@sanity/ui 3.0.0-static.41 → 3.0.0-static.43

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
@@ -1,12 +1,48 @@
1
- import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
- import { ChevronDownIcon, CloseIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
3
- import { useReducer, useCallback, useRef, useImperativeHandle, useMemo, useEffect, cloneElement, useState, Children, isValidElement, Fragment, useContext, useSyncExternalStore, startTransition, useId, lazy, Suspense, Component } from "react";
4
- import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, _isEnterToClickElement, Selectable, Text, useResponsiveProp, EMPTY_ARRAY, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, Card, createGlobalScopedContext, usePrefersReducedMotion, Portal, Z_OFFSETS, Layer, Grid, LayerProvider, isRecord, useCustomValidity, useDelayedState, TooltipDelayGroupContext, BoundaryElementContext, CardProvider, PortalProvider } from "./_chunks-es/_visual-editing.js";
5
- import { Arrow, DEFAULT_ARROW_ELEMENT, DEFAULT_BOX_ELEMENT, DEFAULT_BUTTON_ELEMENT, DEFAULT_CARD_ELEMENT, DEFAULT_FLEX_ELEMENT, DEFAULT_GRID_ELEMENT, DEFAULT_HOTKEYS_ELEMENT, DEFAULT_KBD_ELEMENT, DEFAULT_LAYER_ELEMENT, DEFAULT_MENU_DIVIDER_ELEMENT, DEFAULT_MENU_ELEMENT, DEFAULT_MENU_GROUP_ELEMENT, DEFAULT_MENU_ITEM_ELEMENT, DEFAULT_POPOVER_ELEMENT, DEFAULT_SELECTABLE_ELEMENT, DEFAULT_SPINNER_ELEMENT, DEFAULT_STACK_ELEMENT, DEFAULT_TAB_ELEMENT, DEFAULT_TAB_LIST_ELEMENT, DEFAULT_TEXT_ELEMENT, DEFAULT_TEXT_INPUT_ELEMENT, DEFAULT_TOOLTIP_ELEMENT, Hotkeys, KBD, Menu, MenuDivider, MenuGroup, MenuItem, Spinner, Tab, TabList, Tooltip, _getArrayProp, _getResponsiveProp, useCard, useMatchMedia, useMediaIndex, usePrefersDark, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.js";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { SpinnerIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
3
+ import { useState, isValidElement, useDebugValue, useSyncExternalStore, createContext, useContext, useRef, useImperativeHandle, useEffect, useMemo, useCallback, cloneElement, useReducer, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
6
4
  import { c } from "react/compiler-runtime";
7
- import { breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, toast, toastLayer, treeItem, vars, label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, _inputElement, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, BREAKPOINTS, box, root } from "@sanity/ui/css";
5
+ import { box, text, textOverflow, animatedSpinnerIcon, spinner, button, buttonLoadingBox, _arrow, vars, _arrowSvg, _arrowStrokeMask, _arrowStroke, _arrowShape, card, BREAKPOINTS, popoverCard, popover, _selectable, stack, textInput, textInputPrefix, textInputElement, _inputElement, _inputPresentation, textInputSuffix, breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, kbd, menu, menuDivider, toast, toastLayer, treeItem, label, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, tooltip, root } from "@sanity/ui/css";
6
+ import { isValidElementType } from "react-is";
7
+ import { detectOverflow, autoPlacement, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
8
8
  import { motion, AnimatePresence } from "framer-motion";
9
+ import { createPortal } from "react-dom";
10
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
11
+ import { useEffectEvent } from "use-effect-event";
9
12
  import { ResizeObserver } from "@juggle/resize-observer";
13
+ const EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_PROPS = {
14
+ card: {
15
+ initial: {
16
+ scale: 0.97,
17
+ willChange: "transform"
18
+ },
19
+ hidden: {
20
+ opacity: 0
21
+ },
22
+ visible: {
23
+ opacity: 1,
24
+ transition: {
25
+ when: "beforeChildren",
26
+ duration: 0.1
27
+ }
28
+ },
29
+ scaleIn: {
30
+ scale: 1
31
+ },
32
+ scaleOut: {
33
+ scale: 0.97
34
+ }
35
+ },
36
+ transition: {
37
+ type: "spring",
38
+ visualDuration: 0.2,
39
+ bounce: 0.25
40
+ }
41
+ }, Z_OFFSETS = {
42
+ dialog: 600,
43
+ popover: 400,
44
+ tooltip: 200
45
+ };
10
46
  function _raf(fn) {
11
47
  const frameId = requestAnimationFrame(fn);
12
48
  return () => {
@@ -22,6 +58,30 @@ function _raf2(fn) {
22
58
  innerDispose && innerDispose(), outerDispose();
23
59
  };
24
60
  }
61
+ function _isEnterToClickElement(element) {
62
+ return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
63
+ }
64
+ function isHTMLElement(node) {
65
+ return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
66
+ }
67
+ function isHTMLAnchorElement(element) {
68
+ return isHTMLElement(element) && element.nodeName === "A";
69
+ }
70
+ function isHTMLInputElement(element) {
71
+ return isHTMLElement(element) && element.nodeName === "INPUT";
72
+ }
73
+ function isHTMLButtonElement(element) {
74
+ return isHTMLElement(element) && element.nodeName === "BUTTON";
75
+ }
76
+ function isHTMLSelectElement(element) {
77
+ return isHTMLElement(element) && element.nodeName === "SELECT";
78
+ }
79
+ function isHTMLTextAreaElement(element) {
80
+ return isHTMLElement(element) && element.nodeName === "TEXTAREA";
81
+ }
82
+ function containsOrEqualsElement(element, node) {
83
+ return element.contains(node) || element === node;
84
+ }
25
85
  function _hasFocus(element) {
26
86
  return !!document.activeElement && element.contains(document.activeElement);
27
87
  }
@@ -53,6 +113,1207 @@ function focusLastDescendant(element) {
53
113
  }
54
114
  return !1;
55
115
  }
116
+ function isArray(val) {
117
+ return Array.isArray(val);
118
+ }
119
+ function isRecord(value) {
120
+ return !!(value && typeof value == "object" && !Array.isArray(value));
121
+ }
122
+ function _getArrayProp(val, defaultVal) {
123
+ return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
124
+ }
125
+ function _getResponsiveProp(val, defaultVal) {
126
+ return val === void 0 ? defaultVal || EMPTY_ARRAY : isArray(val) || isRecord(val) ? val : [val];
127
+ }
128
+ function useResponsiveProp(val, defaultVal) {
129
+ const $ = c(3);
130
+ let t0;
131
+ $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getResponsiveProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
132
+ const [t1, setCache] = useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
133
+ return hash !== cachedHash && setCache([_getResponsiveProp(val, defaultVal), hash]), cachedVal;
134
+ }
135
+ const DEFAULT_BOX_ELEMENT = "div";
136
+ function Box(props) {
137
+ const $ = c(132), t0 = props;
138
+ let alignItems, borderBottom, borderLeft, borderRight, borderTop, children, className, flex, flexDirection, flexWrap, gap, gapX, gapY, gridAutoColumns, gridAutoFlow, gridAutoRows, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, gridTemplateColumns, gridTemplateRows, height, inset, insetBottom, insetLeft, insetRight, insetTop, justifyContent, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, maxWidth, muted, outline, overflow, overflowX, overflowY, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pointerEvents, position, radius, rest, shadow, t1, t2, t3, t4, t5, t6, t7, t8, textAlign, width;
139
+ $[0] !== t0 ? ({
140
+ alignItems,
141
+ as: t1,
142
+ border: t2,
143
+ borderTop,
144
+ borderRight,
145
+ borderBottom,
146
+ borderLeft,
147
+ className,
148
+ children,
149
+ display: t3,
150
+ flex,
151
+ flexDirection,
152
+ flexWrap,
153
+ gap,
154
+ gapX,
155
+ gapY,
156
+ gridAutoColumns,
157
+ gridAutoFlow,
158
+ gridAutoRows,
159
+ gridColumn,
160
+ gridColumnEnd,
161
+ gridColumnStart,
162
+ gridRow,
163
+ gridRowEnd,
164
+ gridRowStart,
165
+ gridTemplateColumns,
166
+ gridTemplateRows,
167
+ height,
168
+ inset,
169
+ insetBottom,
170
+ insetLeft,
171
+ insetRight,
172
+ insetTop,
173
+ justifyContent,
174
+ margin: t4,
175
+ marginX,
176
+ marginY,
177
+ marginTop,
178
+ marginRight,
179
+ marginBottom,
180
+ marginLeft,
181
+ maxWidth,
182
+ minHeight: t5,
183
+ minWidth: t6,
184
+ muted,
185
+ outline,
186
+ overflow,
187
+ overflowX,
188
+ overflowY,
189
+ padding: t7,
190
+ paddingX,
191
+ paddingY,
192
+ paddingTop,
193
+ paddingRight,
194
+ paddingBottom,
195
+ paddingLeft,
196
+ pointerEvents,
197
+ position,
198
+ radius,
199
+ shadow,
200
+ sizing: t8,
201
+ textAlign,
202
+ width,
203
+ ...rest
204
+ } = t0, $[0] = t0, $[1] = alignItems, $[2] = borderBottom, $[3] = borderLeft, $[4] = borderRight, $[5] = borderTop, $[6] = children, $[7] = className, $[8] = flex, $[9] = flexDirection, $[10] = flexWrap, $[11] = gap, $[12] = gapX, $[13] = gapY, $[14] = gridAutoColumns, $[15] = gridAutoFlow, $[16] = gridAutoRows, $[17] = gridColumn, $[18] = gridColumnEnd, $[19] = gridColumnStart, $[20] = gridRow, $[21] = gridRowEnd, $[22] = gridRowStart, $[23] = gridTemplateColumns, $[24] = gridTemplateRows, $[25] = height, $[26] = inset, $[27] = insetBottom, $[28] = insetLeft, $[29] = insetRight, $[30] = insetTop, $[31] = justifyContent, $[32] = marginBottom, $[33] = marginLeft, $[34] = marginRight, $[35] = marginTop, $[36] = marginX, $[37] = marginY, $[38] = maxWidth, $[39] = muted, $[40] = outline, $[41] = overflow, $[42] = overflowX, $[43] = overflowY, $[44] = paddingBottom, $[45] = paddingLeft, $[46] = paddingRight, $[47] = paddingTop, $[48] = paddingX, $[49] = paddingY, $[50] = pointerEvents, $[51] = position, $[52] = radius, $[53] = rest, $[54] = shadow, $[55] = t1, $[56] = t2, $[57] = t3, $[58] = t4, $[59] = t5, $[60] = t6, $[61] = t7, $[62] = t8, $[63] = textAlign, $[64] = width) : (alignItems = $[1], borderBottom = $[2], borderLeft = $[3], borderRight = $[4], borderTop = $[5], children = $[6], className = $[7], flex = $[8], flexDirection = $[9], flexWrap = $[10], gap = $[11], gapX = $[12], gapY = $[13], gridAutoColumns = $[14], gridAutoFlow = $[15], gridAutoRows = $[16], gridColumn = $[17], gridColumnEnd = $[18], gridColumnStart = $[19], gridRow = $[20], gridRowEnd = $[21], gridRowStart = $[22], gridTemplateColumns = $[23], gridTemplateRows = $[24], height = $[25], inset = $[26], insetBottom = $[27], insetLeft = $[28], insetRight = $[29], insetTop = $[30], justifyContent = $[31], marginBottom = $[32], marginLeft = $[33], marginRight = $[34], marginTop = $[35], marginX = $[36], marginY = $[37], maxWidth = $[38], muted = $[39], outline = $[40], overflow = $[41], overflowX = $[42], overflowY = $[43], paddingBottom = $[44], paddingLeft = $[45], paddingRight = $[46], paddingTop = $[47], paddingX = $[48], paddingY = $[49], pointerEvents = $[50], position = $[51], radius = $[52], rest = $[53], shadow = $[54], t1 = $[55], t2 = $[56], t3 = $[57], t4 = $[58], t5 = $[59], t6 = $[60], t7 = $[61], t8 = $[62], textAlign = $[63], width = $[64]);
205
+ const Element2 = t1 === void 0 ? DEFAULT_BOX_ELEMENT : t1, border = t2 === void 0 ? !1 : t2, display = t3 === void 0 ? "block" : t3, margin = t4 === void 0 ? 0 : t4, minHeight = t5 === void 0 ? 0 : t5, minWidth = t6 === void 0 ? 0 : t6, padding = t7 === void 0 ? 0 : t7, sizing = t8 === void 0 ? "border" : t8;
206
+ let t9;
207
+ $[65] !== alignItems || $[66] !== border || $[67] !== borderBottom || $[68] !== borderLeft || $[69] !== borderRight || $[70] !== borderTop || $[71] !== className || $[72] !== display || $[73] !== flex || $[74] !== flexDirection || $[75] !== flexWrap || $[76] !== gap || $[77] !== gapX || $[78] !== gapY || $[79] !== gridAutoColumns || $[80] !== gridAutoFlow || $[81] !== gridAutoRows || $[82] !== gridColumn || $[83] !== gridColumnEnd || $[84] !== gridColumnStart || $[85] !== gridRow || $[86] !== gridRowEnd || $[87] !== gridRowStart || $[88] !== gridTemplateColumns || $[89] !== gridTemplateRows || $[90] !== height || $[91] !== inset || $[92] !== insetBottom || $[93] !== insetLeft || $[94] !== insetRight || $[95] !== insetTop || $[96] !== justifyContent || $[97] !== margin || $[98] !== marginBottom || $[99] !== marginLeft || $[100] !== marginRight || $[101] !== marginTop || $[102] !== marginX || $[103] !== marginY || $[104] !== maxWidth || $[105] !== minHeight || $[106] !== minWidth || $[107] !== muted || $[108] !== outline || $[109] !== overflow || $[110] !== overflowX || $[111] !== overflowY || $[112] !== padding || $[113] !== paddingBottom || $[114] !== paddingLeft || $[115] !== paddingRight || $[116] !== paddingTop || $[117] !== paddingX || $[118] !== paddingY || $[119] !== pointerEvents || $[120] !== position || $[121] !== radius || $[122] !== shadow || $[123] !== sizing || $[124] !== textAlign || $[125] !== width ? (t9 = box({
208
+ className,
209
+ alignItems,
210
+ border,
211
+ borderTop,
212
+ borderRight,
213
+ borderBottom,
214
+ borderLeft,
215
+ display,
216
+ flex,
217
+ flexDirection,
218
+ flexWrap,
219
+ gap,
220
+ gapX,
221
+ gapY,
222
+ gridAutoColumns,
223
+ gridAutoFlow,
224
+ gridAutoRows,
225
+ gridColumn,
226
+ gridColumnEnd,
227
+ gridColumnStart,
228
+ gridRow,
229
+ gridRowEnd,
230
+ gridRowStart,
231
+ gridTemplateColumns,
232
+ gridTemplateRows,
233
+ height,
234
+ inset,
235
+ insetBottom,
236
+ insetLeft,
237
+ insetRight,
238
+ insetTop,
239
+ justifyContent,
240
+ margin,
241
+ marginX,
242
+ marginY,
243
+ marginTop,
244
+ marginRight,
245
+ marginBottom,
246
+ marginLeft,
247
+ maxWidth,
248
+ minHeight,
249
+ minWidth,
250
+ muted,
251
+ outline,
252
+ overflow,
253
+ overflowX,
254
+ overflowY,
255
+ padding,
256
+ paddingX,
257
+ paddingY,
258
+ paddingTop,
259
+ paddingRight,
260
+ paddingBottom,
261
+ paddingLeft,
262
+ pointerEvents,
263
+ position,
264
+ radius,
265
+ shadow,
266
+ sizing,
267
+ textAlign,
268
+ width
269
+ }), $[65] = alignItems, $[66] = border, $[67] = borderBottom, $[68] = borderLeft, $[69] = borderRight, $[70] = borderTop, $[71] = className, $[72] = display, $[73] = flex, $[74] = flexDirection, $[75] = flexWrap, $[76] = gap, $[77] = gapX, $[78] = gapY, $[79] = gridAutoColumns, $[80] = gridAutoFlow, $[81] = gridAutoRows, $[82] = gridColumn, $[83] = gridColumnEnd, $[84] = gridColumnStart, $[85] = gridRow, $[86] = gridRowEnd, $[87] = gridRowStart, $[88] = gridTemplateColumns, $[89] = gridTemplateRows, $[90] = height, $[91] = inset, $[92] = insetBottom, $[93] = insetLeft, $[94] = insetRight, $[95] = insetTop, $[96] = justifyContent, $[97] = margin, $[98] = marginBottom, $[99] = marginLeft, $[100] = marginRight, $[101] = marginTop, $[102] = marginX, $[103] = marginY, $[104] = maxWidth, $[105] = minHeight, $[106] = minWidth, $[107] = muted, $[108] = outline, $[109] = overflow, $[110] = overflowX, $[111] = overflowY, $[112] = padding, $[113] = paddingBottom, $[114] = paddingLeft, $[115] = paddingRight, $[116] = paddingTop, $[117] = paddingX, $[118] = paddingY, $[119] = pointerEvents, $[120] = position, $[121] = radius, $[122] = shadow, $[123] = sizing, $[124] = textAlign, $[125] = width, $[126] = t9) : t9 = $[126];
270
+ let t10;
271
+ return $[127] !== Element2 || $[128] !== children || $[129] !== rest || $[130] !== t9 ? (t10 = /* @__PURE__ */ jsx(Element2, { "data-ui": "Box", ...rest, className: t9, children }), $[127] = Element2, $[128] = children, $[129] = rest, $[130] = t9, $[131] = t10) : t10 = $[131], t10;
272
+ }
273
+ const DEFAULT_TEXT_ELEMENT = "div";
274
+ function Text(props) {
275
+ const $ = c(30), t0 = props;
276
+ let align, children, className, flex, muted, rest, t1, t2, t3, t4, textOverflowProp;
277
+ $[0] !== t0 ? ({
278
+ align,
279
+ as: t1,
280
+ children,
281
+ className,
282
+ flex,
283
+ maxWidth: t2,
284
+ muted,
285
+ size: t3,
286
+ textOverflow: textOverflowProp,
287
+ weight: t4,
288
+ ...rest
289
+ } = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = muted, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], muted = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], textOverflowProp = $[11]);
290
+ const Element2 = t1 === void 0 ? DEFAULT_TEXT_ELEMENT : t1, maxWidth = t2 === void 0 ? "fill" : t2, size2 = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
291
+ let t5;
292
+ $[12] !== align || $[13] !== className || $[14] !== flex || $[15] !== maxWidth || $[16] !== muted || $[17] !== size2 || $[18] !== weight ? (t5 = text({
293
+ className,
294
+ align,
295
+ flex,
296
+ maxWidth,
297
+ muted,
298
+ size: size2,
299
+ weight
300
+ }), $[12] = align, $[13] = className, $[14] = flex, $[15] = maxWidth, $[16] = muted, $[17] = size2, $[18] = weight, $[19] = t5) : t5 = $[19];
301
+ let t6;
302
+ $[20] !== textOverflowProp ? (t6 = textOverflow({
303
+ textOverflow: textOverflowProp
304
+ }), $[20] = textOverflowProp, $[21] = t6) : t6 = $[21];
305
+ let t7;
306
+ $[22] !== children || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsx("span", { className: t6, children }), $[22] = children, $[23] = t6, $[24] = t7) : t7 = $[24];
307
+ let t8;
308
+ return $[25] !== Element2 || $[26] !== rest || $[27] !== t5 || $[28] !== t7 ? (t8 = /* @__PURE__ */ jsx(Element2, { "data-ui": "Text", ...rest, className: t5, children: t7 }), $[25] = Element2, $[26] = rest, $[27] = t5, $[28] = t7, $[29] = t8) : t8 = $[29], t8;
309
+ }
310
+ function AnimatedSpinnerIcon(props) {
311
+ const $ = c(5);
312
+ let rest;
313
+ $[0] !== props ? ({
314
+ ...rest
315
+ } = props, $[0] = props, $[1] = rest) : rest = $[1];
316
+ let t0;
317
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t0 = animatedSpinnerIcon(), $[2] = t0) : t0 = $[2];
318
+ let t1;
319
+ return $[3] !== rest ? (t1 = /* @__PURE__ */ jsx(SpinnerIcon, { "data-sanity-icon": "animated-spinner", ...rest, className: t0 }), $[3] = rest, $[4] = t1) : t1 = $[4], t1;
320
+ }
321
+ const DEFAULT_SPINNER_ELEMENT = "div";
322
+ function Spinner(props) {
323
+ const $ = c(11), t0 = props;
324
+ let className, rest, t1;
325
+ $[0] !== t0 ? ({
326
+ as: t1,
327
+ className,
328
+ ...rest
329
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
330
+ const as = t1 === void 0 ? DEFAULT_SPINNER_ELEMENT : t1;
331
+ let t2;
332
+ $[4] !== className ? (t2 = spinner({
333
+ className
334
+ }), $[4] = className, $[5] = t2) : t2 = $[5];
335
+ let t3;
336
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(AnimatedSpinnerIcon, {}), $[6] = t3) : t3 = $[6];
337
+ let t4;
338
+ return $[7] !== as || $[8] !== rest || $[9] !== t2 ? (t4 = /* @__PURE__ */ jsx(Text, { as, "data-ui": "Spinner", ...rest, className: t2, children: t3 }), $[7] = as, $[8] = rest, $[9] = t2, $[10] = t4) : t4 = $[10], t4;
339
+ }
340
+ const DEFAULT_BUTTON_ELEMENT = "button";
341
+ function Button(props) {
342
+ const {
343
+ align = "center",
344
+ as: Element2 = DEFAULT_BUTTON_ELEMENT,
345
+ children,
346
+ className,
347
+ disabled,
348
+ flex,
349
+ fontSize = 1,
350
+ gap = props.padding ?? 3,
351
+ gapX,
352
+ gapY,
353
+ icon: IconComponent,
354
+ iconRight: IconRightComponent,
355
+ justify = "center",
356
+ loading,
357
+ mode = "default",
358
+ padding = 3,
359
+ paddingX,
360
+ paddingY,
361
+ paddingTop,
362
+ paddingBottom,
363
+ paddingLeft,
364
+ paddingRight,
365
+ radius = 2,
366
+ selected,
367
+ text: text2,
368
+ textAlign,
369
+ textOverflow: textOverflow2 = "ellipsis",
370
+ textWeight = "medium",
371
+ tone = "default",
372
+ type = "button",
373
+ muted = !1,
374
+ width,
375
+ ...rest
376
+ } = props;
377
+ let href;
378
+ return "href" in rest && (href = typeof rest.href == "string" ? rest.href : href, delete rest.href), /* @__PURE__ */ jsxs(
379
+ Element2,
380
+ {
381
+ "data-ui": "Button",
382
+ ...rest,
383
+ className: button({
384
+ className,
385
+ flex,
386
+ mode,
387
+ radius,
388
+ tone,
389
+ width
390
+ }),
391
+ "data-disabled": loading || disabled ? "" : void 0,
392
+ "data-selected": selected ? "" : void 0,
393
+ disabled: !!(loading || disabled),
394
+ href: disabled ? void 0 : href,
395
+ type,
396
+ children: [
397
+ !!loading && /* @__PURE__ */ jsx(Box, { alignItems: "center", as: "span", className: buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize }) }),
398
+ (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
399
+ IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
400
+ isValidElement(IconComponent) && IconComponent,
401
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
402
+ ] }),
403
+ text2 && /* @__PURE__ */ jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow: textOverflow2, weight: textWeight, children: text2 }) }),
404
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
405
+ isValidElement(IconRightComponent) && IconRightComponent,
406
+ isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
407
+ ] })
408
+ ] }),
409
+ children && /* @__PURE__ */ jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children })
410
+ ]
411
+ }
412
+ );
413
+ }
414
+ function useMatchMedia(mediaQueryString, getServerSnapshot2) {
415
+ const $ = c(4);
416
+ useDebugValue(mediaQueryString);
417
+ let t0;
418
+ $[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
419
+ const media2 = window.matchMedia(mediaQueryString);
420
+ return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
421
+ }, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
422
+ let t1;
423
+ return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], useSyncExternalStore(t0, t1, getServerSnapshot2);
424
+ }
425
+ function usePrefersReducedMotion(t0) {
426
+ return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$a : t0);
427
+ }
428
+ function _temp$a() {
429
+ return !1;
430
+ }
431
+ const origin = {
432
+ name: "@sanity/ui/origin",
433
+ fn({
434
+ middlewareData,
435
+ placement,
436
+ rects
437
+ }) {
438
+ const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
439
+ if (floatingWidth <= 0 || floatingHeight <= 0)
440
+ return {};
441
+ const isVerticalPlacement = ["bottom", "top"].includes(side), {
442
+ originX,
443
+ originY
444
+ } = isVerticalPlacement ? {
445
+ originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
446
+ originY: side === "bottom" ? 0 : 1
447
+ } : {
448
+ originX: side === "left" ? 1 : 0,
449
+ originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
450
+ };
451
+ return {
452
+ data: {
453
+ originX,
454
+ originY
455
+ }
456
+ };
457
+ }
458
+ };
459
+ function clamp(num, min, max) {
460
+ return Math.min(Math.max(num, min), max);
461
+ }
462
+ function getGlobalScope() {
463
+ if (typeof globalThis < "u") return globalThis;
464
+ if (typeof window < "u") return window;
465
+ if (typeof self < "u") return self;
466
+ if (typeof global < "u") return global;
467
+ throw new Error("@sanity/ui: could not locate global scope");
468
+ }
469
+ const globalScope = getGlobalScope();
470
+ function createGlobalScopedContext(key2, defaultValue) {
471
+ const symbol = Symbol.for(key2);
472
+ if (typeof document > "u")
473
+ return createContext(defaultValue);
474
+ const symbolMap = globalScope;
475
+ return symbolMap[symbol] = symbolMap[symbol] || createContext(defaultValue), symbolMap[symbol];
476
+ }
477
+ const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v3/boundaryElement", null), DEFAULT_VALUE = {
478
+ version: 0,
479
+ element: null
480
+ };
481
+ function useBoundaryElement() {
482
+ const value = useContext(BoundaryElementContext);
483
+ if (value && (!isRecord(value) || value.version !== 0))
484
+ throw new Error("useBoundaryElement(): the context value is not compatible");
485
+ return value || DEFAULT_VALUE;
486
+ }
487
+ function getElementRef(element) {
488
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
489
+ return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
490
+ }
491
+ const CardContext = createGlobalScopedContext("@sanity/ui/v3/card", null);
492
+ function CardProvider(props) {
493
+ const $ = c(7), {
494
+ children,
495
+ tone,
496
+ scheme,
497
+ unstable_CompatProvider
498
+ } = props;
499
+ let t0, t1;
500
+ $[0] !== scheme || $[1] !== tone || $[2] !== unstable_CompatProvider ? (t1 = {
501
+ tone,
502
+ scheme,
503
+ unstable_CompatProvider
504
+ }, $[0] = scheme, $[1] = tone, $[2] = unstable_CompatProvider, $[3] = t1) : t1 = $[3], t0 = t1;
505
+ let t2;
506
+ return $[4] !== children || $[5] !== t0 ? (t2 = /* @__PURE__ */ jsx(CardContext.Provider, { value: t0, children }), $[4] = children, $[5] = t0, $[6] = t2) : t2 = $[6], t2;
507
+ }
508
+ function useCard() {
509
+ const card2 = useContext(CardContext);
510
+ if (!card2)
511
+ throw new Error("useCard(): missing context value");
512
+ return card2;
513
+ }
514
+ const key = "@sanity/ui/v3/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
515
+ elementMap[elementKey] = null;
516
+ const defaultContextValue = {
517
+ version: 0,
518
+ boundaryElement: null,
519
+ get element() {
520
+ return typeof document > "u" ? null : (elementMap[elementKey] || (elementMap[elementKey] = document.createElement("div"), elementMap[elementKey].setAttribute("data-portal", ""), document.body.appendChild(elementMap[elementKey])), elementMap[elementKey]);
521
+ }
522
+ }, PortalContext = createGlobalScopedContext(key, defaultContextValue);
523
+ function usePortal() {
524
+ const value = useContext(PortalContext);
525
+ if (!value)
526
+ throw new Error("usePortal(): missing context value");
527
+ if (!isRecord(value) || value.version !== 0)
528
+ throw new Error("usePortal(): the context value is not compatible");
529
+ return value;
530
+ }
531
+ function Portal(props) {
532
+ const $ = c(6), {
533
+ children,
534
+ __unstable_name: name
535
+ } = props, card2 = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
536
+ if (!portalElement)
537
+ return null;
538
+ let t0;
539
+ $[0] !== card2.scheme || $[1] !== children ? (t0 = /* @__PURE__ */ jsx(CardProvider, { tone: "transparent", scheme: card2.scheme, children }), $[0] = card2.scheme, $[1] = children, $[2] = t0) : t0 = $[2];
540
+ let t1;
541
+ return $[3] !== portalElement || $[4] !== t0 ? (t1 = createPortal(t0, portalElement), $[3] = portalElement, $[4] = t0, $[5] = t1) : t1 = $[5], t1;
542
+ }
543
+ function getLayerContext(contextValue) {
544
+ if (!isRecord(contextValue) || contextValue.version !== 0)
545
+ throw new Error("the context value is not compatible");
546
+ if (!contextValue)
547
+ throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
548
+ if (contextValue.version === 0)
549
+ return contextValue;
550
+ throw new Error("could not get layer context");
551
+ }
552
+ const LayerContext = createGlobalScopedContext("@sanity/ui/v3/layer", null);
553
+ function useLayer() {
554
+ const $ = c(2), value = useContext(LayerContext);
555
+ if (!value)
556
+ throw new Error("useLayer(): missing context value");
557
+ try {
558
+ let t1;
559
+ return $[0] !== value ? (t1 = getLayerContext(value), $[0] = value, $[1] = t1) : t1 = $[1], t1;
560
+ } catch (t0) {
561
+ const err = t0;
562
+ throw err instanceof Error ? new Error(`useLayer(): ${err.message}`) : new Error(`useLayer(): ${err}`);
563
+ }
564
+ }
565
+ const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
566
+ top: ["bottom", "left", "right"],
567
+ "top-start": ["bottom-start", "left-start", "right-start"],
568
+ "top-end": ["bottom-end", "left-end", "right-end"],
569
+ bottom: ["top", "left", "right"],
570
+ "bottom-start": ["top-start", "left-start", "right-start"],
571
+ "bottom-end": ["top-end", "left-end", "right-end"],
572
+ left: ["right", "top", "bottom"],
573
+ "left-start": ["right-start", "top-start", "bottom-start"],
574
+ "left-end": ["right-end", "top-end", "bottom-end"],
575
+ right: ["left", "top", "bottom"],
576
+ "right-start": ["left-start", "top-start", "bottom-start"],
577
+ "right-end": ["left-end", "top-end", "bottom-end"]
578
+ };
579
+ function size(options) {
580
+ const {
581
+ apply,
582
+ margins,
583
+ padding = 0
584
+ } = options;
585
+ return {
586
+ name: "@sanity/ui/size",
587
+ async fn(args) {
588
+ const {
589
+ elements,
590
+ placement,
591
+ platform,
592
+ rects
593
+ } = args, {
594
+ floating,
595
+ reference
596
+ } = rects, overflow = await detectOverflow(args, {
597
+ altBoundary: !0,
598
+ boundary: options.boundaryElement || void 0,
599
+ elementContext: "floating",
600
+ padding,
601
+ rootBoundary: "viewport"
602
+ });
603
+ let maxWidth = 1 / 0, maxHeight = 1 / 0;
604
+ const floatingW = floating.width, floatingH = floating.height;
605
+ placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom)), apply({
606
+ availableWidth: maxWidth - margins[1] - margins[3],
607
+ availableHeight: maxHeight - margins[0] - margins[2],
608
+ elements,
609
+ referenceWidth: reference.width - margins[1] - margins[3]
610
+ });
611
+ const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
612
+ return floatingW !== targetW || floatingH !== targetH ? {
613
+ reset: {
614
+ rects: !0
615
+ }
616
+ } : {};
617
+ }
618
+ };
619
+ }
620
+ function moveTowardsLength(movingPoint, targetPoint, amount) {
621
+ const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
622
+ return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
623
+ }
624
+ function moveTowardsFractional(movingPoint, targetPoint, fraction) {
625
+ return {
626
+ x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
627
+ y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
628
+ };
629
+ }
630
+ function getRoundedCommands(points) {
631
+ const len = points.length, cmds = [];
632
+ for (let i = 0; i < len; i += 1) {
633
+ const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
634
+ if (prevPoint && point.radius) {
635
+ const curveStart = moveTowardsLength(point, prevPoint, point.radius), curveEnd = moveTowardsLength(point, nextPoint, point.radius), startControl = moveTowardsFractional(curveStart, point, 0.5), endControl = moveTowardsFractional(point, curveEnd, 0.5);
636
+ cmds.push({
637
+ type: "point",
638
+ ...curveStart
639
+ }), cmds.push({
640
+ type: "curve",
641
+ curveEnd,
642
+ startControl,
643
+ endControl
644
+ });
645
+ } else
646
+ cmds.push({
647
+ type: "point",
648
+ ...point
649
+ });
650
+ }
651
+ return cmds;
652
+ }
653
+ function compileCommands(cmds) {
654
+ return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
655
+ }
656
+ const DEFAULT_ARROW_ELEMENT = "div";
657
+ function Arrow(props) {
658
+ const $ = c(34), t0 = props;
659
+ let h, rest, style, t1, t2, w;
660
+ $[0] !== t0 ? ({
661
+ as: t1,
662
+ width: w,
663
+ height: h,
664
+ radius: t2,
665
+ style,
666
+ ...rest
667
+ } = t0, $[0] = t0, $[1] = h, $[2] = rest, $[3] = style, $[4] = t1, $[5] = t2, $[6] = w) : (h = $[1], rest = $[2], style = $[3], t1 = $[4], t2 = $[5], w = $[6]);
668
+ const Element2 = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
669
+ let t3;
670
+ const points = [{
671
+ x: 0,
672
+ y: 0
673
+ }, {
674
+ x: radius,
675
+ y: 0,
676
+ radius
677
+ }, {
678
+ x: center,
679
+ y: h - 1,
680
+ radius
681
+ }, {
682
+ x: w - radius,
683
+ y: 0,
684
+ radius
685
+ }, {
686
+ x: w,
687
+ y: 0
688
+ }], cmds = getRoundedCommands(points);
689
+ t3 = compileCommands(cmds);
690
+ const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
691
+ let t4;
692
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = _arrow(), $[7] = t4) : t4 = $[7];
693
+ const t5 = `${w}px`;
694
+ let t6;
695
+ $[8] !== t5 ? (t6 = assignInlineVars({
696
+ [vars.arrow.size]: t5
697
+ }), $[8] = t5, $[9] = t6) : t6 = $[9];
698
+ let t7;
699
+ $[10] !== style || $[11] !== t6 ? (t7 = {
700
+ ...style,
701
+ ...t6
702
+ }, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
703
+ let t8;
704
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = _arrowSvg(), $[13] = t8) : t8 = $[13];
705
+ const t9 = `0 0 ${w} ${w}`;
706
+ let t10;
707
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = _arrowStrokeMask(), $[14] = t10) : t10 = $[14];
708
+ let t11;
709
+ $[15] !== w ? (t11 = /* @__PURE__ */ jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
710
+ let t12;
711
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = _arrowStroke(), $[17] = t12) : t12 = $[17];
712
+ let t13;
713
+ $[18] !== strokePath ? (t13 = /* @__PURE__ */ jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
714
+ let t14;
715
+ $[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = _arrowShape(), $[20] = t14) : t14 = $[20];
716
+ let t15;
717
+ $[21] !== fillPath ? (t15 = /* @__PURE__ */ jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
718
+ let t16;
719
+ $[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
720
+ t11,
721
+ t13,
722
+ t15
723
+ ] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
724
+ let t17;
725
+ return $[29] !== Element2 || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsx(Element2, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element2, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
726
+ }
727
+ const DEFAULT_FLEX_ELEMENT = "div";
728
+ function Flex(props) {
729
+ const $ = c(14), t0 = props;
730
+ let align, justify, rest, t1, t2, wrap;
731
+ $[0] !== t0 ? ({
732
+ align,
733
+ as: t1,
734
+ direction: t2,
735
+ justify,
736
+ wrap,
737
+ ...rest
738
+ } = t0, $[0] = t0, $[1] = align, $[2] = justify, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = wrap) : (align = $[1], justify = $[2], rest = $[3], t1 = $[4], t2 = $[5], wrap = $[6]);
739
+ const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
740
+ let t3;
741
+ return $[7] !== align || $[8] !== as || $[9] !== direction || $[10] !== justify || $[11] !== rest || $[12] !== wrap ? (t3 = /* @__PURE__ */ jsx(Box, { "data-ui": "Flex", ...rest, alignItems: align, as, display: "flex", flexDirection: direction, flexWrap: wrap, justifyContent: justify }), $[7] = align, $[8] = as, $[9] = direction, $[10] = justify, $[11] = rest, $[12] = wrap, $[13] = t3) : t3 = $[13], t3;
742
+ }
743
+ const DEFAULT_CARD_ELEMENT = "div";
744
+ function Card(props) {
745
+ const $ = c(38), t0 = props;
746
+ let className, disabled, pressed, rest, schemeProp, selected, style, t1, t2, t3, t4, t5;
747
+ $[0] !== t0 ? ({
748
+ __unstable_checkered: t1,
749
+ __unstable_focusRing: t2,
750
+ as: t3,
751
+ className,
752
+ disabled,
753
+ pressed,
754
+ radius: t4,
755
+ scheme: schemeProp,
756
+ selected,
757
+ style,
758
+ tone: t5,
759
+ ...rest
760
+ } = t0, $[0] = t0, $[1] = className, $[2] = disabled, $[3] = pressed, $[4] = rest, $[5] = schemeProp, $[6] = selected, $[7] = style, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5) : (className = $[1], disabled = $[2], pressed = $[3], rest = $[4], schemeProp = $[5], selected = $[6], style = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12]);
761
+ const checkered = t1 === void 0 ? !1 : t1, focusRing = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_CARD_ELEMENT : t3, radius = t4 === void 0 ? 0 : t4, toneProp = t5 === void 0 ? "default" : t5, parent = useContext(CardContext), tone = toneProp === "inherit" ? parent?.tone : toneProp, scheme = schemeProp === void 0 ? parent?.scheme : schemeProp, t6 = scheme === parent?.scheme ? void 0 : scheme;
762
+ let t7;
763
+ $[13] !== className || $[14] !== t6 || $[15] !== tone ? (t7 = card({
764
+ className,
765
+ scheme: t6,
766
+ tone
767
+ }), $[13] = className, $[14] = t6, $[15] = tone, $[16] = t7) : t7 = $[16];
768
+ const t8 = checkered ? "" : void 0, t9 = disabled ? "" : void 0, t10 = focusRing ? "" : void 0, t11 = pressed ? "" : void 0, t12 = selected ? "" : void 0;
769
+ let t13;
770
+ $[17] !== as || $[18] !== radius || $[19] !== rest || $[20] !== style || $[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9 ? (t13 = /* @__PURE__ */ jsx(Box, { "data-ui": "Card", ...rest, as, className: t7, "data-checkered": t8, "data-disabled": t9, "data-focus-ring": t10, "data-pressed": t11, "data-selected": t12, radius, style }), $[17] = as, $[18] = radius, $[19] = rest, $[20] = style, $[21] = t10, $[22] = t11, $[23] = t12, $[24] = t7, $[25] = t8, $[26] = t9, $[27] = t13) : t13 = $[27];
771
+ let node = t13;
772
+ if (scheme === parent?.scheme && tone === parent?.tone)
773
+ return node;
774
+ const t14 = scheme ?? "light", t15 = tone ?? "default", t16 = parent?.unstable_CompatProvider;
775
+ let t17;
776
+ if ($[28] !== node || $[29] !== t14 || $[30] !== t15 || $[31] !== t16 ? (t17 = /* @__PURE__ */ jsx(CardProvider, { scheme: t14, tone: t15, unstable_CompatProvider: t16, children: node }), $[28] = node, $[29] = t14, $[30] = t15, $[31] = t16, $[32] = t17) : t17 = $[32], node = t17, parent?.unstable_CompatProvider) {
777
+ const CompatProvider = parent.unstable_CompatProvider, t18 = scheme ?? "light", t19 = tone ?? parent.tone;
778
+ let t20;
779
+ return $[33] !== CompatProvider || $[34] !== node || $[35] !== t18 || $[36] !== t19 ? (t20 = /* @__PURE__ */ jsx(CompatProvider, { scheme: t18, tone: t19, children: node }), $[33] = CompatProvider, $[34] = node, $[35] = t18, $[36] = t19, $[37] = t20) : t20 = $[37], t20;
780
+ }
781
+ return node;
782
+ }
783
+ const DEFAULT_LAYER_CARD_ELEMENT = "div";
784
+ function LayerCard(props) {
785
+ const $ = c(27), t0 = props;
786
+ let children, forwardedRef, onActivate, onFocus, rest, t1, t2, t3;
787
+ $[0] !== t0 ? ({
788
+ as: t1,
789
+ children,
790
+ onActivate,
791
+ onFocus,
792
+ position: t2,
793
+ ref: forwardedRef,
794
+ style: t3,
795
+ ...rest
796
+ } = t0, $[0] = t0, $[1] = children, $[2] = forwardedRef, $[3] = onActivate, $[4] = onFocus, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (children = $[1], forwardedRef = $[2], onActivate = $[3], onFocus = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
797
+ const as = t1 === void 0 ? DEFAULT_LAYER_CARD_ELEMENT : t1, position = t2 === void 0 ? "relative" : t2, style = t3 === void 0 ? EMPTY_RECORD : t3, {
798
+ zIndex,
799
+ isTopLayer
800
+ } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer);
801
+ let t4;
802
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[9] = t4) : t4 = $[9], useImperativeHandle(forwardedRef, t4);
803
+ let t5, t6;
804
+ $[10] !== isTopLayer || $[11] !== onActivate ? (t5 = () => {
805
+ isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({
806
+ activeElement: lastFocusedRef.current
807
+ }), isTopLayerRef.current = isTopLayer;
808
+ }, t6 = [isTopLayer, onActivate], $[10] = isTopLayer, $[11] = onActivate, $[12] = t5, $[13] = t6) : (t5 = $[12], t6 = $[13]), useEffect(t5, t6);
809
+ let t7;
810
+ $[14] !== isTopLayer || $[15] !== onFocus ? (t7 = (event) => {
811
+ onFocus?.(event);
812
+ const rootElement = ref.current, target = document.activeElement;
813
+ !isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
814
+ }, $[14] = isTopLayer, $[15] = onFocus, $[16] = t7) : t7 = $[16];
815
+ const handleFocus = t7, t8 = as;
816
+ let t9;
817
+ $[17] !== style || $[18] !== zIndex ? (t9 = {
818
+ ...style,
819
+ zIndex
820
+ }, $[17] = style, $[18] = zIndex, $[19] = t9) : t9 = $[19];
821
+ let t10;
822
+ return $[20] !== children || $[21] !== handleFocus || $[22] !== position || $[23] !== rest || $[24] !== t8 || $[25] !== t9 ? (t10 = /* @__PURE__ */ jsx(Card, { "data-ui": "Layer", ...rest, as: t8, onFocus: handleFocus, position, ref, style: t9, children }), $[20] = children, $[21] = handleFocus, $[22] = position, $[23] = rest, $[24] = t8, $[25] = t9, $[26] = t10) : t10 = $[26], t10;
823
+ }
824
+ const media = Object.values(BREAKPOINTS);
825
+ function _getMediaQuery(media2, index) {
826
+ return index === 0 ? `screen and (max-width: ${media2[index + 1] - 1}px)` : index === media2.length - 1 ? `screen and (min-width: ${media2[index]}px)` : `screen and (min-width: ${media2[index]}px) and (max-width: ${media2[index + 1] - 1}px)`;
827
+ }
828
+ function _createMediaStore() {
829
+ const mediaLen = media.length;
830
+ let sizes;
831
+ const getSizes = () => {
832
+ if (typeof window > "u")
833
+ return sizes;
834
+ if (!sizes) {
835
+ sizes = [];
836
+ for (let index = mediaLen; index > -1; index -= 1) {
837
+ const mediaQuery = _getMediaQuery(media, index);
838
+ sizes.push({
839
+ index,
840
+ mq: window.matchMedia(mediaQuery)
841
+ });
842
+ }
843
+ }
844
+ return sizes;
845
+ };
846
+ return {
847
+ getSnapshot: () => {
848
+ for (const {
849
+ index,
850
+ mq
851
+ } of getSizes() ?? [])
852
+ if (mq.matches) return index;
853
+ return 0;
854
+ },
855
+ subscribe: (onStoreChange) => {
856
+ const disposeFns = [];
857
+ for (const {
858
+ mq
859
+ } of getSizes() ?? []) {
860
+ const handleChange = () => {
861
+ mq.matches && onStoreChange();
862
+ };
863
+ mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
864
+ }
865
+ return () => {
866
+ for (const disposeFn of disposeFns)
867
+ disposeFn();
868
+ };
869
+ }
870
+ };
871
+ }
872
+ function getServerSnapshot() {
873
+ return 0;
874
+ }
875
+ function useMediaIndex() {
876
+ const $ = c(1);
877
+ let t0, t1;
878
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
879
+ const store = t0;
880
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
881
+ }
882
+ function LayerProvider(props) {
883
+ const $ = c(19), {
884
+ children,
885
+ zOffset: t0
886
+ } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext);
887
+ let t1;
888
+ $[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
889
+ const parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, zOffset = useResponsiveProp(zOffsetProp), maxMediaIndex = Object.values(zOffset).length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + (zOffset[mediaIndex] ?? 0) : zOffset[mediaIndex] ?? 0;
890
+ let t2;
891
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
892
+ const [, setChildLayers] = useState(t2), [size2, setSize] = useState(0), isTopLayer = size2 === 0;
893
+ let t3;
894
+ $[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
895
+ const parentDispose = parentRegisterChild?.(childLevel);
896
+ return childLevel !== void 0 ? setChildLayers((state) => {
897
+ const prevLen = state[childLevel] ?? 0, nextState = {
898
+ ...state,
899
+ [childLevel]: prevLen + 1
900
+ };
901
+ return setSize(Object.keys(nextState).length), nextState;
902
+ }) : setSize(_temp$9), () => {
903
+ childLevel !== void 0 ? setChildLayers((state_0) => {
904
+ const nextState_0 = {
905
+ ...state_0
906
+ };
907
+ return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
908
+ }) : setSize(_temp2$2), parentDispose?.();
909
+ };
910
+ }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
911
+ const registerChild = t3;
912
+ let t4, t5;
913
+ $[6] !== level || $[7] !== parentRegisterChild ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = level, $[7] = parentRegisterChild, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), useEffect(t4, t5);
914
+ let t6, t7;
915
+ $[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
916
+ version: 0,
917
+ isTopLayer,
918
+ level,
919
+ registerChild,
920
+ size: size2,
921
+ zIndex
922
+ }, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
923
+ const value = t6;
924
+ let t8;
925
+ return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
926
+ }
927
+ function _temp2$2(v_0) {
928
+ return v_0 - 1;
929
+ }
930
+ function _temp$9(v) {
931
+ return v + 1;
932
+ }
933
+ const DEFAULT_LAYER_ELEMENT = "div";
934
+ function Layer(props) {
935
+ const $ = c(12), t0 = props;
936
+ let children, rest, t1, t2;
937
+ $[0] !== t0 ? ({
938
+ as: t1,
939
+ children,
940
+ zOffset: t2,
941
+ ...rest
942
+ } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = t2) : (children = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
943
+ const as = t1 === void 0 ? DEFAULT_LAYER_ELEMENT : t1, zOffset = t2 === void 0 ? 1 : t2;
944
+ let t3;
945
+ $[5] !== as || $[6] !== children || $[7] !== rest ? (t3 = /* @__PURE__ */ jsx(LayerCard, { ...rest, as, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t3) : t3 = $[8];
946
+ let t4;
947
+ return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
948
+ }
949
+ function PopoverLayer(props) {
950
+ const $ = c(65);
951
+ let animate, arrow2, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t0, xProp, yProp;
952
+ $[0] !== props ? ({
953
+ __unstable_margins: marginsProp,
954
+ animate,
955
+ arrow: arrow2,
956
+ arrowRef,
957
+ arrowX,
958
+ arrowY,
959
+ children,
960
+ maxWidth,
961
+ padding,
962
+ placement,
963
+ originX,
964
+ originY,
965
+ overflow,
966
+ radius,
967
+ referenceWidth,
968
+ shadow,
969
+ strategy,
970
+ style,
971
+ tone: t0,
972
+ x: xProp,
973
+ y: yProp,
974
+ ...rest
975
+ } = props, $[0] = props, $[1] = animate, $[2] = arrow2, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = maxWidth, $[9] = originX, $[10] = originY, $[11] = overflow, $[12] = padding, $[13] = placement, $[14] = radius, $[15] = referenceWidth, $[16] = rest, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = t0, $[21] = xProp, $[22] = yProp) : (animate = $[1], arrow2 = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], maxWidth = $[8], originX = $[9], originY = $[10], overflow = $[11], padding = $[12], placement = $[13], radius = $[14], referenceWidth = $[15], rest = $[16], shadow = $[17], strategy = $[18], style = $[19], t0 = $[20], xProp = $[21], yProp = $[22]);
976
+ const tone = t0 === void 0 ? "inherit" : t0;
977
+ let t1;
978
+ t1 = marginsProp || DEFAULT_POPOVER_MARGINS;
979
+ const margins = t1, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0];
980
+ let t2;
981
+ const t3 = animate ? "transform" : void 0;
982
+ let t4;
983
+ $[23] !== originX || $[24] !== originY || $[25] !== referenceWidth || $[26] !== style || $[27] !== t3 || $[28] !== x || $[29] !== y ? (t4 = {
984
+ left: x,
985
+ originX,
986
+ originY,
987
+ top: y,
988
+ width: referenceWidth,
989
+ willChange: t3,
990
+ ...style
991
+ }, $[23] = originX, $[24] = originY, $[25] = referenceWidth, $[26] = style, $[27] = t3, $[28] = x, $[29] = y, $[30] = t4) : t4 = $[30], t2 = t4;
992
+ const rootStyle = t2;
993
+ let t5;
994
+ const t6 = arrowX !== null ? arrowX : void 0, t7 = arrowY !== null ? arrowY : void 0;
995
+ let t8;
996
+ $[31] !== t6 || $[32] !== t7 ? (t8 = {
997
+ left: t6,
998
+ top: t7,
999
+ right: void 0,
1000
+ bottom: void 0
1001
+ }, $[31] = t6, $[32] = t7, $[33] = t8) : t8 = $[33], t5 = t8;
1002
+ const arrowStyle = t5;
1003
+ let t9;
1004
+ $[34] === Symbol.for("react.memo_cache_sentinel") ? (t9 = popoverCard(), $[34] = t9) : t9 = $[34];
1005
+ let t10;
1006
+ $[35] !== animate ? (t10 = animate ? ["hidden", "initial"] : void 0, $[35] = animate, $[36] = t10) : t10 = $[36];
1007
+ let t11;
1008
+ $[37] !== animate ? (t11 = animate ? ["visible", "scaleIn"] : void 0, $[37] = animate, $[38] = t11) : t11 = $[38];
1009
+ let t12;
1010
+ $[39] !== animate ? (t12 = animate ? ["hidden", "scaleOut"] : void 0, $[39] = animate, $[40] = t12) : t12 = $[40];
1011
+ let t13;
1012
+ $[41] !== children || $[42] !== padding ? (t13 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[41] = children, $[42] = padding, $[43] = t13) : t13 = $[43];
1013
+ let t14;
1014
+ $[44] !== maxWidth || $[45] !== overflow || $[46] !== t13 ? (t14 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, maxWidth, overflow, children: t13 }), $[44] = maxWidth, $[45] = overflow, $[46] = t13, $[47] = t14) : t14 = $[47];
1015
+ let t15;
1016
+ $[48] !== arrow2 || $[49] !== arrowRef || $[50] !== arrowStyle ? (t15 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[48] = arrow2, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t15) : t15 = $[51];
1017
+ let t16;
1018
+ return $[52] !== placement || $[53] !== radius || $[54] !== rest || $[55] !== rootStyle || $[56] !== shadow || $[57] !== strategy || $[58] !== t10 || $[59] !== t11 || $[60] !== t12 || $[61] !== t14 || $[62] !== t15 || $[63] !== tone ? (t16 = /* @__PURE__ */ jsxs(Layer, { className: t9, "data-ui": "Popover", ...rest, as: motion.div, "data-context-tone": tone, "data-placement": placement, flexDirection: "column", display: "flex", position: strategy, radius, shadow, sizing: "border", style: rootStyle, tone, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t10, animate: t11, exit: t12, children: [
1019
+ t14,
1020
+ t15
1021
+ ] }), $[52] = placement, $[53] = radius, $[54] = rest, $[55] = rootStyle, $[56] = shadow, $[57] = strategy, $[58] = t10, $[59] = t11, $[60] = t12, $[61] = t14, $[62] = t15, $[63] = tone, $[64] = t16) : t16 = $[64], t16;
1022
+ }
1023
+ const DEFAULT_POPOVER_ELEMENT = "div";
1024
+ function ViewportOverlay() {
1025
+ const $ = c(2), {
1026
+ zIndex
1027
+ } = useLayer();
1028
+ let t0;
1029
+ return $[0] !== zIndex ? (t0 = /* @__PURE__ */ jsx("div", { style: {
1030
+ position: "fixed",
1031
+ inset: 0,
1032
+ width: "100vw",
1033
+ height: "100vh",
1034
+ zIndex
1035
+ } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
1036
+ }
1037
+ function Popover(props) {
1038
+ const boundaryElementContext = useBoundaryElement(), {
1039
+ __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
1040
+ animate: _animate = !1,
1041
+ arrow: arrowProp = !1,
1042
+ as = DEFAULT_POPOVER_ELEMENT,
1043
+ children: childProp,
1044
+ className,
1045
+ constrainSize = !1,
1046
+ content: content2,
1047
+ disabled,
1048
+ fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
1049
+ matchReferenceWidth,
1050
+ floatingBoundary = boundaryElementContext.element,
1051
+ modal,
1052
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1053
+ onActivate,
1054
+ open,
1055
+ overflow = "hidden",
1056
+ padding,
1057
+ placement: placementProp = "bottom",
1058
+ placementStrategy = "flip",
1059
+ portal,
1060
+ preventOverflow = !0,
1061
+ radius = 3,
1062
+ ref: forwardedRef,
1063
+ referenceBoundary = boundaryElementContext.element,
1064
+ referenceElement,
1065
+ scheme,
1066
+ shadow = 3,
1067
+ tone = "inherit",
1068
+ width: widthProp = "auto",
1069
+ zOffset: zOffsetProp = Z_OFFSETS.popover,
1070
+ updateRef,
1071
+ ...rest
1072
+ } = props, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
1073
+ useImperativeHandle(forwardedRef, () => ref.current);
1074
+ const referenceWidthRef = useRef(void 0), middleware = useMemo(() => {
1075
+ const ret = [];
1076
+ return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(autoPlacement({
1077
+ allowedPlacements: [placementProp].concat(fallbackPlacements)
1078
+ })) : ret.push(flip({
1079
+ boundary: floatingBoundary || void 0,
1080
+ fallbackPlacements,
1081
+ padding: DEFAULT_POPOVER_PADDING,
1082
+ rootBoundary
1083
+ }))), ret.push(offset({
1084
+ mainAxis: DEFAULT_POPOVER_DISTANCE
1085
+ })), (constrainSize || matchReferenceWidth) && ret.push(size({
1086
+ apply({
1087
+ availableWidth,
1088
+ availableHeight,
1089
+ elements,
1090
+ referenceWidth
1091
+ }) {
1092
+ referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1093
+ },
1094
+ boundaryElement: floatingBoundary || void 0,
1095
+ margins,
1096
+ padding: DEFAULT_POPOVER_PADDING
1097
+ })), preventOverflow && ret.push(shift({
1098
+ boundary: floatingBoundary || void 0,
1099
+ rootBoundary,
1100
+ padding: DEFAULT_POPOVER_PADDING
1101
+ })), arrowProp && ret.push(arrow({
1102
+ element: arrowRef,
1103
+ padding: DEFAULT_POPOVER_PADDING
1104
+ })), animate && ret.push(origin), ret.push(hide({
1105
+ boundary: referenceBoundary || void 0,
1106
+ padding: DEFAULT_POPOVER_PADDING,
1107
+ strategy: "referenceHidden"
1108
+ })), ret;
1109
+ }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1110
+ x,
1111
+ y,
1112
+ middlewareData,
1113
+ placement,
1114
+ refs,
1115
+ strategy,
1116
+ update
1117
+ } = useFloating({
1118
+ middleware,
1119
+ placement: placementProp,
1120
+ whileElementsMounted: autoUpdate,
1121
+ elements: referenceElement ? {
1122
+ reference: referenceElement
1123
+ } : void 0
1124
+ }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = useCallback((arrowEl) => {
1125
+ arrowRef.current = arrowEl;
1126
+ }, []), setFloating = useCallback((node) => {
1127
+ ref.current = node, refs.setFloating(node);
1128
+ }, [refs]), setReference = useCallback((node_0) => {
1129
+ if (refs.setReference(node_0), !childProp) return;
1130
+ const childRef = getElementRef(childProp);
1131
+ typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
1132
+ }, [childProp, refs]), child = useMemo(() => referenceElement ? childProp : childProp ? cloneElement(childProp, {
1133
+ ref: setReference
1134
+ }) : null, [childProp, referenceElement, setReference]);
1135
+ if (useEffect(() => {
1136
+ updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
1137
+ }, [update, updateRef]), disabled)
1138
+ return childProp || /* @__PURE__ */ jsx(Fragment, {});
1139
+ const node_1 = /* @__PURE__ */ jsxs(Fragment, { children: [
1140
+ modal && /* @__PURE__ */ jsx(ViewportOverlay, {}),
1141
+ /* @__PURE__ */ jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: popover({
1142
+ className
1143
+ }), hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, x, y, zOffset, children: content2 })
1144
+ ] }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_1 }) }) : node_1);
1145
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1146
+ animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
1147
+ child
1148
+ ] });
1149
+ }
1150
+ const DEFAULT_SELECTABLE_ELEMENT = "button";
1151
+ function Selectable(props) {
1152
+ const $ = c(16), t0 = props;
1153
+ let className, radius, rest, selected, t1, tone;
1154
+ $[0] !== t0 ? ({
1155
+ as: t1,
1156
+ className,
1157
+ radius,
1158
+ selected,
1159
+ tone,
1160
+ ...rest
1161
+ } = t0, $[0] = t0, $[1] = className, $[2] = radius, $[3] = rest, $[4] = selected, $[5] = t1, $[6] = tone) : (className = $[1], radius = $[2], rest = $[3], selected = $[4], t1 = $[5], tone = $[6]);
1162
+ const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
1163
+ let t2;
1164
+ $[7] !== className || $[8] !== radius || $[9] !== tone ? (t2 = _selectable({
1165
+ className,
1166
+ radius,
1167
+ tone
1168
+ }), $[7] = className, $[8] = radius, $[9] = tone, $[10] = t2) : t2 = $[10];
1169
+ const t3 = selected ? "" : void 0;
1170
+ let t4;
1171
+ return $[11] !== as || $[12] !== rest || $[13] !== t2 || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { ...rest, as, className: t2, "data-selected": t3 }), $[11] = as, $[12] = rest, $[13] = t2, $[14] = t3, $[15] = t4) : t4 = $[15], t4;
1172
+ }
1173
+ const DEFAULT_STACK_ELEMENT = "div";
1174
+ function Stack(props) {
1175
+ const $ = c(12), t0 = props;
1176
+ let className, gap, rest, t1;
1177
+ $[0] !== t0 ? ({
1178
+ as: t1,
1179
+ className,
1180
+ gap,
1181
+ ...rest
1182
+ } = t0, $[0] = t0, $[1] = className, $[2] = gap, $[3] = rest, $[4] = t1) : (className = $[1], gap = $[2], rest = $[3], t1 = $[4]);
1183
+ const as = t1 === void 0 ? DEFAULT_STACK_ELEMENT : t1;
1184
+ let t2;
1185
+ $[5] !== className ? (t2 = stack({
1186
+ className
1187
+ }), $[5] = className, $[6] = t2) : t2 = $[6];
1188
+ let t3;
1189
+ return $[7] !== as || $[8] !== gap || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { "data-ui": "Stack", ...rest, as, gridAutoRows: "min", className: t2, display: "grid", gap }), $[7] = as, $[8] = gap, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
1190
+ }
1191
+ function useCustomValidity(ref, customValidity) {
1192
+ const $ = c(6);
1193
+ let t0;
1194
+ $[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
1195
+ ref.current?.setCustomValidity(customValidity || "");
1196
+ }, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
1197
+ let t1;
1198
+ $[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], useEffect(t0, t1);
1199
+ }
1200
+ const DEFAULT_TEXT_INPUT_ELEMENT = "input";
1201
+ function TextInput(props) {
1202
+ const $ = c(88), t0 = props;
1203
+ let IconComponent, IconRightComponent, __unstable_disableFocusRing, className, clearButton, customValidity, forwardedRef, onClear, prefix, readOnly, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, width;
1204
+ if ($[0] !== t0) {
1205
+ const {
1206
+ __unstable_disableFocusRing: t92,
1207
+ as: t102,
1208
+ border: t112,
1209
+ className: t122,
1210
+ clearButton: t132,
1211
+ disabled: t142,
1212
+ fontSize: t152,
1213
+ gap: t162,
1214
+ icon: t172,
1215
+ iconRight: t182,
1216
+ onClear: t192,
1217
+ padding: t202,
1218
+ prefix: t212,
1219
+ radius: t222,
1220
+ readOnly: t232,
1221
+ ref: t242,
1222
+ suffix: t252,
1223
+ customValidity: t262,
1224
+ type: t272,
1225
+ weight: _width,
1226
+ width: t282,
1227
+ ...t292
1228
+ } = t0;
1229
+ __unstable_disableFocusRing = t92, t1 = t102, t2 = t112, className = t122, clearButton = t132, t3 = t142, t4 = t152, t5 = t162, IconComponent = t172, IconRightComponent = t182, onClear = t192, t6 = t202, prefix = t212, t7 = t222, readOnly = t232, forwardedRef = t242, suffix = t252, customValidity = t262, t8 = t272, width = t282, rest = t292, $[0] = t0, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = __unstable_disableFocusRing, $[4] = className, $[5] = clearButton, $[6] = customValidity, $[7] = forwardedRef, $[8] = onClear, $[9] = prefix, $[10] = readOnly, $[11] = rest, $[12] = suffix, $[13] = t1, $[14] = t2, $[15] = t3, $[16] = t4, $[17] = t5, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = width;
1230
+ } else
1231
+ IconComponent = $[1], IconRightComponent = $[2], __unstable_disableFocusRing = $[3], className = $[4], clearButton = $[5], customValidity = $[6], forwardedRef = $[7], onClear = $[8], prefix = $[9], readOnly = $[10], rest = $[11], suffix = $[12], t1 = $[13], t2 = $[14], t3 = $[15], t4 = $[16], t5 = $[17], t6 = $[18], t7 = $[19], t8 = $[20], width = $[21];
1232
+ const Element2 = t1 === void 0 ? DEFAULT_TEXT_INPUT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, disabled = t3 === void 0 ? !1 : t3, fontSize = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, padding = t6 === void 0 ? 3 : t6, radius = t7 === void 0 ? 2 : t7, type = t8 === void 0 ? "text" : t8, ref = useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
1233
+ let t9;
1234
+ $[22] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[22] = t9) : t9 = $[22], useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
1235
+ const handleClearMouseDown = _temp$8;
1236
+ let t10;
1237
+ $[23] !== onClear ? (t10 = (event_0) => {
1238
+ event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
1239
+ }, $[23] = onClear, $[24] = t10) : t10 = $[24];
1240
+ const handleClearClick = t10;
1241
+ let t11, t12;
1242
+ $[25] !== responsivePadding ? (t12 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$1)), $[25] = responsivePadding, $[26] = t12) : t12 = $[26], t11 = t12;
1243
+ const clearButtonBoxPadding = t11;
1244
+ let t13, t14;
1245
+ $[27] !== responsivePadding ? (t14 = Object.fromEntries(Object.entries(responsivePadding).map(_temp3)), $[27] = responsivePadding, $[28] = t14) : t14 = $[28], t13 = t14;
1246
+ const clearButtonPadding = t13;
1247
+ let t15;
1248
+ t15 = isRecord(clearButton) ? clearButton : EMPTY_RECORD;
1249
+ const clearButtonProps = t15;
1250
+ let t16;
1251
+ $[29] !== border || $[30] !== className || $[31] !== fontSize || $[32] !== gap || $[33] !== padding || $[34] !== radius || $[35] !== width ? (t16 = textInput({
1252
+ className,
1253
+ border,
1254
+ fontSize,
1255
+ padding,
1256
+ radius,
1257
+ gap,
1258
+ width
1259
+ }), $[29] = border, $[30] = className, $[31] = fontSize, $[32] = gap, $[33] = padding, $[34] = radius, $[35] = width, $[36] = t16) : t16 = $[36];
1260
+ const t17 = IconComponent ? "" : void 0, t18 = IconRightComponent ? "" : void 0, t19 = customValidity ? "" : void 0, t20 = prefix ? "" : void 0, t21 = !disabled && readOnly ? "" : void 0, t22 = suffix ? "" : void 0;
1261
+ let t23;
1262
+ $[37] !== prefix ? (t23 = prefix && /* @__PURE__ */ jsx(Box, { className: textInputPrefix(), sizing: "border", children: /* @__PURE__ */ jsx("span", { children: prefix }) }), $[37] = prefix, $[38] = t23) : t23 = $[38];
1263
+ let t24;
1264
+ $[39] === Symbol.for("react.memo_cache_sentinel") ? (t24 = textInputElement(), $[39] = t24) : t24 = $[39];
1265
+ let t25;
1266
+ $[40] === Symbol.for("react.memo_cache_sentinel") ? (t25 = _inputElement(), $[40] = t25) : t25 = $[40];
1267
+ const t26 = __unstable_disableFocusRing ? "" : void 0;
1268
+ let t27;
1269
+ $[41] !== Element2 || $[42] !== disabled || $[43] !== readOnly || $[44] !== rest || $[45] !== t26 || $[46] !== type ? (t27 = /* @__PURE__ */ jsx(Element2, { ...rest, className: t25, "data-no-focus-ring": t26, disabled, readOnly, ref, type }), $[41] = Element2, $[42] = disabled, $[43] = readOnly, $[44] = rest, $[45] = t26, $[46] = type, $[47] = t27) : t27 = $[47];
1270
+ let t28;
1271
+ $[48] === Symbol.for("react.memo_cache_sentinel") ? (t28 = _inputPresentation(), $[48] = t28) : t28 = $[48];
1272
+ let t29;
1273
+ $[49] !== IconComponent || $[50] !== fontSize || $[51] !== padding ? (t29 = IconComponent && /* @__PURE__ */ jsx(Box, { padding, position: "absolute", insetTop: 0, insetLeft: 0, children: /* @__PURE__ */ jsxs(Text, { size: fontSize, children: [
1274
+ isValidElement(IconComponent) && IconComponent,
1275
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
1276
+ ] }) }), $[49] = IconComponent, $[50] = fontSize, $[51] = padding, $[52] = t29) : t29 = $[52];
1277
+ let t30;
1278
+ $[53] !== IconRightComponent || $[54] !== fontSize || $[55] !== padding || $[56] !== withClearButton ? (t30 = !withClearButton && IconRightComponent && /* @__PURE__ */ jsx(Box, { padding, position: "absolute", insetTop: 0, insetRight: 0, children: /* @__PURE__ */ jsxs(Text, { size: fontSize, children: [
1279
+ isValidElement(IconRightComponent) && IconRightComponent,
1280
+ isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
1281
+ ] }) }), $[53] = IconRightComponent, $[54] = fontSize, $[55] = padding, $[56] = withClearButton, $[57] = t30) : t30 = $[57];
1282
+ let t31;
1283
+ $[58] !== t29 || $[59] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Box, { className: t28, position: "absolute", children: [
1284
+ t29,
1285
+ t30
1286
+ ] }), $[58] = t29, $[59] = t30, $[60] = t31) : t31 = $[60];
1287
+ let t32;
1288
+ $[61] !== clearButton || $[62] !== clearButtonBoxPadding || $[63] !== clearButtonPadding || $[64] !== clearButtonProps || $[65] !== disabled || $[66] !== fontSize || $[67] !== handleClearClick || $[68] !== radius || $[69] !== readOnly ? (t32 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsx(Box, { insetTop: 0, insetRight: 0, padding: clearButtonBoxPadding, position: "absolute", style: {
1289
+ zIndex: 2
1290
+ }, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Clear", "data-qa": "clear-button", display: "block", fontSize, icon: CloseIcon, mode: "bleed", padding: clearButtonPadding, radius, ...clearButtonProps, onClick: handleClearClick, onMouseDown: handleClearMouseDown }) }), $[61] = clearButton, $[62] = clearButtonBoxPadding, $[63] = clearButtonPadding, $[64] = clearButtonProps, $[65] = disabled, $[66] = fontSize, $[67] = handleClearClick, $[68] = radius, $[69] = readOnly, $[70] = t32) : t32 = $[70];
1291
+ let t33;
1292
+ $[71] !== t27 || $[72] !== t31 || $[73] !== t32 ? (t33 = /* @__PURE__ */ jsxs(Box, { className: t24, flex: 1, position: "relative", children: [
1293
+ t27,
1294
+ t31,
1295
+ t32
1296
+ ] }), $[71] = t27, $[72] = t31, $[73] = t32, $[74] = t33) : t33 = $[74];
1297
+ let t34;
1298
+ $[75] !== suffix ? (t34 = suffix && /* @__PURE__ */ jsx(Box, { className: textInputSuffix(), sizing: "border", children: /* @__PURE__ */ jsx("span", { children: suffix }) }), $[75] = suffix, $[76] = t34) : t34 = $[76];
1299
+ let t35;
1300
+ return $[77] !== t16 || $[78] !== t17 || $[79] !== t18 || $[80] !== t19 || $[81] !== t20 || $[82] !== t21 || $[83] !== t22 || $[84] !== t23 || $[85] !== t33 || $[86] !== t34 ? (t35 = /* @__PURE__ */ jsxs(Box, { alignItems: "center", className: t16, "data-icon-left": t17, "data-icon-right": t18, "data-invalid": t19, "data-prefix": t20, "data-read-only": t21, "data-suffix": t22, "data-ui": "TextInput", display: "flex", children: [
1301
+ t23,
1302
+ t33,
1303
+ t34
1304
+ ] }), $[77] = t16, $[78] = t17, $[79] = t18, $[80] = t19, $[81] = t20, $[82] = t21, $[83] = t22, $[84] = t23, $[85] = t33, $[86] = t34, $[87] = t35) : t35 = $[87], t35;
1305
+ }
1306
+ function _temp3(t0) {
1307
+ const [key_0, value_0] = t0;
1308
+ return value_0 === 0 ? [key_0, 0] : value_0 === 1 ? [key_0, 0] : value_0 === 2 ? [key_0, 1] : [key_0, typeof value_0 == "number" ? value_0 - 1 : 0];
1309
+ }
1310
+ function _temp2$1(t0) {
1311
+ const [key2, value] = t0;
1312
+ return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
1313
+ }
1314
+ function _temp$8(event) {
1315
+ event.preventDefault(), event.stopPropagation();
1316
+ }
56
1317
  function AutocompleteOption(props) {
57
1318
  const $ = c(11), {
58
1319
  children,
@@ -137,7 +1398,7 @@ function Autocomplete(props) {
137
1398
  openOnFocus,
138
1399
  options: optionsProp,
139
1400
  padding: paddingProp = 3,
140
- popover = EMPTY_RECORD,
1401
+ popover: popover2 = EMPTY_RECORD,
141
1402
  prefix,
142
1403
  radius = 2,
143
1404
  readOnly,
@@ -289,7 +1550,7 @@ function Autocomplete(props) {
289
1550
  "aria-label": "Clear",
290
1551
  onFocus: handleClearButtonFocus
291
1552
  };
292
- }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = useMemo(() => Object.fromEntries(Object.entries(padding).map(([key, value_1]) => value_1 === 0 ? [key, 0] : value_1 === 1 ? [key, 1] : value_1 === 2 ? [key, 1] : [key, value_1 - 2])), [padding]), openButtonPadding = useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = useMemo(() => typeof openButton == "object" ? openButton : EMPTY_RECORD, [openButton]), handleOpenClick = useCallback((event_4) => {
1553
+ }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = useMemo(() => Object.fromEntries(Object.entries(padding).map(([key2, value_1]) => value_1 === 0 ? [key2, 0] : value_1 === 1 ? [key2, 1] : value_1 === 2 ? [key2, 1] : [key2, value_1 - 2])), [padding]), openButtonPadding = useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = useMemo(() => typeof openButton == "object" ? openButton : EMPTY_RECORD, [openButton]), handleOpenClick = useCallback((event_4) => {
293
1554
  dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
294
1555
  }, [openButtonProps, dispatchOpen]), openButtonNode = useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsx(Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsx(TextInput, { ...rest, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", as, border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: inputElementRef, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }), handleListBoxKeyDown = useCallback((event_5) => {
295
1556
  event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
@@ -306,7 +1567,7 @@ function Autocomplete(props) {
306
1567
  inputElement: inputElementRef.current,
307
1568
  onMouseEnter: handlePopoverMouseEnter,
308
1569
  onMouseLeave: handlePopoverMouseLeave
309
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, renderPopover]);
1570
+ }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsx(Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover2 }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover2, renderPopover]);
310
1571
  return (
311
1572
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
312
1573
  /* @__PURE__ */ jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
@@ -315,6 +1576,40 @@ function Autocomplete(props) {
315
1576
  ] })
316
1577
  );
317
1578
  }
1579
+ function useClickOutsideEvent(listener, t0, boundaryElement) {
1580
+ const $ = c(9), elementsArg = t0 === void 0 ? _temp$7 : t0;
1581
+ let t1;
1582
+ $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
1583
+ if (!listener)
1584
+ return;
1585
+ const target = evt.target;
1586
+ if (!(target instanceof Node))
1587
+ return;
1588
+ const resolvedBoundaryElement = boundaryElement?.();
1589
+ if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
1590
+ return;
1591
+ const elements = elementsArg().flat();
1592
+ for (const el of elements)
1593
+ if (el && (target === el || el.contains(target)))
1594
+ return;
1595
+ listener(evt);
1596
+ }, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
1597
+ const onEvent = useEffectEvent(t1), hasListener = !!listener;
1598
+ let t2;
1599
+ $[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
1600
+ if (!hasListener)
1601
+ return;
1602
+ const handleEvent = (evt_0) => onEvent(evt_0);
1603
+ return document.addEventListener("mousedown", handleEvent), () => {
1604
+ document.removeEventListener("mousedown", handleEvent);
1605
+ };
1606
+ }, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
1607
+ let t3;
1608
+ $[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
1609
+ }
1610
+ function _temp$7() {
1611
+ return EMPTY_ARRAY;
1612
+ }
318
1613
  const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
319
1614
  function Breadcrumbs(props) {
320
1615
  const {
@@ -340,7 +1635,7 @@ function Breadcrumbs(props) {
340
1635
  }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
341
1636
  return /* @__PURE__ */ jsx(Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: breadcrumbs({
342
1637
  className
343
- }), gap, gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
1638
+ }), gap, gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
344
1639
  itemIndex > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) }),
