@sanity/ui 4.0.0-static.31 → 4.0.0-static.33

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 (47) hide show
  1. package/dist/index.d.ts +8 -1
  2. package/dist/index.js +1080 -512
  3. package/dist/index.js.map +1 -1
  4. package/package.json +9 -10
  5. package/src/core/components/autocomplete/Autocomplete.tsx +80 -48
  6. package/src/core/components/breadcrumbs/Breadcrumbs.tsx +74 -41
  7. package/src/core/components/dialog/DialogContext.ts +1 -1
  8. package/src/core/components/dialog/__workshop__/Panes.tsx +5 -21
  9. package/src/core/components/dialog/__workshop__/styles.css.ts +18 -0
  10. package/src/core/components/menu/Menu.test.tsx +2 -6
  11. package/src/core/components/menu/Menu.tsx +13 -14
  12. package/src/core/components/menu/MenuContext.ts +2 -3
  13. package/src/core/components/menu/MenuGroup.tsx +2 -0
  14. package/src/core/components/menu/useMenu.ts +2 -2
  15. package/src/core/components/menu/useMenuController.ts +5 -5
  16. package/src/core/components/toast/ToastContext.ts +1 -1
  17. package/src/core/components/tree/Tree.tsx +1 -0
  18. package/src/core/components/tree/TreeContext.ts +1 -1
  19. package/src/core/components/tree/TreeItem.tsx +17 -14
  20. package/src/core/components/virtualList/VirtualList.tsx +86 -44
  21. package/src/core/hooks/useGlobalKeyDown.ts +11 -4
  22. package/src/core/lib/createGlobalScopedContext.ts +5 -3
  23. package/src/core/primitives/avatar/Avatar.tsx +1 -0
  24. package/src/core/primitives/button/Button.tsx +2 -1
  25. package/src/core/primitives/button/__workshop__/SanityUploadButton.tsx +10 -25
  26. package/src/core/primitives/button/__workshop__/Styled1.tsx +2 -8
  27. package/src/core/primitives/button/__workshop__/index.ts +0 -5
  28. package/src/core/primitives/button/__workshop__/styles.css.ts +30 -0
  29. package/src/core/primitives/card/CardContext.ts +1 -1
  30. package/src/core/primitives/card/__workshop__/Styled.tsx +2 -5
  31. package/src/core/primitives/flex/__workshop__/Example.tsx +7 -15
  32. package/src/core/primitives/flex/__workshop__/styles.css.ts +12 -0
  33. package/src/core/primitives/inline/Inline.tsx +1 -0
  34. package/src/core/primitives/layer/LayerContext.ts +1 -1
  35. package/src/core/primitives/popover/Popover.tsx +146 -130
  36. package/src/core/primitives/popover/floating-ui/size.ts +17 -16
  37. package/src/core/primitives/skeleton/Skeleton.tsx +2 -2
  38. package/src/core/primitives/text/__workshop__/Colored.tsx +5 -10
  39. package/src/core/primitives/tooltip/Tooltip.tsx +69 -41
  40. package/src/core/primitives/tooltip/tooltipDelayGroup/TooltipDelayGroupContext.tsx +1 -1
  41. package/src/core/utils/boundaryElement/BoundaryElementContext.ts +1 -1
  42. package/src/core/utils/elementQuery/__workshop__/CustomMedia.tsx +3 -25
  43. package/src/core/utils/elementQuery/__workshop__/styles.css.ts +31 -0
  44. package/src/core/utils/portal/Portal.test.tsx +6 -6
  45. package/src/core/utils/portal/PortalContext.ts +1 -1
  46. package/src/core/utils/portal/PortalProvider.tsx +5 -37
  47. package/src/core/primitives/button/__workshop__/Styled2.tsx +0 -19
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { SpinnerIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
3
- import { useState, isValidElement, useDebugValue, useSyncExternalStore, createContext, use, useRef, useImperativeHandle, useEffect, useMemo, useCallback, cloneElement, useReducer, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
4
2
  import { c } from "react/compiler-runtime";
3
+ import { SpinnerIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
4
+ import { useState, isValidElement, useDebugValue, useSyncExternalStore, createContext, use, useRef, useImperativeHandle, useEffect, cloneElement, useReducer, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
5
5
  import { box, text, textOverflow, animatedSpinnerIcon, spinner, button, buttonLoadingBox, _arrow, vars, _arrowSvg, _arrowStrokeMask, _arrowStroke, _arrowShape, card, BREAKPOINTS, popoverCard, popover, _selectable, stack, textInput, textInputPrefix, textInputElement, _inputElement, _inputPresentation, textInputSuffix, breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, kbd, menu, menuDivider, toast, toastLayer, treeItem, label, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, tooltip, root } from "@sanity/ui/css";
6
6
  import { isValidElementType } from "react-is";
7
- import { detectOverflow, autoPlacement, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
7
+ import { detectOverflow, useFloating, autoPlacement, flip, offset, shift, arrow, hide, autoUpdate } from "@floating-ui/react-dom";
8
8
  import { motion, AnimatePresence } from "framer-motion";
9
9
  import { createPortal } from "react-dom";
10
10
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -353,77 +353,79 @@ function Spinner(props) {
353
353
  }
354
354
  const DEFAULT_BUTTON_ELEMENT = "button";
355
355
  function Button(props) {
356
- const {
357
- align = "center",
358
- as: Element2 = DEFAULT_BUTTON_ELEMENT,
359
- children,
356
+ const $ = c(88), t0 = props;
357
+ let Element2, IconComponent, IconRightComponent, align, children, className, disabled, flex, fontSize, gap, gapX, gapY, href, justify, loading, mode, muted, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, radius, rest, selected, text2, textAlign, textOverflow2, textWeight, tone, type, width;
358
+ if ($[0] !== props.padding || $[1] !== t0) {
359
+ const {
360
+ align: t12,
361
+ as: t22,
362
+ children: t32,
363
+ className: t42,
364
+ disabled: t52,
365
+ flex: t62,
366
+ fontSize: t72,
367
+ gap: _gap,
368
+ gapX: t82,
369
+ gapY: t92,
370
+ icon: t10,
371
+ iconRight: t11,
372
+ justify: t122,
373
+ loading: t13,
374
+ mode: t14,
375
+ muted: t15,
376
+ padding: t16,
377
+ paddingX: t17,
378
+ paddingY: t18,
379
+ paddingTop: t19,
380
+ paddingBottom: t20,
381
+ paddingLeft: t21,
382
+ paddingRight: t222,
383
+ radius: t23,
384
+ selected: t24,
385
+ text: t25,
386
+ textAlign: t26,
387
+ textOverflow: t27,
388
+ textWeight: t28,
389
+ tone: t29,
390
+ type: t30,
391
+ width: t31,
392
+ ...t322
393
+ } = t0;
394
+ children = t32, className = t42, disabled = t52, flex = t62, gapX = t82, gapY = t92, IconComponent = t10, IconRightComponent = t11, loading = t13, paddingX = t17, paddingY = t18, paddingTop = t19, paddingBottom = t20, paddingLeft = t21, paddingRight = t222, selected = t24, text2 = t25, textAlign = t26, width = t31, rest = t322, align = t12 === void 0 ? "center" : t12, Element2 = t22 === void 0 ? DEFAULT_BUTTON_ELEMENT : t22, fontSize = t72 === void 0 ? 1 : t72, justify = t122 === void 0 ? "center" : t122, mode = t14 === void 0 ? "default" : t14, muted = t15 === void 0 ? !1 : t15, padding = t16 === void 0 ? 3 : t16, radius = t23 === void 0 ? 2 : t23, textOverflow2 = t27 === void 0 ? "ellipsis" : t27, textWeight = t28 === void 0 ? "medium" : t28, tone = t29 === void 0 ? "default" : t29, type = t30 === void 0 ? "button" : t30, gap = _gap ?? props.padding ?? 3, href = void 0, "href" in rest && (href = typeof rest.href == "string" ? rest.href : void 0, delete rest.href), $[0] = props.padding, $[1] = t0, $[2] = Element2, $[3] = IconComponent, $[4] = IconRightComponent, $[5] = align, $[6] = children, $[7] = className, $[8] = disabled, $[9] = flex, $[10] = fontSize, $[11] = gap, $[12] = gapX, $[13] = gapY, $[14] = href, $[15] = justify, $[16] = loading, $[17] = mode, $[18] = muted, $[19] = padding, $[20] = paddingBottom, $[21] = paddingLeft, $[22] = paddingRight, $[23] = paddingTop, $[24] = paddingX, $[25] = paddingY, $[26] = radius, $[27] = rest, $[28] = selected, $[29] = text2, $[30] = textAlign, $[31] = textOverflow2, $[32] = textWeight, $[33] = tone, $[34] = type, $[35] = width;
395
+ } else
396
+ Element2 = $[2], IconComponent = $[3], IconRightComponent = $[4], align = $[5], children = $[6], className = $[7], disabled = $[8], flex = $[9], fontSize = $[10], gap = $[11], gapX = $[12], gapY = $[13], href = $[14], justify = $[15], loading = $[16], mode = $[17], muted = $[18], padding = $[19], paddingBottom = $[20], paddingLeft = $[21], paddingRight = $[22], paddingTop = $[23], paddingX = $[24], paddingY = $[25], radius = $[26], rest = $[27], selected = $[28], text2 = $[29], textAlign = $[30], textOverflow2 = $[31], textWeight = $[32], tone = $[33], type = $[34], width = $[35];
397
+ let t1;
398
+ $[36] !== className || $[37] !== flex || $[38] !== mode || $[39] !== radius || $[40] !== tone || $[41] !== width ? (t1 = button({
360
399
  className,
361
- disabled,
362
400
  flex,
363
- fontSize = 1,
364
- gap = props.padding ?? 3,
365
- gapX,
366
- gapY,
367
- icon: IconComponent,
368
- iconRight: IconRightComponent,
369
- justify = "center",
370
- loading,
371
- mode = "default",
372
- muted = !1,
373
- padding = 3,
374
- paddingX,
375
- paddingY,
376
- paddingTop,
377
- paddingBottom,
378
- paddingLeft,
379
- paddingRight,
380
- radius = 2,
381
- selected,
382
- text: text2,
383
- textAlign,
384
- textOverflow: textOverflow2 = "ellipsis",
385
- textWeight = "medium",
386
- tone = "default",
387
- type = "button",
388
- width,
389
- ...rest
390
- } = props;
391
- let href;
392
- return "href" in rest && (href = typeof rest.href == "string" ? rest.href : href, delete rest.href), /* @__PURE__ */ jsxs(
393
- Element2,
394
- {
395
- "data-ui": "Button",
396
- ...rest,
397
- className: button({
398
- className,
399
- flex,
400
- mode,
401
- radius,
402
- tone,
403
- width
404
- }),
405
- "data-disabled": loading || disabled ? "" : props["data-disabled"],
406
- "data-selected": selected ? "" : props["data-selected"],
407
- disabled: !!(loading || disabled),
408
- href: disabled ? void 0 : href,
409
- type,
410
- children: [
411
- !!loading && /* @__PURE__ */ jsx(Box, { alignItems: "center", as: "span", className: buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize }) }),
412
- (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
413
- IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
414
- isValidElement(IconComponent) && IconComponent,
415
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
416
- ] }),
417
- text2 && /* @__PURE__ */ jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow: textOverflow2, weight: textWeight, children: text2 }) }),
418
- IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
419
- isValidElement(IconRightComponent) && IconRightComponent,
420
- isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
421
- ] })
422
- ] }),
423
- children && /* @__PURE__ */ jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children })
424
- ]
425
- }
426
- );
401
+ mode,
402
+ radius,
403
+ tone,
404
+ width
405
+ }), $[36] = className, $[37] = flex, $[38] = mode, $[39] = radius, $[40] = tone, $[41] = width, $[42] = t1) : t1 = $[42];
406
+ const t2 = loading || disabled ? "" : props["data-disabled"], t3 = selected ? "" : props["data-selected"], t4 = !!(loading || disabled), t5 = disabled ? void 0 : href;
407
+ let t6;
408
+ $[43] !== fontSize || $[44] !== loading ? (t6 = !!loading && /* @__PURE__ */ jsx(Box, { alignItems: "center", as: "span", className: buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize }) }), $[43] = fontSize, $[44] = loading, $[45] = t6) : t6 = $[45];
409
+ let t7;
410
+ $[46] !== IconComponent || $[47] !== IconRightComponent || $[48] !== align || $[49] !== fontSize || $[50] !== gap || $[51] !== gapX || $[52] !== gapY || $[53] !== justify || $[54] !== muted || $[55] !== padding || $[56] !== paddingBottom || $[57] !== paddingLeft || $[58] !== paddingRight || $[59] !== paddingTop || $[60] !== paddingX || $[61] !== paddingY || $[62] !== text2 || $[63] !== textAlign || $[64] !== textOverflow2 || $[65] !== textWeight ? (t7 = (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
411
+ IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
412
+ isValidElement(IconComponent) && IconComponent,
413
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
414
+ ] }),
415
+ text2 && /* @__PURE__ */ jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow: textOverflow2, weight: textWeight, children: text2 }) }),
416
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
417
+ isValidElement(IconRightComponent) && IconRightComponent,
418
+ isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
419
+ ] })
420
+ ] }), $[46] = IconComponent, $[47] = IconRightComponent, $[48] = align, $[49] = fontSize, $[50] = gap, $[51] = gapX, $[52] = gapY, $[53] = justify, $[54] = muted, $[55] = padding, $[56] = paddingBottom, $[57] = paddingLeft, $[58] = paddingRight, $[59] = paddingTop, $[60] = paddingX, $[61] = paddingY, $[62] = text2, $[63] = textAlign, $[64] = textOverflow2, $[65] = textWeight, $[66] = t7) : t7 = $[66];
421
+ let t8;
422
+ $[67] !== children || $[68] !== padding || $[69] !== paddingBottom || $[70] !== paddingLeft || $[71] !== paddingRight || $[72] !== paddingTop || $[73] !== paddingX || $[74] !== paddingY ? (t8 = children && /* @__PURE__ */ jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children }), $[67] = children, $[68] = padding, $[69] = paddingBottom, $[70] = paddingLeft, $[71] = paddingRight, $[72] = paddingTop, $[73] = paddingX, $[74] = paddingY, $[75] = t8) : t8 = $[75];
423
+ let t9;
424
+ return $[76] !== Element2 || $[77] !== rest || $[78] !== t1 || $[79] !== t2 || $[80] !== t3 || $[81] !== t4 || $[82] !== t5 || $[83] !== t6 || $[84] !== t7 || $[85] !== t8 || $[86] !== type ? (t9 = /* @__PURE__ */ jsxs(Element2, { "data-ui": "Button", ...rest, className: t1, "data-disabled": t2, "data-selected": t3, disabled: t4, href: t5, type, children: [
425
+ t6,
426
+ t7,
427
+ t8
428
+ ] }), $[76] = Element2, $[77] = rest, $[78] = t1, $[79] = t2, $[80] = t3, $[81] = t4, $[82] = t5, $[83] = t6, $[84] = t7, $[85] = t8, $[86] = type, $[87] = t9) : t9 = $[87], t9;
427
429
  }
428
430
  function useMatchMedia(mediaQueryString, getServerSnapshot2) {
429
431
  const $ = c(4);
@@ -437,9 +439,9 @@ function useMatchMedia(mediaQueryString, getServerSnapshot2) {
437
439
  return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], useSyncExternalStore(t0, t1, getServerSnapshot2);
438
440
  }
439
441
  function usePrefersReducedMotion(t0) {
440
- return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$a : t0);
442
+ return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$c : t0);
441
443
  }
