@flowgram.ai/form-materials 0.2.32 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bin/index.ts +11 -5
  2. package/bin/materials.ts +1 -1
  3. package/dist/esm/index.js +1252 -1361
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/index.d.mts +232 -202
  6. package/dist/index.d.ts +232 -202
  7. package/dist/index.js +1396 -1506
  8. package/dist/index.js.map +1 -1
  9. package/package.json +5 -4
  10. package/src/components/batch-variable-selector/config.json +6 -2
  11. package/src/components/batch-variable-selector/index.tsx +1 -1
  12. package/src/components/code-editor/theme/light.ts +1 -1
  13. package/src/components/code-editor-mini/config.json +7 -0
  14. package/src/components/code-editor-mini/index.tsx +31 -0
  15. package/src/components/condition-row/config.json +10 -2
  16. package/src/components/condition-row/hooks/useRule.ts +2 -2
  17. package/src/components/condition-row/index.tsx +1 -1
  18. package/src/components/condition-row/types.ts +3 -1
  19. package/src/components/constant-input/config.json +6 -3
  20. package/src/components/constant-input/index.tsx +10 -71
  21. package/src/components/constant-input/types.ts +6 -10
  22. package/src/components/display-flow-value/config.json +8 -0
  23. package/src/components/display-flow-value/index.tsx +59 -0
  24. package/src/components/display-inputs-values/config.json +9 -0
  25. package/src/components/display-inputs-values/index.tsx +27 -0
  26. package/src/components/display-inputs-values/styles.ts +12 -0
  27. package/src/components/display-outputs/config.json +10 -0
  28. package/src/components/display-outputs/index.tsx +58 -0
  29. package/src/components/display-outputs/styles.ts +12 -0
  30. package/src/components/display-schema-tag/config.json +10 -0
  31. package/src/components/display-schema-tag/index.tsx +44 -0
  32. package/src/components/display-schema-tag/styles.ts +28 -0
  33. package/src/components/display-schema-tree/config.json +11 -0
  34. package/src/components/display-schema-tree/index.tsx +74 -0
  35. package/src/components/display-schema-tree/styles.tsx +90 -0
  36. package/src/components/dynamic-value-input/config.json +11 -2
  37. package/src/components/dynamic-value-input/hooks.ts +53 -0
  38. package/src/components/dynamic-value-input/index.tsx +30 -28
  39. package/src/components/index.ts +6 -0
  40. package/src/components/inputs-values/config.json +2 -1
  41. package/src/components/inputs-values/types.ts +3 -1
  42. package/src/components/json-schema-editor/config.json +3 -3
  43. package/src/components/json-schema-editor/default-value.tsx +1 -1
  44. package/src/components/json-schema-editor/hooks.tsx +1 -1
  45. package/src/components/json-schema-editor/index.tsx +1 -1
  46. package/src/components/json-schema-editor/types.ts +1 -1
  47. package/src/components/type-selector/config.json +6 -2
  48. package/src/components/type-selector/index.tsx +47 -11
  49. package/src/components/variable-selector/config.json +6 -2
  50. package/src/components/variable-selector/index.tsx +1 -1
  51. package/src/components/variable-selector/use-variable-tree.tsx +14 -20
  52. package/src/effects/provide-json-schema-outputs/config.json +4 -5
  53. package/src/effects/provide-json-schema-outputs/index.ts +1 -3
  54. package/src/effects/sync-variable-title/index.ts +1 -0
  55. package/src/form-plugins/infer-inputs-plugin/config.json +3 -1
  56. package/src/form-plugins/infer-inputs-plugin/index.ts +2 -2
  57. package/src/index.ts +1 -1
  58. package/src/{utils → shared}/index.ts +1 -1
  59. package/src/shared/json-schema-preset/config.json +9 -0
  60. package/src/shared/json-schema-preset/create-type-preset-plugin.tsx +26 -0
  61. package/src/shared/json-schema-preset/index.tsx +39 -0
  62. package/src/shared/json-schema-preset/manager.ts +18 -0
  63. package/src/shared/json-schema-preset/type-definition/array.tsx +23 -0
  64. package/src/shared/json-schema-preset/type-definition/boolean.tsx +32 -0
  65. package/src/shared/json-schema-preset/type-definition/index.tsx +24 -0
  66. package/src/shared/json-schema-preset/type-definition/integer.tsx +24 -0
  67. package/src/shared/json-schema-preset/type-definition/number.tsx +24 -0
  68. package/src/shared/json-schema-preset/type-definition/object.tsx +23 -0
  69. package/src/shared/json-schema-preset/type-definition/string.tsx +18 -0
  70. package/src/typings/flow-value/config.json +4 -4
  71. package/src/typings/flow-value/index.ts +1 -1
  72. package/src/typings/index.ts +0 -1
  73. package/src/components/type-selector/constants.tsx +0 -364
  74. package/src/typings/json-schema/config.json +0 -5
  75. package/src/typings/json-schema/index.ts +0 -36
  76. package/src/utils/json-schema/config.json +0 -5
  77. package/src/utils/json-schema/index.ts +0 -180
  78. /package/src/{utils → shared}/format-legacy-refs/config.json +0 -0
  79. /package/src/{utils → shared}/format-legacy-refs/index.ts +0 -0
  80. /package/src/{utils → shared}/format-legacy-refs/readme.md +0 -0
package/dist/esm/index.js CHANGED
@@ -1,552 +1,604 @@
1
1
  // src/components/variable-selector/index.tsx
2
- import React3, { useMemo } from "react";
2
+ import React11, { useMemo } from "react";
3
3
  import { Popover } from "@douyinfe/semi-ui";
4
4
  import { IconChevronDownStroked, IconIssueStroked } from "@douyinfe/semi-icons";
5
5
 
6
6
  // src/components/variable-selector/use-variable-tree.tsx
7
- import React2, { useCallback } from "react";
8
- import { ASTMatch as ASTMatch2, useAvailableVariables } from "@flowgram.ai/editor";
9
- import { Icon as Icon2 } from "@douyinfe/semi-ui";
7
+ import React10, { useCallback } from "react";
8
+ import { JsonSchemaUtils as JsonSchemaUtils2 } from "@flowgram.ai/json-schema";
9
+ import { ASTMatch, useAvailableVariables } from "@flowgram.ai/editor";
10
+ import { Icon } from "@douyinfe/semi-ui";
10
11
 
11
- // src/components/type-selector/constants.tsx
12
+ // src/shared/format-legacy-refs/index.ts
13
+ import { isObject } from "lodash";
14
+ function formatLegacyRefOnSubmit(value) {
15
+ if (isObject(value)) {
16
+ if (isLegacyFlowRefValueSchema(value)) {
17
+ return formatLegacyRefToNewRef(value);
18
+ }
19
+ return Object.fromEntries(
20
+ Object.entries(value).map(([key, value2]) => [
21
+ key,
22
+ formatLegacyRefOnSubmit(value2)
23
+ ])
24
+ );
25
+ }
26
+ if (Array.isArray(value)) {
27
+ return value.map(formatLegacyRefOnSubmit);
28
+ }
29
+ return value;
30
+ }
31
+ function formatLegacyRefOnInit(value) {
32
+ if (isObject(value)) {
33
+ if (isNewFlowRefValueSchema(value)) {
34
+ return formatNewRefToLegacyRef(value);
35
+ }
36
+ return Object.fromEntries(
37
+ Object.entries(value).map(([key, value2]) => [
38
+ key,
39
+ formatLegacyRefOnInit(value2)
40
+ ])
41
+ );
42
+ }
43
+ if (Array.isArray(value)) {
44
+ return value.map(formatLegacyRefOnInit);
45
+ }
46
+ return value;
47
+ }
48
+ function isLegacyFlowRefValueSchema(value) {
49
+ return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
50
+ }
51
+ function isNewFlowRefValueSchema(value) {
52
+ return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
53
+ }
54
+ function formatLegacyRefToNewRef(value) {
55
+ const keyPath = value.content.split(".");
56
+ if (keyPath[1] === "outputs") {
57
+ return {
58
+ type: "ref",
59
+ content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
60
+ };
61
+ }
62
+ return {
63
+ type: "ref",
64
+ content: keyPath
65
+ };
66
+ }
67
+ function formatNewRefToLegacyRef(value) {
68
+ return {
69
+ type: "ref",
70
+ content: value.content.join(".")
71
+ };
72
+ }
73
+
74
+ // src/shared/json-schema-preset/index.tsx
75
+ import React9 from "react";
76
+ import {
77
+ JsonSchemaUtils,
78
+ useTypeManager as useOriginTypeManager,
79
+ TypePresetProvider as OriginTypePresetProvider
80
+ } from "@flowgram.ai/json-schema";
81
+
82
+ // src/shared/json-schema-preset/type-definition/index.tsx
83
+ import { jsonSchemaTypeManager } from "@flowgram.ai/json-schema";
84
+
85
+ // src/shared/json-schema-preset/type-definition/string.tsx
12
86
  import React from "react";