345
1640
  /* @__PURE__ */ jsx(Box, { as: "li", children: item })
346
1641
  ] }, itemIndex)) });
@@ -364,6 +1659,19 @@ function Container(props) {
364
1659
  let t4;
365
1660
  return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
366
1661
  }
1662
+ function useGlobalKeyDown(onKeyDown) {
1663
+ const $ = c(5);
1664
+ let t0;
1665
+ $[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
1666
+ const handleKeyDown = useEffectEvent(t0);
1667
+ let t1;
1668
+ $[2] !== handleKeyDown ? (t1 = () => {
1669
+ const handler = (event_0) => handleKeyDown(event_0);
1670
+ return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
1671
+ }, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
1672
+ let t2;
1673
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], useEffect(t1, t2);
1674
+ }
367
1675
  function isTargetWithinScope(boundaryElement, portalElement, target) {
368
1676
  return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
369
1677
  }
@@ -509,64 +1817,338 @@ function Dialog(props) {
509
1817
  focusFirstDescendant(cardElement);
510
1818
  return;
511
1819
  }
512
- isHTMLElement(event.target) && (focusedElementRef.current = event.target);
513
- }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
514
- const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = useRef(void 0);
515
- let t9;
516
- $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
517
- rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
518
- const activeElement = document.activeElement;
519
- if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
520
- const target_0 = focusedElementRef.current;
521
- if (!target_0 || !document.body.contains(target_0)) {
522
- const cardElement_0 = cardRef.current;
523
- cardElement_0 && focusFirstDescendant(cardElement_0);
524
- return;
1820
+ isHTMLElement(event.target) && (focusedElementRef.current = event.target);
1821
+ }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
1822
+ const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = useRef(void 0);
1823
+ let t9;
1824
+ $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
1825
+ rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
1826
+ const activeElement = document.activeElement;
1827
+ if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
1828
+ const target_0 = focusedElementRef.current;
1829
+ if (!target_0 || !document.body.contains(target_0)) {
1830
+ const cardElement_0 = cardRef.current;
1831
+ cardElement_0 && focusFirstDescendant(cardElement_0);
1832
+ return;
1833
+ }
1834
+ target_0.focus();
1835
+ }
1836
+ }, 0);
1837
+ }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
1838
+ const handleRootClick = t9;
1839
+ let t10;
1840
+ $[29] !== className ? (t10 = dialog({
1841
+ className
1842
+ }), $[29] = className, $[30] = t10) : t10 = $[30];
1843
+ const t11 = animate ? "" : void 0;
1844
+ let t12;
1845
+ $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
1846
+ let t13;
1847
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = dialogContainer(), $[32] = t13) : t13 = $[32];
1848
+ let t14;
1849
+ $[33] !== autoFocus || $[34] !== cardRadius || $[35] !== cardShadow || $[36] !== children || $[37] !== contentRef || $[38] !== footer || $[39] !== header || $[40] !== hideCloseButton || $[41] !== id || $[42] !== onClickOutside || $[43] !== onClose || $[44] !== portalProp || $[45] !== scheme || $[46] !== tone || $[47] !== width ? (t14 = /* @__PURE__ */ jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, tone, width, children }), $[33] = autoFocus, $[34] = cardRadius, $[35] = cardShadow, $[36] = children, $[37] = contentRef, $[38] = footer, $[39] = header, $[40] = hideCloseButton, $[41] = id, $[42] = onClickOutside, $[43] = onClose, $[44] = portalProp, $[45] = scheme, $[46] = tone, $[47] = width, $[48] = t14) : t14 = $[48];
1850
+ let t15;
1851
+ $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsx(Container, { alignItems: "center", className: t13, "data-ui": "DialogCard", flexDirection: "column", display: "flex", justifyContent: "center", width, children: t14 }), $[49] = t14, $[50] = width, $[51] = t15) : t15 = $[51];
1852
+ let t16;
1853
+ $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
1854
+ let t17;
1855
+ $[53] !== handleFocus || $[54] !== handleRootClick || $[55] !== id || $[56] !== labelId || $[57] !== onActivate || $[58] !== padding || $[59] !== position || $[60] !== rest || $[61] !== t10 || $[62] !== t11 || $[63] !== t15 || $[64] !== zOffset ? (t17 = /* @__PURE__ */ jsxs(Layer, { ...rest, "aria-labelledby": labelId, "aria-modal": !0, className: t10, "data-animate": t11, "data-ui": "Dialog", display: "flex", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, padding, position, role: "dialog", zOffset, children: [
1856
+ t12,
1857
+ t15,
1858
+ t16
1859
+ ] }), $[53] = handleFocus, $[54] = handleRootClick, $[55] = id, $[56] = labelId, $[57] = onActivate, $[58] = padding, $[59] = position, $[60] = rest, $[61] = t10, $[62] = t11, $[63] = t15, $[64] = zOffset, $[65] = t17) : t17 = $[65];
1860
+ let t18;
1861
+ return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
1862
+ }
1863
+ function DialogProvider(props) {
1864
+ const $ = c(6), {
1865
+ children,
1866
+ position,
1867
+ zOffset
1868
+ } = props;
1869
+ let t0, t1;
1870
+ $[0] !== position || $[1] !== zOffset ? (t1 = {
1871
+ version: 0,
1872
+ position,
1873
+ zOffset
1874
+ }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
1875
+ const contextValue = t0;
1876
+ let t2;
1877
+ return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
1878
+ }
1879
+ const DEFAULT_KBD_ELEMENT = "kbd";
1880
+ function KBD(props) {
1881
+ const $ = c(22), t0 = props;
1882
+ let children, className, rest, t1, t2, t3, t4, t5;
1883
+ $[0] !== t0 ? ({
1884
+ as: t1,
1885
+ children,
1886
+ className,
1887
+ display: t2,
1888
+ fontSize: t3,
1889
+ padding: t4,
1890
+ radius: t5,
1891
+ ...rest
1892
+ } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3, $[7] = t4, $[8] = t5) : (children = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6], t4 = $[7], t5 = $[8]);
1893
+ const as = t1 === void 0 ? DEFAULT_KBD_ELEMENT : t1, display = t2 === void 0 ? "inline-block" : t2, fontSize = t3 === void 0 ? 1 : t3, padding = t4 === void 0 ? 1 : t4, radius = t5 === void 0 ? 2 : t5, t6 = as;
1894
+ let t7;
1895
+ $[9] !== className || $[10] !== radius ? (t7 = kbd({
1896
+ className,
1897
+ radius
1898
+ }), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
1899
+ let t8;
1900
+ $[12] !== children || $[13] !== fontSize ? (t8 = /* @__PURE__ */ jsx(Text, { as: "span", muted: !0, size: fontSize, weight: "medium", children }), $[12] = children, $[13] = fontSize, $[14] = t8) : t8 = $[14];
1901
+ let t9;
1902
+ return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsx(Box, { "data-ui": "KBD", ...rest, as: t6, className: t7, display, muted: !0, padding, children: t8 }), $[15] = display, $[16] = padding, $[17] = rest, $[18] = t6, $[19] = t7, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
1903
+ }
1904
+ const DEFAULT_HOTKEYS_ELEMENT = "kbd";
1905
+ function Hotkeys(props) {
1906
+ const $ = c(26), t0 = props;
1907
+ let fontSize, gapX, gapY, keys, padding, radius, rest, t1, t2;
1908
+ $[0] !== t0 ? ({
1909
+ as: t1,
1910
+ fontSize,
1911
+ gap: t2,
1912
+ gapX,
1913
+ gapY,
1914
+ keys,
1915
+ padding,
1916
+ radius,
1917
+ ...rest
1918
+ } = t0, $[0] = t0, $[1] = fontSize, $[2] = gapX, $[3] = gapY, $[4] = keys, $[5] = padding, $[6] = radius, $[7] = rest, $[8] = t1, $[9] = t2) : (fontSize = $[1], gapX = $[2], gapY = $[3], keys = $[4], padding = $[5], radius = $[6], rest = $[7], t1 = $[8], t2 = $[9]);
1919
+ const as = t1 === void 0 ? DEFAULT_HOTKEYS_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2;
1920
+ if (!keys || keys.length === 0)
1921
+ return;
1922
+ let t3;
1923
+ if ($[10] !== fontSize || $[11] !== keys || $[12] !== padding || $[13] !== radius) {
1924
+ let t42;
1925
+ $[15] !== fontSize || $[16] !== padding || $[17] !== radius ? (t42 = (key2, i) => /* @__PURE__ */ jsx(KBD, { fontSize, padding, radius, children: key2 }, i), $[15] = fontSize, $[16] = padding, $[17] = radius, $[18] = t42) : t42 = $[18], t3 = keys.map(t42), $[10] = fontSize, $[11] = keys, $[12] = padding, $[13] = radius, $[14] = t3;
1926
+ } else
1927
+ t3 = $[14];
1928
+ let t4;
1929
+ return $[19] !== as || $[20] !== gap || $[21] !== gapX || $[22] !== gapY || $[23] !== rest || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { as, "data-ui": "Hotkeys", ...rest, display: "flex", gap, gapX, gapY, children: t3 }), $[19] = as, $[20] = gap, $[21] = gapX, $[22] = gapY, $[23] = rest, $[24] = t3, $[25] = t4) : t4 = $[25], t4;
1930
+ }
1931
+ const MenuContext = createGlobalScopedContext("@sanity/ui/v3/menu", null);
1932
+ function _isFocusable(element) {
1933
+ return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
1934
+ }
1935
+ function _getFocusableElements(elements) {
1936
+ return elements.filter(_isFocusable);
1937
+ }
1938
+ function _getDOMPath(rootElement, el) {
1939
+ const path = [];
1940
+ let e = el;
1941
+ for (; e !== rootElement; ) {
1942
+ const parentElement = e.parentElement;
1943
+ if (!parentElement) return path;
1944
+ const index = Array.from(parentElement.childNodes).indexOf(e);
1945
+ if (path.unshift(index), parentElement === rootElement)
1946
+ return path;
1947
+ e = parentElement;
1948
+ }
1949
+ return path;
1950
+ }
1951
+ const EMPTY_PATH = [];
1952
+ function _sortElements(rootElement, elements) {
1953
+ if (!rootElement) return;
1954
+ const map = /* @__PURE__ */ new WeakMap();
1955
+ for (const el of elements)
1956
+ map.set(el, _getDOMPath(rootElement, el));
1957
+ const _sort = (a, b) => {
1958
+ const _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
1959
+ for (let i = 0; i < len; i += 1) {
1960
+ const aIndex = _a[i] || -1, bIndex = _b[i] || -1;
1961
+ if (aIndex !== bIndex)
1962
+ return aIndex - bIndex;
1963
+ }
1964
+ return 0;
1965
+ };
1966
+ elements.sort(_sort);
1967
+ }
1968
+ function useMenuController(props) {
1969
+ const {
1970
+ onKeyDown,
1971
+ originElement,
1972
+ shouldFocus,
1973
+ rootElementRef
1974
+ } = props, elementsRef = useRef([]), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), activeElement = useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = useCallback((nextActiveIndex) => {
1975
+ _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
1976
+ }, []), mount = useCallback((element, selected) => {
1977
+ if (!element) return () => {
1978
+ };
1979
+ if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
1980
+ const selectedIndex = elementsRef.current.indexOf(element);
1981
+ setActiveIndex(selectedIndex);
1982
+ }
1983
+ return () => {
1984
+ const idx = elementsRef.current.indexOf(element);
1985
+ idx > -1 && elementsRef.current.splice(idx, 1);
1986
+ };
1987
+ }, [rootElementRef, setActiveIndex]), handleKeyDown = useCallback((event) => {
1988
+ if (event.key === "Tab") {
1989
+ originElement && originElement.focus();
1990
+ return;
1991
+ }
1992
+ if (event.key === "Home") {
1993
+ event.preventDefault(), event.stopPropagation();
1994
+ const el = _getFocusableElements(elementsRef.current)[0];
1995
+ if (!el) return;
1996
+ const currentIndex = elementsRef.current.indexOf(el);
1997
+ setActiveIndex(currentIndex);
1998
+ return;
1999
+ }
2000
+ if (event.key === "End") {
2001
+ event.preventDefault(), event.stopPropagation();
2002
+ const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
2003
+ if (!el_0) return;
2004
+ const currentIndex_0 = elementsRef.current.indexOf(el_0);
2005
+ setActiveIndex(currentIndex_0);
2006
+ return;
2007
+ }
2008
+ if (event.key === "ArrowUp") {
2009
+ event.preventDefault(), event.stopPropagation();
2010
+ const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
2011
+ if (focusableLen === 0) return;
2012
+ const focusedElement = elementsRef.current[activeIndexRef.current];
2013
+ let focusedIndex = focusableElements_1.indexOf(focusedElement);
2014
+ focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
2015
+ const el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
2016
+ setActiveIndex(currentIndex_1);
2017
+ return;
2018
+ }
2019
+ if (event.key === "ArrowDown") {
2020
+ event.preventDefault(), event.stopPropagation();
2021
+ const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
2022
+ if (focusableLen_0 === 0) return;
2023
+ const focusedElement_0 = elementsRef.current[activeIndexRef.current];
2024
+ let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
2025
+ focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
2026
+ const el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
2027
+ setActiveIndex(currentIndex_2);
2028
+ return;
2029
+ }
2030
+ onKeyDown && onKeyDown(event);
2031
+ }, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = useCallback((event_0) => {
2032
+ const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
2033
+ setActiveIndex(currentIndex_3);
2034
+ }, [setActiveIndex]), handleItemMouseLeave = useCallback(() => {
2035
+ setActiveIndex(-2), rootElementRef.current?.focus();
2036
+ }, [rootElementRef, setActiveIndex]);
2037
+ return useEffect(() => {
2038
+ if (!mounted) return;
2039
+ const rafId = requestAnimationFrame(() => {
2040
+ if (activeIndex === -1) {
2041
+ if (shouldFocus === "first") {
2042
+ const el_3 = _getFocusableElements(elementsRef.current)[0];
2043
+ if (el_3) {
2044
+ const currentIndex_4 = elementsRef.current.indexOf(el_3);
2045
+ setActiveIndex(currentIndex_4);
2046
+ }
525
2047
  }
526
- target_0.focus();
2048
+ if (shouldFocus === "last") {
2049
+ const focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
2050
+ if (el_4) {
2051
+ const currentIndex_5 = elementsRef.current.indexOf(el_4);
2052
+ setActiveIndex(currentIndex_5);
2053
+ }
2054
+ }
2055
+ return;
527
2056
  }
528
- }, 0);
529
- }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
530
- const handleRootClick = t9;
2057
+ (elementsRef.current[activeIndex] || null)?.focus();
2058
+ });
2059
+ return () => cancelAnimationFrame(rafId);
2060
+ }, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
2061
+ activeElement,
2062
+ activeIndex,
2063
+ handleItemMouseEnter,
2064
+ handleItemMouseLeave,
2065
+ handleKeyDown,
2066
+ mount
2067
+ };
2068
+ }
2069
+ const DEFAULT_MENU_ELEMENT = "div";
2070
+ function Menu(props) {
2071
+ const $ = c(57), t0 = props;
2072
+ let _shouldFocus, children, className, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
2073
+ $[0] !== t0 ? ({
2074
+ as: t1,
2075
+ children,
2076
+ className,
2077
+ gap: t2,
2078
+ onClickOutside,
2079
+ onEscape,
2080
+ onItemClick,
2081
+ onItemSelect,
2082
+ onKeyDown,
2083
+ originElement,
2084
+ padding: t3,
2085
+ ref: forwardedRef,
2086
+ registerElement,
2087
+ shouldFocus: _shouldFocus,
2088
+ ...rest
2089
+ } = t0, $[0] = t0, $[1] = _shouldFocus, $[2] = children, $[3] = className, $[4] = forwardedRef, $[5] = onClickOutside, $[6] = onEscape, $[7] = onItemClick, $[8] = onItemSelect, $[9] = onKeyDown, $[10] = originElement, $[11] = registerElement, $[12] = rest, $[13] = t1, $[14] = t2, $[15] = t3) : (_shouldFocus = $[1], children = $[2], className = $[3], forwardedRef = $[4], onClickOutside = $[5], onEscape = $[6], onItemClick = $[7], onItemSelect = $[8], onKeyDown = $[9], originElement = $[10], registerElement = $[11], rest = $[12], t1 = $[13], t2 = $[14], t3 = $[15]);
2090
+ const as = t1 === void 0 ? DEFAULT_MENU_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 1 : t3, shouldFocus = _shouldFocus ?? null, ref = useRef(null);
2091
+ let t4;
2092
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[16] = t4) : t4 = $[16], useImperativeHandle(forwardedRef, t4);
2093
+ const {
2094
+ isTopLayer
2095
+ } = useLayer();
2096
+ let t5;
2097
+ $[17] !== onKeyDown || $[18] !== originElement || $[19] !== shouldFocus ? (t5 = {
2098
+ onKeyDown,
2099
+ originElement,
2100
+ shouldFocus,
2101
+ rootElementRef: ref
2102
+ }, $[17] = onKeyDown, $[18] = originElement, $[19] = shouldFocus, $[20] = t5) : t5 = $[20];
2103
+ const {
2104
+ activeElement,
2105
+ activeIndex,
2106
+ handleItemMouseEnter,
2107
+ handleItemMouseLeave,
2108
+ handleKeyDown,
2109
+ mount
2110
+ } = useMenuController(t5), unregisterElementRef = useRef(null);
2111
+ let t6;
2112
+ $[21] !== registerElement ? (t6 = (el) => {
2113
+ unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
2114
+ }, $[21] = registerElement, $[22] = t6) : t6 = $[22];
2115
+ const handleRefChange = t6;
2116
+ let t7, t8;
2117
+ $[23] !== activeIndex || $[24] !== onItemSelect ? (t7 = () => {
2118
+ onItemSelect && onItemSelect(activeIndex);
2119
+ }, t8 = [activeIndex, onItemSelect], $[23] = activeIndex, $[24] = onItemSelect, $[25] = t7, $[26] = t8) : (t7 = $[25], t8 = $[26]), useEffect(t7, t8);
2120
+ let t9;
2121
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => [ref.current], $[27] = t9) : t9 = $[27], useClickOutsideEvent(isTopLayer && onClickOutside, t9);
531
2122
  let t10;