442
- function _temp$a() {
444
+ function _temp$c() {
443
445
  return !1;
444
446
  }
445
447
  const origin = {
@@ -483,12 +485,14 @@ function getGlobalScope() {
483
485
  const globalScope = getGlobalScope();
484
486
  function createGlobalScopedContext(key2, defaultValue) {
485
487
  const symbol = Symbol.for(key2);
486
- if (typeof document > "u")
487
- return createContext(defaultValue);
488
+ if (typeof document > "u") {
489
+ const context = createContext(defaultValue);
490
+ return context.displayName = key2, context;
491
+ }
488
492
  const symbolMap = globalScope;
489
493
  return symbolMap[symbol] = symbolMap[symbol] || createContext(defaultValue), symbolMap[symbol];
490
494
  }
491
- const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v3/boundaryElement", null), DEFAULT_VALUE = {
495
+ const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v4/boundaryElement", null), DEFAULT_VALUE = {
492
496
  version: 0,
493
497
  element: null
494
498
  };
@@ -502,7 +506,7 @@ function getElementRef(element) {
502
506
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
503
507
  return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
504
508
  }
505
- const CardContext = createGlobalScopedContext("@sanity/ui/v3/card", null);
509
+ const CardContext = createGlobalScopedContext("@sanity/ui/v4/card", null);
506
510
  function CardProvider(props) {
507
511
  const $ = c(7), {
508
512
  children,
@@ -526,7 +530,7 @@ function useCard() {
526
530
  throw new Error("useCard(): missing context value");
527
531
  return card2;
528
532
  }
529
- const key = "@sanity/ui/v3/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
533
+ const key = "@sanity/ui/v4/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
530
534
  elementMap[elementKey] = null;
531
535
  const defaultContextValue = {
532
536
  version: 0,
@@ -564,7 +568,7 @@ function getLayerContext(contextValue) {
564
568
  return contextValue;
565
569
  throw new Error("could not get layer context");
566
570
  }
567
- const LayerContext = createGlobalScopedContext("@sanity/ui/v3/layer", null);
571
+ const LayerContext = createGlobalScopedContext("@sanity/ui/v4/layer", null);
568
572
  function useLayer() {
569
573
  const value = use(LayerContext);
570
574
  if (!value)
@@ -591,9 +595,11 @@ const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER
591
595
  };
592
596
  function size(options) {
593
597
  const {
594
- apply,
595
598
  margins,
596
- padding = 0
599
+ padding = 0,
600
+ constrainSize,
601
+ matchReferenceWidth,
602
+ referenceWidthRef
597
603
  } = options;
598
604
  return {
599
605
  name: "@sanity/ui/size",
@@ -615,12 +621,9 @@ function size(options) {
615
621
  });
616
622
  let maxWidth = 1 / 0, maxHeight = 1 / 0;
617
623
  const floatingW = floating.width, floatingH = floating.height;
618
- placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom)), apply({
619
- availableWidth: maxWidth - margins[1] - margins[3],
620
- availableHeight: maxHeight - margins[0] - margins[2],
621
- elements,
622
- referenceWidth: reference.width - margins[1] - margins[3]
623
- });
624
+ placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom));
625
+ const availableWidth = maxWidth - margins[1] - margins[3], availableHeight = maxHeight - margins[0] - margins[2], referenceWidth = reference.width - margins[1] - margins[3];
626
+ referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
624
627
  const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
625
628
  return floatingW !== targetW || floatingH !== targetH ? {
626
629
  reset: {
@@ -907,13 +910,13 @@ function LayerProvider(props) {
907
910
  [childLevel]: prevLen + 1
908
911
  };
909
912
  return setSize(Object.keys(nextState).length), nextState;
910
- }) : setSize(_temp$9), () => {
913
+ }) : setSize(_temp$b), () => {
911
914
  childLevel !== void 0 ? setChildLayers((state_0) => {
912
915
  const nextState_0 = {
913
916
  ...state_0
914
917
  };
915
918
  return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
916
- }) : setSize(_temp2$2), parentDispose?.();
919
+ }) : setSize(_temp2$3), parentDispose?.();
917
920
  };
918
921
  }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
919
922
  const registerChild = t3;
@@ -932,10 +935,10 @@ function LayerProvider(props) {
932
935
  let t7;
933
936
  return $[16] !== children || $[17] !== value ? (t7 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t7) : t7 = $[18], t7;
934
937
  }
935
- function _temp2$2(v_0) {
938
+ function _temp2$3(v_0) {
936
939
  return v_0 - 1;
937
940
  }
938
- function _temp$9(v) {
941
+ function _temp$b(v) {
939
942
  return v + 1;
940
943
  }
941
944
  const DEFAULT_LAYER_ELEMENT = "div";
@@ -1036,77 +1039,80 @@ function ViewportOverlay() {
1036
1039
  } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
1037
1040
  }
1038
1041
  function Popover(props) {
1039
- const boundaryElementContext = useBoundaryElement(), {
1040
- __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
1041
- animate: _animate = !1,
1042
- arrow: arrowProp = !1,
1043
- as = DEFAULT_POPOVER_ELEMENT,
1044
- children: childProp,
1045
- className,
1046
- constrainSize = !1,
1047
- content: content2,
1048
- disabled,
1049
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
1042
+ const $ = c(111), boundaryElementContext = useBoundaryElement(), t0 = props;
1043
+ let _fallbackPlacements, _floatingBoundary, _referenceBoundary, childProp, className, content2, disabled, forwardedRef, matchReferenceWidth, modal, open, padding, portal, referenceElement, rest, scheme, t1, t10, t11, t12, t13, t14, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
1044
+ if ($[0] !== t0) {
1045
+ const {
1046
+ __unstable_margins: t152,
1047
+ animate: t162,
1048
+ arrow: t172,
1049
+ as: t182,
1050
+ children: t192,
1051
+ className: t202,
1052
+ constrainSize: t212,
1053
+ content: t222,
1054
+ disabled: t232,
1055
+ fallbackPlacements: t242,
1056
+ matchReferenceWidth: t252,
1057
+ floatingBoundary: t262,
1058
+ modal: t272,
1059
+ onActivate,
1060
+ open: t282,
1061
+ overflow: t292,
1062
+ padding: t302,
1063
+ placement: t312,
1064
+ placementStrategy: t32,
1065
+ portal: t33,
1066
+ preventOverflow: t34,
1067
+ radius: t35,
1068
+ ref: t36,
1069
+ referenceBoundary: t37,
1070
+ referenceElement: t38,
1071
+ scheme: t39,
1072
+ shadow: t40,
1073
+ tone: t41,
1074
+ width: t42,
1075
+ zOffset: t43,
1076
+ updateRef: t44,
1077
+ ...t45
1078
+ } = t0;
1079
+ t1 = t152, t2 = t162, t3 = t172, t4 = t182, childProp = t192, className = t202, t5 = t212, content2 = t222, disabled = t232, _fallbackPlacements = t242, matchReferenceWidth = t252, _floatingBoundary = t262, modal = t272, open = t282, t6 = t292, padding = t302, t7 = t312, t8 = t32, portal = t33, t9 = t34, t10 = t35, forwardedRef = t36, _referenceBoundary = t37, referenceElement = t38, scheme = t39, t11 = t40, t12 = t41, t13 = t42, t14 = t43, updateRef = t44, rest = t45, $[0] = t0, $[1] = _fallbackPlacements, $[2] = _floatingBoundary, $[3] = _referenceBoundary, $[4] = childProp, $[5] = className, $[6] = content2, $[7] = disabled, $[8] = forwardedRef, $[9] = matchReferenceWidth, $[10] = modal, $[11] = open, $[12] = padding, $[13] = portal, $[14] = referenceElement, $[15] = rest, $[16] = scheme, $[17] = t1, $[18] = t10, $[19] = t11, $[20] = t12, $[21] = t13, $[22] = t14, $[23] = t2, $[24] = t3, $[25] = t4, $[26] = t5, $[27] = t6, $[28] = t7, $[29] = t8, $[30] = t9, $[31] = updateRef;
1080
+ } else
1081
+ _fallbackPlacements = $[1], _floatingBoundary = $[2], _referenceBoundary = $[3], childProp = $[4], className = $[5], content2 = $[6], disabled = $[7], forwardedRef = $[8], matchReferenceWidth = $[9], modal = $[10], open = $[11], padding = $[12], portal = $[13], referenceElement = $[14], rest = $[15], scheme = $[16], t1 = $[17], t10 = $[18], t11 = $[19], t12 = $[20], t13 = $[21], t14 = $[22], t2 = $[23], t3 = $[24], t4 = $[25], t5 = $[26], t6 = $[27], t7 = $[28], t8 = $[29], t9 = $[30], updateRef = $[31];
1082
+ const margins = t1 === void 0 ? DEFAULT_POPOVER_MARGINS : t1, _animate = t2 === void 0 ? !1 : t2, arrowProp = t3 === void 0 ? !1 : t3, as = t4 === void 0 ? DEFAULT_POPOVER_ELEMENT : t4, constrainSize = t5 === void 0 ? !1 : t5, overflow = t6 === void 0 ? "hidden" : t6, placementProp = t7 === void 0 ? "bottom" : t7, placementStrategy = t8 === void 0 ? "flip" : t8, preventOverflow = t9 === void 0 ? !0 : t9, radius = t10 === void 0 ? 3 : t10, shadow = t11 === void 0 ? 3 : t11, tone = t12 === void 0 ? "inherit" : t12, widthProp = t13 === void 0 ? "auto" : t13, zOffsetProp = t14 === void 0 ? Z_OFFSETS.popover : t14, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElementContext.element, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null);
1083
+ let t15;
1084
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => ref.current, $[32] = t15) : t15 = $[32], useImperativeHandle(forwardedRef, t15);
1085
+ const referenceWidthRef = useRef(void 0);
1086
+ let t16;
1087
+ $[33] !== animate || $[34] !== arrowProp || $[35] !== constrainSize || $[36] !== fallbackPlacements || $[37] !== floatingBoundary || $[38] !== margins || $[39] !== matchReferenceWidth || $[40] !== placementProp || $[41] !== placementStrategy || $[42] !== preventOverflow || $[43] !== referenceBoundary ? (t16 = {
1088
+ animate,
1089
+ arrowProp,
1090
+ arrowRef,
1091
+ constrainSize,
1092
+ fallbackPlacements,
1093
+ floatingBoundary,
1094
+ margins,
1050
1095
  matchReferenceWidth,
1051
- floatingBoundary = boundaryElementContext.element,
1052
- modal,
1053
- onActivate,
1054
- open,
1055
- overflow = "hidden",
1056
- padding,
1057
- placement: placementProp = "bottom",
1058
- placementStrategy = "flip",
1059
- portal,
1060
- preventOverflow = !0,
1061
- radius = 3,
1062
- ref: forwardedRef,
1063
- referenceBoundary = boundaryElementContext.element,
1064
- referenceElement,
1065
- scheme,
1066
- shadow = 3,
1067
- tone = "inherit",
1068
- width: widthProp = "auto",
1069
- zOffset: zOffsetProp = Z_OFFSETS.popover,
1070
- updateRef,
1071
- ...rest
1072
- } = props, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
1073
- useImperativeHandle(forwardedRef, () => ref.current);
1074
- const referenceWidthRef = useRef(void 0), middleware = useMemo(() => {
1075
- const ret = [];
1076
- return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(autoPlacement({
1077
- allowedPlacements: [placementProp].concat(fallbackPlacements)
1078
- })) : ret.push(flip({
1079
- boundary: floatingBoundary || void 0,
1080
- fallbackPlacements,
1081
- padding: DEFAULT_POPOVER_PADDING,
1082
- rootBoundary
1083
- }))), ret.push(offset({
1084
- mainAxis: DEFAULT_POPOVER_DISTANCE
1085
- })), (constrainSize || matchReferenceWidth) && ret.push(size({
1086
- apply({
1087
- availableWidth,
1088
- availableHeight,
1089
- elements,
1090
- referenceWidth
1091
- }) {
1092
- referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1093
- },
1094
- boundaryElement: floatingBoundary || void 0,
1095
- margins,
1096
- padding: DEFAULT_POPOVER_PADDING
1097
- })), preventOverflow && ret.push(shift({
1098
- boundary: floatingBoundary || void 0,
1099
- rootBoundary,
1100
- padding: DEFAULT_POPOVER_PADDING
1101
- })), arrowProp && ret.push(arrow({
1102
- element: arrowRef,
1103
- padding: DEFAULT_POPOVER_PADDING
1104
- })), animate && ret.push(origin), ret.push(hide({
1105
- boundary: referenceBoundary || void 0,
1106
- padding: DEFAULT_POPOVER_PADDING,
1107
- strategy: "referenceHidden"
1108
- })), ret;
1109
- }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1096
+ placementProp,
1097
+ placementStrategy,
1098
+ preventOverflow,
1099
+ referenceBoundary,
1100
+ referenceWidthRef,
1101
+ rootBoundary: "viewport"
1102
+ }, $[33] = animate, $[34] = arrowProp, $[35] = constrainSize, $[36] = fallbackPlacements, $[37] = floatingBoundary, $[38] = margins, $[39] = matchReferenceWidth, $[40] = placementProp, $[41] = placementStrategy, $[42] = preventOverflow, $[43] = referenceBoundary, $[44] = t16) : t16 = $[44];
1103
+ const middleware = useMiddleware$1(t16);
1104
+ let t17;
1105
+ $[45] !== referenceElement ? (t17 = referenceElement ? {
1106
+ reference: referenceElement
1107
+ } : void 0, $[45] = referenceElement, $[46] = t17) : t17 = $[46];
1108
+ let t18;
1109
+ $[47] !== middleware || $[48] !== placementProp || $[49] !== t17 ? (t18 = {
1110
+ middleware,
1111
+ placement: placementProp,
1112
+ whileElementsMounted: autoUpdate,
1113
+ elements: t17
1114
+ }, $[47] = middleware, $[48] = placementProp, $[49] = t17, $[50] = t18) : t18 = $[50];
1115
+ const {
1110
1116
  x,
1111
1117
  y,
1112
1118
  middlewareData,
@@ -1114,38 +1120,139 @@ function Popover(props) {
1114
1120
  refs,
1115
1121
  strategy,
1116
1122
  update
1117
- } = useFloating({
1118
- middleware,
1119
- placement: placementProp,
1120
- whileElementsMounted: autoUpdate,
1121
- elements: referenceElement ? {
1122
- reference: referenceElement
1123
- } : void 0
1124
- }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = useCallback((arrowEl) => {
1125
- arrowRef.current = arrowEl;
1126
- }, []), setFloating = useCallback((node) => {
1123
+ } = useFloating(t18), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY;
1124
+ let t19;
1125
+ $[51] !== refs ? (t19 = (node) => {
1127
1126
  ref.current = node, refs.setFloating(node);
1128
- }, [refs]), setReference = useCallback((node_0) => {
1129
- if (refs.setReference(node_0), !childProp) return;
1130
- const childRef = getElementRef(childProp);
1131
- typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
1132
- }, [childProp, refs]), child = useMemo(() => referenceElement ? childProp : childProp ? cloneElement(childProp, {
1133
- ref: setReference
1134
- }) : null, [childProp, referenceElement, setReference]);
1135
- if (useEffect(() => {
1136
- updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
1137
- }, [update, updateRef]), disabled)
1138
- return childProp || /* @__PURE__ */ jsx(Fragment, {});
1139
- const node_1 = /* @__PURE__ */ jsxs(Fragment, { children: [
1140
- modal && /* @__PURE__ */ jsx(ViewportOverlay, {}),
1141
- /* @__PURE__ */ jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: popover({
1142
- className
1143
- }), hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, tone, strategy, x, y, zOffset, children: content2 })
1144
- ] }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_1 }) }) : node_1);
1145
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1146
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
1127
+ }, $[51] = refs, $[52] = t19) : t19 = $[52];
1128
+ const setFloating = t19;
1129
+ let t20;
1130
+ $[53] !== childProp ? (t20 = childProp ? getElementRef(childProp) : null, $[53] = childProp, $[54] = t20) : t20 = $[54];
1131
+ let t21;
1132
+ $[55] !== refs.reference.current ? (t21 = () => refs.reference.current, $[55] = refs.reference.current, $[56] = t21) : t21 = $[56], useImperativeHandle(t20, t21);
1133
+ let t22;
1134
+ bb0: {
1135
+ if (referenceElement) {
1136
+ t22 = childProp;
1137
+ break bb0;
1138
+ }
1139
+ if (!childProp) {
1140
+ t22 = null;
1141
+ break bb0;
1142
+ }
1143
+ let t232;
1144
+ $[57] !== childProp || $[58] !== refs.setReference ? (t232 = cloneElement(childProp, {
1145
+ ref: refs.setReference
1146
+ }), $[57] = childProp, $[58] = refs.setReference, $[59] = t232) : t232 = $[59], t22 = t232;
1147
+ }
1148
+ const child = t22;
1149
+ let t23, t24;
1150
+ if ($[60] !== update ? (t23 = () => update, t24 = [update], $[60] = update, $[61] = t23, $[62] = t24) : (t23 = $[61], t24 = $[62]), useImperativeHandle(updateRef, t23, t24), disabled) {
1151
+ let t252;
1152
+ return $[63] !== childProp ? (t252 = childProp || /* @__PURE__ */ jsx(Fragment, {}), $[63] = childProp, $[64] = t252) : t252 = $[64], t252;
1153
+ }
1154
+ let t25;
1155
+ $[65] !== modal ? (t25 = modal && /* @__PURE__ */ jsx(ViewportOverlay, {}), $[65] = modal, $[66] = t25) : t25 = $[66];
1156
+ let t26;
1157
+ $[67] !== className ? (t26 = popover({
1158
+ className
1159
+ }), $[67] = className, $[68] = t26) : t26 = $[68];
1160
+ let t27;
1161
+ $[69] !== animate || $[70] !== arrowProp || $[71] !== arrowX || $[72] !== arrowY || $[73] !== as || $[74] !== content2 || $[75] !== margins || $[76] !== originX || $[77] !== originY || $[78] !== overflow || $[79] !== padding || $[80] !== placement || $[81] !== radius || $[82] !== referenceHidden || $[83] !== rest || $[84] !== scheme || $[85] !== setFloating || $[86] !== shadow || $[87] !== strategy || $[88] !== t26 || $[89] !== tone || $[90] !== widthProp || $[91] !== x || $[92] !== y || $[93] !== zOffset ? (t27 = /* @__PURE__ */ jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef, arrowX, arrowY, as, className: t26, hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, tone, strategy, x, y, zOffset, children: content2 }), $[69] = animate, $[70] = arrowProp, $[71] = arrowX, $[72] = arrowY, $[73] = as, $[74] = content2, $[75] = margins, $[76] = originX, $[77] = originY, $[78] = overflow, $[79] = padding, $[80] = placement, $[81] = radius, $[82] = referenceHidden, $[83] = rest, $[84] = scheme, $[85] = setFloating, $[86] = shadow, $[87] = strategy, $[88] = t26, $[89] = tone, $[90] = widthProp, $[91] = x, $[92] = y, $[93] = zOffset, $[94] = t27) : t27 = $[94];
1162
+ let t28;
1163
+ $[95] !== t25 || $[96] !== t27 ? (t28 = /* @__PURE__ */ jsxs(Fragment, { children: [
1164
+ t25,
1165
+ t27
1166
+ ] }), $[95] = t25, $[96] = t27, $[97] = t28) : t28 = $[97];
1167
+ const node_0 = t28;
1168
+ let t29;
1169
+ $[98] !== card2 || $[99] !== node_0 || $[100] !== open || $[101] !== portal || $[102] !== scheme || $[103] !== tone ? (t29 = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0), $[98] = card2, $[99] = node_0, $[100] = open, $[101] = portal, $[102] = scheme, $[103] = tone, $[104] = t29) : t29 = $[104];
1170
+ const children = t29;
1171
+ let t30;
1172
+ $[105] !== animate || $[106] !== children ? (t30 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[105] = animate, $[106] = children, $[107] = t30) : t30 = $[107];
1173
+ let t31;
1174
+ return $[108] !== child || $[109] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Fragment, { children: [
1175
+ t30,
1147
1176
  child
1148
- ] });
1177
+ ] }), $[108] = child, $[109] = t30, $[110] = t31) : t31 = $[110], t31;
1178
+ }
1179
+ function useMiddleware$1(t0) {
1180
+ const $ = c(36), {
1181
+ animate,
1182
+ arrowProp,
1183
+ arrowRef,
1184
+ constrainSize,
1185
+ fallbackPlacements,
1186
+ floatingBoundary,
1187
+ margins,
1188
+ matchReferenceWidth,
1189
+ placementProp,
1190
+ placementStrategy,
1191
+ preventOverflow,
1192
+ referenceBoundary,
1193
+ referenceWidthRef,
1194
+ rootBoundary
1195
+ } = t0;
1196
+ let ret;
1197
+ if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== constrainSize || $[4] !== fallbackPlacements || $[5] !== floatingBoundary || $[6] !== margins || $[7] !== matchReferenceWidth || $[8] !== placementProp || $[9] !== placementStrategy || $[10] !== preventOverflow || $[11] !== referenceBoundary || $[12] !== referenceWidthRef || $[13] !== rootBoundary) {
1198
+ if (ret = [], constrainSize || preventOverflow)
1199
+ if (placementStrategy === "autoPlacement") {
1200
+ let t12;
1201
+ $[15] !== fallbackPlacements || $[16] !== placementProp ? (t12 = autoPlacement({
1202
+ allowedPlacements: [placementProp].concat(fallbackPlacements)
1203
+ }), $[15] = fallbackPlacements, $[16] = placementProp, $[17] = t12) : t12 = $[17], ret.push(t12);
1204
+ } else {
1205
+ const t12 = floatingBoundary || void 0;
1206
+ let t22;
1207
+ $[18] !== fallbackPlacements || $[19] !== rootBoundary || $[20] !== t12 ? (t22 = flip({
1208
+ boundary: t12,
1209
+ fallbackPlacements,
1210
+ padding: DEFAULT_POPOVER_PADDING,
1211
+ rootBoundary
1212
+ }), $[18] = fallbackPlacements, $[19] = rootBoundary, $[20] = t12, $[21] = t22) : t22 = $[21], ret.push(t22);
1213
+ }
1214
+ let t1;
1215
+ if ($[22] === Symbol.for("react.memo_cache_sentinel") ? (t1 = offset({
1216
+ mainAxis: DEFAULT_POPOVER_DISTANCE
1217
+ }), $[22] = t1) : t1 = $[22], ret.push(t1), constrainSize || matchReferenceWidth) {
1218
+ const t22 = floatingBoundary || void 0;
1219
+ let t32;
1220
+ $[23] !== constrainSize || $[24] !== margins || $[25] !== matchReferenceWidth || $[26] !== referenceWidthRef || $[27] !== t22 ? (t32 = size({
1221
+ boundaryElement: t22,
1222
+ constrainSize,
1223
+ margins,
1224
+ matchReferenceWidth,
1225
+ padding: DEFAULT_POPOVER_PADDING,
1226
+ referenceWidthRef
1227
+ }), $[23] = constrainSize, $[24] = margins, $[25] = matchReferenceWidth, $[26] = referenceWidthRef, $[27] = t22, $[28] = t32) : t32 = $[28], ret.push(t32);
1228
+ }
1229
+ if (preventOverflow) {
1230
+ const t22 = floatingBoundary || void 0;
1231
+ let t32;
1232
+ $[29] !== rootBoundary || $[30] !== t22 ? (t32 = shift({
1233
+ boundary: t22,
1234
+ rootBoundary,
1235
+ padding: DEFAULT_POPOVER_PADDING
1236
+ }), $[29] = rootBoundary, $[30] = t22, $[31] = t32) : t32 = $[31], ret.push(t32);
1237
+ }
1238
+ if (arrowProp) {
1239
+ let t22;
1240
+ $[32] !== arrowRef ? (t22 = arrow({
1241
+ element: arrowRef,
1242
+ padding: DEFAULT_POPOVER_PADDING
1243
+ }), $[32] = arrowRef, $[33] = t22) : t22 = $[33], ret.push(t22);
1244
+ }
1245
+ animate && ret.push(origin);
1246
+ const t2 = referenceBoundary || void 0;
1247
+ let t3;
1248
+ $[34] !== t2 ? (t3 = hide({
1249
+ boundary: t2,
1250
+ padding: DEFAULT_POPOVER_PADDING,
1251
+ strategy: "referenceHidden"
1252
+ }), $[34] = t2, $[35] = t3) : t3 = $[35], ret.push(t3), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = constrainSize, $[4] = fallbackPlacements, $[5] = floatingBoundary, $[6] = margins, $[7] = matchReferenceWidth, $[8] = placementProp, $[9] = placementStrategy, $[10] = preventOverflow, $[11] = referenceBoundary, $[12] = referenceWidthRef, $[13] = rootBoundary, $[14] = ret;
1253
+ } else
1254
+ ret = $[14];
1255
+ return ret;
1149
1256
  }
