@sanity/ui 3.0.0-static.42 → 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.cjs CHANGED
@@ -1,6 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), _visualEditing = require("./_chunks-cjs/_visual-editing.cjs"), compilerRuntime = require("react/compiler-runtime"), css = require("@sanity/ui/css"), framerMotion = require("framer-motion"), resizeObserver = require("@juggle/resize-observer");
3
+ var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), compilerRuntime = require("react/compiler-runtime"), css = require("@sanity/ui/css"), reactIs = require("react-is"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), dynamic = require("@vanilla-extract/dynamic"), useEffectEvent = require("use-effect-event"), resizeObserver = require("@juggle/resize-observer");
4
+ const EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_PROPS = {
5
+ card: {
6
+ initial: {
7
+ scale: 0.97,
8
+ willChange: "transform"
9
+ },
10
+ hidden: {
11
+ opacity: 0
12
+ },
13
+ visible: {
14
+ opacity: 1,
15
+ transition: {
16
+ when: "beforeChildren",
17
+ duration: 0.1
18
+ }
19
+ },
20
+ scaleIn: {
21
+ scale: 1
22
+ },
23
+ scaleOut: {
24
+ scale: 0.97
25
+ }
26
+ },
27
+ transition: {
28
+ type: "spring",
29
+ visualDuration: 0.2,
30
+ bounce: 0.25
31
+ }
32
+ }, Z_OFFSETS = {
33
+ dialog: 600,
34
+ popover: 400,
35
+ tooltip: 200
36
+ };
4
37
  function _raf(fn) {
5
38
  const frameId = requestAnimationFrame(fn);
6
39
  return () => {
@@ -16,11 +49,35 @@ function _raf2(fn) {
16
49
  innerDispose && innerDispose(), outerDispose();
17
50
  };
18
51
  }
52
+ function _isEnterToClickElement(element) {
53
+ return isHTMLAnchorElement(element) || isHTMLButtonElement(element);
54
+ }
55
+ function isHTMLElement(node) {
56
+ return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;
57
+ }
58
+ function isHTMLAnchorElement(element) {
59
+ return isHTMLElement(element) && element.nodeName === "A";
60
+ }
61
+ function isHTMLInputElement(element) {
62
+ return isHTMLElement(element) && element.nodeName === "INPUT";
63
+ }
64
+ function isHTMLButtonElement(element) {
65
+ return isHTMLElement(element) && element.nodeName === "BUTTON";
66
+ }
67
+ function isHTMLSelectElement(element) {
68
+ return isHTMLElement(element) && element.nodeName === "SELECT";
69
+ }
70
+ function isHTMLTextAreaElement(element) {
71
+ return isHTMLElement(element) && element.nodeName === "TEXTAREA";
72
+ }
73
+ function containsOrEqualsElement(element, node) {
74
+ return element.contains(node) || element === node;
75
+ }
19
76
  function _hasFocus(element) {
20
77
  return !!document.activeElement && element.contains(document.activeElement);
21
78
  }
22
79
  function isFocusable(element) {
23
- return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : _visualEditing.isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : _visualEditing.isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : _visualEditing.isHTMLButtonElement(element) || _visualEditing.isHTMLSelectElement(element) || _visualEditing.isHTMLTextAreaElement(element) ? !element.disabled : !1;
80
+ return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : isHTMLButtonElement(element) || isHTMLSelectElement(element) || isHTMLTextAreaElement(element) ? !element.disabled : !1;
24
81
  }
25
82
  function attemptFocus(element) {
26
83
  if (!isFocusable(element))
@@ -34,7 +91,7 @@ function attemptFocus(element) {
34
91
  function focusFirstDescendant(element) {
35
92
  for (let i = 0; i < element.childNodes.length; i++) {
36
93
  const child = element.childNodes[i];
37
- if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
94
+ if (isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
38
95
  return !0;
39
96
  }
40
97
  return !1;
@@ -42,11 +99,1212 @@ function focusFirstDescendant(element) {
42
99
  function focusLastDescendant(element) {
43
100
  for (let i = element.childNodes.length - 1; i >= 0; i--) {
44
101
  const child = element.childNodes[i];
45
- if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
102
+ if (isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
46
103
  return !0;
47
104
  }
48
105
  return !1;
49
106
  }
107
+ function isArray(val) {
108
+ return Array.isArray(val);
109
+ }
110
+ function isRecord(value) {
111
+ return !!(value && typeof value == "object" && !Array.isArray(value));
112
+ }
113
+ function _getArrayProp(val, defaultVal) {
114
+ return val === void 0 ? defaultVal || EMPTY_ARRAY : Array.isArray(val) ? val : [val];
115
+ }
116
+ function _getResponsiveProp(val, defaultVal) {
117
+ return val === void 0 ? defaultVal || EMPTY_ARRAY : isArray(val) || isRecord(val) ? val : [val];
118
+ }
119
+ function useResponsiveProp(val, defaultVal) {
120
+ const $ = compilerRuntime.c(3);
121
+ let t0;
122
+ $[0] !== defaultVal || $[1] !== val ? (t0 = () => [_getResponsiveProp(val, defaultVal), JSON.stringify(val ?? defaultVal)], $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2];
123
+ const [t1, setCache] = react.useState(t0), [cachedVal, cachedHash] = t1, hash = JSON.stringify(val ?? defaultVal);
124
+ return hash !== cachedHash && setCache([_getResponsiveProp(val, defaultVal), hash]), cachedVal;
125
+ }
126
+ const DEFAULT_BOX_ELEMENT = "div";
127
+ function Box(props) {
128
+ const $ = compilerRuntime.c(132), t0 = props;
129
+ 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;
130
+ $[0] !== t0 ? ({
131
+ alignItems,
132
+ as: t1,
133
+ border: t2,
134
+ borderTop,
135
+ borderRight,
136
+ borderBottom,
137
+ borderLeft,
138
+ className,
139
+ children,
140
+ display: t3,
141
+ flex,
142
+ flexDirection,
143
+ flexWrap,
144
+ gap,
145
+ gapX,
146
+ gapY,
147
+ gridAutoColumns,
148
+ gridAutoFlow,
149
+ gridAutoRows,
150
+ gridColumn,
151
+ gridColumnEnd,
152
+ gridColumnStart,
153
+ gridRow,
154
+ gridRowEnd,
155
+ gridRowStart,
156
+ gridTemplateColumns,
157
+ gridTemplateRows,
158
+ height,
159
+ inset,
160
+ insetBottom,
161
+ insetLeft,
162
+ insetRight,
163
+ insetTop,
164
+ justifyContent,
165
+ margin: t4,
166
+ marginX,
167
+ marginY,
168
+ marginTop,
169
+ marginRight,
170
+ marginBottom,
171
+ marginLeft,
172
+ maxWidth,
173
+ minHeight: t5,
174
+ minWidth: t6,
175
+ muted,
176
+ outline,
177
+ overflow,
178
+ overflowX,
179
+ overflowY,
180
+ padding: t7,
181
+ paddingX,
182
+ paddingY,
183
+ paddingTop,
184
+ paddingRight,
185
+ paddingBottom,
186
+ paddingLeft,
187
+ pointerEvents,
188
+ position,
189
+ radius,
190
+ shadow,
191
+ sizing: t8,
192
+ textAlign,
193
+ width,
194
+ ...rest
195
+ } = 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]);
196
+ 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;
197
+ let t9;
198
+ $[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 = css.box({
199
+ className,
200
+ alignItems,
201
+ border,
202
+ borderTop,
203
+ borderRight,
204
+ borderBottom,
205
+ borderLeft,
206
+ display,
207
+ flex,
208
+ flexDirection,
209
+ flexWrap,
210
+ gap,
211
+ gapX,
212
+ gapY,
213
+ gridAutoColumns,
214
+ gridAutoFlow,
215
+ gridAutoRows,
216
+ gridColumn,
217
+ gridColumnEnd,
218
+ gridColumnStart,
219
+ gridRow,
220
+ gridRowEnd,
221
+ gridRowStart,
222
+ gridTemplateColumns,
223
+ gridTemplateRows,
224
+ height,
225
+ inset,
226
+ insetBottom,
227
+ insetLeft,
228
+ insetRight,
229
+ insetTop,
230
+ justifyContent,
231
+ margin,
232
+ marginX,
233
+ marginY,
234
+ marginTop,
235
+ marginRight,
236
+ marginBottom,
237
+ marginLeft,
238
+ maxWidth,
239
+ minHeight,
240
+ minWidth,
241
+ muted,
242
+ outline,
243
+ overflow,
244
+ overflowX,
245
+ overflowY,
246
+ padding,
247
+ paddingX,
248
+ paddingY,
249
+ paddingTop,
250
+ paddingRight,
251
+ paddingBottom,
252
+ paddingLeft,
253
+ pointerEvents,
254
+ position,
255
+ radius,
256
+ shadow,
257
+ sizing,
258
+ textAlign,
259
+ width
260
+ }), $[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];
261
+ let t10;
262
+ return $[127] !== Element2 || $[128] !== children || $[129] !== rest || $[130] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Box", ...rest, className: t9, children }), $[127] = Element2, $[128] = children, $[129] = rest, $[130] = t9, $[131] = t10) : t10 = $[131], t10;
263
+ }
264
+ const DEFAULT_TEXT_ELEMENT = "div";
265
+ function Text(props) {
266
+ const $ = compilerRuntime.c(30), t0 = props;
267
+ let align, children, className, flex, muted, rest, t1, t2, t3, t4, textOverflowProp;
268
+ $[0] !== t0 ? ({
269
+ align,
270
+ as: t1,
271
+ children,
272
+ className,
273
+ flex,
274
+ maxWidth: t2,
275
+ muted,
276
+ size: t3,
277
+ textOverflow: textOverflowProp,
278
+ weight: t4,
279
+ ...rest
280
+ } = 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]);
281
+ 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;
282
+ let t5;
283
+ $[12] !== align || $[13] !== className || $[14] !== flex || $[15] !== maxWidth || $[16] !== muted || $[17] !== size2 || $[18] !== weight ? (t5 = css.text({
284
+ className,
285
+ align,
286
+ flex,
287
+ maxWidth,
288
+ muted,
289
+ size: size2,
290
+ weight
291
+ }), $[12] = align, $[13] = className, $[14] = flex, $[15] = maxWidth, $[16] = muted, $[17] = size2, $[18] = weight, $[19] = t5) : t5 = $[19];
292
+ let t6;
293
+ $[20] !== textOverflowProp ? (t6 = css.textOverflow({
294
+ textOverflow: textOverflowProp
295
+ }), $[20] = textOverflowProp, $[21] = t6) : t6 = $[21];
296
+ let t7;
297
+ $[22] !== children || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t6, children }), $[22] = children, $[23] = t6, $[24] = t7) : t7 = $[24];
298
+ let t8;
299
+ return $[25] !== Element2 || $[26] !== rest || $[27] !== t5 || $[28] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { "data-ui": "Text", ...rest, className: t5, children: t7 }), $[25] = Element2, $[26] = rest, $[27] = t5, $[28] = t7, $[29] = t8) : t8 = $[29], t8;
300
+ }
301
+ function AnimatedSpinnerIcon(props) {
302
+ const $ = compilerRuntime.c(5);
303
+ let rest;
304
+ $[0] !== props ? ({
305
+ ...rest
306
+ } = props, $[0] = props, $[1] = rest) : rest = $[1];
307
+ let t0;
308
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t0 = css.animatedSpinnerIcon(), $[2] = t0) : t0 = $[2];
309
+ let t1;
310
+ return $[3] !== rest ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(icons.SpinnerIcon, { "data-sanity-icon": "animated-spinner", ...rest, className: t0 }), $[3] = rest, $[4] = t1) : t1 = $[4], t1;
311
+ }
312
+ const DEFAULT_SPINNER_ELEMENT = "div";
313
+ function Spinner(props) {
314
+ const $ = compilerRuntime.c(11), t0 = props;
315
+ let className, rest, t1;
316
+ $[0] !== t0 ? ({
317
+ as: t1,
318
+ className,
319
+ ...rest
320
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
321
+ const as = t1 === void 0 ? DEFAULT_SPINNER_ELEMENT : t1;
322
+ let t2;
323
+ $[4] !== className ? (t2 = css.spinner({
324
+ className
325
+ }), $[4] = className, $[5] = t2) : t2 = $[5];
326
+ let t3;
327
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(AnimatedSpinnerIcon, {}), $[6] = t3) : t3 = $[6];
328
+ let t4;
329
+ return $[7] !== as || $[8] !== rest || $[9] !== t2 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as, "data-ui": "Spinner", ...rest, className: t2, children: t3 }), $[7] = as, $[8] = rest, $[9] = t2, $[10] = t4) : t4 = $[10], t4;
330
+ }
331
+ const DEFAULT_BUTTON_ELEMENT = "button";
332
+ function Button(props) {
333
+ const {
334
+ align = "center",
335
+ as: Element2 = DEFAULT_BUTTON_ELEMENT,
336
+ children,
337
+ className,
338
+ disabled,
339
+ flex,
340
+ fontSize = 1,
341
+ gap = props.padding ?? 3,
342
+ gapX,
343
+ gapY,
344
+ icon: IconComponent,
345
+ iconRight: IconRightComponent,
346
+ justify = "center",
347
+ loading,
348
+ mode = "default",
349
+ padding = 3,
350
+ paddingX,
351
+ paddingY,
352
+ paddingTop,
353
+ paddingBottom,
354
+ paddingLeft,
355
+ paddingRight,
356
+ radius = 2,
357
+ selected,
358
+ text,
359
+ textAlign,
360
+ textOverflow = "ellipsis",
361
+ textWeight = "medium",
362
+ tone = "default",
363
+ type = "button",
364
+ muted = !1,
365
+ width,
366
+ ...rest
367
+ } = props;
368
+ let href;
369
+ return "href" in rest && (href = typeof rest.href == "string" ? rest.href : href, delete rest.href), /* @__PURE__ */ jsxRuntime.jsxs(
370
+ Element2,
371
+ {
372
+ "data-ui": "Button",
373
+ ...rest,
374
+ className: css.button({
375
+ className,
376
+ flex,
377
+ mode,
378
+ radius,
379
+ tone,
380
+ width
381
+ }),
382
+ "data-disabled": loading || disabled ? "" : void 0,
383
+ "data-selected": selected ? "" : void 0,
384
+ disabled: !!(loading || disabled),
385
+ href: disabled ? void 0 : href,
386
+ type,
387
+ children: [
388
+ !!loading && /* @__PURE__ */ jsxRuntime.jsx(Box, { alignItems: "center", as: "span", className: css.buttonLoadingBox(), display: "flex", flex: 1, justifyContent: "center", width: "fill", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: fontSize }) }),
389
+ (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Box, { alignItems: align, as: "span", display: "flex", flex: 1, gap, gapX, gapY, justifyContent: justify, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children: [
390
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
391
+ react.isValidElement(IconComponent) && IconComponent,
392
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
393
+ ] }),
394
+ text && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", maxWidth: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(Text, { align: textAlign, as: "span", muted, size: fontSize, textOverflow, weight: textWeight, children: text }) }),
395
+ IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { as: "span", flex: "none", muted: !0, size: fontSize, children: [
396
+ react.isValidElement(IconRightComponent) && IconRightComponent,
397
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
398
+ ] })
399
+ ] }),
400
+ children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", flex: 1, padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight, children })
401
+ ]
402
+ }
403
+ );
404
+ }
405
+ function useMatchMedia(mediaQueryString, getServerSnapshot2) {
406
+ const $ = compilerRuntime.c(4);
407
+ react.useDebugValue(mediaQueryString);
408
+ let t0;
409
+ $[0] !== mediaQueryString ? (t0 = (onStoreChange) => {
410
+ const media2 = window.matchMedia(mediaQueryString);
411
+ return media2.addEventListener("change", onStoreChange), () => media2.removeEventListener("change", onStoreChange);
412
+ }, $[0] = mediaQueryString, $[1] = t0) : t0 = $[1];
413
+ let t1;
414
+ return $[2] !== mediaQueryString ? (t1 = () => window.matchMedia(mediaQueryString).matches, $[2] = mediaQueryString, $[3] = t1) : t1 = $[3], react.useSyncExternalStore(t0, t1, getServerSnapshot2);
415
+ }
416
+ function usePrefersReducedMotion(t0) {
417
+ return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$a : t0);
418
+ }
419
+ function _temp$a() {
420
+ return !1;
421
+ }
422
+ const origin = {
423
+ name: "@sanity/ui/origin",
424
+ fn({
425
+ middlewareData,
426
+ placement,
427
+ rects
428
+ }) {
429
+ const [side] = placement.split("-"), floatingWidth = rects.floating.width, floatingHeight = rects.floating.height, shiftX = middlewareData.shift?.x || 0, shiftY = middlewareData.shift?.y || 0;
430
+ if (floatingWidth <= 0 || floatingHeight <= 0)
431
+ return {};
432
+ const isVerticalPlacement = ["bottom", "top"].includes(side), {
433
+ originX,
434
+ originY
435
+ } = isVerticalPlacement ? {
436
+ originX: clamp(0.5 - shiftX / floatingWidth, 0, 1),
437
+ originY: side === "bottom" ? 0 : 1
438
+ } : {
439
+ originX: side === "left" ? 1 : 0,
440
+ originY: clamp(0.5 - shiftY / floatingHeight, 0, 1)
441
+ };
442
+ return {
443
+ data: {
444
+ originX,
445
+ originY
446
+ }
447
+ };
448
+ }
449
+ };
450
+ function clamp(num, min, max) {
451
+ return Math.min(Math.max(num, min), max);
452
+ }
453
+ function getGlobalScope() {
454
+ if (typeof globalThis < "u") return globalThis;
455
+ if (typeof window < "u") return window;
456
+ if (typeof self < "u") return self;
457
+ if (typeof global < "u") return global;
458
+ throw new Error("@sanity/ui: could not locate global scope");
459
+ }
460
+ const globalScope = getGlobalScope();
461
+ function createGlobalScopedContext(key2, defaultValue) {
462
+ const symbol = Symbol.for(key2);
463
+ if (typeof document > "u")
464
+ return react.createContext(defaultValue);
465
+ const symbolMap = globalScope;
466
+ return symbolMap[symbol] = symbolMap[symbol] || react.createContext(defaultValue), symbolMap[symbol];
467
+ }
468
+ const BoundaryElementContext = createGlobalScopedContext("@sanity/ui/v3/boundaryElement", null), DEFAULT_VALUE = {
469
+ version: 0,
470
+ element: null
471
+ };
472
+ function useBoundaryElement() {
473
+ const value = react.useContext(BoundaryElementContext);
474
+ if (value && (!isRecord(value) || value.version !== 0))
475
+ throw new Error("useBoundaryElement(): the context value is not compatible");
476
+ return value || DEFAULT_VALUE;
477
+ }
478
+ function getElementRef(element) {
479
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
480
+ 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);
481
+ }
482
+ const CardContext = createGlobalScopedContext("@sanity/ui/v3/card", null);
483
+ function CardProvider(props) {
484
+ const $ = compilerRuntime.c(7), {
485
+ children,
486
+ tone,
487
+ scheme,
488
+ unstable_CompatProvider
489
+ } = props;
490
+ let t0, t1;
491
+ $[0] !== scheme || $[1] !== tone || $[2] !== unstable_CompatProvider ? (t1 = {
492
+ tone,
493
+ scheme,
494
+ unstable_CompatProvider
495
+ }, $[0] = scheme, $[1] = tone, $[2] = unstable_CompatProvider, $[3] = t1) : t1 = $[3], t0 = t1;
496
+ let t2;
497
+ return $[4] !== children || $[5] !== t0 ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(CardContext.Provider, { value: t0, children }), $[4] = children, $[5] = t0, $[6] = t2) : t2 = $[6], t2;
498
+ }
499
+ function useCard() {
500
+ const card = react.useContext(CardContext);
501
+ if (!card)
502
+ throw new Error("useCard(): missing context value");
503
+ return card;
504
+ }
505
+ const key = "@sanity/ui/v3/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
506
+ elementMap[elementKey] = null;
507
+ const defaultContextValue = {
508
+ version: 0,
509
+ boundaryElement: null,
510
+ get element() {
511
+ return typeof document > "u" ? null : (elementMap[elementKey] || (elementMap[elementKey] = document.createElement("div"), elementMap[elementKey].setAttribute("data-portal", ""), document.body.appendChild(elementMap[elementKey])), elementMap[elementKey]);
512
+ }
513
+ }, PortalContext = createGlobalScopedContext(key, defaultContextValue);
514
+ function usePortal() {
515
+ const value = react.useContext(PortalContext);
516
+ if (!value)
517
+ throw new Error("usePortal(): missing context value");
518
+ if (!isRecord(value) || value.version !== 0)
519
+ throw new Error("usePortal(): the context value is not compatible");
520
+ return value;
521
+ }
522
+ function Portal(props) {
523
+ const $ = compilerRuntime.c(6), {
524
+ children,
525
+ __unstable_name: name
526
+ } = props, card = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
527
+ if (!portalElement)
528
+ return null;
529
+ let t0;
530
+ $[0] !== card.scheme || $[1] !== children ? (t0 = /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: "transparent", scheme: card.scheme, children }), $[0] = card.scheme, $[1] = children, $[2] = t0) : t0 = $[2];
531
+ let t1;
532
+ return $[3] !== portalElement || $[4] !== t0 ? (t1 = reactDom.createPortal(t0, portalElement), $[3] = portalElement, $[4] = t0, $[5] = t1) : t1 = $[5], t1;
533
+ }
534
+ function getLayerContext(contextValue) {
535
+ if (!isRecord(contextValue) || contextValue.version !== 0)
536
+ throw new Error("the context value is not compatible");
537
+ if (!contextValue)
538
+ throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");
539
+ if (contextValue.version === 0)
540
+ return contextValue;
541
+ throw new Error("could not get layer context");
542
+ }
543
+ const LayerContext = createGlobalScopedContext("@sanity/ui/v3/layer", null);
544
+ function useLayer() {
545
+ const $ = compilerRuntime.c(2), value = react.useContext(LayerContext);
546
+ if (!value)
547
+ throw new Error("useLayer(): missing context value");
548
+ try {
549
+ let t1;
550
+ return $[0] !== value ? (t1 = getLayerContext(value), $[0] = value, $[1] = t1) : t1 = $[1], t1;
551
+ } catch (t0) {
552
+ const err = t0;
553
+ throw err instanceof Error ? new Error(`useLayer(): ${err.message}`) : new Error(`useLayer(): ${err}`);
554
+ }
555
+ }
556
+ 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 = {
557
+ top: ["bottom", "left", "right"],
558
+ "top-start": ["bottom-start", "left-start", "right-start"],
559
+ "top-end": ["bottom-end", "left-end", "right-end"],
560
+ bottom: ["top", "left", "right"],
561
+ "bottom-start": ["top-start", "left-start", "right-start"],
562
+ "bottom-end": ["top-end", "left-end", "right-end"],
563
+ left: ["right", "top", "bottom"],
564
+ "left-start": ["right-start", "top-start", "bottom-start"],
565
+ "left-end": ["right-end", "top-end", "bottom-end"],
566
+ right: ["left", "top", "bottom"],
567
+ "right-start": ["left-start", "top-start", "bottom-start"],
568
+ "right-end": ["left-end", "top-end", "bottom-end"]
569
+ };
570
+ function size(options) {
571
+ const {
572
+ apply,
573
+ margins,
574
+ padding = 0
575
+ } = options;
576
+ return {
577
+ name: "@sanity/ui/size",
578
+ async fn(args) {
579
+ const {
580
+ elements,
581
+ placement,
582
+ platform,
583
+ rects
584
+ } = args, {
585
+ floating,
586
+ reference
587
+ } = rects, overflow = await reactDom$1.detectOverflow(args, {
588
+ altBoundary: !0,
589
+ boundary: options.boundaryElement || void 0,
590
+ elementContext: "floating",
591
+ padding,
592
+ rootBoundary: "viewport"
593
+ });
594
+ let maxWidth = 1 / 0, maxHeight = 1 / 0;
595
+ const floatingW = floating.width, floatingH = floating.height;
596
+ 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({
597
+ availableWidth: maxWidth - margins[1] - margins[3],
598
+ availableHeight: maxHeight - margins[0] - margins[2],
599
+ elements,
600
+ referenceWidth: reference.width - margins[1] - margins[3]
601
+ });
602
+ const nextDimensions = await platform.getDimensions(elements.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
603
+ return floatingW !== targetW || floatingH !== targetH ? {
604
+ reset: {
605
+ rects: !0
606
+ }
607
+ } : {};
608
+ }
609
+ };
610
+ }
611
+ function moveTowardsLength(movingPoint, targetPoint, amount) {
612
+ const width = targetPoint.x - movingPoint.x, height = targetPoint.y - movingPoint.y, distance = Math.sqrt(width * width + height * height);
613
+ return moveTowardsFractional(movingPoint, targetPoint, Math.min(1, amount / distance));
614
+ }
615
+ function moveTowardsFractional(movingPoint, targetPoint, fraction) {
616
+ return {
617
+ x: movingPoint.x + (targetPoint.x - movingPoint.x) * fraction,
618
+ y: movingPoint.y + (targetPoint.y - movingPoint.y) * fraction
619
+ };
620
+ }
621
+ function getRoundedCommands(points) {
622
+ const len = points.length, cmds = [];
623
+ for (let i = 0; i < len; i += 1) {
624
+ const point = points[i], prevPoint = points[i - 1], nextPoint = points[i + 1];
625
+ if (prevPoint && point.radius) {
626
+ 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);
627
+ cmds.push({
628
+ type: "point",
629
+ ...curveStart
630
+ }), cmds.push({
631
+ type: "curve",
632
+ curveEnd,
633
+ startControl,
634
+ endControl
635
+ });
636
+ } else
637
+ cmds.push({
638
+ type: "point",
639
+ ...point
640
+ });
641
+ }
642
+ return cmds;
643
+ }
644
+ function compileCommands(cmds) {
645
+ 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(" ");
646
+ }
647
+ const DEFAULT_ARROW_ELEMENT = "div";
648
+ function Arrow(props) {
649
+ const $ = compilerRuntime.c(34), t0 = props;
650
+ let h, rest, style, t1, t2, w;
651
+ $[0] !== t0 ? ({
652
+ as: t1,
653
+ width: w,
654
+ height: h,
655
+ radius: t2,
656
+ style,
657
+ ...rest
658
+ } = 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]);
659
+ const Element2 = t1 === void 0 ? DEFAULT_ARROW_ELEMENT : t1, radius = t2 === void 0 ? 0 : t2, center = w / 2;
660
+ let t3;
661
+ const points = [{
662
+ x: 0,
663
+ y: 0
664
+ }, {
665
+ x: radius,
666
+ y: 0,
667
+ radius
668
+ }, {
669
+ x: center,
670
+ y: h - 1,
671
+ radius
672
+ }, {
673
+ x: w - radius,
674
+ y: 0,
675
+ radius
676
+ }, {
677
+ x: w,
678
+ y: 0
679
+ }], cmds = getRoundedCommands(points);
680
+ t3 = compileCommands(cmds);
681
+ const path = t3, strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
682
+ let t4;
683
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = css._arrow(), $[7] = t4) : t4 = $[7];
684
+ const t5 = `${w}px`;
685
+ let t6;
686
+ $[8] !== t5 ? (t6 = dynamic.assignInlineVars({
687
+ [css.vars.arrow.size]: t5
688
+ }), $[8] = t5, $[9] = t6) : t6 = $[9];
689
+ let t7;
690
+ $[10] !== style || $[11] !== t6 ? (t7 = {
691
+ ...style,
692
+ ...t6
693
+ }, $[10] = style, $[11] = t6, $[12] = t7) : t7 = $[12];
694
+ let t8;
695
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = css._arrowSvg(), $[13] = t8) : t8 = $[13];
696
+ const t9 = `0 0 ${w} ${w}`;
697
+ let t10;
698
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t10 = css._arrowStrokeMask(), $[14] = t10) : t10 = $[14];
699
+ let t11;
700
+ $[15] !== w ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { className: t10, x: 0, width: w, height: w, fill: "white" }) }), $[15] = w, $[16] = t11) : t11 = $[16];
701
+ let t12;
702
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t12 = css._arrowStroke(), $[17] = t12) : t12 = $[17];
703
+ let t13;
704
+ $[18] !== strokePath ? (t13 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t12, d: strokePath, mask: "url(#stroke-mask)" }), $[18] = strokePath, $[19] = t13) : t13 = $[19];
705
+ let t14;
706
+ $[20] === Symbol.for("react.memo_cache_sentinel") ? (t14 = css._arrowShape(), $[20] = t14) : t14 = $[20];
707
+ let t15;
708
+ $[21] !== fillPath ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("path", { className: t14, d: fillPath }), $[21] = fillPath, $[22] = t15) : t15 = $[22];
709
+ let t16;
710
+ $[23] !== t11 || $[24] !== t13 || $[25] !== t15 || $[26] !== t9 || $[27] !== w ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: t8, width: w, height: w, viewBox: t9, children: [
711
+ t11,
712
+ t13,
713
+ t15
714
+ ] }), $[23] = t11, $[24] = t13, $[25] = t15, $[26] = t9, $[27] = w, $[28] = t16) : t16 = $[28];
715
+ let t17;
716
+ return $[29] !== Element2 || $[30] !== rest || $[31] !== t16 || $[32] !== t7 ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t4, style: t7, children: t16 }), $[29] = Element2, $[30] = rest, $[31] = t16, $[32] = t7, $[33] = t17) : t17 = $[33], t17;
717
+ }
718
+ const DEFAULT_FLEX_ELEMENT = "div";
719
+ function Flex(props) {
720
+ const $ = compilerRuntime.c(14), t0 = props;
721
+ let align, justify, rest, t1, t2, wrap;
722
+ $[0] !== t0 ? ({
723
+ align,
724
+ as: t1,
725
+ direction: t2,
726
+ justify,
727
+ wrap,
728
+ ...rest
729
+ } = 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]);
730
+ const as = t1 === void 0 ? DEFAULT_FLEX_ELEMENT : t1, direction = t2 === void 0 ? "row" : t2;
731
+ let t3;
732
+ return $[7] !== align || $[8] !== as || $[9] !== direction || $[10] !== justify || $[11] !== rest || $[12] !== wrap ? (t3 = /* @__PURE__ */ jsxRuntime.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;
733
+ }
734
+ const DEFAULT_CARD_ELEMENT = "div";
735
+ function Card(props) {
736
+ const $ = compilerRuntime.c(38), t0 = props;
737
+ let className, disabled, pressed, rest, schemeProp, selected, style, t1, t2, t3, t4, t5;
738
+ $[0] !== t0 ? ({
739
+ __unstable_checkered: t1,
740
+ __unstable_focusRing: t2,
741
+ as: t3,
742
+ className,
743
+ disabled,
744
+ pressed,
745
+ radius: t4,
746
+ scheme: schemeProp,
747
+ selected,
748
+ style,
749
+ tone: t5,
750
+ ...rest
751
+ } = 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]);
752
+ 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 = react.useContext(CardContext), tone = toneProp === "inherit" ? parent?.tone : toneProp, scheme = schemeProp === void 0 ? parent?.scheme : schemeProp, t6 = scheme === parent?.scheme ? void 0 : scheme;
753
+ let t7;
754
+ $[13] !== className || $[14] !== t6 || $[15] !== tone ? (t7 = css.card({
755
+ className,
756
+ scheme: t6,
757
+ tone
758
+ }), $[13] = className, $[14] = t6, $[15] = tone, $[16] = t7) : t7 = $[16];
759
+ const t8 = checkered ? "" : void 0, t9 = disabled ? "" : void 0, t10 = focusRing ? "" : void 0, t11 = pressed ? "" : void 0, t12 = selected ? "" : void 0;
760
+ let t13;
761
+ $[17] !== as || $[18] !== radius || $[19] !== rest || $[20] !== style || $[21] !== t10 || $[22] !== t11 || $[23] !== t12 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.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];
762
+ let node = t13;
763
+ if (scheme === parent?.scheme && tone === parent?.tone)
764
+ return node;
765
+ const t14 = scheme ?? "light", t15 = tone ?? "default", t16 = parent?.unstable_CompatProvider;
766
+ let t17;
767
+ if ($[28] !== node || $[29] !== t14 || $[30] !== t15 || $[31] !== t16 ? (t17 = /* @__PURE__ */ jsxRuntime.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) {
768
+ const CompatProvider = parent.unstable_CompatProvider, t18 = scheme ?? "light", t19 = tone ?? parent.tone;
769
+ let t20;
770
+ return $[33] !== CompatProvider || $[34] !== node || $[35] !== t18 || $[36] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(CompatProvider, { scheme: t18, tone: t19, children: node }), $[33] = CompatProvider, $[34] = node, $[35] = t18, $[36] = t19, $[37] = t20) : t20 = $[37], t20;
771
+ }
772
+ return node;
773
+ }
774
+ const DEFAULT_LAYER_CARD_ELEMENT = "div";
775
+ function LayerCard(props) {
776
+ const $ = compilerRuntime.c(27), t0 = props;
777
+ let children, forwardedRef, onActivate, onFocus, rest, t1, t2, t3;
778
+ $[0] !== t0 ? ({
779
+ as: t1,
780
+ children,
781
+ onActivate,
782
+ onFocus,
783
+ position: t2,
784
+ ref: forwardedRef,
785
+ style: t3,
786
+ ...rest
787
+ } = 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]);
788
+ const as = t1 === void 0 ? DEFAULT_LAYER_CARD_ELEMENT : t1, position = t2 === void 0 ? "relative" : t2, style = t3 === void 0 ? EMPTY_RECORD : t3, {
789
+ zIndex,
790
+ isTopLayer
791
+ } = useLayer(), lastFocusedRef = react.useRef(null), ref = react.useRef(null), isTopLayerRef = react.useRef(isTopLayer);
792
+ let t4;
793
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[9] = t4) : t4 = $[9], react.useImperativeHandle(forwardedRef, t4);
794
+ let t5, t6;
795
+ $[10] !== isTopLayer || $[11] !== onActivate ? (t5 = () => {
796
+ isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({
797
+ activeElement: lastFocusedRef.current
798
+ }), isTopLayerRef.current = isTopLayer;
799
+ }, t6 = [isTopLayer, onActivate], $[10] = isTopLayer, $[11] = onActivate, $[12] = t5, $[13] = t6) : (t5 = $[12], t6 = $[13]), react.useEffect(t5, t6);
800
+ let t7;
801
+ $[14] !== isTopLayer || $[15] !== onFocus ? (t7 = (event) => {
802
+ onFocus?.(event);
803
+ const rootElement = ref.current, target = document.activeElement;
804
+ !isTopLayer || !rootElement || !target || isHTMLElement(target) && containsOrEqualsElement(rootElement, target) && (lastFocusedRef.current = target);
805
+ }, $[14] = isTopLayer, $[15] = onFocus, $[16] = t7) : t7 = $[16];
806
+ const handleFocus = t7, t8 = as;
807
+ let t9;
808
+ $[17] !== style || $[18] !== zIndex ? (t9 = {
809
+ ...style,
810
+ zIndex
811
+ }, $[17] = style, $[18] = zIndex, $[19] = t9) : t9 = $[19];
812
+ let t10;
813
+ return $[20] !== children || $[21] !== handleFocus || $[22] !== position || $[23] !== rest || $[24] !== t8 || $[25] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.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;
814
+ }
815
+ const media = Object.values(css.BREAKPOINTS);
816
+ function _getMediaQuery(media2, index) {
817
+ 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)`;
818
+ }
819
+ function _createMediaStore() {
820
+ const mediaLen = media.length;
821
+ let sizes;
822
+ const getSizes = () => {
823
+ if (typeof window > "u")
824
+ return sizes;
825
+ if (!sizes) {
826
+ sizes = [];
827
+ for (let index = mediaLen; index > -1; index -= 1) {
828
+ const mediaQuery = _getMediaQuery(media, index);
829
+ sizes.push({
830
+ index,
831
+ mq: window.matchMedia(mediaQuery)
832
+ });
833
+ }
834
+ }
835
+ return sizes;
836
+ };
837
+ return {
838
+ getSnapshot: () => {
839
+ for (const {
840
+ index,
841
+ mq
842
+ } of getSizes() ?? [])
843
+ if (mq.matches) return index;
844
+ return 0;
845
+ },
846
+ subscribe: (onStoreChange) => {
847
+ const disposeFns = [];
848
+ for (const {
849
+ mq
850
+ } of getSizes() ?? []) {
851
+ const handleChange = () => {
852
+ mq.matches && onStoreChange();
853
+ };
854
+ mq.addEventListener("change", handleChange), disposeFns.push(() => mq.removeEventListener("change", handleChange));
855
+ }
856
+ return () => {
857
+ for (const disposeFn of disposeFns)
858
+ disposeFn();
859
+ };
860
+ }
861
+ };
862
+ }
863
+ function getServerSnapshot() {
864
+ return 0;
865
+ }
866
+ function useMediaIndex() {
867
+ const $ = compilerRuntime.c(1);
868
+ let t0, t1;
869
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = _createMediaStore(), $[0] = t1) : t1 = $[0], t0 = t1;
870
+ const store = t0;
871
+ return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
872
+ }
873
+ function LayerProvider(props) {
874
+ const $ = compilerRuntime.c(19), {
875
+ children,
876
+ zOffset: t0
877
+ } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = react.useContext(LayerContext);
878
+ let t1;
879
+ $[0] !== parentContextValue ? (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1) : t1 = $[1];
880
+ 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;
881
+ let t2;
882
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {}, $[2] = t2) : t2 = $[2];
883
+ const [, setChildLayers] = react.useState(t2), [size2, setSize] = react.useState(0), isTopLayer = size2 === 0;
884
+ let t3;
885
+ $[3] !== parentRegisterChild || $[4] !== setChildLayers ? (t3 = (childLevel) => {
886
+ const parentDispose = parentRegisterChild?.(childLevel);
887
+ return childLevel !== void 0 ? setChildLayers((state) => {
888
+ const prevLen = state[childLevel] ?? 0, nextState = {
889
+ ...state,
890
+ [childLevel]: prevLen + 1
891
+ };
892
+ return setSize(Object.keys(nextState).length), nextState;
893
+ }) : setSize(_temp$9), () => {
894
+ childLevel !== void 0 ? setChildLayers((state_0) => {
895
+ const nextState_0 = {
896
+ ...state_0
897
+ };
898
+ return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
899
+ }) : setSize(_temp2$2), parentDispose?.();
900
+ };
901
+ }, $[3] = parentRegisterChild, $[4] = setChildLayers, $[5] = t3) : t3 = $[5];
902
+ const registerChild = t3;
903
+ let t4, t5;
904
+ $[6] !== level || $[7] !== parentRegisterChild ? (t4 = () => parentRegisterChild?.(level), t5 = [level, parentRegisterChild], $[6] = level, $[7] = parentRegisterChild, $[8] = t4, $[9] = t5) : (t4 = $[8], t5 = $[9]), react.useEffect(t4, t5);
905
+ let t6, t7;
906
+ $[10] !== isTopLayer || $[11] !== level || $[12] !== registerChild || $[13] !== size2 || $[14] !== zIndex ? (t7 = {
907
+ version: 0,
908
+ isTopLayer,
909
+ level,
910
+ registerChild,
911
+ size: size2,
912
+ zIndex
913
+ }, $[10] = isTopLayer, $[11] = level, $[12] = registerChild, $[13] = size2, $[14] = zIndex, $[15] = t7) : t7 = $[15], t6 = t7;
914
+ const value = t6;
915
+ let t8;
916
+ return $[16] !== children || $[17] !== value ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(LayerContext.Provider, { value, children }), $[16] = children, $[17] = value, $[18] = t8) : t8 = $[18], t8;
917
+ }
918
+ function _temp2$2(v_0) {
919
+ return v_0 - 1;
920
+ }
921
+ function _temp$9(v) {
922
+ return v + 1;
923
+ }
924
+ const DEFAULT_LAYER_ELEMENT = "div";
925
+ function Layer(props) {
926
+ const $ = compilerRuntime.c(12), t0 = props;
927
+ let children, rest, t1, t2;
928
+ $[0] !== t0 ? ({
929
+ as: t1,
930
+ children,
931
+ zOffset: t2,
932
+ ...rest
933
+ } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = t2) : (children = $[1], rest = $[2], t1 = $[3], t2 = $[4]);
934
+ const as = t1 === void 0 ? DEFAULT_LAYER_ELEMENT : t1, zOffset = t2 === void 0 ? 1 : t2;
935
+ let t3;
936
+ $[5] !== as || $[6] !== children || $[7] !== rest ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(LayerCard, { ...rest, as, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t3) : t3 = $[8];
937
+ let t4;
938
+ return $[9] !== t3 || $[10] !== zOffset ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: t3 }), $[9] = t3, $[10] = zOffset, $[11] = t4) : t4 = $[11], t4;
939
+ }
940
+ function PopoverLayer(props) {
941
+ const $ = compilerRuntime.c(65);
942
+ let animate, arrow, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t0, xProp, yProp;
943
+ $[0] !== props ? ({
944
+ __unstable_margins: marginsProp,
945
+ animate,
946
+ arrow,
947
+ arrowRef,
948
+ arrowX,
949
+ arrowY,
950
+ children,
951
+ maxWidth,
952
+ padding,
953
+ placement,
954
+ originX,
955
+ originY,
956
+ overflow,
957
+ radius,
958
+ referenceWidth,
959
+ shadow,
960
+ strategy,
961
+ style,
962
+ tone: t0,
963
+ x: xProp,
964
+ y: yProp,
965
+ ...rest
966
+ } = props, $[0] = props, $[1] = animate, $[2] = arrow, $[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], arrow = $[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]);
967
+ const tone = t0 === void 0 ? "inherit" : t0;
968
+ let t1;
969
+ t1 = marginsProp || DEFAULT_POPOVER_MARGINS;
970
+ const margins = t1, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0];
971
+ let t2;
972
+ const t3 = animate ? "transform" : void 0;
973
+ let t4;
974
+ $[23] !== originX || $[24] !== originY || $[25] !== referenceWidth || $[26] !== style || $[27] !== t3 || $[28] !== x || $[29] !== y ? (t4 = {
975
+ left: x,
976
+ originX,
977
+ originY,
978
+ top: y,
979
+ width: referenceWidth,
980
+ willChange: t3,
981
+ ...style
982
+ }, $[23] = originX, $[24] = originY, $[25] = referenceWidth, $[26] = style, $[27] = t3, $[28] = x, $[29] = y, $[30] = t4) : t4 = $[30], t2 = t4;
983
+ const rootStyle = t2;
984
+ let t5;
985
+ const t6 = arrowX !== null ? arrowX : void 0, t7 = arrowY !== null ? arrowY : void 0;
986
+ let t8;
987
+ $[31] !== t6 || $[32] !== t7 ? (t8 = {
988
+ left: t6,
989
+ top: t7,
990
+ right: void 0,
991
+ bottom: void 0
992
+ }, $[31] = t6, $[32] = t7, $[33] = t8) : t8 = $[33], t5 = t8;
993
+ const arrowStyle = t5;
994
+ let t9;
995
+ $[34] === Symbol.for("react.memo_cache_sentinel") ? (t9 = css.popoverCard(), $[34] = t9) : t9 = $[34];
996
+ let t10;
997
+ $[35] !== animate ? (t10 = animate ? ["hidden", "initial"] : void 0, $[35] = animate, $[36] = t10) : t10 = $[36];
998
+ let t11;
999
+ $[37] !== animate ? (t11 = animate ? ["visible", "scaleIn"] : void 0, $[37] = animate, $[38] = t11) : t11 = $[38];
1000
+ let t12;
1001
+ $[39] !== animate ? (t12 = animate ? ["hidden", "scaleOut"] : void 0, $[39] = animate, $[40] = t12) : t12 = $[40];
1002
+ let t13;
1003
+ $[41] !== children || $[42] !== padding ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { direction: "column", flex: 1, padding, children }), $[41] = children, $[42] = padding, $[43] = t13) : t13 = $[43];
1004
+ let t14;
1005
+ $[44] !== maxWidth || $[45] !== overflow || $[46] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, maxWidth, overflow, children: t13 }), $[44] = maxWidth, $[45] = overflow, $[46] = t13, $[47] = t14) : t14 = $[47];
1006
+ let t15;
1007
+ $[48] !== arrow || $[49] !== arrowRef || $[50] !== arrowStyle ? (t15 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[48] = arrow, $[49] = arrowRef, $[50] = arrowStyle, $[51] = t15) : t15 = $[51];
1008
+ let t16;
1009
+ 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__ */ jsxRuntime.jsxs(Layer, { className: t9, "data-ui": "Popover", ...rest, as: framerMotion.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: [
1010
+ t14,
1011
+ t15
1012
+ ] }), $[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;
1013
+ }
1014
+ const DEFAULT_POPOVER_ELEMENT = "div";
1015
+ function ViewportOverlay() {
1016
+ const $ = compilerRuntime.c(2), {
1017
+ zIndex
1018
+ } = useLayer();
1019
+ let t0;
1020
+ return $[0] !== zIndex ? (t0 = /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1021
+ position: "fixed",
1022
+ inset: 0,
1023
+ width: "100vw",
1024
+ height: "100vh",
1025
+ zIndex
1026
+ } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
1027
+ }
1028
+ function Popover(props) {
1029
+ const boundaryElementContext = useBoundaryElement(), {
1030
+ __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
1031
+ animate: _animate = !1,
1032
+ arrow: arrowProp = !1,
1033
+ as = DEFAULT_POPOVER_ELEMENT,
1034
+ children: childProp,
1035
+ className,
1036
+ constrainSize = !1,
1037
+ content: content2,
1038
+ disabled,
1039
+ fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
1040
+ matchReferenceWidth,
1041
+ floatingBoundary = boundaryElementContext.element,
1042
+ modal,
1043
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1044
+ onActivate,
1045
+ open,
1046
+ overflow = "hidden",
1047
+ padding,
1048
+ placement: placementProp = "bottom",
1049
+ placementStrategy = "flip",
1050
+ portal,
1051
+ preventOverflow = !0,
1052
+ radius = 3,
1053
+ ref: forwardedRef,
1054
+ referenceBoundary = boundaryElementContext.element,
1055
+ referenceElement,
1056
+ scheme,
1057
+ shadow = 3,
1058
+ tone = "inherit",
1059
+ width: widthProp = "auto",
1060
+ zOffset: zOffsetProp = Z_OFFSETS.popover,
1061
+ updateRef,
1062
+ ...rest
1063
+ } = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, zOffset = useResponsiveProp(zOffsetProp), ref = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
1064
+ react.useImperativeHandle(forwardedRef, () => ref.current);
1065
+ const referenceWidthRef = react.useRef(void 0), middleware = react.useMemo(() => {
1066
+ const ret = [];
1067
+ return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(reactDom$1.autoPlacement({
1068
+ allowedPlacements: [placementProp].concat(fallbackPlacements)
1069
+ })) : ret.push(reactDom$1.flip({
1070
+ boundary: floatingBoundary || void 0,
1071
+ fallbackPlacements,
1072
+ padding: DEFAULT_POPOVER_PADDING,
1073
+ rootBoundary
1074
+ }))), ret.push(reactDom$1.offset({
1075
+ mainAxis: DEFAULT_POPOVER_DISTANCE
1076
+ })), (constrainSize || matchReferenceWidth) && ret.push(size({
1077
+ apply({
1078
+ availableWidth,
1079
+ availableHeight,
1080
+ elements,
1081
+ referenceWidth
1082
+ }) {
1083
+ referenceWidthRef.current = referenceWidth, matchReferenceWidth && (elements.floating.style.width = `${referenceWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${availableWidth}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
1084
+ },
1085
+ boundaryElement: floatingBoundary || void 0,
1086
+ margins,
1087
+ padding: DEFAULT_POPOVER_PADDING
1088
+ })), preventOverflow && ret.push(reactDom$1.shift({
1089
+ boundary: floatingBoundary || void 0,
1090
+ rootBoundary,
1091
+ padding: DEFAULT_POPOVER_PADDING
1092
+ })), arrowProp && ret.push(reactDom$1.arrow({
1093
+ element: arrowRef,
1094
+ padding: DEFAULT_POPOVER_PADDING
1095
+ })), animate && ret.push(origin), ret.push(reactDom$1.hide({
1096
+ boundary: referenceBoundary || void 0,
1097
+ padding: DEFAULT_POPOVER_PADDING,
1098
+ strategy: "referenceHidden"
1099
+ })), ret;
1100
+ }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1101
+ x,
1102
+ y,
1103
+ middlewareData,
1104
+ placement,
1105
+ refs,
1106
+ strategy,
1107
+ update
1108
+ } = reactDom$1.useFloating({
1109
+ middleware,
1110
+ placement: placementProp,
1111
+ whileElementsMounted: reactDom$1.autoUpdate,
1112
+ elements: referenceElement ? {
1113
+ reference: referenceElement
1114
+ } : void 0
1115
+ }), referenceHidden = middlewareData.hide?.referenceHidden, arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, setArrow = react.useCallback((arrowEl) => {
1116
+ arrowRef.current = arrowEl;
1117
+ }, []), setFloating = react.useCallback((node) => {
1118
+ ref.current = node, refs.setFloating(node);
1119
+ }, [refs]), setReference = react.useCallback((node_0) => {
1120
+ if (refs.setReference(node_0), !childProp) return;
1121
+ const childRef = getElementRef(childProp);
1122
+ typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
1123
+ }, [childProp, refs]), child = react.useMemo(() => referenceElement ? childProp : childProp ? react.cloneElement(childProp, {
1124
+ ref: setReference
1125
+ }) : null, [childProp, referenceElement, setReference]);
1126
+ if (react.useEffect(() => {
1127
+ updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
1128
+ }, [update, updateRef]), disabled)
1129
+ return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
1130
+ const node_1 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1131
+ modal && /* @__PURE__ */ jsxRuntime.jsx(ViewportOverlay, {}),
1132
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.popover({
1133
+ className
1134
+ }), hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, x, y, zOffset, children: content2 })
1135
+ ] }), children = open && (portal ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card.tone : tone, scheme: scheme ?? "light", children: node_1 }) }) : node_1);
1136
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1137
+ animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
1138
+ child
1139
+ ] });
1140
+ }
1141
+ const DEFAULT_SELECTABLE_ELEMENT = "button";
1142
+ function Selectable(props) {
1143
+ const $ = compilerRuntime.c(16), t0 = props;
1144
+ let className, radius, rest, selected, t1, tone;
1145
+ $[0] !== t0 ? ({
1146
+ as: t1,
1147
+ className,
1148
+ radius,
1149
+ selected,
1150
+ tone,
1151
+ ...rest
1152
+ } = 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]);
1153
+ const as = t1 === void 0 ? DEFAULT_SELECTABLE_ELEMENT : t1;
1154
+ let t2;
1155
+ $[7] !== className || $[8] !== radius || $[9] !== tone ? (t2 = css._selectable({
1156
+ className,
1157
+ radius,
1158
+ tone
1159
+ }), $[7] = className, $[8] = radius, $[9] = tone, $[10] = t2) : t2 = $[10];
1160
+ const t3 = selected ? "" : void 0;
1161
+ let t4;
1162
+ return $[11] !== as || $[12] !== rest || $[13] !== t2 || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, as, className: t2, "data-selected": t3 }), $[11] = as, $[12] = rest, $[13] = t2, $[14] = t3, $[15] = t4) : t4 = $[15], t4;
1163
+ }
1164
+ const DEFAULT_STACK_ELEMENT = "div";
1165
+ function Stack(props) {
1166
+ const $ = compilerRuntime.c(12), t0 = props;
1167
+ let className, gap, rest, t1;
1168
+ $[0] !== t0 ? ({
1169
+ as: t1,
1170
+ className,
1171
+ gap,
1172
+ ...rest
1173
+ } = t0, $[0] = t0, $[1] = className, $[2] = gap, $[3] = rest, $[4] = t1) : (className = $[1], gap = $[2], rest = $[3], t1 = $[4]);
1174
+ const as = t1 === void 0 ? DEFAULT_STACK_ELEMENT : t1;
1175
+ let t2;
1176
+ $[5] !== className ? (t2 = css.stack({
1177
+ className
1178
+ }), $[5] = className, $[6] = t2) : t2 = $[6];
1179
+ let t3;
1180
+ return $[7] !== as || $[8] !== gap || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.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;
1181
+ }
1182
+ function useCustomValidity(ref, customValidity) {
1183
+ const $ = compilerRuntime.c(6);
1184
+ let t0;
1185
+ $[0] !== customValidity || $[1] !== ref.current ? (t0 = () => {
1186
+ ref.current?.setCustomValidity(customValidity || "");
1187
+ }, $[0] = customValidity, $[1] = ref.current, $[2] = t0) : t0 = $[2];
1188
+ let t1;
1189
+ $[3] !== customValidity || $[4] !== ref ? (t1 = [customValidity, ref], $[3] = customValidity, $[4] = ref, $[5] = t1) : t1 = $[5], react.useEffect(t0, t1);
1190
+ }
1191
+ const DEFAULT_TEXT_INPUT_ELEMENT = "input";
1192
+ function TextInput(props) {
1193
+ const $ = compilerRuntime.c(88), t0 = props;
1194
+ let IconComponent, IconRightComponent, __unstable_disableFocusRing, className, clearButton, customValidity, forwardedRef, onClear, prefix, readOnly, rest, suffix, t1, t2, t3, t4, t5, t6, t7, t8, width;
1195
+ if ($[0] !== t0) {
1196
+ const {
1197
+ __unstable_disableFocusRing: t92,
1198
+ as: t102,
1199
+ border: t112,
1200
+ className: t122,
1201
+ clearButton: t132,
1202
+ disabled: t142,
1203
+ fontSize: t152,
1204
+ gap: t162,
1205
+ icon: t172,
1206
+ iconRight: t182,
1207
+ onClear: t192,
1208
+ padding: t202,
1209
+ prefix: t212,
1210
+ radius: t222,
1211
+ readOnly: t232,
1212
+ ref: t242,
1213
+ suffix: t252,
1214
+ customValidity: t262,
1215
+ type: t272,
1216
+ weight: _width,
1217
+ width: t282,
1218
+ ...t292
1219
+ } = t0;
1220
+ __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;
1221
+ } else
1222
+ 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];
1223
+ 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 = react.useRef(null), responsivePadding = useResponsiveProp(padding), withClearButton = !!clearButton;
1224
+ let t9;
1225
+ $[22] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => ref.current, $[22] = t9) : t9 = $[22], react.useImperativeHandle(forwardedRef, t9), useCustomValidity(ref, customValidity);
1226
+ const handleClearMouseDown = _temp$8;
1227
+ let t10;
1228
+ $[23] !== onClear ? (t10 = (event_0) => {
1229
+ event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
1230
+ }, $[23] = onClear, $[24] = t10) : t10 = $[24];
1231
+ const handleClearClick = t10;
1232
+ let t11, t12;
1233
+ $[25] !== responsivePadding ? (t12 = Object.fromEntries(Object.entries(responsivePadding).map(_temp2$1)), $[25] = responsivePadding, $[26] = t12) : t12 = $[26], t11 = t12;
1234
+ const clearButtonBoxPadding = t11;
1235
+ let t13, t14;
1236
+ $[27] !== responsivePadding ? (t14 = Object.fromEntries(Object.entries(responsivePadding).map(_temp3)), $[27] = responsivePadding, $[28] = t14) : t14 = $[28], t13 = t14;
1237
+ const clearButtonPadding = t13;
1238
+ let t15;
1239
+ t15 = isRecord(clearButton) ? clearButton : EMPTY_RECORD;
1240
+ const clearButtonProps = t15;
1241
+ let t16;
1242
+ $[29] !== border || $[30] !== className || $[31] !== fontSize || $[32] !== gap || $[33] !== padding || $[34] !== radius || $[35] !== width ? (t16 = css.textInput({
1243
+ className,
1244
+ border,
1245
+ fontSize,
1246
+ padding,
1247
+ radius,
1248
+ gap,
1249
+ width
1250
+ }), $[29] = border, $[30] = className, $[31] = fontSize, $[32] = gap, $[33] = padding, $[34] = radius, $[35] = width, $[36] = t16) : t16 = $[36];
1251
+ 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;
1252
+ let t23;
1253
+ $[37] !== prefix ? (t23 = prefix && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.textInputPrefix(), sizing: "border", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: prefix }) }), $[37] = prefix, $[38] = t23) : t23 = $[38];
1254
+ let t24;
1255
+ $[39] === Symbol.for("react.memo_cache_sentinel") ? (t24 = css.textInputElement(), $[39] = t24) : t24 = $[39];
1256
+ let t25;
1257
+ $[40] === Symbol.for("react.memo_cache_sentinel") ? (t25 = css._inputElement(), $[40] = t25) : t25 = $[40];
1258
+ const t26 = __unstable_disableFocusRing ? "" : void 0;
1259
+ let t27;
1260
+ $[41] !== Element2 || $[42] !== disabled || $[43] !== readOnly || $[44] !== rest || $[45] !== t26 || $[46] !== type ? (t27 = /* @__PURE__ */ jsxRuntime.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];
1261
+ let t28;
1262
+ $[48] === Symbol.for("react.memo_cache_sentinel") ? (t28 = css._inputPresentation(), $[48] = t28) : t28 = $[48];
1263
+ let t29;
1264
+ $[49] !== IconComponent || $[50] !== fontSize || $[51] !== padding ? (t29 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, position: "absolute", insetTop: 0, insetLeft: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
1265
+ react.isValidElement(IconComponent) && IconComponent,
1266
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
1267
+ ] }) }), $[49] = IconComponent, $[50] = fontSize, $[51] = padding, $[52] = t29) : t29 = $[52];
1268
+ let t30;
1269
+ $[53] !== IconRightComponent || $[54] !== fontSize || $[55] !== padding || $[56] !== withClearButton ? (t30 = !withClearButton && IconRightComponent && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, position: "absolute", insetTop: 0, insetRight: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
1270
+ react.isValidElement(IconRightComponent) && IconRightComponent,
1271
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
1272
+ ] }) }), $[53] = IconRightComponent, $[54] = fontSize, $[55] = padding, $[56] = withClearButton, $[57] = t30) : t30 = $[57];
1273
+ let t31;
1274
+ $[58] !== t29 || $[59] !== t30 ? (t31 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t28, position: "absolute", children: [
1275
+ t29,
1276
+ t30
1277
+ ] }), $[58] = t29, $[59] = t30, $[60] = t31) : t31 = $[60];
1278
+ let t32;
1279
+ $[61] !== clearButton || $[62] !== clearButtonBoxPadding || $[63] !== clearButtonPadding || $[64] !== clearButtonProps || $[65] !== disabled || $[66] !== fontSize || $[67] !== handleClearClick || $[68] !== radius || $[69] !== readOnly ? (t32 = !disabled && !readOnly && clearButton && /* @__PURE__ */ jsxRuntime.jsx(Box, { insetTop: 0, insetRight: 0, padding: clearButtonBoxPadding, position: "absolute", style: {
1280
+ zIndex: 2
1281
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Clear", "data-qa": "clear-button", display: "block", fontSize, icon: icons.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];
1282
+ let t33;
1283
+ $[71] !== t27 || $[72] !== t31 || $[73] !== t32 ? (t33 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t24, flex: 1, position: "relative", children: [
1284
+ t27,
1285
+ t31,
1286
+ t32
1287
+ ] }), $[71] = t27, $[72] = t31, $[73] = t32, $[74] = t33) : t33 = $[74];
1288
+ let t34;
1289
+ $[75] !== suffix ? (t34 = suffix && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.textInputSuffix(), sizing: "border", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: suffix }) }), $[75] = suffix, $[76] = t34) : t34 = $[76];
1290
+ let t35;
1291
+ return $[77] !== t16 || $[78] !== t17 || $[79] !== t18 || $[80] !== t19 || $[81] !== t20 || $[82] !== t21 || $[83] !== t22 || $[84] !== t23 || $[85] !== t33 || $[86] !== t34 ? (t35 = /* @__PURE__ */ jsxRuntime.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: [
1292
+ t23,
1293
+ t33,
1294
+ t34
1295
+ ] }), $[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;
1296
+ }
1297
+ function _temp3(t0) {
1298
+ const [key_0, value_0] = t0;
1299
+ 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];
1300
+ }
1301
+ function _temp2$1(t0) {
1302
+ const [key2, value] = t0;
1303
+ return value === 0 ? [key2, 0] : value === 1 ? [key2, 1] : value === 2 ? [key2, 1] : [key2, typeof value == "number" ? value - 2 : 0];
1304
+ }
1305
+ function _temp$8(event) {
1306
+ event.preventDefault(), event.stopPropagation();
1307
+ }
50
1308
  function AutocompleteOption(props) {
51
1309
  const $ = compilerRuntime.c(11), {
52
1310
  children,
@@ -64,7 +1322,7 @@ function AutocompleteOption(props) {
64
1322
  const handleClick = t0;
65
1323
  let t1;
66
1324
  $[3] !== handleClick ? (t1 = (event) => {
67
- event.key === "Enter" && !_visualEditing._isEnterToClickElement(event.currentTarget) && handleClick();
1325
+ event.key === "Enter" && !_isEnterToClickElement(event.currentTarget) && handleClick();
68
1326
  }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
69
1327
  const handleKeyDown = t1;
70
1328
  let t2;
@@ -120,7 +1378,7 @@ function Autocomplete(props) {
120
1378
  fontSize = 2,
121
1379
  icon,
122
1380
  id,
123
- listBox = _visualEditing.EMPTY_RECORD,
1381
+ listBox = EMPTY_RECORD,
124
1382
  loading,
125
1383
  onBlur,
126
1384
  onChange,
@@ -131,7 +1389,7 @@ function Autocomplete(props) {
131
1389
  openOnFocus,
132
1390
  options: optionsProp,
133
1391
  padding: paddingProp = 3,
134
- popover = _visualEditing.EMPTY_RECORD,
1392
+ popover = EMPTY_RECORD,
135
1393
  prefix,
136
1394
  radius = 2,
137
1395
  readOnly,
@@ -157,9 +1415,9 @@ function Autocomplete(props) {
157
1415
  value
158
1416
  } = state, defaultRenderOption = react.useCallback(({
159
1417
  value: value_0
160
- }) => /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
1418
+ }) => /* @__PURE__ */ jsxRuntime.jsx(Selectable, { as: "button", padding: paddingProp, radius: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
161
1419
  react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
162
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing.useResponsiveProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
1420
+ const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY, padding = useResponsiveProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
163
1421
  setTimeout(() => {
164
1422
  if (popoverMouseWithinRef.current)
165
1423
  return;
@@ -283,11 +1541,11 @@ function Autocomplete(props) {
283
1541
  "aria-label": "Clear",
284
1542
  onFocus: handleClearButtonFocus
285
1543
  };
286
- }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.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 = react.useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
1544
+ }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.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 = react.useMemo(() => Object.values(padding).map((v_0) => Math.max(v_0 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
287
1545
  dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
288
- }, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.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 && _visualEditing.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 = react.useCallback((event_5) => {
1546
+ }, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Open", disabled: expanded, display: "block", fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), input = /* @__PURE__ */ jsxRuntime.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 = react.useCallback((event_5) => {
289
1547
  event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
290
- }, [listFocused]), content2 = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: filteredOptions.map((option_0) => {
1548
+ }, [listFocused]), content2 = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", gap: 1, id: listBoxId, ref: listBoxElementRef, role: "listbox", children: filteredOptions.map((option_0) => {
291
1549
  const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
292
1550
  return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
293
1551
  disabled: loading,
@@ -300,7 +1558,7 @@ function Autocomplete(props) {
300
1558
  inputElement: inputElementRef.current,
301
1559
  onMouseEnter: handlePopoverMouseEnter,
302
1560
  onMouseLeave: handlePopoverMouseLeave
303
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.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]);
1561
+ }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.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]);
304
1562
  return (
305
1563
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
306
1564
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
@@ -309,6 +1567,40 @@ function Autocomplete(props) {
309
1567
  ] })
310
1568
  );
311
1569
  }
1570
+ function useClickOutsideEvent(listener, t0, boundaryElement) {
1571
+ const $ = compilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$7 : t0;
1572
+ let t1;
1573
+ $[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
1574
+ if (!listener)
1575
+ return;
1576
+ const target = evt.target;
1577
+ if (!(target instanceof Node))
1578
+ return;
1579
+ const resolvedBoundaryElement = boundaryElement?.();
1580
+ if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
1581
+ return;
1582
+ const elements = elementsArg().flat();
1583
+ for (const el of elements)
1584
+ if (el && (target === el || el.contains(target)))
1585
+ return;
1586
+ listener(evt);
1587
+ }, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
1588
+ const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
1589
+ let t2;
1590
+ $[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
1591
+ if (!hasListener)
1592
+ return;
1593
+ const handleEvent = (evt_0) => onEvent(evt_0);
1594
+ return document.addEventListener("mousedown", handleEvent), () => {
1595
+ document.removeEventListener("mousedown", handleEvent);
1596
+ };
1597
+ }, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
1598
+ let t3;
1599
+ $[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
1600
+ }
1601
+ function _temp$7() {
1602
+ return EMPTY_ARRAY;
1603
+ }
312
1604
  const DEFAULT_BREADCRUMBS_ELEMENT = "nav";
313
1605
  function Breadcrumbs(props) {
314
1606
  const {
@@ -323,20 +1615,20 @@ function Breadcrumbs(props) {
323
1615
  separator,
324
1616
  ...rest
325
1617
  } = props, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
326
- _visualEditing.useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
1618
+ useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
327
1619
  const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = react.useMemo(() => {
328
1620
  const len = rawItems.length;
329
1621
  if (maxLength && len > maxLength) {
330
1622
  const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
331
- return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { constrainSize: !0, content: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", gap: gapY, overflow: "auto", children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: open ? collapse : expand, ref: expandElementRef, selected: open }) }, "button"), ...rawItems.slice(len - afterLength)];
1623
+ return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsxRuntime.jsx(Popover, { constrainSize: !0, content: /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ol", gap: gapY, overflow: "auto", children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, padding: 2, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { mode: "bleed", padding: 0, text: "\u2026", ...expandButtonProps, onClick: open ? collapse : expand, ref: expandElementRef, selected: open }) }, "button"), ...rawItems.slice(len - afterLength)];
332
1624
  }
333
1625
  return rawItems;
334
1626
  }, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]);
335
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: css.breadcrumbs({
1627
+ return /* @__PURE__ */ jsxRuntime.jsx(Flex, { as, "data-ui": "Breadcrumbs", ...rest, className: css.breadcrumbs({
336
1628
  className
337
1629
  }), gap, gapX, gapY, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
338
- itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
339
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
1630
+ itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { "aria-hidden": !0, as: "li", children: separator || /* @__PURE__ */ jsxRuntime.jsx(Text, { muted: !0, children: "/" }) }),
1631
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "li", children: item })
340
1632
  ] }, itemIndex)) });
341
1633
  }
