@sanity/ui 2.9.0-canary.3 → 2.9.0-canary.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { c } from "react-compiler-runtime";
4
- import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, useMemo, useCallback, Component, memo, useLayoutEffect, useReducer, Fragment as Fragment$1, startTransition } from "react";
4
+ import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, Component, memo, useLayoutEffect, useMemo, useCallback, useReducer, Fragment as Fragment$1, startTransition } from "react";
5
5
  import ReactIs, { isValidElementType } from "react-is";
6
6
  import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
7
7
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
@@ -3221,16 +3221,37 @@ function findMinBreakpoints(media, width) {
3221
3221
  return ret;
3222
3222
  }
3223
3223
  const ElementQuery = forwardRef(function(props, forwardedRef) {
3224
- const theme = useTheme_v2(), {
3224
+ const $ = c(18), theme = useTheme_v2();
3225
+ let _media, restProps, children;
3226
+ $[0] !== props ? ({
3225
3227
  children,
3226
3228
  media: _media,
3227
3229
  ...restProps
3228
- } = props, media = _media ?? theme.media, ref = useRef(null), [element, setElement] = useState(null), elementSize = useElementSize(element), width = useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
3229
- useImperativeHandle(forwardedRef, () => ref.current);
3230
- const setRef = useCallback((el) => {
3231
- ref.current = el, setElement(el);
3232
- }, []);
3233
- return /* @__PURE__ */ jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": max.length ? max.join(" ") : void 0, "data-eq-min": min.length ? min.join(" ") : void 0, ref: setRef, children });
3230
+ } = props, $[0] = props, $[1] = _media, $[2] = restProps, $[3] = children) : (_media = $[1], restProps = $[2], children = $[3]);
3231
+ const media = _media ?? theme.media, [element, setElement] = useState(null), elementSize = useElementSize(element);
3232
+ let t0;
3233
+ t0 = elementSize?.border.width ?? window.innerWidth;
3234
+ const width = t0;
3235
+ let t1, t2;
3236
+ if ($[4] !== media || $[5] !== width) {
3237
+ const eq = findMaxBreakpoints(media, width);
3238
+ t2 = eq.length ? eq.join(" ") : void 0, $[4] = media, $[5] = width, $[6] = t2;
3239
+ } else
3240
+ t2 = $[6];
3241
+ t1 = t2;
3242
+ const max = t1;
3243
+ let t3, t4;
3244
+ if ($[7] !== media || $[8] !== width) {
3245
+ const eq_0 = findMinBreakpoints(media, width);
3246
+ t4 = eq_0.length ? eq_0.join(" ") : void 0, $[7] = media, $[8] = width, $[9] = t4;
3247
+ } else
3248
+ t4 = $[9];
3249
+ t3 = t4;
3250
+ const min = t3;
3251
+ let t5, t6;
3252
+ $[10] !== element ? (t5 = () => element, t6 = [element], $[10] = element, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), useImperativeHandle(forwardedRef, t5, t6);
3253
+ let t7;
3254
+ return $[13] !== restProps || $[14] !== max || $[15] !== min || $[16] !== children ? (t7 = /* @__PURE__ */ jsx("div", { "data-ui": "ElementQuery", ...restProps, "data-eq-max": max, "data-eq-min": min, ref: setElement, children }), $[13] = restProps, $[14] = max, $[15] = min, $[16] = children, $[17] = t7) : t7 = $[17], t7;
3234
3255
  });
3235
3256
  ElementQuery.displayName = "ForwardRef(ElementQuery)";
3236
3257
  class ErrorBoundary extends Component {
@@ -3357,10 +3378,18 @@ function _isScrollable(el) {
3357
3378
  return style.overflowX.includes("auto") || style.overflowX.includes("scroll") || style.overflowY.includes("auto") || style.overflowY.includes("scroll");
3358
3379
  }
3359
3380
  function LayerProvider(props) {
3360
- const {
3381
+ const $ = c(19), {
3361
3382
  children,
3362
- zOffset: zOffsetProp = 0
3363
- } = props, parentContextValue = useContext(LayerContext), parent = parentContextValue && getLayerContext(parentContextValue), parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useArrayProp(zOffsetProp), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], [, setChildLayers] = useState({}), [size2, setSize] = useState(0), isTopLayer = size2 === 0, registerChild = useCallback((childLevel) => {
3383
+ zOffset: t0
3384
+ } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext);
3385
+ let t1;
3386
+ $[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
3387
+ const parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useArrayProp(zOffsetProp), maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
3388
+ let t2;
3389
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
3390
+ const [, setChildLayers] = useState(t2), [size2, setSize] = useState(0), isTopLayer = size2 === 0;
3391
+ let t3;
3392
+ $[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
3364
3393
  const parentDispose = parentRegisterChild?.(childLevel);
3365
3394
  return childLevel !== void 0 ? setChildLayers((state) => {
3366
3395
  const prevLen = state[childLevel] ?? 0, nextState = {
@@ -3373,20 +3402,25 @@ function LayerProvider(props) {
3373
3402
  const nextState_0 = {
3374
3403
  ...state_0
3375
3404
  };
3376
- return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] -= 1, nextState_0;
3405
+ return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
3377
3406
  }) : setSize((v_0) => v_0 - 1), parentDispose?.();
3378
3407
  };
3379
- }, [parentRegisterChild]);
3380
- useEffect(() => parentRegisterChild?.(level), [level, parentRegisterChild]);
3381
- const value = useMemo(() => ({
3408
+ }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
3409
+ const registerChild = t3;
3410
+ let t4, t5;
3411
+ $[6] !== parentRegisterChild || $[7] !== level ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = parentRegisterChild, $[7] = level, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), useEffect(t4, t5);
3412
+ let t6, t7;
3413
+ $[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
3382
3414
  version: 0,
3383
3415
  isTopLayer,
3384
3416
  level,
3385
3417
  registerChild,
3386
3418
  size: size2,
3387
3419
  zIndex
3388
- }), [isTopLayer, level, registerChild, size2, zIndex]);
3389
- return /* @__PURE__ */ jsx(LayerContext.Provider, { value, children });
3420
+ }, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
3421
+ const value = t6;
3422
+ let t8;
3423
+ return $[16] !== value || $[17] !== children ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children }), $[16] = value, $[17] = children, $[18] = t8) : t8 = $[18], t8;
3390
3424
  }
3391
3425
  LayerProvider.displayName = "LayerProvider";