1150
1257
  const DEFAULT_SELECTABLE_ELEMENT = "button";
1151
1258
  function Selectable(props) {
@@ -1231,14 +1338,14 @@ function TextInput(props) {
1231
1338
  const Element2 = t1 === void 0 ? DEFAULT_TEXT_INPUT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, padding = t6 === void 0 ? 3 : t6, radius = t7 === void 0 ? 2 : t7, type = t8 === void 0 ? "text" : t8, ref = useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
1232
1339
  let t9;
1233
1340
  $[23] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[23] = t9) : t9 = $[23], useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
1234
- const handleClearMouseDown = _temp$8;
1341
+ const handleClearMouseDown = _temp$a;
1235
1342
  let t10;
1236
1343
  $[24] !== onClear ? (t10 = (event_0) => {
1237
1344
  event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
1238
1345
  }, $[24] = onClear, $[25] = t10) : t10 = $[25];
1239
1346
  const handleClearClick = t10;
1240
1347
  let t11;
1241
- $[26] !== responsivePadding ? (t11 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$1)), $[26] = responsivePadding, $[27] = t11) : t11 = $[27];
1348
+ $[26] !== responsivePadding ? (t11 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$2)), $[26] = responsivePadding, $[27] = t11) : t11 = $[27];
1242
1349
  const clearButtonBoxPadding = t11;
1243
1350
  let t12;
1244
1351
  $[28] !== responsivePadding ? (t12 = Object.fromEntries(Object.entries(responsivePadding).map(_temp3)), $[28] = responsivePadding, $[29] = t12) : t12 = $[29];
@@ -1304,11 +1411,11 @@ function _temp3(t0) {
1304
1411
  const [key_0, value_0] = t0;
1305
1412
  return value_0 === 0 ? [key_0, 0] : value_0 === 1 ? [key_0, 0] : value_0 === 2 ? [key_0, 1] : [key_0, typeof value_0 == "number" ? value_0 - 1 : 0];
1306
1413
  }