342
1634
  const DEFAULT_CONTAINER_ELEMENT = "div";
@@ -356,10 +1648,23 @@ function Container(props) {
356
1648
  width
357
1649
  }), $[5] = className, $[6] = width, $[7] = t3) : t3 = $[7];
358
1650
  let t4;
359
- return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
1651
+ return $[8] !== as || $[9] !== rest || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Container", ...rest, as, className: t3 }), $[8] = as, $[9] = rest, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
1652
+ }
1653
+ function useGlobalKeyDown(onKeyDown) {
1654
+ const $ = compilerRuntime.c(5);
1655
+ let t0;
1656
+ $[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
1657
+ const handleKeyDown = useEffectEvent.useEffectEvent(t0);
1658
+ let t1;
1659
+ $[2] !== handleKeyDown ? (t1 = () => {
1660
+ const handler = (event_0) => handleKeyDown(event_0);
1661
+ return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
1662
+ }, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
1663
+ let t2;
1664
+ $[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
360
1665
  }
361
1666
  function isTargetWithinScope(boundaryElement, portalElement, target) {
362
- return !boundaryElement || !portalElement ? !0 : _visualEditing.containsOrEqualsElement(boundaryElement, target) || _visualEditing.containsOrEqualsElement(portalElement, target);
1667
+ return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
363
1668
  }
364
1669
  const DEFAULT_DIALOG_CARD_ELEMENT = "div";
365
1670
  function DialogCard(props) {
@@ -380,7 +1685,7 @@ function DialogCard(props) {
380
1685
  ref: forwardedRef,
381
1686
  ...rest
382
1687
  } = t0, $[0] = t0, $[1] = autoFocus, $[2] = children, $[3] = footer, $[4] = forwardedContentRef, $[5] = forwardedRef, $[6] = header, $[7] = hideCloseButton, $[8] = id, $[9] = onClickOutside, $[10] = onClose, $[11] = portalProp, $[12] = rest, $[13] = t1) : (autoFocus = $[1], children = $[2], footer = $[3], forwardedContentRef = $[4], forwardedRef = $[5], header = $[6], hideCloseButton = $[7], id = $[8], onClickOutside = $[9], onClose = $[10], portalProp = $[11], rest = $[12], t1 = $[13]);
383
- const as = t1 === void 0 ? DEFAULT_DIALOG_CARD_ELEMENT : t1, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, ref = react.useRef(null), contentRef = react.useRef(null), layer = _visualEditing.useLayer(), {
1688
+ const as = t1 === void 0 ? DEFAULT_DIALOG_CARD_ELEMENT : t1, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, ref = react.useRef(null), contentRef = react.useRef(null), layer = useLayer(), {
384
1689
  isTopLayer
385
1690
  } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton, [scrollTop, setScrollTop] = react.useState(0), [scrollHeight, setScrollHeight] = react.useState(0), scrollBottom = scrollHeight - scrollTop;
386
1691
  let t2;
@@ -397,14 +1702,14 @@ function DialogCard(props) {
397
1702
  return;
398
1703
  const target = document.activeElement;
399
1704
  target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
400
- }, $[19] = boundaryElement, $[20] = isTopLayer, $[21] = onClose, $[22] = portalElement, $[23] = t6) : t6 = $[23], _visualEditing.useGlobalKeyDown(t6);
1705
+ }, $[19] = boundaryElement, $[20] = isTopLayer, $[21] = onClose, $[22] = portalElement, $[23] = t6) : t6 = $[23], useGlobalKeyDown(t6);
401
1706
  let t7;
402
1707
  $[24] !== boundaryElement || $[25] !== isTopLayer || $[26] !== onClickOutside || $[27] !== portalElement ? (t7 = isTopLayer && onClickOutside && ((event_0) => {
403
1708
  const target_0 = event_0.target;
404
1709
  target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
405
1710
  }), $[24] = boundaryElement, $[25] = isTopLayer, $[26] = onClickOutside, $[27] = portalElement, $[28] = t7) : t7 = $[28];
406
1711
  let t8;
407
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[29] = t8) : t8 = $[29], _visualEditing.useClickOutsideEvent(t7, t8);
1712
+ $[29] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => [ref.current], $[29] = t8) : t8 = $[29], useClickOutsideEvent(t7, t8);
408
1713
  let t10, t9;