3392
3426
  const Root$j = styled.div({
@@ -3729,8 +3763,8 @@ const MotionCard$1 = styled(motion(Card))`
3729
3763
  will-change: opacity;
3730
3764
  }
3731
3765
  `, PopoverCard = memo(forwardRef(function(props, ref) {
3732
- const $ = c(60);
3733
- let marginsProp, xProp, yProp, animate, originX, originY, strategy, style, width, arrowX, arrowY, restProps, padding, children, overflow, arrow2, arrowRef, placement, radius, scheme, shadow, tone;
3766
+ const $ = c(58);
3767
+ let marginsProp, xProp, yProp, animate, originX, originY, strategy, style, arrowX, arrowY, restProps, padding, children, overflow, arrow2, arrowRef, placement, radius, scheme, shadow, tone;
3734
3768
  $[0] !== props ? ({
3735
3769
  __unstable_margins: marginsProp,
3736
3770
  animate,
@@ -3750,11 +3784,10 @@ const MotionCard$1 = styled(motion(Card))`
3750
3784
  strategy,
3751
3785
  style,
3752
3786
  tone,
3753
- width,
3754
3787
  x: xProp,
3755
3788
  y: yProp,
3756
3789
  ...restProps
3757
- } = props, $[0] = props, $[1] = marginsProp, $[2] = xProp, $[3] = yProp, $[4] = animate, $[5] = originX, $[6] = originY, $[7] = strategy, $[8] = style, $[9] = width, $[10] = arrowX, $[11] = arrowY, $[12] = restProps, $[13] = padding, $[14] = children, $[15] = overflow, $[16] = arrow2, $[17] = arrowRef, $[18] = placement, $[19] = radius, $[20] = scheme, $[21] = shadow, $[22] = tone) : (marginsProp = $[1], xProp = $[2], yProp = $[3], animate = $[4], originX = $[5], originY = $[6], strategy = $[7], style = $[8], width = $[9], arrowX = $[10], arrowY = $[11], restProps = $[12], padding = $[13], children = $[14], overflow = $[15], arrow2 = $[16], arrowRef = $[17], placement = $[18], radius = $[19], scheme = $[20], shadow = $[21], tone = $[22]);
3790
+ } = props, $[0] = props, $[1] = marginsProp, $[2] = xProp, $[3] = yProp, $[4] = animate, $[5] = originX, $[6] = originY, $[7] = strategy, $[8] = style, $[9] = arrowX, $[10] = arrowY, $[11] = restProps, $[12] = padding, $[13] = children, $[14] = overflow, $[15] = arrow2, $[16] = arrowRef, $[17] = placement, $[18] = radius, $[19] = scheme, $[20] = shadow, $[21] = tone) : (marginsProp = $[1], xProp = $[2], yProp = $[3], animate = $[4], originX = $[5], originY = $[6], strategy = $[7], style = $[8], arrowX = $[9], arrowY = $[10], restProps = $[11], padding = $[12], children = $[13], overflow = $[14], arrow2 = $[15], arrowRef = $[16], placement = $[17], radius = $[18], scheme = $[19], shadow = $[20], tone = $[21]);
3758
3791
  const {
3759
3792
  zIndex
3760
3793
  } = useLayer();
@@ -3764,139 +3797,163 @@ const MotionCard$1 = styled(motion(Card))`
3764
3797
  let t1;
3765
3798
  const t2 = animate ? "transform" : void 0;
3766
3799
  let t3;
3767
- $[23] !== x || $[24] !== originX || $[25] !== originY || $[26] !== strategy || $[27] !== y || $[28] !== width || $[29] !== zIndex || $[30] !== t2 || $[31] !== style ? (t3 = {
3800
+ $[22] !== x || $[23] !== originX || $[24] !== originY || $[25] !== strategy || $[26] !== y || $[27] !== zIndex || $[28] !== t2 || $[29] !== style ? (t3 = {
3768
3801
  left: x,
3769
3802
  originX,
3770
3803
  originY,
3771
3804
  position: strategy,
3772
3805
  top: y,
3773
- width,
3774
3806
  zIndex,
3775
3807
  willChange: t2,
3776
3808
  ...style
3777
- }, $[23] = x, $[24] = originX, $[25] = originY, $[26] = strategy, $[27] = y, $[28] = width, $[29] = zIndex, $[30] = t2, $[31] = style, $[32] = t3) : t3 = $[32], t1 = t3;
3809
+ }, $[22] = x, $[23] = originX, $[24] = originY, $[25] = strategy, $[26] = y, $[27] = zIndex, $[28] = t2, $[29] = style, $[30] = t3) : t3 = $[30], t1 = t3;
3778
3810
  const rootStyle2 = t1;
3779
3811
  let t4;
3780
3812
  const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
3781
3813
  let t7;
3782
- $[33] !== t5 || $[34] !== t6 ? (t7 = {
3814
+ $[31] !== t5 || $[32] !== t6 ? (t7 = {
3783
3815
  left: t5,
3784
3816
  top: t6,
3785
3817
  right: void 0,
3786
3818
  bottom: void 0
3787
- }, $[33] = t5, $[34] = t6, $[35] = t7) : t7 = $[35], t4 = t7;
3819
+ }, $[31] = t5, $[32] = t6, $[33] = t7) : t7 = $[33], t4 = t7;
3788
3820
  const arrowStyle = t4, t8 = restProps;
3789
3821
  let t9;
3790
- $[36] !== animate ? (t9 = animate ? POPOVER_MOTION_PROPS : {}, $[36] = animate, $[37] = t9) : t9 = $[37];
3822
+ $[34] !== animate ? (t9 = animate ? POPOVER_MOTION_PROPS : {}, $[34] = animate, $[35] = t9) : t9 = $[35];
3791
3823
  let t10;
3792
- $[38] !== padding || $[39] !== children ? (t10 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[38] = padding, $[39] = children, $[40] = t10) : t10 = $[40];
3824
+ $[36] !== padding || $[37] !== children ? (t10 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[36] = padding, $[37] = children, $[38] = t10) : t10 = $[38];
3793
3825
  let t11;
3794
- $[41] !== overflow || $[42] !== t10 ? (t11 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, overflow, children: t10 }), $[41] = overflow, $[42] = t10, $[43] = t11) : t11 = $[43];
3826
+ $[39] !== overflow || $[40] !== t10 ? (t11 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, overflow, children: t10 }), $[39] = overflow, $[40] = t10, $[41] = t11) : t11 = $[41];
3795
3827
  let t12;
3796
- $[44] !== arrow2 || $[45] !== arrowRef || $[46] !== arrowStyle ? (t12 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[44] = arrow2, $[45] = arrowRef, $[46] = arrowStyle, $[47] = t12) : t12 = $[47];
3828
+ $[42] !== arrow2 || $[43] !== arrowRef || $[44] !== arrowStyle ? (t12 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[42] = arrow2, $[43] = arrowRef, $[44] = arrowStyle, $[45] = t12) : t12 = $[45];
3797
3829
  let t13;
3798
- return $[48] !== t8 || $[49] !== placement || $[50] !== radius || $[51] !== ref || $[52] !== scheme || $[53] !== shadow || $[54] !== rootStyle2 || $[55] !== tone || $[56] !== t9 || $[57] !== t11 || $[58] !== t12 ? (t13 = /* @__PURE__ */ jsxs(MotionCard$1, { "data-ui": "Popover", ...t8, "data-placement": placement, radius, ref, scheme, shadow, sizing: "border", style: rootStyle2, tone, ...t9, children: [
3830
+ return $[46] !== t8 || $[47] !== placement || $[48] !== radius || $[49] !== ref || $[50] !== scheme || $[51] !== shadow || $[52] !== rootStyle2 || $[53] !== tone || $[54] !== t9 || $[55] !== t11 || $[56] !== t12 ? (t13 = /* @__PURE__ */ jsxs(MotionCard$1, { "data-ui": "Popover", ...t8, "data-placement": placement, radius, ref, scheme, shadow, sizing: "border", style: rootStyle2, tone, ...t9, children: [
3799
3831
  t11,
3800
3832
  t12
3801
- ] }), $[48] = t8, $[49] = placement, $[50] = radius, $[51] = ref, $[52] = scheme, $[53] = shadow, $[54] = rootStyle2, $[55] = tone, $[56] = t9, $[57] = t11, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
3833
+ ] }), $[46] = t8, $[47] = placement, $[48] = radius, $[49] = ref, $[50] = scheme, $[51] = shadow, $[52] = rootStyle2, $[53] = tone, $[54] = t9, $[55] = t11, $[56] = t12, $[57] = t13) : t13 = $[57], t13;
3802
3834
  }));
3803
3835
  PopoverCard.displayName = "Memo(ForwardRef(PopoverCard))";
3804
3836
  const Popover = memo(forwardRef(function(props, forwardedRef) {
3805
- const {
3837
+ const $ = c(128), {
3806
3838
  container,
3807
3839
  layer
3808
- } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
3809
- __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
3810
- animate: _animate = !1,
3811
- arrow: arrowProp = !1,
3812
- boundaryElement: _boundaryElement,
3813
- children: childProp,
3814
- constrainSize = !1,
3815
- content,
3816
- disabled,
3817
- fallbackPlacements: _fallbackPlacements,
3818
- matchReferenceWidth,
3819
- floatingBoundary: _floatingBoundary,
3820
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3821
- onActivate,
3822
- open,
3823
- overflow = "hidden",
3824
- padding: paddingProp,
3825
- placement: placementProp = "bottom",
3826
- portal,
3827
- preventOverflow = !0,
3828
- radius: radiusProp = 3,
3829
- referenceBoundary: _referenceBoundary,
3830
- referenceElement,
3831
- scheme,
3832
- shadow: shadowProp = 3,
3833
- tone = "inherit",
3834
- width: widthProp = "auto",
3835
- zOffset: _zOffsetProp,
3836
- updateRef,
3837
- ...restProps
3838
- } = props, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
3839
- useImperativeHandle(forwardedRef, () => ref.current);
3840
- const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
3841
- container,
3842
- mediaIndex,
3843
- width: widthArrayProp
3844
- }), widthRef = useRef(width);
3845
- useEffect(() => {
3846
- widthRef.current = width;
3847
- }, [width]);
3848
- const maxWidth = calcMaxWidth({
3849
- boundaryWidth,
3850
- currentWidth: width
3851
- }), maxWidthRef = useRef(maxWidth);
3852
- useEffect(() => {
3853
- maxWidthRef.current = maxWidth;
3854
- }, [maxWidth]);
3855
- const referenceWidthRef = useRef();
3856
- useLayoutEffect(() => {
3840
+ } = useTheme_v2(), boundaryElementContext = useBoundaryElement();
3841
+ let t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, _boundaryElement, _fallbackPlacements, _floatingBoundary, _referenceBoundary, _zOffsetProp, paddingProp, open, matchReferenceWidth, childProp, referenceElement, updateRef, disabled, restProps, scheme, content, portal;
3842
+ if ($[0] !== props) {
3843
+ const {
3844
+ __unstable_margins: t112,
3845
+ animate: t122,
3846
+ arrow: t132,
3847
+ boundaryElement: t142,
3848
+ children: t152,
3849
+ constrainSize: t162,
3850
+ content: t172,
3851
+ disabled: t182,
3852
+ fallbackPlacements: t192,
3853
+ matchReferenceWidth: t202,
3854
+ floatingBoundary: t212,
3855
+ onActivate,
3856
+ open: t222,
3857
+ overflow: t232,
3858
+ padding: t242,
3859
+ placement: t252,
3860
+ portal: t262,
3861
+ preventOverflow: t272,
3862
+ radius: t282,
3863
+ referenceBoundary: t292,
3864
+ referenceElement: t302,
3865
+ scheme: t312,
3866
+ shadow: t322,
3867
+ tone: t332,
3868
+ width: t342,
3869
+ zOffset: t352,
3870
+ updateRef: t362,
3871
+ ...t372
3872
+ } = props;
3873
+ t0 = t112, t1 = t122, t2 = t132, _boundaryElement = t142, childProp = t152, t3 = t162, content = t172, disabled = t182, _fallbackPlacements = t192, matchReferenceWidth = t202, _floatingBoundary = t212, open = t222, t4 = t232, paddingProp = t242, t5 = t252, portal = t262, t6 = t272, t7 = t282, _referenceBoundary = t292, referenceElement = t302, scheme = t312, t8 = t322, t9 = t332, t10 = t342, _zOffsetProp = t352, updateRef = t362, restProps = t372, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = t7, $[9] = t8, $[10] = t9, $[11] = t10, $[12] = _boundaryElement, $[13] = _fallbackPlacements, $[14] = _floatingBoundary, $[15] = _referenceBoundary, $[16] = _zOffsetProp, $[17] = paddingProp, $[18] = open, $[19] = matchReferenceWidth, $[20] = childProp, $[21] = referenceElement, $[22] = updateRef, $[23] = disabled, $[24] = restProps, $[25] = scheme, $[26] = content, $[27] = portal;
3874
+ } else
3875
+ t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], t7 = $[8], t8 = $[9], t9 = $[10], t10 = $[11], _boundaryElement = $[12], _fallbackPlacements = $[13], _floatingBoundary = $[14], _referenceBoundary = $[15], _zOffsetProp = $[16], paddingProp = $[17], open = $[18], matchReferenceWidth = $[19], childProp = $[20], referenceElement = $[21], updateRef = $[22], disabled = $[23], restProps = $[24], scheme = $[25], content = $[26], portal = $[27];
3876
+ const margins = t0 === void 0 ? DEFAULT_POPOVER_MARGINS : t0, _animate = t1 === void 0 ? !1 : t1, arrowProp = t2 === void 0 ? !1 : t2, constrainSize = t3 === void 0 ? !1 : t3, overflow = t4 === void 0 ? "hidden" : t4, placementProp = t5 === void 0 ? "bottom" : t5, preventOverflow = t6 === void 0 ? !0 : t6, radiusProp = t7 === void 0 ? 3 : t7, shadowProp = t8 === void 0 ? 3 : t8, tone = t9 === void 0 ? "inherit" : t9, widthProp = t10 === void 0 ? "auto" : t10, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), [arrowElement, setArrowElement] = useState(null);
3877
+ let t11;
3878
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => ref.current, $[28] = t11) : t11 = $[28], useImperativeHandle(forwardedRef, t11);
3879
+ const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0;
3880
+ let t12, t13;
3881
+ $[29] !== open || $[30] !== constrainSize || $[31] !== matchReferenceWidth || $[32] !== container || $[33] !== mediaIndex || $[34] !== widthArrayProp || $[35] !== boundaryWidth ? (t12 = () => {
3857
3882
  const floatingElement = ref.current;
3858
- if (!open || !floatingElement) return;
3859
- const referenceWidth = referenceWidthRef.current;
3860
- matchReferenceWidth ? referenceWidthRef.current !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3861
- }, [width, matchReferenceWidth, maxWidth, open]);
3862
- const middleware = useMemo(() => {
3863
- const ret = [];
3864
- return (constrainSize || preventOverflow) && ret.push(flip({
3865
- boundary: floatingBoundary || void 0,
3866
- fallbackPlacements,
3867
- padding: DEFAULT_POPOVER_PADDING,
3868
- rootBoundary
3869
- })), ret.push(offset({
3870
- mainAxis: DEFAULT_POPOVER_DISTANCE
3871
- })), (constrainSize || matchReferenceWidth) && ret.push(size({
3872
- apply({
3883
+ if (!open || !floatingElement || constrainSize || matchReferenceWidth)
3884
+ return;
3885
+ const currentWidth = calcCurrentWidth({
3886
+ container,
3887
+ mediaIndex,
3888
+ width: widthArrayProp
3889
+ }), maxWidth = calcMaxWidth({
3890
+ boundaryWidth,
3891
+ currentWidth
3892
+ });
3893
+ currentWidth !== void 0 && (floatingElement.style.width = `${currentWidth}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3894
+ }, t13 = [boundaryWidth, constrainSize, container, matchReferenceWidth, mediaIndex, open, widthArrayProp], $[29] = open, $[30] = constrainSize, $[31] = matchReferenceWidth, $[32] = container, $[33] = mediaIndex, $[34] = widthArrayProp, $[35] = boundaryWidth, $[36] = t12, $[37] = t13) : (t12 = $[36], t13 = $[37]), useLayoutEffect(t12, t13);
3895
+ let t14;
3896
+ $[38] !== constrainSize || $[39] !== preventOverflow || $[40] !== floatingBoundary || $[41] !== fallbackPlacements ? (t14 = (constrainSize || preventOverflow) && flip({
3897
+ boundary: floatingBoundary || void 0,
3898
+ fallbackPlacements,
3899
+ padding: DEFAULT_POPOVER_PADDING,
3900
+ rootBoundary: "viewport"
3901
+ }), $[38] = constrainSize, $[39] = preventOverflow, $[40] = floatingBoundary, $[41] = fallbackPlacements, $[42] = t14) : t14 = $[42];
3902
+ let t15;
3903
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t15 = offset({
3904
+ mainAxis: DEFAULT_POPOVER_DISTANCE
3905
+ }), $[43] = t15) : t15 = $[43];
3906
+ let t16;
3907
+ $[44] !== constrainSize || $[45] !== matchReferenceWidth || $[46] !== container || $[47] !== mediaIndex || $[48] !== widthArrayProp || $[49] !== boundaryWidth || $[50] !== floatingBoundary || $[51] !== margins ? (t16 = (constrainSize || matchReferenceWidth) && size({
3908
+ apply(t172) {
3909
+ const {
3873
3910
  availableWidth,
3874
3911
  availableHeight,
3875
3912
  elements,
3876
- referenceWidth: referenceWidth_0
3877
- }) {
3878
- referenceWidthRef.current = referenceWidth_0;
3879
- const _currentWidth = widthRef.current, _maxWidth = maxWidthRef.current;
3880
- matchReferenceWidth ? elements.floating.style.width = `${referenceWidth_0}px` : _currentWidth !== void 0 && (elements.floating.style.width = `${_currentWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, _maxWidth ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
3881
- },
3882
- boundaryElement: floatingBoundary || void 0,
3883
- constrainSize,
3884
- margins,
3885
- matchReferenceWidth,
3886
- padding: DEFAULT_POPOVER_PADDING
3887
- })), preventOverflow && ret.push(shift({
3888
- boundary: floatingBoundary || void 0,
3889
- rootBoundary,
3890
- padding: DEFAULT_POPOVER_PADDING
3891
- })), arrowProp && ret.push(arrow({
3892
- element: arrowRef,
3893
- padding: DEFAULT_POPOVER_PADDING
3894
- })), animate && ret.push(origin), ret.push(hide({
3895
- boundary: referenceBoundary || void 0,
3896
- padding: DEFAULT_POPOVER_PADDING,
3897
- strategy: "referenceHidden"
3898
- })), ret;
3899
- }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
3913
+ referenceWidth
3914
+ } = t172, currentWidth_0 = calcCurrentWidth({
3915
+ container,
3916
+ mediaIndex,
3917
+ width: widthArrayProp
3918
+ }), maxWidth_0 = calcMaxWidth({
3919
+ boundaryWidth,
3920
+ currentWidth: currentWidth_0
3921
+ });
3922
+ matchReferenceWidth ? elements.floating.style.width = `${referenceWidth}px` : currentWidth_0 !== void 0 && (elements.floating.style.width = `${currentWidth_0}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, maxWidth_0 ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
3923
+ },
3924
+ boundaryElement: floatingBoundary || void 0,
3925
+ constrainSize,
3926
+ margins,
3927
+ matchReferenceWidth,
3928
+ padding: DEFAULT_POPOVER_PADDING
3929
+ }), $[44] = constrainSize, $[45] = matchReferenceWidth, $[46] = container, $[47] = mediaIndex, $[48] = widthArrayProp, $[49] = boundaryWidth, $[50] = floatingBoundary, $[51] = margins, $[52] = t16) : t16 = $[52];
3930
+ let t17;
3931
+ $[53] !== preventOverflow || $[54] !== floatingBoundary ? (t17 = preventOverflow && shift({
3932
+ boundary: floatingBoundary || void 0,
3933
+ rootBoundary: "viewport",
3934
+ padding: DEFAULT_POPOVER_PADDING
3935
+ }), $[53] = preventOverflow, $[54] = floatingBoundary, $[55] = t17) : t17 = $[55];
3936
+ let t18;
3937
+ $[56] !== arrowProp || $[57] !== arrowElement ? (t18 = arrowProp && arrow({
3938
+ element: arrowElement,
3939
+ padding: DEFAULT_POPOVER_PADDING
3940
+ }), $[56] = arrowProp, $[57] = arrowElement, $[58] = t18) : t18 = $[58];
3941
+ const t19 = animate && origin, t20 = referenceBoundary || void 0;
3942
+ let t21;
3943
+ $[59] !== t20 ? (t21 = hide({
3944
+ boundary: t20,
3945
+ padding: DEFAULT_POPOVER_PADDING,
3946
+ strategy: "referenceHidden"
3947
+ }), $[59] = t20, $[60] = t21) : t21 = $[60];
3948
+ let t22;
3949
+ $[61] !== t14 || $[62] !== t16 || $[63] !== t17 || $[64] !== t18 || $[65] !== t19 || $[66] !== t21 ? (t22 = [t14, t15, t16, t17, t18, t19, t21], $[61] = t14, $[62] = t16, $[63] = t17, $[64] = t18, $[65] = t19, $[66] = t21, $[67] = t22) : t22 = $[67];
3950
+ let t23;
3951
+ $[68] !== t22 || $[69] !== placementProp ? (t23 = {
3952
+ middleware: t22,
3953
+ placement: placementProp,
3954
+ whileElementsMounted: autoUpdate
3955
+ }, $[68] = t22, $[69] = placementProp, $[70] = t23) : t23 = $[70];
3956
+ const {
3900
3957
  x,
3901
3958
  y,
3902
3959
  middlewareData,
@@ -3904,30 +3961,57 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3904
3961
  refs,
3905
3962
  strategy,
3906
3963
  update
3907
- } = useFloating({
3908
- middleware,
3909
- placement: placementProp,
3910
- whileElementsMounted: autoUpdate
3911
- }), 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) => {
3912
- arrowRef.current = arrowEl;
3913
- }, []), setFloating = useCallback((node) => {
3964
+ } = useFloating(t23), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY;
3965
+ let t24;
3966
+ $[71] !== refs ? (t24 = (node) => {
3914
3967
  ref.current = node, refs.setFloating(node);
3915
- }, [refs]), [childElement, setChildElement] = useState(null), setReference = useCallback((node_0) => {
3968
+ }, $[71] = refs, $[72] = t24) : t24 = $[72];
3969
+ const setFloating = t24, [childElement, setChildElement] = useState(null);
3970
+ let t25;
3971
+ $[73] !== refs ? (t25 = (node_0) => {
3916
3972
  refs.setReference(node_0), setChildElement(node_0);
3917
- }, [refs]);
3918
- useImperativeHandle(getElementRef(childProp), () => childElement, [childElement]);
3919
- const child = useMemo(() => !childProp || referenceElement ? null : cloneElement(childProp, {
3920
- ref: setReference
3921
- }), [childProp, referenceElement, setReference]);
3922
- if (useImperativeHandle(updateRef, () => update, [update]), useEffect(() => {
3973
+ }, $[73] = refs, $[74] = t25) : t25 = $[74];
3974
+ const setReference = t25, t26 = childProp;
3975
+ let t27;
3976
+ $[75] !== t26 ? (t27 = getElementRef(t26), $[75] = t26, $[76] = t27) : t27 = $[76];
3977
+ let t28, t29;
3978
+ $[77] !== childElement ? (t28 = () => childElement, t29 = [childElement], $[77] = childElement, $[78] = t28, $[79] = t29) : (t28 = $[78], t29 = $[79]), useImperativeHandle(t27, t28, t29);
3979
+ let t30;
3980
+ bb0: {
3981
+ if (!childProp || referenceElement) {
3982
+ t30 = null;
3983
+ break bb0;
3984
+ }
3985
+ let t312;
3986
+ $[80] !== setReference || $[81] !== childProp ? (t312 = cloneElement(childProp, {
3987
+ ref: setReference
3988
+ }), $[80] = setReference, $[81] = childProp, $[82] = t312) : t312 = $[82], t30 = t312;
3989
+ }
3990
+ const child = t30;
3991
+ let t31, t32;
3992
+ $[83] !== update ? (t31 = () => update, t32 = [update], $[83] = update, $[84] = t31, $[85] = t32) : (t31 = $[84], t32 = $[85]), useImperativeHandle(updateRef, t31, t32);
3993
+ let t33, t34;
3994
+ if ($[86] !== child || $[87] !== refs || $[88] !== referenceElement ? (t33 = () => {
3923
3995
  child || refs.setReference(referenceElement || null);
3924
- }, [referenceElement, refs, child]), disabled)
3925
- return childProp || /* @__PURE__ */ jsx(Fragment, {});
3926
- const popover = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, width: matchReferenceWidth ? referenceWidthRef.current : width, x, y, children: content }) }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover);
3927
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3928
- animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
3996
+ }, t34 = [referenceElement, refs, child], $[86] = child, $[87] = refs, $[88] = referenceElement, $[89] = t33, $[90] = t34) : (t33 = $[89], t34 = $[90]), useEffect(t33, t34), disabled) {
3997
+ let t352;
3998
+ return $[91] !== childProp ? (t352 = childProp || /* @__PURE__ */ jsx(Fragment, {}), $[91] = childProp, $[92] = t352) : t352 = $[92], t352;
3999
+ }
4000
+ let t35;
4001
+ $[93] !== restProps || $[94] !== margins || $[95] !== animate || $[96] !== arrowProp || $[97] !== arrowX || $[98] !== arrowY || $[99] !== referenceHidden || $[100] !== overflow || $[101] !== padding || $[102] !== placement || $[103] !== radius || $[104] !== setFloating || $[105] !== scheme || $[106] !== shadow || $[107] !== originX || $[108] !== originY || $[109] !== strategy || $[110] !== tone || $[111] !== x || $[112] !== y || $[113] !== content ? (t35 = /* @__PURE__ */ jsx(PopoverCard, { ...restProps, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrowElement, arrowX, arrowY, hidden: referenceHidden, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, tone, x, y, children: content }), $[93] = restProps, $[94] = margins, $[95] = animate, $[96] = arrowProp, $[97] = arrowX, $[98] = arrowY, $[99] = referenceHidden, $[100] = overflow, $[101] = padding, $[102] = placement, $[103] = radius, $[104] = setFloating, $[105] = scheme, $[106] = shadow, $[107] = originX, $[108] = originY, $[109] = strategy, $[110] = tone, $[111] = x, $[112] = y, $[113] = content, $[114] = t35) : t35 = $[114];
4002
+ let t36;
4003
+ $[115] !== zOffset || $[116] !== t35 ? (t36 = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: t35 }), $[115] = zOffset, $[116] = t35, $[117] = t36) : t36 = $[117];
4004
+ const popover = t36;
4005
+ let t37;
4006
+ $[118] !== open || $[119] !== portal || $[120] !== popover ? (t37 = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: popover }) : popover), $[118] = open, $[119] = portal, $[120] = popover, $[121] = t37) : t37 = $[121];
4007
+ const children = t37;
4008
+ let t38;
4009
+ $[122] !== animate || $[123] !== children ? (t38 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[122] = animate, $[123] = children, $[124] = t38) : t38 = $[124];
4010
+ let t39;
4011
+ return $[125] !== t38 || $[126] !== child ? (t39 = /* @__PURE__ */ jsxs(Fragment, { children: [
4012
+ t38,
3929
4013
  child
3930
- ] });
4014
+ ] }), $[125] = t38, $[126] = child, $[127] = t39) : t39 = $[127], t39;
3931
4015
  }));
3932
4016
  Popover.displayName = "Memo(ForwardRef(Popover))";
3933
4017
  function getElementRef(element) {
@@ -5939,8 +6023,8 @@ const Root$5 = styled(Box)`
5939
6023
  });
5940
6024
  Menu.displayName = "ForwardRef(Menu)";
5941
6025
  const MenuButton = forwardRef(function(props, forwardedRef) {
5942
- const {
5943
- __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
6026
+ const $ = c(62), {
6027
+ __unstable_disableRestoreFocusOnClose: t0,
5944
6028
  boundaryElement: deprecated_boundaryElement,
5945
6029
  button: buttonProp,
5946
6030
  id,
@@ -5949,23 +6033,38 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5949
6033
  onOpen,
5950
6034
  placement: deprecated_placement,
5951
6035
  popoverScheme: deprecated_popoverScheme,
5952
- portal: deprecated_portal = !0,
6036
+ portal: t1,
5953
6037
  popover,
5954
6038
  popoverRadius: deprecated_popoverRadius,
5955
6039
  preventOverflow: deprecated_preventOverflow
5956
- } = props, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), [menuElements, setChildMenuElements] = useState([]), openRef = useRef(open);
5957
- useEffect(() => {
6040
+ } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null);
6041
+ let t2;
6042
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
6043
+ const [menuElements, setChildMenuElements] = useState(t2), openRef = useRef(open);
6044
+ let t3, t4;
6045
+ $[1] !== onOpen || $[2] !== open ? (t3 = () => {
5958
6046
  onOpen && open && !openRef.current && onOpen();
5959
- }, [onOpen, open]), useEffect(() => {
6047
+ }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), useEffect(t3, t4);
6048
+ let t5, t6;
6049
+ $[5] !== onClose || $[6] !== open ? (t5 = () => {
5960
6050
  onClose && !open && openRef.current && onClose();
5961
- }, [onClose, open]), useEffect(() => {
6051
+ }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), useEffect(t5, t6);
6052
+ let t7, t8;
6053
+ $[9] !== open ? (t7 = () => {
5962
6054
  openRef.current = open;
5963
- }, [open]);
5964
- const handleButtonClick = useCallback(() => {
6055
+ }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), useEffect(t7, t8);
6056
+ let t9;
6057
+ $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
5965
6058
  setOpen((v) => !v), setShouldFocus(null);
5966
- }, []), handleMouseDown = useCallback((event) => {
6059
+ }, $[12] = t9) : t9 = $[12];
6060
+ const handleButtonClick = t9;
6061
+ let t10;
6062
+ $[13] !== open ? (t10 = (event) => {
5967
6063
  open && event.preventDefault();
5968
- }, [open]), handleButtonKeyDown = useCallback((event_0) => {
6064
+ }, $[13] = open, $[14] = t10) : t10 = $[14];
6065
+ const handleMouseDown = t10;
6066
+ let t11;
6067
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
5969
6068
  if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
5970
6069
  event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
5971
6070
  return;
@@ -5974,7 +6073,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5974
6073
  event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
5975
6074
  return;
5976
6075
  }
5977
- }, []), handleMenuClickOutside = useCallback((event_1) => {
6076
+ }, $[15] = t11) : t11 = $[15];
6077
+ const handleButtonKeyDown = t11;
6078
+ let t12;
6079
+ $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
5978
6080
  const target = event_1.target;