1307
- function _temp2$1(t0) {
1414
+ function _temp2$2(t0) {
1308
1415
  const [key2, value] = t0;
1309
1416
  return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
1310
1417
  }
1311
- function _temp$8(event) {
1418
+ function _temp$a(event) {
1312
1419
  event.preventDefault(), event.stopPropagation();
1313
1420
  }
1314
1421
  function AutocompleteOption(props) {
@@ -1375,16 +1482,18 @@ function autocompleteReducer(state, msg) {
1375
1482
  }
1376
1483
  const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_AUTOCOMPLETE_ELEMENT = "input", DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1;
1377
1484
  function Autocomplete(props) {
1378
- const {
1379
- as = DEFAULT_AUTOCOMPLETE_ELEMENT,
1380
- border = !0,
1485
+ const $ = c(181), t0 = props;
1486
+ let customValidity, disabled, filterOptionProp, forwardedRef, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, valueProp;
1487
+ $[0] !== t0 ? ({
1488
+ as: t1,
1489
+ border: t2,
1381
1490
  customValidity,
1382
1491
  disabled,
1383
1492
  filterOption: filterOptionProp,
1384
- fontSize = 2,
1493
+ fontSize: t3,
1385
1494
  icon,
1386
1495
  id,
1387
- listBox = EMPTY_RECORD,
1496
+ listBox: t4,
1388
1497
  loading,
1389
1498
  onBlur,
1390
1499
  onChange,
@@ -1394,36 +1503,61 @@ function Autocomplete(props) {
1394
1503
  openButton,
1395
1504
  openOnFocus,
1396
1505
  options: optionsProp,
1397
- padding: paddingProp = 3,
1398
- popover: popover2 = EMPTY_RECORD,
1506
+ padding: t5,
1507
+ popover: t6,
1399
1508
  prefix,
1400
- radius = 2,
1509
+ radius: t7,
1401
1510
  readOnly,
1402
1511
  ref: forwardedRef,
1403
1512
  relatedElements,
1404
1513
  renderOption: renderOptionProp,
1405
1514
  renderPopover,
1406
- renderValue = DEFAULT_RENDER_VALUE,
1515
+ renderValue: t8,
1407
1516
  suffix,
1408
1517
  value: valueProp,
1409
1518
  ...rest
1410
- } = props, [state, dispatch] = useReducer(autocompleteReducer, {
1411
- activeValue: valueProp || null,
1519
+ } = t0, $[0] = t0, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = forwardedRef, $[5] = icon, $[6] = id, $[7] = loading, $[8] = onBlur, $[9] = onChange, $[10] = onFocus, $[11] = onQueryChange, $[12] = onSelect, $[13] = openButton, $[14] = openOnFocus, $[15] = optionsProp, $[16] = prefix, $[17] = readOnly, $[18] = relatedElements, $[19] = renderOptionProp, $[20] = renderPopover, $[21] = rest, $[22] = suffix, $[23] = t1, $[24] = t2, $[25] = t3, $[26] = t4, $[27] = t5, $[28] = t6, $[29] = t7, $[30] = t8, $[31] = valueProp) : (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], forwardedRef = $[4], icon = $[5], id = $[6], loading = $[7], onBlur = $[8], onChange = $[9], onFocus = $[10], onQueryChange = $[11], onSelect = $[12], openButton = $[13], openOnFocus = $[14], optionsProp = $[15], prefix = $[16], readOnly = $[17], relatedElements = $[18], renderOptionProp = $[19], renderPopover = $[20], rest = $[21], suffix = $[22], t1 = $[23], t2 = $[24], t3 = $[25], t4 = $[26], t5 = $[27], t6 = $[28], t7 = $[29], t8 = $[30], valueProp = $[31]);
1520
+ const as = t1 === void 0 ? DEFAULT_AUTOCOMPLETE_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, fontSize = t3 === void 0 ? 2 : t3, listBox = t4 === void 0 ? EMPTY_RECORD : t4, paddingProp = t5 === void 0 ? 3 : t5, popover2 = t6 === void 0 ? EMPTY_RECORD : t6, radius = t7 === void 0 ? 2 : t7, renderValue = t8 === void 0 ? DEFAULT_RENDER_VALUE : t8, t9 = valueProp || null, t10 = valueProp || null;
1521
+ let t11;
1522
+ $[32] !== t10 || $[33] !== t9 ? (t11 = {
1523
+ activeValue: t9,
1412
1524
  focused: !1,
1413
1525
  listFocused: !1,
1414
1526
  query: null,
1415
- value: valueProp || null
1416
- }), {
1527
+ value: t10
1528
+ }, $[32] = t10, $[33] = t9, $[34] = t11) : t11 = $[34];
1529
+ const [state, dispatch] = useReducer(autocompleteReducer, t11), {
1417
1530
  activeValue,
1418
1531
  focused,
1419
1532
  listFocused,
1420
1533
  query,
1421
1534
  value
1422
- } = state, defaultRenderOption = useCallback(({
1423
- value: value_0
1424
- }) => /* @__PURE__ */ jsx(Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
1425
- useImperativeHandle(forwardedRef, () => inputElementRef.current);
1426
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useResponsiveProp(paddingProp), currentOption = useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = useCallback((event) => {
1535
+ } = state;
1536
+ let t12;
1537
+ $[35] !== fontSize || $[36] !== paddingProp ? (t12 = (t132) => {
1538
+ const {
1539
+ value: value_0
1540
+ } = t132;
1541
+ return /* @__PURE__ */ jsx(Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) });
1542
+ }, $[35] = fontSize, $[36] = paddingProp, $[37] = t12) : t12 = $[37];
1543
+ const renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t12, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, setInputElement] = useState(null), listFocusedRef = useRef(!1), valueRef = useRef(value), valuePropRef = useRef(valueProp), popoverMouseWithinRef = useRef(!1);
1544
+ let t13, t14;
1545
+ $[38] !== inputElement ? (t13 = () => inputElement, t14 = [inputElement], $[38] = inputElement, $[39] = t13, $[40] = t14) : (t13 = $[39], t14 = $[40]), useImperativeHandle(inputElementRef, t13, t14);
1546
+ let t15, t16;
1547
+ $[41] !== inputElement ? (t15 = () => inputElement, t16 = [inputElement], $[41] = inputElement, $[42] = t15, $[43] = t16) : (t15 = $[42], t16 = $[43]), useImperativeHandle(forwardedRef, t15, t16);
1548
+ const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useResponsiveProp(paddingProp);
1549
+ let t17;
1550
+ $[44] !== options || $[45] !== value ? (t17 = value !== null ? options.find((o) => o.value === value) : void 0, $[44] = options, $[45] = value, $[46] = t17) : t17 = $[46];
1551
+ const currentOption = t17;
1552
+ let t18;
1553
+ if ($[47] !== filterOption || $[48] !== options || $[49] !== query) {
1554
+ let t192;
1555
+ $[51] !== filterOption || $[52] !== query ? (t192 = (option) => query ? filterOption(query, option) : !0, $[51] = filterOption, $[52] = query, $[53] = t192) : t192 = $[53], t18 = options.filter(t192), $[47] = filterOption, $[48] = options, $[49] = query, $[50] = t18;
1556
+ } else
1557
+ t18 = $[50];
1558
+ const filteredOptions = t18, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
1559
+ let t19;
1560
+ $[54] !== onBlur || $[55] !== onQueryChange || $[56] !== relatedElements ? (t19 = (event) => {
1427
1561
  setTimeout(() => {
1428
1562
  if (popoverMouseWithinRef.current)
1429
1563
  return;
@@ -1440,20 +1574,30 @@ function Autocomplete(props) {
1440
1574
  type: "root/blur"
1441
1575
  }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
1442
1576
  }, 0);
1443
- }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = useCallback((event_0) => {
1577
+ }, $[54] = onBlur, $[55] = onQueryChange, $[56] = relatedElements, $[57] = t19) : t19 = $[57];
1578
+ const handleRootBlur = t19;
1579
+ let t20;
1580
+ $[58] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_0) => {
1444
1581
  const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
1445
1582
  listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
1446
1583
  type: "root/setListFocused",
1447
1584
  listFocused: listFocused_0
1448
1585
  }));
1449
- }, []), handleOptionSelect = useCallback((v) => {
1586
+ }, $[58] = t20) : t20 = $[58];
1587
+ const handleRootFocus = t20;
1588
+ let t21;
1589
+ $[59] !== onChange || $[60] !== onQueryChange || $[61] !== onSelect ? (t21 = (v) => {
1450
1590
  dispatch({
1451
1591
  type: "value/change",
1452
1592
  value: v
1453
1593
  }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
1454
- }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = useCallback((event_1) => {
1594
+ }, $[59] = onChange, $[60] = onQueryChange, $[61] = onSelect, $[62] = t21) : t21 = $[62];
1595
+ const handleOptionSelect = t21;
1596
+ let t22;
1597
+ $[63] !== activeValue || $[64] !== filteredOptions || $[65] !== filteredOptionsLen || $[66] !== onQueryChange ? (t22 = (event_1) => {
1455
1598
  if (event_1.key === "ArrowDown") {
1456
- if (event_1.preventDefault(), !filteredOptionsLen) return;
1599
+ if (event_1.preventDefault(), !filteredOptionsLen)
1600
+ return;
1457
1601
  const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
1458
1602
  nextActiveOption && dispatch({
1459
1603
  type: "root/setActiveValue",
@@ -1463,7 +1607,8 @@ function Autocomplete(props) {
1463
1607
  return;
1464
1608
  }
1465
1609
  if (event_1.key === "ArrowUp") {
1466
- if (event_1.preventDefault(), !filteredOptionsLen) return;
1610
+ if (event_1.preventDefault(), !filteredOptionsLen)
1611
+ return;
1467
1612
  const activeOption_0 = filteredOptions.find((o_1) => o_1.value === activeValue), activeIndex_0 = activeOption_0 ? filteredOptions.indexOf(activeOption_0) : -1, nextActiveOption_0 = filteredOptions[activeIndex_0 === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex_0 - 1) % filteredOptionsLen];
1468
1613
  nextActiveOption_0 && dispatch({
1469
1614
  type: "root/setActiveValue",
@@ -1483,35 +1628,58 @@ function Autocomplete(props) {
1483
1628
  inputElementRef.current?.focus();
1484
1629
  return;
1485
1630
  }
1486
- }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = useCallback((event_2) => {
1631
+ }, $[63] = activeValue, $[64] = filteredOptions, $[65] = filteredOptionsLen, $[66] = onQueryChange, $[67] = t22) : t22 = $[67];
1632
+ const handleRootKeyDown = t22;
1633
+ let t23;
1634
+ $[68] !== onQueryChange ? (t23 = (event_2) => {
1487
1635
  const nextQuery = event_2.currentTarget.value;
1488
1636
  dispatch({
1489
1637
  type: "input/change",
1490
1638
  query: nextQuery
1491
1639
  }), onQueryChange && onQueryChange(nextQuery);
1492
- }, [onQueryChange]), dispatchOpen = useCallback(() => {
1640
+ }, $[68] = onQueryChange, $[69] = t23) : t23 = $[69];
1641
+ const handleInputChange = t23;
1642
+ let t24;
1643
+ $[70] !== currentOption || $[71] !== renderValue || $[72] !== value ? (t24 = () => {
1493
1644
  dispatch({
1494
1645
  type: "root/open",
1495
1646
  query: value ? renderValue(value, currentOption) : ""
1496
1647
  });
1497
- }, [currentOption, renderValue, value]), handleInputFocus = useCallback((event_3) => {
1648
+ }, $[70] = currentOption, $[71] = renderValue, $[72] = value, $[73] = t24) : t24 = $[73];
1649
+ const dispatchOpen = t24;
1650
+ let t25;
1651
+ $[74] !== dispatchOpen || $[75] !== focused || $[76] !== onFocus || $[77] !== openOnFocus ? (t25 = (event_3) => {
1498
1652
  focused || (dispatch({
1499
1653
  type: "input/focus"
1500
1654
  }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
1501
- }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = useCallback(() => {
1655
+ }, $[74] = dispatchOpen, $[75] = focused, $[76] = onFocus, $[77] = openOnFocus, $[78] = t25) : t25 = $[78];
1656
+ const handleInputFocus = t25;
1657
+ let t26;
1658
+ $[79] === Symbol.for("react.memo_cache_sentinel") ? (t26 = () => {
1502
1659
  popoverMouseWithinRef.current = !0;
1503
- }, []), handlePopoverMouseLeave = useCallback(() => {
1660
+ }, $[79] = t26) : t26 = $[79];
1661
+ const handlePopoverMouseEnter = t26;
1662
+ let t27;
1663
+ $[80] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
1504
1664
  popoverMouseWithinRef.current = !1;
1505
- }, []), handleClearButtonClick = useCallback(() => {
1665
+ }, $[80] = t27) : t27 = $[80];
1666
+ const handlePopoverMouseLeave = t27;
1667
+ let t28;
1668
+ $[81] !== onChange || $[82] !== onQueryChange ? (t28 = () => {
1506
1669
  dispatch({
1507
1670
  type: "root/clear"
1508
1671
  }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
1509
- }, [onChange, onQueryChange]), handleClearButtonFocus = useCallback(() => {
1672
+ }, $[81] = onChange, $[82] = onQueryChange, $[83] = t28) : t28 = $[83];
1673
+ const handleClearButtonClick = t28;
1674
+ let t29;
1675
+ $[84] === Symbol.for("react.memo_cache_sentinel") ? (t29 = () => {
1510
1676
  dispatch({
1511
1677
  type: "input/focus"
1512
1678
  });
1513
- }, []);
1514
- useEffect(() => {
1679
+ }, $[84] = t29) : t29 = $[84];
1680
+ const handleClearButtonFocus = t29;
1681
+ let t30, t31;
1682
+ $[85] !== valueProp ? (t30 = () => {
1515
1683
  if (valueProp !== valuePropRef.current) {
1516
1684
  valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
1517
1685
  type: "value/change",
@@ -1523,14 +1691,19 @@ function Autocomplete(props) {
1523
1691
  type: "value/change",
1524
1692
  value: valueProp || null
1525
1693
  }));
1526
- }, [valueProp]), useEffect(() => {
1694
+ }, t31 = [valueProp], $[85] = valueProp, $[86] = t30, $[87] = t31) : (t30 = $[86], t31 = $[87]), useEffect(t30, t31);
1695
+ let t32, t33;
1696
+ $[88] !== focused ? (t32 = () => {
1527
1697
  !focused && valueRef.current && dispatch({
1528
1698
  type: "root/setActiveValue",
1529
1699
  value: valueRef.current
1530
1700
  });
1531
- }, [focused]), useEffect(() => {
1701
+ }, t33 = [focused], $[88] = focused, $[89] = t32, $[90] = t33) : (t32 = $[89], t33 = $[90]), useEffect(t32, t33);
1702
+ let t34, t35;
1703
+ $[91] !== activeValue || $[92] !== filteredOptions ? (t34 = () => {
1532
1704
  const listElement = listBoxElementRef.current;
1533
- if (!listElement) return;
1705
+ if (!listElement)
1706
+ return;
1534
1707
  const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
1535
1708
  if (activeOption_1) {
1536
1709
  const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
@@ -1540,41 +1713,128 @@ function Autocomplete(props) {
1540
1713
  focusFirstDescendant(activeItemElement);
1541
1714
  }
1542
1715
  }
1543
- }, [activeValue, filteredOptions]);
1544
- const clearButton = useMemo(() => {
1545
- if (!loading && !disabled && value)
1546
- return {
1716
+ }, t35 = [activeValue, filteredOptions], $[91] = activeValue, $[92] = filteredOptions, $[93] = t34, $[94] = t35) : (t34 = $[93], t35 = $[94]), useEffect(t34, t35);
1717
+ let t36;
1718
+ bb0: {
1719
+ if (!loading && !disabled && value) {
1720
+ let t372;
1721
+ $[95] === Symbol.for("react.memo_cache_sentinel") ? (t372 = {
1547
1722
  "aria-label": "Clear",
1548
1723
  onFocus: handleClearButtonFocus
1549
- };
1550
- }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = useMemo(() => Object.fromEntries(Object.entries(padding).map(([key2, value_1]) => value_1 === 0 ? [key2, 0] : value_1 === 1 ? [key2, 1] : value_1 === 2 ? [key2, 1] : [key2, value_1 - 2])), [padding]), openButtonPadding = useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = useMemo(() => typeof openButton == "object" ? openButton : EMPTY_RECORD, [openButton]), handleOpenClick = useCallback((event_4) => {
1724
+ }, $[95] = t372) : t372 = $[95], t36 = t372;
1725
+ break bb0;
1726
+ }
1727
+ t36 = void 0;
1728
+ }
1729
+ const clearButton = t36;
1730
+ let t37;
1731
+ $[96] !== padding ? (t37 = Object.fromEntries(Object.entries(padding).map(_temp$9)), $[96] = padding, $[97] = t37) : t37 = $[97];
1732
+ const openButtonBoxPadding = t37;
1733
+ let t38;
1734
+ $[98] !== padding ? (t38 = Object.values(padding).map(_temp2$1), $[98] = padding, $[99] = t38) : t38 = $[99];
1735
+ const openButtonPadding = t38, openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD;
1736
+ let t39;
1737
+ $[100] !== dispatchOpen || $[101] !== openButtonProps ? (t39 = (event_4) => {
1551
1738
  dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
1552
- }, [openButtonProps, dispatchOpen]), openButtonNode = useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsx(TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = useCallback((event_5) => {
1739
+ }, $[100] = dispatchOpen, $[101] = openButtonProps, $[102] = t39) : t39 = $[102];
1740
+ const handleOpenClick = t39;
1741
+ let t40;
1742
+ $[103] !== disabled || $[104] !== expanded || $[105] !== fontSize || $[106] !== handleOpenClick || $[107] !== openButton || $[108] !== openButtonBoxPadding || $[109] !== openButtonPadding || $[110] !== openButtonProps || $[111] !== readOnly ? (t40 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, $[103] = disabled, $[104] = expanded, $[105] = fontSize, $[106] = handleOpenClick, $[107] = openButton, $[108] = openButtonBoxPadding, $[109] = openButtonPadding, $[110] = openButtonProps, $[111] = readOnly, $[112] = t40) : t40 = $[112];
1743
+ const openButtonNode = t40;
1744
+ let t41;
1745
+ bb1: {
1746
+ if (query === null) {
1747
+ if (value !== null) {
1748
+ let t422;
1749
+ $[113] !== currentOption || $[114] !== renderValue || $[115] !== value ? (t422 = renderValue(value, currentOption), $[113] = currentOption, $[114] = renderValue, $[115] = value, $[116] = t422) : t422 = $[116], t41 = t422;
1750
+ break bb1;
1751
+ }
1752
+ t41 = "";
1753
+ break bb1;
1754
+ }
1755
+ t41 = query;
1756
+ }
1757
+ const inputValue = t41;
1758
+ let t42;
1759
+ $[117] !== listFocused ? (t42 = (event_5) => {
1553
1760
  event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
1554
- }, [listFocused]), content2 = useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsx(Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: filteredOptions.map((option_0) => {
1555
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
1556
- return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
1557
- disabled: loading,
1558
- selected: active,
1559
- tabIndex: listFocused && active ? 0 : -1
1560
- }) }, option_0.value);
1561
- }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = useMemo(() => renderPopover ? renderPopover({
1761
+ }, $[117] = listFocused, $[118] = t42) : t42 = $[118];
1762
+ const handleListBoxKeyDown = t42;
1763
+ let t43;
1764
+ bb2: {
1765
+ if (filteredOptions.length === 0) {
1766
+ t43 = null;
1767
+ break bb2;
1768
+ }
1769
+ let t442;
1770
+ if ($[119] !== activeValue || $[120] !== currentOption || $[121] !== filteredOptions || $[122] !== handleOptionSelect || $[123] !== id || $[124] !== listFocused || $[125] !== loading || $[126] !== renderOption) {
1771
+ let t453;
1772
+ $[128] !== activeValue || $[129] !== currentOption || $[130] !== handleOptionSelect || $[131] !== id || $[132] !== listFocused || $[133] !== loading || $[134] !== renderOption ? (t453 = (option_0) => {
1773
+ const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
1774
+ return /* @__PURE__ */ jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: cloneElement(renderOption(option_0), {
1775
+ disabled: loading,
1776
+ selected: active,
1777
+ tabIndex: listFocused && active ? 0 : -1
1778
+ }) }, option_0.value);
1779
+ }, $[128] = activeValue, $[129] = currentOption, $[130] = handleOptionSelect, $[131] = id, $[132] = listFocused, $[133] = loading, $[134] = renderOption, $[135] = t453) : t453 = $[135], t442 = filteredOptions.map(t453), $[119] = activeValue, $[120] = currentOption, $[121] = filteredOptions, $[122] = handleOptionSelect, $[123] = id, $[124] = listFocused, $[125] = loading, $[126] = renderOption, $[127] = t442;
1780
+ } else
1781
+ t442 = $[127];
1782
+ let t452;
1783
+ $[136] !== listBoxId || $[137] !== t442 ? (t452 = /* @__PURE__ */ jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: t442 }), $[136] = listBoxId, $[137] = t442, $[138] = t452) : t452 = $[138];
1784
+ let t462;
1785
+ $[139] !== handleListBoxKeyDown || $[140] !== listBox || $[141] !== t452 ? (t462 = /* @__PURE__ */ jsx(Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t452 }), $[139] = handleListBoxKeyDown, $[140] = listBox, $[141] = t452, $[142] = t462) : t462 = $[142], t43 = t462;
1786
+ }
1787
+ const content2 = t43;
1788
+ let t44;
1789
+ bb3: {
1790
+ if (renderPopover) {
1791
+ const t453 = !expanded;
1792
+ let t462;
1793
+ $[143] !== content2 || $[144] !== inputElement || $[145] !== renderPopover || $[146] !== t453 ? (t462 = /* @__PURE__ */ jsx(RenderPopover, { content: content2, hidden: t453, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }), $[143] = content2, $[144] = inputElement, $[145] = renderPopover, $[146] = t453, $[147] = t462) : t462 = $[147], t44 = t462;
1794
+ break bb3;
1795
+ }
1796
+ if (filteredOptionsLen === 0) {
1797
+ t44 = null;
1798
+ break bb3;
1799
+ }
1800
+ let t452;
1801
+ $[148] !== content2 || $[149] !== expanded || $[150] !== inputElement || $[151] !== popover2 ? (t452 = /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElement, ...popover2 }), $[148] = content2, $[149] = expanded, $[150] = inputElement, $[151] = popover2, $[152] = t452) : t452 = $[152], t44 = t452;
1802
+ }
1803
+ const results = t44, t45 = loading && AnimatedSpinnerIcon, t46 = suffix || openButtonNode;
1804
+ let t47;
1805
+ $[153] !== activeItemId || $[154] !== as || $[155] !== border || $[156] !== clearButton || $[157] !== customValidity || $[158] !== disabled || $[159] !== expanded || $[160] !== fontSize || $[161] !== handleClearButtonClick || $[162] !== handleInputChange || $[163] !== handleInputFocus || $[164] !== icon || $[165] !== id || $[166] !== inputValue || $[167] !== listBoxId || $[168] !== padding || $[169] !== prefix || $[170] !== radius || $[171] !== readOnly || $[172] !== rest || $[173] !== t45 || $[174] !== t46 ? (t47 = /* @__PURE__ */ jsx(TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: t45, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t46, value: inputValue }), $[153] = activeItemId, $[154] = as, $[155] = border, $[156] = clearButton, $[157] = customValidity, $[158] = disabled, $[159] = expanded, $[160] = fontSize, $[161] = handleClearButtonClick, $[162] = handleInputChange, $[163] = handleInputFocus, $[164] = icon, $[165] = id, $[166] = inputValue, $[167] = listBoxId, $[168] = padding, $[169] = prefix, $[170] = radius, $[171] = readOnly, $[172] = rest, $[173] = t45, $[174] = t46, $[175] = t47) : t47 = $[175];
1806
+ let t48;
1807
+ return $[176] !== handleRootBlur || $[177] !== handleRootKeyDown || $[178] !== results || $[179] !== t47 ? (t48 = /* @__PURE__ */ jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
1808
+ t47,
1809
+ results
1810
+ ] }), $[176] = handleRootBlur, $[177] = handleRootKeyDown, $[178] = results, $[179] = t47, $[180] = t48) : t48 = $[180], t48;
1811
+ }
1812
+ function _temp2$1(v_0) {
1813
+ return Math.max(v_0 - 1, 0);
1814
+ }
1815
+ function _temp$9(t0) {
1816
+ const [key2, value_1] = t0;
1817
+ return value_1 === 0 ? [key2, 0] : value_1 === 1 ? [key2, 1] : value_1 === 2 ? [key2, 1] : [key2, value_1 - 2];
1818
+ }
1819
+ function RenderPopover({
1820
+ renderPopover,
1821
+ content: content2,
1822
+ hidden,
1823
+ inputElement,
1824
+ onMouseEnter,
1825
+ onMouseLeave,
1826
+ resultsPopoverElementRef
1827
+ }) {
1828
+ return renderPopover({
1562
1829
  content: content2,
1563
- hidden: !expanded,
1564
- inputElement: inputElementRef.current,
1565
- onMouseEnter: handlePopoverMouseEnter,
1566
- onMouseLeave: handlePopoverMouseLeave
1567
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover2 }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover2, renderPopover]);
1568
- return (
1569
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
1570
- /* @__PURE__ */ jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
1571
- input,
1572
- results
1573
- ] })
1574
- );
1830
+ hidden,
1831
+ inputElement,
1832
+ onMouseEnter,
1833
+ onMouseLeave
1834
+ }, resultsPopoverElementRef);
1575
1835
  }
