@noirmd/previewer 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/NReditor.js CHANGED
@@ -1,46 +1,12 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
1
  // NReditor.tsx
31
- var NReditor_exports = {};
32
- __export(NReditor_exports, {
33
- default: () => NReditor_default
34
- });
35
- module.exports = __toCommonJS(NReditor_exports);
36
- var import_react11 = __toESM(require("react"));
37
- var import_react_codemirror = __toESM(require("@uiw/react-codemirror"));
38
- var import_view = require("@codemirror/view");
2
+ import React9, { useRef as useRef6, useState as useState5 } from "react";
3
+ import CodeMirror from "@uiw/react-codemirror";
4
+ import { EditorView, Decoration, ViewPlugin, lineNumbers, scrollPastEnd, keymap } from "@codemirror/view";
39
5
 
40
6
  // custom-syntax.ts
41
- var import_language = require("@codemirror/language");
42
- var import_highlight = require("@lezer/highlight");
43
- var customStreamParserV2 = import_language.StreamLanguage.define({
7
+ import { StreamLanguage } from "@codemirror/language";
8
+ import { tags as t } from "@lezer/highlight";
9
+ var customStreamParserV2 = StreamLanguage.define({
44
10
  startState: () => ({
45
11
  inCodeBlock: false,
46
12
  inDirectiveHeader: false,
@@ -308,39 +274,39 @@ var customStreamParserV2 = import_language.StreamLanguage.define({
308
274
  return null;
309
275
  },
310
276
  tokenTable: {
311
- heading: import_highlight.tags.heading,
312
- keyword: import_highlight.tags.keyword,
313
- typeName: import_highlight.tags.typeName,
314
- string: import_highlight.tags.string,
315
- attributeName: import_highlight.tags.attributeName,
316
- propertyName: import_highlight.tags.propertyName,
317
- className: import_highlight.tags.className,
318
- comment: import_highlight.tags.comment,
319
- variableName: import_highlight.tags.variableName,
320
- meta: import_highlight.tags.meta,
321
- strong: import_highlight.tags.strong,
322
- emphasis: import_highlight.tags.emphasis,
323
- strongEmphasis: [import_highlight.tags.strong, import_highlight.tags.emphasis],
324
- strikethrough: import_highlight.tags.strikethrough,
325
- underline: import_highlight.tags.special(import_highlight.tags.emphasis),
326
- highlight: import_highlight.tags.special(import_highlight.tags.comment),
327
- url: import_highlight.tags.url,
328
- link: import_highlight.tags.string,
329
- number: import_highlight.tags.number,
330
- function: import_highlight.tags.function(import_highlight.tags.variableName)
277
+ heading: t.heading,
278
+ keyword: t.keyword,
279
+ typeName: t.typeName,
280
+ string: t.string,
281
+ attributeName: t.attributeName,
282
+ propertyName: t.propertyName,
283
+ className: t.className,
284
+ comment: t.comment,
285
+ variableName: t.variableName,
286
+ meta: t.meta,
287
+ strong: t.strong,
288
+ emphasis: t.emphasis,
289
+ strongEmphasis: [t.strong, t.emphasis],
290
+ strikethrough: t.strikethrough,
291
+ underline: t.special(t.emphasis),
292
+ highlight: t.special(t.comment),
293
+ url: t.url,
294
+ link: t.string,
295
+ number: t.number,
296
+ function: t.function(t.variableName)
331
297
  }
332
298
  });
333
299
 
334
300
  // NReditor.tsx
335
- var import_state = require("@codemirror/state");
336
- var import_language2 = require("@codemirror/language");
337
- var import_highlight2 = require("@lezer/highlight");
301
+ import { RangeSetBuilder } from "@codemirror/state";
302
+ import { syntaxHighlighting, HighlightStyle, foldService, foldGutter, foldAll, unfoldAll } from "@codemirror/language";
303
+ import { tags as t2 } from "@lezer/highlight";
338
304
 
339
305
  // useDebounce.ts
340
- var import_react = require("react");
306
+ import { useState, useEffect } from "react";
341
307
  function useDebounce(value, delay) {
342
- const [debouncedValue, setDebouncedValue] = (0, import_react.useState)(value);
343
- (0, import_react.useEffect)(() => {
308
+ const [debouncedValue, setDebouncedValue] = useState(value);
309
+ useEffect(() => {
344
310
  const timer = setTimeout(() => setDebouncedValue(value), delay);
345
311
  return () => clearTimeout(timer);
346
312
  }, [value, delay]);
@@ -348,7 +314,7 @@ function useDebounce(value, delay) {
348
314
  }
349
315
 
350
316
  // CustomMarkdownRenderer.tsx
351
- var import_react10 = __toESM(require("react"));
317
+ import React8, { useState as useState4, useEffect as useEffect5, useCallback as useCallback2, useMemo, useId as useId3, useRef as useRef5 } from "react";
352
318
 
353
319
  // utils.ts
354
320
  function parseCssString(cssText) {
@@ -773,87 +739,87 @@ function splitSlots(rawContent) {
773
739
  }
774
740
 
775
741
  // ui-components.tsx
776
- var import_react2 = require("react");
742
+ import { useState as useState2, useRef } from "react";
777
743
 
778
744
  // highlightSetup.ts
779
- var import_core = __toESM(require("highlight.js/lib/core"));
780
- var import_javascript = __toESM(require("highlight.js/lib/languages/javascript"));
781
- var import_typescript = __toESM(require("highlight.js/lib/languages/typescript"));
782
- var import_python = __toESM(require("highlight.js/lib/languages/python"));
783
- var import_css = __toESM(require("highlight.js/lib/languages/css"));
784
- var import_xml = __toESM(require("highlight.js/lib/languages/xml"));
785
- var import_json = __toESM(require("highlight.js/lib/languages/json"));
786
- var import_bash = __toESM(require("highlight.js/lib/languages/bash"));
787
- var import_sql = __toESM(require("highlight.js/lib/languages/sql"));
788
- var import_markdown = __toESM(require("highlight.js/lib/languages/markdown"));
789
- var import_java = __toESM(require("highlight.js/lib/languages/java"));
790
- var import_csharp = __toESM(require("highlight.js/lib/languages/csharp"));
791
- var import_cpp = __toESM(require("highlight.js/lib/languages/cpp"));
792
- var import_go = __toESM(require("highlight.js/lib/languages/go"));
793
- var import_rust = __toESM(require("highlight.js/lib/languages/rust"));
794
- var import_php = __toESM(require("highlight.js/lib/languages/php"));
795
- var import_ruby = __toESM(require("highlight.js/lib/languages/ruby"));
796
- var import_swift = __toESM(require("highlight.js/lib/languages/swift"));
797
- var import_kotlin = __toESM(require("highlight.js/lib/languages/kotlin"));
798
- var import_dart = __toESM(require("highlight.js/lib/languages/dart"));
799
- var import_yaml = __toESM(require("highlight.js/lib/languages/yaml"));
800
- var import_ini = __toESM(require("highlight.js/lib/languages/ini"));
801
- var import_dockerfile = __toESM(require("highlight.js/lib/languages/dockerfile"));
802
- var import_diff = __toESM(require("highlight.js/lib/languages/diff"));
803
- var import_shell = __toESM(require("highlight.js/lib/languages/shell"));
804
- import_core.default.registerLanguage("javascript", import_javascript.default);
805
- import_core.default.registerLanguage("js", import_javascript.default);
806
- import_core.default.registerLanguage("jsx", import_javascript.default);
807
- import_core.default.registerLanguage("typescript", import_typescript.default);
808
- import_core.default.registerLanguage("ts", import_typescript.default);
809
- import_core.default.registerLanguage("tsx", import_typescript.default);
810
- import_core.default.registerLanguage("python", import_python.default);
811
- import_core.default.registerLanguage("py", import_python.default);
812
- import_core.default.registerLanguage("css", import_css.default);
813
- import_core.default.registerLanguage("html", import_xml.default);
814
- import_core.default.registerLanguage("xml", import_xml.default);
815
- import_core.default.registerLanguage("svg", import_xml.default);
816
- import_core.default.registerLanguage("json", import_json.default);
817
- import_core.default.registerLanguage("bash", import_bash.default);
818
- import_core.default.registerLanguage("sh", import_bash.default);
819
- import_core.default.registerLanguage("zsh", import_bash.default);
820
- import_core.default.registerLanguage("sql", import_sql.default);
821
- import_core.default.registerLanguage("markdown", import_markdown.default);
822
- import_core.default.registerLanguage("md", import_markdown.default);
823
- import_core.default.registerLanguage("java", import_java.default);
824
- import_core.default.registerLanguage("csharp", import_csharp.default);
825
- import_core.default.registerLanguage("cs", import_csharp.default);
826
- import_core.default.registerLanguage("cpp", import_cpp.default);
827
- import_core.default.registerLanguage("c", import_cpp.default);
828
- import_core.default.registerLanguage("go", import_go.default);
829
- import_core.default.registerLanguage("rust", import_rust.default);
830
- import_core.default.registerLanguage("rs", import_rust.default);
831
- import_core.default.registerLanguage("php", import_php.default);
832
- import_core.default.registerLanguage("ruby", import_ruby.default);
833
- import_core.default.registerLanguage("rb", import_ruby.default);
834
- import_core.default.registerLanguage("swift", import_swift.default);
835
- import_core.default.registerLanguage("kotlin", import_kotlin.default);
836
- import_core.default.registerLanguage("kt", import_kotlin.default);
837
- import_core.default.registerLanguage("dart", import_dart.default);
838
- import_core.default.registerLanguage("yaml", import_yaml.default);
839
- import_core.default.registerLanguage("yml", import_yaml.default);
840
- import_core.default.registerLanguage("toml", import_ini.default);
841
- import_core.default.registerLanguage("ini", import_ini.default);
842
- import_core.default.registerLanguage("dockerfile", import_dockerfile.default);
843
- import_core.default.registerLanguage("docker", import_dockerfile.default);
844
- import_core.default.registerLanguage("diff", import_diff.default);
845
- import_core.default.registerLanguage("shell", import_shell.default);
846
- var highlightSetup_default = import_core.default;
745
+ import hljs from "highlight.js/lib/core";
746
+ import javascript from "highlight.js/lib/languages/javascript";
747
+ import typescript from "highlight.js/lib/languages/typescript";
748
+ import python from "highlight.js/lib/languages/python";
749
+ import css from "highlight.js/lib/languages/css";
750
+ import xml from "highlight.js/lib/languages/xml";
751
+ import json from "highlight.js/lib/languages/json";
752
+ import bash from "highlight.js/lib/languages/bash";
753
+ import sql from "highlight.js/lib/languages/sql";
754
+ import markdown from "highlight.js/lib/languages/markdown";
755
+ import java from "highlight.js/lib/languages/java";
756
+ import csharp from "highlight.js/lib/languages/csharp";
757
+ import cpp from "highlight.js/lib/languages/cpp";
758
+ import go from "highlight.js/lib/languages/go";
759
+ import rust from "highlight.js/lib/languages/rust";
760
+ import php from "highlight.js/lib/languages/php";
761
+ import ruby from "highlight.js/lib/languages/ruby";
762
+ import swift from "highlight.js/lib/languages/swift";
763
+ import kotlin from "highlight.js/lib/languages/kotlin";
764
+ import dart from "highlight.js/lib/languages/dart";
765
+ import yaml from "highlight.js/lib/languages/yaml";
766
+ import toml from "highlight.js/lib/languages/ini";
767
+ import dockerfile from "highlight.js/lib/languages/dockerfile";
768
+ import diff from "highlight.js/lib/languages/diff";
769
+ import shell from "highlight.js/lib/languages/shell";
770
+ hljs.registerLanguage("javascript", javascript);
771
+ hljs.registerLanguage("js", javascript);
772
+ hljs.registerLanguage("jsx", javascript);
773
+ hljs.registerLanguage("typescript", typescript);
774
+ hljs.registerLanguage("ts", typescript);
775
+ hljs.registerLanguage("tsx", typescript);
776
+ hljs.registerLanguage("python", python);
777
+ hljs.registerLanguage("py", python);
778
+ hljs.registerLanguage("css", css);
779
+ hljs.registerLanguage("html", xml);
780
+ hljs.registerLanguage("xml", xml);
781
+ hljs.registerLanguage("svg", xml);
782
+ hljs.registerLanguage("json", json);
783
+ hljs.registerLanguage("bash", bash);
784
+ hljs.registerLanguage("sh", bash);
785
+ hljs.registerLanguage("zsh", bash);
786
+ hljs.registerLanguage("sql", sql);
787
+ hljs.registerLanguage("markdown", markdown);
788
+ hljs.registerLanguage("md", markdown);
789
+ hljs.registerLanguage("java", java);
790
+ hljs.registerLanguage("csharp", csharp);
791
+ hljs.registerLanguage("cs", csharp);
792
+ hljs.registerLanguage("cpp", cpp);
793
+ hljs.registerLanguage("c", cpp);
794
+ hljs.registerLanguage("go", go);
795
+ hljs.registerLanguage("rust", rust);
796
+ hljs.registerLanguage("rs", rust);
797
+ hljs.registerLanguage("php", php);
798
+ hljs.registerLanguage("ruby", ruby);
799
+ hljs.registerLanguage("rb", ruby);
800
+ hljs.registerLanguage("swift", swift);
801
+ hljs.registerLanguage("kotlin", kotlin);
802
+ hljs.registerLanguage("kt", kotlin);
803
+ hljs.registerLanguage("dart", dart);
804
+ hljs.registerLanguage("yaml", yaml);
805
+ hljs.registerLanguage("yml", yaml);
806
+ hljs.registerLanguage("toml", toml);
807
+ hljs.registerLanguage("ini", toml);
808
+ hljs.registerLanguage("dockerfile", dockerfile);
809
+ hljs.registerLanguage("docker", dockerfile);
810
+ hljs.registerLanguage("diff", diff);
811
+ hljs.registerLanguage("shell", shell);
812
+ var highlightSetup_default = hljs;
847
813
 
848
814
  // ui-components.tsx
849
- var import_dialog = require("@base-ui/react/dialog");
850
- var import_jsx_runtime = require("react/jsx-runtime");
815
+ import { Dialog } from "@base-ui/react/dialog";
816
+ import { jsx, jsxs } from "react/jsx-runtime";
851
817
  var IconRenderer = ({ iconName, extraClasses = "" }) => {
852
818
  if (!iconName) return null;
853
819
  const baseClass = `material-symbols-rounded !text-[1em] leading-none align-top ${extraClasses}`;
854
820
  const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(iconName);
855
821
  if (isCodepoint) {
856
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
822
+ return /* @__PURE__ */ jsx(
857
823
  "span",
858
824
  {
859
825
  className: baseClass,
@@ -862,11 +828,11 @@ var IconRenderer = ({ iconName, extraClasses = "" }) => {
862
828
  }
863
829
  );
864
830
  }
865
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: baseClass, "aria-hidden": "true", children: iconName });
831
+ return /* @__PURE__ */ jsx("span", { className: baseClass, "aria-hidden": "true", children: iconName });
866
832
  };
867
833
  var CodeBlock = ({ code, language, title }) => {
868
- const [copied, setCopied] = (0, import_react2.useState)(false);
869
- const timerRef = (0, import_react2.useRef)(null);
834
+ const [copied, setCopied] = useState2(false);
835
+ const timerRef = useRef(null);
870
836
  const lang = language?.split(/[\s{]/)[0]?.trim() || "";
871
837
  let html;
872
838
  try {
@@ -884,13 +850,13 @@ var CodeBlock = ({ code, language, title }) => {
884
850
  if (timerRef.current) clearTimeout(timerRef.current);
885
851
  timerRef.current = setTimeout(() => setCopied(false), 1800);
886
852
  };
887
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "not-prose my-4 rounded-2xl border border-border overflow-hidden bg-background-secondary-solid/5", children: [
888
- title && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 px-4 py-2 border-b border-border bg-background-secondary-solid/10 text-xs sm:text-sm font-mono text-text-secondary", children: [
889
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded text-base", children: "description" }),
853
+ return /* @__PURE__ */ jsxs("div", { className: "not-prose my-4 rounded-2xl border border-border overflow-hidden bg-background-secondary-solid/5", children: [
854
+ title && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4 py-2 border-b border-border bg-background-secondary-solid/10 text-xs sm:text-sm font-mono text-text-secondary", children: [
855
+ /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded text-base", children: "description" }),
890
856
  title
891
857
  ] }),
892
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "overflow-auto [&_pre]:m-0 [&_pre]:p-4 [&_pre]:text-xs sm:[&_pre]:text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "m-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { className: `language-${lang || "plaintext"}`, dangerouslySetInnerHTML: { __html: html } }) }) }),
893
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "absolute top-2 right-2 p-1.5 rounded-lg bg-background-secondary-solid/20 hover:bg-background-secondary-solid/40 transition-colors cursor-pointer border-none text-text-secondary hover:text-text-primary", onClick: handleCopy, title: "Copy code", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded", style: { fontSize: "1rem" }, children: copied ? "check" : "content_copy" }) })
858
+ /* @__PURE__ */ jsx("div", { className: "overflow-auto [&_pre]:m-0 [&_pre]:p-4 [&_pre]:text-xs sm:[&_pre]:text-sm", children: /* @__PURE__ */ jsx("pre", { className: "m-0", children: /* @__PURE__ */ jsx("code", { className: `language-${lang || "plaintext"}`, dangerouslySetInnerHTML: { __html: html } }) }) }),
859
+ /* @__PURE__ */ jsx("button", { className: "absolute top-2 right-2 p-1.5 rounded-lg bg-background-secondary-solid/20 hover:bg-background-secondary-solid/40 transition-colors cursor-pointer border-none text-text-secondary hover:text-text-primary", onClick: handleCopy, title: "Copy code", children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", style: { fontSize: "1rem" }, children: copied ? "check" : "content_copy" }) })
894
860
  ] });
895
861
  };
896
862
  var defaultIcons = {
@@ -909,17 +875,17 @@ var typeClasses = {
909
875
  };
910
876
  var Admonition = ({ type, title, icon, className = "", style, children }) => {
911
877
  const iconToRender = icon || defaultIcons[type] || "info";
912
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
878
+ return /* @__PURE__ */ jsxs(
913
879
  "div",
914
880
  {
915
881
  className: `not-prose rounded-2xl mb-6 border shadow-xs p-4 ${typeClasses[type] || typeClasses.note} ${className}`,
916
882
  style,
917
883
  children: [
918
- title && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h5", { className: "font-bold text-base mb-2 m-0 flex items-center gap-2", children: [
919
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconRenderer, { iconName: iconToRender, extraClasses: "shrink-0" }),
920
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
884
+ title && /* @__PURE__ */ jsxs("h5", { className: "font-bold text-base mb-2 m-0 flex items-center gap-2", children: [
885
+ /* @__PURE__ */ jsx(IconRenderer, { iconName: iconToRender, extraClasses: "shrink-0" }),
886
+ /* @__PURE__ */ jsx("span", { children: title })
921
887
  ] }),
922
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm leading-relaxed opacity-90", children })
888
+ /* @__PURE__ */ jsx("div", { className: "text-sm leading-relaxed opacity-90", children })
923
889
  ]
924
890
  }
925
891
  );
@@ -932,16 +898,16 @@ var Details = ({
932
898
  style,
933
899
  children
934
900
  }) => {
935
- const [isOpen, setIsOpen] = (0, import_react2.useState)(defaultOpen);
901
+ const [isOpen, setIsOpen] = useState2(defaultOpen);
936
902
  const iconToRender = icon || "play_arrow";
937
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
903
+ return /* @__PURE__ */ jsxs(
938
904
  "details",
939
905
  {
940
906
  className: `not-prose rounded-2xl border border-border mb-4 bg-background-primary/5 ${className}`,
941
907
  open: isOpen,
942
908
  style,
943
909
  children: [
944
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
910
+ /* @__PURE__ */ jsxs(
945
911
  "summary",
946
912
  {
947
913
  className: "cursor-pointer p-4 font-bold flex items-center gap-2 list-none [&::-webkit-details-marker]:hidden hover:text-accent-primary transition-colors",
@@ -950,45 +916,45 @@ var Details = ({
950
916
  setIsOpen((prev) => !prev);
951
917
  },
952
918
  children: [
953
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
919
+ /* @__PURE__ */ jsx(
954
920
  IconRenderer,
955
921
  {
956
922
  iconName: iconToRender,
957
923
  extraClasses: `transition-transform ${isOpen ? "rotate-90" : ""}`
958
924
  }
959
925
  ),
960
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
926
+ /* @__PURE__ */ jsx("span", { children: title })
961
927
  ]
962
928
  }
963
929
  ),
964
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-4 pb-4 border-t border-border pt-3 text-sm leading-relaxed opacity-90 overflow-hidden min-w-0", children })
930
+ isOpen && /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 border-t border-border pt-3 text-sm leading-relaxed opacity-90 overflow-hidden min-w-0", children })
965
931
  ]
966
932
  }
967
933
  );
968
934
  };
969
935
  var Modal = ({ title, isOpen, onClose, children }) => {
970
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: (open) => {
936
+ return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: (open) => {
971
937
  if (!open) onClose();
972
- }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Portal, { children: [
973
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Backdrop, { className: "fixed inset-0 z-[9999] bg-black/60" }),
974
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Viewport, { className: "fixed inset-0 z-[9999] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Popup, { className: "bg-background-primary border border-border shadow-2xl rounded-3xl w-full max-w-3xl max-h-[85vh] flex flex-col overflow-hidden", children: [
975
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between items-center p-4 border-b border-border bg-background-secondary-solid/20", children: [
976
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Title, { className: "text-lg font-bold !m-0", children: title }),
977
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Close, { className: "w-8 h-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors cursor-pointer border-none bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded text-base", children: "close" }) })
938
+ }, children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
939
+ /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "fixed inset-0 z-[9999] bg-black/60" }),
940
+ /* @__PURE__ */ jsx(Dialog.Viewport, { className: "fixed inset-0 z-[9999] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs(Dialog.Popup, { className: "bg-background-primary border border-border shadow-2xl rounded-3xl w-full max-w-3xl max-h-[85vh] flex flex-col overflow-hidden", children: [
941
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-4 border-b border-border bg-background-secondary-solid/20", children: [
942
+ /* @__PURE__ */ jsx(Dialog.Title, { className: "text-lg font-bold !m-0", children: title }),
943
+ /* @__PURE__ */ jsx(Dialog.Close, { className: "w-8 h-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors cursor-pointer border-none bg-transparent", children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded text-base", children: "close" }) })
978
944
  ] }),
979
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-6 overflow-auto min-h-0 text-text-primary [&_h1:first-child]:mt-0 [&_h2:first-child]:mt-0 [&_h3:first-child]:mt-0 [&_h4:first-child]:mt-0 [&_h5:first-child]:mt-0 [&_h6:first-child]:mt-0", children })
945
+ /* @__PURE__ */ jsx("div", { className: "p-6 overflow-auto min-h-0 text-text-primary [&_h1:first-child]:mt-0 [&_h2:first-child]:mt-0 [&_h3:first-child]:mt-0 [&_h4:first-child]:mt-0 [&_h5:first-child]:mt-0 [&_h6:first-child]:mt-0", children })
980
946
  ] }) })