409
1714
  $[30] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
410
1715
  const el = contentRef.current;
@@ -422,9 +1727,9 @@ function DialogCard(props) {
422
1727
  let t11;
423
1728
  $[32] === Symbol.for("react.memo_cache_sentinel") ? (t11 = css.dialogCard(), $[32] = t11) : t11 = $[32];
424
1729
  let t12;
425
- $[33] !== header || $[34] !== labelId || $[35] !== onClose || $[36] !== showCloseButton || $[37] !== showHeader ? (t12 = showHeader && /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { align: "flex-start", className: css.dialogHeader(), padding: 3, position: "relative", children: [
426
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
427
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
1730
+ $[33] !== header || $[34] !== labelId || $[35] !== onClose || $[36] !== showCloseButton || $[37] !== showHeader ? (t12 = showHeader && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { align: "flex-start", className: css.dialogHeader(), padding: 3, position: "relative", children: [
1731
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
1732
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
428
1733
  ] }), $[33] = header, $[34] = labelId, $[35] = onClose, $[36] = showCloseButton, $[37] = showHeader, $[38] = t12) : t12 = $[38];
429
1734
  let t13;
430
1735
  $[39] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContent(), $[39] = t13) : t13 = $[39];
@@ -435,27 +1740,27 @@ function DialogCard(props) {
435
1740
  let t15;
436
1741
  $[43] === Symbol.for("react.memo_cache_sentinel") ? (t15 = css.dialogScroller(), $[43] = t15) : t15 = $[43];
437
1742
  let t16;
438
- $[44] !== children ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: t15, overflow: "auto", ref: contentRef, children }), $[44] = children, $[45] = t16) : t16 = $[45];
1743
+ $[44] !== children ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: t15, overflow: "auto", ref: contentRef, children }), $[44] = children, $[45] = t16) : t16 = $[45];
439
1744
  let t17;