1576
1836
  function useClickOutsideEvent(listener, t0, boundaryElement) {
1577
- const $ = c(9), elementsArg = t0 === void 0 ? _temp$7 : t0;
1837
+ const $ = c(9), elementsArg = t0 === void 0 ? _temp$8 : t0;
1578
1838
  let t1;
1579
1839
  $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
1580
1840
  if (!listener)
@@ -1604,38 +1864,97 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
1604
1864
  let t3;
1605
1865
  $[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
1606
1866
  }
1607
- function _temp$7() {
1867
+ function _temp$8() {
1608
1868
  return EMPTY_ARRAY;
1609
1869
  }
1610
1870
  const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
1611
1871
  function Breadcrumbs(props) {
1612
- const {
1613
- as = DEFAULT_BREADCRUMBS_ELEMENT,
1872
+ const $ = c(37), t0 = props;
1873
+ let children, className, expandButtonProps, maxLength, rest, separator, t1, t2, t3, t4;
1874
+ $[0] !== t0 ? ({
1875
+ as: t1,
1614
1876
  children,
1615
1877
  className,
1616
1878
  expandButton: expandButtonProps,
1617
- gap = 2,
1618
- gapX,
1619
- gapY,
1879
+ gap: t2,
1880
+ gapX: t3,
1881
+ gapY: t4,
1620
1882
  maxLength,
1621
1883
  separator,
1622
1884
  ...rest
1623
- } = props, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), collapse = useCallback(() => setOpen(!1), []), expand = useCallback(() => setOpen(!0), []);
1624
- useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
1625
- const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children]), items = useMemo(() => {
1626
- const len = rawItems.length;
1627
- if (maxLength && len > maxLength) {
1628
- const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
1629
- return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: /* @__PURE__ */ jsx(Stack, { as: "ol", gap: gapY, overflow: "auto", children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsx(Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: open ? collapse : expand, ref: expandElementRef, selected: open }) }, "button"), ...rawItems.slice(len - afterLength)];
1630
- }
1631
- return rawItems;
1632
- }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
1633
- return /* @__PURE__ */ jsx(Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: breadcrumbs({
1885
+ } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = expandButtonProps, $[4] = maxLength, $[5] = rest, $[6] = separator, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4) : (children = $[1], className = $[2], expandButtonProps = $[3], maxLength = $[4], rest = $[5], separator = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10]);
1886
+ const as = t1 === void 0 ? DEFAULT_BREADCRUMBS_ELEMENT : t1, gap = t2 === void 0 ? 2 : t2, gapX = t3 === void 0 ? gap : t3, gapY = t4 === void 0 ? gap : t4, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null);
1887
+ let t5;
1888
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => setOpen(!1), $[11] = t5) : t5 = $[11];
1889
+ const collapse = t5;
1890
+ let t6;
1891
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => setOpen(!0), $[12] = t6) : t6 = $[12];
1892
+ const expand = t6;
1893
+ let t7;
1894
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [expandElementRef.current, popoverElementRef.current], $[13] = t7) : t7 = $[13], useClickOutsideEvent(collapse, t7);
1895
+ let t8;
1896
+ $[14] !== children ? (t8 = Children.toArray(children).filter(isValidElement), $[14] = children, $[15] = t8) : t8 = $[15];
1897
+ const rawItems = t8;
1898
+ let t9;
1899
+ $[16] !== expandButtonProps || $[17] !== gapY || $[18] !== maxLength || $[19] !== open || $[20] !== rawItems ? (t9 = {
1900
+ collapse,
1901
+ expand,
1902
+ expandElementRef,
1903
+ maxLength,
1904
+ open,
1905
+ popoverElementRef,
1906
+ rawItems,
1907
+ gapY,
1908
+ expandButtonProps
1909
+ }, $[16] = expandButtonProps, $[17] = gapY, $[18] = maxLength, $[19] = open, $[20] = rawItems, $[21] = t9) : t9 = $[21];
1910
+ const items = useItems(t9);
1911
+ let t10;
1912
+ $[22] !== className ? (t10 = breadcrumbs({
1634
1913
  className
1635
- }), gap, gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
1636
- itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
1637
- /* @__PURE__ */ jsx(Box, { as: "li", children: item })
1638
- ] }, itemIndex)) });
1914
+ }), $[22] = className, $[23] = t10) : t10 = $[23];
1915
+ let t11;
1916
+ if ($[24] !== items || $[25] !== separator) {
1917
+ let t122;
1918
+ $[27] !== separator ? (t122 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
1919
+ itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
1920
+ /* @__PURE__ */ jsx(Box, { as: "li", children: item })
1921
+ ] }, itemIndex), $[27] = separator, $[28] = t122) : t122 = $[28], t11 = items.map(t122), $[24] = items, $[25] = separator, $[26] = t11;
1922
+ } else
1923
+ t11 = $[26];
1924
+ let t12;
1925
+ return $[29] !== as || $[30] !== gap || $[31] !== gapX || $[32] !== gapY || $[33] !== rest || $[34] !== t10 || $[35] !== t11 ? (t12 = /* @__PURE__ */ jsx(Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: t10, gap, gapX, gapY, children: t11 }), $[29] = as, $[30] = gap, $[31] = gapX, $[32] = gapY, $[33] = rest, $[34] = t10, $[35] = t11, $[36] = t12) : t12 = $[36], t12;
1926
+ }
1927
+ function useItems(t0) {
1928
+ const $ = c(30), {
1929
+ collapse,
1930
+ expand,
1931
+ expandElementRef,
1932
+ maxLength,
1933
+ open,
1934
+ popoverElementRef,
1935
+ rawItems,
1936
+ gapY,
1937
+ expandButtonProps
1938
+ } = t0, len = rawItems.length;
1939
+ if (maxLength && len > maxLength) {
1940
+ const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
1941
+ let t1;
1942
+ if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandButtonProps || $[5] !== expandElementRef || $[6] !== gapY || $[7] !== len || $[8] !== open || $[9] !== popoverElementRef || $[10] !== rawItems) {
1943
+ const t2 = rawItems.slice(0, beforeLength - 1);
1944
+ let t3;
1945
+ $[12] !== afterLength || $[13] !== beforeLength || $[14] !== len || $[15] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[12] = afterLength, $[13] = beforeLength, $[14] = len, $[15] = rawItems, $[16] = t3) : t3 = $[16];
1946
+ let t4;
1947
+ $[17] !== gapY || $[18] !== t3 ? (t4 = /* @__PURE__ */ jsx(Stack, { as: "ol", gap: gapY, overflow: "auto", children: t3 }), $[17] = gapY, $[18] = t3, $[19] = t4) : t4 = $[19];
1948
+ const t5 = open ? collapse : expand;
1949
+ let t6;
1950
+ $[20] !== expandButtonProps || $[21] !== expandElementRef || $[22] !== open || $[23] !== t5 ? (t6 = /* @__PURE__ */ jsx(Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: t5, ref: expandElementRef, selected: open }), $[20] = expandButtonProps, $[21] = expandElementRef, $[22] = open, $[23] = t5, $[24] = t6) : t6 = $[24];
1951
+ let t7;
1952
+ $[25] !== open || $[26] !== popoverElementRef || $[27] !== t4 || $[28] !== t6 ? (t7 = /* @__PURE__ */ jsx(Popover, { constrainSize: !0, content: t4, open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: t6 }, "button"), $[25] = open, $[26] = popoverElementRef, $[27] = t4, $[28] = t6, $[29] = t7) : t7 = $[29], t1 = [...t2, t7, ...rawItems.slice(len - afterLength)], $[0] = afterLength, $[1] = beforeLength, $[2] = collapse, $[3] = expand, $[4] = expandButtonProps, $[5] = expandElementRef, $[6] = gapY, $[7] = len, $[8] = open, $[9] = popoverElementRef, $[10] = rawItems, $[11] = t1;
1953
+ } else
1954
+ t1 = $[11];
1955
+ return t1;
1956
+ }
1957
+ return rawItems;
1639
1958
  }
1640
1959
  const DEFAULT_CONTAINER_ELEMENT = "div";
1641
1960
  function Container(props) {
@@ -1656,18 +1975,18 @@ function Container(props) {
1656
1975
  let t4;
1657
1976
  return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
1658
1977
  }
1659
- function useGlobalKeyDown(onKeyDown) {
1660
- const $ = c(5);
1978
+ function useGlobalKeyDown(onKeyDown, options) {
1979
+ const $ = c(7);
1661
1980
  let t0;
1662
1981
  $[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
1663
1982
  const handleKeyDown = useEffectEvent(t0);
1664
1983
  let t1;
1665
- $[2] !== handleKeyDown ? (t1 = () => {
1984
+ $[2] !== handleKeyDown || $[3] !== options ? (t1 = () => {
1666
1985
  const handler = (event_0) => handleKeyDown(event_0);
1667
- return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
1668
- }, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
1986
+ return window.addEventListener("keydown", handler, options), () => window.removeEventListener("keydown", handler, options);
1987
+ }, $[2] = handleKeyDown, $[3] = options, $[4] = t1) : t1 = $[4];
1669
1988
  let t2;
1670
- $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], useEffect(t1, t2);
1989
+ $[5] !== options ? (t2 = [options], $[5] = options, $[6] = t2) : t2 = $[6], useEffect(t1, t2);
1671
1990
  }
1672
1991
  function isTargetWithinScope(boundaryElement, portalElement, target) {
1673
1992
  return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
@@ -1766,7 +2085,7 @@ function DialogCard(props) {
1766
2085
  t19
1767
2086
  ] }), $[55] = as, $[56] = rest, $[57] = t12, $[58] = t18, $[59] = t19, $[60] = t20) : t20 = $[60], t20;
1768
2087
  }
1769
- const DialogContext = createGlobalScopedContext("@sanity/ui/v3/dialog", {
2088
+ const DialogContext = createGlobalScopedContext("@sanity/ui/v4/dialog", {
1770
2089
  version: 0
1771
2090
  });
1772
2091
  function useDialog() {
@@ -1925,7 +2244,7 @@ function Hotkeys(props) {
1925
2244
  let t4;
1926
2245
  return $[19] !== as || $[20] !== gap || $[21] !== gapX || $[22] !== gapY || $[23] !== rest || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "Hotkeys", ...rest, display: "flex", gap, gapX, gapY, children: t3 }), $[19] = as, $[20] = gap, $[21] = gapX, $[22] = gapY, $[23] = rest, $[24] = t3, $[25] = t4) : t4 = $[25], t4;
1927
2246
  }
1928
- const MenuContext = createGlobalScopedContext("@sanity/ui/v3/menu", null);
2247
+ const MenuContext = createGlobalScopedContext("@sanity/ui/v4/menu", null);
1929
2248
  function _isFocusable(element) {
1930
2249
  return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
1931
2250
  }
@@ -1963,16 +2282,24 @@ function _sortElements(rootElement, elements) {
1963
2282
  elements.sort(_sort);
1964
2283
  }