532
- $[29] !== className ? (t10 = dialog({
533
- className
534
- }), $[29] = className, $[30] = t10) : t10 = $[30];
535
- const t11 = animate ? "" : void 0;
536
- let t12;
537
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
2123
+ $[28] !== isTopLayer || $[29] !== onEscape ? (t10 = (event) => {
2124
+ isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
2125
+ }, $[28] = isTopLayer, $[29] = onEscape, $[30] = t10) : t10 = $[30], useGlobalKeyDown(t10);
2126
+ let t11, t12;
2127
+ $[31] !== activeElement || $[32] !== activeIndex || $[33] !== handleItemMouseEnter || $[34] !== handleItemMouseLeave || $[35] !== mount || $[36] !== onClickOutside || $[37] !== onEscape || $[38] !== onItemClick || $[39] !== registerElement ? (t12 = {
2128
+ version: 0,
2129
+ activeElement,
2130
+ activeIndex,
2131
+ mount,
2132
+ onClickOutside,
2133
+ onEscape,
2134
+ onItemClick,
2135
+ onItemMouseEnter: handleItemMouseEnter,
2136
+ onItemMouseLeave: handleItemMouseLeave,
2137
+ registerElement,
2138
+ onMouseEnter: handleItemMouseEnter,
2139
+ onMouseLeave: handleItemMouseLeave
2140
+ }, $[31] = activeElement, $[32] = activeIndex, $[33] = handleItemMouseEnter, $[34] = handleItemMouseLeave, $[35] = mount, $[36] = onClickOutside, $[37] = onEscape, $[38] = onItemClick, $[39] = registerElement, $[40] = t12) : t12 = $[40], t11 = t12;
2141
+ const value = t11;
538
2142
  let t13;
