@uipath/apollo-react 6.78.1 → 6.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts +2 -0
  2. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts.map +1 -1
  3. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.d.ts +1 -0
  4. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.d.ts.map +1 -1
  5. package/dist/canvas/components/Guardrails/components/enum-list-chips-field.cjs +2 -1
  6. package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts.map +1 -1
  7. package/dist/canvas/components/Guardrails/components/enum-list-chips-field.js +2 -1
  8. package/dist/canvas/components/Guardrails/components/map-enum-field.cjs +49 -22
  9. package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts.map +1 -1
  10. package/dist/canvas/components/Guardrails/components/map-enum-field.js +50 -23
  11. package/dist/canvas/components/Guardrails/definitions-copy.cjs +536 -0
  12. package/dist/canvas/components/Guardrails/definitions-copy.d.ts.map +1 -1
  13. package/dist/canvas/components/Guardrails/definitions-copy.js +536 -0
  14. package/dist/canvas/components/Guardrails/definitions-enrich.cjs +3 -0
  15. package/dist/canvas/components/Guardrails/definitions-enrich.d.ts.map +1 -1
  16. package/dist/canvas/components/Guardrails/definitions-enrich.js +3 -0
  17. package/dist/canvas/components/Guardrails/definitions-parse.cjs +2 -1
  18. package/dist/canvas/components/Guardrails/definitions-parse.d.ts.map +1 -1
  19. package/dist/canvas/components/Guardrails/definitions-parse.js +2 -1
  20. package/dist/canvas/components/Guardrails/definitions-wire.d.ts +1 -0
  21. package/dist/canvas/components/Guardrails/definitions-wire.d.ts.map +1 -1
  22. package/dist/canvas/components/Guardrails/form-schema-builder.cjs +10 -1
  23. package/dist/canvas/components/Guardrails/form-schema-builder.d.ts +2 -1
  24. package/dist/canvas/components/Guardrails/form-schema-builder.d.ts.map +1 -1
  25. package/dist/canvas/components/Guardrails/form-schema-builder.js +8 -2
  26. package/dist/canvas/components/Guardrails/i18n.cjs +11 -0
  27. package/dist/canvas/components/Guardrails/i18n.d.ts +5 -3
  28. package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
  29. package/dist/canvas/components/Guardrails/i18n.js +11 -0
  30. package/dist/canvas/components/Guardrails/types.d.ts +1 -0
  31. package/dist/canvas/components/Guardrails/types.d.ts.map +1 -1
  32. package/dist/canvas/components/JsonTree/index.cjs +4 -0
  33. package/dist/canvas/components/JsonTree/index.d.ts +1 -1
  34. package/dist/canvas/components/JsonTree/index.d.ts.map +1 -1
  35. package/dist/canvas/components/JsonTree/index.js +2 -2
  36. package/dist/canvas/components/NodeIOView/NodeIOView.cjs +10 -12
  37. package/dist/canvas/components/NodeIOView/NodeIOView.d.ts +1 -1
  38. package/dist/canvas/components/NodeIOView/NodeIOView.d.ts.map +1 -1
  39. package/dist/canvas/components/NodeIOView/NodeIOView.js +12 -14
  40. package/dist/canvas/components/NodeIOView/NodeIOView.types.d.ts +2 -0
  41. package/dist/canvas/components/NodeIOView/NodeIOView.types.d.ts.map +1 -1
  42. package/dist/canvas/components/NodePropertyPanel/NodePropertyPanel.cjs +6 -6
  43. package/dist/canvas/components/NodePropertyPanel/NodePropertyPanel.d.ts.map +1 -1
  44. package/dist/canvas/components/NodePropertyPanel/NodePropertyPanel.js +6 -6
  45. package/dist/canvas/components/NodeVariablesPanel/NodeVariableEditDialog.cjs +405 -0
  46. package/dist/canvas/components/NodeVariablesPanel/NodeVariableEditDialog.d.ts +10 -0
  47. package/dist/canvas/components/NodeVariablesPanel/NodeVariableEditDialog.d.ts.map +1 -0
  48. package/dist/canvas/components/NodeVariablesPanel/NodeVariableEditDialog.js +371 -0
  49. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.cjs +726 -0
  50. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.d.ts +3 -0
  51. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.d.ts.map +1 -0
  52. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.js +692 -0
  53. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.cjs +18 -0
  54. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.d.ts +65 -0
  55. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.d.ts.map +1 -0
  56. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.js +0 -0
  57. package/dist/canvas/components/NodeVariablesPanel/index.cjs +36 -0
  58. package/dist/canvas/components/NodeVariablesPanel/index.d.ts +3 -0
  59. package/dist/canvas/components/NodeVariablesPanel/index.d.ts.map +1 -0
  60. package/dist/canvas/components/NodeVariablesPanel/index.js +2 -0
  61. package/dist/canvas/components/index.cjs +23 -16
  62. package/dist/canvas/components/index.d.ts +1 -0
  63. package/dist/canvas/components/index.d.ts.map +1 -1
  64. package/dist/canvas/components/index.js +1 -0
  65. package/dist/canvas/locales/en.cjs +1 -1
  66. package/dist/canvas/locales/en.d.ts.map +1 -1
  67. package/dist/canvas/locales/en.js +1 -1
  68. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  69. package/dist/chat/styles/tailwind.chat.css +1 -1
  70. package/package.json +2 -2
