@oomol-lab/open-flow 0.1.0-beta.53 → 0.1.0-beta.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/browser/{createResourceDialog-BsaBMf7_.js → createResourceDialog-4H5_lZ6s.js} +3 -3
  2. package/dist/browser/{main-BPABKzwN.js → dist-BFmpkX4P.js} +9 -1
  3. package/dist/browser/flow-authoring-node.d.ts +5 -0
  4. package/dist/browser/flow-authoring.d.ts +1 -1
  5. package/dist/browser/flow-authoring.js +9434 -9187
  6. package/dist/browser/flow-change.d.ts +6 -1
  7. package/dist/browser/flow-change.js +3108 -141
  8. package/dist/browser/{flowChanges-CcscgZsW.js → flowChanges-ZzG-f9cg.js} +1978 -5437
  9. package/dist/browser/{flowWorkspace-CoT_ewLX.js → flowWorkspace-ChpRaTMX.js} +3197 -310
  10. package/dist/browser/{icons-0s-Q_3lp.js → icons-CdAB9wyS.js} +4294 -54
  11. package/dist/browser/{markdownContent-D3FFc-u_.js → markdownContent-frwDfQQU.js} +1 -2
  12. package/dist/browser/preview.css +375 -322
  13. package/dist/browser/preview.js +5458 -1888
  14. package/dist/browser/theme.css +1 -0
  15. package/dist/browser/ui.css +30 -0
  16. package/dist/browser/ui.js +4 -3
  17. package/dist/browser/workbench.css +375 -322
  18. package/dist/browser/workbench.js +28 -16
  19. package/dist/browser/{workbenchSelect-BqUPacsr.js → workbenchSelect-BRZN4ish.js} +1 -1
  20. package/dist/common/authoringExamples.d.ts +3 -2
  21. package/dist/common/control-api-conformance.js +3410 -3285
  22. package/dist/common/control-api.js +3680 -3531
  23. package/dist/common/control-requests.js +2132 -1860
  24. package/dist/common/decision.d.ts +47 -0
  25. package/dist/common/decision.js +10153 -0
  26. package/dist/common/flow-encoding.js +3105 -124
  27. package/dist/common/flow-semantics.js +276 -2
  28. package/dist/common/integration-trigger.js +202 -1
  29. package/dist/common/mcp.js +3748 -3623
  30. package/dist/common/openapi.js +202 -1
  31. package/dist/common/poll-trigger.js +226 -1
  32. package/dist/common/run-events.js +1 -0
  33. package/dist/common/runtime-contract.d.ts +8 -0
  34. package/dist/common/scheduler.d.ts +1 -1
  35. package/dist/common/scheduler.js +2137 -1936
  36. package/dist/common/webhook-trigger.js +202 -1
  37. package/package.json +5 -1
  38. 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 { $ as useIconifyCollectionLoader, $t as InputGroup, A as calendarDate, An as resolutionOutputPorts, B as mapSource, Bn as inputValue, Bt as followWorkbenchLink, C as editorGroups, Cn as EventSourceSetup, D as isUnconstrainedSchema, E as getDefaultValue, Fn as triggerConfigValue, Ft as securityOptions, G as resourceValue, Gt as PopoverPanelContent, Ht as Popover, I as indexAddNodeOptions, In as triggerConfigValues, It as selectOperation, J as triggerNodeIcon, Jn as Checkbox, Jt as NativeScrollArea, K as designerGraph, Kt as PopoverTitle, L as feishuResourceKind, Ln as variableInputCompatible, Lt as serverAddress, M as datePickerValue, Mt as object, N as isDateFormat, Nn as triggerOutputDefinitions, Nt as openApiFieldIssues, O as typeOfSchema, On as decodeResultList, Pn as isJsonObject, Pt as openApiTask, Q as IconifyProvider, Qt as useTriggerFocusGuards, R as supportsFeishuChatFilter, Rt as servers, S as editorComponent, Sn as FeishuEventPicker, T as valueForEditor, U as observeResource, Ut as PopoverContent, Vt as Switch, W as resourceData, Wt as PopoverDescription, X as providerIcon, Xt as VirtualScrollArea, Y as actionSummary, Yn as IconThemeContext, Yt as ScrollArea, Z as ContentIcon, Zt as Z$2, _n as ko_default$1, an as EmptyHeader, bn as en_default$1, ct as diagnosticMessage, dn as createI18n$1, en as InputGroupAddon, et as useIconifyData, fn as uiLocales, ft as connectionCatalog, gn as ru_default$1, hn as zh_CN_default$1, in as EmptyDescription, it as revisionView, j as datePickerChange, jn as sourceOutputLabel, jt as listOperations, k as calendarChange, ln as SourceForm, lt as diagnosticNodeId, mn as zh_TW_default$1, n as agentTool, nn as Empty, nt as canCancelRun, on as EmptyMedia, pn as waitBranchDescription, q as semanticNodeIcon, qn as controlErrorCode, qt as PopoverTrigger, rn as EmptyContent, rt as hasRunFilter, sn as EmptyTitle, tn as InputGroupInput, un as SourceSelect, ut as schemaMismatchMessage, vn as ja_default$1, w as schemaForEditor, wn as errorNotice, x as defaultValueEditorSchema, xn as I18n, yn as fr_default$1, zt as IdTooltip } from "./flowChanges-CcscgZsW.js";
