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