981
947
  ] }) });
982
948
  };
983
949
 
984
950
  // renderers.tsx
985
- var import_jsx_runtime2 = require("react/jsx-runtime");
951
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
986
952
  function renderInline(text) {
987
953
  if (!text) return text;
988
954
  const parsePart = (part, key) => {
989
955
  let match2;
990
956
  if (match2 = part.match(/^\|\[([^\]]+)\]\|$/)) {
991
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconRenderer, { iconName: match2[1] }, key);
957
+ return /* @__PURE__ */ jsx2(IconRenderer, { iconName: match2[1] }, key);
992
958
  }
993
959
  if (match2 = part.match(/^!~(.+?)~!$/)) {
994
960
  const content = match2[1];
@@ -1007,7 +973,7 @@ function renderInline(text) {
1007
973
  type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
1008
974
  }
1009
975
  const innerText = parts.slice(textIndex).join(";");
1010
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
976
+ return /* @__PURE__ */ jsx2(
1011
977
  "span",
1012
978
  {
1013
979
  style: {
@@ -1020,31 +986,31 @@ function renderInline(text) {
1020
986
  );
1021
987
  }
1022
988
  if (match2 = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
1023
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: match2[1] }, children: renderInline(match2[2]) }, key);
989
+ return /* @__PURE__ */ jsx2("span", { style: { color: match2[1] }, children: renderInline(match2[2]) }, key);
1024
990
  }
