@flowgram.ai/form-materials 0.4.5 → 0.4.6

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 (41) hide show
  1. package/dist/esm/chunk-6OZSB6PD.js +10 -0
  2. package/dist/esm/chunk-6OZSB6PD.js.map +1 -0
  3. package/dist/esm/chunk-G4HQ7OSI.js +440 -0
  4. package/dist/esm/chunk-G4HQ7OSI.js.map +1 -0
  5. package/dist/esm/chunk-QIJ4QVB2.js +271 -0
  6. package/dist/esm/chunk-QIJ4QVB2.js.map +1 -0
  7. package/dist/esm/editor-6UMULJYB.js +180 -0
  8. package/dist/esm/editor-6UMULJYB.js.map +1 -0
  9. package/dist/esm/editor-E2BQTPCD.js +388 -0
  10. package/dist/esm/editor-E2BQTPCD.js.map +1 -0
  11. package/dist/esm/editor-H2R7JJLO.js +282 -0
  12. package/dist/esm/editor-H2R7JJLO.js.map +1 -0
  13. package/dist/esm/editor-JX42GFAZ.js +249 -0
  14. package/dist/esm/editor-JX42GFAZ.js.map +1 -0
  15. package/dist/esm/editor-YMNCDGUR.js +167 -0
  16. package/dist/esm/editor-YMNCDGUR.js.map +1 -0
  17. package/dist/esm/index.js +599 -2293
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/index.d.mts +133 -51
  20. package/dist/index.d.ts +133 -51
  21. package/dist/index.js +3499 -2802
  22. package/dist/index.js.map +1 -1
  23. package/package.json +6 -6
  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/index.ts +1 -0
  34. package/src/components/json-editor-with-variables/editor.tsx +69 -0
  35. package/src/components/json-editor-with-variables/index.tsx +5 -60
  36. package/src/components/prompt-editor/editor.tsx +81 -0
  37. package/src/components/prompt-editor/index.tsx +5 -69
  38. package/src/components/prompt-editor-with-inputs/editor.tsx +25 -0
  39. package/src/components/prompt-editor-with-inputs/index.tsx +5 -15
  40. package/src/components/prompt-editor-with-variables/editor.tsx +22 -0
  41. package/src/components/prompt-editor-with-variables/index.tsx +5 -13
package/dist/esm/index.js CHANGED
@@ -1,1072 +1,34 @@
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";
2
+ PromptEditor
3
+ } from "./chunk-6OZSB6PD.js";
318
4
  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
827
- 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-G4HQ7OSI.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
+ polyfillCreateRoot,
26
+ unstableSetCreateRoot
27
+ } from "./chunk-QIJ4QVB2.js";
1066
28
 
1067
29
  // 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";
30
+ import React, { useMemo } from "react";
31
+ import { Cascader, Icon, IconButton } from "@douyinfe/semi-ui";
1070
32
  var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
