markdown-flow-ui 0.3.1 → 0.3.2-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +13 -0
  2. package/dist/_virtual/index.es3.js +4 -5
  3. package/dist/_virtual/index.es3.js.map +1 -1
  4. package/dist/_virtual/index.es4.js +5 -4
  5. package/dist/_virtual/index.es4.js.map +1 -1
  6. package/dist/_virtual/index.es6.js +5 -3
  7. package/dist/_virtual/index.es6.js.map +1 -1
  8. package/dist/_virtual/index.es7.js +3 -5
  9. package/dist/_virtual/index.es7.js.map +1 -1
  10. package/dist/_virtual/index3.cjs +1 -1
  11. package/dist/_virtual/index4.cjs +1 -1
  12. package/dist/_virtual/index6.cjs +1 -1
  13. package/dist/_virtual/index7.cjs +1 -1
  14. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  15. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  16. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -0
  17. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +440 -415
  18. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  19. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  20. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  21. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +1 -0
  22. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +71 -68
  23. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  24. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +22 -0
  25. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  26. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +2 -1
  27. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +16 -14
  28. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
  29. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  30. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +2 -1
  31. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +19 -17
  32. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
  33. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  34. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +2 -1
  35. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +15 -13
  36. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  37. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  38. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +2 -1
  39. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +21 -19
  40. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
  41. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  42. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +2 -1
  43. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +27 -25
  44. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
  45. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  46. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +2 -1
  47. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +21 -19
  48. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  49. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  50. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +2 -1
  51. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +19 -17
  52. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
  53. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  54. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +2 -1
  55. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +18 -16
  56. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
  57. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  58. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +2 -1
  59. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +17 -15
  60. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
  61. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  62. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +2 -1
  63. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +25 -23
  64. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
  65. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  66. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +2 -1
  67. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +28 -26
  68. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  69. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  70. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  71. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +5 -1
  72. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +154 -149
  73. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  74. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  75. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  76. package/dist/components/MarkdownFlowEditor/utils.d.ts +2 -0
  77. package/dist/components/MarkdownFlowEditor/utils.es.js +54 -52
  78. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  79. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  80. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  81. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
  82. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  83. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.cjs +1 -1
  84. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.es.js +1 -1
  85. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.cjs +1 -1
  86. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.es.js +1 -1
  87. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.cjs +1 -1
  88. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.es.js +1 -1
  89. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.cjs +1 -1
  90. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.es.js +1 -1
  91. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.cjs +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.es.js +1 -1
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.cjs +1 -1
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.es.js +1 -1
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.cjs +1 -1
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.es.js +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.cjs +1 -1
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.es.js +1 -1
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.cjs +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.es.js +1 -1
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.cjs +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.es.js +1 -1
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.cjs +1 -1
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.es.js +1 -1
  105. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  106. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  107. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  108. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  109. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  110. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  111. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  112. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  113. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  114. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
  115. package/package.json +1 -1
@@ -1,309 +1,310 @@
1
- import { jsx as m, jsxs as B } from "react/jsx-runtime";
2
- import { useEffect as C, useMemo as v, useState as w, useRef as K, useCallback as l } from "react";
3
- import Ye from "../../node_modules/@uiw/react-codemirror/esm/index.es.js";
4
- import { autocompletion as Je } from "../../node_modules/@codemirror/autocomplete/dist/index.es.js";
5
- import { EditorView as we } from "../../node_modules/@codemirror/view/dist/index.es.js";
6
- import { markdown as Xe } from "../../node_modules/@codemirror/lang-markdown/dist/index.es.js";
7
- import { syntaxHighlighting as Ze, defaultHighlightStyle as et } from "../../node_modules/@codemirror/language/dist/index.es.js";
8
- import { Tooltip as tt, TooltipTrigger as ot, TooltipContent as nt } from "../ui/tooltip.es.js";
9
- import rt from "./components/CustomDialog.es.js";
10
- import it from "./components/CustomPopover.es.js";
11
- import at from "./components/EditorToolbar.es.js";
12
- import lt from "./components/VariableSearchDropdown.es.js";
13
- import st from "./editor-context.es.js";
14
- import ct from "./components/ImageInject.es.js";
15
- import ut from "./components/VideoInject.es.js";
16
- import mt from "./components/VariableSelect.es.js";
17
- import { SelectedOption as f } from "./types.es.js";
1
+ import { jsx as p, jsxs as $ } from "react/jsx-runtime";
2
+ import { useEffect as I, useMemo as T, useState as L, useRef as U, useCallback as s } from "react";
3
+ import Ze from "../../node_modules/@uiw/react-codemirror/esm/index.es.js";
4
+ import { autocompletion as qe } from "../../node_modules/@codemirror/autocomplete/dist/index.es.js";
5
+ import { EditorView as Te } from "../../node_modules/@codemirror/view/dist/index.es.js";
6
+ import { markdown as Me } from "../../node_modules/@codemirror/lang-markdown/dist/index.es.js";
7
+ import { syntaxHighlighting as et, defaultHighlightStyle as tt } from "../../node_modules/@codemirror/language/dist/index.es.js";
8
+ import { Tooltip as rt, TooltipTrigger as nt, TooltipContent as ot } from "../ui/tooltip.es.js";
9
+ import at from "./components/CustomDialog.es.js";
10
+ import lt from "./components/CustomPopover.es.js";
11
+ import it from "./components/EditorToolbar.es.js";
12
+ import st from "./components/VariableSearchDropdown.es.js";
13
+ import ct from "./editor-context.es.js";
14
+ import ut from "./components/ImageInject.es.js";
15
+ import mt from "./components/VideoInject.es.js";
16
+ import ft from "./components/VariableSelect.es.js";
17
+ import { SelectedOption as m } from "./types.es.js";
18
18
  /* empty css */
19
- import { getImageContentToInsert as ft, getVideoContentToInsert as ht, createSlashCommands as pt, parseContentInfo as gt } from "./utils.es.js";
20
- import dt from "./plugins/ImgPlaceholder.es.js";
21
- import Vt from "./plugins/VideoPlaceholder.es.js";
22
- import { mediaPlaceholderLabels as bt } from "./plugins/mediaPlaceholderLabels.es.js";
23
- import Ct from "./plugins/VariablePlaceholder.es.js";
24
- import St from "./plugins/SyntaxHighlighter.es.js";
19
+ import { getImageContentToInsert as ht, getVideoContentToInsert as pt, createSlashCommands as gt, parseContentInfo as dt } from "./utils.es.js";
20
+ import Vt from "./plugins/ImgPlaceholder.es.js";
21
+ import bt from "./plugins/VideoPlaceholder.es.js";
22
+ import { mediaPlaceholderLabels as Ct } from "./plugins/mediaPlaceholderLabels.es.js";
23
+ import St from "./plugins/VariablePlaceholder.es.js";
24
+ import It, { QuestionSyntaxHighlighter as vt } from "./plugins/SyntaxHighlighter.es.js";
25
25
  import ne from "../../node_modules/i18next/dist/esm/i18next.es.js";