440
1745
  $[46] !== footer || $[47] !== scrollBottom ? (t17 = footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: css.dialogScrollerShadowBottom(), style: {
441
1746
  opacity: Math.min(scrollBottom, 32) / 32
442
1747
  } }), $[46] = footer, $[47] = scrollBottom, $[48] = t17) : t17 = $[48];
443
1748
  let t18;
444
- $[49] !== t14 || $[50] !== t16 || $[51] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: t13, flex: 1, position: "relative", tabIndex: -1, children: [
1749
+ $[49] !== t14 || $[50] !== t16 || $[51] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t13, flex: 1, position: "relative", tabIndex: -1, children: [
445
1750
  t14,
446
1751
  t16,
447
1752
  t17
448
1753
  ] }), $[49] = t14, $[50] = t16, $[51] = t17, $[52] = t18) : t18 = $[52];
449
1754
  let t19;
450
- $[53] !== footer ? (t19 = footer && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { className: css.dialogFooter(), position: "relative", children: footer }), $[53] = footer, $[54] = t19) : t19 = $[54];
1755
+ $[53] !== footer ? (t19 = footer && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: css.dialogFooter(), position: "relative", children: footer }), $[53] = footer, $[54] = t19) : t19 = $[54];
451
1756
  let t20;
452
- return $[55] !== as || $[56] !== rest || $[57] !== t12 || $[58] !== t18 || $[59] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Card, { ...rest, as, className: t11, display: "flex", flexDirection: "column", ref, children: [
1757
+ return $[55] !== as || $[56] !== rest || $[57] !== t12 || $[58] !== t18 || $[59] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(Card, { ...rest, as, className: t11, display: "flex", flexDirection: "column", ref, children: [
453
1758
  t12,
454
1759
  t18,
455
1760
  t19
456
1761
  ] }), $[55] = as, $[56] = rest, $[57] = t12, $[58] = t18, $[59] = t19, $[60] = t20) : t20 = $[60], t20;
457
1762
  }
458
- const DialogContext = _visualEditing.createGlobalScopedContext("@sanity/ui/v3/dialog", {
1763
+ const DialogContext = createGlobalScopedContext("@sanity/ui/v3/dialog", {
459
1764
  version: 0
460
1765
  });
461
1766
  function useDialog() {
@@ -490,7 +1795,7 @@ function Dialog(props) {
490
1795
  tone,
491
1796
  ...rest
492
1797
  } = t0, $[0] = t0, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = className, $[5] = contentRef, $[6] = footer, $[7] = header, $[8] = id, $[9] = onActivate, $[10] = onClickOutside, $[11] = onClose, $[12] = onFocus, $[13] = portalProp, $[14] = rest, $[15] = scheme, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = tone) : (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], className = $[4], contentRef = $[5], footer = $[6], header = $[7], id = $[8], onActivate = $[9], onClickOutside = $[10], onClose = $[11], onFocus = $[12], portalProp = $[13], rest = $[14], scheme = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], tone = $[23]);
493
- const autoFocus = t1 === void 0 ? !0 : t1, hideCloseButton = t2 === void 0 ? !1 : t2, _animate = t3 === void 0 ? !1 : t3, cardRadiusProp = t4 === void 0 ? 4 : t4, padding = t5 === void 0 ? 3 : t5, cardShadow = t6 === void 0 ? 4 : t6, width = t7 === void 0 ? 0 : t7, positionProp = _positionProp ?? context.position ?? "fixed", zOffsetProp = _zOffsetProp ?? context.zOffset ?? _visualEditing.Z_OFFSETS.dialog, animate = _visualEditing.usePrefersReducedMotion() ? !1 : _animate, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, cardRadius = _visualEditing.useResponsiveProp(cardRadiusProp), position = _visualEditing.useResponsiveProp(positionProp), zOffset = _visualEditing.useResponsiveProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
1798
+ const autoFocus = t1 === void 0 ? !0 : t1, hideCloseButton = t2 === void 0 ? !1 : t2, _animate = t3 === void 0 ? !1 : t3, cardRadiusProp = t4 === void 0 ? 4 : t4, padding = t5 === void 0 ? 3 : t5, cardShadow = t6 === void 0 ? 4 : t6, width = t7 === void 0 ? 0 : t7, positionProp = _positionProp ?? context.position ?? "fixed", zOffsetProp = _zOffsetProp ?? context.zOffset ?? Z_OFFSETS.dialog, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useResponsiveProp(cardRadiusProp), position = useResponsiveProp(positionProp), zOffset = useResponsiveProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
494
1799
  let t8;
495
1800
  $[24] !== onFocus ? (t8 = (event) => {
496
1801
  onFocus?.(event);
@@ -499,68 +1804,342 @@ function Dialog(props) {
499
1804
  focusLastDescendant(cardElement);
500
1805
  return;
501
1806
  }
502
- if (cardElement && target === postDivRef.current) {
503
- focusFirstDescendant(cardElement);
1807
+ if (cardElement && target === postDivRef.current) {
1808
+ focusFirstDescendant(cardElement);
1809
+ return;
1810
+ }
1811
+ isHTMLElement(event.target) && (focusedElementRef.current = event.target);
1812
+ }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
1813
+ const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
1814
+ let t9;
1815
+ $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
1816
+ rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
1817
+ const activeElement = document.activeElement;
1818
+ if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
1819
+ const target_0 = focusedElementRef.current;
1820
+ if (!target_0 || !document.body.contains(target_0)) {
1821
+ const cardElement_0 = cardRef.current;
1822
+ cardElement_0 && focusFirstDescendant(cardElement_0);
1823
+ return;
1824
+ }
1825
+ target_0.focus();
1826
+ }
1827
+ }, 0);
1828
+ }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
1829
+ const handleRootClick = t9;
1830
+ let t10;
1831
+ $[29] !== className ? (t10 = css.dialog({
1832
+ className
1833
+ }), $[29] = className, $[30] = t10) : t10 = $[30];
1834
+ const t11 = animate ? "" : void 0;
1835
+ let t12;
1836
+ $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
1837
+ let t13;
1838
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContainer(), $[32] = t13) : t13 = $[32];
1839
+ let t14;
1840
+ $[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__ */ jsxRuntime.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];
1841
+ let t15;
1842
+ $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsxRuntime.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];
1843
+ let t16;
1844
+ $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
1845
+ let t17;
1846
+ $[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__ */ jsxRuntime.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: [
1847
+ t12,
1848
+ t15,
1849
+ t16
1850
+ ] }), $[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];
1851
+ let t18;
1852
+ return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
1853
+ }
1854
+ function DialogProvider(props) {
1855
+ const $ = compilerRuntime.c(6), {
1856
+ children,
1857
+ position,
1858
+ zOffset
1859
+ } = props;
1860
+ let t0, t1;
1861
+ $[0] !== position || $[1] !== zOffset ? (t1 = {
1862
+ version: 0,
1863
+ position,
1864
+ zOffset
1865
+ }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
1866
+ const contextValue = t0;
1867
+ let t2;
1868
+ return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
1869
+ }
1870
+ const DEFAULT_KBD_ELEMENT = "kbd";
1871
+ function KBD(props) {
1872
+ const $ = compilerRuntime.c(22), t0 = props;
1873
+ let children, className, rest, t1, t2, t3, t4, t5;
1874
+ $[0] !== t0 ? ({
1875
+ as: t1,
1876
+ children,
1877
+ className,
1878
+ display: t2,
1879
+ fontSize: t3,
1880
+ padding: t4,
1881
+ radius: t5,
1882
+ ...rest
1883
+ } = 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]);
1884
+ 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;
1885
+ let t7;
1886
+ $[9] !== className || $[10] !== radius ? (t7 = css.kbd({
1887
+ className,
1888
+ radius
1889
+ }), $[9] = className, $[10] = radius, $[11] = t7) : t7 = $[11];
1890
+ let t8;
1891
+ $[12] !== children || $[13] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { as: "span", muted: !0, size: fontSize, weight: "medium", children }), $[12] = children, $[13] = fontSize, $[14] = t8) : t8 = $[14];
1892
+ let t9;
1893
+ return $[15] !== display || $[16] !== padding || $[17] !== rest || $[18] !== t6 || $[19] !== t7 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.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;
1894
+ }
1895
+ const DEFAULT_HOTKEYS_ELEMENT = "kbd";
1896
+ function Hotkeys(props) {
1897
+ const $ = compilerRuntime.c(26), t0 = props;
1898
+ let fontSize, gapX, gapY, keys, padding, radius, rest, t1, t2;
1899
+ $[0] !== t0 ? ({
1900
+ as: t1,
1901
+ fontSize,
1902
+ gap: t2,
1903
+ gapX,
1904
+ gapY,
1905
+ keys,
1906
+ padding,
1907
+ radius,
1908
+ ...rest
1909
+ } = 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]);
1910
+ const as = t1 === void 0 ? DEFAULT_HOTKEYS_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2;
1911
+ if (!keys || keys.length === 0)
1912
+ return;
1913
+ let t3;
1914
+ if ($[10] !== fontSize || $[11] !== keys || $[12] !== padding || $[13] !== radius) {
1915
+ let t42;
1916
+ $[15] !== fontSize || $[16] !== padding || $[17] !== radius ? (t42 = (key2, i) => /* @__PURE__ */ jsxRuntime.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;
1917
+ } else
1918
+ t3 = $[14];
1919
+ let t4;
1920
+ return $[19] !== as || $[20] !== gap || $[21] !== gapX || $[22] !== gapY || $[23] !== rest || $[24] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.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;
1921
+ }
1922
+ const MenuContext = createGlobalScopedContext("@sanity/ui/v3/menu", null);
1923
+ function _isFocusable(element) {
1924
+ return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
1925
+ }
1926
+ function _getFocusableElements(elements) {
1927
+ return elements.filter(_isFocusable);
1928
+ }
1929
+ function _getDOMPath(rootElement, el) {
1930
+ const path = [];
1931
+ let e = el;
1932
+ for (; e !== rootElement; ) {
1933
+ const parentElement = e.parentElement;
1934
+ if (!parentElement) return path;
1935
+ const index = Array.from(parentElement.childNodes).indexOf(e);
1936
+ if (path.unshift(index), parentElement === rootElement)
1937
+ return path;
1938
+ e = parentElement;
1939
+ }
1940
+ return path;
1941
+ }
1942
+ const EMPTY_PATH = [];
1943
+ function _sortElements(rootElement, elements) {
1944
+ if (!rootElement) return;
1945
+ const map = /* @__PURE__ */ new WeakMap();
1946
+ for (const el of elements)
1947
+ map.set(el, _getDOMPath(rootElement, el));
1948
+ const _sort = (a, b) => {
1949
+ const _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
1950
+ for (let i = 0; i < len; i += 1) {
1951
+ const aIndex = _a[i] || -1, bIndex = _b[i] || -1;
1952
+ if (aIndex !== bIndex)
1953
+ return aIndex - bIndex;
1954
+ }
1955
+ return 0;
1956
+ };
1957
+ elements.sort(_sort);
1958
+ }
1959
+ function useMenuController(props) {
1960
+ const {
1961
+ onKeyDown,
1962
+ originElement,
1963
+ shouldFocus,
1964
+ rootElementRef
1965
+ } = props, elementsRef = react.useRef([]), [activeIndex, _setActiveIndex] = react.useState(-1), activeIndexRef = react.useRef(activeIndex), activeElement = react.useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = react.useCallback((nextActiveIndex) => {
1966
+ _setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
1967
+ }, []), mount = react.useCallback((element, selected) => {
1968
+ if (!element) return () => {
1969
+ };
1970
+ if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
1971
+ const selectedIndex = elementsRef.current.indexOf(element);
1972
+ setActiveIndex(selectedIndex);
1973
+ }
1974
+ return () => {
1975
+ const idx = elementsRef.current.indexOf(element);
1976
+ idx > -1 && elementsRef.current.splice(idx, 1);
1977
+ };
1978
+ }, [rootElementRef, setActiveIndex]), handleKeyDown = react.useCallback((event) => {
1979
+ if (event.key === "Tab") {
1980
+ originElement && originElement.focus();
1981
+ return;
1982
+ }
1983
+ if (event.key === "Home") {
1984
+ event.preventDefault(), event.stopPropagation();
1985
+ const el = _getFocusableElements(elementsRef.current)[0];
1986
+ if (!el) return;
1987
+ const currentIndex = elementsRef.current.indexOf(el);
1988
+ setActiveIndex(currentIndex);
1989
+ return;
1990
+ }
1991
+ if (event.key === "End") {
1992
+ event.preventDefault(), event.stopPropagation();
1993
+ const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
1994
+ if (!el_0) return;
1995
+ const currentIndex_0 = elementsRef.current.indexOf(el_0);
1996
+ setActiveIndex(currentIndex_0);
1997
+ return;
1998
+ }
1999
+ if (event.key === "ArrowUp") {
2000
+ event.preventDefault(), event.stopPropagation();
2001
+ const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
2002
+ if (focusableLen === 0) return;
2003
+ const focusedElement = elementsRef.current[activeIndexRef.current];
2004
+ let focusedIndex = focusableElements_1.indexOf(focusedElement);
2005
+ focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
2006
+ const el_1 = focusableElements_1[focusedIndex], currentIndex_1 = elementsRef.current.indexOf(el_1);
2007
+ setActiveIndex(currentIndex_1);
2008
+ return;
2009
+ }
2010
+ if (event.key === "ArrowDown") {
2011
+ event.preventDefault(), event.stopPropagation();
2012
+ const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
2013
+ if (focusableLen_0 === 0) return;
2014
+ const focusedElement_0 = elementsRef.current[activeIndexRef.current];
2015
+ let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
2016
+ focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
2017
+ const el_2 = focusableElements_2[focusedIndex_0], currentIndex_2 = elementsRef.current.indexOf(el_2);
2018
+ setActiveIndex(currentIndex_2);
504
2019
  return;
505
2020
  }
506
- _visualEditing.isHTMLElement(event.target) && (focusedElementRef.current = event.target);
507
- }, $[24] = onFocus, $[25] = t8) : t8 = $[25];
508
- const handleFocus = t8, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
509
- let t9;
510
- $[26] !== boundaryElement || $[27] !== portalElement ? (t9 = () => {
511
- rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
512
- const activeElement = document.activeElement;
513
- if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
514
- const target_0 = focusedElementRef.current;
515
- if (!target_0 || !document.body.contains(target_0)) {
516
- const cardElement_0 = cardRef.current;
517
- cardElement_0 && focusFirstDescendant(cardElement_0);
518
- return;
2021
+ onKeyDown && onKeyDown(event);
2022
+ }, [onKeyDown, originElement, setActiveIndex]), handleItemMouseEnter = react.useCallback((event_0) => {
2023
+ const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
2024
+ setActiveIndex(currentIndex_3);
2025
+ }, [setActiveIndex]), handleItemMouseLeave = react.useCallback(() => {
2026
+ setActiveIndex(-2), rootElementRef.current?.focus();
2027
+ }, [rootElementRef, setActiveIndex]);
2028
+ return react.useEffect(() => {
2029
+ if (!mounted) return;
2030
+ const rafId = requestAnimationFrame(() => {
2031
+ if (activeIndex === -1) {
2032
+ if (shouldFocus === "first") {
2033
+ const el_3 = _getFocusableElements(elementsRef.current)[0];
2034
+ if (el_3) {
2035
+ const currentIndex_4 = elementsRef.current.indexOf(el_3);
2036
+ setActiveIndex(currentIndex_4);
2037
+ }
519
2038
  }
520
- target_0.focus();
2039
+ if (shouldFocus === "last") {
2040
+ const focusableElements_4 = _getFocusableElements(elementsRef.current), el_4 = focusableElements_4[focusableElements_4.length - 1];
2041
+ if (el_4) {
2042
+ const currentIndex_5 = elementsRef.current.indexOf(el_4);
2043
+ setActiveIndex(currentIndex_5);
2044
+ }
2045
+ }
2046
+ return;
521
2047
  }
522
- }, 0);
523
- }, $[26] = boundaryElement, $[27] = portalElement, $[28] = t9) : t9 = $[28];
524
- const handleRootClick = t9;
2048
+ (elementsRef.current[activeIndex] || null)?.focus();
2049
+ });
2050
+ return () => cancelAnimationFrame(rafId);
2051
+ }, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
2052
+ activeElement,
2053
+ activeIndex,
2054
+ handleItemMouseEnter,
2055
+ handleItemMouseLeave,
2056
+ handleKeyDown,
2057
+ mount
2058
+ };
2059
+ }
2060
+ const DEFAULT_MENU_ELEMENT = "div";
2061
+ function Menu(props) {
2062
+ const $ = compilerRuntime.c(57), t0 = props;
2063
+ let _shouldFocus, children, className, forwardedRef, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, rest, t1, t2, t3;
2064
+ $[0] !== t0 ? ({
2065
+ as: t1,
2066
+ children,
2067
+ className,
2068
+ gap: t2,
2069
+ onClickOutside,
2070
+ onEscape,
2071
+ onItemClick,
2072
+ onItemSelect,
2073
+ onKeyDown,
2074
+ originElement,
2075
+ padding: t3,
2076
+ ref: forwardedRef,
2077
+ registerElement,
2078
+ shouldFocus: _shouldFocus,
2079
+ ...rest
2080
+ } = 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]);
2081
+ 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 = react.useRef(null);
2082
+ let t4;
2083
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[16] = t4) : t4 = $[16], react.useImperativeHandle(forwardedRef, t4);
2084
+ const {
2085
+ isTopLayer
2086
+ } = useLayer();
2087
+ let t5;
2088
+ $[17] !== onKeyDown || $[18] !== originElement || $[19] !== shouldFocus ? (t5 = {
2089
+ onKeyDown,
2090
+ originElement,
2091
+ shouldFocus,
2092
+ rootElementRef: ref
2093
+ }, $[17] = onKeyDown, $[18] = originElement, $[19] = shouldFocus, $[20] = t5) : t5 = $[20];
2094
+ const {
2095
+ activeElement,
2096
+ activeIndex,
2097
+ handleItemMouseEnter,
2098
+ handleItemMouseLeave,
2099
+ handleKeyDown,
2100
+ mount
2101
+ } = useMenuController(t5), unregisterElementRef = react.useRef(null);
2102
+ let t6;
2103
+ $[21] !== registerElement ? (t6 = (el) => {
2104
+ unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
2105
+ }, $[21] = registerElement, $[22] = t6) : t6 = $[22];
2106
+ const handleRefChange = t6;
2107
+ let t7, t8;
2108
+ $[23] !== activeIndex || $[24] !== onItemSelect ? (t7 = () => {
2109
+ onItemSelect && onItemSelect(activeIndex);
2110
+ }, t8 = [activeIndex, onItemSelect], $[23] = activeIndex, $[24] = onItemSelect, $[25] = t7, $[26] = t8) : (t7 = $[25], t8 = $[26]), react.useEffect(t7, t8);
2111
+ let t9;
2112
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => [ref.current], $[27] = t9) : t9 = $[27], useClickOutsideEvent(isTopLayer && onClickOutside, t9);
525
2113
  let t10;
526
- $[29] !== className ? (t10 = css.dialog({
527
- className
528
- }), $[29] = className, $[30] = t10) : t10 = $[30];
529
- const t11 = animate ? "" : void 0;
530
- let t12;
531
- $[31] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[31] = t12) : t12 = $[31];
2114
+ $[28] !== isTopLayer || $[29] !== onEscape ? (t10 = (event) => {
2115
+ isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
2116
+ }, $[28] = isTopLayer, $[29] = onEscape, $[30] = t10) : t10 = $[30], useGlobalKeyDown(t10);
2117
+ let t11, t12;
2118
+ $[31] !== activeElement || $[32] !== activeIndex || $[33] !== handleItemMouseEnter || $[34] !== handleItemMouseLeave || $[35] !== mount || $[36] !== onClickOutside || $[37] !== onEscape || $[38] !== onItemClick || $[39] !== registerElement ? (t12 = {
2119
+ version: 0,
2120
+ activeElement,
2121
+ activeIndex,
2122
+ mount,
2123
+ onClickOutside,
2124
+ onEscape,
2125
+ onItemClick,
2126
+ onItemMouseEnter: handleItemMouseEnter,
2127
+ onItemMouseLeave: handleItemMouseLeave,
2128
+ registerElement,
2129
+ onMouseEnter: handleItemMouseEnter,
2130
+ onMouseLeave: handleItemMouseLeave
2131
+ }, $[31] = activeElement, $[32] = activeIndex, $[33] = handleItemMouseEnter, $[34] = handleItemMouseLeave, $[35] = mount, $[36] = onClickOutside, $[37] = onEscape, $[38] = onItemClick, $[39] = registerElement, $[40] = t12) : t12 = $[40], t11 = t12;
2132
+ const value = t11;
532
2133
  let t13;
533
- $[32] === Symbol.for("react.memo_cache_sentinel") ? (t13 = css.dialogContainer(), $[32] = t13) : t13 = $[32];
2134
+ $[41] !== className ? (t13 = css.menu({
2135
+ className
2136
+ }), $[41] = className, $[42] = t13) : t13 = $[42];
534
2137
  let t14;
535
- $[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__ */ jsxRuntime.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];
2138
+ $[43] !== children || $[44] !== gap ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap, children }), $[43] = children, $[44] = gap, $[45] = t14) : t14 = $[45];
536
2139
  let t15;
537
- $[49] !== t14 || $[50] !== width ? (t15 = /* @__PURE__ */ jsxRuntime.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];
2140
+ $[46] !== as || $[47] !== handleKeyDown || $[48] !== handleRefChange || $[49] !== padding || $[50] !== rest || $[51] !== t13 || $[52] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.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];
538
2141
  let t16;
539
- $[52] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[52] = t16) : t16 = $[52];
540
- let t17;
541
- $[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__ */ jsxRuntime.jsxs(_visualEditing.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: [
542
- t12,
543
- t15,
544
- t16
545
- ] }), $[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];
546
- let t18;
547
- return $[66] !== portalProp || $[67] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Portal, { __unstable_name: portalProp, children: t17 }), $[66] = portalProp, $[67] = t17, $[68] = t18) : t18 = $[68], t18;
548
- }
549
- function DialogProvider(props) {
550
- const $ = compilerRuntime.c(6), {
551
- children,
552
- position,
553
- zOffset
554
- } = props;
555
- let t0, t1;
556
- $[0] !== position || $[1] !== zOffset ? (t1 = {
557
- version: 0,
558
- position,
559
- zOffset
560
- }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
561
- const contextValue = t0;
562
- let t2;
563
- return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
2142
+ return $[54] !== t15 || $[55] !== value ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: t15 }), $[54] = t15, $[55] = value, $[56] = t16) : t16 = $[56], t16;
564
2143
  }
565
2144
  function MenuButton(props) {
566
2145
  const $ = compilerRuntime.c(57), {
@@ -590,7 +2169,7 @@ function MenuButton(props) {
590
2169
  }, t7 = [open], $[9] = open, $[10] = t6, $[11] = t7) : (t6 = $[10], t7 = $[11]), react.useEffect(t6, t7);
591
2170
  let t8;
592
2171
  $[12] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => {
593
- setOpen(_temp$4), setShouldFocus(null);
2172
+ setOpen(_temp$6), setShouldFocus(null);
594
2173
  }, $[12] = t8) : t8 = $[12];
595
2174
  const handleButtonClick = t8;
596
2175
  let t9;