539
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = dialogContainer(), $[32] = t13) : t13 = $[32];
2143
+ $[41] !== className ? (t13 = menu({
2144
+ className
2145
+ }), $[41] = className, $[42] = t13) : t13 = $[42];
540
2146
  let t14;
541
- $[33] !== autoFocus || $[34] !== cardRadius || $[35] !== cardShadow || $[36] !== children || $[37] !== contentRef || $[38] !== footer || $[39] !== header || $[40] !== hideCloseButton || $[41] !== id || $[42] !== onClickOutside || $[43] !== onClose || $[44] !== portalProp || $[45] !== scheme || $[46] !== tone || $[47] !== width ? (t14 = /* @__PURE__ */ jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, tone, width, children }), $[33] = autoFocus, $[34] = cardRadius, $[35] = cardShadow, $[36] = children, $[37] = contentRef, $[38] = footer, $[39] = header, $[40] = hideCloseButton, $[41] = id, $[42] = onClickOutside, $[43] = onClose, $[44] = portalProp, $[45] = scheme, $[46] = tone, $[47] = width, $[48] = t14) : t14 = $[48];
2147
+ $[43] !== children || $[44] !== gap ? (t14 = /* @__PURE__ */ jsx(Stack, { gap, children }), $[43] = children, $[44] = gap, $[45] = t14) : t14 = $[45];
542
2148
  let t15;
