elseware-ui 2.37.2 → 2.38.1

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/index.js CHANGED
@@ -6,7 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var bs = require('react-icons/bs');
7
7
  var fa = require('react-icons/fa');
8
8
  var recharts = require('recharts');
9
- var classNames17 = require('classnames');
9
+ var classNames66 = require('classnames');
10
10
  var fa6 = require('react-icons/fa6');
11
11
  var ReactWorldFlags = require('react-world-flags');
12
12
  var emojiFlags = require('emoji-flags');
@@ -18,9 +18,30 @@ var framerMotion = require('framer-motion');
18
18
  var ai = require('react-icons/ai');
19
19
  var reactBeautifulDnd = require('react-beautiful-dnd');
20
20
  var md = require('react-icons/md');
21
- require('@mdxeditor/editor/style.css');
22
- var editor = require('@mdxeditor/editor');
23
21
  var bi = require('react-icons/bi');
22
+ var ReactMarkdown = require('react-markdown');
23
+ var remarkGfm = require('remark-gfm');
24
+ var rehypeRaw = require('rehype-raw');
25
+ var rehypeSanitize = require('rehype-sanitize');
26
+ var reactSyntaxHighlighter = require('react-syntax-highlighter');
27
+ var prism = require('react-syntax-highlighter/dist/esm/styles/prism');
28
+ var bash = require('react-syntax-highlighter/dist/esm/languages/prism/bash');
29
+ var c = require('react-syntax-highlighter/dist/esm/languages/prism/c');
30
+ var cpp = require('react-syntax-highlighter/dist/esm/languages/prism/cpp');
31
+ var css = require('react-syntax-highlighter/dist/esm/languages/prism/css');
32
+ var go = require('react-syntax-highlighter/dist/esm/languages/prism/go');
33
+ var java = require('react-syntax-highlighter/dist/esm/languages/prism/java');
34
+ var javascript = require('react-syntax-highlighter/dist/esm/languages/prism/javascript');
35
+ var json = require('react-syntax-highlighter/dist/esm/languages/prism/json');
36
+ var jsx210 = require('react-syntax-highlighter/dist/esm/languages/prism/jsx');
37
+ var markup = require('react-syntax-highlighter/dist/esm/languages/prism/markup');
38
+ var python = require('react-syntax-highlighter/dist/esm/languages/prism/python');
39
+ var rust = require('react-syntax-highlighter/dist/esm/languages/prism/rust');
40
+ var scss = require('react-syntax-highlighter/dist/esm/languages/prism/scss');
41
+ var sql = require('react-syntax-highlighter/dist/esm/languages/prism/sql');
42
+ var tsx = require('react-syntax-highlighter/dist/esm/languages/prism/tsx');
43
+ var typescript = require('react-syntax-highlighter/dist/esm/languages/prism/typescript');
44
+ var yaml = require('react-syntax-highlighter/dist/esm/languages/prism/yaml');
24
45
 
25
46
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
26
47
 
@@ -43,10 +64,31 @@ function _interopNamespace(e) {
43
64
  }
44
65
 
45
66
  var React2__default = /*#__PURE__*/_interopDefault(React2);
46
- var classNames17__default = /*#__PURE__*/_interopDefault(classNames17);
67
+ var classNames66__default = /*#__PURE__*/_interopDefault(classNames66);
47
68
  var ReactWorldFlags__default = /*#__PURE__*/_interopDefault(ReactWorldFlags);
48
69
  var emojiFlags__default = /*#__PURE__*/_interopDefault(emojiFlags);
49
70
  var d3__namespace = /*#__PURE__*/_interopNamespace(d3);
71
+ var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
72
+ var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
73
+ var rehypeRaw__default = /*#__PURE__*/_interopDefault(rehypeRaw);
74
+ var rehypeSanitize__default = /*#__PURE__*/_interopDefault(rehypeSanitize);
75
+ var bash__default = /*#__PURE__*/_interopDefault(bash);
76
+ var c__default = /*#__PURE__*/_interopDefault(c);
77
+ var cpp__default = /*#__PURE__*/_interopDefault(cpp);
78
+ var css__default = /*#__PURE__*/_interopDefault(css);
79
+ var go__default = /*#__PURE__*/_interopDefault(go);
80
+ var java__default = /*#__PURE__*/_interopDefault(java);
81
+ var javascript__default = /*#__PURE__*/_interopDefault(javascript);
82
+ var json__default = /*#__PURE__*/_interopDefault(json);
83
+ var jsx210__default = /*#__PURE__*/_interopDefault(jsx210);
84
+ var markup__default = /*#__PURE__*/_interopDefault(markup);
85
+ var python__default = /*#__PURE__*/_interopDefault(python);
86
+ var rust__default = /*#__PURE__*/_interopDefault(rust);
87
+ var scss__default = /*#__PURE__*/_interopDefault(scss);
88
+ var sql__default = /*#__PURE__*/_interopDefault(sql);
89
+ var tsx__default = /*#__PURE__*/_interopDefault(tsx);
90
+ var typescript__default = /*#__PURE__*/_interopDefault(typescript);
91
+ var yaml__default = /*#__PURE__*/_interopDefault(yaml);
50
92
 
51
93
  // node_modules/clsx/dist/clsx.mjs