5979
6081
  if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
5980
6082
  for (const el of menuElements)
@@ -5982,9 +6084,15 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5982
6084
  return;
5983
6085
  setOpen(!1);
5984
6086
  }
5985
- }, [buttonElement, menuElements]), handleMenuEscape = useCallback(() => {
6087
+ }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
6088
+ const handleMenuClickOutside = t12;
6089
+ let t13;
6090
+ $[19] !== disableRestoreFocusOnClose || $[20] !== buttonElement ? (t13 = () => {
5986
6091
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5987
- }, [buttonElement, disableRestoreFocusOnClose]), handleBlur = useCallback((event_2) => {
6092
+ }, $[19] = disableRestoreFocusOnClose, $[20] = buttonElement, $[21] = t13) : t13 = $[21];
6093
+ const handleMenuEscape = t13;
6094
+ let t14;
6095
+ $[22] !== menuElements ? (t14 = (event_2) => {
5988
6096
  const target_0 = event_2.relatedTarget;
5989
6097
  if (target_0 instanceof Node) {
5990
6098
  for (const el_0 of menuElements)
@@ -5992,9 +6100,18 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
5992
6100
  return;
5993
6101
  setOpen(!1);
5994
6102
  }
5995
- }, [menuElements]), handleItemClick = useCallback(() => {
6103
+ }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
6104
+ const handleBlur = t14;
6105
+ let t15;
6106
+ $[24] !== disableRestoreFocusOnClose || $[25] !== buttonElement ? (t15 = () => {
5996
6107
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
5997
- }, [buttonElement, disableRestoreFocusOnClose]), registerElement = useCallback((el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), []), menuProps = useMemo(() => ({
6108
+ }, $[24] = disableRestoreFocusOnClose, $[25] = buttonElement, $[26] = t15) : t15 = $[26];
6109
+ const handleItemClick = t15;
6110
+ let t16;
6111
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t16 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t16) : t16 = $[27];
6112
+ const registerElement = t16;
6113
+ let t17;
6114
+ $[28] !== id || $[29] !== handleBlur || $[30] !== handleMenuClickOutside || $[31] !== handleMenuEscape || $[32] !== handleItemClick || $[33] !== buttonElement || $[34] !== shouldFocus || $[35] !== menuProp ? (t17 = menuProp && cloneElement(menuProp, {
5998
6115
  "aria-labelledby": id,
5999
6116
  onBlurCapture: handleBlur,
6000
6117
  onClickOutside: handleMenuClickOutside,
@@ -6003,7 +6120,10 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
6003
6120
  originElement: buttonElement,
6004
6121
  registerElement,
6005
6122
  shouldFocus
6006
- }), [buttonElement, handleMenuClickOutside, handleMenuEscape, handleItemClick, id, handleBlur, registerElement, shouldFocus]), menu = menuProp && cloneElement(menuProp, menuProps), ref = useRef(null), button = useMemo(() => buttonProp && cloneElement(buttonProp, {
6123
+ }), $[28] = id, $[29] = handleBlur, $[30] = handleMenuClickOutside, $[31] = handleMenuEscape, $[32] = handleItemClick, $[33] = buttonElement, $[34] = shouldFocus, $[35] = menuProp, $[36] = t17) : t17 = $[36];
6124
+ const menu = t17;
6125
+ let t18, t19;
6126
+ $[37] !== buttonProp || $[38] !== open || $[39] !== id || $[40] !== handleMouseDown ? (t19 = buttonProp && cloneElement(buttonProp, {
6007
6127
  "data-ui": "MenuButton",
6008
6128
  id,
6009
6129
  onClick: handleButtonClick,
@@ -6011,14 +6131,16 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
6011
6131
  onMouseDown: handleMouseDown,
6012
6132
  "aria-haspopup": !0,
6013
6133
  "aria-expanded": open,
6014
- ref,
6134
+ ref: setButtonElement,
6015
6135
  selected: buttonProp.props.selected ?? open
6016
- }), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
6017
- useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => {
6018
- if (button)
6019
- return setButtonElement(ref.current), () => setButtonElement(null);
6020
- }, [button]);
6021
- const popoverProps = useMemo(() => ({
6136
+ }), $[37] = buttonProp, $[38] = open, $[39] = id, $[40] = handleMouseDown, $[41] = t19) : t19 = $[41], t18 = t19;
6137
+ const button = t18;
6138
+ let t20, t21;
6139
+ $[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), useImperativeHandle(forwardedRef, t20, t21);
6140
+ let t22, t23;
6141
+ $[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
6142
+ let t24;
6143
+ $[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_portal || $[50] !== deprecated_preventOverflow || $[51] !== deprecated_popoverRadius || $[52] !== deprecated_popoverScheme || $[53] !== t23 ? (t24 = {
6022
6144
  boundaryElement: deprecated_boundaryElement,
6023
6145
  overflow: "auto",
6024
6146
  placement: deprecated_placement,
@@ -6026,9 +6148,13 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
6026
6148
  preventOverflow: deprecated_preventOverflow,
6027
6149
  radius: deprecated_popoverRadius,
6028
6150
  scheme: deprecated_popoverScheme,
6029
- ...popover || {}
6030
- }), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
6031
- return /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsx(Fragment, {}) });
6151
+ ...t23
6152
+ }, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_portal, $[50] = deprecated_preventOverflow, $[51] = deprecated_popoverRadius, $[52] = deprecated_popoverScheme, $[53] = t23, $[54] = t24) : t24 = $[54], t22 = t24;
6153
+ const popoverProps = t22;
6154
+ let t25;
6155
+ $[55] !== button ? (t25 = button || /* @__PURE__ */ jsx(Fragment, {}), $[55] = button, $[56] = t25) : t25 = $[56];
6156
+ let t26;
6157
+ return $[57] !== popoverProps || $[58] !== menu || $[59] !== open || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t25 }), $[57] = popoverProps, $[58] = menu, $[59] = open, $[60] = t25, $[61] = t26) : t26 = $[61], t26;
6032
6158
  });