543
- $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsx(Container, { alignItems: "center", className: t13, "data-ui": "DialogCard", flexDirection: "column", display: "flex", justifyContent: "center", width, children: t14 }), $[49] = t14, $[50] = width, $[51] = t15) : t15 = $[51];
2149
+ $[46] !== as || $[47] !== handleKeyDown || $[48] !== handleRefChange || $[49] !== padding || $[50] !== rest || $[51] !== t13 || $[52] !== t14 ? (t15 = /* @__PURE__ */ jsx(Box, { "data-ui": "Menu", ...rest, as, className: t13, onKeyDown: handleKeyDown, overflow: "auto", outline: "none", padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t14 }), $[46] = as, $[47] = handleKeyDown, $[48] = handleRefChange, $[49] = padding, $[50] = rest, $[51] = t13, $[52] = t14, $[53] = t15) : t15 = $[53];
544
2150
  let t16;
545
- $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
546
- let t17;
547
- $[53] !== handleFocus || $[54] !== handleRootClick || $[55] !== id || $[56] !== labelId || $[57] !== onActivate || $[58] !== padding || $[59] !== position || $[60] !== rest || $[61] !== t10 || $[62] !== t11 || $[63] !== t15 || $[64] !== zOffset ? (t17 = /* @__PURE__ */ jsxs(Layer, { ...rest, "aria-labelledby": labelId, "aria-modal": !0, className: t10, "data-animate": t11, "data-ui": "Dialog", display: "flex", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, padding, position, role: "dialog", zOffset, children: [
548
- t12,
549
- t15,
550
- t16
551
- ] }), $[53] = handleFocus, $[54] = handleRootClick, $[55] = id, $[56] = labelId, $[57] = onActivate, $[58] = padding, $[59] = position, $[60] = rest, $[61] = t10, $[62] = t11, $[63] = t15, $[64] = zOffset, $[65] = t17) : t17 = $[65];
552
- let t18;
553
- return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
554
- }
555
- function DialogProvider(props) {
556
- const $ = c(6), {
557
- children,
558
- position,
559
- zOffset
560
- } = props;
561
- let t0, t1;
562
- $[0] !== position || $[1] !== zOffset ? (t1 = {
563
- version: 0,
564
- position,
565
- zOffset
566
- }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
567
- const contextValue = t0;
568
- let t2;
569
- return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
2151
+ return $[54] !== t15 || $[55] !== value ? (t16 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t15 }), $[54] = t15, $[55] = value, $[56] = t16) : t16 = $[56], t16;
570
2152
  }
571
2153
  function MenuButton(props) {
572
2154
  const $ = c(57), {
@@ -576,7 +2158,7 @@ function MenuButton(props) {
576
2158
  menu: menuProp,
577
2159
  onClose,
578
2160
  onOpen,
579
- popover,
2161
+ popover: popover2,
580
2162
  ref: forwardedRef
581
2163
  } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null);
582
2164
  let t1;
@@ -596,7 +2178,7 @@ function MenuButton(props) {
596
2178
  }, t7 = [open], $[9] = open, $[10] = t6, $[11] = t7) : (t6 = $[10], t7 = $[11]), useEffect(t6, t7);
597
2179
  let t8;
598
2180
  $[12] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => {
599
- setOpen(_temp$4), setShouldFocus(null);
2181
+ setOpen(_temp$6), setShouldFocus(null);
600
2182
  }, $[12] = t8) : t8 = $[12];
