elseware-ui 2.37.1 → 2.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { twMerge } from 'tailwind-merge';
2
- import React2, { createContext, forwardRef, useState, useImperativeHandle, useEffect, useMemo, useRef, useCallback, useContext, Children } from 'react';
2
+ import React2, { createContext, forwardRef, useState, useImperativeHandle, useEffect, useMemo, useRef, useCallback, useContext, Children, isValidElement } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { BsStarFill, BsStarHalf, BsStar, BsChevronDown, BsFillDiamondFill } from 'react-icons/bs';
5
5
  import { FaSun, FaMoon, FaGripVertical, FaTrash, FaPlus, FaTimes, FaBars, FaCircle, FaEyeSlash, FaEye } from 'react-icons/fa';
6
6
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Line, AreaChart, Area, BarChart, Bar, PieChart, Pie, Cell, ScatterChart, Scatter } from 'recharts';
7
- import classNames17 from 'classnames';
7
+ import classNames66 from 'classnames';
8
8
  import { FaCircleChevronDown } from 'react-icons/fa6';
9
9
  import ReactWorldFlags from 'react-world-flags';
10
10
  import emojiFlags from 'emoji-flags';
@@ -16,9 +16,40 @@ import { motion, AnimatePresence } from 'framer-motion';
16
16
  import { AiOutlineLoading } from 'react-icons/ai';
17
17
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
18
18
  import { MdUpload, MdOutlineDone, MdOutlineRemoveCircleOutline } from 'react-icons/md';
19
- import '@mdxeditor/editor/style.css';
20
- import { MDXEditor, headingsPlugin, linkPlugin, listsPlugin, imagePlugin, tablePlugin, linkDialogPlugin, thematicBreakPlugin, quotePlugin, toolbarPlugin, UndoRedo, Separator, BlockTypeSelect, BoldItalicUnderlineToggles, StrikeThroughSupSubToggles, ListsToggle, CreateLink, InsertImage, InsertTable, InsertThematicBreak, markdownShortcutPlugin, frontmatterPlugin, codeBlockPlugin, codeMirrorPlugin } from '@mdxeditor/editor';
21
19
  import { BiCheckCircle, BiXCircle, BiChevronDown, BiChevronUp, BiSolidLike, BiLike, BiSolidDislike, BiDislike, BiDotsVerticalRounded, BiReply, BiEdit, BiTrash, BiFlag } from 'react-icons/bi';
20
+ import ReactMarkdown from 'react-markdown';
21
+ import remarkGfm from 'remark-gfm';
22
+ import rehypeRaw from 'rehype-raw';
23
+ import rehypeSanitize from 'rehype-sanitize';
24
+ import { PrismLight } from 'react-syntax-highlighter';
25
+ import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
26
+ import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';
27
+ import c from 'react-syntax-highlighter/dist/esm/languages/prism/c';
28
+ import cpp from 'react-syntax-highlighter/dist/esm/languages/prism/cpp';
29
+ import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
30
+ import go from 'react-syntax-highlighter/dist/esm/languages/prism/go';
31
+ import java from 'react-syntax-highlighter/dist/esm/languages/prism/java';
32
+ import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
33
+ import json from 'react-syntax-highlighter/dist/esm/languages/prism/json';
34
+ import jsx210 from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
35
+ import markup from 'react-syntax-highlighter/dist/esm/languages/prism/markup';
36
+ import python from 'react-syntax-highlighter/dist/esm/languages/prism/python';
37
+ import rust from 'react-syntax-highlighter/dist/esm/languages/prism/rust';
38
+ import scss from 'react-syntax-highlighter/dist/esm/languages/prism/scss';
39
+ import sql from 'react-syntax-highlighter/dist/esm/languages/prism/sql';
40
+ import tsx from 'react-syntax-highlighter/dist/esm/languages/prism/tsx';
41
+ import typescript from 'react-syntax-highlighter/dist/esm/languages/prism/typescript';
42
+ import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml';
43
+ import CodeMirror from '@uiw/react-codemirror';
44
+ import { markdown } from '@codemirror/lang-markdown';
45
+ import { oneDark } from '@codemirror/theme-one-dark';
46
+ import { MDXEditor, headingsPlugin, listsPlugin, quotePlugin, thematicBreakPlugin, markdownShortcutPlugin, linkPlugin, imagePlugin, tablePlugin, codeBlockPlugin, codeMirrorPlugin, toolbarPlugin, UndoRedo, Separator, BoldItalicUnderlineToggles, CodeToggle, ListsToggle, CreateLink, InsertImage, InsertTable, InsertCodeBlock } from '@mdxeditor/editor';
47
+ import '@mdxeditor/editor/style.css';
48
+ import { MilkdownProvider, useEditor, Milkdown } from '@milkdown/react';
49
+ import { Editor, rootCtx, defaultValueCtx, editorViewOptionsCtx } from '@milkdown/kit/core';
50
+ import { commonmark } from '@milkdown/kit/preset/commonmark';
51
+ import { gfm } from '@milkdown/kit/preset/gfm';
52
+ import { listenerCtx, listener } from '@milkdown/kit/plugin/listener';
22
53
 
23
54
  // node_modules/clsx/dist/clsx.mjs