6033
6159
  MenuButton.displayName = "ForwardRef(MenuButton)";
6034
6160
  const MenuDivider = styled.hr`
@@ -6512,9 +6638,6 @@ const CustomButton = styled(Button)`
6512
6638
  return $[18] !== restProps || $[19] !== t7 || $[20] !== fontSize2 || $[21] !== icon || $[22] !== id || $[23] !== onClick || $[24] !== handleFocus || $[25] !== padding || $[26] !== selected || $[27] !== t8 || $[28] !== label ? (t9 = /* @__PURE__ */ jsx(CustomButton, { "data-ui": "Tab", ...restProps, "aria-selected": t7, fontSize: fontSize2, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t8, text: label, type: "button" }), $[18] = restProps, $[19] = t7, $[20] = fontSize2, $[21] = icon, $[22] = id, $[23] = onClick, $[24] = handleFocus, $[25] = padding, $[26] = selected, $[27] = t8, $[28] = label, $[29] = t9) : t9 = $[29], t9;
6513
6639
  });
6514
6640
  Tab.displayName = "ForwardRef(Tab)";
6515
- function _isReactElement(node) {
6516
- return !!node;
6517
- }
6518
6641
  const CustomInline = styled(Inline)`
6519
6642
  & > div {
6520
6643
  display: inline-block;
@@ -6523,19 +6646,32 @@ const CustomInline = styled(Inline)`
6523
6646
  box-sizing: border-box;