@@ -691,11 +2270,301 @@ function MenuButton(props) {
691
2270
  let t23;
692
2271
  $[50] !== button ? (t23 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[50] = button, $[51] = t23) : t23 = $[51];
693
2272
  let t24;
694
- return $[52] !== menu || $[53] !== open || $[54] !== popoverProps || $[55] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[52] = menu, $[53] = open, $[54] = popoverProps, $[55] = t23, $[56] = t24) : t24 = $[56], t24;
2273
+ return $[52] !== menu || $[53] !== open || $[54] !== popoverProps || $[55] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.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;
695
2274
  }
696
- function _temp$4(v) {
2275
+ function _temp$6(v) {
697
2276
  return !v;
698
2277
  }
2278
+ const DEFAULT_MENU_DIVIDER_ELEMENT = "hr";
2279
+ function MenuDivider(props) {
2280
+ const $ = compilerRuntime.c(10), t0 = props;
2281
+ let className, rest, t1;
2282
+ $[0] !== t0 ? ({
2283
+ as: t1,
2284
+ className,
2285
+ ...rest
2286
+ } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
2287
+ const Element2 = t1 === void 0 ? DEFAULT_MENU_DIVIDER_ELEMENT : t1;
2288
+ let t2;
2289
+ $[4] !== className ? (t2 = css.menuDivider({
2290
+ className
2291
+ }), $[4] = className, $[5] = t2) : t2 = $[5];
2292
+ let t3;
2293
+ return $[6] !== Element2 || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Element2, { ...rest, className: t2 }), $[6] = Element2, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2294
+ }
2295
+ function useMenu() {
2296
+ const value = react.useContext(MenuContext);
2297
+ if (!value)
2298
+ throw new Error("useMenu(): missing context value");
2299
+ if (!isRecord(value) || value.version !== 0)
2300
+ throw new Error("useMenu(): the context value is not compatible");
2301
+ return value;
2302
+ }
2303
+ const DEFAULT_MENU_GROUP_ELEMENT = "button";
2304
+ function MenuGroup(props) {
2305
+ const $ = compilerRuntime.c(77), t0 = props;
2306
+ let IconComponent, children, menuProps, onClick, popover, rest, t1, t2, t3, t4, t5, t6, text;
2307
+ $[0] !== t0 ? ({
2308
+ as: t1,
2309
+ children,
2310
+ fontSize: t2,
2311
+ gap: t3,
2312
+ icon: IconComponent,
2313
+ menu: menuProps,
2314
+ onClick,
2315
+ padding: t4,
2316
+ popover,
2317
+ radius: t5,
2318
+ text,
2319
+ tone: t6,
2320
+ ...rest
2321
+ } = t0, $[0] = t0, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6, $[13] = text) : (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12], text = $[13]);
2322
+ 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, {
2323
+ activeElement,
2324
+ mount,
2325
+ onClickOutside,
2326
+ onEscape,
2327
+ onItemClick,
2328
+ onItemMouseEnter,
2329
+ registerElement
2330
+ } = useMenu(), [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1);
2331
+ let t7;
2332
+ $[14] !== onItemMouseEnter ? (t7 = (event) => {
2333
+ setWithinMenu(!1), onItemMouseEnter?.(event), setOpen(!0);
2334
+ }, $[14] = onItemMouseEnter, $[15] = t7) : t7 = $[15];
2335
+ const handleMouseEnter = t7;
2336
+ let t8;
2337
+ $[16] !== rootElement ? (t8 = (event_0) => {
2338
+ event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
2339
+ rootElement?.focus();
2340
+ }));
2341
+ }, $[16] = rootElement, $[17] = t8) : t8 = $[17];
2342
+ const handleMenuKeyDown = t8;
2343
+ let t9;
2344
+ $[18] !== onClick ? (t9 = (event_1) => {
2345
+ onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
2346
+ }, $[18] = onClick, $[19] = t9) : t9 = $[19];
2347
+ const handleClick = t9;
2348
+ let t10;
2349
+ $[20] !== onItemClick ? (t10 = () => {
2350
+ setOpen(!1), onItemClick?.();
2351
+ }, $[20] = onItemClick, $[21] = t10) : t10 = $[21];
2352
+ const handleChildItemClick = t10;
2353
+ let t11;
2354
+ $[22] === Symbol.for("react.memo_cache_sentinel") ? (t11 = () => setWithinMenu(!0), $[22] = t11) : t11 = $[22];
2355
+ const handleMenuMouseEnter = t11;
2356
+ let t12, t13;
2357
+ $[23] !== mount || $[24] !== rootElement ? (t12 = () => mount(rootElement), t13 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t12, $[26] = t13) : (t12 = $[25], t13 = $[26]), react.useEffect(t12, t13);
2358
+ let t14, t15;
2359
+ $[27] !== active ? (t14 = () => {
2360
+ active || setOpen(!1);
2361
+ }, t15 = [active], $[27] = active, $[28] = t14, $[29] = t15) : (t14 = $[28], t15 = $[29]), react.useEffect(t14, t15);
2362
+ let t16, t17;
2363
+ $[30] !== open ? (t16 = () => {
2364
+ open || setWithinMenu(!1);
2365
+ }, t17 = [open], $[30] = open, $[31] = t16, $[32] = t17) : (t16 = $[31], t17 = $[32]), react.useEffect(t16, t17);
2366
+ let t18, t19;
2367
+ $[33] !== shouldFocus ? (t18 = () => {
2368
+ if (!shouldFocus)
2369
+ return;
2370
+ const rafId = requestAnimationFrame(() => setShouldFocus(null));
2371
+ return () => cancelAnimationFrame(rafId);
2372
+ }, t19 = [shouldFocus], $[33] = shouldFocus, $[34] = t18, $[35] = t19) : (t18 = $[34], t19 = $[35]), react.useEffect(t18, t19);
2373
+ let t20;
2374
+ $[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t20 = /* @__PURE__ */ jsxRuntime.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];
2375
+ const childMenu = t20;
2376
+ let t21;
2377
+ $[45] === Symbol.for("react.memo_cache_sentinel") ? (t21 = (event_2) => {
2378
+ const target = event_2.currentTarget;
2379
+ if (document.activeElement === target && event_2.key === "ArrowRight") {
2380
+ setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
2381
+ return;
2382
+ }
2383
+ }, $[45] = t21) : t21 = $[45];
2384
+ const handleKeyDown = t21, t22 = as === "button" ? withinMenu : void 0, t23 = as === "button" ? "button" : void 0;
2385
+ let t24;
2386
+ $[46] !== IconComponent || $[47] !== fontSize ? (t24 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize, children: [
2387
+ react.isValidElement(IconComponent) && IconComponent,
2388
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
2389
+ ] }), $[46] = IconComponent, $[47] = fontSize, $[48] = t24) : t24 = $[48];
2390
+ let t25;
2391
+ $[49] !== fontSize || $[50] !== text ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[49] = fontSize, $[50] = text, $[51] = t25) : t25 = $[51];
2392
+ let t26;
2393
+ $[52] === Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[52] = t26) : t26 = $[52];
2394
+ let t27;
2395
+ $[53] !== fontSize ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children: t26 }), $[53] = fontSize, $[54] = t27) : t27 = $[54];
2396
+ let t28;
2397
+ $[55] !== gap || $[56] !== padding || $[57] !== t24 || $[58] !== t25 || $[59] !== t27 ? (t28 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap, padding, children: [
2398
+ t24,
2399
+ t25,
2400
+ t27
2401
+ ] }), $[55] = gap, $[56] = padding, $[57] = t24, $[58] = t25, $[59] = t27, $[60] = t28) : t28 = $[60];
2402
+ let t29;
2403
+ $[61] !== as || $[62] !== handleClick || $[63] !== handleMouseEnter || $[64] !== radius || $[65] !== rest || $[66] !== t22 || $[67] !== t23 || $[68] !== t28 || $[69] !== tone || $[70] !== withinMenu ? (t29 = /* @__PURE__ */ jsxRuntime.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];
2404
+ let t30;
2405
+ return $[72] !== childMenu || $[73] !== open || $[74] !== popover || $[75] !== t29 ? (t30 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t29 }), $[72] = childMenu, $[73] = open, $[74] = popover, $[75] = t29, $[76] = t30) : t30 = $[76], t30;
2406
+ }
2407
+ const DEFAULT_MENU_ITEM_ELEMENT = "button";
2408
+ function MenuItem(props) {
2409
+ const $ = compilerRuntime.c(73), t0 = props;
2410
+ 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, text;
2411
+ $[0] !== t0 ? ({
2412
+ as: t1,
2413
+ children,
2414
+ disabled,
2415
+ fontSize: t2,
2416
+ gap: t3,
2417
+ gapX,
2418
+ gapY,
2419
+ hotkeys,
2420
+ icon: IconComponent,
2421
+ iconRight: IconRightComponent,
2422
+ onClick,
2423
+ padding: t4,
2424
+ paddingX,
2425
+ paddingY,
2426
+ paddingTop,
2427
+ paddingRight,
2428
+ paddingBottom,
2429
+ paddingLeft,
2430
+ pressed,
2431
+ radius: t5,
2432
+ ref: forwardedRef,
2433
+ selected: selectedProp,
2434
+ text,
2435
+ tone: t6,
2436
+ ...rest
2437
+ } = 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] = text) : (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], text = $[25]);
2438
+ 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, menu = useMenu(), {
2439
+ activeElement,
2440
+ mount,
2441
+ onItemClick,
2442
+ onItemMouseEnter,
2443
+ onItemMouseLeave
2444
+ } = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
2445
+ let t7;
2446
+ $[26] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[26] = t7) : t7 = $[26], react.useImperativeHandle(forwardedRef, t7);
2447
+ let t8, t9;
2448
+ $[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]), react.useEffect(t8, t9);
2449
+ let t10;
2450
+ $[32] !== disabled || $[33] !== onClick || $[34] !== onItemClick ? (t10 = (event) => {
2451
+ disabled || (onClick && onClick(event), onItemClick && onItemClick());
2452
+ }, $[32] = disabled, $[33] = onClick, $[34] = onItemClick, $[35] = t10) : t10 = $[35];
2453
+ const handleClick = t10;
2454
+ let t11, t12;
2455
+ $[36] !== padding || $[37] !== paddingBottom || $[38] !== paddingLeft || $[39] !== paddingRight || $[40] !== paddingTop || $[41] !== paddingX || $[42] !== paddingY ? (t12 = {
2456
+ padding,
2457
+ paddingX,
2458
+ paddingY,
2459
+ paddingTop,
2460
+ paddingRight,
2461
+ paddingBottom,
2462
+ paddingLeft
2463
+ }, $[36] = padding, $[37] = paddingBottom, $[38] = paddingLeft, $[39] = paddingRight, $[40] = paddingTop, $[41] = paddingX, $[42] = paddingY, $[43] = t12) : t12 = $[43], t11 = t12;
2464
+ const paddingProps = t11;
2465
+ let t13;
2466
+ $[44] === Symbol.for("react.memo_cache_sentinel") ? (t13 = (el) => {
2467
+ ref.current = el, setRootElement(el);
2468
+ }, $[44] = t13) : t13 = $[44];
2469
+ const setRef = t13, t14 = pressed ? "" : void 0, t15 = active ? "" : void 0, t16 = disabled ? "" : void 0, t17 = as === "button" ? "button" : void 0;
2470
+ let t18;
2471
+ $[45] !== IconComponent || $[46] !== IconRightComponent || $[47] !== fontSize || $[48] !== gap || $[49] !== gapX || $[50] !== gapY || $[51] !== hotkeys || $[52] !== paddingProps || $[53] !== text ? (t18 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap, gapX, gapY, align: "center", ...paddingProps, children: [
2472
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { muted: !0, size: fontSize, children: [
2473
+ react.isValidElement(IconComponent) && IconComponent,
2474
+ reactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
2475
+ ] }),
2476
+ text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, textOverflow: "ellipsis", weight: "medium", children: text }) }),
2477
+ hotkeys && /* @__PURE__ */ jsxRuntime.jsx(Hotkeys, { keys: hotkeys, style: {
2478
+ marginTop: -4,
2479
+ marginBottom: -4
2480
+ } }),
2481
+ IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { muted: !0, size: fontSize, children: [
2482
+ react.isValidElement(IconRightComponent) && IconRightComponent,
2483
+ reactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
2484
+ ] })
2485
+ ] }), $[45] = IconComponent, $[46] = IconRightComponent, $[47] = fontSize, $[48] = gap, $[49] = gapX, $[50] = gapY, $[51] = hotkeys, $[52] = paddingProps, $[53] = text, $[54] = t18) : t18 = $[54];
2486
+ let t19;
2487
+ $[55] !== children || $[56] !== paddingProps ? (t19 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children }), $[55] = children, $[56] = paddingProps, $[57] = t19) : t19 = $[57];
2488
+ let t20;
2489
+ 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__ */ jsxRuntime.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: [
2490
+ t18,
2491
+ t19
2492
+ ] }), $[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;
2493
+ }
2494
+ const DEFAULT_TAB_ELEMENT = "button";
2495
+ function Tab(props) {
2496
+ const $ = compilerRuntime.c(33), t0 = props;
2497
+ let focused, forwardedRef, icon, id, label, onClick, onFocus, rest, selected, t1, t2, t3;
2498
+ $[0] !== t0 ? ({
2499
+ as: t1,
2500
+ icon,
2501
+ id,
2502
+ focused,
2503
+ fontSize: t2,
2504
+ label,
2505
+ onClick,
2506
+ onFocus,
2507
+ padding: t3,
2508
+ ref: forwardedRef,
2509
+ selected,
2510
+ ...rest
2511
+ } = t0, $[0] = t0, $[1] = focused, $[2] = forwardedRef, $[3] = icon, $[4] = id, $[5] = label, $[6] = onClick, $[7] = onFocus, $[8] = rest, $[9] = selected, $[10] = t1, $[11] = t2, $[12] = t3) : (focused = $[1], forwardedRef = $[2], icon = $[3], id = $[4], label = $[5], onClick = $[6], onFocus = $[7], rest = $[8], selected = $[9], t1 = $[10], t2 = $[11], t3 = $[12]);
2512
+ const as = t1 === void 0 ? DEFAULT_TAB_ELEMENT : t1, fontSize = t2 === void 0 ? 1 : t2, padding = t3 === void 0 ? 2 : t3, ref = react.useRef(null), focusedRef = react.useRef(!1);
2513
+ let t4;
2514
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[13] = t4) : t4 = $[13], react.useImperativeHandle(forwardedRef, t4);
2515
+ let t5;
2516
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
2517
+ focusedRef.current = !1;
2518
+ }, $[14] = t5) : t5 = $[14];
2519
+ const handleBlur = t5;
2520
+ let t6;
2521
+ $[15] !== onFocus ? (t6 = (event) => {
2522
+ focusedRef.current = !0, onFocus && onFocus(event);
2523
+ }, $[15] = onFocus, $[16] = t6) : t6 = $[16];
2524
+ const handleFocus = t6;
2525
+ let t7, t8;
2526
+ $[17] !== focused ? (t7 = () => {
2527
+ focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
2528
+ }, t8 = [focused], $[17] = focused, $[18] = t7, $[19] = t8) : (t7 = $[18], t8 = $[19]), react.useEffect(t7, t8);
2529
+ const t9 = selected ? "true" : "false", t10 = selected ? 0 : -1;
2530
+ let t11;
2531
+ return $[20] !== as || $[21] !== fontSize || $[22] !== handleFocus || $[23] !== icon || $[24] !== id || $[25] !== label || $[26] !== onClick || $[27] !== padding || $[28] !== rest || $[29] !== selected || $[30] !== t10 || $[31] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.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: label, type: "button" }), $[20] = as, $[21] = fontSize, $[22] = handleFocus, $[23] = icon, $[24] = id, $[25] = label, $[26] = onClick, $[27] = padding, $[28] = rest, $[29] = selected, $[30] = t10, $[31] = t9, $[32] = t11) : t11 = $[32], t11;
2532
+ }
2533
+ const DEFAULT_TAB_LIST_ELEMENT = "div";
2534
+ function TabList(props) {
2535
+ const $ = compilerRuntime.c(20), t0 = props;
2536
+ let childrenProp, rest, t1, t2, t3;
2537
+ $[0] !== t0 ? ({
2538
+ as: t1,
2539
+ children: childrenProp,
2540
+ gap: t2,
2541
+ wrap: t3,
2542
+ ...rest
2543
+ } = t0, $[0] = t0, $[1] = childrenProp, $[2] = rest, $[3] = t1, $[4] = t2, $[5] = t3) : (childrenProp = $[1], rest = $[2], t1 = $[3], t2 = $[4], t3 = $[5]);
2544
+ const as = t1 === void 0 ? DEFAULT_TAB_LIST_ELEMENT : t1, gap = t2 === void 0 ? 1 : t2, wrap = t3 === void 0 ? "nowrap" : t3, [focusedIndex, setFocusedIndex] = react.useState(-1);
2545
+ let t4;
2546
+ if ($[6] !== childrenProp || $[7] !== focusedIndex) {
2547
+ const children = react.Children.toArray(childrenProp).filter(_isReactElement);
2548
+ let t52;
2549
+ $[9] !== focusedIndex ? (t52 = (child, childIndex) => react.cloneElement(child, {
2550
+ focused: focusedIndex === childIndex,
2551
+ key: childIndex,
2552
+ onFocus: () => setFocusedIndex(childIndex)
2553
+ }), $[9] = focusedIndex, $[10] = t52) : t52 = $[10], t4 = children.map(t52), $[6] = childrenProp, $[7] = focusedIndex, $[8] = t4;
2554
+ } else
2555
+ t4 = $[8];
2556
+ const tabs = t4, numTabs = tabs.length;
2557
+ let t5;
2558
+ $[11] !== numTabs ? (t5 = (event) => {
2559
+ event.key === "ArrowLeft" && setFocusedIndex((prevIndex) => (prevIndex + numTabs - 1) % numTabs), event.key === "ArrowRight" && setFocusedIndex((prevIndex_0) => (prevIndex_0 + 1) % numTabs);
2560
+ }, $[11] = numTabs, $[12] = t5) : t5 = $[12];
2561
+ const handleKeyDown = t5;
2562
+ let t6;
2563
+ return $[13] !== as || $[14] !== gap || $[15] !== handleKeyDown || $[16] !== rest || $[17] !== tabs || $[18] !== wrap ? (t6 = /* @__PURE__ */ jsxRuntime.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;
2564
+ }
2565
+ function _isReactElement(node) {
2566
+ return !!node;
2567
+ }
699
2568
  const DEFAULT_TAB_PANEL_ELEMENT = "div";
700
2569
  function TabPanel(props) {
701
2570
  const $ = compilerRuntime.c(10), t0 = props;
@@ -708,7 +2577,7 @@ function TabPanel(props) {
708
2577
  } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1, $[4] = tabIndex) : (children = $[1], rest = $[2], t1 = $[3], tabIndex = $[4]);
709
2578
  const as = t1 === void 0 ? DEFAULT_TAB_PANEL_ELEMENT : t1, t2 = tabIndex === void 0 ? 0 : tabIndex;
710
2579
  let t3;
711
- return $[5] !== as || $[6] !== children || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "TabPanel", ...rest, as, role: "tabpanel", tabIndex: t2, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
2580
+ return $[5] !== as || $[6] !== children || $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "TabPanel", ...rest, as, role: "tabpanel", tabIndex: t2, children }), $[5] = as, $[6] = children, $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
712
2581
  }
713
2582
  const DEFAULT_TOAST_ELEMENT = "li", LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24, ROLES = {
714
2583
  error: "alert",
@@ -740,7 +2609,7 @@ function Toast(props) {
740
2609
  status,
741
2610
  ...rest
742
2611
  } = t0, $[0] = t0, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = rest, $[6] = status, $[7] = t1, $[8] = t2, $[9] = title) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], rest = $[5], status = $[6], t1 = $[7], t2 = $[8], title = $[9]);
743
- const as = t1 === void 0 ? DEFAULT_TOAST_ELEMENT : t1, radius = t2 === void 0 ? 3 : t2, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = _visualEditing.usePrefersReducedMotion() ? 0 : 0.26;
2612
+ const as = t1 === void 0 ? DEFAULT_TOAST_ELEMENT : t1, radius = t2 === void 0 ? 3 : t2, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = usePrefersReducedMotion() ? 0 : 0.26;
744
2613
  let t3;
745
2614
  $[10] !== visualDuration ? (t3 = visualDuration ? {
746
2615
  type: "spring",
@@ -763,16 +2632,16 @@ function Toast(props) {
763
2632
  $[15] === Symbol.for("react.memo_cache_sentinel") ? (t7 = css.toast(), $[15] = t7) : t7 = $[15];
764
2633
  const t8 = hasDuration ? "" : void 0;
765
2634
  let t9;
766
- $[16] !== title ? (t9 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[16] = title, $[17] = t9) : t9 = $[17];
2635
+ $[16] !== title ? (t9 = title && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: 1, weight: "medium", children: title }), $[16] = title, $[17] = t9) : t9 = $[17];
767
2636
  let t10;
768
2637
  $[18] !== description || $[19] !== transition ? (t10 = description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[18] = description, $[19] = transition, $[20] = t10) : t10 = $[20];
769
2638
  let t11;
770
- $[21] !== t10 || $[22] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Flex, { flex: 1, overflowX: "auto", padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { gap: 3, children: [
2639
+ $[21] !== t10 || $[22] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Flex, { flex: 1, overflowX: "auto", padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: 3, children: [
771
2640
  t9,
772
2641
  t10
773
2642
  ] }) }), $[21] = t10, $[22] = t9, $[23] = t11) : t11 = $[23];
774
2643
  let t12;
775
- $[24] !== buttonTone || $[25] !== closable || $[26] !== onClose ? (t12 = closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
2644
+ $[24] !== buttonTone || $[25] !== closable || $[26] !== onClose ? (t12 = closable && /* @__PURE__ */ jsxRuntime.jsx(Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
776
2645
  verticalAlign: "top"
777
2646
  } }) }), $[24] = buttonTone, $[25] = closable, $[26] = onClose, $[27] = t12) : t12 = $[27];
778
2647
  let t13;
@@ -820,18 +2689,31 @@ const container = {
820
2689
  visible: {
821
2690
  opacity: 1
822
2691
  }
823
- }, MotionCard = framerMotion.motion.create(_visualEditing.Card), MotionFlex = framerMotion.motion.create(_visualEditing.Flex), MotionText = framerMotion.motion.create(_visualEditing.Text);
2692
+ }, MotionCard = framerMotion.motion.create(Card), MotionFlex = framerMotion.motion.create(Flex), MotionText = framerMotion.motion.create(Text);
824
2693
  function useMounted() {
825
- return react.useSyncExternalStore(subscribe, _temp$3, _temp2);
2694
+ return react.useSyncExternalStore(subscribe, _temp$5, _temp2);
826
2695
  }
827
2696
  function _temp2() {
828
2697
  return !1;
829
2698
  }
830
- function _temp$3() {
2699
+ function _temp$5() {
831
2700
  return !0;
832
2701
  }
833
2702
  const subscribe = () => () => {
834
- }, ToastContext = _visualEditing.createGlobalScopedContext("@sanity/ui/v3/toast", null), DEFAULT_TOAST_LAYER_ELEMENT = "ul";
2703
+ }, ToastContext = createGlobalScopedContext("@sanity/ui/v3/toast", null), DEFAULT_GRID_ELEMENT = "div";
2704
+ function Grid(props) {
2705
+ const $ = compilerRuntime.c(8), t0 = props;
2706
+ let children, rest, t1;
2707
+ $[0] !== t0 ? ({
2708
+ as: t1,
2709
+ children,
2710
+ ...rest
2711
+ } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
2712
+ const as = t1 === void 0 ? DEFAULT_GRID_ELEMENT : t1;
2713
+ let t2;
2714
+ return $[4] !== as || $[5] !== children || $[6] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Grid", ...rest, as, display: "grid", children }), $[4] = as, $[5] = children, $[6] = rest, $[7] = t2) : t2 = $[7], t2;
2715
+ }
2716
+ const DEFAULT_TOAST_LAYER_ELEMENT = "ul";
835
2717
  function ToastLayer(props) {
836
2718
  const $ = compilerRuntime.c(11), {
837
2719
  as: t0,
@@ -842,7 +2724,7 @@ function ToastLayer(props) {
842
2724
  gap: t2
843
2725
  } = props, as = t0 === void 0 ? DEFAULT_TOAST_LAYER_ELEMENT : t0, padding = t1 === void 0 ? 4 : t1, gap = t2 === void 0 ? 3 : t2, {
844
2726
  zIndex
845
- } = _visualEditing.useLayer();
2727
+ } = useLayer();
846
2728
  let t3;
847
2729
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t3 = css.toastLayer(), $[0] = t3) : t3 = $[0];
848
2730
  let t4;
@@ -850,7 +2732,7 @@ function ToastLayer(props) {
850
2732
  zIndex
851
2733
  }, $[1] = zIndex, $[2] = t4) : t4 = $[2];