26
- import { DEFAULT_EDITOR_LOCALE as re, editorLocaleResources as Te, getEditorLocaleMessages as It } from "./editorI18n.es.js";
27
- import { normalizeMarkdownFlowLocale as vt, getMarkdownFlowDirection as wt, getMarkdownFlowLanguage as Tt } from "../../lib/locale.es.js";
28
- import { useDetachedLanguage as Lt } from "../../lib/useDetachedLanguage.es.js";
29
- import { useResolvedDirection as kt } from "../../lib/useResolvedDirection.es.js";
30
- import { initReactI18next as Et } from "../../node_modules/react-i18next/dist/es/initReactI18next.es.js";
31
- import { useTranslation as Ot } from "../../node_modules/react-i18next/dist/es/useTranslation.es.js";
26
+ import { DEFAULT_EDITOR_LOCALE as oe, editorLocaleResources as Le, getEditorLocaleMessages as wt } from "./editorI18n.es.js";
27
+ import { normalizeMarkdownFlowLocale as Tt, getMarkdownFlowDirection as Lt, getMarkdownFlowLanguage as kt } from "../../lib/locale.es.js";
28
+ import { useDetachedLanguage as Et } from "../../lib/useDetachedLanguage.es.js";
29
+ import { useResolvedDirection as yt } from "../../lib/useResolvedDirection.es.js";
30
+ import { initReactI18next as Ot } from "../../node_modules/react-i18next/dist/es/initReactI18next.es.js";
31
+ import { useTranslation as Pt } from "../../node_modules/react-i18next/dist/es/useTranslation.es.js";
32
32
  import { d as N } from "../../_virtual/index.es.js";
