@flowgram.ai/form-materials 0.4.5 → 0.4.7

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 (57) hide show
  1. package/dist/esm/chunk-727SU246.js +13 -0
  2. package/dist/esm/chunk-727SU246.js.map +1 -0
  3. package/dist/esm/chunk-DEZUEMUM.js +284 -0
  4. package/dist/esm/chunk-DEZUEMUM.js.map +1 -0
  5. package/dist/esm/chunk-MFDEE4HB.js +440 -0
  6. package/dist/esm/chunk-MFDEE4HB.js.map +1 -0
  7. package/dist/esm/editor-2YHACGQ2.js +282 -0
  8. package/dist/esm/editor-2YHACGQ2.js.map +1 -0
  9. package/dist/esm/editor-6UMULJYB.js +180 -0
  10. package/dist/esm/editor-6UMULJYB.js.map +1 -0
  11. package/dist/esm/editor-E2BQTPCD.js +388 -0
  12. package/dist/esm/editor-E2BQTPCD.js.map +1 -0
  13. package/dist/esm/editor-G63XGWH2.js +249 -0
  14. package/dist/esm/editor-G63XGWH2.js.map +1 -0
  15. package/dist/esm/editor-OXPGKPF5.js +167 -0
  16. package/dist/esm/editor-OXPGKPF5.js.map +1 -0
  17. package/dist/esm/index.js +607 -2300
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/index.d.mts +141 -51
  20. package/dist/index.d.ts +141 -51
  21. package/dist/index.js +3545 -2825
  22. package/dist/index.js.map +1 -1
  23. package/package.json +8 -8
  24. package/src/components/code-editor/editor.tsx +96 -0
  25. package/src/components/code-editor/index.tsx +5 -89
  26. package/src/components/code-editor-mini/index.tsx +2 -2
  27. package/src/components/condition-row/index.tsx +4 -0
  28. package/src/components/db-condition-row/hooks/use-left.tsx +66 -0
  29. package/src/components/db-condition-row/hooks/use-op.tsx +59 -0
  30. package/src/components/db-condition-row/index.tsx +93 -0
  31. package/src/components/db-condition-row/styles.tsx +43 -0
  32. package/src/components/db-condition-row/types.ts +34 -0
  33. package/src/components/display-inputs-values/index.tsx +1 -1
  34. package/src/components/dynamic-value-input/hooks.ts +1 -1
  35. package/src/components/index.ts +1 -0
  36. package/src/components/inputs-values-tree/hooks/use-child-list.tsx +1 -1
  37. package/src/components/json-editor-with-variables/editor.tsx +69 -0
  38. package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +1 -1
  39. package/src/components/json-editor-with-variables/index.tsx +5 -60
  40. package/src/components/json-schema-editor/hooks.tsx +1 -1
  41. package/src/components/prompt-editor/editor.tsx +81 -0
  42. package/src/components/prompt-editor/index.tsx +5 -69
  43. package/src/components/prompt-editor-with-inputs/editor.tsx +25 -0
  44. package/src/components/prompt-editor-with-inputs/index.tsx +5 -15
  45. package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +1 -1
  46. package/src/components/prompt-editor-with-variables/editor.tsx +22 -0
  47. package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +1 -1
  48. package/src/components/prompt-editor-with-variables/index.tsx +5 -13
  49. package/src/effects/validate-when-variable-sync/index.ts +1 -1
  50. package/src/form-plugins/infer-assign-plugin/index.ts +1 -1
  51. package/src/form-plugins/infer-inputs-plugin/index.ts +1 -1
  52. package/src/hooks/use-object-list/index.tsx +1 -1
  53. package/src/shared/flow-value/utils.ts +1 -1
  54. package/src/shared/format-legacy-refs/index.ts +1 -1
  55. package/src/shared/index.ts +1 -0
  56. package/src/shared/lazy-suspense/index.tsx +28 -0
  57. package/src/validate/validate-flow-value/index.tsx +1 -1