1965
2284
  function useMenuController(props) {
1966
- const {
2285
+ const $ = c(21), {
1967
2286
  onKeyDown,
1968
2287
  originElement,
1969
2288
  shouldFocus,
1970
2289
  rootElementRef
1971
- } = props, elementsRef = useRef([]), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), activeElement = useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = useCallback((nextActiveIndex) => {
1972
- _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
1973
- }, []), mount = useCallback((element, selected) => {
1974
- if (!element) return () => {
1975
- };
2290
+ } = props;
2291
+ let t0;
2292
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
2293
+ const elementsRef = useRef(t0), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), [activeElement, setActiveElement] = useState(null);
2294
+ let t1;
2295
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (nextActiveIndex) => {
2296
+ _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex, setActiveElement(elementsRef.current[nextActiveIndex] || null);
2297
+ }, $[1] = t1) : t1 = $[1];
2298
+ const setActiveIndex = t1;
2299
+ let t2;
2300
+ $[2] !== rootElementRef ? (t2 = (element, selected) => {
2301
+ if (!element)
2302
+ return _temp$7;
1976
2303
  if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
1977
2304
  const selectedIndex = elementsRef.current.indexOf(element);
1978
2305
  setActiveIndex(selectedIndex);
@@ -1981,7 +2308,10 @@ function useMenuController(props) {
1981
2308
  const idx = elementsRef.current.indexOf(element);
1982
2309
  idx > -1 && elementsRef.current.splice(idx, 1);
1983
2310
  };
1984
- }, [rootElementRef, setActiveIndex]), handleKeyDown = useCallback((event) => {
2311
+ }, $[2] = rootElementRef, $[3] = t2) : t2 = $[3];
2312
+ const mount = t2;
2313
+ let t3;
2314
+ $[4] !== onKeyDown || $[5] !== originElement ? (t3 = (event) => {
1985
2315
  if (event.key === "Tab") {
1986
2316
  originElement && originElement.focus();
1987
2317
  return;
@@ -1989,7 +2319,8 @@ function useMenuController(props) {
1989
2319
  if (event.key === "Home") {
1990
2320
  event.preventDefault(), event.stopPropagation();
1991
2321
  const el = _getFocusableElements(elementsRef.current)[0];
1992
- if (!el) return;
2322
+ if (!el)
2323
+ return;
1993
2324
  const currentIndex = elementsRef.current.indexOf(el);
1994
2325
  setActiveIndex(currentIndex);
1995
2326
  return;
@@ -1997,7 +2328,8 @@ function useMenuController(props) {
1997
2328
  if (event.key === "End") {
1998
2329
  event.preventDefault(), event.stopPropagation();
1999
2330
  const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
2000
- if (!el_0) return;
2331
+ if (!el_0)
2332
+ return;
2001
2333
  const currentIndex_0 = elementsRef.current.indexOf(el_0);
2002
2334
  setActiveIndex(currentIndex_0);
2003
2335
  return;
@@ -2005,7 +2337,8 @@ function useMenuController(props) {
2005
2337
  if (event.key === "ArrowUp") {
2006
2338
  event.preventDefault(), event.stopPropagation();
2007
2339
  const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
2008
- if (focusableLen === 0) return;
2340
+ if (focusableLen === 0)
2341
+ return;
2009
2342
  const focusedElement = elementsRef.current[activeIndexRef.current];
2010
2343
  let focusedIndex = focusableElements_1.indexOf(focusedElement);
2011
2344
  focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
@@ -2016,7 +2349,8 @@ function useMenuController(props) {
2016
2349
  if (event.key === "ArrowDown") {
2017
2350
  event.preventDefault(), event.stopPropagation();
2018
2351
  const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
2019
- if (focusableLen_0 === 0) return;
2352
+ if (focusableLen_0 === 0)
2353
+ return;
2020
2354
  const focusedElement_0 = elementsRef.current[activeIndexRef.current];
2021
2355
  let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
2022
2356
  focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
@@ -2025,14 +2359,23 @@ function useMenuController(props) {
2025
2359
  return;
2026
2360
  }
2027
2361
  onKeyDown && onKeyDown(event);
2028
- }, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = useCallback((event_0) => {
2362
+ }, $[4] = onKeyDown, $[5] = originElement, $[6] = t3) : t3 = $[6];
2363
+ const handleKeyDown = t3;
2364
+ let t4;
2365
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = (event_0) => {
2029
2366
  const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
2030
2367
  setActiveIndex(currentIndex_3);
2031
- }, [setActiveIndex]), handleItemMouseLeave = useCallback(() => {
2368
+ }, $[7] = t4) : t4 = $[7];
2369
+ const handleItemMouseEnter = t4;
2370
+ let t5;
2371
+ $[8] !== rootElementRef ? (t5 = () => {
2032
2372
  setActiveIndex(-2), rootElementRef.current?.focus();
2033
- }, [rootElementRef, setActiveIndex]);
2034
- return useEffect(() => {
2035
- if (!mounted) return;
2373
+ }, $[8] = rootElementRef, $[9] = t5) : t5 = $[9];
2374
+ const handleItemMouseLeave = t5;
2375
+ let t6, t7;
2376
+ $[10] !== activeIndex || $[11] !== rootElementRef || $[12] !== shouldFocus ? (t6 = () => {
2377
+ if (!rootElementRef.current)
2378
+ return;
2036
2379
  const rafId = requestAnimationFrame(() => {
2037
2380
  if (activeIndex === -1) {
2038
2381
  if (shouldFocus === "first") {
@@ -2054,18 +2397,22 @@ function useMenuController(props) {
2054
2397
  (elementsRef.current[activeIndex] || null)?.focus();
2055
2398
  });
2056
2399
  return () => cancelAnimationFrame(rafId);
2057
- }, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
2400
+ }, t7 = [activeIndex, rootElementRef, setActiveIndex, shouldFocus], $[10] = activeIndex, $[11] = rootElementRef, $[12] = shouldFocus, $[13] = t6, $[14] = t7) : (t6 = $[13], t7 = $[14]), useEffect(t6, t7);
2401
+ let t8;
2402
+ return $[15] !== activeElement || $[16] !== activeIndex || $[17] !== handleItemMouseLeave || $[18] !== handleKeyDown || $[19] !== mount ? (t8 = {
2058
2403
  activeElement,
2059
2404
  activeIndex,
2060
2405
  handleItemMouseEnter,
2061
2406
  handleItemMouseLeave,
2062
2407
  handleKeyDown,
2063
2408
  mount
2064
- };
2409
+ }, $[15] = activeElement, $[16] = activeIndex, $[17] = handleItemMouseLeave, $[18] = handleKeyDown, $[19] = mount, $[20] = t8) : t8 = $[20], t8;
2410
+ }
2411
+ function _temp$7() {
2065
2412
  }
2066
2413
  const DEFAULT_MENU_ELEMENT = "div";
2067
2414
  function Menu(props) {
2068
- const $ = c(57), t0 = props;
2415
+ const $ = c(56), t0 = props;
2069
2416
  let _shouldFocus, children, className, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
2070
2417
  $[0] !== t0 ? ({
2071
2418
  as: t1,
@@ -2121,10 +2468,9 @@ function Menu(props) {
2121
2468
  isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
2122
2469
  }, $[28] = isTopLayer, $[29] = onEscape, $[30] = t10) : t10 = $[30], useGlobalKeyDown(t10);
2123
2470
  let t11;
2124
- $[31] !== activeElement || $[32] !== activeIndex || $[33] !== handleItemMouseEnter || $[34] !== handleItemMouseLeave || $[35] !== mount || $[36] !== onClickOutside || $[37] !== onEscape || $[38] !== onItemClick || $[39] !== registerElement ? (t11 = {
2125
- version: 0,
2471
+ $[31] !== activeElement || $[32] !== handleItemMouseEnter || $[33] !== handleItemMouseLeave || $[34] !== mount || $[35] !== onClickOutside || $[36] !== onEscape || $[37] !== onItemClick || $[38] !== registerElement ? (t11 = {
2472
+ version: 2,
2126
2473
  activeElement,
2127
- activeIndex,
2128
2474
  mount,
2129
2475
  onClickOutside,
2130
2476
  onEscape,
@@ -2132,18 +2478,18 @@ function Menu(props) {
2132
2478
  onItemMouseEnter: handleItemMouseEnter,
2133
2479
  onItemMouseLeave: handleItemMouseLeave,
2134
2480
  registerElement
2135
- }, $[31] = activeElement, $[32] = activeIndex, $[33] = handleItemMouseEnter, $[34] = handleItemMouseLeave, $[35] = mount, $[36] = onClickOutside, $[37] = onEscape, $[38] = onItemClick, $[39] = registerElement, $[40] = t11) : t11 = $[40];
2481
+ }, $[31] = activeElement, $[32] = handleItemMouseEnter, $[33] = handleItemMouseLeave, $[34] = mount, $[35] = onClickOutside, $[36] = onEscape, $[37] = onItemClick, $[38] = registerElement, $[39] = t11) : t11 = $[39];
2136
2482
  const value = t11;
2137
2483
  let t12;
2138
- $[41] !== className ? (t12 = menu({
2484
+ $[40] !== className ? (t12 = menu({
2139
2485
  className
2140
- }), $[41] = className, $[42] = t12) : t12 = $[42];
2486
+ }), $[40] = className, $[41] = t12) : t12 = $[41];
2141
2487
  let t13;
2142
- $[43] !== children || $[44] !== gap ? (t13 = /* @__PURE__ */ jsx(Stack, { gap, children }), $[43] = children, $[44] = gap, $[45] = t13) : t13 = $[45];
2488
+ $[42] !== children || $[43] !== gap ? (t13 = /* @__PURE__ */ jsx(Stack, { gap, children }), $[42] = children, $[43] = gap, $[44] = t13) : t13 = $[44];
2143
2489
  let t14;
2144
- $[46] !== as || $[47] !== handleKeyDown || $[48] !== handleRefChange || $[49] !== padding || $[50] !== rest || $[51] !== t12 || $[52] !== t13 ? (t14 = /* @__PURE__ */ jsx(Box, { "data-ui": "Menu", ...rest, as, className: t12, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t13 }), $[46] = as, $[47] = handleKeyDown, $[48] = handleRefChange, $[49] = padding, $[50] = rest, $[51] = t12, $[52] = t13, $[53] = t14) : t14 = $[53];
2490
+ $[45] !== as || $[46] !== handleKeyDown || $[47] !== handleRefChange || $[48] !== padding || $[49] !== rest || $[50] !== t12 || $[51] !== t13 ? (t14 = /* @__PURE__ */ jsx(Box, { "data-ui": "Menu", ...rest, as, className: t12, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t13 }), $[45] = as, $[46] = handleKeyDown, $[47] = handleRefChange, $[48] = padding, $[49] = rest, $[50] = t12, $[51] = t13, $[52] = t14) : t14 = $[52];
2145
2491
  let t15;
2146
- return $[54] !== t14 || $[55] !== value ? (t15 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t14 }), $[54] = t14, $[55] = value, $[56] = t15) : t15 = $[56], t15;
2492
+ return $[53] !== t14 || $[54] !== value ? (t15 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t14 }), $[53] = t14, $[54] = value, $[55] = t15) : t15 = $[55], t15;
2147
2493
  }
2148
2494
  function MenuButton(props) {
2149
2495
  const $ = c(57), {
@@ -2300,7 +2646,7 @@ function useMenu() {
2300
2646
  const value = use(MenuContext);
2301
2647
  if (!value)
2302
2648
  throw new Error("useMenu(): missing context value");
2303
- if (!isRecord(value) || value.version !== 0)
2649
+ if (!isRecord(value) || value.version !== 2)
2304
2650
  throw new Error("useMenu(): the context value is not compatible");
2305
2651
  return value;
2306
2652
  }
@@ -2709,7 +3055,7 @@ function _temp$5() {
2709
3055
  return !0;
2710
3056
  }
2711
3057
  const subscribe = () => () => {
2712
- }, ToastContext = createGlobalScopedContext("@sanity/ui/v3/toast", null), DEFAULT_GRID_ELEMENT = "div";
3058
+ }, ToastContext = createGlobalScopedContext("@sanity/ui/v4/toast", null), DEFAULT_GRID_ELEMENT = "div";
2713
3059
  function Grid(props) {
2714
3060
  const $ = c(8), t0 = props;
2715
3061
  let children, rest, t1;
@@ -2864,7 +3210,7 @@ function _focusItemElement(el) {
2864
3210
  firstChild && firstChild instanceof HTMLElement && firstChild.focus();
2865
3211
  }
2866
3212
  }
2867
- const TreeContext = createGlobalScopedContext("@sanity/ui/v3/tree", null), DEFAULT_TREE_ELEMENT = "div";
3213
+ const TreeContext = createGlobalScopedContext("@sanity/ui/v4/tree", null), DEFAULT_TREE_ELEMENT = "div";
2868
3214
  function Tree(props) {
2869
3215
  const $ = c(38), t0 = props;
2870
3216
  let children, forwardedRef, onFocus, rest, t1;
@@ -3038,97 +3384,135 @@ const TreeGroup = function(props) {
3038
3384
  return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.gap ? (t3 = /* @__PURE__ */ jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.gap, role: "group", gap: tree.gap, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.gap, $[8] = t3) : t3 = $[8], t3;
3039
3385
  }, DEFAULT_TREE_ITEM_ELEMENT = "a";
3040
3386
  function TreeItem(props) {
3041
- const {
3387
+ const $ = c(129), t0 = props;
3388
+ let IconComponent, children, className, href, idProp, muted, onClick, rest, t1, t2, t3, t4, t5, t6, t7, text2, weight;
3389
+ $[0] !== t0 ? ({
3042
3390
  children,
3043
3391
  className,
3044
- expanded: expandedProp = !1,
3045
- fontSize = 1,
3392
+ expanded: t1,
3393
+ fontSize: t2,
3046
3394
  href,
3047
3395
  icon: IconComponent,
3048
3396
  id: idProp,
3049
- linkAs = "a",
3397
+ linkAs: t3,
3050
3398
  muted,
3051
3399
  onClick,
3052
- padding = 2,
3053
- radius = 2,
3054
- selected = !1,
3055
- space = 2,
3400
+ padding: t4,
3401
+ radius: t5,
3402
+ selected: t6,
3403
+ space: t7,
3056
3404
  text: text2,
3057
3405
  weight,
3058
3406
  ...rest
3059
- } = props, rootRef = useRef(null), treeitemRef = useRef(null), tree = useTree(), {
3407
+ } = t0, $[0] = t0, $[1] = IconComponent, $[2] = children, $[3] = className, $[4] = href, $[5] = idProp, $[6] = muted, $[7] = onClick, $[8] = rest, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = t4, $[13] = t5, $[14] = t6, $[15] = t7, $[16] = text2, $[17] = weight) : (IconComponent = $[1], children = $[2], className = $[3], href = $[4], idProp = $[5], muted = $[6], onClick = $[7], rest = $[8], t1 = $[9], t2 = $[10], t3 = $[11], t4 = $[12], t5 = $[13], t6 = $[14], t7 = $[15], text2 = $[16], weight = $[17]);
3408
+ const expandedProp = t1 === void 0 ? !1 : t1, fontSize = t2 === void 0 ? 1 : t2, linkAs = t3 === void 0 ? "a" : t3, padding = t4 === void 0 ? 2 : t4, radius = t5 === void 0 ? 2 : t5, selected = t6 === void 0 ? !1 : t6, space = t7 === void 0 ? 2 : t7, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
3060
3409
  path,
3061
3410
  registerItem,
3062
3411
  setExpanded,
3063
3412
  setFocusedElement
3064
- } = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, focused = tree.focusedElement && tree.focusedElement === rootRef.current, tabIndex = focused ? 0 : -1, contextValue = useMemo(() => ({
3413
+ } = tree, _id = useId(), id = idProp || _id;
3414
+ let t8, t9;
3415
+ if ($[18] !== id || $[19] !== path) {
3416
+ const itemPath = path.concat([id || ""]);
3417
+ t8 = itemPath, t9 = itemPath.join("/"), $[18] = id, $[19] = path, $[20] = t8, $[21] = t9;
3418
+ } else
3419
+ t8 = $[20], t9 = $[21];
3420
+ let t10;
3421
+ $[22] !== t8 || $[23] !== t9 ? (t10 = [t8, t9], $[22] = t8, $[23] = t9, $[24] = t10) : t10 = $[24];
3422
+ const [itemPath_0, itemKey] = t10, itemState = tree.state[itemKey], expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, focused = tree.focusedElement && tree.focusedElement === rootElement, tabIndex = focused ? 0 : -1, t11 = tree.level + 1;
3423
+ let t12;
3424
+ $[25] !== itemPath_0 || $[26] !== t11 || $[27] !== tree ? (t12 = {
3065
3425
  ...tree,
3066
- level: tree.level + 1,
3067
- path: itemPath
3068
- }), [itemPath, tree]), handleClick = useCallback((event) => {
3426
+ level: t11,
3427
+ path: itemPath_0
3428
+ }, $[25] = itemPath_0, $[26] = t11, $[27] = tree, $[28] = t12) : t12 = $[28];
3429
+ const contextValue = t12;
3430
+ let t13;
3431
+ $[29] !== expanded || $[30] !== itemKey || $[31] !== onClick || $[32] !== rootElement || $[33] !== setExpanded || $[34] !== setFocusedElement ? (t13 = (event) => {
3069
3432
  onClick && onClick(event);
3070
3433
  const target = event.target;
3071
- target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootRef.current));
3072
- }, [expanded, itemKey, onClick, setExpanded, setFocusedElement]), handleKeyDown = useCallback((event_0) => {
3073
- focused && event_0.key === "Enter" && (treeitemRef.current || rootRef.current)?.click();
3074
- }, [focused]);
3075
- useEffect(() => {
3076
- if (rootRef.current)
3077
- return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
3078
- }, [expanded, itemPath, registerItem, selected]);
3079
- const content2 = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
3080
- /* @__PURE__ */ jsxs(Box, { style: {
3081
- visibility: IconComponent || children ? "visible" : "hidden",
3082
- pointerEvents: "none"
3083
- }, children: [
3084
- IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }),
3085
- !IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
3086
- transform: expanded ? "rotate(90deg)" : void 0
3087
- } }) })
3088
- ] }),
3089
- /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text2 }) })
3090
- ] });
3091
- return href ? /* @__PURE__ */ jsxs(Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: treeItem({
3092
- className
3093
- }), onClick: handleClick, ref: rootRef, role: "none", children: [
3094
- /* @__PURE__ */ jsx(
3095
- Selectable,
3096
- {
3097
- "aria-expanded": expanded,
3098
- as: linkAs,
3099
- "data-ui": "TreeItem__box",
3100
- href,
3101
- radius,
3102
- ref: treeitemRef,
3103
- role: "treeitem",
3104
- selected,
3105
- tabIndex,
3106
- style: {
3107
- paddingLeft: `calc(${vars.space[2]} * ${tree.level})`
3108
- },
3109
- children: content2
3110
- }
3111
- ),
3112
- /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }) })
3113
- ] }) : /* @__PURE__ */ jsxs(Box, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...rest, "aria-expanded": expanded, className: treeItem({
3434
+ target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
3435
+ }, $[29] = expanded, $[30] = itemKey, $[31] = onClick, $[32] = rootElement, $[33] = setExpanded, $[34] = setFocusedElement, $[35] = t13) : t13 = $[35];
3436
+ const handleClick = t13;
3437
+ let t14;
3438
+ $[36] !== focused || $[37] !== rootElement ? (t14 = (event_0) => {
3439
+ focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
3440
+ }, $[36] = focused, $[37] = rootElement, $[38] = t14) : t14 = $[38];
3441
+ const handleKeyDown = t14;
3442
+ let t15, t16;
3443
+ $[39] !== expanded || $[40] !== itemKey || $[41] !== registerItem || $[42] !== rootElement || $[43] !== selected ? (t15 = () => {
3444
+ if (rootElement)
3445
+ return registerItem(rootElement, itemKey, expanded, selected);
3446
+ }, t16 = [expanded, itemKey, registerItem, rootElement, selected], $[39] = expanded, $[40] = itemKey, $[41] = registerItem, $[42] = rootElement, $[43] = selected, $[44] = t15, $[45] = t16) : (t15 = $[44], t16 = $[45]), useEffect(t15, t16);
3447
+ const t17 = IconComponent || children ? "visible" : "hidden";
3448
+ let t18;
3449
+ $[46] !== t17 ? (t18 = {
3450
+ visibility: t17,
3451
+ pointerEvents: "none"
3452
+ }, $[46] = t17, $[47] = t18) : t18 = $[47];
3453
+ let t19;
3454
+ $[48] !== IconComponent || $[49] !== fontSize || $[50] !== muted || $[51] !== weight ? (t19 = IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }), $[48] = IconComponent, $[49] = fontSize, $[50] = muted, $[51] = weight, $[52] = t19) : t19 = $[52];
3455
+ let t20;
3456
+ $[53] !== IconComponent || $[54] !== expanded || $[55] !== fontSize || $[56] !== muted || $[57] !== weight ? (t20 = !IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
3457
+ transform: expanded ? "rotate(90deg)" : void 0
3458
+ } }) }), $[53] = IconComponent, $[54] = expanded, $[55] = fontSize, $[56] = muted, $[57] = weight, $[58] = t20) : t20 = $[58];
3459
+ let t21;
3460
+ $[59] !== t18 || $[60] !== t19 || $[61] !== t20 ? (t21 = /* @__PURE__ */ jsxs(Box, { style: t18, children: [
3461
+ t19,
3462
+ t20
3463
+ ] }), $[59] = t18, $[60] = t19, $[61] = t20, $[62] = t21) : t21 = $[62];
3464
+ let t22;
3465
+ $[63] !== fontSize || $[64] !== muted || $[65] !== text2 || $[66] !== weight ? (t22 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text2 }) }), $[63] = fontSize, $[64] = muted, $[65] = text2, $[66] = weight, $[67] = t22) : t22 = $[67];
3466
+ let t23;
3467
+ $[68] !== padding || $[69] !== space || $[70] !== t21 || $[71] !== t22 ? (t23 = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
3468
+ t21,
3469
+ t22
3470
+ ] }), $[68] = padding, $[69] = space, $[70] = t21, $[71] = t22, $[72] = t23) : t23 = $[72];
3471
+ const content2 = t23;
3472
+ if (href) {
3473
+ const t242 = selected ? "" : void 0, t252 = rest;
3474
+ let t262;
3475
+ $[73] !== className ? (t262 = treeItem({
3476
+ className
3477
+ }), $[73] = className, $[74] = t262) : t262 = $[74];
3478
+ const t272 = `calc(${vars.space[2]} * ${tree.level})`;
3479
+ let t282;
3480
+ $[75] !== t272 ? (t282 = {
3481
+ paddingLeft: t272
3482
+ }, $[75] = t272, $[76] = t282) : t282 = $[76];
3483
+ let t292;
3484
+ $[77] !== content2 || $[78] !== expanded || $[79] !== href || $[80] !== linkAs || $[81] !== radius || $[82] !== selected || $[83] !== t282 || $[84] !== tabIndex ? (t292 = /* @__PURE__ */ jsx(Selectable, { "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, radius, ref: treeitemRef, role: "treeitem", selected, tabIndex, style: t282, children: content2 }), $[77] = content2, $[78] = expanded, $[79] = href, $[80] = linkAs, $[81] = radius, $[82] = selected, $[83] = t282, $[84] = tabIndex, $[85] = t292) : t292 = $[85];
3485
+ let t302;
3486
+ $[86] !== children || $[87] !== expanded ? (t302 = children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }), $[86] = children, $[87] = expanded, $[88] = t302) : t302 = $[88];
3487
+ let t312;
3488
+ $[89] !== contextValue || $[90] !== t302 ? (t312 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t302 }), $[89] = contextValue, $[90] = t302, $[91] = t312) : t312 = $[91];
3489
+ let t322;
3490
+ return $[92] !== handleClick || $[93] !== id || $[94] !== itemKey || $[95] !== t242 || $[96] !== t252 || $[97] !== t262 || $[98] !== t292 || $[99] !== t312 ? (t322 = /* @__PURE__ */ jsxs(Box, { "data-selected": t242, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...t252, as: "li", className: t262, onClick: handleClick, ref: setRootElement, role: "none", children: [
3491
+ t292,
3492
+ t312
3493
+ ] }), $[92] = handleClick, $[93] = id, $[94] = itemKey, $[95] = t242, $[96] = t252, $[97] = t262, $[98] = t292, $[99] = t312, $[100] = t322) : t322 = $[100], t322;
3494
+ }
3495
+ const t24 = selected ? "" : void 0, t25 = rest;
3496
+ let t26;
3497
+ $[101] !== className ? (t26 = treeItem({
3114
3498
  className
3115
- }), onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
3116
- /* @__PURE__ */ jsx(
3117
- Selectable,
3118
- {
3119
- as: "button",
3120
- "data-focused": focused ? "" : void 0,
3121
- "data-ui": "TreeItem__box",
3122
- radius,
3123
- selected,
3124
- style: {
3125
- paddingLeft: `calc(${vars.space[2]} * ${tree.level})`
3126
- },
3127
- children: content2
3128
- }
3129
- ),
3130
- /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
3131
- ] });
3499
+ }), $[101] = className, $[102] = t26) : t26 = $[102];
3500
+ const t27 = focused ? "" : void 0, t28 = `calc(${vars.space[2]} * ${tree.level})`;
3501
+ let t29;
3502
+ $[103] !== t28 ? (t29 = {
3503
+ paddingLeft: t28
3504
+ }, $[103] = t28, $[104] = t29) : t29 = $[104];
3505
+ let t30;
3506
+ $[105] !== content2 || $[106] !== radius || $[107] !== selected || $[108] !== t27 || $[109] !== t29 ? (t30 = /* @__PURE__ */ jsx(Selectable, { as: "button", "data-focused": t27, "data-ui": "TreeItem__box", radius, selected, style: t29, children: content2 }), $[105] = content2, $[106] = radius, $[107] = selected, $[108] = t27, $[109] = t29, $[110] = t30) : t30 = $[110];
3507
+ let t31;
3508
+ $[111] !== children || $[112] !== expanded ? (t31 = children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }), $[111] = children, $[112] = expanded, $[113] = t31) : t31 = $[113];
3509
+ let t32;
3510
+ $[114] !== contextValue || $[115] !== t31 ? (t32 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t31 }), $[114] = contextValue, $[115] = t31, $[116] = t32) : t32 = $[116];
3511
+ let t33;
3512
+ return $[117] !== expanded || $[118] !== handleClick || $[119] !== handleKeyDown || $[120] !== id || $[121] !== itemKey || $[122] !== t24 || $[123] !== t25 || $[124] !== t26 || $[125] !== t30 || $[126] !== t32 || $[127] !== tabIndex ? (t33 = /* @__PURE__ */ jsxs(Box, { "data-selected": t24, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...t25, "aria-expanded": expanded, className: t26, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
3513
+ t30,
3514
+ t32
3515
+ ] }), $[117] = expanded, $[118] = handleClick, $[119] = handleKeyDown, $[120] = id, $[121] = itemKey, $[122] = t24, $[123] = t25, $[124] = t26, $[125] = t30, $[126] = t32, $[127] = tabIndex, $[128] = t33) : t33 = $[128], t33;
3132
3516
  }