2
+ import { $ as useIconifyCollectionLoader, $t as useTriggerFocusGuards, A as calendarDate, B as mapSource, Bn as inputValue, Bt as followWorkbenchLink, C as editorGroups, Cn as FeishuEventPicker, D as isUnconstrainedSchema, E as getDefaultValue, Fn as isJsonObject, Ft as securityOptions, G as resourceValue, Gt as PopoverHeader, Ht as Popover, I as indexAddNodeOptions, In as triggerConfigValue, It as selectOperation, J as triggerNodeIcon, Jn as Checkbox, Jt as PopoverTrigger, K as designerGraph, Kt as PopoverPanelContent, L as feishuResourceKind, Ln as triggerConfigValues, Lt as serverAddress, M as datePickerValue, Mn as sourceOutputLabel, Mt as object, N as isDateFormat, Nt as openApiFieldIssues, O as typeOfSchema, Pn as triggerOutputDefinitions, Pt as openApiTask, Q as IconifyProvider, Qt as Z$2, R as supportsFeishuChatFilter, Rt as servers, S as editorComponent, Sn as I18n, T as valueForEditor, Tn as errorNotice, U as observeResource, Ut as PopoverContent, Vt as Switch, W as resourceData, Wt as PopoverDescription, X as providerIcon, Xt as ScrollArea, Y as actionSummary, Yn as IconThemeContext, Yt as NativeScrollArea, Z as ContentIcon, Zt as VirtualScrollArea, _n as ru_default$1, an as EmptyDescription, bn as fr_default$1, cn as EmptyTitle, ct as diagnosticMessage, dn as SourceSelect, en as InputGroup, et as useIconifyData, fn as createI18n$1, ft as connectionCatalog, gn as zh_CN_default$1, hn as zh_TW_default$1, in as EmptyContent, it as revisionView, j as datePickerChange, jn as resolutionOutputPorts, jt as listOperations, k as calendarChange, kn as decodeResultList, lt as diagnosticNodeId, mn as waitBranchDescription, n as agentTool, nn as InputGroupInput, nt as canCancelRun, on as EmptyHeader, pn as uiLocales, q as semanticNodeIcon, qn as controlErrorCode, qt as PopoverTitle, rn as Empty, rt as hasRunFilter, sn as EmptyMedia, tn as InputGroupAddon, un as SourceForm, ut as schemaMismatchMessage, vn as ko_default$1, w as schemaForEditor, wn as EventSourceSetup, x as defaultValueEditorSchema, xn as en_default$1, yn as ja_default$1, zt as IdTooltip } from "./flowChanges-ZzG-f9cg.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 { a as useVal, i as useTranslate, n as useI18n, r as useLang, t as I18nProvider } from "./main-BPABKzwN.js";
5
- import { $r as useRefWithInit, $t as useFocus$1, A as nodeNameIssue, An as Label, At as scrollIntoViewIfNeeded, Bn as getGridCellIndexOfCorner, Br as EMPTY_ARRAY$1, Bt as inertValue, C as FieldError, Cn as ReactStore, Cr as triggerPress, Dn as require_builtin_esm_external_require_react, Dt as VERTICAL_KEYS, En as require_with_selector, Et as MODIFIER_KEYS, Fr as buttonVariants, Ft as InternalBackdrop, G as webhookSupportsBody, Gn as isIndexOutOfListBounds, Gr as useButton, Gt as useOpenInteractionType, H as valueType, Hn as getGridNavigatedIndex, Ht as popupStateMapping, Ir as cn$1, It as useAnchorPositioning, Jn as activeElement, Jr as formatErrorMessage, Jt as useRole, K as dequal, Kn as isListIndexDisabled, Kr as CompositeRootContext, Kt as safePolygon, L as nodeInputMappings, Lr as cva, Lt as adaptiveOrigin, Mt as useAnchoredPopupScrollLock, Nn as useTimeout, Nr as useControlled, Nt as usePositioner, On as createSelector, Or as useBaseUiId, Ot as VERTICAL_KEYS_WITH_EXTRA_KEYS, P as comparisonIssue, Pr as Button$1, Pt as getDisabledMountTransitionStyles, Qn as ownerDocument, Qr as useStableCallback, Qt as useHoverFloatingInteraction, R as operandHandle, Rn as createGridCellMap, Rr as clsx, Rt as useDirection, S as FieldDescription, Sn as addEventListener, St as COMPOSITE_KEYS, T as FieldLabel, Tn as fastComponentRef, Tt as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, U as decodeRevisionContent, Un as getMaxListIndex, Ur as warn, Ut as pressableTriggerOpenStateMapping, V as unaryOperator, Vn as getGridCellIndices, Vr as EMPTY_OBJECT, Vt as getPseudoElementBounds, W as webhookMethods, Wn as getMinListIndex, Wr as useMergedRefs, Wt as triggerOpenStateMapping, Xn as getTarget, Xr as useIsoLayoutEffect, Xt as useInteractions, Yn as contains, Yr as mergeProps, Yt as useListNavigation, Zn as isMac$1, Zr as SafeReact, Zt as useHoverReferenceInteraction, _ as TooltipPortal, _n as FloatingPortal, _t as ARROW_DOWN, a as DialogDescription, an as useOpenStateTransitions, ar as useAnimationsFinished, b as Spinner, bn as POPUP_COLLISION_AVOIDANCE, br as siblingOpen, bt as ARROW_RIGHT, c as DialogTitle, cn as useDismiss, ct as SelectContent, d as TooltipContent, dn as FloatingNode, dr as cancelOpen, dt as SelectSeparator, ei as getParentNode, en as useSyncedFloatingRootContext, er as ChevronDown, f as TooltipProvider, fn as FloatingTree, ft as SelectTrigger, g as TooltipPositioner, gn as FloatingTreeStore, gr as itemPress, gt as ALL_KEYS, h as TooltipPopup, hn as useFloatingTree, hr as imperativeAction, ht as useCompositeListItem, i as DialogContent, in as useImplicitActiveTrigger, ir as useOpenChangeComplete, it as string, jn as Input$1, jt as useToolbarRootContext, kn as useOnFirstRender, kr as useId$1, kt as isNativeInput, l as DialogTrigger, ln as useClick, lt as SelectGroup, m as TooltipArrow, mn as useFloatingParentNodeId, mt as Separator, n as Dialog, ni as isLastTraversableNode, nn as popupStoreSelectors, nr as createLucideIcon, on as useTriggerDataForwarding, or as TransitionStatusDataAttributes, ot as Select$1, p as TooltipTrigger, pn as useFloatingNodeId, pt as SelectValue, qn as stopEvent$1, qr as useCompositeRootContext, qt as useTypeahead, rn as PopupTriggerMap, rr as useTransitionStatus, sn as useTriggerRegistration, sr as transitionStatusMapping, st as SelectChevron, t as Icon, ti as isHTMLElement, tn as createInitialPopupStoreState, tr as Check, u as Tooltip, un as FloatingFocusManager, ur as createChangeEventDetails, ut as SelectItem, v as TooltipTrigger$1, vr as none$1, vt as ARROW_KEYS, w as FieldGroup, wn as fastComponent, wt as HORIZONTAL_KEYS, x as Field, xn as FocusGuard, xt as ARROW_UP, y as TooltipRoot, yn as DROPDOWN_COLLISION_AVOIDANCE, yt as ARROW_LEFT, z as operatorsForType, zn as findNonDisabledListIndex, zr as useRenderElement, zt as CompositeList } from "./icons-0s-Q_3lp.js";
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-CdAB9wyS.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-BqUPacsr.js";
8
+ import { t as WorkbenchSelect } from "./workbenchSelect-BRZN4ish.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$1 = {
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$1
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-base 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 md:text-sm 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),
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-D3FFc-u_.js"));
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";
@@ -5594,6 +5595,7 @@ function ContextPanel({ className, layoutRoot, children, focusOnOpen, actions, h
5594
5595
  const current = panel.current;
5595
5596
  if (current == null || !(event.target instanceof Node) || !current.contains(event.target)) return;
5596
5597
  if (event.key == "Escape") {
5598
+ if (event.target instanceof Element && event.target.closest("[data-popup-open]") != null) return;
5597
5599
  event.preventDefault();
5598
5600
  event.stopPropagation();
5599
5601
  onClose();
@@ -7162,44 +7164,44 @@ function FlowNodeList({ nodes, onFocusNode, onSelect, groupTriggers = false }) {
7162
7164
  });
7163
7165
  }
7164
7166
  var valueEditor_module_default = {
7165
- root: "valueEditor_root_d4b23",
7166
- errorAnchor: "valueEditor_errorAnchor_d4b23",
7167
- valueTools: "valueEditor_valueTools_d4b23",
7168
- body: "valueEditor_body_d4b23",
7169
- options: "valueEditor_options_d4b23",
7170
- toolbar: "valueEditor_toolbar_d4b23",
7171
- presence: "valueEditor_presence_d4b23",
7172
- actions: "valueEditor_actions_d4b23",
7173
- collection: "valueEditor_collection_d4b23",
7174
- fieldName: "valueEditor_fieldName_d4b23",
7175
- fieldType: "valueEditor_fieldType_d4b23",
7176
- json: "valueEditor_json_d4b23",
7177
- description: "valueEditor_description_d4b23",
7178
- error: "valueEditor_error_d4b23",
7179
- summary: "valueEditor_summary_d4b23",
7180
- summaryError: "valueEditor_summaryError_d4b23",
7181
- srOnly: "valueEditor_srOnly_d4b23",
7182
- option: "valueEditor_option_d4b23",
7183
- header: "valueEditor_header_d4b23",
7184
- leadingControl: "valueEditor_leadingControl_d4b23",
7185
- toggleControl: "valueEditor_toggleControl_d4b23",
7186
- valueAddon: "valueEditor_valueAddon_d4b23",
7187
- summaryText: "valueEditor_summaryText_d4b23",
7188
- clearValue: "valueEditor_clearValue_d4b23",
7189
- resetValue: "valueEditor_resetValue_d4b23",
7190
- unsetValue: "valueEditor_unsetValue_d4b23",
7191
- arrayIndex: "valueEditor_arrayIndex_d4b23",
7192
- nullValue: "valueEditor_nullValue_d4b23",
7193
- nullChip: "valueEditor_nullChip_d4b23",
7194
- collectionActions: "valueEditor_collectionActions_d4b23",
7195
- emptyObjectContent: "valueEditor_emptyObjectContent_d4b23",
7196
- emptyObjectConstraint: "valueEditor_emptyObjectConstraint_d4b23",
7197
- jsonCode: "valueEditor_jsonCode_d4b23",
7198
- emptyString: "valueEditor_emptyString_d4b23",
7199
- booleanControl: "valueEditor_booleanControl_d4b23",
7200
- booleanIndicator: "valueEditor_booleanIndicator_d4b23",
7201
- objectNotice: "valueEditor_objectNotice_d4b23",
7202
- valuePrefix: "valueEditor_valuePrefix_d4b23"
7167
+ root: "valueEditor_root_fd302",
7168
+ errorAnchor: "valueEditor_errorAnchor_fd302",
7169
+ body: "valueEditor_body_fd302",
7170
+ valueTools: "valueEditor_valueTools_fd302",
7171
+ options: "valueEditor_options_fd302",
7172
+ toolbar: "valueEditor_toolbar_fd302",
7173
+ presence: "valueEditor_presence_fd302",
7174
+ actions: "valueEditor_actions_fd302",
7175
+ collection: "valueEditor_collection_fd302",
7176
+ fieldName: "valueEditor_fieldName_fd302",
7177
+ fieldType: "valueEditor_fieldType_fd302",
7178
+ json: "valueEditor_json_fd302",
7179
+ description: "valueEditor_description_fd302",
7180
+ error: "valueEditor_error_fd302",
7181
+ summary: "valueEditor_summary_fd302",
7182
+ summaryError: "valueEditor_summaryError_fd302",
7183
+ srOnly: "valueEditor_srOnly_fd302",
7184
+ option: "valueEditor_option_fd302",
7185
+ header: "valueEditor_header_fd302",
7186
+ leadingControl: "valueEditor_leadingControl_fd302",
7187
+ toggleControl: "valueEditor_toggleControl_fd302",
7188
+ valueAddon: "valueEditor_valueAddon_fd302",
7189
+ summaryText: "valueEditor_summaryText_fd302",
7190
+ clearValue: "valueEditor_clearValue_fd302",
7191
+ resetValue: "valueEditor_resetValue_fd302",
7192
+ unsetValue: "valueEditor_unsetValue_fd302",
7193
+ arrayIndex: "valueEditor_arrayIndex_fd302",
7194
+ nullValue: "valueEditor_nullValue_fd302",
7195
+ nullChip: "valueEditor_nullChip_fd302",
7196
+ collectionActions: "valueEditor_collectionActions_fd302",
7197
+ emptyObjectContent: "valueEditor_emptyObjectContent_fd302",
7198
+ emptyObjectConstraint: "valueEditor_emptyObjectConstraint_fd302",
7199
+ jsonCode: "valueEditor_jsonCode_fd302",
7200
+ emptyString: "valueEditor_emptyString_fd302",
7201
+ booleanControl: "valueEditor_booleanControl_fd302",
7202
+ booleanIndicator: "valueEditor_booleanIndicator_fd302",
7203
+ objectNotice: "valueEditor_objectNotice_fd302",
7204
+ valuePrefix: "valueEditor_valuePrefix_fd302"
7203
7205
  };
7204
7206
  //#endregion
7205
7207
  //#region src/form/browser/fieldControl.tsx
@@ -7236,41 +7238,6 @@ function ValueControl({ addon, children }) {
7236
7238
  }
7237
7239
  //#endregion
7238
7240
  //#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
7241
  function agentFixedValuesValid(config, notificationInputs = []) {
7275
7242
  if (config.kind !== "agent") return true;
7276
7243
  const values = config.tools.flatMap((tool) => tool.inputs.map((port) => ({
@@ -9475,13 +9442,14 @@ function FieldLayout({ children, depth = 0, layout = "values", columns, gap }) {
9475
9442
  children
9476
9443
  });
9477
9444
  }
9478
- var FieldRow = forwardRef(({ columns, gap, header, leadingControl, disclosureContent, trailingControl, actions, layout, depth, typeWidth, disclosure, label, sorting, disclosureInvalid, children, style, className, ...props }, ref) => {
9445
+ 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
9446
  const geometry = useContext(Geometry);
9480
9447
  const level = depth ?? geometry.depth;
9481
9448
  return /* @__PURE__ */ jsxs("div", {
9482
9449
  ...props,
9483
9450
  ref,
9484
9451
  className: [valueEditor_module_default.root, className].filter(Boolean).join(" "),
9452
+ "data-stacking": stacking,
9485
9453
  "data-layout": layout ?? geometry.layout,
9486
9454
  "data-header": header != null || void 0,
9487
9455
  "data-nested-field": level > 0 || void 0,
@@ -9559,6 +9527,25 @@ function FieldTypeAddon({ schema, name, menuTitle, disabled, onChange }) {
9559
9527
  });
9560
9528
  }
9561
9529
  //#endregion
9530
+ //#region src/form/browser/fieldValuePreview.tsx
9531
+ /** Shared compact preview for expandable text and structured values. */
9532
+ function FieldValuePreview({ children, empty, trailing, className, ...props }) {
9533
+ return /* @__PURE__ */ jsxs(Button$1, {
9534
+ type: "button",
9535
+ variant: "disclosure",
9536
+ size: "field",
9537
+ className: cn$1(valueEditor_module_default.summary, className),
9538
+ "data-value-preview": true,
9539
+ "data-field-control": true,
9540
+ ...props,
9541
+ children: [/* @__PURE__ */ jsx("span", {
9542
+ className: valueEditor_module_default.summaryText,
9543
+ "data-empty-string": empty || void 0,
9544
+ children
9545
+ }), trailing]
9546
+ });
9547
+ }
9548
+ //#endregion
9562
9549
  //#region src/ui/browser/code-editor.ts
9563
9550
  var completionIcons = /* @__PURE__ */ new Map([
9564
9551
  ["class", "i-codicon:symbol-class"],
@@ -22293,30 +22280,22 @@ function FieldValueEditor(suppliedProps) {
22293
22280
  "data-value-addon-control": true,
22294
22281
  children: startAddon
22295
22282
  }),
22296
- compactValue && expandable && /* @__PURE__ */ jsxs(Button$1, {
22297
- type: "button",
22298
- variant: "disclosure",
22299
- size: "field",
22300
- className: valueEditor_module_default.summary,
22301
- "data-value-preview": true,
22283
+ compactValue && expandable && /* @__PURE__ */ jsx(FieldValuePreview, {
22284
+ empty: value === "",
22302
22285
  hidden: inlineExpansion && hasExpandedContent && expanded,
22303
22286
  "data-field-prompt": summaryInvalid || void 0,
22304
22287
  "data-readonly": disabled || void 0,
22305
- "data-field-control": true,
22306
22288
  disabled: sorting || !hasExpandedContent && !createValue || needsCreation && !createValue,
22307
22289
  "aria-label": `${label} ${t("valueEditor.setValue")}`,
22308
22290
  "aria-expanded": needsCreation || !hasExpandedContent ? void 0 : expanded,
22309
22291
  "aria-invalid": summaryInvalid,
22310
22292
  "aria-controls": `${id}-body`,
22293
+ trailing: !inlineExpansion && props.header == null && hasExpandedContent && !needsCreation ? /* @__PURE__ */ jsx(SelectChevron, { className: expanded ? "rotate-180" : void 0 }) : void 0,
22311
22294
  onClick: needsCreation ? () => {
22312
22295
  createValue?.();
22313
22296
  setExpanded(true);
22314
22297
  } : toggleExpanded,
22315
- children: [/* @__PURE__ */ jsx("span", {
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 })]
22298
+ 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
22299
  }),
22321
22300
  (!expandable || inlineExpansion) && body,
22322
22301
  /* @__PURE__ */ jsx(ValueTools, {
@@ -22800,6 +22779,45 @@ function PromptEditor({ ariaDescribedBy, invalid, value, inputs, disabled, theme
22800
22779
  });
22801
22780
  }
22802
22781
  //#endregion
22782
+ //#region src/workbench/browser/runtime/editor/taskExecutorChanges.ts
22783
+ var TaskExecutorChanges = class {
22784
+ #saved;
22785
+ #pending = [];
22786
+ #running;
22787
+ #write;
22788
+ constructor(value, write) {
22789
+ this.value = value;
22790
+ this.#saved = value;
22791
+ this.#write = write;
22792
+ }
22793
+ sync(value) {
22794
+ if (this.#running != null || this.#pending.length > 0 || !dequal(this.value, this.#saved)) return;
22795
+ this.value = value;
22796
+ this.#saved = value;
22797
+ }
22798
+ save(metadata) {
22799
+ if (!dequal(this.value, this.#pending.at(-1)?.value ?? this.#saved)) this.#pending.push({
22800
+ value: this.value,
22801
+ metadata
22802
+ });
22803
+ if (this.#pending.length === 0) return Promise.resolve(true);
22804
+ if (this.#running != null) return this.#running;
22805
+ this.#running = this.#flush().finally(() => {
22806
+ this.#running = void 0;
22807
+ });
22808
+ return this.#running;
22809
+ }
22810
+ async #flush() {
22811
+ while (this.#pending.length > 0) {
22812
+ const { value, metadata } = this.#pending[0];
22813
+ if (!await this.#write(this.#saved, value, metadata)) return false;
22814
+ this.#saved = value;
22815
+ this.#pending.shift();
22816
+ }
22817
+ return true;
22818
+ }
22819
+ };
22820
+ //#endregion
22803
22821
  //#region src/workbench/browser/runtime/editor/agentSettings.tsx
22804
22822
  var AgentSettingsContext = createContext(null);
22805
22823
  function AgentPrompt() {
@@ -22813,7 +22831,7 @@ function EditableAgentSettingsProvider({ children, task, nodeId, store, connecto
22813
22831
  const [config, renderConfig] = useState(task.executor);
22814
22832
  const [saveError, setSaveError] = useState();
22815
22833
  const [flowId] = useState(store.$.flowId.value);
22816
- const [changes] = useState(() => new AgentChanges(task.executor, async (before, value) => {
22834
+ const [changes] = useState(() => new TaskExecutorChanges(task.executor, async (before, value) => {
22817
22835
  if (store.$.flowId.value != flowId) return false;
22818
22836
  const current = store.$.revision.value?.node({ kind: "flow" }, nodeId);
22819
22837
  const definition = current?.kind == "task" ? current.definition : void 0;
@@ -23046,6 +23064,55 @@ function AgentSettingsProvider(props) {
23046
23064
  }
23047
23065
  //#endregion
23048
23066
  //#region src/workbench/browser/runtime/editor/builtInOutputPresentation.ts
23067
+ /** Localized answer help is presentation-only; persisted Decision schemas stay language-neutral. */
23068
+ function presentDecisionOutputs(task, t) {
23069
+ if (!("executor" in task) || task.executor.kind !== "decision") return task.outputs;
23070
+ const questions = new Map(task.executor.questions.map((question) => [question.name, question]));
23071
+ return task.outputs.map((port) => {
23072
+ if (!("handle" in port)) return port;
23073
+ const question = questions.get(port.handle);
23074
+ const schema = schemaObject(port.jsonSchema);
23075
+ if (question == null || schema == null) return port;
23076
+ const properties = Object.fromEntries(Object.entries(schemaObject(schema.properties ?? null) ?? {}).map(([name, value]) => {
23077
+ const field = schemaObject(value);
23078
+ if (field == null) return [name, value];
23079
+ let description;
23080
+ switch (name) {
23081
+ case "type":
23082
+ description = t("decision.outputs.type", { type: question.type });
23083
+ break;
23084
+ case "noul":
23085
+ case "choice":
23086
+ case "score":
23087
+ case "confidence":
23088
+ case "legend":
23089
+ description = t(`decision.outputs.${name}`);
23090
+ break;
23091
+ case "probabilities":
23092
+ description = t(`decision.outputs.${question.type}Probabilities`);
23093
+ break;
23094
+ default: return [name, value];
23095
+ }
23096
+ const children = schemaObject(field.properties ?? null);
23097
+ return [name, {
23098
+ ...field,
23099
+ description,
23100
+ ...children == null ? {} : { properties: Object.fromEntries(Object.entries(children).map(([key, child]) => [key, {
23101
+ ...schemaObject(child),
23102
+ description: name === "legend" ? t("decision.outputs.level", { level: key }) : question.type === "choice" ? t("decision.outputs.choiceProbability", { name: key }) : t("decision.outputs.scoreProbability", { level: key })
23103
+ }])) }
23104
+ }];
23105
+ }));
23106
+ return {
23107
+ ...port,
23108
+ description: t("decision.outputs.answer", { type: t(`decision.${question.type}`) }),
23109
+ jsonSchema: {
23110
+ ...schema,
23111
+ properties
23112
+ }
23113
+ };
23114
+ });
23115
+ }
23049
23116
  function withDescriptions$1(ports, descriptionFor) {
23050
23117
  return ports.map((port) => {
23051
23118
  const description = descriptionFor(port.handle);
@@ -25949,6 +26016,2892 @@ function ConditionBranchesEditor({ value: configuration, disabled, readOnly, onC
25949
26016
  })]
25950
26017
  });
25951
26018
  }
26019
+ var fieldTable_module_default = {
26020
+ list: "fieldTable_list_58822",
26021
+ columns: "fieldTable_columns_58822",
26022
+ nameHeading: "fieldTable_nameHeading_58822",
26023
+ typeHeading: "fieldTable_typeHeading_58822",
26024
+ valueHeading: "fieldTable_valueHeading_58822",
26025
+ row: "fieldTable_row_58822",
26026
+ nullableControl: "fieldTable_nullableControl_58822",
26027
+ nullableHeading: "fieldTable_nullableHeading_58822"
26028
+ };
26029
+ //#endregion
26030
+ //#region src/form/browser/fieldTable.tsx
26031
+ /** Shared field geometry. Callers own definitions, values, actions and persistence. */
26032
+ var FieldTable = forwardRef(({ layout = "definition", fixedTypes, typeColumn = true, output, nullable, empty, actionSlots = 1, className, children, ...props }, ref) => {
26033
+ const t = useTranslate();
26034
+ return /* @__PURE__ */ jsxs("div", {
26035
+ ...props,
26036
+ ref,
26037
+ className: [fieldTable_module_default.list, className].filter(Boolean).join(" "),
26038
+ "data-value-editor-scope": true,
26039
+ "data-layout": layout,
26040
+ "data-type-column": typeColumn || void 0,
26041
+ "data-output": output || void 0,
26042
+ "data-fixed-types": fixedTypes || void 0,
26043
+ "data-nullable": nullable || void 0,
26044
+ "data-empty": empty || void 0,
26045
+ "data-action-slots": actionSlots,
26046
+ children: [!empty && /* @__PURE__ */ jsxs("div", {
26047
+ className: fieldTable_module_default.columns,
26048
+ "data-layout": layout,
26049
+ "data-output": output || void 0,
26050
+ children: [
26051
+ /* @__PURE__ */ jsx("span", {
26052
+ className: fieldTable_module_default.nameHeading,
26053
+ children: t("valueEditor.columnName")
26054
+ }),
26055
+ typeColumn && /* @__PURE__ */ jsx("span", {
26056
+ className: fieldTable_module_default.typeHeading,
26057
+ children: t("valueEditor.columnType")
26058
+ }),
26059
+ !output && /* @__PURE__ */ jsx("span", {
26060
+ className: fieldTable_module_default.valueHeading,
26061
+ children: t("valueEditor.columnValue")
26062
+ }),
26063
+ nullable && /* @__PURE__ */ jsx("span", {
26064
+ className: fieldTable_module_default.nullableHeading,
26065
+ children: t("valueEditor.nullable")
26066
+ })
26067
+ ]
26068
+ }), /* @__PURE__ */ jsx(FieldLayout, {
26069
+ layout,
26070
+ children
26071
+ })]
26072
+ });
26073
+ });
26074
+ function FieldTableRow({ className, ...props }) {
26075
+ return /* @__PURE__ */ jsx("div", {
26076
+ ...props,
26077
+ className: [fieldTable_module_default.row, className].filter(Boolean).join(" ")
26078
+ });
26079
+ }
26080
+ function FieldNullable({ name, checked, onChange }) {
26081
+ const t = useTranslate();
26082
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
26083
+ render: /* @__PURE__ */ jsx("span", { className: fieldTable_module_default.nullableControl }),
26084
+ children: /* @__PURE__ */ jsx(Checkbox, {
26085
+ className: "not-data-disabled:cursor-pointer",
26086
+ "aria-label": `${name} ${t("valueEditor.nullable")}`,
26087
+ "aria-checked": checked,
26088
+ checked,
26089
+ indeterminate: !onChange && !checked,
26090
+ disabled: !onChange,
26091
+ onCheckedChange: (next) => onChange?.(next === true)
26092
+ })
26093
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: t(checked ? "valueEditor.nullableDescription" : "valueEditor.notNullableDescription") })] });
26094
+ }
26095
+ //#endregion
26096
+ //#region src/ui/browser/helpButton.tsx
26097
+ /** Supplementary, non-interactive help that can also be opened by click. */
26098
+ function HelpButton({ label, children, size = 24 }) {
26099
+ const id = useId();
26100
+ const [tooltip] = useState(() => createTooltipHandle());
26101
+ return /* @__PURE__ */ jsxs(Tooltip, {
26102
+ handle: tooltip,
26103
+ children: [/* @__PURE__ */ jsx(TooltipTrigger, {
26104
+ id,
26105
+ handle: tooltip,
26106
+ closeOnClick: false,
26107
+ onClick: () => tooltip.open(id),
26108
+ render: /* @__PURE__ */ jsx(Button$1, {
26109
+ type: "button",
26110
+ variant: "ghost",
26111
+ size: "icon-xs",
26112
+ style: {
26113
+ width: size,
26114
+ height: size
26115
+ },
26116
+ "aria-label": label
26117
+ }),
26118
+ children: /* @__PURE__ */ jsx("i", {
26119
+ "aria-hidden": "true",
26120
+ className: "i-lucide-light:info text-muted-foreground",
26121
+ style: { fontSize: size * 5 / 8 }
26122
+ })
26123
+ }), /* @__PURE__ */ jsx(TooltipContent, { children })]
26124
+ });
26125
+ }
26126
+ //#endregion
26127
+ //#region src/workbench/browser/runtime/editor/inspectorSection.tsx
26128
+ function InspectorSection({ title, children, className, contentInset = true, ...props }) {
26129
+ return /* @__PURE__ */ jsxs("section", {
26130
+ className: cn$1("inspector-section inspector-titled-section", className),
26131
+ ...props,
26132
+ children: [/* @__PURE__ */ jsx("h3", {
26133
+ className: "inspector-section-title",
26134
+ children: title
26135
+ }), /* @__PURE__ */ jsx("div", {
26136
+ className: "inspector-section-content",
26137
+ "data-inset": contentInset || void 0,
26138
+ children
26139
+ })]
26140
+ });
26141
+ }
26142
+ //#endregion
26143
+ //#region src/workbench/browser/runtime/editor/decisionSection.tsx
26144
+ var textSchema = {
26145
+ type: "string",
26146
+ minLength: 1,
26147
+ pattern: "\\S"
26148
+ };
26149
+ var instructionSchema = {
26150
+ ...textSchema,
26151
+ "ui:widget": "text"
26152
+ };
26153
+ var nameSchema = (names) => ({
26154
+ ...textSchema,
26155
+ not: { enum: ["__proto__", ...names] }
26156
+ });
26157
+ /** Shared value controls keep drafts until the current asynchronous validation allows a commit. */
26158
+ function DecisionField({ label, schema, value, disabled, onCommit, inline = false, placeholder }) {
26159
+ const id = useId();
26160
+ const [draft, setDraft] = useState(value);
26161
+ const current = useRef(draft);
26162
+ const saved = useRef(value);
26163
+ const request = useRef();
26164
+ const [invalid, setInvalid] = useState(false);
26165
+ const t = useTranslate();
26166
+ useEffect(() => {
26167
+ if (dequal(saved.current, value)) return;
26168
+ saved.current = value;
26169
+ request.current?.abort();
26170
+ current.current = value;
26171
+ setDraft(value);
26172
+ setInvalid(false);
26173
+ }, [value]);
26174
+ useEffect(() => {
26175
+ request.current?.abort();
26176
+ const controller = new AbortController();
26177
+ request.current = controller;
26178
+ const candidate = current.current;
26179
+ Promise.resolve().then(() => {
26180
+ if (controller.signal.aborted || current.current !== candidate) return;
26181
+ setInvalid(!matchesSchema(candidate, schema));
26182
+ });
26183
+ return () => controller.abort();
26184
+ }, [
26185
+ schema,
26186
+ disabled,
26187
+ value
26188
+ ]);
26189
+ useEffect(() => () => request.current?.abort(), []);
26190
+ async function commit() {
26191
+ request.current?.abort();
26192
+ const controller = new AbortController();
26193
+ request.current = controller;
26194
+ const candidate = current.current;
26195
+ await Promise.resolve();
26196
+ if (controller.signal.aborted) return;
26197
+ const valid = matchesSchema(candidate, schema);
26198
+ if (controller.signal.aborted || current.current !== candidate) return;
26199
+ setInvalid(!valid);
26200
+ if (valid && !disabled && !dequal(candidate, value)) onCommit(candidate);
26201
+ }
26202
+ const change = (next) => {
26203
+ request.current?.abort();
26204
+ current.current = next;
26205
+ setDraft(next);
26206
+ setInvalid(false);
26207
+ };
26208
+ const multiline = schema["ui:widget"] === "text";
26209
+ return /* @__PURE__ */ jsxs(Field, {
26210
+ className: "gap-1.5",
26211
+ onBlur: () => void commit(),
26212
+ onKeyDown: (event) => {
26213
+ if (event.key === "Enter" && event.target instanceof HTMLInputElement) commit();
26214
+ },
26215
+ children: [!inline && /* @__PURE__ */ jsx(FieldLabel, {
26216
+ className: "text-xs font-normal leading-4",
26217
+ htmlFor: id,
26218
+ children: label
26219
+ }), /* @__PURE__ */ jsx(ValueEditorFeedback, {
26220
+ error: invalid ? t("decision.invalidValue") : void 0,
26221
+ children: (errorId) => multiline ? /* @__PURE__ */ jsx(Textarea, {
26222
+ id,
26223
+ rows: 2,
26224
+ placeholder,
26225
+ "aria-label": label,
26226
+ "aria-describedby": errorId,
26227
+ "aria-invalid": invalid,
26228
+ readOnly: disabled,
26229
+ value: draft,
26230
+ onChange: (event) => change(event.target.value)
26231
+ }) : /* @__PURE__ */ jsx(Input$1, {
26232
+ id,
26233
+ controlSize: "field",
26234
+ placeholder,
26235
+ "aria-label": label,
26236
+ "aria-describedby": errorId,
26237
+ "aria-invalid": invalid,
26238
+ readOnly: disabled,
26239
+ value: draft,
26240
+ onChange: (event) => change(event.target.value)
26241
+ })
26242
+ })]
26243
+ });
26244
+ }
26245
+ function DecisionSection({ task, disabled, onSave }) {
26246
+ const t = useTranslate();
26247
+ const saveRef = useRef(onSave);
26248
+ saveRef.current = onSave;
26249
+ const taskRef = useRef(task);
26250
+ taskRef.current = task;
26251
+ const [changes] = useState(() => new TaskExecutorChanges(task.executor, async (before, next, deletion) => {
26252
+ if (before.kind !== "decision" || next.kind !== "decision") return false;
26253
+ return saveRef.current(dequal(before, taskRef.current.executor) ? taskRef.current : decisionTask(before.questions, taskRef.current.name), decisionTask(next.questions, taskRef.current.name), deletion);
26254
+ }));
26255
+ const [config, setConfig] = useState(changes.value);
26256
+ const [saveError, setSaveError] = useState(false);
26257
+ const questionId = useId();
26258
+ const [open, setOpen] = useState(() => new Set(config.kind === "decision" ? decisionQuestionIssues(config.questions).flatMap((issue) => issue.question == null ? [] : [issue.question]) : []));
26259
+ useEffect(() => {
26260
+ changes.sync(task.executor);
26261
+ setConfig(changes.value);
26262
+ }, [changes, task.executor]);
26263
+ if (config.kind !== "decision") return null;
26264
+ const questions = limitDecisionQuestions(config.questions);
26265
+ async function update(next, removed) {
26266
+ if (disabled) return;
26267
+ changes.value = {
26268
+ kind: "decision",
26269
+ questions: next
26270
+ };
26271
+ setConfig(changes.value);
26272
+ try {
26273
+ setSaveError(!await changes.save(removed));
26274
+ } catch {
26275
+ setSaveError(true);
26276
+ }
26277
+ }
26278
+ function edit(index, question, removed) {
26279
+ if (changes.value.kind !== "decision") return;
26280
+ update(limitDecisionQuestions(changes.value.questions).map((item, i) => i === index ? question : item), removed);
26281
+ }
26282
+ function add(after = questions.length - 1) {
26283
+ let name = defaultDecisionQuestion().name;
26284
+ let suffix = 2;
26285
+ while (questions.some((question) => question.name === name)) name = `decision${suffix++}`;
26286
+ const index = after + 1;
26287
+ setOpen(new Set([...open].map((i) => i >= index ? i + 1 : i).concat(index)));
26288
+ update(questions.toSpliced(index, 0, defaultDecisionQuestion(name)));
26289
+ }
26290
+ return /* @__PURE__ */ jsxs(InspectorSection, {
26291
+ title: t("decision.questions"),
26292
+ contentInset: false,
26293
+ "data-inspector-section": "task",
26294
+ children: [/* @__PURE__ */ jsxs(FieldTable, {
26295
+ layout: "ports",
26296
+ output: true,
26297
+ actionSlots: 2,
26298
+ empty: !questions.length,
26299
+ children: [/* @__PURE__ */ jsx(ArrayFieldList, {
26300
+ values: questions,
26301
+ label: t("decision.questions"),
26302
+ children: (_entry, index) => {
26303
+ const question = questions[index];
26304
+ const bodyId = `${questionId}-${index}`;
26305
+ return /* @__PURE__ */ jsxs(FieldRow, {
26306
+ stacking: "fields",
26307
+ label: question.name,
26308
+ "data-output": true,
26309
+ "data-object-child": true,
26310
+ "data-expansion": "branch",
26311
+ disclosure: {
26312
+ controls: question.type === "noul" ? bodyId : `${bodyId} ${bodyId}-criteria`,
26313
+ expanded: open.has(index),
26314
+ onToggle: () => setOpen((previous) => {
26315
+ const next = new Set(previous);
26316
+ if (next.has(index)) next.delete(index);
26317
+ else next.add(index);
26318
+ return next;
26319
+ })
26320
+ },
26321
+ header: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FieldName, {
26322
+ name: question.name,
26323
+ children: /* @__PURE__ */ jsx(DecisionField, {
26324
+ inline: true,
26325
+ label: t("decision.name"),
26326
+ schema: nameSchema(questions.filter((_, i) => i !== index).map((item) => item.name)),
26327
+ value: question.name,
26328
+ disabled,
26329
+ onCommit: (name) => edit(index, {
26330
+ ...question,
26331
+ name
26332
+ })
26333
+ })
26334
+ }), /* @__PURE__ */ jsx("div", {
26335
+ "data-field-type": true,
26336
+ children: /* @__PURE__ */ jsx(FieldSelect, {
26337
+ "aria-label": `${question.name} ${t("decision.type")}`,
26338
+ value: question.type,
26339
+ disabled,
26340
+ readOnly: disabled,
26341
+ onChange: (type) => {
26342
+ setOpen((previous) => new Set(previous).add(index));
26343
+ const base = {
26344
+ name: question.name,
26345
+ instructions: question.instructions
26346
+ };
26347
+ if (type === "noul") edit(index, {
26348
+ ...base,
26349
+ type
26350
+ });
26351
+ if (type === "choice") edit(index, {
26352
+ ...base,
26353
+ type,
26354
+ criteria: []
26355
+ });
26356
+ if (type === "score") edit(index, {
26357
+ ...base,
26358
+ type,
26359
+ criteria: ["", ""]
26360
+ });
26361
+ },
26362
+ children: [
26363
+ "noul",
26364
+ "choice",
26365
+ "score"
26366
+ ].map((type) => /* @__PURE__ */ jsx("option", {
26367
+ value: type,
26368
+ children: t(`decision.${type}`)
26369
+ }, type))
26370
+ })
26371
+ })] }),
26372
+ actions: !disabled && /* @__PURE__ */ jsx(DecisionItemActions, {
26373
+ addLabel: t("decision.addQuestion"),
26374
+ removeLabel: t("decision.removeQuestion"),
26375
+ onAdd: () => add(index),
26376
+ onRemove: () => {
26377
+ setOpen(new Set([...open].filter((i) => i !== index).map((i) => i > index ? i - 1 : i)));
26378
+ update(questions.filter((_, i) => i !== index), {
26379
+ target: "field",
26380
+ name: question.name
26381
+ });
26382
+ }
26383
+ }),
26384
+ children: [/* @__PURE__ */ jsx(FieldBody, {
26385
+ id: bodyId,
26386
+ placement: "branch",
26387
+ className: valueEditor_module_default.body,
26388
+ hidden: !open.has(index),
26389
+ children: /* @__PURE__ */ jsxs(FieldGroup, {
26390
+ className: question.type === "noul" ? "gap-0" : "gap-3",
26391
+ children: [/* @__PURE__ */ jsx(DecisionField, {
26392
+ inline: true,
26393
+ placeholder: t("decision.instructionsPlaceholder"),
26394
+ label: t("decision.instructions"),
26395
+ schema: instructionSchema,
26396
+ value: question.instructions,
26397
+ disabled,
26398
+ onCommit: (instructions) => edit(index, {
26399
+ ...question,
26400
+ instructions
26401
+ })
26402
+ }), question.type === "noul" ? /* @__PURE__ */ jsx(DecisionNoulCriteria, {
26403
+ question,
26404
+ disabled,
26405
+ onChange: (criteria) => edit(index, {
26406
+ ...question,
26407
+ criteria
26408
+ })
26409
+ }) : question.type === "score" ? /* @__PURE__ */ jsx(Field, {
26410
+ className: "gap-1.5",
26411
+ children: /* @__PURE__ */ jsxs("div", {
26412
+ className: "flex items-center gap-1",
26413
+ children: [/* @__PURE__ */ jsx(FieldLabel, {
26414
+ className: "text-xs font-normal leading-4",
26415
+ children: t("decision.levels")
26416
+ }), /* @__PURE__ */ jsx(DecisionLevelsHelp, {})]
26417
+ })
26418
+ }) : null]
26419
+ })
26420
+ }), question.type !== "noul" && /* @__PURE__ */ jsx("div", {
26421
+ id: `${bodyId}-criteria`,
26422
+ className: "col-span-full",
26423
+ hidden: !open.has(index),
26424
+ children: /* @__PURE__ */ jsx(FieldLayout, {
26425
+ layout: "ports",
26426
+ depth: 1,
26427
+ children: question.type === "choice" ? /* @__PURE__ */ jsx(DecisionChoices, {
26428
+ question,
26429
+ disabled,
26430
+ onChange: (criteria, removed) => edit(index, {
26431
+ ...question,
26432
+ criteria
26433
+ }, removed)
26434
+ }) : /* @__PURE__ */ jsx(DecisionLevels, {
26435
+ levels: question.criteria,
26436
+ disabled,
26437
+ onChange: (criteria, removed) => edit(index, {
26438
+ ...question,
26439
+ criteria
26440
+ }, removed)
26441
+ })
26442
+ })
26443
+ })]
26444
+ });
26445
+ }
26446
+ }), !questions.length && /* @__PURE__ */ jsx("div", {
26447
+ className: `${valueEditor_module_default.collectionActions} pb-4`,
26448
+ "data-layout": "ports",
26449
+ children: /* @__PURE__ */ jsxs(Button$1, {
26450
+ type: "button",
26451
+ variant: "ghost",
26452
+ size: "field",
26453
+ className: valueEditor_module_default.emptyObjectContent,
26454
+ disabled,
26455
+ onClick: () => add(),
26456
+ children: [/* @__PURE__ */ jsx("i", {
26457
+ "aria-hidden": "true",
26458
+ className: "i-lucide-light:plus"
26459
+ }), t("decision.addQuestion")]
26460
+ })
26461
+ })]
26462
+ }), saveError && /* @__PURE__ */ jsx(FieldError, {
26463
+ className: "px-3 pb-4",
26464
+ children: t("decision.saveFailed")
26465
+ })]
26466
+ });
26467
+ }
26468
+ function DecisionNoulCriteria({ question, disabled, onChange }) {
26469
+ const t = useTranslate();
26470
+ const id = useId();
26471
+ const count = ["true", "false"].filter((key) => question.criteria?.[key]?.trim()).length;
26472
+ const [open, setOpen] = useState(() => count > 0);
26473
+ return /* @__PURE__ */ jsxs(Field, {
26474
+ className: "gap-2",
26475
+ children: [/* @__PURE__ */ jsxs(Button$1, {
26476
+ type: "button",
26477
+ variant: "disclosure",
26478
+ size: "field",
26479
+ className: "justify-start px-0",
26480
+ "aria-expanded": open,
26481
+ "aria-controls": id,
26482
+ onClick: () => setOpen(!open),
26483
+ children: [
26484
+ /* @__PURE__ */ jsx("i", {
26485
+ "aria-hidden": "true",
26486
+ className: open ? "i-lucide-light:chevron-down" : "i-lucide-light:chevron-right"
26487
+ }),
26488
+ t("decision.criteria"),
26489
+ !open && count > 0 && /* @__PURE__ */ jsx("span", {
26490
+ className: "ml-auto text-muted-foreground",
26491
+ children: t("decision.criteriaSet", { count })
26492
+ })
26493
+ ]
26494
+ }), /* @__PURE__ */ jsx("div", {
26495
+ id,
26496
+ hidden: !open,
26497
+ children: /* @__PURE__ */ jsx(FieldGroup, {
26498
+ className: "gap-3",
26499
+ children: ["true", "false"].map((key) => /* @__PURE__ */ jsx(DecisionField, {
26500
+ label: t(`decision.${key}`),
26501
+ schema: {
26502
+ "type": "string",
26503
+ "ui:widget": "text"
26504
+ },
26505
+ value: question.criteria?.[key] ?? "",
26506
+ disabled,
26507
+ onCommit: (value) => onChange({
26508
+ ...question.criteria,
26509
+ [key]: value
26510
+ })
26511
+ }, key))
26512
+ })
26513
+ })]
26514
+ });
26515
+ }
26516
+ function DecisionChoices({ question, disabled, onChange }) {
26517
+ const t = useTranslate();
26518
+ const choices = question.criteria;
26519
+ const added = useRef(/* @__PURE__ */ new WeakSet());
26520
+ function add(after) {
26521
+ if (choices.length >= decisionLimits.choice) return;
26522
+ let name = "category1";
26523
+ let suffix = 2;
26524
+ while (choices.some((choice) => choice.name === name)) name = `category${suffix++}`;
26525
+ const choice = {
26526
+ name,
26527
+ description: ""
26528
+ };
26529
+ added.current.add(choice);
26530
+ onChange(choices.toSpliced(after + 1, 0, choice));
26531
+ }
26532
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(ArrayFieldList, {
26533
+ values: choices,
26534
+ label: t("decision.choices"),
26535
+ children: (_entry, index) => {
26536
+ const choice = choices[index];
26537
+ const names = choices.filter((_, i) => i !== index).map((item) => item.name);
26538
+ return /* @__PURE__ */ jsx(DecisionChoice, {
26539
+ choice,
26540
+ names,
26541
+ disabled,
26542
+ canAdd: choices.length < decisionLimits.choice,
26543
+ initiallyOpen: added.current.has(choice) || !matchesSchema(choice.name, nameSchema(names)),
26544
+ onAdd: () => add(index),
26545
+ onRemove: () => onChange(choices.toSpliced(index, 1), {
26546
+ target: "arrayItem",
26547
+ name: choices[index].name
26548
+ }),
26549
+ onChange: (updated) => onChange(choices.map((item, i) => i === index ? updated : item))
26550
+ });
26551
+ }
26552
+ }), !choices.length && /* @__PURE__ */ jsx("div", {
26553
+ className: valueEditor_module_default.collectionActions,
26554
+ "data-layout": "ports",
26555
+ children: /* @__PURE__ */ jsxs(Button$1, {
26556
+ type: "button",
26557
+ variant: "ghost",
26558
+ size: "field",
26559
+ className: valueEditor_module_default.emptyObjectContent,
26560
+ disabled,
26561
+ onClick: () => add(-1),
26562
+ children: [/* @__PURE__ */ jsx("i", {
26563
+ "aria-hidden": "true",
26564
+ className: "i-lucide-light:plus"
26565
+ }), t("decision.addChoice")]
26566
+ })
26567
+ })] });
26568
+ }
26569
+ function DecisionChoice({ choice, names, disabled, canAdd, initiallyOpen, onAdd, onRemove, onChange }) {
26570
+ const t = useTranslate();
26571
+ const id = useId();
26572
+ const [open, setOpen] = useState(initiallyOpen);
26573
+ const row = useRef(null);
26574
+ const focusDescription = useRef(false);
26575
+ useEffect(() => {
26576
+ if (!open || !focusDescription.current) return;
26577
+ focusDescription.current = false;
26578
+ row.current?.querySelector("textarea")?.focus();
26579
+ }, [open]);
26580
+ return /* @__PURE__ */ jsxs(FieldRow, {
26581
+ ref: row,
26582
+ stacking: "fields",
26583
+ label: choice.name,
26584
+ layout: "ports",
26585
+ "data-output": true,
26586
+ "data-object-child": true,
26587
+ "data-expansion": "branch",
26588
+ "data-expanded": open || void 0,
26589
+ disclosure: {
26590
+ controls: id,
26591
+ expanded: open,
26592
+ onToggle: () => setOpen(!open)
26593
+ },
26594
+ header: /* @__PURE__ */ jsx("span", {
26595
+ "data-field-name": true,
26596
+ children: /* @__PURE__ */ jsx(DecisionField, {
26597
+ inline: true,
26598
+ label: t("decision.choiceName"),
26599
+ placeholder: t("decision.choiceName"),
26600
+ schema: nameSchema(names),
26601
+ value: choice.name,
26602
+ disabled,
26603
+ onCommit: (name) => onChange({
26604
+ ...choice,
26605
+ name
26606
+ })
26607
+ })
26608
+ }),
26609
+ actions: !disabled && /* @__PURE__ */ jsx(DecisionItemActions, {
26610
+ addLabel: t("decision.addChoice"),
26611
+ removeLabel: t("decision.removeChoice"),
26612
+ canAdd,
26613
+ onAdd,
26614
+ onRemove
26615
+ }),
26616
+ children: [/* @__PURE__ */ jsx(FieldValuePreview, {
26617
+ style: {
26618
+ gridColumn: "type / content-end",
26619
+ gridRow: 1
26620
+ },
26621
+ empty: !choice.description,
26622
+ "data-readonly": disabled || void 0,
26623
+ "aria-label": t("decision.choiceDescription"),
26624
+ "aria-expanded": open,
26625
+ "aria-controls": id,
26626
+ onClick: () => {
26627
+ focusDescription.current = !open;
26628
+ setOpen(!open);
26629
+ },
26630
+ children: choice.description || t("decision.choiceDescription")
26631
+ }), /* @__PURE__ */ jsx(FieldBody, {
26632
+ id,
26633
+ placement: "branch",
26634
+ className: valueEditor_module_default.body,
26635
+ hidden: !open,
26636
+ children: /* @__PURE__ */ jsx(DecisionField, {
26637
+ inline: true,
26638
+ label: t("decision.choiceDescription"),
26639
+ placeholder: t("decision.choiceDescription"),
26640
+ schema: {
26641
+ "type": "string",
26642
+ "ui:widget": "text"
26643
+ },
26644
+ value: choice.description,
26645
+ disabled,
26646
+ onCommit: (description) => onChange({
26647
+ ...choice,
26648
+ description
26649
+ })
26650
+ })
26651
+ })]
26652
+ });
26653
+ }
26654
+ function DecisionLevelsHelp() {
26655
+ const t = useTranslate();
26656
+ return /* @__PURE__ */ jsxs(HelpButton, {
26657
+ label: t("decision.levels"),
26658
+ children: [
26659
+ t("decision.levelsCount"),
26660
+ " ",
26661
+ t("decision.levelsHint")
26662
+ ]
26663
+ });
26664
+ }
26665
+ function DecisionLevels({ levels, disabled, onChange }) {
26666
+ const t = useTranslate();
26667
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(ArrayFieldList, {
26668
+ values: levels,
26669
+ label: t("decision.levels"),
26670
+ children: (_entry, index) => /* @__PURE__ */ jsx(DecisionLevel, {
26671
+ value: levels[index],
26672
+ index,
26673
+ disabled,
26674
+ canAdd: levels.length < decisionLimits.score,
26675
+ onAdd: () => {
26676
+ if (levels.length < decisionLimits.score) onChange(levels.toSpliced(index + 1, 0, ""));
26677
+ },
26678
+ onRemove: () => onChange(levels.toSpliced(index, 1), {
26679
+ target: "arrayItem",
26680
+ name: String(index)
26681
+ }),
26682
+ onChange: (value) => onChange(levels.map((level, i) => i === index ? value : level))
26683
+ })
26684
+ }), levels.length < 2 && /* @__PURE__ */ jsx("div", {
26685
+ className: `${valueEditor_module_default.collectionActions} ${levels.length ? "mt-2" : ""}`,
26686
+ "data-layout": "ports",
26687
+ children: /* @__PURE__ */ jsx(ValueEditorFeedback, {
26688
+ error: t("decision.levelsCount"),
26689
+ children: (errorId) => /* @__PURE__ */ jsxs(Button$1, {
26690
+ type: "button",
26691
+ variant: "ghost",
26692
+ size: "field",
26693
+ className: valueEditor_module_default.emptyObjectContent,
26694
+ "data-field-prompt": "true",
26695
+ "aria-invalid": "true",
26696
+ "aria-describedby": errorId,
26697
+ disabled,
26698
+ onClick: () => onChange([...levels, ...Array(2 - levels.length).fill("")]),
26699
+ children: [/* @__PURE__ */ jsx("i", {
26700
+ "aria-hidden": "true",
26701
+ className: "i-lucide-light:plus"
26702
+ }), t("decision.addLevel")]
26703
+ })
26704
+ })
26705
+ })] });
26706
+ }
26707
+ function DecisionLevel({ value, index, disabled, canAdd, onAdd, onRemove, onChange }) {
26708
+ const t = useTranslate();
26709
+ const label = t("decision.levelNumber", { level: index });
26710
+ return /* @__PURE__ */ jsx(FieldRow, {
26711
+ stacking: "fields",
26712
+ label,
26713
+ layout: "ports",
26714
+ 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]",
26715
+ "data-output": true,
26716
+ "data-object-child": true,
26717
+ header: /* @__PURE__ */ jsx("span", {
26718
+ "data-field-name": true,
26719
+ className: "flex items-center text-muted-foreground",
26720
+ style: { fontVariantNumeric: "tabular-nums" },
26721
+ children: label
26722
+ }),
26723
+ actions: !disabled && /* @__PURE__ */ jsx(DecisionItemActions, {
26724
+ addLabel: t("decision.addLevel"),
26725
+ removeLabel: t("decision.removeLevel"),
26726
+ canAdd,
26727
+ onAdd,
26728
+ onRemove
26729
+ }),
26730
+ children: /* @__PURE__ */ jsx("div", {
26731
+ style: {
26732
+ gridColumn: "type / content-end",
26733
+ gridRow: 1
26734
+ },
26735
+ children: /* @__PURE__ */ jsx(DecisionField, {
26736
+ inline: true,
26737
+ label: `${label} ${t("decision.levelDescription")}`,
26738
+ placeholder: t("decision.levelPlaceholder"),
26739
+ schema: textSchema,
26740
+ value,
26741
+ disabled,
26742
+ onCommit: (description) => onChange(description)
26743
+ })
26744
+ })
26745
+ });
26746
+ }
26747
+ function DecisionItemActions({ addLabel, removeLabel, canAdd = true, onAdd, onRemove }) {
26748
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
26749
+ render: /* @__PURE__ */ jsx(Button$1, {
26750
+ type: "button",
26751
+ variant: "ghost",
26752
+ size: "icon-xs",
26753
+ "aria-label": addLabel,
26754
+ disabled: !canAdd,
26755
+ onClick: onAdd
26756
+ }),
26757
+ children: /* @__PURE__ */ jsx("i", {
26758
+ "aria-hidden": "true",
26759
+ className: "i-tabler-light:square-rounded-plus text-lg"
26760
+ })
26761
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: addLabel })] }), /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
26762
+ render: /* @__PURE__ */ jsx(Button$1, {
26763
+ type: "button",
26764
+ variant: "ghost",
26765
+ size: "icon-xs",
26766
+ className: "-translate-x-0.5",
26767
+ "aria-label": removeLabel,
26768
+ onClick: onRemove
26769
+ }),
26770
+ children: /* @__PURE__ */ jsx("i", {
26771
+ "aria-hidden": "true",
26772
+ className: "i-tabler-light:square-rounded-minus text-lg"
26773
+ })
26774
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: removeLabel })] })] });
26775
+ }
26776
+ //#endregion
26777
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/ComboboxRootContext.js
26778
+ var ComboboxRootContext = /*#__PURE__*/ React.createContext(void 0);
26779
+ if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
26780
+ var ComboboxFloatingContext = /*#__PURE__*/ React.createContext(void 0);
26781
+ if (process.env.NODE_ENV !== "production") ComboboxFloatingContext.displayName = "ComboboxFloatingContext";
26782
+ var ComboboxDerivedItemsContext = /*#__PURE__*/ React.createContext(void 0);
26783
+ if (process.env.NODE_ENV !== "production") ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext";
26784
+ var ComboboxInputValueContext = /*#__PURE__*/ React.createContext("");
26785
+ if (process.env.NODE_ENV !== "production") ComboboxInputValueContext.displayName = "ComboboxInputValueContext";
26786
+ function useComboboxRootContext() {
26787
+ const context = React.useContext(ComboboxRootContext);
26788
+ 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));
26789
+ return context;
26790
+ }
26791
+ function useComboboxFloatingContext() {
26792
+ const context = React.useContext(ComboboxFloatingContext);
26793
+ 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));
26794
+ return context;
26795
+ }
26796
+ function useComboboxDerivedItemsContext() {
26797
+ const context = React.useContext(ComboboxDerivedItemsContext);
26798
+ 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));
26799
+ return context;
26800
+ }
26801
+ function useComboboxInputValueContext() {
26802
+ return React.useContext(ComboboxInputValueContext);
26803
+ }
26804
+ //#endregion
26805
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/store.js
26806
+ var selectors = {
26807
+ id: createSelector((state) => state.id),
26808
+ labelId: createSelector((state) => state.labelId),
26809
+ items: createSelector((state) => state.items),
26810
+ selectedValue: createSelector((state) => state.selectedValue),
26811
+ hasSelectionChips: createSelector((state) => {
26812
+ const selectedValue = state.selectedValue;
26813
+ return Array.isArray(selectedValue) && selectedValue.length > 0;
26814
+ }),
26815
+ hasSelectedValue: createSelector((state) => {
26816
+ const { selectedValue, selectionMode } = state;
26817
+ if (selectedValue == null) return false;
26818
+ if (selectionMode === "multiple" && Array.isArray(selectedValue)) return selectedValue.length > 0;
26819
+ return true;
26820
+ }),
26821
+ hasNullItemLabel: createSelector((state, enabled) => {
26822
+ return enabled ? hasNullItemLabel(state.items) : false;
26823
+ }),
26824
+ open: createSelector((state) => state.open),
26825
+ mounted: createSelector((state) => state.mounted),
26826
+ forceMounted: createSelector((state) => state.forceMounted),
26827
+ inline: createSelector((state) => state.inline),
26828
+ activeIndex: createSelector((state) => state.activeIndex),
26829
+ selectedIndex: createSelector((state) => state.selectedIndex),
26830
+ isActive: createSelector((state, index) => state.activeIndex === index),
26831
+ isSelected: createSelector((state, itemValue) => {
26832
+ const comparer = state.isItemEqualToValue;
26833
+ const selectedValue = state.selectedValue;
26834
+ if (Array.isArray(selectedValue)) return selectedValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
26835
+ return compareItemEquality(itemValue, selectedValue, comparer);
26836
+ }),
26837
+ transitionStatus: createSelector((state) => state.transitionStatus),
26838
+ popupProps: createSelector((state) => state.popupProps),
26839
+ inputProps: createSelector((state) => state.inputProps),
26840
+ triggerProps: createSelector((state) => state.triggerProps),
26841
+ getItemProps: createSelector((state) => state.getItemProps),
26842
+ positionerElement: createSelector((state) => state.positionerElement),
26843
+ listElement: createSelector((state) => state.listElement),
26844
+ triggerElement: createSelector((state) => state.triggerElement),
26845
+ inputElement: createSelector((state) => state.inputElement),
26846
+ inputGroupElement: createSelector((state) => state.inputGroupElement),
26847
+ popupSide: createSelector((state) => state.popupSide),
26848
+ openMethod: createSelector((state) => state.openMethod),
26849
+ inputInsidePopup: createSelector((state) => state.inputInsidePopup),
26850
+ selectionMode: createSelector((state) => state.selectionMode),
26851
+ name: createSelector((state) => state.name),
26852
+ form: createSelector((state) => state.form),
26853
+ disabled: createSelector((state) => state.disabled),
26854
+ readOnly: createSelector((state) => state.readOnly),
26855
+ required: createSelector((state) => state.required),
26856
+ grid: createSelector((state) => state.grid),
26857
+ virtualized: createSelector((state) => state.virtualized),
26858
+ itemToStringLabel: createSelector((state) => state.itemToStringLabel),
26859
+ isItemEqualToValue: createSelector((state) => state.isItemEqualToValue),
26860
+ modal: createSelector((state) => state.modal),
26861
+ autoHighlight: createSelector((state) => state.autoHighlight),
26862
+ submitOnItemClick: createSelector((state) => state.submitOnItemClick)
26863
+ };
26864
+ //#endregion
26865
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/index.js
26866
+ /**
26867
+ * Enhanced filter using Intl.Collator for more robust string matching.
26868
+ * Uses the provided `itemToStringLabel` function if available, otherwise falls back to:
26869
+ * • When `item` is an object with a `value` property, that property is used.
26870
+ * • When `item` is a primitive (e.g. `string`), it is used directly.
26871
+ */
26872
+ function createCollatorItemFilter(collatorFilter, itemToStringLabel) {
26873
+ return (item, query) => {
26874
+ if (item == null) return false;
26875
+ const itemString = stringifyAsLabel(item, itemToStringLabel);
26876
+ return collatorFilter.contains(itemString, query);
26877
+ };
26878
+ }
26879
+ /**
26880
+ * Enhanced filter for single selection mode using Intl.Collator that shows all items
26881
+ * when query is empty or matches the current selection, making it easier to browse options.
26882
+ */
26883
+ function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) {
26884
+ return (item, query) => {
26885
+ if (item == null) return false;
26886
+ if (!query) return true;
26887
+ const itemString = stringifyAsLabel(item, itemToStringLabel);
26888
+ const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
26889
+ if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) return true;
26890
+ return collatorFilter.contains(itemString, query);
26891
+ };
26892
+ }
26893
+ //#endregion
26894
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/filter.js
26895
+ var filterCache = /* @__PURE__ */ new Map();
26896
+ function getFilter(options = {}) {
26897
+ const mergedOptions = {
26898
+ usage: "search",
26899
+ sensitivity: "base",
26900
+ ignorePunctuation: true,
26901
+ ...options
26902
+ };
26903
+ const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;
26904
+ const cachedFilter = filterCache.get(cacheKey);
26905
+ if (cachedFilter) return cachedFilter;
26906
+ const collator = new Intl.Collator(options.locale, mergedOptions);
26907
+ const filter = {
26908
+ contains(item, query, itemToString) {
26909
+ if (!query) return true;
26910
+ const itemString = stringifyAsLabel(item, itemToString);
26911
+ for (let i = 0; i <= itemString.length - query.length; i += 1) if (collator.compare(itemString.slice(i, i + query.length), query) === 0) return true;
26912
+ return false;
26913
+ },
26914
+ startsWith(item, query, itemToString) {
26915
+ if (!query) return true;
26916
+ const itemString = stringifyAsLabel(item, itemToString);
26917
+ return collator.compare(itemString.slice(0, query.length), query) === 0;
26918
+ },
26919
+ endsWith(item, query, itemToString) {
26920
+ if (!query) return true;
26921
+ const itemString = stringifyAsLabel(item, itemToString);
26922
+ const queryLength = query.length;
26923
+ return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;
26924
+ }
26925
+ };
26926
+ filterCache.set(cacheKey, filter);
26927
+ return filter;
26928
+ }
26929
+ function stringifyLocale(locale) {
26930
+ if (Array.isArray(locale)) return locale.map((value) => stringifyLocale(value)).join(",");
26931
+ if (locale == null) return "";
26932
+ return String(locale);
26933
+ }
26934
+ //#endregion
26935
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js
26936
+ /**
26937
+ * Matches items against a query using `Intl.Collator` for robust string matching.
26938
+ */
26939
+ var useCoreFilter = getFilter;
26940
+ //#endregion
26941
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/constants.js
26942
+ var NO_ACTIVE_VALUE = Symbol("none");
26943
+ var INITIAL_LAST_HIGHLIGHT = {
26944
+ value: NO_ACTIVE_VALUE,
26945
+ index: -1
26946
+ };
26947
+ //#endregion
26948
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js
26949
+ /**
26950
+ * @internal
26951
+ */
26952
+ function AriaCombobox(props) {
26953
+ 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;
26954
+ const { clearErrors } = useFormContext();
26955
+ const { setDirty, validityData, shouldValidateOnChange, setFilled, name: fieldName, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
26956
+ const id = useLabelableId({ id: idProp });
26957
+ const collatorFilter = useCoreFilter({ locale });
26958
+ const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React.useState(false);
26959
+ const [closeQuery, setCloseQuery] = React.useState(null);
26960
+ const listRef = React.useRef([]);
26961
+ const labelsRef = React.useRef([]);
26962
+ const popupRef = React.useRef(null);
26963
+ const inputRef = React.useRef(null);
26964
+ const startDismissRef = React.useRef(null);
26965
+ const endDismissRef = React.useRef(null);
26966
+ const emptyRef = React.useRef(null);
26967
+ const keyboardActiveRef = React.useRef(true);
26968
+ const hadInputClearRef = React.useRef(false);
26969
+ const chipsContainerRef = React.useRef(null);
26970
+ const clearRef = React.useRef(null);
26971
+ const selectionEventRef = React.useRef(null);
26972
+ const lastHighlightRef = React.useRef(INITIAL_LAST_HIGHLIGHT);
26973
+ const pendingQueryHighlightRef = React.useRef(null);
26974
+ /**
26975
+ * Contains the currently visible list of item values post-filtering.
26976
+ */
26977
+ const valuesRef = React.useRef([]);
26978
+ /**
26979
+ * Contains all item values in a stable, unfiltered order.
26980
+ * This is only used when `items` prop is not provided.
26981
+ * It accumulates values on first mount and does not remove them on unmount due to
26982
+ * filtering, providing a stable index for selected value tracking.
26983
+ */
26984
+ const allValuesRef = React.useRef([]);
26985
+ const disabled = fieldDisabled || disabledProp;
26986
+ const name = fieldName ?? nameProp;
26987
+ const multiple = selectionMode === "multiple";
26988
+ const single = selectionMode === "single";
26989
+ const hasInputValue = inputValueProp !== void 0 || defaultInputValueProp !== void 0;
26990
+ const hasItems = items !== void 0;
26991
+ const hasFilteredItemsProp = filteredItemsProp !== void 0;
26992
+ let autoHighlightMode;
26993
+ if (autoHighlight === "always") autoHighlightMode = "always";
26994
+ else autoHighlightMode = autoHighlight ? "input-change" : false;
26995
+ const [selectedValue, setSelectedValueUnwrapped] = useControlled({
26996
+ controlled: selectedValueProp,
26997
+ default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY$1 : defaultSelectedValue,
26998
+ name: "Combobox",
26999
+ state: "selectedValue"
27000
+ });
27001
+ const filter = React.useMemo(() => {
27002
+ if (filterProp === null) return () => true;
27003
+ if (filterProp !== void 0) return filterProp;
27004
+ if (single && !queryChangedAfterOpen) return createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue);
27005
+ return createCollatorItemFilter(collatorFilter, itemToStringLabel);
27006
+ }, [
27007
+ filterProp,
27008
+ single,
27009
+ selectedValue,
27010
+ queryChangedAfterOpen,
27011
+ collatorFilter,
27012
+ itemToStringLabel
27013
+ ]);
27014
+ const initialDefaultInputValue = useRefWithInit(() => {
27015
+ if (hasInputValue) return defaultInputValueProp ?? "";
27016
+ if (single) return stringifyAsLabel(selectedValue, itemToStringLabel);
27017
+ return "";
27018
+ }).current;
27019
+ const [inputValue, setInputValueUnwrapped] = useControlled({
27020
+ controlled: inputValueProp,
27021
+ default: initialDefaultInputValue,
27022
+ name: "Combobox",
27023
+ state: "inputValue"
27024
+ });
27025
+ const [open, setOpenUnwrapped] = useControlled({
27026
+ controlled: openProp,
27027
+ default: defaultOpen,
27028
+ name: "Combobox",
27029
+ state: "open"
27030
+ });
27031
+ const isGrouped = isGroupedItems(items);
27032
+ const query = closeQuery ?? (inputValue === "" ? "" : String(inputValue).trim());
27033
+ const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
27034
+ const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== "" && selectedLabelString !== "" && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
27035
+ const filterQuery = shouldBypassFiltering ? "" : query;
27036
+ const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering;
27037
+ const flatItems = React.useMemo(() => {
27038
+ if (!items) return EMPTY_ARRAY$1;
27039
+ if (isGrouped) return items.flatMap((group) => group.items);
27040
+ return items;
27041
+ }, [items, isGrouped]);
27042
+ const filteredItems = React.useMemo(() => {
27043
+ if (filteredItemsProp && !shouldIgnoreExternalFiltering) return filteredItemsProp;
27044
+ if (!items) return EMPTY_ARRAY$1;
27045
+ if (isGrouped) {
27046
+ const groupedItems = items;
27047
+ const resultingGroups = [];
27048
+ let currentCount = 0;
27049
+ for (const group of groupedItems) {
27050
+ if (limit > -1 && currentCount >= limit) break;
27051
+ const candidateItems = filterQuery === "" ? group.items : group.items.filter((item) => filter(item, filterQuery, itemToStringLabel));
27052
+ if (candidateItems.length === 0) continue;
27053
+ const remainingLimit = limit > -1 ? limit - currentCount : Infinity;
27054
+ const itemsToTake = candidateItems.slice(0, remainingLimit);
27055
+ if (itemsToTake.length > 0) {
27056
+ const newGroup = {
27057
+ ...group,
27058
+ items: itemsToTake
27059
+ };
27060
+ resultingGroups.push(newGroup);
27061
+ currentCount += itemsToTake.length;
27062
+ }
27063
+ }
27064
+ return resultingGroups;
27065
+ }
27066
+ if (filterQuery === "") return limit > -1 ? flatItems.slice(0, limit) : flatItems;
27067
+ const limitedItems = [];
27068
+ for (const item of flatItems) {
27069
+ if (limit > -1 && limitedItems.length >= limit) break;
27070
+ if (filter(item, filterQuery, itemToStringLabel)) limitedItems.push(item);
27071
+ }
27072
+ return limitedItems;
27073
+ }, [
27074
+ filteredItemsProp,
27075
+ shouldIgnoreExternalFiltering,
27076
+ items,
27077
+ isGrouped,
27078
+ filterQuery,
27079
+ limit,
27080
+ filter,
27081
+ itemToStringLabel,
27082
+ flatItems
27083
+ ]);
27084
+ const flatFilteredItems = React.useMemo(() => {
27085
+ if (isGrouped) return filteredItems.flatMap((g) => g.items);
27086
+ return filteredItems;
27087
+ }, [filteredItems, isGrouped]);
27088
+ const store = useRefWithInit(() => new Store({
27089
+ id,
27090
+ labelId: void 0,
27091
+ selectedValue,
27092
+ open,
27093
+ filter,
27094
+ query,
27095
+ items,
27096
+ selectionMode,
27097
+ listRef,
27098
+ labelsRef,
27099
+ popupRef,
27100
+ emptyRef,
27101
+ inputRef,
27102
+ startDismissRef,
27103
+ endDismissRef,
27104
+ keyboardActiveRef,
27105
+ chipsContainerRef,
27106
+ clearRef,
27107
+ valuesRef,
27108
+ allValuesRef,
27109
+ selectionEventRef,
27110
+ name,
27111
+ form,
27112
+ disabled,
27113
+ readOnly,
27114
+ required,
27115
+ grid,
27116
+ isGrouped,
27117
+ virtualized,
27118
+ openOnInputClick,
27119
+ itemToStringLabel,
27120
+ isItemEqualToValue,
27121
+ modal,
27122
+ autoHighlight: autoHighlightMode,
27123
+ submitOnItemClick,
27124
+ hasInputValue,
27125
+ mounted: false,
27126
+ forceMounted: false,
27127
+ transitionStatus: "idle",
27128
+ inline: inlineProp,
27129
+ activeIndex: null,
27130
+ selectedIndex: null,
27131
+ popupProps: {},
27132
+ inputProps: {},
27133
+ triggerProps: {},
27134
+ positionerElement: null,
27135
+ listElement: null,
27136
+ triggerElement: null,
27137
+ inputElement: null,
27138
+ inputGroupElement: null,
27139
+ popupSide: null,
27140
+ openMethod: null,
27141
+ inputInsidePopup: true,
27142
+ onOpenChangeComplete: onOpenChangeCompleteProp || NOOP,
27143
+ setOpen: NOOP,
27144
+ setInputValue: NOOP,
27145
+ setSelectedValue: NOOP,
27146
+ setIndices: NOOP,
27147
+ onItemHighlighted: NOOP,
27148
+ handleSelection: NOOP,
27149
+ getItemProps: () => EMPTY_OBJECT,
27150
+ forceMount: NOOP,
27151
+ requestSubmit: NOOP
27152
+ })).current;
27153
+ const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue;
27154
+ const fieldStringValue = React.useMemo(() => {
27155
+ if (selectionMode === "none") return fieldRawValue;
27156
+ if (Array.isArray(selectedValue)) return selectedValue.map((value) => stringifyAsValue(value, itemToStringValue));
27157
+ return stringifyAsValue(selectedValue, itemToStringValue);
27158
+ }, [
27159
+ fieldRawValue,
27160
+ itemToStringValue,
27161
+ selectionMode,
27162
+ selectedValue
27163
+ ]);
27164
+ const onItemHighlighted = useStableCallback(onItemHighlightedProp);
27165
+ const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);
27166
+ const activeIndex = useStore$1(store, selectors.activeIndex);
27167
+ const selectedIndex = useStore$1(store, selectors.selectedIndex);
27168
+ const positionerElement = useStore$1(store, selectors.positionerElement);
27169
+ const listElement = useStore$1(store, selectors.listElement);
27170
+ const triggerElement = useStore$1(store, selectors.triggerElement);
27171
+ const inputElement = useStore$1(store, selectors.inputElement);
27172
+ const inputGroupElement = useStore$1(store, selectors.inputGroupElement);
27173
+ const inline = useStore$1(store, selectors.inline);
27174
+ const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
27175
+ const triggerRef = useValueAsRef(triggerElement);
27176
+ const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
27177
+ const { openMethod, triggerProps } = useOpenInteractionType(open);
27178
+ const getFieldValue = useStableCallback(() => fieldStringValue);
27179
+ useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, {
27180
+ id,
27181
+ value: fieldRawValue,
27182
+ getValue: getFieldValue
27183
+ });
27184
+ const forceMount = useStableCallback(() => {
27185
+ if (items) labelsRef.current = flatFilteredItems.map((item) => stringifyAsLabel(item, itemToStringLabel));
27186
+ else store.set("forceMounted", true);
27187
+ });
27188
+ const initialSelectedValueRef = React.useRef(selectedValue);
27189
+ useIsoLayoutEffect(() => {
27190
+ if (selectedValue !== initialSelectedValueRef.current) forceMount();
27191
+ }, [forceMount, selectedValue]);
27192
+ const setIndices = useStableCallback((options) => {
27193
+ store.update(options);
27194
+ const type = options.type || "none";
27195
+ if (options.activeIndex === void 0) return;
27196
+ if (options.activeIndex === null) {
27197
+ if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
27198
+ lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
27199
+ onItemHighlighted(void 0, createGenericEventDetails(type, void 0, { index: -1 }));
27200
+ }
27201
+ } else {
27202
+ const activeValue = valuesRef.current[options.activeIndex];
27203
+ lastHighlightRef.current = {
27204
+ value: activeValue,
27205
+ index: options.activeIndex
27206
+ };
27207
+ onItemHighlighted(activeValue, createGenericEventDetails(type, void 0, { index: options.activeIndex }));
27208
+ }
27209
+ });
27210
+ const setInputValue = useStableCallback((next, eventDetails) => {
27211
+ hadInputClearRef.current = eventDetails.reason === inputClear;
27212
+ props.onInputValueChange?.(next, eventDetails);
27213
+ if (eventDetails.isCanceled) return;
27214
+ if (eventDetails.reason === "input-change") {
27215
+ const event = eventDetails.event;
27216
+ const inputType = event.inputType;
27217
+ if (event.type === "compositionend" || inputType != null && inputType !== "" && inputType !== "insertReplacementText") {
27218
+ const hasQuery = next.trim() !== "";
27219
+ if (hasQuery) setQueryChangedAfterOpen(true);
27220
+ pendingQueryHighlightRef.current = { hasQuery };
27221
+ if (hasQuery && autoHighlightMode && store.state.activeIndex == null) store.set("activeIndex", 0);
27222
+ }
27223
+ }
27224
+ setInputValueUnwrapped(next);
27225
+ });
27226
+ const setOpen = useStableCallback((nextOpen, eventDetails) => {
27227
+ if (open === nextOpen) return;
27228
+ if (eventDetails.reason === "escape-key" && hasItems && flatFilteredItems.length === 0 && !store.state.emptyRef.current) eventDetails.allowPropagation();
27229
+ props.onOpenChange?.(nextOpen, eventDetails);
27230
+ if (eventDetails.isCanceled) return;
27231
+ if (!nextOpen && queryChangedAfterOpen) {
27232
+ if (single) {
27233
+ if (!inline) setCloseQuery(query);
27234
+ if (query === "") setQueryChangedAfterOpen(false);
27235
+ } else if (multiple) {
27236
+ if (inline || inputInsidePopup) setIndices({ activeIndex: null });
27237
+ else setCloseQuery(query);
27238
+ setInputValue("", createChangeEventDetails(inputClear, eventDetails.event));
27239
+ }
27240
+ }
27241
+ setOpenUnwrapped(nextOpen);
27242
+ if (!nextOpen && inputInsidePopup && (eventDetails.reason === "focus-out" || eventDetails.reason === "outside-press")) {
27243
+ setTouched(true);
27244
+ setFocused(false);
27245
+ if (validationMode === "onBlur") {
27246
+ const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
27247
+ validation.commit(valueToValidate);
27248
+ }
27249
+ }
27250
+ });
27251
+ const setSelectedValue = useStableCallback((nextValue, eventDetails) => {
27252
+ onSelectedValueChange?.(nextValue, eventDetails);
27253
+ if (eventDetails.isCanceled) return;
27254
+ setSelectedValueUnwrapped(nextValue);
27255
+ if (selectionMode === "none" && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup) setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), createChangeEventDetails(eventDetails.reason, eventDetails.event));
27256
+ if (single && nextValue != null && eventDetails.reason !== "input-change" && queryChangedAfterOpen && !inline) setCloseQuery(query);
27257
+ });
27258
+ const handleSelection = useStableCallback((event, passedValue) => {
27259
+ let itemValue = passedValue;
27260
+ if (itemValue === void 0) {
27261
+ if (activeIndex === null) return;
27262
+ itemValue = valuesRef.current[activeIndex];
27263
+ }
27264
+ const targetEl = getTarget(event);
27265
+ const overrideEvent = selectionEventRef.current ?? event;
27266
+ selectionEventRef.current = null;
27267
+ const eventDetails = createChangeEventDetails(itemPress, overrideEvent);
27268
+ const href = targetEl?.closest("a")?.getAttribute("href");
27269
+ if (href) {
27270
+ if (href.startsWith("#")) setOpen(false, eventDetails);
27271
+ return;
27272
+ }
27273
+ if (multiple) {
27274
+ const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];
27275
+ const nextValue = selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue) ? removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [...currentSelectedValue, itemValue];
27276
+ setSelectedValue(nextValue, eventDetails);
27277
+ if (!(inputRef.current ? inputRef.current.value.trim() !== "" : false)) return;
27278
+ if (store.state.inputInsidePopup) setInputValue("", createChangeEventDetails(inputClear, eventDetails.event));
27279
+ else setOpen(false, eventDetails);
27280
+ } else {
27281
+ setSelectedValue(itemValue, eventDetails);
27282
+ setOpen(false, eventDetails);
27283
+ }
27284
+ });
27285
+ const requestSubmit = useStableCallback(() => {
27286
+ if (!store.state.submitOnItemClick) return;
27287
+ const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;
27288
+ if (formElement && typeof formElement.requestSubmit === "function") formElement.requestSubmit();
27289
+ });
27290
+ const handleUnmount = useStableCallback(() => {
27291
+ setMounted(false);
27292
+ onOpenChangeComplete?.(false);
27293
+ setQueryChangedAfterOpen(false);
27294
+ setCloseQuery(null);
27295
+ if (selectionMode === "none") setIndices({
27296
+ activeIndex: null,
27297
+ selectedIndex: null
27298
+ });
27299
+ else setIndices({ activeIndex: null });
27300
+ if (multiple && inputRef.current && inputRef.current.value !== "" && !hadInputClearRef.current) setInputValue("", createChangeEventDetails(inputClear));
27301
+ if (single) {
27302
+ if (store.state.inputInsidePopup) {
27303
+ if (inputRef.current && inputRef.current.value !== "") setInputValue("", createChangeEventDetails(inputClear));
27304
+ } else {
27305
+ const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel);
27306
+ if (inputRef.current && inputRef.current.value !== stringVal) setInputValue(stringVal, createChangeEventDetails(stringVal === "" ? inputClear : none$1));
27307
+ }
27308
+ }
27309
+ });
27310
+ const resolvedPopupRef = React.useMemo(() => {
27311
+ if (inline && positionerElement) return { current: positionerElement.closest("[role=\"dialog\"]") };
27312
+ return popupRef;
27313
+ }, [inline, positionerElement]);
27314
+ useOpenChangeComplete({
27315
+ enabled: !props.actionsRef,
27316
+ open,
27317
+ ref: resolvedPopupRef,
27318
+ onComplete() {
27319
+ if (!open) handleUnmount();
27320
+ }
27321
+ });
27322
+ React.useImperativeHandle(props.actionsRef, () => ({ unmount: handleUnmount }), [handleUnmount]);
27323
+ useIsoLayoutEffect(function syncSelectedIndex() {
27324
+ if (open || selectionMode === "none") return;
27325
+ const registry = items ? flatItems : allValuesRef.current;
27326
+ if (multiple) {
27327
+ const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
27328
+ const lastValue = currentValue[currentValue.length - 1];
27329
+ const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
27330
+ setIndices({ selectedIndex: lastIndex === -1 ? null : lastIndex });
27331
+ } else {
27332
+ const index = findItemIndex(registry, selectedValue, isItemEqualToValue);
27333
+ setIndices({ selectedIndex: index === -1 ? null : index });
27334
+ }
27335
+ }, [
27336
+ open,
27337
+ selectedValue,
27338
+ items,
27339
+ selectionMode,
27340
+ flatItems,
27341
+ multiple,
27342
+ isItemEqualToValue,
27343
+ setIndices
27344
+ ]);
27345
+ useIsoLayoutEffect(() => {
27346
+ if (items) {
27347
+ valuesRef.current = flatFilteredItems;
27348
+ listRef.current.length = flatFilteredItems.length;
27349
+ }
27350
+ }, [items, flatFilteredItems]);
27351
+ useIsoLayoutEffect(() => {
27352
+ const pendingHighlight = pendingQueryHighlightRef.current;
27353
+ if (pendingHighlight) {
27354
+ if (pendingHighlight.hasQuery) {
27355
+ if (autoHighlightMode) store.set("activeIndex", 0);
27356
+ } else if (autoHighlightMode === "always") store.set("activeIndex", 0);
27357
+ pendingQueryHighlightRef.current = null;
27358
+ }
27359
+ if (!open && !inline) return;
27360
+ const candidateItems = hasItems || hasFilteredItemsProp ? flatFilteredItems : valuesRef.current;
27361
+ const storeActiveIndex = store.state.activeIndex;
27362
+ if (storeActiveIndex == null) {
27363
+ if (autoHighlightMode === "always" && candidateItems.length > 0) {
27364
+ store.set("activeIndex", 0);
27365
+ return;
27366
+ }
27367
+ if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
27368
+ lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
27369
+ store.state.onItemHighlighted(void 0, createGenericEventDetails(none$1, void 0, { index: -1 }));
27370
+ }
27371
+ return;
27372
+ }
27373
+ if (storeActiveIndex >= candidateItems.length) {
27374
+ if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
27375
+ lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
27376
+ store.state.onItemHighlighted(void 0, createGenericEventDetails(none$1, void 0, { index: -1 }));
27377
+ }
27378
+ store.set("activeIndex", null);
27379
+ return;
27380
+ }
27381
+ const itemValue = candidateItems[storeActiveIndex];
27382
+ const previouslyHighlightedItemValue = lastHighlightRef.current.value;
27383
+ const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
27384
+ if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {
27385
+ lastHighlightRef.current = {
27386
+ value: itemValue,
27387
+ index: storeActiveIndex
27388
+ };
27389
+ store.state.onItemHighlighted(itemValue, createGenericEventDetails(none$1, void 0, { index: storeActiveIndex }));
27390
+ }
27391
+ }, [
27392
+ activeIndex,
27393
+ autoHighlightMode,
27394
+ hasFilteredItemsProp,
27395
+ hasItems,
27396
+ flatFilteredItems,
27397
+ inline,
27398
+ open,
27399
+ store
27400
+ ]);
27401
+ useIsoLayoutEffect(() => {
27402
+ if (selectionMode === "none") {
27403
+ setFilled(String(inputValue) !== "");
27404
+ return;
27405
+ }
27406
+ setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null);
27407
+ }, [
27408
+ setFilled,
27409
+ selectionMode,
27410
+ inputValue,
27411
+ selectedValue,
27412
+ multiple
27413
+ ]);
27414
+ React.useEffect(() => {
27415
+ if (hasItems && autoHighlightMode && flatFilteredItems.length === 0) setIndices({ activeIndex: null });
27416
+ }, [
27417
+ hasItems,
27418
+ autoHighlightMode,
27419
+ flatFilteredItems.length,
27420
+ setIndices
27421
+ ]);
27422
+ useValueChanged(query, () => {
27423
+ if (!open || query === "" || query === String(initialDefaultInputValue)) return;
27424
+ setQueryChangedAfterOpen(true);
27425
+ });
27426
+ useValueChanged(selectedValue, () => {
27427
+ if (selectionMode === "none") return;
27428
+ clearErrors(name);
27429
+ setDirty(selectedValue !== validityData.initialValue);
27430
+ if (shouldValidateOnChange()) validation.commit(selectedValue);
27431
+ else validation.commit(selectedValue, true);
27432
+ if (single && !hasInputValue && !inputInsidePopup) {
27433
+ const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
27434
+ if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails(none$1));
27435
+ }
27436
+ });
27437
+ useValueChanged(inputValue, () => {
27438
+ if (selectionMode !== "none") return;
27439
+ clearErrors(name);
27440
+ setDirty(inputValue !== validityData.initialValue);
27441
+ if (shouldValidateOnChange()) validation.commit(inputValue);
27442
+ else validation.commit(inputValue, true);
27443
+ });
27444
+ useValueChanged(items, () => {
27445
+ if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) return;
27446
+ const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
27447
+ if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails(none$1));
27448
+ });
27449
+ const floatingRootContext = useFloatingRootContext({
27450
+ open: inline ? true : open,
27451
+ onOpenChange: setOpen,
27452
+ elements: {
27453
+ reference: inputInsidePopup ? triggerElement : inputElement,
27454
+ floating: positionerElement
27455
+ }
27456
+ });
27457
+ let ariaHasPopup;
27458
+ let ariaExpanded;
27459
+ if (!inline) {
27460
+ ariaHasPopup = grid ? "grid" : "listbox";
27461
+ ariaExpanded = open ? "true" : "false";
27462
+ }
27463
+ const role = React.useMemo(() => {
27464
+ const isPlainInput = inputElement?.tagName === "INPUT";
27465
+ const shouldTreatAsInput = inputElement == null || isPlainInput;
27466
+ const shouldApplyAria = shouldTreatAsInput || open;
27467
+ const reference = shouldTreatAsInput ? {
27468
+ autoComplete: "off",
27469
+ spellCheck: "false",
27470
+ autoCorrect: "off",
27471
+ autoCapitalize: "none"
27472
+ } : {};
27473
+ if (shouldApplyAria) {
27474
+ reference.role = "combobox";
27475
+ reference["aria-expanded"] = ariaExpanded;
27476
+ reference["aria-haspopup"] = ariaHasPopup;
27477
+ reference["aria-controls"] = open ? listElement?.id : void 0;
27478
+ reference["aria-autocomplete"] = autoComplete;
27479
+ }
27480
+ return {
27481
+ reference,
27482
+ floating: { role: "presentation" }
27483
+ };
27484
+ }, [
27485
+ inputElement,
27486
+ open,
27487
+ ariaExpanded,
27488
+ ariaHasPopup,
27489
+ listElement?.id,
27490
+ autoComplete
27491
+ ]);
27492
+ const click = useClick(floatingRootContext, {
27493
+ enabled: !readOnly && !disabled && openOnInputClick,
27494
+ event: "mousedown-only",
27495
+ toggle: false,
27496
+ touchOpenDelay: inputInsidePopup ? 0 : 100,
27497
+ reason: inputPress
27498
+ });
27499
+ const dismiss = useDismiss(floatingRootContext, {
27500
+ enabled: !readOnly && !disabled && !inline,
27501
+ outsidePressEvent: {
27502
+ mouse: "sloppy",
27503
+ touch: "intentional"
27504
+ },
27505
+ bubbles: inline ? true : void 0,
27506
+ outsidePress(event) {
27507
+ const target = getTarget(event);
27508
+ return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target);
27509
+ }
27510
+ });
27511
+ const listNavigation = useListNavigation(floatingRootContext, {
27512
+ enabled: !readOnly && !disabled,
27513
+ id,
27514
+ listRef,
27515
+ activeIndex,
27516
+ selectedIndex,
27517
+ virtual: true,
27518
+ loopFocus,
27519
+ allowEscape: loopFocus && !autoHighlightMode,
27520
+ focusItemOnOpen: queryChangedAfterOpen || selectionMode === "none" && !autoHighlightMode ? false : "auto",
27521
+ focusItemOnHover: highlightItemOnHover,
27522
+ resetOnPointerLeave: !keepHighlight,
27523
+ cols: grid ? 2 : 1,
27524
+ orientation: grid ? "horizontal" : void 0,
27525
+ disabledIndices: EMPTY_ARRAY$1,
27526
+ onNavigate(nextActiveIndex, event) {
27527
+ if (!event && !open || transitionStatus === "ending") return;
27528
+ if (!event) setIndices({ activeIndex: nextActiveIndex });
27529
+ else setIndices({
27530
+ activeIndex: nextActiveIndex,
27531
+ type: keyboardActiveRef.current ? "keyboard" : "pointer"
27532
+ });
27533
+ }
27534
+ });
27535
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
27536
+ role,
27537
+ click,
27538
+ dismiss,
27539
+ listNavigation
27540
+ ]);
27541
+ useOnFirstRender(() => {
27542
+ store.update({
27543
+ inline: inlineProp,
27544
+ popupProps: getFloatingProps(),
27545
+ inputProps: getReferenceProps(),
27546
+ triggerProps,
27547
+ getItemProps,
27548
+ setOpen,
27549
+ setInputValue,
27550
+ setSelectedValue,
27551
+ setIndices,
27552
+ onItemHighlighted,
27553
+ handleSelection,
27554
+ forceMount,
27555
+ requestSubmit
27556
+ });
27557
+ });
27558
+ useIsoLayoutEffect(() => {
27559
+ store.update({
27560
+ id,
27561
+ selectedValue,
27562
+ open,
27563
+ mounted,
27564
+ transitionStatus,
27565
+ items,
27566
+ inline: inlineProp,
27567
+ popupProps: getFloatingProps(),
27568
+ inputProps: getReferenceProps(),
27569
+ triggerProps,
27570
+ openMethod,
27571
+ getItemProps,
27572
+ selectionMode,
27573
+ name,
27574
+ form,
27575
+ disabled,
27576
+ readOnly,
27577
+ required,
27578
+ grid,
27579
+ isGrouped,
27580
+ virtualized,
27581
+ onOpenChangeComplete,
27582
+ openOnInputClick,
27583
+ itemToStringLabel,
27584
+ modal,
27585
+ autoHighlight: autoHighlightMode,
27586
+ isItemEqualToValue,
27587
+ submitOnItemClick,
27588
+ hasInputValue,
27589
+ requestSubmit
27590
+ });
27591
+ }, [
27592
+ store,
27593
+ id,
27594
+ selectedValue,
27595
+ open,
27596
+ mounted,
27597
+ transitionStatus,
27598
+ items,
27599
+ getFloatingProps,
27600
+ getReferenceProps,
27601
+ getItemProps,
27602
+ openMethod,
27603
+ triggerProps,
27604
+ selectionMode,
27605
+ name,
27606
+ disabled,
27607
+ readOnly,
27608
+ required,
27609
+ validation,
27610
+ grid,
27611
+ isGrouped,
27612
+ virtualized,
27613
+ onOpenChangeComplete,
27614
+ openOnInputClick,
27615
+ itemToStringLabel,
27616
+ modal,
27617
+ isItemEqualToValue,
27618
+ submitOnItemClick,
27619
+ hasInputValue,
27620
+ inlineProp,
27621
+ requestSubmit,
27622
+ autoHighlightMode,
27623
+ form
27624
+ ]);
27625
+ const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
27626
+ const itemsContextValue = React.useMemo(() => ({
27627
+ query,
27628
+ hasItems,
27629
+ filteredItems,
27630
+ flatFilteredItems
27631
+ }), [
27632
+ query,
27633
+ hasItems,
27634
+ filteredItems,
27635
+ flatFilteredItems
27636
+ ]);
27637
+ const serializedValue = React.useMemo(() => {
27638
+ if (Array.isArray(fieldRawValue)) return "";
27639
+ return stringifyAsValue(fieldRawValue, itemToStringValue);
27640
+ }, [fieldRawValue, itemToStringValue]);
27641
+ const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;
27642
+ const hiddenInputName = multiple || selectionMode === "none" ? void 0 : name;
27643
+ const hiddenInputs = React.useMemo(() => {
27644
+ if (!multiple || !Array.isArray(selectedValue) || !name) return null;
27645
+ return selectedValue.map((value) => {
27646
+ const currentSerializedValue = stringifyAsValue(value, itemToStringValue);
27647
+ return /*#__PURE__*/ jsx("input", {
27648
+ type: "hidden",
27649
+ form,
27650
+ name,
27651
+ value: currentSerializedValue
27652
+ }, currentSerializedValue);
27653
+ });
27654
+ }, [
27655
+ multiple,
27656
+ selectedValue,
27657
+ form,
27658
+ name,
27659
+ itemToStringValue
27660
+ ]);
27661
+ const children = /*#__PURE__*/ jsxs(React.Fragment, { children: [
27662
+ props.children,
27663
+ /*#__PURE__*/ jsx("input", {
27664
+ ...validation.getInputValidationProps({
27665
+ onFocus() {
27666
+ if (inputInsidePopup) {
27667
+ triggerElement?.focus();
27668
+ return;
27669
+ }
27670
+ (inputRef.current || triggerElement)?.focus();
27671
+ },
27672
+ onChange(event) {
27673
+ if (event.nativeEvent.defaultPrevented) return;
27674
+ const nextValue = event.currentTarget.value;
27675
+ const details = createChangeEventDetails(none$1, event.nativeEvent);
27676
+ function handleChange() {
27677
+ if (multiple) return;
27678
+ if (selectionMode === "none") {
27679
+ setDirty(nextValue !== validityData.initialValue);
27680
+ setInputValue(nextValue, details);
27681
+ if (shouldValidateOnChange()) validation.commit(nextValue);
27682
+ return;
27683
+ }
27684
+ const matchingValue = valuesRef.current.find((v) => {
27685
+ if (stringifyAsValue(v, itemToStringValue).toLowerCase() === nextValue.toLowerCase()) return true;
27686
+ if (stringifyAsLabel(v, itemToStringLabel).toLowerCase() === nextValue.toLowerCase()) return true;
27687
+ return false;
27688
+ });
27689
+ if (matchingValue != null) {
27690
+ setDirty(matchingValue !== validityData.initialValue);
27691
+ setSelectedValue?.(matchingValue, details);
27692
+ if (shouldValidateOnChange()) validation.commit(matchingValue);
27693
+ }
27694
+ }
27695
+ if (items) handleChange();
27696
+ else {
27697
+ forceMount();
27698
+ queueMicrotask(handleChange);
27699
+ }
27700
+ }
27701
+ }),
27702
+ id: id && hiddenInputName == null ? `${id}-hidden-input` : void 0,
27703
+ form,
27704
+ name: hiddenInputName,
27705
+ autoComplete: formAutoComplete,
27706
+ disabled,
27707
+ required: required && !hasMultipleSelection,
27708
+ readOnly,
27709
+ value: serializedValue,
27710
+ ref: hiddenInputRef,
27711
+ style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,
27712
+ tabIndex: -1,
27713
+ "aria-hidden": true,
27714
+ suppressHydrationWarning: true
27715
+ }),
27716
+ hiddenInputs
27717
+ ] });
27718
+ return /*#__PURE__*/ jsx(ComboboxRootContext.Provider, {
27719
+ value: store,
27720
+ children: /*#__PURE__*/ jsx(ComboboxFloatingContext.Provider, {
27721
+ value: floatingRootContext,
27722
+ children: /*#__PURE__*/ jsx(ComboboxDerivedItemsContext.Provider, {
27723
+ value: itemsContextValue,
27724
+ children: /*#__PURE__*/ jsx(ComboboxInputValueContext.Provider, {
27725
+ value: inputValue,
27726
+ children
27727
+ })
27728
+ })
27729
+ })
27730
+ });
27731
+ }
27732
+ //#endregion
27733
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/ComboboxRoot.js
27734
+ /**
27735
+ * Groups all parts of the combobox.
27736
+ * Doesn't render its own HTML element.
27737
+ *
27738
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
27739
+ */
27740
+ function ComboboxRoot(props) {
27741
+ const { multiple = false, defaultValue, value, onValueChange, autoComplete, ...other } = props;
27742
+ return /*#__PURE__*/ jsx(AriaCombobox, {
27743
+ ...other,
27744
+ selectionMode: multiple ? "multiple" : "single",
27745
+ selectedValue: value,
27746
+ defaultSelectedValue: defaultValue,
27747
+ onSelectedValueChange: onValueChange,
27748
+ formAutoComplete: autoComplete
27749
+ });
27750
+ }
27751
+ //#endregion
27752
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/stateAttributesMapping.js
27753
+ var triggerStateAttributesMapping = {
27754
+ ...pressableTriggerOpenStateMapping,
27755
+ ...fieldValidityMapping,
27756
+ popupSide: (side) => side ? { "data-popup-side": side } : null,
27757
+ listEmpty: (empty) => empty ? { "data-list-empty": "" } : null
27758
+ };
27759
+ //#endregion
27760
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/chips/ComboboxChipsContext.js
27761
+ var ComboboxChipsContext = /*#__PURE__*/ React.createContext(void 0);
27762
+ if (process.env.NODE_ENV !== "production") ComboboxChipsContext.displayName = "ComboboxChipsContext";
27763
+ function useComboboxChipsContext() {
27764
+ return React.useContext(ComboboxChipsContext);
27765
+ }
27766
+ //#endregion
27767
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositionerContext.js
27768
+ var ComboboxPositionerContext = /*#__PURE__*/ React.createContext(void 0);
27769
+ if (process.env.NODE_ENV !== "production") ComboboxPositionerContext.displayName = "ComboboxPositionerContext";
27770
+ function useComboboxPositionerContext(optional) {
27771
+ const context = React.useContext(ComboboxPositionerContext);
27772
+ 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));
27773
+ return context;
27774
+ }
27775
+ //#endregion
27776
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/ComboboxInternalDismissButton.js
27777
+ /**
27778
+ * @internal
27779
+ */
27780
+ var ComboboxInternalDismissButton = /*#__PURE__*/ React.forwardRef(function ComboboxInternalDismissButton(_, forwardedRef) {
27781
+ const store = useComboboxRootContext();
27782
+ const { buttonRef, getButtonProps } = useButton({ native: false });
27783
+ const mergedRef = useMergedRefs(forwardedRef, buttonRef);
27784
+ const dismissProps = getButtonProps({ onClick: useStableCallback((event) => {
27785
+ store.state.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent, event.currentTarget));
27786
+ }) });
27787
+ return /*#__PURE__*/ jsx("span", {
27788
+ ref: mergedRef,
27789
+ ...dismissProps,
27790
+ "aria-label": "Dismiss",
27791
+ tabIndex: void 0,
27792
+ style: visuallyHiddenInput
27793
+ });
27794
+ });
27795
+ if (process.env.NODE_ENV !== "production") ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton";
27796
+ //#endregion
27797
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js
27798
+ /**
27799
+ * A text input to search for items in the list.
27800
+ * Renders an `<input>` element.
27801
+ *
27802
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
27803
+ */
27804
+ var ComboboxInput = /*#__PURE__*/ React.forwardRef(function ComboboxInput(componentProps, forwardedRef) {
27805
+ const { render, className, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
27806
+ const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
27807
+ const { labelId: fieldLabelId } = useLabelableContext();
27808
+ const comboboxChipsContext = useComboboxChipsContext();
27809
+ const positioning = useComboboxPositionerContext(true);
27810
+ const hasPositionerParent = Boolean(positioning);
27811
+ const store = useComboboxRootContext();
27812
+ const { filteredItems } = useComboboxDerivedItemsContext();
27813
+ const inputValue = useComboboxInputValueContext();
27814
+ const direction = useDirection();
27815
+ const required = useStore$1(store, selectors.required);
27816
+ const comboboxDisabled = useStore$1(store, selectors.disabled);
27817
+ const readOnly = useStore$1(store, selectors.readOnly);
27818
+ const name = useStore$1(store, selectors.name);
27819
+ const form = useStore$1(store, selectors.form);
27820
+ const selectionMode = useStore$1(store, selectors.selectionMode);
27821
+ const autoHighlightMode = useStore$1(store, selectors.autoHighlight);
27822
+ const inputProps = useStore$1(store, selectors.inputProps);
27823
+ const triggerProps = useStore$1(store, selectors.triggerProps);
27824
+ const open = useStore$1(store, selectors.open);
27825
+ const mounted = useStore$1(store, selectors.mounted);
27826
+ const selectedValue = useStore$1(store, selectors.selectedValue);
27827
+ const popupSideValue = useStore$1(store, selectors.popupSide);
27828
+ const positionerElement = useStore$1(store, selectors.positionerElement);
27829
+ const rootId = useStore$1(store, selectors.id);
27830
+ const inline = useStore$1(store, selectors.inline);
27831
+ const modal = useStore$1(store, selectors.modal);
27832
+ const autoHighlightEnabled = Boolean(autoHighlightMode);
27833
+ const popupSide = mounted && positionerElement ? popupSideValue : null;
27834
+ const disabled = fieldDisabled || comboboxDisabled || disabledProp;
27835
+ const listEmpty = filteredItems.length === 0;
27836
+ const isInsidePopup = hasPositionerParent || inline;
27837
+ const focusManagerModal = !isInsidePopup || modal;
27838
+ const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : void 0));
27839
+ const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, void 0);
27840
+ const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
27841
+ const [composingValue, setComposingValue] = React.useState(null);
27842
+ const isComposingRef = React.useRef(false);
27843
+ const lastActiveIndexRef = React.useRef(null);
27844
+ const shouldRestoreActiveIndexRef = React.useRef(false);
27845
+ const setInputElement = useStableCallback((element) => {
27846
+ const nextIsInsidePopup = hasPositionerParent || store.state.inline;
27847
+ if (nextIsInsidePopup && !store.state.hasInputValue) store.state.setInputValue("", createChangeEventDetails(none$1));
27848
+ store.update({
27849
+ inputElement: element,
27850
+ inputInsidePopup: nextIsInsidePopup
27851
+ });
27852
+ });
27853
+ const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps);
27854
+ const state = {
27855
+ ...fieldStateForInput,
27856
+ open,
27857
+ disabled,
27858
+ readOnly,
27859
+ popupSide,
27860
+ listEmpty
27861
+ };
27862
+ function handleKeyDown(event) {
27863
+ if (!comboboxChipsContext) return;
27864
+ let nextIndex;
27865
+ const { highlightedChipIndex } = comboboxChipsContext;
27866
+ const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
27867
+ if (highlightedChipIndex !== void 0) {
27868
+ if (event.key === "ArrowLeft") {
27869
+ event.preventDefault();
27870
+ if (highlightedChipIndex > 0) nextIndex = highlightedChipIndex - 1;
27871
+ else nextIndex = void 0;
27872
+ } else if (event.key === "ArrowRight") {
27873
+ event.preventDefault();
27874
+ if (highlightedChipIndex < renderedChipsCount - 1) nextIndex = highlightedChipIndex + 1;
27875
+ else nextIndex = void 0;
27876
+ } else if (event.key === "Backspace" || event.key === "Delete") {
27877
+ event.preventDefault();
27878
+ const computedNextIndex = highlightedChipIndex >= selectedValue.length - 1 ? selectedValue.length - 2 : highlightedChipIndex;
27879
+ nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0;
27880
+ store.state.setIndices({
27881
+ activeIndex: null,
27882
+ selectedIndex: null,
27883
+ type: "keyboard"
27884
+ });
27885
+ }
27886
+ return nextIndex;
27887
+ }
27888
+ if (event.key === "ArrowLeft" && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
27889
+ event.preventDefault();
27890
+ nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0;
27891
+ } else if (event.key === "Backspace" && event.currentTarget.value === "" && selectedValue.length > 0) {
27892
+ store.state.setIndices({
27893
+ activeIndex: null,
27894
+ selectedIndex: null,
27895
+ type: "keyboard"
27896
+ });
27897
+ event.preventDefault();
27898
+ }
27899
+ return nextIndex;
27900
+ }
27901
+ const element = useRenderElement("input", componentProps, {
27902
+ state,
27903
+ ref: [
27904
+ forwardedRef,
27905
+ store.state.inputRef,
27906
+ setInputElement
27907
+ ],
27908
+ props: [
27909
+ inputProps,
27910
+ triggerProps,
27911
+ {
27912
+ type: "text",
27913
+ value: componentProps.value ?? composingValue ?? inputValue,
27914
+ "aria-readonly": readOnly || void 0,
27915
+ "aria-required": required || void 0,
27916
+ "aria-labelledby": ariaLabelledBy,
27917
+ disabled,
27918
+ readOnly,
27919
+ required: selectionMode === "none" ? required : void 0,
27920
+ form,
27921
+ ...selectionMode === "none" && name && { name },
27922
+ id,
27923
+ onFocus() {
27924
+ setFocused(true);
27925
+ if (!inline || !shouldRestoreActiveIndexRef.current) return;
27926
+ shouldRestoreActiveIndexRef.current = false;
27927
+ const nextActiveIndex = lastActiveIndexRef.current;
27928
+ if (nextActiveIndex == null || !Object.hasOwn(store.state.valuesRef.current, nextActiveIndex)) return;
27929
+ store.state.setIndices({ activeIndex: nextActiveIndex });
27930
+ },
27931
+ onBlur() {
27932
+ setTouched(true);
27933
+ setFocused(false);
27934
+ const activeIndex = store.state.activeIndex;
27935
+ if (inline && activeIndex !== null && autoHighlightMode !== "always") {
27936
+ lastActiveIndexRef.current = activeIndex;
27937
+ shouldRestoreActiveIndexRef.current = true;
27938
+ store.state.setIndices({ activeIndex: null });
27939
+ }
27940
+ if (validationMode === "onBlur") {
27941
+ const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
27942
+ validation.commit(valueToValidate);
27943
+ }
27944
+ },
27945
+ onCompositionStart(event) {
27946
+ if (isAndroid) return;
27947
+ isComposingRef.current = true;
27948
+ setComposingValue(event.currentTarget.value);
27949
+ },
27950
+ onCompositionEnd(event) {
27951
+ isComposingRef.current = false;
27952
+ const next = event.currentTarget.value;
27953
+ setComposingValue(null);
27954
+ store.state.setInputValue(next, createChangeEventDetails(inputChange, event.nativeEvent));
27955
+ },
27956
+ onChange(event) {
27957
+ const inputType = event.nativeEvent.inputType;
27958
+ const autofillLikeInput = !inputType || inputType === "insertReplacementText";
27959
+ const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;
27960
+ if (isComposingRef.current) {
27961
+ const nextVal = event.currentTarget.value;
27962
+ setComposingValue(nextVal);
27963
+ if (nextVal === "" && !store.state.openOnInputClick && !store.state.inputInsidePopup) store.state.setOpen(false, createChangeEventDetails(inputClear, event.nativeEvent));
27964
+ const trimmed = nextVal.trim();
27965
+ const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== "";
27966
+ if (!readOnly && !disabled && trimmed) {
27967
+ if (shouldOpenOnInput) {
27968
+ store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
27969
+ if (!autoHighlightEnabled) store.state.setIndices({
27970
+ activeIndex: null,
27971
+ selectedIndex: null,
27972
+ type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
27973
+ });
27974
+ }
27975
+ }
27976
+ if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) store.state.setIndices({
27977
+ activeIndex: null,
27978
+ selectedIndex: null,
27979
+ type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
27980
+ });
27981
+ return;
27982
+ }
27983
+ store.state.setInputValue(event.currentTarget.value, createChangeEventDetails(inputChange, event.nativeEvent));
27984
+ const empty = event.currentTarget.value === "";
27985
+ const clearDetails = createChangeEventDetails(inputClear, event.nativeEvent);
27986
+ if (empty && !store.state.inputInsidePopup) {
27987
+ if (selectionMode === "single") store.state.setSelectedValue(null, clearDetails);
27988
+ if (!store.state.openOnInputClick) store.state.setOpen(false, clearDetails);
27989
+ }
27990
+ const trimmed = event.currentTarget.value.trim();
27991
+ if (!readOnly && !disabled && trimmed) {
27992
+ if (shouldOpenOnInput) {
27993
+ store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
27994
+ if (!autoHighlightEnabled) store.state.setIndices({
27995
+ activeIndex: null,
27996
+ selectedIndex: null,
27997
+ type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
27998
+ });
27999
+ }
28000
+ }
28001
+ if (open && store.state.activeIndex !== null && !autoHighlightEnabled) store.state.setIndices({
28002
+ activeIndex: null,
28003
+ selectedIndex: null,
28004
+ type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
28005
+ });
28006
+ },
28007
+ onKeyDown(event) {
28008
+ if (disabled || readOnly) return;
28009
+ if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;
28010
+ store.state.keyboardActiveRef.current = true;
28011
+ const input = event.currentTarget;
28012
+ const scrollAmount = input.scrollWidth - input.clientWidth;
28013
+ const isRTL = direction === "rtl";
28014
+ if (event.key === "Home") {
28015
+ stopEvent$1(event);
28016
+ const cursor = isFirefox && isRTL ? input.value.length : 0;
28017
+ input.setSelectionRange(cursor, cursor);
28018
+ input.scrollLeft = 0;
28019
+ return;
28020
+ }
28021
+ if (event.key === "End") {
28022
+ stopEvent$1(event);
28023
+ const cursor = isFirefox && isRTL ? 0 : input.value.length;
28024
+ input.setSelectionRange(cursor, cursor);
28025
+ input.scrollLeft = isRTL ? -scrollAmount : scrollAmount;
28026
+ return;
28027
+ }
28028
+ if (!mounted && event.key === "Escape") {
28029
+ const isClear = selectionMode === "multiple" && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null;
28030
+ const details = createChangeEventDetails(escapeKey, event.nativeEvent);
28031
+ const value = selectionMode === "multiple" ? [] : null;
28032
+ store.state.setInputValue("", details);
28033
+ store.state.setSelectedValue(value, details);
28034
+ if (!isClear && !store.state.inline && !details.isPropagationAllowed) event.stopPropagation();
28035
+ return;
28036
+ }
28037
+ if (comboboxChipsContext && event.key === "Backspace" && input.value === "" && comboboxChipsContext.highlightedChipIndex === void 0 && Array.isArray(selectedValue) && selectedValue.length > 0) {
28038
+ const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
28039
+ const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;
28040
+ const newValue = selectedValue.filter((_, index) => index !== removalIndex);
28041
+ store.state.setIndices({
28042
+ activeIndex: null,
28043
+ selectedIndex: null,
28044
+ type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
28045
+ });
28046
+ store.state.setSelectedValue(newValue, createChangeEventDetails(none$1, event.nativeEvent));
28047
+ return;
28048
+ }
28049
+ const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0;
28050
+ const nextIndex = handleKeyDown(event);
28051
+ comboboxChipsContext?.setHighlightedChipIndex(nextIndex);
28052
+ if (nextIndex !== void 0) comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();
28053
+ else if (hadHighlightedChip) store.state.inputRef.current?.focus();
28054
+ if (event.which === 229) return;
28055
+ if (event.key === "Enter" && open) {
28056
+ const activeIndex = store.state.activeIndex;
28057
+ const nativeEvent = event.nativeEvent;
28058
+ if (activeIndex === null) {
28059
+ if (inline) return;
28060
+ store.state.setOpen(false, createChangeEventDetails(none$1, nativeEvent));
28061
+ return;
28062
+ }
28063
+ stopEvent$1(event);
28064
+ const listItem = store.state.listRef.current[activeIndex];
28065
+ if (listItem) {
28066
+ store.state.selectionEventRef.current = nativeEvent;
28067
+ listItem.click();
28068
+ store.state.selectionEventRef.current = null;
28069
+ }
28070
+ }
28071
+ },
28072
+ onPointerMove() {
28073
+ store.state.keyboardActiveRef.current = false;
28074
+ },
28075
+ onPointerDown() {
28076
+ store.state.keyboardActiveRef.current = false;
28077
+ }
28078
+ },
28079
+ validationProps
28080
+ ],
28081
+ stateAttributesMapping: triggerStateAttributesMapping
28082
+ });
28083
+ return /*#__PURE__*/ jsxs(React.Fragment, { children: [open && focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton, { ref: store.state.startDismissRef }), element] });
28084
+ });
28085
+ if (process.env.NODE_ENV !== "production") ComboboxInput.displayName = "ComboboxInput";
28086
+ //#endregion
28087
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/handleInputPress.js
28088
+ function handleInputPress(event, store, disabled, readOnly, shouldIgnoreTarget) {
28089
+ if (event.baseUIHandlerPrevented || readOnly) return;
28090
+ const target = getTarget(event.nativeEvent);
28091
+ const targetElement = isElement(target) ? target : null;
28092
+ if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) return;
28093
+ event.preventDefault();
28094
+ if (disabled) return;
28095
+ store.state.inputRef.current?.focus();
28096
+ if (store.state.openOnInputClick) store.state.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
28097
+ }
28098
+ //#endregion
28099
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/input-group/ComboboxInputGroup.js
28100
+ /**
28101
+ * A wrapper for the input and its associated controls.
28102
+ * Renders a `<div>` element.
28103
+ *
28104
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28105
+ */
28106
+ var ComboboxInputGroup = /*#__PURE__*/ React.forwardRef(function ComboboxInputGroup(componentProps, forwardedRef) {
28107
+ const { render, className, style, ...elementProps } = componentProps;
28108
+ const { state: fieldState } = useFieldRootContext();
28109
+ const store = useComboboxRootContext();
28110
+ const { filteredItems } = useComboboxDerivedItemsContext();
28111
+ const open = useStore$1(store, selectors.open);
28112
+ const mounted = useStore$1(store, selectors.mounted);
28113
+ const popupSideValue = useStore$1(store, selectors.popupSide);
28114
+ const positionerElement = useStore$1(store, selectors.positionerElement);
28115
+ const comboboxDisabled = useStore$1(store, selectors.disabled);
28116
+ const readOnly = useStore$1(store, selectors.readOnly);
28117
+ const hasSelectedValue = useStore$1(store, selectors.hasSelectedValue);
28118
+ const selectionMode = useStore$1(store, selectors.selectionMode);
28119
+ const popupSide = mounted && positionerElement ? popupSideValue : null;
28120
+ const disabled = comboboxDisabled;
28121
+ const listEmpty = filteredItems.length === 0;
28122
+ const placeholder = selectionMode === "none" ? false : !hasSelectedValue;
28123
+ const state = {
28124
+ ...fieldState,
28125
+ open,
28126
+ disabled,
28127
+ readOnly,
28128
+ popupSide,
28129
+ listEmpty,
28130
+ placeholder
28131
+ };
28132
+ const setInputGroupElement = useStableCallback((element) => {
28133
+ store.set("inputGroupElement", element);
28134
+ });
28135
+ return useRenderElement("div", componentProps, {
28136
+ ref: [forwardedRef, setInputGroupElement],
28137
+ props: [{
28138
+ role: "group",
28139
+ onMouseDown(event) {
28140
+ handleInputPress(event, store, disabled, readOnly, (target) => {
28141
+ return contains(store.state.chipsContainerRef.current, target);
28142
+ });
28143
+ }
28144
+ }, elementProps],
28145
+ state,
28146
+ stateAttributesMapping: triggerStateAttributesMapping
28147
+ });
28148
+ });
28149
+ if (process.env.NODE_ENV !== "production") ComboboxInputGroup.displayName = "ComboboxInputGroup";
28150
+ //#endregion
28151
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js
28152
+ var BOUNDARY_OFFSET = 2;
28153
+ /**
28154
+ * A button that opens the popup.
28155
+ * Renders a `<button>` element.
28156
+ *
28157
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28158
+ */
28159
+ var ComboboxTrigger = /*#__PURE__*/ React.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {
28160
+ const { render, className, nativeButton = true, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
28161
+ const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
28162
+ const { labelId: fieldLabelId } = useLabelableContext();
28163
+ const store = useComboboxRootContext();
28164
+ const { filteredItems } = useComboboxDerivedItemsContext();
28165
+ const selectionMode = useStore$1(store, selectors.selectionMode);
28166
+ const comboboxDisabled = useStore$1(store, selectors.disabled);
28167
+ const readOnly = useStore$1(store, selectors.readOnly);
28168
+ const required = useStore$1(store, selectors.required);
28169
+ const mounted = useStore$1(store, selectors.mounted);
28170
+ const popupSideValue = useStore$1(store, selectors.popupSide);
28171
+ const positionerElement = useStore$1(store, selectors.positionerElement);
28172
+ const listElement = useStore$1(store, selectors.listElement);
28173
+ const triggerProps = useStore$1(store, selectors.triggerProps);
28174
+ const triggerElement = useStore$1(store, selectors.triggerElement);
28175
+ const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
28176
+ const rootId = useStore$1(store, selectors.id);
28177
+ const comboboxLabelId = useStore$1(store, selectors.labelId);
28178
+ const open = useStore$1(store, selectors.open);
28179
+ const selectedValue = useStore$1(store, selectors.selectedValue);
28180
+ const activeIndex = useStore$1(store, selectors.activeIndex);
28181
+ const selectedIndex = useStore$1(store, selectors.selectedIndex);
28182
+ const hasSelectedValue = useStore$1(store, selectors.hasSelectedValue);
28183
+ const floatingRootContext = useComboboxFloatingContext();
28184
+ const inputValue = useComboboxInputValueContext();
28185
+ const focusTimeout = useTimeout();
28186
+ const disabled = fieldDisabled || comboboxDisabled || disabledProp;
28187
+ const listEmpty = filteredItems.length === 0;
28188
+ const popupSide = mounted && positionerElement ? popupSideValue : null;
28189
+ useLabelableId({ id: inputInsidePopup ? idProp : void 0 });
28190
+ const id = inputInsidePopup ? idProp ?? rootId : idProp;
28191
+ const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
28192
+ const currentPointerTypeRef = React.useRef("");
28193
+ function trackPointerType(event) {
28194
+ currentPointerTypeRef.current = event.pointerType;
28195
+ }
28196
+ const domReference = floatingRootContext.useState("domReferenceElement");
28197
+ React.useEffect(() => {
28198
+ if (!inputInsidePopup) return;
28199
+ if (triggerElement && triggerElement !== domReference) floatingRootContext.set("domReferenceElement", triggerElement);
28200
+ }, [
28201
+ triggerElement,
28202
+ domReference,
28203
+ floatingRootContext,
28204
+ inputInsidePopup
28205
+ ]);
28206
+ const { reference: triggerTypeaheadProps } = useTypeahead(floatingRootContext, {
28207
+ enabled: !open && !readOnly && !comboboxDisabled && selectionMode === "single",
28208
+ listRef: store.state.labelsRef,
28209
+ activeIndex,
28210
+ selectedIndex,
28211
+ onMatch(index) {
28212
+ const nextSelectedValue = store.state.valuesRef.current[index];
28213
+ if (nextSelectedValue !== void 0) store.state.setSelectedValue(nextSelectedValue, createChangeEventDetails("none"));
28214
+ }
28215
+ });
28216
+ const { reference: triggerClickProps } = useClick(floatingRootContext, {
28217
+ enabled: !readOnly && !comboboxDisabled,
28218
+ event: "mousedown"
28219
+ });
28220
+ const { buttonRef, getButtonProps } = useButton({
28221
+ native: nativeButton,
28222
+ disabled
28223
+ });
28224
+ const state = {
28225
+ ...fieldState,
28226
+ open,
28227
+ disabled,
28228
+ popupSide,
28229
+ listEmpty,
28230
+ placeholder: selectionMode === "none" ? false : !hasSelectedValue
28231
+ };
28232
+ const setTriggerElement = useStableCallback((element) => {
28233
+ store.set("triggerElement", element);
28234
+ });
28235
+ return useRenderElement("button", componentProps, {
28236
+ ref: [
28237
+ forwardedRef,
28238
+ buttonRef,
28239
+ setTriggerElement
28240
+ ],
28241
+ state,
28242
+ props: [
28243
+ triggerProps,
28244
+ triggerClickProps,
28245
+ triggerTypeaheadProps,
28246
+ {
28247
+ id,
28248
+ tabIndex: inputInsidePopup ? 0 : -1,
28249
+ role: inputInsidePopup ? "combobox" : void 0,
28250
+ "aria-expanded": open ? "true" : "false",
28251
+ "aria-haspopup": inputInsidePopup ? "dialog" : "listbox",
28252
+ "aria-controls": open ? listElement?.id : void 0,
28253
+ "aria-required": inputInsidePopup ? required || void 0 : void 0,
28254
+ "aria-labelledby": ariaLabelledBy,
28255
+ onPointerDown: trackPointerType,
28256
+ onPointerEnter: trackPointerType,
28257
+ onFocus() {
28258
+ setFocused(true);
28259
+ if (disabled || readOnly) return;
28260
+ focusTimeout.start(0, store.state.forceMount);
28261
+ },
28262
+ onBlur(event) {
28263
+ if (contains(positionerElement, event.relatedTarget)) return;
28264
+ setTouched(true);
28265
+ setFocused(false);
28266
+ if (validationMode === "onBlur") {
28267
+ const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
28268
+ validation.commit(valueToValidate);
28269
+ }
28270
+ },
28271
+ onMouseDown(event) {
28272
+ if (disabled || readOnly) return;
28273
+ if (!inputInsidePopup) floatingRootContext.set("domReferenceElement", event.currentTarget);
28274
+ store.state.forceMount();
28275
+ if (currentPointerTypeRef.current !== "touch") {
28276
+ store.state.inputRef.current?.focus();
28277
+ if (!inputInsidePopup) event.preventDefault();
28278
+ }
28279
+ if (open) return;
28280
+ const doc = ownerDocument(event.currentTarget);
28281
+ function handleMouseUp(mouseEvent) {
28282
+ if (!triggerElement) return;
28283
+ const mouseUpTarget = getTarget(mouseEvent);
28284
+ const positioner = store.state.positionerElement;
28285
+ const list = store.state.listElement;
28286
+ if (contains(triggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget) || mouseUpTarget === triggerElement) return;
28287
+ const bounds = getPseudoElementBounds(triggerElement);
28288
+ const withinHorizontal = mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET;
28289
+ const withinVertical = mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET;
28290
+ if (withinHorizontal && withinVertical) return;
28291
+ store.state.setOpen(false, createChangeEventDetails("cancel-open", mouseEvent));
28292
+ }
28293
+ if (inputInsidePopup) doc.addEventListener("mouseup", handleMouseUp, { once: true });
28294
+ },
28295
+ onKeyDown(event) {
28296
+ if (disabled || readOnly) return;
28297
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
28298
+ stopEvent$1(event);
28299
+ store.state.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent));
28300
+ store.state.inputRef.current?.focus();
28301
+ }
28302
+ }
28303
+ },
28304
+ validation ? validation.getValidationProps(elementProps) : elementProps,
28305
+ getButtonProps
28306
+ ],
28307
+ stateAttributesMapping: triggerStateAttributesMapping
28308
+ });
28309
+ });
28310
+ if (process.env.NODE_ENV !== "production") ComboboxTrigger.displayName = "ComboboxTrigger";
28311
+ //#endregion
28312
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/collection/GroupCollectionContext.js
28313
+ var GroupCollectionContext = /*#__PURE__*/ React.createContext(null);
28314
+ if (process.env.NODE_ENV !== "production") GroupCollectionContext.displayName = "GroupCollectionContext";
28315
+ function useGroupCollectionContext() {
28316
+ return React.useContext(GroupCollectionContext);
28317
+ }
28318
+ //#endregion
28319
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js
28320
+ /**
28321
+ * Renders filtered list items.
28322
+ * Doesn't render its own HTML element.
28323
+ *
28324
+ * If rendering a flat list, pass a function child to the `List` component instead, which implicitly wraps it.
28325
+ *
28326
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28327
+ */
28328
+ function ComboboxCollection(props) {
28329
+ const { children } = props;
28330
+ const { filteredItems } = useComboboxDerivedItemsContext();
28331
+ const groupContext = useGroupCollectionContext();
28332
+ const itemsToRender = groupContext ? groupContext.items : filteredItems;
28333
+ if (!itemsToRender) return null;
28334
+ return /*#__PURE__*/ jsx(React.Fragment, { children: itemsToRender.map(children) });
28335
+ }
28336
+ //#endregion
28337
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js
28338
+ /**
28339
+ * A list container for the items.
28340
+ * Renders a `<div>` element.
28341
+ *
28342
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28343
+ */
28344
+ var ComboboxList = /*#__PURE__*/ React.forwardRef(function ComboboxList(componentProps, forwardedRef) {
28345
+ var _ComboboxCollection;
28346
+ const { render, className, style, children, ...elementProps } = componentProps;
28347
+ const store = useComboboxRootContext();
28348
+ const floatingRootContext = useComboboxFloatingContext();
28349
+ const hasPositionerContext = Boolean(useComboboxPositionerContext(true));
28350
+ const { filteredItems, hasItems } = useComboboxDerivedItemsContext();
28351
+ const selectionMode = useStore$1(store, selectors.selectionMode);
28352
+ const grid = useStore$1(store, selectors.grid);
28353
+ const popupProps = useStore$1(store, selectors.popupProps);
28354
+ const virtualized = useStore$1(store, selectors.virtualized);
28355
+ const multiple = selectionMode === "multiple";
28356
+ const empty = filteredItems.length === 0;
28357
+ const setPositionerElement = useStableCallback((element) => {
28358
+ store.set("positionerElement", element);
28359
+ });
28360
+ const setListElement = useStableCallback((element) => {
28361
+ store.set("listElement", element);
28362
+ });
28363
+ const resolvedChildren = React.useMemo(() => {
28364
+ if (typeof children === "function") return _ComboboxCollection || (_ComboboxCollection = /*#__PURE__*/ jsx(ComboboxCollection, { children }));
28365
+ return children;
28366
+ }, [children]);
28367
+ const state = { empty };
28368
+ const floatingId = floatingRootContext.useState("floatingId");
28369
+ const element = useRenderElement("div", componentProps, {
28370
+ state,
28371
+ ref: [
28372
+ forwardedRef,
28373
+ setListElement,
28374
+ hasPositionerContext ? null : setPositionerElement
28375
+ ],
28376
+ props: [
28377
+ popupProps,
28378
+ {
28379
+ children: resolvedChildren,
28380
+ tabIndex: -1,
28381
+ id: floatingId,
28382
+ role: grid ? "grid" : "listbox",
28383
+ "aria-multiselectable": multiple ? "true" : void 0,
28384
+ onKeyDown(event) {
28385
+ if (store.state.disabled || store.state.readOnly) return;
28386
+ if (event.key === "Enter") {
28387
+ const activeIndex = store.state.activeIndex;
28388
+ if (activeIndex == null) return;
28389
+ stopEvent$1(event);
28390
+ const nativeEvent = event.nativeEvent;
28391
+ const listItem = store.state.listRef.current[activeIndex];
28392
+ if (listItem) {
28393
+ store.state.selectionEventRef.current = nativeEvent;
28394
+ listItem.click();
28395
+ store.state.selectionEventRef.current = null;
28396
+ }
28397
+ }
28398
+ },
28399
+ onKeyDownCapture() {
28400
+ store.state.keyboardActiveRef.current = true;
28401
+ },
28402
+ onPointerMoveCapture() {
28403
+ store.state.keyboardActiveRef.current = false;
28404
+ }
28405
+ },
28406
+ elementProps
28407
+ ]
28408
+ });
28409
+ if (virtualized) return element;
28410
+ return /*#__PURE__*/ jsx(CompositeList, {
28411
+ elementsRef: store.state.listRef,
28412
+ labelsRef: hasItems ? void 0 : store.state.labelsRef,
28413
+ children: element
28414
+ });
28415
+ });
28416
+ if (process.env.NODE_ENV !== "production") ComboboxList.displayName = "ComboboxList";
28417
+ //#endregion
28418
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortalContext.js
28419
+ var ComboboxPortalContext = /*#__PURE__*/ React.createContext(void 0);
28420
+ if (process.env.NODE_ENV !== "production") ComboboxPortalContext.displayName = "ComboboxPortalContext";
28421
+ function useComboboxPortalContext() {
28422
+ const context = React.useContext(ComboboxPortalContext);
28423
+ if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Combobox.Portal> is missing." : formatErrorMessage(20));
28424
+ return context;
28425
+ }
28426
+ //#endregion
28427
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js
28428
+ /**
28429
+ * A portal element that moves the popup to a different part of the DOM.
28430
+ * By default, the portal element is appended to `<body>`.
28431
+ * Renders a `<div>` element.
28432
+ *
28433
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28434
+ */
28435
+ var ComboboxPortal = /*#__PURE__*/ React.forwardRef(function ComboboxPortal(props, forwardedRef) {
28436
+ const { keepMounted = false, ...portalProps } = props;
28437
+ const store = useComboboxRootContext();
28438
+ const mounted = useStore$1(store, selectors.mounted);
28439
+ const forceMounted = useStore$1(store, selectors.forceMounted);
28440
+ if (!(mounted || keepMounted || forceMounted)) return null;
28441
+ return /*#__PURE__*/ jsx(ComboboxPortalContext.Provider, {
28442
+ value: keepMounted,
28443
+ children: /*#__PURE__*/ jsx(FloatingPortal, {
28444
+ ref: forwardedRef,
28445
+ ...portalProps
28446
+ })
28447
+ });
28448
+ });
28449
+ if (process.env.NODE_ENV !== "production") ComboboxPortal.displayName = "ComboboxPortal";
28450
+ //#endregion
28451
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js
28452
+ /**
28453
+ * Positions the popup against the trigger.
28454
+ * Renders a `<div>` element.
28455
+ *
28456
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28457
+ */
28458
+ var ComboboxPositioner = /*#__PURE__*/ React.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {
28459
+ 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;
28460
+ const store = useComboboxRootContext();
28461
+ const { filteredItems } = useComboboxDerivedItemsContext();
28462
+ const floatingRootContext = useComboboxFloatingContext();
28463
+ const keepMounted = useComboboxPortalContext();
28464
+ const modal = useStore$1(store, selectors.modal);
28465
+ const open = useStore$1(store, selectors.open);
28466
+ const mounted = useStore$1(store, selectors.mounted);
28467
+ const openMethod = useStore$1(store, selectors.openMethod);
28468
+ const positionerElement = useStore$1(store, selectors.positionerElement);
28469
+ const triggerElement = useStore$1(store, selectors.triggerElement);
28470
+ const inputElement = useStore$1(store, selectors.inputElement);
28471
+ const inputGroupElement = useStore$1(store, selectors.inputGroupElement);
28472
+ const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
28473
+ const transitionStatus = useStore$1(store, selectors.transitionStatus);
28474
+ const empty = filteredItems.length === 0;
28475
+ const positioning = useAnchorPositioning({
28476
+ anchor: anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement),
28477
+ floatingRootContext,
28478
+ positionMethod,
28479
+ mounted,
28480
+ side,
28481
+ sideOffset,
28482
+ align,
28483
+ alignOffset,
28484
+ arrowPadding,
28485
+ collisionBoundary,
28486
+ collisionPadding,
28487
+ sticky,
28488
+ disableAnchorTracking,
28489
+ keepMounted,
28490
+ collisionAvoidance,
28491
+ lazyFlip: true
28492
+ });
28493
+ useAnchoredPopupScrollLock(open && modal, openMethod === "touch", positionerElement, triggerElement);
28494
+ const state = {
28495
+ open,
28496
+ side: positioning.side,
28497
+ align: positioning.align,
28498
+ anchorHidden: positioning.anchorHidden,
28499
+ empty
28500
+ };
28501
+ useIsoLayoutEffect(() => {
28502
+ store.set("popupSide", positioning.side);
28503
+ }, [store, positioning.side]);
28504
+ const setPositionerElement = useStableCallback((element) => {
28505
+ store.set("positionerElement", element);
28506
+ });
28507
+ const element = usePositioner(componentProps, state, {
28508
+ styles: positioning.positionerStyles,
28509
+ transitionStatus,
28510
+ props: elementProps,
28511
+ refs: [forwardedRef, setPositionerElement],
28512
+ hidden: !mounted,
28513
+ inert: !open
28514
+ });
28515
+ return /*#__PURE__*/ jsxs(ComboboxPositionerContext.Provider, {
28516
+ value: positioning,
28517
+ children: [mounted && modal && /*#__PURE__*/ jsx(InternalBackdrop, {
28518
+ inert: inertValue(!open),
28519
+ cutout: inputGroupElement ?? inputElement ?? triggerElement
28520
+ }), element]
28521
+ });
28522
+ });
28523
+ if (process.env.NODE_ENV !== "production") ComboboxPositioner.displayName = "ComboboxPositioner";
28524
+ //#endregion
28525
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/popup/ComboboxPopup.js
28526
+ var stateAttributesMapping$1 = {
28527
+ ...popupStateMapping,
28528
+ ...transitionStatusMapping
28529
+ };
28530
+ /**
28531
+ * A container for the list.
28532
+ * Renders a `<div>` element.
28533
+ *
28534
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28535
+ */
28536
+ var ComboboxPopup = /*#__PURE__*/ React.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {
28537
+ const { render, className, style, initialFocus, finalFocus, ...elementProps } = componentProps;
28538
+ const store = useComboboxRootContext();
28539
+ const positioning = useComboboxPositionerContext();
28540
+ const floatingRootContext = useComboboxFloatingContext();
28541
+ const { filteredItems } = useComboboxDerivedItemsContext();
28542
+ const mounted = useStore$1(store, selectors.mounted);
28543
+ const open = useStore$1(store, selectors.open);
28544
+ const openMethod = useStore$1(store, selectors.openMethod);
28545
+ const transitionStatus = useStore$1(store, selectors.transitionStatus);
28546
+ const inputInsidePopup = useStore$1(store, selectors.inputInsidePopup);
28547
+ const inputElement = useStore$1(store, selectors.inputElement);
28548
+ const modal = useStore$1(store, selectors.modal);
28549
+ const empty = filteredItems.length === 0;
28550
+ useOpenChangeComplete({
28551
+ open,
28552
+ ref: store.state.popupRef,
28553
+ onComplete() {
28554
+ if (open) store.state.onOpenChangeComplete(true);
28555
+ }
28556
+ });
28557
+ const state = {
28558
+ open,
28559
+ side: positioning.side,
28560
+ align: positioning.align,
28561
+ anchorHidden: positioning.anchorHidden,
28562
+ transitionStatus,
28563
+ empty
28564
+ };
28565
+ const element = useRenderElement("div", componentProps, {
28566
+ state,
28567
+ ref: [forwardedRef, store.state.popupRef],
28568
+ props: [
28569
+ {
28570
+ role: inputInsidePopup ? "dialog" : "presentation",
28571
+ tabIndex: -1,
28572
+ onFocus(event) {
28573
+ const target = getTarget(event.nativeEvent);
28574
+ if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) store.state.inputRef.current?.focus();
28575
+ }
28576
+ },
28577
+ getDisabledMountTransitionStyles(transitionStatus),
28578
+ elementProps
28579
+ ],
28580
+ stateAttributesMapping: stateAttributesMapping$1
28581
+ });
28582
+ const resolvedInitialFocus = initialFocus === void 0 ? inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.state.popupRef.current : inputElement : false : initialFocus;
28583
+ let resolvedFinalFocus;
28584
+ if (finalFocus != null) resolvedFinalFocus = finalFocus;
28585
+ else resolvedFinalFocus = inputInsidePopup ? void 0 : false;
28586
+ const focusManagerModal = !inputInsidePopup || modal;
28587
+ return /*#__PURE__*/ jsx(FloatingFocusManager, {
28588
+ context: floatingRootContext,
28589
+ disabled: !mounted,
28590
+ modal: focusManagerModal,
28591
+ openInteractionType: openMethod,
28592
+ initialFocus: resolvedInitialFocus,
28593
+ returnFocus: resolvedFinalFocus,
28594
+ getInsideElements: () => [store.state.startDismissRef.current, store.state.endDismissRef.current],
28595
+ children: /*#__PURE__*/ jsxs(React.Fragment, { children: [element, focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton, { ref: store.state.endDismissRef })] })
28596
+ });
28597
+ });
28598
+ if (process.env.NODE_ENV !== "production") ComboboxPopup.displayName = "ComboboxPopup";
28599
+ //#endregion
28600
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item/ComboboxItemContext.js
28601
+ var ComboboxItemContext = /*#__PURE__*/ React.createContext(void 0);
28602
+ if (process.env.NODE_ENV !== "production") ComboboxItemContext.displayName = "ComboboxItemContext";
28603
+ function useComboboxItemContext() {
28604
+ const context = React.useContext(ComboboxItemContext);
28605
+ 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));
28606
+ return context;
28607
+ }
28608
+ //#endregion
28609
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/row/ComboboxRowContext.js
28610
+ var ComboboxRowContext = /*#__PURE__*/ React.createContext(false);
28611
+ if (process.env.NODE_ENV !== "production") ComboboxRowContext.displayName = "ComboboxRowContext";
28612
+ function useComboboxRowContext() {
28613
+ return React.useContext(ComboboxRowContext);
28614
+ }
28615
+ //#endregion
28616
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js
28617
+ /**
28618
+ * An individual item in the list.
28619
+ * Renders a `<div>` element.
28620
+ *
28621
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28622
+ */
28623
+ var ComboboxItem = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef(function ComboboxItem(componentProps, forwardedRef) {
28624
+ const { render, className, value: itemValue = null, index: indexProp, disabled = false, nativeButton = false, style, ...elementProps } = componentProps;
28625
+ const didPointerDownRef = React.useRef(false);
28626
+ const textRef = React.useRef(null);
28627
+ const listItem = useCompositeListItem({
28628
+ index: indexProp,
28629
+ textRef,
28630
+ indexGuessBehavior: IndexGuessBehavior.GuessFromOrder
28631
+ });
28632
+ const store = useComboboxRootContext();
28633
+ const isRow = useComboboxRowContext();
28634
+ const { flatFilteredItems, hasItems } = useComboboxDerivedItemsContext();
28635
+ const open = useStore$1(store, selectors.open);
28636
+ const selectionMode = useStore$1(store, selectors.selectionMode);
28637
+ const readOnly = useStore$1(store, selectors.readOnly);
28638
+ const virtualized = useStore$1(store, selectors.virtualized);
28639
+ const isItemEqualToValue = useStore$1(store, selectors.isItemEqualToValue);
28640
+ const selectable = selectionMode !== "none";
28641
+ const index = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
28642
+ const hasRegistered = listItem.index !== -1;
28643
+ const rootId = useStore$1(store, selectors.id);
28644
+ const highlighted = useStore$1(store, selectors.isActive, index);
28645
+ const matchesSelectedValue = useStore$1(store, selectors.isSelected, itemValue);
28646
+ const getItemProps = useStore$1(store, selectors.getItemProps);
28647
+ const itemRef = React.useRef(null);
28648
+ const id = rootId != null && hasRegistered ? `${rootId}-${index}` : void 0;
28649
+ const selected = matchesSelectedValue && selectable;
28650
+ useIsoLayoutEffect(() => {
28651
+ if (!(hasRegistered && (virtualized || indexProp != null))) return;
28652
+ const list = store.state.listRef.current;
28653
+ list[index] = itemRef.current;
28654
+ return () => {
28655
+ delete list[index];
28656
+ };
28657
+ }, [
28658
+ hasRegistered,
28659
+ virtualized,
28660
+ index,
28661
+ indexProp,
28662
+ store
28663
+ ]);
28664
+ useIsoLayoutEffect(() => {
28665
+ if (!hasRegistered || hasItems) return;
28666
+ const visibleMap = store.state.valuesRef.current;
28667
+ visibleMap[index] = itemValue;
28668
+ if (selectionMode !== "none") store.state.allValuesRef.current.push(itemValue);
28669
+ return () => {
28670
+ delete visibleMap[index];
28671
+ };
28672
+ }, [
28673
+ hasRegistered,
28674
+ hasItems,
28675
+ index,
28676
+ itemValue,
28677
+ store,
28678
+ selectionMode
28679
+ ]);
28680
+ useIsoLayoutEffect(() => {
28681
+ if (!open) {
28682
+ didPointerDownRef.current = false;
28683
+ return;
28684
+ }
28685
+ if (!hasRegistered || hasItems) return;
28686
+ const selectedValue = store.state.selectedValue;
28687
+ const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
28688
+ if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) store.set("selectedIndex", index);
28689
+ }, [
28690
+ hasRegistered,
28691
+ hasItems,
28692
+ open,
28693
+ store,
28694
+ index,
28695
+ itemValue,
28696
+ isItemEqualToValue
28697
+ ]);
28698
+ const state = {
28699
+ disabled,
28700
+ selected,
28701
+ highlighted
28702
+ };
28703
+ const rootProps = getItemProps({
28704
+ active: highlighted,
28705
+ selected
28706
+ });
28707
+ rootProps.id = void 0;
28708
+ rootProps.onFocus = void 0;
28709
+ const { getButtonProps, buttonRef } = useButton({
28710
+ disabled,
28711
+ focusableWhenDisabled: true,
28712
+ native: nativeButton,
28713
+ composite: true
28714
+ });
28715
+ function commitSelection(nativeEvent) {
28716
+ function selectItem() {
28717
+ store.state.handleSelection(nativeEvent, itemValue);
28718
+ }
28719
+ if (store.state.submitOnItemClick) {
28720
+ ReactDOM.flushSync(selectItem);
28721
+ store.state.requestSubmit();
28722
+ } else selectItem();
28723
+ }
28724
+ const defaultProps = {
28725
+ id,
28726
+ role: isRow ? "gridcell" : "option",
28727
+ "aria-selected": selectable ? selected : void 0,
28728
+ tabIndex: void 0,
28729
+ onPointerDownCapture(event) {
28730
+ didPointerDownRef.current = true;
28731
+ event.preventDefault();
28732
+ },
28733
+ onMouseDown(event) {
28734
+ event.preventDefault();
28735
+ },
28736
+ onClick(event) {
28737
+ if (disabled || readOnly) return;
28738
+ commitSelection(event.nativeEvent);
28739
+ },
28740
+ onMouseUp(event) {
28741
+ const pointerStartedOnItem = didPointerDownRef.current;
28742
+ didPointerDownRef.current = false;
28743
+ if (disabled || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) return;
28744
+ commitSelection(event.nativeEvent);
28745
+ }
28746
+ };
28747
+ const element = useRenderElement("div", componentProps, {
28748
+ ref: [
28749
+ buttonRef,
28750
+ forwardedRef,
28751
+ listItem.ref,
28752
+ itemRef
28753
+ ],
28754
+ state,
28755
+ props: [
28756
+ rootProps,
28757
+ defaultProps,
28758
+ elementProps,
28759
+ getButtonProps
28760
+ ]
28761
+ });
28762
+ const contextValue = React.useMemo(() => ({
28763
+ selected,
28764
+ textRef
28765
+ }), [selected, textRef]);
28766
+ return /*#__PURE__*/ jsx(ComboboxItemContext.Provider, {
28767
+ value: contextValue,
28768
+ children: element
28769
+ });
28770
+ }));
28771
+ if (process.env.NODE_ENV !== "production") ComboboxItem.displayName = "ComboboxItem";
28772
+ //#endregion
28773
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item-indicator/ComboboxItemIndicator.js
28774
+ /**
28775
+ * Indicates whether the item is selected.
28776
+ * Renders a `<span>` element.
28777
+ *
28778
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28779
+ */
28780
+ var ComboboxItemIndicator = /*#__PURE__*/ React.forwardRef(function ComboboxItemIndicator(componentProps, forwardedRef) {
28781
+ const keepMounted = componentProps.keepMounted ?? false;
28782
+ const { selected } = useComboboxItemContext();
28783
+ if (!(keepMounted || selected)) return null;
28784
+ return /*#__PURE__*/ jsx(Inner, {
28785
+ ...componentProps,
28786
+ ref: forwardedRef
28787
+ });
28788
+ });
28789
+ /** The core implementation of the indicator is split here to avoid paying the hooks
28790
+ * costs unless the element needs to be mounted. */
28791
+ if (process.env.NODE_ENV !== "production") ComboboxItemIndicator.displayName = "ComboboxItemIndicator";
28792
+ var Inner = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef((componentProps, forwardedRef) => {
28793
+ const { render, className, style, keepMounted, ...elementProps } = componentProps;
28794
+ const { selected } = useComboboxItemContext();
28795
+ const indicatorRef = React.useRef(null);
28796
+ const { transitionStatus, setMounted } = useTransitionStatus(selected);
28797
+ const element = useRenderElement("span", componentProps, {
28798
+ ref: [forwardedRef, indicatorRef],
28799
+ state: {
28800
+ selected,
28801
+ transitionStatus
28802
+ },
28803
+ props: [{
28804
+ "aria-hidden": true,
28805
+ children: "✔️"
28806
+ }, elementProps],
28807
+ stateAttributesMapping: transitionStatusMapping
28808
+ });
28809
+ useOpenChangeComplete({
28810
+ open: selected,
28811
+ ref: indicatorRef,
28812
+ onComplete() {
28813
+ if (!selected) setMounted(false);
28814
+ }
28815
+ });
28816
+ return element;
28817
+ }));
28818
+ if (process.env.NODE_ENV !== "production") Inner.displayName = "Inner";
28819
+ //#endregion
28820
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/clear/ComboboxClear.js
28821
+ var stateAttributesMapping = {
28822
+ ...transitionStatusMapping,
28823
+ ...triggerOpenStateMapping
28824
+ };
28825
+ /**
28826
+ * Clears the value when clicked.
28827
+ * Renders a `<button>` element.
28828
+ *
28829
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
28830
+ */
28831
+ var ComboboxClear = /*#__PURE__*/ React.forwardRef(function ComboboxClear(componentProps, forwardedRef) {
28832
+ const { render, className, disabled: disabledProp = false, nativeButton = true, keepMounted = false, style, ...elementProps } = componentProps;
28833
+ const { disabled: fieldDisabled } = useFieldRootContext();
28834
+ const store = useComboboxRootContext();
28835
+ const selectionMode = useStore$1(store, selectors.selectionMode);
28836
+ const comboboxDisabled = useStore$1(store, selectors.disabled);
28837
+ const readOnly = useStore$1(store, selectors.readOnly);
28838
+ const open = useStore$1(store, selectors.open);
28839
+ const selectedValue = useStore$1(store, selectors.selectedValue);
28840
+ const hasSelectionChips = useStore$1(store, selectors.hasSelectionChips);
28841
+ const inputValue = useComboboxInputValueContext();
28842
+ let visible = false;
28843
+ if (selectionMode === "none") visible = inputValue !== "";
28844
+ else if (selectionMode === "single") visible = selectedValue != null;
28845
+ else visible = hasSelectionChips;
28846
+ const disabled = fieldDisabled || comboboxDisabled || disabledProp;
28847
+ const { buttonRef, getButtonProps } = useButton({
28848
+ native: nativeButton,
28849
+ disabled
28850
+ });
28851
+ const { mounted, transitionStatus, setMounted } = useTransitionStatus(visible);
28852
+ const state = {
28853
+ disabled,
28854
+ open,
28855
+ transitionStatus
28856
+ };
28857
+ useOpenChangeComplete({
28858
+ open: visible,
28859
+ ref: store.state.clearRef,
28860
+ onComplete() {
28861
+ if (!visible) setMounted(false);
28862
+ }
28863
+ });
28864
+ const element = useRenderElement("button", componentProps, {
28865
+ state,
28866
+ ref: [
28867
+ forwardedRef,
28868
+ buttonRef,
28869
+ store.state.clearRef
28870
+ ],
28871
+ props: [
28872
+ {
28873
+ tabIndex: -1,
28874
+ children: "x",
28875
+ onMouseDown(event) {
28876
+ event.preventDefault();
28877
+ },
28878
+ onClick(event) {
28879
+ if (disabled || readOnly) return;
28880
+ const keyboardActiveRef = store.state.keyboardActiveRef;
28881
+ store.state.setInputValue("", createChangeEventDetails(clearPress, event.nativeEvent));
28882
+ if (selectionMode !== "none") {
28883
+ store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(clearPress, event.nativeEvent));
28884
+ store.state.setIndices({
28885
+ activeIndex: null,
28886
+ selectedIndex: null,
28887
+ type: keyboardActiveRef.current ? "keyboard" : "pointer"
28888
+ });
28889
+ } else store.state.setIndices({
28890
+ activeIndex: null,
28891
+ type: keyboardActiveRef.current ? "keyboard" : "pointer"
28892
+ });
28893
+ store.state.inputRef.current?.focus();
28894
+ }
28895
+ },
28896
+ elementProps,
28897
+ getButtonProps
28898
+ ],
28899
+ stateAttributesMapping
28900
+ });
28901
+ if (!(keepMounted || mounted)) return null;
28902
+ return element;
28903
+ });
28904
+ if (process.env.NODE_ENV !== "production") ComboboxClear.displayName = "ComboboxClear";
25952
28905
  //#endregion
