ct-rich-text-editor 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +217 -217
  2. package/dist/assets/style.css +4281 -4107
  3. package/dist/{babel-d3085146.js → babel-d155920e.js} +3278 -3551
  4. package/dist/babel-d155920e.js.map +1 -0
  5. package/dist/components/FileView/index.d.ts +10 -0
  6. package/dist/components/ui/button.d.ts +1 -1
  7. package/dist/constants.d.ts +2 -1
  8. package/dist/{estree-164983f6.js → estree-b1fff53b.js} +1778 -1763
  9. package/dist/estree-b1fff53b.js.map +1 -0
  10. package/dist/hooks/useModal.d.ts +1 -0
  11. package/dist/{html-5586dbf6.js → html-f95ee5dc.js} +656 -701
  12. package/dist/html-f95ee5dc.js.map +1 -0
  13. package/dist/{html2pdf.bundle-5c5747c7.js → html2pdf.bundle-c0e42624.js} +2 -2
  14. package/dist/html2pdf.bundle-c0e42624.js.map +1 -0
  15. package/dist/{html2pdf.bundle.min-8fcf4f01.js → html2pdf.bundle.min-64f254e4.js} +2 -2
  16. package/dist/html2pdf.bundle.min-64f254e4.js.map +1 -0
  17. package/dist/{index-db43388d.js → index-1719c0e6.js} +1248 -628
  18. package/dist/index-1719c0e6.js.map +1 -0
  19. package/dist/{index-48519641.js → index-2e8a7483.js} +87 -15
  20. package/dist/index-2e8a7483.js.map +1 -0
  21. package/dist/index-46b9ecb6.js +213 -0
  22. package/dist/index-46b9ecb6.js.map +1 -0
  23. package/dist/index.js +5 -5
  24. package/dist/{markdown-d513479b.js → markdown-1d9e6c3f.js} +1789 -1836
  25. package/dist/markdown-1d9e6c3f.js.map +1 -0
  26. package/dist/nodes/FileNode.d.ts +33 -0
  27. package/dist/plugins/AutocompletePlugin.d.ts +1 -0
  28. package/dist/plugins/FilePlugin.d.ts +1 -0
  29. package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +1 -0
  30. package/dist/plugins/SlashCommandPlugin/index.d.ts +1 -0
  31. package/dist/plugins/TablePlugin.d.ts +3 -0
  32. package/dist/{postcss-f084f74d.js → postcss-c2592f3f.js} +1357 -1378
  33. package/dist/postcss-c2592f3f.js.map +1 -0
  34. package/dist/standalone-bcc7f37a.js +2649 -0
  35. package/dist/standalone-bcc7f37a.js.map +1 -0
  36. package/dist/typescript-48c10f50.js +13601 -0
  37. package/dist/typescript-48c10f50.js.map +1 -0
  38. package/package.json +126 -126
  39. package/dist/babel-d3085146.js.map +0 -1
  40. package/dist/estree-164983f6.js.map +0 -1
  41. package/dist/html-5586dbf6.js.map +0 -1
  42. package/dist/html2pdf.bundle-5c5747c7.js.map +0 -1
  43. package/dist/html2pdf.bundle.min-8fcf4f01.js.map +0 -1
  44. package/dist/index-48519641.js.map +0 -1
  45. package/dist/index-db43388d.js.map +0 -1
  46. package/dist/markdown-d513479b.js.map +0 -1
  47. package/dist/postcss-f084f74d.js.map +0 -1
  48. package/dist/standalone-5a8c6b7e.js +0 -2518
  49. package/dist/standalone-5a8c6b7e.js.map +0 -1
  50. package/dist/typescript-b1005db4.js +0 -13705
  51. package/dist/typescript-b1005db4.js.map +0 -1
@@ -27,7 +27,7 @@ import { createCommand, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection,
27
27
  import * as ReactDOM from "react-dom";
28
28
  import ReactDOM__default, { createPortal } from "react-dom";
29
29
  import { $isCodeNode, CodeNode, normalizeCodeLang, getLanguageFriendlyName, CodeHighlightNode, CODE_LANGUAGE_MAP, $createCodeNode, registerCodeHighlighting, $isCodeHighlightNode } from "@lexical/code";
30
- import { LinkNode, $isLinkNode, TOGGLE_LINK_COMMAND, $createLinkNode, $isAutoLinkNode } from "@lexical/link";
30
+ import { LinkNode, $isLinkNode, TOGGLE_LINK_COMMAND, $isAutoLinkNode, $createLinkNode } from "@lexical/link";
31
31
  import { ListNode, ListItemNode, $isListNode, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, $createListNode, $createListItemNode } from "@lexical/list";
32
32
  import { HeadingNode, QuoteNode, $isHeadingNode, $createHeadingNode, $createQuoteNode, DRAG_DROP_PASTE } from "@lexical/rich-text";
33
33
  import { $isAtNodeEnd, $selectAll, $patchStyleText, $setBlocksType, $isParentElementRTL, $getSelectionStyleValueForProperty } from "@lexical/selection";
@@ -343,18 +343,18 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
343
343
  }
344
344
  };
345
345
  }