3133
3517
  function _isScrollable(el) {
3134
3518
  if (!(el instanceof Element)) return !1;
@@ -3137,21 +3521,32 @@ function _isScrollable(el) {
3137
3521
  }
3138
3522
  const _ResizeObserver = typeof document < "u" && typeof window < "u" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver, DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
3139
3523
  function VirtualList(props) {
3140
- const {
3141
- as = DEFAULT_VIRTUAL_LIST_ELEMENT,
3142
- gap = 0,
3524
+ const $ = c(44), t0 = props;
3525
+ let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
3526
+ $[0] !== t0 ? ({
3527
+ as: t1,
3528
+ gap: t2,
3143
3529
  getItemKey,
3144
- items = [],
3530
+ items: t3,
3145
3531
  onChange,
3146
3532
  renderItem,
3147
3533
  ref: forwardedRef,
3148
3534
  ...rest
3149
- } = props, ref = useRef(null), wrapperRef = useRef(null), [scrollTop, setScrollTop] = useState(0), [scrollHeight, setScrollHeight] = useState(0), [itemHeight, setItemHeight] = useState(-1), [gapValue, setGapValue] = useState(0);
3150
- useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => {
3151
- if (!ref.current) return;
3535
+ } = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
3536
+ const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
3537
+ let t4;
3538
+ $[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
3539
+ const items = t4, ref = useRef(null), wrapperRef = useRef(null), [scrollTop, setScrollTop] = useState(0), [scrollHeight, setScrollHeight] = useState(0), [itemHeight, setItemHeight] = useState(-1), [gapValue, setGapValue] = useState(0);
3540
+ let t5;
3541
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], useImperativeHandle(forwardedRef, t5);
3542
+ let t6, t7;
3543
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
3544
+ if (!ref.current)
3545
+ return;
3152
3546
  const scrollEl = findScrollable(ref.current.parentNode);
3153
3547
  if (scrollEl) {
3154
- if (!(scrollEl instanceof HTMLElement)) return;
3548
+ if (!(scrollEl instanceof HTMLElement))
3549
+ return;
3155
3550
  const handleScroll = () => {
3156
3551
  setScrollTop(scrollEl.scrollTop);
3157
3552
  };
@@ -3175,9 +3570,10 @@ function VirtualList(props) {
3175
3570
  }), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
3176
3571
  window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
3177
3572
  };
3178
- }, []);
3573
+ }, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), useEffect(t6, t7);
3179
3574
  const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
3180
- useEffect(() => {
3575
+ let t8, t9;
3576
+ $[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
3181
3577
  onChange?.({
3182
3578
  fromIndex,
3183
3579
  gap: gapValue,
@@ -3186,23 +3582,90 @@ function VirtualList(props) {
3186
3582
  scrollTop,
3187
3583
  toIndex
3188
3584
  });
3189
- }, [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex]), useEffect(() => {
3190
- setItemHeight(-1);
3191
- }, [renderItem]);
3192
- const children = useMemo(() => !renderItem || items.length === 0 ? null : itemHeight === -1 ? [/* @__PURE__ */ jsxs(Fragment, { children: [
3193
- /* @__PURE__ */ jsx(Box, { ref: (el) => el ? setItemHeight(el.offsetHeight) : void 0, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: renderItem(items[0]) }, 0),
3194
- /* @__PURE__ */ jsx("div", { ref: (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, style: {
3195
- height: vars.space[gap]
3196
- } })
3197
- ] })] : items.slice(fromIndex, toIndex).map((item, _itemIndex) => {
3198
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3199
- return /* @__PURE__ */ jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
3200
- top: itemIndex * (itemHeight + gapValue)
3201
- }, children: node }, key2);
3202
- }), [fromIndex, gap, gapValue, getItemKey, itemHeight, items, renderItem, toIndex]), wrapperStyle = useMemo(() => ({
3585
+ }, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), useEffect(t8, t9);
3586
+ let t10;
3587
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => {
3588
+ startTransition(() => setItemHeight(-1));
3589
+ }, $[23] = t10) : t10 = $[23];
3590
+ let t11;
3591
+ $[24] !== renderItem ? (t11 = [renderItem], $[24] = renderItem, $[25] = t11) : t11 = $[25], useEffect(t10, t11);
3592
+ let t12;
3593
+ $[26] !== fromIndex || $[27] !== gap || $[28] !== gapValue || $[29] !== getItemKey || $[30] !== itemHeight || $[31] !== items || $[32] !== renderItem || $[33] !== toIndex ? (t12 = {
3594
+ fromIndex,
3595
+ gap,
3596
+ getItemKey,
3597
+ itemHeight,
3598
+ items,
3599
+ renderItem,
3600
+ toIndex,
3601
+ gapValue,
3602
+ setGapValue,
3603
+ setItemHeight
3604
+ }, $[26] = fromIndex, $[27] = gap, $[28] = gapValue, $[29] = getItemKey, $[30] = itemHeight, $[31] = items, $[32] = renderItem, $[33] = toIndex, $[34] = t12) : t12 = $[34];
3605
+ const children = useChildren(t12);
3606
+ let t13;
3607
+ $[35] !== height ? (t13 = {
3203
3608
  height
3204
- }), [height]);
3205
- return /* @__PURE__ */ jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }) });
3609
+ }, $[35] = height, $[36] = t13) : t13 = $[36];
3610
+ const wrapperStyle = t13;
3611
+ let t14;
3612
+ $[37] !== children || $[38] !== wrapperStyle ? (t14 = /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[37] = children, $[38] = wrapperStyle, $[39] = t14) : t14 = $[39];
3613
+ let t15;
3614
+ return $[40] !== as || $[41] !== rest || $[42] !== t14 ? (t15 = /* @__PURE__ */ jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t14 }), $[40] = as, $[41] = rest, $[42] = t14, $[43] = t15) : t15 = $[43], t15;
3615
+ }
3616
+ function useChildren(t0) {
3617
+ const $ = c(32), {
3618
+ fromIndex,
3619
+ gap,
3620
+ getItemKey,
3621
+ itemHeight,
3622
+ items,
3623
+ renderItem,
3624
+ toIndex,
3625
+ gapValue,
3626
+ setGapValue,
3627
+ setItemHeight
3628
+ } = t0;
3629
+ if (!renderItem || items.length === 0)
3630
+ return null;
3631
+ if (itemHeight === -1) {
3632
+ let t12;
3633
+ $[0] !== setItemHeight ? (t12 = (el) => {
3634
+ el && setItemHeight(el.offsetHeight);
3635
+ }, $[0] = setItemHeight, $[1] = t12) : t12 = $[1];
3636
+ let t2;
3637
+ $[2] !== items[0] || $[3] !== renderItem ? (t2 = renderItem(items[0]), $[2] = items[0], $[3] = renderItem, $[4] = t2) : t2 = $[4];
3638
+ let t3;
3639
+ $[5] !== t12 || $[6] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { ref: t12, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t2 }, 0), $[5] = t12, $[6] = t2, $[7] = t3) : t3 = $[7];
3640
+ let t4;
3641
+ $[8] !== setGapValue ? (t4 = (el_0) => {
3642
+ el_0 && setGapValue(el_0.offsetHeight);
3643
+ }, $[8] = setGapValue, $[9] = t4) : t4 = $[9];
3644
+ const t5 = vars.space[gap];
3645
+ let t6;
3646
+ $[10] !== t5 ? (t6 = {
3647
+ height: t5
3648
+ }, $[10] = t5, $[11] = t6) : t6 = $[11];
3649
+ let t7;
3650
+ $[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsx("div", { ref: t4, style: t6 }), $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14];
3651
+ let t8;
3652
+ return $[15] !== t3 || $[16] !== t7 ? (t8 = [/* @__PURE__ */ jsxs(Fragment, { children: [
3653
+ t3,
3654
+ t7
3655
+ ] })], $[15] = t3, $[16] = t7, $[17] = t8) : t8 = $[17], t8;
3656
+ }
3657
+ let t1;
3658
+ if ($[18] !== fromIndex || $[19] !== gapValue || $[20] !== getItemKey || $[21] !== itemHeight || $[22] !== items || $[23] !== renderItem || $[24] !== toIndex) {
3659
+ let t2;
3660
+ $[26] !== fromIndex || $[27] !== gapValue || $[28] !== getItemKey || $[29] !== itemHeight || $[30] !== renderItem ? (t2 = (item, _itemIndex) => {
3661
+ const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3662
+ return /* @__PURE__ */ jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
3663
+ top: itemIndex * (itemHeight + gapValue)
3664
+ }, children: node }, key2);
3665
+ }, $[26] = fromIndex, $[27] = gapValue, $[28] = getItemKey, $[29] = itemHeight, $[30] = renderItem, $[31] = t2) : t2 = $[31], t1 = items.slice(fromIndex, toIndex).map(t2), $[18] = fromIndex, $[19] = gapValue, $[20] = getItemKey, $[21] = itemHeight, $[22] = items, $[23] = renderItem, $[24] = toIndex, $[25] = t1;
3666
+ } else
3667
+ t1 = $[25];
3668
+ return t1;
3206
3669
  }
3207
3670
  function findScrollable(parentNode) {
3208
3671
  let _scrollEl = parentNode;
@@ -3719,7 +4182,7 @@ function Skeleton(props) {
3719
4182
  let t2, t3;
3720
4183
  $[0] !== delay ? (t2 = () => {
3721
4184
  if (!delay)
3722
- return setVisible(!0);
4185
+ return;
3723
4186
  const timeout = setTimeout(() => {
3724
4187
  setVisible(!0);
3725
4188
  }, delay);
@@ -3730,7 +4193,7 @@ function Skeleton(props) {
3730
4193
  const t4 = "Skeleton", t5 = skeleton({
3731
4194
  className,
3732
4195
  ...rest
3733
- }), t6 = animated ? "" : void 0, t7 = visible ? "" : void 0;
4196
+ }), t6 = animated ? "" : void 0, t7 = !delay || visible ? "" : void 0;
3734
4197
  let t8;
3735
4198
  return $[3] !== As || $[4] !== rest || $[5] !== t5 || $[6] !== t6 || $[7] !== t7 ? (t8 = /* @__PURE__ */ jsx(As, { "data-ui": t4, ...rest, className: t5, "data-animated": t6, "data-visible": t7 }), $[3] = As, $[4] = rest, $[5] = t5, $[6] = t6, $[7] = t7, $[8] = t8) : t8 = $[8], t8;
3736
4199
  }
@@ -3941,7 +4404,7 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
3941
4404
  right: ["right-end", "right-start", "left", "top", "bottom"],
3942
4405
  "right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
3943
4406
  "right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
3944
- }, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v3/tooltipDelayGroup", null);
4407
+ }, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v4/tooltipDelayGroup", null);
3945
4408
  function useTooltipDelayGroup() {
3946
4409
  return use(TooltipDelayGroupContext);
3947
4410
  }
@@ -3999,64 +4462,71 @@ function TooltipLayer(props) {
3999
4462
  }
4000
4463
  const DEFAULT_TOOLTIP_ELEMENT = "div";