13
- import Icon from "@douyinfe/semi-icons";
14
- var VariableTypeIcons = {
15
- custom: /* @__PURE__ */ React.createElement(
16
- "svg",
87
+ import { Input } from "@douyinfe/semi-ui";
88
+ var stringRegistry = {
89
+ type: "string",
90
+ ConstantRenderer: (props) => /* @__PURE__ */ React.createElement(Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
91
+ };
92
+
93
+ // src/shared/json-schema-preset/type-definition/object.tsx
94
+ import React4 from "react";
95
+
96
+ // src/components/code-editor-mini/index.tsx
97
+ import React3 from "react";
98
+ import styled from "styled-components";
99
+
100
+ // src/components/code-editor/index.tsx
101
+ import React2, { useEffect, useRef } from "react";
102
+ import {
103
+ ActiveLinePlaceholder,
104
+ createRenderer,
105
+ EditorProvider
106
+ } from "@coze-editor/editor/react";
107
+ import preset from "@coze-editor/editor/preset-code";
108
+ import { EditorView } from "@codemirror/view";
109
+
110
+ // src/components/code-editor/utils.ts
111
+ function getSuffixByLanguageId(languageId) {
112
+ if (languageId === "python") {
113
+ return ".py";
114
+ }
115
+ if (languageId === "typescript") {
116
+ return ".ts";
117
+ }
118
+ if (languageId === "shell") {
119
+ return ".sh";
120
+ }
121
+ if (languageId === "json") {
122
+ return ".json";
123
+ }
124
+ return "";
125
+ }
126
+
127
+ // src/components/code-editor/language-features.ts
128
+ import { languages } from "@coze-editor/editor/preset-code";
129
+ import { typescript } from "@coze-editor/editor/language-typescript";
130
+ import { shell } from "@coze-editor/editor/language-shell";
131
+ import { python } from "@coze-editor/editor/language-python";
132
+ import { json } from "@coze-editor/editor/language-json";
133
+ import { mixLanguages } from "@coze-editor/editor";
134
+ languages.register("python", python);
135
+ languages.register("shell", shell);
136
+ languages.register("typescript", typescript);
137
+ languages.register("json", {
138
+ // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
139
+ language: mixLanguages({
140
+ outerLanguage: json.language
141
+ }),
142
+ languageService: json.languageService
143
+ });
144
+ var tsWorkerInit = false;
145
+ var initTsWorker = () => {
146
+ if (tsWorkerInit) {
147
+ return;
148
+ }
149
+ tsWorkerInit = true;
150
+ const tsWorker = new Worker(
151
+ new URL(`@coze-editor/editor/language-typescript/worker`, import.meta.url),
152
+ { type: "module" }
153
+ );
154
+ typescript.languageService.initialize(tsWorker, {
155
+ compilerOptions: {
156
+ // eliminate Promise error
157
+ lib: ["es2015", "dom"],
158
+ noImplicitAny: false
159
+ }
160
+ });
161
+ };
162
+
163
+ // src/components/code-editor/theme/index.ts
164
+ import { themes } from "@coze-editor/editor/preset-code";
165
+
166
+ // src/components/code-editor/theme/light.ts
167
+ import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
168
+ var colors = {
169
+ background: "#F7F7FC",
170
+ // syntax
171
+ comment: "#000A298A",
172
+ key: "#00818C",
173
+ string: "#D1009D",
174
+ number: "#C74200",
175
+ boolean: "#2B57D9",
176
+ null: "#2B57D9",
177
+ separator: "#0F1529D1"
178
+ };
179
+ var lightTheme = createTheme({
180
+ variant: "light",
181
+ settings: {
182
+ background: "#fff",
183
+ foreground: "#000",
184
+ caret: "#000",
185
+ selection: "#d9d9d9",
186
+ gutterBackground: "#f0f0f0",
187
+ gutterForeground: "#666",
188
+ gutterBorderColor: "transparent",
189
+ gutterBorderWidth: 0,
190
+ lineHighlight: "#e1e1e180",
191
+ bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
192
+ tooltip: {
193
+ backgroundColor: "#f0f0f0",
194
+ color: "#000",
195
+ border: "1px solid #ccc"
196
+ },
197
+ link: {
198
+ color: "#007bff"
199
+ },
200
+ completionItemHover: {
201
+ backgroundColor: "#f0f0f0"
202
+ },
203
+ completionItemSelected: {
204
+ backgroundColor: "#e0e0e0"
205
+ },
206
+ completionItemIcon: {
207
+ color: "#333"
208
+ },
209
+ completionItemLabel: {
210
+ color: "#333"
211
+ },
212
+ completionItemInfo: {
213
+ color: "#333"
214
+ },
215
+ completionItemDetail: {
216
+ color: "#666"
217
+ }
218
+ },
219
+ styles: [
220
+ // JSON
17
221
  {
18
- viewBox: "0 0 24 24",
19
- fill: "none",
20
- xmlns: "http://www.w3.org/2000/svg",
21
- width: "1em",
22
- height: "1em",
23
- focusable: "false",
24
- "aria-hidden": "true"
222
+ tag: t.comment,
223
+ color: colors.comment
25
224
  },
26
- /* @__PURE__ */ React.createElement(
27
- "path",
28
- {
29
- fillRule: "evenodd",
30
- clipRule: "evenodd",
31
- d: "M5.1 18L4.5032 20.1702C4.24999 21.0909 4.94281 22 5.89773 22C6.54881 22 7.11964 21.565 7.29227 20.9372L8.1 18H12.1L11.5032 20.1702C11.25 21.0909 11.9428 22 12.8977 22C13.5488 22 14.1196 21.565 14.2923 20.9372L15.1 18H19.5C20.3284 18 21 17.3284 21 16.5C21 15.6716 20.3284 15 19.5 15H15.925L17.575 9H20.5C21.3284 9 22 8.32843 22 7.5C22 6.67157 21.3284 6 20.5 6H18.4L18.9968 3.8298C19.25 2.90906 18.5572 2 17.6023 2C16.9512 2 16.3804 2.43504 16.2077 3.06281L15.4 6H11.4L11.9968 3.8298C12.25 2.90906 11.5572 2 10.6023 2C9.95119 2 9.38036 2.43504 9.20773 3.06281L8.4 6H4.5C3.67157 6 3 6.67157 3 7.5C3 8.32843 3.67157 9 4.5 9H7.575L5.925 15H3.5C2.67157 15 2 15.6716 2 16.5C2 17.3284 2.67157 18 3.5 18H5.1ZM8.925 15L10.575 9H14.575L12.925 15H8.925Z",
32
- fill: "currentColor"
33
- }
34
- )
35
- ),
36
- object: /* @__PURE__ */ React.createElement(
37
- "svg",
38
225
  {
39
- width: "1em",
40
- height: "1em",
41
- viewBox: "0 0 16 16",
42
- fill: "none",
43
- xmlns: "http://www.w3.org/2000/svg"
226
+ tag: [t.propertyName],
227
+ color: colors.key
44
228
  },
45
- /* @__PURE__ */ React.createElement(
46
- "path",
47
- {
48
- d: "M5.33893 1.5835C5.66613 1.5835 5.93137 1.88142 5.93137 2.20862C5.93137 2.53582 5.66613 2.76838 5.33893 2.76838H4.9099C4.34717 2.76838 4.08062 3.07557 4.08062 3.71921V6.58633C4.08062 7.30996 3.80723 7.84734 3.26798 8.19105C3.11426 8.28902 3.10884 8.55273 3.26068 8.65359C3.80476 9.01503 4.08062 9.53994 4.08062 10.2434V13.1251C4.08062 13.7395 4.34717 14.0613 4.9099 14.0613H5.33893C5.66613 14.0613 5.93137 14.3435 5.93137 14.6707C5.93137 14.9979 5.66613 15.2462 5.33893 15.2462H4.64335C3.99177 15.2462 3.48828 15.0268 3.13287 14.6172C2.80708 14.2369 2.64419 13.7103 2.64419 13.0666V10.3165C2.64419 9.8923 2.55534 9.58511 2.37764 9.39494C2.26816 9.27135 1.80618 9.17938 1.38154 9.11602C1.02726 9.06315 0.759057 8.76744 0.765747 8.4093C0.772379 8.0543 1.03439 7.7566 1.38545 7.70346C1.80778 7.63952 2.26906 7.54968 2.37764 7.43477C2.55534 7.22997 2.64419 6.92278 2.64419 6.51319V3.77772C2.64419 3.11945 2.80708 2.59284 3.13287 2.21251C3.48828 1.78829 3.99177 1.5835 4.64335 1.5835H5.33893Z",
49
- fill: "currentColor"
50
- }
51
- ),
52
- /* @__PURE__ */ React.createElement(
53
- "path",
54
- {
55
- d: "M10.962 15.2463C10.6348 15.2463 10.3696 14.9483 10.3696 14.6211C10.3696 14.2939 10.6348 14.0614 10.962 14.0614H11.391C11.9538 14.0614 12.2203 13.7542 12.2203 13.1105V10.2434C12.2203 9.51979 12.4937 8.98241 13.033 8.6387C13.1867 8.54073 13.1921 8.27703 13.0403 8.17616C12.4962 7.81472 12.2203 7.28982 12.2203 6.58638V3.70463C12.2203 3.09024 11.9538 2.76842 11.391 2.76842L10.962 2.76842C10.6348 2.76842 10.3696 2.48627 10.3696 2.15907C10.3696 1.83188 10.6348 1.58354 10.962 1.58354L11.6576 1.58354C12.3092 1.58354 12.8127 1.80296 13.1681 2.21255C13.4939 2.59289 13.6568 3.1195 13.6568 3.76314V6.51324C13.6568 6.93745 13.7456 7.24464 13.9233 7.43481C14.03 7.5553 14.4328 7.64858 14.8186 7.71393C15.1718 7.77376 15.4401 8.06977 15.4334 8.42791C15.4268 8.78291 15.1646 9.08018 14.814 9.13633C14.4306 9.19774 14.0291 9.28303 13.9233 9.39499C13.7456 9.59978 13.6568 9.90697 13.6568 10.3166V13.052C13.6568 13.7103 13.4939 14.2369 13.1681 14.6172C12.8127 15.0415 12.3092 15.2463 11.6576 15.2463H10.962Z",
56
- fill: "currentColor"
57
- }
58
- )
59
- ),
60
- boolean: /* @__PURE__ */ React.createElement(
61
- "svg",
62
229
  {
63
- width: "1em",
64
- height: "1em",
65
- viewBox: "0 0 16 16",
66
- fill: "none",
67
- xmlns: "http://www.w3.org/2000/svg"
230
+ tag: [t.string],
231
+ color: colors.string
68
232
  },
69
- /* @__PURE__ */ React.createElement(
70
- "path",
71
- {
72
- fillRule: "evenodd",
73
- clipRule: "evenodd",
74
- d: "M10.668 4.66683H5.33463C3.49369 4.66683 2.0013 6.15921 2.0013 8.00016C2.0013 9.84111 3.49369 11.3335 5.33463 11.3335H10.668C12.5089 11.3335 14.0013 9.84111 14.0013 8.00016C14.0013 6.15921 12.5089 4.66683 10.668 4.66683ZM5.33463 3.3335C2.75731 3.3335 0.667969 5.42283 0.667969 8.00016C0.667969 10.5775 2.75731 12.6668 5.33463 12.6668H10.668C13.2453 12.6668 15.3346 10.5775 15.3346 8.00016C15.3346 5.42283 13.2453 3.3335 10.668 3.3335H5.33463Z",
75
- fill: "currentColor"
76
- }
77
- ),
78
- /* @__PURE__ */ React.createElement(
79
- "path",
80
- {
81
- fillRule: "evenodd",
82
- clipRule: "evenodd",
83
- d: "M8.66797 8.00016C8.66797 6.89559 9.5634 6.00016 10.668 6.00016C11.7725 6.00016 12.668 6.89559 12.668 8.00016C12.668 9.10473 11.7725 10.0002 10.668 10.0002C9.5634 10.0002 8.66797 9.10473 8.66797 8.00016ZM10.668 7.3335C10.2998 7.3335 10.0013 7.63197 10.0013 8.00016C10.0013 8.36835 10.2998 8.66683 10.668 8.66683C11.0362 8.66683 11.3346 8.36835 11.3346 8.00016C11.3346 7.63197 11.0362 7.3335 10.668 7.3335Z",
84
- fill: "currentColor"
85
- }
86
- )
87
- ),
88
- string: /* @__PURE__ */ React.createElement(
89
- "svg",
90
233
  {
91
- width: "1em",
92
- height: "1em",
93
- viewBox: "0 0 16 16",
94
- fill: "none",
95
- xmlns: "http://www.w3.org/2000/svg"
234
+ tag: [t.number],
235
+ color: colors.number
96
236
  },
97
- /* @__PURE__ */ React.createElement(
98
- "path",
99
- {
100
- d: "M9.3342 3.33321C8.96601 3.33321 8.66753 3.63169 8.66753 3.99988C8.66753 4.36807 8.96601 4.66655 9.3342 4.66655H14.6675C15.0357 4.66655 15.3342 4.36807 15.3342 3.99988C15.3342 3.63169 15.0357 3.33321 14.6675 3.33321H9.3342Z",
101
- fill: "currentColor"
102
- }
103
- ),
104
- /* @__PURE__ */ React.createElement(
105
- "path",
106
- {
107
- d: "M10.0009 7.99988C10.0009 7.63169 10.2993 7.33321 10.6675 7.33321H14.6675C15.0357 7.33321 15.3342 7.63169 15.3342 7.99988C15.3342 8.36807 15.0357 8.66655 14.6675 8.66655H10.6675C10.2993 8.66655 10.0009 8.36807 10.0009 7.99988Z",
108
- fill: "currentColor"
109
- }
110
- ),
111
- /* @__PURE__ */ React.createElement(
112
- "path",
113
- {
114
- d: "M12.0009 11.3332C11.6327 11.3332 11.3342 11.6317 11.3342 11.9999C11.3342 12.3681 11.6327 12.6665 12.0009 12.6665H14.6675C15.0357 12.6665 15.3342 12.3681 15.3342 11.9999C15.3342 11.6317 15.0357 11.3332 14.6675 11.3332H12.0009Z",
115
- fill: "currentColor"
116
- }
117
- ),
118
- /* @__PURE__ */ React.createElement(
119
- "path",
120
- {
121
- d: "M9.86659 14.1482L8.23444 10.1844H3.18136C3.13868 10.1844 3.09685 10.1808 3.05616 10.1738L1.66589 14.1129C1.53049 14.4965 1.10971 14.6978 0.726058 14.5624C0.342408 14.427 0.141166 14.0062 0.276572 13.6225L4.37566 2.00848C4.71323 1.05202 6.05321 1.01763 6.4394 1.95552L11.2289 13.5872C11.3838 13.9634 11.2044 14.394 10.8282 14.5489C10.452 14.7038 10.0215 14.5244 9.86659 14.1482ZM5.44412 3.40791L3.57241 8.71109H7.62778L5.44412 3.40791Z",
122
- fill: "currentColor"
123
- }
124
- )
125
- ),
126
- integer: /* @__PURE__ */ React.createElement(
127
- "svg",
128
237
  {
129
- width: "1em",
130
- height: "1em",
131
- viewBox: "0 0 16 16",
132
- fill: "none",
133
- xmlns: "http://www.w3.org/2000/svg"
238
+ tag: [t.bool],
239
+ color: colors.boolean
134
240
  },
135
- /* @__PURE__ */ React.createElement(
136
- "path",
137
- {
138
- d: "M15.132 11.4601C15.644 11.0121 15.9 10.3921 15.9 9.60007C15.9 8.60807 15.5 7.93607 14.7 7.58407C15.412 7.23207 15.768 6.62407 15.768 5.76007C15.768 5.05607 15.536 4.48007 15.072 4.03207C14.608 3.59207 14.012 3.37207 13.284 3.37207C12.588 3.37207 12.008 3.58007 11.544 3.99607C11.064 4.42007 10.808 4.98807 10.776 5.70007H12C12.064 4.88407 12.492 4.47607 13.284 4.47607C14.124 4.47607 14.544 4.91607 14.544 5.79607C14.544 6.66007 14.112 7.09207 13.248 7.09207H13.044V8.16007H13.248C14.2 8.16007 14.676 8.62807 14.676 9.56407C14.676 10.5081 14.212 10.9801 13.284 10.9801C12.9 10.9801 12.584 10.8761 12.336 10.6681C12.064 10.4441 11.916 10.1161 11.892 9.68407H10.668C10.692 10.4761 10.964 11.0841 11.484 11.5081C11.948 11.8921 12.548 12.0841 13.284 12.0841C14.036 12.0841 14.652 11.8761 15.132 11.4601Z",
139
- fill: "currentColor"
140
- }
141
- ),
142
- /* @__PURE__ */ React.createElement(
143
- "path",
144
- {
145
- d: "M4.46875 12.0003V10.9083L7.75675 6.91228C8.06075 6.54428 8.21275 6.16428 8.21275 5.77228C8.21275 4.90828 7.79675 4.47628 6.96475 4.47628C6.60475 4.47628 6.31275 4.57628 6.08875 4.77628C5.83275 5.00828 5.70475 5.34828 5.70475 5.79628H4.48075C4.48075 5.07628 4.71275 4.49228 5.17675 4.04428C5.64075 3.60428 6.23675 3.38428 6.96475 3.38428C7.70075 3.38428 8.29675 3.60028 8.75275 4.03228C9.20875 4.47228 9.43675 5.05628 9.43675 5.78428C9.43675 6.13628 9.36875 6.45628 9.23275 6.74428C9.12075 6.97628 8.92075 7.27228 8.63275 7.63228L5.95675 10.9083H9.43675V12.0003H4.46875Z",
146
- fill: "currentColor"
147
- }
148
- ),
149
- /* @__PURE__ */ React.createElement(
150
- "path",
151
- {
152
- d: "M1.668 12.0001V4.78805L0 6.25205V4.89605L1.668 3.45605H2.892V12.0001H1.668Z",
153
- fill: "currentColor"
154
- }
155
- )
156
- ),
157
- number: /* @__PURE__ */ React.createElement(
158
- "svg",
159
241
  {
160
- width: "1em",
161
- height: "1em",
162
- viewBox: "0 0 16 16",
163
- fill: "none",
164
- xmlns: "http://www.w3.org/2000/svg"
242
+ tag: [t.null],
243
+ color: colors.null
165
244
  },
166
- /* @__PURE__ */ React.createElement(
167
- "path",
168
- {
169
- d: "M3.44151 5.3068C3.44151 3.83404 4.71542 2.64014 6.18818 2.64014C7.66094 2.64014 8.93484 3.83404 8.93484 5.3068V10.6135C8.93484 12.0862 7.66094 13.2801 6.18818 13.2801C4.71542 13.2801 3.44151 12.0862 3.44151 10.6135V5.3068ZM7.60151 5.3068C7.60151 4.57042 6.92456 3.97347 6.18818 3.97347C5.4518 3.97347 4.77484 4.57042 4.77484 5.3068V10.6135C4.77484 11.3498 5.4518 11.9468 6.18818 11.9468C6.92456 11.9468 7.60151 11.3498 7.60151 10.6135V5.3068Z",
170
- fill: "currentColor"
171
- }
172
- ),
173
- /* @__PURE__ */ React.createElement(
174
- "path",
175
- {
176
- d: "M12.9882 2.64014C11.5154 2.64014 10.2415 3.83404 10.2415 5.3068V10.6135C10.2415 12.0862 11.5154 13.2801 12.9882 13.2801C14.4609 13.2801 15.7348 12.0862 15.7348 10.6135V5.3068C15.7348 3.83404 14.4609 2.64014 12.9882 2.64014ZM14.4015 10.6135C14.4015 11.3498 13.7246 11.9468 12.9882 11.9468C12.2518 11.9468 11.5748 11.3498 11.5748 10.6135V5.3068C11.5748 4.57042 12.2518 3.97347 12.9882 3.97347C13.7246 3.97347 14.4015 4.57042 14.4015 5.3068V10.6135Z",
177
- fill: "currentColor"
178
- }
179
- ),
180
- /* @__PURE__ */ React.createElement(
181
- "path",
182
- {
183
- d: "M1.21484 13.2001C1.76713 13.2001 2.21484 12.7524 2.21484 12.2001C2.21484 11.6479 1.76713 11.2001 1.21484 11.2001C0.662559 11.2001 0.214844 11.6479 0.214844 12.2001C0.214844 12.7524 0.662559 13.2001 1.21484 13.2001Z",
184
- fill: "currentColor"
185
- }
186
- )
187
- ),
188
- array: /* @__PURE__ */ React.createElement(
189
- "svg",
190
245
  {
191
- width: "1em",
192
- height: "1em",
193
- viewBox: "0 0 16 16",
194
- fill: "none",
195
- xmlns: "http://www.w3.org/2000/svg"
246
+ tag: [t.separator],
247
+ color: colors.separator
196
248
  },
197
- /* @__PURE__ */ React.createElement(
198
- "path",
199
- {
200
- d: "M5.23759 1.00342H2.00391V14.997H5.23759V13.6251H3.35127V2.37534H5.23759V1.00342Z",
201
- fill: "currentColor"
202
- }
203
- ),
204
- /* @__PURE__ */ React.createElement(
205
- "path",
206
- {
207
- d: "M10.7624 1.00342H13.9961V14.997H10.7624V13.6251H12.6487V2.37534H10.7624V1.00342Z",
208
- fill: "currentColor"
209
- }
210
- )
211
- ),
212
- stream: /* @__PURE__ */ React.createElement(
213
- "svg",
249
+ // markdown
214
250
  {
215
- viewBox: "0 0 1024 1024",
216
- version: "1.1",
217
- xmlns: "http://www.w3.org/2000/svg",
218
- width: "1em",
219
- height: "1em"
251
+ tag: [t.heading],
252
+ color: "#3e76ef"
220
253
  },
221
- /* @__PURE__ */ React.createElement(
222
- "path",
223
- {
224
- d: "M879.674 544.51l-158.254-0.221c-8.534 2.287-17.305-2.776-19.588-11.307l-23.862-75.877-74.742 350.891c0 0-1.523 18.507-11.518 18.507s-26.9 0.281-26.9 0.281c-8.259 2.213-16.748-2.687-18.961-10.949l-92.741-457.648-70.305 330.634c-2.261 8.291-11.94 15.206-20.385 12.986l-24.876 0.339c-8.723 2.293-17.685-2.789-20.023-11.349L270.629 544.51 143.993 544.51c-8.831 0-15.993-7.159-15.993-15.993l0-31.986c0-8.831 7.162-15.993 15.993-15.993l157.429-0.516c9.565-0.304 17.685 0.788 20.023 9.351l24.386 76.092 68.642-358.907c0 0 3.4-10.894 14.397-10.894 10.994 0 34.107-0.448 34.107-0.448 8.262-2.213 16.751 2.687 18.965 10.949l91.912 454.126 67.948-326.182c2.213-8.262 8.707-15.161 16.965-12.948l27.316-0.333c8.531-2.287 17.301 2.776 19.588 11.31l46.665 148.4 127.337 0c8.835 0 15.993 7.162 15.993 15.993l0 31.986C895.667 537.352 888.508 544.51 879.674 544.51z",
225
- fill: "currentColor"
226
- }
227
- )
228
- ),
229
- map: /* @__PURE__ */ React.createElement(
230
- "svg",
231
254
  {
232
- viewBox: "0 0 1024 1024",
233
- version: "1.1",
234
- xmlns: "http://www.w3.org/2000/svg",
235
- width: "1em",
236
- height: "1em"
255
+ tag: [t.processingInstruction],
256
+ color: "#3e76ef"
237
257
  },
238
- /* @__PURE__ */ React.createElement(
239
- "path",
240
- {
241
- d: "M877.860571 938.642286h-645.851428c-27.574857 0-54.052571-11.337143-73.508572-31.744a110.957714 110.957714 0 0 1-30.500571-76.8V193.828571c0-28.745143 10.971429-56.32 30.500571-76.726857a101.888 101.888 0 0 1 73.508572-31.817143h574.171428c27.501714 0 53.979429 11.337143 73.508572 31.744 19.529143 20.333714 30.500571 48.054857 30.500571 76.8v522.020572a34.157714 34.157714 0 0 1-6.948571 22.820571c-37.156571 19.382857-57.636571 39.350857-57.636572 72.630857 0 39.716571 19.894857 50.029714 57.636572 72.777143a34.816 34.816 0 0 1-8.045714 49.298286 32.256 32.256 0 0 1-17.334858 5.193143z m-32.256-254.537143V193.828571a40.228571 40.228571 0 0 0-39.497142-41.179428H232.009143a40.301714 40.301714 0 0 0-39.497143 41.252571V699.245714c17.773714-9.874286 37.449143-14.994286 57.417143-14.921143h595.675428v-0.073142z m-595.675428 187.245714h566.198857c-22.893714-11.190857-27.940571-39.497143-28.013714-59.977143 0-20.260571 3.218286-43.885714 28.013714-59.904h-566.125714c-31.670857 0-57.417143 26.843429-57.417143 59.977143 0 33.060571 25.746286 59.904 57.344 59.904z",
242
- fill: "currentColor"
243
- }
244
- ),
245
- /* @__PURE__ */ React.createElement(
246
- "path",
247
- {
248
- d: "M320 128m32.036571 0l-0.073142 0q32.036571 0 32.036571 32.036571l0 511.926858q0 32.036571-32.036571 32.036571l0.073142 0q-32.036571 0-32.036571-32.036571l0-511.926858q0-32.036571 32.036571-32.036571Z",
249
- fill: "currentColor"
250
- }
251
- )
252
- )
258
+ // shell
259
+ // curl
260
+ {
261
+ tag: [t.standard(t.variableName)],
262
+ color: "#00804A"
263
+ },
264
+ // -X
265
+ {
266
+ tag: [t.attributeName],
267
+ color: "#C74200"
268
+ },
269
+ // url in string (includes quotes), e.g. "https://..."
270
+ {
271
+ tag: [t.special(t.string)],
272
+ color: "#2B57D9"
273
+ }
274
+ ]
275
+ });
276
+
277
+ // src/components/code-editor/theme/dark.ts
278
+ import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
279
+ var colors2 = {
280
+ background: "#151B27",
281
+ // syntax
282
+ comment: "#FFFFFF63",
283
+ key: "#39E5D7",
284
+ string: "#FF94D2",
285
+ number: "#FF9933",
286
+ boolean: "#78B0FF",
287
+ null: "#78B0FF",
288
+ separator: "#FFFFFFC9"
253
289
  };
254
- var ArrayIcons = {
255
- object: /* @__PURE__ */ React.createElement(
256
- "svg",
290
+ var darkTheme = createTheme2({
291
+ variant: "dark",
292
+ settings: {
293
+ background: colors2.background,
294
+ foreground: "#fff",
295
+ caret: "#AEAFAD",
296
+ selection: "#d9d9d942",
297
+ gutterBackground: colors2.background,
298
+ gutterForeground: "#FFFFFF63",
299
+ gutterBorderColor: "transparent",
300
+ gutterBorderWidth: 0,
301
+ lineHighlight: "#272e3d36",
302
+ bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
303
+ tooltip: {
304
+ backgroundColor: "#363D4D",
305
+ color: "#fff",
306
+ border: "none"
307
+ },
308
+ link: {
309
+ color: "#4daafc"
310
+ },
311
+ completionItemHover: {
312
+ backgroundColor: "#FFFFFF0F"
313
+ },
314
+ completionItemSelected: {
315
+ backgroundColor: "#FFFFFF17"
316
+ },
317
+ completionItemIcon: {
318
+ color: "#FFFFFFC9"
319
+ },
320
+ completionItemLabel: {
321
+ color: "#FFFFFFC9"
322
+ },
323
+ completionItemInfo: {
324
+ color: "#FFFFFFC9"
325
+ },
326
+ completionItemDetail: {
327
+ color: "#FFFFFF63"
328
+ }
329
+ },
330
+ styles: [
331
+ // json
257
332
  {
258
- width: "1em",
259
- height: "1em",
260
- viewBox: "0 0 16 16",
261
- fill: "none",
262
- xmlns: "http://www.w3.org/2000/svg"
333
+ tag: t2.comment,
334
+ color: colors2.comment
263
335
  },
264
- /* @__PURE__ */ React.createElement(
265
- "path",
266
- {
267
- fillRule: "evenodd",
268
- clipRule: "evenodd",
269
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM3.82031 5.9091C3.82031 5.18535 4.40703 4.59863 5.13078 4.59863C5.85453 4.59863 6.44124 5.18535 6.44124 5.9091C6.44124 6.56485 5.9596 7.1081 5.33078 7.2044V8.70018H5.32877C5.32982 8.75093 5.33078 8.80912 5.33078 8.87034V9.72111C5.33078 10.0195 5.57268 10.2614 5.87109 10.2614H6.24124C6.55613 10.2614 6.8114 10.5167 6.8114 10.8316C6.8114 11.1465 6.55613 11.4017 6.24124 11.4017H5.87109C4.94291 11.4017 4.19047 10.6493 4.19047 9.72111V6.82186C3.96158 6.58607 3.82031 6.26397 3.82031 5.9091ZM7.33679 5.9091C7.33679 5.59421 7.59205 5.33894 7.90694 5.33894H11.6085C11.9234 5.33894 12.1786 5.59421 12.1786 5.9091C12.1786 6.22399 11.9234 6.47925 11.6085 6.47925H7.90694C7.59205 6.47925 7.33679 6.22399 7.33679 5.9091ZM7.33679 9.86846C7.33679 9.55357 7.59205 9.2983 7.90694 9.2983H11.6085C11.9234 9.2983 12.1786 9.55357 12.1786 9.86846C12.1786 10.1833 11.9234 10.4386 11.6085 10.4386H7.90694C7.59205 10.4386 7.33679 10.1833 7.33679 9.86846Z",
270
- fill: "currentColor"
271
- }
272
- )
273
- ),
274
- boolean: /* @__PURE__ */ React.createElement(
275
- "svg",
276
336
  {
277
- width: "1em",
278
- height: "1em",
279
- viewBox: "0 0 16 16",
280
- fill: "none",
281
- xmlns: "http://www.w3.org/2000/svg"
337
+ tag: [t2.propertyName],
338
+ color: colors2.key
282
339
  },
283
- /* @__PURE__ */ React.createElement(
284
- "path",
285
- {
286
- fillRule: "evenodd",
287
- clipRule: "evenodd",
288
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM2.75 7.99993C2.75 6.14518 4.25358 4.6416 6.10833 4.6416H9.775C11.6298 4.6416 13.1333 6.14518 13.1333 7.99993C13.1333 9.85469 11.6298 11.3583 9.775 11.3583H6.10833C4.25358 11.3583 2.75 9.85469 2.75 7.99993ZM6.10833 5.85827C4.92552 5.85827 3.96667 6.81713 3.96667 7.99993C3.96667 9.18274 4.92552 10.1416 6.10833 10.1416H9.775C10.9578 10.1416 11.9167 9.18274 11.9167 7.99993C11.9167 6.81713 10.9578 5.85827 9.775 5.85827H6.10833ZM8.25 7.99993C8.25 7.1577 8.93277 6.47493 9.775 6.47493C10.6172 6.47493 11.3 7.1577 11.3 7.99993C11.3 8.84217 10.6172 9.52493 9.775 9.52493C8.93277 9.52493 8.25 8.84217 8.25 7.99993ZM9.775 7.6916C9.60471 7.6916 9.46667 7.82965 9.46667 7.99993C9.46667 8.17022 9.60471 8.30827 9.775 8.30827C9.94529 8.30827 10.0833 8.17022 10.0833 7.99993C10.0833 7.82965 9.94529 7.6916 9.775 7.6916Z",
289
- fill: "currentColor"
290
- }
291
- )
292
- ),
293
- string: /* @__PURE__ */ React.createElement(
294
- "svg",
295
340
  {
296
- width: "1em",
297
- height: "1em",
298
- viewBox: "0 0 16 16",
299
- fill: "none",
300
- xmlns: "http://www.w3.org/2000/svg"
341
+ tag: [t2.string],
342
+ color: colors2.string
301
343
  },
302
- /* @__PURE__ */ React.createElement(
303
- "path",
304
- {
305
- fillRule: "evenodd",
306
- clipRule: "evenodd",
307
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM5.23701 4.07158C5.50364 3.3161 6.56205 3.28894 6.86709 4.02974L10 11.6383C10.1329 11.9609 9.979 12.3302 9.65631 12.4631C9.33363 12.596 8.96434 12.4421 8.83147 12.1194L7.8021 9.61951H4.61903L3.7474 12.0891C3.63126 12.4182 3.27034 12.5908 2.94127 12.4747C2.6122 12.3585 2.43958 11.9976 2.55573 11.6685L5.23701 4.07158ZM6.08814 5.45704L5.06505 8.35579H7.28174L6.08814 5.45704ZM8.81938 6.07534C8.81938 5.75166 9.08177 5.48926 9.40545 5.48926H12.8941C13.2178 5.48926 13.4802 5.75166 13.4802 6.07534C13.4802 6.39902 13.2178 6.66142 12.8941 6.66142H9.40545C9.08177 6.66142 8.81938 6.39902 8.81938 6.07534ZM10.2668 9.69181C10.2668 9.36812 10.5292 9.10573 10.8529 9.10573H12.8941C13.2178 9.10573 13.4802 9.36812 13.4802 9.69181C13.4802 10.0155 13.2178 10.2779 12.8941 10.2779H10.8529C10.5292 10.2779 10.2668 10.0155 10.2668 9.69181Z",
308
- fill: "currentColor"
309
- }
310
- )
311
- ),
312
- integer: /* @__PURE__ */ React.createElement(
313
- "svg",
314
344
  {
315
- width: "1em",
316
- height: "1em",
317
- viewBox: "0 0 16 16",
318
- fill: "none",
319
- xmlns: "http://www.w3.org/2000/svg"
345
+ tag: [t2.number],
346
+ color: colors2.number
320
347
  },
321
- /* @__PURE__ */ React.createElement(
322
- "path",
323
- {
324
- fillRule: "evenodd",
325
- clipRule: "evenodd",
326
- d: "M0 1.58105H3.6139V2.87326H1.36702V13.1264H3.6139V14.4186H0V1.58105ZM3.41656 13.3264V13.3266H1.17155V13.3264H3.41656ZM0.197344 14.2186H0.199219V1.78125H3.41656V1.78105H0.197344V14.2186ZM12.3861 1.58105H16V14.4186H12.3861V13.1264H14.633V2.87326H12.3861V1.58105ZM12.5834 2.67326V1.78105H15.8027V1.78125H12.5853V2.67326H12.5834ZM12.5853 13.3266V14.2186H12.5834V13.3264H14.8303V2.67345H14.8322V13.3266H12.5853ZM10.3614 5.22374C10.7161 4.90585 11.1581 4.75 11.6762 4.75C12.2173 4.75 12.6723 4.91467 13.0281 5.25207L13.0291 5.253C13.3852 5.59688 13.561 6.03946 13.561 6.56767C13.561 6.89 13.4945 7.17448 13.3539 7.41445C13.2572 7.57972 13.1279 7.71948 12.9685 7.83428C13.1575 7.95643 13.3099 8.11182 13.4225 8.30109C13.5793 8.5644 13.6531 8.88311 13.6531 9.24936C13.6531 9.83787 13.4612 10.3151 13.0656 10.6612C12.6982 10.9795 12.2305 11.1341 11.6762 11.1341C11.1356 11.1341 10.6805 10.9925 10.324 10.6977C9.92124 10.3691 9.71723 9.90026 9.69942 9.31256L9.69473 9.15802H10.846L10.8539 9.2997C10.8689 9.5698 10.9591 9.75553 11.1096 9.87941L11.1106 9.88027C11.2519 9.99882 11.4365 10.0631 11.6762 10.0631C11.9765 10.0631 12.1743 9.98692 12.2984 9.86071C12.4229 9.73404 12.4984 9.53136 12.4984 9.22422C12.4984 8.92116 12.4215 8.72127 12.2939 8.59581C12.1658 8.46989 11.961 8.39373 11.6511 8.39373H11.3586V7.34788H11.6511C11.9297 7.34788 12.111 7.27834 12.2238 7.16555C12.3366 7.05276 12.4062 6.87138 12.4062 6.59281C12.4062 6.30696 12.3378 6.12041 12.2277 6.00501C12.1188 5.89092 11.9446 5.82098 11.6762 5.82098C11.4248 5.82098 11.2539 5.88537 11.1407 5.99325C11.0268 6.10185 10.9497 6.27522 10.9291 6.5375L10.9183 6.67577H9.76788L9.77492 6.51904C9.79886 5.98644 9.99237 5.54989 10.3614 5.22374ZM5.91032 5.26037C6.26612 4.92297 6.72112 4.7583 7.26219 4.7583C7.80751 4.7583 8.26297 4.91938 8.61401 5.25194L8.61501 5.25289C8.96719 5.59272 9.13852 6.04185 9.13852 6.58435C9.13852 6.84997 9.08709 7.09565 8.9817 7.31883L8.98114 7.31999C8.89563 7.49712 8.74775 7.71415 8.54418 7.96862L8.54322 7.96981L6.87446 10.0127H9.13852V11.0753H5.36909V10.1089L7.69946 7.27679C7.89456 7.04062 7.98374 6.80773 7.98374 6.57597C7.98374 6.29602 7.91626 6.11385 7.8078 6.00122C7.70036 5.88964 7.52811 5.8209 7.26219 5.8209C7.04017 5.8209 6.87439 5.88173 6.75075 5.99193C6.61227 6.11766 6.53226 6.30918 6.53226 6.59273V6.74273H5.37747V6.59273C5.37747 6.05443 5.55248 5.60586 5.90934 5.2613L5.91032 5.26037ZM3.50907 4.80865H4.56964V11.0754H3.41486V6.2201L2.25 7.24249V5.89561L3.50907 4.80865Z",
327
- fill: "currentColor"
328
- }
329
- )
330
- ),
331
- number: /* @__PURE__ */ React.createElement(
332
- "svg",
333
348
  {
334
- width: "1em",
335
- height: "1em",
336
- viewBox: "0 0 16 16",
337
- fill: "none",
338
- xmlns: "http://www.w3.org/2000/svg"
349
+ tag: [t2.bool],
350
+ color: colors2.boolean
339
351
  },
340
- /* @__PURE__ */ React.createElement(
341
- "path",
342
- {
343
- fillRule: "evenodd",
344
- clipRule: "evenodd",
345
- d: "M3.6139 1.58154H0V14.4191H3.6139V13.1269H1.36702V2.87375H3.6139V1.58154ZM3.41656 13.3271V13.3269H1.17155V13.3271H3.41656ZM0.199219 14.2191H0.197344V1.78154H3.41656V1.78174H0.199219V14.2191ZM16 1.58154H12.3861V2.87375H14.633V13.1269H12.3861V14.4191H16V1.58154ZM12.5834 1.78154V2.67375H12.5853V1.78174H15.8027V1.78154H12.5834ZM12.5853 14.2191V13.3271H14.8322V2.67394H14.8303V13.3269H12.5834V14.2191H12.5853ZM6.86771 4.5C5.87019 4.5 5.00104 5.30767 5.00104 6.31667V9.63333C5.00104 10.6423 5.87019 11.45 6.86771 11.45C7.86523 11.45 8.73438 10.6423 8.73438 9.63333V6.31667C8.73438 5.30767 7.86523 4.5 6.86771 4.5ZM11.1177 4.5C10.1202 4.5 9.25104 5.30767 9.25104 6.31667V9.63333C9.25104 10.6423 10.1202 11.45 11.1177 11.45C12.1152 11.45 12.9844 10.6423 12.9844 9.63333V6.31667C12.9844 5.30767 12.1152 4.5 11.1177 4.5ZM6.13438 6.31667C6.13438 5.9503 6.47884 5.63333 6.86771 5.63333C7.25657 5.63333 7.60104 5.9503 7.60104 6.31667V9.63333C7.60104 9.9997 7.25657 10.3167 6.86771 10.3167C6.47884 10.3167 6.13438 9.9997 6.13438 9.63333V6.31667ZM10.3844 6.31667C10.3844 5.9503 10.7288 5.63333 11.1177 5.63333C11.5066 5.63333 11.851 5.9503 11.851 6.31667V9.63333C11.851 9.9997 11.5066 10.3167 11.1177 10.3167C10.7288 10.3167 10.3844 9.9997 10.3844 9.63333V6.31667ZM3.75938 9.85C3.33135 9.85 2.98438 10.197 2.98438 10.625C2.98438 11.053 3.33135 11.4 3.75938 11.4C4.1874 11.4 4.53438 11.053 4.53438 10.625C4.53438 10.197 4.1874 9.85 3.75938 9.85Z",
346
- fill: "currentColor"
347
- }
348
- )
349
- )
350
- };
351
- var getSchemaIcon = (value) => {
352
- if (value?.type === "array") {
353
- return ArrayIcons[value.items?.type || "object"];
354
- }
355
- return VariableTypeIcons[value?.type || "object"];
356
- };
357
- var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
358
- var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
359
- var baseOptions = [
360
- {
361
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "string" }) }), firstUppercase("string")),
362
- value: "string"
363
- },
364
- {
365
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "integer" }) }), firstUppercase("integer")),
366
- value: "integer"
367
- },
368
- {
369
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "number" }) }), firstUppercase("number")),
370
- value: "number"
371
- },
372
- {
373
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "boolean" }) }), firstUppercase("boolean")),
374
- value: "boolean"
375
- },
376
- {
377
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "object" }) }), firstUppercase("object")),
378
- value: "object"
379
- }
380
- ];
381
- var options = [
382
- ...baseOptions,
383
- {
384
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: getSchemaIcon({ type: "array" }) }), firstUppercase("array")),
385
- value: "array",
386
- children: baseOptions.map((_opt) => ({
387
- ..._opt,
388
- value: `${_opt.value}`,
389
- label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(
390
- Icon,
391
- {
392
- size: "small",
393
- svg: getSchemaIcon({ type: "array", items: { type: _opt.value } })
394
- }
395
- ), firstUppercase(_opt.value))
396
- }))
397
- }
398
- ];
399
-
400
- // src/utils/json-schema/index.ts
401
- import { get } from "lodash";
402
- import { ASTFactory, ASTKind, ASTMatch } from "@flowgram.ai/editor";
403
- var JsonSchemaUtils;
404
- ((JsonSchemaUtils2) => {
405
- function schemaToAST(jsonSchema) {
406
- const { type, extra } = jsonSchema || {};
407
- const { weak = false } = extra || {};
408
- if (!type) {
409
- return void 0;
352
+ {
353
+ tag: [t2.null],
354
+ color: colors2.null
355
+ },
356
+ {
357
+ tag: [t2.separator],
358
+ color: colors2.separator
359
+ },
360
+ // markdown
361
+ {
362
+ tag: [t2.heading],
363
+ color: "#6b6bff"
364
+ },
365
+ {
366
+ tag: [t2.processingInstruction],
367
+ color: "#6b6bff"
368
+ },
369
+ // shell
370
+ // curl
371
+ {
372
+ tag: [t2.standard(t2.variableName)],
373
+ color: "#3BEB84"
374
+ },
375
+ // -X
376
+ {
377
+ tag: [t2.attributeName],
378
+ color: "#FF9933"
379
+ },
380
+ // url in string (includes quotes), e.g. "https://..."
381
+ {
382
+ tag: [t2.special(t2.string)],
383
+ color: "#78B0FF"
410
384
  }
411
- switch (type) {
412
- case "object":
413
- if (weak) {
414
- return { kind: ASTKind.Object, weak: true };
415
- }
416
- return ASTFactory.createObject({
417
- properties: Object.entries(jsonSchema.properties || {}).sort((a, b) => (get(a?.[1], "extra.index") || 0) - (get(b?.[1], "extra.index") || 0)).map(([key, _property]) => ({
418
- key,
419
- type: schemaToAST(_property),
420
- meta: {
421
- title: _property.title,
422
- description: _property.description
423
- }
424
- }))
425
- });
426
- case "array":
427
- if (weak) {
428
- return { kind: ASTKind.Array, weak: true };
429
- }
430
- return ASTFactory.createArray({
431
- items: schemaToAST(jsonSchema.items)
432
- });
433
- case "map":
434
- if (weak) {
435
- return { kind: ASTKind.Map, weak: true };
436
- }
437
- return ASTFactory.createMap({
438
- valueType: schemaToAST(jsonSchema.additionalProperties)
439
- });
440
- case "string":
441
- return ASTFactory.createString();
442
- case "number":
443
- return ASTFactory.createNumber();
444
- case "boolean":
445
- return ASTFactory.createBoolean();
446
- case "integer":
447
- return ASTFactory.createInteger();
448
- default:
449
- return ASTFactory.createCustomType({ typeName: type });
450
- }
451
- }
452
- JsonSchemaUtils2.schemaToAST = schemaToAST;
453
- function astToSchema(typeAST, options2) {
454
- const { drilldown = true } = options2 || {};
455
- if (ASTMatch.isString(typeAST)) {
456
- return {
457
- type: "string"
458
- };
385
+ ]
386
+ });
387
+
388
+ // src/components/code-editor/theme/index.ts
389
+ themes.register("dark", darkTheme);
390
+ themes.register("light", lightTheme);
391
+
392
+ // src/components/code-editor/index.tsx
393
+ var OriginCodeEditor = createRenderer(preset, [
394
+ EditorView.theme({
395
+ "&.cm-focused": {
396
+ outline: "none"
459
397
  }
460
- if (ASTMatch.isBoolean(typeAST)) {
461
- return {
462
- type: "boolean"
463
- };
398
+ })
399
+ ]);
400
+ function CodeEditor({
401
+ value,
402
+ onChange,
403
+ languageId = "python",
404
+ theme = "light",
405
+ children,
406
+ placeholder,
407
+ activeLinePlaceholder,
408
+ options,
409
+ readonly
410
+ }) {
411
+ const editorRef = useRef(null);
412
+ useEffect(() => {
413
+ if (languageId === "typescript") {
414
+ initTsWorker();
464
415
  }
465
- if (ASTMatch.isNumber(typeAST)) {
466
- return {
467
- type: "number"
468
- };
416
+ }, [languageId]);
417
+ useEffect(() => {
418
+ if (editorRef.current?.getValue() !== value) {
419
+ editorRef.current?.setValue(String(value || ""));
469
420
  }
470
- if (ASTMatch.isInteger(typeAST)) {
471
- return {
472
- type: "integer"
473
- };
421
+ }, [value]);
422
+ return /* @__PURE__ */ React2.createElement(EditorProvider, null, /* @__PURE__ */ React2.createElement(
423
+ OriginCodeEditor,
424
+ {
425
+ defaultValue: value,
426
+ options: {
427
+ uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
428
+ languageId,
429
+ theme,
430
+ placeholder,
431
+ readOnly: readonly,
432
+ editable: !readonly,
433
+ ...options || {}
434
+ },
435
+ didMount: (editor) => {
436
+ editorRef.current = editor;
437
+ },
438
+ onChange: (e) => onChange?.(e.value)
439
+ },
440
+ activeLinePlaceholder && /* @__PURE__ */ React2.createElement(ActiveLinePlaceholder, null, activeLinePlaceholder),
441
+ children
442
+ ));
443
+ }
444
+
445
+ // src/components/code-editor-mini/index.tsx
446
+ var UIMini = styled.div`
447
+ .ͼ1 .cm-content {
448
+ padding: 0;
449
+ }
450
+ `;
451
+ function CodeEditorMini(props) {
452
+ return /* @__PURE__ */ React3.createElement(UIMini, null, /* @__PURE__ */ React3.createElement(
453
+ CodeEditor,
454
+ {
455
+ ...props,
456
+ options: {
457
+ lineNumbersGutter: false,
458
+ foldGutter: false,
459
+ ...props.options || {}
460
+ }
474
461
  }
475
- if (ASTMatch.isObject(typeAST)) {
476
- return {
477
- type: "object",
478
- properties: drilldown ? Object.fromEntries(
479
- typeAST.properties.map((property) => {
480
- const schema = astToSchema(property.type);
481
- if (property.meta?.title && schema) {
482
- schema.title = property.meta.title;
483
- }
484
- if (property.meta?.description && schema) {
485
- schema.description = property.meta.description;
486
- }
487
- return [property.key, schema];
488
- })
489
- ) : {}
490
- };
462
+ ));
463
+ }
464
+
465
+ // src/shared/json-schema-preset/type-definition/object.tsx
466
+ var objectRegistry = {
467
+ type: "object",
468
+ ConstantRenderer: (props) => /* @__PURE__ */ React4.createElement(
469
+ CodeEditorMini,
470
+ {
471
+ value: props.value,
472
+ onChange: (v) => props.onChange?.(v),
473
+ languageId: "json",
474
+ placeholder: "Please Input Object",
475
+ readonly: props.readonly
491
476
  }
492
- if (ASTMatch.isArray(typeAST)) {
493
- return {
494
- type: "array",
495
- items: drilldown ? astToSchema(typeAST.items) : void 0
496
- };
477
+ )
478
+ };
479
+
480
+ // src/shared/json-schema-preset/type-definition/number.tsx
481
+ import React5 from "react";
482
+ import { InputNumber } from "@douyinfe/semi-ui";
483
+ var numberRegistry = {
484
+ type: "number",
485
+ ConstantRenderer: (props) => /* @__PURE__ */ React5.createElement(
486
+ InputNumber,
487
+ {
488
+ placeholder: "Please Input Number",
489
+ size: "small",
490
+ disabled: props.readonly,
491
+ hideButtons: true,
492
+ ...props
497
493
  }
498
- if (ASTMatch.isMap(typeAST)) {
499
- return {
500
- type: "map",
501
- items: drilldown ? astToSchema(typeAST.valueType) : void 0
502
- };
503
- }
504
- if (ASTMatch.isCustomType(typeAST)) {
505
- return {
506
- type: typeAST.typeName
507
- };
494
+ )
495
+ };
496
+
497
+ // src/shared/json-schema-preset/type-definition/integer.tsx
498
+ import React6 from "react";
499
+ import { InputNumber as InputNumber2 } from "@douyinfe/semi-ui";
500
+ var integerRegistry = {
501
+ type: "integer",
502
+ ConstantRenderer: (props) => /* @__PURE__ */ React6.createElement(
503
+ InputNumber2,
504
+ {
505
+ placeholder: "Please Input Integer",
506
+ size: "small",
507
+ disabled: props.readonly,
508
+ precision: 0,
509
+ ...props
508
510
  }
509
- return void 0;
511
+ )
512
+ };
513
+
514
+ // src/shared/json-schema-preset/type-definition/boolean.tsx
515
+ import React7 from "react";
516
+ import { Select } from "@douyinfe/semi-ui";
517
+ var booleanRegistry = {
518
+ type: "boolean",
519
+ ConstantRenderer: (props) => {
520
+ const { value, onChange, ...rest } = props;
521
+ return /* @__PURE__ */ React7.createElement(
522
+ Select,
523
+ {
524
+ placeholder: "Please Select Boolean",
525
+ size: "small",
526
+ disabled: props.readonly,
527
+ optionList: [
528
+ { label: "True", value: 1 },
529
+ { label: "False", value: 0 }
530
+ ],
531
+ value: value ? 1 : 0,
532
+ onChange: (value2) => onChange?.(!!value2),
533
+ ...rest
534
+ }
535
+ );
510
536
  }
511
- JsonSchemaUtils2.astToSchema = astToSchema;
512
- function isASTMatchSchema(typeAST, schema) {
513
- if (Array.isArray(schema)) {
514
- return typeAST.isTypeEqual(
515
- ASTFactory.createUnion({
516
- types: schema.map((_schema) => schemaToAST(_schema)).filter(Boolean)
517
- })
518
- );
537
+ };
538
+
539
+ // src/shared/json-schema-preset/type-definition/array.tsx
540
+ import React8 from "react";
541
+ var arrayRegistry = {
542
+ type: "array",
543
+ ConstantRenderer: (props) => /* @__PURE__ */ React8.createElement(
544
+ CodeEditorMini,
545
+ {
546
+ value: props.value,
547
+ languageId: "json",
548
+ onChange: (v) => props.onChange?.(v),
549
+ placeholder: "Please Input Array",
550
+ readonly: props.readonly
519
551
  }
520
- return typeAST.isTypeEqual(schemaToAST(schema));
521
- }
522
- JsonSchemaUtils2.isASTMatchSchema = isASTMatchSchema;
523
- })(JsonSchemaUtils || (JsonSchemaUtils = {}));
552
+ )
553
+ };
554
+
555
+ // src/shared/json-schema-preset/type-definition/index.tsx
556
+ var jsonSchemaTypePreset = [
557
+ stringRegistry,
558
+ objectRegistry,
559
+ numberRegistry,
560
+ integerRegistry,
561
+ booleanRegistry,
562
+ arrayRegistry
563
+ ];
564
+ jsonSchemaTypePreset.forEach((_type) => jsonSchemaTypeManager.register(_type));
565
+
566
+ // src/shared/json-schema-preset/create-type-preset-plugin.tsx
567
+ import {
568
+ BaseTypeManager,
569
+ jsonSchemaContainerModule
570
+ } from "@flowgram.ai/json-schema";
571
+ import { definePluginCreator } from "@flowgram.ai/editor";
572
+ var createTypePresetPlugin = definePluginCreator({
573
+ onInit(ctx, opts) {
574
+ const typeManager = ctx.get(BaseTypeManager);
575
+ jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
576
+ opts.types.forEach((_type) => typeManager.register(_type));
577
+ },
578
+ containerModules: [jsonSchemaContainerModule]
579
+ });
580
+
581
+ // src/shared/json-schema-preset/index.tsx
582
+ var useTypeManager = () => useOriginTypeManager();
583
+ var JsonSchemaTypePresetProvider = ({
584
+ types = [],
585
+ children
586
+ }) => /* @__PURE__ */ React9.createElement(OriginTypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
524
587
 
525
588
  // src/components/variable-selector/use-variable-tree.tsx
526
589
  function useVariableTree(params) {
527
590
  const { includeSchema, excludeSchema, customSkip } = params;
591
+ const typeManager = useTypeManager();
528
592
  const variables = useAvailableVariables();
529
593
  const getVariableTypeIcon = useCallback((variable) => {
530
594
  if (variable.meta?.icon) {
531
595
  if (typeof variable.meta.icon === "string") {
532
- return /* @__PURE__ */ React2.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
596
+ return /* @__PURE__ */ React10.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
533
597
  }
534
598
  return variable.meta.icon;
535
599
  }
536
- const _type = variable.type;
537
- if (ASTMatch2.isArray(_type)) {
538
- return /* @__PURE__ */ React2.createElement(
539
- Icon2,
540
- {
541
- size: "small",
542
- svg: ArrayIcons[_type.items?.kind.toLowerCase()] || VariableTypeIcons.array
543
- }
544
- );
545
- }
546
- if (ASTMatch2.isCustomType(_type)) {
547
- return /* @__PURE__ */ React2.createElement(Icon2, { size: "small", svg: VariableTypeIcons[_type.typeName.toLowerCase()] });
548
- }
549
- return /* @__PURE__ */ React2.createElement(Icon2, { size: "small", svg: VariableTypeIcons[variable.type?.kind.toLowerCase()] });
600
+ const schema = JsonSchemaUtils2.astToSchema(variable.type, { drilldownObject: false });
601
+ return /* @__PURE__ */ React10.createElement(Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
550
602
  }, []);
551
603
  const renderVariable = (variable, parentFields = []) => {
552
604
  let type = variable?.type;
@@ -554,15 +606,16 @@ function useVariableTree(params) {
554
606
  return null;
555
607
  }
556
608
  let children;
557
- if (ASTMatch2.isObject(type)) {
609
+ if (ASTMatch.isObject(type)) {
558
610
  children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
559
611
  }
560
612
  const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
561
613
  const key = keyPath.join(".");
562
- const isSchemaInclude = includeSchema ? JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
563
- const isSchemaExclude = excludeSchema ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
614
+ const isSchemaInclude = includeSchema ? JsonSchemaUtils2.isASTMatchSchema(type, includeSchema) : true;
615
+ const isSchemaExclude = excludeSchema ? JsonSchemaUtils2.isASTMatchSchema(type, excludeSchema) : false;
564
616
  const isCustomSkip = customSkip ? customSkip(variable) : false;
565
- const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip;
617
+ const isMetaDisabled = variable.meta?.disabled;
618
+ const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
566
619
  if (!isSchemaMatch && !children?.length) {
567
620
  return null;
568
621
  }
@@ -582,9 +635,9 @@ function useVariableTree(params) {
582
635
  }
583
636
 
584
637
  // src/components/variable-selector/styles.tsx
585
- import styled, { css } from "styled-components";
638
+ import styled2, { css } from "styled-components";
586
639
  import { Tag, TreeSelect } from "@douyinfe/semi-ui";
587
- var UIRootTitle = styled.div`
640
+ var UIRootTitle = styled2.div`
588
641
  margin-right: 4px;
589
642
  min-width: 20px;
590
643
  overflow: hidden;
@@ -592,7 +645,7 @@ var UIRootTitle = styled.div`
592
645
  white-space: nowrap;
593
646
  color: var(--semi-color-text-2);
594
647
  `;
595
- var UIVarName = styled.div`
648
+ var UIVarName = styled2.div`
596
649
  overflow: hidden;
597
650
  text-overflow: ellipsis;
598
651
  white-space: nowrap;
@@ -601,7 +654,7 @@ var UIVarName = styled.div`
601
654
  min-width: 50%;
602
655
  `}
603
656
  `;
604
- var UITag = styled(Tag)`
657
+ var UITag = styled2(Tag)`
605
658
  width: 100%;
606
659
  display: flex;
607
660
  align-items: center;
@@ -616,7 +669,7 @@ var UITag = styled(Tag)`
616
669
  height: 22px;
617
670
  }
618
671
  `;
619
- var UITreeSelect = styled(TreeSelect)`
672
+ var UITreeSelect = styled2(TreeSelect)`
620
673
  outline: ${({ $error }) => $error ? "1px solid red" : "none"};
621
674
 
622
675
  & .semi-tree-select-selection {
@@ -632,7 +685,7 @@ var UITreeSelect = styled(TreeSelect)`
632
685
  padding-left: 10px;
633
686
  }
634
687
  `;
635
- var UIPopoverContent = styled.div`
688
+ var UIPopoverContent = styled2.div`
636
689
  padding: 10px;
637
690
  display: inline-flex;
638
691
  align-items: center;
@@ -665,11 +718,11 @@ var VariableSelector = ({
665
718
  }, [value]);
666
719
  const renderIcon = (icon) => {
667
720
  if (typeof icon === "string") {
668
- return /* @__PURE__ */ React3.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
721
+ return /* @__PURE__ */ React11.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
669
722
  }
670
723
  return icon;
671
724
  };
672
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
725
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
673
726
  UITreeSelect,
674
727
  {
675
728
  dropdownMatchSelectWidth: false,
@@ -686,10 +739,10 @@ var VariableSelector = ({
686
739
  },
687
740
  renderSelectedItem: (_option) => {
688
741
  if (!_option?.keyPath) {
689
- return /* @__PURE__ */ React3.createElement(
742
+ return /* @__PURE__ */ React11.createElement(
690
743
  UITag,
691
744
  {
692
- prefixIcon: /* @__PURE__ */ React3.createElement(IconIssueStroked, null),
745
+ prefixIcon: /* @__PURE__ */ React11.createElement(IconIssueStroked, null),
693
746
  color: "amber",
694
747
  closable: !readonly,
695
748
  onClose: () => onChange(void 0)
@@ -698,13 +751,13 @@ var VariableSelector = ({
698
751
  );
699
752
  }
700
753
  const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
701
- const rootTitle = /* @__PURE__ */ React3.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
702
- return /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement(
754
+ const rootTitle = /* @__PURE__ */ React11.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
755
+ return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement(
703
756
  Popover,
704
757
  {
705
- content: /* @__PURE__ */ React3.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ React3.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
758
+ content: /* @__PURE__ */ React11.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ React11.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
706
759
  },
707
- /* @__PURE__ */ React3.createElement(
760
+ /* @__PURE__ */ React11.createElement(
708
761
  UITag,
709
762
  {
710
763
  prefixIcon: rootIcon,
@@ -712,12 +765,12 @@ var VariableSelector = ({
712
765
  onClose: () => onChange(void 0)
713
766
  },
714
767
  rootTitle,
715
- !_option.isRoot && /* @__PURE__ */ React3.createElement(UIVarName, { $inSelector: true }, _option.label)
768
+ !_option.isRoot && /* @__PURE__ */ React11.createElement(UIVarName, { $inSelector: true }, _option.label)
716
769
  )
717
770
  ));
718
771
  },
719
772
  showClear: false,
720
- arrowIcon: /* @__PURE__ */ React3.createElement(IconChevronDownStroked, { size: "small" }),
773
+ arrowIcon: /* @__PURE__ */ React11.createElement(IconChevronDownStroked, { size: "small" }),
721
774
  triggerRender,
722
775
  placeholder: config?.placeholder ?? "Select Variable..."
723
776
  }
@@ -725,8 +778,10 @@ var VariableSelector = ({
725
778
  };
726
779
 
727
780
  // src/components/type-selector/index.tsx
728
- import React4, { useMemo as useMemo2 } from "react";
729
- import { Cascader, IconButton } from "@douyinfe/semi-ui";
781
+ import React12, { useMemo as useMemo2 } from "react";
782
+ import { Cascader, Icon as Icon2, IconButton } from "@douyinfe/semi-ui";
783
+ var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
784
+ var firstUppercase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
730
785
  var getTypeSelectValue = (value) => {
731
786
  if (value?.type === "array" && value?.items) {
732
787
  return [value.type, ...getTypeSelectValue(value.items) || []];
@@ -743,20 +798,37 @@ var parseTypeSelectValue = (value) => {
743
798
  function TypeSelector(props) {
744
799
  const { value, onChange, readonly, disabled, style } = props;
745
800
  const selectValue = useMemo2(() => getTypeSelectValue(value), [value]);
746
- return /* @__PURE__ */ React4.createElement(
801
+ const typeManager = useTypeManager();
802
+ const icon = typeManager.getDisplayIcon(value || {});
803
+ const options = useMemo2(
804
+ () => typeManager.getTypeRegistriesWithParentType().map((_type) => {
805
+ const isArray2 = _type.type === "array";
806
+ return {
807
+ label: /* @__PURE__ */ React12.createElement("div", { style: labelStyle }, /* @__PURE__ */ React12.createElement(Icon2, { size: "small", svg: _type.icon }), firstUppercase(_type.type)),
808
+ value: _type.type,
809
+ children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
810
+ label: /* @__PURE__ */ React12.createElement("div", { style: labelStyle }, /* @__PURE__ */ React12.createElement(
811
+ Icon2,
812
+ {
813
+ size: "small",
814
+ svg: typeManager.getDisplayIcon({
815
+ type: "array",
816
+ items: { type: _type2.type }
817
+ })
818
+ }
819
+ ), firstUppercase(_type2.type)),
820
+ value: _type2.type
821
+ })) : []
822
+ };
823
+ }),
824
+ []
825
+ );
826
+ return /* @__PURE__ */ React12.createElement(
747
827
  Cascader,
748
828
  {
749
829
  disabled: readonly || disabled,
750
830
  size: "small",
751
- triggerRender: () => /* @__PURE__ */ React4.createElement(
752
- IconButton,
753
- {
754
- size: "small",
755
- style,
756
- disabled: readonly || disabled,
757
- icon: getSchemaIcon(value)
758
- }
759
- ),
831
+ triggerRender: () => /* @__PURE__ */ React12.createElement(IconButton, { size: "small", style, disabled: readonly || disabled, icon }),
760
832
  treeData: options,
761
833
  value: selectValue,
762
834
  leafOnly: true,
@@ -768,7 +840,7 @@ function TypeSelector(props) {
768
840
  }
769
841
 
770
842
  // src/components/json-schema-editor/index.tsx
771
- import React9, { useMemo as useMemo5, useState as useState4 } from "react";
843
+ import React17, { useMemo as useMemo5, useState as useState4 } from "react";
772
844
  import { Button, Checkbox, IconButton as IconButton3 } from "@douyinfe/semi-ui";
773
845
  import {
774
846
  IconExpand,
@@ -780,36 +852,36 @@ import {
780
852
  } from "@douyinfe/semi-icons";
781
853
 
782
854
  // src/components/json-schema-editor/styles.tsx
783
- import React5 from "react";
784
- import styled2, { css as css2 } from "styled-components";
855
+ import React13 from "react";
856
+ import styled3, { css as css2 } from "styled-components";
785
857
  import Icon3 from "@douyinfe/semi-icons";
786
- var UIContainer = styled2.div`
858
+ var UIContainer = styled3.div`
787
859
  /* & .semi-input {
788
860
  background-color: #fff;
789
861
  border-radius: 6px;
790
862
  height: 24px;
791
863
  } */
792
864
  `;
793
- var UIRow = styled2.div`
865
+ var UIRow = styled3.div`
794
866
  display: flex;
795
867
  align-items: center;
796
868
  gap: 6px;
797
869
  `;
798
- var UICollapseTrigger = styled2.div`
870
+ var UICollapseTrigger = styled3.div`
799
871
  cursor: pointer;
800
872
  margin-right: 5px;
801
873
  `;
802
- var UIExpandDetail = styled2.div`
874
+ var UIExpandDetail = styled3.div`
803
875
  display: flex;
804
876
  flex-direction: column;
805
877
  `;
806
- var UILabel = styled2.div`
878
+ var UILabel = styled3.div`
807
879
  font-size: 12px;
808
880
  color: #999;
809
881
  font-weight: 400;
810
882
  margin-bottom: 2px;
811
883
  `;
812
- var UIProperties = styled2.div`
884
+ var UIProperties = styled3.div`
813
885
  display: grid;
814
886
  grid-template-columns: auto 1fr;
815
887
 
@@ -818,7 +890,7 @@ var UIProperties = styled2.div`
818
890
  margin-top: 10px;
819
891
  `}
820
892
  `;
821
- var UIPropertyLeft = styled2.div`
893
+ var UIPropertyLeft = styled3.div`
822
894
  grid-column: 1;
823
895
  position: relative;
824
896
  width: 16px;
@@ -855,7 +927,7 @@ var UIPropertyLeft = styled2.div`
855
927
  `;
856
928
  }}
857
929
  `;
858
- var UIPropertyRight = styled2.div`
930
+ var UIPropertyRight = styled3.div`
859
931
  grid-column: 2;
860
932
  margin-bottom: 10px;
861
933
 
@@ -863,7 +935,7 @@ var UIPropertyRight = styled2.div`
863
935
  margin-bottom: 0px;
864
936
  }
865
937
  `;
866
- var UIPropertyMain = styled2.div`
938
+ var UIPropertyMain = styled3.div`
867
939
  display: flex;
868
940
  flex-direction: column;
869
941
  gap: 10px;
@@ -893,22 +965,22 @@ var UIPropertyMain = styled2.div`
893
965
  `;
894
966
  }}
895
967
  `;
896
- var UICollapsible = styled2.div`
968
+ var UICollapsible = styled3.div`
897
969
  display: none;
898
970
 
899
971
  ${({ $collapse }) => $collapse && css2`
900
972
  display: block;
901
973
  `}
902
974
  `;
903
- var UIName = styled2.div`
975
+ var UIName = styled3.div`
904
976
  flex-grow: 1;
905
977
  `;
906
- var UIType = styled2.div``;
907
- var UIRequired = styled2.div``;
908
- var UIActions = styled2.div`
978
+ var UIType = styled3.div``;
979
+ var UIRequired = styled3.div``;
980
+ var UIActions = styled3.div`
909
981
  white-space: nowrap;
910
982
  `;
911
- var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
983
+ var iconAddChildrenSvg = /* @__PURE__ */ React13.createElement(
912
984
  "svg",
913
985
  {
914
986
  className: "icon-icon icon-icon-coz_add_node ",
@@ -918,7 +990,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
918
990
  fill: "currentColor",
919
991
  xmlns: "http://www.w3.org/2000/svg"
920
992
  },
921
- /* @__PURE__ */ React5.createElement(
993
+ /* @__PURE__ */ React13.createElement(
922
994
  "path",
923
995
  {
924
996
  fillRule: "evenodd",
@@ -926,19 +998,19 @@ var iconAddChildrenSvg = /* @__PURE__ */ React5.createElement(
926
998
  d: "M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
927
999
  }
928
1000
  ),
929
- /* @__PURE__ */ React5.createElement("path", { d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z" })
1001
+ /* @__PURE__ */ React13.createElement("path", { d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z" })
930
1002
  );
931
- var IconAddChildren = () => /* @__PURE__ */ React5.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
932
- var DefaultValueWrapper = styled2.div`
1003
+ var IconAddChildren = () => /* @__PURE__ */ React13.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
1004
+ var DefaultValueWrapper = styled3.div`
933
1005
  margin: 0;
934
1006
  `;
935
- var JSONViewerWrapper = styled2.div`
1007
+ var JSONViewerWrapper = styled3.div`
936
1008
  padding: 0 0 24px;
937
1009
  &:first-child {
938
1010
  margin-top: 0px;
939
1011
  }
940
1012
  `;
941
- var JSONHeader = styled2.div`
1013
+ var JSONHeader = styled3.div`
942
1014
  display: flex;
943
1015
  justify-content: space-between;
944
1016
  align-items: center;
@@ -947,17 +1019,17 @@ var JSONHeader = styled2.div`
947
1019
  height: 36px;
948
1020
  padding: 0 8px 0 12px;
949
1021
  `;
950
- var JSONHeaderLeft = styled2.div`
1022
+ var JSONHeaderLeft = styled3.div`
951
1023
  display: flex;
952
1024
  align-items: center;
953
1025
  gap: 10px;
954
1026
  `;
955
- var JSONHeaderRight = styled2.div`
1027
+ var JSONHeaderRight = styled3.div`
956
1028
  display: flex;
957
1029
  align-items: center;
958
1030
  gap: 10px;
959
1031
  `;
960
- var ConstantInputWrapper = styled2.div`
1032
+ var ConstantInputWrapper = styled3.div`
961
1033
  flex-grow: 1;
962
1034
 
963
1035
  & .semi-tree-select,
@@ -968,7 +1040,7 @@ var ConstantInputWrapper = styled2.div`
968
1040
  `;
969
1041
 
970
1042
  // src/components/json-schema-editor/hooks.tsx
971
- import { useEffect, useMemo as useMemo3, useRef, useState } from "react";
1043
+ import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef2, useState } from "react";
972
1044
  import { omit } from "lodash";
973
1045
  var _id = 0;
974
1046
  function genId() {
@@ -1002,8 +1074,8 @@ function usePropertiesEdit(value, onChange) {
1002
1074
  [isDrilldownObject]
1003
1075
  );
1004
1076
  const [propertyList, setPropertyList] = useState(initPropertyList);
1005
- const mountRef = useRef(false);
1006
- useEffect(() => {
1077
+ const mountRef = useRef2(false);
1078
+ useEffect2(() => {
1007
1079
  if (mountRef.current) {
1008
1080
  setPropertyList((_list) => {
1009
1081
  const nameMap = /* @__PURE__ */ new Map();
@@ -1071,7 +1143,7 @@ function usePropertiesEdit(value, onChange) {
1071
1143
  (_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
1072
1144
  );
1073
1145
  };
1074
- useEffect(() => {
1146
+ useEffect2(() => {
1075
1147
  if (!isDrilldownObject) {
1076
1148
  setPropertyList([]);
1077
1149
  }
@@ -1086,7 +1158,7 @@ function usePropertiesEdit(value, onChange) {
1086
1158
  }
1087
1159
 
1088
1160
  // src/components/json-schema-editor/default-value.tsx
1089
- import React7, { useRef as useRef2, useState as useState2, useCallback as useCallback2 } from "react";
1161
+ import React15, { useRef as useRef3, useState as useState2, useCallback as useCallback2 } from "react";
1090
1162
  import { IconButton as IconButton2, JsonViewer, Tooltip } from "@douyinfe/semi-ui";
1091
1163
  import { IconBrackets } from "@douyinfe/semi-icons";
1092
1164
 
@@ -1110,100 +1182,37 @@ function getValueType(value) {
1110
1182
  }
1111
1183
 
1112
1184
  // src/components/constant-input/index.tsx
1113
- import React6, { useMemo as useMemo4 } from "react";
1114
- import { Input, InputNumber, Select } from "@douyinfe/semi-ui";
1115
- var defaultStrategies = [
1116
- {
1117
- hit: (schema) => schema?.type === "string",
1118
- Renderer: (props) => /* @__PURE__ */ React6.createElement(Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
1119
- },
1120
- {
1121
- hit: (schema) => schema?.type === "number",
1122
- Renderer: (props) => /* @__PURE__ */ React6.createElement(
1123
- InputNumber,
1124
- {
1125
- placeholder: "Please Input Number",
1126
- size: "small",
1127
- disabled: props.readonly,
1128
- hideButtons: true,
1129
- ...props
1130
- }
1131
- )
1132
- },
1133
- {
1134
- hit: (schema) => schema?.type === "integer",
1135
- Renderer: (props) => /* @__PURE__ */ React6.createElement(
1136
- InputNumber,
1137
- {
1138
- placeholder: "Please Input Integer",
1139
- size: "small",
1140
- disabled: props.readonly,
1141
- hideButtons: true,
1142
- precision: 0,
1143
- ...props
1144
- }
1145
- )
1146
- },
1147
- {
1148
- hit: (schema) => schema?.type === "boolean",
1149
- Renderer: (props) => {
1150
- const { value, onChange, ...rest } = props;
1151
- return /* @__PURE__ */ React6.createElement(
1152
- Select,
1153
- {
1154
- placeholder: "Please Select Boolean",
1155
- size: "small",
1156
- disabled: props.readonly,
1157
- optionList: [
1158
- { label: "True", value: 1 },
1159
- { label: "False", value: 0 }
1160
- ],
1161
- value: value ? 1 : 0,
1162
- onChange: (value2) => onChange?.(!!value2),
1163
- ...rest
1164
- }
1165
- );
1166
- }
1167
- }
1168
- ];
1185
+ import React14, { useMemo as useMemo4 } from "react";
1186
+ import { Input as Input2 } from "@douyinfe/semi-ui";
1169
1187
  function ConstantInput(props) {
1170
- const {
1171
- value,
1172
- onChange,
1173
- schema,
1174
- strategies: extraStrategies,
1175
- fallbackRenderer,
1176
- readonly,
1177
- ...rest
1178
- } = props;
1179
- const strategies = useMemo4(
1180
- // user's extraStrategies first
1181
- () => [...extraStrategies || [], ...defaultStrategies],
1182
- [extraStrategies]
1183
- );
1188
+ const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
1189
+ const typeManager = useTypeManager();
1184
1190
  const Renderer2 = useMemo4(() => {
1185
- const strategy = strategies.find((_strategy) => _strategy.hit(schema));
1191
+ const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
1192
+ if (!strategy) {
1193
+ return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
1194
+ }
1186
1195
  return strategy?.Renderer;
1187
1196
  }, [strategies, schema]);
1188
1197
  if (!Renderer2) {
1189
1198
  if (fallbackRenderer) {
1190
- return React6.createElement(fallbackRenderer, {
1199
+ return React14.createElement(fallbackRenderer, {
1191
1200
  value,
1192
1201
  onChange,
1193
1202
  readonly,
1194
1203
  ...rest
1195
1204
  });
1196
1205
  }
1197
- return /* @__PURE__ */ React6.createElement(Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
1206
+ return /* @__PURE__ */ React14.createElement(Input2, { size: "small", disabled: true, placeholder: "Unsupported type" });
1198
1207
  }
1199
- return /* @__PURE__ */ React6.createElement(Renderer2, { value, onChange, readonly, ...rest });
1208
+ return /* @__PURE__ */ React14.createElement(Renderer2, { value, onChange, readonly, ...rest });
1200
1209
  }
1201
1210
 
1202
1211
  // src/components/json-schema-editor/default-value.tsx
1203
1212
  function DefaultValue(props) {
1204
1213
  const { value, schema, type, onChange, placeholder, jsonFormatText } = props;
1205
- const wrapperRef = useRef2(null);
1206
- const JsonViewerRef = useRef2(null);
1214
+ const wrapperRef = useRef3(null);
1215
+ const JsonViewerRef = useRef3(null);
1207
1216
  const [internalJsonValue, setInternalJsonValue] = useState2(
1208
1217
  getValueType(value) === "string" ? value : ""
1209
1218
  );
@@ -1230,16 +1239,16 @@ function DefaultValue(props) {
1230
1239
  console.error("Invalid JSON:", error);
1231
1240
  }
1232
1241
  }, [internalJsonValue, onChange]);
1233
- return type === "object" ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(JSONHeader, null, /* @__PURE__ */ React7.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ React7.createElement(JSONHeaderRight, null, /* @__PURE__ */ React7.createElement(Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ React7.createElement(
1242
+ return type === "object" ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(JSONHeader, null, /* @__PURE__ */ React15.createElement(JSONHeaderLeft, null, "json"), /* @__PURE__ */ React15.createElement(JSONHeaderRight, null, /* @__PURE__ */ React15.createElement(Tooltip, { content: jsonFormatText ?? "Format" }, /* @__PURE__ */ React15.createElement(
1234
1243
  IconButton2,
1235
1244
  {
1236
- icon: /* @__PURE__ */ React7.createElement(IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
1245
+ icon: /* @__PURE__ */ React15.createElement(IconBrackets, { style: { color: "var(--semi-color-primary)" } }),
1237
1246
  size: "small",
1238
1247
  type: "tertiary",
1239
1248
  theme: "borderless",
1240
1249
  onClick: handleFormatJson
1241
1250
  }
1242
- )))), /* @__PURE__ */ React7.createElement(
1251
+ )))), /* @__PURE__ */ React15.createElement(
1243
1252
  JSONViewerWrapper,
1244
1253
  {
1245
1254
  ref: wrapperRef,
@@ -1253,7 +1262,7 @@ function DefaultValue(props) {
1253
1262
  setJsonReadOnly(false);
1254
1263
  }
1255
1264
  },
1256
- /* @__PURE__ */ React7.createElement(
1265
+ /* @__PURE__ */ React15.createElement(
1257
1266
  JsonViewer,
1258
1267
  {
1259
1268
  ref: JsonViewerRef,
@@ -1271,7 +1280,7 @@ function DefaultValue(props) {
1271
1280
  onChange: handleJsonChange
1272
1281
  }
1273
1282
  )
1274
- )) : /* @__PURE__ */ React7.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React7.createElement(
1283
+ )) : /* @__PURE__ */ React15.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React15.createElement(
1275
1284
  ConstantInput,
1276
1285
  {
1277
1286
  value,
@@ -1283,15 +1292,15 @@ function DefaultValue(props) {
1283
1292
  }
1284
1293
 
1285
1294
  // src/components/json-schema-editor/components/blur-input.tsx
1286
- import React8, { useEffect as useEffect2, useState as useState3 } from "react";
1287
- import Input2 from "@douyinfe/semi-ui/lib/es/input";
1295
+ import React16, { useEffect as useEffect3, useState as useState3 } from "react";
1296
+ import Input3 from "@douyinfe/semi-ui/lib/es/input";
1288
1297
  function BlurInput(props) {
1289
1298
  const [value, setValue] = useState3("");
1290
- useEffect2(() => {
1299
+ useEffect3(() => {
1291
1300
  setValue(props.value);
1292
1301
  }, [props.value]);
1293
- return /* @__PURE__ */ React8.createElement(
1294
- Input2,
1302
+ return /* @__PURE__ */ React16.createElement(
1303
+ Input3,
1295
1304
  {
1296
1305
  ...props,
1297
1306
  value,
@@ -1310,7 +1319,7 @@ function JsonSchemaEditor(props) {
1310
1319
  value,
1311
1320
  onChangeProps
1312
1321
  );
1313
- return /* @__PURE__ */ React9.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React9.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React9.createElement(
1322
+ return /* @__PURE__ */ React17.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React17.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React17.createElement(
1314
1323
  PropertyEdit,
1315
1324
  {
1316
1325
  readonly,
@@ -1325,13 +1334,13 @@ function JsonSchemaEditor(props) {
1325
1334
  onRemoveProperty(_property.key);
1326
1335
  }
1327
1336
  }
1328
- ))), /* @__PURE__ */ React9.createElement(
1337
+ ))), /* @__PURE__ */ React17.createElement(
1329
1338
  Button,
1330
1339
  {
1331
1340
  disabled: readonly,
1332
1341
  size: "small",
1333
1342
  style: { marginTop: 10, marginLeft: 16 },
1334
- icon: /* @__PURE__ */ React9.createElement(IconPlus, null),
1343
+ icon: /* @__PURE__ */ React17.createElement(IconPlus, null),
1335
1344
  onClick: onAddProperty
1336
1345
  },
1337
1346
  config?.addButtonText ?? "Add"
@@ -1364,7 +1373,7 @@ function PropertyEdit(props) {
1364
1373
  });
1365
1374
  };
1366
1375
  const showCollapse = isDrilldownObject && propertyList.length > 0;
1367
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
1376
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
1368
1377
  UIPropertyLeft,
1369
1378
  {
1370
1379
  type,
@@ -1376,8 +1385,8 @@ function PropertyEdit(props) {
1376
1385
  $parentExpand,
1377
1386
  $parentType
1378
1387
  },
1379
- showCollapse && /* @__PURE__ */ React9.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React9.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React9.createElement(IconChevronRight, { size: "small" }))
1380
- ), /* @__PURE__ */ React9.createElement(UIPropertyRight, null, /* @__PURE__ */ React9.createElement(
1388
+ showCollapse && /* @__PURE__ */ React17.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React17.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React17.createElement(IconChevronRight, { size: "small" }))
1389
+ ), /* @__PURE__ */ React17.createElement(UIPropertyRight, null, /* @__PURE__ */ React17.createElement(
1381
1390
  UIPropertyMain,
1382
1391
  {
1383
1392
  $showCollapse: showCollapse,
@@ -1385,7 +1394,7 @@ function PropertyEdit(props) {
1385
1394
  $expand: expand,
1386
1395
  type
1387
1396
  },
1388
- /* @__PURE__ */ React9.createElement(UIRow, null, /* @__PURE__ */ React9.createElement(UIName, null, /* @__PURE__ */ React9.createElement(
1397
+ /* @__PURE__ */ React17.createElement(UIRow, null, /* @__PURE__ */ React17.createElement(UIName, null, /* @__PURE__ */ React17.createElement(
1389
1398
  BlurInput,
1390
1399
  {
1391
1400
  disabled: readonly,
@@ -1394,7 +1403,7 @@ function PropertyEdit(props) {
1394
1403
  value: name,
1395
1404
  onChange: (value2) => onChange("name", value2)
1396
1405
  }
1397
- )), /* @__PURE__ */ React9.createElement(UIType, null, /* @__PURE__ */ React9.createElement(
1406
+ )), /* @__PURE__ */ React17.createElement(UIType, null, /* @__PURE__ */ React17.createElement(
1398
1407
  TypeSelector,
1399
1408
  {
1400
1409
  value: typeSelectorValue,
@@ -1406,47 +1415,47 @@ function PropertyEdit(props) {
1406
1415
  });
1407
1416
  }
1408
1417
  }
1409
- )), /* @__PURE__ */ React9.createElement(UIRequired, null, /* @__PURE__ */ React9.createElement(
1418
+ )), /* @__PURE__ */ React17.createElement(UIRequired, null, /* @__PURE__ */ React17.createElement(
1410
1419
  Checkbox,
1411
1420
  {
1412
1421
  disabled: readonly,
1413
1422
  checked: isPropertyRequired,
1414
1423
  onChange: (e) => onChange("isPropertyRequired", e.target.checked)
1415
1424
  }
1416
- )), /* @__PURE__ */ React9.createElement(UIActions, null, /* @__PURE__ */ React9.createElement(
1425
+ )), /* @__PURE__ */ React17.createElement(UIActions, null, /* @__PURE__ */ React17.createElement(
1417
1426
  IconButton3,
1418
1427
  {
1419
1428
  disabled: readonly,
1420
1429
  size: "small",
1421
1430
  theme: "borderless",
1422
- icon: expand ? /* @__PURE__ */ React9.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React9.createElement(IconExpand, { size: "small" }),
1431
+ icon: expand ? /* @__PURE__ */ React17.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React17.createElement(IconExpand, { size: "small" }),
1423
1432
  onClick: () => {
1424
1433
  setExpand((_expand) => !_expand);
1425
1434
  }
1426
1435
  }
1427
- ), isDrilldownObject && /* @__PURE__ */ React9.createElement(
1436
+ ), isDrilldownObject && /* @__PURE__ */ React17.createElement(
1428
1437
  IconButton3,
1429
1438
  {
1430
1439
  disabled: readonly,
1431
1440
  size: "small",
1432
1441
  theme: "borderless",
1433
- icon: /* @__PURE__ */ React9.createElement(IconAddChildren, null),
1442
+ icon: /* @__PURE__ */ React17.createElement(IconAddChildren, null),
1434
1443
  onClick: () => {
1435
1444
  onAddProperty();
1436
1445
  setCollapse(true);
1437
1446
  }
1438
1447
  }
1439
- ), /* @__PURE__ */ React9.createElement(
1448
+ ), /* @__PURE__ */ React17.createElement(
1440
1449
  IconButton3,
1441
1450
  {
1442
1451
  disabled: readonly,
1443
1452
  size: "small",
1444
1453
  theme: "borderless",
1445
- icon: /* @__PURE__ */ React9.createElement(IconMinus, { size: "small" }),
1454
+ icon: /* @__PURE__ */ React17.createElement(IconMinus, { size: "small" }),
1446
1455
  onClick: onRemove
1447
1456
  }
1448
1457
  ))),
1449
- expand && /* @__PURE__ */ React9.createElement(UIExpandDetail, null, /* @__PURE__ */ React9.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ React9.createElement(
1458
+ expand && /* @__PURE__ */ React17.createElement(UIExpandDetail, null, /* @__PURE__ */ React17.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ React17.createElement(
1450
1459
  BlurInput,
1451
1460
  {
1452
1461
  disabled: readonly,
@@ -1455,7 +1464,7 @@ function PropertyEdit(props) {
1455
1464
  onChange: (value2) => onChange("description", value2),
1456
1465
  placeholder: config?.descPlaceholder ?? "Help LLM to understand the property"
1457
1466
  }
1458
- ), $level === 0 && type && type !== "array" && /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ React9.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React9.createElement(
1467
+ ), $level === 0 && type && type !== "array" && /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? "Default Value"), /* @__PURE__ */ React17.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React17.createElement(
1459
1468
  DefaultValue,
1460
1469
  {
1461
1470
  value: defaultValue,
@@ -1466,7 +1475,7 @@ function PropertyEdit(props) {
1466
1475
  onChange: (value2) => onChange("default", value2)
1467
1476
  }
1468
1477
  ))))
1469
- ), showCollapse && /* @__PURE__ */ React9.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React9.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React9.createElement(
1478
+ ), showCollapse && /* @__PURE__ */ React17.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React17.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React17.createElement(
1470
1479
  PropertyEdit,
1471
1480
  {
1472
1481
  readonly,
@@ -1491,87 +1500,25 @@ function PropertyEdit(props) {
1491
1500
  }
1492
1501
 
1493
1502
  // src/components/batch-variable-selector/index.tsx
1494
- import React10 from "react";
1503
+ import React18 from "react";
1495
1504
  import { PrivateScopeProvider } from "@flowgram.ai/editor";
1496
1505
  var batchVariableSchema = {
1497
1506
  type: "array",
1498
1507
  extra: { weak: true }
1499
1508
  };
1500
1509
  function BatchVariableSelector(props) {
1501
- return /* @__PURE__ */ React10.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React10.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1510
+ return /* @__PURE__ */ React18.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React18.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1502
1511
  }
1503
1512
 
1504
1513
  // src/components/dynamic-value-input/index.tsx
1505
- import React11, { useMemo as useMemo6, useState as useState5 } from "react";
1506
- import { useScopeAvailable } from "@flowgram.ai/editor";
1514
+ import React19 from "react";
1515
+ import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
1507
1516
  import { IconButton as IconButton4 } from "@douyinfe/semi-ui";
1508
1517
  import { IconSetting } from "@douyinfe/semi-icons";
1509
1518
 
1510
- // src/utils/format-legacy-refs/index.ts
1511
- import { isObject } from "lodash";
1512
- function formatLegacyRefOnSubmit(value) {
1513
- if (isObject(value)) {
1514
- if (isLegacyFlowRefValueSchema(value)) {
1515
- return formatLegacyRefToNewRef(value);
1516
- }
1517
- return Object.fromEntries(
1518
- Object.entries(value).map(([key, value2]) => [
1519
- key,
1520
- formatLegacyRefOnSubmit(value2)
1521
- ])
1522
- );
1523
- }
1524
- if (Array.isArray(value)) {
1525
- return value.map(formatLegacyRefOnSubmit);
1526
- }
1527
- return value;
1528
- }
1529
- function formatLegacyRefOnInit(value) {
1530
- if (isObject(value)) {
1531
- if (isNewFlowRefValueSchema(value)) {
1532
- return formatNewRefToLegacyRef(value);
1533
- }
1534
- return Object.fromEntries(
1535
- Object.entries(value).map(([key, value2]) => [
1536
- key,
1537
- formatLegacyRefOnInit(value2)
1538
- ])
1539
- );
1540
- }
1541
- if (Array.isArray(value)) {
1542
- return value.map(formatLegacyRefOnInit);
1543
- }
1544
- return value;
1545
- }
1546
- function isLegacyFlowRefValueSchema(value) {
1547
- return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
1548
- }
1549
- function isNewFlowRefValueSchema(value) {
1550
- return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
1551
- }
1552
- function formatLegacyRefToNewRef(value) {
1553
- const keyPath = value.content.split(".");
1554
- if (keyPath[1] === "outputs") {
1555
- return {
1556
- type: "ref",
1557
- content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
1558
- };
1559
- }
1560
- return {
1561
- type: "ref",
1562
- content: keyPath
1563
- };
1564
- }
1565
- function formatNewRefToLegacyRef(value) {
1566
- return {
1567
- type: "ref",
1568
- content: value.content.join(".")
1569
- };
1570
- }
1571
-
1572
1519
  // src/components/dynamic-value-input/styles.tsx
1573
- import styled3 from "styled-components";
1574
- var UIContainer2 = styled3.div`
1520
+ import styled4 from "styled-components";
1521
+ var UIContainer2 = styled4.div`
1575
1522
  display: flex;
1576
1523
  align-items: center;
1577
1524
  border-radius: 4px;
@@ -1581,7 +1528,7 @@ var UIContainer2 = styled3.div`
1581
1528
 
1582
1529
  background-color: var(--semi-color-fill-0);
1583
1530
  `;
1584
- var UIMain = styled3.div`
1531
+ var UIMain = styled4.div`
1585
1532
  flex-grow: 1;
1586
1533
  overflow: hidden;
1587
1534
  min-width: 0;
@@ -1599,14 +1546,14 @@ var UIMain = styled3.div`
1599
1546
  border-radius: 0;
1600
1547
  }
1601
1548
  `;
1602
- var UIType2 = styled3.div`
1549
+ var UIType2 = styled4.div`
1603
1550
  border-right: 1px solid #e5e5e5;
1604
1551
 
1605
1552
  & .semi-button {
1606
1553
  border-radius: 0;
1607
1554
  }
1608
1555
  `;
1609
- var UITrigger = styled3.div`
1556
+ var UITrigger = styled4.div`
1610
1557
  border-left: 1px solid #e5e5e5;
1611
1558
 
1612
1559
  & .semi-button {
@@ -1614,6 +1561,39 @@ var UITrigger = styled3.div`
1614
1561
  }
1615
1562
  `;
1616
1563
 
1564
+ // src/components/dynamic-value-input/hooks.ts
1565
+ import { useMemo as useMemo6, useState as useState5 } from "react";
1566
+ import { useScopeAvailable } from "@flowgram.ai/editor";
1567
+ function useRefVariable(value) {
1568
+ const available = useScopeAvailable();
1569
+ const refVariable = useMemo6(() => {
1570
+ if (value?.type === "ref") {
1571
+ return available.getByKeyPath(value.content);
1572
+ }
1573
+ }, [value, available]);
1574
+ return refVariable;
1575
+ }
1576
+ function useSelectSchema(schemaFromProps, constantProps, value) {
1577
+ let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: "string" };
1578
+ if (value?.type === "constant") {
1579
+ defaultSelectSchema = value?.schema || defaultSelectSchema;
1580
+ }
1581
+ const [selectSchema, setSelectSchema] = useState5(defaultSelectSchema);
1582
+ return [selectSchema, setSelectSchema];
1583
+ }
1584
+ function useIncludeSchema(schemaFromProps) {
1585
+ const includeSchema = useMemo6(() => {
1586
+ if (!schemaFromProps) {
1587
+ return;
1588
+ }
1589
+ if (schemaFromProps?.type === "number") {
1590
+ return [schemaFromProps, { type: "integer" }];
1591
+ }
1592
+ return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
1593
+ }, [schemaFromProps]);
1594
+ return includeSchema;
1595
+ }
1596
+
1617
1597
  // src/components/dynamic-value-input/index.tsx
1618
1598
  function DynamicValueInput({
1619
1599
  value,
@@ -1623,44 +1603,46 @@ function DynamicValueInput({
1623
1603
  schema: schemaFromProps,
1624
1604
  constantProps
1625
1605
  }) {
1626
- const available = useScopeAvailable();
1627
- const refVariable = useMemo6(() => {
1628
- if (value?.type === "ref") {
1629
- return available.getByKeyPath(value.content);
1630
- }
1631
- }, [value, available]);
1632
- const [selectSchema, setSelectSchema] = useState5(
1633
- schemaFromProps || constantProps?.schema || { type: "string" }
1634
- );
1606
+ const refVariable = useRefVariable(value);
1607
+ const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
1608
+ const includeSchema = useIncludeSchema(schemaFromProps);
1635
1609
  const renderTypeSelector = () => {
1636
1610
  if (schemaFromProps) {
1637
- return /* @__PURE__ */ React11.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1611
+ return /* @__PURE__ */ React19.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1638
1612
  }
1639
1613
  if (value?.type === "ref") {
1640
- const schema = refVariable?.type ? JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
1641
- return /* @__PURE__ */ React11.createElement(TypeSelector, { value: schema, readonly: true });
1614
+ const schema = refVariable?.type ? JsonSchemaUtils3.astToSchema(refVariable?.type) : void 0;
1615
+ return /* @__PURE__ */ React19.createElement(TypeSelector, { value: schema, readonly: true });
1642
1616
  }
1643
- return /* @__PURE__ */ React11.createElement(
1617
+ return /* @__PURE__ */ React19.createElement(
1644
1618
  TypeSelector,
1645
1619
  {
1646
1620
  value: selectSchema,
1647
- onChange: (_v) => setSelectSchema(_v || { type: "string" }),
1621
+ onChange: (_v) => {
1622
+ setSelectSchema(_v || { type: "string" });
1623
+ let content;
1624
+ if (_v?.type === "object") {
1625
+ content = "{}";
1626
+ }
1627
+ if (_v?.type === "array") {
1628
+ content = "[]";
1629
+ }
1630
+ if (_v?.type === "boolean") {
1631
+ content = false;
1632
+ }
1633
+ onChange({
1634
+ type: "constant",
1635
+ content,
1636
+ schema: _v || { type: "string" }
1637
+ });
1638
+ },
1648
1639
  readonly
1649
1640
  }
1650
1641
  );
1651
1642
  };
1652
- const includeSchema = useMemo6(() => {
1653
- if (!schemaFromProps) {
1654
- return;
1655
- }
1656
- if (schemaFromProps?.type === "number") {
1657
- return [schemaFromProps, { type: "integer" }];
1658
- }
1659
- return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
1660
- }, [schemaFromProps]);
1661
1643
  const renderMain = () => {
1662
1644
  if (value?.type === "ref") {
1663
- return /* @__PURE__ */ React11.createElement(
1645
+ return /* @__PURE__ */ React19.createElement(
1664
1646
  VariableSelector,
1665
1647
  {
1666
1648
  style: { width: "100%" },
@@ -1672,7 +1654,7 @@ function DynamicValueInput({
1672
1654
  );
1673
1655
  }
1674
1656
  const constantSchema = schemaFromProps || selectSchema || { type: "string" };
1675
- return /* @__PURE__ */ React11.createElement(
1657
+ return /* @__PURE__ */ React19.createElement(
1676
1658
  ConstantInput,
1677
1659
  {
1678
1660
  value: value?.content,
@@ -1680,7 +1662,7 @@ function DynamicValueInput({
1680
1662
  schema: constantSchema || { type: "string" },
1681
1663
  readonly,
1682
1664
  strategies: [...constantProps?.strategies || []],
1683
- fallbackRenderer: () => /* @__PURE__ */ React11.createElement(
1665
+ fallbackRenderer: () => /* @__PURE__ */ React19.createElement(
1684
1666
  VariableSelector,
1685
1667
  {
1686
1668
  style: { width: "100%" },
@@ -1693,7 +1675,7 @@ function DynamicValueInput({
1693
1675
  }
1694
1676
  );
1695
1677
  };
1696
- const renderTrigger = () => /* @__PURE__ */ React11.createElement(
1678
+ const renderTrigger = () => /* @__PURE__ */ React19.createElement(
1697
1679
  VariableSelector,
1698
1680
  {
1699
1681
  style: { width: "100%" },
@@ -1701,31 +1683,31 @@ function DynamicValueInput({
1701
1683
  onChange: (_v) => onChange({ type: "ref", content: _v }),
1702
1684
  includeSchema,
1703
1685
  readonly,
1704
- triggerRender: () => /* @__PURE__ */ React11.createElement(IconButton4, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React11.createElement(IconSetting, { size: "small" }) })
1686
+ triggerRender: () => /* @__PURE__ */ React19.createElement(IconButton4, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React19.createElement(IconSetting, { size: "small" }) })
1705
1687
  }
1706
1688
  );
1707
- return /* @__PURE__ */ React11.createElement(UIContainer2, { style }, /* @__PURE__ */ React11.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React11.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React11.createElement(UITrigger, null, renderTrigger()));
1689
+ return /* @__PURE__ */ React19.createElement(UIContainer2, { style }, /* @__PURE__ */ React19.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React19.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React19.createElement(UITrigger, null, renderTrigger()));
1708
1690
  }
1709
1691
 
1710
1692
  // src/components/condition-row/index.tsx
1711
- import React13, { useMemo as useMemo9 } from "react";
1712
- import { Input as Input3 } from "@douyinfe/semi-ui";
1693
+ import React21, { useMemo as useMemo9 } from "react";
1694
+ import { Input as Input4 } from "@douyinfe/semi-ui";
1713
1695
 
1714
1696
  // src/components/condition-row/styles.tsx
1715
- import styled4 from "styled-components";
1716
- var UIContainer3 = styled4.div`
1697
+ import styled5 from "styled-components";
1698
+ var UIContainer3 = styled5.div`
1717
1699
  display: flex;
1718
1700
  align-items: center;
1719
1701
  gap: 4px;
1720
1702
  `;
1721
- var UIOperator = styled4.div``;
1722
- var UILeft = styled4.div`
1703
+ var UIOperator = styled5.div``;
1704
+ var UILeft = styled5.div`
1723
1705
  width: 100%;
1724
1706
  `;
1725
- var UIRight = styled4.div`
1707
+ var UIRight = styled5.div`
1726
1708
  width: 100%;
1727
1709
  `;
1728
- var UIValues = styled4.div`
1710
+ var UIValues = styled5.div`
1729
1711
  flex-grow: 1;
1730
1712
  display: flex;
1731
1713
  flex-direction: column;
@@ -1735,6 +1717,7 @@ var UIValues = styled4.div`
1735
1717
 
1736
1718
  // src/components/condition-row/hooks/useRule.ts
1737
1719
  import { useMemo as useMemo7 } from "react";
1720
+ import { JsonSchemaUtils as JsonSchemaUtils4 } from "@flowgram.ai/json-schema";
1738
1721
  import { useScopeAvailable as useScopeAvailable2 } from "@flowgram.ai/editor";
1739
1722
 
1740
1723
  // src/components/condition-row/constants.ts
@@ -1862,18 +1845,18 @@ function useRule(left) {
1862
1845
  }, [available, left]);
1863
1846
  const rule = useMemo7(() => {
1864
1847
  if (!variable) return void 0;
1865
- const schema = JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
1848
+ const schema = JsonSchemaUtils4.astToSchema(variable.type, { drilldown: false });
1866
1849
  return rules[schema?.type];
1867
1850
  }, [variable?.type]);
1868
1851
  return { rule };
1869
1852
  }
1870
1853
 
1871
1854
  // src/components/condition-row/hooks/useOp.tsx
1872
- import React12, { useMemo as useMemo8 } from "react";
1855
+ import React20, { useMemo as useMemo8 } from "react";
1873
1856
  import { Button as Button2, Select as Select2 } from "@douyinfe/semi-ui";
1874
1857
  import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
1875
1858
  function useOp({ rule, op, onChange, readonly }) {
1876
- const options2 = useMemo8(
1859
+ const options = useMemo8(
1877
1860
  () => Object.keys(rule || {}).map((_op) => ({
1878
1861
  ...opConfigs[_op] || {},
1879
1862
  value: _op
@@ -1881,18 +1864,18 @@ function useOp({ rule, op, onChange, readonly }) {
1881
1864
  [rule]
1882
1865
  );
1883
1866
  const opConfig = useMemo8(() => opConfigs[op], [op]);
1884
- const renderOpSelect = () => /* @__PURE__ */ React12.createElement(
1867
+ const renderOpSelect = () => /* @__PURE__ */ React20.createElement(
1885
1868
  Select2,
1886
1869
  {
1887
1870
  style: { height: 22 },
1888
1871
  disabled: readonly,
1889
1872
  size: "small",
1890
1873
  value: op,
1891
- optionList: options2,
1874
+ optionList: options,
1892
1875
  onChange: (v) => {
1893
1876
  onChange(v);
1894
1877
  },
1895
- triggerRender: ({ value }) => /* @__PURE__ */ React12.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React12.createElement(IconChevronDownStroked2, { size: "small" }))
1878
+ triggerRender: ({ value }) => /* @__PURE__ */ React20.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React20.createElement(IconChevronDownStroked2, { size: "small" }))
1896
1879
  }
1897
1880
  );
1898
1881
  return { renderOpSelect, opConfig };
@@ -1912,7 +1895,7 @@ function ConditionRow({ style, value, onChange, readonly }) {
1912
1895
  const targetType = rule?.[operator] || null;
1913
1896
  return targetType ? { type: targetType, extra: { weak: true } } : null;
1914
1897
  }, [rule, opConfig]);
1915
- return /* @__PURE__ */ React13.createElement(UIContainer3, { style }, /* @__PURE__ */ React13.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React13.createElement(UIValues, null, /* @__PURE__ */ React13.createElement(UILeft, null, /* @__PURE__ */ React13.createElement(
1898
+ return /* @__PURE__ */ React21.createElement(UIContainer3, { style }, /* @__PURE__ */ React21.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React21.createElement(UIValues, null, /* @__PURE__ */ React21.createElement(UILeft, null, /* @__PURE__ */ React21.createElement(
1916
1899
  VariableSelector,
1917
1900
  {
1918
1901
  readonly,
@@ -1926,7 +1909,7 @@ function ConditionRow({ style, value, onChange, readonly }) {
1926
1909
  }
1927
1910
  })
1928
1911
  }
1929
- )), /* @__PURE__ */ React13.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React13.createElement(
1912
+ )), /* @__PURE__ */ React21.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React21.createElement(
1930
1913
  DynamicValueInput,
1931
1914
  {
1932
1915
  readonly: readonly || !rule,
@@ -1934,8 +1917,8 @@ function ConditionRow({ style, value, onChange, readonly }) {
1934
1917
  schema: targetSchema,
1935
1918
  onChange: (v) => onChange({ ...value, right: v })
1936
1919
  }
1937
- ) : /* @__PURE__ */ React13.createElement(
1938
- Input3,
1920
+ ) : /* @__PURE__ */ React21.createElement(
1921
+ Input4,
1939
1922
  {
1940
1923
  size: "small",
1941
1924
  disabled: true,
@@ -1946,14 +1929,14 @@ function ConditionRow({ style, value, onChange, readonly }) {
1946
1929
  }
1947
1930
 
1948
1931
  // src/components/batch-outputs/index.tsx
1949
- import React14 from "react";
1950
- import { Button as Button3, Input as Input4 } from "@douyinfe/semi-ui";
1932
+ import React22 from "react";
1933
+ import { Button as Button3, Input as Input5 } from "@douyinfe/semi-ui";
1951
1934
  import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
1952
1935
 
1953
1936
  // src/hooks/use-object-list/index.tsx
1954
- import { useEffect as useEffect3, useState as useState6 } from "react";
1937
+ import { useEffect as useEffect4, useState as useState6 } from "react";
1955
1938
  import { nanoid } from "nanoid";
1956
- import { difference, get as get2, isObject as isObject2, set } from "lodash";
1939
+ import { difference, get, isObject as isObject2, set } from "lodash";
1957
1940
  function genId2() {
1958
1941
  return nanoid();
1959
1942
  }
@@ -1963,9 +1946,9 @@ function useObjectList({
1963
1946
  sortIndexKey
1964
1947
  }) {
1965
1948
  const [list, setList] = useState6([]);
1966
- useEffect3(() => {
1949
+ useEffect4(() => {
1967
1950
  setList((_prevList) => {
1968
- const newKeys = Object.entries(value || {}).sort((a, b) => get2(a[1], sortIndexKey || 0) - get2(b[1], sortIndexKey || 0)).map(([key]) => key);
1951
+ const newKeys = Object.entries(value || {}).sort((a, b) => get(a[1], sortIndexKey || 0) - get(b[1], sortIndexKey || 0)).map(([key]) => key);
1969
1952
  const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
1970
1953
  const addKeys = difference(newKeys, oldKeys);
1971
1954
  return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
@@ -2047,14 +2030,14 @@ function useObjectList({
2047
2030
  }
2048
2031
 
2049
2032
  // src/components/batch-outputs/styles.tsx
2050
- import styled5 from "styled-components";
2051
- var UIRows = styled5.div`
2033
+ import styled6 from "styled-components";
2034
+ var UIRows = styled6.div`
2052
2035
  display: flex;
2053
2036
  flex-direction: column;
2054
2037
  gap: 10px;
2055
2038
  margin-bottom: 10px;
2056
2039
  `;
2057
- var UIRow2 = styled5.div`
2040
+ var UIRow2 = styled6.div`
2058
2041
  display: flex;
2059
2042
  align-items: center;
2060
2043
  gap: 5px;
@@ -2064,8 +2047,8 @@ var UIRow2 = styled5.div`
2064
2047
  function BatchOutputs(props) {
2065
2048
  const { readonly, style } = props;
2066
2049
  const { list, add, updateKey, updateValue, remove } = useObjectList(props);
2067
- return /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React14.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React14.createElement(
2068
- Input4,
2050
+ return /* @__PURE__ */ React22.createElement("div", null, /* @__PURE__ */ React22.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React22.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React22.createElement(
2051
+ Input5,
2069
2052
  {
2070
2053
  style: { width: 100 },
2071
2054
  disabled: readonly,
@@ -2073,7 +2056,7 @@ function BatchOutputs(props) {
2073
2056
  value: item.key,
2074
2057
  onChange: (v) => updateKey(item.id, v)
2075
2058
  }
2076
- ), /* @__PURE__ */ React14.createElement(
2059
+ ), /* @__PURE__ */ React22.createElement(
2077
2060
  VariableSelector,
2078
2061
  {
2079
2062
  style: { flexGrow: 1 },
@@ -2081,25 +2064,25 @@ function BatchOutputs(props) {
2081
2064
  value: item.value?.content,
2082
2065
  onChange: (v) => updateValue(item.id, { type: "ref", content: v })
2083
2066
  }
2084
- ), /* @__PURE__ */ React14.createElement(
2067
+ ), /* @__PURE__ */ React22.createElement(
2085
2068
  Button3,
2086
2069
  {
2087
2070
  disabled: readonly,
2088
- icon: /* @__PURE__ */ React14.createElement(IconDelete, null),
2071
+ icon: /* @__PURE__ */ React22.createElement(IconDelete, null),
2089
2072
  size: "small",
2090
2073
  onClick: () => remove(item.id)
2091
2074
  }
2092
- )))), /* @__PURE__ */ React14.createElement(Button3, { disabled: readonly, icon: /* @__PURE__ */ React14.createElement(IconPlus2, null), size: "small", onClick: add }, "Add"));
2075
+ )))), /* @__PURE__ */ React22.createElement(Button3, { disabled: readonly, icon: /* @__PURE__ */ React22.createElement(IconPlus2, null), size: "small", onClick: add }, "Add"));
2093
2076
  }
2094
2077
 
2095
2078
  // src/components/prompt-editor/index.tsx
2096
- import React15, { useEffect as useEffect4, useRef as useRef3 } from "react";
2097
- import { Renderer, EditorProvider, ActiveLinePlaceholder } from "@coze-editor/editor/react";
2098
- import preset from "@coze-editor/editor/preset-prompt";
2079
+ import React23, { useEffect as useEffect5, useRef as useRef4 } from "react";
2080
+ import { Renderer, EditorProvider as EditorProvider2, ActiveLinePlaceholder as ActiveLinePlaceholder2 } from "@coze-editor/editor/react";
2081
+ import preset2 from "@coze-editor/editor/preset-prompt";
2099
2082
 
2100
2083
  // src/components/prompt-editor/styles.tsx
2101
- import styled6, { css as css3 } from "styled-components";
2102
- var UIContainer4 = styled6.div`
2084
+ import styled7, { css as css3 } from "styled-components";
2085
+ var UIContainer4 = styled7.div`
2103
2086
  background-color: var(--semi-color-fill-0);
2104
2087
  padding-left: 10px;
2105
2088
  padding-right: 6px;
@@ -2113,7 +2096,7 @@ var UIContainer4 = styled6.div`
2113
2096
  import { useLayoutEffect } from "react";
2114
2097
  import { useInjector } from "@coze-editor/editor/react";
2115
2098
  import { astDecorator } from "@coze-editor/editor";
2116
- import { EditorView } from "@codemirror/view";
2099
+ import { EditorView as EditorView2 } from "@codemirror/view";
2117
2100
  function MarkdownHighlight() {
2118
2101
  const injector = useInjector();
2119
2102
  useLayoutEffect(
@@ -2144,7 +2127,7 @@ function MarkdownHighlight() {
2144
2127
  };
2145
2128
  }
2146
2129
  }),
2147
- EditorView.theme({
2130
+ EditorView2.theme({
2148
2131
  ".heading": {
2149
2132
  color: "#00818C",
2150
2133
  fontWeight: "bold"
@@ -2181,7 +2164,7 @@ var language_support_default = LanguageSupport;
2181
2164
  import { useLayoutEffect as useLayoutEffect3 } from "react";
2182
2165
  import { useInjector as useInjector3 } from "@coze-editor/editor/react";
2183
2166
  import { astDecorator as astDecorator2 } from "@coze-editor/editor";
2184
- import { EditorView as EditorView2 } from "@codemirror/view";
2167
+ import { EditorView as EditorView3 } from "@codemirror/view";
2185
2168
  function JinjaHighlight() {
2186
2169
  const injector = useInjector3();
2187
2170
  useLayoutEffect3(
@@ -2206,7 +2189,7 @@ function JinjaHighlight() {
2206
2189
  };
2207
2190
  }
2208
2191
  }),
2209
- EditorView2.theme({
2192
+ EditorView3.theme({
2210
2193
  ".jinja-statement-bracket": {
2211
2194
  color: "#D1009D"
2212
2195
  },
@@ -2237,19 +2220,19 @@ function PromptEditor(props) {
2237
2220
  children,
2238
2221
  disableMarkdownHighlight
2239
2222
  } = props || {};
2240
- const editorRef = useRef3(null);
2241
- useEffect4(() => {
2223
+ const editorRef = useRef4(null);
2224
+ useEffect5(() => {
2242
2225
  if (editorRef.current?.getValue() !== value?.content) {
2243
2226
  editorRef.current?.setValue(String(value?.content || ""));
2244
2227
  }
2245
2228
  }, [value]);
2246
- return /* @__PURE__ */ React15.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ React15.createElement(EditorProvider, null, /* @__PURE__ */ React15.createElement(
2229
+ return /* @__PURE__ */ React23.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ React23.createElement(EditorProvider2, null, /* @__PURE__ */ React23.createElement(
2247
2230
  Renderer,
2248
2231
  {
2249
2232
  didMount: (editor) => {
2250
2233
  editorRef.current = editor;
2251
2234
  },
2252
- plugins: preset,
2235
+ plugins: preset2,
2253
2236
  defaultValue: String(value?.content),
2254
2237
  options: {
2255
2238
  readOnly: readonly,
@@ -2260,14 +2243,14 @@ function PromptEditor(props) {
2260
2243
  onChange({ type: "template", content: e.value });
2261
2244
  }
2262
2245
  }
2263
- ), activeLinePlaceholder && /* @__PURE__ */ React15.createElement(ActiveLinePlaceholder, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ React15.createElement(markdown_default, null), /* @__PURE__ */ React15.createElement(language_support_default, null), /* @__PURE__ */ React15.createElement(jinja_default, null), children));
2246
+ ), activeLinePlaceholder && /* @__PURE__ */ React23.createElement(ActiveLinePlaceholder2, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ React23.createElement(markdown_default, null), /* @__PURE__ */ React23.createElement(language_support_default, null), /* @__PURE__ */ React23.createElement(jinja_default, null), children));
2264
2247
  }
2265
2248
 
2266
2249
  // src/components/prompt-editor-with-variables/index.tsx
2267
- import React18 from "react";
2250
+ import React26 from "react";
2268
2251
 
2269
2252
  // src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
2270
- import React16, { useEffect as useEffect5, useState as useState7 } from "react";
2253
+ import React24, { useEffect as useEffect6, useState as useState7 } from "react";
2271
2254
  import { Popover as Popover2, Tree } from "@douyinfe/semi-ui";
2272
2255
  import {
2273
2256
  Mention,
@@ -2295,20 +2278,20 @@ function VariableTree() {
2295
2278
  setPosition(e.state.selection.main.head);
2296
2279
  setVisible(e.value);
2297
2280
  }
2298
- useEffect5(() => {
2281
+ useEffect6(() => {
2299
2282
  if (!editor) {
2300
2283
  return;
2301
2284
  }
2302
2285
  }, [editor, visible]);
2303
2286
  const treeData = useVariableTree({});
2304
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React16.createElement(
2287
+ return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React24.createElement(
2305
2288
  Popover2,
2306
2289
  {
2307
2290
  visible,
2308
2291
  trigger: "custom",
2309
2292
  position: "topLeft",
2310
2293
  rePosKey: posKey,
2311
- content: /* @__PURE__ */ React16.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React16.createElement(
2294
+ content: /* @__PURE__ */ React24.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React24.createElement(
2312
2295
  Tree,
2313
2296
  {
2314
2297
  treeData,
@@ -2318,7 +2301,7 @@ function VariableTree() {
2318
2301
  }
2319
2302
  ))
2320
2303
  },
2321
- /* @__PURE__ */ React16.createElement(
2304
+ /* @__PURE__ */ React24.createElement(
2322
2305
  PositionMirror,
2323
2306
  {
2324
2307
  position,
@@ -2330,7 +2313,7 @@ function VariableTree() {
2330
2313
 
2331
2314
  // src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
2332
2315
  import ReactDOM from "react-dom";
2333
- import React17, { useLayoutEffect as useLayoutEffect4 } from "react";
2316
+ import React25, { useLayoutEffect as useLayoutEffect4 } from "react";
2334
2317
  import { isEqual, last } from "lodash";
2335
2318
  import {
2336
2319
  Disposable,
@@ -2342,16 +2325,16 @@ import { IconIssueStroked as IconIssueStroked2 } from "@douyinfe/semi-icons";
2342
2325
  import { useInjector as useInjector4 } from "@coze-editor/editor/react";
2343
2326
  import {
2344
2327
  Decoration,
2345
- EditorView as EditorView3,
2328
+ EditorView as EditorView4,
2346
2329
  MatchDecorator,
2347
2330
  ViewPlugin,
2348
2331
  WidgetType
2349
2332
  } from "@codemirror/view";
2350
2333
 
2351
2334
  // src/components/prompt-editor-with-variables/styles.tsx
2352
- import styled7 from "styled-components";
2335
+ import styled8 from "styled-components";
2353
2336
  import { Tag as Tag2 } from "@douyinfe/semi-ui";
2354
- var UIRootTitle2 = styled7.div`
2337
+ var UIRootTitle2 = styled8.div`
2355
2338
  margin-right: 4px;
2356
2339
  min-width: 20px;
2357
2340
  overflow: hidden;
@@ -2359,12 +2342,12 @@ var UIRootTitle2 = styled7.div`
2359
2342
  white-space: nowrap;
2360
2343
  color: var(--semi-color-text-2);
2361
2344
  `;
2362
- var UIVarName2 = styled7.div`
2345
+ var UIVarName2 = styled8.div`
2363
2346
  overflow: hidden;
2364
2347
  text-overflow: ellipsis;
2365
2348
  white-space: nowrap;
2366
2349
  `;
2367
- var UITag2 = styled7(Tag2)`
2350
+ var UITag2 = styled8(Tag2)`
2368
2351
  display: inline-flex;
2369
2352
  align-items: center;
2370
2353
  justify-content: flex-start;
@@ -2378,7 +2361,7 @@ var UITag2 = styled7(Tag2)`
2378
2361
  margin: 0 5px;
2379
2362
  }
2380
2363
  `;
2381
- var UIPopoverContent2 = styled7.div`
2364
+ var UIPopoverContent2 = styled8.div`
2382
2365
  padding: 10px;
2383
2366
  display: inline-flex;
2384
2367
  align-items: center;
@@ -2392,7 +2375,7 @@ var VariableTagWidget = class extends WidgetType {
2392
2375
  this.toDispose = new DisposableCollection();
2393
2376
  this.renderIcon = (icon) => {
2394
2377
  if (typeof icon === "string") {
2395
- return /* @__PURE__ */ React17.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2378
+ return /* @__PURE__ */ React25.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2396
2379
  }
2397
2380
  return icon;
2398
2381
  };
@@ -2405,21 +2388,21 @@ var VariableTagWidget = class extends WidgetType {
2405
2388
  renderVariable(v) {
2406
2389
  if (!v) {
2407
2390
  this.renderReact(
2408
- /* @__PURE__ */ React17.createElement(UITag2, { prefixIcon: /* @__PURE__ */ React17.createElement(IconIssueStroked2, null), color: "amber" }, "Unknown")
2391
+ /* @__PURE__ */ React25.createElement(UITag2, { prefixIcon: /* @__PURE__ */ React25.createElement(IconIssueStroked2, null), color: "amber" }, "Unknown")
2409
2392
  );
2410
2393
  return;
2411
2394
  }
2412
2395
  const rootField = last(v.parentFields) || v;
2413
2396
  const isRoot = v.parentFields.length === 0;
2414
- const rootTitle = /* @__PURE__ */ React17.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
2397
+ const rootTitle = /* @__PURE__ */ React25.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} ${isRoot ? "" : "-"} ` : "");
2415
2398
  const rootIcon = this.renderIcon(rootField?.meta.icon);
2416
2399
  this.renderReact(
2417
- /* @__PURE__ */ React17.createElement(
2400
+ /* @__PURE__ */ React25.createElement(
2418
2401
  Popover3,
2419
2402
  {
2420
- content: /* @__PURE__ */ React17.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ React17.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2403
+ content: /* @__PURE__ */ React25.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ React25.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2421
2404
  },
2422
- /* @__PURE__ */ React17.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ React17.createElement(UIVarName2, null, v?.key))
2405
+ /* @__PURE__ */ React25.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, !isRoot && /* @__PURE__ */ React25.createElement(UIVarName2, null, v?.key))
2423
2406
  )
2424
2407
  );
2425
2408
  }
@@ -2480,508 +2463,163 @@ function VariableTagInject() {
2480
2463
  {
2481
2464
  decorations: (p) => p.decorations,
2482
2465
  provide(p) {
2483
- return EditorView3.atomicRanges.of(
2466
+ return EditorView4.atomicRanges.of(
2484
2467
  (view) => view.plugin(p)?.decorations ?? Decoration.none
2485
2468
  );
2486
2469
  }
2487
2470
  }
2488
2471
  )
2489
2472
  ]);
2490
- }, [injector]);
2491
- return null;
2492
- }
2493
-
2494
- // src/components/prompt-editor-with-variables/index.tsx
2495
- function PromptEditorWithVariables(props) {
2496
- return /* @__PURE__ */ React18.createElement(PromptEditor, { ...props }, /* @__PURE__ */ React18.createElement(VariableTree, null), /* @__PURE__ */ React18.createElement(VariableTagInject, null));
2497
- }
2498
-
2499
- // src/components/prompt-editor-with-inputs/index.tsx
2500
- import React21 from "react";
2501
-
2502
- // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2503
- import React20, { useEffect as useEffect6, useState as useState8 } from "react";
2504
- import { Popover as Popover4 } from "@douyinfe/semi-ui";
2505
- import {
2506
- Mention as Mention2,
2507
- getCurrentMentionReplaceRange as getCurrentMentionReplaceRange2,
2508
- useEditor as useEditor2,
2509
- PositionMirror as PositionMirror2
2510
- } from "@coze-editor/editor/react";
2511
-
2512
- // src/components/prompt-editor-with-inputs/inputs-picker.tsx
2513
- import React19, { useMemo as useMemo10 } from "react";
2514
- import { last as last2 } from "lodash";
2515
- import {
2516
- ASTMatch as ASTMatch3,
2517
- useScopeAvailable as useScopeAvailable3
2518
- } from "@flowgram.ai/editor";
2519
- import { Tree as Tree2 } from "@douyinfe/semi-ui";
2520
- function InputsPicker({
2521
- inputsValues,
2522
- onSelect
2523
- }) {
2524
- const available = useScopeAvailable3();
2525
- const getArrayDrilldown = (type, depth = 1) => {
2526
- if (ASTMatch3.isArray(type.items)) {
2527
- return getArrayDrilldown(type.items, depth + 1);
2528
- }
2529
- return { type: type.items, depth };
2530
- };
2531
- const renderVariable = (variable, keyPath) => {
2532
- let type = variable?.type;
2533
- let children;
2534
- if (ASTMatch3.isObject(type)) {
2535
- children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
2536
- }
2537
- if (ASTMatch3.isArray(type)) {
2538
- const drilldown = getArrayDrilldown(type);
2539
- if (ASTMatch3.isObject(drilldown.type)) {
2540
- children = (drilldown.type.properties || []).map(
2541
- (_property) => renderVariable(_property, [
2542
- ...keyPath,
2543
- ...new Array(drilldown.depth).fill("[0]"),
2544
- _property.key
2545
- ])
2546
- ).filter(Boolean);
2547
- }
2548
- }
2549
- const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
2550
- return {
2551
- key,
2552
- label: last2(keyPath),
2553
- value: key,
2554
- children
2555
- };
2556
- };
2557
- const treeData = useMemo10(
2558
- () => Object.entries(inputsValues).map(([key, value]) => {
2559
- if (value?.type === "ref") {
2560
- const variable = available.getByKeyPath(value.content || []);
2561
- if (variable) {
2562
- return renderVariable(variable, [key]);
2563
- }
2564
- }
2565
- return {
2566
- key,
2567
- value: key,
2568
- label: key
2569
- };
2570
- }),
2571
- []
2572
- );
2573
- return /* @__PURE__ */ React19.createElement(Tree2, { treeData, onSelect: (v) => onSelect(v) });
2574
- }
2575
-
2576
- // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2577
- function InputsTree({ inputsValues }) {
2578
- const [posKey, setPosKey] = useState8("");
2579
- const [visible, setVisible] = useState8(false);
2580
- const [position, setPosition] = useState8(-1);
2581
- const editor = useEditor2();
2582
- function insert(variablePath) {
2583
- const range = getCurrentMentionReplaceRange2(editor.$view.state);
2584
- if (!range) {
2585
- return;
2586
- }
2587
- editor.replaceText({
2588
- ...range,
2589
- text: "{{" + variablePath + "}}"
2590
- });
2591
- setVisible(false);
2592
- }
2593
- function handleOpenChange(e) {
2594
- setPosition(e.state.selection.main.head);
2595
- setVisible(e.value);
2596
- }
2597
- useEffect6(() => {
2598
- if (!editor) {
2599
- return;
2600
- }
2601
- }, [editor, visible]);
2602
- return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React20.createElement(
2603
- Popover4,
2604
- {
2605
- visible,
2606
- trigger: "custom",
2607
- position: "topLeft",
2608
- rePosKey: posKey,
2609
- content: /* @__PURE__ */ React20.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React20.createElement(
2610
- InputsPicker,
2611
- {
2612
- inputsValues,
2613
- onSelect: (v) => {
2614
- insert(v);
2615
- }
2616
- }
2617
- ))
2618
- },
2619
- /* @__PURE__ */ React20.createElement(
2620
- PositionMirror2,
2621
- {
2622
- position,
2623
- onChange: () => setPosKey(String(Math.random()))
2624
- }
2625
- )
2626
- ));
2627
- }
2628
-
2629
- // src/components/prompt-editor-with-inputs/index.tsx
2630
- function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2631
- return /* @__PURE__ */ React21.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React21.createElement(InputsTree, { inputsValues }));
2632
- }
2633
-
2634
- // src/components/code-editor/index.tsx
2635
- import React22, { useEffect as useEffect7, useRef as useRef4 } from "react";
2636
- import {
2637
- ActiveLinePlaceholder as ActiveLinePlaceholder2,
2638
- createRenderer,
2639
- EditorProvider as EditorProvider2
2640
- } from "@coze-editor/editor/react";
2641
- import preset2 from "@coze-editor/editor/preset-code";
2642
- import { EditorView as EditorView4 } from "@codemirror/view";
2643
-
2644
- // src/components/code-editor/utils.ts
2645
- function getSuffixByLanguageId(languageId) {
2646
- if (languageId === "python") {
2647
- return ".py";
2648
- }
2649
- if (languageId === "typescript") {
2650
- return ".ts";
2651
- }
2652
- if (languageId === "shell") {
2653
- return ".sh";
2654
- }
2655
- if (languageId === "json") {
2656
- return ".json";
2657
- }
2658
- return "";
2659
- }
2660
-
2661
- // src/components/code-editor/language-features.ts
2662
- import { languages } from "@coze-editor/editor/preset-code";
2663
- import { typescript } from "@coze-editor/editor/language-typescript";
2664
- import { shell } from "@coze-editor/editor/language-shell";
2665
- import { python } from "@coze-editor/editor/language-python";
2666
- import { json } from "@coze-editor/editor/language-json";
2667
- import { mixLanguages } from "@coze-editor/editor";
2668
- languages.register("python", python);
2669
- languages.register("shell", shell);
2670
- languages.register("typescript", typescript);
2671
- languages.register("json", {
2672
- // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
2673
- language: mixLanguages({
2674
- outerLanguage: json.language
2675
- }),
2676
- languageService: json.languageService
2677
- });
2678
- var tsWorkerInit = false;
2679
- var initTsWorker = () => {
2680
- if (tsWorkerInit) {
2681
- return;
2682
- }
2683
- tsWorkerInit = true;
2684
- const tsWorker = new Worker(
2685
- new URL(`@coze-editor/editor/language-typescript/worker`, import.meta.url),
2686
- { type: "module" }
2687
- );
2688
- typescript.languageService.initialize(tsWorker, {
2689
- compilerOptions: {
2690
- // eliminate Promise error
2691
- lib: ["es2015", "dom"],
2692
- noImplicitAny: false
2693
- }
2694
- });
2695
- };
2696
-
2697
- // src/components/code-editor/theme/index.ts
2698
- import { themes } from "@coze-editor/editor/preset-code";
2699
-
2700
- // src/components/code-editor/theme/light.ts
2701
- import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
2702
- var colors = {
2703
- background: "#F7F7FC",
2704
- // syntax
2705
- comment: "#000A298A",
2706
- key: "#00818C",
2707
- string: "#D1009D",
2708
- number: "#C74200",
2709
- boolean: "#2B57D9",
2710
- null: "#2B57D9",
2711
- separator: "#0F1529D1"
2712
- };
2713
- var lightTheme = createTheme({
2714
- variant: "light",
2715
- settings: {
2716
- background: "#fff",
2717
- foreground: "#000",
2718
- caret: "#000",
2719
- selection: "#d9d9d9",
2720
- gutterBackground: "#f0f0f0",
2721
- gutterForeground: "#666",
2722
- gutterBorderColor: "transparent",
2723
- gutterBorderWidth: 0,
2724
- lineHighlight: "#f0f0f0",
2725
- bracketColors: ["#FFD700", "#DD99FF", "#78B0FF"],
2726
- tooltip: {
2727
- backgroundColor: "#f0f0f0",
2728
- color: "#000",
2729
- border: "1px solid #ccc"
2730
- },
2731
- link: {
2732
- color: "#007bff"
2733
- },
2734
- completionItemHover: {
2735
- backgroundColor: "#f0f0f0"
2736
- },
2737
- completionItemSelected: {
2738
- backgroundColor: "#e0e0e0"
2739
- },
2740
- completionItemIcon: {
2741
- color: "#333"
2742
- },
2743
- completionItemLabel: {
2744
- color: "#333"
2745
- },
2746
- completionItemInfo: {
2747
- color: "#333"
2748
- },
2749
- completionItemDetail: {
2750
- color: "#666"
2751
- }
2752
- },
2753
- styles: [
2754
- // JSON
2755
- {
2756
- tag: t.comment,
2757
- color: colors.comment
2758
- },
2759
- {
2760
- tag: [t.propertyName],
2761
- color: colors.key
2762
- },
2763
- {
2764
- tag: [t.string],
2765
- color: colors.string
2766
- },
2767
- {
2768
- tag: [t.number],
2769
- color: colors.number
2770
- },
2771
- {
2772
- tag: [t.bool],
2773
- color: colors.boolean
2774
- },
2775
- {
2776
- tag: [t.null],
2777
- color: colors.null
2778
- },
2779
- {
2780
- tag: [t.separator],
2781
- color: colors.separator
2782
- },
2783
- // markdown
2784
- {
2785
- tag: [t.heading],
2786
- color: "#3e76ef"
2787
- },
2788
- {
2789
- tag: [t.processingInstruction],
2790
- color: "#3e76ef"
2791
- },
2792
- // shell
2793
- // curl
2794
- {
2795
- tag: [t.standard(t.variableName)],
2796
- color: "#00804A"
2797
- },
2798
- // -X
2799
- {
2800
- tag: [t.attributeName],
2801
- color: "#C74200"
2802
- },
2803
- // url in string (includes quotes), e.g. "https://..."
2804
- {
2805
- tag: [t.special(t.string)],
2806
- color: "#2B57D9"
2807
- }
2808
- ]
2809
- });
2810
-
2811
- // src/components/code-editor/theme/dark.ts
2812
- import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
2813
- var colors2 = {
2814
- background: "#151B27",
2815
- // syntax
2816
- comment: "#FFFFFF63",
2817
- key: "#39E5D7",
2818
- string: "#FF94D2",
2819
- number: "#FF9933",
2820
- boolean: "#78B0FF",
2821
- null: "#78B0FF",
2822
- separator: "#FFFFFFC9"
2823
- };
2824
- var darkTheme = createTheme2({
2825
- variant: "dark",
2826
- settings: {
2827
- background: colors2.background,
2828
- foreground: "#fff",
2829
- caret: "#AEAFAD",
2830
- selection: "#d9d9d942",
2831
- gutterBackground: colors2.background,
2832
- gutterForeground: "#FFFFFF63",
2833
- gutterBorderColor: "transparent",
2834
- gutterBorderWidth: 0,
2835
- lineHighlight: "#272e3d36",
2836
- bracketColors: ["#FFEF61", "#DD99FF", "#78B0FF"],
2837
- tooltip: {
2838
- backgroundColor: "#363D4D",
2839
- color: "#fff",
2840
- border: "none"
2841
- },
2842
- link: {
2843
- color: "#4daafc"
2844
- },
2845
- completionItemHover: {
2846
- backgroundColor: "#FFFFFF0F"
2847
- },
2848
- completionItemSelected: {
2849
- backgroundColor: "#FFFFFF17"
2850
- },
2851
- completionItemIcon: {
2852
- color: "#FFFFFFC9"
2853
- },
2854
- completionItemLabel: {
2855
- color: "#FFFFFFC9"
2856
- },
2857
- completionItemInfo: {
2858
- color: "#FFFFFFC9"
2859
- },
2860
- completionItemDetail: {
2861
- color: "#FFFFFF63"
2862
- }
2863
- },
2864
- styles: [
2865
- // json
2866
- {
2867
- tag: t2.comment,
2868
- color: colors2.comment
2869
- },
2870
- {
2871
- tag: [t2.propertyName],
2872
- color: colors2.key
2873
- },
2874
- {
2875
- tag: [t2.string],
2876
- color: colors2.string
2877
- },
2878
- {
2879
- tag: [t2.number],
2880
- color: colors2.number
2881
- },
2882
- {
2883
- tag: [t2.bool],
2884
- color: colors2.boolean
2885
- },
2886
- {
2887
- tag: [t2.null],
2888
- color: colors2.null
2889
- },
2890
- {
2891
- tag: [t2.separator],
2892
- color: colors2.separator
2893
- },
2894
- // markdown
2895
- {
2896
- tag: [t2.heading],
2897
- color: "#6b6bff"
2898
- },
2899
- {
2900
- tag: [t2.processingInstruction],
2901
- color: "#6b6bff"
2902
- },
2903
- // shell
2904
- // curl
2905
- {
2906
- tag: [t2.standard(t2.variableName)],
2907
- color: "#3BEB84"
2908
- },
2909
- // -X
2910
- {
2911
- tag: [t2.attributeName],
2912
- color: "#FF9933"
2913
- },
2914
- // url in string (includes quotes), e.g. "https://..."
2915
- {
2916
- tag: [t2.special(t2.string)],
2917
- color: "#78B0FF"
2918
- }
2919
- ]
2920
- });
2473
+ }, [injector]);
2474
+ return null;
2475
+ }
2921
2476
 
2922
- // src/components/code-editor/theme/index.ts
2923
- themes.register("dark", darkTheme);
2924
- themes.register("light", lightTheme);
2477
+ // src/components/prompt-editor-with-variables/index.tsx
2478
+ function PromptEditorWithVariables(props) {
2479
+ return /* @__PURE__ */ React26.createElement(PromptEditor, { ...props }, /* @__PURE__ */ React26.createElement(VariableTree, null), /* @__PURE__ */ React26.createElement(VariableTagInject, null));
2480
+ }
2925
2481
 
2926
- // src/components/code-editor/index.tsx
2927
- var OriginCodeEditor = createRenderer(preset2, [
2928
- EditorView4.theme({
2929
- "&.cm-focused": {
2930
- outline: "none"
2931
- }
2932
- })
2933
- ]);
2934
- function CodeEditor({
2935
- value,
2936
- onChange,
2937
- languageId = "python",
2938
- theme = "light",
2939
- children,
2940
- placeholder,
2941
- activeLinePlaceholder,
2942
- options: options2,
2943
- readonly
2482
+ // src/components/prompt-editor-with-inputs/index.tsx
2483
+ import React29 from "react";
2484
+
2485
+ // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2486
+ import React28, { useEffect as useEffect7, useState as useState8 } from "react";
2487
+ import { Popover as Popover4 } from "@douyinfe/semi-ui";
2488
+ import {
2489
+ Mention as Mention2,
2490
+ getCurrentMentionReplaceRange as getCurrentMentionReplaceRange2,
2491
+ useEditor as useEditor2,
2492
+ PositionMirror as PositionMirror2
2493
+ } from "@coze-editor/editor/react";
2494
+
2495
+ // src/components/prompt-editor-with-inputs/inputs-picker.tsx
2496
+ import React27, { useMemo as useMemo10 } from "react";
2497
+ import { last as last2 } from "lodash";
2498
+ import {
2499
+ ASTMatch as ASTMatch2,
2500
+ useScopeAvailable as useScopeAvailable3
2501
+ } from "@flowgram.ai/editor";
2502
+ import { Tree as Tree2 } from "@douyinfe/semi-ui";
2503
+ function InputsPicker({
2504
+ inputsValues,
2505
+ onSelect
2944
2506
  }) {
2945
- const editorRef = useRef4(null);
2946
- useEffect7(() => {
2947
- if (languageId === "typescript") {
2948
- initTsWorker();
2507
+ const available = useScopeAvailable3();
2508
+ const getArrayDrilldown = (type, depth = 1) => {
2509
+ if (ASTMatch2.isArray(type.items)) {
2510
+ return getArrayDrilldown(type.items, depth + 1);
2949
2511
  }
2950
- }, [languageId]);
2512
+ return { type: type.items, depth };
2513
+ };
2514
+ const renderVariable = (variable, keyPath) => {
2515
+ let type = variable?.type;
2516
+ let children;
2517
+ if (ASTMatch2.isObject(type)) {
2518
+ children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
2519
+ }
2520
+ if (ASTMatch2.isArray(type)) {
2521
+ const drilldown = getArrayDrilldown(type);
2522
+ if (ASTMatch2.isObject(drilldown.type)) {
2523
+ children = (drilldown.type.properties || []).map(
2524
+ (_property) => renderVariable(_property, [
2525
+ ...keyPath,
2526
+ ...new Array(drilldown.depth).fill("[0]"),
2527
+ _property.key
2528
+ ])
2529
+ ).filter(Boolean);
2530
+ }
2531
+ }
2532
+ const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
2533
+ return {
2534
+ key,
2535
+ label: last2(keyPath),
2536
+ value: key,
2537
+ children
2538
+ };
2539
+ };
2540
+ const treeData = useMemo10(
2541
+ () => Object.entries(inputsValues).map(([key, value]) => {
2542
+ if (value?.type === "ref") {
2543
+ const variable = available.getByKeyPath(value.content || []);
2544
+ if (variable) {
2545
+ return renderVariable(variable, [key]);
2546
+ }
2547
+ }
2548
+ return {
2549
+ key,
2550
+ value: key,
2551
+ label: key
2552
+ };
2553
+ }),
2554
+ []
2555
+ );
2556
+ return /* @__PURE__ */ React27.createElement(Tree2, { treeData, onSelect: (v) => onSelect(v) });
2557
+ }
2558
+
2559
+ // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2560
+ function InputsTree({ inputsValues }) {
2561
+ const [posKey, setPosKey] = useState8("");
2562
+ const [visible, setVisible] = useState8(false);
2563
+ const [position, setPosition] = useState8(-1);
2564
+ const editor = useEditor2();
2565
+ function insert(variablePath) {
2566
+ const range = getCurrentMentionReplaceRange2(editor.$view.state);
2567
+ if (!range) {
2568
+ return;
2569
+ }
2570
+ editor.replaceText({
2571
+ ...range,
2572
+ text: "{{" + variablePath + "}}"
2573
+ });
2574
+ setVisible(false);
2575
+ }
2576
+ function handleOpenChange(e) {
2577
+ setPosition(e.state.selection.main.head);
2578
+ setVisible(e.value);
2579
+ }
2951
2580
  useEffect7(() => {
2952
- if (editorRef.current?.getValue() !== value) {
2953
- editorRef.current?.setValue(String(value || ""));
2581
+ if (!editor) {
2582
+ return;
2954
2583
  }
2955
- }, [value]);
2956
- return /* @__PURE__ */ React22.createElement(EditorProvider2, null, /* @__PURE__ */ React22.createElement(
2957
- OriginCodeEditor,
2584
+ }, [editor, visible]);
2585
+ return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React28.createElement(
2586
+ Popover4,
2958
2587
  {
2959
- defaultValue: value,
2960
- options: {
2961
- uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
2962
- languageId,
2963
- theme,
2964
- placeholder,
2965
- readOnly: readonly,
2966
- editable: !readonly,
2967
- ...options2 || {}
2968
- },
2969
- didMount: (editor) => {
2970
- editorRef.current = editor;
2971
- },
2972
- onChange: (e) => onChange?.(e.value)
2588
+ visible,
2589
+ trigger: "custom",
2590
+ position: "topLeft",
2591
+ rePosKey: posKey,
2592
+ content: /* @__PURE__ */ React28.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React28.createElement(
2593
+ InputsPicker,
2594
+ {
2595
+ inputsValues,
2596
+ onSelect: (v) => {
2597
+ insert(v);
2598
+ }
2599
+ }
2600
+ ))
2973
2601
  },
2974
- activeLinePlaceholder && /* @__PURE__ */ React22.createElement(ActiveLinePlaceholder2, null, activeLinePlaceholder),
2975
- children
2602
+ /* @__PURE__ */ React28.createElement(
2603
+ PositionMirror2,
2604
+ {
2605
+ position,
2606
+ onChange: () => setPosKey(String(Math.random()))
2607
+ }
2608
+ )
2976
2609
  ));
2977
2610
  }
2978
2611
 
2612
+ // src/components/prompt-editor-with-inputs/index.tsx
2613
+ function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2614
+ return /* @__PURE__ */ React29.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React29.createElement(InputsTree, { inputsValues }));
2615
+ }
2616
+
2979
2617
  // src/components/json-editor-with-variables/index.tsx
2980
- import React25 from "react";
2618
+ import React32 from "react";
2981
2619
  import { transformerCreator } from "@coze-editor/editor/preset-code";
2982
2620
 
2983
2621
  // src/components/json-editor-with-variables/extensions/variable-tree.tsx
2984
- import React23, { useEffect as useEffect8, useState as useState9 } from "react";
2622
+ import React30, { useEffect as useEffect8, useState as useState9 } from "react";
2985
2623
  import { Popover as Popover5, Tree as Tree3 } from "@douyinfe/semi-ui";
2986
2624
  import {
2987
2625
  Mention as Mention3,
@@ -3015,14 +2653,14 @@ function VariableTree2() {
3015
2653
  }
3016
2654
  }, [editor, visible]);
3017
2655
  const treeData = useVariableTree({});
3018
- return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Mention3, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React23.createElement(
2656
+ return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(Mention3, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React30.createElement(
3019
2657
  Popover5,
3020
2658
  {
3021
2659
  visible,
3022
2660
  trigger: "custom",
3023
2661
  position: "topLeft",
3024
2662
  rePosKey: posKey,
3025
- content: /* @__PURE__ */ React23.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React23.createElement(
2663
+ content: /* @__PURE__ */ React30.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React30.createElement(
3026
2664
  Tree3,
3027
2665
  {
3028
2666
  treeData,
@@ -3032,7 +2670,7 @@ function VariableTree2() {
3032
2670
  }
3033
2671
  ))
3034
2672
  },
3035
- /* @__PURE__ */ React23.createElement(
2673
+ /* @__PURE__ */ React30.createElement(
3036
2674
  PositionMirror3,
3037
2675
  {
3038
2676
  position,
@@ -3043,7 +2681,7 @@ function VariableTree2() {
3043
2681
  }
3044
2682
 
3045
2683
  // src/components/json-editor-with-variables/extensions/variable-tag.tsx
3046
- import React24, { useLayoutEffect as useLayoutEffect5 } from "react";
2684
+ import React31, { useLayoutEffect as useLayoutEffect5 } from "react";
3047
2685
  import { createRoot } from "react-dom/client";
3048
2686
  import { isEqual as isEqual2, last as last3 } from "lodash";
3049
2687
  import {
@@ -3063,9 +2701,9 @@ import {
3063
2701
  } from "@codemirror/view";
3064
2702
 
3065
2703
  // src/components/json-editor-with-variables/styles.tsx
3066
- import styled8 from "styled-components";
2704
+ import styled9 from "styled-components";
3067
2705
  import { Tag as Tag3 } from "@douyinfe/semi-ui";
3068
- var UIRootTitle3 = styled8.div`
2706
+ var UIRootTitle3 = styled9.div`
3069
2707
  margin-right: 4px;
3070
2708
  min-width: 20px;
3071
2709
  overflow: hidden;
@@ -3073,12 +2711,12 @@ var UIRootTitle3 = styled8.div`
3073
2711
  white-space: nowrap;
3074
2712
  color: var(--semi-color-text-2);
3075
2713
  `;
3076
- var UIVarName3 = styled8.div`
2714
+ var UIVarName3 = styled9.div`
3077
2715
  overflow: hidden;
3078
2716
  text-overflow: ellipsis;
3079
2717
  white-space: nowrap;
3080
2718
  `;
3081
- var UITag3 = styled8(Tag3)`
2719
+ var UITag3 = styled9(Tag3)`
3082
2720
  display: inline-flex;
3083
2721
  align-items: center;
3084
2722
  justify-content: flex-start;
@@ -3092,7 +2730,7 @@ var UITag3 = styled8(Tag3)`
3092
2730
  margin: 0 5px;
3093
2731
  }
3094
2732
  `;
3095
- var UIPopoverContent3 = styled8.div`
2733
+ var UIPopoverContent3 = styled9.div`
3096
2734
  padding: 10px;
3097
2735
  display: inline-flex;
3098
2736
  align-items: center;
@@ -3106,7 +2744,7 @@ var VariableTagWidget2 = class extends WidgetType2 {
3106
2744
  this.toDispose = new DisposableCollection2();
3107
2745
  this.renderIcon = (icon) => {
3108
2746
  if (typeof icon === "string") {
3109
- return /* @__PURE__ */ React24.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2747
+ return /* @__PURE__ */ React31.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
3110
2748
  }
3111
2749
  return icon;
3112
2750
  };
@@ -3116,20 +2754,20 @@ var VariableTagWidget2 = class extends WidgetType2 {
3116
2754
  renderVariable(v) {
3117
2755
  if (!v) {
3118
2756
  this.root.render(
3119
- /* @__PURE__ */ React24.createElement(UITag3, { prefixIcon: /* @__PURE__ */ React24.createElement(IconIssueStroked3, null), color: "amber" }, "Unknown")
2757
+ /* @__PURE__ */ React31.createElement(UITag3, { prefixIcon: /* @__PURE__ */ React31.createElement(IconIssueStroked3, null), color: "amber" }, "Unknown")
3120
2758
  );
3121
2759
  return;
3122
2760
  }
3123
2761
  const rootField = last3(v.parentFields);
3124
- const rootTitle = /* @__PURE__ */ React24.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2762
+ const rootTitle = /* @__PURE__ */ React31.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
3125
2763
  const rootIcon = this.renderIcon(rootField?.meta.icon);
3126
2764
  this.root.render(
3127
- /* @__PURE__ */ React24.createElement(
2765
+ /* @__PURE__ */ React31.createElement(
3128
2766
  Popover6,
3129
2767
  {
3130
- content: /* @__PURE__ */ React24.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ React24.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
2768
+ content: /* @__PURE__ */ React31.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ React31.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
3131
2769
  },
3132
- /* @__PURE__ */ React24.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React24.createElement(UIVarName3, null, v?.key))
2770
+ /* @__PURE__ */ React31.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React31.createElement(UIVarName3, null, v?.key))
3133
2771
  )
3134
2772
  );
3135
2773
  }
@@ -3231,7 +2869,7 @@ var transformer = transformerCreator((text) => {
3231
2869
  return text;
3232
2870
  });
3233
2871
  function JsonEditorWithVariables(props) {
3234
- return /* @__PURE__ */ React25.createElement(
2872
+ return /* @__PURE__ */ React32.createElement(
3235
2873
  CodeEditor,
3236
2874
  {
3237
2875
  languageId: "json",
@@ -3242,40 +2880,40 @@ function JsonEditorWithVariables(props) {
3242
2880
  ...props.options || {}
3243
2881
  }
3244
2882
  },
3245
- /* @__PURE__ */ React25.createElement(VariableTree2, null),
3246
- /* @__PURE__ */ React25.createElement(VariableTagInject2, null)
2883
+ /* @__PURE__ */ React32.createElement(VariableTree2, null),
2884
+ /* @__PURE__ */ React32.createElement(VariableTagInject2, null)
3247
2885
  );
3248
2886
  }
3249
2887
 
3250
2888
  // src/components/inputs-values/index.tsx
3251
- import React27 from "react";
2889
+ import React34 from "react";
3252
2890
  import { Button as Button4, IconButton as IconButton5 } from "@douyinfe/semi-ui";
3253
2891
  import { IconDelete as IconDelete2, IconPlus as IconPlus3 } from "@douyinfe/semi-icons";
3254
2892
 
3255
2893
  // src/components/inputs-values/styles.tsx
3256
- import styled9 from "styled-components";
3257
- var UIRows2 = styled9.div`
2894
+ import styled10 from "styled-components";
2895
+ var UIRows2 = styled10.div`
3258
2896
  display: flex;
3259
2897
  flex-direction: column;
3260
2898
  gap: 10px;
3261
2899
  margin-bottom: 10px;
3262
2900
  `;
3263
- var UIRow3 = styled9.div`
2901
+ var UIRow3 = styled10.div`
3264
2902
  display: flex;
3265
2903
  align-items: center;
3266
2904
  gap: 5px;
3267
2905
  `;
3268
2906
 
3269
2907
  // src/components/inputs-values/components/blur-input.tsx
3270
- import React26, { useEffect as useEffect9, useState as useState10 } from "react";
3271
- import Input5 from "@douyinfe/semi-ui/lib/es/input";
2908
+ import React33, { useEffect as useEffect9, useState as useState10 } from "react";
2909
+ import Input6 from "@douyinfe/semi-ui/lib/es/input";
3272
2910
  function BlurInput2(props) {
3273
2911
  const [value, setValue] = useState10("");
3274
2912
  useEffect9(() => {
3275
2913
  setValue(props.value);
3276
2914
  }, [props.value]);
3277
- return /* @__PURE__ */ React26.createElement(
3278
- Input5,
2915
+ return /* @__PURE__ */ React33.createElement(
2916
+ Input6,
3279
2917
  {
3280
2918
  ...props,
3281
2919
  value,
@@ -3302,7 +2940,7 @@ function InputsValues({
3302
2940
  onChange,
3303
2941
  sortIndexKey: "extra.index"
3304
2942
  });
3305
- return /* @__PURE__ */ React27.createElement("div", null, /* @__PURE__ */ React27.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React27.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React27.createElement(
2943
+ return /* @__PURE__ */ React34.createElement("div", null, /* @__PURE__ */ React34.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React34.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React34.createElement(
3306
2944
  BlurInput2,
3307
2945
  {
3308
2946
  style: { width: 100, minWidth: 100, maxWidth: 100 },
@@ -3312,7 +2950,7 @@ function InputsValues({
3312
2950
  onChange: (v) => updateKey(item.id, v),
3313
2951
  placeholder: "Input Key"
3314
2952
  }
3315
- ), /* @__PURE__ */ React27.createElement(
2953
+ ), /* @__PURE__ */ React34.createElement(
3316
2954
  DynamicValueInput,
3317
2955
  {
3318
2956
  style: { flexGrow: 1 },
@@ -3326,46 +2964,290 @@ function InputsValues({
3326
2964
  strategies: [...constantProps?.strategies || []]
3327
2965
  }
3328
2966
  }
3329
- ), /* @__PURE__ */ React27.createElement(
2967
+ ), /* @__PURE__ */ React34.createElement(
3330
2968
  IconButton5,
3331
2969
  {
3332
2970
  disabled: readonly,
3333
2971
  theme: "borderless",
3334
- icon: /* @__PURE__ */ React27.createElement(IconDelete2, { size: "small" }),
2972
+ icon: /* @__PURE__ */ React34.createElement(IconDelete2, { size: "small" }),
3335
2973
  size: "small",
3336
2974
  onClick: () => remove(item.id)
3337
2975
  }
3338
- )))), /* @__PURE__ */ React27.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React27.createElement(IconPlus3, null), size: "small", onClick: add }, "Add"));
2976
+ )))), /* @__PURE__ */ React34.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React34.createElement(IconPlus3, null), size: "small", onClick: add }, "Add"));
2977
+ }
2978
+
2979
+ // src/components/display-schema-tree/index.tsx
2980
+ import React35 from "react";
2981
+
2982
+ // src/components/display-schema-tree/styles.tsx
2983
+ import styled11, { css as css4 } from "styled-components";
2984
+ var TreeRow = styled11.div`
2985
+ display: flex;
2986
+ align-items: center;
2987
+
2988
+ .tree-icon {
2989
+ margin-right: 8px;
2990
+ width: 14px;
2991
+ height: 14px;
2992
+ }
2993
+
2994
+ height: 27px;
2995
+ white-space: nowrap;
2996
+ `;
2997
+ var HorizontalLine = styled11.div`
2998
+ position: relative;
2999
+
3000
+ &::before,
3001
+ &::after {
3002
+ content: '';
3003
+ position: absolute;
3004
+ background-color: var(--semi-color-text-3);
3005
+ }
3006
+
3007
+ &::after {
3008
+ top: 0px;
3009
+ right: 6px;
3010
+ width: 15px;
3011
+ height: 1px;
3012
+ }
3013
+ `;
3014
+ var TreeTitle = styled11.div`
3015
+ // overflow: hidden;
3016
+ // text-overflow: ellipsis;
3017
+ `;
3018
+ var TreeLevel = styled11.div`
3019
+ padding-left: 30px;
3020
+ position: relative;
3021
+
3022
+ /* &::before {
3023
+ content: '';
3024
+ position: absolute;
3025
+ background-color: var(--semi-color-text-3);
3026
+ top: 0px;
3027
+ bottom: 0px;
3028
+ left: -22px;
3029
+ width: 1px;
3030
+ } */
3031
+ `;
3032
+ var TreeItem = styled11.div`
3033
+ position: relative;
3034
+
3035
+ &::before {
3036
+ content: '';
3037
+ position: absolute;
3038
+ background-color: var(--semi-color-text-3);
3039
+ }
3040
+
3041
+ &:not(:last-child)::before {
3042
+ width: 1px;
3043
+ top: 0;
3044
+ bottom: 0;
3045
+ left: -22px;
3046
+ }
3047
+
3048
+ &:last-child::before {
3049
+ width: 1px;
3050
+ top: 0;
3051
+ height: 14px;
3052
+ left: -22px;
3053
+ }
3054
+
3055
+ ${(props) => props.depth === 0 && css4`
3056
+ &::before {
3057
+ width: 0px !important;
3058
+ }
3059
+ `}
3060
+ `;
3061
+
3062
+ // src/components/display-schema-tree/index.tsx
3063
+ function DisplaySchemaTree(props) {
3064
+ return /* @__PURE__ */ React35.createElement(SchemaTree, { ...props });
3065
+ }
3066
+ function SchemaTree(props) {
3067
+ const {
3068
+ value: schema = {},
3069
+ drilldown = true,
3070
+ depth = 0,
3071
+ showIcon = true,
3072
+ parentKey = ""
3073
+ } = props || {};
3074
+ const typeManager = useTypeManager();
3075
+ const config = typeManager.getTypeBySchema(schema);
3076
+ const title = typeManager.getComplexText(schema);
3077
+ const icon = typeManager?.getDisplayIcon(schema);
3078
+ let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
3079
+ const childEntries = Object.entries(properties || {});
3080
+ return /* @__PURE__ */ React35.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ React35.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ React35.createElement(HorizontalLine, null), showIcon && icon && React35.cloneElement(icon, {
3081
+ className: "tree-icon"
3082
+ }), /* @__PURE__ */ React35.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ React35.createElement(React35.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ React35.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ React35.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
3083
+ }
3084
+
3085
+ // src/components/display-outputs/index.tsx
3086
+ import React37, { useEffect as useEffect10 } from "react";
3087
+ import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
3088
+ import { useCurrentScope as useCurrentScope3, useRefresh } from "@flowgram.ai/editor";
3089
+
3090
+ // src/components/display-schema-tag/index.tsx
3091
+ import React36 from "react";
3092
+ import { Popover as Popover7 } from "@douyinfe/semi-ui";
3093
+
3094
+ // src/components/display-schema-tag/styles.ts
3095
+ import styled12 from "styled-components";
3096
+ import { Tag as Tag4 } from "@douyinfe/semi-ui";
3097
+ var PopoverContent = styled12.div`
3098
+ padding: 10px;
3099
+ `;
3100
+ var StyledTag = styled12(Tag4)`
3101
+ padding: 4px;
3102
+
3103
+ .tag-icon {
3104
+ width: 12px;
3105
+ height: 12px;
3106
+ }
3107
+ `;
3108
+ var TitleSpan = styled12.span`
3109
+ display: inline-block;
3110
+ margin-left: 4px;
3111
+ margin-top: -1px;
3112
+ overflow: hidden;
3113
+ text-overflow: ellipsis;
3114
+ `;
3115
+
3116
+ // src/components/display-schema-tag/index.tsx
3117
+ function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
3118
+ const typeManager = useTypeManager();
3119
+ const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
3120
+ return /* @__PURE__ */ React36.createElement(
3121
+ Popover7,
3122
+ {
3123
+ content: /* @__PURE__ */ React36.createElement(PopoverContent, null, /* @__PURE__ */ React36.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
3124
+ },
3125
+ /* @__PURE__ */ React36.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React36.cloneElement(icon, {
3126
+ className: "tag-icon"
3127
+ }), title && /* @__PURE__ */ React36.createElement(TitleSpan, null, title))
3128
+ );
3129
+ }
3130
+
3131
+ // src/components/display-outputs/styles.ts
3132
+ import styled13 from "styled-components";
3133
+ var DisplayOutputsWrapper = styled13.div`
3134
+ display: flex;
3135
+ gap: 5px;
3136
+ flex-wrap: wrap;
3137
+ `;
3138
+
3139
+ // src/components/display-outputs/index.tsx
3140
+ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3141
+ const scope = useCurrentScope3();
3142
+ const refresh = useRefresh();
3143
+ useEffect10(() => {
3144
+ if (!displayFromScope) {
3145
+ return () => null;
3146
+ }
3147
+ const disposable = scope.output.onListOrAnyVarChange(() => {
3148
+ refresh();
3149
+ });
3150
+ return () => {
3151
+ disposable.dispose();
3152
+ };
3153
+ }, [displayFromScope]);
3154
+ const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
3155
+ acm = {
3156
+ ...acm,
3157
+ ...JsonSchemaUtils5.astToSchema(curr.type)?.properties || {}
3158
+ };
3159
+ return acm;
3160
+ }, {}) : value?.properties || {};
3161
+ const childEntries = Object.entries(properties || {});
3162
+ return /* @__PURE__ */ React37.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React37.createElement(DisplaySchemaTag, { key, title: key, value: schema, showIconInTree })));
3163
+ }
3164
+
3165
+ // src/components/display-flow-value/index.tsx
3166
+ import React38, { useMemo as useMemo11 } from "react";
3167
+ import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
3168
+ import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
3169
+ function DisplayFlowValue({ value, title, showIconInTree }) {
3170
+ const available = useScopeAvailable4();
3171
+ const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
3172
+ const schema = useMemo11(() => {
3173
+ if (value?.type === "ref") {
3174
+ return JsonSchemaUtils6.astToSchema(variable?.type);
3175
+ }
3176
+ if (value?.type === "template") {
3177
+ return { type: "string" };
3178
+ }
3179
+ if (value?.type === "constant") {
3180
+ if (value?.schema) {
3181
+ return value?.schema;
3182
+ }
3183
+ if (typeof value?.content === "string") {
3184
+ return { type: "string" };
3185
+ }
3186
+ if (typeof value?.content === "number") {
3187
+ return { type: "number" };
3188
+ }
3189
+ if (typeof value?.content === "boolean") {
3190
+ return { type: "boolean" };
3191
+ }
3192
+ }
3193
+ return { type: "unknown" };
3194
+ }, [value, variable?.hash]);
3195
+ return /* @__PURE__ */ React38.createElement(
3196
+ DisplaySchemaTag,
3197
+ {
3198
+ title,
3199
+ value: schema,
3200
+ showIconInTree,
3201
+ warning: value?.type === "ref" && !variable
3202
+ }
3203
+ );
3204
+ }
3205
+
3206
+ // src/components/display-inputs-values/index.tsx
3207
+ import React39 from "react";
3208
+
3209
+ // src/components/display-inputs-values/styles.ts
3210
+ import styled14 from "styled-components";
3211
+ var DisplayInputsWrapper = styled14.div`
3212
+ display: flex;
3213
+ gap: 5px;
3214
+ flex-wrap: wrap;
3215
+ `;
3216
+
3217
+ // src/components/display-inputs-values/index.tsx
3218
+ function DisplayInputsValues({ value, showIconInTree }) {
3219
+ const childEntries = Object.entries(value || {});
3220
+ return /* @__PURE__ */ React39.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => /* @__PURE__ */ React39.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree })));
3339
3221
  }
3340
3222
 
3341
3223
  // src/effects/provide-batch-input/index.ts
3342
3224
  import {
3343
- ASTFactory as ASTFactory2,
3225
+ ASTFactory,
3344
3226
  createEffectFromVariableProvider,
3345
3227
  getNodeForm
3346
3228
  } from "@flowgram.ai/editor";
3347
3229
  var provideBatchInputEffect = createEffectFromVariableProvider({
3348
3230
  private: true,
3349
3231
  parse: (value, ctx) => [
3350
- ASTFactory2.createVariableDeclaration({
3232
+ ASTFactory.createVariableDeclaration({
3351
3233
  key: `${ctx.node.id}_locals`,
3352
3234
  meta: {
3353
3235
  title: getNodeForm(ctx.node)?.getValueIn("title"),
3354
3236
  icon: ctx.node.getNodeRegistry().info?.icon
3355
3237
  },
3356
- type: ASTFactory2.createObject({
3238
+ type: ASTFactory.createObject({
3357
3239
  properties: [
3358
- ASTFactory2.createProperty({
3240
+ ASTFactory.createProperty({
3359
3241
  key: "item",
3360
- initializer: ASTFactory2.createEnumerateExpression({
3361
- enumerateFor: ASTFactory2.createKeyPathExpression({
3242
+ initializer: ASTFactory.createEnumerateExpression({
3243
+ enumerateFor: ASTFactory.createKeyPathExpression({
3362
3244
  keyPath: value.content || []
3363
3245
  })
3364
3246
  })
3365
3247
  }),
3366
- ASTFactory2.createProperty({
3248
+ ASTFactory.createProperty({
3367
3249
  key: "index",
3368
- type: ASTFactory2.createNumber()
3250
+ type: ASTFactory.createNumber()
3369
3251
  })
3370
3252
  ]
3371
3253
  })
@@ -3468,20 +3350,21 @@ function traverseRef(name, value, cb) {
3468
3350
  }
3469
3351
 
3470
3352
  // src/effects/provide-json-schema-outputs/index.ts
3353
+ import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
3471
3354
  import {
3472
- ASTFactory as ASTFactory3,
3355
+ ASTFactory as ASTFactory2,
3473
3356
  createEffectFromVariableProvider as createEffectFromVariableProvider2,
3474
3357
  getNodeForm as getNodeForm2
3475
3358
  } from "@flowgram.ai/editor";
3476
3359
  var provideJsonSchemaOutputs = createEffectFromVariableProvider2({
3477
3360
  parse: (value, ctx) => [
3478
- ASTFactory3.createVariableDeclaration({
3361
+ ASTFactory2.createVariableDeclaration({
3479
3362
  key: `${ctx.node.id}`,
3480
3363
  meta: {
3481
3364
  title: getNodeForm2(ctx.node)?.getValueIn("title") || ctx.node.id,
3482
3365
  icon: ctx.node.getNodeRegistry().info?.icon
3483
3366
  },
3484
- type: JsonSchemaUtils.schemaToAST(value)
3367
+ type: JsonSchemaUtils7.schemaToAST(value)
3485
3368
  })
3486
3369
  ]
3487
3370
  });
@@ -3498,6 +3381,7 @@ var syncVariableTitle = [
3498
3381
  context.node.getData(FlowNodeVariableData).allScopes.forEach((_scope) => {
3499
3382
  _scope.output.variables.forEach((_var) => {
3500
3383
  _var.updateMeta({
3384
+ ..._var.meta || {},
3501
3385
  title: value || context.node.id,
3502
3386
  icon: context.node.getNodeRegistry().info?.icon
3503
3387
  });
@@ -3509,7 +3393,7 @@ var syncVariableTitle = [
3509
3393
 
3510
3394
  // src/form-plugins/batch-outputs-plugin/index.ts
3511
3395
  import {
3512
- ASTFactory as ASTFactory4,
3396
+ ASTFactory as ASTFactory3,
3513
3397
  createEffectFromVariableProvider as createEffectFromVariableProvider3,
3514
3398
  defineFormPluginCreator,
3515
3399
  getNodeForm as getNodeForm3,
@@ -3520,18 +3404,18 @@ import {
3520
3404
  } from "@flowgram.ai/editor";
3521
3405
  var provideBatchOutputsEffect = createEffectFromVariableProvider3({
3522
3406
  parse: (value, ctx) => [
3523
- ASTFactory4.createVariableDeclaration({
3407
+ ASTFactory3.createVariableDeclaration({
3524
3408
  key: `${ctx.node.id}`,
3525
3409
  meta: {
3526
3410
  title: getNodeForm3(ctx.node)?.getValueIn("title"),
3527
3411
  icon: ctx.node.getNodeRegistry().info?.icon
3528
3412
  },
3529
- type: ASTFactory4.createObject({
3413
+ type: ASTFactory3.createObject({
3530
3414
  properties: Object.entries(value).map(
3531
- ([_key, value2]) => ASTFactory4.createProperty({
3415
+ ([_key, value2]) => ASTFactory3.createProperty({
3532
3416
  key: _key,
3533
- initializer: ASTFactory4.createWrapArrayExpression({
3534
- wrapFor: ASTFactory4.createKeyPathExpression({
3417
+ initializer: ASTFactory3.createWrapArrayExpression({
3418
+ wrapFor: ASTFactory3.createKeyPathExpression({
3535
3419
  keyPath: value2?.content || []
3536
3420
  })
3537
3421
  })
@@ -3583,7 +3467,8 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
3583
3467
  });
3584
3468
 
3585
3469
  // src/form-plugins/infer-inputs-plugin/index.ts
3586
- import { get as get3, set as set2 } from "lodash";
3470
+ import { get as get2, set as set2 } from "lodash";
3471
+ import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
3587
3472
  import {
3588
3473
  defineFormPluginCreator as defineFormPluginCreator2,
3589
3474
  getNodePrivateScope as getNodePrivateScope2,
@@ -3599,7 +3484,7 @@ var createInferInputsPlugin = defineFormPluginCreator2({
3599
3484
  formData,
3600
3485
  targetKey,
3601
3486
  infer(
3602
- get3(formData, sourceKey),
3487
+ get2(formData, sourceKey),
3603
3488
  scope === "private" ? getNodePrivateScope2(ctx.node) : getNodeScope2(ctx.node)
3604
3489
  )
3605
3490
  );
@@ -3640,7 +3525,7 @@ var infer = (values, scope) => {
3640
3525
  }
3641
3526
  if (isRef2(values)) {
3642
3527
  const variable = scope.available.getByKeyPath(values?.content);
3643
- const schema = variable?.type ? JsonSchemaUtils.astToSchema(variable?.type) : void 0;
3528
+ const schema = variable?.type ? JsonSchemaUtils8.astToSchema(variable?.type) : void 0;
3644
3529
  return schema;
3645
3530
  }
3646
3531
  if (isTemplate2(values)) {
@@ -3661,31 +3546,36 @@ var infer = (values, scope) => {
3661
3546
  }
3662
3547
  };
3663
3548
  export {
3664
- ArrayIcons,
3665
3549
  BatchOutputs,
3666
3550
  BatchVariableSelector,
3667
3551
  CodeEditor,
3552
+ CodeEditorMini,
3668
3553
  ConditionRow,
3669
3554
  ConstantInput,
3555
+ DisplayFlowValue,
3556
+ DisplayInputsValues,
3557
+ DisplayOutputs,
3558
+ DisplaySchemaTag,
3559
+ DisplaySchemaTree,
3670
3560
  DynamicValueInput,
3671
3561
  InputsValues,
3672
3562
  JsonEditorWithVariables,
3673
3563
  JsonSchemaEditor,
3564
+ JsonSchemaTypePresetProvider,
3674
3565
  JsonSchemaUtils,
3675
3566
  PromptEditor,
3676
3567
  PromptEditorWithInputs,
3677
3568
  PromptEditorWithVariables,
3678
3569
  TypeSelector,
3679
3570
  VariableSelector,
3680
- VariableTypeIcons,
3681
3571
  autoRenameRefEffect,
3682
3572
  createBatchOutputsFormPlugin,
3683
3573
  createInferInputsPlugin,
3574
+ createTypePresetPlugin,
3684
3575
  formatLegacyRefOnInit,
3685
3576
  formatLegacyRefOnSubmit,
3686
3577
  formatLegacyRefToNewRef,
3687
3578
  formatNewRefToLegacyRef,
3688
- getSchemaIcon,
3689
3579
  getTypeSelectValue,
3690
3580
  isLegacyFlowRefValueSchema,
3691
3581
  isNewFlowRefValueSchema,
@@ -3694,6 +3584,7 @@ export {
3694
3584
  provideBatchOutputsEffect,
3695
3585
  provideJsonSchemaOutputs,
3696
3586
  syncVariableTitle,
3587
+ useTypeManager,
3697
3588
  useVariableTree
3698
3589
  };
3699
3590
  //# sourceMappingURL=index.js.map