@@ -0,0 +1,726 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ NodeVariablesPanel: ()=>NodeVariablesPanel
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
+ const external_lucide_react_namespaceObject = require("lucide-react");
32
+ const external_react_namespaceObject = require("react");
33
+ const index_cjs_namespaceObject = require("../../../i18n/index.cjs");
34
+ const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
35
+ const external_JsonTree_index_cjs_namespaceObject = require("../JsonTree/index.cjs");
36
+ const external_NodeVariableEditDialog_cjs_namespaceObject = require("./NodeVariableEditDialog.cjs");
37
+ const SECTIONS = [
38
+ 'inputs',
39
+ 'outputs',
40
+ 'variables',
41
+ 'nodes'
42
+ ];
43
+ const isSourceSection = (section)=>'inputs' === section || 'nodes' === section;
44
+ const SECTION_ICONS = {
45
+ inputs: {
46
+ Icon: external_lucide_react_namespaceObject.ArrowDown,
47
+ className: 'text-info'
48
+ },
49
+ outputs: {
50
+ Icon: external_lucide_react_namespaceObject.ArrowUp,
51
+ className: 'text-success'
52
+ },
53
+ variables: {
54
+ Icon: external_lucide_react_namespaceObject.Variable,
55
+ className: 'text-chart-purple'
56
+ },
57
+ nodes: {
58
+ Icon: external_lucide_react_namespaceObject.SquareStack,
59
+ className: 'text-chart-pink'
60
+ }
61
+ };
62
+ const COUNT_CLASS = 'ml-auto shrink-0 font-mono text-[10px] text-foreground-muted';
63
+ const EMPTY_MESSAGE_CLASS = 'px-3 py-6 text-center text-xs text-foreground-muted';
64
+ const countEntries = (nodes)=>nodes?.filter((node)=>!(0, external_JsonTree_index_cjs_namespaceObject.isArrayItemTemplateRoot)(node)).length ?? 0;
65
+ const VIRTUALIZE_THRESHOLD = 500;
66
+ function exceedsVirtualizeThreshold(nodes) {
67
+ let count = 0;
68
+ const stack = [
69
+ ...nodes.slice(0, VIRTUALIZE_THRESHOLD + 1)
70
+ ];
71
+ while(stack.length > 0){
72
+ const node = stack.pop();
73
+ count += 1;
74
+ if (count > VIRTUALIZE_THRESHOLD) return true;
75
+ for (const child of node.children ?? []){
76
+ stack.push(child);
77
+ if (stack.length + count > VIRTUALIZE_THRESHOLD) return true;
78
+ }
79
+ }
80
+ return false;
81
+ }
82
+ function objectPaths(nodes) {
83
+ const paths = [];
84
+ const stack = [];
85
+ for(let index = nodes.length - 1; index >= 0; index -= 1)stack.push(nodes[index]);
86
+ while(stack.length > 0){
87
+ const node = stack.pop();
88
+ if ('object' !== node.type || !node.children || 'number' == typeof node.segments[0]) continue;
89
+ paths.push(node.path);
90
+ for(let index = node.children.length - 1; index >= 0; index -= 1)stack.push(node.children[index]);
91
+ }
92
+ return paths;
93
+ }
94
+ function emptyValueFor(schema) {
95
+ const type = (0, external_JsonTree_index_cjs_namespaceObject.schemaDisplayType)(schema);
96
+ if ('object' === type) return {};
97
+ if ('array' === type) return [];
98
+ return 'null' === type ? null : void 0;
99
+ }
100
+ function buildSourceTree(sources) {
101
+ const properties = Object.fromEntries(sources.map((source)=>[
102
+ source.id,
103
+ source.schema ?? {}
104
+ ]));
105
+ const value = Object.fromEntries(sources.flatMap((source)=>{
106
+ const entry = source.value ?? emptyValueFor(source.schema);
107
+ return void 0 === entry ? [] : [
108
+ [
109
+ source.id,
110
+ entry
111
+ ]
112
+ ];
113
+ }));
114
+ return (0, external_JsonTree_index_cjs_namespaceObject.buildJsonTree)({
115
+ schema: {
116
+ type: 'object',
117
+ properties
118
+ },
119
+ value
120
+ });
121
+ }
122
+ function useScrollEdges() {
123
+ const ref = (0, external_react_namespaceObject.useRef)(null);
124
+ const contentRef = (0, external_react_namespaceObject.useRef)(null);
125
+ const [edges, setEdges] = (0, external_react_namespaceObject.useState)({
126
+ top: false,
127
+ bottom: false
128
+ });
129
+ const update = (0, external_react_namespaceObject.useCallback)(()=>{
130
+ const element = ref.current;
131
+ if (!element) return;
132
+ const top = element.scrollTop > 0;
133
+ const bottom = element.scrollTop + element.clientHeight < element.scrollHeight - 1;
134
+ setEdges((current)=>current.top === top && current.bottom === bottom ? current : {
135
+ top,
136
+ bottom
137
+ });
138
+ }, []);
139
+ (0, external_react_namespaceObject.useEffect)(()=>{
140
+ const element = ref.current;
141
+ if (!element) return;
142
+ update();
143
+ if ("u" < typeof ResizeObserver) return;
144
+ const observer = new ResizeObserver(update);
145
+ observer.observe(element);
146
+ if (contentRef.current) observer.observe(contentRef.current);
147
+ return ()=>observer.disconnect();
148
+ }, [
149
+ update
150
+ ]);
151
+ return {
152
+ ref,
153
+ contentRef,
154
+ edges,
155
+ onScroll: update
156
+ };
157
+ }
158
+ function variableTypeOf(schema, value) {
159
+ const declared = (0, external_JsonTree_index_cjs_namespaceObject.schemaDisplayType)(schema);
160
+ const type = declared && 'null' !== declared ? declared : Array.isArray(value) ? 'array' : null === value ? 'string' : typeof value;
161
+ return 'number' === type || 'boolean' === type || 'object' === type || 'array' === type ? type : 'string';
162
+ }
163
+ function rowFor(section, node) {
164
+ return isSourceSection(section) ? {
165
+ section,
166
+ nodeId: String(node.segments[0]),
167
+ node
168
+ } : {
169
+ section,
170
+ node
171
+ };
172
+ }
173
+ const isTopLevelVariable = ({ section, node })=>('outputs' === section || 'variables' === section) && 1 === node.segments.length && 'string' == typeof node.segments[0];
174
+ function siblingKeys(tree, targetPath) {
175
+ const keysOf = (nodes)=>new Set(nodes.map((node)=>node.key));
176
+ if (tree.some((node)=>node.path === targetPath)) return keysOf(tree);
177
+ const stack = [
178
+ ...tree
179
+ ];
180
+ while(stack.length > 0){
181
+ const node = stack.pop();
182
+ if (!node.children) continue;
183
+ if (node.children.some((child)=>child.path === targetPath)) return keysOf(node.children);
184
+ for (const child of node.children)stack.push(child);
185
+ }
186
+ return new Set();
187
+ }
188
+ function NodeVariablesPanel({ inputs = [], outputs, variables, nodes = [], outputsBasePath, variablesBasePath, referencePrefix = '$vars', pathForCopy, defaultExpandedSections = [
189
+ 'nodes'
190
+ ], filters, activeFilterId: activeFilterIdProp, defaultActiveFilterId = null, onActiveFilterChange, onFocusNode, onAdd, isVariableRow = isTopLevelVariable, onEditVariable, onRequestEditVariable, onDeleteVariable, onCopy, leading, rowWrapper, deriveTypeIcon, children, className }) {
191
+ const { _ } = (0, index_cjs_namespaceObject.useSafeLingui)();
192
+ const trees = (0, external_react_namespaceObject.useMemo)(()=>({
193
+ inputs: buildSourceTree(inputs),
194
+ outputs: (0, external_JsonTree_index_cjs_namespaceObject.buildJsonTree)({
195
+ schema: outputs?.schema,
196
+ value: outputs?.value,
197
+ basePath: outputsBasePath
198
+ }),
199
+ variables: (0, external_JsonTree_index_cjs_namespaceObject.buildJsonTree)({
200
+ schema: variables?.schema,
201
+ value: variables?.value,
202
+ basePath: variablesBasePath
203
+ }),
204
+ nodes: buildSourceTree(nodes)
205
+ }), [
206
+ inputs,
207
+ outputs,
208
+ outputsBasePath,
209
+ variables,
210
+ variablesBasePath,
211
+ nodes
212
+ ]);
213
+ const sourcesById = (0, external_react_namespaceObject.useMemo)(()=>({
214
+ inputs: new Map(inputs.map((source)=>[
215
+ source.id,
216
+ source
217
+ ])),
218
+ nodes: new Map(nodes.map((source)=>[
219
+ source.id,
220
+ source
221
+ ]))
222
+ }), [
223
+ inputs,
224
+ nodes
225
+ ]);
226
+ const [openSections, setOpenSections] = (0, external_react_namespaceObject.useState)(()=>new Set(defaultExpandedSections));
227
+ const [openPaths, setOpenPaths] = (0, external_react_namespaceObject.useState)({
228
+ inputs: {},
229
+ outputs: {},
230
+ variables: {},
231
+ nodes: {}
232
+ });
233
+ const collapsed = (0, external_react_namespaceObject.useMemo)(()=>Object.fromEntries(SECTIONS.map((section)=>[
234
+ section,
235
+ Object.fromEntries((0, external_JsonTree_index_cjs_namespaceObject.collectContainerPaths)(trees[section]).map(({ path })=>[
236
+ path,
237
+ !(0, external_JsonTree_index_cjs_namespaceObject.isPathCollapsed)(openPaths[section], path)
238
+ ]))
239
+ ])), [
240
+ trees,
241
+ openPaths
242
+ ]);
243
+ const virtualize = (0, external_react_namespaceObject.useMemo)(()=>Object.fromEntries(SECTIONS.map((section)=>[
244
+ section,
245
+ exceedsVirtualizeThreshold(trees[section])
246
+ ])), [
247
+ trees
248
+ ]);
249
+ const [scroller, setScroller] = (0, external_react_namespaceObject.useState)(null);
250
+ const [query, setQuery] = (0, external_react_namespaceObject.useState)('');
251
+ const [uncontrolledFilterId, setUncontrolledFilterId] = (0, external_react_namespaceObject.useState)(defaultActiveFilterId);
252
+ const activeFilterId = void 0 !== activeFilterIdProp ? activeFilterIdProp : uncontrolledFilterId;
253
+ const changeFilter = (id)=>{
254
+ if (void 0 === activeFilterIdProp) setUncontrolledFilterId(id);
255
+ onActiveFilterChange?.(id);
256
+ };
257
+ const [editing, setEditing] = (0, external_react_namespaceObject.useState)(null);
258
+ const referenceFor = (0, external_react_namespaceObject.useCallback)((path, segments)=>{
259
+ const prefixed = referencePrefix && path ? `${referencePrefix}${path.startsWith('[') ? '' : '.'}${path}` : path || referencePrefix;
260
+ return pathForCopy ? pathForCopy(prefixed, segments) : prefixed;
261
+ }, [
262
+ referencePrefix,
263
+ pathForCopy
264
+ ]);
265
+ const search = query.trim();
266
+ const activeFilter = filters?.find((filter)=>filter.id === activeFilterId);
267
+ const narrowing = !!search || !!activeFilter;
268
+ const toolbarFilters = (0, external_react_namespaceObject.useMemo)(()=>filters?.map(({ id, label })=>({
269
+ id,
270
+ label,
271
+ predicate: ()=>true
272
+ })), [
273
+ filters
274
+ ]);
275
+ const filterPredicates = (0, external_react_namespaceObject.useMemo)(()=>activeFilter ? Object.fromEntries(SECTIONS.map((section)=>[
276
+ section,
277
+ (node)=>activeFilter.predicate(rowFor(section, node))
278
+ ])) : void 0, [
279
+ activeFilter
280
+ ]);
281
+ const decorateSource = (0, external_react_namespaceObject.useMemo)(()=>{
282
+ const decorate = (section)=>(node)=>{
283
+ if (1 !== node.segments.length) return;
284
+ const source = sourcesById[section].get(String(node.segments[0]));
285
+ if (!source) return;
286
+ const count = source.outputCount ?? countEntries(node.children);
287
+ const countLabel = _({
288
+ id: 'canvas.node_variables_panel.node_output_count',
289
+ message: '{count, plural, one {# output} other {# outputs}}',
290
+ values: {
291
+ count
292
+ }
293
+ });
294
+ return {
295
+ label: source.label,
296
+ sublabel: source.id,
297
+ sublabelOnHover: true,
298
+ badge: {
299
+ icon: source.icon
300
+ },
301
+ hideCount: true,
302
+ hideValue: true,
303
+ meta: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
304
+ content: countLabel,
305
+ placement: "top",
306
+ delay: true,
307
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
308
+ role: "img",
309
+ "aria-label": countLabel,
310
+ className: COUNT_CLASS,
311
+ children: [
312
+ "(",
313
+ count,
314
+ ")"
315
+ ]
316
+ })
317
+ })
318
+ };
319
+ };
320
+ return {
321
+ inputs: decorate('inputs'),
322
+ nodes: decorate('nodes')
323
+ };
324
+ }, [
325
+ sourcesById,
326
+ _
327
+ ]);
328
+ const visibleCount = (0, external_react_namespaceObject.useMemo)(()=>Object.fromEntries(SECTIONS.map((section)=>[
329
+ section,
330
+ narrowing ? (0, external_JsonTree_index_cjs_namespaceObject.flattenJsonTree)(trees[section], {
331
+ collapsed: {},
332
+ query: search,
333
+ filterPredicate: filterPredicates?.[section],
334
+ displayTexts: isSourceSection(section) ? decorateSource[section] : void 0
335
+ }).length : 1
336
+ ])), [
337
+ narrowing,
338
+ trees,
339
+ search,
340
+ filterPredicates,
341
+ decorateSource
342
+ ]);
343
+ const totalCount = {
344
+ inputs: inputs.length,
345
+ outputs: countEntries(trees.outputs),
346
+ variables: countEntries(trees.variables),
347
+ nodes: nodes.length
348
+ };
349
+ const sectionOpen = (section)=>narrowing || openSections.has(section);
350
+ const setSectionOpen = (section, open)=>setOpenSections((current)=>{
351
+ const next = new Set(current);
352
+ if (open) next.add(section);
353
+ else next.delete(section);
354
+ return next;
355
+ });
356
+ const toggleCollapsed = (section)=>(path)=>setOpenPaths((current)=>({
357
+ ...current,
358
+ [section]: {
359
+ ...current[section],
360
+ [path]: (0, external_JsonTree_index_cjs_namespaceObject.isPathCollapsed)(collapsed[section], path)
361
+ }
362
+ }));
363
+ const expandableSections = SECTIONS.filter((section)=>totalCount[section] > 0);
364
+ const expandablePaths = (0, external_react_namespaceObject.useMemo)(()=>Object.fromEntries(SECTIONS.map((section)=>[
365
+ section,
366
+ objectPaths(trees[section])
367
+ ])), [
368
+ trees
369
+ ]);
370
+ const allExpanded = expandableSections.length > 0 && expandableSections.every((section)=>openSections.has(section)) && SECTIONS.every((section)=>expandablePaths[section].every((path)=>!(0, external_JsonTree_index_cjs_namespaceObject.isPathCollapsed)(collapsed[section], path)));
371
+ const toggleAll = ()=>{
372
+ const open = !allExpanded;
373
+ setOpenSections(open ? new Set(expandableSections) : new Set());
374
+ setOpenPaths((current)=>Object.fromEntries(SECTIONS.map((section)=>[
375
+ section,
376
+ {
377
+ ...current[section],
378
+ ...Object.fromEntries(expandablePaths[section].map((path)=>[
379
+ path,
380
+ open
381
+ ]))
382
+ }
383
+ ])));
384
+ };
385
+ const sourceActions = (section)=>(node, ctx)=>{
386
+ if (1 !== node.segments.length) return ctx.defaultActions;
387
+ const source = sourcesById[section].get(String(node.segments[0]));
388
+ const label = source?.label ?? node.key;
389
+ const actions = [];
390
+ if (onAdd && source?.addable !== false) actions.push({
391
+ id: 'add-to-node',
392
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {}),
393
+ label: _({
394
+ id: 'canvas.node_variables_panel.add_to_node_label',
395
+ message: 'Add from {label}',
396
+ values: {
397
+ label
398
+ }
399
+ }),
400
+ tooltip: _({
401
+ id: 'canvas.node_variables_panel.add_to_node',
402
+ message: 'Add'
403
+ }),
404
+ persistent: true,
405
+ onSelect: ()=>onAdd(section, node.key)
406
+ });
407
+ if (onFocusNode) actions.unshift({
408
+ id: 'focus-node',
409
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MousePointerClick, {}),
410
+ label: _({
411
+ id: 'canvas.node_variables_panel.focus_node_label',
412
+ message: 'Focus on {label}',
413
+ values: {
414
+ label
415
+ }
416
+ }),
417
+ tooltip: _({
418
+ id: 'canvas.node_variables_panel.focus_node',
419
+ message: 'Focus on node'
420
+ }),
421
+ persistent: true,
422
+ placement: 'start',
423
+ onSelect: ()=>onFocusNode(node.key)
424
+ });
425
+ return actions;
426
+ };
427
+ const openEditDialog = (row)=>{
428
+ const { schema, value } = row.node;
429
+ setEditing({
430
+ row,
431
+ details: {
432
+ id: row.node.key,
433
+ type: variableTypeOf(schema, value),
434
+ description: schema?.description,
435
+ defaultValue: schema && Object.hasOwn(schema, 'default') ? schema.default : value
436
+ }
437
+ });
438
+ };
439
+ const variableActions = (row, ctx)=>{
440
+ const { node } = row;
441
+ const actions = [
442
+ ...ctx.defaultActions
443
+ ];
444
+ if (onRequestEditVariable || onEditVariable) actions.push({
445
+ id: 'edit-variable',
446
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Pencil, {}),
447
+ label: _({
448
+ id: 'canvas.node_variables_panel.edit_variable',
449
+ message: 'Edit {name}',
450
+ values: {
451
+ name: node.key
452
+ }
453
+ }),
454
+ onSelect: ()=>onRequestEditVariable ? onRequestEditVariable(row) : openEditDialog(row)
455
+ });
456
+ if (onDeleteVariable) actions.push({
457
+ id: 'delete-variable',
458
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {}),
459
+ label: _({
460
+ id: 'canvas.node_variables_panel.delete_variable',
461
+ message: 'Delete {name}',
462
+ values: {
463
+ name: node.key
464
+ }
465
+ }),
466
+ tone: 'error',
467
+ onSelect: ()=>onDeleteVariable(row)
468
+ });
469
+ return actions;
470
+ };
471
+ const actionsFor = (section)=>(node, ctx)=>{
472
+ if (isSourceSection(section) && 1 === node.segments.length) return sourceActions(section)(node, ctx);
473
+ const row = rowFor(section, node);
474
+ return !node.isArrayItemTemplate && isVariableRow(row) ? variableActions(row, ctx) : ctx.defaultActions;
475
+ };
476
+ const renamedReference = ({ section, node })=>(id)=>{
477
+ const basePath = 'outputs' === section ? outputsBasePath ?? '' : 'variables' === section ? variablesBasePath ?? '' : '';
478
+ const parentSegments = node.segments.slice(0, -1);
479
+ const path = [
480
+ ...parentSegments,
481
+ id
482
+ ].reduce(external_JsonTree_index_cjs_namespaceObject.appendPathSegment, basePath);
483
+ return referenceFor(path, [
484
+ ...parentSegments,
485
+ id
486
+ ]);
487
+ };
488
+ const sectionName = {
489
+ inputs: _({
490
+ id: 'canvas.node_variables_panel.section_inputs',
491
+ message: 'Inputs'
492
+ }),
493
+ outputs: _({
494
+ id: 'canvas.node_variables_panel.section_outputs',
495
+ message: 'Outputs'
496
+ }),
497
+ variables: _({
498
+ id: 'canvas.node_variables_panel.section_variables',
499
+ message: 'Variables'
500
+ }),
501
+ nodes: _({
502
+ id: 'canvas.node_variables_panel.section_nodes',
503
+ message: 'Nodes'
504
+ })
505
+ };
506
+ const sectionCountLabel = (section, count)=>({
507
+ inputs: _({
508
+ id: 'canvas.node_variables_panel.count_inputs',
509
+ message: '{count, plural, one {# input} other {# inputs}}',
510
+ values: {
511
+ count
512
+ }
513
+ }),
514
+ outputs: _({
515
+ id: 'canvas.node_variables_panel.count_outputs',
516
+ message: '{count, plural, one {# output} other {# outputs}}',
517
+ values: {
518
+ count
519
+ }
520
+ }),
521
+ variables: _({
522
+ id: 'canvas.node_variables_panel.count_variables',
523
+ message: '{count, plural, one {# variable} other {# variables}}',
524
+ values: {
525
+ count
526
+ }
527
+ }),
528
+ nodes: _({
529
+ id: 'canvas.node_variables_panel.count_nodes',
530
+ message: '{count, plural, one {# node} other {# nodes}}',
531
+ values: {
532
+ count
533
+ }
534
+ })
535
+ })[section];
536
+ const addLabel = (section)=>({
537
+ outputs: _({
538
+ id: 'canvas.node_variables_panel.add_outputs',
539
+ message: 'Add outputs'
540
+ }),
541
+ variables: _({
542
+ id: 'canvas.node_variables_panel.add_variables',
543
+ message: 'Add variables'
544
+ })
545
+ })[section];
546
+ const renderTree = (section)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTree_index_cjs_namespaceObject.JsonTreeView, {
547
+ nodes: trees[section],
548
+ collapsed: search ? {} : collapsed[section],
549
+ onToggleCollapsed: search ? void 0 : toggleCollapsed(section),
550
+ query: search,
551
+ filterPredicate: filterPredicates?.[section],
552
+ readOnly: true,
553
+ decorateNode: isSourceSection(section) ? decorateSource[section] : void 0,
554
+ deriveTypeIcon: deriveTypeIcon,
555
+ rowWrapper: rowWrapper,
556
+ nodeActions: actionsFor(section),
557
+ maxInlineActions: 4,
558
+ pathForCopy: referenceFor,
559
+ onCopy: onCopy,
560
+ virtualized: virtualize[section],
561
+ scrollElement: virtualize[section] ? scroller : void 0,
562
+ className: "h-auto py-1"
563
+ });
564
+ const renderSection = (section)=>{
565
+ if (narrowing && 0 === visibleCount[section]) return null;
566
+ const open = sectionOpen(section);
567
+ const name = sectionName[section];
568
+ const count = totalCount[section];
569
+ const { Icon, className: iconClassName } = SECTION_ICONS[section];
570
+ const addable = ('outputs' === section || 'variables' === section) && onAdd ? section : null;
571
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Collapsible, {
572
+ open: open,
573
+ onOpenChange: (next)=>setSectionOpen(section, next),
574
+ disabled: narrowing,
575
+ asChild: true,
576
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("section", {
577
+ "aria-label": name,
578
+ className: "mb-2 overflow-hidden rounded-lg border border-surface-overlay bg-surface-overlay/40",
579
+ children: [
580
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
581
+ className: (0, apollo_wind_namespaceObject.cn)('flex h-9 items-center gap-2 pr-1 pl-2', open && trees[section].length > 0 && 'border-b border-surface-overlay/80'),
582
+ children: [
583
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.CollapsibleTrigger, {
584
+ className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-left disabled:cursor-default",
585
+ children: [
586
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronDown, {
587
+ size: 10,
588
+ className: (0, apollo_wind_namespaceObject.cn)('shrink-0 text-foreground-subtle transition-transform', !open && '-rotate-90')
589
+ }),
590
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
591
+ className: (0, apollo_wind_namespaceObject.cn)('grid size-4.5 shrink-0 place-items-center', iconClassName),
592
+ "aria-hidden": "true",
593
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Icon, {
594
+ size: 14
595
+ })
596
+ }),
597
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
598
+ className: "truncate text-xs font-semibold tracking-[0.02em] text-foreground",
599
+ children: name
600
+ })
601
+ ]
602
+ }),
603
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
604
+ content: sectionCountLabel(section, count),
605
+ placement: "top",
606
+ delay: true,
607
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
608
+ role: "img",
609
+ "aria-label": sectionCountLabel(section, count),
610
+ className: COUNT_CLASS,
611
+ children: [
612
+ "(",
613
+ count,
614
+ ")"
615
+ ]
616
+ })
617
+ }),
618
+ addable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
619
+ variant: "ghost",
620
+ size: "4xs",
621
+ icon: true,
622
+ "aria-label": addLabel(addable),
623
+ onClick: ()=>onAdd?.(addable),
624
+ className: "shrink-0 rounded text-foreground-subtle hover:bg-surface-raised hover:text-foreground [&_svg]:size-2.75",
625
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {})
626
+ }),
627
+ onAdd && !addable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
628
+ "aria-hidden": "true",
629
+ className: "size-5 shrink-0"
630
+ })
631
+ ]
632
+ }),
633
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.CollapsibleContent, {
634
+ className: "bg-surface/30",
635
+ children: trees[section].length > 0 && renderTree(section)
636
+ })
637
+ ]
638
+ })
639
+ }, section);
640
+ };
641
+ const { ref: scrollRef, contentRef, edges, onScroll } = useScrollEdges();
642
+ const setScrollRef = (0, external_react_namespaceObject.useCallback)((element)=>{
643
+ scrollRef.current = element;
644
+ setScroller(element);
645
+ }, [
646
+ scrollRef
647
+ ]);
648
+ const nothingVisible = narrowing && SECTIONS.every((section)=>0 === visibleCount[section]);
649
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
650
+ className: (0, apollo_wind_namespaceObject.cn)('flex min-h-0 flex-1 flex-col', className),
651
+ children: [
652
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTree_index_cjs_namespaceObject.JsonTreeToolbar, {
653
+ query: query,
654
+ onQueryChange: setQuery,
655
+ searchPlaceholder: _({
656
+ id: 'canvas.node_variables_panel.search_placeholder',
657
+ message: 'Search variables'
658
+ }),
659
+ filters: toolbarFilters,
660
+ activeFilterId: activeFilter ? activeFilterId : null,
661
+ onFilterChange: changeFilter,
662
+ allCollapsed: !allExpanded,
663
+ onToggleAll: search ? void 0 : toggleAll,
664
+ leading: leading,
665
+ className: "shrink-0 pt-4 pb-2 [padding-inline:var(--mf-content-inset,1rem)]"
666
+ }),
667
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
668
+ className: "min-h-0 flex-1 overflow-hidden text-foreground",
669
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
670
+ className: "relative mt-1 mb-4 h-[calc(100%-1.25rem)] min-h-0 [margin-inline:var(--mf-content-inset,1rem)]",
671
+ children: [
672
+ edges.top && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
673
+ "aria-hidden": "true",
674
+ "data-edge": "top",
675
+ className: "pointer-events-none absolute inset-x-0 top-0 z-10 h-2 rounded-t-lg border-t border-surface-overlay"
676
+ }),
677
+ edges.bottom && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
678
+ "aria-hidden": "true",
679
+ "data-edge": "bottom",
680
+ className: "pointer-events-none absolute inset-x-0 bottom-0 z-10 h-2 rounded-b-lg border-b border-surface-overlay"
681
+ }),
682
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
683
+ ref: setScrollRef,
684
+ onScroll: onScroll,
685
+ className: "h-full min-h-0 overflow-y-auto rounded-lg pb-1",
686
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
687
+ ref: contentRef,
688
+ children: [
689
+ SECTIONS.map(renderSection),
690
+ nothingVisible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
691
+ className: EMPTY_MESSAGE_CLASS,
692
+ children: search ? _({
693
+ id: 'canvas.node_variables_panel.no_matches',
694
+ message: 'No variables match your search.'
695
+ }) : activeFilter?.emptyMessage ?? _({
696
+ id: 'canvas.node_variables_panel.filter_empty',
697
+ message: 'No variables match this filter.'
698
+ })
699
+ }),
700
+ children
701
+ ]
702
+ })
703
+ })
704
+ ]
705
+ })
706
+ }),
707
+ editing && onEditVariable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_NodeVariableEditDialog_cjs_namespaceObject.NodeVariableEditDialog, {
708
+ variable: editing.details,
709
+ takenNames: siblingKeys(trees[editing.row.section], editing.row.node.path),
710
+ referenceFor: renamedReference(editing.row),
711
+ onSave: (next)=>{
712
+ onEditVariable(editing.row, next);
713
+ setEditing(null);
714
+ },
715
+ onClose: ()=>setEditing(null)
716
+ }, editing.row.node.path)
717
+ ]
718
+ });
719
+ }
720
+ exports.NodeVariablesPanel = __webpack_exports__.NodeVariablesPanel;
721
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
722
+ "NodeVariablesPanel"
723
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
724
+ Object.defineProperty(exports, '__esModule', {
725
+ value: true
726
+ });