852
2734
  let t5;
853
- return $[3] !== as || $[4] !== children || $[5] !== gap || $[6] !== padding || $[7] !== paddingX || $[8] !== paddingY || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Grid, { as, className: t3, "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, gridTemplateColumns: 1, style: t4, children }), $[3] = as, $[4] = children, $[5] = gap, $[6] = padding, $[7] = paddingX, $[8] = paddingY, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
2735
+ return $[3] !== as || $[4] !== children || $[5] !== gap || $[6] !== padding || $[7] !== paddingX || $[8] !== paddingY || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(Grid, { as, className: t3, "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, gridTemplateColumns: 1, style: t4, children }), $[3] = as, $[4] = children, $[5] = gap, $[6] = padding, $[7] = paddingX, $[8] = paddingY, $[9] = t4, $[10] = t5) : t5 = $[10], t5;
854
2736
  }
855
2737
  let toastId = 0;
856
2738
  function generateToastId() {
@@ -896,14 +2778,14 @@ function ToastProvider(props) {
896
2778
  }, $[1] = t3) : t3 = $[1], t2 = t3;
897
2779
  const value = t2;
898
2780
  let t4;
899
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.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];
2781
+ $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.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];
900
2782
  let t5;
901
2783
  return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
902
2784
  children,
903
2785
  t4
904
2786
  ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
905
2787
  }
906
- function _temp$2(t0) {
2788
+ function _temp$4(t0) {
907
2789
  const {
908
2790
  dismiss: dismiss_0,
909
2791
  id: id_0,
@@ -915,7 +2797,7 @@ function useToast() {
915
2797
  const value = react.useContext(ToastContext);
916
2798
  if (!value)
917
2799
  throw new Error("useToast(): missing context value");
918
- if (!_visualEditing.isRecord(value) || value.version !== 0)
2800
+ if (!isRecord(value) || value.version !== 0)
919
2801
  throw new Error("useToast(): the context value is not compatible");
920
2802
  return value;
921
2803
  }
@@ -973,7 +2855,7 @@ function _focusItemElement(el) {
973
2855
  firstChild && firstChild instanceof HTMLElement && firstChild.focus();
974
2856
  }
975
2857
  }
976
- const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/v3/tree", null), DEFAULT_TREE_ELEMENT = "div";
2858
+ const TreeContext = createGlobalScopedContext("@sanity/ui/v3/tree", null), DEFAULT_TREE_ELEMENT = "div";
977
2859
  function Tree(props) {
978
2860
  const $ = compilerRuntime.c(38), t0 = props;
979
2861
  let children, forwardedRef, onFocus, rest, t1;
@@ -1126,7 +3008,7 @@ function Tree(props) {
1126
3008
  let t19;
1127
3009
  $[27] !== children ? (t19 = [children], $[27] = children, $[28] = t19) : t19 = $[28], react.useEffect(t18, t19);
1128
3010
  let t20;
1129
- $[29] !== children || $[30] !== gap || $[31] !== handleFocus || $[32] !== handleKeyDown || $[33] !== rest ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...rest, gap, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", children }), $[29] = children, $[30] = gap, $[31] = handleFocus, $[32] = handleKeyDown, $[33] = rest, $[34] = t20) : t20 = $[34];
3011
+ $[29] !== children || $[30] !== gap || $[31] !== handleFocus || $[32] !== handleKeyDown || $[33] !== rest ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "data-ui": "Tree", ...rest, gap, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", children }), $[29] = children, $[30] = gap, $[31] = handleFocus, $[32] = handleKeyDown, $[33] = rest, $[34] = t20) : t20 = $[34];
1130
3012
  let t21;
1131
3013
  return $[35] !== contextValue || $[36] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t20 }), $[35] = contextValue, $[36] = t20, $[37] = t21) : t21 = $[37], t21;
1132
3014
  }
@@ -1146,7 +3028,7 @@ const TreeGroup = function(props) {
1146
3028
  } = t0, $[0] = t0, $[1] = children, $[2] = rest, $[3] = t1) : (children = $[1], rest = $[2], t1 = $[3]);
1147
3029
  const expanded = t1 === void 0 ? !1 : t1, tree = useTree(), t2 = !expanded;
1148
3030
  let t3;
1149
- return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.gap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.gap, role: "group", gap: tree.gap, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.gap, $[8] = t3) : t3 = $[8], t3;
3031
+ return $[4] !== children || $[5] !== rest || $[6] !== t2 || $[7] !== tree.gap ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { as: "ul", "data-ui": "TreeGroup", ...rest, hidden: t2, marginTop: tree.gap, role: "group", gap: tree.gap, children }), $[4] = children, $[5] = rest, $[6] = t2, $[7] = tree.gap, $[8] = t3) : t3 = $[8], t3;
1150
3032
  }, DEFAULT_TREE_ITEM_ELEMENT = "a";
1151
3033
  function TreeItem(props) {
1152
3034
  const {
@@ -1187,23 +3069,23 @@ function TreeItem(props) {
1187
3069
  if (rootRef.current)
1188
3070
  return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
1189
3071
  }, [expanded, itemPath, registerItem, selected]);
1190
- const content2 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { gap: space, padding, children: [
1191
- /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { style: {
3072
+ const content2 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
3073
+ /* @__PURE__ */ jsxRuntime.jsxs(Box, { style: {
1192
3074
  visibility: IconComponent || children ? "visible" : "hidden",
1193
3075
  pointerEvents: "none"
1194
3076
  }, children: [
1195
- IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
1196
- !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
3077
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
3078
+ !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1197
3079
  transform: expanded ? "rotate(90deg)" : void 0
1198
3080
  } }) })
1199
3081
  ] }),
1200
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
3082
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
1201
3083
  ] });
1202
- return href ? /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: css.treeItem({
3084
+ return href ? /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...rest, as: "li", className: css.treeItem({
1203
3085
  className
1204
3086
  }), onClick: handleClick, ref: rootRef, role: "none", children: [
1205
3087
  /* @__PURE__ */ jsxRuntime.jsx(
1206
- _visualEditing.Selectable,
3088
+ Selectable,
1207
3089
  {
1208
3090
  "aria-expanded": expanded,
1209
3091
  as: linkAs,
@@ -1221,11 +3103,11 @@ function TreeItem(props) {
1221
3103
  }
1222
3104
  ),
1223
3105
  /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }) })
1224
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...rest, "aria-expanded": expanded, className: css.treeItem({
3106
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...rest, "aria-expanded": expanded, className: css.treeItem({
1225
3107
  className
1226
3108
  }), onClick: handleClick, onKeyDown: handleKeyDown, ref: rootRef, role: "treeitem", tabIndex, children: [
1227
3109
  /* @__PURE__ */ jsxRuntime.jsx(
1228
- _visualEditing.Selectable,
3110
+ Selectable,
1229
3111
  {
1230
3112
  as: "button",
1231
3113
  "data-focused": focused ? "" : void 0,
@@ -1328,7 +3210,7 @@ function VirtualList(props) {
1328
3210
  let t142;
1329
3211
  $[27] !== items[0] || $[28] !== renderItem ? (t142 = renderItem(items[0]), $[27] = items[0], $[28] = renderItem, $[29] = t142) : t142 = $[29];
1330
3212
  let t152;
1331
- $[30] !== t142 ? (t152 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { ref: t133, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t142 }, 0), $[30] = t142, $[31] = t152) : t152 = $[31];
3213
+ $[30] !== t142 ? (t152 = /* @__PURE__ */ jsxRuntime.jsx(Box, { ref: t133, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t142 }, 0), $[30] = t142, $[31] = t152) : t152 = $[31];
1332
3214
  let t162;
1333
3215
  $[32] === Symbol.for("react.memo_cache_sentinel") ? (t162 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[32] = t162) : t162 = $[32];
1334
3216
  const t17 = css.vars.space[gap];
@@ -1347,10 +3229,10 @@ function VirtualList(props) {
1347
3229
  if ($[38] !== fromIndex || $[39] !== gapValue || $[40] !== getItemKey || $[41] !== itemHeight || $[42] !== items || $[43] !== renderItem || $[44] !== toIndex) {
1348
3230
  let t142;
1349
3231
  $[46] !== fromIndex || $[47] !== gapValue || $[48] !== getItemKey || $[49] !== itemHeight || $[50] !== renderItem ? (t142 = (item, _itemIndex) => {
1350
- const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
1351
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
3232
+ const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
3233
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
1352
3234
  top: itemIndex * (itemHeight + gapValue)
1353
- }, children: node }, key);
3235
+ }, children: node }, key2);
1354
3236
  }, $[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;
1355
3237
  } else
1356
3238
  t132 = $[45];
@@ -1365,7 +3247,7 @@ function VirtualList(props) {
1365
3247
  let t15;
1366
3248
  $[54] !== children || $[55] !== wrapperStyle ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[54] = children, $[55] = wrapperStyle, $[56] = t15) : t15 = $[56];
1367
3249
  let t16;
1368
- return $[57] !== as || $[58] !== rest || $[59] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t15 }), $[57] = as, $[58] = rest, $[59] = t15, $[60] = t16) : t16 = $[60], t16;
3250
+ return $[57] !== as || $[58] !== rest || $[59] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t15 }), $[57] = as, $[58] = rest, $[59] = t15, $[60] = t16) : t16 = $[60], t16;
1369
3251
  }
1370
3252
  function findScrollable(parentNode) {
1371
3253
  let _scrollEl = parentNode;
@@ -1413,12 +3295,18 @@ function _createElementSizeObserver() {
1413
3295
  };
1414
3296
  }
1415
3297
  function useElementSize(element) {
1416
- const $ = compilerRuntime.c(3), [size, setSize] = react.useState(null);
3298
+ const $ = compilerRuntime.c(3), [size2, setSize] = react.useState(null);
1417
3299
  let t0, t1;
1418
3300
  return $[0] !== element ? (t0 = () => {
1419
3301
  if (element)
1420
3302
  return _elementSizeObserver.subscribe(element, setSize);
1421
- }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1), size;
3303
+ }, t1 = [element], $[0] = element, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), react.useEffect(t0, t1), size2;
3304
+ }
3305
+ function usePrefersDark(t0) {
3306
+ return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$3 : t0);
3307
+ }
3308
+ function _temp$3() {
3309
+ return !1;
1422
3310
  }
1423
3311
  const DEFAULT_LABEL_ELEMENT = "div";
1424
3312
  function Label(props) {
@@ -1435,15 +3323,15 @@ function Label(props) {
1435
3323
  weight: t3,
1436
3324
  ...rest
1437
3325
  } = 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]);
1438
- 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;
3326
+ 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;
1439
3327
  let t4;
1440
- $[10] !== align || $[11] !== className || $[12] !== muted || $[13] !== size || $[14] !== weight ? (t4 = css.label({
3328
+ $[10] !== align || $[11] !== className || $[12] !== muted || $[13] !== size2 || $[14] !== weight ? (t4 = css.label({
1441
3329
  className,
1442
3330
  align,
1443
3331
  muted,
1444
- size,
3332
+ size: size2,
1445
3333
  weight
1446
- }), $[10] = align, $[11] = className, $[12] = muted, $[13] = size, $[14] = weight, $[15] = t4) : t4 = $[15];
3334
+ }), $[10] = align, $[11] = className, $[12] = muted, $[13] = size2, $[14] = weight, $[15] = t4) : t4 = $[15];
1447
3335
  let t5;
1448
3336
  $[16] !== textOverflowProp ? (t5 = css.textOverflow({
1449
3337
  textOverflow: textOverflowProp
@@ -1471,7 +3359,7 @@ function Avatar(props) {
1471
3359
  size: t3,
1472
3360
  ...rest
1473
3361
  } = 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]);
1474
- const Element2 = t1 === void 0 ? DEFAULT_AVATAR_ELEMENT : t1, color = t2 === void 0 ? "magenta" : t2, sizeProp = t3 === void 0 ? 1 : t3, size = _visualEditing.useResponsiveProp(sizeProp), [arrowPosition, setArrowPosition] = react.useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = react.useState(!1);
3362
+ 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] = react.useState(animateArrowFrom || arrowPositionProp || "inside"), [imageError, setImageError] = react.useState(!1);
1475
3363
  let t4, t5;
1476
3364
  $[13] !== arrowPosition || $[14] !== arrowPositionProp ? (t4 = () => {
1477
3365
  if (arrowPosition === arrowPositionProp)
@@ -1489,7 +3377,7 @@ function Avatar(props) {
1489
3377
  }, $[20] = onImageLoadError, $[21] = t8) : t8 = $[21];
1490
3378
  const handleImageError = t8;
1491
3379
  let t9, t10;
1492
- $[22] !== size ? (t10 = Object.values(size).map(_temp$1), $[22] = size, $[23] = t10) : t10 = $[23], t9 = t10;
3380
+ $[22] !== size2 ? (t10 = Object.values(size2).map(_temp$2), $[22] = size2, $[23] = t10) : t10 = $[23], t9 = t10;
1493
3381
  const initialsSize = t9, t11 = __unstable_hideInnerStroke ? "" : void 0;
1494
3382
  let t12;
1495
3383
  $[24] !== className || $[25] !== color || $[26] !== sizeProp ? (t12 = css.avatar({
@@ -1505,9 +3393,9 @@ function Avatar(props) {
1505
3393
  let t16;
1506
3394
  $[31] === Symbol.for("react.memo_cache_sentinel") ? (t16 = css.avatarInitials(), $[31] = t16) : t16 = $[31];
1507
3395
  let t17;
1508
- $[32] !== initials || $[33] !== initialsSize ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { alignItems: "center", as: "span", className: t16, display: "flex", justifyContent: "center", position: "absolute", inset: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: initialsSize, weight: "medium", children: initials }) }), $[32] = initials, $[33] = initialsSize, $[34] = t17) : t17 = $[34];
3396
+ $[32] !== initials || $[33] !== initialsSize ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(Box, { alignItems: "center", as: "span", className: t16, display: "flex", justifyContent: "center", position: "absolute", inset: 0, children: /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: initialsSize, weight: "medium", children: initials }) }), $[32] = initials, $[33] = initialsSize, $[34] = t17) : t17 = $[34];
1509
3397
  let t18;
1510
- $[35] !== handleImageError || $[36] !== initials || $[37] !== src ? (t18 = src && /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: css.avatarImage(), inset: 0, position: "absolute", children: [
3398
+ $[35] !== handleImageError || $[36] !== initials || $[37] !== src ? (t18 = src && /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: css.avatarImage(), inset: 0, position: "absolute", children: [
1511
3399
  /* @__PURE__ */ jsxRuntime.jsx("img", { alt: initials, onError: handleImageError, src }),
1512
3400
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: css.avatarImageOutline() })
1513
3401
  ] }), $[35] = handleImageError, $[36] = initials, $[37] = src, $[38] = t18) : t18 = $[38];
@@ -1518,7 +3406,7 @@ function Avatar(props) {
1518
3406
  t18
1519
3407
  ] }), $[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;
1520
3408
  }
1521
- function _temp$1(s) {
3409
+ function _temp$2(s) {
1522
3410
  return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1523
3411
  }
1524
3412
  const DEFAULT_AVATAR_COUNTER_ELEMENT = "span";
@@ -1532,21 +3420,21 @@ function AvatarCounter(props) {
1532
3420
  size: t2,
1533
3421
  ...rest
1534
3422
  } = t0, $[0] = t0, $[1] = className, $[2] = count, $[3] = rest, $[4] = t1, $[5] = t2) : (className = $[1], count = $[2], rest = $[3], t1 = $[4], t2 = $[5]);
1535
- const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size = _visualEditing.useResponsiveProp(t2 === void 0 ? 1 : t2);
3423
+ const as = t1 === void 0 ? DEFAULT_AVATAR_COUNTER_ELEMENT : t1, size2 = useResponsiveProp(t2 === void 0 ? 1 : t2);
1536
3424
  let t3, t4;
1537
- $[6] !== size ? (t4 = Object.values(size).map(_temp), $[6] = size, $[7] = t4) : t4 = $[7], t3 = t4;
3425
+ $[6] !== size2 ? (t4 = Object.values(size2).map(_temp$1), $[6] = size2, $[7] = t4) : t4 = $[7], t3 = t4;
1538
3426
  const labelSize = t3;
1539
3427
  let t5;
1540
- $[8] !== className || $[9] !== size ? (t5 = css.avatarCounter({
3428
+ $[8] !== className || $[9] !== size2 ? (t5 = css.avatarCounter({
1541
3429
  className,
1542
- size
1543
- }), $[8] = className, $[9] = size, $[10] = t5) : t5 = $[10];
3430
+ size: size2
3431
+ }), $[8] = className, $[9] = size2, $[10] = t5) : t5 = $[10];
1544
3432
  let t6;
1545
3433
  $[11] !== count || $[12] !== labelSize ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(Label, { align: "center", as: "span", size: labelSize, weight: "medium", children: count }), $[11] = count, $[12] = labelSize, $[13] = t6) : t6 = $[13];
1546
3434
  let t7;
1547
- return $[14] !== as || $[15] !== rest || $[16] !== t5 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.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;
3435
+ return $[14] !== as || $[15] !== rest || $[16] !== t5 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.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;
1548
3436
  }
1549
- function _temp(s) {
3437
+ function _temp$1(s) {
1550
3438
  return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
1551
3439
  }
1552
3440
  const DEFAULT_AVATAR_STACK_ELEMENT = "span";
@@ -1561,17 +3449,17 @@ function AvatarStack(props) {
1561
3449
  size: t3,
1562
3450
  ...rest
1563
3451
  } = 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]);
1564
- const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = react.Children.toArray(childrenProp).filter(react.isValidElement), maxLength = Math.max(maxLengthProp, 0), size = _visualEditing.useResponsiveProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = _visualEditing.Box, t4 = "AvatarStack", t5 = "center";
3452
+ const as = t1 === void 0 ? DEFAULT_AVATAR_STACK_ELEMENT : t1, maxLengthProp = t2 === void 0 ? 4 : t2, sizeProp = t3 === void 0 ? 1 : t3, children = react.Children.toArray(childrenProp).filter(react.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";
1565
3453
  let t6;
1566
- $[7] !== className || $[8] !== size ? (t6 = css.avatarStack({
3454
+ $[7] !== className || $[8] !== size2 ? (t6 = css.avatarStack({
1567
3455
  className,
1568
- size
1569
- }), $[7] = className, $[8] = size, $[9] = t6) : t6 = $[9];
1570
- const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size });
3456
+ size: size2
3457
+ }), $[7] = className, $[8] = size2, $[9] = t6) : t6 = $[9];
3458
+ const t7 = "flex", t8 = "flex-start", t9 = len === 0 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }), t10 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 });
1571
3459
  let t11;
1572
- $[10] !== size ? (t11 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: react.cloneElement(child, {
1573
- size
1574
- }) }, String(childIndex)), $[10] = size, $[11] = t11) : t11 = $[11];
3460
+ $[10] !== size2 ? (t11 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: react.cloneElement(child, {
3461
+ size: size2
3462
+ }) }, String(childIndex)), $[10] = size2, $[11] = t11) : t11 = $[11];
1575
3463
  const t12 = visibleChildren.map(t11);
1576
3464
  let t13;
1577
3465
  return $[12] !== T0 || $[13] !== as || $[14] !== rest || $[15] !== t10 || $[16] !== t12 || $[17] !== t6 || $[18] !== t9 ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(T0, { "data-ui": t4, ...rest, alignItems: t5, as, className: t6, display: t7, justifyContent: t8, children: [
@@ -1602,9 +3490,9 @@ function Badge(props) {
1602
3490
  tone
1603
3491
  }), $[10] = className, $[11] = tone, $[12] = t7) : t7 = $[12];
1604
3492
  let t8;
1605
- $[13] !== children || $[14] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children }), $[13] = children, $[14] = fontSize, $[15] = t8) : t8 = $[15];
3493
+ $[13] !== children || $[14] !== fontSize ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children }), $[13] = children, $[14] = fontSize, $[15] = t8) : t8 = $[15];
1606
3494
  let t9;
1607
- return $[16] !== as || $[17] !== flex || $[18] !== padding || $[19] !== radius || $[20] !== rest || $[21] !== t7 || $[22] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Badge", ...rest, as, className: t7, flex, display: "flex", maxWidth: "fill", padding, radius, width: "min", children: t8 }), $[16] = as, $[17] = flex, $[18] = padding, $[19] = radius, $[20] = rest, $[21] = t7, $[22] = t8, $[23] = t9) : t9 = $[23], t9;
3495
+ return $[16] !== as || $[17] !== flex || $[18] !== padding || $[19] !== radius || $[20] !== rest || $[21] !== t7 || $[22] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Badge", ...rest, as, className: t7, flex, display: "flex", maxWidth: "fill", padding, radius, width: "min", children: t8 }), $[16] = as, $[17] = flex, $[18] = padding, $[19] = radius, $[20] = rest, $[21] = t7, $[22] = t8, $[23] = t9) : t9 = $[23], t9;
1608
3496
  }
1609
3497
  const DEFAULT_CHECKBOX_ELEMENT = "input";
1610
3498
  function Checkbox(props) {
@@ -1627,7 +3515,7 @@ function Checkbox(props) {
1627
3515
  let t3, t4;
1628
3516
  $[11] !== indeterminate ? (t3 = () => {
1629
3517
  ref.current && (ref.current.indeterminate = indeterminate || !1);
1630
- }, t4 = [indeterminate], $[11] = indeterminate, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), react.useEffect(t3, t4), _visualEditing.useCustomValidity(ref, customValidity);
3518
+ }, t4 = [indeterminate], $[11] = indeterminate, $[12] = t3, $[13] = t4) : (t3 = $[12], t4 = $[13]), react.useEffect(t3, t4), useCustomValidity(ref, customValidity);
1631
3519
  let t5;
1632
3520
  $[14] !== className ? (t5 = css.checkbox({
1633
3521
  className
@@ -1663,13 +3551,13 @@ function Code(props) {
1663
3551
  weight: t3,
1664
3552
  ...rest
1665
3553
  } = 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]);
1666
- 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;
3554
+ 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;
1667
3555
  let t4;
1668
- $[8] !== className || $[9] !== size || $[10] !== weight ? (t4 = css.code({
3556
+ $[8] !== className || $[9] !== size2 || $[10] !== weight ? (t4 = css.code({
1669
3557
  className,
1670
- size,
3558
+ size: size2,
1671
3559
  weight
1672
- }), $[8] = className, $[9] = size, $[10] = weight, $[11] = t4) : t4 = $[11];
3560
+ }), $[8] = className, $[9] = size2, $[10] = weight, $[11] = t4) : t4 = $[11];
1673
3561
  let t5;
1674
3562
  $[12] !== children ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("code", { children }), $[12] = children, $[13] = t5) : t5 = $[13];
1675
3563
  let t6;
@@ -1695,16 +3583,16 @@ function Heading(props) {
1695
3583
  weight: t4,
1696
3584
  ...rest
1697
3585
  } = 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]);
1698
- 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;
3586
+ 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;
1699
3587
  let t5;