6524
6647
  }
6525
6648
  `, TabList = forwardRef(function(props, ref) {
6526
- const {
6649
+ const $ = c(15);
6650
+ let childrenProp, restProps;
6651
+ $[0] !== props ? ({
6527
6652
  children: childrenProp,
6528
6653
  ...restProps
6529
- } = props, [focusedIndex, setFocusedIndex] = useState(-1), tabs = useMemo(() => childrenProp.filter(_isReactElement), [childrenProp]).map((child, childIndex) => cloneElement(child, {
6530
- focused: focusedIndex === childIndex,
6531
- key: childIndex,
6532
- onFocus: () => handleTabFocus(childIndex)
6533
- })), numTabs = tabs.length, handleTabFocus = useCallback((tabIdx) => {
6534
- setFocusedIndex(tabIdx);
6535
- }, []), handleKeyDown = useCallback((event) => {
6654
+ } = props, $[0] = props, $[1] = childrenProp, $[2] = restProps) : (childrenProp = $[1], restProps = $[2]);
6655
+ const [focusedIndex, setFocusedIndex] = useState(-1);
6656
+ let t0;
6657
+ if ($[3] !== childrenProp || $[4] !== focusedIndex) {
6658
+ const children = Children.toArray(childrenProp).filter(isValidElement);
6659
+ let t12;
6660
+ $[6] !== focusedIndex ? (t12 = (child, childIndex) => cloneElement(child, {
6661
+ focused: focusedIndex === childIndex,
6662
+ key: childIndex,
6663
+ onFocus: () => setFocusedIndex(childIndex)
6664
+ }), $[6] = focusedIndex, $[7] = t12) : t12 = $[7], t0 = children.map(t12), $[3] = childrenProp, $[4] = focusedIndex, $[5] = t0;
6665
+ } else
6666
+ t0 = $[5];
6667
+ const tabs = t0, numTabs = tabs.length;
6668
+ let t1;
6669
+ $[8] !== numTabs ? (t1 = (event) => {
6536
6670
  event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
6537
- }, [numTabs]);
6538
- return /* @__PURE__ */ jsx(CustomInline, { "data-ui": "TabList", ...restProps, onKeyDown: handleKeyDown, ref, role: "tablist", children: tabs });
6671
+ }, $[8] = numTabs, $[9] = t1) : t1 = $[9];
6672
+ const handleKeyDown = t1;
6673
+ let t2;
6674
+ return $[10] !== restProps || $[11] !== handleKeyDown || $[12] !== ref || $[13] !== tabs ? (t2 = /* @__PURE__ */ jsx(CustomInline, { "data-ui": "TabList", ...restProps, onKeyDown: handleKeyDown, ref, role: "tablist", children: tabs }), $[10] = restProps, $[11] = handleKeyDown, $[12] = ref, $[13] = tabs, $[14] = t2) : t2 = $[14], t2;
6539
6675
  });
6540
6676
  TabList.displayName = "ForwardRef(TabList)";
6541
6677
  const TabPanel = forwardRef(function(props, ref) {
@@ -6656,7 +6792,12 @@ function _temp() {
6656
6792
  return !0;
6657
6793
  }
6658
6794
  const subscribe = () => () => {
6659
- }, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null), Root$1 = styled(Layer)`
6795
+ }, ToastContext = createGlobalScopedContext("@sanity/ui/context/toast", null);
6796
+ let toastId = 0;
6797
+ function generateToastId() {
6798
+ return String(toastId++);
6799
+ }
6800
+ const Root$1 = styled(Layer)`
6660
6801
  position: fixed;
6661
6802
  top: 0;
6662
6803
  left: 0;
@@ -6671,31 +6812,44 @@ const subscribe = () => () => {
6671
6812
  max-width: 420px;
6672
6813
  width: 100%;
6673
6814
  `;