package/dist/esm/index.js CHANGED
@@ -1,1072 +1,36 @@
1
- // src/components/variable-selector/index.tsx
2
- import React12, { useMemo } from "react";
3
- import { I18n as I18n7 } from "@flowgram.ai/editor";
4
- import { Popover } from "@douyinfe/semi-ui";
5
- import { IconChevronDownStroked, IconIssueStroked } from "@douyinfe/semi-icons";
6
-
7
- // src/shared/format-legacy-refs/index.ts
8
- import { isObject } from "lodash";
9
- function formatLegacyRefOnSubmit(value) {
10
- if (isObject(value)) {
11
- if (isLegacyFlowRefValueSchema(value)) {
12
- return formatLegacyRefToNewRef(value);
13
- }
14
- return Object.fromEntries(
15
- Object.entries(value).map(([key, value2]) => [
16
- key,
17
- formatLegacyRefOnSubmit(value2)
18
- ])
19
- );
20
- }
21
- if (Array.isArray(value)) {
22
- return value.map(formatLegacyRefOnSubmit);
23
- }
24
- return value;
25
- }
26
- function formatLegacyRefOnInit(value) {
27
- if (isObject(value)) {
28
- if (isNewFlowRefValueSchema(value)) {
29
- return formatNewRefToLegacyRef(value);
30
- }
31
- return Object.fromEntries(
32
- Object.entries(value).map(([key, value2]) => [
33
- key,
34
- formatLegacyRefOnInit(value2)
35
- ])
36
- );
37
- }
38
- if (Array.isArray(value)) {
39
- return value.map(formatLegacyRefOnInit);
40
- }
41
- return value;
42
- }
43
- function isLegacyFlowRefValueSchema(value) {
44
- return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
45
- }
46
- function isNewFlowRefValueSchema(value) {
47
- return isObject(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
48
- }
49
- function formatLegacyRefToNewRef(value) {
50
- const keyPath = value.content.split(".");
51
- if (keyPath[1] === "outputs") {
52
- return {
53
- type: "ref",
54
- content: [`${keyPath[0]}.${keyPath[1]}`, ...keyPath.length > 2 ? keyPath.slice(2) : []]
55
- };
56
- }
57
- return {
58
- type: "ref",
59
- content: keyPath
60
- };
61
- }
62
- function formatNewRefToLegacyRef(value) {
63
- return {
64
- type: "ref",
65
- content: value.content.join(".")
66
- };
67
- }
68
-
69
- // src/shared/inject-material/index.tsx
70
- import React from "react";
71
1
  import {
72
- FlowRendererComponentType,
73
- FlowRendererRegistry,
74
- usePlaygroundContainer
75
- } from "@flowgram.ai/editor";
76
- function createInjectMaterial(Component, params) {
77
- const InjectComponent = (props) => {
78
- const container = usePlaygroundContainer();
79
- if (!container?.isBound(FlowRendererRegistry)) {
80
- return React.createElement(Component, { ...props });
81
- }
82
- const rendererRegistry = container.get(FlowRendererRegistry);
83
- const renderKey = params?.renderKey || Component.renderKey || Component.name || "";
84
- const renderer = rendererRegistry.tryToGetRendererComponent(renderKey);
85
- if (renderer?.type !== FlowRendererComponentType.REACT) {
86
- return React.createElement(Component, { ...props });
87
- }
88
- return React.createElement(renderer.renderer, {
89
- ...props
90
- });
91
- };
92
- return InjectComponent;
93
- }
94
-
95
- // src/shared/flow-value/utils.ts
96
- import { isArray, isObject as isObject2, isPlainObject, uniq } from "lodash";
97
- import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
98
-
99
- // src/shared/flow-value/schema.ts
100
- import z from "zod";
101
- var extraSchema = z.object({
102
- index: z.number().optional()
103
- }).optional();
104
- var constantSchema = z.object({
105
- type: z.literal("constant"),
106
- content: z.any().optional(),
107
- schema: z.any().optional(),
108
- extra: extraSchema
109
- });
110
- var refSchema = z.object({
111
- type: z.literal("ref"),
112
- content: z.array(z.string()).optional(),
113
- extra: extraSchema
114
- });
115
- var expressionSchema = z.object({
116
- type: z.literal("expression"),
117
- content: z.string().optional(),
118
- extra: extraSchema
119
- });
120
- var templateSchema = z.object({
121
- type: z.literal("template"),
122
- content: z.string().optional(),
123
- extra: extraSchema
124
- });
125
-
126
- // src/shared/flow-value/utils.ts
127
- var FlowValueUtils;
128
- ((FlowValueUtils2) => {
129
- function isConstant(value) {
130
- return constantSchema.safeParse(value).success;
131
- }
132
- FlowValueUtils2.isConstant = isConstant;
133
- function isRef(value) {
134
- return refSchema.safeParse(value).success;
135
- }
136
- FlowValueUtils2.isRef = isRef;
137
- function isExpression(value) {
138
- return expressionSchema.safeParse(value).success;
139
- }
140
- FlowValueUtils2.isExpression = isExpression;
141
- function isTemplate(value) {
142
- return templateSchema.safeParse(value).success;
143
- }
144
- FlowValueUtils2.isTemplate = isTemplate;
145
- function isConstantOrRef(value) {
146
- return isConstant(value) || isRef(value);
147
- }
148
- FlowValueUtils2.isConstantOrRef = isConstantOrRef;
149
- function isFlowValue(value) {
150
- return isConstant(value) || isRef(value) || isExpression(value) || isTemplate(value);
151
- }
152
- FlowValueUtils2.isFlowValue = isFlowValue;
153
- function* traverse(value, options) {
154
- const { includeTypes = ["ref", "template"], path = "" } = options;
155
- if (isPlainObject(value)) {
156
- if (isRef(value) && includeTypes.includes("ref")) {
157
- yield { value, path };
158
- return;
159
- }
160
- if (isTemplate(value) && includeTypes.includes("template")) {
161
- yield { value, path };
162
- return;
163
- }
164
- if (isExpression(value) && includeTypes.includes("expression")) {
165
- yield { value, path };
166
- return;
167
- }
168
- if (isConstant(value) && includeTypes.includes("constant")) {
169
- yield { value, path };
170
- return;
171
- }
172
- for (const [_key, _value] of Object.entries(value)) {
173
- yield* traverse(_value, { ...options, path: `${path}.${_key}` });
174
- }
175
- return;
176
- }
177
- if (isArray(value)) {
178
- for (const [_idx, _value] of value.entries()) {
179
- yield* traverse(_value, { ...options, path: `${path}[${_idx}]` });
180
- }
181
- return;
182
- }
183
- return;
184
- }
185
- FlowValueUtils2.traverse = traverse;
186
- function getTemplateKeyPaths(value) {
187
- const keyPathReg = /\{\{([^\}\{]+)\}\}/g;
188
- return uniq(value.content?.match(keyPathReg) || []).map(
189
- (_keyPath) => _keyPath.slice(2, -2).split(".")
190
- );
191
- }
192
- FlowValueUtils2.getTemplateKeyPaths = getTemplateKeyPaths;
193
- function inferConstantJsonSchema(value) {
194
- if (value?.schema) {
195
- return value.schema;
196
- }
197
- if (typeof value.content === "string") {
198
- return {
199
- type: "string"
200
- };
201
- }
202
- if (typeof value.content === "number") {
203
- return {
204
- type: "number"
205
- };
206
- }
207
- if (typeof value.content === "boolean") {
208
- return {
209
- type: "boolean"
210
- };
211
- }
212
- if (isObject2(value.content)) {
213
- return {
214
- type: "object"
215
- };
216
- }
217
- return void 0;
218
- }
219
- FlowValueUtils2.inferConstantJsonSchema = inferConstantJsonSchema;
220
- function inferJsonSchema(values, scope) {
221
- if (isPlainObject(values)) {
222
- if (isConstant(values)) {
223
- return inferConstantJsonSchema(values);
224
- }
225
- if (isRef(values)) {
226
- const variable = scope.available.getByKeyPath(values?.content);
227
- const schema = variable?.type ? JsonSchemaUtils.astToSchema(variable?.type) : void 0;
228
- return schema;
229
- }
230
- if (isTemplate(values)) {
231
- return { type: "string" };
232
- }
233
- return {
234
- type: "object",
235
- properties: Object.keys(values).reduce((acc, key) => {
236
- const schema = inferJsonSchema(values[key], scope);
237
- if (schema) {
238
- acc[key] = schema;
239
- }
240
- return acc;
241
- }, {})
242
- };
243
- }
244
- }
245
- FlowValueUtils2.inferJsonSchema = inferJsonSchema;
246
- })(FlowValueUtils || (FlowValueUtils = {}));
247
-
248
- // src/shared/polyfill-create-root/index.tsx
249
- import * as ReactDOM from "react-dom";
250
- var unstableCreateRoot = (dom) => ({
251
- render(children) {
252
- ReactDOM.render(children, dom);
253
- },
254
- unmount() {
255
- ReactDOM.unmountComponentAtNode(dom);
256
- }
257
- });
258
- function polyfillCreateRoot(dom) {
259
- return unstableCreateRoot(dom);
260
- }
261
- function unstableSetCreateRoot(createRoot) {
262
- unstableCreateRoot = createRoot;
263
- }
264
-
265
- // src/components/variable-selector/use-variable-tree.tsx
266
- import React11, { useCallback } from "react";
267
- import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
268
- import { ASTMatch as ASTMatch2, useAvailableVariables } from "@flowgram.ai/editor";
269
- import { Icon } from "@douyinfe/semi-ui";
270
-
271
- // src/plugins/json-schema-preset/index.tsx
272
- import React10 from "react";
273
- import {
274
- JsonSchemaUtils as JsonSchemaUtils2,
275
- useTypeManager as useOriginTypeManager,
276
- TypePresetProvider as OriginTypePresetProvider
277
- } from "@flowgram.ai/json-schema";
278
-
279
- // src/plugins/json-schema-preset/type-definition/index.tsx
280
- import { jsonSchemaTypeManager } from "@flowgram.ai/json-schema";
281
-
282
- // src/plugins/json-schema-preset/type-definition/string.tsx
283
- import React2 from "react";
284
- import { I18n } from "@flowgram.ai/editor";
285
- import { Input, TextArea } from "@douyinfe/semi-ui";
286
- var stringRegistry = {
287
- type: "string",
288
- ConstantRenderer: (props) => props?.enableMultiLineStr ? /* @__PURE__ */ React2.createElement(
289
- TextArea,
290
- {
291
- autosize: true,
292
- rows: 1,
293
- placeholder: I18n.t("Please Input String"),
294
- disabled: props.readonly,
295
- ...props
296
- }
297
- ) : /* @__PURE__ */ React2.createElement(
298
- Input,
299
- {
300
- size: "small",
301
- placeholder: I18n.t("Please Input String"),
302
- disabled: props.readonly,
303
- ...props
304
- }
305
- )
306
- };
307
-
308
- // src/plugins/json-schema-preset/type-definition/object.tsx
309
- import React5 from "react";
310
- import { I18n as I18n2 } from "@flowgram.ai/editor";
311
-
312
- // src/components/code-editor-mini/index.tsx
313
- import React4 from "react";
314
- import styled from "styled-components";
315
-
316
- // src/components/code-editor/index.tsx
317
- import React3, { useEffect, useRef } from "react";
318
- import {
319
- ActiveLinePlaceholder,
320
- createRenderer,
321
- EditorProvider
322
- } from "@coze-editor/editor/react";
323
- import preset from "@coze-editor/editor/preset-code";
324
- import { EditorView } from "@codemirror/view";
325
-
326
- // src/components/code-editor/utils.ts
327
- function getSuffixByLanguageId(languageId) {
328
- if (languageId === "python") {
329
- return ".py";
330
- }
331
- if (languageId === "typescript") {
332
- return ".ts";
333
- }
334
- if (languageId === "shell") {
335
- return ".sh";
336
- }
337
- if (languageId === "json") {
338
- return ".json";
339
- }
340
- return "";
341
- }
342
-
343
- // src/components/code-editor/language-features.ts
344
- import { languages } from "@coze-editor/editor/preset-code";
345
- import { typescript } from "@coze-editor/editor/language-typescript";
346
- import { shell } from "@coze-editor/editor/language-shell";
347
- import { python } from "@coze-editor/editor/language-python";
348
- import { json } from "@coze-editor/editor/language-json";
349
- import { mixLanguages } from "@coze-editor/editor";
350
- languages.register("python", python);
351
- languages.register("shell", shell);
352
- languages.register("typescript", typescript);
353
- languages.register("json", {
354
- // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
355
- language: mixLanguages({
356
- outerLanguage: json.language
357
- }),
358
- languageService: json.languageService
359
- });
360
- var tsWorkerInit = false;
361
- var initTsWorker = () => {
362
- if (tsWorkerInit) {
363
- return;
364
- }
365
- tsWorkerInit = true;
366
- const tsWorker = new Worker(
367
- new URL(`@coze-editor/editor/language-typescript/worker`, import.meta.url),
368
- { type: "module" }
369
- );
370
- typescript.languageService.initialize(tsWorker, {
371
- compilerOptions: {
372
- // eliminate Promise error
373
- lib: ["es2015", "dom"],
374
- noImplicitAny: false
375
- }
376
- });
377
- };
378
-
379
- // src/components/code-editor/theme/index.ts
380
- import { themes } from "@coze-editor/editor/preset-code";
381
-
382
- // src/components/code-editor/theme/light.ts
383
- import { createTheme, tags as t } from "@coze-editor/editor/preset-code";
384
- var colors = {
385
- background: "#FFFFFF",
386
- comment: "#6B7280",
387
- key: "#2563EB",
388
- variable: "#DC2626",
389
- string: "#059669",
390
- number: "#EA580C",
391
- boolean: "#7C3AED",
392
- null: "#7C3AED",
393
- separator: "#374151"
394
- };
395
- var lightTheme = createTheme({
396
- variant: "light",
397
- settings: {
398
- background: "#FFFFFF",
399
- foreground: "#1F2937",
400
- caret: "#2563EB",
401
- selection: "#E5E7EB",
402
- gutterBackground: "#F9FAFB",
403
- gutterForeground: "#6B7280",
404
- gutterBorderColor: "transparent",
405
- gutterBorderWidth: 0,
406
- lineHighlight: "#F3F4F680",
407
- bracketColors: ["#F59E0B", "#8B5CF6", "#06B6D4"],
408
- tooltip: {
409
- backgroundColor: "#FFFFFF",
410
- color: "#1F2937",
411
- border: "1px solid #E5E7EB",
412
- boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"
413
- },
414
- link: {
415
- color: "#2563EB"
416
- },
417
- completionItemHover: {
418
- backgroundColor: "#F3F4F6"
419
- },
420
- completionItemSelected: {
421
- backgroundColor: "#E5E7EB"
422
- },
423
- completionItemIcon: {
424
- color: "#4B5563"
425
- },
426
- completionItemLabel: {
427
- color: "#1F2937"
428
- },
429
- completionItemInfo: {
430
- color: "#4B5563"
431
- },
432
- completionItemDetail: {
433
- color: "#6B7280"
434
- }
435
- },
436
- styles: [
437
- // JSON
438
- {
439
- tag: t.comment,
440
- color: colors.comment
441
- },
442
- {
443
- tag: [t.propertyName],
444
- color: colors.key
445
- },
446
- {
447
- tag: [t.variableName],
448
- color: colors.variable
449
- },
450
- {
451
- tag: [t.string],
452
- color: colors.string
453
- },
454
- {
455
- tag: [t.number],
456
- color: colors.number
457
- },
458
- {
459
- tag: [t.bool],
460
- color: colors.boolean
461
- },
462
- {
463
- tag: [t.null],
464
- color: colors.null
465
- },
466
- {
467
- tag: [t.separator],
468
- color: colors.separator
469
- },
470
- // markdown
471
- {
472
- tag: [t.heading],
473
- color: "#2563EB"
474
- },
475
- {
476
- tag: [t.processingInstruction],
477
- color: "#2563EB"
478
- },
479
- // js
480
- {
481
- tag: [t.definitionKeyword],
482
- color: "#9333EA"
483
- },
484
- {
485
- tag: [t.modifier],
486
- color: "#9333EA"
487
- },
488
- {
489
- tag: [t.controlKeyword],
490
- color: "#9333EA"
491
- },
492
- {
493
- tag: [t.operatorKeyword],
494
- color: "#9333EA"
495
- },
496
- // shell
497
- // curl
498
- {
499
- tag: [t.standard(t.variableName)],
500
- color: "#059669"
501
- },
502
- // -X
503
- {
504
- tag: [t.attributeName],
505
- color: "#EA580C"
506
- },
507
- // url in string (includes quotes), e.g. "https://..."
508
- {
509
- tag: [t.special(t.string)],
510
- color: "#2563EB"
511
- }
512
- ]
513
- });
514
-
515
- // src/components/code-editor/theme/dark.ts
516
- import { createTheme as createTheme2, tags as t2 } from "@coze-editor/editor/preset-code";
517
- var colors2 = {
518
- background: "#0D1117",
519
- // syntax - 现代化暗色主题配色
520
- comment: "#8B949E",
521
- key: "#7DD3FC",
522
- variable: "#F472B6",
523
- string: "#34D399",
524
- number: "#FBBF24",
525
- boolean: "#A78BFA",
526
- null: "#A78BFA",
527
- separator: "#E6EDF3"
528
- };
529
- var darkTheme = createTheme2({
530
- variant: "dark",
531
- settings: {
532
- background: colors2.background,
533
- foreground: "#E6EDF3",
534
- caret: "#7DD3FC",
535
- selection: "#264F7833",
536
- gutterBackground: colors2.background,
537
- gutterForeground: "#6E7681",
538
- gutterBorderColor: "transparent",
539
- gutterBorderWidth: 0,
540
- lineHighlight: "#21262D",
541
- bracketColors: ["#FBBF24", "#A78BFA", "#7DD3FC"],
542
- tooltip: {
543
- backgroundColor: "#21262D",
544
- color: "#E6EDF3",
545
- border: "1px solid #30363D"
546
- },
547
- link: {
548
- color: "#58A6FF"
549
- },
550
- completionItemHover: {
551
- backgroundColor: "#21262D"
552
- },
553
- completionItemSelected: {
554
- backgroundColor: "#1F6EEB"
555
- },
556
- completionItemIcon: {
557
- color: "#8B949E"
558
- },
559
- completionItemLabel: {
560
- color: "#E6EDF3"
561
- },
562
- completionItemInfo: {
563
- color: "#8B949E"
564
- },
565
- completionItemDetail: {
566
- color: "#6E7681"
567
- }
568
- },
569
- styles: [
570
- // json
571
- {
572
- tag: t2.comment,
573
- color: colors2.comment
574
- },
575
- {
576
- tag: [t2.propertyName],
577
- color: colors2.key
578
- },
579
- {
580
- tag: [t2.string],
581
- color: colors2.string
582
- },
583
- {
584
- tag: [t2.number],
585
- color: colors2.number
586
- },
587
- {
588
- tag: [t2.bool],
589
- color: colors2.boolean
590
- },
591
- {
592
- tag: [t2.null],
593
- color: colors2.null
594
- },
595
- {
596
- tag: [t2.separator],
597
- color: colors2.separator
598
- },
599
- // js
600
- {
601
- tag: [t2.definitionKeyword],
602
- color: "#C084FC"
603
- },
604
- {
605
- tag: [t2.modifier],
606
- color: "#C084FC"
607
- },
608
- {
609
- tag: [t2.controlKeyword],
610
- color: "#C084FC"
611
- },
612
- {
613
- tag: [t2.operatorKeyword],
614
- color: "#C084FC"
615
- },
616
- // markdown
617
- {
618
- tag: [t2.heading],
619
- color: "#7DD3FC"
620
- },
621
- {
622
- tag: [t2.processingInstruction],
623
- color: "#7DD3FC"
624
- },
625
- // shell
626
- // curl
627
- {
628
- tag: [t2.standard(t2.variableName)],
629
- color: "#34D399"
630
- },
631
- // -X
632
- {
633
- tag: [t2.attributeName],
634
- color: "#FBBF24"
635
- },
636
- // url in string (includes quotes), e.g. "https://..."
637
- {
638
- tag: [t2.special(t2.string)],
639
- color: "#7DD3FC"
640
- }
641
- ]
642
- });
643
-
644
- // src/components/code-editor/theme/index.ts
645
- themes.register("dark", darkTheme);
646
- themes.register("light", lightTheme);
647
-
648
- // src/components/code-editor/index.tsx
649
- var OriginCodeEditor = createRenderer(preset, [
650
- EditorView.theme({
651
- "&.cm-focused": {
652
- outline: "none"
653
- }
654
- })
655
- ]);
656
- function CodeEditor({
657
- value,
658
- onChange,
659
- languageId = "python",
660
- theme = "light",
661
- children,
662
- placeholder,
663
- activeLinePlaceholder,
664
- options,
665
- readonly
666
- }) {
667
- const editorRef = useRef(null);
668
- useEffect(() => {
669
- if (languageId === "typescript") {
670
- initTsWorker();
671
- }
672
- }, [languageId]);
673
- useEffect(() => {
674
- if (editorRef.current?.getValue() !== value) {
675
- editorRef.current?.setValue(String(value || ""));
676
- }
677
- }, [value]);
678
- return /* @__PURE__ */ React3.createElement(EditorProvider, null, /* @__PURE__ */ React3.createElement(
679
- OriginCodeEditor,
680
- {
681
- defaultValue: value,
682
- options: {
683
- uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
684
- languageId,
685
- theme,
686
- placeholder,
687
- readOnly: readonly,
688
- editable: !readonly,
689
- ...options || {}
690
- },
691
- didMount: (editor) => {
692
- editorRef.current = editor;
693
- },
694
- onChange: (e) => onChange?.(e.value)
695
- },
696
- activeLinePlaceholder && /* @__PURE__ */ React3.createElement(ActiveLinePlaceholder, null, activeLinePlaceholder),
697
- children
698
- ));
699
- }
700
-
701
- // src/components/code-editor-mini/index.tsx
702
- var UIMini = styled.div`
703
- .ͼ1 .cm-content {
704
- padding: 0;
705
- }
706
- `;
707
- function CodeEditorMini(props) {
708
- return /* @__PURE__ */ React4.createElement(UIMini, null, /* @__PURE__ */ React4.createElement(
709
- CodeEditor,
710
- {
711
- ...props,
712
- options: {
713
- lineNumbersGutter: false,
714
- foldGutter: false,
715
- ...props.options || {}
716
- }
717
- }
718
- ));
719
- }
720
-
721
- // src/plugins/json-schema-preset/type-definition/object.tsx
722
- var objectRegistry = {
723
- type: "object",
724
- ConstantRenderer: (props) => /* @__PURE__ */ React5.createElement(
725
- CodeEditorMini,
726
- {
727
- value: props.value,
728
- onChange: (v) => props.onChange?.(v),
729
- languageId: "json",
730
- placeholder: I18n2.t("Please Input Object"),
731
- readonly: props.readonly
732
- }
733
- )
734
- };
735
-
736
- // src/plugins/json-schema-preset/type-definition/number.tsx
737
- import React6 from "react";
738
- import { I18n as I18n3 } from "@flowgram.ai/editor";
739
- import { InputNumber } from "@douyinfe/semi-ui";
740
- var numberRegistry = {
741
- type: "number",
742
- ConstantRenderer: (props) => /* @__PURE__ */ React6.createElement(
743
- InputNumber,
744
- {
745
- placeholder: I18n3.t("Please Input Number"),
746
- size: "small",
747
- disabled: props.readonly,
748
- hideButtons: true,
749
- ...props
750
- }
751
- )
752
- };
753
-
754
- // src/plugins/json-schema-preset/type-definition/integer.tsx
755
- import React7 from "react";
756
- import { I18n as I18n4 } from "@flowgram.ai/editor";
757
- import { InputNumber as InputNumber2 } from "@douyinfe/semi-ui";
758
- var integerRegistry = {
759
- type: "integer",
760
- ConstantRenderer: (props) => /* @__PURE__ */ React7.createElement(
761
- InputNumber2,
762
- {
763
- placeholder: I18n4.t("Please Input Integer"),
764
- size: "small",
765
- disabled: props.readonly,
766
- precision: 0,
767
- ...props
768
- }
769
- )
770
- };
771
-
772
- // src/plugins/json-schema-preset/type-definition/boolean.tsx
773
- import React8 from "react";
774
- import { I18n as I18n5 } from "@flowgram.ai/editor";
775
- import { Select } from "@douyinfe/semi-ui";
776
- var booleanRegistry = {
777
- type: "boolean",
778
- ConstantRenderer: (props) => {
779
- const { value, onChange, ...rest } = props;
780
- return /* @__PURE__ */ React8.createElement(
781
- Select,
782
- {
783
- placeholder: I18n5.t("Please Select Boolean"),
784
- size: "small",
785
- disabled: props.readonly,
786
- optionList: [
787
- { label: I18n5.t("True"), value: 1 },
788
- { label: I18n5.t("False"), value: 0 }
789
- ],
790
- value: value ? 1 : 0,
791
- onChange: (value2) => onChange?.(!!value2),
792
- ...rest
793
- }
794
- );
795
- }
796
- };
797
-
798
- // src/plugins/json-schema-preset/type-definition/array.tsx
799
- import React9 from "react";
800
- import { I18n as I18n6 } from "@flowgram.ai/editor";
801
- var arrayRegistry = {
802
- type: "array",
803
- ConstantRenderer: (props) => /* @__PURE__ */ React9.createElement(
804
- CodeEditorMini,
805
- {
806
- value: props.value,
807
- languageId: "json",
808
- onChange: (v) => props.onChange?.(v),
809
- placeholder: I18n6.t("Please Input Array"),
810
- readonly: props.readonly
811
- }
812
- )
813
- };
814
-
815
- // src/plugins/json-schema-preset/type-definition/index.tsx
816
- var jsonSchemaTypePreset = [
817
- stringRegistry,
818
- objectRegistry,
819
- numberRegistry,
820
- integerRegistry,
821
- booleanRegistry,
822
- arrayRegistry
823
- ];
824
- jsonSchemaTypePreset.forEach((_type) => jsonSchemaTypeManager.register(_type));
825
-
826
- // src/plugins/json-schema-preset/create-type-preset-plugin.tsx
2
+ PromptEditor
3
+ } from "./chunk-727SU246.js";
827
4
  import {
828
- BaseTypeManager,
829
- jsonSchemaContainerModule
830
- } from "@flowgram.ai/json-schema";
831
- import { definePluginCreator } from "@flowgram.ai/editor";
832
- var createTypePresetPlugin = definePluginCreator({
833
- onInit(ctx, opts) {
834
- const typeManager = ctx.get(BaseTypeManager);
835
- jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
836
- opts.types?.forEach((_type) => typeManager.register(_type));
837
- opts.unregisterTypes?.forEach((_type) => typeManager.unregister(_type));
838
- },
839
- containerModules: [jsonSchemaContainerModule]
840
- });
841
-
842
- // src/plugins/json-schema-preset/index.tsx
843
- var useTypeManager = () => useOriginTypeManager();
844
- var JsonSchemaTypePresetProvider = ({
845
- types = [],
846
- children
847
- }) => /* @__PURE__ */ React10.createElement(OriginTypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
848
-
849
- // src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts
5
+ CodeEditor,
6
+ CodeEditorMini,
7
+ InjectVariableSelector,
8
+ JsonSchemaTypePresetProvider,
9
+ JsonSchemaUtils,
10
+ VariableSelector,
11
+ createDisableDeclarationPlugin,
12
+ createTypePresetPlugin,
13
+ useTypeManager,
14
+ useVariableTree
15
+ } from "./chunk-MFDEE4HB.js";
850
16
  import {
851
- ASTMatch,
852
- definePluginCreator as definePluginCreator2,
853
- VariableEngine
854
- } from "@flowgram.ai/editor";
855
- var createDisableDeclarationPlugin = definePluginCreator2({
856
- onInit(ctx) {
857
- const variableEngine = ctx.get(VariableEngine);
858
- const handleEvent = (action) => {
859
- if (ASTMatch.isVariableDeclaration(action.ast)) {
860
- if (!action.ast.meta?.disabled) {
861
- action.ast.updateMeta({
862
- ...action.ast.meta || {},
863
- disabled: true
864
- });
865
- }
866
- }
867
- };
868
- variableEngine.onGlobalEvent("NewAST", handleEvent);
869
- variableEngine.onGlobalEvent("UpdateAST", handleEvent);
870
- }
871
- });
872
-
873
- // src/components/variable-selector/use-variable-tree.tsx
874
- function useVariableTree(params) {
875
- const { includeSchema, excludeSchema, customSkip } = params;
876
- const typeManager = useTypeManager();
877
- const variables = useAvailableVariables();
878
- const getVariableTypeIcon = useCallback((variable) => {
879
- if (variable.meta?.icon) {
880
- if (typeof variable.meta.icon === "string") {
881
- return /* @__PURE__ */ React11.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
882
- }
883
- return variable.meta.icon;
884
- }
885
- const schema = JsonSchemaUtils3.astToSchema(variable.type, { drilldownObject: false });
886
- return /* @__PURE__ */ React11.createElement(Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
887
- }, []);
888
- const renderVariable = (variable, parentFields = []) => {
889
- let type = variable?.type;
890
- if (!type) {
891
- return null;
892
- }
893
- let children;
894
- if (ASTMatch2.isObject(type)) {
895
- children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
896
- }
897
- const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
898
- const key = keyPath.join(".");
899
- const isSchemaInclude = includeSchema ? JsonSchemaUtils3.isASTMatchSchema(type, includeSchema) : true;
900
- const isSchemaExclude = excludeSchema ? JsonSchemaUtils3.isASTMatchSchema(type, excludeSchema) : false;
901
- const isCustomSkip = customSkip ? customSkip(variable) : false;
902
- const isMetaDisabled = variable.meta?.disabled;
903
- const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
904
- if (!isSchemaMatch && !children?.length) {
905
- return null;
906
- }
907
- return {
908
- key,
909
- label: variable.meta?.title || variable.key,
910
- value: key,
911
- keyPath,
912
- icon: getVariableTypeIcon(variable),
913
- children,
914
- disabled: !isSchemaMatch,
915
- rootMeta: parentFields[0]?.meta || variable.meta,
916
- isRoot: !parentFields?.length
917
- };
918
- };
919
- return [...variables.slice(0).reverse()].map((_variable) => renderVariable(_variable)).filter(Boolean);
920
- }
921
-
922
- // src/components/variable-selector/styles.tsx
923
- import styled2, { css } from "styled-components";
924
- import { Tag, TreeSelect } from "@douyinfe/semi-ui";
925
- var UIRootTitle = styled2.div`
926
- margin-right: 4px;
927
- min-width: 20px;
928
- overflow: hidden;
929
- text-overflow: ellipsis;
930
- white-space: nowrap;
931
- color: var(--semi-color-text-2);
932
- `;
933
- var UIVarName = styled2.div`
934
- overflow: hidden;
935
- text-overflow: ellipsis;
936
- white-space: nowrap;
937
-
938
- ${({ $inSelector }) => $inSelector && css`
939
- min-width: 50%;
940
- `}
941
- `;
942
- var UITag = styled2(Tag)`
943
- width: 100%;
944
- display: flex;
945
- align-items: center;
946
- justify-content: flex-start;
947
-
948
- & .semi-tag-content-center {
949
- justify-content: flex-start;
950
- }
951
-
952
- &.semi-tag {
953
- margin: 0;
954
- height: 22px;
955
- }
956
- `;
957
- var UITreeSelect = styled2(TreeSelect)`
958
- outline: ${({ $error }) => $error ? "1px solid red" : "none"};
959
-
960
- & .semi-tree-select-selection {
961
- padding: 0px;
962
- height: 22px;
963
- }
964
-
965
- & .semi-tree-select-selection-content {
966
- width: 100%;
967
- }
968
-
969
- & .semi-tree-select-selection-placeholder {
970
- padding-left: 10px;
971
- }
972
- `;
973
- var UIPopoverContent = styled2.div`
974
- padding: 10px;
975
- display: inline-flex;
976
- align-items: center;
977
- justify-content: flex-start;
978
- white-space: nowrap;
979
- `;
980
-
981
- // src/components/variable-selector/index.tsx
982
- var VariableSelector = ({
983
- value,
984
- config = {},
985
- onChange,
986
- style,
987
- readonly = false,
988
- includeSchema,
989
- excludeSchema,
990
- hasError,
991
- triggerRender
992
- }) => {
993
- const treeData = useVariableTree({ includeSchema, excludeSchema });
994
- const treeValue = useMemo(() => {
995
- if (typeof value === "string") {
996
- console.warn(
997
- "The Value of VariableSelector is a string, it should be an ARRAY. \n",
998
- "Please check the value of VariableSelector \n"
999
- );
1000
- return value;
1001
- }
1002
- return value?.join(".");
1003
- }, [value]);
1004
- const renderIcon = (icon) => {
1005
- if (typeof icon === "string") {
1006
- return /* @__PURE__ */ React12.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
1007
- }
1008
- return icon;
1009
- };
1010
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
1011
- UITreeSelect,
1012
- {
1013
- dropdownMatchSelectWidth: false,
1014
- disabled: readonly,
1015
- treeData,
1016
- size: "small",
1017
- value: treeValue,
1018
- clearIcon: null,
1019
- $error: hasError,
1020
- style,
1021
- validateStatus: hasError ? "error" : void 0,
1022
- onChange: (_, _config) => {
1023
- onChange(_config.keyPath);
1024
- },
1025
- renderSelectedItem: (_option) => {
1026
- if (!_option?.keyPath) {
1027
- return /* @__PURE__ */ React12.createElement(
1028
- UITag,
1029
- {
1030
- prefixIcon: /* @__PURE__ */ React12.createElement(IconIssueStroked, null),
1031
- color: "amber",
1032
- closable: !readonly,
1033
- onClose: () => onChange(void 0)
1034
- },
1035
- config?.notFoundContent ?? "Undefined"
1036
- );
1037
- }
1038
- const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
1039
- const rootTitle = /* @__PURE__ */ React12.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
1040
- return /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(
1041
- Popover,
1042
- {
1043
- content: /* @__PURE__ */ React12.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ React12.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
1044
- },
1045
- /* @__PURE__ */ React12.createElement(
1046
- UITag,
1047
- {
1048
- prefixIcon: rootIcon,
1049
- closable: !readonly,
1050
- onClose: () => onChange(void 0)
1051
- },
1052
- rootTitle,
1053
- !_option.isRoot && /* @__PURE__ */ React12.createElement(UIVarName, { $inSelector: true }, _option.label)
1054
- )
1055
- ));
1056
- },
1057
- showClear: false,
1058
- arrowIcon: /* @__PURE__ */ React12.createElement(IconChevronDownStroked, { size: "small" }),
1059
- triggerRender,
1060
- placeholder: config?.placeholder ?? I18n7.t("Select Variable")
1061
- }
1062
- ));
1063
- };
1064
- VariableSelector.renderKey = "variable-selector-render-key";
1065
- var InjectVariableSelector = createInjectMaterial(VariableSelector);
17
+ FlowValueUtils,
18
+ createInjectMaterial,
19
+ formatLegacyRefOnInit,
20
+ formatLegacyRefOnSubmit,
21
+ formatLegacyRefToNewRef,
22
+ formatNewRefToLegacyRef,
23
+ isLegacyFlowRefValueSchema,
24
+ isNewFlowRefValueSchema,
25
+ lazySuspense,
26
+ polyfillCreateRoot,
27
+ unstableSetCreateRoot,
28
+ withSuspense
29
+ } from "./chunk-DEZUEMUM.js";
1066
30
 
1067
31
  // src/components/type-selector/index.tsx
1068
- import React13, { useMemo as useMemo2 } from "react";
1069
- import { Cascader, Icon as Icon2, IconButton } from "@douyinfe/semi-ui";
32
+ import React, { useMemo } from "react";
33
+ import { Cascader, Icon, IconButton } from "@douyinfe/semi-ui";
1070
34
  var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
