eddyter 1.3.42 → 1.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +483 -483
- package/dist/App.d.ts +3 -2
- package/dist/Provider/EditorProvider.d.ts +32 -31
- package/dist/Provider/LexicalProvider.d.ts +6 -5
- package/dist/api/ai/index.d.ts +83 -41
- package/dist/api/auth.d.ts +108 -108
- package/dist/api/config/axios.d.ts +2 -1
- package/dist/api/config/endpoints.d.ts +24 -22
- package/dist/api/featureSuggestion.d.ts +23 -23
- package/dist/api/linkPreview.d.ts +15 -15
- package/dist/api/transcript/index.d.ts +21 -21
- package/dist/assets/style.css +5269 -5372
- package/dist/{babel-d3085146.js → babel-d155920e.js} +3278 -3551
- package/dist/babel-d155920e.js.map +1 -0
- package/dist/components/AiPlugin/index.d.ts +6 -6
- package/dist/components/AlignMenu/AlignMenu.d.ts +9 -8
- package/dist/components/AlignMenu/AlignMenuDrop.d.ts +3 -2
- package/dist/components/AlignMenu/index.d.ts +1 -1
- package/dist/components/AutoExpandingDemo.d.ts +6 -5
- package/dist/components/BlockFormatMenu/BlockFormatMenu.d.ts +3 -2
- package/dist/components/BlockFormatMenu/constants.d.ts +14 -14
- package/dist/components/BlockFormatMenu/index.d.ts +1 -1
- package/dist/components/ChartEditDialog.d.ts +9 -8
- package/dist/components/ChartInsertDialog.d.ts +8 -7
- package/dist/components/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -6
- package/dist/components/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +9 -8
- package/dist/components/CodeActionMenuPlugin/index.d.ts +5 -4
- package/dist/components/CodeActionMenuPlugin/utils.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -2
- package/dist/components/ColorPicker/index.d.ts +1 -1
- package/dist/components/CommentSidebar/CommentSidebar.d.ts +8 -7
- package/dist/components/CommentSidebar/index.d.ts +1 -1
- package/dist/components/CommentToggle/CommentToggle.d.ts +8 -7
- package/dist/components/CommentToggle/index.d.ts +1 -1
- package/dist/components/CommentView/CommentView.d.ts +9 -8
- package/dist/components/CommentView/index.d.ts +1 -1
- package/dist/components/ConfigurableEditorWithAuth.d.ts +35 -34
- package/dist/components/ContentPreview/index.d.ts +37 -36
- package/dist/components/DatePicker/DatePickerWidget.d.ts +7 -6
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +3 -2
- package/dist/components/EmojiPickerWidget/index.d.ts +1 -1
- package/dist/components/FeatureSuggestionDialog/index.d.ts +6 -6
- package/dist/components/FileUpload/InsertFileDialog.d.ts +7 -7
- package/dist/components/FileUpload/InsertFileUploadedDialogBody.d.ts +5 -4
- package/dist/components/FileView/index.d.ts +9 -8
- package/dist/components/FontFamilySelect/FontFamilyMenu.d.ts +7 -6
- package/dist/components/FontSizePicker/FontSizeControl.d.ts +3 -2
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +3 -2
- package/dist/components/FormatTextMenu/FormatTextMenuDrop.d.ts +3 -2
- package/dist/components/FormatTextMenu/index.d.ts +1 -1
- package/dist/components/HighlightColorPicker/HighlightColorPicker.d.ts +7 -6
- package/dist/components/HtmlViewDisplay.d.ts +3 -2
- package/dist/components/ImageComparisonDialog/index.d.ts +11 -10
- package/dist/components/ImageGenerationDialog/ImageGenerationManager.d.ts +11 -10
- package/dist/components/ImageGenerationDialog/index.d.ts +11 -10
- package/dist/components/ImageInsertTest.d.ts +3 -2
- package/dist/components/ImageView/ImageDialog/ImageUploadDialogBody.d.ts +9 -8
- package/dist/components/ImageView/ImageDialog/index.d.ts +6 -5
- package/dist/components/ImageView/ImageResizer.d.ts +16 -15
- package/dist/components/ImageView/index.d.ts +17 -16
- package/dist/components/InsertMenu/InsertMenu.d.ts +9 -8
- package/dist/components/InsertMenu/InsertMenuDrop.d.ts +9 -8
- package/dist/components/InsertMenu/index.d.ts +1 -1
- package/dist/components/LanguageSelectorDialog/index.d.ts +8 -7
- package/dist/components/LinkPreviewHover/index.d.ts +40 -40
- package/dist/components/NotePanelMenu/NotePanelMenu.d.ts +6 -5
- package/dist/components/NotePanelMenu/index.d.ts +1 -1
- package/dist/components/NotePanelView/NotePanelView.d.ts +9 -8
- package/dist/components/NotePanelView/index.d.ts +1 -1
- package/dist/components/Placeholder/Placeholder.d.ts +3 -2
- package/dist/components/Placeholder/index.d.ts +1 -1
- package/dist/components/Placeholder/styles.d.ts +1 -1
- package/dist/components/ScopedEditor.d.ts +8 -8
- package/dist/components/SignatureCaption/index.d.ts +6 -5
- package/dist/components/TableColorPicker/index.d.ts +8 -7
- package/dist/components/TableModal/TableModal.d.ts +10 -9
- package/dist/components/TextEnhanceDialog/index.d.ts +10 -9
- package/dist/components/ToneAdjustDialog/index.d.ts +8 -7
- package/dist/components/Toolbar/Toolbar.d.ts +3 -2
- package/dist/components/Toolbar/index.d.ts +1 -1
- package/dist/components/Toolbar/styles.d.ts +6 -6
- package/dist/components/VoiceTranscriptIcon/VoiceTranscriptIcon.d.ts +2 -1
- package/dist/components/VoiceTranscriptIcon/index.d.ts +1 -1
- package/dist/components/ui/avatar.d.ts +6 -6
- package/dist/components/ui/badge.d.ts +9 -8
- package/dist/components/ui/button.d.ts +11 -10
- package/dist/components/ui/calendar.d.ts +8 -7
- package/dist/components/ui/card.d.ts +8 -8
- package/dist/components/ui/checkbox.d.ts +4 -4
- package/dist/components/ui/dialog.d.ts +19 -19
- package/dist/components/ui/dropdown-menu.d.ts +27 -27
- package/dist/components/ui/input.d.ts +3 -3
- package/dist/components/ui/label.d.ts +4 -4
- package/dist/components/ui/popover.d.ts +7 -7
- package/dist/components/ui/select.d.ts +13 -13
- package/dist/components/ui/separator.d.ts +4 -4
- package/dist/components/ui/sheet.d.ts +24 -24
- package/dist/components/ui/skeleton.d.ts +3 -3
- package/dist/components/ui/tabs.d.ts +7 -7
- package/dist/components/ui/textarea.d.ts +3 -3
- package/dist/components/ui/tooltip.d.ts +7 -7
- package/dist/constants.d.ts +22 -21
- package/dist/context/CommentContext.d.ts +43 -42
- package/dist/context/HtmlViewContext.d.ts +17 -16
- package/dist/context/ToolbarContext.d.ts +56 -55
- package/dist/editorConfig.d.ts +48 -48
- package/dist/{estree-164983f6.js → estree-b1fff53b.js} +1778 -1763
- package/dist/estree-b1fff53b.js.map +1 -0
- package/dist/hooks/useAutoExpandingHeight.d.ts +15 -15
- package/dist/hooks/useBlockFormat.d.ts +17 -16
- package/dist/hooks/useColorPicker.d.ts +6 -6
- package/dist/hooks/useCustomCommands.d.ts +3 -2
- package/dist/hooks/useDebounce.d.ts +1 -1
- package/dist/hooks/useEditorToolbar.d.ts +10 -9
- package/dist/hooks/useInsertMenu.d.ts +9 -9
- package/dist/hooks/useModal.d.ts +5 -5
- package/dist/hooks/useReactNativeBridge.d.ts +54 -54
- package/dist/hooks/useS3Uploader.d.ts +11 -11
- package/dist/hooks/useVoiceToText.d.ts +20 -20
- package/dist/{html-5586dbf6.js → html-f95ee5dc.js} +656 -701
- package/dist/html-f95ee5dc.js.map +1 -0
- package/dist/{html2pdf.bundle-2448d0c9.js → html2pdf.bundle-29ea2f41.js} +2 -2
- package/dist/html2pdf.bundle-29ea2f41.js.map +1 -0
- package/dist/{html2pdf.bundle.min-4c9e3abf.js → html2pdf.bundle.min-f6392183.js} +2 -2
- package/dist/html2pdf.bundle.min-f6392183.js.map +1 -0
- package/dist/{index-ef9100c2.js → index-34ac313f.js} +2 -2
- package/dist/index-34ac313f.js.map +1 -0
- package/dist/{index-5a175541.js → index-4ea49f5b.js} +2 -2
- package/dist/index-4ea49f5b.js.map +1 -0
- package/dist/{index-9ff3d80c.js → index-636eff7f.js} +858 -947
- package/dist/index-636eff7f.js.map +1 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.js +1 -1
- package/dist/lib/utils.d.ts +2 -1
- package/dist/main.d.ts +1 -0
- package/dist/{markdown-d513479b.js → markdown-1d9e6c3f.js} +1789 -1836
- package/dist/markdown-1d9e6c3f.js.map +1 -0
- package/dist/nodes/ChartNode.d.ts +41 -40
- package/dist/nodes/CommentNode.d.ts +34 -33
- package/dist/nodes/CommentedTextNode.d.ts +29 -28
- package/dist/nodes/EmbedNode.d.ts +32 -31
- package/dist/nodes/FileNode.d.ts +32 -31
- package/dist/nodes/ImageNode.d.ts +65 -64
- package/dist/nodes/MentionNode.d.ts +75 -74
- package/dist/nodes/NotePanelNode.d.ts +31 -30
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +25 -24
- package/dist/pages/ConfigurableEditor/index.d.ts +2 -2
- package/dist/pages/NotFound.d.ts +2 -2
- package/dist/pages/RichTextEditor.d.ts +6 -6
- package/dist/pages/TextareaEditor.d.ts +6 -6
- package/dist/pages/styles.d.ts +5 -5
- package/dist/plugins/AIChatPlugin.d.ts +11 -10
- package/dist/plugins/AndroidKeyboardFixPlugin.d.ts +16 -16
- package/dist/plugins/AutocompletePlugin.d.ts +22 -22
- package/dist/plugins/CodeBlockNormalizerPlugin.d.ts +8 -8
- package/dist/plugins/CodeBlockSelectAllPlugin.d.ts +8 -8
- package/dist/plugins/CodeHighlightPlugin.d.ts +3 -2
- package/dist/plugins/CombinedAutocompletGrammarPlugin.d.ts +21 -20
- package/dist/plugins/CommentBubblePlugin.d.ts +3 -2
- package/dist/plugins/CommentPlugin.d.ts +7 -6
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRuleNode.d.ts +29 -28
- package/dist/plugins/CustomHorizontalRulePlugin/CustomHorizontalRulePlugin.d.ts +3 -3
- package/dist/plugins/CustomHorizontalRulePlugin/HorizontalRuleCustomizationDialog.d.ts +7 -6
- package/dist/plugins/CustomHorizontalRulePlugin/index.d.ts +3 -3
- package/dist/plugins/DragDropPastePlugin/index.d.ts +8 -8
- package/dist/plugins/EmbedPreviewPlugin/FloatingEmbedMenuPlugin.d.ts +4 -3
- package/dist/plugins/EmbedPreviewPlugin/index.d.ts +6 -5
- package/dist/plugins/FilePlugin.d.ts +8 -7
- package/dist/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -5
- package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +27 -26
- package/dist/plugins/GrammarCheckPlugin.d.ts +2 -1
- package/dist/plugins/HtmlCodeViewPlugin/index.d.ts +2 -2
- package/dist/plugins/HtmlImportPlugin.d.ts +5 -5
- package/dist/plugins/HtmlSyncPlugin.d.ts +3 -3
- package/dist/plugins/ImagePlugin.d.ts +7 -6
- package/dist/plugins/LinkPlugin/index.d.ts +6 -5
- package/dist/plugins/LinkPreviewPlugin/index.d.ts +4 -4
- package/dist/plugins/LocalStoragePlugin.d.ts +7 -6
- package/dist/plugins/MarkdownShortcutsPlugin/index.d.ts +20 -20
- package/dist/plugins/MentionsPlugin/index.d.ts +7 -6
- package/dist/plugins/NotePanelPlugin.d.ts +7 -6
- package/dist/plugins/PasteOptionsPlugin/index.d.ts +17 -17
- package/dist/plugins/RichTextPastePlugin/index.d.ts +6 -5
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasDialog.d.ts +6 -5
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +9 -9
- package/dist/plugins/SignatureCanvasPlugin/index.d.ts +2 -2
- package/dist/plugins/SlashCommandPlugin/index.d.ts +2 -2
- package/dist/plugins/TableActionMenuPlugin/index.d.ts +6 -5
- package/dist/plugins/TableCellResizer/index.d.ts +2 -1
- package/dist/plugins/TableHoverActionsPlugin/index.d.ts +4 -4
- package/dist/plugins/TablePlugin.d.ts +5 -4
- package/dist/plugins/Tableimageautoresizeplugin.d.ts +1 -1
- package/dist/plugins/TextEnhancePlugin.d.ts +6 -6
- package/dist/plugins/TreeViewPlugin.d.ts +3 -2
- package/dist/plugins/UsageTrackingPlugin.d.ts +15 -15
- package/dist/plugins/VoiceTranscriptPlugin.d.ts +22 -22
- package/dist/plugins/WordCountPlugin.d.ts +3 -2
- package/dist/{postcss-f084f74d.js → postcss-c2592f3f.js} +1357 -1378
- package/dist/postcss-c2592f3f.js.map +1 -0
- package/dist/services/chartService.d.ts +19 -18
- package/dist/standalone-bcc7f37a.js +2649 -0
- package/dist/standalone-bcc7f37a.js.map +1 -0
- package/dist/styles/PlaygroundEditorTheme.d.ts +3 -2
- package/dist/types.d.ts +150 -149
- package/dist/typescript-48c10f50.js +13601 -0
- package/dist/typescript-48c10f50.js.map +1 -0
- package/dist/ui/ColorPicker.d.ts +14 -13
- package/dist/ui/Icons.d.ts +76 -76
- package/dist/ui/TextInput.d.ts +11 -10
- package/dist/utils/dateFormats.d.ts +33 -33
- package/dist/utils/debounce.d.ts +6 -5
- package/dist/utils/editorStyleConverter.d.ts +17 -16
- package/dist/utils/export.d.ts +2 -1
- package/dist/utils/getDOMRangeRect.d.ts +13 -13
- package/dist/utils/getSelectedNode.d.ts +3 -2
- package/dist/utils/helper.d.ts +3 -3
- package/dist/utils/index.d.ts +4 -3
- package/dist/utils/invarient.d.ts +1 -1
- package/dist/utils/setFloatingElemPosition.d.ts +8 -8
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -1
- package/dist/utils/url.d.ts +9 -9
- package/package.json +149 -149
- package/dist/babel-d3085146.js.map +0 -1
- package/dist/estree-164983f6.js.map +0 -1
- package/dist/html-5586dbf6.js.map +0 -1
- package/dist/html2pdf.bundle-2448d0c9.js.map +0 -1
- package/dist/html2pdf.bundle.min-4c9e3abf.js.map +0 -1
- package/dist/index-5a175541.js.map +0 -1
- package/dist/index-9ff3d80c.js.map +0 -1
- package/dist/index-ef9100c2.js.map +0 -1
- package/dist/markdown-d513479b.js.map +0 -1
- package/dist/postcss-f084f74d.js.map +0 -1
- package/dist/standalone-5a8c6b7e.js +0 -2518
- package/dist/standalone-5a8c6b7e.js.map +0 -1
- package/dist/typescript-b1005db4.js +0 -13705
- package/dist/typescript-b1005db4.js.map +0 -1
|
@@ -25,7 +25,7 @@ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
|
25
25
|
import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
|
|
26
26
|
import { TableNode, TableCellNode, TableRowNode, $createTableNodeWithDimensions, $isTableRowNode, $isTableCellNode, TableCellHeaderStates, $isTableNode, $isTableSelection, $getTableCellNodeFromLexicalNode, $getTableNodeFromLexicalNodeOrThrow, getTableElement, getTableObserverFromTableElement, $getTableRowIndexFromTableCellNode, $getNodeTriplet, $insertTableRow__EXPERIMENTAL, $getTableColumnIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $deleteTableColumn__EXPERIMENTAL, $unmergeCell, $computeTableMapSkipCellCheck, getDOMCellFromTarget, $getTableAndElementByKey } from "@lexical/table";
|
|
27
27
|
import { mergeRegister, $wrapNodeInElement, $findMatchingParent, $getNearestNodeOfType, $getNearestBlockElementAncestorOrThrow, $insertNodeToNearestRoot, $isEditorIsNestedEditor, mediaFileReader, isMimeType, calculateZoomLevel, CAN_USE_DOM } from "@lexical/utils";
|
|
28
|
-
import { createCommand, DecoratorNode, createEditor, $applyNodeReplacement, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNearestNodeFromDOMNode, isHTMLElement as isHTMLElement$1, TextNode, $getRoot, $createTextNode, $getNodeByKey, $isParagraphNode, $isTextNode, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, REDO_COMMAND, KEY_SPACE_COMMAND, $isLineBreakNode, $createRangeSelection,
|
|
28
|
+
import { createCommand, DecoratorNode, createEditor, $applyNodeReplacement, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNearestNodeFromDOMNode, isHTMLElement as isHTMLElement$1, TextNode, $getRoot, $createTextNode, $getNodeByKey, $isParagraphNode, $isTextNode, $setSelection, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, REDO_COMMAND, KEY_SPACE_COMMAND, $isLineBreakNode, $createRangeSelection, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, $createNodeSelection, $isNodeSelection, PASTE_COMMAND, CLICK_COMMAND, getDOMSelection, KEY_BACKSPACE_COMMAND, ParagraphNode, $createLineBreakNode, isDOMNode } from "lexical";
|
|
29
29
|
import { $isCodeNode, CodeNode, normalizeCodeLang, getLanguageFriendlyName, CodeHighlightNode, CODE_LANGUAGE_MAP, $createCodeNode, registerCodeHighlighting, $isCodeHighlightNode } from "@lexical/code";
|
|
30
30
|
import { LinkNode, $isLinkNode, TOGGLE_LINK_COMMAND, $isAutoLinkNode, $createLinkNode } from "@lexical/link";
|
|
31
31
|
import { ListNode, ListItemNode, $isListNode, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, $isListItemNode, $createListNode, $createListItemNode } from "@lexical/list";
|
|
@@ -118,8 +118,10 @@ const apiEndpoints = {
|
|
|
118
118
|
json: "/api/chat/json",
|
|
119
119
|
textEnhance: "/api/chat/text-enhance",
|
|
120
120
|
textTransform: "/api/chat/text-transform",
|
|
121
|
+
textTransformStream: "/api/chat/text-transform-stream",
|
|
121
122
|
imageCreation: "/api/chat/image-creation",
|
|
122
123
|
editorAction: "/api/chat/chat-action",
|
|
124
|
+
editorActionStream: "/api/chat/chat-action-stream",
|
|
123
125
|
credits: "/api/chat/credits",
|
|
124
126
|
userInfo: "/api/chat/user-info"
|
|
125
127
|
},
|
|
@@ -2117,11 +2119,11 @@ function handleApiError(error) {
|
|
|
2117
2119
|
}
|
|
2118
2120
|
throw error;
|
|
2119
2121
|
}
|
|
2120
|
-
const AiJsonResponse = async ({ content, apiKey }) => {
|
|
2122
|
+
const AiJsonResponse = async ({ content, apiKey, userTextLength }) => {
|
|
2121
2123
|
try {
|
|
2122
2124
|
const res = await backendAPI.post(
|
|
2123
2125
|
apiEndpoints.chat.json,
|
|
2124
|
-
{ content },
|
|
2126
|
+
{ content, userTextLength },
|
|
2125
2127
|
apiKey ? { headers: { "X-API-Key": apiKey } } : void 0
|
|
2126
2128
|
);
|
|
2127
2129
|
return res.data;
|
|
@@ -2130,28 +2132,94 @@ const AiJsonResponse = async ({ content, apiKey }) => {
|
|
|
2130
2132
|
handleApiError(error);
|
|
2131
2133
|
}
|
|
2132
2134
|
};
|
|
2133
|
-
const
|
|
2135
|
+
const AiEditorActionStream = async ({
|
|
2134
2136
|
content,
|
|
2135
2137
|
provider = "chatgpt",
|
|
2136
|
-
apiKey
|
|
2138
|
+
apiKey,
|
|
2139
|
+
userTextLength,
|
|
2140
|
+
onChunk,
|
|
2141
|
+
onComplete,
|
|
2142
|
+
onError: onError2
|
|
2137
2143
|
}) => {
|
|
2144
|
+
var _a;
|
|
2138
2145
|
try {
|
|
2146
|
+
let fullContent = "";
|
|
2147
|
+
let metadata = {};
|
|
2148
|
+
let processedLength = 0;
|
|
2149
|
+
let lineBuffer = "";
|
|
2139
2150
|
const res = await backendAPI.post(
|
|
2140
|
-
apiEndpoints.chat.
|
|
2141
|
-
{ content, provider },
|
|
2142
|
-
|
|
2151
|
+
apiEndpoints.chat.editorActionStream,
|
|
2152
|
+
{ content, provider, userTextLength },
|
|
2153
|
+
{
|
|
2154
|
+
headers: apiKey ? { "X-API-Key": apiKey } : void 0,
|
|
2155
|
+
responseType: "stream",
|
|
2156
|
+
onDownloadProgress: (progressEvent) => {
|
|
2157
|
+
var _a2, _b;
|
|
2158
|
+
const responseText = (_b = (_a2 = progressEvent.event) == null ? void 0 : _a2.target) == null ? void 0 : _b.responseText;
|
|
2159
|
+
if (!responseText)
|
|
2160
|
+
return;
|
|
2161
|
+
const newData = responseText.slice(processedLength);
|
|
2162
|
+
processedLength = responseText.length;
|
|
2163
|
+
if (!newData)
|
|
2164
|
+
return;
|
|
2165
|
+
const dataToProcess = lineBuffer + newData;
|
|
2166
|
+
const lines = dataToProcess.split("\n");
|
|
2167
|
+
lineBuffer = lines.pop() || "";
|
|
2168
|
+
for (const line of lines) {
|
|
2169
|
+
if (!line.trim() || !line.startsWith("data: "))
|
|
2170
|
+
continue;
|
|
2171
|
+
const data = line.slice(6);
|
|
2172
|
+
if (data === "[DONE]") {
|
|
2173
|
+
continue;
|
|
2174
|
+
}
|
|
2175
|
+
try {
|
|
2176
|
+
const parsed = JSON.parse(data);
|
|
2177
|
+
if (parsed.type === "chunk" && parsed.content) {
|
|
2178
|
+
const newChunk = parsed.content;
|
|
2179
|
+
fullContent += newChunk;
|
|
2180
|
+
onChunk(newChunk, fullContent);
|
|
2181
|
+
} else if (parsed.type === "complete") {
|
|
2182
|
+
fullContent = parsed.content || fullContent;
|
|
2183
|
+
metadata = {
|
|
2184
|
+
isImage: parsed.isImage,
|
|
2185
|
+
isChart: parsed.isChart,
|
|
2186
|
+
credits: parsed.credits
|
|
2187
|
+
};
|
|
2188
|
+
} else if (parsed.type === "error") {
|
|
2189
|
+
onError2(new Error(parsed.message || "Stream error"));
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
} catch {
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2143
2197
|
);
|
|
2144
|
-
|
|
2198
|
+
if (res.status === 200) {
|
|
2199
|
+
onComplete(fullContent, metadata);
|
|
2200
|
+
}
|
|
2145
2201
|
} catch (error) {
|
|
2146
|
-
console.error("Error in
|
|
2147
|
-
|
|
2202
|
+
console.error("Error in AiEditorActionStream:", error);
|
|
2203
|
+
const responseData = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data;
|
|
2204
|
+
if (responseData) {
|
|
2205
|
+
const { code, message } = responseData;
|
|
2206
|
+
if (code === "API_KEYS_REQUIRED" || code === "NO_API_KEYS_CONFIGURED" || code === "API_KEYS_DISABLED") {
|
|
2207
|
+
onError2(new ApiKeyRequiredError$1(message || "API key required", code));
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
if (code === "INSUFFICIENT_CREDITS" || code === "NO_ACTIVE_SUBSCRIPTION" || code === "SUBSCRIPTION_EXPIRED") {
|
|
2211
|
+
onError2(new CreditError$1(message || "Credit error", code));
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
onError2(error instanceof Error ? error : new Error(String(error)));
|
|
2148
2216
|
}
|
|
2149
2217
|
};
|
|
2150
|
-
const AiTextEnhance = async ({ content, apiKey }) => {
|
|
2218
|
+
const AiTextEnhance = async ({ content, apiKey, userTextLength }) => {
|
|
2151
2219
|
try {
|
|
2152
2220
|
const res = await backendAPI.post(
|
|
2153
2221
|
apiEndpoints.chat.textEnhance,
|
|
2154
|
-
{ content },
|
|
2222
|
+
{ content, userTextLength },
|
|
2155
2223
|
apiKey ? { headers: { "X-API-Key": apiKey } } : void 0
|
|
2156
2224
|
);
|
|
2157
2225
|
return res.data;
|
|
@@ -2184,23 +2252,88 @@ const GetUserInfo = async ({ apiKey }) => {
|
|
|
2184
2252
|
return { success: false, data: null };
|
|
2185
2253
|
}
|
|
2186
2254
|
};
|
|
2187
|
-
const
|
|
2255
|
+
const AiTextTransformStream = async ({
|
|
2256
|
+
content,
|
|
2257
|
+
apiKey,
|
|
2258
|
+
userTextLength,
|
|
2259
|
+
onChunk,
|
|
2260
|
+
onComplete,
|
|
2261
|
+
onError: onError2
|
|
2262
|
+
}) => {
|
|
2263
|
+
var _a;
|
|
2188
2264
|
try {
|
|
2265
|
+
let fullText = "";
|
|
2266
|
+
let credits;
|
|
2267
|
+
let processedLength = 0;
|
|
2268
|
+
let lineBuffer = "";
|
|
2189
2269
|
const res = await backendAPI.post(
|
|
2190
|
-
apiEndpoints.chat.
|
|
2191
|
-
{ content },
|
|
2192
|
-
|
|
2270
|
+
apiEndpoints.chat.textTransformStream,
|
|
2271
|
+
{ content, userTextLength },
|
|
2272
|
+
{
|
|
2273
|
+
headers: apiKey ? { "X-API-Key": apiKey } : void 0,
|
|
2274
|
+
responseType: "stream",
|
|
2275
|
+
onDownloadProgress: (progressEvent) => {
|
|
2276
|
+
var _a2, _b;
|
|
2277
|
+
const responseText = (_b = (_a2 = progressEvent.event) == null ? void 0 : _a2.target) == null ? void 0 : _b.responseText;
|
|
2278
|
+
if (!responseText)
|
|
2279
|
+
return;
|
|
2280
|
+
const newData = responseText.slice(processedLength);
|
|
2281
|
+
processedLength = responseText.length;
|
|
2282
|
+
if (!newData)
|
|
2283
|
+
return;
|
|
2284
|
+
const dataToProcess = lineBuffer + newData;
|
|
2285
|
+
const lines = dataToProcess.split("\n");
|
|
2286
|
+
lineBuffer = lines.pop() || "";
|
|
2287
|
+
for (const line of lines) {
|
|
2288
|
+
if (!line.trim() || !line.startsWith("data: "))
|
|
2289
|
+
continue;
|
|
2290
|
+
const data = line.slice(6);
|
|
2291
|
+
if (data === "[DONE]") {
|
|
2292
|
+
continue;
|
|
2293
|
+
}
|
|
2294
|
+
try {
|
|
2295
|
+
const parsed = JSON.parse(data);
|
|
2296
|
+
if (parsed.type === "chunk" && parsed.content) {
|
|
2297
|
+
const newChunk = parsed.content;
|
|
2298
|
+
fullText += newChunk;
|
|
2299
|
+
onChunk(newChunk);
|
|
2300
|
+
} else if (parsed.type === "complete") {
|
|
2301
|
+
fullText = parsed.content || fullText;
|
|
2302
|
+
credits = parsed.credits;
|
|
2303
|
+
} else if (parsed.type === "error") {
|
|
2304
|
+
onError2(new Error(parsed.message || "Stream error"));
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
} catch {
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2193
2312
|
);
|
|
2194
|
-
|
|
2313
|
+
if (res.status === 200) {
|
|
2314
|
+
onComplete(fullText, credits);
|
|
2315
|
+
}
|
|
2195
2316
|
} catch (error) {
|
|
2196
|
-
console.error("Error in
|
|
2197
|
-
|
|
2317
|
+
console.error("Error in AiTextTransformStream:", error);
|
|
2318
|
+
const responseData = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data;
|
|
2319
|
+
if (responseData) {
|
|
2320
|
+
const { code, message } = responseData;
|
|
2321
|
+
if (code === "API_KEYS_REQUIRED" || code === "NO_API_KEYS_CONFIGURED" || code === "API_KEYS_DISABLED") {
|
|
2322
|
+
onError2(new ApiKeyRequiredError$1(message || "API key required", code));
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
if (code === "INSUFFICIENT_CREDITS" || code === "NO_ACTIVE_SUBSCRIPTION" || code === "SUBSCRIPTION_EXPIRED") {
|
|
2326
|
+
onError2(new CreditError$1(message || "Credit error", code));
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
onError2(error instanceof Error ? error : new Error(String(error)));
|
|
2198
2331
|
}
|
|
2199
2332
|
};
|
|
2200
2333
|
const AI_ACTION_COMMAND = createCommand(
|
|
2201
2334
|
"AI_ACTION_COMMAND"
|
|
2202
2335
|
);
|
|
2203
|
-
const ImageView = React__default.lazy(() => import("./index-
|
|
2336
|
+
const ImageView = React__default.lazy(() => import("./index-34ac313f.js"));
|
|
2204
2337
|
function isGoogleDocCheckboxImg(img) {
|
|
2205
2338
|
return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
|
|
2206
2339
|
}
|
|
@@ -2503,18 +2636,18 @@ const ImagePlugin = ({
|
|
|
2503
2636
|
}, [captionsEnabled, editor]);
|
|
2504
2637
|
return null;
|
|
2505
2638
|
};
|
|
2506
|
-
function setRef(ref, value) {
|
|
2639
|
+
function setRef$1(ref, value) {
|
|
2507
2640
|
if (typeof ref === "function") {
|
|
2508
2641
|
return ref(value);
|
|
2509
2642
|
} else if (ref !== null && ref !== void 0) {
|
|
2510
2643
|
ref.current = value;
|
|
2511
2644
|
}
|
|
2512
2645
|
}
|
|
2513
|
-
function composeRefs(...refs) {
|
|
2646
|
+
function composeRefs$1(...refs) {
|
|
2514
2647
|
return (node) => {
|
|
2515
2648
|
let hasCleanup = false;
|
|
2516
2649
|
const cleanups = refs.map((ref) => {
|
|
2517
|
-
const cleanup = setRef(ref, node);
|
|
2650
|
+
const cleanup = setRef$1(ref, node);
|
|
2518
2651
|
if (!hasCleanup && typeof cleanup == "function") {
|
|
2519
2652
|
hasCleanup = true;
|
|
2520
2653
|
}
|
|
@@ -2527,34 +2660,31 @@ function composeRefs(...refs) {
|
|
|
2527
2660
|
if (typeof cleanup == "function") {
|
|
2528
2661
|
cleanup();
|
|
2529
2662
|
} else {
|
|
2530
|
-
setRef(refs[i2], null);
|
|
2663
|
+
setRef$1(refs[i2], null);
|
|
2531
2664
|
}
|
|
2532
2665
|
}
|
|
2533
2666
|
};
|
|
2534
2667
|
}
|
|
2535
2668
|
};
|
|
2536
2669
|
}
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
var REACT_LAZY_TYPE$3 = Symbol.for("react.lazy");
|
|
2541
|
-
var use$3 = React$1[" use ".trim().toString()];
|
|
2542
|
-
function isPromiseLike$3(value) {
|
|
2670
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
2671
|
+
var use = React$1[" use ".trim().toString()];
|
|
2672
|
+
function isPromiseLike(value) {
|
|
2543
2673
|
return typeof value === "object" && value !== null && "then" in value;
|
|
2544
2674
|
}
|
|
2545
|
-
function isLazyComponent
|
|
2546
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE
|
|
2675
|
+
function isLazyComponent(element) {
|
|
2676
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
2547
2677
|
}
|
|
2548
2678
|
// @__NO_SIDE_EFFECTS__
|
|
2549
|
-
function createSlot$
|
|
2550
|
-
const SlotClone = /* @__PURE__ */ createSlotClone$
|
|
2679
|
+
function createSlot$1(ownerName) {
|
|
2680
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
|
|
2551
2681
|
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
2552
2682
|
let { children, ...slotProps } = props;
|
|
2553
|
-
if (isLazyComponent
|
|
2554
|
-
children = use
|
|
2683
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
2684
|
+
children = use(children._payload);
|
|
2555
2685
|
}
|
|
2556
2686
|
const childrenArray = React$1.Children.toArray(children);
|
|
2557
|
-
const slottable = childrenArray.find(isSlottable$
|
|
2687
|
+
const slottable = childrenArray.find(isSlottable$1);
|
|
2558
2688
|
if (slottable) {
|
|
2559
2689
|
const newElement = slottable.props.children;
|
|
2560
2690
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -2573,19 +2703,19 @@ function createSlot$4(ownerName) {
|
|
|
2573
2703
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
2574
2704
|
return Slot2;
|
|
2575
2705
|
}
|
|
2576
|
-
var Slot$4 = /* @__PURE__ */ createSlot$
|
|
2706
|
+
var Slot$4 = /* @__PURE__ */ createSlot$1("Slot");
|
|
2577
2707
|
// @__NO_SIDE_EFFECTS__
|
|
2578
|
-
function createSlotClone$
|
|
2708
|
+
function createSlotClone$1(ownerName) {
|
|
2579
2709
|
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
2580
2710
|
let { children, ...slotProps } = props;
|
|
2581
|
-
if (isLazyComponent
|
|
2582
|
-
children = use
|
|
2711
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
2712
|
+
children = use(children._payload);
|
|
2583
2713
|
}
|
|
2584
2714
|
if (React$1.isValidElement(children)) {
|
|
2585
|
-
const childrenRef = getElementRef$
|
|
2586
|
-
const props2 = mergeProps$
|
|
2715
|
+
const childrenRef = getElementRef$2(children);
|
|
2716
|
+
const props2 = mergeProps$1(slotProps, children.props);
|
|
2587
2717
|
if (children.type !== React$1.Fragment) {
|
|
2588
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
2718
|
+
props2.ref = forwardedRef ? composeRefs$1(forwardedRef, childrenRef) : childrenRef;
|
|
2589
2719
|
}
|
|
2590
2720
|
return React$1.cloneElement(children, props2);
|
|
2591
2721
|
}
|
|
@@ -2594,11 +2724,11 @@ function createSlotClone$4(ownerName) {
|
|
|
2594
2724
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
2595
2725
|
return SlotClone;
|
|
2596
2726
|
}
|
|
2597
|
-
var SLOTTABLE_IDENTIFIER$
|
|
2598
|
-
function isSlottable$
|
|
2599
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$
|
|
2727
|
+
var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
|
|
2728
|
+
function isSlottable$1(child) {
|
|
2729
|
+
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
|
|
2600
2730
|
}
|
|
2601
|
-
function mergeProps$
|
|
2731
|
+
function mergeProps$1(slotProps, childProps) {
|
|
2602
2732
|
const overrideProps = { ...childProps };
|
|
2603
2733
|
for (const propName in childProps) {
|
|
2604
2734
|
const slotPropValue = slotProps[propName];
|
|
@@ -2622,7 +2752,7 @@ function mergeProps$4(slotProps, childProps) {
|
|
|
2622
2752
|
}
|
|
2623
2753
|
return { ...slotProps, ...overrideProps };
|
|
2624
2754
|
}
|
|
2625
|
-
function getElementRef$
|
|
2755
|
+
function getElementRef$2(element) {
|
|
2626
2756
|
var _a, _b;
|
|
2627
2757
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
2628
2758
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -2697,28 +2827,7 @@ const cva = (base, config) => (props) => {
|
|
|
2697
2827
|
}, []);
|
|
2698
2828
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2699
2829
|
};
|
|
2700
|
-
const concatArrays = (array1, array2) => {
|
|
2701
|
-
const combinedArray = new Array(array1.length + array2.length);
|
|
2702
|
-
for (let i2 = 0; i2 < array1.length; i2++) {
|
|
2703
|
-
combinedArray[i2] = array1[i2];
|
|
2704
|
-
}
|
|
2705
|
-
for (let i2 = 0; i2 < array2.length; i2++) {
|
|
2706
|
-
combinedArray[array1.length + i2] = array2[i2];
|
|
2707
|
-
}
|
|
2708
|
-
return combinedArray;
|
|
2709
|
-
};
|
|
2710
|
-
const createClassValidatorObject = (classGroupId, validator) => ({
|
|
2711
|
-
classGroupId,
|
|
2712
|
-
validator
|
|
2713
|
-
});
|
|
2714
|
-
const createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
|
|
2715
|
-
nextPart,
|
|
2716
|
-
validators,
|
|
2717
|
-
classGroupId
|
|
2718
|
-
});
|
|
2719
2830
|
const CLASS_PART_SEPARATOR = "-";
|
|
2720
|
-
const EMPTY_CONFLICTS = [];
|
|
2721
|
-
const ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
|
|
2722
2831
|
const createClassGroupUtils = (config) => {
|
|
2723
2832
|
const classMap = createClassMap(config);
|
|
2724
2833
|
const {
|
|
@@ -2726,135 +2835,104 @@ const createClassGroupUtils = (config) => {
|
|
|
2726
2835
|
conflictingClassGroupModifiers
|
|
2727
2836
|
} = config;
|
|
2728
2837
|
const getClassGroupId = (className) => {
|
|
2729
|
-
if (className.startsWith("[") && className.endsWith("]")) {
|
|
2730
|
-
return getGroupIdForArbitraryProperty(className);
|
|
2731
|
-
}
|
|
2732
2838
|
const classParts = className.split(CLASS_PART_SEPARATOR);
|
|
2733
|
-
|
|
2734
|
-
|
|
2839
|
+
if (classParts[0] === "" && classParts.length !== 1) {
|
|
2840
|
+
classParts.shift();
|
|
2841
|
+
}
|
|
2842
|
+
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
|
|
2735
2843
|
};
|
|
2736
2844
|
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
if (modifierConflicts) {
|
|
2741
|
-
if (baseConflicts) {
|
|
2742
|
-
return concatArrays(baseConflicts, modifierConflicts);
|
|
2743
|
-
}
|
|
2744
|
-
return modifierConflicts;
|
|
2745
|
-
}
|
|
2746
|
-
return baseConflicts || EMPTY_CONFLICTS;
|
|
2845
|
+
const conflicts = conflictingClassGroups[classGroupId] || [];
|
|
2846
|
+
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
|
|
2847
|
+
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
|
|
2747
2848
|
}
|
|
2748
|
-
return
|
|
2849
|
+
return conflicts;
|
|
2749
2850
|
};
|
|
2750
2851
|
return {
|
|
2751
2852
|
getClassGroupId,
|
|
2752
2853
|
getConflictingClassGroupIds
|
|
2753
2854
|
};
|
|
2754
2855
|
};
|
|
2755
|
-
const getGroupRecursive = (classParts,
|
|
2756
|
-
|
|
2757
|
-
if (
|
|
2856
|
+
const getGroupRecursive = (classParts, classPartObject) => {
|
|
2857
|
+
var _a;
|
|
2858
|
+
if (classParts.length === 0) {
|
|
2758
2859
|
return classPartObject.classGroupId;
|
|
2759
2860
|
}
|
|
2760
|
-
const currentClassPart = classParts[
|
|
2861
|
+
const currentClassPart = classParts[0];
|
|
2761
2862
|
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
return result;
|
|
2863
|
+
const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
|
|
2864
|
+
if (classGroupFromNextClassPart) {
|
|
2865
|
+
return classGroupFromNextClassPart;
|
|
2766
2866
|
}
|
|
2767
|
-
|
|
2768
|
-
if (validators === null) {
|
|
2867
|
+
if (classPartObject.validators.length === 0) {
|
|
2769
2868
|
return void 0;
|
|
2770
2869
|
}
|
|
2771
|
-
const classRest =
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2870
|
+
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
2871
|
+
return (_a = classPartObject.validators.find(({
|
|
2872
|
+
validator
|
|
2873
|
+
}) => validator(classRest))) == null ? void 0 : _a.classGroupId;
|
|
2874
|
+
};
|
|
2875
|
+
const arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
2876
|
+
const getGroupIdForArbitraryProperty = (className) => {
|
|
2877
|
+
if (arbitraryPropertyRegex.test(className)) {
|
|
2878
|
+
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
2879
|
+
const property = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(":"));
|
|
2880
|
+
if (property) {
|
|
2881
|
+
return "arbitrary.." + property;
|
|
2777
2882
|
}
|
|
2778
2883
|
}
|
|
2779
|
-
return void 0;
|
|
2780
2884
|
};
|
|
2781
|
-
const getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
|
|
2782
|
-
const content = className.slice(1, -1);
|
|
2783
|
-
const colonIndex = content.indexOf(":");
|
|
2784
|
-
const property = content.slice(0, colonIndex);
|
|
2785
|
-
return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
|
|
2786
|
-
})();
|
|
2787
2885
|
const createClassMap = (config) => {
|
|
2788
2886
|
const {
|
|
2789
2887
|
theme: theme2,
|
|
2790
2888
|
classGroups
|
|
2791
2889
|
} = config;
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2890
|
+
const classMap = {
|
|
2891
|
+
nextPart: /* @__PURE__ */ new Map(),
|
|
2892
|
+
validators: []
|
|
2893
|
+
};
|
|
2796
2894
|
for (const classGroupId in classGroups) {
|
|
2797
|
-
|
|
2798
|
-
processClassesRecursively(group, classMap, classGroupId, theme2);
|
|
2895
|
+
processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme2);
|
|
2799
2896
|
}
|
|
2800
2897
|
return classMap;
|
|
2801
2898
|
};
|
|
2802
2899
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme2) => {
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
}
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
};
|
|
2824
|
-
const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
|
|
2825
|
-
if (isThemeGetter(classDefinition)) {
|
|
2826
|
-
processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
|
|
2827
|
-
return;
|
|
2828
|
-
}
|
|
2829
|
-
if (classPartObject.validators === null) {
|
|
2830
|
-
classPartObject.validators = [];
|
|
2831
|
-
}
|
|
2832
|
-
classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
|
|
2833
|
-
};
|
|
2834
|
-
const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme2) => {
|
|
2835
|
-
const entries = Object.entries(classDefinition);
|
|
2836
|
-
const len = entries.length;
|
|
2837
|
-
for (let i2 = 0; i2 < len; i2++) {
|
|
2838
|
-
const [key, value] = entries[i2];
|
|
2839
|
-
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme2);
|
|
2840
|
-
}
|
|
2900
|
+
classGroup.forEach((classDefinition) => {
|
|
2901
|
+
if (typeof classDefinition === "string") {
|
|
2902
|
+
const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
|
|
2903
|
+
classPartObjectToEdit.classGroupId = classGroupId;
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
if (typeof classDefinition === "function") {
|
|
2907
|
+
if (isThemeGetter(classDefinition)) {
|
|
2908
|
+
processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2911
|
+
classPartObject.validators.push({
|
|
2912
|
+
validator: classDefinition,
|
|
2913
|
+
classGroupId
|
|
2914
|
+
});
|
|
2915
|
+
return;
|
|
2916
|
+
}
|
|
2917
|
+
Object.entries(classDefinition).forEach(([key, classGroup2]) => {
|
|
2918
|
+
processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme2);
|
|
2919
|
+
});
|
|
2920
|
+
});
|
|
2841
2921
|
};
|
|
2842
2922
|
const getPart = (classPartObject, path) => {
|
|
2843
|
-
let
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
next = createClassPartObject();
|
|
2851
|
-
current.nextPart.set(part, next);
|
|
2923
|
+
let currentClassPartObject = classPartObject;
|
|
2924
|
+
path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
|
|
2925
|
+
if (!currentClassPartObject.nextPart.has(pathPart)) {
|
|
2926
|
+
currentClassPartObject.nextPart.set(pathPart, {
|
|
2927
|
+
nextPart: /* @__PURE__ */ new Map(),
|
|
2928
|
+
validators: []
|
|
2929
|
+
});
|
|
2852
2930
|
}
|
|
2853
|
-
|
|
2854
|
-
}
|
|
2855
|
-
return
|
|
2931
|
+
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
|
|
2932
|
+
});
|
|
2933
|
+
return currentClassPartObject;
|
|
2856
2934
|
};
|
|
2857
|
-
const isThemeGetter = (func) =>
|
|
2935
|
+
const isThemeGetter = (func) => func.isThemeGetter;
|
|
2858
2936
|
const createLruCache = (maxCacheSize) => {
|
|
2859
2937
|
if (maxCacheSize < 1) {
|
|
2860
2938
|
return {
|
|
@@ -2864,31 +2942,31 @@ const createLruCache = (maxCacheSize) => {
|
|
|
2864
2942
|
};
|
|
2865
2943
|
}
|
|
2866
2944
|
let cacheSize = 0;
|
|
2867
|
-
let cache2 = /* @__PURE__ */
|
|
2868
|
-
let previousCache = /* @__PURE__ */
|
|
2945
|
+
let cache2 = /* @__PURE__ */ new Map();
|
|
2946
|
+
let previousCache = /* @__PURE__ */ new Map();
|
|
2869
2947
|
const update = (key, value) => {
|
|
2870
|
-
cache2
|
|
2948
|
+
cache2.set(key, value);
|
|
2871
2949
|
cacheSize++;
|
|
2872
2950
|
if (cacheSize > maxCacheSize) {
|
|
2873
2951
|
cacheSize = 0;
|
|
2874
2952
|
previousCache = cache2;
|
|
2875
|
-
cache2 = /* @__PURE__ */
|
|
2953
|
+
cache2 = /* @__PURE__ */ new Map();
|
|
2876
2954
|
}
|
|
2877
2955
|
};
|
|
2878
2956
|
return {
|
|
2879
2957
|
get(key) {
|
|
2880
|
-
let value = cache2
|
|
2958
|
+
let value = cache2.get(key);
|
|
2881
2959
|
if (value !== void 0) {
|
|
2882
2960
|
return value;
|
|
2883
2961
|
}
|
|
2884
|
-
if ((value = previousCache
|
|
2962
|
+
if ((value = previousCache.get(key)) !== void 0) {
|
|
2885
2963
|
update(key, value);
|
|
2886
2964
|
return value;
|
|
2887
2965
|
}
|
|
2888
2966
|
},
|
|
2889
2967
|
set(key, value) {
|
|
2890
|
-
if (key
|
|
2891
|
-
cache2
|
|
2968
|
+
if (cache2.has(key)) {
|
|
2969
|
+
cache2.set(key, value);
|
|
2892
2970
|
} else {
|
|
2893
2971
|
update(key, value);
|
|
2894
2972
|
}
|
|
@@ -2897,14 +2975,7 @@ const createLruCache = (maxCacheSize) => {
|
|
|
2897
2975
|
};
|
|
2898
2976
|
const IMPORTANT_MODIFIER = "!";
|
|
2899
2977
|
const MODIFIER_SEPARATOR = ":";
|
|
2900
|
-
const
|
|
2901
|
-
const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
|
|
2902
|
-
modifiers,
|
|
2903
|
-
hasImportantModifier,
|
|
2904
|
-
baseClassName,
|
|
2905
|
-
maybePostfixModifierPosition,
|
|
2906
|
-
isExternal
|
|
2907
|
-
});
|
|
2978
|
+
const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
|
|
2908
2979
|
const createParseClassName = (config) => {
|
|
2909
2980
|
const {
|
|
2910
2981
|
prefix,
|
|
@@ -2916,13 +2987,12 @@ const createParseClassName = (config) => {
|
|
|
2916
2987
|
let parenDepth = 0;
|
|
2917
2988
|
let modifierStart = 0;
|
|
2918
2989
|
let postfixModifierPosition;
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
const currentCharacter = className[index2];
|
|
2990
|
+
for (let index2 = 0; index2 < className.length; index2++) {
|
|
2991
|
+
let currentCharacter = className[index2];
|
|
2922
2992
|
if (bracketDepth === 0 && parenDepth === 0) {
|
|
2923
2993
|
if (currentCharacter === MODIFIER_SEPARATOR) {
|
|
2924
2994
|
modifiers.push(className.slice(modifierStart, index2));
|
|
2925
|
-
modifierStart = index2 +
|
|
2995
|
+
modifierStart = index2 + MODIFIER_SEPARATOR_LENGTH;
|
|
2926
2996
|
continue;
|
|
2927
2997
|
}
|
|
2928
2998
|
if (currentCharacter === "/") {
|
|
@@ -2930,38 +3000,37 @@ const createParseClassName = (config) => {
|
|
|
2930
3000
|
continue;
|
|
2931
3001
|
}
|
|
2932
3002
|
}
|
|
2933
|
-
if (currentCharacter === "[")
|
|
3003
|
+
if (currentCharacter === "[") {
|
|
2934
3004
|
bracketDepth++;
|
|
2935
|
-
else if (currentCharacter === "]")
|
|
3005
|
+
} else if (currentCharacter === "]") {
|
|
2936
3006
|
bracketDepth--;
|
|
2937
|
-
else if (currentCharacter === "(")
|
|
3007
|
+
} else if (currentCharacter === "(") {
|
|
2938
3008
|
parenDepth++;
|
|
2939
|
-
else if (currentCharacter === ")")
|
|
3009
|
+
} else if (currentCharacter === ")") {
|
|
2940
3010
|
parenDepth--;
|
|
3011
|
+
}
|
|
2941
3012
|
}
|
|
2942
|
-
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
|
|
2946
|
-
baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
|
|
2947
|
-
hasImportantModifier = true;
|
|
2948
|
-
} else if (
|
|
2949
|
-
/**
|
|
2950
|
-
* In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
|
|
2951
|
-
* @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
|
|
2952
|
-
*/
|
|
2953
|
-
baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
|
|
2954
|
-
) {
|
|
2955
|
-
baseClassName = baseClassNameWithImportantModifier.slice(1);
|
|
2956
|
-
hasImportantModifier = true;
|
|
2957
|
-
}
|
|
3013
|
+
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
|
|
3014
|
+
const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
|
|
3015
|
+
const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
|
|
2958
3016
|
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
|
|
2959
|
-
return
|
|
3017
|
+
return {
|
|
3018
|
+
modifiers,
|
|
3019
|
+
hasImportantModifier,
|
|
3020
|
+
baseClassName,
|
|
3021
|
+
maybePostfixModifierPosition
|
|
3022
|
+
};
|
|
2960
3023
|
};
|
|
2961
3024
|
if (prefix) {
|
|
2962
3025
|
const fullPrefix = prefix + MODIFIER_SEPARATOR;
|
|
2963
3026
|
const parseClassNameOriginal = parseClassName;
|
|
2964
|
-
parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.
|
|
3027
|
+
parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
|
|
3028
|
+
isExternal: true,
|
|
3029
|
+
modifiers: [],
|
|
3030
|
+
hasImportantModifier: false,
|
|
3031
|
+
baseClassName: className,
|
|
3032
|
+
maybePostfixModifierPosition: void 0
|
|
3033
|
+
};
|
|
2965
3034
|
}
|
|
2966
3035
|
if (experimentalParseClassName) {
|
|
2967
3036
|
const parseClassNameOriginal = parseClassName;
|
|
@@ -2972,35 +3041,36 @@ const createParseClassName = (config) => {
|
|
|
2972
3041
|
}
|
|
2973
3042
|
return parseClassName;
|
|
2974
3043
|
};
|
|
3044
|
+
const stripImportantModifier = (baseClassName) => {
|
|
3045
|
+
if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
|
|
3046
|
+
return baseClassName.substring(0, baseClassName.length - 1);
|
|
3047
|
+
}
|
|
3048
|
+
if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
|
|
3049
|
+
return baseClassName.substring(1);
|
|
3050
|
+
}
|
|
3051
|
+
return baseClassName;
|
|
3052
|
+
};
|
|
2975
3053
|
const createSortModifiers = (config) => {
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
const
|
|
2982
|
-
let
|
|
2983
|
-
|
|
2984
|
-
const
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
if (currentSegment.length > 0) {
|
|
2989
|
-
currentSegment.sort();
|
|
2990
|
-
result.push(...currentSegment);
|
|
2991
|
-
currentSegment = [];
|
|
2992
|
-
}
|
|
2993
|
-
result.push(modifier);
|
|
3054
|
+
const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map((modifier) => [modifier, true]));
|
|
3055
|
+
const sortModifiers = (modifiers) => {
|
|
3056
|
+
if (modifiers.length <= 1) {
|
|
3057
|
+
return modifiers;
|
|
3058
|
+
}
|
|
3059
|
+
const sortedModifiers = [];
|
|
3060
|
+
let unsortedModifiers = [];
|
|
3061
|
+
modifiers.forEach((modifier) => {
|
|
3062
|
+
const isPositionSensitive = modifier[0] === "[" || orderSensitiveModifiers[modifier];
|
|
3063
|
+
if (isPositionSensitive) {
|
|
3064
|
+
sortedModifiers.push(...unsortedModifiers.sort(), modifier);
|
|
3065
|
+
unsortedModifiers = [];
|
|
2994
3066
|
} else {
|
|
2995
|
-
|
|
3067
|
+
unsortedModifiers.push(modifier);
|
|
2996
3068
|
}
|
|
2997
|
-
}
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
result.push(...currentSegment);
|
|
3001
|
-
}
|
|
3002
|
-
return result;
|
|
3069
|
+
});
|
|
3070
|
+
sortedModifiers.push(...unsortedModifiers.sort());
|
|
3071
|
+
return sortedModifiers;
|
|
3003
3072
|
};
|
|
3073
|
+
return sortModifiers;
|
|
3004
3074
|
};
|
|
3005
3075
|
const createConfigUtils = (config) => ({
|
|
3006
3076
|
cache: createLruCache(config.cacheSize),
|
|
@@ -3046,10 +3116,10 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
3046
3116
|
}
|
|
3047
3117
|
hasPostfixModifier = false;
|
|
3048
3118
|
}
|
|
3049
|
-
const variantModifier =
|
|
3119
|
+
const variantModifier = sortModifiers(modifiers).join(":");
|
|
3050
3120
|
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
|
|
3051
3121
|
const classId = modifierId + classGroupId;
|
|
3052
|
-
if (classGroupsInConflict.
|
|
3122
|
+
if (classGroupsInConflict.includes(classId)) {
|
|
3053
3123
|
continue;
|
|
3054
3124
|
}
|
|
3055
3125
|
classGroupsInConflict.push(classId);
|
|
@@ -3062,13 +3132,13 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
3062
3132
|
}
|
|
3063
3133
|
return result;
|
|
3064
3134
|
};
|
|
3065
|
-
|
|
3135
|
+
function twJoin() {
|
|
3066
3136
|
let index2 = 0;
|
|
3067
3137
|
let argument;
|
|
3068
3138
|
let resolvedValue;
|
|
3069
3139
|
let string = "";
|
|
3070
|
-
while (index2 <
|
|
3071
|
-
if (argument =
|
|
3140
|
+
while (index2 < arguments.length) {
|
|
3141
|
+
if (argument = arguments[index2++]) {
|
|
3072
3142
|
if (resolvedValue = toValue(argument)) {
|
|
3073
3143
|
string && (string += " ");
|
|
3074
3144
|
string += resolvedValue;
|
|
@@ -3076,7 +3146,7 @@ const twJoin = (...classLists) => {
|
|
|
3076
3146
|
}
|
|
3077
3147
|
}
|
|
3078
3148
|
return string;
|
|
3079
|
-
}
|
|
3149
|
+
}
|
|
3080
3150
|
const toValue = (mix) => {
|
|
3081
3151
|
if (typeof mix === "string") {
|
|
3082
3152
|
return mix;
|
|
@@ -3093,20 +3163,20 @@ const toValue = (mix) => {
|
|
|
3093
3163
|
}
|
|
3094
3164
|
return string;
|
|
3095
3165
|
};
|
|
3096
|
-
|
|
3166
|
+
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
3097
3167
|
let configUtils;
|
|
3098
3168
|
let cacheGet;
|
|
3099
3169
|
let cacheSet;
|
|
3100
|
-
let functionToCall;
|
|
3101
|
-
|
|
3170
|
+
let functionToCall = initTailwindMerge;
|
|
3171
|
+
function initTailwindMerge(classList) {
|
|
3102
3172
|
const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
|
|
3103
3173
|
configUtils = createConfigUtils(config);
|
|
3104
3174
|
cacheGet = configUtils.cache.get;
|
|
3105
3175
|
cacheSet = configUtils.cache.set;
|
|
3106
3176
|
functionToCall = tailwindMerge;
|
|
3107
3177
|
return tailwindMerge(classList);
|
|
3108
|
-
}
|
|
3109
|
-
|
|
3178
|
+
}
|
|
3179
|
+
function tailwindMerge(classList) {
|
|
3110
3180
|
const cachedResult = cacheGet(classList);
|
|
3111
3181
|
if (cachedResult) {
|
|
3112
3182
|
return cachedResult;
|
|
@@ -3114,13 +3184,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
|
|
|
3114
3184
|
const result = mergeClassList(classList, configUtils);
|
|
3115
3185
|
cacheSet(classList, result);
|
|
3116
3186
|
return result;
|
|
3187
|
+
}
|
|
3188
|
+
return function callTailwindMerge() {
|
|
3189
|
+
return functionToCall(twJoin.apply(null, arguments));
|
|
3117
3190
|
};
|
|
3118
|
-
|
|
3119
|
-
return (...args) => functionToCall(twJoin(...args));
|
|
3120
|
-
};
|
|
3121
|
-
const fallbackThemeArr = [];
|
|
3191
|
+
}
|
|
3122
3192
|
const fromTheme = (key) => {
|
|
3123
|
-
const themeGetter = (theme2) => theme2[key] ||
|
|
3193
|
+
const themeGetter = (theme2) => theme2[key] || [];
|
|
3124
3194
|
themeGetter.isThemeGetter = true;
|
|
3125
3195
|
return themeGetter;
|
|
3126
3196
|
};
|
|
@@ -5762,6 +5832,40 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
5762
5832
|
}
|
|
5763
5833
|
};
|
|
5764
5834
|
}
|
|
5835
|
+
function setRef(ref, value) {
|
|
5836
|
+
if (typeof ref === "function") {
|
|
5837
|
+
return ref(value);
|
|
5838
|
+
} else if (ref !== null && ref !== void 0) {
|
|
5839
|
+
ref.current = value;
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
function composeRefs(...refs) {
|
|
5843
|
+
return (node) => {
|
|
5844
|
+
let hasCleanup = false;
|
|
5845
|
+
const cleanups = refs.map((ref) => {
|
|
5846
|
+
const cleanup = setRef(ref, node);
|
|
5847
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
5848
|
+
hasCleanup = true;
|
|
5849
|
+
}
|
|
5850
|
+
return cleanup;
|
|
5851
|
+
});
|
|
5852
|
+
if (hasCleanup) {
|
|
5853
|
+
return () => {
|
|
5854
|
+
for (let i2 = 0; i2 < cleanups.length; i2++) {
|
|
5855
|
+
const cleanup = cleanups[i2];
|
|
5856
|
+
if (typeof cleanup == "function") {
|
|
5857
|
+
cleanup();
|
|
5858
|
+
} else {
|
|
5859
|
+
setRef(refs[i2], null);
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
};
|
|
5863
|
+
}
|
|
5864
|
+
};
|
|
5865
|
+
}
|
|
5866
|
+
function useComposedRefs(...refs) {
|
|
5867
|
+
return React$1.useCallback(composeRefs(...refs), refs);
|
|
5868
|
+
}
|
|
5765
5869
|
function createContext2(rootComponentName, defaultContext) {
|
|
5766
5870
|
const Context2 = React$1.createContext(defaultContext);
|
|
5767
5871
|
const Provider2 = (props) => {
|
|
@@ -5780,7 +5884,7 @@ function createContext2(rootComponentName, defaultContext) {
|
|
|
5780
5884
|
}
|
|
5781
5885
|
return [Provider2, useContext2];
|
|
5782
5886
|
}
|
|
5783
|
-
function createContextScope
|
|
5887
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
5784
5888
|
let defaultContexts = [];
|
|
5785
5889
|
function createContext3(rootComponentName, defaultContext) {
|
|
5786
5890
|
const BaseContext = React$1.createContext(defaultContext);
|
|
@@ -5819,9 +5923,9 @@ function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
|
5819
5923
|
};
|
|
5820
5924
|
};
|
|
5821
5925
|
createScope.scopeName = scopeName;
|
|
5822
|
-
return [createContext3, composeContextScopes
|
|
5926
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
5823
5927
|
}
|
|
5824
|
-
function composeContextScopes
|
|
5928
|
+
function composeContextScopes(...scopes) {
|
|
5825
5929
|
const baseScope = scopes[0];
|
|
5826
5930
|
if (scopes.length === 1)
|
|
5827
5931
|
return baseScope;
|
|
@@ -5921,12 +6025,12 @@ function isFunction(value) {
|
|
|
5921
6025
|
return typeof value === "function";
|
|
5922
6026
|
}
|
|
5923
6027
|
// @__NO_SIDE_EFFECTS__
|
|
5924
|
-
function createSlot
|
|
5925
|
-
const SlotClone = /* @__PURE__ */ createSlotClone
|
|
6028
|
+
function createSlot(ownerName) {
|
|
6029
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
5926
6030
|
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
5927
6031
|
const { children, ...slotProps } = props;
|
|
5928
6032
|
const childrenArray = React$1.Children.toArray(children);
|
|
5929
|
-
const slottable = childrenArray.find(isSlottable
|
|
6033
|
+
const slottable = childrenArray.find(isSlottable);
|
|
5930
6034
|
if (slottable) {
|
|
5931
6035
|
const newElement = slottable.props.children;
|
|
5932
6036
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -5946,12 +6050,12 @@ function createSlot$3(ownerName) {
|
|
|
5946
6050
|
return Slot2;
|
|
5947
6051
|
}
|
|
5948
6052
|
// @__NO_SIDE_EFFECTS__
|
|
5949
|
-
function createSlotClone
|
|
6053
|
+
function createSlotClone(ownerName) {
|
|
5950
6054
|
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
5951
6055
|
const { children, ...slotProps } = props;
|
|
5952
6056
|
if (React$1.isValidElement(children)) {
|
|
5953
|
-
const childrenRef = getElementRef$
|
|
5954
|
-
const props2 = mergeProps
|
|
6057
|
+
const childrenRef = getElementRef$1(children);
|
|
6058
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
5955
6059
|
if (children.type !== React$1.Fragment) {
|
|
5956
6060
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
5957
6061
|
}
|
|
@@ -5962,20 +6066,20 @@ function createSlotClone$3(ownerName) {
|
|
|
5962
6066
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
5963
6067
|
return SlotClone;
|
|
5964
6068
|
}
|
|
5965
|
-
var SLOTTABLE_IDENTIFIER
|
|
6069
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
5966
6070
|
// @__NO_SIDE_EFFECTS__
|
|
5967
6071
|
function createSlottable(ownerName) {
|
|
5968
6072
|
const Slottable2 = ({ children }) => {
|
|
5969
6073
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
5970
6074
|
};
|
|
5971
6075
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
5972
|
-
Slottable2.__radixId = SLOTTABLE_IDENTIFIER
|
|
6076
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
5973
6077
|
return Slottable2;
|
|
5974
6078
|
}
|
|
5975
|
-
function isSlottable
|
|
5976
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER
|
|
6079
|
+
function isSlottable(child) {
|
|
6080
|
+
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
5977
6081
|
}
|
|
5978
|
-
function mergeProps
|
|
6082
|
+
function mergeProps(slotProps, childProps) {
|
|
5979
6083
|
const overrideProps = { ...childProps };
|
|
5980
6084
|
for (const propName in childProps) {
|
|
5981
6085
|
const slotPropValue = slotProps[propName];
|
|
@@ -5999,7 +6103,7 @@ function mergeProps$3(slotProps, childProps) {
|
|
|
5999
6103
|
}
|
|
6000
6104
|
return { ...slotProps, ...overrideProps };
|
|
6001
6105
|
}
|
|
6002
|
-
function getElementRef$
|
|
6106
|
+
function getElementRef$1(element) {
|
|
6003
6107
|
var _a, _b;
|
|
6004
6108
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
6005
6109
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -6013,7 +6117,7 @@ function getElementRef$4(element) {
|
|
|
6013
6117
|
}
|
|
6014
6118
|
return element.props.ref || element.ref;
|
|
6015
6119
|
}
|
|
6016
|
-
var NODES
|
|
6120
|
+
var NODES = [
|
|
6017
6121
|
"a",
|
|
6018
6122
|
"button",
|
|
6019
6123
|
"div",
|
|
@@ -6032,8 +6136,8 @@ var NODES$3 = [
|
|
|
6032
6136
|
"svg",
|
|
6033
6137
|
"ul"
|
|
6034
6138
|
];
|
|
6035
|
-
var Primitive
|
|
6036
|
-
const Slot2 = /* @__PURE__ */ createSlot
|
|
6139
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
6140
|
+
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
6037
6141
|
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
6038
6142
|
const { asChild, ...primitiveProps } = props;
|
|
6039
6143
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -6166,7 +6270,7 @@ var DismissableLayer = React$1.forwardRef(
|
|
|
6166
6270
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
6167
6271
|
}, []);
|
|
6168
6272
|
return /* @__PURE__ */ jsx(
|
|
6169
|
-
Primitive
|
|
6273
|
+
Primitive.div,
|
|
6170
6274
|
{
|
|
6171
6275
|
...layerProps,
|
|
6172
6276
|
ref: composedRefs,
|
|
@@ -6199,7 +6303,7 @@ var DismissableLayerBranch = React$1.forwardRef((props, forwardedRef) => {
|
|
|
6199
6303
|
};
|
|
6200
6304
|
}
|
|
6201
6305
|
}, [context.branches]);
|
|
6202
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
6306
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
6203
6307
|
});
|
|
6204
6308
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
6205
6309
|
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
@@ -6408,7 +6512,7 @@ var FocusScope = React$1.forwardRef((props, forwardedRef) => {
|
|
|
6408
6512
|
},
|
|
6409
6513
|
[loop, trapped, focusScope.paused]
|
|
6410
6514
|
);
|
|
6411
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
6515
|
+
return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
6412
6516
|
});
|
|
6413
6517
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
6414
6518
|
function focusFirst$2(candidates, { select = false } = {}) {
|
|
@@ -6505,7 +6609,7 @@ var Portal$5 = React$1.forwardRef((props, forwardedRef) => {
|
|
|
6505
6609
|
const [mounted, setMounted] = React$1.useState(false);
|
|
6506
6610
|
useLayoutEffect2(() => setMounted(true), []);
|
|
6507
6611
|
const container = containerProp || mounted && ((_a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a.body);
|
|
6508
|
-
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive
|
|
6612
|
+
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
6509
6613
|
});
|
|
6510
6614
|
Portal$5.displayName = PORTAL_NAME$6;
|
|
6511
6615
|
function useStateMachine(initialState, machine) {
|
|
@@ -6518,7 +6622,7 @@ var Presence = (props) => {
|
|
|
6518
6622
|
const { present, children } = props;
|
|
6519
6623
|
const presence = usePresence(present);
|
|
6520
6624
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React$1.Children.only(children);
|
|
6521
|
-
const ref = useComposedRefs(presence.ref, getElementRef
|
|
6625
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
6522
6626
|
const forceMount = typeof children === "function";
|
|
6523
6627
|
return forceMount || presence.isPresent ? React$1.cloneElement(child, { ref }) : null;
|
|
6524
6628
|
};
|
|
@@ -6617,7 +6721,7 @@ function usePresence(present) {
|
|
|
6617
6721
|
function getAnimationName(styles) {
|
|
6618
6722
|
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
6619
6723
|
}
|
|
6620
|
-
function getElementRef
|
|
6724
|
+
function getElementRef(element) {
|
|
6621
6725
|
var _a, _b;
|
|
6622
6726
|
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
6623
6727
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -7440,7 +7544,7 @@ var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
|
7440
7544
|
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
7441
7545
|
};
|
|
7442
7546
|
var DIALOG_NAME = "Dialog";
|
|
7443
|
-
var [createDialogContext, createDialogScope] = createContextScope
|
|
7547
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
7444
7548
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
7445
7549
|
var Dialog$1 = (props) => {
|
|
7446
7550
|
const {
|
|
@@ -7484,7 +7588,7 @@ var DialogTrigger = React$1.forwardRef(
|
|
|
7484
7588
|
const context = useDialogContext(TRIGGER_NAME$5, __scopeDialog);
|
|
7485
7589
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
7486
7590
|
return /* @__PURE__ */ jsx(
|
|
7487
|
-
Primitive
|
|
7591
|
+
Primitive.button,
|
|
7488
7592
|
{
|
|
7489
7593
|
type: "button",
|
|
7490
7594
|
"aria-haspopup": "dialog",
|
|
@@ -7519,7 +7623,7 @@ var DialogOverlay$1 = React$1.forwardRef(
|
|
|
7519
7623
|
}
|
|
7520
7624
|
);
|
|
7521
7625
|
DialogOverlay$1.displayName = OVERLAY_NAME;
|
|
7522
|
-
var Slot$3 = /* @__PURE__ */ createSlot
|
|
7626
|
+
var Slot$3 = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
7523
7627
|
var DialogOverlayImpl = React$1.forwardRef(
|
|
7524
7628
|
(props, forwardedRef) => {
|
|
7525
7629
|
const { __scopeDialog, ...overlayProps } = props;
|
|
@@ -7528,7 +7632,7 @@ var DialogOverlayImpl = React$1.forwardRef(
|
|
|
7528
7632
|
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
7529
7633
|
// ie. when `Overlay` and `Content` are siblings
|
|
7530
7634
|
/* @__PURE__ */ jsx(RemoveScroll, { as: Slot$3, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
|
|
7531
|
-
Primitive
|
|
7635
|
+
Primitive.div,
|
|
7532
7636
|
{
|
|
7533
7637
|
"data-state": getState$1(context.open),
|
|
7534
7638
|
...overlayProps,
|
|
@@ -7673,7 +7777,7 @@ var DialogTitle$1 = React$1.forwardRef(
|
|
|
7673
7777
|
(props, forwardedRef) => {
|
|
7674
7778
|
const { __scopeDialog, ...titleProps } = props;
|
|
7675
7779
|
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
7676
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
7780
|
+
return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
7677
7781
|
}
|
|
7678
7782
|
);
|
|
7679
7783
|
DialogTitle$1.displayName = TITLE_NAME;
|
|
@@ -7682,7 +7786,7 @@ var DialogDescription$1 = React$1.forwardRef(
|
|
|
7682
7786
|
(props, forwardedRef) => {
|
|
7683
7787
|
const { __scopeDialog, ...descriptionProps } = props;
|
|
7684
7788
|
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
7685
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
7789
|
+
return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
7686
7790
|
}
|
|
7687
7791
|
);
|
|
7688
7792
|
DialogDescription$1.displayName = DESCRIPTION_NAME;
|
|
@@ -7692,7 +7796,7 @@ var DialogClose = React$1.forwardRef(
|
|
|
7692
7796
|
const { __scopeDialog, ...closeProps } = props;
|
|
7693
7797
|
const context = useDialogContext(CLOSE_NAME$1, __scopeDialog);
|
|
7694
7798
|
return /* @__PURE__ */ jsx(
|
|
7695
|
-
Primitive
|
|
7799
|
+
Primitive.button,
|
|
7696
7800
|
{
|
|
7697
7801
|
type: "button",
|
|
7698
7802
|
...closeProps,
|
|
@@ -8366,7 +8470,7 @@ const DialogContent = React$1.forwardRef(({ className, children, ...props }, ref
|
|
|
8366
8470
|
/* @__PURE__ */ jsxs(
|
|
8367
8471
|
Close,
|
|
8368
8472
|
{
|
|
8369
|
-
className: "closeDialog cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-full cteditor-bg-secondary cteditor-p-1 cteditor-opacity-70 cteditor-transition-opacity focus:cteditor-outline-none cteditor-disabled:pointer-events-none data-[state=open]:cteditor-bg-accent data-[state=open]:cteditor-text-muted-foreground hover:cteditor-opacity-100\n",
|
|
8473
|
+
className: "closeDialog cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-full cteditor-bg-secondary cteditor-p-1 cteditor-opacity-70 cteditor-transition-opacity focus:cteditor-outline-none cteditor-disabled:pointer-events-none data-[state=open]:cteditor-bg-accent data-[state=open]:cteditor-text-muted-foreground hover:cteditor-opacity-100\r\n",
|
|
8370
8474
|
children: [
|
|
8371
8475
|
/* @__PURE__ */ jsx(X$1, { className: "cteditor-h-4 cteditor-w-4" }),
|
|
8372
8476
|
/* @__PURE__ */ jsx("span", { className: "!cteditor-sr-only", children: "Close" })
|
|
@@ -8444,140 +8548,10 @@ const Input$1 = React$1.forwardRef(
|
|
|
8444
8548
|
}
|
|
8445
8549
|
);
|
|
8446
8550
|
Input$1.displayName = "Input";
|
|
8447
|
-
var REACT_LAZY_TYPE$2 = Symbol.for("react.lazy");
|
|
8448
|
-
var use$2 = React$1[" use ".trim().toString()];
|
|
8449
|
-
function isPromiseLike$2(value) {
|
|
8450
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
8451
|
-
}
|
|
8452
|
-
function isLazyComponent$2(element) {
|
|
8453
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE$2 && "_payload" in element && isPromiseLike$2(element._payload);
|
|
8454
|
-
}
|
|
8455
|
-
// @__NO_SIDE_EFFECTS__
|
|
8456
|
-
function createSlot$2(ownerName) {
|
|
8457
|
-
const SlotClone = /* @__PURE__ */ createSlotClone$2(ownerName);
|
|
8458
|
-
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
8459
|
-
let { children, ...slotProps } = props;
|
|
8460
|
-
if (isLazyComponent$2(children) && typeof use$2 === "function") {
|
|
8461
|
-
children = use$2(children._payload);
|
|
8462
|
-
}
|
|
8463
|
-
const childrenArray = React$1.Children.toArray(children);
|
|
8464
|
-
const slottable = childrenArray.find(isSlottable$2);
|
|
8465
|
-
if (slottable) {
|
|
8466
|
-
const newElement = slottable.props.children;
|
|
8467
|
-
const newChildren = childrenArray.map((child) => {
|
|
8468
|
-
if (child === slottable) {
|
|
8469
|
-
if (React$1.Children.count(newElement) > 1)
|
|
8470
|
-
return React$1.Children.only(null);
|
|
8471
|
-
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
8472
|
-
} else {
|
|
8473
|
-
return child;
|
|
8474
|
-
}
|
|
8475
|
-
});
|
|
8476
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null });
|
|
8477
|
-
}
|
|
8478
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
8479
|
-
});
|
|
8480
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
8481
|
-
return Slot2;
|
|
8482
|
-
}
|
|
8483
|
-
// @__NO_SIDE_EFFECTS__
|
|
8484
|
-
function createSlotClone$2(ownerName) {
|
|
8485
|
-
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
8486
|
-
let { children, ...slotProps } = props;
|
|
8487
|
-
if (isLazyComponent$2(children) && typeof use$2 === "function") {
|
|
8488
|
-
children = use$2(children._payload);
|
|
8489
|
-
}
|
|
8490
|
-
if (React$1.isValidElement(children)) {
|
|
8491
|
-
const childrenRef = getElementRef$2(children);
|
|
8492
|
-
const props2 = mergeProps$2(slotProps, children.props);
|
|
8493
|
-
if (children.type !== React$1.Fragment) {
|
|
8494
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
8495
|
-
}
|
|
8496
|
-
return React$1.cloneElement(children, props2);
|
|
8497
|
-
}
|
|
8498
|
-
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
8499
|
-
});
|
|
8500
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
8501
|
-
return SlotClone;
|
|
8502
|
-
}
|
|
8503
|
-
var SLOTTABLE_IDENTIFIER$2 = Symbol("radix.slottable");
|
|
8504
|
-
function isSlottable$2(child) {
|
|
8505
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$2;
|
|
8506
|
-
}
|
|
8507
|
-
function mergeProps$2(slotProps, childProps) {
|
|
8508
|
-
const overrideProps = { ...childProps };
|
|
8509
|
-
for (const propName in childProps) {
|
|
8510
|
-
const slotPropValue = slotProps[propName];
|
|
8511
|
-
const childPropValue = childProps[propName];
|
|
8512
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
8513
|
-
if (isHandler) {
|
|
8514
|
-
if (slotPropValue && childPropValue) {
|
|
8515
|
-
overrideProps[propName] = (...args) => {
|
|
8516
|
-
const result = childPropValue(...args);
|
|
8517
|
-
slotPropValue(...args);
|
|
8518
|
-
return result;
|
|
8519
|
-
};
|
|
8520
|
-
} else if (slotPropValue) {
|
|
8521
|
-
overrideProps[propName] = slotPropValue;
|
|
8522
|
-
}
|
|
8523
|
-
} else if (propName === "style") {
|
|
8524
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
8525
|
-
} else if (propName === "className") {
|
|
8526
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
8527
|
-
}
|
|
8528
|
-
}
|
|
8529
|
-
return { ...slotProps, ...overrideProps };
|
|
8530
|
-
}
|
|
8531
|
-
function getElementRef$2(element) {
|
|
8532
|
-
var _a, _b;
|
|
8533
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
8534
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
8535
|
-
if (mayWarn) {
|
|
8536
|
-
return element.ref;
|
|
8537
|
-
}
|
|
8538
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
8539
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
8540
|
-
if (mayWarn) {
|
|
8541
|
-
return element.props.ref;
|
|
8542
|
-
}
|
|
8543
|
-
return element.props.ref || element.ref;
|
|
8544
|
-
}
|
|
8545
|
-
var NODES$2 = [
|
|
8546
|
-
"a",
|
|
8547
|
-
"button",
|
|
8548
|
-
"div",
|
|
8549
|
-
"form",
|
|
8550
|
-
"h2",
|
|
8551
|
-
"h3",
|
|
8552
|
-
"img",
|
|
8553
|
-
"input",
|
|
8554
|
-
"label",
|
|
8555
|
-
"li",
|
|
8556
|
-
"nav",
|
|
8557
|
-
"ol",
|
|
8558
|
-
"p",
|
|
8559
|
-
"select",
|
|
8560
|
-
"span",
|
|
8561
|
-
"svg",
|
|
8562
|
-
"ul"
|
|
8563
|
-
];
|
|
8564
|
-
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
8565
|
-
const Slot2 = /* @__PURE__ */ createSlot$2(`Primitive.${node}`);
|
|
8566
|
-
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
8567
|
-
const { asChild, ...primitiveProps } = props;
|
|
8568
|
-
const Comp = asChild ? Slot2 : node;
|
|
8569
|
-
if (typeof window !== "undefined") {
|
|
8570
|
-
window[Symbol.for("radix-ui")] = true;
|
|
8571
|
-
}
|
|
8572
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
8573
|
-
});
|
|
8574
|
-
Node2.displayName = `Primitive.${node}`;
|
|
8575
|
-
return { ...primitive, [node]: Node2 };
|
|
8576
|
-
}, {});
|
|
8577
8551
|
var NAME$4 = "Label";
|
|
8578
8552
|
var Label$3 = React$1.forwardRef((props, forwardedRef) => {
|
|
8579
8553
|
return /* @__PURE__ */ jsx(
|
|
8580
|
-
Primitive
|
|
8554
|
+
Primitive.label,
|
|
8581
8555
|
{
|
|
8582
8556
|
...props,
|
|
8583
8557
|
ref: forwardedRef,
|
|
@@ -9111,7 +9085,59 @@ const AIRephrasePlugin = () => {
|
|
|
9111
9085
|
duration: Infinity
|
|
9112
9086
|
});
|
|
9113
9087
|
try {
|
|
9114
|
-
const
|
|
9088
|
+
const userTextLength = selectedText.length;
|
|
9089
|
+
if (type === "MAKE_LONGER" || type === "MAKE_SHORTER") {
|
|
9090
|
+
const savedSelection = {
|
|
9091
|
+
anchor: { key: selection.anchor.key, offset: selection.anchor.offset, type: selection.anchor.type },
|
|
9092
|
+
focus: { key: selection.focus.key, offset: selection.focus.offset, type: selection.focus.type }
|
|
9093
|
+
};
|
|
9094
|
+
let isFirstChunk = true;
|
|
9095
|
+
let streamedContent = "";
|
|
9096
|
+
await AiTextTransformStream({
|
|
9097
|
+
content: prompt,
|
|
9098
|
+
apiKey: apiKey || void 0,
|
|
9099
|
+
userTextLength,
|
|
9100
|
+
onChunk: (chunk) => {
|
|
9101
|
+
streamedContent += chunk;
|
|
9102
|
+
editor.update(() => {
|
|
9103
|
+
if (isFirstChunk) {
|
|
9104
|
+
isFirstChunk = false;
|
|
9105
|
+
try {
|
|
9106
|
+
const newSelection = $getSelection();
|
|
9107
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
9108
|
+
newSelection.anchor.set(savedSelection.anchor.key, savedSelection.anchor.offset, savedSelection.anchor.type);
|
|
9109
|
+
newSelection.focus.set(savedSelection.focus.key, savedSelection.focus.offset, savedSelection.focus.type);
|
|
9110
|
+
newSelection.insertText("");
|
|
9111
|
+
}
|
|
9112
|
+
} catch (e) {
|
|
9113
|
+
console.warn("Could not restore selection", e);
|
|
9114
|
+
}
|
|
9115
|
+
}
|
|
9116
|
+
const currentSelection = $getSelection();
|
|
9117
|
+
if (currentSelection && $isRangeSelection(currentSelection)) {
|
|
9118
|
+
currentSelection.insertText(chunk);
|
|
9119
|
+
}
|
|
9120
|
+
});
|
|
9121
|
+
},
|
|
9122
|
+
onComplete: () => {
|
|
9123
|
+
toast.dismiss(loadingToastId);
|
|
9124
|
+
toast.success(successMessage);
|
|
9125
|
+
},
|
|
9126
|
+
onError: (error) => {
|
|
9127
|
+
toast.dismiss(loadingToastId);
|
|
9128
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9129
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9130
|
+
toast.error(title, { description: error.message, duration: 8e3 });
|
|
9131
|
+
} else if (error instanceof CreditError$1) {
|
|
9132
|
+
toast.error("Credits Issue", { description: error.message, duration: 8e3 });
|
|
9133
|
+
} else {
|
|
9134
|
+
toast.error(`${actionName} failed`, { description: error.message });
|
|
9135
|
+
}
|
|
9136
|
+
}
|
|
9137
|
+
});
|
|
9138
|
+
return true;
|
|
9139
|
+
}
|
|
9140
|
+
const response = await AiJsonResponse({ content: prompt, apiKey: apiKey || void 0, userTextLength });
|
|
9115
9141
|
if (!response.data) {
|
|
9116
9142
|
console.warn("Empty response received");
|
|
9117
9143
|
toast.dismiss(loadingToastId);
|
|
@@ -9163,10 +9189,11 @@ const AIRephrasePlugin = () => {
|
|
|
9163
9189
|
duration: Infinity
|
|
9164
9190
|
});
|
|
9165
9191
|
try {
|
|
9192
|
+
const userTextLength = selectedTextForTranslation.length;
|
|
9166
9193
|
const prompt = `Translate this text to ${targetLanguage}. Return ONLY the translated text without any markdown formatting, headers, or special symbols. Just the plain translated text:
|
|
9167
9194
|
|
|
9168
9195
|
"${selectedTextForTranslation}"`;
|
|
9169
|
-
const response = await AiJsonResponse({ content: prompt, apiKey: apiKey || void 0 });
|
|
9196
|
+
const response = await AiJsonResponse({ content: prompt, apiKey: apiKey || void 0, userTextLength });
|
|
9170
9197
|
if (!response.data) {
|
|
9171
9198
|
console.warn("Empty response received");
|
|
9172
9199
|
toast.dismiss(loadingToastId);
|
|
@@ -9236,6 +9263,7 @@ const AIRephrasePlugin = () => {
|
|
|
9236
9263
|
toast.error("No text selected for tone adjustment");
|
|
9237
9264
|
return false;
|
|
9238
9265
|
}
|
|
9266
|
+
const userTextLength = selectedText.length;
|
|
9239
9267
|
const prompt = `Adjust the tone of this text to be ${targetTone.toLowerCase()}. Maintain the core message and key information, but change the style and word choice to match the ${targetTone.toLowerCase()} tone:
|
|
9240
9268
|
"${selectedText}"`;
|
|
9241
9269
|
const loadingToastId = toast.loading(`Adjusting to ${targetTone} tone...`, {
|
|
@@ -9243,39 +9271,49 @@ const AIRephrasePlugin = () => {
|
|
|
9243
9271
|
duration: Infinity
|
|
9244
9272
|
});
|
|
9245
9273
|
try {
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9274
|
+
let isFirstChunk = true;
|
|
9275
|
+
await AiTextTransformStream({
|
|
9276
|
+
content: prompt,
|
|
9277
|
+
apiKey: apiKey || void 0,
|
|
9278
|
+
userTextLength,
|
|
9279
|
+
onChunk: (chunk) => {
|
|
9280
|
+
editor.update(() => {
|
|
9281
|
+
if (isFirstChunk) {
|
|
9282
|
+
isFirstChunk = false;
|
|
9283
|
+
try {
|
|
9284
|
+
const newSelection = $getSelection();
|
|
9285
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
9286
|
+
newSelection.anchor.set(savedSelection.anchor.key, savedSelection.anchor.offset, savedSelection.anchor.type);
|
|
9287
|
+
newSelection.focus.set(savedSelection.focus.key, savedSelection.focus.offset, savedSelection.focus.type);
|
|
9288
|
+
newSelection.insertText("");
|
|
9289
|
+
}
|
|
9290
|
+
} catch (e) {
|
|
9291
|
+
console.warn("Could not restore selection", e);
|
|
9292
|
+
}
|
|
9293
|
+
}
|
|
9294
|
+
const currentSelection = $getSelection();
|
|
9295
|
+
if (currentSelection && $isRangeSelection(currentSelection)) {
|
|
9296
|
+
currentSelection.insertText(chunk);
|
|
9297
|
+
}
|
|
9298
|
+
});
|
|
9299
|
+
},
|
|
9300
|
+
onComplete: () => {
|
|
9301
|
+
toast.dismiss(loadingToastId);
|
|
9302
|
+
toast.success(`Tone adjusted to ${targetTone} successfully!`);
|
|
9303
|
+
toneSelectionRef.current = null;
|
|
9304
|
+
},
|
|
9305
|
+
onError: (error) => {
|
|
9306
|
+
toast.dismiss(loadingToastId);
|
|
9307
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9308
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9309
|
+
toast.error(title, { description: error.message, duration: 8e3 });
|
|
9310
|
+
} else if (error instanceof CreditError$1) {
|
|
9311
|
+
toast.error("Credits Issue", { description: error.message, duration: 8e3 });
|
|
9312
|
+
} else {
|
|
9313
|
+
toast.error("Tone adjustment failed", { description: error.message });
|
|
9263
9314
|
}
|
|
9264
|
-
} catch (e) {
|
|
9265
|
-
console.warn("Could not restore selection, will append at end", e);
|
|
9266
9315
|
}
|
|
9267
|
-
const currentSelection = $getSelection();
|
|
9268
|
-
if (!currentSelection || !$isRangeSelection(currentSelection))
|
|
9269
|
-
return;
|
|
9270
|
-
const parser = new DOMParser();
|
|
9271
|
-
const dom = parser.parseFromString(response.data, "text/html");
|
|
9272
|
-
const nodes = $generateNodesFromDOM(editor, dom);
|
|
9273
|
-
currentSelection.insertText("");
|
|
9274
|
-
$insertNodes(nodes);
|
|
9275
9316
|
});
|
|
9276
|
-
toast.dismiss(loadingToastId);
|
|
9277
|
-
toast.success(`Tone adjusted to ${targetTone} successfully!`);
|
|
9278
|
-
toneSelectionRef.current = null;
|
|
9279
9317
|
return true;
|
|
9280
9318
|
} catch (error) {
|
|
9281
9319
|
console.error("Error in tone adjustment:", error);
|
|
@@ -9705,16 +9743,16 @@ function CopyButton({ editor, getCodeDOMNode }) {
|
|
|
9705
9743
|
}
|
|
9706
9744
|
const index$6 = "";
|
|
9707
9745
|
const PRETTIER_PARSER_MODULES = {
|
|
9708
|
-
css: [() => import("./postcss-
|
|
9709
|
-
html: [() => import("./html-
|
|
9746
|
+
css: [() => import("./postcss-c2592f3f.js")],
|
|
9747
|
+
html: [() => import("./html-f95ee5dc.js")],
|
|
9710
9748
|
js: [
|
|
9711
|
-
() => import("./babel-
|
|
9712
|
-
() => import("./estree-
|
|
9749
|
+
() => import("./babel-d155920e.js"),
|
|
9750
|
+
() => import("./estree-b1fff53b.js")
|
|
9713
9751
|
],
|
|
9714
|
-
markdown: [() => import("./markdown-
|
|
9752
|
+
markdown: [() => import("./markdown-1d9e6c3f.js")],
|
|
9715
9753
|
typescript: [
|
|
9716
|
-
() => import("./typescript-
|
|
9717
|
-
() => import("./estree-
|
|
9754
|
+
() => import("./typescript-48c10f50.js"),
|
|
9755
|
+
() => import("./estree-b1fff53b.js")
|
|
9718
9756
|
]
|
|
9719
9757
|
};
|
|
9720
9758
|
async function loadPrettierParserByLang(lang) {
|
|
@@ -9725,7 +9763,7 @@ async function loadPrettierParserByLang(lang) {
|
|
|
9725
9763
|
return modules;
|
|
9726
9764
|
}
|
|
9727
9765
|
async function loadPrettierFormat() {
|
|
9728
|
-
const { format } = await import("./standalone-
|
|
9766
|
+
const { format } = await import("./standalone-bcc7f37a.js");
|
|
9729
9767
|
return format;
|
|
9730
9768
|
}
|
|
9731
9769
|
const PRETTIER_OPTIONS_BY_LANG = {
|
|
@@ -10202,199 +10240,6 @@ function $createCommentedTextNode(text, commentId, commentText, commentAuthor, c
|
|
|
10202
10240
|
function $isCommentedTextNode(node) {
|
|
10203
10241
|
return node instanceof CommentedTextNode;
|
|
10204
10242
|
}
|
|
10205
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
10206
|
-
let defaultContexts = [];
|
|
10207
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
10208
|
-
const BaseContext = React$1.createContext(defaultContext);
|
|
10209
|
-
BaseContext.displayName = rootComponentName + "Context";
|
|
10210
|
-
const index2 = defaultContexts.length;
|
|
10211
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
10212
|
-
const Provider2 = (props) => {
|
|
10213
|
-
var _a;
|
|
10214
|
-
const { scope, children, ...context } = props;
|
|
10215
|
-
const Context2 = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
10216
|
-
const value = React$1.useMemo(() => context, Object.values(context));
|
|
10217
|
-
return /* @__PURE__ */ jsx(Context2.Provider, { value, children });
|
|
10218
|
-
};
|
|
10219
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
10220
|
-
function useContext2(consumerName, scope) {
|
|
10221
|
-
var _a;
|
|
10222
|
-
const Context2 = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
10223
|
-
const context = React$1.useContext(Context2);
|
|
10224
|
-
if (context)
|
|
10225
|
-
return context;
|
|
10226
|
-
if (defaultContext !== void 0)
|
|
10227
|
-
return defaultContext;
|
|
10228
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10229
|
-
}
|
|
10230
|
-
return [Provider2, useContext2];
|
|
10231
|
-
}
|
|
10232
|
-
const createScope = () => {
|
|
10233
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10234
|
-
return React$1.createContext(defaultContext);
|
|
10235
|
-
});
|
|
10236
|
-
return function useScope(scope) {
|
|
10237
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
10238
|
-
return React$1.useMemo(
|
|
10239
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10240
|
-
[scope, contexts]
|
|
10241
|
-
);
|
|
10242
|
-
};
|
|
10243
|
-
};
|
|
10244
|
-
createScope.scopeName = scopeName;
|
|
10245
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
10246
|
-
}
|
|
10247
|
-
function composeContextScopes(...scopes) {
|
|
10248
|
-
const baseScope = scopes[0];
|
|
10249
|
-
if (scopes.length === 1)
|
|
10250
|
-
return baseScope;
|
|
10251
|
-
const createScope = () => {
|
|
10252
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
10253
|
-
useScope: createScope2(),
|
|
10254
|
-
scopeName: createScope2.scopeName
|
|
10255
|
-
}));
|
|
10256
|
-
return function useComposedScopes(overrideScopes) {
|
|
10257
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10258
|
-
const scopeProps = useScope(overrideScopes);
|
|
10259
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10260
|
-
return { ...nextScopes2, ...currentScope };
|
|
10261
|
-
}, {});
|
|
10262
|
-
return React$1.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10263
|
-
};
|
|
10264
|
-
};
|
|
10265
|
-
createScope.scopeName = baseScope.scopeName;
|
|
10266
|
-
return createScope;
|
|
10267
|
-
}
|
|
10268
|
-
var REACT_LAZY_TYPE$1 = Symbol.for("react.lazy");
|
|
10269
|
-
var use$1 = React$1[" use ".trim().toString()];
|
|
10270
|
-
function isPromiseLike$1(value) {
|
|
10271
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
10272
|
-
}
|
|
10273
|
-
function isLazyComponent$1(element) {
|
|
10274
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE$1 && "_payload" in element && isPromiseLike$1(element._payload);
|
|
10275
|
-
}
|
|
10276
|
-
// @__NO_SIDE_EFFECTS__
|
|
10277
|
-
function createSlot$1(ownerName) {
|
|
10278
|
-
const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
|
|
10279
|
-
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10280
|
-
let { children, ...slotProps } = props;
|
|
10281
|
-
if (isLazyComponent$1(children) && typeof use$1 === "function") {
|
|
10282
|
-
children = use$1(children._payload);
|
|
10283
|
-
}
|
|
10284
|
-
const childrenArray = React$1.Children.toArray(children);
|
|
10285
|
-
const slottable = childrenArray.find(isSlottable$1);
|
|
10286
|
-
if (slottable) {
|
|
10287
|
-
const newElement = slottable.props.children;
|
|
10288
|
-
const newChildren = childrenArray.map((child) => {
|
|
10289
|
-
if (child === slottable) {
|
|
10290
|
-
if (React$1.Children.count(newElement) > 1)
|
|
10291
|
-
return React$1.Children.only(null);
|
|
10292
|
-
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
10293
|
-
} else {
|
|
10294
|
-
return child;
|
|
10295
|
-
}
|
|
10296
|
-
});
|
|
10297
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null });
|
|
10298
|
-
}
|
|
10299
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
10300
|
-
});
|
|
10301
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
10302
|
-
return Slot2;
|
|
10303
|
-
}
|
|
10304
|
-
// @__NO_SIDE_EFFECTS__
|
|
10305
|
-
function createSlotClone$1(ownerName) {
|
|
10306
|
-
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
10307
|
-
let { children, ...slotProps } = props;
|
|
10308
|
-
if (isLazyComponent$1(children) && typeof use$1 === "function") {
|
|
10309
|
-
children = use$1(children._payload);
|
|
10310
|
-
}
|
|
10311
|
-
if (React$1.isValidElement(children)) {
|
|
10312
|
-
const childrenRef = getElementRef$1(children);
|
|
10313
|
-
const props2 = mergeProps$1(slotProps, children.props);
|
|
10314
|
-
if (children.type !== React$1.Fragment) {
|
|
10315
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10316
|
-
}
|
|
10317
|
-
return React$1.cloneElement(children, props2);
|
|
10318
|
-
}
|
|
10319
|
-
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
10320
|
-
});
|
|
10321
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10322
|
-
return SlotClone;
|
|
10323
|
-
}
|
|
10324
|
-
var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
|
|
10325
|
-
function isSlottable$1(child) {
|
|
10326
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
|
|
10327
|
-
}
|
|
10328
|
-
function mergeProps$1(slotProps, childProps) {
|
|
10329
|
-
const overrideProps = { ...childProps };
|
|
10330
|
-
for (const propName in childProps) {
|
|
10331
|
-
const slotPropValue = slotProps[propName];
|
|
10332
|
-
const childPropValue = childProps[propName];
|
|
10333
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
10334
|
-
if (isHandler) {
|
|
10335
|
-
if (slotPropValue && childPropValue) {
|
|
10336
|
-
overrideProps[propName] = (...args) => {
|
|
10337
|
-
const result = childPropValue(...args);
|
|
10338
|
-
slotPropValue(...args);
|
|
10339
|
-
return result;
|
|
10340
|
-
};
|
|
10341
|
-
} else if (slotPropValue) {
|
|
10342
|
-
overrideProps[propName] = slotPropValue;
|
|
10343
|
-
}
|
|
10344
|
-
} else if (propName === "style") {
|
|
10345
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
10346
|
-
} else if (propName === "className") {
|
|
10347
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
10348
|
-
}
|
|
10349
|
-
}
|
|
10350
|
-
return { ...slotProps, ...overrideProps };
|
|
10351
|
-
}
|
|
10352
|
-
function getElementRef$1(element) {
|
|
10353
|
-
var _a, _b;
|
|
10354
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
10355
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10356
|
-
if (mayWarn) {
|
|
10357
|
-
return element.ref;
|
|
10358
|
-
}
|
|
10359
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
10360
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10361
|
-
if (mayWarn) {
|
|
10362
|
-
return element.props.ref;
|
|
10363
|
-
}
|
|
10364
|
-
return element.props.ref || element.ref;
|
|
10365
|
-
}
|
|
10366
|
-
var NODES$1 = [
|
|
10367
|
-
"a",
|
|
10368
|
-
"button",
|
|
10369
|
-
"div",
|
|
10370
|
-
"form",
|
|
10371
|
-
"h2",
|
|
10372
|
-
"h3",
|
|
10373
|
-
"img",
|
|
10374
|
-
"input",
|
|
10375
|
-
"label",
|
|
10376
|
-
"li",
|
|
10377
|
-
"nav",
|
|
10378
|
-
"ol",
|
|
10379
|
-
"p",
|
|
10380
|
-
"select",
|
|
10381
|
-
"span",
|
|
10382
|
-
"svg",
|
|
10383
|
-
"ul"
|
|
10384
|
-
];
|
|
10385
|
-
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
10386
|
-
const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
|
|
10387
|
-
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10388
|
-
const { asChild, ...primitiveProps } = props;
|
|
10389
|
-
const Comp = asChild ? Slot2 : node;
|
|
10390
|
-
if (typeof window !== "undefined") {
|
|
10391
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10392
|
-
}
|
|
10393
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10394
|
-
});
|
|
10395
|
-
Node2.displayName = `Primitive.${node}`;
|
|
10396
|
-
return { ...primitive, [node]: Node2 };
|
|
10397
|
-
}, {});
|
|
10398
10243
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
10399
10244
|
function getDefaultExportFromCjs(x2) {
|
|
10400
10245
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -10480,7 +10325,7 @@ var Avatar$1 = React$1.forwardRef(
|
|
|
10480
10325
|
scope: __scopeAvatar,
|
|
10481
10326
|
imageLoadingStatus,
|
|
10482
10327
|
onImageLoadingStatusChange: setImageLoadingStatus,
|
|
10483
|
-
children: /* @__PURE__ */ jsx(Primitive
|
|
10328
|
+
children: /* @__PURE__ */ jsx(Primitive.span, { ...avatarProps, ref: forwardedRef })
|
|
10484
10329
|
}
|
|
10485
10330
|
);
|
|
10486
10331
|
}
|
|
@@ -10502,7 +10347,7 @@ var AvatarImage$1 = React$1.forwardRef(
|
|
|
10502
10347
|
handleLoadingStatusChange(imageLoadingStatus);
|
|
10503
10348
|
}
|
|
10504
10349
|
}, [imageLoadingStatus, handleLoadingStatusChange]);
|
|
10505
|
-
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsx(Primitive
|
|
10350
|
+
return imageLoadingStatus === "loaded" ? /* @__PURE__ */ jsx(Primitive.img, { ...imageProps, ref: forwardedRef, src }) : null;
|
|
10506
10351
|
}
|
|
10507
10352
|
);
|
|
10508
10353
|
AvatarImage$1.displayName = IMAGE_NAME;
|
|
@@ -10518,7 +10363,7 @@ var AvatarFallback$1 = React$1.forwardRef(
|
|
|
10518
10363
|
return () => window.clearTimeout(timerId);
|
|
10519
10364
|
}
|
|
10520
10365
|
}, [delayMs]);
|
|
10521
|
-
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsx(Primitive
|
|
10366
|
+
return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ jsx(Primitive.span, { ...fallbackProps, ref: forwardedRef }) : null;
|
|
10522
10367
|
}
|
|
10523
10368
|
);
|
|
10524
10369
|
AvatarFallback$1.displayName = FALLBACK_NAME;
|
|
@@ -10663,136 +10508,6 @@ const CardFooter = React$1.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
10663
10508
|
}
|
|
10664
10509
|
));
|
|
10665
10510
|
CardFooter.displayName = "CardFooter";
|
|
10666
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
10667
|
-
var use = React$1[" use ".trim().toString()];
|
|
10668
|
-
function isPromiseLike(value) {
|
|
10669
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
10670
|
-
}
|
|
10671
|
-
function isLazyComponent(element) {
|
|
10672
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
10673
|
-
}
|
|
10674
|
-
// @__NO_SIDE_EFFECTS__
|
|
10675
|
-
function createSlot(ownerName) {
|
|
10676
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
10677
|
-
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10678
|
-
let { children, ...slotProps } = props;
|
|
10679
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
10680
|
-
children = use(children._payload);
|
|
10681
|
-
}
|
|
10682
|
-
const childrenArray = React$1.Children.toArray(children);
|
|
10683
|
-
const slottable = childrenArray.find(isSlottable);
|
|
10684
|
-
if (slottable) {
|
|
10685
|
-
const newElement = slottable.props.children;
|
|
10686
|
-
const newChildren = childrenArray.map((child) => {
|
|
10687
|
-
if (child === slottable) {
|
|
10688
|
-
if (React$1.Children.count(newElement) > 1)
|
|
10689
|
-
return React$1.Children.only(null);
|
|
10690
|
-
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
10691
|
-
} else {
|
|
10692
|
-
return child;
|
|
10693
|
-
}
|
|
10694
|
-
});
|
|
10695
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null });
|
|
10696
|
-
}
|
|
10697
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
10698
|
-
});
|
|
10699
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
10700
|
-
return Slot2;
|
|
10701
|
-
}
|
|
10702
|
-
// @__NO_SIDE_EFFECTS__
|
|
10703
|
-
function createSlotClone(ownerName) {
|
|
10704
|
-
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
10705
|
-
let { children, ...slotProps } = props;
|
|
10706
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
10707
|
-
children = use(children._payload);
|
|
10708
|
-
}
|
|
10709
|
-
if (React$1.isValidElement(children)) {
|
|
10710
|
-
const childrenRef = getElementRef(children);
|
|
10711
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
10712
|
-
if (children.type !== React$1.Fragment) {
|
|
10713
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10714
|
-
}
|
|
10715
|
-
return React$1.cloneElement(children, props2);
|
|
10716
|
-
}
|
|
10717
|
-
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
10718
|
-
});
|
|
10719
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10720
|
-
return SlotClone;
|
|
10721
|
-
}
|
|
10722
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
10723
|
-
function isSlottable(child) {
|
|
10724
|
-
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
10725
|
-
}
|
|
10726
|
-
function mergeProps(slotProps, childProps) {
|
|
10727
|
-
const overrideProps = { ...childProps };
|
|
10728
|
-
for (const propName in childProps) {
|
|
10729
|
-
const slotPropValue = slotProps[propName];
|
|
10730
|
-
const childPropValue = childProps[propName];
|
|
10731
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
10732
|
-
if (isHandler) {
|
|
10733
|
-
if (slotPropValue && childPropValue) {
|
|
10734
|
-
overrideProps[propName] = (...args) => {
|
|
10735
|
-
const result = childPropValue(...args);
|
|
10736
|
-
slotPropValue(...args);
|
|
10737
|
-
return result;
|
|
10738
|
-
};
|
|
10739
|
-
} else if (slotPropValue) {
|
|
10740
|
-
overrideProps[propName] = slotPropValue;
|
|
10741
|
-
}
|
|
10742
|
-
} else if (propName === "style") {
|
|
10743
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
10744
|
-
} else if (propName === "className") {
|
|
10745
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
10746
|
-
}
|
|
10747
|
-
}
|
|
10748
|
-
return { ...slotProps, ...overrideProps };
|
|
10749
|
-
}
|
|
10750
|
-
function getElementRef(element) {
|
|
10751
|
-
var _a, _b;
|
|
10752
|
-
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
10753
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10754
|
-
if (mayWarn) {
|
|
10755
|
-
return element.ref;
|
|
10756
|
-
}
|
|
10757
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
10758
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10759
|
-
if (mayWarn) {
|
|
10760
|
-
return element.props.ref;
|
|
10761
|
-
}
|
|
10762
|
-
return element.props.ref || element.ref;
|
|
10763
|
-
}
|
|
10764
|
-
var NODES = [
|
|
10765
|
-
"a",
|
|
10766
|
-
"button",
|
|
10767
|
-
"div",
|
|
10768
|
-
"form",
|
|
10769
|
-
"h2",
|
|
10770
|
-
"h3",
|
|
10771
|
-
"img",
|
|
10772
|
-
"input",
|
|
10773
|
-
"label",
|
|
10774
|
-
"li",
|
|
10775
|
-
"nav",
|
|
10776
|
-
"ol",
|
|
10777
|
-
"p",
|
|
10778
|
-
"select",
|
|
10779
|
-
"span",
|
|
10780
|
-
"svg",
|
|
10781
|
-
"ul"
|
|
10782
|
-
];
|
|
10783
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
10784
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10785
|
-
const Node2 = React$1.forwardRef((props, forwardedRef) => {
|
|
10786
|
-
const { asChild, ...primitiveProps } = props;
|
|
10787
|
-
const Comp = asChild ? Slot2 : node;
|
|
10788
|
-
if (typeof window !== "undefined") {
|
|
10789
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10790
|
-
}
|
|
10791
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10792
|
-
});
|
|
10793
|
-
Node2.displayName = `Primitive.${node}`;
|
|
10794
|
-
return { ...primitive, [node]: Node2 };
|
|
10795
|
-
}, {});
|
|
10796
10511
|
var NAME$3 = "Separator";
|
|
10797
10512
|
var DEFAULT_ORIENTATION = "horizontal";
|
|
10798
10513
|
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
@@ -10919,7 +10634,7 @@ const SheetDescription = React$1.forwardRef(({ className, ...props }, ref) => /*
|
|
|
10919
10634
|
SheetDescription.displayName = Description.displayName;
|
|
10920
10635
|
function createCollection(name) {
|
|
10921
10636
|
const PROVIDER_NAME2 = name + "CollectionProvider";
|
|
10922
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope
|
|
10637
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME2);
|
|
10923
10638
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
10924
10639
|
PROVIDER_NAME2,
|
|
10925
10640
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
@@ -10932,7 +10647,7 @@ function createCollection(name) {
|
|
|
10932
10647
|
};
|
|
10933
10648
|
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
10934
10649
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
10935
|
-
const CollectionSlotImpl = /* @__PURE__ */ createSlot
|
|
10650
|
+
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
10936
10651
|
const CollectionSlot = React__default.forwardRef(
|
|
10937
10652
|
(props, forwardedRef) => {
|
|
10938
10653
|
const { scope, children } = props;
|
|
@@ -10944,7 +10659,7 @@ function createCollection(name) {
|
|
|
10944
10659
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
10945
10660
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
10946
10661
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
10947
|
-
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot
|
|
10662
|
+
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
10948
10663
|
const CollectionItemSlot = React__default.forwardRef(
|
|
10949
10664
|
(props, forwardedRef) => {
|
|
10950
10665
|
const { scope, children, ...itemData } = props;
|
|
@@ -10989,7 +10704,7 @@ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
|
10989
10704
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
10990
10705
|
var GROUP_NAME$3 = "RovingFocusGroup";
|
|
10991
10706
|
var [Collection$2, useCollection$2, createCollectionScope$2] = createCollection(GROUP_NAME$3);
|
|
10992
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope
|
|
10707
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
10993
10708
|
GROUP_NAME$3,
|
|
10994
10709
|
[createCollectionScope$2]
|
|
10995
10710
|
);
|
|
@@ -11056,7 +10771,7 @@ var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
|
11056
10771
|
[]
|
|
11057
10772
|
),
|
|
11058
10773
|
children: /* @__PURE__ */ jsx(
|
|
11059
|
-
Primitive
|
|
10774
|
+
Primitive.div,
|
|
11060
10775
|
{
|
|
11061
10776
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
11062
10777
|
"data-orientation": orientation,
|
|
@@ -11121,7 +10836,7 @@ var RovingFocusGroupItem = React$1.forwardRef(
|
|
|
11121
10836
|
focusable,
|
|
11122
10837
|
active,
|
|
11123
10838
|
children: /* @__PURE__ */ jsx(
|
|
11124
|
-
Primitive
|
|
10839
|
+
Primitive.span,
|
|
11125
10840
|
{
|
|
11126
10841
|
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
11127
10842
|
"data-orientation": context.orientation,
|
|
@@ -11206,7 +10921,7 @@ function wrapArray$2(array, startIndex) {
|
|
|
11206
10921
|
var Root$2 = RovingFocusGroup;
|
|
11207
10922
|
var Item$1 = RovingFocusGroupItem;
|
|
11208
10923
|
var TABS_NAME = "Tabs";
|
|
11209
|
-
var [createTabsContext, createTabsScope] = createContextScope
|
|
10924
|
+
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
|
|
11210
10925
|
createRovingFocusGroupScope
|
|
11211
10926
|
]);
|
|
11212
10927
|
var useRovingFocusGroupScope$1 = createRovingFocusGroupScope();
|
|
@@ -11241,7 +10956,7 @@ var Tabs$1 = React$1.forwardRef(
|
|
|
11241
10956
|
dir: direction,
|
|
11242
10957
|
activationMode,
|
|
11243
10958
|
children: /* @__PURE__ */ jsx(
|
|
11244
|
-
Primitive
|
|
10959
|
+
Primitive.div,
|
|
11245
10960
|
{
|
|
11246
10961
|
dir: direction,
|
|
11247
10962
|
"data-orientation": orientation,
|
|
@@ -11269,7 +10984,7 @@ var TabsList$1 = React$1.forwardRef(
|
|
|
11269
10984
|
dir: context.dir,
|
|
11270
10985
|
loop,
|
|
11271
10986
|
children: /* @__PURE__ */ jsx(
|
|
11272
|
-
Primitive
|
|
10987
|
+
Primitive.div,
|
|
11273
10988
|
{
|
|
11274
10989
|
role: "tablist",
|
|
11275
10990
|
"aria-orientation": context.orientation,
|
|
@@ -11299,7 +11014,7 @@ var TabsTrigger$1 = React$1.forwardRef(
|
|
|
11299
11014
|
focusable: !disabled,
|
|
11300
11015
|
active: isSelected,
|
|
11301
11016
|
children: /* @__PURE__ */ jsx(
|
|
11302
|
-
Primitive
|
|
11017
|
+
Primitive.button,
|
|
11303
11018
|
{
|
|
11304
11019
|
type: "button",
|
|
11305
11020
|
role: "tab",
|
|
@@ -11349,7 +11064,7 @@ var TabsContent$1 = React$1.forwardRef(
|
|
|
11349
11064
|
return () => cancelAnimationFrame(rAF);
|
|
11350
11065
|
}, []);
|
|
11351
11066
|
return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
|
|
11352
|
-
Primitive
|
|
11067
|
+
Primitive.div,
|
|
11353
11068
|
{
|
|
11354
11069
|
"data-state": isSelected ? "active" : "inactive",
|
|
11355
11070
|
"data-orientation": context.orientation,
|
|
@@ -13771,7 +13486,7 @@ var NAME$2 = "Arrow";
|
|
|
13771
13486
|
var Arrow$1 = React$1.forwardRef((props, forwardedRef) => {
|
|
13772
13487
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
13773
13488
|
return /* @__PURE__ */ jsx(
|
|
13774
|
-
Primitive
|
|
13489
|
+
Primitive.svg,
|
|
13775
13490
|
{
|
|
13776
13491
|
...arrowProps,
|
|
13777
13492
|
ref: forwardedRef,
|
|
@@ -13820,7 +13535,7 @@ function useSize(element) {
|
|
|
13820
13535
|
return size2;
|
|
13821
13536
|
}
|
|
13822
13537
|
var POPPER_NAME = "Popper";
|
|
13823
|
-
var [createPopperContext, createPopperScope] = createContextScope
|
|
13538
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
13824
13539
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
13825
13540
|
var Popper = (props) => {
|
|
13826
13541
|
const { __scopePopper, children } = props;
|
|
@@ -13843,7 +13558,7 @@ var PopperAnchor = React$1.forwardRef(
|
|
|
13843
13558
|
context.onAnchorChange(anchorRef.current);
|
|
13844
13559
|
}
|
|
13845
13560
|
});
|
|
13846
|
-
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive
|
|
13561
|
+
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
13847
13562
|
}
|
|
13848
13563
|
);
|
|
13849
13564
|
PopperAnchor.displayName = ANCHOR_NAME$2;
|
|
@@ -13972,7 +13687,7 @@ var PopperContent = React$1.forwardRef(
|
|
|
13972
13687
|
arrowY,
|
|
13973
13688
|
shouldHideArrow: cannotCenterArrow,
|
|
13974
13689
|
children: /* @__PURE__ */ jsx(
|
|
13975
|
-
Primitive
|
|
13690
|
+
Primitive.div,
|
|
13976
13691
|
{
|
|
13977
13692
|
"data-side": placedSide,
|
|
13978
13693
|
"data-align": placedAlign,
|
|
@@ -14108,7 +13823,7 @@ var NAME$1 = "VisuallyHidden";
|
|
|
14108
13823
|
var VisuallyHidden = React$1.forwardRef(
|
|
14109
13824
|
(props, forwardedRef) => {
|
|
14110
13825
|
return /* @__PURE__ */ jsx(
|
|
14111
|
-
Primitive
|
|
13826
|
+
Primitive.span,
|
|
14112
13827
|
{
|
|
14113
13828
|
...props,
|
|
14114
13829
|
ref: forwardedRef,
|
|
@@ -14119,7 +13834,7 @@ var VisuallyHidden = React$1.forwardRef(
|
|
|
14119
13834
|
);
|
|
14120
13835
|
VisuallyHidden.displayName = NAME$1;
|
|
14121
13836
|
var Root = VisuallyHidden;
|
|
14122
|
-
var [createTooltipContext, createTooltipScope] = createContextScope
|
|
13837
|
+
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
14123
13838
|
createPopperScope
|
|
14124
13839
|
]);
|
|
14125
13840
|
var usePopperScope$3 = createPopperScope();
|
|
@@ -14280,7 +13995,7 @@ var TooltipTrigger$1 = React$1.forwardRef(
|
|
|
14280
13995
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
14281
13996
|
}, [handlePointerUp]);
|
|
14282
13997
|
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
14283
|
-
Primitive
|
|
13998
|
+
Primitive.button,
|
|
14284
13999
|
{
|
|
14285
14000
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
14286
14001
|
"data-state": context.stateAttribute,
|
|
@@ -15330,7 +15045,7 @@ const HtmlViewDisplay = () => {
|
|
|
15330
15045
|
onBlur: handleTextareaBlur,
|
|
15331
15046
|
onClick: handleTextareaClick,
|
|
15332
15047
|
onKeyDown: handleTextareaKeyDown,
|
|
15333
|
-
className: " cteditor-w-full cteditor-flex-1\n cteditor-font-mono cteditor-text-[13px] \n cteditor-p-3 \n cteditor-border cteditor-rounded-lg \n cteditor-resize-y cteditor-leading-[1.4] \n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \n cteditor-whitespace-pre-wrap cteditor-break-words\n dark:cteditor-text-background\n cteditor-text-foreground\n cteditor-bg-foreground/5\n",
|
|
15048
|
+
className: " cteditor-w-full cteditor-flex-1\r\n cteditor-font-mono cteditor-text-[13px] \r\n cteditor-p-3 \r\n cteditor-border cteditor-rounded-lg \r\n cteditor-resize-y cteditor-leading-[1.4] \r\n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \r\n cteditor-whitespace-pre-wrap cteditor-break-words\r\n dark:cteditor-text-background\r\n cteditor-text-foreground\r\n cteditor-bg-foreground/5\r\n",
|
|
15334
15049
|
placeholder: "HTML content will appear here... Edit and click 'Sync to Editor' to apply changes."
|
|
15335
15050
|
}
|
|
15336
15051
|
)
|
|
@@ -16536,7 +16251,7 @@ const EmbedComponent = ({ url, displayType, alignment, width: initialWidth, heig
|
|
|
16536
16251
|
}
|
|
16537
16252
|
);
|
|
16538
16253
|
};
|
|
16539
|
-
const FileComponent = React$1.lazy(() => import("./index-
|
|
16254
|
+
const FileComponent = React$1.lazy(() => import("./index-4ea49f5b.js"));
|
|
16540
16255
|
function convertFileElement(domNode) {
|
|
16541
16256
|
if (domNode instanceof HTMLDivElement) {
|
|
16542
16257
|
const dataUrl = domNode.getAttribute("data-lexical-file-src");
|
|
@@ -17019,7 +16734,7 @@ var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
|
17019
16734
|
var SELECTION_KEYS$1 = [" ", "Enter"];
|
|
17020
16735
|
var SELECT_NAME = "Select";
|
|
17021
16736
|
var [Collection$1, useCollection$1, createCollectionScope$1] = createCollection(SELECT_NAME);
|
|
17022
|
-
var [createSelectContext, createSelectScope] = createContextScope
|
|
16737
|
+
var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
|
|
17023
16738
|
createCollectionScope$1,
|
|
17024
16739
|
createPopperScope
|
|
17025
16740
|
]);
|
|
@@ -17156,7 +16871,7 @@ var SelectTrigger$1 = React$1.forwardRef(
|
|
|
17156
16871
|
}
|
|
17157
16872
|
};
|
|
17158
16873
|
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
17159
|
-
Primitive
|
|
16874
|
+
Primitive.button,
|
|
17160
16875
|
{
|
|
17161
16876
|
type: "button",
|
|
17162
16877
|
role: "combobox",
|
|
@@ -17217,7 +16932,7 @@ var SelectValue$1 = React$1.forwardRef(
|
|
|
17217
16932
|
onValueNodeHasChildrenChange(hasChildren);
|
|
17218
16933
|
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
17219
16934
|
return /* @__PURE__ */ jsx(
|
|
17220
|
-
Primitive
|
|
16935
|
+
Primitive.span,
|
|
17221
16936
|
{
|
|
17222
16937
|
...valueProps,
|
|
17223
16938
|
ref: composedRefs,
|
|
@@ -17232,7 +16947,7 @@ var ICON_NAME = "SelectIcon";
|
|
|
17232
16947
|
var SelectIcon = React$1.forwardRef(
|
|
17233
16948
|
(props, forwardedRef) => {
|
|
17234
16949
|
const { __scopeSelect, children, ...iconProps } = props;
|
|
17235
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
16950
|
+
return /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "▼" });
|
|
17236
16951
|
}
|
|
17237
16952
|
);
|
|
17238
16953
|
SelectIcon.displayName = ICON_NAME;
|
|
@@ -17263,7 +16978,7 @@ SelectContent$1.displayName = CONTENT_NAME$3;
|
|
|
17263
16978
|
var CONTENT_MARGIN = 10;
|
|
17264
16979
|
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME$3);
|
|
17265
16980
|
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
17266
|
-
var Slot$2 = /* @__PURE__ */ createSlot
|
|
16981
|
+
var Slot$2 = /* @__PURE__ */ createSlot("SelectContent.RemoveScroll");
|
|
17267
16982
|
var SelectContentImpl = React$1.forwardRef(
|
|
17268
16983
|
(props, forwardedRef) => {
|
|
17269
16984
|
const {
|
|
@@ -17652,7 +17367,7 @@ var SelectItemAlignedPosition = React$1.forwardRef((props, forwardedRef) => {
|
|
|
17652
17367
|
zIndex: contentZIndex
|
|
17653
17368
|
},
|
|
17654
17369
|
children: /* @__PURE__ */ jsx(
|
|
17655
|
-
Primitive
|
|
17370
|
+
Primitive.div,
|
|
17656
17371
|
{
|
|
17657
17372
|
...popperProps,
|
|
17658
17373
|
ref: composedRefs,
|
|
@@ -17726,7 +17441,7 @@ var SelectViewport = React$1.forwardRef(
|
|
|
17726
17441
|
}
|
|
17727
17442
|
),
|
|
17728
17443
|
/* @__PURE__ */ jsx(Collection$1.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsx(
|
|
17729
|
-
Primitive
|
|
17444
|
+
Primitive.div,
|
|
17730
17445
|
{
|
|
17731
17446
|
"data-radix-select-viewport": "",
|
|
17732
17447
|
role: "presentation",
|
|
@@ -17781,7 +17496,7 @@ var SelectGroup = React$1.forwardRef(
|
|
|
17781
17496
|
(props, forwardedRef) => {
|
|
17782
17497
|
const { __scopeSelect, ...groupProps } = props;
|
|
17783
17498
|
const groupId = useId();
|
|
17784
|
-
return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive
|
|
17499
|
+
return /* @__PURE__ */ jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsx(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
|
|
17785
17500
|
}
|
|
17786
17501
|
);
|
|
17787
17502
|
SelectGroup.displayName = GROUP_NAME$2;
|
|
@@ -17790,7 +17505,7 @@ var SelectLabel$1 = React$1.forwardRef(
|
|
|
17790
17505
|
(props, forwardedRef) => {
|
|
17791
17506
|
const { __scopeSelect, ...labelProps } = props;
|
|
17792
17507
|
const groupContext = useSelectGroupContext(LABEL_NAME$2, __scopeSelect);
|
|
17793
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
17508
|
+
return /* @__PURE__ */ jsx(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
|
|
17794
17509
|
}
|
|
17795
17510
|
);
|
|
17796
17511
|
SelectLabel$1.displayName = LABEL_NAME$2;
|
|
@@ -17849,7 +17564,7 @@ var SelectItem$1 = React$1.forwardRef(
|
|
|
17849
17564
|
disabled,
|
|
17850
17565
|
textValue,
|
|
17851
17566
|
children: /* @__PURE__ */ jsx(
|
|
17852
|
-
Primitive
|
|
17567
|
+
Primitive.div,
|
|
17853
17568
|
{
|
|
17854
17569
|
role: "option",
|
|
17855
17570
|
"aria-labelledby": textId,
|
|
@@ -17937,7 +17652,7 @@ var SelectItemText = React$1.forwardRef(
|
|
|
17937
17652
|
return () => onNativeOptionRemove(nativeOption);
|
|
17938
17653
|
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
17939
17654
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17940
|
-
/* @__PURE__ */ jsx(Primitive
|
|
17655
|
+
/* @__PURE__ */ jsx(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
|
|
17941
17656
|
itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM.createPortal(itemTextProps.children, context.valueNode) : null
|
|
17942
17657
|
] });
|
|
17943
17658
|
}
|
|
@@ -17948,7 +17663,7 @@ var SelectItemIndicator = React$1.forwardRef(
|
|
|
17948
17663
|
(props, forwardedRef) => {
|
|
17949
17664
|
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
17950
17665
|
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME$1, __scopeSelect);
|
|
17951
|
-
return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive
|
|
17666
|
+
return itemContext.isSelected ? /* @__PURE__ */ jsx(Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
17952
17667
|
}
|
|
17953
17668
|
);
|
|
17954
17669
|
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME$1;
|
|
@@ -18039,7 +17754,7 @@ var SelectScrollButtonImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
|
18039
17754
|
(_a = activeItem == null ? void 0 : activeItem.ref.current) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
18040
17755
|
}, [getItems]);
|
|
18041
17756
|
return /* @__PURE__ */ jsx(
|
|
18042
|
-
Primitive
|
|
17757
|
+
Primitive.div,
|
|
18043
17758
|
{
|
|
18044
17759
|
"aria-hidden": true,
|
|
18045
17760
|
...scrollIndicatorProps,
|
|
@@ -18067,7 +17782,7 @@ var SEPARATOR_NAME$2 = "SelectSeparator";
|
|
|
18067
17782
|
var SelectSeparator$1 = React$1.forwardRef(
|
|
18068
17783
|
(props, forwardedRef) => {
|
|
18069
17784
|
const { __scopeSelect, ...separatorProps } = props;
|
|
18070
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
17785
|
+
return /* @__PURE__ */ jsx(Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
|
|
18071
17786
|
}
|
|
18072
17787
|
);
|
|
18073
17788
|
SelectSeparator$1.displayName = SEPARATOR_NAME$2;
|
|
@@ -18105,7 +17820,7 @@ var SelectBubbleInput = React$1.forwardRef(
|
|
|
18105
17820
|
}
|
|
18106
17821
|
}, [prevValue, value]);
|
|
18107
17822
|
return /* @__PURE__ */ jsx(
|
|
18108
|
-
Primitive
|
|
17823
|
+
Primitive.select,
|
|
18109
17824
|
{
|
|
18110
17825
|
...props,
|
|
18111
17826
|
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },
|
|
@@ -19864,7 +19579,8 @@ function AIChatDialog({
|
|
|
19864
19579
|
apiKey,
|
|
19865
19580
|
initialText,
|
|
19866
19581
|
onShowInEditor,
|
|
19867
|
-
selectedTextForInline
|
|
19582
|
+
selectedTextForInline,
|
|
19583
|
+
savedSelection
|
|
19868
19584
|
}) {
|
|
19869
19585
|
const [inputValue, setInputValue] = useState$1("");
|
|
19870
19586
|
const [selectedText, setSelectedText] = useState$1("");
|
|
@@ -19958,6 +19674,7 @@ function AIChatDialog({
|
|
|
19958
19674
|
const isImageRequest = isImageGenerationRequest(inputValue);
|
|
19959
19675
|
let finalPrompt;
|
|
19960
19676
|
const hasSelectedText = selectedText && selectedText.trim() !== "";
|
|
19677
|
+
const userTextLength = inputValue.length + (hasSelectedText ? selectedText.length : 0);
|
|
19961
19678
|
if (isImageRequest) {
|
|
19962
19679
|
if (hasSelectedText) {
|
|
19963
19680
|
finalPrompt = `${inputValue}: ${selectedText}`;
|
|
@@ -19975,29 +19692,140 @@ Text to transform:
|
|
|
19975
19692
|
finalPrompt = inputValue;
|
|
19976
19693
|
}
|
|
19977
19694
|
try {
|
|
19978
|
-
|
|
19979
|
-
|
|
19980
|
-
|
|
19981
|
-
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
editor.update(() => {
|
|
19992
|
-
const nodes = $generateNodesFromDOM(editor, dom);
|
|
19993
|
-
const currentSelection = $getSelection();
|
|
19994
|
-
if (currentSelection) {
|
|
19995
|
-
$insertNodes(nodes);
|
|
19695
|
+
let isFirstChunk = true;
|
|
19696
|
+
let selectionInfo = null;
|
|
19697
|
+
if (savedSelection && $isRangeSelection(savedSelection)) {
|
|
19698
|
+
selectionInfo = {
|
|
19699
|
+
anchor: {
|
|
19700
|
+
key: savedSelection.anchor.key,
|
|
19701
|
+
offset: savedSelection.anchor.offset,
|
|
19702
|
+
type: savedSelection.anchor.type
|
|
19703
|
+
},
|
|
19704
|
+
focus: {
|
|
19705
|
+
key: savedSelection.focus.key,
|
|
19706
|
+
offset: savedSelection.focus.offset,
|
|
19707
|
+
type: savedSelection.focus.type
|
|
19996
19708
|
}
|
|
19997
|
-
}
|
|
19709
|
+
};
|
|
19998
19710
|
}
|
|
19999
|
-
|
|
20000
|
-
|
|
19711
|
+
await AiEditorActionStream({
|
|
19712
|
+
content: finalPrompt,
|
|
19713
|
+
provider,
|
|
19714
|
+
apiKey,
|
|
19715
|
+
userTextLength,
|
|
19716
|
+
onChunk: (chunk) => {
|
|
19717
|
+
editor.focus();
|
|
19718
|
+
editor.update(() => {
|
|
19719
|
+
if (isFirstChunk) {
|
|
19720
|
+
isFirstChunk = false;
|
|
19721
|
+
if (selectionInfo) {
|
|
19722
|
+
try {
|
|
19723
|
+
const newSelection = $getSelection();
|
|
19724
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
19725
|
+
newSelection.anchor.set(selectionInfo.anchor.key, selectionInfo.anchor.offset, selectionInfo.anchor.type);
|
|
19726
|
+
newSelection.focus.set(selectionInfo.focus.key, selectionInfo.focus.offset, selectionInfo.focus.type);
|
|
19727
|
+
const selText = newSelection.getTextContent();
|
|
19728
|
+
if (selText && selText.trim()) {
|
|
19729
|
+
newSelection.insertText("");
|
|
19730
|
+
}
|
|
19731
|
+
}
|
|
19732
|
+
} catch (e) {
|
|
19733
|
+
console.warn("Could not restore selection", e);
|
|
19734
|
+
const root2 = $getRoot();
|
|
19735
|
+
const lastChild = root2.getLastChild();
|
|
19736
|
+
if (lastChild) {
|
|
19737
|
+
lastChild.selectEnd();
|
|
19738
|
+
}
|
|
19739
|
+
}
|
|
19740
|
+
} else {
|
|
19741
|
+
const root2 = $getRoot();
|
|
19742
|
+
const lastChild = root2.getLastChild();
|
|
19743
|
+
if (lastChild) {
|
|
19744
|
+
lastChild.selectEnd();
|
|
19745
|
+
} else {
|
|
19746
|
+
const paragraph = $createParagraphNode();
|
|
19747
|
+
root2.append(paragraph);
|
|
19748
|
+
paragraph.select();
|
|
19749
|
+
}
|
|
19750
|
+
}
|
|
19751
|
+
}
|
|
19752
|
+
const selection = $getSelection();
|
|
19753
|
+
if (selection && $isRangeSelection(selection)) {
|
|
19754
|
+
selection.insertText(chunk);
|
|
19755
|
+
} else {
|
|
19756
|
+
const root2 = $getRoot();
|
|
19757
|
+
const lastChild = root2.getLastChild();
|
|
19758
|
+
if (lastChild) {
|
|
19759
|
+
lastChild.selectEnd();
|
|
19760
|
+
const newSelection = $getSelection();
|
|
19761
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
19762
|
+
newSelection.insertText(chunk);
|
|
19763
|
+
}
|
|
19764
|
+
}
|
|
19765
|
+
}
|
|
19766
|
+
});
|
|
19767
|
+
},
|
|
19768
|
+
onComplete: (fullContent, metadata) => {
|
|
19769
|
+
if (metadata == null ? void 0 : metadata.isImage) {
|
|
19770
|
+
const parser = new DOMParser();
|
|
19771
|
+
const dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
19772
|
+
const imgElement = dom.querySelector("img");
|
|
19773
|
+
if (imgElement && imgElement.src) {
|
|
19774
|
+
editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
|
|
19775
|
+
src: imgElement.src,
|
|
19776
|
+
altText: imgElement.alt || "AI generated image",
|
|
19777
|
+
originalPrompt: inputValue
|
|
19778
|
+
});
|
|
19779
|
+
}
|
|
19780
|
+
handleClose();
|
|
19781
|
+
setIsLoading(false);
|
|
19782
|
+
return;
|
|
19783
|
+
} else if (metadata == null ? void 0 : metadata.isChart) {
|
|
19784
|
+
let dom;
|
|
19785
|
+
try {
|
|
19786
|
+
const chartData = JSON.parse(fullContent);
|
|
19787
|
+
const parser = new DOMParser();
|
|
19788
|
+
dom = parser.parseFromString(chartData.html || fullContent, "text/html");
|
|
19789
|
+
} catch {
|
|
19790
|
+
const parser = new DOMParser();
|
|
19791
|
+
dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
19792
|
+
}
|
|
19793
|
+
editor.update(
|
|
19794
|
+
() => {
|
|
19795
|
+
const nodes = $generateNodesFromDOM(editor, dom);
|
|
19796
|
+
if (savedSelection) {
|
|
19797
|
+
$setSelection(savedSelection.clone());
|
|
19798
|
+
}
|
|
19799
|
+
const currentSelection = $getSelection();
|
|
19800
|
+
if (currentSelection) {
|
|
19801
|
+
$insertNodes(nodes);
|
|
19802
|
+
} else {
|
|
19803
|
+
const root2 = $getRoot();
|
|
19804
|
+
root2.append(...nodes);
|
|
19805
|
+
}
|
|
19806
|
+
},
|
|
19807
|
+
{
|
|
19808
|
+
onUpdate: () => {
|
|
19809
|
+
handleClose();
|
|
19810
|
+
setIsLoading(false);
|
|
19811
|
+
}
|
|
19812
|
+
}
|
|
19813
|
+
);
|
|
19814
|
+
return;
|
|
19815
|
+
} else {
|
|
19816
|
+
handleClose();
|
|
19817
|
+
setIsLoading(false);
|
|
19818
|
+
return;
|
|
19819
|
+
}
|
|
19820
|
+
},
|
|
19821
|
+
onError: (error) => {
|
|
19822
|
+
console.error("Error processing AI action:", error);
|
|
19823
|
+
const safeMessage = error.message || "Error processing your request. Please try again.";
|
|
19824
|
+
setErrorMessage(safeMessage);
|
|
19825
|
+
toast.error(safeMessage);
|
|
19826
|
+
setIsLoading(false);
|
|
19827
|
+
}
|
|
19828
|
+
});
|
|
20001
19829
|
} catch (error) {
|
|
20002
19830
|
console.error("Error processing AI action:", error);
|
|
20003
19831
|
const errorCode = (_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.code;
|
|
@@ -20268,7 +20096,16 @@ function InlineAIPrompt({
|
|
|
20268
20096
|
const [status, setStatus] = useState$1("idle");
|
|
20269
20097
|
const [showMessage, setShowMessage] = useState$1(true);
|
|
20270
20098
|
const inputRef = useRef(null);
|
|
20099
|
+
const savedSelectionRef = useRef(null);
|
|
20271
20100
|
const [selectedText, setSelectedText] = useState$1(initialSelectedText);
|
|
20101
|
+
useEffect$1(() => {
|
|
20102
|
+
editor.getEditorState().read(() => {
|
|
20103
|
+
const selection = $getSelection();
|
|
20104
|
+
if (selection) {
|
|
20105
|
+
savedSelectionRef.current = selection.clone();
|
|
20106
|
+
}
|
|
20107
|
+
});
|
|
20108
|
+
}, [editor]);
|
|
20272
20109
|
useEffect$1(() => {
|
|
20273
20110
|
const unregister = editor.registerUpdateListener(({ editorState }) => {
|
|
20274
20111
|
editorState.read(() => {
|
|
@@ -20322,6 +20159,7 @@ function InlineAIPrompt({
|
|
|
20322
20159
|
setIsLoading(true);
|
|
20323
20160
|
const isImageRequest = isImageGenerationRequest(inputValue) || selectedText && isImageGenerationRequest(selectedText);
|
|
20324
20161
|
const hasSelectedText2 = selectedText && selectedText.trim() !== "";
|
|
20162
|
+
const userTextLength = inputValue.length + (hasSelectedText2 ? selectedText.length : 0);
|
|
20325
20163
|
let finalPrompt;
|
|
20326
20164
|
if (isImageRequest) {
|
|
20327
20165
|
if (hasSelectedText2) {
|
|
@@ -20340,37 +20178,149 @@ Text to transform:
|
|
|
20340
20178
|
finalPrompt = inputValue;
|
|
20341
20179
|
}
|
|
20342
20180
|
try {
|
|
20343
|
-
|
|
20344
|
-
let
|
|
20345
|
-
if (
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
src: imgElement.src,
|
|
20357
|
-
altText: imgElement.alt || "AI generated image",
|
|
20358
|
-
originalPrompt: finalPrompt
|
|
20359
|
-
// Store the prompt for refinement
|
|
20360
|
-
});
|
|
20361
|
-
} else {
|
|
20362
|
-
editor.update(() => {
|
|
20363
|
-
const nodes = $generateNodesFromDOM(editor, dom);
|
|
20364
|
-
const currentSelection = $getSelection();
|
|
20365
|
-
if (currentSelection) {
|
|
20366
|
-
$insertNodes(nodes);
|
|
20181
|
+
let isFirstChunk = true;
|
|
20182
|
+
let selectionInfo = null;
|
|
20183
|
+
if (savedSelectionRef.current && $isRangeSelection(savedSelectionRef.current)) {
|
|
20184
|
+
selectionInfo = {
|
|
20185
|
+
anchor: {
|
|
20186
|
+
key: savedSelectionRef.current.anchor.key,
|
|
20187
|
+
offset: savedSelectionRef.current.anchor.offset,
|
|
20188
|
+
type: savedSelectionRef.current.anchor.type
|
|
20189
|
+
},
|
|
20190
|
+
focus: {
|
|
20191
|
+
key: savedSelectionRef.current.focus.key,
|
|
20192
|
+
offset: savedSelectionRef.current.focus.offset,
|
|
20193
|
+
type: savedSelectionRef.current.focus.type
|
|
20367
20194
|
}
|
|
20368
|
-
}
|
|
20195
|
+
};
|
|
20369
20196
|
}
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20197
|
+
await AiEditorActionStream({
|
|
20198
|
+
content: finalPrompt,
|
|
20199
|
+
provider,
|
|
20200
|
+
apiKey,
|
|
20201
|
+
userTextLength,
|
|
20202
|
+
onChunk: (chunk) => {
|
|
20203
|
+
editor.focus();
|
|
20204
|
+
editor.update(() => {
|
|
20205
|
+
if (isFirstChunk) {
|
|
20206
|
+
isFirstChunk = false;
|
|
20207
|
+
if (selectionInfo) {
|
|
20208
|
+
try {
|
|
20209
|
+
const newSelection = $getSelection();
|
|
20210
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
20211
|
+
newSelection.anchor.set(selectionInfo.anchor.key, selectionInfo.anchor.offset, selectionInfo.anchor.type);
|
|
20212
|
+
newSelection.focus.set(selectionInfo.focus.key, selectionInfo.focus.offset, selectionInfo.focus.type);
|
|
20213
|
+
const selText = newSelection.getTextContent();
|
|
20214
|
+
if (selText && selText.trim()) {
|
|
20215
|
+
newSelection.insertText("");
|
|
20216
|
+
}
|
|
20217
|
+
}
|
|
20218
|
+
} catch (e) {
|
|
20219
|
+
console.warn("Could not restore selection", e);
|
|
20220
|
+
const root2 = $getRoot();
|
|
20221
|
+
const lastChild = root2.getLastChild();
|
|
20222
|
+
if (lastChild) {
|
|
20223
|
+
lastChild.selectEnd();
|
|
20224
|
+
}
|
|
20225
|
+
}
|
|
20226
|
+
} else {
|
|
20227
|
+
const root2 = $getRoot();
|
|
20228
|
+
const lastChild = root2.getLastChild();
|
|
20229
|
+
if (lastChild) {
|
|
20230
|
+
lastChild.selectEnd();
|
|
20231
|
+
} else {
|
|
20232
|
+
const paragraph = $createParagraphNode();
|
|
20233
|
+
root2.append(paragraph);
|
|
20234
|
+
paragraph.select();
|
|
20235
|
+
}
|
|
20236
|
+
}
|
|
20237
|
+
}
|
|
20238
|
+
const selection = $getSelection();
|
|
20239
|
+
if (selection && $isRangeSelection(selection)) {
|
|
20240
|
+
selection.insertText(chunk);
|
|
20241
|
+
} else {
|
|
20242
|
+
const root2 = $getRoot();
|
|
20243
|
+
const lastChild = root2.getLastChild();
|
|
20244
|
+
if (lastChild) {
|
|
20245
|
+
lastChild.selectEnd();
|
|
20246
|
+
const newSelection = $getSelection();
|
|
20247
|
+
if (newSelection && $isRangeSelection(newSelection)) {
|
|
20248
|
+
newSelection.insertText(chunk);
|
|
20249
|
+
}
|
|
20250
|
+
}
|
|
20251
|
+
}
|
|
20252
|
+
});
|
|
20253
|
+
},
|
|
20254
|
+
onComplete: (fullContent, metadata) => {
|
|
20255
|
+
if (metadata == null ? void 0 : metadata.isImage) {
|
|
20256
|
+
const parser = new DOMParser();
|
|
20257
|
+
const dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
20258
|
+
const imgElement = dom.querySelector("img");
|
|
20259
|
+
if (imgElement && imgElement.src) {
|
|
20260
|
+
editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
|
|
20261
|
+
src: imgElement.src,
|
|
20262
|
+
altText: imgElement.alt || "AI generated image",
|
|
20263
|
+
originalPrompt: finalPrompt
|
|
20264
|
+
});
|
|
20265
|
+
}
|
|
20266
|
+
setInputValue("");
|
|
20267
|
+
setSelectedText("");
|
|
20268
|
+
setStatus("success");
|
|
20269
|
+
setShowMessage(true);
|
|
20270
|
+
setIsLoading(false);
|
|
20271
|
+
return;
|
|
20272
|
+
} else if (metadata == null ? void 0 : metadata.isChart) {
|
|
20273
|
+
let dom;
|
|
20274
|
+
try {
|
|
20275
|
+
const chartData = JSON.parse(fullContent);
|
|
20276
|
+
const parser = new DOMParser();
|
|
20277
|
+
dom = parser.parseFromString(chartData.html || fullContent, "text/html");
|
|
20278
|
+
} catch {
|
|
20279
|
+
const parser = new DOMParser();
|
|
20280
|
+
dom = parser.parseFromString(fullContent.trim(), "text/html");
|
|
20281
|
+
}
|
|
20282
|
+
editor.update(
|
|
20283
|
+
() => {
|
|
20284
|
+
const nodes = $generateNodesFromDOM(editor, dom);
|
|
20285
|
+
if (savedSelectionRef.current) {
|
|
20286
|
+
$setSelection(savedSelectionRef.current.clone());
|
|
20287
|
+
}
|
|
20288
|
+
const currentSelection = $getSelection();
|
|
20289
|
+
if (currentSelection) {
|
|
20290
|
+
$insertNodes(nodes);
|
|
20291
|
+
} else {
|
|
20292
|
+
const root2 = $getRoot();
|
|
20293
|
+
root2.append(...nodes);
|
|
20294
|
+
}
|
|
20295
|
+
},
|
|
20296
|
+
{
|
|
20297
|
+
onUpdate: () => {
|
|
20298
|
+
setInputValue("");
|
|
20299
|
+
setSelectedText("");
|
|
20300
|
+
setStatus("success");
|
|
20301
|
+
setShowMessage(true);
|
|
20302
|
+
setIsLoading(false);
|
|
20303
|
+
}
|
|
20304
|
+
}
|
|
20305
|
+
);
|
|
20306
|
+
return;
|
|
20307
|
+
} else {
|
|
20308
|
+
setInputValue("");
|
|
20309
|
+
setSelectedText("");
|
|
20310
|
+
setStatus("success");
|
|
20311
|
+
setShowMessage(true);
|
|
20312
|
+
setIsLoading(false);
|
|
20313
|
+
return;
|
|
20314
|
+
}
|
|
20315
|
+
},
|
|
20316
|
+
onError: (error) => {
|
|
20317
|
+
console.error("Error processing AI action:", error);
|
|
20318
|
+
toast.error(error.message || "Error processing your request. Please try again.");
|
|
20319
|
+
setStatus("error");
|
|
20320
|
+
setShowMessage(true);
|
|
20321
|
+
setIsLoading(false);
|
|
20322
|
+
}
|
|
20323
|
+
});
|
|
20374
20324
|
} catch (error) {
|
|
20375
20325
|
console.error("Error processing AI action:", error);
|
|
20376
20326
|
const errorCode = (_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.code;
|
|
@@ -20382,7 +20332,6 @@ Text to transform:
|
|
|
20382
20332
|
toast.error(safeMessage);
|
|
20383
20333
|
setStatus("error");
|
|
20384
20334
|
setShowMessage(true);
|
|
20385
|
-
} finally {
|
|
20386
20335
|
setIsLoading(false);
|
|
20387
20336
|
}
|
|
20388
20337
|
};
|
|
@@ -21332,10 +21281,10 @@ const PDF_CONFIG = {
|
|
|
21332
21281
|
};
|
|
21333
21282
|
const loadHtml2Pdf = async () => {
|
|
21334
21283
|
try {
|
|
21335
|
-
const mod = await import("./html2pdf.bundle.min-
|
|
21284
|
+
const mod = await import("./html2pdf.bundle.min-f6392183.js").then((n) => n.h);
|
|
21336
21285
|
return (mod == null ? void 0 : mod.default) || mod;
|
|
21337
21286
|
} catch {
|
|
21338
|
-
const mod2 = await import("./html2pdf.bundle-
|
|
21287
|
+
const mod2 = await import("./html2pdf.bundle-29ea2f41.js").then((n) => n.h);
|
|
21339
21288
|
return (mod2 == null ? void 0 : mod2.default) || mod2;
|
|
21340
21289
|
}
|
|
21341
21290
|
};
|
|
@@ -22087,7 +22036,7 @@ var SUB_CLOSE_KEYS = {
|
|
|
22087
22036
|
};
|
|
22088
22037
|
var MENU_NAME = "Menu";
|
|
22089
22038
|
var [Collection, useCollection, createCollectionScope] = createCollection(MENU_NAME);
|
|
22090
|
-
var [createMenuContext, createMenuScope] = createContextScope
|
|
22039
|
+
var [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [
|
|
22091
22040
|
createCollectionScope,
|
|
22092
22041
|
createPopperScope,
|
|
22093
22042
|
createRovingFocusGroupScope
|
|
@@ -22212,7 +22161,7 @@ var MenuRootContentNonModal = React$1.forwardRef((props, forwardedRef) => {
|
|
|
22212
22161
|
}
|
|
22213
22162
|
);
|
|
22214
22163
|
});
|
|
22215
|
-
var Slot$1 = /* @__PURE__ */ createSlot
|
|
22164
|
+
var Slot$1 = /* @__PURE__ */ createSlot("MenuContent.ScrollLock");
|
|
22216
22165
|
var MenuContentImpl = React$1.forwardRef(
|
|
22217
22166
|
(props, forwardedRef) => {
|
|
22218
22167
|
const {
|
|
@@ -22414,7 +22363,7 @@ var GROUP_NAME$1 = "MenuGroup";
|
|
|
22414
22363
|
var MenuGroup = React$1.forwardRef(
|
|
22415
22364
|
(props, forwardedRef) => {
|
|
22416
22365
|
const { __scopeMenu, ...groupProps } = props;
|
|
22417
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
22366
|
+
return /* @__PURE__ */ jsx(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
22418
22367
|
}
|
|
22419
22368
|
);
|
|
22420
22369
|
MenuGroup.displayName = GROUP_NAME$1;
|
|
@@ -22422,7 +22371,7 @@ var LABEL_NAME$1 = "MenuLabel";
|
|
|
22422
22371
|
var MenuLabel = React$1.forwardRef(
|
|
22423
22372
|
(props, forwardedRef) => {
|
|
22424
22373
|
const { __scopeMenu, ...labelProps } = props;
|
|
22425
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
22374
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
22426
22375
|
}
|
|
22427
22376
|
);
|
|
22428
22377
|
MenuLabel.displayName = LABEL_NAME$1;
|
|
@@ -22502,7 +22451,7 @@ var MenuItemImpl = React$1.forwardRef(
|
|
|
22502
22451
|
disabled,
|
|
22503
22452
|
textValue: textValue ?? textContent,
|
|
22504
22453
|
children: /* @__PURE__ */ jsx(Item$1, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(
|
|
22505
|
-
Primitive
|
|
22454
|
+
Primitive.div,
|
|
22506
22455
|
{
|
|
22507
22456
|
role: "menuitem",
|
|
22508
22457
|
"data-highlighted": isFocused ? "" : void 0,
|
|
@@ -22613,7 +22562,7 @@ var MenuItemIndicator = React$1.forwardRef(
|
|
|
22613
22562
|
{
|
|
22614
22563
|
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
22615
22564
|
children: /* @__PURE__ */ jsx(
|
|
22616
|
-
Primitive
|
|
22565
|
+
Primitive.span,
|
|
22617
22566
|
{
|
|
22618
22567
|
...itemIndicatorProps,
|
|
22619
22568
|
ref: forwardedRef,
|
|
@@ -22630,7 +22579,7 @@ var MenuSeparator = React$1.forwardRef(
|
|
|
22630
22579
|
(props, forwardedRef) => {
|
|
22631
22580
|
const { __scopeMenu, ...separatorProps } = props;
|
|
22632
22581
|
return /* @__PURE__ */ jsx(
|
|
22633
|
-
Primitive
|
|
22582
|
+
Primitive.div,
|
|
22634
22583
|
{
|
|
22635
22584
|
role: "separator",
|
|
22636
22585
|
"aria-orientation": "horizontal",
|
|
@@ -22890,7 +22839,7 @@ var Arrow2 = MenuArrow;
|
|
|
22890
22839
|
var SubTrigger = MenuSubTrigger;
|
|
22891
22840
|
var SubContent = MenuSubContent;
|
|
22892
22841
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
22893
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope
|
|
22842
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
|
22894
22843
|
DROPDOWN_MENU_NAME,
|
|
22895
22844
|
[createMenuScope]
|
|
22896
22845
|
);
|
|
@@ -22937,7 +22886,7 @@ var DropdownMenuTrigger$1 = React$1.forwardRef(
|
|
|
22937
22886
|
const context = useDropdownMenuContext(TRIGGER_NAME$1, __scopeDropdownMenu);
|
|
22938
22887
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
22939
22888
|
return /* @__PURE__ */ jsx(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx(
|
|
22940
|
-
Primitive
|
|
22889
|
+
Primitive.button,
|
|
22941
22890
|
{
|
|
22942
22891
|
type: "button",
|
|
22943
22892
|
id: context.triggerId,
|
|
@@ -23276,13 +23225,13 @@ const AlignMenu = () => {
|
|
|
23276
23225
|
{
|
|
23277
23226
|
variant: "ghost",
|
|
23278
23227
|
size: "sm",
|
|
23279
|
-
className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-h-7 cteditor-rounded-sm cteditor-px-2\n",
|
|
23228
|
+
className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-h-7 cteditor-rounded-sm cteditor-px-2\r\n",
|
|
23280
23229
|
children: [
|
|
23281
23230
|
/* @__PURE__ */ jsx(AlignLeftIcon, {}),
|
|
23282
23231
|
/* @__PURE__ */ jsx(
|
|
23283
23232
|
ChevronDown,
|
|
23284
23233
|
{
|
|
23285
|
-
className: "!cteditor-size-4 cteditor-opacity-50\n"
|
|
23234
|
+
className: "!cteditor-size-4 cteditor-opacity-50\r\n"
|
|
23286
23235
|
}
|
|
23287
23236
|
)
|
|
23288
23237
|
]
|
|
@@ -23785,7 +23734,7 @@ var V = "undefined" != typeof window ? useLayoutEffect$1 : useEffect$1, $ = func
|
|
|
23785
23734
|
return React__default.createElement(U, u({}, r2, { colorModel: W }));
|
|
23786
23735
|
};
|
|
23787
23736
|
var POPOVER_NAME = "Popover";
|
|
23788
|
-
var [createPopoverContext, createPopoverScope] = createContextScope
|
|
23737
|
+
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
23789
23738
|
createPopperScope
|
|
23790
23739
|
]);
|
|
23791
23740
|
var usePopperScope = createPopperScope();
|
|
@@ -23849,7 +23798,7 @@ var PopoverTrigger$1 = React$1.forwardRef(
|
|
|
23849
23798
|
const popperScope = usePopperScope(__scopePopover);
|
|
23850
23799
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
23851
23800
|
const trigger = /* @__PURE__ */ jsx(
|
|
23852
|
-
Primitive
|
|
23801
|
+
Primitive.button,
|
|
23853
23802
|
{
|
|
23854
23803
|
type: "button",
|
|
23855
23804
|
"aria-haspopup": "dialog",
|
|
@@ -23885,7 +23834,7 @@ var PopoverContent$1 = React$1.forwardRef(
|
|
|
23885
23834
|
}
|
|
23886
23835
|
);
|
|
23887
23836
|
PopoverContent$1.displayName = CONTENT_NAME;
|
|
23888
|
-
var Slot = /* @__PURE__ */ createSlot
|
|
23837
|
+
var Slot = /* @__PURE__ */ createSlot("PopoverContent.RemoveScroll");
|
|
23889
23838
|
var PopoverContentModal = React$1.forwardRef(
|
|
23890
23839
|
(props, forwardedRef) => {
|
|
23891
23840
|
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
|
|
@@ -24042,7 +23991,7 @@ var PopoverClose = React$1.forwardRef(
|
|
|
24042
23991
|
const { __scopePopover, ...closeProps } = props;
|
|
24043
23992
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
24044
23993
|
return /* @__PURE__ */ jsx(
|
|
24045
|
-
Primitive
|
|
23994
|
+
Primitive.button,
|
|
24046
23995
|
{
|
|
24047
23996
|
type: "button",
|
|
24048
23997
|
...closeProps,
|
|
@@ -24257,7 +24206,7 @@ const ColorPicker$2 = ({
|
|
|
24257
24206
|
{
|
|
24258
24207
|
onMouseDown: (e) => e.preventDefault(),
|
|
24259
24208
|
onClick: () => setShowAdvanced(!showAdvanced),
|
|
24260
|
-
className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\n",
|
|
24209
|
+
className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\r\n",
|
|
24261
24210
|
children: [
|
|
24262
24211
|
/* @__PURE__ */ jsx("span", { className: "cteditor-text-xs", children: showAdvanced ? "▼" : "▶" }),
|
|
24263
24212
|
showAdvanced ? "Hide Advanced" : "Show Advanced"
|
|
@@ -28671,12 +28620,6 @@ function normalizeCodeNodeLineBreaks(codeNode) {
|
|
|
28671
28620
|
node.remove();
|
|
28672
28621
|
}
|
|
28673
28622
|
});
|
|
28674
|
-
let lastChild = codeNode.getLastChild();
|
|
28675
|
-
while (lastChild && $isLineBreakNode(lastChild)) {
|
|
28676
|
-
const toRemove = lastChild;
|
|
28677
|
-
lastChild = toRemove.getPreviousSibling();
|
|
28678
|
-
toRemove.remove();
|
|
28679
|
-
}
|
|
28680
28623
|
}
|
|
28681
28624
|
function CodeBlockNormalizerPlugin() {
|
|
28682
28625
|
const [editor] = useLexicalComposerContext();
|
|
@@ -31604,13 +31547,14 @@ const TextEnhancePlugin = ({ apiKey }) => {
|
|
|
31604
31547
|
const enhanceDialogRef = useRef(null);
|
|
31605
31548
|
const handleTextEnhancement = async (selectedText, userPrompt) => {
|
|
31606
31549
|
try {
|
|
31550
|
+
const userTextLength = selectedText.length + userPrompt.length;
|
|
31607
31551
|
const prompt = `Enhance the following text based on this instruction: "${userPrompt}"
|
|
31608
31552
|
|
|
31609
31553
|
Original text:
|
|
31610
31554
|
"${selectedText}"
|
|
31611
31555
|
|
|
31612
31556
|
Provide only the enhanced text without any additional explanation.`;
|
|
31613
|
-
const response = await AiTextEnhance({ content: prompt, apiKey });
|
|
31557
|
+
const response = await AiTextEnhance({ content: prompt, apiKey, userTextLength });
|
|
31614
31558
|
if (!response.data) {
|
|
31615
31559
|
throw new Error("No response received from AI");
|
|
31616
31560
|
}
|
|
@@ -37261,7 +37205,7 @@ function TableActionMenu({
|
|
|
37261
37205
|
/* @__PURE__ */ jsxs(
|
|
37262
37206
|
"div",
|
|
37263
37207
|
{
|
|
37264
|
-
className: "dropdown table-drop cteditor-z-[100]\n cteditor-flex\n cteditor-flex-col\n cteditor-fixed\n cteditor-min-h-[40px]\n cteditor-min-w-[200px]\n cteditor-p-[6px]\n cteditor-overflow-y-auto\n cteditor-overflow-x-hidden \n cteditor-shadow-xl\n cteditor-rounded-lg\n cteditor-border\n cteditor-border-border\n cteditor-bg-background \n cteditor-backdrop-blur-md\n cteditor-space-y-0.5\n ",
|
|
37208
|
+
className: "dropdown table-drop cteditor-z-[100]\r\n cteditor-flex\r\n cteditor-flex-col\r\n cteditor-fixed\r\n cteditor-min-h-[40px]\r\n cteditor-min-w-[200px]\r\n cteditor-p-[6px]\r\n cteditor-overflow-y-auto\r\n cteditor-overflow-x-hidden \r\n cteditor-shadow-xl\r\n cteditor-rounded-lg\r\n cteditor-border\r\n cteditor-border-border\r\n cteditor-bg-background \r\n cteditor-backdrop-blur-md\r\n cteditor-space-y-0.5\r\n ",
|
|
37265
37209
|
ref: dropDownRef,
|
|
37266
37210
|
onClick: (e) => {
|
|
37267
37211
|
e.stopPropagation();
|
|
@@ -39674,20 +39618,14 @@ const WordCountPlugin = () => {
|
|
|
39674
39618
|
});
|
|
39675
39619
|
});
|
|
39676
39620
|
}, [editor]);
|
|
39677
|
-
return /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-bottom-1 cteditor-right-1 cteditor-flex cteditor-
|
|
39678
|
-
/* @__PURE__ */ jsxs("
|
|
39679
|
-
|
|
39680
|
-
|
|
39681
|
-
stats.words
|
|
39682
|
-
] }),
|
|
39683
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
39684
|
-
"Characters: ",
|
|
39685
|
-
stats.characters
|
|
39686
|
-
] })
|
|
39621
|
+
return /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-bottom-1 cteditor-right-1 cteditor-flex cteditor-gap-4 cteditor-text-xs cteditor-text-gray-600 cteditor-bg-white/90 cteditor-py-1.5 cteditor-px-3 cteditor-rounded cteditor-shadow-sm cteditor-z-[5] cteditor-pointer-events-none", children: [
|
|
39622
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
39623
|
+
"Words: ",
|
|
39624
|
+
stats.words
|
|
39687
39625
|
] }),
|
|
39688
|
-
/* @__PURE__ */ jsxs("span", {
|
|
39689
|
-
"
|
|
39690
|
-
|
|
39626
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
39627
|
+
"Characters: ",
|
|
39628
|
+
stats.characters
|
|
39691
39629
|
] })
|
|
39692
39630
|
] });
|
|
39693
39631
|
};
|
|
@@ -40054,9 +39992,7 @@ function applyGenericSafeStyles(container, codeBlockStyles) {
|
|
|
40054
39992
|
addStyleIfNotSetOnElementOrChildren(blockSelectors, "font-family", defaultFontFamily);
|
|
40055
39993
|
addStyleIfNotSet("table, p, li, td, th, div", "font-size", "16px");
|
|
40056
39994
|
addStyle("p", "margin: 0;");
|
|
40057
|
-
addStyle("p + p", "margin-top: 1em;");
|
|
40058
39995
|
addStyle("th p, td p", "margin: 0; padding: 0;");
|
|
40059
|
-
addStyle("th p + p, td p + p", "margin-top: 0;");
|
|
40060
39996
|
addStyle(
|
|
40061
39997
|
"table",
|
|
40062
39998
|
"border-collapse: collapse; width: 100%; max-width: 100%; margin: 20px 0;"
|
|
@@ -40139,10 +40075,6 @@ function applyGenericSafeStyles(container, codeBlockStyles) {
|
|
|
40139
40075
|
function applyCodeSyntaxHighlighting(container, codeBlockStyles) {
|
|
40140
40076
|
const codeBlocks = container.querySelectorAll('code, pre[data-language], pre[data-highlight-language], pre[spellcheck="false"]');
|
|
40141
40077
|
codeBlocks.forEach((codeBlock) => {
|
|
40142
|
-
const htmlCodeBlock = codeBlock;
|
|
40143
|
-
if (htmlCodeBlock.classList.contains("PlaygroundEditorTheme__textCode") || htmlCodeBlock.classList.contains("bg-foreground/15") || htmlCodeBlock.querySelector(".PlaygroundEditorTheme__textCode") || htmlCodeBlock.querySelector('[class*="textCode"]')) {
|
|
40144
|
-
return;
|
|
40145
|
-
}
|
|
40146
40078
|
const spans = codeBlock.querySelectorAll("span");
|
|
40147
40079
|
spans.forEach((span) => {
|
|
40148
40080
|
const htmlSpan = span;
|
|
@@ -40163,9 +40095,6 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40163
40095
|
const codeBlocks = container.querySelectorAll('code, pre[data-language], pre[data-highlight-language], pre[spellcheck="false"]');
|
|
40164
40096
|
codeBlocks.forEach((codeBlock) => {
|
|
40165
40097
|
const htmlCodeBlock = codeBlock;
|
|
40166
|
-
if (htmlCodeBlock.classList.contains("PlaygroundEditorTheme__textCode") || htmlCodeBlock.classList.contains("bg-foreground/15") || htmlCodeBlock.querySelector(".PlaygroundEditorTheme__textCode") || htmlCodeBlock.querySelector('[class*="textCode"]')) {
|
|
40167
|
-
return;
|
|
40168
|
-
}
|
|
40169
40098
|
const brElements = Array.from(htmlCodeBlock.querySelectorAll("br"));
|
|
40170
40099
|
const toRemove = [];
|
|
40171
40100
|
for (let i2 = 0; i2 < brElements.length - 1; i2++) {
|
|
@@ -40177,12 +40106,6 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40177
40106
|
}
|
|
40178
40107
|
}
|
|
40179
40108
|
toRemove.forEach((br) => br.remove());
|
|
40180
|
-
let lastChild = htmlCodeBlock.lastChild;
|
|
40181
|
-
while (lastChild && lastChild.nodeName === "BR") {
|
|
40182
|
-
const toRemove2 = lastChild;
|
|
40183
|
-
lastChild = lastChild.previousSibling;
|
|
40184
|
-
toRemove2.remove();
|
|
40185
|
-
}
|
|
40186
40109
|
const brCount = htmlCodeBlock.querySelectorAll("br").length;
|
|
40187
40110
|
const lineCount = brCount + 1;
|
|
40188
40111
|
const lineNumbers = [];
|
|
@@ -40191,7 +40114,7 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40191
40114
|
}
|
|
40192
40115
|
const lineNumbersStr = lineNumbers.join("\n");
|
|
40193
40116
|
const maxDigits = lineCount.toString().length;
|
|
40194
|
-
const gutterWidth = Math.max(
|
|
40117
|
+
const gutterWidth = Math.max(40, 20 + maxDigits * 10);
|
|
40195
40118
|
const gutter = container.ownerDocument.createElement("div");
|
|
40196
40119
|
gutter.className = "code-line-numbers";
|
|
40197
40120
|
gutter.textContent = lineNumbersStr;
|
|
@@ -40205,7 +40128,7 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40205
40128
|
"vertical-align: top",
|
|
40206
40129
|
`width: ${gutterWidth}px`,
|
|
40207
40130
|
`min-width: ${gutterWidth}px`,
|
|
40208
|
-
"padding: 8px",
|
|
40131
|
+
"padding: 10px 8px",
|
|
40209
40132
|
`background-color: ${gutterBg}`,
|
|
40210
40133
|
`color: ${gutterColor}`,
|
|
40211
40134
|
"text-align: right",
|
|
@@ -40213,8 +40136,8 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40213
40136
|
`font-size: ${fontSize}`,
|
|
40214
40137
|
`line-height: ${lineHeight}`,
|
|
40215
40138
|
"border-right: 1px solid #404040",
|
|
40216
|
-
"border-top-left-radius:
|
|
40217
|
-
"border-bottom-left-radius:
|
|
40139
|
+
"border-top-left-radius: 5px",
|
|
40140
|
+
"border-bottom-left-radius: 5px",
|
|
40218
40141
|
"user-select: none",
|
|
40219
40142
|
"white-space: pre",
|
|
40220
40143
|
"box-sizing: border-box"
|
|
@@ -40224,7 +40147,7 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40224
40147
|
codeContent.style.cssText = [
|
|
40225
40148
|
"display: table-cell",
|
|
40226
40149
|
"vertical-align: top",
|
|
40227
|
-
"padding:
|
|
40150
|
+
"padding: 10px 10px 10px 12px",
|
|
40228
40151
|
`font-family: ${fontFamily}`,
|
|
40229
40152
|
`font-size: ${fontSize}`,
|
|
40230
40153
|
`line-height: ${lineHeight}`,
|
|
@@ -40243,9 +40166,8 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40243
40166
|
"width: 100%",
|
|
40244
40167
|
`background-color: ${codeBlockBg}`,
|
|
40245
40168
|
`color: ${codeBlockText}`,
|
|
40246
|
-
"border-radius:
|
|
40247
|
-
"
|
|
40248
|
-
"margin: 8px 0",
|
|
40169
|
+
"border-radius: 5px",
|
|
40170
|
+
"margin: 1em 0",
|
|
40249
40171
|
"overflow: hidden"
|
|
40250
40172
|
].join("; ");
|
|
40251
40173
|
htmlCodeBlock.appendChild(gutter);
|
|
@@ -40432,29 +40354,18 @@ function preprocessInitialContent(html) {
|
|
|
40432
40354
|
let body = doc.body;
|
|
40433
40355
|
if (body.children.length === 1) {
|
|
40434
40356
|
const firstChild = body.children[0];
|
|
40435
|
-
if (firstChild.tagName === "DIV" &&
|
|
40436
|
-
(firstChild.style.backgroundColor && firstChild.style.color && firstChild.style.padding || // Editor content wrapper class
|
|
40437
|
-
firstChild.classList.contains("editor-content-wrapper"))) {
|
|
40357
|
+
if (firstChild.tagName === "DIV" && firstChild.style.backgroundColor && firstChild.style.color && firstChild.style.padding) {
|
|
40438
40358
|
const innerHtml = firstChild.innerHTML;
|
|
40439
40359
|
doc = parser.parseFromString(innerHtml, "text/html");
|
|
40440
40360
|
body = doc.body;
|
|
40441
40361
|
}
|
|
40442
40362
|
}
|
|
40443
|
-
const
|
|
40444
|
-
|
|
40445
|
-
|
|
40446
|
-
|
|
40447
|
-
|
|
40448
|
-
|
|
40449
|
-
if (span.textContent && span.textContent.trim() === "" && span.textContent.length > 0) {
|
|
40450
|
-
const prev = span.previousElementSibling;
|
|
40451
|
-
const next = span.nextElementSibling;
|
|
40452
|
-
if (prev && next && blockTags.includes(prev.tagName) && blockTags.includes(next.tagName)) {
|
|
40453
|
-
const spacerParagraph = doc.createElement("p");
|
|
40454
|
-
spacerParagraph.className = "PlaygroundEditorTheme__paragraph";
|
|
40455
|
-
spacerParagraph.innerHTML = "<br>";
|
|
40456
|
-
(_a = span.parentNode) == null ? void 0 : _a.replaceChild(spacerParagraph, span);
|
|
40457
|
-
}
|
|
40363
|
+
const emptyParagraphs = body.querySelectorAll("p");
|
|
40364
|
+
emptyParagraphs.forEach((p2) => {
|
|
40365
|
+
var _a, _b;
|
|
40366
|
+
const hasOnlyBrOrWhitespace = !((_a = p2.textContent) == null ? void 0 : _a.trim()) && (p2.innerHTML.trim() === "" || p2.innerHTML.trim() === "<br>" || p2.querySelector("br") !== null && !((_b = p2.textContent) == null ? void 0 : _b.trim()));
|
|
40367
|
+
if (hasOnlyBrOrWhitespace) {
|
|
40368
|
+
p2.remove();
|
|
40458
40369
|
}
|
|
40459
40370
|
});
|
|
40460
40371
|
const tables = doc.querySelectorAll("table");
|
|
@@ -41509,4 +41420,4 @@ export {
|
|
|
41509
41420
|
ContentPreview as y,
|
|
41510
41421
|
isReactNativeWebView as z
|
|
41511
41422
|
};
|
|
41512
|
-
//# sourceMappingURL=index-
|
|
41423
|
+
//# sourceMappingURL=index-636eff7f.js.map
|