6674
- let toastId = 0;
6675
6815
  function ToastProvider(props) {
6676
- const {
6816
+ const $ = c(24), {
6677
6817
  children,
6678
- padding = 4,
6818
+ padding: t0,
6679
6819
  paddingX,
6680
6820
  paddingY,
6681
6821
  zOffset
6682
- } = props, [state, _setState] = useState([]), toastsRef = useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = useMemo(() => ({
6683
- initial: {
6684
- opacity: 0,
6685
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
6686
- y: 32,
6687
- scale: 0.25,
6688
- willChange: "transform"
6689
- },
6690
- animate: {
6691
- opacity: [0, 1, 1],
6692
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
6693
- y: 0,
6694
- scale: 1
6695
- },
6822
+ } = props, padding = t0 === void 0 ? 4 : t0;
6823
+ let t1;
6824
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
6825
+ const [state, _setState] = useState(t1);
6826
+ let t2;
6827
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[1] = t2) : t2 = $[1];
6828
+ const toastsRef = useRef(t2), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion();
6829
+ let t3, t4, t5;
6830
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {
6831
+ opacity: 0,
6832
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
6833
+ y: 32,
6834
+ scale: 0.25,
6835
+ willChange: "transform"
6836
+ }, t5 = [0, 1, 1], $[2] = t4, $[3] = t5) : (t4 = $[2], t5 = $[3]);
6837
+ let t6, t7;
6838
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t6 = {
6839
+ opacity: t5,
6840
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
6841
+ y: 0,
6842
+ scale: 1
6843
+ }, t7 = [1, 1, 0], $[4] = t6, $[5] = t7) : (t6 = $[4], t7 = $[5]);
6844
+ let t8;
6845
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t8 = [1, 0, 0], $[6] = t8) : t8 = $[6];
6846
+ let t9;
6847
+ $[7] !== prefersReducedMotion ? (t9 = {
6848
+ initial: t4,
6849
+ animate: t6,
6696
6850
  exit: {
6697
- opacity: [1, 1, 0],
6698
- [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
6851
+ opacity: t7,
6852
+ [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: t8,
6699
6853
  scale: 0.5,
6700
6854
  transition: prefersReducedMotion ? {
6701
6855
  duration: 0
@@ -6703,10 +6857,13 @@ function ToastProvider(props) {
6703
6857
  duration: 0.2
6704
6858
  }
6705
6859
  }
6706
- }), [prefersReducedMotion]), value = useMemo(() => ({
6860
+ }, $[7] = prefersReducedMotion, $[8] = t9) : t9 = $[8], t3 = t9;
6861
+ const variants = t3;
6862
+ let t10, t11;
6863
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t11 = {
6707
6864
  version: 0,
6708
6865
  push: (params) => {
6709
- const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || String(toastId++), duration = params.duration || 5e3, dismiss = () => {
6866
+ const setState = (state_0) => startTransition(() => _setState(state_0)), id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
6710
6867
  const timeoutId = toastsRef.current[id]?.timeoutId;
6711
6868
  setState((prevState) => {
6712
6869
  const idx = prevState.findIndex((t) => t.id === id);
@@ -6728,27 +6885,36 @@ function ToastProvider(props) {
6728
6885
  timeoutId: setTimeout(dismiss, duration)
6729
6886
  }, id;
6730
6887
  }
6731
- }), []);
6732
- return useEffect(() => () => {
6888
+ }, $[9] = t11) : t11 = $[9], t10 = t11;
6889
+ const value = t10;
6890
+ let t12, t13;
6891
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => () => {
6733
6892
  for (const {
6734
6893
  timeoutId: timeoutId_0
6735
6894
  } of Object.values(toastsRef.current))
6736
6895
  clearTimeout(timeoutId_0);
6737
6896
  toastsRef.current = {};
6738
- }, []), /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
6739
- children,
6740
- mounted && /* @__PURE__ */ jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsx(ToastContainer, { children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map(({
6897
+ }, t13 = [], $[10] = t12, $[11] = t13) : (t12 = $[10], t13 = $[11]), useEffect(t12, t13);
6898
+ let t14;
6899
+ $[12] !== mounted || $[13] !== variants || $[14] !== prefersReducedMotion || $[15] !== state || $[16] !== padding || $[17] !== paddingX || $[18] !== paddingY || $[19] !== zOffset ? (t14 = mounted && /* @__PURE__ */ jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsx(ToastContainer, { children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map((t152) => {
6900
+ const {
6741
6901
  dismiss: dismiss_0,
6742
6902
  id: id_0,
6743
6903
  params: params_0
6744
- }) => /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6904
+ } = t152;
6905
+ return /* @__PURE__ */ jsx(motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6745
6906
  duration: 0
6746
6907
  } : {
6747
6908
  type: "spring",
6748
6909
  damping: 30,
6749
6910
  stiffness: 400
6750
- }, children: /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }) }, id_0)) }) }) }) })
6751
- ] });
6911
+ }, children: /* @__PURE__ */ jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }) }, id_0);
6912
+ }) }) }) }) }), $[12] = mounted, $[13] = variants, $[14] = prefersReducedMotion, $[15] = state, $[16] = padding, $[17] = paddingX, $[18] = paddingY, $[19] = zOffset, $[20] = t14) : t14 = $[20];
6913
+ let t15;
6914
+ return $[21] !== children || $[22] !== t14 ? (t15 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
6915
+ children,
6916
+ t14
6917
+ ] }), $[21] = children, $[22] = t14, $[23] = t15) : t15 = $[23], t15;
6752
6918
  }
