@innoviatech/lexical-text-editor 2.0.6 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +390 -241
  2. package/dist/components/AlignmentSelectionList.js +19 -0
  3. package/dist/components/ColorPicker.js +30 -0
  4. package/dist/components/ContentPreview.js +11 -0
  5. package/dist/components/DisplayControls.d.ts +16 -0
  6. package/dist/components/DropdownList.js +18 -0
  7. package/dist/components/FindReplaceModal.d.ts +11 -0
  8. package/dist/components/FindReplaceModal.js +120 -0
  9. package/dist/components/FontSelectionList.d.ts +17 -0
  10. package/dist/components/FontSelectionList.js +17 -0
  11. package/dist/components/HeadingSelectionList.js +19 -0
  12. package/dist/components/ImageComponent.d.ts +1 -0
  13. package/dist/components/ImageComponent.js +111 -0
  14. package/dist/components/InsertDropdownList.js +17 -0
  15. package/dist/components/LexicalTextEditor.d.ts +11 -0
  16. package/dist/components/LexicalTextEditor.js +128 -0
  17. package/dist/components/LinkModal.js +47 -0
  18. package/dist/components/Separator.js +4 -0
  19. package/dist/components/SourceView.d.ts +13 -0
  20. package/dist/components/SourceView.js +50 -0
  21. package/dist/components/StatusBar.d.ts +14 -0
  22. package/dist/components/StatusBar.js +30 -0
  23. package/dist/components/ToolbarOverflowModal.d.ts +15 -0
  24. package/dist/components/common/Dialog.js +27 -0
  25. package/dist/components/common/Popover.d.ts +10 -1
  26. package/dist/components/common/Popover.js +37 -0
  27. package/dist/components/common/Tooltip.d.ts +7 -0
  28. package/dist/components/common/Tooltip.js +20 -0
  29. package/dist/components/ui/button.js +35 -0
  30. package/dist/components/ui/command.js +33 -0
  31. package/dist/components/ui/dialog.js +35 -0
  32. package/dist/components/ui/input.js +6 -0
  33. package/dist/components/ui/popover.js +16 -0
  34. package/dist/components/ui/scroll-area.js +12 -0
  35. package/dist/components/ui/tooltip.js +16 -0
  36. package/dist/constants/index.d.ts +23 -1
  37. package/dist/constants/index.js +224 -0
  38. package/dist/index.d.ts +11 -0
  39. package/dist/index.esm.js +1 -1
  40. package/dist/index.esm.js.map +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/lexical-editor.css +1 -1
  44. package/dist/lib/utils.js +5 -0
  45. package/dist/nodes/ExtendedTextNode.js +140 -0
  46. package/dist/nodes/ImageNode.d.ts +5 -1
  47. package/dist/nodes/ImageNode.js +149 -0
  48. package/dist/nodes/VideoNode.js +80 -0
  49. package/dist/nodes/YoutubeNode.js +64 -0
  50. package/dist/plugins/CodeBlockPlugin.d.ts +1 -0
  51. package/dist/plugins/CodeBlockPlugin.js +88 -0
  52. package/dist/plugins/ColorPlugin.js +47 -0
  53. package/dist/plugins/CustomOnChangePlugin.js +33 -0
  54. package/dist/plugins/FontFamilyPlugin.d.ts +1 -0
  55. package/dist/plugins/FontFamilyPlugin.js +53 -0
  56. package/dist/plugins/FontSizePlugin.d.ts +1 -0
  57. package/dist/plugins/FontSizePlugin.js +48 -0
  58. package/dist/plugins/ImagePlugin.d.ts +3 -1
  59. package/dist/plugins/ImagePlugin.js +91 -0
  60. package/dist/plugins/ListPlugin.js +44 -0
  61. package/dist/plugins/TablePlugin.d.ts +1 -0
  62. package/dist/plugins/TablePlugin.js +92 -0
  63. package/dist/plugins/ToolbarPlugin.d.ts +14 -1
  64. package/dist/plugins/ToolbarPlugin.js +381 -0
  65. package/dist/plugins/VideoPlugin.js +49 -0
  66. package/dist/plugins/YoutubePlugin.js +30 -0
  67. package/dist/tsconfig.tsbuildinfo +1 -0
  68. package/editor_screenshot.png +0 -0
  69. package/package.json +11 -4
  70. package/googlebd703883f12c69e4.html +0 -1
  71. package/rollup.config.js +0 -55
  72. package/src/components/AlignmentSelectionList.tsx +0 -61
  73. package/src/components/ColorPicker.tsx +0 -66
  74. package/src/components/ContentPreview.tsx +0 -51
  75. package/src/components/DropdownList.tsx +0 -57
  76. package/src/components/HeadingSelectionList.tsx +0 -61
  77. package/src/components/ImageComponent.tsx +0 -140
  78. package/src/components/InsertDropdownList.tsx +0 -36
  79. package/src/components/LexicalTextEditor.tsx +0 -119
  80. package/src/components/LinkModal.tsx +0 -127
  81. package/src/components/Separator.tsx +0 -7
  82. package/src/components/common/Dialog.tsx +0 -47
  83. package/src/components/common/Popover.tsx +0 -87
  84. package/src/components/common/Tooltip.tsx +0 -43
  85. package/src/components/ui/button.tsx +0 -58
  86. package/src/components/ui/command.tsx +0 -183
  87. package/src/components/ui/dialog.tsx +0 -142
  88. package/src/components/ui/input.tsx +0 -21
  89. package/src/components/ui/popover.tsx +0 -46
  90. package/src/components/ui/scroll-area.tsx +0 -56
  91. package/src/components/ui/tooltip.tsx +0 -59
  92. package/src/constants/index.tsx +0 -177
  93. package/src/index.ts +0 -6
  94. package/src/lib/utils.ts +0 -6
  95. package/src/nodes/ExtendedTextNode.tsx +0 -185
  96. package/src/nodes/ImageNode.tsx +0 -195
  97. package/src/nodes/VideoNode.tsx +0 -134
  98. package/src/nodes/YoutubeNode.tsx +0 -101
  99. package/src/plugins/ColorPlugin.tsx +0 -85
  100. package/src/plugins/CustomOnChangePlugin.tsx +0 -50
  101. package/src/plugins/ImagePlugin.tsx +0 -118
  102. package/src/plugins/ListPlugin.tsx +0 -58
  103. package/src/plugins/ToolbarPlugin.tsx +0 -500
  104. package/src/plugins/VideoPlugin.tsx +0 -100
  105. package/src/plugins/YoutubePlugin.tsx +0 -83
  106. package/src/styles/lexical-editor.css +0 -1053
  107. package/src/types/global.d.ts +0 -34
  108. package/src/types/other.d.ts +0 -11
  109. package/src/types/react-icons.d.ts +0 -11
  110. package/tailwind.config.js +0 -10
  111. package/tsconfig.json +0 -32
@@ -0,0 +1,224 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RxLetterCaseLowercase, RxLetterCaseCapitalize, RxLetterCaseUppercase } from "react-icons/rx";
3
+ import { TbBold, TbItalic, TbUnderline } from "react-icons/tb";
4
+ import { BsArrowClockwise, BsArrowCounterclockwise, BsChatSquareQuote, BsJustify, BsJustifyLeft, BsJustifyRight, BsSubscript, BsSuperscript, BsTextCenter, BsTextParagraph, BsTypeH1, BsTypeH2, BsTypeH3, BsTypeH4, BsTypeH5, BsTypeH6 } from "react-icons/bs";
5
+ import { AiOutlineStrikethrough } from "react-icons/ai";
6
+ import { IoCodeSlashOutline } from "react-icons/io5";
7
+ import { PiHighlighterLight } from "react-icons/pi";
8
+ import { RiEraserLine } from "react-icons/ri";
9
+ import { RiIndentDecrease, RiIndentIncrease } from "react-icons/ri";
10
+ import { TbSeparatorHorizontal } from "react-icons/tb";
11
+ export var RichTextAction;
12
+ (function (RichTextAction) {
13
+ RichTextAction["Bold"] = "bold";
14
+ RichTextAction["Italics"] = "italics";
15
+ RichTextAction["Underline"] = "underline";
16
+ RichTextAction["Quote"] = "quote";
17
+ RichTextAction["Lowercase"] = "lowercase";
18
+ RichTextAction["Uppercase"] = "uppercase";
19
+ RichTextAction["Capitalize"] = "capitalize";
20
+ RichTextAction["Strikethrough"] = "strikethrough";
21
+ RichTextAction["Superscript"] = "superscript";
22
+ RichTextAction["Subscript"] = "subscript";
23
+ RichTextAction["Highlight"] = "highlight";
24
+ RichTextAction["Code"] = "code";
25
+ RichTextAction["Link"] = "link";
26
+ RichTextAction["LeftAlign"] = "leftAlign";
27
+ RichTextAction["CenterAlign"] = "centerAlign";
28
+ RichTextAction["RightAlign"] = "rightAlign";
29
+ RichTextAction["JustifyAlign"] = "justifyAlign";
30
+ RichTextAction["Divider"] = "divider";
31
+ RichTextAction["Undo"] = "undo";
32
+ RichTextAction["Redo"] = "redo";
33
+ RichTextAction["ClearFormatting"] = "clearFormatting";
34
+ RichTextAction["CodeBlock"] = "codeBlock";
35
+ RichTextAction["HorizontalRule"] = "horizontalRule";
36
+ RichTextAction["Indent"] = "indent";
37
+ RichTextAction["Outdent"] = "outdent";
38
+ RichTextAction["Table"] = "table";
39
+ RichTextAction["FindReplace"] = "findReplace";
40
+ RichTextAction["SourceView"] = "sourceView";
41
+ RichTextAction["Fullscreen"] = "fullscreen";
42
+ })(RichTextAction || (RichTextAction = {}));
43
+ export var HeadingAction;
44
+ (function (HeadingAction) {
45
+ HeadingAction["Normal"] = "normal";
46
+ HeadingAction["H1"] = "h1";
47
+ HeadingAction["H2"] = "h2";
48
+ HeadingAction["H3"] = "h3";
49
+ HeadingAction["H4"] = "h4";
50
+ HeadingAction["H5"] = "h5";
51
+ HeadingAction["H6"] = "h6";
52
+ })(HeadingAction || (HeadingAction = {}));
53
+ export const RICH_TEXT_FORMAT_OPTIONS = [
54
+ {
55
+ id: RichTextAction.Lowercase,
56
+ icon: _jsx(RxLetterCaseLowercase, {}),
57
+ label: "Lowercase",
58
+ },
59
+ {
60
+ id: RichTextAction.Uppercase,
61
+ icon: _jsx(RxLetterCaseUppercase, {}),
62
+ label: "Uppercase",
63
+ },
64
+ {
65
+ id: RichTextAction.Capitalize,
66
+ icon: _jsx(RxLetterCaseCapitalize, {}),
67
+ label: "Capitalize",
68
+ },
69
+ {
70
+ id: RichTextAction.Strikethrough,
71
+ icon: _jsx(AiOutlineStrikethrough, {}),
72
+ label: "Strikethrough",
73
+ },
74
+ {
75
+ id: RichTextAction.Highlight,
76
+ icon: _jsx(PiHighlighterLight, {}),
77
+ label: "Highlight",
78
+ fontSize: 10,
79
+ },
80
+ {
81
+ id: RichTextAction.Superscript,
82
+ icon: _jsx(BsSuperscript, {}),
83
+ label: "Superscript",
84
+ },
85
+ {
86
+ id: RichTextAction.Subscript,
87
+ icon: _jsx(BsSubscript, {}),
88
+ label: "Subscript",
89
+ },
90
+ ];
91
+ export const RICH_TEXT_OPTIONS = [
92
+ { id: RichTextAction.Bold, icon: _jsx(TbBold, {}), label: "Bold" },
93
+ { id: RichTextAction.Italics, icon: _jsx(TbItalic, {}), label: "Italics" },
94
+ { id: RichTextAction.Underline, icon: _jsx(TbUnderline, {}), label: "Underline" },
95
+ { id: RichTextAction.Divider },
96
+ { id: RichTextAction.Quote, icon: _jsx(BsChatSquareQuote, {}), label: "Quote" },
97
+ // { id: RichTextAction.Divider },
98
+ {
99
+ id: RichTextAction.Code,
100
+ icon: _jsx(IoCodeSlashOutline, {}),
101
+ label: "Code",
102
+ },
103
+ // { id: RichTextAction.Link, label: "Link", icon: <IoIosLink /> },
104
+ {
105
+ id: RichTextAction.ClearFormatting,
106
+ icon: _jsx(RiEraserLine, {}),
107
+ label: "Clear Formatting",
108
+ },
109
+ ];
110
+ export const RICH_REDO_UNDO_OPTIONS = [
111
+ {
112
+ id: RichTextAction.Undo,
113
+ icon: _jsx(BsArrowCounterclockwise, {}),
114
+ label: "Undo",
115
+ },
116
+ {
117
+ id: RichTextAction.Redo,
118
+ icon: _jsx(BsArrowClockwise, {}),
119
+ label: "Redo",
120
+ },
121
+ { id: RichTextAction.Divider },
122
+ ];
123
+ export const RICH_ALIGNMENT_OPTIONS = [
124
+ {
125
+ id: RichTextAction.LeftAlign,
126
+ icon: _jsx(BsJustifyLeft, {}),
127
+ label: "Left Align",
128
+ },
129
+ {
130
+ id: RichTextAction.CenterAlign,
131
+ icon: _jsx(BsTextCenter, {}),
132
+ label: "Center Align",
133
+ },
134
+ {
135
+ id: RichTextAction.RightAlign,
136
+ icon: _jsx(BsJustifyRight, {}),
137
+ label: "Right Align",
138
+ },
139
+ {
140
+ id: RichTextAction.JustifyAlign,
141
+ icon: _jsx(BsJustify, {}),
142
+ label: "Justify Align",
143
+ },
144
+ ];
145
+ export const RICH_BLOCK_OPTIONS = [
146
+ {
147
+ id: RichTextAction.Indent,
148
+ icon: _jsx(RiIndentIncrease, {}),
149
+ label: "Indent",
150
+ },
151
+ {
152
+ id: RichTextAction.Outdent,
153
+ icon: _jsx(RiIndentDecrease, {}),
154
+ label: "Outdent",
155
+ },
156
+ { id: RichTextAction.Divider },
157
+ {
158
+ id: RichTextAction.HorizontalRule,
159
+ icon: _jsx(TbSeparatorHorizontal, {}),
160
+ label: "Horizontal Rule",
161
+ },
162
+ ];
163
+ export const LOW_PRIORIRTY = 1;
164
+ export const HEADINGS = [
165
+ {
166
+ id: "normal",
167
+ label: "Normal",
168
+ icon: _jsx(BsTextParagraph, {})
169
+ },
170
+ {
171
+ id: "h1",
172
+ label: "Heading 1",
173
+ icon: _jsx(BsTypeH1, {})
174
+ },
175
+ {
176
+ id: "h2",
177
+ label: "Heading 2",
178
+ icon: _jsx(BsTypeH2, {})
179
+ },
180
+ {
181
+ id: "h3",
182
+ label: "Heading 3",
183
+ icon: _jsx(BsTypeH3, {})
184
+ },
185
+ {
186
+ id: "h4",
187
+ label: "Heading 4",
188
+ icon: _jsx(BsTypeH4, {})
189
+ },
190
+ {
191
+ id: "h5",
192
+ label: "Heading 5",
193
+ icon: _jsx(BsTypeH5, {})
194
+ },
195
+ {
196
+ id: "h6",
197
+ label: "Heading 6",
198
+ icon: _jsx(BsTypeH6, {})
199
+ },
200
+ ];
201
+ // ["Normal", "H1", "H2", "H3", "H4", "H5", "H6"];
202
+ export const CODE_BLOCK_LANGUAGES = [
203
+ { id: "plaintext", label: "Plain Text" },
204
+ { id: "javascript", label: "JavaScript" },
205
+ { id: "typescript", label: "TypeScript" },
206
+ { id: "python", label: "Python" },
207
+ { id: "java", label: "Java" },
208
+ { id: "csharp", label: "C#" },
209
+ { id: "cpp", label: "C++" },
210
+ { id: "php", label: "PHP" },
211
+ { id: "ruby", label: "Ruby" },
212
+ { id: "go", label: "Go" },
213
+ { id: "rust", label: "Rust" },
214
+ { id: "swift", label: "Swift" },
215
+ { id: "kotlin", label: "Kotlin" },
216
+ { id: "html", label: "HTML" },
217
+ { id: "css", label: "CSS" },
218
+ { id: "sql", label: "SQL" },
219
+ { id: "json", label: "JSON" },
220
+ { id: "bash", label: "Bash" },
221
+ { id: "markdown", label: "Markdown" },
222
+ { id: "yaml", label: "YAML" },
223
+ { id: "xml", label: "XML" },
224
+ ];
package/dist/index.d.ts CHANGED
@@ -7,6 +7,17 @@ interface LexiTexProps {
7
7
  name: string;
8
8
  height?: string | null | undefined;
9
9
  maxWidth?: string | null | undefined;
10
+ onImageUpload?: (file: File) => Promise<string>;
11
+ showWordCount?: boolean;
12
+ showCharCount?: boolean;
13
+ theme?: 'light' | 'dark' | 'system';
14
+ toolbarStyle?: 'wrap' | 'collapse' | 'scrollbar' | 'normal';
15
+ /** Show light/dark + toolbar-style switchers in the status bar so end users can change these too */
16
+ showDisplayControls?: boolean;
17
+ /** Fires when the end user changes the theme from the editor UI (not on prop changes) */
18
+ onThemeChange?: (theme: 'light' | 'dark' | 'system') => void;
19
+ /** Fires when the end user changes the toolbar style from the editor UI (not on prop changes) */
20
+ onToolbarStyleChange?: (style: 'wrap' | 'collapse' | 'scrollbar') => void;
10
21
  }