4001
4464
  function Tooltip(props) {
4002
- const boundaryElementContext = useBoundaryElement(), {
4003
- animate: _animate = !1,
4004
- arrow: arrowProp = !1,
4005
- as = DEFAULT_TOOLTIP_ELEMENT,
4006
- boundaryElement = boundaryElementContext?.element,
4465
+ const $ = c(143), boundaryElementContext = useBoundaryElement(), t0 = props;
4466
+ let _boundaryElement, _fallbackPlacements, childProp, className, content2, delay, disabled, forwardedRef, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, t8, t9;
4467
+ $[0] !== t0 ? ({
4468
+ animate: t1,
4469
+ arrow: t2,
4470
+ as: t3,
4471
+ boundaryElement: _boundaryElement,
4007
4472
  children: childProp,
4008
4473
  className,
4009
4474
  content: content2,
4010
4475
  delay,
4011
4476
  disabled,
4012
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4013
- padding = 2,
4014
- placement: placementProp = "bottom",
4477
+ fallbackPlacements: _fallbackPlacements,
4478
+ padding: t4,
4479
+ placement: t5,
4015
4480
  portal: portalProp,
4016
- radius = 3,
4481
+ radius: t6,
4017
4482
  ref: forwardedRef,
4018
4483
  scheme,
4019
- shadow = 2,
4020
- zOffset = Z_OFFSETS.tooltip,
4021
- tone = "inherit",
4484
+ shadow: t7,
4485
+ zOffset: t8,
4486
+ tone: t9,
4022
4487
  ...rest
4023
- } = props, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4024
- useImperativeHandle(forwardedRef, () => ref.current);
4025
- const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = useMemo(() => {
4026
- const ret = [];
4027
- return ret.push(flip({
4028
- boundary: boundaryElement || void 0,
4029
- fallbackPlacements,
4030
- padding: DEFAULT_TOOLTIP_PADDING,
4031
- rootBoundary
4032
- })), ret.push(offset({
4033
- mainAxis: DEFAULT_TOOLTIP_DISTANCE
4034
- })), ret.push(shift({
4035
- boundary: boundaryElement || void 0,
4036
- rootBoundary,
4037
- padding: DEFAULT_TOOLTIP_PADDING
4038
- })), arrowProp && ret.push(arrow({
4039
- element: arrowRef,
4040
- padding: DEFAULT_TOOLTIP_PADDING
4041
- })), animate && ret.push(origin), ret;
4042
- }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
4488
+ } = t0, $[0] = t0, $[1] = _boundaryElement, $[2] = _fallbackPlacements, $[3] = childProp, $[4] = className, $[5] = content2, $[6] = delay, $[7] = disabled, $[8] = forwardedRef, $[9] = portalProp, $[10] = rest, $[11] = scheme, $[12] = t1, $[13] = t2, $[14] = t3, $[15] = t4, $[16] = t5, $[17] = t6, $[18] = t7, $[19] = t8, $[20] = t9) : (_boundaryElement = $[1], _fallbackPlacements = $[2], childProp = $[3], className = $[4], content2 = $[5], delay = $[6], disabled = $[7], forwardedRef = $[8], portalProp = $[9], rest = $[10], scheme = $[11], t1 = $[12], t2 = $[13], t3 = $[14], t4 = $[15], t5 = $[16], t6 = $[17], t7 = $[18], t8 = $[19], t9 = $[20]);
4489
+ const _animate = t1 === void 0 ? !1 : t1, arrowProp = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_TOOLTIP_ELEMENT : t3, padding = t4 === void 0 ? 2 : t4, placementProp = t5 === void 0 ? "bottom" : t5, radius = t6 === void 0 ? 3 : t6, shadow = t7 === void 0 ? 2 : t7, zOffset = t8 === void 0 ? Z_OFFSETS.tooltip : t8, tone = t9 === void 0 ? "inherit" : t9, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4490
+ let t10;
4491
+ $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => ref.current, $[21] = t10) : t10 = $[21], useImperativeHandle(forwardedRef, t10);
4492
+ const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element;
4493
+ let t11;
4494
+ $[22] !== animate || $[23] !== arrowProp || $[24] !== boundaryElement || $[25] !== fallbackPlacements ? (t11 = {
4495
+ animate,
4496
+ arrowProp,
4497
+ arrowRef,
4498
+ boundaryElement,
4499
+ fallbackPlacements,
4500
+ rootBoundary: "viewport"
4501
+ }, $[22] = animate, $[23] = arrowProp, $[24] = boundaryElement, $[25] = fallbackPlacements, $[26] = t11) : t11 = $[26];
4502
+ const middleware = useMiddleware(t11);
4503
+ let t12;
4504
+ $[27] !== referenceElement ? (t12 = {
4505
+ reference: referenceElement
4506
+ }, $[27] = referenceElement, $[28] = t12) : t12 = $[28];
4507
+ let t13;
4508
+ $[29] !== middleware || $[30] !== placementProp || $[31] !== t12 ? (t13 = {
4509
+ middleware,
4510
+ placement: placementProp,
4511
+ whileElementsMounted: autoUpdate,
4512
+ elements: t12,
4513
+ transform: !1
4514
+ }, $[29] = middleware, $[30] = placementProp, $[31] = t12, $[32] = t13) : t13 = $[32];
4515
+ const {
4043
4516
  floatingStyles,
4044
4517
  placement,
4045
4518
  middlewareData,
4046
4519
  refs,
4047
4520
  update
4048
- } = useFloating({
4049
- middleware,
4050
- placement: placementProp,
4051
- whileElementsMounted: autoUpdate,
4052
- elements: {
4053
- reference: referenceElement
4054
- },
4055
- transform: !1
4056
- }), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
4521
+ } = useFloating(t13), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup();
4522
+ let t14;
4523
+ $[33] !== delayGroupContext ? (t14 = delayGroupContext || {}, $[33] = delayGroupContext, $[34] = t14) : t14 = $[34];
4524
+ const {
4057
4525
  setIsGroupActive,
4058
4526
  setOpenTooltipId
4059
- } = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = useCallback((open, immediate) => {
4527
+ } = t14, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
4528
+ let t15;
4529
+ $[35] !== closeDelay || $[36] !== isInsideGroup || $[37] !== openDelay || $[38] !== setIsGroupActive || $[39] !== setIsOpen || $[40] !== setOpenTooltipId || $[41] !== tooltipId ? (t15 = (open, immediate) => {
4060
4530
  if (isInsideGroup)
4061
4531
  if (open) {
4062
4532
  const groupedOpenDelay = immediate ? 0 : openDelay;
@@ -4067,65 +4537,173 @@ function Tooltip(props) {
4067
4537
  }
4068
4538
  else
4069
4539
  setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
4070
- }, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = useCallback((e) => {
4540
+ }, $[35] = closeDelay, $[36] = isInsideGroup, $[37] = openDelay, $[38] = setIsGroupActive, $[39] = setIsOpen, $[40] = setOpenTooltipId, $[41] = tooltipId, $[42] = t15) : t15 = $[42];
4541
+ const handleIsOpenChange = t15;
4542
+ let t16;
4543
+ $[43] !== childProp?.props || $[44] !== handleIsOpenChange ? (t16 = (e) => {
4071
4544
  handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
4072
- }, [childProp?.props, handleIsOpenChange]), handleClick = useCallback((e_0) => {
4545
+ }, $[43] = childProp?.props, $[44] = handleIsOpenChange, $[45] = t16) : t16 = $[45];
4546
+ const handleBlur = t16;
4547
+ let t17;
4548
+ $[46] !== childProp?.props || $[47] !== handleIsOpenChange ? (t17 = (e_0) => {
4073
4549
  handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
4074
- }, [childProp?.props, handleIsOpenChange]), handleContextMenu = useCallback((e_1) => {
4550
+ }, $[46] = childProp?.props, $[47] = handleIsOpenChange, $[48] = t17) : t17 = $[48];
4551
+ const handleClick = t17;
4552
+ let t18;
4553
+ $[49] !== childProp?.props || $[50] !== handleIsOpenChange ? (t18 = (e_1) => {
4075
4554
  handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
4076
- }, [childProp?.props, handleIsOpenChange]), handleFocus = useCallback((e_2) => {
4555
+ }, $[49] = childProp?.props, $[50] = handleIsOpenChange, $[51] = t18) : t18 = $[51];
4556
+ const handleContextMenu = t18;
4557
+ let t19;
4558
+ $[52] !== childProp?.props || $[53] !== handleIsOpenChange ? (t19 = (e_2) => {
4077
4559
  handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
4078
- }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = useCallback((e_3) => {
4560
+ }, $[52] = childProp?.props, $[53] = handleIsOpenChange, $[54] = t19) : t19 = $[54];
4561
+ const handleFocus = t19;
4562
+ let t20;
4563
+ $[55] !== childProp?.props || $[56] !== handleIsOpenChange ? (t20 = (e_3) => {
4079
4564
  handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
4080
- }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = useCallback((e_4) => {
4565
+ }, $[55] = childProp?.props, $[56] = handleIsOpenChange, $[57] = t20) : t20 = $[57];
4566
+ const handleMouseEnter = t20;
4567
+ let t21;
4568
+ $[58] !== childProp?.props || $[59] !== handleIsOpenChange ? (t21 = (e_4) => {
4081
4569
  handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
4082
- }, [childProp?.props, handleIsOpenChange]);
4083
- useCloseOnMouseLeave({
4570
+ }, $[58] = childProp?.props, $[59] = handleIsOpenChange, $[60] = t21) : t21 = $[60];
4571
+ const handleMouseLeave = t21;
4572
+ let t22;
4573
+ $[61] !== handleIsOpenChange || $[62] !== isInsideGroup || $[63] !== referenceElement || $[64] !== showTooltip ? (t22 = {
4084
4574
  handleIsOpenChange,
4085
4575
  referenceElement,
4086
4576
  showTooltip,
4087
4577
  isInsideGroup
4088
- }), useEffect(() => {
4578
+ }, $[61] = handleIsOpenChange, $[62] = isInsideGroup, $[63] = referenceElement, $[64] = showTooltip, $[65] = t22) : t22 = $[65], useCloseOnMouseLeave(t22);
4579
+ let t23, t24;
4580
+ $[66] !== disabled || $[67] !== handleIsOpenChange || $[68] !== showTooltip ? (t23 = () => {
4089
4581
  disabled && showTooltip && handleIsOpenChange(!1);
4090
- }, [disabled, handleIsOpenChange, showTooltip]), useEffect(() => {
4582
+ }, t24 = [disabled, handleIsOpenChange, showTooltip], $[66] = disabled, $[67] = handleIsOpenChange, $[68] = showTooltip, $[69] = t23, $[70] = t24) : (t23 = $[69], t24 = $[70]), useEffect(t23, t24);
4583
+ let t25, t26;
4584
+ $[71] !== content2 || $[72] !== handleIsOpenChange || $[73] !== showTooltip ? (t25 = () => {
4091
4585
  !content2 && showTooltip && handleIsOpenChange(!1);
4092
- }, [content2, handleIsOpenChange, showTooltip]), useEffect(() => {
4093
- if (!showTooltip) return;
4094
- function handleWindowKeyDown(event) {
4586
+ }, t26 = [content2, handleIsOpenChange, showTooltip], $[71] = content2, $[72] = handleIsOpenChange, $[73] = showTooltip, $[74] = t25, $[75] = t26) : (t25 = $[74], t26 = $[75]), useEffect(t25, t26);
4587
+ let t27, t28;
4588
+ $[76] !== handleIsOpenChange || $[77] !== showTooltip ? (t27 = () => {
4589
+ if (!showTooltip)
4590
+ return;
4591
+ const handleWindowKeyDown = function(event) {
4095
4592
  event.key === "Escape" && handleIsOpenChange(!1, !0);
4096
- }
4593
+ };
4097
4594
  return window.addEventListener("keydown", handleWindowKeyDown), () => {
4098
4595
  window.removeEventListener("keydown", handleWindowKeyDown);
4099
4596
  };
4100
- }, [handleIsOpenChange, showTooltip]), useLayoutEffect(() => {
4597
+ }, t28 = [handleIsOpenChange, showTooltip], $[76] = handleIsOpenChange, $[77] = showTooltip, $[78] = t27, $[79] = t28) : (t27 = $[78], t28 = $[79]), useEffect(t27, t28);
4598
+ let t29;
4599
+ $[80] !== boundaryElement || $[81] !== portalElement?.offsetWidth ? (t29 = () => {
4101
4600
  const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
4102
4601
  setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
4103
- }, [boundaryElement, portalElement]);
4104
- const setArrow = useCallback((arrowEl) => {
4602
+ }, $[80] = boundaryElement, $[81] = portalElement?.offsetWidth, $[82] = t29) : t29 = $[82];
4603
+ let t30;
4604
+ $[83] !== boundaryElement || $[84] !== portalElement ? (t30 = [boundaryElement, portalElement], $[83] = boundaryElement, $[84] = portalElement, $[85] = t30) : t30 = $[85], useLayoutEffect(t29, t30);
4605
+ let t31;
4606
+ $[86] !== update ? (t31 = (arrowEl) => {
4105
4607
  arrowRef.current = arrowEl, update();
4106
- }, [update]), setFloating = useCallback((node) => {
4608
+ }, $[86] = update, $[87] = t31) : t31 = $[87];
4609
+ const setArrow = t31;
4610
+ let t32;
4611
+ $[88] !== refs ? (t32 = (node) => {
4107
4612
  ref.current = node, refs.setFloating(node);
4108
- }, [refs]), child = useMemo(() => childProp ? cloneElement(childProp, {
4109
- onBlur: handleBlur,
4110
- onFocus: handleFocus,
4111
- onMouseEnter: handleMouseEnter,
4112
- onMouseLeave: handleMouseLeave,
4113
- onClick: handleClick,
4114
- onContextMenu: handleContextMenu,
4115
- ref: setReferenceElement
4116
- }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
4117
- if (useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsx(Fragment, {});
4118
- if (disabled) return child;
4119
- const node_0 = /* @__PURE__ */ jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: tooltip({
4613
+ }, $[88] = refs, $[89] = t32) : t32 = $[89];
4614
+ const setFloating = t32;
4615
+ let t33;
4616
+ bb0: {
4617
+ if (!childProp) {
4618
+ t33 = null;
4619
+ break bb0;
4620
+ }
4621
+ let t342;
4622
+ $[90] !== childProp || $[91] !== handleBlur || $[92] !== handleClick || $[93] !== handleContextMenu || $[94] !== handleFocus || $[95] !== handleMouseEnter || $[96] !== handleMouseLeave ? (t342 = cloneElement(childProp, {
4623
+ onBlur: handleBlur,
4624
+ onFocus: handleFocus,
4625
+ onMouseEnter: handleMouseEnter,
4626
+ onMouseLeave: handleMouseLeave,
4627
+ onClick: handleClick,
4628
+ onContextMenu: handleContextMenu,
4629
+ ref: setReferenceElement
4630
+ }), $[90] = childProp, $[91] = handleBlur, $[92] = handleClick, $[93] = handleContextMenu, $[94] = handleFocus, $[95] = handleMouseEnter, $[96] = handleMouseLeave, $[97] = t342) : t342 = $[97], t33 = t342;
4631
+ }
4632
+ const child = t33;
4633
+ let t34;
4634
+ $[98] !== childProp ? (t34 = childProp ? getElementRef(childProp) : null, $[98] = childProp, $[99] = t34) : t34 = $[99];
4635
+ let t35, t36;
4636
+ if ($[100] !== referenceElement ? (t35 = () => referenceElement, t36 = [referenceElement], $[100] = referenceElement, $[101] = t35, $[102] = t36) : (t35 = $[101], t36 = $[102]), useImperativeHandle(t34, t35, t36), !child) {
4637
+ let t372;
4638
+ return $[103] === Symbol.for("react.memo_cache_sentinel") ? (t372 = /* @__PURE__ */ jsx(Fragment, {}), $[103] = t372) : t372 = $[103], t372;
4639
+ }
4640
+ if (disabled)
4641
+ return child;
4642
+ let t37;
4643
+ $[104] !== className ? (t37 = tooltip({
4120
4644
  className
4121
- }), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
4645
+ }), $[104] = className, $[105] = t37) : t37 = $[105];
4646
+ const t38 = tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0;
4647
+ let t39;
4648
+ $[106] !== floatingStyles || $[107] !== t38 ? (t39 = {
4122
4649
  ...floatingStyles,
4123
- maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
4124
- }, tone, zOffset, children: content2 }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
4125
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4126
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
4650
+ maxWidth: t38
4651
+ }, $[106] = floatingStyles, $[107] = t38, $[108] = t39) : t39 = $[108];
4652
+ let t40;
4653
+ $[109] !== animate || $[110] !== arrowProp || $[111] !== arrowX || $[112] !== arrowY || $[113] !== as || $[114] !== content2 || $[115] !== originX || $[116] !== originY || $[117] !== padding || $[118] !== placement || $[119] !== radius || $[120] !== rest || $[121] !== scheme || $[122] !== setArrow || $[123] !== setFloating || $[124] !== shadow || $[125] !== t37 || $[126] !== t39 || $[127] !== tone || $[128] !== zOffset ? (t40 = /* @__PURE__ */ jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: t37, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: t39, tone, zOffset, children: content2 }), $[109] = animate, $[110] = arrowProp, $[111] = arrowX, $[112] = arrowY, $[113] = as, $[114] = content2, $[115] = originX, $[116] = originY, $[117] = padding, $[118] = placement, $[119] = radius, $[120] = rest, $[121] = scheme, $[122] = setArrow, $[123] = setFloating, $[124] = shadow, $[125] = t37, $[126] = t39, $[127] = tone, $[128] = zOffset, $[129] = t40) : t40 = $[129];
4654
+ const node_0 = t40;
4655
+ let t41;
4656
+ $[130] !== card2 || $[131] !== node_0 || $[132] !== portalProp || $[133] !== scheme || $[134] !== showTooltip || $[135] !== tone ? (t41 = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0), $[130] = card2, $[131] = node_0, $[132] = portalProp, $[133] = scheme, $[134] = showTooltip, $[135] = tone, $[136] = t41) : t41 = $[136];
4657
+ const children = t41;
4658
+ let t42;
4659
+ $[137] !== animate || $[138] !== children ? (t42 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[137] = animate, $[138] = children, $[139] = t42) : t42 = $[139];
4660
+ let t43;
4661
+ return $[140] !== child || $[141] !== t42 ? (t43 = /* @__PURE__ */ jsxs(Fragment, { children: [
4662
+ t42,
4127
4663
  child
4128
- ] });
4664
+ ] }), $[140] = child, $[141] = t42, $[142] = t43) : t43 = $[142], t43;
4665
+ }
4666
+ function useMiddleware(t0) {
4667
+ const $ = c(17), {
4668
+ animate,
4669
+ arrowProp,
4670
+ arrowRef,
4671
+ boundaryElement,
4672
+ fallbackPlacements,
4673
+ rootBoundary
4674
+ } = t0;
4675
+ let ret;
4676
+ if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryElement || $[4] !== fallbackPlacements || $[5] !== rootBoundary) {
4677
+ ret = [];
4678
+ const t1 = boundaryElement || void 0;
4679
+ let t2;
4680
+ $[7] !== fallbackPlacements || $[8] !== rootBoundary || $[9] !== t1 ? (t2 = flip({
4681
+ boundary: t1,
4682
+ fallbackPlacements,
4683
+ padding: DEFAULT_TOOLTIP_PADDING,
4684
+ rootBoundary
4685
+ }), $[7] = fallbackPlacements, $[8] = rootBoundary, $[9] = t1, $[10] = t2) : t2 = $[10], ret.push(t2);
4686
+ let t3;
4687
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = offset({
4688
+ mainAxis: DEFAULT_TOOLTIP_DISTANCE
4689
+ }), $[11] = t3) : t3 = $[11], ret.push(t3);
4690
+ const t4 = boundaryElement || void 0;
4691
+ let t5;
4692
+ if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
4693
+ boundary: t4,
4694
+ rootBoundary,
4695
+ padding: DEFAULT_TOOLTIP_PADDING
4696
+ }), $[12] = rootBoundary, $[13] = t4, $[14] = t5) : t5 = $[14], ret.push(t5), arrowProp) {
4697
+ let t6;
4698
+ $[15] !== arrowRef ? (t6 = arrow({
4699
+ element: arrowRef,
4700
+ padding: DEFAULT_TOOLTIP_PADDING
4701
+ }), $[15] = arrowRef, $[16] = t6) : t6 = $[16], ret.push(t6);
4702
+ }
4703
+ animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryElement, $[4] = fallbackPlacements, $[5] = rootBoundary, $[6] = ret;
4704
+ } else
4705
+ ret = $[6];
4706
+ return ret;
4129
4707
  }
4130
4708
  function useCloseOnMouseLeave(t0) {
4131
4709
  const $ = c(10), {
@@ -4256,8 +4834,8 @@ function PortalProvider(props) {
4256
4834
  const $ = c(9), {
4257
4835
  children,
4258
4836
  element,
4259
- __unstable_elements: elementsProp
4260
- } = props, elements = useUnique(elementsProp), parentPortal = use(PortalContext);
4837
+ __unstable_elements: elements
4838
+ } = props, parentPortal = use(PortalContext);
4261
4839
  let t0;
4262
4840
  $[0] !== elements || $[1] !== parentPortal ? (t0 = () => elements?.default ?? (parentPortal.element || document.body), $[0] = elements, $[1] = parentPortal, $[2] = t0) : t0 = $[2];
4263
4841
  const fallbackElement = useSyncExternalStore(emptySubscribe, t0, _temp), t1 = element || fallbackElement;
@@ -4270,23 +4848,13 @@ function PortalProvider(props) {
4270
4848
  }, $[3] = elements, $[4] = t1, $[5] = t2) : t2 = $[5];
4271
4849
  const value = t2;
4272
4850
  let t3;
4273
- return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
4851
+ return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(PortalContext, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
4274
4852
  }
4275
4853
  function _temp() {
4276
4854
  return null;
4277
4855
  }
4278
4856
  const emptySubscribe = () => () => {
4279
4857
  };
4280
- function useUnique(value) {
4281
- const valueRef = useRef(value);
4282
- return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
4283
- }
4284
- function _isEqual(objA, objB) {
4285
- if (!objA || !objB)
4286
- return objA === objB;
4287
- const keysA = Object.keys(objA), keysB = Object.keys(objB);
4288
- return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
4289
- }
4290
4858
  function RootProvider(props) {
4291
4859
  const $ = c(10), {
4292
4860
  boundaryElement: t0,