6753
6919
  ToastProvider.displayName = "ToastProvider";
6754
6920
  function useToast() {
@@ -7085,61 +7251,117 @@ const TreeGroup = memo(function(props) {
7085
7251
  transition: transform 100ms;
7086
7252
  }
7087
7253
  `, TreeItem = memo(function(props) {
7088
- const {
7254
+ const $ = c(112);
7255
+ let t0, t1, t2, t3, t4, idProp, onClick, IconComponent, children, muted, weight, text, href, linkAs, restProps;
7256
+ $[0] !== props ? ({
7089
7257
  children,
7090
- expanded: expandedProp = !1,
7091
- fontSize: fontSize2 = 1,
7258
+ expanded: t0,
7259
+ fontSize: t1,
7092
7260
  href,
7093
7261
  icon: IconComponent,
7094
7262
  id: idProp,
7095
7263
  linkAs,
7096
7264
  muted,
7097
7265
  onClick,
7098
- padding = 2,
7099
- selected = !1,
7100
- space = 2,
7266
+ padding: t2,
7267
+ selected: t3,
7268
+ space: t4,
7101
7269
  text,
7102
7270
  weight,
7103
7271
  ...restProps
7104
- } = props, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
7272
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = idProp, $[7] = onClick, $[8] = IconComponent, $[9] = children, $[10] = muted, $[11] = weight, $[12] = text, $[13] = href, $[14] = linkAs, $[15] = restProps) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], idProp = $[6], onClick = $[7], IconComponent = $[8], children = $[9], muted = $[10], weight = $[11], text = $[12], href = $[13], linkAs = $[14], restProps = $[15]);
7273
+ const expandedProp = t0 === void 0 ? !1 : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, space = t4 === void 0 ? 2 : t4, [rootElement, setRootElement] = useState(null), treeitemRef = useRef(null), tree = useTree(), {
7105
7274
  path,
7106
7275
  registerItem,
7107
7276
  setExpanded,
7108
7277
  setFocusedElement
7109
- } = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1, contextValue = useMemo(() => ({
7278
+ } = tree, _id = useId(), id = idProp || _id;
7279
+ let t5, t6, t7;
7280
+ if ($[16] !== id || $[17] !== path) {
7281
+ const result = path.concat([id || ""]);
7282
+ t6 = result, t7 = result.join("/"), $[16] = id, $[17] = path, $[18] = t6, $[19] = t7;
7283
+ } else
7284
+ t6 = $[18], t7 = $[19];
7285
+ let t8;
7286
+ $[20] !== t6 || $[21] !== t7 ? (t8 = [t6, t7], $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22], t5 = t8;
7287
+ const [itemPath, itemKey] = t5, itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1;
7288
+ let t9;
7289
+ const t10 = tree.level + 1;
7290
+ let t11;
7291
+ $[23] !== tree || $[24] !== t10 || $[25] !== itemPath ? (t11 = {
7110
7292
  ...tree,
7111
- level: tree.level + 1,
7293
+ level: t10,
7112
7294
  path: itemPath
7113
- }), [itemPath, tree]), handleClick = useCallback((event) => {
7295
+ }, $[23] = tree, $[24] = t10, $[25] = itemPath, $[26] = t11) : t11 = $[26], t9 = t11;
7296
+ const contextValue = t9;
7297
+ let t12;
7298
+ $[27] !== onClick || $[28] !== setExpanded || $[29] !== itemKey || $[30] !== expanded || $[31] !== setFocusedElement || $[32] !== rootElement ? (t12 = (event) => {
7114
7299
  onClick && onClick(event);
7115
7300
  const target = event.target;
7116
7301
  target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
7117
- }, [expanded, itemKey, onClick, rootElement, setExpanded, setFocusedElement]), handleKeyDown = useCallback((event_0) => {
7302
+ }, $[27] = onClick, $[28] = setExpanded, $[29] = itemKey, $[30] = expanded, $[31] = setFocusedElement, $[32] = rootElement, $[33] = t12) : t12 = $[33];
7303
+ const handleClick = t12;
7304
+ let t13;
7305
+ $[34] !== focused || $[35] !== rootElement ? (t13 = (event_0) => {
7118
7306
  focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
7119
- }, [focused, rootElement]);
7120
- useEffect(() => {
7307
+ }, $[34] = focused, $[35] = rootElement, $[36] = t13) : t13 = $[36];
7308
+ const handleKeyDown = t13;
7309
+ let t14, t15;
7310
+ $[37] !== rootElement || $[38] !== registerItem || $[39] !== itemPath || $[40] !== expanded || $[41] !== selected ? (t14 = () => {
7121
7311
  if (rootElement)
7122
7312
  return registerItem(rootElement, itemPath.join("/"), expanded, selected);
7123
- }, [expanded, itemPath, registerItem, rootElement, selected]);
7124
- const content = /* @__PURE__ */ jsxs(Flex, { padding, children: [
7125
- /* @__PURE__ */ jsxs(Box, { marginRight: space, style: {
7126
- visibility: IconComponent || children ? "visible" : "hidden",
7127
- pointerEvents: "none"
7128
- }, children: [
7129
- IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }),
7130
- !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
7131
- transform: expanded ? "rotate(90deg)" : void 0
7132
- } }) })
7133
- ] }),
7134
- /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) })
7135
- ] });
7136
- return href ? /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
7137
- /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content }),
7138
- /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }) })
7139
- ] }) : /* @__PURE__ */ jsxs(Root, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
7140
- /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }),
7141
- /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
7142
- ] });
7313
+ }, t15 = [expanded, itemPath, registerItem, rootElement, selected], $[37] = rootElement, $[38] = registerItem, $[39] = itemPath, $[40] = expanded, $[41] = selected, $[42] = t14, $[43] = t15) : (t14 = $[42], t15 = $[43]), useEffect(t14, t15);
7314
+ const t16 = IconComponent || children ? "visible" : "hidden";
7315
+ let t17;
7316
+ $[44] !== t16 ? (t17 = {
7317
+ visibility: t16,
7318
+ pointerEvents: "none"
7319
+ }, $[44] = t16, $[45] = t17) : t17 = $[45];
7320
+ let t18;
7321
+ $[46] !== IconComponent || $[47] !== muted || $[48] !== fontSize2 || $[49] !== weight ? (t18 = IconComponent && /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(IconComponent, {}) }), $[46] = IconComponent, $[47] = muted, $[48] = fontSize2, $[49] = weight, $[50] = t18) : t18 = $[50];
7322
+ let t19;
7323
+ $[51] !== IconComponent || $[52] !== expanded || $[53] !== muted || $[54] !== fontSize2 || $[55] !== weight ? (t19 = !IconComponent && /* @__PURE__ */ jsx(ToggleArrowText, { muted, size: fontSize2, weight, children: /* @__PURE__ */ jsx(ToggleArrowRightIcon, { style: {
7324
+ transform: expanded ? "rotate(90deg)" : void 0
7325
+ } }) }), $[51] = IconComponent, $[52] = expanded, $[53] = muted, $[54] = fontSize2, $[55] = weight, $[56] = t19) : t19 = $[56];
7326
+ let t20;
7327
+ $[57] !== space || $[58] !== t17 || $[59] !== t18 || $[60] !== t19 ? (t20 = /* @__PURE__ */ jsxs(Box, { marginRight: space, style: t17, children: [
7328
+ t18,
7329
+ t19
7330
+ ] }), $[57] = space, $[58] = t17, $[59] = t18, $[60] = t19, $[61] = t20) : t20 = $[61];
7331
+ let t21;
7332
+ $[62] !== muted || $[63] !== fontSize2 || $[64] !== weight || $[65] !== text ? (t21 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text }) }), $[62] = muted, $[63] = fontSize2, $[64] = weight, $[65] = text, $[66] = t21) : t21 = $[66];
7333
+ let t22;
7334
+ $[67] !== padding || $[68] !== t20 || $[69] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Flex, { padding, children: [
7335
+ t20,
7336
+ t21
7337
+ ] }), $[67] = padding, $[68] = t20, $[69] = t21, $[70] = t22) : t22 = $[70];
7338
+ const content = t22;
7339
+ if (href) {
7340
+ const t232 = selected ? "" : void 0;
7341
+ let t242;
7342
+ $[71] !== tree.level || $[72] !== expanded || $[73] !== linkAs || $[74] !== href || $[75] !== tabIndex || $[76] !== content ? (t242 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content }), $[71] = tree.level, $[72] = expanded, $[73] = linkAs, $[74] = href, $[75] = tabIndex, $[76] = content, $[77] = t242) : t242 = $[77];
7343
+ let t252;
7344
+ $[78] !== children || $[79] !== expanded ? (t252 = children && /* @__PURE__ */ jsx(TreeGroup, { hidden: !expanded, children }), $[78] = children, $[79] = expanded, $[80] = t252) : t252 = $[80];
7345
+ let t262;
7346
+ $[81] !== contextValue || $[82] !== t252 ? (t262 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t252 }), $[81] = contextValue, $[82] = t252, $[83] = t262) : t262 = $[83];
7347
+ let t272;
7348
+ return $[84] !== t232 || $[85] !== id || $[86] !== itemKey || $[87] !== restProps || $[88] !== handleClick || $[89] !== t242 || $[90] !== t262 ? (t272 = /* @__PURE__ */ jsxs(Root, { "data-selected": t232, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
7349
+ t242,
7350
+ t262
7351
+ ] }), $[84] = t232, $[85] = id, $[86] = itemKey, $[87] = restProps, $[88] = handleClick, $[89] = t242, $[90] = t262, $[91] = t272) : t272 = $[91], t272;
7352
+ }
7353
+ const t23 = selected ? "" : void 0;
7354
+ let t24;
7355
+ $[92] !== tree.level || $[93] !== content ? (t24 = /* @__PURE__ */ jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content }), $[92] = tree.level, $[93] = content, $[94] = t24) : t24 = $[94];
7356
+ let t25;
7357
+ $[95] !== children || $[96] !== expanded ? (t25 = children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }), $[95] = children, $[96] = expanded, $[97] = t25) : t25 = $[97];
7358
+ let t26;
7359
+ $[98] !== contextValue || $[99] !== t25 ? (t26 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t25 }), $[98] = contextValue, $[99] = t25, $[100] = t26) : t26 = $[100];
7360
+ let t27;
7361
+ return $[101] !== t23 || $[102] !== id || $[103] !== itemKey || $[104] !== restProps || $[105] !== expanded || $[106] !== handleClick || $[107] !== handleKeyDown || $[108] !== tabIndex || $[109] !== t24 || $[110] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Root, { "data-selected": t23, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
7362
+ t24,
7363
+ t26
7364
+ ] }), $[101] = t23, $[102] = id, $[103] = itemKey, $[104] = restProps, $[105] = expanded, $[106] = handleClick, $[107] = handleKeyDown, $[108] = tabIndex, $[109] = t24, $[110] = t26, $[111] = t27) : t27 = $[111], t27;
7143
7365
  });
7144
7366
  TreeItem.displayName = "Memo(TreeItem)";
7145
7367
  export {