11
22
  declare const LexicalTextEditor: React.FC<LexiTexProps>;
12
23
 
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{LexicalComposer as i}from"@lexical/react/LexicalComposer";import o,{useRef as r,useEffect as l,cloneElement as c,useState as a,useCallback as s,useMemo as d}from"react";import{$isHeadingNode as u,$isQuoteNode as h,$createQuoteNode as p,$createHeadingNode as m,HeadingNode as g,QuoteNode as f}from"@lexical/rich-text";import{CodeHighlightNode as b,CodeNode as v}from"@lexical/code";import{RichTextPlugin as y}from"@lexical/react/LexicalRichTextPlugin";import{ContentEditable as x}from"@lexical/react/LexicalContentEditable";import{LexicalErrorBoundary as w}from"@lexical/react/LexicalErrorBoundary";import{$createRangeSelection as C,$findMatchingParent as k,INTERNAL_$isBlock as _,$isElementNode as N,$getSelection as S,$setSelection as L,$isRootOrShadowRoot as A,$hasAncestor as T,$isRangeSelection as E,$isTextNode as D,$isTokenOrSegmented as M,$getCharacterOffsets as O,$isLeafNode as z,$getPreviousSelection as F,$caretRangeFromSelection as R,SELECTION_CHANGE_COMMAND as H,$getNodeByKey as U,DecoratorNode as I,$applyNodeReplacement as P,$insertNodes as $,CAN_REDO_COMMAND as W,CAN_UNDO_COMMAND as K,REDO_COMMAND as B,UNDO_COMMAND as J,FORMAT_ELEMENT_COMMAND as j,FORMAT_TEXT_COMMAND as q,$createParagraphNode as Q,$getRoot as Y,isDOMDocumentNode as G,ArtificialNode__DO_NOT_USE as X,$createLineBreakNode as V,$cloneWithProperties as Z,getRegisteredNode as ee,isHTMLElement as te,isDocumentFragment as ne,$isBlockElementNode as ie,isBlockDomNode as oe,isInlineDomNode as re,TextNode as le,LineBreakNode as ce}from"lexical";import{HistoryPlugin as ae}from"@lexical/react/LexicalHistoryPlugin";import{ListPlugin as se}from"@lexical/react/LexicalListPlugin";import{REMOVE_LIST_COMMAND as de,INSERT_ORDERED_LIST_COMMAND as ue,INSERT_UNORDERED_LIST_COMMAND as he,$isListNode as pe,ListNode as me,ListItemNode as ge}from"@lexical/list";import{RxLetterCaseLowercase as fe,RxLetterCaseUppercase as be,RxLetterCaseCapitalize as ve}from"react-icons/rx";import{TbBold as ye,TbItalic as xe,TbUnderline as we}from"react-icons/tb";import{BsSuperscript as Ce,BsSubscript as ke,BsChatSquareQuote as _e,BsArrowCounterclockwise as Ne,BsArrowClockwise as Se,BsJustifyLeft as Le,BsTextCenter as Ae,BsJustifyRight as Te,BsJustify as Ee,BsTextParagraph as De,BsTypeH1 as Me,BsTypeH2 as Oe,BsTypeH3 as ze,BsTypeH4 as Fe,BsTypeH5 as Re,BsTypeH6 as He,BsPencilSquare as Ue,BsListOl as Ie,BsListUl as Pe}from"react-icons/bs";import{AiOutlineStrikethrough as $e,AiOutlineFontColors as We,AiOutlineBgColors as Ke}from"react-icons/ai";import{IoCodeSlashOutline as Be,IoImageOutline as Je}from"react-icons/io5";import{PiHighlighterLight as je}from"react-icons/pi";import{useLexicalComposerContext as qe}from"@lexical/react/LexicalComposerContext";import{TOGGLE_LINK_COMMAND as Qe,$isLinkNode as Ye,LinkNode as Ge}from"@lexical/link";import{HiChevronDown as Xe}from"react-icons/hi2";import{IoIosLink as Ve}from"react-icons/io";import{MdCheck as Ze}from"react-icons/md";import{BiUnlink as et}from"react-icons/bi";import{SketchPicker as tt}from"react-color";import{createPortal as nt}from"react-dom";import{LuUpload as it}from"react-icons/lu";import{FaYoutube as ot}from"react-icons/fa";import{VscPreview as rt}from"react-icons/vsc";import{LinkPlugin as lt}from"@lexical/react/LexicalLinkPlugin";import{OnChangePlugin as ct}from"@lexical/react/LexicalOnChangePlugin";var at,st;!function(e){e.Bold="bold",e.Italics="italics",e.Underline="underline",e.Quote="quote",e.Lowercase="lowercase",e.Uppercase="uppercase",e.Capitalize="capitalize",e.Strikethrough="strikethrough",e.Superscript="superscript",e.Subscript="subscript",e.Highlight="highlight",e.Code="code",e.Link="link",e.LeftAlign="leftAlign",e.CenterAlign="centerAlign",e.RightAlign="rightAlign",e.JustifyAlign="justifyAlign",e.Divider="divider",e.Undo="undo",e.Redo="redo"}(at||(at={})),function(e){e.Normal="normal",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6"}(st||(st={}));const dt=[{id:at.Lowercase,icon:e(fe,{}),label:"Lowercase"},{id:at.Uppercase,icon:e(be,{}),label:"Uppercase"},{id:at.Capitalize,icon:e(ve,{}),label:"Capitalize"},{id:at.Strikethrough,icon:e($e,{}),label:"Strikethrough"},{id:at.Highlight,icon:e(je,{}),label:"Highlight",fontSize:10},{id:at.Superscript,icon:e(Ce,{}),label:"Superscript"},{id:at.Subscript,icon:e(ke,{}),label:"Subscript"}],ut=[{id:at.Bold,icon:e(ye,{}),label:"Bold"},{id:at.Italics,icon:e(xe,{}),label:"Italics"},{id:at.Underline,icon:e(we,{}),label:"Underline"},{id:at.Divider},{id:at.Quote,icon:e(_e,{}),label:"Quote"},{id:at.Code,icon:e(Be,{}),label:"Code"}],ht=[{id:at.Undo,icon:e(Ne,{}),label:"Undo"},{id:at.Redo,icon:e(Se,{}),label:"Redo"},{id:at.Divider}],pt=[{id:at.LeftAlign,icon:e(Le,{}),label:"Left Align"},{id:at.CenterAlign,icon:e(Ae,{}),label:"Center Align"},{id:at.RightAlign,icon:e(Te,{}),label:"Right Align"},{id:at.JustifyAlign,icon:e(Ee,{}),label:"Justify Align"}],mt=[{id:"normal",label:"Normal",icon:e(De,{})},{id:"h1",label:"Heading 1",icon:e(Me,{})},{id:"h2",label:"Heading 2",icon:e(Oe,{})},{id:"h3",label:"Heading 3",icon:e(ze,{})},{id:"h4",label:"Heading 4",icon:e(Fe,{})},{id:"h5",label:"Heading 5",icon:e(Re,{})},{id:"h6",label:"Heading 6",icon:e(He,{})}];function gt(e,...t){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",e);for(const e of t)i.append("v",e);throw n.search=i.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ft=new Map;function bt(e){let t=ft.get(e);return void 0===t&&(t=function(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,i]=e.split(/:([^]+)/);n&&i&&(t[n.trim()]=i.trim())}return t}(e),ft.set(e,t)),t}function vt(e,t){(E(e)?e.isCollapsed():D(e)||N(e))||gt(280);const n=bt(E(e)?e.style:D(e)?e.getStyle():e.getTextStyle()),i=Object.entries(t).reduce((t,[i,o])=>("function"==typeof o?t[i]=o(n[i],e):null===o?delete t[i]:t[i]=o,t),{...n}),o=function(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}(i);E(e)||D(e)?e.setStyle(o):e.setTextStyle(o),ft.set(o,i)}function yt(e,t){if(E(e)&&e.isCollapsed()){vt(e,t);const n=e.anchor.getNode();N(n)&&n.isEmpty()&&vt(n,t)}!function(e){const t=S();if(!t)return;const n=new Map,i=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(E(t))for(const e of R(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const o=t.getNodes();for(const t of o){if(!D(t)||!t.canHaveFormat())continue;const[n,o]=i(t);o!==n&&(M(t)||0===n&&o===t.getTextContentSize()?e(t):e(t.splitText(n,o)[0===n?0:1]))}E(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&function(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:i,offset:o,type:r}=t;t.set(n.key,n.offset,n.type),n.set(i,o,r)}}(t)}(e=>{vt(e,t)})}function xt(e,t){const n=e.getFormatType(),i=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),i!==t.getIndent()&&t.setIndent(i)}function wt(e){return e.getNode().isAttached()}function Ct(e){let t=e;for(;null!==t&&!A(t);){const e=t.getLatest(),n=t.getParent();0===e.getChildrenSize()&&t.remove(!0),t=n}}function kt(e,t,n=null){const i=e.getStartEndPoints(),o=i?i[0]:null,r=e.getNodes(),l=r.length;if(null!==o&&(0===l||1===l&&"element"===o.type&&0===o.getNode().getChildrenSize())){const e="text"===o.type?o.getNode().getParentOrThrow():o.getNode(),i=e.getChildren();let r=t();return r.setFormat(e.getFormatType()),r.setIndent(e.getIndent()),i.forEach(e=>r.append(e)),n&&(r=n.append(r)),void e.replace(r)}let c=null,a=[];for(let i=0;i<l;i++){const o=r[i];A(o)?(_t(e,a,a.length,t,n),a=[],c=o):null===c||null!==c&&T(o,c)?a.push(o):(_t(e,a,a.length,t,n),a=[o])}_t(e,a,a.length,t,n)}function _t(e,t,n,i,o=null){if(0===t.length)return;const r=t[0],l=new Map,c=[];let a=N(r)?r:r.getParentOrThrow();a.isInline()&&(a=a.getParentOrThrow());let s=!1;for(;null!==a;){const e=a.getPreviousSibling();if(null!==e){a=e,s=!0;break}if(a=a.getParentOrThrow(),A(a))break}const d=new Set;for(let e=0;e<n;e++){const n=t[e];N(n)&&0===n.getChildrenSize()&&d.add(n.getKey())}const u=new Set;for(let e=0;e<n;e++){const n=t[e];let o=n.getParent();if(null!==o&&o.isInline()&&(o=o.getParent()),null!==o&&z(n)&&!u.has(n.getKey())){const e=o.getKey();if(void 0===l.get(e)){const t=i();t.setFormat(o.getFormatType()),t.setIndent(o.getIndent()),c.push(t),l.set(e,t),o.getChildren().forEach(e=>{t.append(e),u.add(e.getKey()),N(e)&&e.getChildrenKeys().forEach(e=>u.add(e))}),Ct(o)}}else if(d.has(n.getKey())){N(n)||gt(179);const e=i();e.setFormat(n.getFormatType()),e.setIndent(n.getIndent()),c.push(e),n.remove(!0)}}if(null!==o)for(let e=0;e<c.length;e++){const t=c[e];o.append(t)}let h=null;if(A(a))if(s)if(null!==o)a.insertAfter(o);else for(let e=c.length-1;e>=0;e--){const t=c[e];a.insertAfter(t)}else{const e=a.getFirstChild();if(N(e)&&(a=e),null===e)if(o)a.append(o);else for(let e=0;e<c.length;e++){const t=c[e];a.append(t),h=t}else if(null!==o)e.insertBefore(o);else for(let t=0;t<c.length;t++){const n=c[t];e.insertBefore(n),h=n}}else if(o)a.insertAfter(o);else for(let e=c.length-1;e>=0;e--){const t=c[e];a.insertAfter(t),h=t}const p=F();E(p)&&wt(p.anchor)&&wt(p.focus)?L(p.clone()):null!==h?h.selectEnd():e.dirty=!0}function Nt(e,t,n){const i=bt(e.getStyle());return null!==i&&i[t]||n}function St(e,t,n=""){let i=null;const o=e.getNodes(),r=e.anchor,l=e.focus,c=e.isBackward(),a=c?l.offset:r.offset,s=c?l.getNode():r.getNode();if(E(e)&&e.isCollapsed()&&""!==e.style){const n=bt(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e<o.length;e++){const r=o[e];if((0===e||0!==a||!r.is(s))&&D(r)){const e=Nt(r,t,n);if(null===i)i=e;else if(i!==e){i="";break}}}return null===i?n:i}const Lt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,At=Lt&&"documentMode"in document?document.documentMode:null;function Tt(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Et({open:t,onOpenChange:n,children:i}){const a=r(null),s=r(null);return l(()=>{function e(e){a.current?.contains(e.target)||s.current?.contains(e.target)||n(!1)}return t&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t,n]),e("div",{className:"popover-root",children:o.Children.map(i,e=>e&&"object"==typeof e?e.type===Dt?c(e,{triggerRef:a}):e.type===Mt?c(e,{contentRef:s}):e:e)})}function Dt({children:t,triggerRef:n}){return e("div",{className:"popover-trigger",ref:n,children:t})}function Mt({open:t,align:n="start",children:i,contentRef:o}){return t?e("div",{ref:o,className:`popover-content align-${n}`,children:i}):null}function Ot({onAction:n,selectionMap:i}){const[o,l]=a(!1),c=r(null),s=r(null);return t(Et,{open:o,onOpenChange:l,children:[e(Dt,{triggerRef:c,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(o?"toolbar-active":"toolbar"),onClick:()=>l(e=>!e),children:[e("span",{children:"Aa"}),e(Xe,{className:"chevron "+(o?"rotated":"")})]})}),e(Mt,{open:o,align:"start",onClose:()=>l(!1),contentRef:s,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:dt.map(({id:o,label:r,icon:c})=>t("button",{type:"button",className:"lexical-btn "+(i[o]?"toolbar-active":"toolbar"),onClick:()=>{n(o),l(!1)},style:{minWidth:130},children:[c,e("span",{className:"label",children:r})]},o))})})]})}function zt(){return e("div",{className:"w-[1px] h-[20px] mx-[2px] bg-gray-300 shrink-0"})}function Ft({updateHeading:n,headingSelectionMap:i}){const o=mt.find(e=>i[e.id]),[l,c]=a(!1),s=r(null),d=r(null);return t(Et,{open:l,onOpenChange:c,children:[e(Dt,{triggerRef:s,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(l?"toolbar-active":"toolbar"),onClick:()=>c(e=>!e),style:{minWidth:132},children:[o?.icon,e("span",{children:o?.label}),e(Xe,{className:"chevron "+(l?"rotated":"")})]})}),e(Mt,{open:l,align:"start",onClose:()=>c(!1),contentRef:d,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:mt.map(({id:o,label:r,icon:l})=>t("button",{type:"button",className:"lexical-btn "+(i[o]?"toolbar-active":"toolbar"),onClick:()=>{n(o),c(!1)},children:[l,e("span",{className:"label",children:r})]},o))})})]})}function Rt({linkUrl:n,setLinkUrl:i,onConfirm:o,onCancel:c,removeLink:s}){const[d,u]=a(!1),h=r(null),p=r(null);return l(()=>{"https://"===n&&u(!0)},[n]),l(()=>{d&&p.current?.focus()},[d]),l(()=>{const e=e=>{h.current&&!h.current.contains(e.target)&&c()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c]),t("div",{ref:h,className:"lexical-text-editor-link link-editor-container",children:[e("div",{className:"link-editor-input-wrapper",children:d?e("input",{ref:p,className:"link-editor-input",value:n,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),o(n),u(!1)):"Escape"===e.key&&(e.preventDefault(),u(!1),c())}}):e("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"link-editor-url",children:n})}),t("div",{className:"link-editor-buttons",children:[e("button",{type:"button",className:"lexical-btn heading-trigger toolbar",onClick:()=>{d?(o(n),u(!1)):u(!0)},children:d?e(Ze,{size:18}):e(Ue,{size:14})}),e("button",{type:"button",className:"lexical-btn heading-trigger toolbar",onMouseDown:e=>e.preventDefault(),onClick:s,children:e(et,{size:14,style:{stroke:"black"}})})]})]})}function Ht({onAction:n,alignmentSelectionMap:i}){const o=pt.find(e=>i[e.id]),[l,c]=a(!1),s=r(null),d=r(null);return t(Et,{open:l,onOpenChange:c,children:[e(Dt,{triggerRef:s,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(l?"toolbar-active":"toolbar"),onClick:()=>c(e=>!e),style:{minWidth:146},children:[o?.icon,e("span",{children:o?.label}),e(Xe,{className:"chevron "+(l?"rotated":"")})]})}),e(Mt,{open:l,align:"start",onClose:()=>c(!1),contentRef:d,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:pt.map(({id:o,label:r,icon:l})=>t("button",{type:"button",className:"lexical-btn "+(i[o]?"toolbar-active":"toolbar"),onClick:()=>{n(o),c(!1)},children:[l,e("span",{className:"label",children:r})]},o))})})]})}function Ut({color:n,onChange:i,icon:o}){const[c,s]=a(!1),d=r(null),u=r(null);l(()=>{const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);return t("div",{className:"color-picker-wrapper",children:[e("button",{type:"button",ref:d,className:`size-8 lexical-btn ${c?"toolbarActive":"toolbar"} icon`,onClick:()=>s(e=>!e),children:o}),c&&nt(e("div",{ref:u,className:"lexical-color-popover "+(c?"open":""),style:{top:d.current?.getBoundingClientRect().bottom,left:d.current?.getBoundingClientRect().left,position:"absolute"},onMouseDown:e=>e.preventDefault(),children:e(tt,{color:n,onChangeComplete:e=>{i(e.hex)}})}),document.body)]})}Lt&&"InputEvent"in window&&!At&&new window.InputEvent("input");const It=({content:n,direction:i="top",delay:o=400,children:l})=>{const[c,s]=a(!1),d=r(null);return t("div",{className:"Lexical-Tooltip-Wrapper",onMouseEnter:()=>{d.current=window.setTimeout(()=>{s(!0)},o)},onMouseLeave:()=>{d.current&&clearTimeout(d.current),s(!1)},children:[l,c&&e("div",{className:`Lexical-Tooltip-Tip ${i}`,children:n})]})};function Pt(){const[i]=qe(),[{color:o,bgColor:r},c]=a({color:"#000",bgColor:"#fff"}),s=()=>{const e=S();if(E(e)){const t=St(e,"color","#000"),n=St(e,"background","#fff");c({color:t,bgColor:n})}};l(()=>Tt(i.registerUpdateListener(({editorState:e})=>{e.read(()=>{s()})}),i.registerCommand(H,()=>(s(),!1),1)),[i]);const d=({property:e,color:t})=>{i.update(()=>{const n=S();n&&yt(n,{[e]:t})})};return t(n,{children:[e(It,{content:"Font Color",direction:"bottom",children:e(Ut,{color:o,onChange:e=>{d({property:"color",color:e})},icon:e(We,{})})}),e(It,{content:"Background Color",direction:"bottom",children:e(Ut,{color:r,onChange:e=>{d({property:"background",color:e})},icon:e(Ke,{})})})]})}function $t({blockType:i}){const[o]=qe();return t(n,{children:[e(It,{content:"Ordered list",direction:"bottom",children:e("button",{type:"button",className:`size-8 lexical-btn ${"ol"===i?"toolbarActive":"toolbar"} icon`,onClick:()=>{"ol"===i?o.dispatchCommand(de,void 0):o.dispatchCommand(ue,void 0)},children:e(Ie,{})})}),e(It,{content:"Unordered list",direction:"bottom",children:e("button",{type:"button",className:`size-8 lexical-btn ${"ul"===i?"toolbarActive":"toolbar"} icon`,onClick:()=>{"ul"===i?o.dispatchCommand(de,void 0):o.dispatchCommand(he,void 0)},children:e(Pe,{})})})]})}const Wt=({src:n,altText:i,nodeKey:o,width:l,height:c,maxWidth:a})=>{const[s]=qe(),d=r(null),u=r(null),h=r(null),p=e=>{if(!h.current||!d.current)return;const t=e.clientX-h.current.x,n=Math.min(a,Math.max(50,h.current.width+t)),i=n*d.current.ratio;d.current.width=n,d.current.height=i;const o=u.current?.querySelector("img");o&&(o.style.width=n+"px",o.style.height=i+"px")},m=()=>{if(!d.current)return;const{width:e,height:t}=d.current;s.update(()=>{const n=U(o);n&&"function"==typeof n.updateDimensions&&n.updateDimensions(e,t)}),d.current=null,h.current=null,window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",m)};return t("div",{ref:u,style:{display:"inline-block",position:"relative",maxWidth:a},children:[e("img",{src:n,alt:i,width:"inherit"===l?void 0:l,height:"inherit"===c?void 0:c,style:{maxWidth:"100%",display:"block"}}),e("div",{onMouseDown:e=>{e.preventDefault(),e.stopPropagation();const t=u.current?.querySelector("img");if(!t)return;const n=t.getBoundingClientRect().width,i=t.naturalHeight/t.naturalWidth,o=n*i;h.current={x:e.clientX,y:e.clientY,width:n,height:o},d.current={width:n,height:o,ratio:i},window.addEventListener("mousemove",p),window.addEventListener("mouseup",m)},style:{position:"absolute",bottom:0,right:0,width:14,height:14,background:"white",border:"1px solid #999",cursor:"nwse-resize",borderRadius:2}})]})},Kt=e=>P(new Jt(e)),Bt=e=>{if(!(e instanceof HTMLImageElement))return null;const{src:t,alt:n}=e;let i,o;e.width&&(i=e.width),e.height&&(o=e.height);const r=e.style;if((!i||0===i)&&r.width){const e=parseInt(r.width,10);Number.isNaN(e)||(i=e)}if((!o||0===o)&&r.height){const e=parseInt(r.height,10);Number.isNaN(e)||(o=e)}return{node:Kt({src:t,altText:n,width:i??"inherit",height:o??"inherit"})}};class Jt extends I{constructor({src:e="",altText:t="",maxWidth:n=1080,width:i="inherit",height:o="inherit",key:r}={src:"",altText:""}){super(r),this.__src=e,this.__altText=t,this.__maxWidth=n,this.__width=i,this.__height=o}static getType(){return"image"}static clone(e){return new Jt({src:e.__src,altText:e.__altText,width:e.__width,height:e.__height,maxWidth:e.__maxWidth,key:e.getKey()})}createDOM(){return document.createElement("span")}updateDOM(e){return e.__width!==this.__width||e.__height!==this.__height}exportDOM(){const e=document.createElement("img");return e.src=this.__src,e.alt=this.__altText,"inherit"!==this.__width&&(e.width=this.__width??0),"inherit"!==this.__height&&(e.height=this.__height??0),{element:e}}static importDOM(){return{img:()=>({conversion:Bt,priority:1})}}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,maxWidth:this.__maxWidth,width:this.__width,height:this.__height}}static importJSON(e){return new Jt({src:e.src,altText:e.altText,maxWidth:e.maxWidth,width:e.width,height:e.height})}updateDimensions(e,t){const n=this.getWritable();n.__width=e,n.__height=t}decorate(){return e(Wt,{src:this.__src,altText:this.__altText,nodeKey:this.getKey(),width:this.__width,height:this.__height,maxWidth:this.__maxWidth})}}function jt({open:n,onClose:i,forPreview:o=!1,children:c}){const a=r(null);return l(()=>{if(!n)return;const e=e=>{a.current&&!a.current.contains(e.target)&&i()},t=e=>{"Escape"===e.key&&i()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[n,i]),n?e("div",{className:"lexical-text-editor-dialog lte-dialog-overlay",children:t("div",{ref:a,className:"lte-dialog "+(o?"preview":""),children:[e("button",{type:"button",className:"lte-dialog-close",onClick:i,children:"×"}),c]})}):null}function qt(){const[n]=qe(),i=r(null),[o,l]=a(!1),[c,s]=a(""),[d,u]=a(""),[h,p]=a();return t("div",{className:"lexical-text-editor-dialog",children:[e("input",{type:"file",ref:i,accept:"image/*",className:"lte-hidden",onChange:e=>{const t=e.target.files?.[0];t&&p(t),e.target.value=""}}),e("button",{type:"button",className:`size-8 lexical-btn ${o?"toolbarActive":"toolbar"} icon`,onClick:()=>l(e=>!e),children:e(Je,{size:18})}),t(jt,{open:o,onClose:()=>l(!1),children:[e("div",{className:"lte-dialog-header",children:"Add Image"}),t("div",{className:"lte-dialog-body",children:[e("input",{className:"lte-input",placeholder:"Alt text",value:d,onChange:e=>u(e.target.value)}),e("input",{className:"lte-input",placeholder:"Add image by URL",value:c,onChange:e=>s(e.target.value)}),e("div",{className:"lte-divider",children:e("span",{children:"or"})}),t("button",{type:"button",className:"lexical-btn heading-trigger toolbar-active",onClick:()=>i.current?.click(),style:{width:"fit-content",margin:"0 auto"},children:[e(it,{size:20}),e("span",{children:"Upload Image"})]}),h&&e("div",{className:"lte-file-name",children:h.name})]}),e("div",{className:"lte-dialog-footer",children:e("button",{type:"button",className:"lte-primary-btn",disabled:!c&&!h,onClick:()=>{let e=c;h&&(e=URL.createObjectURL(h)),n.update(()=>{const t=Kt({src:e,altText:d});$([t])}),p(void 0),u(""),s(""),l(!1)},children:"Add Image"})})]})]})}const Qt=({id:e,provider:t})=>new tn({id:e,provider:t}),Yt="data-lexical-video",Gt="data-provider",Xt="315px",Vt="560px",Zt=(e,t)=>"drive"===t?`https://drive.google.com/file/d/${e}/preview`:`https://www.youtube-nocookie.com/embed/${e}`,en=e=>{const t=e?.getAttribute(Yt),n=e?.getAttribute(Gt)??"youtube";if(!t)return null;return{node:Qt({id:t,provider:n})}};class tn extends I{constructor({id:e,provider:t,key:n}){super(n),this.__id=e,this.__provider=t}static getType(){return"video"}static clone(e){return new tn({id:e.__id,provider:e.__provider,key:e.getKey()})}static importJSON(e){return Qt({id:e.id,provider:e.provider})}exportJSON(){return{id:this.__id,provider:this.__provider,type:"video",version:1}}updateDOM(){return!1}decorate(){return e("iframe",{height:Xt,width:Vt,src:Zt(this.__id,this.__provider),frameBorder:"0",allowFullScreen:!0})}createDOM(){return document.createElement("div")}exportDOM(){const e=document.createElement("iframe");return e.setAttribute(Yt,this.__id),e.setAttribute(Gt,this.__provider),e.setAttribute("height",Xt),e.setAttribute("width",Vt),e.setAttribute("src",Zt(this.__id,this.__provider)),{element:e}}static importDOM(){return{iframe:()=>({conversion:en,priority:0})}}}function nn(){const[n,i]=a(!1),[o,r]=a(!1),[c,s]=a(""),[d]=qe();return l(()=>{n||(s(""),r(!1))},[n]),t("div",{className:"lexical-text-editor-dialog",children:[e("button",{type:"button",className:`size-8 lexical-btn ${n?"toolbarActive":"toolbar"} icon`,onClick:()=>i(!0),children:e(ot,{size:18,color:"red"})}),t(jt,{open:n,onClose:()=>i(!1),children:[e("div",{className:"lte-dialog-header",children:"Embed Video"}),t("div",{className:"lte-dialog-body",children:[e("input",{className:"lte-input",placeholder:"Add YouTube or Google Drive URL",value:c,onChange:e=>s(e.target.value)}),o&&e("p",{className:"lte-error-text",children:"It's not a valid YouTube or Google Drive URL"})]}),e("div",{className:"lte-dialog-footer",children:e("button",{type:"button",className:"lte-primary-btn",disabled:!c,onClick:()=>{if(!c)return;let e=null,t=null;const n=/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/.exec(c);n&&11===n[2]?.length&&(e="youtube",t=n[2]);const o=/drive\.google\.com\/file\/d\/([a-zA-Z0-9_-]+)\//.exec(c);o&&o[1]&&(e="drive",t=o[1]),t&&e?(d.update(()=>{const n=Qt({id:t,provider:e});$([n])}),s(""),r(!1),i(!1)):r(!0)},children:"Embed"})})]})]})}function on({value:t}){return e("div",{className:"lexical-text-editor-html-preview",dangerouslySetInnerHTML:{__html:t}})}function rn({value:n,triggerLabel:i="Preview"}){const[o,r]=a(!1);return t("div",{className:"lexical-text-editor-dialog",children:[t("button",{type:"button",className:"lexical-btn heading-trigger "+(o?"toolbar-active":"toolbar"),onClick:()=>r(e=>!e),children:[e(rt,{size:18}),e("span",{children:i})]}),t(jt,{open:o,onClose:()=>r(!1),forPreview:!0,children:[e("div",{className:"lte-dialog-header",children:"Content Preview"}),t("div",{className:"lte-preview-container",children:[e("div",{className:"lte-preview-title",children:"CONTENT"}),e(on,{value:n})]})]})]})}const ln=({value:n})=>{const[i]=qe(),[o,r]=a({[at.Undo]:!0,[at.Redo]:!0}),[c,d]=a(!1),[g,f]=a({[at.LeftAlign]:!0}),[b,v]=a({[st.Normal]:!0}),[y,x]=a("paragraph"),[w,A]=a("https://");let T=!0;const D=()=>{if(T){const e=i.getRootElement();e&&(e.scrollTop=0,T=!1)}const e=S();if(E(e)){const t={[at.Bold]:e.hasFormat("bold"),[at.Italics]:e.hasFormat("italic"),[at.Underline]:e.hasFormat("underline"),[at.Uppercase]:e.hasFormat("uppercase"),[at.Lowercase]:e.hasFormat("lowercase"),[at.Capitalize]:e.hasFormat("capitalize"),[at.Strikethrough]:e.hasFormat("strikethrough"),[at.Superscript]:e.hasFormat("superscript"),[at.Subscript]:e.hasFormat("subscript"),[at.Code]:e.hasFormat("code"),[at.Highlight]:e.hasFormat("highlight")};f(t);const n=e.anchor.getNode(),o="root"===n.getKey()?n:n.getTopLevelElementOrThrow(),r=o.getKey();if(!i.getElementByKey(r))return;if(pe(o)){const e=function(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}(n,me),t=e?e.getTag():o.getTag();x(t)}else if("paragraph"===o.getType()||u(o)){let e=null;u(o)&&(e=o.getTag());const t={[st.H1]:"h1"===e,[st.H2]:"h2"===e,[st.H3]:"h3"===e,[st.H4]:"h4"===e,[st.H5]:"h5"===e,[st.H6]:"h6"===e,[st.Normal]:"paragraph"===o.getType()};x(o.getType()),v(t)}else x(o.getType());const l=(N(n)?n:o).getFormat();f(e=>({...e,[at.LeftAlign]:0===l||1===l,[at.CenterAlign]:2===l,[at.RightAlign]:3===l,[at.JustifyAlign]:4===l})),"quote"===o.getType()?f(e=>({...e,[at.Quote]:!0})):f(e=>({...e,[at.Quote]:!1}));const c=e.anchor.getNode(),a=c.getParent();Ye(a)?(f(e=>({...e,[at.Link]:!0})),A(a.getURL()),d(!0)):Ye(c)?(f(e=>({...e,[at.Link]:!0})),A(c.getURL()),d(!0)):(f(e=>({...e,[at.Link]:!1})),A("https://"),d(!1))}};l(()=>Tt(i.registerUpdateListener(({editorState:e})=>{e.read(()=>{D()})}),i.registerCommand(H,()=>(D(),!1),1),i.registerCommand(K,e=>(r(t=>({...t,undo:!e})),!1),1),i.registerCommand(W,e=>(r(t=>({...t,redo:!e})),!1),1)),[]);const M=e=>{switch(e){case at.Bold:i.dispatchCommand(q,"bold");break;case at.Italics:i.dispatchCommand(q,"italic");break;case at.Underline:i.dispatchCommand(q,"underline");break;case at.Lowercase:i.dispatchCommand(q,"lowercase");break;case at.Uppercase:i.dispatchCommand(q,"uppercase");break;case at.Capitalize:i.dispatchCommand(q,"capitalize");break;case at.Strikethrough:i.dispatchCommand(q,"strikethrough");break;case at.Superscript:i.dispatchCommand(q,"superscript");break;case at.Subscript:i.dispatchCommand(q,"subscript");break;case at.Highlight:i.dispatchCommand(q,"highlight");break;case at.Code:i.dispatchCommand(q,"code");break;case at.Quote:i.update(()=>{const e=S();if(E(e)){const t=e.anchor.getNode().getParent();t&&h(t)?function(e,t,n=xt){if(null===e)return;const i=e.getStartEndPoints(),o=new Map;let r=null;if(i){const[e,t]=i;r=C(),r.anchor.set(e.key,e.offset,e.type),r.focus.set(t.key,t.offset,t.type);const n=k(e.getNode(),_),l=k(t.getNode(),_);N(n)&&o.set(n.getKey(),n),N(l)&&o.set(l.getKey(),l)}for(const t of e.getNodes())if(N(t)&&_(t))o.set(t.getKey(),t);else if(null===i){const e=k(t,_);N(e)&&o.set(e.getKey(),e)}for(const[e,i]of o){const o=t();n(i,o),i.replace(o,!0),r&&(e===r.anchor.key&&r.anchor.set(o.getKey(),r.anchor.offset,r.anchor.type),e===r.focus.key&&r.focus.set(o.getKey(),r.focus.offset,r.focus.type))}r&&e.is(S())&&L(r)}(e,()=>Q()):kt(e,()=>p())}});break;case at.Link:O(),d(!0);break;case at.LeftAlign:i.dispatchCommand(j,"left");break;case at.RightAlign:i.dispatchCommand(j,"right");break;case at.CenterAlign:i.dispatchCommand(j,"center");break;case at.JustifyAlign:i.dispatchCommand(j,"justify");break;case at.Undo:i.dispatchCommand(J,void 0);break;case at.Redo:i.dispatchCommand(B,void 0)}},O=s(()=>{i.update(()=>{const e=S();E(e)&&!e.isCollapsed()&&(c?i.dispatchCommand(Qe,null):""!==w&&i.dispatchCommand(Qe,w))})},[i,c,w]),z=s(()=>{A(""),i.dispatchCommand(Qe,null),d(!1)},[i]);return t("div",{className:"lexical-toolbar-wrapper",style:{position:"relative",padding:12,marginBottom:4,borderBottom:"1px solid #e5e7eb"},children:[ht.map(({id:t,label:n,icon:i})=>t===at.Divider?e(zt,{},t):e(It,{content:n,direction:"bottom",children:e("button",{type:"button",className:`size-8 lexical-btn ${g[t]?"toolbarActive":"toolbar"} icon`,onClick:()=>M(t),disabled:!!o[t],children:i})},n)),t("div",{style:{display:"flex",gap:6,justifyContent:"start",alignItems:"center"},children:[e(Ft,{updateHeading:e=>{i.update(()=>{const t=S();E(t)&&kt(t,"normal"===e?()=>Q():()=>m(e))})},headingSelectionMap:b}),e(zt,{})]}),ut.map(({id:t,label:n,icon:i})=>t===at.Divider?e(zt,{},t):e(It,{content:n,direction:"bottom",children:e("button",{type:"button",className:`size-8 lexical-btn ${g[t]?"toolbarActive":"toolbar"} icon`,onClick:()=>M(t),children:i})},t)),t("div",{style:{display:"flex",gap:6,justifyContent:"start",alignItems:"center"},children:[e($t,{blockType:y}),e(zt,{})]}),e(Pt,{}),e(Ot,{onAction:M,selectionMap:g}),t("div",{style:{display:"flex",gap:6,justifyContent:"start",alignItems:"center"},children:[e(Ht,{onAction:M,alignmentSelectionMap:g}),e(zt,{})]}),e(It,{content:"Link",direction:"bottom",children:e("button",{type:"button",className:`size-8 lexical-btn ${g[at.Link]?"toolbarActive":"toolbar"} icon`,onClick:()=>M(at.Link),disabled:!!o[at.Link],children:e(Ve,{})})}),c&&e(Rt,{linkUrl:w,setLinkUrl:A,removeLink:z,onConfirm:e=>{i.dispatchCommand(Qe,{url:e,target:"_blank"}),A(e),d(!1)},onCancel:()=>{A(""),d(!1)}}),e(qt,{}),e(nn,{}),e(rn,{value:n})]})};function cn(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),i=Y().getChildren();for(let o=0;o<i.length;o++)an(e,i[o],n,t);return n.innerHTML}function an(e,t,n,i=null){let o=null===i||t.isSelected(i);const r=N(t)&&t.excludeFromCopy("html");let l=t;if(null!==i){let e=Z(t);e=D(e)&&null!==i?function(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!M(t)&&null!==n){const[i,o]=n,r=e.isBackward(),l=i.getNode(),c=o.getNode(),a=t.is(l),s=t.is(c);if(a||s){const[n,i]=O(e),o=l.is(c),a=t.is(r?c:l),s=t.is(r?l:c);let d,u=0;o?(u=n>i?i:n,d=n>i?n:i):a?(u=r?i:n,d=void 0):s&&(u=0,d=r?n:i),t.__text=t.__text.slice(u,d)}}return t}(i,e):e,l=e}const c=N(l)?l.getChildren():[],a=ee(e,l.getType());let s;s=a&&void 0!==a.exportDOM?a.exportDOM(e,l):l.exportDOM(e);const{element:d,after:u}=s;if(!d)return!1;const h=document.createDocumentFragment();for(let n=0;n<c.length;n++){const r=c[n],l=an(e,r,h,i);!o&&N(t)&&l&&t.extractWithChild(r,i,"html")&&(o=!0)}if(o&&!r){if((te(d)||ne(d))&&d.append(h),n.append(d),u){const e=u.call(l,d);e&&(ne(d)?d.replaceChildren(e):d.replaceWith(e))}}else n.append(h);return o}const sn=new Set(["STYLE","SCRIPT"]);function dn(e,t,n,i,o=new Map,r){let l=[];if(sn.has(e.nodeName))return l;let c=null;const a=function(e,t){const{nodeName:n}=e,i=t._htmlConversions.get(n.toLowerCase());let o=null;if(void 0!==i)for(const t of i){const n=t(e);null!==n&&(null===o||(o.priority||0)<=(n.priority||0))&&(o=n)}return null!==o?o.conversion:null}(e,t),s=a?a(e):null;let d=null;if(null!==s){d=s.after;const t=s.node;if(c=Array.isArray(t)?t[t.length-1]:t,null!==c){for(const[,e]of o)if(c=e(c,r),!c)break;c&&l.push(...Array.isArray(t)?t:[c])}null!=s.forChild&&o.set(e.nodeName,s.forChild)}const u=e.childNodes;let h=[];const p=(null==c||!A(c))&&(null!=c&&ie(c)||i);for(let e=0;e<u.length;e++)h.push(...dn(u[e],t,n,p,new Map(o),c));return null!=d&&(h=d(h)),oe(e)&&(h=function(e,t,n){const i=e.style.textAlign,o=[];let r=[];for(let e=0;e<t.length;e++){const l=t[e];if(ie(l))i&&!l.getFormat()&&l.setFormat(i),o.push(l);else if(r.push(l),e===t.length-1||e<t.length-1&&ie(t[e+1])){const e=n();e.setFormat(i),e.append(...r),o.push(e),r=[]}}return o}(e,h,p?()=>{const e=new X;return n.push(e),e}:Q)),null==c?h.length>0?l=l.concat(h):oe(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(re(e.nextSibling)&&re(e.previousSibling))}(e)&&(l=l.concat(V())):N(c)&&c.append(...h),l}function un({value:t,onChange:n}){const[i]=qe(),[o,r]=a(!0);return l(()=>{t&&o&&(r(!1),i.update(()=>{if(cn(i)!==t){Y().clear();const e=(new DOMParser).parseFromString(t,"text/html"),n=function(e,t){const n=G(t)?t.body.childNodes:t.childNodes;let i=[];const o=[];for(const t of n)if(!sn.has(t.nodeName)){const n=dn(t,e,o,!1);null!==n&&(i=i.concat(n))}return function(e){for(const t of e)t.getNextSibling()instanceof X&&t.insertAfter(V());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(o),i}(i,e);$(n)}}))},[i,t,o]),l(()=>{r(!0)},[t]),e(ct,{onChange:e=>{e.read(()=>{n(cn(i))})}})}const hn=({id:e})=>new vn({id:e}),pn="data-lexical-youtube",mn="315px",gn="560px",fn=e=>`https://www.youtube-nocookie.com/embed/${e}`,bn=e=>{const t=e?.getAttribute(pn);if(!t)return null;return{node:hn({id:t})}};class vn extends I{constructor({id:e,key:t}){super(t),this.__id=e}static getType(){return"youtube"}static clone(e){return new vn({id:e.__id,key:e.getKey()})}static importJSON(e){return hn({id:e.id})}exportJSON(){return{id:this.__id,type:"youtube",version:1}}decorate(){return e("iframe",{height:mn,width:gn,src:fn(this.__id),frameBorder:"0",allowFullScreen:!0})}createDOM(){return document.createElement("div")}exportDOM(){const e=document.createElement("iframe");return e.setAttribute(pn,this.__id),e.setAttribute("height",mn),e.setAttribute("width",gn),e.setAttribute("src",fn(this.__id)),{element:e}}static importDOM(){return{iframe:()=>({conversion:bn,priority:0})}}}class yn extends le{constructor(e,t){super(e,t)}static getType(){return"extended-text"}static clone(e){return new yn(e.__text,e.__key)}static importDOM(){const e=le.importDOM();return{...e,br:()=>({conversion:()=>({node:V()}),priority:1}),span:()=>({conversion:xn(e?.span),priority:1}),div:()=>({conversion:xn(e?.div),priority:1}),p:()=>({conversion:xn(e?.p),priority:1}),b:()=>({conversion:xn(e?.b),priority:1}),strong:()=>({conversion:xn(e?.strong),priority:1}),i:()=>({conversion:xn(e?.i),priority:1}),em:()=>({conversion:xn(e?.em),priority:1}),u:()=>({conversion:xn(e?.u),priority:1}),s:()=>({conversion:xn(e?.s),priority:1}),strike:()=>({conversion:xn(e?.strike),priority:1}),code:()=>({conversion:xn(e?.code),priority:1})}}static importJSON(e){return function(e=""){return P(new yn(e))}().updateFromJSON(e)}isSimpleText(){return"extended-text"===this.__type&&0===this.__mode}}function xn(e){return t=>{const n=e?.(t);if(!n)return null;const i=n.conversion(t);if(!i)return i;const o=t.style,r=[];o.backgroundColor&&r.push(`background-color: ${o.backgroundColor}`),o.color&&r.push(`color: ${o.color}`),o.fontFamily&&r.push(`font-family: ${o.fontFamily}`),o.fontWeight&&r.push(`font-weight: ${o.fontWeight}`),o.fontSize&&r.push(`font-size: ${o.fontSize}`),o.fontStyle&&r.push(`font-style: ${o.fontStyle}`),o.textDecoration&&r.push(`text-decoration: ${o.textDecoration}`),o.whiteSpace&&r.push(`white-space: ${o.whiteSpace}`),o.textAlign&&r.push(`text-align: ${o.textAlign}`);const l=t.getAttribute("style");if(l){l.split(";").filter(e=>e.trim()).forEach(e=>{const[t]=e.split(":").map(e=>e.trim());t&&!r.some(e=>e.startsWith(t))&&r.push(e.trim())})}return{...i,forChild:(e,t)=>{const n=i?.forChild??(e=>e),o=n(e,t);if(D(o)&&r.length>0){const e=r.join("; ");return o.setStyle(e)}return o}}}}const wn={text:{bold:"lexical-bold",underline:"lexical-underline",italic:"lexical-italic",strikethrough:"lexical-strikethrough",underlineStrikethrough:"lexical-underline-strikethrough",uppercase:"lexical-uppercase",lowercase:"lexical-lowercase",capitalize:"lexical-capitalize",code:"lexical-code"},paragraph:"lexical-paragraph",list:{ul:"lexical-list-ul",ol:"lexical-list-ol",listitem:"lexical-listitem"},quote:"lexical-quote",link:"lexical-link"},Cn=o.memo(function({name:n,value:o,onChange:r,placeholder:l,maxWidth:c=null,height:a=null}){const s=d(()=>({namespace:n,theme:wn,onError:e=>{console.error("Lexical error:",e)},nodes:[yn,{replace:le,with:e=>new yn(e.__text),withKlass:yn},g,b,v,me,ge,f,Ge,Jt,vn,tn,ce]}),[n]);return e("div",{className:"lexical-text-editor lexical-editor-container",style:{maxWidth:c||"1090px"},children:t(i,{initialConfig:s,children:[e("div",{className:"lexical-toolbar-container",children:e(ln,{value:o})}),e("div",{className:"lexical-editor-inner",children:e(y,{contentEditable:e(x,{className:"lexical-content-editable",style:{height:a||"500px"}}),placeholder:e("div",{className:"lexical-placeholder",children:l||"Some Text"}),ErrorBoundary:w})}),e(ae,{}),e(se,{}),e(lt,{}),e(un,{value:o,onChange:r})]})})});export{Cn as LexicalTextEditor};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{LexicalComposer as o}from"@lexical/react/LexicalComposer";import i,{useRef as l,useEffect as r,cloneElement as a,useState as c,useCallback as s,useMemo as d}from"react";import{$isHeadingNode as u,$isQuoteNode as h,$createQuoteNode as p,$createHeadingNode as m,HeadingNode as g,QuoteNode as f}from"@lexical/rich-text";import{$isCodeNode as b,$createCodeNode as y,CodeHighlightNode as v,CodeNode as x}from"@lexical/code";import{RichTextPlugin as w}from"@lexical/react/LexicalRichTextPlugin";import{ContentEditable as C}from"@lexical/react/LexicalContentEditable";import{LexicalErrorBoundary as k}from"@lexical/react/LexicalErrorBoundary";import{$createRangeSelection as N,$findMatchingParent as S,INTERNAL_$isBlock as _,$isElementNode as L,$getSelection as T,$setSelection as E,$isRootOrShadowRoot as A,$hasAncestor as R,$isRangeSelection as M,$isTextNode as D,$isTokenOrSegmented as F,$getCharacterOffsets as z,$isLeafNode as W,$getPreviousSelection as O,$caretRangeFromSelection as I,$getRoot as H,$getNodeByKey as U,SELECTION_CHANGE_COMMAND as $,$createParagraphNode as P,KEY_TAB_COMMAND as B,OUTDENT_CONTENT_COMMAND as K,INDENT_CONTENT_COMMAND as J,COMMAND_PRIORITY_EDITOR as V,DecoratorNode as j,$applyNodeReplacement as q,PASTE_COMMAND as Q,COMMAND_PRIORITY_LOW as X,$insertNodes as Y,CAN_REDO_COMMAND as G,CAN_UNDO_COMMAND as Z,REDO_COMMAND as ee,UNDO_COMMAND as te,FORMAT_ELEMENT_COMMAND as ne,FORMAT_TEXT_COMMAND as oe,isDOMDocumentNode as ie,ArtificialNode__DO_NOT_USE as le,$createLineBreakNode as re,$cloneWithProperties as ae,getRegisteredNode as ce,isHTMLElement as se,isDocumentFragment as de,$isBlockElementNode as ue,isBlockDomNode as he,isInlineDomNode as pe,TextNode as me}from"lexical";import{HistoryPlugin as ge}from"@lexical/react/LexicalHistoryPlugin";import{ListPlugin as fe}from"@lexical/react/LexicalListPlugin";import{REMOVE_LIST_COMMAND as be,INSERT_ORDERED_LIST_COMMAND as ye,INSERT_UNORDERED_LIST_COMMAND as ve,ListNode as xe,$isListNode as we,ListItemNode as Ce}from"@lexical/list";import{INSERT_HORIZONTAL_RULE_COMMAND as ke,HorizontalRuleNode as Ne}from"@lexical/react/LexicalHorizontalRuleNode";import{HorizontalRulePlugin as Se}from"@lexical/react/LexicalHorizontalRulePlugin";import{TablePlugin as _e}from"@lexical/react/LexicalTablePlugin";import{$findCellNode as Le,INSERT_TABLE_COMMAND as Te,$isTableCellNode as Ee,TableCellHeaderStates as Ae,$insertTableRowAtSelection as Re,$deleteTableRowAtSelection as Me,$insertTableColumnAtSelection as De,$deleteTableColumnAtSelection as Fe,TableNode as ze,TableRowNode as We,TableCellNode as Oe}from"@lexical/table";import{RxLetterCaseLowercase as Ie,RxLetterCaseUppercase as He,RxLetterCaseCapitalize as Ue}from"react-icons/rx";import{TbBold as $e,TbItalic as Pe,TbUnderline as Be,TbSeparatorHorizontal as Ke,TbArrowsLeftRight as Je}from"react-icons/tb";import{BsSuperscript as Ve,BsSubscript as je,BsChatSquareQuote as qe,BsArrowCounterclockwise as Qe,BsArrowClockwise as Xe,BsJustifyLeft as Ye,BsTextCenter as Ge,BsJustifyRight as Ze,BsJustify as et,BsTextParagraph as tt,BsTypeH1 as nt,BsTypeH2 as ot,BsTypeH3 as it,BsTypeH4 as lt,BsTypeH5 as rt,BsTypeH6 as at,BsPencilSquare as ct,BsListOl as st,BsListUl as dt,BsTable as ut,BsFullscreenExit as ht,BsFullscreen as pt,BsThreeDots as mt,BsSun as gt,BsMoon as ft}from"react-icons/bs";import{AiOutlineStrikethrough as bt,AiOutlineFontColors as yt,AiOutlineBgColors as vt}from"react-icons/ai";import{IoCodeSlashOutline as xt,IoChevronUp as wt,IoChevronDown as Ct,IoClose as kt,IoImageOutline as Nt,IoSearchOutline as St,IoCodeOutline as _t}from"react-icons/io5";import{PiHighlighterLight as Lt}from"react-icons/pi";import{RiEraserLine as Tt,RiIndentIncrease as Et,RiIndentDecrease as At,RiFontFamily as Rt,RiFontSize as Mt}from"react-icons/ri";import{useLexicalComposerContext as Dt}from"@lexical/react/LexicalComposerContext";import{TOGGLE_LINK_COMMAND as Ft,$isLinkNode as zt,LinkNode as Wt}from"@lexical/link";import{HiChevronDown as Ot}from"react-icons/hi2";import{createPortal as It}from"react-dom";import{IoIosLink as Ht}from"react-icons/io";import{MdCheck as Ut,MdMonitor as $t,MdWrapText as Pt}from"react-icons/md";import{BiUnlink as Bt}from"react-icons/bi";import{SketchPicker as Kt}from"react-color";import{LuUpload as Jt}from"react-icons/lu";import{FaYoutube as Vt}from"react-icons/fa";import{VscPreview as jt}from"react-icons/vsc";import{LinkPlugin as qt}from"@lexical/react/LexicalLinkPlugin";import{OnChangePlugin as Qt}from"@lexical/react/LexicalOnChangePlugin";var Xt,Yt;!function(e){e.Bold="bold",e.Italics="italics",e.Underline="underline",e.Quote="quote",e.Lowercase="lowercase",e.Uppercase="uppercase",e.Capitalize="capitalize",e.Strikethrough="strikethrough",e.Superscript="superscript",e.Subscript="subscript",e.Highlight="highlight",e.Code="code",e.Link="link",e.LeftAlign="leftAlign",e.CenterAlign="centerAlign",e.RightAlign="rightAlign",e.JustifyAlign="justifyAlign",e.Divider="divider",e.Undo="undo",e.Redo="redo",e.ClearFormatting="clearFormatting",e.CodeBlock="codeBlock",e.HorizontalRule="horizontalRule",e.Indent="indent",e.Outdent="outdent",e.Table="table",e.FindReplace="findReplace",e.SourceView="sourceView",e.Fullscreen="fullscreen"}(Xt||(Xt={})),function(e){e.Normal="normal",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6"}(Yt||(Yt={}));const Gt=[{id:Xt.Lowercase,icon:e(Ie,{}),label:"Lowercase"},{id:Xt.Uppercase,icon:e(He,{}),label:"Uppercase"},{id:Xt.Capitalize,icon:e(Ue,{}),label:"Capitalize"},{id:Xt.Strikethrough,icon:e(bt,{}),label:"Strikethrough"},{id:Xt.Highlight,icon:e(Lt,{}),label:"Highlight",fontSize:10},{id:Xt.Superscript,icon:e(Ve,{}),label:"Superscript"},{id:Xt.Subscript,icon:e(je,{}),label:"Subscript"}],Zt=[{id:Xt.Bold,icon:e($e,{}),label:"Bold"},{id:Xt.Italics,icon:e(Pe,{}),label:"Italics"},{id:Xt.Underline,icon:e(Be,{}),label:"Underline"},{id:Xt.Divider},{id:Xt.Quote,icon:e(qe,{}),label:"Quote"},{id:Xt.Code,icon:e(xt,{}),label:"Code"},{id:Xt.ClearFormatting,icon:e(Tt,{}),label:"Clear Formatting"}],en=[{id:Xt.Undo,icon:e(Qe,{}),label:"Undo"},{id:Xt.Redo,icon:e(Xe,{}),label:"Redo"},{id:Xt.Divider}],tn=[{id:Xt.LeftAlign,icon:e(Ye,{}),label:"Left Align"},{id:Xt.CenterAlign,icon:e(Ge,{}),label:"Center Align"},{id:Xt.RightAlign,icon:e(Ze,{}),label:"Right Align"},{id:Xt.JustifyAlign,icon:e(et,{}),label:"Justify Align"}],nn=[{id:Xt.Indent,icon:e(Et,{}),label:"Indent"},{id:Xt.Outdent,icon:e(At,{}),label:"Outdent"},{id:Xt.Divider},{id:Xt.HorizontalRule,icon:e(Ke,{}),label:"Horizontal Rule"}],on=[{id:"normal",label:"Normal",icon:e(tt,{})},{id:"h1",label:"Heading 1",icon:e(nt,{})},{id:"h2",label:"Heading 2",icon:e(ot,{})},{id:"h3",label:"Heading 3",icon:e(it,{})},{id:"h4",label:"Heading 4",icon:e(lt,{})},{id:"h5",label:"Heading 5",icon:e(rt,{})},{id:"h6",label:"Heading 6",icon:e(at,{})}],ln=[{id:"plaintext",label:"Plain Text"},{id:"javascript",label:"JavaScript"},{id:"typescript",label:"TypeScript"},{id:"python",label:"Python"},{id:"java",label:"Java"},{id:"csharp",label:"C#"},{id:"cpp",label:"C++"},{id:"php",label:"PHP"},{id:"ruby",label:"Ruby"},{id:"go",label:"Go"},{id:"rust",label:"Rust"},{id:"swift",label:"Swift"},{id:"kotlin",label:"Kotlin"},{id:"html",label:"HTML"},{id:"css",label:"CSS"},{id:"sql",label:"SQL"},{id:"json",label:"JSON"},{id:"bash",label:"Bash"},{id:"markdown",label:"Markdown"},{id:"yaml",label:"YAML"},{id:"xml",label:"XML"}];function rn(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const an=new Map;function cn(e){let t=an.get(e);return void 0===t&&(t=function(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,o]=e.split(/:([^]+)/);n&&o&&(t[n.trim()]=o.trim())}return t}(e),an.set(e,t)),t}function sn(e,t){(M(e)?e.isCollapsed():D(e)||L(e))||rn(280);const n=cn(M(e)?e.style:D(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((t,[o,i])=>("function"==typeof i?t[o]=i(n[o],e):null===i?delete t[o]:t[o]=i,t),{...n}),i=function(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}(o);M(e)||D(e)?e.setStyle(i):e.setTextStyle(i),an.set(i,o)}function dn(e,t){if(M(e)&&e.isCollapsed()){sn(e,t);const n=e.anchor.getNode();L(n)&&n.isEmpty()&&sn(n,t)}!function(e){const t=T();if(!t)return;const n=new Map,o=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(M(t))for(const e of I(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const i=t.getNodes();for(const t of i){if(!D(t)||!t.canHaveFormat())continue;const[n,i]=o(t);i!==n&&(F(t)||0===n&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[0===n?0:1]))}M(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&function(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:o,offset:i,type:l}=t;t.set(n.key,n.offset,n.type),n.set(o,i,l)}}(t)}(e=>{sn(e,t)})}function un(e,t){const n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function hn(e,t,n=un){if(null===e)return;const o=e.getStartEndPoints(),i=new Map;let l=null;if(o){const[e,t]=o;l=N(),l.anchor.set(e.key,e.offset,e.type),l.focus.set(t.key,t.offset,t.type);const n=S(e.getNode(),_),r=S(t.getNode(),_);L(n)&&i.set(n.getKey(),n),L(r)&&i.set(r.getKey(),r)}for(const t of e.getNodes())if(L(t)&&_(t))i.set(t.getKey(),t);else if(null===o){const e=S(t,_);L(e)&&i.set(e.getKey(),e)}for(const[e,o]of i){const i=t();n(o,i),o.replace(i,!0),l&&(e===l.anchor.key&&l.anchor.set(i.getKey(),l.anchor.offset,l.anchor.type),e===l.focus.key&&l.focus.set(i.getKey(),l.focus.offset,l.focus.type))}l&&e.is(T())&&E(l)}function pn(e){return e.getNode().isAttached()}function mn(e){let t=e;for(;null!==t&&!A(t);){const e=t.getLatest(),n=t.getParent();0===e.getChildrenSize()&&t.remove(!0),t=n}}function gn(e,t,n=null){const o=e.getStartEndPoints(),i=o?o[0]:null,l=e.getNodes(),r=l.length;if(null!==i&&(0===r||1===r&&"element"===i.type&&0===i.getNode().getChildrenSize())){const e="text"===i.type?i.getNode().getParentOrThrow():i.getNode(),o=e.getChildren();let l=t();return l.setFormat(e.getFormatType()),l.setIndent(e.getIndent()),o.forEach(e=>l.append(e)),n&&(l=n.append(l)),void e.replace(l)}let a=null,c=[];for(let o=0;o<r;o++){const i=l[o];A(i)?(fn(e,c,c.length,t,n),c=[],a=i):null===a||null!==a&&R(i,a)?c.push(i):(fn(e,c,c.length,t,n),c=[i])}fn(e,c,c.length,t,n)}function fn(e,t,n,o,i=null){if(0===t.length)return;const l=t[0],r=new Map,a=[];let c=L(l)?l:l.getParentOrThrow();c.isInline()&&(c=c.getParentOrThrow());let s=!1;for(;null!==c;){const e=c.getPreviousSibling();if(null!==e){c=e,s=!0;break}if(c=c.getParentOrThrow(),A(c))break}const d=new Set;for(let e=0;e<n;e++){const n=t[e];L(n)&&0===n.getChildrenSize()&&d.add(n.getKey())}const u=new Set;for(let e=0;e<n;e++){const n=t[e];let i=n.getParent();if(null!==i&&i.isInline()&&(i=i.getParent()),null!==i&&W(n)&&!u.has(n.getKey())){const e=i.getKey();if(void 0===r.get(e)){const t=o();t.setFormat(i.getFormatType()),t.setIndent(i.getIndent()),a.push(t),r.set(e,t),i.getChildren().forEach(e=>{t.append(e),u.add(e.getKey()),L(e)&&e.getChildrenKeys().forEach(e=>u.add(e))}),mn(i)}}else if(d.has(n.getKey())){L(n)||rn(179);const e=o();e.setFormat(n.getFormatType()),e.setIndent(n.getIndent()),a.push(e),n.remove(!0)}}if(null!==i)for(let e=0;e<a.length;e++){const t=a[e];i.append(t)}let h=null;if(A(c))if(s)if(null!==i)c.insertAfter(i);else for(let e=a.length-1;e>=0;e--){const t=a[e];c.insertAfter(t)}else{const e=c.getFirstChild();if(L(e)&&(c=e),null===e)if(i)c.append(i);else for(let e=0;e<a.length;e++){const t=a[e];c.append(t),h=t}else if(null!==i)e.insertBefore(i);else for(let t=0;t<a.length;t++){const n=a[t];e.insertBefore(n),h=n}}else if(i)c.insertAfter(i);else for(let e=a.length-1;e>=0;e--){const t=a[e];c.insertAfter(t),h=t}const p=O();M(p)&&pn(p.anchor)&&pn(p.focus)?E(p.clone()):null!==h?h.selectEnd():e.dirty=!0}function bn(e,t,n){const o=cn(e.getStyle());return null!==o&&o[t]||n}function yn(e,t,n=""){let o=null;const i=e.getNodes(),l=e.anchor,r=e.focus,a=e.isBackward(),c=a?r.offset:l.offset,s=a?r.getNode():l.getNode();if(M(e)&&e.isCollapsed()&&""!==e.style){const n=cn(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e<i.length;e++){const l=i[e];if((0===e||0!==c||!l.is(s))&&D(l)){const e=bn(l,t,n);if(null===o)o=e;else if(o!==e){o="";break}}}return null===o?n:o}const vn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,xn=vn&&"documentMode"in document?document.documentMode:null;function wn(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Cn(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function kn({open:t,onOpenChange:n,children:o}){const c=l(null),s=l(null);return r(()=>{function e(e){c.current?.contains(e.target)||s.current?.contains(e.target)||n(!1)}return t&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t,n]),e("div",{className:"popover-root",children:i.Children.map(o,e=>e&&"object"==typeof e?e.type===Nn?a(e,{triggerRef:c}):e.type===Sn?a(e,{contentRef:s,triggerRef:c}):e:e)})}function Nn({children:t,triggerRef:n}){return e("div",{className:"popover-trigger",ref:n,children:t})}function Sn({open:t,align:n="start",children:o,contentRef:a,triggerRef:c}){const s=l(null),[d,u]=i.useState(!1);return r(()=>{if(!t)return;const e=()=>{const e=s.current,t=c?.current;if(!e||!t)return;const o=t.closest(".lexical-text-editor"),i=!!o?.classList.contains("lexical-dark");e.classList.contains("lexical-dark")!==i&&e.classList.toggle("lexical-dark",i);const l=t.getBoundingClientRect(),r=e.offsetWidth,a=e.offsetHeight;let d=l.left;"center"===n?d=l.left+l.width/2-r/2:"end"===n&&(d=l.right-r),d=Math.max(8,Math.min(window.innerWidth-r-8,d));let h=l.bottom+4;h+a>window.innerHeight-8&&l.top>a+8&&(h=l.top-a-4),e.style.left=`${d}px`,e.style.top=`${h}px`,u(i)};return e(),requestAnimationFrame(e),window.addEventListener("resize",e),document.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),document.removeEventListener("scroll",e,!0)}},[t,n,c]),t?It(e("div",{ref:s,className:"lexical-text-editor"+(d?" lexical-dark":""),style:{position:"fixed",top:0,left:0,zIndex:9999,background:"transparent",border:"none",borderRadius:0,boxShadow:"none",padding:0,margin:0,height:"fit-content",maxWidth:"none"},children:e("div",{ref:e=>{a.current=e},className:"popover-content",style:{position:"static",top:"auto",left:"auto",borderRadius:6,border:"none",boxShadow:"none",margin:0,width:"100%"},children:o})}),document.body):null}function _n({onAction:n,selectionMap:o}){const[i,r]=c(!1),a=l(null),s=l(null);return t(kn,{open:i,onOpenChange:r,children:[e(Nn,{triggerRef:a,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(i?"toolbar-active":"toolbar"),onClick:()=>r(e=>!e),children:[e("span",{children:"Aa"}),e(Ot,{className:"chevron "+(i?"rotated":"")})]})}),e(Sn,{open:i,align:"start",onClose:()=>r(!1),contentRef:s,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:Gt.map(({id:i,label:l,icon:a})=>t("button",{type:"button",className:"lexical-btn "+(o[i]?"toolbar-active":"toolbar"),onClick:()=>{n(i),r(!1)},style:{minWidth:130},children:[a,e("span",{className:"label",children:l})]},i))})})]})}function Ln(){return e("div",{className:"w-[1px] h-[20px] mx-[2px] bg-gray-300 shrink-0"})}function Tn({updateHeading:n,headingSelectionMap:o}){const i=on.find(e=>o[e.id]),[r,a]=c(!1),s=l(null),d=l(null);return t(kn,{open:r,onOpenChange:a,children:[e(Nn,{triggerRef:s,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(r?"toolbar-active":"toolbar"),onClick:()=>a(e=>!e),style:{minWidth:132},children:[i?.icon,e("span",{children:i?.label}),e(Ot,{className:"chevron "+(r?"rotated":"")})]})}),e(Sn,{open:r,align:"start",onClose:()=>a(!1),contentRef:d,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:on.map(({id:i,label:l,icon:r})=>t("button",{type:"button",className:"lexical-btn "+(o[i]?"toolbar-active":"toolbar"),onClick:()=>{n(i),a(!1)},children:[r,e("span",{className:"label",children:l})]},i))})})]})}function En({linkUrl:n,setLinkUrl:o,onConfirm:i,onCancel:a,removeLink:s}){const[d,u]=c(!1),h=l(null),p=l(null);return r(()=>{"https://"===n&&u(!0)},[n]),r(()=>{d&&p.current?.focus()},[d]),r(()=>{const e=e=>{h.current&&!h.current.contains(e.target)&&a()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]),t("div",{ref:h,className:"lexical-text-editor-link link-editor-container",children:[e("div",{className:"link-editor-input-wrapper",children:d?e("input",{ref:p,className:"link-editor-input",value:n,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),i(n),u(!1)):"Escape"===e.key&&(e.preventDefault(),u(!1),a())}}):e("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"link-editor-url",children:n})}),t("div",{className:"link-editor-buttons",children:[e("button",{type:"button",className:"lexical-btn heading-trigger toolbar",onClick:()=>{d?(i(n),u(!1)):u(!0)},children:d?e(Ut,{size:18}):e(ct,{size:14})}),e("button",{type:"button",className:"lexical-btn heading-trigger toolbar",onMouseDown:e=>e.preventDefault(),onClick:s,children:e(Bt,{size:14,style:{stroke:"black"}})})]})]})}function An({onClose:n}){const[o]=Dt(),[i,a]=c(""),[s,d]=c(""),[u,h]=c(!1),[p,m]=c([]),[g,f]=c(0),b=l(null);r(()=>{b.current?.focus()},[]);const y=()=>{if(!i)return[];const e=u?i:i.toLowerCase(),t=[],n=H().getAllTextNodes();for(const o of n){const n=u?o.getTextContent():o.getTextContent().toLowerCase();let i=n.indexOf(e);for(;-1!==i;)t.push({key:o.getKey(),start:i}),i=n.indexOf(e,i+e.length)}return t};r(()=>{const e=o.getEditorState().read(y);m(e),f(0)},[o,i,u]),r(()=>o.registerUpdateListener(({editorState:e})=>{const t=e.read(y);m(t),f(e=>0===t.length?0:Math.min(e,t.length-1))}),[o,i,u]);const v=e=>{if(0===p.length)return;const t=(g+e+p.length)%p.length,n=p[t];f(t),o.update(()=>{const e=U(n.key);D(e)&&e.select(n.start,n.start+i.length)}),requestAnimationFrame(()=>{const e=o.getElementByKey(n.key);e?.scrollIntoView({block:"nearest"})})},x=i.length>0,w=p.length>0;return t("div",{className:"lexical-find-replace",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),n())},children:[t("div",{className:"lexical-fr-row",children:[e("input",{ref:b,className:"lexical-fr-input",placeholder:"Find",value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v(e.shiftKey?-1:1))}}),e("span",{className:"lexical-fr-count",children:w?`${g+1} of ${p.length}`:x?"0 results":""})]}),e("div",{className:"lexical-fr-row",children:e("input",{className:"lexical-fr-input",placeholder:"Replace with",value:s,onChange:e=>d(e.target.value)})}),t("div",{className:"lexical-fr-row",children:[t("label",{className:"lexical-fr-case",children:[e("input",{type:"checkbox",checked:u,onChange:e=>h(e.target.checked)}),e("span",{children:"Match case"})]}),e("span",{style:{flex:1}}),e("button",{type:"button",className:"lexical-btn toolbar",onClick:()=>v(-1),disabled:!w,"aria-label":"Previous match",children:e(wt,{})}),e("button",{type:"button",className:"lexical-btn toolbar",onClick:()=>v(1),disabled:!w,"aria-label":"Next match",children:e(Ct,{})}),e("button",{type:"button",className:"lexical-btn toolbar",onClick:()=>{o.update(()=>{const e=y();if(0===e.length)return m([]),void f(0);const t=e[Math.min(g,e.length-1)],n=U(t.key);D(n)&&n.spliceText(t.start,i.length,s,!0)})},disabled:!w,children:"Replace"}),e("button",{type:"button",className:"lexical-btn toolbar",onClick:()=>{o.update(()=>{const e=y();for(let t=e.length-1;t>=0;t--){const n=e[t],o=U(n.key);D(o)&&o.spliceText(n.start,i.length,s,!1)}})},disabled:!w,children:"Replace All"}),e("button",{type:"button",className:"lexical-btn toolbar",onClick:n,"aria-label":"Close find and replace",children:e(kt,{})})]})]})}function Rn({anchorRef:t,onClose:n,children:o}){const i=l(null);return r(()=>{const e=e=>{const o=e.target;!i.current||i.current.contains(o)||t.current&&t.current.contains(o)||n()},o=e=>{"Escape"===e.key&&n()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",o)}},[t,n]),e("div",{ref:i,className:"lte-overflow-panel",children:e("div",{className:"lte-overflow-grid",children:o})})}function Mn({onAction:n,alignmentSelectionMap:o}){const i=tn.find(e=>o[e.id]),[r,a]=c(!1),s=l(null),d=l(null);return t(kn,{open:r,onOpenChange:a,children:[e(Nn,{triggerRef:s,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(r?"toolbar-active":"toolbar"),onClick:()=>a(e=>!e),style:{minWidth:146},children:[i?.icon,e("span",{children:i?.label}),e(Ot,{className:"chevron "+(r?"rotated":"")})]})}),e(Sn,{open:r,align:"start",onClose:()=>a(!1),contentRef:d,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:tn.map(({id:i,label:l,icon:r})=>t("button",{type:"button",className:"lexical-btn "+(o[i]?"toolbar-active":"toolbar"),onClick:()=>{n(i),a(!1)},children:[r,e("span",{className:"label",children:l})]},i))})})]})}function Dn({color:n,onChange:o,icon:i}){const[a,s]=c(!1),d=l(null),u=l(null);r(()=>{const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);return t("div",{className:"color-picker-wrapper",children:[e("button",{type:"button",ref:d,className:`size-10 lexical-btn ${a?"toolbarActive":"toolbar"} icon`,onClick:()=>s(e=>!e),children:i}),a&&It(e("div",{ref:u,className:"lexical-color-popover "+(a?"open":""),style:{top:d.current?.getBoundingClientRect().bottom,left:d.current?.getBoundingClientRect().left,position:"absolute"},onMouseDown:e=>e.preventDefault(),children:e(Kt,{color:n,onChangeComplete:e=>{o(e.hex)}})}),document.body)]})}function Fn(){const[o]=Dt(),[{color:i,bgColor:l},a]=c({color:"#000",bgColor:"#fff"}),s=()=>{const e=T();if(M(e)){const t=yn(e,"color","#000"),n=yn(e,"background","#fff");a({color:t,bgColor:n})}};r(()=>wn(o.registerUpdateListener(({editorState:e})=>{e.read(()=>{s()})}),o.registerCommand($,()=>(s(),!1),1)),[o]);const d=({property:e,color:t})=>{o.update(()=>{const n=T();n&&dn(n,{[e]:t})})};return t(n,{children:[e(Dn,{color:i,onChange:e=>{d({property:"color",color:e})},icon:e(yt,{})}),e(Dn,{color:l,onChange:e=>{d({property:"background",color:e})},icon:e(vt,{})})]})}function zn({icon:n,tooltipLabel:o,currentValue:i,options:r,onSelect:a,minWidth:s=132}){const d=r.find(e=>""!==e.id&&e.id===i),[u,h]=c(!1),p=l(null),m=l(null);return t(kn,{open:u,onOpenChange:h,children:[e(Nn,{triggerRef:p,children:t("button",{type:"button","aria-label":o,className:"lexical-btn heading-trigger font-trigger "+(u?"toolbar-active":"toolbar"),style:{minWidth:s},onClick:()=>h(e=>!e),children:[n,e("span",{children:d?.label??"Default"}),e(Ot,{className:"chevron "+(u?"rotated":"")})]})}),e(Sn,{open:u,align:"start",onClose:()=>h(!1),contentRef:m,children:e("div",{style:{display:"flex",flexDirection:"column",gap:5},children:r.map(t=>e("button",{type:"button",className:"lexical-btn "+(""===t.id&&""===i||""!==t.id&&t.id===i?"toolbar-active":"toolbar"),onClick:()=>{a(t.id),h(!1)},children:e("span",{className:"label",children:t.label})},t.label))})})]})}vn&&"InputEvent"in window&&!xn&&new window.InputEvent("input");const Wn=[{id:"",label:"Default"},{id:"Inter",label:"Inter"},{id:"System UI",label:"System"},{id:"serif",label:"Serif"},{id:"monospace",label:"Monospace"},{id:"cursive",label:"Cursive"},{id:"Georgia",label:"Georgia"},{id:"Courier New",label:"Courier"}];function On(){const[t]=Dt(),[n,o]=c(""),i=()=>{const e=T();if(M(e)){const t=yn(e,"font-family","");o((e=>e.replace(/['"]/g,"").trim())(t))}};r(()=>wn(t.registerUpdateListener(({editorState:e})=>{e.read(()=>{i()})}),t.registerCommand($,()=>(i(),!1),1)),[t]);return e(zn,{icon:e(Rt,{}),tooltipLabel:"Font Family",currentValue:n,options:Wn,onSelect:e=>{t.update(()=>{const t=T();M(t)&&dn(t,{"font-family":""===e?null:e})})}})}const In=[{id:"",label:"Default"},...[12,14,16,18,20,24,28,32,36,48].map(e=>({id:`${e}px`,label:`${e}`}))];function Hn(){const[t]=Dt(),[n,o]=c(""),i=()=>{const e=T();if(M(e)){const t=yn(e,"font-size","");o((e=>e.trim())(t))}};r(()=>wn(t.registerUpdateListener(({editorState:e})=>{e.read(()=>{i()})}),t.registerCommand($,()=>(i(),!1),1)),[t]);return e(zn,{icon:e(Mt,{}),tooltipLabel:"Font Size",currentValue:n,options:In,onSelect:e=>{t.update(()=>{const t=T();M(t)&&dn(t,{"font-size":""===e?null:e})})}})}function Un(){const[n]=Dt(),[o,i]=c(!1),[a,s]=c(null),[d,u]=c(!1),h=l(null),p=l(null),m=()=>{const e=T();if(M(e)){const t=e.anchor.getNode(),n="root"===t.getKey()?t:t.getTopLevelElementOrThrow(),o=b(n);i(o),o&&s(n.getLanguage()??null)}};r(()=>wn(n.registerUpdateListener(({editorState:e})=>{e.read(()=>{m()})}),n.registerCommand($,()=>(m(),!1),1)),[n]);const g=ln.find(e=>e.id===a)?.label??"Plain Text";return t(kn,{open:d,onOpenChange:u,children:[e(Nn,{triggerRef:h,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(o?"toolbar-active":"toolbar"),onClick:()=>u(e=>!e),children:[e(xt,{}),e("span",{children:g}),e(Ot,{className:"chevron "+(d?"rotated":"")})]})}),e(Sn,{open:d,align:"start",onClose:()=>u(!1),contentRef:p,children:t("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[t("button",{type:"button",className:"lexical-btn "+(o?"toolbar-active":"toolbar"),onClick:()=>{n.update(()=>{const e=T();if(!M(e))return;const t=e.anchor.getNode(),n="root"===t.getKey()?t:t.getTopLevelElementOrThrow();if(b(n))hn(e,()=>P());else{const t=a??"javascript";hn(e,()=>y(t))}}),u(!1)},style:{minWidth:150},children:[e(xt,{}),e("span",{className:"label",children:o?"Remove Code Block":"Code Block"})]}),e("div",{className:"w-full h-[1px] bg-gray-200 my-1"}),e("div",{style:{display:"flex",flexDirection:"column",gap:5,maxHeight:260,overflowY:"auto"},children:ln.map(({id:t,label:o})=>e("button",{type:"button",className:"lexical-btn "+(a===t?"toolbar-active":"toolbar"),onClick:()=>{var e;s(e=t),n.update(()=>{const t=T();if(!M(t))return;const n=t.anchor.getNode(),o="root"===n.getKey()?n:n.getTopLevelElementOrThrow();b(o)&&o.setLanguage(e)}),u(!1)},style:{minWidth:150},children:e("span",{className:"label",children:o})},t))})]})})]})}const $n=({content:n,direction:o="top",delay:i=400,children:r})=>{const[a,s]=c(!1),[d,u]=c(null),h=l(null),p=l(null),m=()=>{h.current=window.setTimeout(()=>{const e=p.current;if(e){const t=e.getBoundingClientRect();u({left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.width,height:t.height})}s(!0)},i)},g=()=>{h.current&&clearTimeout(h.current),s(!1)};if(!d)return e("div",{ref:p,className:"Lexical-Tooltip-Wrapper",onMouseEnter:m,onMouseLeave:g,children:r});const f=d.left+d.width/2,b=d.top+d.height/2,y="bottom"===o?{top:d.bottom+10,left:f,bottom:"auto"}:"top"===o?{bottom:window.innerHeight-d.top+10,top:"auto",left:f}:"right"===o?{left:d.right+10,right:"auto",top:b}:{left:"auto",right:window.innerWidth-d.left+10,top:b};return t("div",{ref:p,className:"Lexical-Tooltip-Wrapper",onMouseEnter:m,onMouseLeave:g,children:[r,a&&It(e("div",{className:`Lexical-Tooltip-Tip ${o}`,style:{position:"fixed",pointerEvents:"none",...y,zIndex:1e4},children:n}),document.body)]})};function Pn({blockType:o}){const[i]=Dt();r(()=>wn(i.registerCommand(B,e=>{const t=T();if(!M(t))return!1;return!!Cn(t.anchor.getNode(),xe)&&(e.preventDefault(),i.dispatchCommand(e.shiftKey?K:J,void 0),!0)},V)),[i]);return t(n,{children:[e($n,{content:"Ordered list",direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${"ol"===o?"toolbarActive":"toolbar"} icon`,onClick:()=>{"ol"===o?i.dispatchCommand(be,void 0):i.dispatchCommand(ye,void 0)},children:e(st,{})})}),e($n,{content:"Unordered list",direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${"ul"===o?"toolbarActive":"toolbar"} icon`,onClick:()=>{"ul"===o?i.dispatchCommand(be,void 0):i.dispatchCommand(ve,void 0)},children:e(dt,{})})})]})}function Bn(){const[n]=Dt(),[o,i]=c(!1),[a,s]=c(!1),[d,u]=c(null),h=l(null),p=l(null),m=()=>{const e=T();if(M(e)){const t=Le(e.anchor.getNode());i(!!t)}else i(!1)};r(()=>wn(n.registerUpdateListener(({editorState:e})=>{e.read(()=>{m()})}),n.registerCommand($,()=>(m(),!1),1)),[n]);const g=e=>{n.update(()=>{const t=T();M(t)&&e()}),s(!1)},f=d?`${d.rows} × ${d.cols}`:"Insert Table";return t(kn,{open:a,onOpenChange:s,children:[e(Nn,{triggerRef:h,children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(o?"toolbar-active":"toolbar"),onClick:()=>s(e=>!e),children:[e(ut,{}),e(Ot,{className:"chevron "+(a?"rotated":"")})]})}),e(Sn,{open:a,align:"start",onClose:()=>s(!1),contentRef:p,children:t("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t("div",{style:{width:"fit-content"},children:[e("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 18px)",gap:3},children:Array.from({length:25},(t,o)=>{const i=Math.floor(o/5)+1,l=o%5+1,r=d&&i<=d.rows&&l<=d.cols;return e("div",{onMouseEnter:()=>u({rows:i,cols:l}),onClick:()=>{return e=i,t=l,n.dispatchCommand(Te,{rows:String(e),columns:String(t),includeHeaders:!1}),void s(!1);var e,t},style:{width:18,height:18,borderRadius:3,border:"1px solid #d1d5db",backgroundColor:r?"#c7d2fe":"#fff",cursor:"pointer"}},o)})}),e("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:f})]}),e("div",{className:"w-full h-[1px] bg-gray-200"}),t("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>g(()=>{Re(!1)}),style:{minWidth:160},children:e("span",{className:"label",children:"Insert row above"})}),e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>g(()=>{Re(!0)}),style:{minWidth:160},children:e("span",{className:"label",children:"Insert row below"})}),e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>g(()=>{Me()}),style:{minWidth:160},children:e("span",{className:"label",children:"Delete row"})}),e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>g(()=>{De(!1)}),style:{minWidth:160},children:e("span",{className:"label",children:"Insert column left"})}),e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>g(()=>{De(!0)}),style:{minWidth:160},children:e("span",{className:"label",children:"Insert column right"})}),e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>g(()=>{Fe()}),style:{minWidth:160},children:e("span",{className:"label",children:"Delete column"})}),e("button",{type:"button",className:"lexical-btn toolbar",disabled:!o,onClick:()=>{g(()=>{const e=T();if(!M(e))return;const t=Le(e.anchor.getNode());if(!t)return;const n=t.getParent();if(!n)return;const o=n.getChildren().filter(Ee),i=o.some(e=>e.hasHeaderState(Ae.ROW));for(const e of o)e.setHeaderStyles(i?Ae.NO_STATUS:Ae.ROW,Ae.ROW)})},style:{minWidth:160},children:e("span",{className:"label",children:"Toggle header row"})})]})]})})]})}const Kn=({src:n,altText:o,nodeKey:i,width:r,height:a,maxWidth:s,caption:d=""})=>{const[u]=Dt(),[h,p]=c(!1),[m,g]=c(d),f=l(null),b=l(null),y=l(null),v=l(null),x=e=>{if(!v.current||!b.current)return;const t=e.clientX-v.current.x,n=Math.min(s,Math.max(50,v.current.width+t)),o=n*b.current.ratio;b.current.width=n,b.current.height=o;const i=y.current?.querySelector("img");i&&(i.style.width=n+"px",i.style.height=o+"px")},w=()=>{if(!b.current)return;const{width:e,height:t}=b.current;u.update(()=>{const n=U(i);n&&"function"==typeof n.updateDimensions&&n.updateDimensions(e,t)}),b.current=null,v.current=null,window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",w)},C=()=>{p(!1),u.update(()=>{const e=U(i);e&&"function"==typeof e.setCaption&&e.setCaption(m)})},k=()=>{g(d),p(!0),setTimeout(()=>f.current?.focus(),0)};return t("div",{ref:y,style:{display:"inline-block",position:"relative",maxWidth:s},children:[e("img",{src:n,alt:o,width:"inherit"===r?void 0:r,height:"inherit"===a?void 0:a,style:{maxWidth:"100%",display:"block"}}),(d||h)&&e("div",{style:{textAlign:"center",marginTop:4},children:h?e("input",{ref:f,className:"lte-input",style:{width:"100%",textAlign:"center"},value:m,onChange:e=>g(e.target.value),onBlur:C,onKeyDown:e=>{"Enter"===e.key&&C()}}):e("span",{style:{fontSize:13,color:"#666",cursor:"text",display:"inline-block",minWidth:20,minHeight:18},onClick:k,children:d})}),!d&&!h&&e("div",{style:{textAlign:"center",marginTop:2},children:e("span",{style:{fontSize:12,color:"#999",cursor:"pointer"},onClick:k,children:"+ Add caption"})}),e("div",{onMouseDown:e=>{e.preventDefault(),e.stopPropagation();const t=y.current?.querySelector("img");if(!t)return;const n=t.getBoundingClientRect().width,o=t.naturalHeight/t.naturalWidth,i=n*o;v.current={x:e.clientX,y:e.clientY,width:n,height:i},b.current={width:n,height:i,ratio:o},window.addEventListener("mousemove",x),window.addEventListener("mouseup",w)},style:{position:"absolute",bottom:d||h?40:0,right:0,width:14,height:14,background:"white",border:"1px solid #999",cursor:"nwse-resize",borderRadius:2}})]})},Jn=e=>q(new jn(e)),Vn=e=>{if(!(e instanceof HTMLImageElement))return null;const{src:t,alt:n}=e;let o,i;e.width&&(o=e.width),e.height&&(i=e.height);const l=e.style;if((!o||0===o)&&l.width){const e=parseInt(l.width,10);Number.isNaN(e)||(o=e)}if((!i||0===i)&&l.height){const e=parseInt(l.height,10);Number.isNaN(e)||(i=e)}return{node:Jn({src:t,altText:n,width:o??"inherit",height:i??"inherit"})}};class jn extends j{constructor({src:e="",altText:t="",maxWidth:n=1080,width:o="inherit",height:i="inherit",caption:l="",key:r}={src:"",altText:""}){super(r),this.__src=e,this.__altText=t,this.__maxWidth=n,this.__width=o,this.__height=i,this.__caption=l}static getType(){return"image"}static clone(e){return new jn({src:e.__src,altText:e.__altText,width:e.__width,height:e.__height,maxWidth:e.__maxWidth,caption:e.__caption,key:e.getKey()})}createDOM(){return document.createElement("span")}updateDOM(e){return e.__width!==this.__width||e.__height!==this.__height}exportDOM(){const e=document.createElement("img");if(e.src=this.__src,e.alt=this.__altText,"inherit"!==this.__width&&(e.width=this.__width??0),"inherit"!==this.__height&&(e.height=this.__height??0),this.__caption){const t=document.createElement("figure"),n=document.createElement("figcaption");return n.textContent=this.__caption,t.appendChild(e),t.appendChild(n),{element:t}}return{element:e}}static importDOM(){return{img:()=>({conversion:Vn,priority:1}),figure:()=>({conversion:e=>{const t=e.querySelector("img");if(!t)return null;const n=e.querySelector("figcaption"),o=n?.textContent||"",i=Vn(t);return i?.node instanceof jn&&o&&(i.node.__caption=o),i},priority:1})}}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,maxWidth:this.__maxWidth,width:this.__width,height:this.__height,caption:this.__caption}}static importJSON(e){return new jn({src:e.src,altText:e.altText,maxWidth:e.maxWidth,width:e.width,height:e.height,caption:e.caption})}updateDimensions(e,t){const n=this.getWritable();n.__width=e,n.__height=t}setCaption(e){this.getWritable().__caption=e}decorate(){return e(Kn,{src:this.__src,altText:this.__altText,nodeKey:this.getKey(),width:this.__width,height:this.__height,maxWidth:this.__maxWidth,caption:this.__caption})}}function qn({open:n,onClose:o,forPreview:i=!1,children:a}){const c=l(null);return r(()=>{if(!n)return;const e=e=>{c.current&&!c.current.contains(e.target)&&o()},t=e=>{"Escape"===e.key&&o()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[n,o]),n?e("div",{className:"lexical-text-editor-dialog lte-dialog-overlay",children:t("div",{ref:c,className:"lte-dialog "+(i?"preview":""),children:[e("button",{type:"button",className:"lte-dialog-close",onClick:o,children:"×"}),a]})}):null}async function Qn(e,{src:t,altText:n="",caption:o=""}){e.update(()=>{const e=Jn({src:t,altText:n,caption:o});Y([e])})}function Xn({onImageUpload:n}){const[o]=Dt(),i=l(null),[a,d]=c(!1),[u,h]=c(""),[p,m]=c(""),[g,f]=c(""),[b,y]=c(),[v,x]=c(!1),w=s(async(e,t="",i="")=>{let l;l=n?await n(e):URL.createObjectURL(e),Qn(o,{src:l,altText:t,caption:i})},[o,n]);return r(()=>{const e=o.registerCommand(Q,e=>{if(e instanceof ClipboardEvent){const t=e.clipboardData?.items;if(!t)return!1;for(const n of t)if(n.type.startsWith("image/")){e.preventDefault();const t=n.getAsFile();return t&&w(t,"","").catch(console.error),!0}}return!1},X);return()=>e()},[o,w]),t("div",{className:"lexical-text-editor-dialog",children:[e("input",{type:"file",ref:i,accept:"image/*",className:"lte-hidden",onChange:e=>{const t=e.target.files?.[0];t&&y(t),e.target.value=""}}),e($n,{content:"Add Image",direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${a?"toolbarActive":"toolbar"} icon`,onClick:()=>d(e=>!e),children:e(Nt,{size:18})})}),t(qn,{open:a,onClose:()=>d(!1),children:[e("div",{className:"lte-dialog-header",children:"Add Image"}),t("div",{className:"lte-dialog-body",children:[e("input",{className:"lte-input",placeholder:"Alt text",value:p,onChange:e=>m(e.target.value)}),e("input",{className:"lte-input",placeholder:"Caption",value:g,onChange:e=>f(e.target.value)}),e("input",{className:"lte-input",placeholder:"Add image by URL",value:u,onChange:e=>h(e.target.value)}),e("div",{className:"lte-divider",children:e("span",{children:"or"})}),t("button",{type:"button",className:"lexical-btn heading-trigger toolbar-active",onClick:()=>i.current?.click(),style:{width:"fit-content",margin:"0 auto"},children:[e(Jt,{size:20}),e("span",{children:"Upload Image"})]}),b&&e("div",{className:"lte-file-name",children:b.name})]}),e("div",{className:"lte-dialog-footer",children:e("button",{type:"button",className:"lte-primary-btn",disabled:!u&&!b||v,onClick:async()=>{if(!v){if(b){x(!0);try{await w(b,p,g)}catch(e){return console.error("Image upload failed:",e),void x(!1)}x(!1)}else{if(!u)return;Qn(o,{src:u,altText:p,caption:g})}y(void 0),m(""),f(""),h(""),d(!1)}},children:v?"Uploading...":"Add Image"})})]})]})}const Yn=({id:e,provider:t})=>new io({id:e,provider:t}),Gn="data-lexical-video",Zn="data-provider",eo="315px",to="560px",no=(e,t)=>"drive"===t?`https://drive.google.com/file/d/${e}/preview`:`https://www.youtube-nocookie.com/embed/${e}`,oo=e=>{const t=e?.getAttribute(Gn),n=e?.getAttribute(Zn)??"youtube";if(!t)return null;return{node:Yn({id:t,provider:n})}};class io extends j{constructor({id:e,provider:t,key:n}){super(n),this.__id=e,this.__provider=t}static getType(){return"video"}static clone(e){return new io({id:e.__id,provider:e.__provider,key:e.getKey()})}static importJSON(e){return Yn({id:e.id,provider:e.provider})}exportJSON(){return{id:this.__id,provider:this.__provider,type:"video",version:1}}updateDOM(){return!1}decorate(){return e("iframe",{height:eo,width:to,src:no(this.__id,this.__provider),frameBorder:"0",allowFullScreen:!0})}createDOM(){return document.createElement("div")}exportDOM(){const e=document.createElement("iframe");return e.setAttribute(Gn,this.__id),e.setAttribute(Zn,this.__provider),e.setAttribute("height",eo),e.setAttribute("width",to),e.setAttribute("src",no(this.__id,this.__provider)),{element:e}}static importDOM(){return{iframe:()=>({conversion:oo,priority:0})}}}function lo(){const[n,o]=c(!1),[i,l]=c(!1),[a,s]=c(""),[d]=Dt();return r(()=>{n||(s(""),l(!1))},[n]),t("div",{className:"lexical-text-editor-dialog",children:[e($n,{content:"Embed Video",direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${n?"toolbarActive":"toolbar"} icon`,onClick:()=>o(!0),children:e(Vt,{size:18,color:"red"})})}),t(qn,{open:n,onClose:()=>o(!1),children:[e("div",{className:"lte-dialog-header",children:"Embed Video"}),t("div",{className:"lte-dialog-body",children:[e("input",{className:"lte-input",placeholder:"Add YouTube or Google Drive URL",value:a,onChange:e=>s(e.target.value)}),i&&e("p",{className:"lte-error-text",children:"It's not a valid YouTube or Google Drive URL"})]}),e("div",{className:"lte-dialog-footer",children:e("button",{type:"button",className:"lte-primary-btn",disabled:!a,onClick:()=>{if(!a)return;let e=null,t=null;const n=/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/.exec(a);n&&11===n[2]?.length&&(e="youtube",t=n[2]);const i=/drive\.google\.com\/file\/d\/([a-zA-Z0-9_-]+)\//.exec(a);i&&i[1]&&(e="drive",t=i[1]),t&&e?(d.update(()=>{const n=Yn({id:t,provider:e});Y([n])}),s(""),l(!1),o(!1)):l(!0)},children:"Embed"})})]})]})}function ro({value:t}){return e("div",{className:"lexical-text-editor-html-preview",dangerouslySetInnerHTML:{__html:t}})}function ao({value:n,triggerLabel:o="Preview"}){const[i,l]=c(!1);return t("div",{className:"lexical-text-editor-dialog",children:[e($n,{content:o,direction:"bottom",children:t("button",{type:"button",className:"lexical-btn heading-trigger "+(i?"toolbar-active":"toolbar"),onClick:()=>l(e=>!e),children:[e(jt,{size:18}),e("span",{children:o})]})}),t(qn,{open:i,onClose:()=>l(!1),forPreview:!0,children:[e("div",{className:"lte-dialog-header",children:"Content Preview"}),t("div",{className:"lte-preview-container",children:[e("div",{className:"lte-preview-title",children:"CONTENT"}),e(ro,{value:n})]})]})]})}const co=[{id:"fontFamily"},{id:"fontSize"},{id:"color"},{id:"textFormats",primary:!0},{id:"dropdown"},{id:"lists"},{id:"blockOptions"},{id:"primaryAlignment",primary:!0},{id:"primaryLink",primary:!0},{id:"codeBlock"},{id:"image"},{id:"video"},{id:"table"},{id:"utility"},{id:"preview"}];co.filter(e=>!e.primary).map(e=>e.id);const so=["textFormats","lists","primaryAlignment","primaryLink","fontFamily","fontSize","color","dropdown","codeBlock","blockOptions","image","video","table","utility","preview"],uo=({value:o,onImageUpload:i,sourceView:a=!1,onToggleSourceView:d,fullscreen:g=!1,onToggleFullscreen:f,toolbarStyle:b="wrap"})=>{const y="normal"===b?"collapse":b,[v]=Dt(),[x,w]=c({[Xt.Undo]:!0,[Xt.Redo]:!0}),[C,k]=c(!1),[N,S]=c(!1),[_,E]=c(0),[A,R]=c(!1),F=l(null),z=l(null),W=l(null),O=l({}),I=l({}),H=l(0),U=l(null),B=l(null),[V,j]=c({[Xt.LeftAlign]:!0}),[q,Q]=c({[Yt.Normal]:!0}),[X,Y]=c("paragraph"),[ie,le]=c("https://");let re=!0;const ae=()=>{if(re){const e=v.getRootElement();e&&(e.scrollTop=0,re=!1)}const e=T();if(M(e)){const t={[Xt.Bold]:e.hasFormat("bold"),[Xt.Italics]:e.hasFormat("italic"),[Xt.Underline]:e.hasFormat("underline"),[Xt.Uppercase]:e.hasFormat("uppercase"),[Xt.Lowercase]:e.hasFormat("lowercase"),[Xt.Capitalize]:e.hasFormat("capitalize"),[Xt.Strikethrough]:e.hasFormat("strikethrough"),[Xt.Superscript]:e.hasFormat("superscript"),[Xt.Subscript]:e.hasFormat("subscript"),[Xt.Code]:e.hasFormat("code"),[Xt.Highlight]:e.hasFormat("highlight")};j(t);const n=e.anchor.getNode(),o="root"===n.getKey()?n:n.getTopLevelElementOrThrow(),i=o.getKey();if(!v.getElementByKey(i))return;if(we(o)){const e=Cn(n,xe),t=e?e.getTag():o.getTag();Y(t)}else if("paragraph"===o.getType()||u(o)){let e=null;u(o)&&(e=o.getTag());const t={[Yt.H1]:"h1"===e,[Yt.H2]:"h2"===e,[Yt.H3]:"h3"===e,[Yt.H4]:"h4"===e,[Yt.H5]:"h5"===e,[Yt.H6]:"h6"===e,[Yt.Normal]:"paragraph"===o.getType()};Y(o.getType()),Q(t)}else Y(o.getType());const l=(L(n)?n:o).getFormat();j(e=>({...e,[Xt.LeftAlign]:0===l||1===l,[Xt.CenterAlign]:2===l,[Xt.RightAlign]:3===l,[Xt.JustifyAlign]:4===l})),"quote"===o.getType()?j(e=>({...e,[Xt.Quote]:!0})):j(e=>({...e,[Xt.Quote]:!1}));const r=e.anchor.getNode(),a=r.getParent();zt(a)?(j(e=>({...e,[Xt.Link]:!0})),le(a.getURL()),k(!0)):zt(r)?(j(e=>({...e,[Xt.Link]:!0})),le(r.getURL()),k(!0)):(j(e=>({...e,[Xt.Link]:!1})),le("https://"),k(!1))}};r(()=>wn(v.registerUpdateListener(({editorState:e})=>{e.read(()=>{ae()})}),v.registerCommand($,()=>(ae(),!1),1),v.registerCommand(Z,e=>(w(t=>({...t,undo:!e})),!1),1),v.registerCommand(G,e=>(w(t=>({...t,redo:!e})),!1),1)),[]);const ce="scrollbar"===y,se=s(()=>{if("collapse"!==y)return;const e=F.current;if(!e)return;const t=e.clientWidth;if(t<=0)return;const n=z.current?z.current.offsetWidth:0,o=so.map(e=>{const t=O.current[e];return t&&"none"!==t.style.display&&(I.current[e]=t.offsetWidth),I.current[e]??0});W.current&&(H.current=W.current.offsetWidth);const i=H.current||40,l=e=>{const t=1+(e>0?1:0)+(so.length-e);let l=n+6*Math.max(0,t-1)+(e>0?i:0);for(let t=0;t<so.length-e;t++)l+=o[t];return l};let r=_;for(;r<so.length&&l(r)>t;)r++;for(;r>0&&l(r-1)<=t;)r--;E(e=>e===r?e:r)},[_,y]);r(()=>{se()});const de=l(()=>{});de.current=se,r(()=>{if("undefined"==typeof ResizeObserver)return;const e=F.current;if(!e)return;const t=new ResizeObserver(()=>{de.current(),fe.current()});return t.observe(e),()=>t.disconnect()},[]),r(()=>{0===_&&R(!1)},[_]),r(()=>{"collapse"!==y&&E(0)},[y]);const ue=s(()=>{if("scrollbar"!==y)return;const e=F.current,t=U.current,n=B.current;if(!e||!t||!n)return;const o=e.clientWidth;if(e.scrollWidth-o<=1)return void(t.style.display="none");t.style.display="flex";const i=Math.max(24,o/e.scrollWidth*o),l=e.scrollWidth-o,r=o-i,a=l>0?e.scrollLeft/l*r:0;n.style.width=`${i}px`,n.style.transform=`translateX(${a}px)`},[b]),he=s(e=>{e.stopPropagation(),e.preventDefault();const t=F.current,n=B.current;if(!t||!n)return;const o=e.clientX,i=t.scrollLeft,l=t.clientWidth,r=Math.max(24,l/t.scrollWidth*l),a=t.scrollWidth-l,c=l-r,s=e=>{const n=e.clientX-o;t.scrollLeft=c>0?i+n/c*a:0},d=()=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",d)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",d)},[]),pe=s(e=>{const t=F.current,n=U.current;if(!t||!n)return;const o=n.getBoundingClientRect(),i=(e.clientX-o.left)/o.width;t.scrollLeft=i*t.scrollWidth-t.clientWidth/2},[]),me=l(null),ge=s(()=>{const e=me.current;if(e)for(const t of e.querySelectorAll(".lte-toolbar-row svg:not(.chevron), .lte-overflow-panel svg:not(.chevron)")){const e=t;try{const t=e.viewBox?.baseVal;if(!t||!t.width)continue;let n=1/0,o=1/0,i=-1/0,l=-1/0;if(e.querySelectorAll("path, circle, rect, ellipse, polygon, polyline, line").forEach(e=>{const t=e.getBBox();(t.width||t.height)&&(n=Math.min(n,t.x),o=Math.min(o,t.y),i=Math.max(i,t.x+t.width),l=Math.max(l,t.y+t.height))}),i===-1/0)continue;const r=((i-n)/t.width+(l-o)/t.height)/2;if(!isFinite(r)||r<=0)continue;const a=Math.min(22,Math.max(17,15/r));parseFloat(e.style.width)!==a&&(e.style.width=`${a}px`,e.style.height=`${a}px`)}catch{}}},[]);r(()=>{ge()}),r(()=>{ue()});const fe=l(()=>{});fe.current=ue,r(()=>{if("scrollbar"!==y)return;const e=F.current;if(!e)return;const t=()=>ue();return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[y,ue]);const be=e=>{switch(e){case Xt.Bold:v.dispatchCommand(oe,"bold");break;case Xt.Italics:v.dispatchCommand(oe,"italic");break;case Xt.Underline:v.dispatchCommand(oe,"underline");break;case Xt.Lowercase:v.dispatchCommand(oe,"lowercase");break;case Xt.Uppercase:v.dispatchCommand(oe,"uppercase");break;case Xt.Capitalize:v.dispatchCommand(oe,"capitalize");break;case Xt.Strikethrough:v.dispatchCommand(oe,"strikethrough");break;case Xt.Superscript:v.dispatchCommand(oe,"superscript");break;case Xt.Subscript:v.dispatchCommand(oe,"subscript");break;case Xt.Highlight:v.dispatchCommand(oe,"highlight");break;case Xt.Code:v.dispatchCommand(oe,"code");break;case Xt.Quote:v.update(()=>{const e=T();if(M(e)){const t=e.anchor.getNode().getParent();t&&h(t)?hn(e,()=>P()):gn(e,()=>p())}});break;case Xt.Link:ye(),k(!0);break;case Xt.LeftAlign:v.dispatchCommand(ne,"left");break;case Xt.RightAlign:v.dispatchCommand(ne,"right");break;case Xt.CenterAlign:v.dispatchCommand(ne,"center");break;case Xt.JustifyAlign:v.dispatchCommand(ne,"justify");break;case Xt.Undo:v.dispatchCommand(te,void 0);break;case Xt.Redo:v.dispatchCommand(ee,void 0);break;case Xt.ClearFormatting:v.update(()=>{const e=T();if(!M(e))return;const t=e.getNodes().filter(D);for(const e of t)e.setFormat(0),e.setStyle("")});break;case Xt.HorizontalRule:v.dispatchCommand(ke,void 0);break;case Xt.Indent:v.dispatchCommand(J,void 0);break;case Xt.Outdent:v.dispatchCommand(K,void 0)}},ye=s(()=>{v.update(()=>{const e=T();M(e)&&!e.isCollapsed()&&(C?v.dispatchCommand(Ft,null):""!==ie&&v.dispatchCommand(Ft,ie))})},[v,C,ie]),ve=s(()=>{le(""),v.dispatchCommand(Ft,null),k(!1)},[v]),Ce=e=>so.indexOf(e)>=so.length-_,Ne={textFormats:e(n,{children:Zt.map(({id:t,label:n,icon:o})=>t===Xt.Divider?e(Ln,{},t):e($n,{content:n,direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${V[t]?"toolbarActive":"toolbar"} icon`,onClick:()=>be(t),children:o})},t))}),primaryAlignment:t(n,{children:[e(Mn,{onAction:be,alignmentSelectionMap:V}),e(Ln,{})]}),primaryLink:e($n,{content:"Link",direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${V[Xt.Link]?"toolbarActive":"toolbar"} icon`,onClick:()=>be(Xt.Link),disabled:!!x[Xt.Link],children:e(Ht,{})})}),lists:t(n,{children:[e(Pn,{blockType:X}),e(Ln,{})]}),blockOptions:e(n,{children:nn.map(({id:t,label:n,icon:o})=>t===Xt.Divider?e(Ln,{},t):e($n,{content:n,direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${V[t]?"toolbarActive":"toolbar"} icon`,onClick:()=>be(t),children:o})},t))}),fontFamily:e(On,{}),fontSize:e(Hn,{}),color:e(Fn,{}),codeBlock:e(Un,{}),dropdown:e(_n,{onAction:be,selectionMap:V}),image:e(Xn,{onImageUpload:i}),video:e(lo,{}),table:e(Bn,{}),utility:t(n,{children:[e(Ln,{}),e($n,{content:"Find & Replace",direction:"bottom",children:e("button",{type:"button","aria-label":"Find & Replace",className:`size-10 lexical-btn ${N?"toolbarActive":"toolbar"} icon`,onClick:()=>S(e=>!e),children:e(St,{})})}),e($n,{content:"Source Code View",direction:"bottom",children:e("button",{type:"button","aria-label":"Source Code View",className:`size-10 lexical-btn ${a?"toolbarActive":"toolbar"} icon`,onClick:()=>d?.(),children:e(_t,{})})}),e($n,{content:g?"Exit Fullscreen":"Fullscreen",direction:"bottom",children:e("button",{type:"button","aria-label":g?"Exit Fullscreen":"Fullscreen",className:`size-10 lexical-btn ${g?"toolbarActive":"toolbar"} icon`,onClick:()=>f?.(),children:e(g?ht:pt,{})})})]}),preview:e(ao,{value:o})};return t("div",{ref:me,className:"lexical-toolbar-wrapper",style:{position:"relative",padding:12,marginBottom:4,borderBottom:"1px solid #e5e7eb"},children:[t("div",{ref:F,className:"lte-toolbar-row "+(ce?"useScroll":"collapse"===y?"lte-nowrap":"lte-wrap"),children:[t("div",{ref:z,className:"lte-toolbar-primary",style:{display:"flex",gap:6,justifyContent:"start",alignItems:"center"},children:[en.map(({id:t,label:n,icon:o})=>t===Xt.Divider?e(Ln,{},t):e($n,{content:n,direction:"bottom",children:e("button",{type:"button",className:`size-10 lexical-btn ${V[t]?"toolbarActive":"toolbar"} icon`,onClick:()=>be(t),disabled:!!x[t],children:o})},n)),t("div",{style:{display:"flex",gap:6,justifyContent:"start",alignItems:"center"},children:[e(Tn,{updateHeading:e=>{v.update(()=>{const t=T();M(t)&&gn(t,"normal"===e?()=>P():()=>m(e))})},headingSelectionMap:q}),e(Ln,{})]})]}),co.map(({id:t})=>{const n=Ce(t);return e("div",{ref:e=>{O.current[t]=e},style:n?{display:"none"}:{display:"flex",gap:6,justifyContent:"start",alignItems:"center"},children:n?null:Ne[t]},t)}),_>0&&e($n,{content:"More tools",direction:"bottom",children:e("button",{type:"button",ref:W,"aria-label":"More tools",className:`size-10 lexical-btn ${A?"toolbarActive":"toolbar"} icon`,onClick:()=>R(e=>!e),children:e(mt,{})})})]}),ce&&e("div",{ref:U,className:"lte-custom-scrollbar",onPointerDown:pe,"aria-hidden":"true",children:e("div",{ref:B,className:"lte-custom-scrollbar-thumb",onPointerDown:he})}),C&&e(En,{linkUrl:ie,setLinkUrl:le,removeLink:ve,onConfirm:e=>{v.dispatchCommand(Ft,{url:e,target:"_blank"}),le(e),k(!1)},onCancel:()=>{le(""),k(!1)}}),A&&e(Rn,{anchorRef:W,onClose:()=>R(!1),children:co.map(({id:e})=>e).filter(e=>Ce(e)&&Ne[e]).map(t=>e("div",{className:"lte-overflow-item",children:Ne[t]},t))}),N&&e(An,{onClose:()=>S(!1)})]})};function ho(e,t){const n=ie(t)?t.body.childNodes:t.childNodes;let o=[];const i=[];for(const t of n)if(!go.has(t.nodeName)){const n=fo(t,e,i,!1);null!==n&&(o=o.concat(n))}return function(e){for(const t of e)t.getNextSibling()instanceof le&&t.insertAfter(re());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(i),o}function po(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),o=H().getChildren();for(let i=0;i<o.length;i++)mo(e,o[i],n,t);return n.innerHTML}function mo(e,t,n,o=null){let i=null===o||t.isSelected(o);const l=L(t)&&t.excludeFromCopy("html");let r=t;if(null!==o){let e=ae(t);e=D(e)&&null!==o?function(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!F(t)&&null!==n){const[o,i]=n,l=e.isBackward(),r=o.getNode(),a=i.getNode(),c=t.is(r),s=t.is(a);if(c||s){const[n,o]=z(e),i=r.is(a),c=t.is(l?a:r),s=t.is(l?r:a);let d,u=0;i?(u=n>o?o:n,d=n>o?n:o):c?(u=l?o:n,d=void 0):s&&(u=0,d=l?n:o),t.__text=t.__text.slice(u,d)}}return t}(o,e):e,r=e}const a=L(r)?r.getChildren():[],c=ce(e,r.getType());let s;s=c&&void 0!==c.exportDOM?c.exportDOM(e,r):r.exportDOM(e);const{element:d,after:u}=s;if(!d)return!1;const h=document.createDocumentFragment();for(let n=0;n<a.length;n++){const l=a[n],r=mo(e,l,h,o);!i&&L(t)&&r&&t.extractWithChild(l,o,"html")&&(i=!0)}if(i&&!l){if((se(d)||de(d))&&d.append(h),n.append(d),u){const e=u.call(r,d);e&&(de(d)?d.replaceChildren(e):d.replaceWith(e))}}else n.append(h);return i}const go=new Set(["STYLE","SCRIPT"]);function fo(e,t,n,o,i=new Map,l){let r=[];if(go.has(e.nodeName))return r;let a=null;const c=function(e,t){const{nodeName:n}=e,o=t._htmlConversions.get(n.toLowerCase());let i=null;if(void 0!==o)for(const t of o){const n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(e,t),s=c?c(e):null;let d=null;if(null!==s){d=s.after;const t=s.node;if(a=Array.isArray(t)?t[t.length-1]:t,null!==a){for(const[,e]of i)if(a=e(a,l),!a)break;a&&r.push(...Array.isArray(t)?t:[a])}null!=s.forChild&&i.set(e.nodeName,s.forChild)}const u=e.childNodes;let h=[];const p=(null==a||!A(a))&&(null!=a&&ue(a)||o);for(let e=0;e<u.length;e++)h.push(...fo(u[e],t,n,p,new Map(i),a));return null!=d&&(h=d(h)),he(e)&&(h=function(e,t,n){const o=e.style.textAlign,i=[];let l=[];for(let e=0;e<t.length;e++){const r=t[e];if(ue(r))o&&!r.getFormat()&&r.setFormat(o),i.push(r);else if(l.push(r),e===t.length-1||e<t.length-1&&ue(t[e+1])){const e=n();e.setFormat(o),e.append(...l),i.push(e),l=[]}}return i}(e,h,p?()=>{const e=new le;return n.push(e),e}:P)),null==a?h.length>0?r=r.concat(h):he(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(pe(e.nextSibling)&&pe(e.previousSibling))}(e)&&(r=r.concat(re())):L(a)&&a.append(...h),r}function bo({value:t,onChange:n}){const[o]=Dt(),[i,l]=c(!0);return r(()=>{t&&i&&(l(!1),o.update(()=>{if(po(o)!==t){H().clear();const e=(new DOMParser).parseFromString(t,"text/html"),n=ho(o,e);Y(n)}}))},[o,t,i]),r(()=>{l(!0)},[t]),e(Qt,{onChange:e=>{e.read(()=>{n(po(o))})}})}function yo({applyRef:n,onExit:o}){const[i]=Dt(),[a,s]=c(()=>i.getEditorState().read(()=>po(i))),d=l(a),u=e=>{e!==d.current&&(i.update(()=>{const t=H();if(t.clear(),t.selectEnd(),e){const t=(new DOMParser).parseFromString(e,"text/html"),n=ho(i,t);n.length>0&&Y(n)}}),d.current=e)};return r(()=>(n.current=()=>{u(a),o()},()=>{n.current=null}),[n,a,o,i]),t("div",{className:"lexical-source-view",children:[e("textarea",{className:"lexical-source-textarea",value:a,onChange:e=>s(e.target.value),"aria-label":"HTML source",spellCheck:!1}),t("div",{className:"lexical-source-actions",children:[e($n,{content:"Apply HTML to the editor",direction:"top",children:t("button",{type:"button",className:"lexical-btn heading-trigger toolbar",onClick:()=>u(a),children:[e(Ut,{size:16}),e("span",{className:"label",children:"Update"})]})}),e("button",{type:"button",className:"lexical-btn heading-trigger toolbar",onClick:()=>{u(a),o()},children:"Done"})]})]})}function vo({showWordCount:n=!0,showCharCount:o=!0,rightSlot:i}){const[l]=Dt(),[a,s]=c({words:0,chars:0});return r(()=>{const e=e=>{e.read(()=>{const e=H().getTextContent(),t=e.trim();s({words:t?t.split(/\s+/).length:0,chars:e.length})})};return e(l.getEditorState()),l.registerUpdateListener(({editorState:t})=>{e(t)})},[l]),t("div",{className:"lexical-status-bar",children:[n&&t("span",{children:[a.words," words"]}),o&&t("span",{children:[a.chars," characters"]}),i&&e("div",{className:"lexical-status-bar-right",children:i})]})}function xo({theme:n,toolbarStyle:o,onThemeChange:i,onToolbarStyleChange:l}){const r="normal"===o?"collapse":o,a=[{value:"light",label:"Light theme",icon:e(gt,{})},{value:"dark",label:"Dark theme",icon:e(ft,{})},{value:"system",label:"Follow system theme",icon:e($t,{})}],c=[{value:"wrap",label:"Toolbar: wrap to new lines",icon:e(Pt,{})},{value:"collapse",label:'Toolbar: collapse into "..."',icon:e(mt,{})},{value:"scrollbar",label:"Toolbar: scroll in one row",icon:e(Je,{})}];return t("div",{className:"lexical-display-controls",role:"group","aria-label":"Display settings",children:[e("div",{className:"lte-mini-seg",role:"radiogroup","aria-label":"Theme",children:a.map(t=>e($n,{content:t.label,direction:"top",children:e("button",{type:"button",role:"radio","aria-checked":n===t.value,"aria-label":t.label,className:"lte-mini-btn btn "+(n===t.value?"active":""),onClick:()=>i?.(t.value),children:t.icon})},t.value))}),e("div",{className:"lte-mini-seg",role:"radiogroup","aria-label":"Toolbar style",children:c.map(t=>e($n,{content:t.label,direction:"top",children:e("button",{type:"button",role:"radio","aria-checked":r===t.value,"aria-label":t.label,className:"lte-mini-btn btn "+(r===t.value?"active":""),onClick:()=>l?.(t.value),children:t.icon})},t.value))})]})}const wo=({id:e})=>new Lo({id:e}),Co="data-lexical-youtube",ko="315px",No="560px",So=e=>`https://www.youtube-nocookie.com/embed/${e}`,_o=e=>{const t=e?.getAttribute(Co);if(!t)return null;return{node:wo({id:t})}};class Lo extends j{constructor({id:e,key:t}){super(t),this.__id=e}static getType(){return"youtube"}static clone(e){return new Lo({id:e.__id,key:e.getKey()})}static importJSON(e){return wo({id:e.id})}exportJSON(){return{id:this.__id,type:"youtube",version:1}}decorate(){return e("iframe",{height:ko,width:No,src:So(this.__id),frameBorder:"0",allowFullScreen:!0})}createDOM(){return document.createElement("div")}exportDOM(){const e=document.createElement("iframe");return e.setAttribute(Co,this.__id),e.setAttribute("height",ko),e.setAttribute("width",No),e.setAttribute("src",So(this.__id)),{element:e}}static importDOM(){return{iframe:()=>({conversion:_o,priority:0})}}}class To extends me{constructor(e,t){super(e,t)}static getType(){return"extended-text"}static clone(e){return new To(e.__text,e.__key)}static importDOM(){const e=me.importDOM();return{...e,span:()=>({conversion:Eo(e?.span),priority:1}),div:()=>({conversion:Eo(e?.div),priority:1}),p:()=>({conversion:Eo(e?.p),priority:1}),b:()=>({conversion:Eo(e?.b),priority:1}),strong:()=>({conversion:Eo(e?.strong),priority:1}),i:()=>({conversion:Eo(e?.i),priority:1}),em:()=>({conversion:Eo(e?.em),priority:1}),u:()=>({conversion:Eo(e?.u),priority:1}),s:()=>({conversion:Eo(e?.s),priority:1}),strike:()=>({conversion:Eo(e?.strike),priority:1}),code:()=>({conversion:Eo(e?.code),priority:1})}}static importJSON(e){return function(e=""){return q(new To(e))}().updateFromJSON(e)}isSimpleText(){return"extended-text"===this.__type&&0===this.__mode}}function Eo(e){return t=>{const n=e?.(t);if(!n)return null;const o=n.conversion(t);if(!o)return o;const i=t.style,l=[];i.backgroundColor&&l.push(`background-color: ${i.backgroundColor}`),i.color&&l.push(`color: ${i.color}`),i.fontFamily&&l.push(`font-family: ${i.fontFamily}`),i.fontWeight&&l.push(`font-weight: ${i.fontWeight}`),i.fontSize&&l.push(`font-size: ${i.fontSize}`),i.fontStyle&&l.push(`font-style: ${i.fontStyle}`),i.textDecoration&&l.push(`text-decoration: ${i.textDecoration}`),i.whiteSpace&&l.push(`white-space: ${i.whiteSpace}`),i.textAlign&&l.push(`text-align: ${i.textAlign}`);const r=t.getAttribute("style");if(r){r.split(";").filter(e=>e.trim()).forEach(e=>{const[t]=e.split(":").map(e=>e.trim());t&&!l.some(e=>e.startsWith(t))&&l.push(e.trim())})}return{...o,forChild:(e,t)=>{const n=o?.forChild??(e=>e),i=n(e,t);if(D(i)&&l.length>0){const e=l.join("; ");return i.setStyle(e)}return i}}}}const Ao={text:{bold:"lexical-bold",underline:"lexical-underline",italic:"lexical-italic",strikethrough:"lexical-strikethrough",underlineStrikethrough:"lexical-underline-strikethrough",uppercase:"lexical-uppercase",lowercase:"lexical-lowercase",capitalize:"lexical-capitalize",code:"lexical-code"},paragraph:"lexical-paragraph",list:{ul:"lexical-list-ul",ol:"lexical-list-ol",listitem:"lexical-listitem"},quote:"lexical-quote",link:"lexical-link",code:"lexical-code-block",hr:"lexical-hr",indent:"lexical-indent",table:"lexical-table",tableRow:"lexical-table-row",tableCell:"lexical-table-cell",codeHighlight:{keyword:"lexical-code-token-keyword",string:"lexical-code-token-string",number:"lexical-code-token-number",comment:"lexical-code-token-comment",function:"lexical-code-token-function",operator:"lexical-code-token-operator",punctuation:"lexical-code-token-punctuation"}},Ro=i.memo(function({name:n,value:i,onChange:a,placeholder:s,maxWidth:u=null,height:h=null,onImageUpload:p,showWordCount:m=!0,showCharCount:b=!0,theme:y="system",toolbarStyle:N="collapse",showDisplayControls:S=!0,onThemeChange:_,onToolbarStyleChange:L}){const[T,E]=c(!1),[A,R]=c(!1),M=l(null),[D,F]=c(!1),[z,W]=c(y),[O,I]=c("normal"===N?"collapse":N);r(()=>{W(y)},[y]),r(()=>{I("normal"===N?"collapse":N)},[N]),r(()=>{if("system"!==z||"undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)");F(e.matches);const t=e=>F(e.matches);return e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))},[z]);const H="dark"===z||"system"===z&&D;r(()=>{if(!A)return;const e=e=>{"Escape"===e.key&&R(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[A]);const U=d(()=>({namespace:n,theme:Ao,onError:e=>{console.error("Lexical error:",e)},nodes:[To,{replace:me,with:e=>new To(e.__text),withKlass:To},g,v,x,xe,Ce,f,Wt,jn,Lo,io,Ne,ze,We,Oe]}),[n]);return e("div",{className:`lexical-text-editor lexical-editor-container ${A?"lexical-fullscreen":""} ${H?"lexical-dark":""}`,style:{maxWidth:A?"none":u||"1090px"},children:t(o,{initialConfig:U,children:[e("div",{className:"lexical-toolbar-container",children:e(uo,{value:i,onImageUpload:p,sourceView:T,onToggleSourceView:()=>{E(e=>!e||(M.current?.(),!1))},fullscreen:A,onToggleFullscreen:()=>{R(e=>!e)},toolbarStyle:O})}),e("div",{className:"lexical-editor-inner",style:T?{display:"none"}:void 0,children:e(w,{contentEditable:e(C,{className:"lexical-content-editable",style:{height:h||"500px"}}),placeholder:e("div",{className:"lexical-placeholder",children:s||"Some Text"}),ErrorBoundary:k})}),T&&e(yo,{applyRef:M,onExit:()=>E(!1)}),(m||b||S)&&e(vo,{showWordCount:m,showCharCount:b,rightSlot:S?e(xo,{theme:z,toolbarStyle:O,onThemeChange:e=>{W(e),_?.(e)},onToolbarStyleChange:e=>{I(e),L?.(e)}}):void 0}),e(ge,{}),e(fe,{}),e(_e,{}),e(Se,{}),e(qt,{}),e(bo,{value:i,onChange:a})]})})});export{Ro as LexicalTextEditor};
2
2
  //# sourceMappingURL=index.esm.js.map