1025
991
  if (match2 = part.match(/^!>([^<]+?)<!$/)) {
1026
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer", children: renderInline(match2[1]) }, key);
992
+ return /* @__PURE__ */ jsx2("span", { className: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer", children: renderInline(match2[1]) }, key);
1027
993
  }
1028
994
  if (match2 = part.match(/^==(.+?)==$/)) {
1029
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("mark", { className: "bg-yellow-500/20 text-inherit px-0.5 rounded", children: renderInline(match2[1]) }, key);
995
+ return /* @__PURE__ */ jsx2("mark", { className: "bg-yellow-500/20 text-inherit px-0.5 rounded", children: renderInline(match2[1]) }, key);
1030
996
  }
1031
997
  if (match2 = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
1032
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: renderInline(match2[1]) }) }, key);
998
+ return /* @__PURE__ */ jsx2("strong", { children: /* @__PURE__ */ jsx2("em", { children: renderInline(match2[1]) }) }, key);
1033
999
  }
1034
1000
  if (match2 = part.match(/^\*\*(.+?)\*\*$/)) {
1035
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: renderInline(match2[1]) }, key);
1001
+ return /* @__PURE__ */ jsx2("strong", { children: renderInline(match2[1]) }, key);
1036
1002
  }
1037
1003
  if (match2 = part.match(/^_(.+?)_$/)) {
1038
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: renderInline(match2[1]) }, key);
1004
+ return /* @__PURE__ */ jsx2("em", { children: renderInline(match2[1]) }, key);
1039
1005
  }
1040
1006
  if (match2 = part.match(/^~~(.+?)~~$/)) {
1041
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("del", { children: renderInline(match2[1]) }, key);
1007
+ return /* @__PURE__ */ jsx2("del", { children: renderInline(match2[1]) }, key);
1042
1008
  }
