@docyrus/ui-pro-ai-assistant 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ interface SubmitOptions {
9
9
  supportDocumentSearch?: boolean;
10
10
  supportThinking?: boolean;
11
11
  supportWorkCanvas?: boolean;
12
+ reasoningEffort?: string;
12
13
  files?: {
13
14
  url: string;
14
15
  mediaType: string;
package/dist/index.js CHANGED
@@ -211,7 +211,7 @@ import '@univerjs/sheets-crosshair-highlight/lib/index.css';
211
211
  import * as XLSX from 'xlsx';
212
212
  import { MarkdownPlugin, remarkMdx, remarkMention, serializeMd, stripMarkdown, deserializeMd } from '@platejs/markdown';
213
213
  import { usePlateEditor, toTPlatePlugin, useEditorContainerRef, createPlatePlugin, usePluginOption, ParagraphPlugin, BlockPlaceholderPlugin, useEditorRef, useElement, Key, createPrimitiveComponent, withHOC, PlateElement, useReadOnly, useEditorPlugin, useEditorMounted, Plate, PlateContent, PlateLeaf, useHotkeys, PlateText, useSelected, useFocused, useEventEditorValue, useComposedRef, useEditorReadOnly, useSelectionAcrossBlocks, useEditorSelector, useElementSelector, MemoizedChildren, useSelectionFragmentProp, useMarkToolbarButtonState, useMarkToolbarButton, PlateContainer, usePlateState } from 'platejs/react';
214
- import { KEYS, TrailingBlockPlugin, isSlateString, isSlateEditor, isSlateElement, getPluginType, PathApi, isHotkey, getPluginTypes, ExitBreakPlugin, nanoid, BaseParagraphPlugin, NodeApi, TextApi, isType, IS_APPLE, RangeApi, getPluginByType, ElementApi, createSlateEditor, isUrl } from 'platejs';
214
+ import { KEYS, TrailingBlockPlugin, isSlateString, isSlateEditor, isSlateElement, getPluginType, PathApi, createSlatePlugin, isHotkey, getPluginTypes, ExitBreakPlugin, nanoid, BaseParagraphPlugin, NodeApi, TextApi, createTextSubstitutionInputRule, isType, IS_APPLE, RangeApi, getPluginByType, ElementApi, createSlateEditor, isUrl } from 'platejs';
215
215
  import { withAIBatch } from '@platejs/ai';
216
216
  import { useAIChatEditor, AIChatPlugin, useChatChunk, streamInsertChunk, applyAISuggestions, rejectAISuggestions, AIPlugin, CopilotPlugin, useLastAssistantMessage, useEditorChat, applyTableCellSuggestion, aiCommentToRange } from '@platejs/ai/react';
217
217
  import { CursorOverlayPlugin, BlockSelectionPlugin, BlockMenuPlugin, useBlockSelected, useCursorOverlay, useIsSelecting, BLOCK_CONTEXT_MENU_ID, useBlockSelectionNodes, useBlockSelectionFragmentProp } from '@platejs/selection/react';
@@ -225,13 +225,11 @@ import { CaptionPlugin, TextareaAutosize as TextareaAutosize$1, Caption as Capti
225
225
  import { BaseCommentPlugin, getDraftCommentKey, getCommentCount, getTransientCommentKey, getCommentKey } from '@platejs/comment';
226
226
  import { CommentPlugin, useCommentId } from '@platejs/comment/react';
227
227
  import { SuggestionPlugin } from '@platejs/suggestion/react';
228
+ import { BoldRules, MarkComboRules, ItalicRules, UnderlineRules, CodeRules, StrikethroughRules, SubscriptRules, SuperscriptRules, HighlightRules, HeadingRules, BlockquoteRules, HorizontalRuleRules, BaseH1Plugin, BaseH2Plugin, BaseH3Plugin, BaseBlockquotePlugin, BaseHorizontalRulePlugin, BaseBoldPlugin, BaseItalicPlugin, BaseUnderlinePlugin, BaseStrikethroughPlugin, BaseSubscriptPlugin, BaseSuperscriptPlugin, BaseCodePlugin, BaseHighlightPlugin } from '@platejs/basic-nodes';
228
229
  import { BoldPlugin, ItalicPlugin, UnderlinePlugin, CodePlugin, StrikethroughPlugin, SubscriptPlugin, SuperscriptPlugin, HighlightPlugin, H1Plugin, H2Plugin, H3Plugin, BlockquotePlugin, HorizontalRulePlugin } from '@platejs/basic-nodes/react';
229
- import { AutoformatPlugin, autoformatSmartQuotes, autoformatPunctuation, autoformatLegal, autoformatLegalHtml, autoformatArrow, autoformatMath } from '@platejs/autoformat';
230
- import { insertEmptyCodeBlock, insertCodeBlock, BaseCodeBlockPlugin, BaseCodeLinePlugin, BaseCodeSyntaxPlugin } from '@platejs/code-block';
231
- import { expandListItemsWithChildren, BaseListPlugin, toggleList, isOrderedList, someList, ListStyleType } from '@platejs/list';
232
- import { openNextToggles, TogglePlugin, useToggleButtonState, useToggleButton, useToggleToolbarButtonState, useToggleToolbarButton } from '@platejs/toggle/react';
233
230
  import { DndPlugin, useDropLine, useDraggable } from '@platejs/dnd';
234
231
  import { insertCallout, BaseCalloutPlugin } from '@platejs/callout';
232
+ import { insertCodeBlock, CodeBlockRules, BaseCodeBlockPlugin, BaseCodeLinePlugin, BaseCodeSyntaxPlugin } from '@platejs/code-block';
235
233
  import { insertDate, BaseDatePlugin } from '@platejs/date';
236
234
  import { BaseColumnPlugin, BaseColumnItemPlugin, insertColumnGroup, toggleColumnGroup } from '@platejs/layout';
237
235
  import { insertEquation, insertInlineEquation, BaseInlineEquationPlugin, BaseEquationPlugin, getEquationHtml } from '@platejs/math';
@@ -250,6 +248,7 @@ import { DatePlugin } from '@platejs/date/react';
250
248
  import { PlaceholderPlugin, useMediaState, useImage, PlaceholderProvider, usePlaceholderElementState, usePlaceholderPopoverState, ImagePlugin, MediaEmbedPlugin, VideoPlugin, AudioPlugin, FilePlugin, useImagePreviewValue, useImagePreview, PreviewImage as PreviewImage$1, useMediaControllerState, useMediaController, openImagePreview, UploadErrorCode, useScaleInput, useMediaControllerDropDownMenu } from '@platejs/media/react';
251
249
  import { DndProvider } from 'react-dnd';
252
250
  import { HTML5Backend } from 'react-dnd-html5-backend';
251
+ import { expandListItemsWithChildren, isOrderedList, BulletedListRules, OrderedListRules, TaskListRules, BaseListPlugin, someList, ListStyleType, toggleList } from '@platejs/list';
253
252
  import { DocxPlugin } from '@platejs/docx';
254
253
  import { JuicePlugin } from '@platejs/juice';
255
254
  import emojiMartData from '@emoji-mart/data';
@@ -267,11 +266,11 @@ import LiteYouTubeEmbed from 'react-lite-youtube-embed';
267
266
  import ReactPlayer from 'react-player';
268
267
  import { MentionPlugin, MentionInputPlugin } from '@platejs/mention/react';
269
268
  import { SlashPlugin, SlashInputPlugin } from '@platejs/slash-command/react';
270
- import { TableProvider, TablePlugin, useTableElement, TableRowPlugin, TableCellPlugin, TableCellHeaderPlugin, useTableCellElement, useTableCellElementResizable, useTableMergeState } from '@platejs/table/react';
269
+ import { TableProvider, TablePlugin, useTableElement, useTableSelectionDom, TableRowPlugin, TableCellPlugin, TableCellHeaderPlugin, useTableCellElement, useTableCellElementResizable, useTableMergeState } from '@platejs/table/react';
271
270
  import { TocPlugin, useTocElementState, useTocElement } from '@platejs/toc/react';
271
+ import { TogglePlugin, useToggleButtonState, useToggleButton, useToggleToolbarButtonState, useToggleToolbarButton } from '@platejs/toggle/react';
272
272
  import { DocxExportPlugin, importDocx, exportToDocx } from '@platejs/docx-io';
273
273
  import { SlateElement, SlateLeaf, serializeHtml, PlateStatic, getEditorDOMFromHtmlString } from 'platejs/static';
274
- import { BaseH1Plugin, BaseH2Plugin, BaseH3Plugin, BaseBlockquotePlugin, BaseHorizontalRulePlugin, BaseBoldPlugin, BaseItalicPlugin, BaseUnderlinePlugin, BaseStrikethroughPlugin, BaseSubscriptPlugin, BaseSuperscriptPlugin, BaseCodePlugin, BaseHighlightPlugin } from '@platejs/basic-nodes';
275
274
  import { BaseFontColorPlugin, BaseFontBackgroundColorPlugin, BaseFontSizePlugin, BaseFontFamilyPlugin, toUnitLess } from '@platejs/basic-styles';
276
275
  import { BaseIndentPlugin } from '@platejs/indent';
277
276
  import { BaseCaptionPlugin } from '@platejs/caption';
@@ -2797,12 +2796,14 @@ function AgentConsentDialog({
2797
2796
  onDeclined();
2798
2797
  };
2799
2798
  const scoped = !!container;
2800
- return /* @__PURE__ */ jsx(Dialog.Root, { open: !!pending, children: /* @__PURE__ */ jsxs(Dialog.Portal, { container: container ?? void 0, children: [
2799
+ return /* @__PURE__ */ jsx(Dialog.Root, { open: !!pending, modal: false, children: /* @__PURE__ */ jsxs(Dialog.Portal, { container: container ?? void 0, children: [
2801
2800
  /* @__PURE__ */ jsx(
2802
- Dialog.Overlay,
2801
+ "div",
2803
2802
  {
2803
+ "aria-hidden": true,
2804
+ onPointerDown: (e) => e.preventDefault(),
2804
2805
  className: cn(
2805
- "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs isolate z-[200] inset-0",
2806
+ "bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs isolate z-[200] inset-0",
2806
2807
  scoped ? "absolute" : "fixed"
2807
2808
  )
2808
2809
  }
@@ -6001,6 +6002,11 @@ var AIInputArea = ({
6001
6002
  const [thinkingActive, setThinkingActive] = useState(initialFeatures?.thinking ?? false);
6002
6003
  const [deepResearchActive, setDeepResearchActive] = useState(initialFeatures?.deepResearch ?? false);
6003
6004
  const [workCanvasActive, setWorkCanvasActive] = useState(initialFeatures?.workCanvas ?? false);
6005
+ const [reasoningOverride, setReasoningOverride] = useState(null);
6006
+ const reasoningLevels = effectiveSupportThinking || selectedModel?.supportThinking ? selectedModel?.reasoningLevels ?? [] : [];
6007
+ const activeOverrideId = reasoningOverride && reasoningOverride.modelId === selectedModel?.id ? reasoningOverride.id : null;
6008
+ const overrideLevel = activeOverrideId ? reasoningLevels.find((level) => level.id === activeOverrideId) : void 0;
6009
+ const selectedReasoningLevel = reasoningLevels.length === 0 ? null : overrideLevel ?? reasoningLevels.find((level) => level.default) ?? reasoningLevels[0];
6004
6010
  const initialModelAppliedRef = useRef(false);
6005
6011
  useEffect(() => {
6006
6012
  if (initialModelId && models.length > 0 && !initialModelAppliedRef.current) {
@@ -6172,6 +6178,7 @@ var AIInputArea = ({
6172
6178
  supportDocumentSearch: effectiveSupportDocumentSearch && documentSearchActive,
6173
6179
  supportThinking: effectiveSupportThinking && thinkingActive,
6174
6180
  supportWorkCanvas: effectiveSupportWorkCanvas && workCanvasActive,
6181
+ reasoningEffort: selectedReasoningLevel?.id,
6175
6182
  files: message.files?.length > 0 ? message.files : void 0,
6176
6183
  mcpServerIds: activeMcpServerIds.length > 0 ? activeMcpServerIds : void 0
6177
6184
  };
@@ -6192,6 +6199,7 @@ var AIInputArea = ({
6192
6199
  thinkingActive,
6193
6200
  effectiveSupportWorkCanvas,
6194
6201
  workCanvasActive,
6202
+ selectedReasoningLevel?.id,
6195
6203
  activeMcpServers
6196
6204
  ]);
6197
6205
  const status = isLoading ? "streaming" : "ready";
@@ -6489,6 +6497,28 @@ var AIInputArea = ({
6489
6497
  thinkingActive ? ` (${t("common.active")})` : ""
6490
6498
  ] })
6491
6499
  ] }),
6500
+ reasoningLevels.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu$1, { children: [
6501
+ /* @__PURE__ */ jsxs(Tooltip$2, { children: [
6502
+ /* @__PURE__ */ jsx(TooltipTrigger$1, { asChild: true, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(PromptInputButton, { variant: "ghost", className: "gap-1", children: [
6503
+ /* @__PURE__ */ jsx(Brain, { className: "w-4 h-4" }),
6504
+ selectedReasoningLevel && /* @__PURE__ */ jsx("span", { className: "max-w-20 truncate text-xs font-medium", children: selectedReasoningLevel.name }),
6505
+ /* @__PURE__ */ jsx(ChevronDown, { className: "w-3 h-3 opacity-60" })
6506
+ ] }) }) }),
6507
+ /* @__PURE__ */ jsx(TooltipContent$1, { side: "top", children: t("common.reasoning") })
6508
+ ] }),
6509
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", className: "min-w-[12rem] z-[10000]", children: reasoningLevels.map((level) => /* @__PURE__ */ jsxs(
6510
+ DropdownMenuItem,
6511
+ {
6512
+ onClick: () => setReasoningOverride({ modelId: selectedModel?.id ?? "", id: level.id }),
6513
+ className: cn(selectedReasoningLevel?.id === level.id && "bg-accent"),
6514
+ children: [
6515
+ /* @__PURE__ */ jsx(Brain, { className: "w-4 h-4" }),
6516
+ level.name
6517
+ ]
6518
+ },
6519
+ level.id
6520
+ )) })
6521
+ ] }),
6492
6522
  effectiveSupportDeepResearch && /* @__PURE__ */ jsxs(Tooltip$2, { children: [
6493
6523
  /* @__PURE__ */ jsx(TooltipTrigger$1, { asChild: true, children: /* @__PURE__ */ jsx(
6494
6524
  PromptInputButton,
@@ -24026,23 +24056,41 @@ function HighlightLeaf(props) {
24026
24056
 
24027
24057
  // src/internal/plate-editor/editor/plugins/basic-marks-kit.tsx
24028
24058
  var BasicMarksKit = [
24029
- BoldPlugin,
24030
- ItalicPlugin,
24031
- UnderlinePlugin,
24059
+ BoldPlugin.configure({
24060
+ inputRules: [
24061
+ BoldRules.markdown({ variant: "*" }),
24062
+ BoldRules.markdown({ variant: "_" }),
24063
+ MarkComboRules.markdown({ variant: "boldItalic" }),
24064
+ MarkComboRules.markdown({ variant: "boldUnderline" }),
24065
+ MarkComboRules.markdown({ variant: "boldItalicUnderline" }),
24066
+ MarkComboRules.markdown({ variant: "italicUnderline" })
24067
+ ]
24068
+ }),
24069
+ ItalicPlugin.configure({
24070
+ inputRules: [ItalicRules.markdown({ variant: "*" }), ItalicRules.markdown({ variant: "_" })]
24071
+ }),
24072
+ UnderlinePlugin.configure({
24073
+ inputRules: [UnderlineRules.markdown()]
24074
+ }),
24032
24075
  CodePlugin.configure({
24076
+ inputRules: [CodeRules.markdown()],
24033
24077
  node: { component: CodeLeaf },
24034
24078
  shortcuts: { toggle: { keys: "mod+e" } }
24035
24079
  }),
24036
24080
  StrikethroughPlugin.configure({
24081
+ inputRules: [StrikethroughRules.markdown()],
24037
24082
  shortcuts: { toggle: { keys: "mod+shift+x" } }
24038
24083
  }),
24039
24084
  SubscriptPlugin.configure({
24085
+ inputRules: [SubscriptRules.markdown()],
24040
24086
  shortcuts: { toggle: { keys: "mod+comma" } }
24041
24087
  }),
24042
24088
  SuperscriptPlugin.configure({
24089
+ inputRules: [SuperscriptRules.markdown()],
24043
24090
  shortcuts: { toggle: { keys: "mod+period" } }
24044
24091
  }),
24045
24092
  HighlightPlugin.configure({
24093
+ inputRules: [HighlightRules.markdown({ variant: "==" }), HighlightRules.markdown({ variant: "\u2261" })],
24046
24094
  node: { component: HighlightLeaf },
24047
24095
  shortcuts: { toggle: { keys: "mod+shift+h" } }
24048
24096
  })
@@ -25576,196 +25624,139 @@ var insertAIAnchorElement = (editor) => {
25576
25624
  });
25577
25625
  editor.setOption(AIChatPlugin, "streaming", true);
25578
25626
  };
25579
- var autoformatMarks = [
25580
- {
25581
- match: "***",
25582
- mode: "mark",
25583
- type: [KEYS.bold, KEYS.italic]
25584
- },
25585
- {
25586
- match: "__*",
25587
- mode: "mark",
25588
- type: [KEYS.underline, KEYS.italic]
25589
- },
25590
- {
25591
- match: "__**",
25592
- mode: "mark",
25593
- type: [KEYS.underline, KEYS.bold]
25594
- },
25595
- {
25596
- match: "___***",
25597
- mode: "mark",
25598
- type: [KEYS.underline, KEYS.bold, KEYS.italic]
25599
- },
25600
- {
25601
- match: "**",
25602
- mode: "mark",
25603
- type: KEYS.bold
25604
- },
25605
- {
25606
- match: "__",
25607
- mode: "mark",
25608
- type: KEYS.underline
25609
- },
25610
- {
25611
- match: "*",
25612
- mode: "mark",
25613
- type: KEYS.italic
25614
- },
25615
- {
25616
- match: "_",
25617
- mode: "mark",
25618
- type: KEYS.italic
25619
- },
25620
- {
25621
- match: "~~",
25622
- mode: "mark",
25623
- type: KEYS.strikethrough
25624
- },
25625
- {
25626
- match: "^",
25627
- mode: "mark",
25628
- type: KEYS.sup
25629
- },
25630
- {
25631
- match: "~",
25632
- mode: "mark",
25633
- type: KEYS.sub
25634
- },
25635
- {
25636
- match: "`",
25637
- mode: "mark",
25638
- type: KEYS.code
25639
- }
25640
- ];
25641
- var autoformatBlocks = [
25642
- {
25643
- match: "# ",
25644
- mode: "block",
25645
- type: KEYS.h1
25646
- },
25647
- {
25648
- match: "## ",
25649
- mode: "block",
25650
- type: KEYS.h2
25651
- },
25652
- {
25653
- match: "### ",
25654
- mode: "block",
25655
- type: KEYS.h3
25656
- },
25657
- {
25658
- match: "> ",
25659
- mode: "block",
25660
- type: KEYS.blockquote
25661
- },
25662
- {
25663
- match: "```",
25664
- mode: "block",
25665
- type: KEYS.codeBlock,
25666
- format: (editor) => {
25667
- insertEmptyCodeBlock(editor, {
25668
- defaultType: KEYS.p,
25669
- insertNodesOptions: { select: true }
25670
- });
25671
- }
25672
- },
25673
- {
25674
- match: "+ ",
25675
- mode: "block",
25676
- preFormat: openNextToggles,
25677
- type: KEYS.toggle
25678
- },
25679
- {
25680
- match: ["---", "\u2014-", "___ "],
25681
- mode: "block",
25682
- type: KEYS.hr,
25683
- format: (editor) => {
25684
- editor.tf.setNodes({ type: KEYS.hr });
25685
- editor.tf.insertNodes({
25686
- children: [{ text: "" }],
25687
- type: KEYS.p
25688
- });
25689
- }
25690
- }
25691
- ];
25692
- var autoformatLists = [
25693
- {
25694
- match: ["* ", "- "],
25695
- mode: "block",
25696
- type: "list",
25697
- format: (editor) => {
25698
- toggleList(editor, {
25699
- listStyleType: KEYS.ul
25700
- });
25701
- }
25702
- },
25703
- {
25704
- match: [String.raw`^\d+\.$ `, String.raw`^\d+\)$ `],
25705
- matchByRegex: true,
25706
- mode: "block",
25707
- type: "list",
25708
- format: (editor, { matchString }) => {
25709
- toggleList(editor, {
25710
- listRestartPolite: Number(matchString) || 1,
25711
- listStyleType: KEYS.ol
25712
- });
25713
- }
25714
- },
25715
- {
25716
- match: ["[] "],
25717
- mode: "block",
25718
- type: "list",
25719
- format: (editor) => {
25720
- toggleList(editor, {
25721
- listStyleType: KEYS.listTodo
25722
- });
25723
- editor.tf.setNodes({
25724
- checked: false,
25725
- listStyleType: KEYS.listTodo
25726
- });
25727
- }
25728
- },
25729
- {
25730
- match: ["[x] "],
25731
- mode: "block",
25732
- type: "list",
25733
- format: (editor) => {
25734
- toggleList(editor, {
25735
- listStyleType: KEYS.listTodo
25736
- });
25737
- editor.tf.setNodes({
25738
- checked: true,
25739
- listStyleType: KEYS.listTodo
25740
- });
25741
- }
25627
+ var isTextSubstitutionBlocked = (editor) => editor.api.some({
25628
+ match: {
25629
+ type: [editor.getType(KEYS.codeBlock)]
25742
25630
  }
25743
- ];
25744
- var AutoformatKit = [
25745
- AutoformatPlugin.configure({
25746
- options: {
25747
- enableUndoOnDelete: true,
25748
- rules: [
25749
- ...autoformatBlocks,
25750
- ...autoformatMarks,
25751
- ...autoformatSmartQuotes,
25752
- ...autoformatPunctuation,
25753
- ...autoformatLegal,
25754
- ...autoformatLegalHtml,
25755
- ...autoformatArrow,
25756
- ...autoformatMath,
25757
- ...autoformatLists
25758
- ].map(
25759
- (rule) => ({
25760
- ...rule,
25761
- query: (editor) => !editor.api.some({
25762
- match: { type: editor.getType(KEYS.codeBlock) }
25763
- })
25764
- })
25765
- )
25766
- }
25767
- })
25768
- ];
25631
+ });
25632
+ var createAutoformatTextSubstitutionRule = ({
25633
+ patterns
25634
+ }) => createTextSubstitutionInputRule({
25635
+ enabled: ({ editor }) => !isTextSubstitutionBlocked(editor),
25636
+ patterns
25637
+ });
25638
+ var arrowsRule = createAutoformatTextSubstitutionRule({
25639
+ patterns: [
25640
+ { format: "\u2192", match: "->" },
25641
+ { format: "\u2190", match: "<-" },
25642
+ { format: "\u21D2", match: "=>" },
25643
+ { format: "\u21D0", match: ["<=", "\u2264="] }
25644
+ ]
25645
+ });
25646
+ var comparisonsRule = createAutoformatTextSubstitutionRule({
25647
+ patterns: [
25648
+ { format: "\u226F", match: "!>" },
25649
+ { format: "\u226E", match: "!<" },
25650
+ { format: "\u2265", match: ">=" },
25651
+ { format: "\u2264", match: "<=" },
25652
+ { format: "\u2271", match: "!>=" },
25653
+ { format: "\u2270", match: "!<=" }
25654
+ ]
25655
+ });
25656
+ var equalityRule = createAutoformatTextSubstitutionRule({
25657
+ patterns: [
25658
+ { format: "\u2260", match: "!=" },
25659
+ { format: "\u2261", match: "==" },
25660
+ { format: "\u2262", match: ["!==", "\u2260="] },
25661
+ { format: "\u2248", match: "~=" },
25662
+ { format: "\u2249", match: "!~=" }
25663
+ ]
25664
+ });
25665
+ var fractionsRule = createAutoformatTextSubstitutionRule({
25666
+ patterns: [
25667
+ { format: "\xBD", match: "1/2" },
25668
+ { format: "\u2153", match: "1/3" },
25669
+ { format: "\xBC", match: "1/4" },
25670
+ { format: "\u2155", match: "1/5" },
25671
+ { format: "\u2159", match: "1/6" },
25672
+ { format: "\u2150", match: "1/7" },
25673
+ { format: "\u215B", match: "1/8" },
25674
+ { format: "\u2151", match: "1/9" },
25675
+ { format: "\u2152", match: "1/10" },
25676
+ { format: "\u2154", match: "2/3" },
25677
+ { format: "\u2156", match: "2/5" },
25678
+ { format: "\xBE", match: "3/4" },
25679
+ { format: "\u2157", match: "3/5" },
25680
+ { format: "\u215C", match: "3/8" },
25681
+ { format: "\u2158", match: "4/5" },
25682
+ { format: "\u215A", match: "5/6" },
25683
+ { format: "\u215D", match: "5/8" },
25684
+ { format: "\u215E", match: "7/8" }
25685
+ ]
25686
+ });
25687
+ var legalRule = createAutoformatTextSubstitutionRule({
25688
+ patterns: [{ format: "\u2122", match: ["(tm)", "(TM)"] }, { format: "\xAE", match: ["(r)", "(R)"] }, { format: "\xA9", match: ["(c)", "(C)"] }]
25689
+ });
25690
+ var legalHtmlRule = createAutoformatTextSubstitutionRule({
25691
+ patterns: [
25692
+ { format: "\u2122", match: "&trade;" },
25693
+ { format: "\xAE", match: "&reg;" },
25694
+ { format: "\xA9", match: "&copy;" },
25695
+ { format: "\xA7", match: "&sect;" }
25696
+ ]
25697
+ });
25698
+ var operatorsRule = createAutoformatTextSubstitutionRule({
25699
+ patterns: [{ format: "\xB1", match: "+-" }, { format: "\u2030", match: "%%" }, { format: "\u2031", match: ["%%%", "\u2030%"] }]
25700
+ });
25701
+ var punctuationRule = createAutoformatTextSubstitutionRule({
25702
+ patterns: [{ format: "\xBB", match: ">>" }, { format: "\xAB", match: "<<" }]
25703
+ });
25704
+ var smartQuotesRule = createAutoformatTextSubstitutionRule({
25705
+ patterns: [{ format: ["\u201C", "\u201D"], match: '"' }, { format: ["\u2018", "\u2019"], match: "'" }]
25706
+ });
25707
+ var subscriptNumbersRule = createAutoformatTextSubstitutionRule({
25708
+ patterns: [
25709
+ { format: "\u2080", match: "~0" },
25710
+ { format: "\u2081", match: "~1" },
25711
+ { format: "\u2082", match: "~2" },
25712
+ { format: "\u2083", match: "~3" },
25713
+ { format: "\u2084", match: "~4" },
25714
+ { format: "\u2085", match: "~5" },
25715
+ { format: "\u2086", match: "~6" },
25716
+ { format: "\u2087", match: "~7" },
25717
+ { format: "\u2088", match: "~8" },
25718
+ { format: "\u2089", match: "~9" }
25719
+ ]
25720
+ });
25721
+ var subscriptSymbolsRule = createAutoformatTextSubstitutionRule({
25722
+ patterns: [{ format: "\u208A", match: "~+" }, { format: "\u208B", match: "~-" }]
25723
+ });
25724
+ var superscriptNumbersRule = createAutoformatTextSubstitutionRule({
25725
+ patterns: [
25726
+ { format: "\u2070", match: "^0" },
25727
+ { format: "\xB9", match: "^1" },
25728
+ { format: "\xB2", match: "^2" },
25729
+ { format: "\xB3", match: "^3" },
25730
+ { format: "\u2074", match: "^4" },
25731
+ { format: "\u2075", match: "^5" },
25732
+ { format: "\u2076", match: "^6" },
25733
+ { format: "\u2077", match: "^7" },
25734
+ { format: "\u2078", match: "^8" },
25735
+ { format: "\u2079", match: "^9" }
25736
+ ]
25737
+ });
25738
+ var superscriptSymbolsRule = createAutoformatTextSubstitutionRule({
25739
+ patterns: [{ format: "\xB0", match: "^o" }, { format: "\u207A", match: "^+" }, { format: "\u207B", match: "^-" }]
25740
+ });
25741
+ var AutoformatShortcutsPlugin = createSlatePlugin({
25742
+ key: "autoformatShortcuts",
25743
+ inputRules: [
25744
+ legalRule,
25745
+ legalHtmlRule,
25746
+ arrowsRule,
25747
+ comparisonsRule,
25748
+ equalityRule,
25749
+ fractionsRule,
25750
+ operatorsRule,
25751
+ punctuationRule,
25752
+ smartQuotesRule,
25753
+ subscriptNumbersRule,
25754
+ subscriptSymbolsRule,
25755
+ superscriptNumbersRule,
25756
+ superscriptSymbolsRule
25757
+ ]
25758
+ });
25759
+ var AutoformatKit = [AutoformatShortcutsPlugin];
25769
25760
  function BlockquoteElement(props) {
25770
25761
  return /* @__PURE__ */ jsx(PlateElement, { as: "blockquote", className: "my-1 px-0.5 py-[3px]", ...props, children: /* @__PURE__ */ jsx("div", { className: "border-primary border-l-[3px] px-4", children: props.children }) });
25771
25762
  }
@@ -25848,6 +25839,7 @@ function ParagraphElement(props) {
25848
25839
  var BasicBlocksKit = [
25849
25840
  ParagraphPlugin.withComponent(ParagraphElement),
25850
25841
  H1Plugin.configure({
25842
+ inputRules: [HeadingRules.markdown()],
25851
25843
  node: {
25852
25844
  component: H1Element
25853
25845
  },
@@ -25857,6 +25849,7 @@ var BasicBlocksKit = [
25857
25849
  shortcuts: { toggle: { keys: "mod+alt+1" } }
25858
25850
  }),
25859
25851
  H2Plugin.configure({
25852
+ inputRules: [HeadingRules.markdown()],
25860
25853
  node: {
25861
25854
  component: H2Element
25862
25855
  },
@@ -25866,6 +25859,7 @@ var BasicBlocksKit = [
25866
25859
  shortcuts: { toggle: { keys: "mod+alt+2" } }
25867
25860
  }),
25868
25861
  H3Plugin.configure({
25862
+ inputRules: [HeadingRules.markdown()],
25869
25863
  node: {
25870
25864
  component: H3Element
25871
25865
  },
@@ -25875,10 +25869,14 @@ var BasicBlocksKit = [
25875
25869
  shortcuts: { toggle: { keys: "mod+alt+3" } }
25876
25870
  }),
25877
25871
  BlockquotePlugin.configure({
25872
+ inputRules: [BlockquoteRules.markdown()],
25878
25873
  node: { component: BlockquoteElement },
25879
25874
  shortcuts: { toggle: { keys: "mod+shift+period" } }
25880
25875
  }),
25881
- HorizontalRulePlugin.withComponent(HrElement)
25876
+ HorizontalRulePlugin.configure({
25877
+ inputRules: [HorizontalRuleRules.markdown({ variant: "-" }), HorizontalRuleRules.markdown({ variant: "_" })],
25878
+ node: { component: HrElement }
25879
+ })
25882
25880
  ];
25883
25881
  var blockSelectionVariants = cva(
25884
25882
  cn(
@@ -28181,6 +28179,7 @@ var languages = [
28181
28179
  var lowlight = createLowlight(all);
28182
28180
  var CodeBlockKit = [
28183
28181
  CodeBlockPlugin.configure({
28182
+ inputRules: [CodeBlockRules.markdown({ on: "match" })],
28184
28183
  node: { component: CodeBlockElement2 },
28185
28184
  options: { lowlight },
28186
28185
  shortcuts: { toggle: { keys: "mod+alt+8" } }
@@ -29637,7 +29636,30 @@ function TodoLi(props) {
29637
29636
  var ListKit = [
29638
29637
  ...IndentKit,
29639
29638
  ListPlugin.configure({
29639
+ inputRules: [
29640
+ BulletedListRules.markdown({ variant: "-" }),
29641
+ BulletedListRules.markdown({ variant: "*" }),
29642
+ OrderedListRules.markdown({ variant: "." }),
29643
+ OrderedListRules.markdown({ variant: ")" }),
29644
+ TaskListRules.markdown({ checked: false }),
29645
+ TaskListRules.markdown({ checked: true })
29646
+ ],
29640
29647
  inject: {
29648
+ nodeProps: {
29649
+ nodeKey: KEYS.listType,
29650
+ query: ({ nodeProps }) => {
29651
+ const { element } = nodeProps;
29652
+ return !!element?.listStyleType && !isOrderedList(element);
29653
+ },
29654
+ transformProps: ({ props }) => ({
29655
+ ...props,
29656
+ role: "listitem",
29657
+ style: {
29658
+ ...props.style,
29659
+ display: "list-item"
29660
+ }
29661
+ })
29662
+ },
29641
29663
  targetPlugins: [
29642
29664
  ...KEYS.heading,
29643
29665
  KEYS.p,
@@ -30527,7 +30549,7 @@ var PlaceholderElement = withHOC(
30527
30549
  /* @__PURE__ */ jsxs("div", { className: "whitespace-nowrap text-muted-foreground text-sm", children: [
30528
30550
  /* @__PURE__ */ jsx("div", { children: progressing ? file?.name : currentContent.content }),
30529
30551
  progressing && !isImage && /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-1.5", children: [
30530
- /* @__PURE__ */ jsx("div", { children: formatBytes(file.size) }),
30552
+ /* @__PURE__ */ jsx("div", { children: formatBytes(file?.size ?? 0) }),
30531
30553
  /* @__PURE__ */ jsx("div", { children: "-" }),
30532
30554
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
30533
30555
  /* @__PURE__ */ jsx(Spinner$1, { className: "mr-1 size-3.5" }),
@@ -31491,11 +31513,9 @@ var TableElement2 = withHOC(
31491
31513
  const { editor, element } = props;
31492
31514
  const { tf } = useEditorPlugin(TablePlugin);
31493
31515
  const readOnly = useReadOnly();
31494
- const {
31495
- isSelectingCell,
31496
- marginLeft,
31497
- props: tableProps
31498
- } = useTableElement();
31516
+ const { marginLeft, props: tableProps } = useTableElement();
31517
+ const tableRef = useRef(null);
31518
+ useTableSelectionDom(tableRef);
31499
31519
  const isSelectingTable = useBlockSelected(props.element.id);
31500
31520
  return /* @__PURE__ */ jsx(
31501
31521
  PlateElement,
@@ -31507,9 +31527,14 @@ var TableElement2 = withHOC(
31507
31527
  /* @__PURE__ */ jsx(
31508
31528
  "table",
31509
31529
  {
31530
+ ref: tableRef,
31510
31531
  className: cn(
31511
31532
  "mr-0 ml-px table h-px table-fixed border-collapse",
31512
- isSelectingCell && "selection:bg-transparent"
31533
+ "data-[table-selecting=true]:[&_*::selection]:!bg-transparent",
31534
+ "data-[table-selecting=true]:[&_*::selection]:!text-inherit",
31535
+ "data-[table-selecting=true]:[&_*::-moz-selection]:!bg-transparent",
31536
+ "data-[table-selecting=true]:[&_*::-moz-selection]:!text-inherit",
31537
+ "data-[table-selecting=true]:[&_*]:!caret-transparent"
31513
31538
  ),
31514
31539
  ...tableProps,
31515
31540
  children: /* @__PURE__ */ jsx("tbody", { className: "min-w-full", children: props.children })
@@ -32904,10 +32929,12 @@ var getHeadingList = (editor) => {
32904
32929
  return options3.queryHeading(editor);
32905
32930
  }
32906
32931
  const headingList = [];
32907
- const values = editor.api.nodes({
32908
- at: [],
32909
- match: (n) => isHeading(n)
32910
- });
32932
+ const values = Array.from(
32933
+ editor.api.nodes({
32934
+ at: [],
32935
+ match: (n) => isHeading(n)
32936
+ })
32937
+ );
32911
32938
  if (!values) return [];
32912
32939
  for (const [node, path] of values) {
32913
32940
  const { type } = node;
@@ -36525,6 +36552,7 @@ var DocyAssistant = ({
36525
36552
  supportDocumentSearch: options3?.supportDocumentSearch,
36526
36553
  supportThinking: options3?.supportThinking,
36527
36554
  supportWorkCanvas: options3?.supportWorkCanvas,
36555
+ ...options3?.reasoningEffort ? { reasoningEffort: options3.reasoningEffort } : {},
36528
36556
  ...hostEnvironment ? { hostEnvironment } : {},
36529
36557
  ...appContext?.id ? { appId: appContext.id } : {},
36530
36558
  ...clientToolDefsRef.current.length ? { clientTools: clientToolDefsRef.current } : {},
@@ -37017,7 +37045,8 @@ var DocyAssistant = ({
37017
37045
  supportDeepResearch: options3?.supportDeepResearch,
37018
37046
  supportDocumentSearch: options3?.supportDocumentSearch,
37019
37047
  supportThinking: options3?.supportThinking,
37020
- supportWorkCanvas: options3?.supportWorkCanvas
37048
+ supportWorkCanvas: options3?.supportWorkCanvas,
37049
+ reasoningEffort: options3?.reasoningEffort
37021
37050
  }
37022
37051
  });
37023
37052
  } finally {