25953
28906
  //#region src/workbench/browser/runtime/editor/errorTriggerSources.tsx
25954
28907
  function ErrorTriggerSources({ flows, flowId, value, disabled = false, complete = true, footer, onChange }) {
@@ -25957,7 +28910,6 @@ function ErrorTriggerSources({ flows, flowId, value, disabled = false, complete
25957
28910
  const [query, setQuery] = useState("");
25958
28911
  const [open, setOpen] = useState(false);
25959
28912
  const [container, setContainer] = useState(null);
25960
- const search = useRef(null);
25961
28913
  const eligible = flows.filter((flow) => flow.flowId != flowId && flow.status == "active" && flow.live != null);
25962
28914
  const candidates = [.../* @__PURE__ */ new Set([...eligible.map((flow) => flow.flowId), ...value])].map((sourceId) => {
25963
28915
  const flow = flows.find((item) => item.flowId == sourceId);
@@ -25984,99 +28936,101 @@ function ErrorTriggerSources({ flows, flowId, value, disabled = false, complete
25984
28936
  /* @__PURE__ */ jsx("div", {
25985
28937
  ref: setContainer,
25986
28938
  className: "min-w-0",
25987
- children: /* @__PURE__ */ jsxs(Popover, {
28939
+ children: /* @__PURE__ */ jsxs(ComboboxRoot, {
28940
+ multiple: true,
28941
+ disabled,
28942
+ value: [...value],
28943
+ onValueChange: onChange,
28944
+ items: visible.map((flow) => flow.id),
28945
+ filter: null,
28946
+ inputValue: open ? query : summary,
28947
+ onInputValueChange: setQuery,
25988
28948
  open,
25989
28949
  onOpenChange: (next) => {
25990
28950
  setOpen(next);
25991
28951
  if (!next) setQuery("");
25992
28952
  },
25993
- children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
25994
- render: /* @__PURE__ */ jsx(Button$1, {
28953
+ children: [/* @__PURE__ */ jsxs(ComboboxInputGroup, {
28954
+ render: /* @__PURE__ */ jsx(InputGroup, {}),
28955
+ children: [/* @__PURE__ */ jsx(ComboboxInput, {
28956
+ render: /* @__PURE__ */ jsx(InputGroupInput, {}),
25995
28957
  id,
25996
- type: "button",
25997
- variant: "field",
25998
- size: "field",
25999
- disabled,
26000
- "aria-label": `${t("errorWorkflow.sources")}: ${summary || t("errorWorkflow.choose")}`,
28958
+ "aria-label": t("errorWorkflow.sources"),
26001
28959
  "aria-describedby": `${id}-hint${unavailable.length > 0 ? ` ${id}-error` : ""}`,
26002
28960
  "aria-invalid": unavailable.length > 0 || void 0,
26003
- className: "w-full min-w-0 justify-between"
26004
- }),
26005
- children: [/* @__PURE__ */ jsx("span", {
26006
- className: `min-w-0 flex-1 truncate text-left ${value.length == 0 ? "text-muted-foreground" : ""}`,
26007
- title: summary || void 0,
26008
- children: summary || t("errorWorkflow.choose")
26009
- }), /* @__PURE__ */ jsx(SelectChevron, {})]
26010
- }), /* @__PURE__ */ jsxs(PopoverContent, {
26011
- container,
26012
- align: "start",
26013
- initialFocus: search,
26014
- "aria-label": t("errorWorkflow.sources"),
26015
- className: `w-(--anchor-width) min-w-56 max-w-[calc(100vw-24px)] gap-1 ${selectionMenuContentClass}`,
26016
- children: [
26017
- /* @__PURE__ */ jsx("div", {
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)
28961
+ placeholder: open ? t("errorWorkflow.search") : t("errorWorkflow.choose"),
28962
+ title: summary || void 0
28963
+ }), /* @__PURE__ */ jsxs(InputGroupAddon, {
28964
+ align: "inline-end",
28965
+ children: [value.length > 0 && !disabled && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
28966
+ render: /* @__PURE__ */ jsx(ComboboxClear, {
28967
+ render: /* @__PURE__ */ jsx(Button$1, {
28968
+ variant: "ghost",
28969
+ size: "icon-xs"
28970
+ }),
28971
+ "aria-label": t("errorWorkflow.clear")
28972
+ }),
28973
+ children: /* @__PURE__ */ jsx("i", {
28974
+ "aria-hidden": "true",
28975
+ className: "i-lucide-light:x text-base"
26025
28976
  })
26026
- }),
26027
- /* @__PURE__ */ jsxs("div", {
26028
- role: "group",
26029
- "aria-label": t("errorWorkflow.sources"),
26030
- className: "max-h-[min(40vh,280px)] overflow-y-auto overscroll-contain",
26031
- children: [visible.map((flow) => /* @__PURE__ */ jsxs(Label, {
26032
- className: `flex cursor-default items-center gap-2 px-2 hover:bg-accent focus-within:bg-accent ${selectionMenuItemClass}`,
26033
- children: [/* @__PURE__ */ jsx(Checkbox, {
26034
- checked: value.includes(flow.id),
26035
- disabled,
26036
- onCheckedChange: (checked) => onChange(checked ? [...value, flow.id] : value.filter((item) => item != flow.id))
26037
- }), /* @__PURE__ */ jsxs("span", {
26038
- className: "min-w-0 flex-1 break-words",
26039
- children: [
26040
- flow.name,
26041
- flow.issue == "deleted" && /* @__PURE__ */ jsx("span", {
26042
- className: "block break-all text-muted-foreground",
26043
- children: flow.id
26044
- }),
26045
- flow.issue && /* @__PURE__ */ jsx("span", {
26046
- className: "block text-destructive",
26047
- children: t(`errorWorkflow.${flow.issue}`)
26048
- })
26049
- ]
28977
+ }), /* @__PURE__ */ jsx(TooltipContent, {
28978
+ container,
28979
+ children: t("errorWorkflow.clear")
28980
+ })] }), /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
28981
+ render: /* @__PURE__ */ jsx(ComboboxTrigger, {
28982
+ render: /* @__PURE__ */ jsx(Button$1, {
28983
+ variant: "ghost",
28984
+ size: "icon-xs"
28985
+ }),
28986
+ "aria-label": t("errorWorkflow.choose")
28987
+ }),
28988
+ children: /* @__PURE__ */ jsx(SelectChevron, {})
28989
+ }), /* @__PURE__ */ jsx(TooltipContent, {
28990
+ container,
28991
+ children: t("errorWorkflow.choose")
28992
+ })] })]
28993
+ })]
28994
+ }), /* @__PURE__ */ jsx(ComboboxPortal, {
28995
+ container,
28996
+ className: "contents",
28997
+ children: /* @__PURE__ */ jsx(ComboboxPositioner, {
28998
+ align: "start",
28999
+ sideOffset: 4,
29000
+ className: "isolate z-50",
29001
+ children: /* @__PURE__ */ jsxs(ComboboxPopup, {
29002
+ 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}`,
29003
+ children: [/* @__PURE__ */ jsxs(ComboboxList, {
29004
+ "aria-label": t("errorWorkflow.sources"),
29005
+ className: "max-h-[min(40vh,280px)] overflow-y-auto overscroll-contain",
29006
+ children: [visible.map((flow) => /* @__PURE__ */ jsxs(ComboboxItem, {
29007
+ value: flow.id,
29008
+ className: `group/option flex cursor-default items-center gap-2 px-2 data-highlighted:bg-accent ${selectionMenuItemClass}`,
29009
+ children: [/* @__PURE__ */ jsx("span", {
29010
+ "aria-hidden": "true",
29011
+ 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",
29012
+ children: /* @__PURE__ */ jsx(ComboboxItemIndicator, { children: /* @__PURE__ */ jsx("i", { className: "i-lucide-light:check block text-sm" }) })
29013
+ }), /* @__PURE__ */ jsxs("span", {
29014
+ className: "min-w-0 flex-1 break-words",
29015
+ children: [
29016
+ flow.name,
29017
+ flow.issue == "deleted" && /* @__PURE__ */ jsx("span", {
29018
+ className: "block break-all text-muted-foreground",
29019
+ children: flow.id
29020
+ }),
29021
+ flow.issue && /* @__PURE__ */ jsx("span", {
29022
+ className: "block text-destructive",
29023
+ children: t(`errorWorkflow.${flow.issue}`)
29024
+ })
29025
+ ]
29026
+ })]
29027
+ }, flow.id)), visible.length == 0 && /* @__PURE__ */ jsx("p", {
29028
+ className: "px-2 py-3 text-xs text-muted-foreground",
29029
+ children: t(query ? "errorWorkflow.noMatches" : "errorWorkflow.empty")
26050
29030
  })]
26051
- }, flow.id)), visible.length == 0 && /* @__PURE__ */ jsx("p", {
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
- })]
29031
+ }), footer]
26078
29032
  })
26079
- ]
29033
+ })
26080
29034
  })]
26081
29035
  })
26082
29036
  }),
@@ -26574,81 +29528,6 @@ function DefinitionField({ schema, label, disabled, onChange, options, depth = 0
26574
29528
  })
26575
29529
  });
26576
29530
  }
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
29531
  //#endregion
26653
29532
  //#region src/workbench/browser/runtime/editor/portOrder.ts
26654
29533
  /** Reordering a field preserves its group and the identities used by values and edges. */
@@ -32468,22 +35347,6 @@ function validateCronExpression(expression, timezone) {
32468
35347
  if (cron.nextRun() == null) throw new TypeError("Cron expression has no future occurrence.");
32469
35348
  }
32470
35349
  //#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
35350
  //#region src/workbench/browser/runtime/editor/triggerScheduleValidation.ts
32488
35351
  function deferScheduleCheck(check, signal) {
32489
35352
  return new Promise((resolve, reject) => {
@@ -33148,6 +36011,7 @@ function inspectorIcon(node, target) {
33148
36011
  if (node?.kind == "wait") return "wait";
33149
36012
  if (node?.kind == "subflow" || node == null && target.kind == "subflow") return "subflow";
33150
36013
  if (node?.kind == "task" && node.definition != null && "executor" in node.definition) {
36014
+ if (node.definition.executor.kind == "decision") return "decision";
33151
36015
  if (node.definition.executor.kind == "openapi") return "task";
33152
36016
  return node.definition.executor.kind == "connector" ? "connection" : "llm";
33153
36017
  }
@@ -33177,6 +36041,7 @@ function nodePurposePlaceholder(selection, t, action, displays) {
33177
36041
  if (!("executor" in definition)) return t("addNode.javascriptDescription");
33178
36042
  switch (definition.executor.kind) {
33179
36043
  case "agent": return t("addNode.agentDescription");
36044
+ case "decision": return t("decision.description");
33180
36045
  case "openapi": return t("openapi.description");
33181
36046
  case "connector": return action?.description;
33182
36047
  case "llm": return t(definition.executor.mode == "json" ? "addNode.llmStructuredDescription" : "addNode.llmChatDescription");
@@ -33233,6 +36098,7 @@ function NodeInspector({ variables = {
33233
36098
  const content = useRef(null);
33234
36099
  const task = selection?.kind == "task" ? selection.definition : void 0;
33235
36100
  const isAgent = task != null && "executor" in task && task.executor.kind == "agent";
36101
+ const isDecision = task != null && "executor" in task && task.executor.kind == "decision";
33236
36102
  const isOpenApi = task != null && "executor" in task && task.executor.kind == "openapi";
33237
36103
  const unconfiguredOpenApi = task != null && "executor" in task && task.executor.kind == "openapi" && !task.executor.path;
33238
36104
  const isLlm = task != null && "executor" in task && task.executor.kind == "llm";
@@ -33392,6 +36258,16 @@ function NodeInspector({ variables = {
33392
36258
  store?.saveTriggerSchedule(selection.id, schedule);
33393
36259
  }
33394
36260
  }, `schedule:${selection.id}`),
36261
+ selection?.kind === "task" && task != null && "executor" in task && task.executor.kind === "decision" && /* @__PURE__ */ jsx(DecisionSection, {
36262
+ task,
36263
+ disabled,
36264
+ onSave: (before, value, deletion) => store?.saveTaskSettings(selection.id, {
36265
+ kind: "decision",
36266
+ name: task.name,
36267
+ before,
36268
+ task: value
36269
+ }, deletion) ?? Promise.resolve(false)
36270
+ }, `decision:${selection.id}`),
33395
36271
  isOpenApi && task != null && "executor" in task && /* @__PURE__ */ jsx(OpenApiSection, {
33396
36272
  task,
33397
36273
  credentials: (onInvalidChange) => selection?.kind === "task" && task.inputs.filter((port) => "handle" in port && port.handle.startsWith("auth.")).map((definition) => {
@@ -33451,6 +36327,10 @@ function NodeInspector({ variables = {
33451
36327
  });
33452
36328
  const entries = definitions.filter((definition) => !isOpenApi || !("handle" in definition) || !definition.handle.startsWith("auth.")).map((definition) => {
33453
36329
  if ("group" in definition) return definition;
36330
+ if (selection.kind === "task" && selection.definition != null && "executor" in selection.definition && selection.definition.executor.kind === "decision" && definition.handle === "target") definition = {
36331
+ ...definition,
36332
+ description: t("decision.targetDescription")
36333
+ };
33454
36334
  const mapping = selection.node.inputs[definition.handle];
33455
36335
  const source = mapping?.kind === "sources" ? mapping.sources.find((item) => item.kind === "binding") : void 0;
33456
36336
  const binding = source?.kind === "binding" ? revision.binding(source.bindingId) : void 0;
@@ -33592,7 +36472,7 @@ function NodeInspector({ variables = {
33592
36472
  layout: "ports",
33593
36473
  title: t("inspector.ports.outputsTitle"),
33594
36474
  output: true,
33595
- values: selection.definition.outputs,
36475
+ values: presentDecisionOutputs(selection.definition, t),
33596
36476
  disabled: disabled || !(selection.node.task != null || isAgent),
33597
36477
  onChange: (outputs, deletion) => {
33598
36478
  store?.saveTaskPorts(selection.id, {
@@ -33631,14 +36511,21 @@ function NodeInspector({ variables = {
33631
36511
  selection,
33632
36512
  disabled,
33633
36513
  store
33634
- }), /* @__PURE__ */ jsx(GeneralSettings, {
36514
+ }), /* @__PURE__ */ jsxs(GeneralSettings, {
33635
36515
  readOnly,
33636
- title: isAgent ? t("agent.more") : void 0,
36516
+ title: isAgent || isDecision ? t("agent.more") : void 0,
33637
36517
  disabled,
33638
36518
  node: selection.node,
33639
36519
  nodeId: selection.id,
33640
36520
  store,
33641
- children: isAgent && /* @__PURE__ */ jsx(AgentAdvancedSettings, {})
36521
+ children: [isAgent && /* @__PURE__ */ jsx(AgentAdvancedSettings, {}), isDecision && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
36522
+ htmlFor: `${selection.id}-model`,
36523
+ children: t("agent.model")
36524
+ }), /* @__PURE__ */ jsx(Input$1, {
36525
+ id: `${selection.id}-model`,
36526
+ readOnly: true,
36527
+ value: "typesafe/jev"
36528
+ })] })]
33642
36529
  })] }) : selection.kind == "approval" || selection.kind == "wait" ? /* @__PURE__ */ jsx(ResolutionDefinition, {
33643
36530
  disabled,
33644
36531
  selection,
@@ -49407,7 +52294,7 @@ var markdownPreview_module_default = {
49407
52294
  };
49408
52295
  //#endregion
49409
52296
  //#region src/canvas/browser/preview/markdownPreview.tsx
49410
- var MarkdownContent = lazy(() => import("./markdownContent-D3FFc-u_.js"));
52297
+ var MarkdownContent = lazy(() => import("./markdownContent-frwDfQQU.js"));
49411
52298
  var MarkdownPreview = /* @__PURE__ */ memo(({ dark, unstyled, components, contentClassName, content, draggable, onDoubleClick }) => {
49412
52299
  const [focus, setFocus] = useState(false);
49413
52300
  return /* @__PURE__ */ jsx("div", {
@@ -56352,41 +59239,41 @@ function WorkspacePublishIsland({ hasPublications, onOpenPublications, onOpenRun
56352
59239
  })
56353
59240
  }), /* @__PURE__ */ jsxs(PopoverContent, {
56354
59241
  align: "end",
59242
+ className: "gap-4 p-0",
56355
59243
  container: popupContainer,
56356
59244
  initialFocus: cancelButton,
56357
59245
  side: "bottom",
56358
59246
  sideOffset: 8,
56359
- children: [
56360
- /* @__PURE__ */ jsx(PopoverTitle, {
59247
+ children: [/* @__PURE__ */ jsxs(PopoverHeader, {
59248
+ className: "gap-2 px-4 pt-4",
59249
+ children: [/* @__PURE__ */ jsx(PopoverTitle, {
56361
59250
  className: "m-0 text-sm",
56362
59251
  children: t("publication.publishConfirm")
56363
- }),
56364
- /* @__PURE__ */ jsx(PopoverDescription, {
59252
+ }), /* @__PURE__ */ jsx(PopoverDescription, {
56365
59253
  className: "m-0",
56366
59254
  children: t("publication.publishConfirmDescription")
56367
- }),
56368
- /* @__PURE__ */ jsxs("div", {
56369
- className: "flex justify-end gap-2",
56370
- children: [/* @__PURE__ */ jsx(Button$1, {
56371
- ref: cancelButton,
56372
- onClick: () => setConfirming(false),
56373
- size: "sm",
56374
- type: "button",
56375
- variant: "outline",
56376
- children: t("common.cancel")
56377
- }), /* @__PURE__ */ jsx(Button$1, {
56378
- disabled: state != "ready",
56379
- onClick: () => {
56380
- if (state != "ready") return;
56381
- setConfirming(false);
56382
- onPublish();
56383
- },
56384
- size: "sm",
56385
- type: "button",
56386
- children: t("publication.confirmPublish")
56387
- })]
56388
- })
56389
- ]
59255
+ })]
59256
+ }), /* @__PURE__ */ jsxs("div", {
59257
+ className: "flex justify-end gap-2 px-3 pb-3",
59258
+ children: [/* @__PURE__ */ jsx(Button$1, {
59259
+ ref: cancelButton,
59260
+ onClick: () => setConfirming(false),
59261
+ size: "sm",
59262
+ type: "button",
59263
+ variant: "outline",
59264
+ children: t("common.cancel")
59265
+ }), /* @__PURE__ */ jsx(Button$1, {
59266
+ disabled: state != "ready",
59267
+ onClick: () => {
59268
+ if (state != "ready") return;
59269
+ setConfirming(false);
59270
+ onPublish();
59271
+ },
59272
+ size: "sm",
59273
+ type: "button",
59274
+ children: t("publication.confirmPublish")
59275
+ })]
59276
+ })]
56390
59277
  })]
56391
59278
  }), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(CanvasTooltip, {
56392
59279
  getPopupContainer: () => popupContainer ?? document.body,
@@ -56554,11 +59441,11 @@ var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus
56554
59441
  ]);
56555
59442
  const triggerCandidates = triggerProviderId == null ? void 0 : store.connectorAccess.allowedTriggerCandidates(triggerProviderId, triggerId);
56556
59443
  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
59444
  const connectorActionError = useVal(store.connectors.$.selectedActionError);
56559
59445
  const connectorActionLoading = useVal(store.connectors.$.actionLoading);
56560
59446
  const connectorAuthorizationPending = useVal(store.connectors.$.selectedAuthorizationPending);
56561
59447
  const connectorConnection = useVal(store.connectors.$.selectedConnection);
59448
+ const accessError = providerId != null && connectorAccess?.mode == "selectable" && allowedCandidates?.length == 0 && (connectorConnection == null || connectorConnection.status == "active") ? t("connectorAccess.noAvailablePermissions") : void 0;
56562
59449
  const connectorConnectionError = useVal(store.connectors.$.selectedConnectionError);
56563
59450
  const connectorConnectionLoading = useVal(store.connectors.$.connectionLoading);
56564
59451
  const activeConnectorConnections = useVal(store.connectors.$.selectedActiveConnections);
@@ -56589,7 +59476,7 @@ var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus
56589
59476
  connectorAccessError: accessError,
56590
59477
  connectorActionError,
56591
59478
  connectorAuthorizationPending,
56592
- connectorConnection: connectorAccess?.mode == "selectable" && allowedCandidates != null && !allowedCandidates.some((candidate) => candidate.connectionId == connectorConnection?.connectionId) ? void 0 : connectorConnection,
59479
+ connectorConnection: connectorConnection?.status == "active" && connectorAccess?.mode == "selectable" && allowedCandidates != null && !allowedCandidates.some((candidate) => candidate.connectionId == connectorConnection?.connectionId) ? void 0 : connectorConnection,
56593
59480
  connectorConnectionError,
56594
59481
  activeConnectorConnections: connectorAccess?.mode == "selectable" && providerId != null ? activeConnectorConnections?.filter((connection) => allowedCandidates?.some((candidate) => candidate.connectionId == connection.connectionId)) : activeConnectorConnections,
56595
59482
  connectors: store.connectors,