1043
1009
  if (match2 = part.match(/^`([^`]+)`$/)) {
1044
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { className: "text-[0.875em] font-mono bg-background-secondary/50 px-1.5 py-0.5 rounded text-text-primary", children: match2[1] }, key);
1010
+ return /* @__PURE__ */ jsx2("code", { className: "text-[0.875em] font-mono bg-background-secondary/50 px-1.5 py-0.5 rounded text-text-primary", children: match2[1] }, key);
1045
1011
  }
1046
1012
  if (match2 = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
1047
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1013
+ return /* @__PURE__ */ jsx2(
1048
1014
  "a",
1049
1015
  {
1050
1016
  href: match2[2],
@@ -1057,7 +1023,7 @@ function renderInline(text) {
1057
1023
  );
1058
1024
  }
1059
1025
  if (part.startsWith("<") && part.endsWith(">")) {
1060
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { dangerouslySetInnerHTML: { __html: part } }, key);
1026
+ return /* @__PURE__ */ jsx2("span", { dangerouslySetInnerHTML: { __html: part } }, key);
1061
1027
  }
1062
1028
  return part;
1063
1029
  };
@@ -1080,13 +1046,13 @@ function renderInline(text) {
1080
1046
  }
1081
1047
  function renderTable(content) {
1082
1048
  const rows = content.split("\n").filter((r) => r.trim());
1083
- if (rows.length < 2) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: content });
1049
+ if (rows.length < 2) return /* @__PURE__ */ jsx2("p", { children: content });
1084
1050
  const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
1085
1051
  const headerCells = parseRow(rows[0]);
1086
1052
  const bodyRows = rows.slice(2).map(parseRow);
1087
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "w-full text-sm sm:text-base border-collapse my-4", children: [
1088
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: headerCells.map((cell, ci) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "border border-border px-3 py-2 bg-background-secondary-solid/10 text-left font-bold", children: renderInline(cell) }, ci)) }) }),
1089
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: bodyRows.map((cells, ri) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: cells.map((cell, ci) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "border border-border px-3 py-2", children: renderInline(cell) }, ci)) }, ri)) })
1053
+ return /* @__PURE__ */ jsx2("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs2("table", { className: "w-full text-sm sm:text-base border-collapse my-4", children: [
1054
+ /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsx2("tr", { children: headerCells.map((cell, ci) => /* @__PURE__ */ jsx2("th", { className: "border border-border px-3 py-2 bg-background-secondary-solid/10 text-left font-bold", children: renderInline(cell) }, ci)) }) }),
1055
+ /* @__PURE__ */ jsx2("tbody", { children: bodyRows.map((cells, ri) => /* @__PURE__ */ jsx2("tr", { children: cells.map((cell, ci) => /* @__PURE__ */ jsx2("td", { className: "border border-border px-3 py-2", children: renderInline(cell) }, ci)) }, ri)) })
1090
1056
  ] }) });
1091
1057
  }
1092
1058
  function renderList(content) {
@@ -1103,23 +1069,23 @@ function renderList(content) {
1103
1069
  });
1104
1070
  }
1105
1071
  }
1106
- if (items.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: content });
1072
+ if (items.length === 0) return /* @__PURE__ */ jsx2("p", { children: content });
1107
1073
  const isOrdered = /^\d+\.$/.test(items[0].marker);
1108
1074
  const Tag = isOrdered ? "ol" : "ul";
1109
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Tag, { className: `${isOrdered ? "list-decimal" : "list-disc"} pl-6 my-3 space-y-1 text-sm sm:text-base`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { className: "leading-relaxed", children: renderInline(item.text) }, index)) });
1075
+ return /* @__PURE__ */ jsx2(Tag, { className: `${isOrdered ? "list-decimal" : "list-disc"} pl-6 my-3 space-y-1 text-sm sm:text-base`, children: items.map((item, index) => /* @__PURE__ */ jsx2("li", { className: "leading-relaxed", children: renderInline(item.text) }, index)) });
1110
1076
  }
1111
1077
  function extractHeaders(elements) {
1112
1078
  return elements.filter((el) => el.type === "header");
1113
1079
  }
1114
1080
 
1115
1081
  // directives/AdmonitionDirective.tsx
1116
- var import_jsx_runtime3 = require("react/jsx-runtime");
1082
+ import { jsx as jsx3 } from "react/jsx-runtime";
1117
1083
  var AdmonitionDirective = ({
1118
1084
  directiveType,
1119
1085
  props,
1120
1086
  renderSlot
1121
1087
  }) => {
1122
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1088
+ return /* @__PURE__ */ jsx3(
1123
1089
  Admonition,
1124
1090
  {
1125
1091
  type: directiveType,
@@ -1134,8 +1100,8 @@ var AdmonitionDirective = ({
1134
1100
  var AdmonitionDirective_default = AdmonitionDirective;
1135
1101
 
1136
1102
  // directives/CardDirective.tsx
1137
- var import_react3 = __toESM(require("react"));
1138
- var import_jsx_runtime4 = require("react/jsx-runtime");
1103
+ import React2, { useId } from "react";
1104
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1139
1105
  var CardDirective = ({
1140
1106
  directiveType,
1141
1107
  props,
@@ -1144,7 +1110,7 @@ var CardDirective = ({
1144
1110
  context,
1145
1111
  options = {}
1146
1112
  }) => {
1147
- const stableId = (0, import_react3.useId)();
1113
+ const stableId = useId();
1148
1114
  const { title, image, icon, class: customClass, url, target } = props;
1149
1115
  const hasDescription = !!slots.description;
1150
1116
  const { isSingleCard } = options;
@@ -1155,8 +1121,8 @@ var CardDirective = ({
1155
1121
  const inlineStyles = props.style ? parseCssString(props.style) : {};
1156
1122
  const description = hasDescription ? renderSlot("description") : null;
1157
1123
  const content = renderSlot("content") || renderSlot("default");
1158
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react3.default.Fragment, { children: [
1159
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1124
+ return /* @__PURE__ */ jsxs3(React2.Fragment, { children: [
1125
+ /* @__PURE__ */ jsxs3(
1160
1126
  "div",
1161
1127
  {
1162
1128
  className: `flex flex-col h-full rounded-3xl transition-all relative overflow-hidden group border min-w-[18rem] w-[18rem] max-w-[20rem] ${isModal || isLink ? "cursor-pointer !border-accent-primary/10 hover:border-accent-primary/50" : "border-border"} ${wrapperClass}`,
@@ -1172,20 +1138,20 @@ var CardDirective = ({
1172
1138
  if (e.key === "Enter" || e.key === " ") context.setModals((prev) => ({ ...prev, [modalId]: true }));
1173
1139
  } : void 0,
1174
1140
  children: [
1175
- image && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`, children: [
1176
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: image, alt: title || "", className: "w-full h-full object-cover !m-0" }),
1177
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
1141
+ image && /* @__PURE__ */ jsxs3("div", { className: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`, children: [
1142
+ /* @__PURE__ */ jsx4("img", { src: image, alt: title || "", className: "w-full h-full object-cover !m-0" }),
1143
+ /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
1178
1144
  ] }),
1179
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `flex flex-col flex-1 bg-background-primary/80 rounded-t-xl p-6 relative ${image ? "-mt-10" : ""} border-t border-white/5 shadow-2xl`, children: [
1180
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-3 mb-3", children: [
1181
- icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-10 h-10 text-[1.6em] rounded-xl bg-accent-primary/20 flex items-center justify-center shrink-0 text-accent-primary", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: icon }) }),
1182
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-base font-black tracking-tight leading-tight !m-0", children: title })
1145
+ /* @__PURE__ */ jsxs3("div", { className: `flex flex-col flex-1 bg-background-primary/80 rounded-t-xl p-6 relative ${image ? "-mt-10" : ""} border-t border-white/5 shadow-2xl`, children: [
1146
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3 mb-3", children: [
1147
+ icon && /* @__PURE__ */ jsx4("div", { className: "w-10 h-10 text-[1.6em] rounded-xl bg-accent-primary/20 flex items-center justify-center shrink-0 text-accent-primary", children: /* @__PURE__ */ jsx4(IconRenderer, { iconName: icon }) }),
1148
+ /* @__PURE__ */ jsx4("h3", { className: "text-base font-black tracking-tight leading-tight !m-0", children: title })
1183
1149
  ] }),
1184
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1 flex flex-col gap-2", children: [
1185
- description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-sm opacity-80 leading-relaxed font-medium", children: description }),
1186
- directiveType === "card" && content && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-2", children: content })
1150
+ /* @__PURE__ */ jsxs3("div", { className: "flex-1 flex flex-col gap-2", children: [
1151
+ description && /* @__PURE__ */ jsx4("div", { className: "text-sm opacity-80 leading-relaxed font-medium", children: description }),
1152
+ directiveType === "card" && content && /* @__PURE__ */ jsx4("div", { className: "mt-2", children: content })
1187
1153
  ] }),
1188
- (isModal || isLink) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-6 flex justify-end", children: isLink && url ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1154
+ (isModal || isLink) && /* @__PURE__ */ jsx4("div", { className: "mt-6 flex justify-end", children: isLink && url ? /* @__PURE__ */ jsxs3(
1189
1155
  "a",
1190
1156
  {
1191
1157
  href: url,
@@ -1194,25 +1160,25 @@ var CardDirective = ({
1194
1160
  className: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all no-underline",
1195
1161
  onClick: (e) => e.stopPropagation(),
1196
1162
  children: [
1197
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: "open_in_new" }),
1163
+ /* @__PURE__ */ jsx4(IconRenderer, { iconName: "open_in_new" }),
1198
1164
  " Link"
1199
1165
  ]
1200
1166
  }
1201
- ) : isModal ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 cursor-pointer rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all", children: [
1202
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: "arrow_forward" }),
1167
+ ) : isModal ? /* @__PURE__ */ jsxs3("div", { className: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 cursor-pointer rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all", children: [
1168
+ /* @__PURE__ */ jsx4(IconRenderer, { iconName: "arrow_forward" }),
1203
1169
  " Abrir"
1204
1170
  ] }) : null })
1205
1171
  ] })
1206
1172
  ]
1207
1173
  }
1208
1174
  ),
1209
- isModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1175
+ isModal && /* @__PURE__ */ jsx4(
1210
1176
  Modal,
1211
1177
  {
1212
1178
  title: title || "Detalles",
1213
1179
  isOpen: !!context.modals[modalId],
1214
1180
  onClose: () => context.setModals((prev) => ({ ...prev, [modalId]: false })),
1215
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "prose prose-sm max-w-none", children: content })
1181
+ children: /* @__PURE__ */ jsx4("div", { className: "prose prose-sm max-w-none", children: content })
1216
1182
  }
1217
1183
  )
1218
1184
  ] });
@@ -1220,12 +1186,12 @@ var CardDirective = ({
1220
1186
  var CardDirective_default = CardDirective;
1221
1187
 
1222
1188
  // directives/DetailsDirective.tsx
1223
- var import_jsx_runtime5 = require("react/jsx-runtime");
1189
+ import { jsx as jsx5 } from "react/jsx-runtime";
1224
1190
  var DetailsDirective = ({
1225
1191
  props,
1226
1192
  renderSlot
1227
1193
  }) => {
1228
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1194
+ return /* @__PURE__ */ jsx5(
1229
1195
  Details,
1230
1196
  {
1231
1197
  title: props.title || "Details",
@@ -1240,14 +1206,14 @@ var DetailsDirective = ({
1240
1206
  var DetailsDirective_default = DetailsDirective;
1241
1207
 
1242
1208
  // directives/ModalDirective.tsx
1243
- var import_react4 = require("react");
1244
- var import_jsx_runtime6 = require("react/jsx-runtime");
1209
+ import { useId as useId2 } from "react";
1210
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1245
1211
  var ModalDirective = ({
1246
1212
  props,
1247
1213
  renderSlot,
1248
1214
  context
1249
1215
  }) => {
1250
- const stableId = (0, import_react4.useId)();
1216
+ const stableId = useId2();
1251
1217
  const modalId = `modal-${props.id || stableId}`;
1252
1218
  const label = props.label || props.title || "Open";
1253
1219
  const modalTitle = props.title || "Modal";
@@ -1272,12 +1238,12 @@ var ModalDirective = ({
1272
1238
  const handleClose = () => {
1273
1239
  context.setModals((prev) => ({ ...prev, [modalId]: false }));
1274
1240
  };
1275
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: `not-prose ${wrapperClass}`.trim(), children: [
1276
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { className: btnClass, onClick: handleOpen, children: [
1277
- props.icon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconRenderer, { iconName: props.icon }),
1241
+ return /* @__PURE__ */ jsxs4("div", { className: `not-prose ${wrapperClass}`.trim(), children: [
1242
+ /* @__PURE__ */ jsxs4("button", { className: btnClass, onClick: handleOpen, children: [
1243
+ props.icon && /* @__PURE__ */ jsx6(IconRenderer, { iconName: props.icon }),
1278
1244
  label
1279
1245
  ] }),
1280
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1246
+ /* @__PURE__ */ jsx6(
1281
1247
  Modal,
1282
1248
  {
1283
1249
  title: modalTitle,
@@ -1291,8 +1257,8 @@ var ModalDirective = ({
1291
1257
  var ModalDirective_default = ModalDirective;
1292
1258
 
1293
1259
  // directives/ButtonDirective.tsx
1294
- var import_react5 = __toESM(require("react"));
1295
- var import_jsx_runtime7 = require("react/jsx-runtime");
1260
+ import React4 from "react";
1261
+ import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1296
1262
  var ButtonDirective = ({
1297
1263
  props,
1298
1264
  renderSlot
@@ -1317,7 +1283,7 @@ var ButtonDirective = ({
1317
1283
  };
1318
1284
  const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
1319
1285
  if (label) {
1320
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1286
+ return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ jsxs5(
1321
1287
  "a",
1322
1288
  {
1323
1289
  href: url,
@@ -1325,7 +1291,7 @@ var ButtonDirective = ({
1325
1291
  rel: "noopener noreferrer",
1326
1292
  className: btnClass,
1327
1293
  children: [
1328
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
1294
+ /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1329
1295
  label
1330
1296
  ]
1331
1297
  }
@@ -1334,21 +1300,21 @@ var ButtonDirective = ({
1334
1300
  const slotContent = renderSlot("default");
1335
1301
  const findLinks = (element) => {
1336
1302
  if (!element) return [];
1337
- if (import_react5.default.isValidElement(element) && element.type === "a") {
1303
+ if (React4.isValidElement(element) && element.type === "a") {
1338
1304
  return [element];
1339
1305
  }
1340
1306
  if (Array.isArray(element)) {
1341
1307
  return element.flatMap(findLinks);
1342
1308
  }
1343
- if (import_react5.default.isValidElement(element) && element.props.children) {
1309
+ if (React4.isValidElement(element) && element.props.children) {
1344
1310
  return findLinks(element.props.children);
1345
1311
  }
1346
1312
  return [];
1347
1313
  };
1348
1314
  const links = findLinks(slotContent);
1349
1315
  if (links.length > 0) {
1350
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `not-prose ${wrapperClass}`.trim(), children: links.map(
1351
- (link, index) => import_react5.default.cloneElement(
1316
+ return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: links.map(
1317
+ (link, index) => React4.cloneElement(
1352
1318
  link,
1353
1319
  {
1354
1320
  key: index,
@@ -1356,22 +1322,22 @@ var ButtonDirective = ({
1356
1322
  target,
1357
1323
  rel: "noopener noreferrer"
1358
1324
  },
1359
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1360
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
1325
+ /* @__PURE__ */ jsxs5(Fragment, { children: [
1326
+ /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1361
1327
  link.props.children
1362
1328
  ] })
1363
1329
  )
1364
1330
  ) });
1365
1331
  }
1366
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { href: url, target, rel: "noopener noreferrer", className: btnClass, children: [
1367
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
1332
+ return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ jsxs5("a", { href: url, target, rel: "noopener noreferrer", className: btnClass, children: [
1333
+ /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1368
1334
  slotContent
1369
1335
  ] }) });
1370
1336
  };
1371
1337
  var ButtonDirective_default = ButtonDirective;
1372
1338
 
1373
1339
  // directives/WrapperDirective.tsx
1374
- var import_jsx_runtime8 = require("react/jsx-runtime");
1340
+ import { jsx as jsx8 } from "react/jsx-runtime";
1375
1341
  var WrapperDirective = ({
1376
1342
  props,
1377
1343
  renderSlot
@@ -1388,13 +1354,13 @@ var WrapperDirective = ({
1388
1354
  wrapperProps[key] = value;
1389
1355
  }
1390
1356
  }
1391
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...wrapperProps, children: renderSlot("default") });
1357
+ return /* @__PURE__ */ jsx8("div", { ...wrapperProps, children: renderSlot("default") });
1392
1358
  };
1393
1359
  var WrapperDirective_default = WrapperDirective;
1394
1360
 
1395
1361
  // directives/SlideDirective.tsx
1396
- var import_react6 = require("react");
1397
- var import_jsx_runtime9 = require("react/jsx-runtime");
1362
+ import { useState as useState3, useEffect as useEffect2, useCallback, useRef as useRef2, useLayoutEffect } from "react";
1363
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1398
1364
  var slideCounter = 0;
1399
1365
  var SlideDirective = ({
1400
1366
  props,
@@ -1404,23 +1370,23 @@ var SlideDirective = ({
1404
1370
  const rawContent = slots.default || "";
1405
1371
  const lines = rawContent.split("\n").map((l) => l.trim()).filter(Boolean);
1406
1372
  const elements = lines.map((line) => context.parseMarkdown(line));
1407
- const [current, setCurrent] = (0, import_react6.useState)(0);
1373
+ const [current, setCurrent] = useState3(0);
1408
1374
  const interval = parseInt(props.interval || "3000", 10);
1409
1375
  const speed = parseInt(props.speed || "500", 10);
1410
- const elRefs = (0, import_react6.useRef)([]);
1411
- const [maxH, setMaxH] = (0, import_react6.useState)(0);
1412
- (0, import_react6.useLayoutEffect)(() => {
1376
+ const elRefs = useRef2([]);
1377
+ const [maxH, setMaxH] = useState3(0);
1378
+ useLayoutEffect(() => {
1413
1379
  let h = 0;
1414
1380
  elRefs.current.forEach((el) => {
1415
1381
  if (el) h = Math.max(h, el.offsetHeight);
1416
1382
  });
1417
1383
  if (h > 0) setMaxH(h);
1418
1384
  }, [elements]);
1419
- const cycle = (0, import_react6.useCallback)(() => {
1385
+ const cycle = useCallback(() => {
1420
1386
  if (elements.length <= 1) return;
1421
1387
  setCurrent((prev) => (prev + 1) % elements.length);
1422
1388
  }, [elements.length]);
1423
- (0, import_react6.useEffect)(() => {
1389
+ useEffect2(() => {
1424
1390
  if (elements.length <= 1) return;
1425
1391
  const id = setInterval(cycle, interval);
1426
1392
  return () => clearInterval(id);
@@ -1447,14 +1413,14 @@ var SlideDirective = ({
1447
1413
  const forcedFontSize = textSizeMatch ? textSizeMap[textSizeMatch[0]] : null;
1448
1414
  const scopeClass = `sld-${++slideCounter}`;
1449
1415
  const className = textSizeMatch ? rawClass.replace(textSizeMatch[0], "").replace(/\s+/g, " ").trim() : rawClass;
1450
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1416
+ return /* @__PURE__ */ jsxs6(
1451
1417
  "div",
1452
1418
  {
1453
1419
  className: "not-prose",
1454
1420
  style: { height: maxH || "auto", position: "relative", overflow: "hidden", ...inlineStyle },
1455
1421
  children: [
1456
- forcedFontSize && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("style", { children: `.${scopeClass} * { font-size: ${forcedFontSize} !important; line-height: normal !important; }` }),
1457
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1422
+ forcedFontSize && /* @__PURE__ */ jsx9("style", { children: `.${scopeClass} * { font-size: ${forcedFontSize} !important; line-height: normal !important; }` }),
1423
+ /* @__PURE__ */ jsx9(
1458
1424
  "div",
1459
1425
  {
1460
1426
  style: {
@@ -1465,14 +1431,14 @@ var SlideDirective = ({
1465
1431
  transition: `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`,
1466
1432
  transform: `translateY(${-current * maxH}px)`
1467
1433
  },
1468
- children: elements.map((tokens, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1434
+ children: elements.map((tokens, i) => /* @__PURE__ */ jsx9(
1469
1435
  "div",
1470
1436
  {
1471
1437
  ref: (el) => {
1472
1438
  elRefs.current[i] = el;
1473
1439
  },
1474
1440
  style: maxH ? { height: maxH, display: "flex", alignItems: "center", overflow: "hidden" } : { display: "flex", alignItems: "center" },
1475
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${scopeClass} ${className}`, style: { width: "100%" }, children: context.processAndRenderElements(tokens) })
1441
+ children: /* @__PURE__ */ jsx9("div", { className: `${scopeClass} ${className}`, style: { width: "100%" }, children: context.processAndRenderElements(tokens) })
1476
1442
  },