1071
33
  var getTypeSelectValue = (value) => {
1072
34
  if (value?.type === "array" && value?.items) {
@@ -1083,18 +45,18 @@ var parseTypeSelectValue = (value) => {
1083
45
  };
1084
46
  function TypeSelector(props) {
1085
47
  const { value, onChange, readonly, disabled, style } = props;
1086
- const selectValue = useMemo2(() => getTypeSelectValue(value), [value]);
48
+ const selectValue = useMemo(() => getTypeSelectValue(value), [value]);
1087
49
  const typeManager = useTypeManager();
1088
50
  const icon = typeManager.getDisplayIcon(value || {});
1089
- const options = useMemo2(
51
+ const options = useMemo(
1090
52
  () => typeManager.getTypeRegistriesWithParentType().map((_type) => {
1091
- const isArray2 = _type.type === "array";
53
+ const isArray = _type.type === "array";
1092
54
  return {
1093
- label: /* @__PURE__ */ React13.createElement("div", { style: labelStyle }, /* @__PURE__ */ React13.createElement(Icon2, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
55
+ label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
1094
56
  value: _type.type,
1095
- children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
1096
- label: /* @__PURE__ */ React13.createElement("div", { style: labelStyle }, /* @__PURE__ */ React13.createElement(
1097
- Icon2,
57
+ children: isArray ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
58
+ label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(
59
+ Icon,
1098
60
  {
1099
61
  size: "small",
1100
62
  svg: typeManager.getDisplayIcon({
@@ -1110,12 +72,12 @@ function TypeSelector(props) {
1110
72
  []
1111
73
  );
1112
74
  const isDisabled = readonly || disabled;
1113
- return /* @__PURE__ */ React13.createElement(
75
+ return /* @__PURE__ */ React.createElement(
1114
76
  Cascader,
1115
77
  {
1116
78
  disabled: isDisabled,
1117
79
  size: "small",
1118
- triggerRender: () => /* @__PURE__ */ React13.createElement(
80
+ triggerRender: () => /* @__PURE__ */ React.createElement(
1119
81
  IconButton,
1120
82
  {
1121
83
  size: "small",
@@ -1140,8 +102,8 @@ TypeSelector.renderKey = "type-selector-render-key";
1140
102
  var InjectTypeSelector = createInjectMaterial(TypeSelector);
1141
103
 
1142
104
  // 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";
105
+ import React6, { useMemo as useMemo3, useState as useState3 } from "react";
106
+ import { I18n as I18n2 } from "@flowgram.ai/editor";
1145
107
  import { Button, Checkbox, IconButton as IconButton2 } from "@douyinfe/semi-ui";
1146
108
  import {
1147
109
  IconExpand,
@@ -1153,15 +115,15 @@ import {
1153
115
  } from "@douyinfe/semi-icons";
1154
116
 
1155
117
  // 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";
118
+ import React2, { useEffect, useState } from "react";
119
+ import Input from "@douyinfe/semi-ui/lib/es/input";
1158
120
  function BlurInput(props) {
1159
121
  const [value, setValue] = useState("");
1160
- useEffect2(() => {
122
+ useEffect(() => {
1161
123
  setValue(props.value);
1162
124
  }, [props.value]);
1163
- return /* @__PURE__ */ React14.createElement(
1164
- Input2,
125
+ return /* @__PURE__ */ React2.createElement(
126
+ Input,
1165
127
  {
1166
128
  ...props,
1167
129
  value,
@@ -1174,45 +136,45 @@ function BlurInput(props) {
1174
136
  }
1175
137
 
1176
138
  // 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`
139
+ import React3 from "react";
140
+ import styled, { css } from "styled-components";
141
+ import Icon2 from "@douyinfe/semi-icons";
142
+ var UIContainer = styled.div`
1181
143
  /* & .semi-input {
1182
144
  background-color: #fff;
1183
145
  border-radius: 6px;
1184
146
  height: 24px;
1185
147
  } */
1186
148
  `;
1187
- var UIRow = styled3.div`
149
+ var UIRow = styled.div`
1188
150
  display: flex;
1189
151
  align-items: center;
1190
152
  gap: 6px;
1191
153
  `;
1192
- var UICollapseTrigger = styled3.div`
154
+ var UICollapseTrigger = styled.div`
1193
155
  cursor: pointer;
1194
156
  margin-right: 5px;
1195
157
  `;
1196
- var UIExpandDetail = styled3.div`
158
+ var UIExpandDetail = styled.div`
1197
159
  display: flex;
1198
160
  flex-direction: column;
1199
161
  `;
1200
- var UILabel = styled3.div`
162
+ var UILabel = styled.div`
1201
163
  font-size: 12px;
1202
164
  color: #999;
1203
165
  font-weight: 400;
1204
166
  margin-bottom: 2px;
1205
167
  `;
1206
- var UITreeItems = styled3.div`
168
+ var UITreeItems = styled.div`
1207
169
  display: grid;
1208
170
  grid-template-columns: auto 1fr;
1209
171
 
1210
- ${({ $shrink }) => $shrink && css2`
172
+ ${({ $shrink }) => $shrink && css`
1211
173
  padding-left: 3px;
1212
174
  margin-top: 10px;
1213
175
  `}
1214
176
  `;
1215
- var UITreeItemLeft = styled3.div`
177
+ var UITreeItemLeft = styled.div`
1216
178
  grid-column: 1;
1217
179
  position: relative;
1218
180
  width: 16px;
@@ -1220,7 +182,7 @@ var UITreeItemLeft = styled3.div`
1220
182
  ${({ $showLine, $isLast, $showCollapse }) => {
1221
183
  let height = $isLast ? "24px" : "100%";
1222
184
  let width = $showCollapse ? "12px" : "30px";
1223
- return $showLine && css2`
185
+ return $showLine && css`
1224
186
  &::before {
1225
187
  /* 竖线 */
1226
188
  content: '';
@@ -1247,7 +209,7 @@ var UITreeItemLeft = styled3.div`
1247
209
  `;
1248
210
  }}
1249
211
  `;
1250
- var UITreeItemRight = styled3.div`
212
+ var UITreeItemRight = styled.div`
1251
213
  grid-column: 2;
1252
214
  margin-bottom: 10px;
1253
215
 
@@ -1255,28 +217,28 @@ var UITreeItemRight = styled3.div`
1255
217
  margin-bottom: 0px;
1256
218
  }
1257
219
  `;
1258
- var UITreeItemMain = styled3.div`
220
+ var UITreeItemMain = styled.div`
1259
221
  display: flex;
1260
222
  flex-direction: column;
1261
223
  gap: 10px;
1262
224
  position: relative;
1263
225
  `;
1264
- var UICollapsible = styled3.div`
226
+ var UICollapsible = styled.div`
1265
227
  display: none;
1266
228
 
1267
- ${({ $collapse }) => $collapse && css2`
229
+ ${({ $collapse }) => $collapse && css`
1268
230
  display: block;
1269
231
  `}
1270
232
  `;
1271
- var UIName = styled3.div`
233
+ var UIName = styled.div`
1272
234
  flex-grow: 1;
1273
235
  `;
1274
- var UIType = styled3.div``;
1275
- var UIRequired = styled3.div``;
1276
- var UIActions = styled3.div`
236
+ var UIType = styled.div``;
237
+ var UIRequired = styled.div``;
238
+ var UIActions = styled.div`
1277
239
  white-space: nowrap;
1278
240
  `;
1279
- var iconAddChildrenSvg = /* @__PURE__ */ React15.createElement(
241
+ var iconAddChildrenSvg = /* @__PURE__ */ React3.createElement(
1280
242
  "svg",
1281
243
  {
1282
244
  className: "icon-icon icon-icon-coz_add_node ",
@@ -1286,7 +248,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ React15.createElement(
1286
248
  fill: "currentColor",
1287
249
  xmlns: "http://www.w3.org/2000/svg"
1288
250
  },
1289
- /* @__PURE__ */ React15.createElement(
251
+ /* @__PURE__ */ React3.createElement(
1290
252
  "path",
1291
253
  {
1292
254
  fillRule: "evenodd",
@@ -1294,13 +256,13 @@ var iconAddChildrenSvg = /* @__PURE__ */ React15.createElement(
1294
256
  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
257
  }
1296
258
  ),
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" })
259
+ /* @__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
260
  );
1299
- var IconAddChildren = () => /* @__PURE__ */ React15.createElement(Icon3, { size: "small", svg: iconAddChildrenSvg });
1300
- var DefaultValueWrapper = styled3.div`
261
+ var IconAddChildren = () => /* @__PURE__ */ React3.createElement(Icon2, { size: "small", svg: iconAddChildrenSvg });
262
+ var DefaultValueWrapper = styled.div`
1301
263
  margin: 0;
1302
264
  `;
1303
- var ConstantInputWrapper = styled3.div`
265
+ var ConstantInputWrapper = styled.div`
1304
266
  flex-grow: 1;
1305
267
 
1306
268
  & .semi-tree-select,
@@ -1311,7 +273,7 @@ var ConstantInputWrapper = styled3.div`
1311
273
  `;
1312
274
 
1313
275
  // src/components/json-schema-editor/hooks.tsx
1314
- import { useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
276
+ import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
1315
277
  import { difference, omit } from "lodash";
1316
278
  import { produce } from "immer";
1317
279
  import { useTypeManager as useTypeManager2 } from "@flowgram.ai/json-schema";
@@ -1324,9 +286,9 @@ function usePropertiesEdit(value, onChange) {
1324
286
  const drilldownSchema = typeManager.getPropertiesParent(value || {});
1325
287
  const canAddField = typeManager.canAddField(value || {});
1326
288
  const [propertyList, setPropertyList] = useState2([]);
1327
- const effectVersion = useRef2(0);
1328
- const changeVersion = useRef2(0);
1329
- useEffect3(() => {
289
+ const effectVersion = useRef(0);
290
+ const changeVersion = useRef(0);
291
+ useEffect2(() => {
1330
292
  effectVersion.current = effectVersion.current + 1;
1331
293
  if (effectVersion.current === changeVersion.current) {
1332
294
  return;
@@ -1393,7 +355,7 @@ function usePropertiesEdit(value, onChange) {
1393
355
  (_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
1394
356
  );
1395
357
  };
1396
- useEffect3(() => {
358
+ useEffect2(() => {
1397
359
  if (!canAddField) {
1398
360
  setPropertyList([]);
1399
361
  }
@@ -1408,46 +370,46 @@ function usePropertiesEdit(value, onChange) {
1408
370
  }
1409
371
 
1410
372
  // src/components/json-schema-editor/default-value.tsx
1411
- import React17 from "react";
1412
- import { I18n as I18n8 } from "@flowgram.ai/editor";
373
+ import React5 from "react";
374
+ import { I18n } from "@flowgram.ai/editor";
1413
375
 
1414
376
  // src/components/constant-input/index.tsx
1415
- import React16, { useMemo as useMemo3 } from "react";
1416
- import { Input as Input3 } from "@douyinfe/semi-ui";
377
+ import React4, { useMemo as useMemo2 } from "react";
378
+ import { Input as Input2 } from "@douyinfe/semi-ui";
1417
379
  function ConstantInput(props) {
1418
380
  const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
1419
381
  const typeManager = useTypeManager();
1420
- const Renderer2 = useMemo3(() => {
382
+ const Renderer = useMemo2(() => {
1421
383
  const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
1422
384
  if (!strategy) {
1423
385
  return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
1424
386
  }
1425
387
  return strategy?.Renderer;
1426
388
  }, [strategies, schema]);
1427
- if (!Renderer2) {
389
+ if (!Renderer) {
1428
390
  if (fallbackRenderer) {
1429
- return React16.createElement(fallbackRenderer, {
391
+ return React4.createElement(fallbackRenderer, {
1430
392
  value,
1431
393
  onChange,
1432
394
  readonly,
1433
395
  ...rest
1434
396
  });
1435
397
  }
1436
- return /* @__PURE__ */ React16.createElement(Input3, { size: "small", disabled: true, placeholder: "Unsupported type" });
398
+ return /* @__PURE__ */ React4.createElement(Input2, { size: "small", disabled: true, placeholder: "Unsupported type" });
1437
399
  }
1438
- return /* @__PURE__ */ React16.createElement(Renderer2, { value, onChange, readonly, ...rest });
400
+ return /* @__PURE__ */ React4.createElement(Renderer, { value, onChange, readonly, ...rest });
1439
401
  }
1440
402
 
1441
403
  // src/components/json-schema-editor/default-value.tsx
1442
404
  function DefaultValue(props) {
1443
405
  const { value, schema, onChange, placeholder } = props;
1444
- return /* @__PURE__ */ React17.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React17.createElement(
406
+ return /* @__PURE__ */ React5.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React5.createElement(
1445
407
  ConstantInput,
1446
408
  {
1447
409
  value,
1448
410
  onChange: (_v) => onChange(_v),
1449
411
  schema: schema || { type: "string" },
1450
- placeholder: placeholder ?? I18n8.t("Default value if parameter is not provided"),
412
+ placeholder: placeholder ?? I18n.t("Default value if parameter is not provided"),
1451
413
  enableMultiLineStr: true
1452
414
  }
1453
415
  ));
@@ -1461,7 +423,7 @@ function JsonSchemaEditor(props) {
1461
423
  value,
1462
424
  onChangeProps
1463
425
  );
1464
- return /* @__PURE__ */ React18.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React18.createElement(UITreeItems, null, propertyList.map((_property) => /* @__PURE__ */ React18.createElement(
426
+ return /* @__PURE__ */ React6.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React6.createElement(UITreeItems, null, propertyList.map((_property) => /* @__PURE__ */ React6.createElement(
1465
427
  PropertyEdit,
1466
428
  {
1467
429
  readonly,
@@ -1475,16 +437,16 @@ function JsonSchemaEditor(props) {
1475
437
  onRemoveProperty(_property.key);
1476
438
  }
1477
439
  }
1478
- ))), /* @__PURE__ */ React18.createElement(
440
+ ))), /* @__PURE__ */ React6.createElement(
1479
441
  Button,
1480
442
  {
1481
443
  disabled: readonly,
1482
444
  size: "small",
1483
445
  style: { marginTop: 10, marginLeft: 16 },
1484
- icon: /* @__PURE__ */ React18.createElement(IconPlus, null),
446
+ icon: /* @__PURE__ */ React6.createElement(IconPlus, null),
1485
447
  onClick: onAddProperty
1486
448
  },
1487
- config?.addButtonText ?? I18n9.t("Add")
449
+ config?.addButtonText ?? I18n2.t("Add")
1488
450
  ));
1489
451
  }
1490
452
  function PropertyEdit(props) {
@@ -1492,7 +454,7 @@ function PropertyEdit(props) {
1492
454
  const [expand, setExpand] = useState3(false);
1493
455
  const [collapse, setCollapse] = useState3(false);
1494
456
  const { name, type, items, default: defaultValue, description, isPropertyRequired } = value || {};
1495
- const typeSelectorValue = useMemo4(() => ({ type, items }), [type, items]);
457
+ const typeSelectorValue = useMemo3(() => ({ type, items }), [type, items]);
1496
458
  const { propertyList, canAddField, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
1497
459
  const onChange = (key, _value) => {
1498
460
  onChangeProps?.({
@@ -1501,16 +463,16 @@ function PropertyEdit(props) {
1501
463
  });
1502
464
  };
1503
465
  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(
466
+ 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
467
  BlurInput,
1506
468
  {
1507
469
  disabled: readonly,
1508
- placeholder: config?.placeholder ?? I18n9.t("Input Variable Name"),
470
+ placeholder: config?.placeholder ?? I18n2.t("Input Variable Name"),
1509
471
  size: "small",
1510
472
  value: name,
1511
473
  onChange: (value2) => onChange("name", value2)
1512
474
  }
1513
- )), /* @__PURE__ */ React18.createElement(UIType, null, /* @__PURE__ */ React18.createElement(
475
+ )), /* @__PURE__ */ React6.createElement(UIType, null, /* @__PURE__ */ React6.createElement(
1514
476
  InjectTypeSelector,
1515
477
  {
1516
478
  value: typeSelectorValue,
@@ -1522,63 +484,63 @@ function PropertyEdit(props) {
1522
484
  });
1523
485
  }
1524
486
  }
1525
- )), /* @__PURE__ */ React18.createElement(UIRequired, null, /* @__PURE__ */ React18.createElement(
487
+ )), /* @__PURE__ */ React6.createElement(UIRequired, null, /* @__PURE__ */ React6.createElement(
1526
488
  Checkbox,
1527
489
  {
1528
490
  disabled: readonly,
1529
491
  checked: isPropertyRequired,
1530
492
  onChange: (e) => onChange("isPropertyRequired", e.target.checked)
1531
493
  }
1532
- )), /* @__PURE__ */ React18.createElement(UIActions, null, /* @__PURE__ */ React18.createElement(
494
+ )), /* @__PURE__ */ React6.createElement(UIActions, null, /* @__PURE__ */ React6.createElement(
1533
495
  IconButton2,
1534
496
  {
1535
497
  disabled: readonly,
1536
498
  size: "small",
1537
499
  theme: "borderless",
1538
- icon: expand ? /* @__PURE__ */ React18.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React18.createElement(IconExpand, { size: "small" }),
500
+ icon: expand ? /* @__PURE__ */ React6.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React6.createElement(IconExpand, { size: "small" }),
1539
501
  onClick: () => {
1540
502
  setExpand((_expand) => !_expand);
1541
503
  }
1542
504
  }
1543
- ), canAddField && /* @__PURE__ */ React18.createElement(
505
+ ), canAddField && /* @__PURE__ */ React6.createElement(
1544
506
  IconButton2,
1545
507
  {
1546
508
  disabled: readonly,
1547
509
  size: "small",
1548
510
  theme: "borderless",
1549
- icon: /* @__PURE__ */ React18.createElement(IconAddChildren, null),
511
+ icon: /* @__PURE__ */ React6.createElement(IconAddChildren, null),
1550
512
  onClick: () => {
1551
513
  onAddProperty();
1552
514
  setCollapse(true);
1553
515
  }
1554
516
  }
1555
- ), /* @__PURE__ */ React18.createElement(
517
+ ), /* @__PURE__ */ React6.createElement(
1556
518
  IconButton2,
1557
519
  {
1558
520
  disabled: readonly,
1559
521
  size: "small",
1560
522
  theme: "borderless",
1561
- icon: /* @__PURE__ */ React18.createElement(IconMinus, { size: "small" }),
523
+ icon: /* @__PURE__ */ React6.createElement(IconMinus, { size: "small" }),
1562
524
  onClick: onRemove
1563
525
  }
1564
- ))), expand && /* @__PURE__ */ React18.createElement(UIExpandDetail, null, /* @__PURE__ */ React18.createElement(UILabel, null, config?.descTitle ?? I18n9.t("Description")), /* @__PURE__ */ React18.createElement(
526
+ ))), expand && /* @__PURE__ */ React6.createElement(UIExpandDetail, null, /* @__PURE__ */ React6.createElement(UILabel, null, config?.descTitle ?? I18n2.t("Description")), /* @__PURE__ */ React6.createElement(
1565
527
  BlurInput,
1566
528
  {
1567
529
  disabled: readonly,
1568
530
  size: "small",
1569
531
  value: description,
1570
532
  onChange: (value2) => onChange("description", value2),
1571
- placeholder: config?.descPlaceholder ?? I18n9.t("Help LLM to understand the property")
533
+ placeholder: config?.descPlaceholder ?? I18n2.t("Help LLM to understand the property")
1572
534
  }
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(
535
+ ), $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
536
  DefaultValue,
1575
537
  {
1576
538
  value: defaultValue,
1577
539
  schema: value,
1578
- placeholder: config?.defaultValuePlaceholder ?? I18n9.t("Default Value"),
540
+ placeholder: config?.defaultValuePlaceholder ?? I18n2.t("Default Value"),
1579
541
  onChange: (value2) => onChange("default", value2)
1580
542
  }
1581
- ))))), showCollapse && /* @__PURE__ */ React18.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React18.createElement(UITreeItems, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React18.createElement(
543
+ ))))), showCollapse && /* @__PURE__ */ React6.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React6.createElement(UITreeItems, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React6.createElement(
1582
544
  PropertyEdit,
1583
545
  {
1584
546
  readonly,
@@ -1598,28 +560,28 @@ function PropertyEdit(props) {
1598
560
  }
1599
561
 
1600
562
  // src/components/batch-variable-selector/index.tsx
1601
- import React19 from "react";
563
+ import React7 from "react";
1602
564
  import { PrivateScopeProvider } from "@flowgram.ai/editor";
1603
565
  var batchVariableSchema = {
1604
566
  type: "array",
1605
567
  extra: { weak: true }
1606
568
  };
1607
569
  function BatchVariableSelector(props) {
1608
- return /* @__PURE__ */ React19.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React19.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
570
+ return /* @__PURE__ */ React7.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React7.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
1609
571
  }
1610
572
 
1611
573
  // src/components/dynamic-value-input/index.tsx
1612
- import React20 from "react";
574
+ import React8 from "react";
1613
575
  import {
1614
- JsonSchemaUtils as JsonSchemaUtils4,
576
+ JsonSchemaUtils as JsonSchemaUtils2,
1615
577
  useTypeManager as useTypeManager3
1616
578
  } from "@flowgram.ai/json-schema";
1617
579
  import { IconButton as IconButton3 } from "@douyinfe/semi-ui";
1618
580
  import { IconSetting } from "@douyinfe/semi-icons";
1619
581
 
1620
582
  // src/components/dynamic-value-input/styles.tsx
1621
- import styled4 from "styled-components";
1622
- var UIContainer2 = styled4.div`
583
+ import styled2 from "styled-components";
584
+ var UIContainer2 = styled2.div`
1623
585
  display: flex;
1624
586
  align-items: center;
1625
587
  border-radius: 4px;
@@ -1629,7 +591,7 @@ var UIContainer2 = styled4.div`
1629
591
 
1630
592
  background-color: var(--semi-color-fill-0);
1631
593
  `;
1632
- var UIMain = styled4.div`
594
+ var UIMain = styled2.div`
1633
595
  flex-grow: 1;
1634
596
  overflow: hidden;
1635
597
  min-width: 0;
@@ -1661,23 +623,23 @@ var UIMain = styled4.div`
1661
623
  word-break: break-all;
1662
624
  }
1663
625
  `;
1664
- var UIType2 = styled4.div`
626
+ var UIType2 = styled2.div`
1665
627
  & .semi-button {
1666
628
  border-radius: 0;
1667
629
  }
1668
630
  `;
1669
- var UITrigger = styled4.div`
631
+ var UITrigger = styled2.div`
1670
632
  & .semi-button {
1671
633
  border-radius: 0;
1672
634
  }
1673
635
  `;
1674
636
 
1675
637
  // src/components/dynamic-value-input/hooks.ts
1676
- import { useEffect as useEffect4, useMemo as useMemo5, useRef as useRef3, useState as useState4 } from "react";
638
+ import { useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2, useState as useState4 } from "react";
1677
639
  import { useScopeAvailable } from "@flowgram.ai/editor";
1678
640
  function useRefVariable(value) {
1679
641
  const available = useScopeAvailable();
1680
- const refVariable = useMemo5(() => {
642
+ const refVariable = useMemo4(() => {
1681
643
  if (value?.type === "ref") {
1682
644
  return available.getByKeyPath(value.content);
1683
645
  }
@@ -1689,10 +651,10 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
1689
651
  if (value?.type === "constant") {
1690
652
  defaultSelectSchema = value?.schema || defaultSelectSchema;
1691
653
  }
1692
- const changeVersion = useRef3(0);
1693
- const effectVersion = useRef3(0);
654
+ const changeVersion = useRef2(0);
655
+ const effectVersion = useRef2(0);
1694
656
  const [selectSchema, setSelectSchema] = useState4(defaultSelectSchema);
1695
- useEffect4(() => {
657
+ useEffect3(() => {
1696
658
  effectVersion.current += 1;
1697
659
  if (changeVersion.current === effectVersion.current) {
1698
660
  return;
@@ -1710,7 +672,7 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
1710
672
  return [selectSchema, setSelectSchemaWithVersionUpdate];
1711
673
  }
1712
674
  function useIncludeSchema(schemaFromProps) {
1713
- const includeSchema = useMemo5(() => {
675
+ const includeSchema = useMemo4(() => {
1714
676
  if (!schemaFromProps) {
1715
677
  return;
1716
678
  }
@@ -1742,13 +704,13 @@ function DynamicValueInput({
1742
704
  const typeManager = useTypeManager3();
1743
705
  const renderTypeSelector = () => {
1744
706
  if (schemaFromProps) {
1745
- return /* @__PURE__ */ React20.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
707
+ return /* @__PURE__ */ React8.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
1746
708
  }
1747
709
  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 });
710
+ const schema = refVariable?.type ? JsonSchemaUtils2.astToSchema(refVariable?.type) : void 0;
711
+ return /* @__PURE__ */ React8.createElement(TypeSelector, { value: schema, readonly: true });
1750
712
  }
1751
- return /* @__PURE__ */ React20.createElement(
713
+ return /* @__PURE__ */ React8.createElement(
1752
714
  TypeSelector,
1753
715
  {
1754
716
  value: selectSchema,
@@ -1774,7 +736,7 @@ function DynamicValueInput({
1774
736
  };
1775
737
  const renderMain = () => {
1776
738
  if (value?.type === "ref") {
1777
- return /* @__PURE__ */ React20.createElement(
739
+ return /* @__PURE__ */ React8.createElement(
1778
740
  InjectVariableSelector,
1779
741
  {
1780
742
  style: { width: "100%" },
@@ -1785,15 +747,15 @@ function DynamicValueInput({
1785
747
  }
1786
748
  );
1787
749
  }
1788
- const constantSchema2 = schemaFromProps || selectSchema || { type: "string" };
1789
- return /* @__PURE__ */ React20.createElement(
750
+ const constantSchema = schemaFromProps || selectSchema || { type: "string" };
751
+ return /* @__PURE__ */ React8.createElement(
1790
752
  ConstantInput,
1791
753
  {
1792
754
  value: value?.content,
1793
- onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema2 }),
1794
- schema: constantSchema2 || { type: "string" },
755
+ onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema }),
756
+ schema: constantSchema || { type: "string" },
1795
757
  readonly,
1796
- fallbackRenderer: () => /* @__PURE__ */ React20.createElement(
758
+ fallbackRenderer: () => /* @__PURE__ */ React8.createElement(
1797
759
  InjectVariableSelector,
1798
760
  {
1799
761
  style: { width: "100%" },
@@ -1807,7 +769,7 @@ function DynamicValueInput({
1807
769
  }
1808
770
  );
1809
771
  };
1810
- const renderTrigger = () => /* @__PURE__ */ React20.createElement(
772
+ const renderTrigger = () => /* @__PURE__ */ React8.createElement(
1811
773
  InjectVariableSelector,
1812
774
  {
1813
775
  style: { width: "100%" },
@@ -1815,34 +777,34 @@ function DynamicValueInput({
1815
777
  onChange: (_v) => onChange({ type: "ref", content: _v }),
1816
778
  includeSchema,
1817
779
  readonly,
1818
- triggerRender: () => /* @__PURE__ */ React20.createElement(IconButton3, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React20.createElement(IconSetting, { size: "small" }) })
780
+ triggerRender: () => /* @__PURE__ */ React8.createElement(IconButton3, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React8.createElement(IconSetting, { size: "small" }) })
1819
781
  }
1820
782
  );
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()));
783
+ 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
784
  }
1823
785
  DynamicValueInput.renderKey = "dynamic-value-input-render-key";
1824
786
  var InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
1825
787
 
1826
788
  // 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";
789
+ import React10, { useMemo as useMemo7 } from "react";
790
+ import { I18n as I18n4 } from "@flowgram.ai/editor";
791
+ import { Input as Input3 } from "@douyinfe/semi-ui";
1830
792
 
1831
793
  // src/components/condition-row/styles.tsx
1832
- import styled5 from "styled-components";
1833
- var UIContainer3 = styled5.div`
794
+ import styled3 from "styled-components";
795
+ var UIContainer3 = styled3.div`
1834
796
  display: flex;
1835
797
  align-items: center;
1836
798
  gap: 4px;
1837
799
  `;
1838
- var UIOperator = styled5.div``;
1839
- var UILeft = styled5.div`
800
+ var UIOperator = styled3.div``;
801
+ var UILeft = styled3.div`
1840
802
  width: 100%;
1841
803
  `;
1842
- var UIRight = styled5.div`
804
+ var UIRight = styled3.div`
1843
805
  width: 100%;
1844
806
  `;
1845
- var UIValues = styled5.div`
807
+ var UIValues = styled3.div`
1846
808
  flex-grow: 1;
1847
809
  display: flex;
1848
810
  flex-direction: column;
@@ -1851,8 +813,8 @@ var UIValues = styled5.div`
1851
813
  `;
1852
814
 
1853
815
  // src/components/condition-row/hooks/useRule.ts
1854
- import { useMemo as useMemo6 } from "react";
1855
- import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
816
+ import { useMemo as useMemo5 } from "react";
817
+ import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
1856
818
  import { useScopeAvailable as useScopeAvailable2 } from "@flowgram.ai/editor";
1857
819
 
1858
820
  // src/components/condition-row/constants.ts
@@ -1978,37 +940,37 @@ var defaultOpConfigs = {
1978
940
  // src/components/condition-row/hooks/useRule.ts
1979
941
  function useRule(left, userRules) {
1980
942
  const available = useScopeAvailable2();
1981
- const rules = useMemo6(() => ({ ...defaultRules, ...userRules || {} }), [userRules]);
1982
- const variable = useMemo6(() => {
943
+ const rules = useMemo5(() => ({ ...defaultRules, ...userRules || {} }), [userRules]);
944
+ const variable = useMemo5(() => {
1983
945
  if (!left) return void 0;
1984
946
  return available.getByKeyPath(left.content);
1985
947
  }, [available, left]);
1986
- const rule = useMemo6(() => {
948
+ const rule = useMemo5(() => {
1987
949
  if (!variable) return void 0;
1988
- const schema = JsonSchemaUtils5.astToSchema(variable.type, { drilldown: false });
950
+ const schema = JsonSchemaUtils3.astToSchema(variable.type, { drilldown: false });
1989
951
  return rules[schema?.type];
1990
952
  }, [variable?.type, rules]);
1991
953
  return { rule };
1992
954
  }
1993
955
 
1994
956
  // 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";
957
+ import React9, { useMemo as useMemo6 } from "react";
958
+ import { I18n as I18n3 } from "@flowgram.ai/editor";
959
+ import { Button as Button2, Select } from "@douyinfe/semi-ui";
960
+ import { IconChevronDownStroked } from "@douyinfe/semi-icons";
1999
961
  function useOp({ rule, op, onChange, readonly, userOps }) {
2000
- const options = useMemo7(
962
+ const options = useMemo6(
2001
963
  () => Object.keys(rule || {}).map((_op) => ({
2002
964
  ...defaultOpConfigs[_op] || {},
2003
965
  ...userOps?.[_op] || {},
2004
966
  value: _op,
2005
- label: I18n10.t(userOps?.[_op]?.label || defaultOpConfigs[_op]?.label)
967
+ label: I18n3.t(userOps?.[_op]?.label || defaultOpConfigs[_op]?.label)
2006
968
  })),
2007
969
  [rule, userOps]
2008
970
  );
2009
- const opConfig = useMemo7(() => defaultOpConfigs[op], [op]);
2010
- const renderOpSelect = () => /* @__PURE__ */ React21.createElement(
2011
- Select2,
971
+ const opConfig = useMemo6(() => defaultOpConfigs[op], [op]);
972
+ const renderOpSelect = () => /* @__PURE__ */ React9.createElement(
973
+ Select,
2012
974
  {
2013
975
  style: { height: 22 },
2014
976
  disabled: readonly,
@@ -2018,7 +980,7 @@ function useOp({ rule, op, onChange, readonly, userOps }) {
2018
980
  onChange: (v) => {
2019
981
  onChange(v);
2020
982
  },
2021
- triggerRender: ({ value }) => /* @__PURE__ */ React21.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React21.createElement(IconChevronDownStroked2, { size: "small" }))
983
+ triggerRender: ({ value }) => /* @__PURE__ */ React9.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React9.createElement(IconChevronDownStroked, { size: "small" }))
2022
984
  }
2023
985
  );
2024
986
  return { renderOpSelect, opConfig };
@@ -2045,11 +1007,11 @@ function ConditionRow({
2045
1007
  readonly,
2046
1008
  userOps: ruleConfig.ops
2047
1009
  });
2048
- const targetSchema = useMemo8(() => {
1010
+ const targetSchema = useMemo7(() => {
2049
1011
  const targetType = rule?.[operator || ""] || null;
2050
1012
  return targetType ? { type: targetType, extra: { weak: true } } : null;
2051
1013
  }, [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(
1014
+ 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
1015
  InjectVariableSelector,
2054
1016
  {
2055
1017
  readonly,
@@ -2063,7 +1025,7 @@ function ConditionRow({
2063
1025
  }
2064
1026
  })
2065
1027
  }
2066
- )), /* @__PURE__ */ React22.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React22.createElement(
1028
+ )), /* @__PURE__ */ React10.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React10.createElement(
2067
1029
  InjectDynamicValueInput,
2068
1030
  {
2069
1031
  readonly: readonly || !rule,
@@ -2071,1032 +1033,375 @@ function ConditionRow({
2071
1033
  schema: targetSchema,
2072
1034
  onChange: (v) => onChange({ ...value, right: v })
2073
1035
  }
2074
- ) : /* @__PURE__ */ React22.createElement(
2075
- Input4,
1036
+ ) : /* @__PURE__ */ React10.createElement(
1037
+ Input3,
2076
1038
  {
2077
1039
  size: "small",
2078
1040
  disabled: true,
2079
1041
  style: { pointerEvents: "none" },
2080
- value: opConfig?.rightDisplay || I18n11.t("Empty")
1042
+ value: opConfig?.rightDisplay || I18n4.t("Empty")
2081
1043
  }
2082
1044
  ))));
2083
1045
  }
1046
+ ConditionRow.defaultRules = defaultRules;
1047
+ ConditionRow.defaultOpConfigs = defaultOpConfigs;
2084
1048
 
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
- }
1049
+ // src/components/db-condition-row/index.tsx
1050
+ import React13, { useMemo as useMemo10 } from "react";
1051
+ import { I18n as I18n6 } from "@flowgram.ai/editor";
1052
+ import { Input as Input4 } from "@douyinfe/semi-ui";
2204
1053
 
2205
- // src/components/batch-outputs/styles.tsx
2206
- import styled6 from "styled-components";
2207
- var UIRows = styled6.div`
1054
+ // src/components/db-condition-row/styles.tsx
1055
+ import styled4 from "styled-components";
1056
+ import { Select as Select2 } from "@douyinfe/semi-ui";
1057
+ var UIContainer4 = styled4.div`
1058
+ display: flex;
1059
+ align-items: center;
1060
+ gap: 4px;
1061
+ `;
1062
+ var UIOperator2 = styled4.div``;
1063
+ var UILeft2 = styled4.div`
1064
+ width: 100%;
1065
+ `;
1066
+ var UIRight2 = styled4.div`
1067
+ width: 100%;
1068
+ `;
1069
+ var UIValues2 = styled4.div`
1070
+ flex-grow: 1;
2208
1071
  display: flex;
2209
1072
  flex-direction: column;
2210
- gap: 10px;
2211
- margin-bottom: 10px;
1073
+ align-items: center;
1074
+ gap: 4px;
2212
1075
  `;
2213
- var UIRow2 = styled6.div`
1076
+ var UIOptionLabel = styled4.div`
2214
1077
  display: flex;
2215
1078
  align-items: center;
2216
- gap: 5px;
1079
+ gap: 10px;
1080
+ `;
1081
+ var UISelect = styled4(Select2)`
1082
+ & .semi-select-selection {
1083
+ margin-left: 5px;
1084
+ }
2217
1085
  `;
2218
1086
 
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,
1087
+ // src/components/db-condition-row/hooks/use-op.tsx
1088
+ import React11, { useMemo as useMemo8 } from "react";
1089
+ import { I18n as I18n5 } from "@flowgram.ai/editor";
1090
+ import { Button as Button3, Select as Select3 } from "@douyinfe/semi-ui";
1091
+ import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
1092
+ var defaultOpConfigs2 = ConditionRow.defaultOpConfigs;
1093
+ function useOp2({ rule, op, onChange, readonly, userOps }) {
1094
+ const options = useMemo8(
1095
+ () => Object.keys(rule || {}).map((_op) => ({
1096
+ ...defaultOpConfigs2[_op] || {},
1097
+ ...userOps?.[_op] || {},
1098
+ value: _op,
1099
+ label: I18n5.t(userOps?.[_op]?.label || defaultOpConfigs2[_op]?.label)
1100
+ })),
1101
+ [rule, userOps]
1102
+ );
1103
+ const opConfig = useMemo8(() => defaultOpConfigs2[op], [op]);
1104
+ const renderOpSelect = () => /* @__PURE__ */ React11.createElement(
1105
+ Select3,
2225
1106
  {
2226
- style: { width: 100 },
1107
+ style: { height: 22 },
2227
1108
  disabled: readonly,
2228
1109
  size: "small",
2229
- value: item.key,
2230
- onChange: (v) => updateKey(item.id, v)
1110
+ value: op,
1111
+ optionList: options,
1112
+ onChange: (v) => {
1113
+ onChange(v);
1114
+ },
1115
+ triggerRender: ({ value }) => /* @__PURE__ */ React11.createElement(Button3, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React11.createElement(IconChevronDownStroked2, { size: "small" }))
2231
1116
  }
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 })
1117
+ );
1118
+ return { renderOpSelect, opConfig };
1119
+ }
1120
+
1121
+ // src/components/db-condition-row/hooks/use-left.tsx
1122
+ import { useMemo as useMemo9 } from "react";
1123
+ import React12 from "react";
1124
+ import { useTypeManager as useTypeManager4 } from "@flowgram.ai/json-schema";
1125
+ import { Icon as Icon3 } from "@douyinfe/semi-ui";
1126
+ var defaultRules2 = ConditionRow.defaultRules;
1127
+ function useLeft({ left, options, userRules, readonly, onChange }) {
1128
+ const rules = useMemo9(() => ({ ...defaultRules2, ...userRules || {} }), [userRules]);
1129
+ const typeManager = useTypeManager4();
1130
+ const rule = useMemo9(() => {
1131
+ if (!left) return void 0;
1132
+ const option = options?.find((item) => item.value === left);
1133
+ if (!option?.schema?.type) {
1134
+ return void 0;
2239
1135
  }
2240
- ), /* @__PURE__ */ React23.createElement(
2241
- Button3,
1136
+ return rules[option.schema.type];
1137
+ }, [left, options, rules]);
1138
+ const renderDBOptionSelect = () => /* @__PURE__ */ React12.createElement(
1139
+ UISelect,
2242
1140
  {
2243
1141
  disabled: readonly,
2244
- icon: /* @__PURE__ */ React23.createElement(IconDelete, null),
2245
1142
  size: "small",
2246
- onClick: () => remove(item.id)
1143
+ style: { width: "100%" },
1144
+ value: left,
1145
+ onChange: (v) => onChange(v),
1146
+ optionList: options?.map((item) => ({
1147
+ label: /* @__PURE__ */ React12.createElement(UIOptionLabel, null, /* @__PURE__ */ React12.createElement(Icon3, { size: "small", svg: typeManager.getDisplayIcon(item.schema) }), item.label),
1148
+ value: item.value
1149
+ })) || []
2247
1150
  }
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
1151
  );
2379
- return null;
1152
+ return { rule, renderDBOptionSelect };
2380
1153
  }
2381
- var jinja_default = JinjaHighlight;
2382
1154
 
2383
- // src/components/prompt-editor/index.tsx
2384
- function PromptEditor(props) {
2385
- const {
2386
- value,
2387
- onChange,
1155
+ // src/components/db-condition-row/index.tsx
1156
+ var defaultRuleConfig2 = {
1157
+ ops: {},
1158
+ rules: {}
1159
+ };
1160
+ function DBConditionRow({
1161
+ style,
1162
+ value,
1163
+ onChange,
1164
+ readonly,
1165
+ options,
1166
+ ruleConfig = defaultRuleConfig2
1167
+ }) {
1168
+ const { left, operator, right } = value || {};
1169
+ const { rule, renderDBOptionSelect } = useLeft({
1170
+ left,
1171
+ options,
1172
+ onChange: (leftKey) => onChange({ ...value, left: leftKey }),
2388
1173
  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,
1174
+ userRules: ruleConfig.rules
1175
+ });
1176
+ const { renderOpSelect, opConfig } = useOp2({
1177
+ rule,
1178
+ op: operator,
1179
+ onChange: (v) => onChange({ ...value, operator: v }),
1180
+ readonly,
1181
+ userOps: ruleConfig.ops
1182
+ });
1183
+ const targetSchema = useMemo10(() => {
1184
+ const targetType = rule?.[operator || ""] || null;
1185
+ return targetType ? { type: targetType, extra: { weak: true } } : null;
1186
+ }, [rule, opConfig]);
1187
+ 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(
1188
+ InjectDynamicValueInput,
2405
1189
  {
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;
1190
+ readonly: readonly || !rule,
1191
+ value: right,
1192
+ schema: targetSchema,
1193
+ onChange: (v) => onChange({ ...value, right: v })
2467
1194
  }
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,
1195
+ ) : /* @__PURE__ */ React13.createElement(
1196
+ Input4,
2472
1197
  {
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;
1198
+ size: "small",
1199
+ disabled: true,
1200
+ style: { pointerEvents: "none" },
1201
+ value: opConfig?.rightDisplay || I18n6.t("Empty")
2573
1202
  }
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));
1203
+ ))));
2658
1204
  }
2659
1205
 
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";
1206
+ // src/components/batch-outputs/index.tsx
1207
+ import React14 from "react";
1208
+ import { I18n as I18n7 } from "@flowgram.ai/editor";
1209
+ import { Button as Button4, Input as Input5 } from "@douyinfe/semi-ui";
1210
+ import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
2672
1211
 
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
1212
+ // src/hooks/use-object-list/index.tsx
1213
+ import { useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
1214
+ import { nanoid } from "nanoid";
1215
+ import { difference as difference2, get, isObject, set } from "lodash";
1216
+ function genId2() {
1217
+ return nanoid();
1218
+ }
1219
+ function useObjectList({
1220
+ value,
1221
+ onChange,
1222
+ sortIndexKey
2684
1223
  }) {
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
- };
1224
+ const [list, setList] = useState5([]);
1225
+ const effectVersion = useRef3(0);
1226
+ const changeVersion = useRef3(0);
1227
+ const getSortIndex = (value2) => {
1228
+ if (typeof sortIndexKey === "function") {
1229
+ return get(value2, sortIndexKey(value2)) || 0;
2740
1230
  }
1231
+ return get(value2, sortIndexKey || "") || 0;
2741
1232
  };
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) {
1233
+ useEffect4(() => {
1234
+ effectVersion.current = effectVersion.current + 1;
1235
+ if (effectVersion.current === changeVersion.current) {
2758
1236
  return;
2759
1237
  }
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 + "}}"
1238
+ effectVersion.current = changeVersion.current;
1239
+ setList((_prevList) => {
1240
+ const newKeys = Object.entries(value || {}).sort((a, b) => getSortIndex(a[1]) - getSortIndex(b[1])).map(([key]) => key);
1241
+ const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
1242
+ const addKeys = difference2(newKeys, oldKeys);
1243
+ return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
1244
+ id: item.id,
1245
+ key: item.key,
1246
+ value: item.key ? value?.[item.key] : item.value
1247
+ })).concat(
1248
+ addKeys.map((_key) => ({
1249
+ id: genId2(),
1250
+ key: _key,
1251
+ value: value?.[_key]
1252
+ }))
1253
+ );
2770
1254
  });
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,
1255
+ }, [value]);
1256
+ const add = (defaultValue) => {
1257
+ setList((prevList) => [
1258
+ ...prevList,
2801
1259
  {
2802
- position,
2803
- onChange: () => setPosKey(String(Math.random()))
1260
+ id: genId2(),
1261
+ value: defaultValue
2804
1262
  }
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 + "}}"
1263
+ ]);
1264
+ };
1265
+ const updateValue = (itemId, value2) => {
1266
+ changeVersion.current = changeVersion.current + 1;
1267
+ setList((prevList) => {
1268
+ const nextList = prevList.map((_item) => {
1269
+ if (_item.id === itemId) {
1270
+ return {
1271
+ ..._item,
1272
+ value: value2
1273
+ };
1274
+ }
1275
+ return _item;
1276
+ });
1277
+ onChange(
1278
+ Object.fromEntries(
1279
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
1280
+ const indexKey = typeof sortIndexKey === "function" ? sortIndexKey(_res[1]) : sortIndexKey;
1281
+ if (isObject(_res[1]) && indexKey) {
1282
+ set(_res[1], indexKey, idx);
1283
+ }
1284
+ return _res;
1285
+ })
1286
+ )
1287
+ );
1288
+ return nextList;
2840
1289
  });
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
- }
1290
+ };
1291
+ const updateKey = (itemId, key) => {
1292
+ changeVersion.current = changeVersion.current + 1;
1293
+ setList((prevList) => {
1294
+ const nextList = prevList.map((_item) => {
1295
+ if (_item.id === itemId) {
1296
+ return {
1297
+ ..._item,
1298
+ key
1299
+ };
2867
1300
  }
2868
- ))
2869
- },
2870
- /* @__PURE__ */ React31.createElement(
2871
- PositionMirror3,
2872
- {
2873
- position,
2874
- onChange: () => setPosKey(String(Math.random()))
2875
- }
2876
- )
2877
- ));
1301
+ return _item;
1302
+ });
1303
+ onChange(
1304
+ Object.fromEntries(
1305
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value])
1306
+ )
1307
+ );
1308
+ return nextList;
1309
+ });
1310
+ };
1311
+ const remove = (itemId) => {
1312
+ changeVersion.current = changeVersion.current + 1;
1313
+ setList((prevList) => {
1314
+ const nextList = prevList.filter((_item) => _item.id !== itemId);
1315
+ onChange(
1316
+ Object.fromEntries(
1317
+ nextList.filter((item) => item.key).map((item) => [item.key, item.value])
1318
+ )
1319
+ );
1320
+ return nextList;
1321
+ });
1322
+ };
1323
+ return { list, add, updateKey, updateValue, remove };
2878
1324
  }
2879
1325
 
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
- }
1326
+ // src/components/batch-outputs/styles.tsx
1327
+ import styled5 from "styled-components";
1328
+ var UIRows = styled5.div`
1329
+ display: flex;
1330
+ flex-direction: column;
1331
+ gap: 10px;
1332
+ margin-bottom: 10px;
2928
1333
  `;
2929
- var UIPopoverContent3 = styled9.div`
2930
- padding: 10px;
2931
- display: inline-flex;
1334
+ var UIRow2 = styled5.div`
1335
+ display: flex;
2932
1336
  align-items: center;
2933
- justify-content: flex-start;
1337
+ gap: 5px;
2934
1338
  `;
2935
1339
 
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;
1340
+ // src/components/batch-outputs/index.tsx
1341
+ function BatchOutputs(props) {
1342
+ const { readonly, style } = props;
1343
+ const { list, add, updateKey, updateValue, remove } = useObjectList(props);
1344
+ return /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React14.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React14.createElement(
1345
+ Input5,
1346
+ {
1347
+ style: { width: 100 },
1348
+ disabled: readonly,
1349
+ size: "small",
1350
+ value: item.key,
1351
+ onChange: (v) => updateKey(item.id, v)
2956
1352
  }
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++;
1353
+ ), /* @__PURE__ */ React14.createElement(
1354
+ InjectVariableSelector,
1355
+ {
1356
+ style: { flexGrow: 1 },
1357
+ readonly,
1358
+ value: item.value?.content,
1359
+ onChange: (v) => updateValue(item.id, { type: "ref", content: v })
3050
1360
  }
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,
1361
+ ), /* @__PURE__ */ React14.createElement(
1362
+ Button4,
3071
1363
  {
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
- );
1364
+ disabled: readonly,
1365
+ icon: /* @__PURE__ */ React14.createElement(IconDelete, null),
1366
+ size: "small",
1367
+ onClick: () => remove(item.id)
1368
+ }
1369
+ )))), /* @__PURE__ */ React14.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React14.createElement(IconPlus2, null), size: "small", onClick: () => add() }, I18n7.t("Add")));
3083
1370
  }
3084
1371
 
1372
+ // src/components/prompt-editor-with-variables/index.tsx
1373
+ import { lazy } from "react";
1374
+ var PromptEditorWithVariables = lazy(
1375
+ () => import("./editor-JX42GFAZ.js").then((module) => ({ default: module.PromptEditorWithVariables }))
1376
+ );
1377
+
1378
+ // src/components/prompt-editor-with-inputs/index.tsx
1379
+ import { lazy as lazy2 } from "react";
1380
+ var PromptEditorWithInputs = lazy2(
1381
+ () => import("./editor-YMNCDGUR.js").then((module) => ({ default: module.PromptEditorWithInputs }))
1382
+ );
1383
+
1384
+ // src/components/json-editor-with-variables/index.tsx
1385
+ import { lazy as lazy3 } from "react";
1386
+ var JsonEditorWithVariables = lazy3(
1387
+ () => import("./editor-H2R7JJLO.js").then((module) => ({ default: module.JsonEditorWithVariables }))
1388
+ );
1389
+
3085
1390
  // 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";
1391
+ import React15 from "react";
1392
+ import { I18n as I18n8 } from "@flowgram.ai/editor";
1393
+ import { Button as Button5, IconButton as IconButton4 } from "@douyinfe/semi-ui";
3089
1394
  import { IconDelete as IconDelete2, IconPlus as IconPlus3 } from "@douyinfe/semi-icons";
3090
1395
 
3091
1396
  // src/components/inputs-values/styles.tsx
3092
- import styled10 from "styled-components";
3093
- var UIRows2 = styled10.div`
1397
+ import styled6 from "styled-components";
1398
+ var UIRows2 = styled6.div`
3094
1399
  display: flex;
3095
1400
  flex-direction: column;
3096
1401
  gap: 10px;
3097
1402
  margin-bottom: 10px;
3098
1403
  `;
3099
- var UIRow3 = styled10.div`
1404
+ var UIRow3 = styled6.div`
3100
1405
  display: flex;
3101
1406
  align-items: flex-start;
3102
1407
  gap: 5px;
@@ -3117,7 +1422,7 @@ function InputsValues({
3117
1422
  onChange,
3118
1423
  sortIndexKey: "extra.index"
3119
1424
  });
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(
1425
+ 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
1426
  BlurInput,
3122
1427
  {
3123
1428
  style: { width: 100, minWidth: 100, maxWidth: 100 },
@@ -3125,9 +1430,9 @@ function InputsValues({
3125
1430
  size: "small",
3126
1431
  value: item.key,
3127
1432
  onChange: (v) => updateKey(item.id, v),
3128
- placeholder: I18n14.t("Input Key")
1433
+ placeholder: I18n8.t("Input Key")
3129
1434
  }
3130
- ), /* @__PURE__ */ React34.createElement(
1435
+ ), /* @__PURE__ */ React15.createElement(
3131
1436
  InjectDynamicValueInput,
3132
1437
  {
3133
1438
  style: { flexGrow: 1 },
@@ -3141,20 +1446,20 @@ function InputsValues({
3141
1446
  strategies: [...constantProps?.strategies || []]
3142
1447
  }
3143
1448
  }
3144
- ), /* @__PURE__ */ React34.createElement(
1449
+ ), /* @__PURE__ */ React15.createElement(
3145
1450
  IconButton4,
3146
1451
  {
3147
1452
  disabled: readonly,
3148
1453
  theme: "borderless",
3149
- icon: /* @__PURE__ */ React34.createElement(IconDelete2, { size: "small" }),
1454
+ icon: /* @__PURE__ */ React15.createElement(IconDelete2, { size: "small" }),
3150
1455
  size: "small",
3151
1456
  onClick: () => remove(item.id)
3152
1457
  }
3153
- )))), /* @__PURE__ */ React34.createElement(
3154
- Button4,
1458
+ )))), /* @__PURE__ */ React15.createElement(
1459
+ Button5,
3155
1460
  {
3156
1461
  disabled: readonly,
3157
- icon: /* @__PURE__ */ React34.createElement(IconPlus3, null),
1462
+ icon: /* @__PURE__ */ React15.createElement(IconPlus3, null),
3158
1463
  size: "small",
3159
1464
  onClick: () => add({
3160
1465
  type: "constant",
@@ -3162,16 +1467,16 @@ function InputsValues({
3162
1467
  schema: { type: "string" }
3163
1468
  })
3164
1469
  },
3165
- I18n14.t("Add")
1470
+ I18n8.t("Add")
3166
1471
  ));
3167
1472
  }
3168
1473
 
3169
1474
  // src/components/display-schema-tree/index.tsx
3170
- import React35 from "react";
1475
+ import React16 from "react";
3171
1476
 
3172
1477
  // src/components/display-schema-tree/styles.tsx
3173
- import styled11, { css as css4 } from "styled-components";
3174
- var TreeRow = styled11.div`
1478
+ import styled7, { css as css2 } from "styled-components";
1479
+ var TreeRow = styled7.div`
3175
1480
  display: flex;
3176
1481
  align-items: center;
3177
1482
 
@@ -3184,7 +1489,7 @@ var TreeRow = styled11.div`
3184
1489
  height: 27px;
3185
1490
  white-space: nowrap;
3186
1491
  `;
3187
- var HorizontalLine = styled11.div`
1492
+ var HorizontalLine = styled7.div`
3188
1493
  position: relative;
3189
1494
 
3190
1495
  &::before,
@@ -3201,11 +1506,11 @@ var HorizontalLine = styled11.div`
3201
1506
  height: 1px;
3202
1507
  }
3203
1508
  `;
3204
- var TreeTitle = styled11.div`
1509
+ var TreeTitle = styled7.div`
3205
1510
  // overflow: hidden;
3206
1511
  // text-overflow: ellipsis;
3207
1512
  `;
3208
- var TreeLevel = styled11.div`
1513
+ var TreeLevel = styled7.div`
3209
1514
  padding-left: 30px;
3210
1515
  position: relative;
3211
1516
 
@@ -3219,7 +1524,7 @@ var TreeLevel = styled11.div`
3219
1524
  width: 1px;
3220
1525
  } */
3221
1526
  `;
3222
- var TreeItem = styled11.div`
1527
+ var TreeItem = styled7.div`
3223
1528
  position: relative;
3224
1529
 
3225
1530
  &::before {
@@ -3242,7 +1547,7 @@ var TreeItem = styled11.div`
3242
1547
  left: -22px;
3243
1548
  }
3244
1549
 
3245
- ${(props) => props.depth === 0 && css4`
1550
+ ${(props) => props.depth === 0 && css2`
3246
1551
  &::before {
3247
1552
  width: 0px !important;
3248
1553
  }
@@ -3251,7 +1556,7 @@ var TreeItem = styled11.div`
3251
1556
 
3252
1557
  // src/components/display-schema-tree/index.tsx
3253
1558
  function DisplaySchemaTree(props) {
3254
- return /* @__PURE__ */ React35.createElement(SchemaTree, { ...props });
1559
+ return /* @__PURE__ */ React16.createElement(SchemaTree, { ...props });
3255
1560
  }
3256
1561
  function SchemaTree(props) {
3257
1562
  const {
@@ -3267,27 +1572,27 @@ function SchemaTree(props) {
3267
1572
  const icon = typeManager?.getDisplayIcon(schema);
3268
1573
  let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
3269
1574
  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, {
1575
+ 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
1576
  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);
1577
+ }), /* @__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
1578
  }
3274
1579
 
3275
1580
  // 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";
1581
+ import React18, { useEffect as useEffect5 } from "react";
1582
+ import { JsonSchemaUtils as JsonSchemaUtils4 } from "@flowgram.ai/json-schema";
1583
+ import { useCurrentScope, useRefresh } from "@flowgram.ai/editor";
3279
1584
 
3280
1585
  // src/components/display-schema-tag/index.tsx
3281
- import React36 from "react";
3282
- import { Popover as Popover7 } from "@douyinfe/semi-ui";
1586
+ import React17 from "react";
1587
+ import { Popover } from "@douyinfe/semi-ui";
3283
1588
 
3284
1589
  // 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`
1590
+ import styled8 from "styled-components";
1591
+ import { Tag } from "@douyinfe/semi-ui";
1592
+ var PopoverContent = styled8.div`
3288
1593
  padding: 10px;
3289
1594
  `;
3290
- var StyledTag = styled12(Tag4)`
1595
+ var StyledTag = styled8(Tag)`
3291
1596
  padding: 4px;
3292
1597
 
3293
1598
  .tag-icon {
@@ -3295,7 +1600,7 @@ var StyledTag = styled12(Tag4)`
3295
1600
  height: 12px;
3296
1601
  }
3297
1602
  `;
3298
- var TitleSpan = styled12.span`
1603
+ var TitleSpan = styled8.span`
3299
1604
  display: inline-block;
3300
1605
  margin-left: 4px;
3301
1606
  margin-top: -1px;
@@ -3307,20 +1612,20 @@ var TitleSpan = styled12.span`
3307
1612
  function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
3308
1613
  const typeManager = useTypeManager();
3309
1614
  const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
3310
- return /* @__PURE__ */ React36.createElement(
3311
- Popover7,
1615
+ return /* @__PURE__ */ React17.createElement(
1616
+ Popover,
3312
1617
  {
3313
- content: /* @__PURE__ */ React36.createElement(PopoverContent, null, /* @__PURE__ */ React36.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
1618
+ content: /* @__PURE__ */ React17.createElement(PopoverContent, null, /* @__PURE__ */ React17.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
3314
1619
  },
3315
- /* @__PURE__ */ React36.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React36.cloneElement(icon, {
1620
+ /* @__PURE__ */ React17.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React17.cloneElement(icon, {
3316
1621
  className: "tag-icon"
3317
- }), title && /* @__PURE__ */ React36.createElement(TitleSpan, null, title))
1622
+ }), title && /* @__PURE__ */ React17.createElement(TitleSpan, null, title))
3318
1623
  );
3319
1624
  }
3320
1625
 
3321
1626
  // src/components/display-outputs/styles.ts
3322
- import styled13 from "styled-components";
3323
- var DisplayOutputsWrapper = styled13.div`
1627
+ import styled9 from "styled-components";
1628
+ var DisplayOutputsWrapper = styled9.div`
3324
1629
  display: flex;
3325
1630
  gap: 5px;
3326
1631
  flex-wrap: wrap;
@@ -3328,9 +1633,9 @@ var DisplayOutputsWrapper = styled13.div`
3328
1633
 
3329
1634
  // src/components/display-outputs/index.tsx
3330
1635
  function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3331
- const scope = useCurrentScope3();
1636
+ const scope = useCurrentScope();
3332
1637
  const refresh = useRefresh();
3333
- useEffect10(() => {
1638
+ useEffect5(() => {
3334
1639
  if (!displayFromScope) {
3335
1640
  return () => null;
3336
1641
  }
@@ -3344,12 +1649,12 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3344
1649
  const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
3345
1650
  acm = {
3346
1651
  ...acm,
3347
- ...JsonSchemaUtils6.astToSchema(curr.type)?.properties || {}
1652
+ ...JsonSchemaUtils4.astToSchema(curr.type)?.properties || {}
3348
1653
  };
3349
1654
  return acm;
3350
1655
  }, {}) : value?.properties || {};
3351
1656
  const childEntries = Object.entries(properties || {});
3352
- return /* @__PURE__ */ React37.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React37.createElement(
1657
+ return /* @__PURE__ */ React18.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React18.createElement(
3353
1658
  DisplaySchemaTag,
3354
1659
  {
3355
1660
  key,
@@ -3362,15 +1667,15 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
3362
1667
  }
3363
1668
 
3364
1669
  // 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";
1670
+ import React19, { useMemo as useMemo11 } from "react";
1671
+ import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
1672
+ import { useScopeAvailable as useScopeAvailable3 } from "@flowgram.ai/editor";
3368
1673
  function DisplayFlowValue({ value, title, showIconInTree }) {
3369
- const available = useScopeAvailable4();
1674
+ const available = useScopeAvailable3();
3370
1675
  const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
3371
- const schema = useMemo10(() => {
1676
+ const schema = useMemo11(() => {
3372
1677
  if (value?.type === "ref") {
3373
- return JsonSchemaUtils7.astToSchema(variable?.type);
1678
+ return JsonSchemaUtils5.astToSchema(variable?.type);
3374
1679
  }
3375
1680
  if (value?.type === "template") {
3376
1681
  return { type: "string" };
@@ -3380,7 +1685,7 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3380
1685
  }
3381
1686
  return { type: "unknown" };
3382
1687
  }, [value, variable?.hash]);
3383
- return /* @__PURE__ */ React38.createElement(
1688
+ return /* @__PURE__ */ React19.createElement(
3384
1689
  DisplaySchemaTag,
3385
1690
  {
3386
1691
  title,
@@ -3392,13 +1697,13 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3392
1697
  }
3393
1698
 
3394
1699
  // 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";
1700
+ import React20, { useMemo as useMemo12 } from "react";
1701
+ import { isPlainObject } from "lodash";
1702
+ import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
3398
1703
 
3399
1704
  // src/components/display-inputs-values/styles.ts
3400
- import styled14 from "styled-components";
3401
- var DisplayInputsWrapper = styled14.div`
1705
+ import styled10 from "styled-components";
1706
+ var DisplayInputsWrapper = styled10.div`
3402
1707
  display: flex;
3403
1708
  gap: 5px;
3404
1709
  flex-wrap: wrap;
@@ -3407,12 +1712,12 @@ var DisplayInputsWrapper = styled14.div`
3407
1712
  // src/components/display-inputs-values/index.tsx
3408
1713
  function DisplayInputsValues({ value, showIconInTree }) {
3409
1714
  const childEntries = Object.entries(value || {});
3410
- return /* @__PURE__ */ React39.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
1715
+ return /* @__PURE__ */ React20.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
3411
1716
  if (FlowValueUtils.isFlowValue(value2)) {
3412
- return /* @__PURE__ */ React39.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
1717
+ return /* @__PURE__ */ React20.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
3413
1718
  }
3414
- if (isPlainObject3(value2)) {
3415
- return /* @__PURE__ */ React39.createElement(
1719
+ if (isPlainObject(value2)) {
1720
+ return /* @__PURE__ */ React20.createElement(
3416
1721
  DisplayInputsValueAllInTag,
3417
1722
  {
3418
1723
  key,
@@ -3430,34 +1735,34 @@ function DisplayInputsValueAllInTag({
3430
1735
  title,
3431
1736
  showIconInTree
3432
1737
  }) {
3433
- const available = useScopeAvailable5();
3434
- const schema = useMemo11(
1738
+ const available = useScopeAvailable4();
1739
+ const schema = useMemo12(
3435
1740
  () => FlowValueUtils.inferJsonSchema(value, available.scope),
3436
1741
  [available.version, value]
3437
1742
  );
3438
- return /* @__PURE__ */ React39.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
1743
+ return /* @__PURE__ */ React20.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
3439
1744
  }
3440
1745
 
3441
1746
  // src/components/assign-rows/index.tsx
3442
- import React42 from "react";
1747
+ import React23 from "react";
3443
1748
  import { FieldArray } from "@flowgram.ai/editor";
3444
- import { Button as Button5 } from "@douyinfe/semi-ui";
1749
+ import { Button as Button6 } from "@douyinfe/semi-ui";
3445
1750
  import { IconPlus as IconPlus4 } from "@douyinfe/semi-icons";
3446
1751
 
3447
1752
  // src/components/assign-row/index.tsx
3448
- import React41 from "react";
1753
+ import React22 from "react";
3449
1754
  import { IconButton as IconButton5 } from "@douyinfe/semi-ui";
3450
1755
  import { IconMinus as IconMinus2 } from "@douyinfe/semi-icons";
3451
1756
 
3452
1757
  // src/components/assign-row/components/blur-input.tsx
3453
- import React40, { useEffect as useEffect11, useState as useState9 } from "react";
1758
+ import React21, { useEffect as useEffect6, useState as useState6 } from "react";
3454
1759
  import Input6 from "@douyinfe/semi-ui/lib/es/input";
3455
1760
  function BlurInput2(props) {
3456
- const [value, setValue] = useState9("");
3457
- useEffect11(() => {
1761
+ const [value, setValue] = useState6("");
1762
+ useEffect6(() => {
3458
1763
  setValue(props.value);
3459
1764
  }, [props.value]);
3460
- return /* @__PURE__ */ React40.createElement(
1765
+ return /* @__PURE__ */ React21.createElement(
3461
1766
  Input6,
3462
1767
  {
3463
1768
  ...props,
@@ -3480,7 +1785,7 @@ function AssignRow(props) {
3480
1785
  onDelete,
3481
1786
  readonly
3482
1787
  } = 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(
1788
+ 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
1789
  InjectVariableSelector,
3485
1790
  {
3486
1791
  style: { width: "100%", height: 26 },
@@ -3491,7 +1796,7 @@ function AssignRow(props) {
3491
1796
  left: { type: "ref", content: v }
3492
1797
  })
3493
1798
  }
3494
- ) : /* @__PURE__ */ React41.createElement(
1799
+ ) : /* @__PURE__ */ React22.createElement(
3495
1800
  BlurInput2,
3496
1801
  {
3497
1802
  style: { height: 26 },
@@ -3503,7 +1808,7 @@ function AssignRow(props) {
3503
1808
  left: v
3504
1809
  })
3505
1810
  }
3506
- )), /* @__PURE__ */ React41.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ React41.createElement(
1811
+ )), /* @__PURE__ */ React22.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ React22.createElement(
3507
1812
  InjectDynamicValueInput,
3508
1813
  {
3509
1814
  readonly,
@@ -3513,12 +1818,12 @@ function AssignRow(props) {
3513
1818
  right: v
3514
1819
  })
3515
1820
  }
3516
- )), onDelete && /* @__PURE__ */ React41.createElement("div", null, /* @__PURE__ */ React41.createElement(
1821
+ )), onDelete && /* @__PURE__ */ React22.createElement("div", null, /* @__PURE__ */ React22.createElement(
3517
1822
  IconButton5,
3518
1823
  {
3519
1824
  size: "small",
3520
1825
  theme: "borderless",
3521
- icon: /* @__PURE__ */ React41.createElement(IconMinus2, null),
1826
+ icon: /* @__PURE__ */ React22.createElement(IconMinus2, null),
3522
1827
  onClick: () => onDelete?.()
3523
1828
  }
3524
1829
  )));
@@ -3527,7 +1832,7 @@ function AssignRow(props) {
3527
1832
  // src/components/assign-rows/index.tsx
3528
1833
  function AssignRows(props) {
3529
1834
  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(
1835
+ return /* @__PURE__ */ React23.createElement(FieldArray, { name }, ({ field }) => /* @__PURE__ */ React23.createElement(React23.Fragment, null, field.map((childField, index) => /* @__PURE__ */ React23.createElement(
3531
1836
  AssignRow,
3532
1837
  {
3533
1838
  key: childField.key,
@@ -3538,21 +1843,21 @@ function AssignRows(props) {
3538
1843
  },
3539
1844
  onDelete: () => field.remove(index)
3540
1845
  }
3541
- )), /* @__PURE__ */ React42.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ React42.createElement(
3542
- Button5,
1846
+ )), /* @__PURE__ */ React23.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ React23.createElement(
1847
+ Button6,
3543
1848
  {
3544
1849
  size: "small",
3545
1850
  theme: "borderless",
3546
- icon: /* @__PURE__ */ React42.createElement(IconPlus4, null),
1851
+ icon: /* @__PURE__ */ React23.createElement(IconPlus4, null),
3547
1852
  onClick: () => field.append({ operator: "assign" })
3548
1853
  },
3549
1854
  "Assign"
3550
- ), /* @__PURE__ */ React42.createElement(
3551
- Button5,
1855
+ ), /* @__PURE__ */ React23.createElement(
1856
+ Button6,
3552
1857
  {
3553
1858
  size: "small",
3554
1859
  theme: "borderless",
3555
- icon: /* @__PURE__ */ React42.createElement(IconPlus4, null),
1860
+ icon: /* @__PURE__ */ React23.createElement(IconPlus4, null),
3556
1861
  onClick: () => field.append({ operator: "declare" })
3557
1862
  },
3558
1863
  "Declaration"
@@ -3560,35 +1865,35 @@ function AssignRows(props) {
3560
1865
  }
3561
1866
 
3562
1867
  // 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";
1868
+ import React26 from "react";
1869
+ import { I18n as I18n10 } from "@flowgram.ai/editor";
1870
+ import { Button as Button7 } from "@douyinfe/semi-ui";
3566
1871
  import { IconPlus as IconPlus5 } from "@douyinfe/semi-icons";
3567
1872
 
3568
1873
  // src/components/inputs-values-tree/styles.tsx
3569
- import React43 from "react";
3570
- import styled15, { css as css5 } from "styled-components";
1874
+ import React24 from "react";
1875
+ import styled11, { css as css3 } from "styled-components";
3571
1876
  import Icon4 from "@douyinfe/semi-icons";
3572
- var UIContainer5 = styled15.div``;
3573
- var UIRow4 = styled15.div`
1877
+ var UIContainer5 = styled11.div``;
1878
+ var UIRow4 = styled11.div`
3574
1879
  display: flex;
3575
1880
  align-items: flex-start;
3576
1881
  gap: 5px;
3577
1882
  `;
3578
- var UICollapseTrigger2 = styled15.div`
1883
+ var UICollapseTrigger2 = styled11.div`
3579
1884
  cursor: pointer;
3580
1885
  margin-right: 5px;
3581
1886
  `;
3582
- var UITreeItems2 = styled15.div`
1887
+ var UITreeItems2 = styled11.div`
3583
1888
  display: grid;
3584
1889
  grid-template-columns: auto 1fr;
3585
1890
 
3586
- ${({ $shrink }) => $shrink && css5`
1891
+ ${({ $shrink }) => $shrink && css3`
3587
1892
  padding-left: 3px;
3588
1893
  margin-top: 10px;
3589
1894
  `}
3590
1895
  `;
3591
- var UITreeItemLeft2 = styled15.div`
1896
+ var UITreeItemLeft2 = styled11.div`
3592
1897
  grid-column: 1;
3593
1898
  position: relative;
3594
1899
  width: 16px;
@@ -3596,7 +1901,7 @@ var UITreeItemLeft2 = styled15.div`
3596
1901
  ${({ $showLine, $isLast, $showCollapse }) => {
3597
1902
  let height = $isLast ? "24px" : "100%";
3598
1903
  let width = $showCollapse ? "12px" : "30px";
3599
- return $showLine && css5`
1904
+ return $showLine && css3`
3600
1905
  &::before {
3601
1906
  /* 竖线 */
3602
1907
  content: '';
@@ -3623,7 +1928,7 @@ var UITreeItemLeft2 = styled15.div`
3623
1928
  `;
3624
1929
  }}
3625
1930
  `;
3626
- var UITreeItemRight2 = styled15.div`
1931
+ var UITreeItemRight2 = styled11.div`
3627
1932
  grid-column: 2;
3628
1933
  margin-bottom: 10px;
3629
1934
 
@@ -3631,23 +1936,23 @@ var UITreeItemRight2 = styled15.div`
3631
1936
  margin-bottom: 0px;
3632
1937
  }
3633
1938
  `;
3634
- var UITreeItemMain2 = styled15.div`
1939
+ var UITreeItemMain2 = styled11.div`
3635
1940
  display: flex;
3636
1941
  flex-direction: column;
3637
1942
  gap: 10px;
3638
1943
  position: relative;
3639
1944
  `;
3640
- var UICollapsible2 = styled15.div`
1945
+ var UICollapsible2 = styled11.div`
3641
1946
  display: none;
3642
1947
 
3643
- ${({ $collapse }) => $collapse && css5`
1948
+ ${({ $collapse }) => $collapse && css3`
3644
1949
  display: block;
3645
1950
  `}
3646
1951
  `;
3647
- var UIActions2 = styled15.div`
1952
+ var UIActions2 = styled11.div`
3648
1953
  white-space: nowrap;
3649
1954
  `;
3650
- var iconAddChildrenSvg2 = /* @__PURE__ */ React43.createElement(
1955
+ var iconAddChildrenSvg2 = /* @__PURE__ */ React24.createElement(
3651
1956
  "svg",
3652
1957
  {
3653
1958
  className: "icon-icon icon-icon-coz_add_node ",
@@ -3657,7 +1962,7 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ React43.createElement(
3657
1962
  fill: "currentColor",
3658
1963
  xmlns: "http://www.w3.org/2000/svg"
3659
1964
  },
3660
- /* @__PURE__ */ React43.createElement(
1965
+ /* @__PURE__ */ React24.createElement(
3661
1966
  "path",
3662
1967
  {
3663
1968
  fillRule: "evenodd",
@@ -3665,22 +1970,22 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ React43.createElement(
3665
1970
  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
1971
  }
3667
1972
  ),
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" })
1973
+ /* @__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
1974
  );
3670
- var IconAddChildren2 = () => /* @__PURE__ */ React43.createElement(Icon4, { size: "small", svg: iconAddChildrenSvg2 });
1975
+ var IconAddChildren2 = () => /* @__PURE__ */ React24.createElement(Icon4, { size: "small", svg: iconAddChildrenSvg2 });
3671
1976
 
3672
1977
  // 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";
1978
+ import React25, { useMemo as useMemo14, useState as useState7 } from "react";
1979
+ import { I18n as I18n9 } from "@flowgram.ai/editor";
3675
1980
  import { IconButton as IconButton6, Input as Input7 } from "@douyinfe/semi-ui";
3676
1981
  import { IconChevronDown as IconChevronDown2, IconChevronRight as IconChevronRight2, IconDelete as IconDelete3 } from "@douyinfe/semi-icons";
3677
1982
 
3678
1983
  // src/components/inputs-values-tree/hooks/use-child-list.tsx
3679
- import { useMemo as useMemo12 } from "react";
3680
- import { isPlainObject as isPlainObject4 } from "lodash";
1984
+ import { useMemo as useMemo13 } from "react";
1985
+ import { isPlainObject as isPlainObject2 } from "lodash";
3681
1986
  function useChildList(value, onChange) {
3682
- const canAddField = useMemo12(() => {
3683
- if (!isPlainObject4(value)) {
1987
+ const canAddField = useMemo13(() => {
1988
+ if (!isPlainObject2(value)) {
3684
1989
  return false;
3685
1990
  }
3686
1991
  if (FlowValueUtils.isFlowValue(value)) {
@@ -3688,8 +1993,8 @@ function useChildList(value, onChange) {
3688
1993
  }
3689
1994
  return true;
3690
1995
  }, [value]);
3691
- const objectListValue = useMemo12(() => {
3692
- if (isPlainObject4(value)) {
1996
+ const objectListValue = useMemo13(() => {
1997
+ if (isPlainObject2(value)) {
3693
1998
  if (FlowValueUtils.isFlowValue(value)) {
3694
1999
  return void 0;
3695
2000
  }
@@ -3704,7 +2009,7 @@ function useChildList(value, onChange) {
3704
2009
  },
3705
2010
  sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
3706
2011
  });
3707
- const hasChildren = useMemo12(
2012
+ const hasChildren = useMemo13(
3708
2013
  () => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
3709
2014
  [canAddField, list.length, Object.keys(objectListValue || {}).length]
3710
2015
  );
@@ -3722,13 +2027,13 @@ function useChildList(value, onChange) {
3722
2027
  // src/components/inputs-values-tree/row.tsx
3723
2028
  var AddObjectChildStrategy = {
3724
2029
  hit: (schema) => schema.type === "object",
3725
- Renderer: () => /* @__PURE__ */ React44.createElement(
2030
+ Renderer: () => /* @__PURE__ */ React25.createElement(
3726
2031
  Input7,
3727
2032
  {
3728
2033
  size: "small",
3729
2034
  disabled: true,
3730
2035
  style: { pointerEvents: "none" },
3731
- value: I18n15.t("Configure via child fields")
2036
+ value: I18n9.t("Configure via child fields")
3732
2037
  }
3733
2038
  )
3734
2039
  };
@@ -3745,23 +2050,23 @@ function InputValueRow(props) {
3745
2050
  hasError,
3746
2051
  readonly
3747
2052
  } = props;
3748
- const [collapse, setCollapse] = useState10(false);
2053
+ const [collapse, setCollapse] = useState7(false);
3749
2054
  const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
3750
2055
  value,
3751
2056
  onUpdateValue
3752
2057
  );
3753
- const strategies = useMemo13(
2058
+ const strategies = useMemo14(
3754
2059
  () => [...hasChildren ? [AddObjectChildStrategy] : [], ...constantProps?.strategies || []],
3755
2060
  [hasChildren, constantProps?.strategies]
3756
2061
  );
3757
- const flowDisplayValue = useMemo13(
2062
+ const flowDisplayValue = useMemo14(
3758
2063
  () => hasChildren ? {
3759
2064
  type: "constant",
3760
2065
  schema: { type: "object" }
3761
2066
  } : value,
3762
2067
  [hasChildren, value]
3763
2068
  );
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(
2069
+ 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
2070
  BlurInput,
3766
2071
  {
3767
2072
  style: { width: 100, minWidth: 100, maxWidth: 100 },
@@ -3769,9 +2074,9 @@ function InputValueRow(props) {
3769
2074
  size: "small",
3770
2075
  value: keyName,
3771
2076
  onChange: (v) => onUpdateKey?.(v),
3772
- placeholder: I18n15.t("Input Key")
2077
+ placeholder: I18n9.t("Input Key")
3773
2078
  }
3774
- ), /* @__PURE__ */ React44.createElement(
2079
+ ), /* @__PURE__ */ React25.createElement(
3775
2080
  InjectDynamicValueInput,
3776
2081
  {
3777
2082
  style: { flexGrow: 1 },
@@ -3784,13 +2089,13 @@ function InputValueRow(props) {
3784
2089
  strategies
3785
2090
  }
3786
2091
  }
3787
- ), /* @__PURE__ */ React44.createElement(UIActions2, null, canAddField && /* @__PURE__ */ React44.createElement(
2092
+ ), /* @__PURE__ */ React25.createElement(UIActions2, null, canAddField && /* @__PURE__ */ React25.createElement(
3788
2093
  IconButton6,
3789
2094
  {
3790
2095
  disabled: readonly,
3791
2096
  size: "small",
3792
2097
  theme: "borderless",
3793
- icon: /* @__PURE__ */ React44.createElement(IconAddChildren2, null),
2098
+ icon: /* @__PURE__ */ React25.createElement(IconAddChildren2, null),
3794
2099
  onClick: () => {
3795
2100
  add({
3796
2101
  type: "constant",
@@ -3800,16 +2105,16 @@ function InputValueRow(props) {
3800
2105
  setCollapse(true);
3801
2106
  }
3802
2107
  }
3803
- ), /* @__PURE__ */ React44.createElement(
2108
+ ), /* @__PURE__ */ React25.createElement(
3804
2109
  IconButton6,
3805
2110
  {
3806
2111
  disabled: readonly,
3807
2112
  theme: "borderless",
3808
- icon: /* @__PURE__ */ React44.createElement(IconDelete3, { size: "small" }),
2113
+ icon: /* @__PURE__ */ React25.createElement(IconDelete3, { size: "small" }),
3809
2114
  size: "small",
3810
2115
  onClick: () => onRemove?.()
3811
2116
  }
3812
- )))), hasChildren && /* @__PURE__ */ React44.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ React44.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ React44.createElement(
2117
+ )))), hasChildren && /* @__PURE__ */ React25.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ React25.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ React25.createElement(
3813
2118
  InputValueRow,
3814
2119
  {
3815
2120
  readonly,
@@ -3841,7 +2146,7 @@ function InputsValuesTree(props) {
3841
2146
  onChange,
3842
2147
  sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
3843
2148
  });
3844
- return /* @__PURE__ */ React45.createElement("div", null, /* @__PURE__ */ React45.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ React45.createElement(
2149
+ return /* @__PURE__ */ React26.createElement("div", null, /* @__PURE__ */ React26.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ React26.createElement(
3845
2150
  InputValueRow,
3846
2151
  {
3847
2152
  key: item.id,
@@ -3854,12 +2159,12 @@ function InputsValuesTree(props) {
3854
2159
  hasError,
3855
2160
  constantProps
3856
2161
  }
3857
- ))), /* @__PURE__ */ React45.createElement(
3858
- Button6,
2162
+ ))), /* @__PURE__ */ React26.createElement(
2163
+ Button7,
3859
2164
  {
3860
2165
  style: { marginTop: 10, marginLeft: 16 },
3861
2166
  disabled: readonly,
3862
- icon: /* @__PURE__ */ React45.createElement(IconPlus5, null),
2167
+ icon: /* @__PURE__ */ React26.createElement(IconPlus5, null),
3863
2168
  size: "small",
3864
2169
  onClick: () => {
3865
2170
  add({
@@ -3869,7 +2174,7 @@ function InputsValuesTree(props) {
3869
2174
  });
3870
2175
  }
3871
2176
  },
3872
- I18n16.t("Add")
2177
+ I18n10.t("Add")
3873
2178
  ));
3874
2179
  }
3875
2180
 
@@ -3975,7 +2280,7 @@ function traverseRef(name, value, cb) {
3975
2280
  }
3976
2281
 
3977
2282
  // src/effects/provide-json-schema-outputs/index.ts
3978
- import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
2283
+ import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
3979
2284
  import {
3980
2285
  ASTFactory as ASTFactory2,
3981
2286
  createEffectFromVariableProvider as createEffectFromVariableProvider2,
@@ -3989,7 +2294,7 @@ var provideJsonSchemaOutputs = createEffectFromVariableProvider2({
3989
2294
  title: getNodeForm2(ctx.node)?.getValueIn("title") || ctx.node.id,
3990
2295
  icon: ctx.node.getNodeRegistry().info?.icon
3991
2296
  },
3992
- type: JsonSchemaUtils8.schemaToAST(value)
2297
+ type: JsonSchemaUtils6.schemaToAST(value)
3993
2298
  })
3994
2299
  ]
3995
2300
  });
@@ -4067,7 +2372,7 @@ var listenRefValueChange = (cb) => [
4067
2372
  ];
4068
2373
 
4069
2374
  // src/effects/listen-ref-schema-change/index.ts
4070
- import { JsonSchemaUtils as JsonSchemaUtils9 } from "@flowgram.ai/json-schema";
2375
+ import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
4071
2376
  import {
4072
2377
  DataEvent as DataEvent5,
4073
2378
  getNodeScope as getNodeScope3
@@ -4083,7 +2388,7 @@ var listenRefSchemaChange = (cb) => [
4083
2388
  const disposable = getNodeScope3(context.node).available.trackByKeyPath(
4084
2389
  value?.content || [],
4085
2390
  (_type) => {
4086
- cb({ ...params, schema: JsonSchemaUtils9.astToSchema(_type) });
2391
+ cb({ ...params, schema: JsonSchemaUtils7.astToSchema(_type) });
4087
2392
  },
4088
2393
  {
4089
2394
  selector: (_v) => _v?.type
@@ -4195,7 +2500,7 @@ var createInferInputsPlugin = defineFormPluginCreator2({
4195
2500
 
4196
2501
  // src/form-plugins/infer-assign-plugin/index.ts
4197
2502
  import { set as set3, uniqBy } from "lodash";
4198
- import { JsonSchemaUtils as JsonSchemaUtils10 } from "@flowgram.ai/json-schema";
2503
+ import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
4199
2504
  import {
4200
2505
  ASTFactory as ASTFactory4,
4201
2506
  createEffectFromVariableProvider as createEffectFromVariableProvider4,
@@ -4226,7 +2531,7 @@ var createInferAssignPlugin = defineFormPluginCreator3({
4226
2531
  properties: declareRows.map(
4227
2532
  (_v) => ASTFactory4.createProperty({
4228
2533
  key: _v.left,
4229
- type: _v.right?.type === "constant" ? JsonSchemaUtils10.schemaToAST(_v.right?.schema || {}) : void 0,
2534
+ type: _v.right?.type === "constant" ? JsonSchemaUtils8.schemaToAST(_v.right?.schema || {}) : void 0,
4230
2535
  initializer: _v.right?.type === "ref" ? ASTFactory4.createKeyPathExpression({
4231
2536
  keyPath: _v.right?.content || []
4232
2537
  }) : {}
@@ -4242,7 +2547,7 @@ var createInferAssignPlugin = defineFormPluginCreator3({
4242
2547
  set3(
4243
2548
  formData,
4244
2549
  outputKey,
4245
- JsonSchemaUtils10.astToSchema(getNodeScope6(ctx.node).output.variables?.[0]?.type)
2550
+ JsonSchemaUtils8.astToSchema(getNodeScope6(ctx.node).output.variables?.[0]?.type)
4246
2551
  );
4247
2552
  return formData;
4248
2553
  });
@@ -4297,6 +2602,7 @@ export {
4297
2602
  CodeEditorMini,
4298
2603
  ConditionRow,
4299
2604
  ConstantInput,
2605
+ DBConditionRow,
4300
2606
  DisplayFlowValue,
4301
2607
  DisplayInputsValueAllInTag,
4302
2608
  DisplayInputsValues,
@@ -4313,7 +2619,7 @@ export {
4313
2619
  JsonEditorWithVariables,
4314
2620
  JsonSchemaEditor,
4315
2621
  JsonSchemaTypePresetProvider,
4316
- JsonSchemaUtils2 as JsonSchemaUtils,
2622
+ JsonSchemaUtils,
4317
2623
  PromptEditor,
4318
2624
  PromptEditorWithInputs,
4319
2625
  PromptEditorWithVariables,