601
2183
  const handleButtonClick = t8;
602
2184
  let t9;
@@ -662,7 +2244,7 @@ function MenuButton(props) {
662
2244
  registerElement,
663
2245
  shouldFocus
664
2246
  }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t16) : t16 = $[36];
665
- const menu = t16;
2247
+ const menu2 = t16;
666
2248
  let t17;
667
2249
  bb0: {
668
2250
  if (!buttonProp) {
@@ -683,11 +2265,11 @@ function MenuButton(props) {
683
2265
  selected: t182
684
2266
  }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t182, $[42] = t192) : t192 = $[42], t17 = t192;
685
2267
  }
686
- const button = t17;
2268
+ const button2 = t17;
687
2269
  let t18, t19;
688
2270
  $[43] !== buttonElement ? (t18 = () => buttonElement, t19 = [buttonElement], $[43] = buttonElement, $[44] = t18, $[45] = t19) : (t18 = $[44], t19 = $[45]), useImperativeHandle(forwardedRef, t18, t19);
689
2271
  let t20, t21;
690
- $[46] !== popover ? (t21 = popover || {}, $[46] = popover, $[47] = t21) : t21 = $[47];
2272
+ $[46] !== popover2 ? (t21 = popover2 || {}, $[46] = popover2, $[47] = t21) : t21 = $[47];
691
2273
  let t22;
692
2274
  $[48] !== t21 ? (t22 = {
693
2275
  overflow: "auto",
@@ -695,13 +2277,303 @@ function MenuButton(props) {
695
2277
  }, $[48] = t21, $[49] = t22) : t22 = $[49], t20 = t22;
696
2278
  const popoverProps = t20;
697
2279
  let t23;
698
- $[50] !== button ? (t23 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[50] = button, $[51] = t23) : t23 = $[51];
2280
+ $[50] !== button2 ? (t23 = button2 || /* @__PURE__ */ jsx(Fragment, {}), $[50] = button2, $[51] = t23) : t23 = $[51];
699
2281
  let t24;
700
- return $[52] !== menu || $[53] !== open || $[54] !== popoverProps || $[55] !== t23 ? (t24 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[52] = menu, $[53] = open, $[54] = popoverProps, $[55] = t23, $[56] = t24) : t24 = $[56], t24;
2282
+ return $[52] !== menu2 || $[53] !== open || $[54] !== popoverProps || $[55] !== t23 ? (t24 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu2, open, children: t23 }), $[52] = menu2, $[53] = open, $[54] = popoverProps, $[55] = t23, $[56] = t24) : t24 = $[56], t24;
701
2283
  }
702
- function _temp$4(v) {
2284
+ function _temp$6(v) {
703
2285
  return !v;
704
2286
  }
2287
+ const DEFAULT_MENU_DIVIDER_ELEMENT = "hr";
2288
+ function MenuDivider(props) {
2289
+ const $ = c(10), t0 = props;
2290
+ let className, rest, t1;
2291
+ $[0] !== t0 ? ({
2292
+ as: t1,
2293
+ className,
2294
+ ...rest
2295
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
2296
+ const Element2 = t1 === void 0 ? DEFAULT_MENU_DIVIDER_ELEMENT : t1;
2297
+ let t2;
2298
+ $[4] !== className ? (t2 = menuDivider({
2299
+ className
2300
+ }), $[4] = className, $[5] = t2) : t2 = $[5];
2301
+ let t3;
2302
+ return $[6] !== Element2 || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(Element2, { ...rest, className: t2 }), $[6] = Element2, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2303
+ }
2304
+ function useMenu() {
2305
+ const value = useContext(MenuContext);
2306
+ if (!value)
2307
+ throw new Error("useMenu(): missing context value");
2308
+ if (!isRecord(value) || value.version !== 0)
2309
+ throw new Error("useMenu(): the context value is not compatible");
2310
+ return value;
2311
+ }
2312
+ const DEFAULT_MENU_GROUP_ELEMENT = "button";
2313
+ function MenuGroup(props) {
2314
+ const $ = c(77), t0 = props;
2315
+ let IconComponent, children, menuProps, onClick, popover2, rest, t1, t2, t3, t4, t5, t6, text2;
2316
+ $[0] !== t0 ? ({
2317
+ as: t1,
2318
+ children,
2319
+ fontSize: t2,
2320
+ gap: t3,
2321
+ icon: IconComponent,
2322
+ menu: menuProps,
2323
+ onClick,
2324
+ padding: t4,
2325
+ popover: popover2,
2326
+ radius: t5,
2327
+ text: text2,
2328
+ tone: t6,
2329
+ ...rest
2330
+ } = t0, $[0] = t0, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover2, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6, $[13] = text2) : (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover2 = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12], text2 = $[13]);
2331
+ const as = t1 === void 0 ? DEFAULT_MENU_GROUP_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, gap = t3 === void 0 ? 3 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 2 : t5, tone = t6 === void 0 ? "default" : t6, {
2332
+ activeElement,
2333
+ mount,
2334
+ onClickOutside,
2335
+ onEscape,
2336
+ onItemClick,
2337
+ onItemMouseEnter,
2338
+ registerElement
2339
+ } = useMenu(), [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1);
2340
+ let t7;
2341
+ $[14] !== onItemMouseEnter ? (t7 = (event) => {
2342
+ setWithinMenu(!1), onItemMouseEnter?.(event), setOpen(!0);
2343
+ }, $[14] = onItemMouseEnter, $[15] = t7) : t7 = $[15];
2344
+ const handleMouseEnter = t7;
2345
+ let t8;
2346
+ $[16] !== rootElement ? (t8 = (event_0) => {
2347
+ event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
2348
+ rootElement?.focus();
2349
+ }));
2350
+ }, $[16] = rootElement, $[17] = t8) : t8 = $[17];
2351
+ const handleMenuKeyDown = t8;
2352
+ let t9;
2353
+ $[18] !== onClick ? (t9 = (event_1) => {
2354
+ onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
2355
+ }, $[18] = onClick, $[19] = t9) : t9 = $[19];
2356
+ const handleClick = t9;
2357
+ let t10;
2358
+ $[20] !== onItemClick ? (t10 = () => {
2359
+ setOpen(!1), onItemClick?.();
2360
+ }, $[20] = onItemClick, $[21] = t10) : t10 = $[21];
2361
+ const handleChildItemClick = t10;
2362
+ let t11;
2363
+ $[22] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => setWithinMenu(!0), $[22] = t11) : t11 = $[22];
2364
+ const handleMenuMouseEnter = t11;
2365
+ let t12, t13;
2366
+ $[23] !== mount || $[24] !== rootElement ? (t12 = () => mount(rootElement), t13 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t12, $[26] = t13) : (t12 = $[25], t13 = $[26]), useEffect(t12, t13);
2367
+ let t14, t15;
2368
+ $[27] !== active ? (t14 = () => {
2369
+ active || setOpen(!1);
2370
+ }, t15 = [active], $[27] = active, $[28] = t14, $[29] = t15) : (t14 = $[28], t15 = $[29]), useEffect(t14, t15);
2371
+ let t16, t17;
2372
+ $[30] !== open ? (t16 = () => {
2373
+ open || setWithinMenu(!1);
2374
+ }, t17 = [open], $[30] = open, $[31] = t16, $[32] = t17) : (t16 = $[31], t17 = $[32]), useEffect(t16, t17);
2375
+ let t18, t19;
2376
+ $[33] !== shouldFocus ? (t18 = () => {
2377
+ if (!shouldFocus)
2378
+ return;
2379
+ const rafId = requestAnimationFrame(() => setShouldFocus(null));
2380
+ return () => cancelAnimationFrame(rafId);
2381
+ }, t19 = [shouldFocus], $[33] = shouldFocus, $[34] = t18, $[35] = t19) : (t18 = $[34], t19 = $[35]), useEffect(t18, t19);
2382
+ let t20;
2383
+ $[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t20 = /* @__PURE__ */ jsx(Menu, { ...menuProps, onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), $[36] = children, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = menuProps, $[40] = onClickOutside, $[41] = onEscape, $[42] = registerElement, $[43] = shouldFocus, $[44] = t20) : t20 = $[44];
2384
+ const childMenu = t20;
2385
+ let t21;
2386
+ $[45] === Symbol.for("react.memo_cache_sentinel") ? (t21 = (event_2) => {
2387
+ const target = event_2.currentTarget;
2388
+ if (document.activeElement === target && event_2.key === "ArrowRight") {
2389
+ setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
2390
+ return;
2391
+ }
2392
+ }, $[45] = t21) : t21 = $[45];
2393
+ const handleKeyDown = t21, t22 = as === "button" ? withinMenu : void 0, t23 = as === "button" ? "button" : void 0;
2394
+ let t24;
2395
+ $[46] !== IconComponent || $[47] !== fontSize ? (t24 = IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize, children: [
2396
+ isValidElement(IconComponent) && IconComponent,
2397
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
2398
+ ] }), $[46] = IconComponent, $[47] = fontSize, $[48] = t24) : t24 = $[48];
2399
+ let t25;
2400
+ $[49] !== fontSize || $[50] !== text2 ? (t25 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text2 }) }), $[49] = fontSize, $[50] = text2, $[51] = t25) : t25 = $[51];
2401
+ let t26;
2402
+ $[52] === Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[52] = t26) : t26 = $[52];
2403
+ let t27;
2404
+ $[53] !== fontSize ? (t27 = /* @__PURE__ */ jsx(Text, { size: fontSize, children: t26 }), $[53] = fontSize, $[54] = t27) : t27 = $[54];
2405
+ let t28;
2406
+ $[55] !== gap || $[56] !== padding || $[57] !== t24 || $[58] !== t25 || $[59] !== t27 ? (t28 = /* @__PURE__ */ jsxs(Flex, { gap, padding, children: [
2407
+ t24,
2408
+ t25,
2409
+ t27
2410
+ ] }), $[55] = gap, $[56] = padding, $[57] = t24, $[58] = t25, $[59] = t27, $[60] = t28) : t28 = $[60];
2411
+ let t29;
2412
+ $[61] !== as || $[62] !== handleClick || $[63] !== handleMouseEnter || $[64] !== radius || $[65] !== rest || $[66] !== t22 || $[67] !== t23 || $[68] !== t28 || $[69] !== tone || $[70] !== withinMenu ? (t29 = /* @__PURE__ */ jsx(Selectable, { "data-ui": "MenuGroup", ...rest, "aria-pressed": t22, as, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, radius, ref: setRootElement, selected: withinMenu, tabIndex: -1, tone, type: t23, children: t28 }), $[61] = as, $[62] = handleClick, $[63] = handleMouseEnter, $[64] = radius, $[65] = rest, $[66] = t22, $[67] = t23, $[68] = t28, $[69] = tone, $[70] = withinMenu, $[71] = t29) : t29 = $[71];
2413
+ let t30;
2414
+ return $[72] !== childMenu || $[73] !== open || $[74] !== popover2 || $[75] !== t29 ? (t30 = /* @__PURE__ */ jsx(Popover, { ...popover2, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t29 }), $[72] = childMenu, $[73] = open, $[74] = popover2, $[75] = t29, $[76] = t30) : t30 = $[76], t30;
2415
+ }
2416
+ const DEFAULT_MENU_ITEM_ELEMENT = "button";
2417
+ function MenuItem(props) {
2418
+ const $ = c(73), t0 = props;
2419
+ let IconComponent, IconRightComponent, children, disabled, forwardedRef, gapX, gapY, hotkeys, onClick, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, pressed, rest, selectedProp, t1, t2, t3, t4, t5, t6, text2;
2420
+ $[0] !== t0 ? ({
2421
+ as: t1,
2422
+ children,
2423
+ disabled,
2424
+ fontSize: t2,
2425
+ gap: t3,
2426
+ gapX,
2427
+ gapY,
2428
+ hotkeys,
2429
+ icon: IconComponent,
2430
+ iconRight: IconRightComponent,
2431
+ onClick,
2432
+ padding: t4,
2433
+ paddingX,
2434
+ paddingY,
2435
+ paddingTop,
2436
+ paddingRight,
2437
+ paddingBottom,
2438
+ paddingLeft,
2439
+ pressed,
2440
+ radius: t5,
2441
+ ref: forwardedRef,
2442
+ selected: selectedProp,
2443
+ text: text2,
2444
+ tone: t6,
2445
+ ...rest
2446
+ } = t0, $[0] = t0, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = forwardedRef, $[6] = gapX, $[7] = gapY, $[8] = hotkeys, $[9] = onClick, $[10] = paddingBottom, $[11] = paddingLeft, $[12] = paddingRight, $[13] = paddingTop, $[14] = paddingX, $[15] = paddingY, $[16] = pressed, $[17] = rest, $[18] = selectedProp, $[19] = t1, $[20] = t2, $[21] = t3, $[22] = t4, $[23] = t5, $[24] = t6, $[25] = text2) : (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], forwardedRef = $[5], gapX = $[6], gapY = $[7], hotkeys = $[8], onClick = $[9], paddingBottom = $[10], paddingLeft = $[11], paddingRight = $[12], paddingTop = $[13], paddingX = $[14], paddingY = $[15], pressed = $[16], rest = $[17], selectedProp = $[18], t1 = $[19], t2 = $[20], t3 = $[21], t4 = $[22], t5 = $[23], t6 = $[24], text2 = $[25]);
2447
+ const as = t1 === void 0 ? DEFAULT_MENU_ITEM_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, gap = t3 === void 0 ? 3 : t3, padding = t4 === void 0 ? 3 : t4, radius = t5 === void 0 ? 2 : t5, tone = t6 === void 0 ? "default" : t6, menu2 = useMenu(), {
2448
+ activeElement,
2449
+ mount,
2450
+ onItemClick,
2451
+ onItemMouseEnter,
2452
+ onItemMouseLeave
2453
+ } = menu2, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
2454
+ let t7;
2455
+ $[26] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[26] = t7) : t7 = $[26], useImperativeHandle(forwardedRef, t7);
2456
+ let t8, t9;
2457
+ $[27] !== mount || $[28] !== rootElement || $[29] !== selectedProp ? (t8 = () => mount(rootElement, selectedProp), t9 = [mount, rootElement, selectedProp], $[27] = mount, $[28] = rootElement, $[29] = selectedProp, $[30] = t8, $[31] = t9) : (t8 = $[30], t9 = $[31]), useEffect(t8, t9);
2458
+ let t10;
2459
+ $[32] !== disabled || $[33] !== onClick || $[34] !== onItemClick ? (t10 = (event) => {
2460
+ disabled || (onClick && onClick(event), onItemClick && onItemClick());
2461
+ }, $[32] = disabled, $[33] = onClick, $[34] = onItemClick, $[35] = t10) : t10 = $[35];
2462
+ const handleClick = t10;
2463
+ let t11, t12;
2464
+ $[36] !== padding || $[37] !== paddingBottom || $[38] !== paddingLeft || $[39] !== paddingRight || $[40] !== paddingTop || $[41] !== paddingX || $[42] !== paddingY ? (t12 = {
2465
+ padding,
2466
+ paddingX,
2467
+ paddingY,
2468
+ paddingTop,
2469
+ paddingRight,
2470
+ paddingBottom,
2471
+ paddingLeft
2472
+ }, $[36] = padding, $[37] = paddingBottom, $[38] = paddingLeft, $[39] = paddingRight, $[40] = paddingTop, $[41] = paddingX, $[42] = paddingY, $[43] = t12) : t12 = $[43], t11 = t12;
2473
+ const paddingProps = t11;
2474
+ let t13;
2475
+ $[44] === Symbol.for("react.memo_cache_sentinel") ? (t13 = (el) => {
2476
+ ref.current = el, setRootElement(el);
2477
+ }, $[44] = t13) : t13 = $[44];
2478
+ const setRef = t13, t14 = pressed ? "" : void 0, t15 = active ? "" : void 0, t16 = disabled ? "" : void 0, t17 = as === "button" ? "button" : void 0;
2479
+ let t18;
2480
+ $[45] !== IconComponent || $[46] !== IconRightComponent || $[47] !== fontSize || $[48] !== gap || $[49] !== gapX || $[50] !== gapY || $[51] !== hotkeys || $[52] !== paddingProps || $[53] !== text2 ? (t18 = (IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, { as: "span", gap, gapX, gapY, align: "center", ...paddingProps, children: [
2481
+ IconComponent && /* @__PURE__ */ jsxs(Text, { muted: !0, size: fontSize, children: [
2482
+ isValidElement(IconComponent) && IconComponent,
2483
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
2484
+ ] }),
2485
+ text2 && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text2 }) }),
2486
+ hotkeys && /* @__PURE__ */ jsx(Hotkeys, { keys: hotkeys, style: {
2487
+ marginTop: -4,
2488
+ marginBottom: -4
2489
+ } }),
2490
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, { muted: !0, size: fontSize, children: [
2491
+ isValidElement(IconRightComponent) && IconRightComponent,
2492
+ isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
2493
+ ] })
2494
+ ] }), $[45] = IconComponent, $[46] = IconRightComponent, $[47] = fontSize, $[48] = gap, $[49] = gapX, $[50] = gapY, $[51] = hotkeys, $[52] = paddingProps, $[53] = text2, $[54] = t18) : t18 = $[54];
2495
+ let t19;
2496
+ $[55] !== children || $[56] !== paddingProps ? (t19 = children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children }), $[55] = children, $[56] = paddingProps, $[57] = t19) : t19 = $[57];
2497
+ let t20;
2498
+ return $[58] !== as || $[59] !== disabled || $[60] !== handleClick || $[61] !== onItemMouseEnter || $[62] !== onItemMouseLeave || $[63] !== radius || $[64] !== rest || $[65] !== t14 || $[66] !== t15 || $[67] !== t16 || $[68] !== t17 || $[69] !== t18 || $[70] !== t19 || $[71] !== tone ? (t20 = /* @__PURE__ */ jsxs(Selectable, { "data-ui": "MenuItem", ...rest, as, "data-pressed": t14, "data-selected": t15, "data-disabled": t16, radius, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role: "menuitem", tabIndex: -1, tone, type: t17, children: [
2499
+ t18,
2500
+ t19
2501
+ ] }), $[58] = as, $[59] = disabled, $[60] = handleClick, $[61] = onItemMouseEnter, $[62] = onItemMouseLeave, $[63] = radius, $[64] = rest, $[65] = t14, $[66] = t15, $[67] = t16, $[68] = t17, $[69] = t18, $[70] = t19, $[71] = tone, $[72] = t20) : t20 = $[72], t20;
2502
+ }
2503
+ const DEFAULT_TAB_ELEMENT = "button";
2504
+ function Tab(props) {
2505
+ const $ = c(33), t0 = props;
2506
+ let focused, forwardedRef, icon, id, label2, onClick, onFocus, rest, selected, t1, t2, t3;
2507
+ $[0] !== t0 ? ({
2508
+ as: t1,
2509
+ icon,
2510
+ id,
2511
+ focused,
2512
+ fontSize: t2,
2513
+ label: label2,
2514
+ onClick,
2515
+ onFocus,
2516
+ padding: t3,
2517
+ ref: forwardedRef,
2518
+ selected,
2519
+ ...rest
2520
+ } = t0, $[0] = t0, $[1] = focused, $[2] = forwardedRef, $[3] = icon, $[4] = id, $[5] = label2, $[6] = onClick, $[7] = onFocus, $[8] = rest, $[9] = selected, $[10] = t1, $[11] = t2, $[12] = t3) : (focused = $[1], forwardedRef = $[2], icon = $[3], id = $[4], label2 = $[5], onClick = $[6], onFocus = $[7], rest = $[8], selected = $[9], t1 = $[10], t2 = $[11], t3 = $[12]);
2521
+ const as = t1 === void 0 ? DEFAULT_TAB_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 2 : t3, ref = useRef(null), focusedRef = useRef(!1);
2522
+ let t4;
2523
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[13] = t4) : t4 = $[13], useImperativeHandle(forwardedRef, t4);
2524
+ let t5;
2525
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
2526
+ focusedRef.current = !1;
2527
+ }, $[14] = t5) : t5 = $[14];
2528
+ const handleBlur = t5;
2529
+ let t6;
2530
+ $[15] !== onFocus ? (t6 = (event) => {
2531
+ focusedRef.current = !0, onFocus && onFocus(event);
2532
+ }, $[15] = onFocus, $[16] = t6) : t6 = $[16];
2533
+ const handleFocus = t6;
2534
+ let t7, t8;
2535
+ $[17] !== focused ? (t7 = () => {
2536
+ focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
2537
+ }, t8 = [focused], $[17] = focused, $[18] = t7, $[19] = t8) : (t7 = $[18], t8 = $[19]), useEffect(t7, t8);
2538
+ const t9 = selected ? "true" : "false", t10 = selected ? 0 : -1;
2539
+ let t11;
2540
+ return $[20] !== as || $[21] !== fontSize || $[22] !== handleFocus || $[23] !== icon || $[24] !== id || $[25] !== label2 || $[26] !== onClick || $[27] !== padding || $[28] !== rest || $[29] !== selected || $[30] !== t10 || $[31] !== t9 ? (t11 = /* @__PURE__ */ jsx(Button, { "data-ui": "Tab", ...rest, "aria-selected": t9, as, fontSize, icon, id, mode: "bleed", onClick, onBlur: handleBlur, onFocus: handleFocus, padding, ref, role: "tab", selected, tabIndex: t10, text: label2, type: "button" }), $[20] = as, $[21] = fontSize, $[22] = handleFocus, $[23] = icon, $[24] = id, $[25] = label2, $[26] = onClick, $[27] = padding, $[28] = rest, $[29] = selected, $[30] = t10, $[31] = t9, $[32] = t11) : t11 = $[32], t11;
2541
+ }
2542
+ const DEFAULT_TAB_LIST_ELEMENT = "div";
2543
+ function TabList(props) {
2544
+ const $ = c(20), t0 = props;
2545
+ let childrenProp, rest, t1, t2, t3;
2546
+ $[0] !== t0 ? ({
2547
+ as: t1,
2548
+ children: childrenProp,
2549
+ gap: t2,
2550
+ wrap: t3,
2551
+ ...rest
2552
+ } = t0, $[0] = t0, $[1] = childrenProp, $[2] = rest, $[3] = t1, $[4] = t2, $[5] = t3) : (childrenProp = $[1], rest = $[2], t1 = $[3], t2 = $[4], t3 = $[5]);
2553
+ const as = t1 === void 0 ? DEFAULT_TAB_LIST_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, wrap = t3 === void 0 ? "nowrap" : t3, [focusedIndex, setFocusedIndex] = useState(-1);
2554
+ let t4;
2555
+ if ($[6] !== childrenProp || $[7] !== focusedIndex) {
2556
+ const children = Children.toArray(childrenProp).filter(_isReactElement);
2557
+ let t52;
2558
+ $[9] !== focusedIndex ? (t52 = (child, childIndex) => cloneElement(child, {
2559
+ focused: focusedIndex === childIndex,
2560
+ key: childIndex,
2561
+ onFocus: () => setFocusedIndex(childIndex)
2562
+ }), $[9] = focusedIndex, $[10] = t52) : t52 = $[10], t4 = children.map(t52), $[6] = childrenProp, $[7] = focusedIndex, $[8] = t4;
2563
+ } else
2564
+ t4 = $[8];
2565
+ const tabs = t4, numTabs = tabs.length;
2566
+ let t5;
2567
+ $[11] !== numTabs ? (t5 = (event) => {
2568
+ event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
2569
+ }, $[11] = numTabs, $[12] = t5) : t5 = $[12];
2570
+ const handleKeyDown = t5;
2571
+ let t6;
2572
+ return $[13] !== as || $[14] !== gap || $[15] !== handleKeyDown || $[16] !== rest || $[17] !== tabs || $[18] !== wrap ? (t6 = /* @__PURE__ */ jsx(Flex, { "data-ui": "TabList", ...rest, as, gap, onKeyDown: handleKeyDown, role: "tablist", wrap, children: tabs }), $[13] = as, $[14] = gap, $[15] = handleKeyDown, $[16] = rest, $[17] = tabs, $[18] = wrap, $[19] = t6) : t6 = $[19], t6;
2573
+ }
2574
+ function _isReactElement(node) {
2575
+ return !!node;
2576
+ }
705
2577
  const DEFAULT_TAB_PANEL_ELEMENT = "div";