24
55
  function r(e) {
@@ -138,7 +169,7 @@ var CURRENCIES = [
138
169
 
139
170
  // src/utils/currency.ts
140
171
  var getCurrencySymbol = (code) => {
141
- const currency = CURRENCIES.find((c) => c.code === code);
172
+ const currency = CURRENCIES.find((c2) => c2.code === code);
142
173
  return currency ? currency.symbol : null;
143
174
  };
144
175
 
@@ -3732,7 +3763,7 @@ function renderTransitionChild(children, className) {
3732
3763
  }
3733
3764
  const element = child;
3734
3765
  return React2.cloneElement(element, {
3735
- className: classNames17(element.props.className, className)
3766
+ className: classNames66(element.props.className, className)
3736
3767
  });
3737
3768
  }
3738
3769
  function TransitionBase({
@@ -3752,7 +3783,7 @@ function TransitionBase({
3752
3783
  if (!mounted && unmountOnExit) {
3753
3784
  return null;
3754
3785
  }
3755
- const transitionClassName = classNames17(
3786
+ const transitionClassName = classNames66(
3756
3787
  visibility ? enterClassName : leaveClassName,
3757
3788
  active ? visibleClassName : hiddenClassName
3758
3789
  );
@@ -3927,7 +3958,7 @@ function Accordion({
3927
3958
  /* @__PURE__ */ jsxs(
3928
3959
  "div",
3929
3960
  {
3930
- className: classNames17(
3961
+ className: classNames66(
3931
3962
  "inline-flex gap-3 items-center px-3 py-2 w-full eui-gradient-to-r-general-xs",
3932
3963
  {
3933
3964
  "hover:cursor-pointer": toggleOnSummaryClick
@@ -3948,7 +3979,7 @@ function Accordion({
3948
3979
  children: /* @__PURE__ */ jsx(
3949
3980
  FaCircleChevronDown,
3950
3981
  {
3951
- className: classNames17("text-xl transition-transform duration-300", {
3982
+ className: classNames66("text-xl transition-transform duration-300", {
3952
3983
  "rotate-180": collapse
3953
3984
  })
3954
3985
  }
@@ -3962,7 +3993,7 @@ function Accordion({
3962
3993
  /* @__PURE__ */ jsx(TransitionAccordion_default, { visibility: collapse, children: /* @__PURE__ */ jsx(
3963
3994
  "div",
3964
3995
  {
3965
- className: classNames17(
3996
+ className: classNames66(
3966
3997
  "border-t border-t-eui-dark-400/40 eui-text-sm",
3967
3998
  {
3968
3999
  "p-5": enableChildrenPadding
@@ -4046,7 +4077,7 @@ function CardHeader({ icon, title, description, className }) {
4046
4077
  return /* @__PURE__ */ jsxs(
4047
4078
  "div",
4048
4079
  {
4049
- className: classNames17(
4080
+ className: classNames66(
4050
4081
  "flex items-start gap-4 p-6 border-b border-white/10",
4051
4082
  className
4052
4083
  ),
@@ -4062,14 +4093,14 @@ function CardHeader({ icon, title, description, className }) {
4062
4093
  }
4063
4094
  var CardHeader_default = CardHeader;
4064
4095
  function CardContent({ children, className }) {
4065
- return /* @__PURE__ */ jsx("div", { className: classNames17("p-6 text-gray-300 text-sm", className), children });
4096
+ return /* @__PURE__ */ jsx("div", { className: classNames66("p-6 text-gray-300 text-sm", className), children });
4066
4097
  }
4067
4098
  var CardContent_default = CardContent;
4068
4099
  function CardFooter({ children, className }) {
4069
4100
  return /* @__PURE__ */ jsx(
4070
4101
  "div",
4071
4102
  {
4072
- className: classNames17(
4103
+ className: classNames66(
4073
4104
  "flex items-center gap-3 p-5 border-t border-white/10 text-sm text-gray-400",
4074
4105
  className
4075
4106
  ),
@@ -4111,7 +4142,7 @@ function GradientAnimation({
4111
4142
  return /* @__PURE__ */ jsx(
4112
4143
  "div",
4113
4144
  {
4114
- className: classNames17("absolute inset-0"),
4145
+ className: classNames66("absolute inset-0"),
4115
4146
  style: {
4116
4147
  background: `linear-gradient(${cfg.angle}deg, ${cfg.colors?.join(",")})`,
4117
4148
  backgroundSize: cfg.backgroundSize,
@@ -4257,7 +4288,7 @@ function MotionSurface({
4257
4288
  }) {
4258
4289
  const AnimationComponent = animationVariant === "custom" ? CustomAnimation : animationRegistry[animationVariant];
4259
4290
  const OverlayComponent = overlay === "custom" ? CustomOverlay : overlayRegistry[overlay];
4260
- return /* @__PURE__ */ jsxs("div", { className: classNames17("relative overflow-hidden", className), children: [
4291
+ return /* @__PURE__ */ jsxs("div", { className: classNames66("relative overflow-hidden", className), children: [
4261
4292
  AnimationComponent && /* @__PURE__ */ jsx(AnimationComponent, { config: animationConfig, animated }),
4262
4293
  OverlayComponent && /* @__PURE__ */ jsx(OverlayComponent, { config: overlayConfig }),
4263
4294
  /* @__PURE__ */ jsx("div", { className: "relative z-10", children })
@@ -5661,7 +5692,7 @@ var Backdrop = ({ children, styles }) => {
5661
5692
  return /* @__PURE__ */ jsx(
5662
5693
  "div",
5663
5694
  {
5664
- className: classNames17({
5695
+ className: classNames66({
5665
5696
  "bg-black/75 top-0 bottom-0 left-0 right-0 z-50 fixed inset-0 flex items-center justify-center overflow-hidden": true,
5666
5697
  [`${styles}`]: styles
5667
5698
  }),
@@ -6185,7 +6216,7 @@ var Form = ({
6185
6216
  /* @__PURE__ */ jsx(UnsavedChangesGuard_default, { formik, enabled: warnOnUnsavedChanges }),
6186
6217
  /* @__PURE__ */ jsx(DirtyObserver_default, { formik, onDirtyChange }),
6187
6218
  /* @__PURE__ */ jsx(FormObserver_default, { formik, onChange }),
6188
- /* @__PURE__ */ jsx("div", { className: classNames17(styles), children })
6219
+ /* @__PURE__ */ jsx("div", { className: classNames66(styles), children })
6189
6220
  ] })
6190
6221
  }
6191
6222
  );
@@ -6227,16 +6258,16 @@ function normalizeToastStatus(status = "default" /* default */) {
6227
6258
  }
6228
6259
  function emit() {
6229
6260
  const snapshot = [...toasts];
6230
- listeners.forEach((listener) => {
6231
- listener(snapshot);
6261
+ listeners.forEach((listener2) => {
6262
+ listener2(snapshot);
6232
6263
  });
6233
6264
  }
6234
6265
  var toastStore = {
6235
- subscribe(listener) {
6236
- listeners.add(listener);
6237
- listener([...toasts]);
6266
+ subscribe(listener2) {
6267
+ listeners.add(listener2);
6268
+ listener2([...toasts]);
6238
6269
  return () => {
6239
- listeners.delete(listener);
6270
+ listeners.delete(listener2);
6240
6271
  };
6241
6272
  },
6242
6273
  getSnapshot() {
@@ -6702,7 +6733,7 @@ function FormResponse({
6702
6733
  return /* @__PURE__ */ jsx(Transition.TransitionDropdown, { visibility: text ? true : false, children: /* @__PURE__ */ jsx(
6703
6734
  "div",
6704
6735
  {
6705
- className: classNames17({
6736
+ className: classNames66({
6706
6737
  "font-poppins font-light text-sm": true,
6707
6738
  [`${variantsLite[variant]}`]: variant,
6708
6739
  [`${shapes[shape]}`]: shape,
@@ -6819,7 +6850,7 @@ var ThemeSwitch = () => {
6819
6850
  /* @__PURE__ */ jsx(
6820
6851
  "div",
6821
6852
  {
6822
- className: classNames17(
6853
+ className: classNames66(
6823
6854
  "w-6 h-6 bg-white dark:bg-gray-600 rounded-full shadow-md transition-transform duration-300",
6824
6855
  theme === "dark" ? "translate-x-8" : "translate-x-0"
6825
6856
  )
@@ -18200,12 +18231,12 @@ function WorldMap({
18200
18231
  const mode = isDarkMode ? mapStyles.dark : mapStyles.light;
18201
18232
  const resolvedData = useMemo(() => {
18202
18233
  return data.map((item) => {
18203
- const c = COUNTRIES.find((x) => x.code === item.code);
18204
- if (!c) return null;
18234
+ const c2 = COUNTRIES.find((x) => x.code === item.code);
18235
+ if (!c2) return null;
18205
18236
  return {
18206
18237
  ...item,
18207
- name: c.name,
18208
- coordinates: c.coordinates
18238
+ name: c2.name,
18239
+ coordinates: c2.coordinates
18209
18240
  };
18210
18241
  }).filter(Boolean);
18211
18242
  }, [data]);
@@ -18367,7 +18398,7 @@ function InputResponse({
18367
18398
  return /* @__PURE__ */ jsx(Transition.TransitionDropdown, { visibility, children: /* @__PURE__ */ jsx(
18368
18399
  "div",
18369
18400
  {
18370
- className: classNames17({
18401
+ className: classNames66({
18371
18402
  "font-medium text-sm py-1 px-2": true,
18372
18403
  [`${textVariants[variant]}`]: variant,
18373
18404
  "transition-all ease-in-out": true,
@@ -18382,7 +18413,7 @@ function InputLabel({ text, children, styles }) {
18382
18413
  return /* @__PURE__ */ jsx(
18383
18414
  "label",
18384
18415
  {
18385
- className: classNames17({
18416
+ className: classNames66({
18386
18417
  "px-0 eui-text-sm text-[13.5px] pointer-events-none select-none": true,
18387
18418
  "transition-all ease-in-out": true,
18388
18419
  [`${styles}`]: styles
@@ -18434,7 +18465,7 @@ var Input = ({
18434
18465
  ...field,
18435
18466
  ...props,
18436
18467
  placeholder,
18437
- className: classNames17({
18468
+ className: classNames66({
18438
18469
  "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,
18439
18470
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
18440
18471
  "border-eui-danger-500": meta.touched && meta.error,
@@ -18479,7 +18510,7 @@ var InputFile = ({
18479
18510
  /* @__PURE__ */ jsx(
18480
18511
  "div",
18481
18512
  {
18482
- className: classNames17(
18513
+ className: classNames66(
18483
18514
  "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",
18484
18515
  {
18485
18516
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
@@ -18505,7 +18536,7 @@ var InputFile = ({
18505
18536
  InputLabel_default,
18506
18537
  {
18507
18538
  text: placeholder,
18508
- styles: classNames17({
18539
+ styles: classNames66({
18509
18540
  "absolute left-2 eui-text-sm peer-placeholder-shown:text-base peer-placeholder-shown:top-3 pointer-events-none": true,
18510
18541
  "top-[0.7px]": showFloatingLabel,
18511
18542
  "top-[13px] text-base": !showFloatingLabel
@@ -18558,7 +18589,7 @@ var InputList = ({ name, placeholder, shape }) => {
18558
18589
  /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(FieldArray, { name, children: ({ push, remove, move }) => /* @__PURE__ */ jsxs(
18559
18590
  "div",
18560
18591
  {
18561
- className: classNames17(
18592
+ className: classNames66(
18562
18593
  "flex w-full flex-col space-y-2 bg-eui-primary-300/10",
18563
18594
  shapes[resolvedShape]
18564
18595
  ),
@@ -18587,7 +18618,7 @@ var InputList = ({ name, placeholder, shape }) => {
18587
18618
  ref: provided2.innerRef,
18588
18619
  ...draggableProps,
18589
18620
  style: draggableStyle,
18590
- className: classNames17(
18621
+ className: classNames66(
18591
18622
  "flex items-center space-x-2 bg-eui-primary-300/10 p-2",
18592
18623
  shapes[resolvedShape]
18593
18624
  ),
@@ -18598,7 +18629,7 @@ var InputList = ({ name, placeholder, shape }) => {
18598
18629
  {
18599
18630
  name: `${name}[${index}]`,
18600
18631
  placeholder: `Item ${index + 1}`,
18601
- className: classNames17(
18632
+ className: classNames66(
18602
18633
  "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",
18603
18634
  shapes[resolvedShape],
18604
18635
  hasItemError ? "border-eui-danger-500" : "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18694,7 +18725,7 @@ var InputListGroup = ({
18694
18725
  return /* @__PURE__ */ jsxs(
18695
18726
  "div",
18696
18727
  {
18697
- className: classNames17(
18728
+ className: classNames66(
18698
18729
  "flex flex-col gap-2 bg-eui-primary-300/10 p-3",
18699
18730
  shapes[resolvedShape]
18700
18731
  ),
@@ -18706,7 +18737,7 @@ var InputListGroup = ({
18706
18737
  {
18707
18738
  name: `${name}[${groupIndex}].name`,
18708
18739
  placeholder: `Group ${groupIndex + 1}`,
18709
- className: classNames17(
18740
+ className: classNames66(
18710
18741
  "h-[40px] w-full border bg-eui-primary-300/10 px-3 py-2 text-md focus:outline-none",
18711
18742
  shapes[resolvedShape],
18712
18743
  "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18737,7 +18768,7 @@ var InputListGroup = ({
18737
18768
  {
18738
18769
  ref: provided.innerRef,
18739
18770
  ...provided.droppableProps,
18740
- className: classNames17(
18771
+ className: classNames66(
18741
18772
  "space-y-2 bg-eui-primary-300/10 p-2",
18742
18773
  shapes[resolvedShape]
18743
18774
  ),
@@ -18757,7 +18788,7 @@ var InputListGroup = ({
18757
18788
  ref: provided2.innerRef,
18758
18789
  ...draggableProps,
18759
18790
  style: draggableStyle,
18760
- className: classNames17(
18791
+ className: classNames66(
18761
18792
  "flex items-center gap-2 bg-eui-primary-300/10 p-2",
18762
18793
  shapes[resolvedShape]
18763
18794
  ),
@@ -18768,7 +18799,7 @@ var InputListGroup = ({
18768
18799
  {
18769
18800
  name: `${itemsFieldName}[${itemIndex}]`,
18770
18801
  placeholder: `Item ${itemIndex + 1}`,
18771
- className: classNames17(
18802
+ className: classNames66(
18772
18803
  "h-[40px] w-full border bg-eui-primary-300/10 px-3 py-2 text-md focus:outline-none",
18773
18804
  shapes[resolvedShape],
18774
18805
  "border-eui-primary-400 focus:border-eui-secondary-500"
@@ -18982,7 +19013,7 @@ var DateSelector = ({
18982
19013
  ...field,
18983
19014
  ...props,
18984
19015
  placeholder,
18985
- className: classNames17({
19016
+ className: classNames66({
18986
19017
  "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,
18987
19018
  "border-eui-danger-500": meta.touched && meta.error,
18988
19019
  "transition-all ease-in-out": true,
@@ -19091,7 +19122,7 @@ var ImageInput = forwardRef(
19091
19122
  /* @__PURE__ */ jsxs(
19092
19123
  "label",
19093
19124
  {
19094
- className: classNames17({
19125
+ className: classNames66({
19095
19126
  "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,
19096
19127
  "hover:cursor-pointer hover:border-solid hover:border-gray-600 hover:bg-gray-900/80": true,
19097
19128
  "transition-all ease-in-out duration-150": true
@@ -19208,7 +19239,7 @@ function Radio({
19208
19239
  return /* @__PURE__ */ jsxs(
19209
19240
  "div",
19210
19241
  {
19211
- className: classNames17({
19242
+ className: classNames66({
19212
19243
  "flex flex-row gap-2 items-center mx-1 my-2": true
19213
19244
  }),
19214
19245
  children: [
@@ -19221,7 +19252,7 @@ function Radio({
19221
19252
  ...props,
19222
19253
  value: option.value,
19223
19254
  checked: field2.value === option.value,
19224
- className: classNames17({
19255
+ className: classNames66({
19225
19256
  "appearance-none w-4 h-4 border-2 border-eui-primary-400 rounded-full cursor-pointer transition-all duration-300": true,
19226
19257
  // base radio button styles
19227
19258
  "checked:bg-eui-secondary-700 checked:border-eui-primary-400": field2.value === option.value
@@ -19233,7 +19264,7 @@ function Radio({
19233
19264
  "label",
19234
19265
  {
19235
19266
  htmlFor: option.value,
19236
- className: classNames17({
19267
+ className: classNames66({
19237
19268
  "eui-text-md text-sm": true
19238
19269
  }),
19239
19270
  children: option.label
@@ -19276,7 +19307,7 @@ function StarRatingInput({
19276
19307
  return /* @__PURE__ */ jsxs(
19277
19308
  "div",
19278
19309
  {
19279
- className: classNames17({
19310
+ className: classNames66({
19280
19311
  "inline-flex gap-[4px] text-[20px]": true,
19281
19312
  [`${styles}`]: styles
19282
19313
  }),
@@ -19289,7 +19320,7 @@ function StarRatingInput({
19289
19320
  onClick: () => handleOnClick(index),
19290
19321
  onMouseEnter: () => setHover(index),
19291
19322
  onMouseLeave: () => setHover(null),
19292
- className: classNames17({
19323
+ className: classNames66({
19293
19324
  "text-yellow-600": index <= (hover ?? rating - 1),
19294
19325
  "text-gray-400": index > (hover ?? rating - 1)
19295
19326
  }),
@@ -19333,7 +19364,7 @@ function Select({
19333
19364
  {
19334
19365
  as: "select",
19335
19366
  ...props,
19336
- className: classNames17({
19367
+ className: classNames66({
19337
19368
  "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,
19338
19369
  "border-eui-primary-400": !(meta.touched && meta.error),
19339
19370
  "border-red-500": meta.touched && meta.error,
@@ -19385,7 +19416,7 @@ function Switch({
19385
19416
  "div",
19386
19417
  {
19387
19418
  onClick: () => helpers.setValue(!field.value),
19388
- className: classNames17(
19419
+ className: classNames66(
19389
19420
  "w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer dark:bg-eui-dark-100",
19390
19421
  "peer-checked:after:translate-x-full peer-checked:after:border-white",
19391
19422
  "after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white",
@@ -19442,7 +19473,7 @@ function Tags({
19442
19473
  /* @__PURE__ */ jsxs(
19443
19474
  "div",
19444
19475
  {
19445
- className: classNames17(
19476
+ className: classNames66(
19446
19477
  "border rounded-sm flex flex-wrap items-center gap-2 px-2 pt-2 pb-6 min-h-[3rem]",
19447
19478
  {
19448
19479
  "bg-eui-primary-300/10 eui-text-md": true,
@@ -19490,7 +19521,7 @@ function Tags({
19490
19521
  InputLabel_default,
19491
19522
  {
19492
19523
  text: placeholder,
19493
- styles: classNames17(
19524
+ styles: classNames66(
19494
19525
  "absolute left-2 transition-all pointer-events-none text-eui-dark-200",
19495
19526
  input.length > 0 || field.value.length > 0 ? "top-[2px] text-[13.5px]" : "top-3 text-base"
19496
19527
  )
@@ -19531,7 +19562,7 @@ function TextArea({
19531
19562
  as: "textarea",
19532
19563
  ...field,
19533
19564
  ...props,
19534
- className: classNames17({
19565
+ className: classNames66({
19535
19566
  "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,
19536
19567
  "transition-all ease-in-out": true,
19537
19568
  "border-eui-primary-400 focus:border-eui-secondary-500": !(meta.touched && meta.error),
@@ -19545,7 +19576,7 @@ function TextArea({
19545
19576
  InputLabel_default,
19546
19577
  {
19547
19578
  text: placeholder,
19548
- styles: classNames17(
19579
+ styles: classNames66(
19549
19580
  "absolute left-2 transition-all pointer-events-none text-eui-dark-200",
19550
19581
  field.value ? "top-[2px] text-[13.5px]" : "top-3 text-base"
19551
19582
  )
@@ -19568,31 +19599,30 @@ function TextArea({
19568
19599
  ] });
19569
19600
  }
19570
19601
  var TextArea_default = TextArea;
19571
- function ContentArea({
19572
- children,
19573
- styles,
19574
- enablePadding = false
19575
- }) {
19576
- return /* @__PURE__ */ jsx(
19577
- "div",
19578
- {
19579
- className: classNames17({
19580
- "min-h-screen h-full w-full py-3 px-5": true,
19581
- "py-3 px-5": !enablePadding,
19582
- "py-3 px-5 lg:px-[150px]": enablePadding,
19583
- "transition-all duration-[200ms]": true,
19584
- [`${styles}`]: styles
19585
- }),
19586
- children
19587
- }
19588
- );
19589
- }
19602
+ var ContentArea = forwardRef(
19603
+ ({ children, styles, enablePadding = false }, ref) => {
19604
+ return /* @__PURE__ */ jsx(
19605
+ "div",
19606
+ {
19607
+ ref,
19608
+ className: classNames66({
19609
+ "min-h-screen h-full w-full transition-all duration-[200ms]": true,
19610
+ "py-3 px-5": !enablePadding,
19611
+ "py-3 px-5 lg:px-[150px]": enablePadding,
19612
+ [`${styles}`]: Boolean(styles)
19613
+ }),
19614
+ children
19615
+ }
19616
+ );
19617
+ }
19618
+ );
19619
+ ContentArea.displayName = "ContentArea";
19590
19620
  var ContentArea_default = ContentArea;
19591
19621
  function FlexCol({ children, gap = 3, styles }) {
19592
19622
  return /* @__PURE__ */ jsx(
19593
19623
  "div",
19594
19624
  {
19595
- className: classNames17({
19625
+ className: classNames66({
19596
19626
  [`flex flex-col gap-${gap}`]: true,
19597
19627
  [`${styles}`]: styles
19598
19628
  }),
@@ -19605,7 +19635,7 @@ function FlexRow({ children, gap = 3, styles }) {
19605
19635
  return /* @__PURE__ */ jsx(
19606
19636
  "div",
19607
19637
  {
19608
- className: classNames17({
19638
+ className: classNames66({
19609
19639
  [`flex flex-row gap-${gap}`]: true,
19610
19640
  [`${styles}`]: styles
19611
19641
  }),
@@ -19624,7 +19654,7 @@ function Grid({ children, styles }) {
19624
19654
  return /* @__PURE__ */ jsx(
19625
19655
  "div",
19626
19656
  {
19627
- className: classNames17({
19657
+ className: classNames66({
19628
19658
  [`grid`]: true,
19629
19659
  [`${styles}`]: styles
19630
19660
  }),
@@ -19641,7 +19671,7 @@ var Layout = ({
19641
19671
  return /* @__PURE__ */ jsx(
19642
19672
  "div",
19643
19673
  {
19644
- className: classNames17({
19674
+ className: classNames66({
19645
19675
  // "flex h-full w-screen bg-gray-100 overflow-auto": true,
19646
19676
  "flex bg-eui-light-600": true,
19647
19677
  "flex-col": flexDirection === "vertical",
@@ -19660,7 +19690,7 @@ var Header = ({
19660
19690
  return /* @__PURE__ */ jsx(
19661
19691
  "div",
19662
19692
  {
19663
- className: classNames17({
19693
+ className: classNames66({
19664
19694
  static: position === "static",
19665
19695
  fixed: position === "fixed",
19666
19696
  sticky: position === "sticky",
@@ -19700,7 +19730,7 @@ var Content = ({
19700
19730
  return /* @__PURE__ */ jsx(
19701
19731
  "div",
19702
19732
  {
19703
- className: classNames17({
19733
+ className: classNames66({
19704
19734
  "w-full min-h-screen transition-all duration-200 eui-bg-sm": true,
19705
19735
  "md:pl-[300px]": !overlayedSidebar && sidebarVisible && !isMobile,
19706
19736
  // Shift when sidebar is open (desktop)
@@ -19716,7 +19746,7 @@ var Footer = ({ children, styles }) => {
19716
19746
  return /* @__PURE__ */ jsx(
19717
19747
  "div",
19718
19748
  {
19719
- className: classNames17({
19749
+ className: classNames66({
19720
19750
  "bottom-0 w-full h-fit": true,
19721
19751
  "border-t border-eui-dark-500/40 dark:border-eui-secondary-800 eui-bg-md": !styles,
19722
19752
  [`${styles}`]: styles
@@ -19789,269 +19819,6 @@ function BlockGroup({
19789
19819
  ] });
19790
19820
  }
19791
19821
  var BlockGroup_default = BlockGroup;
19792
- var useTheme = () => {
19793
- const context = useContext(ThemeContext);
19794
- if (!context) {
19795
- throw new Error("useTheme must be used within a ThemeProvider");
19796
- }
19797
- return context;
19798
- };
19799
- var useTheme_default = useTheme;
19800
- function MarkdownEditor({
19801
- styles,
19802
- ...props
19803
- }) {
19804
- const [field, meta, helpers] = useField(props);
19805
- const { theme } = useTheme_default();
19806
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
19807
- /* @__PURE__ */ jsx("div", { className: classNames17(theme === "dark" ? "dark" : "", styles), children: /* @__PURE__ */ jsx(
19808
- MDXEditor,
19809
- {
19810
- markdown: field.value,
19811
- onChange: (val) => helpers.setValue(val),
19812
- className: "rounded border border-gray-300 dark:border-gray-700",
19813
- plugins: [
19814
- headingsPlugin(),
19815
- linkPlugin(),
19816
- listsPlugin(),
19817
- imagePlugin(),
19818
- tablePlugin(),
19819
- linkDialogPlugin({}),
19820
- thematicBreakPlugin(),
19821
- quotePlugin(),
19822
- toolbarPlugin({
19823
- toolbarContents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
19824
- /* @__PURE__ */ jsx(UndoRedo, {}),
19825
- /* @__PURE__ */ jsx(Separator, {}),
19826
- /* @__PURE__ */ jsx(BlockTypeSelect, {}),
19827
- /* @__PURE__ */ jsx(Separator, {}),
19828
- /* @__PURE__ */ jsx(BoldItalicUnderlineToggles, {}),
19829
- /* @__PURE__ */ jsx(Separator, {}),
19830
- /* @__PURE__ */ jsx(StrikeThroughSupSubToggles, {}),
19831
- /* @__PURE__ */ jsx(Separator, {}),
19832
- /* @__PURE__ */ jsx(ListsToggle, {}),
19833
- /* @__PURE__ */ jsx(Separator, {}),
19834
- /* @__PURE__ */ jsx(CreateLink, {}),
19835
- /* @__PURE__ */ jsx(InsertImage, {}),
19836
- /* @__PURE__ */ jsx(Separator, {}),
19837
- /* @__PURE__ */ jsx(InsertTable, {}),
19838
- /* @__PURE__ */ jsx(InsertThematicBreak, {})
19839
- ] })
19840
- })
19841
- ]
19842
- }
19843
- ) }),
19844
- /* @__PURE__ */ jsx(
19845
- InputResponse_default,
19846
- {
19847
- name: field.name,
19848
- visibility: meta.touched && meta.error ? true : false,
19849
- variant: "danger"
19850
- }
19851
- )
19852
- ] });
19853
- }
19854
- var MarkdownEditor_default = MarkdownEditor;
19855
- var MarkdownContext = createContext(null);
19856
-
19857
- // src/components/markdown/hooks/useMarkdown.tsx
19858
- function useMarkdown() {
19859
- return useContext(MarkdownContext);
19860
- }
19861
-
19862
- // src/components/markdown/utils/generateHeadingNumbers.ts
19863
- function generateHeadingNumbers(headings) {
19864
- const counters = [0, 0, 0, 0, 0, 0];
19865
- return headings.map((heading) => {
19866
- const level = heading.level;
19867
- counters[level - 1]++;
19868
- for (let i = level; i < counters.length; i++) {
19869
- counters[i] = 0;
19870
- }
19871
- const numbering = counters.slice(0, level).filter((n) => n > 0).join(".");
19872
- return {
19873
- ...heading,
19874
- numbering
19875
- };
19876
- });
19877
- }
19878
-
19879
- // src/components/markdown/utils/sanitizeHeading.ts
19880
- function sanitizeHeading(text) {
19881
- return text.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu, "").replace(/\s+/g, " ").trim();
19882
- }
19883
- function MarkdownTOC({ title = "Table of Contents" }) {
19884
- const context = useMarkdown();
19885
- if (!context) {
19886
- return null;
19887
- }
19888
- const { headings, activeHeading } = context;
19889
- const numberedHeadings = generateHeadingNumbers(headings);
19890
- const scrollToHeading = (id) => {
19891
- const element = document.getElementById(id);
19892
- if (!element) return;
19893
- element.scrollIntoView({
19894
- behavior: "smooth",
19895
- block: "start"
19896
- });
19897
- };
19898
- return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
19899
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
19900
- "h2",
19901
- {
19902
- className: "\n text-sm\n font-semibold\n uppercase\n tracking-wide\n text-gray-900\n dark:text-gray-100\n ",
19903
- children: title
19904
- }
19905
- ) }),
19906
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: numberedHeadings.map((heading) => /* @__PURE__ */ jsxs(
19907
- "button",
19908
- {
19909
- onClick: () => scrollToHeading(heading.id),
19910
- className: classNames17(
19911
- "block w-full text-left text-sm transition-all ease-in-out duration-150",
19912
- "hover:text-primary",
19913
- activeHeading === heading.id ? "text-primary font-semibold underline" : "text-gray-500 dark:text-gray-400"
19914
- ),
19915
- style: {
19916
- paddingLeft: `${(heading.level - 1) * 12}px`
19917
- },
19918
- children: [
19919
- /* @__PURE__ */ jsx("span", { className: "mr-2 opacity-70", children: heading.numbering }),
19920
- /* @__PURE__ */ jsx("span", { children: sanitizeHeading(heading.text) })
19921
- ]
19922
- },
19923
- heading.id
19924
- )) })
19925
- ] });
19926
- }
19927
- var MarkdownTOC_default = MarkdownTOC;
19928
- function MarkdownViewer({ value }) {
19929
- const { theme } = useTheme_default();
19930
- const context = useMarkdown();
19931
- const markdown = value ?? context?.markdown ?? "";
19932
- const headings = context?.headings ?? [];
19933
- const setActiveHeading = context?.setActiveHeading;
19934
- useEffect(() => {
19935
- const timeout = setTimeout(() => {
19936
- headings.forEach((heading) => {
19937
- const headingEls = document.querySelectorAll("h1,h2,h3,h4,h5,h6");
19938
- headingEls.forEach((el) => {
19939
- if (el.textContent?.trim() === heading.text.trim()) {
19940
- el.id = heading.id;
19941
- }
19942
- });
19943
- });
19944
- if (!setActiveHeading) return;
19945
- const observer = new IntersectionObserver(
19946
- (entries) => {
19947
- entries.forEach((entry) => {
19948
- if (entry.isIntersecting) {
19949
- setActiveHeading(entry.target.id);
19950
- }
19951
- });
19952
- },
19953
- {
19954
- rootMargin: "-20% 0px -70% 0px"
19955
- }
19956
- );
19957
- headings.forEach((heading) => {
19958
- const el = document.getElementById(heading.id);
19959
- if (el) {
19960
- observer.observe(el);
19961
- }
19962
- });
19963
- return () => observer.disconnect();
19964
- }, 0);
19965
- return () => clearTimeout(timeout);
19966
- }, [headings, setActiveHeading]);
19967
- return /* @__PURE__ */ jsx("div", { className: theme === "dark" ? "dark" : "", children: /* @__PURE__ */ jsx(
19968
- MDXEditor,
19969
- {
19970
- markdown,
19971
- readOnly: true,
19972
- className: "markdown-body max-w-none",
19973
- plugins: [
19974
- headingsPlugin(),
19975
- linkPlugin(),
19976
- listsPlugin(),
19977
- imagePlugin(),
19978
- tablePlugin(),
19979
- quotePlugin(),
19980
- thematicBreakPlugin(),
19981
- linkDialogPlugin({}),
19982
- markdownShortcutPlugin(),
19983
- frontmatterPlugin(),
19984
- codeBlockPlugin({
19985
- defaultCodeBlockLanguage: "txt",
19986
- codeBlockEditorDescriptors: []
19987
- }),
19988
- codeMirrorPlugin({
19989
- codeBlockLanguages: {
19990
- js: "JavaScript",
19991
- ts: "TypeScript",
19992
- jsx: "React JSX",
19993
- tsx: "React TSX",
19994
- html: "HTML",
19995
- css: "CSS",
19996
- scss: "SCSS",
19997
- json: "JSON",
19998
- bash: "Bash",
19999
- shell: "Shell",
20000
- zsh: "ZSH",
20001
- yaml: "YAML",
20002
- yml: "YAML",
20003
- md: "Markdown",
20004
- py: "Python",
20005
- java: "Java",
20006
- cpp: "C++",
20007
- c: "C",
20008
- go: "Go",
20009
- rust: "Rust",
20010
- php: "PHP",
20011
- sql: "SQL"
20012
- }
20013
- })
20014
- ]
20015
- },
20016
- markdown
20017
- ) });
20018
- }
20019
- var MarkdownViewer_default = MarkdownViewer;
20020
-
20021
- // src/components/markdown/utils/slugify.ts
20022
- function slugify(text) {
20023
- return text.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-");
20024
- }
20025
-
20026
- // src/components/markdown/utils/extractHeadings.ts
20027
- function extractHeadings(markdown) {
20028
- return markdown.split("\n").filter((line) => /^#{1,6}\s/.test(line)).map((line) => {
20029
- const level = line.match(/^#+/)?.[0].length || 1;
20030
- const text = line.replace(/^#{1,6}\s/, "");
20031
- return {
20032
- id: slugify(text),
20033
- text,
20034
- level
20035
- };
20036
- });
20037
- }
20038
- function MarkdownProvider({ markdown, children }) {
20039
- const [activeHeading, setActiveHeading] = useState("");
20040
- const headings = useMemo(() => extractHeadings(markdown), [markdown]);
20041
- return /* @__PURE__ */ jsx(
20042
- MarkdownContext.Provider,
20043
- {
20044
- value: {
20045
- markdown,
20046
- headings,
20047
- activeHeading,
20048
- setActiveHeading
20049
- },
20050
- children
20051
- }
20052
- );
20053
- }
20054
- var MarkdownProvider_default = MarkdownProvider;
20055
19822
  function BreadcrumbItem({
20056
19823
  title,
20057
19824
  href = "#",
@@ -20063,7 +19830,7 @@ function BreadcrumbItem({
20063
19830
  {
20064
19831
  href,
20065
19832
  onClick,
20066
- className: classNames17({
19833
+ className: classNames66({
20067
19834
  "text-lg font-semibold": true,
20068
19835
  "text-gray-400 hover:text-gray-600 cursor-pointer": !active,
20069
19836
  "text-eui-light-800": active,
@@ -20140,7 +19907,7 @@ var Breadcrumb = ({
20140
19907
  index < resolvedData.length - 1 && /* @__PURE__ */ jsx(
20141
19908
  "span",
20142
19909
  {
20143
- className: classNames17({
19910
+ className: classNames66({
20144
19911
  "text-lg font-semibold text-gray-500": true,
20145
19912
  [`px-${gap}`]: gap
20146
19913
  }),
@@ -20154,7 +19921,7 @@ var Breadcrumb = ({
20154
19921
  return /* @__PURE__ */ jsx(
20155
19922
  "div",
20156
19923
  {
20157
- className: classNames17({
19924
+ className: classNames66({
20158
19925
  "inline-flex": true,
20159
19926
  [`${styles}`]: styles
20160
19927
  }),
@@ -20186,7 +19953,7 @@ var Drawer = ({
20186
19953
  isMobile && showBackdrop && /* @__PURE__ */ jsx(TransitionFade_default, { visibility, leaveDuration: 200, children: /* @__PURE__ */ jsx(
20187
19954
  "div",
20188
19955
  {
20189
- className: classNames17(
19956
+ className: classNames66(
20190
19957
  "fixed inset-0 bg-black/50 z-40",
20191
19958
  backdropStyles
20192
19959
  ),
@@ -20197,7 +19964,7 @@ var Drawer = ({
20197
19964
  "div",
20198
19965
  {
20199
19966
  style: drawerStyle,
20200
- className: classNames17(
19967
+ className: classNames66(
20201
19968
  "fixed shadow-lg z-50",
20202
19969
  {
20203
19970
  "h-full w-[300px] top-0": isHorizontal && !hasOffset,
@@ -20226,7 +19993,7 @@ function DrawerToggler({
20226
19993
  return /* @__PURE__ */ jsx(
20227
19994
  "div",
20228
19995
  {
20229
- className: classNames17({
19996
+ className: classNames66({
20230
19997
  "text-xl p-3 cursor-pointer": true,
20231
19998
  "transition-all ease-in-out": true,
20232
19999
  "text-eui-dark-500 dark:text-eui-secondary-600": !styles,
@@ -20274,7 +20041,7 @@ function FooterNav({ data = [], styles }) {
20274
20041
  childrenContent = /* @__PURE__ */ jsx(
20275
20042
  "div",
20276
20043
  {
20277
- className: classNames17({
20044
+ className: classNames66({
20278
20045
  "grid w-full": true,
20279
20046
  "grid-cols-1": isMobile,
20280
20047
  "grid-cols-3": !isMobile,
@@ -20287,7 +20054,7 @@ function FooterNav({ data = [], styles }) {
20287
20054
  return /* @__PURE__ */ jsx(
20288
20055
  "div",
20289
20056
  {
20290
- className: classNames17({
20057
+ className: classNames66({
20291
20058
  [`${styles}`]: styles
20292
20059
  }),
20293
20060
  children: childrenContent
@@ -20328,7 +20095,7 @@ var FooterNavGroup = ({
20328
20095
  /* @__PURE__ */ jsx(
20329
20096
  "div",
20330
20097
  {
20331
- className: classNames17({
20098
+ className: classNames66({
20332
20099
  "": true,
20333
20100
  "py-2 font-semibold eui-text-lg": !styles,
20334
20101
  [`${styles}`]: styles
@@ -20373,7 +20140,7 @@ var FooterNavItem = ({
20373
20140
  "div",
20374
20141
  {
20375
20142
  onClick: handleNavigation,
20376
- className: classNames17({
20143
+ className: classNames66({
20377
20144
  "flex flex-row items-center gap-3 cursor-pointer p-1 w-full": true,
20378
20145
  "transition-all duration-200 ease-in-out": true,
20379
20146
  "text-sm eui-text-sm": !styles,
@@ -20402,7 +20169,7 @@ var FooterNavItemTitle = ({
20402
20169
  return /* @__PURE__ */ jsx(
20403
20170
  "div",
20404
20171
  {
20405
- className: classNames17({
20172
+ className: classNames66({
20406
20173
  "": true,
20407
20174
  "py-2 font-thin eui-text-md": !styles,
20408
20175
  [`${styles}`]: styles
@@ -20455,7 +20222,7 @@ function HeaderNav({ data = [], styles }) {
20455
20222
  return /* @__PURE__ */ jsx(
20456
20223
  "div",
20457
20224
  {
20458
- className: classNames17({
20225
+ className: classNames66({
20459
20226
  [`${styles}`]: styles
20460
20227
  }),
20461
20228
  children: childrenContent
@@ -20465,7 +20232,7 @@ function HeaderNav({ data = [], styles }) {
20465
20232
  var HeaderNav_default = HeaderNav;
20466
20233
  function useClickOutside(ref, fun) {
20467
20234
  useEffect(() => {
20468
- const listener = (e) => {
20235
+ const listener2 = (e) => {
20469
20236
  if (!ref.current || ref.current.contains(e.target)) {
20470
20237
  return;
20471
20238
  }
@@ -20473,11 +20240,11 @@ function useClickOutside(ref, fun) {
20473
20240
  fun();
20474
20241
  }
20475
20242
  };
20476
- document.addEventListener("mousedown", listener);
20477
- document.addEventListener("touchstart", listener);
20243
+ document.addEventListener("mousedown", listener2);
20244
+ document.addEventListener("touchstart", listener2);
20478
20245
  return () => {
20479
- document.removeEventListener("mousedown", listener);
20480
- document.removeEventListener("touchstart", listener);
20246
+ document.removeEventListener("mousedown", listener2);
20247
+ document.removeEventListener("touchstart", listener2);
20481
20248
  };
20482
20249
  }, [ref, fun]);
20483
20250
  }
@@ -20517,7 +20284,7 @@ var HeaderNavGroup = ({
20517
20284
  /* @__PURE__ */ jsxs(
20518
20285
  "div",
20519
20286
  {
20520
- className: classNames17({
20287
+ className: classNames66({
20521
20288
  "flex flex-row gap-2 items-center justify-between cursor-pointer p-3 w-full": true,
20522
20289
  "transition-all duration-300 ease-in-out": true,
20523
20290
  "eui-text-md bg-gradient-to-t from-eui-dark-500/10 dark:from-green-700/10": !styles,
@@ -20545,7 +20312,7 @@ var HeaderNavGroup = ({
20545
20312
  children && /* @__PURE__ */ jsx(
20546
20313
  BsChevronDown,
20547
20314
  {
20548
- className: classNames17({
20315
+ className: classNames66({
20549
20316
  "text-md": true,
20550
20317
  "transition-all ease-in-out duration-300": true,
20551
20318
  "rotate-180": !collapsed
@@ -20558,7 +20325,7 @@ var HeaderNavGroup = ({
20558
20325
  !collapsed && children && /* @__PURE__ */ jsx(
20559
20326
  "div",
20560
20327
  {
20561
- className: classNames17({
20328
+ className: classNames66({
20562
20329
  "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,
20563
20330
  "transition-all duration-300 ease-in-out": true
20564
20331
  }),
@@ -20588,7 +20355,7 @@ var HeaderNavItem = ({
20588
20355
  "div",
20589
20356
  {
20590
20357
  onClick: handleNavigation,
20591
- className: classNames17({
20358
+ className: classNames66({
20592
20359
  "flex flex-row items-center gap-3 cursor-pointer p-3 w-full": true,
20593
20360
  "transition-all duration-200 ease-in-out": true,
20594
20361
  "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,
@@ -20617,7 +20384,7 @@ var HeaderNavItemTitle = ({
20617
20384
  return /* @__PURE__ */ jsx(
20618
20385
  "div",
20619
20386
  {
20620
- className: classNames17({
20387
+ className: classNames66({
20621
20388
  "p-3 font-thin": true,
20622
20389
  "eui-text-md": !styles,
20623
20390
  [`${styles}`]: styles
@@ -20657,7 +20424,7 @@ var Link = ({
20657
20424
  href: href || "#",
20658
20425
  target: targets[target],
20659
20426
  onClick: handleClick,
20660
- className: classNames17({
20427
+ className: classNames66({
20661
20428
  [`${textVariants[variant]}`]: variant,
20662
20429
  [`${decorations[decoration]}`]: decoration,
20663
20430
  "font-bold": bold,
@@ -21307,7 +21074,7 @@ function Modal({
21307
21074
  "div",
21308
21075
  {
21309
21076
  ref: modalRef,
21310
- className: classNames17(
21077
+ className: classNames66(
21311
21078
  "eui-bg-md eui-shadow-lg border border-gray-700/80 w-fit h-fit",
21312
21079
  shapes[resolvedShape],
21313
21080
  styles
@@ -21319,7 +21086,7 @@ function Modal({
21319
21086
  "button",
21320
21087
  {
21321
21088
  type: "button",
21322
- className: classNames17(
21089
+ className: classNames66(
21323
21090
  "w-[60px] h-[60px] flex items-center justify-center transition-standard-fast",
21324
21091
  "hover:cursor-pointer hover:bg-eui-dark-500"
21325
21092
  ),
@@ -21453,7 +21220,7 @@ function ShowMore({ text, limit }) {
21453
21220
  /* @__PURE__ */ jsx(
21454
21221
  "div",
21455
21222
  {
21456
- className: classNames17({
21223
+ className: classNames66({
21457
21224
  "text-blue-300 px-1 pb-1 mt-1": true,
21458
21225
  "bg-slate-900/70": !showMore,
21459
21226
  "bg-gradient-to-t from-slate-900/50 to-transparent": showMore
@@ -21737,16 +21504,20 @@ function CommentHeader({ comment, config }) {
21737
21504
  var CommentHeader_default = CommentHeader;
21738
21505
  var useDrawer = (defaultVisibility = true) => {
21739
21506
  const [show, setShow] = useState(defaultVisibility);
21740
- const openDrawer = () => {
21741
- setShow((prev) => !prev);
21742
- };
21743
- const closeDrawer = () => {
21507
+ const openDrawer = useCallback(() => {
21508
+ setShow(true);
21509
+ }, []);
21510
+ const closeDrawer = useCallback(() => {
21744
21511
  setShow(false);
21745
- };
21512
+ }, []);
21513
+ const toggleDrawer = useCallback(() => {
21514
+ setShow((prev) => !prev);
21515
+ }, []);
21746
21516
  return {
21747
21517
  show,
21748
21518
  openDrawer,
21749
- closeDrawer
21519
+ closeDrawer,
21520
+ toggleDrawer
21750
21521
  };
21751
21522
  };
21752
21523
  var useDrawer_default = useDrawer;
@@ -21765,6 +21536,14 @@ var useModal = () => {
21765
21536
  };
21766
21537
  };
21767
21538
  var useModal_default = useModal;
21539
+ var useTheme = () => {
21540
+ const context = useContext(ThemeContext);
21541
+ if (!context) {
21542
+ throw new Error("useTheme must be used within a ThemeProvider");
21543
+ }
21544
+ return context;
21545
+ };
21546
+ var useTheme_default = useTheme;
21768
21547
  function CommentMenuItem({
21769
21548
  icon,
21770
21549
  name,
@@ -22340,11 +22119,78 @@ function DataViewTable({
22340
22119
  );
22341
22120
  }
22342
22121
  var DataViewTable_default = DataViewTable;
22343
- function DocumentationPanel({ value, toc = true }) {
22344
- return /* @__PURE__ */ jsx(MarkdownProvider_default, { markdown: value, children: /* @__PURE__ */ jsxs("div", { className: "h-screen overflow-hidden grid grid-cols-[minmax(0,1fr)_280px] gap-10", children: [
22345
- /* @__PURE__ */ jsx("div", { className: "documentation_scrollbar min-w-0 h-screen overflow-y-auto scroll-smooth", children: /* @__PURE__ */ jsx("div", { className: "max-w-4xl mx-auto px-6", children: /* @__PURE__ */ jsx(MarkdownViewer_default, {}) }) }),
22346
- toc && /* @__PURE__ */ jsx("div", { className: "hidden lg:block h-screen border-l border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ jsx("div", { className: "documentation_scrollbar h-full overflow-y-auto px-6 pt-0 pb-10", children: /* @__PURE__ */ jsx(MarkdownTOC_default, {}) }) })
22347
- ] }) });
22122
+ function toCssSize(value) {
22123
+ if (typeof value === "number") return `${value}px`;
22124
+ return value;
22125
+ }
22126
+ function DocumentationPanel({
22127
+ value,
22128
+ toc = true,
22129
+ height = "100vh",
22130
+ viewerClassName,
22131
+ contentClassName,
22132
+ tocClassName,
22133
+ className,
22134
+ contentMaxWidthClassName = "max-w-4xl"
22135
+ }) {
22136
+ return /* @__PURE__ */ jsx(MarkdownProvider_default, { markdown: value, children: /* @__PURE__ */ jsxs(
22137
+ "section",
22138
+ {
22139
+ className: classNames66(
22140
+ "eui-documentation-panel",
22141
+ "min-h-0 overflow-hidden bg-white text-gray-900",
22142
+ "dark:bg-gray-950 dark:text-gray-100",
22143
+ toc ? "grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]" : "grid grid-cols-1",
22144
+ className
22145
+ ),
22146
+ style: {
22147
+ height: toCssSize(height)
22148
+ },
22149
+ children: [
22150
+ /* @__PURE__ */ jsx(
22151
+ "main",
22152
+ {
22153
+ className: classNames66(
22154
+ "eui-documentation-panel-viewer",
22155
+ "documentation-panel-scrollbar min-w-0 overflow-y-auto scroll-smooth",
22156
+ viewerClassName
22157
+ ),
22158
+ children: /* @__PURE__ */ jsx(
22159
+ "div",
22160
+ {
22161
+ className: classNames66(
22162
+ "mx-auto px-5 py-8 sm:px-6 lg:px-8",
22163
+ contentMaxWidthClassName,
22164
+ contentClassName
22165
+ ),
22166
+ children: /* @__PURE__ */ jsx(MarkdownViewer_default, {})
22167
+ }
22168
+ )
22169
+ }
22170
+ ),
22171
+ toc ? /* @__PURE__ */ jsx(
22172
+ "aside",
22173
+ {
22174
+ className: classNames66(
22175
+ "eui-documentation-panel-toc",
22176
+ "hidden min-w-0 border-l border-gray-200 bg-white lg:block",
22177
+ "dark:border-gray-800 dark:bg-gray-950",
22178
+ tocClassName
22179
+ ),
22180
+ children: /* @__PURE__ */ jsx(
22181
+ "div",
22182
+ {
22183
+ className: classNames66(
22184
+ "documentation-panel-scrollbar h-full overflow-y-auto px-5 py-8"
22185
+ ),
22186
+ children: /* @__PURE__ */ jsx("div", { className: "sticky top-0", children: /* @__PURE__ */ jsx(MarkdownTOC_default, {}) })
22187
+ }
22188
+ )
22189
+ }
22190
+ ) : null
22191
+ ]
22192
+ }
22193
+ ) });
22348
22194
  }
22349
22195
  var DocumentationPanel_default = DocumentationPanel;
22350
22196
  function SliderItem({
@@ -22520,7 +22366,7 @@ function WorldMapCountryTable({
22520
22366
  }) {
22521
22367
  const enrichedData = useMemo(() => {
22522
22368
  const mapped = data.map((item) => {
22523
- const countryMeta = COUNTRIES.find((c) => c.code === item.code);
22369
+ const countryMeta = COUNTRIES.find((c2) => c2.code === item.code);
22524
22370
  return {
22525
22371
  code: item.code,
22526
22372
  value: item.value,
@@ -22610,7 +22456,7 @@ function BoxNavItem({ icon, name, to, selected, onClick }) {
22610
22456
  type: "button",
22611
22457
  onClick: handleClick,
22612
22458
  "aria-current": selected ? "page" : void 0,
22613
- className: classNames17(
22459
+ className: classNames66(
22614
22460
  "w-full min-w-[80px] flex flex-col items-center justify-center py-3 text-center",
22615
22461
  "hover:text-secondary-700 hover:bg-gray-300/10 hover:cursor-pointer",
22616
22462
  selected ? "text-eui-secondary-700 bg-gray-300/10" : "text-gray-400",
@@ -24519,6 +24365,2531 @@ function ReviewThread({
24519
24365
  ] });
24520
24366
  }
24521
24367
  var ReviewThread_default = ReviewThread;
24368
+ var MarkdownContext = createContext(null);
24369
+
24370
+ // src/compositions/markdown/utils/sanitizeHeading.ts
24371
+ function sanitizeHeading(text, options = {}) {
24372
+ const {
24373
+ removeMarkdownSyntax = true,
24374
+ removeHtmlTags = true,
24375
+ collapseWhitespace = true
24376
+ } = options;
24377
+ let value = String(text || "");
24378
+ if (removeHtmlTags) {
24379
+ value = value.replace(/<[^>]*>/g, "");
24380
+ }
24381
+ if (removeMarkdownSyntax) {
24382
+ value = value.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\[[^\]]+\]/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/[*_~]+/g, "").replace(/\\([\\`*{}\[\]()#+\-.!_>])/g, "$1");
24383
+ }
24384
+ value = value.replace(/[\u0000-\u001F\u007F]/g, "");
24385
+ if (collapseWhitespace) {
24386
+ value = value.replace(/\s+/g, " ");
24387
+ }
24388
+ return value.trim();
24389
+ }
24390
+
24391
+ // src/compositions/markdown/utils/createHeadingSlug.ts
24392
+ function escapeRegExp(value) {
24393
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24394
+ }
24395
+ function createHeadingSlug(text, options = {}) {
24396
+ const {
24397
+ separator = "-",
24398
+ fallback = "heading",
24399
+ slugCounts,
24400
+ existingSlugs
24401
+ } = options;
24402
+ const escapedSeparator = escapeRegExp(separator);
24403
+ const sanitized = sanitizeHeading(text);
24404
+ 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;
24405
+ if (slugCounts) {
24406
+ const count = slugCounts.get(baseSlug) ?? 0;
24407
+ slugCounts.set(baseSlug, count + 1);
24408
+ return count === 0 ? baseSlug : `${baseSlug}${separator}${count}`;
24409
+ }
24410
+ if (existingSlugs) {
24411
+ let slug = baseSlug;
24412
+ let count = 1;
24413
+ while (existingSlugs.has(slug)) {
24414
+ slug = `${baseSlug}${separator}${count}`;
24415
+ count++;
24416
+ }
24417
+ existingSlugs.add(slug);
24418
+ return slug;
24419
+ }
24420
+ return baseSlug;
24421
+ }
24422
+ function slugify(text) {
24423
+ return createHeadingSlug(text);
24424
+ }
24425
+
24426
+ // src/compositions/markdown/utils/normalizeMarkdown.ts
24427
+ function normalizeMarkdown(markdown, options = {}) {
24428
+ const {
24429
+ removeBom = true,
24430
+ normalizeLineEndings = true,
24431
+ trimStart = false,
24432
+ trimEnd = false,
24433
+ collapseBlankLines = false,
24434
+ finalNewline = false
24435
+ } = options;
24436
+ let value = String(markdown ?? "");
24437
+ if (removeBom) {
24438
+ value = value.replace(/^\uFEFF/, "");
24439
+ }
24440
+ if (normalizeLineEndings) {
24441
+ value = value.replace(/\r\n?/g, "\n");
24442
+ }
24443
+ if (trimStart) {
24444
+ value = value.trimStart();
24445
+ }
24446
+ if (trimEnd) {
24447
+ value = value.trimEnd();
24448
+ }
24449
+ if (collapseBlankLines) {
24450
+ value = value.replace(/\n{3,}/g, "\n\n");
24451
+ }
24452
+ if (finalNewline && value && !value.endsWith("\n")) {
24453
+ value += "\n";
24454
+ }
24455
+ return value;
24456
+ }
24457
+
24458
+ // src/compositions/markdown/utils/extractHeadings.ts
24459
+ function getFenceState(line) {
24460
+ const match = line.match(/^\s{0,3}(`{3,}|~{3,})/);
24461
+ if (!match) return null;
24462
+ const fence = match[1];
24463
+ return {
24464
+ marker: fence[0],
24465
+ length: fence.length
24466
+ };
24467
+ }
24468
+ function closesFence(line, fence) {
24469
+ const match = line.match(/^\s{0,3}(`{3,}|~{3,})\s*$/);
24470
+ if (!match) return false;
24471
+ const closingFence = match[1];
24472
+ return closingFence[0] === fence.marker && closingFence.length >= fence.length;
24473
+ }
24474
+ function isSetextUnderline(line) {
24475
+ if (/^\s{0,3}=+\s*$/.test(line)) {
24476
+ return 1;
24477
+ }
24478
+ if (/^\s{0,3}-+\s*$/.test(line)) {
24479
+ return 2;
24480
+ }
24481
+ return null;
24482
+ }
24483
+ function extractAtxHeading(line) {
24484
+ const match = line.match(/^\s{0,3}(#{1,6})(?:\s+|$)(.*)$/);
24485
+ if (!match) return null;
24486
+ const level = match[1].length;
24487
+ const rawText = match[2].replace(/\s+#+\s*$/, "").trim();
24488
+ return {
24489
+ level,
24490
+ text: sanitizeHeading(rawText)
24491
+ };
24492
+ }
24493
+ function extractHeadings(markdown, options = {}) {
24494
+ const {
24495
+ minDepth = 1,
24496
+ maxDepth = 6,
24497
+ includeSetextHeadings = true,
24498
+ idPrefix = ""
24499
+ } = options;
24500
+ const normalizedMarkdown = normalizeMarkdown(markdown);
24501
+ const lines = normalizedMarkdown.split("\n");
24502
+ const headings = [];
24503
+ const slugCounts = /* @__PURE__ */ new Map();
24504
+ let activeFence = null;
24505
+ for (let index = 0; index < lines.length; index++) {
24506
+ const line = lines[index];
24507
+ const fence = getFenceState(line);
24508
+ if (activeFence) {
24509
+ if (closesFence(line, activeFence)) {
24510
+ activeFence = null;
24511
+ }
24512
+ continue;
24513
+ }
24514
+ if (fence) {
24515
+ activeFence = fence;
24516
+ continue;
24517
+ }
24518
+ const atxHeading = extractAtxHeading(line);
24519
+ if (atxHeading) {
24520
+ const { level, text: text2 } = atxHeading;
24521
+ if (level >= minDepth && level <= maxDepth && text2) {
24522
+ const id = createHeadingSlug(text2, { slugCounts });
24523
+ headings.push({
24524
+ id: `${idPrefix}${id}`,
24525
+ text: text2,
24526
+ level
24527
+ });
24528
+ }
24529
+ continue;
24530
+ }
24531
+ if (!includeSetextHeadings) {
24532
+ continue;
24533
+ }
24534
+ const nextLine = lines[index + 1];
24535
+ if (!nextLine) {
24536
+ continue;
24537
+ }
24538
+ const setextLevel = isSetextUnderline(nextLine);
24539
+ if (!setextLevel) {
24540
+ continue;
24541
+ }
24542
+ const text = sanitizeHeading(line);
24543
+ if (!text) {
24544
+ continue;
24545
+ }
24546
+ if (setextLevel >= minDepth && setextLevel <= maxDepth) {
24547
+ const id = createHeadingSlug(text, { slugCounts });
24548
+ headings.push({
24549
+ id: `${idPrefix}${id}`,
24550
+ text,
24551
+ level: setextLevel
24552
+ });
24553
+ }
24554
+ index++;
24555
+ }
24556
+ return headings;
24557
+ }
24558
+
24559
+ // src/compositions/markdown/utils/generateHeadingNumbers.ts
24560
+ function generateHeadingNumbers(headings, options = {}) {
24561
+ const { minDepth = 1, maxDepth = 6, separator = "." } = options;
24562
+ const counters = [0, 0, 0, 0, 0, 0];
24563
+ return headings.filter((heading) => {
24564
+ return heading.level >= minDepth && heading.level <= maxDepth;
24565
+ }).map((heading) => {
24566
+ const level = Math.min(Math.max(heading.level, 1), 6);
24567
+ counters[level - 1]++;
24568
+ for (let index = level; index < counters.length; index++) {
24569
+ counters[index] = 0;
24570
+ }
24571
+ const numbering = counters.slice(0, level).filter((count) => count > 0).join(separator);
24572
+ return {
24573
+ ...heading,
24574
+ numbering
24575
+ };
24576
+ });
24577
+ }
24578
+ function MarkdownProvider({
24579
+ children,
24580
+ markdown,
24581
+ value,
24582
+ headings: externalHeadings,
24583
+ meta,
24584
+ activeHeading: controlledActiveHeading,
24585
+ defaultActiveHeading = "",
24586
+ onActiveHeadingChange
24587
+ }) {
24588
+ const resolvedMarkdown = value ?? markdown ?? "";
24589
+ const [internalActiveHeading, setInternalActiveHeading] = useState(defaultActiveHeading);
24590
+ const headings = useMemo(() => {
24591
+ if (externalHeadings) {
24592
+ return externalHeadings;
24593
+ }
24594
+ return extractHeadings(resolvedMarkdown);
24595
+ }, [externalHeadings, resolvedMarkdown]);
24596
+ const numberedHeadings = useMemo(() => {
24597
+ return generateHeadingNumbers(headings);
24598
+ }, [headings]);
24599
+ const headingMap = useMemo(() => {
24600
+ return headings.reduce((acc, heading) => {
24601
+ acc[heading.id] = heading;
24602
+ return acc;
24603
+ }, {});
24604
+ }, [headings]);
24605
+ const activeHeading = controlledActiveHeading ?? internalActiveHeading;
24606
+ const getHeadingById = useCallback(
24607
+ (id) => {
24608
+ return headingMap[id];
24609
+ },
24610
+ [headingMap]
24611
+ );
24612
+ const setActiveHeading = useCallback(
24613
+ (id) => {
24614
+ if (controlledActiveHeading === void 0) {
24615
+ setInternalActiveHeading(id);
24616
+ }
24617
+ onActiveHeadingChange?.(id, headingMap[id]);
24618
+ },
24619
+ [controlledActiveHeading, headingMap, onActiveHeadingChange]
24620
+ );
24621
+ const contextValue = useMemo(
24622
+ () => ({
24623
+ markdown: resolvedMarkdown,
24624
+ headings,
24625
+ numberedHeadings,
24626
+ activeHeading,
24627
+ setActiveHeading,
24628
+ meta,
24629
+ getHeadingById
24630
+ }),
24631
+ [
24632
+ resolvedMarkdown,
24633
+ headings,
24634
+ numberedHeadings,
24635
+ activeHeading,
24636
+ setActiveHeading,
24637
+ meta,
24638
+ getHeadingById
24639
+ ]
24640
+ );
24641
+ return /* @__PURE__ */ jsx(MarkdownContext.Provider, { value: contextValue, children });
24642
+ }
24643
+ var MarkdownProvider_default = MarkdownProvider;
24644
+ function useMarkdown(options = {}) {
24645
+ const { required = false, errorMessage } = options;
24646
+ const context = useContext(MarkdownContext);
24647
+ if (!context && required) {
24648
+ throw new Error(
24649
+ errorMessage || "useMarkdown must be used inside a MarkdownProvider."
24650
+ );
24651
+ }
24652
+ return context;
24653
+ }
24654
+ function useActiveHeading(options = {}) {
24655
+ const context = useMarkdown();
24656
+ const {
24657
+ headings: externalHeadings,
24658
+ activeHeading: controlledActiveHeading,
24659
+ defaultActiveHeading = "",
24660
+ enabled = true,
24661
+ root = null,
24662
+ rootMargin = "-20% 0px -70% 0px",
24663
+ threshold = 0,
24664
+ scrollBehavior = "smooth",
24665
+ scrollBlock = "start",
24666
+ onActiveHeadingChange
24667
+ } = options;
24668
+ const headings = externalHeadings ?? context?.headings ?? [];
24669
+ const [internalActiveHeading, setInternalActiveHeading] = useState(defaultActiveHeading);
24670
+ const activeHeading = controlledActiveHeading ?? context?.activeHeading ?? internalActiveHeading;
24671
+ const headingMap = useMemo(() => {
24672
+ return headings.reduce((acc, heading) => {
24673
+ acc[heading.id] = heading;
24674
+ return acc;
24675
+ }, {});
24676
+ }, [headings]);
24677
+ const setActiveHeading = useCallback(
24678
+ (id) => {
24679
+ if (controlledActiveHeading === void 0 && !context) {
24680
+ setInternalActiveHeading(id);
24681
+ }
24682
+ context?.setActiveHeading(id);
24683
+ onActiveHeadingChange?.(id, headingMap[id]);
24684
+ },
24685
+ [context, controlledActiveHeading, headingMap, onActiveHeadingChange]
24686
+ );
24687
+ const scrollToHeading = useCallback(
24688
+ (id) => {
24689
+ if (typeof document === "undefined") return;
24690
+ const element = document.getElementById(id);
24691
+ if (!element) return;
24692
+ element.scrollIntoView({
24693
+ behavior: scrollBehavior,
24694
+ block: scrollBlock
24695
+ });
24696
+ setActiveHeading(id);
24697
+ },
24698
+ [scrollBehavior, scrollBlock, setActiveHeading]
24699
+ );
24700
+ const observedHeadingIds = useMemo(() => {
24701
+ return headings.map((heading) => heading.id).join("|");
24702
+ }, [headings]);
24703
+ useEffect(() => {
24704
+ if (!enabled) return;
24705
+ if (typeof window === "undefined") return;
24706
+ if (!("IntersectionObserver" in window)) return;
24707
+ if (headings.length === 0) return;
24708
+ const elements = headings.map((heading) => document.getElementById(heading.id)).filter((element) => Boolean(element));
24709
+ if (elements.length === 0) return;
24710
+ const observer = new IntersectionObserver(
24711
+ (entries) => {
24712
+ const visibleEntries = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
24713
+ const nextActiveId = visibleEntries[0]?.target.id;
24714
+ if (!nextActiveId) return;
24715
+ setActiveHeading(nextActiveId);
24716
+ },
24717
+ {
24718
+ root,
24719
+ rootMargin,
24720
+ threshold
24721
+ }
24722
+ );
24723
+ elements.forEach((element) => {
24724
+ observer.observe(element);
24725
+ });
24726
+ return () => {
24727
+ observer.disconnect();
24728
+ };
24729
+ }, [
24730
+ enabled,
24731
+ root,
24732
+ rootMargin,
24733
+ threshold,
24734
+ observedHeadingIds,
24735
+ headings,
24736
+ setActiveHeading
24737
+ ]);
24738
+ return {
24739
+ activeHeading,
24740
+ setActiveHeading,
24741
+ scrollToHeading
24742
+ };
24743
+ }
24744
+ function useMarkdownHeadings(options = {}) {
24745
+ const context = useMarkdown();
24746
+ const {
24747
+ markdown,
24748
+ headings: externalHeadings,
24749
+ minDepth = 1,
24750
+ maxDepth = 6
24751
+ } = options;
24752
+ const baseHeadings = useMemo(() => {
24753
+ if (externalHeadings) {
24754
+ return externalHeadings;
24755
+ }
24756
+ if (markdown !== void 0) {
24757
+ return extractHeadings(markdown);
24758
+ }
24759
+ return context?.headings ?? [];
24760
+ }, [context?.headings, externalHeadings, markdown]);
24761
+ const headings = useMemo(() => {
24762
+ return baseHeadings.filter((heading) => {
24763
+ return heading.level >= minDepth && heading.level <= maxDepth;
24764
+ });
24765
+ }, [baseHeadings, minDepth, maxDepth]);
24766
+ const numberedHeadings = useMemo(() => {
24767
+ return generateHeadingNumbers(headings);
24768
+ }, [headings]);
24769
+ const headingMap = useMemo(() => {
24770
+ return headings.reduce((acc, heading) => {
24771
+ acc[heading.id] = heading;
24772
+ return acc;
24773
+ }, {});
24774
+ }, [headings]);
24775
+ const getHeadingById = (id) => {
24776
+ return headingMap[id];
24777
+ };
24778
+ return {
24779
+ headings,
24780
+ numberedHeadings,
24781
+ hasHeadings: headings.length > 0,
24782
+ getHeadingById
24783
+ };
24784
+ }
24785
+ function MarkdownHeading({
24786
+ id,
24787
+ level,
24788
+ children,
24789
+ className,
24790
+ showAnchor = true,
24791
+ ...props
24792
+ }) {
24793
+ const tag = `h${Math.min(Math.max(level, 1), 6)}`;
24794
+ return React2.createElement(
24795
+ tag,
24796
+ {
24797
+ ...props,
24798
+ id,
24799
+ className: classNames66("eui-markdown-heading", className)
24800
+ },
24801
+ /* @__PURE__ */ jsxs(Fragment, { children: [
24802
+ children,
24803
+ showAnchor && id ? /* @__PURE__ */ jsx(
24804
+ "a",
24805
+ {
24806
+ href: `#${id}`,
24807
+ className: "eui-markdown-heading-anchor",
24808
+ "aria-label": "Link to heading",
24809
+ children: "#"
24810
+ }
24811
+ ) : null
24812
+ ] })
24813
+ );
24814
+ }
24815
+ var MarkdownHeading_default = MarkdownHeading;
24816
+ PrismLight.registerLanguage("bash", bash);
24817
+ PrismLight.registerLanguage("shell", bash);
24818
+ PrismLight.registerLanguage("sh", bash);
24819
+ PrismLight.registerLanguage("zsh", bash);
24820
+ PrismLight.registerLanguage("c", c);
24821
+ PrismLight.registerLanguage("cpp", cpp);
24822
+ PrismLight.registerLanguage("c++", cpp);
24823
+ PrismLight.registerLanguage("css", css);
24824
+ PrismLight.registerLanguage("scss", scss);
24825
+ PrismLight.registerLanguage("go", go);
24826
+ PrismLight.registerLanguage("java", java);
24827
+ PrismLight.registerLanguage("js", javascript);
24828
+ PrismLight.registerLanguage("javascript", javascript);
24829
+ PrismLight.registerLanguage("jsx", jsx210);
24830
+ PrismLight.registerLanguage("json", json);
24831
+ PrismLight.registerLanguage("html", markup);
24832
+ PrismLight.registerLanguage("xml", markup);
24833
+ PrismLight.registerLanguage("markup", markup);
24834
+ PrismLight.registerLanguage("py", python);
24835
+ PrismLight.registerLanguage("python", python);
24836
+ PrismLight.registerLanguage("rs", rust);
24837
+ PrismLight.registerLanguage("rust", rust);
24838
+ PrismLight.registerLanguage("sql", sql);
24839
+ PrismLight.registerLanguage("ts", typescript);
24840
+ PrismLight.registerLanguage("typescript", typescript);
24841
+ PrismLight.registerLanguage("tsx", tsx);
24842
+ PrismLight.registerLanguage("yaml", yaml);
24843
+ PrismLight.registerLanguage("yml", yaml);
24844
+ var LANGUAGE_ALIASES = {
24845
+ js: "javascript",
24846
+ ts: "typescript",
24847
+ py: "python",
24848
+ sh: "bash",
24849
+ shell: "bash",
24850
+ zsh: "bash",
24851
+ yml: "yaml",
24852
+ html: "markup",
24853
+ xml: "markup",
24854
+ "c++": "cpp",
24855
+ text: "text",
24856
+ txt: "text",
24857
+ plain: "text",
24858
+ plaintext: "text"
24859
+ };
24860
+ function normalizeLanguage(language) {
24861
+ if (!language) return "text";
24862
+ const normalized = language.toLowerCase().trim();
24863
+ return LANGUAGE_ALIASES[normalized] ?? normalized;
24864
+ }
24865
+ function MarkdownCodeBlock({
24866
+ code,
24867
+ language,
24868
+ meta,
24869
+ className,
24870
+ showCopy = true,
24871
+ wrapLongLines = false,
24872
+ ...props
24873
+ }) {
24874
+ const [copied, setCopied] = useState(false);
24875
+ const timeoutRef = useRef(null);
24876
+ const title = meta?.title ?? meta?.filename;
24877
+ const resolvedLanguage = useMemo(() => {
24878
+ return normalizeLanguage(language);
24879
+ }, [language]);
24880
+ const languageLabel = language || resolvedLanguage;
24881
+ const showHeader = Boolean(title || languageLabel || showCopy);
24882
+ const highlightLines = useMemo(() => {
24883
+ return new Set(meta?.highlightLines ?? []);
24884
+ }, [meta?.highlightLines]);
24885
+ const showLineNumbers = Boolean(meta?.showLineNumbers);
24886
+ useEffect(() => {
24887
+ return () => {
24888
+ if (timeoutRef.current) {
24889
+ window.clearTimeout(timeoutRef.current);
24890
+ }
24891
+ };
24892
+ }, []);
24893
+ const copyCode = async () => {
24894
+ if (typeof navigator === "undefined") return;
24895
+ if (!navigator.clipboard) return;
24896
+ await navigator.clipboard.writeText(code);
24897
+ setCopied(true);
24898
+ if (timeoutRef.current) {
24899
+ window.clearTimeout(timeoutRef.current);
24900
+ }
24901
+ timeoutRef.current = window.setTimeout(() => {
24902
+ setCopied(false);
24903
+ }, 1500);
24904
+ };
24905
+ const lineNumberStyle = {
24906
+ minWidth: "3rem",
24907
+ paddingRight: "1rem",
24908
+ color: "rgb(100 116 139)",
24909
+ textAlign: "right",
24910
+ userSelect: "none"
24911
+ };
24912
+ return /* @__PURE__ */ jsxs("div", { ...props, className: classNames66("eui-markdown-code", className), children: [
24913
+ showHeader ? /* @__PURE__ */ jsxs("div", { className: "eui-markdown-code-header", children: [
24914
+ /* @__PURE__ */ jsxs("div", { className: "eui-markdown-code-header-main", children: [
24915
+ title ? /* @__PURE__ */ jsx("div", { className: "eui-markdown-code-title", children: title }) : null,
24916
+ languageLabel ? /* @__PURE__ */ jsx("div", { className: "eui-markdown-code-language", children: languageLabel }) : null
24917
+ ] }),
24918
+ showCopy ? /* @__PURE__ */ jsx(
24919
+ "button",
24920
+ {
24921
+ type: "button",
24922
+ className: "eui-markdown-copy-button",
24923
+ onClick: copyCode,
24924
+ children: copied ? "Copied" : "Copy"
24925
+ }
24926
+ ) : null
24927
+ ] }) : null,
24928
+ /* @__PURE__ */ jsx(
24929
+ PrismLight,
24930
+ {
24931
+ className: "eui-markdown-code-highlighter",
24932
+ language: resolvedLanguage,
24933
+ style: vscDarkPlus,
24934
+ showLineNumbers,
24935
+ wrapLines: highlightLines.size > 0,
24936
+ wrapLongLines,
24937
+ PreTag: "pre",
24938
+ CodeTag: "code",
24939
+ customStyle: {
24940
+ margin: 0,
24941
+ padding: "1rem",
24942
+ background: "transparent",
24943
+ fontSize: "0.875rem",
24944
+ lineHeight: 1.7
24945
+ },
24946
+ codeTagProps: {
24947
+ style: {
24948
+ fontFamily: '"JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'
24949
+ }
24950
+ },
24951
+ lineNumberStyle,
24952
+ lineProps: (lineNumber) => {
24953
+ const highlighted = highlightLines.has(lineNumber);
24954
+ return {
24955
+ className: highlighted ? "eui-markdown-code-line-highlighted" : void 0,
24956
+ style: {
24957
+ display: "block",
24958
+ background: highlighted ? "rgba(250, 204, 21, 0.12)" : void 0
24959
+ }
24960
+ };
24961
+ },
24962
+ children: code
24963
+ }
24964
+ )
24965
+ ] });
24966
+ }
24967
+ var MarkdownCodeBlock_default = MarkdownCodeBlock;
24968
+ function MarkdownInlineCode({
24969
+ children,
24970
+ className,
24971
+ ...props
24972
+ }) {
24973
+ return /* @__PURE__ */ jsx(
24974
+ "code",
24975
+ {
24976
+ ...props,
24977
+ className: classNames66("eui-markdown-inline-code", className),
24978
+ children
24979
+ }
24980
+ );
24981
+ }
24982
+ var MarkdownInlineCode_default = MarkdownInlineCode;
24983
+ function isExternalHref(href) {
24984
+ if (!href) return false;
24985
+ return /^https?:\/\//i.test(href);
24986
+ }
24987
+ function getSafeHref(href) {
24988
+ if (!href) return void 0;
24989
+ const trimmed = href.trim();
24990
+ const isSafe = trimmed.startsWith("#") || trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || /^https?:\/\//i.test(trimmed) || /^mailto:/i.test(trimmed) || /^tel:/i.test(trimmed);
24991
+ return isSafe ? trimmed : void 0;
24992
+ }
24993
+ function MarkdownLink({
24994
+ href,
24995
+ target,
24996
+ children,
24997
+ className,
24998
+ openLinksInNewTab = true,
24999
+ ...props
25000
+ }) {
25001
+ const safeHref = getSafeHref(href);
25002
+ if (!safeHref) {
25003
+ return /* @__PURE__ */ jsx("span", { className, children });
25004
+ }
25005
+ const external = isExternalHref(safeHref);
25006
+ const resolvedTarget = target ?? (openLinksInNewTab && external ? "_blank" : void 0);
25007
+ const rel = resolvedTarget === "_blank" ? "noopener noreferrer" : props.rel;
25008
+ return /* @__PURE__ */ jsx(
25009
+ "a",
25010
+ {
25011
+ ...props,
25012
+ href: safeHref,
25013
+ target: resolvedTarget,
25014
+ rel,
25015
+ className: classNames66("eui-markdown-link", className),
25016
+ children
25017
+ }
25018
+ );
25019
+ }
25020
+ var MarkdownLink_default = MarkdownLink;
25021
+ function getSafeImageSrc(src) {
25022
+ if (!src) return void 0;
25023
+ const trimmed = src.trim();
25024
+ 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);
25025
+ return isSafe ? trimmed : void 0;
25026
+ }
25027
+ function MarkdownImage({
25028
+ src,
25029
+ alt,
25030
+ title,
25031
+ className,
25032
+ ...props
25033
+ }) {
25034
+ const safeSrc = getSafeImageSrc(src);
25035
+ if (!safeSrc) {
25036
+ return null;
25037
+ }
25038
+ return /* @__PURE__ */ jsx(
25039
+ "img",
25040
+ {
25041
+ ...props,
25042
+ src: safeSrc,
25043
+ alt: alt ?? "",
25044
+ title,
25045
+ loading: "lazy",
25046
+ decoding: "async",
25047
+ className: classNames66("eui-markdown-image", className)
25048
+ }
25049
+ );
25050
+ }
25051
+ var MarkdownImage_default = MarkdownImage;
25052
+ function MarkdownTable({
25053
+ children,
25054
+ className,
25055
+ ...props
25056
+ }) {
25057
+ return /* @__PURE__ */ jsx("div", { className: "eui-markdown-table-wrapper", children: /* @__PURE__ */ jsx("table", { ...props, className: classNames66("eui-markdown-table", className), children }) });
25058
+ }
25059
+ function MarkdownTableCell({
25060
+ children,
25061
+ className,
25062
+ ...props
25063
+ }) {
25064
+ return /* @__PURE__ */ jsx("td", { ...props, className: classNames66("eui-markdown-table-cell", className), children });
25065
+ }
25066
+ function MarkdownTableHeaderCell({
25067
+ children,
25068
+ className,
25069
+ ...props
25070
+ }) {
25071
+ return /* @__PURE__ */ jsx(
25072
+ "th",
25073
+ {
25074
+ ...props,
25075
+ className: classNames66("eui-markdown-table-header-cell", className),
25076
+ children
25077
+ }
25078
+ );
25079
+ }
25080
+ var MarkdownTable_default = MarkdownTable;
25081
+ function MarkdownBlockquote({
25082
+ children,
25083
+ className,
25084
+ ...props
25085
+ }) {
25086
+ return /* @__PURE__ */ jsx(
25087
+ "blockquote",
25088
+ {
25089
+ ...props,
25090
+ className: classNames66("eui-markdown-blockquote", className),
25091
+ children
25092
+ }
25093
+ );
25094
+ }
25095
+ var MarkdownBlockquote_default = MarkdownBlockquote;
25096
+ function getTextContent(node) {
25097
+ if (typeof node === "string" || typeof node === "number") {
25098
+ return String(node);
25099
+ }
25100
+ if (Array.isArray(node)) {
25101
+ return node.map(getTextContent).join("");
25102
+ }
25103
+ if (isValidElement(node)) {
25104
+ return getTextContent(node.props.children);
25105
+ }
25106
+ return "";
25107
+ }
25108
+ function createHeadingKey(level, text) {
25109
+ return `${level}:${sanitizeHeading(text)}`;
25110
+ }
25111
+ function parseNumberRanges(value) {
25112
+ if (!value) return [];
25113
+ const normalized = value.replace(/[{}[\]\s]/g, "");
25114
+ if (!normalized) return [];
25115
+ const values = /* @__PURE__ */ new Set();
25116
+ normalized.split(",").forEach((part) => {
25117
+ if (!part) return;
25118
+ const rangeMatch = part.match(/^(\d+)-(\d+)$/);
25119
+ if (rangeMatch) {
25120
+ const start = Number(rangeMatch[1]);
25121
+ const end = Number(rangeMatch[2]);
25122
+ for (let line2 = start; line2 <= end; line2++) {
25123
+ values.add(line2);
25124
+ }
25125
+ return;
25126
+ }
25127
+ const line = Number(part);
25128
+ if (!Number.isNaN(line)) {
25129
+ values.add(line);
25130
+ }
25131
+ });
25132
+ return Array.from(values).sort((a, b) => a - b);
25133
+ }
25134
+ function parseCodeMeta(metaString) {
25135
+ if (!metaString) return void 0;
25136
+ const filenameMatch = metaString.match(
25137
+ /(?:filename|file)=["']?([^"'\s]+)["']?/
25138
+ );
25139
+ const titleMatch = metaString.match(/(?:title)=["']?([^"']+)["']?/);
25140
+ const highlightMatch = metaString.match(/(?:highlight|lines)=["']?([^"'\s]+)["']?/) || metaString.match(/{([^}]+)}/);
25141
+ return {
25142
+ filename: filenameMatch?.[1],
25143
+ title: titleMatch?.[1],
25144
+ showLineNumbers: /\b(showLineNumbers|lineNumbers|line-numbers)\b/.test(
25145
+ metaString
25146
+ ),
25147
+ highlightLines: parseNumberRanges(highlightMatch?.[1])
25148
+ };
25149
+ }
25150
+ function getCodeMetaString(node) {
25151
+ const value = node;
25152
+ return value?.data?.meta || value?.data?.hProperties?.meta || value?.properties?.meta || value?.properties?.dataMeta || value?.meta;
25153
+ }
25154
+ function getLanguageFromClassName(className) {
25155
+ if (!className) return void 0;
25156
+ const match = className.match(/language-([^\s]+)/);
25157
+ return match?.[1];
25158
+ }
25159
+ function getCodeInfoFromPreChildren(children) {
25160
+ const childArray = React2.Children.toArray(children);
25161
+ const codeElement = childArray.find((child) => {
25162
+ if (!isValidElement(child)) return false;
25163
+ return child.type === "code";
25164
+ });
25165
+ const codeProps = codeElement?.props;
25166
+ const code = getTextContent(codeProps?.children ?? children).replace(
25167
+ /\n$/,
25168
+ ""
25169
+ );
25170
+ const language = getLanguageFromClassName(codeProps?.className);
25171
+ const meta = parseCodeMeta(codeProps?.["data-meta"]);
25172
+ return {
25173
+ code,
25174
+ language,
25175
+ meta
25176
+ };
25177
+ }
25178
+ function MarkdownRenderer({
25179
+ markdown,
25180
+ headings = [],
25181
+ headingIdPrefix = "",
25182
+ components,
25183
+ className,
25184
+ contentClassName,
25185
+ openLinksInNewTab = true,
25186
+ linkTarget,
25187
+ enableGfm = true,
25188
+ allowHtml = false,
25189
+ sanitizeHtml = true,
25190
+ showCopyCode = true,
25191
+ showHeadingAnchors = true
25192
+ }) {
25193
+ const headingQueues = /* @__PURE__ */ new Map();
25194
+ headings.forEach((heading) => {
25195
+ const key = createHeadingKey(heading.level, heading.text);
25196
+ const queue = headingQueues.get(key) ?? [];
25197
+ queue.push(heading.id);
25198
+ headingQueues.set(key, queue);
25199
+ });
25200
+ const headingUsage = /* @__PURE__ */ new Map();
25201
+ const fallbackSlugCounts = /* @__PURE__ */ new Map();
25202
+ const resolveHeadingId = (level, children) => {
25203
+ const text = getTextContent(children);
25204
+ const key = createHeadingKey(level, text);
25205
+ const queue = headingQueues.get(key);
25206
+ if (queue?.length) {
25207
+ const usedCount = headingUsage.get(key) ?? 0;
25208
+ headingUsage.set(key, usedCount + 1);
25209
+ const existingId = queue[usedCount];
25210
+ if (existingId) {
25211
+ return existingId;
25212
+ }
25213
+ }
25214
+ return `${headingIdPrefix}${createHeadingSlug(text, {
25215
+ slugCounts: fallbackSlugCounts
25216
+ })}`;
25217
+ };
25218
+ const remarkPlugins = [];
25219
+ if (enableGfm) {
25220
+ remarkPlugins.push(remarkGfm);
25221
+ }
25222
+ const rehypePlugins = [];
25223
+ if (allowHtml) {
25224
+ rehypePlugins.push(rehypeRaw);
25225
+ if (sanitizeHtml) {
25226
+ rehypePlugins.push(rehypeSanitize);
25227
+ }
25228
+ }
25229
+ const rendererComponents = {
25230
+ h1: ({ node: _node, children, ...rest }) => {
25231
+ const Component = components?.h1 ?? MarkdownHeading_default;
25232
+ return /* @__PURE__ */ jsx(
25233
+ Component,
25234
+ {
25235
+ ...rest,
25236
+ id: resolveHeadingId(1, children),
25237
+ level: 1,
25238
+ showAnchor: showHeadingAnchors,
25239
+ children
25240
+ }
25241
+ );
25242
+ },
25243
+ h2: ({ node: _node, children, ...rest }) => {
25244
+ const Component = components?.h2 ?? MarkdownHeading_default;
25245
+ return /* @__PURE__ */ jsx(
25246
+ Component,
25247
+ {
25248
+ ...rest,
25249
+ id: resolveHeadingId(2, children),
25250
+ level: 2,
25251
+ showAnchor: showHeadingAnchors,
25252
+ children
25253
+ }
25254
+ );
25255
+ },
25256
+ h3: ({ node: _node, children, ...rest }) => {
25257
+ const Component = components?.h3 ?? MarkdownHeading_default;
25258
+ return /* @__PURE__ */ jsx(
25259
+ Component,
25260
+ {
25261
+ ...rest,
25262
+ id: resolveHeadingId(3, children),
25263
+ level: 3,
25264
+ showAnchor: showHeadingAnchors,
25265
+ children
25266
+ }
25267
+ );
25268
+ },
25269
+ h4: ({ node: _node, children, ...rest }) => {
25270
+ const Component = components?.h4 ?? MarkdownHeading_default;
25271
+ return /* @__PURE__ */ jsx(
25272
+ Component,
25273
+ {
25274
+ ...rest,
25275
+ id: resolveHeadingId(4, children),
25276
+ level: 4,
25277
+ showAnchor: showHeadingAnchors,
25278
+ children
25279
+ }
25280
+ );
25281
+ },
25282
+ h5: ({ node: _node, children, ...rest }) => {
25283
+ const Component = components?.h5 ?? MarkdownHeading_default;
25284
+ return /* @__PURE__ */ jsx(
25285
+ Component,
25286
+ {
25287
+ ...rest,
25288
+ id: resolveHeadingId(5, children),
25289
+ level: 5,
25290
+ showAnchor: showHeadingAnchors,
25291
+ children
25292
+ }
25293
+ );
25294
+ },
25295
+ h6: ({ node: _node, children, ...rest }) => {
25296
+ const Component = components?.h6 ?? MarkdownHeading_default;
25297
+ return /* @__PURE__ */ jsx(
25298
+ Component,
25299
+ {
25300
+ ...rest,
25301
+ id: resolveHeadingId(6, children),
25302
+ level: 6,
25303
+ showAnchor: showHeadingAnchors,
25304
+ children
25305
+ }
25306
+ );
25307
+ },
25308
+ /**
25309
+ * Important:
25310
+ * For block code, return a native <code> with className="language-*".
25311
+ * Then the pre renderer can reliably extract language + meta.
25312
+ */
25313
+ code: ({ node, className: className2, children, ...rest }) => {
25314
+ const language = getLanguageFromClassName(className2);
25315
+ if (language) {
25316
+ return /* @__PURE__ */ jsx(
25317
+ "code",
25318
+ {
25319
+ ...rest,
25320
+ className: className2,
25321
+ "data-meta": getCodeMetaString(node),
25322
+ children
25323
+ }
25324
+ );
25325
+ }
25326
+ const Component = components?.code ?? MarkdownInlineCode_default;
25327
+ return /* @__PURE__ */ jsx(Component, { ...rest, className: className2, children });
25328
+ },
25329
+ /**
25330
+ * Do not spread rest here.
25331
+ * React-markdown's pre props are HTMLPreElement props.
25332
+ * MarkdownCodeBlock root is a div.
25333
+ */
25334
+ pre: ({ node: _node, children }) => {
25335
+ const Component = components?.pre ?? MarkdownCodeBlock_default;
25336
+ const { code, language, meta } = getCodeInfoFromPreChildren(children);
25337
+ return /* @__PURE__ */ jsx(
25338
+ Component,
25339
+ {
25340
+ code,
25341
+ language,
25342
+ meta,
25343
+ showCopy: showCopyCode
25344
+ }
25345
+ );
25346
+ },
25347
+ a: ({ node: _node, children, href, target, ...rest }) => {
25348
+ const Component = components?.a ?? MarkdownLink_default;
25349
+ return /* @__PURE__ */ jsx(
25350
+ Component,
25351
+ {
25352
+ ...rest,
25353
+ href,
25354
+ target: linkTarget ?? target,
25355
+ openLinksInNewTab,
25356
+ children
25357
+ }
25358
+ );
25359
+ },
25360
+ img: ({ node: _node, src, alt, title, ...rest }) => {
25361
+ const Component = components?.img ?? MarkdownImage_default;
25362
+ return /* @__PURE__ */ jsx(Component, { ...rest, src, alt, title });
25363
+ },
25364
+ table: ({ node: _node, children, ...rest }) => {
25365
+ const Component = components?.table ?? MarkdownTable_default;
25366
+ return /* @__PURE__ */ jsx(Component, { ...rest, children });
25367
+ },
25368
+ td: ({ node: _node, children, ...rest }) => {
25369
+ const Component = components?.td ?? MarkdownTableCell;
25370
+ return /* @__PURE__ */ jsx(Component, { ...rest, children });
25371
+ },
25372
+ th: ({ node: _node, children, ...rest }) => {
25373
+ const Component = components?.th ?? MarkdownTableHeaderCell;
25374
+ return /* @__PURE__ */ jsx(Component, { ...rest, children });
25375
+ },
25376
+ blockquote: ({ node: _node, children, ...rest }) => {
25377
+ const Component = components?.blockquote ?? MarkdownBlockquote_default;
25378
+ return /* @__PURE__ */ jsx(Component, { ...rest, children });
25379
+ },
25380
+ ...components
25381
+ };
25382
+ return /* @__PURE__ */ jsx("div", { className: classNames66("eui-markdown markdown-body", className), children: /* @__PURE__ */ jsx("div", { className: contentClassName, children: /* @__PURE__ */ jsx(
25383
+ ReactMarkdown,
25384
+ {
25385
+ remarkPlugins,
25386
+ rehypePlugins,
25387
+ skipHtml: !allowHtml,
25388
+ components: rendererComponents,
25389
+ children: markdown
25390
+ }
25391
+ ) }) });
25392
+ }
25393
+ var MarkdownRenderer_default = MarkdownRenderer;
25394
+ function MarkdownViewer({
25395
+ value,
25396
+ headings: externalHeadings,
25397
+ headingIdPrefix = "",
25398
+ enableActiveHeading = true,
25399
+ ...props
25400
+ }) {
25401
+ const context = useMarkdown();
25402
+ const markdown = value ?? context?.markdown ?? "";
25403
+ const headings = useMemo(() => {
25404
+ if (externalHeadings) {
25405
+ return externalHeadings;
25406
+ }
25407
+ if (context?.headings?.length) {
25408
+ return context.headings;
25409
+ }
25410
+ return extractHeadings(markdown, {
25411
+ idPrefix: headingIdPrefix
25412
+ });
25413
+ }, [context?.headings, externalHeadings, headingIdPrefix, markdown]);
25414
+ useActiveHeading({
25415
+ headings,
25416
+ enabled: enableActiveHeading && headings.length > 0
25417
+ });
25418
+ return /* @__PURE__ */ jsx(
25419
+ MarkdownRenderer_default,
25420
+ {
25421
+ markdown,
25422
+ headings,
25423
+ headingIdPrefix,
25424
+ ...props
25425
+ }
25426
+ );
25427
+ }
25428
+ var MarkdownViewer_default = MarkdownViewer;
25429
+ function hasNumbering(heading) {
25430
+ return "numbering" in heading;
25431
+ }
25432
+ function MarkdownTOCItem({
25433
+ heading,
25434
+ active = false,
25435
+ numbered = true,
25436
+ sanitizeLabel = true,
25437
+ indentSize = 12,
25438
+ className,
25439
+ activeClassName,
25440
+ inactiveClassName,
25441
+ onSelect
25442
+ }) {
25443
+ const label = sanitizeLabel ? sanitizeHeading(heading.text) : heading.text;
25444
+ const numbering = hasNumbering(heading) ? heading.numbering : void 0;
25445
+ return /* @__PURE__ */ jsxs(
25446
+ "button",
25447
+ {
25448
+ type: "button",
25449
+ onClick: () => onSelect?.(heading),
25450
+ "aria-current": active ? "location" : void 0,
25451
+ title: label,
25452
+ className: classNames66(
25453
+ "eui-markdown-toc-item",
25454
+ "block w-full text-left text-sm transition-all ease-in-out duration-150",
25455
+ "hover:text-primary",
25456
+ active ? classNames66("text-primary font-semibold underline", activeClassName) : classNames66("text-gray-500 dark:text-gray-400", inactiveClassName),
25457
+ className
25458
+ ),
25459
+ style: {
25460
+ paddingLeft: `${Math.max(heading.level - 1, 0) * indentSize}px`
25461
+ },
25462
+ children: [
25463
+ numbered && numbering ? /* @__PURE__ */ jsx("span", { className: "eui-markdown-toc-item-number mr-2 opacity-70", children: numbering }) : null,
25464
+ /* @__PURE__ */ jsx("span", { className: "eui-markdown-toc-item-label", children: label })
25465
+ ]
25466
+ }
25467
+ );
25468
+ }
25469
+ var MarkdownTOCItem_default = MarkdownTOCItem;
25470
+ function MarkdownTOC({
25471
+ title = "Table of Contents",
25472
+ markdown,
25473
+ headings: externalHeadings,
25474
+ minDepth = 1,
25475
+ maxDepth = 6,
25476
+ numbered = true,
25477
+ sanitizeLabels = true,
25478
+ collapsible = false,
25479
+ defaultCollapsed = false,
25480
+ emptyState = null,
25481
+ smoothScroll = true,
25482
+ scrollBlock = "start",
25483
+ indentSize = 12,
25484
+ className,
25485
+ titleClassName,
25486
+ listClassName,
25487
+ itemClassName,
25488
+ activeItemClassName,
25489
+ inactiveItemClassName,
25490
+ activeHeading: controlledActiveHeading,
25491
+ onActiveHeadingChange,
25492
+ onHeadingClick
25493
+ }) {
25494
+ const context = useMarkdown();
25495
+ const [collapsed, setCollapsed] = useState(defaultCollapsed);
25496
+ const { headings, numberedHeadings, hasHeadings } = useMarkdownHeadings({
25497
+ markdown,
25498
+ headings: externalHeadings,
25499
+ minDepth,
25500
+ maxDepth
25501
+ });
25502
+ const tocHeadings = useMemo(() => {
25503
+ return numbered ? numberedHeadings : headings;
25504
+ }, [headings, numbered, numberedHeadings]);
25505
+ const { activeHeading, scrollToHeading, setActiveHeading } = useActiveHeading(
25506
+ {
25507
+ headings,
25508
+ enabled: false,
25509
+ activeHeading: controlledActiveHeading,
25510
+ scrollBehavior: smoothScroll ? "smooth" : "auto",
25511
+ scrollBlock,
25512
+ onActiveHeadingChange
25513
+ }
25514
+ );
25515
+ if (!context && !markdown && !externalHeadings) {
25516
+ return null;
25517
+ }
25518
+ if (!hasHeadings) {
25519
+ return emptyState ? /* @__PURE__ */ jsx(
25520
+ "div",
25521
+ {
25522
+ className: classNames66(
25523
+ "eui-markdown-toc",
25524
+ "text-sm text-gray-500 dark:text-gray-400",
25525
+ className
25526
+ ),
25527
+ children: emptyState
25528
+ }
25529
+ ) : null;
25530
+ }
25531
+ const handleSelect = (heading) => {
25532
+ scrollToHeading(heading.id);
25533
+ setActiveHeading(heading.id);
25534
+ onHeadingClick?.(heading);
25535
+ };
25536
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
25537
+ title ? /* @__PURE__ */ jsx("div", { className: "eui-markdown-toc-header", children: collapsible ? /* @__PURE__ */ jsxs(
25538
+ "button",
25539
+ {
25540
+ type: "button",
25541
+ onClick: () => setCollapsed((value) => !value),
25542
+ className: classNames66(
25543
+ "eui-markdown-toc-title",
25544
+ "flex w-full items-center justify-between gap-2 text-left",
25545
+ "text-sm font-semibold uppercase tracking-wide",
25546
+ "text-gray-900 dark:text-gray-100",
25547
+ titleClassName
25548
+ ),
25549
+ "aria-expanded": !collapsed,
25550
+ children: [
25551
+ /* @__PURE__ */ jsx("span", { children: title }),
25552
+ /* @__PURE__ */ jsx(
25553
+ "span",
25554
+ {
25555
+ className: classNames66(
25556
+ "text-xs opacity-60 transition-transform duration-150",
25557
+ !collapsed && "rotate-90"
25558
+ ),
25559
+ "aria-hidden": "true",
25560
+ children: "\u203A"
25561
+ }
25562
+ )
25563
+ ]
25564
+ }
25565
+ ) : /* @__PURE__ */ jsx(
25566
+ "h2",
25567
+ {
25568
+ className: classNames66(
25569
+ "eui-markdown-toc-title",
25570
+ "text-sm font-semibold uppercase tracking-wide",
25571
+ "text-gray-900 dark:text-gray-100",
25572
+ titleClassName
25573
+ ),
25574
+ children: title
25575
+ }
25576
+ ) }) : null,
25577
+ !collapsed ? /* @__PURE__ */ jsx(
25578
+ "nav",
25579
+ {
25580
+ className: classNames66(
25581
+ "eui-markdown-toc-list",
25582
+ "space-y-1",
25583
+ listClassName
25584
+ ),
25585
+ "aria-label": title || "Markdown table of contents",
25586
+ children: tocHeadings.map((heading) => /* @__PURE__ */ jsx(
25587
+ MarkdownTOCItem_default,
25588
+ {
25589
+ heading,
25590
+ active: activeHeading === heading.id,
25591
+ numbered,
25592
+ sanitizeLabel: sanitizeLabels,
25593
+ indentSize,
25594
+ className: itemClassName,
25595
+ activeClassName: activeItemClassName,
25596
+ inactiveClassName: inactiveItemClassName,
25597
+ onSelect: handleSelect
25598
+ },
25599
+ heading.id
25600
+ ))
25601
+ }
25602
+ ) : null
25603
+ ] });
25604
+ return /* @__PURE__ */ jsx("aside", { className: classNames66("eui-markdown-toc", "space-y-4", className), children: content });
25605
+ }
25606
+ var MarkdownTOC_default = MarkdownTOC;
25607
+ var DEFAULT_MARKDOWN_TOOLBAR_ACTIONS = [
25608
+ {
25609
+ id: "heading-1",
25610
+ label: "H1",
25611
+ title: "Heading 1"
25612
+ },
25613
+ {
25614
+ id: "heading-2",
25615
+ label: "H2",
25616
+ title: "Heading 2"
25617
+ },
25618
+ {
25619
+ id: "heading-3",
25620
+ label: "H3",
25621
+ title: "Heading 3"
25622
+ },
25623
+ {
25624
+ id: "bold",
25625
+ label: "B",
25626
+ title: "Bold",
25627
+ shortcut: "Ctrl+B"
25628
+ },
25629
+ {
25630
+ id: "italic",
25631
+ label: "I",
25632
+ title: "Italic",
25633
+ shortcut: "Ctrl+I"
25634
+ },
25635
+ {
25636
+ id: "strike",
25637
+ label: "S",
25638
+ title: "Strikethrough"
25639
+ },
25640
+ {
25641
+ id: "inline-code",
25642
+ label: "`",
25643
+ title: "Inline code"
25644
+ },
25645
+ {
25646
+ id: "code-block",
25647
+ label: "{}",
25648
+ title: "Code block"
25649
+ },
25650
+ {
25651
+ id: "link",
25652
+ label: "Link",
25653
+ title: "Link"
25654
+ },
25655
+ {
25656
+ id: "image",
25657
+ label: "Img",
25658
+ title: "Image"
25659
+ },
25660
+ {
25661
+ id: "unordered-list",
25662
+ label: "\u2022 List",
25663
+ title: "Bullet list"
25664
+ },
25665
+ {
25666
+ id: "ordered-list",
25667
+ label: "1. List",
25668
+ title: "Numbered list"
25669
+ },
25670
+ {
25671
+ id: "quote",
25672
+ label: "Quote",
25673
+ title: "Blockquote"
25674
+ },
25675
+ {
25676
+ id: "table",
25677
+ label: "Table",
25678
+ title: "Table"
25679
+ },
25680
+ {
25681
+ id: "hr",
25682
+ label: "\u2014",
25683
+ title: "Horizontal rule"
25684
+ }
25685
+ ];
25686
+ function MarkdownToolbar({
25687
+ actions = DEFAULT_MARKDOWN_TOOLBAR_ACTIONS,
25688
+ disabled = false,
25689
+ actionsDisabled = false,
25690
+ compact = false,
25691
+ viewMode = "preview",
25692
+ showViewModeToggle = true,
25693
+ onViewModeToggle,
25694
+ className,
25695
+ buttonClassName,
25696
+ toggleButtonClassName,
25697
+ onAction
25698
+ }) {
25699
+ const isPreviewMode = viewMode === "preview";
25700
+ return /* @__PURE__ */ jsxs(
25701
+ "div",
25702
+ {
25703
+ className: classNames66(
25704
+ "eui-markdown-toolbar",
25705
+ "flex flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 p-2",
25706
+ "dark:border-gray-700 dark:bg-gray-900",
25707
+ className
25708
+ ),
25709
+ children: [
25710
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1", children: actions.map((action) => /* @__PURE__ */ jsx(
25711
+ "button",
25712
+ {
25713
+ type: "button",
25714
+ disabled: disabled || actionsDisabled,
25715
+ title: action.shortcut ? `${action.title || action.label} (${action.shortcut})` : action.title || action.label,
25716
+ onClick: () => onAction?.(action.id),
25717
+ className: classNames66(
25718
+ "eui-markdown-toolbar-button",
25719
+ "inline-flex items-center justify-center rounded border border-transparent",
25720
+ "text-gray-700 transition-colors hover:border-gray-300 hover:bg-white",
25721
+ "dark:text-gray-200 dark:hover:border-gray-600 dark:hover:bg-gray-800",
25722
+ "disabled:cursor-not-allowed disabled:opacity-50",
25723
+ compact ? "h-7 px-2 text-xs" : "h-8 px-2.5 text-sm",
25724
+ buttonClassName
25725
+ ),
25726
+ children: action.label
25727
+ },
25728
+ action.id
25729
+ )) }),
25730
+ showViewModeToggle ? /* @__PURE__ */ jsx("div", { className: "ml-auto", children: /* @__PURE__ */ jsx(
25731
+ "button",
25732
+ {
25733
+ type: "button",
25734
+ disabled,
25735
+ onClick: onViewModeToggle,
25736
+ title: isPreviewMode ? "Switch to Markdown syntax" : "Switch to preview",
25737
+ className: classNames66(
25738
+ "eui-markdown-view-toggle",
25739
+ "inline-flex items-center justify-center rounded border font-medium transition-colors",
25740
+ "border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
25741
+ "dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700",
25742
+ "disabled:cursor-not-allowed disabled:opacity-50",
25743
+ compact ? "h-7 px-2 text-xs" : "h-8 px-3 text-sm",
25744
+ toggleButtonClassName
25745
+ ),
25746
+ children: isPreviewMode ? "Syntax" : "Preview"
25747
+ }
25748
+ ) }) : null
25749
+ ]
25750
+ }
25751
+ );
25752
+ }
25753
+ var MarkdownToolbar_default = MarkdownToolbar;
25754
+ function getLineRange(value, start, end) {
25755
+ const lineStart = value.lastIndexOf("\n", start - 1) + 1;
25756
+ const lineEndIndex = value.indexOf("\n", end);
25757
+ return {
25758
+ lineStart,
25759
+ lineEnd: lineEndIndex === -1 ? value.length : lineEndIndex
25760
+ };
25761
+ }
25762
+ function replaceRange(value, start, end, replacement) {
25763
+ return value.slice(0, start) + replacement + value.slice(end);
25764
+ }
25765
+ function wrapSelection(value, start, end, before, after = before, placeholder = "text") {
25766
+ const selected = value.slice(start, end);
25767
+ const content = selected || placeholder;
25768
+ const replacement = `${before}${content}${after}`;
25769
+ const nextValue = replaceRange(value, start, end, replacement);
25770
+ const selectionStart = start + before.length;
25771
+ const selectionEnd = selectionStart + content.length;
25772
+ return {
25773
+ value: nextValue,
25774
+ selectionStart,
25775
+ selectionEnd
25776
+ };
25777
+ }
25778
+ function prefixSelectedLines(value, start, end, getPrefix) {
25779
+ const { lineStart, lineEnd } = getLineRange(value, start, end);
25780
+ const selectedBlock = value.slice(lineStart, lineEnd);
25781
+ const lines = selectedBlock.split("\n");
25782
+ const replacement = lines.map((line, index) => {
25783
+ const prefix = getPrefix(index);
25784
+ if (line.startsWith(prefix)) {
25785
+ return line;
25786
+ }
25787
+ return `${prefix}${line}`;
25788
+ }).join("\n");
25789
+ const nextValue = replaceRange(value, lineStart, lineEnd, replacement);
25790
+ const delta = replacement.length - selectedBlock.length;
25791
+ return {
25792
+ value: nextValue,
25793
+ selectionStart: start + getPrefix(0).length,
25794
+ selectionEnd: end + delta
25795
+ };
25796
+ }
25797
+ function prefixCurrentLine(value, start, end, prefix) {
25798
+ const { lineStart, lineEnd } = getLineRange(value, start, end);
25799
+ const line = value.slice(lineStart, lineEnd);
25800
+ const cleanedLine = line.replace(/^#{1,6}\s+/, "");
25801
+ const replacement = `${prefix}${cleanedLine}`;
25802
+ const nextValue = replaceRange(value, lineStart, lineEnd, replacement);
25803
+ return {
25804
+ value: nextValue,
25805
+ selectionStart: lineStart + prefix.length,
25806
+ selectionEnd: lineStart + replacement.length
25807
+ };
25808
+ }
25809
+ function insertBlock(value, start, end, block) {
25810
+ const before = value.slice(0, start);
25811
+ const after = value.slice(end);
25812
+ const needsLeadingNewline = before.length > 0 && !before.endsWith("\n");
25813
+ const needsTrailingNewline = after.length > 0 && !after.startsWith("\n");
25814
+ const replacement = `${needsLeadingNewline ? "\n" : ""}${block}${needsTrailingNewline ? "\n" : ""}`;
25815
+ const nextValue = replaceRange(value, start, end, replacement);
25816
+ const selectionStart = start + (needsLeadingNewline ? 1 : 0);
25817
+ const selectionEnd = selectionStart + block.length;
25818
+ return {
25819
+ value: nextValue,
25820
+ selectionStart,
25821
+ selectionEnd
25822
+ };
25823
+ }
25824
+ function applyMarkdownAction(value, start, end, action) {
25825
+ switch (action) {
25826
+ case "heading-1":
25827
+ return prefixCurrentLine(value, start, end, "# ");
25828
+ case "heading-2":
25829
+ return prefixCurrentLine(value, start, end, "## ");
25830
+ case "heading-3":
25831
+ return prefixCurrentLine(value, start, end, "### ");
25832
+ case "bold":
25833
+ return wrapSelection(value, start, end, "**", "**", "bold text");
25834
+ case "italic":
25835
+ return wrapSelection(value, start, end, "_", "_", "italic text");
25836
+ case "strike":
25837
+ return wrapSelection(value, start, end, "~~", "~~", "strikethrough text");
25838
+ case "inline-code":
25839
+ return wrapSelection(value, start, end, "`", "`", "code");
25840
+ case "code-block": {
25841
+ const selected = value.slice(start, end) || "code";
25842
+ return insertBlock(value, start, end, `\`\`\`ts
25843
+ ${selected}
25844
+ \`\`\``);
25845
+ }
25846
+ case "link": {
25847
+ const selected = value.slice(start, end) || "link text";
25848
+ const replacement = `[${selected}](https://example.com)`;
25849
+ const nextValue = replaceRange(value, start, end, replacement);
25850
+ return {
25851
+ value: nextValue,
25852
+ selectionStart: start + 1,
25853
+ selectionEnd: start + 1 + selected.length
25854
+ };
25855
+ }
25856
+ case "image": {
25857
+ const selected = value.slice(start, end) || "image alt";
25858
+ const replacement = `![${selected}](https://example.com/image.png)`;
25859
+ const nextValue = replaceRange(value, start, end, replacement);
25860
+ return {
25861
+ value: nextValue,
25862
+ selectionStart: start + 2,
25863
+ selectionEnd: start + 2 + selected.length
25864
+ };
25865
+ }
25866
+ case "unordered-list":
25867
+ return prefixSelectedLines(value, start, end, () => "- ");
25868
+ case "ordered-list":
25869
+ return prefixSelectedLines(
25870
+ value,
25871
+ start,
25872
+ end,
25873
+ (index) => `${index + 1}. `
25874
+ );
25875
+ case "quote":
25876
+ return prefixSelectedLines(value, start, end, () => "> ");
25877
+ case "table":
25878
+ return insertBlock(
25879
+ value,
25880
+ start,
25881
+ end,
25882
+ [
25883
+ "| Column 1 | Column 2 | Column 3 |",
25884
+ "| --- | --- | --- |",
25885
+ "| Value 1 | Value 2 | Value 3 |"
25886
+ ].join("\n")
25887
+ );
25888
+ case "hr":
25889
+ return insertBlock(value, start, end, "---");
25890
+ default:
25891
+ return {
25892
+ value,
25893
+ selectionStart: start,
25894
+ selectionEnd: end
25895
+ };
25896
+ }
25897
+ }
25898
+ function MarkdownSourceEditor({
25899
+ value,
25900
+ defaultValue = "",
25901
+ onChange,
25902
+ onBlur,
25903
+ viewMode,
25904
+ defaultViewMode = "preview",
25905
+ onViewModeChange,
25906
+ showToolbar = true,
25907
+ showViewModeToggle = true,
25908
+ toolbarProps,
25909
+ previewProps,
25910
+ minHeight = 260,
25911
+ maxHeight,
25912
+ disabled = false,
25913
+ readOnly = false,
25914
+ placeholder = "Write markdown...",
25915
+ containerClassName,
25916
+ toolbarClassName,
25917
+ textareaClassName,
25918
+ previewClassName,
25919
+ className,
25920
+ onKeyDown,
25921
+ ...props
25922
+ }) {
25923
+ const textareaRef = useRef(null);
25924
+ const isControlled = value !== void 0;
25925
+ const isViewModeControlled = viewMode !== void 0;
25926
+ const [internalValue, setInternalValue] = useState(defaultValue);
25927
+ const [internalViewMode, setInternalViewMode] = useState(defaultViewMode);
25928
+ const currentValue = isControlled ? value : internalValue;
25929
+ const currentViewMode = isViewModeControlled ? viewMode : internalViewMode;
25930
+ const resolvedValue = currentValue ?? "";
25931
+ useEffect(() => {
25932
+ if (!isControlled) {
25933
+ setInternalValue(defaultValue);
25934
+ }
25935
+ }, [defaultValue, isControlled]);
25936
+ useEffect(() => {
25937
+ if (!isViewModeControlled) {
25938
+ setInternalViewMode(defaultViewMode);
25939
+ }
25940
+ }, [defaultViewMode, isViewModeControlled]);
25941
+ const updateValue = (nextValue) => {
25942
+ if (!isControlled) {
25943
+ setInternalValue(nextValue);
25944
+ }
25945
+ onChange?.(nextValue);
25946
+ };
25947
+ const updateViewMode = (nextViewMode) => {
25948
+ if (!isViewModeControlled) {
25949
+ setInternalViewMode(nextViewMode);
25950
+ }
25951
+ onViewModeChange?.(nextViewMode);
25952
+ };
25953
+ const toggleViewMode = () => {
25954
+ updateViewMode(currentViewMode === "preview" ? "source" : "preview");
25955
+ };
25956
+ const runAction = (action) => {
25957
+ const textarea = textareaRef.current;
25958
+ if (!textarea || disabled || readOnly) return;
25959
+ const start = textarea.selectionStart;
25960
+ const end = textarea.selectionEnd;
25961
+ const result = applyMarkdownAction(resolvedValue, start, end, action);
25962
+ updateValue(result.value);
25963
+ window.setTimeout(() => {
25964
+ textarea.focus();
25965
+ textarea.setSelectionRange(result.selectionStart, result.selectionEnd);
25966
+ }, 0);
25967
+ };
25968
+ const handleToolbarAction = (action) => {
25969
+ if (currentViewMode === "preview") {
25970
+ updateViewMode("source");
25971
+ window.setTimeout(() => {
25972
+ runAction(action);
25973
+ }, 0);
25974
+ return;
25975
+ }
25976
+ runAction(action);
25977
+ };
25978
+ const handleKeyDown = (event) => {
25979
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "b") {
25980
+ event.preventDefault();
25981
+ runAction("bold");
25982
+ return;
25983
+ }
25984
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "i") {
25985
+ event.preventDefault();
25986
+ runAction("italic");
25987
+ return;
25988
+ }
25989
+ onKeyDown?.(event);
25990
+ };
25991
+ return /* @__PURE__ */ jsxs(
25992
+ "div",
25993
+ {
25994
+ className: classNames66(
25995
+ "eui-markdown-editor",
25996
+ "overflow-hidden rounded border border-gray-300 bg-white",
25997
+ "dark:border-gray-700 dark:bg-gray-950",
25998
+ containerClassName,
25999
+ className
26000
+ ),
26001
+ children: [
26002
+ showToolbar ? /* @__PURE__ */ jsx(
26003
+ MarkdownToolbar_default,
26004
+ {
26005
+ ...toolbarProps,
26006
+ disabled,
26007
+ actionsDisabled: readOnly,
26008
+ viewMode: currentViewMode,
26009
+ showViewModeToggle,
26010
+ className: classNames66(toolbarClassName, toolbarProps?.className),
26011
+ onViewModeToggle: toggleViewMode,
26012
+ onAction: handleToolbarAction
26013
+ }
26014
+ ) : null,
26015
+ currentViewMode === "preview" ? /* @__PURE__ */ jsx(
26016
+ "div",
26017
+ {
26018
+ className: classNames66(
26019
+ "eui-markdown-editor-preview",
26020
+ "min-h-[260px] p-4",
26021
+ previewClassName
26022
+ ),
26023
+ style: {
26024
+ minHeight,
26025
+ maxHeight
26026
+ },
26027
+ children: resolvedValue.trim() ? /* @__PURE__ */ jsx(MarkdownViewer_default, { ...previewProps, value: resolvedValue }) : /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: placeholder })
26028
+ }
26029
+ ) : /* @__PURE__ */ jsx(
26030
+ "textarea",
26031
+ {
26032
+ ...props,
26033
+ ref: textareaRef,
26034
+ value: resolvedValue,
26035
+ disabled,
26036
+ readOnly,
26037
+ placeholder,
26038
+ onChange: (event) => updateValue(event.target.value),
26039
+ onBlur,
26040
+ onKeyDown: handleKeyDown,
26041
+ className: classNames66(
26042
+ "eui-markdown-source-textarea",
26043
+ "block w-full resize-y border-0 bg-transparent p-4 font-mono text-sm leading-7",
26044
+ "text-gray-900 outline-none placeholder:text-gray-400",
26045
+ "dark:text-gray-100 dark:placeholder:text-gray-500",
26046
+ "disabled:cursor-not-allowed disabled:opacity-60",
26047
+ textareaClassName
26048
+ ),
26049
+ style: {
26050
+ minHeight,
26051
+ maxHeight,
26052
+ ...props.style
26053
+ }
26054
+ }
26055
+ )
26056
+ ]
26057
+ }
26058
+ );
26059
+ }
26060
+ var MarkdownSourceEditor_default = MarkdownSourceEditor;
26061
+ function MarkdownPreviewPane({
26062
+ value = "",
26063
+ emptyState = /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Nothing to preview yet." }),
26064
+ className,
26065
+ contentClassName,
26066
+ ...viewerProps
26067
+ }) {
26068
+ return /* @__PURE__ */ jsx(
26069
+ "div",
26070
+ {
26071
+ className: classNames66(
26072
+ "eui-markdown-preview-pane",
26073
+ "rounded border border-gray-300 bg-white p-4",
26074
+ "dark:border-gray-700 dark:bg-gray-950",
26075
+ className
26076
+ ),
26077
+ children: value.trim() ? /* @__PURE__ */ jsx(
26078
+ MarkdownViewer_default,
26079
+ {
26080
+ ...viewerProps,
26081
+ value,
26082
+ className: contentClassName
26083
+ }
26084
+ ) : emptyState
26085
+ }
26086
+ );
26087
+ }
26088
+ var MarkdownPreviewPane_default = MarkdownPreviewPane;
26089
+ function MarkdownSplitEditor({
26090
+ value,
26091
+ defaultValue = "",
26092
+ onChange,
26093
+ onBlur,
26094
+ previewProps,
26095
+ previewPlacement = "right",
26096
+ sourceLabel = "Editor",
26097
+ previewLabel = "Preview",
26098
+ wrapperClassName,
26099
+ sourceWrapperClassName,
26100
+ previewWrapperClassName,
26101
+ ...sourceEditorProps
26102
+ }) {
26103
+ const isControlled = value !== void 0;
26104
+ const [internalValue, setInternalValue] = useState(defaultValue);
26105
+ const currentValue = isControlled ? value : internalValue;
26106
+ useEffect(() => {
26107
+ if (!isControlled) {
26108
+ setInternalValue(defaultValue);
26109
+ }
26110
+ }, [defaultValue, isControlled]);
26111
+ const updateValue = (nextValue) => {
26112
+ if (!isControlled) {
26113
+ setInternalValue(nextValue);
26114
+ }
26115
+ onChange?.(nextValue);
26116
+ };
26117
+ const isHorizontal = previewPlacement === "right";
26118
+ return /* @__PURE__ */ jsxs(
26119
+ "div",
26120
+ {
26121
+ className: classNames66(
26122
+ "eui-markdown-split-editor",
26123
+ "grid gap-4",
26124
+ isHorizontal ? "grid-cols-1 lg:grid-cols-2" : "grid-cols-1",
26125
+ wrapperClassName
26126
+ ),
26127
+ children: [
26128
+ /* @__PURE__ */ jsxs(
26129
+ "div",
26130
+ {
26131
+ className: classNames66(
26132
+ "eui-markdown-split-source",
26133
+ "min-w-0 space-y-2",
26134
+ sourceWrapperClassName
26135
+ ),
26136
+ children: [
26137
+ sourceLabel ? /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200", children: sourceLabel }) : null,
26138
+ /* @__PURE__ */ jsx(
26139
+ MarkdownSourceEditor_default,
26140
+ {
26141
+ ...sourceEditorProps,
26142
+ value: currentValue,
26143
+ onChange: updateValue,
26144
+ onBlur,
26145
+ defaultViewMode: "source",
26146
+ showViewModeToggle: false
26147
+ }
26148
+ )
26149
+ ]
26150
+ }
26151
+ ),
26152
+ /* @__PURE__ */ jsxs(
26153
+ "div",
26154
+ {
26155
+ className: classNames66(
26156
+ "eui-markdown-split-preview",
26157
+ "min-w-0 space-y-2",
26158
+ previewWrapperClassName
26159
+ ),
26160
+ children: [
26161
+ previewLabel ? /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200", children: previewLabel }) : null,
26162
+ /* @__PURE__ */ jsx(MarkdownPreviewPane_default, { ...previewProps, value: currentValue })
26163
+ ]
26164
+ }
26165
+ )
26166
+ ]
26167
+ }
26168
+ );
26169
+ }
26170
+ var MarkdownSplitEditor_default = MarkdownSplitEditor;
26171
+ function MarkdownEditor({
26172
+ value,
26173
+ defaultValue = "",
26174
+ onChange,
26175
+ onBlur,
26176
+ mode = "source",
26177
+ viewMode,
26178
+ defaultViewMode = "preview",
26179
+ onViewModeChange,
26180
+ splitProps,
26181
+ richEditor,
26182
+ ...sourceEditorProps
26183
+ }) {
26184
+ const isControlled = value !== void 0;
26185
+ const [internalValue, setInternalValue] = useState(defaultValue);
26186
+ const currentValue = isControlled ? value : internalValue;
26187
+ useEffect(() => {
26188
+ if (!isControlled) {
26189
+ setInternalValue(defaultValue);
26190
+ }
26191
+ }, [defaultValue, isControlled]);
26192
+ const updateValue = (nextValue) => {
26193
+ if (!isControlled) {
26194
+ setInternalValue(nextValue);
26195
+ }
26196
+ onChange?.(nextValue);
26197
+ };
26198
+ if (mode === "rich" && richEditor) {
26199
+ return /* @__PURE__ */ jsx(Fragment, { children: richEditor });
26200
+ }
26201
+ if (mode === "split") {
26202
+ return /* @__PURE__ */ jsx(
26203
+ MarkdownSplitEditor_default,
26204
+ {
26205
+ ...sourceEditorProps,
26206
+ ...splitProps,
26207
+ value: currentValue,
26208
+ onChange: updateValue,
26209
+ onBlur
26210
+ }
26211
+ );
26212
+ }
26213
+ return /* @__PURE__ */ jsx(
26214
+ MarkdownSourceEditor_default,
26215
+ {
26216
+ ...sourceEditorProps,
26217
+ value: currentValue,
26218
+ onChange: updateValue,
26219
+ onBlur,
26220
+ viewMode,
26221
+ defaultViewMode,
26222
+ onViewModeChange
26223
+ }
26224
+ );
26225
+ }
26226
+ var MarkdownEditor_default = MarkdownEditor;
26227
+ function MarkdownField({
26228
+ name,
26229
+ validate,
26230
+ label,
26231
+ helperText,
26232
+ wrapperClassName,
26233
+ labelClassName,
26234
+ helperTextClassName,
26235
+ ...editorProps
26236
+ }) {
26237
+ const [field, meta, helpers] = useField({
26238
+ name,
26239
+ validate
26240
+ });
26241
+ const hasError = Boolean(meta.touched && meta.error);
26242
+ return /* @__PURE__ */ jsxs(
26243
+ "div",
26244
+ {
26245
+ className: classNames66(
26246
+ "eui-markdown-field",
26247
+ "relative space-y-2",
26248
+ wrapperClassName
26249
+ ),
26250
+ children: [
26251
+ label ? /* @__PURE__ */ jsx(
26252
+ "label",
26253
+ {
26254
+ htmlFor: editorProps.id || field.name,
26255
+ className: classNames66(
26256
+ "block text-sm font-medium text-gray-700 dark:text-gray-200",
26257
+ labelClassName
26258
+ ),
26259
+ children: label
26260
+ }
26261
+ ) : null,
26262
+ /* @__PURE__ */ jsx(
26263
+ MarkdownEditor_default,
26264
+ {
26265
+ ...editorProps,
26266
+ id: editorProps.id || field.name,
26267
+ name: field.name,
26268
+ value: field.value || "",
26269
+ onChange: (nextValue) => {
26270
+ helpers.setValue(nextValue);
26271
+ },
26272
+ onBlur: () => {
26273
+ helpers.setTouched(true);
26274
+ }
26275
+ }
26276
+ ),
26277
+ helperText && !hasError ? /* @__PURE__ */ jsx(
26278
+ "p",
26279
+ {
26280
+ className: classNames66(
26281
+ "text-sm text-gray-500 dark:text-gray-400",
26282
+ helperTextClassName
26283
+ ),
26284
+ children: helperText
26285
+ }
26286
+ ) : null,
26287
+ /* @__PURE__ */ jsx(InputResponse_default, { name: field.name, visibility: hasError, variant: "danger" })
26288
+ ]
26289
+ }
26290
+ );
26291
+ }
26292
+ var MarkdownField_default = MarkdownField;
26293
+ function resolveSize(value) {
26294
+ if (value === void 0) return void 0;
26295
+ return typeof value === "number" ? `${value}px` : value;
26296
+ }
26297
+ function MarkdownLayout({
26298
+ children,
26299
+ content,
26300
+ toc,
26301
+ sidebar,
26302
+ aside,
26303
+ header,
26304
+ footer,
26305
+ tocPosition = "right",
26306
+ showToc = true,
26307
+ showSidebar = true,
26308
+ showAside = true,
26309
+ stickyToc = true,
26310
+ stickySidebar = true,
26311
+ stickyAside = true,
26312
+ stickyOffset = "6rem",
26313
+ maxWidth = "1440px",
26314
+ className,
26315
+ containerClassName,
26316
+ gridClassName,
26317
+ contentClassName,
26318
+ tocClassName,
26319
+ sidebarClassName,
26320
+ asideClassName,
26321
+ headerClassName,
26322
+ footerClassName
26323
+ }) {
26324
+ const resolvedContent = children ?? content;
26325
+ const hasToc = showToc && Boolean(toc);
26326
+ const hasSidebar = showSidebar && Boolean(sidebar);
26327
+ const hasAside = showAside && Boolean(aside);
26328
+ const stickyStyle = {
26329
+ top: resolveSize(stickyOffset)
26330
+ };
26331
+ const hasLeftToc = hasToc && tocPosition === "left";
26332
+ const hasRightToc = hasToc && tocPosition === "right";
26333
+ return /* @__PURE__ */ jsx("div", { className: classNames66("eui-markdown-layout", "w-full", className), children: /* @__PURE__ */ jsxs(
26334
+ "div",
26335
+ {
26336
+ className: classNames66(
26337
+ "eui-markdown-layout-container",
26338
+ "mx-auto w-full px-4 sm:px-6 lg:px-8",
26339
+ containerClassName
26340
+ ),
26341
+ style: {
26342
+ maxWidth: resolveSize(maxWidth)
26343
+ },
26344
+ children: [
26345
+ header ? /* @__PURE__ */ jsx(
26346
+ "header",
26347
+ {
26348
+ className: classNames66(
26349
+ "eui-markdown-layout-header",
26350
+ "mb-8",
26351
+ headerClassName
26352
+ ),
26353
+ children: header
26354
+ }
26355
+ ) : null,
26356
+ /* @__PURE__ */ jsxs(
26357
+ "div",
26358
+ {
26359
+ className: classNames66(
26360
+ "eui-markdown-layout-grid",
26361
+ "grid grid-cols-1 gap-8",
26362
+ hasSidebar && hasToc && "xl:grid-cols-[16rem_minmax(0,1fr)_18rem]",
26363
+ hasSidebar && !hasToc && "lg:grid-cols-[16rem_minmax(0,1fr)]",
26364
+ !hasSidebar && hasToc && "lg:grid-cols-[minmax(0,1fr)_18rem]",
26365
+ hasAside && "2xl:grid-cols-[16rem_minmax(0,1fr)_18rem_16rem]",
26366
+ gridClassName
26367
+ ),
26368
+ children: [
26369
+ hasSidebar ? /* @__PURE__ */ jsx(
26370
+ "aside",
26371
+ {
26372
+ className: classNames66(
26373
+ "eui-markdown-layout-sidebar",
26374
+ "min-w-0",
26375
+ stickySidebar && "lg:sticky lg:self-start",
26376
+ sidebarClassName
26377
+ ),
26378
+ style: stickySidebar ? stickyStyle : void 0,
26379
+ children: sidebar
26380
+ }
26381
+ ) : null,
26382
+ hasLeftToc ? /* @__PURE__ */ jsx(
26383
+ "aside",
26384
+ {
26385
+ className: classNames66(
26386
+ "eui-markdown-layout-toc",
26387
+ "min-w-0",
26388
+ stickyToc && "lg:sticky lg:self-start",
26389
+ tocClassName
26390
+ ),
26391
+ style: stickyToc ? stickyStyle : void 0,
26392
+ children: toc
26393
+ }
26394
+ ) : null,
26395
+ /* @__PURE__ */ jsx(
26396
+ "main",
26397
+ {
26398
+ className: classNames66(
26399
+ "eui-markdown-layout-content",
26400
+ "min-w-0",
26401
+ contentClassName
26402
+ ),
26403
+ children: resolvedContent
26404
+ }
26405
+ ),
26406
+ hasRightToc ? /* @__PURE__ */ jsx(
26407
+ "aside",
26408
+ {
26409
+ className: classNames66(
26410
+ "eui-markdown-layout-toc",
26411
+ "min-w-0",
26412
+ stickyToc && "lg:sticky lg:self-start",
26413
+ tocClassName
26414
+ ),
26415
+ style: stickyToc ? stickyStyle : void 0,
26416
+ children: toc
26417
+ }
26418
+ ) : null,
26419
+ hasAside ? /* @__PURE__ */ jsx(
26420
+ "aside",
26421
+ {
26422
+ className: classNames66(
26423
+ "eui-markdown-layout-aside",
26424
+ "min-w-0",
26425
+ stickyAside && "2xl:sticky 2xl:self-start",
26426
+ asideClassName
26427
+ ),
26428
+ style: stickyAside ? stickyStyle : void 0,
26429
+ children: aside
26430
+ }
26431
+ ) : null
26432
+ ]
26433
+ }
26434
+ ),
26435
+ footer ? /* @__PURE__ */ jsx(
26436
+ "footer",
26437
+ {
26438
+ className: classNames66(
26439
+ "eui-markdown-layout-footer",
26440
+ "mt-10",
26441
+ footerClassName
26442
+ ),
26443
+ children: footer
26444
+ }
26445
+ ) : null
26446
+ ]
26447
+ }
26448
+ ) });
26449
+ }
26450
+ var MarkdownLayout_default = MarkdownLayout;
26451
+ function MarkdownDocsLayoutContent({
26452
+ children,
26453
+ markdown,
26454
+ value,
26455
+ headings,
26456
+ title,
26457
+ description,
26458
+ header,
26459
+ headerActions,
26460
+ content,
26461
+ toc,
26462
+ viewerProps,
26463
+ tocProps,
26464
+ enableDefaultViewer = true,
26465
+ enableDefaultToc = true,
26466
+ docsHeaderClassName,
26467
+ docsTitleClassName,
26468
+ docsDescriptionClassName,
26469
+ ...layoutProps
26470
+ }) {
26471
+ const resolvedMarkdown = value ?? markdown ?? "";
26472
+ const resolvedHeader = header ?? (title || description || headerActions ? /* @__PURE__ */ jsx(
26473
+ "div",
26474
+ {
26475
+ className: classNames66(
26476
+ "eui-markdown-docs-header",
26477
+ "flex flex-col gap-4 border-b border-gray-200 pb-6",
26478
+ "dark:border-gray-700",
26479
+ docsHeaderClassName
26480
+ ),
26481
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
26482
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-2", children: [
26483
+ title ? /* @__PURE__ */ jsx(
26484
+ "h1",
26485
+ {
26486
+ className: classNames66(
26487
+ "eui-markdown-docs-title",
26488
+ "text-3xl font-bold tracking-tight text-gray-950",
26489
+ "dark:text-gray-50",
26490
+ docsTitleClassName
26491
+ ),
26492
+ children: title
26493
+ }
26494
+ ) : null,
26495
+ description ? /* @__PURE__ */ jsx(
26496
+ "div",
26497
+ {
26498
+ className: classNames66(
26499
+ "eui-markdown-docs-description",
26500
+ "max-w-3xl text-base leading-7 text-gray-600",
26501
+ "dark:text-gray-400",
26502
+ docsDescriptionClassName
26503
+ ),
26504
+ children: description
26505
+ }
26506
+ ) : null
26507
+ ] }),
26508
+ headerActions ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: headerActions }) : null
26509
+ ] })
26510
+ }
26511
+ ) : null);
26512
+ const resolvedContent = children ?? content ?? (enableDefaultViewer ? /* @__PURE__ */ jsx(
26513
+ MarkdownViewer_default,
26514
+ {
26515
+ ...viewerProps,
26516
+ value: resolvedMarkdown,
26517
+ headings
26518
+ }
26519
+ ) : null);
26520
+ const resolvedToc = toc ?? (enableDefaultToc ? /* @__PURE__ */ jsx(
26521
+ MarkdownTOC_default,
26522
+ {
26523
+ ...tocProps,
26524
+ markdown: resolvedMarkdown,
26525
+ headings
26526
+ }
26527
+ ) : null);
26528
+ return /* @__PURE__ */ jsx(
26529
+ MarkdownLayout_default,
26530
+ {
26531
+ ...layoutProps,
26532
+ header: resolvedHeader,
26533
+ toc: resolvedToc,
26534
+ content: resolvedContent
26535
+ }
26536
+ );
26537
+ }
26538
+ function MarkdownDocsLayout({
26539
+ markdown,
26540
+ value,
26541
+ headings,
26542
+ meta,
26543
+ providerProps,
26544
+ enableProvider = true,
26545
+ ...props
26546
+ }) {
26547
+ const resolvedMarkdown = value ?? markdown ?? "";
26548
+ if (!enableProvider) {
26549
+ return /* @__PURE__ */ jsx(
26550
+ MarkdownDocsLayoutContent,
26551
+ {
26552
+ ...props,
26553
+ markdown,
26554
+ value,
26555
+ headings
26556
+ }
26557
+ );
26558
+ }
26559
+ return /* @__PURE__ */ jsx(
26560
+ MarkdownProvider_default,
26561
+ {
26562
+ ...providerProps,
26563
+ markdown: resolvedMarkdown,
26564
+ headings,
26565
+ meta,
26566
+ children: /* @__PURE__ */ jsx(
26567
+ MarkdownDocsLayoutContent,
26568
+ {
26569
+ ...props,
26570
+ markdown: resolvedMarkdown,
26571
+ headings
26572
+ }
26573
+ )
26574
+ }
26575
+ );
26576
+ }
26577
+ var MarkdownDocsLayout_default = MarkdownDocsLayout;
26578
+ function toCssSize2(value) {
26579
+ if (typeof value === "number") return `${value}px`;
26580
+ return value;
26581
+ }
26582
+ function CodeMirrorMarkdownEditor({
26583
+ value,
26584
+ defaultValue = "",
26585
+ onChange,
26586
+ onBlur,
26587
+ id,
26588
+ name,
26589
+ placeholder = "Write markdown...",
26590
+ disabled = false,
26591
+ readOnly = false,
26592
+ autoFocus = false,
26593
+ minHeight = 320,
26594
+ maxHeight,
26595
+ height,
26596
+ dark = false,
26597
+ className,
26598
+ editorClassName,
26599
+ extensions
26600
+ }) {
26601
+ const isControlled = value !== void 0;
26602
+ const [internalValue, setInternalValue] = useState(defaultValue);
26603
+ const currentValue = isControlled ? value : internalValue;
26604
+ useEffect(() => {
26605
+ if (!isControlled) {
26606
+ setInternalValue(defaultValue);
26607
+ }
26608
+ }, [defaultValue, isControlled]);
26609
+ const updateValue = (nextValue) => {
26610
+ if (!isControlled) {
26611
+ setInternalValue(nextValue);
26612
+ }
26613
+ onChange?.(nextValue);
26614
+ };
26615
+ return /* @__PURE__ */ jsx(
26616
+ "div",
26617
+ {
26618
+ id,
26619
+ "data-name": name,
26620
+ className: classNames66(
26621
+ "eui-markdown-adapter",
26622
+ "eui-markdown-codemirror-adapter",
26623
+ "overflow-hidden rounded border border-gray-300 bg-white",
26624
+ "dark:border-gray-700 dark:bg-gray-950",
26625
+ disabled && "cursor-not-allowed opacity-60",
26626
+ className
26627
+ ),
26628
+ style: {
26629
+ minHeight: toCssSize2(minHeight),
26630
+ maxHeight: toCssSize2(maxHeight)
26631
+ },
26632
+ children: /* @__PURE__ */ jsx(
26633
+ CodeMirror,
26634
+ {
26635
+ value: currentValue,
26636
+ height,
26637
+ minHeight: toCssSize2(minHeight),
26638
+ maxHeight: toCssSize2(maxHeight),
26639
+ placeholder,
26640
+ autoFocus,
26641
+ editable: !disabled && !readOnly,
26642
+ readOnly,
26643
+ theme: dark ? oneDark : void 0,
26644
+ extensions: [markdown(), ...extensions ?? []],
26645
+ basicSetup: {
26646
+ lineNumbers: true,
26647
+ foldGutter: true,
26648
+ highlightActiveLine: true,
26649
+ highlightSelectionMatches: true,
26650
+ autocompletion: true,
26651
+ closeBrackets: true,
26652
+ bracketMatching: true
26653
+ },
26654
+ className: classNames66("eui-markdown-codemirror", editorClassName),
26655
+ onChange: updateValue,
26656
+ onBlur
26657
+ }
26658
+ )
26659
+ }
26660
+ );
26661
+ }
26662
+ var CodeMirrorMarkdownEditor_default = CodeMirrorMarkdownEditor;
26663
+ function toCssSize3(value) {
26664
+ if (typeof value === "number") return `${value}px`;
26665
+ return value;
26666
+ }
26667
+ function createDefaultPlugins(showToolbar) {
26668
+ return [
26669
+ headingsPlugin(),
26670
+ listsPlugin(),
26671
+ quotePlugin(),
26672
+ thematicBreakPlugin(),
26673
+ markdownShortcutPlugin(),
26674
+ linkPlugin(),
26675
+ imagePlugin(),
26676
+ tablePlugin(),
26677
+ codeBlockPlugin({
26678
+ defaultCodeBlockLanguage: "tsx"
26679
+ }),
26680
+ codeMirrorPlugin({
26681
+ codeBlockLanguages: {
26682
+ js: "JavaScript",
26683
+ jsx: "JSX",
26684
+ ts: "TypeScript",
26685
+ tsx: "TSX",
26686
+ css: "CSS",
26687
+ scss: "SCSS",
26688
+ json: "JSON",
26689
+ bash: "Bash",
26690
+ sh: "Shell",
26691
+ html: "HTML",
26692
+ xml: "XML",
26693
+ md: "Markdown"
26694
+ }
26695
+ }),
26696
+ ...showToolbar ? [
26697
+ toolbarPlugin({
26698
+ toolbarContents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
26699
+ /* @__PURE__ */ jsx(UndoRedo, {}),
26700
+ /* @__PURE__ */ jsx(Separator, {}),
26701
+ /* @__PURE__ */ jsx(BoldItalicUnderlineToggles, {}),
26702
+ /* @__PURE__ */ jsx(CodeToggle, {}),
26703
+ /* @__PURE__ */ jsx(Separator, {}),
26704
+ /* @__PURE__ */ jsx(ListsToggle, {}),
26705
+ /* @__PURE__ */ jsx(Separator, {}),
26706
+ /* @__PURE__ */ jsx(CreateLink, {}),
26707
+ /* @__PURE__ */ jsx(InsertImage, {}),
26708
+ /* @__PURE__ */ jsx(InsertTable, {}),
26709
+ /* @__PURE__ */ jsx(InsertCodeBlock, {})
26710
+ ] })
26711
+ })
26712
+ ] : []
26713
+ ];
26714
+ }
26715
+ function MDXMarkdownEditor({
26716
+ value,
26717
+ defaultValue = "",
26718
+ onChange,
26719
+ onBlur,
26720
+ id,
26721
+ name,
26722
+ disabled = false,
26723
+ readOnly = false,
26724
+ minHeight = 360,
26725
+ maxHeight,
26726
+ dark = false,
26727
+ className,
26728
+ editorClassName,
26729
+ plugins,
26730
+ showToolbar = true,
26731
+ ...props
26732
+ }) {
26733
+ const editorRef = useRef(null);
26734
+ const isControlled = value !== void 0;
26735
+ const [internalValue, setInternalValue] = useState(defaultValue);
26736
+ const currentValue = isControlled ? value : internalValue;
26737
+ useEffect(() => {
26738
+ if (!isControlled) {
26739
+ setInternalValue(defaultValue);
26740
+ }
26741
+ }, [defaultValue, isControlled]);
26742
+ useEffect(() => {
26743
+ if (!isControlled) return;
26744
+ editorRef.current?.setMarkdown(value ?? "");
26745
+ }, [value, isControlled]);
26746
+ const updateValue = (nextValue) => {
26747
+ if (!isControlled) {
26748
+ setInternalValue(nextValue);
26749
+ }
26750
+ onChange?.(nextValue);
26751
+ };
26752
+ return /* @__PURE__ */ jsx(
26753
+ "div",
26754
+ {
26755
+ id,
26756
+ "data-name": name,
26757
+ onBlur,
26758
+ className: classNames66(
26759
+ "eui-markdown-adapter",
26760
+ "eui-markdown-mdx-adapter",
26761
+ dark && "dark",
26762
+ disabled && "is-disabled",
26763
+ className
26764
+ ),
26765
+ style: {
26766
+ minHeight: toCssSize3(minHeight),
26767
+ maxHeight: toCssSize3(maxHeight)
26768
+ },
26769
+ children: /* @__PURE__ */ jsx(
26770
+ MDXEditor,
26771
+ {
26772
+ ...props,
26773
+ ref: editorRef,
26774
+ markdown: currentValue ?? "",
26775
+ readOnly: disabled || readOnly,
26776
+ plugins: plugins ?? createDefaultPlugins(showToolbar),
26777
+ className: classNames66("eui-markdown-mdx-editor", editorClassName),
26778
+ contentEditableClassName: "eui-markdown-mdx-content",
26779
+ onChange: updateValue
26780
+ }
26781
+ )
26782
+ }
26783
+ );
26784
+ }
26785
+ var MDXMarkdownEditor_default = MDXMarkdownEditor;
26786
+ function toCssSize4(value) {
26787
+ if (typeof value === "number") return `${value}px`;
26788
+ return value;
26789
+ }
26790
+ function MilkdownInnerEditor({
26791
+ currentValue,
26792
+ updateValue,
26793
+ onBlur,
26794
+ disabled = false,
26795
+ readOnly = false,
26796
+ editorClassName,
26797
+ useGfm = true
26798
+ }) {
26799
+ useEditor(
26800
+ (root) => {
26801
+ let editor = Editor.make().config((ctx) => {
26802
+ ctx.set(rootCtx, root);
26803
+ ctx.set(defaultValueCtx, currentValue);
26804
+ ctx.update(editorViewOptionsCtx, (prev) => ({
26805
+ ...prev,
26806
+ editable: () => !disabled && !readOnly,
26807
+ attributes: {
26808
+ class: classNames66("eui-markdown-milkdown-content", editorClassName),
26809
+ spellcheck: "true"
26810
+ },
26811
+ handleDOMEvents: {
26812
+ blur: () => {
26813
+ onBlur?.();
26814
+ return false;
26815
+ }
26816
+ }
26817
+ }));
26818
+ ctx.get(listenerCtx).markdownUpdated((_ctx, markdown) => {
26819
+ updateValue(markdown);
26820
+ });
26821
+ });
26822
+ editor = editor.use(commonmark);
26823
+ if (useGfm) {
26824
+ editor = editor.use(gfm);
26825
+ }
26826
+ editor = editor.use(listener);
26827
+ return editor;
26828
+ },
26829
+ [disabled, readOnly, editorClassName, onBlur, updateValue, useGfm]
26830
+ );
26831
+ return /* @__PURE__ */ jsx(Milkdown, {});
26832
+ }
26833
+ function MilkdownMarkdownEditor({
26834
+ value,
26835
+ defaultValue = "",
26836
+ onChange,
26837
+ onBlur,
26838
+ id,
26839
+ name,
26840
+ disabled = false,
26841
+ readOnly = false,
26842
+ minHeight = 360,
26843
+ maxHeight,
26844
+ className,
26845
+ editorClassName,
26846
+ useGfm = true
26847
+ }) {
26848
+ const isControlled = value !== void 0;
26849
+ const [internalValue, setInternalValue] = useState(defaultValue);
26850
+ const currentValue = isControlled ? value : internalValue;
26851
+ useEffect(() => {
26852
+ if (!isControlled) {
26853
+ setInternalValue(defaultValue);
26854
+ }
26855
+ }, [defaultValue, isControlled]);
26856
+ const updateValue = (nextValue) => {
26857
+ if (!isControlled) {
26858
+ setInternalValue(nextValue);
26859
+ }
26860
+ onChange?.(nextValue);
26861
+ };
26862
+ return /* @__PURE__ */ jsx(
26863
+ "div",
26864
+ {
26865
+ id,
26866
+ "data-name": name,
26867
+ className: classNames66(
26868
+ "eui-markdown-adapter",
26869
+ "eui-markdown-milkdown-adapter",
26870
+ disabled && "is-disabled",
26871
+ className
26872
+ ),
26873
+ style: {
26874
+ minHeight: toCssSize4(minHeight),
26875
+ maxHeight: toCssSize4(maxHeight)
26876
+ },
26877
+ children: /* @__PURE__ */ jsx(MilkdownProvider, { children: /* @__PURE__ */ jsx(
26878
+ MilkdownInnerEditor,
26879
+ {
26880
+ currentValue: currentValue ?? "",
26881
+ updateValue,
26882
+ onBlur,
26883
+ disabled,
26884
+ readOnly,
26885
+ editorClassName,
26886
+ useGfm
26887
+ }
26888
+ ) })
26889
+ }
26890
+ );
26891
+ }
26892
+ var MilkdownMarkdownEditor_default = MilkdownMarkdownEditor;
24522
26893
  function GenericLayout({
24523
26894
  children,
24524
26895
  styles,
@@ -24527,7 +26898,7 @@ function GenericLayout({
24527
26898
  return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme, children: /* @__PURE__ */ jsx(
24528
26899
  "div",
24529
26900
  {
24530
- className: classNames17({
26901
+ className: classNames66({
24531
26902
  [`${styles}`]: styles
24532
26903
  }),
24533
26904
  children
@@ -24576,7 +26947,7 @@ function SidemenuLayout({ data, children }) {
24576
26947
  return /* @__PURE__ */ jsx(DefaultLayout_default, { children: /* @__PURE__ */ jsxs(
24577
26948
  "div",
24578
26949
  {
24579
- className: classNames17({
26950
+ className: classNames66({
24580
26951
  grid: true,
24581
26952
  "grid-cols-7 gap-10": !isMobile,
24582
26953
  "grid-cols-1 gap-": isMobile
@@ -24635,6 +27006,6 @@ function ScrollToTop({
24635
27006
  }
24636
27007
  var ScrollToTop_default = ScrollToTop;
24637
27008
 
24638
- export { Accordion_default as Accordion, AreaPlot, AsyncComponentWrapper_default as AsyncComponentWrapper, Avatar, Backdrop_default as Backdrop, Badge, BarPlot, BaseChartDataSource, Block_default as Block, BlockGroup_default as BlockGroup, BoxNav_default as BoxNav, BoxNavItem_default as BoxNavItem, Brand_default as Brand, Breadcrumb, BreadcrumbItem_default as BreadcrumbItem, Button_default as Button, CHART_COLOR_PALETTE, CHART_DARK_THEME, CHART_DATA_MODES, CHART_DEFAULT_ACTIVE_DOT_RADIUS, CHART_DEFAULT_ANIMATION_DURATION, CHART_DEFAULT_BAR_RADIUS, CHART_DEFAULT_DOT_RADIUS, CHART_DEFAULT_HEIGHT, CHART_DEFAULT_MARGIN, CHART_DEFAULT_MAX_REALTIME_POINTS, CHART_DEFAULT_POLLING_INTERVAL, CHART_DEFAULT_STROKE_WIDTH, CHART_EMPTY_MESSAGE, CHART_ERROR_MESSAGE, CHART_LIGHT_THEME, CHART_LOADING_MESSAGE, CHART_STATUSES, CHART_STATUS_COLORS, CHART_VALUE_FORMATS, Caption, Card_default as Card, CardContent_default as CardContent, CardFooter_default as CardFooter, CardHeader_default as CardHeader, Chapter, Chart, ChartContainer, ChartContext, ChartEmptyState, ChartErrorState, ChartHeader, ChartLegend, ChartLoadingState, ChartPanel, ChartProvider, ChartToolbar, ChartTooltip, Checkbox_default as Checkbox, Chip, CloudinaryImage_default as CloudinaryImage, CloudinaryProvider, CloudinaryVideo_default as CloudinaryVideo, Code, CommentThread_default as CommentThread, ConfigBootstrap_default as ConfigBootstrap, Configurator, ConfiguratorError, Content, ContentArea_default as ContentArea, DEFAULT_CHART_THEME, DEFAULT_REVIEW_THREAD_CONFIG, DataView, DataViewTable_default as DataViewTable, DateSelector_default as DateSelector, DefaultLayout_default as DefaultLayout, Display, DocumentationPanel_default as DocumentationPanel, Drawer, DrawerToggler_default as DrawerToggler, EUIDevLayout_default as EUIDevLayout, EUIProvider, EnvErrorScreen_default as EnvErrorScreen, Flag, Flex, FlexCol_default as FlexCol, FlexRow_default as FlexRow, Footer, FooterNav_default as FooterNav, FooterNavGroup_default as FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse_default as FormResponse, GaugePlot, GenericLayout_default as GenericLayout, GlowWrapper_default as GlowWrapper, Graph, GraphEdge, GraphNode, GraphRenderer, Grid_default as Grid, Header, HeaderNav_default as HeaderNav, HeaderNavGroup_default as HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout_default as HomeLayout, Image2 as Image, ImageInput_default as ImageInput, InfiniteScrollTrigger_default as InfiniteScrollTrigger, Info_default as Info, Input, InputFile, InputLabel_default as InputLabel, InputList, InputListGroup, InputResponse_default as InputResponse, Label, Layout, Lead, LinePlot, Link, List_default as List, ListItem_default as ListItem, MarkdownEditor_default as MarkdownEditor, MarkdownProvider_default as MarkdownProvider, MarkdownTOC_default as MarkdownTOC, MarkdownViewer_default as MarkdownViewer, Menu, MenuGroup, MenuItem, MenuItemTitle, Modal_default as Modal, MotionSurface_default as MotionSurface, MultiImageInput_default as MultiImageInput, NumericRating_default as NumericRating, Overline, Paragraph, PiePlot, PollingChartDataSource, PriceTag, ProgressBar, ProgressBarRating_default as ProgressBarRating, Quote, Radio_default as Radio, RealtimeChartDataSource, ReviewThread_default as ReviewThread, RouteTab_default as RouteTab, RouteTabs_default as RouteTabs, ScatterPlot, ScrollToTop_default as ScrollToTop, Section, Select_default as Select, ShapeSwitch, ShowMore_default as ShowMore, Sidebar_default as Sidebar, SidebarLayout_default as SidebarLayout, SidemenuLayout_default as SidemenuLayout, Skeleton, Slider_default as Slider, Spinner_default as Spinner, StarRating_default as StarRating, StarRatingDistribution_default as StarRatingDistribution, StarRatingInput_default as StarRatingInput, StatPlot, StaticChartDataSource, Switch_default as Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table_default as Table, Tag_default as Tag, Tags_default as Tags, TextArea_default as TextArea, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, Toast, Tooltip6 as Tooltip, TopNav, Transition, TransitionAccordion_default as TransitionAccordion, TransitionBase_default as TransitionBase, TransitionDropdown_default as TransitionDropdown, TransitionFade_default as TransitionFade, TransitionFadeIn_default as TransitionFadeIn, TransitionScale_default as TransitionScale, TransitionSlide_default as TransitionSlide, Typography, UnderConstructionBanner, ValueBadge_default as ValueBadge, WorldMap, WorldMapCountryTable, YoutubeVideo_default as YoutubeVideoPlayer, addReplyToCache, addReviewReply, appendReview, applyReactionState, assertAbsoluteURL, buildURL, canDeleteReview, canDeleteReviewReply, canEditReview, canEditReviewReply, canReplyToReview, canReportReview, canReportReviewReply, chartReducer, cn, createConfigurator, createForceLayout, createGridLayout, createInitialChartState, createTreeLayout, createURLResolver, decrementReplyCount, enumValues, euiToast, findReview, formatChartValue, formatCommentDate, formatConfigError, formatReviewDate, getAllowedOrigins, getBrowserHref, getBrowserOrigin, getBrowserRedirectURL, getCurrencySymbol, getLayout, getOptimisticDislikeState, getOptimisticLikeState, getSafeRedirect, hasReviewReply, incrementReplyCount, isMatch, isRenderFn, limitRealtimePoints, normalize, normalizeChartData, normalizeChartDataPoint, normalizeReview, normalizeReviewAuthor, normalizeReviewReply, parseJson, parseJsonRecord, parseUrlMap, prependReview, registerLayout, removeComment, removeCommentTreeFromCache, removeReview, removeReviewReply, replaceRealtimePoints, replaceReview, replaceReviewReply, resolveAppearanceStyles, resolveChartColor, resolveChartColors, resolveWithGlobal, sendToast, toConfiguratorError, updateComment, updateReplyCacheComment, updateReview, updateReviewReply, upsertReview, useChartContext, useChartData, useChartPolling, useChartRealtime, useChartSeries, useChartTheme, useClickOutside, useCloudinaryConfig, useCurrentTheme_default as useCurrentTheme, useDrawer_default as useDrawer, useEUIConfig, useIsMobile_default as useIsMobile, useModal_default as useModal, useReviewThreadState, useTheme_default as useTheme };
27009
+ export { Accordion_default as Accordion, AreaPlot, AsyncComponentWrapper_default as AsyncComponentWrapper, Avatar, Backdrop_default as Backdrop, Badge, BarPlot, BaseChartDataSource, Block_default as Block, BlockGroup_default as BlockGroup, BoxNav_default as BoxNav, BoxNavItem_default as BoxNavItem, Brand_default as Brand, Breadcrumb, BreadcrumbItem_default as BreadcrumbItem, Button_default as Button, CHART_COLOR_PALETTE, CHART_DARK_THEME, CHART_DATA_MODES, CHART_DEFAULT_ACTIVE_DOT_RADIUS, CHART_DEFAULT_ANIMATION_DURATION, CHART_DEFAULT_BAR_RADIUS, CHART_DEFAULT_DOT_RADIUS, CHART_DEFAULT_HEIGHT, CHART_DEFAULT_MARGIN, CHART_DEFAULT_MAX_REALTIME_POINTS, CHART_DEFAULT_POLLING_INTERVAL, CHART_DEFAULT_STROKE_WIDTH, CHART_EMPTY_MESSAGE, CHART_ERROR_MESSAGE, CHART_LIGHT_THEME, CHART_LOADING_MESSAGE, CHART_STATUSES, CHART_STATUS_COLORS, CHART_VALUE_FORMATS, Caption, Card_default as Card, CardContent_default as CardContent, CardFooter_default as CardFooter, CardHeader_default as CardHeader, Chapter, Chart, ChartContainer, ChartContext, ChartEmptyState, ChartErrorState, ChartHeader, ChartLegend, ChartLoadingState, ChartPanel, ChartProvider, ChartToolbar, ChartTooltip, Checkbox_default as Checkbox, Chip, CloudinaryImage_default as CloudinaryImage, CloudinaryProvider, CloudinaryVideo_default as CloudinaryVideo, Code, CodeMirrorMarkdownEditor_default as CodeMirrorMarkdownEditor, CommentThread_default as CommentThread, ConfigBootstrap_default as ConfigBootstrap, Configurator, ConfiguratorError, Content, ContentArea_default as ContentArea, DEFAULT_CHART_THEME, DEFAULT_REVIEW_THREAD_CONFIG, DataView, DataViewTable_default as DataViewTable, DateSelector_default as DateSelector, DefaultLayout_default as DefaultLayout, Display, DocumentationPanel_default as DocumentationPanel, Drawer, DrawerToggler_default as DrawerToggler, EUIDevLayout_default as EUIDevLayout, EUIProvider, EnvErrorScreen_default as EnvErrorScreen, Flag, Flex, FlexCol_default as FlexCol, FlexRow_default as FlexRow, Footer, FooterNav_default as FooterNav, FooterNavGroup_default as FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse_default as FormResponse, GaugePlot, GenericLayout_default as GenericLayout, GlowWrapper_default as GlowWrapper, Graph, GraphEdge, GraphNode, GraphRenderer, Grid_default as Grid, Header, HeaderNav_default as HeaderNav, HeaderNavGroup_default as HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout_default as HomeLayout, Image2 as Image, ImageInput_default as ImageInput, InfiniteScrollTrigger_default as InfiniteScrollTrigger, Info_default as Info, Input, InputFile, InputLabel_default as InputLabel, InputList, InputListGroup, InputResponse_default as InputResponse, Label, Layout, Lead, LinePlot, Link, List_default as List, ListItem_default as ListItem, MDXMarkdownEditor_default as MDXMarkdownEditor, MarkdownBlockquote_default as MarkdownBlockquote, MarkdownCodeBlock_default as MarkdownCodeBlock, MarkdownContext, MarkdownDocsLayout_default as MarkdownDocsLayout, MarkdownEditor_default as MarkdownEditor, MarkdownField_default as MarkdownField, MarkdownHeading_default as MarkdownHeadingComponent, MarkdownImage_default as MarkdownImage, MarkdownInlineCode_default as MarkdownInlineCode, MarkdownLayout_default as MarkdownLayout, MarkdownLink_default as MarkdownLink, MarkdownPreviewPane_default as MarkdownPreviewPane, MarkdownProvider_default as MarkdownProvider, MarkdownRenderer_default as MarkdownRenderer, MarkdownSourceEditor_default as MarkdownSourceEditor, MarkdownSplitEditor_default as MarkdownSplitEditor, MarkdownTOC_default as MarkdownTOC, MarkdownTOCItem_default as MarkdownTOCItem, MarkdownTable_default as MarkdownTable, MarkdownTableCell, MarkdownTableHeaderCell, MarkdownToolbar_default as MarkdownToolbar, MarkdownViewer_default as MarkdownViewer, Menu, MenuGroup, MenuItem, MenuItemTitle, MilkdownMarkdownEditor_default as MilkdownMarkdownEditor, Modal_default as Modal, MotionSurface_default as MotionSurface, MultiImageInput_default as MultiImageInput, NumericRating_default as NumericRating, Overline, Paragraph, PiePlot, PollingChartDataSource, PriceTag, ProgressBar, ProgressBarRating_default as ProgressBarRating, Quote, Radio_default as Radio, RealtimeChartDataSource, ReviewThread_default as ReviewThread, RouteTab_default as RouteTab, RouteTabs_default as RouteTabs, ScatterPlot, ScrollToTop_default as ScrollToTop, Section, Select_default as Select, ShapeSwitch, ShowMore_default as ShowMore, Sidebar_default as Sidebar, SidebarLayout_default as SidebarLayout, SidemenuLayout_default as SidemenuLayout, Skeleton, Slider_default as Slider, Spinner_default as Spinner, StarRating_default as StarRating, StarRatingDistribution_default as StarRatingDistribution, StarRatingInput_default as StarRatingInput, StatPlot, StaticChartDataSource, Switch_default as Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table_default as Table, Tag_default as Tag, Tags_default as Tags, TextArea_default as TextArea, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, Toast, Tooltip6 as Tooltip, TopNav, Transition, TransitionAccordion_default as TransitionAccordion, TransitionBase_default as TransitionBase, TransitionDropdown_default as TransitionDropdown, TransitionFade_default as TransitionFade, TransitionFadeIn_default as TransitionFadeIn, TransitionScale_default as TransitionScale, TransitionSlide_default as TransitionSlide, Typography, UnderConstructionBanner, ValueBadge_default as ValueBadge, WorldMap, WorldMapCountryTable, YoutubeVideo_default as YoutubeVideoPlayer, addReplyToCache, addReviewReply, appendReview, applyReactionState, assertAbsoluteURL, buildURL, canDeleteReview, canDeleteReviewReply, canEditReview, canEditReviewReply, canReplyToReview, canReportReview, canReportReviewReply, chartReducer, cn, createConfigurator, createForceLayout, createGridLayout, createHeadingSlug, createInitialChartState, createTreeLayout, createURLResolver, decrementReplyCount, enumValues, euiToast, extractHeadings, findReview, formatChartValue, formatCommentDate, formatConfigError, formatReviewDate, generateHeadingNumbers, getAllowedOrigins, getBrowserHref, getBrowserOrigin, getBrowserRedirectURL, getCurrencySymbol, getLayout, getOptimisticDislikeState, getOptimisticLikeState, getSafeRedirect, hasReviewReply, incrementReplyCount, isMatch, isRenderFn, limitRealtimePoints, normalize, normalizeChartData, normalizeChartDataPoint, normalizeMarkdown, normalizeReview, normalizeReviewAuthor, normalizeReviewReply, parseJson, parseJsonRecord, parseUrlMap, prependReview, registerLayout, removeComment, removeCommentTreeFromCache, removeReview, removeReviewReply, replaceRealtimePoints, replaceReview, replaceReviewReply, resolveAppearanceStyles, resolveChartColor, resolveChartColors, resolveWithGlobal, sanitizeHeading, sendToast, slugify, toConfiguratorError, updateComment, updateReplyCacheComment, updateReview, updateReviewReply, upsertReview, useActiveHeading, useChartContext, useChartData, useChartPolling, useChartRealtime, useChartSeries, useChartTheme, useClickOutside, useCloudinaryConfig, useCurrentTheme_default as useCurrentTheme, useDrawer_default as useDrawer, useEUIConfig, useIsMobile_default as useIsMobile, useMarkdown, useMarkdownHeadings, useModal_default as useModal, useReviewThreadState, useTheme_default as useTheme };
24639
27010
  //# sourceMappingURL=index.mjs.map
24640
27011
  //# sourceMappingURL=index.mjs.map