52
94
  function r(e) {
@@ -166,7 +208,7 @@ var CURRENCIES = [
166
208
 
167
209
  // src/utils/currency.ts
168
210
  var getCurrencySymbol = (code) => {
169
- const currency = CURRENCIES.find((c) => c.code === code);
211
+ const currency = CURRENCIES.find((c2) => c2.code === code);
170
212
  return currency ? currency.symbol : null;
171
213
  };
172
214
 
@@ -3760,7 +3802,7 @@ function renderTransitionChild(children, className) {
3760
3802
  }
3761
3803
  const element = child;
3762
3804
  return React2__default.default.cloneElement(element, {
3763
- className: classNames17__default.default(element.props.className, className)
3805
+ className: classNames66__default.default(element.props.className, className)
3764
3806
  });
3765
3807
  }
3766
3808
  function TransitionBase({
@@ -3780,7 +3822,7 @@ function TransitionBase({
3780
3822
  if (!mounted && unmountOnExit) {
3781
3823
  return null;
3782
3824
  }
3783
- const transitionClassName = classNames17__default.default(
3825
+ const transitionClassName = classNames66__default.default(
3784
3826
  visibility ? enterClassName : leaveClassName,
3785
3827
  active ? visibleClassName : hiddenClassName
3786
3828
  );
@@ -3955,7 +3997,7 @@ function Accordion({
3955
3997
  /* @__PURE__ */ jsxRuntime.jsxs(
3956
3998
  "div",
3957
3999
  {
3958
- className: classNames17__default.default(
4000
+ className: classNames66__default.default(
3959
4001
  "inline-flex gap-3 items-center px-3 py-2 w-full eui-gradient-to-r-general-xs",
3960
4002
  {
3961
4003
  "hover:cursor-pointer": toggleOnSummaryClick
@@ -3976,7 +4018,7 @@ function Accordion({
3976
4018
  children: /* @__PURE__ */ jsxRuntime.jsx(
3977
4019
  fa6.FaCircleChevronDown,
3978
4020
  {
3979
- className: classNames17__default.default("text-xl transition-transform duration-300", {
4021
+ className: classNames66__default.default("text-xl transition-transform duration-300", {
3980
4022
  "rotate-180": collapse
3981
4023
  })
3982
4024
  }
@@ -3990,7 +4032,7 @@ function Accordion({
3990
4032
  /* @__PURE__ */ jsxRuntime.jsx(TransitionAccordion_default, { visibility: collapse, children: /* @__PURE__ */ jsxRuntime.jsx(
3991
4033
  "div",
3992
4034
  {
3993
- className: classNames17__default.default(
4035
+ className: classNames66__default.default(
3994
4036
  "border-t border-t-eui-dark-400/40 eui-text-sm",
3995
4037
  {
3996
4038
  "p-5": enableChildrenPadding
@@ -4074,7 +4116,7 @@ function CardHeader({ icon, title, description, className }) {
4074
4116
  return /* @__PURE__ */ jsxRuntime.jsxs(
4075
4117
  "div",
4076
4118
  {
4077
- className: classNames17__default.default(
4119
+ className: classNames66__default.default(
4078
4120
  "flex items-start gap-4 p-6 border-b border-white/10",
4079
4121
  className
4080
4122
  ),
@@ -4090,14 +4132,14 @@ function CardHeader({ icon, title, description, className }) {
4090
4132
  }
4091
4133
  var CardHeader_default = CardHeader;
4092
4134
  function CardContent({ children, className }) {
4093
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames17__default.default("p-6 text-gray-300 text-sm", className), children });
4135
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default("p-6 text-gray-300 text-sm", className), children });
4094
4136
  }
4095
4137
  var CardContent_default = CardContent;
4096
4138
  function CardFooter({ children, className }) {
4097
4139
  return /* @__PURE__ */ jsxRuntime.jsx(
4098
4140
  "div",
4099
4141
  {
4100
- className: classNames17__default.default(
4142
+ className: classNames66__default.default(
4101
4143
  "flex items-center gap-3 p-5 border-t border-white/10 text-sm text-gray-400",
4102
4144
  className
4103
4145
  ),
@@ -4139,7 +4181,7 @@ function GradientAnimation({
4139
4181
  return /* @__PURE__ */ jsxRuntime.jsx(
4140
4182
  "div",
4141
4183
  {
4142
- className: classNames17__default.default("absolute inset-0"),
4184
+ className: classNames66__default.default("absolute inset-0"),
4143
4185
  style: {
4144
4186
  background: `linear-gradient(${cfg.angle}deg, ${cfg.colors?.join(",")})`,
4145
4187
  backgroundSize: cfg.backgroundSize,
@@ -4285,7 +4327,7 @@ function MotionSurface({
4285
4327
  }) {
4286
4328
  const AnimationComponent = animationVariant === "custom" ? CustomAnimation : animationRegistry[animationVariant];
4287
4329
  const OverlayComponent = overlay === "custom" ? CustomOverlay : overlayRegistry[overlay];
4288
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames17__default.default("relative overflow-hidden", className), children: [
4330
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames66__default.default("relative overflow-hidden", className), children: [
4289
4331
  AnimationComponent && /* @__PURE__ */ jsxRuntime.jsx(AnimationComponent, { config: animationConfig, animated }),
4290
4332
  OverlayComponent && /* @__PURE__ */ jsxRuntime.jsx(OverlayComponent, { config: overlayConfig }),
4291
4333
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-10", children })
@@ -5689,7 +5731,7 @@ var Backdrop = ({ children, styles }) => {
5689
5731
  return /* @__PURE__ */ jsxRuntime.jsx(
5690
5732
  "div",
5691
5733
  {
5692
- className: classNames17__default.default({
5734
+ className: classNames66__default.default({
5693
5735
  "bg-black/75 top-0 bottom-0 left-0 right-0 z-50 fixed inset-0 flex items-center justify-center overflow-hidden": true,
5694
5736
  [`${styles}`]: styles
5695
5737
  }),
@@ -6213,7 +6255,7 @@ var Form = ({
6213
6255
  /* @__PURE__ */ jsxRuntime.jsx(UnsavedChangesGuard_default, { formik: formik$1, enabled: warnOnUnsavedChanges }),
6214
6256
  /* @__PURE__ */ jsxRuntime.jsx(DirtyObserver_default, { formik: formik$1, onDirtyChange }),
6215
6257
  /* @__PURE__ */ jsxRuntime.jsx(FormObserver_default, { formik: formik$1, onChange }),
6216
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames17__default.default(styles), children })
6258
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default(styles), children })
6217
6259
  ] })
6218
6260
  }
6219
6261
  );
@@ -6730,7 +6772,7 @@ function FormResponse({
6730
6772
  return /* @__PURE__ */ jsxRuntime.jsx(Transition.TransitionDropdown, { visibility: text ? true : false, children: /* @__PURE__ */ jsxRuntime.jsx(
6731
6773
  "div",
6732
6774
  {
6733
- className: classNames17__default.default({
6775
+ className: classNames66__default.default({
6734
6776
  "font-poppins font-light text-sm": true,
6735
6777
  [`${variantsLite[variant]}`]: variant,
6736
6778
  [`${shapes[shape]}`]: shape,
@@ -6847,7 +6889,7 @@ var ThemeSwitch = () => {
6847
6889
  /* @__PURE__ */ jsxRuntime.jsx(
6848
6890
  "div",
6849
6891
  {
6850
- className: classNames17__default.default(
6892
+ className: classNames66__default.default(
6851
6893
  "w-6 h-6 bg-white dark:bg-gray-600 rounded-full shadow-md transition-transform duration-300",
6852
6894
  theme === "dark" ? "translate-x-8" : "translate-x-0"
6853
6895
  )
@@ -18228,12 +18270,12 @@ function WorldMap({
18228
18270
  const mode = isDarkMode ? mapStyles.dark : mapStyles.light;
18229
18271
  const resolvedData = React2.useMemo(() => {
18230
18272
  return data.map((item) => {
18231
- const c = COUNTRIES.find((x) => x.code === item.code);
18232
- if (!c) return null;
18273
+ const c2 = COUNTRIES.find((x) => x.code === item.code);
18274
+ if (!c2) return null;
18233
18275
  return {
18234
18276
  ...item,
18235
- name: c.name,
18236
- coordinates: c.coordinates
18277
+ name: c2.name,
18278
+ coordinates: c2.coordinates
18237
18279
  };
18238
18280
  }).filter(Boolean);
18239
18281
  }, [data]);
@@ -18395,7 +18437,7 @@ function InputResponse({
18395
18437
  return /* @__PURE__ */ jsxRuntime.jsx(Transition.TransitionDropdown, { visibility, children: /* @__PURE__ */ jsxRuntime.jsx(
18396
18438
  "div",
18397
18439
  {
18398
- className: classNames17__default.default({
18440
+ className: classNames66__default.default({
18399
18441
  "font-medium text-sm py-1 px-2": true,
18400
18442
  [`${textVariants[variant]}`]: variant,
18401
18443
  "transition-all ease-in-out": true,
@@ -18410,7 +18452,7 @@ function InputLabel({ text, children, styles }) {
18410
18452
  return /* @__PURE__ */ jsxRuntime.jsx(
18411
18453
  "label",
18412
18454
  {
18413
- className: classNames17__default.default({
18455
+ className: classNames66__default.default({
18414
18456
  "px-0 eui-text-sm text-[13.5px] pointer-events-none select-none": true,
18415
18457
  "transition-all ease-in-out": true,
18416
18458
  [`${styles}`]: styles
@@ -18462,7 +18504,7 @@ var Input = ({
18462
18504
  ...field,
18463
18505
  ...props,
18464
18506
  placeholder,
18465
- className: classNames17__default.default({
18507
+ className: classNames66__default.default({
18466
18508
  "border peer w-full bg-eui-primary-300/10 pt-5 px-3 pb-2 text-md eui-text-md placeholder-transparent placeholder-shown:p-3 focus:outline-none h-[50px]": true,
18467
18509
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
18468
18510
  "border-eui-danger-500": meta.touched && meta.error,
@@ -18507,7 +18549,7 @@ var InputFile = ({
18507
18549
  /* @__PURE__ */ jsxRuntime.jsx(
18508
18550
  "div",
18509
18551
  {
18510
- className: classNames17__default.default(
18552
+ className: classNames66__default.default(
18511
18553
  "border rounded-sm bg-eui-primary-300/10 px-3 pt-3 text-md text-eui-dark-100 cursor-pointer h-[50px] flex items-center",
18512
18554
  {
18513
18555
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
@@ -18533,7 +18575,7 @@ var InputFile = ({
18533
18575
  InputLabel_default,
18534
18576
  {
18535
18577
  text: placeholder,
18536
- styles: classNames17__default.default({
18578
+ styles: classNames66__default.default({
18537
18579
  "absolute left-2 eui-text-sm peer-placeholder-shown:text-base peer-placeholder-shown:top-3 pointer-events-none": true,
18538
18580
  "top-[0.7px]": showFloatingLabel,
18539
18581
  "top-[13px] text-base": !showFloatingLabel
@@ -18586,7 +18628,7 @@ var InputList = ({ name, placeholder, shape }) => {
18586
18628
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(formik.FieldArray, { name, children: ({ push, remove, move }) => /* @__PURE__ */ jsxRuntime.jsxs(
18587
18629
  "div",
18588
18630
  {
18589
- className: classNames17__default.default(
18631
+ className: classNames66__default.default(
18590
18632
  "flex w-full flex-col space-y-2 bg-eui-primary-300/10",
18591
18633
  shapes[resolvedShape]
18592
18634
  ),
@@ -18615,7 +18657,7 @@ var InputList = ({ name, placeholder, shape }) => {
18615
18657
  ref: provided2.innerRef,
18616
18658
  ...draggableProps,
18617
18659
  style: draggableStyle,
18618
- className: classNames17__default.default(
18660
+ className: classNames66__default.default(
18619
18661
  "flex items-center space-x-2 bg-eui-primary-300/10 p-2",
18620
18662
  shapes[resolvedShape]
18621
18663
  ),
@@ -18626,7 +18668,7 @@ var InputList = ({ name, placeholder, shape }) => {
18626
18668
  {
18627
18669
  name: `${name}[${index}]`,
18628
18670
  placeholder: `Item ${index + 1}`,
18629
- className: classNames17__default.default(
18671
+ className: classNames66__default.default(
18630
18672
  "peer h-[50px] w-full border bg-eui-primary-300/10 px-3 pb-2 pt-5 text-md placeholder-transparent placeholder-shown:p-3 focus:outline-none eui-text-md",
18631
18673
  shapes[resolvedShape],
18632
18674
  hasItemError ? "border-eui-danger-500" : "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18722,7 +18764,7 @@ var InputListGroup = ({
18722
18764
  return /* @__PURE__ */ jsxRuntime.jsxs(
18723
18765
  "div",
18724
18766
  {
18725
- className: classNames17__default.default(
18767
+ className: classNames66__default.default(
18726
18768
  "flex flex-col gap-2 bg-eui-primary-300/10 p-3",
18727
18769
  shapes[resolvedShape]
18728
18770
  ),
@@ -18734,7 +18776,7 @@ var InputListGroup = ({
18734
18776
  {
18735
18777
  name: `${name}[${groupIndex}].name`,
18736
18778
  placeholder: `Group ${groupIndex + 1}`,
18737
- className: classNames17__default.default(
18779
+ className: classNames66__default.default(
18738
18780
  "h-[40px] w-full border bg-eui-primary-300/10 px-3 py-2 text-md focus:outline-none",
18739
18781
  shapes[resolvedShape],
18740
18782
  "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18765,7 +18807,7 @@ var InputListGroup = ({
18765
18807
  {
18766
18808
  ref: provided.innerRef,
18767
18809
  ...provided.droppableProps,
18768
- className: classNames17__default.default(
18810
+ className: classNames66__default.default(
18769
18811
  "space-y-2 bg-eui-primary-300/10 p-2",
18770
18812
  shapes[resolvedShape]
18771
18813
  ),
@@ -18785,7 +18827,7 @@ var InputListGroup = ({
18785
18827
  ref: provided2.innerRef,
18786
18828
  ...draggableProps,
18787
18829
  style: draggableStyle,
18788
- className: classNames17__default.default(
18830
+ className: classNames66__default.default(
18789
18831
  "flex items-center gap-2 bg-eui-primary-300/10 p-2",
18790
18832
  shapes[resolvedShape]
18791
18833
  ),
@@ -18796,7 +18838,7 @@ var InputListGroup = ({
18796
18838
  {
18797
18839
  name: `${itemsFieldName}[${itemIndex}]`,
18798
18840
  placeholder: `Item ${itemIndex + 1}`,
18799
- className: classNames17__default.default(
18841
+ className: classNames66__default.default(
18800
18842
  "h-[40px] w-full border bg-eui-primary-300/10 px-3 py-2 text-md focus:outline-none",
18801
18843
  shapes[resolvedShape],
18802
18844
  "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -19010,7 +19052,7 @@ var DateSelector = ({
19010
19052
  ...field,
19011
19053
  ...props,
19012
19054
  placeholder,
19013
- className: classNames17__default.default({
19055
+ className: classNames66__default.default({
19014
19056
  "border border-eui-primary-400 peer w-full bg-eui-primary-300/10 pt-5 px-3 pb-2 text-md eui-text-md placeholder-transparent placeholder-shown:p-3 focus:border-eui-secondary-500 focus:outline-none h-[50px]": true,
19015
19057
  "border-eui-danger-500": meta.touched && meta.error,
19016
19058
  "transition-all ease-in-out": true,
@@ -19119,7 +19161,7 @@ var ImageInput = React2.forwardRef(
19119
19161
  /* @__PURE__ */ jsxRuntime.jsxs(
19120
19162
  "label",
19121
19163
  {
19122
- className: classNames17__default.default({
19164
+ className: classNames66__default.default({
19123
19165
  "border-2 border-dashed border-gray-700 bg-gray-900 h-[200px] w-[300px] flex flex-col gap-2 items-center justify-center group": true,
19124
19166
  "hover:cursor-pointer hover:border-solid hover:border-gray-600 hover:bg-gray-900/80": true,
19125
19167
  "transition-all ease-in-out duration-150": true
@@ -19236,7 +19278,7 @@ function Radio({
19236
19278
  return /* @__PURE__ */ jsxRuntime.jsxs(
19237
19279
  "div",
19238
19280
  {
19239
- className: classNames17__default.default({
19281
+ className: classNames66__default.default({
19240
19282
  "flex flex-row gap-2 items-center mx-1 my-2": true
19241
19283
  }),
19242
19284
  children: [
@@ -19249,7 +19291,7 @@ function Radio({
19249
19291
  ...props,
19250
19292
  value: option.value,
19251
19293
  checked: field2.value === option.value,
19252
- className: classNames17__default.default({
19294
+ className: classNames66__default.default({
19253
19295
  "appearance-none w-4 h-4 border-2 border-eui-primary-400 rounded-full cursor-pointer transition-all duration-300": true,
19254
19296
  // base radio button styles
19255
19297
  "checked:bg-eui-secondary-700 checked:border-eui-primary-400": field2.value === option.value
@@ -19261,7 +19303,7 @@ function Radio({
19261
19303
  "label",
19262
19304
  {
19263
19305
  htmlFor: option.value,
19264
- className: classNames17__default.default({
19306
+ className: classNames66__default.default({
19265
19307
  "eui-text-md text-sm": true
19266
19308
  }),
19267
19309
  children: option.label
@@ -19304,7 +19346,7 @@ function StarRatingInput({
19304
19346
  return /* @__PURE__ */ jsxRuntime.jsxs(
19305
19347
  "div",
19306
19348
  {
19307
- className: classNames17__default.default({
19349
+ className: classNames66__default.default({
19308
19350
  "inline-flex gap-[4px] text-[20px]": true,
19309
19351
  [`${styles}`]: styles
19310
19352
  }),
@@ -19317,7 +19359,7 @@ function StarRatingInput({
19317
19359
  onClick: () => handleOnClick(index),
19318
19360
  onMouseEnter: () => setHover(index),
19319
19361
  onMouseLeave: () => setHover(null),
19320
- className: classNames17__default.default({
19362
+ className: classNames66__default.default({
19321
19363
  "text-yellow-600": index <= (hover ?? rating - 1),
19322
19364
  "text-gray-400": index > (hover ?? rating - 1)
19323
19365
  }),
@@ -19361,7 +19403,7 @@ function Select({
19361
19403
  {
19362
19404
  as: "select",
19363
19405
  ...props,
19364
- className: classNames17__default.default({
19406
+ className: classNames66__default.default({
19365
19407
  "border peer w-full bg-eui-primary-300/10 pt-5 px-3 pb-2 text-md eui-text-md placeholder-transparent placeholder-shown:p-3 focus:border-eui-secondary-500 focus:outline-none h-[50px]": true,
19366
19408
  "border-eui-primary-400": !(meta.touched && meta.error),
19367
19409
  "border-red-500": meta.touched && meta.error,
@@ -19413,7 +19455,7 @@ function Switch({
19413
19455
  "div",
19414
19456
  {
19415
19457
  onClick: () => helpers.setValue(!field.value),
19416
- className: classNames17__default.default(
19458
+ className: classNames66__default.default(
19417
19459
  "w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer dark:bg-eui-dark-100",
19418
19460
  "peer-checked:after:translate-x-full peer-checked:after:border-white",
19419
19461
  "after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white",
@@ -19470,7 +19512,7 @@ function Tags({
19470
19512
  /* @__PURE__ */ jsxRuntime.jsxs(
19471
19513
  "div",
19472
19514
  {
19473
- className: classNames17__default.default(
19515
+ className: classNames66__default.default(
19474
19516
  "border rounded-sm flex flex-wrap items-center gap-2 px-2 pt-2 pb-6 min-h-[3rem]",
19475
19517
  {
19476
19518
  "bg-eui-primary-300/10 eui-text-md": true,
@@ -19518,7 +19560,7 @@ function Tags({
19518
19560
  InputLabel_default,
19519
19561
  {
19520
19562
  text: placeholder,
19521
- styles: classNames17__default.default(
19563
+ styles: classNames66__default.default(
19522
19564
  "absolute left-2 transition-all pointer-events-none text-eui-dark-200",
19523
19565
  input.length > 0 || field.value.length > 0 ? "top-[2px] text-[13.5px]" : "top-3 text-base"
19524
19566
  )
@@ -19559,7 +19601,7 @@ function TextArea({
19559
19601
  as: "textarea",
19560
19602
  ...field,
19561
19603
  ...props,
19562
- className: classNames17__default.default({
19604
+ className: classNames66__default.default({
19563
19605
  "border peer w-full bg-eui-primary-300/10 eui-text-md outline-none px-3 py-5 resize-none focus:resize-none focus:outline-none": true,
19564
19606
  "transition-all ease-in-out": true,
19565
19607
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
@@ -19573,7 +19615,7 @@ function TextArea({
19573
19615
  InputLabel_default,
19574
19616
  {
19575
19617
  text: placeholder,
19576
- styles: classNames17__default.default(
19618
+ styles: classNames66__default.default(
19577
19619
  "absolute left-2 transition-all pointer-events-none text-eui-dark-200",
19578
19620
  field.value ? "top-[2px] text-[13.5px]" : "top-3 text-base"
19579
19621
  )
@@ -19602,7 +19644,7 @@ var ContentArea = React2.forwardRef(
19602
19644
  "div",
19603
19645
  {
19604
19646
  ref,
19605
- className: classNames17__default.default({
19647
+ className: classNames66__default.default({
19606
19648
  "min-h-screen h-full w-full transition-all duration-[200ms]": true,
19607
19649
  "py-3 px-5": !enablePadding,
19608
19650
  "py-3 px-5 lg:px-[150px]": enablePadding,
@@ -19619,7 +19661,7 @@ function FlexCol({ children, gap = 3, styles }) {
19619
19661
  return /* @__PURE__ */ jsxRuntime.jsx(
19620
19662
  "div",
19621
19663
  {
19622
- className: classNames17__default.default({
19664
+ className: classNames66__default.default({
19623
19665
  [`flex flex-col gap-${gap}`]: true,
19624
19666
  [`${styles}`]: styles
19625
19667
  }),
@@ -19632,7 +19674,7 @@ function FlexRow({ children, gap = 3, styles }) {
19632
19674
  return /* @__PURE__ */ jsxRuntime.jsx(
19633
19675
  "div",
19634
19676
  {
19635
- className: classNames17__default.default({
19677
+ className: classNames66__default.default({
19636
19678
  [`flex flex-row gap-${gap}`]: true,
19637
19679
  [`${styles}`]: styles
19638
19680
  }),
@@ -19651,7 +19693,7 @@ function Grid({ children, styles }) {
19651
19693
  return /* @__PURE__ */ jsxRuntime.jsx(
19652
19694
  "div",
19653
19695
  {
19654
- className: classNames17__default.default({
19696
+ className: classNames66__default.default({
19655
19697
  [`grid`]: true,
19656
19698
  [`${styles}`]: styles
19657
19699
  }),
@@ -19668,7 +19710,7 @@ var Layout = ({
19668
19710
  return /* @__PURE__ */ jsxRuntime.jsx(
19669
19711
  "div",
19670
19712
  {
19671
- className: classNames17__default.default({
19713
+ className: classNames66__default.default({
19672
19714
  // "flex h-full w-screen bg-gray-100 overflow-auto": true,
19673
19715
  "flex bg-eui-light-600": true,
19674
19716
  "flex-col": flexDirection === "vertical",
@@ -19687,7 +19729,7 @@ var Header = ({
19687
19729
  return /* @__PURE__ */ jsxRuntime.jsx(
19688
19730
  "div",
19689
19731
  {
19690
- className: classNames17__default.default({
19732
+ className: classNames66__default.default({
19691
19733
  static: position === "static",
19692
19734
  fixed: position === "fixed",
19693
19735
  sticky: position === "sticky",
@@ -19727,7 +19769,7 @@ var Content = ({
19727
19769
  return /* @__PURE__ */ jsxRuntime.jsx(
19728
19770
  "div",
19729
19771
  {
19730
- className: classNames17__default.default({
19772
+ className: classNames66__default.default({
19731
19773
  "w-full min-h-screen transition-all duration-200 eui-bg-sm": true,
19732
19774
  "md:pl-[300px]": !overlayedSidebar && sidebarVisible && !isMobile,
19733
19775
  // Shift when sidebar is open (desktop)
@@ -19743,7 +19785,7 @@ var Footer = ({ children, styles }) => {
19743
19785
  return /* @__PURE__ */ jsxRuntime.jsx(
19744
19786
  "div",
19745
19787
  {
19746
- className: classNames17__default.default({
19788
+ className: classNames66__default.default({
19747
19789
  "bottom-0 w-full h-fit": true,
19748
19790
  "border-t border-eui-dark-500/40 dark:border-eui-secondary-800 eui-bg-md": !styles,
19749
19791
  [`${styles}`]: styles
@@ -19816,269 +19858,6 @@ function BlockGroup({
19816
19858
  ] });
19817
19859
  }
19818
19860
  var BlockGroup_default = BlockGroup;
19819
- var useTheme = () => {
19820
- const context = React2.useContext(ThemeContext);
19821
- if (!context) {
19822
- throw new Error("useTheme must be used within a ThemeProvider");
19823
- }
19824
- return context;
19825
- };
19826
- var useTheme_default = useTheme;
19827
- function MarkdownEditor({
19828
- styles,
19829
- ...props
19830
- }) {
19831
- const [field, meta, helpers] = formik.useField(props);
19832
- const { theme } = useTheme_default();
19833
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
19834
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames17__default.default(theme === "dark" ? "dark" : "", styles), children: /* @__PURE__ */ jsxRuntime.jsx(
19835
- editor.MDXEditor,
19836
- {
19837
- markdown: field.value,
19838
- onChange: (val) => helpers.setValue(val),
19839
- className: "rounded border border-gray-300 dark:border-gray-700",
19840
- plugins: [
19841
- editor.headingsPlugin(),
19842
- editor.linkPlugin(),
19843
- editor.listsPlugin(),
19844
- editor.imagePlugin(),
19845
- editor.tablePlugin(),
19846
- editor.linkDialogPlugin({}),
19847
- editor.thematicBreakPlugin(),
19848
- editor.quotePlugin(),
19849
- editor.toolbarPlugin({
19850
- toolbarContents: () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19851
- /* @__PURE__ */ jsxRuntime.jsx(editor.UndoRedo, {}),
19852
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19853
- /* @__PURE__ */ jsxRuntime.jsx(editor.BlockTypeSelect, {}),
19854
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19855
- /* @__PURE__ */ jsxRuntime.jsx(editor.BoldItalicUnderlineToggles, {}),
19856
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19857
- /* @__PURE__ */ jsxRuntime.jsx(editor.StrikeThroughSupSubToggles, {}),
19858
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19859
- /* @__PURE__ */ jsxRuntime.jsx(editor.ListsToggle, {}),
19860
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19861
- /* @__PURE__ */ jsxRuntime.jsx(editor.CreateLink, {}),
19862
- /* @__PURE__ */ jsxRuntime.jsx(editor.InsertImage, {}),
19863
- /* @__PURE__ */ jsxRuntime.jsx(editor.Separator, {}),
19864
- /* @__PURE__ */ jsxRuntime.jsx(editor.InsertTable, {}),
19865
- /* @__PURE__ */ jsxRuntime.jsx(editor.InsertThematicBreak, {})
19866
- ] })
19867
- })
19868
- ]
19869
- }
19870
- ) }),
19871
- /* @__PURE__ */ jsxRuntime.jsx(
19872
- InputResponse_default,
19873
- {
19874
- name: field.name,
19875
- visibility: meta.touched && meta.error ? true : false,
19876
- variant: "danger"
19877
- }
19878
- )
19879
- ] });
19880
- }
19881
- var MarkdownEditor_default = MarkdownEditor;
19882
- var MarkdownContext = React2.createContext(null);
19883
-
19884
- // src/components/markdown/hooks/useMarkdown.tsx
19885
- function useMarkdown() {
19886
- return React2.useContext(MarkdownContext);
19887
- }
19888
-
19889
- // src/components/markdown/utils/generateHeadingNumbers.ts
19890
- function generateHeadingNumbers(headings) {
19891
- const counters = [0, 0, 0, 0, 0, 0];
19892
- return headings.map((heading) => {
19893
- const level = heading.level;
19894
- counters[level - 1]++;
19895
- for (let i = level; i < counters.length; i++) {
19896
- counters[i] = 0;
19897
- }
19898
- const numbering = counters.slice(0, level).filter((n) => n > 0).join(".");
19899
- return {
19900
- ...heading,
19901
- numbering
19902
- };
19903
- });
19904
- }
19905
-
19906
- // src/components/markdown/utils/sanitizeHeading.ts
19907
- function sanitizeHeading(text) {
19908
- return text.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu, "").replace(/\s+/g, " ").trim();
19909
- }
19910
- function MarkdownTOC({ title = "Table of Contents" }) {
19911
- const context = useMarkdown();
19912
- if (!context) {
19913
- return null;
19914
- }
19915
- const { headings, activeHeading } = context;
19916
- const numberedHeadings = generateHeadingNumbers(headings);
19917
- const scrollToHeading = (id) => {
19918
- const element = document.getElementById(id);
19919
- if (!element) return;
19920
- element.scrollIntoView({
19921
- behavior: "smooth",
19922
- block: "start"
19923
- });
19924
- };
19925
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
19926
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
19927
- "h2",
19928
- {
19929
- className: "\n text-sm\n font-semibold\n uppercase\n tracking-wide\n text-gray-900\n dark:text-gray-100\n ",
19930
- children: title
19931
- }
19932
- ) }),
19933
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: numberedHeadings.map((heading) => /* @__PURE__ */ jsxRuntime.jsxs(
19934
- "button",
19935
- {
19936
- onClick: () => scrollToHeading(heading.id),
19937
- className: classNames17__default.default(
19938
- "block w-full text-left text-sm transition-all ease-in-out duration-150",
19939
- "hover:text-primary",
19940
- activeHeading === heading.id ? "text-primary font-semibold underline" : "text-gray-500 dark:text-gray-400"
19941
- ),
19942
- style: {
19943
- paddingLeft: `${(heading.level - 1) * 12}px`
19944
- },
19945
- children: [
19946
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 opacity-70", children: heading.numbering }),
19947
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: sanitizeHeading(heading.text) })
19948
- ]
19949
- },
19950
- heading.id
19951
- )) })
19952
- ] });
19953
- }
19954
- var MarkdownTOC_default = MarkdownTOC;
19955
- function MarkdownViewer({ value }) {
19956
- const { theme } = useTheme_default();
19957
- const context = useMarkdown();
19958
- const markdown = value ?? context?.markdown ?? "";
19959
- const headings = context?.headings ?? [];
19960
- const setActiveHeading = context?.setActiveHeading;
19961
- React2.useEffect(() => {
19962
- const timeout = setTimeout(() => {
19963
- headings.forEach((heading) => {
19964
- const headingEls = document.querySelectorAll("h1,h2,h3,h4,h5,h6");
19965
- headingEls.forEach((el) => {
19966
- if (el.textContent?.trim() === heading.text.trim()) {
19967
- el.id = heading.id;
19968
- }
19969
- });
19970
- });
19971
- if (!setActiveHeading) return;
19972
- const observer = new IntersectionObserver(
19973
- (entries) => {
19974
- entries.forEach((entry) => {
19975
- if (entry.isIntersecting) {
19976
- setActiveHeading(entry.target.id);
19977
- }
19978
- });
19979
- },
19980
- {
19981
- rootMargin: "-20% 0px -70% 0px"
19982
- }
19983
- );
19984
- headings.forEach((heading) => {
19985
- const el = document.getElementById(heading.id);
19986
- if (el) {
19987
- observer.observe(el);
19988
- }
19989
- });
19990
- return () => observer.disconnect();
19991
- }, 0);
19992
- return () => clearTimeout(timeout);
19993
- }, [headings, setActiveHeading]);
19994
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme === "dark" ? "dark" : "", children: /* @__PURE__ */ jsxRuntime.jsx(
19995
- editor.MDXEditor,
19996
- {
19997
- markdown,
19998
- readOnly: true,
19999
- className: "markdown-body max-w-none",
20000
- plugins: [
20001
- editor.headingsPlugin(),
20002
- editor.linkPlugin(),
20003
- editor.listsPlugin(),
20004
- editor.imagePlugin(),
20005
- editor.tablePlugin(),
20006
- editor.quotePlugin(),
20007
- editor.thematicBreakPlugin(),
20008
- editor.linkDialogPlugin({}),
20009
- editor.markdownShortcutPlugin(),
20010
- editor.frontmatterPlugin(),
20011
- editor.codeBlockPlugin({
20012
- defaultCodeBlockLanguage: "txt",
20013
- codeBlockEditorDescriptors: []
20014
- }),
20015
- editor.codeMirrorPlugin({
20016
- codeBlockLanguages: {
20017
- js: "JavaScript",
20018
- ts: "TypeScript",
20019
- jsx: "React JSX",
20020
- tsx: "React TSX",
20021
- html: "HTML",
20022
- css: "CSS",
20023
- scss: "SCSS",
20024
- json: "JSON",
20025
- bash: "Bash",
20026
- shell: "Shell",
20027
- zsh: "ZSH",
20028
- yaml: "YAML",
20029
- yml: "YAML",
20030
- md: "Markdown",
20031
- py: "Python",
20032
- java: "Java",
20033
- cpp: "C++",
20034
- c: "C",
20035
- go: "Go",
20036
- rust: "Rust",
20037
- php: "PHP",
20038
- sql: "SQL"
20039
- }
20040
- })
20041
- ]
20042
- },
20043
- markdown
20044
- ) });
20045
- }
20046
- var MarkdownViewer_default = MarkdownViewer;
20047
-
20048
- // src/components/markdown/utils/slugify.ts
20049
- function slugify(text) {
20050
- return text.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-");
20051
- }
20052
-
20053
- // src/components/markdown/utils/extractHeadings.ts
20054
- function extractHeadings(markdown) {
20055
- return markdown.split("\n").filter((line) => /^#{1,6}\s/.test(line)).map((line) => {
20056
- const level = line.match(/^#+/)?.[0].length || 1;
20057
- const text = line.replace(/^#{1,6}\s/, "");
20058
- return {
20059
- id: slugify(text),
20060
- text,
20061
- level
20062
- };
20063
- });
20064
- }
20065
- function MarkdownProvider({ markdown, children }) {
20066
- const [activeHeading, setActiveHeading] = React2.useState("");
20067
- const headings = React2.useMemo(() => extractHeadings(markdown), [markdown]);
20068
- return /* @__PURE__ */ jsxRuntime.jsx(
20069
- MarkdownContext.Provider,
20070
- {
20071
- value: {
20072
- markdown,
20073
- headings,
20074
- activeHeading,
20075
- setActiveHeading
20076
- },
20077
- children
20078
- }
20079
- );
20080
- }
20081
- var MarkdownProvider_default = MarkdownProvider;
20082
19861
  function BreadcrumbItem({
20083
19862
  title,
20084
19863
  href = "#",
@@ -20090,7 +19869,7 @@ function BreadcrumbItem({
20090
19869
  {
20091
19870
  href,
20092
19871
  onClick,
20093
- className: classNames17__default.default({
19872
+ className: classNames66__default.default({
20094
19873
  "text-lg font-semibold": true,
20095
19874
  "text-gray-400 hover:text-gray-600 cursor-pointer": !active,
20096
19875
  "text-eui-light-800": active,
@@ -20167,7 +19946,7 @@ var Breadcrumb = ({
20167
19946
  index < resolvedData.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
20168
19947
  "span",
20169
19948
  {
20170
- className: classNames17__default.default({
19949
+ className: classNames66__default.default({
20171
19950
  "text-lg font-semibold text-gray-500": true,
20172
19951
  [`px-${gap}`]: gap
20173
19952
  }),
@@ -20181,7 +19960,7 @@ var Breadcrumb = ({
20181
19960
  return /* @__PURE__ */ jsxRuntime.jsx(
20182
19961
  "div",
20183
19962
  {
20184
- className: classNames17__default.default({
19963
+ className: classNames66__default.default({
20185
19964
  "inline-flex": true,
20186
19965
  [`${styles}`]: styles
20187
19966
  }),
@@ -20213,7 +19992,7 @@ var Drawer = ({
20213
19992
  isMobile && showBackdrop && /* @__PURE__ */ jsxRuntime.jsx(TransitionFade_default, { visibility, leaveDuration: 200, children: /* @__PURE__ */ jsxRuntime.jsx(
20214
19993
  "div",
20215
19994
  {
20216
- className: classNames17__default.default(
19995
+ className: classNames66__default.default(
20217
19996
  "fixed inset-0 bg-black/50 z-40",
20218
19997
  backdropStyles
20219
19998
  ),
@@ -20224,7 +20003,7 @@ var Drawer = ({
20224
20003
  "div",
20225
20004
  {
20226
20005
  style: drawerStyle,
20227
- className: classNames17__default.default(
20006
+ className: classNames66__default.default(
20228
20007
  "fixed shadow-lg z-50",
20229
20008
  {
20230
20009
  "h-full w-[300px] top-0": isHorizontal && !hasOffset,
@@ -20253,7 +20032,7 @@ function DrawerToggler({
20253
20032
  return /* @__PURE__ */ jsxRuntime.jsx(
20254
20033
  "div",
20255
20034
  {
20256
- className: classNames17__default.default({
20035
+ className: classNames66__default.default({
20257
20036
  "text-xl p-3 cursor-pointer": true,
20258
20037
  "transition-all ease-in-out": true,
20259
20038
  "text-eui-dark-500 dark:text-eui-secondary-600": !styles,
@@ -20301,7 +20080,7 @@ function FooterNav({ data = [], styles }) {
20301
20080
  childrenContent = /* @__PURE__ */ jsxRuntime.jsx(
20302
20081
  "div",
20303
20082
  {
20304
- className: classNames17__default.default({
20083
+ className: classNames66__default.default({
20305
20084
  "grid w-full": true,
20306
20085
  "grid-cols-1": isMobile,
20307
20086
  "grid-cols-3": !isMobile,
@@ -20314,7 +20093,7 @@ function FooterNav({ data = [], styles }) {
20314
20093
  return /* @__PURE__ */ jsxRuntime.jsx(
20315
20094
  "div",
20316
20095
  {
20317
- className: classNames17__default.default({
20096
+ className: classNames66__default.default({
20318
20097
  [`${styles}`]: styles
20319
20098
  }),
20320
20099
  children: childrenContent
@@ -20355,7 +20134,7 @@ var FooterNavGroup = ({
20355
20134
  /* @__PURE__ */ jsxRuntime.jsx(
20356
20135
  "div",
20357
20136
  {
20358
- className: classNames17__default.default({
20137
+ className: classNames66__default.default({
20359
20138
  "": true,
20360
20139
  "py-2 font-semibold eui-text-lg": !styles,
20361
20140
  [`${styles}`]: styles
@@ -20400,7 +20179,7 @@ var FooterNavItem = ({
20400
20179
  "div",
20401
20180
  {
20402
20181
  onClick: handleNavigation,
20403
- className: classNames17__default.default({
20182
+ className: classNames66__default.default({
20404
20183
  "flex flex-row items-center gap-3 cursor-pointer p-1 w-full": true,
20405
20184
  "transition-all duration-200 ease-in-out": true,
20406
20185
  "text-sm eui-text-sm": !styles,
@@ -20429,7 +20208,7 @@ var FooterNavItemTitle = ({
20429
20208
  return /* @__PURE__ */ jsxRuntime.jsx(
20430
20209
  "div",
20431
20210
  {
20432
- className: classNames17__default.default({
20211
+ className: classNames66__default.default({
20433
20212
  "": true,
20434
20213
  "py-2 font-thin eui-text-md": !styles,
20435
20214
  [`${styles}`]: styles
@@ -20482,7 +20261,7 @@ function HeaderNav({ data = [], styles }) {
20482
20261
  return /* @__PURE__ */ jsxRuntime.jsx(
20483
20262
  "div",
20484
20263
  {
20485
- className: classNames17__default.default({
20264
+ className: classNames66__default.default({
20486
20265
  [`${styles}`]: styles
20487
20266
  }),
20488
20267
  children: childrenContent
@@ -20544,7 +20323,7 @@ var HeaderNavGroup = ({
20544
20323
  /* @__PURE__ */ jsxRuntime.jsxs(
20545
20324
  "div",
20546
20325
  {
20547
- className: classNames17__default.default({
20326
+ className: classNames66__default.default({
20548
20327
  "flex flex-row gap-2 items-center justify-between cursor-pointer p-3 w-full": true,
20549
20328
  "transition-all duration-300 ease-in-out": true,
20550
20329
  "eui-text-md bg-gradient-to-t from-eui-dark-500/10 dark:from-green-700/10": !styles,
@@ -20572,7 +20351,7 @@ var HeaderNavGroup = ({
20572
20351
  children && /* @__PURE__ */ jsxRuntime.jsx(
20573
20352
  bs.BsChevronDown,
20574
20353
  {
20575
- className: classNames17__default.default({
20354
+ className: classNames66__default.default({
20576
20355
  "text-md": true,
20577
20356
  "transition-all ease-in-out duration-300": true,
20578
20357
  "rotate-180": !collapsed
@@ -20585,7 +20364,7 @@ var HeaderNavGroup = ({
20585
20364
  !collapsed && children && /* @__PURE__ */ jsxRuntime.jsx(
20586
20365
  "div",
20587
20366
  {
20588
- className: classNames17__default.default({
20367
+ className: classNames66__default.default({
20589
20368
  "absolute min-w-80 left-0 top-full mt-1 border border-eui-dark-300/10 dark:border-eui-dark-300/50 shadow-lg eui-shadow-lg z-50 w-full eui-bg-md": true,
20590
20369
  "transition-all duration-300 ease-in-out": true
20591
20370
  }),
@@ -20615,7 +20394,7 @@ var HeaderNavItem = ({
20615
20394
  "div",
20616
20395
  {
20617
20396
  onClick: handleNavigation,
20618
- className: classNames17__default.default({
20397
+ className: classNames66__default.default({
20619
20398
  "flex flex-row items-center gap-3 cursor-pointer p-3 w-full": true,
20620
20399
  "transition-all duration-200 ease-in-out": true,
20621
20400
  "eui-text-md border-b border-eui-dark-500/20 dark:border-eui-secondary-900/20 bg-gradient-to-r from-eui-dark-500/10 dark:from-eui-secondary-900/10": !styles,
@@ -20644,7 +20423,7 @@ var HeaderNavItemTitle = ({
20644
20423
  return /* @__PURE__ */ jsxRuntime.jsx(
20645
20424
  "div",
20646
20425
  {
20647
- className: classNames17__default.default({
20426
+ className: classNames66__default.default({
20648
20427
  "p-3 font-thin": true,
20649
20428
  "eui-text-md": !styles,
20650
20429
  [`${styles}`]: styles
@@ -20684,7 +20463,7 @@ var Link = ({
20684
20463
  href: href || "#",
20685
20464
  target: targets[target],
20686
20465
  onClick: handleClick,
20687
- className: classNames17__default.default({
20466
+ className: classNames66__default.default({
20688
20467
  [`${textVariants[variant]}`]: variant,
20689
20468
  [`${decorations[decoration]}`]: decoration,
20690
20469
  "font-bold": bold,
@@ -21334,7 +21113,7 @@ function Modal({
21334
21113
  "div",
21335
21114
  {
21336
21115
  ref: modalRef,
21337
- className: classNames17__default.default(
21116
+ className: classNames66__default.default(
21338
21117
  "eui-bg-md eui-shadow-lg border border-gray-700/80 w-fit h-fit",
21339
21118
  shapes[resolvedShape],
21340
21119
  styles
@@ -21346,7 +21125,7 @@ function Modal({
21346
21125
  "button",
21347
21126
  {
21348
21127
  type: "button",
21349
- className: classNames17__default.default(
21128
+ className: classNames66__default.default(
21350
21129
  "w-[60px] h-[60px] flex items-center justify-center transition-standard-fast",
21351
21130
  "hover:cursor-pointer hover:bg-eui-dark-500"
21352
21131
  ),
@@ -21480,7 +21259,7 @@ function ShowMore({ text, limit }) {
21480
21259
  /* @__PURE__ */ jsxRuntime.jsx(
21481
21260
  "div",
21482
21261
  {
21483
- className: classNames17__default.default({
21262
+ className: classNames66__default.default({
21484
21263
  "text-blue-300 px-1 pb-1 mt-1": true,
21485
21264
  "bg-slate-900/70": !showMore,
21486
21265
  "bg-gradient-to-t from-slate-900/50 to-transparent": showMore
@@ -21796,6 +21575,14 @@ var useModal = () => {
21796
21575
  };
21797
21576
  };
21798
21577
  var useModal_default = useModal;
21578
+ var useTheme = () => {
21579
+ const context = React2.useContext(ThemeContext);
21580
+ if (!context) {
21581
+ throw new Error("useTheme must be used within a ThemeProvider");
21582
+ }
21583
+ return context;
21584
+ };
21585
+ var useTheme_default = useTheme;
21799
21586
  function CommentMenuItem({
21800
21587
  icon,
21801
21588
  name,
@@ -22371,11 +22158,78 @@ function DataViewTable({
22371
22158
  );
22372
22159
  }
22373
22160
  var DataViewTable_default = DataViewTable;
22374
- function DocumentationPanel({ value, toc = true }) {
22375
- return /* @__PURE__ */ jsxRuntime.jsx(MarkdownProvider_default, { markdown: value, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-screen overflow-hidden grid grid-cols-[minmax(0,1fr)_280px] gap-10", children: [
22376
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "documentation_scrollbar min-w-0 h-screen overflow-y-auto scroll-smooth", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-4xl mx-auto px-6", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownViewer_default, {}) }) }),
22377
- toc && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden lg:block h-screen border-l border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "documentation_scrollbar h-full overflow-y-auto px-6 pt-0 pb-10", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownTOC_default, {}) }) })
22378
- ] }) });
22161
+ function toCssSize(value) {
22162
+ if (typeof value === "number") return `${value}px`;
22163
+ return value;
22164
+ }
22165
+ function DocumentationPanel({
22166
+ value,
22167
+ toc = true,
22168
+ height = "100vh",
22169
+ viewerClassName,
22170
+ contentClassName,
22171
+ tocClassName,
22172
+ className,
22173
+ contentMaxWidthClassName = "max-w-4xl"
22174
+ }) {
22175
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownProvider_default, { markdown: value, children: /* @__PURE__ */ jsxRuntime.jsxs(
22176
+ "section",
22177
+ {
22178
+ className: classNames66__default.default(
22179
+ "eui-documentation-panel",
22180
+ "min-h-0 overflow-hidden bg-white text-gray-900",
22181
+ "dark:bg-gray-950 dark:text-gray-100",
22182
+ toc ? "grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]" : "grid grid-cols-1",
22183
+ className
22184
+ ),
22185
+ style: {
22186
+ height: toCssSize(height)
22187
+ },
22188
+ children: [
22189
+ /* @__PURE__ */ jsxRuntime.jsx(
22190
+ "main",
22191
+ {
22192
+ className: classNames66__default.default(
22193
+ "eui-documentation-panel-viewer",
22194
+ "documentation-panel-scrollbar min-w-0 overflow-y-auto scroll-smooth",
22195
+ viewerClassName
22196
+ ),
22197
+ children: /* @__PURE__ */ jsxRuntime.jsx(
22198
+ "div",
22199
+ {
22200
+ className: classNames66__default.default(
22201
+ "mx-auto px-5 py-8 sm:px-6 lg:px-8",
22202
+ contentMaxWidthClassName,
22203
+ contentClassName
22204
+ ),
22205
+ children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownViewer_default, {})
22206
+ }
22207
+ )
22208
+ }
22209
+ ),
22210
+ toc ? /* @__PURE__ */ jsxRuntime.jsx(
22211
+ "aside",
22212
+ {
22213
+ className: classNames66__default.default(
22214
+ "eui-documentation-panel-toc",
22215
+ "hidden min-w-0 border-l border-gray-200 bg-white lg:block",
22216
+ "dark:border-gray-800 dark:bg-gray-950",
22217
+ tocClassName
22218
+ ),
22219
+ children: /* @__PURE__ */ jsxRuntime.jsx(
22220
+ "div",
22221
+ {
22222
+ className: classNames66__default.default(
22223
+ "documentation-panel-scrollbar h-full overflow-y-auto px-5 py-8"
22224
+ ),
22225
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky top-0", children: /* @__PURE__ */ jsxRuntime.jsx(MarkdownTOC_default, {}) })
22226
+ }
22227
+ )
22228
+ }
22229
+ ) : null
22230
+ ]
22231
+ }
22232
+ ) });
22379
22233
  }
22380
22234
  var DocumentationPanel_default = DocumentationPanel;
22381
22235
  function SliderItem({
@@ -22551,7 +22405,7 @@ function WorldMapCountryTable({
22551
22405
  }) {
22552
22406
  const enrichedData = React2.useMemo(() => {
22553
22407
  const mapped = data.map((item) => {
22554
- const countryMeta = COUNTRIES.find((c) => c.code === item.code);
22408
+ const countryMeta = COUNTRIES.find((c2) => c2.code === item.code);
22555
22409
  return {
22556
22410
  code: item.code,
22557
22411
  value: item.value,
@@ -22641,7 +22495,7 @@ function BoxNavItem({ icon, name, to, selected, onClick }) {
22641
22495
  type: "button",
22642
22496
  onClick: handleClick,
22643
22497
  "aria-current": selected ? "page" : void 0,
22644
- className: classNames17__default.default(
22498
+ className: classNames66__default.default(
22645
22499
  "w-full min-w-[80px] flex flex-col items-center justify-center py-3 text-center",
22646
22500
  "hover:text-secondary-700 hover:bg-gray-300/10 hover:cursor-pointer",
22647
22501
  selected ? "text-eui-secondary-700 bg-gray-300/10" : "text-gray-400",
@@ -24550,6 +24404,2216 @@ function ReviewThread({
24550
24404
  ] });
24551
24405
  }
24552
24406
  var ReviewThread_default = ReviewThread;
24407
+ var MarkdownContext = React2.createContext(null);
24408
+
24409
+ // src/compositions/markdown/utils/sanitizeHeading.ts
24410
+ function sanitizeHeading(text, options = {}) {
24411
+ const {
24412
+ removeMarkdownSyntax = true,
24413
+ removeHtmlTags = true,
24414
+ collapseWhitespace = true
24415
+ } = options;
24416
+ let value = String(text || "");
24417
+ if (removeHtmlTags) {
24418
+ value = value.replace(/<[^>]*>/g, "");
24419
+ }
24420
+ if (removeMarkdownSyntax) {
24421
+ value = value.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\[[^\]]+\]/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/[*_~]+/g, "").replace(/\\([\\`*{}\[\]()#+\-.!_>])/g, "$1");
24422
+ }
24423
+ value = value.replace(/[\u0000-\u001F\u007F]/g, "");
24424
+ if (collapseWhitespace) {
24425
+ value = value.replace(/\s+/g, " ");
24426
+ }
24427
+ return value.trim();
24428
+ }
24429
+
24430
+ // src/compositions/markdown/utils/createHeadingSlug.ts
24431
+ function escapeRegExp(value) {
24432
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24433
+ }
24434
+ function createHeadingSlug(text, options = {}) {
24435
+ const {
24436
+ separator = "-",
24437
+ fallback = "heading",
24438
+ slugCounts,
24439
+ existingSlugs
24440
+ } = options;
24441
+ const escapedSeparator = escapeRegExp(separator);
24442
+ const sanitized = sanitizeHeading(text);
24443
+ const baseSlug = sanitized.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}\s-]/gu, "").replace(/\s+/g, separator).replace(new RegExp(`${escapedSeparator}+`, "g"), separator).replace(new RegExp(`^${escapedSeparator}|${escapedSeparator}$`, "g"), "").trim() || fallback;
24444
+ if (slugCounts) {
24445
+ const count = slugCounts.get(baseSlug) ?? 0;
24446
+ slugCounts.set(baseSlug, count + 1);
24447
+ return count === 0 ? baseSlug : `${baseSlug}${separator}${count}`;
24448
+ }
24449
+ if (existingSlugs) {
24450
+ let slug = baseSlug;
24451
+ let count = 1;
24452
+ while (existingSlugs.has(slug)) {
24453
+ slug = `${baseSlug}${separator}${count}`;
24454
+ count++;
24455
+ }
24456
+ existingSlugs.add(slug);
24457
+ return slug;
24458
+ }
24459
+ return baseSlug;
24460
+ }
24461
+ function slugify(text) {
24462
+ return createHeadingSlug(text);
24463
+ }
24464
+
24465
+ // src/compositions/markdown/utils/normalizeMarkdown.ts
24466
+ function normalizeMarkdown(markdown, options = {}) {
24467
+ const {
24468
+ removeBom = true,
24469
+ normalizeLineEndings = true,
24470
+ trimStart = false,
24471
+ trimEnd = false,
24472
+ collapseBlankLines = false,
24473
+ finalNewline = false
24474
+ } = options;
24475
+ let value = String(markdown ?? "");
24476
+ if (removeBom) {
24477
+ value = value.replace(/^\uFEFF/, "");
24478
+ }
24479
+ if (normalizeLineEndings) {
24480
+ value = value.replace(/\r\n?/g, "\n");
24481
+ }
24482
+ if (trimStart) {
24483
+ value = value.trimStart();
24484
+ }
24485
+ if (trimEnd) {
24486
+ value = value.trimEnd();
24487
+ }
24488
+ if (collapseBlankLines) {
24489
+ value = value.replace(/\n{3,}/g, "\n\n");
24490
+ }
24491
+ if (finalNewline && value && !value.endsWith("\n")) {
24492
+ value += "\n";
24493
+ }
24494
+ return value;
24495
+ }
24496
+
24497
+ // src/compositions/markdown/utils/extractHeadings.ts
24498
+ function getFenceState(line) {
24499
+ const match = line.match(/^\s{0,3}(`{3,}|~{3,})/);
24500
+ if (!match) return null;
24501
+ const fence = match[1];
24502
+ return {
24503
+ marker: fence[0],
24504
+ length: fence.length
24505
+ };
24506
+ }
24507
+ function closesFence(line, fence) {
24508
+ const match = line.match(/^\s{0,3}(`{3,}|~{3,})\s*$/);
24509
+ if (!match) return false;
24510
+ const closingFence = match[1];
24511
+ return closingFence[0] === fence.marker && closingFence.length >= fence.length;
24512
+ }
24513
+ function isSetextUnderline(line) {
24514
+ if (/^\s{0,3}=+\s*$/.test(line)) {
24515
+ return 1;
24516
+ }
24517
+ if (/^\s{0,3}-+\s*$/.test(line)) {
24518
+ return 2;
24519
+ }
24520
+ return null;
24521
+ }
24522
+ function extractAtxHeading(line) {
24523
+ const match = line.match(/^\s{0,3}(#{1,6})(?:\s+|$)(.*)$/);
24524
+ if (!match) return null;
24525
+ const level = match[1].length;
24526
+ const rawText = match[2].replace(/\s+#+\s*$/, "").trim();
24527
+ return {
24528
+ level,
24529
+ text: sanitizeHeading(rawText)
24530
+ };
24531
+ }
24532
+ function extractHeadings(markdown, options = {}) {
24533
+ const {
24534
+ minDepth = 1,
24535
+ maxDepth = 6,
24536
+ includeSetextHeadings = true,
24537
+ idPrefix = ""
24538
+ } = options;
24539
+ const normalizedMarkdown = normalizeMarkdown(markdown);
24540
+ const lines = normalizedMarkdown.split("\n");
24541
+ const headings = [];
24542
+ const slugCounts = /* @__PURE__ */ new Map();
24543
+ let activeFence = null;
24544
+ for (let index = 0; index < lines.length; index++) {
24545
+ const line = lines[index];
24546
+ const fence = getFenceState(line);
24547
+ if (activeFence) {
24548
+ if (closesFence(line, activeFence)) {
24549
+ activeFence = null;
24550
+ }
24551
+ continue;
24552
+ }
24553
+ if (fence) {
24554
+ activeFence = fence;
24555
+ continue;
24556
+ }
24557
+ const atxHeading = extractAtxHeading(line);
24558
+ if (atxHeading) {
24559
+ const { level, text: text2 } = atxHeading;
24560
+ if (level >= minDepth && level <= maxDepth && text2) {
24561
+ const id = createHeadingSlug(text2, { slugCounts });
24562
+ headings.push({
24563
+ id: `${idPrefix}${id}`,
24564
+ text: text2,
24565
+ level
24566
+ });
24567
+ }
24568
+ continue;
24569
+ }
24570
+ if (!includeSetextHeadings) {
24571
+ continue;
24572
+ }
24573
+ const nextLine = lines[index + 1];
24574
+ if (!nextLine) {
24575
+ continue;
24576
+ }
24577
+ const setextLevel = isSetextUnderline(nextLine);
24578
+ if (!setextLevel) {
24579
+ continue;
24580
+ }
24581
+ const text = sanitizeHeading(line);
24582
+ if (!text) {
24583
+ continue;
24584
+ }
24585
+ if (setextLevel >= minDepth && setextLevel <= maxDepth) {
24586
+ const id = createHeadingSlug(text, { slugCounts });
24587
+ headings.push({
24588
+ id: `${idPrefix}${id}`,
24589
+ text,
24590
+ level: setextLevel
24591
+ });
24592
+ }
24593
+ index++;
24594
+ }
24595
+ return headings;
24596
+ }
24597
+
24598
+ // src/compositions/markdown/utils/generateHeadingNumbers.ts
24599
+ function generateHeadingNumbers(headings, options = {}) {
24600
+ const { minDepth = 1, maxDepth = 6, separator = "." } = options;
24601
+ const counters = [0, 0, 0, 0, 0, 0];
24602
+ return headings.filter((heading) => {
24603
+ return heading.level >= minDepth && heading.level <= maxDepth;
24604
+ }).map((heading) => {
24605
+ const level = Math.min(Math.max(heading.level, 1), 6);
24606
+ counters[level - 1]++;
24607
+ for (let index = level; index < counters.length; index++) {
24608
+ counters[index] = 0;
24609
+ }
24610
+ const numbering = counters.slice(0, level).filter((count) => count > 0).join(separator);
24611
+ return {
24612
+ ...heading,
24613
+ numbering
24614
+ };
24615
+ });
24616
+ }
24617
+ function MarkdownProvider({
24618
+ children,
24619
+ markdown,
24620
+ value,
24621
+ headings: externalHeadings,
24622
+ meta,
24623
+ activeHeading: controlledActiveHeading,
24624
+ defaultActiveHeading = "",
24625
+ onActiveHeadingChange
24626
+ }) {
24627
+ const resolvedMarkdown = value ?? markdown ?? "";
24628
+ const [internalActiveHeading, setInternalActiveHeading] = React2.useState(defaultActiveHeading);
24629
+ const headings = React2.useMemo(() => {
24630
+ if (externalHeadings) {
24631
+ return externalHeadings;
24632
+ }
24633
+ return extractHeadings(resolvedMarkdown);
24634
+ }, [externalHeadings, resolvedMarkdown]);
24635
+ const numberedHeadings = React2.useMemo(() => {
24636
+ return generateHeadingNumbers(headings);
24637
+ }, [headings]);
24638
+ const headingMap = React2.useMemo(() => {
24639
+ return headings.reduce((acc, heading) => {
24640
+ acc[heading.id] = heading;
24641
+ return acc;
24642
+ }, {});
24643
+ }, [headings]);
24644
+ const activeHeading = controlledActiveHeading ?? internalActiveHeading;
24645
+ const getHeadingById = React2.useCallback(
24646
+ (id) => {
24647
+ return headingMap[id];
24648
+ },
24649
+ [headingMap]
24650
+ );
24651
+ const setActiveHeading = React2.useCallback(
24652
+ (id) => {
24653
+ if (controlledActiveHeading === void 0) {
24654
+ setInternalActiveHeading(id);
24655
+ }
24656
+ onActiveHeadingChange?.(id, headingMap[id]);
24657
+ },
24658
+ [controlledActiveHeading, headingMap, onActiveHeadingChange]
24659
+ );
24660
+ const contextValue = React2.useMemo(
24661
+ () => ({
24662
+ markdown: resolvedMarkdown,
24663
+ headings,
24664
+ numberedHeadings,
24665
+ activeHeading,
24666
+ setActiveHeading,
24667
+ meta,
24668
+ getHeadingById
24669
+ }),
24670
+ [
24671
+ resolvedMarkdown,
24672
+ headings,
24673
+ numberedHeadings,
24674
+ activeHeading,
24675
+ setActiveHeading,
24676
+ meta,
24677
+ getHeadingById
24678
+ ]
24679
+ );
24680
+ return /* @__PURE__ */ jsxRuntime.jsx(MarkdownContext.Provider, { value: contextValue, children });
24681
+ }
24682
+ var MarkdownProvider_default = MarkdownProvider;
24683
+ function useMarkdown(options = {}) {
24684
+ const { required = false, errorMessage } = options;
24685
+ const context = React2.useContext(MarkdownContext);
24686
+ if (!context && required) {
24687
+ throw new Error(
24688
+ errorMessage || "useMarkdown must be used inside a MarkdownProvider."
24689
+ );
24690
+ }
24691
+ return context;
24692
+ }
24693
+ function useActiveHeading(options = {}) {
24694
+ const context = useMarkdown();
24695
+ const {
24696
+ headings: externalHeadings,
24697
+ activeHeading: controlledActiveHeading,
24698
+ defaultActiveHeading = "",
24699
+ enabled = true,
24700
+ root = null,
24701
+ rootMargin = "-20% 0px -70% 0px",
24702
+ threshold = 0,
24703
+ scrollBehavior = "smooth",
24704
+ scrollBlock = "start",
24705
+ onActiveHeadingChange
24706
+ } = options;
24707
+ const headings = externalHeadings ?? context?.headings ?? [];
24708
+ const [internalActiveHeading, setInternalActiveHeading] = React2.useState(defaultActiveHeading);
24709
+ const activeHeading = controlledActiveHeading ?? context?.activeHeading ?? internalActiveHeading;
24710
+ const headingMap = React2.useMemo(() => {
24711
+ return headings.reduce((acc, heading) => {
24712
+ acc[heading.id] = heading;
24713
+ return acc;
24714
+ }, {});
24715
+ }, [headings]);
24716
+ const setActiveHeading = React2.useCallback(
24717
+ (id) => {
24718
+ if (controlledActiveHeading === void 0 && !context) {
24719
+ setInternalActiveHeading(id);
24720
+ }
24721
+ context?.setActiveHeading(id);
24722
+ onActiveHeadingChange?.(id, headingMap[id]);
24723
+ },
24724
+ [context, controlledActiveHeading, headingMap, onActiveHeadingChange]
24725
+ );
24726
+ const scrollToHeading = React2.useCallback(
24727
+ (id) => {
24728
+ if (typeof document === "undefined") return;
24729
+ const element = document.getElementById(id);
24730
+ if (!element) return;
24731
+ element.scrollIntoView({
24732
+ behavior: scrollBehavior,
24733
+ block: scrollBlock
24734
+ });
24735
+ setActiveHeading(id);
24736
+ },
24737
+ [scrollBehavior, scrollBlock, setActiveHeading]
24738
+ );
24739
+ const observedHeadingIds = React2.useMemo(() => {
24740
+ return headings.map((heading) => heading.id).join("|");
24741
+ }, [headings]);
24742
+ React2.useEffect(() => {
24743
+ if (!enabled) return;
24744
+ if (typeof window === "undefined") return;
24745
+ if (!("IntersectionObserver" in window)) return;
24746
+ if (headings.length === 0) return;
24747
+ const elements = headings.map((heading) => document.getElementById(heading.id)).filter((element) => Boolean(element));
24748
+ if (elements.length === 0) return;
24749
+ const observer = new IntersectionObserver(
24750
+ (entries) => {
24751
+ const visibleEntries = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
24752
+ const nextActiveId = visibleEntries[0]?.target.id;
24753
+ if (!nextActiveId) return;
24754
+ setActiveHeading(nextActiveId);
24755
+ },
24756
+ {
24757
+ root,
24758
+ rootMargin,
24759
+ threshold
24760
+ }
24761
+ );
24762
+ elements.forEach((element) => {
24763
+ observer.observe(element);
24764
+ });
24765
+ return () => {
24766
+ observer.disconnect();
24767
+ };
24768
+ }, [
24769
+ enabled,
24770
+ root,
24771
+ rootMargin,
24772
+ threshold,
24773
+ observedHeadingIds,
24774
+ headings,
24775
+ setActiveHeading
24776
+ ]);
24777
+ return {
24778
+ activeHeading,
24779
+ setActiveHeading,
24780
+ scrollToHeading
24781
+ };
24782
+ }
24783
+ function useMarkdownHeadings(options = {}) {
24784
+ const context = useMarkdown();
24785
+ const {
24786
+ markdown,
24787
+ headings: externalHeadings,
24788
+ minDepth = 1,
24789
+ maxDepth = 6
24790
+ } = options;
24791
+ const baseHeadings = React2.useMemo(() => {
24792
+ if (externalHeadings) {
24793
+ return externalHeadings;
24794
+ }
24795
+ if (markdown !== void 0) {
24796
+ return extractHeadings(markdown);
24797
+ }
24798
+ return context?.headings ?? [];
24799
+ }, [context?.headings, externalHeadings, markdown]);
24800
+ const headings = React2.useMemo(() => {
24801
+ return baseHeadings.filter((heading) => {
24802
+ return heading.level >= minDepth && heading.level <= maxDepth;
24803
+ });
24804
+ }, [baseHeadings, minDepth, maxDepth]);
24805
+ const numberedHeadings = React2.useMemo(() => {
24806
+ return generateHeadingNumbers(headings);
24807
+ }, [headings]);
24808
+ const headingMap = React2.useMemo(() => {
24809
+ return headings.reduce((acc, heading) => {
24810
+ acc[heading.id] = heading;
24811
+ return acc;
24812
+ }, {});
24813
+ }, [headings]);
24814
+ const getHeadingById = (id) => {
24815
+ return headingMap[id];
24816
+ };
24817
+ return {
24818
+ headings,
24819
+ numberedHeadings,
24820
+ hasHeadings: headings.length > 0,
24821
+ getHeadingById
24822
+ };
24823
+ }
24824
+ function MarkdownHeading({
24825
+ id,
24826
+ level,
24827
+ children,
24828
+ className,
24829
+ showAnchor = true,
24830
+ ...props
24831
+ }) {
24832
+ const tag = `h${Math.min(Math.max(level, 1), 6)}`;
24833
+ return React2__default.default.createElement(
24834
+ tag,
24835
+ {
24836
+ ...props,
24837
+ id,
24838
+ className: classNames66__default.default("eui-markdown-heading", className)
24839
+ },
24840
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24841
+ children,
24842
+ showAnchor && id ? /* @__PURE__ */ jsxRuntime.jsx(
24843
+ "a",
24844
+ {
24845
+ href: `#${id}`,
24846
+ className: "eui-markdown-heading-anchor",
24847
+ "aria-label": "Link to heading",
24848
+ children: "#"
24849
+ }
24850
+ ) : null
24851
+ ] })
24852
+ );
24853
+ }
24854
+ var MarkdownHeading_default = MarkdownHeading;
24855
+ reactSyntaxHighlighter.PrismLight.registerLanguage("bash", bash__default.default);
24856
+ reactSyntaxHighlighter.PrismLight.registerLanguage("shell", bash__default.default);
24857
+ reactSyntaxHighlighter.PrismLight.registerLanguage("sh", bash__default.default);
24858
+ reactSyntaxHighlighter.PrismLight.registerLanguage("zsh", bash__default.default);
24859
+ reactSyntaxHighlighter.PrismLight.registerLanguage("c", c__default.default);
24860
+ reactSyntaxHighlighter.PrismLight.registerLanguage("cpp", cpp__default.default);
24861
+ reactSyntaxHighlighter.PrismLight.registerLanguage("c++", cpp__default.default);
24862
+ reactSyntaxHighlighter.PrismLight.registerLanguage("css", css__default.default);
24863
+ reactSyntaxHighlighter.PrismLight.registerLanguage("scss", scss__default.default);
24864
+ reactSyntaxHighlighter.PrismLight.registerLanguage("go", go__default.default);
24865
+ reactSyntaxHighlighter.PrismLight.registerLanguage("java", java__default.default);
24866
+ reactSyntaxHighlighter.PrismLight.registerLanguage("js", javascript__default.default);
24867
+ reactSyntaxHighlighter.PrismLight.registerLanguage("javascript", javascript__default.default);
24868
+ reactSyntaxHighlighter.PrismLight.registerLanguage("jsx", jsx210__default.default);
24869
+ reactSyntaxHighlighter.PrismLight.registerLanguage("json", json__default.default);
24870
+ reactSyntaxHighlighter.PrismLight.registerLanguage("html", markup__default.default);
24871
+ reactSyntaxHighlighter.PrismLight.registerLanguage("xml", markup__default.default);
24872
+ reactSyntaxHighlighter.PrismLight.registerLanguage("markup", markup__default.default);
24873
+ reactSyntaxHighlighter.PrismLight.registerLanguage("py", python__default.default);
24874
+ reactSyntaxHighlighter.PrismLight.registerLanguage("python", python__default.default);
24875
+ reactSyntaxHighlighter.PrismLight.registerLanguage("rs", rust__default.default);
24876
+ reactSyntaxHighlighter.PrismLight.registerLanguage("rust", rust__default.default);
24877
+ reactSyntaxHighlighter.PrismLight.registerLanguage("sql", sql__default.default);
24878
+ reactSyntaxHighlighter.PrismLight.registerLanguage("ts", typescript__default.default);
24879
+ reactSyntaxHighlighter.PrismLight.registerLanguage("typescript", typescript__default.default);
24880
+ reactSyntaxHighlighter.PrismLight.registerLanguage("tsx", tsx__default.default);
24881
+ reactSyntaxHighlighter.PrismLight.registerLanguage("yaml", yaml__default.default);
24882
+ reactSyntaxHighlighter.PrismLight.registerLanguage("yml", yaml__default.default);
24883
+ var LANGUAGE_ALIASES = {
24884
+ js: "javascript",
24885
+ ts: "typescript",
24886
+ py: "python",
24887
+ sh: "bash",
24888
+ shell: "bash",
24889
+ zsh: "bash",
24890
+ yml: "yaml",
24891
+ html: "markup",
24892
+ xml: "markup",
24893
+ "c++": "cpp",
24894
+ text: "text",
24895
+ txt: "text",
24896
+ plain: "text",
24897
+ plaintext: "text"
24898
+ };
24899
+ function normalizeLanguage(language) {
24900
+ if (!language) return "text";
24901
+ const normalized = language.toLowerCase().trim();
24902
+ return LANGUAGE_ALIASES[normalized] ?? normalized;
24903
+ }
24904
+ function MarkdownCodeBlock({
24905
+ code,
24906
+ language,
24907
+ meta,
24908
+ className,
24909
+ showCopy = true,
24910
+ wrapLongLines = false,
24911
+ ...props
24912
+ }) {
24913
+ const [copied, setCopied] = React2.useState(false);
24914
+ const timeoutRef = React2.useRef(null);
24915
+ const title = meta?.title ?? meta?.filename;
24916
+ const resolvedLanguage = React2.useMemo(() => {
24917
+ return normalizeLanguage(language);
24918
+ }, [language]);
24919
+ const languageLabel = language || resolvedLanguage;
24920
+ const showHeader = Boolean(title || languageLabel || showCopy);
24921
+ const highlightLines = React2.useMemo(() => {
24922
+ return new Set(meta?.highlightLines ?? []);
24923
+ }, [meta?.highlightLines]);
24924
+ const showLineNumbers = Boolean(meta?.showLineNumbers);
24925
+ React2.useEffect(() => {
24926
+ return () => {
24927
+ if (timeoutRef.current) {
24928
+ window.clearTimeout(timeoutRef.current);
24929
+ }
24930
+ };
24931
+ }, []);
24932
+ const copyCode = async () => {
24933
+ if (typeof navigator === "undefined") return;
24934
+ if (!navigator.clipboard) return;
24935
+ await navigator.clipboard.writeText(code);
24936
+ setCopied(true);
24937
+ if (timeoutRef.current) {
24938
+ window.clearTimeout(timeoutRef.current);
24939
+ }
24940
+ timeoutRef.current = window.setTimeout(() => {
24941
+ setCopied(false);
24942
+ }, 1500);
24943
+ };
24944
+ const lineNumberStyle = {
24945
+ minWidth: "3rem",
24946
+ paddingRight: "1rem",
24947
+ color: "rgb(100 116 139)",
24948
+ textAlign: "right",
24949
+ userSelect: "none"
24950
+ };
24951
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props, className: classNames66__default.default("eui-markdown-code", className), children: [
24952
+ showHeader ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "eui-markdown-code-header", children: [
24953
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "eui-markdown-code-header-main", children: [
24954
+ title ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-code-title", children: title }) : null,
24955
+ languageLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-code-language", children: languageLabel }) : null
24956
+ ] }),
24957
+ showCopy ? /* @__PURE__ */ jsxRuntime.jsx(
24958
+ "button",
24959
+ {
24960
+ type: "button",
24961
+ className: "eui-markdown-copy-button",
24962
+ onClick: copyCode,
24963
+ children: copied ? "Copied" : "Copy"
24964
+ }
24965
+ ) : null
24966
+ ] }) : null,
24967
+ /* @__PURE__ */ jsxRuntime.jsx(
24968
+ reactSyntaxHighlighter.PrismLight,
24969
+ {
24970
+ className: "eui-markdown-code-highlighter",
24971
+ language: resolvedLanguage,
24972
+ style: prism.vscDarkPlus,
24973
+ showLineNumbers,
24974
+ wrapLines: highlightLines.size > 0,
24975
+ wrapLongLines,
24976
+ PreTag: "pre",
24977
+ CodeTag: "code",
24978
+ customStyle: {
24979
+ margin: 0,
24980
+ padding: "1rem",
24981
+ background: "transparent",
24982
+ fontSize: "0.875rem",
24983
+ lineHeight: 1.7
24984
+ },
24985
+ codeTagProps: {
24986
+ style: {
24987
+ fontFamily: '"JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'
24988
+ }
24989
+ },
24990
+ lineNumberStyle,
24991
+ lineProps: (lineNumber) => {
24992
+ const highlighted = highlightLines.has(lineNumber);
24993
+ return {
24994
+ className: highlighted ? "eui-markdown-code-line-highlighted" : void 0,
24995
+ style: {
24996
+ display: "block",
24997
+ background: highlighted ? "rgba(250, 204, 21, 0.12)" : void 0
24998
+ }
24999
+ };
25000
+ },
25001
+ children: code
25002
+ }
25003
+ )
25004
+ ] });
25005
+ }
25006
+ var MarkdownCodeBlock_default = MarkdownCodeBlock;
25007
+ function MarkdownInlineCode({
25008
+ children,
25009
+ className,
25010
+ ...props
25011
+ }) {
25012
+ return /* @__PURE__ */ jsxRuntime.jsx(
25013
+ "code",
25014
+ {
25015
+ ...props,
25016
+ className: classNames66__default.default("eui-markdown-inline-code", className),
25017
+ children
25018
+ }
25019
+ );
25020
+ }
25021
+ var MarkdownInlineCode_default = MarkdownInlineCode;
25022
+ function isExternalHref(href) {
25023
+ if (!href) return false;
25024
+ return /^https?:\/\//i.test(href);
25025
+ }
25026
+ function getSafeHref(href) {
25027
+ if (!href) return void 0;
25028
+ const trimmed = href.trim();
25029
+ const isSafe = trimmed.startsWith("#") || trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || /^https?:\/\//i.test(trimmed) || /^mailto:/i.test(trimmed) || /^tel:/i.test(trimmed);
25030
+ return isSafe ? trimmed : void 0;
25031
+ }
25032
+ function MarkdownLink({
25033
+ href,
25034
+ target,
25035
+ children,
25036
+ className,
25037
+ openLinksInNewTab = true,
25038
+ ...props
25039
+ }) {
25040
+ const safeHref = getSafeHref(href);
25041
+ if (!safeHref) {
25042
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children });
25043
+ }
25044
+ const external = isExternalHref(safeHref);
25045
+ const resolvedTarget = target ?? (openLinksInNewTab && external ? "_blank" : void 0);
25046
+ const rel = resolvedTarget === "_blank" ? "noopener noreferrer" : props.rel;
25047
+ return /* @__PURE__ */ jsxRuntime.jsx(
25048
+ "a",
25049
+ {
25050
+ ...props,
25051
+ href: safeHref,
25052
+ target: resolvedTarget,
25053
+ rel,
25054
+ className: classNames66__default.default("eui-markdown-link", className),
25055
+ children
25056
+ }
25057
+ );
25058
+ }
25059
+ var MarkdownLink_default = MarkdownLink;
25060
+ function getSafeImageSrc(src) {
25061
+ if (!src) return void 0;
25062
+ const trimmed = src.trim();
25063
+ const isSafe = trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || /^https?:\/\//i.test(trimmed) || /^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,/i.test(trimmed);
25064
+ return isSafe ? trimmed : void 0;
25065
+ }
25066
+ function MarkdownImage({
25067
+ src,
25068
+ alt,
25069
+ title,
25070
+ className,
25071
+ ...props
25072
+ }) {
25073
+ const safeSrc = getSafeImageSrc(src);
25074
+ if (!safeSrc) {
25075
+ return null;
25076
+ }
25077
+ return /* @__PURE__ */ jsxRuntime.jsx(
25078
+ "img",
25079
+ {
25080
+ ...props,
25081
+ src: safeSrc,
25082
+ alt: alt ?? "",
25083
+ title,
25084
+ loading: "lazy",
25085
+ decoding: "async",
25086
+ className: classNames66__default.default("eui-markdown-image", className)
25087
+ }
25088
+ );
25089
+ }
25090
+ var MarkdownImage_default = MarkdownImage;
25091
+ function MarkdownTable({
25092
+ children,
25093
+ className,
25094
+ ...props
25095
+ }) {
25096
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-table-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, className: classNames66__default.default("eui-markdown-table", className), children }) });
25097
+ }
25098
+ function MarkdownTableCell({
25099
+ children,
25100
+ className,
25101
+ ...props
25102
+ }) {
25103
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props, className: classNames66__default.default("eui-markdown-table-cell", className), children });
25104
+ }
25105
+ function MarkdownTableHeaderCell({
25106
+ children,
25107
+ className,
25108
+ ...props
25109
+ }) {
25110
+ return /* @__PURE__ */ jsxRuntime.jsx(
25111
+ "th",
25112
+ {
25113
+ ...props,
25114
+ className: classNames66__default.default("eui-markdown-table-header-cell", className),
25115
+ children
25116
+ }
25117
+ );
25118
+ }
25119
+ var MarkdownTable_default = MarkdownTable;
25120
+ function MarkdownBlockquote({
25121
+ children,
25122
+ className,
25123
+ ...props
25124
+ }) {
25125
+ return /* @__PURE__ */ jsxRuntime.jsx(
25126
+ "blockquote",
25127
+ {
25128
+ ...props,
25129
+ className: classNames66__default.default("eui-markdown-blockquote", className),
25130
+ children
25131
+ }
25132
+ );
25133
+ }
25134
+ var MarkdownBlockquote_default = MarkdownBlockquote;
25135
+ function getTextContent(node) {
25136
+ if (typeof node === "string" || typeof node === "number") {
25137
+ return String(node);
25138
+ }
25139
+ if (Array.isArray(node)) {
25140
+ return node.map(getTextContent).join("");
25141
+ }
25142
+ if (React2.isValidElement(node)) {
25143
+ return getTextContent(node.props.children);
25144
+ }
25145
+ return "";
25146
+ }
25147
+ function createHeadingKey(level, text) {
25148
+ return `${level}:${sanitizeHeading(text)}`;
25149
+ }
25150
+ function parseNumberRanges(value) {
25151
+ if (!value) return [];
25152
+ const normalized = value.replace(/[{}[\]\s]/g, "");
25153
+ if (!normalized) return [];
25154
+ const values = /* @__PURE__ */ new Set();
25155
+ normalized.split(",").forEach((part) => {
25156
+ if (!part) return;
25157
+ const rangeMatch = part.match(/^(\d+)-(\d+)$/);
25158
+ if (rangeMatch) {
25159
+ const start = Number(rangeMatch[1]);
25160
+ const end = Number(rangeMatch[2]);
25161
+ for (let line2 = start; line2 <= end; line2++) {
25162
+ values.add(line2);
25163
+ }
25164
+ return;
25165
+ }
25166
+ const line = Number(part);
25167
+ if (!Number.isNaN(line)) {
25168
+ values.add(line);
25169
+ }
25170
+ });
25171
+ return Array.from(values).sort((a, b) => a - b);
25172
+ }
25173
+ function parseCodeMeta(metaString) {
25174
+ if (!metaString) return void 0;
25175
+ const filenameMatch = metaString.match(
25176
+ /(?:filename|file)=["']?([^"'\s]+)["']?/
25177
+ );
25178
+ const titleMatch = metaString.match(/(?:title)=["']?([^"']+)["']?/);
25179
+ const highlightMatch = metaString.match(/(?:highlight|lines)=["']?([^"'\s]+)["']?/) || metaString.match(/{([^}]+)}/);
25180
+ return {
25181
+ filename: filenameMatch?.[1],
25182
+ title: titleMatch?.[1],
25183
+ showLineNumbers: /\b(showLineNumbers|lineNumbers|line-numbers)\b/.test(
25184
+ metaString
25185
+ ),
25186
+ highlightLines: parseNumberRanges(highlightMatch?.[1])
25187
+ };
25188
+ }
25189
+ function getCodeMetaString(node) {
25190
+ const value = node;
25191
+ return value?.data?.meta || value?.data?.hProperties?.meta || value?.properties?.meta || value?.properties?.dataMeta || value?.meta;
25192
+ }
25193
+ function getLanguageFromClassName(className) {
25194
+ if (!className) return void 0;
25195
+ const match = className.match(/language-([^\s]+)/);
25196
+ return match?.[1];
25197
+ }
25198
+ function getCodeInfoFromPreChildren(children) {
25199
+ const childArray = React2__default.default.Children.toArray(children);
25200
+ const codeElement = childArray.find((child) => {
25201
+ if (!React2.isValidElement(child)) return false;
25202
+ return child.type === "code";
25203
+ });
25204
+ const codeProps = codeElement?.props;
25205
+ const code = getTextContent(codeProps?.children ?? children).replace(
25206
+ /\n$/,
25207
+ ""
25208
+ );
25209
+ const language = getLanguageFromClassName(codeProps?.className);
25210
+ const meta = parseCodeMeta(codeProps?.["data-meta"]);
25211
+ return {
25212
+ code,
25213
+ language,
25214
+ meta
25215
+ };
25216
+ }
25217
+ function MarkdownRenderer({
25218
+ markdown,
25219
+ headings = [],
25220
+ headingIdPrefix = "",
25221
+ components,
25222
+ className,
25223
+ contentClassName,
25224
+ openLinksInNewTab = true,
25225
+ linkTarget,
25226
+ enableGfm = true,
25227
+ allowHtml = false,
25228
+ sanitizeHtml = true,
25229
+ showCopyCode = true,
25230
+ showHeadingAnchors = true
25231
+ }) {
25232
+ const headingQueues = /* @__PURE__ */ new Map();
25233
+ headings.forEach((heading) => {
25234
+ const key = createHeadingKey(heading.level, heading.text);
25235
+ const queue = headingQueues.get(key) ?? [];
25236
+ queue.push(heading.id);
25237
+ headingQueues.set(key, queue);
25238
+ });
25239
+ const headingUsage = /* @__PURE__ */ new Map();
25240
+ const fallbackSlugCounts = /* @__PURE__ */ new Map();
25241
+ const resolveHeadingId = (level, children) => {
25242
+ const text = getTextContent(children);
25243
+ const key = createHeadingKey(level, text);
25244
+ const queue = headingQueues.get(key);
25245
+ if (queue?.length) {
25246
+ const usedCount = headingUsage.get(key) ?? 0;
25247
+ headingUsage.set(key, usedCount + 1);
25248
+ const existingId = queue[usedCount];
25249
+ if (existingId) {
25250
+ return existingId;
25251
+ }
25252
+ }
25253
+ return `${headingIdPrefix}${createHeadingSlug(text, {
25254
+ slugCounts: fallbackSlugCounts
25255
+ })}`;
25256
+ };
25257
+ const remarkPlugins = [];
25258
+ if (enableGfm) {
25259
+ remarkPlugins.push(remarkGfm__default.default);
25260
+ }
25261
+ const rehypePlugins = [];
25262
+ if (allowHtml) {
25263
+ rehypePlugins.push(rehypeRaw__default.default);
25264
+ if (sanitizeHtml) {
25265
+ rehypePlugins.push(rehypeSanitize__default.default);
25266
+ }
25267
+ }
25268
+ const rendererComponents = {
25269
+ h1: ({ node: _node, children, ...rest }) => {
25270
+ const Component = components?.h1 ?? MarkdownHeading_default;
25271
+ return /* @__PURE__ */ jsxRuntime.jsx(
25272
+ Component,
25273
+ {
25274
+ ...rest,
25275
+ id: resolveHeadingId(1, children),
25276
+ level: 1,
25277
+ showAnchor: showHeadingAnchors,
25278
+ children
25279
+ }
25280
+ );
25281
+ },
25282
+ h2: ({ node: _node, children, ...rest }) => {
25283
+ const Component = components?.h2 ?? MarkdownHeading_default;
25284
+ return /* @__PURE__ */ jsxRuntime.jsx(
25285
+ Component,
25286
+ {
25287
+ ...rest,
25288
+ id: resolveHeadingId(2, children),
25289
+ level: 2,
25290
+ showAnchor: showHeadingAnchors,
25291
+ children
25292
+ }
25293
+ );
25294
+ },
25295
+ h3: ({ node: _node, children, ...rest }) => {
25296
+ const Component = components?.h3 ?? MarkdownHeading_default;
25297
+ return /* @__PURE__ */ jsxRuntime.jsx(
25298
+ Component,
25299
+ {
25300
+ ...rest,
25301
+ id: resolveHeadingId(3, children),
25302
+ level: 3,
25303
+ showAnchor: showHeadingAnchors,
25304
+ children
25305
+ }
25306
+ );
25307
+ },
25308
+ h4: ({ node: _node, children, ...rest }) => {
25309
+ const Component = components?.h4 ?? MarkdownHeading_default;
25310
+ return /* @__PURE__ */ jsxRuntime.jsx(
25311
+ Component,
25312
+ {
25313
+ ...rest,
25314
+ id: resolveHeadingId(4, children),
25315
+ level: 4,
25316
+ showAnchor: showHeadingAnchors,
25317
+ children
25318
+ }
25319
+ );
25320
+ },
25321
+ h5: ({ node: _node, children, ...rest }) => {
25322
+ const Component = components?.h5 ?? MarkdownHeading_default;
25323
+ return /* @__PURE__ */ jsxRuntime.jsx(
25324
+ Component,
25325
+ {
25326
+ ...rest,
25327
+ id: resolveHeadingId(5, children),
25328
+ level: 5,
25329
+ showAnchor: showHeadingAnchors,
25330
+ children
25331
+ }
25332
+ );
25333
+ },
25334
+ h6: ({ node: _node, children, ...rest }) => {
25335
+ const Component = components?.h6 ?? MarkdownHeading_default;
25336
+ return /* @__PURE__ */ jsxRuntime.jsx(
25337
+ Component,
25338
+ {
25339
+ ...rest,
25340
+ id: resolveHeadingId(6, children),
25341
+ level: 6,
25342
+ showAnchor: showHeadingAnchors,
25343
+ children
25344
+ }
25345
+ );
25346
+ },
25347
+ /**
25348
+ * Important:
25349
+ * For block code, return a native <code> with className="language-*".
25350
+ * Then the pre renderer can reliably extract language + meta.
25351
+ */
25352
+ code: ({ node, className: className2, children, ...rest }) => {
25353
+ const language = getLanguageFromClassName(className2);
25354
+ if (language) {
25355
+ return /* @__PURE__ */ jsxRuntime.jsx(
25356
+ "code",
25357
+ {
25358
+ ...rest,
25359
+ className: className2,
25360
+ "data-meta": getCodeMetaString(node),
25361
+ children
25362
+ }
25363
+ );
25364
+ }
25365
+ const Component = components?.code ?? MarkdownInlineCode_default;
25366
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, className: className2, children });
25367
+ },
25368
+ /**
25369
+ * Do not spread rest here.
25370
+ * React-markdown's pre props are HTMLPreElement props.
25371
+ * MarkdownCodeBlock root is a div.
25372
+ */
25373
+ pre: ({ node: _node, children }) => {
25374
+ const Component = components?.pre ?? MarkdownCodeBlock_default;
25375
+ const { code, language, meta } = getCodeInfoFromPreChildren(children);
25376
+ return /* @__PURE__ */ jsxRuntime.jsx(
25377
+ Component,
25378
+ {
25379
+ code,
25380
+ language,
25381
+ meta,
25382
+ showCopy: showCopyCode
25383
+ }
25384
+ );
25385
+ },
25386
+ a: ({ node: _node, children, href, target, ...rest }) => {
25387
+ const Component = components?.a ?? MarkdownLink_default;
25388
+ return /* @__PURE__ */ jsxRuntime.jsx(
25389
+ Component,
25390
+ {
25391
+ ...rest,
25392
+ href,
25393
+ target: linkTarget ?? target,
25394
+ openLinksInNewTab,
25395
+ children
25396
+ }
25397
+ );
25398
+ },
25399
+ img: ({ node: _node, src, alt, title, ...rest }) => {
25400
+ const Component = components?.img ?? MarkdownImage_default;
25401
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, src, alt, title });
25402
+ },
25403
+ table: ({ node: _node, children, ...rest }) => {
25404
+ const Component = components?.table ?? MarkdownTable_default;
25405
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25406
+ },
25407
+ td: ({ node: _node, children, ...rest }) => {
25408
+ const Component = components?.td ?? MarkdownTableCell;
25409
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25410
+ },
25411
+ th: ({ node: _node, children, ...rest }) => {
25412
+ const Component = components?.th ?? MarkdownTableHeaderCell;
25413
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25414
+ },
25415
+ blockquote: ({ node: _node, children, ...rest }) => {
25416
+ const Component = components?.blockquote ?? MarkdownBlockquote_default;
25417
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...rest, children });
25418
+ },
25419
+ ...components
25420
+ };
25421
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default("eui-markdown markdown-body", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClassName, children: /* @__PURE__ */ jsxRuntime.jsx(
25422
+ ReactMarkdown__default.default,
25423
+ {
25424
+ remarkPlugins,
25425
+ rehypePlugins,
25426
+ skipHtml: !allowHtml,
25427
+ components: rendererComponents,
25428
+ children: markdown
25429
+ }
25430
+ ) }) });
25431
+ }
25432
+ var MarkdownRenderer_default = MarkdownRenderer;
25433
+ function MarkdownViewer({
25434
+ value,
25435
+ headings: externalHeadings,
25436
+ headingIdPrefix = "",
25437
+ enableActiveHeading = true,
25438
+ ...props
25439
+ }) {
25440
+ const context = useMarkdown();
25441
+ const markdown = value ?? context?.markdown ?? "";
25442
+ const headings = React2.useMemo(() => {
25443
+ if (externalHeadings) {
25444
+ return externalHeadings;
25445
+ }
25446
+ if (context?.headings?.length) {
25447
+ return context.headings;
25448
+ }
25449
+ return extractHeadings(markdown, {
25450
+ idPrefix: headingIdPrefix
25451
+ });
25452
+ }, [context?.headings, externalHeadings, headingIdPrefix, markdown]);
25453
+ useActiveHeading({
25454
+ headings,
25455
+ enabled: enableActiveHeading && headings.length > 0
25456
+ });
25457
+ return /* @__PURE__ */ jsxRuntime.jsx(
25458
+ MarkdownRenderer_default,
25459
+ {
25460
+ markdown,
25461
+ headings,
25462
+ headingIdPrefix,
25463
+ ...props
25464
+ }
25465
+ );
25466
+ }
25467
+ var MarkdownViewer_default = MarkdownViewer;
25468
+ function hasNumbering(heading) {
25469
+ return "numbering" in heading;
25470
+ }
25471
+ function MarkdownTOCItem({
25472
+ heading,
25473
+ active = false,
25474
+ numbered = true,
25475
+ sanitizeLabel = true,
25476
+ indentSize = 12,
25477
+ className,
25478
+ activeClassName,
25479
+ inactiveClassName,
25480
+ onSelect
25481
+ }) {
25482
+ const label = sanitizeLabel ? sanitizeHeading(heading.text) : heading.text;
25483
+ const numbering = hasNumbering(heading) ? heading.numbering : void 0;
25484
+ return /* @__PURE__ */ jsxRuntime.jsxs(
25485
+ "button",
25486
+ {
25487
+ type: "button",
25488
+ onClick: () => onSelect?.(heading),
25489
+ "aria-current": active ? "location" : void 0,
25490
+ title: label,
25491
+ className: classNames66__default.default(
25492
+ "eui-markdown-toc-item",
25493
+ "block w-full text-left text-sm transition-all ease-in-out duration-150",
25494
+ "hover:text-primary",
25495
+ active ? classNames66__default.default("text-primary font-semibold underline", activeClassName) : classNames66__default.default("text-gray-500 dark:text-gray-400", inactiveClassName),
25496
+ className
25497
+ ),
25498
+ style: {
25499
+ paddingLeft: `${Math.max(heading.level - 1, 0) * indentSize}px`
25500
+ },
25501
+ children: [
25502
+ numbered && numbering ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eui-markdown-toc-item-number mr-2 opacity-70", children: numbering }) : null,
25503
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eui-markdown-toc-item-label", children: label })
25504
+ ]
25505
+ }
25506
+ );
25507
+ }
25508
+ var MarkdownTOCItem_default = MarkdownTOCItem;
25509
+ function MarkdownTOC({
25510
+ title = "Table of Contents",
25511
+ markdown,
25512
+ headings: externalHeadings,
25513
+ minDepth = 1,
25514
+ maxDepth = 6,
25515
+ numbered = true,
25516
+ sanitizeLabels = true,
25517
+ collapsible = false,
25518
+ defaultCollapsed = false,
25519
+ emptyState = null,
25520
+ smoothScroll = true,
25521
+ scrollBlock = "start",
25522
+ indentSize = 12,
25523
+ className,
25524
+ titleClassName,
25525
+ listClassName,
25526
+ itemClassName,
25527
+ activeItemClassName,
25528
+ inactiveItemClassName,
25529
+ activeHeading: controlledActiveHeading,
25530
+ onActiveHeadingChange,
25531
+ onHeadingClick
25532
+ }) {
25533
+ const context = useMarkdown();
25534
+ const [collapsed, setCollapsed] = React2.useState(defaultCollapsed);
25535
+ const { headings, numberedHeadings, hasHeadings } = useMarkdownHeadings({
25536
+ markdown,
25537
+ headings: externalHeadings,
25538
+ minDepth,
25539
+ maxDepth
25540
+ });
25541
+ const tocHeadings = React2.useMemo(() => {
25542
+ return numbered ? numberedHeadings : headings;
25543
+ }, [headings, numbered, numberedHeadings]);
25544
+ const { activeHeading, scrollToHeading, setActiveHeading } = useActiveHeading(
25545
+ {
25546
+ headings,
25547
+ enabled: false,
25548
+ activeHeading: controlledActiveHeading,
25549
+ scrollBehavior: smoothScroll ? "smooth" : "auto",
25550
+ scrollBlock,
25551
+ onActiveHeadingChange
25552
+ }
25553
+ );
25554
+ if (!context && !markdown && !externalHeadings) {
25555
+ return null;
25556
+ }
25557
+ if (!hasHeadings) {
25558
+ return emptyState ? /* @__PURE__ */ jsxRuntime.jsx(
25559
+ "div",
25560
+ {
25561
+ className: classNames66__default.default(
25562
+ "eui-markdown-toc",
25563
+ "text-sm text-gray-500 dark:text-gray-400",
25564
+ className
25565
+ ),
25566
+ children: emptyState
25567
+ }
25568
+ ) : null;
25569
+ }
25570
+ const handleSelect = (heading) => {
25571
+ scrollToHeading(heading.id);
25572
+ setActiveHeading(heading.id);
25573
+ onHeadingClick?.(heading);
25574
+ };
25575
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
25576
+ title ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eui-markdown-toc-header", children: collapsible ? /* @__PURE__ */ jsxRuntime.jsxs(
25577
+ "button",
25578
+ {
25579
+ type: "button",
25580
+ onClick: () => setCollapsed((value) => !value),
25581
+ className: classNames66__default.default(
25582
+ "eui-markdown-toc-title",
25583
+ "flex w-full items-center justify-between gap-2 text-left",
25584
+ "text-sm font-semibold uppercase tracking-wide",
25585
+ "text-gray-900 dark:text-gray-100",
25586
+ titleClassName
25587
+ ),
25588
+ "aria-expanded": !collapsed,
25589
+ children: [
25590
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
25591
+ /* @__PURE__ */ jsxRuntime.jsx(
25592
+ "span",
25593
+ {
25594
+ className: classNames66__default.default(
25595
+ "text-xs opacity-60 transition-transform duration-150",
25596
+ !collapsed && "rotate-90"
25597
+ ),
25598
+ "aria-hidden": "true",
25599
+ children: "\u203A"
25600
+ }
25601
+ )
25602
+ ]
25603
+ }
25604
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
25605
+ "h2",
25606
+ {
25607
+ className: classNames66__default.default(
25608
+ "eui-markdown-toc-title",
25609
+ "text-sm font-semibold uppercase tracking-wide",
25610
+ "text-gray-900 dark:text-gray-100",
25611
+ titleClassName
25612
+ ),
25613
+ children: title
25614
+ }
25615
+ ) }) : null,
25616
+ !collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
25617
+ "nav",
25618
+ {
25619
+ className: classNames66__default.default(
25620
+ "eui-markdown-toc-list",
25621
+ "space-y-1",
25622
+ listClassName
25623
+ ),
25624
+ "aria-label": title || "Markdown table of contents",
25625
+ children: tocHeadings.map((heading) => /* @__PURE__ */ jsxRuntime.jsx(
25626
+ MarkdownTOCItem_default,
25627
+ {
25628
+ heading,
25629
+ active: activeHeading === heading.id,
25630
+ numbered,
25631
+ sanitizeLabel: sanitizeLabels,
25632
+ indentSize,
25633
+ className: itemClassName,
25634
+ activeClassName: activeItemClassName,
25635
+ inactiveClassName: inactiveItemClassName,
25636
+ onSelect: handleSelect
25637
+ },
25638
+ heading.id
25639
+ ))
25640
+ }
25641
+ ) : null
25642
+ ] });
25643
+ return /* @__PURE__ */ jsxRuntime.jsx("aside", { className: classNames66__default.default("eui-markdown-toc", "space-y-4", className), children: content });
25644
+ }
25645
+ var MarkdownTOC_default = MarkdownTOC;
25646
+ var DEFAULT_MARKDOWN_TOOLBAR_ACTIONS = [
25647
+ {
25648
+ id: "heading-1",
25649
+ label: "H1",
25650
+ title: "Heading 1"
25651
+ },
25652
+ {
25653
+ id: "heading-2",
25654
+ label: "H2",
25655
+ title: "Heading 2"
25656
+ },
25657
+ {
25658
+ id: "heading-3",
25659
+ label: "H3",
25660
+ title: "Heading 3"
25661
+ },
25662
+ {
25663
+ id: "bold",
25664
+ label: "B",
25665
+ title: "Bold",
25666
+ shortcut: "Ctrl+B"
25667
+ },
25668
+ {
25669
+ id: "italic",
25670
+ label: "I",
25671
+ title: "Italic",
25672
+ shortcut: "Ctrl+I"
25673
+ },
25674
+ {
25675
+ id: "strike",
25676
+ label: "S",
25677
+ title: "Strikethrough"
25678
+ },
25679
+ {
25680
+ id: "inline-code",
25681
+ label: "`",
25682
+ title: "Inline code"
25683
+ },
25684
+ {
25685
+ id: "code-block",
25686
+ label: "{}",
25687
+ title: "Code block"
25688
+ },
25689
+ {
25690
+ id: "link",
25691
+ label: "Link",
25692
+ title: "Link"
25693
+ },
25694
+ {
25695
+ id: "image",
25696
+ label: "Img",
25697
+ title: "Image"
25698
+ },
25699
+ {
25700
+ id: "unordered-list",
25701
+ label: "\u2022 List",
25702
+ title: "Bullet list"
25703
+ },
25704
+ {
25705
+ id: "ordered-list",
25706
+ label: "1. List",
25707
+ title: "Numbered list"
25708
+ },
25709
+ {
25710
+ id: "quote",
25711
+ label: "Quote",
25712
+ title: "Blockquote"
25713
+ },
25714
+ {
25715
+ id: "table",
25716
+ label: "Table",
25717
+ title: "Table"
25718
+ },
25719
+ {
25720
+ id: "hr",
25721
+ label: "\u2014",
25722
+ title: "Horizontal rule"
25723
+ }
25724
+ ];
25725
+ function MarkdownToolbar({
25726
+ actions = DEFAULT_MARKDOWN_TOOLBAR_ACTIONS,
25727
+ disabled = false,
25728
+ actionsDisabled = false,
25729
+ compact = false,
25730
+ viewMode = "preview",
25731
+ showViewModeToggle = true,
25732
+ onViewModeToggle,
25733
+ className,
25734
+ buttonClassName,
25735
+ toggleButtonClassName,
25736
+ onAction
25737
+ }) {
25738
+ const isPreviewMode = viewMode === "preview";
25739
+ return /* @__PURE__ */ jsxRuntime.jsxs(
25740
+ "div",
25741
+ {
25742
+ className: classNames66__default.default(
25743
+ "eui-markdown-toolbar",
25744
+ "flex flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 p-2",
25745
+ "dark:border-gray-700 dark:bg-gray-900",
25746
+ className
25747
+ ),
25748
+ children: [
25749
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1", children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
25750
+ "button",
25751
+ {
25752
+ type: "button",
25753
+ disabled: disabled || actionsDisabled,
25754
+ title: action.shortcut ? `${action.title || action.label} (${action.shortcut})` : action.title || action.label,
25755
+ onClick: () => onAction?.(action.id),
25756
+ className: classNames66__default.default(
25757
+ "eui-markdown-toolbar-button",
25758
+ "inline-flex items-center justify-center rounded border border-transparent",
25759
+ "text-gray-700 transition-colors hover:border-gray-300 hover:bg-white",
25760
+ "dark:text-gray-200 dark:hover:border-gray-600 dark:hover:bg-gray-800",
25761
+ "disabled:cursor-not-allowed disabled:opacity-50",
25762
+ compact ? "h-7 px-2 text-xs" : "h-8 px-2.5 text-sm",
25763
+ buttonClassName
25764
+ ),
25765
+ children: action.label
25766
+ },
25767
+ action.id
25768
+ )) }),
25769
+ showViewModeToggle ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
25770
+ "button",
25771
+ {
25772
+ type: "button",
25773
+ disabled,
25774
+ onClick: onViewModeToggle,
25775
+ title: isPreviewMode ? "Switch to Markdown syntax" : "Switch to preview",
25776
+ className: classNames66__default.default(
25777
+ "eui-markdown-view-toggle",
25778
+ "inline-flex items-center justify-center rounded border font-medium transition-colors",
25779
+ "border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
25780
+ "dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700",
25781
+ "disabled:cursor-not-allowed disabled:opacity-50",
25782
+ compact ? "h-7 px-2 text-xs" : "h-8 px-3 text-sm",
25783
+ toggleButtonClassName
25784
+ ),
25785
+ children: isPreviewMode ? "Syntax" : "Preview"
25786
+ }
25787
+ ) }) : null
25788
+ ]
25789
+ }
25790
+ );
25791
+ }
25792
+ var MarkdownToolbar_default = MarkdownToolbar;
25793
+ function getLineRange(value, start, end) {
25794
+ const lineStart = value.lastIndexOf("\n", start - 1) + 1;
25795
+ const lineEndIndex = value.indexOf("\n", end);
25796
+ return {
25797
+ lineStart,
25798
+ lineEnd: lineEndIndex === -1 ? value.length : lineEndIndex
25799
+ };
25800
+ }
25801
+ function replaceRange(value, start, end, replacement) {
25802
+ return value.slice(0, start) + replacement + value.slice(end);
25803
+ }
25804
+ function wrapSelection(value, start, end, before, after = before, placeholder = "text") {
25805
+ const selected = value.slice(start, end);
25806
+ const content = selected || placeholder;
25807
+ const replacement = `${before}${content}${after}`;
25808
+ const nextValue = replaceRange(value, start, end, replacement);
25809
+ const selectionStart = start + before.length;
25810
+ const selectionEnd = selectionStart + content.length;
25811
+ return {
25812
+ value: nextValue,
25813
+ selectionStart,
25814
+ selectionEnd
25815
+ };
25816
+ }
25817
+ function prefixSelectedLines(value, start, end, getPrefix) {
25818
+ const { lineStart, lineEnd } = getLineRange(value, start, end);
25819
+ const selectedBlock = value.slice(lineStart, lineEnd);
25820
+ const lines = selectedBlock.split("\n");
25821
+ const replacement = lines.map((line, index) => {
25822
+ const prefix = getPrefix(index);
25823
+ if (line.startsWith(prefix)) {
25824
+ return line;
25825
+ }
25826
+ return `${prefix}${line}`;
25827
+ }).join("\n");
25828
+ const nextValue = replaceRange(value, lineStart, lineEnd, replacement);
25829
+ const delta = replacement.length - selectedBlock.length;
25830
+ return {
25831
+ value: nextValue,
25832
+ selectionStart: start + getPrefix(0).length,
25833
+ selectionEnd: end + delta
25834
+ };
25835
+ }
25836
+ function prefixCurrentLine(value, start, end, prefix) {
25837
+ const { lineStart, lineEnd } = getLineRange(value, start, end);
25838
+ const line = value.slice(lineStart, lineEnd);
25839
+ const cleanedLine = line.replace(/^#{1,6}\s+/, "");
25840
+ const replacement = `${prefix}${cleanedLine}`;
25841
+ const nextValue = replaceRange(value, lineStart, lineEnd, replacement);
25842
+ return {
25843
+ value: nextValue,
25844
+ selectionStart: lineStart + prefix.length,
25845
+ selectionEnd: lineStart + replacement.length
25846
+ };
25847
+ }
25848
+ function insertBlock(value, start, end, block) {
25849
+ const before = value.slice(0, start);
25850
+ const after = value.slice(end);
25851
+ const needsLeadingNewline = before.length > 0 && !before.endsWith("\n");
25852
+ const needsTrailingNewline = after.length > 0 && !after.startsWith("\n");
25853
+ const replacement = `${needsLeadingNewline ? "\n" : ""}${block}${needsTrailingNewline ? "\n" : ""}`;
25854
+ const nextValue = replaceRange(value, start, end, replacement);
25855
+ const selectionStart = start + (needsLeadingNewline ? 1 : 0);
25856
+ const selectionEnd = selectionStart + block.length;
25857
+ return {
25858
+ value: nextValue,
25859
+ selectionStart,
25860
+ selectionEnd
25861
+ };
25862
+ }
25863
+ function applyMarkdownAction(value, start, end, action) {
25864
+ switch (action) {
25865
+ case "heading-1":
25866
+ return prefixCurrentLine(value, start, end, "# ");
25867
+ case "heading-2":
25868
+ return prefixCurrentLine(value, start, end, "## ");
25869
+ case "heading-3":
25870
+ return prefixCurrentLine(value, start, end, "### ");
25871
+ case "bold":
25872
+ return wrapSelection(value, start, end, "**", "**", "bold text");
25873
+ case "italic":
25874
+ return wrapSelection(value, start, end, "_", "_", "italic text");
25875
+ case "strike":
25876
+ return wrapSelection(value, start, end, "~~", "~~", "strikethrough text");
25877
+ case "inline-code":
25878
+ return wrapSelection(value, start, end, "`", "`", "code");
25879
+ case "code-block": {
25880
+ const selected = value.slice(start, end) || "code";
25881
+ return insertBlock(value, start, end, `\`\`\`ts
25882
+ ${selected}
25883
+ \`\`\``);
25884
+ }
25885
+ case "link": {
25886
+ const selected = value.slice(start, end) || "link text";
25887
+ const replacement = `[${selected}](https://example.com)`;
25888
+ const nextValue = replaceRange(value, start, end, replacement);
25889
+ return {
25890
+ value: nextValue,
25891
+ selectionStart: start + 1,
25892
+ selectionEnd: start + 1 + selected.length
25893
+ };
25894
+ }
25895
+ case "image": {
25896
+ const selected = value.slice(start, end) || "image alt";
25897
+ const replacement = `![${selected}](https://example.com/image.png)`;
25898
+ const nextValue = replaceRange(value, start, end, replacement);
25899
+ return {
25900
+ value: nextValue,
25901
+ selectionStart: start + 2,
25902
+ selectionEnd: start + 2 + selected.length
25903
+ };
25904
+ }
25905
+ case "unordered-list":
25906
+ return prefixSelectedLines(value, start, end, () => "- ");
25907
+ case "ordered-list":
25908
+ return prefixSelectedLines(
25909
+ value,
25910
+ start,
25911
+ end,
25912
+ (index) => `${index + 1}. `
25913
+ );
25914
+ case "quote":
25915
+ return prefixSelectedLines(value, start, end, () => "> ");
25916
+ case "table":
25917
+ return insertBlock(
25918
+ value,
25919
+ start,
25920
+ end,
25921
+ [
25922
+ "| Column 1 | Column 2 | Column 3 |",
25923
+ "| --- | --- | --- |",
25924
+ "| Value 1 | Value 2 | Value 3 |"
25925
+ ].join("\n")
25926
+ );
25927
+ case "hr":
25928
+ return insertBlock(value, start, end, "---");
25929
+ default:
25930
+ return {
25931
+ value,
25932
+ selectionStart: start,
25933
+ selectionEnd: end
25934
+ };
25935
+ }
25936
+ }
25937
+ function MarkdownSourceEditor({
25938
+ value,
25939
+ defaultValue = "",
25940
+ onChange,
25941
+ onBlur,
25942
+ viewMode,
25943
+ defaultViewMode = "preview",
25944
+ onViewModeChange,
25945
+ showToolbar = true,
25946
+ showViewModeToggle = true,
25947
+ toolbarProps,
25948
+ previewProps,
25949
+ minHeight = 260,
25950
+ maxHeight,
25951
+ disabled = false,
25952
+ readOnly = false,
25953
+ placeholder = "Write markdown...",
25954
+ containerClassName,
25955
+ toolbarClassName,
25956
+ textareaClassName,
25957
+ previewClassName,
25958
+ className,
25959
+ onKeyDown,
25960
+ ...props
25961
+ }) {
25962
+ const textareaRef = React2.useRef(null);
25963
+ const isControlled = value !== void 0;
25964
+ const isViewModeControlled = viewMode !== void 0;
25965
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
25966
+ const [internalViewMode, setInternalViewMode] = React2.useState(defaultViewMode);
25967
+ const currentValue = isControlled ? value : internalValue;
25968
+ const currentViewMode = isViewModeControlled ? viewMode : internalViewMode;
25969
+ const resolvedValue = currentValue ?? "";
25970
+ React2.useEffect(() => {
25971
+ if (!isControlled) {
25972
+ setInternalValue(defaultValue);
25973
+ }
25974
+ }, [defaultValue, isControlled]);
25975
+ React2.useEffect(() => {
25976
+ if (!isViewModeControlled) {
25977
+ setInternalViewMode(defaultViewMode);
25978
+ }
25979
+ }, [defaultViewMode, isViewModeControlled]);
25980
+ const updateValue = (nextValue) => {
25981
+ if (!isControlled) {
25982
+ setInternalValue(nextValue);
25983
+ }
25984
+ onChange?.(nextValue);
25985
+ };
25986
+ const updateViewMode = (nextViewMode) => {
25987
+ if (!isViewModeControlled) {
25988
+ setInternalViewMode(nextViewMode);
25989
+ }
25990
+ onViewModeChange?.(nextViewMode);
25991
+ };
25992
+ const toggleViewMode = () => {
25993
+ updateViewMode(currentViewMode === "preview" ? "source" : "preview");
25994
+ };
25995
+ const runAction = (action) => {
25996
+ const textarea = textareaRef.current;
25997
+ if (!textarea || disabled || readOnly) return;
25998
+ const start = textarea.selectionStart;
25999
+ const end = textarea.selectionEnd;
26000
+ const result = applyMarkdownAction(resolvedValue, start, end, action);
26001
+ updateValue(result.value);
26002
+ window.setTimeout(() => {
26003
+ textarea.focus();
26004
+ textarea.setSelectionRange(result.selectionStart, result.selectionEnd);
26005
+ }, 0);
26006
+ };
26007
+ const handleToolbarAction = (action) => {
26008
+ if (currentViewMode === "preview") {
26009
+ updateViewMode("source");
26010
+ window.setTimeout(() => {
26011
+ runAction(action);
26012
+ }, 0);
26013
+ return;
26014
+ }
26015
+ runAction(action);
26016
+ };
26017
+ const handleKeyDown = (event) => {
26018
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "b") {
26019
+ event.preventDefault();
26020
+ runAction("bold");
26021
+ return;
26022
+ }
26023
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "i") {
26024
+ event.preventDefault();
26025
+ runAction("italic");
26026
+ return;
26027
+ }
26028
+ onKeyDown?.(event);
26029
+ };
26030
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26031
+ "div",
26032
+ {
26033
+ className: classNames66__default.default(
26034
+ "eui-markdown-editor",
26035
+ "overflow-hidden rounded border border-gray-300 bg-white",
26036
+ "dark:border-gray-700 dark:bg-gray-950",
26037
+ containerClassName,
26038
+ className
26039
+ ),
26040
+ children: [
26041
+ showToolbar ? /* @__PURE__ */ jsxRuntime.jsx(
26042
+ MarkdownToolbar_default,
26043
+ {
26044
+ ...toolbarProps,
26045
+ disabled,
26046
+ actionsDisabled: readOnly,
26047
+ viewMode: currentViewMode,
26048
+ showViewModeToggle,
26049
+ className: classNames66__default.default(toolbarClassName, toolbarProps?.className),
26050
+ onViewModeToggle: toggleViewMode,
26051
+ onAction: handleToolbarAction
26052
+ }
26053
+ ) : null,
26054
+ currentViewMode === "preview" ? /* @__PURE__ */ jsxRuntime.jsx(
26055
+ "div",
26056
+ {
26057
+ className: classNames66__default.default(
26058
+ "eui-markdown-editor-preview",
26059
+ "min-h-[260px] p-4",
26060
+ previewClassName
26061
+ ),
26062
+ style: {
26063
+ minHeight,
26064
+ maxHeight
26065
+ },
26066
+ children: resolvedValue.trim() ? /* @__PURE__ */ jsxRuntime.jsx(MarkdownViewer_default, { ...previewProps, value: resolvedValue }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: placeholder })
26067
+ }
26068
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
26069
+ "textarea",
26070
+ {
26071
+ ...props,
26072
+ ref: textareaRef,
26073
+ value: resolvedValue,
26074
+ disabled,
26075
+ readOnly,
26076
+ placeholder,
26077
+ onChange: (event) => updateValue(event.target.value),
26078
+ onBlur,
26079
+ onKeyDown: handleKeyDown,
26080
+ className: classNames66__default.default(
26081
+ "eui-markdown-source-textarea",
26082
+ "block w-full resize-y border-0 bg-transparent p-4 font-mono text-sm leading-7",
26083
+ "text-gray-900 outline-none placeholder:text-gray-400",
26084
+ "dark:text-gray-100 dark:placeholder:text-gray-500",
26085
+ "disabled:cursor-not-allowed disabled:opacity-60",
26086
+ textareaClassName
26087
+ ),
26088
+ style: {
26089
+ minHeight,
26090
+ maxHeight,
26091
+ ...props.style
26092
+ }
26093
+ }
26094
+ )
26095
+ ]
26096
+ }
26097
+ );
26098
+ }
26099
+ var MarkdownSourceEditor_default = MarkdownSourceEditor;
26100
+ function MarkdownPreviewPane({
26101
+ value = "",
26102
+ emptyState = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Nothing to preview yet." }),
26103
+ className,
26104
+ contentClassName,
26105
+ ...viewerProps
26106
+ }) {
26107
+ return /* @__PURE__ */ jsxRuntime.jsx(
26108
+ "div",
26109
+ {
26110
+ className: classNames66__default.default(
26111
+ "eui-markdown-preview-pane",
26112
+ "rounded border border-gray-300 bg-white p-4",
26113
+ "dark:border-gray-700 dark:bg-gray-950",
26114
+ className
26115
+ ),
26116
+ children: value.trim() ? /* @__PURE__ */ jsxRuntime.jsx(
26117
+ MarkdownViewer_default,
26118
+ {
26119
+ ...viewerProps,
26120
+ value,
26121
+ className: contentClassName
26122
+ }
26123
+ ) : emptyState
26124
+ }
26125
+ );
26126
+ }
26127
+ var MarkdownPreviewPane_default = MarkdownPreviewPane;
26128
+ function MarkdownSplitEditor({
26129
+ value,
26130
+ defaultValue = "",
26131
+ onChange,
26132
+ onBlur,
26133
+ previewProps,
26134
+ previewPlacement = "right",
26135
+ sourceLabel = "Editor",
26136
+ previewLabel = "Preview",
26137
+ wrapperClassName,
26138
+ sourceWrapperClassName,
26139
+ previewWrapperClassName,
26140
+ ...sourceEditorProps
26141
+ }) {
26142
+ const isControlled = value !== void 0;
26143
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26144
+ const currentValue = isControlled ? value : internalValue;
26145
+ React2.useEffect(() => {
26146
+ if (!isControlled) {
26147
+ setInternalValue(defaultValue);
26148
+ }
26149
+ }, [defaultValue, isControlled]);
26150
+ const updateValue = (nextValue) => {
26151
+ if (!isControlled) {
26152
+ setInternalValue(nextValue);
26153
+ }
26154
+ onChange?.(nextValue);
26155
+ };
26156
+ const isHorizontal = previewPlacement === "right";
26157
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26158
+ "div",
26159
+ {
26160
+ className: classNames66__default.default(
26161
+ "eui-markdown-split-editor",
26162
+ "grid gap-4",
26163
+ isHorizontal ? "grid-cols-1 lg:grid-cols-2" : "grid-cols-1",
26164
+ wrapperClassName
26165
+ ),
26166
+ children: [
26167
+ /* @__PURE__ */ jsxRuntime.jsxs(
26168
+ "div",
26169
+ {
26170
+ className: classNames66__default.default(
26171
+ "eui-markdown-split-source",
26172
+ "min-w-0 space-y-2",
26173
+ sourceWrapperClassName
26174
+ ),
26175
+ children: [
26176
+ sourceLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200", children: sourceLabel }) : null,
26177
+ /* @__PURE__ */ jsxRuntime.jsx(
26178
+ MarkdownSourceEditor_default,
26179
+ {
26180
+ ...sourceEditorProps,
26181
+ value: currentValue,
26182
+ onChange: updateValue,
26183
+ onBlur,
26184
+ defaultViewMode: "source",
26185
+ showViewModeToggle: false
26186
+ }
26187
+ )
26188
+ ]
26189
+ }
26190
+ ),
26191
+ /* @__PURE__ */ jsxRuntime.jsxs(
26192
+ "div",
26193
+ {
26194
+ className: classNames66__default.default(
26195
+ "eui-markdown-split-preview",
26196
+ "min-w-0 space-y-2",
26197
+ previewWrapperClassName
26198
+ ),
26199
+ children: [
26200
+ previewLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200", children: previewLabel }) : null,
26201
+ /* @__PURE__ */ jsxRuntime.jsx(MarkdownPreviewPane_default, { ...previewProps, value: currentValue })
26202
+ ]
26203
+ }
26204
+ )
26205
+ ]
26206
+ }
26207
+ );
26208
+ }
26209
+ var MarkdownSplitEditor_default = MarkdownSplitEditor;
26210
+ function MarkdownEditor({
26211
+ value,
26212
+ defaultValue = "",
26213
+ onChange,
26214
+ onBlur,
26215
+ mode = "source",
26216
+ viewMode,
26217
+ defaultViewMode = "preview",
26218
+ onViewModeChange,
26219
+ splitProps,
26220
+ richEditor,
26221
+ ...sourceEditorProps
26222
+ }) {
26223
+ const isControlled = value !== void 0;
26224
+ const [internalValue, setInternalValue] = React2.useState(defaultValue);
26225
+ const currentValue = isControlled ? value : internalValue;
26226
+ React2.useEffect(() => {
26227
+ if (!isControlled) {
26228
+ setInternalValue(defaultValue);
26229
+ }
26230
+ }, [defaultValue, isControlled]);
26231
+ const updateValue = (nextValue) => {
26232
+ if (!isControlled) {
26233
+ setInternalValue(nextValue);
26234
+ }
26235
+ onChange?.(nextValue);
26236
+ };
26237
+ if (mode === "rich" && richEditor) {
26238
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: richEditor });
26239
+ }
26240
+ if (mode === "split") {
26241
+ return /* @__PURE__ */ jsxRuntime.jsx(
26242
+ MarkdownSplitEditor_default,
26243
+ {
26244
+ ...sourceEditorProps,
26245
+ ...splitProps,
26246
+ value: currentValue,
26247
+ onChange: updateValue,
26248
+ onBlur
26249
+ }
26250
+ );
26251
+ }
26252
+ return /* @__PURE__ */ jsxRuntime.jsx(
26253
+ MarkdownSourceEditor_default,
26254
+ {
26255
+ ...sourceEditorProps,
26256
+ value: currentValue,
26257
+ onChange: updateValue,
26258
+ onBlur,
26259
+ viewMode,
26260
+ defaultViewMode,
26261
+ onViewModeChange
26262
+ }
26263
+ );
26264
+ }
26265
+ var MarkdownEditor_default = MarkdownEditor;
26266
+ function MarkdownField({
26267
+ name,
26268
+ validate,
26269
+ label,
26270
+ helperText,
26271
+ wrapperClassName,
26272
+ labelClassName,
26273
+ helperTextClassName,
26274
+ ...editorProps
26275
+ }) {
26276
+ const [field, meta, helpers] = formik.useField({
26277
+ name,
26278
+ validate
26279
+ });
26280
+ const hasError = Boolean(meta.touched && meta.error);
26281
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26282
+ "div",
26283
+ {
26284
+ className: classNames66__default.default(
26285
+ "eui-markdown-field",
26286
+ "relative space-y-2",
26287
+ wrapperClassName
26288
+ ),
26289
+ children: [
26290
+ label ? /* @__PURE__ */ jsxRuntime.jsx(
26291
+ "label",
26292
+ {
26293
+ htmlFor: editorProps.id || field.name,
26294
+ className: classNames66__default.default(
26295
+ "block text-sm font-medium text-gray-700 dark:text-gray-200",
26296
+ labelClassName
26297
+ ),
26298
+ children: label
26299
+ }
26300
+ ) : null,
26301
+ /* @__PURE__ */ jsxRuntime.jsx(
26302
+ MarkdownEditor_default,
26303
+ {
26304
+ ...editorProps,
26305
+ id: editorProps.id || field.name,
26306
+ name: field.name,
26307
+ value: field.value || "",
26308
+ onChange: (nextValue) => {
26309
+ helpers.setValue(nextValue);
26310
+ },
26311
+ onBlur: () => {
26312
+ helpers.setTouched(true);
26313
+ }
26314
+ }
26315
+ ),
26316
+ helperText && !hasError ? /* @__PURE__ */ jsxRuntime.jsx(
26317
+ "p",
26318
+ {
26319
+ className: classNames66__default.default(
26320
+ "text-sm text-gray-500 dark:text-gray-400",
26321
+ helperTextClassName
26322
+ ),
26323
+ children: helperText
26324
+ }
26325
+ ) : null,
26326
+ /* @__PURE__ */ jsxRuntime.jsx(InputResponse_default, { name: field.name, visibility: hasError, variant: "danger" })
26327
+ ]
26328
+ }
26329
+ );
26330
+ }
26331
+ var MarkdownField_default = MarkdownField;
26332
+ function resolveSize(value) {
26333
+ if (value === void 0) return void 0;
26334
+ return typeof value === "number" ? `${value}px` : value;
26335
+ }
26336
+ function MarkdownLayout({
26337
+ children,
26338
+ content,
26339
+ toc,
26340
+ sidebar,
26341
+ aside,
26342
+ header,
26343
+ footer,
26344
+ tocPosition = "right",
26345
+ showToc = true,
26346
+ showSidebar = true,
26347
+ showAside = true,
26348
+ stickyToc = true,
26349
+ stickySidebar = true,
26350
+ stickyAside = true,
26351
+ stickyOffset = "6rem",
26352
+ maxWidth = "1440px",
26353
+ className,
26354
+ containerClassName,
26355
+ gridClassName,
26356
+ contentClassName,
26357
+ tocClassName,
26358
+ sidebarClassName,
26359
+ asideClassName,
26360
+ headerClassName,
26361
+ footerClassName
26362
+ }) {
26363
+ const resolvedContent = children ?? content;
26364
+ const hasToc = showToc && Boolean(toc);
26365
+ const hasSidebar = showSidebar && Boolean(sidebar);
26366
+ const hasAside = showAside && Boolean(aside);
26367
+ const stickyStyle = {
26368
+ top: resolveSize(stickyOffset)
26369
+ };
26370
+ const hasLeftToc = hasToc && tocPosition === "left";
26371
+ const hasRightToc = hasToc && tocPosition === "right";
26372
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames66__default.default("eui-markdown-layout", "w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
26373
+ "div",
26374
+ {
26375
+ className: classNames66__default.default(
26376
+ "eui-markdown-layout-container",
26377
+ "mx-auto w-full px-4 sm:px-6 lg:px-8",
26378
+ containerClassName
26379
+ ),
26380
+ style: {
26381
+ maxWidth: resolveSize(maxWidth)
26382
+ },
26383
+ children: [
26384
+ header ? /* @__PURE__ */ jsxRuntime.jsx(
26385
+ "header",
26386
+ {
26387
+ className: classNames66__default.default(
26388
+ "eui-markdown-layout-header",
26389
+ "mb-8",
26390
+ headerClassName
26391
+ ),
26392
+ children: header
26393
+ }
26394
+ ) : null,
26395
+ /* @__PURE__ */ jsxRuntime.jsxs(
26396
+ "div",
26397
+ {
26398
+ className: classNames66__default.default(
26399
+ "eui-markdown-layout-grid",
26400
+ "grid grid-cols-1 gap-8",
26401
+ hasSidebar && hasToc && "xl:grid-cols-[16rem_minmax(0,1fr)_18rem]",
26402
+ hasSidebar && !hasToc && "lg:grid-cols-[16rem_minmax(0,1fr)]",
26403
+ !hasSidebar && hasToc && "lg:grid-cols-[minmax(0,1fr)_18rem]",
26404
+ hasAside && "2xl:grid-cols-[16rem_minmax(0,1fr)_18rem_16rem]",
26405
+ gridClassName
26406
+ ),
26407
+ children: [
26408
+ hasSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
26409
+ "aside",
26410
+ {
26411
+ className: classNames66__default.default(
26412
+ "eui-markdown-layout-sidebar",
26413
+ "min-w-0",
26414
+ stickySidebar && "lg:sticky lg:self-start",
26415
+ sidebarClassName
26416
+ ),
26417
+ style: stickySidebar ? stickyStyle : void 0,
26418
+ children: sidebar
26419
+ }
26420
+ ) : null,
26421
+ hasLeftToc ? /* @__PURE__ */ jsxRuntime.jsx(
26422
+ "aside",
26423
+ {
26424
+ className: classNames66__default.default(
26425
+ "eui-markdown-layout-toc",
26426
+ "min-w-0",
26427
+ stickyToc && "lg:sticky lg:self-start",
26428
+ tocClassName
26429
+ ),
26430
+ style: stickyToc ? stickyStyle : void 0,
26431
+ children: toc
26432
+ }
26433
+ ) : null,
26434
+ /* @__PURE__ */ jsxRuntime.jsx(
26435
+ "main",
26436
+ {
26437
+ className: classNames66__default.default(
26438
+ "eui-markdown-layout-content",
26439
+ "min-w-0",
26440
+ contentClassName
26441
+ ),
26442
+ children: resolvedContent
26443
+ }
26444
+ ),
26445
+ hasRightToc ? /* @__PURE__ */ jsxRuntime.jsx(
26446
+ "aside",
26447
+ {
26448
+ className: classNames66__default.default(
26449
+ "eui-markdown-layout-toc",
26450
+ "min-w-0",
26451
+ stickyToc && "lg:sticky lg:self-start",
26452
+ tocClassName
26453
+ ),
26454
+ style: stickyToc ? stickyStyle : void 0,
26455
+ children: toc
26456
+ }
26457
+ ) : null,
26458
+ hasAside ? /* @__PURE__ */ jsxRuntime.jsx(
26459
+ "aside",
26460
+ {
26461
+ className: classNames66__default.default(
26462
+ "eui-markdown-layout-aside",
26463
+ "min-w-0",
26464
+ stickyAside && "2xl:sticky 2xl:self-start",
26465
+ asideClassName
26466
+ ),
26467
+ style: stickyAside ? stickyStyle : void 0,
26468
+ children: aside
26469
+ }
26470
+ ) : null
26471
+ ]
26472
+ }
26473
+ ),
26474
+ footer ? /* @__PURE__ */ jsxRuntime.jsx(
26475
+ "footer",
26476
+ {
26477
+ className: classNames66__default.default(
26478
+ "eui-markdown-layout-footer",
26479
+ "mt-10",
26480
+ footerClassName
26481
+ ),
26482
+ children: footer
26483
+ }
26484
+ ) : null
26485
+ ]
26486
+ }
26487
+ ) });
26488
+ }
26489
+ var MarkdownLayout_default = MarkdownLayout;
26490
+ function MarkdownDocsLayoutContent({
26491
+ children,
26492
+ markdown,
26493
+ value,
26494
+ headings,
26495
+ title,
26496
+ description,
26497
+ header,
26498
+ headerActions,
26499
+ content,
26500
+ toc,
26501
+ viewerProps,
26502
+ tocProps,
26503
+ enableDefaultViewer = true,
26504
+ enableDefaultToc = true,
26505
+ docsHeaderClassName,
26506
+ docsTitleClassName,
26507
+ docsDescriptionClassName,
26508
+ ...layoutProps
26509
+ }) {
26510
+ const resolvedMarkdown = value ?? markdown ?? "";
26511
+ const resolvedHeader = header ?? (title || description || headerActions ? /* @__PURE__ */ jsxRuntime.jsx(
26512
+ "div",
26513
+ {
26514
+ className: classNames66__default.default(
26515
+ "eui-markdown-docs-header",
26516
+ "flex flex-col gap-4 border-b border-gray-200 pb-6",
26517
+ "dark:border-gray-700",
26518
+ docsHeaderClassName
26519
+ ),
26520
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
26521
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-2", children: [
26522
+ title ? /* @__PURE__ */ jsxRuntime.jsx(
26523
+ "h1",
26524
+ {
26525
+ className: classNames66__default.default(
26526
+ "eui-markdown-docs-title",
26527
+ "text-3xl font-bold tracking-tight text-gray-950",
26528
+ "dark:text-gray-50",
26529
+ docsTitleClassName
26530
+ ),
26531
+ children: title
26532
+ }
26533
+ ) : null,
26534
+ description ? /* @__PURE__ */ jsxRuntime.jsx(
26535
+ "div",
26536
+ {
26537
+ className: classNames66__default.default(
26538
+ "eui-markdown-docs-description",
26539
+ "max-w-3xl text-base leading-7 text-gray-600",
26540
+ "dark:text-gray-400",
26541
+ docsDescriptionClassName
26542
+ ),
26543
+ children: description
26544
+ }
26545
+ ) : null
26546
+ ] }),
26547
+ headerActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: headerActions }) : null
26548
+ ] })
26549
+ }
26550
+ ) : null);
26551
+ const resolvedContent = children ?? content ?? (enableDefaultViewer ? /* @__PURE__ */ jsxRuntime.jsx(
26552
+ MarkdownViewer_default,
26553
+ {
26554
+ ...viewerProps,
26555
+ value: resolvedMarkdown,
26556
+ headings
26557
+ }
26558
+ ) : null);
26559
+ const resolvedToc = toc ?? (enableDefaultToc ? /* @__PURE__ */ jsxRuntime.jsx(
26560
+ MarkdownTOC_default,
26561
+ {
26562
+ ...tocProps,
26563
+ markdown: resolvedMarkdown,
26564
+ headings
26565
+ }
26566
+ ) : null);
26567
+ return /* @__PURE__ */ jsxRuntime.jsx(
26568
+ MarkdownLayout_default,
26569
+ {
26570
+ ...layoutProps,
26571
+ header: resolvedHeader,
26572
+ toc: resolvedToc,
26573
+ content: resolvedContent
26574
+ }
26575
+ );
26576
+ }
26577
+ function MarkdownDocsLayout({
26578
+ markdown,
26579
+ value,
26580
+ headings,
26581
+ meta,
26582
+ providerProps,
26583
+ enableProvider = true,
26584
+ ...props
26585
+ }) {
26586
+ const resolvedMarkdown = value ?? markdown ?? "";
26587
+ if (!enableProvider) {
26588
+ return /* @__PURE__ */ jsxRuntime.jsx(
26589
+ MarkdownDocsLayoutContent,
26590
+ {
26591
+ ...props,
26592
+ markdown,
26593
+ value,
26594
+ headings
26595
+ }
26596
+ );
26597
+ }
26598
+ return /* @__PURE__ */ jsxRuntime.jsx(
26599
+ MarkdownProvider_default,
26600
+ {
26601
+ ...providerProps,
26602
+ markdown: resolvedMarkdown,
26603
+ headings,
26604
+ meta,
26605
+ children: /* @__PURE__ */ jsxRuntime.jsx(
26606
+ MarkdownDocsLayoutContent,
26607
+ {
26608
+ ...props,
26609
+ markdown: resolvedMarkdown,
26610
+ headings
26611
+ }
26612
+ )
26613
+ }
26614
+ );
26615
+ }
26616
+ var MarkdownDocsLayout_default = MarkdownDocsLayout;
24553
26617
  function GenericLayout({
24554
26618
  children,
24555
26619
  styles,
@@ -24558,7 +26622,7 @@ function GenericLayout({
24558
26622
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { defaultTheme, children: /* @__PURE__ */ jsxRuntime.jsx(
24559
26623
  "div",
24560
26624
  {
24561
- className: classNames17__default.default({
26625
+ className: classNames66__default.default({
24562
26626
  [`${styles}`]: styles
24563
26627
  }),
24564
26628
  children
@@ -24607,7 +26671,7 @@ function SidemenuLayout({ data, children }) {
24607
26671
  return /* @__PURE__ */ jsxRuntime.jsx(DefaultLayout_default, { children: /* @__PURE__ */ jsxRuntime.jsxs(
24608
26672
  "div",
24609
26673
  {
24610
- className: classNames17__default.default({
26674
+ className: classNames66__default.default({
24611
26675
  grid: true,
24612
26676
  "grid-cols-7 gap-10": !isMobile,
24613
26677
  "grid-cols-1 gap-": isMobile
@@ -24788,9 +26852,28 @@ exports.LinePlot = LinePlot;
24788
26852
  exports.Link = Link;
24789
26853
  exports.List = List_default;
24790
26854
  exports.ListItem = ListItem_default;
26855
+ exports.MarkdownBlockquote = MarkdownBlockquote_default;
26856
+ exports.MarkdownCodeBlock = MarkdownCodeBlock_default;
26857
+ exports.MarkdownContext = MarkdownContext;
26858
+ exports.MarkdownDocsLayout = MarkdownDocsLayout_default;
24791
26859
  exports.MarkdownEditor = MarkdownEditor_default;
26860
+ exports.MarkdownField = MarkdownField_default;
26861
+ exports.MarkdownHeadingComponent = MarkdownHeading_default;
26862
+ exports.MarkdownImage = MarkdownImage_default;
26863
+ exports.MarkdownInlineCode = MarkdownInlineCode_default;
26864
+ exports.MarkdownLayout = MarkdownLayout_default;
26865
+ exports.MarkdownLink = MarkdownLink_default;
26866
+ exports.MarkdownPreviewPane = MarkdownPreviewPane_default;
24792
26867
  exports.MarkdownProvider = MarkdownProvider_default;
26868
+ exports.MarkdownRenderer = MarkdownRenderer_default;
26869
+ exports.MarkdownSourceEditor = MarkdownSourceEditor_default;
26870
+ exports.MarkdownSplitEditor = MarkdownSplitEditor_default;
24793
26871
  exports.MarkdownTOC = MarkdownTOC_default;
26872
+ exports.MarkdownTOCItem = MarkdownTOCItem_default;
26873
+ exports.MarkdownTable = MarkdownTable_default;
26874
+ exports.MarkdownTableCell = MarkdownTableCell;
26875
+ exports.MarkdownTableHeaderCell = MarkdownTableHeaderCell;
26876
+ exports.MarkdownToolbar = MarkdownToolbar_default;
24794
26877
  exports.MarkdownViewer = MarkdownViewer_default;
24795
26878
  exports.Menu = Menu;
24796
26879
  exports.MenuGroup = MenuGroup;
@@ -24878,17 +26961,20 @@ exports.cn = cn;
24878
26961
  exports.createConfigurator = createConfigurator;
24879
26962
  exports.createForceLayout = createForceLayout;
24880
26963
  exports.createGridLayout = createGridLayout;
26964
+ exports.createHeadingSlug = createHeadingSlug;
24881
26965
  exports.createInitialChartState = createInitialChartState;
24882
26966
  exports.createTreeLayout = createTreeLayout;
24883
26967
  exports.createURLResolver = createURLResolver;
24884
26968
  exports.decrementReplyCount = decrementReplyCount;
24885
26969
  exports.enumValues = enumValues;
24886
26970
  exports.euiToast = euiToast;
26971
+ exports.extractHeadings = extractHeadings;
24887
26972
  exports.findReview = findReview;
24888
26973
  exports.formatChartValue = formatChartValue;
24889
26974
  exports.formatCommentDate = formatCommentDate;
24890
26975
  exports.formatConfigError = formatConfigError;
24891
26976
  exports.formatReviewDate = formatReviewDate;
26977
+ exports.generateHeadingNumbers = generateHeadingNumbers;
24892
26978
  exports.getAllowedOrigins = getAllowedOrigins;
24893
26979
  exports.getBrowserHref = getBrowserHref;
24894
26980
  exports.getBrowserOrigin = getBrowserOrigin;
@@ -24906,6 +26992,7 @@ exports.limitRealtimePoints = limitRealtimePoints;
24906
26992
  exports.normalize = normalize;
24907
26993
  exports.normalizeChartData = normalizeChartData;
24908
26994
  exports.normalizeChartDataPoint = normalizeChartDataPoint;
26995
+ exports.normalizeMarkdown = normalizeMarkdown;
24909
26996
  exports.normalizeReview = normalizeReview;
24910
26997
  exports.normalizeReviewAuthor = normalizeReviewAuthor;
24911
26998
  exports.normalizeReviewReply = normalizeReviewReply;
@@ -24925,13 +27012,16 @@ exports.resolveAppearanceStyles = resolveAppearanceStyles;
24925
27012
  exports.resolveChartColor = resolveChartColor;
24926
27013
  exports.resolveChartColors = resolveChartColors;
24927
27014
  exports.resolveWithGlobal = resolveWithGlobal;
27015
+ exports.sanitizeHeading = sanitizeHeading;
24928
27016
  exports.sendToast = sendToast;
27017
+ exports.slugify = slugify;
24929
27018
  exports.toConfiguratorError = toConfiguratorError;
24930
27019
  exports.updateComment = updateComment;
24931
27020
  exports.updateReplyCacheComment = updateReplyCacheComment;
24932
27021
  exports.updateReview = updateReview;
24933
27022
  exports.updateReviewReply = updateReviewReply;
24934
27023
  exports.upsertReview = upsertReview;
27024
+ exports.useActiveHeading = useActiveHeading;
24935
27025
  exports.useChartContext = useChartContext;
24936
27026
  exports.useChartData = useChartData;
24937
27027
  exports.useChartPolling = useChartPolling;
@@ -24944,6 +27034,8 @@ exports.useCurrentTheme = useCurrentTheme_default;
24944
27034
  exports.useDrawer = useDrawer_default;
24945
27035
  exports.useEUIConfig = useEUIConfig;
24946
27036
  exports.useIsMobile = useIsMobile_default;
27037
+ exports.useMarkdown = useMarkdown;
27038
+ exports.useMarkdownHeadings = useMarkdownHeadings;
24947
27039
  exports.useModal = useModal_default;
24948
27040
  exports.useReviewThreadState = useReviewThreadState;
24949
27041
  exports.useTheme = useTheme_default;