706
2578
  function TabPanel(props) {
707
2579
  const $ = c(10), t0 = props;
@@ -828,16 +2700,29 @@ const container = {
828
2700
  }
829
2701
  }, MotionCard = motion.create(Card), MotionFlex = motion.create(Flex), MotionText = motion.create(Text);
830
2702
  function useMounted() {
831
- return useSyncExternalStore(subscribe, _temp$3, _temp2);
2703
+ return useSyncExternalStore(subscribe, _temp$5, _temp2);
832
2704
  }
833
2705
  function _temp2() {
834
2706
  return !1;
835
2707
  }
836
- function _temp$3() {
2708
+ function _temp$5() {
837
2709
  return !0;
838
2710
  }
839
2711
  const subscribe = () => () => {
840
- }, ToastContext = createGlobalScopedContext("@sanity/ui/v3/toast", null), DEFAULT_TOAST_LAYER_ELEMENT = "ul";
2712
+ }, ToastContext = createGlobalScopedContext("@sanity/ui/v3/toast", null), DEFAULT_GRID_ELEMENT = "div";
2713
+ function Grid(props) {
2714
+ const $ = c(8), t0 = props;
2715
+ let children, rest, t1;
2716
+ $[0] !== t0 ? ({
2717
+ as: t1,
2718
+ children,
2719
+ ...rest
2720
+ } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
2721
+ const as = t1 === void 0 ? DEFAULT_GRID_ELEMENT : t1;
2722
+ let t2;
2723
+ return $[4] !== as || $[5] !== children || $[6] !== rest ? (t2 = /* @__PURE__ */ jsx(Box, { "data-ui": "Grid", ...rest, as, display: "grid", children }), $[4] = as, $[5] = children, $[6] = rest, $[7] = t2) : t2 = $[7], t2;
2724
+ }
2725
+ const DEFAULT_TOAST_LAYER_ELEMENT = "ul";
841
2726
  function ToastLayer(props) {
842
2727
  const $ = c(11), {
843
2728
  as: t0,
@@ -902,14 +2787,14 @@ function ToastProvider(props) {
902
2787
  }, $[1] = t3) : t3 = $[1], t2 = t3;
903
2788
  const value = t2;
904
2789
  let t4;
905
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp$2) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
2790
+ $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp$4) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
906
2791
  let t5;
907
2792
  return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
908
2793
  children,
909
2794
  t4
910
2795
  ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
911
2796
  }
912
- function _temp$2(t0) {
2797
+ function _temp$4(t0) {
913
2798
  const {
914
2799
  dismiss: dismiss_0,
915
2800
  id: id_0,
@@ -1170,7 +3055,7 @@ function TreeItem(props) {
1170
3055
  radius = 2,
1171
3056
  selected = !1,
1172
3057
  space = 2,
1173
- text,
3058
+ text: text2,
1174
3059
  weight,
1175
3060
  ...rest
1176
3061
  } = props, rootRef = useRef(null), treeitemRef = useRef(null), tree = useTree(), {
@@ -1203,7 +3088,7 @@ function TreeItem(props) {
1203
3088
  transform: expanded ? "rotate(90deg)" : void 0
1204
3089
  } }) })
1205
3090
  ] }),
1206
- /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
3091
+ /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text2 }) })
1207
3092
  ] });
1208
3093
  return href ? /* @__PURE__ */ jsxs(Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: treeItem({
1209
3094
  className
@@ -1343,7 +3228,7 @@ function VirtualList(props) {
1343
3228
  height: t17
1344
3229
  } }), $[33] = t17, $[34] = t18) : t18 = $[34];
1345
3230
  let t19;
1346
- $[35] !== t152 || $[36] !== t18 ? (t19 = [/* @__PURE__ */ jsxs(Fragment$1, { children: [
3231
+ $[35] !== t152 || $[36] !== t18 ? (t19 = [/* @__PURE__ */ jsxs(Fragment, { children: [
1347
3232
  t152,
1348
3233
  t18
1349
3234
  ] })], $[35] = t152, $[36] = t18, $[37] = t19) : t19 = $[37], t12 = t19;
@@ -1353,10 +3238,10 @@ function VirtualList(props) {
1353
3238
  if ($[38] !== fromIndex || $[39] !== gapValue || $[40] !== getItemKey || $[41] !== itemHeight || $[42] !== items || $[43] !== renderItem || $[44] !== toIndex) {
1354
3239
  let t142;
1355
3240
  $[46] !== fromIndex || $[47] !== gapValue || $[48] !== getItemKey || $[49] !== itemHeight || $[50] !== renderItem ? (t142 = (item, _itemIndex) => {
1356
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3241
+ const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
1357
3242
  return /* @__PURE__ */ jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
1358
3243
  top: itemIndex * (itemHeight + gapValue)
1359
- }, children: node }, key);
3244
+ }, children: node }, key2);
1360
3245
  }, $[46] = fromIndex, $[47] = gapValue, $[48] = getItemKey, $[49] = itemHeight, $[50] = renderItem, $[51] = t142) : t142 = $[51], t132 = items.slice(fromIndex, toIndex).map(t142), $[38] = fromIndex, $[39] = gapValue, $[40] = getItemKey, $[41] = itemHeight, $[42] = items, $[43] = renderItem, $[44] = toIndex, $[45] = t132;
1361
3246
  } else
1362
3247
  t132 = $[45];
@@ -1419,12 +3304,18 @@ function _createElementSizeObserver() {
1419
3304
  };
1420
3305
  }
1421
3306
  function useElementSize(element) {
1422
- const $ = c(3), [size, setSize] = useState(null);
3307
+ const $ = c(3), [size2, setSize] = useState(null);
1423
3308
  let t0, t1;
1424
3309
  return $[0] !== element ? (t0 = () => {
1425
3310
  if (element)
1426
3311
  return _elementSizeObserver.subscribe(element, setSize);
1427
- }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1), size;
3312
+ }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1), size2;
3313
+ }
3314
+ function usePrefersDark(t0) {
3315
+ return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$3 : t0);
3316
+ }
3317
+ function _temp$3() {
3318
+ return !1;
1428
3319
  }
1429
3320
  const DEFAULT_LABEL_ELEMENT = "div";
1430
3321
  function Label(props) {
@@ -1441,15 +3332,15 @@ function Label(props) {
1441
3332
  weight: t3,
1442
3333
  ...rest
1443
3334
  } = props, $[0] = props, $[1] = align, $[2] = children, $[3] = className, $[4] = rest, $[5] = t0, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], rest = $[4], t0 = $[5], t1 = $[6], t2 = $[7], t3 = $[8], textOverflowProp = $[9]);
1444
- const Element2 = t0 === void 0 ? DEFAULT_LABEL_ELEMENT : t0, muted = t1 === void 0 ? !1 : t1, size = t2 === void 0 ? 1 : t2, weight = t3 === void 0 ? "regular" : t3;
3335
+ const Element2 = t0 === void 0 ? DEFAULT_LABEL_ELEMENT : t0, muted = t1 === void 0 ? !1 : t1, size2 = t2 === void 0 ? 1 : t2, weight = t3 === void 0 ? "regular" : t3;
1445
3336
  let t4;
1446
- $[10] !== align || $[11] !== className || $[12] !== muted || $[13] !== size || $[14] !== weight ? (t4 = label({
3337
+ $[10] !== align || $[11] !== className || $[12] !== muted || $[13] !== size2 || $[14] !== weight ? (t4 = label({
1447
3338
  className,
1448
3339
  align,
1449
3340
  muted,
1450
- size,
3341
+ size: size2,
1451
3342
  weight
1452
- }), $[10] = align, $[11] = className, $[12] = muted, $[13] = size, $[14] = weight, $[15] = t4) : t4 = $[15];
3343
+ }), $[10] = align, $[11] = className, $[12] = muted, $[13] = size2, $[14] = weight, $[15] = t4) : t4 = $[15];
1453
3344
  let t5;
1454
3345
  $[16] !== textOverflowProp ? (t5 = textOverflow({
1455
3346
  textOverflow: textOverflowProp
@@ -1477,7 +3368,7 @@ function Avatar(props) {
1477
3368
  size: t3,
1478
3369
  ...rest
1479
3370
  } = t0, $[0] = t0, $[1] = __unstable_hideInnerStroke, $[2] = animateArrowFrom, $[3] = arrowPositionProp, $[4] = className, $[5] = initials, $[6] = onImageLoadError, $[7] = rest, $[8] = src, $[9] = t1, $[10] = t2, $[11] = t3, $[12] = title) : (__unstable_hideInnerStroke = $[1], animateArrowFrom = $[2], arrowPositionProp = $[3], className = $[4], initials = $[5], onImageLoadError = $[6], rest = $[7], src = $[8], t1 = $[9], t2 = $[10], t3 = $[11], title = $[12]);
1480
- const Element2 = t1 === void 0 ? DEFAULT_AVATAR_ELEMENT : t1, color = t2 === void 0 ? "magenta" : t2, sizeProp = t3 === void 0 ? 1 : t3, size = useResponsiveProp(sizeProp), [arrowPosition, setArrowPosition] = useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = useState(!1);
3371
+ const Element2 = t1 === void 0 ? DEFAULT_AVATAR_ELEMENT : t1, color = t2 === void 0 ? "magenta" : t2, sizeProp = t3 === void 0 ? 1 : t3, size2 = useResponsiveProp(sizeProp), [arrowPosition, setArrowPosition] = useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = useState(!1);
1481
3372
  let t4, t5;
1482
3373
  $[13] !== arrowPosition || $[14] !== arrowPositionProp ? (t4 = () => {
1483
3374
  if (arrowPosition === arrowPositionProp)
@@ -1495,7 +3386,7 @@ function Avatar(props) {
1495
3386
  }, $[20] = onImageLoadError, $[21] = t8) : t8 = $[21];
1496
3387
  const handleImageError = t8;
1497
3388
  let t9, t10;
1498
- $[22] !== size ? (t10 = Object.values(size).map(_temp$1), $[22] = size, $[23] = t10) : t10 = $[23], t9 = t10;
3389
+ $[22] !== size2 ? (t10 = Object.values(size2).map(_temp$2), $[22] = size2, $[23] = t10) : t10 = $[23], t9 = t10;
1499
3390
  const initialsSize = t9, t11 = __unstable_hideInnerStroke ? "" : void 0;
1500
3391
  let t12;
1501
3392
  $[24] !== className || $[25] !== color || $[26] !== sizeProp ? (t12 = avatar({
@@ -1524,7 +3415,7 @@ function Avatar(props) {
1524
3415
  t18
1525
3416
  ] }), $[39] = Element2, $[40] = arrowPosition, $[41] = rest, $[42] = t11, $[43] = t12, $[44] = t13, $[45] = t15, $[46] = t17, $[47] = t18, $[48] = title, $[49] = t19) : t19 = $[49], t19;
1526
3417
  }
1527
- function _temp$1(s) {
3418
+ function _temp$2(s) {
1528
3419
  return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1529
3420
  }
1530
3421
  const DEFAULT_AVATAR_COUNTER_ELEMENT = "span";
@@ -1538,21 +3429,21 @@ function AvatarCounter(props) {
1538
3429
  size: t2,
1539
3430
  ...rest
1540
3431
  } = t0, $[0] = t0, $[1] = className, $[2] = count, $[3] = rest, $[4] = t1, $[5] = t2) : (className = $[1], count = $[2], rest = $[3], t1 = $[4], t2 = $[5]);
1541
- const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size = useResponsiveProp(t2 === void 0 ? 1 : t2);
3432
+ const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size2 = useResponsiveProp(t2 === void 0 ? 1 : t2);
1542
3433
  let t3, t4;
1543
- $[6] !== size ? (t4 = Object.values(size).map(_temp), $[6] = size, $[7] = t4) : t4 = $[7], t3 = t4;
3434
+ $[6] !== size2 ? (t4 = Object.values(size2).map(_temp$1), $[6] = size2, $[7] = t4) : t4 = $[7], t3 = t4;
1544
3435
  const labelSize = t3;
1545
3436
  let t5;
1546
- $[8] !== className || $[9] !== size ? (t5 = avatarCounter({
3437
+ $[8] !== className || $[9] !== size2 ? (t5 = avatarCounter({
1547
3438
  className,
1548
- size
1549
- }), $[8] = className, $[9] = size, $[10] = t5) : t5 = $[10];
3439
+ size: size2
3440
+ }), $[8] = className, $[9] = size2, $[10] = t5) : t5 = $[10];
1550
3441
  let t6;
1551
3442
  $[11] !== count || $[12] !== labelSize ? (t6 = /* @__PURE__ */ jsx(Label, { align: "center", as: "span", size: labelSize, weight: "medium", children: count }), $[11] = count, $[12] = labelSize, $[13] = t6) : t6 = $[13];
1552
3443
  let t7;
1553
3444
  return $[14] !== as || $[15] !== rest || $[16] !== t5 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsx(Box, { "data-ui": "AvatarCounter", ...rest, alignItems: "center", as, className: t5, display: "flex", flex: "none", justifyContent: "center", paddingX: 2, sizing: "border", children: t6 }), $[14] = as, $[15] = rest, $[16] = t5, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
1554
3445
  }
1555
- function _temp(s) {
3446
+ function _temp$1(s) {
1556
3447
  return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1557
3448
  }
1558
3449
  const DEFAULT_AVATAR_STACK_ELEMENT = "span";
@@ -1567,17 +3458,17 @@ function AvatarStack(props) {
1567
3458
  size: t3,
1568
3459
  ...rest
1569
3460
  } = t0, $[0] = t0, $[1] = childrenProp, $[2] = className, $[3] = rest, $[4] = t1, $[5] = t2, $[6] = t3) : (childrenProp = $[1], className = $[2], rest = $[3], t1 = $[4], t2 = $[5], t3 = $[6]);
1570
- const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = Children.toArray(childrenProp).filter(isValidElement), maxLength = Math.max(maxLengthProp, 0), size = useResponsiveProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = Box, t4 = "AvatarStack", t5 = "center";
3461
+ const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = Children.toArray(childrenProp).filter(isValidElement), maxLength = Math.max(maxLengthProp, 0), size2 = useResponsiveProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = Box, t4 = "AvatarStack", t5 = "center";
1571
3462
  let t6;
1572
- $[7] !== className || $[8] !== size ? (t6 = avatarStack({
3463
+ $[7] !== className || $[8] !== size2 ? (t6 = avatarStack({
1573
3464
  className,
1574
- size
1575
- }), $[7] = className, $[8] = size, $[9] = t6) : t6 = $[9];
1576
- const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsx(AvatarCounter, { count: len, size }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size });
3465
+ size: size2
3466
+ }), $[7] = className, $[8] = size2, $[9] = t6) : t6 = $[9];
3467
+ const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 });
1577
3468
  let t11;
1578
- $[10] !== size ? (t11 = (child, childIndex) => /* @__PURE__ */ jsx(Fragment, { children: cloneElement(child, {
1579
- size
1580
- }) }, String(childIndex)), $[10] = size, $[11] = t11) : t11 = $[11];
3469
+ $[10] !== size2 ? (t11 = (child, childIndex) => /* @__PURE__ */ jsx(Fragment$1, { children: cloneElement(child, {
3470
+ size: size2
3471
+ }) }, String(childIndex)), $[10] = size2, $[11] = t11) : t11 = $[11];
1581
3472
  const t12 = visibleChildren.map(t11);
1582
3473
  let t13;