1071
35
  var getTypeSelectValue = (value) => {
1072
36
  if (value?.type === "array" && value?.items) {
@@ -1083,18 +47,18 @@ var parseTypeSelectValue = (value) => {
1083
47
  };
1084
48
  function TypeSelector(props) {
1085
49
  const { value, onChange, readonly, disabled, style } = props;
1086
- const selectValue = useMemo2(() => getTypeSelectValue(value), [value]);
50
+ const selectValue = useMemo(() => getTypeSelectValue(value), [value]);
1087
51
  const typeManager = useTypeManager();
1088
52
  const icon = typeManager.getDisplayIcon(value || {});
1089
- const options = useMemo2(
53
+ const options = useMemo(
1090
54
  () => typeManager.getTypeRegistriesWithParentType().map((_type) => {
1091
- const isArray2 = _type.type === "array";
55
+ const isArray = _type.type === "array";
1092
56
  return {
1093
- label: /* @__PURE__ */ React13.createElement("div", { style: labelStyle }, /* @__PURE__ */ React13.createElement(Icon2, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
57
+ label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
1094
58
  value: _type.type,
1095
- children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
1096
- label: /* @__PURE__ */ React13.createElement("div", { style: labelStyle }, /* @__PURE__ */ React13.createElement(
1097
- Icon2,
59
+ children: isArray ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
60
+ label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(
61
+ Icon,
1098
62
  {
1099
63
  size: "small",
1100
64
  svg: typeManager.getDisplayIcon({
@@ -1110,12 +74,12 @@ function TypeSelector(props) {
1110
74
  []
1111
75
  );
1112
76
  const isDisabled = readonly || disabled;
1113
- return /* @__PURE__ */ React13.createElement(
77
+ return /* @__PURE__ */ React.createElement(
1114
78
  Cascader,
1115
79
  {
1116
80
  disabled: isDisabled,
1117
81
  size: "small",
1118
- triggerRender: () => /* @__PURE__ */ React13.createElement(
82
+ triggerRender: () => /* @__PURE__ */ React.createElement(
1119
83
  IconButton,
1120
84
  {
1121
85
  size: "small",
@@ -1140,8 +104,8 @@ TypeSelector.renderKey = "type-selector-render-key";
1140
104
  var InjectTypeSelector = createInjectMaterial(TypeSelector);
1141
105
 
1142
106
  // src/components/json-schema-editor/index.tsx
1143
- import React18, { useMemo as useMemo4, useState as useState3 } from "react";
1144
- import { I18n as I18n9 } from "@flowgram.ai/editor";
107
+ import React6, { useMemo as useMemo3, useState as useState3 } from "react";
108
+ import { I18n as I18n2 } from "@flowgram.ai/editor";
1145
109
  import { Button, Checkbox, IconButton as IconButton2 } from "@douyinfe/semi-ui";
1146
110
  import {
1147
111
  IconExpand,
@@ -1153,15 +117,15 @@ import {
1153
117
  } from "@douyinfe/semi-icons";
1154
118
 
1155
119
  // src/components/blur-input/index.tsx
1156
- import React14, { useEffect as useEffect2, useState } from "react";
1157
- import Input2 from "@douyinfe/semi-ui/lib/es/input";
120
+ import React2, { useEffect, useState } from "react";
121
+ import Input from "@douyinfe/semi-ui/lib/es/input";
1158
122
  function BlurInput(props) {
1159
123
  const [value, setValue] = useState("");
1160
- useEffect2(() => {
124
+ useEffect(() => {
1161
125
  setValue(props.value);
1162
126
  }, [props.value]);
1163
- return /* @__PURE__ */ React14.createElement(
1164
- Input2,
127
+ return /* @__PURE__ */ React2.createElement(
128
+ Input,
1165
129
  {
1166
130
  ...props,
1167
131
  value,
@@ -1174,45 +138,45 @@ function BlurInput(props) {
1174
138
  }
1175
139
 
1176
140
  // src/components/json-schema-editor/styles.tsx
1177
- import React15 from "react";
1178
- import styled3, { css as css2 } from "styled-components";
1179
- import Icon3 from "@douyinfe/semi-icons";
1180
- var UIContainer = styled3.div`
141
+ import React3 from "react";
142
+ import styled, { css } from "styled-components";
143
+ import Icon2 from "@douyinfe/semi-icons";
144
+ var UIContainer = styled.div`
1181
145
  /* & .semi-input {
1182
146
  background-color: #fff;
1183
147
  border-radius: 6px;
1184
148
  height: 24px;
1185
149
  } */
1186
150
  `;
1187
- var UIRow = styled3.div`
151
+ var UIRow = styled.div`
1188
152
  display: flex;
1189
153
  align-items: center;
1190
154
  gap: 6px;
1191
155
  `;
1192
- var UICollapseTrigger = styled3.div`
156
+ var UICollapseTrigger = styled.div`
1193
157
  cursor: pointer;
1194
158
  margin-right: 5px;
1195
159
  `;
1196
- var UIExpandDetail = styled3.div`
160
+ var UIExpandDetail = styled.div`
1197
161
  display: flex;
1198
162
  flex-direction: column;
1199
163
  `;
1200
- var UILabel = styled3.div`
164
+ var UILabel = styled.div`
1201
165
  font-size: 12px;
1202
166
  color: #999;
1203
167
  font-weight: 400;
1204
168
  margin-bottom: 2px;
1205
169
  `;
1206
- var UITreeItems = styled3.div`
170
+ var UITreeItems = styled.div`
1207
171
  display: grid;
1208
172
  grid-template-columns: auto 1fr;
1209
173
 
1210
- ${({ $shrink }) => $shrink && css2`
174
+ ${({ $shrink }) => $shrink && css`
1211
175
  padding-left: 3px;
1212
176
  margin-top: 10px;
1213
177
  `}
1214
178
  `;
1215
- var UITreeItemLeft = styled3.div`
179
+ var UITreeItemLeft = styled.div`
1216
180
  grid-column: 1;
1217
181
  position: relative;
1218
182
  width: 16px;
@@ -1220,7 +184,7 @@ var UITreeItemLeft = styled3.div`
1220
184
  ${({ $showLine, $isLast, $showCollapse }) => {
1221
185
  let height = $isLast ? "24px" : "100%";
1222
186
  let width = $showCollapse ? "12px" : "30px";
1223
- return $showLine && css2`
187
+ return $showLine && css`
1224
188
  &::before {
1225
189
  /* 竖线 */
1226
190
  content: '';
@@ -1247,7 +211,7 @@ var UITreeItemLeft = styled3.div`
1247
211
  `;
1248
212
  }}
1249
213
  `;
1250
- var UITreeItemRight = styled3.div`
214
+ var UITreeItemRight = styled.div`
1251
215
  grid-column: 2;
1252
216
  margin-bottom: 10px;
1253
217
 
@@ -1255,28 +219,28 @@ var UITreeItemRight = styled3.div`
1255
219
  margin-bottom: 0px;
1256
220
  }
1257
221
  `;
1258
- var UITreeItemMain = styled3.div`
222
+ var UITreeItemMain = styled.div`
1259
223
  display: flex;
1260
224
  flex-direction: column;
1261
225
  gap: 10px;
1262
226
  position: relative;
1263
227
  `;
1264
- var UICollapsible = styled3.div`
228
+ var UICollapsible = styled.div`
1265
229
  display: none;
1266
230
 
1267
- ${({ $collapse }) => $collapse && css2`
231
+ ${({ $collapse }) => $collapse && css`
1268
232
  display: block;
1269
233
  `}
1270
234
  `;
1271
- var UIName = styled3.div`
235
+ var UIName = styled.div`
1272
236
  flex-grow: 1;
1273
237
  `;
1274
- var UIType = styled3.div``;
1275
- var UIRequired = styled3.div``;
1276
- var UIActions = styled3.div`
238
+ var UIType = styled.div``;
239
+ var UIRequired = styled.div``;
240
+ var UIActions = styled.div`
1277
241
  white-space: nowrap;
1278
242
  `;
1279
- var iconAddChildrenSvg = /* @__PURE__ */ React15.createElement(
243
+ var iconAddChildrenSvg = /* @__PURE__ */ React3.createElement(
1280
244
  "svg",
1281
245
  {
1282
246
  className: "icon-icon icon-icon-coz_add_node ",
@@ -1286,7 +250,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ React15.createElement(
1286
250
  fill: "currentColor",
1287
251
  xmlns: "http://www.w3.org/2000/svg"
1288
252
  },
1289
- /* @__PURE__ */ React15.createElement(
253
+ /* @__PURE__ */ React3.createElement(
1290
254
  "path",
1291
255
  {
1292
256
  fillRule: "evenodd",
@@ -1294,13 +258,13 @@ var iconAddChildrenSvg = /* @__PURE__ */ React15.createElement(
1294
258
  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"
1295
259
  }
1296
260
  ),
1297
- /* @__PURE__ */ React15.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" })
261
+ /* @__PURE__ */ React3.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" })
1298
262
  );
1299
- var IconAddChildren = () => /* @__PURE__ */ React15.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
1300
- var DefaultValueWrapper = styled3.div`
263
+ var IconAddChildren = () => /* @__PURE__ */ React3.createElement(Icon2, { size: "small", svg: iconAddChildrenSvg });
264
+ var DefaultValueWrapper = styled.div`
1301
265
  margin: 0;
1302
266
  `;
1303
- var ConstantInputWrapper = styled3.div`
267
+ var ConstantInputWrapper = styled.div`
1304
268
  flex-grow: 1;
1305
269
 
1306
270
  & .semi-tree-select,
@@ -1311,8 +275,8 @@ var ConstantInputWrapper = styled3.div`
1311
275
  `;
1312
276
 
1313
277
  // src/components/json-schema-editor/hooks.tsx
1314
- import { useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
1315
- import { difference, omit } from "lodash";
278
+ import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
279
+ import { difference, omit } from "lodash-es";
1316
280
  import { produce } from "immer";
1317
281
  import { useTypeManager as useTypeManager2 } from "@flowgram.ai/json-schema";
1318
282
  var _id = 0;
@@ -1324,9 +288,9 @@ function usePropertiesEdit(value, onChange) {
1324
288
  const drilldownSchema = typeManager.getPropertiesParent(value || {});
1325
289
  const canAddField = typeManager.canAddField(value || {});
1326
290
  const [propertyList, setPropertyList] = useState2([]);
1327
- const effectVersion = useRef2(0);
1328
- const changeVersion = useRef2(0);
1329
- useEffect3(() => {
291
+ const effectVersion = useRef(0);
292
+ const changeVersion = useRef(0);
293
+ useEffect2(() => {
1330
294
  effectVersion.current = effectVersion.current + 1;
1331
295
  if (effectVersion.current === changeVersion.current) {
1332
296
  return;
@@ -1393,7 +357,7 @@ function usePropertiesEdit(value, onChange) {
1393
357
  (_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
1394
358
  );
1395
359
  };
1396
- useEffect3(() => {
360
+ useEffect2(() => {
1397
361
  if (!canAddField) {
1398
362
  setPropertyList([]);
1399
363
  }
@@ -1408,46 +372,46 @@ function usePropertiesEdit(value, onChange) {
1408
372
  }
1409
373
 
1410
374
  // src/components/json-schema-editor/default-value.tsx
1411
- import React17 from "react";
1412
- import { I18n as I18n8 } from "@flowgram.ai/editor";
375
+ import React5 from "react";
376
+ import { I18n } from "@flowgram.ai/editor";
1413
377
 
1414
378
  // src/components/constant-input/index.tsx
1415
- import React16, { useMemo as useMemo3 } from "react";
1416
- import { Input as Input3 } from "@douyinfe/semi-ui";
379
+ import React4, { useMemo as useMemo2 } from "react";
380
+ import { Input as Input2 } from "@douyinfe/semi-ui";
1417
381
  function ConstantInput(props) {
1418
382
  const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
1419
383
  const typeManager = useTypeManager();
1420
- const Renderer2 = useMemo3(() => {
384
+ const Renderer = useMemo2(() => {
1421
385
  const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
1422
386
  if (!strategy) {
1423
387
  return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
1424
388
  }
1425
389
  return strategy?.Renderer;
1426
390
  }, [strategies, schema]);
1427
- if (!Renderer2) {
391
+ if (!Renderer) {
1428
392
  if (fallbackRenderer) {
1429
- return React16.createElement(fallbackRenderer, {
393
+ return React4.createElement(fallbackRenderer, {
1430
394
  value,
1431
395
  onChange,
1432
396
  readonly,
1433
397
  ...rest
1434
398
  });
1435
399
  }
1436
- return /* @__PURE__ */ React16.createElement(Input3, { size: "small", disabled: true, placeholder: "Unsupported type" });
400
+ return /* @__PURE__ */ React4.createElement(Input2, { size: "small", disabled: true, placeholder: "Unsupported type" });
1437
401
  }
1438
- return /* @__PURE__ */ React16.createElement(Renderer2, { value, onChange, readonly, ...rest });
402
+ return /* @__PURE__ */ React4.createElement(Renderer, { value, onChange, readonly, ...rest });
1439
403
  }
1440
404
 
1441
405
  // src/components/json-schema-editor/default-value.tsx
1442
406
  function DefaultValue(props) {
1443
407
  const { value, schema, onChange, placeholder } = props;
1444
- return /* @__PURE__ */ React17.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React17.createElement(
408
+ return /* @__PURE__ */ React5.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React5.createElement(
1445
409
  ConstantInput,
1446
410
  {
1447
411
  value,
1448
412
  onChange: (_v) => onChange(_v),
1449
413
  schema: schema || { type: "string" },
1450
- placeholder: placeholder ?? I18n8.t("Default value if parameter is not provided"),
414
+ placeholder: placeholder ?? I18n.t("Default value if parameter is not provided"),
1451
415
  enableMultiLineStr: true
1452
416
  }
1453
417
  ));
@@ -1461,7 +425,7 @@ function JsonSchemaEditor(props) {
1461
425
  value,
1462
426
  onChangeProps
1463
427
  );
1464
- return /* @__PURE__ */ React18.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React18.createElement(UITreeItems, null, propertyList.map((_property) => /* @__PURE__ */ React18.createElement(
428
+ return /* @__PURE__ */ React6.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React6.createElement(UITreeItems, null, propertyList.map((_property) => /* @__PURE__ */ React6.createElement(
1465
429
  PropertyEdit,
1466
430
  {
1467
431
  readonly,
@@ -1475,16 +439,16 @@ function JsonSchemaEditor(props) {
1475
439
  onRemoveProperty(_property.key);
1476
440
  }
1477
441
  }
1478
- ))), /* @__PURE__ */ React18.createElement(
442
+ ))), /* @__PURE__ */ React6.createElement(
1479
443
  Button,
1480
444
  {
1481
445
  disabled: readonly,
1482
446
  size: "small",
1483
447
  style: { marginTop: 10, marginLeft: 16 },
1484
- icon: /* @__PURE__ */ React18.createElement(IconPlus, null),
448
+ icon: /* @__PURE__ */ React6.createElement(IconPlus, null),
1485
449
  onClick: onAddProperty
1486
450
  },
1487
- config?.addButtonText ?? I18n9.t("Add")
451
+ config?.addButtonText ?? I18n2.t("Add")
1488
452
  ));
1489
453
  }
1490
454
  function PropertyEdit(props) {
@@ -1492,7 +456,7 @@ function PropertyEdit(props) {
1492
456
  const [expand, setExpand] = useState3(false);
1493
457
  const [collapse, setCollapse] = useState3(false);
1494
458
  const { name, type, items, default: defaultValue, description, isPropertyRequired } = value || {};
1495
- const typeSelectorValue = useMemo4(() => ({ type, items }), [type, items]);
459
+ const typeSelectorValue = useMemo3(() => ({ type, items }), [type, items]);
1496
460
  const { propertyList, canAddField, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
1497
461
  const onChange = (key, _value) => {
1498
462
  onChangeProps?.({
@@ -1501,16 +465,16 @@ function PropertyEdit(props) {
1501
465
  });
1502
466
  };
1503
467
  const showCollapse = canAddField && propertyList.length > 0;
1504
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(UITreeItemLeft, { $isLast, $showLine: $level > 0, $showCollapse: showCollapse }, showCollapse && /* @__PURE__ */ React18.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React18.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React18.createElement(IconChevronRight, { size: "small" }))), /* @__PURE__ */ React18.createElement(UITreeItemRight, null, /* @__PURE__ */ React18.createElement(UITreeItemMain, null, /* @__PURE__ */ React18.createElement(UIRow, null, /* @__PURE__ */ React18.createElement(UIName, null, /* @__PURE__ */ React18.createElement(
468
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(UITreeItemLeft, { $isLast, $showLine: $level > 0, $showCollapse: showCollapse }, showCollapse && /* @__PURE__ */ React6.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React6.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React6.createElement(IconChevronRight, { size: "small" }))), /* @__PURE__ */ React6.createElement(UITreeItemRight, null, /* @__PURE__ */ React6.createElement(UITreeItemMain, null, /* @__PURE__ */ React6.createElement(UIRow, null, /* @__PURE__ */ React6.createElement(UIName, null, /* @__PURE__ */ React6.createElement(
1505
469
  BlurInput,
1506
470
  {
1507
471
  disabled: readonly,
1508
- placeholder: config?.placeholder ?? I18n9.t("Input Variable Name"),
472
+ placeholder: config?.placeholder ?? I18n2.t("Input Variable Name"),
1509
473
  size: "small",
1510
474
  value: name,
1511
475
  onChange: (value2) => onChange("name", value2)
1512
476
  }
1513
- )), /* @__PURE__ */ React18.createElement(UIType, null, /* @__PURE__ */ React18.createElement(
477
+ )), /* @__PURE__ */ React6.createElement(UIType, null, /* @__PURE__ */ React6.createElement(
1514
478
  InjectTypeSelector,
1515
479
  {
1516
480
  value: typeSelectorValue,
@@ -1522,63 +486,63 @@ function PropertyEdit(props) {
1522
486
  });
1523
487
  }
1524
488
  }
1525
- )), /* @__PURE__ */ React18.createElement(UIRequired, null, /* @__PURE__ */ React18.createElement(
489
+ )), /* @__PURE__ */ React6.createElement(UIRequired, null, /* @__PURE__ */ React6.createElement(
1526
490
  Checkbox,
1527
491
  {
1528
492
  disabled: readonly,
1529
493
  checked: isPropertyRequired,
1530
494
  onChange: (e) => onChange("isPropertyRequired", e.target.checked)
1531
495
  }
1532
- )), /* @__PURE__ */ React18.createElement(UIActions, null, /* @__PURE__ */ React18.createElement(
496
+ )), /* @__PURE__ */ React6.createElement(UIActions, null, /* @__PURE__ */ React6.createElement(
1533
497
  IconButton2,
1534
498
  {
1535
499
  disabled: readonly,
1536
500
  size: "small",
1537
501
  theme: "borderless",
1538
- icon: expand ? /* @__PURE__ */ React18.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React18.createElement(IconExpand, { size: "small" }),
502
+ icon: expand ? /* @__PURE__ */ React6.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React6.createElement(IconExpand, { size: "small" }),
1539
503
  onClick: () => {
1540
504
  setExpand((_expand) => !_expand);
1541
505
  }
1542
506
  }
1543
- ), canAddField && /* @__PURE__ */ React18.createElement(
507
+ ), canAddField && /* @__PURE__ */ React6.createElement(
1544
508
  IconButton2,
1545
509
  {
1546
510
  disabled: readonly,
1547
511
  size: "small",
1548
512
  theme: "borderless",
1549
- icon: /* @__PURE__ */ React18.createElement(IconAddChildren, null),
513
+ icon: /* @__PURE__ */ React6.createElement(IconAddChildren, null),
1550
514
  onClick: () => {
1551
515
  onAddProperty();
1552
516
  setCollapse(true);
1553
517
  }
1554
518
  }
1555
- ), /* @__PURE__ */ React18.createElement(
519
+ ), /* @__PURE__ */ React6.createElement(
1556
520
  IconButton2,
1557
521
  {
1558
522
  disabled: readonly,
1559
523
  size: "small",
1560
524
  theme: "borderless",
1561
- icon: /* @__PURE__ */ React18.createElement(IconMinus, { size: "small" }),
525
+ icon: /* @__PURE__ */ React6.createElement(IconMinus, { size: "small" }),
1562
526
  onClick: onRemove
1563
527
  }
1564
- ))), expand && /* @__PURE__ */ React18.createElement(UIExpandDetail, null, /* @__PURE__ */ React18.createElement(UILabel, null, config?.descTitle ?? I18n9.t("Description")), /* @__PURE__ */ React18.createElement(
528
+ ))), expand && /* @__PURE__ */ React6.createElement(UIExpandDetail, null, /* @__PURE__ */ React6.createElement(UILabel, null, config?.descTitle ?? I18n2.t("Description")), /* @__PURE__ */ React6.createElement(
1565
529
  BlurInput,
1566
530
  {
1567
531
  disabled: readonly,
1568
532
  size: "small",
1569
533
  value: description,
1570
534
  onChange: (value2) => onChange("description", value2),
1571
- placeholder: config?.descPlaceholder ?? I18n9.t("Help LLM to understand the property")
535
+ placeholder: config?.descPlaceholder ?? I18n2.t("Help LLM to understand the property")
1572
536
  }
1573
- ), $level === 0 && /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? I18n9.t("Default Value")), /* @__PURE__ */ React18.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React18.createElement(
537
+ ), $level === 0 && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? I18n2.t("Default Value")), /* @__PURE__ */ React6.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React6.createElement(
1574
538
  DefaultValue,
1575
539
  {
1576
540
  value: defaultValue,
1577
541
  schema: value,
1578
- placeholder: config?.defaultValuePlaceholder ?? I18n9.t("Default Value"),
542
+ placeholder: config?.defaultValuePlaceholder ?? I18n2.t("Default Value"),
1579
543
  onChange: (value2) => onChange("default", value2)
1580
544
  }
1581
- ))))), showCollapse && /* @__PURE__ */ React18.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React18.createElement(UITreeItems, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React18.createElement(
545
+ ))))), showCollapse && /* @__PURE__ */ React6.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React6.createElement(UITreeItems, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React6.createElement(
1582
546
  PropertyEdit,
1583
547
  {
1584
548
  readonly,
@@ -1598,28 +562,28 @@ function PropertyEdit(props) {
1598
562
  }
1599
563
 
1600
564
  // src/components/batch-variable-selector/index.tsx
1601
- import React19 from "react";
565
+ import React7 from "react";
1602
566
  import { PrivateScopeProvider } from "@flowgram.ai/editor";
1603
567
  var batchVariableSchema = {
1604
568
  type: "array",
1605
569
  extra: { weak: true }
1606
570
  };
1607
571
  function BatchVariableSelector(props) {
1608
- return /* @__PURE__ */ React19.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React19.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
572
+ return /* @__PURE__ */ React7.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React7.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1609
573
  }
1610
574
 
1611
575
  // src/components/dynamic-value-input/index.tsx
1612
- import React20 from "react";
576
+ import React8 from "react";
1613
577
  import {
1614
- JsonSchemaUtils as JsonSchemaUtils4,
578
+ JsonSchemaUtils as JsonSchemaUtils2,
1615
579
  useTypeManager as useTypeManager3
1616
580
  } from "@flowgram.ai/json-schema";
1617
581
  import { IconButton as IconButton3 } from "@douyinfe/semi-ui";
1618
582
  import { IconSetting } from "@douyinfe/semi-icons";
1619
583
 
1620
584
  // src/components/dynamic-value-input/styles.tsx
1621
- import styled4 from "styled-components";
1622
- var UIContainer2 = styled4.div`
585
+ import styled2 from "styled-components";
586
+ var UIContainer2 = styled2.div`
1623
587
  display: flex;
1624
588
  align-items: center;
1625
589
  border-radius: 4px;
@@ -1629,7 +593,7 @@ var UIContainer2 = styled4.div`
1629
593
 
1630
594
  background-color: var(--semi-color-fill-0);
1631
595
  `;
1632
- var UIMain = styled4.div`
596
+ var UIMain = styled2.div`
1633
597
  flex-grow: 1;
1634
598
  overflow: hidden;
1635
599
  min-width: 0;
@@ -1661,23 +625,23 @@ var UIMain = styled4.div`
1661
625
  word-break: break-all;
1662
626
  }
1663
627
  `;
1664
- var UIType2 = styled4.div`
628
+ var UIType2 = styled2.div`
1665
629
  & .semi-button {
1666
630
  border-radius: 0;
1667
631
  }
1668
632
  `;
1669
- var UITrigger = styled4.div`
633
+ var UITrigger = styled2.div`
1670
634
  & .semi-button {
1671
635
  border-radius: 0;
1672
636
  }
1673
637
  `;
1674
638
 
1675
639
  // src/components/dynamic-value-input/hooks.ts
1676
- import { useEffect as useEffect4, useMemo as useMemo5, useRef as useRef3, useState as useState4 } from "react";
640
+ import { useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2, useState as useState4 } from "react";
1677
641
  import { useScopeAvailable } from "@flowgram.ai/editor";
1678
642
  function useRefVariable(value) {
1679
643
  const available = useScopeAvailable();
1680
- const refVariable = useMemo5(() => {
644
+ const refVariable = useMemo4(() => {
1681
645
  if (value?.type === "ref") {
1682
646
  return available.getByKeyPath(value.content);
1683
647
  }
@@ -1689,10 +653,10 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
1689
653
  if (value?.type === "constant") {
1690
654
  defaultSelectSchema = value?.schema || defaultSelectSchema;
1691
655
  }
1692
- const changeVersion = useRef3(0);
1693
- const effectVersion = useRef3(0);
656
+ const changeVersion = useRef2(0);
657
+ const effectVersion = useRef2(0);
1694
658
  const [selectSchema, setSelectSchema] = useState4(defaultSelectSchema);
1695
- useEffect4(() => {
659
+ useEffect3(() => {
1696
660
  effectVersion.current += 1;
1697
661
  if (changeVersion.current === effectVersion.current) {
1698
662
  return;
@@ -1710,14 +674,14 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
1710
674
  return [selectSchema, setSelectSchemaWithVersionUpdate];
1711
675
  }
1712
676
  function useIncludeSchema(schemaFromProps) {
1713
- const includeSchema = useMemo5(() => {
677
+ const includeSchema = useMemo4(() => {
1714
678
  if (!schemaFromProps) {
1715
679
  return;
1716
680
  }
1717
681
  if (schemaFromProps?.type === "number") {
1718
682
  return [schemaFromProps, { type: "integer" }];
1719
683
  }
1720
- return { ...schemaFromProps, extra: { ...schemaFromProps?.extra, weak: true } };
684
+ return { ...schemaFromProps, extra: { weak: true, ...schemaFromProps?.extra } };
1721
685
  }, [schemaFromProps]);
1722
686
  return includeSchema;
1723
687
  }
@@ -1742,13 +706,13 @@ function DynamicValueInput({
1742
706
  const typeManager = useTypeManager3();
1743
707
  const renderTypeSelector = () => {
1744
708
  if (schemaFromProps) {
1745
- return /* @__PURE__ */ React20.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
709
+ return /* @__PURE__ */ React8.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1746
710
  }
1747
711
  if (value?.type === "ref") {
1748
- const schema = refVariable?.type ? JsonSchemaUtils4.astToSchema(refVariable?.type) : void 0;
1749
- return /* @__PURE__ */ React20.createElement(TypeSelector, { value: schema, readonly: true });
712
+ const schema = refVariable?.type ? JsonSchemaUtils2.astToSchema(refVariable?.type) : void 0;
713
+ return /* @__PURE__ */ React8.createElement(TypeSelector, { value: schema, readonly: true });
1750
714
  }
1751
- return /* @__PURE__ */ React20.createElement(
715
+ return /* @__PURE__ */ React8.createElement(
1752
716
  TypeSelector,
1753
717
  {
1754
718
  value: selectSchema,
@@ -1774,7 +738,7 @@ function DynamicValueInput({
1774
738
  };
1775
739
  const renderMain = () => {
1776
740
  if (value?.type === "ref") {
1777
- return /* @__PURE__ */ React20.createElement(
741
+ return /* @__PURE__ */ React8.createElement(
1778
742
  InjectVariableSelector,
1779
743
  {
1780
744
  style: { width: "100%" },
@@ -1785,15 +749,15 @@ function DynamicValueInput({
1785
749
  }
1786
750
  );
1787
751
  }
1788
- const constantSchema2 = schemaFromProps || selectSchema || { type: "string" };
1789
- return /* @__PURE__ */ React20.createElement(
752
+ const constantSchema = schemaFromProps || selectSchema || { type: "string" };
753
+ return /* @__PURE__ */ React8.createElement(
1790
754
  ConstantInput,
1791
755
  {
1792
756
  value: value?.content,
1793
- onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema2 }),
1794
- schema: constantSchema2 || { type: "string" },
757
+ onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema }),
758
+ schema: constantSchema || { type: "string" },
1795
759
  readonly,
1796
- fallbackRenderer: () => /* @__PURE__ */ React20.createElement(
760
+ fallbackRenderer: () => /* @__PURE__ */ React8.createElement(
1797
761
  InjectVariableSelector,
1798
762
  {
1799
763
  style: { width: "100%" },
@@ -1807,7 +771,7 @@ function DynamicValueInput({
1807
771
  }
1808
772
  );
1809
773
  };
1810
- const renderTrigger = () => /* @__PURE__ */ React20.createElement(
774
+ const renderTrigger = () => /* @__PURE__ */ React8.createElement(
1811
775
  InjectVariableSelector,
1812
776
  {
1813
777
  style: { width: "100%" },
@@ -1815,34 +779,34 @@ function DynamicValueInput({
1815
779
  onChange: (_v) => onChange({ type: "ref", content: _v }),
1816
780
  includeSchema,
1817
781
  readonly,
1818
- triggerRender: () => /* @__PURE__ */ React20.createElement(IconButton3, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React20.createElement(IconSetting, { size: "small" }) })
782
+ triggerRender: () => /* @__PURE__ */ React8.createElement(IconButton3, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React8.createElement(IconSetting, { size: "small" }) })
1819
783
  }
1820
784
  );
1821
- return /* @__PURE__ */ React20.createElement(UIContainer2, { style }, /* @__PURE__ */ React20.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React20.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React20.createElement(UITrigger, null, renderTrigger()));
785
+ return /* @__PURE__ */ React8.createElement(UIContainer2, { style }, /* @__PURE__ */ React8.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React8.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React8.createElement(UITrigger, null, renderTrigger()));
1822
786
  }
1823
787
  DynamicValueInput.renderKey = "dynamic-value-input-render-key";
1824
788
  var InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
1825
789
 
1826
790
  // src/components/condition-row/index.tsx
1827
- import React22, { useMemo as useMemo8 } from "react";
1828
- import { I18n as I18n11 } from "@flowgram.ai/editor";
1829
- import { Input as Input4 } from "@douyinfe/semi-ui";
791
+ import React10, { useMemo as useMemo7 } from "react";
792
+ import { I18n as I18n4 } from "@flowgram.ai/editor";
793
+ import { Input as Input3 } from "@douyinfe/semi-ui";
1830
794
 
1831
795
  // src/components/condition-row/styles.tsx
1832
- import styled5 from "styled-components";
1833
- var UIContainer3 = styled5.div`
796
+ import styled3 from "styled-components";
797
+ var UIContainer3 = styled3.div`
1834
798
  display: flex;
1835
799
  align-items: center;
1836
800
  gap: 4px;
1837
801
  `;
1838
- var UIOperator = styled5.div``;
1839
- var UILeft = styled5.div`
802
+ var UIOperator = styled3.div``;
803
+ var UILeft = styled3.div`
1840
804
  width: 100%;
1841
805
  `;
1842
- var UIRight = styled5.div`
806
+ var UIRight = styled3.div`
1843
807
  width: 100%;
1844
808
  `;
1845
- var UIValues = styled5.div`
809
+ var UIValues = styled3.div`
1846
810
  flex-grow: 1;
1847
811
  display: flex;
1848
812
  flex-direction: column;
@@ -1851,8 +815,8 @@ var UIValues = styled5.div`
1851
815
  `;
1852
816
 
1853
817
  // src/components/condition-row/hooks/useRule.ts
1854
- import { useMemo as useMemo6 } from "react";
1855
- import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
818
+ import { useMemo as useMemo5 } from "react";
819
+ import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
1856
820
  import { useScopeAvailable as useScopeAvailable2 } from "@flowgram.ai/editor";
1857
821
 
1858
822
  // src/components/condition-row/constants.ts
@@ -1978,37 +942,37 @@ var defaultOpConfigs = {
1978
942
  // src/components/condition-row/hooks/useRule.ts
1979
943
  function useRule(left, userRules) {
1980
944
  const available = useScopeAvailable2();
1981
- const rules = useMemo6(() => ({ ...defaultRules, ...userRules || {} }), [userRules]);
1982
- const variable = useMemo6(() => {
945
+ const rules = useMemo5(() => ({ ...defaultRules, ...userRules || {} }), [userRules]);
946
+ const variable = useMemo5(() => {
1983
947
  if (!left) return void 0;
1984
948
  return available.getByKeyPath(left.content);
1985
949
  }, [available, left]);
1986
- const rule = useMemo6(() => {
950
+ const rule = useMemo5(() => {
1987
951
  if (!variable) return void 0;
1988
- const schema = JsonSchemaUtils5.astToSchema(variable.type, { drilldown: false });
952
+ const schema = JsonSchemaUtils3.astToSchema(variable.type, { drilldown: false });
1989
953
  return rules[schema?.type];
1990
954
  }, [variable?.type, rules]);
1991
955
  return { rule };
1992
956
  }
1993
957
 
1994
958
  // src/components/condition-row/hooks/useOp.tsx
1995
- import React21, { useMemo as useMemo7 } from "react";
1996
- import { I18n as I18n10 } from "@flowgram.ai/editor";
1997
- import { Button as Button2, Select as Select2 } from "@douyinfe/semi-ui";
1998
- import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
959
+ import React9, { useMemo as useMemo6 } from "react";
960
+ import { I18n as I18n3 } from "@flowgram.ai/editor";
961
+ import { Button as Button2, Select } from "@douyinfe/semi-ui";
962
+ import { IconChevronDownStroked } from "@douyinfe/semi-icons";
1999
963
  function useOp({ rule, op, onChange, readonly, userOps }) {
2000
- const options = useMemo7(
964
+ const options = useMemo6(
2001
965
  () => Object.keys(rule || {}).map((_op) => ({
2002
966
  ...defaultOpConfigs[_op] || {},
2003
967
  ...userOps?.[_op] || {},
2004
968
  value: _op,
2005
- label: I18n10.t(userOps?.[_op]?.label || defaultOpConfigs[_op]?.label)
969
+ label: I18n3.t(userOps?.[_op]?.label || defaultOpConfigs[_op]?.label)
2006
970
  })),
2007
971
  [rule, userOps]
2008
972
  );
2009
- const opConfig = useMemo7(() => defaultOpConfigs[op], [op]);
2010
- const renderOpSelect = () => /* @__PURE__ */ React21.createElement(
2011
- Select2,
973
+ const opConfig = useMemo6(() => defaultOpConfigs[op], [op]);
974
+ const renderOpSelect = () => /* @__PURE__ */ React9.createElement(
975
+ Select,
2012
976
  {
2013
977
  style: { height: 22 },
2014
978
  disabled: readonly,
@@ -2018,7 +982,7 @@ function useOp({ rule, op, onChange, readonly, userOps }) {
2018
982
  onChange: (v) => {
2019
983
  onChange(v);
2020
984
  },
2021
- triggerRender: ({ value }) => /* @__PURE__ */ React21.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React21.createElement(IconChevronDownStroked2, { size: "small" }))
985
+ triggerRender: ({ value }) => /* @__PURE__ */ React9.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React9.createElement(IconChevronDownStroked, { size: "small" }))
2022
986
  }
2023
987
  );
2024
988
  return { renderOpSelect, opConfig };
@@ -2045,11 +1009,11 @@ function ConditionRow({
2045
1009
  readonly,
2046
1010
  userOps: ruleConfig.ops
2047
1011
  });
2048
- const targetSchema = useMemo8(() => {
1012
+ const targetSchema = useMemo7(() => {
2049
1013
  const targetType = rule?.[operator || ""] || null;
2050
1014
  return targetType ? { type: targetType, extra: { weak: true } } : null;
2051
1015
  }, [rule, opConfig]);
2052
- return /* @__PURE__ */ React22.createElement(UIContainer3, { style }, /* @__PURE__ */ React22.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React22.createElement(UIValues, null, /* @__PURE__ */ React22.createElement(UILeft, null, /* @__PURE__ */ React22.createElement(
1016
+ return /* @__PURE__ */ React10.createElement(UIContainer3, { style }, /* @__PURE__ */ React10.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React10.createElement(UIValues, null, /* @__PURE__ */ React10.createElement(UILeft, null, /* @__PURE__ */ React10.createElement(
2053
1017
  InjectVariableSelector,
2054
1018
  {
2055
1019
  readonly,
@@ -2063,7 +1027,7 @@ function ConditionRow({
2063
1027
  }
2064
1028
  })
2065
1029
  }
2066
- )), /* @__PURE__ */ React22.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React22.createElement(
1030
+ )), /* @__PURE__ */ React10.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React10.createElement(
2067
1031
  InjectDynamicValueInput,
2068
1032
  {
2069
1033
  readonly: readonly || !rule,
@@ -2071,1032 +1035,372 @@ function ConditionRow({
2071
1035
  schema: targetSchema,
2072
1036
  onChange: (v) => onChange({ ...value, right: v })
2073
1037
  }
2074
- ) : /* @__PURE__ */ React22.createElement(
2075
- Input4,
1038
+ ) : /* @__PURE__ */ React10.createElement(
1039
+ Input3,
2076
1040
  {
2077
1041
  size: "small",
2078
1042
  disabled: true,
2079
1043
  style: { pointerEvents: "none" },
2080
- value: opConfig?.rightDisplay || I18n11.t("Empty")
1044
+ value: opConfig?.rightDisplay || I18n4.t("Empty")
2081
1045
  }
2082
1046
  ))));
2083
1047
  }
1048
+ ConditionRow.defaultRules = defaultRules;
1049
+ ConditionRow.defaultOpConfigs = defaultOpConfigs;
2084
1050
 
2085
- // src/components/batch-outputs/index.tsx
2086
- import React23 from "react";
2087
- import { I18n as I18n12 } from "@flowgram.ai/editor";
2088
- import { Button as Button3, Input as Input5 } from "@douyinfe/semi-ui";
2089
- import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
2090
-
2091
- // src/hooks/use-object-list/index.tsx
2092
- import { useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
2093
- import { nanoid } from "nanoid";
2094
- import { difference as difference2, get, isObject as isObject3, set } from "lodash";
2095
- function genId2() {
2096
- return nanoid();
2097
- }
2098
- function useObjectList({
2099
- value,
2100
- onChange,
2101
- sortIndexKey
2102
- }) {
2103
- const [list, setList] = useState5([]);
2104
- const effectVersion = useRef4(0);
2105
- const changeVersion = useRef4(0);
2106
- const getSortIndex = (value2) => {
2107
- if (typeof sortIndexKey === "function") {
2108
- return get(value2, sortIndexKey(value2)) || 0;
2109
- }
2110
- return get(value2, sortIndexKey || "") || 0;
2111
- };
2112
- useEffect5(() => {
2113
- effectVersion.current = effectVersion.current + 1;
2114
- if (effectVersion.current === changeVersion.current) {
2115
- return;
2116
- }
2117
- effectVersion.current = changeVersion.current;
2118
- setList((_prevList) => {
2119
- const newKeys = Object.entries(value || {}).sort((a, b) => getSortIndex(a[1]) - getSortIndex(b[1])).map(([key]) => key);
2120
- const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
2121
- const addKeys = difference2(newKeys, oldKeys);
2122
- return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
2123
- id: item.id,
2124
- key: item.key,
2125
- value: item.key ? value?.[item.key] : item.value
2126
- })).concat(
2127
- addKeys.map((_key) => ({
2128
- id: genId2(),
2129
- key: _key,
2130
- value: value?.[_key]
2131
- }))
2132
- );
2133
- });
2134
- }, [value]);
2135
- const add = (defaultValue) => {
2136
- setList((prevList) => [
2137
- ...prevList,
2138
- {
2139
- id: genId2(),
2140
- value: defaultValue
2141
- }
2142
- ]);
2143
- };
2144
- const updateValue = (itemId, value2) => {
2145
- changeVersion.current = changeVersion.current + 1;
2146
- setList((prevList) => {
2147
- const nextList = prevList.map((_item) => {
2148
- if (_item.id === itemId) {
2149
- return {
2150
- ..._item,
2151
- value: value2
2152
- };
2153
- }
2154
- return _item;
2155
- });
2156
- onChange(
2157
- Object.fromEntries(
2158
- nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
2159
- const indexKey = typeof sortIndexKey === "function" ? sortIndexKey(_res[1]) : sortIndexKey;
2160
- if (isObject3(_res[1]) && indexKey) {
2161
- set(_res[1], indexKey, idx);
2162
- }
2163
- return _res;
2164
- })
2165
- )
2166
- );
2167
- return nextList;
2168
- });
2169
- };
2170
- const updateKey = (itemId, key) => {
2171
- changeVersion.current = changeVersion.current + 1;
2172
- setList((prevList) => {
2173
- const nextList = prevList.map((_item) => {
2174
- if (_item.id === itemId) {
2175
- return {
2176
- ..._item,
2177
- key
2178
- };
2179
- }
2180
- return _item;
2181
- });
2182
- onChange(
2183
- Object.fromEntries(
2184
- nextList.filter((item) => item.key).map((item) => [item.key, item.value])
2185
- )
2186
- );
2187
- return nextList;
2188
- });
2189
- };
2190
- const remove = (itemId) => {
2191
- changeVersion.current = changeVersion.current + 1;
2192
- setList((prevList) => {
2193
- const nextList = prevList.filter((_item) => _item.id !== itemId);
2194
- onChange(
2195
- Object.fromEntries(
2196
- nextList.filter((item) => item.key).map((item) => [item.key, item.value])
2197
- )
2198
- );
2199
- return nextList;
2200
- });
2201
- };
2202
- return { list, add, updateKey, updateValue, remove };
2203
- }
1051
+ // src/components/db-condition-row/index.tsx
1052
+ import React13, { useMemo as useMemo10 } from "react";
1053
+ import { I18n as I18n6 } from "@flowgram.ai/editor";
1054
+ import { Input as Input4 } from "@douyinfe/semi-ui";
2204
1055
 
2205
- // src/components/batch-outputs/styles.tsx
2206
- import styled6 from "styled-components";
2207
- var UIRows = styled6.div`
1056
+ // src/components/db-condition-row/styles.tsx
1057
+ import styled4 from "styled-components";
1058
+ import { Select as Select2 } from "@douyinfe/semi-ui";
1059
+ var UIContainer4 = styled4.div`
1060
+ display: flex;
1061
+ align-items: center;
1062
+ gap: 4px;
1063
+ `;
1064
+ var UIOperator2 = styled4.div``;
1065
+ var UILeft2 = styled4.div`
1066
+ width: 100%;
1067
+ `;
1068
+ var UIRight2 = styled4.div`
1069
+ width: 100%;
1070
+ `;
1071
+ var UIValues2 = styled4.div`
1072
+ flex-grow: 1;
2208
1073
  display: flex;
2209
1074
  flex-direction: column;
2210
- gap: 10px;
2211
- margin-bottom: 10px;
1075
+ align-items: center;
1076
+ gap: 4px;
2212
1077
  `;
2213
- var UIRow2 = styled6.div`
1078
+ var UIOptionLabel = styled4.div`
2214
1079
  display: flex;
2215
1080
  align-items: center;
2216
- gap: 5px;
1081
+ gap: 10px;
1082
+ `;
1083
+ var UISelect = styled4(Select2)`
1084
+ & .semi-select-selection {
1085
+ margin-left: 5px;
1086
+ }
2217
1087
  `;
2218
1088
 
2219
- // src/components/batch-outputs/index.tsx
2220
- function BatchOutputs(props) {
2221
- const { readonly, style } = props;
2222
- const { list, add, updateKey, updateValue, remove } = useObjectList(props);
2223
- return /* @__PURE__ */ React23.createElement("div", null, /* @__PURE__ */ React23.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React23.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React23.createElement(
2224
- Input5,
1089
+ // src/components/db-condition-row/hooks/use-op.tsx
1090
+ import React11, { useMemo as useMemo8 } from "react";
1091
+ import { I18n as I18n5 } from "@flowgram.ai/editor";
1092
+ import { Button as Button3, Select as Select3 } from "@douyinfe/semi-ui";
1093
+ import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
1094
+ var defaultOpConfigs2 = ConditionRow.defaultOpConfigs;
1095
+ function useOp2({ rule, op, onChange, readonly, userOps }) {
1096
+ const options = useMemo8(
1097
+ () => Object.keys(rule || {}).map((_op) => ({
1098
+ ...defaultOpConfigs2[_op] || {},
1099
+ ...userOps?.[_op] || {},
1100
+ value: _op,
1101
+ label: I18n5.t(userOps?.[_op]?.label || defaultOpConfigs2[_op]?.label)
1102
+ })),
1103
+ [rule, userOps]
1104
+ );
1105
+ const opConfig = useMemo8(() => defaultOpConfigs2[op], [op]);
1106
+ const renderOpSelect = () => /* @__PURE__ */ React11.createElement(
1107
+ Select3,
2225
1108
  {
2226
- style: { width: 100 },
1109
+ style: { height: 22 },
2227
1110
  disabled: readonly,
2228
1111
  size: "small",
2229
- value: item.key,
2230
- onChange: (v) => updateKey(item.id, v)
1112
+ value: op,
1113
+ optionList: options,
1114
+ onChange: (v) => {
1115
+ onChange(v);
1116
+ },
1117
+ triggerRender: ({ value }) => /* @__PURE__ */ React11.createElement(Button3, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React11.createElement(IconChevronDownStroked2, { size: "small" }))
2231
1118
  }
2232
- ), /* @__PURE__ */ React23.createElement(
2233
- InjectVariableSelector,
2234
- {
2235
- style: { flexGrow: 1 },
2236
- readonly,
2237
- value: item.value?.content,
2238
- onChange: (v) => updateValue(item.id, { type: "ref", content: v })
1119
+ );
1120
+ return { renderOpSelect, opConfig };
1121
+ }
1122
+
1123
+ // src/components/db-condition-row/hooks/use-left.tsx
1124
+ import { useMemo as useMemo9 } from "react";
1125
+ import React12 from "react";
1126
+ import { useTypeManager as useTypeManager4 } from "@flowgram.ai/json-schema";
1127
+ import { Icon as Icon3 } from "@douyinfe/semi-ui";
1128
+ var defaultRules2 = ConditionRow.defaultRules;
1129
+ function useLeft({ left, options, userRules, readonly, onChange }) {
1130
+ const rules = useMemo9(() => ({ ...defaultRules2, ...userRules || {} }), [userRules]);
1131
+ const typeManager = useTypeManager4();
1132
+ const rule = useMemo9(() => {
1133
+ if (!left) return void 0;
1134
+ const option = options?.find((item) => item.value === left);
1135
+ if (!option?.schema?.type) {
1136
+ return void 0;
2239
1137
  }
2240
- ), /* @__PURE__ */ React23.createElement(
2241
- Button3,
1138
+ return rules[option.schema.type];
1139
+ }, [left, options, rules]);
1140
+ const renderDBOptionSelect = () => /* @__PURE__ */ React12.createElement(
1141
+ UISelect,
2242
1142
  {
2243
1143
  disabled: readonly,
2244
- icon: /* @__PURE__ */ React23.createElement(IconDelete, null),
2245
1144
  size: "small",
2246
- onClick: () => remove(item.id)
1145
+ style: { width: "100%" },
1146
+ value: left,
1147
+ onChange: (v) => onChange(v),
1148
+ optionList: options?.map((item) => ({
1149
+ label: /* @__PURE__ */ React12.createElement(UIOptionLabel, null, /* @__PURE__ */ React12.createElement(Icon3, { size: "small", svg: typeManager.getDisplayIcon(item.schema) }), item.label),
1150
+ value: item.value
1151
+ })) || []
2247
1152
  }
2248
- )))), /* @__PURE__ */ React23.createElement(Button3, { disabled: readonly, icon: /* @__PURE__ */ React23.createElement(IconPlus2, null), size: "small", onClick: () => add() }, I18n12.t("Add")));
2249
- }
2250
-
2251
- // src/components/prompt-editor/index.tsx
2252
- import React24, { useEffect as useEffect6, useRef as useRef5 } from "react";
2253
- import { Renderer, EditorProvider as EditorProvider2, ActiveLinePlaceholder as ActiveLinePlaceholder2 } from "@coze-editor/editor/react";
2254
- import preset2 from "@coze-editor/editor/preset-prompt";
2255
-
2256
- // src/components/prompt-editor/styles.tsx
2257
- import styled7, { css as css3 } from "styled-components";
2258
- var UIContainer4 = styled7.div`
2259
- background-color: var(--semi-color-fill-0);
2260
- padding-left: 10px;
2261
- padding-right: 6px;
2262
-
2263
- ${({ $hasError }) => $hasError && css3`
2264
- border: 1px solid var(--semi-color-danger-6);
2265
- `}
2266
- `;
2267
-
2268
- // src/components/prompt-editor/extensions/markdown.tsx
2269
- import { useLayoutEffect } from "react";
2270
- import { useInjector } from "@coze-editor/editor/react";
2271
- import { astDecorator } from "@coze-editor/editor";
2272
- import { EditorView as EditorView2 } from "@codemirror/view";
2273
- function MarkdownHighlight() {
2274
- const injector = useInjector();
2275
- useLayoutEffect(
2276
- () => injector.inject([
2277
- astDecorator.whole.of((cursor) => {
2278
- if (cursor.name.startsWith("ATXHeading")) {
2279
- return {
2280
- type: "className",
2281
- className: "heading"
2282
- };
2283
- }
2284
- if (cursor.name === "Emphasis") {
2285
- return {
2286
- type: "className",
2287
- className: "emphasis"
2288
- };
2289
- }
2290
- if (cursor.name === "StrongEmphasis") {
2291
- return {
2292
- type: "className",
2293
- className: "strong-emphasis"
2294
- };
2295
- }
2296
- if (cursor.name === "ListMark" || cursor.name === "QuoteMark") {
2297
- return {
2298
- type: "className",
2299
- className: "mark"
2300
- };
2301
- }
2302
- }),
2303
- EditorView2.theme({
2304
- ".heading": {
2305
- color: "#00818C",
2306
- fontWeight: "bold"
2307
- },
2308
- ".emphasis": {
2309
- fontStyle: "italic"
2310
- },
2311
- ".strong-emphasis": {
2312
- fontWeight: "bold"
2313
- },
2314
- ".mark": {
2315
- color: "#4E40E5"
2316
- }
2317
- })
2318
- ]),
2319
- [injector]
2320
- );
2321
- return null;
2322
- }
2323
- var markdown_default = MarkdownHighlight;
2324
-
2325
- // src/components/prompt-editor/extensions/language-support.tsx
2326
- import { useLayoutEffect as useLayoutEffect2 } from "react";
2327
- import { useInjector as useInjector2 } from "@coze-editor/editor/react";
2328
- import { languageSupport } from "@coze-editor/editor/preset-prompt";
2329
- function LanguageSupport() {
2330
- const injector = useInjector2();
2331
- useLayoutEffect2(() => injector.inject([languageSupport]), [injector]);
2332
- return null;
2333
- }
2334
- var language_support_default = LanguageSupport;
2335
-
2336
- // src/components/prompt-editor/extensions/jinja.tsx
2337
- import { useLayoutEffect as useLayoutEffect3 } from "react";
2338
- import { useInjector as useInjector3 } from "@coze-editor/editor/react";
2339
- import { astDecorator as astDecorator2 } from "@coze-editor/editor";
2340
- import { EditorView as EditorView3 } from "@codemirror/view";
2341
- function JinjaHighlight() {
2342
- const injector = useInjector3();
2343
- useLayoutEffect3(
2344
- () => injector.inject([
2345
- astDecorator2.whole.of((cursor) => {
2346
- if (cursor.name === "JinjaStatementStart" || cursor.name === "JinjaStatementEnd") {
2347
- return {
2348
- type: "className",
2349
- className: "jinja-statement-bracket"
2350
- };
2351
- }
2352
- if (cursor.name === "JinjaComment") {
2353
- return {
2354
- type: "className",
2355
- className: "jinja-comment"
2356
- };
2357
- }
2358
- if (cursor.name === "JinjaExpression") {
2359
- return {
2360
- type: "className",
2361
- className: "jinja-expression"
2362
- };
2363
- }
2364
- }),
2365
- EditorView3.theme({
2366
- ".jinja-statement-bracket": {
2367
- color: "#D1009D"
2368
- },
2369
- ".jinja-comment": {
2370
- color: "#0607094D"
2371
- },
2372
- ".jinja-expression": {
2373
- color: "#4E40E5"
2374
- }
2375
- })
2376
- ]),
2377
- [injector]
2378
1153
  );
2379
- return null;
1154
+ return { rule, renderDBOptionSelect };
2380
1155
  }
2381
- var jinja_default = JinjaHighlight;
2382
1156
 
2383
- // src/components/prompt-editor/index.tsx
2384
- function PromptEditor(props) {
2385
- const {
2386
- value,
2387
- onChange,
1157
+ // src/components/db-condition-row/index.tsx
1158
+ var defaultRuleConfig2 = {
1159
+ ops: {},
1160
+ rules: {}
1161
+ };
1162
+ function DBConditionRow({
1163
+ style,
1164
+ value,
1165
+ onChange,
1166
+ readonly,
1167
+ options,
1168
+ ruleConfig = defaultRuleConfig2
1169
+ }) {
1170
+ const { left, operator, right } = value || {};
1171
+ const { rule, renderDBOptionSelect } = useLeft({
1172
+ left,
1173
+ options,
1174
+ onChange: (leftKey) => onChange({ ...value, left: leftKey }),
2388
1175
  readonly,
2389
- placeholder,
2390
- activeLinePlaceholder,
2391
- style,
2392
- hasError,
2393
- children,
2394
- disableMarkdownHighlight,
2395
- options
2396
- } = props || {};
2397
- const editorRef = useRef5(null);
2398
- useEffect6(() => {
2399
- if (editorRef.current?.getValue() !== value?.content) {
2400
- editorRef.current?.setValue(String(value?.content || ""));
2401
- }
2402
- }, [value]);
2403
- return /* @__PURE__ */ React24.createElement(UIContainer4, { $hasError: hasError, style }, /* @__PURE__ */ React24.createElement(EditorProvider2, null, /* @__PURE__ */ React24.createElement(
2404
- Renderer,
1176
+ userRules: ruleConfig.rules
1177
+ });
1178
+ const { renderOpSelect, opConfig } = useOp2({
1179
+ rule,
1180
+ op: operator,
1181
+ onChange: (v) => onChange({ ...value, operator: v }),
1182
+ readonly,
1183
+ userOps: ruleConfig.ops
1184
+ });
1185
+ const targetSchema = useMemo10(() => {
1186
+ const targetType = rule?.[operator || ""] || null;
1187
+ return targetType ? { type: targetType, extra: { weak: true } } : null;
1188
+ }, [rule, opConfig]);
1189
+ return /* @__PURE__ */ React13.createElement(UIContainer4, { style }, /* @__PURE__ */ React13.createElement(UIOperator2, null, renderOpSelect()), /* @__PURE__ */ React13.createElement(UIValues2, null, /* @__PURE__ */ React13.createElement(UILeft2, null, renderDBOptionSelect()), /* @__PURE__ */ React13.createElement(UIRight2, null, targetSchema ? /* @__PURE__ */ React13.createElement(
1190
+ InjectDynamicValueInput,
2405
1191
  {
2406
- didMount: (editor) => {
2407
- editorRef.current = editor;
2408
- },
2409
- plugins: preset2,
2410
- defaultValue: String(value?.content),
2411
- options: {
2412
- readOnly: readonly,
2413
- editable: !readonly,
2414
- placeholder,
2415
- ...options
2416
- },
2417
- onChange: (e) => {
2418
- onChange({ type: "template", content: e.value });
2419
- }
2420
- }
2421
- ), activeLinePlaceholder && /* @__PURE__ */ React24.createElement(ActiveLinePlaceholder2, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ React24.createElement(markdown_default, null), /* @__PURE__ */ React24.createElement(language_support_default, null), /* @__PURE__ */ React24.createElement(jinja_default, null), children));
2422
- }
2423
-
2424
- // src/components/prompt-editor-with-variables/index.tsx
2425
- import React27 from "react";
2426
-
2427
- // src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
2428
- import React25, { useEffect as useEffect7, useState as useState6 } from "react";
2429
- import { Popover as Popover2, Tree } from "@douyinfe/semi-ui";
2430
- import {
2431
- Mention,
2432
- getCurrentMentionReplaceRange,
2433
- useEditor,
2434
- PositionMirror
2435
- } from "@coze-editor/editor/react";
2436
- function VariableTree() {
2437
- const [posKey, setPosKey] = useState6("");
2438
- const [visible, setVisible] = useState6(false);
2439
- const [position, setPosition] = useState6(-1);
2440
- const editor = useEditor();
2441
- function insert(variablePath) {
2442
- const range = getCurrentMentionReplaceRange(editor.$view.state);
2443
- if (!range) {
2444
- return;
2445
- }
2446
- let { from, to } = range;
2447
- while (editor.$view.state.doc.sliceString(from - 1, from) === "{") {
2448
- from--;
2449
- }
2450
- while (editor.$view.state.doc.sliceString(to, to + 1) === "}") {
2451
- to++;
2452
- }
2453
- editor.replaceText({
2454
- from,
2455
- to,
2456
- text: "{{" + variablePath + "}}"
2457
- });
2458
- setVisible(false);
2459
- }
2460
- function handleOpenChange(e) {
2461
- setPosition(e.state.selection.main.head);
2462
- setVisible(e.value);
2463
- }
2464
- useEffect7(() => {
2465
- if (!editor) {
2466
- return;
1192
+ readonly: readonly || !rule,
1193
+ value: right,
1194
+ schema: targetSchema,
1195
+ onChange: (v) => onChange({ ...value, right: v })
2467
1196
  }
2468
- }, [editor, visible]);
2469
- const treeData = useVariableTree({});
2470
- return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React25.createElement(
2471
- Popover2,
1197
+ ) : /* @__PURE__ */ React13.createElement(
1198
+ Input4,
2472
1199
  {
2473
- visible,
2474
- trigger: "custom",
2475
- position: "topLeft",
2476
- rePosKey: posKey,
2477
- content: /* @__PURE__ */ React25.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React25.createElement(
2478
- Tree,
2479
- {
2480
- treeData,
2481
- onSelect: (v) => {
2482
- insert(v);
2483
- }
2484
- }
2485
- ))
2486
- },
2487
- /* @__PURE__ */ React25.createElement(
2488
- PositionMirror,
2489
- {
2490
- position,
2491
- onChange: () => setPosKey(String(Math.random()))
2492
- }
2493
- )
2494
- ));
2495
- }
2496
-
2497
- // src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
2498
- import React26, { useLayoutEffect as useLayoutEffect4 } from "react";
2499
- import { isEqual, last } from "lodash";
2500
- import {
2501
- Disposable,
2502
- DisposableCollection,
2503
- useCurrentScope
2504
- } from "@flowgram.ai/editor";
2505
- import { Popover as Popover3 } from "@douyinfe/semi-ui";
2506
- import { IconIssueStroked as IconIssueStroked2 } from "@douyinfe/semi-icons";
2507
- import { useInjector as useInjector4 } from "@coze-editor/editor/react";
2508
- import {
2509
- Decoration,
2510
- EditorView as EditorView4,
2511
- MatchDecorator,
2512
- ViewPlugin,
2513
- WidgetType
2514
- } from "@codemirror/view";
2515
-
2516
- // src/components/prompt-editor-with-variables/styles.tsx
2517
- import styled8 from "styled-components";
2518
- import { Tag as Tag2 } from "@douyinfe/semi-ui";
2519
- var UIRootTitle2 = styled8.div`
2520
- margin-right: 4px;
2521
- min-width: 20px;
2522
- overflow: hidden;
2523
- text-overflow: ellipsis;
2524
- white-space: nowrap;
2525
- color: var(--semi-color-text-2);
2526
- `;
2527
- var UIVarName2 = styled8.div`
2528
- overflow: hidden;
2529
- text-overflow: ellipsis;
2530
- white-space: nowrap;
2531
- `;
2532
- var UITag2 = styled8(Tag2)`
2533
- display: inline-flex;
2534
- align-items: center;
2535
- justify-content: flex-start;
2536
- max-width: 300px;
2537
-
2538
- & .semi-tag-content-center {
2539
- justify-content: flex-start;
2540
- }
2541
-
2542
- &.semi-tag {
2543
- margin: 0 5px;
2544
- }
2545
- `;
2546
- var UIPopoverContent2 = styled8.div`
2547
- padding: 10px;
2548
- display: inline-flex;
2549
- align-items: center;
2550
- justify-content: flex-start;
2551
- `;
2552
-
2553
- // src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
2554
- var VariableTagWidget = class extends WidgetType {
2555
- constructor({ keyPath, scope }) {
2556
- super();
2557
- this.toDispose = new DisposableCollection();
2558
- this.renderIcon = (icon) => {
2559
- if (typeof icon === "string") {
2560
- return /* @__PURE__ */ React26.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2561
- }
2562
- return icon;
2563
- };
2564
- this.keyPath = keyPath;
2565
- this.scope = scope;
2566
- }
2567
- renderVariable(v) {
2568
- if (!v) {
2569
- this.root.render(
2570
- /* @__PURE__ */ React26.createElement(UITag2, { prefixIcon: /* @__PURE__ */ React26.createElement(IconIssueStroked2, null), color: "amber" }, "Unknown")
2571
- );
2572
- return;
1200
+ size: "small",
1201
+ disabled: true,
1202
+ style: { pointerEvents: "none" },
1203
+ value: opConfig?.rightDisplay || I18n6.t("Empty")
2573
1204
  }
2574
- const rootField = last(v.parentFields);
2575
- const rootTitle = /* @__PURE__ */ React26.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2576
- const rootIcon = this.renderIcon(rootField?.meta.icon);
2577
- this.root.render(
2578
- /* @__PURE__ */ React26.createElement(
2579
- Popover3,
2580
- {
2581
- content: /* @__PURE__ */ React26.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ React26.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
2582
- },
2583
- /* @__PURE__ */ React26.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React26.createElement(UIVarName2, null, v?.key))
2584
- )
2585
- );
2586
- }
2587
- toDOM(view) {
2588
- const dom = document.createElement("span");
2589
- this.root = polyfillCreateRoot(dom);
2590
- this.toDispose.push(
2591
- Disposable.create(() => {
2592
- this.root.unmount();
2593
- })
2594
- );
2595
- this.toDispose.push(
2596
- this.scope.available.trackByKeyPath(
2597
- this.keyPath,
2598
- (v) => {
2599
- this.renderVariable(v);
2600
- },
2601
- { triggerOnInit: false }
2602
- )
2603
- );
2604
- this.renderVariable(this.scope.available.getByKeyPath(this.keyPath));
2605
- return dom;
2606
- }
2607
- eq(other) {
2608
- return isEqual(this.keyPath, other.keyPath);
2609
- }
2610
- ignoreEvent() {
2611
- return false;
2612
- }
2613
- destroy(dom) {
2614
- this.toDispose.dispose();
2615
- }
2616
- };
2617
- function VariableTagInject() {
2618
- const injector = useInjector4();
2619
- const scope = useCurrentScope();
2620
- useLayoutEffect4(() => {
2621
- const atMatcher = new MatchDecorator({
2622
- regexp: /\{\{([^\}\{]+)\}\}/g,
2623
- decoration: (match) => Decoration.replace({
2624
- widget: new VariableTagWidget({
2625
- keyPath: match[1]?.split(".") ?? [],
2626
- scope
2627
- })
2628
- })
2629
- });
2630
- return injector.inject([
2631
- ViewPlugin.fromClass(
2632
- class {
2633
- constructor(view) {
2634
- this.view = view;
2635
- this.decorations = atMatcher.createDeco(view);
2636
- }
2637
- update() {
2638
- this.decorations = atMatcher.createDeco(this.view);
2639
- }
2640
- },
2641
- {
2642
- decorations: (p) => p.decorations,
2643
- provide(p) {
2644
- return EditorView4.atomicRanges.of(
2645
- (view) => view.plugin(p)?.decorations ?? Decoration.none
2646
- );
2647
- }
2648
- }
2649
- )
2650
- ]);
2651
- }, [injector]);
2652
- return null;
2653
- }
2654
-
2655
- // src/components/prompt-editor-with-variables/index.tsx
2656
- function PromptEditorWithVariables(props) {
2657
- return /* @__PURE__ */ React27.createElement(PromptEditor, { ...props }, /* @__PURE__ */ React27.createElement(VariableTree, null), /* @__PURE__ */ React27.createElement(VariableTagInject, null));
1205
+ ))));
2658
1206
  }
2659
1207
 
2660
- // src/components/prompt-editor-with-inputs/index.tsx
2661
- import React30 from "react";
2662
-
2663
- // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2664
- import React29, { useEffect as useEffect8, useState as useState7 } from "react";
2665
- import { Popover as Popover4 } from "@douyinfe/semi-ui";
2666
- import {
2667
- Mention as Mention2,
2668
- getCurrentMentionReplaceRange as getCurrentMentionReplaceRange2,
2669
- useEditor as useEditor2,
2670
- PositionMirror as PositionMirror2
2671
- } from "@coze-editor/editor/react";
1208
+ // src/components/batch-outputs/index.tsx
1209
+ import React14 from "react";
1210
+ import { I18n as I18n7 } from "@flowgram.ai/editor";
1211
+ import { Button as Button4, Input as Input5 } from "@douyinfe/semi-ui";
1212
+ import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
2672
1213
 
2673
- // src/components/prompt-editor-with-inputs/inputs-picker.tsx
2674
- import React28, { useMemo as useMemo9 } from "react";
2675
- import { isPlainObject as isPlainObject2, last as last2 } from "lodash";
2676
- import {
2677
- ASTMatch as ASTMatch3,
2678
- useScopeAvailable as useScopeAvailable3
2679
- } from "@flowgram.ai/editor";
2680
- import { Tree as Tree2 } from "@douyinfe/semi-ui";
2681
- function InputsPicker({
2682
- inputsValues,
2683
- onSelect
1214
+ // src/hooks/use-object-list/index.tsx
1215
+ import { useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
1216
+ import { nanoid } from "nanoid";
1217
+ import { difference as difference2, get, isObject, set } from "lodash-es";
1218
+ function genId2() {
1219
+ return nanoid();
1220
+ }
1221
+ function useObjectList({
1222
+ value,
1223
+ onChange,
1224
+ sortIndexKey
2684
1225
  }) {
2685
- const available = useScopeAvailable3();
2686
- const getArrayDrilldown = (type, depth = 1) => {
2687
- if (ASTMatch3.isArray(type.items)) {
2688
- return getArrayDrilldown(type.items, depth + 1);
2689
- }
2690
- return { type: type.items, depth };
2691
- };
2692
- const renderVariable = (variable, keyPath) => {
2693
- let type = variable?.type;
2694
- let children;
2695
- if (ASTMatch3.isObject(type)) {
2696
- children = (type.properties || []).map((_property) => renderVariable(_property, [...keyPath, _property.key])).filter(Boolean);
2697
- }
2698
- if (ASTMatch3.isArray(type)) {
2699
- const drilldown = getArrayDrilldown(type);
2700
- if (ASTMatch3.isObject(drilldown.type)) {
2701
- children = (drilldown.type.properties || []).map(
2702
- (_property) => renderVariable(_property, [
2703
- ...keyPath,
2704
- ...new Array(drilldown.depth).fill("[0]"),
2705
- _property.key
2706
- ])
2707
- ).filter(Boolean);
2708
- }
2709
- }
2710
- const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
2711
- return {
2712
- key,
2713
- label: last2(keyPath),
2714
- value: key,
2715
- children
2716
- };
2717
- };
2718
- const getTreeData = (value, keyPath) => {
2719
- const currKey = keyPath.join(".");
2720
- if (FlowValueUtils.isFlowValue(value)) {
2721
- if (FlowValueUtils.isRef(value)) {
2722
- const variable = available.getByKeyPath(value.content || []);
2723
- if (variable) {
2724
- return renderVariable(variable, keyPath);
2725
- }
2726
- }
2727
- return {
2728
- key: currKey,
2729
- value: currKey,
2730
- label: last2(keyPath)
2731
- };
2732
- }
2733
- if (isPlainObject2(value)) {
2734
- return {
2735
- key: currKey,
2736
- value: currKey,
2737
- label: last2(keyPath),
2738
- children: Object.entries(value).map(([key, value2]) => getTreeData(value2, [...keyPath, key])).filter(Boolean)
2739
- };
1226
+ const [list, setList] = useState5([]);
1227
+ const effectVersion = useRef3(0);
1228
+ const changeVersion = useRef3(0);
1229
+ const getSortIndex = (value2) => {
1230
+ if (typeof sortIndexKey === "function") {
1231
+ return get(value2, sortIndexKey(value2)) || 0;
2740
1232
  }
1233
+ return get(value2, sortIndexKey || "") || 0;
2741
1234
  };
2742
- const treeData = useMemo9(
2743
- () => Object.entries(inputsValues).map(([key, value]) => getTreeData(value, [key])).filter(Boolean),
2744
- []
2745
- );
2746
- return /* @__PURE__ */ React28.createElement(Tree2, { treeData, onSelect: (v) => onSelect(v) });
2747
- }
2748
-
2749
- // src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
2750
- function InputsTree({ inputsValues }) {
2751
- const [posKey, setPosKey] = useState7("");
2752
- const [visible, setVisible] = useState7(false);
2753
- const [position, setPosition] = useState7(-1);
2754
- const editor = useEditor2();
2755
- function insert(variablePath) {
2756
- const range = getCurrentMentionReplaceRange2(editor.$view.state);
2757
- if (!range) {
1235
+ useEffect4(() => {
1236
+ effectVersion.current = effectVersion.current + 1;
1237
+ if (effectVersion.current === changeVersion.current) {
2758
1238
  return;
2759
1239
  }
2760
- let { from, to } = range;
2761
- while (editor.$view.state.doc.sliceString(from - 1, from) === "{") {
2762
- from--;
2763
- }
2764
- while (editor.$view.state.doc.sliceString(to, to + 1) === "}") {
2765
- to++;
2766
- }
2767
- editor.replaceText({
2768
- ...range,
2769
- text: "{{" + variablePath + "}}"
1240
+ effectVersion.current = changeVersion.current;
1241
+ setList((_prevList) => {
1242
+ const newKeys = Object.entries(value || {}).sort((a, b) => getSortIndex(a[1]) - getSortIndex(b[1])).map(([key]) => key);
1243
+ const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
1244
+ const addKeys = difference2(newKeys, oldKeys);
1245
+ return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
1246
+ id: item.id,
1247
+ key: item.key,
1248
+ value: item.key ? value?.[item.key] : item.value
1249
+ })).concat(
1250
+ addKeys.map((_key) => ({
1251
+ id: genId2(),
1252
+ key: _key,
1253
+ value: value?.[_key]
1254
+ }))
1255
+ );
2770
1256
  });
2771
- setVisible(false);
2772
- }
2773
- function handleOpenChange(e) {
2774
- setPosition(e.state.selection.main.head);
2775
- setVisible(e.value);
2776
- }
2777
- useEffect8(() => {
2778
- if (!editor) {
2779
- return;
2780
- }
2781
- }, [editor, visible]);
2782
- return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Mention2, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React29.createElement(
2783
- Popover4,
2784
- {
2785
- visible,
2786
- trigger: "custom",
2787
- position: "topLeft",
2788
- rePosKey: posKey,
2789
- content: /* @__PURE__ */ React29.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React29.createElement(
2790
- InputsPicker,
2791
- {
2792
- inputsValues,
2793
- onSelect: (v) => {
2794
- insert(v);
2795
- }
2796
- }
2797
- ))
2798
- },
2799
- /* @__PURE__ */ React29.createElement(
2800
- PositionMirror2,
1257
+ }, [value]);
1258
+ const add = (defaultValue) => {
1259
+ setList((prevList) => [
1260
+ ...prevList,
2801
1261
  {
2802
- position,
2803
- onChange: () => setPosKey(String(Math.random()))
1262
+ id: genId2(),
1263
+ value: defaultValue
2804
1264
  }
2805
- )
2806
- ));
2807
- }
2808
-
2809
- // src/components/prompt-editor-with-inputs/index.tsx
2810
- function PromptEditorWithInputs({ inputsValues, ...restProps }) {
2811
- return /* @__PURE__ */ React30.createElement(PromptEditor, { ...restProps }, /* @__PURE__ */ React30.createElement(InputsTree, { inputsValues }));
2812
- }
2813
-
2814
- // src/components/json-editor-with-variables/index.tsx
2815
- import React33 from "react";
2816
- import { transformerCreator } from "@coze-editor/editor/preset-code";
2817
-
2818
- // src/components/json-editor-with-variables/extensions/variable-tree.tsx
2819
- import React31, { useEffect as useEffect9, useState as useState8 } from "react";
2820
- import { Popover as Popover5, Tree as Tree3 } from "@douyinfe/semi-ui";
2821
- import {
2822
- Mention as Mention3,
2823
- getCurrentMentionReplaceRange as getCurrentMentionReplaceRange3,
2824
- useEditor as useEditor3,
2825
- PositionMirror as PositionMirror3
2826
- } from "@coze-editor/editor/react";
2827
- function VariableTree2() {
2828
- const [posKey, setPosKey] = useState8("");
2829
- const [visible, setVisible] = useState8(false);
2830
- const [position, setPosition] = useState8(-1);
2831
- const editor = useEditor3();
2832
- function insert(variablePath) {
2833
- const range = getCurrentMentionReplaceRange3(editor.$view.state);
2834
- if (!range) {
2835
- return;
2836
- }
2837
- editor.replaceText({
2838
- ...range,
2839
- text: "{{" + variablePath + "}}"
1265
+ ]);
1266
+ };
1267
+ const updateValue = (itemId, value2) => {
1268
+ changeVersion.current = changeVersion.current + 1;
1269
+ setList((prevList) => {
1270
+ const nextList = prevList.map((_item) => {
1271
+ if (_item.id === itemId) {
1272
+ return {
1273
+ ..._item,
1274
+ value: value2
1275
+ };
1276
+ }
1277
+ return _item;
1278
+ });
1279
+ onChange(
1280
+ Object.fromEntries(
1281
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
1282
+ const indexKey = typeof sortIndexKey === "function" ? sortIndexKey(_res[1]) : sortIndexKey;
1283
+ if (isObject(_res[1]) && indexKey) {
1284
+ set(_res[1], indexKey, idx);
1285
+ }
1286
+ return _res;
1287
+ })
1288
+ )
1289
+ );
1290
+ return nextList;
2840
1291
  });
2841
- setVisible(false);
2842
- }
2843
- function handleOpenChange(e) {
2844
- setPosition(e.state.selection.main.head);
2845
- setVisible(e.value);
2846
- }
2847
- useEffect9(() => {
2848
- if (!editor) {
2849
- return;
2850
- }
2851
- }, [editor, visible]);
2852
- const treeData = useVariableTree({});
2853
- return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(Mention3, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ React31.createElement(
2854
- Popover5,
2855
- {
2856
- visible,
2857
- trigger: "custom",
2858
- position: "topLeft",
2859
- rePosKey: posKey,
2860
- content: /* @__PURE__ */ React31.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ React31.createElement(
2861
- Tree3,
2862
- {
2863
- treeData,
2864
- onSelect: (v) => {
2865
- insert(v);
2866
- }
1292
+ };
1293
+ const updateKey = (itemId, key) => {
1294
+ changeVersion.current = changeVersion.current + 1;
1295
+ setList((prevList) => {
1296
+ const nextList = prevList.map((_item) => {
1297
+ if (_item.id === itemId) {
1298
+ return {
1299
+ ..._item,
1300
+ key
1301
+ };
2867
1302
  }
2868
- ))
2869
- },
2870
- /* @__PURE__ */ React31.createElement(
2871
- PositionMirror3,
2872
- {
2873
- position,
2874
- onChange: () => setPosKey(String(Math.random()))
2875
- }
2876
- )
2877
- ));
1303
+ return _item;
1304
+ });
1305
+ onChange(
1306
+ Object.fromEntries(
1307
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value])
1308
+ )
1309
+ );
1310
+ return nextList;
1311
+ });
1312
+ };
1313
+ const remove = (itemId) => {
1314
+ changeVersion.current = changeVersion.current + 1;
1315
+ setList((prevList) => {
1316
+ const nextList = prevList.filter((_item) => _item.id !== itemId);
1317
+ onChange(
1318
+ Object.fromEntries(
1319
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value])
1320
+ )
1321
+ );
1322
+ return nextList;
1323
+ });
1324
+ };
1325
+ return { list, add, updateKey, updateValue, remove };
2878
1326
  }
2879
1327
 
2880
- // src/components/json-editor-with-variables/extensions/variable-tag.tsx
2881
- import React32, { useLayoutEffect as useLayoutEffect5 } from "react";
2882
- import { isEqual as isEqual2, last as last3 } from "lodash";
2883
- import {
2884
- Disposable as Disposable2,
2885
- DisposableCollection as DisposableCollection2,
2886
- useCurrentScope as useCurrentScope2
2887
- } from "@flowgram.ai/editor";
2888
- import { Popover as Popover6 } from "@douyinfe/semi-ui";
2889
- import { IconIssueStroked as IconIssueStroked3 } from "@douyinfe/semi-icons";
2890
- import { useInjector as useInjector5 } from "@coze-editor/editor/react";
2891
- import {
2892
- Decoration as Decoration2,
2893
- EditorView as EditorView5,
2894
- MatchDecorator as MatchDecorator2,
2895
- ViewPlugin as ViewPlugin2,
2896
- WidgetType as WidgetType2
2897
- } from "@codemirror/view";
2898
-
2899
- // src/components/json-editor-with-variables/styles.tsx
2900
- import styled9 from "styled-components";
2901
- import { Tag as Tag3 } from "@douyinfe/semi-ui";
2902
- var UIRootTitle3 = styled9.div`
2903
- margin-right: 4px;
2904
- min-width: 20px;
2905
- overflow: hidden;
2906
- text-overflow: ellipsis;
2907
- white-space: nowrap;
2908
- color: var(--semi-color-text-2);
2909
- `;
2910
- var UIVarName3 = styled9.div`
2911
- overflow: hidden;
2912
- text-overflow: ellipsis;
2913
- white-space: nowrap;
2914
- `;
2915
- var UITag3 = styled9(Tag3)`
2916
- display: inline-flex;
2917
- align-items: center;
2918
- justify-content: flex-start;
2919
- max-width: 300px;
2920
-
2921
- & .semi-tag-content-center {
2922
- justify-content: flex-start;
2923
- }
2924
-
2925
- &.semi-tag {
2926
- margin: 0 5px;
2927
- }
1328
+ // src/components/batch-outputs/styles.tsx
1329
+ import styled5 from "styled-components";
1330
+ var UIRows = styled5.div`
1331
+ display: flex;
1332
+ flex-direction: column;
1333
+ gap: 10px;
1334
+ margin-bottom: 10px;
2928
1335
  `;
2929
- var UIPopoverContent3 = styled9.div`
2930
- padding: 10px;
2931
- display: inline-flex;
1336
+ var UIRow2 = styled5.div`
1337
+ display: flex;
2932
1338
  align-items: center;
2933
- justify-content: flex-start;
1339
+ gap: 5px;
2934
1340
  `;
2935
1341
 
2936
- // src/components/json-editor-with-variables/extensions/variable-tag.tsx
2937
- var VariableTagWidget2 = class extends WidgetType2 {
2938
- constructor({ keyPath, scope }) {
2939
- super();
2940
- this.toDispose = new DisposableCollection2();
2941
- this.renderIcon = (icon) => {
2942
- if (typeof icon === "string") {
2943
- return /* @__PURE__ */ React32.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
2944
- }
2945
- return icon;
2946
- };
2947
- this.keyPath = keyPath;
2948
- this.scope = scope;
2949
- }
2950
- renderVariable(v) {
2951
- if (!v) {
2952
- this.root.render(
2953
- /* @__PURE__ */ React32.createElement(UITag3, { prefixIcon: /* @__PURE__ */ React32.createElement(IconIssueStroked3, null), color: "amber" }, "Unknown")
2954
- );
2955
- return;
1342
+ // src/components/batch-outputs/index.tsx
1343
+ function BatchOutputs(props) {
1344
+ const { readonly, style } = props;
1345
+ const { list, add, updateKey, updateValue, remove } = useObjectList(props);
1346
+ return /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React14.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React14.createElement(
1347
+ Input5,
1348
+ {
1349
+ style: { width: 100 },
1350
+ disabled: readonly,
1351
+ size: "small",
1352
+ value: item.key,
1353
+ onChange: (v) => updateKey(item.id, v)
2956
1354
  }
2957
- const rootField = last3(v.parentFields);
2958
- const rootTitle = /* @__PURE__ */ React32.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
2959
- const rootIcon = this.renderIcon(rootField?.meta.icon);
2960
- this.root.render(
2961
- /* @__PURE__ */ React32.createElement(
2962
- Popover6,
2963
- {
2964
- content: /* @__PURE__ */ React32.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ React32.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
2965
- },
2966
- /* @__PURE__ */ React32.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ React32.createElement(UIVarName3, null, v?.key))
2967
- )
2968
- );
2969
- }
2970
- toDOM(view) {
2971
- const dom = document.createElement("span");
2972
- this.root = polyfillCreateRoot(dom);
2973
- this.toDispose.push(
2974
- Disposable2.create(() => {
2975
- this.root.unmount();
2976
- })
2977
- );
2978
- this.toDispose.push(
2979
- this.scope.available.trackByKeyPath(
2980
- this.keyPath,
2981
- (v) => {
2982
- this.renderVariable(v);
2983
- },
2984
- { triggerOnInit: false }
2985
- )
2986
- );
2987
- this.renderVariable(this.scope.available.getByKeyPath(this.keyPath));
2988
- return dom;
2989
- }
2990
- eq(other) {
2991
- return isEqual2(this.keyPath, other.keyPath);
2992
- }
2993
- ignoreEvent() {
2994
- return false;
2995
- }
2996
- destroy(dom) {
2997
- this.toDispose.dispose();
2998
- }
2999
- };
3000
- function VariableTagInject2() {
3001
- const injector = useInjector5();
3002
- const scope = useCurrentScope2();
3003
- useLayoutEffect5(() => {
3004
- const atMatcher = new MatchDecorator2({
3005
- regexp: /\{\{([^\}\{]+)\}\}/g,
3006
- decoration: (match) => Decoration2.replace({
3007
- widget: new VariableTagWidget2({
3008
- keyPath: match[1]?.split(".") ?? [],
3009
- scope
3010
- })
3011
- })
3012
- });
3013
- return injector.inject([
3014
- ViewPlugin2.fromClass(
3015
- class {
3016
- constructor(view) {
3017
- this.view = view;
3018
- this.decorations = atMatcher.createDeco(view);
3019
- }
3020
- update() {
3021
- this.decorations = atMatcher.createDeco(this.view);
3022
- }
3023
- },
3024
- {
3025
- decorations: (p) => p.decorations,
3026
- provide(p) {
3027
- return EditorView5.atomicRanges.of(
3028
- (view) => view.plugin(p)?.decorations ?? Decoration2.none
3029
- );
3030
- }
3031
- }
3032
- )
3033
- ]);
3034
- }, [injector]);
3035
- return null;
3036
- }
3037
-
3038
- // src/components/json-editor-with-variables/index.tsx
3039
- import { I18n as I18n13 } from "@flowgram.ai/editor";
3040
- function findAllMatches(inputString, regex) {
3041
- const globalRegex = new RegExp(
3042
- regex,
3043
- regex.flags.includes("g") ? regex.flags : regex.flags + "g"
3044
- );
3045
- let match;
3046
- const matches = [];
3047
- while ((match = globalRegex.exec(inputString)) !== null) {
3048
- if (match.index === globalRegex.lastIndex) {
3049
- globalRegex.lastIndex++;
1355
+ ), /* @__PURE__ */ React14.createElement(
1356
+ InjectVariableSelector,
1357
+ {
1358
+ style: { flexGrow: 1 },
1359
+ readonly,
1360
+ value: item.value?.content,
1361
+ onChange: (v) => updateValue(item.id, { type: "ref", content: v })
3050
1362
  }
3051
- matches.push({
3052
- match: match[0],
3053
- range: [match.index, match.index + match[0].length]
3054
- });
3055
- }
3056
- return matches;
3057
- }
3058
- var transformer = transformerCreator((text) => {
3059
- const originalSource = text.toString();
3060
- const matches = findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
3061
- if (matches.length > 0) {
3062
- matches.forEach(({ range }) => {
3063
- text.replaceRange(range[0], range[1], "null");
3064
- });
3065
- }
3066
- return text;
3067
- });
3068
- function JsonEditorWithVariables(props) {
3069
- return /* @__PURE__ */ React33.createElement(
3070
- CodeEditor,
1363
+ ), /* @__PURE__ */ React14.createElement(
1364
+ Button4,
3071
1365
  {
3072
- languageId: "json",
3073
- activeLinePlaceholder: I18n13.t("Press '@' to Select variable"),
3074
- ...props,
3075
- options: {
3076
- transformer,
3077
- ...props.options || {}
3078
- }
3079
- },
3080
- /* @__PURE__ */ React33.createElement(VariableTree2, null),
3081
- /* @__PURE__ */ React33.createElement(VariableTagInject2, null)
3082
- );
1366
+ disabled: readonly,
1367
+ icon: /* @__PURE__ */ React14.createElement(IconDelete, null),
1368
+ size: "small",
1369
+ onClick: () => remove(item.id)
1370
+ }
1371
+ )))), /* @__PURE__ */ React14.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React14.createElement(IconPlus2, null), size: "small", onClick: () => add() }, I18n7.t("Add")));
3083
1372
  }
3084
1373
 
1374
+ // src/components/prompt-editor-with-variables/index.tsx
1375
+ var PromptEditorWithVariables = lazySuspense(
1376
+ () => import("./editor-G63XGWH2.js").then((module) => ({ default: module.PromptEditorWithVariables }))
1377
+ );
1378
+
1379
+ // src/components/prompt-editor-with-inputs/index.tsx
1380
+ var PromptEditorWithInputs = lazySuspense(
1381
+ () => import("./editor-OXPGKPF5.js").then((module) => ({ default: module.PromptEditorWithInputs }))
1382
+ );
1383
+
1384
+ // src/components/json-editor-with-variables/index.tsx
1385
+ var JsonEditorWithVariables = lazySuspense(
1386
+ () => import("./editor-2YHACGQ2.js").then((module) => ({ default: module.JsonEditorWithVariables }))
1387
+ );
1388
+
3085
1389
  // src/components/inputs-values/index.tsx
3086
- import React34 from "react";
3087
- import { I18n as I18n14 } from "@flowgram.ai/editor";
3088
- import { Button as Button4, IconButton as IconButton4 } from "@douyinfe/semi-ui";
1390
+ import React15 from "react";
1391
+ import { I18n as I18n8 } from "@flowgram.ai/editor";
1392
+ import { Button as Button5, IconButton as IconButton4 } from "@douyinfe/semi-ui";
3089
1393
  import { IconDelete as IconDelete2, IconPlus as IconPlus3 } from "@douyinfe/semi-icons";
3090
1394
 
3091
1395
  // src/components/inputs-values/styles.tsx
3092
- import styled10 from "styled-components";
3093
- var UIRows2 = styled10.div`
1396
+ import styled6 from "styled-components";
1397
+ var UIRows2 = styled6.div`
3094
1398
  display: flex;
3095
1399
  flex-direction: column;
3096
1400
  gap: 10px;
3097
1401
  margin-bottom: 10px;
3098
1402
  `;
3099
- var UIRow3 = styled10.div`
1403
+ var UIRow3 = styled6.div`
3100
1404
  display: flex;
3101
1405
  align-items: flex-start;
3102
1406
  gap: 5px;
@@ -3117,7 +1421,7 @@ function InputsValues({
3117
1421
  onChange,
3118
1422
  sortIndexKey: "extra.index"
3119
1423
  });
3120
- return /* @__PURE__ */ React34.createElement("div", null, /* @__PURE__ */ React34.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React34.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React34.createElement(
1424
+ return /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React15.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React15.createElement(
3121
1425
  BlurInput,
3122
1426
  {
3123
1427
  style: { width: 100, minWidth: 100, maxWidth: 100 },
@@ -3125,9 +1429,9 @@ function InputsValues({
3125
1429
  size: "small",
3126
1430
  value: item.key,
3127
1431
  onChange: (v) => updateKey(item.id, v),
3128
- placeholder: I18n14.t("Input Key")
1432
+ placeholder: I18n8.t("Input Key")
3129
1433
  }
3130
- ), /* @__PURE__ */ React34.createElement(
1434
+ ), /* @__PURE__ */ React15.createElement(
3131
1435
  InjectDynamicValueInput,
3132
1436
  {
3133
1437
  style: { flexGrow: 1 },
@@ -3141,20 +1445,20 @@ function InputsValues({
3141
1445
  strategies: [...constantProps?.strategies || []]
3142
1446
  }
3143
1447
  }
3144
- ), /* @__PURE__ */ React34.createElement(
1448
+ ), /* @__PURE__ */ React15.createElement(
3145
1449
  IconButton4,
3146
1450
  {
3147
1451
  disabled: readonly,
3148
1452
  theme: "borderless",
3149
- icon: /* @__PURE__ */ React34.createElement(IconDelete2, { size: "small" }),
1453
+ icon: /* @__PURE__ */ React15.createElement(IconDelete2, { size: "small" }),
3150
1454
  size: "small",
3151
1455
  onClick: () => remove(item.id)
3152
1456
  }
3153
- )))), /* @__PURE__ */ React34.createElement(
3154
- Button4,
1457
+ )))), /* @__PURE__ */ React15.createElement(
1458
+ Button5,
3155
1459
  {
3156
1460
  disabled: readonly,
3157
- icon: /* @__PURE__ */ React34.createElement(IconPlus3, null),
1461
+ icon: /* @__PURE__ */ React15.createElement(IconPlus3, null),
3158
1462
  size: "small",
3159
1463
  onClick: () => add({
3160
1464
  type: "constant",
@@ -3162,16 +1466,16 @@ function InputsValues({
3162
1466
  schema: { type: "string" }
3163
1467
  })
3164
1468
  },
3165
- I18n14.t("Add")
1469
+ I18n8.t("Add")
3166
1470
  ));
3167
1471
  }
3168
1472
 
3169
1473
  // src/components/display-schema-tree/index.tsx
3170
- import React35 from "react";
1474
+ import React16 from "react";
3171
1475
 
3172
1476
  // src/components/display-schema-tree/styles.tsx
3173
- import styled11, { css as css4 } from "styled-components";
3174
- var TreeRow = styled11.div`
1477
+ import styled7, { css as css2 } from "styled-components";
1478
+ var TreeRow = styled7.div`
3175
1479
  display: flex;
3176
1480
  align-items: center;
3177
1481
 
@@ -3184,7 +1488,7 @@ var TreeRow = styled11.div`
3184
1488
  height: 27px;
3185
1489
  white-space: nowrap;
3186
1490
  `;
3187
- var HorizontalLine = styled11.div`
1491
+ var HorizontalLine = styled7.div`
3188
1492
  position: relative;
3189
1493
 
3190
1494
  &::before,
@@ -3201,11 +1505,11 @@ var HorizontalLine = styled11.div`
3201
1505
  height: 1px;
3202
1506
  }
3203
1507
  `;
3204
- var TreeTitle = styled11.div`
1508
+ var TreeTitle = styled7.div`
3205
1509
  // overflow: hidden;
3206
1510
  // text-overflow: ellipsis;
3207
1511
  `;
3208
- var TreeLevel = styled11.div`
1512
+ var TreeLevel = styled7.div`
3209
1513
  padding-left: 30px;
3210
1514
  position: relative;
3211
1515
 
@@ -3219,7 +1523,7 @@ var TreeLevel = styled11.div`
3219
1523
  width: 1px;
3220
1524
  } */
3221
1525
  `;
3222
- var TreeItem = styled11.div`
1526
+ var TreeItem = styled7.div`
3223
1527
  position: relative;
3224
1528
 
3225
1529
  &::before {
@@ -3242,7 +1546,7 @@ var TreeItem = styled11.div`
3242
1546
  left: -22px;
3243
1547
  }
3244
1548
 
3245
- ${(props) => props.depth === 0 && css4`
1549
+ ${(props) => props.depth === 0 && css2`
3246
1550
  &::before {
3247
1551
  width: 0px !important;
3248
1552
  }
@@ -3251,7 +1555,7 @@ var TreeItem = styled11.div`
3251
1555
 
3252
1556
  // src/components/display-schema-tree/index.tsx
3253
1557
  function DisplaySchemaTree(props) {
3254
- return /* @__PURE__ */ React35.createElement(SchemaTree, { ...props });
1558
+ return /* @__PURE__ */ React16.createElement(SchemaTree, { ...props });
3255
1559
  }
3256
1560
  function SchemaTree(props) {
3257
1561
  const {
@@ -3267,27 +1571,27 @@ function SchemaTree(props) {
3267
1571
  const icon = typeManager?.getDisplayIcon(schema);
3268
1572
  let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
3269
1573
  const childEntries = Object.entries(properties || {});
3270
- 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, {
1574
+ return /* @__PURE__ */ React16.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ React16.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ React16.createElement(HorizontalLine, null), showIcon && icon && React16.cloneElement(icon, {
3271
1575
  className: "tree-icon"
3272
- }), /* @__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);
1576
+ }), /* @__PURE__ */ React16.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ React16.createElement(React16.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ React16.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ React16.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
3273
1577
  }
3274
1578
 
3275
1579
  // src/components/display-outputs/index.tsx
3276
- import React37, { useEffect as useEffect10 } from "react";
3277
- import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
3278
- import { useCurrentScope as useCurrentScope3, useRefresh } from "@flowgram.ai/editor";
1580
+ import React18, { useEffect as useEffect5 } from "react";
1581
+ import { JsonSchemaUtils as JsonSchemaUtils4 } from "@flowgram.ai/json-schema";
1582
+ import { useCurrentScope, useRefresh } from "@flowgram.ai/editor";
3279
1583
 
3280
1584
  // src/components/display-schema-tag/index.tsx
3281
- import React36 from "react";
3282
- import { Popover as Popover7 } from "@douyinfe/semi-ui";
1585
+ import React17 from "react";
1586
+ import { Popover } from "@douyinfe/semi-ui";
3283
1587
 
3284
1588
  // src/components/display-schema-tag/styles.ts
3285
- import styled12 from "styled-components";
3286
- import { Tag as Tag4 } from "@douyinfe/semi-ui";
3287
- var PopoverContent = styled12.div`
1589
+ import styled8 from "styled-components";
1590
+ import { Tag } from "@douyinfe/semi-ui";
1591
+ var PopoverContent = styled8.div`
3288
1592
  padding: 10px;
3289
1593
  `;
3290
- var StyledTag = styled12(Tag4)`
1594
+ var StyledTag = styled8(Tag)`
3291
1595
  padding: 4px;
3292
1596
 
3293
1597
  .tag-icon {
@@ -3295,7 +1599,7 @@ var StyledTag = styled12(Tag4)`
3295
1599
  height: 12px;
3296
1600
  }
3297
1601
  `;
3298
- var TitleSpan = styled12.span`
1602
+ var TitleSpan = styled8.span`
3299
1603
  display: inline-block;
3300
1604
  margin-left: 4px;
3301
1605
  margin-top: -1px;
@@ -3307,20 +1611,20 @@ var TitleSpan = styled12.span`
3307
1611
  function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
3308
1612
  const typeManager = useTypeManager();
3309
1613
  const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
3310
- return /* @__PURE__ */ React36.createElement(
3311
- Popover7,
1614
+ return /* @__PURE__ */ React17.createElement(
1615
+ Popover,
3312
1616
  {
3313
- content: /* @__PURE__ */ React36.createElement(PopoverContent, null, /* @__PURE__ */ React36.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
1617
+ content: /* @__PURE__ */ React17.createElement(PopoverContent, null, /* @__PURE__ */ React17.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
3314
1618
  },
3315
- /* @__PURE__ */ React36.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React36.cloneElement(icon, {
1619
+ /* @__PURE__ */ React17.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React17.cloneElement(icon, {
3316
1620
  className: "tag-icon"
3317
- }), title && /* @__PURE__ */ React36.createElement(TitleSpan, null, title))
1621
+ }), title && /* @__PURE__ */ React17.createElement(TitleSpan, null, title))
3318
1622
  );
3319
1623
  }
3320
1624
 
3321
1625
  // src/components/display-outputs/styles.ts
3322
- import styled13 from "styled-components";
3323
- var DisplayOutputsWrapper = styled13.div`
1626
+ import styled9 from "styled-components";
1627
+ var DisplayOutputsWrapper = styled9.div`
3324
1628
  display: flex;
3325
1629
  gap: 5px;
3326
1630
  flex-wrap: wrap;
@@ -3328,9 +1632,9 @@ var DisplayOutputsWrapper = styled13.div`
3328
1632
 
3329
1633
  // src/components/display-outputs/index.tsx
3330
1634
  function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3331
- const scope = useCurrentScope3();
1635
+ const scope = useCurrentScope();
3332
1636
  const refresh = useRefresh();
3333
- useEffect10(() => {
1637
+ useEffect5(() => {
3334
1638
  if (!displayFromScope) {
3335
1639
  return () => null;
3336
1640
  }
@@ -3344,12 +1648,12 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3344
1648
  const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
3345
1649
  acm = {
3346
1650
  ...acm,
3347
- ...JsonSchemaUtils6.astToSchema(curr.type)?.properties || {}
1651
+ ...JsonSchemaUtils4.astToSchema(curr.type)?.properties || {}
3348
1652
  };
3349
1653
  return acm;
3350
1654
  }, {}) : value?.properties || {};
3351
1655
  const childEntries = Object.entries(properties || {});
3352
- return /* @__PURE__ */ React37.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React37.createElement(
1656
+ return /* @__PURE__ */ React18.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React18.createElement(
3353
1657
  DisplaySchemaTag,
3354
1658
  {
3355
1659
  key,
@@ -3362,15 +1666,15 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3362
1666
  }
3363
1667
 
3364
1668
  // src/components/display-flow-value/index.tsx
3365
- import React38, { useMemo as useMemo10 } from "react";
3366
- import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
3367
- import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
1669
+ import React19, { useMemo as useMemo11 } from "react";
1670
+ import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
1671
+ import { useScopeAvailable as useScopeAvailable3 } from "@flowgram.ai/editor";
3368
1672
  function DisplayFlowValue({ value, title, showIconInTree }) {
3369
- const available = useScopeAvailable4();
1673
+ const available = useScopeAvailable3();
3370
1674
  const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
3371
- const schema = useMemo10(() => {
1675
+ const schema = useMemo11(() => {
3372
1676
  if (value?.type === "ref") {
3373
- return JsonSchemaUtils7.astToSchema(variable?.type);
1677
+ return JsonSchemaUtils5.astToSchema(variable?.type);
3374
1678
  }
3375
1679
  if (value?.type === "template") {
3376
1680
  return { type: "string" };
@@ -3380,7 +1684,7 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3380
1684
  }
3381
1685
  return { type: "unknown" };
3382
1686
  }, [value, variable?.hash]);
3383
- return /* @__PURE__ */ React38.createElement(
1687
+ return /* @__PURE__ */ React19.createElement(
3384
1688
  DisplaySchemaTag,
3385
1689
  {
3386
1690
  title,
@@ -3392,13 +1696,13 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3392
1696
  }
3393
1697
 
3394
1698
  // src/components/display-inputs-values/index.tsx
3395
- import React39, { useMemo as useMemo11 } from "react";
3396
- import { isPlainObject as isPlainObject3 } from "lodash";
3397
- import { useScopeAvailable as useScopeAvailable5 } from "@flowgram.ai/editor";
1699
+ import React20, { useMemo as useMemo12 } from "react";
1700
+ import { isPlainObject } from "lodash-es";
1701
+ import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
3398
1702
 
3399
1703
  // src/components/display-inputs-values/styles.ts
3400
- import styled14 from "styled-components";
3401
- var DisplayInputsWrapper = styled14.div`
1704
+ import styled10 from "styled-components";
1705
+ var DisplayInputsWrapper = styled10.div`
3402
1706
  display: flex;
3403
1707
  gap: 5px;
3404
1708
  flex-wrap: wrap;
@@ -3407,12 +1711,12 @@ var DisplayInputsWrapper = styled14.div`
3407
1711
  // src/components/display-inputs-values/index.tsx
3408
1712
  function DisplayInputsValues({ value, showIconInTree }) {
3409
1713
  const childEntries = Object.entries(value || {});
3410
- return /* @__PURE__ */ React39.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
1714
+ return /* @__PURE__ */ React20.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
3411
1715
  if (FlowValueUtils.isFlowValue(value2)) {
3412
- return /* @__PURE__ */ React39.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
1716
+ return /* @__PURE__ */ React20.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
3413
1717
  }
3414
- if (isPlainObject3(value2)) {
3415
- return /* @__PURE__ */ React39.createElement(
1718
+ if (isPlainObject(value2)) {
1719
+ return /* @__PURE__ */ React20.createElement(
3416
1720
  DisplayInputsValueAllInTag,
3417
1721
  {
3418
1722
  key,
@@ -3430,34 +1734,34 @@ function DisplayInputsValueAllInTag({
3430
1734
  title,
3431
1735
  showIconInTree
3432
1736
  }) {
3433
- const available = useScopeAvailable5();
3434
- const schema = useMemo11(
1737
+ const available = useScopeAvailable4();
1738
+ const schema = useMemo12(
3435
1739
  () => FlowValueUtils.inferJsonSchema(value, available.scope),
3436
1740
  [available.version, value]
3437
1741
  );
3438
- return /* @__PURE__ */ React39.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
1742
+ return /* @__PURE__ */ React20.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
3439
1743
  }
3440
1744
 
3441
1745
  // src/components/assign-rows/index.tsx
3442
- import React42 from "react";
1746
+ import React23 from "react";
3443
1747
  import { FieldArray } from "@flowgram.ai/editor";
3444
- import { Button as Button5 } from "@douyinfe/semi-ui";
1748
+ import { Button as Button6 } from "@douyinfe/semi-ui";
3445
1749
  import { IconPlus as IconPlus4 } from "@douyinfe/semi-icons";
3446
1750
 
3447
1751
  // src/components/assign-row/index.tsx
3448
- import React41 from "react";
1752
+ import React22 from "react";
3449
1753
  import { IconButton as IconButton5 } from "@douyinfe/semi-ui";
3450
1754
  import { IconMinus as IconMinus2 } from "@douyinfe/semi-icons";
3451
1755
 
3452
1756
  // src/components/assign-row/components/blur-input.tsx
3453
- import React40, { useEffect as useEffect11, useState as useState9 } from "react";
1757
+ import React21, { useEffect as useEffect6, useState as useState6 } from "react";
3454
1758
  import Input6 from "@douyinfe/semi-ui/lib/es/input";
3455
1759
  function BlurInput2(props) {
3456
- const [value, setValue] = useState9("");
3457
- useEffect11(() => {
1760
+ const [value, setValue] = useState6("");
1761
+ useEffect6(() => {
3458
1762
  setValue(props.value);
3459
1763
  }, [props.value]);
3460
- return /* @__PURE__ */ React40.createElement(
1764
+ return /* @__PURE__ */ React21.createElement(
3461
1765
  Input6,
3462
1766
  {
3463
1767
  ...props,
@@ -3480,7 +1784,7 @@ function AssignRow(props) {
3480
1784
  onDelete,
3481
1785
  readonly
3482
1786
  } = props;
3483
- return /* @__PURE__ */ React41.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ React41.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ React41.createElement(
1787
+ return /* @__PURE__ */ React22.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ React22.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ React22.createElement(
3484
1788
  InjectVariableSelector,
3485
1789
  {
3486
1790
  style: { width: "100%", height: 26 },
@@ -3491,7 +1795,7 @@ function AssignRow(props) {
3491
1795
  left: { type: "ref", content: v }
3492
1796
  })
3493
1797
  }
3494
- ) : /* @__PURE__ */ React41.createElement(
1798
+ ) : /* @__PURE__ */ React22.createElement(
3495
1799
  BlurInput2,
3496
1800
  {
3497
1801
  style: { height: 26 },
@@ -3503,7 +1807,7 @@ function AssignRow(props) {
3503
1807
  left: v
3504
1808
  })
3505
1809
  }
3506
- )), /* @__PURE__ */ React41.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ React41.createElement(
1810
+ )), /* @__PURE__ */ React22.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ React22.createElement(
3507
1811
  InjectDynamicValueInput,
3508
1812
  {
3509
1813
  readonly,
@@ -3513,12 +1817,12 @@ function AssignRow(props) {
3513
1817
  right: v
3514
1818
  })
3515
1819
  }
3516
- )), onDelete && /* @__PURE__ */ React41.createElement("div", null, /* @__PURE__ */ React41.createElement(
1820
+ )), onDelete && /* @__PURE__ */ React22.createElement("div", null, /* @__PURE__ */ React22.createElement(
3517
1821
  IconButton5,
3518
1822
  {
3519
1823
  size: "small",
3520
1824
  theme: "borderless",
3521
- icon: /* @__PURE__ */ React41.createElement(IconMinus2, null),
1825
+ icon: /* @__PURE__ */ React22.createElement(IconMinus2, null),
3522
1826
  onClick: () => onDelete?.()
3523
1827
  }
3524
1828
  )));
@@ -3527,7 +1831,7 @@ function AssignRow(props) {
3527
1831
  // src/components/assign-rows/index.tsx
3528
1832
  function AssignRows(props) {
3529
1833
  const { name, readonly } = props;
3530
- return /* @__PURE__ */ React42.createElement(FieldArray, { name }, ({ field }) => /* @__PURE__ */ React42.createElement(React42.Fragment, null, field.map((childField, index) => /* @__PURE__ */ React42.createElement(
1834
+ return /* @__PURE__ */ React23.createElement(FieldArray, { name }, ({ field }) => /* @__PURE__ */ React23.createElement(React23.Fragment, null, field.map((childField, index) => /* @__PURE__ */ React23.createElement(
3531
1835
  AssignRow,
3532
1836
  {
3533
1837
  key: childField.key,
@@ -3538,21 +1842,21 @@ function AssignRows(props) {
3538
1842
  },
3539
1843
  onDelete: () => field.remove(index)
3540
1844
  }
3541
- )), /* @__PURE__ */ React42.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ React42.createElement(
3542
- Button5,
1845
+ )), /* @__PURE__ */ React23.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ React23.createElement(
1846
+ Button6,
3543
1847
  {
3544
1848
  size: "small",
3545
1849
  theme: "borderless",
3546
- icon: /* @__PURE__ */ React42.createElement(IconPlus4, null),
1850
+ icon: /* @__PURE__ */ React23.createElement(IconPlus4, null),
3547
1851
  onClick: () => field.append({ operator: "assign" })
3548
1852
  },
3549
1853
  "Assign"
3550
- ), /* @__PURE__ */ React42.createElement(
3551
- Button5,
1854
+ ), /* @__PURE__ */ React23.createElement(
1855
+ Button6,
3552
1856
  {
3553
1857
  size: "small",
3554
1858
  theme: "borderless",
3555
- icon: /* @__PURE__ */ React42.createElement(IconPlus4, null),
1859
+ icon: /* @__PURE__ */ React23.createElement(IconPlus4, null),
3556
1860
  onClick: () => field.append({ operator: "declare" })
3557
1861
  },
3558
1862
  "Declaration"
@@ -3560,35 +1864,35 @@ function AssignRows(props) {
3560
1864
  }
3561
1865
 
3562
1866
  // src/components/inputs-values-tree/index.tsx
3563
- import React45 from "react";
3564
- import { I18n as I18n16 } from "@flowgram.ai/editor";
3565
- import { Button as Button6 } from "@douyinfe/semi-ui";
1867
+ import React26 from "react";
1868
+ import { I18n as I18n10 } from "@flowgram.ai/editor";
1869
+ import { Button as Button7 } from "@douyinfe/semi-ui";
3566
1870
  import { IconPlus as IconPlus5 } from "@douyinfe/semi-icons";
3567
1871
 
3568
1872
  // src/components/inputs-values-tree/styles.tsx
3569
- import React43 from "react";
3570
- import styled15, { css as css5 } from "styled-components";
1873
+ import React24 from "react";
1874
+ import styled11, { css as css3 } from "styled-components";
3571
1875
  import Icon4 from "@douyinfe/semi-icons";
3572
- var UIContainer5 = styled15.div``;
3573
- var UIRow4 = styled15.div`
1876
+ var UIContainer5 = styled11.div``;
1877
+ var UIRow4 = styled11.div`
3574
1878
  display: flex;
3575
1879
  align-items: flex-start;
3576
1880
  gap: 5px;
3577
1881
  `;
3578
- var UICollapseTrigger2 = styled15.div`
1882
+ var UICollapseTrigger2 = styled11.div`
3579
1883
  cursor: pointer;
3580
1884
  margin-right: 5px;
3581
1885
  `;
3582
- var UITreeItems2 = styled15.div`
1886
+ var UITreeItems2 = styled11.div`
3583
1887
  display: grid;
3584
1888
  grid-template-columns: auto 1fr;
3585
1889
 
3586
- ${({ $shrink }) => $shrink && css5`
1890
+ ${({ $shrink }) => $shrink && css3`
3587
1891
  padding-left: 3px;
3588
1892
  margin-top: 10px;
3589
1893
  `}
3590
1894
  `;
3591
- var UITreeItemLeft2 = styled15.div`
1895
+ var UITreeItemLeft2 = styled11.div`
3592
1896
  grid-column: 1;
3593
1897
  position: relative;
3594
1898
  width: 16px;
@@ -3596,7 +1900,7 @@ var UITreeItemLeft2 = styled15.div`
3596
1900
  ${({ $showLine, $isLast, $showCollapse }) => {
3597
1901
  let height = $isLast ? "24px" : "100%";
3598
1902
  let width = $showCollapse ? "12px" : "30px";
3599
- return $showLine && css5`
1903
+ return $showLine && css3`
3600
1904
  &::before {
3601
1905
  /* 竖线 */
3602
1906
  content: '';
@@ -3623,7 +1927,7 @@ var UITreeItemLeft2 = styled15.div`
3623
1927
  `;
3624
1928
  }}
3625
1929
  `;
3626
- var UITreeItemRight2 = styled15.div`
1930
+ var UITreeItemRight2 = styled11.div`
3627
1931
  grid-column: 2;
3628
1932
  margin-bottom: 10px;
3629
1933
 
@@ -3631,23 +1935,23 @@ var UITreeItemRight2 = styled15.div`
3631
1935
  margin-bottom: 0px;
3632
1936
  }
3633
1937
  `;
3634
- var UITreeItemMain2 = styled15.div`
1938
+ var UITreeItemMain2 = styled11.div`
3635
1939
  display: flex;
3636
1940
  flex-direction: column;
3637
1941
  gap: 10px;
3638
1942
  position: relative;
3639
1943
  `;
3640
- var UICollapsible2 = styled15.div`
1944
+ var UICollapsible2 = styled11.div`
3641
1945
  display: none;
3642
1946
 
3643
- ${({ $collapse }) => $collapse && css5`
1947
+ ${({ $collapse }) => $collapse && css3`
3644
1948
  display: block;
3645
1949
  `}
3646
1950
  `;
3647
- var UIActions2 = styled15.div`
1951
+ var UIActions2 = styled11.div`
3648
1952
  white-space: nowrap;
3649
1953
  `;
3650
- var iconAddChildrenSvg2 = /* @__PURE__ */ React43.createElement(
1954
+ var iconAddChildrenSvg2 = /* @__PURE__ */ React24.createElement(
3651
1955
  "svg",
3652
1956
  {
3653
1957
  className: "icon-icon icon-icon-coz_add_node ",
@@ -3657,7 +1961,7 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ React43.createElement(
3657
1961
  fill: "currentColor",
3658
1962
  xmlns: "http://www.w3.org/2000/svg"
3659
1963
  },
3660
- /* @__PURE__ */ React43.createElement(
1964
+ /* @__PURE__ */ React24.createElement(
3661
1965
  "path",
3662
1966
  {
3663
1967
  fillRule: "evenodd",
@@ -3665,22 +1969,22 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ React43.createElement(
3665
1969
  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"
3666
1970
  }
3667
1971
  ),
3668
- /* @__PURE__ */ React43.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" })
1972
+ /* @__PURE__ */ React24.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" })
3669
1973
  );
3670
- var IconAddChildren2 = () => /* @__PURE__ */ React43.createElement(Icon4, { size: "small", svg: iconAddChildrenSvg2 });
1974
+ var IconAddChildren2 = () => /* @__PURE__ */ React24.createElement(Icon4, { size: "small", svg: iconAddChildrenSvg2 });
3671
1975
 
3672
1976
  // src/components/inputs-values-tree/row.tsx
3673
- import React44, { useMemo as useMemo13, useState as useState10 } from "react";
3674
- import { I18n as I18n15 } from "@flowgram.ai/editor";
1977
+ import React25, { useMemo as useMemo14, useState as useState7 } from "react";
1978
+ import { I18n as I18n9 } from "@flowgram.ai/editor";
3675
1979
  import { IconButton as IconButton6, Input as Input7 } from "@douyinfe/semi-ui";
3676
1980
  import { IconChevronDown as IconChevronDown2, IconChevronRight as IconChevronRight2, IconDelete as IconDelete3 } from "@douyinfe/semi-icons";
3677
1981
 
3678
1982
  // src/components/inputs-values-tree/hooks/use-child-list.tsx
3679
- import { useMemo as useMemo12 } from "react";
3680
- import { isPlainObject as isPlainObject4 } from "lodash";
1983
+ import { useMemo as useMemo13 } from "react";
1984
+ import { isPlainObject as isPlainObject2 } from "lodash-es";
3681
1985
  function useChildList(value, onChange) {
3682
- const canAddField = useMemo12(() => {
3683
- if (!isPlainObject4(value)) {
1986
+ const canAddField = useMemo13(() => {
1987
+ if (!isPlainObject2(value)) {
3684
1988
  return false;
3685
1989
  }
3686
1990
  if (FlowValueUtils.isFlowValue(value)) {
@@ -3688,8 +1992,8 @@ function useChildList(value, onChange) {
3688
1992
  }
3689
1993
  return true;
3690
1994
  }, [value]);
3691
- const objectListValue = useMemo12(() => {
3692
- if (isPlainObject4(value)) {
1995
+ const objectListValue = useMemo13(() => {
1996
+ if (isPlainObject2(value)) {
3693
1997
  if (FlowValueUtils.isFlowValue(value)) {
3694
1998
  return void 0;
3695
1999
  }
@@ -3704,7 +2008,7 @@ function useChildList(value, onChange) {
3704
2008
  },
3705
2009
  sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
3706
2010
  });
3707
- const hasChildren = useMemo12(
2011
+ const hasChildren = useMemo13(
3708
2012
  () => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
3709
2013
  [canAddField, list.length, Object.keys(objectListValue || {}).length]
3710
2014
  );
@@ -3722,13 +2026,13 @@ function useChildList(value, onChange) {
3722
2026
  // src/components/inputs-values-tree/row.tsx
3723
2027
  var AddObjectChildStrategy = {
3724
2028
  hit: (schema) => schema.type === "object",
3725
- Renderer: () => /* @__PURE__ */ React44.createElement(
2029
+ Renderer: () => /* @__PURE__ */ React25.createElement(
3726
2030
  Input7,
3727
2031
  {
3728
2032
  size: "small",
3729
2033
  disabled: true,
3730
2034
  style: { pointerEvents: "none" },
3731
- value: I18n15.t("Configure via child fields")
2035
+ value: I18n9.t("Configure via child fields")
3732
2036
  }
3733
2037
  )
3734
2038
  };
@@ -3745,23 +2049,23 @@ function InputValueRow(props) {
3745
2049
  hasError,
3746
2050
  readonly
3747
2051
  } = props;
3748
- const [collapse, setCollapse] = useState10(false);
2052
+ const [collapse, setCollapse] = useState7(false);
3749
2053
  const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
3750
2054
  value,
3751
2055
  onUpdateValue
3752
2056
  );
3753
- const strategies = useMemo13(
2057
+ const strategies = useMemo14(
3754
2058
  () => [...hasChildren ? [AddObjectChildStrategy] : [], ...constantProps?.strategies || []],
3755
2059
  [hasChildren, constantProps?.strategies]
3756
2060
  );
3757
- const flowDisplayValue = useMemo13(
2061
+ const flowDisplayValue = useMemo14(
3758
2062
  () => hasChildren ? {
3759
2063
  type: "constant",
3760
2064
  schema: { type: "object" }
3761
2065
  } : value,
3762
2066
  [hasChildren, value]
3763
2067
  );
3764
- return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(UITreeItemLeft2, { $isLast, $showLine: $level > 0, $showCollapse: hasChildren }, hasChildren && /* @__PURE__ */ React44.createElement(UICollapseTrigger2, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React44.createElement(IconChevronDown2, { size: "small" }) : /* @__PURE__ */ React44.createElement(IconChevronRight2, { size: "small" }))), /* @__PURE__ */ React44.createElement(UITreeItemRight2, null, /* @__PURE__ */ React44.createElement(UITreeItemMain2, null, /* @__PURE__ */ React44.createElement(UIRow4, null, /* @__PURE__ */ React44.createElement(
2068
+ return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(UITreeItemLeft2, { $isLast, $showLine: $level > 0, $showCollapse: hasChildren }, hasChildren && /* @__PURE__ */ React25.createElement(UICollapseTrigger2, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React25.createElement(IconChevronDown2, { size: "small" }) : /* @__PURE__ */ React25.createElement(IconChevronRight2, { size: "small" }))), /* @__PURE__ */ React25.createElement(UITreeItemRight2, null, /* @__PURE__ */ React25.createElement(UITreeItemMain2, null, /* @__PURE__ */ React25.createElement(UIRow4, null, /* @__PURE__ */ React25.createElement(
3765
2069
  BlurInput,
3766
2070
  {
3767
2071
  style: { width: 100, minWidth: 100, maxWidth: 100 },
@@ -3769,9 +2073,9 @@ function InputValueRow(props) {
3769
2073
  size: "small",
3770
2074
  value: keyName,
3771
2075
  onChange: (v) => onUpdateKey?.(v),
3772
- placeholder: I18n15.t("Input Key")
2076
+ placeholder: I18n9.t("Input Key")
3773
2077
  }
3774
- ), /* @__PURE__ */ React44.createElement(
2078
+ ), /* @__PURE__ */ React25.createElement(
3775
2079
  InjectDynamicValueInput,
3776
2080
  {
3777
2081
  style: { flexGrow: 1 },
@@ -3784,13 +2088,13 @@ function InputValueRow(props) {
3784
2088
  strategies
3785
2089
  }
3786
2090
  }
3787
- ), /* @__PURE__ */ React44.createElement(UIActions2, null, canAddField && /* @__PURE__ */ React44.createElement(
2091
+ ), /* @__PURE__ */ React25.createElement(UIActions2, null, canAddField && /* @__PURE__ */ React25.createElement(
3788
2092
  IconButton6,
3789
2093
  {
3790
2094
  disabled: readonly,
3791
2095
  size: "small",
3792
2096
  theme: "borderless",
3793
- icon: /* @__PURE__ */ React44.createElement(IconAddChildren2, null),
2097
+ icon: /* @__PURE__ */ React25.createElement(IconAddChildren2, null),
3794
2098
  onClick: () => {
3795
2099
  add({
3796
2100
  type: "constant",
@@ -3800,16 +2104,16 @@ function InputValueRow(props) {
3800
2104
  setCollapse(true);
3801
2105
  }
3802
2106
  }
3803
- ), /* @__PURE__ */ React44.createElement(
2107
+ ), /* @__PURE__ */ React25.createElement(
3804
2108
  IconButton6,
3805
2109
  {
3806
2110
  disabled: readonly,
3807
2111
  theme: "borderless",
3808
- icon: /* @__PURE__ */ React44.createElement(IconDelete3, { size: "small" }),
2112
+ icon: /* @__PURE__ */ React25.createElement(IconDelete3, { size: "small" }),
3809
2113
  size: "small",
3810
2114
  onClick: () => onRemove?.()
3811
2115
  }
3812
- )))), hasChildren && /* @__PURE__ */ React44.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ React44.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ React44.createElement(
2116
+ )))), hasChildren && /* @__PURE__ */ React25.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ React25.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ React25.createElement(
3813
2117
  InputValueRow,
3814
2118
  {
3815
2119
  readonly,
@@ -3841,7 +2145,7 @@ function InputsValuesTree(props) {
3841
2145
  onChange,
3842
2146
  sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
3843
2147
  });
3844
- return /* @__PURE__ */ React45.createElement("div", null, /* @__PURE__ */ React45.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ React45.createElement(
2148
+ return /* @__PURE__ */ React26.createElement("div", null, /* @__PURE__ */ React26.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ React26.createElement(
3845
2149
  InputValueRow,
3846
2150
  {
3847
2151
  key: item.id,
@@ -3854,12 +2158,12 @@ function InputsValuesTree(props) {
3854
2158
  hasError,
3855
2159
  constantProps
3856
2160
  }
3857
- ))), /* @__PURE__ */ React45.createElement(
3858
- Button6,
2161
+ ))), /* @__PURE__ */ React26.createElement(
2162
+ Button7,
3859
2163
  {
3860
2164
  style: { marginTop: 10, marginLeft: 16 },
3861
2165
  disabled: readonly,
3862
- icon: /* @__PURE__ */ React45.createElement(IconPlus5, null),
2166
+ icon: /* @__PURE__ */ React26.createElement(IconPlus5, null),
3863
2167
  size: "small",
3864
2168
  onClick: () => {
3865
2169
  add({
@@ -3869,7 +2173,7 @@ function InputsValuesTree(props) {
3869
2173
  });
3870
2174
  }
3871
2175
  },
3872
- I18n16.t("Add")
2176
+ I18n10.t("Add")
3873
2177
  ));
3874
2178
  }
3875
2179
 
@@ -3975,7 +2279,7 @@ function traverseRef(name, value, cb) {
3975
2279
  }
3976
2280
 
3977
2281
  // src/effects/provide-json-schema-outputs/index.ts
3978
- import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
2282
+ import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
3979
2283
  import {
3980
2284
  ASTFactory as ASTFactory2,
3981
2285
  createEffectFromVariableProvider as createEffectFromVariableProvider2,
@@ -3989,7 +2293,7 @@ var provideJsonSchemaOutputs = createEffectFromVariableProvider2({
3989
2293
  title: getNodeForm2(ctx.node)?.getValueIn("title") || ctx.node.id,
3990
2294
  icon: ctx.node.getNodeRegistry().info?.icon
3991
2295
  },
3992
- type: JsonSchemaUtils8.schemaToAST(value)
2296
+ type: JsonSchemaUtils6.schemaToAST(value)
3993
2297
  })
3994
2298
  ]
3995
2299
  });
@@ -4017,7 +2321,7 @@ var syncVariableTitle = [
4017
2321
  ];
4018
2322
 
4019
2323
  // src/effects/validate-when-variable-sync/index.ts
4020
- import { isEmpty } from "lodash";
2324
+ import { isEmpty } from "lodash-es";
4021
2325
  import {
4022
2326
  DataEvent as DataEvent3,
4023
2327
  getNodeScope,
@@ -4067,7 +2371,7 @@ var listenRefValueChange = (cb) => [
4067
2371
  ];
4068
2372
 
4069
2373
  // src/effects/listen-ref-schema-change/index.ts
4070
- import { JsonSchemaUtils as JsonSchemaUtils9 } from "@flowgram.ai/json-schema";
2374
+ import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
4071
2375
  import {
4072
2376
  DataEvent as DataEvent5,
4073
2377
  getNodeScope as getNodeScope3
@@ -4083,7 +2387,7 @@ var listenRefSchemaChange = (cb) => [
4083
2387
  const disposable = getNodeScope3(context.node).available.trackByKeyPath(
4084
2388
  value?.content || [],
4085
2389
  (_type) => {
4086
- cb({ ...params, schema: JsonSchemaUtils9.astToSchema(_type) });
2390
+ cb({ ...params, schema: JsonSchemaUtils7.astToSchema(_type) });
4087
2391
  },
4088
2392
  {
4089
2393
  selector: (_v) => _v?.type
@@ -4172,7 +2476,7 @@ var createBatchOutputsFormPlugin = defineFormPluginCreator({
4172
2476
  });
4173
2477
 
4174
2478
  // src/form-plugins/infer-inputs-plugin/index.ts
4175
- import { get as get2, set as set2 } from "lodash";
2479
+ import { get as get2, set as set2 } from "lodash-es";
4176
2480
  import { defineFormPluginCreator as defineFormPluginCreator2, getNodePrivateScope as getNodePrivateScope3, getNodeScope as getNodeScope5 } from "@flowgram.ai/editor";
4177
2481
  var createInferInputsPlugin = defineFormPluginCreator2({
4178
2482
  onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
@@ -4194,8 +2498,8 @@ var createInferInputsPlugin = defineFormPluginCreator2({
4194
2498
  });
4195
2499
 
4196
2500
  // src/form-plugins/infer-assign-plugin/index.ts
4197
- import { set as set3, uniqBy } from "lodash";
4198
- import { JsonSchemaUtils as JsonSchemaUtils10 } from "@flowgram.ai/json-schema";
2501
+ import { set as set3, uniqBy } from "lodash-es";
2502
+ import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
4199
2503
  import {
4200
2504
  ASTFactory as ASTFactory4,
4201
2505
  createEffectFromVariableProvider as createEffectFromVariableProvider4,
@@ -4226,7 +2530,7 @@ var createInferAssignPlugin = defineFormPluginCreator3({
4226
2530
  properties: declareRows.map(
4227
2531
  (_v) => ASTFactory4.createProperty({
4228
2532
  key: _v.left,
4229
- type: _v.right?.type === "constant" ? JsonSchemaUtils10.schemaToAST(_v.right?.schema || {}) : void 0,
2533
+ type: _v.right?.type === "constant" ? JsonSchemaUtils8.schemaToAST(_v.right?.schema || {}) : void 0,
4230
2534
  initializer: _v.right?.type === "ref" ? ASTFactory4.createKeyPathExpression({
4231
2535
  keyPath: _v.right?.content || []
4232
2536
  }) : {}
@@ -4242,7 +2546,7 @@ var createInferAssignPlugin = defineFormPluginCreator3({
4242
2546
  set3(
4243
2547
  formData,
4244
2548
  outputKey,
4245
- JsonSchemaUtils10.astToSchema(getNodeScope6(ctx.node).output.variables?.[0]?.type)
2549
+ JsonSchemaUtils8.astToSchema(getNodeScope6(ctx.node).output.variables?.[0]?.type)
4246
2550
  );
4247
2551
  return formData;
4248
2552
  });
@@ -4250,7 +2554,7 @@ var createInferAssignPlugin = defineFormPluginCreator3({
4250
2554
  });
4251
2555
 
4252
2556
  // src/validate/validate-flow-value/index.tsx
4253
- import { isNil } from "lodash";
2557
+ import { isNil } from "lodash-es";
4254
2558
  import { FeedbackLevel, getNodeScope as getNodeScope7 } from "@flowgram.ai/editor";
4255
2559
  function validateFlowValue(value, ctx) {
4256
2560
  const { node, required, errorMessages } = ctx;
@@ -4297,6 +2601,7 @@ export {
4297
2601
  CodeEditorMini,
4298
2602
  ConditionRow,
4299
2603
  ConstantInput,
2604
+ DBConditionRow,
4300
2605
  DisplayFlowValue,
4301
2606
  DisplayInputsValueAllInTag,
4302
2607
  DisplayInputsValues,
@@ -4313,7 +2618,7 @@ export {
4313
2618
  JsonEditorWithVariables,
4314
2619
  JsonSchemaEditor,
4315
2620
  JsonSchemaTypePresetProvider,
4316
- JsonSchemaUtils2 as JsonSchemaUtils,
2621
+ JsonSchemaUtils,
4317
2622
  PromptEditor,
4318
2623
  PromptEditorWithInputs,
4319
2624
  PromptEditorWithVariables,
@@ -4333,6 +2638,7 @@ export {
4333
2638
  getTypeSelectValue,
4334
2639
  isLegacyFlowRefValueSchema,
4335
2640
  isNewFlowRefValueSchema,
2641
+ lazySuspense,
4336
2642
  listenRefSchemaChange,
4337
2643
  listenRefValueChange,
4338
2644
  parseTypeSelectValue,
@@ -4346,6 +2652,7 @@ export {
4346
2652
  useTypeManager,
4347
2653
  useVariableTree,
4348
2654
  validateFlowValue,
4349
- validateWhenVariableSync
2655
+ validateWhenVariableSync,
2656
+ withSuspense
4350
2657
  };
4351
2658
  //# sourceMappingURL=index.js.map