1700
- $[11] !== align || $[12] !== className || $[13] !== flex || $[14] !== muted || $[15] !== size || $[16] !== weight ? (t5 = css.heading({
3588
+ $[11] !== align || $[12] !== className || $[13] !== flex || $[14] !== muted || $[15] !== size2 || $[16] !== weight ? (t5 = css.heading({
1701
3589
  className,
1702
3590
  align,
1703
3591
  flex,
1704
3592
  muted,
1705
- size,
3593
+ size: size2,
1706
3594
  weight
1707
- }), $[11] = align, $[12] = className, $[13] = flex, $[14] = muted, $[15] = size, $[16] = weight, $[17] = t5) : t5 = $[17];
3595
+ }), $[11] = align, $[12] = className, $[13] = flex, $[14] = muted, $[15] = size2, $[16] = weight, $[17] = t5) : t5 = $[17];
1708
3596
  let t6;
1709
3597
  $[18] !== textOverflowProp ? (t6 = css.textOverflow({
1710
3598
  textOverflow: textOverflowProp
@@ -1726,7 +3614,7 @@ function Inline(props) {
1726
3614
  } = t0, $[0] = t0, $[1] = children, $[2] = gap, $[3] = rest, $[4] = t1) : (children = $[1], gap = $[2], rest = $[3], t1 = $[4]);
1727
3615
  const as = t1 === void 0 ? DEFAULT_INLINE_ELEMENT : t1;
1728
3616
  let t2;
1729
- return $[5] !== as || $[6] !== children || $[7] !== gap || $[8] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "Inline", ...rest, alignItems: "center", as, display: "flex", gap, flexWrap: "wrap", children }), $[5] = as, $[6] = children, $[7] = gap, $[8] = rest, $[9] = t2) : t2 = $[9], t2;
3617
+ return $[5] !== as || $[6] !== children || $[7] !== gap || $[8] !== rest ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Box, { "data-ui": "Inline", ...rest, alignItems: "center", as, display: "flex", gap, flexWrap: "wrap", children }), $[5] = as, $[6] = children, $[7] = gap, $[8] = rest, $[9] = t2) : t2 = $[9], t2;
1730
3618
  }
1731
3619
  const DEFAULT_RADIO_ELEMENT = "input";
1732
3620
  function Radio(props) {
@@ -1744,7 +3632,7 @@ function Radio(props) {
1744
3632
  } = t0, $[0] = t0, $[1] = className, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = readOnly, $[6] = rest, $[7] = style, $[8] = t1) : (className = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], readOnly = $[5], rest = $[6], style = $[7], t1 = $[8]);
1745
3633
  const Element2 = t1 === void 0 ? DEFAULT_RADIO_ELEMENT : t1, ref = react.useRef(null);
1746
3634
  let t2;
1747
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2), _visualEditing.useCustomValidity(ref, customValidity);
3635
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[9] = t2) : t2 = $[9], react.useImperativeHandle(forwardedRef, t2), useCustomValidity(ref, customValidity);
1748
3636
  let t3;
1749
3637
  $[10] !== className ? (t3 = css.radio({
1750
3638
  className
@@ -1782,7 +3670,7 @@ function Select(props) {
1782
3670
  } = t0, $[0] = t0, $[1] = children, $[2] = customValidity, $[3] = disabled, $[4] = forwardedRef, $[5] = readOnly, $[6] = rest, $[7] = t1, $[8] = t2, $[9] = t3, $[10] = t4, $[11] = t5, $[12] = t6) : (children = $[1], customValidity = $[2], disabled = $[3], forwardedRef = $[4], readOnly = $[5], rest = $[6], t1 = $[7], t2 = $[8], t3 = $[9], t4 = $[10], t5 = $[11], t6 = $[12]);
1783
3671
  const Element2 = t1 === void 0 ? DEFAULT_SELECT_ELEMENT : t1, border = t2 === void 0 ? !0 : t2, fontSize = t3 === void 0 ? 2 : t3, gap = t4 === void 0 ? 2 : t4, padding = t5 === void 0 ? 3 : t5, radius = t6 === void 0 ? 1 : t6, ref = react.useRef(null);
1784
3672
  let t7;
1785
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[13] = t7) : t7 = $[13], react.useImperativeHandle(forwardedRef, t7), _visualEditing.useCustomValidity(ref, customValidity);
3673
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[13] = t7) : t7 = $[13], react.useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
1786
3674
  let t8;
1787
3675
  $[14] !== border || $[15] !== fontSize || $[16] !== gap || $[17] !== padding || $[18] !== radius ? (t8 = css.select({
1788
3676
  border,
@@ -1801,9 +3689,9 @@ function Select(props) {
1801
3689
  let t13;
1802
3690
  $[27] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}), $[27] = t13) : t13 = $[27];
1803
3691
  let t14;
1804
- $[28] !== fontSize ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, children: t13 }), $[28] = fontSize, $[29] = t14) : t14 = $[29];
3692
+ $[28] !== fontSize ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize, children: t13 }), $[28] = fontSize, $[29] = t14) : t14 = $[29];
1805
3693
  let t15;
1806
- $[30] !== padding || $[31] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t12, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "span", display: "inline-block", padding, children: t14 }) }), $[30] = padding, $[31] = t14, $[32] = t15) : t15 = $[32];
3694
+ $[30] !== padding || $[31] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t12, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", display: "inline-block", padding, children: t14 }) }), $[30] = padding, $[31] = t14, $[32] = t15) : t15 = $[32];
1807
3695
  let t16;
1808
3696
  return $[33] !== t11 || $[34] !== t15 || $[35] !== t8 ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Select", className: t8, "data-icon-right": "", children: [
1809
3697
  t11,
@@ -1852,12 +3740,12 @@ function CodeSkeleton(props) {
1852
3740
  size: t1,
1853
3741
  ...rest
1854
3742
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1855
- const size = t1 === void 0 ? 2 : t1;
3743
+ const size2 = t1 === void 0 ? 2 : t1;
1856
3744
  let t2;
1857
- $[4] !== className || $[5] !== size ? (t2 = css.codeSkeleton({
3745
+ $[4] !== className || $[5] !== size2 ? (t2 = css.codeSkeleton({
1858
3746
  className,
1859
- size
1860
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3747
+ size: size2
3748
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1861
3749
  let t3;
1862
3750
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1863
3751
  }
@@ -1870,12 +3758,12 @@ function HeadingSkeleton(props) {
1870
3758
  size: t1,
1871
3759
  ...rest
1872
3760
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1873
- const size = t1 === void 0 ? 2 : t1;
3761
+ const size2 = t1 === void 0 ? 2 : t1;
1874
3762
  let t2;
1875
- $[4] !== className || $[5] !== size ? (t2 = css.headingSkeleton({
3763
+ $[4] !== className || $[5] !== size2 ? (t2 = css.headingSkeleton({
1876
3764
  className,
1877
- size
1878
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3765
+ size: size2
3766
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1879
3767
  let t3;
1880
3768
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1881
3769
  }
@@ -1888,12 +3776,12 @@ function LabelSkeleton(props) {
1888
3776
  size: t1,
1889
3777
  ...rest
1890
3778
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1891
- const size = t1 === void 0 ? 2 : t1;
3779
+ const size2 = t1 === void 0 ? 2 : t1;
1892
3780
  let t2;
1893
- $[4] !== className || $[5] !== size ? (t2 = css.labelSkeleton({
3781
+ $[4] !== className || $[5] !== size2 ? (t2 = css.labelSkeleton({
1894
3782
  className,
1895
- size
1896
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3783
+ size: size2
3784
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1897
3785
  let t3;
1898
3786
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1899
3787
  }
@@ -1906,12 +3794,12 @@ function TextSkeleton(props) {
1906
3794
  size: t1,
1907
3795
  ...rest
1908
3796
  } = t0, $[0] = t0, $[1] = className, $[2] = rest, $[3] = t1) : (className = $[1], rest = $[2], t1 = $[3]);
1909
- const size = t1 === void 0 ? 2 : t1;
3797
+ const size2 = t1 === void 0 ? 2 : t1;
1910
3798
  let t2;
1911
- $[4] !== className || $[5] !== size ? (t2 = css.textSkeleton({
3799
+ $[4] !== className || $[5] !== size2 ? (t2 = css.textSkeleton({
1912
3800
  className,
1913
- size
1914
- }), $[4] = className, $[5] = size, $[6] = t2) : t2 = $[6];
3801
+ size: size2
3802
+ }), $[4] = className, $[5] = size2, $[6] = t2) : t2 = $[6];
1915
3803
  let t3;
1916
3804
  return $[7] !== rest || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { ...rest, className: t2 }), $[7] = rest, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
1917
3805
  }
@@ -1969,7 +3857,7 @@ function Switch(props) {
1969
3857
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: css._switchThumb() })
1970
3858
  ] }), $[21] = t10) : t10 = $[21];
1971
3859
  let t11;
1972
- return $[22] !== style || $[23] !== t5 || $[24] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { className: t5, "data-ui": "Switch", display: "block", position: "relative", style, children: [
3860
+ return $[22] !== style || $[23] !== t5 || $[24] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: t5, "data-ui": "Switch", display: "block", position: "relative", style, children: [
1973
3861
  t9,
1974
3862
  t10
1975
3863
  ] }), $[22] = style, $[23] = t5, $[24] = t9, $[25] = t11) : t11 = $[25], t11;
@@ -1994,7 +3882,7 @@ function TextArea(props) {
1994
3882
  } = t0, $[0] = t0, $[1] = __unstable_disableFocusRing, $[2] = customValidity, $[3] = forwardedRef, $[4] = readOnly, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3, $[9] = t4, $[10] = t5, $[11] = t6, $[12] = t7) : (__unstable_disableFocusRing = $[1], customValidity = $[2], forwardedRef = $[3], readOnly = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8], t4 = $[9], t5 = $[10], t6 = $[11], t7 = $[12]);
1995
3883
  const Element2 = t1 === void 0 ? DEFAULT_TEXT_AREA_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, ref = react.useRef(null);
1996
3884
  let t8;
1997
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[13] = t8) : t8 = $[13], react.useImperativeHandle(forwardedRef, t8), _visualEditing.useCustomValidity(ref, customValidity);
3885
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t8 = () => ref.current, $[13] = t8) : t8 = $[13], react.useImperativeHandle(forwardedRef, t8), useCustomValidity(ref, customValidity);
1998
3886
  let t9;
1999
3887
  $[14] !== border || $[15] !== fontSize || $[16] !== gap || $[17] !== padding || $[18] !== radius ? (t9 = css.textArea({
2000
3888
  border,
@@ -2017,11 +3905,40 @@ function TextArea(props) {
2017
3905
  t15
2018
3906
  ] }), $[28] = t10, $[29] = t11, $[30] = t14, $[31] = t9, $[32] = t16) : t16 = $[32], t16;
2019
3907
  }
3908
+ function useDelayedState(initialState) {
3909
+ const $ = compilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef(void 0);
3910
+ let t0;
3911
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
3912
+ const action = () => {
3913
+ setState(nextState);
3914
+ };
3915
+ if (delayedAction.current && (clearTimeout(delayedAction.current), delayedAction.current = void 0), !delay)
3916
+ return action();
3917
+ delayedAction.current = setTimeout(action, delay);
3918
+ }, $[0] = t0) : t0 = $[0];
3919
+ const onStateChange = t0;
3920
+ let t1;
3921
+ return $[1] !== state ? (t1 = [state, onStateChange], $[1] = state, $[2] = t1) : t1 = $[2], t1;
3922
+ }
3923
+ 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 = {
3924
+ top: ["top-end", "top-start", "bottom", "left", "right"],
3925
+ "top-start": ["top", "top-end", "bottom-start", "left-start", "right-start"],
3926
+ "top-end": ["top", "top-start", "bottom-end", "left-end", "right-end"],
3927
+ bottom: ["bottom-end", "bottom-start", "top", "left", "right"],
3928
+ "bottom-start": ["bottom", "bottom-end", "top-start", "left-start", "right-start"],
3929
+ "bottom-end": ["bottom", "bottom-start", "top-end", "left-end", "right-end"],
3930
+ left: ["left-end", "left-start", "right", "top", "bottom"],
3931
+ "left-start": ["left", "left-end", "right-start", "top-start", "bottom-start"],
3932
+ "left-end": ["left", "left-start", "right-end", "top-end", "bottom-end"],
3933
+ right: ["right-end", "right-start", "left", "top", "bottom"],
3934
+ "right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
3935
+ "right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
3936
+ }, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/v3/tooltipDelayGroup", null);
2020
3937
  function TooltipDelayGroupProvider(props) {
2021
3938
  const $ = compilerRuntime.c(9), {
2022
3939
  children,
2023
3940
  delay
2024
- } = props, [isGroupActive, setIsGroupActive] = _visualEditing.useDelayedState(!1), [openTooltipId, setOpenTooltipId] = _visualEditing.useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
3941
+ } = props, [isGroupActive, setIsGroupActive] = useDelayedState(!1), [openTooltipId, setOpenTooltipId] = useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
2025
3942
  let t0;
2026
3943
  const t1 = isGroupActive ? 1 : openDelay;
2027
3944
  let t2;
@@ -2034,7 +3951,220 @@ function TooltipDelayGroupProvider(props) {
2034
3951
  }, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
2035
3952
  const value = t0;
2036
3953
  let t3;
2037
- return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
3954
+ return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
3955
+ }
3956
+ function useTooltipDelayGroup() {
3957
+ return react.useContext(TooltipDelayGroupContext);
3958
+ }
3959
+ function TooltipLayer(props) {
3960
+ const $ = compilerRuntime.c(50);
3961
+ let animate, arrow, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, rest, scheme, shadow, style, t0;
3962
+ $[0] !== props ? ({
3963
+ animate,
3964
+ arrow,
3965
+ arrowRef,
3966
+ arrowX,
3967
+ arrowY,
3968
+ children,
3969
+ originX,
3970
+ originY,
3971
+ padding,
3972
+ placement,
3973
+ radius,
3974
+ scheme,
3975
+ shadow,
3976
+ style,
3977
+ tone: t0,
3978
+ ...rest
3979
+ } = props, $[0] = props, $[1] = animate, $[2] = arrow, $[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], arrow = $[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]);
3980
+ const tone = t0 === void 0 ? "inherit" : t0;
3981
+ let t1;
3982
+ const t2 = animate ? "transform" : void 0;
3983
+ let t3;
3984
+ $[17] !== originX || $[18] !== originY || $[19] !== style || $[20] !== t2 ? (t3 = {
3985
+ originX,
3986
+ originY,
3987
+ willChange: t2,
3988
+ ...style
3989
+ }, $[17] = originX, $[18] = originY, $[19] = style, $[20] = t2, $[21] = t3) : t3 = $[21], t1 = t3;
3990
+ const rootStyle = t1;
3991
+ let t4;
3992
+ const t5 = arrowX !== null ? arrowX : void 0, t6 = arrowY !== null ? arrowY : void 0;
3993
+ let t7;
3994
+ $[22] !== t5 || $[23] !== t6 ? (t7 = {
3995
+ left: t5,
3996
+ top: t6,
3997
+ right: void 0,
3998
+ bottom: void 0
3999
+ }, $[22] = t5, $[23] = t6, $[24] = t7) : t7 = $[24], t4 = t7;
4000
+ const arrowStyle = t4, t8 = animate ? "" : void 0;
4001
+ let t9;
4002
+ $[25] !== animate ? (t9 = animate ? ["hidden", "initial"] : void 0, $[25] = animate, $[26] = t9) : t9 = $[26];
4003
+ let t10;
4004
+ $[27] !== animate ? (t10 = animate ? ["visible", "scaleIn"] : void 0, $[27] = animate, $[28] = t10) : t10 = $[28];
4005
+ let t11;
4006
+ $[29] !== animate ? (t11 = animate ? ["hidden", "scaleOut"] : void 0, $[29] = animate, $[30] = t11) : t11 = $[30];
4007
+ let t12;
4008
+ $[31] !== arrow || $[32] !== arrowRef || $[33] !== arrowStyle ? (t12 = arrow && /* @__PURE__ */ jsxRuntime.jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[31] = arrow, $[32] = arrowRef, $[33] = arrowStyle, $[34] = t12) : t12 = $[34];
4009
+ let t13;
4010
+ 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__ */ jsxRuntime.jsxs(Layer, { "data-ui": "Tooltip__layer", ...rest, as: framerMotion.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: [
4011
+ children,
4012
+ t12
4013
+ ] }), $[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;
4014
+ }
4015
+ const DEFAULT_TOOLTIP_ELEMENT = "div";
4016
+ function Tooltip(props) {
4017
+ const boundaryElementContext = useBoundaryElement(), {
4018
+ animate: _animate = !1,
4019
+ arrow: arrowProp = !1,
4020
+ as = DEFAULT_TOOLTIP_ELEMENT,
4021
+ boundaryElement = boundaryElementContext?.element,
4022
+ children: childProp,
4023
+ className,
4024
+ content: content2,
4025
+ delay,
4026
+ disabled,
4027
+ fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4028
+ padding = 2,
4029
+ placement: placementProp = "bottom",
4030
+ portal: portalProp,
4031
+ radius = 3,
4032
+ ref: forwardedRef,
4033
+ scheme,
4034
+ shadow = 2,
4035
+ zOffset = Z_OFFSETS.tooltip,
4036
+ tone = "inherit",
4037
+ ...rest
4038
+ } = props, card = useCard(), animate = usePrefersReducedMotion() ? !1 : _animate, ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
4039
+ react.useImperativeHandle(forwardedRef, () => ref.current);
4040
+ const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
4041
+ const ret = [];
4042
+ return ret.push(reactDom$1.flip({
4043
+ boundary: boundaryElement || void 0,
4044
+ fallbackPlacements,
4045
+ padding: DEFAULT_TOOLTIP_PADDING,
4046
+ rootBoundary
4047
+ })), ret.push(reactDom$1.offset({
4048
+ mainAxis: DEFAULT_TOOLTIP_DISTANCE
4049
+ })), ret.push(reactDom$1.shift({
4050
+ boundary: boundaryElement || void 0,
4051
+ rootBoundary,
4052
+ padding: DEFAULT_TOOLTIP_PADDING
4053
+ })), arrowProp && ret.push(reactDom$1.arrow({
4054
+ element: arrowRef,
4055
+ padding: DEFAULT_TOOLTIP_PADDING
4056
+ })), animate && ret.push(origin), ret;
4057
+ }, [animate, arrowProp, boundaryElement, fallbackPlacements]), {
4058
+ floatingStyles,
4059
+ placement,
4060
+ middlewareData,
4061
+ refs,
4062
+ update
4063
+ } = reactDom$1.useFloating({
4064
+ middleware,
4065
+ placement: placementProp,
4066
+ whileElementsMounted: reactDom$1.autoUpdate,
4067
+ elements: {
4068
+ reference: referenceElement
4069
+ },
4070
+ transform: !1
4071
+ }), arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = react.useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), {
4072
+ setIsGroupActive,
4073
+ setOpenTooltipId
4074
+ } = 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 = react.useCallback((open, immediate) => {
4075
+ if (isInsideGroup)
4076
+ if (open) {
4077
+ const groupedOpenDelay = immediate ? 0 : openDelay;
4078
+ setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
4079
+ } else {
4080
+ const groupDeactivateDelay = closeDelay > 200 ? closeDelay : 200;
4081
+ setIsGroupActive?.(open, groupDeactivateDelay), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
4082
+ }
4083
+ else
4084
+ setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
4085
+ }, [isInsideGroup, openDelay, setIsGroupActive, setOpenTooltipId, tooltipId, closeDelay, setIsOpen]), handleBlur = react.useCallback((e) => {
4086
+ handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
4087
+ }, [childProp?.props, handleIsOpenChange]), handleClick = react.useCallback((e_0) => {
4088
+ handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
4089
+ }, [childProp?.props, handleIsOpenChange]), handleContextMenu = react.useCallback((e_1) => {
4090
+ handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
4091
+ }, [childProp?.props, handleIsOpenChange]), handleFocus = react.useCallback((e_2) => {
4092
+ handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
4093
+ }, [childProp?.props, handleIsOpenChange]), handleMouseEnter = react.useCallback((e_3) => {
4094
+ handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
4095
+ }, [childProp?.props, handleIsOpenChange]), handleMouseLeave = react.useCallback((e_4) => {
4096
+ handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
4097
+ }, [childProp?.props, handleIsOpenChange]);
4098
+ useCloseOnMouseLeave({
4099
+ handleIsOpenChange,
4100
+ referenceElement,
4101
+ showTooltip,
4102
+ isInsideGroup
4103
+ }), react.useEffect(() => {
4104
+ disabled && showTooltip && handleIsOpenChange(!1);
4105
+ }, [disabled, handleIsOpenChange, showTooltip]), react.useEffect(() => {
4106
+ !content2 && showTooltip && handleIsOpenChange(!1);
4107
+ }, [content2, handleIsOpenChange, showTooltip]), react.useEffect(() => {
4108
+ if (!showTooltip) return;
4109
+ function handleWindowKeyDown(event) {
4110
+ event.key === "Escape" && handleIsOpenChange(!1, !0);
4111
+ }
4112
+ return window.addEventListener("keydown", handleWindowKeyDown), () => {
4113
+ window.removeEventListener("keydown", handleWindowKeyDown);
4114
+ };
4115
+ }, [handleIsOpenChange, showTooltip]), react.useLayoutEffect(() => {
4116
+ const availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
4117
+ setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2);
4118
+ }, [boundaryElement, portalElement]);
4119
+ const setArrow = react.useCallback((arrowEl) => {
4120
+ arrowRef.current = arrowEl, update();
4121
+ }, [update]), setFloating = react.useCallback((node) => {
4122
+ ref.current = node, refs.setFloating(node);
4123
+ }, [refs]), child = react.useMemo(() => childProp ? react.cloneElement(childProp, {
4124
+ onBlur: handleBlur,
4125
+ onFocus: handleFocus,
4126
+ onMouseEnter: handleMouseEnter,
4127
+ onMouseLeave: handleMouseLeave,
4128
+ onClick: handleClick,
4129
+ onContextMenu: handleContextMenu,
4130
+ ref: setReferenceElement
4131
+ }) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
4132
+ if (react.useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
4133
+ if (disabled) return child;
4134
+ const node_0 = /* @__PURE__ */ jsxRuntime.jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: css.tooltip({
4135
+ className
4136
+ }), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
4137
+ ...floatingStyles,
4138
+ maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
4139
+ }, tone, zOffset, children: content2 }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { tone: tone === "inherit" ? card.tone : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
4140
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4141
+ animate ? /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children }) : children,
4142
+ child
4143
+ ] });
4144
+ }
4145
+ function useCloseOnMouseLeave(t0) {
4146
+ const $ = compilerRuntime.c(10), {
4147
+ handleIsOpenChange,
4148
+ referenceElement,
4149
+ showTooltip,
4150
+ isInsideGroup
4151
+ } = t0;
4152
+ let t1;
4153
+ $[0] !== handleIsOpenChange || $[1] !== referenceElement ? (t1 = (target, teardown) => {
4154
+ referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
4155
+ }, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
4156
+ const onMouseMove = useEffectEvent.useEffectEvent(t1);
4157
+ let t2;
4158
+ $[3] !== isInsideGroup || $[4] !== onMouseMove || $[5] !== showTooltip ? (t2 = () => {
4159
+ if (!showTooltip || isInsideGroup)
4160
+ return;
4161
+ const handleMouseMove = (event) => {
4162
+ onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
4163
+ };
4164
+ return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
4165
+ }, $[3] = isInsideGroup, $[4] = onMouseMove, $[5] = showTooltip, $[6] = t2) : t2 = $[6];
4166
+ let t3;
4167
+ $[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], react.useEffect(t2, t3);
2038
4168
  }
2039
4169
  function BoundaryElementProvider(props) {
2040
4170
  const $ = compilerRuntime.c(5), {
@@ -2048,18 +4178,18 @@ function BoundaryElementProvider(props) {
2048
4178
  }, $[0] = element, $[1] = t1) : t1 = $[1], t0 = t1;
2049
4179
  const value = t0;
2050
4180
  let t2;
2051
- return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
4181
+ return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(BoundaryElementContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
2052
4182
  }
2053
- function findMaxBreakpoints(media, width) {
4183
+ function findMaxBreakpoints(media2, width) {
2054
4184
  const ret = [];
2055
- for (let i = 0; i < media.length; i += 1)
2056
- media[i] > width && ret.push(i);
4185
+ for (let i = 0; i < media2.length; i += 1)
4186
+ media2[i] > width && ret.push(i);
2057
4187
  return ret;
2058
4188
  }
2059
- function findMinBreakpoints(media, width) {
4189
+ function findMinBreakpoints(media2, width) {
2060
4190
  const ret = [];
2061
- for (let i = 0; i < media.length; i += 1)
2062
- media[i] <= width && ret.push(i);
4191
+ for (let i = 0; i < media2.length; i += 1)
4192
+ media2[i] <= width && ret.push(i);
2063
4193
  return ret;
2064
4194
  }
2065
4195
  const DEFAULT_ELEMENT_QUERY_ELEMENT = "div", DEFAULT_BREAKPOINTS = Object.values(css.BREAKPOINTS);
@@ -2125,6 +4255,43 @@ class ErrorBoundary extends react.Component {
2125
4255
  return this.props.children;
2126
4256
  }
2127
4257
  }
4258
+ function PortalProvider(props) {
4259
+ const $ = compilerRuntime.c(9), {
4260
+ children,
4261
+ element,
4262
+ __unstable_elements: elementsProp
4263
+ } = props, elements = useUnique(elementsProp), parentPortal = react.useContext(PortalContext);
4264
+ let t0;
4265
+ $[0] !== elements || $[1] !== parentPortal ? (t0 = () => elements?.default ?? (parentPortal.element || document.body), $[0] = elements, $[1] = parentPortal, $[2] = t0) : t0 = $[2];
4266
+ const fallbackElement = react.useSyncExternalStore(emptySubscribe, t0, _temp);
4267
+ let t1;
4268
+ const t2 = element || fallbackElement;
4269
+ let t3;
4270
+ $[3] !== elements || $[4] !== t2 ? (t3 = {
4271
+ version: 0,
4272
+ boundaryElement: null,
4273
+ element: t2,
4274
+ elements
4275
+ }, $[3] = elements, $[4] = t2, $[5] = t3) : t3 = $[5], t1 = t3;
4276
+ const value = t1;
4277
+ let t4;
4278
+ return $[6] !== children || $[7] !== value ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t4) : t4 = $[8], t4;
4279
+ }
4280
+ function _temp() {
4281
+ return null;
4282
+ }
4283
+ const emptySubscribe = () => () => {
4284
+ };
4285
+ function useUnique(value) {
4286
+ const valueRef = react.useRef(value);
4287
+ return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
4288
+ }
4289
+ function _isEqual(objA, objB) {
4290
+ if (!objA || !objB)
4291
+ return objA === objB;
4292
+ const keysA = Object.keys(objA), keysB = Object.keys(objB);
4293
+ return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
4294
+ }
2128
4295
  function RootProvider(props) {
2129
4296
  const $ = compilerRuntime.c(10), {
2130
4297
  boundaryElement: t0,
@@ -2134,11 +4301,11 @@ function RootProvider(props) {
2134
4301
  tone: t3
2135
4302
  } = props, boundaryElement = t0 === void 0 ? null : t0, portalElement = t1 === void 0 ? null : t1, scheme = t2 === void 0 ? "light" : t2, tone = t3 === void 0 ? "transparent" : t3;
2136
4303
  let t4;
2137
- $[0] !== children || $[1] !== portalElement ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.PortalProvider, { element: portalElement, children }), $[0] = children, $[1] = portalElement, $[2] = t4) : t4 = $[2];
4304
+ $[0] !== children || $[1] !== portalElement ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { element: portalElement, children }), $[0] = children, $[1] = portalElement, $[2] = t4) : t4 = $[2];
2138
4305
  let t5;