33
- ne.isInitialized ? Object.entries(Te).forEach(([V, h]) => {
33
+ ne.isInitialized ? Object.entries(Le).forEach(([C, g]) => {
34
34
  ne.addResourceBundle(
35
- V,
35
+ C,
36
36
  "translation",
37
- h.translation,
37
+ g.translation,
38
38
  !0,
39
39
  !0
40
40
  );
41
- }) : ne.use(Et).init({
42
- resources: Te,
43
- lng: re,
44
- fallbackLng: re,
41
+ }) : ne.use(Ot).init({
42
+ resources: Le,
43
+ lng: oe,
44
+ fallbackLng: oe,
45
45
  interpolation: { escapeValue: !1 }
46
46
  });
47
- const Le = [], ke = (V, h) => {
48
- if (!V || h < 0)
47
+ const ke = [], Ee = (C, g) => {
48
+ if (!C || g < 0)
49
49
  return !1;
50
- for (const k of N.findDocumentVariableMarkers(V))
51
- if (k.name !== null && h >= k.start + 2 && h <= k.end - 2)
50
+ for (const l of N.findDocumentVariableMarkers(C))
51
+ if (l.name !== null && g >= l.start + 2 && g <= l.end - 2)
52
52
  return !0;
53
53
  return !1;
54
- }, yt = (V = "") => V ? N.formatVariableReference(V) : "{{ }}", so = ({
55
- content: V = "",
56
- editMode: h = "codeEdit",
57
- variables: k,
58
- systemVariables: ie,
59
- onChange: F,
60
- onBlur: Ee,
61
- locale: Q,
54
+ }, xt = (C = "") => C ? N.formatVariableReference(C) : "{{ }}", ur = ({
55
+ content: C = "",
56
+ editMode: g = "codeEdit",
57
+ questionMode: l = !1,
58
+ variables: ae,
59
+ systemVariables: le,
60
+ onChange: D,
61
+ onBlur: ye,
62
+ locale: Y,
62
63
  lang: Oe,
63
- uploadProps: ye,
64
+ uploadProps: Pe,
64
65
  disabled: n = !1,
65
- toolbarActionsRight: U,
66
+ toolbarActionsRight: J,
66
67
  onReady: xe
67
68
  }) => {
68
- const { t: a, i18n: Y } = Ot(), j = vt(
69
- Q ?? re
70
- ), ae = wt(Q), le = Oe ?? Tt(Q);
71
- C(() => {
72
- Y.language !== j && Y.changeLanguage(j);
73
- }, [Y, j]);
74
- const E = It(j), b = v(
69
+ const { t: i, i18n: X } = Pt(), H = Tt(
70
+ Y ?? oe
71
+ ), ie = Lt(Y), se = Oe ?? kt(Y);
72
+ I(() => {
73
+ X.language !== H && X.changeLanguage(H);
74
+ }, [X, H]);
75
+ const f = wt(H), S = T(
75
76
  () => ({
76
- image: a("toolbarInsertImage", {
77
+ image: i("toolbarInsertImage", {
77
78
  defaultValue: "Insert image"
78
79
  }),
79
- video: a("toolbarInsertVideo", {
80
+ video: i("toolbarInsertVideo", {
80
81
  defaultValue: "Insert video"
81
82
  }),
82
- variable: a("slashVariable", {
83
+ variable: i("slashVariable", {
83
84
  defaultValue: "Variable"
84
85
  }),
85
- addVariable: a("toolbarInsertNewVariable", {
86
+ addVariable: i("toolbarInsertNewVariable", {
86
87
  defaultValue: "Insert new variable"
87
88
  }),
88
- search: a("toolbarInsertExistingVariable", {
89
+ search: i("toolbarInsertExistingVariable", {
89
90
  defaultValue: "Insert existing variable"
90
91
  }),
91
- confirmOutput: a("toolbarConfirmOutput", {
92
+ confirmOutput: i("toolbarConfirmOutput", {
92
93
  defaultValue: "Confirm output"
93
94
  }),
94
- insertLink: a("toolbarInsertLink", {
95
+ insertLink: i("toolbarInsertLink", {
95
96
  defaultValue: "Insert link"
96
97
  }),
97
- insertButton: a("toolbarInsertButton", {
98
+ insertButton: i("toolbarInsertButton", {
98
99
  defaultValue: "Insert button"
99
100
  }),
100
- insertSingleChoice: a("toolbarInsertSingleChoice", {
101
+ insertSingleChoice: i("toolbarInsertSingleChoice", {
101
102
  defaultValue: "Insert single choice"
102
103
  }),
103
- insertMultiChoice: a("toolbarInsertMultiChoice", {
104
+ insertMultiChoice: i("toolbarInsertMultiChoice", {
104
105
  defaultValue: "Insert multi choice"
105
106
  }),
106
- insertInput: a("toolbarInsertInput", {
107
+ insertInput: i("toolbarInsertInput", {
107
108
  defaultValue: "Insert input"
108
109
  }),
109
- singleChoiceOption1: a("toolbarChoiceOption1", {
110
+ singleChoiceOption1: i("toolbarChoiceOption1", {
110
111
  defaultValue: "Option 1"
111
112
  }),
112
- singleChoiceOption2: a("toolbarChoiceOption2", {
113
+ singleChoiceOption2: i("toolbarChoiceOption2", {
113
114
  defaultValue: "Option 2"
114
115
  }),
115
- inputPlaceholder: a("toolbarInputPlaceholder", {
116
+ inputPlaceholder: i("toolbarInputPlaceholder", {
116
117
  defaultValue: "Please enter"
117
118
  })
118
119
  }),
119
- [a]
120
- ), Pe = v(
120
+ [i]
121
+ ), Ne = T(
121
122
  () => ({
122
- searchPlaceholder: a("variableSearchPlaceholder", {
123
+ searchPlaceholder: i("variableSearchPlaceholder", {
123
124
  defaultValue: "Search variable"
124
125
  }),
125
- systemLabel: a("variableSectionSystem", "System Variables"),
126
- customLabel: a("variableSectionCustom", "Custom Variables"),
127
- emptyLabel: a("variableNotFound", "No variables found")
126
+ systemLabel: i("variableSectionSystem", "System Variables"),
127
+ customLabel: i("variableSectionCustom", "Custom Variables"),
128
+ emptyLabel: i("variableNotFound", "No variables found")
128
129
  }),
129
- [a]
130
- ), Ne = h === "quickEdit" ? a("placeholderQuickEdit", {
131
- defaultValue: a("placeholderCodeEdit", {
132
- defaultValue: a("placeholder")
130
+ [i]
131
+ ), De = g === "quickEdit" ? i("placeholderQuickEdit", {
132
+ defaultValue: i("placeholderCodeEdit", {
133
+ defaultValue: i("placeholder")
133
134
  })
134
- }) : a("placeholderCodeEdit", { defaultValue: a("placeholder") }), D = v(() => {
135
+ }) : i("placeholderCodeEdit", { defaultValue: i("placeholder") }), R = T(() => {
135
136
  const e = /* @__PURE__ */ new Set();
136
- return (ie ?? Le).flatMap((o) => {
137
- const r = typeof o?.name == "string" ? N.normalizeVariableName(o.name) : null;
138
- return r === null || e.has(r) ? [] : (e.add(r), [{ ...o, name: r }]);
137
+ return (le ?? ke).flatMap((r) => {
138
+ const o = typeof r?.name == "string" ? N.normalizeVariableName(r.name) : null;
139
+ return o === null || e.has(o) ? [] : (e.add(o), [{ ...r, name: o }]);
139
140
  });
140
- }, [ie]), J = v(() => {
141
+ }, [le]), Z = T(() => {
141
142
  const e = new Set(
142
- D.map((r) => r.name)
143
- ), o = /* @__PURE__ */ new Set();
144
- return (k ?? Le).flatMap((r) => {
145
- const t = typeof r?.name == "string" ? N.normalizeVariableName(r.name) : null;
146
- return t === null || e.has(t) || o.has(t) ? [] : (o.add(t), [{ ...r, name: t }]);
143
+ R.map((o) => o.name)
144
+ ), r = /* @__PURE__ */ new Set();
145
+ return (ae ?? ke).flatMap((o) => {
146
+ const t = typeof o?.name == "string" ? N.normalizeVariableName(o.name) : null;
147
+ return t === null || e.has(t) || r.has(t) ? [] : (r.add(t), [{ ...o, name: t }]);
147
148
  });
148
- }, [k, D]), [X, T] = w(!1), [Z, O] = w(!1), H = K(null), R = Lt(H, le), { resolvedDirection: A } = kt(
149
- H,
150
- ae
151
- ), [De, z] = w(null), [se, ee] = w(
152
- J
153
- ), [$, Re] = w(
154
- D
149
+ }, [ae, R]), [q, k] = L(!1), [M, y] = L(!1), j = U(null), A = Et(j, se), { resolvedDirection: z } = yt(
150
+ j,
151
+ ie
152
+ ), [Re, B] = L(null), [ce, ee] = L(
153
+ Z
154
+ ), [_, Ae] = L(
155
+ R
155
156
  );
156
- C(() => {
157
- ee(J);
158
- }, [J]), C(() => {
159
- Re(D);
160
- }, [D]);
161
- const [S, L] = w(
162
- f.Empty
163
- ), [s, M] = w(), i = K(null), q = K(null), _ = K(null), [te, ce] = w(!1), d = l(() => {
164
- ce(!1), _.current = null;
165
- }, []), Ae = l(
157
+ I(() => {
158
+ ee(Z);
159
+ }, [Z]), I(() => {
160
+ Ae(R);
161
+ }, [R]);
162
+ const [v, E] = L(
163
+ m.Empty
164
+ ), [u, F] = L(), a = U(null), G = U(null), Q = U(null), [te, ue] = L(!1), b = s(() => {
165
+ ue(!1), Q.current = null;
166
+ }, []), ze = s(
166
167
  (e) => {
167
168
  if (!n) {
168
- if (te && _.current === e) {
169
- d();
169
+ if (te && Q.current === e) {
170
+ b();
170
171
  return;
171
172
  }
172
- _.current = e, ce(!0);
173
+ Q.current = e, ue(!0);
173
174
  }
174
175
  },
175
- [d, n, te]
176
- ), ze = {
177
- selectedOption: S,
178
- setSelectedOption: L,
179
- dialogOpen: X,
180
- setDialogOpen: T,
181
- popoverOpen: Z,
182
- setPopoverOpen: O,
183
- popoverPosition: De,
184
- setPopoverPosition: z
176
+ [b, n, te]
177
+ ), Be = {
178
+ selectedOption: v,
179
+ setSelectedOption: E,
180
+ dialogOpen: q,
181
+ setDialogOpen: k,
182
+ popoverOpen: M,
183
+ setPopoverOpen: y,
184
+ popoverPosition: Re,
185
+ setPopoverPosition: B
185
186
  };
186
- C(() => {
187
- n && (T(!1), O(!1), L(f.Empty), M(null), z(null), d());
187
+ I(() => {
188
+ n && (k(!1), y(!1), E(m.Empty), F(null), B(null), b());
188
189
  }, [
189
- d,
190
+ b,
190
191
  n,
191
- T,
192
- O,
193
- z,
194
- L,
195
- M
192
+ k,
193
+ y,
194
+ B,
195
+ E,
196
+ F
196
197
  ]);
197
- const y = l(
198
+ const O = s(
198
199
  (e) => {
199
- if (h !== "quickEdit" || !e)
200
+ if (l || g !== "quickEdit" || !e)
200
201
  return;
201
- const o = N.extractVariableNames(e);
202
- if (!o.length)
202
+ const r = N.extractVariableNames(e);
203
+ if (!r.length)
203
204
  return;
204
- const r = new Set(
205
- $.map((t) => t.name)
205
+ const o = new Set(
206
+ _.map((t) => t.name)
206
207
  );
207
208
  ee((t) => {
208
- const c = new Set(t.map((g) => g.name)), u = /* @__PURE__ */ new Set(), p = [];
209
- return o.forEach((g) => {
210
- const I = g;
211
- !g || r.has(I) || c.has(I) || u.has(I) || (p.push({ name: g }), u.add(I));
212
- }), p.length ? [...p, ...t] : t;
209
+ const c = new Set(t.map((V) => V.name)), h = /* @__PURE__ */ new Set(), d = [];
210
+ return r.forEach((V) => {
211
+ const w = V;
212
+ !V || o.has(w) || c.has(w) || h.has(w) || (d.push({ name: V }), h.add(w));
213
+ }), d.length ? [...d, ...t] : t;
213
214
  });
214
215
  },
215
- [h, $]
216
+ [g, l, _]
216
217
  );
217
- C(() => {
218
- y(V);
219
- }, [V, y]);
220
- const oe = l(
218
+ I(() => {
219
+ O(C);
220
+ }, [C, O]);
221
+ const re = s(
221
222
  (e) => {
222
- if (!n)
223
- if (d(), L(e), e === f.Variable) {
224
- if (i.current) {
225
- const { state: o } = i.current, r = o.selection.main.from, t = i.current.coordsAtPos(r);
226
- t && z({
223
+ if (!(n || l && e === m.Variable))
224
+ if (b(), E(e), e === m.Variable) {
225
+ if (a.current) {
226
+ const { state: r } = a.current, o = r.selection.main.from, t = a.current.coordsAtPos(o);
227
+ t && B({
227
228
  x: t.left,
228
229
  y: t.bottom
229
230
  });
230
231
  }
231
- O(!0);
232
+ y(!0);
232
233
  } else
233
- T(!0);
234
+ k(!0);
234
235
  },
235
- [d, n]
236
- ), x = l(
236
+ [b, n, l]
237
+ ), P = s(
237
238
  (e) => {
238
- if (n || !i.current) return;
239
- const { state: o, dispatch: r } = i.current, t = o.selection.main.from;
240
- r({
239
+ if (n || !a.current) return;
240
+ const { state: r, dispatch: o } = a.current, t = r.selection.main.from;
241
+ o({
241
242
  changes: { from: t, insert: e },
242
243
  selection: { anchor: t + e.length }
243
244
  });
244
245
  },
245
- [i, n]
246
- ), ue = l(
246
+ [a, n]
247
+ ), me = s(
247
248
  (e) => {
248
- if (n || !i.current)
249
+ if (n || !a.current)
249
250
  return;
250
- const { state: o, dispatch: r } = i.current, t = o.selection.main;
251
- r({
251
+ const { state: r, dispatch: o } = a.current, t = r.selection.main;
252
+ o({
252
253
  changes: { from: t.from, to: t.to, insert: e },
253
254
  selection: { anchor: t.from + e.length }
254
255
  });
255
256
  },
256
257
  [n]
257
- ), me = l(() => {
258
- i.current?.focus();
259
- }, []), fe = l(() => i.current?.state.doc.toString() ?? "", []), he = l(
258
+ ), fe = s(() => {
259
+ a.current?.focus();
260
+ }, []), he = s(() => a.current?.state.doc.toString() ?? "", []), pe = s(
260
261
  (e) => {
261
262
  if (n)
262
263
  return;
263
- if (!i.current) {
264
- F?.(e);
264
+ if (!a.current) {
265
+ D?.(e);
265
266
  return;
266
267
  }
267
- const o = i.current, { state: r, dispatch: t } = o;
268
+ const r = a.current, { state: o, dispatch: t } = r;
268
269
  t({
269
- changes: { from: 0, to: r.doc.length, insert: e },
270
+ changes: { from: 0, to: o.doc.length, insert: e },
270
271
  selection: { anchor: e.length }
271
272
  });
272
273
  },
273
- [n, F]
274
- ), G = l(() => {
275
- if (n || !s || !i.current || s.from === -1)
274
+ [n, D]
275
+ ), W = s(() => {
276
+ if (n || !u || !a.current || u.from === -1)
276
277
  return;
277
- const { from: e, to: o } = s, { dispatch: r } = i.current;
278
- r({
279
- changes: { from: e, to: o, insert: "" }
278
+ const { from: e, to: r } = u, { dispatch: o } = a.current;
279
+ o({
280
+ changes: { from: e, to: r, insert: "" }
280
281
  });
281
- }, [s, i, n]), W = l(
282
- (e, o, r = !1) => {
283
- if (n || !i.current)
282
+ }, [u, a, n]), K = s(
283
+ (e, r, o = !1) => {
284
+ if (n || !a.current)
284
285
  return;
285
- const t = i.current, { state: c, dispatch: u } = t, p = o ?? c.selection.main, g = yt(e);
286
- if (!g) return;
287
- const I = N.normalizeVariableName(e) ?? "", Ue = r ? g.length : 3 + I.length;
288
- u({
286
+ const t = a.current, { state: c, dispatch: h } = t, d = r ?? c.selection.main, V = xt(e);
287
+ if (!V) return;
288
+ const w = N.normalizeVariableName(e) ?? "", Xe = o ? V.length : 3 + w.length;
289
+ h({
289
290
  changes: {
290
- from: p.from,
291
- to: p.to,
292
- insert: g
291
+ from: d.from,
292
+ to: d.to,
293
+ insert: V
293
294
  },
294
295
  selection: {
295
- anchor: p.from + Ue
296
+ anchor: d.from + Xe
296
297
  }
297
298
  }), t.focus();
298
299
  },
299
300
  [n]
300
- ), Me = l(() => {
301
- n || (d(), W(""));
302
- }, [d, n, W]), Be = l(() => {
303
- if (n || !i.current)
301
+ ), Fe = s(() => {
302
+ n || (b(), K(""));
303
+ }, [b, n, K]), $e = s(() => {
304
+ if (n || !a.current)
304
305
  return;
305
- const e = i.current, { state: o, dispatch: r } = e, t = o.selection.main;
306
- r({
306
+ const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main;
307
+ o({
307
308
  changes: {
308
309
  from: t.from,
309
310
  to: t.to,
@@ -313,11 +314,11 @@ const Le = [], ke = (V, h) => {
313
314
  anchor: t.from + 3
314
315
  }
315
316
  }), e.focus();
316
- }, [n]), Fe = l(() => {
317
- if (n || !i.current)
317
+ }, [n]), He = s(() => {
318
+ if (n || !a.current)
318
319
  return;
319
- const e = i.current, { state: o, dispatch: r } = e, t = o.selection.main;
320
- r({
320
+ const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main;
321
+ o({
321
322
  changes: {
322
323
  from: t.from,
323
324
  to: t.to,
@@ -327,11 +328,11 @@ const Le = [], ke = (V, h) => {
327
328
  anchor: t.from + 1
328
329
  }
329
330
  }), e.focus();
330
- }, [n]), je = l(() => {
331
- if (n || !i.current)
331
+ }, [n]), je = s(() => {
332
+ if (n || !a.current)
332
333
  return;
333
- const e = i.current, { state: o, dispatch: r } = e, t = o.selection.main;
334
- r({
334
+ const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main;
335
+ o({
335
336
  changes: {
336
337
  from: t.from,
337
338
  to: t.to,
@@ -341,266 +342,289 @@ const Le = [], ke = (V, h) => {
341
342
  anchor: t.from + 2
342
343
  }
343
344
  }), e.focus();
344
- }, [n]), He = l(() => {
345
- if (n || !i.current)
345
+ }, [n]), _e = s(() => {
346
+ if (n || !a.current)
346
347
  return;
347
- const e = i.current, { state: o, dispatch: r } = e, t = o.selection.main, c = b.singleChoiceOption1, u = b.singleChoiceOption2, p = `?[%{{ }} ${c} | ${u}]`;
348
- r({
348
+ const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main, c = S.singleChoiceOption1, h = S.singleChoiceOption2, d = `?[%{{ ${l ? f.questionPlaceholder : ""} }} ${c} | ${h}]`;
349
+ o({
349
350
  changes: {
350
351
  from: t.from,
351
352
  to: t.to,
352
- insert: p
353
+ insert: d
353
354
  },
354
355
  selection: {
355
- anchor: t.from + 6
356
+ anchor: t.from + 6,
357
+ head: t.from + 6 + (l ? f.questionPlaceholder.length : 0)
356
358
  }
357
359
  }), e.focus();
358
360
  }, [
359
361
  n,
360
- b.singleChoiceOption1,
361
- b.singleChoiceOption2
362
- ]), $e = l(() => {
363
- if (n || !i.current)
362
+ S.singleChoiceOption1,
363
+ S.singleChoiceOption2,
364
+ l,
365
+ f.questionPlaceholder
366
+ ]), Ge = s(() => {
367
+ if (n || !a.current)
364
368
  return;
365
- const e = i.current, { state: o, dispatch: r } = e, t = o.selection.main, c = b.singleChoiceOption1, u = b.singleChoiceOption2, p = `?[%{{ }} ${c} || ${u}]`;
366
- r({
369
+ const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main, c = S.singleChoiceOption1, h = S.singleChoiceOption2, d = `?[%{{ ${l ? f.questionPlaceholder : ""} }} ${c} || ${h}]`;
370
+ o({
367
371
  changes: {
368
372
  from: t.from,
369
373
  to: t.to,
370
- insert: p
374
+ insert: d
371
375
  },
372
376
  selection: {
373
- anchor: t.from + 6
377
+ anchor: t.from + 6,
378
+ head: t.from + 6 + (l ? f.questionPlaceholder.length : 0)
374
379
  }
375
380
  }), e.focus();
376
381
  }, [
377
382
  n,
378
- b.singleChoiceOption1,
379
- b.singleChoiceOption2
380
- ]), qe = l(() => {
381
- if (n || !i.current)
383
+ S.singleChoiceOption1,
384
+ S.singleChoiceOption2,
385
+ l,
386
+ f.questionPlaceholder
387
+ ]), Qe = s(() => {
388
+ if (n || !a.current)
382
389
  return;
383
- const e = i.current, { state: o, dispatch: r } = e, t = o.selection.main, u = `?[%{{ }}...${b.inputPlaceholder ?? "请输入"}]`;
384
- r({
390
+ const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main, c = S.inputPlaceholder ?? "请输入", h = `?[%{{ ${l ? f.questionPlaceholder : ""} }}...${c}]`;
391
+ o({
385
392
  changes: {
386
393
  from: t.from,
387
394
  to: t.to,
388
- insert: u
395
+ insert: h
389
396
  },
390
397
  selection: {
391
- anchor: t.from + 6
398
+ anchor: t.from + 6,
399
+ head: t.from + 6 + (l ? f.questionPlaceholder.length : 0)
392
400
  }
393
401
  }), e.focus();
394
- }, [n, b.inputPlaceholder]), _e = l(
402
+ }, [
403
+ n,
404
+ S.inputPlaceholder,
405
+ l,
406
+ f.questionPlaceholder
407
+ ]), We = s(
395
408
  ({
396
409
  resourceUrl: e,
397
- resourceTitle: o,
398
- scalePercent: r
410
+ resourceTitle: r,
411
+ scalePercent: o
399
412
  }) => {
400
413
  if (!e || n) return;
401
- const t = ft({
414
+ const t = ht({
402
415
  resourceUrl: e,
403
- resourceTitle: o,
404
- scalePercent: r
416
+ resourceTitle: r,
417
+ scalePercent: o
405
418
  });
406
- if (s?.type === f.Image) {
407
- if (G(), !i.current) return;
408
- const { dispatch: c } = i.current;
419
+ if (u?.type === m.Image) {
420
+ if (W(), !a.current) return;
421
+ const { dispatch: c } = a.current;
409
422
  c({
410
- changes: { from: s.from, insert: t }
423
+ changes: { from: u.from, insert: t }
411
424
  });
412
425
  } else
413
- x(t);
414
- T(!1);
426
+ P(t);
427
+ k(!1);
415
428
  },
416
- [G, n, x, s]
417
- ), Ge = l(
429
+ [W, n, P, u]
430
+ ), Ke = s(
418
431
  ({
419
432
  resourceUrl: e,
420
- resourceTitle: o
433
+ resourceTitle: r
421
434
  }) => {
422
435
  if (n)
423
436
  return;
424
- const r = ht(e, o);
425
- if (s?.type === f.Video) {
426
- if (G(), !i.current) return;
427
- const { dispatch: t } = i.current;
437
+ const o = pt(e, r);
438
+ if (u?.type === m.Video) {
439
+ if (W(), !a.current) return;
440
+ const { dispatch: t } = a.current;
428
441
  t({
429
- changes: { from: s.from, insert: r }
442
+ changes: { from: u.from, insert: o }
430
443
  });
431
444
  } else
432
- x(r);
433
- T(!1);
445
+ P(o);
446
+ k(!1);
434
447
  },
435
- [G, n, x, s]
436
- ), pe = l(
448
+ [W, n, P, u]
449
+ ), ge = s(
437
450
  (e) => {
438
451
  if (n)
439
452
  return;
440
- const o = s?.type === f.Variable ? { from: s.from, to: s.to } : void 0;
441
- W(e.name, o, !0), O(!1), d();
453
+ const r = u?.type === m.Variable ? { from: u.from, to: u.to } : void 0;
454
+ K(e.name, r, !0), y(!1), b();
442
455
  },
443
- [n, W, s, d]
444
- ), ge = l(() => Je({
456
+ [n, K, u, b]
457
+ ), de = s(() => qe({
445
458
  override: [
446
- pt(oe, {
447
- // divider: currentStrings.slashDivider,
448
- // fixedText: currentStrings.slashFixedText,
449
- image: E.slashImage,
450
- video: E.slashVideo,
451
- variable: E.slashVariable
452
- })
459
+ gt(
460
+ re,
461
+ {
462
+ // divider: currentStrings.slashDivider,
463
+ // fixedText: currentStrings.slashFixedText,
464
+ image: f.slashImage,
465
+ video: f.slashVideo,
466
+ variable: f.slashVariable
467
+ },
468
+ { enableVariables: !l }
469
+ )
453
470
  ]
454
471
  }), [
455
472
  // currentStrings.slashDivider,
456
473
  // currentStrings.slashFixedText,
457
- E.slashImage,
458
- E.slashVideo,
459
- E.slashVariable,
460
- oe
461
- ]), de = l(
474
+ f.slashImage,
475
+ f.slashVideo,
476
+ f.slashVariable,
477
+ re,
478
+ l
479
+ ]), Ve = s(
462
480
  (e) => {
463
- if (i.current = e.view, h === "quickEdit" && q.current && e.selectionSet) {
464
- const o = e.state.selection.main.head, r = e.state.doc.toString();
465
- ke(
466
- r,
467
- o
468
- ) || (y(r), q.current = null);
481
+ if (a.current = e.view, !l && g === "quickEdit" && G.current && e.selectionSet) {
482
+ const r = e.state.selection.main.head, o = e.state.doc.toString();
483
+ Ee(
484
+ o,
485
+ r
486
+ ) || (O(o), G.current = null);
469
487
  }
470
488
  },
471
- [y, h]
472
- ), Ve = l(
489
+ [O, g, l]
490
+ ), be = s(
473
491
  (e) => {
474
492
  if (e.stopPropagation(), n)
475
493
  return;
476
- const { type: o, from: r, to: t, dataset: c, target: u } = e.detail, p = gt(o, c);
477
- if (M({
478
- type: o,
479
- value: p,
480
- from: r,
494
+ const { type: r, from: o, to: t, dataset: c, target: h } = e.detail;
495
+ if (l && r === m.Variable) return;
496
+ const d = dt(r, c);
497
+ if (F({
498
+ type: r,
499
+ value: d,
500
+ from: o,
481
501
  to: t
482
- }), L(o), o === f.Variable) {
483
- if (u) {
484
- const g = u.getBoundingClientRect(), I = u.ownerDocument.defaultView?.getComputedStyle(
485
- H.current ?? u
502
+ }), E(r), r === m.Variable) {
503
+ if (h) {
504
+ const V = h.getBoundingClientRect(), w = h.ownerDocument.defaultView?.getComputedStyle(
505
+ j.current ?? h
486
506
  ).direction;
487
- z({
488
- x: I === "rtl" ? g.right : g.left,
489
- y: g.bottom
507
+ B({
508
+ x: w === "rtl" ? V.right : V.left,
509
+ y: V.bottom
490
510
  });
491
511
  }
492
- O(!0);
512
+ y(!0);
493
513
  } else
494
- T(!0);
514
+ k(!0);
495
515
  },
496
- [n]
516
+ [n, l]
497
517
  );
498
- C(() => {
499
- X || (L(f.Empty), M(null));
500
- }, [X]), C(() => {
501
- !Z && S === f.Variable && (L(f.Empty), M(null));
502
- }, [Z, S]), C(() => {
503
- const e = (o) => {
504
- o.detail.view === i.current && Ve(o);
518
+ I(() => {
519
+ q || (E(m.Empty), F(null));
520
+ }, [q]), I(() => {
521
+ !M && v === m.Variable && (E(m.Empty), F(null));
522
+ }, [M, v]), I(() => {
523
+ const e = (r) => {
524
+ r.detail.view === a.current && be(r);
505
525
  };
506
526
  return window.addEventListener("globalTagClick", e), () => {
507
527
  window.removeEventListener("globalTagClick", e);
508
528
  };
509
- }, [Ve]);
510
- const be = a("imageDefaultTitle"), Ce = a("videoDefaultTitle"), Se = v(
511
- () => bt.of({
512
- image: be,
513
- video: Ce
529
+ }, [be]);
530
+ const Ce = i("imageDefaultTitle"), Se = i("videoDefaultTitle"), Ie = T(
531
+ () => Ct.of({
532
+ image: Ce,
533
+ video: Se
514
534
  }),
515
- [be, Ce]
516
- ), We = v(() => {
535
+ [Ce, Se]
536
+ ), Ue = T(() => {
517
537
  const e = [
518
- we.lineWrapping,
519
- Xe(),
520
- Ze(et),
521
- St
538
+ Te.lineWrapping,
539
+ Me(),
540
+ et(tt),
541
+ l ? vt : It
522
542
  ];
523
- return n || e.push(ge()), h === "quickEdit" && e.push(
524
- Se,
525
- dt,
543
+ return n || e.push(de()), g === "quickEdit" && (e.push(
544
+ Ie,
526
545
  Vt,
527
- Ct
546
+ bt
528
547
  // fixedTextPlaceholderExtension,
529
548
  // DividerPlaceholder,
530
- ), e.push(
531
- we.updateListener.of((o) => {
532
- de(o);
549
+ ), l || e.push(St)), e.push(
550
+ Te.updateListener.of((r) => {
551
+ Ve(r);
533
552
  })
534
553
  ), e;
535
554
  }, [
536
555
  n,
537
- h,
538
- ge,
556
+ g,
539
557
  de,
540
- Se
541
- ]), Ke = l(
558
+ Ve,
559
+ Ie,
560
+ l
561
+ ]), Ye = s(
542
562
  (e) => {
543
563
  if (n)
544
564
  return;
545
- const o = i.current?.state.selection.main.head ?? -1;
546
- ke(
565
+ if (l) {
566
+ D?.(e);
567
+ return;
568
+ }
569
+ const r = a.current?.state.selection.main.head ?? -1;
570
+ Ee(
547
571
  e,
548
- o
549
- ) ? q.current = e : (q.current = null, y(e)), F?.(e);
572
+ r
573
+ ) ? G.current = e : (G.current = null, O(e)), D?.(e);
550
574
  },
551
- [y, F, n]
552
- ), Ie = !n && te, P = v(
575
+ [O, D, n, l]
576
+ ), ve = !l && !n && te, x = T(
553
577
  () => ({
554
- insertTextAtCursor: x,
555
- replaceSelection: ue,
556
- focus: me,
557
- getContent: fe,
558
- setContent: he
578
+ insertTextAtCursor: P,
579
+ replaceSelection: me,
580
+ focus: fe,
581
+ getContent: he,
582
+ setContent: pe
559
583
  }),
560
- [me, fe, x, ue, he]
561
- ), ve = l(
584
+ [fe, he, P, me, pe]
585
+ ), we = s(
562
586
  (e) => {
563
- n || "render" in e || e.onClick?.(P);
587
+ n || "render" in e || e.onClick?.(x);
564
588
  },
565
- [n, P]
566
- ), Qe = v(() => U?.length ? /* @__PURE__ */ m("div", { className: "markdown-flow-editor-toolbar-right", children: U.map((e) => {
589
+ [n, x]
590
+ ), Je = T(() => J?.length ? /* @__PURE__ */ p("div", { className: "markdown-flow-editor-toolbar-right", children: J.map((e) => {
567
591
  if ("render" in e)
568
- return /* @__PURE__ */ m(
592
+ return /* @__PURE__ */ p(
569
593
  "div",
570
594
  {
571
595
  className: "markdown-flow-editor-toolbar-right-item",
572
- children: e.render(P)
596
+ children: e.render(x)
573
597
  },
574
598
  e.key
575
599
  );
576
- const o = e.label || e.tooltip || void 0, r = /* @__PURE__ */ B(
600
+ const r = e.label || e.tooltip || void 0, o = /* @__PURE__ */ $(
577
601
  "button",
578
602
  {
579
603
  type: "button",
580
604
  disabled: n || e.disabled,
581
- onClick: () => ve(e),
605
+ onClick: () => we(e),
582
606
  className: "markdown-flow-editor-toolbar-right-button",
583
- "aria-label": o,
607
+ "aria-label": r,
584
608
  title: e.label || e.tooltip,
585
609
  children: [
586
- e.icon ? /* @__PURE__ */ m("span", { className: "toolbar-right-icon", children: e.icon }) : null,
587
- e.label ? /* @__PURE__ */ m("span", { className: "toolbar-right-label", children: e.label }) : null
610
+ e.icon ? /* @__PURE__ */ p("span", { className: "toolbar-right-icon", children: e.icon }) : null,
611
+ e.label ? /* @__PURE__ */ p("span", { className: "toolbar-right-label", children: e.label }) : null
588
612
  ]
589
613
  },
590
614
  e.key
591
- ), t = e.tooltip ? /* @__PURE__ */ B(tt, { children: [
592
- /* @__PURE__ */ m(ot, { asChild: !0, children: r }),
593
- /* @__PURE__ */ m(
594
- nt,
615
+ ), t = e.tooltip ? /* @__PURE__ */ $(rt, { children: [
616
+ /* @__PURE__ */ p(nt, { asChild: !0, children: o }),
617
+ /* @__PURE__ */ p(
618
+ ot,
595
619
  {
596
620
  side: "top",
597
- dir: A,
598
- lang: R,
621
+ dir: z,
622
+ lang: A,
599
623
  children: e.tooltip
600
624
  }
601
625
  )
602
- ] }) : r;
603
- return /* @__PURE__ */ m(
626
+ ] }) : o;
627
+ return /* @__PURE__ */ p(
604
628
  "div",
605
629
  {
606
630
  className: "markdown-flow-editor-toolbar-right-item",
@@ -610,62 +634,63 @@ const Le = [], ke = (V, h) => {
610
634
  );
611
635
  }) }) : null, [
612
636
  n,
613
- P,
614
- ve,
637
+ x,
638
+ we,
639
+ z,
615
640
  A,
616
- R,
617
- U
641
+ J
618
642
  ]);
619
- return C(() => {
620
- xe?.(P);
621
- }, [P]), /* @__PURE__ */ B(
643
+ return I(() => {
644
+ xe?.(x);
645
+ }, [x]), /* @__PURE__ */ $(
622
646
  "div",
623
647
  {
624
648
  className: "markdown-flow-editor",
625
- ref: H,
626
- dir: ae,
627
- lang: le,
649
+ ref: j,
650
+ dir: ie,
651
+ lang: se,
628
652
  "data-disabled": n ? "true" : void 0,
629
653
  "aria-disabled": n,
630
654
  children: [
631
- /* @__PURE__ */ m(
632
- at,
655
+ /* @__PURE__ */ p(
656
+ it,
633
657
  {
634
658
  disabled: n,
635
- labels: b,
636
- tooltipDirection: A,
637
- tooltipLanguage: R,
638
- onSelect: oe,
639
- onInsertVariablePlaceholder: Me,
640
- onVariableSearchToggle: Ae,
641
- onVariableSearchClose: d,
642
- onInsertConfirmOutput: Be,
643
- onInsertLink: Fe,
659
+ enableVariables: !l,
660
+ labels: S,
661
+ tooltipDirection: z,
662
+ tooltipLanguage: A,
663
+ onSelect: re,
664
+ onInsertVariablePlaceholder: Fe,
665
+ onVariableSearchToggle: ze,
666
+ onVariableSearchClose: b,
667
+ onInsertConfirmOutput: $e,
668
+ onInsertLink: He,
644
669
  onInsertButton: je,
645
- onInsertSingleChoice: He,
646
- onInsertMultiChoice: $e,
647
- onInsertInputField: qe,
648
- variableSearchActive: Ie,
649
- rightSlot: Qe
670
+ onInsertSingleChoice: _e,
671
+ onInsertMultiChoice: Ge,
672
+ onInsertInputField: Qe,
673
+ variableSearchActive: ve,
674
+ rightSlot: Je
650
675
  }
651
676
  ),
652
- /* @__PURE__ */ m(
653
- lt,
677
+ !l && /* @__PURE__ */ p(
678
+ st,
654
679
  {
655
- open: Ie,
656
- anchorElement: _.current,
657
- onClose: d,
658
- onSelect: pe,
659
- variables: se,
660
- systemVariables: $,
661
- labels: Pe
680
+ open: ve,
681
+ anchorElement: Q.current,
682
+ onClose: b,
683
+ onSelect: ge,
684
+ variables: ce,
685
+ systemVariables: _,
686
+ labels: Ne
662
687
  }
663
688
  ),
664
- /* @__PURE__ */ m("div", { className: "markdown-flow-editor-body relative overflow-auto", children: /* @__PURE__ */ B(st.Provider, { value: ze, children: [
665
- /* @__PURE__ */ m(
666
- Ye,
689
+ /* @__PURE__ */ p("div", { className: "markdown-flow-editor-body relative overflow-auto", children: /* @__PURE__ */ $(ct.Provider, { value: Be, children: [
690
+ /* @__PURE__ */ p(
691
+ Ze,
667
692
  {
668
- extensions: We,
693
+ extensions: Ue,
669
694
  basicSetup: {
670
695
  lineNumbers: !1,
671
696
  searchKeymap: !1,
@@ -675,56 +700,56 @@ const Le = [], ke = (V, h) => {
675
700
  foldGutter: !1
676
701
  },
677
702
  className: "rounded-md",
678
- placeholder: Ne,
679
- value: V,
703
+ placeholder: De,
704
+ value: C,
680
705
  theme: "light",
681
706
  minHeight: "2rem",
682
707
  editable: !n,
683
- onChange: Ke,
684
- onBlur: Ee
708
+ onChange: Ye,
709
+ onBlur: ye
685
710
  }
686
711
  ),
687
- !n && /* @__PURE__ */ B(
688
- rt,
712
+ !n && /* @__PURE__ */ $(
713
+ at,
689
714
  {
690
- dir: A,
691
- lang: R,
715
+ dir: z,
716
+ lang: A,
692
717
  labels: {
693
- closeButtonLabel: a("dialogCloseLabel"),
694
- title: S === f.Image ? a("dialogTitleImage") : S === f.Video ? a("dialogTitleVideo") : S === f.Variable ? a("dialogTitleVariable") : a("dialogTitle")
718
+ closeButtonLabel: i("dialogCloseLabel"),
719
+ title: v === m.Image ? i("dialogTitleImage") : v === m.Video ? i("dialogTitleVideo") : v === m.Variable ? i("dialogTitleVariable") : i("dialogTitle")
695
720
  },
696
721
  children: [
697
- S === f.Image && /* @__PURE__ */ m(
698
- ct,
722
+ v === m.Image && /* @__PURE__ */ p(
723
+ ut,
699
724
  {
700
- value: s?.value,
701
- onSelect: _e,
702
- uploadProps: ye
725
+ value: u?.value,
726
+ onSelect: We,
727
+ uploadProps: Pe
703
728
  }
704
729
  ),
705
- S === f.Video && /* @__PURE__ */ m(
706
- ut,
730
+ v === m.Video && /* @__PURE__ */ p(
731
+ mt,
707
732
  {
708
- value: s?.value,
709
- onSelect: Ge
733
+ value: u?.value,
734
+ onSelect: Ke
710
735
  }
711
736
  )
712
737
  ]
713
738
  }
714
739
  ),
715
- !n && /* @__PURE__ */ m(it, { dir: A, lang: R, children: /* @__PURE__ */ m(
716
- mt,
740
+ !n && !l && /* @__PURE__ */ p(lt, { dir: z, lang: A, children: /* @__PURE__ */ p(
741
+ ft,
717
742
  {
718
- variables: se,
719
- systemVariables: $,
720
- selectedName: s?.value?.variableName,
721
- onSelect: pe,
743
+ variables: ce,
744
+ systemVariables: _,
745
+ selectedName: u?.value?.variableName,
746
+ onSelect: ge,
722
747
  onAddVariable: (e) => {
723
- ee((o) => {
724
- const r = e.name;
725
- return o.some(
726
- (c) => c.name === r
727
- ) ? o : [e, ...o];
748
+ ee((r) => {
749
+ const o = e.name;
750
+ return r.some(
751
+ (c) => c.name === o
752
+ ) ? r : [e, ...r];
728
753
  });
729
754
  }
730
755
  }
@@ -735,6 +760,6 @@ const Le = [], ke = (V, h) => {
735
760
  );
736
761
  };
737
762
  export {
738
- so as default
763
+ ur as default
739
764
  };
740
765
  //# sourceMappingURL=MarkdownFlowEditor.es.js.map