1583
3474
  return $[12] !== T0 || $[13] !== as || $[14] !== rest || $[15] !== t10 || $[16] !== t12 || $[17] !== t6 || $[18] !== t9 ? (t13 = /* @__PURE__ */ jsxs(T0, { "data-ui": t4, ...rest, alignItems: t5, as, className: t6, display: t7, justifyContent: t8, children: [
@@ -1667,13 +3558,13 @@ function Code(props) {
1667
3558
  weight: t3,
1668
3559
  ...rest
1669
3560
  } = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = languageProp, $[4] = rest, $[5] = t1, $[6] = t2, $[7] = t3) : (children = $[1], className = $[2], languageProp = $[3], rest = $[4], t1 = $[5], t2 = $[6], t3 = $[7]);
1670
- const Element2 = t1 === void 0 ? DEFAULT_CODE_ELEMENT : t1, size = t2 === void 0 ? 2 : t2, weight = t3 === void 0 ? "regular" : t3, language = typeof languageProp == "string" ? languageProp : void 0;
3561
+ const Element2 = t1 === void 0 ? DEFAULT_CODE_ELEMENT : t1, size2 = t2 === void 0 ? 2 : t2, weight = t3 === void 0 ? "regular" : t3, language = typeof languageProp == "string" ? languageProp : void 0;
1671
3562
  let t4;
1672
- $[8] !== className || $[9] !== size || $[10] !== weight ? (t4 = code({
3563
+ $[8] !== className || $[9] !== size2 || $[10] !== weight ? (t4 = code({
1673
3564
  className,
1674
- size,
3565
+ size: size2,
1675
3566
  weight
1676
- }), $[8] = className, $[9] = size, $[10] = weight, $[11] = t4) : t4 = $[11];
3567
+ }), $[8] = className, $[9] = size2, $[10] = weight, $[11] = t4) : t4 = $[11];
1677
3568
  let t5;
1678
3569
  $[12] !== children ? (t5 = /* @__PURE__ */ jsx("code", { children }), $[12] = children, $[13] = t5) : t5 = $[13];
1679
3570
  let t6;
@@ -1699,16 +3590,16 @@ function Heading(props) {
1699
3590
  weight: t4,
1700
3591
  ...rest
1701
3592
  } = t0, $[0] = t0, $[1] = align, $[2] = children, $[3] = className, $[4] = flex, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4, $[10] = textOverflowProp) : (align = $[1], children = $[2], className = $[3], flex = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9], textOverflowProp = $[10]);
1702
- const Element2 = t1 === void 0 ? DEFAULT_HEADING_ELEMENT : t1, muted = t2 === void 0 ? !1 : t2, size = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
3593
+ const Element2 = t1 === void 0 ? DEFAULT_HEADING_ELEMENT : t1, muted = t2 === void 0 ? !1 : t2, size2 = t3 === void 0 ? 2 : t3, weight = t4 === void 0 ? "regular" : t4;
1703
3594
  let t5;
1704
- $[11] !== align || $[12] !== className || $[13] !== flex || $[14] !== muted || $[15] !== size || $[16] !== weight ? (t5 = heading({
3595
+ $[11] !== align || $[12] !== className || $[13] !== flex || $[14] !== muted || $[15] !== size2 || $[16] !== weight ? (t5 = heading({
1705
3596
  className,
1706
3597
  align,
1707
3598
  flex,
1708
3599
  muted,
1709
- size,
3600
+ size: size2,
1710
3601
  weight
1711
- }), $[11] = align, $[12] = className, $[13] = flex, $[14] = muted, $[15] = size, $[16] = weight, $[17] = t5) : t5 = $[17];
3602
+ }), $[11] = align, $[12] = className, $[13] = flex, $[14] = muted, $[15] = size2, $[16] = weight, $[17] = t5) : t5 = $[17];
1712
3603
  let t6;
1713
3604
  $[18] !== textOverflowProp ? (t6 = textOverflow({
1714
3605
  textOverflow: textOverflowProp
@@ -1856,12 +3747,12 @@ function CodeSkeleton(props) {
1856
3747
  size: t1,
1857
3748
  ...rest
1858
3749
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1859
- const size = t1 === void 0 ? 2 : t1;
3750
+ const size2 = t1 === void 0 ? 2 : t1;
1860
3751
  let t2;
1861
- $[4] !== className || $[5] !== size ? (t2 = codeSkeleton({
3752
+ $[4] !== className || $[5] !== size2 ? (t2 = codeSkeleton({
1862
3753
  className,
1863
- size
1864
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3754
+ size: size2
3755
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1865
3756
  let t3;
1866
3757
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1867
3758
  }
@@ -1874,12 +3765,12 @@ function HeadingSkeleton(props) {
1874
3765
  size: t1,
1875
3766
  ...rest
1876
3767
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1877
- const size = t1 === void 0 ? 2 : t1;
3768
+ const size2 = t1 === void 0 ? 2 : t1;
1878
3769
  let t2;
1879
- $[4] !== className || $[5] !== size ? (t2 = headingSkeleton({
3770
+ $[4] !== className || $[5] !== size2 ? (t2 = headingSkeleton({
1880
3771
  className,
1881
- size
1882
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3772
+ size: size2
3773
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1883
3774
  let t3;
1884
3775
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1885
3776
  }
@@ -1892,12 +3783,12 @@ function LabelSkeleton(props) {
1892
3783
  size: t1,
1893
3784
  ...rest
1894
3785
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1895
- const size = t1 === void 0 ? 2 : t1;
3786
+ const size2 = t1 === void 0 ? 2 : t1;
1896
3787
  let t2;
1897
- $[4] !== className || $[5] !== size ? (t2 = labelSkeleton({
3788
+ $[4] !== className || $[5] !== size2 ? (t2 = labelSkeleton({
1898
3789
  className,
1899
- size
1900
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3790
+ size: size2
3791
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1901
3792
  let t3;
1902
3793
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1903
3794
  }
@@ -1910,12 +3801,12 @@ function TextSkeleton(props) {
1910
3801
  size: t1,
1911
3802
  ...rest
1912
3803
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1913
- const size = t1 === void 0 ? 2 : t1;
3804
+ const size2 = t1 === void 0 ? 2 : t1;
1914
3805
  let t2;
1915
- $[4] !== className || $[5] !== size ? (t2 = textSkeleton({
3806
+ $[4] !== className || $[5] !== size2 ? (t2 = textSkeleton({
1916
3807
  className,
1917
- size
1918
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3808
+ size: size2
3809
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1919
3810
  let t3;
1920
3811
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1921
3812
  }
@@ -2021,6 +3912,35 @@ function TextArea(props) {
2021
3912
  t15
2022
3913
  ] }), $[28] = t10, $[29] = t11, $[30] = t14, $[31] = t9, $[32] = t16) : t16 = $[32], t16;
2023
3914
  }
3915
+ function useDelayedState(initialState) {
3916
+ const $ = c(3), [state, setState] = useState(initialState), delayedAction = useRef(void 0);
3917
+ let t0;
3918
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
3919
+ const action = () => {
3920
+ setState(nextState);
3921
+ };
3922
+ if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
3923
+ return action();
3924
+ delayedAction.current = setTimeout(action, delay);
3925
+ }, $[0] = t0) : t0 = $[0];
3926
+ const onStateChange = t0;
3927
+ let t1;
3928
+ return $[1] !== state ? (t1 = [state, onStateChange], $[1] = state, $[2] = t1) : t1 = $[2], t1;
3929
+ }
3930
+ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAULT_TOOLTIP_ARROW_RADIUS = 2, DEFAULT_TOOLTIP_DISTANCE = 4, DEFAULT_TOOLTIP_PADDING = 4, DEFAULT_FALLBACK_PLACEMENTS = {
3931
+ top: ["top-end", "top-start", "bottom", "left", "right"],
3932
+ "top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
3933
+ "top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
3934
+ bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
3935
+ "bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
3936
+ "bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
3937
+ left: ["left-end", "left-start", "right", "top", "bottom"],
3938
+ "left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
3939
+ "left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
3940
+ right: ["right-end", "right-start", "left", "top", "bottom"],
3941
+ "right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
3942
+ "right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
3943
+ }, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v3/tooltipDelayGroup", null);
2024
3944
  function TooltipDelayGroupProvider(props) {
2025
3945
  const $ = c(9), {
2026
3946
  children,
@@ -2040,6 +3960,219 @@ function TooltipDelayGroupProvider(props) {
2040
3960
  let t3;
2041
3961
  return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
2042
3962
  }
3963
+ function useTooltipDelayGroup() {
3964
+ return useContext(TooltipDelayGroupContext);
3965
+ }
3966
+ function TooltipLayer(props) {
3967
+ const $ = c(50);
3968
+ let animate, arrow2, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, rest, scheme, shadow, style, t0;
3969
+ $[0] !== props ? ({
3970
+ animate,
3971
+ arrow: arrow2,
3972
+ arrowRef,
3973
+ arrowX,
3974
+ arrowY,
3975
+ children,
3976
+ originX,
3977
+ originY,
3978
+ padding,
3979
+ placement,
3980
+ radius,
3981
+ scheme,
3982
+ shadow,
3983
+ style,
3984
+ tone: t0,
3985
+ ...rest
3986
+ } = props, $[0] = props, $[1] = animate, $[2] = arrow2, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = rest, $[13] = scheme, $[14] = shadow, $[15] = style, $[16] = t0) : (animate = $[1], arrow2 = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], rest = $[12], scheme = $[13], shadow = $[14], style = $[15], t0 = $[16]);
3987
+ const tone = t0 === void 0 ? "inherit" : t0;
3988
+ let t1;
3989
+ const t2 = animate ? "transform" : void 0;
3990
+ let t3;
3991
+ $[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t2 ? (t3 = {
3992
+ originX,
3993
+ originY,
3994
+ willChange: t2,
3995
+ ...style
3996
+ }, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t2, $[21] = t3) : t3 = $[21], t1 = t3;
3997
+ const rootStyle = t1;
3998
+ let t4;
3999
+ const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
4000
+ let t7;
4001
+ $[22] !== t5 || $[23] !== t6 ? (t7 = {
4002
+ left: t5,
4003
+ top: t6,
4004
+ right: void 0,
4005
+ bottom: void 0
4006
+ }, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t4 = t7;
4007
+ const arrowStyle = t4, t8 = animate ? "" : void 0;
4008
+ let t9;
4009
+ $[25] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t9) : t9 = $[26];
4010
+ let t10;
4011
+ $[27] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t10) : t10 = $[28];
4012
+ let t11;
4013
+ $[29] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t11) : t11 = $[30];
4014
+ let t12;
4015
+ $[31] !== arrow2 || $[32] !== arrowRef || $[33] !== arrowStyle ? (t12 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[31] = arrow2, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t12) : t12 = $[34];
4016
+ let t13;
4017
+ return $[35] !== children || $[36] !== padding || $[37] !== placement || $[38] !== radius || $[39] !== rest || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t10 || $[44] !== t11 || $[45] !== t12 || $[46] !== t8 || $[47] !== t9 || $[48] !== tone ? (t13 = /* @__PURE__ */ jsxs(Layer, { "data-ui": "Tooltip__layer", ...rest, as: motion.div, "data-animate": t8, "data-placement": placement, padding, radius, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t9, animate: t10, exit: t11, tone, children: [
4018
+ children,
4019
+ t12
4020
+ ] }), $[35] = children, $[36] = padding, $[37] = placement, $[38] = radius, $[39] = rest, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t10, $[44] = t11, $[45] = t12, $[46] = t8, $[47] = t9, $[48] = tone, $[49] = t13) : t13 = $[49], t13;
4021
+ }
4022
+ const DEFAULT_TOOLTIP_ELEMENT = "div";
4023
+ function Tooltip(props) {
4024
+ const boundaryElementContext = useBoundaryElement(), {
4025
+ animate: _animate = !1,
4026
+ arrow: arrowProp = !1,
4027
+ as = DEFAULT_TOOLTIP_ELEMENT,
4028
+ boundaryElement = boundaryElementContext?.element,
4029
+ children: childProp,
4030
+ className,
4031
+ content: content2,
4032
+ delay,
4033
+ disabled,
4034
+ fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4035
+ padding = 2,
4036
+ placement: placementProp = "bottom",
4037
+ portal: portalProp,
4038
+ radius = 3,
4039
+ ref: forwardedRef,
4040
+ scheme,
4041
+ shadow = 2,
4042
+ zOffset = Z_OFFSETS.tooltip,
4043
+ tone = "inherit",
4044
+ ...rest
4045
+ } = props, card2 = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4046
+ useImperativeHandle(forwardedRef, () => ref.current);
4047
+ const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = useMemo(() => {
4048
+ const ret = [];
4049
+ return ret.push(flip({
4050
+ boundary: boundaryElement || void 0,
4051
+ fallbackPlacements,
4052
+ padding: DEFAULT_TOOLTIP_PADDING,
4053
+ rootBoundary
4054
+ })), ret.push(offset({
4055
+ mainAxis: DEFAULT_TOOLTIP_DISTANCE
4056
+ })), ret.push(shift({
4057
+ boundary: boundaryElement || void 0,
4058
+ rootBoundary,
4059
+ padding: DEFAULT_TOOLTIP_PADDING
4060
+ })), arrowProp && ret.push(arrow({
4061
+ element: arrowRef,
4062
+ padding: DEFAULT_TOOLTIP_PADDING
4063
+ })), animate && ret.push(origin), ret;
4064
+ }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
4065
+ floatingStyles,
4066
+ placement,
4067
+ middlewareData,
4068
+ refs,
4069
+ update
4070
+ } = useFloating({
4071
+ middleware,
4072
+ placement: placementProp,
4073
+ whileElementsMounted: autoUpdate,
4074
+ elements: {
4075
+ reference: referenceElement
4076
+ },
4077
+ transform: !1
4078
+ }), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
4079
+ setIsGroupActive,
4080
+ setOpenTooltipId
4081
+ } = delayGroupContext || {}, showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId, isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, handleIsOpenChange = useCallback((open, immediate) => {
4082
+ if (isInsideGroup)
4083
+ if (open) {
4084
+ const groupedOpenDelay = immediate ? 0 : openDelay;
4085
+ setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
4086
+ } else {
4087
+ const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
4088
+ setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
4089
+ }
4090
+ else
4091
+ setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
4092
+ }, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = useCallback((e) => {
4093
+ handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
4094
+ }, [childProp?.props, handleIsOpenChange]), handleClick = useCallback((e_0) => {
4095
+ handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
4096
+ }, [childProp?.props, handleIsOpenChange]), handleContextMenu = useCallback((e_1) => {
4097
+ handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
4098
+ }, [childProp?.props, handleIsOpenChange]), handleFocus = useCallback((e_2) => {
4099
+ handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
4100
+ }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = useCallback((e_3) => {
4101
+ handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
4102
+ }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = useCallback((e_4) => {
4103
+ handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
4104
+ }, [childProp?.props, handleIsOpenChange]);
4105
+ useCloseOnMouseLeave({
4106
+ handleIsOpenChange,
4107
+ referenceElement,
4108
+ showTooltip,
4109
+ isInsideGroup
4110
+ }), useEffect(() => {
4111
+ disabled && showTooltip && handleIsOpenChange(!1);
4112
+ }, [disabled, handleIsOpenChange, showTooltip]), useEffect(() => {
4113
+ !content2 && showTooltip && handleIsOpenChange(!1);
4114
+ }, [content2, handleIsOpenChange, showTooltip]), useEffect(() => {
4115
+ if (!showTooltip) return;
4116
+ function handleWindowKeyDown(event) {
4117
+ event.key === "Escape" && handleIsOpenChange(!1, !0);
4118
+ }
4119
+ return window.addEventListener("keydown", handleWindowKeyDown), () => {
4120
+ window.removeEventListener("keydown", handleWindowKeyDown);
4121
+ };
4122
+ }, [handleIsOpenChange, showTooltip]), useLayoutEffect(() => {
4123
+ const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
4124
+ setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
4125
+ }, [boundaryElement, portalElement]);
4126
+ const setArrow = useCallback((arrowEl) => {
4127
+ arrowRef.current = arrowEl, update();
4128
+ }, [update]), setFloating = useCallback((node) => {
4129
+ ref.current = node, refs.setFloating(node);
4130
+ }, [refs]), child = useMemo(() => childProp ? cloneElement(childProp, {
4131
+ onBlur: handleBlur,
4132
+ onFocus: handleFocus,
4133
+ onMouseEnter: handleMouseEnter,
4134
+ onMouseLeave: handleMouseLeave,
4135
+ onClick: handleClick,
4136
+ onContextMenu: handleContextMenu,
4137
+ ref: setReferenceElement
4138
+ }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
4139
+ if (useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsx(Fragment, {});
4140
+ if (disabled) return child;
4141
+ const node_0 = /* @__PURE__ */ jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: tooltip({
4142
+ className
4143
+ }), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
4144
+ ...floatingStyles,
4145
+ maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
4146
+ }, tone, zOffset, children: content2 }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
4147
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4148
+ animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
4149
+ child
4150
+ ] });
4151
+ }
4152
+ function useCloseOnMouseLeave(t0) {
4153
+ const $ = c(10), {
4154
+ handleIsOpenChange,
4155
+ referenceElement,
4156
+ showTooltip,
4157
+ isInsideGroup
4158
+ } = t0;
4159
+ let t1;
4160
+ $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
4161
+ referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
4162
+ }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
4163
+ const onMouseMove = useEffectEvent(t1);
4164
+ let t2;
4165
+ $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
4166
+ if (!showTooltip || isInsideGroup)
4167
+ return;
4168
+ const handleMouseMove = (event) => {
4169
+ onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
4170
+ };
4171
+ return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
4172
+ }, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
4173
+ let t3;
4174
+ $[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
4175
+ }
2043
4176
  function BoundaryElementProvider(props) {
2044
4177
  const $ = c(5), {
2045
4178
  children,
@@ -2054,16 +4187,16 @@ function BoundaryElementProvider(props) {
2054
4187
  let t2;
2055
4188
  return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsx(BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
2056
4189
  }
2057
- function findMaxBreakpoints(media, width) {
4190
+ function findMaxBreakpoints(media2, width) {
2058
4191
  const ret = [];
2059
- for (let i = 0; i < media.length; i += 1)
2060
- media[i] > width && ret.push(i);
4192
+ for (let i = 0; i < media2.length; i += 1)
4193
+ media2[i] > width && ret.push(i);
2061
4194
  return ret;
2062
4195
  }
2063
- function findMinBreakpoints(media, width) {
4196
+ function findMinBreakpoints(media2, width) {
2064
4197
  const ret = [];
2065
- for (let i = 0; i < media.length; i += 1)
2066
- media[i] <= width && ret.push(i);
4198
+ for (let i = 0; i < media2.length; i += 1)
4199
+ media2[i] <= width && ret.push(i);
2067
4200
  return ret;
2068
4201
  }
2069
4202
  const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(BREAKPOINTS);
@@ -2129,6 +4262,43 @@ class ErrorBoundary extends Component {
2129
4262
  return this.props.children;
2130
4263
  }
2131
4264
  }
4265
+ function PortalProvider(props) {
4266
+ const $ = c(9), {
4267
+ children,
4268
+ element,
4269
+ __unstable_elements: elementsProp
4270
+ } = props, elements = useUnique(elementsProp), parentPortal = useContext(PortalContext);
4271
+ let t0;
4272
+ $[0] !== elements || $[1] !== parentPortal ? (t0 = () => elements?.default ?? (parentPortal.element || document.body), $[0] = elements, $[1] = parentPortal, $[2] = t0) : t0 = $[2];
4273
+ const fallbackElement = useSyncExternalStore(emptySubscribe, t0, _temp);
4274
+ let t1;
4275
+ const t2 = element || fallbackElement;
4276
+ let t3;
4277
+ $[3] !== elements || $[4] !== t2 ? (t3 = {
4278
+ version: 0,
4279
+ boundaryElement: null,
4280
+ element: t2,
4281
+ elements
4282
+ }, $[3] = elements, $[4] = t2, $[5] = t3) : t3 = $[5], t1 = t3;
4283
+ const value = t1;
4284
+ let t4;
4285
+ return $[6] !== children || $[7] !== value ? (t4 = /* @__PURE__ */ jsx(PortalContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t4) : t4 = $[8], t4;
4286
+ }
4287
+ function _temp() {
4288
+ return null;
4289
+ }
4290
+ const emptySubscribe = () => () => {
4291
+ };
4292
+ function useUnique(value) {
4293
+ const valueRef = useRef(value);
4294
+ return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
4295
+ }
4296
+ function _isEqual(objA, objB) {
4297
+ if (!objA || !objB)
4298
+ return objA === objB;
4299
+ const keysA = Object.keys(objA), keysB = Object.keys(objB);
4300
+ return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
4301
+ }
2132
4302
  function RootProvider(props) {
2133
4303
  const $ = c(10), {
2134
4304
  boundaryElement: t0,