1477
1443
  i
1478
1444
  ))
@@ -1511,7 +1477,7 @@ var directiveRegistry = {
1511
1477
  var directives_default = directiveRegistry;
1512
1478
 
1513
1479
  // DirectiveRenderer.tsx
1514
- var import_jsx_runtime10 = require("react/jsx-runtime");
1480
+ import { jsx as jsx10 } from "react/jsx-runtime";
1515
1481
  var DirectiveRenderer = ({
1516
1482
  element,
1517
1483
  context,
@@ -1536,31 +1502,31 @@ var DirectiveRenderer = ({
1536
1502
  allElements
1537
1503
  };
1538
1504
  if (Component) {
1539
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { ...directiveProps }, index);
1505
+ return /* @__PURE__ */ jsx10(Component, { ...directiveProps }, index);
1540
1506
  }
1541
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `my-4 p-4 rounded-2xl border border-border bg-background-primary/5`, children: renderSlot("default") }, index);
1507
+ return /* @__PURE__ */ jsx10("div", { className: `my-4 p-4 rounded-2xl border border-border bg-background-primary/5`, children: renderSlot("default") }, index);
1542
1508
  };
1543
1509
  var DirectiveRenderer_default = DirectiveRenderer;
1544
1510
 
1545
1511
  // RawHtmlRenderer.tsx
1546
- var import_react8 = require("react");
1512
+ import { useRef as useRef4, useEffect as useEffect4 } from "react";
1547
1513
 
1548
1514
  // useTailwindCDN.ts