2139
4306
  $[3] !== boundaryElement || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(ToastProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(BoundaryElementProvider, { element: boundaryElement, children: t4 }) }), $[3] = boundaryElement, $[4] = t4, $[5] = t5) : t5 = $[5];
2140
4307
  let t6;
2141
- return $[6] !== scheme || $[7] !== t5 || $[8] !== tone ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.CardProvider, { scheme, tone, children: t5 }) }), $[6] = scheme, $[7] = t5, $[8] = tone, $[9] = t6) : t6 = $[9], t6;
4308
+ return $[6] !== scheme || $[7] !== t5 || $[8] !== tone ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(LayerProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(CardProvider, { scheme, tone, children: t5 }) }), $[6] = scheme, $[7] = t5, $[8] = tone, $[9] = t6) : t6 = $[9], t6;
2142
4309
  }
2143
4310
  const DEFAULT_ROOT_ELEMENT = "html";
2144
4311
  function Root(props) {
@@ -2189,118 +4356,73 @@ function Root(props) {
2189
4356
  tone
2190
4357
  }), $[24] = className, $[25] = height, $[26] = scheme, $[27] = tone, $[28] = t9) : t9 = $[28];
2191
4358
  let t10;
2192
- return $[29] !== as || $[30] !== node || $[31] !== overflow || $[32] !== rest || $[33] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as, "data-ui": "Root", ...rest, className: t9, overflow, ref: handleRef, children: node }), $[29] = as, $[30] = node, $[31] = overflow, $[32] = rest, $[33] = t9, $[34] = t10) : t10 = $[34], t10;
2193
- }
2194
- exports.Arrow = _visualEditing.Arrow;
2195
- exports.Box = _visualEditing.Box;
2196
- exports.Button = _visualEditing.Button;
2197
- exports.Card = _visualEditing.Card;
2198
- exports.CardProvider = _visualEditing.CardProvider;
2199
- exports.DEFAULT_ARROW_ELEMENT = _visualEditing.DEFAULT_ARROW_ELEMENT;
2200
- exports.DEFAULT_BOX_ELEMENT = _visualEditing.DEFAULT_BOX_ELEMENT;
2201
- exports.DEFAULT_BUTTON_ELEMENT = _visualEditing.DEFAULT_BUTTON_ELEMENT;
2202
- exports.DEFAULT_CARD_ELEMENT = _visualEditing.DEFAULT_CARD_ELEMENT;
2203
- exports.DEFAULT_FLEX_ELEMENT = _visualEditing.DEFAULT_FLEX_ELEMENT;
2204
- exports.DEFAULT_GRID_ELEMENT = _visualEditing.DEFAULT_GRID_ELEMENT;
2205
- exports.DEFAULT_HOTKEYS_ELEMENT = _visualEditing.DEFAULT_HOTKEYS_ELEMENT;
2206
- exports.DEFAULT_KBD_ELEMENT = _visualEditing.DEFAULT_KBD_ELEMENT;
2207
- exports.DEFAULT_LAYER_ELEMENT = _visualEditing.DEFAULT_LAYER_ELEMENT;
2208
- exports.DEFAULT_MENU_DIVIDER_ELEMENT = _visualEditing.DEFAULT_MENU_DIVIDER_ELEMENT;
2209
- exports.DEFAULT_MENU_ELEMENT = _visualEditing.DEFAULT_MENU_ELEMENT;
2210
- exports.DEFAULT_MENU_GROUP_ELEMENT = _visualEditing.DEFAULT_MENU_GROUP_ELEMENT;
2211
- exports.DEFAULT_MENU_ITEM_ELEMENT = _visualEditing.DEFAULT_MENU_ITEM_ELEMENT;
2212
- exports.DEFAULT_POPOVER_ELEMENT = _visualEditing.DEFAULT_POPOVER_ELEMENT;
2213
- exports.DEFAULT_SELECTABLE_ELEMENT = _visualEditing.DEFAULT_SELECTABLE_ELEMENT;
2214
- exports.DEFAULT_SPINNER_ELEMENT = _visualEditing.DEFAULT_SPINNER_ELEMENT;
2215
- exports.DEFAULT_STACK_ELEMENT = _visualEditing.DEFAULT_STACK_ELEMENT;
2216
- exports.DEFAULT_TAB_ELEMENT = _visualEditing.DEFAULT_TAB_ELEMENT;
2217
- exports.DEFAULT_TAB_LIST_ELEMENT = _visualEditing.DEFAULT_TAB_LIST_ELEMENT;
2218
- exports.DEFAULT_TEXT_ELEMENT = _visualEditing.DEFAULT_TEXT_ELEMENT;
2219
- exports.DEFAULT_TEXT_INPUT_ELEMENT = _visualEditing.DEFAULT_TEXT_INPUT_ELEMENT;
2220
- exports.DEFAULT_TOOLTIP_ELEMENT = _visualEditing.DEFAULT_TOOLTIP_ELEMENT;
2221
- exports.Flex = _visualEditing.Flex;
2222
- exports.Grid = _visualEditing.Grid;
2223
- exports.Hotkeys = _visualEditing.Hotkeys;
2224
- exports.KBD = _visualEditing.KBD;
2225
- exports.Layer = _visualEditing.Layer;
2226
- exports.LayerProvider = _visualEditing.LayerProvider;
2227
- exports.Menu = _visualEditing.Menu;
2228
- exports.MenuDivider = _visualEditing.MenuDivider;
2229
- exports.MenuGroup = _visualEditing.MenuGroup;
2230
- exports.MenuItem = _visualEditing.MenuItem;
2231
- exports.Popover = _visualEditing.Popover;
2232
- exports.Portal = _visualEditing.Portal;
2233
- exports.PortalProvider = _visualEditing.PortalProvider;
2234
- exports.Selectable = _visualEditing.Selectable;
2235
- exports.Spinner = _visualEditing.Spinner;
2236
- exports.Stack = _visualEditing.Stack;
2237
- exports.Tab = _visualEditing.Tab;
2238
- exports.TabList = _visualEditing.TabList;
2239
- exports.Text = _visualEditing.Text;
2240
- exports.TextInput = _visualEditing.TextInput;
2241
- exports.Tooltip = _visualEditing.Tooltip;
2242
- exports.TooltipDelayGroupContext = _visualEditing.TooltipDelayGroupContext;
2243
- exports._getArrayProp = _visualEditing._getArrayProp;
2244
- exports._getResponsiveProp = _visualEditing._getResponsiveProp;
2245
- exports._isEnterToClickElement = _visualEditing._isEnterToClickElement;
2246
- exports.containsOrEqualsElement = _visualEditing.containsOrEqualsElement;
2247
- exports.isHTMLAnchorElement = _visualEditing.isHTMLAnchorElement;
2248
- exports.isHTMLButtonElement = _visualEditing.isHTMLButtonElement;
2249
- exports.isHTMLElement = _visualEditing.isHTMLElement;
2250
- exports.isHTMLInputElement = _visualEditing.isHTMLInputElement;
2251
- exports.isHTMLSelectElement = _visualEditing.isHTMLSelectElement;
2252
- exports.isHTMLTextAreaElement = _visualEditing.isHTMLTextAreaElement;
2253
- exports.useBoundaryElement = _visualEditing.useBoundaryElement;
2254
- exports.useCard = _visualEditing.useCard;
2255
- exports.useClickOutsideEvent = _visualEditing.useClickOutsideEvent;
2256
- exports.useCustomValidity = _visualEditing.useCustomValidity;
2257
- exports.useGlobalKeyDown = _visualEditing.useGlobalKeyDown;
2258
- exports.useLayer = _visualEditing.useLayer;
2259
- exports.useMatchMedia = _visualEditing.useMatchMedia;
2260
- exports.useMediaIndex = _visualEditing.useMediaIndex;
2261
- exports.usePortal = _visualEditing.usePortal;
2262
- exports.usePrefersDark = _visualEditing.usePrefersDark;
2263
- exports.usePrefersReducedMotion = _visualEditing.usePrefersReducedMotion;
2264
- exports.useResponsiveProp = _visualEditing.useResponsiveProp;
2265
- exports.useTooltipDelayGroup = _visualEditing.useTooltipDelayGroup;
4359
+ return $[29] !== as || $[30] !== node || $[31] !== overflow || $[32] !== rest || $[33] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Box, { as, "data-ui": "Root", ...rest, className: t9, overflow, ref: handleRef, children: node }), $[29] = as, $[30] = node, $[31] = overflow, $[32] = rest, $[33] = t9, $[34] = t10) : t10 = $[34], t10;
4360
+ }
4361
+ exports.Arrow = Arrow;
2266
4362
  exports.Autocomplete = Autocomplete;
2267
4363
  exports.Avatar = Avatar;
2268
4364
  exports.AvatarCounter = AvatarCounter;
2269
4365
  exports.AvatarStack = AvatarStack;
2270
4366
  exports.Badge = Badge;
2271
4367
  exports.BoundaryElementProvider = BoundaryElementProvider;
4368
+ exports.Box = Box;
2272
4369
  exports.Breadcrumbs = Breadcrumbs;
4370
+ exports.Button = Button;
4371
+ exports.Card = Card;
4372
+ exports.CardProvider = CardProvider;
2273
4373
  exports.Checkbox = Checkbox;
2274
4374
  exports.Code = Code;
2275
4375
  exports.CodeSkeleton = CodeSkeleton;
2276
4376
  exports.Container = Container;
4377
+ exports.DEFAULT_ARROW_ELEMENT = DEFAULT_ARROW_ELEMENT;
2277
4378
  exports.DEFAULT_AUTOCOMPLETE_ELEMENT = DEFAULT_AUTOCOMPLETE_ELEMENT;
2278
4379
  exports.DEFAULT_AVATAR_COUNTER_ELEMENT = DEFAULT_AVATAR_COUNTER_ELEMENT;
2279
4380
  exports.DEFAULT_AVATAR_ELEMENT = DEFAULT_AVATAR_ELEMENT;
2280
4381
  exports.DEFAULT_AVATAR_STACK_ELEMENT = DEFAULT_AVATAR_STACK_ELEMENT;
2281
4382
  exports.DEFAULT_BADGE_ELEMENT = DEFAULT_BADGE_ELEMENT;
4383
+ exports.DEFAULT_BOX_ELEMENT = DEFAULT_BOX_ELEMENT;
2282
4384
  exports.DEFAULT_BREADCRUMBS_ELEMENT = DEFAULT_BREADCRUMBS_ELEMENT;
4385
+ exports.DEFAULT_BUTTON_ELEMENT = DEFAULT_BUTTON_ELEMENT;
4386
+ exports.DEFAULT_CARD_ELEMENT = DEFAULT_CARD_ELEMENT;
2283
4387
  exports.DEFAULT_CHECKBOX_ELEMENT = DEFAULT_CHECKBOX_ELEMENT;
2284
4388
  exports.DEFAULT_CODE_ELEMENT = DEFAULT_CODE_ELEMENT;
2285
4389
  exports.DEFAULT_CODE_SKELETON_ELEMENT = DEFAULT_CODE_SKELETON_ELEMENT;
2286
4390
  exports.DEFAULT_CONTAINER_ELEMENT = DEFAULT_CONTAINER_ELEMENT;
2287
4391
  exports.DEFAULT_DIALOG_ELEMENT = DEFAULT_DIALOG_ELEMENT;
2288
4392
  exports.DEFAULT_ELEMENT_QUERY_ELEMENT = DEFAULT_ELEMENT_QUERY_ELEMENT;
4393
+ exports.DEFAULT_FLEX_ELEMENT = DEFAULT_FLEX_ELEMENT;
4394
+ exports.DEFAULT_GRID_ELEMENT = DEFAULT_GRID_ELEMENT;
2289
4395
  exports.DEFAULT_HEADING_ELEMENT = DEFAULT_HEADING_ELEMENT;
2290
4396
  exports.DEFAULT_HEADING_SKELETON_ELEMENT = DEFAULT_HEADING_SKELETON_ELEMENT;
4397
+ exports.DEFAULT_HOTKEYS_ELEMENT = DEFAULT_HOTKEYS_ELEMENT;
2291
4398
  exports.DEFAULT_INLINE_ELEMENT = DEFAULT_INLINE_ELEMENT;
4399
+ exports.DEFAULT_KBD_ELEMENT = DEFAULT_KBD_ELEMENT;
2292
4400
  exports.DEFAULT_LABEL_ELEMENT = DEFAULT_LABEL_ELEMENT;
2293
4401
  exports.DEFAULT_LABEL_SKELETON_ELEMENT = DEFAULT_LABEL_SKELETON_ELEMENT;
4402
+ exports.DEFAULT_LAYER_ELEMENT = DEFAULT_LAYER_ELEMENT;
4403
+ exports.DEFAULT_MENU_DIVIDER_ELEMENT = DEFAULT_MENU_DIVIDER_ELEMENT;
4404
+ exports.DEFAULT_MENU_ELEMENT = DEFAULT_MENU_ELEMENT;
4405
+ exports.DEFAULT_MENU_GROUP_ELEMENT = DEFAULT_MENU_GROUP_ELEMENT;
4406
+ exports.DEFAULT_MENU_ITEM_ELEMENT = DEFAULT_MENU_ITEM_ELEMENT;
4407
+ exports.DEFAULT_POPOVER_ELEMENT = DEFAULT_POPOVER_ELEMENT;
2294
4408
  exports.DEFAULT_RADIO_ELEMENT = DEFAULT_RADIO_ELEMENT;
2295
4409
  exports.DEFAULT_ROOT_ELEMENT = DEFAULT_ROOT_ELEMENT;
4410
+ exports.DEFAULT_SELECTABLE_ELEMENT = DEFAULT_SELECTABLE_ELEMENT;
2296
4411
  exports.DEFAULT_SELECT_ELEMENT = DEFAULT_SELECT_ELEMENT;
2297
4412
  exports.DEFAULT_SKELETON_ELEMENT = DEFAULT_SKELETON_ELEMENT;
4413
+ exports.DEFAULT_SPINNER_ELEMENT = DEFAULT_SPINNER_ELEMENT;
2298
4414
  exports.DEFAULT_SR_ONLY_ELEMENT = DEFAULT_SR_ONLY_ELEMENT;
4415
+ exports.DEFAULT_STACK_ELEMENT = DEFAULT_STACK_ELEMENT;
2299
4416
  exports.DEFAULT_SWITCH_ELEMENT = DEFAULT_SWITCH_ELEMENT;
4417
+ exports.DEFAULT_TAB_ELEMENT = DEFAULT_TAB_ELEMENT;
4418
+ exports.DEFAULT_TAB_LIST_ELEMENT = DEFAULT_TAB_LIST_ELEMENT;
2300
4419
  exports.DEFAULT_TAB_PANEL_ELEMENT = DEFAULT_TAB_PANEL_ELEMENT;
2301
4420
  exports.DEFAULT_TEXT_AREA_ELEMENT = DEFAULT_TEXT_AREA_ELEMENT;
4421
+ exports.DEFAULT_TEXT_ELEMENT = DEFAULT_TEXT_ELEMENT;
4422
+ exports.DEFAULT_TEXT_INPUT_ELEMENT = DEFAULT_TEXT_INPUT_ELEMENT;
2302
4423
  exports.DEFAULT_TEXT_SKELETON_ELEMENT = DEFAULT_TEXT_SKELETON_ELEMENT;
2303
4424
  exports.DEFAULT_TOAST_ELEMENT = DEFAULT_TOAST_ELEMENT;
4425
+ exports.DEFAULT_TOOLTIP_ELEMENT = DEFAULT_TOOLTIP_ELEMENT;
2304
4426
  exports.DEFAULT_TREE_ELEMENT = DEFAULT_TREE_ELEMENT;
2305
4427
  exports.DEFAULT_TREE_ITEM_ELEMENT = DEFAULT_TREE_ITEM_ELEMENT;
2306
4428
  exports.DEFAULT_VIRTUAL_LIST_ELEMENT = DEFAULT_VIRTUAL_LIST_ELEMENT;
@@ -2309,40 +4431,85 @@ exports.DialogContext = DialogContext;
2309
4431
  exports.DialogProvider = DialogProvider;
2310
4432
  exports.ElementQuery = ElementQuery;
2311
4433
  exports.ErrorBoundary = ErrorBoundary;
4434
+ exports.Flex = Flex;
4435
+ exports.Grid = Grid;
2312
4436
  exports.Heading = Heading;
2313
4437
  exports.HeadingSkeleton = HeadingSkeleton;
4438
+ exports.Hotkeys = Hotkeys;
2314
4439
  exports.Inline = Inline;
4440
+ exports.KBD = KBD;
2315
4441
  exports.Label = Label;
2316
4442
  exports.LabelSkeleton = LabelSkeleton;
4443
+ exports.Layer = Layer;
4444
+ exports.LayerProvider = LayerProvider;
4445
+ exports.Menu = Menu;
2317
4446
  exports.MenuButton = MenuButton;
4447
+ exports.MenuDivider = MenuDivider;
4448
+ exports.MenuGroup = MenuGroup;
4449
+ exports.MenuItem = MenuItem;
4450
+ exports.Popover = Popover;
4451
+ exports.Portal = Portal;
4452
+ exports.PortalProvider = PortalProvider;
2318
4453
  exports.Radio = Radio;
2319
4454
  exports.Root = Root;
2320
4455
  exports.RootProvider = RootProvider;
2321
4456
  exports.Select = Select;
4457
+ exports.Selectable = Selectable;
2322
4458
  exports.Skeleton = Skeleton;
4459
+ exports.Spinner = Spinner;
2323
4460
  exports.SrOnly = SrOnly;
4461
+ exports.Stack = Stack;
2324
4462
  exports.Switch = Switch;
4463
+ exports.Tab = Tab;
4464
+ exports.TabList = TabList;
2325
4465
  exports.TabPanel = TabPanel;
4466
+ exports.Text = Text;
2326
4467
  exports.TextArea = TextArea;
4468
+ exports.TextInput = TextInput;
2327
4469
  exports.TextSkeleton = TextSkeleton;
2328
4470
  exports.Toast = Toast;
2329
4471
  exports.ToastProvider = ToastProvider;
4472
+ exports.Tooltip = Tooltip;
4473
+ exports.TooltipDelayGroupContext = TooltipDelayGroupContext;
2330
4474
  exports.TooltipDelayGroupProvider = TooltipDelayGroupProvider;
2331
4475
  exports.Tree = Tree;
2332
4476
  exports.TreeItem = TreeItem;
2333
4477
  exports.VirtualList = VirtualList;
2334
4478
  exports._ResizeObserver = _ResizeObserver;
2335
4479
  exports._elementSizeObserver = _elementSizeObserver;
4480
+ exports._getArrayProp = _getArrayProp;
4481
+ exports._getResponsiveProp = _getResponsiveProp;
2336
4482
  exports._hasFocus = _hasFocus;
4483
+ exports._isEnterToClickElement = _isEnterToClickElement;
2337
4484
  exports._isScrollable = _isScrollable;
2338
4485
  exports._raf = _raf;
2339
4486
  exports._raf2 = _raf2;
2340
4487
  exports.attemptFocus = attemptFocus;
4488
+ exports.containsOrEqualsElement = containsOrEqualsElement;
2341
4489
  exports.focusFirstDescendant = focusFirstDescendant;
2342
4490
  exports.focusLastDescendant = focusLastDescendant;
2343
4491
  exports.isFocusable = isFocusable;
4492
+ exports.isHTMLAnchorElement = isHTMLAnchorElement;
4493
+ exports.isHTMLButtonElement = isHTMLButtonElement;
4494
+ exports.isHTMLElement = isHTMLElement;
4495
+ exports.isHTMLInputElement = isHTMLInputElement;
4496
+ exports.isHTMLSelectElement = isHTMLSelectElement;
4497
+ exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
4498
+ exports.useBoundaryElement = useBoundaryElement;
4499
+ exports.useCard = useCard;
4500
+ exports.useClickOutsideEvent = useClickOutsideEvent;
4501
+ exports.useCustomValidity = useCustomValidity;
2344
4502
  exports.useDialog = useDialog;
2345
4503
  exports.useElementSize = useElementSize;
4504
+ exports.useGlobalKeyDown = useGlobalKeyDown;
4505
+ exports.useLayer = useLayer;
4506
+ exports.useMatchMedia = useMatchMedia;
4507
+ exports.useMediaIndex = useMediaIndex;
4508
+ exports.usePortal = usePortal;
4509
+ exports.usePrefersDark = usePrefersDark;
4510
+ exports.usePrefersReducedMotion = usePrefersReducedMotion;
4511
+ exports.useResponsiveProp = useResponsiveProp;
2346
4512
  exports.useToast = useToast;
4513
+ exports.useTooltipDelayGroup = useTooltipDelayGroup;
2347
4514
  exports.useTree = useTree;
2348
4515
  //# sourceMappingURL=index.cjs.map