@oomol-lab/open-flow 0.1.0-beta.54 → 0.1.0-beta.56
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.
- package/README.md +1 -1
- package/dist/browser/{createResourceDialog-BsaBMf7_.js → createResourceDialog-Btjes3wD.js} +3 -3
- package/dist/browser/{main-BPABKzwN.js → dist-BFmpkX4P.js} +9 -1
- package/dist/browser/flow-authoring-edge.d.ts +3 -3
- package/dist/browser/flow-authoring-node.d.ts +29 -44
- package/dist/browser/flow-authoring.d.ts +1 -1
- package/dist/browser/flow-authoring.js +418 -12018
- package/dist/browser/flow-change-schema.d.ts +1 -1
- package/dist/browser/flow-change.d.ts +15 -100
- package/dist/browser/flow-change.js +3175 -383
- package/dist/browser/{flowChanges-CcscgZsW.js → flowChanges-BxutPLYO.js} +23382 -27177
- package/dist/browser/{flowWorkspace-CoT_ewLX.js → flowWorkspace-Dg4mqfa6.js} +3307 -595
- package/dist/browser/{icons-0s-Q_3lp.js → icons-p2A9zs8t.js} +4403 -354
- package/dist/browser/lib-DrKav3HG.js +11403 -0
- package/dist/browser/{markdownContent-D3FFc-u_.js → markdownContent-frwDfQQU.js} +1 -2
- package/dist/browser/preview.css +375 -322
- package/dist/browser/preview.js +16796 -13483
- package/dist/browser/theme.css +1 -0
- package/dist/browser/ui-idTooltip.d.ts +11 -0
- package/dist/browser/ui.css +30 -0
- package/dist/browser/ui.d.ts +5 -0
- package/dist/browser/ui.js +87 -4
- package/dist/browser/workbench.css +375 -322
- package/dist/browser/workbench.js +213 -414
- package/dist/browser/{workbenchSelect-BqUPacsr.js → workbenchSelect-LRp_Xjeq.js} +1 -1
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/control-api-conformance.js +3686 -3594
- package/dist/common/control-api.d.ts +6 -6
- package/dist/common/control-api.js +3760 -3645
- package/dist/common/control-requests.js +2382 -3118
- package/dist/common/decision.d.ts +47 -0
- package/dist/common/decision.js +10109 -0
- package/dist/common/flow-agent.d.ts +1 -1
- package/dist/common/flow-connectionUsage.d.ts +1 -2
- package/dist/common/flow-encoding.d.ts +2 -4
- package/dist/common/flow-encoding.js +3206 -286
- package/dist/common/flow-graph.d.ts +10 -10
- package/dist/common/flow-semantics.d.ts +4 -9
- package/dist/common/flow-semantics.js +9200 -9132
- package/dist/common/flowInspection.d.ts +3 -21
- package/dist/common/integration-trigger.js +6251 -6094
- package/dist/common/mcp.d.ts +0 -1
- package/dist/common/mcp.js +3729 -3627
- package/dist/common/openapi.js +6402 -6245
- package/dist/common/poll-trigger.js +6433 -6252
- package/dist/common/run-events.js +1 -1
- package/dist/common/runtime-contract.d.ts +8 -0
- package/dist/common/scheduler.d.ts +3 -9
- package/dist/common/scheduler.js +3263 -3153
- package/dist/common/webhook-trigger.js +6402 -6245
- package/package.json +5 -1
- package/dist/browser/dist-BDBTOgS5.js +0 -9
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
|
|
2
|
-
import { $
|
|
2
|
+
import { $t as InputGroupInput, A as datePickerValue, Bt as PopoverContent, C as valueForEditor, D as calendarChange, E as typeOfSchema, En as decodeResultList, F as feishuResourceKind, G as semanticNodeIcon, Gn as Checkbox, Gt as PopoverTrigger, H as resourceData, Ht as PopoverHeader, I as supportsFeishuChatFilter, It as IdTooltip, J as providerIcon, Jt as VirtualScrollArea, K as triggerNodeIcon, Kn as IconThemeContext, Kt as NativeScrollArea, Ln as inputValue, Lt as followWorkbenchLink, Mn as isJsonObject, Nn as triggerConfigValue, O as calendarDate, On as resolutionOutputPorts, P as indexAddNodeOptions, Pn as triggerConfigValues, Q as useIconifyData, Qt as InputGroupAddon, R as mapSource, Rt as Switch, S as schemaForEditor, Sn as errorNotice, T as isUnconstrainedSchema, U as resourceValue, Ut as PopoverPanelContent, V as observeResource, Vt as PopoverDescription, W as designerGraph, Wn as controlErrorCode, Wt as PopoverTitle, X as IconifyProvider, Xt as useTriggerFocusGuards, Y as ContentIcon, Yt as Z$2, Z as useIconifyCollectionLoader, Zt as InputGroup, _n as fr_default$1, an as EmptyTitle, at as openApiFieldIssues, b as editorComponent, bn as FeishuEventPicker, cn as SourceSelect, ct as selectOperation, dn as waitBranchDescription, en as Empty, et as canCancelRun, fn as zh_TW_default$1, gn as ja_default$1, gt as schemaMismatchMessage, hn as ko_default$1, ht as diagnosticNodeId, in as EmptyMedia, it as object, j as isDateFormat, jn as triggerOutputDefinitions, k as datePickerChange, kn as sourceOutputLabel, ln as createI18n$1, lt as serverAddress, mn as ru_default$1, mt as diagnosticMessage, n as agentTool, nn as EmptyDescription, nt as revisionView, ot as openApiTask, pn as zh_CN_default$1, q as actionSummary, qt as ScrollArea, rn as EmptyHeader, rt as listOperations, sn as SourceForm, st as securityOptions, tn as EmptyContent, tt as hasRunFilter, un as uiLocales, ut as servers, vn as en_default$1, vt as connectionCatalog, w as getDefaultValue, x as editorGroups, xn as EventSourceSetup, y as defaultValueEditorSchema, yn as I18n, zt as Popover } from "./flowChanges-BxutPLYO.js";
|
|
3
3
|
import { a as derive, c as strictEqual, i as compute, l as val, n as attachSetter, r as combine, s as readonlyVal } from "./dist-bO8nvHFH.js";
|
|
4
|
-
import {
|
|
5
|
-
import { $
|
|
6
|
-
import { i as isString, n as isBoolean, r as isPlainObject, t as isArray$1 } from "./dist-BDBTOgS5.js";
|
|
4
|
+
import { c as useLang, i as isString, l as useTranslate, n as isBoolean, o as I18nProvider, r as isPlainObject, s as useI18n, t as isArray$1, u as useVal } from "./dist-BFmpkX4P.js";
|
|
5
|
+
import { $n as require_builtin_esm_external_require_react, $r as none$1, $t as inertValue, Ai as formatErrorMessage, An as useTriggerDataForwarding, Ar as ChevronDown, At as ARROW_DOWN, B as operatorsForType, Bn as FloatingTreeStore, Br as createChangeEventDetails, Bt as VERTICAL_KEYS, C as FieldDescription, Ci as EMPTY_OBJECT, Cn as useSyncedFloatingRootContext, Cr as contains, Ct as SelectSeparator, Di as useButton, Dn as PopupTriggerMap, Dr as isMac$1, Dt as IndexGuessBehavior, E as FieldLabel, Ei as useMergedRefs, En as popupStoreSelectors, Er as isFirefox, Et as Separator, F as comparisonIssue, Fi as useRefWithInit, Fn as FloatingNode, Fr as useAnimationsFinished, Ft as COMPOSITE_KEYS, G as webhookMethods, Gn as FocusGuard, Gr as escapeKey, Gt as useAnchoredPopupScrollLock, H as unaryOperator, Hr as cancelOpen, Ht as isNativeInput, Ii as getParentNode, In as FloatingTree, Ir as TransitionStatusDataAttributes, Jn as Store, Jr as inputChange, Jt as InternalBackdrop, K as webhookSupportsBody, Kn as addEventListener, Kt as usePositioner, Li as isElement, Ln as useFloatingNodeId, Lr as transitionStatusMapping, Lt as HORIZONTAL_KEYS, Mi as useIsoLayoutEffect, Mn as useDismiss, Mr as createLucideIcon, Mt as ARROW_LEFT, Ni as SafeReact, Nn as useClick, Nr as useTransitionStatus, Nt as ARROW_RIGHT, Oi as CompositeRootContext, On as useImplicitActiveTrigger, Or as ownerDocument, Ot as useCompositeListItem, Pi as useStableCallback, Pn as FloatingFocusManager, Pr as useOpenChangeComplete, Pt as ARROW_UP, Q as limitDecisionQuestions, Qn as require_with_selector, Qr as listNavigation, Qt as CompositeList, R as nodeInputMappings, Ri as isHTMLElement, Rn as useFloatingParentNodeId, Rt as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, S as Field, Si as EMPTY_ARRAY$1, Sn as useFocus$1, Sr as activeElement, St as SelectItem, T as FieldGroup, Ti as warn, Tn as createInitialPopupStoreState, Tr as isAndroid, Tt as SelectValue, U as valueType, Un as DROPDOWN_COLLISION_AVOIDANCE, Ur as clearPress, Ut as scrollIntoViewIfNeeded, Vn as FloatingPortal, Vr as createGenericEventDetails, Vt as VERTICAL_KEYS_WITH_EXTRA_KEYS, W as decodeRevisionContent, Wn as POPUP_COLLISION_AVOIDANCE, Wr as closePress, Wt as useToolbarRootContext, X as decisionTask, Xn as fastComponent, Xr as inputPress, Xt as adaptiveOrigin, Y as decisionQuestionIssues, Yn as useStore$1, Yr as inputClear, Yt as useAnchorPositioning, Z as defaultDecisionQuestion, Zn as fastComponentRef, Zr as itemPress, Zt as useDirection, _ as TooltipPositioner, _i as buttonVariants, _n as useRole, _r as getMinListIndex, a as DialogDescription, ai as useLabelableContext, an as useOpenInteractionType, b as TooltipRoot, bi as clsx, bn as useHoverReferenceInteraction, br as stopEvent$1, bt as SelectContent, c as DialogTitle, ci as useFieldRootContext, cn as stringifyAsLabel, d as TooltipContent, di as DEFAULT_FIELD_STATE_ATTRIBUTES, dn as defaultItemEquality, dr as createGridCellMap, en as getPseudoElementBounds, er as createSelector, et as matchesSchema, f as TooltipProvider, fi as fieldValidityMapping, fn as findItemIndex, fr as findNonDisabledListIndex, g as TooltipPopup, gi as Button$1, gn as useTypeahead, gr as getMaxListIndex, gt as string, h as TooltipArrow, hi as useControlled, hn as safePolygon, hr as getGridNavigatedIndex, i as DialogContent, ii as triggerPress, in as resolveAriaLabelledBy, ir as Input$1, it as dequal, j as nodeNameIssue, ji as mergeProps, jn as useTriggerRegistration, jr as Check, jt as ARROW_KEYS, ki as useCompositeRootContext, kn as useOpenStateTransitions, kr as useLabelableId, kt as ALL_KEYS, l as DialogTrigger, li as useBaseUiId, ln as stringifyAsValue, m as createTooltipHandle, mi as visuallyHiddenInput, mn as selectedValueIncludes, mr as getGridCellIndices, n as Dialog, nn as pressableTriggerOpenStateMapping, nr as useOnFirstRender, nt as variableInputCompatible, oi as useFormContext, on as hasNullItemLabel, or as useTimeout, p as TooltipTrigger, pi as visuallyHidden, pn as removeItem, pr as getGridCellIndexOfCorner, q as decisionLimits, qn as ReactStore, qr as imperativeAction, qt as getDisabledMountTransitionStyles, rn as triggerOpenStateMapping, rr as Label, si as useRegisterFieldControl, sn as isGroupedItems, t as Icon, ti as siblingOpen, tn as popupStateMapping, tr as useValueAsRef, tt as schemaObject, u as Tooltip, ui as useId$1, un as compareItemEquality, v as TooltipPortal, vi as cn$1, vn as useListNavigation, vr as isIndexOutOfListBounds, vt as Select$1, w as FieldError, wi as NOOP, wn as useFloatingRootContext, wr as getTarget, wt as SelectTrigger, x as Spinner, xi as useRenderElement, xn as useHoverFloatingInteraction, xr as isInteractiveElement, xt as SelectGroup, y as TooltipTrigger$1, yi as cva, yn as useInteractions, yr as isListIndexDisabled, yt as SelectChevron, z as operandHandle, zi as isLastTraversableNode, zn as useFloatingTree, zr as useValueChanged, zt as MODIFIER_KEYS } from "./icons-p2A9zs8t.js";
|
|
7
6
|
import { a as renameObjectField, i as objectValue, l as resolveUiLanguage, n as isJsonValue, o as setObjectField, r as jsonDataTypes, s as valueType$1, t as initialValue } from "./value-DL_poNiC.js";
|
|
8
7
|
import { n as compile, r as validate } from "./flowRunInputEditorStore-Dsxyfwae.js";
|
|
9
|
-
import { t as WorkbenchSelect } from "./workbenchSelect-
|
|
8
|
+
import { t as WorkbenchSelect } from "./workbenchSelect-LRp_Xjeq.js";
|
|
10
9
|
import * as React from "react";
|
|
11
10
|
import reactExports, { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
12
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import * as ReactDOM from "react-dom";
|
|
13
13
|
import { createPortal, flushSync } from "react-dom";
|
|
14
14
|
//#region ../../node_modules/.bun/lucide-react@0.468.0+f4eacebf2041cd4f/node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
15
15
|
/**
|
|
@@ -894,7 +894,7 @@ var TabsPanelDataAttributes = function(TabsPanelDataAttributes) {
|
|
|
894
894
|
}({});
|
|
895
895
|
//#endregion
|
|
896
896
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/panel/TabsPanel.js
|
|
897
|
-
var stateAttributesMapping$
|
|
897
|
+
var stateAttributesMapping$3 = {
|
|
898
898
|
...tabsStateAttributesMapping,
|
|
899
899
|
...transitionStatusMapping
|
|
900
900
|
};
|
|
@@ -940,7 +940,7 @@ var TabsPanel = /*#__PURE__*/ React.forwardRef(function TabPanel(componentProps,
|
|
|
940
940
|
inert: inertValue(!open),
|
|
941
941
|
[TabsPanelDataAttributes.index]: index
|
|
942
942
|
}, elementProps],
|
|
943
|
-
stateAttributesMapping: stateAttributesMapping$
|
|
943
|
+
stateAttributesMapping: stateAttributesMapping$3
|
|
944
944
|
});
|
|
945
945
|
useOpenChangeComplete({
|
|
946
946
|
open,
|
|
@@ -1365,13 +1365,13 @@ var Textarea = React.forwardRef(function Textarea({ className, ...props }, ref)
|
|
|
1365
1365
|
return /* @__PURE__ */ jsx("textarea", {
|
|
1366
1366
|
ref,
|
|
1367
1367
|
"data-slot": "textarea",
|
|
1368
|
-
className: cn$1("flex field-sizing-content min-h-16 w-full rounded-[var(--ui-control-radius,calc(var(--ui-radius)_+_2px))] border border-input bg-[var(--ui-control-background,var(--ui-muted))] px-2.5 py-2 text-
|
|
1368
|
+
className: cn$1("flex field-sizing-content min-h-16 w-full rounded-[var(--ui-control-radius,calc(var(--ui-radius)_+_2px))] border border-input bg-[var(--ui-control-background,var(--ui-muted))] px-2.5 py-2 text-[length:var(--ui-textarea-font-size,var(--ui-font-size))] leading-5 transition-colors outline-none read-only:cursor-default placeholder:text-muted-foreground focus-visible:text-field-focus focus-visible:aria-invalid:invalid-text-field-focus disabled:cursor-[var(--ui-disabled-cursor,not-allowed)] disabled:bg-[var(--ui-disabled-background,color-mix(in_srgb,var(--ui-input)_50%,transparent))] disabled:opacity-[var(--ui-disabled-opacity,0.5)] aria-invalid:border-destructive dark:bg-[var(--ui-control-background,var(--ui-muted))] dark:disabled:bg-[var(--ui-disabled-background,color-mix(in_srgb,var(--ui-input)_80%,transparent))]", className),
|
|
1369
1369
|
...props
|
|
1370
1370
|
});
|
|
1371
1371
|
});
|
|
1372
1372
|
//#endregion
|
|
1373
1373
|
//#region src/workbench/browser/runtime/editor/commentInspector.tsx
|
|
1374
|
-
var MarkdownContent$1 = lazy(() => import("./markdownContent-
|
|
1374
|
+
var MarkdownContent$1 = lazy(() => import("./markdownContent-frwDfQQU.js"));
|
|
1375
1375
|
/** A comment is presentation data; editing it does not require the canvas store. */
|
|
1376
1376
|
function CommentInspector({ title, content, disabled = false, readOnly, dark, onSave }) {
|
|
1377
1377
|
const t = useTranslate();
|
|
@@ -1874,7 +1874,7 @@ var MenuItem = /*#__PURE__*/ React.forwardRef(function MenuItem(componentProps,
|
|
|
1874
1874
|
if (process.env.NODE_ENV !== "production") MenuItem.displayName = "MenuItem";
|
|
1875
1875
|
//#endregion
|
|
1876
1876
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/popup/MenuPopup.js
|
|
1877
|
-
var stateAttributesMapping = {
|
|
1877
|
+
var stateAttributesMapping$2 = {
|
|
1878
1878
|
...popupStateMapping,
|
|
1879
1879
|
...transitionStatusMapping
|
|
1880
1880
|
};
|
|
@@ -1943,7 +1943,7 @@ var MenuPopup = /*#__PURE__*/ React.forwardRef(function MenuPopup(componentProps
|
|
|
1943
1943
|
store.context.popupRef,
|
|
1944
1944
|
setPopupElement
|
|
1945
1945
|
],
|
|
1946
|
-
stateAttributesMapping,
|
|
1946
|
+
stateAttributesMapping: stateAttributesMapping$2,
|
|
1947
1947
|
props: [
|
|
1948
1948
|
popupProps,
|
|
1949
1949
|
{ onKeyDown(event) {
|
|
@@ -2388,7 +2388,7 @@ function useMenubarContext(optional) {
|
|
|
2388
2388
|
}
|
|
2389
2389
|
//#endregion
|
|
2390
2390
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/store/MenuStore.js
|
|
2391
|
-
var selectors = {
|
|
2391
|
+
var selectors$1 = {
|
|
2392
2392
|
...popupStoreSelectors,
|
|
2393
2393
|
disabled: createSelector((state) => state.parent.type === "menubar" ? state.parent.context.disabled || state.disabled : state.disabled),
|
|
2394
2394
|
modal: createSelector((state) => (state.parent.type === void 0 || state.parent.type === "context-menu") && (state.modal ?? true)),
|
|
@@ -2435,7 +2435,7 @@ var MenuStore = class MenuStore extends ReactStore {
|
|
|
2435
2435
|
beforeContentFocusGuardRef: /*#__PURE__*/ React.createRef(),
|
|
2436
2436
|
onOpenChangeComplete: void 0,
|
|
2437
2437
|
triggerElements: new PopupTriggerMap()
|
|
2438
|
-
}, selectors);
|
|
2438
|
+
}, selectors$1);
|
|
2439
2439
|
this.unsubscribeParentListener = this.observe("parent", (parent) => {
|
|
2440
2440
|
this.unsubscribeParentListener?.();
|
|
2441
2441
|
if (parent.type === "menu") {
|
|
@@ -2885,7 +2885,7 @@ function useMixedToggleClickHandler(params) {
|
|
|
2885
2885
|
}
|
|
2886
2886
|
//#endregion
|
|
2887
2887
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/trigger/MenuTrigger.js
|
|
2888
|
-
var BOUNDARY_OFFSET = 2;
|
|
2888
|
+
var BOUNDARY_OFFSET$1 = 2;
|
|
2889
2889
|
/**
|
|
2890
2890
|
* A button that opens the menu.
|
|
2891
2891
|
* Renders a `<button>` element.
|
|
@@ -2943,7 +2943,7 @@ var MenuTrigger = fastComponentRef(function MenuTrigger(componentProps, forwarde
|
|
|
2943
2943
|
if (contains(triggerRef.current, mouseUpTarget) || contains(store.select("positionerElement"), mouseUpTarget) || mouseUpTarget === triggerRef.current) return;
|
|
2944
2944
|
if (mouseUpTarget != null && findRootOwnerId(mouseUpTarget) === store.select("rootId")) return;
|
|
2945
2945
|
const bounds = getPseudoElementBounds(triggerRef.current);
|
|
2946
|
-
if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET) return;
|
|
2946
|
+
if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET$1 && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET$1 && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET$1 && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET$1) return;
|
|
2947
2947
|
floatingTreeRoot.events.emit("close", {
|
|
2948
2948
|
domEvent: mouseEvent,
|
|
2949
2949
|
reason: cancelOpen
|
|
@@ -4174,6 +4174,7 @@ function fallbackIcon$1(item) {
|
|
|
4174
4174
|
switch (item.type) {
|
|
4175
4175
|
case "agent": return "llm";
|
|
4176
4176
|
case "condition": return "condition";
|
|
4177
|
+
case "decision": return "decision";
|
|
4177
4178
|
case "openapi":
|
|
4178
4179
|
case "connector":
|
|
4179
4180
|
case "connector-group": return "connection";
|
|
@@ -4183,7 +4184,6 @@ function fallbackIcon$1(item) {
|
|
|
4183
4184
|
case "value": return "value";
|
|
4184
4185
|
case "wait": return "wait";
|
|
4185
4186
|
case "new-task":
|
|
4186
|
-
case "subflow":
|
|
4187
4187
|
case "comment": return "task";
|
|
4188
4188
|
}
|
|
4189
4189
|
}
|
|
@@ -4860,7 +4860,7 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
4860
4860
|
const pendingUses = pendingConnectionUses(uses, providers.data);
|
|
4861
4861
|
const providerMetadata = Object.fromEntries((providers.data ?? []).map((provider) => [provider.serviceId, provider]));
|
|
4862
4862
|
const referenceIcon = (reference) => {
|
|
4863
|
-
const node = displayed?.node(reference.
|
|
4863
|
+
const node = displayed?.node(reference.nodeId);
|
|
4864
4864
|
if (node == null) return;
|
|
4865
4865
|
return node.kind == "trigger" ? triggerNodeIcon(node.trigger, providerMetadata) : semanticNodeIcon(node, actions);
|
|
4866
4866
|
};
|
|
@@ -5466,11 +5466,7 @@ function AccountReferences({ hierarchy = false, icon, code = false, references,
|
|
|
5466
5466
|
className: "i-lucide-light:arrow-up-right size-3 shrink-0 text-muted-foreground"
|
|
5467
5467
|
})]
|
|
5468
5468
|
})]
|
|
5469
|
-
}, JSON.stringify([
|
|
5470
|
-
reference.target,
|
|
5471
|
-
reference.nodeId,
|
|
5472
|
-
reference.kind
|
|
5473
|
-
]));
|
|
5469
|
+
}, JSON.stringify([reference.nodeId, reference.kind]));
|
|
5474
5470
|
})
|
|
5475
5471
|
}),
|
|
5476
5472
|
code && /* @__PURE__ */ jsx("p", {
|
|
@@ -5594,6 +5590,7 @@ function ContextPanel({ className, layoutRoot, children, focusOnOpen, actions, h
|
|
|
5594
5590
|
const current = panel.current;
|
|
5595
5591
|
if (current == null || !(event.target instanceof Node) || !current.contains(event.target)) return;
|
|
5596
5592
|
if (event.key == "Escape") {
|
|
5593
|
+
if (event.target instanceof Element && event.target.closest("[data-popup-open]") != null) return;
|
|
5597
5594
|
event.preventDefault();
|
|
5598
5595
|
event.stopPropagation();
|
|
5599
5596
|
onClose();
|
|
@@ -7162,44 +7159,44 @@ function FlowNodeList({ nodes, onFocusNode, onSelect, groupTriggers = false }) {
|
|
|
7162
7159
|
});
|
|
7163
7160
|
}
|
|
7164
7161
|
var valueEditor_module_default = {
|
|
7165
|
-
root: "
|
|
7166
|
-
errorAnchor: "
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
options: "
|
|
7170
|
-
toolbar: "
|
|
7171
|
-
presence: "
|
|
7172
|
-
actions: "
|
|
7173
|
-
collection: "
|
|
7174
|
-
fieldName: "
|
|
7175
|
-
fieldType: "
|
|
7176
|
-
json: "
|
|
7177
|
-
description: "
|
|
7178
|
-
error: "
|
|
7179
|
-
summary: "
|
|
7180
|
-
summaryError: "
|
|
7181
|
-
srOnly: "
|
|
7182
|
-
option: "
|
|
7183
|
-
header: "
|
|
7184
|
-
leadingControl: "
|
|
7185
|
-
toggleControl: "
|
|
7186
|
-
valueAddon: "
|
|
7187
|
-
summaryText: "
|
|
7188
|
-
clearValue: "
|
|
7189
|
-
resetValue: "
|
|
7190
|
-
unsetValue: "
|
|
7191
|
-
arrayIndex: "
|
|
7192
|
-
nullValue: "
|
|
7193
|
-
nullChip: "
|
|
7194
|
-
collectionActions: "
|
|
7195
|
-
emptyObjectContent: "
|
|
7196
|
-
emptyObjectConstraint: "
|
|
7197
|
-
jsonCode: "
|
|
7198
|
-
emptyString: "
|
|
7199
|
-
booleanControl: "
|
|
7200
|
-
booleanIndicator: "
|
|
7201
|
-
objectNotice: "
|
|
7202
|
-
valuePrefix: "
|
|
7162
|
+
root: "valueEditor_root_fd302",
|
|
7163
|
+
errorAnchor: "valueEditor_errorAnchor_fd302",
|
|
7164
|
+
body: "valueEditor_body_fd302",
|
|
7165
|
+
valueTools: "valueEditor_valueTools_fd302",
|
|
7166
|
+
options: "valueEditor_options_fd302",
|
|
7167
|
+
toolbar: "valueEditor_toolbar_fd302",
|
|
7168
|
+
presence: "valueEditor_presence_fd302",
|
|
7169
|
+
actions: "valueEditor_actions_fd302",
|
|
7170
|
+
collection: "valueEditor_collection_fd302",
|
|
7171
|
+
fieldName: "valueEditor_fieldName_fd302",
|
|
7172
|
+
fieldType: "valueEditor_fieldType_fd302",
|
|
7173
|
+
json: "valueEditor_json_fd302",
|
|
7174
|
+
description: "valueEditor_description_fd302",
|
|
7175
|
+
error: "valueEditor_error_fd302",
|
|
7176
|
+
summary: "valueEditor_summary_fd302",
|
|
7177
|
+
summaryError: "valueEditor_summaryError_fd302",
|
|
7178
|
+
srOnly: "valueEditor_srOnly_fd302",
|
|
7179
|
+
option: "valueEditor_option_fd302",
|
|
7180
|
+
header: "valueEditor_header_fd302",
|
|
7181
|
+
leadingControl: "valueEditor_leadingControl_fd302",
|
|
7182
|
+
toggleControl: "valueEditor_toggleControl_fd302",
|
|
7183
|
+
valueAddon: "valueEditor_valueAddon_fd302",
|
|
7184
|
+
summaryText: "valueEditor_summaryText_fd302",
|
|
7185
|
+
clearValue: "valueEditor_clearValue_fd302",
|
|
7186
|
+
resetValue: "valueEditor_resetValue_fd302",
|
|
7187
|
+
unsetValue: "valueEditor_unsetValue_fd302",
|
|
7188
|
+
arrayIndex: "valueEditor_arrayIndex_fd302",
|
|
7189
|
+
nullValue: "valueEditor_nullValue_fd302",
|
|
7190
|
+
nullChip: "valueEditor_nullChip_fd302",
|
|
7191
|
+
collectionActions: "valueEditor_collectionActions_fd302",
|
|
7192
|
+
emptyObjectContent: "valueEditor_emptyObjectContent_fd302",
|
|
7193
|
+
emptyObjectConstraint: "valueEditor_emptyObjectConstraint_fd302",
|
|
7194
|
+
jsonCode: "valueEditor_jsonCode_fd302",
|
|
7195
|
+
emptyString: "valueEditor_emptyString_fd302",
|
|
7196
|
+
booleanControl: "valueEditor_booleanControl_fd302",
|
|
7197
|
+
booleanIndicator: "valueEditor_booleanIndicator_fd302",
|
|
7198
|
+
objectNotice: "valueEditor_objectNotice_fd302",
|
|
7199
|
+
valuePrefix: "valueEditor_valuePrefix_fd302"
|
|
7203
7200
|
};
|
|
7204
7201
|
//#endregion
|
|
7205
7202
|
//#region src/form/browser/fieldControl.tsx
|
|
@@ -7236,41 +7233,6 @@ function ValueControl({ addon, children }) {
|
|
|
7236
7233
|
}
|
|
7237
7234
|
//#endregion
|
|
7238
7235
|
//#region src/workbench/browser/runtime/editor/agentChanges.ts
|
|
7239
|
-
var AgentChanges = class {
|
|
7240
|
-
#saved;
|
|
7241
|
-
#pending;
|
|
7242
|
-
#running;
|
|
7243
|
-
#write;
|
|
7244
|
-
constructor(value, write) {
|
|
7245
|
-
this.value = value;
|
|
7246
|
-
this.#saved = value;
|
|
7247
|
-
this.#write = write;
|
|
7248
|
-
}
|
|
7249
|
-
sync(value) {
|
|
7250
|
-
if (this.#running != null || !dequal(this.value, this.#saved)) return;
|
|
7251
|
-
this.value = value;
|
|
7252
|
-
this.#saved = value;
|
|
7253
|
-
}
|
|
7254
|
-
save() {
|
|
7255
|
-
if (this.#running == null && dequal(this.value, this.#saved)) return Promise.resolve(true);
|
|
7256
|
-
this.#pending = this.value;
|
|
7257
|
-
if (this.#running != null) return this.#running;
|
|
7258
|
-
this.#running = this.#flush().finally(() => {
|
|
7259
|
-
this.#running = void 0;
|
|
7260
|
-
});
|
|
7261
|
-
return this.#running;
|
|
7262
|
-
}
|
|
7263
|
-
async #flush() {
|
|
7264
|
-
while (this.#pending != null) {
|
|
7265
|
-
const value = this.#pending;
|
|
7266
|
-
this.#pending = void 0;
|
|
7267
|
-
if (dequal(value, this.#saved)) continue;
|
|
7268
|
-
if (!await this.#write(this.#saved, value)) return false;
|
|
7269
|
-
this.#saved = value;
|
|
7270
|
-
}
|
|
7271
|
-
return true;
|
|
7272
|
-
}
|
|
7273
|
-
};
|
|
7274
7236
|
function agentFixedValuesValid(config, notificationInputs = []) {
|
|
7275
7237
|
if (config.kind !== "agent") return true;
|
|
7276
7238
|
const values = config.tools.flatMap((tool) => tool.inputs.map((port) => ({
|
|
@@ -7871,7 +7833,7 @@ function AccountSelect({ connections, disabled, loading = false, id, invalid, wa
|
|
|
7871
7833
|
})]
|
|
7872
7834
|
});
|
|
7873
7835
|
}
|
|
7874
|
-
function ConnectorAccount({ accessError, onConfigureAccess, action, actionError, actionId, activeConnections, authorizationPending, connection, connectionError, connectionId, connectors, disabled, fieldIdPrefix, loading,
|
|
7836
|
+
function ConnectorAccount({ accessError, onConfigureAccess, action, actionError, actionId, activeConnections, authorizationPending, connection, connectionError, connectionId, connectors, disabled, fieldIdPrefix, loading, nodeId }) {
|
|
7875
7837
|
const t = useTranslate();
|
|
7876
7838
|
const available = activeConnections ?? [];
|
|
7877
7839
|
const accessIssue = accessError ?? (actionError?.code == "connector.access-required" || actionError?.code == "connector.access-invalid" ? actionError.message : void 0);
|
|
@@ -7928,7 +7890,7 @@ function ConnectorAccount({ accessError, onConfigureAccess, action, actionError,
|
|
|
7928
7890
|
id: `${fieldIdPrefix}-connection`,
|
|
7929
7891
|
selectedConnection: connection,
|
|
7930
7892
|
selectedId: connectionId,
|
|
7931
|
-
onChange: (next) => void connectors.setConnection(
|
|
7893
|
+
onChange: (next) => void connectors.setConnection(nodeId, next),
|
|
7932
7894
|
onManage: onConfigureAccess
|
|
7933
7895
|
})]
|
|
7934
7896
|
}),
|
|
@@ -9475,13 +9437,14 @@ function FieldLayout({ children, depth = 0, layout = "values", columns, gap }) {
|
|
|
9475
9437
|
children
|
|
9476
9438
|
});
|
|
9477
9439
|
}
|
|
9478
|
-
var FieldRow = forwardRef(({ columns, gap, header, leadingControl, disclosureContent, trailingControl, actions, layout, depth, typeWidth, disclosure, label, sorting, disclosureInvalid, children, style, className, ...props }, ref) => {
|
|
9440
|
+
var FieldRow = forwardRef(({ columns, gap, header, leadingControl, disclosureContent, trailingControl, actions, layout, depth, typeWidth, disclosure, label, sorting, disclosureInvalid, stacking = "editor", children, style, className, ...props }, ref) => {
|
|
9479
9441
|
const geometry = useContext(Geometry);
|
|
9480
9442
|
const level = depth ?? geometry.depth;
|
|
9481
9443
|
return /* @__PURE__ */ jsxs("div", {
|
|
9482
9444
|
...props,
|
|
9483
9445
|
ref,
|
|
9484
9446
|
className: [valueEditor_module_default.root, className].filter(Boolean).join(" "),
|
|
9447
|
+
"data-stacking": stacking,
|
|
9485
9448
|
"data-layout": layout ?? geometry.layout,
|
|
9486
9449
|
"data-header": header != null || void 0,
|
|
9487
9450
|
"data-nested-field": level > 0 || void 0,
|
|
@@ -9559,6 +9522,25 @@ function FieldTypeAddon({ schema, name, menuTitle, disabled, onChange }) {
|
|
|
9559
9522
|
});
|
|
9560
9523
|
}
|
|
9561
9524
|
//#endregion
|
|
9525
|
+
//#region src/form/browser/fieldValuePreview.tsx
|
|
9526
|
+
/** Shared compact preview for expandable text and structured values. */
|
|
9527
|
+
function FieldValuePreview({ children, empty, trailing, className, ...props }) {
|
|
9528
|
+
return /* @__PURE__ */ jsxs(Button$1, {
|
|
9529
|
+
type: "button",
|
|
9530
|
+
variant: "disclosure",
|
|
9531
|
+
size: "field",
|
|
9532
|
+
className: cn$1(valueEditor_module_default.summary, className),
|
|
9533
|
+
"data-value-preview": true,
|
|
9534
|
+
"data-field-control": true,
|
|
9535
|
+
...props,
|
|
9536
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
9537
|
+
className: valueEditor_module_default.summaryText,
|
|
9538
|
+
"data-empty-string": empty || void 0,
|
|
9539
|
+
children
|
|
9540
|
+
}), trailing]
|
|
9541
|
+
});
|
|
9542
|
+
}
|
|
9543
|
+
//#endregion
|
|
9562
9544
|
//#region src/ui/browser/code-editor.ts
|
|
9563
9545
|
var completionIcons = /* @__PURE__ */ new Map([
|
|
9564
9546
|
["class", "i-codicon:symbol-class"],
|
|
@@ -22293,30 +22275,22 @@ function FieldValueEditor(suppliedProps) {
|
|
|
22293
22275
|
"data-value-addon-control": true,
|
|
22294
22276
|
children: startAddon
|
|
22295
22277
|
}),
|
|
22296
|
-
compactValue && expandable && /* @__PURE__ */
|
|
22297
|
-
|
|
22298
|
-
variant: "disclosure",
|
|
22299
|
-
size: "field",
|
|
22300
|
-
className: valueEditor_module_default.summary,
|
|
22301
|
-
"data-value-preview": true,
|
|
22278
|
+
compactValue && expandable && /* @__PURE__ */ jsx(FieldValuePreview, {
|
|
22279
|
+
empty: value === "",
|
|
22302
22280
|
hidden: inlineExpansion && hasExpandedContent && expanded,
|
|
22303
22281
|
"data-field-prompt": summaryInvalid || void 0,
|
|
22304
22282
|
"data-readonly": disabled || void 0,
|
|
22305
|
-
"data-field-control": true,
|
|
22306
22283
|
disabled: sorting || !hasExpandedContent && !createValue || needsCreation && !createValue,
|
|
22307
22284
|
"aria-label": `${label} ${t("valueEditor.setValue")}`,
|
|
22308
22285
|
"aria-expanded": needsCreation || !hasExpandedContent ? void 0 : expanded,
|
|
22309
22286
|
"aria-invalid": summaryInvalid,
|
|
22310
22287
|
"aria-controls": `${id}-body`,
|
|
22288
|
+
trailing: !inlineExpansion && props.header == null && hasExpandedContent && !needsCreation ? /* @__PURE__ */ jsx(SelectChevron, { className: expanded ? "rotate-180" : void 0 }) : void 0,
|
|
22311
22289
|
onClick: needsCreation ? () => {
|
|
22312
22290
|
createValue?.();
|
|
22313
22291
|
setExpanded(true);
|
|
22314
22292
|
} : toggleExpanded,
|
|
22315
|
-
children:
|
|
22316
|
-
className: valueEditor_module_default.summaryText,
|
|
22317
|
-
"data-empty-string": value === "" || void 0,
|
|
22318
|
-
children: state.display === "null" ? "null" : presence === "unset" ? t("valueEditor.unset") : structured ? JSON.stringify(value) : typeof value === "string" ? value === "" ? t("valueEditor.emptyStringValue") : value : JSON.stringify(value)
|
|
22319
|
-
}), !inlineExpansion && props.header == null && hasExpandedContent && !needsCreation && /* @__PURE__ */ jsx(SelectChevron, { className: expanded ? "rotate-180" : void 0 })]
|
|
22293
|
+
children: state.display === "null" ? "null" : presence === "unset" ? t("valueEditor.unset") : structured ? JSON.stringify(value) : typeof value === "string" ? value === "" ? t("valueEditor.emptyStringValue") : value : JSON.stringify(value)
|
|
22320
22294
|
}),
|
|
22321
22295
|
(!expandable || inlineExpansion) && body,
|
|
22322
22296
|
/* @__PURE__ */ jsx(ValueTools, {
|
|
@@ -22800,6 +22774,45 @@ function PromptEditor({ ariaDescribedBy, invalid, value, inputs, disabled, theme
|
|
|
22800
22774
|
});
|
|
22801
22775
|
}
|
|
22802
22776
|
//#endregion
|
|
22777
|
+
//#region src/workbench/browser/runtime/editor/taskExecutorChanges.ts
|
|
22778
|
+
var TaskExecutorChanges = class {
|
|
22779
|
+
#saved;
|
|
22780
|
+
#pending = [];
|
|
22781
|
+
#running;
|
|
22782
|
+
#write;
|
|
22783
|
+
constructor(value, write) {
|
|
22784
|
+
this.value = value;
|
|
22785
|
+
this.#saved = value;
|
|
22786
|
+
this.#write = write;
|
|
22787
|
+
}
|
|
22788
|
+
sync(value) {
|
|
22789
|
+
if (this.#running != null || this.#pending.length > 0 || !dequal(this.value, this.#saved)) return;
|
|
22790
|
+
this.value = value;
|
|
22791
|
+
this.#saved = value;
|
|
22792
|
+
}
|
|
22793
|
+
save(metadata) {
|
|
22794
|
+
if (!dequal(this.value, this.#pending.at(-1)?.value ?? this.#saved)) this.#pending.push({
|
|
22795
|
+
value: this.value,
|
|
22796
|
+
metadata
|
|
22797
|
+
});
|
|
22798
|
+
if (this.#pending.length === 0) return Promise.resolve(true);
|
|
22799
|
+
if (this.#running != null) return this.#running;
|
|
22800
|
+
this.#running = this.#flush().finally(() => {
|
|
22801
|
+
this.#running = void 0;
|
|
22802
|
+
});
|
|
22803
|
+
return this.#running;
|
|
22804
|
+
}
|
|
22805
|
+
async #flush() {
|
|
22806
|
+
while (this.#pending.length > 0) {
|
|
22807
|
+
const { value, metadata } = this.#pending[0];
|
|
22808
|
+
if (!await this.#write(this.#saved, value, metadata)) return false;
|
|
22809
|
+
this.#saved = value;
|
|
22810
|
+
this.#pending.shift();
|
|
22811
|
+
}
|
|
22812
|
+
return true;
|
|
22813
|
+
}
|
|
22814
|
+
};
|
|
22815
|
+
//#endregion
|
|
22803
22816
|
//#region src/workbench/browser/runtime/editor/agentSettings.tsx
|
|
22804
22817
|
var AgentSettingsContext = createContext(null);
|
|
22805
22818
|
function AgentPrompt() {
|
|
@@ -22813,32 +22826,35 @@ function EditableAgentSettingsProvider({ children, task, nodeId, store, connecto
|
|
|
22813
22826
|
const [config, renderConfig] = useState(task.executor);
|
|
22814
22827
|
const [saveError, setSaveError] = useState();
|
|
22815
22828
|
const [flowId] = useState(store.$.flowId.value);
|
|
22816
|
-
const [changes] = useState(() => new
|
|
22829
|
+
const [changes] = useState(() => new TaskExecutorChanges(task.executor, async (before, value) => {
|
|
22817
22830
|
if (store.$.flowId.value != flowId) return false;
|
|
22818
|
-
const current = store.$.revision.value?.node(
|
|
22831
|
+
const current = store.$.revision.value?.node(nodeId);
|
|
22819
22832
|
const definition = current?.kind == "task" ? current.definition : void 0;
|
|
22820
22833
|
if (definition == null || !("executor" in definition) || !dequal(definition.executor, before)) return false;
|
|
22821
22834
|
const decoded = decodeRevisionContent({
|
|
22822
|
-
modelVersion:
|
|
22835
|
+
modelVersion: 6,
|
|
22823
22836
|
modules: {},
|
|
22824
22837
|
document: {
|
|
22825
22838
|
bindings: {},
|
|
22826
|
-
subflows: {},
|
|
22827
22839
|
graph: {
|
|
22828
|
-
nodes: {
|
|
22840
|
+
nodes: { agent: {
|
|
22841
|
+
kind: "task",
|
|
22842
|
+
inputs: {},
|
|
22843
|
+
task: {
|
|
22844
|
+
...definition,
|
|
22845
|
+
executor: value
|
|
22846
|
+
}
|
|
22847
|
+
} },
|
|
22829
22848
|
edges: []
|
|
22830
|
-
}
|
|
22831
|
-
tasks: { agent: {
|
|
22832
|
-
...definition,
|
|
22833
|
-
executor: value
|
|
22834
|
-
} }
|
|
22849
|
+
}
|
|
22835
22850
|
}
|
|
22836
|
-
}).document.
|
|
22851
|
+
}).document.graph.nodes.agent;
|
|
22852
|
+
if (decoded.kind != "task" || !("executor" in decoded.task)) return false;
|
|
22837
22853
|
return store.saveTaskSettings(nodeId, {
|
|
22838
22854
|
kind: "agent",
|
|
22839
22855
|
name: definition.name,
|
|
22840
22856
|
before: definition,
|
|
22841
|
-
task: decoded
|
|
22857
|
+
task: decoded.task
|
|
22842
22858
|
});
|
|
22843
22859
|
}));
|
|
22844
22860
|
useEffect(() => {
|
|
@@ -22847,7 +22863,7 @@ function EditableAgentSettingsProvider({ children, task, nodeId, store, connecto
|
|
|
22847
22863
|
}, [changes, task.executor]);
|
|
22848
22864
|
const save = async () => {
|
|
22849
22865
|
const value = changes.value;
|
|
22850
|
-
const notificationInputs = (value.kind === "agent"
|
|
22866
|
+
const notificationInputs = (value.kind === "agent" ? value.notification : void 0)?.inputDefinitions ?? [];
|
|
22851
22867
|
if (value.kind == "agent" && (!value.model.trim() || !Number.isSafeInteger(value.maxRounds) || value.maxRounds < 1 || value.maxRounds > 100)) return false;
|
|
22852
22868
|
if (!agentFixedValuesValid(value, notificationInputs)) {
|
|
22853
22869
|
setSaveError(t("agent.invalidValues"));
|
|
@@ -23046,6 +23062,55 @@ function AgentSettingsProvider(props) {
|
|
|
23046
23062
|
}
|
|
23047
23063
|
//#endregion
|
|
23048
23064
|
//#region src/workbench/browser/runtime/editor/builtInOutputPresentation.ts
|
|
23065
|
+
/** Localized answer help is presentation-only; persisted Decision schemas stay language-neutral. */
|
|
23066
|
+
function presentDecisionOutputs(task, t) {
|
|
23067
|
+
if (!("executor" in task) || task.executor.kind !== "decision") return task.outputs;
|
|
23068
|
+
const questions = new Map(task.executor.questions.map((question) => [question.name, question]));
|
|
23069
|
+
return task.outputs.map((port) => {
|
|
23070
|
+
if (!("handle" in port)) return port;
|
|
23071
|
+
const question = questions.get(port.handle);
|
|
23072
|
+
const schema = schemaObject(port.jsonSchema);
|
|
23073
|
+
if (question == null || schema == null) return port;
|
|
23074
|
+
const properties = Object.fromEntries(Object.entries(schemaObject(schema.properties ?? null) ?? {}).map(([name, value]) => {
|
|
23075
|
+
const field = schemaObject(value);
|
|
23076
|
+
if (field == null) return [name, value];
|
|
23077
|
+
let description;
|
|
23078
|
+
switch (name) {
|
|
23079
|
+
case "type":
|
|
23080
|
+
description = t("decision.outputs.type", { type: question.type });
|
|
23081
|
+
break;
|
|
23082
|
+
case "noul":
|
|
23083
|
+
case "choice":
|
|
23084
|
+
case "score":
|
|
23085
|
+
case "confidence":
|
|
23086
|
+
case "legend":
|
|
23087
|
+
description = t(`decision.outputs.${name}`);
|
|
23088
|
+
break;
|
|
23089
|
+
case "probabilities":
|
|
23090
|
+
description = t(`decision.outputs.${question.type}Probabilities`);
|
|
23091
|
+
break;
|
|
23092
|
+
default: return [name, value];
|
|
23093
|
+
}
|
|
23094
|
+
const children = schemaObject(field.properties ?? null);
|
|
23095
|
+
return [name, {
|
|
23096
|
+
...field,
|
|
23097
|
+
description,
|
|
23098
|
+
...children == null ? {} : { properties: Object.fromEntries(Object.entries(children).map(([key, child]) => [key, {
|
|
23099
|
+
...schemaObject(child),
|
|
23100
|
+
description: name === "legend" ? t("decision.outputs.level", { level: key }) : question.type === "choice" ? t("decision.outputs.choiceProbability", { name: key }) : t("decision.outputs.scoreProbability", { level: key })
|
|
23101
|
+
}])) }
|
|
23102
|
+
}];
|
|
23103
|
+
}));
|
|
23104
|
+
return {
|
|
23105
|
+
...port,
|
|
23106
|
+
description: t("decision.outputs.answer", { type: t(`decision.${question.type}`) }),
|
|
23107
|
+
jsonSchema: {
|
|
23108
|
+
...schema,
|
|
23109
|
+
properties
|
|
23110
|
+
}
|
|
23111
|
+
};
|
|
23112
|
+
});
|
|
23113
|
+
}
|
|
23049
23114
|
function withDescriptions$1(ports, descriptionFor) {
|
|
23050
23115
|
return ports.map((port) => {
|
|
23051
23116
|
const description = descriptionFor(port.handle);
|
|
@@ -23803,7 +23868,7 @@ function CodeEditor({ ariaDescribedBy, ariaLabel, diagnostics, disabled, errorLa
|
|
|
23803
23868
|
});
|
|
23804
23869
|
}
|
|
23805
23870
|
//#endregion
|
|
23806
|
-
//#region src/
|
|
23871
|
+
//#region src/workbench/browser/runtime/editor/generateTyping.ts
|
|
23807
23872
|
function generateTyping(language, inputsDef, outputsDef) {
|
|
23808
23873
|
if (language === "typescript") return genTypeScript(inputsDef, outputsDef) + "\n";
|
|
23809
23874
|
else return genJavaScript(inputsDef, outputsDef) + "\n";
|
|
@@ -25949,15 +26014,2900 @@ function ConditionBranchesEditor({ value: configuration, disabled, readOnly, onC
|
|
|
25949
26014
|
})]
|
|
25950
26015
|
});
|
|
25951
26016
|
}
|
|
26017
|
+
var fieldTable_module_default = {
|
|
26018
|
+
list: "fieldTable_list_58822",
|
|
26019
|
+
columns: "fieldTable_columns_58822",
|
|
26020
|
+
nameHeading: "fieldTable_nameHeading_58822",
|
|
26021
|
+
typeHeading: "fieldTable_typeHeading_58822",
|
|
26022
|
+
valueHeading: "fieldTable_valueHeading_58822",
|
|
26023
|
+
row: "fieldTable_row_58822",
|
|
26024
|
+
nullableControl: "fieldTable_nullableControl_58822",
|
|
26025
|
+
nullableHeading: "fieldTable_nullableHeading_58822"
|
|
26026
|
+
};
|
|
25952
26027
|
//#endregion
|
|
25953
|
-
//#region src/
|
|
25954
|
-
|
|
26028
|
+
//#region src/form/browser/fieldTable.tsx
|
|
26029
|
+
/** Shared field geometry. Callers own definitions, values, actions and persistence. */
|
|
26030
|
+
var FieldTable = forwardRef(({ layout = "definition", fixedTypes, typeColumn = true, output, nullable, empty, actionSlots = 1, className, children, ...props }, ref) => {
|
|
26031
|
+
const t = useTranslate();
|
|
26032
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26033
|
+
...props,
|
|
26034
|
+
ref,
|
|
26035
|
+
className: [fieldTable_module_default.list, className].filter(Boolean).join(" "),
|
|
26036
|
+
"data-value-editor-scope": true,
|
|
26037
|
+
"data-layout": layout,
|
|
26038
|
+
"data-type-column": typeColumn || void 0,
|
|
26039
|
+
"data-output": output || void 0,
|
|
26040
|
+
"data-fixed-types": fixedTypes || void 0,
|
|
26041
|
+
"data-nullable": nullable || void 0,
|
|
26042
|
+
"data-empty": empty || void 0,
|
|
26043
|
+
"data-action-slots": actionSlots,
|
|
26044
|
+
children: [!empty && /* @__PURE__ */ jsxs("div", {
|
|
26045
|
+
className: fieldTable_module_default.columns,
|
|
26046
|
+
"data-layout": layout,
|
|
26047
|
+
"data-output": output || void 0,
|
|
26048
|
+
children: [
|
|
26049
|
+
/* @__PURE__ */ jsx("span", {
|
|
26050
|
+
className: fieldTable_module_default.nameHeading,
|
|
26051
|
+
children: t("valueEditor.columnName")
|
|
26052
|
+
}),
|
|
26053
|
+
typeColumn && /* @__PURE__ */ jsx("span", {
|
|
26054
|
+
className: fieldTable_module_default.typeHeading,
|
|
26055
|
+
children: t("valueEditor.columnType")
|
|
26056
|
+
}),
|
|
26057
|
+
!output && /* @__PURE__ */ jsx("span", {
|
|
26058
|
+
className: fieldTable_module_default.valueHeading,
|
|
26059
|
+
children: t("valueEditor.columnValue")
|
|
26060
|
+
}),
|
|
26061
|
+
nullable && /* @__PURE__ */ jsx("span", {
|
|
26062
|
+
className: fieldTable_module_default.nullableHeading,
|
|
26063
|
+
children: t("valueEditor.nullable")
|
|
26064
|
+
})
|
|
26065
|
+
]
|
|
26066
|
+
}), /* @__PURE__ */ jsx(FieldLayout, {
|
|
26067
|
+
layout,
|
|
26068
|
+
children
|
|
26069
|
+
})]
|
|
26070
|
+
});
|
|
26071
|
+
});
|
|
26072
|
+
function FieldTableRow({ className, ...props }) {
|
|
26073
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26074
|
+
...props,
|
|
26075
|
+
className: [fieldTable_module_default.row, className].filter(Boolean).join(" ")
|
|
26076
|
+
});
|
|
26077
|
+
}
|
|
26078
|
+
function FieldNullable({ name, checked, onChange }) {
|
|
25955
26079
|
const t = useTranslate();
|
|
26080
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
26081
|
+
render: /* @__PURE__ */ jsx("span", { className: fieldTable_module_default.nullableControl }),
|
|
26082
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
26083
|
+
className: "not-data-disabled:cursor-pointer",
|
|
26084
|
+
"aria-label": `${name} ${t("valueEditor.nullable")}`,
|
|
26085
|
+
"aria-checked": checked,
|
|
26086
|
+
checked,
|
|
26087
|
+
indeterminate: !onChange && !checked,
|
|
26088
|
+
disabled: !onChange,
|
|
26089
|
+
onCheckedChange: (next) => onChange?.(next === true)
|
|
26090
|
+
})
|
|
26091
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: t(checked ? "valueEditor.nullableDescription" : "valueEditor.notNullableDescription") })] });
|
|
26092
|
+
}
|
|
26093
|
+
//#endregion
|
|
26094
|
+
//#region src/ui/browser/helpButton.tsx
|
|
26095
|
+
/** Supplementary, non-interactive help that can also be opened by click. */
|
|
26096
|
+
function HelpButton({ label, children, size = 24 }) {
|
|
25956
26097
|
const id = useId();
|
|
25957
|
-
const [
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
26098
|
+
const [tooltip] = useState(() => createTooltipHandle());
|
|
26099
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
26100
|
+
handle: tooltip,
|
|
26101
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
26102
|
+
id,
|
|
26103
|
+
handle: tooltip,
|
|
26104
|
+
closeOnClick: false,
|
|
26105
|
+
onClick: () => tooltip.open(id),
|
|
26106
|
+
render: /* @__PURE__ */ jsx(Button$1, {
|
|
26107
|
+
type: "button",
|
|
26108
|
+
variant: "ghost",
|
|
26109
|
+
size: "icon-xs",
|
|
26110
|
+
style: {
|
|
26111
|
+
width: size,
|
|
26112
|
+
height: size
|
|
26113
|
+
},
|
|
26114
|
+
"aria-label": label
|
|
26115
|
+
}),
|
|
26116
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
26117
|
+
"aria-hidden": "true",
|
|
26118
|
+
className: "i-lucide-light:info text-muted-foreground",
|
|
26119
|
+
style: { fontSize: size * 5 / 8 }
|
|
26120
|
+
})
|
|
26121
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children })]
|
|
26122
|
+
});
|
|
26123
|
+
}
|
|
26124
|
+
//#endregion
|
|
26125
|
+
//#region src/workbench/browser/runtime/editor/inspectorSection.tsx
|
|
26126
|
+
function InspectorSection({ title, children, className, contentInset = true, ...props }) {
|
|
26127
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
26128
|
+
className: cn$1("inspector-section inspector-titled-section", className),
|
|
26129
|
+
...props,
|
|
26130
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
26131
|
+
className: "inspector-section-title",
|
|
26132
|
+
children: title
|
|
26133
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
26134
|
+
className: "inspector-section-content",
|
|
26135
|
+
"data-inset": contentInset || void 0,
|
|
26136
|
+
children
|
|
26137
|
+
})]
|
|
26138
|
+
});
|
|
26139
|
+
}
|
|
26140
|
+
//#endregion
|
|
26141
|
+
//#region src/workbench/browser/runtime/editor/decisionSection.tsx
|
|
26142
|
+
var textSchema = {
|
|
26143
|
+
type: "string",
|
|
26144
|
+
minLength: 1,
|
|
26145
|
+
pattern: "\\S"
|
|
26146
|
+
};
|
|
26147
|
+
var instructionSchema = {
|
|
26148
|
+
...textSchema,
|
|
26149
|
+
"ui:widget": "text"
|
|
26150
|
+
};
|
|
26151
|
+
var nameSchema = (names) => ({
|
|
26152
|
+
...textSchema,
|
|
26153
|
+
not: { enum: ["__proto__", ...names] }
|
|
26154
|
+
});
|
|
26155
|
+
/** Shared value controls keep drafts until the current asynchronous validation allows a commit. */
|
|
26156
|
+
function DecisionField({ label, schema, value, disabled, onCommit, inline = false, placeholder }) {
|
|
26157
|
+
const id = useId();
|
|
26158
|
+
const [draft, setDraft] = useState(value);
|
|
26159
|
+
const current = useRef(draft);
|
|
26160
|
+
const saved = useRef(value);
|
|
26161
|
+
const request = useRef();
|
|
26162
|
+
const [invalid, setInvalid] = useState(false);
|
|
26163
|
+
const t = useTranslate();
|
|
26164
|
+
useEffect(() => {
|
|
26165
|
+
if (dequal(saved.current, value)) return;
|
|
26166
|
+
saved.current = value;
|
|
26167
|
+
request.current?.abort();
|
|
26168
|
+
current.current = value;
|
|
26169
|
+
setDraft(value);
|
|
26170
|
+
setInvalid(false);
|
|
26171
|
+
}, [value]);
|
|
26172
|
+
useEffect(() => {
|
|
26173
|
+
request.current?.abort();
|
|
26174
|
+
const controller = new AbortController();
|
|
26175
|
+
request.current = controller;
|
|
26176
|
+
const candidate = current.current;
|
|
26177
|
+
Promise.resolve().then(() => {
|
|
26178
|
+
if (controller.signal.aborted || current.current !== candidate) return;
|
|
26179
|
+
setInvalid(!matchesSchema(candidate, schema));
|
|
26180
|
+
});
|
|
26181
|
+
return () => controller.abort();
|
|
26182
|
+
}, [
|
|
26183
|
+
schema,
|
|
26184
|
+
disabled,
|
|
26185
|
+
value
|
|
26186
|
+
]);
|
|
26187
|
+
useEffect(() => () => request.current?.abort(), []);
|
|
26188
|
+
async function commit() {
|
|
26189
|
+
request.current?.abort();
|
|
26190
|
+
const controller = new AbortController();
|
|
26191
|
+
request.current = controller;
|
|
26192
|
+
const candidate = current.current;
|
|
26193
|
+
await Promise.resolve();
|
|
26194
|
+
if (controller.signal.aborted) return;
|
|
26195
|
+
const valid = matchesSchema(candidate, schema);
|
|
26196
|
+
if (controller.signal.aborted || current.current !== candidate) return;
|
|
26197
|
+
setInvalid(!valid);
|
|
26198
|
+
if (valid && !disabled && !dequal(candidate, value)) onCommit(candidate);
|
|
26199
|
+
}
|
|
26200
|
+
const change = (next) => {
|
|
26201
|
+
request.current?.abort();
|
|
26202
|
+
current.current = next;
|
|
26203
|
+
setDraft(next);
|
|
26204
|
+
setInvalid(false);
|
|
26205
|
+
};
|
|
26206
|
+
const multiline = schema["ui:widget"] === "text";
|
|
26207
|
+
return /* @__PURE__ */ jsxs(Field, {
|
|
26208
|
+
className: "gap-1.5",
|
|
26209
|
+
onBlur: () => void commit(),
|
|
26210
|
+
onKeyDown: (event) => {
|
|
26211
|
+
if (event.key === "Enter" && event.target instanceof HTMLInputElement) commit();
|
|
26212
|
+
},
|
|
26213
|
+
children: [!inline && /* @__PURE__ */ jsx(FieldLabel, {
|
|
26214
|
+
className: "text-xs font-normal leading-4",
|
|
26215
|
+
htmlFor: id,
|
|
26216
|
+
children: label
|
|
26217
|
+
}), /* @__PURE__ */ jsx(ValueEditorFeedback, {
|
|
26218
|
+
error: invalid ? t("decision.invalidValue") : void 0,
|
|
26219
|
+
children: (errorId) => multiline ? /* @__PURE__ */ jsx(Textarea, {
|
|
26220
|
+
id,
|
|
26221
|
+
rows: 2,
|
|
26222
|
+
placeholder,
|
|
26223
|
+
"aria-label": label,
|
|
26224
|
+
"aria-describedby": errorId,
|
|
26225
|
+
"aria-invalid": invalid,
|
|
26226
|
+
readOnly: disabled,
|
|
26227
|
+
value: draft,
|
|
26228
|
+
onChange: (event) => change(event.target.value)
|
|
26229
|
+
}) : /* @__PURE__ */ jsx(Input$1, {
|
|
26230
|
+
id,
|
|
26231
|
+
controlSize: "field",
|
|
26232
|
+
placeholder,
|
|
26233
|
+
"aria-label": label,
|
|
26234
|
+
"aria-describedby": errorId,
|
|
26235
|
+
"aria-invalid": invalid,
|
|
26236
|
+
readOnly: disabled,
|
|
26237
|
+
value: draft,
|
|
26238
|
+
onChange: (event) => change(event.target.value)
|
|
26239
|
+
})
|
|
26240
|
+
})]
|
|
26241
|
+
});
|
|
26242
|
+
}
|
|
26243
|
+
function DecisionSection({ task, disabled, onSave }) {
|
|
26244
|
+
const t = useTranslate();
|
|
26245
|
+
const saveRef = useRef(onSave);
|
|
26246
|
+
saveRef.current = onSave;
|
|
26247
|
+
const taskRef = useRef(task);
|
|
26248
|
+
taskRef.current = task;
|
|
26249
|
+
const [changes] = useState(() => new TaskExecutorChanges(task.executor, async (before, next, deletion) => {
|
|
26250
|
+
if (before.kind !== "decision" || next.kind !== "decision") return false;
|
|
26251
|
+
return saveRef.current(dequal(before, taskRef.current.executor) ? taskRef.current : decisionTask(before.questions, taskRef.current.name), decisionTask(next.questions, taskRef.current.name), deletion);
|
|
26252
|
+
}));
|
|
26253
|
+
const [config, setConfig] = useState(changes.value);
|
|
26254
|
+
const [saveError, setSaveError] = useState(false);
|
|
26255
|
+
const questionId = useId();
|
|
26256
|
+
const [open, setOpen] = useState(() => new Set(config.kind === "decision" ? decisionQuestionIssues(config.questions).flatMap((issue) => issue.question == null ? [] : [issue.question]) : []));
|
|
26257
|
+
useEffect(() => {
|
|
26258
|
+
changes.sync(task.executor);
|
|
26259
|
+
setConfig(changes.value);
|
|
26260
|
+
}, [changes, task.executor]);
|
|
26261
|
+
if (config.kind !== "decision") return null;
|
|
26262
|
+
const questions = limitDecisionQuestions(config.questions);
|
|
26263
|
+
async function update(next, removed) {
|
|
26264
|
+
if (disabled) return;
|
|
26265
|
+
changes.value = {
|
|
26266
|
+
kind: "decision",
|
|
26267
|
+
questions: next
|
|
26268
|
+
};
|
|
26269
|
+
setConfig(changes.value);
|
|
26270
|
+
try {
|
|
26271
|
+
setSaveError(!await changes.save(removed));
|
|
26272
|
+
} catch {
|
|
26273
|
+
setSaveError(true);
|
|
26274
|
+
}
|
|
26275
|
+
}
|
|
26276
|
+
function edit(index, question, removed) {
|
|
26277
|
+
if (changes.value.kind !== "decision") return;
|
|
26278
|
+
update(limitDecisionQuestions(changes.value.questions).map((item, i) => i === index ? question : item), removed);
|
|
26279
|
+
}
|
|
26280
|
+
function add(after = questions.length - 1) {
|
|
26281
|
+
let name = defaultDecisionQuestion().name;
|
|
26282
|
+
let suffix = 2;
|
|
26283
|
+
while (questions.some((question) => question.name === name)) name = `decision${suffix++}`;
|
|
26284
|
+
const index = after + 1;
|
|
26285
|
+
setOpen(new Set([...open].map((i) => i >= index ? i + 1 : i).concat(index)));
|
|
26286
|
+
update(questions.toSpliced(index, 0, defaultDecisionQuestion(name)));
|
|
26287
|
+
}
|
|
26288
|
+
return /* @__PURE__ */ jsxs(InspectorSection, {
|
|
26289
|
+
title: t("decision.questions"),
|
|
26290
|
+
contentInset: false,
|
|
26291
|
+
"data-inspector-section": "task",
|
|
26292
|
+
children: [/* @__PURE__ */ jsxs(FieldTable, {
|
|
26293
|
+
layout: "ports",
|
|
26294
|
+
output: true,
|
|
26295
|
+
actionSlots: 2,
|
|
26296
|
+
empty: !questions.length,
|
|
26297
|
+
children: [/* @__PURE__ */ jsx(ArrayFieldList, {
|
|
26298
|
+
values: questions,
|
|
26299
|
+
label: t("decision.questions"),
|
|
26300
|
+
children: (_entry, index) => {
|
|
26301
|
+
const question = questions[index];
|
|
26302
|
+
const bodyId = `${questionId}-${index}`;
|
|
26303
|
+
return /* @__PURE__ */ jsxs(FieldRow, {
|
|
26304
|
+
stacking: "fields",
|
|
26305
|
+
label: question.name,
|
|
26306
|
+
"data-output": true,
|
|
26307
|
+
"data-object-child": true,
|
|
26308
|
+
"data-expansion": "branch",
|
|
26309
|
+
disclosure: {
|
|
26310
|
+
controls: question.type === "noul" ? bodyId : `${bodyId} ${bodyId}-criteria`,
|
|
26311
|
+
expanded: open.has(index),
|
|
26312
|
+
onToggle: () => setOpen((previous) => {
|
|
26313
|
+
const next = new Set(previous);
|
|
26314
|
+
if (next.has(index)) next.delete(index);
|
|
26315
|
+
else next.add(index);
|
|
26316
|
+
return next;
|
|
26317
|
+
})
|
|
26318
|
+
},
|
|
26319
|
+
header: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FieldName, {
|
|
26320
|
+
name: question.name,
|
|
26321
|
+
children: /* @__PURE__ */ jsx(DecisionField, {
|
|
26322
|
+
inline: true,
|
|
26323
|
+
label: t("decision.name"),
|
|
26324
|
+
schema: nameSchema(questions.filter((_, i) => i !== index).map((item) => item.name)),
|
|
26325
|
+
value: question.name,
|
|
26326
|
+
disabled,
|
|
26327
|
+
onCommit: (name) => edit(index, {
|
|
26328
|
+
...question,
|
|
26329
|
+
name
|
|
26330
|
+
})
|
|
26331
|
+
})
|
|
26332
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
26333
|
+
"data-field-type": true,
|
|
26334
|
+
children: /* @__PURE__ */ jsx(FieldSelect, {
|
|
26335
|
+
"aria-label": `${question.name} ${t("decision.type")}`,
|
|
26336
|
+
value: question.type,
|
|
26337
|
+
disabled,
|
|
26338
|
+
readOnly: disabled,
|
|
26339
|
+
onChange: (type) => {
|
|
26340
|
+
setOpen((previous) => new Set(previous).add(index));
|
|
26341
|
+
const base = {
|
|
26342
|
+
name: question.name,
|
|
26343
|
+
instructions: question.instructions
|
|
26344
|
+
};
|
|
26345
|
+
if (type === "noul") edit(index, {
|
|
26346
|
+
...base,
|
|
26347
|
+
type
|
|
26348
|
+
});
|
|
26349
|
+
if (type === "choice") edit(index, {
|
|
26350
|
+
...base,
|
|
26351
|
+
type,
|
|
26352
|
+
criteria: []
|
|
26353
|
+
});
|
|
26354
|
+
if (type === "score") edit(index, {
|
|
26355
|
+
...base,
|
|
26356
|
+
type,
|
|
26357
|
+
criteria: ["", ""]
|
|
26358
|
+
});
|
|
26359
|
+
},
|
|
26360
|
+
children: [
|
|
26361
|
+
"noul",
|
|
26362
|
+
"choice",
|
|
26363
|
+
"score"
|
|
26364
|
+
].map((type) => /* @__PURE__ */ jsx("option", {
|
|
26365
|
+
value: type,
|
|
26366
|
+
children: t(`decision.${type}`)
|
|
26367
|
+
}, type))
|
|
26368
|
+
})
|
|
26369
|
+
})] }),
|
|
26370
|
+
actions: !disabled && /* @__PURE__ */ jsx(DecisionItemActions, {
|
|
26371
|
+
addLabel: t("decision.addQuestion"),
|
|
26372
|
+
removeLabel: t("decision.removeQuestion"),
|
|
26373
|
+
onAdd: () => add(index),
|
|
26374
|
+
onRemove: () => {
|
|
26375
|
+
setOpen(new Set([...open].filter((i) => i !== index).map((i) => i > index ? i - 1 : i)));
|
|
26376
|
+
update(questions.filter((_, i) => i !== index), {
|
|
26377
|
+
target: "field",
|
|
26378
|
+
name: question.name
|
|
26379
|
+
});
|
|
26380
|
+
}
|
|
26381
|
+
}),
|
|
26382
|
+
children: [/* @__PURE__ */ jsx(FieldBody, {
|
|
26383
|
+
id: bodyId,
|
|
26384
|
+
placement: "branch",
|
|
26385
|
+
className: valueEditor_module_default.body,
|
|
26386
|
+
hidden: !open.has(index),
|
|
26387
|
+
children: /* @__PURE__ */ jsxs(FieldGroup, {
|
|
26388
|
+
className: question.type === "noul" ? "gap-0" : "gap-3",
|
|
26389
|
+
children: [/* @__PURE__ */ jsx(DecisionField, {
|
|
26390
|
+
inline: true,
|
|
26391
|
+
placeholder: t("decision.instructionsPlaceholder"),
|
|
26392
|
+
label: t("decision.instructions"),
|
|
26393
|
+
schema: instructionSchema,
|
|
26394
|
+
value: question.instructions,
|
|
26395
|
+
disabled,
|
|
26396
|
+
onCommit: (instructions) => edit(index, {
|
|
26397
|
+
...question,
|
|
26398
|
+
instructions
|
|
26399
|
+
})
|
|
26400
|
+
}), question.type === "noul" ? /* @__PURE__ */ jsx(DecisionNoulCriteria, {
|
|
26401
|
+
question,
|
|
26402
|
+
disabled,
|
|
26403
|
+
onChange: (criteria) => edit(index, {
|
|
26404
|
+
...question,
|
|
26405
|
+
criteria
|
|
26406
|
+
})
|
|
26407
|
+
}) : question.type === "score" ? /* @__PURE__ */ jsx(Field, {
|
|
26408
|
+
className: "gap-1.5",
|
|
26409
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
26410
|
+
className: "flex items-center gap-1",
|
|
26411
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
26412
|
+
className: "text-xs font-normal leading-4",
|
|
26413
|
+
children: t("decision.levels")
|
|
26414
|
+
}), /* @__PURE__ */ jsx(DecisionLevelsHelp, {})]
|
|
26415
|
+
})
|
|
26416
|
+
}) : null]
|
|
26417
|
+
})
|
|
26418
|
+
}), question.type !== "noul" && /* @__PURE__ */ jsx("div", {
|
|
26419
|
+
id: `${bodyId}-criteria`,
|
|
26420
|
+
className: "col-span-full",
|
|
26421
|
+
hidden: !open.has(index),
|
|
26422
|
+
children: /* @__PURE__ */ jsx(FieldLayout, {
|
|
26423
|
+
layout: "ports",
|
|
26424
|
+
depth: 1,
|
|
26425
|
+
children: question.type === "choice" ? /* @__PURE__ */ jsx(DecisionChoices, {
|
|
26426
|
+
question,
|
|
26427
|
+
disabled,
|
|
26428
|
+
onChange: (criteria, removed) => edit(index, {
|
|
26429
|
+
...question,
|
|
26430
|
+
criteria
|
|
26431
|
+
}, removed)
|
|
26432
|
+
}) : /* @__PURE__ */ jsx(DecisionLevels, {
|
|
26433
|
+
levels: question.criteria,
|
|
26434
|
+
disabled,
|
|
26435
|
+
onChange: (criteria, removed) => edit(index, {
|
|
26436
|
+
...question,
|
|
26437
|
+
criteria
|
|
26438
|
+
}, removed)
|
|
26439
|
+
})
|
|
26440
|
+
})
|
|
26441
|
+
})]
|
|
26442
|
+
});
|
|
26443
|
+
}
|
|
26444
|
+
}), !questions.length && /* @__PURE__ */ jsx("div", {
|
|
26445
|
+
className: `${valueEditor_module_default.collectionActions} pb-4`,
|
|
26446
|
+
"data-layout": "ports",
|
|
26447
|
+
children: /* @__PURE__ */ jsxs(Button$1, {
|
|
26448
|
+
type: "button",
|
|
26449
|
+
variant: "ghost",
|
|
26450
|
+
size: "field",
|
|
26451
|
+
className: valueEditor_module_default.emptyObjectContent,
|
|
26452
|
+
disabled,
|
|
26453
|
+
onClick: () => add(),
|
|
26454
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
26455
|
+
"aria-hidden": "true",
|
|
26456
|
+
className: "i-lucide-light:plus"
|
|
26457
|
+
}), t("decision.addQuestion")]
|
|
26458
|
+
})
|
|
26459
|
+
})]
|
|
26460
|
+
}), saveError && /* @__PURE__ */ jsx(FieldError, {
|
|
26461
|
+
className: "px-3 pb-4",
|
|
26462
|
+
children: t("decision.saveFailed")
|
|
26463
|
+
})]
|
|
26464
|
+
});
|
|
26465
|
+
}
|
|
26466
|
+
function DecisionNoulCriteria({ question, disabled, onChange }) {
|
|
26467
|
+
const t = useTranslate();
|
|
26468
|
+
const id = useId();
|
|
26469
|
+
const count = ["true", "false"].filter((key) => question.criteria?.[key]?.trim()).length;
|
|
26470
|
+
const [open, setOpen] = useState(() => count > 0);
|
|
26471
|
+
return /* @__PURE__ */ jsxs(Field, {
|
|
26472
|
+
className: "gap-2",
|
|
26473
|
+
children: [/* @__PURE__ */ jsxs(Button$1, {
|
|
26474
|
+
type: "button",
|
|
26475
|
+
variant: "disclosure",
|
|
26476
|
+
size: "field",
|
|
26477
|
+
className: "justify-start px-0",
|
|
26478
|
+
"aria-expanded": open,
|
|
26479
|
+
"aria-controls": id,
|
|
26480
|
+
onClick: () => setOpen(!open),
|
|
26481
|
+
children: [
|
|
26482
|
+
/* @__PURE__ */ jsx("i", {
|
|
26483
|
+
"aria-hidden": "true",
|
|
26484
|
+
className: open ? "i-lucide-light:chevron-down" : "i-lucide-light:chevron-right"
|
|
26485
|
+
}),
|
|
26486
|
+
t("decision.criteria"),
|
|
26487
|
+
!open && count > 0 && /* @__PURE__ */ jsx("span", {
|
|
26488
|
+
className: "ml-auto text-muted-foreground",
|
|
26489
|
+
children: t("decision.criteriaSet", { count })
|
|
26490
|
+
})
|
|
26491
|
+
]
|
|
26492
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
26493
|
+
id,
|
|
26494
|
+
hidden: !open,
|
|
26495
|
+
children: /* @__PURE__ */ jsx(FieldGroup, {
|
|
26496
|
+
className: "gap-3",
|
|
26497
|
+
children: ["true", "false"].map((key) => /* @__PURE__ */ jsx(DecisionField, {
|
|
26498
|
+
label: t(`decision.${key}`),
|
|
26499
|
+
schema: {
|
|
26500
|
+
"type": "string",
|
|
26501
|
+
"ui:widget": "text"
|
|
26502
|
+
},
|
|
26503
|
+
value: question.criteria?.[key] ?? "",
|
|
26504
|
+
disabled,
|
|
26505
|
+
onCommit: (value) => onChange({
|
|
26506
|
+
...question.criteria,
|
|
26507
|
+
[key]: value
|
|
26508
|
+
})
|
|
26509
|
+
}, key))
|
|
26510
|
+
})
|
|
26511
|
+
})]
|
|
26512
|
+
});
|
|
26513
|
+
}
|
|
26514
|
+
function DecisionChoices({ question, disabled, onChange }) {
|
|
26515
|
+
const t = useTranslate();
|
|
26516
|
+
const choices = question.criteria;
|
|
26517
|
+
const added = useRef(/* @__PURE__ */ new WeakSet());
|
|
26518
|
+
function add(after) {
|
|
26519
|
+
if (choices.length >= decisionLimits.choice) return;
|
|
26520
|
+
let name = "category1";
|
|
26521
|
+
let suffix = 2;
|
|
26522
|
+
while (choices.some((choice) => choice.name === name)) name = `category${suffix++}`;
|
|
26523
|
+
const choice = {
|
|
26524
|
+
name,
|
|
26525
|
+
description: ""
|
|
26526
|
+
};
|
|
26527
|
+
added.current.add(choice);
|
|
26528
|
+
onChange(choices.toSpliced(after + 1, 0, choice));
|
|
26529
|
+
}
|
|
26530
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(ArrayFieldList, {
|
|
26531
|
+
values: choices,
|
|
26532
|
+
label: t("decision.choices"),
|
|
26533
|
+
children: (_entry, index) => {
|
|
26534
|
+
const choice = choices[index];
|
|
26535
|
+
const names = choices.filter((_, i) => i !== index).map((item) => item.name);
|
|
26536
|
+
return /* @__PURE__ */ jsx(DecisionChoice, {
|
|
26537
|
+
choice,
|
|
26538
|
+
names,
|
|
26539
|
+
disabled,
|
|
26540
|
+
canAdd: choices.length < decisionLimits.choice,
|
|
26541
|
+
initiallyOpen: added.current.has(choice) || !matchesSchema(choice.name, nameSchema(names)),
|
|
26542
|
+
onAdd: () => add(index),
|
|
26543
|
+
onRemove: () => onChange(choices.toSpliced(index, 1), {
|
|
26544
|
+
target: "arrayItem",
|
|
26545
|
+
name: choices[index].name
|
|
26546
|
+
}),
|
|
26547
|
+
onChange: (updated) => onChange(choices.map((item, i) => i === index ? updated : item))
|
|
26548
|
+
});
|
|
26549
|
+
}
|
|
26550
|
+
}), !choices.length && /* @__PURE__ */ jsx("div", {
|
|
26551
|
+
className: valueEditor_module_default.collectionActions,
|
|
26552
|
+
"data-layout": "ports",
|
|
26553
|
+
children: /* @__PURE__ */ jsxs(Button$1, {
|
|
26554
|
+
type: "button",
|
|
26555
|
+
variant: "ghost",
|
|
26556
|
+
size: "field",
|
|
26557
|
+
className: valueEditor_module_default.emptyObjectContent,
|
|
26558
|
+
disabled,
|
|
26559
|
+
onClick: () => add(-1),
|
|
26560
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
26561
|
+
"aria-hidden": "true",
|
|
26562
|
+
className: "i-lucide-light:plus"
|
|
26563
|
+
}), t("decision.addChoice")]
|
|
26564
|
+
})
|
|
26565
|
+
})] });
|
|
26566
|
+
}
|
|
26567
|
+
function DecisionChoice({ choice, names, disabled, canAdd, initiallyOpen, onAdd, onRemove, onChange }) {
|
|
26568
|
+
const t = useTranslate();
|
|
26569
|
+
const id = useId();
|
|
26570
|
+
const [open, setOpen] = useState(initiallyOpen);
|
|
26571
|
+
const row = useRef(null);
|
|
26572
|
+
const focusDescription = useRef(false);
|
|
26573
|
+
useEffect(() => {
|
|
26574
|
+
if (!open || !focusDescription.current) return;
|
|
26575
|
+
focusDescription.current = false;
|
|
26576
|
+
row.current?.querySelector("textarea")?.focus();
|
|
26577
|
+
}, [open]);
|
|
26578
|
+
return /* @__PURE__ */ jsxs(FieldRow, {
|
|
26579
|
+
ref: row,
|
|
26580
|
+
stacking: "fields",
|
|
26581
|
+
label: choice.name,
|
|
26582
|
+
layout: "ports",
|
|
26583
|
+
"data-output": true,
|
|
26584
|
+
"data-object-child": true,
|
|
26585
|
+
"data-expansion": "branch",
|
|
26586
|
+
"data-expanded": open || void 0,
|
|
26587
|
+
disclosure: {
|
|
26588
|
+
controls: id,
|
|
26589
|
+
expanded: open,
|
|
26590
|
+
onToggle: () => setOpen(!open)
|
|
26591
|
+
},
|
|
26592
|
+
header: /* @__PURE__ */ jsx("span", {
|
|
26593
|
+
"data-field-name": true,
|
|
26594
|
+
children: /* @__PURE__ */ jsx(DecisionField, {
|
|
26595
|
+
inline: true,
|
|
26596
|
+
label: t("decision.choiceName"),
|
|
26597
|
+
placeholder: t("decision.choiceName"),
|
|
26598
|
+
schema: nameSchema(names),
|
|
26599
|
+
value: choice.name,
|
|
26600
|
+
disabled,
|
|
26601
|
+
onCommit: (name) => onChange({
|
|
26602
|
+
...choice,
|
|
26603
|
+
name
|
|
26604
|
+
})
|
|
26605
|
+
})
|
|
26606
|
+
}),
|
|
26607
|
+
actions: !disabled && /* @__PURE__ */ jsx(DecisionItemActions, {
|
|
26608
|
+
addLabel: t("decision.addChoice"),
|
|
26609
|
+
removeLabel: t("decision.removeChoice"),
|
|
26610
|
+
canAdd,
|
|
26611
|
+
onAdd,
|
|
26612
|
+
onRemove
|
|
26613
|
+
}),
|
|
26614
|
+
children: [/* @__PURE__ */ jsx(FieldValuePreview, {
|
|
26615
|
+
style: {
|
|
26616
|
+
gridColumn: "type / content-end",
|
|
26617
|
+
gridRow: 1
|
|
26618
|
+
},
|
|
26619
|
+
empty: !choice.description,
|
|
26620
|
+
"data-readonly": disabled || void 0,
|
|
26621
|
+
"aria-label": t("decision.choiceDescription"),
|
|
26622
|
+
"aria-expanded": open,
|
|
26623
|
+
"aria-controls": id,
|
|
26624
|
+
onClick: () => {
|
|
26625
|
+
focusDescription.current = !open;
|
|
26626
|
+
setOpen(!open);
|
|
26627
|
+
},
|
|
26628
|
+
children: choice.description || t("decision.choiceDescription")
|
|
26629
|
+
}), /* @__PURE__ */ jsx(FieldBody, {
|
|
26630
|
+
id,
|
|
26631
|
+
placement: "branch",
|
|
26632
|
+
className: valueEditor_module_default.body,
|
|
26633
|
+
hidden: !open,
|
|
26634
|
+
children: /* @__PURE__ */ jsx(DecisionField, {
|
|
26635
|
+
inline: true,
|
|
26636
|
+
label: t("decision.choiceDescription"),
|
|
26637
|
+
placeholder: t("decision.choiceDescription"),
|
|
26638
|
+
schema: {
|
|
26639
|
+
"type": "string",
|
|
26640
|
+
"ui:widget": "text"
|
|
26641
|
+
},
|
|
26642
|
+
value: choice.description,
|
|
26643
|
+
disabled,
|
|
26644
|
+
onCommit: (description) => onChange({
|
|
26645
|
+
...choice,
|
|
26646
|
+
description
|
|
26647
|
+
})
|
|
26648
|
+
})
|
|
26649
|
+
})]
|
|
26650
|
+
});
|
|
26651
|
+
}
|
|
26652
|
+
function DecisionLevelsHelp() {
|
|
26653
|
+
const t = useTranslate();
|
|
26654
|
+
return /* @__PURE__ */ jsxs(HelpButton, {
|
|
26655
|
+
label: t("decision.levels"),
|
|
26656
|
+
children: [
|
|
26657
|
+
t("decision.levelsCount"),
|
|
26658
|
+
" ",
|
|
26659
|
+
t("decision.levelsHint")
|
|
26660
|
+
]
|
|
26661
|
+
});
|
|
26662
|
+
}
|
|
26663
|
+
function DecisionLevels({ levels, disabled, onChange }) {
|
|
26664
|
+
const t = useTranslate();
|
|
26665
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(ArrayFieldList, {
|
|
26666
|
+
values: levels,
|
|
26667
|
+
label: t("decision.levels"),
|
|
26668
|
+
children: (_entry, index) => /* @__PURE__ */ jsx(DecisionLevel, {
|
|
26669
|
+
value: levels[index],
|
|
26670
|
+
index,
|
|
26671
|
+
disabled,
|
|
26672
|
+
canAdd: levels.length < decisionLimits.score,
|
|
26673
|
+
onAdd: () => {
|
|
26674
|
+
if (levels.length < decisionLimits.score) onChange(levels.toSpliced(index + 1, 0, ""));
|
|
26675
|
+
},
|
|
26676
|
+
onRemove: () => onChange(levels.toSpliced(index, 1), {
|
|
26677
|
+
target: "arrayItem",
|
|
26678
|
+
name: String(index)
|
|
26679
|
+
}),
|
|
26680
|
+
onChange: (value) => onChange(levels.map((level, i) => i === index ? value : level))
|
|
26681
|
+
})
|
|
26682
|
+
}), levels.length < 2 && /* @__PURE__ */ jsx("div", {
|
|
26683
|
+
className: `${valueEditor_module_default.collectionActions} ${levels.length ? "mt-2" : ""}`,
|
|
26684
|
+
"data-layout": "ports",
|
|
26685
|
+
children: /* @__PURE__ */ jsx(ValueEditorFeedback, {
|
|
26686
|
+
error: t("decision.levelsCount"),
|
|
26687
|
+
children: (errorId) => /* @__PURE__ */ jsxs(Button$1, {
|
|
26688
|
+
type: "button",
|
|
26689
|
+
variant: "ghost",
|
|
26690
|
+
size: "field",
|
|
26691
|
+
className: valueEditor_module_default.emptyObjectContent,
|
|
26692
|
+
"data-field-prompt": "true",
|
|
26693
|
+
"aria-invalid": "true",
|
|
26694
|
+
"aria-describedby": errorId,
|
|
26695
|
+
disabled,
|
|
26696
|
+
onClick: () => onChange([...levels, ...Array(2 - levels.length).fill("")]),
|
|
26697
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
26698
|
+
"aria-hidden": "true",
|
|
26699
|
+
className: "i-lucide-light:plus"
|
|
26700
|
+
}), t("decision.addLevel")]
|
|
26701
|
+
})
|
|
26702
|
+
})
|
|
26703
|
+
})] });
|
|
26704
|
+
}
|
|
26705
|
+
function DecisionLevel({ value, index, disabled, canAdd, onAdd, onRemove, onChange }) {
|
|
26706
|
+
const t = useTranslate();
|
|
26707
|
+
const label = t("decision.levelNumber", { level: index });
|
|
26708
|
+
return /* @__PURE__ */ jsx(FieldRow, {
|
|
26709
|
+
stacking: "fields",
|
|
26710
|
+
label,
|
|
26711
|
+
layout: "ports",
|
|
26712
|
+
columns: "[toggle] var(--field-toggle-width, 20px) var(--field-value-name-gap, 2px) [handle] max-content 8px [type] minmax(0, 1fr) [content-end] var(--field-table-actions-gap, 4px) [nullable actions] var(--field-actions-width, 28px) [end]",
|
|
26713
|
+
"data-output": true,
|
|
26714
|
+
"data-object-child": true,
|
|
26715
|
+
header: /* @__PURE__ */ jsx("span", {
|
|
26716
|
+
"data-field-name": true,
|
|
26717
|
+
className: "flex items-center text-muted-foreground",
|
|
26718
|
+
style: { fontVariantNumeric: "tabular-nums" },
|
|
26719
|
+
children: label
|
|
26720
|
+
}),
|
|
26721
|
+
actions: !disabled && /* @__PURE__ */ jsx(DecisionItemActions, {
|
|
26722
|
+
addLabel: t("decision.addLevel"),
|
|
26723
|
+
removeLabel: t("decision.removeLevel"),
|
|
26724
|
+
canAdd,
|
|
26725
|
+
onAdd,
|
|
26726
|
+
onRemove
|
|
26727
|
+
}),
|
|
26728
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
26729
|
+
style: {
|
|
26730
|
+
gridColumn: "type / content-end",
|
|
26731
|
+
gridRow: 1
|
|
26732
|
+
},
|
|
26733
|
+
children: /* @__PURE__ */ jsx(DecisionField, {
|
|
26734
|
+
inline: true,
|
|
26735
|
+
label: `${label} ${t("decision.levelDescription")}`,
|
|
26736
|
+
placeholder: t("decision.levelPlaceholder"),
|
|
26737
|
+
schema: textSchema,
|
|
26738
|
+
value,
|
|
26739
|
+
disabled,
|
|
26740
|
+
onCommit: (description) => onChange(description)
|
|
26741
|
+
})
|
|
26742
|
+
})
|
|
26743
|
+
});
|
|
26744
|
+
}
|
|
26745
|
+
function DecisionItemActions({ addLabel, removeLabel, canAdd = true, onAdd, onRemove }) {
|
|
26746
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
26747
|
+
render: /* @__PURE__ */ jsx(Button$1, {
|
|
26748
|
+
type: "button",
|
|
26749
|
+
variant: "ghost",
|
|
26750
|
+
size: "icon-xs",
|
|
26751
|
+
"aria-label": addLabel,
|
|
26752
|
+
disabled: !canAdd,
|
|
26753
|
+
onClick: onAdd
|
|
26754
|
+
}),
|
|
26755
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
26756
|
+
"aria-hidden": "true",
|
|
26757
|
+
className: "i-tabler-light:square-rounded-plus text-lg"
|
|
26758
|
+
})
|
|
26759
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: addLabel })] }), /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
26760
|
+
render: /* @__PURE__ */ jsx(Button$1, {
|
|
26761
|
+
type: "button",
|
|
26762
|
+
variant: "ghost",
|
|
26763
|
+
size: "icon-xs",
|
|
26764
|
+
className: "-translate-x-0.5",
|
|
26765
|
+
"aria-label": removeLabel,
|
|
26766
|
+
onClick: onRemove
|
|
26767
|
+
}),
|
|
26768
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
26769
|
+
"aria-hidden": "true",
|
|
26770
|
+
className: "i-tabler-light:square-rounded-minus text-lg"
|
|
26771
|
+
})
|
|
26772
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: removeLabel })] })] });
|
|
26773
|
+
}
|
|
26774
|
+
//#endregion
|
|
26775
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/ComboboxRootContext.js
|
|
26776
|
+
var ComboboxRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
26777
|
+
if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
|
|
26778
|
+
var ComboboxFloatingContext = /*#__PURE__*/ React.createContext(void 0);
|
|
26779
|
+
if (process.env.NODE_ENV !== "production") ComboboxFloatingContext.displayName = "ComboboxFloatingContext";
|
|
26780
|
+
var ComboboxDerivedItemsContext = /*#__PURE__*/ React.createContext(void 0);
|
|
26781
|
+
if (process.env.NODE_ENV !== "production") ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext";
|
|
26782
|
+
var ComboboxInputValueContext = /*#__PURE__*/ React.createContext("");
|
|
26783
|
+
if (process.env.NODE_ENV !== "production") ComboboxInputValueContext.displayName = "ComboboxInputValueContext";
|
|
26784
|
+
function useComboboxRootContext() {
|
|
26785
|
+
const context = React.useContext(ComboboxRootContext);
|
|
26786
|
+
if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage(22));
|
|
26787
|
+
return context;
|
|
26788
|
+
}
|
|
26789
|
+
function useComboboxFloatingContext() {
|
|
26790
|
+
const context = React.useContext(ComboboxFloatingContext);
|
|
26791
|
+
if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage(23));
|
|
26792
|
+
return context;
|
|
26793
|
+
}
|
|
26794
|
+
function useComboboxDerivedItemsContext() {
|
|
26795
|
+
const context = React.useContext(ComboboxDerivedItemsContext);
|
|
26796
|
+
if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage(24));
|
|
26797
|
+
return context;
|
|
26798
|
+
}
|
|
26799
|
+
function useComboboxInputValueContext() {
|
|
26800
|
+
return React.useContext(ComboboxInputValueContext);
|
|
26801
|
+
}
|
|
26802
|
+
//#endregion
|
|
26803
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/store.js
|
|
26804
|
+
var selectors = {
|
|
26805
|
+
id: createSelector((state) => state.id),
|
|
26806
|
+
labelId: createSelector((state) => state.labelId),
|
|
26807
|
+
items: createSelector((state) => state.items),
|
|
26808
|
+
selectedValue: createSelector((state) => state.selectedValue),
|
|
26809
|
+
hasSelectionChips: createSelector((state) => {
|
|
26810
|
+
const selectedValue = state.selectedValue;
|
|
26811
|
+
return Array.isArray(selectedValue) && selectedValue.length > 0;
|
|
26812
|
+
}),
|
|
26813
|
+
hasSelectedValue: createSelector((state) => {
|
|
26814
|
+
const { selectedValue, selectionMode } = state;
|
|
26815
|
+
if (selectedValue == null) return false;
|
|
26816
|
+
if (selectionMode === "multiple" && Array.isArray(selectedValue)) return selectedValue.length > 0;
|
|
26817
|
+
return true;
|
|
26818
|
+
}),
|
|
26819
|
+
hasNullItemLabel: createSelector((state, enabled) => {
|
|
26820
|
+
return enabled ? hasNullItemLabel(state.items) : false;
|
|
26821
|
+
}),
|
|
26822
|
+
open: createSelector((state) => state.open),
|
|
26823
|
+
mounted: createSelector((state) => state.mounted),
|
|
26824
|
+
forceMounted: createSelector((state) => state.forceMounted),
|
|
26825
|
+
inline: createSelector((state) => state.inline),
|
|
26826
|
+
activeIndex: createSelector((state) => state.activeIndex),
|
|
26827
|
+
selectedIndex: createSelector((state) => state.selectedIndex),
|
|
26828
|
+
isActive: createSelector((state, index) => state.activeIndex === index),
|
|
26829
|
+
isSelected: createSelector((state, itemValue) => {
|
|
26830
|
+
const comparer = state.isItemEqualToValue;
|
|
26831
|
+
const selectedValue = state.selectedValue;
|
|
26832
|
+
if (Array.isArray(selectedValue)) return selectedValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
|
|
26833
|
+
return compareItemEquality(itemValue, selectedValue, comparer);
|
|
26834
|
+
}),
|
|
26835
|
+
transitionStatus: createSelector((state) => state.transitionStatus),
|
|
26836
|
+
popupProps: createSelector((state) => state.popupProps),
|
|
26837
|
+
inputProps: createSelector((state) => state.inputProps),
|
|
26838
|
+
triggerProps: createSelector((state) => state.triggerProps),
|
|
26839
|
+
getItemProps: createSelector((state) => state.getItemProps),
|
|
26840
|
+
positionerElement: createSelector((state) => state.positionerElement),
|
|
26841
|
+
listElement: createSelector((state) => state.listElement),
|
|
26842
|
+
triggerElement: createSelector((state) => state.triggerElement),
|
|
26843
|
+
inputElement: createSelector((state) => state.inputElement),
|
|
26844
|
+
inputGroupElement: createSelector((state) => state.inputGroupElement),
|
|
26845
|
+
popupSide: createSelector((state) => state.popupSide),
|
|
26846
|
+
openMethod: createSelector((state) => state.openMethod),
|
|
26847
|
+
inputInsidePopup: createSelector((state) => state.inputInsidePopup),
|
|
26848
|
+
selectionMode: createSelector((state) => state.selectionMode),
|
|
26849
|
+
name: createSelector((state) => state.name),
|
|
26850
|
+
form: createSelector((state) => state.form),
|
|
26851
|
+
disabled: createSelector((state) => state.disabled),
|
|
26852
|
+
readOnly: createSelector((state) => state.readOnly),
|
|
26853
|
+
required: createSelector((state) => state.required),
|
|
26854
|
+
grid: createSelector((state) => state.grid),
|
|
26855
|
+
virtualized: createSelector((state) => state.virtualized),
|
|
26856
|
+
itemToStringLabel: createSelector((state) => state.itemToStringLabel),
|
|
26857
|
+
isItemEqualToValue: createSelector((state) => state.isItemEqualToValue),
|
|
26858
|
+
modal: createSelector((state) => state.modal),
|
|
26859
|
+
autoHighlight: createSelector((state) => state.autoHighlight),
|
|
26860
|
+
submitOnItemClick: createSelector((state) => state.submitOnItemClick)
|
|
26861
|
+
};
|
|
26862
|
+
//#endregion
|
|
26863
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/index.js
|
|
26864
|
+
/**
|
|
26865
|
+
* Enhanced filter using Intl.Collator for more robust string matching.
|
|
26866
|
+
* Uses the provided `itemToStringLabel` function if available, otherwise falls back to:
|
|
26867
|
+
* • When `item` is an object with a `value` property, that property is used.
|
|
26868
|
+
* • When `item` is a primitive (e.g. `string`), it is used directly.
|
|
26869
|
+
*/
|
|
26870
|
+
function createCollatorItemFilter(collatorFilter, itemToStringLabel) {
|
|
26871
|
+
return (item, query) => {
|
|
26872
|
+
if (item == null) return false;
|
|
26873
|
+
const itemString = stringifyAsLabel(item, itemToStringLabel);
|
|
26874
|
+
return collatorFilter.contains(itemString, query);
|
|
26875
|
+
};
|
|
26876
|
+
}
|
|
26877
|
+
/**
|
|
26878
|
+
* Enhanced filter for single selection mode using Intl.Collator that shows all items
|
|
26879
|
+
* when query is empty or matches the current selection, making it easier to browse options.
|
|
26880
|
+
*/
|
|
26881
|
+
function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) {
|
|
26882
|
+
return (item, query) => {
|
|
26883
|
+
if (item == null) return false;
|
|
26884
|
+
if (!query) return true;
|
|
26885
|
+
const itemString = stringifyAsLabel(item, itemToStringLabel);
|
|
26886
|
+
const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
|
|
26887
|
+
if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) return true;
|
|
26888
|
+
return collatorFilter.contains(itemString, query);
|
|
26889
|
+
};
|
|
26890
|
+
}
|
|
26891
|
+
//#endregion
|
|
26892
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/filter.js
|
|
26893
|
+
var filterCache = /* @__PURE__ */ new Map();
|
|
26894
|
+
function getFilter(options = {}) {
|
|
26895
|
+
const mergedOptions = {
|
|
26896
|
+
usage: "search",
|
|
26897
|
+
sensitivity: "base",
|
|
26898
|
+
ignorePunctuation: true,
|
|
26899
|
+
...options
|
|
26900
|
+
};
|
|
26901
|
+
const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;
|
|
26902
|
+
const cachedFilter = filterCache.get(cacheKey);
|
|
26903
|
+
if (cachedFilter) return cachedFilter;
|
|
26904
|
+
const collator = new Intl.Collator(options.locale, mergedOptions);
|
|
26905
|
+
const filter = {
|
|
26906
|
+
contains(item, query, itemToString) {
|
|
26907
|
+
if (!query) return true;
|
|
26908
|
+
const itemString = stringifyAsLabel(item, itemToString);
|
|
26909
|
+
for (let i = 0; i <= itemString.length - query.length; i += 1) if (collator.compare(itemString.slice(i, i + query.length), query) === 0) return true;
|
|
26910
|
+
return false;
|
|
26911
|
+
},
|
|
26912
|
+
startsWith(item, query, itemToString) {
|
|
26913
|
+
if (!query) return true;
|
|
26914
|
+
const itemString = stringifyAsLabel(item, itemToString);
|
|
26915
|
+
return collator.compare(itemString.slice(0, query.length), query) === 0;
|
|
26916
|
+
},
|
|
26917
|
+
endsWith(item, query, itemToString) {
|
|
26918
|
+
if (!query) return true;
|
|
26919
|
+
const itemString = stringifyAsLabel(item, itemToString);
|
|
26920
|
+
const queryLength = query.length;
|
|
26921
|
+
return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;
|
|
26922
|
+
}
|
|
26923
|
+
};
|
|
26924
|
+
filterCache.set(cacheKey, filter);
|
|
26925
|
+
return filter;
|
|
26926
|
+
}
|
|
26927
|
+
function stringifyLocale(locale) {
|
|
26928
|
+
if (Array.isArray(locale)) return locale.map((value) => stringifyLocale(value)).join(",");
|
|
26929
|
+
if (locale == null) return "";
|
|
26930
|
+
return String(locale);
|
|
26931
|
+
}
|
|
26932
|
+
//#endregion
|
|
26933
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js
|
|
26934
|
+
/**
|
|
26935
|
+
* Matches items against a query using `Intl.Collator` for robust string matching.
|
|
26936
|
+
*/
|
|
26937
|
+
var useCoreFilter = getFilter;
|
|
26938
|
+
//#endregion
|
|
26939
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/constants.js
|
|
26940
|
+
var NO_ACTIVE_VALUE = Symbol("none");
|
|
26941
|
+
var INITIAL_LAST_HIGHLIGHT = {
|
|
26942
|
+
value: NO_ACTIVE_VALUE,
|
|
26943
|
+
index: -1
|
|
26944
|
+
};
|
|
26945
|
+
//#endregion
|
|
26946
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js
|
|
26947
|
+
/**
|
|
26948
|
+
* @internal
|
|
26949
|
+
*/
|
|
26950
|
+
function AriaCombobox(props) {
|
|
26951
|
+
const { id: idProp, onOpenChangeComplete: onOpenChangeCompleteProp, defaultSelectedValue = null, selectedValue: selectedValueProp, onSelectedValueChange, defaultInputValue: defaultInputValueProp, inputValue: inputValueProp, open: openProp, defaultOpen = false, selectionMode = "none", onItemHighlighted: onItemHighlightedProp, name: nameProp, form, disabled: disabledProp = false, readOnly = false, required = false, inputRef: inputRefProp, grid = false, items, filteredItems: filteredItemsProp, filter: filterProp, openOnInputClick = true, autoHighlight = false, keepHighlight = false, highlightItemOnHover = true, loopFocus = true, itemToStringLabel, itemToStringValue, isItemEqualToValue = defaultItemEquality, virtualized = false, inline: inlineProp = false, fillInputOnItemPress = true, modal = false, limit = -1, autoComplete = "list", formAutoComplete, locale, submitOnItemClick = false } = props;
|
|
26952
|
+
const { clearErrors } = useFormContext();
|
|
26953
|
+
const { setDirty, validityData, shouldValidateOnChange, setFilled, name: fieldName, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
|
|
26954
|
+
const id = useLabelableId({ id: idProp });
|
|
26955
|
+
const collatorFilter = useCoreFilter({ locale });
|
|
26956
|
+
const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React.useState(false);
|
|
26957
|
+
const [closeQuery, setCloseQuery] = React.useState(null);
|
|
26958
|
+
const listRef = React.useRef([]);
|
|
26959
|
+
const labelsRef = React.useRef([]);
|
|
26960
|
+
const popupRef = React.useRef(null);
|
|
26961
|
+
const inputRef = React.useRef(null);
|
|
26962
|
+
const startDismissRef = React.useRef(null);
|
|
26963
|
+
const endDismissRef = React.useRef(null);
|
|
26964
|
+
const emptyRef = React.useRef(null);
|
|
26965
|
+
const keyboardActiveRef = React.useRef(true);
|
|
26966
|
+
const hadInputClearRef = React.useRef(false);
|
|
26967
|
+
const chipsContainerRef = React.useRef(null);
|
|
26968
|
+
const clearRef = React.useRef(null);
|
|
26969
|
+
const selectionEventRef = React.useRef(null);
|
|
26970
|
+
const lastHighlightRef = React.useRef(INITIAL_LAST_HIGHLIGHT);
|
|
26971
|
+
const pendingQueryHighlightRef = React.useRef(null);
|
|
26972
|
+
/**
|
|
26973
|
+
* Contains the currently visible list of item values post-filtering.
|
|
26974
|
+
*/
|
|
26975
|
+
const valuesRef = React.useRef([]);
|
|
26976
|
+
/**
|
|
26977
|
+
* Contains all item values in a stable, unfiltered order.
|
|
26978
|
+
* This is only used when `items` prop is not provided.
|
|
26979
|
+
* It accumulates values on first mount and does not remove them on unmount due to
|
|
26980
|
+
* filtering, providing a stable index for selected value tracking.
|
|
26981
|
+
*/
|
|
26982
|
+
const allValuesRef = React.useRef([]);
|
|
26983
|
+
const disabled = fieldDisabled || disabledProp;
|
|
26984
|
+
const name = fieldName ?? nameProp;
|
|
26985
|
+
const multiple = selectionMode === "multiple";
|
|
26986
|
+
const single = selectionMode === "single";
|
|
26987
|
+
const hasInputValue = inputValueProp !== void 0 || defaultInputValueProp !== void 0;
|
|
26988
|
+
const hasItems = items !== void 0;
|
|
26989
|
+
const hasFilteredItemsProp = filteredItemsProp !== void 0;
|
|
26990
|
+
let autoHighlightMode;
|
|
26991
|
+
if (autoHighlight === "always") autoHighlightMode = "always";
|
|
26992
|
+
else autoHighlightMode = autoHighlight ? "input-change" : false;
|
|
26993
|
+
const [selectedValue, setSelectedValueUnwrapped] = useControlled({
|
|
26994
|
+
controlled: selectedValueProp,
|
|
26995
|
+
default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY$1 : defaultSelectedValue,
|
|
26996
|
+
name: "Combobox",
|
|
26997
|
+
state: "selectedValue"
|
|
26998
|
+
});
|
|
26999
|
+
const filter = React.useMemo(() => {
|
|
27000
|
+
if (filterProp === null) return () => true;
|
|
27001
|
+
if (filterProp !== void 0) return filterProp;
|
|
27002
|
+
if (single && !queryChangedAfterOpen) return createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue);
|
|
27003
|
+
return createCollatorItemFilter(collatorFilter, itemToStringLabel);
|
|
27004
|
+
}, [
|
|
27005
|
+
filterProp,
|
|
27006
|
+
single,
|
|
27007
|
+
selectedValue,
|
|
27008
|
+
queryChangedAfterOpen,
|
|
27009
|
+
collatorFilter,
|
|
27010
|
+
itemToStringLabel
|
|
27011
|
+
]);
|
|
27012
|
+
const initialDefaultInputValue = useRefWithInit(() => {
|
|
27013
|
+
if (hasInputValue) return defaultInputValueProp ?? "";
|
|
27014
|
+
if (single) return stringifyAsLabel(selectedValue, itemToStringLabel);
|
|
27015
|
+
return "";
|
|
27016
|
+
}).current;
|
|
27017
|
+
const [inputValue, setInputValueUnwrapped] = useControlled({
|
|
27018
|
+
controlled: inputValueProp,
|
|
27019
|
+
default: initialDefaultInputValue,
|
|
27020
|
+
name: "Combobox",
|
|
27021
|
+
state: "inputValue"
|
|
27022
|
+
});
|
|
27023
|
+
const [open, setOpenUnwrapped] = useControlled({
|
|
27024
|
+
controlled: openProp,
|
|
27025
|
+
default: defaultOpen,
|
|
27026
|
+
name: "Combobox",
|
|
27027
|
+
state: "open"
|
|
27028
|
+
});
|
|
27029
|
+
const isGrouped = isGroupedItems(items);
|
|
27030
|
+
const query = closeQuery ?? (inputValue === "" ? "" : String(inputValue).trim());
|
|
27031
|
+
const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
|
|
27032
|
+
const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== "" && selectedLabelString !== "" && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
|
|
27033
|
+
const filterQuery = shouldBypassFiltering ? "" : query;
|
|
27034
|
+
const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering;
|
|
27035
|
+
const flatItems = React.useMemo(() => {
|
|
27036
|
+
if (!items) return EMPTY_ARRAY$1;
|
|
27037
|
+
if (isGrouped) return items.flatMap((group) => group.items);
|
|
27038
|
+
return items;
|
|
27039
|
+
}, [items, isGrouped]);
|
|
27040
|
+
const filteredItems = React.useMemo(() => {
|
|
27041
|
+
if (filteredItemsProp && !shouldIgnoreExternalFiltering) return filteredItemsProp;
|
|
27042
|
+
if (!items) return EMPTY_ARRAY$1;
|
|
27043
|
+
if (isGrouped) {
|
|
27044
|
+
const groupedItems = items;
|
|
27045
|
+
const resultingGroups = [];
|
|
27046
|
+
let currentCount = 0;
|
|
27047
|
+
for (const group of groupedItems) {
|
|
27048
|
+
if (limit > -1 && currentCount >= limit) break;
|
|
27049
|
+
const candidateItems = filterQuery === "" ? group.items : group.items.filter((item) => filter(item, filterQuery, itemToStringLabel));
|
|
27050
|
+
if (candidateItems.length === 0) continue;
|
|
27051
|
+
const remainingLimit = limit > -1 ? limit - currentCount : Infinity;
|
|
27052
|
+
const itemsToTake = candidateItems.slice(0, remainingLimit);
|
|
27053
|
+
if (itemsToTake.length > 0) {
|
|
27054
|
+
const newGroup = {
|
|
27055
|
+
...group,
|
|
27056
|
+
items: itemsToTake
|
|
27057
|
+
};
|
|
27058
|
+
resultingGroups.push(newGroup);
|
|
27059
|
+
currentCount += itemsToTake.length;
|
|
27060
|
+
}
|
|
27061
|
+
}
|
|
27062
|
+
return resultingGroups;
|
|
27063
|
+
}
|
|
27064
|
+
if (filterQuery === "") return limit > -1 ? flatItems.slice(0, limit) : flatItems;
|
|
27065
|
+
const limitedItems = [];
|
|
27066
|
+
for (const item of flatItems) {
|
|
27067
|
+
if (limit > -1 && limitedItems.length >= limit) break;
|
|
27068
|
+
if (filter(item, filterQuery, itemToStringLabel)) limitedItems.push(item);
|
|
27069
|
+
}
|
|
27070
|
+
return limitedItems;
|
|
27071
|
+
}, [
|
|
27072
|
+
filteredItemsProp,
|
|
27073
|
+
shouldIgnoreExternalFiltering,
|
|
27074
|
+
items,
|
|
27075
|
+
isGrouped,
|
|
27076
|
+
filterQuery,
|
|
27077
|
+
limit,
|
|
27078
|
+
filter,
|
|
27079
|
+
itemToStringLabel,
|
|
27080
|
+
flatItems
|
|
27081
|
+
]);
|
|
27082
|
+
const flatFilteredItems = React.useMemo(() => {
|
|
27083
|
+
if (isGrouped) return filteredItems.flatMap((g) => g.items);
|
|
27084
|
+
return filteredItems;
|
|
27085
|
+
}, [filteredItems, isGrouped]);
|
|
27086
|
+
const store = useRefWithInit(() => new Store({
|
|
27087
|
+
id,
|
|
27088
|
+
labelId: void 0,
|
|
27089
|
+
selectedValue,
|
|
27090
|
+
open,
|
|
27091
|
+
filter,
|
|
27092
|
+
query,
|
|
27093
|
+
items,
|
|
27094
|
+
selectionMode,
|
|
27095
|
+
listRef,
|
|
27096
|
+
labelsRef,
|
|
27097
|
+
popupRef,
|
|
27098
|
+
emptyRef,
|
|
27099
|
+
inputRef,
|
|
27100
|
+
startDismissRef,
|
|
27101
|
+
endDismissRef,
|
|
27102
|
+
keyboardActiveRef,
|
|
27103
|
+
chipsContainerRef,
|
|
27104
|
+
clearRef,
|
|
27105
|
+
valuesRef,
|
|
27106
|
+
allValuesRef,
|
|
27107
|
+
selectionEventRef,
|
|
27108
|
+
name,
|
|
27109
|
+
form,
|
|
27110
|
+
disabled,
|
|
27111
|
+
readOnly,
|
|
27112
|
+
required,
|
|
27113
|
+
grid,
|
|
27114
|
+
isGrouped,
|
|
27115
|
+
virtualized,
|
|
27116
|
+
openOnInputClick,
|
|
27117
|
+
itemToStringLabel,
|
|
27118
|
+
isItemEqualToValue,
|
|
27119
|
+
modal,
|
|
27120
|
+
autoHighlight: autoHighlightMode,
|
|
27121
|
+
submitOnItemClick,
|
|
27122
|
+
hasInputValue,
|
|
27123
|
+
mounted: false,
|
|
27124
|
+
forceMounted: false,
|
|
27125
|
+
transitionStatus: "idle",
|
|
27126
|
+
inline: inlineProp,
|
|
27127
|
+
activeIndex: null,
|
|
27128
|
+
selectedIndex: null,
|
|
27129
|
+
popupProps: {},
|
|
27130
|
+
inputProps: {},
|
|
27131
|
+
triggerProps: {},
|
|
27132
|
+
positionerElement: null,
|
|
27133
|
+
listElement: null,
|
|
27134
|
+
triggerElement: null,
|
|
27135
|
+
inputElement: null,
|
|
27136
|
+
inputGroupElement: null,
|
|
27137
|
+
popupSide: null,
|
|
27138
|
+
openMethod: null,
|
|
27139
|
+
inputInsidePopup: true,
|
|
27140
|
+
onOpenChangeComplete: onOpenChangeCompleteProp || NOOP,
|
|
27141
|
+
setOpen: NOOP,
|
|
27142
|
+
setInputValue: NOOP,
|
|
27143
|
+
setSelectedValue: NOOP,
|
|
27144
|
+
setIndices: NOOP,
|
|
27145
|
+
onItemHighlighted: NOOP,
|
|
27146
|
+
handleSelection: NOOP,
|
|
27147
|
+
getItemProps: () => EMPTY_OBJECT,
|
|
27148
|
+
forceMount: NOOP,
|
|
27149
|
+
requestSubmit: NOOP
|
|
27150
|
+
})).current;
|
|
27151
|
+
const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue;
|
|
27152
|
+
const fieldStringValue = React.useMemo(() => {
|
|
27153
|
+
if (selectionMode === "none") return fieldRawValue;
|
|
27154
|
+
if (Array.isArray(selectedValue)) return selectedValue.map((value) => stringifyAsValue(value, itemToStringValue));
|
|
27155
|
+
return stringifyAsValue(selectedValue, itemToStringValue);
|
|
27156
|
+
}, [
|
|
27157
|
+
fieldRawValue,
|
|
27158
|
+
itemToStringValue,
|
|
27159
|
+
selectionMode,
|
|
27160
|
+
selectedValue
|
|
27161
|
+
]);
|
|
27162
|
+
const onItemHighlighted = useStableCallback(onItemHighlightedProp);
|
|
27163
|
+
const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);
|
|
27164
|
+
const activeIndex = useStore$1(store, selectors.activeIndex);
|
|
27165
|
+
const selectedIndex = useStore$1(store, selectors.selectedIndex);
|
|
27166
|
+
const positionerElement = useStore$1(store, selectors.positionerElement);
|
|
27167
|
+
const listElement = useStore$1(store, selectors.listElement);
|
|
27168
|
+
const triggerElement = useStore$1(store, selectors.triggerElement);
|
|
27169
|
+
const inputElement = useStore$1(store, selectors.inputElement);
|
|
27170
|
+
const inputGroupElement = useStore$1(store, selectors.inputGroupElement);
|
|
27171
|
+
const inline = useStore$1(store, selectors.inline);
|
|
27172
|
+
const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
|
|
27173
|
+
const triggerRef = useValueAsRef(triggerElement);
|
|
27174
|
+
const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
|
|
27175
|
+
const { openMethod, triggerProps } = useOpenInteractionType(open);
|
|
27176
|
+
const getFieldValue = useStableCallback(() => fieldStringValue);
|
|
27177
|
+
useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, {
|
|
27178
|
+
id,
|
|
27179
|
+
value: fieldRawValue,
|
|
27180
|
+
getValue: getFieldValue
|
|
27181
|
+
});
|
|
27182
|
+
const forceMount = useStableCallback(() => {
|
|
27183
|
+
if (items) labelsRef.current = flatFilteredItems.map((item) => stringifyAsLabel(item, itemToStringLabel));
|
|
27184
|
+
else store.set("forceMounted", true);
|
|
27185
|
+
});
|
|
27186
|
+
const initialSelectedValueRef = React.useRef(selectedValue);
|
|
27187
|
+
useIsoLayoutEffect(() => {
|
|
27188
|
+
if (selectedValue !== initialSelectedValueRef.current) forceMount();
|
|
27189
|
+
}, [forceMount, selectedValue]);
|
|
27190
|
+
const setIndices = useStableCallback((options) => {
|
|
27191
|
+
store.update(options);
|
|
27192
|
+
const type = options.type || "none";
|
|
27193
|
+
if (options.activeIndex === void 0) return;
|
|
27194
|
+
if (options.activeIndex === null) {
|
|
27195
|
+
if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
|
|
27196
|
+
lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
|
|
27197
|
+
onItemHighlighted(void 0, createGenericEventDetails(type, void 0, { index: -1 }));
|
|
27198
|
+
}
|
|
27199
|
+
} else {
|
|
27200
|
+
const activeValue = valuesRef.current[options.activeIndex];
|
|
27201
|
+
lastHighlightRef.current = {
|
|
27202
|
+
value: activeValue,
|
|
27203
|
+
index: options.activeIndex
|
|
27204
|
+
};
|
|
27205
|
+
onItemHighlighted(activeValue, createGenericEventDetails(type, void 0, { index: options.activeIndex }));
|
|
27206
|
+
}
|
|
27207
|
+
});
|
|
27208
|
+
const setInputValue = useStableCallback((next, eventDetails) => {
|
|
27209
|
+
hadInputClearRef.current = eventDetails.reason === inputClear;
|
|
27210
|
+
props.onInputValueChange?.(next, eventDetails);
|
|
27211
|
+
if (eventDetails.isCanceled) return;
|
|
27212
|
+
if (eventDetails.reason === "input-change") {
|
|
27213
|
+
const event = eventDetails.event;
|
|
27214
|
+
const inputType = event.inputType;
|
|
27215
|
+
if (event.type === "compositionend" || inputType != null && inputType !== "" && inputType !== "insertReplacementText") {
|
|
27216
|
+
const hasQuery = next.trim() !== "";
|
|
27217
|
+
if (hasQuery) setQueryChangedAfterOpen(true);
|
|
27218
|
+
pendingQueryHighlightRef.current = { hasQuery };
|
|
27219
|
+
if (hasQuery && autoHighlightMode && store.state.activeIndex == null) store.set("activeIndex", 0);
|
|
27220
|
+
}
|
|
27221
|
+
}
|
|
27222
|
+
setInputValueUnwrapped(next);
|
|
27223
|
+
});
|
|
27224
|
+
const setOpen = useStableCallback((nextOpen, eventDetails) => {
|
|
27225
|
+
if (open === nextOpen) return;
|
|
27226
|
+
if (eventDetails.reason === "escape-key" && hasItems && flatFilteredItems.length === 0 && !store.state.emptyRef.current) eventDetails.allowPropagation();
|
|
27227
|
+
props.onOpenChange?.(nextOpen, eventDetails);
|
|
27228
|
+
if (eventDetails.isCanceled) return;
|
|
27229
|
+
if (!nextOpen && queryChangedAfterOpen) {
|
|
27230
|
+
if (single) {
|
|
27231
|
+
if (!inline) setCloseQuery(query);
|
|
27232
|
+
if (query === "") setQueryChangedAfterOpen(false);
|
|
27233
|
+
} else if (multiple) {
|
|
27234
|
+
if (inline || inputInsidePopup) setIndices({ activeIndex: null });
|
|
27235
|
+
else setCloseQuery(query);
|
|
27236
|
+
setInputValue("", createChangeEventDetails(inputClear, eventDetails.event));
|
|
27237
|
+
}
|
|
27238
|
+
}
|
|
27239
|
+
setOpenUnwrapped(nextOpen);
|
|
27240
|
+
if (!nextOpen && inputInsidePopup && (eventDetails.reason === "focus-out" || eventDetails.reason === "outside-press")) {
|
|
27241
|
+
setTouched(true);
|
|
27242
|
+
setFocused(false);
|
|
27243
|
+
if (validationMode === "onBlur") {
|
|
27244
|
+
const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
|
|
27245
|
+
validation.commit(valueToValidate);
|
|
27246
|
+
}
|
|
27247
|
+
}
|
|
27248
|
+
});
|
|
27249
|
+
const setSelectedValue = useStableCallback((nextValue, eventDetails) => {
|
|
27250
|
+
onSelectedValueChange?.(nextValue, eventDetails);
|
|
27251
|
+
if (eventDetails.isCanceled) return;
|
|
27252
|
+
setSelectedValueUnwrapped(nextValue);
|
|
27253
|
+
if (selectionMode === "none" && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup) setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), createChangeEventDetails(eventDetails.reason, eventDetails.event));
|
|
27254
|
+
if (single && nextValue != null && eventDetails.reason !== "input-change" && queryChangedAfterOpen && !inline) setCloseQuery(query);
|
|
27255
|
+
});
|
|
27256
|
+
const handleSelection = useStableCallback((event, passedValue) => {
|
|
27257
|
+
let itemValue = passedValue;
|
|
27258
|
+
if (itemValue === void 0) {
|
|
27259
|
+
if (activeIndex === null) return;
|
|
27260
|
+
itemValue = valuesRef.current[activeIndex];
|
|
27261
|
+
}
|
|
27262
|
+
const targetEl = getTarget(event);
|
|
27263
|
+
const overrideEvent = selectionEventRef.current ?? event;
|
|
27264
|
+
selectionEventRef.current = null;
|
|
27265
|
+
const eventDetails = createChangeEventDetails(itemPress, overrideEvent);
|
|
27266
|
+
const href = targetEl?.closest("a")?.getAttribute("href");
|
|
27267
|
+
if (href) {
|
|
27268
|
+
if (href.startsWith("#")) setOpen(false, eventDetails);
|
|
27269
|
+
return;
|
|
27270
|
+
}
|
|
27271
|
+
if (multiple) {
|
|
27272
|
+
const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];
|
|
27273
|
+
const nextValue = selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue) ? removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [...currentSelectedValue, itemValue];
|
|
27274
|
+
setSelectedValue(nextValue, eventDetails);
|
|
27275
|
+
if (!(inputRef.current ? inputRef.current.value.trim() !== "" : false)) return;
|
|
27276
|
+
if (store.state.inputInsidePopup) setInputValue("", createChangeEventDetails(inputClear, eventDetails.event));
|
|
27277
|
+
else setOpen(false, eventDetails);
|
|
27278
|
+
} else {
|
|
27279
|
+
setSelectedValue(itemValue, eventDetails);
|
|
27280
|
+
setOpen(false, eventDetails);
|
|
27281
|
+
}
|
|
27282
|
+
});
|
|
27283
|
+
const requestSubmit = useStableCallback(() => {
|
|
27284
|
+
if (!store.state.submitOnItemClick) return;
|
|
27285
|
+
const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;
|
|
27286
|
+
if (formElement && typeof formElement.requestSubmit === "function") formElement.requestSubmit();
|
|
27287
|
+
});
|
|
27288
|
+
const handleUnmount = useStableCallback(() => {
|
|
27289
|
+
setMounted(false);
|
|
27290
|
+
onOpenChangeComplete?.(false);
|
|
27291
|
+
setQueryChangedAfterOpen(false);
|
|
27292
|
+
setCloseQuery(null);
|
|
27293
|
+
if (selectionMode === "none") setIndices({
|
|
27294
|
+
activeIndex: null,
|
|
27295
|
+
selectedIndex: null
|
|
27296
|
+
});
|
|
27297
|
+
else setIndices({ activeIndex: null });
|
|
27298
|
+
if (multiple && inputRef.current && inputRef.current.value !== "" && !hadInputClearRef.current) setInputValue("", createChangeEventDetails(inputClear));
|
|
27299
|
+
if (single) {
|
|
27300
|
+
if (store.state.inputInsidePopup) {
|
|
27301
|
+
if (inputRef.current && inputRef.current.value !== "") setInputValue("", createChangeEventDetails(inputClear));
|
|
27302
|
+
} else {
|
|
27303
|
+
const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel);
|
|
27304
|
+
if (inputRef.current && inputRef.current.value !== stringVal) setInputValue(stringVal, createChangeEventDetails(stringVal === "" ? inputClear : none$1));
|
|
27305
|
+
}
|
|
27306
|
+
}
|
|
27307
|
+
});
|
|
27308
|
+
const resolvedPopupRef = React.useMemo(() => {
|
|
27309
|
+
if (inline && positionerElement) return { current: positionerElement.closest("[role=\"dialog\"]") };
|
|
27310
|
+
return popupRef;
|
|
27311
|
+
}, [inline, positionerElement]);
|
|
27312
|
+
useOpenChangeComplete({
|
|
27313
|
+
enabled: !props.actionsRef,
|
|
27314
|
+
open,
|
|
27315
|
+
ref: resolvedPopupRef,
|
|
27316
|
+
onComplete() {
|
|
27317
|
+
if (!open) handleUnmount();
|
|
27318
|
+
}
|
|
27319
|
+
});
|
|
27320
|
+
React.useImperativeHandle(props.actionsRef, () => ({ unmount: handleUnmount }), [handleUnmount]);
|
|
27321
|
+
useIsoLayoutEffect(function syncSelectedIndex() {
|
|
27322
|
+
if (open || selectionMode === "none") return;
|
|
27323
|
+
const registry = items ? flatItems : allValuesRef.current;
|
|
27324
|
+
if (multiple) {
|
|
27325
|
+
const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
|
|
27326
|
+
const lastValue = currentValue[currentValue.length - 1];
|
|
27327
|
+
const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
|
|
27328
|
+
setIndices({ selectedIndex: lastIndex === -1 ? null : lastIndex });
|
|
27329
|
+
} else {
|
|
27330
|
+
const index = findItemIndex(registry, selectedValue, isItemEqualToValue);
|
|
27331
|
+
setIndices({ selectedIndex: index === -1 ? null : index });
|
|
27332
|
+
}
|
|
27333
|
+
}, [
|
|
27334
|
+
open,
|
|
27335
|
+
selectedValue,
|
|
27336
|
+
items,
|
|
27337
|
+
selectionMode,
|
|
27338
|
+
flatItems,
|
|
27339
|
+
multiple,
|
|
27340
|
+
isItemEqualToValue,
|
|
27341
|
+
setIndices
|
|
27342
|
+
]);
|
|
27343
|
+
useIsoLayoutEffect(() => {
|
|
27344
|
+
if (items) {
|
|
27345
|
+
valuesRef.current = flatFilteredItems;
|
|
27346
|
+
listRef.current.length = flatFilteredItems.length;
|
|
27347
|
+
}
|
|
27348
|
+
}, [items, flatFilteredItems]);
|
|
27349
|
+
useIsoLayoutEffect(() => {
|
|
27350
|
+
const pendingHighlight = pendingQueryHighlightRef.current;
|
|
27351
|
+
if (pendingHighlight) {
|
|
27352
|
+
if (pendingHighlight.hasQuery) {
|
|
27353
|
+
if (autoHighlightMode) store.set("activeIndex", 0);
|
|
27354
|
+
} else if (autoHighlightMode === "always") store.set("activeIndex", 0);
|
|
27355
|
+
pendingQueryHighlightRef.current = null;
|
|
27356
|
+
}
|
|
27357
|
+
if (!open && !inline) return;
|
|
27358
|
+
const candidateItems = hasItems || hasFilteredItemsProp ? flatFilteredItems : valuesRef.current;
|
|
27359
|
+
const storeActiveIndex = store.state.activeIndex;
|
|
27360
|
+
if (storeActiveIndex == null) {
|
|
27361
|
+
if (autoHighlightMode === "always" && candidateItems.length > 0) {
|
|
27362
|
+
store.set("activeIndex", 0);
|
|
27363
|
+
return;
|
|
27364
|
+
}
|
|
27365
|
+
if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
|
|
27366
|
+
lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
|
|
27367
|
+
store.state.onItemHighlighted(void 0, createGenericEventDetails(none$1, void 0, { index: -1 }));
|
|
27368
|
+
}
|
|
27369
|
+
return;
|
|
27370
|
+
}
|
|
27371
|
+
if (storeActiveIndex >= candidateItems.length) {
|
|
27372
|
+
if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
|
|
27373
|
+
lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
|
|
27374
|
+
store.state.onItemHighlighted(void 0, createGenericEventDetails(none$1, void 0, { index: -1 }));
|
|
27375
|
+
}
|
|
27376
|
+
store.set("activeIndex", null);
|
|
27377
|
+
return;
|
|
27378
|
+
}
|
|
27379
|
+
const itemValue = candidateItems[storeActiveIndex];
|
|
27380
|
+
const previouslyHighlightedItemValue = lastHighlightRef.current.value;
|
|
27381
|
+
const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
|
|
27382
|
+
if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {
|
|
27383
|
+
lastHighlightRef.current = {
|
|
27384
|
+
value: itemValue,
|
|
27385
|
+
index: storeActiveIndex
|
|
27386
|
+
};
|
|
27387
|
+
store.state.onItemHighlighted(itemValue, createGenericEventDetails(none$1, void 0, { index: storeActiveIndex }));
|
|
27388
|
+
}
|
|
27389
|
+
}, [
|
|
27390
|
+
activeIndex,
|
|
27391
|
+
autoHighlightMode,
|
|
27392
|
+
hasFilteredItemsProp,
|
|
27393
|
+
hasItems,
|
|
27394
|
+
flatFilteredItems,
|
|
27395
|
+
inline,
|
|
27396
|
+
open,
|
|
27397
|
+
store
|
|
27398
|
+
]);
|
|
27399
|
+
useIsoLayoutEffect(() => {
|
|
27400
|
+
if (selectionMode === "none") {
|
|
27401
|
+
setFilled(String(inputValue) !== "");
|
|
27402
|
+
return;
|
|
27403
|
+
}
|
|
27404
|
+
setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null);
|
|
27405
|
+
}, [
|
|
27406
|
+
setFilled,
|
|
27407
|
+
selectionMode,
|
|
27408
|
+
inputValue,
|
|
27409
|
+
selectedValue,
|
|
27410
|
+
multiple
|
|
27411
|
+
]);
|
|
27412
|
+
React.useEffect(() => {
|
|
27413
|
+
if (hasItems && autoHighlightMode && flatFilteredItems.length === 0) setIndices({ activeIndex: null });
|
|
27414
|
+
}, [
|
|
27415
|
+
hasItems,
|
|
27416
|
+
autoHighlightMode,
|
|
27417
|
+
flatFilteredItems.length,
|
|
27418
|
+
setIndices
|
|
27419
|
+
]);
|
|
27420
|
+
useValueChanged(query, () => {
|
|
27421
|
+
if (!open || query === "" || query === String(initialDefaultInputValue)) return;
|
|
27422
|
+
setQueryChangedAfterOpen(true);
|
|
27423
|
+
});
|
|
27424
|
+
useValueChanged(selectedValue, () => {
|
|
27425
|
+
if (selectionMode === "none") return;
|
|
27426
|
+
clearErrors(name);
|
|
27427
|
+
setDirty(selectedValue !== validityData.initialValue);
|
|
27428
|
+
if (shouldValidateOnChange()) validation.commit(selectedValue);
|
|
27429
|
+
else validation.commit(selectedValue, true);
|
|
27430
|
+
if (single && !hasInputValue && !inputInsidePopup) {
|
|
27431
|
+
const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
|
|
27432
|
+
if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails(none$1));
|
|
27433
|
+
}
|
|
27434
|
+
});
|
|
27435
|
+
useValueChanged(inputValue, () => {
|
|
27436
|
+
if (selectionMode !== "none") return;
|
|
27437
|
+
clearErrors(name);
|
|
27438
|
+
setDirty(inputValue !== validityData.initialValue);
|
|
27439
|
+
if (shouldValidateOnChange()) validation.commit(inputValue);
|
|
27440
|
+
else validation.commit(inputValue, true);
|
|
27441
|
+
});
|
|
27442
|
+
useValueChanged(items, () => {
|
|
27443
|
+
if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) return;
|
|
27444
|
+
const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
|
|
27445
|
+
if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails(none$1));
|
|
27446
|
+
});
|
|
27447
|
+
const floatingRootContext = useFloatingRootContext({
|
|
27448
|
+
open: inline ? true : open,
|
|
27449
|
+
onOpenChange: setOpen,
|
|
27450
|
+
elements: {
|
|
27451
|
+
reference: inputInsidePopup ? triggerElement : inputElement,
|
|
27452
|
+
floating: positionerElement
|
|
27453
|
+
}
|
|
27454
|
+
});
|
|
27455
|
+
let ariaHasPopup;
|
|
27456
|
+
let ariaExpanded;
|
|
27457
|
+
if (!inline) {
|
|
27458
|
+
ariaHasPopup = grid ? "grid" : "listbox";
|
|
27459
|
+
ariaExpanded = open ? "true" : "false";
|
|
27460
|
+
}
|
|
27461
|
+
const role = React.useMemo(() => {
|
|
27462
|
+
const isPlainInput = inputElement?.tagName === "INPUT";
|
|
27463
|
+
const shouldTreatAsInput = inputElement == null || isPlainInput;
|
|
27464
|
+
const shouldApplyAria = shouldTreatAsInput || open;
|
|
27465
|
+
const reference = shouldTreatAsInput ? {
|
|
27466
|
+
autoComplete: "off",
|
|
27467
|
+
spellCheck: "false",
|
|
27468
|
+
autoCorrect: "off",
|
|
27469
|
+
autoCapitalize: "none"
|
|
27470
|
+
} : {};
|
|
27471
|
+
if (shouldApplyAria) {
|
|
27472
|
+
reference.role = "combobox";
|
|
27473
|
+
reference["aria-expanded"] = ariaExpanded;
|
|
27474
|
+
reference["aria-haspopup"] = ariaHasPopup;
|
|
27475
|
+
reference["aria-controls"] = open ? listElement?.id : void 0;
|
|
27476
|
+
reference["aria-autocomplete"] = autoComplete;
|
|
27477
|
+
}
|
|
27478
|
+
return {
|
|
27479
|
+
reference,
|
|
27480
|
+
floating: { role: "presentation" }
|
|
27481
|
+
};
|
|
27482
|
+
}, [
|
|
27483
|
+
inputElement,
|
|
27484
|
+
open,
|
|
27485
|
+
ariaExpanded,
|
|
27486
|
+
ariaHasPopup,
|
|
27487
|
+
listElement?.id,
|
|
27488
|
+
autoComplete
|
|
27489
|
+
]);
|
|
27490
|
+
const click = useClick(floatingRootContext, {
|
|
27491
|
+
enabled: !readOnly && !disabled && openOnInputClick,
|
|
27492
|
+
event: "mousedown-only",
|
|
27493
|
+
toggle: false,
|
|
27494
|
+
touchOpenDelay: inputInsidePopup ? 0 : 100,
|
|
27495
|
+
reason: inputPress
|
|
27496
|
+
});
|
|
27497
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
27498
|
+
enabled: !readOnly && !disabled && !inline,
|
|
27499
|
+
outsidePressEvent: {
|
|
27500
|
+
mouse: "sloppy",
|
|
27501
|
+
touch: "intentional"
|
|
27502
|
+
},
|
|
27503
|
+
bubbles: inline ? true : void 0,
|
|
27504
|
+
outsidePress(event) {
|
|
27505
|
+
const target = getTarget(event);
|
|
27506
|
+
return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target);
|
|
27507
|
+
}
|
|
27508
|
+
});
|
|
27509
|
+
const listNavigation = useListNavigation(floatingRootContext, {
|
|
27510
|
+
enabled: !readOnly && !disabled,
|
|
27511
|
+
id,
|
|
27512
|
+
listRef,
|
|
27513
|
+
activeIndex,
|
|
27514
|
+
selectedIndex,
|
|
27515
|
+
virtual: true,
|
|
27516
|
+
loopFocus,
|
|
27517
|
+
allowEscape: loopFocus && !autoHighlightMode,
|
|
27518
|
+
focusItemOnOpen: queryChangedAfterOpen || selectionMode === "none" && !autoHighlightMode ? false : "auto",
|
|
27519
|
+
focusItemOnHover: highlightItemOnHover,
|
|
27520
|
+
resetOnPointerLeave: !keepHighlight,
|
|
27521
|
+
cols: grid ? 2 : 1,
|
|
27522
|
+
orientation: grid ? "horizontal" : void 0,
|
|
27523
|
+
disabledIndices: EMPTY_ARRAY$1,
|
|
27524
|
+
onNavigate(nextActiveIndex, event) {
|
|
27525
|
+
if (!event && !open || transitionStatus === "ending") return;
|
|
27526
|
+
if (!event) setIndices({ activeIndex: nextActiveIndex });
|
|
27527
|
+
else setIndices({
|
|
27528
|
+
activeIndex: nextActiveIndex,
|
|
27529
|
+
type: keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
27530
|
+
});
|
|
27531
|
+
}
|
|
27532
|
+
});
|
|
27533
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
|
|
27534
|
+
role,
|
|
27535
|
+
click,
|
|
27536
|
+
dismiss,
|
|
27537
|
+
listNavigation
|
|
27538
|
+
]);
|
|
27539
|
+
useOnFirstRender(() => {
|
|
27540
|
+
store.update({
|
|
27541
|
+
inline: inlineProp,
|
|
27542
|
+
popupProps: getFloatingProps(),
|
|
27543
|
+
inputProps: getReferenceProps(),
|
|
27544
|
+
triggerProps,
|
|
27545
|
+
getItemProps,
|
|
27546
|
+
setOpen,
|
|
27547
|
+
setInputValue,
|
|
27548
|
+
setSelectedValue,
|
|
27549
|
+
setIndices,
|
|
27550
|
+
onItemHighlighted,
|
|
27551
|
+
handleSelection,
|
|
27552
|
+
forceMount,
|
|
27553
|
+
requestSubmit
|
|
27554
|
+
});
|
|
27555
|
+
});
|
|
27556
|
+
useIsoLayoutEffect(() => {
|
|
27557
|
+
store.update({
|
|
27558
|
+
id,
|
|
27559
|
+
selectedValue,
|
|
27560
|
+
open,
|
|
27561
|
+
mounted,
|
|
27562
|
+
transitionStatus,
|
|
27563
|
+
items,
|
|
27564
|
+
inline: inlineProp,
|
|
27565
|
+
popupProps: getFloatingProps(),
|
|
27566
|
+
inputProps: getReferenceProps(),
|
|
27567
|
+
triggerProps,
|
|
27568
|
+
openMethod,
|
|
27569
|
+
getItemProps,
|
|
27570
|
+
selectionMode,
|
|
27571
|
+
name,
|
|
27572
|
+
form,
|
|
27573
|
+
disabled,
|
|
27574
|
+
readOnly,
|
|
27575
|
+
required,
|
|
27576
|
+
grid,
|
|
27577
|
+
isGrouped,
|
|
27578
|
+
virtualized,
|
|
27579
|
+
onOpenChangeComplete,
|
|
27580
|
+
openOnInputClick,
|
|
27581
|
+
itemToStringLabel,
|
|
27582
|
+
modal,
|
|
27583
|
+
autoHighlight: autoHighlightMode,
|
|
27584
|
+
isItemEqualToValue,
|
|
27585
|
+
submitOnItemClick,
|
|
27586
|
+
hasInputValue,
|
|
27587
|
+
requestSubmit
|
|
27588
|
+
});
|
|
27589
|
+
}, [
|
|
27590
|
+
store,
|
|
27591
|
+
id,
|
|
27592
|
+
selectedValue,
|
|
27593
|
+
open,
|
|
27594
|
+
mounted,
|
|
27595
|
+
transitionStatus,
|
|
27596
|
+
items,
|
|
27597
|
+
getFloatingProps,
|
|
27598
|
+
getReferenceProps,
|
|
27599
|
+
getItemProps,
|
|
27600
|
+
openMethod,
|
|
27601
|
+
triggerProps,
|
|
27602
|
+
selectionMode,
|
|
27603
|
+
name,
|
|
27604
|
+
disabled,
|
|
27605
|
+
readOnly,
|
|
27606
|
+
required,
|
|
27607
|
+
validation,
|
|
27608
|
+
grid,
|
|
27609
|
+
isGrouped,
|
|
27610
|
+
virtualized,
|
|
27611
|
+
onOpenChangeComplete,
|
|
27612
|
+
openOnInputClick,
|
|
27613
|
+
itemToStringLabel,
|
|
27614
|
+
modal,
|
|
27615
|
+
isItemEqualToValue,
|
|
27616
|
+
submitOnItemClick,
|
|
27617
|
+
hasInputValue,
|
|
27618
|
+
inlineProp,
|
|
27619
|
+
requestSubmit,
|
|
27620
|
+
autoHighlightMode,
|
|
27621
|
+
form
|
|
27622
|
+
]);
|
|
27623
|
+
const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
|
|
27624
|
+
const itemsContextValue = React.useMemo(() => ({
|
|
27625
|
+
query,
|
|
27626
|
+
hasItems,
|
|
27627
|
+
filteredItems,
|
|
27628
|
+
flatFilteredItems
|
|
27629
|
+
}), [
|
|
27630
|
+
query,
|
|
27631
|
+
hasItems,
|
|
27632
|
+
filteredItems,
|
|
27633
|
+
flatFilteredItems
|
|
27634
|
+
]);
|
|
27635
|
+
const serializedValue = React.useMemo(() => {
|
|
27636
|
+
if (Array.isArray(fieldRawValue)) return "";
|
|
27637
|
+
return stringifyAsValue(fieldRawValue, itemToStringValue);
|
|
27638
|
+
}, [fieldRawValue, itemToStringValue]);
|
|
27639
|
+
const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;
|
|
27640
|
+
const hiddenInputName = multiple || selectionMode === "none" ? void 0 : name;
|
|
27641
|
+
const hiddenInputs = React.useMemo(() => {
|
|
27642
|
+
if (!multiple || !Array.isArray(selectedValue) || !name) return null;
|
|
27643
|
+
return selectedValue.map((value) => {
|
|
27644
|
+
const currentSerializedValue = stringifyAsValue(value, itemToStringValue);
|
|
27645
|
+
return /*#__PURE__*/ jsx("input", {
|
|
27646
|
+
type: "hidden",
|
|
27647
|
+
form,
|
|
27648
|
+
name,
|
|
27649
|
+
value: currentSerializedValue
|
|
27650
|
+
}, currentSerializedValue);
|
|
27651
|
+
});
|
|
27652
|
+
}, [
|
|
27653
|
+
multiple,
|
|
27654
|
+
selectedValue,
|
|
27655
|
+
form,
|
|
27656
|
+
name,
|
|
27657
|
+
itemToStringValue
|
|
27658
|
+
]);
|
|
27659
|
+
const children = /*#__PURE__*/ jsxs(React.Fragment, { children: [
|
|
27660
|
+
props.children,
|
|
27661
|
+
/*#__PURE__*/ jsx("input", {
|
|
27662
|
+
...validation.getInputValidationProps({
|
|
27663
|
+
onFocus() {
|
|
27664
|
+
if (inputInsidePopup) {
|
|
27665
|
+
triggerElement?.focus();
|
|
27666
|
+
return;
|
|
27667
|
+
}
|
|
27668
|
+
(inputRef.current || triggerElement)?.focus();
|
|
27669
|
+
},
|
|
27670
|
+
onChange(event) {
|
|
27671
|
+
if (event.nativeEvent.defaultPrevented) return;
|
|
27672
|
+
const nextValue = event.currentTarget.value;
|
|
27673
|
+
const details = createChangeEventDetails(none$1, event.nativeEvent);
|
|
27674
|
+
function handleChange() {
|
|
27675
|
+
if (multiple) return;
|
|
27676
|
+
if (selectionMode === "none") {
|
|
27677
|
+
setDirty(nextValue !== validityData.initialValue);
|
|
27678
|
+
setInputValue(nextValue, details);
|
|
27679
|
+
if (shouldValidateOnChange()) validation.commit(nextValue);
|
|
27680
|
+
return;
|
|
27681
|
+
}
|
|
27682
|
+
const matchingValue = valuesRef.current.find((v) => {
|
|
27683
|
+
if (stringifyAsValue(v, itemToStringValue).toLowerCase() === nextValue.toLowerCase()) return true;
|
|
27684
|
+
if (stringifyAsLabel(v, itemToStringLabel).toLowerCase() === nextValue.toLowerCase()) return true;
|
|
27685
|
+
return false;
|
|
27686
|
+
});
|
|
27687
|
+
if (matchingValue != null) {
|
|
27688
|
+
setDirty(matchingValue !== validityData.initialValue);
|
|
27689
|
+
setSelectedValue?.(matchingValue, details);
|
|
27690
|
+
if (shouldValidateOnChange()) validation.commit(matchingValue);
|
|
27691
|
+
}
|
|
27692
|
+
}
|
|
27693
|
+
if (items) handleChange();
|
|
27694
|
+
else {
|
|
27695
|
+
forceMount();
|
|
27696
|
+
queueMicrotask(handleChange);
|
|
27697
|
+
}
|
|
27698
|
+
}
|
|
27699
|
+
}),
|
|
27700
|
+
id: id && hiddenInputName == null ? `${id}-hidden-input` : void 0,
|
|
27701
|
+
form,
|
|
27702
|
+
name: hiddenInputName,
|
|
27703
|
+
autoComplete: formAutoComplete,
|
|
27704
|
+
disabled,
|
|
27705
|
+
required: required && !hasMultipleSelection,
|
|
27706
|
+
readOnly,
|
|
27707
|
+
value: serializedValue,
|
|
27708
|
+
ref: hiddenInputRef,
|
|
27709
|
+
style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,
|
|
27710
|
+
tabIndex: -1,
|
|
27711
|
+
"aria-hidden": true,
|
|
27712
|
+
suppressHydrationWarning: true
|
|
27713
|
+
}),
|
|
27714
|
+
hiddenInputs
|
|
27715
|
+
] });
|
|
27716
|
+
return /*#__PURE__*/ jsx(ComboboxRootContext.Provider, {
|
|
27717
|
+
value: store,
|
|
27718
|
+
children: /*#__PURE__*/ jsx(ComboboxFloatingContext.Provider, {
|
|
27719
|
+
value: floatingRootContext,
|
|
27720
|
+
children: /*#__PURE__*/ jsx(ComboboxDerivedItemsContext.Provider, {
|
|
27721
|
+
value: itemsContextValue,
|
|
27722
|
+
children: /*#__PURE__*/ jsx(ComboboxInputValueContext.Provider, {
|
|
27723
|
+
value: inputValue,
|
|
27724
|
+
children
|
|
27725
|
+
})
|
|
27726
|
+
})
|
|
27727
|
+
})
|
|
27728
|
+
});
|
|
27729
|
+
}
|
|
27730
|
+
//#endregion
|
|
27731
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/ComboboxRoot.js
|
|
27732
|
+
/**
|
|
27733
|
+
* Groups all parts of the combobox.
|
|
27734
|
+
* Doesn't render its own HTML element.
|
|
27735
|
+
*
|
|
27736
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
27737
|
+
*/
|
|
27738
|
+
function ComboboxRoot(props) {
|
|
27739
|
+
const { multiple = false, defaultValue, value, onValueChange, autoComplete, ...other } = props;
|
|
27740
|
+
return /*#__PURE__*/ jsx(AriaCombobox, {
|
|
27741
|
+
...other,
|
|
27742
|
+
selectionMode: multiple ? "multiple" : "single",
|
|
27743
|
+
selectedValue: value,
|
|
27744
|
+
defaultSelectedValue: defaultValue,
|
|
27745
|
+
onSelectedValueChange: onValueChange,
|
|
27746
|
+
formAutoComplete: autoComplete
|
|
27747
|
+
});
|
|
27748
|
+
}
|
|
27749
|
+
//#endregion
|
|
27750
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/stateAttributesMapping.js
|
|
27751
|
+
var triggerStateAttributesMapping = {
|
|
27752
|
+
...pressableTriggerOpenStateMapping,
|
|
27753
|
+
...fieldValidityMapping,
|
|
27754
|
+
popupSide: (side) => side ? { "data-popup-side": side } : null,
|
|
27755
|
+
listEmpty: (empty) => empty ? { "data-list-empty": "" } : null
|
|
27756
|
+
};
|
|
27757
|
+
//#endregion
|
|
27758
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/chips/ComboboxChipsContext.js
|
|
27759
|
+
var ComboboxChipsContext = /*#__PURE__*/ React.createContext(void 0);
|
|
27760
|
+
if (process.env.NODE_ENV !== "production") ComboboxChipsContext.displayName = "ComboboxChipsContext";
|
|
27761
|
+
function useComboboxChipsContext() {
|
|
27762
|
+
return React.useContext(ComboboxChipsContext);
|
|
27763
|
+
}
|
|
27764
|
+
//#endregion
|
|
27765
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositionerContext.js
|
|
27766
|
+
var ComboboxPositionerContext = /*#__PURE__*/ React.createContext(void 0);
|
|
27767
|
+
if (process.env.NODE_ENV !== "production") ComboboxPositionerContext.displayName = "ComboboxPositionerContext";
|
|
27768
|
+
function useComboboxPositionerContext(optional) {
|
|
27769
|
+
const context = React.useContext(ComboboxPositionerContext);
|
|
27770
|
+
if (context === void 0 && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component" : formatErrorMessage(21));
|
|
27771
|
+
return context;
|
|
27772
|
+
}
|
|
27773
|
+
//#endregion
|
|
27774
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/ComboboxInternalDismissButton.js
|
|
27775
|
+
/**
|
|
27776
|
+
* @internal
|
|
27777
|
+
*/
|
|
27778
|
+
var ComboboxInternalDismissButton = /*#__PURE__*/ React.forwardRef(function ComboboxInternalDismissButton(_, forwardedRef) {
|
|
27779
|
+
const store = useComboboxRootContext();
|
|
27780
|
+
const { buttonRef, getButtonProps } = useButton({ native: false });
|
|
27781
|
+
const mergedRef = useMergedRefs(forwardedRef, buttonRef);
|
|
27782
|
+
const dismissProps = getButtonProps({ onClick: useStableCallback((event) => {
|
|
27783
|
+
store.state.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent, event.currentTarget));
|
|
27784
|
+
}) });
|
|
27785
|
+
return /*#__PURE__*/ jsx("span", {
|
|
27786
|
+
ref: mergedRef,
|
|
27787
|
+
...dismissProps,
|
|
27788
|
+
"aria-label": "Dismiss",
|
|
27789
|
+
tabIndex: void 0,
|
|
27790
|
+
style: visuallyHiddenInput
|
|
27791
|
+
});
|
|
27792
|
+
});
|
|
27793
|
+
if (process.env.NODE_ENV !== "production") ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton";
|
|
27794
|
+
//#endregion
|
|
27795
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js
|
|
27796
|
+
/**
|
|
27797
|
+
* A text input to search for items in the list.
|
|
27798
|
+
* Renders an `<input>` element.
|
|
27799
|
+
*
|
|
27800
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
27801
|
+
*/
|
|
27802
|
+
var ComboboxInput = /*#__PURE__*/ React.forwardRef(function ComboboxInput(componentProps, forwardedRef) {
|
|
27803
|
+
const { render, className, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
|
|
27804
|
+
const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
|
|
27805
|
+
const { labelId: fieldLabelId } = useLabelableContext();
|
|
27806
|
+
const comboboxChipsContext = useComboboxChipsContext();
|
|
27807
|
+
const positioning = useComboboxPositionerContext(true);
|
|
27808
|
+
const hasPositionerParent = Boolean(positioning);
|
|
27809
|
+
const store = useComboboxRootContext();
|
|
27810
|
+
const { filteredItems } = useComboboxDerivedItemsContext();
|
|
27811
|
+
const inputValue = useComboboxInputValueContext();
|
|
27812
|
+
const direction = useDirection();
|
|
27813
|
+
const required = useStore$1(store, selectors.required);
|
|
27814
|
+
const comboboxDisabled = useStore$1(store, selectors.disabled);
|
|
27815
|
+
const readOnly = useStore$1(store, selectors.readOnly);
|
|
27816
|
+
const name = useStore$1(store, selectors.name);
|
|
27817
|
+
const form = useStore$1(store, selectors.form);
|
|
27818
|
+
const selectionMode = useStore$1(store, selectors.selectionMode);
|
|
27819
|
+
const autoHighlightMode = useStore$1(store, selectors.autoHighlight);
|
|
27820
|
+
const inputProps = useStore$1(store, selectors.inputProps);
|
|
27821
|
+
const triggerProps = useStore$1(store, selectors.triggerProps);
|
|
27822
|
+
const open = useStore$1(store, selectors.open);
|
|
27823
|
+
const mounted = useStore$1(store, selectors.mounted);
|
|
27824
|
+
const selectedValue = useStore$1(store, selectors.selectedValue);
|
|
27825
|
+
const popupSideValue = useStore$1(store, selectors.popupSide);
|
|
27826
|
+
const positionerElement = useStore$1(store, selectors.positionerElement);
|
|
27827
|
+
const rootId = useStore$1(store, selectors.id);
|
|
27828
|
+
const inline = useStore$1(store, selectors.inline);
|
|
27829
|
+
const modal = useStore$1(store, selectors.modal);
|
|
27830
|
+
const autoHighlightEnabled = Boolean(autoHighlightMode);
|
|
27831
|
+
const popupSide = mounted && positionerElement ? popupSideValue : null;
|
|
27832
|
+
const disabled = fieldDisabled || comboboxDisabled || disabledProp;
|
|
27833
|
+
const listEmpty = filteredItems.length === 0;
|
|
27834
|
+
const isInsidePopup = hasPositionerParent || inline;
|
|
27835
|
+
const focusManagerModal = !isInsidePopup || modal;
|
|
27836
|
+
const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : void 0));
|
|
27837
|
+
const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, void 0);
|
|
27838
|
+
const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
|
|
27839
|
+
const [composingValue, setComposingValue] = React.useState(null);
|
|
27840
|
+
const isComposingRef = React.useRef(false);
|
|
27841
|
+
const lastActiveIndexRef = React.useRef(null);
|
|
27842
|
+
const shouldRestoreActiveIndexRef = React.useRef(false);
|
|
27843
|
+
const setInputElement = useStableCallback((element) => {
|
|
27844
|
+
const nextIsInsidePopup = hasPositionerParent || store.state.inline;
|
|
27845
|
+
if (nextIsInsidePopup && !store.state.hasInputValue) store.state.setInputValue("", createChangeEventDetails(none$1));
|
|
27846
|
+
store.update({
|
|
27847
|
+
inputElement: element,
|
|
27848
|
+
inputInsidePopup: nextIsInsidePopup
|
|
27849
|
+
});
|
|
27850
|
+
});
|
|
27851
|
+
const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps);
|
|
27852
|
+
const state = {
|
|
27853
|
+
...fieldStateForInput,
|
|
27854
|
+
open,
|
|
27855
|
+
disabled,
|
|
27856
|
+
readOnly,
|
|
27857
|
+
popupSide,
|
|
27858
|
+
listEmpty
|
|
27859
|
+
};
|
|
27860
|
+
function handleKeyDown(event) {
|
|
27861
|
+
if (!comboboxChipsContext) return;
|
|
27862
|
+
let nextIndex;
|
|
27863
|
+
const { highlightedChipIndex } = comboboxChipsContext;
|
|
27864
|
+
const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
|
|
27865
|
+
if (highlightedChipIndex !== void 0) {
|
|
27866
|
+
if (event.key === "ArrowLeft") {
|
|
27867
|
+
event.preventDefault();
|
|
27868
|
+
if (highlightedChipIndex > 0) nextIndex = highlightedChipIndex - 1;
|
|
27869
|
+
else nextIndex = void 0;
|
|
27870
|
+
} else if (event.key === "ArrowRight") {
|
|
27871
|
+
event.preventDefault();
|
|
27872
|
+
if (highlightedChipIndex < renderedChipsCount - 1) nextIndex = highlightedChipIndex + 1;
|
|
27873
|
+
else nextIndex = void 0;
|
|
27874
|
+
} else if (event.key === "Backspace" || event.key === "Delete") {
|
|
27875
|
+
event.preventDefault();
|
|
27876
|
+
const computedNextIndex = highlightedChipIndex >= selectedValue.length - 1 ? selectedValue.length - 2 : highlightedChipIndex;
|
|
27877
|
+
nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0;
|
|
27878
|
+
store.state.setIndices({
|
|
27879
|
+
activeIndex: null,
|
|
27880
|
+
selectedIndex: null,
|
|
27881
|
+
type: "keyboard"
|
|
27882
|
+
});
|
|
27883
|
+
}
|
|
27884
|
+
return nextIndex;
|
|
27885
|
+
}
|
|
27886
|
+
if (event.key === "ArrowLeft" && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
|
|
27887
|
+
event.preventDefault();
|
|
27888
|
+
nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0;
|
|
27889
|
+
} else if (event.key === "Backspace" && event.currentTarget.value === "" && selectedValue.length > 0) {
|
|
27890
|
+
store.state.setIndices({
|
|
27891
|
+
activeIndex: null,
|
|
27892
|
+
selectedIndex: null,
|
|
27893
|
+
type: "keyboard"
|
|
27894
|
+
});
|
|
27895
|
+
event.preventDefault();
|
|
27896
|
+
}
|
|
27897
|
+
return nextIndex;
|
|
27898
|
+
}
|
|
27899
|
+
const element = useRenderElement("input", componentProps, {
|
|
27900
|
+
state,
|
|
27901
|
+
ref: [
|
|
27902
|
+
forwardedRef,
|
|
27903
|
+
store.state.inputRef,
|
|
27904
|
+
setInputElement
|
|
27905
|
+
],
|
|
27906
|
+
props: [
|
|
27907
|
+
inputProps,
|
|
27908
|
+
triggerProps,
|
|
27909
|
+
{
|
|
27910
|
+
type: "text",
|
|
27911
|
+
value: componentProps.value ?? composingValue ?? inputValue,
|
|
27912
|
+
"aria-readonly": readOnly || void 0,
|
|
27913
|
+
"aria-required": required || void 0,
|
|
27914
|
+
"aria-labelledby": ariaLabelledBy,
|
|
27915
|
+
disabled,
|
|
27916
|
+
readOnly,
|
|
27917
|
+
required: selectionMode === "none" ? required : void 0,
|
|
27918
|
+
form,
|
|
27919
|
+
...selectionMode === "none" && name && { name },
|
|
27920
|
+
id,
|
|
27921
|
+
onFocus() {
|
|
27922
|
+
setFocused(true);
|
|
27923
|
+
if (!inline || !shouldRestoreActiveIndexRef.current) return;
|
|
27924
|
+
shouldRestoreActiveIndexRef.current = false;
|
|
27925
|
+
const nextActiveIndex = lastActiveIndexRef.current;
|
|
27926
|
+
if (nextActiveIndex == null || !Object.hasOwn(store.state.valuesRef.current, nextActiveIndex)) return;
|
|
27927
|
+
store.state.setIndices({ activeIndex: nextActiveIndex });
|
|
27928
|
+
},
|
|
27929
|
+
onBlur() {
|
|
27930
|
+
setTouched(true);
|
|
27931
|
+
setFocused(false);
|
|
27932
|
+
const activeIndex = store.state.activeIndex;
|
|
27933
|
+
if (inline && activeIndex !== null && autoHighlightMode !== "always") {
|
|
27934
|
+
lastActiveIndexRef.current = activeIndex;
|
|
27935
|
+
shouldRestoreActiveIndexRef.current = true;
|
|
27936
|
+
store.state.setIndices({ activeIndex: null });
|
|
27937
|
+
}
|
|
27938
|
+
if (validationMode === "onBlur") {
|
|
27939
|
+
const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
|
|
27940
|
+
validation.commit(valueToValidate);
|
|
27941
|
+
}
|
|
27942
|
+
},
|
|
27943
|
+
onCompositionStart(event) {
|
|
27944
|
+
if (isAndroid) return;
|
|
27945
|
+
isComposingRef.current = true;
|
|
27946
|
+
setComposingValue(event.currentTarget.value);
|
|
27947
|
+
},
|
|
27948
|
+
onCompositionEnd(event) {
|
|
27949
|
+
isComposingRef.current = false;
|
|
27950
|
+
const next = event.currentTarget.value;
|
|
27951
|
+
setComposingValue(null);
|
|
27952
|
+
store.state.setInputValue(next, createChangeEventDetails(inputChange, event.nativeEvent));
|
|
27953
|
+
},
|
|
27954
|
+
onChange(event) {
|
|
27955
|
+
const inputType = event.nativeEvent.inputType;
|
|
27956
|
+
const autofillLikeInput = !inputType || inputType === "insertReplacementText";
|
|
27957
|
+
const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;
|
|
27958
|
+
if (isComposingRef.current) {
|
|
27959
|
+
const nextVal = event.currentTarget.value;
|
|
27960
|
+
setComposingValue(nextVal);
|
|
27961
|
+
if (nextVal === "" && !store.state.openOnInputClick && !store.state.inputInsidePopup) store.state.setOpen(false, createChangeEventDetails(inputClear, event.nativeEvent));
|
|
27962
|
+
const trimmed = nextVal.trim();
|
|
27963
|
+
const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== "";
|
|
27964
|
+
if (!readOnly && !disabled && trimmed) {
|
|
27965
|
+
if (shouldOpenOnInput) {
|
|
27966
|
+
store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
|
|
27967
|
+
if (!autoHighlightEnabled) store.state.setIndices({
|
|
27968
|
+
activeIndex: null,
|
|
27969
|
+
selectedIndex: null,
|
|
27970
|
+
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
27971
|
+
});
|
|
27972
|
+
}
|
|
27973
|
+
}
|
|
27974
|
+
if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) store.state.setIndices({
|
|
27975
|
+
activeIndex: null,
|
|
27976
|
+
selectedIndex: null,
|
|
27977
|
+
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
27978
|
+
});
|
|
27979
|
+
return;
|
|
27980
|
+
}
|
|
27981
|
+
store.state.setInputValue(event.currentTarget.value, createChangeEventDetails(inputChange, event.nativeEvent));
|
|
27982
|
+
const empty = event.currentTarget.value === "";
|
|
27983
|
+
const clearDetails = createChangeEventDetails(inputClear, event.nativeEvent);
|
|
27984
|
+
if (empty && !store.state.inputInsidePopup) {
|
|
27985
|
+
if (selectionMode === "single") store.state.setSelectedValue(null, clearDetails);
|
|
27986
|
+
if (!store.state.openOnInputClick) store.state.setOpen(false, clearDetails);
|
|
27987
|
+
}
|
|
27988
|
+
const trimmed = event.currentTarget.value.trim();
|
|
27989
|
+
if (!readOnly && !disabled && trimmed) {
|
|
27990
|
+
if (shouldOpenOnInput) {
|
|
27991
|
+
store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
|
|
27992
|
+
if (!autoHighlightEnabled) store.state.setIndices({
|
|
27993
|
+
activeIndex: null,
|
|
27994
|
+
selectedIndex: null,
|
|
27995
|
+
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
27996
|
+
});
|
|
27997
|
+
}
|
|
27998
|
+
}
|
|
27999
|
+
if (open && store.state.activeIndex !== null && !autoHighlightEnabled) store.state.setIndices({
|
|
28000
|
+
activeIndex: null,
|
|
28001
|
+
selectedIndex: null,
|
|
28002
|
+
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
28003
|
+
});
|
|
28004
|
+
},
|
|
28005
|
+
onKeyDown(event) {
|
|
28006
|
+
if (disabled || readOnly) return;
|
|
28007
|
+
if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;
|
|
28008
|
+
store.state.keyboardActiveRef.current = true;
|
|
28009
|
+
const input = event.currentTarget;
|
|
28010
|
+
const scrollAmount = input.scrollWidth - input.clientWidth;
|
|
28011
|
+
const isRTL = direction === "rtl";
|
|
28012
|
+
if (event.key === "Home") {
|
|
28013
|
+
stopEvent$1(event);
|
|
28014
|
+
const cursor = isFirefox && isRTL ? input.value.length : 0;
|
|
28015
|
+
input.setSelectionRange(cursor, cursor);
|
|
28016
|
+
input.scrollLeft = 0;
|
|
28017
|
+
return;
|
|
28018
|
+
}
|
|
28019
|
+
if (event.key === "End") {
|
|
28020
|
+
stopEvent$1(event);
|
|
28021
|
+
const cursor = isFirefox && isRTL ? 0 : input.value.length;
|
|
28022
|
+
input.setSelectionRange(cursor, cursor);
|
|
28023
|
+
input.scrollLeft = isRTL ? -scrollAmount : scrollAmount;
|
|
28024
|
+
return;
|
|
28025
|
+
}
|
|
28026
|
+
if (!mounted && event.key === "Escape") {
|
|
28027
|
+
const isClear = selectionMode === "multiple" && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null;
|
|
28028
|
+
const details = createChangeEventDetails(escapeKey, event.nativeEvent);
|
|
28029
|
+
const value = selectionMode === "multiple" ? [] : null;
|
|
28030
|
+
store.state.setInputValue("", details);
|
|
28031
|
+
store.state.setSelectedValue(value, details);
|
|
28032
|
+
if (!isClear && !store.state.inline && !details.isPropagationAllowed) event.stopPropagation();
|
|
28033
|
+
return;
|
|
28034
|
+
}
|
|
28035
|
+
if (comboboxChipsContext && event.key === "Backspace" && input.value === "" && comboboxChipsContext.highlightedChipIndex === void 0 && Array.isArray(selectedValue) && selectedValue.length > 0) {
|
|
28036
|
+
const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
|
|
28037
|
+
const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;
|
|
28038
|
+
const newValue = selectedValue.filter((_, index) => index !== removalIndex);
|
|
28039
|
+
store.state.setIndices({
|
|
28040
|
+
activeIndex: null,
|
|
28041
|
+
selectedIndex: null,
|
|
28042
|
+
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
28043
|
+
});
|
|
28044
|
+
store.state.setSelectedValue(newValue, createChangeEventDetails(none$1, event.nativeEvent));
|
|
28045
|
+
return;
|
|
28046
|
+
}
|
|
28047
|
+
const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0;
|
|
28048
|
+
const nextIndex = handleKeyDown(event);
|
|
28049
|
+
comboboxChipsContext?.setHighlightedChipIndex(nextIndex);
|
|
28050
|
+
if (nextIndex !== void 0) comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();
|
|
28051
|
+
else if (hadHighlightedChip) store.state.inputRef.current?.focus();
|
|
28052
|
+
if (event.which === 229) return;
|
|
28053
|
+
if (event.key === "Enter" && open) {
|
|
28054
|
+
const activeIndex = store.state.activeIndex;
|
|
28055
|
+
const nativeEvent = event.nativeEvent;
|
|
28056
|
+
if (activeIndex === null) {
|
|
28057
|
+
if (inline) return;
|
|
28058
|
+
store.state.setOpen(false, createChangeEventDetails(none$1, nativeEvent));
|
|
28059
|
+
return;
|
|
28060
|
+
}
|
|
28061
|
+
stopEvent$1(event);
|
|
28062
|
+
const listItem = store.state.listRef.current[activeIndex];
|
|
28063
|
+
if (listItem) {
|
|
28064
|
+
store.state.selectionEventRef.current = nativeEvent;
|
|
28065
|
+
listItem.click();
|
|
28066
|
+
store.state.selectionEventRef.current = null;
|
|
28067
|
+
}
|
|
28068
|
+
}
|
|
28069
|
+
},
|
|
28070
|
+
onPointerMove() {
|
|
28071
|
+
store.state.keyboardActiveRef.current = false;
|
|
28072
|
+
},
|
|
28073
|
+
onPointerDown() {
|
|
28074
|
+
store.state.keyboardActiveRef.current = false;
|
|
28075
|
+
}
|
|
28076
|
+
},
|
|
28077
|
+
validationProps
|
|
28078
|
+
],
|
|
28079
|
+
stateAttributesMapping: triggerStateAttributesMapping
|
|
28080
|
+
});
|
|
28081
|
+
return /*#__PURE__*/ jsxs(React.Fragment, { children: [open && focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton, { ref: store.state.startDismissRef }), element] });
|
|
28082
|
+
});
|
|
28083
|
+
if (process.env.NODE_ENV !== "production") ComboboxInput.displayName = "ComboboxInput";
|
|
28084
|
+
//#endregion
|
|
28085
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/handleInputPress.js
|
|
28086
|
+
function handleInputPress(event, store, disabled, readOnly, shouldIgnoreTarget) {
|
|
28087
|
+
if (event.baseUIHandlerPrevented || readOnly) return;
|
|
28088
|
+
const target = getTarget(event.nativeEvent);
|
|
28089
|
+
const targetElement = isElement(target) ? target : null;
|
|
28090
|
+
if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) return;
|
|
28091
|
+
event.preventDefault();
|
|
28092
|
+
if (disabled) return;
|
|
28093
|
+
store.state.inputRef.current?.focus();
|
|
28094
|
+
if (store.state.openOnInputClick) store.state.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
|
|
28095
|
+
}
|
|
28096
|
+
//#endregion
|
|
28097
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/input-group/ComboboxInputGroup.js
|
|
28098
|
+
/**
|
|
28099
|
+
* A wrapper for the input and its associated controls.
|
|
28100
|
+
* Renders a `<div>` element.
|
|
28101
|
+
*
|
|
28102
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28103
|
+
*/
|
|
28104
|
+
var ComboboxInputGroup = /*#__PURE__*/ React.forwardRef(function ComboboxInputGroup(componentProps, forwardedRef) {
|
|
28105
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
28106
|
+
const { state: fieldState } = useFieldRootContext();
|
|
28107
|
+
const store = useComboboxRootContext();
|
|
28108
|
+
const { filteredItems } = useComboboxDerivedItemsContext();
|
|
28109
|
+
const open = useStore$1(store, selectors.open);
|
|
28110
|
+
const mounted = useStore$1(store, selectors.mounted);
|
|
28111
|
+
const popupSideValue = useStore$1(store, selectors.popupSide);
|
|
28112
|
+
const positionerElement = useStore$1(store, selectors.positionerElement);
|
|
28113
|
+
const comboboxDisabled = useStore$1(store, selectors.disabled);
|
|
28114
|
+
const readOnly = useStore$1(store, selectors.readOnly);
|
|
28115
|
+
const hasSelectedValue = useStore$1(store, selectors.hasSelectedValue);
|
|
28116
|
+
const selectionMode = useStore$1(store, selectors.selectionMode);
|
|
28117
|
+
const popupSide = mounted && positionerElement ? popupSideValue : null;
|
|
28118
|
+
const disabled = comboboxDisabled;
|
|
28119
|
+
const listEmpty = filteredItems.length === 0;
|
|
28120
|
+
const placeholder = selectionMode === "none" ? false : !hasSelectedValue;
|
|
28121
|
+
const state = {
|
|
28122
|
+
...fieldState,
|
|
28123
|
+
open,
|
|
28124
|
+
disabled,
|
|
28125
|
+
readOnly,
|
|
28126
|
+
popupSide,
|
|
28127
|
+
listEmpty,
|
|
28128
|
+
placeholder
|
|
28129
|
+
};
|
|
28130
|
+
const setInputGroupElement = useStableCallback((element) => {
|
|
28131
|
+
store.set("inputGroupElement", element);
|
|
28132
|
+
});
|
|
28133
|
+
return useRenderElement("div", componentProps, {
|
|
28134
|
+
ref: [forwardedRef, setInputGroupElement],
|
|
28135
|
+
props: [{
|
|
28136
|
+
role: "group",
|
|
28137
|
+
onMouseDown(event) {
|
|
28138
|
+
handleInputPress(event, store, disabled, readOnly, (target) => {
|
|
28139
|
+
return contains(store.state.chipsContainerRef.current, target);
|
|
28140
|
+
});
|
|
28141
|
+
}
|
|
28142
|
+
}, elementProps],
|
|
28143
|
+
state,
|
|
28144
|
+
stateAttributesMapping: triggerStateAttributesMapping
|
|
28145
|
+
});
|
|
28146
|
+
});
|
|
28147
|
+
if (process.env.NODE_ENV !== "production") ComboboxInputGroup.displayName = "ComboboxInputGroup";
|
|
28148
|
+
//#endregion
|
|
28149
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js
|
|
28150
|
+
var BOUNDARY_OFFSET = 2;
|
|
28151
|
+
/**
|
|
28152
|
+
* A button that opens the popup.
|
|
28153
|
+
* Renders a `<button>` element.
|
|
28154
|
+
*
|
|
28155
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28156
|
+
*/
|
|
28157
|
+
var ComboboxTrigger = /*#__PURE__*/ React.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {
|
|
28158
|
+
const { render, className, nativeButton = true, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
|
|
28159
|
+
const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
|
|
28160
|
+
const { labelId: fieldLabelId } = useLabelableContext();
|
|
28161
|
+
const store = useComboboxRootContext();
|
|
28162
|
+
const { filteredItems } = useComboboxDerivedItemsContext();
|
|
28163
|
+
const selectionMode = useStore$1(store, selectors.selectionMode);
|
|
28164
|
+
const comboboxDisabled = useStore$1(store, selectors.disabled);
|
|
28165
|
+
const readOnly = useStore$1(store, selectors.readOnly);
|
|
28166
|
+
const required = useStore$1(store, selectors.required);
|
|
28167
|
+
const mounted = useStore$1(store, selectors.mounted);
|
|
28168
|
+
const popupSideValue = useStore$1(store, selectors.popupSide);
|
|
28169
|
+
const positionerElement = useStore$1(store, selectors.positionerElement);
|
|
28170
|
+
const listElement = useStore$1(store, selectors.listElement);
|
|
28171
|
+
const triggerProps = useStore$1(store, selectors.triggerProps);
|
|
28172
|
+
const triggerElement = useStore$1(store, selectors.triggerElement);
|
|
28173
|
+
const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
|
|
28174
|
+
const rootId = useStore$1(store, selectors.id);
|
|
28175
|
+
const comboboxLabelId = useStore$1(store, selectors.labelId);
|
|
28176
|
+
const open = useStore$1(store, selectors.open);
|
|
28177
|
+
const selectedValue = useStore$1(store, selectors.selectedValue);
|
|
28178
|
+
const activeIndex = useStore$1(store, selectors.activeIndex);
|
|
28179
|
+
const selectedIndex = useStore$1(store, selectors.selectedIndex);
|
|
28180
|
+
const hasSelectedValue = useStore$1(store, selectors.hasSelectedValue);
|
|
28181
|
+
const floatingRootContext = useComboboxFloatingContext();
|
|
28182
|
+
const inputValue = useComboboxInputValueContext();
|
|
28183
|
+
const focusTimeout = useTimeout();
|
|
28184
|
+
const disabled = fieldDisabled || comboboxDisabled || disabledProp;
|
|
28185
|
+
const listEmpty = filteredItems.length === 0;
|
|
28186
|
+
const popupSide = mounted && positionerElement ? popupSideValue : null;
|
|
28187
|
+
useLabelableId({ id: inputInsidePopup ? idProp : void 0 });
|
|
28188
|
+
const id = inputInsidePopup ? idProp ?? rootId : idProp;
|
|
28189
|
+
const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
|
|
28190
|
+
const currentPointerTypeRef = React.useRef("");
|
|
28191
|
+
function trackPointerType(event) {
|
|
28192
|
+
currentPointerTypeRef.current = event.pointerType;
|
|
28193
|
+
}
|
|
28194
|
+
const domReference = floatingRootContext.useState("domReferenceElement");
|
|
28195
|
+
React.useEffect(() => {
|
|
28196
|
+
if (!inputInsidePopup) return;
|
|
28197
|
+
if (triggerElement && triggerElement !== domReference) floatingRootContext.set("domReferenceElement", triggerElement);
|
|
28198
|
+
}, [
|
|
28199
|
+
triggerElement,
|
|
28200
|
+
domReference,
|
|
28201
|
+
floatingRootContext,
|
|
28202
|
+
inputInsidePopup
|
|
28203
|
+
]);
|
|
28204
|
+
const { reference: triggerTypeaheadProps } = useTypeahead(floatingRootContext, {
|
|
28205
|
+
enabled: !open && !readOnly && !comboboxDisabled && selectionMode === "single",
|
|
28206
|
+
listRef: store.state.labelsRef,
|
|
28207
|
+
activeIndex,
|
|
28208
|
+
selectedIndex,
|
|
28209
|
+
onMatch(index) {
|
|
28210
|
+
const nextSelectedValue = store.state.valuesRef.current[index];
|
|
28211
|
+
if (nextSelectedValue !== void 0) store.state.setSelectedValue(nextSelectedValue, createChangeEventDetails("none"));
|
|
28212
|
+
}
|
|
28213
|
+
});
|
|
28214
|
+
const { reference: triggerClickProps } = useClick(floatingRootContext, {
|
|
28215
|
+
enabled: !readOnly && !comboboxDisabled,
|
|
28216
|
+
event: "mousedown"
|
|
28217
|
+
});
|
|
28218
|
+
const { buttonRef, getButtonProps } = useButton({
|
|
28219
|
+
native: nativeButton,
|
|
28220
|
+
disabled
|
|
28221
|
+
});
|
|
28222
|
+
const state = {
|
|
28223
|
+
...fieldState,
|
|
28224
|
+
open,
|
|
28225
|
+
disabled,
|
|
28226
|
+
popupSide,
|
|
28227
|
+
listEmpty,
|
|
28228
|
+
placeholder: selectionMode === "none" ? false : !hasSelectedValue
|
|
28229
|
+
};
|
|
28230
|
+
const setTriggerElement = useStableCallback((element) => {
|
|
28231
|
+
store.set("triggerElement", element);
|
|
28232
|
+
});
|
|
28233
|
+
return useRenderElement("button", componentProps, {
|
|
28234
|
+
ref: [
|
|
28235
|
+
forwardedRef,
|
|
28236
|
+
buttonRef,
|
|
28237
|
+
setTriggerElement
|
|
28238
|
+
],
|
|
28239
|
+
state,
|
|
28240
|
+
props: [
|
|
28241
|
+
triggerProps,
|
|
28242
|
+
triggerClickProps,
|
|
28243
|
+
triggerTypeaheadProps,
|
|
28244
|
+
{
|
|
28245
|
+
id,
|
|
28246
|
+
tabIndex: inputInsidePopup ? 0 : -1,
|
|
28247
|
+
role: inputInsidePopup ? "combobox" : void 0,
|
|
28248
|
+
"aria-expanded": open ? "true" : "false",
|
|
28249
|
+
"aria-haspopup": inputInsidePopup ? "dialog" : "listbox",
|
|
28250
|
+
"aria-controls": open ? listElement?.id : void 0,
|
|
28251
|
+
"aria-required": inputInsidePopup ? required || void 0 : void 0,
|
|
28252
|
+
"aria-labelledby": ariaLabelledBy,
|
|
28253
|
+
onPointerDown: trackPointerType,
|
|
28254
|
+
onPointerEnter: trackPointerType,
|
|
28255
|
+
onFocus() {
|
|
28256
|
+
setFocused(true);
|
|
28257
|
+
if (disabled || readOnly) return;
|
|
28258
|
+
focusTimeout.start(0, store.state.forceMount);
|
|
28259
|
+
},
|
|
28260
|
+
onBlur(event) {
|
|
28261
|
+
if (contains(positionerElement, event.relatedTarget)) return;
|
|
28262
|
+
setTouched(true);
|
|
28263
|
+
setFocused(false);
|
|
28264
|
+
if (validationMode === "onBlur") {
|
|
28265
|
+
const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
|
|
28266
|
+
validation.commit(valueToValidate);
|
|
28267
|
+
}
|
|
28268
|
+
},
|
|
28269
|
+
onMouseDown(event) {
|
|
28270
|
+
if (disabled || readOnly) return;
|
|
28271
|
+
if (!inputInsidePopup) floatingRootContext.set("domReferenceElement", event.currentTarget);
|
|
28272
|
+
store.state.forceMount();
|
|
28273
|
+
if (currentPointerTypeRef.current !== "touch") {
|
|
28274
|
+
store.state.inputRef.current?.focus();
|
|
28275
|
+
if (!inputInsidePopup) event.preventDefault();
|
|
28276
|
+
}
|
|
28277
|
+
if (open) return;
|
|
28278
|
+
const doc = ownerDocument(event.currentTarget);
|
|
28279
|
+
function handleMouseUp(mouseEvent) {
|
|
28280
|
+
if (!triggerElement) return;
|
|
28281
|
+
const mouseUpTarget = getTarget(mouseEvent);
|
|
28282
|
+
const positioner = store.state.positionerElement;
|
|
28283
|
+
const list = store.state.listElement;
|
|
28284
|
+
if (contains(triggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget) || mouseUpTarget === triggerElement) return;
|
|
28285
|
+
const bounds = getPseudoElementBounds(triggerElement);
|
|
28286
|
+
const withinHorizontal = mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET;
|
|
28287
|
+
const withinVertical = mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET;
|
|
28288
|
+
if (withinHorizontal && withinVertical) return;
|
|
28289
|
+
store.state.setOpen(false, createChangeEventDetails("cancel-open", mouseEvent));
|
|
28290
|
+
}
|
|
28291
|
+
if (inputInsidePopup) doc.addEventListener("mouseup", handleMouseUp, { once: true });
|
|
28292
|
+
},
|
|
28293
|
+
onKeyDown(event) {
|
|
28294
|
+
if (disabled || readOnly) return;
|
|
28295
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
28296
|
+
stopEvent$1(event);
|
|
28297
|
+
store.state.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent));
|
|
28298
|
+
store.state.inputRef.current?.focus();
|
|
28299
|
+
}
|
|
28300
|
+
}
|
|
28301
|
+
},
|
|
28302
|
+
validation ? validation.getValidationProps(elementProps) : elementProps,
|
|
28303
|
+
getButtonProps
|
|
28304
|
+
],
|
|
28305
|
+
stateAttributesMapping: triggerStateAttributesMapping
|
|
28306
|
+
});
|
|
28307
|
+
});
|
|
28308
|
+
if (process.env.NODE_ENV !== "production") ComboboxTrigger.displayName = "ComboboxTrigger";
|
|
28309
|
+
//#endregion
|
|
28310
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/collection/GroupCollectionContext.js
|
|
28311
|
+
var GroupCollectionContext = /*#__PURE__*/ React.createContext(null);
|
|
28312
|
+
if (process.env.NODE_ENV !== "production") GroupCollectionContext.displayName = "GroupCollectionContext";
|
|
28313
|
+
function useGroupCollectionContext() {
|
|
28314
|
+
return React.useContext(GroupCollectionContext);
|
|
28315
|
+
}
|
|
28316
|
+
//#endregion
|
|
28317
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js
|
|
28318
|
+
/**
|
|
28319
|
+
* Renders filtered list items.
|
|
28320
|
+
* Doesn't render its own HTML element.
|
|
28321
|
+
*
|
|
28322
|
+
* If rendering a flat list, pass a function child to the `List` component instead, which implicitly wraps it.
|
|
28323
|
+
*
|
|
28324
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28325
|
+
*/
|
|
28326
|
+
function ComboboxCollection(props) {
|
|
28327
|
+
const { children } = props;
|
|
28328
|
+
const { filteredItems } = useComboboxDerivedItemsContext();
|
|
28329
|
+
const groupContext = useGroupCollectionContext();
|
|
28330
|
+
const itemsToRender = groupContext ? groupContext.items : filteredItems;
|
|
28331
|
+
if (!itemsToRender) return null;
|
|
28332
|
+
return /*#__PURE__*/ jsx(React.Fragment, { children: itemsToRender.map(children) });
|
|
28333
|
+
}
|
|
28334
|
+
//#endregion
|
|
28335
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js
|
|
28336
|
+
/**
|
|
28337
|
+
* A list container for the items.
|
|
28338
|
+
* Renders a `<div>` element.
|
|
28339
|
+
*
|
|
28340
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28341
|
+
*/
|
|
28342
|
+
var ComboboxList = /*#__PURE__*/ React.forwardRef(function ComboboxList(componentProps, forwardedRef) {
|
|
28343
|
+
var _ComboboxCollection;
|
|
28344
|
+
const { render, className, style, children, ...elementProps } = componentProps;
|
|
28345
|
+
const store = useComboboxRootContext();
|
|
28346
|
+
const floatingRootContext = useComboboxFloatingContext();
|
|
28347
|
+
const hasPositionerContext = Boolean(useComboboxPositionerContext(true));
|
|
28348
|
+
const { filteredItems, hasItems } = useComboboxDerivedItemsContext();
|
|
28349
|
+
const selectionMode = useStore$1(store, selectors.selectionMode);
|
|
28350
|
+
const grid = useStore$1(store, selectors.grid);
|
|
28351
|
+
const popupProps = useStore$1(store, selectors.popupProps);
|
|
28352
|
+
const virtualized = useStore$1(store, selectors.virtualized);
|
|
28353
|
+
const multiple = selectionMode === "multiple";
|
|
28354
|
+
const empty = filteredItems.length === 0;
|
|
28355
|
+
const setPositionerElement = useStableCallback((element) => {
|
|
28356
|
+
store.set("positionerElement", element);
|
|
28357
|
+
});
|
|
28358
|
+
const setListElement = useStableCallback((element) => {
|
|
28359
|
+
store.set("listElement", element);
|
|
28360
|
+
});
|
|
28361
|
+
const resolvedChildren = React.useMemo(() => {
|
|
28362
|
+
if (typeof children === "function") return _ComboboxCollection || (_ComboboxCollection = /*#__PURE__*/ jsx(ComboboxCollection, { children }));
|
|
28363
|
+
return children;
|
|
28364
|
+
}, [children]);
|
|
28365
|
+
const state = { empty };
|
|
28366
|
+
const floatingId = floatingRootContext.useState("floatingId");
|
|
28367
|
+
const element = useRenderElement("div", componentProps, {
|
|
28368
|
+
state,
|
|
28369
|
+
ref: [
|
|
28370
|
+
forwardedRef,
|
|
28371
|
+
setListElement,
|
|
28372
|
+
hasPositionerContext ? null : setPositionerElement
|
|
28373
|
+
],
|
|
28374
|
+
props: [
|
|
28375
|
+
popupProps,
|
|
28376
|
+
{
|
|
28377
|
+
children: resolvedChildren,
|
|
28378
|
+
tabIndex: -1,
|
|
28379
|
+
id: floatingId,
|
|
28380
|
+
role: grid ? "grid" : "listbox",
|
|
28381
|
+
"aria-multiselectable": multiple ? "true" : void 0,
|
|
28382
|
+
onKeyDown(event) {
|
|
28383
|
+
if (store.state.disabled || store.state.readOnly) return;
|
|
28384
|
+
if (event.key === "Enter") {
|
|
28385
|
+
const activeIndex = store.state.activeIndex;
|
|
28386
|
+
if (activeIndex == null) return;
|
|
28387
|
+
stopEvent$1(event);
|
|
28388
|
+
const nativeEvent = event.nativeEvent;
|
|
28389
|
+
const listItem = store.state.listRef.current[activeIndex];
|
|
28390
|
+
if (listItem) {
|
|
28391
|
+
store.state.selectionEventRef.current = nativeEvent;
|
|
28392
|
+
listItem.click();
|
|
28393
|
+
store.state.selectionEventRef.current = null;
|
|
28394
|
+
}
|
|
28395
|
+
}
|
|
28396
|
+
},
|
|
28397
|
+
onKeyDownCapture() {
|
|
28398
|
+
store.state.keyboardActiveRef.current = true;
|
|
28399
|
+
},
|
|
28400
|
+
onPointerMoveCapture() {
|
|
28401
|
+
store.state.keyboardActiveRef.current = false;
|
|
28402
|
+
}
|
|
28403
|
+
},
|
|
28404
|
+
elementProps
|
|
28405
|
+
]
|
|
28406
|
+
});
|
|
28407
|
+
if (virtualized) return element;
|
|
28408
|
+
return /*#__PURE__*/ jsx(CompositeList, {
|
|
28409
|
+
elementsRef: store.state.listRef,
|
|
28410
|
+
labelsRef: hasItems ? void 0 : store.state.labelsRef,
|
|
28411
|
+
children: element
|
|
28412
|
+
});
|
|
28413
|
+
});
|
|
28414
|
+
if (process.env.NODE_ENV !== "production") ComboboxList.displayName = "ComboboxList";
|
|
28415
|
+
//#endregion
|
|
28416
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortalContext.js
|
|
28417
|
+
var ComboboxPortalContext = /*#__PURE__*/ React.createContext(void 0);
|
|
28418
|
+
if (process.env.NODE_ENV !== "production") ComboboxPortalContext.displayName = "ComboboxPortalContext";
|
|
28419
|
+
function useComboboxPortalContext() {
|
|
28420
|
+
const context = React.useContext(ComboboxPortalContext);
|
|
28421
|
+
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Combobox.Portal> is missing." : formatErrorMessage(20));
|
|
28422
|
+
return context;
|
|
28423
|
+
}
|
|
28424
|
+
//#endregion
|
|
28425
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js
|
|
28426
|
+
/**
|
|
28427
|
+
* A portal element that moves the popup to a different part of the DOM.
|
|
28428
|
+
* By default, the portal element is appended to `<body>`.
|
|
28429
|
+
* Renders a `<div>` element.
|
|
28430
|
+
*
|
|
28431
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28432
|
+
*/
|
|
28433
|
+
var ComboboxPortal = /*#__PURE__*/ React.forwardRef(function ComboboxPortal(props, forwardedRef) {
|
|
28434
|
+
const { keepMounted = false, ...portalProps } = props;
|
|
28435
|
+
const store = useComboboxRootContext();
|
|
28436
|
+
const mounted = useStore$1(store, selectors.mounted);
|
|
28437
|
+
const forceMounted = useStore$1(store, selectors.forceMounted);
|
|
28438
|
+
if (!(mounted || keepMounted || forceMounted)) return null;
|
|
28439
|
+
return /*#__PURE__*/ jsx(ComboboxPortalContext.Provider, {
|
|
28440
|
+
value: keepMounted,
|
|
28441
|
+
children: /*#__PURE__*/ jsx(FloatingPortal, {
|
|
28442
|
+
ref: forwardedRef,
|
|
28443
|
+
...portalProps
|
|
28444
|
+
})
|
|
28445
|
+
});
|
|
28446
|
+
});
|
|
28447
|
+
if (process.env.NODE_ENV !== "production") ComboboxPortal.displayName = "ComboboxPortal";
|
|
28448
|
+
//#endregion
|
|
28449
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js
|
|
28450
|
+
/**
|
|
28451
|
+
* Positions the popup against the trigger.
|
|
28452
|
+
* Renders a `<div>` element.
|
|
28453
|
+
*
|
|
28454
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28455
|
+
*/
|
|
28456
|
+
var ComboboxPositioner = /*#__PURE__*/ React.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {
|
|
28457
|
+
const { render, className, anchor, positionMethod = "absolute", side = "bottom", align = "center", sideOffset = 0, alignOffset = 0, collisionBoundary = "clipping-ancestors", collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style: styleProp, ...elementProps } = componentProps;
|
|
28458
|
+
const store = useComboboxRootContext();
|
|
28459
|
+
const { filteredItems } = useComboboxDerivedItemsContext();
|
|
28460
|
+
const floatingRootContext = useComboboxFloatingContext();
|
|
28461
|
+
const keepMounted = useComboboxPortalContext();
|
|
28462
|
+
const modal = useStore$1(store, selectors.modal);
|
|
28463
|
+
const open = useStore$1(store, selectors.open);
|
|
28464
|
+
const mounted = useStore$1(store, selectors.mounted);
|
|
28465
|
+
const openMethod = useStore$1(store, selectors.openMethod);
|
|
28466
|
+
const positionerElement = useStore$1(store, selectors.positionerElement);
|
|
28467
|
+
const triggerElement = useStore$1(store, selectors.triggerElement);
|
|
28468
|
+
const inputElement = useStore$1(store, selectors.inputElement);
|
|
28469
|
+
const inputGroupElement = useStore$1(store, selectors.inputGroupElement);
|
|
28470
|
+
const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
|
|
28471
|
+
const transitionStatus = useStore$1(store, selectors.transitionStatus);
|
|
28472
|
+
const empty = filteredItems.length === 0;
|
|
28473
|
+
const positioning = useAnchorPositioning({
|
|
28474
|
+
anchor: anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement),
|
|
28475
|
+
floatingRootContext,
|
|
28476
|
+
positionMethod,
|
|
28477
|
+
mounted,
|
|
28478
|
+
side,
|
|
28479
|
+
sideOffset,
|
|
28480
|
+
align,
|
|
28481
|
+
alignOffset,
|
|
28482
|
+
arrowPadding,
|
|
28483
|
+
collisionBoundary,
|
|
28484
|
+
collisionPadding,
|
|
28485
|
+
sticky,
|
|
28486
|
+
disableAnchorTracking,
|
|
28487
|
+
keepMounted,
|
|
28488
|
+
collisionAvoidance,
|
|
28489
|
+
lazyFlip: true
|
|
28490
|
+
});
|
|
28491
|
+
useAnchoredPopupScrollLock(open && modal, openMethod === "touch", positionerElement, triggerElement);
|
|
28492
|
+
const state = {
|
|
28493
|
+
open,
|
|
28494
|
+
side: positioning.side,
|
|
28495
|
+
align: positioning.align,
|
|
28496
|
+
anchorHidden: positioning.anchorHidden,
|
|
28497
|
+
empty
|
|
28498
|
+
};
|
|
28499
|
+
useIsoLayoutEffect(() => {
|
|
28500
|
+
store.set("popupSide", positioning.side);
|
|
28501
|
+
}, [store, positioning.side]);
|
|
28502
|
+
const setPositionerElement = useStableCallback((element) => {
|
|
28503
|
+
store.set("positionerElement", element);
|
|
28504
|
+
});
|
|
28505
|
+
const element = usePositioner(componentProps, state, {
|
|
28506
|
+
styles: positioning.positionerStyles,
|
|
28507
|
+
transitionStatus,
|
|
28508
|
+
props: elementProps,
|
|
28509
|
+
refs: [forwardedRef, setPositionerElement],
|
|
28510
|
+
hidden: !mounted,
|
|
28511
|
+
inert: !open
|
|
28512
|
+
});
|
|
28513
|
+
return /*#__PURE__*/ jsxs(ComboboxPositionerContext.Provider, {
|
|
28514
|
+
value: positioning,
|
|
28515
|
+
children: [mounted && modal && /*#__PURE__*/ jsx(InternalBackdrop, {
|
|
28516
|
+
inert: inertValue(!open),
|
|
28517
|
+
cutout: inputGroupElement ?? inputElement ?? triggerElement
|
|
28518
|
+
}), element]
|
|
28519
|
+
});
|
|
28520
|
+
});
|
|
28521
|
+
if (process.env.NODE_ENV !== "production") ComboboxPositioner.displayName = "ComboboxPositioner";
|
|
28522
|
+
//#endregion
|
|
28523
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/popup/ComboboxPopup.js
|
|
28524
|
+
var stateAttributesMapping$1 = {
|
|
28525
|
+
...popupStateMapping,
|
|
28526
|
+
...transitionStatusMapping
|
|
28527
|
+
};
|
|
28528
|
+
/**
|
|
28529
|
+
* A container for the list.
|
|
28530
|
+
* Renders a `<div>` element.
|
|
28531
|
+
*
|
|
28532
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28533
|
+
*/
|
|
28534
|
+
var ComboboxPopup = /*#__PURE__*/ React.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {
|
|
28535
|
+
const { render, className, style, initialFocus, finalFocus, ...elementProps } = componentProps;
|
|
28536
|
+
const store = useComboboxRootContext();
|
|
28537
|
+
const positioning = useComboboxPositionerContext();
|
|
28538
|
+
const floatingRootContext = useComboboxFloatingContext();
|
|
28539
|
+
const { filteredItems } = useComboboxDerivedItemsContext();
|
|
28540
|
+
const mounted = useStore$1(store, selectors.mounted);
|
|
28541
|
+
const open = useStore$1(store, selectors.open);
|
|
28542
|
+
const openMethod = useStore$1(store, selectors.openMethod);
|
|
28543
|
+
const transitionStatus = useStore$1(store, selectors.transitionStatus);
|
|
28544
|
+
const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
|
|
28545
|
+
const inputElement = useStore$1(store, selectors.inputElement);
|
|
28546
|
+
const modal = useStore$1(store, selectors.modal);
|
|
28547
|
+
const empty = filteredItems.length === 0;
|
|
28548
|
+
useOpenChangeComplete({
|
|
28549
|
+
open,
|
|
28550
|
+
ref: store.state.popupRef,
|
|
28551
|
+
onComplete() {
|
|
28552
|
+
if (open) store.state.onOpenChangeComplete(true);
|
|
28553
|
+
}
|
|
28554
|
+
});
|
|
28555
|
+
const state = {
|
|
28556
|
+
open,
|
|
28557
|
+
side: positioning.side,
|
|
28558
|
+
align: positioning.align,
|
|
28559
|
+
anchorHidden: positioning.anchorHidden,
|
|
28560
|
+
transitionStatus,
|
|
28561
|
+
empty
|
|
28562
|
+
};
|
|
28563
|
+
const element = useRenderElement("div", componentProps, {
|
|
28564
|
+
state,
|
|
28565
|
+
ref: [forwardedRef, store.state.popupRef],
|
|
28566
|
+
props: [
|
|
28567
|
+
{
|
|
28568
|
+
role: inputInsidePopup ? "dialog" : "presentation",
|
|
28569
|
+
tabIndex: -1,
|
|
28570
|
+
onFocus(event) {
|
|
28571
|
+
const target = getTarget(event.nativeEvent);
|
|
28572
|
+
if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) store.state.inputRef.current?.focus();
|
|
28573
|
+
}
|
|
28574
|
+
},
|
|
28575
|
+
getDisabledMountTransitionStyles(transitionStatus),
|
|
28576
|
+
elementProps
|
|
28577
|
+
],
|
|
28578
|
+
stateAttributesMapping: stateAttributesMapping$1
|
|
28579
|
+
});
|
|
28580
|
+
const resolvedInitialFocus = initialFocus === void 0 ? inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.state.popupRef.current : inputElement : false : initialFocus;
|
|
28581
|
+
let resolvedFinalFocus;
|
|
28582
|
+
if (finalFocus != null) resolvedFinalFocus = finalFocus;
|
|
28583
|
+
else resolvedFinalFocus = inputInsidePopup ? void 0 : false;
|
|
28584
|
+
const focusManagerModal = !inputInsidePopup || modal;
|
|
28585
|
+
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
28586
|
+
context: floatingRootContext,
|
|
28587
|
+
disabled: !mounted,
|
|
28588
|
+
modal: focusManagerModal,
|
|
28589
|
+
openInteractionType: openMethod,
|
|
28590
|
+
initialFocus: resolvedInitialFocus,
|
|
28591
|
+
returnFocus: resolvedFinalFocus,
|
|
28592
|
+
getInsideElements: () => [store.state.startDismissRef.current, store.state.endDismissRef.current],
|
|
28593
|
+
children: /*#__PURE__*/ jsxs(React.Fragment, { children: [element, focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton, { ref: store.state.endDismissRef })] })
|
|
28594
|
+
});
|
|
28595
|
+
});
|
|
28596
|
+
if (process.env.NODE_ENV !== "production") ComboboxPopup.displayName = "ComboboxPopup";
|
|
28597
|
+
//#endregion
|
|
28598
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item/ComboboxItemContext.js
|
|
28599
|
+
var ComboboxItemContext = /*#__PURE__*/ React.createContext(void 0);
|
|
28600
|
+
if (process.env.NODE_ENV !== "production") ComboboxItemContext.displayName = "ComboboxItemContext";
|
|
28601
|
+
function useComboboxItemContext() {
|
|
28602
|
+
const context = React.useContext(ComboboxItemContext);
|
|
28603
|
+
if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>." : formatErrorMessage(19));
|
|
28604
|
+
return context;
|
|
28605
|
+
}
|
|
28606
|
+
//#endregion
|
|
28607
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/row/ComboboxRowContext.js
|
|
28608
|
+
var ComboboxRowContext = /*#__PURE__*/ React.createContext(false);
|
|
28609
|
+
if (process.env.NODE_ENV !== "production") ComboboxRowContext.displayName = "ComboboxRowContext";
|
|
28610
|
+
function useComboboxRowContext() {
|
|
28611
|
+
return React.useContext(ComboboxRowContext);
|
|
28612
|
+
}
|
|
28613
|
+
//#endregion
|
|
28614
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js
|
|
28615
|
+
/**
|
|
28616
|
+
* An individual item in the list.
|
|
28617
|
+
* Renders a `<div>` element.
|
|
28618
|
+
*
|
|
28619
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28620
|
+
*/
|
|
28621
|
+
var ComboboxItem = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef(function ComboboxItem(componentProps, forwardedRef) {
|
|
28622
|
+
const { render, className, value: itemValue = null, index: indexProp, disabled = false, nativeButton = false, style, ...elementProps } = componentProps;
|
|
28623
|
+
const didPointerDownRef = React.useRef(false);
|
|
28624
|
+
const textRef = React.useRef(null);
|
|
28625
|
+
const listItem = useCompositeListItem({
|
|
28626
|
+
index: indexProp,
|
|
28627
|
+
textRef,
|
|
28628
|
+
indexGuessBehavior: IndexGuessBehavior.GuessFromOrder
|
|
28629
|
+
});
|
|
28630
|
+
const store = useComboboxRootContext();
|
|
28631
|
+
const isRow = useComboboxRowContext();
|
|
28632
|
+
const { flatFilteredItems, hasItems } = useComboboxDerivedItemsContext();
|
|
28633
|
+
const open = useStore$1(store, selectors.open);
|
|
28634
|
+
const selectionMode = useStore$1(store, selectors.selectionMode);
|
|
28635
|
+
const readOnly = useStore$1(store, selectors.readOnly);
|
|
28636
|
+
const virtualized = useStore$1(store, selectors.virtualized);
|
|
28637
|
+
const isItemEqualToValue = useStore$1(store, selectors.isItemEqualToValue);
|
|
28638
|
+
const selectable = selectionMode !== "none";
|
|
28639
|
+
const index = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
|
|
28640
|
+
const hasRegistered = listItem.index !== -1;
|
|
28641
|
+
const rootId = useStore$1(store, selectors.id);
|
|
28642
|
+
const highlighted = useStore$1(store, selectors.isActive, index);
|
|
28643
|
+
const matchesSelectedValue = useStore$1(store, selectors.isSelected, itemValue);
|
|
28644
|
+
const getItemProps = useStore$1(store, selectors.getItemProps);
|
|
28645
|
+
const itemRef = React.useRef(null);
|
|
28646
|
+
const id = rootId != null && hasRegistered ? `${rootId}-${index}` : void 0;
|
|
28647
|
+
const selected = matchesSelectedValue && selectable;
|
|
28648
|
+
useIsoLayoutEffect(() => {
|
|
28649
|
+
if (!(hasRegistered && (virtualized || indexProp != null))) return;
|
|
28650
|
+
const list = store.state.listRef.current;
|
|
28651
|
+
list[index] = itemRef.current;
|
|
28652
|
+
return () => {
|
|
28653
|
+
delete list[index];
|
|
28654
|
+
};
|
|
28655
|
+
}, [
|
|
28656
|
+
hasRegistered,
|
|
28657
|
+
virtualized,
|
|
28658
|
+
index,
|
|
28659
|
+
indexProp,
|
|
28660
|
+
store
|
|
28661
|
+
]);
|
|
28662
|
+
useIsoLayoutEffect(() => {
|
|
28663
|
+
if (!hasRegistered || hasItems) return;
|
|
28664
|
+
const visibleMap = store.state.valuesRef.current;
|
|
28665
|
+
visibleMap[index] = itemValue;
|
|
28666
|
+
if (selectionMode !== "none") store.state.allValuesRef.current.push(itemValue);
|
|
28667
|
+
return () => {
|
|
28668
|
+
delete visibleMap[index];
|
|
28669
|
+
};
|
|
28670
|
+
}, [
|
|
28671
|
+
hasRegistered,
|
|
28672
|
+
hasItems,
|
|
28673
|
+
index,
|
|
28674
|
+
itemValue,
|
|
28675
|
+
store,
|
|
28676
|
+
selectionMode
|
|
28677
|
+
]);
|
|
28678
|
+
useIsoLayoutEffect(() => {
|
|
28679
|
+
if (!open) {
|
|
28680
|
+
didPointerDownRef.current = false;
|
|
28681
|
+
return;
|
|
28682
|
+
}
|
|
28683
|
+
if (!hasRegistered || hasItems) return;
|
|
28684
|
+
const selectedValue = store.state.selectedValue;
|
|
28685
|
+
const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
|
|
28686
|
+
if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) store.set("selectedIndex", index);
|
|
28687
|
+
}, [
|
|
28688
|
+
hasRegistered,
|
|
28689
|
+
hasItems,
|
|
28690
|
+
open,
|
|
28691
|
+
store,
|
|
28692
|
+
index,
|
|
28693
|
+
itemValue,
|
|
28694
|
+
isItemEqualToValue
|
|
28695
|
+
]);
|
|
28696
|
+
const state = {
|
|
28697
|
+
disabled,
|
|
28698
|
+
selected,
|
|
28699
|
+
highlighted
|
|
28700
|
+
};
|
|
28701
|
+
const rootProps = getItemProps({
|
|
28702
|
+
active: highlighted,
|
|
28703
|
+
selected
|
|
28704
|
+
});
|
|
28705
|
+
rootProps.id = void 0;
|
|
28706
|
+
rootProps.onFocus = void 0;
|
|
28707
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
28708
|
+
disabled,
|
|
28709
|
+
focusableWhenDisabled: true,
|
|
28710
|
+
native: nativeButton,
|
|
28711
|
+
composite: true
|
|
28712
|
+
});
|
|
28713
|
+
function commitSelection(nativeEvent) {
|
|
28714
|
+
function selectItem() {
|
|
28715
|
+
store.state.handleSelection(nativeEvent, itemValue);
|
|
28716
|
+
}
|
|
28717
|
+
if (store.state.submitOnItemClick) {
|
|
28718
|
+
ReactDOM.flushSync(selectItem);
|
|
28719
|
+
store.state.requestSubmit();
|
|
28720
|
+
} else selectItem();
|
|
28721
|
+
}
|
|
28722
|
+
const defaultProps = {
|
|
28723
|
+
id,
|
|
28724
|
+
role: isRow ? "gridcell" : "option",
|
|
28725
|
+
"aria-selected": selectable ? selected : void 0,
|
|
28726
|
+
tabIndex: void 0,
|
|
28727
|
+
onPointerDownCapture(event) {
|
|
28728
|
+
didPointerDownRef.current = true;
|
|
28729
|
+
event.preventDefault();
|
|
28730
|
+
},
|
|
28731
|
+
onMouseDown(event) {
|
|
28732
|
+
event.preventDefault();
|
|
28733
|
+
},
|
|
28734
|
+
onClick(event) {
|
|
28735
|
+
if (disabled || readOnly) return;
|
|
28736
|
+
commitSelection(event.nativeEvent);
|
|
28737
|
+
},
|
|
28738
|
+
onMouseUp(event) {
|
|
28739
|
+
const pointerStartedOnItem = didPointerDownRef.current;
|
|
28740
|
+
didPointerDownRef.current = false;
|
|
28741
|
+
if (disabled || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) return;
|
|
28742
|
+
commitSelection(event.nativeEvent);
|
|
28743
|
+
}
|
|
28744
|
+
};
|
|
28745
|
+
const element = useRenderElement("div", componentProps, {
|
|
28746
|
+
ref: [
|
|
28747
|
+
buttonRef,
|
|
28748
|
+
forwardedRef,
|
|
28749
|
+
listItem.ref,
|
|
28750
|
+
itemRef
|
|
28751
|
+
],
|
|
28752
|
+
state,
|
|
28753
|
+
props: [
|
|
28754
|
+
rootProps,
|
|
28755
|
+
defaultProps,
|
|
28756
|
+
elementProps,
|
|
28757
|
+
getButtonProps
|
|
28758
|
+
]
|
|
28759
|
+
});
|
|
28760
|
+
const contextValue = React.useMemo(() => ({
|
|
28761
|
+
selected,
|
|
28762
|
+
textRef
|
|
28763
|
+
}), [selected, textRef]);
|
|
28764
|
+
return /*#__PURE__*/ jsx(ComboboxItemContext.Provider, {
|
|
28765
|
+
value: contextValue,
|
|
28766
|
+
children: element
|
|
28767
|
+
});
|
|
28768
|
+
}));
|
|
28769
|
+
if (process.env.NODE_ENV !== "production") ComboboxItem.displayName = "ComboboxItem";
|
|
28770
|
+
//#endregion
|
|
28771
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item-indicator/ComboboxItemIndicator.js
|
|
28772
|
+
/**
|
|
28773
|
+
* Indicates whether the item is selected.
|
|
28774
|
+
* Renders a `<span>` element.
|
|
28775
|
+
*
|
|
28776
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28777
|
+
*/
|
|
28778
|
+
var ComboboxItemIndicator = /*#__PURE__*/ React.forwardRef(function ComboboxItemIndicator(componentProps, forwardedRef) {
|
|
28779
|
+
const keepMounted = componentProps.keepMounted ?? false;
|
|
28780
|
+
const { selected } = useComboboxItemContext();
|
|
28781
|
+
if (!(keepMounted || selected)) return null;
|
|
28782
|
+
return /*#__PURE__*/ jsx(Inner, {
|
|
28783
|
+
...componentProps,
|
|
28784
|
+
ref: forwardedRef
|
|
28785
|
+
});
|
|
28786
|
+
});
|
|
28787
|
+
/** The core implementation of the indicator is split here to avoid paying the hooks
|
|
28788
|
+
* costs unless the element needs to be mounted. */
|
|
28789
|
+
if (process.env.NODE_ENV !== "production") ComboboxItemIndicator.displayName = "ComboboxItemIndicator";
|
|
28790
|
+
var Inner = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef((componentProps, forwardedRef) => {
|
|
28791
|
+
const { render, className, style, keepMounted, ...elementProps } = componentProps;
|
|
28792
|
+
const { selected } = useComboboxItemContext();
|
|
28793
|
+
const indicatorRef = React.useRef(null);
|
|
28794
|
+
const { transitionStatus, setMounted } = useTransitionStatus(selected);
|
|
28795
|
+
const element = useRenderElement("span", componentProps, {
|
|
28796
|
+
ref: [forwardedRef, indicatorRef],
|
|
28797
|
+
state: {
|
|
28798
|
+
selected,
|
|
28799
|
+
transitionStatus
|
|
28800
|
+
},
|
|
28801
|
+
props: [{
|
|
28802
|
+
"aria-hidden": true,
|
|
28803
|
+
children: "✔️"
|
|
28804
|
+
}, elementProps],
|
|
28805
|
+
stateAttributesMapping: transitionStatusMapping
|
|
28806
|
+
});
|
|
28807
|
+
useOpenChangeComplete({
|
|
28808
|
+
open: selected,
|
|
28809
|
+
ref: indicatorRef,
|
|
28810
|
+
onComplete() {
|
|
28811
|
+
if (!selected) setMounted(false);
|
|
28812
|
+
}
|
|
28813
|
+
});
|
|
28814
|
+
return element;
|
|
28815
|
+
}));
|
|
28816
|
+
if (process.env.NODE_ENV !== "production") Inner.displayName = "Inner";
|
|
28817
|
+
//#endregion
|
|
28818
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/clear/ComboboxClear.js
|
|
28819
|
+
var stateAttributesMapping = {
|
|
28820
|
+
...transitionStatusMapping,
|
|
28821
|
+
...triggerOpenStateMapping
|
|
28822
|
+
};
|
|
28823
|
+
/**
|
|
28824
|
+
* Clears the value when clicked.
|
|
28825
|
+
* Renders a `<button>` element.
|
|
28826
|
+
*
|
|
28827
|
+
* Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
|
|
28828
|
+
*/
|
|
28829
|
+
var ComboboxClear = /*#__PURE__*/ React.forwardRef(function ComboboxClear(componentProps, forwardedRef) {
|
|
28830
|
+
const { render, className, disabled: disabledProp = false, nativeButton = true, keepMounted = false, style, ...elementProps } = componentProps;
|
|
28831
|
+
const { disabled: fieldDisabled } = useFieldRootContext();
|
|
28832
|
+
const store = useComboboxRootContext();
|
|
28833
|
+
const selectionMode = useStore$1(store, selectors.selectionMode);
|
|
28834
|
+
const comboboxDisabled = useStore$1(store, selectors.disabled);
|
|
28835
|
+
const readOnly = useStore$1(store, selectors.readOnly);
|
|
28836
|
+
const open = useStore$1(store, selectors.open);
|
|
28837
|
+
const selectedValue = useStore$1(store, selectors.selectedValue);
|
|
28838
|
+
const hasSelectionChips = useStore$1(store, selectors.hasSelectionChips);
|
|
28839
|
+
const inputValue = useComboboxInputValueContext();
|
|
28840
|
+
let visible = false;
|
|
28841
|
+
if (selectionMode === "none") visible = inputValue !== "";
|
|
28842
|
+
else if (selectionMode === "single") visible = selectedValue != null;
|
|
28843
|
+
else visible = hasSelectionChips;
|
|
28844
|
+
const disabled = fieldDisabled || comboboxDisabled || disabledProp;
|
|
28845
|
+
const { buttonRef, getButtonProps } = useButton({
|
|
28846
|
+
native: nativeButton,
|
|
28847
|
+
disabled
|
|
28848
|
+
});
|
|
28849
|
+
const { mounted, transitionStatus, setMounted } = useTransitionStatus(visible);
|
|
28850
|
+
const state = {
|
|
28851
|
+
disabled,
|
|
28852
|
+
open,
|
|
28853
|
+
transitionStatus
|
|
28854
|
+
};
|
|
28855
|
+
useOpenChangeComplete({
|
|
28856
|
+
open: visible,
|
|
28857
|
+
ref: store.state.clearRef,
|
|
28858
|
+
onComplete() {
|
|
28859
|
+
if (!visible) setMounted(false);
|
|
28860
|
+
}
|
|
28861
|
+
});
|
|
28862
|
+
const element = useRenderElement("button", componentProps, {
|
|
28863
|
+
state,
|
|
28864
|
+
ref: [
|
|
28865
|
+
forwardedRef,
|
|
28866
|
+
buttonRef,
|
|
28867
|
+
store.state.clearRef
|
|
28868
|
+
],
|
|
28869
|
+
props: [
|
|
28870
|
+
{
|
|
28871
|
+
tabIndex: -1,
|
|
28872
|
+
children: "x",
|
|
28873
|
+
onMouseDown(event) {
|
|
28874
|
+
event.preventDefault();
|
|
28875
|
+
},
|
|
28876
|
+
onClick(event) {
|
|
28877
|
+
if (disabled || readOnly) return;
|
|
28878
|
+
const keyboardActiveRef = store.state.keyboardActiveRef;
|
|
28879
|
+
store.state.setInputValue("", createChangeEventDetails(clearPress, event.nativeEvent));
|
|
28880
|
+
if (selectionMode !== "none") {
|
|
28881
|
+
store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(clearPress, event.nativeEvent));
|
|
28882
|
+
store.state.setIndices({
|
|
28883
|
+
activeIndex: null,
|
|
28884
|
+
selectedIndex: null,
|
|
28885
|
+
type: keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
28886
|
+
});
|
|
28887
|
+
} else store.state.setIndices({
|
|
28888
|
+
activeIndex: null,
|
|
28889
|
+
type: keyboardActiveRef.current ? "keyboard" : "pointer"
|
|
28890
|
+
});
|
|
28891
|
+
store.state.inputRef.current?.focus();
|
|
28892
|
+
}
|
|
28893
|
+
},
|
|
28894
|
+
elementProps,
|
|
28895
|
+
getButtonProps
|
|
28896
|
+
],
|
|
28897
|
+
stateAttributesMapping
|
|
28898
|
+
});
|
|
28899
|
+
if (!(keepMounted || mounted)) return null;
|
|
28900
|
+
return element;
|
|
28901
|
+
});
|
|
28902
|
+
if (process.env.NODE_ENV !== "production") ComboboxClear.displayName = "ComboboxClear";
|
|
28903
|
+
//#endregion
|
|
28904
|
+
//#region src/workbench/browser/runtime/editor/errorTriggerSources.tsx
|
|
28905
|
+
function ErrorTriggerSources({ flows, flowId, value, disabled = false, complete = true, footer, onChange }) {
|
|
28906
|
+
const t = useTranslate();
|
|
28907
|
+
const id = useId();
|
|
28908
|
+
const [query, setQuery] = useState("");
|
|
28909
|
+
const [open, setOpen] = useState(false);
|
|
28910
|
+
const [container, setContainer] = useState(null);
|
|
25961
28911
|
const eligible = flows.filter((flow) => flow.flowId != flowId && flow.status == "active" && flow.live != null);
|
|
25962
28912
|
const candidates = [.../* @__PURE__ */ new Set([...eligible.map((flow) => flow.flowId), ...value])].map((sourceId) => {
|
|
25963
28913
|
const flow = flows.find((item) => item.flowId == sourceId);
|
|
@@ -25984,99 +28934,101 @@ function ErrorTriggerSources({ flows, flowId, value, disabled = false, complete
|
|
|
25984
28934
|
/* @__PURE__ */ jsx("div", {
|
|
25985
28935
|
ref: setContainer,
|
|
25986
28936
|
className: "min-w-0",
|
|
25987
|
-
children: /* @__PURE__ */ jsxs(
|
|
28937
|
+
children: /* @__PURE__ */ jsxs(ComboboxRoot, {
|
|
28938
|
+
multiple: true,
|
|
28939
|
+
disabled,
|
|
28940
|
+
value: [...value],
|
|
28941
|
+
onValueChange: onChange,
|
|
28942
|
+
items: visible.map((flow) => flow.id),
|
|
28943
|
+
filter: null,
|
|
28944
|
+
inputValue: open ? query : summary,
|
|
28945
|
+
onInputValueChange: setQuery,
|
|
25988
28946
|
open,
|
|
25989
28947
|
onOpenChange: (next) => {
|
|
25990
28948
|
setOpen(next);
|
|
25991
28949
|
if (!next) setQuery("");
|
|
25992
28950
|
},
|
|
25993
|
-
children: [/* @__PURE__ */ jsxs(
|
|
25994
|
-
render: /* @__PURE__ */ jsx(
|
|
28951
|
+
children: [/* @__PURE__ */ jsxs(ComboboxInputGroup, {
|
|
28952
|
+
render: /* @__PURE__ */ jsx(InputGroup, {}),
|
|
28953
|
+
children: [/* @__PURE__ */ jsx(ComboboxInput, {
|
|
28954
|
+
render: /* @__PURE__ */ jsx(InputGroupInput, {}),
|
|
25995
28955
|
id,
|
|
25996
|
-
|
|
25997
|
-
variant: "field",
|
|
25998
|
-
size: "field",
|
|
25999
|
-
disabled,
|
|
26000
|
-
"aria-label": `${t("errorWorkflow.sources")}: ${summary || t("errorWorkflow.choose")}`,
|
|
28956
|
+
"aria-label": t("errorWorkflow.sources"),
|
|
26001
28957
|
"aria-describedby": `${id}-hint${unavailable.length > 0 ? ` ${id}-error` : ""}`,
|
|
26002
28958
|
"aria-invalid": unavailable.length > 0 || void 0,
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
|
|
26007
|
-
|
|
26008
|
-
|
|
26009
|
-
|
|
26010
|
-
|
|
26011
|
-
|
|
26012
|
-
|
|
26013
|
-
|
|
26014
|
-
|
|
26015
|
-
|
|
26016
|
-
|
|
26017
|
-
|
|
26018
|
-
className: "p-1",
|
|
26019
|
-
children: /* @__PURE__ */ jsx(Input$1, {
|
|
26020
|
-
ref: search,
|
|
26021
|
-
"aria-label": t("errorWorkflow.search"),
|
|
26022
|
-
placeholder: t("errorWorkflow.search"),
|
|
26023
|
-
value: query,
|
|
26024
|
-
onChange: (event) => setQuery(event.target.value)
|
|
28959
|
+
placeholder: open ? t("errorWorkflow.search") : t("errorWorkflow.choose"),
|
|
28960
|
+
title: summary || void 0
|
|
28961
|
+
}), /* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
28962
|
+
align: "inline-end",
|
|
28963
|
+
children: [value.length > 0 && !disabled && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
28964
|
+
render: /* @__PURE__ */ jsx(ComboboxClear, {
|
|
28965
|
+
render: /* @__PURE__ */ jsx(Button$1, {
|
|
28966
|
+
variant: "ghost",
|
|
28967
|
+
size: "icon-xs"
|
|
28968
|
+
}),
|
|
28969
|
+
"aria-label": t("errorWorkflow.clear")
|
|
28970
|
+
}),
|
|
28971
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
28972
|
+
"aria-hidden": "true",
|
|
28973
|
+
className: "i-lucide-light:x text-base"
|
|
26025
28974
|
})
|
|
26026
|
-
}),
|
|
26027
|
-
|
|
26028
|
-
|
|
26029
|
-
|
|
26030
|
-
|
|
26031
|
-
|
|
26032
|
-
|
|
26033
|
-
|
|
26034
|
-
|
|
26035
|
-
|
|
26036
|
-
|
|
26037
|
-
|
|
26038
|
-
|
|
26039
|
-
|
|
26040
|
-
|
|
26041
|
-
|
|
26042
|
-
|
|
26043
|
-
|
|
26044
|
-
|
|
26045
|
-
|
|
26046
|
-
|
|
26047
|
-
|
|
26048
|
-
|
|
26049
|
-
|
|
28975
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
28976
|
+
container,
|
|
28977
|
+
children: t("errorWorkflow.clear")
|
|
28978
|
+
})] }), /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
28979
|
+
render: /* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
28980
|
+
render: /* @__PURE__ */ jsx(Button$1, {
|
|
28981
|
+
variant: "ghost",
|
|
28982
|
+
size: "icon-xs"
|
|
28983
|
+
}),
|
|
28984
|
+
"aria-label": t("errorWorkflow.choose")
|
|
28985
|
+
}),
|
|
28986
|
+
children: /* @__PURE__ */ jsx(SelectChevron, {})
|
|
28987
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
28988
|
+
container,
|
|
28989
|
+
children: t("errorWorkflow.choose")
|
|
28990
|
+
})] })]
|
|
28991
|
+
})]
|
|
28992
|
+
}), /* @__PURE__ */ jsx(ComboboxPortal, {
|
|
28993
|
+
container,
|
|
28994
|
+
className: "contents",
|
|
28995
|
+
children: /* @__PURE__ */ jsx(ComboboxPositioner, {
|
|
28996
|
+
align: "start",
|
|
28997
|
+
sideOffset: 4,
|
|
28998
|
+
className: "isolate z-50",
|
|
28999
|
+
children: /* @__PURE__ */ jsxs(ComboboxPopup, {
|
|
29000
|
+
className: `w-(--anchor-width) min-w-56 max-w-[calc(100vw-24px)] bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-none ${selectionMenuContentClass}`,
|
|
29001
|
+
children: [/* @__PURE__ */ jsxs(ComboboxList, {
|
|
29002
|
+
"aria-label": t("errorWorkflow.sources"),
|
|
29003
|
+
className: "max-h-[min(40vh,280px)] overflow-y-auto overscroll-contain",
|
|
29004
|
+
children: [visible.map((flow) => /* @__PURE__ */ jsxs(ComboboxItem, {
|
|
29005
|
+
value: flow.id,
|
|
29006
|
+
className: `group/option flex cursor-default items-center gap-2 px-2 data-highlighted:bg-accent ${selectionMenuItemClass}`,
|
|
29007
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
29008
|
+
"aria-hidden": "true",
|
|
29009
|
+
className: "flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input group-data-selected/option:border-primary group-data-selected/option:bg-primary group-data-selected/option:text-primary-foreground",
|
|
29010
|
+
children: /* @__PURE__ */ jsx(ComboboxItemIndicator, { children: /* @__PURE__ */ jsx("i", { className: "i-lucide-light:check block text-sm" }) })
|
|
29011
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
29012
|
+
className: "min-w-0 flex-1 break-words",
|
|
29013
|
+
children: [
|
|
29014
|
+
flow.name,
|
|
29015
|
+
flow.issue == "deleted" && /* @__PURE__ */ jsx("span", {
|
|
29016
|
+
className: "block break-all text-muted-foreground",
|
|
29017
|
+
children: flow.id
|
|
29018
|
+
}),
|
|
29019
|
+
flow.issue && /* @__PURE__ */ jsx("span", {
|
|
29020
|
+
className: "block text-destructive",
|
|
29021
|
+
children: t(`errorWorkflow.${flow.issue}`)
|
|
29022
|
+
})
|
|
29023
|
+
]
|
|
29024
|
+
})]
|
|
29025
|
+
}, flow.id)), visible.length == 0 && /* @__PURE__ */ jsx("p", {
|
|
29026
|
+
className: "px-2 py-3 text-xs text-muted-foreground",
|
|
29027
|
+
children: t(query ? "errorWorkflow.noMatches" : "errorWorkflow.empty")
|
|
26050
29028
|
})]
|
|
26051
|
-
}
|
|
26052
|
-
className: "px-2 py-3 text-xs text-muted-foreground",
|
|
26053
|
-
children: t(query ? "errorWorkflow.noMatches" : "errorWorkflow.empty")
|
|
26054
|
-
})]
|
|
26055
|
-
}),
|
|
26056
|
-
footer,
|
|
26057
|
-
/* @__PURE__ */ jsx("div", {
|
|
26058
|
-
role: "separator",
|
|
26059
|
-
className: "mx-2 my-1 h-px bg-border/50"
|
|
26060
|
-
}),
|
|
26061
|
-
/* @__PURE__ */ jsxs("div", {
|
|
26062
|
-
className: "flex items-center justify-between gap-2 px-1 pb-1",
|
|
26063
|
-
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
26064
|
-
variant: "ghost",
|
|
26065
|
-
size: "sm",
|
|
26066
|
-
disabled: disabled || value.length == 0,
|
|
26067
|
-
onClick: () => onChange([]),
|
|
26068
|
-
children: t("errorWorkflow.clear")
|
|
26069
|
-
}), /* @__PURE__ */ jsx(Button$1, {
|
|
26070
|
-
variant: "ghost",
|
|
26071
|
-
size: "sm",
|
|
26072
|
-
onClick: () => {
|
|
26073
|
-
setOpen(false);
|
|
26074
|
-
setQuery("");
|
|
26075
|
-
},
|
|
26076
|
-
children: t("errorWorkflow.done")
|
|
26077
|
-
})]
|
|
29029
|
+
}), footer]
|
|
26078
29030
|
})
|
|
26079
|
-
|
|
29031
|
+
})
|
|
26080
29032
|
})]
|
|
26081
29033
|
})
|
|
26082
29034
|
}),
|
|
@@ -26574,81 +29526,6 @@ function DefinitionField({ schema, label, disabled, onChange, options, depth = 0
|
|
|
26574
29526
|
})
|
|
26575
29527
|
});
|
|
26576
29528
|
}
|
|
26577
|
-
var fieldTable_module_default = {
|
|
26578
|
-
list: "fieldTable_list_698c8",
|
|
26579
|
-
columns: "fieldTable_columns_698c8",
|
|
26580
|
-
nameHeading: "fieldTable_nameHeading_698c8",
|
|
26581
|
-
typeHeading: "fieldTable_typeHeading_698c8",
|
|
26582
|
-
valueHeading: "fieldTable_valueHeading_698c8",
|
|
26583
|
-
row: "fieldTable_row_698c8",
|
|
26584
|
-
nullableControl: "fieldTable_nullableControl_698c8",
|
|
26585
|
-
nullableHeading: "fieldTable_nullableHeading_698c8"
|
|
26586
|
-
};
|
|
26587
|
-
//#endregion
|
|
26588
|
-
//#region src/form/browser/fieldTable.tsx
|
|
26589
|
-
/** Shared field geometry. Callers own definitions, values, actions and persistence. */
|
|
26590
|
-
var FieldTable = forwardRef(({ layout = "definition", fixedTypes, typeColumn = true, output, nullable, empty, className, children, ...props }, ref) => {
|
|
26591
|
-
const t = useTranslate();
|
|
26592
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
26593
|
-
...props,
|
|
26594
|
-
ref,
|
|
26595
|
-
className: [fieldTable_module_default.list, className].filter(Boolean).join(" "),
|
|
26596
|
-
"data-value-editor-scope": true,
|
|
26597
|
-
"data-layout": layout,
|
|
26598
|
-
"data-type-column": typeColumn || void 0,
|
|
26599
|
-
"data-output": output || void 0,
|
|
26600
|
-
"data-fixed-types": fixedTypes || void 0,
|
|
26601
|
-
"data-nullable": nullable || void 0,
|
|
26602
|
-
"data-empty": empty || void 0,
|
|
26603
|
-
children: [!empty && /* @__PURE__ */ jsxs("div", {
|
|
26604
|
-
className: fieldTable_module_default.columns,
|
|
26605
|
-
"data-layout": layout,
|
|
26606
|
-
"data-output": output || void 0,
|
|
26607
|
-
children: [
|
|
26608
|
-
/* @__PURE__ */ jsx("span", {
|
|
26609
|
-
className: fieldTable_module_default.nameHeading,
|
|
26610
|
-
children: t("valueEditor.columnName")
|
|
26611
|
-
}),
|
|
26612
|
-
typeColumn && /* @__PURE__ */ jsx("span", {
|
|
26613
|
-
className: fieldTable_module_default.typeHeading,
|
|
26614
|
-
children: t("valueEditor.columnType")
|
|
26615
|
-
}),
|
|
26616
|
-
!output && /* @__PURE__ */ jsx("span", {
|
|
26617
|
-
className: fieldTable_module_default.valueHeading,
|
|
26618
|
-
children: t("valueEditor.columnValue")
|
|
26619
|
-
}),
|
|
26620
|
-
nullable && /* @__PURE__ */ jsx("span", {
|
|
26621
|
-
className: fieldTable_module_default.nullableHeading,
|
|
26622
|
-
children: t("valueEditor.nullable")
|
|
26623
|
-
})
|
|
26624
|
-
]
|
|
26625
|
-
}), /* @__PURE__ */ jsx(FieldLayout, {
|
|
26626
|
-
layout,
|
|
26627
|
-
children
|
|
26628
|
-
})]
|
|
26629
|
-
});
|
|
26630
|
-
});
|
|
26631
|
-
function FieldTableRow({ className, ...props }) {
|
|
26632
|
-
return /* @__PURE__ */ jsx("div", {
|
|
26633
|
-
...props,
|
|
26634
|
-
className: [fieldTable_module_default.row, className].filter(Boolean).join(" ")
|
|
26635
|
-
});
|
|
26636
|
-
}
|
|
26637
|
-
function FieldNullable({ name, checked, onChange }) {
|
|
26638
|
-
const t = useTranslate();
|
|
26639
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
26640
|
-
render: /* @__PURE__ */ jsx("span", { className: fieldTable_module_default.nullableControl }),
|
|
26641
|
-
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
26642
|
-
className: "not-data-disabled:cursor-pointer",
|
|
26643
|
-
"aria-label": `${name} ${t("valueEditor.nullable")}`,
|
|
26644
|
-
"aria-checked": checked,
|
|
26645
|
-
checked,
|
|
26646
|
-
indeterminate: !onChange && !checked,
|
|
26647
|
-
disabled: !onChange,
|
|
26648
|
-
onCheckedChange: (next) => onChange?.(next === true)
|
|
26649
|
-
})
|
|
26650
|
-
}), /* @__PURE__ */ jsx(TooltipContent, { children: t(checked ? "valueEditor.nullableDescription" : "valueEditor.notNullableDescription") })] });
|
|
26651
|
-
}
|
|
26652
29529
|
//#endregion
|
|
26653
29530
|
//#region src/workbench/browser/runtime/editor/portOrder.ts
|
|
26654
29531
|
/** Reordering a field preserves its group and the identities used by values and edges. */
|
|
@@ -28693,95 +31570,6 @@ function ResolutionDefinition({ disabled, selection, store }) {
|
|
|
28693
31570
|
}), error != null && /* @__PURE__ */ jsx(FieldError, { children: error })] })
|
|
28694
31571
|
});
|
|
28695
31572
|
}
|
|
28696
|
-
//#endregion
|
|
28697
|
-
//#region src/workbench/browser/runtime/editor/subflowDefinition.tsx
|
|
28698
|
-
function json$1(value) {
|
|
28699
|
-
return JSON.stringify(value, null, 2);
|
|
28700
|
-
}
|
|
28701
|
-
function arrayValue(value, label, t) {
|
|
28702
|
-
const parsed = JSON.parse(value);
|
|
28703
|
-
if (!Array.isArray(parsed)) throw new TypeError(t("inspector.errors.portDefinitions", { label }));
|
|
28704
|
-
return parsed;
|
|
28705
|
-
}
|
|
28706
|
-
function SubflowDefinition({ definition, disabled, store, subflowId }) {
|
|
28707
|
-
const t = useTranslate();
|
|
28708
|
-
const [name, setName] = useState(definition.name);
|
|
28709
|
-
const [inputs, setInputs] = useState(json$1(definition.inputs));
|
|
28710
|
-
const [outputs, setOutputs] = useState(json$1(definition.outputs));
|
|
28711
|
-
const [error, setError] = useState();
|
|
28712
|
-
useEffect(() => {
|
|
28713
|
-
setName(definition.name);
|
|
28714
|
-
setInputs(json$1(definition.inputs));
|
|
28715
|
-
setOutputs(json$1(definition.outputs));
|
|
28716
|
-
setError(void 0);
|
|
28717
|
-
}, [definition]);
|
|
28718
|
-
return /* @__PURE__ */ jsxs("form", {
|
|
28719
|
-
className: "inspector-section inspector-form",
|
|
28720
|
-
onSubmit: (event) => {
|
|
28721
|
-
event.preventDefault();
|
|
28722
|
-
if (disabled || store == null) return;
|
|
28723
|
-
try {
|
|
28724
|
-
const nextInputs = arrayValue(inputs, t("inspector.subflow.inputPorts"), t);
|
|
28725
|
-
const nextOutputs = arrayValue(outputs, t("inspector.subflow.outputPorts"), t);
|
|
28726
|
-
setError(void 0);
|
|
28727
|
-
store?.saveSubflowSettings(subflowId, {
|
|
28728
|
-
inputs: nextInputs,
|
|
28729
|
-
name: name.trim(),
|
|
28730
|
-
outputs: nextOutputs
|
|
28731
|
-
});
|
|
28732
|
-
} catch (parseError) {
|
|
28733
|
-
setError(parseError instanceof TypeError ? parseError.message : t("inspector.errors.portDefinitions"));
|
|
28734
|
-
}
|
|
28735
|
-
},
|
|
28736
|
-
children: [
|
|
28737
|
-
/* @__PURE__ */ jsx("h3", { children: t("inspector.subflow.definition") }),
|
|
28738
|
-
/* @__PURE__ */ jsxs(FieldGroup, { children: [
|
|
28739
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
28740
|
-
htmlFor: `${subflowId}-name`,
|
|
28741
|
-
children: t("common.name")
|
|
28742
|
-
}), /* @__PURE__ */ jsx(Input$1, {
|
|
28743
|
-
readOnly: disabled,
|
|
28744
|
-
id: `${subflowId}-name`,
|
|
28745
|
-
onChange: (event) => setName(event.target.value),
|
|
28746
|
-
value: name
|
|
28747
|
-
})] }),
|
|
28748
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
28749
|
-
htmlFor: `${subflowId}-inputs`,
|
|
28750
|
-
children: t("inspector.subflow.inputPorts")
|
|
28751
|
-
}), /* @__PURE__ */ jsx(Textarea, {
|
|
28752
|
-
readOnly: disabled,
|
|
28753
|
-
id: `${subflowId}-inputs`,
|
|
28754
|
-
onChange: (event) => setInputs(event.target.value),
|
|
28755
|
-
rows: 8,
|
|
28756
|
-
spellCheck: false,
|
|
28757
|
-
value: inputs
|
|
28758
|
-
})] }),
|
|
28759
|
-
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
28760
|
-
htmlFor: `${subflowId}-outputs`,
|
|
28761
|
-
children: t("inspector.subflow.outputPorts")
|
|
28762
|
-
}), /* @__PURE__ */ jsx(Textarea, {
|
|
28763
|
-
readOnly: disabled,
|
|
28764
|
-
id: `${subflowId}-outputs`,
|
|
28765
|
-
onChange: (event) => setOutputs(event.target.value),
|
|
28766
|
-
rows: 10,
|
|
28767
|
-
spellCheck: false,
|
|
28768
|
-
value: outputs
|
|
28769
|
-
})] }),
|
|
28770
|
-
error != null && /* @__PURE__ */ jsx(FieldError, { children: error })
|
|
28771
|
-
] }),
|
|
28772
|
-
!disabled && /* @__PURE__ */ jsx("div", {
|
|
28773
|
-
className: "form-actions",
|
|
28774
|
-
children: /* @__PURE__ */ jsx(Button$1, {
|
|
28775
|
-
disabled: disabled || name.trim() == "",
|
|
28776
|
-
size: "sm",
|
|
28777
|
-
type: "submit",
|
|
28778
|
-
variant: "secondary",
|
|
28779
|
-
children: t("inspector.subflow.save")
|
|
28780
|
-
})
|
|
28781
|
-
})
|
|
28782
|
-
]
|
|
28783
|
-
});
|
|
28784
|
-
}
|
|
28785
31573
|
var triggerScheduleEditor_module_default = {
|
|
28786
31574
|
describedControl: "triggerScheduleEditor_describedControl_49cac",
|
|
28787
31575
|
describedInput: "triggerScheduleEditor_describedInput_49cac",
|
|
@@ -32468,22 +35256,6 @@ function validateCronExpression(expression, timezone) {
|
|
|
32468
35256
|
if (cron.nextRun() == null) throw new TypeError("Cron expression has no future occurrence.");
|
|
32469
35257
|
}
|
|
32470
35258
|
//#endregion
|
|
32471
|
-
//#region src/workbench/browser/runtime/editor/inspectorSection.tsx
|
|
32472
|
-
function InspectorSection({ title, children, className, contentInset = true, ...props }) {
|
|
32473
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
32474
|
-
className: cn$1("inspector-section inspector-titled-section", className),
|
|
32475
|
-
...props,
|
|
32476
|
-
children: [/* @__PURE__ */ jsx("h3", {
|
|
32477
|
-
className: "inspector-section-title",
|
|
32478
|
-
children: title
|
|
32479
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
32480
|
-
className: "inspector-section-content",
|
|
32481
|
-
"data-inset": contentInset || void 0,
|
|
32482
|
-
children
|
|
32483
|
-
})]
|
|
32484
|
-
});
|
|
32485
|
-
}
|
|
32486
|
-
//#endregion
|
|
32487
35259
|
//#region src/workbench/browser/runtime/editor/triggerScheduleValidation.ts
|
|
32488
35260
|
function deferScheduleCheck(check, signal) {
|
|
32489
35261
|
return new Promise((resolve, reject) => {
|
|
@@ -33140,14 +35912,14 @@ function WebhookEditor({ bodyFields, method, options, disabled, readOnly, output
|
|
|
33140
35912
|
}
|
|
33141
35913
|
//#endregion
|
|
33142
35914
|
//#region src/workbench/browser/runtime/editor/nodeInspector.tsx
|
|
33143
|
-
function inspectorIcon(node
|
|
35915
|
+
function inspectorIcon(node) {
|
|
33144
35916
|
if (node?.kind == "trigger") return "trigger";
|
|
33145
35917
|
if (node?.kind == "condition") return "condition";
|
|
33146
35918
|
if (node?.kind == "value") return "value";
|
|
33147
35919
|
if (node?.kind == "approval") return "check";
|
|
33148
35920
|
if (node?.kind == "wait") return "wait";
|
|
33149
|
-
if (node?.kind == "subflow" || node == null && target.kind == "subflow") return "subflow";
|
|
33150
35921
|
if (node?.kind == "task" && node.definition != null && "executor" in node.definition) {
|
|
35922
|
+
if (node.definition.executor.kind == "decision") return "decision";
|
|
33151
35923
|
if (node.definition.executor.kind == "openapi") return "task";
|
|
33152
35924
|
return node.definition.executor.kind == "connector" ? "connection" : "llm";
|
|
33153
35925
|
}
|
|
@@ -33159,7 +35931,6 @@ function nodePurposePlaceholder(selection, t, action, displays) {
|
|
|
33159
35931
|
case "value": return t("addNode.valueDescription");
|
|
33160
35932
|
case "approval": return t("addNode.approvalDescription");
|
|
33161
35933
|
case "wait": return t("addNode.waitDescription");
|
|
33162
|
-
case "subflow": return t("addNode.subflowDescription");
|
|
33163
35934
|
case "trigger": {
|
|
33164
35935
|
const node = selection.node;
|
|
33165
35936
|
switch (node.kind) {
|
|
@@ -33177,6 +35948,7 @@ function nodePurposePlaceholder(selection, t, action, displays) {
|
|
|
33177
35948
|
if (!("executor" in definition)) return t("addNode.javascriptDescription");
|
|
33178
35949
|
switch (definition.executor.kind) {
|
|
33179
35950
|
case "agent": return t("addNode.agentDescription");
|
|
35951
|
+
case "decision": return t("decision.description");
|
|
33180
35952
|
case "openapi": return t("openapi.description");
|
|
33181
35953
|
case "connector": return action?.description;
|
|
33182
35954
|
case "llm": return t(definition.executor.mode == "json" ? "addNode.llmStructuredDescription" : "addNode.llmChatDescription");
|
|
@@ -33184,8 +35956,8 @@ function nodePurposePlaceholder(selection, t, action, displays) {
|
|
|
33184
35956
|
}
|
|
33185
35957
|
}
|
|
33186
35958
|
}
|
|
33187
|
-
function inputUpstreamSources({ revision, sourceNodeIcons,
|
|
33188
|
-
const graph = revision.graph(
|
|
35959
|
+
function inputUpstreamSources({ revision, sourceNodeIcons, selection, store, handleName, t, triggerDisplays }) {
|
|
35960
|
+
const graph = revision.graph();
|
|
33189
35961
|
const mapping = nodeInputMappings(selection.node)[handleName];
|
|
33190
35962
|
const sources = mapping?.kind == "sources" ? mapping.sources.filter((source) => source.kind == "node") : [];
|
|
33191
35963
|
const providerDisplay = (node) => node?.kind == "integration" || node?.kind == "poll" ? triggerDisplays?.[node.definition.key] : void 0;
|
|
@@ -33193,7 +35965,7 @@ function inputUpstreamSources({ revision, sourceNodeIcons, target, selection, st
|
|
|
33193
35965
|
current: sources.map((source) => {
|
|
33194
35966
|
const node = graph.nodes[source.nodeId];
|
|
33195
35967
|
return {
|
|
33196
|
-
description: node == null ? revision.outputDescription(
|
|
35968
|
+
description: node == null ? revision.outputDescription(source.nodeId, source.output) : presentProviderOutputDescription(node, source.output, presentBuiltInOutputDescription(node, source.output, revision.outputDescription(source.nodeId, source.output), t), providerDisplay(node)),
|
|
33197
35969
|
icon: sourceNodeIcons?.[source.nodeId],
|
|
33198
35970
|
nodeId: source.nodeId,
|
|
33199
35971
|
nodeName: node?.name,
|
|
@@ -33202,7 +35974,7 @@ function inputUpstreamSources({ revision, sourceNodeIcons, target, selection, st
|
|
|
33202
35974
|
check: void 0
|
|
33203
35975
|
};
|
|
33204
35976
|
}),
|
|
33205
|
-
query: revision.inputSource(
|
|
35977
|
+
query: revision.inputSource(selection.id, handleName),
|
|
33206
35978
|
groups: [],
|
|
33207
35979
|
describeGroups: (candidates) => Object.entries(candidates).map(([nodeId, outputs]) => {
|
|
33208
35980
|
const node = graph.nodes[nodeId];
|
|
@@ -33224,7 +35996,7 @@ function NodeInspector({ variables = {
|
|
|
33224
35996
|
loading: false,
|
|
33225
35997
|
names: [],
|
|
33226
35998
|
onOpen: void 0
|
|
33227
|
-
}, readOnly = false,
|
|
35999
|
+
}, readOnly = false, connectorAction, connectorActionError, connectorAccessError, connectorAuthorizationPending = false, connectorConnection, connectorConnectionError, activeConnectorConnections, connectors: liveConnectors, connectorAccess, connectorCandidates, onConfigureConnectorAccess, prepareConnectorAction, connectorLoading = false, disabled: temporarilyDisabled = false, diagnostics, focus, revision, selection, sourceNodeIcons, store: writableStore, theme, triggerActiveConnections, triggerAuthorizationPending = false, triggerConnection, triggerConnectionError, triggerConnectionLoading = false, triggerDisplays, triggers: liveTriggers }) {
|
|
33228
36000
|
const store = readOnly ? void 0 : writableStore;
|
|
33229
36001
|
const connectors = readOnly ? void 0 : liveConnectors;
|
|
33230
36002
|
const triggers = readOnly ? void 0 : liveTriggers;
|
|
@@ -33233,11 +36005,12 @@ function NodeInspector({ variables = {
|
|
|
33233
36005
|
const content = useRef(null);
|
|
33234
36006
|
const task = selection?.kind == "task" ? selection.definition : void 0;
|
|
33235
36007
|
const isAgent = task != null && "executor" in task && task.executor.kind == "agent";
|
|
36008
|
+
const isDecision = task != null && "executor" in task && task.executor.kind == "decision";
|
|
33236
36009
|
const isOpenApi = task != null && "executor" in task && task.executor.kind == "openapi";
|
|
33237
36010
|
const unconfiguredOpenApi = task != null && "executor" in task && task.executor.kind == "openapi" && !task.executor.path;
|
|
33238
36011
|
const isLlm = task != null && "executor" in task && task.executor.kind == "llm";
|
|
33239
36012
|
const connector = task != null && "executor" in task && task.executor.kind == "connector" ? task.executor : void 0;
|
|
33240
|
-
const
|
|
36013
|
+
const nodeId = selection?.kind == "task" ? selection.id : void 0;
|
|
33241
36014
|
const locatedRequest = useRef();
|
|
33242
36015
|
useEffect(() => {
|
|
33243
36016
|
if (focus == null) return;
|
|
@@ -33284,7 +36057,7 @@ function NodeInspector({ variables = {
|
|
|
33284
36057
|
triggers,
|
|
33285
36058
|
onConfigureAccess: (providerId) => void triggers.connect(providerId)
|
|
33286
36059
|
}),
|
|
33287
|
-
!readOnly && connectors != null && connector != null &&
|
|
36060
|
+
!readOnly && connectors != null && connector != null && nodeId != null && connectorAction?.authenticated !== false && /* @__PURE__ */ jsx(ConnectorAccount, {
|
|
33288
36061
|
action: connectorAction,
|
|
33289
36062
|
actionError: connectorActionError,
|
|
33290
36063
|
accessError: connectorAccessError,
|
|
@@ -33299,7 +36072,7 @@ function NodeInspector({ variables = {
|
|
|
33299
36072
|
disabled,
|
|
33300
36073
|
fieldIdPrefix: `task-${selection?.id}`,
|
|
33301
36074
|
loading: connectorLoading,
|
|
33302
|
-
|
|
36075
|
+
nodeId
|
|
33303
36076
|
}),
|
|
33304
36077
|
selection != null && /* @__PURE__ */ jsx(NodeDescription, {
|
|
33305
36078
|
value: selection.node.description,
|
|
@@ -33392,6 +36165,16 @@ function NodeInspector({ variables = {
|
|
|
33392
36165
|
store?.saveTriggerSchedule(selection.id, schedule);
|
|
33393
36166
|
}
|
|
33394
36167
|
}, `schedule:${selection.id}`),
|
|
36168
|
+
selection?.kind === "task" && task != null && "executor" in task && task.executor.kind === "decision" && /* @__PURE__ */ jsx(DecisionSection, {
|
|
36169
|
+
task,
|
|
36170
|
+
disabled,
|
|
36171
|
+
onSave: (before, value, deletion) => store?.saveTaskSettings(selection.id, {
|
|
36172
|
+
kind: "decision",
|
|
36173
|
+
name: task.name,
|
|
36174
|
+
before,
|
|
36175
|
+
task: value
|
|
36176
|
+
}, deletion) ?? Promise.resolve(false)
|
|
36177
|
+
}, `decision:${selection.id}`),
|
|
33395
36178
|
isOpenApi && task != null && "executor" in task && /* @__PURE__ */ jsx(OpenApiSection, {
|
|
33396
36179
|
task,
|
|
33397
36180
|
credentials: (onInvalidChange) => selection?.kind === "task" && task.inputs.filter((port) => "handle" in port && port.handle.startsWith("auth.")).map((definition) => {
|
|
@@ -33416,7 +36199,6 @@ function NodeInspector({ variables = {
|
|
|
33416
36199
|
upstream: inputUpstreamSources({
|
|
33417
36200
|
revision,
|
|
33418
36201
|
sourceNodeIcons,
|
|
33419
|
-
target,
|
|
33420
36202
|
selection,
|
|
33421
36203
|
store,
|
|
33422
36204
|
handleName: definition.handle,
|
|
@@ -33441,8 +36223,8 @@ function NodeInspector({ variables = {
|
|
|
33441
36223
|
task: value
|
|
33442
36224
|
}) ?? Promise.resolve(false)
|
|
33443
36225
|
}, `openapi:${selection?.id}`),
|
|
33444
|
-
!unconfiguredOpenApi && (selection?.kind === "approval" || selection?.kind === "wait" || selection?.kind === "
|
|
33445
|
-
const definitions = selection.kind === "task" ? [...selection.definition?.inputs ?? []] :
|
|
36226
|
+
!unconfiguredOpenApi && (selection?.kind === "approval" || selection?.kind === "wait" || selection?.kind === "task") && (() => {
|
|
36227
|
+
const definitions = selection.kind === "task" ? [...selection.definition?.inputs ?? []] : [...selection.node.inputDefinitions];
|
|
33446
36228
|
const handles = new Set(definitions.flatMap((definition) => "handle" in definition ? [definition.handle] : []));
|
|
33447
36229
|
for (const handle of Object.keys(selection.node.inputs)) if (!handles.has(handle) && !(selection.kind === "task" && selection.node.additionalInputs?.some((port) => port.handle === handle))) definitions.push({
|
|
33448
36230
|
handle,
|
|
@@ -33451,6 +36233,10 @@ function NodeInspector({ variables = {
|
|
|
33451
36233
|
});
|
|
33452
36234
|
const entries = definitions.filter((definition) => !isOpenApi || !("handle" in definition) || !definition.handle.startsWith("auth.")).map((definition) => {
|
|
33453
36235
|
if ("group" in definition) return definition;
|
|
36236
|
+
if (selection.kind === "task" && selection.definition != null && "executor" in selection.definition && selection.definition.executor.kind === "decision" && definition.handle === "target") definition = {
|
|
36237
|
+
...definition,
|
|
36238
|
+
description: t("decision.targetDescription")
|
|
36239
|
+
};
|
|
33454
36240
|
const mapping = selection.node.inputs[definition.handle];
|
|
33455
36241
|
const source = mapping?.kind === "sources" ? mapping.sources.find((item) => item.kind === "binding") : void 0;
|
|
33456
36242
|
const binding = source?.kind === "binding" ? revision.binding(source.bindingId) : void 0;
|
|
@@ -33470,7 +36256,7 @@ function NodeInspector({ variables = {
|
|
|
33470
36256
|
onReset: () => {
|
|
33471
36257
|
return store?.resetInputs(selection.id, entries.flatMap((entry) => "group" in entry ? [] : [entry.definition.handle]));
|
|
33472
36258
|
},
|
|
33473
|
-
onDefinitions: selection.kind === "task" && selection.definition != null && (selection.node.task
|
|
36259
|
+
onDefinitions: selection.kind === "task" && selection.definition != null && ("moduleId" in selection.node.task || isAgent) ? (inputs, deletion, values) => {
|
|
33474
36260
|
store?.saveTaskPorts(selection.id, {
|
|
33475
36261
|
inputs,
|
|
33476
36262
|
outputs: selection.definition.outputs
|
|
@@ -33485,7 +36271,6 @@ function NodeInspector({ variables = {
|
|
|
33485
36271
|
renderSource: (handle) => inputUpstreamSources({
|
|
33486
36272
|
revision,
|
|
33487
36273
|
sourceNodeIcons,
|
|
33488
|
-
target,
|
|
33489
36274
|
selection,
|
|
33490
36275
|
store,
|
|
33491
36276
|
handleName: handle,
|
|
@@ -33504,7 +36289,7 @@ function NodeInspector({ variables = {
|
|
|
33504
36289
|
return /* @__PURE__ */ jsxs("section", {
|
|
33505
36290
|
className: "inspector-port-section",
|
|
33506
36291
|
"data-inspector-section": "inputs",
|
|
33507
|
-
children: [fields, selection.kind === "task" && selection.definition != null && selection.node.task
|
|
36292
|
+
children: [fields, selection.kind === "task" && selection.definition != null && !("moduleId" in selection.node.task) && isLlm && /* @__PURE__ */ jsx("section", {
|
|
33508
36293
|
className: "inspector-nested-port-section",
|
|
33509
36294
|
children: /* @__PURE__ */ jsx(NodeInputs, {
|
|
33510
36295
|
readOnly,
|
|
@@ -33537,7 +36322,6 @@ function NodeInspector({ variables = {
|
|
|
33537
36322
|
renderSource: (handle) => inputUpstreamSources({
|
|
33538
36323
|
revision,
|
|
33539
36324
|
sourceNodeIcons,
|
|
33540
|
-
target,
|
|
33541
36325
|
selection,
|
|
33542
36326
|
store,
|
|
33543
36327
|
handleName: handle,
|
|
@@ -33556,7 +36340,6 @@ function NodeInspector({ variables = {
|
|
|
33556
36340
|
renderSource: (handle) => inputUpstreamSources({
|
|
33557
36341
|
revision,
|
|
33558
36342
|
sourceNodeIcons,
|
|
33559
|
-
target,
|
|
33560
36343
|
selection,
|
|
33561
36344
|
store,
|
|
33562
36345
|
handleName: handle,
|
|
@@ -33564,7 +36347,7 @@ function NodeInspector({ variables = {
|
|
|
33564
36347
|
triggerDisplays
|
|
33565
36348
|
}),
|
|
33566
36349
|
variableName: (source) => source.kind === "binding" ? revision.binding(source.bindingId)?.target : void 0,
|
|
33567
|
-
sourceType: (source) => revision.sourceType(
|
|
36350
|
+
sourceType: (source) => revision.sourceType(source),
|
|
33568
36351
|
onVariable: (handle, name) => {
|
|
33569
36352
|
store?.setInputVariable(selection.id, handle, name);
|
|
33570
36353
|
},
|
|
@@ -33592,8 +36375,8 @@ function NodeInspector({ variables = {
|
|
|
33592
36375
|
layout: "ports",
|
|
33593
36376
|
title: t("inspector.ports.outputsTitle"),
|
|
33594
36377
|
output: true,
|
|
33595
|
-
values: selection.definition
|
|
33596
|
-
disabled: disabled || !(selection.node.task
|
|
36378
|
+
values: presentDecisionOutputs(selection.definition, t),
|
|
36379
|
+
disabled: disabled || !("moduleId" in selection.node.task || isAgent),
|
|
33597
36380
|
onChange: (outputs, deletion) => {
|
|
33598
36381
|
store?.saveTaskPorts(selection.id, {
|
|
33599
36382
|
inputs: selection.definition.inputs,
|
|
@@ -33602,7 +36385,7 @@ function NodeInspector({ variables = {
|
|
|
33602
36385
|
}
|
|
33603
36386
|
})
|
|
33604
36387
|
}),
|
|
33605
|
-
(selection?.kind === "
|
|
36388
|
+
(selection?.kind === "approval" || selection?.kind === "wait") && /* @__PURE__ */ jsx("section", {
|
|
33606
36389
|
className: "inspector-port-section",
|
|
33607
36390
|
children: /* @__PURE__ */ jsx(PortDefinitionEditor, {
|
|
33608
36391
|
readOnly,
|
|
@@ -33611,64 +36394,46 @@ function NodeInspector({ variables = {
|
|
|
33611
36394
|
title: t("inspector.ports.outputsTitle"),
|
|
33612
36395
|
output: true,
|
|
33613
36396
|
disabled: true,
|
|
33614
|
-
values:
|
|
36397
|
+
values: presentResolutionOutputs(selection.node, t),
|
|
33615
36398
|
onChange: () => {}
|
|
33616
36399
|
})
|
|
33617
36400
|
}),
|
|
33618
|
-
selection == null ?
|
|
33619
|
-
definition: revision.subflow(target.id),
|
|
33620
|
-
disabled,
|
|
33621
|
-
store,
|
|
33622
|
-
subflowId: target.id
|
|
33623
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
36401
|
+
selection == null ? /* @__PURE__ */ jsx("div", {
|
|
33624
36402
|
className: "inspector-empty",
|
|
33625
36403
|
children: t("inspector.selectNode")
|
|
33626
|
-
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
33627
|
-
|
|
33628
|
-
|
|
33629
|
-
|
|
33630
|
-
|
|
33631
|
-
|
|
33632
|
-
|
|
33633
|
-
|
|
33634
|
-
|
|
33635
|
-
|
|
33636
|
-
|
|
33637
|
-
|
|
33638
|
-
|
|
33639
|
-
|
|
33640
|
-
|
|
33641
|
-
|
|
33642
|
-
|
|
33643
|
-
|
|
33644
|
-
selection
|
|
33645
|
-
|
|
33646
|
-
|
|
33647
|
-
|
|
33648
|
-
|
|
33649
|
-
|
|
33650
|
-
|
|
33651
|
-
|
|
33652
|
-
|
|
33653
|
-
|
|
33654
|
-
|
|
33655
|
-
|
|
33656
|
-
|
|
33657
|
-
|
|
33658
|
-
|
|
33659
|
-
className: "reference-value",
|
|
33660
|
-
children: selection.definition?.name ?? selection.node.subflowId
|
|
33661
|
-
}),
|
|
33662
|
-
onOpenSubflow != null && selection.definition != null && /* @__PURE__ */ jsx(Button$1, {
|
|
33663
|
-
className: "self-start",
|
|
33664
|
-
size: "sm",
|
|
33665
|
-
variant: "outline",
|
|
33666
|
-
onClick: () => onOpenSubflow(selection.node.subflowId),
|
|
33667
|
-
children: t("inspector.subflow.open")
|
|
33668
|
-
})
|
|
33669
|
-
]
|
|
33670
|
-
})
|
|
33671
|
-
] })
|
|
36404
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [selection.kind == "trigger" ? null : selection.kind == "task" ? selection.definition == null ? /* @__PURE__ */ jsx("div", {
|
|
36405
|
+
className: "inspector-section section-error",
|
|
36406
|
+
children: t("inspector.task.missing")
|
|
36407
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [isLlm && /* @__PURE__ */ jsx(LlmTaskSection, {
|
|
36408
|
+
selection,
|
|
36409
|
+
disabled,
|
|
36410
|
+
store
|
|
36411
|
+
}), /* @__PURE__ */ jsxs(GeneralSettings, {
|
|
36412
|
+
readOnly,
|
|
36413
|
+
title: isAgent || isDecision ? t("agent.more") : void 0,
|
|
36414
|
+
disabled,
|
|
36415
|
+
node: selection.node,
|
|
36416
|
+
nodeId: selection.id,
|
|
36417
|
+
store,
|
|
36418
|
+
children: [isAgent && /* @__PURE__ */ jsx(AgentAdvancedSettings, {}), isDecision && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
36419
|
+
htmlFor: `${selection.id}-model`,
|
|
36420
|
+
children: t("agent.model")
|
|
36421
|
+
}), /* @__PURE__ */ jsx(Input$1, {
|
|
36422
|
+
id: `${selection.id}-model`,
|
|
36423
|
+
readOnly: true,
|
|
36424
|
+
value: "typesafe/jev"
|
|
36425
|
+
})] })]
|
|
36426
|
+
})] }) : selection.kind == "approval" || selection.kind == "wait" ? /* @__PURE__ */ jsx(ResolutionDefinition, {
|
|
36427
|
+
disabled,
|
|
36428
|
+
selection,
|
|
36429
|
+
store
|
|
36430
|
+
}) : null, selection.kind != "trigger" && selection.kind != "task" && /* @__PURE__ */ jsx(GeneralSettings, {
|
|
36431
|
+
readOnly,
|
|
36432
|
+
disabled,
|
|
36433
|
+
node: selection.node,
|
|
36434
|
+
nodeId: selection.id,
|
|
36435
|
+
store
|
|
36436
|
+
})] })
|
|
33672
36437
|
]
|
|
33673
36438
|
})
|
|
33674
36439
|
});
|
|
@@ -33874,7 +36639,6 @@ function useInspectorPanel({ identity, preferences, selectedNodeIds, onSelectNod
|
|
|
33874
36639
|
//#region src/canvas/browser/stores/node/constants.ts
|
|
33875
36640
|
var NODE_TYPE = /* @__PURE__ */ function(NODE_TYPE) {
|
|
33876
36641
|
NODE_TYPE["TaskNode"] = "task_node";
|
|
33877
|
-
NODE_TYPE["SubflowNode"] = "subflow_node";
|
|
33878
36642
|
NODE_TYPE["ValueNode"] = "value_node";
|
|
33879
36643
|
NODE_TYPE["ConditionNode"] = "condition_node";
|
|
33880
36644
|
NODE_TYPE["CommentNode"] = "comment_node";
|
|
@@ -36643,7 +39407,6 @@ function createNodeEntry(node, contentKey, canvasStore) {
|
|
|
36643
39407
|
const types = {
|
|
36644
39408
|
approval: NODE_TYPE.TaskNode,
|
|
36645
39409
|
condition: NODE_TYPE.ConditionNode,
|
|
36646
|
-
subflow: NODE_TYPE.SubflowNode,
|
|
36647
39410
|
task: NODE_TYPE.TaskNode,
|
|
36648
39411
|
trigger: NODE_TYPE.TriggerNode,
|
|
36649
39412
|
value: NODE_TYPE.ValueNode,
|
|
@@ -48728,16 +51491,14 @@ function CardCollapse({ hidden, children }) {
|
|
|
48728
51491
|
//#region src/canvas/browser/graph/Nodes/components/constants.ts
|
|
48729
51492
|
var defaultNodeIcon = "i-carbon:hexagon-vertical-outline";
|
|
48730
51493
|
var defaultConditionIcon = "i-carbon:child-node";
|
|
48731
|
-
var defaultSubflowIcon = "i-carbon:subflow";
|
|
48732
51494
|
var defaultTriggerIcon = "i-codicon:symbol-event";
|
|
48733
|
-
var iconForNodeType = (nodeType) => nodeType === NODE_TYPE.TaskNode ? "i-carbon:code" : nodeType === NODE_TYPE.ConditionNode ? defaultConditionIcon : nodeType === NODE_TYPE.
|
|
51495
|
+
var iconForNodeType = (nodeType) => nodeType === NODE_TYPE.TaskNode ? "i-carbon:code" : nodeType === NODE_TYPE.ConditionNode ? defaultConditionIcon : nodeType === NODE_TYPE.TriggerNode ? defaultTriggerIcon : defaultNodeIcon;
|
|
48734
51496
|
//#endregion
|
|
48735
51497
|
//#region src/canvas/browser/graph/Nodes/components/CanvasNodeIcon.tsx
|
|
48736
51498
|
function nodeTypeForKind(kind) {
|
|
48737
51499
|
switch (kind) {
|
|
48738
51500
|
case "task": return NODE_TYPE.TaskNode;
|
|
48739
51501
|
case "condition": return NODE_TYPE.ConditionNode;
|
|
48740
|
-
case "subflow": return NODE_TYPE.SubflowNode;
|
|
48741
51502
|
case "trigger": return NODE_TYPE.TriggerNode;
|
|
48742
51503
|
case "comment": return NODE_TYPE.CommentNode;
|
|
48743
51504
|
default: return NODE_TYPE.ValueNode;
|
|
@@ -49407,7 +52168,7 @@ var markdownPreview_module_default = {
|
|
|
49407
52168
|
};
|
|
49408
52169
|
//#endregion
|
|
49409
52170
|
//#region src/canvas/browser/preview/markdownPreview.tsx
|
|
49410
|
-
var MarkdownContent = lazy(() => import("./markdownContent-
|
|
52171
|
+
var MarkdownContent = lazy(() => import("./markdownContent-frwDfQQU.js"));
|
|
49411
52172
|
var MarkdownPreview = /* @__PURE__ */ memo(({ dark, unstyled, components, contentClassName, content, draggable, onDoubleClick }) => {
|
|
49412
52173
|
const [focus, setFocus] = useState(false);
|
|
49413
52174
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -50544,7 +53305,6 @@ var NODE_TYPES = {
|
|
|
50544
53305
|
default: BasicNode,
|
|
50545
53306
|
[NODE_TYPE.TaskNode]: BasicNode,
|
|
50546
53307
|
[NODE_TYPE.ValueNode]: BasicNode,
|
|
50547
|
-
[NODE_TYPE.SubflowNode]: BasicNode,
|
|
50548
53308
|
[NODE_TYPE.ConditionNode]: BasicNode,
|
|
50549
53309
|
[NODE_TYPE.CommentNode]: BasicNode,
|
|
50550
53310
|
[NODE_TYPE.TriggerNode]: BasicNode
|
|
@@ -52173,7 +54933,7 @@ function focusPanel(event) {
|
|
|
52173
54933
|
if (element instanceof Element && element.closest("a, button, input, label, select, textarea, [contenteditable=\"true\"]")) return;
|
|
52174
54934
|
event.currentTarget.focus({ preventScroll: true });
|
|
52175
54935
|
}
|
|
52176
|
-
var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeControl, addNodeOptions, history, disabled, interactiveMode$, focusNodeRequest, inspectorOpen, model, onAddNode, onConnect, onChangeNodeContentHidden, onChangeComment, onCopy, onDeleteEdge, onDeleteNodes, onDuplicate, onMoveNodes, onMoveViewport, onPaste, provideAddNodeOptions, onSelectNodes, onActivateSelection, onSelectionStart, onSelectionEnd, onToggleInspector, ignoredNodeIds, onIgnoreNodes, runControl, cornerLeading, connectionControl, topLeftTools, bottomRightTools, selectedNodeIds,
|
|
54936
|
+
var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeControl, addNodeOptions, history, disabled, interactiveMode$, focusNodeRequest, inspectorOpen, model, onAddNode, onConnect, onChangeNodeContentHidden, onChangeComment, onCopy, onDeleteEdge, onDeleteNodes, onDuplicate, onMoveNodes, onMoveViewport, onPaste, provideAddNodeOptions, onSelectNodes, onActivateSelection, onSelectionStart, onSelectionEnd, onToggleInspector, ignoredNodeIds, onIgnoreNodes, runControl, cornerLeading, connectionControl, topLeftTools, bottomRightTools, selectedNodeIds, theme }, ref) {
|
|
52177
54937
|
const [pickerRequest, setPickerRequest] = useState();
|
|
52178
54938
|
const [pickerCentered, setPickerCentered] = useState(false);
|
|
52179
54939
|
useEffect(() => {
|
|
@@ -52221,16 +54981,6 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52221
54981
|
return source.kind == "condition" || source.kind == "approval" || source.kind == "wait" ? source.outputs.some((port) => "handle" in port && `$branch:${port.handle}` == edge.sourceHandle) : edge.sourceHandle == "$out";
|
|
52222
54982
|
};
|
|
52223
54983
|
}, [model.nodes]);
|
|
52224
|
-
useEffect(() => {
|
|
52225
|
-
setPickerRequest(void 0);
|
|
52226
|
-
setPickerCentered(false);
|
|
52227
|
-
setAddNodeRequest(void 0);
|
|
52228
|
-
setAddItemRequest(void 0);
|
|
52229
|
-
pendingAdd.current?.(void 0);
|
|
52230
|
-
pendingAdd.current = void 0;
|
|
52231
|
-
dynamicOptions.current.clear();
|
|
52232
|
-
draggedNode.current.clear();
|
|
52233
|
-
}, [target?.kind == "subflow" ? target.id : void 0, target?.kind]);
|
|
52234
54984
|
const canvasCenter = () => ({
|
|
52235
54985
|
x: (canvas.current?.clientWidth ?? 184) / 2,
|
|
52236
54986
|
y: (canvas.current?.clientHeight ?? 184) / 2
|
|
@@ -52285,7 +55035,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52285
55035
|
});
|
|
52286
55036
|
};
|
|
52287
55037
|
const manualTrigger = staticOptions.get("trigger:manual");
|
|
52288
|
-
const needsTrigger =
|
|
55038
|
+
const needsTrigger = !model.nodes.some((node) => node.kind == "trigger");
|
|
52289
55039
|
const addRecommended = async (option) => {
|
|
52290
55040
|
if (addingRecommended.current) return;
|
|
52291
55041
|
addingRecommended.current = true;
|
|
@@ -52296,7 +55046,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52296
55046
|
}
|
|
52297
55047
|
};
|
|
52298
55048
|
const keyDown = (event) => {
|
|
52299
|
-
if (disabled
|
|
55049
|
+
if (disabled) return;
|
|
52300
55050
|
if (!(event.target instanceof Node) || !event.currentTarget.contains(event.target)) return;
|
|
52301
55051
|
if (event.target instanceof Element && event.target.closest("[contenteditable=\"true\"], [role=\"dialog\"], .nokey")) return;
|
|
52302
55052
|
if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement || event.target instanceof HTMLSelectElement) return;
|
|
@@ -52336,7 +55086,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52336
55086
|
dark: theme == "dark",
|
|
52337
55087
|
editable: !disabled,
|
|
52338
55088
|
focusNodeRequest: readyFocusNodeRequest,
|
|
52339
|
-
identity:
|
|
55089
|
+
identity: "flow",
|
|
52340
55090
|
interactiveMode$,
|
|
52341
55091
|
isValidConnection,
|
|
52342
55092
|
language,
|
|
@@ -52344,7 +55094,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52344
55094
|
cornerTools: /* @__PURE__ */ jsxs(Fragment$1, { children: [connectionControl, /* @__PURE__ */ jsx(WorkbenchInspectorToggle, {
|
|
52345
55095
|
label: t("designer.toggleInspector"),
|
|
52346
55096
|
open: inspectorOpen,
|
|
52347
|
-
disabled
|
|
55097
|
+
disabled,
|
|
52348
55098
|
onToggle: onToggleInspector
|
|
52349
55099
|
})] }),
|
|
52350
55100
|
cornerLeading,
|
|
@@ -52364,7 +55114,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52364
55114
|
},
|
|
52365
55115
|
addNodeControl,
|
|
52366
55116
|
pickerOpen: pickerRequest != null,
|
|
52367
|
-
disabled
|
|
55117
|
+
disabled,
|
|
52368
55118
|
onOpenNodePicker: openAddNode,
|
|
52369
55119
|
runControl,
|
|
52370
55120
|
onAddTrigger: needsTrigger && model.nodes.length > 0 && manualTrigger != null ? () => void addRecommended(manualTrigger) : void 0
|
|
@@ -52434,7 +55184,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, addNodeC
|
|
|
52434
55184
|
draggedNode.current.clear();
|
|
52435
55185
|
}
|
|
52436
55186
|
}, `${pickerRequest.screenPosition.x}:${pickerRequest.screenPosition.y}`),
|
|
52437
|
-
|
|
55187
|
+
model.nodes.length == 0 && /* @__PURE__ */ jsxs("div", {
|
|
52438
55188
|
className: "canvas-empty",
|
|
52439
55189
|
children: [/* @__PURE__ */ jsxs(Button$1, {
|
|
52440
55190
|
className: "canvas-empty-add",
|
|
@@ -52873,15 +55623,13 @@ function RevisionCanvas({ draft, presentation, theme, interactiveMode$, label, b
|
|
|
52873
55623
|
const t = useTranslate();
|
|
52874
55624
|
const language = useLang();
|
|
52875
55625
|
const revision = useMemo(() => revisionView(draft), [draft]);
|
|
52876
|
-
const
|
|
52877
|
-
const graphId = target.kind === "flow" ? "flow" : `subflow:${target.id}`;
|
|
55626
|
+
const graphId = "flow";
|
|
52878
55627
|
const [sessions, setSessions] = useState({});
|
|
52879
55628
|
const [selected, setSelected] = useState([]);
|
|
52880
55629
|
const [inspectorOpen, setInspectorOpen] = useState(false);
|
|
52881
55630
|
const [focus, setFocus] = useState();
|
|
52882
|
-
const baseline = useMemo(() => designerGraph(draft,
|
|
55631
|
+
const baseline = useMemo(() => designerGraph(draft, presentation?.value, [], {}, {}, t), [
|
|
52883
55632
|
draft,
|
|
52884
|
-
target,
|
|
52885
55633
|
presentation,
|
|
52886
55634
|
t
|
|
52887
55635
|
]);
|
|
@@ -52898,39 +55646,21 @@ function RevisionCanvas({ draft, presentation, theme, interactiveMode$, label, b
|
|
|
52898
55646
|
const position = session?.positions?.[node.id];
|
|
52899
55647
|
return position != null && (position.x !== node.position.x || position.y !== node.position.y);
|
|
52900
55648
|
});
|
|
52901
|
-
const
|
|
52902
|
-
setTarget(next);
|
|
52903
|
-
setSelected([]);
|
|
52904
|
-
setFocus(void 0);
|
|
52905
|
-
};
|
|
52906
|
-
const selection = selected.length === 1 ? revision.node(target, selected[0]) : void 0;
|
|
55649
|
+
const selection = selected.length === 1 ? revision.node(selected[0]) : void 0;
|
|
52907
55650
|
const comment = selected.length === 1 ? model.nodes.find((node) => node.id === selected[0] && node.kind === "comment") : void 0;
|
|
52908
|
-
const navigation =
|
|
52909
|
-
|
|
52910
|
-
|
|
52911
|
-
|
|
52912
|
-
|
|
52913
|
-
|
|
52914
|
-
|
|
52915
|
-
|
|
52916
|
-
|
|
52917
|
-
|
|
52918
|
-
|
|
52919
|
-
|
|
52920
|
-
|
|
52921
|
-
children: t("snapshot.missingLayout")
|
|
52922
|
-
}),
|
|
52923
|
-
moved && /* @__PURE__ */ jsxs(Button$1, {
|
|
52924
|
-
className: "ml-auto",
|
|
52925
|
-
size: "xs",
|
|
52926
|
-
variant: "ghost",
|
|
52927
|
-
onClick: () => setSessions((current) => changeRevisionCanvasSession(current, graphId, { kind: "restore" })),
|
|
52928
|
-
children: [/* @__PURE__ */ jsx("i", {
|
|
52929
|
-
"aria-hidden": "true",
|
|
52930
|
-
className: "i-lucide-light:rotate-ccw"
|
|
52931
|
-
}), t("snapshot.restore")]
|
|
52932
|
-
})
|
|
52933
|
-
] }) : void 0;
|
|
55651
|
+
const navigation = presentation == null || moved ? /* @__PURE__ */ jsxs(Fragment$1, { children: [presentation == null && /* @__PURE__ */ jsx("span", {
|
|
55652
|
+
className: "revision-viewer-hint",
|
|
55653
|
+
children: t("snapshot.missingLayout")
|
|
55654
|
+
}), moved && /* @__PURE__ */ jsxs(Button$1, {
|
|
55655
|
+
className: "ml-auto",
|
|
55656
|
+
size: "xs",
|
|
55657
|
+
variant: "ghost",
|
|
55658
|
+
onClick: () => setSessions((current) => changeRevisionCanvasSession(current, graphId, { kind: "restore" })),
|
|
55659
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
55660
|
+
"aria-hidden": "true",
|
|
55661
|
+
className: "i-lucide-light:rotate-ccw"
|
|
55662
|
+
}), t("snapshot.restore")]
|
|
55663
|
+
})] }) : void 0;
|
|
52934
55664
|
return /* @__PURE__ */ jsxs("section", {
|
|
52935
55665
|
ref: root,
|
|
52936
55666
|
className: `revision-viewer${inspectorOpen ? " inspector-open" : ""}`,
|
|
@@ -52989,19 +55719,14 @@ function RevisionCanvas({ draft, presentation, theme, interactiveMode$, label, b
|
|
|
52989
55719
|
className: "open-flow-property-panel",
|
|
52990
55720
|
theme,
|
|
52991
55721
|
title: selection?.node.name ?? comment?.title ?? t("inspector.title"),
|
|
52992
|
-
icon: comment?.kind === "comment" ? "comment" : inspectorIcon(selection
|
|
55722
|
+
icon: comment?.kind === "comment" ? "comment" : inspectorIcon(selection),
|
|
52993
55723
|
focusOnOpen: true,
|
|
52994
55724
|
onClose: () => setInspectorOpen(false),
|
|
52995
55725
|
children: selection != null ? /* @__PURE__ */ jsx(NodeInspector, {
|
|
52996
55726
|
readOnly: true,
|
|
52997
55727
|
revision,
|
|
52998
55728
|
selection,
|
|
52999
|
-
|
|
53000
|
-
theme,
|
|
53001
|
-
onOpenSubflow: (id) => navigate({
|
|
53002
|
-
kind: "subflow",
|
|
53003
|
-
id
|
|
53004
|
-
})
|
|
55729
|
+
theme
|
|
53005
55730
|
}, `${graphId}:${selection.id}`) : comment?.kind === "comment" ? /* @__PURE__ */ jsx(CommentInspector, {
|
|
53006
55731
|
title: comment.title,
|
|
53007
55732
|
content: comment.content ?? "",
|
|
@@ -53105,7 +55830,7 @@ function PublicationsView({ store, onClose, theme = "light" }) {
|
|
|
53105
55830
|
const language = useLang();
|
|
53106
55831
|
const t = useTranslate();
|
|
53107
55832
|
const busy = useVal(store.$.busy);
|
|
53108
|
-
const flow = useVal(store.workspace.$.
|
|
55833
|
+
const flow = useVal(store.workspace.$.flow);
|
|
53109
55834
|
const live = useVal(store.publications.$.live);
|
|
53110
55835
|
const loadFailed = useVal(store.publications.$.loadFailed);
|
|
53111
55836
|
const loading = useVal(store.publications.$.loading) || !loadFailed && live == null;
|
|
@@ -56304,7 +59029,6 @@ function WorkspaceNavigationIsland({ flowName, flowsHref, ghost = false, onOpenF
|
|
|
56304
59029
|
//#region src/workbench/browser/runtime/shell/workspacePublishIsland.tsx
|
|
56305
59030
|
var blockedReasonKey = {
|
|
56306
59031
|
issues: "workspace.publishIssuesReason",
|
|
56307
|
-
subflow: "workspace.subflowPublishHelp",
|
|
56308
59032
|
busy: "workspace.publishActionInProgress",
|
|
56309
59033
|
publishing: "workspace.publishInProgress"
|
|
56310
59034
|
};
|
|
@@ -56352,41 +59076,41 @@ function WorkspacePublishIsland({ hasPublications, onOpenPublications, onOpenRun
|
|
|
56352
59076
|
})
|
|
56353
59077
|
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
56354
59078
|
align: "end",
|
|
59079
|
+
className: "gap-4 p-0",
|
|
56355
59080
|
container: popupContainer,
|
|
56356
59081
|
initialFocus: cancelButton,
|
|
56357
59082
|
side: "bottom",
|
|
56358
59083
|
sideOffset: 8,
|
|
56359
|
-
children: [
|
|
56360
|
-
|
|
59084
|
+
children: [/* @__PURE__ */ jsxs(PopoverHeader, {
|
|
59085
|
+
className: "gap-2 px-4 pt-4",
|
|
59086
|
+
children: [/* @__PURE__ */ jsx(PopoverTitle, {
|
|
56361
59087
|
className: "m-0 text-sm",
|
|
56362
59088
|
children: t("publication.publishConfirm")
|
|
56363
|
-
}),
|
|
56364
|
-
/* @__PURE__ */ jsx(PopoverDescription, {
|
|
59089
|
+
}), /* @__PURE__ */ jsx(PopoverDescription, {
|
|
56365
59090
|
className: "m-0",
|
|
56366
59091
|
children: t("publication.publishConfirmDescription")
|
|
56367
|
-
})
|
|
56368
|
-
|
|
56369
|
-
|
|
56370
|
-
|
|
56371
|
-
|
|
56372
|
-
|
|
56373
|
-
|
|
56374
|
-
|
|
56375
|
-
|
|
56376
|
-
|
|
56377
|
-
|
|
56378
|
-
|
|
56379
|
-
|
|
56380
|
-
|
|
56381
|
-
|
|
56382
|
-
|
|
56383
|
-
|
|
56384
|
-
|
|
56385
|
-
|
|
56386
|
-
|
|
56387
|
-
|
|
56388
|
-
|
|
56389
|
-
]
|
|
59092
|
+
})]
|
|
59093
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
59094
|
+
className: "flex justify-end gap-2 px-3 pb-3",
|
|
59095
|
+
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
59096
|
+
ref: cancelButton,
|
|
59097
|
+
onClick: () => setConfirming(false),
|
|
59098
|
+
size: "sm",
|
|
59099
|
+
type: "button",
|
|
59100
|
+
variant: "outline",
|
|
59101
|
+
children: t("common.cancel")
|
|
59102
|
+
}), /* @__PURE__ */ jsx(Button$1, {
|
|
59103
|
+
disabled: state != "ready",
|
|
59104
|
+
onClick: () => {
|
|
59105
|
+
if (state != "ready") return;
|
|
59106
|
+
setConfirming(false);
|
|
59107
|
+
onPublish();
|
|
59108
|
+
},
|
|
59109
|
+
size: "sm",
|
|
59110
|
+
type: "button",
|
|
59111
|
+
children: t("publication.confirmPublish")
|
|
59112
|
+
})]
|
|
59113
|
+
})]
|
|
56390
59114
|
})]
|
|
56391
59115
|
}), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(CanvasTooltip, {
|
|
56392
59116
|
getPopupContainer: () => popupContainer ?? document.body,
|
|
@@ -56523,7 +59247,7 @@ function RunDrawerContainer({ onOpenRuns, onClose, onConfigureConnector, open, s
|
|
|
56523
59247
|
submitting: submitting != null
|
|
56524
59248
|
});
|
|
56525
59249
|
}
|
|
56526
|
-
var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus, disabled, revision, selection,
|
|
59250
|
+
var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus, disabled, revision, selection, theme }) {
|
|
56527
59251
|
const t = useTranslate();
|
|
56528
59252
|
const language = useLang();
|
|
56529
59253
|
const variableNames = useVal(store.$.variableNames);
|
|
@@ -56554,11 +59278,11 @@ var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus
|
|
|
56554
59278
|
]);
|
|
56555
59279
|
const triggerCandidates = triggerProviderId == null ? void 0 : store.connectorAccess.allowedTriggerCandidates(triggerProviderId, triggerId);
|
|
56556
59280
|
const allowedCandidates = (providerId == null ? void 0 : accessState.candidates[providerId]?.candidates)?.filter((candidate) => candidate.permissions == null || candidate.permissions.allActions || candidate.permissions.actionIds.includes(connectorAction.actionId));
|
|
56557
|
-
const accessError = providerId != null && connectorAccess?.mode == "selectable" && allowedCandidates?.length == 0 ? t("connectorAccess.noAvailablePermissions") : void 0;
|
|
56558
59281
|
const connectorActionError = useVal(store.connectors.$.selectedActionError);
|
|
56559
59282
|
const connectorActionLoading = useVal(store.connectors.$.actionLoading);
|
|
56560
59283
|
const connectorAuthorizationPending = useVal(store.connectors.$.selectedAuthorizationPending);
|
|
56561
59284
|
const connectorConnection = useVal(store.connectors.$.selectedConnection);
|
|
59285
|
+
const accessError = providerId != null && connectorAccess?.mode == "selectable" && allowedCandidates?.length == 0 && (connectorConnection == null || connectorConnection.status == "active") ? t("connectorAccess.noAvailablePermissions") : void 0;
|
|
56562
59286
|
const connectorConnectionError = useVal(store.connectors.$.selectedConnectionError);
|
|
56563
59287
|
const connectorConnectionLoading = useVal(store.connectors.$.connectionLoading);
|
|
56564
59288
|
const activeConnectorConnections = useVal(store.connectors.$.selectedActiveConnections);
|
|
@@ -56589,7 +59313,7 @@ var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus
|
|
|
56589
59313
|
connectorAccessError: accessError,
|
|
56590
59314
|
connectorActionError,
|
|
56591
59315
|
connectorAuthorizationPending,
|
|
56592
|
-
connectorConnection: connectorAccess?.mode == "selectable" && allowedCandidates != null && !allowedCandidates.some((candidate) => candidate.connectionId == connectorConnection?.connectionId) ? void 0 : connectorConnection,
|
|
59316
|
+
connectorConnection: connectorConnection?.status == "active" && connectorAccess?.mode == "selectable" && allowedCandidates != null && !allowedCandidates.some((candidate) => candidate.connectionId == connectorConnection?.connectionId) ? void 0 : connectorConnection,
|
|
56593
59317
|
connectorConnectionError,
|
|
56594
59318
|
activeConnectorConnections: connectorAccess?.mode == "selectable" && providerId != null ? activeConnectorConnections?.filter((connection) => allowedCandidates?.some((candidate) => candidate.connectionId == connection.connectionId)) : activeConnectorConnections,
|
|
56595
59319
|
connectors: store.connectors,
|
|
@@ -56603,7 +59327,6 @@ var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus
|
|
|
56603
59327
|
selection,
|
|
56604
59328
|
sourceNodeIcons,
|
|
56605
59329
|
store: store.workspace,
|
|
56606
|
-
target,
|
|
56607
59330
|
theme,
|
|
56608
59331
|
triggerActiveConnections: connectorAccess?.mode == "selectable" ? triggerActiveConnections?.filter((connection) => triggerCandidates?.some((candidate) => candidate.connectionId == connection.connectionId)) : triggerActiveConnections,
|
|
56609
59332
|
triggerAuthorizationPending,
|
|
@@ -56639,11 +59362,10 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56639
59362
|
const selectedDesignerNode = useVal(store.$.selectedDesignerNode);
|
|
56640
59363
|
const selection = useVal(store.workspace.$.selection);
|
|
56641
59364
|
const selectedNodeIds = useVal(store.workspace.$.selectedNodeIds);
|
|
56642
|
-
const
|
|
56643
|
-
const
|
|
56644
|
-
const { ignoredNodeIds, onIgnoreNodes } = useIgnoredNodes(`${flowId}:${target?.kind}:${target?.kind == "subflow" ? target.id : ""}`);
|
|
59365
|
+
const initialAddNodeTab = triggers.length == 0 ? "triggers" : "nodes";
|
|
59366
|
+
const { ignoredNodeIds, onIgnoreNodes } = useIgnoredNodes(flowId ?? "");
|
|
56645
59367
|
const panel = useInspectorPanel({
|
|
56646
|
-
identity:
|
|
59368
|
+
identity: flowId ?? "",
|
|
56647
59369
|
preferences: store.preferences,
|
|
56648
59370
|
selectedNodeIds,
|
|
56649
59371
|
onSelectNodes: (ids) => store.selectNodes(ids)
|
|
@@ -56655,14 +59377,10 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56655
59377
|
const [accountReference, setAccountReference] = useState();
|
|
56656
59378
|
useEffect(() => {
|
|
56657
59379
|
if (accountReference == null) return;
|
|
56658
|
-
if (target?.kind != accountReference.target.kind || target?.kind == "subflow" && accountReference.target.kind == "subflow" && target.id != accountReference.target.id) {
|
|
56659
|
-
if (!store.workspace.selectTarget(accountReference.target)) setAccountReference(void 0);
|
|
56660
|
-
return;
|
|
56661
|
-
}
|
|
56662
59380
|
panel.activate([accountReference.nodeId]);
|
|
56663
59381
|
store.workspace.locateNode(accountReference.nodeId, { preserveSelection: true });
|
|
56664
59382
|
setAccountReference(void 0);
|
|
56665
|
-
}, [accountReference
|
|
59383
|
+
}, [accountReference]);
|
|
56666
59384
|
const designerRef = useRef(null);
|
|
56667
59385
|
const accessConfiguration = useVal(store.connectorAccess.$).configuration;
|
|
56668
59386
|
useEffect(() => {
|
|
@@ -56684,11 +59402,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56684
59402
|
setStartId(void 0);
|
|
56685
59403
|
focusInspectorOnOpen.current = false;
|
|
56686
59404
|
opener.current = void 0;
|
|
56687
|
-
}, [
|
|
56688
|
-
flowId,
|
|
56689
|
-
target?.kind == "subflow" ? target.id : void 0,
|
|
56690
|
-
target?.kind
|
|
56691
|
-
]);
|
|
59405
|
+
}, [flowId]);
|
|
56692
59406
|
useEffect(() => {
|
|
56693
59407
|
if (diagnosticFocus == null) return;
|
|
56694
59408
|
focusInspectorOnOpen.current = false;
|
|
@@ -56699,7 +59413,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56699
59413
|
if (selectedDesignerNode?.kind == "trigger") setStartId(selectedDesignerNode.id);
|
|
56700
59414
|
}, [selectedDesignerNode]);
|
|
56701
59415
|
const authoringDisabled = draft == null || history.applying || history.failed || busy != null && busy != "designer" && busy != "run";
|
|
56702
|
-
const publishState = busy == "publish" ? "publishing" : busy != null ? "busy" : diagnostics?.valid == false ? "issues" :
|
|
59416
|
+
const publishState = busy == "publish" ? "publishing" : busy != null ? "busy" : diagnostics?.valid == false ? "issues" : live?.hasUnpublishedChanges == false ? "current" : "ready";
|
|
56703
59417
|
const closeContextPanel = (focusTarget) => {
|
|
56704
59418
|
panel.close();
|
|
56705
59419
|
focusInspectorOnOpen.current = false;
|
|
@@ -56734,11 +59448,11 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56734
59448
|
const focusNode = (nodeId) => {
|
|
56735
59449
|
store.workspace.locateNode(nodeId, { preserveSelection: true });
|
|
56736
59450
|
};
|
|
56737
|
-
const contextPanelVisible = panel.open &&
|
|
59451
|
+
const contextPanelVisible = panel.open && revision != null;
|
|
56738
59452
|
const flowSelected = panel.page == "outline";
|
|
56739
59453
|
const multipleSelected = !flowSelected && selectedNodeIds.length > 1;
|
|
56740
59454
|
const singleSelected = !flowSelected && !multipleSelected;
|
|
56741
|
-
const contextPanelIcon =
|
|
59455
|
+
const contextPanelIcon = flowSelected || multipleSelected ? "flow" : inspectorIcon(selection);
|
|
56742
59456
|
const contextPanelTitle = flowSelected ? t("inspector.outline") : multipleSelected ? t("inspector.multipleSelected", { count: selectedNodeIds.length }) : selectedDesignerNode?.title ?? t("inspector.title");
|
|
56743
59457
|
const historyControls = {
|
|
56744
59458
|
state: history,
|
|
@@ -56748,7 +59462,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56748
59462
|
};
|
|
56749
59463
|
return /* @__PURE__ */ jsxs(CanvasHistoryScope, {
|
|
56750
59464
|
history: historyControls,
|
|
56751
|
-
disabled: authoringDisabled
|
|
59465
|
+
disabled: authoringDisabled,
|
|
56752
59466
|
"aria-label": t("workspace.design"),
|
|
56753
59467
|
className: `editor-grid ${contextPanelVisible ? "" : "context-panel-closed"}`,
|
|
56754
59468
|
id: "workspace-panel-design",
|
|
@@ -56802,7 +59516,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56802
59516
|
history: historyControls,
|
|
56803
59517
|
ignoredNodeIds,
|
|
56804
59518
|
onIgnoreNodes,
|
|
56805
|
-
runControl:
|
|
59519
|
+
runControl: draft != null && selectedTrigger != null ? /* @__PURE__ */ jsx(RunControl, {
|
|
56806
59520
|
disabled: busy != null && busy != "run" && busy != "designer",
|
|
56807
59521
|
inputContent: /* @__PURE__ */ jsx(RunInputPanel, {
|
|
56808
59522
|
onStarted: onRunStarted,
|
|
@@ -56834,12 +59548,12 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56834
59548
|
catalogFailed: triggerCatalogState.error != null,
|
|
56835
59549
|
refreshCatalog: store.retryCatalog,
|
|
56836
59550
|
initialTab: initialAddNodeTab,
|
|
56837
|
-
disabled: authoringDisabled
|
|
59551
|
+
disabled: authoringDisabled,
|
|
56838
59552
|
focusRequest: 0,
|
|
56839
59553
|
onAdd: addFromPicker,
|
|
56840
59554
|
onRegisterDragOption: (option) => designerRef.current?.registerDraggedNode(option),
|
|
56841
59555
|
onDragEnd: () => designerRef.current?.clearDraggedNode()
|
|
56842
|
-
},
|
|
59556
|
+
}, flowId ?? ""),
|
|
56843
59557
|
nodePicker: {
|
|
56844
59558
|
connections,
|
|
56845
59559
|
loadConnections: store.connectors.loadConnections,
|
|
@@ -56877,7 +59591,6 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56877
59591
|
onToggleInspector: toggleInspector,
|
|
56878
59592
|
ref: designerRef,
|
|
56879
59593
|
selectedNodeIds: panel.canvasSelection,
|
|
56880
|
-
target,
|
|
56881
59594
|
theme
|
|
56882
59595
|
}),
|
|
56883
59596
|
contextPanelVisible && /* @__PURE__ */ jsxs(EditorContextPanel, {
|
|
@@ -56892,7 +59605,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56892
59605
|
title: selection.node.name ?? selectedDesignerNode?.title ?? "",
|
|
56893
59606
|
icon: selectedDesignerNode != null && "icon" in selectedDesignerNode ? selectedDesignerNode.icon : void 0,
|
|
56894
59607
|
disabled: authoringDisabled,
|
|
56895
|
-
fallback: /* @__PURE__ */ jsx(Icon, { name: inspectorIcon(selection
|
|
59608
|
+
fallback: /* @__PURE__ */ jsx(Icon, { name: inspectorIcon(selection) }),
|
|
56896
59609
|
onRename: (name) => {
|
|
56897
59610
|
store.workspace.saveNodeTitle(selection.id, name);
|
|
56898
59611
|
},
|
|
@@ -56900,8 +59613,8 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56900
59613
|
store.workspace.saveNodeIcon(selection.id, icon);
|
|
56901
59614
|
},
|
|
56902
59615
|
validate: (name) => {
|
|
56903
|
-
if (revision == null
|
|
56904
|
-
const graph = revision.graph(
|
|
59616
|
+
if (revision == null) return;
|
|
59617
|
+
const graph = revision.graph();
|
|
56905
59618
|
if (graph == null) return;
|
|
56906
59619
|
const issue = nodeNameIssue(graph, selection.id, name);
|
|
56907
59620
|
return issue == null ? void 0 : t(`inspector.node.${issue === "empty" ? "nameEmpty" : "nameDuplicate"}`);
|
|
@@ -56936,7 +59649,7 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56936
59649
|
nodes: designer.nodes,
|
|
56937
59650
|
onFocusNode: focusNode,
|
|
56938
59651
|
onSelect: selectOutlineNode
|
|
56939
|
-
},
|
|
59652
|
+
}, flowId ?? "")
|
|
56940
59653
|
})
|
|
56941
59654
|
}), multipleSelected ? /* @__PURE__ */ jsx(FlowNodeList, {
|
|
56942
59655
|
nodes: designer.nodes.filter((node) => selectedNodeIds.includes(node.id)),
|
|
@@ -56954,7 +59667,6 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
|
|
|
56954
59667
|
disabled: authoringDisabled,
|
|
56955
59668
|
revision,
|
|
56956
59669
|
selection,
|
|
56957
|
-
target,
|
|
56958
59670
|
theme
|
|
56959
59671
|
})]
|
|
56960
59672
|
}),
|