1549
- var import_react7 = require("react");
1515
+ import { useEffect as useEffect3, useRef as useRef3 } from "react";
1550
1516
  function scanTailwindCDN() {
1551
1517
  const tw = window.tailwind;
1552
1518
  if (tw?.scan) tw.scan();
1553
1519
  }
1554
1520
 
1555
1521
  // RawHtmlRenderer.tsx
1556
- var import_jsx_runtime11 = require("react/jsx-runtime");
1522
+ import { jsx as jsx11 } from "react/jsx-runtime";
1557
1523
  var RawHtmlRenderer = ({
1558
1524
  content,
1559
1525
  globalStyles,
1560
1526
  wrapperClassName
1561
1527
  }) => {
1562
- const containerRef = (0, import_react8.useRef)(null);
1563
- (0, import_react8.useEffect)(() => {
1528
+ const containerRef = useRef4(null);
1529
+ useEffect4(() => {
1564
1530
  if (!containerRef.current) return;
1565
1531
  const scripts = containerRef.current.querySelectorAll("script");
1566
1532
  scripts.forEach((oldScript) => {
@@ -1573,7 +1539,7 @@ var RawHtmlRenderer = ({
1573
1539
  });
1574
1540
  scanTailwindCDN();
1575
1541
  }, [content]);
1576
- (0, import_react8.useEffect)(() => {
1542
+ useEffect4(() => {
1577
1543
  if (!globalStyles) return;
1578
1544
  const styleEl = document.createElement("style");
1579
1545
  styleEl.setAttribute("data-global", "");
@@ -1583,25 +1549,25 @@ var RawHtmlRenderer = ({
1583
1549
  if (styleEl.parentNode) document.head.removeChild(styleEl);
1584
1550
  };
1585
1551
  }, [globalStyles]);
1586
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: wrapperClassName, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { dangerouslySetInnerHTML: { __html: content } }) });
1552
+ return /* @__PURE__ */ jsx11("div", { className: wrapperClassName, ref: containerRef, children: /* @__PURE__ */ jsx11("div", { dangerouslySetInnerHTML: { __html: content } }) });
1587
1553
  };
1588
1554
  var RawHtmlRenderer_default = RawHtmlRenderer;
1589
1555
 
1590
1556
  // context.tsx
1591
- var import_react9 = require("react");
1592
- var RenderCtx = (0, import_react9.createContext)(null);
1557
+ import { createContext, useContext } from "react";
1558
+ var RenderCtx = createContext(null);
1593
1559
  var RenderContextProvider = RenderCtx.Provider;
1594
1560
 
1595
1561
  // CustomMarkdownRenderer.tsx
1596
- var import_jsx_runtime12 = require("react/jsx-runtime");
1562
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1597
1563
  var CustomMarkdownRenderer = ({ content: initialContent }) => {
1598
- const [modals, setModals] = (0, import_react10.useState)({});
1599
- const baseId = (0, import_react10.useId)().replace(/:/g, "");
1564
+ const [modals, setModals] = useState4({});
1565
+ const baseId = useId3().replace(/:/g, "");
1600
1566
  const articleClass = `scope-${baseId}`;
1601
- const contextRef = (0, import_react10.useRef)(null);
1567
+ const contextRef = useRef5(null);
1602
1568
  resetScopeCounter();
1603
- const allElements = (0, import_react10.useMemo)(() => parseMarkdown(initialContent), [initialContent]);
1604
- (0, import_react10.useEffect)(() => {
1569
+ const allElements = useMemo(() => parseMarkdown(initialContent), [initialContent]);
1570
+ useEffect5(() => {
1605
1571
  const handleHashChange = () => {
1606
1572
  const hash = window.location.hash;
1607
1573
  if (hash) {
@@ -1614,7 +1580,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1614
1580
  window.addEventListener("hashchange", handleHashChange);
1615
1581
  return () => window.removeEventListener("hashchange", handleHashChange);
1616
1582
  }, [initialContent]);
1617
- const renderElement = (0, import_react10.useCallback)(
1583
+ const renderElement = useCallback2(
1618
1584
  (element, index, _depth = 0) => {
1619
1585
  switch (element.type) {
1620
1586
  case "header": {
@@ -1632,7 +1598,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1632
1598
  if (alignCenter) headerClasses += " text-center";
1633
1599
  if (alignRight) headerClasses += " text-right";
1634
1600
  if (userClasses) headerClasses += ` ${userClasses}`;
1635
- return import_react10.default.createElement(
1601
+ return React8.createElement(
1636
1602
  HeaderTag,
1637
1603
  { key: index, id: element.id, className: headerClasses },
1638
1604
  renderInline(text)
@@ -1643,13 +1609,13 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1643
1609
  const processedContent = lines.map((line, lineIndex) => {
1644
1610
  const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
1645
1611
  if (hardBreakMatch) {
1646
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react10.default.Fragment, { children: [
1612
+ return /* @__PURE__ */ jsxs7(React8.Fragment, { children: [
1647
1613
  renderInline(hardBreakMatch[1]),
1648
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("br", {})
1614
+ /* @__PURE__ */ jsx12("br", {})
1649
1615
  ] }, lineIndex);
1650
1616
  }
1651
1617
  const isLastLine = lineIndex === lines.length - 1;
1652
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react10.default.Fragment, { children: [
1618
+ return /* @__PURE__ */ jsxs7(React8.Fragment, { children: [
1653
1619
  renderInline(line),
1654
1620
  !isLastLine && " "
1655
1621
  ] }, lineIndex);
@@ -1658,10 +1624,10 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1658
1624
  let pClasses = "md-p";
1659
1625
  if (pUserClasses) pClasses += ` ${pUserClasses}`;
1660
1626
  if (element.align) pClasses += ` text-${element.align}`;
1661
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { id: element.id, className: pClasses, children: processedContent }, index);
1627
+ return /* @__PURE__ */ jsx12("p", { id: element.id, className: pClasses, children: processedContent }, index);
1662
1628
  }
1663
1629
  case "codeblock":
1664
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1630
+ return /* @__PURE__ */ jsx12(
1665
1631
  CodeBlock,
1666
1632
  {
1667
1633
  code: element.content,
@@ -1671,7 +1637,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1671
1637
  index
1672
1638
  );
1673
1639
  case "directive":
1674
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1640
+ return /* @__PURE__ */ jsx12(
1675
1641
  DirectiveRenderer_default,
1676
1642
  {
1677
1643
  element,
@@ -1692,7 +1658,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1692
1658
  }
1693
1659
  );
1694
1660
  const wrapperClassName = "w-full my-4";
1695
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1661
+ return /* @__PURE__ */ jsx12(
1696
1662
  RawHtmlRenderer_default,
1697
1663
  {
1698
1664
  content: processedContent,
@@ -1705,14 +1671,14 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1705
1671
  case "html-block": {
1706
1672
  const htmlBlock = element;
1707
1673
  const props = parseHtmlAttrs(htmlBlock.attrs);
1708
- return import_react10.default.createElement(
1674
+ return React8.createElement(
1709
1675
  htmlBlock.tag,
1710
1676
  { key: index, ...props },
1711
1677
  ...processAndRenderElements(htmlBlock.children, _depth + 1)
1712
1678
  );
1713
1679
  }
1714
1680
  case "image":
1715
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1681
+ return /* @__PURE__ */ jsx12(
1716
1682
  "img",
1717
1683
  {
1718
1684
  alt: element.alt,
@@ -1723,22 +1689,22 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1723
1689
  index
1724
1690
  );
1725
1691
  case "table":
1726
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: renderTable(element.content) }, index);
1692
+ return /* @__PURE__ */ jsx12("div", { children: renderTable(element.content) }, index);
1727
1693
  case "list":
1728
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: renderList(element.content) }, index);
1694
+ return /* @__PURE__ */ jsx12("div", { children: renderList(element.content) }, index);
1729
1695
  case "blockquote":
1730
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", { className: `border-l-4 border-accent-primary/30 pl-4 italic text-text-secondary my-4 text-sm sm:text-base${element.classes ? ` ${element.classes}` : ""}`, children: renderInline(element.content) }, index);
1696
+ return /* @__PURE__ */ jsx12("blockquote", { className: `border-l-4 border-accent-primary/30 pl-4 italic text-text-secondary my-4 text-sm sm:text-base${element.classes ? ` ${element.classes}` : ""}`, children: renderInline(element.content) }, index);
1731
1697
  case "hr":
1732
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "my-8 border-border" }, index);
1698
+ return /* @__PURE__ */ jsx12("hr", { className: "my-8 border-border" }, index);
1733
1699
  case "toc":
1734
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: generateToc(allElements) }, index);
1700
+ return /* @__PURE__ */ jsx12("div", { children: generateToc(allElements) }, index);
1735
1701
  default:
1736
1702
  return null;
1737
1703
  }
1738
1704
  },
1739
1705
  [allElements]
1740
1706
  );
1741
- const processAndRenderElements = (0, import_react10.useCallback)(
1707
+ const processAndRenderElements = useCallback2(
1742
1708
  (elements, depth = 0) => {
1743
1709
  const result = [];
1744
1710
  let i = 0;
@@ -1759,7 +1725,7 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1759
1725
  const justifyClasses = firstCardClass.match(/\bjustify-\S+/g) || [];
1760
1726
  const wrapperJustify = justifyClasses.length > 0 ? justifyClasses.join(" ") : "";
1761
1727
  result.push(
1762
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`, children: cards.map((card, ci) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react10.default.Fragment, { children: renderElement(card, ci, depth) }, ci)) }, `card-grid-${result.length}`)
1728
+ /* @__PURE__ */ jsx12("div", { className: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`, children: cards.map((card, ci) => /* @__PURE__ */ jsx12(React8.Fragment, { children: renderElement(card, ci, depth) }, ci)) }, `card-grid-${result.length}`)
1763
1729
  );
1764
1730
  }
1765
1731
  } else {
@@ -1774,12 +1740,12 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1774
1740
  const generateToc = (elements) => {
1775
1741
  const headers = extractHeaders(elements);
1776
1742
  if (headers.length === 0) return null;
1777
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("nav", { className: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5", children: [
1778
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-base font-bold mb-3", children: "Table of Contents" }),
1779
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "space-y-1 list-none p-0 m-0", children: headers.map((h, i) => {
1743
+ return /* @__PURE__ */ jsxs7("nav", { className: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5", children: [
1744
+ /* @__PURE__ */ jsx12("div", { className: "text-base font-bold mb-3", children: "Table of Contents" }),
1745
+ /* @__PURE__ */ jsx12("ul", { className: "space-y-1 list-none p-0 m-0", children: headers.map((h, i) => {
1780
1746
  if (h.type !== "header") return null;
1781
1747
  const indentClass = h.level <= 2 ? "pl-0" : h.level === 3 ? "pl-4" : h.level === 4 ? "pl-8" : "pl-12";
1782
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { className: `${indentClass} text-sm sm:text-base`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1748
+ return /* @__PURE__ */ jsx12("li", { className: `${indentClass} text-sm sm:text-base`, children: /* @__PURE__ */ jsx12(
1783
1749
  "a",
1784
1750
  {
1785
1751
  href: `#${h.id}`,
@@ -1805,33 +1771,33 @@ var CustomMarkdownRenderer = ({ content: initialContent }) => {
1805
1771
  processAndRenderElements
1806
1772
  };
1807
1773
  contextRef.current = contextForDirectives;
1808
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RenderContextProvider, { value: contextForDirectives, children: processAndRenderElements(allElements) });
1774
+ return /* @__PURE__ */ jsx12(RenderContextProvider, { value: contextForDirectives, children: processAndRenderElements(allElements) });
1809
1775
  };
1810
1776
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
1811
1777
 
1812
1778
  // NReditor.tsx
1813
- var import_jsx_runtime13 = require("react/jsx-runtime");
1814
- var customSyntaxHighlighting = import_language2.HighlightStyle.define([
1815
- { tag: import_highlight2.tags.heading, fontWeight: "bold", color: "var(--tc-heading, #e2e8f0)" },
1816
- { tag: import_highlight2.tags.quote, color: "var(--tc-quote, #94a3b8)", fontStyle: "italic" },
1817
- { tag: import_highlight2.tags.meta, color: "var(--tc-meta, #64748b)" },
1818
- { tag: import_highlight2.tags.variableName, color: "var(--tc-variable, #38bdf8)" },
1819
- { tag: import_highlight2.tags.strong, fontWeight: "bold" },
1820
- { tag: import_highlight2.tags.emphasis, fontStyle: "italic" },
1821
- { tag: import_highlight2.tags.strikethrough, textDecoration: "line-through" },
1822
- { tag: import_highlight2.tags.link, color: "var(--tc-link, #38bdf8)" },
1823
- { tag: import_highlight2.tags.url, color: "var(--tc-link, #38bdf8)" },
1824
- { tag: import_highlight2.tags.comment, color: "var(--tc-comment, #64748b)" },
1825
- { tag: import_highlight2.tags.keyword, color: "var(--tc-heading, #e2e8f0)", fontWeight: "bold" },
1826
- { tag: import_highlight2.tags.typeName, color: "var(--tc-type, #a78bfa)" },
1827
- { tag: import_highlight2.tags.string, color: "var(--tc-string, #4ade80)" },
1828
- { tag: import_highlight2.tags.attributeName, color: "var(--tc-attribute, #fb923c)" },
1829
- { tag: import_highlight2.tags.propertyName, color: "#0ea5e9" },
1830
- { tag: import_highlight2.tags.className, color: "#f59e0b", fontStyle: "italic" },
1831
- { tag: import_highlight2.tags.special(import_highlight2.tags.emphasis), textDecoration: "underline" },
1832
- { tag: import_highlight2.tags.special(import_highlight2.tags.comment), backgroundColor: "var(--tc-highlight-bg, rgba(255,255,255,0.05))", padding: "0 2px", borderRadius: "2px" }
1779
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1780
+ var customSyntaxHighlighting = HighlightStyle.define([
1781
+ { tag: t2.heading, fontWeight: "bold", color: "var(--tc-heading, #e2e8f0)" },
1782
+ { tag: t2.quote, color: "var(--tc-quote, #94a3b8)", fontStyle: "italic" },
1783
+ { tag: t2.meta, color: "var(--tc-meta, #64748b)" },
1784
+ { tag: t2.variableName, color: "var(--tc-variable, #38bdf8)" },
1785
+ { tag: t2.strong, fontWeight: "bold" },
1786
+ { tag: t2.emphasis, fontStyle: "italic" },
1787
+ { tag: t2.strikethrough, textDecoration: "line-through" },
1788
+ { tag: t2.link, color: "var(--tc-link, #38bdf8)" },
1789
+ { tag: t2.url, color: "var(--tc-link, #38bdf8)" },
1790
+ { tag: t2.comment, color: "var(--tc-comment, #64748b)" },
1791
+ { tag: t2.keyword, color: "var(--tc-heading, #e2e8f0)", fontWeight: "bold" },
1792
+ { tag: t2.typeName, color: "var(--tc-type, #a78bfa)" },
1793
+ { tag: t2.string, color: "var(--tc-string, #4ade80)" },
1794
+ { tag: t2.attributeName, color: "var(--tc-attribute, #fb923c)" },
1795
+ { tag: t2.propertyName, color: "#0ea5e9" },
1796
+ { tag: t2.className, color: "#f59e0b", fontStyle: "italic" },
1797
+ { tag: t2.special(t2.emphasis), textDecoration: "underline" },
1798
+ { tag: t2.special(t2.comment), backgroundColor: "var(--tc-highlight-bg, rgba(255,255,255,0.05))", padding: "0 2px", borderRadius: "2px" }
1833
1799
  ]);
1834
- var customEditorTheme = import_view.EditorView.theme({
1800
+ var customEditorTheme = EditorView.theme({
1835
1801
  "&": {
1836
1802
  color: "var(--color-text-primary, #e2e8f0)",
1837
1803
  backgroundColor: "transparent !important",
@@ -2022,7 +1988,7 @@ var customEditorTheme = import_view.EditorView.theme({
2022
1988
  accentColor: "var(--color-accent-primary, #38bdf8)"
2023
1989
  }
2024
1990
  });
2025
- var customFoldService = import_language2.foldService.of((state, lineStart) => {
1991
+ var customFoldService = foldService.of((state, lineStart) => {
2026
1992
  const line = state.doc.lineAt(lineStart);
2027
1993
  const trimmed = line.text.trim();
2028
1994
  const dirMatch = trimmed.match(/^:::(.+)/);
@@ -2085,7 +2051,7 @@ var customFoldService = import_language2.foldService.of((state, lineStart) => {
2085
2051
  }
2086
2052
  return null;
2087
2053
  });
2088
- var directivePlugin = import_view.ViewPlugin.fromClass(
2054
+ var directivePlugin = ViewPlugin.fromClass(
2089
2055
  class {
2090
2056
  constructor(view) {
2091
2057
  this.decorations = this.getDecorations(view);
@@ -2096,7 +2062,7 @@ var directivePlugin = import_view.ViewPlugin.fromClass(
2096
2062
  }
2097
2063
  }
2098
2064
  getDecorations(view) {
2099
- const builder = new import_state.RangeSetBuilder();
2065
+ const builder = new RangeSetBuilder();
2100
2066
  const doc = view.state.doc;
2101
2067
  const visibleRanges = view.visibleRanges;
2102
2068
  if (visibleRanges.length === 0) return builder.finish();
@@ -2140,7 +2106,7 @@ var directivePlugin = import_view.ViewPlugin.fromClass(
2140
2106
  builder.add(
2141
2107
  line.from,
2142
2108
  line.from,
2143
- import_view.Decoration.line({ class: lineClasses.join(" ") })
2109
+ Decoration.line({ class: lineClasses.join(" ") })
2144
2110
  );
2145
2111
  }
2146
2112
  if (isClosingLine) {
@@ -2152,7 +2118,7 @@ var directivePlugin = import_view.ViewPlugin.fromClass(
2152
2118
  },
2153
2119
  { decorations: (v) => v.decorations }
2154
2120
  );
2155
- var blockquotePlugin = import_view.ViewPlugin.fromClass(
2121
+ var blockquotePlugin = ViewPlugin.fromClass(
2156
2122
  class {
2157
2123
  constructor(view) {
2158
2124
  this.decorations = this.getDecorations(view);
@@ -2163,7 +2129,7 @@ var blockquotePlugin = import_view.ViewPlugin.fromClass(
2163
2129
  }
2164
2130
  }
2165
2131
  getDecorations(view) {
2166
- const builder = new import_state.RangeSetBuilder();
2132
+ const builder = new RangeSetBuilder();
2167
2133
  for (const { from, to } of view.visibleRanges) {
2168
2134
  for (let pos = from; pos <= to; ) {
2169
2135
  const line = view.state.doc.lineAt(pos);
@@ -2171,7 +2137,7 @@ var blockquotePlugin = import_view.ViewPlugin.fromClass(
2171
2137
  builder.add(
2172
2138
  line.from,
2173
2139
  line.from,
2174
- import_view.Decoration.line({ class: "cm-blockquote-line" })
2140
+ Decoration.line({ class: "cm-blockquote-line" })
2175
2141
  );
2176
2142
  }
2177
2143
  pos = line.to + 1;
@@ -2182,7 +2148,7 @@ var blockquotePlugin = import_view.ViewPlugin.fromClass(
2182
2148
  },
2183
2149
  { decorations: (v) => v.decorations }
2184
2150
  );
2185
- var spoilerPlugin = import_view.ViewPlugin.fromClass(
2151
+ var spoilerPlugin = ViewPlugin.fromClass(
2186
2152
  class {
2187
2153
  constructor(view) {
2188
2154
  this.decorations = this.getDecorations(view);
@@ -2193,7 +2159,7 @@ var spoilerPlugin = import_view.ViewPlugin.fromClass(
2193
2159
  }
2194
2160
  }
2195
2161
  getDecorations(view) {
2196
- const builder = new import_state.RangeSetBuilder();
2162
+ const builder = new RangeSetBuilder();
2197
2163
  const spoilerRegex = /!>([\s\S]+?)<!(?=\s|$)/g;
2198
2164
  const ranges = [];
2199
2165
  for (const { from, to } of view.visibleRanges) {
@@ -2206,13 +2172,13 @@ var spoilerPlugin = import_view.ViewPlugin.fromClass(
2206
2172
  const contentStart = start + 2;
2207
2173
  const contentEnd = end - 2;
2208
2174
  if (contentStart >= contentEnd) continue;
2209
- ranges.push({ from: start, to: contentStart, dec: import_view.Decoration.replace({}) });
2175
+ ranges.push({ from: start, to: contentStart, dec: Decoration.replace({}) });
2210
2176
  ranges.push({
2211
2177
  from: contentStart,
2212
2178
  to: contentEnd,
2213
- dec: import_view.Decoration.mark({ class: "cm-spoiler" })
2179
+ dec: Decoration.mark({ class: "cm-spoiler" })
2214
2180
  });
2215
- ranges.push({ from: contentEnd, to: end, dec: import_view.Decoration.replace({}) });
2181
+ ranges.push({ from: contentEnd, to: end, dec: Decoration.replace({}) });
2216
2182
  }
2217
2183
  }
2218
2184
  ranges.sort((a, b) => a.from - b.from || a.to - b.to);
@@ -2222,7 +2188,7 @@ var spoilerPlugin = import_view.ViewPlugin.fromClass(
2222
2188
  },
2223
2189
  { decorations: (v) => v.decorations }
2224
2190
  );
2225
- var colorTextPlugin = import_view.ViewPlugin.fromClass(
2191
+ var colorTextPlugin = ViewPlugin.fromClass(
2226
2192
  class {
2227
2193
  constructor(view) {
2228
2194
  this.decorations = this.getDecorations(view);
@@ -2233,7 +2199,7 @@ var colorTextPlugin = import_view.ViewPlugin.fromClass(
2233
2199
  }
2234
2200
  }
2235
2201
  getDecorations(view) {
2236
- const builder = new import_state.RangeSetBuilder();
2202
+ const builder = new RangeSetBuilder();
2237
2203
  const colorRegex = /%([^%\s]+?)%((?:(?!%%).)*)%%/g;
2238
2204
  for (const { from, to } of view.visibleRanges) {
2239
2205
  const text = view.state.doc.sliceString(from, to);
@@ -2245,7 +2211,7 @@ var colorTextPlugin = import_view.ViewPlugin.fromClass(
2245
2211
  builder.add(
2246
2212
  startPos,
2247
2213
  endPos,
2248
- import_view.Decoration.mark({ attributes: { style: `color: ${color}` } })
2214
+ Decoration.mark({ attributes: { style: `color: ${color}` } })
2249
2215
  );
2250
2216
  }
2251
2217
  }
@@ -2261,25 +2227,25 @@ var NReditor = ({
2261
2227
  debounceMs = 300,
2262
2228
  tailwindCDN = false
2263
2229
  }) => {
2264
- const editorRef = (0, import_react11.useRef)(null);
2265
- const [isAllFolded, setIsAllFolded] = (0, import_react11.useState)(false);
2266
- const [editorMode, setEditorMode] = (0, import_react11.useState)("editor");
2230
+ const editorRef = useRef6(null);
2231
+ const [isAllFolded, setIsAllFolded] = useState5(false);
2232
+ const [editorMode, setEditorMode] = useState5("editor");
2267
2233
  const debouncedContent = useDebounce(value, debounceMs);
2268
2234
  const handleToggleFold = () => {
2269
2235
  if (!editorRef.current) return;
2270
2236
  if (isAllFolded) {
2271
- (0, import_language2.unfoldAll)(editorRef.current);
2237
+ unfoldAll(editorRef.current);
2272
2238
  setIsAllFolded(false);
2273
2239
  } else {
2274
- (0, import_language2.foldAll)(editorRef.current);
2240
+ foldAll(editorRef.current);
2275
2241
  setIsAllFolded(true);
2276
2242
  }
2277
2243
  };
2278
- const extensions = import_react11.default.useMemo(
2244
+ const extensions = React9.useMemo(
2279
2245
  () => [
2280
2246
  customStreamParserV2,
2281
- (0, import_view.lineNumbers)(),
2282
- (0, import_language2.foldGutter)({
2247
+ lineNumbers(),
2248
+ foldGutter({
2283
2249
  markerDOM: (open) => {
2284
2250
  const span = document.createElement("span");
2285
2251
  span.style.cursor = "pointer";
@@ -2293,12 +2259,12 @@ var NReditor = ({
2293
2259
  }),
2294
2260
  customFoldService,
2295
2261
  customEditorTheme,
2296
- (0, import_language2.syntaxHighlighting)(customSyntaxHighlighting),
2297
- import_view.EditorView.lineWrapping,
2298
- (0, import_view.scrollPastEnd)(),
2299
- import_view.keymap.of([
2300
- { key: "Ctrl-Shift-[", run: import_language2.foldAll },
2301
- { key: "Ctrl-Shift-]", run: import_language2.unfoldAll }
2262
+ syntaxHighlighting(customSyntaxHighlighting),
2263
+ EditorView.lineWrapping,
2264
+ scrollPastEnd(),
2265
+ keymap.of([
2266
+ { key: "Ctrl-Shift-[", run: foldAll },
2267
+ { key: "Ctrl-Shift-]", run: unfoldAll }
2302
2268
  ]),
2303
2269
  directivePlugin,
2304
2270
  blockquotePlugin,
@@ -2312,9 +2278,9 @@ var NReditor = ({
2312
2278
  { key: "split", icon: "vertical_split", label: "Split" },
2313
2279
  { key: "preview", icon: "visibility", label: "Preview" }
2314
2280
  ];
2315
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `relative flex-1 flex flex-col min-h-0 ${className || ""}`, children: [
2316
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center justify-between px-2 py-1.5 border-b border-border/30 bg-background-secondary-solid/50 rounded-t-2xl shrink-0", children: [
2317
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2281
+ return /* @__PURE__ */ jsxs8("div", { className: `relative flex-1 flex flex-col min-h-0 ${className || ""}`, children: [
2282
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between px-2 py-1.5 border-b border-border/30 bg-background-secondary-solid/50 rounded-t-2xl shrink-0", children: [
2283
+ /* @__PURE__ */ jsx13(
2318
2284
  "button",
2319
2285
  {
2320
2286
  onClick: handleToggleFold,
@@ -2323,27 +2289,27 @@ var NReditor = ({
2323
2289
  children: isAllFolded ? "\u2569" : "\u2566"
2324
2290
  }
2325
2291
  ),
2326
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center gap-0.5 bg-black/10 dark:bg-white/5 rounded-lg p-0.5", children: modeButtons.map((btn) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2292
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-0.5 bg-black/10 dark:bg-white/5 rounded-lg p-0.5", children: modeButtons.map((btn) => /* @__PURE__ */ jsxs8(
2327
2293
  "button",
2328
2294
  {
2329
2295
  onClick: () => setEditorMode(btn.key),
2330
2296
  className: `flex items-center gap-1 px-2.5 py-1 text-xs rounded-md transition-colors ${editorMode === btn.key ? "bg-accent-primary/20 text-accent-primary font-semibold" : "text-text-secondary hover:text-text-primary hover:bg-white/5"}`,
2331
2297
  title: btn.label,
2332
2298
  children: [
2333
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "material-symbols-rounded text-sm", children: btn.icon }),
2334
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "hidden sm:inline", children: btn.label })
2299
+ /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded text-sm", children: btn.icon }),
2300
+ /* @__PURE__ */ jsx13("span", { className: "hidden sm:inline", children: btn.label })
2335
2301
  ]
2336
2302
  },
2337
2303
  btn.key
2338
2304
  )) })
2339
2305
  ] }),
2340
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex-1 min-h-0 flex", children: [
2341
- (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2306
+ /* @__PURE__ */ jsxs8("div", { className: "flex-1 min-h-0 flex", children: [
2307
+ (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ jsx13(
2342
2308
  "div",
2343
2309
  {
2344
2310
  className: `${editorMode === "split" ? "w-1/2 border-r border-border/30" : "w-full"} flex-1 flex flex-col min-h-0 min-w-0`,
2345
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2346
- import_react_codemirror.default,
2311
+ children: /* @__PURE__ */ jsx13(
2312
+ CodeMirror,
2347
2313
  {
2348
2314
  value,
2349
2315
  onChange,
@@ -2361,15 +2327,18 @@ var NReditor = ({
2361
2327
  )
2362
2328
  }
2363
2329
  ),
2364
- (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2330
+ (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ jsx13(
2365
2331
  "div",
2366
2332
  {
2367
2333
  className: `${editorMode === "split" ? "w-1/2" : "w-full"} flex-1 min-h-0 overflow-auto min-w-0`,
2368
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "nr-prose h-full shadow-xs overflow-auto p-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CustomMarkdownRenderer_default, { content: debouncedContent }) })
2334
+ children: /* @__PURE__ */ jsx13("div", { className: "nr-prose h-full shadow-xs overflow-auto p-4", children: /* @__PURE__ */ jsx13(CustomMarkdownRenderer_default, { content: debouncedContent }) })
2369
2335
  }
2370
2336
  )
2371
2337
  ] })
2372
2338
  ] });
2373
2339
  };
2374
2340
  var NReditor_default = NReditor;
2341
+ export {
2342
+ NReditor_default as default
2343
+ };
2375
2344
  //# sourceMappingURL=NReditor.js.map