346
- function setRef(ref, value) {
346
+ function setRef$1(ref, value) {
347
347
  if (typeof ref === "function") {
348
348
  return ref(value);
349
349
  } else if (ref !== null && ref !== void 0) {
350
350
  ref.current = value;
351
351
  }
352
352
  }
353
- function composeRefs(...refs) {
353
+ function composeRefs$1(...refs) {
354
354
  return (node) => {
355
355
  let hasCleanup = false;
356
356
  const cleanups = refs.map((ref) => {
357
- const cleanup = setRef(ref, node);
357
+ const cleanup = setRef$1(ref, node);
358
358
  if (!hasCleanup && typeof cleanup == "function") {
359
359
  hasCleanup = true;
360
360
  }
@@ -367,7 +367,7 @@ function composeRefs(...refs) {
367
367
  if (typeof cleanup == "function") {
368
368
  cleanup();
369
369
  } else {
370
- setRef(refs[i2], null);
370
+ setRef$1(refs[i2], null);
371
371
  }
372
372
  }
373
373
  };
@@ -375,7 +375,7 @@ function composeRefs(...refs) {
375
375
  };
376
376
  }
377
377
  function useComposedRefs(...refs) {
378
- return React$1.useCallback(composeRefs(...refs), refs);
378
+ return React$1.useCallback(composeRefs$1(...refs), refs);
379
379
  }
380
380
  function createContext2(rootComponentName, defaultContext) {
381
381
  const Context2 = React$1.createContext(defaultContext);
@@ -395,7 +395,7 @@ function createContext2(rootComponentName, defaultContext) {
395
395
  }
396
396
  return [Provider2, useContext2];
397
397
  }
398
- function createContextScope$1(scopeName, createContextScopeDeps = []) {
398
+ function createContextScope(scopeName, createContextScopeDeps = []) {
399
399
  let defaultContexts = [];
400
400
  function createContext3(rootComponentName, defaultContext) {
401
401
  const BaseContext = React$1.createContext(defaultContext);
@@ -434,9 +434,9 @@ function createContextScope$1(scopeName, createContextScopeDeps = []) {
434
434
  };
435
435
  };
436
436
  createScope.scopeName = scopeName;
437
- return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
437
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
438
438
  }
439
- function composeContextScopes$1(...scopes) {
439
+ function composeContextScopes(...scopes) {
440
440
  const baseScope = scopes[0];
441
441
  if (scopes.length === 1)
442
442
  return baseScope;
@@ -568,7 +568,7 @@ function createSlotClone$1(ownerName) {
568
568
  const childrenRef = getElementRef$2(children);
569
569
  const props2 = mergeProps$1(slotProps, children.props);
570
570
  if (children.type !== React$1.Fragment) {
571
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
571
+ props2.ref = forwardedRef ? composeRefs$1(forwardedRef, childrenRef) : childrenRef;
572
572
  }
573
573
  return React$1.cloneElement(children, props2);
574
574
  }
@@ -628,7 +628,7 @@ function getElementRef$2(element) {
628
628
  }
629
629
  return element.props.ref || element.ref;
630
630
  }
631
- var NODES$1 = [
631
+ var NODES = [
632
632
  "a",
633
633
  "button",
634
634
  "div",
@@ -647,7 +647,7 @@ var NODES$1 = [
647
647
  "svg",
648
648
  "ul"
649
649
  ];
650
- var Primitive$1 = NODES$1.reduce((primitive, node) => {
650
+ var Primitive = NODES.reduce((primitive, node) => {
651
651
  const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
652
652
  const Node2 = React$1.forwardRef((props, forwardedRef) => {
653
653
  const { asChild, ...primitiveProps } = props;
@@ -781,7 +781,7 @@ var DismissableLayer = React$1.forwardRef(
781
781
  return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
782
782
  }, []);
783
783
  return /* @__PURE__ */ jsx(
784
- Primitive$1.div,
784
+ Primitive.div,
785
785
  {
786
786
  ...layerProps,
787
787
  ref: composedRefs,
@@ -814,7 +814,7 @@ var DismissableLayerBranch = React$1.forwardRef((props, forwardedRef) => {
814
814
  };
815
815
  }
816
816
  }, [context.branches]);
817
- return /* @__PURE__ */ jsx(Primitive$1.div, { ...props, ref: composedRefs });
817
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
818
818
  });
819
819
  DismissableLayerBranch.displayName = BRANCH_NAME;
820
820
  function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
@@ -1023,7 +1023,7 @@ var FocusScope = React$1.forwardRef((props, forwardedRef) => {
1023
1023
  },
1024
1024
  [loop, trapped, focusScope.paused]
1025
1025
  );
1026
- return /* @__PURE__ */ jsx(Primitive$1.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
1026
+ return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
1027
1027
  });
1028
1028
  FocusScope.displayName = FOCUS_SCOPE_NAME;
1029
1029
  function focusFirst$2(candidates, { select = false } = {}) {
@@ -1120,7 +1120,7 @@ var Portal$5 = React$1.forwardRef((props, forwardedRef) => {
1120
1120
  const [mounted, setMounted] = React$1.useState(false);
1121
1121
  useLayoutEffect2(() => setMounted(true), []);
1122
1122
  const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
1123
- return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive$1.div, { ...portalProps, ref: forwardedRef }), container) : null;
1123
+ return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
1124
1124
  });
1125
1125
  Portal$5.displayName = PORTAL_NAME$6;
1126
1126
  function useStateMachine(initialState, machine) {
@@ -2055,7 +2055,7 @@ var hideOthers = function(originalTarget, parentNode, markerName) {
2055
2055
  return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
2056
2056
  };
2057
2057
  var DIALOG_NAME = "Dialog";
2058
- var [createDialogContext, createDialogScope] = createContextScope$1(DIALOG_NAME);
2058
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
2059
2059
  var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
2060
2060
  var Dialog$1 = (props) => {
2061
2061
  const {
@@ -2099,7 +2099,7 @@ var DialogTrigger = React$1.forwardRef(
2099
2099
  const context = useDialogContext(TRIGGER_NAME$5, __scopeDialog);
2100
2100
  const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
2101
2101
  return /* @__PURE__ */ jsx(
2102
- Primitive$1.button,
2102
+ Primitive.button,
2103
2103
  {
2104
2104
  type: "button",
2105
2105
  "aria-haspopup": "dialog",
@@ -2143,7 +2143,7 @@ var DialogOverlayImpl = React$1.forwardRef(
2143
2143
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2144
2144
  // ie. when `Overlay` and `Content` are siblings
2145
2145
  /* @__PURE__ */ jsx(RemoveScroll, { as: Slot$4, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
2146
- Primitive$1.div,
2146
+ Primitive.div,
2147
2147
  {
2148
2148
  "data-state": getState$1(context.open),
2149
2149
  ...overlayProps,
@@ -2288,7 +2288,7 @@ var DialogTitle$1 = React$1.forwardRef(
2288
2288
  (props, forwardedRef) => {
2289
2289
  const { __scopeDialog, ...titleProps } = props;
2290
2290
  const context = useDialogContext(TITLE_NAME, __scopeDialog);
2291
- return /* @__PURE__ */ jsx(Primitive$1.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
2291
+ return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
2292
2292
  }
2293
2293
  );
2294
2294
  DialogTitle$1.displayName = TITLE_NAME;
@@ -2297,7 +2297,7 @@ var DialogDescription$1 = React$1.forwardRef(
2297
2297
  (props, forwardedRef) => {
2298
2298
  const { __scopeDialog, ...descriptionProps } = props;
2299
2299
  const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
2300
- return /* @__PURE__ */ jsx(Primitive$1.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
2300
+ return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
2301
2301
  }
2302
2302
  );
2303
2303
  DialogDescription$1.displayName = DESCRIPTION_NAME;
@@ -2307,7 +2307,7 @@ var DialogClose = React$1.forwardRef(
2307
2307
  const { __scopeDialog, ...closeProps } = props;
2308
2308
  const context = useDialogContext(CLOSE_NAME$1, __scopeDialog);
2309
2309
  return /* @__PURE__ */ jsx(
2310
- Primitive$1.button,
2310
+ Primitive.button,
2311
2311
  {
2312
2312
  type: "button",
2313
2313
  ...closeProps,
@@ -2504,6 +2504,16 @@ const Ban = createLucideIcon("Ban", [
2504
2504
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
2505
2505
  ["path", { d: "m4.9 4.9 14.2 14.2", key: "1m5liu" }]
2506
2506
  ]);
2507
+ /**
2508
+ * @license lucide-react v0.344.0 - ISC
2509
+ *
2510
+ * This source code is licensed under the ISC license.
2511
+ * See the LICENSE file in the root directory of this source tree.
2512
+ */
2513
+ const Bold = createLucideIcon("Bold", [
2514
+ ["path", { d: "M14 12a4 4 0 0 0 0-8H6v8", key: "v2sylx" }],
2515
+ ["path", { d: "M15 20a4 4 0 0 0 0-8H6v8Z", key: "1ef5ya" }]
2516
+ ]);
2507
2517
  /**
2508
2518
  * @license lucide-react v0.344.0 - ISC
2509
2519
  *
@@ -2565,6 +2575,16 @@ const Clock = createLucideIcon("Clock", [
2565
2575
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
2566
2576
  ["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
2567
2577
  ]);
2578
+ /**
2579
+ * @license lucide-react v0.344.0 - ISC
2580
+ *
2581
+ * This source code is licensed under the ISC license.
2582
+ * See the LICENSE file in the root directory of this source tree.
2583
+ */
2584
+ const Code = createLucideIcon("Code", [
2585
+ ["polyline", { points: "16 18 22 12 16 6", key: "z7tu5w" }],
2586
+ ["polyline", { points: "8 6 2 12 8 18", key: "1eg1df" }]
2587
+ ]);
2568
2588
  /**
2569
2589
  * @license lucide-react v0.344.0 - ISC
2570
2590
  *
@@ -2586,6 +2606,23 @@ const Download = createLucideIcon("Download", [
2586
2606
  ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
2587
2607
  ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
2588
2608
  ]);
2609
+ /**
2610
+ * @license lucide-react v0.344.0 - ISC
2611
+ *
2612
+ * This source code is licensed under the ISC license.
2613
+ * See the LICENSE file in the root directory of this source tree.
2614
+ */
2615
+ const Eraser = createLucideIcon("Eraser", [
2616
+ [
2617
+ "path",
2618
+ {
2619
+ d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",
2620
+ key: "182aya"
2621
+ }
2622
+ ],
2623
+ ["path", { d: "M22 21H7", key: "t4ddhn" }],
2624
+ ["path", { d: "m5 11 9 9", key: "1mo9qw" }]
2625
+ ]);
2589
2626
  /**
2590
2627
  * @license lucide-react v0.344.0 - ISC
2591
2628
  *
@@ -2720,6 +2757,17 @@ const Info = createLucideIcon("Info", [
2720
2757
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
2721
2758
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
2722
2759
  ]);
2760
+ /**
2761
+ * @license lucide-react v0.344.0 - ISC
2762
+ *
2763
+ * This source code is licensed under the ISC license.
2764
+ * See the LICENSE file in the root directory of this source tree.
2765
+ */
2766
+ const Italic = createLucideIcon("Italic", [
2767
+ ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
2768
+ ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
2769
+ ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
2770
+ ]);
2723
2771
  /**
2724
2772
  * @license lucide-react v0.344.0 - ISC
2725
2773
  *
@@ -2787,6 +2835,15 @@ const List$1 = createLucideIcon("List", [
2787
2835
  const Loader2 = createLucideIcon("Loader2", [
2788
2836
  ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
2789
2837
  ]);
2838
+ /**
2839
+ * @license lucide-react v0.344.0 - ISC
2840
+ *
2841
+ * This source code is licensed under the ISC license.
2842
+ * See the LICENSE file in the root directory of this source tree.
2843
+ */
2844
+ const MessageCircle = createLucideIcon("MessageCircle", [
2845
+ ["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
2846
+ ]);
2790
2847
  /**
2791
2848
  * @license lucide-react v0.344.0 - ISC
2792
2849
  *
@@ -2847,6 +2904,38 @@ const Plus = createLucideIcon("Plus", [
2847
2904
  ["path", { d: "M5 12h14", key: "1ays0h" }],
2848
2905
  ["path", { d: "M12 5v14", key: "s699le" }]
2849
2906
  ]);
2907
+ /**
2908
+ * @license lucide-react v0.344.0 - ISC
2909
+ *
2910
+ * This source code is licensed under the ISC license.
2911
+ * See the LICENSE file in the root directory of this source tree.
2912
+ */
2913
+ const Quote = createLucideIcon("Quote", [
2914
+ [
2915
+ "path",
2916
+ {
2917
+ d: "M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",
2918
+ key: "4rm80e"
2919
+ }
2920
+ ],
2921
+ [
2922
+ "path",
2923
+ {
2924
+ d: "M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",
2925
+ key: "10za9r"
2926
+ }
2927
+ ]
2928
+ ]);
2929
+ /**
2930
+ * @license lucide-react v0.344.0 - ISC
2931
+ *
2932
+ * This source code is licensed under the ISC license.
2933
+ * See the LICENSE file in the root directory of this source tree.
2934
+ */
2935
+ const Redo = createLucideIcon("Redo", [
2936
+ ["path", { d: "M21 7v6h-6", key: "3ptur4" }],
2937
+ ["path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7", key: "1kgawr" }]
2938
+ ]);
2850
2939
  /**
2851
2940
  * @license lucide-react v0.344.0 - ISC
2852
2941
  *
@@ -2857,6 +2946,16 @@ const Reply = createLucideIcon("Reply", [
2857
2946
  ["polyline", { points: "9 17 4 12 9 7", key: "hvgpf2" }],
2858
2947
  ["path", { d: "M20 18v-2a4 4 0 0 0-4-4H4", key: "5vmcpk" }]
2859
2948
  ]);
2949
+ /**
2950
+ * @license lucide-react v0.344.0 - ISC
2951
+ *
2952
+ * This source code is licensed under the ISC license.
2953
+ * See the LICENSE file in the root directory of this source tree.
2954
+ */
2955
+ const Search = createLucideIcon("Search", [
2956
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
2957
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
2958
+ ]);
2860
2959
  /**
2861
2960
  * @license lucide-react v0.344.0 - ISC
2862
2961
  *
@@ -2886,6 +2985,17 @@ const StickyNote = createLucideIcon("StickyNote", [
2886
2985
  ["path", { d: "M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z", key: "qazsjp" }],
2887
2986
  ["path", { d: "M15 3v4a2 2 0 0 0 2 2h4", key: "40519r" }]
2888
2987
  ]);
2988
+ /**
2989
+ * @license lucide-react v0.344.0 - ISC
2990
+ *
2991
+ * This source code is licensed under the ISC license.
2992
+ * See the LICENSE file in the root directory of this source tree.
2993
+ */
2994
+ const Strikethrough = createLucideIcon("Strikethrough", [
2995
+ ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
2996
+ ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
2997
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
2998
+ ]);
2889
2999
  /**
2890
3000
  * @license lucide-react v0.344.0 - ISC
2891
3001
  *
@@ -2920,6 +3030,18 @@ const Superscript = createLucideIcon("Superscript", [
2920
3030
  }
2921
3031
  ]
2922
3032
  ]);
3033
+ /**
3034
+ * @license lucide-react v0.344.0 - ISC
3035
+ *
3036
+ * This source code is licensed under the ISC license.
3037
+ * See the LICENSE file in the root directory of this source tree.
3038
+ */
3039
+ const Table = createLucideIcon("Table", [
3040
+ ["path", { d: "M12 3v18", key: "108xh3" }],
3041
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
3042
+ ["path", { d: "M3 9h18", key: "1pudct" }],
3043
+ ["path", { d: "M3 15h18", key: "5xshup" }]
3044
+ ]);
2923
3045
  /**
2924
3046
  * @license lucide-react v0.344.0 - ISC
2925
3047
  *
@@ -2966,6 +3088,26 @@ const Type = createLucideIcon("Type", [
2966
3088
  ["line", { x1: "9", x2: "15", y1: "20", y2: "20", key: "swin9y" }],
2967
3089
  ["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
2968
3090
  ]);
3091
+ /**
3092
+ * @license lucide-react v0.344.0 - ISC
3093
+ *
3094
+ * This source code is licensed under the ISC license.
3095
+ * See the LICENSE file in the root directory of this source tree.
3096
+ */
3097
+ const Underline = createLucideIcon("Underline", [
3098
+ ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
3099
+ ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
3100
+ ]);
3101
+ /**
3102
+ * @license lucide-react v0.344.0 - ISC
3103
+ *
3104
+ * This source code is licensed under the ISC license.
3105
+ * See the LICENSE file in the root directory of this source tree.
3106
+ */
3107
+ const Undo = createLucideIcon("Undo", [
3108
+ ["path", { d: "M3 7v6h6", key: "1v2h90" }],
3109
+ ["path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13", key: "1r6uu6" }]
3110
+ ]);
2969
3111
  /**
2970
3112
  * @license lucide-react v0.344.0 - ISC
2971
3113
  *
@@ -2976,6 +3118,17 @@ const Video = createLucideIcon("Video", [
2976
3118
  ["path", { d: "m22 8-6 4 6 4V8Z", key: "50v9me" }],
2977
3119
  ["rect", { width: "14", height: "12", x: "2", y: "6", rx: "2", ry: "2", key: "1rqjg6" }]
2978
3120
  ]);
3121
+ /**
3122
+ * @license lucide-react v0.344.0 - ISC
3123
+ *
3124
+ * This source code is licensed under the ISC license.
3125
+ * See the LICENSE file in the root directory of this source tree.
3126
+ */
3127
+ const XCircle = createLucideIcon("XCircle", [
3128
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
3129
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
3130
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
3131
+ ]);
2979
3132
  /**
2980
3133
  * @license lucide-react v0.344.0 - ISC
2981
3134
  *
@@ -3005,28 +3158,7 @@ function clsx() {
3005
3158
  (e = arguments[f2]) && (t = r(e)) && (n && (n += " "), n += t);
3006
3159
  return n;
3007
3160
  }
3008
- const concatArrays = (array1, array2) => {
3009
- const combinedArray = new Array(array1.length + array2.length);
3010
- for (let i2 = 0; i2 < array1.length; i2++) {
3011
- combinedArray[i2] = array1[i2];
3012
- }
3013
- for (let i2 = 0; i2 < array2.length; i2++) {
3014
- combinedArray[array1.length + i2] = array2[i2];
3015
- }
3016
- return combinedArray;
3017
- };
3018
- const createClassValidatorObject = (classGroupId, validator) => ({
3019
- classGroupId,
3020
- validator
3021
- });
3022
- const createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
3023
- nextPart,
3024
- validators,
3025
- classGroupId
3026
- });
3027
3161
  const CLASS_PART_SEPARATOR = "-";
3028
- const EMPTY_CONFLICTS = [];
3029
- const ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
3030
3162
  const createClassGroupUtils = (config) => {
3031
3163
  const classMap = createClassMap(config);
3032
3164
  const {
@@ -3034,135 +3166,104 @@ const createClassGroupUtils = (config) => {
3034
3166
  conflictingClassGroupModifiers
3035
3167
  } = config;
3036
3168
  const getClassGroupId = (className) => {
3037
- if (className.startsWith("[") && className.endsWith("]")) {
3038
- return getGroupIdForArbitraryProperty(className);
3039
- }
3040
3169
  const classParts = className.split(CLASS_PART_SEPARATOR);
3041
- const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
3042
- return getGroupRecursive(classParts, startIndex, classMap);
3170
+ if (classParts[0] === "" && classParts.length !== 1) {
3171
+ classParts.shift();
3172
+ }
3173
+ return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
3043
3174
  };
3044
3175
  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
3045
- if (hasPostfixModifier) {
3046
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
3047
- const baseConflicts = conflictingClassGroups[classGroupId];
3048
- if (modifierConflicts) {
3049
- if (baseConflicts) {
3050
- return concatArrays(baseConflicts, modifierConflicts);
3051
- }
3052
- return modifierConflicts;
3053
- }
3054
- return baseConflicts || EMPTY_CONFLICTS;
3176
+ const conflicts = conflictingClassGroups[classGroupId] || [];
3177
+ if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
3178
+ return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
3055
3179
  }
3056
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
3180
+ return conflicts;
3057
3181
  };
3058
3182
  return {
3059
3183
  getClassGroupId,
3060
3184
  getConflictingClassGroupIds
3061
3185
  };
3062
3186
  };
3063
- const getGroupRecursive = (classParts, startIndex, classPartObject) => {
3064
- const classPathsLength = classParts.length - startIndex;
3065
- if (classPathsLength === 0) {
3187
+ const getGroupRecursive = (classParts, classPartObject) => {
3188
+ var _a;
3189
+ if (classParts.length === 0) {
3066
3190
  return classPartObject.classGroupId;
3067
3191
  }
3068
- const currentClassPart = classParts[startIndex];
3192
+ const currentClassPart = classParts[0];
3069
3193
  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
3070
- if (nextClassPartObject) {
3071
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
3072
- if (result)
3073
- return result;
3194
+ const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
3195
+ if (classGroupFromNextClassPart) {
3196
+ return classGroupFromNextClassPart;
3074
3197
  }
3075
- const validators = classPartObject.validators;
3076
- if (validators === null) {
3198
+ if (classPartObject.validators.length === 0) {
3077
3199
  return void 0;
3078
3200
  }
3079
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
3080
- const validatorsLength = validators.length;
3081
- for (let i2 = 0; i2 < validatorsLength; i2++) {
3082
- const validatorObj = validators[i2];
3083
- if (validatorObj.validator(classRest)) {
3084
- return validatorObj.classGroupId;
3201
+ const classRest = classParts.join(CLASS_PART_SEPARATOR);
3202
+ return (_a = classPartObject.validators.find(({
3203
+ validator
3204
+ }) => validator(classRest))) == null ? void 0 : _a.classGroupId;
3205
+ };
3206
+ const arbitraryPropertyRegex = /^\[(.+)\]$/;
3207
+ const getGroupIdForArbitraryProperty = (className) => {
3208
+ if (arbitraryPropertyRegex.test(className)) {
3209
+ const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
3210
+ const property = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(":"));
3211
+ if (property) {
3212
+ return "arbitrary.." + property;
3085
3213
  }
3086
3214
  }
3087
- return void 0;
3088
3215
  };
3089
- const getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
3090
- const content = className.slice(1, -1);
3091
- const colonIndex = content.indexOf(":");
3092
- const property = content.slice(0, colonIndex);
3093
- return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
3094
- })();
3095
3216
  const createClassMap = (config) => {
3096
3217
  const {
3097
3218
  theme: theme2,
3098
3219
  classGroups
3099
3220
  } = config;
3100
- return processClassGroups(classGroups, theme2);
3101
- };
3102
- const processClassGroups = (classGroups, theme2) => {
3103
- const classMap = createClassPartObject();
3221
+ const classMap = {
3222
+ nextPart: /* @__PURE__ */ new Map(),
3223
+ validators: []
3224
+ };
3104
3225
  for (const classGroupId in classGroups) {
3105
- const group = classGroups[classGroupId];
3106
- processClassesRecursively(group, classMap, classGroupId, theme2);
3226
+ processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme2);
3107
3227
  }
3108
3228
  return classMap;
3109
3229
  };
3110
3230
  const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme2) => {
3111
- const len = classGroup.length;
3112
- for (let i2 = 0; i2 < len; i2++) {
3113
- const classDefinition = classGroup[i2];
3114
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme2);
3115
- }
3116
- };
3117
- const processClassDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
3118
- if (typeof classDefinition === "string") {
3119
- processStringDefinition(classDefinition, classPartObject, classGroupId);
3120
- return;
3121
- }
3122
- if (typeof classDefinition === "function") {
3123
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme2);
3124
- return;
3125
- }
3126
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme2);
3127
- };
3128
- const processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
3129
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
3130
- classPartObjectToEdit.classGroupId = classGroupId;
3131
- };
3132
- const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
3133
- if (isThemeGetter(classDefinition)) {
3134
- processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
3135
- return;
3136
- }
3137
- if (classPartObject.validators === null) {
3138
- classPartObject.validators = [];
3139
- }
3140
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
3141
- };
3142
- const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
3143
- const entries = Object.entries(classDefinition);
3144
- const len = entries.length;
3145
- for (let i2 = 0; i2 < len; i2++) {
3146
- const [key, value] = entries[i2];
3147
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme2);
3148
- }
3231
+ classGroup.forEach((classDefinition) => {
3232
+ if (typeof classDefinition === "string") {
3233
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
3234
+ classPartObjectToEdit.classGroupId = classGroupId;
3235
+ return;
3236
+ }
3237
+ if (typeof classDefinition === "function") {
3238
+ if (isThemeGetter(classDefinition)) {
3239
+ processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
3240
+ return;
3241
+ }
3242
+ classPartObject.validators.push({
3243
+ validator: classDefinition,
3244
+ classGroupId
3245
+ });
3246
+ return;
3247
+ }
3248
+ Object.entries(classDefinition).forEach(([key, classGroup2]) => {
3249
+ processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme2);
3250
+ });
3251
+ });
3149
3252
  };
3150
3253
  const getPart = (classPartObject, path) => {
3151
- let current = classPartObject;
3152
- const parts = path.split(CLASS_PART_SEPARATOR);
3153
- const len = parts.length;
3154
- for (let i2 = 0; i2 < len; i2++) {
3155
- const part = parts[i2];
3156
- let next = current.nextPart.get(part);
3157
- if (!next) {
3158
- next = createClassPartObject();
3159
- current.nextPart.set(part, next);
3160
- }
3161
- current = next;
3162
- }
3163
- return current;
3254
+ let currentClassPartObject = classPartObject;
3255
+ path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
3256
+ if (!currentClassPartObject.nextPart.has(pathPart)) {
3257
+ currentClassPartObject.nextPart.set(pathPart, {
3258
+ nextPart: /* @__PURE__ */ new Map(),
3259
+ validators: []
3260
+ });
3261
+ }
3262
+ currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
3263
+ });
3264
+ return currentClassPartObject;
3164
3265
  };
3165
- const isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
3266
+ const isThemeGetter = (func) => func.isThemeGetter;
3166
3267
  const createLruCache = (maxCacheSize) => {
3167
3268
  if (maxCacheSize < 1) {
3168
3269
  return {
@@ -3172,31 +3273,31 @@ const createLruCache = (maxCacheSize) => {
3172
3273
  };
3173
3274
  }
3174
3275
  let cacheSize = 0;
3175
- let cache = /* @__PURE__ */ Object.create(null);
3176
- let previousCache = /* @__PURE__ */ Object.create(null);
3276
+ let cache = /* @__PURE__ */ new Map();
3277
+ let previousCache = /* @__PURE__ */ new Map();
3177
3278
  const update = (key, value) => {
3178
- cache[key] = value;
3279
+ cache.set(key, value);
3179
3280
  cacheSize++;
3180
3281
  if (cacheSize > maxCacheSize) {
3181
3282
  cacheSize = 0;
3182
3283
  previousCache = cache;
3183
- cache = /* @__PURE__ */ Object.create(null);
3284
+ cache = /* @__PURE__ */ new Map();
3184
3285
  }
3185
3286
  };
3186
3287
  return {
3187
3288
  get(key) {
3188
- let value = cache[key];
3289
+ let value = cache.get(key);
3189
3290
  if (value !== void 0) {
3190
3291
  return value;
3191
3292
  }
3192
- if ((value = previousCache[key]) !== void 0) {
3293
+ if ((value = previousCache.get(key)) !== void 0) {
3193
3294
  update(key, value);
3194
3295
  return value;
3195
3296
  }
3196
3297
  },
3197
3298
  set(key, value) {
3198
- if (key in cache) {
3199
- cache[key] = value;
3299
+ if (cache.has(key)) {
3300
+ cache.set(key, value);
3200
3301
  } else {
3201
3302
  update(key, value);
3202
3303
  }
@@ -3205,14 +3306,7 @@ const createLruCache = (maxCacheSize) => {
3205
3306
  };
3206
3307
  const IMPORTANT_MODIFIER = "!";
3207
3308
  const MODIFIER_SEPARATOR = ":";
3208
- const EMPTY_MODIFIERS = [];
3209
- const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
3210
- modifiers,
3211
- hasImportantModifier,
3212
- baseClassName,
3213
- maybePostfixModifierPosition,
3214
- isExternal
3215
- });
3309
+ const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
3216
3310
  const createParseClassName = (config) => {
3217
3311
  const {
3218
3312
  prefix,
@@ -3224,13 +3318,12 @@ const createParseClassName = (config) => {
3224
3318
  let parenDepth = 0;
3225
3319
  let modifierStart = 0;
3226
3320
  let postfixModifierPosition;
3227
- const len = className.length;
3228
- for (let index2 = 0; index2 < len; index2++) {
3229
- const currentCharacter = className[index2];
3321
+ for (let index2 = 0; index2 < className.length; index2++) {
3322
+ let currentCharacter = className[index2];
3230
3323
  if (bracketDepth === 0 && parenDepth === 0) {
3231
3324
  if (currentCharacter === MODIFIER_SEPARATOR) {
3232
3325
  modifiers.push(className.slice(modifierStart, index2));
3233
- modifierStart = index2 + 1;
3326
+ modifierStart = index2 + MODIFIER_SEPARATOR_LENGTH;
3234
3327
  continue;
3235
3328
  }
3236
3329
  if (currentCharacter === "/") {
@@ -3238,38 +3331,37 @@ const createParseClassName = (config) => {
3238
3331
  continue;
3239
3332
  }
3240
3333
  }
3241
- if (currentCharacter === "[")
3334
+ if (currentCharacter === "[") {
3242
3335
  bracketDepth++;
3243
- else if (currentCharacter === "]")
3336
+ } else if (currentCharacter === "]") {
3244
3337
  bracketDepth--;
3245
- else if (currentCharacter === "(")
3338
+ } else if (currentCharacter === "(") {
3246
3339
  parenDepth++;
3247
- else if (currentCharacter === ")")
3340
+ } else if (currentCharacter === ")") {
3248
3341
  parenDepth--;
3342
+ }
3249
3343
  }
3250
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
3251
- let baseClassName = baseClassNameWithImportantModifier;
3252
- let hasImportantModifier = false;
3253
- if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
3254
- baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
3255
- hasImportantModifier = true;
3256
- } else if (
3257
- /**
3258
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
3259
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
3260
- */
3261
- baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
3262
- ) {
3263
- baseClassName = baseClassNameWithImportantModifier.slice(1);
3264
- hasImportantModifier = true;
3265
- }
3344
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
3345
+ const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
3346
+ const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
3266
3347
  const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
3267
- return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
3348
+ return {
3349
+ modifiers,
3350
+ hasImportantModifier,
3351
+ baseClassName,
3352
+ maybePostfixModifierPosition
3353
+ };
3268
3354
  };
3269
3355
  if (prefix) {
3270
3356
  const fullPrefix = prefix + MODIFIER_SEPARATOR;
3271
3357
  const parseClassNameOriginal = parseClassName;
3272
- parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
3358
+ parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
3359
+ isExternal: true,
3360
+ modifiers: [],
3361
+ hasImportantModifier: false,
3362
+ baseClassName: className,
3363
+ maybePostfixModifierPosition: void 0
3364
+ };
3273
3365
  }
3274
3366
  if (experimentalParseClassName) {
3275
3367
  const parseClassNameOriginal = parseClassName;
@@ -3280,35 +3372,36 @@ const createParseClassName = (config) => {
3280
3372
  }
3281
3373
  return parseClassName;
3282
3374
  };
3375
+ const stripImportantModifier = (baseClassName) => {
3376
+ if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
3377
+ return baseClassName.substring(0, baseClassName.length - 1);
3378
+ }
3379
+ if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
3380
+ return baseClassName.substring(1);
3381
+ }
3382
+ return baseClassName;
3383
+ };
3283
3384
  const createSortModifiers = (config) => {
3284
- const modifierWeights = /* @__PURE__ */ new Map();
3285
- config.orderSensitiveModifiers.forEach((mod, index2) => {
3286
- modifierWeights.set(mod, 1e6 + index2);
3287
- });
3288
- return (modifiers) => {
3289
- const result = [];
3290
- let currentSegment = [];
3291
- for (let i2 = 0; i2 < modifiers.length; i2++) {
3292
- const modifier = modifiers[i2];
3293
- const isArbitrary = modifier[0] === "[";
3294
- const isOrderSensitive = modifierWeights.has(modifier);
3295
- if (isArbitrary || isOrderSensitive) {
3296
- if (currentSegment.length > 0) {
3297
- currentSegment.sort();
3298
- result.push(...currentSegment);
3299
- currentSegment = [];
3300
- }
3301
- result.push(modifier);
3385
+ const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map((modifier) => [modifier, true]));
3386
+ const sortModifiers = (modifiers) => {
3387
+ if (modifiers.length <= 1) {
3388
+ return modifiers;
3389
+ }
3390
+ const sortedModifiers = [];
3391
+ let unsortedModifiers = [];
3392
+ modifiers.forEach((modifier) => {
3393
+ const isPositionSensitive = modifier[0] === "[" || orderSensitiveModifiers[modifier];
3394
+ if (isPositionSensitive) {
3395
+ sortedModifiers.push(...unsortedModifiers.sort(), modifier);
3396
+ unsortedModifiers = [];
3302
3397
  } else {
3303
- currentSegment.push(modifier);
3398
+ unsortedModifiers.push(modifier);
3304
3399
  }
3305
- }
3306
- if (currentSegment.length > 0) {
3307
- currentSegment.sort();
3308
- result.push(...currentSegment);
3309
- }
3310
- return result;
3400
+ });
3401
+ sortedModifiers.push(...unsortedModifiers.sort());
3402
+ return sortedModifiers;
3311
3403
  };
3404
+ return sortModifiers;
3312
3405
  };
3313
3406
  const createConfigUtils = (config) => ({
3314
3407
  cache: createLruCache(config.cacheSize),
@@ -3354,10 +3447,10 @@ const mergeClassList = (classList, configUtils) => {
3354
3447
  }
3355
3448
  hasPostfixModifier = false;
3356
3449
  }
3357
- const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
3450
+ const variantModifier = sortModifiers(modifiers).join(":");
3358
3451
  const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
3359
3452
  const classId = modifierId + classGroupId;
3360
- if (classGroupsInConflict.indexOf(classId) > -1) {
3453
+ if (classGroupsInConflict.includes(classId)) {
3361
3454
  continue;
3362
3455
  }
3363
3456
  classGroupsInConflict.push(classId);
@@ -3370,13 +3463,13 @@ const mergeClassList = (classList, configUtils) => {
3370
3463
  }
3371
3464
  return result;
3372
3465
  };
3373
- const twJoin = (...classLists) => {
3466
+ function twJoin() {
3374
3467
  let index2 = 0;
3375
3468
  let argument;
3376
3469
  let resolvedValue;
3377
3470
  let string = "";
3378
- while (index2 < classLists.length) {
3379
- if (argument = classLists[index2++]) {
3471
+ while (index2 < arguments.length) {
3472
+ if (argument = arguments[index2++]) {
3380
3473
  if (resolvedValue = toValue(argument)) {
3381
3474
  string && (string += " ");
3382
3475
  string += resolvedValue;
@@ -3384,7 +3477,7 @@ const twJoin = (...classLists) => {
3384
3477
  }
3385
3478
  }
3386
3479
  return string;
3387
- };
3480
+ }
3388
3481
  const toValue = (mix) => {
3389
3482
  if (typeof mix === "string") {
3390
3483
  return mix;
@@ -3401,20 +3494,20 @@ const toValue = (mix) => {
3401
3494
  }
3402
3495
  return string;
3403
3496
  };
3404
- const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
3497
+ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
3405
3498
  let configUtils;
3406
3499
  let cacheGet;
3407
3500
  let cacheSet;
3408
- let functionToCall;
3409
- const initTailwindMerge = (classList) => {
3501
+ let functionToCall = initTailwindMerge;
3502
+ function initTailwindMerge(classList) {
3410
3503
  const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
3411
3504
  configUtils = createConfigUtils(config);
3412
3505
  cacheGet = configUtils.cache.get;
3413
3506
  cacheSet = configUtils.cache.set;
3414
3507
  functionToCall = tailwindMerge;
3415
3508
  return tailwindMerge(classList);
3416
- };
3417
- const tailwindMerge = (classList) => {
3509
+ }
3510
+ function tailwindMerge(classList) {
3418
3511
  const cachedResult = cacheGet(classList);
3419
3512
  if (cachedResult) {
3420
3513
  return cachedResult;
@@ -3422,13 +3515,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
3422
3515
  const result = mergeClassList(classList, configUtils);
3423
3516
  cacheSet(classList, result);
3424
3517
  return result;
3518
+ }
3519
+ return function callTailwindMerge() {
3520
+ return functionToCall(twJoin.apply(null, arguments));
3425
3521
  };
3426
- functionToCall = initTailwindMerge;
3427
- return (...args) => functionToCall(twJoin(...args));
3428
- };
3429
- const fallbackThemeArr = [];
3522
+ }
3430
3523
  const fromTheme = (key) => {
3431
- const themeGetter = (theme2) => theme2[key] || fallbackThemeArr;
3524
+ const themeGetter = (theme2) => theme2[key] || [];
3432
3525
  themeGetter.isThemeGetter = true;
3433
3526
  return themeGetter;
3434
3527
  };
@@ -6050,7 +6143,7 @@ const DialogContent = React$1.forwardRef(({ className, children, ...props }, ref
6050
6143
  /* @__PURE__ */ jsxs(
6051
6144
  Close,
6052
6145
  {
6053
- className: "cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-full cteditor-bg-secondary cteditor-p-1 cteditor-opacity-70 cteditor-transition-opacity focus:cteditor-outline-none cteditor-disabled:pointer-events-none data-[state=open]:cteditor-bg-accent data-[state=open]:cteditor-text-muted-foreground hover:cteditor-opacity-100\n",
6146
+ className: "cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-full cteditor-bg-secondary cteditor-p-1 cteditor-opacity-70 cteditor-transition-opacity focus:cteditor-outline-none cteditor-disabled:pointer-events-none data-[state=open]:cteditor-bg-accent data-[state=open]:cteditor-text-muted-foreground hover:cteditor-opacity-100\r\n",
6054
6147
  children: [
6055
6148
  /* @__PURE__ */ jsx(X$1, { className: "cteditor-h-4 cteditor-w-4" }),
6056
6149
  /* @__PURE__ */ jsx("span", { className: "!cteditor-sr-only", children: "Close" })
@@ -6111,6 +6204,37 @@ const DialogDescription = React$1.forwardRef(({ className, ...props }, ref) => /
6111
6204
  }
6112
6205
  ));
6113
6206
  DialogDescription.displayName = Description.displayName;
6207
+ function setRef(ref, value) {
6208
+ if (typeof ref === "function") {
6209
+ return ref(value);
6210
+ } else if (ref !== null && ref !== void 0) {
6211
+ ref.current = value;
6212
+ }
6213
+ }
6214
+ function composeRefs(...refs) {
6215
+ return (node) => {
6216
+ let hasCleanup = false;
6217
+ const cleanups = refs.map((ref) => {
6218
+ const cleanup = setRef(ref, node);
6219
+ if (!hasCleanup && typeof cleanup == "function") {
6220
+ hasCleanup = true;
6221
+ }
6222
+ return cleanup;
6223
+ });
6224
+ if (hasCleanup) {
6225
+ return () => {
6226
+ for (let i2 = 0; i2 < cleanups.length; i2++) {
6227
+ const cleanup = cleanups[i2];
6228
+ if (typeof cleanup == "function") {
6229
+ cleanup();
6230
+ } else {
6231
+ setRef(refs[i2], null);
6232
+ }
6233
+ }
6234
+ };
6235
+ }
6236
+ };
6237
+ }
6114
6238
  var REACT_LAZY_TYPE = Symbol.for("react.lazy");
6115
6239
  var use = React$1[" use ".trim().toString()];
6116
6240
  function isPromiseLike(value) {
@@ -6311,38 +6435,6 @@ const Input$1 = React$1.forwardRef(
6311
6435
  }
6312
6436
  );
6313
6437
  Input$1.displayName = "Input";
6314
- var NODES = [
6315
- "a",
6316
- "button",
6317
- "div",
6318
- "form",
6319
- "h2",
6320
- "h3",
6321
- "img",
6322
- "input",
6323
- "label",
6324
- "li",
6325
- "nav",
6326
- "ol",
6327
- "p",
6328
- "select",
6329
- "span",
6330
- "svg",
6331
- "ul"
6332
- ];
6333
- var Primitive = NODES.reduce((primitive, node) => {
6334
- const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
6335
- const Node2 = React$1.forwardRef((props, forwardedRef) => {
6336
- const { asChild, ...primitiveProps } = props;
6337
- const Comp = asChild ? Slot2 : node;
6338
- if (typeof window !== "undefined") {
6339
- window[Symbol.for("radix-ui")] = true;
6340
- }
6341
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
6342
- });
6343
- Node2.displayName = `Primitive.${node}`;
6344
- return { ...primitive, [node]: Node2 };
6345
- }, {});
6346
6438
  var NAME$4 = "Label";
6347
6439
  var Label$3 = React$1.forwardRef((props, forwardedRef) => {
6348
6440
  return /* @__PURE__ */ jsx(
@@ -7990,16 +8082,16 @@ function CopyButton({ editor, getCodeDOMNode }) {
7990
8082
  }
7991
8083
  const index$4 = "";
7992
8084
  const PRETTIER_PARSER_MODULES = {
7993
- css: [() => import("./postcss-f084f74d.js")],
7994
- html: [() => import("./html-5586dbf6.js")],
8085
+ css: [() => import("./postcss-c2592f3f.js")],
8086
+ html: [() => import("./html-f95ee5dc.js")],
7995
8087
  js: [
7996
- () => import("./babel-d3085146.js"),
7997
- () => import("./estree-164983f6.js")
8088
+ () => import("./babel-d155920e.js"),
8089
+ () => import("./estree-b1fff53b.js")
7998
8090
  ],
7999
- markdown: [() => import("./markdown-d513479b.js")],
8091
+ markdown: [() => import("./markdown-1d9e6c3f.js")],
8000
8092
  typescript: [
8001
- () => import("./typescript-b1005db4.js"),
8002
- () => import("./estree-164983f6.js")
8093
+ () => import("./typescript-48c10f50.js"),
8094
+ () => import("./estree-b1fff53b.js")
8003
8095
  ]
8004
8096
  };
8005
8097
  async function loadPrettierParserByLang(lang) {
@@ -8010,7 +8102,7 @@ async function loadPrettierParserByLang(lang) {
8010
8102
  return modules;
8011
8103
  }
8012
8104
  async function loadPrettierFormat() {
8013
- const { format } = await import("./standalone-5a8c6b7e.js");
8105
+ const { format } = await import("./standalone-bcc7f37a.js");
8014
8106
  return format;
8015
8107
  }
8016
8108
  const PRETTIER_OPTIONS_BY_LANG = {
@@ -8468,69 +8560,6 @@ function $createCommentedTextNode(text, commentId, commentText, commentAuthor, c
8468
8560
  function $isCommentedTextNode(node) {
8469
8561
  return node instanceof CommentedTextNode;
8470
8562
  }
8471
- function createContextScope(scopeName, createContextScopeDeps = []) {
8472
- let defaultContexts = [];
8473
- function createContext3(rootComponentName, defaultContext) {
8474
- const BaseContext = React$1.createContext(defaultContext);
8475
- BaseContext.displayName = rootComponentName + "Context";
8476
- const index2 = defaultContexts.length;
8477
- defaultContexts = [...defaultContexts, defaultContext];
8478
- const Provider2 = (props) => {
8479
- var _a;
8480
- const { scope, children, ...context } = props;
8481
- const Context2 = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
8482
- const value = React$1.useMemo(() => context, Object.values(context));
8483
- return /* @__PURE__ */ jsx(Context2.Provider, { value, children });
8484
- };
8485
- Provider2.displayName = rootComponentName + "Provider";
8486
- function useContext2(consumerName, scope) {
8487
- var _a;
8488
- const Context2 = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
8489
- const context = React$1.useContext(Context2);
8490
- if (context)
8491
- return context;
8492
- if (defaultContext !== void 0)
8493
- return defaultContext;
8494
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
8495
- }
8496
- return [Provider2, useContext2];
8497
- }
8498
- const createScope = () => {
8499
- const scopeContexts = defaultContexts.map((defaultContext) => {
8500
- return React$1.createContext(defaultContext);
8501
- });
8502
- return function useScope(scope) {
8503
- const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
8504
- return React$1.useMemo(
8505
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
8506
- [scope, contexts]
8507
- );
8508
- };
8509
- };
8510
- createScope.scopeName = scopeName;
8511
- return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
8512
- }
8513
- function composeContextScopes(...scopes) {
8514
- const baseScope = scopes[0];
8515
- if (scopes.length === 1)
8516
- return baseScope;
8517
- const createScope = () => {
8518
- const scopeHooks = scopes.map((createScope2) => ({
8519
- useScope: createScope2(),
8520
- scopeName: createScope2.scopeName
8521
- }));
8522
- return function useComposedScopes(overrideScopes) {
8523
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
8524
- const scopeProps = useScope(overrideScopes);
8525
- const currentScope = scopeProps[`__scope${scopeName}`];
8526
- return { ...nextScopes2, ...currentScope };
8527
- }, {});
8528
- return React$1.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
8529
- };
8530
- };
8531
- createScope.scopeName = baseScope.scopeName;
8532
- return createScope;
8533
- }
8534
8563
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
8535
8564
  function getDefaultExportFromCjs(x2) {
8536
8565
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -8944,7 +8973,7 @@ const SheetDescription = React$1.forwardRef(({ className, ...props }, ref) => /*
8944
8973
  SheetDescription.displayName = Description.displayName;
8945
8974
  function createCollection(name) {
8946
8975
  const PROVIDER_NAME2 = name + "CollectionProvider";
8947
- const [createCollectionContext, createCollectionScope2] = createContextScope$1(PROVIDER_NAME2);
8976
+ const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME2);
8948
8977
  const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
8949
8978
  PROVIDER_NAME2,
8950
8979
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
@@ -9014,7 +9043,7 @@ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
9014
9043
  var EVENT_OPTIONS = { bubbles: false, cancelable: true };
9015
9044
  var GROUP_NAME$3 = "RovingFocusGroup";
9016
9045
  var [Collection$2, useCollection$2, createCollectionScope$2] = createCollection(GROUP_NAME$3);
9017
- var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope$1(
9046
+ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
9018
9047
  GROUP_NAME$3,
9019
9048
  [createCollectionScope$2]
9020
9049
  );
@@ -9081,7 +9110,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
9081
9110
  []
9082
9111
  ),
9083
9112
  children: /* @__PURE__ */ jsx(
9084
- Primitive$1.div,
9113
+ Primitive.div,
9085
9114
  {
9086
9115
  tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
9087
9116
  "data-orientation": orientation,
@@ -9146,7 +9175,7 @@ var RovingFocusGroupItem = React$1.forwardRef(
9146
9175
  focusable,
9147
9176
  active,
9148
9177
  children: /* @__PURE__ */ jsx(
9149
- Primitive$1.span,
9178
+ Primitive.span,
9150
9179
  {
9151
9180
  tabIndex: isCurrentTabStop ? 0 : -1,
9152
9181
  "data-orientation": context.orientation,
@@ -9231,7 +9260,7 @@ function wrapArray$2(array, startIndex) {
9231
9260
  var Root$2 = RovingFocusGroup;
9232
9261
  var Item$1 = RovingFocusGroupItem;
9233
9262
  var TABS_NAME = "Tabs";
9234
- var [createTabsContext, createTabsScope] = createContextScope$1(TABS_NAME, [
9263
+ var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
9235
9264
  createRovingFocusGroupScope
9236
9265
  ]);
9237
9266
  var useRovingFocusGroupScope$1 = createRovingFocusGroupScope();
@@ -9266,7 +9295,7 @@ var Tabs$1 = React$1.forwardRef(
9266
9295
  dir: direction,
9267
9296
  activationMode,
9268
9297
  children: /* @__PURE__ */ jsx(
9269
- Primitive$1.div,
9298
+ Primitive.div,
9270
9299
  {
9271
9300
  dir: direction,
9272
9301
  "data-orientation": orientation,
@@ -9294,7 +9323,7 @@ var TabsList$1 = React$1.forwardRef(
9294
9323
  dir: context.dir,
9295
9324
  loop,
9296
9325
  children: /* @__PURE__ */ jsx(
9297
- Primitive$1.div,
9326
+ Primitive.div,
9298
9327
  {
9299
9328
  role: "tablist",
9300
9329
  "aria-orientation": context.orientation,
@@ -9324,7 +9353,7 @@ var TabsTrigger$1 = React$1.forwardRef(
9324
9353
  focusable: !disabled,
9325
9354
  active: isSelected,
9326
9355
  children: /* @__PURE__ */ jsx(
9327
- Primitive$1.button,
9356
+ Primitive.button,
9328
9357
  {
9329
9358
  type: "button",
9330
9359
  role: "tab",
@@ -9374,7 +9403,7 @@ var TabsContent$1 = React$1.forwardRef(
9374
9403
  return () => cancelAnimationFrame(rAF);
9375
9404
  }, []);
9376
9405
  return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
9377
- Primitive$1.div,
9406
+ Primitive.div,
9378
9407
  {
9379
9408
  "data-state": isSelected ? "active" : "inactive",
9380
9409
  "data-orientation": context.orientation,
@@ -11754,7 +11783,7 @@ var NAME$2 = "Arrow";
11754
11783
  var Arrow$1 = React$1.forwardRef((props, forwardedRef) => {
11755
11784
  const { children, width = 10, height = 5, ...arrowProps } = props;
11756
11785
  return /* @__PURE__ */ jsx(
11757
- Primitive$1.svg,
11786
+ Primitive.svg,
11758
11787
  {
11759
11788
  ...arrowProps,
11760
11789
  ref: forwardedRef,
@@ -11803,7 +11832,7 @@ function useSize(element) {
11803
11832
  return size2;
11804
11833
  }
11805
11834
  var POPPER_NAME = "Popper";
11806
- var [createPopperContext, createPopperScope] = createContextScope$1(POPPER_NAME);
11835
+ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
11807
11836
  var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
11808
11837
  var Popper = (props) => {
11809
11838
  const { __scopePopper, children } = props;
@@ -11826,7 +11855,7 @@ var PopperAnchor = React$1.forwardRef(
11826
11855
  context.onAnchorChange(anchorRef.current);
11827
11856
  }
11828
11857
  });
11829
- return virtualRef ? null : /* @__PURE__ */ jsx(Primitive$1.div, { ...anchorProps, ref: composedRefs });
11858
+ return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
11830
11859
  }
11831
11860
  );
11832
11861
  PopperAnchor.displayName = ANCHOR_NAME$2;
@@ -11955,7 +11984,7 @@ var PopperContent = React$1.forwardRef(
11955
11984
  arrowY,
11956
11985
  shouldHideArrow: cannotCenterArrow,
11957
11986
  children: /* @__PURE__ */ jsx(
11958
- Primitive$1.div,
11987
+ Primitive.div,
11959
11988
  {
11960
11989
  "data-side": placedSide,
11961
11990
  "data-align": placedAlign,
@@ -12091,7 +12120,7 @@ var NAME$1 = "VisuallyHidden";
12091
12120
  var VisuallyHidden = React$1.forwardRef(
12092
12121
  (props, forwardedRef) => {
12093
12122
  return /* @__PURE__ */ jsx(
12094
- Primitive$1.span,
12123
+ Primitive.span,
12095
12124
  {
12096
12125
  ...props,
12097
12126
  ref: forwardedRef,
@@ -12102,7 +12131,7 @@ var VisuallyHidden = React$1.forwardRef(
12102
12131
  );
12103
12132
  VisuallyHidden.displayName = NAME$1;
12104
12133
  var Root = VisuallyHidden;
12105
- var [createTooltipContext, createTooltipScope] = createContextScope$1("Tooltip", [
12134
+ var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
12106
12135
  createPopperScope
12107
12136
  ]);
12108
12137
  var usePopperScope$3 = createPopperScope();
@@ -12263,7 +12292,7 @@ var TooltipTrigger$1 = React$1.forwardRef(
12263
12292
  return () => document.removeEventListener("pointerup", handlePointerUp);
12264
12293
  }, [handlePointerUp]);
12265
12294
  return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
12266
- Primitive$1.button,
12295
+ Primitive.button,
12267
12296
  {
12268
12297
  "aria-describedby": context.open ? context.contentId : void 0,
12269
12298
  "data-state": context.stateAttribute,
@@ -12615,7 +12644,7 @@ const CommentToggle = ({
12615
12644
  return /* @__PURE__ */ jsx(
12616
12645
  "div",
12617
12646
  {
12618
- className: "cteditor-flex cteditor-bg-background cteditor-text-foreground cteditor-px-2.5 cteditor-py-[7px] cteditor-rounded-lg cteditor-h-11 cteditor-items-center cteditor-justify-center cteditor-ml-2\n",
12647
+ className: "cteditor-flex cteditor-bg-background cteditor-text-foreground cteditor-px-2.5 cteditor-py-[7px] cteditor-rounded-lg cteditor-h-11 cteditor-items-center cteditor-justify-center cteditor-ml-2\r\n",
12619
12648
  children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
12620
12649
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
12621
12650
  Button,
@@ -12798,44 +12827,23 @@ const HtmlViewDisplay = () => {
12798
12827
  return "Sync to Editor";
12799
12828
  }
12800
12829
  };
12801
- return /* @__PURE__ */ jsxs("div", { className: "htmlView", style: { marginTop: "16px" }, children: [
12830
+ return /* @__PURE__ */ jsx("div", { className: "htmlView cteditor-text-background cteditor-absolute cteditor-top-0 cteditor-pt-16 cteditor-left-0 cteditor-w-full cteditor-flex cteditor-flex-col cteditor-h-full cteditor-p-2 ", children: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-h-full cteditor-p-2 cteditor-bg-background cteditor-border cteditor-border-background/10 cteditor-rounded-md", children: [
12802
12831
  /* @__PURE__ */ jsxs(
12803
12832
  "div",
12804
12833
  {
12805
- style: {
12806
- display: "flex",
12807
- justifyContent: "space-between",
12808
- alignItems: "center",
12809
- marginBottom: "8px",
12810
- padding: "8px 12px",
12811
- background: isUserTyping ? "hsl(var(--accent))" : "hsl(var(--muted))",
12812
- borderRadius: "6px",
12813
- fontSize: "12px",
12814
- color: isUserTyping ? "hsl(var(--accent-foreground))" : "hsl(var(--muted-foreground))"
12815
- },
12834
+ className: "cteditor-flex cteditor-justify-between cteditor-rounded-lg cteditor-pb-2 cteditor-text-sm cteditor-text-foreground cteditor-items-center",
12816
12835
  children: [
12817
- /* @__PURE__ */ jsx("span", { children: "HTML View" }),
12818
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
12836
+ /* @__PURE__ */ jsx("span", { className: "cteditor-text-xs", children: "HTML View" }),
12837
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
12819
12838
  isUserTyping && /* @__PURE__ */ jsxs(
12820
12839
  "span",
12821
12840
  {
12822
- style: {
12823
- display: "flex",
12824
- alignItems: "center",
12825
- gap: "4px",
12826
- fontWeight: "500"
12827
- },
12841
+ className: "cteditor-flex cteditor-items-center cteditor-gap-4 cteditor-font-medium cteditor-text-xs",
12828
12842
  children: [
12829
12843
  /* @__PURE__ */ jsx(
12830
12844
  "div",
12831
12845
  {
12832
- style: {
12833
- width: "6px",
12834
- height: "6px",
12835
- borderRadius: "50%",
12836
- background: "currentColor",
12837
- animation: "pulse 1.5s ease-in-out infinite"
12838
- }
12846
+ className: "cteditor-size-1.5 cteditor-rounded-full cteditor-bg-current cteditor-animate-[pulse_1.5s_ease-in-out_infinite]"
12839
12847
  }
12840
12848
  ),
12841
12849
  "Editing..."
@@ -12907,27 +12915,11 @@ const HtmlViewDisplay = () => {
12907
12915
  onBlur: handleTextareaBlur,
12908
12916
  onClick: handleTextareaClick,
12909
12917
  onKeyDown: handleTextareaKeyDown,
12910
- style: {
12911
- background: "hsl(var(--background))",
12912
- color: "hsl(var(--foreground))",
12913
- width: "100%",
12914
- height: "400px",
12915
- fontFamily: "monospace",
12916
- fontSize: "13px",
12917
- padding: "12px",
12918
- border: `1px solid ${isUserTyping ? "hsl(var(--accent))" : "hsl(var(--border))"}`,
12919
- borderRadius: "8px",
12920
- resize: "vertical",
12921
- lineHeight: "1.4",
12922
- outline: "none",
12923
- transition: "border-color 0.2s ease",
12924
- whiteSpace: "pre-wrap",
12925
- wordWrap: "break-word"
12926
- },
12918
+ className: " cteditor-w-full cteditor-flex-1\r\n cteditor-font-mono cteditor-text-[13px] \r\n cteditor-p-3 \r\n cteditor-border cteditor-rounded-lg \r\n cteditor-resize-y cteditor-leading-[1.4] \r\n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \r\n cteditor-whitespace-pre-wrap cteditor-break-words\r\n",
12927
12919
  placeholder: "HTML content will appear here... Edit and click 'Sync to Editor' to apply changes."
12928
12920
  }
12929
12921
  )
12930
- ] });
12922
+ ] }) });
12931
12923
  };
12932
12924
  const PDF_CONFIG = {
12933
12925
  A4_WIDTH: "210mm",
@@ -12948,10 +12940,10 @@ const PDF_CONFIG = {
12948
12940
  };
12949
12941
  const loadHtml2Pdf = async () => {
12950
12942
  try {
12951
- const mod = await import("./html2pdf.bundle.min-8fcf4f01.js").then((n) => n.h);
12943
+ const mod = await import("./html2pdf.bundle.min-64f254e4.js").then((n) => n.h);
12952
12944
  return (mod == null ? void 0 : mod.default) || mod;
12953
12945
  } catch {
12954
- const mod2 = await import("./html2pdf.bundle-5c5747c7.js").then((n) => n.h);
12946
+ const mod2 = await import("./html2pdf.bundle-c0e42624.js").then((n) => n.h);
12955
12947
  return (mod2 == null ? void 0 : mod2.default) || mod2;
12956
12948
  }
12957
12949
  };
@@ -14158,7 +14150,115 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
14158
14150
  }
14159
14151
  );
14160
14152
  };
14161
- const ImageView = React__default.lazy(() => import("./index-48519641.js"));
14153
+ const FileComponent = React$1.lazy(() => import("./index-46b9ecb6.js"));
14154
+ function convertFileElement(domNode) {
14155
+ if (domNode instanceof HTMLDivElement) {
14156
+ const dataUrl = domNode.getAttribute("data-lexical-file-src");
14157
+ const fileName = domNode.getAttribute("data-lexical-file-name");
14158
+ if (dataUrl && fileName) {
14159
+ const node = $createFileNode({ src: dataUrl, fileName });
14160
+ return { node };
14161
+ }
14162
+ }
14163
+ return null;
14164
+ }
14165
+ class FileNode extends DecoratorNode {
14166
+ constructor(src, fileName, fileSize, key) {
14167
+ super(key);
14168
+ __publicField(this, "__src");
14169
+ __publicField(this, "__fileName");
14170
+ __publicField(this, "__fileSize");
14171
+ this.__src = src;
14172
+ this.__fileName = fileName;
14173
+ this.__fileSize = fileSize;
14174
+ }
14175
+ static getType() {
14176
+ return "file";
14177
+ }
14178
+ static clone(node) {
14179
+ return new FileNode(node.__src, node.__fileName, node.__fileSize, node.__key);
14180
+ }
14181
+ static importJSON(serializedNode) {
14182
+ const { src, fileName, fileSize } = serializedNode;
14183
+ const node = $createFileNode({
14184
+ src,
14185
+ fileName,
14186
+ fileSize
14187
+ });
14188
+ return node;
14189
+ }
14190
+ exportDOM() {
14191
+ const element = document.createElement("div");
14192
+ element.setAttribute("data-lexical-file-src", this.__src);
14193
+ element.setAttribute("data-lexical-file-name", this.__fileName);
14194
+ if (this.__fileSize) {
14195
+ element.setAttribute("data-lexical-file-size", this.__fileSize.toString());
14196
+ }
14197
+ return { element };
14198
+ }
14199
+ static importDOM() {
14200
+ return {
14201
+ div: (node) => ({
14202
+ conversion: convertFileElement,
14203
+ priority: 0
14204
+ })
14205
+ };
14206
+ }
14207
+ exportJSON() {
14208
+ return {
14209
+ src: this.__src,
14210
+ fileName: this.__fileName,
14211
+ fileSize: this.__fileSize,
14212
+ type: "file",
14213
+ version: 1
14214
+ };
14215
+ }
14216
+ // View
14217
+ createDOM(config) {
14218
+ const span = document.createElement("span");
14219
+ const theme2 = config.theme;
14220
+ const className = theme2.file;
14221
+ if (className !== void 0) {
14222
+ span.className = className;
14223
+ }
14224
+ return span;
14225
+ }
14226
+ updateDOM() {
14227
+ return false;
14228
+ }
14229
+ getSrc() {
14230
+ return this.__src;
14231
+ }
14232
+ getFileName() {
14233
+ return this.__fileName;
14234
+ }
14235
+ getFileSize() {
14236
+ return this.__fileSize;
14237
+ }
14238
+ decorate() {
14239
+ try {
14240
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading file..." }), children: /* @__PURE__ */ jsx(
14241
+ FileComponent,
14242
+ {
14243
+ src: this.__src,
14244
+ fileName: this.__fileName,
14245
+ fileSize: this.__fileSize,
14246
+ nodeKey: this.getKey()
14247
+ }
14248
+ ) });
14249
+ } catch (error) {
14250
+ console.error("Error decorating FileNode:", error, { src: this.__src, fileName: this.__fileName });
14251
+ return /* @__PURE__ */ jsx("div", { children: "Error loading file" });
14252
+ }
14253
+ }
14254
+ }
14255
+ function $createFileNode({ src, fileName, fileSize, key }) {
14256
+ return new FileNode(src, fileName, fileSize, key);
14257
+ }
14258
+ function $isFileNode(node) {
14259
+ return node instanceof FileNode;
14260
+ }
14261
+ const ImageView = React__default.lazy(() => import("./index-2e8a7483.js"));
14162
14262
  function isGoogleDocCheckboxImg(img) {
14163
14263
  return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
14164
14264
  }
@@ -15824,6 +15924,7 @@ const EDITOR_NODES = [
15824
15924
  TableRowNode,
15825
15925
  ImageNode,
15826
15926
  EmbedNode,
15927
+ FileNode,
15827
15928
  MentionNode,
15828
15929
  NotePanelNode,
15829
15930
  CommentNode,
@@ -16613,6 +16714,7 @@ function AIChatPlugin({
16613
16714
  const [editor] = useLexicalComposerContext();
16614
16715
  return useAIChatToolbar(editor, apiKey);
16615
16716
  }
16717
+ const OPEN_TABLE_MODAL_COMMAND = createCommand();
16616
16718
  const getContrastColor = (hexColor) => {
16617
16719
  const hex = hexColor.replace("#", "");
16618
16720
  const r2 = parseInt(hex.substr(0, 2), 16);
@@ -16630,6 +16732,16 @@ function TableOptionPlugin() {
16630
16732
  const [headerColor, setHeaderColor] = useState$1("#4A90E2");
16631
16733
  const [editor] = useLexicalComposerContext();
16632
16734
  const headerCellsMapRef = useRef(/* @__PURE__ */ new Map());
16735
+ useEffect$1(() => {
16736
+ return editor.registerCommand(
16737
+ OPEN_TABLE_MODAL_COMMAND,
16738
+ () => {
16739
+ setIsOpen(true);
16740
+ return true;
16741
+ },
16742
+ COMMAND_PRIORITY_EDITOR
16743
+ );
16744
+ }, [editor]);
16633
16745
  useEffect$1(() => {
16634
16746
  const headerCellsMap = headerCellsMapRef.current;
16635
16747
  const reapplyHeaderStyles = () => {
@@ -16842,7 +16954,7 @@ function TableOptionPlugin() {
16842
16954
  setColumnHeadings([]);
16843
16955
  }
16844
16956
  },
16845
- className: "\n cteditor-peer\n cteditor-appearance-none\n cteditor-w-5 cteditor-h-5\n cteditor-border cteditor-border-gray-400 cteditor-rounded\n cteditor-transition-all cteditor-duration-200\n checked:cteditor-bg-blue-600 checked:cteditor-border-blue-600\n hover:cteditor-border-blue-500 [&>span]:checked:cteditor-opacity-100\n \n "
16957
+ className: "\r\n cteditor-peer\r\n cteditor-appearance-none\r\n cteditor-w-5 cteditor-h-5\r\n cteditor-border cteditor-border-gray-400 cteditor-rounded\r\n cteditor-transition-all cteditor-duration-200\r\n checked:cteditor-bg-blue-600 checked:cteditor-border-blue-600\r\n hover:cteditor-border-blue-500 [&>span]:checked:cteditor-opacity-100\r\n \r\n "
16846
16958
  }
16847
16959
  ),
16848
16960
  /* @__PURE__ */ jsx("span", { className: "cteditor-absolute cteditor-top-1/2 cteditor-left-1/2 [&>svg]:cteditor-size-4 -cteditor-translate-x-1/2 -cteditor-translate-y-1/2 cteditor-opacity-0 peer-checked:cteditor-opacity-100", children: /* @__PURE__ */ jsx(CheckIcon, {}) })
@@ -17377,7 +17489,7 @@ var SUB_CLOSE_KEYS = {
17377
17489
  };
17378
17490
  var MENU_NAME = "Menu";
17379
17491
  var [Collection$1, useCollection$1, createCollectionScope$1] = createCollection(MENU_NAME);
17380
- var [createMenuContext, createMenuScope] = createContextScope$1(MENU_NAME, [
17492
+ var [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [
17381
17493
  createCollectionScope$1,
17382
17494
  createPopperScope,
17383
17495
  createRovingFocusGroupScope
@@ -17704,7 +17816,7 @@ var GROUP_NAME$2 = "MenuGroup";
17704
17816
  var MenuGroup = React$1.forwardRef(
17705
17817
  (props, forwardedRef) => {
17706
17818
  const { __scopeMenu, ...groupProps } = props;
17707
- return /* @__PURE__ */ jsx(Primitive$1.div, { role: "group", ...groupProps, ref: forwardedRef });
17819
+ return /* @__PURE__ */ jsx(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
17708
17820
  }
17709
17821
  );
17710
17822
  MenuGroup.displayName = GROUP_NAME$2;
@@ -17712,7 +17824,7 @@ var LABEL_NAME$2 = "MenuLabel";
17712
17824
  var MenuLabel = React$1.forwardRef(
17713
17825
  (props, forwardedRef) => {
17714
17826
  const { __scopeMenu, ...labelProps } = props;
17715
- return /* @__PURE__ */ jsx(Primitive$1.div, { ...labelProps, ref: forwardedRef });
17827
+ return /* @__PURE__ */ jsx(Primitive.div, { ...labelProps, ref: forwardedRef });
17716
17828
  }
17717
17829
  );
17718
17830
  MenuLabel.displayName = LABEL_NAME$2;
@@ -17792,7 +17904,7 @@ var MenuItemImpl = React$1.forwardRef(
17792
17904
  disabled,
17793
17905
  textValue: textValue ?? textContent,
17794
17906
  children: /* @__PURE__ */ jsx(Item$1, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(
17795
- Primitive$1.div,
17907
+ Primitive.div,
17796
17908
  {
17797
17909
  role: "menuitem",
17798
17910
  "data-highlighted": isFocused ? "" : void 0,
@@ -17903,7 +18015,7 @@ var MenuItemIndicator = React$1.forwardRef(
17903
18015
  {
17904
18016
  present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
17905
18017
  children: /* @__PURE__ */ jsx(
17906
- Primitive$1.span,
18018
+ Primitive.span,
17907
18019
  {
17908
18020
  ...itemIndicatorProps,
17909
18021
  ref: forwardedRef,
@@ -17920,7 +18032,7 @@ var MenuSeparator = React$1.forwardRef(
17920
18032
  (props, forwardedRef) => {
17921
18033
  const { __scopeMenu, ...separatorProps } = props;
17922
18034
  return /* @__PURE__ */ jsx(
17923
- Primitive$1.div,
18035
+ Primitive.div,
17924
18036
  {
17925
18037
  role: "separator",
17926
18038
  "aria-orientation": "horizontal",
@@ -17974,7 +18086,7 @@ var MenuSubTrigger = React$1.forwardRef(
17974
18086
  "aria-controls": subContext.contentId,
17975
18087
  "data-state": getOpenState(context.open),
17976
18088
  ...props,
17977
- ref: composeRefs(forwardedRef, subContext.onTriggerChange),
18089
+ ref: composeRefs$1(forwardedRef, subContext.onTriggerChange),
17978
18090
  onClick: (event) => {
17979
18091
  var _a;
17980
18092
  (_a = props.onClick) == null ? void 0 : _a.call(props, event);
@@ -18180,7 +18292,7 @@ var Arrow2 = MenuArrow;
18180
18292
  var SubTrigger = MenuSubTrigger;
18181
18293
  var SubContent = MenuSubContent;
18182
18294
  var DROPDOWN_MENU_NAME = "DropdownMenu";
18183
- var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope$1(
18295
+ var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
18184
18296
  DROPDOWN_MENU_NAME,
18185
18297
  [createMenuScope]
18186
18298
  );
@@ -18227,7 +18339,7 @@ var DropdownMenuTrigger$1 = React$1.forwardRef(
18227
18339
  const context = useDropdownMenuContext(TRIGGER_NAME$2, __scopeDropdownMenu);
18228
18340
  const menuScope = useMenuScope(__scopeDropdownMenu);
18229
18341
  return /* @__PURE__ */ jsx(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx(
18230
- Primitive$1.button,
18342
+ Primitive.button,
18231
18343
  {
18232
18344
  type: "button",
18233
18345
  id: context.triggerId,
@@ -18238,7 +18350,7 @@ var DropdownMenuTrigger$1 = React$1.forwardRef(
18238
18350
  "data-disabled": disabled ? "" : void 0,
18239
18351
  disabled,
18240
18352
  ...triggerProps,
18241
- ref: composeRefs(forwardedRef, context.triggerRef),
18353
+ ref: composeRefs$1(forwardedRef, context.triggerRef),
18242
18354
  onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
18243
18355
  if (!disabled && event.button === 0 && event.ctrlKey === false) {
18244
18356
  context.onOpenToggle();
@@ -18564,14 +18676,14 @@ const AlignMenu = () => {
18564
18676
  {
18565
18677
  variant: "ghost",
18566
18678
  size: "sm",
18567
- className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-h-7 cteditor-rounded-sm cteditor-px-2\n",
18679
+ className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-h-7 cteditor-rounded-sm cteditor-px-2\r\n",
18568
18680
  children: [
18569
18681
  /* @__PURE__ */ jsx(AlignLeft, { className: "!cteditor-size-4" }),
18570
18682
  "Align",
18571
18683
  /* @__PURE__ */ jsx(
18572
18684
  ChevronDown,
18573
18685
  {
18574
- className: "!cteditor-size-4 cteditor-opacity-50\n"
18686
+ className: "!cteditor-size-4 cteditor-opacity-50\r\n"
18575
18687
  }
18576
18688
  )
18577
18689
  ]
@@ -18969,7 +19081,7 @@ var V = "undefined" != typeof window ? useLayoutEffect$1 : useEffect$1, $ = func
18969
19081
  return React__default.createElement(U, u({}, r2, { colorModel: W }));
18970
19082
  };
18971
19083
  var POPOVER_NAME = "Popover";
18972
- var [createPopoverContext, createPopoverScope] = createContextScope$1(POPOVER_NAME, [
19084
+ var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
18973
19085
  createPopperScope
18974
19086
  ]);
18975
19087
  var usePopperScope$1 = createPopperScope();
@@ -19033,7 +19145,7 @@ var PopoverTrigger$1 = React$1.forwardRef(
19033
19145
  const popperScope = usePopperScope$1(__scopePopover);
19034
19146
  const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
19035
19147
  const trigger = /* @__PURE__ */ jsx(
19036
- Primitive$1.button,
19148
+ Primitive.button,
19037
19149
  {
19038
19150
  type: "button",
19039
19151
  "aria-haspopup": "dialog",
@@ -19226,7 +19338,7 @@ var PopoverClose = React$1.forwardRef(
19226
19338
  const { __scopePopover, ...closeProps } = props;
19227
19339
  const context = usePopoverContext(CLOSE_NAME, __scopePopover);
19228
19340
  return /* @__PURE__ */ jsx(
19229
- Primitive$1.button,
19341
+ Primitive.button,
19230
19342
  {
19231
19343
  type: "button",
19232
19344
  ...closeProps,
@@ -19462,7 +19574,7 @@ const ColorPicker$2 = ({
19462
19574
  "button",
19463
19575
  {
19464
19576
  onClick: () => setShowAdvanced(!showAdvanced),
19465
- className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\n",
19577
+ className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\r\n",
19466
19578
  children: [
19467
19579
  /* @__PURE__ */ jsx("span", { className: "cteditor-text-xs", children: showAdvanced ? "▼" : "▶" }),
19468
19580
  showAdvanced ? "Hide Advanced" : "Show Advanced"
@@ -19591,7 +19703,7 @@ var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
19591
19703
  var SELECTION_KEYS = [" ", "Enter"];
19592
19704
  var SELECT_NAME = "Select";
19593
19705
  var [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);
19594
- var [createSelectContext, createSelectScope] = createContextScope$1(SELECT_NAME, [
19706
+ var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
19595
19707
  createCollectionScope,
19596
19708
  createPopperScope
19597
19709
  ]);
@@ -19728,7 +19840,7 @@ var SelectTrigger$1 = React$1.forwardRef(
19728
19840
  }
19729
19841
  };
19730
19842
  return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
19731
- Primitive$1.button,
19843
+ Primitive.button,
19732
19844
  {
19733
19845
  type: "button",
19734
19846
  role: "combobox",
@@ -19789,7 +19901,7 @@ var SelectValue$1 = React$1.forwardRef(
19789
19901
  onValueNodeHasChildrenChange(hasChildren);
19790
19902
  }, [onValueNodeHasChildrenChange, hasChildren]);
19791
19903
  return /* @__PURE__ */ jsx(
19792
- Primitive$1.span,
19904
+ Primitive.span,
19793
19905
  {
19794
19906
  ...valueProps,
19795
19907
  ref: composedRefs,
@@ -19804,7 +19916,7 @@ var ICON_NAME = "SelectIcon";
19804
19916
  var SelectIcon = React$1.forwardRef(
19805
19917
  (props, forwardedRef) => {
19806
19918
  const { __scopeSelect, children, ...iconProps } = props;
19807
- return /* @__PURE__ */ jsx(Primitive$1.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "▼" });
19919
+ return /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "▼" });
19808
19920
  }
19809
19921
  );
19810
19922
  SelectIcon.displayName = ICON_NAME;
@@ -20224,7 +20336,7 @@ var SelectItemAlignedPosition = React$1.forwardRef((props, forwardedRef) => {
20224
20336
  zIndex: contentZIndex
20225
20337
  },
20226
20338
  children: /* @__PURE__ */ jsx(
20227
- Primitive$1.div,
20339
+ Primitive.div,
20228
20340
  {
20229
20341
  ...popperProps,
20230
20342
  ref: composedRefs,
@@ -20298,7 +20410,7 @@ var SelectViewport = React$1.forwardRef(
20298
20410
  }
20299
20411
  ),
20300
20412
  /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
20301
- Primitive$1.div,
20413
+ Primitive.div,
20302
20414
  {
20303
20415
  "data-radix-select-viewport": "",
20304
20416
  role: "presentation",
@@ -20353,7 +20465,7 @@ var SelectGroup = React$1.forwardRef(
20353
20465
  (props, forwardedRef) => {
20354
20466
  const { __scopeSelect, ...groupProps } = props;
20355
20467
  const groupId = useId();
20356
- return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive$1.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
20468
+ return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
20357
20469
  }
20358
20470
  );
20359
20471
  SelectGroup.displayName = GROUP_NAME;
@@ -20362,7 +20474,7 @@ var SelectLabel$1 = React$1.forwardRef(
20362
20474
  (props, forwardedRef) => {
20363
20475
  const { __scopeSelect, ...labelProps } = props;
20364
20476
  const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
20365
- return /* @__PURE__ */ jsx(Primitive$1.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
20477
+ return /* @__PURE__ */ jsx(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
20366
20478
  }
20367
20479
  );
20368
20480
  SelectLabel$1.displayName = LABEL_NAME;
@@ -20421,7 +20533,7 @@ var SelectItem$1 = React$1.forwardRef(
20421
20533
  disabled,
20422
20534
  textValue,
20423
20535
  children: /* @__PURE__ */ jsx(
20424
- Primitive$1.div,
20536
+ Primitive.div,
20425
20537
  {
20426
20538
  role: "option",
20427
20539
  "aria-labelledby": textId,
@@ -20509,7 +20621,7 @@ var SelectItemText = React$1.forwardRef(
20509
20621
  return () => onNativeOptionRemove(nativeOption);
20510
20622
  }, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
20511
20623
  return /* @__PURE__ */ jsxs(Fragment, { children: [
20512
- /* @__PURE__ */ jsx(Primitive$1.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
20624
+ /* @__PURE__ */ jsx(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
20513
20625
  itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null
20514
20626
  ] });
20515
20627
  }
@@ -20520,7 +20632,7 @@ var SelectItemIndicator = React$1.forwardRef(
20520
20632
  (props, forwardedRef) => {
20521
20633
  const { __scopeSelect, ...itemIndicatorProps } = props;
20522
20634
  const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
20523
- return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive$1.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
20635
+ return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
20524
20636
  }
20525
20637
  );
20526
20638
  SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
@@ -20611,7 +20723,7 @@ var SelectScrollButtonImpl = React$1.forwardRef((props, forwardedRef) => {
20611
20723
  (_a = activeItem == null ? void 0 : activeItem.ref.current) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
20612
20724
  }, [getItems]);
20613
20725
  return /* @__PURE__ */ jsx(
20614
- Primitive$1.div,
20726
+ Primitive.div,
20615
20727
  {
20616
20728
  "aria-hidden": true,
20617
20729
  ...scrollIndicatorProps,
@@ -20639,7 +20751,7 @@ var SEPARATOR_NAME = "SelectSeparator";
20639
20751
  var SelectSeparator$1 = React$1.forwardRef(
20640
20752
  (props, forwardedRef) => {
20641
20753
  const { __scopeSelect, ...separatorProps } = props;
20642
- return /* @__PURE__ */ jsx(Primitive$1.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
20754
+ return /* @__PURE__ */ jsx(Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
20643
20755
  }
20644
20756
  );
20645
20757
  SelectSeparator$1.displayName = SEPARATOR_NAME;
@@ -20677,7 +20789,7 @@ var SelectBubbleInput = React$1.forwardRef(
20677
20789
  }
20678
20790
  }, [prevValue, value]);
20679
20791
  return /* @__PURE__ */ jsx(
20680
- Primitive$1.select,
20792
+ Primitive.select,
20681
20793
  {
20682
20794
  ...props,
20683
20795
  style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },
@@ -21192,78 +21304,30 @@ const FilePlugin = () => {
21192
21304
  useEffect$1(() => {
21193
21305
  return editor.registerCommand(
21194
21306
  INSERT_FILE_COMMAND,
21195
- ({ src, linkText }) => {
21196
- console.log("Received INSERT_FILE_COMMAND with:", { src, linkText });
21307
+ ({ src, linkText, fileSize }) => {
21308
+ console.log("Received INSERT_FILE_COMMAND with:", { src, linkText, fileSize });
21197
21309
  try {
21198
21310
  editor.update(() => {
21199
21311
  editor.focus();
21200
21312
  const selection = $getSelection();
21201
- console.log("Current Selection after focus:", selection);
21202
- const isPreviewable = src.match(
21203
- /\.(mp4|webm|ogg|pdf|docx?|xlsx?|pptx?|zip|rar|txt|csv|json|png|jpe?g|gif|webp|svg)$/i
21204
- );
21205
- let embedSuccess = false;
21206
- if (isPreviewable) {
21207
- try {
21208
- console.log("Embedding file preview using EmbedNode.");
21209
- if ($isRangeSelection(selection)) {
21210
- selection.insertNodes([$createEmbedNode(src)]);
21211
- } else {
21212
- console.warn(
21213
- "No valid range selection found. Creating a new paragraph."
21214
- );
21215
- const paragraphNode = $createParagraphNode();
21216
- paragraphNode.append($createEmbedNode(src));
21217
- const root2 = editor.getEditorState().read(() => $getRoot());
21218
- root2.append(paragraphNode);
21219
- }
21220
- embedSuccess = true;
21221
- } catch (embedError) {
21222
- console.error("Failed to create EmbedNode, falling back to link:", embedError);
21223
- embedSuccess = false;
21224
- }
21225
- }
21226
- if (!embedSuccess) {
21227
- console.log("Inserting file as a simple link.");
21228
- const linkNode = $createLinkNode(src);
21229
- linkNode.setURL(src);
21230
- linkNode.append($createTextNode(linkText || src.split("/").pop() || "Download File"));
21231
- if ($isRangeSelection(selection)) {
21232
- selection.insertNodes([linkNode]);
21233
- } else {
21234
- console.warn(
21235
- "No valid range selection found. Creating a new paragraph."
21236
- );
21237
- const paragraphNode = $createParagraphNode();
21238
- paragraphNode.append(linkNode);
21239
- const root2 = editor.getEditorState().read(() => $getRoot());
21240
- root2.append(paragraphNode);
21241
- }
21313
+ const fileNode = $createFileNode({
21314
+ src,
21315
+ fileName: linkText || src.split("/").pop() || "Download File",
21316
+ fileSize
21317
+ });
21318
+ if ($isRangeSelection(selection)) {
21319
+ selection.insertNodes([fileNode]);
21320
+ } else {
21321
+ const paragraphNode = $createParagraphNode();
21322
+ paragraphNode.append(fileNode);
21323
+ const root2 = editor.getEditorState().read(() => $getRoot());
21324
+ root2.append(paragraphNode);
21242
21325
  }
21243
21326
  });
21244
21327
  return true;
21245
21328
  } catch (error) {
21246
21329
  console.error("Error in INSERT_FILE_COMMAND handler:", error);
21247
- try {
21248
- editor.update(() => {
21249
- const selection = $getSelection();
21250
- const linkNode = $createLinkNode(src);
21251
- linkNode.append($createTextNode(linkText || src.split("/").pop() || "Download File"));
21252
- if ($isRangeSelection(selection)) {
21253
- selection.insertNodes([linkNode]);
21254
- } else {
21255
- const paragraphNode = $createParagraphNode();
21256
- paragraphNode.append(linkNode);
21257
- const root2 = editor.getEditorState().read(() => $getRoot());
21258
- root2.append(paragraphNode);
21259
- }
21260
- });
21261
- console.log("Successfully inserted file as fallback link");
21262
- return true;
21263
- } catch (fallbackError) {
21264
- console.error("Complete failure to insert file:", fallbackError);
21265
- return false;
21266
- }
21330
+ return false;
21267
21331
  }
21268
21332
  },
21269
21333
  0
@@ -21403,7 +21467,7 @@ const InsertFileUploadedDialogBody = ({ onClick }) => {
21403
21467
  if (!url)
21404
21468
  return;
21405
21469
  console.log("Dispatching command with URL:", url, "Link text:", linkText);
21406
- onClick({ linkText: linkText || url, src: url });
21470
+ onClick({ linkText: linkText || fileToUpload.name, src: url });
21407
21471
  setFileToUpload(null);
21408
21472
  setLinkText("");
21409
21473
  } catch (uploadError) {
@@ -22663,8 +22727,8 @@ const SignatureCanvasDialog = ({
22663
22727
  setIsEmpty(false);
22664
22728
  setUploadedImage(null);
22665
22729
  };
22666
- const handleColorChange = (event) => {
22667
- setPenColor(event.target.value);
22730
+ const handleColorChange = (color) => {
22731
+ setPenColor(color);
22668
22732
  };
22669
22733
  const handleUpload = (event) => {
22670
22734
  var _a;
@@ -22683,17 +22747,15 @@ const SignatureCanvasDialog = ({
22683
22747
  /* @__PURE__ */ jsx("div", { className: "cteditor-text-lg cteditor-font-medium", children: "Draw your signature" }),
22684
22748
  /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-justify-between cteditor-gap-3 cteditor-items-center", children: [
22685
22749
  /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-gap-2 cteditor-items-center", children: [
22686
- /* @__PURE__ */ jsx("label", { htmlFor: "penColor", children: "Choose Color:" }),
22687
- /* @__PURE__ */ jsx("div", { className: "cteditor-size-8 cteditor-overflow-hidden cteditor-relative cteditor-rounded-md cteditor-border cteditor-border-foreground/5", children: /* @__PURE__ */ jsx(
22688
- "input",
22750
+ /* @__PURE__ */ jsx("label", { children: "Choose Color:" }),
22751
+ /* @__PURE__ */ jsx(
22752
+ ColorPicker$2,
22689
22753
  {
22690
- type: "color",
22691
- id: "penColor",
22692
- value: penColor,
22754
+ title: "Pen Color",
22693
22755
  onChange: handleColorChange,
22694
- className: "cteditor-scale-[5] cteditor-absolute cteditor-inset-0 cteditor-cursor-pointer"
22756
+ icon: /* @__PURE__ */ jsx("div", { className: "cteditor-w-4 cteditor-h-4", style: { backgroundColor: penColor } })
22695
22757
  }
22696
- ) })
22758
+ )
22697
22759
  ] }),
22698
22760
  /* @__PURE__ */ jsxs("div", { children: [
22699
22761
  /* @__PURE__ */ jsx("label", { htmlFor: "uploadSignature", className: "cteditor-cursor-pointer cteditor-text-foreground underline cteditor-text-sm cteditor-rounded-md cteditor-h-9 cteditor-px-4 cteditor-font-medium cteditor-shadow-sm cteditor-bg-background cteditor-border-input cteditor-border cteditor-flex cteditor-items-center hover:cteditor-bg-accent", children: "Upload Signature Image" }),
@@ -23980,7 +24042,7 @@ const Toolbar = ({
23980
24042
  ]
23981
24043
  }
23982
24044
  ),
23983
- showMoreMenu && /* @__PURE__ */ jsx("div", { className: "cteditor-flex-shrink-0", children: /* @__PURE__ */ jsxs(
24045
+ showMoreMenu && /* @__PURE__ */ jsx("div", { className: "cteditor-flex-shrink-0 cteditor-h-7", children: /* @__PURE__ */ jsxs(
23984
24046
  DropdownMenu$1,
23985
24047
  {
23986
24048
  open: isMoreMenuOpen,
@@ -24445,11 +24507,16 @@ const STATIC_SUGGESTIONS = [
24445
24507
  "integration"
24446
24508
  ];
24447
24509
  class AIService {
24510
+ // Only log errors once per minute
24448
24511
  constructor(apiEndpoint = "api/ai/process") {
24449
24512
  __publicField(this, "apiEndpoint");
24450
24513
  __publicField(this, "cache", /* @__PURE__ */ new Map());
24451
- __publicField(this, "requestTimeout", 1e4);
24514
+ __publicField(this, "requestTimeout", 3e4);
24515
+ // Increased to 30 seconds for AI processing
24452
24516
  __publicField(this, "pendingRequests", /* @__PURE__ */ new Map());
24517
+ __publicField(this, "isBackendAvailable", true);
24518
+ __publicField(this, "lastErrorTime", 0);
24519
+ __publicField(this, "errorCooldown", 6e4);
24453
24520
  this.apiEndpoint = "https://api.cteditor.com/" + apiEndpoint;
24454
24521
  }
24455
24522
  async makeRequest(payload) {
@@ -24470,6 +24537,9 @@ class AIService {
24470
24537
  }
24471
24538
  }
24472
24539
  async executeRequest(payload, cacheKey) {
24540
+ if (!this.isBackendAvailable) {
24541
+ return null;
24542
+ }
24473
24543
  try {
24474
24544
  const controller = new AbortController();
24475
24545
  const timeoutId = setTimeout(() => controller.abort(), this.requestTimeout);
@@ -24484,9 +24554,11 @@ class AIService {
24484
24554
  clearTimeout(timeoutId);
24485
24555
  if (!response.ok) {
24486
24556
  const errorText = await response.text();
24487
- throw new Error(`AI service error: ${response.status} - ${errorText}`);
24557
+ this.handleError(`API error: ${response.status} - ${errorText}`);
24558
+ return null;
24488
24559
  }
24489
24560
  const result = await response.json();
24561
+ this.isBackendAvailable = true;
24490
24562
  this.cache.set(cacheKey, result.data);
24491
24563
  if (this.cache.size > 50) {
24492
24564
  const firstKey = this.cache.keys().next().value;
@@ -24496,10 +24568,30 @@ class AIService {
24496
24568
  }
24497
24569
  return result.data;
24498
24570
  } catch (error) {
24499
- console.error("❌ AIService: Request failed:", error);
24571
+ if (error instanceof Error) {
24572
+ if (error.name === "AbortError") {
24573
+ this.handleError(`Request timeout (${this.requestTimeout}ms) - Backend may be slow or unavailable`);
24574
+ } else if (error.message.includes("Failed to fetch")) {
24575
+ this.handleError("Network error - Backend may be offline");
24576
+ this.isBackendAvailable = false;
24577
+ } else {
24578
+ this.handleError(`Request failed: ${error.message}`);
24579
+ }
24580
+ } else {
24581
+ this.handleError("Unknown error occurred");
24582
+ }
24500
24583
  return null;
24501
24584
  }
24502
24585
  }
24586
+ handleError(message) {
24587
+ const now2 = Date.now();
24588
+ if (now2 - this.lastErrorTime > this.errorCooldown) {
24589
+ console.warn(`⚠️ AIService: ${message}`);
24590
+ console.warn(` Endpoint: ${this.apiEndpoint}`);
24591
+ console.warn(` AI features will be disabled until the backend is available`);
24592
+ this.lastErrorTime = now2;
24593
+ }
24594
+ }
24503
24595
  async getIntelligentSuggestions(currentWord, text, maxSuggestions = 5) {
24504
24596
  if (!text || text.length < 2 || /^\s*$/.test(text)) {
24505
24597
  return null;
@@ -24513,10 +24605,16 @@ class AIService {
24513
24605
  }
24514
24606
  }
24515
24607
  class GrammarCheckService {
24608
+ // 30 seconds timeout
24516
24609
  constructor() {
24517
24610
  __publicField(this, "cache", /* @__PURE__ */ new Map());
24518
24611
  __publicField(this, "apiEndpoint");
24519
24612
  __publicField(this, "pendingRequest", null);
24613
+ __publicField(this, "isBackendAvailable", true);
24614
+ __publicField(this, "lastErrorTime", 0);
24615
+ __publicField(this, "errorCooldown", 6e4);
24616
+ // Only log errors once per minute
24617
+ __publicField(this, "requestTimeout", 3e4);
24520
24618
  this.apiEndpoint = "https://api.cteditor.com/api/ai/process";
24521
24619
  }
24522
24620
  async check(text) {
@@ -24540,18 +24638,25 @@ class GrammarCheckService {
24540
24638
  }
24541
24639
  async executeCheck(text) {
24542
24640
  var _a, _b, _c, _d, _e, _f;
24641
+ if (!this.isBackendAvailable) {
24642
+ return [];
24643
+ }
24543
24644
  try {
24645
+ const controller = new AbortController();
24646
+ const timeoutId = setTimeout(() => controller.abort(), this.requestTimeout);
24544
24647
  const response = await fetch(this.apiEndpoint, {
24545
24648
  method: "POST",
24546
24649
  headers: { "Content-Type": "application/json" },
24547
24650
  body: JSON.stringify({ text: text.trim(), maxSuggestions: 3 }),
24548
- signal: AbortSignal.timeout(1e4)
24651
+ signal: controller.signal
24549
24652
  });
24653
+ clearTimeout(timeoutId);
24550
24654
  if (!response.ok) {
24551
- console.error("❌ GrammarCheck: API error:", response.status);
24655
+ this.handleError(`API error: ${response.status}`);
24552
24656
  return [];
24553
24657
  }
24554
24658
  const result = await response.json();
24659
+ this.isBackendAvailable = true;
24555
24660
  const foundErrors = [];
24556
24661
  if ((_c = (_b = (_a = result.data) == null ? void 0 : _a.corrections) == null ? void 0 : _b.spelling) == null ? void 0 : _c.errors) {
24557
24662
  result.data.corrections.spelling.errors.forEach((err, idx) => {
@@ -24583,10 +24688,30 @@ class GrammarCheckService {
24583
24688
  }
24584
24689
  return foundErrors;
24585
24690
  } catch (error) {
24586
- console.error("❌ GrammarCheck: Check failed:", error);
24691
+ if (error instanceof Error) {
24692
+ if (error.name === "AbortError") {
24693
+ this.handleError(`Request timeout (${this.requestTimeout}ms) - Backend may be slow or unavailable`);
24694
+ } else if (error.message.includes("Failed to fetch")) {
24695
+ this.handleError("Network error - Backend may be offline");
24696
+ this.isBackendAvailable = false;
24697
+ } else {
24698
+ this.handleError(`Check failed: ${error.message}`);
24699
+ }
24700
+ } else {
24701
+ this.handleError("Unknown error occurred");
24702
+ }
24587
24703
  return [];
24588
24704
  }
24589
24705
  }
24706
+ handleError(message) {
24707
+ const now2 = Date.now();
24708
+ if (now2 - this.lastErrorTime > this.errorCooldown) {
24709
+ console.warn(`⚠️ GrammarCheck: ${message}`);
24710
+ console.warn(` Endpoint: ${this.apiEndpoint}`);
24711
+ console.warn(` Grammar checking will be disabled until the backend is available`);
24712
+ this.lastErrorTime = now2;
24713
+ }
24714
+ }
24590
24715
  }
24591
24716
  function CombinedAutocompleteGrammarPlugin({
24592
24717
  onQueryChange,
@@ -24598,7 +24723,7 @@ function CombinedAutocompleteGrammarPlugin({
24598
24723
  debounceDelay = 200
24599
24724
  }) {
24600
24725
  const [editor] = useLexicalComposerContext();
24601
- const { updateToolbarState } = useToolbarState();
24726
+ const { updateToolbarState, toolbarState } = useToolbarState();
24602
24727
  const [activeTab, setActiveTab] = useState$1("autocomplete");
24603
24728
  const [queryString, setQueryString] = useState$1(null);
24604
24729
  const [suggestions, setSuggestions] = useState$1([]);
@@ -24819,6 +24944,10 @@ function CombinedAutocompleteGrammarPlugin({
24819
24944
  [getTraditionalSuggestions, getAISuggestions, enableAI, maxSuggestions]
24820
24945
  );
24821
24946
  const checkForAutocompleteTrigger = useCallback(() => {
24947
+ if (!toolbarState.isAutocompleteEnabled) {
24948
+ setQueryString(null);
24949
+ return;
24950
+ }
24822
24951
  if (justSelectedOption.current) {
24823
24952
  setTimeout(() => {
24824
24953
  justSelectedOption.current = false;
@@ -24850,7 +24979,20 @@ function CombinedAutocompleteGrammarPlugin({
24850
24979
  setQueryString(null);
24851
24980
  }
24852
24981
  });
24853
- }, [editor, minMatchLength]);
24982
+ }, [editor, minMatchLength, toolbarState.isAutocompleteEnabled]);
24983
+ useEffect$1(() => {
24984
+ if (!toolbarState.isAutocompleteEnabled) {
24985
+ setQueryString(null);
24986
+ setSuggestions([]);
24987
+ setSelectedIndex(0);
24988
+ }
24989
+ }, [toolbarState.isAutocompleteEnabled]);
24990
+ useEffect$1(() => {
24991
+ if (!toolbarState.isGrammarCheckEnabled) {
24992
+ setErrors([]);
24993
+ setUserDismissed(false);
24994
+ }
24995
+ }, [toolbarState.isGrammarCheckEnabled]);
24854
24996
  useEffect$1(() => {
24855
24997
  if (debounceTimer.current) {
24856
24998
  clearTimeout(debounceTimer.current);
@@ -25029,6 +25171,10 @@ function CombinedAutocompleteGrammarPlugin({
25029
25171
  };
25030
25172
  }, [editor, checkForAutocompleteTrigger]);
25031
25173
  const checkGrammar = useCallback(async () => {
25174
+ if (!toolbarState.isGrammarCheckEnabled) {
25175
+ setErrors([]);
25176
+ return;
25177
+ }
25032
25178
  const isSlashActive = editor.getEditorState().read(() => {
25033
25179
  const selection = $getSelection();
25034
25180
  if (!$isRangeSelection(selection))
@@ -25061,7 +25207,7 @@ function CombinedAutocompleteGrammarPlugin({
25061
25207
  }
25062
25208
  const foundErrors = await grammarService.current.check(text);
25063
25209
  setErrors(foundErrors);
25064
- }, [editor]);
25210
+ }, [editor, toolbarState.isGrammarCheckEnabled]);
25065
25211
  useEffect$1(() => {
25066
25212
  const unregister = editor.registerUpdateListener(() => {
25067
25213
  clearTimeout(checkTimeout.current);
@@ -25129,27 +25275,40 @@ function CombinedAutocompleteGrammarPlugin({
25129
25275
  (suggestion, original, errorType) => {
25130
25276
  editor.update(() => {
25131
25277
  const root2 = $getRoot();
25132
- const currentText = root2.getTextContent();
25133
- const isSpellingError = errorType === "spelling";
25134
- let newText = currentText;
25135
- if (isSpellingError) {
25136
- const escapedOriginal = original.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25137
- const regex = new RegExp(`\\b${escapedOriginal}\\b`, "gi");
25138
- newText = currentText.replace(regex, suggestion);
25139
- } else {
25140
- const escapedOriginal = original.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25141
- const regex = new RegExp(escapedOriginal, "gi");
25142
- if (currentText.toLowerCase().includes(original.toLowerCase())) {
25143
- newText = currentText.replace(regex, suggestion);
25144
- } else {
25145
- newText = suggestion;
25278
+ let targetNode = null;
25279
+ let targetIndex = -1;
25280
+ const findNode = (node) => {
25281
+ if (node.getType && node.getType() === "text") {
25282
+ const text = node.getTextContent();
25283
+ const lowerText = text.toLowerCase();
25284
+ const lowerOriginal = original.toLowerCase();
25285
+ const index2 = lowerText.indexOf(lowerOriginal);
25286
+ if (index2 !== -1) {
25287
+ targetNode = node;
25288
+ targetIndex = index2;
25289
+ return true;
25290
+ }
25291
+ }
25292
+ const children = node.getChildren ? node.getChildren() : [];
25293
+ for (const child of children) {
25294
+ if (findNode(child)) {
25295
+ return true;
25296
+ }
25146
25297
  }
25298
+ return false;
25299
+ };
25300
+ findNode(root2);
25301
+ if (targetNode && targetIndex !== -1) {
25302
+ const text = targetNode.getTextContent();
25303
+ const before = text.substring(0, targetIndex);
25304
+ const after = text.substring(targetIndex + original.length);
25305
+ const newText = before + suggestion + after;
25306
+ const cursorPosition = before.length + suggestion.length;
25307
+ targetNode.setTextContent(newText);
25308
+ targetNode.select(cursorPosition, cursorPosition);
25309
+ } else {
25310
+ console.warn("Could not find text to replace:", original);
25147
25311
  }
25148
- root2.clear();
25149
- const paragraph = $createParagraphNode();
25150
- const textNode = $createTextNode(newText);
25151
- paragraph.append(textNode);
25152
- root2.append(paragraph);
25153
25312
  });
25154
25313
  setTimeout(() => {
25155
25314
  lastCheckedText.current = "";
@@ -25335,7 +25494,10 @@ function CombinedAutocompleteGrammarPlugin({
25335
25494
  onClick: () => {
25336
25495
  setQueryString(null);
25337
25496
  setSuggestions([]);
25497
+ setUserDismissed(true);
25498
+ setErrors([]);
25338
25499
  updateToolbarState("isAutocompleteEnabled", false);
25500
+ updateToolbarState("isGrammarCheckEnabled", false);
25339
25501
  },
25340
25502
  children: [
25341
25503
  /* @__PURE__ */ jsx(Ban, { className: "!cteditor-size-3" }),
@@ -25382,8 +25544,11 @@ function CombinedAutocompleteGrammarPlugin({
25382
25544
  size: "sm",
25383
25545
  className: "cteditor-w-full cteditor-justify-start cteditor-gap-2 cteditor-text-muted-foreground hover:cteditor-text-foreground",
25384
25546
  onClick: () => {
25547
+ setQueryString(null);
25548
+ setSuggestions([]);
25385
25549
  setUserDismissed(true);
25386
25550
  setErrors([]);
25551
+ updateToolbarState("isAutocompleteEnabled", false);
25387
25552
  updateToolbarState("isGrammarCheckEnabled", false);
25388
25553
  },
25389
25554
  children: [
@@ -25621,8 +25786,8 @@ const fileToDataURL = (file) => {
25621
25786
  function DragDropPaste() {
25622
25787
  const [editor] = useLexicalComposerContext();
25623
25788
  const [isDragging, setIsDragging] = useState$1(false);
25624
- const apiKey = void 0;
25625
- const { uploadFileToS3 } = useS3Uploader(apiKey);
25789
+ const { apiKey } = useEditor();
25790
+ const { uploadFileToS3 } = useS3Uploader(apiKey || void 0);
25626
25791
  useEffect$1(() => {
25627
25792
  const handleDragEnter = (e) => {
25628
25793
  var _a, _b;
@@ -25732,9 +25897,10 @@ function DragDropPaste() {
25732
25897
  for (const { file, result } of filesResult) {
25733
25898
  let fileUrl;
25734
25899
  try {
25735
- if (apiKey)
25736
- ;
25737
- else {
25900
+ if (apiKey) {
25901
+ fileUrl = await uploadFileToS3(file);
25902
+ console.log("File uploaded to S3:", fileUrl);
25903
+ } else {
25738
25904
  fileUrl = await fileToDataURL(file);
25739
25905
  console.log("Using local data URL (no S3 upload)");
25740
25906
  }
@@ -25750,7 +25916,8 @@ function DragDropPaste() {
25750
25916
  } else if (isMimeType(file, ACCEPTABLE_APPLICATION_TYPES)) {
25751
25917
  editor.dispatchCommand(INSERT_FILE_COMMAND, {
25752
25918
  linkText: file.name || "Download File",
25753
- src: fileUrl
25919
+ src: fileUrl,
25920
+ fileSize: file.size
25754
25921
  });
25755
25922
  }
25756
25923
  }
@@ -26782,8 +26949,29 @@ function setFloatingElemPosition(targetRect, floatingElem, anchorElem, isLink =
26782
26949
  left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
26783
26950
  }
26784
26951
  }
26952
+ if (left < editorScrollerRect.left) {
26953
+ left = editorScrollerRect.left + horizontalOffset;
26954
+ }
26955
+ const viewportWidth = window.innerWidth;
26956
+ if (floatingElemRect.width > viewportWidth - 20) {
26957
+ left = editorScrollerRect.left + 10;
26958
+ } else {
26959
+ const maxLeft = viewportWidth - floatingElemRect.width - 10;
26960
+ const minLeft = 10;
26961
+ left = Math.max(minLeft, Math.min(left, maxLeft));
26962
+ }
26785
26963
  top -= anchorElementRect.top;
26786
26964
  left -= anchorElementRect.left;
26965
+ const absoluteLeft = left + anchorElementRect.left;
26966
+ if (absoluteLeft < 10) {
26967
+ left = 10 - anchorElementRect.left;
26968
+ } else if (absoluteLeft + floatingElemRect.width > viewportWidth - 10) {
26969
+ if (floatingElemRect.width > viewportWidth - 20) {
26970
+ left = 10 - anchorElementRect.left;
26971
+ } else {
26972
+ left = viewportWidth - floatingElemRect.width - 10 - anchorElementRect.left;
26973
+ }
26974
+ }
26787
26975
  floatingElem.style.opacity = "1";
26788
26976
  floatingElem.style.transform = `translate(${left}px, ${top}px)`;
26789
26977
  }
@@ -29040,24 +29228,57 @@ function TableCellResizer({ editor }) {
29040
29228
  const [activeCell, updateActiveCell] = useState$1(null);
29041
29229
  const [isMouseDown, updateIsMouseDown] = useState$1(false);
29042
29230
  const [draggingDirection, updateDraggingDirection] = useState$1(null);
29231
+ const [currentDimension, setCurrentDimension] = useState$1(null);
29232
+ const [hoveredDirection, setHoveredDirection] = useState$1(null);
29043
29233
  const resetState = useCallback(() => {
29044
29234
  updateActiveCell(null);
29045
29235
  targetRef.current = null;
29046
29236
  updateDraggingDirection(null);
29047
29237
  mouseStartPosRef.current = null;
29048
29238
  tableRectRef.current = null;
29239
+ setCurrentDimension(null);
29240
+ setHoveredDirection(null);
29049
29241
  }, []);
29050
29242
  const isMouseDownOnEvent = (event) => {
29051
29243
  return (event.buttons & 1) === 1;
29052
29244
  };
29053
29245
  useEffect$1(() => {
29054
29246
  return editor.registerNodeTransform(TableNode, (tableNode) => {
29055
- if (tableNode.getColWidths()) {
29247
+ const existingWidths = tableNode.getColWidths();
29248
+ const numColumns = tableNode.getColumnCount();
29249
+ const tableElement = editor.getElementByKey(tableNode.getKey());
29250
+ if (existingWidths && existingWidths.length > 0) {
29251
+ if (tableElement) {
29252
+ const totalWidth = existingWidths.reduce((sum, w2) => sum + w2, 0);
29253
+ const currentWidth = tableElement.style.width;
29254
+ if (!currentWidth || parseInt(currentWidth) !== totalWidth) {
29255
+ tableElement.style.setProperty("width", `${totalWidth}px`, "important");
29256
+ }
29257
+ }
29056
29258
  return tableNode;
29057
29259
  }
29058
- const numColumns = tableNode.getColumnCount();
29059
- const columnWidth = MIN_COLUMN_WIDTH;
29060
- tableNode.setColWidths(Array(numColumns).fill(columnWidth));
29260
+ if (tableElement) {
29261
+ const firstRow = tableElement.querySelector("tr");
29262
+ if (firstRow) {
29263
+ const cells = Array.from(firstRow.querySelectorAll("th, td"));
29264
+ const actualWidths = cells.map((cell) => {
29265
+ const width = cell.offsetWidth;
29266
+ return Math.max(width || MIN_COLUMN_WIDTH, MIN_COLUMN_WIDTH);
29267
+ });
29268
+ if (actualWidths.length === numColumns) {
29269
+ tableNode.setColWidths(actualWidths);
29270
+ const totalWidth = actualWidths.reduce((sum, w2) => sum + w2, 0);
29271
+ tableElement.style.setProperty("width", `${totalWidth}px`, "important");
29272
+ return tableNode;
29273
+ }
29274
+ }
29275
+ }
29276
+ const fallbackWidths = Array(numColumns).fill(MIN_COLUMN_WIDTH);
29277
+ tableNode.setColWidths(fallbackWidths);
29278
+ if (tableElement) {
29279
+ const totalWidth = fallbackWidths.reduce((sum, w2) => sum + w2, 0);
29280
+ tableElement.style.setProperty("width", `${totalWidth}px`, "important");
29281
+ }
29061
29282
  return tableNode;
29062
29283
  });
29063
29284
  }, [editor]);
@@ -29112,6 +29333,11 @@ function TableCellResizer({ editor }) {
29112
29333
  };
29113
29334
  const onMouseUp = (event) => {
29114
29335
  updateIsMouseDown(false);
29336
+ if (draggingDirection) {
29337
+ updateDraggingDirection(null);
29338
+ updateMouseCurrentPos(null);
29339
+ setCurrentDimension(null);
29340
+ }
29115
29341
  };
29116
29342
  const removeRootListener = editor.registerRootListener(
29117
29343
  (rootElement, prevRootElement) => {
@@ -29126,7 +29352,7 @@ function TableCellResizer({ editor }) {
29126
29352
  return () => {
29127
29353
  removeRootListener();
29128
29354
  };
29129
- }, [activeCell, draggingDirection, editor, resetState]);
29355
+ }, [activeCell, draggingDirection, editor, resetState, setCurrentDimension]);
29130
29356
  const isHeightChanging = (direction) => {
29131
29357
  if (direction === "bottom") {
29132
29358
  return true;
@@ -29165,12 +29391,34 @@ function TableCellResizer({ editor }) {
29165
29391
  }
29166
29392
  const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
29167
29393
  tableRow.setHeight(newHeight);
29394
+ setCurrentDimension(newHeight);
29168
29395
  },
29169
29396
  { tag: "skip-scroll-into-view" }
29170
29397
  );
29171
29398
  },
29172
29399
  [activeCell, editor]
29173
29400
  );
29401
+ const autoFitRowHeight = useCallback(() => {
29402
+ if (!activeCell)
29403
+ return;
29404
+ editor.update(
29405
+ () => {
29406
+ const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
29407
+ if (!$isTableCellNode(tableCellNode))
29408
+ return;
29409
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
29410
+ const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;
29411
+ const tableRows = tableNode.getChildren();
29412
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0)
29413
+ return;
29414
+ const tableRow = tableRows[tableRowIndex];
29415
+ if (!$isTableRowNode(tableRow))
29416
+ return;
29417
+ tableRow.setHeight(void 0);
29418
+ },
29419
+ { tag: "skip-scroll-into-view" }
29420
+ );
29421
+ }, [activeCell, editor]);
29174
29422
  const getCellNodeHeight = (cell, activeEditor) => {
29175
29423
  const domCellNode = activeEditor.getElementByKey(cell.getKey());
29176
29424
  return domCellNode == null ? void 0 : domCellNode.clientHeight;
@@ -29183,6 +29431,7 @@ function TableCellResizer({ editor }) {
29183
29431
  }
29184
29432
  }
29185
29433
  }
29434
+ return void 0;
29186
29435
  };
29187
29436
  const updateColumnWidth = useCallback(
29188
29437
  (widthChange) => {
@@ -29201,28 +29450,117 @@ function TableCellResizer({ editor }) {
29201
29450
  null,
29202
29451
  null
29203
29452
  );
29204
- const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
29205
- if (columnIndex === void 0) {
29453
+ let startColumnIndex;
29454
+ for (let row = 0; row < tableMap.length; row++) {
29455
+ for (let column = 0; column < tableMap[row].length; column++) {
29456
+ if (tableMap[row][column].cell === tableCellNode) {
29457
+ startColumnIndex = column;
29458
+ break;
29459
+ }
29460
+ }
29461
+ if (startColumnIndex !== void 0)
29462
+ break;
29463
+ }
29464
+ if (startColumnIndex === void 0) {
29206
29465
  throw new Error("TableCellResizer: Table column not found.");
29207
29466
  }
29467
+ const colSpan = tableCellNode.getColSpan() || 1;
29468
+ const columnIndex = startColumnIndex + colSpan - 1;
29208
29469
  const colWidths = tableNode.getColWidths();
29209
- if (!colWidths) {
29470
+ if (!colWidths || columnIndex >= colWidths.length) {
29210
29471
  return;
29211
29472
  }
29212
29473
  const width = colWidths[columnIndex];
29213
29474
  if (width === void 0) {
29214
29475
  return;
29215
29476
  }
29216
- const newColWidths = [...colWidths];
29217
29477
  const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
29218
- newColWidths[columnIndex] = newWidth;
29478
+ const newColWidths = colWidths.map((w2, i2) => {
29479
+ if (i2 === columnIndex) {
29480
+ return newWidth;
29481
+ }
29482
+ return w2;
29483
+ });
29219
29484
  tableNode.setColWidths(newColWidths);
29485
+ setCurrentDimension(newWidth);
29486
+ const totalWidth = newColWidths.reduce((sum, w2) => sum + w2, 0);
29487
+ const tableElement = editor.getElementByKey(tableNode.getKey());
29488
+ if (tableElement) {
29489
+ tableElement.style.setProperty("width", `${totalWidth}px`, "important");
29490
+ }
29220
29491
  },
29221
29492
  { tag: "skip-scroll-into-view" }
29222
29493
  );
29494
+ setTimeout(() => {
29495
+ editor.getEditorState().read(() => {
29496
+ const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
29497
+ if (!$isTableCellNode(tableCellNode))
29498
+ return;
29499
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
29500
+ const tableElement = editor.getElementByKey(tableNode.getKey());
29501
+ const colWidths = tableNode.getColWidths();
29502
+ if (tableElement && colWidths) {
29503
+ const totalWidth = colWidths.reduce((sum, w2) => sum + w2, 0);
29504
+ tableElement.style.width = `${totalWidth}px`;
29505
+ }
29506
+ });
29507
+ }, 0);
29223
29508
  },
29224
29509
  [activeCell, editor]
29225
29510
  );
29511
+ const autoFitColumnWidth = useCallback(() => {
29512
+ if (!activeCell)
29513
+ return;
29514
+ editor.update(
29515
+ () => {
29516
+ const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
29517
+ if (!$isTableCellNode(tableCellNode))
29518
+ return;
29519
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
29520
+ const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);
29521
+ const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
29522
+ if (columnIndex === void 0)
29523
+ return;
29524
+ const colWidths = tableNode.getColWidths();
29525
+ if (!colWidths)
29526
+ return;
29527
+ let maxContentWidth = MIN_COLUMN_WIDTH;
29528
+ for (let row = 0; row < tableMap.length; row++) {
29529
+ const cellInfo = tableMap[row][columnIndex];
29530
+ if (cellInfo && cellInfo.cell) {
29531
+ const cellElement = editor.getElementByKey(cellInfo.cell.getKey());
29532
+ if (cellElement) {
29533
+ const contentWidth = cellElement.scrollWidth + 16;
29534
+ maxContentWidth = Math.max(maxContentWidth, contentWidth);
29535
+ }
29536
+ }
29537
+ }
29538
+ const newColWidths = [...colWidths];
29539
+ newColWidths[columnIndex] = Math.max(maxContentWidth, MIN_COLUMN_WIDTH);
29540
+ tableNode.setColWidths(newColWidths);
29541
+ const totalWidth = newColWidths.reduce((sum, w2) => sum + w2, 0);
29542
+ const tableElement = editor.getElementByKey(tableNode.getKey());
29543
+ if (tableElement) {
29544
+ tableElement.style.setProperty("width", `${totalWidth}px`, "important");
29545
+ }
29546
+ },
29547
+ { tag: "skip-scroll-into-view" }
29548
+ );
29549
+ setTimeout(() => {
29550
+ editor.getEditorState().read(() => {
29551
+ const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
29552
+ if (!$isTableCellNode(tableCellNode))
29553
+ return;
29554
+ const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
29555
+ const tableElement = editor.getElementByKey(tableNode.getKey());
29556
+ const colWidths = tableNode.getColWidths();
29557
+ if (tableElement && colWidths) {
29558
+ const totalWidth = colWidths.reduce((sum, w2) => sum + w2, 0);
29559
+ tableElement.style.setProperty("width", `${totalWidth}px`, "important");
29560
+ }
29561
+ });
29562
+ }, 0);
29563
+ }, [activeCell, editor]);
29226
29564
  const mouseUpHandler = useCallback(
29227
29565
  (direction) => {
29228
29566
  const handler = (event) => {
@@ -29244,13 +29582,16 @@ function TableCellResizer({ editor }) {
29244
29582
  const widthChange = (event.clientX - x2) / zoom;
29245
29583
  updateColumnWidth(widthChange);
29246
29584
  }
29247
- resetState();
29585
+ updateDraggingDirection(null);
29586
+ updateMouseCurrentPos(null);
29587
+ mouseStartPosRef.current = null;
29588
+ setCurrentDimension(null);
29248
29589
  document.removeEventListener("mouseup", handler);
29249
29590
  }
29250
29591
  };
29251
29592
  return handler;
29252
29593
  },
29253
- [activeCell, resetState, updateColumnWidth, updateRowHeight]
29594
+ [activeCell, updateColumnWidth, updateRowHeight]
29254
29595
  );
29255
29596
  const toggleResize = useCallback(
29256
29597
  (direction) => (event) => {
@@ -29269,6 +29610,18 @@ function TableCellResizer({ editor }) {
29269
29610
  },
29270
29611
  [activeCell, mouseUpHandler]
29271
29612
  );
29613
+ const handleDoubleClick = useCallback(
29614
+ (direction) => (event) => {
29615
+ event.preventDefault();
29616
+ event.stopPropagation();
29617
+ if (direction === "right") {
29618
+ autoFitColumnWidth();
29619
+ } else {
29620
+ autoFitRowHeight();
29621
+ }
29622
+ },
29623
+ [autoFitColumnWidth, autoFitRowHeight]
29624
+ );
29272
29625
  const getResizers = useCallback(() => {
29273
29626
  if (activeCell) {
29274
29627
  const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
@@ -29281,7 +29634,8 @@ function TableCellResizer({ editor }) {
29281
29634
  height: `${zoneWidth}px`,
29282
29635
  left: `${window.pageXOffset + left}px`,
29283
29636
  top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,
29284
- width: `${width}px`
29637
+ width: `${width}px`,
29638
+ boxShadow: void 0
29285
29639
  },
29286
29640
  right: {
29287
29641
  backgroundColor: "none",
@@ -29289,7 +29643,8 @@ function TableCellResizer({ editor }) {
29289
29643
  height: `${height}px`,
29290
29644
  left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,
29291
29645
  top: `${window.pageYOffset + top}px`,
29292
- width: `${zoneWidth}px`
29646
+ width: `${zoneWidth}px`,
29647
+ boxShadow: void 0
29293
29648
  }
29294
29649
  };
29295
29650
  const tableRect = tableRectRef.current;
@@ -29305,7 +29660,8 @@ function TableCellResizer({ editor }) {
29305
29660
  styles[draggingDirection].width = "3px";
29306
29661
  styles[draggingDirection].height = `${tableRect.height}px`;
29307
29662
  }
29308
- styles[draggingDirection].backgroundColor = "#adf";
29663
+ styles[draggingDirection].backgroundColor = "#3b82f6";
29664
+ styles[draggingDirection].boxShadow = "0 0 8px rgba(59, 130, 246, 0.6)";
29309
29665
  }
29310
29666
  return styles;
29311
29667
  }
@@ -29317,24 +29673,54 @@ function TableCellResizer({ editor }) {
29317
29673
  };
29318
29674
  }, [activeCell, draggingDirection, mouseCurrentPos]);
29319
29675
  const resizerStyles = getResizers();
29320
- return /* @__PURE__ */ jsx("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ jsxs(Fragment, { children: [
29321
- /* @__PURE__ */ jsx(
29322
- "div",
29323
- {
29324
- className: "TableCellResizer__resizer TableCellResizer__ui",
29325
- style: resizerStyles.right || void 0,
29326
- onMouseDown: toggleResize("right")
29327
- }
29328
- ),
29329
- /* @__PURE__ */ jsx(
29676
+ return /* @__PURE__ */ jsxs("div", { ref: resizerRef, children: [
29677
+ activeCell != null && /* @__PURE__ */ jsxs(Fragment, { children: [
29678
+ !draggingDirection && /* @__PURE__ */ jsxs(Fragment, { children: [
29679
+ /* @__PURE__ */ jsx(
29680
+ "div",
29681
+ {
29682
+ className: `TableCellResizer__resizer TableCellResizer__ui ${hoveredDirection === "right" ? "TableCellResizer__resizer--hovered" : ""}`,
29683
+ style: resizerStyles.right || void 0,
29684
+ onMouseDown: toggleResize("right"),
29685
+ onDoubleClick: handleDoubleClick("right"),
29686
+ onMouseEnter: () => setHoveredDirection("right"),
29687
+ onMouseLeave: () => setHoveredDirection(null),
29688
+ title: "Drag to resize column • Double-click to auto-fit"
29689
+ }
29690
+ ),
29691
+ /* @__PURE__ */ jsx(
29692
+ "div",
29693
+ {
29694
+ className: `TableCellResizer__resizer TableCellResizer__ui ${hoveredDirection === "bottom" ? "TableCellResizer__resizer--hovered" : ""}`,
29695
+ style: resizerStyles.bottom || void 0,
29696
+ onMouseDown: toggleResize("bottom"),
29697
+ onDoubleClick: handleDoubleClick("bottom"),
29698
+ onMouseEnter: () => setHoveredDirection("bottom"),
29699
+ onMouseLeave: () => setHoveredDirection(null),
29700
+ title: "Drag to resize row • Double-click to auto-fit"
29701
+ }
29702
+ )
29703
+ ] }),
29704
+ draggingDirection && mouseCurrentPos && /* @__PURE__ */ jsx(
29705
+ "div",
29706
+ {
29707
+ className: "TableCellResizer__dragLine",
29708
+ style: resizerStyles[draggingDirection] || void 0
29709
+ }
29710
+ )
29711
+ ] }),
29712
+ draggingDirection && mouseCurrentPos && currentDimension !== null && /* @__PURE__ */ jsx(
29330
29713
  "div",
29331
29714
  {
29332
- className: "TableCellResizer__resizer TableCellResizer__ui",
29333
- style: resizerStyles.bottom || void 0,
29334
- onMouseDown: toggleResize("bottom")
29715
+ className: "TableCellResizer__tooltip",
29716
+ style: {
29717
+ left: mouseCurrentPos.x + 15,
29718
+ top: mouseCurrentPos.y - 35
29719
+ },
29720
+ children: draggingDirection === "right" ? `Width: ${Math.round(currentDimension)}px` : `Height: ${Math.round(currentDimension)}px`
29335
29721
  }
29336
29722
  )
29337
- ] }) });
29723
+ ] });
29338
29724
  }
29339
29725
  function TableCellResizerPlugin() {
29340
29726
  const [editor] = useLexicalComposerContext();
@@ -29646,42 +30032,80 @@ function TableHoverActionsPlugin({
29646
30032
  }
29647
30033
  function getOptionMeta(label) {
29648
30034
  const lower = label.toLowerCase();
29649
- if (lower.startsWith("paragraph")) {
30035
+ if (lower.startsWith("paragraph"))
29650
30036
  return { icon: /* @__PURE__ */ jsx(Type, { className: "cteditor-size-4" }), description: "Start a new paragraph", shortcut: "P" };
29651
- }
29652
- if (lower.includes("heading 1")) {
30037
+ if (lower.includes("heading 1"))
29653
30038
  return { icon: /* @__PURE__ */ jsx(Heading1, { className: "cteditor-size-4" }), description: "Large section title", shortcut: "H1" };
29654
- }
29655
- if (lower.includes("heading 2")) {
30039
+ if (lower.includes("heading 2"))
29656
30040
  return { icon: /* @__PURE__ */ jsx(Heading2, { className: "cteditor-size-4" }), description: "Section heading", shortcut: "H2" };
29657
- }
29658
- if (lower.includes("heading 3")) {
30041
+ if (lower.includes("heading 3"))
29659
30042
  return { icon: /* @__PURE__ */ jsx(Heading3, { className: "cteditor-size-4" }), description: "Subsection heading", shortcut: "H3" };
29660
- }
29661
- if (lower.includes("bullet")) {
30043
+ if (lower.includes("heading 4"))
30044
+ return { icon: /* @__PURE__ */ jsx(Heading4, { className: "cteditor-size-4" }), description: "Small section heading", shortcut: "H4" };
30045
+ if (lower.includes("heading 5"))
30046
+ return { icon: /* @__PURE__ */ jsx(Heading5, { className: "cteditor-size-4" }), description: "Minor heading", shortcut: "H5" };
30047
+ if (lower.includes("heading 6"))
30048
+ return { icon: /* @__PURE__ */ jsx(Heading6, { className: "cteditor-size-4" }), description: "Smallest heading", shortcut: "H6" };
30049
+ if (lower.includes("quote"))
30050
+ return { icon: /* @__PURE__ */ jsx(Quote, { className: "cteditor-size-4" }), description: "Insert a quote block" };
30051
+ if (lower.includes("code block"))
30052
+ return { icon: /* @__PURE__ */ jsx(Code, { className: "cteditor-size-4" }), description: "Insert a code block" };
30053
+ if (lower.includes("bullet"))
29662
30054
  return { icon: /* @__PURE__ */ jsx(List$1, { className: "cteditor-size-4" }), description: "Create a bulleted list", shortcut: "•" };
29663
- }
29664
- if (lower.includes("numbered")) {
30055
+ if (lower.includes("numbered"))
29665
30056
  return { icon: /* @__PURE__ */ jsx(ListOrdered, { className: "cteditor-size-4" }), description: "Create a numbered list", shortcut: "1." };
29666
- }
29667
- if (lower.includes("todo")) {
30057
+ if (lower.includes("todo"))
29668
30058
  return { icon: /* @__PURE__ */ jsx(ListChecks, { className: "cteditor-size-4" }), description: "Create a checklist", shortcut: "[ ]" };
29669
- }
29670
- if (lower.includes("image")) {
30059
+ if (lower.includes("image"))
29671
30060
  return { icon: /* @__PURE__ */ jsx(Image$2, { className: "cteditor-size-4" }), description: "Insert an image", shortcut: "Img" };
29672
- }
29673
- if (lower.includes("video")) {
30061
+ if (lower.includes("video"))
29674
30062
  return { icon: /* @__PURE__ */ jsx(Video, { className: "cteditor-size-4" }), description: "Embed a video", shortcut: "Vid" };
29675
- }
29676
- if (lower.includes("align left")) {
30063
+ if (lower.includes("table"))
30064
+ return { icon: /* @__PURE__ */ jsx(Table, { className: "cteditor-size-4" }), description: "Insert a table" };
30065
+ if (lower.includes("bold"))
30066
+ return { icon: /* @__PURE__ */ jsx(Bold, { className: "cteditor-size-4" }), description: "Make text bold" };
30067
+ if (lower.includes("italic"))
30068
+ return { icon: /* @__PURE__ */ jsx(Italic, { className: "cteditor-size-4" }), description: "Make text italic" };
30069
+ if (lower.includes("underline"))
30070
+ return { icon: /* @__PURE__ */ jsx(Underline, { className: "cteditor-size-4" }), description: "Underline text" };
30071
+ if (lower.includes("strikethrough"))
30072
+ return { icon: /* @__PURE__ */ jsx(Strikethrough, { className: "cteditor-size-4" }), description: "Strike through text" };
30073
+ if (lower.includes("subscript"))
30074
+ return { icon: /* @__PURE__ */ jsx(Subscript, { className: "cteditor-size-4" }), description: "Format as subscript" };
30075
+ if (lower.includes("superscript"))
30076
+ return { icon: /* @__PURE__ */ jsx(Superscript, { className: "cteditor-size-4" }), description: "Format as superscript" };
30077
+ if (lower.includes("align left"))
29677
30078
  return { icon: /* @__PURE__ */ jsx(AlignLeft, { className: "cteditor-size-4" }), description: "Align text left" };
29678
- }
29679
- if (lower.includes("align center")) {
30079
+ if (lower.includes("align center"))
29680
30080
  return { icon: /* @__PURE__ */ jsx(AlignCenter, { className: "cteditor-size-4" }), description: "Align text center" };
29681
- }
29682
- if (lower.includes("align right")) {
30081
+ if (lower.includes("align right"))
29683
30082
  return { icon: /* @__PURE__ */ jsx(AlignRight, { className: "cteditor-size-4" }), description: "Align text right" };
29684
- }
30083
+ if (lower.includes("justify"))
30084
+ return { icon: /* @__PURE__ */ jsx(AlignJustify, { className: "cteditor-size-4" }), description: "Justify text" };
30085
+ if (lower.includes("info"))
30086
+ return { icon: /* @__PURE__ */ jsx(Info, { className: "cteditor-size-4" }), description: "Insert info panel" };
30087
+ if (lower.includes("warning"))
30088
+ return { icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "cteditor-size-4" }), description: "Insert warning panel" };
30089
+ if (lower.includes("error"))
30090
+ return { icon: /* @__PURE__ */ jsx(XCircle, { className: "cteditor-size-4" }), description: "Insert error panel" };
30091
+ if (lower.includes("success"))
30092
+ return { icon: /* @__PURE__ */ jsx(CheckCircle, { className: "cteditor-size-4" }), description: "Insert success panel" };
30093
+ if (lower.includes("undo"))
30094
+ return { icon: /* @__PURE__ */ jsx(Undo, { className: "cteditor-size-4" }), description: "Undo last action" };
30095
+ if (lower.includes("redo"))
30096
+ return { icon: /* @__PURE__ */ jsx(Redo, { className: "cteditor-size-4" }), description: "Redo last action" };
30097
+ if (lower.includes("clear"))
30098
+ return { icon: /* @__PURE__ */ jsx(Eraser, { className: "cteditor-size-4" }), description: "Clear formatting" };
30099
+ if (lower.includes("comment"))
30100
+ return { icon: /* @__PURE__ */ jsx(MessageSquare, { className: "cteditor-size-4" }), description: "Add a comment" };
30101
+ if (lower.includes("ai chat"))
30102
+ return { icon: /* @__PURE__ */ jsx(MessageCircle, { className: "cteditor-size-4" }), description: "Open AI chat" };
30103
+ if (lower.includes("ai") || lower.includes("improve"))
30104
+ return { icon: /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-size-4" }), description: "AI improvements" };
30105
+ if (lower.includes("html"))
30106
+ return { icon: /* @__PURE__ */ jsx(FileCode2, { className: "cteditor-size-4" }), description: "Toggle HTML view" };
30107
+ if (lower.includes("pdf") || lower.includes("export"))
30108
+ return { icon: /* @__PURE__ */ jsx(Download, { className: "cteditor-size-4" }), description: "Export to PDF" };
29685
30109
  return { icon: /* @__PURE__ */ jsx(Type, { className: "cteditor-size-4" }) };
29686
30110
  }
29687
30111
  class SlashMenuOption extends MenuOption {
@@ -29700,12 +30124,16 @@ function SlashMenuItem({
29700
30124
  onMouseEnter,
29701
30125
  option
29702
30126
  }) {
30127
+ if (option.label.startsWith("__label__")) {
30128
+ const labelText = option.label.replace("__label__", "");
30129
+ return /* @__PURE__ */ jsx("li", { className: "cteditor-px-2 !cteditor-mt-0", children: /* @__PURE__ */ jsx("span", { className: "cteditor-text-[11px] cteditor-text-muted-foreground cteditor-font-medium cteditor-tracking-wider", children: labelText }) }, option.key);
30130
+ }
29703
30131
  const meta = getOptionMeta(option.label);
29704
30132
  return /* @__PURE__ */ jsxs(
29705
30133
  "li",
29706
30134
  {
29707
30135
  tabIndex: -1,
29708
- className: (isSelected ? "cteditor-bg-primary/10 cteditor-border-primary/40 cteditor-shadow-md " : "hover:cteditor-bg-accent/50 hover:cteditor-border-primary/30 hover:cteditor-shadow ") + "cteditor-group cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-px-3 cteditor-py-2 cteditor-rounded-xl cteditor-transition-all cteditor-duration-200 cteditor-cursor-pointer cteditor-border cteditor-border-border hover:cteditor-translate-x-[1px]",
30136
+ className: (isSelected ? "cteditor-bg-primary/10 " : "hover:cteditor-bg-accent/50 ") + "cteditor-group cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-p-1 cteditor-rounded-sm cteditor-transition-all cteditor-duration-200 cteditor-cursor-pointer ",
29709
30137
  ref: option.setRefElement,
29710
30138
  role: "option",
29711
30139
  "aria-selected": isSelected,
@@ -29713,11 +30141,8 @@ function SlashMenuItem({
29713
30141
  onMouseEnter,
29714
30142
  onClick,
29715
30143
  children: [
29716
- /* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-lg cteditor-h-8 cteditor-w-8 cteditor-text-primary cteditor-bg-gradient-to-br cteditor-from-primary/10 cteditor-to-accent/10 group-hover:cteditor-from-primary/20 group-hover:cteditor-to-accent/20", children: meta.icon }),
29717
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-0.5 cteditor-min-w-0", children: [
29718
- /* @__PURE__ */ jsx("span", { className: "cteditor-text-sm cteditor-font-semibold cteditor-text-foreground cteditor-truncate", children: option.label }),
29719
- meta.description && /* @__PURE__ */ jsx("span", { className: "cteditor-text-xs cteditor-text-muted-foreground cteditor-truncate", children: meta.description })
29720
- ] }),
30144
+ /* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-size-5 ", children: meta.icon }),
30145
+ /* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-flex-col cteditor-gap-0.5 cteditor-min-w-0", children: /* @__PURE__ */ jsx("span", { className: "cteditor-text-xs cteditor-text-foreground cteditor-truncate", children: option.label }) }),
29721
30146
  meta.shortcut && /* @__PURE__ */ jsx("span", { className: "cteditor-ml-auto cteditor-text-[10px] cteditor-text-muted-foreground cteditor-border cteditor-border-border cteditor-rounded-md cteditor-px-1.5 cteditor-py-0.5 cteditor-bg-foreground/5", children: meta.shortcut })
29722
30147
  ]
29723
30148
  },
@@ -29727,11 +30152,23 @@ function SlashMenuItem({
29727
30152
  function SlashCommandPlugin() {
29728
30153
  const [editor] = useLexicalComposerContext();
29729
30154
  const [queryString, setQueryString] = useState$1(null);
30155
+ const [searchQuery, setSearchQuery] = useState$1("");
30156
+ const searchInputRef = useRef(null);
29730
30157
  const menuRef = useRef(null);
29731
30158
  const [menuPosition, setMenuPosition] = useState$1({ left: 0 });
29732
30159
  const anchorRef = useRef(null);
29733
30160
  const [isMenuOpen, setIsMenuOpen] = useState$1(false);
29734
30161
  const triggerFn = useBasicTypeaheadTriggerMatch("/", { minLength: 0 });
30162
+ useEffect$1(() => {
30163
+ if (isMenuOpen && searchInputRef.current) {
30164
+ setTimeout(() => {
30165
+ var _a;
30166
+ (_a = searchInputRef.current) == null ? void 0 : _a.focus();
30167
+ }, 50);
30168
+ } else if (!isMenuOpen) {
30169
+ setSearchQuery("");
30170
+ }
30171
+ }, [isMenuOpen]);
29735
30172
  const makeBlock = useCallback((cb) => {
29736
30173
  editor.update(() => {
29737
30174
  cb();
@@ -29786,28 +30223,170 @@ function SlashCommandPlugin() {
29786
30223
  }
29787
30224
  });
29788
30225
  }, [editor]);
30226
+ const insertQuote = useCallback(() => {
30227
+ makeBlock(() => {
30228
+ const selection = $getSelection();
30229
+ if ($isRangeSelection(selection)) {
30230
+ selection.insertNodes([$createQuoteNode()]);
30231
+ }
30232
+ });
30233
+ }, [makeBlock]);
30234
+ const insertCodeBlock = useCallback(() => {
30235
+ makeBlock(() => {
30236
+ const selection = $getSelection();
30237
+ if ($isRangeSelection(selection)) {
30238
+ selection.insertNodes([$createCodeNode()]);
30239
+ }
30240
+ });
30241
+ }, [makeBlock]);
30242
+ const insertTable = useCallback(() => {
30243
+ editor.dispatchCommand(OPEN_TABLE_MODAL_COMMAND, void 0);
30244
+ }, [editor]);
30245
+ const formatBold = useCallback(() => {
30246
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
30247
+ }, [editor]);
30248
+ const formatItalic = useCallback(() => {
30249
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
30250
+ }, [editor]);
30251
+ const formatUnderline = useCallback(() => {
30252
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
30253
+ }, [editor]);
30254
+ const formatStrikethrough = useCallback(() => {
30255
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
30256
+ }, [editor]);
30257
+ const formatSubscript = useCallback(() => {
30258
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "subscript");
30259
+ }, [editor]);
30260
+ const formatSuperscript = useCallback(() => {
30261
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "superscript");
30262
+ }, [editor]);
30263
+ const alignJustify = useCallback(() => {
30264
+ editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "justify");
30265
+ }, [editor]);
30266
+ const undo = useCallback(() => {
30267
+ editor.dispatchCommand(UNDO_COMMAND, void 0);
30268
+ }, [editor]);
30269
+ const redo = useCallback(() => {
30270
+ editor.dispatchCommand(REDO_COMMAND, void 0);
30271
+ }, [editor]);
30272
+ const { clearFormatting } = useEditorToolbar();
30273
+ const { clearEditorContent } = useCustomCommands();
30274
+ const handleClearFormatting = useCallback(() => {
30275
+ clearFormatting();
30276
+ toast.success("Formatting cleared");
30277
+ }, [clearFormatting]);
30278
+ const handleClearContent = useCallback(() => {
30279
+ toast.warning("Clear editor content?", {
30280
+ description: "This will remove all content.",
30281
+ action: {
30282
+ label: "OK",
30283
+ onClick: () => {
30284
+ clearEditorContent();
30285
+ toast.success("Editor cleared");
30286
+ }
30287
+ },
30288
+ duration: 8e3
30289
+ });
30290
+ }, [clearEditorContent]);
30291
+ const addComment = useCallback(() => {
30292
+ editor.dispatchCommand(OPEN_COMMENT_MODAL_COMMAND, void 0);
30293
+ }, [editor]);
30294
+ const openAIChat = useCallback(() => {
30295
+ editor.dispatchCommand(TOGGLE_AI_CHAT_COMMAND, void 0);
30296
+ }, [editor]);
30297
+ const aiGenerateImage = useCallback(() => {
30298
+ editor.dispatchCommand(AI_IMAGE_COMMAND, { type: "CREATE_IMAGE" });
30299
+ }, [editor]);
29789
30300
  const baseOptions = useMemo(() => {
29790
30301
  return [
30302
+ // Block types
30303
+ new SlashMenuOption("__label__BLOCKS", () => {
30304
+ }),
29791
30305
  new SlashMenuOption("Paragraph", insertParagraph),
29792
30306
  new SlashMenuOption("Heading 1", () => insertHeading("h1")),
29793
30307
  new SlashMenuOption("Heading 2", () => insertHeading("h2")),
29794
30308
  new SlashMenuOption("Heading 3", () => insertHeading("h3")),
30309
+ new SlashMenuOption("Heading 4", () => insertHeading("h4")),
30310
+ new SlashMenuOption("Heading 5", () => insertHeading("h5")),
30311
+ new SlashMenuOption("Heading 6", () => insertHeading("h6")),
30312
+ new SlashMenuOption("Quote", insertQuote),
30313
+ new SlashMenuOption("Code block", insertCodeBlock),
30314
+ // Lists
30315
+ new SlashMenuOption("__label__LISTS", () => {
30316
+ }),
29795
30317
  new SlashMenuOption("Bullet list", toggleBullet),
29796
30318
  new SlashMenuOption("Numbered list", toggleNumber),
29797
30319
  new SlashMenuOption("Todo list", toggleTodo),
30320
+ // Media
30321
+ new SlashMenuOption("__label__MEDIA", () => {
30322
+ }),
29798
30323
  new SlashMenuOption("Image", insertImage),
29799
30324
  new SlashMenuOption("Video", insertVideo),
30325
+ new SlashMenuOption("Table", insertTable),
30326
+ // Text formatting
30327
+ new SlashMenuOption("__label__FORMAT", () => {
30328
+ }),
30329
+ new SlashMenuOption("Bold", formatBold),
30330
+ new SlashMenuOption("Italic", formatItalic),
30331
+ new SlashMenuOption("Underline", formatUnderline),
30332
+ new SlashMenuOption("Strikethrough", formatStrikethrough),
30333
+ new SlashMenuOption("Subscript", formatSubscript),
30334
+ new SlashMenuOption("Superscript", formatSuperscript),
30335
+ // Alignment
30336
+ new SlashMenuOption("__label__ALIGN", () => {
30337
+ }),
29800
30338
  new SlashMenuOption("Align left", () => align("left")),
29801
30339
  new SlashMenuOption("Align center", () => align("center")),
29802
- new SlashMenuOption("Align right", () => align("right"))
30340
+ new SlashMenuOption("Align right", () => align("right")),
30341
+ new SlashMenuOption("Justify", alignJustify),
30342
+ // Actions
30343
+ new SlashMenuOption("__label__ACTIONS", () => {
30344
+ }),
30345
+ new SlashMenuOption("Undo", undo),
30346
+ new SlashMenuOption("Redo", redo),
30347
+ new SlashMenuOption("Clear formatting", handleClearFormatting),
30348
+ new SlashMenuOption("Clear content", handleClearContent),
30349
+ new SlashMenuOption("Add comment", addComment),
30350
+ // AI features
30351
+ new SlashMenuOption("__label__AI", () => {
30352
+ }),
30353
+ new SlashMenuOption("AI Chat", openAIChat),
30354
+ new SlashMenuOption("AI Generate image", aiGenerateImage)
29803
30355
  ];
29804
- }, [insertParagraph, insertHeading, toggleBullet, toggleNumber, toggleTodo, insertImage, insertVideo, align]);
30356
+ }, [
30357
+ insertParagraph,
30358
+ insertHeading,
30359
+ insertQuote,
30360
+ insertCodeBlock,
30361
+ toggleBullet,
30362
+ toggleNumber,
30363
+ toggleTodo,
30364
+ insertImage,
30365
+ insertVideo,
30366
+ insertTable,
30367
+ formatBold,
30368
+ formatItalic,
30369
+ formatUnderline,
30370
+ formatStrikethrough,
30371
+ formatSubscript,
30372
+ formatSuperscript,
30373
+ align,
30374
+ alignJustify,
30375
+ undo,
30376
+ redo,
30377
+ handleClearFormatting,
30378
+ handleClearContent,
30379
+ addComment,
30380
+ openAIChat,
30381
+ aiGenerateImage
30382
+ ]);
29805
30383
  const options = useMemo(() => {
29806
- if (!queryString)
30384
+ const query = searchQuery || queryString || "";
30385
+ if (!query)
29807
30386
  return baseOptions;
29808
- const q2 = queryString.toLowerCase();
30387
+ const q2 = query.toLowerCase();
29809
30388
  return baseOptions.filter((o) => o.label.toLowerCase().includes(q2));
29810
- }, [baseOptions, queryString]);
30389
+ }, [baseOptions, queryString, searchQuery]);
29811
30390
  const onSelectOption = useCallback(
29812
30391
  (selectedOption, nodeToReplace, closeMenu) => {
29813
30392
  selectedOption.onSelect();
@@ -29885,7 +30464,7 @@ function SlashCommandPlugin() {
29885
30464
  "div",
29886
30465
  {
29887
30466
  ref: menuRef,
29888
- className: "cteditor-w-72 cteditor-max-h-60 cteditor-overflow-y-auto no-scrollbar cteditor-backdrop-blur-md cteditor-shadow-xl cteditor-rounded-lg cteditor-border cteditor-border-border cteditor-p-1.5 cteditor-bg-background cteditor-z-50",
30467
+ className: "cteditor-w-72 cteditor-max-h-96 cteditor-backdrop-blur-md cteditor-shadow-xl cteditor-rounded-lg cteditor-border cteditor-border-border cteditor-bg-background cteditor-z-50 cteditor-flex cteditor-flex-col cteditor-overflow-hidden",
29889
30468
  style: {
29890
30469
  position: "fixed",
29891
30470
  top: menuPosition.top,
@@ -29893,11 +30472,40 @@ function SlashCommandPlugin() {
29893
30472
  left: menuPosition.left
29894
30473
  },
29895
30474
  children: [
29896
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-2 cteditor-py-1 cteditor-text-[11px] cteditor-text-muted-foreground", children: [
29897
- /* @__PURE__ */ jsx("span", { children: queryString ? "Search results" : "Quick actions" }),
29898
- /* @__PURE__ */ jsx("span", { className: "cteditor-hidden sm:cteditor-inline", children: "Type to filter" })
30475
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-sticky cteditor-top-0 cteditor-bg-background/95 cteditor-backdrop-blur-sm cteditor-border-b cteditor-border-border cteditor-z-10", children: [
30476
+ /* @__PURE__ */ jsx("div", { className: "cteditor-px-3 cteditor-py-2", children: /* @__PURE__ */ jsxs("div", { className: "cteditor-relative cteditor-group", children: [
30477
+ /* @__PURE__ */ jsx("div", { className: "cteditor-absolute cteditor-left-2.5 cteditor-top-1/2 -cteditor-translate-y-1/2 cteditor-text-muted-foreground cteditor-transition-colors group-focus-within:cteditor-text-primary", children: /* @__PURE__ */ jsx(Search, { className: "cteditor-size-3.5" }) }),
30478
+ /* @__PURE__ */ jsx(
30479
+ "input",
30480
+ {
30481
+ ref: searchInputRef,
30482
+ type: "text",
30483
+ value: searchQuery,
30484
+ onChange: (e) => setSearchQuery(e.target.value),
30485
+ placeholder: "Search commands...",
30486
+ className: "cteditor-w-full cteditor-pl-8 cteditor-pr-8 cteditor-py-1.5 cteditor-text-xs cteditor-bg-accent/50 cteditor-border cteditor-border-border cteditor-rounded-md cteditor-outline-none focus:cteditor-border-primary focus:cteditor-ring-1 focus:cteditor-ring-primary/20 cteditor-transition-all cteditor-placeholder-muted-foreground/60",
30487
+ onKeyDown: (e) => {
30488
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
30489
+ e.preventDefault();
30490
+ }
30491
+ }
30492
+ }
30493
+ ),
30494
+ searchQuery && /* @__PURE__ */ jsx(
30495
+ "button",
30496
+ {
30497
+ onClick: () => setSearchQuery(""),
30498
+ className: "cteditor-absolute cteditor-right-2 cteditor-top-1/2 -cteditor-translate-y-1/2 cteditor-text-muted-foreground hover:cteditor-text-foreground cteditor-transition-colors cteditor-p-0.5 cteditor-rounded hover:cteditor-bg-accent",
30499
+ children: /* @__PURE__ */ jsx(X$1, { className: "cteditor-size-3" })
30500
+ }
30501
+ )
30502
+ ] }) }),
30503
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-between cteditor-px-3 cteditor-pb-1.5 cteditor-text-[10px] cteditor-text-muted-foreground", children: [
30504
+ /* @__PURE__ */ jsx("span", { className: "cteditor-font-medium cteditor-tracking-wider", children: searchQuery || queryString ? `${options.length} RESULT${options.length !== 1 ? "S" : ""}` : "QUICK ACTIONS" }),
30505
+ /* @__PURE__ */ jsx("span", { className: "cteditor-hidden sm:cteditor-inline cteditor-text-[9px] cteditor-bg-accent/50 cteditor-px-1.5 cteditor-py-0.5 cteditor-rounded", children: "↑↓ Navigate" })
30506
+ ] })
29899
30507
  ] }),
29900
- options.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "cteditor-space-y-1", children: options.map((option, i2) => /* @__PURE__ */ jsx(
30508
+ options.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "cteditor-space-y-0.5 cteditor-p-2 cteditor-overflow-y-auto cteditor-flex-1", children: options.map((option, i2) => /* @__PURE__ */ jsx(
29901
30509
  SlashMenuItem,
29902
30510
  {
29903
30511
  index: i2,
@@ -29905,6 +30513,7 @@ function SlashCommandPlugin() {
29905
30513
  onClick: () => {
29906
30514
  setHighlightedIndex(i2);
29907
30515
  selectOptionAndCleanUp(option);
30516
+ setSearchQuery("");
29908
30517
  },
29909
30518
  onMouseEnter: () => {
29910
30519
  setHighlightedIndex(i2);
@@ -29912,7 +30521,11 @@ function SlashCommandPlugin() {
29912
30521
  option
29913
30522
  },
29914
30523
  option.key
29915
- )) }) : /* @__PURE__ */ jsx("div", { className: "cteditor-text-[11px] cteditor-text-muted-foreground cteditor-px-3 cteditor-py-2", children: "No results" })
30524
+ )) }) : /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-py-8 cteditor-px-4 cteditor-text-center", children: [
30525
+ /* @__PURE__ */ jsx("div", { className: "cteditor-size-10 cteditor-rounded-full cteditor-bg-accent/50 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-mb-3", children: /* @__PURE__ */ jsx(Search, { className: "cteditor-size-5 cteditor-text-muted-foreground" }) }),
30526
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground cteditor-mb-1", children: "No results found" }),
30527
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-xs cteditor-text-muted-foreground", children: "Try a different search term" })
30528
+ ] })
29916
30529
  ]
29917
30530
  }
29918
30531
  ),
@@ -29973,7 +30586,7 @@ const WordCountPlugin = () => {
29973
30586
  const useStyles = () => ({
29974
30587
  // container: "cteditor-relative cteditor-w-full cteditor-bg-white cteditor-text-black cteditor-font-normal cteditor-text-left cteditor-border cteditor-border-red-500",
29975
30588
  contentEditable: cn$1(
29976
- "cteditor-relative cteditor-min-h-[150px] !cteditor-h-auto cteditor-resize-none cteditor-outline-0",
30589
+ "cteditor-relative cteditor-min-h-[300px] !cteditor-h-auto cteditor-resize-none cteditor-outline-0 cteditor-content",
29977
30590
  // Ensure strong contrast in both themes
29978
30591
  "cteditor-text-black dark:cteditor-text-white ",
29979
30592
  // Caret and spacing
@@ -30222,24 +30835,26 @@ const ConfigurableEditor = ({
30222
30835
  /* @__PURE__ */ jsx(EmbedPreviewPlugin, {}),
30223
30836
  config.htmlViewOption && !config.toolbarOptions.enableHtmlViewToggle && /* @__PURE__ */ jsx(HtmlViewTogglePlugin, {})
30224
30837
  ] }),
30225
- floatingAnchorElem && !isSmallWidthViewport && /* @__PURE__ */ jsxs(Fragment, { children: [
30226
- /* @__PURE__ */ jsx(
30227
- TableActionMenuPlugin,
30228
- {
30229
- anchorElem: floatingAnchorElem,
30230
- cellMerge: true
30231
- }
30232
- ),
30233
- /* @__PURE__ */ jsx(TableHoverActionsPlugin, { anchorElem: floatingAnchorElem }),
30234
- /* @__PURE__ */ jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }),
30235
- /* @__PURE__ */ jsx(
30236
- FloatingLinkEditorPlugin,
30237
- {
30238
- anchorElem: floatingAnchorElem,
30239
- isLinkEditMode,
30240
- setIsLinkEditMode
30241
- }
30242
- ),
30838
+ floatingAnchorElem && /* @__PURE__ */ jsxs(Fragment, { children: [
30839
+ !isSmallWidthViewport && /* @__PURE__ */ jsxs(Fragment, { children: [
30840
+ /* @__PURE__ */ jsx(
30841
+ TableActionMenuPlugin,
30842
+ {
30843
+ anchorElem: floatingAnchorElem,
30844
+ cellMerge: true
30845
+ }
30846
+ ),
30847
+ /* @__PURE__ */ jsx(TableHoverActionsPlugin, { anchorElem: floatingAnchorElem }),
30848
+ /* @__PURE__ */ jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }),
30849
+ /* @__PURE__ */ jsx(
30850
+ FloatingLinkEditorPlugin,
30851
+ {
30852
+ anchorElem: floatingAnchorElem,
30853
+ isLinkEditMode,
30854
+ setIsLinkEditMode
30855
+ }
30856
+ )
30857
+ ] }),
30243
30858
  config.enableFloatingMenu && /* @__PURE__ */ jsx(
30244
30859
  FloatingTextFormatToolbarPlugin,
30245
30860
  {
@@ -30265,7 +30880,7 @@ const ScopedEditorWrapper = ({
30265
30880
  className = "",
30266
30881
  darkMode = false
30267
30882
  }) => {
30268
- return /* @__PURE__ */ jsx("div", { id: "ct-editor-f47ac10b", className: "cteditor-max-w-full", children: /* @__PURE__ */ jsx("div", { className: "cteditor-p-2 cteditor-w-full", children }) });
30883
+ return /* @__PURE__ */ jsx("div", { id: "ct-editor-f47ac10b", className: "cteditor-max-w-full", children: /* @__PURE__ */ jsx("div", { className: "cteditor-p-2 cteditor-w-full cteditor-relative", children }) });
30269
30884
  };
30270
30885
  const MessageContainer = styled.div`
30271
30886
  display: flex;
@@ -30375,18 +30990,23 @@ const ConfigurableEditorWithAuth = ({
30375
30990
  ) });
30376
30991
  };
30377
30992
  export {
30378
- $isImageNode as $,
30993
+ $isFileNode as $,
30379
30994
  ConfigurableEditorWithAuth as C,
30380
- EditorProvider as E,
30995
+ Download as D,
30996
+ ExternalLink as E,
30381
30997
  HtmlViewProvider as H,
30382
30998
  LocalStoragePlugin$1 as L,
30383
- useEditor as a,
30384
- ConfigurableEditor as b,
30999
+ Trash2 as T,
31000
+ createLucideIcon as a,
31001
+ $isImageNode as b,
30385
31002
  commonjsGlobal as c,
30386
- editorConfig as e,
31003
+ EditorProvider as d,
31004
+ useEditor as e,
31005
+ ConfigurableEditor as f,
30387
31006
  getDefaultExportFromCjs as g,
31007
+ editorConfig as h,
30388
31008
  initialConfig as i,
30389
31009
  useHtmlView as u,
30390
31010
  verifyApiKey as v
30391
31011
  };
30392
- //# sourceMappingURL=index-db43388d.js.map
31012
+ //# sourceMappingURL=index-1719c0e6.js.map