PluginProbe
Gutenberg / 23.3.2
Gutenberg v23.3.2
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / widgets / quick-draft / render.js

render.js in Gutenberg 23.3.2, at build/widgets/quick-draft/render.js

31,187 lines 1.1 MB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4 var __getOwnPropNames = Object.getOwnPropertyNames;
5 var __getProtoOf = Object.getPrototypeOf;
6 var __hasOwnProp = Object.prototype.hasOwnProperty;
7 var __commonJS = (cb, mod) => function __require() {
8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9 };
10 var __export = (target, all) => {
11 for (var name in all)
12 __defProp(target, name, { get: all[name], enumerable: true });
13 };
14 var __copyProps = (to, from, except, desc) => {
15 if (from && typeof from === "object" || typeof from === "function") {
16 for (let key of __getOwnPropNames(from))
17 if (!__hasOwnProp.call(to, key) && key !== except)
18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19 }
20 return to;
21 };
22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23 // If the importer is in node compatibility mode or this is not an ESM
24 // file that has been converted to a CommonJS file using a Babel-
25 // compatible transform (i.e. "__esModule" has not been set), then set
26 // "default" to the CommonJS "module.exports" for node compatibility.
27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28 mod
29 ));
30
31 // package-external:@wordpress/autop
32 var require_autop = __commonJS({
33 "package-external:@wordpress/autop"(exports, module) {
34 module.exports = window.wp.autop;
35 }
36 });
37
38 // package-external:@wordpress/core-data
39 var require_core_data = __commonJS({
40 "package-external:@wordpress/core-data"(exports, module) {
41 module.exports = window.wp.coreData;
42 }
43 });
44
45 // package-external:@wordpress/data
46 var require_data = __commonJS({
47 "package-external:@wordpress/data"(exports, module) {
48 module.exports = window.wp.data;
49 }
50 });
51
52 // package-external:@wordpress/element
53 var require_element = __commonJS({
54 "package-external:@wordpress/element"(exports, module) {
55 module.exports = window.wp.element;
56 }
57 });
58
59 // package-external:@wordpress/compose
60 var require_compose = __commonJS({
61 "package-external:@wordpress/compose"(exports, module) {
62 module.exports = window.wp.compose;
63 }
64 });
65
66 // vendor-external:react
67 var require_react = __commonJS({
68 "vendor-external:react"(exports, module) {
69 module.exports = window.React;
70 }
71 });
72
73 // vendor-external:react/jsx-runtime
74 var require_jsx_runtime = __commonJS({
75 "vendor-external:react/jsx-runtime"(exports, module) {
76 module.exports = window.ReactJSXRuntime;
77 }
78 });
79
80 // vendor-external:react-dom
81 var require_react_dom = __commonJS({
82 "vendor-external:react-dom"(exports, module) {
83 module.exports = window.ReactDOM;
84 }
85 });
86
87 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
88 var require_use_sync_external_store_shim_development = __commonJS({
89 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
90 "use strict";
91 (function() {
92 function is(x2, y2) {
93 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
94 }
95 function useSyncExternalStore$2(subscribe2, getSnapshot) {
96 didWarnOld18Alpha || void 0 === React62.startTransition || (didWarnOld18Alpha = true, console.error(
97 "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
98 ));
99 var value = getSnapshot();
100 if (!didWarnUncachedGetSnapshot) {
101 var cachedValue = getSnapshot();
102 objectIs(value, cachedValue) || (console.error(
103 "The result of getSnapshot should be cached to avoid an infinite loop"
104 ), didWarnUncachedGetSnapshot = true);
105 }
106 cachedValue = useState46({
107 inst: { value, getSnapshot }
108 });
109 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
110 useLayoutEffect6(
111 function() {
112 inst.value = value;
113 inst.getSnapshot = getSnapshot;
114 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
115 },
116 [subscribe2, value, getSnapshot]
117 );
118 useEffect40(
119 function() {
120 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
121 return subscribe2(function() {
122 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
123 });
124 },
125 [subscribe2]
126 );
127 useDebugValue2(value);
128 return value;
129 }
130 function checkIfSnapshotChanged(inst) {
131 var latestGetSnapshot = inst.getSnapshot;
132 inst = inst.value;
133 try {
134 var nextValue = latestGetSnapshot();
135 return !objectIs(inst, nextValue);
136 } catch (error2) {
137 return true;
138 }
139 }
140 function useSyncExternalStore$1(subscribe2, getSnapshot) {
141 return getSnapshot();
142 }
143 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
144 var React62 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState46 = React62.useState, useEffect40 = React62.useEffect, useLayoutEffect6 = React62.useLayoutEffect, useDebugValue2 = React62.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
145 exports.useSyncExternalStore = void 0 !== React62.useSyncExternalStore ? React62.useSyncExternalStore : shim;
146 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
147 })();
148 }
149 });
150
151 // node_modules/use-sync-external-store/shim/index.js
152 var require_shim = __commonJS({
153 "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
154 "use strict";
155 if (false) {
156 module.exports = null;
157 } else {
158 module.exports = require_use_sync_external_store_shim_development();
159 }
160 }
161 });
162
163 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
164 var require_with_selector_development = __commonJS({
165 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
166 "use strict";
167 (function() {
168 function is(x2, y2) {
169 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
170 }
171 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
172 var React62 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef54 = React62.useRef, useEffect40 = React62.useEffect, useMemo56 = React62.useMemo, useDebugValue2 = React62.useDebugValue;
173 exports.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot, getServerSnapshot, selector2, isEqual) {
174 var instRef = useRef54(null);
175 if (null === instRef.current) {
176 var inst = { hasValue: false, value: null };
177 instRef.current = inst;
178 } else inst = instRef.current;
179 instRef = useMemo56(
180 function() {
181 function memoizedSelector(nextSnapshot) {
182 if (!hasMemo) {
183 hasMemo = true;
184 memoizedSnapshot = nextSnapshot;
185 nextSnapshot = selector2(nextSnapshot);
186 if (void 0 !== isEqual && inst.hasValue) {
187 var currentSelection = inst.value;
188 if (isEqual(currentSelection, nextSnapshot))
189 return memoizedSelection = currentSelection;
190 }
191 return memoizedSelection = nextSnapshot;
192 }
193 currentSelection = memoizedSelection;
194 if (objectIs(memoizedSnapshot, nextSnapshot))
195 return currentSelection;
196 var nextSelection = selector2(nextSnapshot);
197 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
198 return memoizedSnapshot = nextSnapshot, currentSelection;
199 memoizedSnapshot = nextSnapshot;
200 return memoizedSelection = nextSelection;
201 }
202 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
203 return [
204 function() {
205 return memoizedSelector(getSnapshot());
206 },
207 null === maybeGetServerSnapshot ? void 0 : function() {
208 return memoizedSelector(maybeGetServerSnapshot());
209 }
210 ];
211 },
212 [getSnapshot, getServerSnapshot, selector2, isEqual]
213 );
214 var value = useSyncExternalStore3(subscribe2, instRef[0], instRef[1]);
215 useEffect40(
216 function() {
217 inst.hasValue = true;
218 inst.value = value;
219 },
220 [value]
221 );
222 useDebugValue2(value);
223 return value;
224 };
225 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
226 })();
227 }
228 });
229
230 // node_modules/use-sync-external-store/shim/with-selector.js
231 var require_with_selector = __commonJS({
232 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
233 "use strict";
234 if (false) {
235 module.exports = null;
236 } else {
237 module.exports = require_with_selector_development();
238 }
239 }
240 });
241
242 // package-external:@wordpress/i18n
243 var require_i18n = __commonJS({
244 "package-external:@wordpress/i18n"(exports, module) {
245 module.exports = window.wp.i18n;
246 }
247 });
248
249 // package-external:@wordpress/primitives
250 var require_primitives = __commonJS({
251 "package-external:@wordpress/primitives"(exports, module) {
252 module.exports = window.wp.primitives;
253 }
254 });
255
256 // package-external:@wordpress/theme
257 var require_theme = __commonJS({
258 "package-external:@wordpress/theme"(exports, module) {
259 module.exports = window.wp.theme;
260 }
261 });
262
263 // package-external:@wordpress/private-apis
264 var require_private_apis = __commonJS({
265 "package-external:@wordpress/private-apis"(exports, module) {
266 module.exports = window.wp.privateApis;
267 }
268 });
269
270 // package-external:@wordpress/components
271 var require_components = __commonJS({
272 "package-external:@wordpress/components"(exports, module) {
273 module.exports = window.wp.components;
274 }
275 });
276
277 // package-external:@wordpress/keycodes
278 var require_keycodes = __commonJS({
279 "package-external:@wordpress/keycodes"(exports, module) {
280 module.exports = window.wp.keycodes;
281 }
282 });
283
284 // node_modules/remove-accents/index.js
285 var require_remove_accents = __commonJS({
286 "node_modules/remove-accents/index.js"(exports, module) {
287 var characterMap = {
288 "\xC0": "A",
289 "\xC1": "A",
290 "\xC2": "A",
291 "\xC3": "A",
292 "\xC4": "A",
293 "\xC5": "A",
294 "\u1EA4": "A",
295 "\u1EAE": "A",
296 "\u1EB2": "A",
297 "\u1EB4": "A",
298 "\u1EB6": "A",
299 "\xC6": "AE",
300 "\u1EA6": "A",
301 "\u1EB0": "A",
302 "\u0202": "A",
303 "\u1EA2": "A",
304 "\u1EA0": "A",
305 "\u1EA8": "A",
306 "\u1EAA": "A",
307 "\u1EAC": "A",
308 "\xC7": "C",
309 "\u1E08": "C",
310 "\xC8": "E",
311 "\xC9": "E",
312 "\xCA": "E",
313 "\xCB": "E",
314 "\u1EBE": "E",
315 "\u1E16": "E",
316 "\u1EC0": "E",
317 "\u1E14": "E",
318 "\u1E1C": "E",
319 "\u0206": "E",
320 "\u1EBA": "E",
321 "\u1EBC": "E",
322 "\u1EB8": "E",
323 "\u1EC2": "E",
324 "\u1EC4": "E",
325 "\u1EC6": "E",
326 "\xCC": "I",
327 "\xCD": "I",
328 "\xCE": "I",
329 "\xCF": "I",
330 "\u1E2E": "I",
331 "\u020A": "I",
332 "\u1EC8": "I",
333 "\u1ECA": "I",
334 "\xD0": "D",
335 "\xD1": "N",
336 "\xD2": "O",
337 "\xD3": "O",
338 "\xD4": "O",
339 "\xD5": "O",
340 "\xD6": "O",
341 "\xD8": "O",
342 "\u1ED0": "O",
343 "\u1E4C": "O",
344 "\u1E52": "O",
345 "\u020E": "O",
346 "\u1ECE": "O",
347 "\u1ECC": "O",
348 "\u1ED4": "O",
349 "\u1ED6": "O",
350 "\u1ED8": "O",
351 "\u1EDC": "O",
352 "\u1EDE": "O",
353 "\u1EE0": "O",
354 "\u1EDA": "O",
355 "\u1EE2": "O",
356 "\xD9": "U",
357 "\xDA": "U",
358 "\xDB": "U",
359 "\xDC": "U",
360 "\u1EE6": "U",
361 "\u1EE4": "U",
362 "\u1EEC": "U",
363 "\u1EEE": "U",
364 "\u1EF0": "U",
365 "\xDD": "Y",
366 "\xE0": "a",
367 "\xE1": "a",
368 "\xE2": "a",
369 "\xE3": "a",
370 "\xE4": "a",
371 "\xE5": "a",
372 "\u1EA5": "a",
373 "\u1EAF": "a",
374 "\u1EB3": "a",
375 "\u1EB5": "a",
376 "\u1EB7": "a",
377 "\xE6": "ae",
378 "\u1EA7": "a",
379 "\u1EB1": "a",
380 "\u0203": "a",
381 "\u1EA3": "a",
382 "\u1EA1": "a",
383 "\u1EA9": "a",
384 "\u1EAB": "a",
385 "\u1EAD": "a",
386 "\xE7": "c",
387 "\u1E09": "c",
388 "\xE8": "e",
389 "\xE9": "e",
390 "\xEA": "e",
391 "\xEB": "e",
392 "\u1EBF": "e",
393 "\u1E17": "e",
394 "\u1EC1": "e",
395 "\u1E15": "e",
396 "\u1E1D": "e",
397 "\u0207": "e",
398 "\u1EBB": "e",
399 "\u1EBD": "e",
400 "\u1EB9": "e",
401 "\u1EC3": "e",
402 "\u1EC5": "e",
403 "\u1EC7": "e",
404 "\xEC": "i",
405 "\xED": "i",
406 "\xEE": "i",
407 "\xEF": "i",
408 "\u1E2F": "i",
409 "\u020B": "i",
410 "\u1EC9": "i",
411 "\u1ECB": "i",
412 "\xF0": "d",
413 "\xF1": "n",
414 "\xF2": "o",
415 "\xF3": "o",
416 "\xF4": "o",
417 "\xF5": "o",
418 "\xF6": "o",
419 "\xF8": "o",
420 "\u1ED1": "o",
421 "\u1E4D": "o",
422 "\u1E53": "o",
423 "\u020F": "o",
424 "\u1ECF": "o",
425 "\u1ECD": "o",
426 "\u1ED5": "o",
427 "\u1ED7": "o",
428 "\u1ED9": "o",
429 "\u1EDD": "o",
430 "\u1EDF": "o",
431 "\u1EE1": "o",
432 "\u1EDB": "o",
433 "\u1EE3": "o",
434 "\xF9": "u",
435 "\xFA": "u",
436 "\xFB": "u",
437 "\xFC": "u",
438 "\u1EE7": "u",
439 "\u1EE5": "u",
440 "\u1EED": "u",
441 "\u1EEF": "u",
442 "\u1EF1": "u",
443 "\xFD": "y",
444 "\xFF": "y",
445 "\u0100": "A",
446 "\u0101": "a",
447 "\u0102": "A",
448 "\u0103": "a",
449 "\u0104": "A",
450 "\u0105": "a",
451 "\u0106": "C",
452 "\u0107": "c",
453 "\u0108": "C",
454 "\u0109": "c",
455 "\u010A": "C",
456 "\u010B": "c",
457 "\u010C": "C",
458 "\u010D": "c",
459 "C\u0306": "C",
460 "c\u0306": "c",
461 "\u010E": "D",
462 "\u010F": "d",
463 "\u0110": "D",
464 "\u0111": "d",
465 "\u0112": "E",
466 "\u0113": "e",
467 "\u0114": "E",
468 "\u0115": "e",
469 "\u0116": "E",
470 "\u0117": "e",
471 "\u0118": "E",
472 "\u0119": "e",
473 "\u011A": "E",
474 "\u011B": "e",
475 "\u011C": "G",
476 "\u01F4": "G",
477 "\u011D": "g",
478 "\u01F5": "g",
479 "\u011E": "G",
480 "\u011F": "g",
481 "\u0120": "G",
482 "\u0121": "g",
483 "\u0122": "G",
484 "\u0123": "g",
485 "\u0124": "H",
486 "\u0125": "h",
487 "\u0126": "H",
488 "\u0127": "h",
489 "\u1E2A": "H",
490 "\u1E2B": "h",
491 "\u0128": "I",
492 "\u0129": "i",
493 "\u012A": "I",
494 "\u012B": "i",
495 "\u012C": "I",
496 "\u012D": "i",
497 "\u012E": "I",
498 "\u012F": "i",
499 "\u0130": "I",
500 "\u0131": "i",
501 "\u0132": "IJ",
502 "\u0133": "ij",
503 "\u0134": "J",
504 "\u0135": "j",
505 "\u0136": "K",
506 "\u0137": "k",
507 "\u1E30": "K",
508 "\u1E31": "k",
509 "K\u0306": "K",
510 "k\u0306": "k",
511 "\u0139": "L",
512 "\u013A": "l",
513 "\u013B": "L",
514 "\u013C": "l",
515 "\u013D": "L",
516 "\u013E": "l",
517 "\u013F": "L",
518 "\u0140": "l",
519 "\u0141": "l",
520 "\u0142": "l",
521 "\u1E3E": "M",
522 "\u1E3F": "m",
523 "M\u0306": "M",
524 "m\u0306": "m",
525 "\u0143": "N",
526 "\u0144": "n",
527 "\u0145": "N",
528 "\u0146": "n",
529 "\u0147": "N",
530 "\u0148": "n",
531 "\u0149": "n",
532 "N\u0306": "N",
533 "n\u0306": "n",
534 "\u014C": "O",
535 "\u014D": "o",
536 "\u014E": "O",
537 "\u014F": "o",
538 "\u0150": "O",
539 "\u0151": "o",
540 "\u0152": "OE",
541 "\u0153": "oe",
542 "P\u0306": "P",
543 "p\u0306": "p",
544 "\u0154": "R",
545 "\u0155": "r",
546 "\u0156": "R",
547 "\u0157": "r",
548 "\u0158": "R",
549 "\u0159": "r",
550 "R\u0306": "R",
551 "r\u0306": "r",
552 "\u0212": "R",
553 "\u0213": "r",
554 "\u015A": "S",
555 "\u015B": "s",
556 "\u015C": "S",
557 "\u015D": "s",
558 "\u015E": "S",
559 "\u0218": "S",
560 "\u0219": "s",
561 "\u015F": "s",
562 "\u0160": "S",
563 "\u0161": "s",
564 "\u0162": "T",
565 "\u0163": "t",
566 "\u021B": "t",
567 "\u021A": "T",
568 "\u0164": "T",
569 "\u0165": "t",
570 "\u0166": "T",
571 "\u0167": "t",
572 "T\u0306": "T",
573 "t\u0306": "t",
574 "\u0168": "U",
575 "\u0169": "u",
576 "\u016A": "U",
577 "\u016B": "u",
578 "\u016C": "U",
579 "\u016D": "u",
580 "\u016E": "U",
581 "\u016F": "u",
582 "\u0170": "U",
583 "\u0171": "u",
584 "\u0172": "U",
585 "\u0173": "u",
586 "\u0216": "U",
587 "\u0217": "u",
588 "V\u0306": "V",
589 "v\u0306": "v",
590 "\u0174": "W",
591 "\u0175": "w",
592 "\u1E82": "W",
593 "\u1E83": "w",
594 "X\u0306": "X",
595 "x\u0306": "x",
596 "\u0176": "Y",
597 "\u0177": "y",
598 "\u0178": "Y",
599 "Y\u0306": "Y",
600 "y\u0306": "y",
601 "\u0179": "Z",
602 "\u017A": "z",
603 "\u017B": "Z",
604 "\u017C": "z",
605 "\u017D": "Z",
606 "\u017E": "z",
607 "\u017F": "s",
608 "\u0192": "f",
609 "\u01A0": "O",
610 "\u01A1": "o",
611 "\u01AF": "U",
612 "\u01B0": "u",
613 "\u01CD": "A",
614 "\u01CE": "a",
615 "\u01CF": "I",
616 "\u01D0": "i",
617 "\u01D1": "O",
618 "\u01D2": "o",
619 "\u01D3": "U",
620 "\u01D4": "u",
621 "\u01D5": "U",
622 "\u01D6": "u",
623 "\u01D7": "U",
624 "\u01D8": "u",
625 "\u01D9": "U",
626 "\u01DA": "u",
627 "\u01DB": "U",
628 "\u01DC": "u",
629 "\u1EE8": "U",
630 "\u1EE9": "u",
631 "\u1E78": "U",
632 "\u1E79": "u",
633 "\u01FA": "A",
634 "\u01FB": "a",
635 "\u01FC": "AE",
636 "\u01FD": "ae",
637 "\u01FE": "O",
638 "\u01FF": "o",
639 "\xDE": "TH",
640 "\xFE": "th",
641 "\u1E54": "P",
642 "\u1E55": "p",
643 "\u1E64": "S",
644 "\u1E65": "s",
645 "X\u0301": "X",
646 "x\u0301": "x",
647 "\u0403": "\u0413",
648 "\u0453": "\u0433",
649 "\u040C": "\u041A",
650 "\u045C": "\u043A",
651 "A\u030B": "A",
652 "a\u030B": "a",
653 "E\u030B": "E",
654 "e\u030B": "e",
655 "I\u030B": "I",
656 "i\u030B": "i",
657 "\u01F8": "N",
658 "\u01F9": "n",
659 "\u1ED2": "O",
660 "\u1ED3": "o",
661 "\u1E50": "O",
662 "\u1E51": "o",
663 "\u1EEA": "U",
664 "\u1EEB": "u",
665 "\u1E80": "W",
666 "\u1E81": "w",
667 "\u1EF2": "Y",
668 "\u1EF3": "y",
669 "\u0200": "A",
670 "\u0201": "a",
671 "\u0204": "E",
672 "\u0205": "e",
673 "\u0208": "I",
674 "\u0209": "i",
675 "\u020C": "O",
676 "\u020D": "o",
677 "\u0210": "R",
678 "\u0211": "r",
679 "\u0214": "U",
680 "\u0215": "u",
681 "B\u030C": "B",
682 "b\u030C": "b",
683 "\u010C\u0323": "C",
684 "\u010D\u0323": "c",
685 "\xCA\u030C": "E",
686 "\xEA\u030C": "e",
687 "F\u030C": "F",
688 "f\u030C": "f",
689 "\u01E6": "G",
690 "\u01E7": "g",
691 "\u021E": "H",
692 "\u021F": "h",
693 "J\u030C": "J",
694 "\u01F0": "j",
695 "\u01E8": "K",
696 "\u01E9": "k",
697 "M\u030C": "M",
698 "m\u030C": "m",
699 "P\u030C": "P",
700 "p\u030C": "p",
701 "Q\u030C": "Q",
702 "q\u030C": "q",
703 "\u0158\u0329": "R",
704 "\u0159\u0329": "r",
705 "\u1E66": "S",
706 "\u1E67": "s",
707 "V\u030C": "V",
708 "v\u030C": "v",
709 "W\u030C": "W",
710 "w\u030C": "w",
711 "X\u030C": "X",
712 "x\u030C": "x",
713 "Y\u030C": "Y",
714 "y\u030C": "y",
715 "A\u0327": "A",
716 "a\u0327": "a",
717 "B\u0327": "B",
718 "b\u0327": "b",
719 "\u1E10": "D",
720 "\u1E11": "d",
721 "\u0228": "E",
722 "\u0229": "e",
723 "\u0190\u0327": "E",
724 "\u025B\u0327": "e",
725 "\u1E28": "H",
726 "\u1E29": "h",
727 "I\u0327": "I",
728 "i\u0327": "i",
729 "\u0197\u0327": "I",
730 "\u0268\u0327": "i",
731 "M\u0327": "M",
732 "m\u0327": "m",
733 "O\u0327": "O",
734 "o\u0327": "o",
735 "Q\u0327": "Q",
736 "q\u0327": "q",
737 "U\u0327": "U",
738 "u\u0327": "u",
739 "X\u0327": "X",
740 "x\u0327": "x",
741 "Z\u0327": "Z",
742 "z\u0327": "z",
743 "\u0439": "\u0438",
744 "\u0419": "\u0418",
745 "\u0451": "\u0435",
746 "\u0401": "\u0415"
747 };
748 var chars = Object.keys(characterMap).join("|");
749 var allAccents = new RegExp(chars, "g");
750 var firstAccent = new RegExp(chars, "");
751 function matcher(match2) {
752 return characterMap[match2];
753 }
754 var removeAccents2 = function(string) {
755 return string.replace(allAccents, matcher);
756 };
757 var hasAccents = function(string) {
758 return !!string.match(firstAccent);
759 };
760 module.exports = removeAccents2;
761 module.exports.has = hasAccents;
762 module.exports.remove = removeAccents2;
763 }
764 });
765
766 // node_modules/fast-deep-equal/es6/index.js
767 var require_es6 = __commonJS({
768 "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
769 "use strict";
770 module.exports = function equal(a2, b2) {
771 if (a2 === b2) return true;
772 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
773 if (a2.constructor !== b2.constructor) return false;
774 var length, i2, keys;
775 if (Array.isArray(a2)) {
776 length = a2.length;
777 if (length != b2.length) return false;
778 for (i2 = length; i2-- !== 0; )
779 if (!equal(a2[i2], b2[i2])) return false;
780 return true;
781 }
782 if (a2 instanceof Map && b2 instanceof Map) {
783 if (a2.size !== b2.size) return false;
784 for (i2 of a2.entries())
785 if (!b2.has(i2[0])) return false;
786 for (i2 of a2.entries())
787 if (!equal(i2[1], b2.get(i2[0]))) return false;
788 return true;
789 }
790 if (a2 instanceof Set && b2 instanceof Set) {
791 if (a2.size !== b2.size) return false;
792 for (i2 of a2.entries())
793 if (!b2.has(i2[0])) return false;
794 return true;
795 }
796 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
797 length = a2.length;
798 if (length != b2.length) return false;
799 for (i2 = length; i2-- !== 0; )
800 if (a2[i2] !== b2[i2]) return false;
801 return true;
802 }
803 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
804 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
805 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
806 keys = Object.keys(a2);
807 length = keys.length;
808 if (length !== Object.keys(b2).length) return false;
809 for (i2 = length; i2-- !== 0; )
810 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
811 for (i2 = length; i2-- !== 0; ) {
812 var key = keys[i2];
813 if (!equal(a2[key], b2[key])) return false;
814 }
815 return true;
816 }
817 return a2 !== a2 && b2 !== b2;
818 };
819 }
820 });
821
822 // package-external:@wordpress/date
823 var require_date = __commonJS({
824 "package-external:@wordpress/date"(exports, module) {
825 module.exports = window.wp.date;
826 }
827 });
828
829 // package-external:@wordpress/warning
830 var require_warning = __commonJS({
831 "package-external:@wordpress/warning"(exports, module) {
832 module.exports = window.wp.warning;
833 }
834 });
835
836 // node_modules/deepmerge/dist/cjs.js
837 var require_cjs = __commonJS({
838 "node_modules/deepmerge/dist/cjs.js"(exports, module) {
839 "use strict";
840 var isMergeableObject = function isMergeableObject2(value) {
841 return isNonNullObject(value) && !isSpecial(value);
842 };
843 function isNonNullObject(value) {
844 return !!value && typeof value === "object";
845 }
846 function isSpecial(value) {
847 var stringValue = Object.prototype.toString.call(value);
848 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
849 }
850 var canUseSymbol = typeof Symbol === "function" && Symbol.for;
851 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
852 function isReactElement(value) {
853 return value.$$typeof === REACT_ELEMENT_TYPE;
854 }
855 function emptyTarget(val) {
856 return Array.isArray(val) ? [] : {};
857 }
858 function cloneUnlessOtherwiseSpecified(value, options) {
859 return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
860 }
861 function defaultArrayMerge(target, source, options) {
862 return target.concat(source).map(function(element) {
863 return cloneUnlessOtherwiseSpecified(element, options);
864 });
865 }
866 function getMergeFunction(key, options) {
867 if (!options.customMerge) {
868 return deepmerge;
869 }
870 var customMerge = options.customMerge(key);
871 return typeof customMerge === "function" ? customMerge : deepmerge;
872 }
873 function getEnumerableOwnPropertySymbols(target) {
874 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol3) {
875 return Object.propertyIsEnumerable.call(target, symbol3);
876 }) : [];
877 }
878 function getKeys2(target) {
879 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
880 }
881 function propertyIsOnObject(object, property) {
882 try {
883 return property in object;
884 } catch (_) {
885 return false;
886 }
887 }
888 function propertyIsUnsafe(target, key) {
889 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
890 }
891 function mergeObject(target, source, options) {
892 var destination = {};
893 if (options.isMergeableObject(target)) {
894 getKeys2(target).forEach(function(key) {
895 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
896 });
897 }
898 getKeys2(source).forEach(function(key) {
899 if (propertyIsUnsafe(target, key)) {
900 return;
901 }
902 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
903 destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
904 } else {
905 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
906 }
907 });
908 return destination;
909 }
910 function deepmerge(target, source, options) {
911 options = options || {};
912 options.arrayMerge = options.arrayMerge || defaultArrayMerge;
913 options.isMergeableObject = options.isMergeableObject || isMergeableObject;
914 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
915 var sourceIsArray = Array.isArray(source);
916 var targetIsArray = Array.isArray(target);
917 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
918 if (!sourceAndTargetTypesMatch) {
919 return cloneUnlessOtherwiseSpecified(source, options);
920 } else if (sourceIsArray) {
921 return options.arrayMerge(target, source, options);
922 } else {
923 return mergeObject(target, source, options);
924 }
925 }
926 deepmerge.all = function deepmergeAll(array, options) {
927 if (!Array.isArray(array)) {
928 throw new Error("first argument should be an array");
929 }
930 return array.reduce(function(prev, next) {
931 return deepmerge(prev, next, options);
932 }, {});
933 };
934 var deepmerge_1 = deepmerge;
935 module.exports = deepmerge_1;
936 }
937 });
938
939 // package-external:@wordpress/escape-html
940 var require_escape_html = __commonJS({
941 "package-external:@wordpress/escape-html"(exports, module) {
942 module.exports = window.wp.escapeHtml;
943 }
944 });
945
946 // package-external:@wordpress/html-entities
947 var require_html_entities = __commonJS({
948 "package-external:@wordpress/html-entities"(exports, module) {
949 module.exports = window.wp.htmlEntities;
950 }
951 });
952
953 // package-external:@wordpress/url
954 var require_url = __commonJS({
955 "package-external:@wordpress/url"(exports, module) {
956 module.exports = window.wp.url;
957 }
958 });
959
960 // node_modules/clsx/dist/clsx.mjs
961 function r(e2) {
962 var t2, f2, n2 = "";
963 if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
964 else if ("object" == typeof e2) if (Array.isArray(e2)) {
965 var o2 = e2.length;
966 for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
967 } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
968 return n2;
969 }
970 function clsx() {
971 for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
972 return n2;
973 }
974 var clsx_default = clsx;
975
976 // widgets/quick-draft/render.tsx
977 var import_autop = __toESM(require_autop());
978 var import_core_data2 = __toESM(require_core_data());
979 var import_data7 = __toESM(require_data());
980
981 // packages/dataviews/build-module/dataviews/index.mjs
982 var import_element96 = __toESM(require_element(), 1);
983 var import_compose12 = __toESM(require_compose(), 1);
984
985 // packages/ui/build-module/badge/badge.mjs
986 var import_element9 = __toESM(require_element(), 1);
987
988 // node_modules/@base-ui/utils/esm/useControlled.js
989 var React = __toESM(require_react(), 1);
990
991 // node_modules/@base-ui/utils/esm/error.js
992 var set;
993 if (true) {
994 set = /* @__PURE__ */ new Set();
995 }
996 function error(...messages) {
997 if (true) {
998 const messageKey = messages.join(" ");
999 if (!set.has(messageKey)) {
1000 set.add(messageKey);
1001 console.error(`Base UI: ${messageKey}`);
1002 }
1003 }
1004 }
1005
1006 // node_modules/@base-ui/utils/esm/useControlled.js
1007 function useControlled({
1008 controlled,
1009 default: defaultProp,
1010 name,
1011 state = "value"
1012 }) {
1013 const {
1014 current: isControlled
1015 } = React.useRef(controlled !== void 0);
1016 const [valueState, setValue] = React.useState(defaultProp);
1017 const value = isControlled ? controlled : valueState;
1018 if (true) {
1019 React.useEffect(() => {
1020 if (isControlled !== (controlled !== void 0)) {
1021 error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n"));
1022 }
1023 }, [state, name, controlled]);
1024 const {
1025 current: defaultValue2
1026 } = React.useRef(defaultProp);
1027 React.useEffect(() => {
1028 if (!isControlled && serializeToDevModeString(defaultValue2) !== serializeToDevModeString(defaultProp)) {
1029 error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
1030 }
1031 }, [defaultProp]);
1032 }
1033 const setValueIfUncontrolled = React.useCallback((newValue) => {
1034 if (!isControlled) {
1035 setValue(newValue);
1036 }
1037 }, []);
1038 return [value, setValueIfUncontrolled];
1039 }
1040 function serializeToDevModeString(input) {
1041 let nextId = 0;
1042 const seen = /* @__PURE__ */ new WeakMap();
1043 try {
1044 const result = JSON.stringify(input, function replacer(key, value) {
1045 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
1046 return void 0;
1047 }
1048 if (typeof value === "bigint") {
1049 return `__bigint__:${value}`;
1050 }
1051 if (value !== null && typeof value === "object") {
1052 const id = seen.get(value);
1053 if (id !== void 0) {
1054 return `__object__:${id}`;
1055 }
1056 seen.set(value, nextId);
1057 nextId += 1;
1058 }
1059 return value;
1060 });
1061 return result ?? `__top__:${typeof input}`;
1062 } catch {
1063 return "__unserializable__";
1064 }
1065 }
1066
1067 // node_modules/@base-ui/utils/esm/useStableCallback.js
1068 var React3 = __toESM(require_react(), 1);
1069
1070 // node_modules/@base-ui/utils/esm/useRefWithInit.js
1071 var React2 = __toESM(require_react(), 1);
1072 var UNINITIALIZED = {};
1073 function useRefWithInit(init2, initArg) {
1074 const ref = React2.useRef(UNINITIALIZED);
1075 if (ref.current === UNINITIALIZED) {
1076 ref.current = init2(initArg);
1077 }
1078 return ref;
1079 }
1080
1081 // node_modules/@base-ui/utils/esm/useStableCallback.js
1082 var useInsertionEffect = React3[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)];
1083 var useSafeInsertionEffect = (
1084 // React 17 doesn't have useInsertionEffect.
1085 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
1086 useInsertionEffect !== React3.useLayoutEffect ? useInsertionEffect : (fn) => fn()
1087 );
1088 function useStableCallback(callback) {
1089 const stable = useRefWithInit(createStableCallback).current;
1090 stable.next = callback;
1091 useSafeInsertionEffect(stable.effect);
1092 return stable.trampoline;
1093 }
1094 function createStableCallback() {
1095 const stable = {
1096 next: void 0,
1097 callback: assertNotCalled,
1098 trampoline: (...args) => stable.callback?.(...args),
1099 effect: () => {
1100 stable.callback = stable.next;
1101 }
1102 };
1103 return stable;
1104 }
1105 function assertNotCalled() {
1106 if (true) {
1107 throw (
1108 /* minify-error-disabled */
1109 new Error("Base UI: Cannot call an event handler while rendering.")
1110 );
1111 }
1112 }
1113
1114 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js
1115 var React4 = __toESM(require_react(), 1);
1116 var noop = () => {
1117 };
1118 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;
1119
1120 // node_modules/@base-ui/utils/esm/warn.js
1121 var set2;
1122 if (true) {
1123 set2 = /* @__PURE__ */ new Set();
1124 }
1125 function warn(...messages) {
1126 if (true) {
1127 const messageKey = messages.join(" ");
1128 if (!set2.has(messageKey)) {
1129 set2.add(messageKey);
1130 console.warn(`Base UI: ${messageKey}`);
1131 }
1132 }
1133 }
1134
1135 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js
1136 var React5 = __toESM(require_react(), 1);
1137 var DirectionContext = /* @__PURE__ */ React5.createContext(void 0);
1138 if (true) DirectionContext.displayName = "DirectionContext";
1139 function useDirection() {
1140 const context = React5.useContext(DirectionContext);
1141 return context?.direction ?? "ltr";
1142 }
1143
1144 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
1145 var React8 = __toESM(require_react(), 1);
1146
1147 // node_modules/@base-ui/utils/esm/useMergedRefs.js
1148 function useMergedRefs(a2, b2, c2, d2) {
1149 const forkRef = useRefWithInit(createForkRef).current;
1150 if (didChange(forkRef, a2, b2, c2, d2)) {
1151 update(forkRef, [a2, b2, c2, d2]);
1152 }
1153 return forkRef.callback;
1154 }
1155 function useMergedRefsN(refs) {
1156 const forkRef = useRefWithInit(createForkRef).current;
1157 if (didChangeN(forkRef, refs)) {
1158 update(forkRef, refs);
1159 }
1160 return forkRef.callback;
1161 }
1162 function createForkRef() {
1163 return {
1164 callback: null,
1165 cleanup: null,
1166 refs: []
1167 };
1168 }
1169 function didChange(forkRef, a2, b2, c2, d2) {
1170 return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d2;
1171 }
1172 function didChangeN(forkRef, newRefs) {
1173 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
1174 }
1175 function update(forkRef, refs) {
1176 forkRef.refs = refs;
1177 if (refs.every((ref) => ref == null)) {
1178 forkRef.callback = null;
1179 return;
1180 }
1181 forkRef.callback = (instance) => {
1182 if (forkRef.cleanup) {
1183 forkRef.cleanup();
1184 forkRef.cleanup = null;
1185 }
1186 if (instance != null) {
1187 const cleanupCallbacks = Array(refs.length).fill(null);
1188 for (let i2 = 0; i2 < refs.length; i2 += 1) {
1189 const ref = refs[i2];
1190 if (ref == null) {
1191 continue;
1192 }
1193 switch (typeof ref) {
1194 case "function": {
1195 const refCleanup = ref(instance);
1196 if (typeof refCleanup === "function") {
1197 cleanupCallbacks[i2] = refCleanup;
1198 }
1199 break;
1200 }
1201 case "object": {
1202 ref.current = instance;
1203 break;
1204 }
1205 default:
1206 }
1207 }
1208 forkRef.cleanup = () => {
1209 for (let i2 = 0; i2 < refs.length; i2 += 1) {
1210 const ref = refs[i2];
1211 if (ref == null) {
1212 continue;
1213 }
1214 switch (typeof ref) {
1215 case "function": {
1216 const cleanupCallback = cleanupCallbacks[i2];
1217 if (typeof cleanupCallback === "function") {
1218 cleanupCallback();
1219 } else {
1220 ref(null);
1221 }
1222 break;
1223 }
1224 case "object": {
1225 ref.current = null;
1226 break;
1227 }
1228 default:
1229 }
1230 }
1231 };
1232 }
1233 };
1234 }
1235
1236 // node_modules/@base-ui/utils/esm/getReactElementRef.js
1237 var React7 = __toESM(require_react(), 1);
1238
1239 // node_modules/@base-ui/utils/esm/reactVersion.js
1240 var React6 = __toESM(require_react(), 1);
1241 var majorVersion = parseInt(React6.version, 10);
1242 function isReactVersionAtLeast(reactVersionToCheck) {
1243 return majorVersion >= reactVersionToCheck;
1244 }
1245
1246 // node_modules/@base-ui/utils/esm/getReactElementRef.js
1247 function getReactElementRef(element) {
1248 if (!/* @__PURE__ */ React7.isValidElement(element)) {
1249 return null;
1250 }
1251 const reactElement = element;
1252 const propsWithRef = reactElement.props;
1253 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
1254 }
1255
1256 // node_modules/@base-ui/utils/esm/mergeObjects.js
1257 function mergeObjects(a2, b2) {
1258 if (a2 && !b2) {
1259 return a2;
1260 }
1261 if (!a2 && b2) {
1262 return b2;
1263 }
1264 if (a2 || b2) {
1265 return {
1266 ...a2,
1267 ...b2
1268 };
1269 }
1270 return void 0;
1271 }
1272
1273 // node_modules/@base-ui/utils/esm/empty.js
1274 function NOOP() {
1275 }
1276 var EMPTY_ARRAY = Object.freeze([]);
1277 var EMPTY_OBJECT = Object.freeze({});
1278
1279 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js
1280 function getStateAttributesProps(state, customMapping) {
1281 const props = {};
1282 for (const key in state) {
1283 const value = state[key];
1284 if (customMapping?.hasOwnProperty(key)) {
1285 const customProps = customMapping[key](value);
1286 if (customProps != null) {
1287 Object.assign(props, customProps);
1288 }
1289 continue;
1290 }
1291 if (value === true) {
1292 props[`data-${key.toLowerCase()}`] = "";
1293 } else if (value) {
1294 props[`data-${key.toLowerCase()}`] = value.toString();
1295 }
1296 }
1297 return props;
1298 }
1299
1300 // node_modules/@base-ui/react/esm/utils/resolveClassName.js
1301 function resolveClassName(className, state) {
1302 return typeof className === "function" ? className(state) : className;
1303 }
1304
1305 // node_modules/@base-ui/react/esm/utils/resolveStyle.js
1306 function resolveStyle(style, state) {
1307 return typeof style === "function" ? style(state) : style;
1308 }
1309
1310 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js
1311 var EMPTY_PROPS = {};
1312 function mergeProps(a2, b2, c2, d2, e2) {
1313 if (!c2 && !d2 && !e2 && !a2) {
1314 return createInitialMergedProps(b2);
1315 }
1316 let merged = createInitialMergedProps(a2);
1317 if (b2) {
1318 merged = mergeInto(merged, b2);
1319 }
1320 if (c2) {
1321 merged = mergeInto(merged, c2);
1322 }
1323 if (d2) {
1324 merged = mergeInto(merged, d2);
1325 }
1326 if (e2) {
1327 merged = mergeInto(merged, e2);
1328 }
1329 return merged;
1330 }
1331 function mergePropsN(props) {
1332 if (props.length === 0) {
1333 return EMPTY_PROPS;
1334 }
1335 if (props.length === 1) {
1336 return createInitialMergedProps(props[0]);
1337 }
1338 let merged = createInitialMergedProps(props[0]);
1339 for (let i2 = 1; i2 < props.length; i2 += 1) {
1340 merged = mergeInto(merged, props[i2]);
1341 }
1342 return merged;
1343 }
1344 function createInitialMergedProps(inputProps) {
1345 if (isPropsGetter(inputProps)) {
1346 return {
1347 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
1348 };
1349 }
1350 return copyInitialProps(inputProps);
1351 }
1352 function mergeInto(merged, inputProps) {
1353 if (isPropsGetter(inputProps)) {
1354 return resolvePropsGetter(inputProps, merged);
1355 }
1356 return mutablyMergeInto(merged, inputProps);
1357 }
1358 function copyInitialProps(inputProps) {
1359 const copiedProps = {
1360 ...inputProps
1361 };
1362 for (const propName in copiedProps) {
1363 const propValue = copiedProps[propName];
1364 if (isEventHandler(propName, propValue)) {
1365 copiedProps[propName] = wrapEventHandler(propValue);
1366 }
1367 }
1368 return copiedProps;
1369 }
1370 function mutablyMergeInto(mergedProps, externalProps) {
1371 if (!externalProps) {
1372 return mergedProps;
1373 }
1374 for (const propName in externalProps) {
1375 const externalPropValue = externalProps[propName];
1376 switch (propName) {
1377 case "style": {
1378 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
1379 break;
1380 }
1381 case "className": {
1382 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
1383 break;
1384 }
1385 default: {
1386 if (isEventHandler(propName, externalPropValue)) {
1387 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
1388 } else {
1389 mergedProps[propName] = externalPropValue;
1390 }
1391 }
1392 }
1393 }
1394 return mergedProps;
1395 }
1396 function isEventHandler(key, value) {
1397 const code0 = key.charCodeAt(0);
1398 const code1 = key.charCodeAt(1);
1399 const code2 = key.charCodeAt(2);
1400 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
1401 }
1402 function isPropsGetter(inputProps) {
1403 return typeof inputProps === "function";
1404 }
1405 function resolvePropsGetter(inputProps, previousProps) {
1406 if (isPropsGetter(inputProps)) {
1407 return inputProps(previousProps);
1408 }
1409 return inputProps ?? EMPTY_PROPS;
1410 }
1411 function mergeEventHandlers(ourHandler, theirHandler) {
1412 if (!theirHandler) {
1413 return ourHandler;
1414 }
1415 if (!ourHandler) {
1416 return wrapEventHandler(theirHandler);
1417 }
1418 return (...args) => {
1419 const event = args[0];
1420 if (isSyntheticEvent(event)) {
1421 const baseUIEvent = event;
1422 makeEventPreventable(baseUIEvent);
1423 const result2 = theirHandler(...args);
1424 if (!baseUIEvent.baseUIHandlerPrevented) {
1425 ourHandler?.(...args);
1426 }
1427 return result2;
1428 }
1429 const result = theirHandler(...args);
1430 ourHandler?.(...args);
1431 return result;
1432 };
1433 }
1434 function wrapEventHandler(handler) {
1435 if (!handler) {
1436 return handler;
1437 }
1438 return (...args) => {
1439 const event = args[0];
1440 if (isSyntheticEvent(event)) {
1441 makeEventPreventable(event);
1442 }
1443 return handler(...args);
1444 };
1445 }
1446 function makeEventPreventable(event) {
1447 event.preventBaseUIHandler = () => {
1448 event.baseUIHandlerPrevented = true;
1449 };
1450 return event;
1451 }
1452 function mergeClassNames(ourClassName, theirClassName) {
1453 if (theirClassName) {
1454 if (ourClassName) {
1455 return theirClassName + " " + ourClassName;
1456 }
1457 return theirClassName;
1458 }
1459 return ourClassName;
1460 }
1461 function isSyntheticEvent(event) {
1462 return event != null && typeof event === "object" && "nativeEvent" in event;
1463 }
1464
1465 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
1466 var import_react = __toESM(require_react(), 1);
1467 function useRenderElement(element, componentProps, params = {}) {
1468 const renderProp = componentProps.render;
1469 const outProps = useRenderElementProps(componentProps, params);
1470 if (params.enabled === false) {
1471 return null;
1472 }
1473 const state = params.state ?? EMPTY_OBJECT;
1474 return evaluateRenderProp(element, renderProp, outProps, state);
1475 }
1476 function useRenderElementProps(componentProps, params = {}) {
1477 const {
1478 className: classNameProp,
1479 style: styleProp,
1480 render: renderProp
1481 } = componentProps;
1482 const {
1483 state = EMPTY_OBJECT,
1484 ref,
1485 props,
1486 stateAttributesMapping: stateAttributesMapping4,
1487 enabled = true
1488 } = params;
1489 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
1490 const style = enabled ? resolveStyle(styleProp, state) : void 0;
1491 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping4) : EMPTY_OBJECT;
1492 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
1493 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
1494 if (typeof document !== "undefined") {
1495 if (!enabled) {
1496 useMergedRefs(null, null);
1497 } else if (Array.isArray(ref)) {
1498 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
1499 } else {
1500 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
1501 }
1502 }
1503 if (!enabled) {
1504 return EMPTY_OBJECT;
1505 }
1506 if (className !== void 0) {
1507 outProps.className = mergeClassNames(outProps.className, className);
1508 }
1509 if (style !== void 0) {
1510 outProps.style = mergeObjects(outProps.style, style);
1511 }
1512 return outProps;
1513 }
1514 function resolveRenderFunctionProps(props) {
1515 if (Array.isArray(props)) {
1516 return mergePropsN(props);
1517 }
1518 return mergeProps(void 0, props);
1519 }
1520 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
1521 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
1522 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
1523 function evaluateRenderProp(element, render4, props, state) {
1524 if (render4) {
1525 if (typeof render4 === "function") {
1526 if (true) {
1527 warnIfRenderPropLooksLikeComponent(render4);
1528 }
1529 return render4(props, state);
1530 }
1531 const mergedProps = mergeProps(props, render4.props);
1532 mergedProps.ref = props.ref;
1533 let newElement = render4;
1534 if (newElement?.$$typeof === REACT_LAZY_TYPE) {
1535 const children = React8.Children.toArray(render4);
1536 newElement = children[0];
1537 }
1538 if (true) {
1539 if (!/* @__PURE__ */ React8.isValidElement(newElement)) {
1540 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
1541 }
1542 }
1543 return /* @__PURE__ */ React8.cloneElement(newElement, mergedProps);
1544 }
1545 if (element) {
1546 if (typeof element === "string") {
1547 return renderTag(element, props);
1548 }
1549 }
1550 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1551 }
1552 function warnIfRenderPropLooksLikeComponent(renderFn) {
1553 const functionName = renderFn.name;
1554 if (functionName.length === 0) {
1555 return;
1556 }
1557 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1558 return;
1559 }
1560 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1561 return;
1562 }
1563 warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
1564 }
1565 function renderTag(Tag, props) {
1566 if (Tag === "button") {
1567 return /* @__PURE__ */ (0, import_react.createElement)("button", {
1568 type: "button",
1569 ...props,
1570 key: props.key
1571 });
1572 }
1573 if (Tag === "img") {
1574 return /* @__PURE__ */ (0, import_react.createElement)("img", {
1575 alt: "",
1576 ...props,
1577 key: props.key
1578 });
1579 }
1580 return /* @__PURE__ */ React8.createElement(Tag, props);
1581 }
1582
1583 // node_modules/@base-ui/react/esm/internals/reason-parts.js
1584 var reason_parts_exports = {};
1585 __export(reason_parts_exports, {
1586 cancelOpen: () => cancelOpen,
1587 chipRemovePress: () => chipRemovePress,
1588 clearPress: () => clearPress,
1589 closePress: () => closePress,
1590 closeWatcher: () => closeWatcher,
1591 decrementPress: () => decrementPress,
1592 disabled: () => disabled,
1593 drag: () => drag,
1594 escapeKey: () => escapeKey,
1595 focusOut: () => focusOut,
1596 imperativeAction: () => imperativeAction,
1597 incrementPress: () => incrementPress,
1598 inputBlur: () => inputBlur,
1599 inputChange: () => inputChange,
1600 inputClear: () => inputClear,
1601 inputPaste: () => inputPaste,
1602 inputPress: () => inputPress,
1603 itemPress: () => itemPress,
1604 keyboard: () => keyboard,
1605 linkPress: () => linkPress,
1606 listNavigation: () => listNavigation,
1607 none: () => none,
1608 outsidePress: () => outsidePress,
1609 pointer: () => pointer,
1610 scrub: () => scrub,
1611 siblingOpen: () => siblingOpen,
1612 swipe: () => swipe,
1613 trackPress: () => trackPress,
1614 triggerFocus: () => triggerFocus,
1615 triggerHover: () => triggerHover,
1616 triggerPress: () => triggerPress,
1617 wheel: () => wheel,
1618 windowResize: () => windowResize
1619 });
1620 var none = "none";
1621 var triggerPress = "trigger-press";
1622 var triggerHover = "trigger-hover";
1623 var triggerFocus = "trigger-focus";
1624 var outsidePress = "outside-press";
1625 var itemPress = "item-press";
1626 var closePress = "close-press";
1627 var linkPress = "link-press";
1628 var clearPress = "clear-press";
1629 var chipRemovePress = "chip-remove-press";
1630 var trackPress = "track-press";
1631 var incrementPress = "increment-press";
1632 var decrementPress = "decrement-press";
1633 var inputChange = "input-change";
1634 var inputClear = "input-clear";
1635 var inputBlur = "input-blur";
1636 var inputPaste = "input-paste";
1637 var inputPress = "input-press";
1638 var focusOut = "focus-out";
1639 var escapeKey = "escape-key";
1640 var closeWatcher = "close-watcher";
1641 var listNavigation = "list-navigation";
1642 var keyboard = "keyboard";
1643 var pointer = "pointer";
1644 var drag = "drag";
1645 var wheel = "wheel";
1646 var scrub = "scrub";
1647 var cancelOpen = "cancel-open";
1648 var siblingOpen = "sibling-open";
1649 var disabled = "disabled";
1650 var imperativeAction = "imperative-action";
1651 var swipe = "swipe";
1652 var windowResize = "window-resize";
1653
1654 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js
1655 function createChangeEventDetails(reason, event, trigger, customProperties) {
1656 let canceled = false;
1657 let allowPropagation = false;
1658 const custom = customProperties ?? EMPTY_OBJECT;
1659 const details = {
1660 reason,
1661 event: event ?? new Event("base-ui"),
1662 cancel() {
1663 canceled = true;
1664 },
1665 allowPropagation() {
1666 allowPropagation = true;
1667 },
1668 get isCanceled() {
1669 return canceled;
1670 },
1671 get isPropagationAllowed() {
1672 return allowPropagation;
1673 },
1674 trigger,
1675 ...custom
1676 };
1677 return details;
1678 }
1679
1680 // node_modules/@base-ui/utils/esm/useId.js
1681 var React10 = __toESM(require_react(), 1);
1682
1683 // node_modules/@base-ui/utils/esm/safeReact.js
1684 var React9 = __toESM(require_react(), 1);
1685 var SafeReact = {
1686 ...React9
1687 };
1688
1689 // node_modules/@base-ui/utils/esm/useId.js
1690 var globalId = 0;
1691 function useGlobalId(idOverride, prefix = "mui") {
1692 const [defaultId, setDefaultId] = React10.useState(idOverride);
1693 const id = idOverride || defaultId;
1694 React10.useEffect(() => {
1695 if (defaultId == null) {
1696 globalId += 1;
1697 setDefaultId(`${prefix}-${globalId}`);
1698 }
1699 }, [defaultId, prefix]);
1700 return id;
1701 }
1702 var maybeReactUseId = SafeReact.useId;
1703 function useId(idOverride, prefix) {
1704 if (maybeReactUseId !== void 0) {
1705 const reactId = maybeReactUseId();
1706 return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
1707 }
1708 return useGlobalId(idOverride, prefix);
1709 }
1710
1711 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js
1712 function useBaseUiId(idOverride) {
1713 return useId(idOverride, "base-ui");
1714 }
1715
1716 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js
1717 var React13 = __toESM(require_react(), 1);
1718
1719 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js
1720 var ReactDOM = __toESM(require_react_dom(), 1);
1721
1722 // node_modules/@base-ui/utils/esm/useOnMount.js
1723 var React11 = __toESM(require_react(), 1);
1724 var EMPTY = [];
1725 function useOnMount(fn) {
1726 React11.useEffect(fn, EMPTY);
1727 }
1728
1729 // node_modules/@base-ui/utils/esm/useAnimationFrame.js
1730 var EMPTY2 = null;
1731 var LAST_RAF = globalThis.requestAnimationFrame;
1732 var Scheduler = class {
1733 /* This implementation uses an array as a backing data-structure for frame callbacks.
1734 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1735 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1736 * be much more efficient if there is a call pattern that alterns as
1737 * "request-cancel-request-cancel-…".
1738 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1739 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1740 callbacks = [];
1741 callbacksCount = 0;
1742 nextId = 1;
1743 startId = 1;
1744 isScheduled = false;
1745 tick = (timestamp) => {
1746 this.isScheduled = false;
1747 const currentCallbacks = this.callbacks;
1748 const currentCallbacksCount = this.callbacksCount;
1749 this.callbacks = [];
1750 this.callbacksCount = 0;
1751 this.startId = this.nextId;
1752 if (currentCallbacksCount > 0) {
1753 for (let i2 = 0; i2 < currentCallbacks.length; i2 += 1) {
1754 currentCallbacks[i2]?.(timestamp);
1755 }
1756 }
1757 };
1758 request(fn) {
1759 const id = this.nextId;
1760 this.nextId += 1;
1761 this.callbacks.push(fn);
1762 this.callbacksCount += 1;
1763 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1764 if (!this.isScheduled || didRAFChange) {
1765 requestAnimationFrame(this.tick);
1766 this.isScheduled = true;
1767 }
1768 return id;
1769 }
1770 cancel(id) {
1771 const index2 = id - this.startId;
1772 if (index2 < 0 || index2 >= this.callbacks.length) {
1773 return;
1774 }
1775 this.callbacks[index2] = null;
1776 this.callbacksCount -= 1;
1777 }
1778 };
1779 var scheduler = new Scheduler();
1780 var AnimationFrame = class _AnimationFrame {
1781 static create() {
1782 return new _AnimationFrame();
1783 }
1784 static request(fn) {
1785 return scheduler.request(fn);
1786 }
1787 static cancel(id) {
1788 return scheduler.cancel(id);
1789 }
1790 currentId = EMPTY2;
1791 /**
1792 * Executes `fn` after `delay`, clearing any previously scheduled call.
1793 */
1794 request(fn) {
1795 this.cancel();
1796 this.currentId = scheduler.request(() => {
1797 this.currentId = EMPTY2;
1798 fn();
1799 });
1800 }
1801 cancel = () => {
1802 if (this.currentId !== EMPTY2) {
1803 scheduler.cancel(this.currentId);
1804 this.currentId = EMPTY2;
1805 }
1806 };
1807 disposeEffect = () => {
1808 return this.cancel;
1809 };
1810 };
1811 function useAnimationFrame() {
1812 const timeout = useRefWithInit(AnimationFrame.create).current;
1813 useOnMount(timeout.disposeEffect);
1814 return timeout;
1815 }
1816
1817 // node_modules/@base-ui/react/esm/utils/resolveRef.js
1818 function resolveRef(maybeRef) {
1819 if (maybeRef == null) {
1820 return maybeRef;
1821 }
1822 return "current" in maybeRef ? maybeRef.current : maybeRef;
1823 }
1824
1825 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js
1826 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
1827 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
1828 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
1829 return TransitionStatusDataAttributes2;
1830 })({});
1831 var STARTING_HOOK = {
1832 [TransitionStatusDataAttributes.startingStyle]: ""
1833 };
1834 var ENDING_HOOK = {
1835 [TransitionStatusDataAttributes.endingStyle]: ""
1836 };
1837 var transitionStatusMapping = {
1838 transitionStatus(value) {
1839 if (value === "starting") {
1840 return STARTING_HOOK;
1841 }
1842 if (value === "ending") {
1843 return ENDING_HOOK;
1844 }
1845 return null;
1846 }
1847 };
1848
1849 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js
1850 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) {
1851 const frame = useAnimationFrame();
1852 return useStableCallback((fnToExecute, signal = null) => {
1853 frame.cancel();
1854 const element = resolveRef(elementOrRef);
1855 if (element == null) {
1856 return;
1857 }
1858 const resolvedElement = element;
1859 const done = () => {
1860 ReactDOM.flushSync(fnToExecute);
1861 };
1862 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1863 fnToExecute();
1864 return;
1865 }
1866 function exec() {
1867 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1868 if (!signal?.aborted) {
1869 done();
1870 }
1871 }).catch(() => {
1872 if (treatAbortedAsFinished) {
1873 if (!signal?.aborted) {
1874 done();
1875 }
1876 return;
1877 }
1878 const currentAnimations = resolvedElement.getAnimations();
1879 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1880 exec();
1881 }
1882 });
1883 }
1884 if (waitForStartingStyleRemoved) {
1885 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
1886 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1887 frame.request(exec);
1888 return;
1889 }
1890 const attributeObserver = new MutationObserver(() => {
1891 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1892 attributeObserver.disconnect();
1893 exec();
1894 }
1895 });
1896 attributeObserver.observe(resolvedElement, {
1897 attributes: true,
1898 attributeFilter: [startingStyleAttribute]
1899 });
1900 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
1901 once: true
1902 });
1903 return;
1904 }
1905 frame.request(exec);
1906 });
1907 }
1908
1909 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js
1910 var React12 = __toESM(require_react(), 1);
1911 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
1912 const [transitionStatus, setTransitionStatus] = React12.useState(open && enableIdleState ? "idle" : void 0);
1913 const [mounted, setMounted] = React12.useState(open);
1914 if (open && !mounted) {
1915 setMounted(true);
1916 setTransitionStatus("starting");
1917 }
1918 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
1919 setTransitionStatus("ending");
1920 }
1921 if (!open && !mounted && transitionStatus === "ending") {
1922 setTransitionStatus(void 0);
1923 }
1924 useIsoLayoutEffect(() => {
1925 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
1926 const frame = AnimationFrame.request(() => {
1927 setTransitionStatus("ending");
1928 });
1929 return () => {
1930 AnimationFrame.cancel(frame);
1931 };
1932 }
1933 return void 0;
1934 }, [open, mounted, transitionStatus, deferEndingState]);
1935 useIsoLayoutEffect(() => {
1936 if (!open || enableIdleState) {
1937 return void 0;
1938 }
1939 const frame = AnimationFrame.request(() => {
1940 setTransitionStatus(void 0);
1941 });
1942 return () => {
1943 AnimationFrame.cancel(frame);
1944 };
1945 }, [enableIdleState, open]);
1946 useIsoLayoutEffect(() => {
1947 if (!open || !enableIdleState) {
1948 return void 0;
1949 }
1950 if (open && mounted && transitionStatus !== "idle") {
1951 setTransitionStatus("starting");
1952 }
1953 const frame = AnimationFrame.request(() => {
1954 setTransitionStatus("idle");
1955 });
1956 return () => {
1957 AnimationFrame.cancel(frame);
1958 };
1959 }, [enableIdleState, open, mounted, transitionStatus]);
1960 return {
1961 mounted,
1962 setMounted,
1963 transitionStatus
1964 };
1965 }
1966
1967 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js
1968 function useCollapsibleRoot(parameters) {
1969 const {
1970 open: openParam,
1971 defaultOpen,
1972 onOpenChange,
1973 disabled: disabled2
1974 } = parameters;
1975 const isControlled = openParam !== void 0;
1976 const [open, setOpen] = useControlled({
1977 controlled: openParam,
1978 default: defaultOpen,
1979 name: "Collapsible",
1980 state: "open"
1981 });
1982 const {
1983 mounted,
1984 setMounted,
1985 transitionStatus
1986 } = useTransitionStatus(open, true, true);
1987 const [visible, setVisible] = React13.useState(open);
1988 const [{
1989 height,
1990 width
1991 }, setDimensions] = React13.useState({
1992 height: void 0,
1993 width: void 0
1994 });
1995 const defaultPanelId = useBaseUiId();
1996 const [panelIdState, setPanelIdState] = React13.useState();
1997 const panelId = panelIdState ?? defaultPanelId;
1998 const [hiddenUntilFound, setHiddenUntilFound] = React13.useState(false);
1999 const [keepMounted, setKeepMounted] = React13.useState(false);
2000 const abortControllerRef = React13.useRef(null);
2001 const animationTypeRef = React13.useRef(null);
2002 const transitionDimensionRef = React13.useRef(null);
2003 const panelRef = React13.useRef(null);
2004 const runOnceAnimationsFinish = useAnimationsFinished(panelRef, false);
2005 const handleTrigger = useStableCallback((event) => {
2006 const nextOpen = !open;
2007 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent);
2008 onOpenChange(nextOpen, eventDetails);
2009 if (eventDetails.isCanceled) {
2010 return;
2011 }
2012 const panel = panelRef.current;
2013 if (animationTypeRef.current === "css-animation" && panel != null) {
2014 panel.style.removeProperty("animation-name");
2015 }
2016 if (!hiddenUntilFound && !keepMounted) {
2017 if (animationTypeRef.current != null && animationTypeRef.current !== "css-animation") {
2018 if (!mounted && nextOpen) {
2019 setMounted(true);
2020 }
2021 }
2022 if (animationTypeRef.current === "css-animation") {
2023 if (!visible && nextOpen) {
2024 setVisible(true);
2025 }
2026 if (!mounted && nextOpen) {
2027 setMounted(true);
2028 }
2029 }
2030 }
2031 setOpen(nextOpen);
2032 if (animationTypeRef.current === "none" && mounted && !nextOpen) {
2033 setMounted(false);
2034 }
2035 });
2036 useIsoLayoutEffect(() => {
2037 if (isControlled && animationTypeRef.current === "none" && !open) {
2038 setMounted(false);
2039 }
2040 }, [isControlled, open, openParam, setMounted]);
2041 return React13.useMemo(() => ({
2042 abortControllerRef,
2043 animationTypeRef,
2044 disabled: disabled2,
2045 handleTrigger,
2046 height,
2047 mounted,
2048 open,
2049 panelId,
2050 panelRef,
2051 runOnceAnimationsFinish,
2052 setDimensions,
2053 setHiddenUntilFound,
2054 setKeepMounted,
2055 setMounted,
2056 setOpen,
2057 setPanelIdState,
2058 setVisible,
2059 transitionDimensionRef,
2060 transitionStatus,
2061 visible,
2062 width
2063 }), [abortControllerRef, animationTypeRef, disabled2, handleTrigger, height, mounted, open, panelId, panelRef, runOnceAnimationsFinish, setDimensions, setHiddenUntilFound, setKeepMounted, setMounted, setOpen, setVisible, transitionDimensionRef, transitionStatus, visible, width]);
2064 }
2065
2066 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRootContext.js
2067 var React14 = __toESM(require_react(), 1);
2068 var CollapsibleRootContext = /* @__PURE__ */ React14.createContext(void 0);
2069 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext";
2070 function useCollapsibleRootContext() {
2071 const context = React14.useContext(CollapsibleRootContext);
2072 if (context === void 0) {
2073 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15));
2074 }
2075 return context;
2076 }
2077
2078 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelDataAttributes.js
2079 var CollapsiblePanelDataAttributes = (function(CollapsiblePanelDataAttributes2) {
2080 CollapsiblePanelDataAttributes2["open"] = "data-open";
2081 CollapsiblePanelDataAttributes2["closed"] = "data-closed";
2082 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
2083 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
2084 return CollapsiblePanelDataAttributes2;
2085 })({});
2086
2087 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTriggerDataAttributes.js
2088 var CollapsibleTriggerDataAttributes = /* @__PURE__ */ (function(CollapsibleTriggerDataAttributes2) {
2089 CollapsibleTriggerDataAttributes2["panelOpen"] = "data-panel-open";
2090 return CollapsibleTriggerDataAttributes2;
2091 })({});
2092
2093 // node_modules/@base-ui/react/esm/utils/collapsibleOpenStateMapping.js
2094 var PANEL_OPEN_HOOK = {
2095 [CollapsiblePanelDataAttributes.open]: ""
2096 };
2097 var PANEL_CLOSED_HOOK = {
2098 [CollapsiblePanelDataAttributes.closed]: ""
2099 };
2100 var triggerOpenStateMapping = {
2101 open(value) {
2102 if (value) {
2103 return {
2104 [CollapsibleTriggerDataAttributes.panelOpen]: ""
2105 };
2106 }
2107 return null;
2108 }
2109 };
2110 var collapsibleOpenStateMapping = {
2111 open(value) {
2112 if (value) {
2113 return PANEL_OPEN_HOOK;
2114 }
2115 return PANEL_CLOSED_HOOK;
2116 }
2117 };
2118
2119 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js
2120 var React17 = __toESM(require_react(), 1);
2121
2122 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
2123 function hasWindow() {
2124 return typeof window !== "undefined";
2125 }
2126 function getNodeName(node) {
2127 if (isNode(node)) {
2128 return (node.nodeName || "").toLowerCase();
2129 }
2130 return "#document";
2131 }
2132 function getWindow(node) {
2133 var _node$ownerDocument;
2134 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2135 }
2136 function getDocumentElement(node) {
2137 var _ref;
2138 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2139 }
2140 function isNode(value) {
2141 if (!hasWindow()) {
2142 return false;
2143 }
2144 return value instanceof Node || value instanceof getWindow(value).Node;
2145 }
2146 function isElement(value) {
2147 if (!hasWindow()) {
2148 return false;
2149 }
2150 return value instanceof Element || value instanceof getWindow(value).Element;
2151 }
2152 function isHTMLElement(value) {
2153 if (!hasWindow()) {
2154 return false;
2155 }
2156 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2157 }
2158 function isShadowRoot(value) {
2159 if (!hasWindow() || typeof ShadowRoot === "undefined") {
2160 return false;
2161 }
2162 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2163 }
2164 function isOverflowElement(element) {
2165 const {
2166 overflow,
2167 overflowX,
2168 overflowY,
2169 display
2170 } = getComputedStyle2(element);
2171 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
2172 }
2173 function isTableElement(element) {
2174 return /^(table|td|th)$/.test(getNodeName(element));
2175 }
2176 function isTopLayer(element) {
2177 try {
2178 if (element.matches(":popover-open")) {
2179 return true;
2180 }
2181 } catch (_e) {
2182 }
2183 try {
2184 return element.matches(":modal");
2185 } catch (_e) {
2186 return false;
2187 }
2188 }
2189 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
2190 var containRe = /paint|layout|strict|content/;
2191 var isNotNone = (value) => !!value && value !== "none";
2192 var isWebKitValue;
2193 function isContainingBlock(elementOrCss) {
2194 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
2195 return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
2196 }
2197 function getContainingBlock(element) {
2198 let currentNode = getParentNode(element);
2199 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2200 if (isContainingBlock(currentNode)) {
2201 return currentNode;
2202 } else if (isTopLayer(currentNode)) {
2203 return null;
2204 }
2205 currentNode = getParentNode(currentNode);
2206 }
2207 return null;
2208 }
2209 function isWebKit() {
2210 if (isWebKitValue == null) {
2211 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
2212 }
2213 return isWebKitValue;
2214 }
2215 function isLastTraversableNode(node) {
2216 return /^(html|body|#document)$/.test(getNodeName(node));
2217 }
2218 function getComputedStyle2(element) {
2219 return getWindow(element).getComputedStyle(element);
2220 }
2221 function getNodeScroll(element) {
2222 if (isElement(element)) {
2223 return {
2224 scrollLeft: element.scrollLeft,
2225 scrollTop: element.scrollTop
2226 };
2227 }
2228 return {
2229 scrollLeft: element.scrollX,
2230 scrollTop: element.scrollY
2231 };
2232 }
2233 function getParentNode(node) {
2234 if (getNodeName(node) === "html") {
2235 return node;
2236 }
2237 const result = (
2238 // Step into the shadow DOM of the parent of a slotted node.
2239 node.assignedSlot || // DOM Element detected.
2240 node.parentNode || // ShadowRoot detected.
2241 isShadowRoot(node) && node.host || // Fallback.
2242 getDocumentElement(node)
2243 );
2244 return isShadowRoot(result) ? result.host : result;
2245 }
2246 function getNearestOverflowAncestor(node) {
2247 const parentNode = getParentNode(node);
2248 if (isLastTraversableNode(parentNode)) {
2249 return node.ownerDocument ? node.ownerDocument.body : node.body;
2250 }
2251 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2252 return parentNode;
2253 }
2254 return getNearestOverflowAncestor(parentNode);
2255 }
2256 function getOverflowAncestors(node, list, traverseIframes) {
2257 var _node$ownerDocument2;
2258 if (list === void 0) {
2259 list = [];
2260 }
2261 if (traverseIframes === void 0) {
2262 traverseIframes = true;
2263 }
2264 const scrollableAncestor = getNearestOverflowAncestor(node);
2265 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2266 const win = getWindow(scrollableAncestor);
2267 if (isBody) {
2268 const frameElement = getFrameElement(win);
2269 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
2270 } else {
2271 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2272 }
2273 }
2274 function getFrameElement(win) {
2275 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
2276 }
2277
2278 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js
2279 var React15 = __toESM(require_react(), 1);
2280 var CompositeRootContext = /* @__PURE__ */ React15.createContext(void 0);
2281 if (true) CompositeRootContext.displayName = "CompositeRootContext";
2282 function useCompositeRootContext(optional = false) {
2283 const context = React15.useContext(CompositeRootContext);
2284 if (context === void 0 && !optional) {
2285 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
2286 }
2287 return context;
2288 }
2289
2290 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js
2291 var React16 = __toESM(require_react(), 1);
2292 function useFocusableWhenDisabled(parameters) {
2293 const {
2294 focusableWhenDisabled,
2295 disabled: disabled2,
2296 composite = false,
2297 tabIndex: tabIndexProp = 0,
2298 isNativeButton
2299 } = parameters;
2300 const isFocusableComposite = composite && focusableWhenDisabled !== false;
2301 const isNonFocusableComposite = composite && focusableWhenDisabled === false;
2302 const props = React16.useMemo(() => {
2303 const additionalProps = {
2304 // allow Tabbing away from focusableWhenDisabled elements
2305 onKeyDown(event) {
2306 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
2307 event.preventDefault();
2308 }
2309 }
2310 };
2311 if (!composite) {
2312 additionalProps.tabIndex = tabIndexProp;
2313 if (!isNativeButton && disabled2) {
2314 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
2315 }
2316 }
2317 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
2318 additionalProps["aria-disabled"] = disabled2;
2319 }
2320 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
2321 additionalProps.disabled = disabled2;
2322 }
2323 return additionalProps;
2324 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
2325 return {
2326 props
2327 };
2328 }
2329
2330 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js
2331 function useButton(parameters = {}) {
2332 const {
2333 disabled: disabled2 = false,
2334 focusableWhenDisabled,
2335 tabIndex = 0,
2336 native: isNativeButton = true,
2337 composite: compositeProp
2338 } = parameters;
2339 const elementRef = React17.useRef(null);
2340 const compositeRootContext = useCompositeRootContext(true);
2341 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
2342 const {
2343 props: focusableWhenDisabledProps
2344 } = useFocusableWhenDisabled({
2345 focusableWhenDisabled,
2346 disabled: disabled2,
2347 composite: isCompositeItem,
2348 tabIndex,
2349 isNativeButton
2350 });
2351 if (true) {
2352 React17.useEffect(() => {
2353 if (!elementRef.current) {
2354 return;
2355 }
2356 const isButtonTag = isButtonElement(elementRef.current);
2357 if (isNativeButton) {
2358 if (!isButtonTag) {
2359 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
2360 const message2 = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`.";
2361 error(`${message2}${ownerStackMessage}`);
2362 }
2363 } else if (isButtonTag) {
2364 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
2365 const message2 = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`.";
2366 error(`${message2}${ownerStackMessage}`);
2367 }
2368 }, [isNativeButton]);
2369 }
2370 const updateDisabled = React17.useCallback(() => {
2371 const element = elementRef.current;
2372 if (!isButtonElement(element)) {
2373 return;
2374 }
2375 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
2376 element.disabled = false;
2377 }
2378 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]);
2379 useIsoLayoutEffect(updateDisabled, [updateDisabled]);
2380 const getButtonProps = React17.useCallback((externalProps = {}) => {
2381 const {
2382 onClick: externalOnClick,
2383 onMouseDown: externalOnMouseDown,
2384 onKeyUp: externalOnKeyUp,
2385 onKeyDown: externalOnKeyDown,
2386 onPointerDown: externalOnPointerDown,
2387 ...otherExternalProps
2388 } = externalProps;
2389 const type = isNativeButton ? "button" : void 0;
2390 return mergeProps({
2391 type,
2392 onClick(event) {
2393 if (disabled2) {
2394 event.preventDefault();
2395 return;
2396 }
2397 externalOnClick?.(event);
2398 },
2399 onMouseDown(event) {
2400 if (!disabled2) {
2401 externalOnMouseDown?.(event);
2402 }
2403 },
2404 onKeyDown(event) {
2405 if (disabled2) {
2406 return;
2407 }
2408 makeEventPreventable(event);
2409 externalOnKeyDown?.(event);
2410 if (event.baseUIHandlerPrevented) {
2411 return;
2412 }
2413 const isCurrentTarget = event.target === event.currentTarget;
2414 const currentTarget = event.currentTarget;
2415 const isButton2 = isButtonElement(currentTarget);
2416 const isLink = !isNativeButton && isValidLinkElement(currentTarget);
2417 const shouldClick = isCurrentTarget && (isNativeButton ? isButton2 : !isLink);
2418 const isEnterKey = event.key === "Enter";
2419 const isSpaceKey = event.key === " ";
2420 const role = currentTarget.getAttribute("role");
2421 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
2422 if (isCurrentTarget && isCompositeItem && isSpaceKey) {
2423 if (event.defaultPrevented && isTextNavigationRole) {
2424 return;
2425 }
2426 event.preventDefault();
2427 if (isLink || isNativeButton && isButton2) {
2428 currentTarget.click();
2429 event.preventBaseUIHandler();
2430 } else if (shouldClick) {
2431 externalOnClick?.(event);
2432 event.preventBaseUIHandler();
2433 }
2434 return;
2435 }
2436 if (shouldClick) {
2437 if (!isNativeButton && (isSpaceKey || isEnterKey)) {
2438 event.preventDefault();
2439 }
2440 if (!isNativeButton && isEnterKey) {
2441 externalOnClick?.(event);
2442 }
2443 }
2444 },
2445 onKeyUp(event) {
2446 if (disabled2) {
2447 return;
2448 }
2449 makeEventPreventable(event);
2450 externalOnKeyUp?.(event);
2451 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
2452 event.preventDefault();
2453 return;
2454 }
2455 if (event.baseUIHandlerPrevented) {
2456 return;
2457 }
2458 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") {
2459 externalOnClick?.(event);
2460 }
2461 },
2462 onPointerDown(event) {
2463 if (disabled2) {
2464 event.preventDefault();
2465 return;
2466 }
2467 externalOnPointerDown?.(event);
2468 }
2469 }, !isNativeButton ? {
2470 role: "button"
2471 } : void 0, focusableWhenDisabledProps, otherExternalProps);
2472 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
2473 const buttonRef = useStableCallback((element) => {
2474 elementRef.current = element;
2475 updateDisabled();
2476 });
2477 return {
2478 getButtonProps,
2479 buttonRef
2480 };
2481 }
2482 function isButtonElement(elem) {
2483 return isHTMLElement(elem) && elem.tagName === "BUTTON";
2484 }
2485 function isValidLinkElement(elem) {
2486 return Boolean(elem?.tagName === "A" && elem?.href);
2487 }
2488
2489 // node_modules/@base-ui/utils/esm/detectBrowser.js
2490 var hasNavigator = typeof navigator !== "undefined";
2491 var nav = getNavigatorData();
2492 var platform = getPlatform();
2493 var userAgent = getUserAgent();
2494 var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none");
2495 var isIOS = (
2496 // iPads can claim to be MacIntel
2497 nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform)
2498 );
2499 var isFirefox = hasNavigator && /firefox/i.test(userAgent);
2500 var isSafari = hasNavigator && /apple/i.test(navigator.vendor);
2501 var isEdge = hasNavigator && /Edg/i.test(userAgent);
2502 var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent);
2503 var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
2504 var isJSDOM = userAgent.includes("jsdom/");
2505 function getNavigatorData() {
2506 if (!hasNavigator) {
2507 return {
2508 platform: "",
2509 maxTouchPoints: -1
2510 };
2511 }
2512 const uaData = navigator.userAgentData;
2513 if (uaData?.platform) {
2514 return {
2515 platform: uaData.platform,
2516 maxTouchPoints: navigator.maxTouchPoints
2517 };
2518 }
2519 return {
2520 platform: navigator.platform ?? "",
2521 maxTouchPoints: navigator.maxTouchPoints ?? -1
2522 };
2523 }
2524 function getUserAgent() {
2525 if (!hasNavigator) {
2526 return "";
2527 }
2528 const uaData = navigator.userAgentData;
2529 if (uaData && Array.isArray(uaData.brands)) {
2530 return uaData.brands.map(({
2531 brand,
2532 version: version2
2533 }) => `${brand}/${version2}`).join(" ");
2534 }
2535 return navigator.userAgent;
2536 }
2537 function getPlatform() {
2538 if (!hasNavigator) {
2539 return "";
2540 }
2541 const uaData = navigator.userAgentData;
2542 if (uaData?.platform) {
2543 return uaData.platform;
2544 }
2545 return navigator.platform ?? "";
2546 }
2547
2548 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js
2549 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
2550 var ACTIVE_KEY = "active";
2551 var SELECTED_KEY = "selected";
2552 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
2553
2554 // node_modules/@base-ui/react/esm/internals/shadowDom.js
2555 function activeElement(doc) {
2556 let element = doc.activeElement;
2557 while (element?.shadowRoot?.activeElement != null) {
2558 element = element.shadowRoot.activeElement;
2559 }
2560 return element;
2561 }
2562 function contains(parent, child) {
2563 if (!parent || !child) {
2564 return false;
2565 }
2566 const rootNode = child.getRootNode?.();
2567 if (parent.contains(child)) {
2568 return true;
2569 }
2570 if (rootNode && isShadowRoot(rootNode)) {
2571 let next = child;
2572 while (next) {
2573 if (parent === next) {
2574 return true;
2575 }
2576 next = next.parentNode || next.host;
2577 }
2578 }
2579 return false;
2580 }
2581 function getTarget(event) {
2582 if ("composedPath" in event) {
2583 return event.composedPath()[0];
2584 }
2585 return event.target;
2586 }
2587
2588 // node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js
2589 function isTargetInsideEnabledTrigger(target, triggerElements) {
2590 if (!isElement(target)) {
2591 return false;
2592 }
2593 const targetElement = target;
2594 if (triggerElements.hasElement(targetElement)) {
2595 return !targetElement.hasAttribute("data-trigger-disabled");
2596 }
2597 for (const [, trigger] of triggerElements.entries()) {
2598 if (contains(trigger, targetElement)) {
2599 return !trigger.hasAttribute("data-trigger-disabled");
2600 }
2601 }
2602 return false;
2603 }
2604 function isEventTargetWithin(event, node) {
2605 if (node == null) {
2606 return false;
2607 }
2608 if ("composedPath" in event) {
2609 return event.composedPath().includes(node);
2610 }
2611 const eventAgain = event;
2612 return eventAgain.target != null && node.contains(eventAgain.target);
2613 }
2614 function isRootElement(element) {
2615 return element.matches("html,body");
2616 }
2617 function isTypeableElement(element) {
2618 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
2619 }
2620 function isInteractiveElement(element) {
2621 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
2622 }
2623 function matchesFocusVisible(element) {
2624 if (!element || isJSDOM) {
2625 return true;
2626 }
2627 try {
2628 return element.matches(":focus-visible");
2629 } catch (_e) {
2630 return true;
2631 }
2632 }
2633
2634 // node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js
2635 function getNodeChildren(nodes, id, onlyOpenChildren = true) {
2636 const directChildren = nodes.filter((node) => node.parentId === id);
2637 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
2638 }
2639
2640 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js
2641 function isReactEvent(event) {
2642 return "nativeEvent" in event;
2643 }
2644 function isMouseLikePointerType(pointerType, strict) {
2645 const values = ["mouse", "pen"];
2646 if (!strict) {
2647 values.push("", void 0);
2648 }
2649 return values.includes(pointerType);
2650 }
2651 function isClickLikeEvent(event) {
2652 const type = event.type;
2653 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
2654 }
2655
2656 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2657 var sides = ["top", "right", "bottom", "left"];
2658 var min = Math.min;
2659 var max = Math.max;
2660 var round = Math.round;
2661 var floor = Math.floor;
2662 var createCoords = (v2) => ({
2663 x: v2,
2664 y: v2
2665 });
2666 var oppositeSideMap = {
2667 left: "right",
2668 right: "left",
2669 bottom: "top",
2670 top: "bottom"
2671 };
2672 function clamp(start, value, end) {
2673 return max(start, min(value, end));
2674 }
2675 function evaluate(value, param) {
2676 return typeof value === "function" ? value(param) : value;
2677 }
2678 function getSide(placement) {
2679 return placement.split("-")[0];
2680 }
2681 function getAlignment(placement) {
2682 return placement.split("-")[1];
2683 }
2684 function getOppositeAxis(axis) {
2685 return axis === "x" ? "y" : "x";
2686 }
2687 function getAxisLength(axis) {
2688 return axis === "y" ? "height" : "width";
2689 }
2690 function getSideAxis(placement) {
2691 const firstChar = placement[0];
2692 return firstChar === "t" || firstChar === "b" ? "y" : "x";
2693 }
2694 function getAlignmentAxis(placement) {
2695 return getOppositeAxis(getSideAxis(placement));
2696 }
2697 function getAlignmentSides(placement, rects, rtl) {
2698 if (rtl === void 0) {
2699 rtl = false;
2700 }
2701 const alignment = getAlignment(placement);
2702 const alignmentAxis = getAlignmentAxis(placement);
2703 const length = getAxisLength(alignmentAxis);
2704 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2705 if (rects.reference[length] > rects.floating[length]) {
2706 mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2707 }
2708 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2709 }
2710 function getExpandedPlacements(placement) {
2711 const oppositePlacement = getOppositePlacement(placement);
2712 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2713 }
2714 function getOppositeAlignmentPlacement(placement) {
2715 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2716 }
2717 var lrPlacement = ["left", "right"];
2718 var rlPlacement = ["right", "left"];
2719 var tbPlacement = ["top", "bottom"];
2720 var btPlacement = ["bottom", "top"];
2721 function getSideList(side, isStart, rtl) {
2722 switch (side) {
2723 case "top":
2724 case "bottom":
2725 if (rtl) return isStart ? rlPlacement : lrPlacement;
2726 return isStart ? lrPlacement : rlPlacement;
2727 case "left":
2728 case "right":
2729 return isStart ? tbPlacement : btPlacement;
2730 default:
2731 return [];
2732 }
2733 }
2734 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2735 const alignment = getAlignment(placement);
2736 let list = getSideList(getSide(placement), direction === "start", rtl);
2737 if (alignment) {
2738 list = list.map((side) => side + "-" + alignment);
2739 if (flipAlignment) {
2740 list = list.concat(list.map(getOppositeAlignmentPlacement));
2741 }
2742 }
2743 return list;
2744 }
2745 function getOppositePlacement(placement) {
2746 const side = getSide(placement);
2747 return oppositeSideMap[side] + placement.slice(side.length);
2748 }
2749 function expandPaddingObject(padding) {
2750 return {
2751 top: 0,
2752 right: 0,
2753 bottom: 0,
2754 left: 0,
2755 ...padding
2756 };
2757 }
2758 function getPaddingObject(padding) {
2759 return typeof padding !== "number" ? expandPaddingObject(padding) : {
2760 top: padding,
2761 right: padding,
2762 bottom: padding,
2763 left: padding
2764 };
2765 }
2766 function rectToClientRect(rect) {
2767 const {
2768 x: x2,
2769 y: y2,
2770 width,
2771 height
2772 } = rect;
2773 return {
2774 width,
2775 height,
2776 top: y2,
2777 left: x2,
2778 right: x2 + width,
2779 bottom: y2 + height,
2780 x: x2,
2781 y: y2
2782 };
2783 }
2784
2785 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js
2786 function isHiddenByStyles(styles) {
2787 return styles.visibility === "hidden" || styles.visibility === "collapse";
2788 }
2789 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
2790 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
2791 return false;
2792 }
2793 if (typeof element.checkVisibility === "function") {
2794 return element.checkVisibility();
2795 }
2796 return styles.display !== "none" && styles.display !== "contents";
2797 }
2798
2799 // node_modules/@base-ui/utils/esm/owner.js
2800 function ownerDocument(node) {
2801 return node?.ownerDocument || document;
2802 }
2803
2804 // node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js
2805 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
2806 function getParentElement(element) {
2807 const assignedSlot = element.assignedSlot;
2808 if (assignedSlot) {
2809 return assignedSlot;
2810 }
2811 if (element.parentElement) {
2812 return element.parentElement;
2813 }
2814 const rootNode = element.getRootNode();
2815 return isShadowRoot(rootNode) ? rootNode.host : null;
2816 }
2817 function getDetailsSummary(details) {
2818 for (const child of Array.from(details.children)) {
2819 if (getNodeName(child) === "summary") {
2820 return child;
2821 }
2822 }
2823 return null;
2824 }
2825 function isWithinOpenDetailsSummary(element, details) {
2826 const summary = getDetailsSummary(details);
2827 return !!summary && (element === summary || contains(summary, element));
2828 }
2829 function isFocusableCandidate(element) {
2830 const nodeName = element ? getNodeName(element) : "";
2831 return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden");
2832 }
2833 function isFocusableElement(element) {
2834 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
2835 return false;
2836 }
2837 for (let current = element; current; current = getParentElement(current)) {
2838 const isAncestor = current !== element;
2839 const isSlot = getNodeName(current) === "slot";
2840 if (current.hasAttribute("inert")) {
2841 return false;
2842 }
2843 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
2844 return false;
2845 }
2846 }
2847 return true;
2848 }
2849 function isVisibleInTabbableTree(element, isAncestor) {
2850 const styles = getComputedStyle2(element);
2851 if (!isAncestor) {
2852 return isElementVisible(element, styles);
2853 }
2854 return styles.display !== "none";
2855 }
2856 function getTabIndex(element) {
2857 const tabIndex = element.tabIndex;
2858 if (tabIndex < 0) {
2859 const nodeName = getNodeName(element);
2860 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
2861 return 0;
2862 }
2863 }
2864 return tabIndex;
2865 }
2866 function getNamedRadioInput(element) {
2867 if (getNodeName(element) !== "input") {
2868 return null;
2869 }
2870 const input = element;
2871 return input.type === "radio" && input.name !== "" ? input : null;
2872 }
2873 function isTabbableRadio(element, candidates) {
2874 const input = getNamedRadioInput(element);
2875 if (!input) {
2876 return true;
2877 }
2878 const checkedRadio = candidates.find((candidate) => {
2879 const radio = getNamedRadioInput(candidate);
2880 return radio?.name === input.name && radio.form === input.form && radio.checked;
2881 });
2882 if (checkedRadio) {
2883 return checkedRadio === input;
2884 }
2885 return candidates.find((candidate) => {
2886 const radio = getNamedRadioInput(candidate);
2887 return radio?.name === input.name && radio.form === input.form;
2888 }) === input;
2889 }
2890 function getComposedChildren(container) {
2891 if (isHTMLElement(container) && getNodeName(container) === "slot") {
2892 const assignedElements = container.assignedElements({
2893 flatten: true
2894 });
2895 if (assignedElements.length > 0) {
2896 return assignedElements;
2897 }
2898 }
2899 if (isHTMLElement(container) && container.shadowRoot) {
2900 return Array.from(container.shadowRoot.children);
2901 }
2902 return Array.from(container.children);
2903 }
2904 function appendCandidates(container, list) {
2905 getComposedChildren(container).forEach((child) => {
2906 if (isFocusableCandidate(child)) {
2907 list.push(child);
2908 }
2909 appendCandidates(child, list);
2910 });
2911 }
2912 function appendMatchingElements(container, selector2, list) {
2913 getComposedChildren(container).forEach((child) => {
2914 if (isHTMLElement(child) && child.matches(selector2)) {
2915 list.push(child);
2916 }
2917 appendMatchingElements(child, selector2, list);
2918 });
2919 }
2920 function focusable(container) {
2921 const candidates = [];
2922 appendCandidates(container, candidates);
2923 return candidates.filter(isFocusableElement);
2924 }
2925 function tabbable(container) {
2926 const candidates = focusable(container);
2927 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
2928 }
2929 function getTabbableIn(container, dir) {
2930 const list = tabbable(container);
2931 const len = list.length;
2932 if (len === 0) {
2933 return void 0;
2934 }
2935 const active = activeElement(ownerDocument(container));
2936 const index2 = list.indexOf(active);
2937 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
2938 return list[nextIndex];
2939 }
2940 function getNextTabbable(referenceElement) {
2941 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
2942 }
2943 function getPreviousTabbable(referenceElement) {
2944 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
2945 }
2946 function isOutsideEvent(event, container) {
2947 const containerElement = container || event.currentTarget;
2948 const relatedTarget = event.relatedTarget;
2949 return !relatedTarget || !contains(containerElement, relatedTarget);
2950 }
2951 function disableFocusInside(container) {
2952 const tabbableElements = tabbable(container);
2953 tabbableElements.forEach((element) => {
2954 element.dataset.tabindex = element.getAttribute("tabindex") || "";
2955 element.setAttribute("tabindex", "-1");
2956 });
2957 }
2958 function enableFocusInside(container) {
2959 const elements = [];
2960 appendMatchingElements(container, "[data-tabindex]", elements);
2961 elements.forEach((element) => {
2962 const tabindex = element.dataset.tabindex;
2963 delete element.dataset.tabindex;
2964 if (tabindex) {
2965 element.setAttribute("tabindex", tabindex);
2966 } else {
2967 element.removeAttribute("tabindex");
2968 }
2969 });
2970 }
2971
2972 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js
2973 var React18 = __toESM(require_react(), 1);
2974
2975 // node_modules/@base-ui/utils/esm/addEventListener.js
2976 function addEventListener(target, type, listener, options) {
2977 target.addEventListener(type, listener, options);
2978 return () => {
2979 target.removeEventListener(type, listener, options);
2980 };
2981 }
2982
2983 // node_modules/@base-ui/react/esm/accordion/root/AccordionRootDataAttributes.js
2984 var AccordionRootDataAttributes = /* @__PURE__ */ (function(AccordionRootDataAttributes2) {
2985 AccordionRootDataAttributes2["disabled"] = "data-disabled";
2986 AccordionRootDataAttributes2["orientation"] = "data-orientation";
2987 return AccordionRootDataAttributes2;
2988 })({});
2989
2990 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js
2991 function useCollapsiblePanel(parameters) {
2992 const {
2993 abortControllerRef,
2994 animationTypeRef,
2995 externalRef,
2996 height,
2997 hiddenUntilFound,
2998 keepMounted,
2999 id: idParam,
3000 mounted,
3001 onOpenChange,
3002 open,
3003 panelRef,
3004 runOnceAnimationsFinish,
3005 setDimensions,
3006 setMounted,
3007 setOpen,
3008 setVisible,
3009 transitionDimensionRef,
3010 visible,
3011 width
3012 } = parameters;
3013 const isBeforeMatchRef = React18.useRef(false);
3014 const latestAnimationNameRef = React18.useRef(null);
3015 const shouldCancelInitialOpenAnimationRef = React18.useRef(open);
3016 const shouldCancelInitialOpenTransitionRef = React18.useRef(open);
3017 const endingStyleFrame = useAnimationFrame();
3018 const hidden = React18.useMemo(() => {
3019 if (animationTypeRef.current === "css-animation") {
3020 return !visible;
3021 }
3022 return !open && !mounted;
3023 }, [open, mounted, visible, animationTypeRef]);
3024 const handlePanelRef = useStableCallback((element) => {
3025 if (!element) {
3026 return void 0;
3027 }
3028 if (animationTypeRef.current == null || transitionDimensionRef.current == null) {
3029 const panelStyles = getComputedStyle(element);
3030 const hasAnimation = panelStyles.animationName !== "none" && panelStyles.animationName !== "";
3031 const hasTransition = panelStyles.transitionDuration !== "0s" && panelStyles.transitionDuration !== "";
3032 if (hasAnimation && hasTransition) {
3033 if (true) {
3034 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.");
3035 }
3036 } else if (panelStyles.animationName === "none" && panelStyles.transitionDuration !== "0s") {
3037 animationTypeRef.current = "css-transition";
3038 } else if (panelStyles.animationName !== "none" && panelStyles.transitionDuration === "0s") {
3039 animationTypeRef.current = "css-animation";
3040 } else {
3041 animationTypeRef.current = "none";
3042 }
3043 if (element.getAttribute(AccordionRootDataAttributes.orientation) === "horizontal" || panelStyles.transitionProperty.indexOf("width") > -1) {
3044 transitionDimensionRef.current = "width";
3045 } else {
3046 transitionDimensionRef.current = "height";
3047 }
3048 }
3049 if (animationTypeRef.current !== "css-transition") {
3050 return void 0;
3051 }
3052 if (height === void 0 || width === void 0) {
3053 setDimensions({
3054 height: element.scrollHeight,
3055 width: element.scrollWidth
3056 });
3057 if (shouldCancelInitialOpenTransitionRef.current) {
3058 element.style.setProperty("transition-duration", "0s");
3059 }
3060 }
3061 let frame = -1;
3062 let nextFrame = -1;
3063 frame = AnimationFrame.request(() => {
3064 shouldCancelInitialOpenTransitionRef.current = false;
3065 nextFrame = AnimationFrame.request(() => {
3066 setTimeout(() => {
3067 element.style.removeProperty("transition-duration");
3068 });
3069 });
3070 });
3071 return () => {
3072 AnimationFrame.cancel(frame);
3073 AnimationFrame.cancel(nextFrame);
3074 };
3075 });
3076 const mergedPanelRef = useMergedRefs(externalRef, panelRef, handlePanelRef);
3077 useIsoLayoutEffect(() => {
3078 if (animationTypeRef.current !== "css-transition") {
3079 return void 0;
3080 }
3081 const panel = panelRef.current;
3082 if (!panel) {
3083 return void 0;
3084 }
3085 let resizeFrame = -1;
3086 if (abortControllerRef.current != null) {
3087 abortControllerRef.current.abort();
3088 abortControllerRef.current = null;
3089 }
3090 if (open) {
3091 const originalLayoutStyles = {
3092 "justify-content": panel.style.justifyContent,
3093 "align-items": panel.style.alignItems,
3094 "align-content": panel.style.alignContent,
3095 "justify-items": panel.style.justifyItems
3096 };
3097 Object.keys(originalLayoutStyles).forEach((key) => {
3098 panel.style.setProperty(key, "initial", "important");
3099 });
3100 if (!shouldCancelInitialOpenTransitionRef.current && !keepMounted) {
3101 panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, "");
3102 }
3103 setDimensions({
3104 height: panel.scrollHeight,
3105 width: panel.scrollWidth
3106 });
3107 resizeFrame = AnimationFrame.request(() => {
3108 Object.entries(originalLayoutStyles).forEach(([key, value]) => {
3109 if (value === "") {
3110 panel.style.removeProperty(key);
3111 } else {
3112 panel.style.setProperty(key, value);
3113 }
3114 });
3115 });
3116 } else {
3117 if (panel.scrollHeight === 0 && panel.scrollWidth === 0) {
3118 return void 0;
3119 }
3120 setDimensions({
3121 height: panel.scrollHeight,
3122 width: panel.scrollWidth
3123 });
3124 const abortController = new AbortController();
3125 abortControllerRef.current = abortController;
3126 const signal = abortController.signal;
3127 let attributeObserver = null;
3128 const endingStyleAttribute = CollapsiblePanelDataAttributes.endingStyle;
3129 attributeObserver = new MutationObserver((mutationList) => {
3130 const hasEndingStyle = mutationList.some((mutation) => mutation.type === "attributes" && mutation.attributeName === endingStyleAttribute);
3131 if (hasEndingStyle) {
3132 attributeObserver?.disconnect();
3133 attributeObserver = null;
3134 runOnceAnimationsFinish(() => {
3135 setDimensions({
3136 height: 0,
3137 width: 0
3138 });
3139 panel.style.removeProperty("content-visibility");
3140 setMounted(false);
3141 if (abortControllerRef.current === abortController) {
3142 abortControllerRef.current = null;
3143 }
3144 }, signal);
3145 }
3146 });
3147 attributeObserver.observe(panel, {
3148 attributes: true,
3149 attributeFilter: [endingStyleAttribute]
3150 });
3151 return () => {
3152 attributeObserver?.disconnect();
3153 endingStyleFrame.cancel();
3154 if (abortControllerRef.current === abortController) {
3155 abortController.abort();
3156 abortControllerRef.current = null;
3157 }
3158 };
3159 }
3160 return () => {
3161 AnimationFrame.cancel(resizeFrame);
3162 };
3163 }, [abortControllerRef, animationTypeRef, endingStyleFrame, hiddenUntilFound, keepMounted, mounted, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted]);
3164 useIsoLayoutEffect(() => {
3165 if (animationTypeRef.current !== "css-animation") {
3166 return;
3167 }
3168 const panel = panelRef.current;
3169 if (!panel) {
3170 return;
3171 }
3172 latestAnimationNameRef.current = panel.style.animationName || latestAnimationNameRef.current;
3173 panel.style.setProperty("animation-name", "none");
3174 setDimensions({
3175 height: panel.scrollHeight,
3176 width: panel.scrollWidth
3177 });
3178 if (!shouldCancelInitialOpenAnimationRef.current && !isBeforeMatchRef.current) {
3179 panel.style.removeProperty("animation-name");
3180 }
3181 if (open) {
3182 if (abortControllerRef.current != null) {
3183 abortControllerRef.current.abort();
3184 abortControllerRef.current = null;
3185 }
3186 setMounted(true);
3187 setVisible(true);
3188 } else {
3189 abortControllerRef.current = new AbortController();
3190 runOnceAnimationsFinish(() => {
3191 setMounted(false);
3192 setVisible(false);
3193 abortControllerRef.current = null;
3194 }, abortControllerRef.current.signal);
3195 }
3196 }, [abortControllerRef, animationTypeRef, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted, setVisible, visible]);
3197 useOnMount(() => {
3198 const frame = AnimationFrame.request(() => {
3199 shouldCancelInitialOpenAnimationRef.current = false;
3200 });
3201 return () => AnimationFrame.cancel(frame);
3202 });
3203 useIsoLayoutEffect(() => {
3204 if (!hiddenUntilFound) {
3205 return void 0;
3206 }
3207 const panel = panelRef.current;
3208 if (!panel) {
3209 return void 0;
3210 }
3211 let frame = -1;
3212 let nextFrame = -1;
3213 if (open && isBeforeMatchRef.current) {
3214 panel.style.transitionDuration = "0s";
3215 setDimensions({
3216 height: panel.scrollHeight,
3217 width: panel.scrollWidth
3218 });
3219 frame = AnimationFrame.request(() => {
3220 isBeforeMatchRef.current = false;
3221 nextFrame = AnimationFrame.request(() => {
3222 setTimeout(() => {
3223 panel.style.removeProperty("transition-duration");
3224 });
3225 });
3226 });
3227 }
3228 return () => {
3229 AnimationFrame.cancel(frame);
3230 AnimationFrame.cancel(nextFrame);
3231 };
3232 }, [hiddenUntilFound, open, panelRef, setDimensions]);
3233 useIsoLayoutEffect(() => {
3234 const panel = panelRef.current;
3235 if (panel && hiddenUntilFound && hidden) {
3236 panel.setAttribute("hidden", "until-found");
3237 if (animationTypeRef.current === "css-transition") {
3238 panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, "");
3239 }
3240 }
3241 }, [hiddenUntilFound, hidden, animationTypeRef, panelRef]);
3242 React18.useEffect(function registerBeforeMatchListener() {
3243 const panel = panelRef.current;
3244 if (!panel) {
3245 return void 0;
3246 }
3247 function handleBeforeMatch(event) {
3248 isBeforeMatchRef.current = true;
3249 setOpen(true);
3250 onOpenChange(true, createChangeEventDetails(reason_parts_exports.none, event));
3251 }
3252 return addEventListener(panel, "beforematch", handleBeforeMatch);
3253 }, [onOpenChange, panelRef, setOpen]);
3254 return React18.useMemo(() => ({
3255 props: {
3256 hidden,
3257 id: idParam,
3258 ref: mergedPanelRef
3259 }
3260 }), [hidden, idParam, mergedPanelRef]);
3261 }
3262
3263 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js
3264 var React19 = __toESM(require_react(), 1);
3265 function useOpenChangeComplete(parameters) {
3266 const {
3267 enabled = true,
3268 open,
3269 ref,
3270 onComplete: onCompleteParam
3271 } = parameters;
3272 const onComplete = useStableCallback(onCompleteParam);
3273 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false);
3274 React19.useEffect(() => {
3275 if (!enabled) {
3276 return void 0;
3277 }
3278 const abortController = new AbortController();
3279 runOnceAnimationsFinish(onComplete, abortController.signal);
3280 return () => {
3281 abortController.abort();
3282 };
3283 }, [enabled, open, onComplete, runOnceAnimationsFinish]);
3284 }
3285
3286 // node_modules/@base-ui/utils/esm/useOnFirstRender.js
3287 var React20 = __toESM(require_react(), 1);
3288 function useOnFirstRender(fn) {
3289 const ref = React20.useRef(true);
3290 if (ref.current) {
3291 ref.current = false;
3292 fn();
3293 }
3294 }
3295
3296 // node_modules/@base-ui/utils/esm/useTimeout.js
3297 var EMPTY3 = 0;
3298 var Timeout = class _Timeout {
3299 static create() {
3300 return new _Timeout();
3301 }
3302 currentId = EMPTY3;
3303 /**
3304 * Executes `fn` after `delay`, clearing any previously scheduled call.
3305 */
3306 start(delay, fn) {
3307 this.clear();
3308 this.currentId = setTimeout(() => {
3309 this.currentId = EMPTY3;
3310 fn();
3311 }, delay);
3312 }
3313 isStarted() {
3314 return this.currentId !== EMPTY3;
3315 }
3316 clear = () => {
3317 if (this.currentId !== EMPTY3) {
3318 clearTimeout(this.currentId);
3319 this.currentId = EMPTY3;
3320 }
3321 };
3322 disposeEffect = () => {
3323 return this.clear;
3324 };
3325 };
3326 function useTimeout() {
3327 const timeout = useRefWithInit(Timeout.create).current;
3328 useOnMount(timeout.disposeEffect);
3329 return timeout;
3330 }
3331
3332 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js
3333 var React21 = __toESM(require_react(), 1);
3334
3335 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js
3336 function resolveValue(value, pointerType) {
3337 if (pointerType != null && !isMouseLikePointerType(pointerType)) {
3338 return 0;
3339 }
3340 if (typeof value === "function") {
3341 return value();
3342 }
3343 return value;
3344 }
3345 function getDelay(value, prop, pointerType) {
3346 const result = resolveValue(value, pointerType);
3347 if (typeof result === "number") {
3348 return result;
3349 }
3350 return result?.[prop];
3351 }
3352 function getRestMs(value) {
3353 if (typeof value === "function") {
3354 return value();
3355 }
3356 return value;
3357 }
3358 function isClickLikeOpenEvent(openEventType, interactedInside) {
3359 return interactedInside || openEventType === "click" || openEventType === "mousedown";
3360 }
3361
3362 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js
3363 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
3364 var FloatingDelayGroupContext = /* @__PURE__ */ React21.createContext({
3365 hasProvider: false,
3366 timeoutMs: 0,
3367 delayRef: {
3368 current: 0
3369 },
3370 initialDelayRef: {
3371 current: 0
3372 },
3373 timeout: new Timeout(),
3374 currentIdRef: {
3375 current: null
3376 },
3377 currentContextRef: {
3378 current: null
3379 }
3380 });
3381 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
3382 function FloatingDelayGroup(props) {
3383 const {
3384 children,
3385 delay,
3386 timeoutMs = 0
3387 } = props;
3388 const delayRef = React21.useRef(delay);
3389 const initialDelayRef = React21.useRef(delay);
3390 const currentIdRef = React21.useRef(null);
3391 const currentContextRef = React21.useRef(null);
3392 const timeout = useTimeout();
3393 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, {
3394 value: React21.useMemo(() => ({
3395 hasProvider: true,
3396 delayRef,
3397 initialDelayRef,
3398 currentIdRef,
3399 timeoutMs,
3400 currentContextRef,
3401 timeout
3402 }), [timeoutMs, timeout]),
3403 children
3404 });
3405 }
3406 function useDelayGroup(context, options = {
3407 open: false
3408 }) {
3409 const store = "rootStore" in context ? context.rootStore : context;
3410 const floatingId = store.useState("floatingId");
3411 const {
3412 open
3413 } = options;
3414 const groupContext = React21.useContext(FloatingDelayGroupContext);
3415 const {
3416 currentIdRef,
3417 delayRef,
3418 timeoutMs,
3419 initialDelayRef,
3420 currentContextRef,
3421 hasProvider,
3422 timeout
3423 } = groupContext;
3424 const [isInstantPhase, setIsInstantPhase] = React21.useState(false);
3425 useIsoLayoutEffect(() => {
3426 function unset() {
3427 setIsInstantPhase(false);
3428 currentContextRef.current?.setIsInstantPhase(false);
3429 currentIdRef.current = null;
3430 currentContextRef.current = null;
3431 delayRef.current = initialDelayRef.current;
3432 }
3433 if (!currentIdRef.current) {
3434 return void 0;
3435 }
3436 if (!open && currentIdRef.current === floatingId) {
3437 setIsInstantPhase(false);
3438 if (timeoutMs) {
3439 const closingId = floatingId;
3440 timeout.start(timeoutMs, () => {
3441 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
3442 return;
3443 }
3444 unset();
3445 });
3446 return () => {
3447 timeout.clear();
3448 };
3449 }
3450 unset();
3451 }
3452 return void 0;
3453 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]);
3454 useIsoLayoutEffect(() => {
3455 if (!open) {
3456 return;
3457 }
3458 const prevContext = currentContextRef.current;
3459 const prevId = currentIdRef.current;
3460 timeout.clear();
3461 currentContextRef.current = {
3462 onOpenChange: store.setOpen,
3463 setIsInstantPhase
3464 };
3465 currentIdRef.current = floatingId;
3466 delayRef.current = {
3467 open: 0,
3468 close: getDelay(initialDelayRef.current, "close")
3469 };
3470 if (prevId !== null && prevId !== floatingId) {
3471 setIsInstantPhase(true);
3472 prevContext?.setIsInstantPhase(true);
3473 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
3474 } else {
3475 setIsInstantPhase(false);
3476 prevContext?.setIsInstantPhase(false);
3477 }
3478 }, [open, floatingId, store, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout]);
3479 useIsoLayoutEffect(() => {
3480 return () => {
3481 currentContextRef.current = null;
3482 };
3483 }, [currentContextRef]);
3484 return React21.useMemo(() => ({
3485 hasProvider,
3486 delayRef,
3487 isInstantPhase
3488 }), [hasProvider, delayRef, isInstantPhase]);
3489 }
3490
3491 // node_modules/@base-ui/utils/esm/mergeCleanups.js
3492 function mergeCleanups(...cleanups) {
3493 return () => {
3494 for (let i2 = 0; i2 < cleanups.length; i2 += 1) {
3495 const cleanup = cleanups[i2];
3496 if (cleanup) {
3497 cleanup();
3498 }
3499 }
3500 };
3501 }
3502
3503 // node_modules/@base-ui/utils/esm/useValueAsRef.js
3504 function useValueAsRef(value) {
3505 const latest = useRefWithInit(createLatestRef, value).current;
3506 latest.next = value;
3507 useIsoLayoutEffect(latest.effect);
3508 return latest;
3509 }
3510 function createLatestRef(value) {
3511 const latest = {
3512 current: value,
3513 next: value,
3514 effect: () => {
3515 latest.current = latest.next;
3516 }
3517 };
3518 return latest;
3519 }
3520
3521 // node_modules/@base-ui/react/esm/utils/FocusGuard.js
3522 var React22 = __toESM(require_react(), 1);
3523
3524 // node_modules/@base-ui/utils/esm/visuallyHidden.js
3525 var visuallyHiddenBase = {
3526 clipPath: "inset(50%)",
3527 overflow: "hidden",
3528 whiteSpace: "nowrap",
3529 border: 0,
3530 padding: 0,
3531 width: 1,
3532 height: 1,
3533 margin: -1
3534 };
3535 var visuallyHidden = {
3536 ...visuallyHiddenBase,
3537 position: "fixed",
3538 top: 0,
3539 left: 0
3540 };
3541 var visuallyHiddenInput = {
3542 ...visuallyHiddenBase,
3543 position: "absolute"
3544 };
3545
3546 // node_modules/@base-ui/react/esm/utils/FocusGuard.js
3547 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
3548 var FocusGuard = /* @__PURE__ */ React22.forwardRef(function FocusGuard2(props, ref) {
3549 const [role, setRole] = React22.useState();
3550 useIsoLayoutEffect(() => {
3551 if (isSafari) {
3552 setRole("button");
3553 }
3554 }, []);
3555 const restProps = {
3556 tabIndex: 0,
3557 // Role is only for VoiceOver
3558 role
3559 };
3560 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
3561 ...props,
3562 ref,
3563 style: visuallyHidden,
3564 "aria-hidden": role ? void 0 : true,
3565 ...restProps,
3566 "data-base-ui-focus-guard": ""
3567 });
3568 });
3569 if (true) FocusGuard.displayName = "FocusGuard";
3570
3571 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js
3572 function createAttribute(name) {
3573 return `data-base-ui-${name}`;
3574 }
3575
3576 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js
3577 var React23 = __toESM(require_react(), 1);
3578 var ReactDOM2 = __toESM(require_react_dom(), 1);
3579
3580 // node_modules/@base-ui/react/esm/internals/constants.js
3581 var DISABLED_TRANSITIONS_STYLE = {
3582 style: {
3583 transition: "none"
3584 }
3585 };
3586 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
3587 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
3588 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
3589 var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
3590 var POPUP_COLLISION_AVOIDANCE = {
3591 fallbackAxisSide: "end"
3592 };
3593 var ownerVisuallyHidden = {
3594 clipPath: "inset(50%)",
3595 position: "fixed",
3596 top: 0,
3597 left: 0
3598 };
3599
3600 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js
3601 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
3602 var PortalContext = /* @__PURE__ */ React23.createContext(null);
3603 if (true) PortalContext.displayName = "PortalContext";
3604 var usePortalContext = () => React23.useContext(PortalContext);
3605 var attr = createAttribute("portal");
3606 function useFloatingPortalNode(props = {}) {
3607 const {
3608 ref,
3609 container: containerProp,
3610 componentProps = EMPTY_OBJECT,
3611 elementProps
3612 } = props;
3613 const uniqueId = useId();
3614 const portalContext = usePortalContext();
3615 const parentPortalNode = portalContext?.portalNode;
3616 const [containerElement, setContainerElement] = React23.useState(null);
3617 const [portalNode, setPortalNode] = React23.useState(null);
3618 const setPortalNodeRef = useStableCallback((node) => {
3619 if (node !== null) {
3620 setPortalNode(node);
3621 }
3622 });
3623 const containerRef = React23.useRef(null);
3624 useIsoLayoutEffect(() => {
3625 if (containerProp === null) {
3626 if (containerRef.current) {
3627 containerRef.current = null;
3628 setPortalNode(null);
3629 setContainerElement(null);
3630 }
3631 return;
3632 }
3633 if (uniqueId == null) {
3634 return;
3635 }
3636 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
3637 if (resolvedContainer == null) {
3638 if (containerRef.current) {
3639 containerRef.current = null;
3640 setPortalNode(null);
3641 setContainerElement(null);
3642 }
3643 return;
3644 }
3645 if (containerRef.current !== resolvedContainer) {
3646 containerRef.current = resolvedContainer;
3647 setPortalNode(null);
3648 setContainerElement(resolvedContainer);
3649 }
3650 }, [containerProp, parentPortalNode, uniqueId]);
3651 const portalElement = useRenderElement("div", componentProps, {
3652 ref: [ref, setPortalNodeRef],
3653 props: [{
3654 id: uniqueId,
3655 [attr]: ""
3656 }, elementProps]
3657 });
3658 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
3659 return {
3660 portalNode,
3661 portalSubtree
3662 };
3663 }
3664 var FloatingPortal = /* @__PURE__ */ React23.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
3665 const {
3666 children,
3667 container,
3668 className,
3669 render: render4,
3670 renderGuards,
3671 style,
3672 ...elementProps
3673 } = componentProps;
3674 const {
3675 portalNode,
3676 portalSubtree
3677 } = useFloatingPortalNode({
3678 container,
3679 ref: forwardedRef,
3680 componentProps,
3681 elementProps
3682 });
3683 const beforeOutsideRef = React23.useRef(null);
3684 const afterOutsideRef = React23.useRef(null);
3685 const beforeInsideRef = React23.useRef(null);
3686 const afterInsideRef = React23.useRef(null);
3687 const [focusManagerState, setFocusManagerState] = React23.useState(null);
3688 const focusInsideDisabledRef = React23.useRef(false);
3689 const modal = focusManagerState?.modal;
3690 const open = focusManagerState?.open;
3691 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
3692 React23.useEffect(() => {
3693 if (!portalNode || modal) {
3694 return void 0;
3695 }
3696 function onFocus(event) {
3697 if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
3698 if (event.type === "focusin") {
3699 if (focusInsideDisabledRef.current) {
3700 enableFocusInside(portalNode);
3701 focusInsideDisabledRef.current = false;
3702 }
3703 } else {
3704 disableFocusInside(portalNode);
3705 focusInsideDisabledRef.current = true;
3706 }
3707 }
3708 }
3709 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
3710 }, [portalNode, modal]);
3711 React23.useEffect(() => {
3712 if (!portalNode || open !== false) {
3713 return;
3714 }
3715 enableFocusInside(portalNode);
3716 focusInsideDisabledRef.current = false;
3717 }, [open, portalNode]);
3718 const portalContextValue = React23.useMemo(() => ({
3719 beforeOutsideRef,
3720 afterOutsideRef,
3721 beforeInsideRef,
3722 afterInsideRef,
3723 portalNode,
3724 setFocusManagerState
3725 }), [portalNode]);
3726 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React23.Fragment, {
3727 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, {
3728 value: portalContextValue,
3729 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3730 "data-type": "outside",
3731 ref: beforeOutsideRef,
3732 onFocus: (event) => {
3733 if (isOutsideEvent(event, portalNode)) {
3734 beforeInsideRef.current?.focus();
3735 } else {
3736 const domReference = focusManagerState ? focusManagerState.domReference : null;
3737 const prevTabbable = getPreviousTabbable(domReference);
3738 prevTabbable?.focus();
3739 }
3740 }
3741 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
3742 "aria-owns": portalNode.id,
3743 style: ownerVisuallyHidden
3744 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3745 "data-type": "outside",
3746 ref: afterOutsideRef,
3747 onFocus: (event) => {
3748 if (isOutsideEvent(event, portalNode)) {
3749 afterInsideRef.current?.focus();
3750 } else {
3751 const domReference = focusManagerState ? focusManagerState.domReference : null;
3752 const nextTabbable = getNextTabbable(domReference);
3753 nextTabbable?.focus();
3754 if (focusManagerState?.closeOnFocusOut) {
3755 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
3756 }
3757 }
3758 }
3759 })]
3760 })]
3761 });
3762 });
3763 if (true) FloatingPortal.displayName = "FloatingPortal";
3764
3765 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js
3766 var React24 = __toESM(require_react(), 1);
3767
3768 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js
3769 function createEventEmitter() {
3770 const map = /* @__PURE__ */ new Map();
3771 return {
3772 emit(event, data) {
3773 map.get(event)?.forEach((listener) => listener(data));
3774 },
3775 on(event, listener) {
3776 if (!map.has(event)) {
3777 map.set(event, /* @__PURE__ */ new Set());
3778 }
3779 map.get(event).add(listener);
3780 },
3781 off(event, listener) {
3782 map.get(event)?.delete(listener);
3783 }
3784 };
3785 }
3786
3787 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js
3788 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
3789 var FloatingNodeContext = /* @__PURE__ */ React24.createContext(null);
3790 if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
3791 var FloatingTreeContext = /* @__PURE__ */ React24.createContext(null);
3792 if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
3793 var useFloatingParentNodeId = () => React24.useContext(FloatingNodeContext)?.id || null;
3794 var useFloatingTree = (externalTree) => {
3795 const contextTree = React24.useContext(FloatingTreeContext);
3796 return externalTree ?? contextTree;
3797 };
3798
3799 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js
3800 var React25 = __toESM(require_react(), 1);
3801 function createVirtualElement(domElement, data) {
3802 let offsetX = null;
3803 let offsetY = null;
3804 let isAutoUpdateEvent = false;
3805 return {
3806 contextElement: domElement || void 0,
3807 getBoundingClientRect() {
3808 const domRect = domElement?.getBoundingClientRect() || {
3809 width: 0,
3810 height: 0,
3811 x: 0,
3812 y: 0
3813 };
3814 const isXAxis = data.axis === "x" || data.axis === "both";
3815 const isYAxis = data.axis === "y" || data.axis === "both";
3816 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
3817 let width = domRect.width;
3818 let height = domRect.height;
3819 let x2 = domRect.x;
3820 let y2 = domRect.y;
3821 if (offsetX == null && data.x && isXAxis) {
3822 offsetX = domRect.x - data.x;
3823 }
3824 if (offsetY == null && data.y && isYAxis) {
3825 offsetY = domRect.y - data.y;
3826 }
3827 x2 -= offsetX || 0;
3828 y2 -= offsetY || 0;
3829 width = 0;
3830 height = 0;
3831 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
3832 width = data.axis === "y" ? domRect.width : 0;
3833 height = data.axis === "x" ? domRect.height : 0;
3834 x2 = isXAxis && data.x != null ? data.x : x2;
3835 y2 = isYAxis && data.y != null ? data.y : y2;
3836 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
3837 height = data.axis === "x" ? domRect.height : height;
3838 width = data.axis === "y" ? domRect.width : width;
3839 }
3840 isAutoUpdateEvent = true;
3841 return {
3842 width,
3843 height,
3844 x: x2,
3845 y: y2,
3846 top: y2,
3847 right: x2 + width,
3848 bottom: y2 + height,
3849 left: x2
3850 };
3851 }
3852 };
3853 }
3854 function isMouseBasedEvent(event) {
3855 return event != null && event.clientX != null;
3856 }
3857 function useClientPoint(context, props = {}) {
3858 const store = "rootStore" in context ? context.rootStore : context;
3859 const open = store.useState("open");
3860 const floating = store.useState("floatingElement");
3861 const domReference = store.useState("domReferenceElement");
3862 const dataRef = store.context.dataRef;
3863 const {
3864 enabled = true,
3865 axis = "both"
3866 } = props;
3867 const initialRef = React25.useRef(false);
3868 const cleanupListenerRef = React25.useRef(null);
3869 const [pointerType, setPointerType] = React25.useState();
3870 const [reactive, setReactive] = React25.useState([]);
3871 const setReference = useStableCallback((newX, newY, referenceElement) => {
3872 if (initialRef.current) {
3873 return;
3874 }
3875 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
3876 return;
3877 }
3878 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
3879 x: newX,
3880 y: newY,
3881 axis,
3882 dataRef,
3883 pointerType
3884 }));
3885 });
3886 const handleReferenceEnterOrMove = useStableCallback((event) => {
3887 if (!open) {
3888 setReference(event.clientX, event.clientY, event.currentTarget);
3889 } else if (!cleanupListenerRef.current) {
3890 setReactive([]);
3891 }
3892 });
3893 const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
3894 const addListener = React25.useCallback(() => {
3895 if (!openCheck || !enabled) {
3896 return void 0;
3897 }
3898 const win = getWindow(floating);
3899 function handleMouseMove(event) {
3900 const target = getTarget(event);
3901 if (!contains(floating, target)) {
3902 setReference(event.clientX, event.clientY);
3903 } else {
3904 cleanupListenerRef.current?.();
3905 cleanupListenerRef.current = null;
3906 }
3907 }
3908 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
3909 const cleanup = () => {
3910 cleanupListenerRef.current?.();
3911 cleanupListenerRef.current = null;
3912 };
3913 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
3914 return cleanup;
3915 }
3916 store.set("positionReference", domReference);
3917 return void 0;
3918 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference]);
3919 React25.useEffect(() => {
3920 return addListener();
3921 }, [addListener, reactive]);
3922 React25.useEffect(() => {
3923 if (enabled && !floating) {
3924 initialRef.current = false;
3925 }
3926 }, [enabled, floating]);
3927 React25.useEffect(() => {
3928 if (!enabled && open) {
3929 initialRef.current = true;
3930 }
3931 }, [enabled, open]);
3932 const reference = React25.useMemo(() => {
3933 function setPointerTypeRef(event) {
3934 setPointerType(event.pointerType);
3935 }
3936 return {
3937 onPointerDown: setPointerTypeRef,
3938 onPointerEnter: setPointerTypeRef,
3939 onMouseMove: handleReferenceEnterOrMove,
3940 onMouseEnter: handleReferenceEnterOrMove
3941 };
3942 }, [handleReferenceEnterOrMove]);
3943 return React25.useMemo(() => enabled ? {
3944 reference,
3945 trigger: reference
3946 } : {}, [enabled, reference]);
3947 }
3948
3949 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js
3950 var React26 = __toESM(require_react(), 1);
3951 var bubbleHandlerKeys = {
3952 intentional: "onClick",
3953 sloppy: "onPointerDown"
3954 };
3955 function alwaysFalse() {
3956 return false;
3957 }
3958 function normalizeProp(normalizable) {
3959 return {
3960 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
3961 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
3962 };
3963 }
3964 function useDismiss(context, props = {}) {
3965 const store = "rootStore" in context ? context.rootStore : context;
3966 const open = store.useState("open");
3967 const floatingElement = store.useState("floatingElement");
3968 const {
3969 dataRef
3970 } = store.context;
3971 const {
3972 enabled = true,
3973 escapeKey: escapeKey2 = true,
3974 outsidePress: outsidePressProp = true,
3975 outsidePressEvent = "sloppy",
3976 referencePress = alwaysFalse,
3977 referencePressEvent = "sloppy",
3978 bubbles,
3979 externalTree
3980 } = props;
3981 const tree = useFloatingTree(externalTree);
3982 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
3983 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
3984 const outsidePressEnabled = outsidePress2 !== false;
3985 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
3986 const pressStartedInsideRef = React26.useRef(false);
3987 const pressStartPreventedRef = React26.useRef(false);
3988 const suppressNextOutsideClickRef = React26.useRef(false);
3989 const {
3990 escapeKey: escapeKeyBubbles,
3991 outsidePress: outsidePressBubbles
3992 } = normalizeProp(bubbles);
3993 const touchStateRef = React26.useRef(null);
3994 const cancelDismissOnEndTimeout = useTimeout();
3995 const clearInsideReactTreeTimeout = useTimeout();
3996 const clearInsideReactTree = useStableCallback(() => {
3997 clearInsideReactTreeTimeout.clear();
3998 dataRef.current.insideReactTree = false;
3999 });
4000 const isComposingRef = React26.useRef(false);
4001 const currentPointerTypeRef = React26.useRef("");
4002 const isReferencePressEnabled = useStableCallback(referencePress);
4003 const closeOnEscapeKeyDown = useStableCallback((event) => {
4004 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") {
4005 return;
4006 }
4007 if (isComposingRef.current) {
4008 return;
4009 }
4010 const nodeId = dataRef.current.floatingContext?.nodeId;
4011 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
4012 if (!escapeKeyBubbles) {
4013 if (children.length > 0) {
4014 let shouldDismiss = true;
4015 children.forEach((child) => {
4016 if (child.context?.open && !child.context.dataRef.current.__escapeKeyBubbles) {
4017 shouldDismiss = false;
4018 }
4019 });
4020 if (!shouldDismiss) {
4021 return;
4022 }
4023 }
4024 }
4025 const native = isReactEvent(event) ? event.nativeEvent : event;
4026 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
4027 store.setOpen(false, eventDetails);
4028 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
4029 event.stopPropagation();
4030 }
4031 });
4032 const markInsideReactTree = useStableCallback(() => {
4033 dataRef.current.insideReactTree = true;
4034 clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
4035 });
4036 React26.useEffect(() => {
4037 if (!open || !enabled) {
4038 return void 0;
4039 }
4040 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
4041 dataRef.current.__outsidePressBubbles = outsidePressBubbles;
4042 const compositionTimeout = new Timeout();
4043 const preventedPressSuppressionTimeout = new Timeout();
4044 function handleCompositionStart() {
4045 compositionTimeout.clear();
4046 isComposingRef.current = true;
4047 }
4048 function handleCompositionEnd() {
4049 compositionTimeout.start(
4050 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
4051 // Only apply to WebKit for the test to remain 0ms.
4052 isWebKit() ? 5 : 0,
4053 () => {
4054 isComposingRef.current = false;
4055 }
4056 );
4057 }
4058 function suppressImmediateOutsideClickAfterPreventedStart() {
4059 suppressNextOutsideClickRef.current = true;
4060 preventedPressSuppressionTimeout.start(0, () => {
4061 suppressNextOutsideClickRef.current = false;
4062 });
4063 }
4064 function resetPressStartState() {
4065 pressStartedInsideRef.current = false;
4066 pressStartPreventedRef.current = false;
4067 }
4068 function getOutsidePressEvent() {
4069 const type = currentPointerTypeRef.current;
4070 const computedType = type === "pen" || !type ? "mouse" : type;
4071 const outsidePressEventValue = getOutsidePressEventProp();
4072 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
4073 if (typeof resolved === "string") {
4074 return resolved;
4075 }
4076 return resolved[computedType];
4077 }
4078 function shouldIgnoreEvent(event) {
4079 const computedOutsidePressEvent = getOutsidePressEvent();
4080 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
4081 }
4082 function isEventWithinFloatingTree(event) {
4083 const nodeId = dataRef.current.floatingContext?.nodeId;
4084 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
4085 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")) || targetIsInsideChildren;
4086 }
4087 function closeOnPressOutside(event) {
4088 if (shouldIgnoreEvent(event)) {
4089 clearInsideReactTree();
4090 return;
4091 }
4092 if (dataRef.current.insideReactTree) {
4093 clearInsideReactTree();
4094 return;
4095 }
4096 const target = getTarget(event);
4097 const inertSelector = `[${createAttribute("inert")}]`;
4098 const targetRoot = isElement(target) ? target.getRootNode() : null;
4099 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector));
4100 const triggers = store.context.triggerElements;
4101 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
4102 return;
4103 }
4104 let targetRootAncestor = isElement(target) ? target : null;
4105 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
4106 const nextParent = getParentNode(targetRootAncestor);
4107 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
4108 break;
4109 }
4110 targetRootAncestor = nextParent;
4111 }
4112 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
4113 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the
4114 // element was injected after the floating element rendered.
4115 markers.every((marker) => !contains(targetRootAncestor, marker))) {
4116 return;
4117 }
4118 if (isHTMLElement(target) && !("touches" in event)) {
4119 const lastTraversableNode = isLastTraversableNode(target);
4120 const style = getComputedStyle2(target);
4121 const scrollRe = /auto|scroll/;
4122 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
4123 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
4124 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
4125 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
4126 const isRTL7 = style.direction === "rtl";
4127 const pressedVerticalScrollbar = canScrollY && (isRTL7 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
4128 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
4129 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
4130 return;
4131 }
4132 }
4133 if (isEventWithinFloatingTree(event)) {
4134 return;
4135 }
4136 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) {
4137 preventedPressSuppressionTimeout.clear();
4138 suppressNextOutsideClickRef.current = false;
4139 return;
4140 }
4141 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
4142 return;
4143 }
4144 const nodeId = dataRef.current.floatingContext?.nodeId;
4145 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
4146 if (children.length > 0) {
4147 let shouldDismiss = true;
4148 children.forEach((child) => {
4149 if (child.context?.open && !child.context.dataRef.current.__outsidePressBubbles) {
4150 shouldDismiss = false;
4151 }
4152 });
4153 if (!shouldDismiss) {
4154 return;
4155 }
4156 }
4157 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
4158 clearInsideReactTree();
4159 }
4160 function handlePointerDown(event) {
4161 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) {
4162 return;
4163 }
4164 closeOnPressOutside(event);
4165 }
4166 function handleTouchStart(event) {
4167 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) {
4168 return;
4169 }
4170 const touch = event.touches[0];
4171 if (touch) {
4172 touchStateRef.current = {
4173 startTime: Date.now(),
4174 startX: touch.clientX,
4175 startY: touch.clientY,
4176 dismissOnTouchEnd: false,
4177 dismissOnMouseDown: true
4178 };
4179 cancelDismissOnEndTimeout.start(1e3, () => {
4180 if (touchStateRef.current) {
4181 touchStateRef.current.dismissOnTouchEnd = false;
4182 touchStateRef.current.dismissOnMouseDown = false;
4183 }
4184 });
4185 }
4186 }
4187 function addTargetEventListenerOnce(event, listener) {
4188 const target = getTarget(event);
4189 if (!target) {
4190 return;
4191 }
4192 const unsubscribe2 = addEventListener(target, event.type, () => {
4193 listener(event);
4194 unsubscribe2();
4195 });
4196 }
4197 function handleTouchStartCapture(event) {
4198 currentPointerTypeRef.current = "touch";
4199 addTargetEventListenerOnce(event, handleTouchStart);
4200 }
4201 function closeOnPressOutsideCapture(event) {
4202 cancelDismissOnEndTimeout.clear();
4203 if (event.type === "pointerdown") {
4204 currentPointerTypeRef.current = event.pointerType;
4205 }
4206 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
4207 return;
4208 }
4209 addTargetEventListenerOnce(event, (targetEvent) => {
4210 if (targetEvent.type === "pointerdown") {
4211 handlePointerDown(targetEvent);
4212 } else {
4213 closeOnPressOutside(targetEvent);
4214 }
4215 });
4216 }
4217 function handlePressEndCapture(event) {
4218 if (!pressStartedInsideRef.current) {
4219 return;
4220 }
4221 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
4222 resetPressStartState();
4223 if (getOutsidePressEvent() !== "intentional") {
4224 return;
4225 }
4226 if (event.type === "pointercancel") {
4227 if (pressStartedInsideDefaultPrevented) {
4228 suppressImmediateOutsideClickAfterPreventedStart();
4229 }
4230 return;
4231 }
4232 if (isEventWithinFloatingTree(event)) {
4233 return;
4234 }
4235 if (pressStartedInsideDefaultPrevented) {
4236 suppressImmediateOutsideClickAfterPreventedStart();
4237 return;
4238 }
4239 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
4240 return;
4241 }
4242 preventedPressSuppressionTimeout.clear();
4243 suppressNextOutsideClickRef.current = true;
4244 clearInsideReactTree();
4245 }
4246 function handleTouchMove(event) {
4247 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) {
4248 return;
4249 }
4250 const touch = event.touches[0];
4251 if (!touch) {
4252 return;
4253 }
4254 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
4255 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
4256 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
4257 if (distance > 5) {
4258 touchStateRef.current.dismissOnTouchEnd = true;
4259 }
4260 if (distance > 10) {
4261 closeOnPressOutside(event);
4262 cancelDismissOnEndTimeout.clear();
4263 touchStateRef.current = null;
4264 }
4265 }
4266 function handleTouchMoveCapture(event) {
4267 addTargetEventListenerOnce(event, handleTouchMove);
4268 }
4269 function handleTouchEnd(event) {
4270 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) {
4271 return;
4272 }
4273 if (touchStateRef.current.dismissOnTouchEnd) {
4274 closeOnPressOutside(event);
4275 }
4276 cancelDismissOnEndTimeout.clear();
4277 touchStateRef.current = null;
4278 }
4279 function handleTouchEndCapture(event) {
4280 addTargetEventListenerOnce(event, handleTouchEnd);
4281 }
4282 const doc = ownerDocument(floatingElement);
4283 const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true)));
4284 return () => {
4285 unsubscribe();
4286 compositionTimeout.clear();
4287 preventedPressSuppressionTimeout.clear();
4288 resetPressStartState();
4289 suppressNextOutsideClickRef.current = false;
4290 };
4291 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, tree, store, cancelDismissOnEndTimeout]);
4292 React26.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]);
4293 const reference = React26.useMemo(() => ({
4294 onKeyDown: closeOnEscapeKeyDown,
4295 [bubbleHandlerKeys[referencePressEvent]]: (event) => {
4296 if (!isReferencePressEnabled()) {
4297 return;
4298 }
4299 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
4300 },
4301 ...referencePressEvent !== "intentional" && {
4302 onClick(event) {
4303 if (!isReferencePressEnabled()) {
4304 return;
4305 }
4306 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
4307 }
4308 }
4309 }), [closeOnEscapeKeyDown, store, referencePressEvent, isReferencePressEnabled]);
4310 const markPressStartedInsideReactTree = useStableCallback((event) => {
4311 if (!open || !enabled || event.button !== 0) {
4312 return;
4313 }
4314 const target = getTarget(event.nativeEvent);
4315 if (!contains(store.select("floatingElement"), target)) {
4316 return;
4317 }
4318 if (!pressStartedInsideRef.current) {
4319 pressStartedInsideRef.current = true;
4320 pressStartPreventedRef.current = false;
4321 }
4322 });
4323 const markInsidePressStartPrevented = useStableCallback((event) => {
4324 if (!open || !enabled) {
4325 return;
4326 }
4327 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
4328 return;
4329 }
4330 if (pressStartedInsideRef.current) {
4331 pressStartPreventedRef.current = true;
4332 }
4333 });
4334 const floating = React26.useMemo(() => ({
4335 onKeyDown: closeOnEscapeKeyDown,
4336 // `onMouseDown` may be blocked if `event.preventDefault()` is called in
4337 // `onPointerDown`, such as with <NumberField.ScrubArea>.
4338 // See https://github.com/mui/base-ui/pull/3379
4339 onPointerDown: markInsidePressStartPrevented,
4340 onMouseDown: markInsidePressStartPrevented,
4341 onClickCapture: markInsideReactTree,
4342 onMouseDownCapture(event) {
4343 markInsideReactTree();
4344 markPressStartedInsideReactTree(event);
4345 },
4346 onPointerDownCapture(event) {
4347 markInsideReactTree();
4348 markPressStartedInsideReactTree(event);
4349 },
4350 onMouseUpCapture: markInsideReactTree,
4351 onTouchEndCapture: markInsideReactTree,
4352 onTouchMoveCapture: markInsideReactTree
4353 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
4354 return React26.useMemo(() => enabled ? {
4355 reference,
4356 floating,
4357 trigger: reference
4358 } : {}, [enabled, reference, floating]);
4359 }
4360
4361 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js
4362 var React32 = __toESM(require_react(), 1);
4363
4364 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
4365 function computeCoordsFromPlacement(_ref, placement, rtl) {
4366 let {
4367 reference,
4368 floating
4369 } = _ref;
4370 const sideAxis = getSideAxis(placement);
4371 const alignmentAxis = getAlignmentAxis(placement);
4372 const alignLength = getAxisLength(alignmentAxis);
4373 const side = getSide(placement);
4374 const isVertical = sideAxis === "y";
4375 const commonX = reference.x + reference.width / 2 - floating.width / 2;
4376 const commonY = reference.y + reference.height / 2 - floating.height / 2;
4377 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
4378 let coords;
4379 switch (side) {
4380 case "top":
4381 coords = {
4382 x: commonX,
4383 y: reference.y - floating.height
4384 };
4385 break;
4386 case "bottom":
4387 coords = {
4388 x: commonX,
4389 y: reference.y + reference.height
4390 };
4391 break;
4392 case "right":
4393 coords = {
4394 x: reference.x + reference.width,
4395 y: commonY
4396 };
4397 break;
4398 case "left":
4399 coords = {
4400 x: reference.x - floating.width,
4401 y: commonY
4402 };
4403 break;
4404 default:
4405 coords = {
4406 x: reference.x,
4407 y: reference.y
4408 };
4409 }
4410 switch (getAlignment(placement)) {
4411 case "start":
4412 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
4413 break;
4414 case "end":
4415 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
4416 break;
4417 }
4418 return coords;
4419 }
4420 async function detectOverflow(state, options) {
4421 var _await$platform$isEle;
4422 if (options === void 0) {
4423 options = {};
4424 }
4425 const {
4426 x: x2,
4427 y: y2,
4428 platform: platform3,
4429 rects,
4430 elements,
4431 strategy
4432 } = state;
4433 const {
4434 boundary = "clippingAncestors",
4435 rootBoundary = "viewport",
4436 elementContext = "floating",
4437 altBoundary = false,
4438 padding = 0
4439 } = evaluate(options, state);
4440 const paddingObject = getPaddingObject(padding);
4441 const altContext = elementContext === "floating" ? "reference" : "floating";
4442 const element = elements[altBoundary ? altContext : elementContext];
4443 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
4444 element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)),
4445 boundary,
4446 rootBoundary,
4447 strategy
4448 }));
4449 const rect = elementContext === "floating" ? {
4450 x: x2,
4451 y: y2,
4452 width: rects.floating.width,
4453 height: rects.floating.height
4454 } : rects.reference;
4455 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
4456 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
4457 x: 1,
4458 y: 1
4459 } : {
4460 x: 1,
4461 y: 1
4462 };
4463 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
4464 elements,
4465 rect,
4466 offsetParent,
4467 strategy
4468 }) : rect);
4469 return {
4470 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
4471 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
4472 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
4473 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
4474 };
4475 }
4476 var MAX_RESET_COUNT = 50;
4477 var computePosition = async (reference, floating, config) => {
4478 const {
4479 placement = "bottom",
4480 strategy = "absolute",
4481 middleware = [],
4482 platform: platform3
4483 } = config;
4484 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
4485 ...platform3,
4486 detectOverflow
4487 };
4488 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
4489 let rects = await platform3.getElementRects({
4490 reference,
4491 floating,
4492 strategy
4493 });
4494 let {
4495 x: x2,
4496 y: y2
4497 } = computeCoordsFromPlacement(rects, placement, rtl);
4498 let statefulPlacement = placement;
4499 let resetCount = 0;
4500 const middlewareData = {};
4501 for (let i2 = 0; i2 < middleware.length; i2++) {
4502 const currentMiddleware = middleware[i2];
4503 if (!currentMiddleware) {
4504 continue;
4505 }
4506 const {
4507 name,
4508 fn
4509 } = currentMiddleware;
4510 const {
4511 x: nextX,
4512 y: nextY,
4513 data,
4514 reset
4515 } = await fn({
4516 x: x2,
4517 y: y2,
4518 initialPlacement: placement,
4519 placement: statefulPlacement,
4520 strategy,
4521 middlewareData,
4522 rects,
4523 platform: platformWithDetectOverflow,
4524 elements: {
4525 reference,
4526 floating
4527 }
4528 });
4529 x2 = nextX != null ? nextX : x2;
4530 y2 = nextY != null ? nextY : y2;
4531 middlewareData[name] = {
4532 ...middlewareData[name],
4533 ...data
4534 };
4535 if (reset && resetCount < MAX_RESET_COUNT) {
4536 resetCount++;
4537 if (typeof reset === "object") {
4538 if (reset.placement) {
4539 statefulPlacement = reset.placement;
4540 }
4541 if (reset.rects) {
4542 rects = reset.rects === true ? await platform3.getElementRects({
4543 reference,
4544 floating,
4545 strategy
4546 }) : reset.rects;
4547 }
4548 ({
4549 x: x2,
4550 y: y2
4551 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
4552 }
4553 i2 = -1;
4554 }
4555 }
4556 return {
4557 x: x2,
4558 y: y2,
4559 placement: statefulPlacement,
4560 strategy,
4561 middlewareData
4562 };
4563 };
4564 var flip = function(options) {
4565 if (options === void 0) {
4566 options = {};
4567 }
4568 return {
4569 name: "flip",
4570 options,
4571 async fn(state) {
4572 var _middlewareData$arrow, _middlewareData$flip;
4573 const {
4574 placement,
4575 middlewareData,
4576 rects,
4577 initialPlacement,
4578 platform: platform3,
4579 elements
4580 } = state;
4581 const {
4582 mainAxis: checkMainAxis = true,
4583 crossAxis: checkCrossAxis = true,
4584 fallbackPlacements: specifiedFallbackPlacements,
4585 fallbackStrategy = "bestFit",
4586 fallbackAxisSideDirection = "none",
4587 flipAlignment = true,
4588 ...detectOverflowOptions
4589 } = evaluate(options, state);
4590 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4591 return {};
4592 }
4593 const side = getSide(placement);
4594 const initialSideAxis = getSideAxis(initialPlacement);
4595 const isBasePlacement = getSide(initialPlacement) === initialPlacement;
4596 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4597 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
4598 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
4599 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
4600 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
4601 }
4602 const placements2 = [initialPlacement, ...fallbackPlacements];
4603 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4604 const overflows = [];
4605 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
4606 if (checkMainAxis) {
4607 overflows.push(overflow[side]);
4608 }
4609 if (checkCrossAxis) {
4610 const sides2 = getAlignmentSides(placement, rects, rtl);
4611 overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
4612 }
4613 overflowsData = [...overflowsData, {
4614 placement,
4615 overflows
4616 }];
4617 if (!overflows.every((side2) => side2 <= 0)) {
4618 var _middlewareData$flip2, _overflowsData$filter;
4619 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
4620 const nextPlacement = placements2[nextIndex];
4621 if (nextPlacement) {
4622 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
4623 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
4624 // overflows the main axis.
4625 overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) {
4626 return {
4627 data: {
4628 index: nextIndex,
4629 overflows: overflowsData
4630 },
4631 reset: {
4632 placement: nextPlacement
4633 }
4634 };
4635 }
4636 }
4637 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
4638 if (!resetPlacement) {
4639 switch (fallbackStrategy) {
4640 case "bestFit": {
4641 var _overflowsData$filter2;
4642 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
4643 if (hasFallbackAxisSideDirection) {
4644 const currentSideAxis = getSideAxis(d2.placement);
4645 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
4646 // reading directions favoring greater width.
4647 currentSideAxis === "y";
4648 }
4649 return true;
4650 }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
4651 if (placement2) {
4652 resetPlacement = placement2;
4653 }
4654 break;
4655 }
4656 case "initialPlacement":
4657 resetPlacement = initialPlacement;
4658 break;
4659 }
4660 }
4661 if (placement !== resetPlacement) {
4662 return {
4663 reset: {
4664 placement: resetPlacement
4665 }
4666 };
4667 }
4668 }
4669 return {};
4670 }
4671 };
4672 };
4673 function getSideOffsets(overflow, rect) {
4674 return {
4675 top: overflow.top - rect.height,
4676 right: overflow.right - rect.width,
4677 bottom: overflow.bottom - rect.height,
4678 left: overflow.left - rect.width
4679 };
4680 }
4681 function isAnySideFullyClipped(overflow) {
4682 return sides.some((side) => overflow[side] >= 0);
4683 }
4684 var hide = function(options) {
4685 if (options === void 0) {
4686 options = {};
4687 }
4688 return {
4689 name: "hide",
4690 options,
4691 async fn(state) {
4692 const {
4693 rects,
4694 platform: platform3
4695 } = state;
4696 const {
4697 strategy = "referenceHidden",
4698 ...detectOverflowOptions
4699 } = evaluate(options, state);
4700 switch (strategy) {
4701 case "referenceHidden": {
4702 const overflow = await platform3.detectOverflow(state, {
4703 ...detectOverflowOptions,
4704 elementContext: "reference"
4705 });
4706 const offsets = getSideOffsets(overflow, rects.reference);
4707 return {
4708 data: {
4709 referenceHiddenOffsets: offsets,
4710 referenceHidden: isAnySideFullyClipped(offsets)
4711 }
4712 };
4713 }
4714 case "escaped": {
4715 const overflow = await platform3.detectOverflow(state, {
4716 ...detectOverflowOptions,
4717 altBoundary: true
4718 });
4719 const offsets = getSideOffsets(overflow, rects.floating);
4720 return {
4721 data: {
4722 escapedOffsets: offsets,
4723 escaped: isAnySideFullyClipped(offsets)
4724 }
4725 };
4726 }
4727 default: {
4728 return {};
4729 }
4730 }
4731 }
4732 };
4733 };
4734 var originSides = /* @__PURE__ */ new Set(["left", "top"]);
4735 async function convertValueToCoords(state, options) {
4736 const {
4737 placement,
4738 platform: platform3,
4739 elements
4740 } = state;
4741 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4742 const side = getSide(placement);
4743 const alignment = getAlignment(placement);
4744 const isVertical = getSideAxis(placement) === "y";
4745 const mainAxisMulti = originSides.has(side) ? -1 : 1;
4746 const crossAxisMulti = rtl && isVertical ? -1 : 1;
4747 const rawValue = evaluate(options, state);
4748 let {
4749 mainAxis,
4750 crossAxis,
4751 alignmentAxis
4752 } = typeof rawValue === "number" ? {
4753 mainAxis: rawValue,
4754 crossAxis: 0,
4755 alignmentAxis: null
4756 } : {
4757 mainAxis: rawValue.mainAxis || 0,
4758 crossAxis: rawValue.crossAxis || 0,
4759 alignmentAxis: rawValue.alignmentAxis
4760 };
4761 if (alignment && typeof alignmentAxis === "number") {
4762 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
4763 }
4764 return isVertical ? {
4765 x: crossAxis * crossAxisMulti,
4766 y: mainAxis * mainAxisMulti
4767 } : {
4768 x: mainAxis * mainAxisMulti,
4769 y: crossAxis * crossAxisMulti
4770 };
4771 }
4772 var offset = function(options) {
4773 if (options === void 0) {
4774 options = 0;
4775 }
4776 return {
4777 name: "offset",
4778 options,
4779 async fn(state) {
4780 var _middlewareData$offse, _middlewareData$arrow;
4781 const {
4782 x: x2,
4783 y: y2,
4784 placement,
4785 middlewareData
4786 } = state;
4787 const diffCoords = await convertValueToCoords(state, options);
4788 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4789 return {};
4790 }
4791 return {
4792 x: x2 + diffCoords.x,
4793 y: y2 + diffCoords.y,
4794 data: {
4795 ...diffCoords,
4796 placement
4797 }
4798 };
4799 }
4800 };
4801 };
4802 var shift = function(options) {
4803 if (options === void 0) {
4804 options = {};
4805 }
4806 return {
4807 name: "shift",
4808 options,
4809 async fn(state) {
4810 const {
4811 x: x2,
4812 y: y2,
4813 placement,
4814 platform: platform3
4815 } = state;
4816 const {
4817 mainAxis: checkMainAxis = true,
4818 crossAxis: checkCrossAxis = false,
4819 limiter = {
4820 fn: (_ref) => {
4821 let {
4822 x: x3,
4823 y: y3
4824 } = _ref;
4825 return {
4826 x: x3,
4827 y: y3
4828 };
4829 }
4830 },
4831 ...detectOverflowOptions
4832 } = evaluate(options, state);
4833 const coords = {
4834 x: x2,
4835 y: y2
4836 };
4837 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4838 const crossAxis = getSideAxis(getSide(placement));
4839 const mainAxis = getOppositeAxis(crossAxis);
4840 let mainAxisCoord = coords[mainAxis];
4841 let crossAxisCoord = coords[crossAxis];
4842 if (checkMainAxis) {
4843 const minSide = mainAxis === "y" ? "top" : "left";
4844 const maxSide = mainAxis === "y" ? "bottom" : "right";
4845 const min2 = mainAxisCoord + overflow[minSide];
4846 const max2 = mainAxisCoord - overflow[maxSide];
4847 mainAxisCoord = clamp(min2, mainAxisCoord, max2);
4848 }
4849 if (checkCrossAxis) {
4850 const minSide = crossAxis === "y" ? "top" : "left";
4851 const maxSide = crossAxis === "y" ? "bottom" : "right";
4852 const min2 = crossAxisCoord + overflow[minSide];
4853 const max2 = crossAxisCoord - overflow[maxSide];
4854 crossAxisCoord = clamp(min2, crossAxisCoord, max2);
4855 }
4856 const limitedCoords = limiter.fn({
4857 ...state,
4858 [mainAxis]: mainAxisCoord,
4859 [crossAxis]: crossAxisCoord
4860 });
4861 return {
4862 ...limitedCoords,
4863 data: {
4864 x: limitedCoords.x - x2,
4865 y: limitedCoords.y - y2,
4866 enabled: {
4867 [mainAxis]: checkMainAxis,
4868 [crossAxis]: checkCrossAxis
4869 }
4870 }
4871 };
4872 }
4873 };
4874 };
4875 var limitShift = function(options) {
4876 if (options === void 0) {
4877 options = {};
4878 }
4879 return {
4880 options,
4881 fn(state) {
4882 const {
4883 x: x2,
4884 y: y2,
4885 placement,
4886 rects,
4887 middlewareData
4888 } = state;
4889 const {
4890 offset: offset4 = 0,
4891 mainAxis: checkMainAxis = true,
4892 crossAxis: checkCrossAxis = true
4893 } = evaluate(options, state);
4894 const coords = {
4895 x: x2,
4896 y: y2
4897 };
4898 const crossAxis = getSideAxis(placement);
4899 const mainAxis = getOppositeAxis(crossAxis);
4900 let mainAxisCoord = coords[mainAxis];
4901 let crossAxisCoord = coords[crossAxis];
4902 const rawOffset = evaluate(offset4, state);
4903 const computedOffset = typeof rawOffset === "number" ? {
4904 mainAxis: rawOffset,
4905 crossAxis: 0
4906 } : {
4907 mainAxis: 0,
4908 crossAxis: 0,
4909 ...rawOffset
4910 };
4911 if (checkMainAxis) {
4912 const len = mainAxis === "y" ? "height" : "width";
4913 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
4914 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
4915 if (mainAxisCoord < limitMin) {
4916 mainAxisCoord = limitMin;
4917 } else if (mainAxisCoord > limitMax) {
4918 mainAxisCoord = limitMax;
4919 }
4920 }
4921 if (checkCrossAxis) {
4922 var _middlewareData$offse, _middlewareData$offse2;
4923 const len = mainAxis === "y" ? "width" : "height";
4924 const isOriginSide = originSides.has(getSide(placement));
4925 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
4926 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
4927 if (crossAxisCoord < limitMin) {
4928 crossAxisCoord = limitMin;
4929 } else if (crossAxisCoord > limitMax) {
4930 crossAxisCoord = limitMax;
4931 }
4932 }
4933 return {
4934 [mainAxis]: mainAxisCoord,
4935 [crossAxis]: crossAxisCoord
4936 };
4937 }
4938 };
4939 };
4940 var size = function(options) {
4941 if (options === void 0) {
4942 options = {};
4943 }
4944 return {
4945 name: "size",
4946 options,
4947 async fn(state) {
4948 var _state$middlewareData, _state$middlewareData2;
4949 const {
4950 placement,
4951 rects,
4952 platform: platform3,
4953 elements
4954 } = state;
4955 const {
4956 apply = () => {
4957 },
4958 ...detectOverflowOptions
4959 } = evaluate(options, state);
4960 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4961 const side = getSide(placement);
4962 const alignment = getAlignment(placement);
4963 const isYAxis = getSideAxis(placement) === "y";
4964 const {
4965 width,
4966 height
4967 } = rects.floating;
4968 let heightSide;
4969 let widthSide;
4970 if (side === "top" || side === "bottom") {
4971 heightSide = side;
4972 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
4973 } else {
4974 widthSide = side;
4975 heightSide = alignment === "end" ? "top" : "bottom";
4976 }
4977 const maximumClippingHeight = height - overflow.top - overflow.bottom;
4978 const maximumClippingWidth = width - overflow.left - overflow.right;
4979 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
4980 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
4981 const noShift = !state.middlewareData.shift;
4982 let availableHeight = overflowAvailableHeight;
4983 let availableWidth = overflowAvailableWidth;
4984 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
4985 availableWidth = maximumClippingWidth;
4986 }
4987 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
4988 availableHeight = maximumClippingHeight;
4989 }
4990 if (noShift && !alignment) {
4991 const xMin = max(overflow.left, 0);
4992 const xMax = max(overflow.right, 0);
4993 const yMin = max(overflow.top, 0);
4994 const yMax = max(overflow.bottom, 0);
4995 if (isYAxis) {
4996 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
4997 } else {
4998 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
4999 }
5000 }
5001 await apply({
5002 ...state,
5003 availableWidth,
5004 availableHeight
5005 });
5006 const nextDimensions = await platform3.getDimensions(elements.floating);
5007 if (width !== nextDimensions.width || height !== nextDimensions.height) {
5008 return {
5009 reset: {
5010 rects: true
5011 }
5012 };
5013 }
5014 return {};
5015 }
5016 };
5017 };
5018
5019 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
5020 function getCssDimensions(element) {
5021 const css = getComputedStyle2(element);
5022 let width = parseFloat(css.width) || 0;
5023 let height = parseFloat(css.height) || 0;
5024 const hasOffset = isHTMLElement(element);
5025 const offsetWidth = hasOffset ? element.offsetWidth : width;
5026 const offsetHeight = hasOffset ? element.offsetHeight : height;
5027 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
5028 if (shouldFallback) {
5029 width = offsetWidth;
5030 height = offsetHeight;
5031 }
5032 return {
5033 width,
5034 height,
5035 $: shouldFallback
5036 };
5037 }
5038 function unwrapElement(element) {
5039 return !isElement(element) ? element.contextElement : element;
5040 }
5041 function getScale(element) {
5042 const domElement = unwrapElement(element);
5043 if (!isHTMLElement(domElement)) {
5044 return createCoords(1);
5045 }
5046 const rect = domElement.getBoundingClientRect();
5047 const {
5048 width,
5049 height,
5050 $: $2
5051 } = getCssDimensions(domElement);
5052 let x2 = ($2 ? round(rect.width) : rect.width) / width;
5053 let y2 = ($2 ? round(rect.height) : rect.height) / height;
5054 if (!x2 || !Number.isFinite(x2)) {
5055 x2 = 1;
5056 }
5057 if (!y2 || !Number.isFinite(y2)) {
5058 y2 = 1;
5059 }
5060 return {
5061 x: x2,
5062 y: y2
5063 };
5064 }
5065 var noOffsets = /* @__PURE__ */ createCoords(0);
5066 function getVisualOffsets(element) {
5067 const win = getWindow(element);
5068 if (!isWebKit() || !win.visualViewport) {
5069 return noOffsets;
5070 }
5071 return {
5072 x: win.visualViewport.offsetLeft,
5073 y: win.visualViewport.offsetTop
5074 };
5075 }
5076 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
5077 if (isFixed === void 0) {
5078 isFixed = false;
5079 }
5080 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
5081 return false;
5082 }
5083 return isFixed;
5084 }
5085 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
5086 if (includeScale === void 0) {
5087 includeScale = false;
5088 }
5089 if (isFixedStrategy === void 0) {
5090 isFixedStrategy = false;
5091 }
5092 const clientRect = element.getBoundingClientRect();
5093 const domElement = unwrapElement(element);
5094 let scale = createCoords(1);
5095 if (includeScale) {
5096 if (offsetParent) {
5097 if (isElement(offsetParent)) {
5098 scale = getScale(offsetParent);
5099 }
5100 } else {
5101 scale = getScale(element);
5102 }
5103 }
5104 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
5105 let x2 = (clientRect.left + visualOffsets.x) / scale.x;
5106 let y2 = (clientRect.top + visualOffsets.y) / scale.y;
5107 let width = clientRect.width / scale.x;
5108 let height = clientRect.height / scale.y;
5109 if (domElement) {
5110 const win = getWindow(domElement);
5111 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
5112 let currentWin = win;
5113 let currentIFrame = getFrameElement(currentWin);
5114 while (currentIFrame && offsetParent && offsetWin !== currentWin) {
5115 const iframeScale = getScale(currentIFrame);
5116 const iframeRect = currentIFrame.getBoundingClientRect();
5117 const css = getComputedStyle2(currentIFrame);
5118 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
5119 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
5120 x2 *= iframeScale.x;
5121 y2 *= iframeScale.y;
5122 width *= iframeScale.x;
5123 height *= iframeScale.y;
5124 x2 += left;
5125 y2 += top;
5126 currentWin = getWindow(currentIFrame);
5127 currentIFrame = getFrameElement(currentWin);
5128 }
5129 }
5130 return rectToClientRect({
5131 width,
5132 height,
5133 x: x2,
5134 y: y2
5135 });
5136 }
5137 function getWindowScrollBarX(element, rect) {
5138 const leftScroll = getNodeScroll(element).scrollLeft;
5139 if (!rect) {
5140 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
5141 }
5142 return rect.left + leftScroll;
5143 }
5144 function getHTMLOffset(documentElement, scroll) {
5145 const htmlRect = documentElement.getBoundingClientRect();
5146 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
5147 const y2 = htmlRect.top + scroll.scrollTop;
5148 return {
5149 x: x2,
5150 y: y2
5151 };
5152 }
5153 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
5154 let {
5155 elements,
5156 rect,
5157 offsetParent,
5158 strategy
5159 } = _ref;
5160 const isFixed = strategy === "fixed";
5161 const documentElement = getDocumentElement(offsetParent);
5162 const topLayer = elements ? isTopLayer(elements.floating) : false;
5163 if (offsetParent === documentElement || topLayer && isFixed) {
5164 return rect;
5165 }
5166 let scroll = {
5167 scrollLeft: 0,
5168 scrollTop: 0
5169 };
5170 let scale = createCoords(1);
5171 const offsets = createCoords(0);
5172 const isOffsetParentAnElement = isHTMLElement(offsetParent);
5173 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5174 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
5175 scroll = getNodeScroll(offsetParent);
5176 }
5177 if (isOffsetParentAnElement) {
5178 const offsetRect = getBoundingClientRect(offsetParent);
5179 scale = getScale(offsetParent);
5180 offsets.x = offsetRect.x + offsetParent.clientLeft;
5181 offsets.y = offsetRect.y + offsetParent.clientTop;
5182 }
5183 }
5184 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5185 return {
5186 width: rect.width * scale.x,
5187 height: rect.height * scale.y,
5188 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
5189 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
5190 };
5191 }
5192 function getClientRects(element) {
5193 return Array.from(element.getClientRects());
5194 }
5195 function getDocumentRect(element) {
5196 const html = getDocumentElement(element);
5197 const scroll = getNodeScroll(element);
5198 const body = element.ownerDocument.body;
5199 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
5200 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
5201 let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
5202 const y2 = -scroll.scrollTop;
5203 if (getComputedStyle2(body).direction === "rtl") {
5204 x2 += max(html.clientWidth, body.clientWidth) - width;
5205 }
5206 return {
5207 width,
5208 height,
5209 x: x2,
5210 y: y2
5211 };
5212 }
5213 var SCROLLBAR_MAX = 25;
5214 function getViewportRect(element, strategy) {
5215 const win = getWindow(element);
5216 const html = getDocumentElement(element);
5217 const visualViewport = win.visualViewport;
5218 let width = html.clientWidth;
5219 let height = html.clientHeight;
5220 let x2 = 0;
5221 let y2 = 0;
5222 if (visualViewport) {
5223 width = visualViewport.width;
5224 height = visualViewport.height;
5225 const visualViewportBased = isWebKit();
5226 if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
5227 x2 = visualViewport.offsetLeft;
5228 y2 = visualViewport.offsetTop;
5229 }
5230 }
5231 const windowScrollbarX = getWindowScrollBarX(html);
5232 if (windowScrollbarX <= 0) {
5233 const doc = html.ownerDocument;
5234 const body = doc.body;
5235 const bodyStyles = getComputedStyle(body);
5236 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
5237 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
5238 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
5239 width -= clippingStableScrollbarWidth;
5240 }
5241 } else if (windowScrollbarX <= SCROLLBAR_MAX) {
5242 width += windowScrollbarX;
5243 }
5244 return {
5245 width,
5246 height,
5247 x: x2,
5248 y: y2
5249 };
5250 }
5251 function getInnerBoundingClientRect(element, strategy) {
5252 const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
5253 const top = clientRect.top + element.clientTop;
5254 const left = clientRect.left + element.clientLeft;
5255 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
5256 const width = element.clientWidth * scale.x;
5257 const height = element.clientHeight * scale.y;
5258 const x2 = left * scale.x;
5259 const y2 = top * scale.y;
5260 return {
5261 width,
5262 height,
5263 x: x2,
5264 y: y2
5265 };
5266 }
5267 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
5268 let rect;
5269 if (clippingAncestor === "viewport") {
5270 rect = getViewportRect(element, strategy);
5271 } else if (clippingAncestor === "document") {
5272 rect = getDocumentRect(getDocumentElement(element));
5273 } else if (isElement(clippingAncestor)) {
5274 rect = getInnerBoundingClientRect(clippingAncestor, strategy);
5275 } else {
5276 const visualOffsets = getVisualOffsets(element);
5277 rect = {
5278 x: clippingAncestor.x - visualOffsets.x,
5279 y: clippingAncestor.y - visualOffsets.y,
5280 width: clippingAncestor.width,
5281 height: clippingAncestor.height
5282 };
5283 }
5284 return rectToClientRect(rect);
5285 }
5286 function hasFixedPositionAncestor(element, stopNode) {
5287 const parentNode = getParentNode(element);
5288 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
5289 return false;
5290 }
5291 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
5292 }
5293 function getClippingElementAncestors(element, cache) {
5294 const cachedResult = cache.get(element);
5295 if (cachedResult) {
5296 return cachedResult;
5297 }
5298 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
5299 let currentContainingBlockComputedStyle = null;
5300 const elementIsFixed = getComputedStyle2(element).position === "fixed";
5301 let currentNode = elementIsFixed ? getParentNode(element) : element;
5302 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
5303 const computedStyle = getComputedStyle2(currentNode);
5304 const currentNodeIsContaining = isContainingBlock(currentNode);
5305 if (!currentNodeIsContaining && computedStyle.position === "fixed") {
5306 currentContainingBlockComputedStyle = null;
5307 }
5308 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5309 if (shouldDropCurrentNode) {
5310 result = result.filter((ancestor) => ancestor !== currentNode);
5311 } else {
5312 currentContainingBlockComputedStyle = computedStyle;
5313 }
5314 currentNode = getParentNode(currentNode);
5315 }
5316 cache.set(element, result);
5317 return result;
5318 }
5319 function getClippingRect(_ref) {
5320 let {
5321 element,
5322 boundary,
5323 rootBoundary,
5324 strategy
5325 } = _ref;
5326 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
5327 const clippingAncestors = [...elementClippingAncestors, rootBoundary];
5328 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
5329 let top = firstRect.top;
5330 let right = firstRect.right;
5331 let bottom = firstRect.bottom;
5332 let left = firstRect.left;
5333 for (let i2 = 1; i2 < clippingAncestors.length; i2++) {
5334 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy);
5335 top = max(rect.top, top);
5336 right = min(rect.right, right);
5337 bottom = min(rect.bottom, bottom);
5338 left = max(rect.left, left);
5339 }
5340 return {
5341 width: right - left,
5342 height: bottom - top,
5343 x: left,
5344 y: top
5345 };
5346 }
5347 function getDimensions(element) {
5348 const {
5349 width,
5350 height
5351 } = getCssDimensions(element);
5352 return {
5353 width,
5354 height
5355 };
5356 }
5357 function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5358 const isOffsetParentAnElement = isHTMLElement(offsetParent);
5359 const documentElement = getDocumentElement(offsetParent);
5360 const isFixed = strategy === "fixed";
5361 const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
5362 let scroll = {
5363 scrollLeft: 0,
5364 scrollTop: 0
5365 };
5366 const offsets = createCoords(0);
5367 function setLeftRTLScrollbarOffset() {
5368 offsets.x = getWindowScrollBarX(documentElement);
5369 }
5370 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5371 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
5372 scroll = getNodeScroll(offsetParent);
5373 }
5374 if (isOffsetParentAnElement) {
5375 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5376 offsets.x = offsetRect.x + offsetParent.clientLeft;
5377 offsets.y = offsetRect.y + offsetParent.clientTop;
5378 } else if (documentElement) {
5379 setLeftRTLScrollbarOffset();
5380 }
5381 }
5382 if (isFixed && !isOffsetParentAnElement && documentElement) {
5383 setLeftRTLScrollbarOffset();
5384 }
5385 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5386 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
5387 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
5388 return {
5389 x: x2,
5390 y: y2,
5391 width: rect.width,
5392 height: rect.height
5393 };
5394 }
5395 function isStaticPositioned(element) {
5396 return getComputedStyle2(element).position === "static";
5397 }
5398 function getTrueOffsetParent(element, polyfill) {
5399 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
5400 return null;
5401 }
5402 if (polyfill) {
5403 return polyfill(element);
5404 }
5405 let rawOffsetParent = element.offsetParent;
5406 if (getDocumentElement(element) === rawOffsetParent) {
5407 rawOffsetParent = rawOffsetParent.ownerDocument.body;
5408 }
5409 return rawOffsetParent;
5410 }
5411 function getOffsetParent(element, polyfill) {
5412 const win = getWindow(element);
5413 if (isTopLayer(element)) {
5414 return win;
5415 }
5416 if (!isHTMLElement(element)) {
5417 let svgOffsetParent = getParentNode(element);
5418 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
5419 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
5420 return svgOffsetParent;
5421 }
5422 svgOffsetParent = getParentNode(svgOffsetParent);
5423 }
5424 return win;
5425 }
5426 let offsetParent = getTrueOffsetParent(element, polyfill);
5427 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
5428 offsetParent = getTrueOffsetParent(offsetParent, polyfill);
5429 }
5430 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
5431 return win;
5432 }
5433 return offsetParent || getContainingBlock(element) || win;
5434 }
5435 var getElementRects = async function(data) {
5436 const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5437 const getDimensionsFn = this.getDimensions;
5438 const floatingDimensions = await getDimensionsFn(data.floating);
5439 return {
5440 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
5441 floating: {
5442 x: 0,
5443 y: 0,
5444 width: floatingDimensions.width,
5445 height: floatingDimensions.height
5446 }
5447 };
5448 };
5449 function isRTL(element) {
5450 return getComputedStyle2(element).direction === "rtl";
5451 }
5452 var platform2 = {
5453 convertOffsetParentRelativeRectToViewportRelativeRect,
5454 getDocumentElement,
5455 getClippingRect,
5456 getOffsetParent,
5457 getElementRects,
5458 getClientRects,
5459 getDimensions,
5460 getScale,
5461 isElement,
5462 isRTL
5463 };
5464 function rectsAreEqual(a2, b2) {
5465 return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height;
5466 }
5467 function observeMove(element, onMove) {
5468 let io = null;
5469 let timeoutId;
5470 const root = getDocumentElement(element);
5471 function cleanup() {
5472 var _io;
5473 clearTimeout(timeoutId);
5474 (_io = io) == null || _io.disconnect();
5475 io = null;
5476 }
5477 function refresh(skip, threshold) {
5478 if (skip === void 0) {
5479 skip = false;
5480 }
5481 if (threshold === void 0) {
5482 threshold = 1;
5483 }
5484 cleanup();
5485 const elementRectForRootMargin = element.getBoundingClientRect();
5486 const {
5487 left,
5488 top,
5489 width,
5490 height
5491 } = elementRectForRootMargin;
5492 if (!skip) {
5493 onMove();
5494 }
5495 if (!width || !height) {
5496 return;
5497 }
5498 const insetTop = floor(top);
5499 const insetRight = floor(root.clientWidth - (left + width));
5500 const insetBottom = floor(root.clientHeight - (top + height));
5501 const insetLeft = floor(left);
5502 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
5503 const options = {
5504 rootMargin,
5505 threshold: max(0, min(1, threshold)) || 1
5506 };
5507 let isFirstUpdate = true;
5508 function handleObserve(entries) {
5509 const ratio = entries[0].intersectionRatio;
5510 if (ratio !== threshold) {
5511 if (!isFirstUpdate) {
5512 return refresh();
5513 }
5514 if (!ratio) {
5515 timeoutId = setTimeout(() => {
5516 refresh(false, 1e-7);
5517 }, 1e3);
5518 } else {
5519 refresh(false, ratio);
5520 }
5521 }
5522 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
5523 refresh();
5524 }
5525 isFirstUpdate = false;
5526 }
5527 try {
5528 io = new IntersectionObserver(handleObserve, {
5529 ...options,
5530 // Handle <iframe>s
5531 root: root.ownerDocument
5532 });
5533 } catch (_e) {
5534 io = new IntersectionObserver(handleObserve, options);
5535 }
5536 io.observe(element);
5537 }
5538 refresh(true);
5539 return cleanup;
5540 }
5541 function autoUpdate(reference, floating, update2, options) {
5542 if (options === void 0) {
5543 options = {};
5544 }
5545 const {
5546 ancestorScroll = true,
5547 ancestorResize = true,
5548 elementResize = typeof ResizeObserver === "function",
5549 layoutShift = typeof IntersectionObserver === "function",
5550 animationFrame = false
5551 } = options;
5552 const referenceEl = unwrapElement(reference);
5553 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
5554 ancestors.forEach((ancestor) => {
5555 ancestorScroll && ancestor.addEventListener("scroll", update2, {
5556 passive: true
5557 });
5558 ancestorResize && ancestor.addEventListener("resize", update2);
5559 });
5560 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null;
5561 let reobserveFrame = -1;
5562 let resizeObserver = null;
5563 if (elementResize) {
5564 resizeObserver = new ResizeObserver((_ref) => {
5565 let [firstEntry] = _ref;
5566 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5567 resizeObserver.unobserve(floating);
5568 cancelAnimationFrame(reobserveFrame);
5569 reobserveFrame = requestAnimationFrame(() => {
5570 var _resizeObserver;
5571 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
5572 });
5573 }
5574 update2();
5575 });
5576 if (referenceEl && !animationFrame) {
5577 resizeObserver.observe(referenceEl);
5578 }
5579 if (floating) {
5580 resizeObserver.observe(floating);
5581 }
5582 }
5583 let frameId;
5584 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
5585 if (animationFrame) {
5586 frameLoop();
5587 }
5588 function frameLoop() {
5589 const nextRefRect = getBoundingClientRect(reference);
5590 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
5591 update2();
5592 }
5593 prevRefRect = nextRefRect;
5594 frameId = requestAnimationFrame(frameLoop);
5595 }
5596 update2();
5597 return () => {
5598 var _resizeObserver2;
5599 ancestors.forEach((ancestor) => {
5600 ancestorScroll && ancestor.removeEventListener("scroll", update2);
5601 ancestorResize && ancestor.removeEventListener("resize", update2);
5602 });
5603 cleanupIo == null || cleanupIo();
5604 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
5605 resizeObserver = null;
5606 if (animationFrame) {
5607 cancelAnimationFrame(frameId);
5608 }
5609 };
5610 }
5611 var offset2 = offset;
5612 var shift2 = shift;
5613 var flip2 = flip;
5614 var size2 = size;
5615 var hide2 = hide;
5616 var limitShift2 = limitShift;
5617 var computePosition2 = (reference, floating, options) => {
5618 const cache = /* @__PURE__ */ new Map();
5619 const mergedOptions = {
5620 platform: platform2,
5621 ...options
5622 };
5623 const platformWithCache = {
5624 ...mergedOptions.platform,
5625 _c: cache
5626 };
5627 return computePosition(reference, floating, {
5628 ...mergedOptions,
5629 platform: platformWithCache
5630 });
5631 };
5632
5633 // node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
5634 var React27 = __toESM(require_react(), 1);
5635 var import_react2 = __toESM(require_react(), 1);
5636 var ReactDOM3 = __toESM(require_react_dom(), 1);
5637 var isClient = typeof document !== "undefined";
5638 var noop2 = function noop3() {
5639 };
5640 var index = isClient ? import_react2.useLayoutEffect : noop2;
5641 function deepEqual(a2, b2) {
5642 if (a2 === b2) {
5643 return true;
5644 }
5645 if (typeof a2 !== typeof b2) {
5646 return false;
5647 }
5648 if (typeof a2 === "function" && a2.toString() === b2.toString()) {
5649 return true;
5650 }
5651 let length;
5652 let i2;
5653 let keys;
5654 if (a2 && b2 && typeof a2 === "object") {
5655 if (Array.isArray(a2)) {
5656 length = a2.length;
5657 if (length !== b2.length) return false;
5658 for (i2 = length; i2-- !== 0; ) {
5659 if (!deepEqual(a2[i2], b2[i2])) {
5660 return false;
5661 }
5662 }
5663 return true;
5664 }
5665 keys = Object.keys(a2);
5666 length = keys.length;
5667 if (length !== Object.keys(b2).length) {
5668 return false;
5669 }
5670 for (i2 = length; i2-- !== 0; ) {
5671 if (!{}.hasOwnProperty.call(b2, keys[i2])) {
5672 return false;
5673 }
5674 }
5675 for (i2 = length; i2-- !== 0; ) {
5676 const key = keys[i2];
5677 if (key === "_owner" && a2.$$typeof) {
5678 continue;
5679 }
5680 if (!deepEqual(a2[key], b2[key])) {
5681 return false;
5682 }
5683 }
5684 return true;
5685 }
5686 return a2 !== a2 && b2 !== b2;
5687 }
5688 function getDPR(element) {
5689 if (typeof window === "undefined") {
5690 return 1;
5691 }
5692 const win = element.ownerDocument.defaultView || window;
5693 return win.devicePixelRatio || 1;
5694 }
5695 function roundByDPR(element, value) {
5696 const dpr = getDPR(element);
5697 return Math.round(value * dpr) / dpr;
5698 }
5699 function useLatestRef(value) {
5700 const ref = React27.useRef(value);
5701 index(() => {
5702 ref.current = value;
5703 });
5704 return ref;
5705 }
5706 function useFloating(options) {
5707 if (options === void 0) {
5708 options = {};
5709 }
5710 const {
5711 placement = "bottom",
5712 strategy = "absolute",
5713 middleware = [],
5714 platform: platform3,
5715 elements: {
5716 reference: externalReference,
5717 floating: externalFloating
5718 } = {},
5719 transform = true,
5720 whileElementsMounted,
5721 open
5722 } = options;
5723 const [data, setData] = React27.useState({
5724 x: 0,
5725 y: 0,
5726 strategy,
5727 placement,
5728 middlewareData: {},
5729 isPositioned: false
5730 });
5731 const [latestMiddleware, setLatestMiddleware] = React27.useState(middleware);
5732 if (!deepEqual(latestMiddleware, middleware)) {
5733 setLatestMiddleware(middleware);
5734 }
5735 const [_reference, _setReference] = React27.useState(null);
5736 const [_floating, _setFloating] = React27.useState(null);
5737 const setReference = React27.useCallback((node) => {
5738 if (node !== referenceRef.current) {
5739 referenceRef.current = node;
5740 _setReference(node);
5741 }
5742 }, []);
5743 const setFloating = React27.useCallback((node) => {
5744 if (node !== floatingRef.current) {
5745 floatingRef.current = node;
5746 _setFloating(node);
5747 }
5748 }, []);
5749 const referenceEl = externalReference || _reference;
5750 const floatingEl = externalFloating || _floating;
5751 const referenceRef = React27.useRef(null);
5752 const floatingRef = React27.useRef(null);
5753 const dataRef = React27.useRef(data);
5754 const hasWhileElementsMounted = whileElementsMounted != null;
5755 const whileElementsMountedRef = useLatestRef(whileElementsMounted);
5756 const platformRef = useLatestRef(platform3);
5757 const openRef = useLatestRef(open);
5758 const update2 = React27.useCallback(() => {
5759 if (!referenceRef.current || !floatingRef.current) {
5760 return;
5761 }
5762 const config = {
5763 placement,
5764 strategy,
5765 middleware: latestMiddleware
5766 };
5767 if (platformRef.current) {
5768 config.platform = platformRef.current;
5769 }
5770 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
5771 const fullData = {
5772 ...data2,
5773 // The floating element's position may be recomputed while it's closed
5774 // but still mounted (such as when transitioning out). To ensure
5775 // `isPositioned` will be `false` initially on the next open, avoid
5776 // setting it to `true` when `open === false` (must be specified).
5777 isPositioned: openRef.current !== false
5778 };
5779 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
5780 dataRef.current = fullData;
5781 ReactDOM3.flushSync(() => {
5782 setData(fullData);
5783 });
5784 }
5785 });
5786 }, [latestMiddleware, placement, strategy, platformRef, openRef]);
5787 index(() => {
5788 if (open === false && dataRef.current.isPositioned) {
5789 dataRef.current.isPositioned = false;
5790 setData((data2) => ({
5791 ...data2,
5792 isPositioned: false
5793 }));
5794 }
5795 }, [open]);
5796 const isMountedRef = React27.useRef(false);
5797 index(() => {
5798 isMountedRef.current = true;
5799 return () => {
5800 isMountedRef.current = false;
5801 };
5802 }, []);
5803 index(() => {
5804 if (referenceEl) referenceRef.current = referenceEl;
5805 if (floatingEl) floatingRef.current = floatingEl;
5806 if (referenceEl && floatingEl) {
5807 if (whileElementsMountedRef.current) {
5808 return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
5809 }
5810 update2();
5811 }
5812 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
5813 const refs = React27.useMemo(() => ({
5814 reference: referenceRef,
5815 floating: floatingRef,
5816 setReference,
5817 setFloating
5818 }), [setReference, setFloating]);
5819 const elements = React27.useMemo(() => ({
5820 reference: referenceEl,
5821 floating: floatingEl
5822 }), [referenceEl, floatingEl]);
5823 const floatingStyles = React27.useMemo(() => {
5824 const initialStyles = {
5825 position: strategy,
5826 left: 0,
5827 top: 0
5828 };
5829 if (!elements.floating) {
5830 return initialStyles;
5831 }
5832 const x2 = roundByDPR(elements.floating, data.x);
5833 const y2 = roundByDPR(elements.floating, data.y);
5834 if (transform) {
5835 return {
5836 ...initialStyles,
5837 transform: "translate(" + x2 + "px, " + y2 + "px)",
5838 ...getDPR(elements.floating) >= 1.5 && {
5839 willChange: "transform"
5840 }
5841 };
5842 }
5843 return {
5844 position: strategy,
5845 left: x2,
5846 top: y2
5847 };
5848 }, [strategy, transform, elements.floating, data.x, data.y]);
5849 return React27.useMemo(() => ({
5850 ...data,
5851 update: update2,
5852 refs,
5853 elements,
5854 floatingStyles
5855 }), [data, update2, refs, elements, floatingStyles]);
5856 }
5857 var offset3 = (options, deps) => {
5858 const result = offset2(options);
5859 return {
5860 name: result.name,
5861 fn: result.fn,
5862 options: [options, deps]
5863 };
5864 };
5865 var shift3 = (options, deps) => {
5866 const result = shift2(options);
5867 return {
5868 name: result.name,
5869 fn: result.fn,
5870 options: [options, deps]
5871 };
5872 };
5873 var limitShift3 = (options, deps) => {
5874 const result = limitShift2(options);
5875 return {
5876 fn: result.fn,
5877 options: [options, deps]
5878 };
5879 };
5880 var flip3 = (options, deps) => {
5881 const result = flip2(options);
5882 return {
5883 name: result.name,
5884 fn: result.fn,
5885 options: [options, deps]
5886 };
5887 };
5888 var size3 = (options, deps) => {
5889 const result = size2(options);
5890 return {
5891 name: result.name,
5892 fn: result.fn,
5893 options: [options, deps]
5894 };
5895 };
5896 var hide3 = (options, deps) => {
5897 const result = hide2(options);
5898 return {
5899 name: result.name,
5900 fn: result.fn,
5901 options: [options, deps]
5902 };
5903 };
5904
5905 // node_modules/@base-ui/utils/esm/store/createSelector.js
5906 var createSelector = (a2, b2, c2, d2, e2, f2, ...other) => {
5907 if (other.length > 0) {
5908 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1));
5909 }
5910 let selector2;
5911 if (a2 && b2 && c2 && d2 && e2 && f2) {
5912 selector2 = (state, a1, a22, a3) => {
5913 const va = a2(state, a1, a22, a3);
5914 const vb = b2(state, a1, a22, a3);
5915 const vc = c2(state, a1, a22, a3);
5916 const vd = d2(state, a1, a22, a3);
5917 const ve = e2(state, a1, a22, a3);
5918 return f2(va, vb, vc, vd, ve, a1, a22, a3);
5919 };
5920 } else if (a2 && b2 && c2 && d2 && e2) {
5921 selector2 = (state, a1, a22, a3) => {
5922 const va = a2(state, a1, a22, a3);
5923 const vb = b2(state, a1, a22, a3);
5924 const vc = c2(state, a1, a22, a3);
5925 const vd = d2(state, a1, a22, a3);
5926 return e2(va, vb, vc, vd, a1, a22, a3);
5927 };
5928 } else if (a2 && b2 && c2 && d2) {
5929 selector2 = (state, a1, a22, a3) => {
5930 const va = a2(state, a1, a22, a3);
5931 const vb = b2(state, a1, a22, a3);
5932 const vc = c2(state, a1, a22, a3);
5933 return d2(va, vb, vc, a1, a22, a3);
5934 };
5935 } else if (a2 && b2 && c2) {
5936 selector2 = (state, a1, a22, a3) => {
5937 const va = a2(state, a1, a22, a3);
5938 const vb = b2(state, a1, a22, a3);
5939 return c2(va, vb, a1, a22, a3);
5940 };
5941 } else if (a2 && b2) {
5942 selector2 = (state, a1, a22, a3) => {
5943 const va = a2(state, a1, a22, a3);
5944 return b2(va, a1, a22, a3);
5945 };
5946 } else if (a2) {
5947 selector2 = a2;
5948 } else {
5949 throw (
5950 /* minify-error-disabled */
5951 new Error("Missing arguments")
5952 );
5953 }
5954 return selector2;
5955 };
5956
5957 // node_modules/@base-ui/utils/esm/store/useStore.js
5958 var React29 = __toESM(require_react(), 1);
5959 var import_shim = __toESM(require_shim(), 1);
5960 var import_with_selector = __toESM(require_with_selector(), 1);
5961
5962 // node_modules/@base-ui/utils/esm/fastHooks.js
5963 var React28 = __toESM(require_react(), 1);
5964 var hooks = [];
5965 var currentInstance = void 0;
5966 function getInstance() {
5967 return currentInstance;
5968 }
5969 function register(hook) {
5970 hooks.push(hook);
5971 }
5972 function fastComponent(fn) {
5973 const FastComponent = (props, forwardedRef) => {
5974 const instance = useRefWithInit(createInstance).current;
5975 let result;
5976 try {
5977 currentInstance = instance;
5978 for (const hook of hooks) {
5979 hook.before(instance);
5980 }
5981 result = fn(props, forwardedRef);
5982 for (const hook of hooks) {
5983 hook.after(instance);
5984 }
5985 instance.didInitialize = true;
5986 } finally {
5987 currentInstance = void 0;
5988 }
5989 return result;
5990 };
5991 FastComponent.displayName = fn.displayName || fn.name;
5992 return FastComponent;
5993 }
5994 function fastComponentRef(fn) {
5995 return /* @__PURE__ */ React28.forwardRef(fastComponent(fn));
5996 }
5997 function createInstance() {
5998 return {
5999 didInitialize: false
6000 };
6001 }
6002
6003 // node_modules/@base-ui/utils/esm/store/useStore.js
6004 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
6005 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
6006 function useStore(store, selector2, a1, a2, a3) {
6007 return useStoreImplementation(store, selector2, a1, a2, a3);
6008 }
6009 function useStoreR19(store, selector2, a1, a2, a3) {
6010 const getSelection = React29.useCallback(() => selector2(store.getSnapshot(), a1, a2, a3), [store, selector2, a1, a2, a3]);
6011 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection);
6012 }
6013 register({
6014 before(instance) {
6015 instance.syncIndex = 0;
6016 if (!instance.didInitialize) {
6017 instance.syncTick = 1;
6018 instance.syncHooks = [];
6019 instance.didChangeStore = true;
6020 instance.getSnapshot = () => {
6021 let didChange2 = false;
6022 for (let i2 = 0; i2 < instance.syncHooks.length; i2 += 1) {
6023 const hook = instance.syncHooks[i2];
6024 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
6025 if (hook.didChange || !Object.is(hook.value, value)) {
6026 didChange2 = true;
6027 hook.value = value;
6028 hook.didChange = false;
6029 }
6030 }
6031 if (didChange2) {
6032 instance.syncTick += 1;
6033 }
6034 return instance.syncTick;
6035 };
6036 }
6037 },
6038 after(instance) {
6039 if (instance.syncHooks.length > 0) {
6040 if (instance.didChangeStore) {
6041 instance.didChangeStore = false;
6042 instance.subscribe = (onStoreChange) => {
6043 const stores = /* @__PURE__ */ new Set();
6044 for (const hook of instance.syncHooks) {
6045 stores.add(hook.store);
6046 }
6047 const unsubscribes = [];
6048 for (const store of stores) {
6049 unsubscribes.push(store.subscribe(onStoreChange));
6050 }
6051 return () => {
6052 for (const unsubscribe of unsubscribes) {
6053 unsubscribe();
6054 }
6055 };
6056 };
6057 }
6058 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
6059 }
6060 }
6061 });
6062 function useStoreFast(store, selector2, a1, a2, a3) {
6063 const instance = getInstance();
6064 if (!instance) {
6065 return useStoreR19(store, selector2, a1, a2, a3);
6066 }
6067 const index2 = instance.syncIndex;
6068 instance.syncIndex += 1;
6069 let hook;
6070 if (!instance.didInitialize) {
6071 hook = {
6072 store,
6073 selector: selector2,
6074 a1,
6075 a2,
6076 a3,
6077 value: selector2(store.getSnapshot(), a1, a2, a3),
6078 didChange: false
6079 };
6080 instance.syncHooks.push(hook);
6081 } else {
6082 hook = instance.syncHooks[index2];
6083 if (hook.store !== store || hook.selector !== selector2 || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
6084 if (hook.store !== store) {
6085 instance.didChangeStore = true;
6086 }
6087 hook.store = store;
6088 hook.selector = selector2;
6089 hook.a1 = a1;
6090 hook.a2 = a2;
6091 hook.a3 = a3;
6092 hook.didChange = true;
6093 }
6094 }
6095 return hook.value;
6096 }
6097 function useStoreLegacy(store, selector2, a1, a2, a3) {
6098 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector2(state, a1, a2, a3));
6099 }
6100
6101 // node_modules/@base-ui/utils/esm/store/Store.js
6102 var Store = class {
6103 /**
6104 * The current state of the store.
6105 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
6106 * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
6107 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
6108 *
6109 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
6110 */
6111 // Internal state to handle recursive `setState()` calls
6112 constructor(state) {
6113 this.state = state;
6114 this.listeners = /* @__PURE__ */ new Set();
6115 this.updateTick = 0;
6116 }
6117 /**
6118 * Registers a listener that will be called whenever the store's state changes.
6119 *
6120 * @param fn The listener function to be called on state changes.
6121 * @returns A function to unsubscribe the listener.
6122 */
6123 subscribe = (fn) => {
6124 this.listeners.add(fn);
6125 return () => {
6126 this.listeners.delete(fn);
6127 };
6128 };
6129 /**
6130 * Returns the current state of the store.
6131 */
6132 getSnapshot = () => {
6133 return this.state;
6134 };
6135 /**
6136 * Updates the entire store's state and notifies all registered listeners.
6137 *
6138 * @param newState The new state to set for the store.
6139 */
6140 setState(newState) {
6141 if (this.state === newState) {
6142 return;
6143 }
6144 this.state = newState;
6145 this.updateTick += 1;
6146 const currentTick = this.updateTick;
6147 for (const listener of this.listeners) {
6148 if (currentTick !== this.updateTick) {
6149 return;
6150 }
6151 listener(newState);
6152 }
6153 }
6154 /**
6155 * Merges the provided changes into the current state and notifies listeners if there are changes.
6156 *
6157 * @param changes An object containing the changes to apply to the current state.
6158 */
6159 update(changes) {
6160 for (const key in changes) {
6161 if (!Object.is(this.state[key], changes[key])) {
6162 this.setState({
6163 ...this.state,
6164 ...changes
6165 });
6166 return;
6167 }
6168 }
6169 }
6170 /**
6171 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
6172 *
6173 * @param key The key in the store's state to update.
6174 * @param value The new value to set for the specified key.
6175 */
6176 set(key, value) {
6177 if (!Object.is(this.state[key], value)) {
6178 this.setState({
6179 ...this.state,
6180 [key]: value
6181 });
6182 }
6183 }
6184 /**
6185 * Gives the state a new reference and updates all registered listeners.
6186 */
6187 notifyAll() {
6188 const newState = {
6189 ...this.state
6190 };
6191 this.setState(newState);
6192 }
6193 use(selector2, a1, a2, a3) {
6194 return useStore(this, selector2, a1, a2, a3);
6195 }
6196 };
6197
6198 // node_modules/@base-ui/utils/esm/store/ReactStore.js
6199 var React30 = __toESM(require_react(), 1);
6200 var ReactStore = class extends Store {
6201 /**
6202 * Creates a new ReactStore instance.
6203 *
6204 * @param state Initial state of the store.
6205 * @param context Non-reactive context values.
6206 * @param selectors Optional selectors for use with `useState`.
6207 */
6208 constructor(state, context = {}, selectors3) {
6209 super(state);
6210 this.context = context;
6211 this.selectors = selectors3;
6212 }
6213 /**
6214 * Non-reactive values such as refs, callbacks, etc.
6215 */
6216 /**
6217 * Synchronizes a single external value into the store.
6218 *
6219 * Note that the while the value in `state` is updated immediately, the value returned
6220 * by `useState` is updated before the next render (similarly to React's `useState`).
6221 */
6222 useSyncedValue(key, value) {
6223 React30.useDebugValue(key);
6224 useIsoLayoutEffect(() => {
6225 if (this.state[key] !== value) {
6226 this.set(key, value);
6227 }
6228 }, [key, value]);
6229 }
6230 /**
6231 * Synchronizes a single external value into the store and
6232 * cleans it up (sets to `undefined`) on unmount.
6233 *
6234 * Note that the while the value in `state` is updated immediately, the value returned
6235 * by `useState` is updated before the next render (similarly to React's `useState`).
6236 */
6237 useSyncedValueWithCleanup(key, value) {
6238 const store = this;
6239 useIsoLayoutEffect(() => {
6240 if (store.state[key] !== value) {
6241 store.set(key, value);
6242 }
6243 return () => {
6244 store.set(key, void 0);
6245 };
6246 }, [store, key, value]);
6247 }
6248 /**
6249 * Synchronizes multiple external values into the store.
6250 *
6251 * Note that the while the values in `state` are updated immediately, the values returned
6252 * by `useState` are updated before the next render (similarly to React's `useState`).
6253 */
6254 useSyncedValues(statePart) {
6255 const store = this;
6256 if (true) {
6257 React30.useDebugValue(statePart, (p2) => Object.keys(p2));
6258 const keys = React30.useRef(Object.keys(statePart)).current;
6259 const nextKeys = Object.keys(statePart);
6260 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
6261 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
6262 }
6263 }
6264 const dependencies = Object.values(statePart);
6265 useIsoLayoutEffect(() => {
6266 store.update(statePart);
6267 }, [store, ...dependencies]);
6268 }
6269 /**
6270 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
6271 * is non-undefined, the store's state at `key` is updated to match `controlled`.
6272 */
6273 useControlledProp(key, controlled) {
6274 React30.useDebugValue(key);
6275 const isControlled = controlled !== void 0;
6276 useIsoLayoutEffect(() => {
6277 if (isControlled && !Object.is(this.state[key], controlled)) {
6278 super.setState({
6279 ...this.state,
6280 [key]: controlled
6281 });
6282 }
6283 }, [key, controlled, isControlled]);
6284 if (true) {
6285 const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
6286 if (!cache.has(key)) {
6287 cache.set(key, isControlled);
6288 }
6289 const previouslyControlled = cache.get(key);
6290 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
6291 console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
6292 }
6293 }
6294 }
6295 /** Gets the current value from the store using a selector with the provided key.
6296 *
6297 * @param key Key of the selector to use.
6298 */
6299 select(key, a1, a2, a3) {
6300 const selector2 = this.selectors[key];
6301 return selector2(this.state, a1, a2, a3);
6302 }
6303 /**
6304 * Returns a value from the store's state using a selector function.
6305 * Used to subscribe to specific parts of the state.
6306 * This methods causes a rerender whenever the selected state changes.
6307 *
6308 * @param key Key of the selector to use.
6309 */
6310 useState(key, a1, a2, a3) {
6311 React30.useDebugValue(key);
6312 return useStore(this, this.selectors[key], a1, a2, a3);
6313 }
6314 /**
6315 * Wraps a function with `useStableCallback` to ensure it has a stable reference
6316 * and assigns it to the context.
6317 *
6318 * @param key Key of the event callback. Must be a function in the context.
6319 * @param fn Function to assign.
6320 */
6321 useContextCallback(key, fn) {
6322 React30.useDebugValue(key);
6323 const stableFunction = useStableCallback(fn ?? NOOP);
6324 this.context[key] = stableFunction;
6325 }
6326 /**
6327 * Returns a stable setter function for a specific key in the store's state.
6328 * It's commonly used to pass as a ref callback to React elements.
6329 *
6330 * @param key Key of the state to set.
6331 */
6332 useStateSetter(key) {
6333 const ref = React30.useRef(void 0);
6334 if (ref.current === void 0) {
6335 ref.current = (value) => {
6336 this.set(key, value);
6337 };
6338 }
6339 return ref.current;
6340 }
6341 /**
6342 * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
6343 *
6344 * @param key Key of the selector to observe.
6345 * @param listener Listener function called when the selector result changes.
6346 */
6347 observe(selector2, listener) {
6348 let selectFn;
6349 if (typeof selector2 === "function") {
6350 selectFn = selector2;
6351 } else {
6352 selectFn = this.selectors[selector2];
6353 }
6354 let prevValue = selectFn(this.state);
6355 listener(prevValue, prevValue, this);
6356 return this.subscribe((nextState) => {
6357 const nextValue = selectFn(nextState);
6358 if (!Object.is(prevValue, nextValue)) {
6359 const oldValue = prevValue;
6360 prevValue = nextValue;
6361 listener(nextValue, oldValue, this);
6362 }
6363 });
6364 }
6365 };
6366
6367 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js
6368 var selectors = {
6369 open: createSelector((state) => state.open),
6370 transitionStatus: createSelector((state) => state.transitionStatus),
6371 domReferenceElement: createSelector((state) => state.domReferenceElement),
6372 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement),
6373 floatingElement: createSelector((state) => state.floatingElement),
6374 floatingId: createSelector((state) => state.floatingId)
6375 };
6376 var FloatingRootStore = class extends ReactStore {
6377 constructor(options) {
6378 const {
6379 syncOnly,
6380 nested,
6381 onOpenChange,
6382 triggerElements,
6383 ...initialState
6384 } = options;
6385 super({
6386 ...initialState,
6387 positionReference: initialState.referenceElement,
6388 domReferenceElement: initialState.referenceElement
6389 }, {
6390 onOpenChange,
6391 dataRef: {
6392 current: {}
6393 },
6394 events: createEventEmitter(),
6395 nested,
6396 triggerElements
6397 }, selectors);
6398 this.syncOnly = syncOnly;
6399 }
6400 /**
6401 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
6402 */
6403 syncOpenEvent = (newOpen, event) => {
6404 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
6405 // click events to upgrade a hover-open.
6406 event != null && isClickLikeEvent(event)) {
6407 this.context.dataRef.current.openEvent = newOpen ? event : void 0;
6408 }
6409 };
6410 /**
6411 * Runs the root-owned side effects for an open state change.
6412 */
6413 dispatchOpenChange = (newOpen, eventDetails) => {
6414 this.syncOpenEvent(newOpen, eventDetails.event);
6415 const details = {
6416 open: newOpen,
6417 reason: eventDetails.reason,
6418 nativeEvent: eventDetails.event,
6419 nested: this.context.nested,
6420 triggerElement: eventDetails.trigger
6421 };
6422 this.context.events.emit("openchange", details);
6423 };
6424 /**
6425 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
6426 *
6427 * @param newOpen The new open state.
6428 * @param eventDetails Details about the event that triggered the open state change.
6429 */
6430 setOpen = (newOpen, eventDetails) => {
6431 if (this.syncOnly) {
6432 this.context.onOpenChange?.(newOpen, eventDetails);
6433 return;
6434 }
6435 this.dispatchOpenChange(newOpen, eventDetails);
6436 this.context.onOpenChange?.(newOpen, eventDetails);
6437 };
6438 };
6439
6440 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js
6441 var React31 = __toESM(require_react(), 1);
6442 function useTriggerRegistration(id, store) {
6443 const registeredElementIdRef = React31.useRef(null);
6444 const registeredElementRef = React31.useRef(null);
6445 return React31.useCallback((element) => {
6446 if (id === void 0) {
6447 return;
6448 }
6449 if (registeredElementIdRef.current !== null) {
6450 const registeredId = registeredElementIdRef.current;
6451 const registeredElement = registeredElementRef.current;
6452 const currentElement = store.context.triggerElements.getById(registeredId);
6453 if (registeredElement && currentElement === registeredElement) {
6454 store.context.triggerElements.delete(registeredId);
6455 }
6456 registeredElementIdRef.current = null;
6457 registeredElementRef.current = null;
6458 }
6459 if (element !== null) {
6460 registeredElementIdRef.current = id;
6461 registeredElementRef.current = element;
6462 store.context.triggerElements.add(id, element);
6463 }
6464 }, [store, id]);
6465 }
6466 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {
6467 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId);
6468 const baseRegisterTrigger = useTriggerRegistration(triggerId, store);
6469 const registerTrigger = useStableCallback((element) => {
6470 baseRegisterTrigger(element);
6471 if (!element || !store.select("open")) {
6472 return;
6473 }
6474 const activeTriggerId = store.select("activeTriggerId");
6475 if (activeTriggerId === triggerId) {
6476 store.update({
6477 activeTriggerElement: element,
6478 ...stateUpdates
6479 });
6480 return;
6481 }
6482 if (activeTriggerId == null) {
6483 store.update({
6484 activeTriggerId: triggerId,
6485 activeTriggerElement: element,
6486 ...stateUpdates
6487 });
6488 }
6489 });
6490 useIsoLayoutEffect(() => {
6491 if (isMountedByThisTrigger) {
6492 store.update({
6493 activeTriggerElement: triggerElementRef.current,
6494 ...stateUpdates
6495 });
6496 }
6497 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);
6498 return {
6499 registerTrigger,
6500 isMountedByThisTrigger
6501 };
6502 }
6503 function useImplicitActiveTrigger(store) {
6504 const open = store.useState("open");
6505 useIsoLayoutEffect(() => {
6506 if (open && !store.select("activeTriggerId") && store.context.triggerElements.size === 1) {
6507 const iteratorResult = store.context.triggerElements.entries().next();
6508 if (!iteratorResult.done) {
6509 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
6510 store.update({
6511 activeTriggerId: implicitTriggerId,
6512 activeTriggerElement: implicitTriggerElement
6513 });
6514 }
6515 }
6516 }, [open, store]);
6517 }
6518 function useOpenStateTransitions(open, store, onUnmount) {
6519 const {
6520 mounted,
6521 setMounted,
6522 transitionStatus
6523 } = useTransitionStatus(open);
6524 store.useSyncedValues({
6525 mounted,
6526 transitionStatus
6527 });
6528 const forceUnmount = useStableCallback(() => {
6529 setMounted(false);
6530 store.update({
6531 activeTriggerId: null,
6532 activeTriggerElement: null,
6533 mounted: false
6534 });
6535 onUnmount?.();
6536 store.context.onOpenChangeComplete?.(false);
6537 });
6538 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose");
6539 useOpenChangeComplete({
6540 enabled: !preventUnmountingOnClose,
6541 open,
6542 ref: store.context.popupRef,
6543 onComplete() {
6544 if (!open) {
6545 forceUnmount();
6546 }
6547 }
6548 });
6549 return {
6550 forceUnmount,
6551 transitionStatus
6552 };
6553 }
6554
6555 // node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js
6556 var PopupTriggerMap = class {
6557 constructor() {
6558 this.elementsSet = /* @__PURE__ */ new Set();
6559 this.idMap = /* @__PURE__ */ new Map();
6560 }
6561 /**
6562 * Adds a trigger element with the given ID.
6563 *
6564 * Note: The provided element is assumed to not be registered under multiple IDs.
6565 */
6566 add(id, element) {
6567 const existingElement = this.idMap.get(id);
6568 if (existingElement === element) {
6569 return;
6570 }
6571 if (existingElement !== void 0) {
6572 this.elementsSet.delete(existingElement);
6573 }
6574 this.elementsSet.add(element);
6575 this.idMap.set(id, element);
6576 if (true) {
6577 if (this.elementsSet.size !== this.idMap.size) {
6578 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
6579 }
6580 }
6581 }
6582 /**
6583 * Removes the trigger element with the given ID.
6584 */
6585 delete(id) {
6586 const element = this.idMap.get(id);
6587 if (element) {
6588 this.elementsSet.delete(element);
6589 this.idMap.delete(id);
6590 }
6591 }
6592 /**
6593 * Whether the given element is registered as a trigger.
6594 */
6595 hasElement(element) {
6596 return this.elementsSet.has(element);
6597 }
6598 /**
6599 * Whether there is a registered trigger element matching the given predicate.
6600 */
6601 hasMatchingElement(predicate) {
6602 for (const element of this.elementsSet) {
6603 if (predicate(element)) {
6604 return true;
6605 }
6606 }
6607 return false;
6608 }
6609 /**
6610 * Returns the trigger element associated with the given ID, or undefined if no such element exists.
6611 */
6612 getById(id) {
6613 return this.idMap.get(id);
6614 }
6615 /**
6616 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
6617 */
6618 entries() {
6619 return this.idMap.entries();
6620 }
6621 /**
6622 * Returns an iterable of all registered trigger elements.
6623 */
6624 elements() {
6625 return this.elementsSet.values();
6626 }
6627 /**
6628 * Returns the number of registered trigger elements.
6629 */
6630 get size() {
6631 return this.idMap.size;
6632 }
6633 };
6634
6635 // node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js
6636 function getEmptyRootContext() {
6637 return new FloatingRootStore({
6638 open: false,
6639 transitionStatus: void 0,
6640 floatingElement: null,
6641 referenceElement: null,
6642 triggerElements: new PopupTriggerMap(),
6643 floatingId: "",
6644 syncOnly: false,
6645 nested: false,
6646 onOpenChange: void 0
6647 });
6648 }
6649
6650 // node_modules/@base-ui/react/esm/utils/popups/store.js
6651 function createInitialPopupStoreState() {
6652 return {
6653 open: false,
6654 openProp: void 0,
6655 mounted: false,
6656 transitionStatus: void 0,
6657 floatingRootContext: getEmptyRootContext(),
6658 preventUnmountingOnClose: false,
6659 payload: void 0,
6660 activeTriggerId: null,
6661 activeTriggerElement: null,
6662 triggerIdProp: void 0,
6663 popupElement: null,
6664 positionerElement: null,
6665 activeTriggerProps: EMPTY_OBJECT,
6666 inactiveTriggerProps: EMPTY_OBJECT,
6667 popupProps: EMPTY_OBJECT
6668 };
6669 }
6670 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId);
6671 var popupStoreSelectors = {
6672 open: createSelector((state) => state.openProp ?? state.open),
6673 mounted: createSelector((state) => state.mounted),
6674 transitionStatus: createSelector((state) => state.transitionStatus),
6675 floatingRootContext: createSelector((state) => state.floatingRootContext),
6676 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose),
6677 payload: createSelector((state) => state.payload),
6678 activeTriggerId: activeTriggerIdSelector,
6679 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null),
6680 /**
6681 * Whether the trigger with the given ID was used to open the popup.
6682 */
6683 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId),
6684 /**
6685 * Whether the popup is open and was activated by a trigger with the given ID.
6686 */
6687 isOpenedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.open),
6688 /**
6689 * Whether the popup is mounted and was activated by a trigger with the given ID.
6690 */
6691 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted),
6692 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps),
6693 popupProps: createSelector((state) => state.popupProps),
6694 popupElement: createSelector((state) => state.popupElement),
6695 positionerElement: createSelector((state) => state.positionerElement)
6696 };
6697
6698 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js
6699 function useFloatingRootContext(options) {
6700 const {
6701 open = false,
6702 onOpenChange,
6703 elements = {}
6704 } = options;
6705 const floatingId = useId();
6706 const nested = useFloatingParentNodeId() != null;
6707 if (true) {
6708 const optionDomReference = elements.reference;
6709 if (optionDomReference && !isElement(optionDomReference)) {
6710 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
6711 }
6712 }
6713 const store = useRefWithInit(() => new FloatingRootStore({
6714 open,
6715 transitionStatus: void 0,
6716 onOpenChange,
6717 referenceElement: elements.reference ?? null,
6718 floatingElement: elements.floating ?? null,
6719 triggerElements: new PopupTriggerMap(),
6720 floatingId,
6721 syncOnly: false,
6722 nested
6723 })).current;
6724 useIsoLayoutEffect(() => {
6725 const valuesToSync = {
6726 open,
6727 floatingId
6728 };
6729 if (elements.reference !== void 0) {
6730 valuesToSync.referenceElement = elements.reference;
6731 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
6732 }
6733 if (elements.floating !== void 0) {
6734 valuesToSync.floatingElement = elements.floating;
6735 }
6736 store.update(valuesToSync);
6737 }, [open, floatingId, elements.reference, elements.floating, store]);
6738 store.context.onOpenChange = onOpenChange;
6739 store.context.nested = nested;
6740 return store;
6741 }
6742
6743 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js
6744 function useFloating2(options = {}) {
6745 const {
6746 nodeId,
6747 externalTree
6748 } = options;
6749 const internalRootStore = useFloatingRootContext(options);
6750 const rootContext = options.rootContext || internalRootStore;
6751 const rootContextElements = {
6752 reference: rootContext.useState("referenceElement"),
6753 floating: rootContext.useState("floatingElement"),
6754 domReference: rootContext.useState("domReferenceElement")
6755 };
6756 const [positionReference, setPositionReferenceRaw] = React32.useState(null);
6757 const domReferenceRef = React32.useRef(null);
6758 const tree = useFloatingTree(externalTree);
6759 useIsoLayoutEffect(() => {
6760 if (rootContextElements.domReference) {
6761 domReferenceRef.current = rootContextElements.domReference;
6762 }
6763 }, [rootContextElements.domReference]);
6764 const position = useFloating({
6765 ...options,
6766 elements: {
6767 ...rootContextElements,
6768 ...positionReference && {
6769 reference: positionReference
6770 }
6771 }
6772 });
6773 const setPositionReference = React32.useCallback((node) => {
6774 const computedPositionReference = isElement(node) ? {
6775 getBoundingClientRect: () => node.getBoundingClientRect(),
6776 getClientRects: () => node.getClientRects(),
6777 contextElement: node
6778 } : node;
6779 setPositionReferenceRaw(computedPositionReference);
6780 position.refs.setReference(computedPositionReference);
6781 }, [position.refs]);
6782 const [localDomReference, setLocalDomReference] = React32.useState(void 0);
6783 const [localFloatingElement, setLocalFloatingElement] = React32.useState(null);
6784 rootContext.useSyncedValue("referenceElement", localDomReference ?? null);
6785 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
6786 rootContext.useSyncedValue("domReferenceElement", localDomReference === void 0 ? rootContextElements.domReference : localDomReferenceElement);
6787 rootContext.useSyncedValue("floatingElement", localFloatingElement);
6788 const setReference = React32.useCallback((node) => {
6789 if (isElement(node) || node === null) {
6790 domReferenceRef.current = node;
6791 setLocalDomReference(node);
6792 }
6793 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
6794 // `null` to support `positionReference` + an unstable `reference`
6795 // callback ref.
6796 node !== null && !isElement(node)) {
6797 position.refs.setReference(node);
6798 }
6799 }, [position.refs, setLocalDomReference]);
6800 const setFloating = React32.useCallback((node) => {
6801 setLocalFloatingElement(node);
6802 position.refs.setFloating(node);
6803 }, [position.refs]);
6804 const refs = React32.useMemo(() => ({
6805 ...position.refs,
6806 setReference,
6807 setFloating,
6808 setPositionReference,
6809 domReference: domReferenceRef
6810 }), [position.refs, setReference, setFloating, setPositionReference]);
6811 const elements = React32.useMemo(() => ({
6812 ...position.elements,
6813 domReference: rootContextElements.domReference
6814 }), [position.elements, rootContextElements.domReference]);
6815 const open = rootContext.useState("open");
6816 const floatingId = rootContext.useState("floatingId");
6817 const context = React32.useMemo(() => ({
6818 ...position,
6819 dataRef: rootContext.context.dataRef,
6820 open,
6821 onOpenChange: rootContext.setOpen,
6822 events: rootContext.context.events,
6823 floatingId,
6824 refs,
6825 elements,
6826 nodeId,
6827 rootStore: rootContext
6828 }), [position, refs, elements, nodeId, rootContext, open, floatingId]);
6829 useIsoLayoutEffect(() => {
6830 rootContext.context.dataRef.current.floatingContext = context;
6831 const node = tree?.nodesRef.current.find((n2) => n2.id === nodeId);
6832 if (node) {
6833 node.context = context;
6834 }
6835 });
6836 return React32.useMemo(() => ({
6837 ...position,
6838 context,
6839 refs,
6840 elements,
6841 rootStore: rootContext
6842 }), [position, refs, elements, context, rootContext]);
6843 }
6844
6845 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js
6846 function useSyncedFloatingRootContext(options) {
6847 const {
6848 popupStore,
6849 treatPopupAsFloatingElement = false,
6850 onOpenChange
6851 } = options;
6852 const floatingId = useId();
6853 const nested = useFloatingParentNodeId() != null;
6854 const open = popupStore.useState("open");
6855 const referenceElement = popupStore.useState("activeTriggerElement");
6856 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
6857 const triggerElements = popupStore.context.triggerElements;
6858 const store = useRefWithInit(() => new FloatingRootStore({
6859 open,
6860 transitionStatus: void 0,
6861 referenceElement,
6862 floatingElement,
6863 triggerElements,
6864 onOpenChange,
6865 floatingId,
6866 syncOnly: true,
6867 nested
6868 })).current;
6869 useIsoLayoutEffect(() => {
6870 const valuesToSync = {
6871 open,
6872 floatingId,
6873 referenceElement,
6874 floatingElement
6875 };
6876 if (isElement(referenceElement)) {
6877 valuesToSync.domReferenceElement = referenceElement;
6878 }
6879 if (store.state.positionReference === store.state.referenceElement) {
6880 valuesToSync.positionReference = referenceElement;
6881 }
6882 store.update(valuesToSync);
6883 }, [open, floatingId, referenceElement, floatingElement, store]);
6884 store.context.onOpenChange = onOpenChange;
6885 store.context.nested = nested;
6886 return store;
6887 }
6888
6889 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js
6890 var React33 = __toESM(require_react(), 1);
6891 var isMacSafari = isMac && isSafari;
6892 function useFocus(context, props = {}) {
6893 const store = "rootStore" in context ? context.rootStore : context;
6894 const {
6895 events,
6896 dataRef
6897 } = store.context;
6898 const {
6899 enabled = true,
6900 delay
6901 } = props;
6902 const blockFocusRef = React33.useRef(false);
6903 const blockedReferenceRef = React33.useRef(null);
6904 const timeout = useTimeout();
6905 const keyboardModalityRef = React33.useRef(true);
6906 React33.useEffect(() => {
6907 const domReference = store.select("domReferenceElement");
6908 if (!enabled) {
6909 return void 0;
6910 }
6911 const win = getWindow(domReference);
6912 function onBlur() {
6913 const currentDomReference = store.select("domReferenceElement");
6914 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
6915 blockFocusRef.current = true;
6916 }
6917 }
6918 function onKeyDown() {
6919 keyboardModalityRef.current = true;
6920 }
6921 function onPointerDown() {
6922 keyboardModalityRef.current = false;
6923 }
6924 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
6925 }, [store, enabled]);
6926 React33.useEffect(() => {
6927 if (!enabled) {
6928 return void 0;
6929 }
6930 function onOpenChangeLocal(details) {
6931 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
6932 const referenceElement = store.select("domReferenceElement");
6933 if (isElement(referenceElement)) {
6934 blockedReferenceRef.current = referenceElement;
6935 blockFocusRef.current = true;
6936 }
6937 }
6938 }
6939 events.on("openchange", onOpenChangeLocal);
6940 return () => {
6941 events.off("openchange", onOpenChangeLocal);
6942 };
6943 }, [events, enabled, store]);
6944 const reference = React33.useMemo(() => ({
6945 onMouseLeave() {
6946 blockFocusRef.current = false;
6947 blockedReferenceRef.current = null;
6948 },
6949 onFocus(event) {
6950 const focusTarget = event.currentTarget;
6951 if (blockFocusRef.current) {
6952 if (blockedReferenceRef.current === focusTarget) {
6953 return;
6954 }
6955 blockFocusRef.current = false;
6956 blockedReferenceRef.current = null;
6957 }
6958 const target = getTarget(event.nativeEvent);
6959 if (isElement(target)) {
6960 if (isMacSafari && !event.relatedTarget) {
6961 if (!keyboardModalityRef.current && !isTypeableElement(target)) {
6962 return;
6963 }
6964 } else if (!matchesFocusVisible(target)) {
6965 return;
6966 }
6967 }
6968 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements);
6969 const {
6970 nativeEvent,
6971 currentTarget
6972 } = event;
6973 const delayValue = typeof delay === "function" ? delay() : delay;
6974 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
6975 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6976 return;
6977 }
6978 timeout.start(delayValue, () => {
6979 if (blockFocusRef.current) {
6980 return;
6981 }
6982 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6983 });
6984 },
6985 onBlur(event) {
6986 blockFocusRef.current = false;
6987 blockedReferenceRef.current = null;
6988 const relatedTarget = event.relatedTarget;
6989 const nativeEvent = event.nativeEvent;
6990 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
6991 timeout.start(0, () => {
6992 const domReference = store.select("domReferenceElement");
6993 const activeEl = activeElement(ownerDocument(domReference));
6994 if (!relatedTarget && activeEl === domReference) {
6995 return;
6996 }
6997 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
6998 return;
6999 }
7000 const nextFocusedElement = relatedTarget ?? activeEl;
7001 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) {
7002 return;
7003 }
7004 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
7005 });
7006 }
7007 }), [dataRef, store, timeout, delay]);
7008 return React33.useMemo(() => enabled ? {
7009 reference,
7010 trigger: reference
7011 } : {}, [enabled, reference]);
7012 }
7013
7014 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js
7015 var React34 = __toESM(require_react(), 1);
7016
7017 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js
7018 var HoverInteraction = class _HoverInteraction {
7019 constructor() {
7020 this.pointerType = void 0;
7021 this.interactedInside = false;
7022 this.handler = void 0;
7023 this.blockMouseMove = true;
7024 this.performedPointerEventsMutation = false;
7025 this.pointerEventsScopeElement = null;
7026 this.pointerEventsReferenceElement = null;
7027 this.pointerEventsFloatingElement = null;
7028 this.restTimeoutPending = false;
7029 this.openChangeTimeout = new Timeout();
7030 this.restTimeout = new Timeout();
7031 this.handleCloseOptions = void 0;
7032 }
7033 static create() {
7034 return new _HoverInteraction();
7035 }
7036 dispose = () => {
7037 this.openChangeTimeout.clear();
7038 this.restTimeout.clear();
7039 };
7040 disposeEffect = () => {
7041 return this.dispose;
7042 };
7043 };
7044 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
7045 function clearSafePolygonPointerEventsMutation(instance) {
7046 if (!instance.performedPointerEventsMutation) {
7047 return;
7048 }
7049 const scopeElement = instance.pointerEventsScopeElement;
7050 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
7051 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
7052 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
7053 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
7054 pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
7055 }
7056 instance.performedPointerEventsMutation = false;
7057 instance.pointerEventsScopeElement = null;
7058 instance.pointerEventsReferenceElement = null;
7059 instance.pointerEventsFloatingElement = null;
7060 }
7061 function applySafePolygonPointerEventsMutation(instance, options) {
7062 const {
7063 scopeElement,
7064 referenceElement,
7065 floatingElement
7066 } = options;
7067 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
7068 if (existingOwner && existingOwner !== instance) {
7069 clearSafePolygonPointerEventsMutation(existingOwner);
7070 }
7071 clearSafePolygonPointerEventsMutation(instance);
7072 instance.performedPointerEventsMutation = true;
7073 instance.pointerEventsScopeElement = scopeElement;
7074 instance.pointerEventsReferenceElement = referenceElement;
7075 instance.pointerEventsFloatingElement = floatingElement;
7076 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
7077 scopeElement.style.pointerEvents = "none";
7078 referenceElement.style.pointerEvents = "auto";
7079 floatingElement.style.pointerEvents = "auto";
7080 }
7081 function useHoverInteractionSharedState(store) {
7082 const instance = useRefWithInit(HoverInteraction.create).current;
7083 const data = store.context.dataRef.current;
7084 if (!data.hoverInteractionState) {
7085 data.hoverInteractionState = instance;
7086 }
7087 useOnMount(data.hoverInteractionState.disposeEffect);
7088 return data.hoverInteractionState;
7089 }
7090
7091 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js
7092 function useHoverFloatingInteraction(context, parameters = {}) {
7093 const store = "rootStore" in context ? context.rootStore : context;
7094 const open = store.useState("open");
7095 const floatingElement = store.useState("floatingElement");
7096 const domReferenceElement = store.useState("domReferenceElement");
7097 const {
7098 dataRef
7099 } = store.context;
7100 const {
7101 enabled = true,
7102 closeDelay: closeDelayProp = 0,
7103 nodeId: nodeIdProp
7104 } = parameters;
7105 const instance = useHoverInteractionSharedState(store);
7106 const tree = useFloatingTree();
7107 const parentId = useFloatingParentNodeId();
7108 const isClickLikeOpenEvent2 = useStableCallback(() => {
7109 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7110 });
7111 const isHoverOpen = useStableCallback(() => {
7112 const type = dataRef.current.openEvent?.type;
7113 return type?.includes("mouse") && type !== "mousedown";
7114 });
7115 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => {
7116 return isTargetInsideEnabledTrigger(target, store.context.triggerElements);
7117 });
7118 const closeWithDelay = React34.useCallback((event) => {
7119 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
7120 const close = () => {
7121 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7122 tree?.events.emit("floating.closed", event);
7123 };
7124 if (closeDelay) {
7125 instance.openChangeTimeout.start(closeDelay, close);
7126 } else {
7127 instance.openChangeTimeout.clear();
7128 close();
7129 }
7130 }, [closeDelayProp, store, instance, tree]);
7131 const clearPointerEvents = useStableCallback(() => {
7132 clearSafePolygonPointerEventsMutation(instance);
7133 });
7134 const handleInteractInside = useStableCallback((event) => {
7135 const target = getTarget(event);
7136 if (!isInteractiveElement(target)) {
7137 instance.interactedInside = false;
7138 return;
7139 }
7140 instance.interactedInside = target?.closest("[aria-haspopup]") != null;
7141 });
7142 useIsoLayoutEffect(() => {
7143 if (!open) {
7144 instance.pointerType = void 0;
7145 instance.restTimeoutPending = false;
7146 instance.interactedInside = false;
7147 clearPointerEvents();
7148 }
7149 }, [open, instance, clearPointerEvents]);
7150 React34.useEffect(() => {
7151 return clearPointerEvents;
7152 }, [clearPointerEvents]);
7153 useIsoLayoutEffect(() => {
7154 if (!enabled) {
7155 return void 0;
7156 }
7157 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
7158 const ref = domReferenceElement;
7159 const floatingEl = floatingElement;
7160 const doc = ownerDocument(floatingElement);
7161 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
7162 if (parentFloating) {
7163 parentFloating.style.pointerEvents = "";
7164 }
7165 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? instance.pointerEventsScopeElement ?? parentFloating ?? ref.closest("[data-rootownerid]") ?? doc.body;
7166 applySafePolygonPointerEventsMutation(instance, {
7167 scopeElement,
7168 referenceElement: ref,
7169 floatingElement: floatingEl
7170 });
7171 return () => {
7172 clearPointerEvents();
7173 };
7174 }
7175 return void 0;
7176 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
7177 const childClosedTimeout = useTimeout();
7178 React34.useEffect(() => {
7179 if (!enabled) {
7180 return void 0;
7181 }
7182 function onFloatingMouseEnter() {
7183 instance.openChangeTimeout.clear();
7184 childClosedTimeout.clear();
7185 tree?.events.off("floating.closed", onNodeClosed);
7186 clearPointerEvents();
7187 }
7188 function onFloatingMouseLeave(event) {
7189 if (tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0) {
7190 tree.events.on("floating.closed", onNodeClosed);
7191 return;
7192 }
7193 if (isRelatedTargetInsideEnabledTrigger(event.relatedTarget)) {
7194 return;
7195 }
7196 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
7197 const relatedTarget = event.relatedTarget;
7198 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
7199 if (isMovingIntoDescendantFloating) {
7200 return;
7201 }
7202 if (instance.handler) {
7203 instance.handler(event);
7204 return;
7205 }
7206 clearPointerEvents();
7207 if (!isClickLikeOpenEvent2()) {
7208 closeWithDelay(event);
7209 }
7210 }
7211 function onNodeClosed(event) {
7212 if (!tree || !parentId || getNodeChildren(tree.nodesRef.current, parentId).length > 0) {
7213 return;
7214 }
7215 childClosedTimeout.start(0, () => {
7216 tree.events.off("floating.closed", onNodeClosed);
7217 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7218 tree.events.emit("floating.closed", event);
7219 });
7220 }
7221 const floating = floatingElement;
7222 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
7223 tree?.events.off("floating.closed", onNodeClosed);
7224 });
7225 }, [enabled, floatingElement, store, dataRef, nodeIdProp, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, closeWithDelay, clearPointerEvents, handleInteractInside, instance, tree, parentId, childClosedTimeout]);
7226 }
7227
7228 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js
7229 var React35 = __toESM(require_react(), 1);
7230 var ReactDOM4 = __toESM(require_react_dom(), 1);
7231 var EMPTY_REF = {
7232 current: null
7233 };
7234 function useHoverReferenceInteraction(context, props = {}) {
7235 const store = "rootStore" in context ? context.rootStore : context;
7236 const {
7237 dataRef,
7238 events
7239 } = store.context;
7240 const {
7241 enabled = true,
7242 delay = 0,
7243 handleClose = null,
7244 mouseOnly = false,
7245 restMs = 0,
7246 move = true,
7247 triggerElementRef = EMPTY_REF,
7248 externalTree,
7249 isActiveTrigger = true,
7250 getHandleCloseContext,
7251 isClosing
7252 } = props;
7253 const tree = useFloatingTree(externalTree);
7254 const instance = useHoverInteractionSharedState(store);
7255 const isHoverCloseActiveRef = React35.useRef(false);
7256 const handleCloseRef = useValueAsRef(handleClose);
7257 const delayRef = useValueAsRef(delay);
7258 const restMsRef = useValueAsRef(restMs);
7259 const enabledRef = useValueAsRef(enabled);
7260 const isClosingRef = useValueAsRef(isClosing);
7261 if (isActiveTrigger) {
7262 instance.handleCloseOptions = handleCloseRef.current?.__options;
7263 }
7264 const isClickLikeOpenEvent2 = useStableCallback(() => {
7265 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7266 });
7267 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => {
7268 return isTargetInsideEnabledTrigger(target, store.context.triggerElements);
7269 });
7270 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
7271 const allTriggers = store.context.triggerElements;
7272 if (allTriggers.hasElement(currentTarget)) {
7273 return !currentDomReference || !contains(currentDomReference, currentTarget);
7274 }
7275 if (!isElement(target)) {
7276 return false;
7277 }
7278 const targetElement = target;
7279 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
7280 });
7281 const closeWithDelay = useStableCallback((event, runElseBranch = true) => {
7282 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
7283 if (closeDelay) {
7284 instance.openChangeTimeout.start(closeDelay, () => {
7285 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7286 tree?.events.emit("floating.closed", event);
7287 });
7288 } else if (runElseBranch) {
7289 instance.openChangeTimeout.clear();
7290 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7291 tree?.events.emit("floating.closed", event);
7292 }
7293 });
7294 const cleanupMouseMoveHandler = useStableCallback(() => {
7295 if (!instance.handler) {
7296 return;
7297 }
7298 const doc = ownerDocument(store.select("domReferenceElement"));
7299 doc.removeEventListener("mousemove", instance.handler);
7300 instance.handler = void 0;
7301 });
7302 const clearPointerEvents = useStableCallback(() => {
7303 clearSafePolygonPointerEventsMutation(instance);
7304 });
7305 React35.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
7306 React35.useEffect(() => {
7307 if (!enabled) {
7308 return void 0;
7309 }
7310 function onOpenChangeLocal(details) {
7311 if (!details.open) {
7312 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
7313 cleanupMouseMoveHandler();
7314 instance.openChangeTimeout.clear();
7315 instance.restTimeout.clear();
7316 instance.blockMouseMove = true;
7317 instance.restTimeoutPending = false;
7318 } else {
7319 isHoverCloseActiveRef.current = false;
7320 }
7321 }
7322 events.on("openchange", onOpenChangeLocal);
7323 return () => {
7324 events.off("openchange", onOpenChangeLocal);
7325 };
7326 }, [enabled, events, instance, cleanupMouseMoveHandler]);
7327 React35.useEffect(() => {
7328 if (!enabled) {
7329 return void 0;
7330 }
7331 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null);
7332 if (!isElement(trigger)) {
7333 return void 0;
7334 }
7335 function onMouseEnter(event) {
7336 instance.openChangeTimeout.clear();
7337 instance.blockMouseMove = false;
7338 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7339 return;
7340 }
7341 const restMsValue = getRestMs(restMsRef.current);
7342 const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
7343 const eventTarget = getTarget(event);
7344 const currentTarget = event.currentTarget ?? null;
7345 const currentDomReference = store.select("domReferenceElement");
7346 let triggerNode = currentTarget;
7347 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {
7348 for (const triggerElement of store.context.triggerElements.elements()) {
7349 if (contains(triggerElement, eventTarget)) {
7350 triggerNode = triggerElement;
7351 break;
7352 }
7353 }
7354 }
7355 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
7356 triggerNode = currentDomReference;
7357 }
7358 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
7359 const isOpen = store.select("open");
7360 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending";
7361 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
7362 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
7363 const isRestOnlyDelay = restMsValue > 0 && !openDelay;
7364 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
7365 const shouldOpen = !isOpen || isOverInactive;
7366 if (shouldOpenImmediately) {
7367 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7368 return;
7369 }
7370 if (isRestOnlyDelay) {
7371 return;
7372 }
7373 if (openDelay) {
7374 instance.openChangeTimeout.start(openDelay, () => {
7375 if (shouldOpen) {
7376 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7377 }
7378 });
7379 } else if (shouldOpen) {
7380 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7381 }
7382 }
7383 function onMouseLeave(event) {
7384 if (isClickLikeOpenEvent2()) {
7385 clearPointerEvents();
7386 return;
7387 }
7388 cleanupMouseMoveHandler();
7389 const domReferenceElement = store.select("domReferenceElement");
7390 const doc = ownerDocument(domReferenceElement);
7391 instance.restTimeout.clear();
7392 instance.restTimeoutPending = false;
7393 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
7394 const ignoreRelatedTargetTrigger = isRelatedTargetInsideEnabledTrigger(event.relatedTarget);
7395 if (ignoreRelatedTargetTrigger) {
7396 return;
7397 }
7398 if (handleCloseRef.current && handleCloseContextBase) {
7399 if (!store.select("open")) {
7400 instance.openChangeTimeout.clear();
7401 }
7402 const currentTrigger = triggerElementRef.current;
7403 instance.handler = handleCloseRef.current({
7404 ...handleCloseContextBase,
7405 tree,
7406 x: event.clientX,
7407 y: event.clientY,
7408 onClose() {
7409 clearPointerEvents();
7410 cleanupMouseMoveHandler();
7411 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) {
7412 closeWithDelay(event, true);
7413 }
7414 }
7415 });
7416 doc.addEventListener("mousemove", instance.handler);
7417 instance.handler(event);
7418 return;
7419 }
7420 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true;
7421 if (shouldClose) {
7422 closeWithDelay(event);
7423 }
7424 }
7425 if (move) {
7426 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
7427 once: true
7428 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
7429 }
7430 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave));
7431 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, closeWithDelay, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef]);
7432 return React35.useMemo(() => {
7433 if (!enabled) {
7434 return void 0;
7435 }
7436 function setPointerRef(event) {
7437 instance.pointerType = event.pointerType;
7438 }
7439 return {
7440 onPointerDown: setPointerRef,
7441 onPointerEnter: setPointerRef,
7442 onMouseMove(event) {
7443 const {
7444 nativeEvent
7445 } = event;
7446 const trigger = event.currentTarget;
7447 const currentDomReference = store.select("domReferenceElement");
7448 const currentOpen = store.select("open");
7449 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
7450 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7451 return;
7452 }
7453 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
7454 const floatingElement = store.select("floatingElement");
7455 if (floatingElement) {
7456 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
7457 applySafePolygonPointerEventsMutation(instance, {
7458 scopeElement,
7459 referenceElement: trigger,
7460 floatingElement
7461 });
7462 }
7463 }
7464 const restMsValue = getRestMs(restMsRef.current);
7465 if (currentOpen && !isOverInactive || restMsValue === 0) {
7466 return;
7467 }
7468 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
7469 return;
7470 }
7471 instance.restTimeout.clear();
7472 function handleMouseMove() {
7473 instance.restTimeoutPending = false;
7474 if (isClickLikeOpenEvent2()) {
7475 return;
7476 }
7477 const latestOpen = store.select("open");
7478 if (!instance.blockMouseMove && (!latestOpen || isOverInactive)) {
7479 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
7480 }
7481 }
7482 if (instance.pointerType === "touch") {
7483 ReactDOM4.flushSync(() => {
7484 handleMouseMove();
7485 });
7486 } else if (isOverInactive && currentOpen) {
7487 handleMouseMove();
7488 } else {
7489 instance.restTimeoutPending = true;
7490 instance.restTimeout.start(restMsValue, handleMouseMove);
7491 }
7492 }
7493 };
7494 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef]);
7495 }
7496
7497 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useInteractions.js
7498 var React36 = __toESM(require_react(), 1);
7499 function useInteractions(propsList = []) {
7500 const referenceDeps = propsList.map((key) => key?.reference);
7501 const floatingDeps = propsList.map((key) => key?.floating);
7502 const itemDeps = propsList.map((key) => key?.item);
7503 const triggerDeps = propsList.map((key) => key?.trigger);
7504 const getReferenceProps = React36.useCallback(
7505 (userProps) => mergeProps2(userProps, propsList, "reference"),
7506 // eslint-disable-next-line react-hooks/exhaustive-deps
7507 referenceDeps
7508 );
7509 const getFloatingProps = React36.useCallback(
7510 (userProps) => mergeProps2(userProps, propsList, "floating"),
7511 // eslint-disable-next-line react-hooks/exhaustive-deps
7512 floatingDeps
7513 );
7514 const getItemProps = React36.useCallback(
7515 (userProps) => mergeProps2(userProps, propsList, "item"),
7516 // eslint-disable-next-line react-hooks/exhaustive-deps
7517 itemDeps
7518 );
7519 const getTriggerProps = React36.useCallback(
7520 (userProps) => mergeProps2(userProps, propsList, "trigger"),
7521 // eslint-disable-next-line react-hooks/exhaustive-deps
7522 triggerDeps
7523 );
7524 return React36.useMemo(() => ({
7525 getReferenceProps,
7526 getFloatingProps,
7527 getItemProps,
7528 getTriggerProps
7529 }), [getReferenceProps, getFloatingProps, getItemProps, getTriggerProps]);
7530 }
7531 function mergeProps2(userProps, propsList, elementKey) {
7532 const eventHandlers = /* @__PURE__ */ new Map();
7533 const isItem2 = elementKey === "item";
7534 const outputProps = {};
7535 if (elementKey === "floating") {
7536 outputProps.tabIndex = -1;
7537 outputProps[FOCUSABLE_ATTRIBUTE] = "";
7538 }
7539 for (const key in userProps) {
7540 if (isItem2 && userProps) {
7541 if (key === ACTIVE_KEY || key === SELECTED_KEY) {
7542 continue;
7543 }
7544 }
7545 outputProps[key] = userProps[key];
7546 }
7547 for (let i2 = 0; i2 < propsList.length; i2 += 1) {
7548 let props;
7549 const propsOrGetProps = propsList[i2]?.[elementKey];
7550 if (typeof propsOrGetProps === "function") {
7551 props = userProps ? propsOrGetProps(userProps) : null;
7552 } else {
7553 props = propsOrGetProps;
7554 }
7555 if (!props) {
7556 continue;
7557 }
7558 mutablyMergeProps(outputProps, props, isItem2, eventHandlers);
7559 }
7560 mutablyMergeProps(outputProps, userProps, isItem2, eventHandlers);
7561 return outputProps;
7562 }
7563 function mutablyMergeProps(outputProps, props, isItem2, eventHandlers) {
7564 for (const key in props) {
7565 const value = props[key];
7566 if (isItem2 && (key === ACTIVE_KEY || key === SELECTED_KEY)) {
7567 continue;
7568 }
7569 if (!key.startsWith("on")) {
7570 outputProps[key] = value;
7571 } else {
7572 if (!eventHandlers.has(key)) {
7573 eventHandlers.set(key, []);
7574 }
7575 if (typeof value === "function") {
7576 eventHandlers.get(key)?.push(value);
7577 outputProps[key] = (...args) => {
7578 return eventHandlers.get(key)?.map((fn) => fn(...args)).find((val) => val !== void 0);
7579 };
7580 }
7581 }
7582 }
7583 }
7584
7585 // node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js
7586 var CURSOR_SPEED_THRESHOLD = 0.1;
7587 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
7588 var POLYGON_BUFFER = 0.5;
7589 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
7590 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
7591 }
7592 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
7593 let isInsideValue = false;
7594 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
7595 isInsideValue = !isInsideValue;
7596 }
7597 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
7598 isInsideValue = !isInsideValue;
7599 }
7600 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
7601 isInsideValue = !isInsideValue;
7602 }
7603 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
7604 isInsideValue = !isInsideValue;
7605 }
7606 return isInsideValue;
7607 }
7608 function isInsideRect(pointX, pointY, rect) {
7609 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
7610 }
7611 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
7612 const minX = Math.min(x1, x2);
7613 const maxX = Math.max(x1, x2);
7614 const minY = Math.min(y1, y2);
7615 const maxY = Math.max(y1, y2);
7616 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
7617 }
7618 function safePolygon(options = {}) {
7619 const {
7620 blockPointerEvents = false
7621 } = options;
7622 const timeout = new Timeout();
7623 const fn = ({
7624 x: x2,
7625 y: y2,
7626 placement,
7627 elements,
7628 onClose,
7629 nodeId,
7630 tree
7631 }) => {
7632 const side = placement?.split("-")[0];
7633 let hasLanded = false;
7634 let lastX = null;
7635 let lastY = null;
7636 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
7637 function isCursorMovingSlowly(nextX, nextY) {
7638 const currentTime = performance.now();
7639 const elapsedTime = currentTime - lastCursorTime;
7640 if (lastX === null || lastY === null || elapsedTime === 0) {
7641 lastX = nextX;
7642 lastY = nextY;
7643 lastCursorTime = currentTime;
7644 return false;
7645 }
7646 const deltaX = nextX - lastX;
7647 const deltaY = nextY - lastY;
7648 const distanceSquared = deltaX * deltaX + deltaY * deltaY;
7649 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
7650 lastX = nextX;
7651 lastY = nextY;
7652 lastCursorTime = currentTime;
7653 return distanceSquared < thresholdSquared;
7654 }
7655 function close() {
7656 timeout.clear();
7657 onClose();
7658 }
7659 return function onMouseMove(event) {
7660 timeout.clear();
7661 const domReference = elements.domReference;
7662 const floating = elements.floating;
7663 if (!domReference || !floating || side == null || x2 == null || y2 == null) {
7664 return void 0;
7665 }
7666 const {
7667 clientX,
7668 clientY
7669 } = event;
7670 const target = getTarget(event);
7671 const isLeave = event.type === "mouseleave";
7672 const isOverFloatingEl = contains(floating, target);
7673 const isOverReferenceEl = contains(domReference, target);
7674 if (isOverFloatingEl) {
7675 hasLanded = true;
7676 if (!isLeave) {
7677 return void 0;
7678 }
7679 }
7680 if (isOverReferenceEl) {
7681 hasLanded = false;
7682 if (!isLeave) {
7683 hasLanded = true;
7684 return void 0;
7685 }
7686 }
7687 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
7688 return void 0;
7689 }
7690 function hasOpenChildNode() {
7691 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
7692 }
7693 function closeIfNoOpenChild() {
7694 if (!hasOpenChildNode()) {
7695 close();
7696 }
7697 }
7698 if (hasOpenChildNode()) {
7699 return void 0;
7700 }
7701 const refRect = domReference.getBoundingClientRect();
7702 const rect = floating.getBoundingClientRect();
7703 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2;
7704 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2;
7705 const isFloatingWider = rect.width > refRect.width;
7706 const isFloatingTaller = rect.height > refRect.height;
7707 const left = (isFloatingWider ? refRect : rect).left;
7708 const right = (isFloatingWider ? refRect : rect).right;
7709 const top = (isFloatingTaller ? refRect : rect).top;
7710 const bottom = (isFloatingTaller ? refRect : rect).bottom;
7711 if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) {
7712 closeIfNoOpenChild();
7713 return void 0;
7714 }
7715 let isInsideTroughRect = false;
7716 switch (side) {
7717 case "top":
7718 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
7719 break;
7720 case "bottom":
7721 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
7722 break;
7723 case "left":
7724 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
7725 break;
7726 case "right":
7727 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
7728 break;
7729 default:
7730 }
7731 if (isInsideTroughRect) {
7732 return void 0;
7733 }
7734 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
7735 closeIfNoOpenChild();
7736 return void 0;
7737 }
7738 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
7739 closeIfNoOpenChild();
7740 return void 0;
7741 }
7742 let isInsidePolygon = false;
7743 switch (side) {
7744 case "top": {
7745 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7746 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7747 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7748 const cursorPointY = y2 + POLYGON_BUFFER + 1;
7749 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
7750 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
7751 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7752 break;
7753 }
7754 case "bottom": {
7755 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7756 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7757 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7758 const cursorPointY = y2 - POLYGON_BUFFER;
7759 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
7760 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
7761 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7762 break;
7763 }
7764 case "left": {
7765 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7766 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7767 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7768 const cursorPointX = x2 + POLYGON_BUFFER + 1;
7769 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
7770 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
7771 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
7772 break;
7773 }
7774 case "right": {
7775 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7776 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7777 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7778 const cursorPointX = x2 - POLYGON_BUFFER;
7779 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
7780 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
7781 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
7782 break;
7783 }
7784 default:
7785 }
7786 if (!isInsidePolygon) {
7787 closeIfNoOpenChild();
7788 } else if (!hasLanded) {
7789 timeout.start(40, closeIfNoOpenChild);
7790 }
7791 return void 0;
7792 };
7793 };
7794 fn.__options = {
7795 ...options,
7796 blockPointerEvents
7797 };
7798 return fn;
7799 }
7800
7801 // node_modules/@base-ui/react/esm/utils/popupStateMapping.js
7802 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) {
7803 CommonPopupDataAttributes2["open"] = "data-open";
7804 CommonPopupDataAttributes2["closed"] = "data-closed";
7805 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
7806 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
7807 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden";
7808 CommonPopupDataAttributes2["side"] = "data-side";
7809 CommonPopupDataAttributes2["align"] = "data-align";
7810 return CommonPopupDataAttributes2;
7811 })({});
7812 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) {
7813 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open";
7814 CommonTriggerDataAttributes2["pressed"] = "data-pressed";
7815 return CommonTriggerDataAttributes2;
7816 })({});
7817 var TRIGGER_HOOK = {
7818 [CommonTriggerDataAttributes.popupOpen]: ""
7819 };
7820 var PRESSABLE_TRIGGER_HOOK = {
7821 [CommonTriggerDataAttributes.popupOpen]: "",
7822 [CommonTriggerDataAttributes.pressed]: ""
7823 };
7824 var POPUP_OPEN_HOOK = {
7825 [CommonPopupDataAttributes.open]: ""
7826 };
7827 var POPUP_CLOSED_HOOK = {
7828 [CommonPopupDataAttributes.closed]: ""
7829 };
7830 var ANCHOR_HIDDEN_HOOK = {
7831 [CommonPopupDataAttributes.anchorHidden]: ""
7832 };
7833 var triggerOpenStateMapping2 = {
7834 open(value) {
7835 if (value) {
7836 return TRIGGER_HOOK;
7837 }
7838 return null;
7839 }
7840 };
7841 var popupStateMapping = {
7842 open(value) {
7843 if (value) {
7844 return POPUP_OPEN_HOOK;
7845 }
7846 return POPUP_CLOSED_HOOK;
7847 },
7848 anchorHidden(value) {
7849 if (value) {
7850 return ANCHOR_HIDDEN_HOOK;
7851 }
7852 return null;
7853 }
7854 };
7855
7856 // node_modules/@base-ui/utils/esm/inertValue.js
7857 function inertValue(value) {
7858 if (isReactVersionAtLeast(19)) {
7859 return value;
7860 }
7861 return value ? "true" : void 0;
7862 }
7863
7864 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js
7865 var React37 = __toESM(require_react(), 1);
7866
7867 // node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js
7868 var baseArrow = (options) => ({
7869 name: "arrow",
7870 options,
7871 async fn(state) {
7872 const {
7873 x: x2,
7874 y: y2,
7875 placement,
7876 rects,
7877 platform: platform3,
7878 elements,
7879 middlewareData
7880 } = state;
7881 const {
7882 element,
7883 padding = 0,
7884 offsetParent = "real"
7885 } = evaluate(options, state) || {};
7886 if (element == null) {
7887 return {};
7888 }
7889 const paddingObject = getPaddingObject(padding);
7890 const coords = {
7891 x: x2,
7892 y: y2
7893 };
7894 const axis = getAlignmentAxis(placement);
7895 const length = getAxisLength(axis);
7896 const arrowDimensions = await platform3.getDimensions(element);
7897 const isYAxis = axis === "y";
7898 const minProp = isYAxis ? "top" : "left";
7899 const maxProp = isYAxis ? "bottom" : "right";
7900 const clientProp = isYAxis ? "clientHeight" : "clientWidth";
7901 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
7902 const startDiff = coords[axis] - rects.reference[axis];
7903 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
7904 let clientSize = elements.floating[clientProp] || rects.floating[length];
7905 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
7906 clientSize = elements.floating[clientProp] || rects.floating[length];
7907 }
7908 const centerToReference = endDiff / 2 - startDiff / 2;
7909 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
7910 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
7911 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
7912 const min2 = minPadding;
7913 const max2 = clientSize - arrowDimensions[length] - maxPadding;
7914 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
7915 const offset4 = clamp(min2, center, max2);
7916 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
7917 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0;
7918 return {
7919 [axis]: coords[axis] + alignmentOffset,
7920 data: {
7921 [axis]: offset4,
7922 centerOffset: center - offset4 - alignmentOffset,
7923 ...shouldAddOffset && {
7924 alignmentOffset
7925 }
7926 },
7927 reset: shouldAddOffset
7928 };
7929 }
7930 });
7931 var arrow4 = (options, deps) => ({
7932 ...baseArrow(options),
7933 options: [options, deps]
7934 });
7935
7936 // node_modules/@base-ui/react/esm/utils/hideMiddleware.js
7937 var hide4 = {
7938 name: "hide",
7939 async fn(state) {
7940 const {
7941 width,
7942 height,
7943 x: x2,
7944 y: y2
7945 } = state.rects.reference;
7946 const anchorHidden = width === 0 && height === 0 && x2 === 0 && y2 === 0;
7947 const nativeHideResult = await hide3().fn(state);
7948 return {
7949 data: {
7950 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden
7951 }
7952 };
7953 }
7954 };
7955
7956 // node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js
7957 var DEFAULT_SIDES = {
7958 sideX: "left",
7959 sideY: "top"
7960 };
7961 var adaptiveOrigin = {
7962 name: "adaptiveOrigin",
7963 async fn(state) {
7964 const {
7965 x: rawX,
7966 y: rawY,
7967 rects: {
7968 floating: floatRect
7969 },
7970 elements: {
7971 floating
7972 },
7973 platform: platform3,
7974 strategy,
7975 placement
7976 } = state;
7977 const win = getWindow(floating);
7978 const styles = win.getComputedStyle(floating);
7979 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
7980 if (!hasTransition) {
7981 return {
7982 x: rawX,
7983 y: rawY,
7984 data: DEFAULT_SIDES
7985 };
7986 }
7987 const offsetParent = await platform3.getOffsetParent?.(floating);
7988 let offsetDimensions = {
7989 width: 0,
7990 height: 0
7991 };
7992 if (strategy === "fixed" && win?.visualViewport) {
7993 offsetDimensions = {
7994 width: win.visualViewport.width,
7995 height: win.visualViewport.height
7996 };
7997 } else if (offsetParent === win) {
7998 const doc = ownerDocument(floating);
7999 offsetDimensions = {
8000 width: doc.documentElement.clientWidth,
8001 height: doc.documentElement.clientHeight
8002 };
8003 } else if (await platform3.isElement?.(offsetParent)) {
8004 offsetDimensions = await platform3.getDimensions(offsetParent);
8005 }
8006 const currentSide = getSide(placement);
8007 let x2 = rawX;
8008 let y2 = rawY;
8009 if (currentSide === "left") {
8010 x2 = offsetDimensions.width - (rawX + floatRect.width);
8011 }
8012 if (currentSide === "top") {
8013 y2 = offsetDimensions.height - (rawY + floatRect.height);
8014 }
8015 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
8016 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
8017 return {
8018 x: x2,
8019 y: y2,
8020 data: {
8021 sideX,
8022 sideY
8023 }
8024 };
8025 }
8026 };
8027
8028 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js
8029 function getLogicalSide(sideParam, renderedSide, isRtl) {
8030 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
8031 const logicalRight = isRtl ? "inline-start" : "inline-end";
8032 const logicalLeft = isRtl ? "inline-end" : "inline-start";
8033 return {
8034 top: "top",
8035 right: isLogicalSideParam ? logicalRight : "right",
8036 bottom: "bottom",
8037 left: isLogicalSideParam ? logicalLeft : "left"
8038 }[renderedSide];
8039 }
8040 function getOffsetData(state, sideParam, isRtl) {
8041 const {
8042 rects,
8043 placement
8044 } = state;
8045 const data = {
8046 side: getLogicalSide(sideParam, getSide(placement), isRtl),
8047 align: getAlignment(placement) || "center",
8048 anchor: {
8049 width: rects.reference.width,
8050 height: rects.reference.height
8051 },
8052 positioner: {
8053 width: rects.floating.width,
8054 height: rects.floating.height
8055 }
8056 };
8057 return data;
8058 }
8059 function useAnchorPositioning(params) {
8060 const {
8061 // Public parameters
8062 anchor,
8063 positionMethod = "absolute",
8064 side: sideParam = "bottom",
8065 sideOffset = 0,
8066 align = "center",
8067 alignOffset = 0,
8068 collisionBoundary,
8069 collisionPadding: collisionPaddingParam = 5,
8070 sticky = false,
8071 arrowPadding = 5,
8072 disableAnchorTracking = false,
8073 // Private parameters
8074 keepMounted = false,
8075 floatingRootContext,
8076 mounted,
8077 collisionAvoidance,
8078 shiftCrossAxis = false,
8079 nodeId,
8080 adaptiveOrigin: adaptiveOrigin2,
8081 lazyFlip = false,
8082 externalTree
8083 } = params;
8084 const [mountSide, setMountSide] = React37.useState(null);
8085 if (!mounted && mountSide !== null) {
8086 setMountSide(null);
8087 }
8088 const collisionAvoidanceSide = collisionAvoidance.side || "flip";
8089 const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
8090 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
8091 const anchorFn = typeof anchor === "function" ? anchor : void 0;
8092 const anchorFnCallback = useStableCallback(anchorFn);
8093 const anchorDep = anchorFn ? anchorFnCallback : anchor;
8094 const anchorValueRef = useValueAsRef(anchor);
8095 const mountedRef = useValueAsRef(mounted);
8096 const direction = useDirection();
8097 const isRtl = direction === "rtl";
8098 const side = mountSide || {
8099 top: "top",
8100 right: "right",
8101 bottom: "bottom",
8102 left: "left",
8103 "inline-end": isRtl ? "left" : "right",
8104 "inline-start": isRtl ? "right" : "left"
8105 }[sideParam];
8106 const placement = align === "center" ? side : `${side}-${align}`;
8107 let collisionPadding = collisionPaddingParam;
8108 const bias = 1;
8109 const biasTop = sideParam === "bottom" ? bias : 0;
8110 const biasBottom = sideParam === "top" ? bias : 0;
8111 const biasLeft = sideParam === "right" ? bias : 0;
8112 const biasRight = sideParam === "left" ? bias : 0;
8113 if (typeof collisionPadding === "number") {
8114 collisionPadding = {
8115 top: collisionPadding + biasTop,
8116 right: collisionPadding + biasRight,
8117 bottom: collisionPadding + biasBottom,
8118 left: collisionPadding + biasLeft
8119 };
8120 } else if (collisionPadding) {
8121 collisionPadding = {
8122 top: (collisionPadding.top || 0) + biasTop,
8123 right: (collisionPadding.right || 0) + biasRight,
8124 bottom: (collisionPadding.bottom || 0) + biasBottom,
8125 left: (collisionPadding.left || 0) + biasLeft
8126 };
8127 }
8128 const commonCollisionProps = {
8129 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
8130 padding: collisionPadding
8131 };
8132 const arrowRef = React37.useRef(null);
8133 const sideOffsetRef = useValueAsRef(sideOffset);
8134 const alignOffsetRef = useValueAsRef(alignOffset);
8135 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
8136 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
8137 const middleware = [offset3((state) => {
8138 const data = getOffsetData(state, sideParam, isRtl);
8139 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
8140 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
8141 return {
8142 mainAxis: sideAxis,
8143 crossAxis: alignAxis,
8144 alignmentAxis: alignAxis
8145 };
8146 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])];
8147 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
8148 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
8149 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
8150 ...commonCollisionProps,
8151 // Ensure the popup flips if it's been limited by its --available-height and it resizes.
8152 // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
8153 padding: {
8154 top: collisionPadding.top + bias,
8155 right: collisionPadding.right + bias,
8156 bottom: collisionPadding.bottom + bias,
8157 left: collisionPadding.left + bias
8158 },
8159 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
8160 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
8161 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
8162 });
8163 const shiftMiddleware = shiftDisabled ? null : shift3((data) => {
8164 const html = ownerDocument(data.elements.floating).documentElement;
8165 return {
8166 ...commonCollisionProps,
8167 // Use the Layout Viewport to avoid shifting around when pinch-zooming
8168 // for context menus.
8169 rootBoundary: shiftCrossAxis ? {
8170 x: 0,
8171 y: 0,
8172 width: html.clientWidth,
8173 height: html.clientHeight
8174 } : void 0,
8175 mainAxis: collisionAvoidanceAlign !== "none",
8176 crossAxis: crossAxisShiftEnabled,
8177 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
8178 if (!arrowRef.current) {
8179 return {};
8180 }
8181 const {
8182 width,
8183 height
8184 } = arrowRef.current.getBoundingClientRect();
8185 const sideAxis = getSideAxis(getSide(limitData.placement));
8186 const arrowSize = sideAxis === "y" ? width : height;
8187 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
8188 return {
8189 offset: arrowSize / 2 + offsetAmount / 2
8190 };
8191 })
8192 };
8193 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]);
8194 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
8195 middleware.push(shiftMiddleware, flipMiddleware);
8196 } else {
8197 middleware.push(flipMiddleware, shiftMiddleware);
8198 }
8199 middleware.push(size3({
8200 ...commonCollisionProps,
8201 apply({
8202 elements: {
8203 floating
8204 },
8205 availableWidth,
8206 availableHeight,
8207 rects
8208 }) {
8209 if (!mountedRef.current) {
8210 return;
8211 }
8212 const floatingStyle = floating.style;
8213 floatingStyle.setProperty("--available-width", `${availableWidth}px`);
8214 floatingStyle.setProperty("--available-height", `${availableHeight}px`);
8215 const dpr = getWindow(floating).devicePixelRatio || 1;
8216 const {
8217 x: x3,
8218 y: y3,
8219 width,
8220 height
8221 } = rects.reference;
8222 const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr;
8223 const anchorHeight = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr;
8224 floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`);
8225 floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`);
8226 }
8227 }), arrow4(() => ({
8228 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
8229 // we'll create a fake element.
8230 element: arrowRef.current || ownerDocument(arrowRef.current).createElement("div"),
8231 padding: arrowPadding,
8232 offsetParent: "floating"
8233 }), [arrowPadding]), {
8234 name: "transformOrigin",
8235 fn(state) {
8236 const {
8237 elements: elements2,
8238 middlewareData: middlewareData2,
8239 placement: renderedPlacement2,
8240 rects,
8241 y: y3
8242 } = state;
8243 const currentRenderedSide = getSide(renderedPlacement2);
8244 const currentRenderedAxis = getSideAxis(currentRenderedSide);
8245 const arrowEl = arrowRef.current;
8246 const arrowX = middlewareData2.arrow?.x || 0;
8247 const arrowY = middlewareData2.arrow?.y || 0;
8248 const arrowWidth = arrowEl?.clientWidth || 0;
8249 const arrowHeight = arrowEl?.clientHeight || 0;
8250 const transformX = arrowX + arrowWidth / 2;
8251 const transformY = arrowY + arrowHeight / 2;
8252 const shiftY = Math.abs(middlewareData2.shift?.y || 0);
8253 const halfAnchorHeight = rects.reference.height / 2;
8254 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
8255 const isOverlappingAnchor = shiftY > sideOffsetValue;
8256 const adjacentTransformOrigin = {
8257 top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,
8258 bottom: `${transformX}px ${-sideOffsetValue}px`,
8259 left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,
8260 right: `${-sideOffsetValue}px ${transformY}px`
8261 }[currentRenderedSide];
8262 const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y3}px`;
8263 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
8264 return {};
8265 }
8266 }, hide4, adaptiveOrigin2);
8267 useIsoLayoutEffect(() => {
8268 if (!mounted && floatingRootContext) {
8269 floatingRootContext.update({
8270 referenceElement: null,
8271 floatingElement: null,
8272 domReferenceElement: null,
8273 positionReference: null
8274 });
8275 }
8276 }, [mounted, floatingRootContext]);
8277 const autoUpdateOptions = React37.useMemo(() => ({
8278 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
8279 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
8280 }), [disableAnchorTracking]);
8281 const {
8282 refs,
8283 elements,
8284 x: x2,
8285 y: y2,
8286 middlewareData,
8287 update: update2,
8288 placement: renderedPlacement,
8289 context,
8290 isPositioned,
8291 floatingStyles: originalFloatingStyles
8292 } = useFloating2({
8293 rootContext: floatingRootContext,
8294 open: keepMounted ? mounted : void 0,
8295 placement,
8296 middleware,
8297 strategy: positionMethod,
8298 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
8299 nodeId,
8300 externalTree
8301 });
8302 const {
8303 sideX,
8304 sideY
8305 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
8306 const resolvedPosition = isPositioned ? positionMethod : "fixed";
8307 const floatingStyles = React37.useMemo(() => {
8308 const base = adaptiveOrigin2 ? {
8309 position: resolvedPosition,
8310 [sideX]: x2,
8311 [sideY]: y2
8312 } : {
8313 position: resolvedPosition,
8314 ...originalFloatingStyles
8315 };
8316 if (!isPositioned) {
8317 base.opacity = 0;
8318 }
8319 return base;
8320 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]);
8321 const registeredPositionReferenceRef = React37.useRef(null);
8322 useIsoLayoutEffect(() => {
8323 if (!mounted) {
8324 return;
8325 }
8326 const anchorValue = anchorValueRef.current;
8327 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
8328 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
8329 const finalAnchor = unwrappedElement || null;
8330 if (finalAnchor !== registeredPositionReferenceRef.current) {
8331 refs.setPositionReference(finalAnchor);
8332 registeredPositionReferenceRef.current = finalAnchor;
8333 }
8334 }, [mounted, refs, anchorDep, anchorValueRef]);
8335 React37.useEffect(() => {
8336 if (!mounted) {
8337 return;
8338 }
8339 const anchorValue = anchorValueRef.current;
8340 if (typeof anchorValue === "function") {
8341 return;
8342 }
8343 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
8344 refs.setPositionReference(anchorValue.current);
8345 registeredPositionReferenceRef.current = anchorValue.current;
8346 }
8347 }, [mounted, refs, anchorDep, anchorValueRef]);
8348 React37.useEffect(() => {
8349 if (keepMounted && mounted && elements.domReference && elements.floating) {
8350 return autoUpdate(elements.domReference, elements.floating, update2, autoUpdateOptions);
8351 }
8352 return void 0;
8353 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
8354 const renderedSide = getSide(renderedPlacement);
8355 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
8356 const renderedAlign = getAlignment(renderedPlacement) || "center";
8357 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
8358 useIsoLayoutEffect(() => {
8359 if (lazyFlip && mounted && isPositioned) {
8360 setMountSide(renderedSide);
8361 }
8362 }, [lazyFlip, mounted, isPositioned, renderedSide]);
8363 const arrowStyles = React37.useMemo(() => ({
8364 position: "absolute",
8365 top: middlewareData.arrow?.y,
8366 left: middlewareData.arrow?.x
8367 }), [middlewareData.arrow]);
8368 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
8369 return React37.useMemo(() => ({
8370 positionerStyles: floatingStyles,
8371 arrowStyles,
8372 arrowRef,
8373 arrowUncentered,
8374 side: logicalRenderedSide,
8375 align: renderedAlign,
8376 physicalSide: renderedSide,
8377 anchorHidden,
8378 refs,
8379 context,
8380 isPositioned,
8381 update: update2
8382 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]);
8383 }
8384 function isRef(param) {
8385 return param != null && "current" in param;
8386 }
8387
8388 // node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js
8389 function getDisabledMountTransitionStyles(transitionStatus) {
8390 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
8391 }
8392
8393 // node_modules/@base-ui/react/esm/utils/usePositioner.js
8394 function usePositioner(componentProps, state, {
8395 styles,
8396 transitionStatus,
8397 props,
8398 refs,
8399 hidden,
8400 inert = false
8401 }) {
8402 const style = {
8403 ...styles
8404 };
8405 if (inert) {
8406 style.pointerEvents = "none";
8407 }
8408 return useRenderElement("div", componentProps, {
8409 state,
8410 ref: refs,
8411 props: [{
8412 role: "presentation",
8413 hidden,
8414 style
8415 }, getDisabledMountTransitionStyles(transitionStatus), props],
8416 stateAttributesMapping: popupStateMapping
8417 });
8418 }
8419
8420 // node_modules/@base-ui/react/esm/button/Button.js
8421 var React38 = __toESM(require_react(), 1);
8422 var Button = /* @__PURE__ */ React38.forwardRef(function Button2(componentProps, forwardedRef) {
8423 const {
8424 render: render4,
8425 className,
8426 disabled: disabled2 = false,
8427 focusableWhenDisabled = false,
8428 nativeButton = true,
8429 style,
8430 ...elementProps
8431 } = componentProps;
8432 const {
8433 getButtonProps,
8434 buttonRef
8435 } = useButton({
8436 disabled: disabled2,
8437 focusableWhenDisabled,
8438 native: nativeButton
8439 });
8440 const state = {
8441 disabled: disabled2
8442 };
8443 return useRenderElement("button", componentProps, {
8444 state,
8445 ref: [forwardedRef, buttonRef],
8446 props: [elementProps, getButtonProps]
8447 });
8448 });
8449 if (true) Button.displayName = "Button";
8450
8451 // node_modules/@base-ui/react/esm/collapsible/index.parts.js
8452 var index_parts_exports = {};
8453 __export(index_parts_exports, {
8454 Panel: () => CollapsiblePanel,
8455 Root: () => CollapsibleRoot,
8456 Trigger: () => CollapsibleTrigger
8457 });
8458
8459 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js
8460 var React39 = __toESM(require_react(), 1);
8461
8462 // node_modules/@base-ui/react/esm/collapsible/root/stateAttributesMapping.js
8463 var collapsibleStateAttributesMapping = {
8464 ...collapsibleOpenStateMapping,
8465 ...transitionStatusMapping
8466 };
8467
8468 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js
8469 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
8470 var CollapsibleRoot = /* @__PURE__ */ React39.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) {
8471 const {
8472 render: render4,
8473 className,
8474 defaultOpen = false,
8475 disabled: disabled2 = false,
8476 onOpenChange: onOpenChangeProp,
8477 open,
8478 style,
8479 ...elementProps
8480 } = componentProps;
8481 const onOpenChange = useStableCallback(onOpenChangeProp);
8482 const collapsible = useCollapsibleRoot({
8483 open,
8484 defaultOpen,
8485 onOpenChange,
8486 disabled: disabled2
8487 });
8488 const state = React39.useMemo(() => ({
8489 open: collapsible.open,
8490 disabled: collapsible.disabled,
8491 transitionStatus: collapsible.transitionStatus
8492 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);
8493 const contextValue = React39.useMemo(() => ({
8494 ...collapsible,
8495 onOpenChange,
8496 state
8497 }), [collapsible, onOpenChange, state]);
8498 const element = useRenderElement("div", componentProps, {
8499 state,
8500 ref: forwardedRef,
8501 props: elementProps,
8502 stateAttributesMapping: collapsibleStateAttributesMapping
8503 });
8504 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapsibleRootContext.Provider, {
8505 value: contextValue,
8506 children: element
8507 });
8508 });
8509 if (true) CollapsibleRoot.displayName = "CollapsibleRoot";
8510
8511 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTrigger.js
8512 var React40 = __toESM(require_react(), 1);
8513 var stateAttributesMapping = {
8514 ...triggerOpenStateMapping,
8515 ...transitionStatusMapping
8516 };
8517 var CollapsibleTrigger = /* @__PURE__ */ React40.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) {
8518 const {
8519 panelId,
8520 open,
8521 handleTrigger,
8522 state,
8523 disabled: contextDisabled
8524 } = useCollapsibleRootContext();
8525 const {
8526 className,
8527 disabled: disabled2 = contextDisabled,
8528 id,
8529 render: render4,
8530 nativeButton = true,
8531 style,
8532 ...elementProps
8533 } = componentProps;
8534 const {
8535 getButtonProps,
8536 buttonRef
8537 } = useButton({
8538 disabled: disabled2,
8539 focusableWhenDisabled: true,
8540 native: nativeButton
8541 });
8542 const props = React40.useMemo(() => ({
8543 "aria-controls": open ? panelId : void 0,
8544 "aria-expanded": open,
8545 onClick: handleTrigger
8546 }), [panelId, open, handleTrigger]);
8547 const element = useRenderElement("button", componentProps, {
8548 state,
8549 ref: [forwardedRef, buttonRef],
8550 props: [props, elementProps, getButtonProps],
8551 stateAttributesMapping
8552 });
8553 return element;
8554 });
8555 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger";
8556
8557 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js
8558 var React41 = __toESM(require_react(), 1);
8559
8560 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelCssVars.js
8561 var CollapsiblePanelCssVars = /* @__PURE__ */ (function(CollapsiblePanelCssVars2) {
8562 CollapsiblePanelCssVars2["collapsiblePanelHeight"] = "--collapsible-panel-height";
8563 CollapsiblePanelCssVars2["collapsiblePanelWidth"] = "--collapsible-panel-width";
8564 return CollapsiblePanelCssVars2;
8565 })({});
8566
8567 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js
8568 var CollapsiblePanel = /* @__PURE__ */ React41.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) {
8569 const {
8570 className,
8571 hiddenUntilFound: hiddenUntilFoundProp,
8572 keepMounted: keepMountedProp,
8573 render: render4,
8574 id: idProp,
8575 style,
8576 ...elementProps
8577 } = componentProps;
8578 if (true) {
8579 useIsoLayoutEffect(() => {
8580 if (hiddenUntilFoundProp && keepMountedProp === false) {
8581 warn("The `keepMounted={false}` prop on a Collapsible will be ignored when using `hiddenUntilFound` since it requires the Panel to remain mounted even when closed.");
8582 }
8583 }, [hiddenUntilFoundProp, keepMountedProp]);
8584 }
8585 const {
8586 abortControllerRef,
8587 animationTypeRef,
8588 height,
8589 mounted,
8590 onOpenChange,
8591 open,
8592 panelId,
8593 panelRef,
8594 runOnceAnimationsFinish,
8595 setDimensions,
8596 setHiddenUntilFound,
8597 setKeepMounted,
8598 setMounted,
8599 setPanelIdState,
8600 setOpen,
8601 setVisible,
8602 state,
8603 transitionDimensionRef,
8604 visible,
8605 width,
8606 transitionStatus
8607 } = useCollapsibleRootContext();
8608 const hiddenUntilFound = hiddenUntilFoundProp ?? false;
8609 const keepMounted = keepMountedProp ?? false;
8610 useIsoLayoutEffect(() => {
8611 if (idProp) {
8612 setPanelIdState(idProp);
8613 return () => {
8614 setPanelIdState(void 0);
8615 };
8616 }
8617 return void 0;
8618 }, [idProp, setPanelIdState]);
8619 useIsoLayoutEffect(() => {
8620 setHiddenUntilFound(hiddenUntilFound);
8621 }, [setHiddenUntilFound, hiddenUntilFound]);
8622 useIsoLayoutEffect(() => {
8623 setKeepMounted(keepMounted);
8624 }, [setKeepMounted, keepMounted]);
8625 const {
8626 props
8627 } = useCollapsiblePanel({
8628 abortControllerRef,
8629 animationTypeRef,
8630 externalRef: forwardedRef,
8631 height,
8632 hiddenUntilFound,
8633 id: panelId,
8634 keepMounted,
8635 mounted,
8636 onOpenChange,
8637 open,
8638 panelRef,
8639 runOnceAnimationsFinish,
8640 setDimensions,
8641 setMounted,
8642 setOpen,
8643 setVisible,
8644 transitionDimensionRef,
8645 visible,
8646 width
8647 });
8648 useOpenChangeComplete({
8649 open: open && transitionStatus === "idle",
8650 ref: panelRef,
8651 onComplete() {
8652 if (!open) {
8653 return;
8654 }
8655 setDimensions({
8656 height: void 0,
8657 width: void 0
8658 });
8659 }
8660 });
8661 const panelState = React41.useMemo(() => ({
8662 ...state,
8663 transitionStatus
8664 }), [state, transitionStatus]);
8665 const element = useRenderElement("div", componentProps, {
8666 state: panelState,
8667 ref: [forwardedRef, panelRef],
8668 props: [props, {
8669 style: {
8670 [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === void 0 ? "auto" : `${height}px`,
8671 [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === void 0 ? "auto" : `${width}px`
8672 }
8673 }, elementProps],
8674 stateAttributesMapping: collapsibleStateAttributesMapping
8675 });
8676 const shouldRender = keepMounted || hiddenUntilFound || mounted;
8677 if (!shouldRender) {
8678 return null;
8679 }
8680 return element;
8681 });
8682 if (true) CollapsiblePanel.displayName = "CollapsiblePanel";
8683
8684 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js
8685 var React44 = __toESM(require_react(), 1);
8686 var ReactDOM5 = __toESM(require_react_dom(), 1);
8687
8688 // node_modules/@base-ui/utils/esm/usePreviousValue.js
8689 var React42 = __toESM(require_react(), 1);
8690 function usePreviousValue(value) {
8691 const [state, setState] = React42.useState({
8692 current: value,
8693 previous: null
8694 });
8695 if (value !== state.current) {
8696 setState({
8697 current: value,
8698 previous: state.current
8699 });
8700 }
8701 return state.previous;
8702 }
8703
8704 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js
8705 var React43 = __toESM(require_react(), 1);
8706
8707 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js
8708 function getCssDimensions2(element) {
8709 const css = getComputedStyle2(element);
8710 let width = parseFloat(css.width) || 0;
8711 let height = parseFloat(css.height) || 0;
8712 const hasOffset = isHTMLElement(element);
8713 const offsetWidth = hasOffset ? element.offsetWidth : width;
8714 const offsetHeight = hasOffset ? element.offsetHeight : height;
8715 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
8716 if (shouldFallback) {
8717 width = offsetWidth;
8718 height = offsetHeight;
8719 }
8720 return {
8721 width,
8722 height
8723 };
8724 }
8725
8726 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js
8727 var DEFAULT_ENABLED = () => true;
8728 function usePopupAutoResize(parameters) {
8729 const {
8730 popupElement,
8731 positionerElement,
8732 content,
8733 mounted,
8734 enabled = DEFAULT_ENABLED,
8735 onMeasureLayout: onMeasureLayoutParam,
8736 onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
8737 side,
8738 direction
8739 } = parameters;
8740 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false);
8741 const animationFrame = useAnimationFrame();
8742 const committedDimensionsRef = React43.useRef(null);
8743 const liveDimensionsRef = React43.useRef(null);
8744 const isInitialRenderRef = React43.useRef(true);
8745 const restoreAnchoringStylesRef = React43.useRef(NOOP);
8746 const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
8747 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
8748 const anchoringStyles = React43.useMemo(() => {
8749 let isOriginSide = side === "top";
8750 let isPhysicalLeft = side === "left";
8751 if (direction === "rtl") {
8752 isOriginSide = isOriginSide || side === "inline-end";
8753 isPhysicalLeft = isPhysicalLeft || side === "inline-end";
8754 } else {
8755 isOriginSide = isOriginSide || side === "inline-start";
8756 isPhysicalLeft = isPhysicalLeft || side === "inline-start";
8757 }
8758 return isOriginSide ? {
8759 position: "absolute",
8760 [side === "top" ? "bottom" : "top"]: "0",
8761 [isPhysicalLeft ? "right" : "left"]: "0"
8762 } : EMPTY_OBJECT;
8763 }, [side, direction]);
8764 useIsoLayoutEffect(() => {
8765 if (!mounted || !enabled() || typeof ResizeObserver !== "function") {
8766 restoreAnchoringStylesRef.current = NOOP;
8767 isInitialRenderRef.current = true;
8768 committedDimensionsRef.current = null;
8769 liveDimensionsRef.current = null;
8770 return void 0;
8771 }
8772 if (!popupElement || !positionerElement) {
8773 return void 0;
8774 }
8775 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
8776 const observer = new ResizeObserver((entries) => {
8777 const entry = entries[0];
8778 if (entry) {
8779 liveDimensionsRef.current = {
8780 width: Math.ceil(entry.borderBoxSize[0].inlineSize),
8781 height: Math.ceil(entry.borderBoxSize[0].blockSize)
8782 };
8783 }
8784 });
8785 observer.observe(popupElement);
8786 setPopupCssSize(popupElement, "auto");
8787 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
8788 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
8789 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
8790 const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
8791 "--available-width": "max-content",
8792 "--available-height": "max-content"
8793 });
8794 function restoreMeasurementOverrides() {
8795 restorePopupPosition();
8796 restorePopupTransform();
8797 restorePositionerAvailableSize();
8798 }
8799 function restoreMeasurementOverridesIncludingScale() {
8800 restoreMeasurementOverrides();
8801 restorePopupScale();
8802 }
8803 onMeasureLayout?.();
8804 if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
8805 setPositionerCssSize(positionerElement, "max-content");
8806 const dimensions = getCssDimensions2(popupElement);
8807 committedDimensionsRef.current = dimensions;
8808 setPositionerCssSize(positionerElement, dimensions);
8809 restoreMeasurementOverridesIncludingScale();
8810 onMeasureLayoutComplete?.(null, dimensions);
8811 isInitialRenderRef.current = false;
8812 return () => {
8813 observer.disconnect();
8814 restoreAnchoringStylesRef.current();
8815 restoreAnchoringStylesRef.current = NOOP;
8816 };
8817 }
8818 setPopupCssSize(popupElement, "auto");
8819 setPositionerCssSize(positionerElement, "max-content");
8820 const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current;
8821 const newDimensions = getCssDimensions2(popupElement);
8822 committedDimensionsRef.current = newDimensions;
8823 if (!previousDimensions) {
8824 setPositionerCssSize(positionerElement, newDimensions);
8825 restoreMeasurementOverridesIncludingScale();
8826 onMeasureLayoutComplete?.(null, newDimensions);
8827 return () => {
8828 observer.disconnect();
8829 animationFrame.cancel();
8830 restoreAnchoringStylesRef.current();
8831 restoreAnchoringStylesRef.current = NOOP;
8832 };
8833 }
8834 setPopupCssSize(popupElement, previousDimensions);
8835 restoreMeasurementOverridesIncludingScale();
8836 onMeasureLayoutComplete?.(previousDimensions, newDimensions);
8837 setPositionerCssSize(positionerElement, newDimensions);
8838 const abortController = new AbortController();
8839 animationFrame.request(() => {
8840 setPopupCssSize(popupElement, newDimensions);
8841 runOnceAnimationsFinish(() => {
8842 popupElement.style.setProperty("--popup-width", "auto");
8843 popupElement.style.setProperty("--popup-height", "auto");
8844 }, abortController.signal);
8845 });
8846 return () => {
8847 observer.disconnect();
8848 abortController.abort();
8849 animationFrame.cancel();
8850 restoreAnchoringStylesRef.current();
8851 restoreAnchoringStylesRef.current = NOOP;
8852 };
8853 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
8854 }
8855 function overrideElementStyle(element, property, value) {
8856 const originalValue = element.style.getPropertyValue(property);
8857 element.style.setProperty(property, value);
8858 return () => {
8859 element.style.setProperty(property, originalValue);
8860 };
8861 }
8862 function applyElementStyles(element, styles) {
8863 const restorers = [];
8864 for (const [key, value] of Object.entries(styles)) {
8865 restorers.push(overrideElementStyle(element, key, value));
8866 }
8867 return restorers.length ? () => {
8868 restorers.forEach((restore) => restore());
8869 } : NOOP;
8870 }
8871 function setPopupCssSize(popupElement, size4) {
8872 const width = size4 === "auto" ? "auto" : `${size4.width}px`;
8873 const height = size4 === "auto" ? "auto" : `${size4.height}px`;
8874 popupElement.style.setProperty("--popup-width", width);
8875 popupElement.style.setProperty("--popup-height", height);
8876 }
8877 function setPositionerCssSize(positionerElement, size4) {
8878 const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
8879 const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
8880 positionerElement.style.setProperty("--positioner-width", width);
8881 positionerElement.style.setProperty("--positioner-height", height);
8882 }
8883
8884 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js
8885 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
8886 function usePopupViewport(parameters) {
8887 const {
8888 store,
8889 side,
8890 cssVars,
8891 children
8892 } = parameters;
8893 const direction = useDirection();
8894 const activeTrigger = store.useState("activeTriggerElement");
8895 const activeTriggerId = store.useState("activeTriggerId");
8896 const open = store.useState("open");
8897 const payload = store.useState("payload");
8898 const mounted = store.useState("mounted");
8899 const popupElement = store.useState("popupElement");
8900 const positionerElement = store.useState("positionerElement");
8901 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null);
8902 const currentContentKey = usePopupContentKey(activeTriggerId, payload);
8903 const capturedNodeRef = React44.useRef(null);
8904 const [previousContentNode, setPreviousContentNode] = React44.useState(null);
8905 const [newTriggerOffset, setNewTriggerOffset] = React44.useState(null);
8906 const currentContainerRef = React44.useRef(null);
8907 const previousContainerRef = React44.useRef(null);
8908 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false);
8909 const cleanupFrame = useAnimationFrame();
8910 const [previousContentDimensions, setPreviousContentDimensions] = React44.useState(null);
8911 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React44.useState(false);
8912 useIsoLayoutEffect(() => {
8913 store.set("hasViewport", true);
8914 return () => {
8915 store.set("hasViewport", false);
8916 };
8917 }, [store]);
8918 const handleMeasureLayout = useStableCallback(() => {
8919 currentContainerRef.current?.style.setProperty("animation", "none");
8920 currentContainerRef.current?.style.setProperty("transition", "none");
8921 previousContainerRef.current?.style.setProperty("display", "none");
8922 });
8923 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
8924 currentContainerRef.current?.style.removeProperty("animation");
8925 currentContainerRef.current?.style.removeProperty("transition");
8926 previousContainerRef.current?.style.removeProperty("display");
8927 if (previousDimensions) {
8928 setPreviousContentDimensions(previousDimensions);
8929 }
8930 });
8931 const lastHandledTriggerRef = React44.useRef(null);
8932 useIsoLayoutEffect(() => {
8933 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
8934 setPreviousContentNode(capturedNodeRef.current);
8935 setShowStartingStyleAttribute(true);
8936 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
8937 setNewTriggerOffset(offset4);
8938 cleanupFrame.request(() => {
8939 ReactDOM5.flushSync(() => {
8940 setShowStartingStyleAttribute(false);
8941 });
8942 onAnimationsFinished(() => {
8943 setPreviousContentNode(null);
8944 setPreviousContentDimensions(null);
8945 capturedNodeRef.current = null;
8946 });
8947 });
8948 lastHandledTriggerRef.current = activeTrigger;
8949 }
8950 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]);
8951 useIsoLayoutEffect(() => {
8952 const source = currentContainerRef.current;
8953 if (!source) {
8954 return;
8955 }
8956 const wrapper = ownerDocument(source).createElement("div");
8957 for (const child of Array.from(source.childNodes)) {
8958 wrapper.appendChild(child.cloneNode(true));
8959 }
8960 capturedNodeRef.current = wrapper;
8961 });
8962 const isTransitioning = previousContentNode != null;
8963 let childrenToRender;
8964 if (!isTransitioning) {
8965 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
8966 "data-current": true,
8967 ref: currentContainerRef,
8968 children
8969 }, currentContentKey);
8970 } else {
8971 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React44.Fragment, {
8972 children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
8973 "data-previous": true,
8974 inert: inertValue(true),
8975 ref: previousContainerRef,
8976 style: {
8977 ...previousContentDimensions ? {
8978 [cssVars.popupWidth]: `${previousContentDimensions.width}px`,
8979 [cssVars.popupHeight]: `${previousContentDimensions.height}px`
8980 } : null,
8981 position: "absolute"
8982 },
8983 "data-ending-style": showStartingStyleAttribute ? void 0 : ""
8984 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
8985 "data-current": true,
8986 ref: currentContainerRef,
8987 "data-starting-style": showStartingStyleAttribute ? "" : void 0,
8988 children
8989 }, currentContentKey)]
8990 });
8991 }
8992 useIsoLayoutEffect(() => {
8993 const container = previousContainerRef.current;
8994 if (!container || !previousContentNode) {
8995 return;
8996 }
8997 container.replaceChildren(...Array.from(previousContentNode.childNodes));
8998 }, [previousContentNode]);
8999 usePopupAutoResize({
9000 popupElement,
9001 positionerElement,
9002 mounted,
9003 content: payload,
9004 onMeasureLayout: handleMeasureLayout,
9005 onMeasureLayoutComplete: handleMeasureLayoutComplete,
9006 side,
9007 direction
9008 });
9009 const state = {
9010 activationDirection: getActivationDirection(newTriggerOffset),
9011 transitioning: isTransitioning
9012 };
9013 return {
9014 children: childrenToRender,
9015 state
9016 };
9017 }
9018 function getActivationDirection(offset4) {
9019 if (!offset4) {
9020 return void 0;
9021 }
9022 return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
9023 }
9024 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
9025 if (value > tolerance) {
9026 return positiveLabel;
9027 }
9028 if (value < -tolerance) {
9029 return negativeLabel;
9030 }
9031 return "";
9032 }
9033 function calculateRelativePosition(from, to) {
9034 const fromRect = from.getBoundingClientRect();
9035 const toRect = to.getBoundingClientRect();
9036 const fromCenter = {
9037 x: fromRect.left + fromRect.width / 2,
9038 y: fromRect.top + fromRect.height / 2
9039 };
9040 const toCenter = {
9041 x: toRect.left + toRect.width / 2,
9042 y: toRect.top + toRect.height / 2
9043 };
9044 return {
9045 horizontal: toCenter.x - fromCenter.x,
9046 vertical: toCenter.y - fromCenter.y
9047 };
9048 }
9049 function usePopupContentKey(activeTriggerId, payload) {
9050 const [contentKey, setContentKey] = React44.useState(0);
9051 const previousActiveTriggerIdRef = React44.useRef(activeTriggerId);
9052 const previousPayloadRef = React44.useRef(payload);
9053 const pendingPayloadUpdateRef = React44.useRef(false);
9054 useIsoLayoutEffect(() => {
9055 const previousActiveTriggerId = previousActiveTriggerIdRef.current;
9056 const previousPayload = previousPayloadRef.current;
9057 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
9058 const payloadChanged = payload !== previousPayload;
9059 if (triggerIdChanged) {
9060 setContentKey((value) => value + 1);
9061 pendingPayloadUpdateRef.current = !payloadChanged;
9062 } else if (pendingPayloadUpdateRef.current && payloadChanged) {
9063 setContentKey((value) => value + 1);
9064 pendingPayloadUpdateRef.current = false;
9065 }
9066 previousActiveTriggerIdRef.current = activeTriggerId;
9067 previousPayloadRef.current = payload;
9068 }, [activeTriggerId, payload]);
9069 return `${activeTriggerId ?? "current"}-${contentKey}`;
9070 }
9071
9072 // node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js
9073 var React45 = __toESM(require_react(), 1);
9074 var ReactDOM6 = __toESM(require_react_dom(), 1);
9075 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
9076 var FloatingPortalLite = /* @__PURE__ */ React45.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
9077 const {
9078 children,
9079 container,
9080 className,
9081 render: render4,
9082 style,
9083 ...elementProps
9084 } = componentProps;
9085 const {
9086 portalNode,
9087 portalSubtree
9088 } = useFloatingPortalNode({
9089 container,
9090 ref: forwardedRef,
9091 componentProps,
9092 elementProps
9093 });
9094 if (!portalSubtree && !portalNode) {
9095 return null;
9096 }
9097 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React45.Fragment, {
9098 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM6.createPortal(children, portalNode)]
9099 });
9100 });
9101 if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
9102
9103 // node_modules/@base-ui/react/esm/tooltip/index.parts.js
9104 var index_parts_exports2 = {};
9105 __export(index_parts_exports2, {
9106 Arrow: () => TooltipArrow,
9107 Handle: () => TooltipHandle,
9108 Popup: () => TooltipPopup,
9109 Portal: () => TooltipPortal,
9110 Positioner: () => TooltipPositioner,
9111 Provider: () => TooltipProvider,
9112 Root: () => TooltipRoot,
9113 Trigger: () => TooltipTrigger,
9114 Viewport: () => TooltipViewport,
9115 createHandle: () => createTooltipHandle
9116 });
9117
9118 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js
9119 var React48 = __toESM(require_react(), 1);
9120
9121 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js
9122 var React46 = __toESM(require_react(), 1);
9123 var TooltipRootContext = /* @__PURE__ */ React46.createContext(void 0);
9124 if (true) TooltipRootContext.displayName = "TooltipRootContext";
9125 function useTooltipRootContext(optional) {
9126 const context = React46.useContext(TooltipRootContext);
9127 if (context === void 0 && !optional) {
9128 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
9129 }
9130 return context;
9131 }
9132
9133 // node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js
9134 var React47 = __toESM(require_react(), 1);
9135 var ReactDOM7 = __toESM(require_react_dom(), 1);
9136 var selectors2 = {
9137 ...popupStoreSelectors,
9138 disabled: createSelector((state) => state.disabled),
9139 instantType: createSelector((state) => state.instantType),
9140 isInstantPhase: createSelector((state) => state.isInstantPhase),
9141 trackCursorAxis: createSelector((state) => state.trackCursorAxis),
9142 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup),
9143 lastOpenChangeReason: createSelector((state) => state.openChangeReason),
9144 closeOnClick: createSelector((state) => state.closeOnClick),
9145 closeDelay: createSelector((state) => state.closeDelay),
9146 hasViewport: createSelector((state) => state.hasViewport)
9147 };
9148 var TooltipStore = class _TooltipStore extends ReactStore {
9149 constructor(initialState) {
9150 super({
9151 ...createInitialState(),
9152 ...initialState
9153 }, {
9154 popupRef: /* @__PURE__ */ React47.createRef(),
9155 onOpenChange: void 0,
9156 onOpenChangeComplete: void 0,
9157 triggerElements: new PopupTriggerMap()
9158 }, selectors2);
9159 }
9160 setOpen = (nextOpen, eventDetails) => {
9161 const reason = eventDetails.reason;
9162 const isHover = reason === reason_parts_exports.triggerHover;
9163 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
9164 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
9165 eventDetails.preventUnmountOnClose = () => {
9166 this.set("preventUnmountingOnClose", true);
9167 };
9168 this.context.onOpenChange?.(nextOpen, eventDetails);
9169 if (eventDetails.isCanceled) {
9170 return;
9171 }
9172 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
9173 const changeState = () => {
9174 const updatedState = {
9175 open: nextOpen,
9176 openChangeReason: reason
9177 };
9178 if (isFocusOpen) {
9179 updatedState.instantType = "focus";
9180 } else if (isDismissClose) {
9181 updatedState.instantType = "dismiss";
9182 } else if (reason === reason_parts_exports.triggerHover) {
9183 updatedState.instantType = void 0;
9184 }
9185 const newTriggerId = eventDetails.trigger?.id ?? null;
9186 if (newTriggerId || nextOpen) {
9187 updatedState.activeTriggerId = newTriggerId;
9188 updatedState.activeTriggerElement = eventDetails.trigger ?? null;
9189 }
9190 this.update(updatedState);
9191 };
9192 if (isHover) {
9193 ReactDOM7.flushSync(changeState);
9194 } else {
9195 changeState();
9196 }
9197 };
9198 static useStore(externalStore, initialState) {
9199 const internalStore = useRefWithInit(() => {
9200 return new _TooltipStore(initialState);
9201 }).current;
9202 const store = externalStore ?? internalStore;
9203 const floatingRootContext = useSyncedFloatingRootContext({
9204 popupStore: store,
9205 onOpenChange: store.setOpen
9206 });
9207 store.state.floatingRootContext = floatingRootContext;
9208 return store;
9209 }
9210 };
9211 function createInitialState() {
9212 return {
9213 ...createInitialPopupStoreState(),
9214 disabled: false,
9215 instantType: void 0,
9216 isInstantPhase: false,
9217 trackCursorAxis: "none",
9218 disableHoverablePopup: false,
9219 openChangeReason: null,
9220 closeOnClick: true,
9221 closeDelay: 0,
9222 hasViewport: false
9223 };
9224 }
9225
9226 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js
9227 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
9228 var TooltipRoot = fastComponent(function TooltipRoot2(props) {
9229 const {
9230 disabled: disabled2 = false,
9231 defaultOpen = false,
9232 open: openProp,
9233 disableHoverablePopup = false,
9234 trackCursorAxis = "none",
9235 actionsRef,
9236 onOpenChange,
9237 onOpenChangeComplete,
9238 handle,
9239 triggerId: triggerIdProp,
9240 defaultTriggerId: defaultTriggerIdProp = null,
9241 children
9242 } = props;
9243 const store = TooltipStore.useStore(handle?.store, {
9244 open: defaultOpen,
9245 openProp,
9246 activeTriggerId: defaultTriggerIdProp,
9247 triggerIdProp
9248 });
9249 useOnFirstRender(() => {
9250 if (openProp === void 0 && store.state.open === false && defaultOpen === true) {
9251 store.update({
9252 open: true,
9253 activeTriggerId: defaultTriggerIdProp
9254 });
9255 }
9256 });
9257 store.useControlledProp("openProp", openProp);
9258 store.useControlledProp("triggerIdProp", triggerIdProp);
9259 store.useContextCallback("onOpenChange", onOpenChange);
9260 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
9261 const openState = store.useState("open");
9262 const open = !disabled2 && openState;
9263 const activeTriggerId = store.useState("activeTriggerId");
9264 const payload = store.useState("payload");
9265 store.useSyncedValues({
9266 trackCursorAxis,
9267 disableHoverablePopup
9268 });
9269 useIsoLayoutEffect(() => {
9270 if (openState && disabled2) {
9271 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
9272 }
9273 }, [openState, disabled2, store]);
9274 store.useSyncedValue("disabled", disabled2);
9275 useImplicitActiveTrigger(store);
9276 const {
9277 forceUnmount,
9278 transitionStatus
9279 } = useOpenStateTransitions(open, store);
9280 const floatingRootContext = store.select("floatingRootContext");
9281 const isInstantPhase = store.useState("isInstantPhase");
9282 const instantType = store.useState("instantType");
9283 const lastOpenChangeReason = store.useState("lastOpenChangeReason");
9284 const previousInstantTypeRef = React48.useRef(null);
9285 useIsoLayoutEffect(() => {
9286 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
9287 if (instantType !== "delay") {
9288 previousInstantTypeRef.current = instantType;
9289 }
9290 store.set("instantType", "delay");
9291 } else if (previousInstantTypeRef.current !== null) {
9292 store.set("instantType", previousInstantTypeRef.current);
9293 previousInstantTypeRef.current = null;
9294 }
9295 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]);
9296 useIsoLayoutEffect(() => {
9297 if (open) {
9298 if (activeTriggerId == null) {
9299 store.set("payload", void 0);
9300 }
9301 }
9302 }, [store, activeTriggerId, open]);
9303 const handleImperativeClose = React48.useCallback(() => {
9304 store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
9305 }, [store]);
9306 React48.useImperativeHandle(actionsRef, () => ({
9307 unmount: forceUnmount,
9308 close: handleImperativeClose
9309 }), [forceUnmount, handleImperativeClose]);
9310 const dismiss = useDismiss(floatingRootContext, {
9311 enabled: !disabled2,
9312 referencePress: () => store.select("closeOnClick")
9313 });
9314 const clientPoint = useClientPoint(floatingRootContext, {
9315 enabled: !disabled2 && trackCursorAxis !== "none",
9316 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
9317 });
9318 const {
9319 getReferenceProps,
9320 getFloatingProps,
9321 getTriggerProps
9322 } = useInteractions([dismiss, clientPoint]);
9323 const activeTriggerProps = React48.useMemo(() => getReferenceProps(), [getReferenceProps]);
9324 const inactiveTriggerProps = React48.useMemo(() => getTriggerProps(), [getTriggerProps]);
9325 const popupProps = React48.useMemo(() => getFloatingProps(), [getFloatingProps]);
9326 store.useSyncedValues({
9327 activeTriggerProps,
9328 inactiveTriggerProps,
9329 popupProps
9330 });
9331 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipRootContext.Provider, {
9332 value: store,
9333 children: typeof children === "function" ? children({
9334 payload
9335 }) : children
9336 });
9337 });
9338 if (true) TooltipRoot.displayName = "TooltipRoot";
9339
9340 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js
9341 var React50 = __toESM(require_react(), 1);
9342
9343 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js
9344 var React49 = __toESM(require_react(), 1);
9345 var TooltipProviderContext = /* @__PURE__ */ React49.createContext(void 0);
9346 if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
9347 function useTooltipProviderContext() {
9348 return React49.useContext(TooltipProviderContext);
9349 }
9350
9351 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js
9352 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) {
9353 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen";
9354 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled";
9355 return TooltipTriggerDataAttributes2;
9356 })({});
9357
9358 // node_modules/@base-ui/react/esm/tooltip/utils/constants.js
9359 var OPEN_DELAY = 600;
9360
9361 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js
9362 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
9363 const {
9364 className,
9365 render: render4,
9366 handle,
9367 payload,
9368 disabled: disabledProp,
9369 delay,
9370 closeOnClick = true,
9371 closeDelay,
9372 id: idProp,
9373 style,
9374 ...elementProps
9375 } = componentProps;
9376 const rootContext = useTooltipRootContext(true);
9377 const store = handle?.store ?? rootContext;
9378 if (!store) {
9379 throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82));
9380 }
9381 const thisTriggerId = useBaseUiId(idProp);
9382 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
9383 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
9384 const floatingRootContext = store.useState("floatingRootContext");
9385 const triggerElementRef = React50.useRef(null);
9386 const delayWithDefault = delay ?? OPEN_DELAY;
9387 const closeDelayWithDefault = closeDelay ?? 0;
9388 const {
9389 registerTrigger,
9390 isMountedByThisTrigger
9391 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
9392 payload,
9393 closeOnClick,
9394 closeDelay: closeDelayWithDefault
9395 });
9396 const providerContext = useTooltipProviderContext();
9397 const {
9398 delayRef,
9399 isInstantPhase,
9400 hasProvider
9401 } = useDelayGroup(floatingRootContext, {
9402 open: isOpenedByThisTrigger
9403 });
9404 store.useSyncedValue("isInstantPhase", isInstantPhase);
9405 const rootDisabled = store.useState("disabled");
9406 const disabled2 = disabledProp ?? rootDisabled;
9407 const trackCursorAxis = store.useState("trackCursorAxis");
9408 const disableHoverablePopup = store.useState("disableHoverablePopup");
9409 const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
9410 enabled: !disabled2,
9411 mouseOnly: true,
9412 move: false,
9413 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
9414 restMs() {
9415 const providerDelay = providerContext?.delay;
9416 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0;
9417 let computedRestMs = delayWithDefault;
9418 if (hasProvider) {
9419 if (groupOpenValue !== 0) {
9420 computedRestMs = delay ?? providerDelay ?? delayWithDefault;
9421 } else {
9422 computedRestMs = 0;
9423 }
9424 }
9425 return computedRestMs;
9426 },
9427 delay() {
9428 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0;
9429 let computedCloseDelay = closeDelayWithDefault;
9430 if (closeDelay == null && hasProvider) {
9431 computedCloseDelay = closeValue;
9432 }
9433 return {
9434 close: computedCloseDelay
9435 };
9436 },
9437 triggerElementRef,
9438 isActiveTrigger: isTriggerActive,
9439 isClosing: () => store.select("transitionStatus") === "ending"
9440 });
9441 const focusProps = useFocus(floatingRootContext, {
9442 enabled: !disabled2
9443 }).reference;
9444 const state = {
9445 open: isOpenedByThisTrigger
9446 };
9447 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
9448 const element = useRenderElement("button", componentProps, {
9449 state,
9450 ref: [forwardedRef, registerTrigger, triggerElementRef],
9451 props: [hoverProps, focusProps, rootTriggerProps, {
9452 onPointerDown() {
9453 store.set("closeOnClick", closeOnClick);
9454 },
9455 id: thisTriggerId,
9456 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0
9457 }, elementProps],
9458 stateAttributesMapping: triggerOpenStateMapping2
9459 });
9460 return element;
9461 });
9462 if (true) TooltipTrigger.displayName = "TooltipTrigger";
9463
9464 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js
9465 var React52 = __toESM(require_react(), 1);
9466
9467 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js
9468 var React51 = __toESM(require_react(), 1);
9469 var TooltipPortalContext = /* @__PURE__ */ React51.createContext(void 0);
9470 if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
9471 function useTooltipPortalContext() {
9472 const value = React51.useContext(TooltipPortalContext);
9473 if (value === void 0) {
9474 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
9475 }
9476 return value;
9477 }
9478
9479 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js
9480 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
9481 var TooltipPortal = /* @__PURE__ */ React52.forwardRef(function TooltipPortal2(props, forwardedRef) {
9482 const {
9483 keepMounted = false,
9484 ...portalProps
9485 } = props;
9486 const store = useTooltipRootContext();
9487 const mounted = store.useState("mounted");
9488 const shouldRender = mounted || keepMounted;
9489 if (!shouldRender) {
9490 return null;
9491 }
9492 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPortalContext.Provider, {
9493 value: keepMounted,
9494 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FloatingPortalLite, {
9495 ref: forwardedRef,
9496 ...portalProps
9497 })
9498 });
9499 });
9500 if (true) TooltipPortal.displayName = "TooltipPortal";
9501
9502 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js
9503 var React54 = __toESM(require_react(), 1);
9504
9505 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js
9506 var React53 = __toESM(require_react(), 1);
9507 var TooltipPositionerContext = /* @__PURE__ */ React53.createContext(void 0);
9508 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
9509 function useTooltipPositionerContext() {
9510 const context = React53.useContext(TooltipPositionerContext);
9511 if (context === void 0) {
9512 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
9513 }
9514 return context;
9515 }
9516
9517 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js
9518 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
9519 var TooltipPositioner = /* @__PURE__ */ React54.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
9520 const {
9521 render: render4,
9522 className,
9523 anchor,
9524 positionMethod = "absolute",
9525 side = "top",
9526 align = "center",
9527 sideOffset = 0,
9528 alignOffset = 0,
9529 collisionBoundary = "clipping-ancestors",
9530 collisionPadding = 5,
9531 arrowPadding = 5,
9532 sticky = false,
9533 disableAnchorTracking = false,
9534 collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
9535 style,
9536 ...elementProps
9537 } = componentProps;
9538 const store = useTooltipRootContext();
9539 const keepMounted = useTooltipPortalContext();
9540 const open = store.useState("open");
9541 const mounted = store.useState("mounted");
9542 const trackCursorAxis = store.useState("trackCursorAxis");
9543 const disableHoverablePopup = store.useState("disableHoverablePopup");
9544 const floatingRootContext = store.useState("floatingRootContext");
9545 const instantType = store.useState("instantType");
9546 const transitionStatus = store.useState("transitionStatus");
9547 const hasViewport = store.useState("hasViewport");
9548 const positioning = useAnchorPositioning({
9549 anchor,
9550 positionMethod,
9551 floatingRootContext,
9552 mounted,
9553 side,
9554 sideOffset,
9555 align,
9556 alignOffset,
9557 collisionBoundary,
9558 collisionPadding,
9559 sticky,
9560 arrowPadding,
9561 disableAnchorTracking,
9562 keepMounted,
9563 collisionAvoidance,
9564 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0
9565 });
9566 const state = React54.useMemo(() => ({
9567 open,
9568 side: positioning.side,
9569 align: positioning.align,
9570 anchorHidden: positioning.anchorHidden,
9571 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
9572 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
9573 const element = usePositioner(componentProps, state, {
9574 styles: positioning.positionerStyles,
9575 transitionStatus,
9576 props: elementProps,
9577 refs: [forwardedRef, store.useStateSetter("positionerElement")],
9578 hidden: !mounted,
9579 inert: !open || trackCursorAxis === "both" || disableHoverablePopup
9580 });
9581 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPositionerContext.Provider, {
9582 value: positioning,
9583 children: element
9584 });
9585 });
9586 if (true) TooltipPositioner.displayName = "TooltipPositioner";
9587
9588 // node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js
9589 var React55 = __toESM(require_react(), 1);
9590 var stateAttributesMapping2 = {
9591 ...popupStateMapping,
9592 ...transitionStatusMapping
9593 };
9594 var TooltipPopup = /* @__PURE__ */ React55.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
9595 const {
9596 className,
9597 render: render4,
9598 style,
9599 ...elementProps
9600 } = componentProps;
9601 const store = useTooltipRootContext();
9602 const {
9603 side,
9604 align
9605 } = useTooltipPositionerContext();
9606 const open = store.useState("open");
9607 const instantType = store.useState("instantType");
9608 const transitionStatus = store.useState("transitionStatus");
9609 const popupProps = store.useState("popupProps");
9610 const floatingContext = store.useState("floatingRootContext");
9611 useOpenChangeComplete({
9612 open,
9613 ref: store.context.popupRef,
9614 onComplete() {
9615 if (open) {
9616 store.context.onOpenChangeComplete?.(true);
9617 }
9618 }
9619 });
9620 const disabled2 = store.useState("disabled");
9621 const closeDelay = store.useState("closeDelay");
9622 useHoverFloatingInteraction(floatingContext, {
9623 enabled: !disabled2,
9624 closeDelay
9625 });
9626 const state = {
9627 open,
9628 side,
9629 align,
9630 instant: instantType,
9631 transitionStatus
9632 };
9633 const element = useRenderElement("div", componentProps, {
9634 state,
9635 ref: [forwardedRef, store.context.popupRef, store.useStateSetter("popupElement")],
9636 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
9637 stateAttributesMapping: stateAttributesMapping2
9638 });
9639 return element;
9640 });
9641 if (true) TooltipPopup.displayName = "TooltipPopup";
9642
9643 // node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js
9644 var React56 = __toESM(require_react(), 1);
9645 var TooltipArrow = /* @__PURE__ */ React56.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
9646 const {
9647 className,
9648 render: render4,
9649 style,
9650 ...elementProps
9651 } = componentProps;
9652 const store = useTooltipRootContext();
9653 const open = store.useState("open");
9654 const instantType = store.useState("instantType");
9655 const {
9656 arrowRef,
9657 side,
9658 align,
9659 arrowUncentered,
9660 arrowStyles
9661 } = useTooltipPositionerContext();
9662 const state = {
9663 open,
9664 side,
9665 align,
9666 uncentered: arrowUncentered,
9667 instant: instantType
9668 };
9669 const element = useRenderElement("div", componentProps, {
9670 state,
9671 ref: [forwardedRef, arrowRef],
9672 props: [{
9673 style: arrowStyles,
9674 "aria-hidden": true
9675 }, elementProps],
9676 stateAttributesMapping: popupStateMapping
9677 });
9678 return element;
9679 });
9680 if (true) TooltipArrow.displayName = "TooltipArrow";
9681
9682 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js
9683 var React57 = __toESM(require_react(), 1);
9684 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
9685 var TooltipProvider = function TooltipProvider2(props) {
9686 const {
9687 delay,
9688 closeDelay,
9689 timeout = 400
9690 } = props;
9691 const contextValue = React57.useMemo(() => ({
9692 delay,
9693 closeDelay
9694 }), [delay, closeDelay]);
9695 const delayValue = React57.useMemo(() => ({
9696 open: delay,
9697 close: closeDelay
9698 }), [delay, closeDelay]);
9699 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProviderContext.Provider, {
9700 value: contextValue,
9701 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FloatingDelayGroup, {
9702 delay: delayValue,
9703 timeoutMs: timeout,
9704 children: props.children
9705 })
9706 });
9707 };
9708 if (true) TooltipProvider.displayName = "TooltipProvider";
9709
9710 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js
9711 var React58 = __toESM(require_react(), 1);
9712
9713 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js
9714 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) {
9715 TooltipViewportCssVars2["popupWidth"] = "--popup-width";
9716 TooltipViewportCssVars2["popupHeight"] = "--popup-height";
9717 return TooltipViewportCssVars2;
9718 })({});
9719
9720 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js
9721 var stateAttributesMapping3 = {
9722 activationDirection: (value) => value ? {
9723 "data-activation-direction": value
9724 } : null
9725 };
9726 var TooltipViewport = /* @__PURE__ */ React58.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
9727 const {
9728 render: render4,
9729 className,
9730 style,
9731 children,
9732 ...elementProps
9733 } = componentProps;
9734 const store = useTooltipRootContext();
9735 const positioner = useTooltipPositionerContext();
9736 const instantType = store.useState("instantType");
9737 const {
9738 children: childrenToRender,
9739 state: viewportState
9740 } = usePopupViewport({
9741 store,
9742 side: positioner.side,
9743 cssVars: TooltipViewportCssVars,
9744 children
9745 });
9746 const state = {
9747 activationDirection: viewportState.activationDirection,
9748 transitioning: viewportState.transitioning,
9749 instant: instantType
9750 };
9751 return useRenderElement("div", componentProps, {
9752 state,
9753 ref: forwardedRef,
9754 props: [elementProps, {
9755 children: childrenToRender
9756 }],
9757 stateAttributesMapping: stateAttributesMapping3
9758 });
9759 });
9760 if (true) TooltipViewport.displayName = "TooltipViewport";
9761
9762 // node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js
9763 var TooltipHandle = class {
9764 /**
9765 * Internal store holding the tooltip state.
9766 * @internal
9767 */
9768 constructor() {
9769 this.store = new TooltipStore();
9770 }
9771 /**
9772 * Opens the tooltip and associates it with the trigger with the given ID.
9773 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop.
9774 *
9775 * This method should only be called in an event handler or an effect (not during rendering).
9776 *
9777 * @param triggerId ID of the trigger to associate with the tooltip.
9778 */
9779 open(triggerId) {
9780 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
9781 if (triggerId && !triggerElement) {
9782 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "${triggerId}".` : formatErrorMessage_default(81, triggerId));
9783 }
9784 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
9785 }
9786 /**
9787 * Closes the tooltip.
9788 */
9789 close() {
9790 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0));
9791 }
9792 /**
9793 * Indicates whether the tooltip is currently open.
9794 */
9795 get isOpen() {
9796 return this.store.state.open;
9797 }
9798 };
9799 function createTooltipHandle() {
9800 return new TooltipHandle();
9801 }
9802
9803 // node_modules/@base-ui/react/esm/use-render/useRender.js
9804 function useRender(params) {
9805 return useRenderElement(params.defaultTagName ?? "div", params, params);
9806 }
9807
9808 // packages/ui/build-module/text/text.mjs
9809 var import_element8 = __toESM(require_element(), 1);
9810 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
9811 function getRuntime() {
9812 const globalScope = globalThis;
9813 if (globalScope.__wpStyleRuntime) {
9814 return globalScope.__wpStyleRuntime;
9815 }
9816 globalScope.__wpStyleRuntime = {
9817 documents: /* @__PURE__ */ new Map(),
9818 styles: /* @__PURE__ */ new Map(),
9819 injectedStyles: /* @__PURE__ */ new WeakMap()
9820 };
9821 if (typeof document !== "undefined") {
9822 registerDocument(document);
9823 }
9824 return globalScope.__wpStyleRuntime;
9825 }
9826 function documentContainsStyleHash(targetDocument, hash) {
9827 if (!targetDocument.head) {
9828 return false;
9829 }
9830 for (const style of targetDocument.head.querySelectorAll(
9831 `style[${STYLE_HASH_ATTRIBUTE}]`
9832 )) {
9833 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
9834 return true;
9835 }
9836 }
9837 return false;
9838 }
9839 function injectStyle(targetDocument, hash, css) {
9840 if (!targetDocument.head) {
9841 return;
9842 }
9843 const runtime = getRuntime();
9844 let injectedStyles = runtime.injectedStyles.get(targetDocument);
9845 if (!injectedStyles) {
9846 injectedStyles = /* @__PURE__ */ new Set();
9847 runtime.injectedStyles.set(targetDocument, injectedStyles);
9848 }
9849 if (injectedStyles.has(hash)) {
9850 return;
9851 }
9852 if (documentContainsStyleHash(targetDocument, hash)) {
9853 injectedStyles.add(hash);
9854 return;
9855 }
9856 const style = targetDocument.createElement("style");
9857 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
9858 style.appendChild(targetDocument.createTextNode(css));
9859 targetDocument.head.appendChild(style);
9860 injectedStyles.add(hash);
9861 }
9862 function registerDocument(targetDocument) {
9863 const runtime = getRuntime();
9864 runtime.documents.set(
9865 targetDocument,
9866 (runtime.documents.get(targetDocument) ?? 0) + 1
9867 );
9868 for (const [hash, css] of runtime.styles) {
9869 injectStyle(targetDocument, hash, css);
9870 }
9871 return () => {
9872 const count = runtime.documents.get(targetDocument);
9873 if (count === void 0) {
9874 return;
9875 }
9876 if (count <= 1) {
9877 runtime.documents.delete(targetDocument);
9878 return;
9879 }
9880 runtime.documents.set(targetDocument, count - 1);
9881 };
9882 }
9883 function registerStyle(hash, css) {
9884 const runtime = getRuntime();
9885 runtime.styles.set(hash, css);
9886 for (const targetDocument of runtime.documents.keys()) {
9887 injectStyle(targetDocument, hash, css);
9888 }
9889 }
9890 if (typeof process === "undefined" || true) {
9891 registerStyle("0c8601dd83", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}');
9892 }
9893 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
9894 if (typeof process === "undefined" || true) {
9895 registerStyle("1fb29d3a3c", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}");
9896 }
9897 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
9898 var Text = (0, import_element8.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) {
9899 const element = useRender({
9900 render: render4,
9901 defaultTagName: "span",
9902 ref,
9903 props: mergeProps(props, {
9904 className: clsx_default(
9905 style_default.text,
9906 global_css_defense_default.heading,
9907 global_css_defense_default.p,
9908 style_default[variant],
9909 className
9910 )
9911 })
9912 });
9913 return element;
9914 });
9915
9916 // packages/ui/build-module/badge/badge.mjs
9917 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
9918 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
9919 function getRuntime2() {
9920 const globalScope = globalThis;
9921 if (globalScope.__wpStyleRuntime) {
9922 return globalScope.__wpStyleRuntime;
9923 }
9924 globalScope.__wpStyleRuntime = {
9925 documents: /* @__PURE__ */ new Map(),
9926 styles: /* @__PURE__ */ new Map(),
9927 injectedStyles: /* @__PURE__ */ new WeakMap()
9928 };
9929 if (typeof document !== "undefined") {
9930 registerDocument2(document);
9931 }
9932 return globalScope.__wpStyleRuntime;
9933 }
9934 function documentContainsStyleHash2(targetDocument, hash) {
9935 if (!targetDocument.head) {
9936 return false;
9937 }
9938 for (const style of targetDocument.head.querySelectorAll(
9939 `style[${STYLE_HASH_ATTRIBUTE2}]`
9940 )) {
9941 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
9942 return true;
9943 }
9944 }
9945 return false;
9946 }
9947 function injectStyle2(targetDocument, hash, css) {
9948 if (!targetDocument.head) {
9949 return;
9950 }
9951 const runtime = getRuntime2();
9952 let injectedStyles = runtime.injectedStyles.get(targetDocument);
9953 if (!injectedStyles) {
9954 injectedStyles = /* @__PURE__ */ new Set();
9955 runtime.injectedStyles.set(targetDocument, injectedStyles);
9956 }
9957 if (injectedStyles.has(hash)) {
9958 return;
9959 }
9960 if (documentContainsStyleHash2(targetDocument, hash)) {
9961 injectedStyles.add(hash);
9962 return;
9963 }
9964 const style = targetDocument.createElement("style");
9965 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
9966 style.appendChild(targetDocument.createTextNode(css));
9967 targetDocument.head.appendChild(style);
9968 injectedStyles.add(hash);
9969 }
9970 function registerDocument2(targetDocument) {
9971 const runtime = getRuntime2();
9972 runtime.documents.set(
9973 targetDocument,
9974 (runtime.documents.get(targetDocument) ?? 0) + 1
9975 );
9976 for (const [hash, css] of runtime.styles) {
9977 injectStyle2(targetDocument, hash, css);
9978 }
9979 return () => {
9980 const count = runtime.documents.get(targetDocument);
9981 if (count === void 0) {
9982 return;
9983 }
9984 if (count <= 1) {
9985 runtime.documents.delete(targetDocument);
9986 return;
9987 }
9988 runtime.documents.set(targetDocument, count - 1);
9989 };
9990 }
9991 function registerStyle2(hash, css) {
9992 const runtime = getRuntime2();
9993 runtime.styles.set(hash, css);
9994 for (const targetDocument of runtime.documents.keys()) {
9995 injectStyle2(targetDocument, hash, css);
9996 }
9997 }
9998 if (typeof process === "undefined" || true) {
9999 registerStyle2("d6a685e1aa", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6be);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee995);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c6f7cd);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-fg-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}");
10000 }
10001 var style_default2 = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" };
10002 var Badge = (0, import_element9.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) {
10003 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10004 Text,
10005 {
10006 ref,
10007 className: clsx_default(
10008 style_default2.badge,
10009 style_default2[`is-${intent}-intent`],
10010 className
10011 ),
10012 ...props,
10013 variant: "body-sm"
10014 }
10015 );
10016 });
10017
10018 // packages/ui/build-module/button/button.mjs
10019 var import_element10 = __toESM(require_element(), 1);
10020 var import_i18n = __toESM(require_i18n(), 1);
10021 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
10022 import { speak } from "@wordpress/a11y";
10023 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
10024 function getRuntime3() {
10025 const globalScope = globalThis;
10026 if (globalScope.__wpStyleRuntime) {
10027 return globalScope.__wpStyleRuntime;
10028 }
10029 globalScope.__wpStyleRuntime = {
10030 documents: /* @__PURE__ */ new Map(),
10031 styles: /* @__PURE__ */ new Map(),
10032 injectedStyles: /* @__PURE__ */ new WeakMap()
10033 };
10034 if (typeof document !== "undefined") {
10035 registerDocument3(document);
10036 }
10037 return globalScope.__wpStyleRuntime;
10038 }
10039 function documentContainsStyleHash3(targetDocument, hash) {
10040 if (!targetDocument.head) {
10041 return false;
10042 }
10043 for (const style of targetDocument.head.querySelectorAll(
10044 `style[${STYLE_HASH_ATTRIBUTE3}]`
10045 )) {
10046 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
10047 return true;
10048 }
10049 }
10050 return false;
10051 }
10052 function injectStyle3(targetDocument, hash, css) {
10053 if (!targetDocument.head) {
10054 return;
10055 }
10056 const runtime = getRuntime3();
10057 let injectedStyles = runtime.injectedStyles.get(targetDocument);
10058 if (!injectedStyles) {
10059 injectedStyles = /* @__PURE__ */ new Set();
10060 runtime.injectedStyles.set(targetDocument, injectedStyles);
10061 }
10062 if (injectedStyles.has(hash)) {
10063 return;
10064 }
10065 if (documentContainsStyleHash3(targetDocument, hash)) {
10066 injectedStyles.add(hash);
10067 return;
10068 }
10069 const style = targetDocument.createElement("style");
10070 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
10071 style.appendChild(targetDocument.createTextNode(css));
10072 targetDocument.head.appendChild(style);
10073 injectedStyles.add(hash);
10074 }
10075 function registerDocument3(targetDocument) {
10076 const runtime = getRuntime3();
10077 runtime.documents.set(
10078 targetDocument,
10079 (runtime.documents.get(targetDocument) ?? 0) + 1
10080 );
10081 for (const [hash, css] of runtime.styles) {
10082 injectStyle3(targetDocument, hash, css);
10083 }
10084 return () => {
10085 const count = runtime.documents.get(targetDocument);
10086 if (count === void 0) {
10087 return;
10088 }
10089 if (count <= 1) {
10090 runtime.documents.delete(targetDocument);
10091 return;
10092 }
10093 runtime.documents.set(targetDocument, count - 1);
10094 };
10095 }
10096 function registerStyle3(hash, css) {
10097 const runtime = getRuntime3();
10098 runtime.styles.set(hash, css);
10099 for (const targetDocument of runtime.documents.keys()) {
10100 injectStyle3(targetDocument, hash, css);
10101 }
10102 }
10103 if (typeof process === "undefined" || true) {
10104 registerStyle3("7d54255a4c", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:499;--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:40px;--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:#0000;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:#0000;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:24px}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:32px}._914b42f315c0e580__is-loading{color:#0000;&:not([data-disabled]):is(:hover,:active,:focus){color:#0000}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}');
10105 }
10106 var style_default3 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
10107 if (typeof process === "undefined" || true) {
10108 registerStyle3("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}");
10109 }
10110 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
10111 if (typeof process === "undefined" || true) {
10112 registerStyle3("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}");
10113 }
10114 var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
10115 if (typeof process === "undefined" || true) {
10116 registerStyle3("1fb29d3a3c", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}");
10117 }
10118 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
10119 var Button3 = (0, import_element10.forwardRef)(
10120 function Button22({
10121 tone = "brand",
10122 variant = "solid",
10123 size: size4 = "default",
10124 className,
10125 focusableWhenDisabled = true,
10126 disabled: disabled2,
10127 loading,
10128 loadingAnnouncement = (0, import_i18n.__)("Loading"),
10129 children,
10130 ...props
10131 }, ref) {
10132 const mergedClassName = clsx_default(
10133 global_css_defense_default2.button,
10134 resets_default["box-sizing"],
10135 focus_default["outset-ring--focus-except-active"],
10136 variant !== "unstyled" && style_default3.button,
10137 style_default3[`is-${tone}`],
10138 style_default3[`is-${variant}`],
10139 style_default3[`is-${size4}`],
10140 loading && style_default3["is-loading"],
10141 className
10142 );
10143 (0, import_element10.useEffect)(() => {
10144 if (loading && loadingAnnouncement) {
10145 speak(loadingAnnouncement);
10146 }
10147 }, [loading, loadingAnnouncement]);
10148 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10149 Button,
10150 {
10151 ref,
10152 className: mergedClassName,
10153 focusableWhenDisabled,
10154 disabled: disabled2 ?? loading,
10155 ...props,
10156 children
10157 }
10158 );
10159 }
10160 );
10161
10162 // packages/ui/build-module/button/icon.mjs
10163 var import_element12 = __toESM(require_element(), 1);
10164
10165 // packages/ui/build-module/icon/icon.mjs
10166 var import_element11 = __toESM(require_element(), 1);
10167 var import_primitives = __toESM(require_primitives(), 1);
10168 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
10169 var Icon = (0, import_element11.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) {
10170 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10171 import_primitives.SVG,
10172 {
10173 ref,
10174 fill: "currentColor",
10175 ...icon.props,
10176 ...restProps,
10177 width: size4,
10178 height: size4
10179 }
10180 );
10181 });
10182
10183 // packages/ui/build-module/button/icon.mjs
10184 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
10185 var ButtonIcon = (0, import_element12.forwardRef)(
10186 function ButtonIcon2({ icon, ...props }, ref) {
10187 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10188 Icon,
10189 {
10190 ref,
10191 icon,
10192 viewBox: "4 4 16 16",
10193 size: 16,
10194 ...props
10195 }
10196 );
10197 }
10198 );
10199
10200 // packages/ui/build-module/button/index.mjs
10201 ButtonIcon.displayName = "Button.Icon";
10202 var Button4 = Object.assign(Button3, {
10203 /**
10204 * An icon component specifically designed to work well when rendered inside
10205 * a `Button` component.
10206 */
10207 Icon: ButtonIcon
10208 });
10209
10210 // packages/ui/build-module/card/index.mjs
10211 var card_exports = {};
10212 __export(card_exports, {
10213 Content: () => Content,
10214 FullBleed: () => FullBleed,
10215 Header: () => Header,
10216 Root: () => Root,
10217 Title: () => Title
10218 });
10219
10220 // packages/ui/build-module/card/root.mjs
10221 var import_element13 = __toESM(require_element(), 1);
10222 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
10223 function getRuntime4() {
10224 const globalScope = globalThis;
10225 if (globalScope.__wpStyleRuntime) {
10226 return globalScope.__wpStyleRuntime;
10227 }
10228 globalScope.__wpStyleRuntime = {
10229 documents: /* @__PURE__ */ new Map(),
10230 styles: /* @__PURE__ */ new Map(),
10231 injectedStyles: /* @__PURE__ */ new WeakMap()
10232 };
10233 if (typeof document !== "undefined") {
10234 registerDocument4(document);
10235 }
10236 return globalScope.__wpStyleRuntime;
10237 }
10238 function documentContainsStyleHash4(targetDocument, hash) {
10239 if (!targetDocument.head) {
10240 return false;
10241 }
10242 for (const style of targetDocument.head.querySelectorAll(
10243 `style[${STYLE_HASH_ATTRIBUTE4}]`
10244 )) {
10245 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
10246 return true;
10247 }
10248 }
10249 return false;
10250 }
10251 function injectStyle4(targetDocument, hash, css) {
10252 if (!targetDocument.head) {
10253 return;
10254 }
10255 const runtime = getRuntime4();
10256 let injectedStyles = runtime.injectedStyles.get(targetDocument);
10257 if (!injectedStyles) {
10258 injectedStyles = /* @__PURE__ */ new Set();
10259 runtime.injectedStyles.set(targetDocument, injectedStyles);
10260 }
10261 if (injectedStyles.has(hash)) {
10262 return;
10263 }
10264 if (documentContainsStyleHash4(targetDocument, hash)) {
10265 injectedStyles.add(hash);
10266 return;
10267 }
10268 const style = targetDocument.createElement("style");
10269 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
10270 style.appendChild(targetDocument.createTextNode(css));
10271 targetDocument.head.appendChild(style);
10272 injectedStyles.add(hash);
10273 }
10274 function registerDocument4(targetDocument) {
10275 const runtime = getRuntime4();
10276 runtime.documents.set(
10277 targetDocument,
10278 (runtime.documents.get(targetDocument) ?? 0) + 1
10279 );
10280 for (const [hash, css] of runtime.styles) {
10281 injectStyle4(targetDocument, hash, css);
10282 }
10283 return () => {
10284 const count = runtime.documents.get(targetDocument);
10285 if (count === void 0) {
10286 return;
10287 }
10288 if (count <= 1) {
10289 runtime.documents.delete(targetDocument);
10290 return;
10291 }
10292 runtime.documents.set(targetDocument, count - 1);
10293 };
10294 }
10295 function registerStyle4(hash, css) {
10296 const runtime = getRuntime4();
10297 runtime.styles.set(hash, css);
10298 for (const targetDocument of runtime.documents.keys()) {
10299 injectStyle4(targetDocument, hash, css);
10300 }
10301 }
10302 if (typeof process === "undefined" || true) {
10303 registerStyle4("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}");
10304 }
10305 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
10306 if (typeof process === "undefined" || true) {
10307 registerStyle4("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}");
10308 }
10309 var style_default4 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
10310 var Root = (0, import_element13.forwardRef)(function Card({ render: render4, ...restProps }, ref) {
10311 const mergedClassName = clsx_default(style_default4.root, resets_default2["box-sizing"]);
10312 const element = useRender({
10313 defaultTagName: "div",
10314 render: render4,
10315 ref,
10316 props: mergeProps({ className: mergedClassName }, restProps)
10317 });
10318 return element;
10319 });
10320
10321 // packages/ui/build-module/card/header.mjs
10322 var import_element14 = __toESM(require_element(), 1);
10323 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
10324 function getRuntime5() {
10325 const globalScope = globalThis;
10326 if (globalScope.__wpStyleRuntime) {
10327 return globalScope.__wpStyleRuntime;
10328 }
10329 globalScope.__wpStyleRuntime = {
10330 documents: /* @__PURE__ */ new Map(),
10331 styles: /* @__PURE__ */ new Map(),
10332 injectedStyles: /* @__PURE__ */ new WeakMap()
10333 };
10334 if (typeof document !== "undefined") {
10335 registerDocument5(document);
10336 }
10337 return globalScope.__wpStyleRuntime;
10338 }
10339 function documentContainsStyleHash5(targetDocument, hash) {
10340 if (!targetDocument.head) {
10341 return false;
10342 }
10343 for (const style of targetDocument.head.querySelectorAll(
10344 `style[${STYLE_HASH_ATTRIBUTE5}]`
10345 )) {
10346 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
10347 return true;
10348 }
10349 }
10350 return false;
10351 }
10352 function injectStyle5(targetDocument, hash, css) {
10353 if (!targetDocument.head) {
10354 return;
10355 }
10356 const runtime = getRuntime5();
10357 let injectedStyles = runtime.injectedStyles.get(targetDocument);
10358 if (!injectedStyles) {
10359 injectedStyles = /* @__PURE__ */ new Set();
10360 runtime.injectedStyles.set(targetDocument, injectedStyles);
10361 }
10362 if (injectedStyles.has(hash)) {
10363 return;
10364 }
10365 if (documentContainsStyleHash5(targetDocument, hash)) {
10366 injectedStyles.add(hash);
10367 return;
10368 }
10369 const style = targetDocument.createElement("style");
10370 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
10371 style.appendChild(targetDocument.createTextNode(css));
10372 targetDocument.head.appendChild(style);
10373 injectedStyles.add(hash);
10374 }
10375 function registerDocument5(targetDocument) {
10376 const runtime = getRuntime5();
10377 runtime.documents.set(
10378 targetDocument,
10379 (runtime.documents.get(targetDocument) ?? 0) + 1
10380 );
10381 for (const [hash, css] of runtime.styles) {
10382 injectStyle5(targetDocument, hash, css);
10383 }
10384 return () => {
10385 const count = runtime.documents.get(targetDocument);
10386 if (count === void 0) {
10387 return;
10388 }
10389 if (count <= 1) {
10390 runtime.documents.delete(targetDocument);
10391 return;
10392 }
10393 runtime.documents.set(targetDocument, count - 1);
10394 };
10395 }
10396 function registerStyle5(hash, css) {
10397 const runtime = getRuntime5();
10398 runtime.styles.set(hash, css);
10399 for (const targetDocument of runtime.documents.keys()) {
10400 injectStyle5(targetDocument, hash, css);
10401 }
10402 }
10403 if (typeof process === "undefined" || true) {
10404 registerStyle5("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}");
10405 }
10406 var style_default5 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
10407 var Header = (0, import_element14.forwardRef)(
10408 function CardHeader({ render: render4, ...props }, ref) {
10409 const element = useRender({
10410 defaultTagName: "div",
10411 render: render4,
10412 ref,
10413 props: mergeProps({ className: style_default5.header }, props)
10414 });
10415 return element;
10416 }
10417 );
10418
10419 // packages/ui/build-module/card/content.mjs
10420 var import_element15 = __toESM(require_element(), 1);
10421 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
10422 function getRuntime6() {
10423 const globalScope = globalThis;
10424 if (globalScope.__wpStyleRuntime) {
10425 return globalScope.__wpStyleRuntime;
10426 }
10427 globalScope.__wpStyleRuntime = {
10428 documents: /* @__PURE__ */ new Map(),
10429 styles: /* @__PURE__ */ new Map(),
10430 injectedStyles: /* @__PURE__ */ new WeakMap()
10431 };
10432 if (typeof document !== "undefined") {
10433 registerDocument6(document);
10434 }
10435 return globalScope.__wpStyleRuntime;
10436 }
10437 function documentContainsStyleHash6(targetDocument, hash) {
10438 if (!targetDocument.head) {
10439 return false;
10440 }
10441 for (const style of targetDocument.head.querySelectorAll(
10442 `style[${STYLE_HASH_ATTRIBUTE6}]`
10443 )) {
10444 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
10445 return true;
10446 }
10447 }
10448 return false;
10449 }
10450 function injectStyle6(targetDocument, hash, css) {
10451 if (!targetDocument.head) {
10452 return;
10453 }
10454 const runtime = getRuntime6();
10455 let injectedStyles = runtime.injectedStyles.get(targetDocument);
10456 if (!injectedStyles) {
10457 injectedStyles = /* @__PURE__ */ new Set();
10458 runtime.injectedStyles.set(targetDocument, injectedStyles);
10459 }
10460 if (injectedStyles.has(hash)) {
10461 return;
10462 }
10463 if (documentContainsStyleHash6(targetDocument, hash)) {
10464 injectedStyles.add(hash);
10465 return;
10466 }
10467 const style = targetDocument.createElement("style");
10468 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
10469 style.appendChild(targetDocument.createTextNode(css));
10470 targetDocument.head.appendChild(style);
10471 injectedStyles.add(hash);
10472 }
10473 function registerDocument6(targetDocument) {
10474 const runtime = getRuntime6();
10475 runtime.documents.set(
10476 targetDocument,
10477 (runtime.documents.get(targetDocument) ?? 0) + 1
10478 );
10479 for (const [hash, css] of runtime.styles) {
10480 injectStyle6(targetDocument, hash, css);
10481 }
10482 return () => {
10483 const count = runtime.documents.get(targetDocument);
10484 if (count === void 0) {
10485 return;
10486 }
10487 if (count <= 1) {
10488 runtime.documents.delete(targetDocument);
10489 return;
10490 }
10491 runtime.documents.set(targetDocument, count - 1);
10492 };
10493 }
10494 function registerStyle6(hash, css) {
10495 const runtime = getRuntime6();
10496 runtime.styles.set(hash, css);
10497 for (const targetDocument of runtime.documents.keys()) {
10498 injectStyle6(targetDocument, hash, css);
10499 }
10500 }
10501 if (typeof process === "undefined" || true) {
10502 registerStyle6("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}");
10503 }
10504 var style_default6 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
10505 var Content = (0, import_element15.forwardRef)(
10506 function CardContent({ render: render4, ...props }, ref) {
10507 const element = useRender({
10508 defaultTagName: "div",
10509 render: render4,
10510 ref,
10511 props: mergeProps({ className: style_default6.content }, props)
10512 });
10513 return element;
10514 }
10515 );
10516
10517 // packages/ui/build-module/card/full-bleed.mjs
10518 var import_element16 = __toESM(require_element(), 1);
10519 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash";
10520 function getRuntime7() {
10521 const globalScope = globalThis;
10522 if (globalScope.__wpStyleRuntime) {
10523 return globalScope.__wpStyleRuntime;
10524 }
10525 globalScope.__wpStyleRuntime = {
10526 documents: /* @__PURE__ */ new Map(),
10527 styles: /* @__PURE__ */ new Map(),
10528 injectedStyles: /* @__PURE__ */ new WeakMap()
10529 };
10530 if (typeof document !== "undefined") {
10531 registerDocument7(document);
10532 }
10533 return globalScope.__wpStyleRuntime;
10534 }
10535 function documentContainsStyleHash7(targetDocument, hash) {
10536 if (!targetDocument.head) {
10537 return false;
10538 }
10539 for (const style of targetDocument.head.querySelectorAll(
10540 `style[${STYLE_HASH_ATTRIBUTE7}]`
10541 )) {
10542 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) {
10543 return true;
10544 }
10545 }
10546 return false;
10547 }
10548 function injectStyle7(targetDocument, hash, css) {
10549 if (!targetDocument.head) {
10550 return;
10551 }
10552 const runtime = getRuntime7();
10553 let injectedStyles = runtime.injectedStyles.get(targetDocument);
10554 if (!injectedStyles) {
10555 injectedStyles = /* @__PURE__ */ new Set();
10556 runtime.injectedStyles.set(targetDocument, injectedStyles);
10557 }
10558 if (injectedStyles.has(hash)) {
10559 return;
10560 }
10561 if (documentContainsStyleHash7(targetDocument, hash)) {
10562 injectedStyles.add(hash);
10563 return;
10564 }
10565 const style = targetDocument.createElement("style");
10566 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash);
10567 style.appendChild(targetDocument.createTextNode(css));
10568 targetDocument.head.appendChild(style);
10569 injectedStyles.add(hash);
10570 }
10571 function registerDocument7(targetDocument) {
10572 const runtime = getRuntime7();
10573 runtime.documents.set(
10574 targetDocument,
10575 (runtime.documents.get(targetDocument) ?? 0) + 1
10576 );
10577 for (const [hash, css] of runtime.styles) {
10578 injectStyle7(targetDocument, hash, css);
10579 }
10580 return () => {
10581 const count = runtime.documents.get(targetDocument);
10582 if (count === void 0) {
10583 return;
10584 }
10585 if (count <= 1) {
10586 runtime.documents.delete(targetDocument);
10587 return;
10588 }
10589 runtime.documents.set(targetDocument, count - 1);
10590 };
10591 }
10592 function registerStyle7(hash, css) {
10593 const runtime = getRuntime7();
10594 runtime.styles.set(hash, css);
10595 for (const targetDocument of runtime.documents.keys()) {
10596 injectStyle7(targetDocument, hash, css);
10597 }
10598 }
10599 if (typeof process === "undefined" || true) {
10600 registerStyle7("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}");
10601 }
10602 var style_default7 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
10603 var FullBleed = (0, import_element16.forwardRef)(
10604 function CardFullBleed({ render: render4, ...props }, ref) {
10605 const element = useRender({
10606 defaultTagName: "div",
10607 render: render4,
10608 ref,
10609 props: mergeProps(
10610 { className: style_default7.fullbleed },
10611 props
10612 )
10613 });
10614 return element;
10615 }
10616 );
10617
10618 // packages/ui/build-module/card/title.mjs
10619 var import_element17 = __toESM(require_element(), 1);
10620 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
10621 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", {});
10622 var Title = (0, import_element17.forwardRef)(
10623 function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) {
10624 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10625 Text,
10626 {
10627 ref,
10628 variant: "heading-lg",
10629 render: render4,
10630 ...props,
10631 children
10632 }
10633 );
10634 }
10635 );
10636
10637 // packages/ui/build-module/collapsible/panel.mjs
10638 var import_element18 = __toESM(require_element(), 1);
10639 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
10640 var Panel = (0, import_element18.forwardRef)(
10641 function CollapsiblePanel3(props, forwardedRef) {
10642 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props });
10643 }
10644 );
10645
10646 // packages/ui/build-module/collapsible/root.mjs
10647 var import_element19 = __toESM(require_element(), 1);
10648 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
10649 var Root2 = (0, import_element19.forwardRef)(
10650 function CollapsibleRoot3(props, forwardedRef) {
10651 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props });
10652 }
10653 );
10654
10655 // packages/ui/build-module/collapsible/trigger.mjs
10656 var import_element20 = __toESM(require_element(), 1);
10657 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
10658 var Trigger = (0, import_element20.forwardRef)(
10659 function CollapsibleTrigger3(props, forwardedRef) {
10660 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props });
10661 }
10662 );
10663
10664 // packages/ui/build-module/collapsible-card/index.mjs
10665 var collapsible_card_exports = {};
10666 __export(collapsible_card_exports, {
10667 Content: () => Content2,
10668 Header: () => Header2,
10669 HeaderDescription: () => HeaderDescription,
10670 Root: () => Root3
10671 });
10672
10673 // packages/ui/build-module/collapsible-card/root.mjs
10674 var import_element21 = __toESM(require_element(), 1);
10675 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
10676 var Root3 = (0, import_element21.forwardRef)(
10677 function CollapsibleCardRoot({ render: render4, ...restProps }, ref) {
10678 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
10679 Root2,
10680 {
10681 ref,
10682 render: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Root, { render: render4 }),
10683 ...restProps
10684 }
10685 );
10686 }
10687 );
10688
10689 // packages/ui/build-module/collapsible-card/header.mjs
10690 var import_element23 = __toESM(require_element(), 1);
10691
10692 // packages/icons/build-module/library/arrow-down.mjs
10693 var import_primitives2 = __toESM(require_primitives(), 1);
10694 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
10695 var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives2.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) });
10696
10697 // packages/icons/build-module/library/arrow-left.mjs
10698 var import_primitives3 = __toESM(require_primitives(), 1);
10699 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
10700 var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives3.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) });
10701
10702 // packages/icons/build-module/library/arrow-right.mjs
10703 var import_primitives4 = __toESM(require_primitives(), 1);
10704 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
10705 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives4.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) });
10706
10707 // packages/icons/build-module/library/arrow-up.mjs
10708 var import_primitives5 = __toESM(require_primitives(), 1);
10709 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
10710 var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives5.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) });
10711
10712 // packages/icons/build-module/library/block-table.mjs
10713 var import_primitives6 = __toESM(require_primitives(), 1);
10714 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
10715 var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives6.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) });
10716
10717 // packages/icons/build-module/library/category.mjs
10718 var import_primitives7 = __toESM(require_primitives(), 1);
10719 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
10720 var category_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z" }) });
10721
10722 // packages/icons/build-module/library/check.mjs
10723 var import_primitives8 = __toESM(require_primitives(), 1);
10724 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
10725 var check_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives8.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });
10726
10727 // packages/icons/build-module/library/chevron-down.mjs
10728 var import_primitives9 = __toESM(require_primitives(), 1);
10729 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
10730 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives9.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });
10731
10732 // packages/icons/build-module/library/chevron-left.mjs
10733 var import_primitives10 = __toESM(require_primitives(), 1);
10734 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
10735 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives10.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });
10736
10737 // packages/icons/build-module/library/chevron-right.mjs
10738 var import_primitives11 = __toESM(require_primitives(), 1);
10739 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
10740 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives11.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });
10741
10742 // packages/icons/build-module/library/close-small.mjs
10743 var import_primitives12 = __toESM(require_primitives(), 1);
10744 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
10745 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives12.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) });
10746
10747 // packages/icons/build-module/library/cog.mjs
10748 var import_primitives13 = __toESM(require_primitives(), 1);
10749 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
10750 var cog_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives13.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z" }) });
10751
10752 // packages/icons/build-module/library/drafts.mjs
10753 var import_primitives14 = __toESM(require_primitives(), 1);
10754 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
10755 var drafts_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives14.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" }) });
10756
10757 // packages/icons/build-module/library/envelope.mjs
10758 var import_primitives15 = __toESM(require_primitives(), 1);
10759 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
10760 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives15.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M3 7c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm2-.5h14c.3 0 .5.2.5.5v1L12 13.5 4.5 7.9V7c0-.3.2-.5.5-.5Zm-.5 3.3V17c0 .3.2.5.5.5h14c.3 0 .5-.2.5-.5V9.8L12 15.4 4.5 9.8Z" }) });
10761
10762 // packages/icons/build-module/library/error.mjs
10763 var import_primitives16 = __toESM(require_primitives(), 1);
10764 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
10765 var error_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives16.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) });
10766
10767 // packages/icons/build-module/library/format-list-bullets-rtl.mjs
10768 var import_primitives17 = __toESM(require_primitives(), 1);
10769 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
10770 var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives17.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) });
10771
10772 // packages/icons/build-module/library/format-list-bullets.mjs
10773 var import_primitives18 = __toESM(require_primitives(), 1);
10774 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
10775 var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives18.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) });
10776
10777 // packages/icons/build-module/library/funnel.mjs
10778 var import_primitives19 = __toESM(require_primitives(), 1);
10779 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
10780 var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives19.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) });
10781
10782 // packages/icons/build-module/library/link.mjs
10783 var import_primitives20 = __toESM(require_primitives(), 1);
10784 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
10785 var link_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives20.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) });
10786
10787 // packages/icons/build-module/library/mobile.mjs
10788 var import_primitives21 = __toESM(require_primitives(), 1);
10789 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
10790 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives21.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) });
10791
10792 // packages/icons/build-module/library/more-vertical.mjs
10793 var import_primitives22 = __toESM(require_primitives(), 1);
10794 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
10795 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives22.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });
10796
10797 // packages/icons/build-module/library/next.mjs
10798 var import_primitives23 = __toESM(require_primitives(), 1);
10799 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
10800 var next_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives23.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) });
10801
10802 // packages/icons/build-module/library/pencil.mjs
10803 var import_primitives24 = __toESM(require_primitives(), 1);
10804 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
10805 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives24.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) });
10806
10807 // packages/icons/build-module/library/post-featured-image.mjs
10808 var import_primitives25 = __toESM(require_primitives(), 1);
10809 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
10810 var post_featured_image_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives25.Path, { d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z" }) });
10811
10812 // packages/icons/build-module/library/previous.mjs
10813 var import_primitives26 = __toESM(require_primitives(), 1);
10814 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
10815 var previous_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives26.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) });
10816
10817 // packages/icons/build-module/library/scheduled.mjs
10818 var import_primitives27 = __toESM(require_primitives(), 1);
10819 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
10820 var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives27.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) });
10821
10822 // packages/icons/build-module/library/search.mjs
10823 var import_primitives28 = __toESM(require_primitives(), 1);
10824 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
10825 var search_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives28.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) });
10826
10827 // packages/icons/build-module/library/seen.mjs
10828 var import_primitives29 = __toESM(require_primitives(), 1);
10829 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
10830 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives29.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) });
10831
10832 // packages/icons/build-module/library/trash.mjs
10833 var import_primitives30 = __toESM(require_primitives(), 1);
10834 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
10835 var trash_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives30.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" }) });
10836
10837 // packages/icons/build-module/library/unseen.mjs
10838 var import_primitives31 = __toESM(require_primitives(), 1);
10839 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
10840 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives31.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) });
10841
10842 // packages/ui/build-module/collapsible-card/context.mjs
10843 var import_element22 = __toESM(require_element(), 1);
10844 var HeaderDescriptionIdContext = (0, import_element22.createContext)({
10845 setDescriptionId: () => {
10846 }
10847 });
10848
10849 // packages/ui/build-module/collapsible-card/header.mjs
10850 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
10851 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash";
10852 function getRuntime8() {
10853 const globalScope = globalThis;
10854 if (globalScope.__wpStyleRuntime) {
10855 return globalScope.__wpStyleRuntime;
10856 }
10857 globalScope.__wpStyleRuntime = {
10858 documents: /* @__PURE__ */ new Map(),
10859 styles: /* @__PURE__ */ new Map(),
10860 injectedStyles: /* @__PURE__ */ new WeakMap()
10861 };
10862 if (typeof document !== "undefined") {
10863 registerDocument8(document);
10864 }
10865 return globalScope.__wpStyleRuntime;
10866 }
10867 function documentContainsStyleHash8(targetDocument, hash) {
10868 if (!targetDocument.head) {
10869 return false;
10870 }
10871 for (const style of targetDocument.head.querySelectorAll(
10872 `style[${STYLE_HASH_ATTRIBUTE8}]`
10873 )) {
10874 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) {
10875 return true;
10876 }
10877 }
10878 return false;
10879 }
10880 function injectStyle8(targetDocument, hash, css) {
10881 if (!targetDocument.head) {
10882 return;
10883 }
10884 const runtime = getRuntime8();
10885 let injectedStyles = runtime.injectedStyles.get(targetDocument);
10886 if (!injectedStyles) {
10887 injectedStyles = /* @__PURE__ */ new Set();
10888 runtime.injectedStyles.set(targetDocument, injectedStyles);
10889 }
10890 if (injectedStyles.has(hash)) {
10891 return;
10892 }
10893 if (documentContainsStyleHash8(targetDocument, hash)) {
10894 injectedStyles.add(hash);
10895 return;
10896 }
10897 const style = targetDocument.createElement("style");
10898 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash);
10899 style.appendChild(targetDocument.createTextNode(css));
10900 targetDocument.head.appendChild(style);
10901 injectedStyles.add(hash);
10902 }
10903 function registerDocument8(targetDocument) {
10904 const runtime = getRuntime8();
10905 runtime.documents.set(
10906 targetDocument,
10907 (runtime.documents.get(targetDocument) ?? 0) + 1
10908 );
10909 for (const [hash, css] of runtime.styles) {
10910 injectStyle8(targetDocument, hash, css);
10911 }
10912 return () => {
10913 const count = runtime.documents.get(targetDocument);
10914 if (count === void 0) {
10915 return;
10916 }
10917 if (count <= 1) {
10918 runtime.documents.delete(targetDocument);
10919 return;
10920 }
10921 runtime.documents.set(targetDocument, count - 1);
10922 };
10923 }
10924 function registerStyle8(hash, css) {
10925 const runtime = getRuntime8();
10926 runtime.styles.set(hash, css);
10927 for (const targetDocument of runtime.documents.keys()) {
10928 injectStyle8(targetDocument, hash, css);
10929 }
10930 }
10931 if (typeof process === "undefined" || true) {
10932 registerStyle8("f1b9bb6252", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}.dd89d27c4f15912d__header-trigger-positioner{align-self:center;flex-shrink:0;max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._165c4572592944b2__overflowVisible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer wp-ui-compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}");
10933 }
10934 var style_default8 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflowVisible": "_165c4572592944b2__overflowVisible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
10935 if (typeof process === "undefined" || true) {
10936 registerStyle8("1fb29d3a3c", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}");
10937 }
10938 var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
10939 if (typeof process === "undefined" || true) {
10940 registerStyle8("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}");
10941 }
10942 var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
10943 var Header2 = (0, import_element23.forwardRef)(
10944 function CollapsibleCardHeader({ children, className, render: render4, ...restProps }, ref) {
10945 const [descriptionId, setDescriptionId] = (0, import_element23.useState)();
10946 const contextValue = (0, import_element23.useMemo)(
10947 () => ({ setDescriptionId }),
10948 [setDescriptionId]
10949 );
10950 return useRender({
10951 defaultTagName: "div",
10952 render: render4,
10953 ref,
10954 props: mergeProps(restProps, {
10955 className: clsx_default(
10956 global_css_defense_default3.heading,
10957 style_default8["heading-wrapper"],
10958 className
10959 ),
10960 children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
10961 Trigger,
10962 {
10963 className: style_default8.header,
10964 render: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Header, {}),
10965 nativeButton: false,
10966 "aria-describedby": descriptionId,
10967 children: [
10968 /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: style_default8["header-content"], children }),
10969 /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10970 "div",
10971 {
10972 className: clsx_default(
10973 style_default8["header-trigger-positioner"]
10974 ),
10975 children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10976 "div",
10977 {
10978 className: clsx_default(
10979 style_default8["header-trigger-wrapper"],
10980 global_css_defense_default3.div,
10981 // While the interactive trigger element is the whole header,
10982 // the focus ring will be displayed only on the icon to visually
10983 // emulate it being the button.
10984 focus_default2["outset-ring--focus-parent-visible"]
10985 ),
10986 children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
10987 Icon,
10988 {
10989 icon: chevron_down_default,
10990 className: style_default8["header-trigger"]
10991 }
10992 )
10993 }
10994 )
10995 }
10996 )
10997 ]
10998 }
10999 ) })
11000 })
11001 });
11002 }
11003 );
11004
11005 // packages/ui/build-module/collapsible-card/header-description.mjs
11006 var import_element24 = __toESM(require_element(), 1);
11007 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
11008 var HeaderDescription = (0, import_element24.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, ...restProps }, ref) {
11009 const descriptionId = (0, import_element24.useId)();
11010 const { setDescriptionId } = (0, import_element24.useContext)(HeaderDescriptionIdContext);
11011 (0, import_element24.useEffect)(() => {
11012 setDescriptionId(descriptionId);
11013 return () => setDescriptionId(void 0);
11014 }, [descriptionId, setDescriptionId]);
11015 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11016 "div",
11017 {
11018 ref,
11019 id: descriptionId,
11020 "aria-hidden": "true",
11021 className,
11022 ...restProps,
11023 children
11024 }
11025 );
11026 });
11027
11028 // packages/ui/build-module/collapsible-card/content.mjs
11029 var import_element25 = __toESM(require_element(), 1);
11030 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
11031 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash";
11032 function getRuntime9() {
11033 const globalScope = globalThis;
11034 if (globalScope.__wpStyleRuntime) {
11035 return globalScope.__wpStyleRuntime;
11036 }
11037 globalScope.__wpStyleRuntime = {
11038 documents: /* @__PURE__ */ new Map(),
11039 styles: /* @__PURE__ */ new Map(),
11040 injectedStyles: /* @__PURE__ */ new WeakMap()
11041 };
11042 if (typeof document !== "undefined") {
11043 registerDocument9(document);
11044 }
11045 return globalScope.__wpStyleRuntime;
11046 }
11047 function documentContainsStyleHash9(targetDocument, hash) {
11048 if (!targetDocument.head) {
11049 return false;
11050 }
11051 for (const style of targetDocument.head.querySelectorAll(
11052 `style[${STYLE_HASH_ATTRIBUTE9}]`
11053 )) {
11054 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) {
11055 return true;
11056 }
11057 }
11058 return false;
11059 }
11060 function injectStyle9(targetDocument, hash, css) {
11061 if (!targetDocument.head) {
11062 return;
11063 }
11064 const runtime = getRuntime9();
11065 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11066 if (!injectedStyles) {
11067 injectedStyles = /* @__PURE__ */ new Set();
11068 runtime.injectedStyles.set(targetDocument, injectedStyles);
11069 }
11070 if (injectedStyles.has(hash)) {
11071 return;
11072 }
11073 if (documentContainsStyleHash9(targetDocument, hash)) {
11074 injectedStyles.add(hash);
11075 return;
11076 }
11077 const style = targetDocument.createElement("style");
11078 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash);
11079 style.appendChild(targetDocument.createTextNode(css));
11080 targetDocument.head.appendChild(style);
11081 injectedStyles.add(hash);
11082 }
11083 function registerDocument9(targetDocument) {
11084 const runtime = getRuntime9();
11085 runtime.documents.set(
11086 targetDocument,
11087 (runtime.documents.get(targetDocument) ?? 0) + 1
11088 );
11089 for (const [hash, css] of runtime.styles) {
11090 injectStyle9(targetDocument, hash, css);
11091 }
11092 return () => {
11093 const count = runtime.documents.get(targetDocument);
11094 if (count === void 0) {
11095 return;
11096 }
11097 if (count <= 1) {
11098 runtime.documents.delete(targetDocument);
11099 return;
11100 }
11101 runtime.documents.set(targetDocument, count - 1);
11102 };
11103 }
11104 function registerStyle9(hash, css) {
11105 const runtime = getRuntime9();
11106 runtime.styles.set(hash, css);
11107 for (const targetDocument of runtime.documents.keys()) {
11108 injectStyle9(targetDocument, hash, css);
11109 }
11110 }
11111 if (typeof process === "undefined" || true) {
11112 registerStyle9("f1b9bb6252", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}.dd89d27c4f15912d__header-trigger-positioner{align-self:center;flex-shrink:0;max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._165c4572592944b2__overflowVisible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer wp-ui-compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}");
11113 }
11114 var style_default9 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflowVisible": "_165c4572592944b2__overflowVisible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
11115 var Content2 = (0, import_element25.forwardRef)(
11116 function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) {
11117 return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11118 Panel,
11119 {
11120 ref,
11121 className: (state) => clsx_default(
11122 style_default9.content,
11123 state.open && state.transitionStatus === "idle" && style_default9.overflowVisible,
11124 className
11125 ),
11126 hiddenUntilFound,
11127 ...restProps,
11128 children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11129 Content,
11130 {
11131 className: style_default9["content-inner"],
11132 render: render4,
11133 children
11134 }
11135 )
11136 }
11137 );
11138 }
11139 );
11140
11141 // packages/ui/build-module/utils/render-slot-with-children.mjs
11142 var import_element26 = __toESM(require_element(), 1);
11143 function renderSlotWithChildren(slot, defaultSlot, children) {
11144 return (0, import_element26.cloneElement)(slot ?? defaultSlot, { children });
11145 }
11146
11147 // packages/ui/build-module/lock-unlock.mjs
11148 var import_private_apis = __toESM(require_private_apis(), 1);
11149 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
11150 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
11151 "@wordpress/ui"
11152 );
11153
11154 // packages/ui/build-module/stack/stack.mjs
11155 var import_element27 = __toESM(require_element(), 1);
11156 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash";
11157 function getRuntime10() {
11158 const globalScope = globalThis;
11159 if (globalScope.__wpStyleRuntime) {
11160 return globalScope.__wpStyleRuntime;
11161 }
11162 globalScope.__wpStyleRuntime = {
11163 documents: /* @__PURE__ */ new Map(),
11164 styles: /* @__PURE__ */ new Map(),
11165 injectedStyles: /* @__PURE__ */ new WeakMap()
11166 };
11167 if (typeof document !== "undefined") {
11168 registerDocument10(document);
11169 }
11170 return globalScope.__wpStyleRuntime;
11171 }
11172 function documentContainsStyleHash10(targetDocument, hash) {
11173 if (!targetDocument.head) {
11174 return false;
11175 }
11176 for (const style of targetDocument.head.querySelectorAll(
11177 `style[${STYLE_HASH_ATTRIBUTE10}]`
11178 )) {
11179 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) {
11180 return true;
11181 }
11182 }
11183 return false;
11184 }
11185 function injectStyle10(targetDocument, hash, css) {
11186 if (!targetDocument.head) {
11187 return;
11188 }
11189 const runtime = getRuntime10();
11190 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11191 if (!injectedStyles) {
11192 injectedStyles = /* @__PURE__ */ new Set();
11193 runtime.injectedStyles.set(targetDocument, injectedStyles);
11194 }
11195 if (injectedStyles.has(hash)) {
11196 return;
11197 }
11198 if (documentContainsStyleHash10(targetDocument, hash)) {
11199 injectedStyles.add(hash);
11200 return;
11201 }
11202 const style = targetDocument.createElement("style");
11203 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash);
11204 style.appendChild(targetDocument.createTextNode(css));
11205 targetDocument.head.appendChild(style);
11206 injectedStyles.add(hash);
11207 }
11208 function registerDocument10(targetDocument) {
11209 const runtime = getRuntime10();
11210 runtime.documents.set(
11211 targetDocument,
11212 (runtime.documents.get(targetDocument) ?? 0) + 1
11213 );
11214 for (const [hash, css] of runtime.styles) {
11215 injectStyle10(targetDocument, hash, css);
11216 }
11217 return () => {
11218 const count = runtime.documents.get(targetDocument);
11219 if (count === void 0) {
11220 return;
11221 }
11222 if (count <= 1) {
11223 runtime.documents.delete(targetDocument);
11224 return;
11225 }
11226 runtime.documents.set(targetDocument, count - 1);
11227 };
11228 }
11229 function registerStyle10(hash, css) {
11230 const runtime = getRuntime10();
11231 runtime.styles.set(hash, css);
11232 for (const targetDocument of runtime.documents.keys()) {
11233 injectStyle10(targetDocument, hash, css);
11234 }
11235 }
11236 if (typeof process === "undefined" || true) {
11237 registerStyle10("b51ff41489", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}");
11238 }
11239 var style_default10 = { "stack": "_19ce0419607e1896__stack" };
11240 var gapTokens = {
11241 xs: "var(--wpds-dimension-gap-xs, 4px)",
11242 sm: "var(--wpds-dimension-gap-sm, 8px)",
11243 md: "var(--wpds-dimension-gap-md, 12px)",
11244 lg: "var(--wpds-dimension-gap-lg, 16px)",
11245 xl: "var(--wpds-dimension-gap-xl, 24px)",
11246 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
11247 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
11248 };
11249 var Stack = (0, import_element27.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) {
11250 const style = {
11251 gap: gap && gapTokens[gap],
11252 alignItems: align,
11253 justifyContent: justify,
11254 flexDirection: direction,
11255 flexWrap: wrap
11256 };
11257 const element = useRender({
11258 render: render4,
11259 ref,
11260 props: mergeProps(props, { style, className: style_default10.stack })
11261 });
11262 return element;
11263 });
11264
11265 // packages/ui/build-module/icon-button/icon-button.mjs
11266 var import_element32 = __toESM(require_element(), 1);
11267
11268 // packages/ui/build-module/tooltip/index.mjs
11269 var tooltip_exports = {};
11270 __export(tooltip_exports, {
11271 Popup: () => Popup,
11272 Portal: () => Portal,
11273 Positioner: () => Positioner,
11274 Provider: () => Provider,
11275 Root: () => Root4,
11276 Trigger: () => Trigger2
11277 });
11278
11279 // packages/ui/build-module/tooltip/popup.mjs
11280 var import_element30 = __toESM(require_element(), 1);
11281 var import_theme = __toESM(require_theme(), 1);
11282
11283 // packages/ui/build-module/tooltip/portal.mjs
11284 var import_element28 = __toESM(require_element(), 1);
11285
11286 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
11287 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash";
11288 function getRuntime11() {
11289 const globalScope = globalThis;
11290 if (globalScope.__wpStyleRuntime) {
11291 return globalScope.__wpStyleRuntime;
11292 }
11293 globalScope.__wpStyleRuntime = {
11294 documents: /* @__PURE__ */ new Map(),
11295 styles: /* @__PURE__ */ new Map(),
11296 injectedStyles: /* @__PURE__ */ new WeakMap()
11297 };
11298 if (typeof document !== "undefined") {
11299 registerDocument11(document);
11300 }
11301 return globalScope.__wpStyleRuntime;
11302 }
11303 function documentContainsStyleHash11(targetDocument, hash) {
11304 if (!targetDocument.head) {
11305 return false;
11306 }
11307 for (const style of targetDocument.head.querySelectorAll(
11308 `style[${STYLE_HASH_ATTRIBUTE11}]`
11309 )) {
11310 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) {
11311 return true;
11312 }
11313 }
11314 return false;
11315 }
11316 function injectStyle11(targetDocument, hash, css) {
11317 if (!targetDocument.head) {
11318 return;
11319 }
11320 const runtime = getRuntime11();
11321 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11322 if (!injectedStyles) {
11323 injectedStyles = /* @__PURE__ */ new Set();
11324 runtime.injectedStyles.set(targetDocument, injectedStyles);
11325 }
11326 if (injectedStyles.has(hash)) {
11327 return;
11328 }
11329 if (documentContainsStyleHash11(targetDocument, hash)) {
11330 injectedStyles.add(hash);
11331 return;
11332 }
11333 const style = targetDocument.createElement("style");
11334 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash);
11335 style.appendChild(targetDocument.createTextNode(css));
11336 targetDocument.head.appendChild(style);
11337 injectedStyles.add(hash);
11338 }
11339 function registerDocument11(targetDocument) {
11340 const runtime = getRuntime11();
11341 runtime.documents.set(
11342 targetDocument,
11343 (runtime.documents.get(targetDocument) ?? 0) + 1
11344 );
11345 for (const [hash, css] of runtime.styles) {
11346 injectStyle11(targetDocument, hash, css);
11347 }
11348 return () => {
11349 const count = runtime.documents.get(targetDocument);
11350 if (count === void 0) {
11351 return;
11352 }
11353 if (count <= 1) {
11354 runtime.documents.delete(targetDocument);
11355 return;
11356 }
11357 runtime.documents.set(targetDocument, count - 1);
11358 };
11359 }
11360 function registerStyle11(hash, css) {
11361 const runtime = getRuntime11();
11362 runtime.styles.set(hash, css);
11363 for (const targetDocument of runtime.documents.keys()) {
11364 injectStyle11(targetDocument, hash, css);
11365 }
11366 }
11367 if (typeof process === "undefined" || true) {
11368 registerStyle11("45eb1fe20f", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui-utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}");
11369 }
11370 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
11371 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
11372 function resolveOwnerDocument() {
11373 return typeof document === "undefined" ? null : document;
11374 }
11375 function isInWordPressEnvironment() {
11376 let topWp;
11377 try {
11378 topWp = window.top?.wp;
11379 } catch {
11380 }
11381 const wp = topWp ?? window.wp;
11382 return typeof wp?.components === "object" && wp.components !== null;
11383 }
11384 var cachedSlot = null;
11385 function createSlot(ownerDocument2) {
11386 const element = ownerDocument2.createElement("div");
11387 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
11388 if (wp_compat_overlay_slot_default.slot) {
11389 element.classList.add(wp_compat_overlay_slot_default.slot);
11390 }
11391 ownerDocument2.body.appendChild(element);
11392 return element;
11393 }
11394 function getWpCompatOverlaySlot() {
11395 if (typeof window === "undefined") {
11396 return void 0;
11397 }
11398 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
11399 return void 0;
11400 }
11401 const ownerDocument2 = resolveOwnerDocument();
11402 if (!ownerDocument2 || !ownerDocument2.body) {
11403 return void 0;
11404 }
11405 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
11406 return cachedSlot;
11407 }
11408 const existing = ownerDocument2.querySelector(
11409 `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
11410 );
11411 if (existing instanceof HTMLDivElement) {
11412 cachedSlot = existing;
11413 return existing;
11414 }
11415 if (cachedSlot?.isConnected) {
11416 cachedSlot.remove();
11417 }
11418 cachedSlot = createSlot(ownerDocument2);
11419 return cachedSlot;
11420 }
11421
11422 // packages/ui/build-module/tooltip/portal.mjs
11423 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
11424 var Portal = (0, import_element28.forwardRef)(
11425 function TooltipPortal3({ container, ...restProps }, ref) {
11426 return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11427 index_parts_exports2.Portal,
11428 {
11429 container: container ?? getWpCompatOverlaySlot(),
11430 ...restProps,
11431 ref
11432 }
11433 );
11434 }
11435 );
11436
11437 // packages/ui/build-module/tooltip/positioner.mjs
11438 var import_element29 = __toESM(require_element(), 1);
11439 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
11440 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash";
11441 function getRuntime12() {
11442 const globalScope = globalThis;
11443 if (globalScope.__wpStyleRuntime) {
11444 return globalScope.__wpStyleRuntime;
11445 }
11446 globalScope.__wpStyleRuntime = {
11447 documents: /* @__PURE__ */ new Map(),
11448 styles: /* @__PURE__ */ new Map(),
11449 injectedStyles: /* @__PURE__ */ new WeakMap()
11450 };
11451 if (typeof document !== "undefined") {
11452 registerDocument12(document);
11453 }
11454 return globalScope.__wpStyleRuntime;
11455 }
11456 function documentContainsStyleHash12(targetDocument, hash) {
11457 if (!targetDocument.head) {
11458 return false;
11459 }
11460 for (const style of targetDocument.head.querySelectorAll(
11461 `style[${STYLE_HASH_ATTRIBUTE12}]`
11462 )) {
11463 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) {
11464 return true;
11465 }
11466 }
11467 return false;
11468 }
11469 function injectStyle12(targetDocument, hash, css) {
11470 if (!targetDocument.head) {
11471 return;
11472 }
11473 const runtime = getRuntime12();
11474 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11475 if (!injectedStyles) {
11476 injectedStyles = /* @__PURE__ */ new Set();
11477 runtime.injectedStyles.set(targetDocument, injectedStyles);
11478 }
11479 if (injectedStyles.has(hash)) {
11480 return;
11481 }
11482 if (documentContainsStyleHash12(targetDocument, hash)) {
11483 injectedStyles.add(hash);
11484 return;
11485 }
11486 const style = targetDocument.createElement("style");
11487 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash);
11488 style.appendChild(targetDocument.createTextNode(css));
11489 targetDocument.head.appendChild(style);
11490 injectedStyles.add(hash);
11491 }
11492 function registerDocument12(targetDocument) {
11493 const runtime = getRuntime12();
11494 runtime.documents.set(
11495 targetDocument,
11496 (runtime.documents.get(targetDocument) ?? 0) + 1
11497 );
11498 for (const [hash, css] of runtime.styles) {
11499 injectStyle12(targetDocument, hash, css);
11500 }
11501 return () => {
11502 const count = runtime.documents.get(targetDocument);
11503 if (count === void 0) {
11504 return;
11505 }
11506 if (count <= 1) {
11507 runtime.documents.delete(targetDocument);
11508 return;
11509 }
11510 runtime.documents.set(targetDocument, count - 1);
11511 };
11512 }
11513 function registerStyle12(hash, css) {
11514 const runtime = getRuntime12();
11515 runtime.styles.set(hash, css);
11516 for (const targetDocument of runtime.documents.keys()) {
11517 injectStyle12(targetDocument, hash, css);
11518 }
11519 }
11520 if (typeof process === "undefined" || true) {
11521 registerStyle12("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}");
11522 }
11523 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
11524 if (typeof process === "undefined" || true) {
11525 registerStyle12("8293efbb49", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-sm,2px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}');
11526 }
11527 var style_default11 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
11528 var Positioner = (0, import_element29.forwardRef)(
11529 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
11530 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
11531 index_parts_exports2.Positioner,
11532 {
11533 ref,
11534 align,
11535 side,
11536 sideOffset,
11537 ...props,
11538 className: clsx_default(
11539 resets_default3["box-sizing"],
11540 style_default11.positioner,
11541 className
11542 )
11543 }
11544 );
11545 }
11546 );
11547
11548 // packages/ui/build-module/tooltip/popup.mjs
11549 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
11550 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash";
11551 function getRuntime13() {
11552 const globalScope = globalThis;
11553 if (globalScope.__wpStyleRuntime) {
11554 return globalScope.__wpStyleRuntime;
11555 }
11556 globalScope.__wpStyleRuntime = {
11557 documents: /* @__PURE__ */ new Map(),
11558 styles: /* @__PURE__ */ new Map(),
11559 injectedStyles: /* @__PURE__ */ new WeakMap()
11560 };
11561 if (typeof document !== "undefined") {
11562 registerDocument13(document);
11563 }
11564 return globalScope.__wpStyleRuntime;
11565 }
11566 function documentContainsStyleHash13(targetDocument, hash) {
11567 if (!targetDocument.head) {
11568 return false;
11569 }
11570 for (const style of targetDocument.head.querySelectorAll(
11571 `style[${STYLE_HASH_ATTRIBUTE13}]`
11572 )) {
11573 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) {
11574 return true;
11575 }
11576 }
11577 return false;
11578 }
11579 function injectStyle13(targetDocument, hash, css) {
11580 if (!targetDocument.head) {
11581 return;
11582 }
11583 const runtime = getRuntime13();
11584 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11585 if (!injectedStyles) {
11586 injectedStyles = /* @__PURE__ */ new Set();
11587 runtime.injectedStyles.set(targetDocument, injectedStyles);
11588 }
11589 if (injectedStyles.has(hash)) {
11590 return;
11591 }
11592 if (documentContainsStyleHash13(targetDocument, hash)) {
11593 injectedStyles.add(hash);
11594 return;
11595 }
11596 const style = targetDocument.createElement("style");
11597 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash);
11598 style.appendChild(targetDocument.createTextNode(css));
11599 targetDocument.head.appendChild(style);
11600 injectedStyles.add(hash);
11601 }
11602 function registerDocument13(targetDocument) {
11603 const runtime = getRuntime13();
11604 runtime.documents.set(
11605 targetDocument,
11606 (runtime.documents.get(targetDocument) ?? 0) + 1
11607 );
11608 for (const [hash, css] of runtime.styles) {
11609 injectStyle13(targetDocument, hash, css);
11610 }
11611 return () => {
11612 const count = runtime.documents.get(targetDocument);
11613 if (count === void 0) {
11614 return;
11615 }
11616 if (count <= 1) {
11617 runtime.documents.delete(targetDocument);
11618 return;
11619 }
11620 runtime.documents.set(targetDocument, count - 1);
11621 };
11622 }
11623 function registerStyle13(hash, css) {
11624 const runtime = getRuntime13();
11625 runtime.styles.set(hash, css);
11626 for (const targetDocument of runtime.documents.keys()) {
11627 injectStyle13(targetDocument, hash, css);
11628 }
11629 }
11630 if (typeof process === "undefined" || true) {
11631 registerStyle13("8293efbb49", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-sm,2px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}');
11632 }
11633 var style_default12 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
11634 var ThemeProvider = unlock(import_theme.privateApis).ThemeProvider;
11635 var Popup = (0, import_element30.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
11636 const popupContent = (
11637 /* This should ideally use whatever dark color makes sense,
11638 * and not be hardcoded to #1e1e1e. The solutions would be to:
11639 * - review the design of the tooltip, in case we want to stop
11640 * hardcoding it to a dark background
11641 * - create new semantic tokens as needed (aliasing either the
11642 * "inverted bg" or "perma-dark bg" private tokens) and have
11643 * Tooltip.Popup use them;
11644 * - remove the hardcoded `bg` setting from the `ThemeProvider`
11645 * below
11646 */
11647 /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ThemeProvider, { color: { bg: "#1e1e1e" }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11648 index_parts_exports2.Popup,
11649 {
11650 ref,
11651 className: clsx_default(style_default12.popup, className),
11652 ...props,
11653 children
11654 }
11655 ) })
11656 );
11657 const positionedPopup = renderSlotWithChildren(
11658 positioner,
11659 /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Positioner, {}),
11660 popupContent
11661 );
11662 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Portal, {}), positionedPopup);
11663 });
11664
11665 // packages/ui/build-module/tooltip/trigger.mjs
11666 var import_element31 = __toESM(require_element(), 1);
11667 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
11668 var Trigger2 = (0, import_element31.forwardRef)(
11669 function TooltipTrigger3(props, ref) {
11670 return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(index_parts_exports2.Trigger, { ref, ...props });
11671 }
11672 );
11673
11674 // packages/ui/build-module/tooltip/root.mjs
11675 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
11676 function Root4(props) {
11677 return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(index_parts_exports2.Root, { ...props });
11678 }
11679
11680 // packages/ui/build-module/tooltip/provider.mjs
11681 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
11682 function Provider({ ...props }) {
11683 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(index_parts_exports2.Provider, { ...props });
11684 }
11685
11686 // packages/ui/build-module/icon-button/icon-button.mjs
11687 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
11688 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash";
11689 function getRuntime14() {
11690 const globalScope = globalThis;
11691 if (globalScope.__wpStyleRuntime) {
11692 return globalScope.__wpStyleRuntime;
11693 }
11694 globalScope.__wpStyleRuntime = {
11695 documents: /* @__PURE__ */ new Map(),
11696 styles: /* @__PURE__ */ new Map(),
11697 injectedStyles: /* @__PURE__ */ new WeakMap()
11698 };
11699 if (typeof document !== "undefined") {
11700 registerDocument14(document);
11701 }
11702 return globalScope.__wpStyleRuntime;
11703 }
11704 function documentContainsStyleHash14(targetDocument, hash) {
11705 if (!targetDocument.head) {
11706 return false;
11707 }
11708 for (const style of targetDocument.head.querySelectorAll(
11709 `style[${STYLE_HASH_ATTRIBUTE14}]`
11710 )) {
11711 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) {
11712 return true;
11713 }
11714 }
11715 return false;
11716 }
11717 function injectStyle14(targetDocument, hash, css) {
11718 if (!targetDocument.head) {
11719 return;
11720 }
11721 const runtime = getRuntime14();
11722 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11723 if (!injectedStyles) {
11724 injectedStyles = /* @__PURE__ */ new Set();
11725 runtime.injectedStyles.set(targetDocument, injectedStyles);
11726 }
11727 if (injectedStyles.has(hash)) {
11728 return;
11729 }
11730 if (documentContainsStyleHash14(targetDocument, hash)) {
11731 injectedStyles.add(hash);
11732 return;
11733 }
11734 const style = targetDocument.createElement("style");
11735 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash);
11736 style.appendChild(targetDocument.createTextNode(css));
11737 targetDocument.head.appendChild(style);
11738 injectedStyles.add(hash);
11739 }
11740 function registerDocument14(targetDocument) {
11741 const runtime = getRuntime14();
11742 runtime.documents.set(
11743 targetDocument,
11744 (runtime.documents.get(targetDocument) ?? 0) + 1
11745 );
11746 for (const [hash, css] of runtime.styles) {
11747 injectStyle14(targetDocument, hash, css);
11748 }
11749 return () => {
11750 const count = runtime.documents.get(targetDocument);
11751 if (count === void 0) {
11752 return;
11753 }
11754 if (count <= 1) {
11755 runtime.documents.delete(targetDocument);
11756 return;
11757 }
11758 runtime.documents.set(targetDocument, count - 1);
11759 };
11760 }
11761 function registerStyle14(hash, css) {
11762 const runtime = getRuntime14();
11763 runtime.styles.set(hash, css);
11764 for (const targetDocument of runtime.documents.keys()) {
11765 injectStyle14(targetDocument, hash, css);
11766 }
11767 }
11768 if (typeof process === "undefined" || true) {
11769 registerStyle14("358a2a646a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}");
11770 }
11771 var style_default13 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" };
11772 var IconButton = (0, import_element32.forwardRef)(
11773 function IconButton2({
11774 label,
11775 className,
11776 // Prevent accidental forwarding of `children`
11777 children: _children,
11778 disabled: disabled2,
11779 focusableWhenDisabled = true,
11780 icon,
11781 size: size4,
11782 shortcut,
11783 positioner,
11784 ...restProps
11785 }, ref) {
11786 const classes = clsx_default(style_default13["icon-button"], className);
11787 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Provider, { delay: 0, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Root4, { children: [
11788 /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
11789 Trigger2,
11790 {
11791 ref,
11792 disabled: disabled2 && !focusableWhenDisabled,
11793 render: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
11794 Button4,
11795 {
11796 ...restProps,
11797 size: size4,
11798 "aria-label": label,
11799 "aria-keyshortcuts": shortcut?.ariaKeyShortcut,
11800 disabled: disabled2,
11801 focusableWhenDisabled
11802 }
11803 ),
11804 className: classes,
11805 children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
11806 Icon,
11807 {
11808 icon,
11809 size: 24,
11810 className: style_default13.icon
11811 }
11812 )
11813 }
11814 ),
11815 /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Popup, { positioner, children: [
11816 label,
11817 shortcut && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
11818 " ",
11819 /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { "aria-hidden": "true", children: shortcut.displayShortcut })
11820 ] })
11821 ] })
11822 ] }) });
11823 }
11824 );
11825
11826 // packages/ui/build-module/empty-state/index.mjs
11827 var empty_state_exports = {};
11828 __export(empty_state_exports, {
11829 Actions: () => Actions,
11830 Description: () => Description,
11831 Icon: () => Icon3,
11832 Root: () => Root5,
11833 Title: () => Title2,
11834 Visual: () => Visual
11835 });
11836
11837 // packages/ui/build-module/empty-state/root.mjs
11838 var import_element33 = __toESM(require_element(), 1);
11839 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash";
11840 function getRuntime15() {
11841 const globalScope = globalThis;
11842 if (globalScope.__wpStyleRuntime) {
11843 return globalScope.__wpStyleRuntime;
11844 }
11845 globalScope.__wpStyleRuntime = {
11846 documents: /* @__PURE__ */ new Map(),
11847 styles: /* @__PURE__ */ new Map(),
11848 injectedStyles: /* @__PURE__ */ new WeakMap()
11849 };
11850 if (typeof document !== "undefined") {
11851 registerDocument15(document);
11852 }
11853 return globalScope.__wpStyleRuntime;
11854 }
11855 function documentContainsStyleHash15(targetDocument, hash) {
11856 if (!targetDocument.head) {
11857 return false;
11858 }
11859 for (const style of targetDocument.head.querySelectorAll(
11860 `style[${STYLE_HASH_ATTRIBUTE15}]`
11861 )) {
11862 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) {
11863 return true;
11864 }
11865 }
11866 return false;
11867 }
11868 function injectStyle15(targetDocument, hash, css) {
11869 if (!targetDocument.head) {
11870 return;
11871 }
11872 const runtime = getRuntime15();
11873 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11874 if (!injectedStyles) {
11875 injectedStyles = /* @__PURE__ */ new Set();
11876 runtime.injectedStyles.set(targetDocument, injectedStyles);
11877 }
11878 if (injectedStyles.has(hash)) {
11879 return;
11880 }
11881 if (documentContainsStyleHash15(targetDocument, hash)) {
11882 injectedStyles.add(hash);
11883 return;
11884 }
11885 const style = targetDocument.createElement("style");
11886 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash);
11887 style.appendChild(targetDocument.createTextNode(css));
11888 targetDocument.head.appendChild(style);
11889 injectedStyles.add(hash);
11890 }
11891 function registerDocument15(targetDocument) {
11892 const runtime = getRuntime15();
11893 runtime.documents.set(
11894 targetDocument,
11895 (runtime.documents.get(targetDocument) ?? 0) + 1
11896 );
11897 for (const [hash, css] of runtime.styles) {
11898 injectStyle15(targetDocument, hash, css);
11899 }
11900 return () => {
11901 const count = runtime.documents.get(targetDocument);
11902 if (count === void 0) {
11903 return;
11904 }
11905 if (count <= 1) {
11906 runtime.documents.delete(targetDocument);
11907 return;
11908 }
11909 runtime.documents.set(targetDocument, count - 1);
11910 };
11911 }
11912 function registerStyle15(hash, css) {
11913 const runtime = getRuntime15();
11914 runtime.styles.set(hash, css);
11915 for (const targetDocument of runtime.documents.keys()) {
11916 injectStyle15(targetDocument, hash, css);
11917 }
11918 }
11919 if (typeof process === "undefined" || true) {
11920 registerStyle15("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}');
11921 }
11922 var style_default14 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" };
11923 var Root5 = (0, import_element33.forwardRef)(
11924 function EmptyStateRoot({ render: render4, ...props }, ref) {
11925 const className = clsx_default(style_default14.root);
11926 const element = useRender({
11927 defaultTagName: "div",
11928 render: render4,
11929 ref,
11930 props: mergeProps({ className }, props)
11931 });
11932 return element;
11933 }
11934 );
11935
11936 // packages/ui/build-module/empty-state/visual.mjs
11937 var import_element34 = __toESM(require_element(), 1);
11938 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash";
11939 function getRuntime16() {
11940 const globalScope = globalThis;
11941 if (globalScope.__wpStyleRuntime) {
11942 return globalScope.__wpStyleRuntime;
11943 }
11944 globalScope.__wpStyleRuntime = {
11945 documents: /* @__PURE__ */ new Map(),
11946 styles: /* @__PURE__ */ new Map(),
11947 injectedStyles: /* @__PURE__ */ new WeakMap()
11948 };
11949 if (typeof document !== "undefined") {
11950 registerDocument16(document);
11951 }
11952 return globalScope.__wpStyleRuntime;
11953 }
11954 function documentContainsStyleHash16(targetDocument, hash) {
11955 if (!targetDocument.head) {
11956 return false;
11957 }
11958 for (const style of targetDocument.head.querySelectorAll(
11959 `style[${STYLE_HASH_ATTRIBUTE16}]`
11960 )) {
11961 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) {
11962 return true;
11963 }
11964 }
11965 return false;
11966 }
11967 function injectStyle16(targetDocument, hash, css) {
11968 if (!targetDocument.head) {
11969 return;
11970 }
11971 const runtime = getRuntime16();
11972 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11973 if (!injectedStyles) {
11974 injectedStyles = /* @__PURE__ */ new Set();
11975 runtime.injectedStyles.set(targetDocument, injectedStyles);
11976 }
11977 if (injectedStyles.has(hash)) {
11978 return;
11979 }
11980 if (documentContainsStyleHash16(targetDocument, hash)) {
11981 injectedStyles.add(hash);
11982 return;
11983 }
11984 const style = targetDocument.createElement("style");
11985 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash);
11986 style.appendChild(targetDocument.createTextNode(css));
11987 targetDocument.head.appendChild(style);
11988 injectedStyles.add(hash);
11989 }
11990 function registerDocument16(targetDocument) {
11991 const runtime = getRuntime16();
11992 runtime.documents.set(
11993 targetDocument,
11994 (runtime.documents.get(targetDocument) ?? 0) + 1
11995 );
11996 for (const [hash, css] of runtime.styles) {
11997 injectStyle16(targetDocument, hash, css);
11998 }
11999 return () => {
12000 const count = runtime.documents.get(targetDocument);
12001 if (count === void 0) {
12002 return;
12003 }
12004 if (count <= 1) {
12005 runtime.documents.delete(targetDocument);
12006 return;
12007 }
12008 runtime.documents.set(targetDocument, count - 1);
12009 };
12010 }
12011 function registerStyle16(hash, css) {
12012 const runtime = getRuntime16();
12013 runtime.styles.set(hash, css);
12014 for (const targetDocument of runtime.documents.keys()) {
12015 injectStyle16(targetDocument, hash, css);
12016 }
12017 }
12018 if (typeof process === "undefined" || true) {
12019 registerStyle16("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}');
12020 }
12021 var style_default15 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" };
12022 var Visual = (0, import_element34.forwardRef)(
12023 function EmptyStateVisual({ render: render4, ...props }, ref) {
12024 const className = clsx_default(style_default15.visual);
12025 const element = useRender({
12026 defaultTagName: "div",
12027 render: render4,
12028 ref,
12029 props: mergeProps({ className }, props)
12030 });
12031 return element;
12032 }
12033 );
12034
12035 // packages/ui/build-module/empty-state/icon.mjs
12036 var import_element35 = __toESM(require_element(), 1);
12037 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
12038 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash";
12039 function getRuntime17() {
12040 const globalScope = globalThis;
12041 if (globalScope.__wpStyleRuntime) {
12042 return globalScope.__wpStyleRuntime;
12043 }
12044 globalScope.__wpStyleRuntime = {
12045 documents: /* @__PURE__ */ new Map(),
12046 styles: /* @__PURE__ */ new Map(),
12047 injectedStyles: /* @__PURE__ */ new WeakMap()
12048 };
12049 if (typeof document !== "undefined") {
12050 registerDocument17(document);
12051 }
12052 return globalScope.__wpStyleRuntime;
12053 }
12054 function documentContainsStyleHash17(targetDocument, hash) {
12055 if (!targetDocument.head) {
12056 return false;
12057 }
12058 for (const style of targetDocument.head.querySelectorAll(
12059 `style[${STYLE_HASH_ATTRIBUTE17}]`
12060 )) {
12061 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) {
12062 return true;
12063 }
12064 }
12065 return false;
12066 }
12067 function injectStyle17(targetDocument, hash, css) {
12068 if (!targetDocument.head) {
12069 return;
12070 }
12071 const runtime = getRuntime17();
12072 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12073 if (!injectedStyles) {
12074 injectedStyles = /* @__PURE__ */ new Set();
12075 runtime.injectedStyles.set(targetDocument, injectedStyles);
12076 }
12077 if (injectedStyles.has(hash)) {
12078 return;
12079 }
12080 if (documentContainsStyleHash17(targetDocument, hash)) {
12081 injectedStyles.add(hash);
12082 return;
12083 }
12084 const style = targetDocument.createElement("style");
12085 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash);
12086 style.appendChild(targetDocument.createTextNode(css));
12087 targetDocument.head.appendChild(style);
12088 injectedStyles.add(hash);
12089 }
12090 function registerDocument17(targetDocument) {
12091 const runtime = getRuntime17();
12092 runtime.documents.set(
12093 targetDocument,
12094 (runtime.documents.get(targetDocument) ?? 0) + 1
12095 );
12096 for (const [hash, css] of runtime.styles) {
12097 injectStyle17(targetDocument, hash, css);
12098 }
12099 return () => {
12100 const count = runtime.documents.get(targetDocument);
12101 if (count === void 0) {
12102 return;
12103 }
12104 if (count <= 1) {
12105 runtime.documents.delete(targetDocument);
12106 return;
12107 }
12108 runtime.documents.set(targetDocument, count - 1);
12109 };
12110 }
12111 function registerStyle17(hash, css) {
12112 const runtime = getRuntime17();
12113 runtime.styles.set(hash, css);
12114 for (const targetDocument of runtime.documents.keys()) {
12115 injectStyle17(targetDocument, hash, css);
12116 }
12117 }
12118 if (typeof process === "undefined" || true) {
12119 registerStyle17("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}');
12120 }
12121 var style_default16 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" };
12122 var Icon3 = (0, import_element35.forwardRef)(
12123 function EmptyStateIcon({ icon, className, ...restProps }, ref) {
12124 return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12125 Visual,
12126 {
12127 ref,
12128 className: clsx_default(style_default16.icon, className),
12129 ...restProps,
12130 children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { icon })
12131 }
12132 );
12133 }
12134 );
12135
12136 // packages/ui/build-module/empty-state/title.mjs
12137 var import_element36 = __toESM(require_element(), 1);
12138 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
12139 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash";
12140 function getRuntime18() {
12141 const globalScope = globalThis;
12142 if (globalScope.__wpStyleRuntime) {
12143 return globalScope.__wpStyleRuntime;
12144 }
12145 globalScope.__wpStyleRuntime = {
12146 documents: /* @__PURE__ */ new Map(),
12147 styles: /* @__PURE__ */ new Map(),
12148 injectedStyles: /* @__PURE__ */ new WeakMap()
12149 };
12150 if (typeof document !== "undefined") {
12151 registerDocument18(document);
12152 }
12153 return globalScope.__wpStyleRuntime;
12154 }
12155 function documentContainsStyleHash18(targetDocument, hash) {
12156 if (!targetDocument.head) {
12157 return false;
12158 }
12159 for (const style of targetDocument.head.querySelectorAll(
12160 `style[${STYLE_HASH_ATTRIBUTE18}]`
12161 )) {
12162 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) {
12163 return true;
12164 }
12165 }
12166 return false;
12167 }
12168 function injectStyle18(targetDocument, hash, css) {
12169 if (!targetDocument.head) {
12170 return;
12171 }
12172 const runtime = getRuntime18();
12173 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12174 if (!injectedStyles) {
12175 injectedStyles = /* @__PURE__ */ new Set();
12176 runtime.injectedStyles.set(targetDocument, injectedStyles);
12177 }
12178 if (injectedStyles.has(hash)) {
12179 return;
12180 }
12181 if (documentContainsStyleHash18(targetDocument, hash)) {
12182 injectedStyles.add(hash);
12183 return;
12184 }
12185 const style = targetDocument.createElement("style");
12186 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash);
12187 style.appendChild(targetDocument.createTextNode(css));
12188 targetDocument.head.appendChild(style);
12189 injectedStyles.add(hash);
12190 }
12191 function registerDocument18(targetDocument) {
12192 const runtime = getRuntime18();
12193 runtime.documents.set(
12194 targetDocument,
12195 (runtime.documents.get(targetDocument) ?? 0) + 1
12196 );
12197 for (const [hash, css] of runtime.styles) {
12198 injectStyle18(targetDocument, hash, css);
12199 }
12200 return () => {
12201 const count = runtime.documents.get(targetDocument);
12202 if (count === void 0) {
12203 return;
12204 }
12205 if (count <= 1) {
12206 runtime.documents.delete(targetDocument);
12207 return;
12208 }
12209 runtime.documents.set(targetDocument, count - 1);
12210 };
12211 }
12212 function registerStyle18(hash, css) {
12213 const runtime = getRuntime18();
12214 runtime.styles.set(hash, css);
12215 for (const targetDocument of runtime.documents.keys()) {
12216 injectStyle18(targetDocument, hash, css);
12217 }
12218 }
12219 if (typeof process === "undefined" || true) {
12220 registerStyle18("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}');
12221 }
12222 var style_default17 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" };
12223 var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h2", {});
12224 var Title2 = (0, import_element36.forwardRef)(
12225 function EmptyStateTitle({ render: render4 = DEFAULT_TAG2, className, children, ...props }, ref) {
12226 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
12227 Text,
12228 {
12229 ref,
12230 variant: "heading-lg",
12231 render: render4,
12232 className: clsx_default(style_default17.title, className),
12233 ...props,
12234 children
12235 }
12236 );
12237 }
12238 );
12239
12240 // packages/ui/build-module/empty-state/description.mjs
12241 var import_element37 = __toESM(require_element(), 1);
12242 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
12243 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash";
12244 function getRuntime19() {
12245 const globalScope = globalThis;
12246 if (globalScope.__wpStyleRuntime) {
12247 return globalScope.__wpStyleRuntime;
12248 }
12249 globalScope.__wpStyleRuntime = {
12250 documents: /* @__PURE__ */ new Map(),
12251 styles: /* @__PURE__ */ new Map(),
12252 injectedStyles: /* @__PURE__ */ new WeakMap()
12253 };
12254 if (typeof document !== "undefined") {
12255 registerDocument19(document);
12256 }
12257 return globalScope.__wpStyleRuntime;
12258 }
12259 function documentContainsStyleHash19(targetDocument, hash) {
12260 if (!targetDocument.head) {
12261 return false;
12262 }
12263 for (const style of targetDocument.head.querySelectorAll(
12264 `style[${STYLE_HASH_ATTRIBUTE19}]`
12265 )) {
12266 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) {
12267 return true;
12268 }
12269 }
12270 return false;
12271 }
12272 function injectStyle19(targetDocument, hash, css) {
12273 if (!targetDocument.head) {
12274 return;
12275 }
12276 const runtime = getRuntime19();
12277 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12278 if (!injectedStyles) {
12279 injectedStyles = /* @__PURE__ */ new Set();
12280 runtime.injectedStyles.set(targetDocument, injectedStyles);
12281 }
12282 if (injectedStyles.has(hash)) {
12283 return;
12284 }
12285 if (documentContainsStyleHash19(targetDocument, hash)) {
12286 injectedStyles.add(hash);
12287 return;
12288 }
12289 const style = targetDocument.createElement("style");
12290 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash);
12291 style.appendChild(targetDocument.createTextNode(css));
12292 targetDocument.head.appendChild(style);
12293 injectedStyles.add(hash);
12294 }
12295 function registerDocument19(targetDocument) {
12296 const runtime = getRuntime19();
12297 runtime.documents.set(
12298 targetDocument,
12299 (runtime.documents.get(targetDocument) ?? 0) + 1
12300 );
12301 for (const [hash, css] of runtime.styles) {
12302 injectStyle19(targetDocument, hash, css);
12303 }
12304 return () => {
12305 const count = runtime.documents.get(targetDocument);
12306 if (count === void 0) {
12307 return;
12308 }
12309 if (count <= 1) {
12310 runtime.documents.delete(targetDocument);
12311 return;
12312 }
12313 runtime.documents.set(targetDocument, count - 1);
12314 };
12315 }
12316 function registerStyle19(hash, css) {
12317 const runtime = getRuntime19();
12318 runtime.styles.set(hash, css);
12319 for (const targetDocument of runtime.documents.keys()) {
12320 injectStyle19(targetDocument, hash, css);
12321 }
12322 }
12323 if (typeof process === "undefined" || true) {
12324 registerStyle19("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}');
12325 }
12326 var style_default18 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" };
12327 var DEFAULT_TAG3 = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", {});
12328 var Description = (0, import_element37.forwardRef)(function EmptyStateDescription({ render: render4 = DEFAULT_TAG3, className, children, ...props }, ref) {
12329 return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
12330 Text,
12331 {
12332 ref,
12333 variant: "body-md",
12334 render: render4,
12335 className: clsx_default(style_default18.description, className),
12336 ...props,
12337 children
12338 }
12339 );
12340 });
12341
12342 // packages/ui/build-module/empty-state/actions.mjs
12343 var import_element38 = __toESM(require_element(), 1);
12344 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash";
12345 function getRuntime20() {
12346 const globalScope = globalThis;
12347 if (globalScope.__wpStyleRuntime) {
12348 return globalScope.__wpStyleRuntime;
12349 }
12350 globalScope.__wpStyleRuntime = {
12351 documents: /* @__PURE__ */ new Map(),
12352 styles: /* @__PURE__ */ new Map(),
12353 injectedStyles: /* @__PURE__ */ new WeakMap()
12354 };
12355 if (typeof document !== "undefined") {
12356 registerDocument20(document);
12357 }
12358 return globalScope.__wpStyleRuntime;
12359 }
12360 function documentContainsStyleHash20(targetDocument, hash) {
12361 if (!targetDocument.head) {
12362 return false;
12363 }
12364 for (const style of targetDocument.head.querySelectorAll(
12365 `style[${STYLE_HASH_ATTRIBUTE20}]`
12366 )) {
12367 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) {
12368 return true;
12369 }
12370 }
12371 return false;
12372 }
12373 function injectStyle20(targetDocument, hash, css) {
12374 if (!targetDocument.head) {
12375 return;
12376 }
12377 const runtime = getRuntime20();
12378 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12379 if (!injectedStyles) {
12380 injectedStyles = /* @__PURE__ */ new Set();
12381 runtime.injectedStyles.set(targetDocument, injectedStyles);
12382 }
12383 if (injectedStyles.has(hash)) {
12384 return;
12385 }
12386 if (documentContainsStyleHash20(targetDocument, hash)) {
12387 injectedStyles.add(hash);
12388 return;
12389 }
12390 const style = targetDocument.createElement("style");
12391 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash);
12392 style.appendChild(targetDocument.createTextNode(css));
12393 targetDocument.head.appendChild(style);
12394 injectedStyles.add(hash);
12395 }
12396 function registerDocument20(targetDocument) {
12397 const runtime = getRuntime20();
12398 runtime.documents.set(
12399 targetDocument,
12400 (runtime.documents.get(targetDocument) ?? 0) + 1
12401 );
12402 for (const [hash, css] of runtime.styles) {
12403 injectStyle20(targetDocument, hash, css);
12404 }
12405 return () => {
12406 const count = runtime.documents.get(targetDocument);
12407 if (count === void 0) {
12408 return;
12409 }
12410 if (count <= 1) {
12411 runtime.documents.delete(targetDocument);
12412 return;
12413 }
12414 runtime.documents.set(targetDocument, count - 1);
12415 };
12416 }
12417 function registerStyle20(hash, css) {
12418 const runtime = getRuntime20();
12419 runtime.styles.set(hash, css);
12420 for (const targetDocument of runtime.documents.keys()) {
12421 injectStyle20(targetDocument, hash, css);
12422 }
12423 }
12424 if (typeof process === "undefined" || true) {
12425 registerStyle20("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}');
12426 }
12427 var style_default19 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" };
12428 var Actions = (0, import_element38.forwardRef)(
12429 function EmptyStateActions({ render: render4, ...props }, ref) {
12430 const className = clsx_default(style_default19.actions);
12431 const element = useRender({
12432 defaultTagName: "div",
12433 render: render4,
12434 ref,
12435 props: mergeProps({ className }, props)
12436 });
12437 return element;
12438 }
12439 );
12440
12441 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
12442 var import_element39 = __toESM(require_element(), 1);
12443 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash";
12444 function getRuntime21() {
12445 const globalScope = globalThis;
12446 if (globalScope.__wpStyleRuntime) {
12447 return globalScope.__wpStyleRuntime;
12448 }
12449 globalScope.__wpStyleRuntime = {
12450 documents: /* @__PURE__ */ new Map(),
12451 styles: /* @__PURE__ */ new Map(),
12452 injectedStyles: /* @__PURE__ */ new WeakMap()
12453 };
12454 if (typeof document !== "undefined") {
12455 registerDocument21(document);
12456 }
12457 return globalScope.__wpStyleRuntime;
12458 }
12459 function documentContainsStyleHash21(targetDocument, hash) {
12460 if (!targetDocument.head) {
12461 return false;
12462 }
12463 for (const style of targetDocument.head.querySelectorAll(
12464 `style[${STYLE_HASH_ATTRIBUTE21}]`
12465 )) {
12466 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) {
12467 return true;
12468 }
12469 }
12470 return false;
12471 }
12472 function injectStyle21(targetDocument, hash, css) {
12473 if (!targetDocument.head) {
12474 return;
12475 }
12476 const runtime = getRuntime21();
12477 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12478 if (!injectedStyles) {
12479 injectedStyles = /* @__PURE__ */ new Set();
12480 runtime.injectedStyles.set(targetDocument, injectedStyles);
12481 }
12482 if (injectedStyles.has(hash)) {
12483 return;
12484 }
12485 if (documentContainsStyleHash21(targetDocument, hash)) {
12486 injectedStyles.add(hash);
12487 return;
12488 }
12489 const style = targetDocument.createElement("style");
12490 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash);
12491 style.appendChild(targetDocument.createTextNode(css));
12492 targetDocument.head.appendChild(style);
12493 injectedStyles.add(hash);
12494 }
12495 function registerDocument21(targetDocument) {
12496 const runtime = getRuntime21();
12497 runtime.documents.set(
12498 targetDocument,
12499 (runtime.documents.get(targetDocument) ?? 0) + 1
12500 );
12501 for (const [hash, css] of runtime.styles) {
12502 injectStyle21(targetDocument, hash, css);
12503 }
12504 return () => {
12505 const count = runtime.documents.get(targetDocument);
12506 if (count === void 0) {
12507 return;
12508 }
12509 if (count <= 1) {
12510 runtime.documents.delete(targetDocument);
12511 return;
12512 }
12513 runtime.documents.set(targetDocument, count - 1);
12514 };
12515 }
12516 function registerStyle21(hash, css) {
12517 const runtime = getRuntime21();
12518 runtime.styles.set(hash, css);
12519 for (const targetDocument of runtime.documents.keys()) {
12520 injectStyle21(targetDocument, hash, css);
12521 }
12522 }
12523 if (typeof process === "undefined" || true) {
12524 registerStyle21("c46e8cb841", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}");
12525 }
12526 var style_default20 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
12527 var VisuallyHidden = (0, import_element39.forwardRef)(
12528 function VisuallyHidden2({ render: render4, ...restProps }, ref) {
12529 const element = useRender({
12530 render: render4,
12531 ref,
12532 props: mergeProps(
12533 { className: style_default20["visually-hidden"] },
12534 restProps,
12535 {
12536 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
12537 "data-visually-hidden": ""
12538 }
12539 )
12540 });
12541 return element;
12542 }
12543 );
12544
12545 // packages/ui/build-module/link/link.mjs
12546 var import_element40 = __toESM(require_element(), 1);
12547 var import_i18n2 = __toESM(require_i18n(), 1);
12548 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
12549 var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash";
12550 function getRuntime22() {
12551 const globalScope = globalThis;
12552 if (globalScope.__wpStyleRuntime) {
12553 return globalScope.__wpStyleRuntime;
12554 }
12555 globalScope.__wpStyleRuntime = {
12556 documents: /* @__PURE__ */ new Map(),
12557 styles: /* @__PURE__ */ new Map(),
12558 injectedStyles: /* @__PURE__ */ new WeakMap()
12559 };
12560 if (typeof document !== "undefined") {
12561 registerDocument22(document);
12562 }
12563 return globalScope.__wpStyleRuntime;
12564 }
12565 function documentContainsStyleHash22(targetDocument, hash) {
12566 if (!targetDocument.head) {
12567 return false;
12568 }
12569 for (const style of targetDocument.head.querySelectorAll(
12570 `style[${STYLE_HASH_ATTRIBUTE22}]`
12571 )) {
12572 if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) {
12573 return true;
12574 }
12575 }
12576 return false;
12577 }
12578 function injectStyle22(targetDocument, hash, css) {
12579 if (!targetDocument.head) {
12580 return;
12581 }
12582 const runtime = getRuntime22();
12583 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12584 if (!injectedStyles) {
12585 injectedStyles = /* @__PURE__ */ new Set();
12586 runtime.injectedStyles.set(targetDocument, injectedStyles);
12587 }
12588 if (injectedStyles.has(hash)) {
12589 return;
12590 }
12591 if (documentContainsStyleHash22(targetDocument, hash)) {
12592 injectedStyles.add(hash);
12593 return;
12594 }
12595 const style = targetDocument.createElement("style");
12596 style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash);
12597 style.appendChild(targetDocument.createTextNode(css));
12598 targetDocument.head.appendChild(style);
12599 injectedStyles.add(hash);
12600 }
12601 function registerDocument22(targetDocument) {
12602 const runtime = getRuntime22();
12603 runtime.documents.set(
12604 targetDocument,
12605 (runtime.documents.get(targetDocument) ?? 0) + 1
12606 );
12607 for (const [hash, css] of runtime.styles) {
12608 injectStyle22(targetDocument, hash, css);
12609 }
12610 return () => {
12611 const count = runtime.documents.get(targetDocument);
12612 if (count === void 0) {
12613 return;
12614 }
12615 if (count <= 1) {
12616 runtime.documents.delete(targetDocument);
12617 return;
12618 }
12619 runtime.documents.set(targetDocument, count - 1);
12620 };
12621 }
12622 function registerStyle22(hash, css) {
12623 const runtime = getRuntime22();
12624 runtime.styles.set(hash, css);
12625 for (const targetDocument of runtime.documents.keys()) {
12626 injectStyle22(targetDocument, hash, css);
12627 }
12628 }
12629 if (typeof process === "undefined" || true) {
12630 registerStyle22("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}");
12631 }
12632 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
12633 if (typeof process === "undefined" || true) {
12634 registerStyle22("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}");
12635 }
12636 var focus_default3 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
12637 if (typeof process === "undefined" || true) {
12638 registerStyle22("90a23568f8", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-regular,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}');
12639 }
12640 var style_default21 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" };
12641 if (typeof process === "undefined" || true) {
12642 registerStyle22("1fb29d3a3c", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid #0000)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid #0000);transition:var(--_gcd-a-transition,none)}");
12643 }
12644 var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
12645 var Link = (0, import_element40.forwardRef)(function Link2({
12646 children,
12647 variant = "default",
12648 tone = "brand",
12649 openInNewTab = false,
12650 render: render4,
12651 className,
12652 ...props
12653 }, ref) {
12654 const element = useRender({
12655 render: render4,
12656 defaultTagName: "a",
12657 ref,
12658 props: mergeProps(props, {
12659 className: clsx_default(
12660 global_css_defense_default4.a,
12661 resets_default4["box-sizing"],
12662 focus_default3["outset-ring--focus"],
12663 variant !== "unstyled" && style_default21.link,
12664 variant !== "unstyled" && style_default21[`is-${tone}`],
12665 variant === "unstyled" && style_default21["is-unstyled"],
12666 className
12667 ),
12668 target: openInNewTab ? "_blank" : void 0,
12669 children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
12670 children,
12671 openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
12672 "span",
12673 {
12674 className: style_default21["link-icon"],
12675 role: "img",
12676 "aria-label": (
12677 /* translators: accessibility text appended to link text */
12678 (0, import_i18n2.__)("(opens in a new tab)")
12679 )
12680 }
12681 )
12682 ] })
12683 })
12684 });
12685 return element;
12686 });
12687
12688 // packages/dataviews/build-module/components/dataviews-context/index.mjs
12689 var import_element41 = __toESM(require_element(), 1);
12690
12691 // packages/dataviews/build-module/constants.mjs
12692 var import_i18n3 = __toESM(require_i18n(), 1);
12693 var OPERATOR_IS_ANY = "isAny";
12694 var OPERATOR_IS_NONE = "isNone";
12695 var OPERATOR_IS_ALL = "isAll";
12696 var OPERATOR_IS_NOT_ALL = "isNotAll";
12697 var OPERATOR_BETWEEN = "between";
12698 var OPERATOR_IN_THE_PAST = "inThePast";
12699 var OPERATOR_OVER = "over";
12700 var OPERATOR_IS = "is";
12701 var OPERATOR_IS_NOT = "isNot";
12702 var OPERATOR_LESS_THAN = "lessThan";
12703 var OPERATOR_GREATER_THAN = "greaterThan";
12704 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
12705 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
12706 var OPERATOR_BEFORE = "before";
12707 var OPERATOR_AFTER = "after";
12708 var OPERATOR_BEFORE_INC = "beforeInc";
12709 var OPERATOR_AFTER_INC = "afterInc";
12710 var OPERATOR_CONTAINS = "contains";
12711 var OPERATOR_NOT_CONTAINS = "notContains";
12712 var OPERATOR_STARTS_WITH = "startsWith";
12713 var OPERATOR_ON = "on";
12714 var OPERATOR_NOT_ON = "notOn";
12715 var SORTING_DIRECTIONS = ["asc", "desc"];
12716 var sortArrows = { asc: "\u2191", desc: "\u2193" };
12717 var sortValues = { asc: "ascending", desc: "descending" };
12718 var sortLabels = {
12719 asc: (0, import_i18n3.__)("Sort ascending"),
12720 desc: (0, import_i18n3.__)("Sort descending")
12721 };
12722 var sortIcons = {
12723 asc: arrow_up_default,
12724 desc: arrow_down_default
12725 };
12726 var LAYOUT_TABLE = "table";
12727 var LAYOUT_GRID = "grid";
12728 var LAYOUT_LIST = "list";
12729 var LAYOUT_ACTIVITY = "activity";
12730 var LAYOUT_PICKER_GRID = "pickerGrid";
12731 var LAYOUT_PICKER_TABLE = "pickerTable";
12732
12733 // packages/dataviews/build-module/components/dataviews-context/index.mjs
12734 var DataViewsContext = (0, import_element41.createContext)({
12735 view: { type: LAYOUT_TABLE },
12736 onChangeView: () => {
12737 },
12738 fields: [],
12739 data: [],
12740 paginationInfo: {
12741 totalItems: 0,
12742 totalPages: 0
12743 },
12744 selection: [],
12745 onChangeSelection: () => {
12746 },
12747 setOpenedFilter: () => {
12748 },
12749 openedFilter: null,
12750 getItemId: (item) => item.id,
12751 isItemClickable: () => true,
12752 renderItemLink: void 0,
12753 containerWidth: 0,
12754 containerRef: (0, import_element41.createRef)(),
12755 resizeObserverRef: () => {
12756 },
12757 defaultLayouts: { list: {}, grid: {}, table: {} },
12758 filters: [],
12759 isShowingFilter: false,
12760 setIsShowingFilter: () => {
12761 },
12762 hasInitiallyLoaded: false,
12763 config: {
12764 perPageSizes: []
12765 },
12766 intersectionObserver: null
12767 });
12768 DataViewsContext.displayName = "DataViewsContext";
12769 var dataviews_context_default = DataViewsContext;
12770
12771 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs
12772 var import_i18n23 = __toESM(require_i18n(), 1);
12773
12774 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs
12775 var import_i18n11 = __toESM(require_i18n(), 1);
12776 var import_components6 = __toESM(require_components(), 1);
12777 var import_element49 = __toESM(require_element(), 1);
12778 var import_keycodes = __toESM(require_keycodes(), 1);
12779
12780 // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs
12781 var import_components = __toESM(require_components(), 1);
12782 var import_i18n4 = __toESM(require_i18n(), 1);
12783 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
12784 function DataViewsSelectionCheckbox({
12785 selection,
12786 onChangeSelection,
12787 item,
12788 getItemId,
12789 titleField,
12790 disabled: disabled2,
12791 ...extraProps
12792 }) {
12793 const id = getItemId(item);
12794 const isInSelectionArray = selection.includes(id);
12795 const checked = !disabled2 && isInSelectionArray;
12796 const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n4.__)("(no title)");
12797 return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
12798 import_components.CheckboxControl,
12799 {
12800 className: "dataviews-selection-checkbox",
12801 "aria-label": selectionLabel,
12802 "aria-disabled": disabled2,
12803 checked,
12804 onChange: () => {
12805 if (disabled2) {
12806 return;
12807 }
12808 onChangeSelection(
12809 isInSelectionArray ? selection.filter((itemId) => id !== itemId) : [...selection, id]
12810 );
12811 },
12812 ...extraProps
12813 }
12814 );
12815 }
12816
12817 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs
12818 var import_components2 = __toESM(require_components(), 1);
12819 var import_i18n5 = __toESM(require_i18n(), 1);
12820 var import_element42 = __toESM(require_element(), 1);
12821 var import_data = __toESM(require_data(), 1);
12822 var import_compose = __toESM(require_compose(), 1);
12823
12824 // packages/dataviews/build-module/lock-unlock.mjs
12825 var import_private_apis2 = __toESM(require_private_apis(), 1);
12826 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
12827 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
12828 "@wordpress/dataviews"
12829 );
12830
12831 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs
12832 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
12833 var { Menu, kebabCase } = unlock2(import_components2.privateApis);
12834 function ButtonTrigger({
12835 action,
12836 onClick,
12837 items,
12838 variant
12839 }) {
12840 const label = typeof action.label === "string" ? action.label : action.label(items);
12841 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12842 import_components2.Button,
12843 {
12844 disabled: !!action.disabled,
12845 accessibleWhenDisabled: true,
12846 size: "compact",
12847 variant,
12848 onClick,
12849 children: label
12850 }
12851 );
12852 }
12853 function MenuItemTrigger({
12854 action,
12855 onClick,
12856 items
12857 }) {
12858 const label = typeof action.label === "string" ? action.label : action.label(items);
12859 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Menu.ItemLabel, { children: label }) });
12860 }
12861 function ActionModal({
12862 action,
12863 items,
12864 closeModal
12865 }) {
12866 const label = typeof action.label === "string" ? action.label : action.label(items);
12867 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
12868 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12869 import_components2.Modal,
12870 {
12871 title: modalHeader || label,
12872 __experimentalHideHeader: !!action.hideModalHeader,
12873 onRequestClose: closeModal,
12874 focusOnMount: action.modalFocusOnMount ?? true,
12875 size: action.modalSize || "medium",
12876 overlayClassName: `dataviews-action-modal dataviews-action-modal__${kebabCase(
12877 action.id
12878 )}`,
12879 children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(action.RenderModal, { items, closeModal })
12880 }
12881 );
12882 }
12883 function ActionsMenuGroup({
12884 actions,
12885 item,
12886 registry,
12887 setActiveModalAction
12888 }) {
12889 const { primaryActions, regularActions } = (0, import_element42.useMemo)(() => {
12890 return actions.reduce(
12891 (acc, action) => {
12892 (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action);
12893 return acc;
12894 },
12895 {
12896 primaryActions: [],
12897 regularActions: []
12898 }
12899 );
12900 }, [actions]);
12901 const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12902 MenuItemTrigger,
12903 {
12904 action,
12905 onClick: () => {
12906 if ("RenderModal" in action) {
12907 setActiveModalAction(action);
12908 return;
12909 }
12910 action.callback([item], { registry });
12911 },
12912 items: [item]
12913 },
12914 action.id
12915 ));
12916 return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Menu.Group, { children: [
12917 renderActionGroup(primaryActions),
12918 renderActionGroup(regularActions)
12919 ] });
12920 }
12921 function ItemActions({
12922 item,
12923 actions,
12924 isCompact
12925 }) {
12926 const registry = (0, import_data.useRegistry)();
12927 const { primaryActions, eligibleActions } = (0, import_element42.useMemo)(() => {
12928 const _eligibleActions = actions.filter(
12929 (action) => !action.isEligible || action.isEligible(item)
12930 );
12931 const _primaryActions = _eligibleActions.filter(
12932 (action) => action.isPrimary
12933 );
12934 return {
12935 primaryActions: _primaryActions,
12936 eligibleActions: _eligibleActions
12937 };
12938 }, [actions, item]);
12939 const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
12940 if (isCompact) {
12941 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12942 CompactItemActions,
12943 {
12944 item,
12945 actions: eligibleActions,
12946 isSmall: true,
12947 registry
12948 }
12949 );
12950 }
12951 return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
12952 Stack,
12953 {
12954 direction: "row",
12955 justify: "flex-end",
12956 className: "dataviews-item-actions",
12957 style: {
12958 flexShrink: 0,
12959 width: "auto"
12960 },
12961 children: [
12962 /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12963 PrimaryActions,
12964 {
12965 item,
12966 actions: primaryActions,
12967 registry
12968 }
12969 ),
12970 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu
12971 // there if there are any actions at all.
12972 isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12973 CompactItemActions,
12974 {
12975 item,
12976 actions: eligibleActions,
12977 registry
12978 }
12979 )
12980 ]
12981 }
12982 );
12983 }
12984 function CompactItemActions({
12985 item,
12986 actions,
12987 isSmall,
12988 registry
12989 }) {
12990 const [activeModalAction, setActiveModalAction] = (0, import_element42.useState)(
12991 null
12992 );
12993 return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
12994 /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Menu, { placement: "bottom-end", children: [
12995 /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12996 Menu.TriggerButton,
12997 {
12998 render: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
12999 import_components2.Button,
13000 {
13001 size: isSmall ? "small" : "compact",
13002 icon: more_vertical_default,
13003 label: (0, import_i18n5.__)("Actions"),
13004 accessibleWhenDisabled: true,
13005 disabled: !actions.length,
13006 className: "dataviews-all-actions-button"
13007 }
13008 )
13009 }
13010 ),
13011 /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13012 ActionsMenuGroup,
13013 {
13014 actions,
13015 item,
13016 registry,
13017 setActiveModalAction
13018 }
13019 ) })
13020 ] }),
13021 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13022 ActionModal,
13023 {
13024 action: activeModalAction,
13025 items: [item],
13026 closeModal: () => setActiveModalAction(null)
13027 }
13028 )
13029 ] });
13030 }
13031 function PrimaryActions({
13032 item,
13033 actions,
13034 registry,
13035 buttonVariant
13036 }) {
13037 const [activeModalAction, setActiveModalAction] = (0, import_element42.useState)(null);
13038 const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
13039 if (isMobileViewport) {
13040 return null;
13041 }
13042 if (!Array.isArray(actions) || actions.length === 0) {
13043 return null;
13044 }
13045 return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
13046 actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13047 ButtonTrigger,
13048 {
13049 action,
13050 onClick: () => {
13051 if ("RenderModal" in action) {
13052 setActiveModalAction(action);
13053 return;
13054 }
13055 action.callback([item], { registry });
13056 },
13057 items: [item],
13058 variant: buttonVariant
13059 },
13060 action.id
13061 )),
13062 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
13063 ActionModal,
13064 {
13065 action: activeModalAction,
13066 items: [item],
13067 closeModal: () => setActiveModalAction(null)
13068 }
13069 )
13070 ] });
13071 }
13072
13073 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs
13074 var import_components3 = __toESM(require_components(), 1);
13075 var import_i18n7 = __toESM(require_i18n(), 1);
13076 var import_element43 = __toESM(require_element(), 1);
13077 var import_data2 = __toESM(require_data(), 1);
13078 var import_compose2 = __toESM(require_compose(), 1);
13079
13080 // packages/dataviews/build-module/utils/get-footer-message.mjs
13081 var import_i18n6 = __toESM(require_i18n(), 1);
13082 function getFooterMessage(selectionCount, itemsCount, totalItems, onlyTotalCount = false) {
13083 if (selectionCount > 0) {
13084 return (0, import_i18n6.sprintf)(
13085 /* translators: %d: number of items. */
13086 (0, import_i18n6._n)("%d Item selected", "%d Items selected", selectionCount),
13087 selectionCount
13088 );
13089 }
13090 if (onlyTotalCount || totalItems <= itemsCount) {
13091 return (0, import_i18n6.sprintf)(
13092 /* translators: %d: number of items. */
13093 (0, import_i18n6._n)("%d Item", "%d Items", totalItems),
13094 totalItems
13095 );
13096 }
13097 return (0, import_i18n6.sprintf)(
13098 /* translators: %1$d: number of items. %2$d: total number of items. */
13099 (0, import_i18n6._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems),
13100 itemsCount,
13101 totalItems
13102 );
13103 }
13104
13105 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs
13106 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
13107 function ActionWithModal({
13108 action,
13109 items,
13110 ActionTriggerComponent
13111 }) {
13112 const [isModalOpen, setIsModalOpen] = (0, import_element43.useState)(false);
13113 const actionTriggerProps = {
13114 action,
13115 onClick: () => {
13116 setIsModalOpen(true);
13117 },
13118 items
13119 };
13120 return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
13121 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ActionTriggerComponent, { ...actionTriggerProps }),
13122 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13123 ActionModal,
13124 {
13125 action,
13126 items,
13127 closeModal: () => setIsModalOpen(false)
13128 }
13129 )
13130 ] });
13131 }
13132 function useHasAPossibleBulkAction(actions, item) {
13133 return (0, import_element43.useMemo)(() => {
13134 return actions.some((action) => {
13135 return action.supportsBulk && (!action.isEligible || action.isEligible(item));
13136 });
13137 }, [actions, item]);
13138 }
13139 function useSomeItemHasAPossibleBulkAction(actions, data) {
13140 return (0, import_element43.useMemo)(() => {
13141 return data.some((item) => {
13142 return actions.some((action) => {
13143 return action.supportsBulk && (!action.isEligible || action.isEligible(item));
13144 });
13145 });
13146 }, [actions, data]);
13147 }
13148 function BulkSelectionCheckbox({
13149 selection,
13150 onChangeSelection,
13151 data,
13152 actions,
13153 getItemId,
13154 disableSelectAll = false
13155 }) {
13156 const selectableItems = (0, import_element43.useMemo)(() => {
13157 return data.filter((item) => {
13158 return actions.some(
13159 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
13160 );
13161 });
13162 }, [data, actions]);
13163 const selectedItems = data.filter(
13164 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
13165 );
13166 const hasSelection = selection.length > 0;
13167 const areAllSelected = selectedItems.length === selectableItems.length;
13168 if (disableSelectAll) {
13169 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13170 import_components3.CheckboxControl,
13171 {
13172 className: "dataviews-view-table-selection-checkbox",
13173 checked: hasSelection,
13174 disabled: !hasSelection,
13175 onChange: () => {
13176 onChangeSelection([]);
13177 },
13178 "aria-label": (0, import_i18n7.__)("Deselect all")
13179 }
13180 );
13181 }
13182 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13183 import_components3.CheckboxControl,
13184 {
13185 className: "dataviews-view-table-selection-checkbox",
13186 checked: areAllSelected,
13187 indeterminate: !areAllSelected && !!selectedItems.length,
13188 onChange: () => {
13189 if (areAllSelected) {
13190 onChangeSelection([]);
13191 } else {
13192 onChangeSelection(
13193 selectableItems.map((item) => getItemId(item))
13194 );
13195 }
13196 },
13197 "aria-label": areAllSelected ? (0, import_i18n7.__)("Deselect all") : (0, import_i18n7.__)("Select all")
13198 }
13199 );
13200 }
13201 function ActionTrigger({
13202 action,
13203 onClick,
13204 isBusy,
13205 items
13206 }) {
13207 const label = typeof action.label === "string" ? action.label : action.label(items);
13208 const isMobile = (0, import_compose2.useViewportMatch)("medium", "<");
13209 if (isMobile) {
13210 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13211 import_components3.Button,
13212 {
13213 disabled: isBusy,
13214 accessibleWhenDisabled: true,
13215 label,
13216 icon: action.icon,
13217 size: "compact",
13218 onClick,
13219 isBusy
13220 }
13221 );
13222 }
13223 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13224 import_components3.Button,
13225 {
13226 disabled: isBusy,
13227 accessibleWhenDisabled: true,
13228 size: "compact",
13229 onClick,
13230 isBusy,
13231 children: label
13232 }
13233 );
13234 }
13235 var EMPTY_ARRAY2 = [];
13236 function ActionButton({
13237 action,
13238 selectedItems,
13239 actionInProgress,
13240 setActionInProgress
13241 }) {
13242 const registry = (0, import_data2.useRegistry)();
13243 const selectedEligibleItems = (0, import_element43.useMemo)(() => {
13244 return selectedItems.filter((item) => {
13245 return !action.isEligible || action.isEligible(item);
13246 });
13247 }, [action, selectedItems]);
13248 if ("RenderModal" in action) {
13249 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13250 ActionWithModal,
13251 {
13252 action,
13253 items: selectedEligibleItems,
13254 ActionTriggerComponent: ActionTrigger
13255 },
13256 action.id
13257 );
13258 }
13259 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13260 ActionTrigger,
13261 {
13262 action,
13263 onClick: async () => {
13264 setActionInProgress(action.id);
13265 await action.callback(selectedItems, {
13266 registry
13267 });
13268 setActionInProgress(null);
13269 },
13270 items: selectedEligibleItems,
13271 isBusy: actionInProgress === action.id
13272 },
13273 action.id
13274 );
13275 }
13276 function renderFooterContent(data, actions, getItemId, isInfiniteScroll, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection, paginationInfo) {
13277 const message2 = getFooterMessage(
13278 selection.length,
13279 data.length,
13280 paginationInfo.totalItems,
13281 isInfiniteScroll
13282 );
13283 return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13284 Stack,
13285 {
13286 direction: "row",
13287 className: "dataviews-bulk-actions-footer__container",
13288 gap: "md",
13289 align: "center",
13290 children: [
13291 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13292 BulkSelectionCheckbox,
13293 {
13294 selection,
13295 onChangeSelection,
13296 data,
13297 actions,
13298 getItemId,
13299 disableSelectAll: isInfiniteScroll
13300 }
13301 ),
13302 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }),
13303 /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
13304 Stack,
13305 {
13306 direction: "row",
13307 className: "dataviews-bulk-actions-footer__action-buttons",
13308 gap: "xs",
13309 children: [
13310 actionsToShow.map((action) => {
13311 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13312 ActionButton,
13313 {
13314 action,
13315 selectedItems,
13316 actionInProgress,
13317 setActionInProgress
13318 },
13319 action.id
13320 );
13321 }),
13322 selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13323 import_components3.Button,
13324 {
13325 icon: close_small_default,
13326 showTooltip: true,
13327 tooltipPosition: "top",
13328 size: "compact",
13329 label: (0, import_i18n7.__)("Cancel"),
13330 disabled: !!actionInProgress,
13331 accessibleWhenDisabled: false,
13332 onClick: () => {
13333 onChangeSelection(EMPTY_ARRAY2);
13334 }
13335 }
13336 )
13337 ]
13338 }
13339 )
13340 ]
13341 }
13342 );
13343 }
13344 function FooterContent({
13345 selection,
13346 actions,
13347 onChangeSelection,
13348 data,
13349 getItemId,
13350 isInfiniteScroll,
13351 paginationInfo
13352 }) {
13353 const [actionInProgress, setActionInProgress] = (0, import_element43.useState)(
13354 null
13355 );
13356 const footerContentRef = (0, import_element43.useRef)(void 0);
13357 const isMobile = (0, import_compose2.useViewportMatch)("medium", "<");
13358 const bulkActions = (0, import_element43.useMemo)(
13359 () => actions.filter((action) => action.supportsBulk),
13360 [actions]
13361 );
13362 const selectableItems = (0, import_element43.useMemo)(() => {
13363 return data.filter((item) => {
13364 return bulkActions.some(
13365 (action) => !action.isEligible || action.isEligible(item)
13366 );
13367 });
13368 }, [data, bulkActions]);
13369 const selectedItems = (0, import_element43.useMemo)(() => {
13370 return data.filter(
13371 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item)
13372 );
13373 }, [selection, data, getItemId, selectableItems]);
13374 const actionsToShow = (0, import_element43.useMemo)(
13375 () => actions.filter((action) => {
13376 return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some(
13377 (item) => !action.isEligible || action.isEligible(item)
13378 );
13379 }),
13380 [actions, selectedItems, isMobile]
13381 );
13382 if (!actionInProgress) {
13383 if (footerContentRef.current) {
13384 footerContentRef.current = void 0;
13385 }
13386 return renderFooterContent(
13387 data,
13388 actions,
13389 getItemId,
13390 isInfiniteScroll,
13391 selection,
13392 actionsToShow,
13393 selectedItems,
13394 actionInProgress,
13395 setActionInProgress,
13396 onChangeSelection,
13397 paginationInfo
13398 );
13399 } else if (!footerContentRef.current) {
13400 footerContentRef.current = renderFooterContent(
13401 data,
13402 actions,
13403 getItemId,
13404 isInfiniteScroll,
13405 selection,
13406 actionsToShow,
13407 selectedItems,
13408 actionInProgress,
13409 setActionInProgress,
13410 onChangeSelection,
13411 paginationInfo
13412 );
13413 }
13414 return footerContentRef.current;
13415 }
13416 function BulkActionsFooter() {
13417 const {
13418 data,
13419 selection,
13420 actions = EMPTY_ARRAY2,
13421 onChangeSelection,
13422 getItemId,
13423 paginationInfo,
13424 view
13425 } = (0, import_element43.useContext)(dataviews_context_default);
13426 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
13427 FooterContent,
13428 {
13429 selection,
13430 onChangeSelection,
13431 data,
13432 actions,
13433 getItemId,
13434 isInfiniteScroll: !!view.infiniteScrollEnabled,
13435 paginationInfo
13436 }
13437 );
13438 }
13439
13440 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs
13441 var import_i18n8 = __toESM(require_i18n(), 1);
13442 var import_components4 = __toESM(require_components(), 1);
13443 var import_element44 = __toESM(require_element(), 1);
13444
13445 // packages/dataviews/build-module/utils/get-hideable-fields.mjs
13446 function getHideableFields(view, fields) {
13447 const togglableFields = [
13448 view?.titleField,
13449 view?.mediaField,
13450 view?.descriptionField
13451 ].filter(Boolean);
13452 return fields.filter(
13453 (f2) => !togglableFields.includes(f2.id) && f2.type !== "media" && f2.enableHiding !== false
13454 );
13455 }
13456
13457 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs
13458 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
13459 var { Menu: Menu2 } = unlock2(import_components4.privateApis);
13460 function WithMenuSeparators({ children }) {
13461 return import_element44.Children.toArray(children).filter(Boolean).map((child, i2) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_element44.Fragment, { children: [
13462 i2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.Separator, {}),
13463 child
13464 ] }, i2));
13465 }
13466 var _HeaderMenu = (0, import_element44.forwardRef)(function HeaderMenu({
13467 fieldId,
13468 view,
13469 fields,
13470 onChangeView,
13471 onHide,
13472 setOpenedFilter,
13473 canMove = true,
13474 canInsertLeft = true,
13475 canInsertRight = true
13476 }, ref) {
13477 const visibleFieldIds = view.fields ?? [];
13478 const index2 = visibleFieldIds?.indexOf(fieldId);
13479 const isSorted = view.sort?.field === fieldId;
13480 let isHidable = false;
13481 let isSortable = false;
13482 let canAddFilter = false;
13483 let operators = [];
13484 const field = fields.find((f2) => f2.id === fieldId);
13485 const { setIsShowingFilter } = (0, import_element44.useContext)(dataviews_context_default);
13486 if (!field) {
13487 return null;
13488 }
13489 isHidable = field.enableHiding !== false;
13490 isSortable = field.enableSorting !== false;
13491 const header = field.header;
13492 operators = !!field.filterBy && field.filterBy?.operators || [];
13493 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary;
13494 if (!isSortable && !canMove && !isHidable && !canAddFilter) {
13495 return header;
13496 }
13497 const hiddenFields = getHideableFields(view, fields).filter(
13498 (f2) => !visibleFieldIds.includes(f2.id)
13499 );
13500 const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length;
13501 const isRtl = (0, import_i18n8.isRTL)();
13502 return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Menu2, { children: [
13503 /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
13504 Menu2.TriggerButton,
13505 {
13506 render: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13507 import_components4.Button,
13508 {
13509 size: "compact",
13510 className: "dataviews-view-table-header-button",
13511 ref,
13512 variant: "tertiary"
13513 }
13514 ),
13515 children: [
13516 header,
13517 view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })
13518 ]
13519 }
13520 ),
13521 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(WithMenuSeparators, { children: [
13522 isSortable && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.Group, { children: SORTING_DIRECTIONS.map(
13523 (direction) => {
13524 const isChecked = view.sort && isSorted && view.sort.direction === direction;
13525 const value = `${fieldId}-${direction}`;
13526 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13527 Menu2.RadioItem,
13528 {
13529 name: "view-table-sorting",
13530 value,
13531 checked: isChecked,
13532 onChange: () => {
13533 onChangeView({
13534 ...view,
13535 sort: {
13536 field: fieldId,
13537 direction
13538 },
13539 showLevels: false
13540 });
13541 },
13542 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: sortLabels[direction] })
13543 },
13544 value
13545 );
13546 }
13547 ) }),
13548 canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13549 Menu2.Item,
13550 {
13551 prefix: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components4.Icon, { icon: funnel_default }),
13552 onClick: () => {
13553 setOpenedFilter(fieldId);
13554 setIsShowingFilter(true);
13555 onChangeView({
13556 ...view,
13557 page: 1,
13558 filters: [
13559 ...view.filters || [],
13560 {
13561 field: fieldId,
13562 value: void 0,
13563 operator: operators[0]
13564 }
13565 ]
13566 });
13567 },
13568 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: (0, import_i18n8.__)("Add filter") })
13569 }
13570 ) }),
13571 (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Menu2.Group, { children: [
13572 canMove && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13573 Menu2.Item,
13574 {
13575 prefix: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components4.Icon, { icon: arrow_left_default }),
13576 disabled: isRtl ? index2 >= visibleFieldIds.length - 1 : index2 < 1,
13577 onClick: () => {
13578 const targetIndex = isRtl ? index2 + 1 : index2 - 1;
13579 const newFields = [
13580 ...visibleFieldIds
13581 ];
13582 newFields.splice(index2, 1);
13583 newFields.splice(
13584 targetIndex,
13585 0,
13586 fieldId
13587 );
13588 onChangeView({
13589 ...view,
13590 fields: newFields
13591 });
13592 },
13593 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: (0, import_i18n8.__)("Move left") })
13594 }
13595 ),
13596 canMove && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13597 Menu2.Item,
13598 {
13599 prefix: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components4.Icon, { icon: arrow_right_default }),
13600 disabled: isRtl ? index2 < 1 : index2 >= visibleFieldIds.length - 1,
13601 onClick: () => {
13602 const targetIndex = isRtl ? index2 - 1 : index2 + 1;
13603 const newFields = [
13604 ...visibleFieldIds
13605 ];
13606 newFields.splice(index2, 1);
13607 newFields.splice(
13608 targetIndex,
13609 0,
13610 fieldId
13611 );
13612 onChangeView({
13613 ...view,
13614 fields: newFields
13615 });
13616 },
13617 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: (0, import_i18n8.__)("Move right") })
13618 }
13619 ),
13620 canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Menu2, { children: [
13621 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: (0, import_i18n8.__)("Insert left") }) }),
13622 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => {
13623 const insertIndex = isRtl ? index2 + 1 : index2;
13624 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13625 Menu2.Item,
13626 {
13627 onClick: () => {
13628 onChangeView({
13629 ...view,
13630 fields: [
13631 ...visibleFieldIds.slice(
13632 0,
13633 insertIndex
13634 ),
13635 hiddenField.id,
13636 ...visibleFieldIds.slice(
13637 insertIndex
13638 )
13639 ]
13640 });
13641 },
13642 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: hiddenField.label })
13643 },
13644 hiddenField.id
13645 );
13646 }) })
13647 ] }),
13648 canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Menu2, { children: [
13649 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: (0, import_i18n8.__)("Insert right") }) }),
13650 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => {
13651 const insertIndex = isRtl ? index2 : index2 + 1;
13652 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13653 Menu2.Item,
13654 {
13655 onClick: () => {
13656 onChangeView({
13657 ...view,
13658 fields: [
13659 ...visibleFieldIds.slice(
13660 0,
13661 insertIndex
13662 ),
13663 hiddenField.id,
13664 ...visibleFieldIds.slice(
13665 insertIndex
13666 )
13667 ]
13668 });
13669 },
13670 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: hiddenField.label })
13671 },
13672 hiddenField.id
13673 );
13674 }) })
13675 ] }),
13676 isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
13677 Menu2.Item,
13678 {
13679 prefix: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components4.Icon, { icon: unseen_default }),
13680 onClick: () => {
13681 onHide(field);
13682 onChangeView({
13683 ...view,
13684 fields: visibleFieldIds.filter(
13685 (id) => id !== fieldId
13686 )
13687 });
13688 },
13689 children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Menu2.ItemLabel, { children: (0, import_i18n8.__)("Hide column") })
13690 }
13691 )
13692 ] })
13693 ] }) })
13694 ] });
13695 });
13696 var ColumnHeaderMenu = _HeaderMenu;
13697 var column_header_menu_default = ColumnHeaderMenu;
13698
13699 // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs
13700 var import_element45 = __toESM(require_element(), 1);
13701 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
13702 function getClickableItemProps({
13703 item,
13704 isItemClickable,
13705 onClickItem,
13706 className
13707 }) {
13708 if (!isItemClickable(item) || !onClickItem) {
13709 return { className };
13710 }
13711 return {
13712 className: className ? `${className} ${className}--clickable` : void 0,
13713 role: "button",
13714 tabIndex: 0,
13715 onClick: (event) => {
13716 event.stopPropagation();
13717 onClickItem(item);
13718 },
13719 onKeyDown: (event) => {
13720 if (event.key === "Enter" || event.key === "" || event.key === " ") {
13721 event.stopPropagation();
13722 onClickItem(item);
13723 }
13724 }
13725 };
13726 }
13727 function ItemClickWrapper({
13728 item,
13729 isItemClickable,
13730 onClickItem,
13731 renderItemLink,
13732 className,
13733 children,
13734 ...extraProps
13735 }) {
13736 if (!isItemClickable(item)) {
13737 return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className, ...extraProps, children });
13738 }
13739 if (renderItemLink) {
13740 const renderedElement = renderItemLink({
13741 item,
13742 className: `${className} ${className}--clickable`,
13743 ...extraProps,
13744 children
13745 });
13746 return (0, import_element45.cloneElement)(renderedElement, {
13747 onClick: (event) => {
13748 event.stopPropagation();
13749 if (renderedElement.props.onClick) {
13750 renderedElement.props.onClick(event);
13751 }
13752 },
13753 onKeyDown: (event) => {
13754 if (event.key === "Enter" || event.key === "" || event.key === " ") {
13755 event.stopPropagation();
13756 if (renderedElement.props.onKeyDown) {
13757 renderedElement.props.onKeyDown(event);
13758 }
13759 }
13760 }
13761 });
13762 }
13763 const clickProps = getClickableItemProps({
13764 item,
13765 isItemClickable,
13766 onClickItem,
13767 className
13768 });
13769 return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { ...clickProps, ...extraProps, children });
13770 }
13771
13772 // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs
13773 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
13774 function ColumnPrimary({
13775 item,
13776 level,
13777 titleField,
13778 mediaField,
13779 descriptionField,
13780 onClickItem,
13781 renderItemLink,
13782 isItemClickable
13783 }) {
13784 return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [
13785 mediaField && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13786 ItemClickWrapper,
13787 {
13788 item,
13789 isItemClickable,
13790 onClickItem,
13791 renderItemLink,
13792 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",
13793 "aria-label": isItemClickable(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0,
13794 children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13795 mediaField.render,
13796 {
13797 item,
13798 field: mediaField,
13799 config: { sizes: "32px" }
13800 }
13801 )
13802 }
13803 ),
13804 /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
13805 Stack,
13806 {
13807 direction: "column",
13808 align: "flex-start",
13809 className: "dataviews-view-table__primary-column-content",
13810 children: [
13811 titleField && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
13812 ItemClickWrapper,
13813 {
13814 item,
13815 isItemClickable,
13816 onClickItem,
13817 renderItemLink,
13818 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field",
13819 children: [
13820 level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "dataviews-view-table__level", children: [
13821 Array(level).fill("\u2014").join(" "),
13822 "\xA0"
13823 ] }),
13824 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(titleField.render, { item, field: titleField })
13825 ]
13826 }
13827 ),
13828 descriptionField && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
13829 descriptionField.render,
13830 {
13831 item,
13832 field: descriptionField
13833 }
13834 )
13835 ]
13836 }
13837 )
13838 ] });
13839 }
13840 var column_primary_default = ColumnPrimary;
13841
13842 // packages/dataviews/build-module/components/dataviews-layouts/table/use-scroll-state.mjs
13843 var import_element46 = __toESM(require_element(), 1);
13844 var import_i18n9 = __toESM(require_i18n(), 1);
13845 var isScrolledToEnd = (element) => {
13846 if ((0, import_i18n9.isRTL)()) {
13847 const scrollLeft = Math.abs(element.scrollLeft);
13848 return scrollLeft <= 1;
13849 }
13850 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
13851 };
13852 function useScrollState({
13853 scrollContainerRef,
13854 enabledHorizontal = false
13855 }) {
13856 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element46.useState)(false);
13857 const [isVerticallyScrolled, setIsVerticallyScrolled] = (0, import_element46.useState)(false);
13858 const handleScroll = (0, import_element46.useCallback)(() => {
13859 const scrollContainer = scrollContainerRef.current;
13860 if (!scrollContainer) {
13861 return;
13862 }
13863 if (enabledHorizontal) {
13864 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
13865 }
13866 setIsVerticallyScrolled(scrollContainer.scrollTop > 0);
13867 }, [scrollContainerRef, enabledHorizontal]);
13868 (0, import_element46.useEffect)(() => {
13869 if (typeof window === "undefined" || !scrollContainerRef.current) {
13870 return () => {
13871 };
13872 }
13873 const scrollContainer = scrollContainerRef.current;
13874 handleScroll();
13875 scrollContainer.addEventListener("scroll", handleScroll);
13876 window.addEventListener("resize", handleScroll);
13877 return () => {
13878 scrollContainer.removeEventListener("scroll", handleScroll);
13879 window.removeEventListener("resize", handleScroll);
13880 };
13881 }, [scrollContainerRef, enabledHorizontal, handleScroll]);
13882 return { isHorizontalScrollEnd, isVerticallyScrolled };
13883 }
13884
13885 // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs
13886 function getDataByGroup(data, groupByField) {
13887 return data.reduce((groups, item) => {
13888 const groupName = groupByField.getValue({ item });
13889 if (!groups.has(groupName)) {
13890 groups.set(groupName, []);
13891 }
13892 groups.get(groupName)?.push(item);
13893 return groups;
13894 }, /* @__PURE__ */ new Map());
13895 }
13896
13897 // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs
13898 var import_components5 = __toESM(require_components(), 1);
13899 var import_i18n10 = __toESM(require_i18n(), 1);
13900 var import_element47 = __toESM(require_element(), 1);
13901 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
13902 function FieldItem({
13903 field,
13904 isVisible: isVisible2,
13905 onToggleVisibility
13906 }) {
13907 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components5.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [
13908 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components5.Icon, { icon: check_default }) }),
13909 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "dataviews-view-config__label", children: field.label })
13910 ] }) });
13911 }
13912 function isDefined(item) {
13913 return !!item;
13914 }
13915 function PropertiesSection({
13916 showLabel = true
13917 }) {
13918 const { view, fields, onChangeView } = (0, import_element47.useContext)(dataviews_context_default);
13919 const regularFields = getHideableFields(view, fields);
13920 if (!regularFields?.length) {
13921 return null;
13922 }
13923 const titleField = fields.find((f2) => f2.id === view.titleField);
13924 const previewField = fields.find((f2) => f2.id === view.mediaField);
13925 const descriptionField = fields.find(
13926 (f2) => f2.id === view.descriptionField
13927 );
13928 const lockedFields = [
13929 {
13930 field: titleField,
13931 isVisibleFlag: "showTitle"
13932 },
13933 {
13934 field: previewField,
13935 isVisibleFlag: "showMedia"
13936 },
13937 {
13938 field: descriptionField,
13939 isVisibleFlag: "showDescription"
13940 }
13941 ].filter(({ field }) => isDefined(field));
13942 const visibleFieldIds = view.fields ?? [];
13943 const visibleRegularFieldsCount = regularFields.filter(
13944 (f2) => visibleFieldIds.includes(f2.id)
13945 ).length;
13946 const visibleLockedFields = lockedFields.filter(
13947 ({ isVisibleFlag }) => (
13948 // @ts-expect-error
13949 view[isVisibleFlag] ?? true
13950 )
13951 );
13952 const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount;
13953 const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1;
13954 return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [
13955 showLabel && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components5.BaseControl.VisualLabel, { children: (0, import_i18n10.__)("Properties") }),
13956 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13957 Stack,
13958 {
13959 direction: "column",
13960 className: "dataviews-view-config__properties",
13961 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_components5.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [
13962 lockedFields.map(({ field, isVisibleFlag }) => {
13963 const isVisible2 = view[isVisibleFlag] ?? true;
13964 const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field;
13965 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13966 FieldItem,
13967 {
13968 field: fieldToRender,
13969 isVisible: isVisible2,
13970 onToggleVisibility: () => {
13971 onChangeView({
13972 ...view,
13973 [isVisibleFlag]: !isVisible2
13974 });
13975 }
13976 },
13977 field.id
13978 );
13979 }),
13980 regularFields.map((field) => {
13981 const isVisible2 = visibleFieldIds.includes(field.id);
13982 const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field;
13983 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
13984 FieldItem,
13985 {
13986 field: fieldToRender,
13987 isVisible: isVisible2,
13988 onToggleVisibility: () => {
13989 onChangeView({
13990 ...view,
13991 fields: isVisible2 ? visibleFieldIds.filter(
13992 (fieldId) => fieldId !== field.id
13993 ) : [...visibleFieldIds, field.id]
13994 });
13995 }
13996 },
13997 field.id
13998 );
13999 })
14000 ] })
14001 }
14002 )
14003 ] });
14004 }
14005
14006 // packages/dataviews/build-module/hooks/use-delayed-loading.mjs
14007 var import_element48 = __toESM(require_element(), 1);
14008 function useDelayedLoading(isLoading, options = { delay: 400 }) {
14009 const [showLoader, setShowLoader] = (0, import_element48.useState)(false);
14010 (0, import_element48.useEffect)(() => {
14011 if (!isLoading) {
14012 return;
14013 }
14014 const timeout = setTimeout(() => {
14015 setShowLoader(true);
14016 }, options.delay);
14017 return () => {
14018 clearTimeout(timeout);
14019 setShowLoader(false);
14020 };
14021 }, [isLoading, options.delay]);
14022 return showLoader;
14023 }
14024
14025 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs
14026 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
14027 function getEffectiveAlign(explicitAlign, fieldType) {
14028 if (explicitAlign) {
14029 return explicitAlign;
14030 }
14031 if (fieldType === "integer" || fieldType === "number") {
14032 return "end";
14033 }
14034 return void 0;
14035 }
14036 function TableColumnField({
14037 item,
14038 fields,
14039 column,
14040 align
14041 }) {
14042 const field = fields.find((f2) => f2.id === column);
14043 if (!field) {
14044 return null;
14045 }
14046 const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
14047 "dataviews-view-table__cell-align-end": align === "end",
14048 "dataviews-view-table__cell-align-center": align === "center"
14049 });
14050 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(field.render, { item, field }) });
14051 }
14052 function TableRow({
14053 hasBulkActions,
14054 item,
14055 level,
14056 actions,
14057 fields,
14058 id,
14059 view,
14060 titleField,
14061 mediaField,
14062 descriptionField,
14063 selection,
14064 getItemId,
14065 isItemClickable,
14066 onClickItem,
14067 renderItemLink,
14068 onChangeSelection,
14069 isActionsColumnSticky,
14070 posinset
14071 }) {
14072 const { paginationInfo } = (0, import_element49.useContext)(dataviews_context_default);
14073 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
14074 const isSelected2 = hasPossibleBulkAction && selection.includes(id);
14075 const {
14076 showTitle = true,
14077 showMedia = true,
14078 showDescription = true,
14079 infiniteScrollEnabled
14080 } = view;
14081 const isTouchDeviceRef = (0, import_element49.useRef)(false);
14082 const columns = view.fields ?? [];
14083 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
14084 return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
14085 "tr",
14086 {
14087 className: clsx_default("dataviews-view-table__row", {
14088 "is-selected": hasPossibleBulkAction && isSelected2,
14089 "has-bulk-actions": hasPossibleBulkAction
14090 }),
14091 onTouchStart: () => {
14092 isTouchDeviceRef.current = true;
14093 },
14094 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
14095 "aria-posinset": posinset,
14096 role: infiniteScrollEnabled ? "article" : void 0,
14097 onMouseDown: (event) => {
14098 const isMetaClick = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey;
14099 if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) {
14100 event?.preventDefault();
14101 }
14102 },
14103 onClick: (event) => {
14104 if (!hasPossibleBulkAction) {
14105 return;
14106 }
14107 const isModifierKeyPressed = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey;
14108 if (isModifierKeyPressed && !isTouchDeviceRef.current && document.getSelection()?.type !== "Range") {
14109 onChangeSelection(
14110 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
14111 );
14112 }
14113 },
14114 children: [
14115 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14116 DataViewsSelectionCheckbox,
14117 {
14118 item,
14119 selection,
14120 onChangeSelection,
14121 getItemId,
14122 titleField,
14123 disabled: !hasPossibleBulkAction
14124 }
14125 ) }) }),
14126 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14127 column_primary_default,
14128 {
14129 item,
14130 level,
14131 titleField: showTitle ? titleField : void 0,
14132 mediaField: showMedia ? mediaField : void 0,
14133 descriptionField: showDescription ? descriptionField : void 0,
14134 isItemClickable,
14135 onClickItem,
14136 renderItemLink
14137 }
14138 ) }),
14139 columns.map((column) => {
14140 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
14141 const field = fields.find((f2) => f2.id === column);
14142 const effectiveAlign = getEffectiveAlign(align, field?.type);
14143 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14144 "td",
14145 {
14146 style: {
14147 width,
14148 maxWidth,
14149 minWidth
14150 },
14151 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14152 TableColumnField,
14153 {
14154 fields,
14155 item,
14156 column,
14157 align: effectiveAlign
14158 }
14159 )
14160 },
14161 column
14162 );
14163 }),
14164 !!actions?.length && // Disable reason: we are not making the element interactive,
14165 // but preventing any click events from bubbling up to the
14166 // table row. This allows us to add a click handler to the row
14167 // itself (to toggle row selection) without erroneously
14168 // intercepting click events from ItemActions.
14169 /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14170 "td",
14171 {
14172 className: clsx_default("dataviews-view-table__actions-column", {
14173 "dataviews-view-table__actions-column--sticky": true,
14174 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
14175 }),
14176 onClick: (e2) => e2.stopPropagation(),
14177 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ItemActions, { item, actions })
14178 }
14179 )
14180 ]
14181 }
14182 );
14183 }
14184 function ViewTable({
14185 actions,
14186 data,
14187 fields,
14188 getItemId,
14189 getItemLevel,
14190 isLoading = false,
14191 onChangeView,
14192 onChangeSelection,
14193 selection,
14194 setOpenedFilter,
14195 onClickItem,
14196 isItemClickable,
14197 renderItemLink,
14198 view,
14199 className,
14200 empty
14201 }) {
14202 const { containerRef } = (0, import_element49.useContext)(dataviews_context_default);
14203 const isDelayedLoading = useDelayedLoading(isLoading);
14204 const headerMenuRefs = (0, import_element49.useRef)(/* @__PURE__ */ new Map());
14205 const headerMenuToFocusRef = (0, import_element49.useRef)(void 0);
14206 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element49.useState)();
14207 const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element49.useState)(null);
14208 (0, import_element49.useEffect)(() => {
14209 if (headerMenuToFocusRef.current) {
14210 headerMenuToFocusRef.current.focus();
14211 headerMenuToFocusRef.current = void 0;
14212 }
14213 });
14214 const tableNoticeId = (0, import_element49.useId)();
14215 const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({
14216 scrollContainerRef: containerRef,
14217 enabledHorizontal: !!actions?.length
14218 });
14219 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
14220 if (nextHeaderMenuToFocus) {
14221 headerMenuToFocusRef.current = nextHeaderMenuToFocus;
14222 setNextHeaderMenuToFocus(void 0);
14223 return;
14224 }
14225 const onHide = (field) => {
14226 const hidden = headerMenuRefs.current.get(field.id);
14227 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
14228 setNextHeaderMenuToFocus(fallback?.node);
14229 };
14230 const handleHeaderContextMenu = (event) => {
14231 event.preventDefault();
14232 event.stopPropagation();
14233 const virtualAnchor = {
14234 getBoundingClientRect: () => ({
14235 x: event.clientX,
14236 y: event.clientY,
14237 top: event.clientY,
14238 left: event.clientX,
14239 right: event.clientX,
14240 bottom: event.clientY,
14241 width: 0,
14242 height: 0,
14243 toJSON: () => ({})
14244 })
14245 };
14246 window.requestAnimationFrame(() => {
14247 setContextMenuAnchor(virtualAnchor);
14248 });
14249 };
14250 const hasData = !!data?.length;
14251 const titleField = fields.find((field) => field.id === view.titleField);
14252 const mediaField = fields.find((field) => field.id === view.mediaField);
14253 const descriptionField = fields.find(
14254 (field) => field.id === view.descriptionField
14255 );
14256 const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
14257 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
14258 const { showTitle = true, showMedia = true, showDescription = true } = view;
14259 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
14260 const columns = view.fields ?? [];
14261 const headerMenuRef = (column, index2) => (node) => {
14262 if (node) {
14263 headerMenuRefs.current.set(column, {
14264 node,
14265 fallback: columns[index2 > 0 ? index2 - 1 : 1]
14266 });
14267 } else {
14268 headerMenuRefs.current.delete(column);
14269 }
14270 };
14271 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
14272 const isRtl = (0, import_i18n11.isRTL)();
14273 if (!hasData) {
14274 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14275 "div",
14276 {
14277 className: clsx_default("dataviews-no-results", {
14278 "is-refreshing": isDelayedLoading
14279 }),
14280 id: tableNoticeId,
14281 children: empty
14282 }
14283 );
14284 }
14285 return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
14286 /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
14287 "table",
14288 {
14289 className: clsx_default("dataviews-view-table", className, {
14290 [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
14291 view.layout.density
14292 ),
14293 "has-bulk-actions": hasBulkActions,
14294 "is-refreshing": !isInfiniteScroll && isDelayedLoading
14295 }),
14296 "aria-busy": isLoading,
14297 "aria-describedby": tableNoticeId,
14298 role: isInfiniteScroll ? "feed" : void 0,
14299 inert: !isInfiniteScroll && isLoading ? "true" : void 0,
14300 children: [
14301 /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("colgroup", { children: [
14302 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("col", { className: "dataviews-view-table__col-checkbox" }),
14303 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("col", { className: "dataviews-view-table__col-first-data" }),
14304 columns.map((column, index2) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14305 "col",
14306 {
14307 className: clsx_default(
14308 `dataviews-view-table__col-${column}`,
14309 {
14310 "dataviews-view-table__col-expand": !hasPrimaryColumn && index2 === columns.length - 1
14311 }
14312 )
14313 },
14314 `col-${column}`
14315 )),
14316 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("col", { className: "dataviews-view-table__col-actions" })
14317 ] }),
14318 contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14319 import_components6.Popover,
14320 {
14321 anchor: contextMenuAnchor,
14322 onClose: () => setContextMenuAnchor(null),
14323 placement: "bottom-start",
14324 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(PropertiesSection, { showLabel: false })
14325 }
14326 ),
14327 /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14328 "thead",
14329 {
14330 className: clsx_default({
14331 "dataviews-view-table__thead--stuck": isVerticallyScrolled
14332 }),
14333 onContextMenu: handleHeaderContextMenu,
14334 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("tr", { className: "dataviews-view-table__row", children: [
14335 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14336 "th",
14337 {
14338 className: "dataviews-view-table__checkbox-column",
14339 scope: "col",
14340 onContextMenu: handleHeaderContextMenu,
14341 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14342 BulkSelectionCheckbox,
14343 {
14344 selection,
14345 onChangeSelection,
14346 data,
14347 actions,
14348 getItemId
14349 }
14350 )
14351 }
14352 ),
14353 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14354 column_header_menu_default,
14355 {
14356 ref: headerMenuRef(
14357 titleField.id,
14358 0
14359 ),
14360 fieldId: titleField.id,
14361 view,
14362 fields,
14363 onChangeView,
14364 onHide,
14365 setOpenedFilter,
14366 canMove: false,
14367 canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false,
14368 canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true
14369 }
14370 ) }),
14371 columns.map((column, index2) => {
14372 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
14373 const field = fields.find(
14374 (f2) => f2.id === column
14375 );
14376 const effectiveAlign = getEffectiveAlign(
14377 align,
14378 field?.type
14379 );
14380 const canInsertOrMove = view.layout?.enableMoving ?? true;
14381 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14382 "th",
14383 {
14384 style: {
14385 width,
14386 maxWidth,
14387 minWidth,
14388 textAlign: effectiveAlign
14389 },
14390 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
14391 scope: "col",
14392 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14393 column_header_menu_default,
14394 {
14395 ref: headerMenuRef(column, index2),
14396 fieldId: column,
14397 view,
14398 fields,
14399 onChangeView,
14400 onHide,
14401 setOpenedFilter,
14402 canMove: canInsertOrMove,
14403 canInsertLeft: canInsertOrMove,
14404 canInsertRight: canInsertOrMove
14405 }
14406 )
14407 },
14408 column
14409 );
14410 }),
14411 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14412 "th",
14413 {
14414 className: clsx_default(
14415 "dataviews-view-table__actions-column",
14416 {
14417 "dataviews-view-table__actions-column--sticky": true,
14418 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
14419 }
14420 ),
14421 children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n11.__)("Actions") })
14422 }
14423 )
14424 ] })
14425 }
14426 ),
14427 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
14428 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("tbody", { children: [
14429 /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14430 "td",
14431 {
14432 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0),
14433 className: "dataviews-view-table__group-header-cell",
14434 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n11.sprintf)(
14435 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
14436 (0, import_i18n11.__)("%1$s: %2$s"),
14437 groupField.label,
14438 groupName
14439 )
14440 }
14441 ) }),
14442 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14443 TableRow,
14444 {
14445 item,
14446 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
14447 hasBulkActions,
14448 actions,
14449 fields,
14450 id: getItemId(item) || index2.toString(),
14451 view,
14452 titleField,
14453 mediaField,
14454 descriptionField,
14455 selection,
14456 getItemId,
14457 onChangeSelection,
14458 onClickItem,
14459 renderItemLink,
14460 isItemClickable,
14461 isActionsColumnSticky: !isHorizontalScrollEnd
14462 },
14463 getItemId(item)
14464 ))
14465 ] }, `group-${groupName}`)
14466 ) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("tbody", { children: hasData && data.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
14467 TableRow,
14468 {
14469 item,
14470 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0,
14471 hasBulkActions,
14472 actions,
14473 fields,
14474 id: getItemId(item) || index2.toString(),
14475 view,
14476 titleField,
14477 mediaField,
14478 descriptionField,
14479 selection,
14480 getItemId,
14481 onChangeSelection,
14482 onClickItem,
14483 renderItemLink,
14484 isItemClickable,
14485 isActionsColumnSticky: !isHorizontalScrollEnd,
14486 posinset: isInfiniteScroll ? index2 + 1 : void 0
14487 },
14488 getItemId(item)
14489 )) })
14490 ]
14491 }
14492 ),
14493 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components6.Spinner, {}) }) })
14494 ] });
14495 }
14496 var table_default = ViewTable;
14497
14498 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs
14499 var import_components9 = __toESM(require_components(), 1);
14500 var import_i18n14 = __toESM(require_i18n(), 1);
14501
14502 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs
14503 var import_components8 = __toESM(require_components(), 1);
14504 var import_i18n13 = __toESM(require_i18n(), 1);
14505 var import_compose3 = __toESM(require_compose(), 1);
14506 var import_keycodes2 = __toESM(require_keycodes(), 1);
14507 var import_element53 = __toESM(require_element(), 1);
14508
14509 // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs
14510 var import_components7 = __toESM(require_components(), 1);
14511 var import_i18n12 = __toESM(require_i18n(), 1);
14512 var import_element50 = __toESM(require_element(), 1);
14513 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
14514 var imageSizes = [
14515 {
14516 value: 120,
14517 breakpoint: 1
14518 },
14519 {
14520 value: 170,
14521 breakpoint: 1
14522 },
14523 {
14524 value: 230,
14525 breakpoint: 1
14526 },
14527 {
14528 value: 290,
14529 breakpoint: 1112
14530 // at minimum image width, 4 images display at this container size
14531 },
14532 {
14533 value: 350,
14534 breakpoint: 1636
14535 // at minimum image width, 6 images display at this container size
14536 },
14537 {
14538 value: 430,
14539 breakpoint: 588
14540 // at minimum image width, 2 images display at this container size
14541 }
14542 ];
14543 var DEFAULT_PREVIEW_SIZE = imageSizes[2].value;
14544 function useGridColumns() {
14545 const context = (0, import_element50.useContext)(dataviews_context_default);
14546 const view = context.view;
14547 return (0, import_element50.useMemo)(() => {
14548 const containerWidth = context.containerWidth;
14549 const gap = 32;
14550 const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE;
14551 const columns = Math.floor(
14552 (containerWidth + gap) / (previewSize + gap)
14553 );
14554 return Math.max(1, columns);
14555 }, [context.containerWidth, view.layout?.previewSize]);
14556 }
14557
14558 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs
14559 var import_element51 = __toESM(require_element(), 1);
14560 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
14561 var GridItems = (0, import_element51.forwardRef)(({ className, previewSize, ...props }, ref) => {
14562 return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
14563 "div",
14564 {
14565 ref,
14566 className: clsx_default("dataviews-view-grid-items", className),
14567 style: {
14568 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax(${previewSize}px, 1fr))`
14569 },
14570 ...props
14571 }
14572 );
14573 });
14574
14575 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-infinite-scroll.mjs
14576 var import_element52 = __toESM(require_element(), 1);
14577 function useIntersectionObserver(elementRef, posinset) {
14578 const { intersectionObserver } = (0, import_element52.useContext)(dataviews_context_default);
14579 (0, import_element52.useEffect)(() => {
14580 const element = elementRef.current;
14581 if (!element || posinset === void 0 || !intersectionObserver) {
14582 return;
14583 }
14584 intersectionObserver.observe(element);
14585 return () => {
14586 intersectionObserver.unobserve(element);
14587 };
14588 }, [elementRef, intersectionObserver, posinset]);
14589 }
14590 function usePlaceholdersNeeded(data, isInfiniteScroll, gridColumns) {
14591 const hasData = !!data?.length;
14592 const firstItemPosition = hasData && isInfiniteScroll ? data[0].position : void 0;
14593 return firstItemPosition && gridColumns ? (firstItemPosition - 1) % gridColumns : 0;
14594 }
14595
14596 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs
14597 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
14598 var { Badge: WCBadge } = unlock2(import_components8.privateApis);
14599 function chunk(array, size4) {
14600 const chunks = [];
14601 for (let i2 = 0, j2 = array.length; i2 < j2; i2 += size4) {
14602 chunks.push(array.slice(i2, i2 + size4));
14603 }
14604 return chunks;
14605 }
14606 var GridItem = (0, import_element53.forwardRef)(
14607 function GridItem2({
14608 view,
14609 selection,
14610 onChangeSelection,
14611 onClickItem,
14612 isItemClickable,
14613 renderItemLink,
14614 getItemId,
14615 item,
14616 actions,
14617 mediaField,
14618 titleField,
14619 descriptionField,
14620 regularFields,
14621 badgeFields,
14622 hasBulkActions,
14623 config,
14624 posinset,
14625 setsize,
14626 ...props
14627 }, forwardedRef) {
14628 const {
14629 showTitle = true,
14630 showMedia = true,
14631 showDescription = true
14632 } = view;
14633 const hasBulkAction = useHasAPossibleBulkAction(actions, item);
14634 const id = getItemId(item);
14635 const elementRef = (0, import_element53.useRef)(null);
14636 const setRefs = (0, import_element53.useCallback)(
14637 (node) => {
14638 elementRef.current = node;
14639 if (typeof forwardedRef === "function") {
14640 forwardedRef(node);
14641 } else if (forwardedRef) {
14642 forwardedRef.current = node;
14643 }
14644 },
14645 [forwardedRef]
14646 );
14647 useIntersectionObserver(elementRef, posinset);
14648 const instanceId = (0, import_compose3.useInstanceId)(GridItem2);
14649 const isSelected2 = selection.includes(id);
14650 const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "dataviews-view-grid__media-placeholder" });
14651 const rendersMediaField = showMedia && mediaField?.render;
14652 const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14653 mediaField.render,
14654 {
14655 item,
14656 field: mediaField,
14657 config
14658 }
14659 ) : mediaPlaceholder;
14660 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(titleField.render, { item, field: titleField }) : null;
14661 let mediaA11yProps;
14662 let titleA11yProps;
14663 if (isItemClickable(item) && onClickItem) {
14664 if (renderedTitleField) {
14665 mediaA11yProps = {
14666 "aria-labelledby": `dataviews-view-grid__title-field-${instanceId}`
14667 };
14668 titleA11yProps = {
14669 id: `dataviews-view-grid__title-field-${instanceId}`
14670 };
14671 } else {
14672 mediaA11yProps = {
14673 "aria-label": (0, import_i18n13.__)("Navigate to item")
14674 };
14675 }
14676 }
14677 return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
14678 Stack,
14679 {
14680 direction: "column",
14681 ...props,
14682 ref: setRefs,
14683 "aria-setsize": setsize,
14684 "aria-posinset": posinset,
14685 className: clsx_default(
14686 props.className,
14687 "dataviews-view-grid__row__gridcell",
14688 "dataviews-view-grid__card",
14689 {
14690 "is-selected": hasBulkAction && isSelected2
14691 }
14692 ),
14693 onClickCapture: (event) => {
14694 props.onClickCapture?.(event);
14695 if ((0, import_keycodes2.isAppleOS)() ? event.metaKey : event.ctrlKey) {
14696 event.stopPropagation();
14697 event.preventDefault();
14698 if (!hasBulkAction) {
14699 return;
14700 }
14701 onChangeSelection(
14702 isSelected2 ? selection.filter(
14703 (itemId) => id !== itemId
14704 ) : [...selection, id]
14705 );
14706 }
14707 },
14708 children: [
14709 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14710 ItemClickWrapper,
14711 {
14712 item,
14713 isItemClickable,
14714 onClickItem,
14715 renderItemLink,
14716 className: clsx_default("dataviews-view-grid__media", {
14717 "dataviews-view-grid__media--placeholder": !rendersMediaField
14718 }),
14719 ...mediaA11yProps,
14720 children: renderedMediaField
14721 }
14722 ),
14723 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14724 DataViewsSelectionCheckbox,
14725 {
14726 item,
14727 selection,
14728 onChangeSelection,
14729 getItemId,
14730 titleField,
14731 disabled: !hasBulkAction
14732 }
14733 ),
14734 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14735 ItemActions,
14736 {
14737 item,
14738 actions,
14739 isCompact: true
14740 }
14741 ) }),
14742 showTitle && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "dataviews-view-grid__title-actions", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14743 ItemClickWrapper,
14744 {
14745 item,
14746 isItemClickable,
14747 onClickItem,
14748 renderItemLink,
14749 className: "dataviews-view-grid__title-field dataviews-title-field",
14750 ...titleA11yProps,
14751 title: titleField?.getValueFormatted({
14752 item,
14753 field: titleField
14754 }) || void 0,
14755 children: renderedTitleField
14756 }
14757 ) }),
14758 /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(Stack, { direction: "column", gap: "xs", children: [
14759 showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14760 descriptionField.render,
14761 {
14762 item,
14763 field: descriptionField
14764 }
14765 ),
14766 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14767 Stack,
14768 {
14769 direction: "row",
14770 className: "dataviews-view-grid__badge-fields",
14771 gap: "sm",
14772 wrap: "wrap",
14773 align: "top",
14774 justify: "flex-start",
14775 children: badgeFields.map((field) => {
14776 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14777 WCBadge,
14778 {
14779 className: "dataviews-view-grid__field-value",
14780 children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14781 field.render,
14782 {
14783 item,
14784 field
14785 }
14786 )
14787 },
14788 field.id
14789 );
14790 })
14791 }
14792 ),
14793 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14794 Stack,
14795 {
14796 direction: "column",
14797 className: "dataviews-view-grid__fields",
14798 gap: "xs",
14799 children: regularFields.map((field) => {
14800 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14801 import_components8.Flex,
14802 {
14803 className: "dataviews-view-grid__field",
14804 gap: 1,
14805 justify: "flex-start",
14806 expanded: true,
14807 style: { height: "auto" },
14808 direction: "row",
14809 children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
14810 /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(tooltip_exports.Root, { children: [
14811 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14812 tooltip_exports.Trigger,
14813 {
14814 render: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components8.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header })
14815 }
14816 ),
14817 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(tooltip_exports.Popup, { children: field.label })
14818 ] }),
14819 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14820 import_components8.FlexItem,
14821 {
14822 className: "dataviews-view-grid__field-value",
14823 style: { maxHeight: "none" },
14824 children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14825 field.render,
14826 {
14827 item,
14828 field
14829 }
14830 )
14831 }
14832 )
14833 ] })
14834 },
14835 field.id
14836 );
14837 })
14838 }
14839 )
14840 ] })
14841 ]
14842 }
14843 );
14844 }
14845 );
14846 function CompositeGrid({
14847 data,
14848 isInfiniteScroll,
14849 className,
14850 inert,
14851 isLoading,
14852 view,
14853 fields,
14854 selection,
14855 onChangeSelection,
14856 onClickItem,
14857 isItemClickable,
14858 renderItemLink,
14859 getItemId,
14860 actions
14861 }) {
14862 const { paginationInfo, resizeObserverRef } = (0, import_element53.useContext)(dataviews_context_default);
14863 const gridColumns = useGridColumns();
14864 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
14865 const titleField = fields.find(
14866 (field) => field.id === view?.titleField
14867 );
14868 const mediaField = fields.find(
14869 (field) => field.id === view?.mediaField
14870 );
14871 const descriptionField = fields.find(
14872 (field) => field.id === view?.descriptionField
14873 );
14874 const otherFields = view.fields ?? [];
14875 const { regularFields, badgeFields } = otherFields.reduce(
14876 (accumulator, fieldId) => {
14877 const field = fields.find((f2) => f2.id === fieldId);
14878 if (!field) {
14879 return accumulator;
14880 }
14881 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
14882 accumulator[key].push(field);
14883 return accumulator;
14884 },
14885 { regularFields: [], badgeFields: [] }
14886 );
14887 const size4 = "900px";
14888 const totalRows = Math.ceil(data.length / gridColumns);
14889 const placeholdersNeeded = usePlaceholdersNeeded(
14890 data,
14891 isInfiniteScroll,
14892 gridColumns
14893 );
14894 return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, {
14895 // Render infinite scroll layout (no rows, feed semantics)
14896 children: [
14897 isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
14898 import_components8.Composite,
14899 {
14900 render: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14901 GridItems,
14902 {
14903 className: clsx_default(
14904 "dataviews-view-grid-infinite-scroll",
14905 className,
14906 {
14907 [`has-${view.layout?.density}-density`]: view.layout?.density && [
14908 "compact",
14909 "comfortable"
14910 ].includes(view.layout.density)
14911 }
14912 ),
14913 previewSize: view.layout?.previewSize,
14914 "aria-busy": isLoading,
14915 ref: resizeObserverRef
14916 }
14917 ),
14918 role: "feed",
14919 focusWrap: true,
14920 inert,
14921 children: [
14922 Array.from({ length: placeholdersNeeded }).map(
14923 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14924 import_components8.Composite.Item,
14925 {
14926 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14927 Stack,
14928 {
14929 ...props,
14930 direction: "column",
14931 role: "article",
14932 className: "dataviews-view-grid__row__gridcell dataviews-view-grid__card dataviews-view-grid__placeholder"
14933 }
14934 ),
14935 "aria-hidden": true,
14936 tabIndex: -1
14937 },
14938 `placeholder-${index2}`
14939 )
14940 ),
14941 data.map((item) => {
14942 const itemId = getItemId(item);
14943 const stablePosition = item.position;
14944 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14945 import_components8.Composite.Item,
14946 {
14947 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14948 GridItem,
14949 {
14950 ...props,
14951 id: itemId,
14952 role: "article",
14953 view,
14954 selection,
14955 onChangeSelection,
14956 onClickItem,
14957 isItemClickable,
14958 renderItemLink,
14959 getItemId,
14960 item,
14961 actions,
14962 mediaField,
14963 titleField,
14964 descriptionField,
14965 regularFields,
14966 badgeFields,
14967 hasBulkActions,
14968 posinset: stablePosition,
14969 setsize: paginationInfo.totalItems,
14970 config: {
14971 sizes: size4
14972 }
14973 }
14974 )
14975 },
14976 itemId
14977 );
14978 })
14979 ]
14980 }
14981 ),
14982 // Render standard grid layout (with rows, grid semantics)
14983 !isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14984 import_components8.Composite,
14985 {
14986 role: "grid",
14987 className: clsx_default("dataviews-view-grid", className, {
14988 [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
14989 view.layout.density
14990 )
14991 }),
14992 focusWrap: true,
14993 "aria-busy": isLoading,
14994 "aria-rowcount": totalRows,
14995 ref: resizeObserverRef,
14996 inert,
14997 children: chunk(data, gridColumns).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
14998 import_components8.Composite.Row,
14999 {
15000 render: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
15001 "div",
15002 {
15003 role: "row",
15004 "aria-rowindex": i2 + 1,
15005 "aria-label": (0, import_i18n13.sprintf)(
15006 /* translators: %d: The row number in the grid */
15007 (0, import_i18n13.__)("Row %d"),
15008 i2 + 1
15009 ),
15010 className: "dataviews-view-grid__row",
15011 style: {
15012 gridTemplateColumns: `repeat( ${gridColumns}, minmax(0, 1fr) )`
15013 }
15014 }
15015 ),
15016 children: row.map((item) => {
15017 const itemId = getItemId(item);
15018 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
15019 import_components8.Composite.Item,
15020 {
15021 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
15022 GridItem,
15023 {
15024 ...props,
15025 id: itemId,
15026 role: "gridcell",
15027 view,
15028 selection,
15029 onChangeSelection,
15030 onClickItem,
15031 isItemClickable,
15032 renderItemLink,
15033 getItemId,
15034 item,
15035 actions,
15036 mediaField,
15037 titleField,
15038 descriptionField,
15039 regularFields,
15040 badgeFields,
15041 hasBulkActions,
15042 config: {
15043 sizes: size4
15044 }
15045 }
15046 )
15047 },
15048 itemId
15049 );
15050 })
15051 },
15052 i2
15053 ))
15054 }
15055 )
15056 ]
15057 });
15058 }
15059
15060 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs
15061 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
15062 function ViewGrid({
15063 actions,
15064 data,
15065 fields,
15066 getItemId,
15067 isLoading,
15068 onChangeSelection,
15069 onClickItem,
15070 isItemClickable,
15071 renderItemLink,
15072 selection,
15073 view,
15074 className,
15075 empty
15076 }) {
15077 const isDelayedLoading = useDelayedLoading(!!isLoading);
15078 const hasData = !!data?.length;
15079 const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
15080 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
15081 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
15082 if (!hasData) {
15083 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
15084 "div",
15085 {
15086 className: clsx_default("dataviews-no-results", {
15087 "is-refreshing": isDelayedLoading
15088 }),
15089 children: empty
15090 }
15091 );
15092 }
15093 const gridProps = {
15094 className: clsx_default(className, {
15095 "is-refreshing": !isInfiniteScroll && isDelayedLoading
15096 }),
15097 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0,
15098 isLoading,
15099 view,
15100 fields,
15101 selection,
15102 onChangeSelection,
15103 onClickItem,
15104 isItemClickable,
15105 renderItemLink,
15106 getItemId,
15107 actions
15108 };
15109 return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, {
15110 // Render multiple groups.
15111 children: [
15112 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map(
15113 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
15114 Stack,
15115 {
15116 direction: "column",
15117 gap: "sm",
15118 children: [
15119 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n14.sprintf)(
15120 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
15121 (0, import_i18n14.__)("%1$s: %2$s"),
15122 groupField.label,
15123 groupName
15124 ) }),
15125 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
15126 CompositeGrid,
15127 {
15128 ...gridProps,
15129 data: groupItems,
15130 isInfiniteScroll: false
15131 }
15132 )
15133 ]
15134 },
15135 groupName
15136 )
15137 ) }),
15138 // Render a single grid with all data.
15139 !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
15140 CompositeGrid,
15141 {
15142 ...gridProps,
15143 data,
15144 isInfiniteScroll: !!isInfiniteScroll
15145 }
15146 ),
15147 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components9.Spinner, {}) })
15148 ]
15149 });
15150 }
15151 var grid_default = ViewGrid;
15152
15153 // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs
15154 var import_compose4 = __toESM(require_compose(), 1);
15155 var import_components10 = __toESM(require_components(), 1);
15156 var import_element54 = __toESM(require_element(), 1);
15157 var import_i18n15 = __toESM(require_i18n(), 1);
15158 var import_data3 = __toESM(require_data(), 1);
15159 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
15160 var { Menu: Menu3 } = unlock2(import_components10.privateApis);
15161 function generateItemWrapperCompositeId(idPrefix) {
15162 return `${idPrefix}-item-wrapper`;
15163 }
15164 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) {
15165 return `${idPrefix}-primary-action-${primaryActionId}`;
15166 }
15167 function generateDropdownTriggerCompositeId(idPrefix) {
15168 return `${idPrefix}-dropdown`;
15169 }
15170 function PrimaryActionGridCell({
15171 idPrefix,
15172 primaryAction,
15173 item
15174 }) {
15175 const registry = (0, import_data3.useRegistry)();
15176 const [isModalOpen, setIsModalOpen] = (0, import_element54.useState)(false);
15177 const compositeItemId = generatePrimaryActionCompositeId(
15178 idPrefix,
15179 primaryAction.id
15180 );
15181 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]);
15182 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15183 import_components10.Composite.Item,
15184 {
15185 id: compositeItemId,
15186 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15187 import_components10.Button,
15188 {
15189 disabled: !!primaryAction.disabled,
15190 accessibleWhenDisabled: true,
15191 text: label,
15192 size: "small",
15193 onClick: () => setIsModalOpen(true)
15194 }
15195 ),
15196 children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15197 ActionModal,
15198 {
15199 action: primaryAction,
15200 items: [item],
15201 closeModal: () => setIsModalOpen(false)
15202 }
15203 )
15204 }
15205 ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15206 import_components10.Composite.Item,
15207 {
15208 id: compositeItemId,
15209 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15210 import_components10.Button,
15211 {
15212 disabled: !!primaryAction.disabled,
15213 accessibleWhenDisabled: true,
15214 size: "small",
15215 onClick: () => {
15216 primaryAction.callback([item], { registry });
15217 },
15218 children: label
15219 }
15220 )
15221 }
15222 ) }, primaryAction.id);
15223 }
15224 function ListItem({
15225 view,
15226 actions,
15227 idPrefix,
15228 isSelected: isSelected2,
15229 item,
15230 titleField,
15231 mediaField,
15232 descriptionField,
15233 onSelect,
15234 otherFields,
15235 onDropdownTriggerKeyDown,
15236 posinset
15237 }) {
15238 const {
15239 showTitle = true,
15240 showMedia = true,
15241 showDescription = true,
15242 infiniteScrollEnabled
15243 } = view;
15244 const itemRef = (0, import_element54.useRef)(null);
15245 const labelId = `${idPrefix}-label`;
15246 const descriptionId = `${idPrefix}-description`;
15247 const registry = (0, import_data3.useRegistry)();
15248 const [isHovered, setIsHovered] = (0, import_element54.useState)(false);
15249 const [activeModalAction, setActiveModalAction] = (0, import_element54.useState)(
15250 null
15251 );
15252 const handleHover = ({ type }) => {
15253 const isHover = type === "mouseenter";
15254 setIsHovered(isHover);
15255 };
15256 const { paginationInfo } = (0, import_element54.useContext)(dataviews_context_default);
15257 (0, import_element54.useEffect)(() => {
15258 if (isSelected2) {
15259 itemRef.current?.scrollIntoView({
15260 behavior: "auto",
15261 block: "nearest",
15262 inline: "nearest"
15263 });
15264 }
15265 }, [isSelected2]);
15266 const { primaryAction, eligibleActions } = (0, import_element54.useMemo)(() => {
15267 const _eligibleActions = actions.filter(
15268 (action) => !action.isEligible || action.isEligible(item)
15269 );
15270 const _primaryActions = _eligibleActions.filter(
15271 (action) => action.isPrimary
15272 );
15273 return {
15274 primaryAction: _primaryActions[0],
15275 eligibleActions: _eligibleActions
15276 };
15277 }, [actions, item]);
15278 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1;
15279 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15280 mediaField.render,
15281 {
15282 item,
15283 field: mediaField,
15284 config: { sizes: "52px" }
15285 }
15286 ) }) : null;
15287 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(titleField.render, { item, field: titleField }) : null;
15288 const renderDescription = showDescription && descriptionField?.render;
15289 const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length;
15290 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
15291 Stack,
15292 {
15293 direction: "row",
15294 gap: "md",
15295 className: "dataviews-view-list__item-actions",
15296 children: [
15297 primaryAction && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15298 PrimaryActionGridCell,
15299 {
15300 idPrefix,
15301 primaryAction,
15302 item
15303 }
15304 ),
15305 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { role: "gridcell", children: [
15306 /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Menu3, { placement: "bottom-end", children: [
15307 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15308 Menu3.TriggerButton,
15309 {
15310 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15311 import_components10.Composite.Item,
15312 {
15313 id: generateDropdownTriggerCompositeId(
15314 idPrefix
15315 ),
15316 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15317 import_components10.Button,
15318 {
15319 size: "small",
15320 icon: more_vertical_default,
15321 label: (0, import_i18n15.__)("Actions"),
15322 accessibleWhenDisabled: true,
15323 disabled: !actions.length,
15324 onKeyDown: onDropdownTriggerKeyDown
15325 }
15326 )
15327 }
15328 )
15329 }
15330 ),
15331 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Menu3.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15332 ActionsMenuGroup,
15333 {
15334 actions: eligibleActions,
15335 item,
15336 registry,
15337 setActiveModalAction
15338 }
15339 ) })
15340 ] }),
15341 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15342 ActionModal,
15343 {
15344 action: activeModalAction,
15345 items: [item],
15346 closeModal: () => setActiveModalAction(null)
15347 }
15348 )
15349 ] })
15350 ]
15351 }
15352 );
15353 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15354 import_components10.Composite.Row,
15355 {
15356 ref: itemRef,
15357 render: (
15358 /* aria-posinset breaks Composite.Row if passed to it directly. */
15359 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15360 "div",
15361 {
15362 "aria-posinset": posinset,
15363 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0
15364 }
15365 )
15366 ),
15367 role: infiniteScrollEnabled ? "article" : "row",
15368 className: clsx_default({
15369 "is-selected": isSelected2,
15370 "is-hovered": isHovered
15371 }),
15372 onMouseEnter: handleHover,
15373 onMouseLeave: handleHover,
15374 children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
15375 Stack,
15376 {
15377 direction: "row",
15378 className: "dataviews-view-list__item-wrapper",
15379 children: [
15380 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15381 import_components10.Composite.Item,
15382 {
15383 id: generateItemWrapperCompositeId(idPrefix),
15384 "aria-pressed": isSelected2,
15385 "aria-labelledby": labelId,
15386 "aria-describedby": descriptionId,
15387 className: "dataviews-view-list__item",
15388 onClick: () => onSelect(item)
15389 }
15390 ) }),
15391 /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
15392 Stack,
15393 {
15394 direction: "row",
15395 gap: "md",
15396 justify: "start",
15397 align: hasOnlyMediaAndTitle ? "center" : "flex-start",
15398 style: { flex: 1, minWidth: 0 },
15399 children: [
15400 renderedMediaField,
15401 /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
15402 Stack,
15403 {
15404 direction: "column",
15405 gap: "xs",
15406 className: "dataviews-view-list__field-wrapper",
15407 children: [
15408 /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Stack, { direction: "row", align: "center", children: [
15409 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15410 "div",
15411 {
15412 className: "dataviews-title-field dataviews-view-list__title-field",
15413 id: labelId,
15414 children: renderedTitleField
15415 }
15416 ),
15417 usedActions
15418 ] }),
15419 renderDescription && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15420 descriptionField.render,
15421 {
15422 item,
15423 field: descriptionField
15424 }
15425 ) }),
15426 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15427 "div",
15428 {
15429 className: "dataviews-view-list__fields",
15430 id: descriptionId,
15431 children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
15432 "div",
15433 {
15434 className: "dataviews-view-list__field",
15435 children: [
15436 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15437 VisuallyHidden,
15438 {
15439 className: "dataviews-view-list__field-label",
15440 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", {}),
15441 children: field.label
15442 }
15443 ),
15444 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15445 field.render,
15446 {
15447 item,
15448 field
15449 }
15450 ) })
15451 ]
15452 },
15453 field.id
15454 ))
15455 }
15456 )
15457 ]
15458 }
15459 )
15460 ]
15461 }
15462 )
15463 ]
15464 }
15465 )
15466 }
15467 );
15468 }
15469 function isDefined2(item) {
15470 return !!item;
15471 }
15472 function ViewList(props) {
15473 const {
15474 actions,
15475 data,
15476 fields,
15477 getItemId,
15478 isLoading,
15479 onChangeSelection,
15480 selection,
15481 view,
15482 className,
15483 empty
15484 } = props;
15485 const baseId = (0, import_compose4.useInstanceId)(ViewList, "view-list");
15486 const isDelayedLoading = useDelayedLoading(!!isLoading);
15487 const selectedItem = data?.findLast(
15488 (item) => selection.includes(getItemId(item))
15489 );
15490 const titleField = fields.find((field) => field.id === view.titleField);
15491 const mediaField = fields.find((field) => field.id === view.mediaField);
15492 const descriptionField = fields.find(
15493 (field) => field.id === view.descriptionField
15494 );
15495 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined2);
15496 const onSelect = (item) => onChangeSelection([getItemId(item)]);
15497 const generateCompositeItemIdPrefix = (0, import_element54.useCallback)(
15498 (item) => `${baseId}-${getItemId(item)}`,
15499 [baseId, getItemId]
15500 );
15501 const isActiveCompositeItem = (0, import_element54.useCallback)(
15502 (item, idToCheck) => {
15503 return idToCheck.startsWith(
15504 generateCompositeItemIdPrefix(item)
15505 );
15506 },
15507 [generateCompositeItemIdPrefix]
15508 );
15509 const [activeCompositeId, setActiveCompositeId] = (0, import_element54.useState)(void 0);
15510 const compositeRef = (0, import_element54.useRef)(null);
15511 (0, import_element54.useEffect)(() => {
15512 if (selectedItem) {
15513 setActiveCompositeId(
15514 generateItemWrapperCompositeId(
15515 generateCompositeItemIdPrefix(selectedItem)
15516 )
15517 );
15518 }
15519 }, [selectedItem, generateCompositeItemIdPrefix]);
15520 const activeItemIndex = data.findIndex(
15521 (item) => isActiveCompositeItem(item, activeCompositeId ?? "")
15522 );
15523 const previousActiveItemIndex = (0, import_compose4.usePrevious)(activeItemIndex);
15524 const isActiveIdInList = activeItemIndex !== -1;
15525 const selectCompositeItem = (0, import_element54.useCallback)(
15526 (targetIndex, generateCompositeId) => {
15527 const clampedIndex = Math.min(
15528 data.length - 1,
15529 Math.max(0, targetIndex)
15530 );
15531 if (!data[clampedIndex]) {
15532 return;
15533 }
15534 const itemIdPrefix = generateCompositeItemIdPrefix(
15535 data[clampedIndex]
15536 );
15537 const targetCompositeItemId = generateCompositeId(itemIdPrefix);
15538 setActiveCompositeId(targetCompositeItemId);
15539 if (compositeRef.current?.contains(
15540 compositeRef.current.ownerDocument.activeElement
15541 )) {
15542 document.getElementById(targetCompositeItemId)?.focus();
15543 }
15544 },
15545 [data, generateCompositeItemIdPrefix]
15546 );
15547 (0, import_element54.useEffect)(() => {
15548 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1;
15549 if (!isActiveIdInList && wasActiveIdInList) {
15550 selectCompositeItem(
15551 previousActiveItemIndex,
15552 generateItemWrapperCompositeId
15553 );
15554 }
15555 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]);
15556 const onDropdownTriggerKeyDown = (0, import_element54.useCallback)(
15557 (event) => {
15558 if (event.key === "ArrowDown") {
15559 event.preventDefault();
15560 selectCompositeItem(
15561 activeItemIndex + 1,
15562 generateDropdownTriggerCompositeId
15563 );
15564 }
15565 if (event.key === "ArrowUp") {
15566 event.preventDefault();
15567 selectCompositeItem(
15568 activeItemIndex - 1,
15569 generateDropdownTriggerCompositeId
15570 );
15571 }
15572 },
15573 [selectCompositeItem, activeItemIndex]
15574 );
15575 const hasData = !!data?.length;
15576 const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
15577 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null;
15578 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
15579 if (!hasData) {
15580 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15581 "div",
15582 {
15583 className: clsx_default("dataviews-no-results", {
15584 "is-refreshing": isDelayedLoading
15585 }),
15586 children: empty
15587 }
15588 );
15589 }
15590 if (hasData && groupField && dataByGroup) {
15591 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15592 import_components10.Composite,
15593 {
15594 ref: compositeRef,
15595 id: `${baseId}`,
15596 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", {}),
15597 className: "dataviews-view-list__group",
15598 role: "grid",
15599 activeId: activeCompositeId,
15600 setActiveId: setActiveCompositeId,
15601 children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15602 Stack,
15603 {
15604 direction: "column",
15605 gap: "lg",
15606 className: clsx_default("dataviews-view-list", className),
15607 children: Array.from(dataByGroup.entries()).map(
15608 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
15609 Stack,
15610 {
15611 direction: "column",
15612 gap: "sm",
15613 children: [
15614 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n15.sprintf)(
15615 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
15616 (0, import_i18n15.__)("%1$s: %2$s"),
15617 groupField.label,
15618 groupName
15619 ) }),
15620 groupItems.map((item) => {
15621 const id = generateCompositeItemIdPrefix(item);
15622 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15623 ListItem,
15624 {
15625 view,
15626 idPrefix: id,
15627 actions,
15628 item,
15629 isSelected: item === selectedItem,
15630 onSelect,
15631 mediaField,
15632 titleField,
15633 descriptionField,
15634 otherFields,
15635 onDropdownTriggerKeyDown
15636 },
15637 id
15638 );
15639 })
15640 ]
15641 },
15642 groupName
15643 )
15644 )
15645 }
15646 )
15647 }
15648 );
15649 }
15650 return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
15651 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15652 import_components10.Composite,
15653 {
15654 ref: compositeRef,
15655 id: baseId,
15656 render: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", {}),
15657 className: clsx_default("dataviews-view-list", className, {
15658 [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
15659 view.layout.density
15660 ),
15661 "is-refreshing": !isInfiniteScroll && isDelayedLoading
15662 }),
15663 role: view.infiniteScrollEnabled ? "feed" : "grid",
15664 activeId: activeCompositeId,
15665 setActiveId: setActiveCompositeId,
15666 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0,
15667 children: data.map((item, index2) => {
15668 const id = generateCompositeItemIdPrefix(item);
15669 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
15670 ListItem,
15671 {
15672 view,
15673 idPrefix: id,
15674 actions,
15675 item,
15676 isSelected: item === selectedItem,
15677 onSelect,
15678 mediaField,
15679 titleField,
15680 descriptionField,
15681 otherFields,
15682 onDropdownTriggerKeyDown,
15683 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0
15684 },
15685 id
15686 );
15687 })
15688 }
15689 ),
15690 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components10.Spinner, {}) })
15691 ] });
15692 }
15693
15694 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs
15695 var import_components11 = __toESM(require_components(), 1);
15696
15697 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs
15698 var import_i18n16 = __toESM(require_i18n(), 1);
15699 var import_element55 = __toESM(require_element(), 1);
15700 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
15701 function ActivityGroup({
15702 groupName,
15703 groupData,
15704 groupField,
15705 showLabel = true,
15706 children
15707 }) {
15708 const groupHeader = showLabel ? (0, import_element55.createInterpolateElement)(
15709 // translators: %s: The label of the field e.g. "Status".
15710 (0, import_i18n16.sprintf)((0, import_i18n16.__)("%s: <groupName />"), groupField.label).trim(),
15711 {
15712 groupName: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
15713 groupField.render,
15714 {
15715 item: groupData[0],
15716 field: groupField
15717 }
15718 )
15719 }
15720 ) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(groupField.render, { item: groupData[0], field: groupField });
15721 return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
15722 Stack,
15723 {
15724 direction: "column",
15725 className: "dataviews-view-activity__group",
15726 children: [
15727 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }),
15728 children
15729 ]
15730 },
15731 groupName
15732 );
15733 }
15734
15735 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs
15736 var import_element56 = __toESM(require_element(), 1);
15737 var import_data4 = __toESM(require_data(), 1);
15738 var import_compose5 = __toESM(require_compose(), 1);
15739 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
15740 function ActivityItem(props) {
15741 const {
15742 view,
15743 actions,
15744 item,
15745 titleField,
15746 mediaField,
15747 descriptionField,
15748 otherFields,
15749 posinset,
15750 onClickItem,
15751 renderItemLink,
15752 isItemClickable
15753 } = props;
15754 const {
15755 showTitle = true,
15756 showMedia = true,
15757 showDescription = true,
15758 infiniteScrollEnabled
15759 } = view;
15760 const itemRef = (0, import_element56.useRef)(null);
15761 const registry = (0, import_data4.useRegistry)();
15762 const { paginationInfo } = (0, import_element56.useContext)(dataviews_context_default);
15763 const { primaryActions, eligibleActions } = (0, import_element56.useMemo)(() => {
15764 const _eligibleActions = actions.filter(
15765 (action) => !action.isEligible || action.isEligible(item)
15766 );
15767 const _primaryActions = _eligibleActions.filter(
15768 (action) => action.isPrimary
15769 );
15770 return {
15771 primaryActions: _primaryActions,
15772 eligibleActions: _eligibleActions
15773 };
15774 }, [actions, item]);
15775 const isMobileViewport = (0, import_compose5.useViewportMatch)("medium", "<");
15776 const density = view.layout?.density ?? "balanced";
15777 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15778 mediaField.render,
15779 {
15780 item,
15781 field: mediaField,
15782 config: {
15783 sizes: density === "comfortable" ? "32px" : "24px"
15784 }
15785 }
15786 ) : null;
15787 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15788 "span",
15789 {
15790 className: "dataviews-view-activity__item-bullet",
15791 "aria-hidden": "true"
15792 }
15793 ) });
15794 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(titleField.render, { item, field: titleField }) : null;
15795 const verticalGap = (0, import_element56.useMemo)(() => {
15796 switch (density) {
15797 case "comfortable":
15798 return "md";
15799 default:
15800 return "sm";
15801 }
15802 }, [density]);
15803 return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15804 "div",
15805 {
15806 ref: itemRef,
15807 role: infiniteScrollEnabled ? "article" : void 0,
15808 "aria-posinset": posinset,
15809 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
15810 className: clsx_default(
15811 "dataviews-view-activity__item",
15812 density === "compact" && "is-compact",
15813 density === "balanced" && "is-balanced",
15814 density === "comfortable" && "is-comfortable"
15815 ),
15816 children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [
15817 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15818 Stack,
15819 {
15820 direction: "column",
15821 gap: "xs",
15822 align: "center",
15823 className: "dataviews-view-activity__item-type",
15824 children: renderedMediaField
15825 }
15826 ),
15827 /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
15828 Stack,
15829 {
15830 direction: "column",
15831 gap: verticalGap,
15832 align: "flex-start",
15833 className: "dataviews-view-activity__item-content",
15834 children: [
15835 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15836 ItemClickWrapper,
15837 {
15838 item,
15839 isItemClickable,
15840 onClickItem,
15841 renderItemLink,
15842 className: "dataviews-view-activity__item-title",
15843 children: renderedTitleField
15844 }
15845 ),
15846 showDescription && descriptionField && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15847 descriptionField.render,
15848 {
15849 item,
15850 field: descriptionField
15851 }
15852 ) }),
15853 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
15854 "div",
15855 {
15856 className: "dataviews-view-activity__item-field",
15857 children: [
15858 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15859 VisuallyHidden,
15860 {
15861 className: "dataviews-view-activity__item-field-label",
15862 render: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", {}),
15863 children: field.label
15864 }
15865 ),
15866 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15867 field.render,
15868 {
15869 item,
15870 field
15871 }
15872 ) })
15873 ]
15874 },
15875 field.id
15876 )) }),
15877 !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15878 PrimaryActions,
15879 {
15880 item,
15881 actions: primaryActions,
15882 registry,
15883 buttonVariant: "secondary"
15884 }
15885 )
15886 ]
15887 }
15888 ),
15889 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu
15890 // there if there are any actions at all.
15891 isMobileViewport && // At the same time, only show the menu if there are actions to show.
15892 eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
15893 ItemActions,
15894 {
15895 item,
15896 actions: eligibleActions,
15897 isCompact: true
15898 }
15899 ) })
15900 ] })
15901 }
15902 );
15903 }
15904 var activity_item_default = ActivityItem;
15905
15906 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs
15907 var import_react15 = __toESM(require_react(), 1);
15908 function isDefined3(item) {
15909 return !!item;
15910 }
15911 function ActivityItems(props) {
15912 const { data, fields, getItemId, view } = props;
15913 const titleField = fields.find((field) => field.id === view.titleField);
15914 const mediaField = fields.find((field) => field.id === view.mediaField);
15915 const descriptionField = fields.find(
15916 (field) => field.id === view.descriptionField
15917 );
15918 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined3);
15919 return data.map((item, index2) => {
15920 return /* @__PURE__ */ (0, import_react15.createElement)(
15921 activity_item_default,
15922 {
15923 ...props,
15924 key: getItemId(item),
15925 item,
15926 mediaField,
15927 titleField,
15928 descriptionField,
15929 otherFields,
15930 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0
15931 }
15932 );
15933 });
15934 }
15935
15936 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs
15937 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
15938 function ViewActivity(props) {
15939 const { empty, data, fields, isLoading, view, className } = props;
15940 const isDelayedLoading = useDelayedLoading(!!isLoading);
15941 const hasData = !!data?.length;
15942 const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
15943 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null;
15944 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
15945 if (!hasData) {
15946 return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
15947 "div",
15948 {
15949 className: clsx_default("dataviews-no-results", {
15950 "is-refreshing": isDelayedLoading
15951 }),
15952 children: empty
15953 }
15954 );
15955 }
15956 const isInert = !isInfiniteScroll && !!isLoading;
15957 const wrapperClassName = clsx_default("dataviews-view-activity", className, {
15958 "is-refreshing": !isInfiniteScroll && isDelayedLoading
15959 });
15960 const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : [];
15961 if (hasData && groupField && dataByGroup) {
15962 return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
15963 Stack,
15964 {
15965 direction: "column",
15966 gap: "sm",
15967 className: wrapperClassName,
15968 inert: isInert ? "true" : void 0,
15969 children: groupedEntries.map(
15970 ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
15971 ActivityGroup,
15972 {
15973 groupName,
15974 groupData,
15975 groupField,
15976 showLabel: view.groupBy?.showLabel !== false,
15977 children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
15978 ActivityItems,
15979 {
15980 ...props,
15981 data: groupData
15982 }
15983 )
15984 },
15985 groupName
15986 )
15987 )
15988 }
15989 );
15990 }
15991 return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
15992 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
15993 "div",
15994 {
15995 className: wrapperClassName,
15996 role: view.infiniteScrollEnabled ? "feed" : void 0,
15997 inert: isInert ? "true" : void 0,
15998 children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ActivityItems, { ...props })
15999 }
16000 ),
16001 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components11.Spinner, {}) })
16002 ] });
16003 }
16004
16005 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs
16006 var import_components14 = __toESM(require_components(), 1);
16007 var import_i18n19 = __toESM(require_i18n(), 1);
16008 var import_compose6 = __toESM(require_compose(), 1);
16009 var import_element59 = __toESM(require_element(), 1);
16010
16011 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs
16012 var import_components13 = __toESM(require_components(), 1);
16013 var import_data5 = __toESM(require_data(), 1);
16014 var import_element58 = __toESM(require_element(), 1);
16015 var import_i18n18 = __toESM(require_i18n(), 1);
16016
16017 // packages/dataviews/build-module/components/dataviews-pagination/index.mjs
16018 var import_components12 = __toESM(require_components(), 1);
16019 var import_element57 = __toESM(require_element(), 1);
16020 var import_i18n17 = __toESM(require_i18n(), 1);
16021 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
16022 function DataViewsPagination() {
16023 const {
16024 view,
16025 onChangeView,
16026 paginationInfo: { totalItems = 0, totalPages }
16027 } = (0, import_element57.useContext)(dataviews_context_default);
16028 if (!totalItems || !totalPages || view.infiniteScrollEnabled) {
16029 return null;
16030 }
16031 const currentPage = view.page ?? 1;
16032 const pageSelectOptions = Array.from(Array(totalPages)).map(
16033 (_, i2) => {
16034 const page = i2 + 1;
16035 return {
16036 value: page.toString(),
16037 label: page.toString(),
16038 "aria-label": currentPage === page ? (0, import_i18n17.sprintf)(
16039 // translators: 1: current page number. 2: total number of pages.
16040 (0, import_i18n17.__)("Page %1$d of %2$d"),
16041 currentPage,
16042 totalPages
16043 ) : page.toString()
16044 };
16045 }
16046 );
16047 return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
16048 Stack,
16049 {
16050 direction: "row",
16051 className: "dataviews-pagination",
16052 justify: "end",
16053 align: "center",
16054 gap: "xl",
16055 children: [
16056 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
16057 Stack,
16058 {
16059 direction: "row",
16060 justify: "flex-start",
16061 align: "center",
16062 gap: "xs",
16063 className: "dataviews-pagination__page-select",
16064 children: (0, import_element57.createInterpolateElement)(
16065 (0, import_i18n17.sprintf)(
16066 // translators: 1: Current page number, 2: Total number of pages.
16067 (0, import_i18n17._x)(
16068 "<div>Page</div>%1$s<div>of %2$d</div>",
16069 "paging"
16070 ),
16071 "<CurrentPage />",
16072 totalPages
16073 ),
16074 {
16075 div: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { "aria-hidden": true }),
16076 // @ts-expect-error — Tag injected via sprintf argument, not visible in format string.
16077 CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
16078 import_components12.SelectControl,
16079 {
16080 "aria-label": (0, import_i18n17.__)("Current page"),
16081 value: currentPage.toString(),
16082 options: pageSelectOptions,
16083 onChange: (newValue) => {
16084 onChangeView({
16085 ...view,
16086 page: +newValue
16087 });
16088 },
16089 size: "small",
16090 variant: "minimal"
16091 }
16092 )
16093 }
16094 )
16095 }
16096 ),
16097 /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Stack, { direction: "row", gap: "xs", align: "center", children: [
16098 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
16099 import_components12.Button,
16100 {
16101 onClick: () => onChangeView({
16102 ...view,
16103 page: currentPage - 1
16104 }),
16105 disabled: currentPage === 1,
16106 accessibleWhenDisabled: true,
16107 label: (0, import_i18n17.__)("Previous page"),
16108 icon: (0, import_i18n17.isRTL)() ? next_default : previous_default,
16109 showTooltip: true,
16110 size: "compact",
16111 tooltipPosition: "top"
16112 }
16113 ),
16114 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
16115 import_components12.Button,
16116 {
16117 onClick: () => onChangeView({ ...view, page: currentPage + 1 }),
16118 disabled: currentPage >= totalPages,
16119 accessibleWhenDisabled: true,
16120 label: (0, import_i18n17.__)("Next page"),
16121 icon: (0, import_i18n17.isRTL)() ? previous_default : next_default,
16122 showTooltip: true,
16123 size: "compact",
16124 tooltipPosition: "top"
16125 }
16126 )
16127 ] })
16128 ]
16129 }
16130 );
16131 }
16132 var dataviews_pagination_default = (0, import_element57.memo)(DataViewsPagination);
16133
16134 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs
16135 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
16136 function useIsMultiselectPicker(actions) {
16137 return (0, import_element58.useMemo)(() => {
16138 return actions?.every((action) => action.supportsBulk);
16139 }, [actions]);
16140 }
16141
16142 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs
16143 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
16144 var { Badge: WCBadge2 } = unlock2(import_components14.privateApis);
16145 function GridItem3({
16146 view,
16147 multiselect,
16148 selection,
16149 onChangeSelection,
16150 getItemId,
16151 item,
16152 mediaField,
16153 titleField,
16154 descriptionField,
16155 regularFields,
16156 badgeFields,
16157 config,
16158 posinset,
16159 setsize
16160 }) {
16161 const { showTitle = true, showMedia = true, showDescription = true } = view;
16162 const id = getItemId(item);
16163 const elementRef = (0, import_element59.useRef)(null);
16164 const isSelected2 = selection.includes(id);
16165 useIntersectionObserver(elementRef, posinset);
16166 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16167 mediaField.render,
16168 {
16169 item,
16170 field: mediaField,
16171 config
16172 }
16173 ) : null;
16174 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(titleField.render, { item, field: titleField }) : null;
16175 return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
16176 import_components14.Composite.Item,
16177 {
16178 ref: elementRef,
16179 "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n19.__)("(no title)") : void 0,
16180 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Stack, { direction: "column", children, ...props }),
16181 role: "option",
16182 "aria-posinset": posinset,
16183 "aria-setsize": setsize,
16184 className: clsx_default("dataviews-view-picker-grid__card", {
16185 "is-selected": isSelected2
16186 }),
16187 "aria-selected": isSelected2,
16188 onClick: () => {
16189 if (isSelected2) {
16190 onChangeSelection(
16191 selection.filter((itemId) => id !== itemId)
16192 );
16193 } else {
16194 const newSelection = multiselect ? [...selection, id] : [id];
16195 onChangeSelection(newSelection);
16196 }
16197 },
16198 children: [
16199 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }),
16200 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16201 DataViewsSelectionCheckbox,
16202 {
16203 item,
16204 selection,
16205 onChangeSelection,
16206 getItemId,
16207 titleField,
16208 disabled: false,
16209 "aria-hidden": true,
16210 tabIndex: -1
16211 }
16212 ),
16213 showTitle && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16214 Stack,
16215 {
16216 direction: "row",
16217 justify: "space-between",
16218 className: "dataviews-view-picker-grid__title-actions",
16219 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField })
16220 }
16221 ),
16222 /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Stack, { direction: "column", gap: "xs", children: [
16223 showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16224 descriptionField.render,
16225 {
16226 item,
16227 field: descriptionField
16228 }
16229 ),
16230 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16231 Stack,
16232 {
16233 direction: "row",
16234 className: "dataviews-view-picker-grid__badge-fields",
16235 gap: "sm",
16236 wrap: "wrap",
16237 align: "top",
16238 justify: "flex-start",
16239 children: badgeFields.map((field) => {
16240 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16241 WCBadge2,
16242 {
16243 className: "dataviews-view-picker-grid__field-value",
16244 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16245 field.render,
16246 {
16247 item,
16248 field
16249 }
16250 )
16251 },
16252 field.id
16253 );
16254 })
16255 }
16256 ),
16257 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16258 Stack,
16259 {
16260 direction: "column",
16261 className: "dataviews-view-picker-grid__fields",
16262 gap: "xs",
16263 children: regularFields.map((field) => {
16264 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16265 import_components14.Flex,
16266 {
16267 className: "dataviews-view-picker-grid__field",
16268 gap: 1,
16269 justify: "flex-start",
16270 expanded: true,
16271 style: { height: "auto" },
16272 direction: "row",
16273 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
16274 /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components14.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }),
16275 /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16276 import_components14.FlexItem,
16277 {
16278 className: "dataviews-view-picker-grid__field-value",
16279 style: { maxHeight: "none" },
16280 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16281 field.render,
16282 {
16283 item,
16284 field
16285 }
16286 )
16287 }
16288 )
16289 ] })
16290 },
16291 field.id
16292 );
16293 })
16294 }
16295 )
16296 ] })
16297 ]
16298 },
16299 id
16300 );
16301 }
16302 function GridGroup({
16303 groupName,
16304 groupField,
16305 showLabel = true,
16306 children
16307 }) {
16308 const headerId = (0, import_compose6.useInstanceId)(
16309 GridGroup,
16310 "dataviews-view-picker-grid-group__header"
16311 );
16312 return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
16313 Stack,
16314 {
16315 direction: "column",
16316 gap: "sm",
16317 role: "group",
16318 "aria-labelledby": headerId,
16319 children: [
16320 /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16321 "h3",
16322 {
16323 className: "dataviews-view-picker-grid-group__header",
16324 id: headerId,
16325 children: showLabel ? (0, import_i18n19.sprintf)(
16326 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
16327 (0, import_i18n19.__)("%1$s: %2$s"),
16328 groupField.label,
16329 groupName
16330 ) : groupName
16331 }
16332 ),
16333 children
16334 ]
16335 },
16336 groupName
16337 );
16338 }
16339 function ViewPickerGrid({
16340 actions,
16341 data,
16342 fields,
16343 getItemId,
16344 isLoading,
16345 onChangeSelection,
16346 selection,
16347 view,
16348 className,
16349 empty
16350 }) {
16351 const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element59.useContext)(dataviews_context_default);
16352 const titleField = fields.find(
16353 (field) => field.id === view?.titleField
16354 );
16355 const mediaField = fields.find(
16356 (field) => field.id === view?.mediaField
16357 );
16358 const descriptionField = fields.find(
16359 (field) => field.id === view?.descriptionField
16360 );
16361 const otherFields = view.fields ?? [];
16362 const { regularFields, badgeFields } = otherFields.reduce(
16363 (accumulator, fieldId) => {
16364 const field = fields.find((f2) => f2.id === fieldId);
16365 if (!field) {
16366 return accumulator;
16367 }
16368 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
16369 accumulator[key].push(field);
16370 return accumulator;
16371 },
16372 { regularFields: [], badgeFields: [] }
16373 );
16374 const hasData = !!data?.length;
16375 const usedPreviewSize = view.layout?.previewSize;
16376 const isMultiselect = useIsMultiselectPicker(actions);
16377 const size4 = "900px";
16378 const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
16379 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
16380 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false;
16381 const currentPage = view?.page ?? 1;
16382 const perPage = view?.perPage ?? 0;
16383 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
16384 const gridColumns = useGridColumns();
16385 const placeholdersNeeded = usePlaceholdersNeeded(
16386 data,
16387 isInfiniteScroll,
16388 gridColumns
16389 );
16390 return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, {
16391 // Render multiple groups.
16392 children: [
16393 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16394 import_components14.Composite,
16395 {
16396 virtualFocus: true,
16397 orientation: "horizontal",
16398 role: "listbox",
16399 "aria-multiselectable": isMultiselect,
16400 className: clsx_default(
16401 "dataviews-view-picker-grid",
16402 className,
16403 {
16404 [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
16405 view.layout.density
16406 )
16407 }
16408 ),
16409 "aria-label": itemListLabel,
16410 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16411 Stack,
16412 {
16413 direction: "column",
16414 gap: "lg",
16415 children,
16416 ...props
16417 }
16418 ),
16419 children: Array.from(dataByGroup.entries()).map(
16420 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16421 GridGroup,
16422 {
16423 groupName,
16424 groupField,
16425 showLabel: view.groupBy?.showLabel !== false,
16426 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16427 GridItems,
16428 {
16429 previewSize: usedPreviewSize,
16430 style: {
16431 gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax(${usedPreviewSize}px, 1fr))`
16432 },
16433 "aria-busy": isLoading,
16434 ref: resizeObserverRef,
16435 children: groupItems.map((item) => {
16436 const posInSet = item.position ?? (currentPage - 1) * perPage + data.indexOf(item) + 1;
16437 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16438 GridItem3,
16439 {
16440 view,
16441 multiselect: isMultiselect,
16442 selection,
16443 onChangeSelection,
16444 getItemId,
16445 item,
16446 mediaField,
16447 titleField,
16448 descriptionField,
16449 regularFields,
16450 badgeFields,
16451 config: {
16452 sizes: size4
16453 },
16454 posinset: posInSet,
16455 setsize: setSize
16456 },
16457 getItemId(item)
16458 );
16459 })
16460 }
16461 )
16462 },
16463 groupName
16464 )
16465 )
16466 }
16467 ),
16468 // Render a single grid with all data.
16469 hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
16470 import_components14.Composite,
16471 {
16472 render: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16473 GridItems,
16474 {
16475 className: clsx_default(
16476 "dataviews-view-picker-grid",
16477 className,
16478 {
16479 [`has-${view.layout?.density}-density`]: view.layout?.density && [
16480 "compact",
16481 "comfortable"
16482 ].includes(view.layout.density)
16483 }
16484 ),
16485 previewSize: usedPreviewSize,
16486 "aria-busy": isLoading,
16487 ref: resizeObserverRef
16488 }
16489 ),
16490 virtualFocus: true,
16491 orientation: "horizontal",
16492 role: "listbox",
16493 "aria-multiselectable": isMultiselect,
16494 "aria-label": itemListLabel,
16495 children: [
16496 Array.from({ length: placeholdersNeeded }).map(
16497 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16498 import_components14.Composite.Item,
16499 {
16500 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16501 Stack,
16502 {
16503 direction: "column",
16504 children,
16505 ...props
16506 }
16507 ),
16508 role: "option",
16509 "aria-hidden": true,
16510 tabIndex: -1,
16511 className: "dataviews-view-picker-grid__card dataviews-view-picker-grid__placeholder"
16512 },
16513 `placeholder-${index2}`
16514 )
16515 ),
16516 data.map((item) => {
16517 const posinset = item.position;
16518 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16519 GridItem3,
16520 {
16521 view,
16522 multiselect: isMultiselect,
16523 selection,
16524 onChangeSelection,
16525 getItemId,
16526 item,
16527 mediaField,
16528 titleField,
16529 descriptionField,
16530 regularFields,
16531 badgeFields,
16532 config: {
16533 sizes: size4
16534 },
16535 posinset,
16536 setsize: setSize
16537 },
16538 getItemId(item)
16539 );
16540 })
16541 ]
16542 }
16543 ),
16544 // Render empty state.
16545 !hasData && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
16546 "div",
16547 {
16548 className: clsx_default({
16549 "dataviews-loading": isLoading,
16550 "dataviews-no-results": !isLoading
16551 }),
16552 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components14.Spinner, {}) }) : empty
16553 }
16554 ),
16555 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components14.Spinner, {}) })
16556 ]
16557 });
16558 }
16559 var picker_grid_default = ViewPickerGrid;
16560
16561 // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs
16562 var import_i18n20 = __toESM(require_i18n(), 1);
16563 var import_components15 = __toESM(require_components(), 1);
16564 var import_element60 = __toESM(require_element(), 1);
16565 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
16566 function TableColumnField2({
16567 item,
16568 fields,
16569 column,
16570 align
16571 }) {
16572 const field = fields.find((f2) => f2.id === column);
16573 if (!field) {
16574 return null;
16575 }
16576 const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
16577 "dataviews-view-table__cell-align-end": align === "end",
16578 "dataviews-view-table__cell-align-center": align === "center"
16579 });
16580 return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(field.render, { item, field }) });
16581 }
16582 function TableRow2({
16583 item,
16584 fields,
16585 id,
16586 view,
16587 titleField,
16588 mediaField,
16589 descriptionField,
16590 selection,
16591 getItemId,
16592 onChangeSelection,
16593 multiselect,
16594 posinset
16595 }) {
16596 const { paginationInfo } = (0, import_element60.useContext)(dataviews_context_default);
16597 const isSelected2 = selection.includes(id);
16598 const [isHovered, setIsHovered] = (0, import_element60.useState)(false);
16599 const elementRef = (0, import_element60.useRef)(null);
16600 useIntersectionObserver(elementRef, posinset);
16601 const {
16602 showTitle = true,
16603 showMedia = true,
16604 showDescription = true,
16605 infiniteScrollEnabled
16606 } = view;
16607 const handleMouseEnter = () => {
16608 setIsHovered(true);
16609 };
16610 const handleMouseLeave = () => {
16611 setIsHovered(false);
16612 };
16613 const columns = view.fields ?? [];
16614 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
16615 return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
16616 import_components15.Composite.Item,
16617 {
16618 ref: elementRef,
16619 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16620 "tr",
16621 {
16622 className: clsx_default("dataviews-view-table__row", {
16623 "is-selected": isSelected2,
16624 "is-hovered": isHovered
16625 }),
16626 onMouseEnter: handleMouseEnter,
16627 onMouseLeave: handleMouseLeave,
16628 children,
16629 ...props
16630 }
16631 ),
16632 "aria-selected": isSelected2,
16633 "aria-setsize": paginationInfo.totalItems || void 0,
16634 "aria-posinset": posinset,
16635 role: infiniteScrollEnabled ? "article" : "option",
16636 onMouseDown: (event) => {
16637 if (event.button !== 0) {
16638 return;
16639 }
16640 event.currentTarget.parentElement?.focus({
16641 preventScroll: true
16642 });
16643 },
16644 onClick: () => {
16645 if (isSelected2) {
16646 onChangeSelection(
16647 selection.filter((itemId) => id !== itemId)
16648 );
16649 } else {
16650 const newSelection = multiselect ? [...selection, id] : [id];
16651 onChangeSelection(newSelection);
16652 }
16653 },
16654 children: [
16655 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16656 "td",
16657 {
16658 className: "dataviews-view-table__checkbox-column",
16659 role: "presentation",
16660 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16661 DataViewsSelectionCheckbox,
16662 {
16663 item,
16664 selection,
16665 onChangeSelection,
16666 getItemId,
16667 titleField,
16668 disabled: false,
16669 "aria-hidden": true,
16670 tabIndex: -1
16671 }
16672 ) })
16673 }
16674 ),
16675 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16676 "td",
16677 {
16678 role: "presentation",
16679 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16680 column_primary_default,
16681 {
16682 item,
16683 titleField: showTitle ? titleField : void 0,
16684 mediaField: showMedia ? mediaField : void 0,
16685 descriptionField: showDescription ? descriptionField : void 0,
16686 isItemClickable: () => false
16687 }
16688 )
16689 }
16690 ),
16691 columns.map((column) => {
16692 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
16693 return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16694 "td",
16695 {
16696 style: {
16697 width,
16698 maxWidth,
16699 minWidth
16700 },
16701 role: "presentation",
16702 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16703 TableColumnField2,
16704 {
16705 fields,
16706 item,
16707 column,
16708 align
16709 }
16710 )
16711 },
16712 column
16713 );
16714 })
16715 ]
16716 },
16717 id
16718 );
16719 }
16720 function ViewPickerTable({
16721 actions,
16722 data,
16723 fields,
16724 getItemId,
16725 isLoading = false,
16726 onChangeView,
16727 onChangeSelection,
16728 selection,
16729 setOpenedFilter,
16730 view,
16731 className,
16732 empty
16733 }) {
16734 const headerMenuRefs = (0, import_element60.useRef)(/* @__PURE__ */ new Map());
16735 const headerMenuToFocusRef = (0, import_element60.useRef)(void 0);
16736 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element60.useState)();
16737 const isMultiselect = useIsMultiselectPicker(actions) ?? false;
16738 (0, import_element60.useEffect)(() => {
16739 if (headerMenuToFocusRef.current) {
16740 headerMenuToFocusRef.current.focus();
16741 headerMenuToFocusRef.current = void 0;
16742 }
16743 });
16744 const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
16745 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
16746 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
16747 const tableNoticeId = (0, import_element60.useId)();
16748 if (nextHeaderMenuToFocus) {
16749 headerMenuToFocusRef.current = nextHeaderMenuToFocus;
16750 setNextHeaderMenuToFocus(void 0);
16751 return;
16752 }
16753 const onHide = (field) => {
16754 const hidden = headerMenuRefs.current.get(field.id);
16755 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
16756 setNextHeaderMenuToFocus(fallback?.node);
16757 };
16758 const hasData = !!data?.length;
16759 const titleField = fields.find((field) => field.id === view.titleField);
16760 const mediaField = fields.find((field) => field.id === view.mediaField);
16761 const descriptionField = fields.find(
16762 (field) => field.id === view.descriptionField
16763 );
16764 const { showTitle = true, showMedia = true, showDescription = true } = view;
16765 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription;
16766 const columns = view.fields ?? [];
16767 const headerMenuRef = (column, index2) => (node) => {
16768 if (node) {
16769 headerMenuRefs.current.set(column, {
16770 node,
16771 fallback: columns[index2 > 0 ? index2 - 1 : 1]
16772 });
16773 } else {
16774 headerMenuRefs.current.delete(column);
16775 }
16776 };
16777 return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
16778 /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
16779 "table",
16780 {
16781 className: clsx_default(
16782 "dataviews-view-table",
16783 "dataviews-view-picker-table",
16784 className,
16785 {
16786 [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
16787 view.layout.density
16788 )
16789 }
16790 ),
16791 "aria-busy": isLoading,
16792 "aria-describedby": tableNoticeId,
16793 role: isInfiniteScroll ? "feed" : "listbox",
16794 children: [
16795 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
16796 "tr",
16797 {
16798 className: "dataviews-view-table__row",
16799 role: "presentation",
16800 children: [
16801 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16802 BulkSelectionCheckbox,
16803 {
16804 selection,
16805 onChangeSelection,
16806 data,
16807 actions,
16808 getItemId,
16809 disableSelectAll: isInfiniteScroll
16810 }
16811 ) }),
16812 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16813 column_header_menu_default,
16814 {
16815 ref: headerMenuRef(
16816 titleField.id,
16817 0
16818 ),
16819 fieldId: titleField.id,
16820 view,
16821 fields,
16822 onChangeView,
16823 onHide,
16824 setOpenedFilter,
16825 canMove: false
16826 }
16827 ) }),
16828 columns.map((column, index2) => {
16829 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
16830 return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16831 "th",
16832 {
16833 style: {
16834 width,
16835 maxWidth,
16836 minWidth,
16837 textAlign: align
16838 },
16839 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
16840 scope: "col",
16841 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16842 column_header_menu_default,
16843 {
16844 ref: headerMenuRef(column, index2),
16845 fieldId: column,
16846 view,
16847 fields,
16848 onChangeView,
16849 onHide,
16850 setOpenedFilter,
16851 canMove: view.layout?.enableMoving ?? true
16852 }
16853 )
16854 },
16855 column
16856 );
16857 })
16858 ]
16859 }
16860 ) }),
16861 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
16862 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
16863 import_components15.Composite,
16864 {
16865 virtualFocus: true,
16866 orientation: "vertical",
16867 render: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tbody", { role: "group" }),
16868 children: [
16869 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16870 "tr",
16871 {
16872 className: "dataviews-view-table__group-header-row",
16873 role: "presentation",
16874 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16875 "td",
16876 {
16877 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1,
16878 className: "dataviews-view-table__group-header-cell",
16879 role: "presentation",
16880 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n20.sprintf)(
16881 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
16882 (0, import_i18n20.__)("%1$s: %2$s"),
16883 groupField.label,
16884 groupName
16885 )
16886 }
16887 )
16888 }
16889 ),
16890 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16891 TableRow2,
16892 {
16893 item,
16894 fields,
16895 id: getItemId(item) || index2.toString(),
16896 view,
16897 titleField,
16898 mediaField,
16899 descriptionField,
16900 selection,
16901 getItemId,
16902 onChangeSelection,
16903 multiselect: isMultiselect
16904 },
16905 getItemId(item)
16906 ))
16907 ]
16908 },
16909 `group-${groupName}`
16910 )
16911 ) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16912 import_components15.Composite,
16913 {
16914 render: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tbody", { role: "presentation" }),
16915 virtualFocus: true,
16916 orientation: "vertical",
16917 children: hasData && data.map((item, index2) => {
16918 const itemId = getItemId(item);
16919 const posinset = item.position;
16920 return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
16921 TableRow2,
16922 {
16923 item,
16924 fields,
16925 id: itemId || index2.toString(),
16926 view,
16927 titleField,
16928 mediaField,
16929 descriptionField,
16930 selection,
16931 getItemId,
16932 onChangeSelection,
16933 multiselect: isMultiselect,
16934 posinset
16935 },
16936 itemId
16937 );
16938 })
16939 }
16940 )
16941 ]
16942 }
16943 ),
16944 /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
16945 "div",
16946 {
16947 className: clsx_default({
16948 "dataviews-loading": isLoading,
16949 "dataviews-no-results": !hasData && !isLoading
16950 }),
16951 id: tableNoticeId,
16952 children: [
16953 !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components15.Spinner, {}) }) : empty),
16954 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components15.Spinner, {}) })
16955 ]
16956 }
16957 )
16958 ] });
16959 }
16960 var picker_table_default = ViewPickerTable;
16961
16962 // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs
16963 var import_components16 = __toESM(require_components(), 1);
16964 var import_i18n21 = __toESM(require_i18n(), 1);
16965 var import_element61 = __toESM(require_element(), 1);
16966 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
16967 function DensityPicker() {
16968 const context = (0, import_element61.useContext)(dataviews_context_default);
16969 const view = context.view;
16970 return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
16971 import_components16.__experimentalToggleGroupControl,
16972 {
16973 size: "__unstable-large",
16974 label: (0, import_i18n21.__)("Density"),
16975 value: view.layout?.density || "balanced",
16976 onChange: (value) => {
16977 context.onChangeView({
16978 ...view,
16979 layout: {
16980 ...view.layout,
16981 density: value
16982 }
16983 });
16984 },
16985 isBlock: true,
16986 children: [
16987 /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
16988 import_components16.__experimentalToggleGroupControlOption,
16989 {
16990 value: "comfortable",
16991 label: (0, import_i18n21._x)(
16992 "Comfortable",
16993 "Density option for DataView layout"
16994 )
16995 },
16996 "comfortable"
16997 ),
16998 /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
16999 import_components16.__experimentalToggleGroupControlOption,
17000 {
17001 value: "balanced",
17002 label: (0, import_i18n21._x)("Balanced", "Density option for DataView layout")
17003 },
17004 "balanced"
17005 ),
17006 /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
17007 import_components16.__experimentalToggleGroupControlOption,
17008 {
17009 value: "compact",
17010 label: (0, import_i18n21._x)("Compact", "Density option for DataView layout")
17011 },
17012 "compact"
17013 )
17014 ]
17015 }
17016 );
17017 }
17018
17019 // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs
17020 var import_components17 = __toESM(require_components(), 1);
17021 var import_i18n22 = __toESM(require_i18n(), 1);
17022 var import_element62 = __toESM(require_element(), 1);
17023 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
17024 var imageSizes2 = [
17025 {
17026 value: 120,
17027 breakpoint: 1
17028 },
17029 {
17030 value: 170,
17031 breakpoint: 1
17032 },
17033 {
17034 value: 230,
17035 breakpoint: 1
17036 },
17037 {
17038 value: 290,
17039 breakpoint: 1112
17040 // at minimum image width, 4 images display at this container size
17041 },
17042 {
17043 value: 350,
17044 breakpoint: 1636
17045 // at minimum image width, 6 images display at this container size
17046 },
17047 {
17048 value: 430,
17049 breakpoint: 588
17050 // at minimum image width, 2 images display at this container size
17051 }
17052 ];
17053 function PreviewSizePicker() {
17054 const context = (0, import_element62.useContext)(dataviews_context_default);
17055 const view = context.view;
17056 const breakValues = imageSizes2.filter((size4) => {
17057 return context.containerWidth >= size4.breakpoint;
17058 });
17059 const layoutPreviewSize = view.layout?.previewSize ?? 230;
17060 const previewSizeToUse = breakValues.map((size4, index2) => ({ ...size4, index: index2 })).filter((size4) => size4.value <= layoutPreviewSize).sort((a2, b2) => b2.value - a2.value)[0]?.index ?? 0;
17061 const marks = breakValues.map((size4, index2) => {
17062 return {
17063 value: index2
17064 };
17065 });
17066 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
17067 import_components17.RangeControl,
17068 {
17069 __next40pxDefaultSize: true,
17070 showTooltip: false,
17071 label: (0, import_i18n22.__)("Preview size"),
17072 value: previewSizeToUse,
17073 min: 0,
17074 max: breakValues.length - 1,
17075 withInputField: false,
17076 onChange: (value = 0) => {
17077 context.onChangeView({
17078 ...view,
17079 layout: {
17080 ...view.layout,
17081 previewSize: breakValues[value].value
17082 }
17083 });
17084 },
17085 step: 1,
17086 marks
17087 }
17088 );
17089 }
17090
17091 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-config-options.mjs
17092 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
17093 function GridConfigOptions() {
17094 return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
17095 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DensityPicker, {}),
17096 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(PreviewSizePicker, {})
17097 ] });
17098 }
17099
17100 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs
17101 var VIEW_LAYOUTS = [
17102 {
17103 type: LAYOUT_TABLE,
17104 label: (0, import_i18n23.__)("Table"),
17105 component: table_default,
17106 icon: block_table_default,
17107 viewConfigOptions: DensityPicker
17108 },
17109 {
17110 type: LAYOUT_GRID,
17111 label: (0, import_i18n23.__)("Grid"),
17112 component: grid_default,
17113 icon: category_default,
17114 viewConfigOptions: GridConfigOptions
17115 },
17116 {
17117 type: LAYOUT_LIST,
17118 label: (0, import_i18n23.__)("List"),
17119 component: ViewList,
17120 icon: (0, import_i18n23.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default,
17121 viewConfigOptions: DensityPicker
17122 },
17123 {
17124 type: LAYOUT_ACTIVITY,
17125 label: (0, import_i18n23.__)("Activity"),
17126 component: ViewActivity,
17127 icon: scheduled_default,
17128 viewConfigOptions: DensityPicker
17129 },
17130 {
17131 type: LAYOUT_PICKER_GRID,
17132 label: (0, import_i18n23.__)("Grid"),
17133 component: picker_grid_default,
17134 icon: category_default,
17135 viewConfigOptions: GridConfigOptions,
17136 isPicker: true
17137 },
17138 {
17139 type: LAYOUT_PICKER_TABLE,
17140 label: (0, import_i18n23.__)("Table"),
17141 component: picker_table_default,
17142 icon: block_table_default,
17143 viewConfigOptions: DensityPicker,
17144 isPicker: true
17145 }
17146 ];
17147
17148 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs
17149 var import_element70 = __toESM(require_element(), 1);
17150
17151 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs
17152 var import_components20 = __toESM(require_components(), 1);
17153 var import_i18n26 = __toESM(require_i18n(), 1);
17154 var import_element67 = __toESM(require_element(), 1);
17155
17156 // node_modules/@ariakit/core/esm/__chunks/XMCVU3LR.js
17157 function noop4(..._) {
17158 }
17159 function applyState(argument, currentValue) {
17160 if (isUpdater(argument)) {
17161 const value = isLazyValue(currentValue) ? currentValue() : currentValue;
17162 return argument(value);
17163 }
17164 return argument;
17165 }
17166 function isUpdater(argument) {
17167 return typeof argument === "function";
17168 }
17169 function isLazyValue(value) {
17170 return typeof value === "function";
17171 }
17172 function hasOwnProperty(object, prop) {
17173 if (typeof Object.hasOwn === "function") {
17174 return Object.hasOwn(object, prop);
17175 }
17176 return Object.prototype.hasOwnProperty.call(object, prop);
17177 }
17178 function chain(...fns) {
17179 return (...args) => {
17180 for (const fn of fns) {
17181 if (typeof fn === "function") {
17182 fn(...args);
17183 }
17184 }
17185 };
17186 }
17187 function normalizeString(str) {
17188 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
17189 }
17190 function omit(object, keys) {
17191 const result = { ...object };
17192 for (const key of keys) {
17193 if (hasOwnProperty(result, key)) {
17194 delete result[key];
17195 }
17196 }
17197 return result;
17198 }
17199 function pick(object, paths) {
17200 const result = {};
17201 for (const key of paths) {
17202 if (hasOwnProperty(object, key)) {
17203 result[key] = object[key];
17204 }
17205 }
17206 return result;
17207 }
17208 function identity(value) {
17209 return value;
17210 }
17211 function invariant(condition, message2) {
17212 if (condition) return;
17213 if (typeof message2 !== "string") throw new Error("Invariant failed");
17214 throw new Error(message2);
17215 }
17216 function getKeys(obj) {
17217 return Object.keys(obj);
17218 }
17219 function isFalsyBooleanCallback(booleanOrCallback, ...args) {
17220 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
17221 if (result == null) return false;
17222 return !result;
17223 }
17224 function disabledFromProps(props) {
17225 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
17226 }
17227 function removeUndefinedValues(obj) {
17228 const result = {};
17229 for (const key in obj) {
17230 if (obj[key] !== void 0) {
17231 result[key] = obj[key];
17232 }
17233 }
17234 return result;
17235 }
17236 function defaultValue(...values) {
17237 for (const value of values) {
17238 if (value !== void 0) return value;
17239 }
17240 return void 0;
17241 }
17242
17243 // node_modules/@ariakit/react-core/esm/__chunks/YXGXYGQX.js
17244 var import_react16 = __toESM(require_react(), 1);
17245 function setRef(ref, value) {
17246 if (typeof ref === "function") {
17247 ref(value);
17248 } else if (ref) {
17249 ref.current = value;
17250 }
17251 }
17252 function isValidElementWithRef(element) {
17253 if (!element) return false;
17254 if (!(0, import_react16.isValidElement)(element)) return false;
17255 if ("ref" in element.props) return true;
17256 if ("ref" in element) return true;
17257 return false;
17258 }
17259 function getRefProperty(element) {
17260 if (!isValidElementWithRef(element)) return null;
17261 const props = { ...element.props };
17262 return props.ref || element.ref;
17263 }
17264 function mergeProps3(base, overrides) {
17265 const props = { ...base };
17266 for (const key in overrides) {
17267 if (!hasOwnProperty(overrides, key)) continue;
17268 if (key === "className") {
17269 const prop = "className";
17270 props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop];
17271 continue;
17272 }
17273 if (key === "style") {
17274 const prop = "style";
17275 props[prop] = base[prop] ? { ...base[prop], ...overrides[prop] } : overrides[prop];
17276 continue;
17277 }
17278 const overrideValue = overrides[key];
17279 if (typeof overrideValue === "function" && key.startsWith("on")) {
17280 const baseValue = base[key];
17281 if (typeof baseValue === "function") {
17282 props[key] = (...args) => {
17283 overrideValue(...args);
17284 baseValue(...args);
17285 };
17286 continue;
17287 }
17288 }
17289 props[key] = overrideValue;
17290 }
17291 return props;
17292 }
17293
17294 // node_modules/@ariakit/core/esm/__chunks/3DNM6L6E.js
17295 var canUseDOM = checkIsBrowser();
17296 function checkIsBrowser() {
17297 var _a;
17298 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
17299 }
17300 function getDocument(node) {
17301 if (!node) return document;
17302 if ("self" in node) return node.document;
17303 return node.ownerDocument || document;
17304 }
17305 function getActiveElement(node, activeDescendant = false) {
17306 var _a;
17307 const { activeElement: activeElement2 } = getDocument(node);
17308 if (!(activeElement2 == null ? void 0 : activeElement2.nodeName)) {
17309 return null;
17310 }
17311 if (isFrame(activeElement2) && ((_a = activeElement2.contentDocument) == null ? void 0 : _a.body)) {
17312 return getActiveElement(
17313 activeElement2.contentDocument.body,
17314 activeDescendant
17315 );
17316 }
17317 if (activeDescendant) {
17318 const id = activeElement2.getAttribute("aria-activedescendant");
17319 if (id) {
17320 const element = getDocument(activeElement2).getElementById(id);
17321 if (element) {
17322 return element;
17323 }
17324 }
17325 }
17326 return activeElement2;
17327 }
17328 function contains2(parent, child) {
17329 return parent === child || parent.contains(child);
17330 }
17331 function isFrame(element) {
17332 return element.tagName === "IFRAME";
17333 }
17334 function isButton(element) {
17335 const tagName = element.tagName.toLowerCase();
17336 if (tagName === "button") return true;
17337 if (tagName === "input" && element.type) {
17338 return buttonInputTypes.indexOf(element.type) !== -1;
17339 }
17340 return false;
17341 }
17342 var buttonInputTypes = [
17343 "button",
17344 "color",
17345 "file",
17346 "image",
17347 "reset",
17348 "submit"
17349 ];
17350 function isVisible(element) {
17351 if (typeof element.checkVisibility === "function") {
17352 return element.checkVisibility();
17353 }
17354 const htmlElement = element;
17355 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
17356 }
17357 function isTextField(element) {
17358 try {
17359 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
17360 const isTextArea = element.tagName === "TEXTAREA";
17361 return isTextInput || isTextArea || false;
17362 } catch (_error) {
17363 return false;
17364 }
17365 }
17366 function isTextbox(element) {
17367 return element.isContentEditable || isTextField(element);
17368 }
17369 function getTextboxValue(element) {
17370 if (isTextField(element)) {
17371 return element.value;
17372 }
17373 if (element.isContentEditable) {
17374 const range = getDocument(element).createRange();
17375 range.selectNodeContents(element);
17376 return range.toString();
17377 }
17378 return "";
17379 }
17380 function getTextboxSelection(element) {
17381 let start = 0;
17382 let end = 0;
17383 if (isTextField(element)) {
17384 start = element.selectionStart || 0;
17385 end = element.selectionEnd || 0;
17386 } else if (element.isContentEditable) {
17387 const selection = getDocument(element).getSelection();
17388 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains2(element, selection.anchorNode) && selection.focusNode && contains2(element, selection.focusNode)) {
17389 const range = selection.getRangeAt(0);
17390 const nextRange = range.cloneRange();
17391 nextRange.selectNodeContents(element);
17392 nextRange.setEnd(range.startContainer, range.startOffset);
17393 start = nextRange.toString().length;
17394 nextRange.setEnd(range.endContainer, range.endOffset);
17395 end = nextRange.toString().length;
17396 }
17397 }
17398 return { start, end };
17399 }
17400 function getPopupRole(element, fallback) {
17401 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
17402 const role = element == null ? void 0 : element.getAttribute("role");
17403 if (role && allowedPopupRoles.indexOf(role) !== -1) {
17404 return role;
17405 }
17406 return fallback;
17407 }
17408 function getScrollingElement(element) {
17409 if (!element) return null;
17410 const isScrollableOverflow = (overflow) => {
17411 if (overflow === "auto") return true;
17412 if (overflow === "scroll") return true;
17413 return false;
17414 };
17415 if (element.clientHeight && element.scrollHeight > element.clientHeight) {
17416 const { overflowY } = getComputedStyle(element);
17417 if (isScrollableOverflow(overflowY)) return element;
17418 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
17419 const { overflowX } = getComputedStyle(element);
17420 if (isScrollableOverflow(overflowX)) return element;
17421 }
17422 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
17423 }
17424 function setSelectionRange(element, ...args) {
17425 if (/text|search|password|tel|url/i.test(element.type)) {
17426 element.setSelectionRange(...args);
17427 }
17428 }
17429 function sortBasedOnDOMPosition(items, getElement) {
17430 const pairs = items.map((item, index2) => [index2, item]);
17431 let isOrderDifferent = false;
17432 pairs.sort(([indexA, a2], [indexB, b2]) => {
17433 const elementA = getElement(a2);
17434 const elementB = getElement(b2);
17435 if (elementA === elementB) return 0;
17436 if (!elementA || !elementB) return 0;
17437 if (isElementPreceding(elementA, elementB)) {
17438 if (indexA > indexB) {
17439 isOrderDifferent = true;
17440 }
17441 return -1;
17442 }
17443 if (indexA < indexB) {
17444 isOrderDifferent = true;
17445 }
17446 return 1;
17447 });
17448 if (isOrderDifferent) {
17449 return pairs.map(([_, item]) => item);
17450 }
17451 return items;
17452 }
17453 function isElementPreceding(a2, b2) {
17454 return Boolean(
17455 b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING
17456 );
17457 }
17458
17459 // node_modules/@ariakit/core/esm/__chunks/SNHYQNEZ.js
17460 function isTouchDevice() {
17461 return canUseDOM && !!navigator.maxTouchPoints;
17462 }
17463 function isApple() {
17464 if (!canUseDOM) return false;
17465 return /mac|iphone|ipad|ipod/i.test(navigator.platform);
17466 }
17467 function isSafari2() {
17468 return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
17469 }
17470 function isFirefox2() {
17471 return canUseDOM && /firefox\//i.test(navigator.userAgent);
17472 }
17473
17474 // node_modules/@ariakit/core/esm/utils/events.js
17475 function isPortalEvent(event) {
17476 return Boolean(
17477 event.currentTarget && !contains2(event.currentTarget, event.target)
17478 );
17479 }
17480 function isSelfTarget(event) {
17481 return event.target === event.currentTarget;
17482 }
17483 function isOpeningInNewTab(event) {
17484 const element = event.currentTarget;
17485 if (!element) return false;
17486 const isAppleDevice = isApple();
17487 if (isAppleDevice && !event.metaKey) return false;
17488 if (!isAppleDevice && !event.ctrlKey) return false;
17489 const tagName = element.tagName.toLowerCase();
17490 if (tagName === "a") return true;
17491 if (tagName === "button" && element.type === "submit") return true;
17492 if (tagName === "input" && element.type === "submit") return true;
17493 return false;
17494 }
17495 function isDownloading(event) {
17496 const element = event.currentTarget;
17497 if (!element) return false;
17498 const tagName = element.tagName.toLowerCase();
17499 if (!event.altKey) return false;
17500 if (tagName === "a") return true;
17501 if (tagName === "button" && element.type === "submit") return true;
17502 if (tagName === "input" && element.type === "submit") return true;
17503 return false;
17504 }
17505 function fireBlurEvent(element, eventInit) {
17506 const event = new FocusEvent("blur", eventInit);
17507 const defaultAllowed = element.dispatchEvent(event);
17508 const bubbleInit = { ...eventInit, bubbles: true };
17509 element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
17510 return defaultAllowed;
17511 }
17512 function fireKeyboardEvent(element, type, eventInit) {
17513 const event = new KeyboardEvent(type, eventInit);
17514 return element.dispatchEvent(event);
17515 }
17516 function fireClickEvent(element, eventInit) {
17517 const event = new MouseEvent("click", eventInit);
17518 return element.dispatchEvent(event);
17519 }
17520 function isFocusEventOutside(event, container) {
17521 const containerElement = container || event.currentTarget;
17522 const relatedTarget = event.relatedTarget;
17523 return !relatedTarget || !contains2(containerElement, relatedTarget);
17524 }
17525 function queueBeforeEvent(element, type, callback, timeout) {
17526 const createTimer = (callback2) => {
17527 if (timeout) {
17528 const timerId2 = setTimeout(callback2, timeout);
17529 return () => clearTimeout(timerId2);
17530 }
17531 const timerId = requestAnimationFrame(callback2);
17532 return () => cancelAnimationFrame(timerId);
17533 };
17534 const cancelTimer = createTimer(() => {
17535 element.removeEventListener(type, callSync, true);
17536 callback();
17537 });
17538 const callSync = () => {
17539 cancelTimer();
17540 callback();
17541 };
17542 element.addEventListener(type, callSync, { once: true, capture: true });
17543 return cancelTimer;
17544 }
17545 function addGlobalEventListener(type, listener, options, scope = window) {
17546 const children = [];
17547 try {
17548 scope.document.addEventListener(type, listener, options);
17549 for (const frame of Array.from(scope.frames)) {
17550 children.push(addGlobalEventListener(type, listener, options, frame));
17551 }
17552 } catch (e2) {
17553 }
17554 const removeEventListener = () => {
17555 try {
17556 scope.document.removeEventListener(type, listener, options);
17557 } catch (e2) {
17558 }
17559 for (const remove of children) {
17560 remove();
17561 }
17562 };
17563 return removeEventListener;
17564 }
17565
17566 // node_modules/@ariakit/react-core/esm/__chunks/KPHZR4MB.js
17567 var React59 = __toESM(require_react(), 1);
17568 var import_react17 = __toESM(require_react(), 1);
17569 var _React = { ...React59 };
17570 var useReactId = _React.useId;
17571 var useReactDeferredValue = _React.useDeferredValue;
17572 var useReactInsertionEffect = _React.useInsertionEffect;
17573 var useSafeLayoutEffect = canUseDOM ? import_react17.useLayoutEffect : import_react17.useEffect;
17574 function useInitialValue(value) {
17575 const [initialValue] = (0, import_react17.useState)(value);
17576 return initialValue;
17577 }
17578 function useLiveRef(value) {
17579 const ref = (0, import_react17.useRef)(value);
17580 useSafeLayoutEffect(() => {
17581 ref.current = value;
17582 });
17583 return ref;
17584 }
17585 function useEvent(callback) {
17586 const ref = (0, import_react17.useRef)(() => {
17587 throw new Error("Cannot call an event handler while rendering.");
17588 });
17589 if (useReactInsertionEffect) {
17590 useReactInsertionEffect(() => {
17591 ref.current = callback;
17592 });
17593 } else {
17594 ref.current = callback;
17595 }
17596 return (0, import_react17.useCallback)((...args) => {
17597 var _a;
17598 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
17599 }, []);
17600 }
17601 function useTransactionState(callback) {
17602 const [state, setState] = (0, import_react17.useState)(null);
17603 useSafeLayoutEffect(() => {
17604 if (state == null) return;
17605 if (!callback) return;
17606 let prevState = null;
17607 callback((prev) => {
17608 prevState = prev;
17609 return state;
17610 });
17611 return () => {
17612 callback(prevState);
17613 };
17614 }, [state, callback]);
17615 return [state, setState];
17616 }
17617 function useMergeRefs(...refs) {
17618 return (0, import_react17.useMemo)(() => {
17619 if (!refs.some(Boolean)) return;
17620 return (value) => {
17621 for (const ref of refs) {
17622 setRef(ref, value);
17623 }
17624 };
17625 }, refs);
17626 }
17627 function useId5(defaultId) {
17628 if (useReactId) {
17629 const reactId = useReactId();
17630 if (defaultId) return defaultId;
17631 return reactId;
17632 }
17633 const [id, setId] = (0, import_react17.useState)(defaultId);
17634 useSafeLayoutEffect(() => {
17635 if (defaultId || id) return;
17636 const random = Math.random().toString(36).slice(2, 8);
17637 setId(`id-${random}`);
17638 }, [defaultId, id]);
17639 return defaultId || id;
17640 }
17641 function useTagName(refOrElement, type) {
17642 const stringOrUndefined = (type2) => {
17643 if (typeof type2 !== "string") return;
17644 return type2;
17645 };
17646 const [tagName, setTagName] = (0, import_react17.useState)(() => stringOrUndefined(type));
17647 useSafeLayoutEffect(() => {
17648 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
17649 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
17650 }, [refOrElement, type]);
17651 return tagName;
17652 }
17653 function useAttribute(refOrElement, attributeName, defaultValue2) {
17654 const initialValue = useInitialValue(defaultValue2);
17655 const [attribute, setAttribute] = (0, import_react17.useState)(initialValue);
17656 (0, import_react17.useEffect)(() => {
17657 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
17658 if (!element) return;
17659 const callback = () => {
17660 const value = element.getAttribute(attributeName);
17661 setAttribute(value == null ? initialValue : value);
17662 };
17663 const observer = new MutationObserver(callback);
17664 observer.observe(element, { attributeFilter: [attributeName] });
17665 callback();
17666 return () => observer.disconnect();
17667 }, [refOrElement, attributeName, initialValue]);
17668 return attribute;
17669 }
17670 function useUpdateEffect(effect, deps) {
17671 const mounted = (0, import_react17.useRef)(false);
17672 (0, import_react17.useEffect)(() => {
17673 if (mounted.current) {
17674 return effect();
17675 }
17676 mounted.current = true;
17677 }, deps);
17678 (0, import_react17.useEffect)(
17679 () => () => {
17680 mounted.current = false;
17681 },
17682 []
17683 );
17684 }
17685 function useUpdateLayoutEffect(effect, deps) {
17686 const mounted = (0, import_react17.useRef)(false);
17687 useSafeLayoutEffect(() => {
17688 if (mounted.current) {
17689 return effect();
17690 }
17691 mounted.current = true;
17692 }, deps);
17693 useSafeLayoutEffect(
17694 () => () => {
17695 mounted.current = false;
17696 },
17697 []
17698 );
17699 }
17700 function useForceUpdate() {
17701 return (0, import_react17.useReducer)(() => [], []);
17702 }
17703 function useBooleanEvent(booleanOrCallback) {
17704 return useEvent(
17705 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
17706 );
17707 }
17708 function useWrapElement(props, callback, deps = []) {
17709 const wrapElement = (0, import_react17.useCallback)(
17710 (element) => {
17711 if (props.wrapElement) {
17712 element = props.wrapElement(element);
17713 }
17714 return callback(element);
17715 },
17716 [...deps, props.wrapElement]
17717 );
17718 return { ...props, wrapElement };
17719 }
17720 function useMetadataProps(props, key, value) {
17721 const parent = props.onLoadedMetadataCapture;
17722 const onLoadedMetadataCapture = (0, import_react17.useMemo)(() => {
17723 return Object.assign(() => {
17724 }, { ...parent, [key]: value });
17725 }, [parent, key, value]);
17726 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
17727 }
17728 var hasInstalledGlobalEventListeners = false;
17729 function useIsMouseMoving() {
17730 (0, import_react17.useEffect)(() => {
17731 if (hasInstalledGlobalEventListeners) return;
17732 addGlobalEventListener("mousemove", setMouseMoving, true);
17733 addGlobalEventListener("mousedown", resetMouseMoving, true);
17734 addGlobalEventListener("mouseup", resetMouseMoving, true);
17735 addGlobalEventListener("keydown", resetMouseMoving, true);
17736 addGlobalEventListener("scroll", resetMouseMoving, true);
17737 hasInstalledGlobalEventListeners = true;
17738 }, []);
17739 const isMouseMoving = useEvent(() => mouseMoving);
17740 return isMouseMoving;
17741 }
17742 var mouseMoving = false;
17743 var previousScreenX = 0;
17744 var previousScreenY = 0;
17745 function hasMouseMovement(event) {
17746 const movementX = event.movementX || event.screenX - previousScreenX;
17747 const movementY = event.movementY || event.screenY - previousScreenY;
17748 previousScreenX = event.screenX;
17749 previousScreenY = event.screenY;
17750 return movementX || movementY || false;
17751 }
17752 function setMouseMoving(event) {
17753 if (!hasMouseMovement(event)) return;
17754 mouseMoving = true;
17755 }
17756 function resetMouseMoving() {
17757 mouseMoving = false;
17758 }
17759
17760 // node_modules/@ariakit/react-core/esm/__chunks/GWSL6KNJ.js
17761 var React60 = __toESM(require_react(), 1);
17762 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
17763 function forwardRef210(render4) {
17764 const Role = React60.forwardRef(
17765 // @ts-ignore Incompatible with React 19 types. Ignore for now.
17766 (props, ref) => render4({ ...props, ref })
17767 );
17768 Role.displayName = render4.displayName || render4.name;
17769 return Role;
17770 }
17771 function memo22(Component, propsAreEqual) {
17772 return React60.memo(Component, propsAreEqual);
17773 }
17774 function createElement3(Type, props) {
17775 const { wrapElement, render: render4, ...rest } = props;
17776 const mergedRef = useMergeRefs(props.ref, getRefProperty(render4));
17777 let element;
17778 if (React60.isValidElement(render4)) {
17779 const renderProps = {
17780 // @ts-ignore Incompatible with React 19 types. Ignore for now.
17781 ...render4.props,
17782 ref: mergedRef
17783 };
17784 element = React60.cloneElement(render4, mergeProps3(rest, renderProps));
17785 } else if (render4) {
17786 element = render4(rest);
17787 } else {
17788 element = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Type, { ...rest });
17789 }
17790 if (wrapElement) {
17791 return wrapElement(element);
17792 }
17793 return element;
17794 }
17795 function createHook(useProps) {
17796 const useRole = (props = {}) => {
17797 return useProps(props);
17798 };
17799 useRole.displayName = useProps.name;
17800 return useRole;
17801 }
17802 function createStoreContext(providers = [], scopedProviders = []) {
17803 const context = React60.createContext(void 0);
17804 const scopedContext = React60.createContext(void 0);
17805 const useContext210 = () => React60.useContext(context);
17806 const useScopedContext = (onlyScoped = false) => {
17807 const scoped = React60.useContext(scopedContext);
17808 const store = useContext210();
17809 if (onlyScoped) return scoped;
17810 return scoped || store;
17811 };
17812 const useProviderContext = () => {
17813 const scoped = React60.useContext(scopedContext);
17814 const store = useContext210();
17815 if (scoped && scoped === store) return;
17816 return store;
17817 };
17818 const ContextProvider = (props) => {
17819 return providers.reduceRight(
17820 (children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Provider2, { ...props, children }),
17821 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(context.Provider, { ...props })
17822 );
17823 };
17824 const ScopedContextProvider = (props) => {
17825 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(ContextProvider, { ...props, children: scopedProviders.reduceRight(
17826 (children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Provider2, { ...props, children }),
17827 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(scopedContext.Provider, { ...props })
17828 ) });
17829 };
17830 return {
17831 context,
17832 scopedContext,
17833 useContext: useContext210,
17834 useScopedContext,
17835 useProviderContext,
17836 ContextProvider,
17837 ScopedContextProvider
17838 };
17839 }
17840
17841 // node_modules/@ariakit/react-core/esm/__chunks/SMPCIMZM.js
17842 var ctx = createStoreContext();
17843 var useCollectionContext = ctx.useContext;
17844 var useCollectionScopedContext = ctx.useScopedContext;
17845 var useCollectionProviderContext = ctx.useProviderContext;
17846 var CollectionContextProvider = ctx.ContextProvider;
17847 var CollectionScopedContextProvider = ctx.ScopedContextProvider;
17848
17849 // node_modules/@ariakit/react-core/esm/__chunks/AVVXDJMZ.js
17850 var import_react18 = __toESM(require_react(), 1);
17851 var ctx2 = createStoreContext(
17852 [CollectionContextProvider],
17853 [CollectionScopedContextProvider]
17854 );
17855 var useCompositeContext = ctx2.useContext;
17856 var useCompositeScopedContext = ctx2.useScopedContext;
17857 var useCompositeProviderContext = ctx2.useProviderContext;
17858 var CompositeContextProvider = ctx2.ContextProvider;
17859 var CompositeScopedContextProvider = ctx2.ScopedContextProvider;
17860 var CompositeItemContext = (0, import_react18.createContext)(
17861 void 0
17862 );
17863 var CompositeRowContext = (0, import_react18.createContext)(
17864 void 0
17865 );
17866
17867 // node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js
17868 function findFirstEnabledItem(items, excludeId) {
17869 return items.find((item) => {
17870 if (excludeId) {
17871 return !item.disabled && item.id !== excludeId;
17872 }
17873 return !item.disabled;
17874 });
17875 }
17876 function getEnabledItem(store, id) {
17877 if (!id) return null;
17878 return store.item(id) || null;
17879 }
17880 function groupItemsByRows(items) {
17881 const rows = [];
17882 for (const item of items) {
17883 const row = rows.find((currentRow) => {
17884 var _a;
17885 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
17886 });
17887 if (row) {
17888 row.push(item);
17889 } else {
17890 rows.push([item]);
17891 }
17892 }
17893 return rows;
17894 }
17895 function selectTextField(element, collapseToEnd = false) {
17896 if (isTextField(element)) {
17897 element.setSelectionRange(
17898 collapseToEnd ? element.value.length : 0,
17899 element.value.length
17900 );
17901 } else if (element.isContentEditable) {
17902 const selection = getDocument(element).getSelection();
17903 selection == null ? void 0 : selection.selectAllChildren(element);
17904 if (collapseToEnd) {
17905 selection == null ? void 0 : selection.collapseToEnd();
17906 }
17907 }
17908 }
17909 var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY");
17910 function focusSilently(element) {
17911 element[FOCUS_SILENTLY] = true;
17912 element.focus({ preventScroll: true });
17913 }
17914 function silentlyFocused(element) {
17915 const isSilentlyFocused = element[FOCUS_SILENTLY];
17916 delete element[FOCUS_SILENTLY];
17917 return isSilentlyFocused;
17918 }
17919 function isItem(store, element, exclude) {
17920 if (!element) return false;
17921 if (element === exclude) return false;
17922 const item = store.item(element.id);
17923 if (!item) return false;
17924 if (exclude && item.element === exclude) return false;
17925 return true;
17926 }
17927
17928 // node_modules/@ariakit/react-core/esm/__chunks/Z2O3VLAQ.js
17929 var import_react19 = __toESM(require_react(), 1);
17930 var TagName = "div";
17931 var useCollectionItem = createHook(
17932 function useCollectionItem2({
17933 store,
17934 shouldRegisterItem = true,
17935 getItem = identity,
17936 // @ts-expect-error This prop may come from a collection renderer.
17937 element,
17938 ...props
17939 }) {
17940 const context = useCollectionContext();
17941 store = store || context;
17942 const id = useId5(props.id);
17943 const ref = (0, import_react19.useRef)(element);
17944 (0, import_react19.useEffect)(() => {
17945 const element2 = ref.current;
17946 if (!id) return;
17947 if (!element2) return;
17948 if (!shouldRegisterItem) return;
17949 const item = getItem({ id, element: element2 });
17950 return store == null ? void 0 : store.renderItem(item);
17951 }, [id, shouldRegisterItem, getItem, store]);
17952 props = {
17953 ...props,
17954 ref: useMergeRefs(ref, props.ref)
17955 };
17956 return removeUndefinedValues(props);
17957 }
17958 );
17959 var CollectionItem = forwardRef210(function CollectionItem2(props) {
17960 const htmlProps = useCollectionItem(props);
17961 return createElement3(TagName, htmlProps);
17962 });
17963
17964 // node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
17965 var import_react20 = __toESM(require_react(), 1);
17966 var FocusableContext = (0, import_react20.createContext)(true);
17967
17968 // node_modules/@ariakit/core/esm/utils/focus.js
17969 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
17970 function isFocusable(element) {
17971 if (!element.matches(selector)) return false;
17972 if (!isVisible(element)) return false;
17973 if (element.closest("[inert]")) return false;
17974 return true;
17975 }
17976 function getClosestFocusable(element) {
17977 while (element && !isFocusable(element)) {
17978 element = element.closest(selector);
17979 }
17980 return element || null;
17981 }
17982 function hasFocus(element) {
17983 const activeElement2 = getActiveElement(element);
17984 if (!activeElement2) return false;
17985 if (activeElement2 === element) return true;
17986 const activeDescendant = activeElement2.getAttribute("aria-activedescendant");
17987 if (!activeDescendant) return false;
17988 return activeDescendant === element.id;
17989 }
17990 function hasFocusWithin(element) {
17991 const activeElement2 = getActiveElement(element);
17992 if (!activeElement2) return false;
17993 if (contains2(element, activeElement2)) return true;
17994 const activeDescendant = activeElement2.getAttribute("aria-activedescendant");
17995 if (!activeDescendant) return false;
17996 if (!("id" in element)) return false;
17997 if (activeDescendant === element.id) return true;
17998 return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
17999 }
18000 function focusIfNeeded(element) {
18001 if (!hasFocusWithin(element) && isFocusable(element)) {
18002 element.focus();
18003 }
18004 }
18005 function focusIntoView(element, options) {
18006 if (!("scrollIntoView" in element)) {
18007 element.focus();
18008 } else {
18009 element.focus({ preventScroll: true });
18010 element.scrollIntoView({ block: "nearest", inline: "nearest", ...options });
18011 }
18012 }
18013
18014 // node_modules/@ariakit/react-core/esm/__chunks/U6HHPQDW.js
18015 var import_react21 = __toESM(require_react(), 1);
18016 var TagName2 = "div";
18017 var isSafariBrowser = isSafari2();
18018 var alwaysFocusVisibleInputTypes = [
18019 "text",
18020 "search",
18021 "url",
18022 "tel",
18023 "email",
18024 "password",
18025 "number",
18026 "date",
18027 "month",
18028 "week",
18029 "time",
18030 "datetime",
18031 "datetime-local"
18032 ];
18033 var safariFocusAncestorSymbol = /* @__PURE__ */ Symbol("safariFocusAncestor");
18034 function markSafariFocusAncestor(element, value) {
18035 if (!element) return;
18036 element[safariFocusAncestorSymbol] = value;
18037 }
18038 function isAlwaysFocusVisible(element) {
18039 const { tagName, readOnly, type } = element;
18040 if (tagName === "TEXTAREA" && !readOnly) return true;
18041 if (tagName === "SELECT" && !readOnly) return true;
18042 if (tagName === "INPUT" && !readOnly) {
18043 return alwaysFocusVisibleInputTypes.includes(type);
18044 }
18045 if (element.isContentEditable) return true;
18046 const role = element.getAttribute("role");
18047 if (role === "combobox" && element.dataset.name) {
18048 return true;
18049 }
18050 return false;
18051 }
18052 function getLabels(element) {
18053 if ("labels" in element) {
18054 return element.labels;
18055 }
18056 return null;
18057 }
18058 function isNativeCheckboxOrRadio(element) {
18059 const tagName = element.tagName.toLowerCase();
18060 if (tagName === "input" && element.type) {
18061 return element.type === "radio" || element.type === "checkbox";
18062 }
18063 return false;
18064 }
18065 function isNativeTabbable(tagName) {
18066 if (!tagName) return true;
18067 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
18068 }
18069 function supportsDisabledAttribute(tagName) {
18070 if (!tagName) return true;
18071 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
18072 }
18073 function getTabIndex2(focusable2, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
18074 if (!focusable2) {
18075 return tabIndexProp;
18076 }
18077 if (trulyDisabled) {
18078 if (nativeTabbable && !supportsDisabled) {
18079 return -1;
18080 }
18081 return;
18082 }
18083 if (nativeTabbable) {
18084 return tabIndexProp;
18085 }
18086 return tabIndexProp || 0;
18087 }
18088 function useDisableEvent(onEvent, disabled2) {
18089 return useEvent((event) => {
18090 onEvent == null ? void 0 : onEvent(event);
18091 if (event.defaultPrevented) return;
18092 if (disabled2) {
18093 event.stopPropagation();
18094 event.preventDefault();
18095 }
18096 });
18097 }
18098 var hasInstalledGlobalEventListeners2 = false;
18099 var isKeyboardModality = true;
18100 function onGlobalMouseDown(event) {
18101 const target = event.target;
18102 if (target && "hasAttribute" in target) {
18103 if (!target.hasAttribute("data-focus-visible")) {
18104 isKeyboardModality = false;
18105 }
18106 }
18107 }
18108 function onGlobalKeyDown(event) {
18109 if (event.metaKey) return;
18110 if (event.ctrlKey) return;
18111 if (event.altKey) return;
18112 isKeyboardModality = true;
18113 }
18114 var useFocusable = createHook(
18115 function useFocusable2({
18116 focusable: focusable2 = true,
18117 accessibleWhenDisabled,
18118 autoFocus,
18119 onFocusVisible,
18120 ...props
18121 }) {
18122 const ref = (0, import_react21.useRef)(null);
18123 (0, import_react21.useEffect)(() => {
18124 if (!focusable2) return;
18125 if (hasInstalledGlobalEventListeners2) return;
18126 addGlobalEventListener("mousedown", onGlobalMouseDown, true);
18127 addGlobalEventListener("keydown", onGlobalKeyDown, true);
18128 hasInstalledGlobalEventListeners2 = true;
18129 }, [focusable2]);
18130 if (isSafariBrowser) {
18131 (0, import_react21.useEffect)(() => {
18132 if (!focusable2) return;
18133 const element = ref.current;
18134 if (!element) return;
18135 if (!isNativeCheckboxOrRadio(element)) return;
18136 const labels = getLabels(element);
18137 if (!labels) return;
18138 const onMouseUp = () => queueMicrotask(() => element.focus());
18139 for (const label of labels) {
18140 label.addEventListener("mouseup", onMouseUp);
18141 }
18142 return () => {
18143 for (const label of labels) {
18144 label.removeEventListener("mouseup", onMouseUp);
18145 }
18146 };
18147 }, [focusable2]);
18148 }
18149 const disabled2 = focusable2 && disabledFromProps(props);
18150 const trulyDisabled = !!disabled2 && !accessibleWhenDisabled;
18151 const [focusVisible, setFocusVisible] = (0, import_react21.useState)(false);
18152 (0, import_react21.useEffect)(() => {
18153 if (!focusable2) return;
18154 if (trulyDisabled && focusVisible) {
18155 setFocusVisible(false);
18156 }
18157 }, [focusable2, trulyDisabled, focusVisible]);
18158 (0, import_react21.useEffect)(() => {
18159 if (!focusable2) return;
18160 if (!focusVisible) return;
18161 const element = ref.current;
18162 if (!element) return;
18163 if (typeof IntersectionObserver === "undefined") return;
18164 const observer = new IntersectionObserver(() => {
18165 if (!isFocusable(element)) {
18166 setFocusVisible(false);
18167 }
18168 });
18169 observer.observe(element);
18170 return () => observer.disconnect();
18171 }, [focusable2, focusVisible]);
18172 const onKeyPressCapture = useDisableEvent(
18173 props.onKeyPressCapture,
18174 disabled2
18175 );
18176 const onMouseDownCapture = useDisableEvent(
18177 props.onMouseDownCapture,
18178 disabled2
18179 );
18180 const onClickCapture = useDisableEvent(props.onClickCapture, disabled2);
18181 const onMouseDownProp = props.onMouseDown;
18182 const onMouseDown = useEvent((event) => {
18183 onMouseDownProp == null ? void 0 : onMouseDownProp(event);
18184 if (event.defaultPrevented) return;
18185 if (!focusable2) return;
18186 const element = event.currentTarget;
18187 if (!isSafariBrowser) return;
18188 if (isPortalEvent(event)) return;
18189 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return;
18190 let receivedFocus = false;
18191 const onFocus = () => {
18192 receivedFocus = true;
18193 };
18194 const options = { capture: true, once: true };
18195 element.addEventListener("focusin", onFocus, options);
18196 const focusableContainer = getClosestFocusable(element.parentElement);
18197 markSafariFocusAncestor(focusableContainer, true);
18198 queueBeforeEvent(element, "mouseup", () => {
18199 element.removeEventListener("focusin", onFocus, true);
18200 markSafariFocusAncestor(focusableContainer, false);
18201 if (receivedFocus) return;
18202 focusIfNeeded(element);
18203 });
18204 });
18205 const handleFocusVisible = (event, currentTarget) => {
18206 if (currentTarget) {
18207 event.currentTarget = currentTarget;
18208 }
18209 if (!focusable2) return;
18210 const element = event.currentTarget;
18211 if (!element) return;
18212 if (!hasFocus(element)) return;
18213 onFocusVisible == null ? void 0 : onFocusVisible(event);
18214 if (event.defaultPrevented) return;
18215 element.dataset.focusVisible = "true";
18216 setFocusVisible(true);
18217 };
18218 const onKeyDownCaptureProp = props.onKeyDownCapture;
18219 const onKeyDownCapture = useEvent((event) => {
18220 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
18221 if (event.defaultPrevented) return;
18222 if (!focusable2) return;
18223 if (focusVisible) return;
18224 if (event.metaKey) return;
18225 if (event.altKey) return;
18226 if (event.ctrlKey) return;
18227 if (!isSelfTarget(event)) return;
18228 const element = event.currentTarget;
18229 const applyFocusVisible = () => handleFocusVisible(event, element);
18230 queueBeforeEvent(element, "focusout", applyFocusVisible);
18231 });
18232 const onFocusCaptureProp = props.onFocusCapture;
18233 const onFocusCapture = useEvent((event) => {
18234 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
18235 if (event.defaultPrevented) return;
18236 if (!focusable2) return;
18237 if (!isSelfTarget(event)) {
18238 setFocusVisible(false);
18239 return;
18240 }
18241 const element = event.currentTarget;
18242 const applyFocusVisible = () => handleFocusVisible(event, element);
18243 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
18244 queueBeforeEvent(event.target, "focusout", applyFocusVisible);
18245 } else {
18246 setFocusVisible(false);
18247 }
18248 });
18249 const onBlurProp = props.onBlur;
18250 const onBlur = useEvent((event) => {
18251 onBlurProp == null ? void 0 : onBlurProp(event);
18252 if (!focusable2) return;
18253 if (!isFocusEventOutside(event)) return;
18254 event.currentTarget.removeAttribute("data-focus-visible");
18255 setFocusVisible(false);
18256 });
18257 const autoFocusOnShow = (0, import_react21.useContext)(FocusableContext);
18258 const autoFocusRef = useEvent((element) => {
18259 if (!focusable2) return;
18260 if (!autoFocus) return;
18261 if (!element) return;
18262 if (!autoFocusOnShow) return;
18263 queueMicrotask(() => {
18264 if (hasFocus(element)) return;
18265 if (!isFocusable(element)) return;
18266 element.focus();
18267 });
18268 });
18269 const tagName = useTagName(ref);
18270 const nativeTabbable = focusable2 && isNativeTabbable(tagName);
18271 const supportsDisabled = focusable2 && supportsDisabledAttribute(tagName);
18272 const styleProp = props.style;
18273 const style = (0, import_react21.useMemo)(() => {
18274 if (trulyDisabled) {
18275 return { pointerEvents: "none", ...styleProp };
18276 }
18277 return styleProp;
18278 }, [trulyDisabled, styleProp]);
18279 props = {
18280 "data-focus-visible": focusable2 && focusVisible || void 0,
18281 "data-autofocus": autoFocus || void 0,
18282 "aria-disabled": disabled2 || void 0,
18283 ...props,
18284 ref: useMergeRefs(ref, autoFocusRef, props.ref),
18285 style,
18286 tabIndex: getTabIndex2(
18287 focusable2,
18288 trulyDisabled,
18289 nativeTabbable,
18290 supportsDisabled,
18291 props.tabIndex
18292 ),
18293 disabled: supportsDisabled && trulyDisabled ? true : void 0,
18294 // TODO: Test Focusable contentEditable.
18295 contentEditable: disabled2 ? void 0 : props.contentEditable,
18296 onKeyPressCapture,
18297 onClickCapture,
18298 onMouseDownCapture,
18299 onMouseDown,
18300 onKeyDownCapture,
18301 onFocusCapture,
18302 onBlur
18303 };
18304 return removeUndefinedValues(props);
18305 }
18306 );
18307 var Focusable = forwardRef210(function Focusable2(props) {
18308 const htmlProps = useFocusable(props);
18309 return createElement3(TagName2, htmlProps);
18310 });
18311
18312 // node_modules/@ariakit/react-core/esm/__chunks/PZ3OL7I2.js
18313 var import_react22 = __toESM(require_react(), 1);
18314 var TagName3 = "button";
18315 function isNativeClick(event) {
18316 if (!event.isTrusted) return false;
18317 const element = event.currentTarget;
18318 if (event.key === "Enter") {
18319 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
18320 }
18321 if (event.key === " ") {
18322 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
18323 }
18324 return false;
18325 }
18326 var symbol = /* @__PURE__ */ Symbol("command");
18327 var useCommand = createHook(
18328 function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) {
18329 const ref = (0, import_react22.useRef)(null);
18330 const [isNativeButton, setIsNativeButton] = (0, import_react22.useState)(false);
18331 (0, import_react22.useEffect)(() => {
18332 if (!ref.current) return;
18333 setIsNativeButton(isButton(ref.current));
18334 }, []);
18335 const [active, setActive] = (0, import_react22.useState)(false);
18336 const activeRef = (0, import_react22.useRef)(false);
18337 const disabled2 = disabledFromProps(props);
18338 const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true);
18339 const onKeyDownProp = props.onKeyDown;
18340 const onKeyDown = useEvent((event) => {
18341 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
18342 const element = event.currentTarget;
18343 if (event.defaultPrevented) return;
18344 if (isDuplicate) return;
18345 if (disabled2) return;
18346 if (!isSelfTarget(event)) return;
18347 if (isTextField(element)) return;
18348 if (element.isContentEditable) return;
18349 const isEnter = clickOnEnter && event.key === "Enter";
18350 const isSpace = clickOnSpace && event.key === " ";
18351 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
18352 const shouldPreventSpace = event.key === " " && !clickOnSpace;
18353 if (shouldPreventEnter || shouldPreventSpace) {
18354 event.preventDefault();
18355 return;
18356 }
18357 if (isEnter || isSpace) {
18358 const nativeClick = isNativeClick(event);
18359 if (isEnter) {
18360 if (!nativeClick) {
18361 event.preventDefault();
18362 const { view, ...eventInit } = event;
18363 const click = () => fireClickEvent(element, eventInit);
18364 if (isFirefox2()) {
18365 queueBeforeEvent(element, "keyup", click);
18366 } else {
18367 queueMicrotask(click);
18368 }
18369 }
18370 } else if (isSpace) {
18371 activeRef.current = true;
18372 if (!nativeClick) {
18373 event.preventDefault();
18374 setActive(true);
18375 }
18376 }
18377 }
18378 });
18379 const onKeyUpProp = props.onKeyUp;
18380 const onKeyUp = useEvent((event) => {
18381 onKeyUpProp == null ? void 0 : onKeyUpProp(event);
18382 if (event.defaultPrevented) return;
18383 if (isDuplicate) return;
18384 if (disabled2) return;
18385 if (event.metaKey) return;
18386 const isSpace = clickOnSpace && event.key === " ";
18387 if (activeRef.current && isSpace) {
18388 activeRef.current = false;
18389 if (!isNativeClick(event)) {
18390 event.preventDefault();
18391 setActive(false);
18392 const element = event.currentTarget;
18393 const { view, ...eventInit } = event;
18394 queueMicrotask(() => fireClickEvent(element, eventInit));
18395 }
18396 }
18397 });
18398 props = {
18399 "data-active": active || void 0,
18400 type: isNativeButton ? "button" : void 0,
18401 ...metadataProps,
18402 ...props,
18403 ref: useMergeRefs(ref, props.ref),
18404 onKeyDown,
18405 onKeyUp
18406 };
18407 props = useFocusable(props);
18408 return props;
18409 }
18410 );
18411 var Command = forwardRef210(function Command2(props) {
18412 const htmlProps = useCommand(props);
18413 return createElement3(TagName3, htmlProps);
18414 });
18415
18416 // node_modules/@ariakit/core/esm/__chunks/SXKM4CGU.js
18417 function getInternal(store, key) {
18418 const internals = store.__unstableInternals;
18419 invariant(internals, "Invalid store");
18420 return internals[key];
18421 }
18422 function createStore(initialState, ...stores) {
18423 let state = initialState;
18424 let prevStateBatch = state;
18425 let lastUpdate = /* @__PURE__ */ Symbol();
18426 let destroy = noop4;
18427 const instances = /* @__PURE__ */ new Set();
18428 const updatedKeys = /* @__PURE__ */ new Set();
18429 const setups = /* @__PURE__ */ new Set();
18430 const listeners = /* @__PURE__ */ new Set();
18431 const batchListeners = /* @__PURE__ */ new Set();
18432 const disposables = /* @__PURE__ */ new WeakMap();
18433 const listenerKeys = /* @__PURE__ */ new WeakMap();
18434 const storeSetup = (callback) => {
18435 setups.add(callback);
18436 return () => setups.delete(callback);
18437 };
18438 const storeInit = () => {
18439 const initialized = instances.size;
18440 const instance = /* @__PURE__ */ Symbol();
18441 instances.add(instance);
18442 const maybeDestroy = () => {
18443 instances.delete(instance);
18444 if (instances.size) return;
18445 destroy();
18446 };
18447 if (initialized) return maybeDestroy;
18448 const desyncs = getKeys(state).map(
18449 (key) => chain(
18450 ...stores.map((store) => {
18451 var _a;
18452 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
18453 if (!storeState) return;
18454 if (!hasOwnProperty(storeState, key)) return;
18455 return sync(store, [key], (state2) => {
18456 setState(
18457 key,
18458 state2[key],
18459 // @ts-expect-error - Not public API. This is just to prevent
18460 // infinite loops.
18461 true
18462 );
18463 });
18464 })
18465 )
18466 );
18467 const teardowns = [];
18468 for (const setup2 of setups) {
18469 teardowns.push(setup2());
18470 }
18471 const cleanups = stores.map(init);
18472 destroy = chain(...desyncs, ...teardowns, ...cleanups);
18473 return maybeDestroy;
18474 };
18475 const sub = (keys, listener, set3 = listeners) => {
18476 set3.add(listener);
18477 listenerKeys.set(listener, keys);
18478 return () => {
18479 var _a;
18480 (_a = disposables.get(listener)) == null ? void 0 : _a();
18481 disposables.delete(listener);
18482 listenerKeys.delete(listener);
18483 set3.delete(listener);
18484 };
18485 };
18486 const storeSubscribe = (keys, listener) => sub(keys, listener);
18487 const storeSync = (keys, listener) => {
18488 disposables.set(listener, listener(state, state));
18489 return sub(keys, listener);
18490 };
18491 const storeBatch = (keys, listener) => {
18492 disposables.set(listener, listener(state, prevStateBatch));
18493 return sub(keys, listener, batchListeners);
18494 };
18495 const storePick = (keys) => createStore(pick(state, keys), finalStore);
18496 const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
18497 const getState = () => state;
18498 const setState = (key, value, fromStores = false) => {
18499 var _a;
18500 if (!hasOwnProperty(state, key)) return;
18501 const nextValue = applyState(value, state[key]);
18502 if (nextValue === state[key]) return;
18503 if (!fromStores) {
18504 for (const store of stores) {
18505 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
18506 }
18507 }
18508 const prevState = state;
18509 state = { ...state, [key]: nextValue };
18510 const thisUpdate = /* @__PURE__ */ Symbol();
18511 lastUpdate = thisUpdate;
18512 updatedKeys.add(key);
18513 const run = (listener, prev, uKeys) => {
18514 var _a2;
18515 const keys = listenerKeys.get(listener);
18516 const updated = (k) => uKeys ? uKeys.has(k) : k === key;
18517 if (!keys || keys.some(updated)) {
18518 (_a2 = disposables.get(listener)) == null ? void 0 : _a2();
18519 disposables.set(listener, listener(state, prev));
18520 }
18521 };
18522 for (const listener of listeners) {
18523 run(listener, prevState);
18524 }
18525 queueMicrotask(() => {
18526 if (lastUpdate !== thisUpdate) return;
18527 const snapshot = state;
18528 for (const listener of batchListeners) {
18529 run(listener, prevStateBatch, updatedKeys);
18530 }
18531 prevStateBatch = snapshot;
18532 updatedKeys.clear();
18533 });
18534 };
18535 const finalStore = {
18536 getState,
18537 setState,
18538 __unstableInternals: {
18539 setup: storeSetup,
18540 init: storeInit,
18541 subscribe: storeSubscribe,
18542 sync: storeSync,
18543 batch: storeBatch,
18544 pick: storePick,
18545 omit: storeOmit
18546 }
18547 };
18548 return finalStore;
18549 }
18550 function setup(store, ...args) {
18551 if (!store) return;
18552 return getInternal(store, "setup")(...args);
18553 }
18554 function init(store, ...args) {
18555 if (!store) return;
18556 return getInternal(store, "init")(...args);
18557 }
18558 function subscribe(store, ...args) {
18559 if (!store) return;
18560 return getInternal(store, "subscribe")(...args);
18561 }
18562 function sync(store, ...args) {
18563 if (!store) return;
18564 return getInternal(store, "sync")(...args);
18565 }
18566 function batch(store, ...args) {
18567 if (!store) return;
18568 return getInternal(store, "batch")(...args);
18569 }
18570 function omit2(store, ...args) {
18571 if (!store) return;
18572 return getInternal(store, "omit")(...args);
18573 }
18574 function pick2(store, ...args) {
18575 if (!store) return;
18576 return getInternal(store, "pick")(...args);
18577 }
18578 function mergeStore(...stores) {
18579 var _a;
18580 const initialState = {};
18581 for (const store2 of stores) {
18582 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
18583 if (nextState) {
18584 Object.assign(initialState, nextState);
18585 }
18586 }
18587 const store = createStore(initialState, ...stores);
18588 return Object.assign({}, ...stores, store);
18589 }
18590 function throwOnConflictingProps(props, store) {
18591 if (false) return;
18592 if (!store) return;
18593 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
18594 var _a;
18595 const stateKey = key.replace("default", "");
18596 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
18597 });
18598 if (!defaultKeys.length) return;
18599 const storeState = store.getState();
18600 const conflictingProps = defaultKeys.filter(
18601 (key) => hasOwnProperty(storeState, key)
18602 );
18603 if (!conflictingProps.length) return;
18604 throw new Error(
18605 `Passing a store prop in conjunction with a default state is not supported.
18606
18607 const store = useSelectStore();
18608 <SelectProvider store={store} defaultValue="Apple" />
18609 ^ ^
18610
18611 Instead, pass the default state to the topmost store:
18612
18613 const store = useSelectStore({ defaultValue: "Apple" });
18614 <SelectProvider store={store} />
18615
18616 See https://github.com/ariakit/ariakit/pull/2745 for more details.
18617
18618 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
18619 `
18620 );
18621 }
18622
18623 // node_modules/@ariakit/react-core/esm/__chunks/Q5W46E73.js
18624 var React61 = __toESM(require_react(), 1);
18625 var import_shim2 = __toESM(require_shim(), 1);
18626 var { useSyncExternalStore: useSyncExternalStore2 } = import_shim2.default;
18627 var noopSubscribe = () => () => {
18628 };
18629 function useStoreState(store, keyOrSelector = identity) {
18630 const storeSubscribe = React61.useCallback(
18631 (callback) => {
18632 if (!store) return noopSubscribe();
18633 return subscribe(store, null, callback);
18634 },
18635 [store]
18636 );
18637 const getSnapshot = () => {
18638 const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
18639 const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null;
18640 const state = store == null ? void 0 : store.getState();
18641 if (selector2) return selector2(state);
18642 if (!state) return;
18643 if (!key) return;
18644 if (!hasOwnProperty(state, key)) return;
18645 return state[key];
18646 };
18647 return useSyncExternalStore2(storeSubscribe, getSnapshot, getSnapshot);
18648 }
18649 function useStoreStateObject(store, object) {
18650 const objRef = React61.useRef(
18651 {}
18652 );
18653 const storeSubscribe = React61.useCallback(
18654 (callback) => {
18655 if (!store) return noopSubscribe();
18656 return subscribe(store, null, callback);
18657 },
18658 [store]
18659 );
18660 const getSnapshot = () => {
18661 const state = store == null ? void 0 : store.getState();
18662 let updated = false;
18663 const obj = objRef.current;
18664 for (const prop in object) {
18665 const keyOrSelector = object[prop];
18666 if (typeof keyOrSelector === "function") {
18667 const value = keyOrSelector(state);
18668 if (value !== obj[prop]) {
18669 obj[prop] = value;
18670 updated = true;
18671 }
18672 }
18673 if (typeof keyOrSelector === "string") {
18674 if (!state) continue;
18675 if (!hasOwnProperty(state, keyOrSelector)) continue;
18676 const value = state[keyOrSelector];
18677 if (value !== obj[prop]) {
18678 obj[prop] = value;
18679 updated = true;
18680 }
18681 }
18682 }
18683 if (updated) {
18684 objRef.current = { ...obj };
18685 }
18686 return objRef.current;
18687 };
18688 return useSyncExternalStore2(storeSubscribe, getSnapshot, getSnapshot);
18689 }
18690 function useStoreProps(store, props, key, setKey) {
18691 const value = hasOwnProperty(props, key) ? props[key] : void 0;
18692 const setValue = setKey ? props[setKey] : void 0;
18693 const propsRef = useLiveRef({ value, setValue });
18694 useSafeLayoutEffect(() => {
18695 return sync(store, [key], (state, prev) => {
18696 const { value: value2, setValue: setValue2 } = propsRef.current;
18697 if (!setValue2) return;
18698 if (state[key] === prev[key]) return;
18699 if (state[key] === value2) return;
18700 setValue2(state[key]);
18701 });
18702 }, [store, key]);
18703 useSafeLayoutEffect(() => {
18704 if (value === void 0) return;
18705 store.setState(key, value);
18706 return batch(store, [key], () => {
18707 if (value === void 0) return;
18708 store.setState(key, value);
18709 });
18710 });
18711 }
18712 function useStore2(createStore2, props) {
18713 const [store, setStore] = React61.useState(() => createStore2(props));
18714 useSafeLayoutEffect(() => init(store), [store]);
18715 const useState210 = React61.useCallback(
18716 (keyOrSelector) => useStoreState(store, keyOrSelector),
18717 [store]
18718 );
18719 const memoizedStore = React61.useMemo(
18720 () => ({ ...store, useState: useState210 }),
18721 [store, useState210]
18722 );
18723 const updateStore = useEvent(() => {
18724 setStore((store2) => createStore2({ ...props, ...store2.getState() }));
18725 });
18726 return [memoizedStore, updateStore];
18727 }
18728
18729 // node_modules/@ariakit/react-core/esm/__chunks/WZWDIE3S.js
18730 var import_react23 = __toESM(require_react(), 1);
18731 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
18732 var TagName4 = "button";
18733 function isEditableElement(element) {
18734 if (isTextbox(element)) return true;
18735 return element.tagName === "INPUT" && !isButton(element);
18736 }
18737 function getNextPageOffset(scrollingElement, pageUp = false) {
18738 const height = scrollingElement.clientHeight;
18739 const { top } = scrollingElement.getBoundingClientRect();
18740 const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
18741 const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
18742 if (scrollingElement.tagName === "HTML") {
18743 return pageOffset + scrollingElement.scrollTop;
18744 }
18745 return pageOffset;
18746 }
18747 function getItemOffset(itemElement, pageUp = false) {
18748 const { top } = itemElement.getBoundingClientRect();
18749 if (pageUp) {
18750 return top + itemElement.clientHeight;
18751 }
18752 return top;
18753 }
18754 function findNextPageItemId(element, store, next, pageUp = false) {
18755 var _a;
18756 if (!store) return;
18757 if (!next) return;
18758 const { renderedItems } = store.getState();
18759 const scrollingElement = getScrollingElement(element);
18760 if (!scrollingElement) return;
18761 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
18762 let id;
18763 let prevDifference;
18764 for (let i2 = 0; i2 < renderedItems.length; i2 += 1) {
18765 const previousId = id;
18766 id = next(i2);
18767 if (!id) break;
18768 if (id === previousId) continue;
18769 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element;
18770 if (!itemElement) continue;
18771 const itemOffset = getItemOffset(itemElement, pageUp);
18772 const difference = itemOffset - nextPageOffset;
18773 const absDifference = Math.abs(difference);
18774 if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
18775 if (prevDifference !== void 0 && prevDifference < absDifference) {
18776 id = previousId;
18777 }
18778 break;
18779 }
18780 prevDifference = absDifference;
18781 }
18782 return id;
18783 }
18784 function targetIsAnotherItem(event, store) {
18785 if (isSelfTarget(event)) return false;
18786 return isItem(store, event.target);
18787 }
18788 var useCompositeItem = createHook(
18789 function useCompositeItem2({
18790 store,
18791 rowId: rowIdProp,
18792 preventScrollOnKeyDown = false,
18793 moveOnKeyPress = true,
18794 tabbable: tabbable2 = false,
18795 getItem: getItemProp,
18796 "aria-setsize": ariaSetSizeProp,
18797 "aria-posinset": ariaPosInSetProp,
18798 ...props
18799 }) {
18800 const context = useCompositeContext();
18801 store = store || context;
18802 const id = useId5(props.id);
18803 const ref = (0, import_react23.useRef)(null);
18804 const row = (0, import_react23.useContext)(CompositeRowContext);
18805 const disabled2 = disabledFromProps(props);
18806 const trulyDisabled = disabled2 && !props.accessibleWhenDisabled;
18807 const {
18808 rowId,
18809 baseElement,
18810 isActiveItem,
18811 ariaSetSize,
18812 ariaPosInSet,
18813 isTabbable
18814 } = useStoreStateObject(store, {
18815 rowId(state) {
18816 if (rowIdProp) return rowIdProp;
18817 if (!state) return;
18818 if (!(row == null ? void 0 : row.baseElement)) return;
18819 if (row.baseElement !== state.baseElement) return;
18820 return row.id;
18821 },
18822 baseElement(state) {
18823 return (state == null ? void 0 : state.baseElement) || void 0;
18824 },
18825 isActiveItem(state) {
18826 return !!state && state.activeId === id;
18827 },
18828 ariaSetSize(state) {
18829 if (ariaSetSizeProp != null) return ariaSetSizeProp;
18830 if (!state) return;
18831 if (!(row == null ? void 0 : row.ariaSetSize)) return;
18832 if (row.baseElement !== state.baseElement) return;
18833 return row.ariaSetSize;
18834 },
18835 ariaPosInSet(state) {
18836 if (ariaPosInSetProp != null) return ariaPosInSetProp;
18837 if (!state) return;
18838 if (!(row == null ? void 0 : row.ariaPosInSet)) return;
18839 if (row.baseElement !== state.baseElement) return;
18840 const itemsInRow = state.renderedItems.filter(
18841 (item) => item.rowId === rowId
18842 );
18843 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
18844 },
18845 isTabbable(state) {
18846 if (!(state == null ? void 0 : state.renderedItems.length)) return true;
18847 if (state.virtualFocus) return false;
18848 if (tabbable2) return true;
18849 if (state.activeId === null) return false;
18850 const item = store == null ? void 0 : store.item(state.activeId);
18851 if (item == null ? void 0 : item.disabled) return true;
18852 if (!(item == null ? void 0 : item.element)) return true;
18853 return state.activeId === id;
18854 }
18855 });
18856 const getItem = (0, import_react23.useCallback)(
18857 (item) => {
18858 var _a;
18859 const nextItem = {
18860 ...item,
18861 id: id || item.id,
18862 rowId,
18863 disabled: !!trulyDisabled,
18864 children: (_a = item.element) == null ? void 0 : _a.textContent
18865 };
18866 if (getItemProp) {
18867 return getItemProp(nextItem);
18868 }
18869 return nextItem;
18870 },
18871 [id, rowId, trulyDisabled, getItemProp]
18872 );
18873 const onFocusProp = props.onFocus;
18874 const hasFocusedComposite = (0, import_react23.useRef)(false);
18875 const onFocus = useEvent((event) => {
18876 onFocusProp == null ? void 0 : onFocusProp(event);
18877 if (event.defaultPrevented) return;
18878 if (isPortalEvent(event)) return;
18879 if (!id) return;
18880 if (!store) return;
18881 if (targetIsAnotherItem(event, store)) return;
18882 const { virtualFocus, baseElement: baseElement2 } = store.getState();
18883 store.setActiveId(id);
18884 if (isTextbox(event.currentTarget)) {
18885 selectTextField(event.currentTarget);
18886 }
18887 if (!virtualFocus) return;
18888 if (!isSelfTarget(event)) return;
18889 if (isEditableElement(event.currentTarget)) return;
18890 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
18891 if (isSafari2() && event.currentTarget.hasAttribute("data-autofocus")) {
18892 event.currentTarget.scrollIntoView({
18893 block: "nearest",
18894 inline: "nearest"
18895 });
18896 }
18897 hasFocusedComposite.current = true;
18898 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget);
18899 if (fromComposite) {
18900 focusSilently(baseElement2);
18901 } else {
18902 baseElement2.focus();
18903 }
18904 });
18905 const onBlurCaptureProp = props.onBlurCapture;
18906 const onBlurCapture = useEvent((event) => {
18907 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
18908 if (event.defaultPrevented) return;
18909 const state = store == null ? void 0 : store.getState();
18910 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
18911 hasFocusedComposite.current = false;
18912 event.preventDefault();
18913 event.stopPropagation();
18914 }
18915 });
18916 const onKeyDownProp = props.onKeyDown;
18917 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
18918 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
18919 const onKeyDown = useEvent((event) => {
18920 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
18921 if (event.defaultPrevented) return;
18922 if (!isSelfTarget(event)) return;
18923 if (!store) return;
18924 const { currentTarget } = event;
18925 const state = store.getState();
18926 const item = store.item(id);
18927 const isGrid2 = !!(item == null ? void 0 : item.rowId);
18928 const isVertical = state.orientation !== "horizontal";
18929 const isHorizontal = state.orientation !== "vertical";
18930 const canHomeEnd = () => {
18931 if (isGrid2) return true;
18932 if (isHorizontal) return true;
18933 if (!state.baseElement) return true;
18934 if (!isTextField(state.baseElement)) return true;
18935 return false;
18936 };
18937 const keyMap = {
18938 ArrowUp: (isGrid2 || isVertical) && store.up,
18939 ArrowRight: (isGrid2 || isHorizontal) && store.next,
18940 ArrowDown: (isGrid2 || isVertical) && store.down,
18941 ArrowLeft: (isGrid2 || isHorizontal) && store.previous,
18942 Home: () => {
18943 if (!canHomeEnd()) return;
18944 if (!isGrid2 || event.ctrlKey) {
18945 return store == null ? void 0 : store.first();
18946 }
18947 return store == null ? void 0 : store.previous(-1);
18948 },
18949 End: () => {
18950 if (!canHomeEnd()) return;
18951 if (!isGrid2 || event.ctrlKey) {
18952 return store == null ? void 0 : store.last();
18953 }
18954 return store == null ? void 0 : store.next(-1);
18955 },
18956 PageUp: () => {
18957 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
18958 },
18959 PageDown: () => {
18960 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
18961 }
18962 };
18963 const action = keyMap[event.key];
18964 if (action) {
18965 if (isTextbox(currentTarget)) {
18966 const selection = getTextboxSelection(currentTarget);
18967 const isLeft = isHorizontal && event.key === "ArrowLeft";
18968 const isRight = isHorizontal && event.key === "ArrowRight";
18969 const isUp = isVertical && event.key === "ArrowUp";
18970 const isDown = isVertical && event.key === "ArrowDown";
18971 if (isRight || isDown) {
18972 const { length: valueLength } = getTextboxValue(currentTarget);
18973 if (selection.end !== valueLength) return;
18974 } else if ((isLeft || isUp) && selection.start !== 0) return;
18975 }
18976 const nextId = action();
18977 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
18978 if (!moveOnKeyPressProp(event)) return;
18979 event.preventDefault();
18980 store.move(nextId);
18981 }
18982 }
18983 });
18984 const providerValue = (0, import_react23.useMemo)(
18985 () => ({ id, baseElement }),
18986 [id, baseElement]
18987 );
18988 props = useWrapElement(
18989 props,
18990 (element) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
18991 [providerValue]
18992 );
18993 props = {
18994 id,
18995 "data-active-item": isActiveItem || void 0,
18996 ...props,
18997 ref: useMergeRefs(ref, props.ref),
18998 tabIndex: isTabbable ? props.tabIndex : -1,
18999 onFocus,
19000 onBlurCapture,
19001 onKeyDown
19002 };
19003 props = useCommand(props);
19004 props = useCollectionItem({
19005 store,
19006 ...props,
19007 getItem,
19008 shouldRegisterItem: id ? props.shouldRegisterItem : false
19009 });
19010 return removeUndefinedValues({
19011 ...props,
19012 "aria-setsize": ariaSetSize,
19013 "aria-posinset": ariaPosInSet
19014 });
19015 }
19016 );
19017 var CompositeItem = memo22(
19018 forwardRef210(function CompositeItem2(props) {
19019 const htmlProps = useCompositeItem(props);
19020 return createElement3(TagName4, htmlProps);
19021 })
19022 );
19023
19024 // node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
19025 function toArray(arg) {
19026 if (Array.isArray(arg)) {
19027 return arg;
19028 }
19029 return typeof arg !== "undefined" ? [arg] : [];
19030 }
19031 function flatten2DArray(array) {
19032 const flattened = [];
19033 for (const row of array) {
19034 flattened.push(...row);
19035 }
19036 return flattened;
19037 }
19038 function reverseArray(array) {
19039 return array.slice().reverse();
19040 }
19041
19042 // node_modules/@ariakit/react-core/esm/__chunks/ZMWF7ASR.js
19043 var import_react24 = __toESM(require_react(), 1);
19044 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
19045 var TagName5 = "div";
19046 function isGrid(items) {
19047 return items.some((item) => !!item.rowId);
19048 }
19049 function isPrintableKey(event) {
19050 const target = event.target;
19051 if (target && !isTextField(target)) return false;
19052 return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
19053 }
19054 function isModifierKey(event) {
19055 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
19056 }
19057 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
19058 return useEvent((event) => {
19059 var _a;
19060 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
19061 if (event.defaultPrevented) return;
19062 if (event.isPropagationStopped()) return;
19063 if (!isSelfTarget(event)) return;
19064 if (isModifierKey(event)) return;
19065 if (isPrintableKey(event)) return;
19066 const state = store.getState();
19067 const activeElement2 = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element;
19068 if (!activeElement2) return;
19069 const { view, ...eventInit } = event;
19070 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
19071 if (activeElement2 !== previousElement) {
19072 activeElement2.focus();
19073 }
19074 if (!fireKeyboardEvent(activeElement2, event.type, eventInit)) {
19075 event.preventDefault();
19076 }
19077 if (event.currentTarget.contains(activeElement2)) {
19078 event.stopPropagation();
19079 }
19080 });
19081 }
19082 function findFirstEnabledItemInTheLastRow(items) {
19083 return findFirstEnabledItem(
19084 flatten2DArray(reverseArray(groupItemsByRows(items)))
19085 );
19086 }
19087 function useScheduleFocus(store) {
19088 const [scheduled, setScheduled] = (0, import_react24.useState)(false);
19089 const schedule = (0, import_react24.useCallback)(() => setScheduled(true), []);
19090 const activeItem = store.useState(
19091 (state) => getEnabledItem(store, state.activeId)
19092 );
19093 (0, import_react24.useEffect)(() => {
19094 const activeElement2 = activeItem == null ? void 0 : activeItem.element;
19095 if (!scheduled) return;
19096 if (!activeElement2) return;
19097 setScheduled(false);
19098 activeElement2.focus({ preventScroll: true });
19099 }, [activeItem, scheduled]);
19100 return schedule;
19101 }
19102 var useComposite = createHook(
19103 function useComposite2({
19104 store,
19105 composite = true,
19106 focusOnMove = composite,
19107 moveOnKeyPress = true,
19108 ...props
19109 }) {
19110 const context = useCompositeProviderContext();
19111 store = store || context;
19112 invariant(
19113 store,
19114 "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
19115 );
19116 const ref = (0, import_react24.useRef)(null);
19117 const previousElementRef = (0, import_react24.useRef)(null);
19118 const scheduleFocus = useScheduleFocus(store);
19119 const moves = store.useState("moves");
19120 const [, setBaseElement] = useTransactionState(
19121 composite ? store.setBaseElement : null
19122 );
19123 (0, import_react24.useEffect)(() => {
19124 var _a;
19125 if (!store) return;
19126 if (!moves) return;
19127 if (!composite) return;
19128 if (!focusOnMove) return;
19129 const { activeId: activeId2 } = store.getState();
19130 const itemElement = (_a = getEnabledItem(store, activeId2)) == null ? void 0 : _a.element;
19131 if (!itemElement) return;
19132 focusIntoView(itemElement);
19133 }, [store, moves, composite, focusOnMove]);
19134 useSafeLayoutEffect(() => {
19135 if (!store) return;
19136 if (!moves) return;
19137 if (!composite) return;
19138 const { baseElement, activeId: activeId2 } = store.getState();
19139 const isSelfAcive = activeId2 === null;
19140 if (!isSelfAcive) return;
19141 if (!baseElement) return;
19142 const previousElement = previousElementRef.current;
19143 previousElementRef.current = null;
19144 if (previousElement) {
19145 fireBlurEvent(previousElement, { relatedTarget: baseElement });
19146 }
19147 if (!hasFocus(baseElement)) {
19148 baseElement.focus();
19149 }
19150 }, [store, moves, composite]);
19151 const activeId = store.useState("activeId");
19152 const virtualFocus = store.useState("virtualFocus");
19153 useSafeLayoutEffect(() => {
19154 var _a;
19155 if (!store) return;
19156 if (!composite) return;
19157 if (!virtualFocus) return;
19158 const previousElement = previousElementRef.current;
19159 previousElementRef.current = null;
19160 if (!previousElement) return;
19161 const activeElement2 = (_a = getEnabledItem(store, activeId)) == null ? void 0 : _a.element;
19162 const relatedTarget = activeElement2 || getActiveElement(previousElement);
19163 if (relatedTarget === previousElement) return;
19164 fireBlurEvent(previousElement, { relatedTarget });
19165 }, [store, activeId, virtualFocus, composite]);
19166 const onKeyDownCapture = useKeyboardEventProxy(
19167 store,
19168 props.onKeyDownCapture,
19169 previousElementRef
19170 );
19171 const onKeyUpCapture = useKeyboardEventProxy(
19172 store,
19173 props.onKeyUpCapture,
19174 previousElementRef
19175 );
19176 const onFocusCaptureProp = props.onFocusCapture;
19177 const onFocusCapture = useEvent((event) => {
19178 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
19179 if (event.defaultPrevented) return;
19180 if (!store) return;
19181 const { virtualFocus: virtualFocus2 } = store.getState();
19182 if (!virtualFocus2) return;
19183 const previousActiveElement = event.relatedTarget;
19184 const isSilentlyFocused = silentlyFocused(event.currentTarget);
19185 if (isSelfTarget(event) && isSilentlyFocused) {
19186 event.stopPropagation();
19187 previousElementRef.current = previousActiveElement;
19188 }
19189 });
19190 const onFocusProp = props.onFocus;
19191 const onFocus = useEvent((event) => {
19192 onFocusProp == null ? void 0 : onFocusProp(event);
19193 if (event.defaultPrevented) return;
19194 if (!composite) return;
19195 if (!store) return;
19196 const { relatedTarget } = event;
19197 const { virtualFocus: virtualFocus2 } = store.getState();
19198 if (virtualFocus2) {
19199 if (isSelfTarget(event) && !isItem(store, relatedTarget)) {
19200 queueMicrotask(scheduleFocus);
19201 }
19202 } else if (isSelfTarget(event)) {
19203 store.setActiveId(null);
19204 }
19205 });
19206 const onBlurCaptureProp = props.onBlurCapture;
19207 const onBlurCapture = useEvent((event) => {
19208 var _a;
19209 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
19210 if (event.defaultPrevented) return;
19211 if (!store) return;
19212 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
19213 if (!virtualFocus2) return;
19214 const activeElement2 = (_a = getEnabledItem(store, activeId2)) == null ? void 0 : _a.element;
19215 const nextActiveElement = event.relatedTarget;
19216 const nextActiveElementIsItem = isItem(store, nextActiveElement);
19217 const previousElement = previousElementRef.current;
19218 previousElementRef.current = null;
19219 if (isSelfTarget(event) && nextActiveElementIsItem) {
19220 if (nextActiveElement === activeElement2) {
19221 if (previousElement && previousElement !== nextActiveElement) {
19222 fireBlurEvent(previousElement, event);
19223 }
19224 } else if (activeElement2) {
19225 fireBlurEvent(activeElement2, event);
19226 } else if (previousElement) {
19227 fireBlurEvent(previousElement, event);
19228 }
19229 event.stopPropagation();
19230 } else {
19231 const targetIsItem = isItem(store, event.target);
19232 if (!targetIsItem && activeElement2) {
19233 fireBlurEvent(activeElement2, event);
19234 }
19235 }
19236 });
19237 const onKeyDownProp = props.onKeyDown;
19238 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
19239 const onKeyDown = useEvent((event) => {
19240 var _a;
19241 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
19242 if (event.nativeEvent.isComposing) return;
19243 if (event.defaultPrevented) return;
19244 if (!store) return;
19245 if (!isSelfTarget(event)) return;
19246 const { orientation, renderedItems, activeId: activeId2 } = store.getState();
19247 const activeItem = getEnabledItem(store, activeId2);
19248 if ((_a = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a.isConnected) return;
19249 const isVertical = orientation !== "horizontal";
19250 const isHorizontal = orientation !== "vertical";
19251 const grid = isGrid(renderedItems);
19252 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
19253 if (isHorizontalKey && isTextField(event.currentTarget)) return;
19254 const up = () => {
19255 if (grid) {
19256 const item = findFirstEnabledItemInTheLastRow(renderedItems);
19257 return item == null ? void 0 : item.id;
19258 }
19259 return store == null ? void 0 : store.last();
19260 };
19261 const keyMap = {
19262 ArrowUp: (grid || isVertical) && up,
19263 ArrowRight: (grid || isHorizontal) && store.first,
19264 ArrowDown: (grid || isVertical) && store.first,
19265 ArrowLeft: (grid || isHorizontal) && store.last,
19266 Home: store.first,
19267 End: store.last,
19268 PageUp: store.first,
19269 PageDown: store.last
19270 };
19271 const action = keyMap[event.key];
19272 if (action) {
19273 const id = action();
19274 if (id !== void 0) {
19275 if (!moveOnKeyPressProp(event)) return;
19276 event.preventDefault();
19277 store.move(id);
19278 }
19279 }
19280 });
19281 props = useWrapElement(
19282 props,
19283 (element) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(CompositeContextProvider, { value: store, children: element }),
19284 [store]
19285 );
19286 const activeDescendant = store.useState((state) => {
19287 var _a;
19288 if (!store) return;
19289 if (!composite) return;
19290 if (!state.virtualFocus) return;
19291 return (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.id;
19292 });
19293 props = {
19294 "aria-activedescendant": activeDescendant,
19295 ...props,
19296 ref: useMergeRefs(ref, setBaseElement, props.ref),
19297 onKeyDownCapture,
19298 onKeyUpCapture,
19299 onFocusCapture,
19300 onFocus,
19301 onBlurCapture,
19302 onKeyDown
19303 };
19304 const focusable2 = store.useState(
19305 (state) => composite && (state.virtualFocus || state.activeId === null)
19306 );
19307 props = useFocusable({ focusable: focusable2, ...props });
19308 return props;
19309 }
19310 );
19311 var Composite5 = forwardRef210(function Composite22(props) {
19312 const htmlProps = useComposite(props);
19313 return createElement3(TagName5, htmlProps);
19314 });
19315
19316 // node_modules/@ariakit/react-core/esm/__chunks/LVDQFHCH.js
19317 var ctx3 = createStoreContext();
19318 var useDisclosureContext = ctx3.useContext;
19319 var useDisclosureScopedContext = ctx3.useScopedContext;
19320 var useDisclosureProviderContext = ctx3.useProviderContext;
19321 var DisclosureContextProvider = ctx3.ContextProvider;
19322 var DisclosureScopedContextProvider = ctx3.ScopedContextProvider;
19323
19324 // node_modules/@ariakit/react-core/esm/__chunks/A62MDFCW.js
19325 var import_react25 = __toESM(require_react(), 1);
19326 var ctx4 = createStoreContext(
19327 [DisclosureContextProvider],
19328 [DisclosureScopedContextProvider]
19329 );
19330 var useDialogContext = ctx4.useContext;
19331 var useDialogScopedContext = ctx4.useScopedContext;
19332 var useDialogProviderContext = ctx4.useProviderContext;
19333 var DialogContextProvider = ctx4.ContextProvider;
19334 var DialogScopedContextProvider = ctx4.ScopedContextProvider;
19335 var DialogHeadingContext = (0, import_react25.createContext)(void 0);
19336 var DialogDescriptionContext = (0, import_react25.createContext)(void 0);
19337
19338 // node_modules/@ariakit/react-core/esm/__chunks/6B3RXHKP.js
19339 var import_react26 = __toESM(require_react(), 1);
19340 var import_react_dom4 = __toESM(require_react_dom(), 1);
19341 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
19342 var TagName6 = "div";
19343 function afterTimeout(timeoutMs, cb) {
19344 const timeoutId = setTimeout(cb, timeoutMs);
19345 return () => clearTimeout(timeoutId);
19346 }
19347 function afterPaint2(cb) {
19348 let raf = requestAnimationFrame(() => {
19349 raf = requestAnimationFrame(cb);
19350 });
19351 return () => cancelAnimationFrame(raf);
19352 }
19353 function parseCSSTime(...times) {
19354 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
19355 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
19356 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
19357 if (currentTime > longestTime) return currentTime;
19358 return longestTime;
19359 }, 0);
19360 }
19361 function isHidden(mounted, hidden, alwaysVisible) {
19362 return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
19363 }
19364 var useDisclosureContent = createHook(function useDisclosureContent2({ store, alwaysVisible, ...props }) {
19365 const context = useDisclosureProviderContext();
19366 store = store || context;
19367 invariant(
19368 store,
19369 "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."
19370 );
19371 const ref = (0, import_react26.useRef)(null);
19372 const id = useId5(props.id);
19373 const [transition, setTransition] = (0, import_react26.useState)(null);
19374 const open = store.useState("open");
19375 const mounted = store.useState("mounted");
19376 const animated = store.useState("animated");
19377 const contentElement = store.useState("contentElement");
19378 const otherElement = useStoreState(store.disclosure, "contentElement");
19379 useSafeLayoutEffect(() => {
19380 if (!ref.current) return;
19381 store == null ? void 0 : store.setContentElement(ref.current);
19382 }, [store]);
19383 useSafeLayoutEffect(() => {
19384 let previousAnimated;
19385 store == null ? void 0 : store.setState("animated", (animated2) => {
19386 previousAnimated = animated2;
19387 return true;
19388 });
19389 return () => {
19390 if (previousAnimated === void 0) return;
19391 store == null ? void 0 : store.setState("animated", previousAnimated);
19392 };
19393 }, [store]);
19394 useSafeLayoutEffect(() => {
19395 if (!animated) return;
19396 if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
19397 setTransition(null);
19398 return;
19399 }
19400 return afterPaint2(() => {
19401 setTransition(open ? "enter" : mounted ? "leave" : null);
19402 });
19403 }, [animated, contentElement, open, mounted]);
19404 useSafeLayoutEffect(() => {
19405 if (!store) return;
19406 if (!animated) return;
19407 if (!transition) return;
19408 if (!contentElement) return;
19409 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false);
19410 const stopAnimationSync = () => (0, import_react_dom4.flushSync)(stopAnimation);
19411 if (transition === "leave" && open) return;
19412 if (transition === "enter" && !open) return;
19413 if (typeof animated === "number") {
19414 const timeout2 = animated;
19415 return afterTimeout(timeout2, stopAnimationSync);
19416 }
19417 const {
19418 transitionDuration,
19419 animationDuration,
19420 transitionDelay,
19421 animationDelay
19422 } = getComputedStyle(contentElement);
19423 const {
19424 transitionDuration: transitionDuration2 = "0",
19425 animationDuration: animationDuration2 = "0",
19426 transitionDelay: transitionDelay2 = "0",
19427 animationDelay: animationDelay2 = "0"
19428 } = otherElement ? getComputedStyle(otherElement) : {};
19429 const delay = parseCSSTime(
19430 transitionDelay,
19431 animationDelay,
19432 transitionDelay2,
19433 animationDelay2
19434 );
19435 const duration = parseCSSTime(
19436 transitionDuration,
19437 animationDuration,
19438 transitionDuration2,
19439 animationDuration2
19440 );
19441 const timeout = delay + duration;
19442 if (!timeout) {
19443 if (transition === "enter") {
19444 store.setState("animated", false);
19445 }
19446 stopAnimation();
19447 return;
19448 }
19449 const frameRate = 1e3 / 60;
19450 const maxTimeout = Math.max(timeout - frameRate, 0);
19451 return afterTimeout(maxTimeout, stopAnimationSync);
19452 }, [store, animated, contentElement, otherElement, open, transition]);
19453 props = useWrapElement(
19454 props,
19455 (element) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DialogScopedContextProvider, { value: store, children: element }),
19456 [store]
19457 );
19458 const hidden = isHidden(mounted, props.hidden, alwaysVisible);
19459 const styleProp = props.style;
19460 const style = (0, import_react26.useMemo)(() => {
19461 if (hidden) {
19462 return { ...styleProp, display: "none" };
19463 }
19464 return styleProp;
19465 }, [hidden, styleProp]);
19466 props = {
19467 id,
19468 "data-open": open || void 0,
19469 "data-enter": transition === "enter" || void 0,
19470 "data-leave": transition === "leave" || void 0,
19471 hidden,
19472 ...props,
19473 ref: useMergeRefs(id ? store.setContentElement : null, ref, props.ref),
19474 style
19475 };
19476 return removeUndefinedValues(props);
19477 });
19478 var DisclosureContentImpl = forwardRef210(function DisclosureContentImpl2(props) {
19479 const htmlProps = useDisclosureContent(props);
19480 return createElement3(TagName6, htmlProps);
19481 });
19482 var DisclosureContent = forwardRef210(function DisclosureContent2({
19483 unmountOnHide,
19484 ...props
19485 }) {
19486 const context = useDisclosureProviderContext();
19487 const store = props.store || context;
19488 const mounted = useStoreState(
19489 store,
19490 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
19491 );
19492 if (mounted === false) return null;
19493 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DisclosureContentImpl, { ...props });
19494 });
19495
19496 // node_modules/@ariakit/core/esm/__chunks/75BJEVSH.js
19497 function createDisclosureStore(props = {}) {
19498 const store = mergeStore(
19499 props.store,
19500 omit2(props.disclosure, ["contentElement", "disclosureElement"])
19501 );
19502 throwOnConflictingProps(props, store);
19503 const syncState = store == null ? void 0 : store.getState();
19504 const open = defaultValue(
19505 props.open,
19506 syncState == null ? void 0 : syncState.open,
19507 props.defaultOpen,
19508 false
19509 );
19510 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
19511 const initialState = {
19512 open,
19513 animated,
19514 animating: !!animated && open,
19515 mounted: open,
19516 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
19517 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
19518 };
19519 const disclosure = createStore(initialState, store);
19520 setup(
19521 disclosure,
19522 () => sync(disclosure, ["animated", "animating"], (state) => {
19523 if (state.animated) return;
19524 disclosure.setState("animating", false);
19525 })
19526 );
19527 setup(
19528 disclosure,
19529 () => subscribe(disclosure, ["open"], () => {
19530 if (!disclosure.getState().animated) return;
19531 disclosure.setState("animating", true);
19532 })
19533 );
19534 setup(
19535 disclosure,
19536 () => sync(disclosure, ["open", "animating"], (state) => {
19537 disclosure.setState("mounted", state.open || state.animating);
19538 })
19539 );
19540 return {
19541 ...disclosure,
19542 disclosure: props.disclosure,
19543 setOpen: (value) => disclosure.setState("open", value),
19544 show: () => disclosure.setState("open", true),
19545 hide: () => disclosure.setState("open", false),
19546 toggle: () => disclosure.setState("open", (open2) => !open2),
19547 stopAnimation: () => disclosure.setState("animating", false),
19548 setContentElement: (value) => disclosure.setState("contentElement", value),
19549 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
19550 };
19551 }
19552
19553 // node_modules/@ariakit/react-core/esm/__chunks/WLZ6H5FH.js
19554 function useDisclosureStoreProps(store, update2, props) {
19555 useUpdateEffect(update2, [props.store, props.disclosure]);
19556 useStoreProps(store, props, "open", "setOpen");
19557 useStoreProps(store, props, "mounted", "setMounted");
19558 useStoreProps(store, props, "animated");
19559 return Object.assign(store, { disclosure: props.disclosure });
19560 }
19561
19562 // node_modules/@ariakit/react-core/esm/__chunks/JMU4N4M5.js
19563 var ctx5 = createStoreContext(
19564 [DialogContextProvider],
19565 [DialogScopedContextProvider]
19566 );
19567 var usePopoverContext = ctx5.useContext;
19568 var usePopoverScopedContext = ctx5.useScopedContext;
19569 var usePopoverProviderContext = ctx5.useProviderContext;
19570 var PopoverContextProvider = ctx5.ContextProvider;
19571 var PopoverScopedContextProvider = ctx5.ScopedContextProvider;
19572
19573 // node_modules/@ariakit/core/esm/__chunks/N5XGANPW.js
19574 function getCommonParent(items) {
19575 var _a;
19576 const firstItem = items.find((item) => !!item.element);
19577 const lastItem = [...items].reverse().find((item) => !!item.element);
19578 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
19579 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
19580 const parent = parentElement;
19581 if (lastItem && parent.contains(lastItem.element)) {
19582 return parentElement;
19583 }
19584 parentElement = parentElement.parentElement;
19585 }
19586 return getDocument(parentElement).body;
19587 }
19588 function getPrivateStore(store) {
19589 return store == null ? void 0 : store.__unstablePrivateStore;
19590 }
19591 function createCollectionStore(props = {}) {
19592 var _a;
19593 throwOnConflictingProps(props, props.store);
19594 const syncState = (_a = props.store) == null ? void 0 : _a.getState();
19595 const items = defaultValue(
19596 props.items,
19597 syncState == null ? void 0 : syncState.items,
19598 props.defaultItems,
19599 []
19600 );
19601 const itemsMap = new Map(items.map((item) => [item.id, item]));
19602 const initialState = {
19603 items,
19604 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
19605 };
19606 const syncPrivateStore = getPrivateStore(props.store);
19607 const privateStore = createStore(
19608 { items, renderedItems: initialState.renderedItems },
19609 syncPrivateStore
19610 );
19611 const collection = createStore(initialState, props.store);
19612 const sortItems = (renderedItems) => {
19613 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i2) => i2.element);
19614 privateStore.setState("renderedItems", sortedItems);
19615 collection.setState("renderedItems", sortedItems);
19616 };
19617 setup(collection, () => init(privateStore));
19618 setup(privateStore, () => {
19619 return batch(privateStore, ["items"], (state) => {
19620 collection.setState("items", state.items);
19621 });
19622 });
19623 setup(privateStore, () => {
19624 return batch(privateStore, ["renderedItems"], (state) => {
19625 let firstRun = true;
19626 let raf = requestAnimationFrame(() => {
19627 const { renderedItems } = collection.getState();
19628 if (state.renderedItems === renderedItems) return;
19629 sortItems(state.renderedItems);
19630 });
19631 if (typeof IntersectionObserver !== "function") {
19632 return () => cancelAnimationFrame(raf);
19633 }
19634 const ioCallback = () => {
19635 if (firstRun) {
19636 firstRun = false;
19637 return;
19638 }
19639 cancelAnimationFrame(raf);
19640 raf = requestAnimationFrame(() => sortItems(state.renderedItems));
19641 };
19642 const root = getCommonParent(state.renderedItems);
19643 const observer = new IntersectionObserver(ioCallback, { root });
19644 for (const item of state.renderedItems) {
19645 if (!item.element) continue;
19646 observer.observe(item.element);
19647 }
19648 return () => {
19649 cancelAnimationFrame(raf);
19650 observer.disconnect();
19651 };
19652 });
19653 });
19654 const mergeItem = (item, setItems, canDeleteFromMap = false) => {
19655 let prevItem;
19656 setItems((items2) => {
19657 const index2 = items2.findIndex(({ id }) => id === item.id);
19658 const nextItems = items2.slice();
19659 if (index2 !== -1) {
19660 prevItem = items2[index2];
19661 const nextItem = { ...prevItem, ...item };
19662 nextItems[index2] = nextItem;
19663 itemsMap.set(item.id, nextItem);
19664 } else {
19665 nextItems.push(item);
19666 itemsMap.set(item.id, item);
19667 }
19668 return nextItems;
19669 });
19670 const unmergeItem = () => {
19671 setItems((items2) => {
19672 if (!prevItem) {
19673 if (canDeleteFromMap) {
19674 itemsMap.delete(item.id);
19675 }
19676 return items2.filter(({ id }) => id !== item.id);
19677 }
19678 const index2 = items2.findIndex(({ id }) => id === item.id);
19679 if (index2 === -1) return items2;
19680 const nextItems = items2.slice();
19681 nextItems[index2] = prevItem;
19682 itemsMap.set(item.id, prevItem);
19683 return nextItems;
19684 });
19685 };
19686 return unmergeItem;
19687 };
19688 const registerItem = (item) => mergeItem(
19689 item,
19690 (getItems) => privateStore.setState("items", getItems),
19691 true
19692 );
19693 return {
19694 ...collection,
19695 registerItem,
19696 renderItem: (item) => chain(
19697 registerItem(item),
19698 mergeItem(
19699 item,
19700 (getItems) => privateStore.setState("renderedItems", getItems)
19701 )
19702 ),
19703 item: (id) => {
19704 if (!id) return null;
19705 let item = itemsMap.get(id);
19706 if (!item) {
19707 const { items: items2 } = privateStore.getState();
19708 item = items2.find((item2) => item2.id === id);
19709 if (item) {
19710 itemsMap.set(id, item);
19711 }
19712 }
19713 return item || null;
19714 },
19715 // @ts-expect-error Internal
19716 __unstablePrivateStore: privateStore
19717 };
19718 }
19719
19720 // node_modules/@ariakit/react-core/esm/__chunks/GVAFFF2B.js
19721 function useCollectionStoreProps(store, update2, props) {
19722 useUpdateEffect(update2, [props.store]);
19723 useStoreProps(store, props, "items", "setItems");
19724 return store;
19725 }
19726
19727 // node_modules/@ariakit/core/esm/__chunks/RVTIKFRL.js
19728 var NULL_ITEM = { id: null };
19729 function findFirstEnabledItem2(items, excludeId) {
19730 return items.find((item) => {
19731 if (excludeId) {
19732 return !item.disabled && item.id !== excludeId;
19733 }
19734 return !item.disabled;
19735 });
19736 }
19737 function getEnabledItems(items, excludeId) {
19738 return items.filter((item) => {
19739 if (excludeId) {
19740 return !item.disabled && item.id !== excludeId;
19741 }
19742 return !item.disabled;
19743 });
19744 }
19745 function getItemsInRow(items, rowId) {
19746 return items.filter((item) => item.rowId === rowId);
19747 }
19748 function flipItems(items, activeId, shouldInsertNullItem = false) {
19749 const index2 = items.findIndex((item) => item.id === activeId);
19750 return [
19751 ...items.slice(index2 + 1),
19752 ...shouldInsertNullItem ? [NULL_ITEM] : [],
19753 ...items.slice(0, index2)
19754 ];
19755 }
19756 function groupItemsByRows2(items) {
19757 const rows = [];
19758 for (const item of items) {
19759 const row = rows.find((currentRow) => {
19760 var _a;
19761 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
19762 });
19763 if (row) {
19764 row.push(item);
19765 } else {
19766 rows.push([item]);
19767 }
19768 }
19769 return rows;
19770 }
19771 function getMaxRowLength(array) {
19772 let maxLength = 0;
19773 for (const { length } of array) {
19774 if (length > maxLength) {
19775 maxLength = length;
19776 }
19777 }
19778 return maxLength;
19779 }
19780 function createEmptyItem(rowId) {
19781 return {
19782 id: "__EMPTY_ITEM__",
19783 disabled: true,
19784 rowId
19785 };
19786 }
19787 function normalizeRows(rows, activeId, focusShift) {
19788 const maxLength = getMaxRowLength(rows);
19789 for (const row of rows) {
19790 for (let i2 = 0; i2 < maxLength; i2 += 1) {
19791 const item = row[i2];
19792 if (!item || focusShift && item.disabled) {
19793 const isFirst = i2 === 0;
19794 const previousItem = isFirst && focusShift ? findFirstEnabledItem2(row) : row[i2 - 1];
19795 row[i2] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
19796 }
19797 }
19798 }
19799 return rows;
19800 }
19801 function verticalizeItems(items) {
19802 const rows = groupItemsByRows2(items);
19803 const maxLength = getMaxRowLength(rows);
19804 const verticalized = [];
19805 for (let i2 = 0; i2 < maxLength; i2 += 1) {
19806 for (const row of rows) {
19807 const item = row[i2];
19808 if (item) {
19809 verticalized.push({
19810 ...item,
19811 // If there's no rowId, it means that it's not a grid composite, but
19812 // a single row instead. So, instead of verticalizing it, that is,
19813 // assigning a different rowId based on the column index, we keep it
19814 // undefined so they will be part of the same row. This is useful
19815 // when using up/down on one-dimensional composites.
19816 rowId: item.rowId ? `${i2}` : void 0
19817 });
19818 }
19819 }
19820 }
19821 return verticalized;
19822 }
19823 function createCompositeStore(props = {}) {
19824 var _a;
19825 const syncState = (_a = props.store) == null ? void 0 : _a.getState();
19826 const collection = createCollectionStore(props);
19827 const activeId = defaultValue(
19828 props.activeId,
19829 syncState == null ? void 0 : syncState.activeId,
19830 props.defaultActiveId
19831 );
19832 const initialState = {
19833 ...collection.getState(),
19834 id: defaultValue(
19835 props.id,
19836 syncState == null ? void 0 : syncState.id,
19837 `id-${Math.random().toString(36).slice(2, 8)}`
19838 ),
19839 activeId,
19840 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
19841 includesBaseElement: defaultValue(
19842 props.includesBaseElement,
19843 syncState == null ? void 0 : syncState.includesBaseElement,
19844 activeId === null
19845 ),
19846 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
19847 orientation: defaultValue(
19848 props.orientation,
19849 syncState == null ? void 0 : syncState.orientation,
19850 "both"
19851 ),
19852 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
19853 virtualFocus: defaultValue(
19854 props.virtualFocus,
19855 syncState == null ? void 0 : syncState.virtualFocus,
19856 false
19857 ),
19858 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
19859 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
19860 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
19861 };
19862 const composite = createStore(initialState, collection, props.store);
19863 setup(
19864 composite,
19865 () => sync(composite, ["renderedItems", "activeId"], (state) => {
19866 composite.setState("activeId", (activeId2) => {
19867 var _a2;
19868 if (activeId2 !== void 0) return activeId2;
19869 return (_a2 = findFirstEnabledItem2(state.renderedItems)) == null ? void 0 : _a2.id;
19870 });
19871 })
19872 );
19873 const getNextId = (direction = "next", options = {}) => {
19874 var _a2, _b;
19875 const defaultState = composite.getState();
19876 const {
19877 skip = 0,
19878 activeId: activeId2 = defaultState.activeId,
19879 focusShift = defaultState.focusShift,
19880 focusLoop = defaultState.focusLoop,
19881 focusWrap = defaultState.focusWrap,
19882 includesBaseElement = defaultState.includesBaseElement,
19883 renderedItems = defaultState.renderedItems,
19884 rtl = defaultState.rtl
19885 } = options;
19886 const isVerticalDirection = direction === "up" || direction === "down";
19887 const isNextDirection = direction === "next" || direction === "down";
19888 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
19889 const canShift = focusShift && !skip;
19890 let items = !isVerticalDirection ? renderedItems : flatten2DArray(
19891 normalizeRows(groupItemsByRows2(renderedItems), activeId2, canShift)
19892 );
19893 items = canReverse ? reverseArray(items) : items;
19894 items = isVerticalDirection ? verticalizeItems(items) : items;
19895 if (activeId2 == null) {
19896 return (_a2 = findFirstEnabledItem2(items)) == null ? void 0 : _a2.id;
19897 }
19898 const activeItem = items.find((item) => item.id === activeId2);
19899 if (!activeItem) {
19900 return (_b = findFirstEnabledItem2(items)) == null ? void 0 : _b.id;
19901 }
19902 const isGrid2 = items.some((item) => item.rowId);
19903 const activeIndex = items.indexOf(activeItem);
19904 const nextItems = items.slice(activeIndex + 1);
19905 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
19906 if (skip) {
19907 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
19908 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
19909 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
19910 return nextItem2 == null ? void 0 : nextItem2.id;
19911 }
19912 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
19913 const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
19914 const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
19915 if (canLoop) {
19916 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
19917 const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
19918 const nextItem2 = findFirstEnabledItem2(sortedItems, activeId2);
19919 return nextItem2 == null ? void 0 : nextItem2.id;
19920 }
19921 if (canWrap) {
19922 const nextItem2 = findFirstEnabledItem2(
19923 // We can use nextItems, which contains all the next items, including
19924 // items from other rows, to wrap between rows. However, if there is a
19925 // null item (the composite container), we'll only use the next items in
19926 // the row. So moving next from the last item will focus on the
19927 // composite container. On grid composites, horizontal navigation never
19928 // focuses on the composite container, only vertical.
19929 hasNullItem ? nextItemsInRow : nextItems,
19930 activeId2
19931 );
19932 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
19933 return nextId;
19934 }
19935 const nextItem = findFirstEnabledItem2(nextItemsInRow, activeId2);
19936 if (!nextItem && hasNullItem) {
19937 return null;
19938 }
19939 return nextItem == null ? void 0 : nextItem.id;
19940 };
19941 return {
19942 ...collection,
19943 ...composite,
19944 setBaseElement: (element) => composite.setState("baseElement", element),
19945 setActiveId: (id) => composite.setState("activeId", id),
19946 move: (id) => {
19947 if (id === void 0) return;
19948 composite.setState("activeId", id);
19949 composite.setState("moves", (moves) => moves + 1);
19950 },
19951 first: () => {
19952 var _a2;
19953 return (_a2 = findFirstEnabledItem2(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
19954 },
19955 last: () => {
19956 var _a2;
19957 return (_a2 = findFirstEnabledItem2(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
19958 },
19959 next: (options) => {
19960 if (options !== void 0 && typeof options === "number") {
19961 options = { skip: options };
19962 }
19963 return getNextId("next", options);
19964 },
19965 previous: (options) => {
19966 if (options !== void 0 && typeof options === "number") {
19967 options = { skip: options };
19968 }
19969 return getNextId("previous", options);
19970 },
19971 down: (options) => {
19972 if (options !== void 0 && typeof options === "number") {
19973 options = { skip: options };
19974 }
19975 return getNextId("down", options);
19976 },
19977 up: (options) => {
19978 if (options !== void 0 && typeof options === "number") {
19979 options = { skip: options };
19980 }
19981 return getNextId("up", options);
19982 }
19983 };
19984 }
19985
19986 // node_modules/@ariakit/react-core/esm/__chunks/IQYAUKXT.js
19987 function useCompositeStoreOptions(props) {
19988 const id = useId5(props.id);
19989 return { id, ...props };
19990 }
19991 function useCompositeStoreProps(store, update2, props) {
19992 store = useCollectionStoreProps(store, update2, props);
19993 useStoreProps(store, props, "activeId", "setActiveId");
19994 useStoreProps(store, props, "includesBaseElement");
19995 useStoreProps(store, props, "virtualFocus");
19996 useStoreProps(store, props, "orientation");
19997 useStoreProps(store, props, "rtl");
19998 useStoreProps(store, props, "focusLoop");
19999 useStoreProps(store, props, "focusWrap");
20000 useStoreProps(store, props, "focusShift");
20001 return store;
20002 }
20003
20004 // node_modules/@ariakit/react-core/esm/__chunks/CVCFNOHX.js
20005 var import_react27 = __toESM(require_react(), 1);
20006 var ComboboxListRoleContext = (0, import_react27.createContext)(
20007 void 0
20008 );
20009 var ctx6 = createStoreContext(
20010 [PopoverContextProvider, CompositeContextProvider],
20011 [PopoverScopedContextProvider, CompositeScopedContextProvider]
20012 );
20013 var useComboboxContext = ctx6.useContext;
20014 var useComboboxScopedContext = ctx6.useScopedContext;
20015 var useComboboxProviderContext = ctx6.useProviderContext;
20016 var ComboboxContextProvider = ctx6.ContextProvider;
20017 var ComboboxScopedContextProvider = ctx6.ScopedContextProvider;
20018 var ComboboxItemValueContext = (0, import_react27.createContext)(
20019 void 0
20020 );
20021 var ComboboxItemCheckedContext = (0, import_react27.createContext)(false);
20022
20023 // node_modules/@ariakit/core/esm/__chunks/KMAUV3TY.js
20024 function createDialogStore(props = {}) {
20025 return createDisclosureStore(props);
20026 }
20027
20028 // node_modules/@ariakit/react-core/esm/__chunks/4NYSH4UO.js
20029 function useDialogStoreProps(store, update2, props) {
20030 return useDisclosureStoreProps(store, update2, props);
20031 }
20032
20033 // node_modules/@ariakit/core/esm/__chunks/BFGNM53A.js
20034 function createPopoverStore({
20035 popover: otherPopover,
20036 ...props
20037 } = {}) {
20038 const store = mergeStore(
20039 props.store,
20040 omit2(otherPopover, [
20041 "arrowElement",
20042 "anchorElement",
20043 "contentElement",
20044 "popoverElement",
20045 "disclosureElement"
20046 ])
20047 );
20048 throwOnConflictingProps(props, store);
20049 const syncState = store == null ? void 0 : store.getState();
20050 const dialog = createDialogStore({ ...props, store });
20051 const placement = defaultValue(
20052 props.placement,
20053 syncState == null ? void 0 : syncState.placement,
20054 "bottom"
20055 );
20056 const initialState = {
20057 ...dialog.getState(),
20058 placement,
20059 currentPlacement: placement,
20060 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
20061 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
20062 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
20063 rendered: /* @__PURE__ */ Symbol("rendered")
20064 };
20065 const popover = createStore(initialState, dialog, store);
20066 return {
20067 ...dialog,
20068 ...popover,
20069 setAnchorElement: (element) => popover.setState("anchorElement", element),
20070 setPopoverElement: (element) => popover.setState("popoverElement", element),
20071 setArrowElement: (element) => popover.setState("arrowElement", element),
20072 render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered"))
20073 };
20074 }
20075
20076 // node_modules/@ariakit/react-core/esm/__chunks/B6FLPFJM.js
20077 function usePopoverStoreProps(store, update2, props) {
20078 useUpdateEffect(update2, [props.popover]);
20079 useStoreProps(store, props, "placement");
20080 return useDialogStoreProps(store, update2, props);
20081 }
20082
20083 // node_modules/@ariakit/react-core/esm/__chunks/4POTBZ2J.js
20084 var TagName7 = "div";
20085 var usePopoverAnchor = createHook(
20086 function usePopoverAnchor2({ store, ...props }) {
20087 const context = usePopoverProviderContext();
20088 store = store || context;
20089 props = {
20090 ...props,
20091 ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref)
20092 };
20093 return props;
20094 }
20095 );
20096 var PopoverAnchor = forwardRef210(function PopoverAnchor2(props) {
20097 const htmlProps = usePopoverAnchor(props);
20098 return createElement3(TagName7, htmlProps);
20099 });
20100
20101 // node_modules/@ariakit/react-core/esm/__chunks/X6LNAU2F.js
20102 var import_react28 = __toESM(require_react(), 1);
20103 var TagName8 = "div";
20104 function getMouseDestination(event) {
20105 const relatedTarget = event.relatedTarget;
20106 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
20107 return relatedTarget;
20108 }
20109 return null;
20110 }
20111 function hoveringInside(event) {
20112 const nextElement = getMouseDestination(event);
20113 if (!nextElement) return false;
20114 return contains2(event.currentTarget, nextElement);
20115 }
20116 var symbol2 = /* @__PURE__ */ Symbol("composite-hover");
20117 function movingToAnotherItem(event) {
20118 let dest = getMouseDestination(event);
20119 if (!dest) return false;
20120 do {
20121 if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true;
20122 dest = dest.parentElement;
20123 } while (dest);
20124 return false;
20125 }
20126 var useCompositeHover = createHook(
20127 function useCompositeHover2({
20128 store,
20129 focusOnHover = true,
20130 blurOnHoverEnd = !!focusOnHover,
20131 ...props
20132 }) {
20133 const context = useCompositeContext();
20134 store = store || context;
20135 invariant(
20136 store,
20137 "CompositeHover must be wrapped in a Composite component."
20138 );
20139 const isMouseMoving = useIsMouseMoving();
20140 const onMouseMoveProp = props.onMouseMove;
20141 const focusOnHoverProp = useBooleanEvent(focusOnHover);
20142 const onMouseMove = useEvent((event) => {
20143 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
20144 if (event.defaultPrevented) return;
20145 if (!isMouseMoving()) return;
20146 if (!focusOnHoverProp(event)) return;
20147 if (!hasFocusWithin(event.currentTarget)) {
20148 const baseElement = store == null ? void 0 : store.getState().baseElement;
20149 if (baseElement && !hasFocus(baseElement)) {
20150 baseElement.focus();
20151 }
20152 }
20153 store == null ? void 0 : store.setActiveId(event.currentTarget.id);
20154 });
20155 const onMouseLeaveProp = props.onMouseLeave;
20156 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
20157 const onMouseLeave = useEvent((event) => {
20158 var _a;
20159 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
20160 if (event.defaultPrevented) return;
20161 if (!isMouseMoving()) return;
20162 if (hoveringInside(event)) return;
20163 if (movingToAnotherItem(event)) return;
20164 if (!focusOnHoverProp(event)) return;
20165 if (!blurOnHoverEndProp(event)) return;
20166 store == null ? void 0 : store.setActiveId(null);
20167 (_a = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a.focus();
20168 });
20169 const ref = (0, import_react28.useCallback)((element) => {
20170 if (!element) return;
20171 element[symbol2] = true;
20172 }, []);
20173 props = {
20174 ...props,
20175 ref: useMergeRefs(ref, props.ref),
20176 onMouseMove,
20177 onMouseLeave
20178 };
20179 return removeUndefinedValues(props);
20180 }
20181 );
20182 var CompositeHover = memo22(
20183 forwardRef210(function CompositeHover2(props) {
20184 const htmlProps = useCompositeHover(props);
20185 return createElement3(TagName8, htmlProps);
20186 })
20187 );
20188
20189 // node_modules/@ariakit/react-core/esm/combobox/combobox.js
20190 var import_react29 = __toESM(require_react(), 1);
20191 var TagName9 = "input";
20192 function isFirstItemAutoSelected(items, activeValue, autoSelect) {
20193 if (!autoSelect) return false;
20194 const firstItem = items.find((item) => !item.disabled && item.value);
20195 return (firstItem == null ? void 0 : firstItem.value) === activeValue;
20196 }
20197 function hasCompletionString(value, activeValue) {
20198 if (!activeValue) return false;
20199 if (value == null) return false;
20200 value = normalizeString(value);
20201 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0;
20202 }
20203 function isInputEvent(event) {
20204 return event.type === "input";
20205 }
20206 function isAriaAutoCompleteValue(value) {
20207 return value === "inline" || value === "list" || value === "both" || value === "none";
20208 }
20209 function getDefaultAutoSelectId(items) {
20210 const item = items.find((item2) => {
20211 var _a;
20212 if (item2.disabled) return false;
20213 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab";
20214 });
20215 return item == null ? void 0 : item.id;
20216 }
20217 var useCombobox = createHook(
20218 function useCombobox2({
20219 store,
20220 focusable: focusable2 = true,
20221 autoSelect: autoSelectProp = false,
20222 getAutoSelectId,
20223 setValueOnChange,
20224 showMinLength = 0,
20225 showOnChange,
20226 showOnMouseDown,
20227 showOnClick = showOnMouseDown,
20228 showOnKeyDown,
20229 showOnKeyPress = showOnKeyDown,
20230 blurActiveItemOnClick,
20231 setValueOnClick = true,
20232 moveOnKeyPress = true,
20233 autoComplete = "list",
20234 ...props
20235 }) {
20236 const context = useComboboxProviderContext();
20237 store = store || context;
20238 invariant(
20239 store,
20240 "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."
20241 );
20242 const ref = (0, import_react29.useRef)(null);
20243 const [valueUpdated, forceValueUpdate] = useForceUpdate();
20244 const canAutoSelectRef = (0, import_react29.useRef)(false);
20245 const composingRef = (0, import_react29.useRef)(false);
20246 const autoSelect = store.useState(
20247 (state) => state.virtualFocus && autoSelectProp
20248 );
20249 const inline4 = autoComplete === "inline" || autoComplete === "both";
20250 const [canInline, setCanInline] = (0, import_react29.useState)(inline4);
20251 useUpdateLayoutEffect(() => {
20252 if (!inline4) return;
20253 setCanInline(true);
20254 }, [inline4]);
20255 const storeValue = store.useState("value");
20256 const prevSelectedValueRef = (0, import_react29.useRef)(void 0);
20257 (0, import_react29.useEffect)(() => {
20258 return sync(store, ["selectedValue", "activeId"], (_, prev) => {
20259 prevSelectedValueRef.current = prev.selectedValue;
20260 });
20261 }, []);
20262 const inlineActiveValue = store.useState((state) => {
20263 var _a;
20264 if (!inline4) return;
20265 if (!canInline) return;
20266 if (state.activeValue && Array.isArray(state.selectedValue)) {
20267 if (state.selectedValue.includes(state.activeValue)) return;
20268 if ((_a = prevSelectedValueRef.current) == null ? void 0 : _a.includes(state.activeValue)) return;
20269 }
20270 return state.activeValue;
20271 });
20272 const items = store.useState("renderedItems");
20273 const open = store.useState("open");
20274 const contentElement = store.useState("contentElement");
20275 const value = (0, import_react29.useMemo)(() => {
20276 if (!inline4) return storeValue;
20277 if (!canInline) return storeValue;
20278 const firstItemAutoSelected = isFirstItemAutoSelected(
20279 items,
20280 inlineActiveValue,
20281 autoSelect
20282 );
20283 if (firstItemAutoSelected) {
20284 if (hasCompletionString(storeValue, inlineActiveValue)) {
20285 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || "";
20286 return storeValue + slice;
20287 }
20288 return storeValue;
20289 }
20290 return inlineActiveValue || storeValue;
20291 }, [inline4, canInline, items, inlineActiveValue, autoSelect, storeValue]);
20292 (0, import_react29.useEffect)(() => {
20293 const element = ref.current;
20294 if (!element) return;
20295 const onCompositeItemMove = () => setCanInline(true);
20296 element.addEventListener("combobox-item-move", onCompositeItemMove);
20297 return () => {
20298 element.removeEventListener("combobox-item-move", onCompositeItemMove);
20299 };
20300 }, []);
20301 (0, import_react29.useEffect)(() => {
20302 if (!inline4) return;
20303 if (!canInline) return;
20304 if (!inlineActiveValue) return;
20305 const firstItemAutoSelected = isFirstItemAutoSelected(
20306 items,
20307 inlineActiveValue,
20308 autoSelect
20309 );
20310 if (!firstItemAutoSelected) return;
20311 if (!hasCompletionString(storeValue, inlineActiveValue)) return;
20312 let cleanup = noop4;
20313 queueMicrotask(() => {
20314 const element = ref.current;
20315 if (!element) return;
20316 const { start: prevStart, end: prevEnd } = getTextboxSelection(element);
20317 const nextStart = storeValue.length;
20318 const nextEnd = inlineActiveValue.length;
20319 setSelectionRange(element, nextStart, nextEnd);
20320 cleanup = () => {
20321 if (!hasFocus(element)) return;
20322 const { start, end } = getTextboxSelection(element);
20323 if (start !== nextStart) return;
20324 if (end !== nextEnd) return;
20325 setSelectionRange(element, prevStart, prevEnd);
20326 };
20327 });
20328 return () => cleanup();
20329 }, [
20330 valueUpdated,
20331 inline4,
20332 canInline,
20333 inlineActiveValue,
20334 items,
20335 autoSelect,
20336 storeValue
20337 ]);
20338 const scrollingElementRef = (0, import_react29.useRef)(null);
20339 const getAutoSelectIdProp = useEvent(getAutoSelectId);
20340 const autoSelectIdRef = (0, import_react29.useRef)(null);
20341 (0, import_react29.useEffect)(() => {
20342 if (!open) return;
20343 if (!contentElement) return;
20344 const scrollingElement = getScrollingElement(contentElement);
20345 if (!scrollingElement) return;
20346 scrollingElementRef.current = scrollingElement;
20347 const onUserScroll = () => {
20348 canAutoSelectRef.current = false;
20349 };
20350 const onScroll = () => {
20351 if (!store) return;
20352 if (!canAutoSelectRef.current) return;
20353 const { activeId } = store.getState();
20354 if (activeId === null) return;
20355 if (activeId === autoSelectIdRef.current) return;
20356 canAutoSelectRef.current = false;
20357 };
20358 const options = { passive: true, capture: true };
20359 scrollingElement.addEventListener("wheel", onUserScroll, options);
20360 scrollingElement.addEventListener("touchmove", onUserScroll, options);
20361 scrollingElement.addEventListener("scroll", onScroll, options);
20362 return () => {
20363 scrollingElement.removeEventListener("wheel", onUserScroll, true);
20364 scrollingElement.removeEventListener("touchmove", onUserScroll, true);
20365 scrollingElement.removeEventListener("scroll", onScroll, true);
20366 };
20367 }, [open, contentElement, store]);
20368 useSafeLayoutEffect(() => {
20369 if (!storeValue) return;
20370 if (composingRef.current) return;
20371 canAutoSelectRef.current = true;
20372 }, [storeValue]);
20373 useSafeLayoutEffect(() => {
20374 if (autoSelect !== "always" && open) return;
20375 canAutoSelectRef.current = open;
20376 }, [autoSelect, open]);
20377 const resetValueOnSelect = store.useState("resetValueOnSelect");
20378 useUpdateEffect(() => {
20379 var _a, _b;
20380 const canAutoSelect = canAutoSelectRef.current;
20381 if (!store) return;
20382 if (!open) return;
20383 if (!canAutoSelect && !resetValueOnSelect) return;
20384 const { baseElement, contentElement: contentElement2, activeId } = store.getState();
20385 if (baseElement && !hasFocus(baseElement)) return;
20386 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
20387 const observer = new MutationObserver(forceValueUpdate);
20388 observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
20389 return () => observer.disconnect();
20390 }
20391 if (autoSelect && canAutoSelect) {
20392 const userAutoSelectId = getAutoSelectIdProp(items);
20393 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a = getDefaultAutoSelectId(items)) != null ? _a : store.first();
20394 autoSelectIdRef.current = autoSelectId;
20395 store.move(autoSelectId != null ? autoSelectId : null);
20396 } else {
20397 const element = (_b = store.item(activeId || store.first())) == null ? void 0 : _b.element;
20398 if (element && "scrollIntoView" in element) {
20399 element.scrollIntoView({ block: "nearest", inline: "nearest" });
20400 }
20401 }
20402 return;
20403 }, [
20404 store,
20405 open,
20406 valueUpdated,
20407 storeValue,
20408 autoSelect,
20409 resetValueOnSelect,
20410 getAutoSelectIdProp,
20411 items
20412 ]);
20413 (0, import_react29.useEffect)(() => {
20414 if (!inline4) return;
20415 const combobox = ref.current;
20416 if (!combobox) return;
20417 const elements = [combobox, contentElement].filter(
20418 (value2) => !!value2
20419 );
20420 const onBlur2 = (event) => {
20421 if (elements.every((el) => isFocusEventOutside(event, el))) {
20422 store == null ? void 0 : store.setValue(value);
20423 }
20424 };
20425 for (const element of elements) {
20426 element.addEventListener("focusout", onBlur2);
20427 }
20428 return () => {
20429 for (const element of elements) {
20430 element.removeEventListener("focusout", onBlur2);
20431 }
20432 };
20433 }, [inline4, contentElement, store, value]);
20434 const canShow = (event) => {
20435 const currentTarget = event.currentTarget;
20436 return currentTarget.value.length >= showMinLength;
20437 };
20438 const onChangeProp = props.onChange;
20439 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow);
20440 const setValueOnChangeProp = useBooleanEvent(
20441 // If the combobox is combined with tags, the value will be set by the tag
20442 // input component.
20443 setValueOnChange != null ? setValueOnChange : !store.tag
20444 );
20445 const onChange = useEvent((event) => {
20446 onChangeProp == null ? void 0 : onChangeProp(event);
20447 if (event.defaultPrevented) return;
20448 if (!store) return;
20449 const currentTarget = event.currentTarget;
20450 const { value: value2, selectionStart, selectionEnd } = currentTarget;
20451 const nativeEvent = event.nativeEvent;
20452 canAutoSelectRef.current = true;
20453 if (isInputEvent(nativeEvent)) {
20454 if (nativeEvent.isComposing) {
20455 canAutoSelectRef.current = false;
20456 composingRef.current = true;
20457 }
20458 if (inline4) {
20459 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText";
20460 const caretAtEnd = selectionStart === value2.length;
20461 setCanInline(textInserted && caretAtEnd);
20462 }
20463 }
20464 if (setValueOnChangeProp(event)) {
20465 const isSameValue = value2 === store.getState().value;
20466 store.setValue(value2);
20467 queueMicrotask(() => {
20468 setSelectionRange(currentTarget, selectionStart, selectionEnd);
20469 });
20470 if (inline4 && autoSelect && isSameValue) {
20471 forceValueUpdate();
20472 }
20473 }
20474 if (showOnChangeProp(event)) {
20475 store.show();
20476 }
20477 if (!autoSelect || !canAutoSelectRef.current) {
20478 store.setActiveId(null);
20479 }
20480 });
20481 const onCompositionEndProp = props.onCompositionEnd;
20482 const onCompositionEnd = useEvent((event) => {
20483 canAutoSelectRef.current = true;
20484 composingRef.current = false;
20485 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event);
20486 if (event.defaultPrevented) return;
20487 if (!autoSelect) return;
20488 forceValueUpdate();
20489 });
20490 const onMouseDownProp = props.onMouseDown;
20491 const blurActiveItemOnClickProp = useBooleanEvent(
20492 blurActiveItemOnClick != null ? blurActiveItemOnClick : (() => !!(store == null ? void 0 : store.getState().includesBaseElement))
20493 );
20494 const setValueOnClickProp = useBooleanEvent(setValueOnClick);
20495 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow);
20496 const onMouseDown = useEvent((event) => {
20497 onMouseDownProp == null ? void 0 : onMouseDownProp(event);
20498 if (event.defaultPrevented) return;
20499 if (event.button) return;
20500 if (event.ctrlKey) return;
20501 if (!store) return;
20502 if (blurActiveItemOnClickProp(event)) {
20503 store.setActiveId(null);
20504 }
20505 if (setValueOnClickProp(event)) {
20506 store.setValue(value);
20507 }
20508 if (showOnClickProp(event)) {
20509 queueBeforeEvent(event.currentTarget, "mouseup", store.show);
20510 }
20511 });
20512 const onKeyDownProp = props.onKeyDown;
20513 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow);
20514 const onKeyDown = useEvent((event) => {
20515 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
20516 if (!event.repeat) {
20517 canAutoSelectRef.current = false;
20518 }
20519 if (event.defaultPrevented) return;
20520 if (event.ctrlKey) return;
20521 if (event.altKey) return;
20522 if (event.shiftKey) return;
20523 if (event.metaKey) return;
20524 if (!store) return;
20525 const { open: open2 } = store.getState();
20526 if (open2) return;
20527 if (event.key === "ArrowUp" || event.key === "ArrowDown") {
20528 if (showOnKeyPressProp(event)) {
20529 event.preventDefault();
20530 store.show();
20531 }
20532 }
20533 });
20534 const onBlurProp = props.onBlur;
20535 const onBlur = useEvent((event) => {
20536 canAutoSelectRef.current = false;
20537 onBlurProp == null ? void 0 : onBlurProp(event);
20538 if (event.defaultPrevented) return;
20539 });
20540 const id = useId5(props.id);
20541 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
20542 const isActiveItem = store.useState((state) => state.activeId === null);
20543 props = {
20544 id,
20545 role: "combobox",
20546 "aria-autocomplete": ariaAutoComplete,
20547 "aria-haspopup": getPopupRole(contentElement, "listbox"),
20548 "aria-expanded": open,
20549 "aria-controls": contentElement == null ? void 0 : contentElement.id,
20550 "data-active-item": isActiveItem || void 0,
20551 value,
20552 ...props,
20553 ref: useMergeRefs(ref, props.ref),
20554 onChange,
20555 onCompositionEnd,
20556 onMouseDown,
20557 onKeyDown,
20558 onBlur
20559 };
20560 props = useComposite({
20561 store,
20562 focusable: focusable2,
20563 ...props,
20564 // Enable inline autocomplete when the user moves from the combobox input
20565 // to an item.
20566 moveOnKeyPress: (event) => {
20567 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;
20568 if (inline4) setCanInline(true);
20569 return true;
20570 }
20571 });
20572 props = usePopoverAnchor({ store, ...props });
20573 return { autoComplete: "off", ...props };
20574 }
20575 );
20576 var Combobox = forwardRef210(function Combobox2(props) {
20577 const htmlProps = useCombobox(props);
20578 return createElement3(TagName9, htmlProps);
20579 });
20580
20581 // node_modules/@ariakit/react-core/esm/__chunks/IBXZ2LQC.js
20582 var import_react30 = __toESM(require_react(), 1);
20583 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
20584 var TagName10 = "div";
20585 function isSelected(storeValue, itemValue) {
20586 if (itemValue == null) return;
20587 if (storeValue == null) return false;
20588 if (Array.isArray(storeValue)) {
20589 return storeValue.includes(itemValue);
20590 }
20591 return storeValue === itemValue;
20592 }
20593 function getItemRole(popupRole) {
20594 var _a;
20595 const itemRoleByPopupRole = {
20596 menu: "menuitem",
20597 listbox: "option",
20598 tree: "treeitem"
20599 };
20600 const key = popupRole;
20601 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option";
20602 }
20603 var useComboboxItem = createHook(
20604 function useComboboxItem2({
20605 store,
20606 value,
20607 hideOnClick,
20608 setValueOnClick,
20609 selectValueOnClick = true,
20610 resetValueOnSelect,
20611 focusOnHover = false,
20612 moveOnKeyPress = true,
20613 getItem: getItemProp,
20614 ...props
20615 }) {
20616 var _a;
20617 const context = useComboboxScopedContext();
20618 store = store || context;
20619 invariant(
20620 store,
20621 "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component."
20622 );
20623 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, {
20624 resetValueOnSelectState: "resetValueOnSelect",
20625 multiSelectable(state) {
20626 return Array.isArray(state.selectedValue);
20627 },
20628 selected(state) {
20629 return isSelected(state.selectedValue, value);
20630 }
20631 });
20632 const getItem = (0, import_react30.useCallback)(
20633 (item) => {
20634 const nextItem = { ...item, value };
20635 if (getItemProp) {
20636 return getItemProp(nextItem);
20637 }
20638 return nextItem;
20639 },
20640 [value, getItemProp]
20641 );
20642 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable;
20643 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable;
20644 const onClickProp = props.onClick;
20645 const setValueOnClickProp = useBooleanEvent(setValueOnClick);
20646 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick);
20647 const resetValueOnSelectProp = useBooleanEvent(
20648 (_a = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a : multiSelectable
20649 );
20650 const hideOnClickProp = useBooleanEvent(hideOnClick);
20651 const onClick = useEvent((event) => {
20652 onClickProp == null ? void 0 : onClickProp(event);
20653 if (event.defaultPrevented) return;
20654 if (isDownloading(event)) return;
20655 if (isOpeningInNewTab(event)) return;
20656 if (value != null) {
20657 if (selectValueOnClickProp(event)) {
20658 if (resetValueOnSelectProp(event)) {
20659 store == null ? void 0 : store.resetValue();
20660 }
20661 store == null ? void 0 : store.setSelectedValue((prevValue) => {
20662 if (!Array.isArray(prevValue)) return value;
20663 if (prevValue.includes(value)) {
20664 return prevValue.filter((v2) => v2 !== value);
20665 }
20666 return [...prevValue, value];
20667 });
20668 }
20669 if (setValueOnClickProp(event)) {
20670 store == null ? void 0 : store.setValue(value);
20671 }
20672 }
20673 if (hideOnClickProp(event)) {
20674 store == null ? void 0 : store.hide();
20675 }
20676 });
20677 const onKeyDownProp = props.onKeyDown;
20678 const onKeyDown = useEvent((event) => {
20679 onKeyDownProp == null ? void 0 : onKeyDownProp(event);
20680 if (event.defaultPrevented) return;
20681 const baseElement = store == null ? void 0 : store.getState().baseElement;
20682 if (!baseElement) return;
20683 if (hasFocus(baseElement)) return;
20684 const printable = event.key.length === 1;
20685 if (printable || event.key === "Backspace" || event.key === "Delete") {
20686 queueMicrotask(() => baseElement.focus());
20687 if (isTextField(baseElement)) {
20688 store == null ? void 0 : store.setValue(baseElement.value);
20689 }
20690 }
20691 });
20692 if (multiSelectable && selected != null) {
20693 props = {
20694 "aria-selected": selected,
20695 ...props
20696 };
20697 }
20698 props = useWrapElement(
20699 props,
20700 (element) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }),
20701 [value, selected]
20702 );
20703 const popupRole = (0, import_react30.useContext)(ComboboxListRoleContext);
20704 props = {
20705 role: getItemRole(popupRole),
20706 children: value,
20707 ...props,
20708 onClick,
20709 onKeyDown
20710 };
20711 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
20712 props = useCompositeItem({
20713 store,
20714 ...props,
20715 getItem,
20716 // Dispatch a custom event on the combobox input when moving to an item
20717 // with the keyboard so the Combobox component can enable inline
20718 // autocompletion.
20719 moveOnKeyPress: (event) => {
20720 if (!moveOnKeyPressProp(event)) return false;
20721 const moveEvent = new Event("combobox-item-move");
20722 const baseElement = store == null ? void 0 : store.getState().baseElement;
20723 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent);
20724 return true;
20725 }
20726 });
20727 props = useCompositeHover({ store, focusOnHover, ...props });
20728 return props;
20729 }
20730 );
20731 var ComboboxItem = memo22(
20732 forwardRef210(function ComboboxItem2(props) {
20733 const htmlProps = useComboboxItem(props);
20734 return createElement3(TagName10, htmlProps);
20735 })
20736 );
20737
20738 // node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js
20739 var import_react31 = __toESM(require_react(), 1);
20740 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
20741 var TagName11 = "span";
20742 function normalizeValue(value) {
20743 return normalizeString(value).toLowerCase();
20744 }
20745 function getOffsets(string, values) {
20746 const offsets = [];
20747 for (const value of values) {
20748 let pos = 0;
20749 const length = value.length;
20750 while (string.indexOf(value, pos) !== -1) {
20751 const index2 = string.indexOf(value, pos);
20752 if (index2 !== -1) {
20753 offsets.push([index2, length]);
20754 }
20755 pos = index2 + 1;
20756 }
20757 }
20758 return offsets;
20759 }
20760 function filterOverlappingOffsets(offsets) {
20761 return offsets.filter(([offset4, length], i2, arr) => {
20762 return !arr.some(
20763 ([o2, l2], j2) => j2 !== i2 && o2 <= offset4 && o2 + l2 >= offset4 + length
20764 );
20765 });
20766 }
20767 function sortOffsets(offsets) {
20768 return offsets.sort(([a2], [b2]) => a2 - b2);
20769 }
20770 function splitValue(itemValue, userValue) {
20771 if (!itemValue) return itemValue;
20772 if (!userValue) return itemValue;
20773 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue);
20774 const parts = [];
20775 const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
20776 "span",
20777 {
20778 "data-autocomplete-value": autocomplete ? "" : void 0,
20779 "data-user-value": autocomplete ? void 0 : "",
20780 children: value
20781 },
20782 parts.length
20783 );
20784 const offsets = sortOffsets(
20785 filterOverlappingOffsets(
20786 // Convert userValues into a set to avoid duplicates
20787 getOffsets(normalizeValue(itemValue), new Set(userValues))
20788 )
20789 );
20790 if (!offsets.length) {
20791 parts.push(span(itemValue, true));
20792 return parts;
20793 }
20794 const [firstOffset] = offsets[0];
20795 const values = [
20796 itemValue.slice(0, firstOffset),
20797 ...offsets.flatMap(([offset4, length], i2) => {
20798 var _a;
20799 const value = itemValue.slice(offset4, offset4 + length);
20800 const nextOffset = (_a = offsets[i2 + 1]) == null ? void 0 : _a[0];
20801 const nextValue = itemValue.slice(offset4 + length, nextOffset);
20802 return [value, nextValue];
20803 })
20804 ];
20805 values.forEach((value, i2) => {
20806 if (!value) return;
20807 parts.push(span(value, i2 % 2 === 0));
20808 });
20809 return parts;
20810 }
20811 var useComboboxItemValue = createHook(function useComboboxItemValue2({ store, value, userValue, ...props }) {
20812 const context = useComboboxScopedContext();
20813 store = store || context;
20814 const itemContext = (0, import_react31.useContext)(ComboboxItemValueContext);
20815 const itemValue = value != null ? value : itemContext;
20816 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value);
20817 const children = (0, import_react31.useMemo)(() => {
20818 if (!itemValue) return;
20819 if (!inputValue) return itemValue;
20820 return splitValue(itemValue, inputValue);
20821 }, [itemValue, inputValue]);
20822 props = {
20823 children,
20824 ...props
20825 };
20826 return removeUndefinedValues(props);
20827 });
20828 var ComboboxItemValue = forwardRef210(function ComboboxItemValue2(props) {
20829 const htmlProps = useComboboxItemValue(props);
20830 return createElement3(TagName11, htmlProps);
20831 });
20832
20833 // node_modules/@ariakit/react-core/esm/combobox/combobox-label.js
20834 var TagName12 = "label";
20835 var useComboboxLabel = createHook(
20836 function useComboboxLabel2({ store, ...props }) {
20837 const context = useComboboxProviderContext();
20838 store = store || context;
20839 invariant(
20840 store,
20841 "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component."
20842 );
20843 const comboboxId = store.useState((state) => {
20844 var _a;
20845 return (_a = state.baseElement) == null ? void 0 : _a.id;
20846 });
20847 props = {
20848 htmlFor: comboboxId,
20849 ...props
20850 };
20851 return removeUndefinedValues(props);
20852 }
20853 );
20854 var ComboboxLabel = memo22(
20855 forwardRef210(function ComboboxLabel2(props) {
20856 const htmlProps = useComboboxLabel(props);
20857 return createElement3(TagName12, htmlProps);
20858 })
20859 );
20860
20861 // node_modules/@ariakit/react-core/esm/__chunks/2G6YEJT4.js
20862 var import_react32 = __toESM(require_react(), 1);
20863 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
20864 var TagName13 = "div";
20865 var useComboboxList = createHook(
20866 function useComboboxList2({ store, alwaysVisible, ...props }) {
20867 const scopedContext = useComboboxScopedContext(true);
20868 const context = useComboboxContext();
20869 store = store || context;
20870 const scopedContextSameStore = !!store && store === scopedContext;
20871 invariant(
20872 store,
20873 "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."
20874 );
20875 const ref = (0, import_react32.useRef)(null);
20876 const id = useId5(props.id);
20877 const mounted = store.useState("mounted");
20878 const hidden = isHidden(mounted, props.hidden, alwaysVisible);
20879 const style = hidden ? { ...props.style, display: "none" } : props.style;
20880 const multiSelectable = store.useState(
20881 (state) => Array.isArray(state.selectedValue)
20882 );
20883 const role = useAttribute(ref, "role", props.role);
20884 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid";
20885 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0;
20886 const [hasListboxInside, setHasListboxInside] = (0, import_react32.useState)(false);
20887 const contentElement = store.useState("contentElement");
20888 useSafeLayoutEffect(() => {
20889 if (!mounted) return;
20890 const element = ref.current;
20891 if (!element) return;
20892 if (contentElement !== element) return;
20893 const callback = () => {
20894 setHasListboxInside(!!element.querySelector("[role='listbox']"));
20895 };
20896 const observer = new MutationObserver(callback);
20897 observer.observe(element, {
20898 subtree: true,
20899 childList: true,
20900 attributeFilter: ["role"]
20901 });
20902 callback();
20903 return () => observer.disconnect();
20904 }, [mounted, contentElement]);
20905 if (!hasListboxInside) {
20906 props = {
20907 role: "listbox",
20908 "aria-multiselectable": ariaMultiSelectable,
20909 ...props
20910 };
20911 }
20912 props = useWrapElement(
20913 props,
20914 (element) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }),
20915 [store, role]
20916 );
20917 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null;
20918 props = {
20919 id,
20920 hidden,
20921 ...props,
20922 ref: useMergeRefs(setContentElement, ref, props.ref),
20923 style
20924 };
20925 return removeUndefinedValues(props);
20926 }
20927 );
20928 var ComboboxList = forwardRef210(function ComboboxList2(props) {
20929 const htmlProps = useComboboxList(props);
20930 return createElement3(TagName13, htmlProps);
20931 });
20932
20933 // node_modules/@ariakit/react-core/esm/__chunks/XSIEPKGA.js
20934 var import_react33 = __toESM(require_react(), 1);
20935 var TagValueContext = (0, import_react33.createContext)(null);
20936 var TagRemoveIdContext = (0, import_react33.createContext)(
20937 null
20938 );
20939 var ctx7 = createStoreContext(
20940 [CompositeContextProvider],
20941 [CompositeScopedContextProvider]
20942 );
20943 var useTagContext = ctx7.useContext;
20944 var useTagScopedContext = ctx7.useScopedContext;
20945 var useTagProviderContext = ctx7.useProviderContext;
20946 var TagContextProvider = ctx7.ContextProvider;
20947 var TagScopedContextProvider = ctx7.ScopedContextProvider;
20948
20949 // node_modules/@ariakit/core/esm/combobox/combobox-store.js
20950 var isTouchSafari = isSafari2() && isTouchDevice();
20951 function createComboboxStore({
20952 tag,
20953 ...props
20954 } = {}) {
20955 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"]));
20956 throwOnConflictingProps(props, store);
20957 const tagState = tag == null ? void 0 : tag.getState();
20958 const syncState = store == null ? void 0 : store.getState();
20959 const activeId = defaultValue(
20960 props.activeId,
20961 syncState == null ? void 0 : syncState.activeId,
20962 props.defaultActiveId,
20963 null
20964 );
20965 const composite = createCompositeStore({
20966 ...props,
20967 activeId,
20968 includesBaseElement: defaultValue(
20969 props.includesBaseElement,
20970 syncState == null ? void 0 : syncState.includesBaseElement,
20971 true
20972 ),
20973 orientation: defaultValue(
20974 props.orientation,
20975 syncState == null ? void 0 : syncState.orientation,
20976 "vertical"
20977 ),
20978 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
20979 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
20980 virtualFocus: defaultValue(
20981 props.virtualFocus,
20982 syncState == null ? void 0 : syncState.virtualFocus,
20983 true
20984 )
20985 });
20986 const popover = createPopoverStore({
20987 ...props,
20988 placement: defaultValue(
20989 props.placement,
20990 syncState == null ? void 0 : syncState.placement,
20991 "bottom-start"
20992 )
20993 });
20994 const value = defaultValue(
20995 props.value,
20996 syncState == null ? void 0 : syncState.value,
20997 props.defaultValue,
20998 ""
20999 );
21000 const selectedValue = defaultValue(
21001 props.selectedValue,
21002 syncState == null ? void 0 : syncState.selectedValue,
21003 tagState == null ? void 0 : tagState.values,
21004 props.defaultSelectedValue,
21005 ""
21006 );
21007 const multiSelectable = Array.isArray(selectedValue);
21008 const initialState = {
21009 ...composite.getState(),
21010 ...popover.getState(),
21011 value,
21012 selectedValue,
21013 resetValueOnSelect: defaultValue(
21014 props.resetValueOnSelect,
21015 syncState == null ? void 0 : syncState.resetValueOnSelect,
21016 multiSelectable
21017 ),
21018 resetValueOnHide: defaultValue(
21019 props.resetValueOnHide,
21020 syncState == null ? void 0 : syncState.resetValueOnHide,
21021 multiSelectable && !tag
21022 ),
21023 activeValue: syncState == null ? void 0 : syncState.activeValue
21024 };
21025 const combobox = createStore(initialState, composite, popover, store);
21026 if (isTouchSafari) {
21027 setup(
21028 combobox,
21029 () => sync(combobox, ["virtualFocus"], () => {
21030 combobox.setState("virtualFocus", false);
21031 })
21032 );
21033 }
21034 setup(combobox, () => {
21035 if (!tag) return;
21036 return chain(
21037 sync(combobox, ["selectedValue"], (state) => {
21038 if (!Array.isArray(state.selectedValue)) return;
21039 tag.setValues(state.selectedValue);
21040 }),
21041 sync(tag, ["values"], (state) => {
21042 combobox.setState("selectedValue", state.values);
21043 })
21044 );
21045 });
21046 setup(
21047 combobox,
21048 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
21049 if (!state.resetValueOnHide) return;
21050 if (state.mounted) return;
21051 combobox.setState("value", value);
21052 })
21053 );
21054 setup(
21055 combobox,
21056 () => sync(combobox, ["open"], (state) => {
21057 if (state.open) return;
21058 combobox.setState("activeId", activeId);
21059 combobox.setState("moves", 0);
21060 })
21061 );
21062 setup(
21063 combobox,
21064 () => sync(combobox, ["moves", "activeId"], (state, prevState) => {
21065 if (state.moves === prevState.moves) {
21066 combobox.setState("activeValue", void 0);
21067 }
21068 })
21069 );
21070 setup(
21071 combobox,
21072 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
21073 if (state.moves === prev.moves) return;
21074 const { activeId: activeId2 } = combobox.getState();
21075 const activeItem = composite.item(activeId2);
21076 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
21077 })
21078 );
21079 return {
21080 ...popover,
21081 ...composite,
21082 ...combobox,
21083 tag,
21084 setValue: (value2) => combobox.setState("value", value2),
21085 resetValue: () => combobox.setState("value", initialState.value),
21086 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
21087 };
21088 }
21089
21090 // node_modules/@ariakit/react-core/esm/__chunks/SVN33SY6.js
21091 function useComboboxStoreOptions(props) {
21092 const tag = useTagContext();
21093 props = {
21094 ...props,
21095 tag: props.tag !== void 0 ? props.tag : tag
21096 };
21097 return useCompositeStoreOptions(props);
21098 }
21099 function useComboboxStoreProps(store, update2, props) {
21100 useUpdateEffect(update2, [props.tag]);
21101 useStoreProps(store, props, "value", "setValue");
21102 useStoreProps(store, props, "selectedValue", "setSelectedValue");
21103 useStoreProps(store, props, "resetValueOnHide");
21104 useStoreProps(store, props, "resetValueOnSelect");
21105 return Object.assign(
21106 useCompositeStoreProps(
21107 usePopoverStoreProps(store, update2, props),
21108 update2,
21109 props
21110 ),
21111 { tag: props.tag }
21112 );
21113 }
21114 function useComboboxStore(props = {}) {
21115 props = useComboboxStoreOptions(props);
21116 const [store, update2] = useStore2(createComboboxStore, props);
21117 return useComboboxStoreProps(store, update2, props);
21118 }
21119
21120 // node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js
21121 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
21122 function ComboboxProvider(props = {}) {
21123 const store = useComboboxStore(props);
21124 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ComboboxContextProvider, { value: store, children: props.children });
21125 }
21126
21127 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs
21128 var import_remove_accents = __toESM(require_remove_accents(), 1);
21129 var import_compose7 = __toESM(require_compose(), 1);
21130 var import_i18n24 = __toESM(require_i18n(), 1);
21131 var import_element64 = __toESM(require_element(), 1);
21132 var import_components18 = __toESM(require_components(), 1);
21133
21134 // packages/dataviews/build-module/components/dataviews-filters/utils.mjs
21135 var EMPTY_ARRAY3 = [];
21136 var getCurrentValue = (filterDefinition, currentFilter) => {
21137 if (filterDefinition.singleSelection) {
21138 return currentFilter?.value;
21139 }
21140 if (Array.isArray(currentFilter?.value)) {
21141 return currentFilter.value;
21142 }
21143 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
21144 return [currentFilter.value];
21145 }
21146 return EMPTY_ARRAY3;
21147 };
21148
21149 // packages/dataviews/build-module/hooks/use-elements.mjs
21150 var import_element63 = __toESM(require_element(), 1);
21151 var EMPTY_ARRAY4 = [];
21152 function useElements({
21153 elements,
21154 getElements
21155 }) {
21156 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY4;
21157 const [records, setRecords] = (0, import_element63.useState)(staticElements);
21158 const [isLoading, setIsLoading] = (0, import_element63.useState)(false);
21159 (0, import_element63.useEffect)(() => {
21160 if (!getElements) {
21161 setRecords(staticElements);
21162 return;
21163 }
21164 let cancelled = false;
21165 setIsLoading(true);
21166 getElements().then((fetchedElements) => {
21167 if (!cancelled) {
21168 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
21169 setRecords(dynamicElements);
21170 }
21171 }).catch(() => {
21172 if (!cancelled) {
21173 setRecords(staticElements);
21174 }
21175 }).finally(() => {
21176 if (!cancelled) {
21177 setIsLoading(false);
21178 }
21179 });
21180 return () => {
21181 cancelled = true;
21182 };
21183 }, [getElements, staticElements]);
21184 return {
21185 elements: records,
21186 isLoading
21187 };
21188 }
21189
21190 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs
21191 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
21192 function normalizeSearchInput(input = "") {
21193 return (0, import_remove_accents.default)(input.trim().toLowerCase());
21194 }
21195 var getNewValue = (filterDefinition, currentFilter, value) => {
21196 if (filterDefinition.singleSelection) {
21197 return value;
21198 }
21199 if (Array.isArray(currentFilter?.value)) {
21200 return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value];
21201 }
21202 return [value];
21203 };
21204 function generateFilterElementCompositeItemId(prefix, filterElementValue) {
21205 return `${prefix}-${filterElementValue}`;
21206 }
21207 var MultiSelectionOption = ({ selected }) => {
21208 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21209 "span",
21210 {
21211 className: clsx_default(
21212 "dataviews-filters__search-widget-listitem-multi-selection",
21213 { "is-selected": selected }
21214 ),
21215 children: selected && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components18.Icon, { icon: check_default })
21216 }
21217 );
21218 };
21219 var SingleSelectionOption = ({ selected }) => {
21220 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21221 "span",
21222 {
21223 className: clsx_default(
21224 "dataviews-filters__search-widget-listitem-single-selection",
21225 { "is-selected": selected }
21226 )
21227 }
21228 );
21229 };
21230 function ListBox({ view, filter, onChangeView }) {
21231 const baseId = (0, import_compose7.useInstanceId)(ListBox, "dataviews-filter-list-box");
21232 const [activeCompositeId, setActiveCompositeId] = (0, import_element64.useState)(
21233 // When there are one or less operators, the first item is set as active
21234 // (by setting the initial `activeId` to `undefined`).
21235 // With 2 or more operators, the focus is moved on the operators control
21236 // (by setting the initial `activeId` to `null`), meaning that there won't
21237 // be an active item initially. Focus is then managed via the
21238 // `onFocusVisible` callback.
21239 filter.operators?.length === 1 ? void 0 : null
21240 );
21241 const currentFilter = view.filters?.find(
21242 (f2) => f2.field === filter.field
21243 );
21244 const currentValue = getCurrentValue(filter, currentFilter);
21245 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21246 import_components18.Composite,
21247 {
21248 virtualFocus: true,
21249 focusLoop: true,
21250 activeId: activeCompositeId,
21251 setActiveId: setActiveCompositeId,
21252 role: "listbox",
21253 className: "dataviews-filters__search-widget-listbox",
21254 "aria-label": (0, import_i18n24.sprintf)(
21255 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
21256 (0, import_i18n24.__)("List of: %1$s"),
21257 filter.name
21258 ),
21259 onFocusVisible: () => {
21260 if (!activeCompositeId && filter.elements.length) {
21261 setActiveCompositeId(
21262 generateFilterElementCompositeItemId(
21263 baseId,
21264 filter.elements[0].value
21265 )
21266 );
21267 }
21268 },
21269 render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components18.Composite.Typeahead, {}),
21270 children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
21271 import_components18.Composite.Hover,
21272 {
21273 render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21274 import_components18.Composite.Item,
21275 {
21276 id: generateFilterElementCompositeItemId(
21277 baseId,
21278 element.value
21279 ),
21280 render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21281 "div",
21282 {
21283 "aria-label": element.label,
21284 role: "option",
21285 className: "dataviews-filters__search-widget-listitem"
21286 }
21287 ),
21288 onClick: () => {
21289 const newFilters = currentFilter ? [
21290 ...(view.filters ?? []).map(
21291 (_filter) => {
21292 if (_filter.field === filter.field) {
21293 return {
21294 ..._filter,
21295 operator: currentFilter.operator || filter.operators[0],
21296 value: getNewValue(
21297 filter,
21298 currentFilter,
21299 element.value
21300 )
21301 };
21302 }
21303 return _filter;
21304 }
21305 )
21306 ] : [
21307 ...view.filters ?? [],
21308 {
21309 field: filter.field,
21310 operator: filter.operators[0],
21311 value: getNewValue(
21312 filter,
21313 currentFilter,
21314 element.value
21315 )
21316 }
21317 ];
21318 onChangeView({
21319 ...view,
21320 page: 1,
21321 filters: newFilters
21322 });
21323 }
21324 }
21325 ),
21326 children: [
21327 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21328 SingleSelectionOption,
21329 {
21330 selected: currentValue === element.value
21331 }
21332 ),
21333 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21334 MultiSelectionOption,
21335 {
21336 selected: currentValue.includes(element.value)
21337 }
21338 ),
21339 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21340 "span",
21341 {
21342 className: "dataviews-filters__search-widget-listitem-value",
21343 title: element.label,
21344 children: element.label
21345 }
21346 )
21347 ]
21348 },
21349 element.value
21350 ))
21351 }
21352 );
21353 }
21354 function ComboboxList22({ view, filter, onChangeView }) {
21355 const [searchValue, setSearchValue] = (0, import_element64.useState)("");
21356 const deferredSearchValue = (0, import_element64.useDeferredValue)(searchValue);
21357 const currentFilter = view.filters?.find(
21358 (_filter) => _filter.field === filter.field
21359 );
21360 const currentValue = getCurrentValue(filter, currentFilter);
21361 const matches = (0, import_element64.useMemo)(() => {
21362 const normalizedSearch = normalizeSearchInput(deferredSearchValue);
21363 return filter.elements.filter(
21364 (item) => normalizeSearchInput(item.label).includes(normalizedSearch)
21365 );
21366 }, [filter.elements, deferredSearchValue]);
21367 return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
21368 ComboboxProvider,
21369 {
21370 selectedValue: currentValue,
21371 setSelectedValue: (value) => {
21372 const newFilters = currentFilter ? [
21373 ...(view.filters ?? []).map((_filter) => {
21374 if (_filter.field === filter.field) {
21375 return {
21376 ..._filter,
21377 operator: currentFilter.operator || filter.operators[0],
21378 value
21379 };
21380 }
21381 return _filter;
21382 })
21383 ] : [
21384 ...view.filters ?? [],
21385 {
21386 field: filter.field,
21387 operator: filter.operators[0],
21388 value
21389 }
21390 ];
21391 onChangeView({
21392 ...view,
21393 page: 1,
21394 filters: newFilters
21395 });
21396 },
21397 setValue: setSearchValue,
21398 children: [
21399 /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
21400 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ComboboxLabel, {}), children: (0, import_i18n24.__)("Search items") }),
21401 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21402 Combobox,
21403 {
21404 autoSelect: "always",
21405 placeholder: (0, import_i18n24.__)("Search"),
21406 className: "dataviews-filters__search-widget-filter-combobox__input"
21407 }
21408 ),
21409 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components18.Icon, { icon: search_default }) })
21410 ] }),
21411 /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
21412 ComboboxList,
21413 {
21414 className: "dataviews-filters__search-widget-filter-combobox-list",
21415 alwaysVisible: true,
21416 children: [
21417 matches.map((element) => {
21418 return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
21419 ComboboxItem,
21420 {
21421 resetValueOnSelect: false,
21422 value: element.value,
21423 className: "dataviews-filters__search-widget-listitem",
21424 hideOnClick: false,
21425 setValueOnClick: false,
21426 focusOnHover: true,
21427 children: [
21428 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21429 SingleSelectionOption,
21430 {
21431 selected: currentValue === element.value
21432 }
21433 ),
21434 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21435 MultiSelectionOption,
21436 {
21437 selected: currentValue.includes(
21438 element.value
21439 )
21440 }
21441 ),
21442 /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
21443 "span",
21444 {
21445 className: "dataviews-filters__search-widget-listitem-value",
21446 title: element.label,
21447 children: [
21448 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
21449 ComboboxItemValue,
21450 {
21451 className: "dataviews-filters__search-widget-filter-combobox-item-value",
21452 value: element.label
21453 }
21454 ),
21455 !!element.description && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
21456 ]
21457 }
21458 )
21459 ]
21460 },
21461 element.value
21462 );
21463 }),
21464 !matches.length && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { children: (0, import_i18n24.__)("No results found") })
21465 ]
21466 }
21467 )
21468 ]
21469 }
21470 );
21471 }
21472 function SearchWidget(props) {
21473 const { elements, isLoading } = useElements({
21474 elements: props.filter.elements,
21475 getElements: props.filter.getElements
21476 });
21477 if (isLoading) {
21478 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components18.Spinner, {}) });
21479 }
21480 if (elements.length === 0) {
21481 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n24.__)("No elements found") });
21482 }
21483 const Widget = elements.length > 10 ? ComboboxList22 : ListBox;
21484 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Widget, { ...props, filter: { ...props.filter, elements } });
21485 }
21486
21487 // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs
21488 var import_es6 = __toESM(require_es6(), 1);
21489 var import_compose8 = __toESM(require_compose(), 1);
21490 var import_element65 = __toESM(require_element(), 1);
21491 var import_components19 = __toESM(require_components(), 1);
21492 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
21493 function InputWidget({
21494 filter,
21495 view,
21496 onChangeView,
21497 fields
21498 }) {
21499 const currentFilter = view.filters?.find(
21500 (f2) => f2.field === filter.field
21501 );
21502 const currentValue = getCurrentValue(filter, currentFilter);
21503 const field = (0, import_element65.useMemo)(() => {
21504 const currentField = fields.find((f2) => f2.id === filter.field);
21505 if (currentField) {
21506 return {
21507 ...currentField,
21508 // Deactivate validation for filters.
21509 isValid: {},
21510 // Filter controls are always enabled.
21511 isDisabled: () => false,
21512 // Filter controls are always visible.
21513 isVisible: () => true,
21514 // Configure getValue/setValue as if Item was a plain object.
21515 getValue: ({ item }) => item[currentField.id],
21516 setValue: ({ value }) => ({
21517 [currentField.id]: value
21518 })
21519 };
21520 }
21521 return currentField;
21522 }, [fields, filter.field]);
21523 const data = (0, import_element65.useMemo)(() => {
21524 return (view.filters ?? []).reduce(
21525 (acc, activeFilter) => {
21526 acc[activeFilter.field] = activeFilter.value;
21527 return acc;
21528 },
21529 {}
21530 );
21531 }, [view.filters]);
21532 const handleChange = (0, import_compose8.useEvent)((updatedData) => {
21533 if (!field || !currentFilter) {
21534 return;
21535 }
21536 const nextValue = field.getValue({ item: updatedData });
21537 if ((0, import_es6.default)(nextValue, currentValue)) {
21538 return;
21539 }
21540 onChangeView({
21541 ...view,
21542 filters: (view.filters ?? []).map(
21543 (_filter) => _filter.field === filter.field ? {
21544 ..._filter,
21545 operator: currentFilter.operator || filter.operators[0],
21546 // Consider empty strings as undefined:
21547 //
21548 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records
21549 // - empty string as value means "search empty string": returns only the records that have an empty string as value
21550 //
21551 // In practice, this means the filter will not be able to find an empty string as the value.
21552 value: nextValue === "" ? void 0 : nextValue
21553 } : _filter
21554 )
21555 });
21556 });
21557 if (!field || !field.Edit || !currentFilter) {
21558 return null;
21559 }
21560 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
21561 import_components19.Flex,
21562 {
21563 className: "dataviews-filters__user-input-widget",
21564 gap: 2.5,
21565 direction: "column",
21566 children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
21567 field.Edit,
21568 {
21569 hideLabelFromVision: true,
21570 data,
21571 field,
21572 operator: currentFilter.operator,
21573 onChange: handleChange
21574 }
21575 )
21576 }
21577 );
21578 }
21579
21580 // node_modules/date-fns/constants.js
21581 var daysInYear = 365.2425;
21582 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
21583 var minTime = -maxTime;
21584 var millisecondsInWeek = 6048e5;
21585 var millisecondsInDay = 864e5;
21586 var secondsInHour = 3600;
21587 var secondsInDay = secondsInHour * 24;
21588 var secondsInWeek = secondsInDay * 7;
21589 var secondsInYear = secondsInDay * daysInYear;
21590 var secondsInMonth = secondsInYear / 12;
21591 var secondsInQuarter = secondsInMonth * 3;
21592 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
21593
21594 // node_modules/date-fns/constructFrom.js
21595 function constructFrom(date, value) {
21596 if (typeof date === "function") return date(value);
21597 if (date && typeof date === "object" && constructFromSymbol in date)
21598 return date[constructFromSymbol](value);
21599 if (date instanceof Date) return new date.constructor(value);
21600 return new Date(value);
21601 }
21602
21603 // node_modules/date-fns/toDate.js
21604 function toDate(argument, context) {
21605 return constructFrom(context || argument, argument);
21606 }
21607
21608 // node_modules/date-fns/addDays.js
21609 function addDays(date, amount, options) {
21610 const _date = toDate(date, options?.in);
21611 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
21612 if (!amount) return _date;
21613 _date.setDate(_date.getDate() + amount);
21614 return _date;
21615 }
21616
21617 // node_modules/date-fns/addMonths.js
21618 function addMonths(date, amount, options) {
21619 const _date = toDate(date, options?.in);
21620 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
21621 if (!amount) {
21622 return _date;
21623 }
21624 const dayOfMonth = _date.getDate();
21625 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
21626 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
21627 const daysInMonth = endOfDesiredMonth.getDate();
21628 if (dayOfMonth >= daysInMonth) {
21629 return endOfDesiredMonth;
21630 } else {
21631 _date.setFullYear(
21632 endOfDesiredMonth.getFullYear(),
21633 endOfDesiredMonth.getMonth(),
21634 dayOfMonth
21635 );
21636 return _date;
21637 }
21638 }
21639
21640 // node_modules/date-fns/_lib/defaultOptions.js
21641 var defaultOptions = {};
21642 function getDefaultOptions() {
21643 return defaultOptions;
21644 }
21645
21646 // node_modules/date-fns/startOfWeek.js
21647 function startOfWeek(date, options) {
21648 const defaultOptions2 = getDefaultOptions();
21649 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
21650 const _date = toDate(date, options?.in);
21651 const day = _date.getDay();
21652 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
21653 _date.setDate(_date.getDate() - diff);
21654 _date.setHours(0, 0, 0, 0);
21655 return _date;
21656 }
21657
21658 // node_modules/date-fns/startOfISOWeek.js
21659 function startOfISOWeek(date, options) {
21660 return startOfWeek(date, { ...options, weekStartsOn: 1 });
21661 }
21662
21663 // node_modules/date-fns/getISOWeekYear.js
21664 function getISOWeekYear(date, options) {
21665 const _date = toDate(date, options?.in);
21666 const year = _date.getFullYear();
21667 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
21668 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
21669 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
21670 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
21671 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
21672 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
21673 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
21674 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
21675 if (_date.getTime() >= startOfNextYear.getTime()) {
21676 return year + 1;
21677 } else if (_date.getTime() >= startOfThisYear.getTime()) {
21678 return year;
21679 } else {
21680 return year - 1;
21681 }
21682 }
21683
21684 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
21685 function getTimezoneOffsetInMilliseconds(date) {
21686 const _date = toDate(date);
21687 const utcDate = new Date(
21688 Date.UTC(
21689 _date.getFullYear(),
21690 _date.getMonth(),
21691 _date.getDate(),
21692 _date.getHours(),
21693 _date.getMinutes(),
21694 _date.getSeconds(),
21695 _date.getMilliseconds()
21696 )
21697 );
21698 utcDate.setUTCFullYear(_date.getFullYear());
21699 return +date - +utcDate;
21700 }
21701
21702 // node_modules/date-fns/_lib/normalizeDates.js
21703 function normalizeDates(context, ...dates) {
21704 const normalize = constructFrom.bind(
21705 null,
21706 context || dates.find((date) => typeof date === "object")
21707 );
21708 return dates.map(normalize);
21709 }
21710
21711 // node_modules/date-fns/startOfDay.js
21712 function startOfDay(date, options) {
21713 const _date = toDate(date, options?.in);
21714 _date.setHours(0, 0, 0, 0);
21715 return _date;
21716 }
21717
21718 // node_modules/date-fns/differenceInCalendarDays.js
21719 function differenceInCalendarDays(laterDate, earlierDate, options) {
21720 const [laterDate_, earlierDate_] = normalizeDates(
21721 options?.in,
21722 laterDate,
21723 earlierDate
21724 );
21725 const laterStartOfDay = startOfDay(laterDate_);
21726 const earlierStartOfDay = startOfDay(earlierDate_);
21727 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
21728 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
21729 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
21730 }
21731
21732 // node_modules/date-fns/startOfISOWeekYear.js
21733 function startOfISOWeekYear(date, options) {
21734 const year = getISOWeekYear(date, options);
21735 const fourthOfJanuary = constructFrom(options?.in || date, 0);
21736 fourthOfJanuary.setFullYear(year, 0, 4);
21737 fourthOfJanuary.setHours(0, 0, 0, 0);
21738 return startOfISOWeek(fourthOfJanuary);
21739 }
21740
21741 // node_modules/date-fns/addWeeks.js
21742 function addWeeks(date, amount, options) {
21743 return addDays(date, amount * 7, options);
21744 }
21745
21746 // node_modules/date-fns/addYears.js
21747 function addYears(date, amount, options) {
21748 return addMonths(date, amount * 12, options);
21749 }
21750
21751 // node_modules/date-fns/isDate.js
21752 function isDate(value) {
21753 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
21754 }
21755
21756 // node_modules/date-fns/isValid.js
21757 function isValid(date) {
21758 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
21759 }
21760
21761 // node_modules/date-fns/startOfMonth.js
21762 function startOfMonth(date, options) {
21763 const _date = toDate(date, options?.in);
21764 _date.setDate(1);
21765 _date.setHours(0, 0, 0, 0);
21766 return _date;
21767 }
21768
21769 // node_modules/date-fns/startOfYear.js
21770 function startOfYear(date, options) {
21771 const date_ = toDate(date, options?.in);
21772 date_.setFullYear(date_.getFullYear(), 0, 1);
21773 date_.setHours(0, 0, 0, 0);
21774 return date_;
21775 }
21776
21777 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js
21778 var formatDistanceLocale = {
21779 lessThanXSeconds: {
21780 one: "less than a second",
21781 other: "less than {{count}} seconds"
21782 },
21783 xSeconds: {
21784 one: "1 second",
21785 other: "{{count}} seconds"
21786 },
21787 halfAMinute: "half a minute",
21788 lessThanXMinutes: {
21789 one: "less than a minute",
21790 other: "less than {{count}} minutes"
21791 },
21792 xMinutes: {
21793 one: "1 minute",
21794 other: "{{count}} minutes"
21795 },
21796 aboutXHours: {
21797 one: "about 1 hour",
21798 other: "about {{count}} hours"
21799 },
21800 xHours: {
21801 one: "1 hour",
21802 other: "{{count}} hours"
21803 },
21804 xDays: {
21805 one: "1 day",
21806 other: "{{count}} days"
21807 },
21808 aboutXWeeks: {
21809 one: "about 1 week",
21810 other: "about {{count}} weeks"
21811 },
21812 xWeeks: {
21813 one: "1 week",
21814 other: "{{count}} weeks"
21815 },
21816 aboutXMonths: {
21817 one: "about 1 month",
21818 other: "about {{count}} months"
21819 },
21820 xMonths: {
21821 one: "1 month",
21822 other: "{{count}} months"
21823 },
21824 aboutXYears: {
21825 one: "about 1 year",
21826 other: "about {{count}} years"
21827 },
21828 xYears: {
21829 one: "1 year",
21830 other: "{{count}} years"
21831 },
21832 overXYears: {
21833 one: "over 1 year",
21834 other: "over {{count}} years"
21835 },
21836 almostXYears: {
21837 one: "almost 1 year",
21838 other: "almost {{count}} years"
21839 }
21840 };
21841 var formatDistance = (token, count, options) => {
21842 let result;
21843 const tokenValue = formatDistanceLocale[token];
21844 if (typeof tokenValue === "string") {
21845 result = tokenValue;
21846 } else if (count === 1) {
21847 result = tokenValue.one;
21848 } else {
21849 result = tokenValue.other.replace("{{count}}", count.toString());
21850 }
21851 if (options?.addSuffix) {
21852 if (options.comparison && options.comparison > 0) {
21853 return "in " + result;
21854 } else {
21855 return result + " ago";
21856 }
21857 }
21858 return result;
21859 };
21860
21861 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js
21862 function buildFormatLongFn(args) {
21863 return (options = {}) => {
21864 const width = options.width ? String(options.width) : args.defaultWidth;
21865 const format6 = args.formats[width] || args.formats[args.defaultWidth];
21866 return format6;
21867 };
21868 }
21869
21870 // node_modules/date-fns/locale/en-US/_lib/formatLong.js
21871 var dateFormats = {
21872 full: "EEEE, MMMM do, y",
21873 long: "MMMM do, y",
21874 medium: "MMM d, y",
21875 short: "MM/dd/yyyy"
21876 };
21877 var timeFormats = {
21878 full: "h:mm:ss a zzzz",
21879 long: "h:mm:ss a z",
21880 medium: "h:mm:ss a",
21881 short: "h:mm a"
21882 };
21883 var dateTimeFormats = {
21884 full: "{{date}} 'at' {{time}}",
21885 long: "{{date}} 'at' {{time}}",
21886 medium: "{{date}}, {{time}}",
21887 short: "{{date}}, {{time}}"
21888 };
21889 var formatLong = {
21890 date: buildFormatLongFn({
21891 formats: dateFormats,
21892 defaultWidth: "full"
21893 }),
21894 time: buildFormatLongFn({
21895 formats: timeFormats,
21896 defaultWidth: "full"
21897 }),
21898 dateTime: buildFormatLongFn({
21899 formats: dateTimeFormats,
21900 defaultWidth: "full"
21901 })
21902 };
21903
21904 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js
21905 var formatRelativeLocale = {
21906 lastWeek: "'last' eeee 'at' p",
21907 yesterday: "'yesterday at' p",
21908 today: "'today at' p",
21909 tomorrow: "'tomorrow at' p",
21910 nextWeek: "eeee 'at' p",
21911 other: "P"
21912 };
21913 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
21914
21915 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js
21916 function buildLocalizeFn(args) {
21917 return (value, options) => {
21918 const context = options?.context ? String(options.context) : "standalone";
21919 let valuesArray;
21920 if (context === "formatting" && args.formattingValues) {
21921 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
21922 const width = options?.width ? String(options.width) : defaultWidth;
21923 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
21924 } else {
21925 const defaultWidth = args.defaultWidth;
21926 const width = options?.width ? String(options.width) : args.defaultWidth;
21927 valuesArray = args.values[width] || args.values[defaultWidth];
21928 }
21929 const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
21930 return valuesArray[index2];
21931 };
21932 }
21933
21934 // node_modules/date-fns/locale/en-US/_lib/localize.js
21935 var eraValues = {
21936 narrow: ["B", "A"],
21937 abbreviated: ["BC", "AD"],
21938 wide: ["Before Christ", "Anno Domini"]
21939 };
21940 var quarterValues = {
21941 narrow: ["1", "2", "3", "4"],
21942 abbreviated: ["Q1", "Q2", "Q3", "Q4"],
21943 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
21944 };
21945 var monthValues = {
21946 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
21947 abbreviated: [
21948 "Jan",
21949 "Feb",
21950 "Mar",
21951 "Apr",
21952 "May",
21953 "Jun",
21954 "Jul",
21955 "Aug",
21956 "Sep",
21957 "Oct",
21958 "Nov",
21959 "Dec"
21960 ],
21961 wide: [
21962 "January",
21963 "February",
21964 "March",
21965 "April",
21966 "May",
21967 "June",
21968 "July",
21969 "August",
21970 "September",
21971 "October",
21972 "November",
21973 "December"
21974 ]
21975 };
21976 var dayValues = {
21977 narrow: ["S", "M", "T", "W", "T", "F", "S"],
21978 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
21979 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
21980 wide: [
21981 "Sunday",
21982 "Monday",
21983 "Tuesday",
21984 "Wednesday",
21985 "Thursday",
21986 "Friday",
21987 "Saturday"
21988 ]
21989 };
21990 var dayPeriodValues = {
21991 narrow: {
21992 am: "a",
21993 pm: "p",
21994 midnight: "mi",
21995 noon: "n",
21996 morning: "morning",
21997 afternoon: "afternoon",
21998 evening: "evening",
21999 night: "night"
22000 },
22001 abbreviated: {
22002 am: "AM",
22003 pm: "PM",
22004 midnight: "midnight",
22005 noon: "noon",
22006 morning: "morning",
22007 afternoon: "afternoon",
22008 evening: "evening",
22009 night: "night"
22010 },
22011 wide: {
22012 am: "a.m.",
22013 pm: "p.m.",
22014 midnight: "midnight",
22015 noon: "noon",
22016 morning: "morning",
22017 afternoon: "afternoon",
22018 evening: "evening",
22019 night: "night"
22020 }
22021 };
22022 var formattingDayPeriodValues = {
22023 narrow: {
22024 am: "a",
22025 pm: "p",
22026 midnight: "mi",
22027 noon: "n",
22028 morning: "in the morning",
22029 afternoon: "in the afternoon",
22030 evening: "in the evening",
22031 night: "at night"
22032 },
22033 abbreviated: {
22034 am: "AM",
22035 pm: "PM",
22036 midnight: "midnight",
22037 noon: "noon",
22038 morning: "in the morning",
22039 afternoon: "in the afternoon",
22040 evening: "in the evening",
22041 night: "at night"
22042 },
22043 wide: {
22044 am: "a.m.",
22045 pm: "p.m.",
22046 midnight: "midnight",
22047 noon: "noon",
22048 morning: "in the morning",
22049 afternoon: "in the afternoon",
22050 evening: "in the evening",
22051 night: "at night"
22052 }
22053 };
22054 var ordinalNumber = (dirtyNumber, _options) => {
22055 const number = Number(dirtyNumber);
22056 const rem100 = number % 100;
22057 if (rem100 > 20 || rem100 < 10) {
22058 switch (rem100 % 10) {
22059 case 1:
22060 return number + "st";
22061 case 2:
22062 return number + "nd";
22063 case 3:
22064 return number + "rd";
22065 }
22066 }
22067 return number + "th";
22068 };
22069 var localize = {
22070 ordinalNumber,
22071 era: buildLocalizeFn({
22072 values: eraValues,
22073 defaultWidth: "wide"
22074 }),
22075 quarter: buildLocalizeFn({
22076 values: quarterValues,
22077 defaultWidth: "wide",
22078 argumentCallback: (quarter) => quarter - 1
22079 }),
22080 month: buildLocalizeFn({
22081 values: monthValues,
22082 defaultWidth: "wide"
22083 }),
22084 day: buildLocalizeFn({
22085 values: dayValues,
22086 defaultWidth: "wide"
22087 }),
22088 dayPeriod: buildLocalizeFn({
22089 values: dayPeriodValues,
22090 defaultWidth: "wide",
22091 formattingValues: formattingDayPeriodValues,
22092 defaultFormattingWidth: "wide"
22093 })
22094 };
22095
22096 // node_modules/date-fns/locale/_lib/buildMatchFn.js
22097 function buildMatchFn(args) {
22098 return (string, options = {}) => {
22099 const width = options.width;
22100 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
22101 const matchResult = string.match(matchPattern);
22102 if (!matchResult) {
22103 return null;
22104 }
22105 const matchedString = matchResult[0];
22106 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
22107 const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
22108 // [TODO] -- I challenge you to fix the type
22109 findKey(parsePatterns, (pattern) => pattern.test(matchedString))
22110 );
22111 let value;
22112 value = args.valueCallback ? args.valueCallback(key) : key;
22113 value = options.valueCallback ? (
22114 // [TODO] -- I challenge you to fix the type
22115 options.valueCallback(value)
22116 ) : value;
22117 const rest = string.slice(matchedString.length);
22118 return { value, rest };
22119 };
22120 }
22121 function findKey(object, predicate) {
22122 for (const key in object) {
22123 if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
22124 return key;
22125 }
22126 }
22127 return void 0;
22128 }
22129 function findIndex(array, predicate) {
22130 for (let key = 0; key < array.length; key++) {
22131 if (predicate(array[key])) {
22132 return key;
22133 }
22134 }
22135 return void 0;
22136 }
22137
22138 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
22139 function buildMatchPatternFn(args) {
22140 return (string, options = {}) => {
22141 const matchResult = string.match(args.matchPattern);
22142 if (!matchResult) return null;
22143 const matchedString = matchResult[0];
22144 const parseResult = string.match(args.parsePattern);
22145 if (!parseResult) return null;
22146 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
22147 value = options.valueCallback ? options.valueCallback(value) : value;
22148 const rest = string.slice(matchedString.length);
22149 return { value, rest };
22150 };
22151 }
22152
22153 // node_modules/date-fns/locale/en-US/_lib/match.js
22154 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
22155 var parseOrdinalNumberPattern = /\d+/i;
22156 var matchEraPatterns = {
22157 narrow: /^(b|a)/i,
22158 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
22159 wide: /^(before christ|before common era|anno domini|common era)/i
22160 };
22161 var parseEraPatterns = {
22162 any: [/^b/i, /^(a|c)/i]
22163 };
22164 var matchQuarterPatterns = {
22165 narrow: /^[1234]/i,
22166 abbreviated: /^q[1234]/i,
22167 wide: /^[1234](th|st|nd|rd)? quarter/i
22168 };
22169 var parseQuarterPatterns = {
22170 any: [/1/i, /2/i, /3/i, /4/i]
22171 };
22172 var matchMonthPatterns = {
22173 narrow: /^[jfmasond]/i,
22174 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
22175 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
22176 };
22177 var parseMonthPatterns = {
22178 narrow: [
22179 /^j/i,
22180 /^f/i,
22181 /^m/i,
22182 /^a/i,
22183 /^m/i,
22184 /^j/i,
22185 /^j/i,
22186 /^a/i,
22187 /^s/i,
22188 /^o/i,
22189 /^n/i,
22190 /^d/i
22191 ],
22192 any: [
22193 /^ja/i,
22194 /^f/i,
22195 /^mar/i,
22196 /^ap/i,
22197 /^may/i,
22198 /^jun/i,
22199 /^jul/i,
22200 /^au/i,
22201 /^s/i,
22202 /^o/i,
22203 /^n/i,
22204 /^d/i
22205 ]
22206 };
22207 var matchDayPatterns = {
22208 narrow: /^[smtwf]/i,
22209 short: /^(su|mo|tu|we|th|fr|sa)/i,
22210 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
22211 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
22212 };
22213 var parseDayPatterns = {
22214 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
22215 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
22216 };
22217 var matchDayPeriodPatterns = {
22218 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
22219 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
22220 };
22221 var parseDayPeriodPatterns = {
22222 any: {
22223 am: /^a/i,
22224 pm: /^p/i,
22225 midnight: /^mi/i,
22226 noon: /^no/i,
22227 morning: /morning/i,
22228 afternoon: /afternoon/i,
22229 evening: /evening/i,
22230 night: /night/i
22231 }
22232 };
22233 var match = {
22234 ordinalNumber: buildMatchPatternFn({
22235 matchPattern: matchOrdinalNumberPattern,
22236 parsePattern: parseOrdinalNumberPattern,
22237 valueCallback: (value) => parseInt(value, 10)
22238 }),
22239 era: buildMatchFn({
22240 matchPatterns: matchEraPatterns,
22241 defaultMatchWidth: "wide",
22242 parsePatterns: parseEraPatterns,
22243 defaultParseWidth: "any"
22244 }),
22245 quarter: buildMatchFn({
22246 matchPatterns: matchQuarterPatterns,
22247 defaultMatchWidth: "wide",
22248 parsePatterns: parseQuarterPatterns,
22249 defaultParseWidth: "any",
22250 valueCallback: (index2) => index2 + 1
22251 }),
22252 month: buildMatchFn({
22253 matchPatterns: matchMonthPatterns,
22254 defaultMatchWidth: "wide",
22255 parsePatterns: parseMonthPatterns,
22256 defaultParseWidth: "any"
22257 }),
22258 day: buildMatchFn({
22259 matchPatterns: matchDayPatterns,
22260 defaultMatchWidth: "wide",
22261 parsePatterns: parseDayPatterns,
22262 defaultParseWidth: "any"
22263 }),
22264 dayPeriod: buildMatchFn({
22265 matchPatterns: matchDayPeriodPatterns,
22266 defaultMatchWidth: "any",
22267 parsePatterns: parseDayPeriodPatterns,
22268 defaultParseWidth: "any"
22269 })
22270 };
22271
22272 // node_modules/date-fns/locale/en-US.js
22273 var enUS = {
22274 code: "en-US",
22275 formatDistance,
22276 formatLong,
22277 formatRelative,
22278 localize,
22279 match,
22280 options: {
22281 weekStartsOn: 0,
22282 firstWeekContainsDate: 1
22283 }
22284 };
22285
22286 // node_modules/date-fns/getDayOfYear.js
22287 function getDayOfYear(date, options) {
22288 const _date = toDate(date, options?.in);
22289 const diff = differenceInCalendarDays(_date, startOfYear(_date));
22290 const dayOfYear = diff + 1;
22291 return dayOfYear;
22292 }
22293
22294 // node_modules/date-fns/getISOWeek.js
22295 function getISOWeek(date, options) {
22296 const _date = toDate(date, options?.in);
22297 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
22298 return Math.round(diff / millisecondsInWeek) + 1;
22299 }
22300
22301 // node_modules/date-fns/getWeekYear.js
22302 function getWeekYear(date, options) {
22303 const _date = toDate(date, options?.in);
22304 const year = _date.getFullYear();
22305 const defaultOptions2 = getDefaultOptions();
22306 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
22307 const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
22308 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
22309 firstWeekOfNextYear.setHours(0, 0, 0, 0);
22310 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
22311 const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
22312 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
22313 firstWeekOfThisYear.setHours(0, 0, 0, 0);
22314 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
22315 if (+_date >= +startOfNextYear) {
22316 return year + 1;
22317 } else if (+_date >= +startOfThisYear) {
22318 return year;
22319 } else {
22320 return year - 1;
22321 }
22322 }
22323
22324 // node_modules/date-fns/startOfWeekYear.js
22325 function startOfWeekYear(date, options) {
22326 const defaultOptions2 = getDefaultOptions();
22327 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
22328 const year = getWeekYear(date, options);
22329 const firstWeek = constructFrom(options?.in || date, 0);
22330 firstWeek.setFullYear(year, 0, firstWeekContainsDate);
22331 firstWeek.setHours(0, 0, 0, 0);
22332 const _date = startOfWeek(firstWeek, options);
22333 return _date;
22334 }
22335
22336 // node_modules/date-fns/getWeek.js
22337 function getWeek(date, options) {
22338 const _date = toDate(date, options?.in);
22339 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
22340 return Math.round(diff / millisecondsInWeek) + 1;
22341 }
22342
22343 // node_modules/date-fns/_lib/addLeadingZeros.js
22344 function addLeadingZeros(number, targetLength) {
22345 const sign = number < 0 ? "-" : "";
22346 const output = Math.abs(number).toString().padStart(targetLength, "0");
22347 return sign + output;
22348 }
22349
22350 // node_modules/date-fns/_lib/format/lightFormatters.js
22351 var lightFormatters = {
22352 // Year
22353 y(date, token) {
22354 const signedYear = date.getFullYear();
22355 const year = signedYear > 0 ? signedYear : 1 - signedYear;
22356 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
22357 },
22358 // Month
22359 M(date, token) {
22360 const month = date.getMonth();
22361 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
22362 },
22363 // Day of the month
22364 d(date, token) {
22365 return addLeadingZeros(date.getDate(), token.length);
22366 },
22367 // AM or PM
22368 a(date, token) {
22369 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
22370 switch (token) {
22371 case "a":
22372 case "aa":
22373 return dayPeriodEnumValue.toUpperCase();
22374 case "aaa":
22375 return dayPeriodEnumValue;
22376 case "aaaaa":
22377 return dayPeriodEnumValue[0];
22378 case "aaaa":
22379 default:
22380 return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
22381 }
22382 },
22383 // Hour [1-12]
22384 h(date, token) {
22385 return addLeadingZeros(date.getHours() % 12 || 12, token.length);
22386 },
22387 // Hour [0-23]
22388 H(date, token) {
22389 return addLeadingZeros(date.getHours(), token.length);
22390 },
22391 // Minute
22392 m(date, token) {
22393 return addLeadingZeros(date.getMinutes(), token.length);
22394 },
22395 // Second
22396 s(date, token) {
22397 return addLeadingZeros(date.getSeconds(), token.length);
22398 },
22399 // Fraction of second
22400 S(date, token) {
22401 const numberOfDigits = token.length;
22402 const milliseconds = date.getMilliseconds();
22403 const fractionalSeconds = Math.trunc(
22404 milliseconds * Math.pow(10, numberOfDigits - 3)
22405 );
22406 return addLeadingZeros(fractionalSeconds, token.length);
22407 }
22408 };
22409
22410 // node_modules/date-fns/_lib/format/formatters.js
22411 var dayPeriodEnum = {
22412 am: "am",
22413 pm: "pm",
22414 midnight: "midnight",
22415 noon: "noon",
22416 morning: "morning",
22417 afternoon: "afternoon",
22418 evening: "evening",
22419 night: "night"
22420 };
22421 var formatters = {
22422 // Era
22423 G: function(date, token, localize2) {
22424 const era = date.getFullYear() > 0 ? 1 : 0;
22425 switch (token) {
22426 // AD, BC
22427 case "G":
22428 case "GG":
22429 case "GGG":
22430 return localize2.era(era, { width: "abbreviated" });
22431 // A, B
22432 case "GGGGG":
22433 return localize2.era(era, { width: "narrow" });
22434 // Anno Domini, Before Christ
22435 case "GGGG":
22436 default:
22437 return localize2.era(era, { width: "wide" });
22438 }
22439 },
22440 // Year
22441 y: function(date, token, localize2) {
22442 if (token === "yo") {
22443 const signedYear = date.getFullYear();
22444 const year = signedYear > 0 ? signedYear : 1 - signedYear;
22445 return localize2.ordinalNumber(year, { unit: "year" });
22446 }
22447 return lightFormatters.y(date, token);
22448 },
22449 // Local week-numbering year
22450 Y: function(date, token, localize2, options) {
22451 const signedWeekYear = getWeekYear(date, options);
22452 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
22453 if (token === "YY") {
22454 const twoDigitYear = weekYear % 100;
22455 return addLeadingZeros(twoDigitYear, 2);
22456 }
22457 if (token === "Yo") {
22458 return localize2.ordinalNumber(weekYear, { unit: "year" });
22459 }
22460 return addLeadingZeros(weekYear, token.length);
22461 },
22462 // ISO week-numbering year
22463 R: function(date, token) {
22464 const isoWeekYear = getISOWeekYear(date);
22465 return addLeadingZeros(isoWeekYear, token.length);
22466 },
22467 // Extended year. This is a single number designating the year of this calendar system.
22468 // The main difference between `y` and `u` localizers are B.C. years:
22469 // | Year | `y` | `u` |
22470 // |------|-----|-----|
22471 // | AC 1 | 1 | 1 |
22472 // | BC 1 | 1 | 0 |
22473 // | BC 2 | 2 | -1 |
22474 // Also `yy` always returns the last two digits of a year,
22475 // while `uu` pads single digit years to 2 characters and returns other years unchanged.
22476 u: function(date, token) {
22477 const year = date.getFullYear();
22478 return addLeadingZeros(year, token.length);
22479 },
22480 // Quarter
22481 Q: function(date, token, localize2) {
22482 const quarter = Math.ceil((date.getMonth() + 1) / 3);
22483 switch (token) {
22484 // 1, 2, 3, 4
22485 case "Q":
22486 return String(quarter);
22487 // 01, 02, 03, 04
22488 case "QQ":
22489 return addLeadingZeros(quarter, 2);
22490 // 1st, 2nd, 3rd, 4th
22491 case "Qo":
22492 return localize2.ordinalNumber(quarter, { unit: "quarter" });
22493 // Q1, Q2, Q3, Q4
22494 case "QQQ":
22495 return localize2.quarter(quarter, {
22496 width: "abbreviated",
22497 context: "formatting"
22498 });
22499 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
22500 case "QQQQQ":
22501 return localize2.quarter(quarter, {
22502 width: "narrow",
22503 context: "formatting"
22504 });
22505 // 1st quarter, 2nd quarter, ...
22506 case "QQQQ":
22507 default:
22508 return localize2.quarter(quarter, {
22509 width: "wide",
22510 context: "formatting"
22511 });
22512 }
22513 },
22514 // Stand-alone quarter
22515 q: function(date, token, localize2) {
22516 const quarter = Math.ceil((date.getMonth() + 1) / 3);
22517 switch (token) {
22518 // 1, 2, 3, 4
22519 case "q":
22520 return String(quarter);
22521 // 01, 02, 03, 04
22522 case "qq":
22523 return addLeadingZeros(quarter, 2);
22524 // 1st, 2nd, 3rd, 4th
22525 case "qo":
22526 return localize2.ordinalNumber(quarter, { unit: "quarter" });
22527 // Q1, Q2, Q3, Q4
22528 case "qqq":
22529 return localize2.quarter(quarter, {
22530 width: "abbreviated",
22531 context: "standalone"
22532 });
22533 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
22534 case "qqqqq":
22535 return localize2.quarter(quarter, {
22536 width: "narrow",
22537 context: "standalone"
22538 });
22539 // 1st quarter, 2nd quarter, ...
22540 case "qqqq":
22541 default:
22542 return localize2.quarter(quarter, {
22543 width: "wide",
22544 context: "standalone"
22545 });
22546 }
22547 },
22548 // Month
22549 M: function(date, token, localize2) {
22550 const month = date.getMonth();
22551 switch (token) {
22552 case "M":
22553 case "MM":
22554 return lightFormatters.M(date, token);
22555 // 1st, 2nd, ..., 12th
22556 case "Mo":
22557 return localize2.ordinalNumber(month + 1, { unit: "month" });
22558 // Jan, Feb, ..., Dec
22559 case "MMM":
22560 return localize2.month(month, {
22561 width: "abbreviated",
22562 context: "formatting"
22563 });
22564 // J, F, ..., D
22565 case "MMMMM":
22566 return localize2.month(month, {
22567 width: "narrow",
22568 context: "formatting"
22569 });
22570 // January, February, ..., December
22571 case "MMMM":
22572 default:
22573 return localize2.month(month, { width: "wide", context: "formatting" });
22574 }
22575 },
22576 // Stand-alone month
22577 L: function(date, token, localize2) {
22578 const month = date.getMonth();
22579 switch (token) {
22580 // 1, 2, ..., 12
22581 case "L":
22582 return String(month + 1);
22583 // 01, 02, ..., 12
22584 case "LL":
22585 return addLeadingZeros(month + 1, 2);
22586 // 1st, 2nd, ..., 12th
22587 case "Lo":
22588 return localize2.ordinalNumber(month + 1, { unit: "month" });
22589 // Jan, Feb, ..., Dec
22590 case "LLL":
22591 return localize2.month(month, {
22592 width: "abbreviated",
22593 context: "standalone"
22594 });
22595 // J, F, ..., D
22596 case "LLLLL":
22597 return localize2.month(month, {
22598 width: "narrow",
22599 context: "standalone"
22600 });
22601 // January, February, ..., December
22602 case "LLLL":
22603 default:
22604 return localize2.month(month, { width: "wide", context: "standalone" });
22605 }
22606 },
22607 // Local week of year
22608 w: function(date, token, localize2, options) {
22609 const week = getWeek(date, options);
22610 if (token === "wo") {
22611 return localize2.ordinalNumber(week, { unit: "week" });
22612 }
22613 return addLeadingZeros(week, token.length);
22614 },
22615 // ISO week of year
22616 I: function(date, token, localize2) {
22617 const isoWeek = getISOWeek(date);
22618 if (token === "Io") {
22619 return localize2.ordinalNumber(isoWeek, { unit: "week" });
22620 }
22621 return addLeadingZeros(isoWeek, token.length);
22622 },
22623 // Day of the month
22624 d: function(date, token, localize2) {
22625 if (token === "do") {
22626 return localize2.ordinalNumber(date.getDate(), { unit: "date" });
22627 }
22628 return lightFormatters.d(date, token);
22629 },
22630 // Day of year
22631 D: function(date, token, localize2) {
22632 const dayOfYear = getDayOfYear(date);
22633 if (token === "Do") {
22634 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
22635 }
22636 return addLeadingZeros(dayOfYear, token.length);
22637 },
22638 // Day of week
22639 E: function(date, token, localize2) {
22640 const dayOfWeek = date.getDay();
22641 switch (token) {
22642 // Tue
22643 case "E":
22644 case "EE":
22645 case "EEE":
22646 return localize2.day(dayOfWeek, {
22647 width: "abbreviated",
22648 context: "formatting"
22649 });
22650 // T
22651 case "EEEEE":
22652 return localize2.day(dayOfWeek, {
22653 width: "narrow",
22654 context: "formatting"
22655 });
22656 // Tu
22657 case "EEEEEE":
22658 return localize2.day(dayOfWeek, {
22659 width: "short",
22660 context: "formatting"
22661 });
22662 // Tuesday
22663 case "EEEE":
22664 default:
22665 return localize2.day(dayOfWeek, {
22666 width: "wide",
22667 context: "formatting"
22668 });
22669 }
22670 },
22671 // Local day of week
22672 e: function(date, token, localize2, options) {
22673 const dayOfWeek = date.getDay();
22674 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
22675 switch (token) {
22676 // Numerical value (Nth day of week with current locale or weekStartsOn)
22677 case "e":
22678 return String(localDayOfWeek);
22679 // Padded numerical value
22680 case "ee":
22681 return addLeadingZeros(localDayOfWeek, 2);
22682 // 1st, 2nd, ..., 7th
22683 case "eo":
22684 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
22685 case "eee":
22686 return localize2.day(dayOfWeek, {
22687 width: "abbreviated",
22688 context: "formatting"
22689 });
22690 // T
22691 case "eeeee":
22692 return localize2.day(dayOfWeek, {
22693 width: "narrow",
22694 context: "formatting"
22695 });
22696 // Tu
22697 case "eeeeee":
22698 return localize2.day(dayOfWeek, {
22699 width: "short",
22700 context: "formatting"
22701 });
22702 // Tuesday
22703 case "eeee":
22704 default:
22705 return localize2.day(dayOfWeek, {
22706 width: "wide",
22707 context: "formatting"
22708 });
22709 }
22710 },
22711 // Stand-alone local day of week
22712 c: function(date, token, localize2, options) {
22713 const dayOfWeek = date.getDay();
22714 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
22715 switch (token) {
22716 // Numerical value (same as in `e`)
22717 case "c":
22718 return String(localDayOfWeek);
22719 // Padded numerical value
22720 case "cc":
22721 return addLeadingZeros(localDayOfWeek, token.length);
22722 // 1st, 2nd, ..., 7th
22723 case "co":
22724 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
22725 case "ccc":
22726 return localize2.day(dayOfWeek, {
22727 width: "abbreviated",
22728 context: "standalone"
22729 });
22730 // T
22731 case "ccccc":
22732 return localize2.day(dayOfWeek, {
22733 width: "narrow",
22734 context: "standalone"
22735 });
22736 // Tu
22737 case "cccccc":
22738 return localize2.day(dayOfWeek, {
22739 width: "short",
22740 context: "standalone"
22741 });
22742 // Tuesday
22743 case "cccc":
22744 default:
22745 return localize2.day(dayOfWeek, {
22746 width: "wide",
22747 context: "standalone"
22748 });
22749 }
22750 },
22751 // ISO day of week
22752 i: function(date, token, localize2) {
22753 const dayOfWeek = date.getDay();
22754 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
22755 switch (token) {
22756 // 2
22757 case "i":
22758 return String(isoDayOfWeek);
22759 // 02
22760 case "ii":
22761 return addLeadingZeros(isoDayOfWeek, token.length);
22762 // 2nd
22763 case "io":
22764 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
22765 // Tue
22766 case "iii":
22767 return localize2.day(dayOfWeek, {
22768 width: "abbreviated",
22769 context: "formatting"
22770 });
22771 // T
22772 case "iiiii":
22773 return localize2.day(dayOfWeek, {
22774 width: "narrow",
22775 context: "formatting"
22776 });
22777 // Tu
22778 case "iiiiii":
22779 return localize2.day(dayOfWeek, {
22780 width: "short",
22781 context: "formatting"
22782 });
22783 // Tuesday
22784 case "iiii":
22785 default:
22786 return localize2.day(dayOfWeek, {
22787 width: "wide",
22788 context: "formatting"
22789 });
22790 }
22791 },
22792 // AM or PM
22793 a: function(date, token, localize2) {
22794 const hours = date.getHours();
22795 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
22796 switch (token) {
22797 case "a":
22798 case "aa":
22799 return localize2.dayPeriod(dayPeriodEnumValue, {
22800 width: "abbreviated",
22801 context: "formatting"
22802 });
22803 case "aaa":
22804 return localize2.dayPeriod(dayPeriodEnumValue, {
22805 width: "abbreviated",
22806 context: "formatting"
22807 }).toLowerCase();
22808 case "aaaaa":
22809 return localize2.dayPeriod(dayPeriodEnumValue, {
22810 width: "narrow",
22811 context: "formatting"
22812 });
22813 case "aaaa":
22814 default:
22815 return localize2.dayPeriod(dayPeriodEnumValue, {
22816 width: "wide",
22817 context: "formatting"
22818 });
22819 }
22820 },
22821 // AM, PM, midnight, noon
22822 b: function(date, token, localize2) {
22823 const hours = date.getHours();
22824 let dayPeriodEnumValue;
22825 if (hours === 12) {
22826 dayPeriodEnumValue = dayPeriodEnum.noon;
22827 } else if (hours === 0) {
22828 dayPeriodEnumValue = dayPeriodEnum.midnight;
22829 } else {
22830 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
22831 }
22832 switch (token) {
22833 case "b":
22834 case "bb":
22835 return localize2.dayPeriod(dayPeriodEnumValue, {
22836 width: "abbreviated",
22837 context: "formatting"
22838 });
22839 case "bbb":
22840 return localize2.dayPeriod(dayPeriodEnumValue, {
22841 width: "abbreviated",
22842 context: "formatting"
22843 }).toLowerCase();
22844 case "bbbbb":
22845 return localize2.dayPeriod(dayPeriodEnumValue, {
22846 width: "narrow",
22847 context: "formatting"
22848 });
22849 case "bbbb":
22850 default:
22851 return localize2.dayPeriod(dayPeriodEnumValue, {
22852 width: "wide",
22853 context: "formatting"
22854 });
22855 }
22856 },
22857 // in the morning, in the afternoon, in the evening, at night
22858 B: function(date, token, localize2) {
22859 const hours = date.getHours();
22860 let dayPeriodEnumValue;
22861 if (hours >= 17) {
22862 dayPeriodEnumValue = dayPeriodEnum.evening;
22863 } else if (hours >= 12) {
22864 dayPeriodEnumValue = dayPeriodEnum.afternoon;
22865 } else if (hours >= 4) {
22866 dayPeriodEnumValue = dayPeriodEnum.morning;
22867 } else {
22868 dayPeriodEnumValue = dayPeriodEnum.night;
22869 }
22870 switch (token) {
22871 case "B":
22872 case "BB":
22873 case "BBB":
22874 return localize2.dayPeriod(dayPeriodEnumValue, {
22875 width: "abbreviated",
22876 context: "formatting"
22877 });
22878 case "BBBBB":
22879 return localize2.dayPeriod(dayPeriodEnumValue, {
22880 width: "narrow",
22881 context: "formatting"
22882 });
22883 case "BBBB":
22884 default:
22885 return localize2.dayPeriod(dayPeriodEnumValue, {
22886 width: "wide",
22887 context: "formatting"
22888 });
22889 }
22890 },
22891 // Hour [1-12]
22892 h: function(date, token, localize2) {
22893 if (token === "ho") {
22894 let hours = date.getHours() % 12;
22895 if (hours === 0) hours = 12;
22896 return localize2.ordinalNumber(hours, { unit: "hour" });
22897 }
22898 return lightFormatters.h(date, token);
22899 },
22900 // Hour [0-23]
22901 H: function(date, token, localize2) {
22902 if (token === "Ho") {
22903 return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
22904 }
22905 return lightFormatters.H(date, token);
22906 },
22907 // Hour [0-11]
22908 K: function(date, token, localize2) {
22909 const hours = date.getHours() % 12;
22910 if (token === "Ko") {
22911 return localize2.ordinalNumber(hours, { unit: "hour" });
22912 }
22913 return addLeadingZeros(hours, token.length);
22914 },
22915 // Hour [1-24]
22916 k: function(date, token, localize2) {
22917 let hours = date.getHours();
22918 if (hours === 0) hours = 24;
22919 if (token === "ko") {
22920 return localize2.ordinalNumber(hours, { unit: "hour" });
22921 }
22922 return addLeadingZeros(hours, token.length);
22923 },
22924 // Minute
22925 m: function(date, token, localize2) {
22926 if (token === "mo") {
22927 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
22928 }
22929 return lightFormatters.m(date, token);
22930 },
22931 // Second
22932 s: function(date, token, localize2) {
22933 if (token === "so") {
22934 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
22935 }
22936 return lightFormatters.s(date, token);
22937 },
22938 // Fraction of second
22939 S: function(date, token) {
22940 return lightFormatters.S(date, token);
22941 },
22942 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
22943 X: function(date, token, _localize) {
22944 const timezoneOffset = date.getTimezoneOffset();
22945 if (timezoneOffset === 0) {
22946 return "Z";
22947 }
22948 switch (token) {
22949 // Hours and optional minutes
22950 case "X":
22951 return formatTimezoneWithOptionalMinutes(timezoneOffset);
22952 // Hours, minutes and optional seconds without `:` delimiter
22953 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
22954 // so this token always has the same output as `XX`
22955 case "XXXX":
22956 case "XX":
22957 return formatTimezone(timezoneOffset);
22958 // Hours, minutes and optional seconds with `:` delimiter
22959 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
22960 // so this token always has the same output as `XXX`
22961 case "XXXXX":
22962 case "XXX":
22963 // Hours and minutes with `:` delimiter
22964 default:
22965 return formatTimezone(timezoneOffset, ":");
22966 }
22967 },
22968 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
22969 x: function(date, token, _localize) {
22970 const timezoneOffset = date.getTimezoneOffset();
22971 switch (token) {
22972 // Hours and optional minutes
22973 case "x":
22974 return formatTimezoneWithOptionalMinutes(timezoneOffset);
22975 // Hours, minutes and optional seconds without `:` delimiter
22976 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
22977 // so this token always has the same output as `xx`
22978 case "xxxx":
22979 case "xx":
22980 return formatTimezone(timezoneOffset);
22981 // Hours, minutes and optional seconds with `:` delimiter
22982 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
22983 // so this token always has the same output as `xxx`
22984 case "xxxxx":
22985 case "xxx":
22986 // Hours and minutes with `:` delimiter
22987 default:
22988 return formatTimezone(timezoneOffset, ":");
22989 }
22990 },
22991 // Timezone (GMT)
22992 O: function(date, token, _localize) {
22993 const timezoneOffset = date.getTimezoneOffset();
22994 switch (token) {
22995 // Short
22996 case "O":
22997 case "OO":
22998 case "OOO":
22999 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
23000 // Long
23001 case "OOOO":
23002 default:
23003 return "GMT" + formatTimezone(timezoneOffset, ":");
23004 }
23005 },
23006 // Timezone (specific non-location)
23007 z: function(date, token, _localize) {
23008 const timezoneOffset = date.getTimezoneOffset();
23009 switch (token) {
23010 // Short
23011 case "z":
23012 case "zz":
23013 case "zzz":
23014 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
23015 // Long
23016 case "zzzz":
23017 default:
23018 return "GMT" + formatTimezone(timezoneOffset, ":");
23019 }
23020 },
23021 // Seconds timestamp
23022 t: function(date, token, _localize) {
23023 const timestamp = Math.trunc(+date / 1e3);
23024 return addLeadingZeros(timestamp, token.length);
23025 },
23026 // Milliseconds timestamp
23027 T: function(date, token, _localize) {
23028 return addLeadingZeros(+date, token.length);
23029 }
23030 };
23031 function formatTimezoneShort(offset4, delimiter = "") {
23032 const sign = offset4 > 0 ? "-" : "+";
23033 const absOffset = Math.abs(offset4);
23034 const hours = Math.trunc(absOffset / 60);
23035 const minutes = absOffset % 60;
23036 if (minutes === 0) {
23037 return sign + String(hours);
23038 }
23039 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
23040 }
23041 function formatTimezoneWithOptionalMinutes(offset4, delimiter) {
23042 if (offset4 % 60 === 0) {
23043 const sign = offset4 > 0 ? "-" : "+";
23044 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2);
23045 }
23046 return formatTimezone(offset4, delimiter);
23047 }
23048 function formatTimezone(offset4, delimiter = "") {
23049 const sign = offset4 > 0 ? "-" : "+";
23050 const absOffset = Math.abs(offset4);
23051 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
23052 const minutes = addLeadingZeros(absOffset % 60, 2);
23053 return sign + hours + delimiter + minutes;
23054 }
23055
23056 // node_modules/date-fns/_lib/format/longFormatters.js
23057 var dateLongFormatter = (pattern, formatLong2) => {
23058 switch (pattern) {
23059 case "P":
23060 return formatLong2.date({ width: "short" });
23061 case "PP":
23062 return formatLong2.date({ width: "medium" });
23063 case "PPP":
23064 return formatLong2.date({ width: "long" });
23065 case "PPPP":
23066 default:
23067 return formatLong2.date({ width: "full" });
23068 }
23069 };
23070 var timeLongFormatter = (pattern, formatLong2) => {
23071 switch (pattern) {
23072 case "p":
23073 return formatLong2.time({ width: "short" });
23074 case "pp":
23075 return formatLong2.time({ width: "medium" });
23076 case "ppp":
23077 return formatLong2.time({ width: "long" });
23078 case "pppp":
23079 default:
23080 return formatLong2.time({ width: "full" });
23081 }
23082 };
23083 var dateTimeLongFormatter = (pattern, formatLong2) => {
23084 const matchResult = pattern.match(/(P+)(p+)?/) || [];
23085 const datePattern = matchResult[1];
23086 const timePattern = matchResult[2];
23087 if (!timePattern) {
23088 return dateLongFormatter(pattern, formatLong2);
23089 }
23090 let dateTimeFormat;
23091 switch (datePattern) {
23092 case "P":
23093 dateTimeFormat = formatLong2.dateTime({ width: "short" });
23094 break;
23095 case "PP":
23096 dateTimeFormat = formatLong2.dateTime({ width: "medium" });
23097 break;
23098 case "PPP":
23099 dateTimeFormat = formatLong2.dateTime({ width: "long" });
23100 break;
23101 case "PPPP":
23102 default:
23103 dateTimeFormat = formatLong2.dateTime({ width: "full" });
23104 break;
23105 }
23106 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
23107 };
23108 var longFormatters = {
23109 p: timeLongFormatter,
23110 P: dateTimeLongFormatter
23111 };
23112
23113 // node_modules/date-fns/_lib/protectedTokens.js
23114 var dayOfYearTokenRE = /^D+$/;
23115 var weekYearTokenRE = /^Y+$/;
23116 var throwTokens = ["D", "DD", "YY", "YYYY"];
23117 function isProtectedDayOfYearToken(token) {
23118 return dayOfYearTokenRE.test(token);
23119 }
23120 function isProtectedWeekYearToken(token) {
23121 return weekYearTokenRE.test(token);
23122 }
23123 function warnOrThrowProtectedError(token, format6, input) {
23124 const _message = message(token, format6, input);
23125 console.warn(_message);
23126 if (throwTokens.includes(token)) throw new RangeError(_message);
23127 }
23128 function message(token, format6, input) {
23129 const subject = token[0] === "Y" ? "years" : "days of the month";
23130 return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format6}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
23131 }
23132
23133 // node_modules/date-fns/format.js
23134 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
23135 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
23136 var escapedStringRegExp = /^'([^]*?)'?$/;
23137 var doubleQuoteRegExp = /''/g;
23138 var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
23139 function format(date, formatStr, options) {
23140 const defaultOptions2 = getDefaultOptions();
23141 const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
23142 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
23143 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
23144 const originalDate = toDate(date, options?.in);
23145 if (!isValid(originalDate)) {
23146 throw new RangeError("Invalid time value");
23147 }
23148 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
23149 const firstCharacter = substring[0];
23150 if (firstCharacter === "p" || firstCharacter === "P") {
23151 const longFormatter = longFormatters[firstCharacter];
23152 return longFormatter(substring, locale.formatLong);
23153 }
23154 return substring;
23155 }).join("").match(formattingTokensRegExp).map((substring) => {
23156 if (substring === "''") {
23157 return { isToken: false, value: "'" };
23158 }
23159 const firstCharacter = substring[0];
23160 if (firstCharacter === "'") {
23161 return { isToken: false, value: cleanEscapedString(substring) };
23162 }
23163 if (formatters[firstCharacter]) {
23164 return { isToken: true, value: substring };
23165 }
23166 if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
23167 throw new RangeError(
23168 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
23169 );
23170 }
23171 return { isToken: false, value: substring };
23172 });
23173 if (locale.localize.preprocessor) {
23174 parts = locale.localize.preprocessor(originalDate, parts);
23175 }
23176 const formatterOptions = {
23177 firstWeekContainsDate,
23178 weekStartsOn,
23179 locale
23180 };
23181 return parts.map((part) => {
23182 if (!part.isToken) return part.value;
23183 const token = part.value;
23184 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
23185 warnOrThrowProtectedError(token, formatStr, String(date));
23186 }
23187 const formatter = formatters[token[0]];
23188 return formatter(originalDate, token, locale.localize, formatterOptions);
23189 }).join("");
23190 }
23191 function cleanEscapedString(input) {
23192 const matched = input.match(escapedStringRegExp);
23193 if (!matched) {
23194 return input;
23195 }
23196 return matched[1].replace(doubleQuoteRegExp, "'");
23197 }
23198
23199 // node_modules/date-fns/subDays.js
23200 function subDays(date, amount, options) {
23201 return addDays(date, -amount, options);
23202 }
23203
23204 // node_modules/date-fns/subMonths.js
23205 function subMonths(date, amount, options) {
23206 return addMonths(date, -amount, options);
23207 }
23208
23209 // node_modules/date-fns/subWeeks.js
23210 function subWeeks(date, amount, options) {
23211 return addWeeks(date, -amount, options);
23212 }
23213
23214 // node_modules/date-fns/subYears.js
23215 function subYears(date, amount, options) {
23216 return addYears(date, -amount, options);
23217 }
23218
23219 // packages/dataviews/build-module/utils/operators.mjs
23220 var import_i18n25 = __toESM(require_i18n(), 1);
23221 var import_element66 = __toESM(require_element(), 1);
23222 var import_date = __toESM(require_date(), 1);
23223 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
23224 var filterTextWrappers = {
23225 Name: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
23226 Value: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
23227 };
23228 function getRelativeDate(value, unit) {
23229 switch (unit) {
23230 case "days":
23231 return subDays(/* @__PURE__ */ new Date(), value);
23232 case "weeks":
23233 return subWeeks(/* @__PURE__ */ new Date(), value);
23234 case "months":
23235 return subMonths(/* @__PURE__ */ new Date(), value);
23236 case "years":
23237 return subYears(/* @__PURE__ */ new Date(), value);
23238 default:
23239 return /* @__PURE__ */ new Date();
23240 }
23241 }
23242 var isNoneOperatorDefinition = {
23243 /* translators: DataViews operator name */
23244 label: (0, import_i18n25.__)("Is none of"),
23245 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23246 (0, import_i18n25.sprintf)(
23247 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
23248 (0, import_i18n25.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
23249 filter.name,
23250 activeElements.map((element) => element.label).join(", ")
23251 ),
23252 filterTextWrappers
23253 ),
23254 filter: ((item, field, filterValue) => {
23255 if (!filterValue?.length) {
23256 return true;
23257 }
23258 const fieldValue = field.getValue({ item });
23259 if (Array.isArray(fieldValue)) {
23260 return !filterValue.some(
23261 (fv) => fieldValue.includes(fv)
23262 );
23263 } else if (typeof fieldValue === "string") {
23264 return !filterValue.includes(fieldValue);
23265 }
23266 return false;
23267 }),
23268 selection: "multi"
23269 };
23270 var OPERATORS = [
23271 {
23272 name: OPERATOR_IS_ANY,
23273 /* translators: DataViews operator name */
23274 label: (0, import_i18n25.__)("Includes"),
23275 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23276 (0, import_i18n25.sprintf)(
23277 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
23278 (0, import_i18n25.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
23279 filter.name,
23280 activeElements.map((element) => element.label).join(", ")
23281 ),
23282 filterTextWrappers
23283 ),
23284 filter(item, field, filterValue) {
23285 if (!filterValue?.length) {
23286 return true;
23287 }
23288 const fieldValue = field.getValue({ item });
23289 if (Array.isArray(fieldValue)) {
23290 return filterValue.some(
23291 (fv) => fieldValue.includes(fv)
23292 );
23293 } else if (typeof fieldValue === "string") {
23294 return filterValue.includes(fieldValue);
23295 }
23296 return false;
23297 },
23298 selection: "multi"
23299 },
23300 {
23301 name: OPERATOR_IS_NONE,
23302 ...isNoneOperatorDefinition
23303 },
23304 {
23305 name: OPERATOR_IS_ALL,
23306 /* translators: DataViews operator name */
23307 label: (0, import_i18n25.__)("Includes all"),
23308 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23309 (0, import_i18n25.sprintf)(
23310 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
23311 (0, import_i18n25.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
23312 filter.name,
23313 activeElements.map((element) => element.label).join(", ")
23314 ),
23315 filterTextWrappers
23316 ),
23317 filter(item, field, filterValue) {
23318 if (!filterValue?.length) {
23319 return true;
23320 }
23321 return filterValue.every((value) => {
23322 return field.getValue({ item })?.includes(value);
23323 });
23324 },
23325 selection: "multi"
23326 },
23327 {
23328 name: OPERATOR_IS_NOT_ALL,
23329 ...isNoneOperatorDefinition
23330 },
23331 {
23332 name: OPERATOR_BETWEEN,
23333 /* translators: DataViews operator name */
23334 label: (0, import_i18n25.__)("Between (inc)"),
23335 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23336 (0, import_i18n25.sprintf)(
23337 /* translators: 1: Filter name (e.g. "Item count"). 2: Filter value min. 3: Filter value max. e.g.: "Item count between (inc): 10 and 180". */
23338 (0, import_i18n25.__)(
23339 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
23340 ),
23341 filter.name,
23342 activeElements[0].label[0],
23343 activeElements[0].label[1]
23344 ),
23345 filterTextWrappers
23346 ),
23347 filter(item, field, filterValue) {
23348 if (!Array.isArray(filterValue) || filterValue.length !== 2 || filterValue[0] === void 0 || filterValue[1] === void 0) {
23349 return true;
23350 }
23351 const fieldValue = field.getValue({ item });
23352 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
23353 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1];
23354 }
23355 return false;
23356 },
23357 selection: "custom"
23358 },
23359 {
23360 name: OPERATOR_IN_THE_PAST,
23361 /* translators: DataViews operator name */
23362 label: (0, import_i18n25.__)("In the past"),
23363 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23364 (0, import_i18n25.sprintf)(
23365 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
23366 (0, import_i18n25.__)(
23367 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
23368 ),
23369 filter.name,
23370 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
23371 ),
23372 filterTextWrappers
23373 ),
23374 filter(item, field, filterValue) {
23375 if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
23376 return true;
23377 }
23378 const targetDate = getRelativeDate(
23379 filterValue.value,
23380 filterValue.unit
23381 );
23382 const fieldValue = (0, import_date.getDate)(field.getValue({ item }));
23383 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
23384 },
23385 selection: "custom"
23386 },
23387 {
23388 name: OPERATOR_OVER,
23389 /* translators: DataViews operator name */
23390 label: (0, import_i18n25.__)("Over"),
23391 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23392 (0, import_i18n25.sprintf)(
23393 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
23394 (0, import_i18n25.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
23395 filter.name,
23396 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
23397 ),
23398 filterTextWrappers
23399 ),
23400 filter(item, field, filterValue) {
23401 if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
23402 return true;
23403 }
23404 const targetDate = getRelativeDate(
23405 filterValue.value,
23406 filterValue.unit
23407 );
23408 const fieldValue = (0, import_date.getDate)(field.getValue({ item }));
23409 return fieldValue < targetDate;
23410 },
23411 selection: "custom"
23412 },
23413 {
23414 name: OPERATOR_IS,
23415 /* translators: DataViews operator name */
23416 label: (0, import_i18n25.__)("Is"),
23417 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23418 (0, import_i18n25.sprintf)(
23419 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
23420 (0, import_i18n25.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
23421 filter.name,
23422 activeElements[0].label
23423 ),
23424 filterTextWrappers
23425 ),
23426 filter(item, field, filterValue) {
23427 return filterValue === field.getValue({ item }) || filterValue === void 0;
23428 },
23429 selection: "single"
23430 },
23431 {
23432 name: OPERATOR_IS_NOT,
23433 /* translators: DataViews operator name */
23434 label: (0, import_i18n25.__)("Is not"),
23435 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23436 (0, import_i18n25.sprintf)(
23437 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
23438 (0, import_i18n25.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
23439 filter.name,
23440 activeElements[0].label
23441 ),
23442 filterTextWrappers
23443 ),
23444 filter(item, field, filterValue) {
23445 return filterValue !== field.getValue({ item });
23446 },
23447 selection: "single"
23448 },
23449 {
23450 name: OPERATOR_LESS_THAN,
23451 /* translators: DataViews operator name */
23452 label: (0, import_i18n25.__)("Less than"),
23453 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23454 (0, import_i18n25.sprintf)(
23455 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
23456 (0, import_i18n25.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
23457 filter.name,
23458 activeElements[0].label
23459 ),
23460 filterTextWrappers
23461 ),
23462 filter(item, field, filterValue) {
23463 if (filterValue === void 0) {
23464 return true;
23465 }
23466 const fieldValue = field.getValue({ item });
23467 return fieldValue < filterValue;
23468 },
23469 selection: "single"
23470 },
23471 {
23472 name: OPERATOR_GREATER_THAN,
23473 /* translators: DataViews operator name */
23474 label: (0, import_i18n25.__)("Greater than"),
23475 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23476 (0, import_i18n25.sprintf)(
23477 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
23478 (0, import_i18n25.__)(
23479 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
23480 ),
23481 filter.name,
23482 activeElements[0].label
23483 ),
23484 filterTextWrappers
23485 ),
23486 filter(item, field, filterValue) {
23487 if (filterValue === void 0) {
23488 return true;
23489 }
23490 const fieldValue = field.getValue({ item });
23491 return fieldValue > filterValue;
23492 },
23493 selection: "single"
23494 },
23495 {
23496 name: OPERATOR_LESS_THAN_OR_EQUAL,
23497 /* translators: DataViews operator name */
23498 label: (0, import_i18n25.__)("Less than or equal"),
23499 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23500 (0, import_i18n25.sprintf)(
23501 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
23502 (0, import_i18n25.__)(
23503 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
23504 ),
23505 filter.name,
23506 activeElements[0].label
23507 ),
23508 filterTextWrappers
23509 ),
23510 filter(item, field, filterValue) {
23511 if (filterValue === void 0) {
23512 return true;
23513 }
23514 const fieldValue = field.getValue({ item });
23515 return fieldValue <= filterValue;
23516 },
23517 selection: "single"
23518 },
23519 {
23520 name: OPERATOR_GREATER_THAN_OR_EQUAL,
23521 /* translators: DataViews operator name */
23522 label: (0, import_i18n25.__)("Greater than or equal"),
23523 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23524 (0, import_i18n25.sprintf)(
23525 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
23526 (0, import_i18n25.__)(
23527 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
23528 ),
23529 filter.name,
23530 activeElements[0].label
23531 ),
23532 filterTextWrappers
23533 ),
23534 filter(item, field, filterValue) {
23535 if (filterValue === void 0) {
23536 return true;
23537 }
23538 const fieldValue = field.getValue({ item });
23539 return fieldValue >= filterValue;
23540 },
23541 selection: "single"
23542 },
23543 {
23544 name: OPERATOR_BEFORE,
23545 /* translators: DataViews operator name */
23546 label: (0, import_i18n25.__)("Before"),
23547 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23548 (0, import_i18n25.sprintf)(
23549 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
23550 (0, import_i18n25.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
23551 filter.name,
23552 activeElements[0].label
23553 ),
23554 filterTextWrappers
23555 ),
23556 filter(item, field, filterValue) {
23557 if (filterValue === void 0) {
23558 return true;
23559 }
23560 const filterDate = (0, import_date.getDate)(filterValue);
23561 const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
23562 return fieldDate < filterDate;
23563 },
23564 selection: "single"
23565 },
23566 {
23567 name: OPERATOR_AFTER,
23568 /* translators: DataViews operator name */
23569 label: (0, import_i18n25.__)("After"),
23570 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23571 (0, import_i18n25.sprintf)(
23572 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
23573 (0, import_i18n25.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
23574 filter.name,
23575 activeElements[0].label
23576 ),
23577 filterTextWrappers
23578 ),
23579 filter(item, field, filterValue) {
23580 if (filterValue === void 0) {
23581 return true;
23582 }
23583 const filterDate = (0, import_date.getDate)(filterValue);
23584 const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
23585 return fieldDate > filterDate;
23586 },
23587 selection: "single"
23588 },
23589 {
23590 name: OPERATOR_BEFORE_INC,
23591 /* translators: DataViews operator name */
23592 label: (0, import_i18n25.__)("Before (inc)"),
23593 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23594 (0, import_i18n25.sprintf)(
23595 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
23596 (0, import_i18n25.__)(
23597 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
23598 ),
23599 filter.name,
23600 activeElements[0].label
23601 ),
23602 filterTextWrappers
23603 ),
23604 filter(item, field, filterValue) {
23605 if (filterValue === void 0) {
23606 return true;
23607 }
23608 const filterDate = (0, import_date.getDate)(filterValue);
23609 const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
23610 return fieldDate <= filterDate;
23611 },
23612 selection: "single"
23613 },
23614 {
23615 name: OPERATOR_AFTER_INC,
23616 /* translators: DataViews operator name */
23617 label: (0, import_i18n25.__)("After (inc)"),
23618 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23619 (0, import_i18n25.sprintf)(
23620 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
23621 (0, import_i18n25.__)(
23622 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
23623 ),
23624 filter.name,
23625 activeElements[0].label
23626 ),
23627 filterTextWrappers
23628 ),
23629 filter(item, field, filterValue) {
23630 if (filterValue === void 0) {
23631 return true;
23632 }
23633 const filterDate = (0, import_date.getDate)(filterValue);
23634 const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
23635 return fieldDate >= filterDate;
23636 },
23637 selection: "single"
23638 },
23639 {
23640 name: OPERATOR_CONTAINS,
23641 /* translators: DataViews operator name */
23642 label: (0, import_i18n25.__)("Contains"),
23643 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23644 (0, import_i18n25.sprintf)(
23645 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
23646 (0, import_i18n25.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
23647 filter.name,
23648 activeElements[0].label
23649 ),
23650 filterTextWrappers
23651 ),
23652 filter(item, field, filterValue) {
23653 if (filterValue === void 0) {
23654 return true;
23655 }
23656 const fieldValue = field.getValue({ item });
23657 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
23658 },
23659 selection: "single"
23660 },
23661 {
23662 name: OPERATOR_NOT_CONTAINS,
23663 /* translators: DataViews operator name */
23664 label: (0, import_i18n25.__)("Doesn't contain"),
23665 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23666 (0, import_i18n25.sprintf)(
23667 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
23668 (0, import_i18n25.__)(
23669 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
23670 ),
23671 filter.name,
23672 activeElements[0].label
23673 ),
23674 filterTextWrappers
23675 ),
23676 filter(item, field, filterValue) {
23677 if (filterValue === void 0) {
23678 return true;
23679 }
23680 const fieldValue = field.getValue({ item });
23681 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
23682 },
23683 selection: "single"
23684 },
23685 {
23686 name: OPERATOR_STARTS_WITH,
23687 /* translators: DataViews operator name */
23688 label: (0, import_i18n25.__)("Starts with"),
23689 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23690 (0, import_i18n25.sprintf)(
23691 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
23692 (0, import_i18n25.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
23693 filter.name,
23694 activeElements[0].label
23695 ),
23696 filterTextWrappers
23697 ),
23698 filter(item, field, filterValue) {
23699 if (filterValue === void 0) {
23700 return true;
23701 }
23702 const fieldValue = field.getValue({ item });
23703 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase());
23704 },
23705 selection: "single"
23706 },
23707 {
23708 name: OPERATOR_ON,
23709 /* translators: DataViews operator name */
23710 label: (0, import_i18n25.__)("On"),
23711 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23712 (0, import_i18n25.sprintf)(
23713 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
23714 (0, import_i18n25.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
23715 filter.name,
23716 activeElements[0].label
23717 ),
23718 filterTextWrappers
23719 ),
23720 filter(item, field, filterValue) {
23721 if (filterValue === void 0) {
23722 return true;
23723 }
23724 const filterDate = (0, import_date.getDate)(filterValue);
23725 const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
23726 return filterDate.getTime() === fieldDate.getTime();
23727 },
23728 selection: "single"
23729 },
23730 {
23731 name: OPERATOR_NOT_ON,
23732 /* translators: DataViews operator name */
23733 label: (0, import_i18n25.__)("Not on"),
23734 filterText: (filter, activeElements) => (0, import_element66.createInterpolateElement)(
23735 (0, import_i18n25.sprintf)(
23736 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
23737 (0, import_i18n25.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
23738 filter.name,
23739 activeElements[0].label
23740 ),
23741 filterTextWrappers
23742 ),
23743 filter(item, field, filterValue) {
23744 if (filterValue === void 0) {
23745 return true;
23746 }
23747 const filterDate = (0, import_date.getDate)(filterValue);
23748 const fieldDate = (0, import_date.getDate)(field.getValue({ item }));
23749 return filterDate.getTime() !== fieldDate.getTime();
23750 },
23751 selection: "single"
23752 }
23753 ];
23754 var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name);
23755 var getAllOperatorNames = () => OPERATORS.map((op) => op.name);
23756 var isSingleSelectionOperator = (name) => OPERATORS.filter((op) => op.selection === "single").some(
23757 (op) => op.name === name
23758 );
23759 var isRegisteredOperator = (name) => OPERATORS.some((op) => op.name === name);
23760
23761 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs
23762 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
23763 var ENTER = "Enter";
23764 var SPACE = " ";
23765 var FilterText = ({
23766 activeElements,
23767 filterInView,
23768 filter
23769 }) => {
23770 if (activeElements === void 0 || activeElements.length === 0) {
23771 return filter.name;
23772 }
23773 const operator = getOperatorByName(filterInView?.operator);
23774 if (operator !== void 0) {
23775 return operator.filterText(filter, activeElements);
23776 }
23777 return (0, import_i18n26.sprintf)(
23778 /* translators: 1: Filter name e.g.: "Unknown status for Author". */
23779 (0, import_i18n26.__)("Unknown status for %1$s"),
23780 filter.name
23781 );
23782 };
23783 function OperatorSelector({
23784 filter,
23785 view,
23786 onChangeView
23787 }) {
23788 const operatorOptions = filter.operators?.map((operator) => ({
23789 value: operator,
23790 label: getOperatorByName(operator)?.label || operator
23791 }));
23792 const currentFilter = view.filters?.find(
23793 (_filter) => _filter.field === filter.field
23794 );
23795 const value = currentFilter?.operator || filter.operators[0];
23796 return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
23797 Stack,
23798 {
23799 direction: "row",
23800 gap: "sm",
23801 justify: "flex-start",
23802 className: "dataviews-filters__summary-operators-container",
23803 align: "center",
23804 children: [
23805 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_components20.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
23806 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
23807 import_components20.SelectControl,
23808 {
23809 className: "dataviews-filters__summary-operators-filter-select",
23810 label: (0, import_i18n26.__)("Conditions"),
23811 value,
23812 options: operatorOptions,
23813 onChange: (newValue) => {
23814 const newOperator = newValue;
23815 const currentOperator = currentFilter?.operator;
23816 const newFilters = currentFilter ? [
23817 ...(view.filters ?? []).map(
23818 (_filter) => {
23819 if (_filter.field === filter.field) {
23820 const currentOpSelectionModel = getOperatorByName(
23821 currentOperator
23822 )?.selection;
23823 const newOpSelectionModel = getOperatorByName(
23824 newOperator
23825 )?.selection;
23826 const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [
23827 currentOpSelectionModel,
23828 newOpSelectionModel
23829 ].includes("custom");
23830 return {
23831 ..._filter,
23832 value: shouldResetValue ? void 0 : _filter.value,
23833 operator: newOperator
23834 };
23835 }
23836 return _filter;
23837 }
23838 )
23839 ] : [
23840 ...view.filters ?? [],
23841 {
23842 field: filter.field,
23843 operator: newOperator,
23844 value: void 0
23845 }
23846 ];
23847 onChangeView({
23848 ...view,
23849 page: 1,
23850 filters: newFilters
23851 });
23852 },
23853 size: "small",
23854 variant: "minimal",
23855 hideLabelFromVision: true
23856 }
23857 )
23858 ]
23859 }
23860 );
23861 }
23862 function Filter({
23863 addFilterRef,
23864 openedFilter,
23865 fields,
23866 ...commonProps
23867 }) {
23868 const toggleRef = (0, import_element67.useRef)(null);
23869 const { filter, view, onChangeView } = commonProps;
23870 const filterInView = view.filters?.find(
23871 (f2) => f2.field === filter.field
23872 );
23873 let activeElements = [];
23874 const field = (0, import_element67.useMemo)(() => {
23875 const currentField = fields.find((f2) => f2.id === filter.field);
23876 if (currentField) {
23877 return {
23878 ...currentField,
23879 // Configure getValue as if Item was a plain object.
23880 // See related input-widget.tsx
23881 getValue: ({ item }) => item[currentField.id]
23882 };
23883 }
23884 return currentField;
23885 }, [fields, filter.field]);
23886 const { elements } = useElements({
23887 elements: filter.elements,
23888 getElements: filter.getElements
23889 });
23890 if (elements.length > 0) {
23891 activeElements = elements.filter((element) => {
23892 if (filter.singleSelection) {
23893 return element.value === filterInView?.value;
23894 }
23895 return filterInView?.value?.includes(element.value);
23896 });
23897 } else if (Array.isArray(filterInView?.value)) {
23898 const label = filterInView.value.map((v2) => {
23899 const formattedValue = field?.getValueFormatted({
23900 item: { [field.id]: v2 },
23901 field
23902 });
23903 return formattedValue || String(v2);
23904 });
23905 activeElements = [
23906 {
23907 value: filterInView.value,
23908 // @ts-ignore
23909 label
23910 }
23911 ];
23912 } else if (typeof filterInView?.value === "object") {
23913 activeElements = [
23914 { value: filterInView.value, label: filterInView.value }
23915 ];
23916 } else if (filterInView?.value !== void 0) {
23917 const label = field !== void 0 ? field.getValueFormatted({
23918 item: { [field.id]: filterInView.value },
23919 field
23920 }) : String(filterInView.value);
23921 activeElements = [
23922 {
23923 value: filterInView.value,
23924 label
23925 }
23926 ];
23927 }
23928 const isPrimary = filter.isPrimary;
23929 const isLocked = filterInView?.isLocked;
23930 const hasValues = !isLocked && filterInView?.value !== void 0;
23931 const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
23932 const resetOrRemoveLabel = isPrimary ? (0, import_i18n26.__)("Reset") : (0, import_i18n26.__)("Remove");
23933 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
23934 import_components20.Dropdown,
23935 {
23936 defaultOpen: openedFilter === filter.field,
23937 contentClassName: "dataviews-filters__summary-popover",
23938 popoverProps: { placement: "bottom-start", role: "dialog" },
23939 onClose: () => {
23940 toggleRef.current?.focus();
23941 },
23942 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [
23943 /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(tooltip_exports.Root, { children: [
23944 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
23945 tooltip_exports.Trigger,
23946 {
23947 render: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
23948 "div",
23949 {
23950 className: clsx_default(
23951 "dataviews-filters__summary-chip",
23952 {
23953 "has-reset": canResetOrRemove,
23954 "has-values": hasValues,
23955 "is-not-clickable": isLocked
23956 }
23957 ),
23958 role: "button",
23959 tabIndex: isLocked ? -1 : 0,
23960 onClick: () => {
23961 if (!isLocked) {
23962 onToggle();
23963 }
23964 },
23965 onKeyDown: (event) => {
23966 if (!isLocked && [ENTER, SPACE].includes(
23967 event.key
23968 )) {
23969 onToggle();
23970 event.preventDefault();
23971 }
23972 },
23973 "aria-disabled": isLocked,
23974 "aria-pressed": isOpen,
23975 "aria-expanded": isOpen,
23976 ref: toggleRef,
23977 children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
23978 FilterText,
23979 {
23980 activeElements,
23981 filterInView,
23982 filter
23983 }
23984 )
23985 }
23986 )
23987 }
23988 ),
23989 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(tooltip_exports.Popup, { children: (0, import_i18n26.sprintf)(
23990 /* translators: 1: Filter name. */
23991 (0, import_i18n26.__)("Filter by: %1$s"),
23992 filter.name.toLowerCase()
23993 ) })
23994 ] }),
23995 canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(tooltip_exports.Root, { children: [
23996 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
23997 tooltip_exports.Trigger,
23998 {
23999 render: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
24000 "button",
24001 {
24002 className: clsx_default(
24003 "dataviews-filters__summary-chip-remove",
24004 { "has-values": hasValues }
24005 ),
24006 "aria-label": resetOrRemoveLabel,
24007 onClick: () => {
24008 onChangeView({
24009 ...view,
24010 page: 1,
24011 filters: view.filters?.filter(
24012 (_filter) => _filter.field !== filter.field
24013 )
24014 });
24015 if (!isPrimary) {
24016 addFilterRef.current?.focus();
24017 } else {
24018 toggleRef.current?.focus();
24019 }
24020 },
24021 children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_components20.Icon, { icon: close_small_default })
24022 }
24023 )
24024 }
24025 ),
24026 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(tooltip_exports.Popup, { children: resetOrRemoveLabel })
24027 ] })
24028 ] }),
24029 renderContent: () => {
24030 return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Stack, { direction: "column", justify: "flex-start", children: [
24031 /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(OperatorSelector, { ...commonProps }),
24032 commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
24033 SearchWidget,
24034 {
24035 ...commonProps,
24036 filter: {
24037 ...commonProps.filter,
24038 elements
24039 }
24040 }
24041 ) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(InputWidget, { ...commonProps, fields })
24042 ] });
24043 }
24044 }
24045 );
24046 }
24047
24048 // packages/dataviews/build-module/components/dataviews-filters/add-filter.mjs
24049 var import_components21 = __toESM(require_components(), 1);
24050 var import_i18n27 = __toESM(require_i18n(), 1);
24051 var import_element68 = __toESM(require_element(), 1);
24052 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
24053 var { Menu: Menu4 } = unlock2(import_components21.privateApis);
24054 function AddFilterMenu({
24055 filters,
24056 view,
24057 onChangeView,
24058 setOpenedFilter,
24059 triggerProps
24060 }) {
24061 const inactiveFilters = filters.filter((filter) => !filter.isVisible);
24062 return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(Menu4, { children: [
24063 /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Menu4.TriggerButton, { ...triggerProps }),
24064 /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Menu4.Popover, { children: inactiveFilters.map((filter) => {
24065 return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24066 Menu4.Item,
24067 {
24068 onClick: () => {
24069 setOpenedFilter(filter.field);
24070 onChangeView({
24071 ...view,
24072 page: 1,
24073 filters: [
24074 ...view.filters || [],
24075 {
24076 field: filter.field,
24077 value: void 0,
24078 operator: filter.operators[0]
24079 }
24080 ]
24081 });
24082 },
24083 children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Menu4.ItemLabel, { children: filter.name })
24084 },
24085 filter.field
24086 );
24087 }) })
24088 ] });
24089 }
24090 function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
24091 if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) {
24092 return null;
24093 }
24094 const inactiveFilters = filters.filter((filter) => !filter.isVisible);
24095 return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24096 AddFilterMenu,
24097 {
24098 triggerProps: {
24099 render: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24100 import_components21.Button,
24101 {
24102 accessibleWhenDisabled: true,
24103 size: "compact",
24104 className: "dataviews-filters-button",
24105 variant: "tertiary",
24106 disabled: !inactiveFilters.length,
24107 ref
24108 }
24109 ),
24110 children: (0, import_i18n27.__)("Add filter")
24111 },
24112 ...{ filters, view, onChangeView, setOpenedFilter }
24113 }
24114 );
24115 }
24116 var add_filter_default = (0, import_element68.forwardRef)(AddFilter);
24117
24118 // packages/dataviews/build-module/components/dataviews-filters/reset-filters.mjs
24119 var import_components22 = __toESM(require_components(), 1);
24120 var import_i18n28 = __toESM(require_i18n(), 1);
24121 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
24122 function ResetFilter({
24123 filters,
24124 view,
24125 onChangeView
24126 }) {
24127 const isPrimary = (field) => filters.some(
24128 (_filter) => _filter.field === field && _filter.isPrimary
24129 );
24130 const isDisabled = !view.search && !view.filters?.some(
24131 (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
24132 );
24133 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
24134 import_components22.Button,
24135 {
24136 disabled: isDisabled,
24137 accessibleWhenDisabled: true,
24138 size: "compact",
24139 variant: "tertiary",
24140 className: "dataviews-filters__reset-button",
24141 onClick: () => {
24142 onChangeView({
24143 ...view,
24144 page: 1,
24145 search: "",
24146 filters: view.filters?.filter((f2) => !!f2.isLocked) || []
24147 });
24148 },
24149 children: (0, import_i18n28.__)("Reset")
24150 }
24151 );
24152 }
24153
24154 // packages/dataviews/build-module/components/dataviews-filters/use-filters.mjs
24155 var import_element69 = __toESM(require_element(), 1);
24156 function useFilters(fields, view) {
24157 return (0, import_element69.useMemo)(() => {
24158 const filters = [];
24159 fields.forEach((field) => {
24160 if (field.filterBy === false || !field.hasElements && !field.Edit) {
24161 return;
24162 }
24163 const operators = field.filterBy.operators;
24164 const isPrimary = !!field.filterBy?.isPrimary;
24165 const isLocked = view.filters?.some(
24166 (f2) => f2.field === field.id && !!f2.isLocked
24167 ) ?? false;
24168 filters.push({
24169 field: field.id,
24170 name: field.label,
24171 elements: field.elements,
24172 getElements: field.getElements,
24173 hasElements: field.hasElements,
24174 singleSelection: operators.some(
24175 (op) => isSingleSelectionOperator(op)
24176 ),
24177 operators,
24178 isVisible: isLocked || isPrimary || !!view.filters?.some(
24179 (f2) => f2.field === field.id && isRegisteredOperator(f2.operator)
24180 ),
24181 isPrimary,
24182 isLocked
24183 });
24184 });
24185 filters.sort((a2, b2) => {
24186 if (a2.isLocked && !b2.isLocked) {
24187 return -1;
24188 }
24189 if (!a2.isLocked && b2.isLocked) {
24190 return 1;
24191 }
24192 if (a2.isPrimary && !b2.isPrimary) {
24193 return -1;
24194 }
24195 if (!a2.isPrimary && b2.isPrimary) {
24196 return 1;
24197 }
24198 return a2.name.localeCompare(b2.name);
24199 });
24200 return filters;
24201 }, [fields, view]);
24202 }
24203 var use_filters_default = useFilters;
24204
24205 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs
24206 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
24207 function Filters({ className }) {
24208 const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element70.useContext)(dataviews_context_default);
24209 const addFilterRef = (0, import_element70.useRef)(null);
24210 const filters = use_filters_default(fields, view);
24211 const addFilter = /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
24212 add_filter_default,
24213 {
24214 filters,
24215 view,
24216 onChangeView,
24217 ref: addFilterRef,
24218 setOpenedFilter
24219 },
24220 "add-filter"
24221 );
24222 const visibleFilters = filters.filter((filter) => filter.isVisible);
24223 if (visibleFilters.length === 0) {
24224 return null;
24225 }
24226 const filterComponents = [
24227 ...visibleFilters.map((filter) => {
24228 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
24229 Filter,
24230 {
24231 filter,
24232 view,
24233 fields,
24234 onChangeView,
24235 addFilterRef,
24236 openedFilter
24237 },
24238 filter.field
24239 );
24240 }),
24241 addFilter
24242 ];
24243 filterComponents.push(
24244 /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
24245 ResetFilter,
24246 {
24247 filters,
24248 view,
24249 onChangeView
24250 },
24251 "reset-filters"
24252 )
24253 );
24254 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
24255 Stack,
24256 {
24257 direction: "row",
24258 justify: "flex-start",
24259 gap: "sm",
24260 style: { width: "fit-content" },
24261 wrap: "wrap",
24262 className,
24263 children: filterComponents
24264 }
24265 );
24266 }
24267 var filters_default = (0, import_element70.memo)(Filters);
24268
24269 // packages/dataviews/build-module/components/dataviews-filters/toggle.mjs
24270 var import_element71 = __toESM(require_element(), 1);
24271 var import_components23 = __toESM(require_components(), 1);
24272 var import_i18n29 = __toESM(require_i18n(), 1);
24273 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
24274 function FiltersToggle() {
24275 const {
24276 filters,
24277 view,
24278 onChangeView,
24279 setOpenedFilter,
24280 isShowingFilter,
24281 setIsShowingFilter
24282 } = (0, import_element71.useContext)(dataviews_context_default);
24283 const buttonRef = (0, import_element71.useRef)(null);
24284 const onChangeViewWithFilterVisibility = (0, import_element71.useCallback)(
24285 (_view) => {
24286 onChangeView(_view);
24287 setIsShowingFilter(true);
24288 },
24289 [onChangeView, setIsShowingFilter]
24290 );
24291 if (filters.length === 0) {
24292 return null;
24293 }
24294 const hasVisibleFilters = filters.some((filter) => filter.isVisible);
24295 const addFilterButtonProps = {
24296 label: (0, import_i18n29.__)("Add filter"),
24297 "aria-expanded": false,
24298 isPressed: false
24299 };
24300 const toggleFiltersButtonProps = {
24301 label: (0, import_i18n29._x)("Filter", "verb"),
24302 "aria-expanded": isShowingFilter,
24303 isPressed: isShowingFilter,
24304 onClick: () => {
24305 if (!isShowingFilter) {
24306 setOpenedFilter(null);
24307 }
24308 setIsShowingFilter(!isShowingFilter);
24309 }
24310 };
24311 const hasPrimaryOrLockedFilters = filters.some(
24312 (filter) => filter.isPrimary || filter.isLocked
24313 );
24314 const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24315 import_components23.Button,
24316 {
24317 ref: buttonRef,
24318 className: "dataviews-filters__visibility-toggle",
24319 size: "compact",
24320 icon: funnel_default,
24321 disabled: hasPrimaryOrLockedFilters,
24322 accessibleWhenDisabled: true,
24323 ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
24324 }
24325 );
24326 return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24327 AddFilterMenu,
24328 {
24329 filters,
24330 view,
24331 onChangeView: onChangeViewWithFilterVisibility,
24332 setOpenedFilter,
24333 triggerProps: { render: buttonComponent }
24334 }
24335 ) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
24336 FilterVisibilityToggle,
24337 {
24338 buttonRef,
24339 filtersCount: view.filters?.length,
24340 children: buttonComponent
24341 }
24342 ) });
24343 }
24344 function FilterVisibilityToggle({
24345 buttonRef,
24346 filtersCount,
24347 children
24348 }) {
24349 (0, import_element71.useEffect)(
24350 () => () => {
24351 buttonRef.current?.focus();
24352 },
24353 [buttonRef]
24354 );
24355 return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
24356 children,
24357 !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
24358 ] });
24359 }
24360 var toggle_default = FiltersToggle;
24361
24362 // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.mjs
24363 var import_element72 = __toESM(require_element(), 1);
24364 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
24365 function FiltersToggled(props) {
24366 const { isShowingFilter } = (0, import_element72.useContext)(dataviews_context_default);
24367 if (!isShowingFilter) {
24368 return null;
24369 }
24370 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(filters_default, { ...props });
24371 }
24372 var filters_toggled_default = FiltersToggled;
24373
24374 // packages/dataviews/build-module/components/dataviews-layout/index.mjs
24375 var import_element73 = __toESM(require_element(), 1);
24376 var import_components24 = __toESM(require_components(), 1);
24377 var import_i18n30 = __toESM(require_i18n(), 1);
24378 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
24379 function DataViewsLayout({ className }) {
24380 const {
24381 actions = [],
24382 data,
24383 fields,
24384 getItemId,
24385 getItemLevel,
24386 hasInitiallyLoaded,
24387 isLoading,
24388 view,
24389 onChangeView,
24390 selection,
24391 onChangeSelection,
24392 setOpenedFilter,
24393 onClickItem,
24394 isItemClickable,
24395 renderItemLink,
24396 defaultLayouts,
24397 containerRef,
24398 empty = /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("p", { children: (0, import_i18n30.__)("No results") })
24399 } = (0, import_element73.useContext)(dataviews_context_default);
24400 const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, {
24401 delay: 200
24402 });
24403 if (!hasInitiallyLoaded) {
24404 if (!isDelayedInitialLoading) {
24405 return null;
24406 }
24407 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: "dataviews-loading", children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_components24.Spinner, {}) }) });
24408 }
24409 const ViewComponent = VIEW_LAYOUTS.find(
24410 (v2) => v2.type === view.type && defaultLayouts[v2.type]
24411 )?.component;
24412 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: "dataviews-layout__container", ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
24413 ViewComponent,
24414 {
24415 className,
24416 actions,
24417 data,
24418 fields,
24419 getItemId,
24420 getItemLevel,
24421 isLoading,
24422 onChangeView,
24423 onChangeSelection,
24424 selection,
24425 setOpenedFilter,
24426 onClickItem,
24427 renderItemLink,
24428 isItemClickable,
24429 view,
24430 empty
24431 }
24432 ) });
24433 }
24434
24435 // packages/dataviews/build-module/components/dataviews-footer/index.mjs
24436 var import_element74 = __toESM(require_element(), 1);
24437 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
24438 var EMPTY_ARRAY5 = [];
24439 function DataViewsFooter() {
24440 const {
24441 view,
24442 paginationInfo: { totalItems = 0, totalPages },
24443 data,
24444 actions = EMPTY_ARRAY5,
24445 isLoading,
24446 hasInitiallyLoaded
24447 } = (0, import_element74.useContext)(dataviews_context_default);
24448 const isRefreshing = !!isLoading && hasInitiallyLoaded && !!data?.length;
24449 const isDelayedRefreshing = useDelayedLoading(!!isRefreshing);
24450 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [LAYOUT_TABLE, LAYOUT_GRID].includes(view.type);
24451 if (!isRefreshing && (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions)) {
24452 return null;
24453 }
24454 return (!!totalItems || isRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
24455 "div",
24456 {
24457 className: "dataviews-footer",
24458 inert: isRefreshing ? "true" : void 0,
24459 children: /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
24460 Stack,
24461 {
24462 direction: "row",
24463 justify: "end",
24464 align: "center",
24465 className: clsx_default("dataviews-footer__content", {
24466 "is-refreshing": isDelayedRefreshing
24467 }),
24468 gap: "sm",
24469 children: [
24470 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(BulkActionsFooter, {}),
24471 /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(dataviews_pagination_default, {})
24472 ]
24473 }
24474 )
24475 }
24476 );
24477 }
24478
24479 // packages/dataviews/build-module/components/dataviews-search/index.mjs
24480 var import_i18n31 = __toESM(require_i18n(), 1);
24481 var import_element75 = __toESM(require_element(), 1);
24482 var import_components25 = __toESM(require_components(), 1);
24483 var import_compose9 = __toESM(require_compose(), 1);
24484 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
24485 var DataViewsSearch = (0, import_element75.memo)(function Search({ label }) {
24486 const { view, onChangeView } = (0, import_element75.useContext)(dataviews_context_default);
24487 const [search, setSearch, debouncedSearch] = (0, import_compose9.useDebouncedInput)(
24488 view.search
24489 );
24490 (0, import_element75.useEffect)(() => {
24491 if (view.search !== debouncedSearch) {
24492 setSearch(view.search ?? "");
24493 }
24494 }, [view.search, setSearch]);
24495 const onChangeViewRef = (0, import_element75.useRef)(onChangeView);
24496 const viewRef = (0, import_element75.useRef)(view);
24497 (0, import_element75.useEffect)(() => {
24498 onChangeViewRef.current = onChangeView;
24499 viewRef.current = view;
24500 }, [onChangeView, view]);
24501 (0, import_element75.useEffect)(() => {
24502 if (debouncedSearch !== viewRef.current?.search) {
24503 onChangeViewRef.current({
24504 ...viewRef.current,
24505 page: view.page ? 1 : void 0,
24506 startPosition: view.startPosition ? 1 : void 0,
24507 search: debouncedSearch
24508 });
24509 }
24510 }, [debouncedSearch]);
24511 const searchLabel = label || (0, import_i18n31.__)("Search");
24512 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
24513 import_components25.SearchControl,
24514 {
24515 className: "dataviews-search",
24516 onChange: setSearch,
24517 value: search,
24518 label: searchLabel,
24519 placeholder: searchLabel,
24520 size: "compact"
24521 }
24522 );
24523 });
24524 var dataviews_search_default = DataViewsSearch;
24525
24526 // packages/dataviews/build-module/components/dataviews-view-config/index.mjs
24527 var import_components26 = __toESM(require_components(), 1);
24528 var import_i18n32 = __toESM(require_i18n(), 1);
24529 var import_element76 = __toESM(require_element(), 1);
24530 var import_warning = __toESM(require_warning(), 1);
24531 var import_compose10 = __toESM(require_compose(), 1);
24532 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
24533 var { Menu: Menu5 } = unlock2(import_components26.privateApis);
24534 var DATAVIEWS_CONFIG_POPOVER_PROPS = {
24535 className: "dataviews-config__popover",
24536 placement: "bottom-end",
24537 offset: 9
24538 };
24539 function ViewTypeMenu() {
24540 const { view, onChangeView, defaultLayouts } = (0, import_element76.useContext)(dataviews_context_default);
24541 const availableLayouts = Object.keys(defaultLayouts);
24542 if (availableLayouts.length <= 1) {
24543 return null;
24544 }
24545 const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type);
24546 return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(Menu5, { children: [
24547 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24548 Menu5.TriggerButton,
24549 {
24550 render: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24551 import_components26.Button,
24552 {
24553 size: "compact",
24554 icon: activeView?.icon,
24555 label: (0, import_i18n32.__)("Layout")
24556 }
24557 )
24558 }
24559 ),
24560 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Menu5.Popover, { children: availableLayouts.map((layout) => {
24561 const config = VIEW_LAYOUTS.find(
24562 (v2) => v2.type === layout
24563 );
24564 if (!config) {
24565 return null;
24566 }
24567 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24568 Menu5.RadioItem,
24569 {
24570 value: layout,
24571 name: "view-actions-available-view",
24572 checked: layout === view.type,
24573 hideOnClick: true,
24574 onChange: (e2) => {
24575 switch (e2.target.value) {
24576 case "list":
24577 case "grid":
24578 case "table":
24579 case "pickerGrid":
24580 case "pickerTable":
24581 case "activity":
24582 const viewWithoutLayout = { ...view };
24583 if ("layout" in viewWithoutLayout) {
24584 delete viewWithoutLayout.layout;
24585 }
24586 return onChangeView({
24587 ...viewWithoutLayout,
24588 type: e2.target.value,
24589 ...defaultLayouts[e2.target.value]
24590 });
24591 }
24592 (0, import_warning.default)("Invalid dataview");
24593 },
24594 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Menu5.ItemLabel, { children: config.label })
24595 },
24596 layout
24597 );
24598 }) })
24599 ] });
24600 }
24601 function SortFieldControl() {
24602 const { view, fields, onChangeView } = (0, import_element76.useContext)(dataviews_context_default);
24603 const orderOptions = (0, import_element76.useMemo)(() => {
24604 const sortableFields = fields.filter(
24605 (field) => field.enableSorting !== false
24606 );
24607 return sortableFields.map((field) => {
24608 return {
24609 label: field.label,
24610 value: field.id
24611 };
24612 });
24613 }, [fields]);
24614 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24615 import_components26.SelectControl,
24616 {
24617 __next40pxDefaultSize: true,
24618 label: (0, import_i18n32.__)("Sort by"),
24619 value: view.sort?.field,
24620 options: orderOptions,
24621 onChange: (value) => {
24622 onChangeView({
24623 ...view,
24624 sort: {
24625 direction: view?.sort?.direction || "desc",
24626 field: value
24627 },
24628 showLevels: false
24629 });
24630 }
24631 }
24632 );
24633 }
24634 function SortDirectionControl() {
24635 const { view, fields, onChangeView } = (0, import_element76.useContext)(dataviews_context_default);
24636 const sortableFields = fields.filter(
24637 (field) => field.enableSorting !== false
24638 );
24639 if (sortableFields.length === 0) {
24640 return null;
24641 }
24642 let value = view.sort?.direction;
24643 if (!value && view.sort?.field) {
24644 value = "desc";
24645 }
24646 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24647 import_components26.__experimentalToggleGroupControl,
24648 {
24649 className: "dataviews-view-config__sort-direction",
24650 __next40pxDefaultSize: true,
24651 isBlock: true,
24652 label: (0, import_i18n32.__)("Order"),
24653 value,
24654 onChange: (newDirection) => {
24655 if (newDirection === "asc" || newDirection === "desc") {
24656 onChangeView({
24657 ...view,
24658 sort: {
24659 direction: newDirection,
24660 field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field.
24661 fields.find(
24662 (field) => field.enableSorting !== false
24663 )?.id || ""
24664 },
24665 showLevels: false
24666 });
24667 return;
24668 }
24669 (0, import_warning.default)("Invalid direction");
24670 },
24671 children: SORTING_DIRECTIONS.map((direction) => {
24672 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24673 import_components26.__experimentalToggleGroupControlOptionIcon,
24674 {
24675 value: direction,
24676 icon: sortIcons[direction],
24677 label: sortLabels[direction]
24678 },
24679 direction
24680 );
24681 })
24682 }
24683 );
24684 }
24685 function ItemsPerPageControl() {
24686 const { view, config, onChangeView } = (0, import_element76.useContext)(dataviews_context_default);
24687 const { infiniteScrollEnabled } = view;
24688 if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) {
24689 return null;
24690 }
24691 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24692 import_components26.__experimentalToggleGroupControl,
24693 {
24694 __next40pxDefaultSize: true,
24695 isBlock: true,
24696 label: (0, import_i18n32.__)("Items per page"),
24697 value: view.perPage || 10,
24698 disabled: !view?.sort?.field,
24699 onChange: (newItemsPerPage) => {
24700 const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10);
24701 onChangeView({
24702 ...view,
24703 perPage: newItemsPerPageNumber,
24704 page: 1
24705 });
24706 },
24707 children: config.perPageSizes.map((value) => {
24708 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24709 import_components26.__experimentalToggleGroupControlOption,
24710 {
24711 value,
24712 label: value.toString()
24713 },
24714 value
24715 );
24716 })
24717 }
24718 );
24719 }
24720 function ResetViewButton() {
24721 const { onReset } = (0, import_element76.useContext)(dataviews_context_default);
24722 if (onReset === void 0) {
24723 return null;
24724 }
24725 const isDisabled = onReset === false;
24726 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24727 import_components26.Button,
24728 {
24729 variant: "tertiary",
24730 size: "compact",
24731 disabled: isDisabled,
24732 accessibleWhenDisabled: true,
24733 className: "dataviews-view-config__reset-button",
24734 onClick: () => {
24735 if (typeof onReset === "function") {
24736 onReset();
24737 }
24738 },
24739 children: (0, import_i18n32.__)("Reset view")
24740 }
24741 );
24742 }
24743 function DataviewsViewConfigDropdown() {
24744 const { view, onReset } = (0, import_element76.useContext)(dataviews_context_default);
24745 const popoverId = (0, import_compose10.useInstanceId)(
24746 _DataViewsViewConfig,
24747 "dataviews-view-config-dropdown"
24748 );
24749 const activeLayout = VIEW_LAYOUTS.find(
24750 (layout) => layout.type === view.type
24751 );
24752 const isModified = typeof onReset === "function";
24753 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24754 import_components26.Dropdown,
24755 {
24756 expandOnMobile: true,
24757 popoverProps: {
24758 ...DATAVIEWS_CONFIG_POPOVER_PROPS,
24759 id: popoverId
24760 },
24761 renderToggle: ({ onToggle, isOpen }) => {
24762 return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "dataviews-view-config__toggle-wrapper", children: [
24763 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24764 import_components26.Button,
24765 {
24766 size: "compact",
24767 icon: cog_default,
24768 label: (0, import_i18n32._x)(
24769 "View options",
24770 "View is used as a noun"
24771 ),
24772 onClick: onToggle,
24773 "aria-expanded": isOpen ? "true" : "false",
24774 "aria-controls": popoverId
24775 }
24776 ),
24777 isModified && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "dataviews-view-config__modified-indicator" })
24778 ] });
24779 },
24780 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24781 import_components26.__experimentalDropdownContentWrapper,
24782 {
24783 paddingSize: "medium",
24784 className: "dataviews-config__popover-content-wrapper",
24785 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
24786 Stack,
24787 {
24788 direction: "column",
24789 className: "dataviews-view-config",
24790 gap: "xl",
24791 children: [
24792 /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
24793 Stack,
24794 {
24795 direction: "row",
24796 justify: "space-between",
24797 align: "center",
24798 className: "dataviews-view-config__header",
24799 children: [
24800 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
24801 import_components26.__experimentalHeading,
24802 {
24803 level: 2,
24804 className: "dataviews-settings-section__title",
24805 children: (0, import_i18n32.__)("Appearance")
24806 }
24807 ),
24808 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ResetViewButton, {})
24809 ]
24810 }
24811 ),
24812 /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24813 /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
24814 Stack,
24815 {
24816 direction: "row",
24817 gap: "sm",
24818 className: "dataviews-view-config__sort-controls",
24819 children: [
24820 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SortFieldControl, {}),
24821 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SortDirectionControl, {})
24822 ]
24823 }
24824 ),
24825 !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(activeLayout.viewConfigOptions, {}),
24826 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ItemsPerPageControl, {}),
24827 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(PropertiesSection, {})
24828 ] })
24829 ]
24830 }
24831 )
24832 }
24833 )
24834 }
24835 );
24836 }
24837 function _DataViewsViewConfig() {
24838 return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [
24839 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ViewTypeMenu, {}),
24840 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(DataviewsViewConfigDropdown, {})
24841 ] });
24842 }
24843 var DataViewsViewConfig = (0, import_element76.memo)(_DataViewsViewConfig);
24844 var dataviews_view_config_default = DataViewsViewConfig;
24845
24846 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
24847 var import_components27 = __toESM(require_components(), 1);
24848 var import_element77 = __toESM(require_element(), 1);
24849
24850 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs
24851 function getCustomValidity(isValid2, validity) {
24852 let customValidity;
24853 if (isValid2?.required && validity?.required) {
24854 customValidity = validity?.required?.message ? validity.required : void 0;
24855 } else if (isValid2?.pattern && validity?.pattern) {
24856 customValidity = validity.pattern;
24857 } else if (isValid2?.min && validity?.min) {
24858 customValidity = validity.min;
24859 } else if (isValid2?.max && validity?.max) {
24860 customValidity = validity.max;
24861 } else if (isValid2?.minLength && validity?.minLength) {
24862 customValidity = validity.minLength;
24863 } else if (isValid2?.maxLength && validity?.maxLength) {
24864 customValidity = validity.maxLength;
24865 } else if (isValid2?.elements && validity?.elements) {
24866 customValidity = validity.elements;
24867 } else if (validity?.custom) {
24868 customValidity = validity.custom;
24869 }
24870 return customValidity;
24871 }
24872
24873 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
24874 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
24875 var { ValidatedCheckboxControl } = unlock2(import_components27.privateApis);
24876 function Checkbox({
24877 field,
24878 onChange,
24879 data,
24880 hideLabelFromVision,
24881 markWhenOptional,
24882 validity
24883 }) {
24884 const { getValue, setValue, label, description, isValid: isValid2 } = field;
24885 const disabled2 = field.isDisabled({ item: data, field });
24886 const onChangeControl = (0, import_element77.useCallback)(() => {
24887 onChange(
24888 setValue({ item: data, value: !getValue({ item: data }) })
24889 );
24890 }, [data, getValue, onChange, setValue]);
24891 return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
24892 ValidatedCheckboxControl,
24893 {
24894 required: !!field.isValid?.required,
24895 markWhenOptional,
24896 customValidity: getCustomValidity(isValid2, validity),
24897 hidden: hideLabelFromVision,
24898 label,
24899 help: description,
24900 checked: getValue({ item: data }),
24901 onChange: onChangeControl,
24902 disabled: disabled2
24903 }
24904 );
24905 }
24906
24907 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs
24908 var import_components28 = __toESM(require_components(), 1);
24909 var import_element78 = __toESM(require_element(), 1);
24910 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
24911 var { ValidatedComboboxControl } = unlock2(import_components28.privateApis);
24912 function Combobox3({
24913 data,
24914 field,
24915 onChange,
24916 hideLabelFromVision,
24917 validity
24918 }) {
24919 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field;
24920 const value = getValue({ item: data }) ?? "";
24921 const onChangeControl = (0, import_element78.useCallback)(
24922 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
24923 [data, onChange, setValue]
24924 );
24925 const { elements, isLoading } = useElements({
24926 elements: field.elements,
24927 getElements: field.getElements
24928 });
24929 if (isLoading) {
24930 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_components28.Spinner, {});
24931 }
24932 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
24933 ValidatedComboboxControl,
24934 {
24935 required: !!field.isValid?.required,
24936 customValidity: getCustomValidity(isValid2, validity),
24937 label,
24938 value,
24939 help: description,
24940 placeholder,
24941 options: elements,
24942 onChange: onChangeControl,
24943 hideLabelFromVision,
24944 allowReset: true,
24945 expandOnFocus: true
24946 }
24947 );
24948 }
24949
24950 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
24951 var import_components30 = __toESM(require_components(), 1);
24952 var import_element81 = __toESM(require_element(), 1);
24953 var import_i18n34 = __toESM(require_i18n(), 1);
24954 var import_date3 = __toESM(require_date(), 1);
24955
24956 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs
24957 var import_components29 = __toESM(require_components(), 1);
24958 var import_element79 = __toESM(require_element(), 1);
24959 var import_i18n33 = __toESM(require_i18n(), 1);
24960 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
24961 var TIME_UNITS_OPTIONS = {
24962 [OPERATOR_IN_THE_PAST]: [
24963 { value: "days", label: (0, import_i18n33.__)("Days") },
24964 { value: "weeks", label: (0, import_i18n33.__)("Weeks") },
24965 { value: "months", label: (0, import_i18n33.__)("Months") },
24966 { value: "years", label: (0, import_i18n33.__)("Years") }
24967 ],
24968 [OPERATOR_OVER]: [
24969 { value: "days", label: (0, import_i18n33.__)("Days ago") },
24970 { value: "weeks", label: (0, import_i18n33.__)("Weeks ago") },
24971 { value: "months", label: (0, import_i18n33.__)("Months ago") },
24972 { value: "years", label: (0, import_i18n33.__)("Years ago") }
24973 ]
24974 };
24975 function RelativeDateControl({
24976 className,
24977 data,
24978 field,
24979 onChange,
24980 hideLabelFromVision,
24981 operator
24982 }) {
24983 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
24984 const { id, label, description, getValue, setValue } = field;
24985 const disabled2 = field.isDisabled({ item: data, field });
24986 const fieldValue = getValue({ item: data });
24987 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
24988 const onChangeValue = (0, import_element79.useCallback)(
24989 (newValue) => onChange(
24990 setValue({
24991 item: data,
24992 value: { value: Number(newValue), unit }
24993 })
24994 ),
24995 [onChange, setValue, data, unit]
24996 );
24997 const onChangeUnit = (0, import_element79.useCallback)(
24998 (newUnit) => onChange(
24999 setValue({
25000 item: data,
25001 value: { value: relValue, unit: newUnit }
25002 })
25003 ),
25004 [onChange, setValue, data, relValue]
25005 );
25006 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
25007 import_components29.BaseControl,
25008 {
25009 id,
25010 className: clsx_default(className, "dataviews-controls__relative-date"),
25011 label,
25012 hideLabelFromVision,
25013 help: description,
25014 children: /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(Stack, { direction: "row", gap: "sm", children: [
25015 /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
25016 import_components29.__experimentalNumberControl,
25017 {
25018 __next40pxDefaultSize: true,
25019 className: "dataviews-controls__relative-date-number",
25020 spinControls: "none",
25021 min: 1,
25022 step: 1,
25023 value: relValue,
25024 onChange: onChangeValue,
25025 disabled: disabled2
25026 }
25027 ),
25028 /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
25029 import_components29.SelectControl,
25030 {
25031 className: "dataviews-controls__relative-date-unit",
25032 __next40pxDefaultSize: true,
25033 label: (0, import_i18n33.__)("Unit"),
25034 value: unit,
25035 options,
25036 onChange: onChangeUnit,
25037 hideLabelFromVision: true,
25038 disabled: disabled2
25039 }
25040 )
25041 ] })
25042 }
25043 );
25044 }
25045
25046 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs
25047 var import_element80 = __toESM(require_element(), 1);
25048 function useDisabledDateMatchers(isValid2, parseDateFn) {
25049 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
25050 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
25051 const disabledMatchers = (0, import_element80.useMemo)(() => {
25052 const matchers = [];
25053 if (minConstraint) {
25054 const minDate = parseDateFn(minConstraint);
25055 if (minDate) {
25056 matchers.push({ before: minDate });
25057 }
25058 }
25059 if (maxConstraint) {
25060 const maxDate = parseDateFn(maxConstraint);
25061 if (maxDate) {
25062 matchers.push({ after: maxDate });
25063 }
25064 }
25065 return matchers.length > 0 ? matchers : void 0;
25066 }, [minConstraint, maxConstraint, parseDateFn]);
25067 return { minConstraint, maxConstraint, disabledMatchers };
25068 }
25069
25070 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs
25071 var import_date2 = __toESM(require_date(), 1);
25072 function parseDateTime(dateTimeString) {
25073 if (!dateTimeString) {
25074 return null;
25075 }
25076 const parsed = (0, import_date2.getDate)(dateTimeString);
25077 return parsed && isValid(parsed) ? parsed : null;
25078 }
25079
25080 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
25081 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
25082 var { DateCalendar, ValidatedInputControl } = unlock2(import_components30.privateApis);
25083 var formatDateTime = (value) => {
25084 if (!value) {
25085 return "";
25086 }
25087 return (0, import_date3.dateI18n)("Y-m-d\\TH:i", (0, import_date3.getDate)(value));
25088 };
25089 function CalendarDateTimeControl({
25090 data,
25091 field,
25092 onChange,
25093 hideLabelFromVision,
25094 markWhenOptional,
25095 validity,
25096 config
25097 }) {
25098 const { compact } = config || {};
25099 const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
25100 const disabled2 = field.isDisabled({ item: data, field });
25101 const fieldValue = getValue({ item: data });
25102 const value = typeof fieldValue === "string" ? fieldValue : void 0;
25103 const [calendarMonth, setCalendarMonth] = (0, import_element81.useState)(() => {
25104 const parsedDate = parseDateTime(value);
25105 return parsedDate || /* @__PURE__ */ new Date();
25106 });
25107 const inputControlRef = (0, import_element81.useRef)(null);
25108 const validationTimeoutRef = (0, import_element81.useRef)(void 0);
25109 const previousFocusRef = (0, import_element81.useRef)(null);
25110 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime);
25111 const onChangeCallback = (0, import_element81.useCallback)(
25112 (newValue) => onChange(setValue({ item: data, value: newValue })),
25113 [data, onChange, setValue]
25114 );
25115 (0, import_element81.useEffect)(() => {
25116 return () => {
25117 if (validationTimeoutRef.current) {
25118 clearTimeout(validationTimeoutRef.current);
25119 }
25120 };
25121 }, []);
25122 const onSelectDate = (0, import_element81.useCallback)(
25123 (newDate) => {
25124 let dateTimeValue;
25125 if (newDate) {
25126 const wpDate = (0, import_date3.dateI18n)("Y-m-d", newDate);
25127 let wpTime;
25128 if (value) {
25129 wpTime = (0, import_date3.dateI18n)("H:i", (0, import_date3.getDate)(value));
25130 } else {
25131 wpTime = (0, import_date3.dateI18n)("H:i", newDate);
25132 }
25133 const finalDateTime = (0, import_date3.getDate)(`${wpDate}T${wpTime}`);
25134 dateTimeValue = finalDateTime.toISOString();
25135 onChangeCallback(dateTimeValue);
25136 if (validationTimeoutRef.current) {
25137 clearTimeout(validationTimeoutRef.current);
25138 }
25139 } else {
25140 onChangeCallback(void 0);
25141 }
25142 previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement;
25143 validationTimeoutRef.current = setTimeout(() => {
25144 if (inputControlRef.current) {
25145 inputControlRef.current.focus();
25146 inputControlRef.current.blur();
25147 onChangeCallback(dateTimeValue);
25148 if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) {
25149 previousFocusRef.current.focus();
25150 }
25151 }
25152 }, 0);
25153 },
25154 [onChangeCallback, value]
25155 );
25156 const handleManualDateTimeChange = (0, import_element81.useCallback)(
25157 (newValue) => {
25158 if (newValue) {
25159 const dateTime = (0, import_date3.getDate)(newValue);
25160 onChangeCallback(dateTime.toISOString());
25161 const parsedDate = parseDateTime(dateTime.toISOString());
25162 if (parsedDate) {
25163 setCalendarMonth(parsedDate);
25164 }
25165 } else {
25166 onChangeCallback(void 0);
25167 }
25168 },
25169 [onChangeCallback]
25170 );
25171 const { format: fieldFormat } = field;
25172 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date3.getSettings)().l10n.startOfWeek;
25173 const {
25174 timezone: { string: timezoneString }
25175 } = (0, import_date3.getSettings)();
25176 let displayLabel = label;
25177 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) {
25178 displayLabel = `${label} (${(0, import_i18n34.__)("Required")})`;
25179 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) {
25180 displayLabel = `${label} (${(0, import_i18n34.__)("Optional")})`;
25181 }
25182 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
25183 import_components30.BaseControl,
25184 {
25185 id,
25186 label: displayLabel,
25187 help: description,
25188 hideLabelFromVision,
25189 children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Stack, { direction: "column", gap: "lg", children: [
25190 /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
25191 ValidatedInputControl,
25192 {
25193 ref: inputControlRef,
25194 __next40pxDefaultSize: true,
25195 required: !!isValid2?.required,
25196 customValidity: getCustomValidity(isValid2, validity),
25197 type: "datetime-local",
25198 label: (0, import_i18n34.__)("Date time"),
25199 hideLabelFromVision: true,
25200 value: formatDateTime(value),
25201 onChange: handleManualDateTimeChange,
25202 disabled: disabled2,
25203 min: minConstraint ? formatDateTime(minConstraint) : void 0,
25204 max: maxConstraint ? formatDateTime(maxConstraint) : void 0
25205 }
25206 ),
25207 !compact && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
25208 DateCalendar,
25209 {
25210 style: { width: "100%" },
25211 selected: value ? parseDateTime(value) || void 0 : void 0,
25212 onSelect: onSelectDate,
25213 month: calendarMonth,
25214 onMonthChange: setCalendarMonth,
25215 timeZone: timezoneString || void 0,
25216 weekStartsOn,
25217 disabled: disabled2 || disabledMatchers
25218 }
25219 )
25220 ] })
25221 }
25222 );
25223 }
25224 function DateTime({
25225 data,
25226 field,
25227 onChange,
25228 hideLabelFromVision,
25229 markWhenOptional,
25230 operator,
25231 validity,
25232 config
25233 }) {
25234 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
25235 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
25236 RelativeDateControl,
25237 {
25238 className: "dataviews-controls__datetime",
25239 data,
25240 field,
25241 onChange,
25242 hideLabelFromVision,
25243 operator
25244 }
25245 );
25246 }
25247 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
25248 CalendarDateTimeControl,
25249 {
25250 data,
25251 field,
25252 onChange,
25253 hideLabelFromVision,
25254 markWhenOptional,
25255 validity,
25256 config
25257 }
25258 );
25259 }
25260
25261 // packages/dataviews/build-module/components/dataform-controls/date.mjs
25262 var import_components31 = __toESM(require_components(), 1);
25263 var import_element82 = __toESM(require_element(), 1);
25264 var import_i18n35 = __toESM(require_i18n(), 1);
25265 var import_date4 = __toESM(require_date(), 1);
25266 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
25267 var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock2(import_components31.privateApis);
25268 var DATE_PRESETS = [
25269 {
25270 id: "today",
25271 label: (0, import_i18n35.__)("Today"),
25272 getValue: () => (0, import_date4.getDate)(null)
25273 },
25274 {
25275 id: "yesterday",
25276 label: (0, import_i18n35.__)("Yesterday"),
25277 getValue: () => {
25278 const today = (0, import_date4.getDate)(null);
25279 return subDays(today, 1);
25280 }
25281 },
25282 {
25283 id: "past-week",
25284 label: (0, import_i18n35.__)("Past week"),
25285 getValue: () => {
25286 const today = (0, import_date4.getDate)(null);
25287 return subDays(today, 7);
25288 }
25289 },
25290 {
25291 id: "past-month",
25292 label: (0, import_i18n35.__)("Past month"),
25293 getValue: () => {
25294 const today = (0, import_date4.getDate)(null);
25295 return subMonths(today, 1);
25296 }
25297 }
25298 ];
25299 var DATE_RANGE_PRESETS = [
25300 {
25301 id: "last-7-days",
25302 label: (0, import_i18n35.__)("Last 7 days"),
25303 getValue: () => {
25304 const today = (0, import_date4.getDate)(null);
25305 return [subDays(today, 7), today];
25306 }
25307 },
25308 {
25309 id: "last-30-days",
25310 label: (0, import_i18n35.__)("Last 30 days"),
25311 getValue: () => {
25312 const today = (0, import_date4.getDate)(null);
25313 return [subDays(today, 30), today];
25314 }
25315 },
25316 {
25317 id: "month-to-date",
25318 label: (0, import_i18n35.__)("Month to date"),
25319 getValue: () => {
25320 const today = (0, import_date4.getDate)(null);
25321 return [startOfMonth(today), today];
25322 }
25323 },
25324 {
25325 id: "last-year",
25326 label: (0, import_i18n35.__)("Last year"),
25327 getValue: () => {
25328 const today = (0, import_date4.getDate)(null);
25329 return [subYears(today, 1), today];
25330 }
25331 },
25332 {
25333 id: "year-to-date",
25334 label: (0, import_i18n35.__)("Year to date"),
25335 getValue: () => {
25336 const today = (0, import_date4.getDate)(null);
25337 return [startOfYear(today), today];
25338 }
25339 }
25340 ];
25341 var parseDate = (dateString) => {
25342 if (!dateString) {
25343 return null;
25344 }
25345 const parsed = (0, import_date4.getDate)(dateString);
25346 return parsed && isValid(parsed) ? parsed : null;
25347 };
25348 var formatDate = (date) => {
25349 if (!date) {
25350 return "";
25351 }
25352 return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
25353 };
25354 function ValidatedDateControl({
25355 field,
25356 validity,
25357 inputRefs,
25358 isTouched,
25359 setIsTouched,
25360 children
25361 }) {
25362 const { isValid: isValid2 } = field;
25363 const [customValidity, setCustomValidity] = (0, import_element82.useState)(void 0);
25364 const validateRefs = (0, import_element82.useCallback)(() => {
25365 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
25366 for (const ref of refs) {
25367 const input = ref.current;
25368 if (input && !input.validity.valid) {
25369 setCustomValidity({
25370 type: "invalid",
25371 message: input.validationMessage
25372 });
25373 return;
25374 }
25375 }
25376 setCustomValidity(void 0);
25377 }, [inputRefs]);
25378 (0, import_element82.useEffect)(() => {
25379 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
25380 const result = validity ? getCustomValidity(isValid2, validity) : void 0;
25381 for (const ref of refs) {
25382 const input = ref.current;
25383 if (input) {
25384 input.setCustomValidity(
25385 result?.type === "invalid" && result.message ? result.message : ""
25386 );
25387 }
25388 }
25389 }, [inputRefs, isValid2, validity]);
25390 (0, import_element82.useEffect)(() => {
25391 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
25392 const handleInvalid = (event) => {
25393 event.preventDefault();
25394 setIsTouched(true);
25395 };
25396 for (const ref of refs) {
25397 ref.current?.addEventListener("invalid", handleInvalid);
25398 }
25399 return () => {
25400 for (const ref of refs) {
25401 ref.current?.removeEventListener("invalid", handleInvalid);
25402 }
25403 };
25404 }, [inputRefs, setIsTouched]);
25405 (0, import_element82.useEffect)(() => {
25406 if (!isTouched) {
25407 return;
25408 }
25409 const result = validity ? getCustomValidity(isValid2, validity) : void 0;
25410 if (result) {
25411 setCustomValidity(result);
25412 } else {
25413 validateRefs();
25414 }
25415 }, [isTouched, isValid2, validity, validateRefs]);
25416 const onBlur = (event) => {
25417 if (isTouched) {
25418 return;
25419 }
25420 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
25421 setIsTouched(true);
25422 }
25423 };
25424 return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { onBlur, children: [
25425 children,
25426 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
25427 "p",
25428 {
25429 className: clsx_default(
25430 "components-validated-control__indicator",
25431 customValidity.type === "invalid" ? "is-invalid" : void 0
25432 ),
25433 children: [
25434 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25435 import_components31.Icon,
25436 {
25437 className: "components-validated-control__indicator-icon",
25438 icon: error_default,
25439 size: 16,
25440 fill: "currentColor"
25441 }
25442 ),
25443 customValidity.message
25444 ]
25445 }
25446 ) })
25447 ] });
25448 }
25449 function CalendarDateControl({
25450 data,
25451 field,
25452 onChange,
25453 hideLabelFromVision,
25454 markWhenOptional,
25455 validity
25456 }) {
25457 const {
25458 id,
25459 label,
25460 description,
25461 setValue,
25462 getValue,
25463 isValid: isValid2,
25464 format: fieldFormat
25465 } = field;
25466 const disabled2 = field.isDisabled({ item: data, field });
25467 const [selectedPresetId, setSelectedPresetId] = (0, import_element82.useState)(
25468 null
25469 );
25470 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek;
25471 const fieldValue = getValue({ item: data });
25472 const value = typeof fieldValue === "string" ? fieldValue : void 0;
25473 const [calendarMonth, setCalendarMonth] = (0, import_element82.useState)(() => {
25474 const parsedDate = parseDate(value);
25475 return parsedDate || /* @__PURE__ */ new Date();
25476 });
25477 const [isTouched, setIsTouched] = (0, import_element82.useState)(false);
25478 const validityTargetRef = (0, import_element82.useRef)(null);
25479 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate);
25480 const onChangeCallback = (0, import_element82.useCallback)(
25481 (newValue) => onChange(setValue({ item: data, value: newValue })),
25482 [data, onChange, setValue]
25483 );
25484 const onSelectDate = (0, import_element82.useCallback)(
25485 (newDate) => {
25486 const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
25487 onChangeCallback(dateValue);
25488 setSelectedPresetId(null);
25489 setIsTouched(true);
25490 },
25491 [onChangeCallback]
25492 );
25493 const handlePresetClick = (0, import_element82.useCallback)(
25494 (preset) => {
25495 const presetDate = preset.getValue();
25496 const dateValue = formatDate(presetDate);
25497 setCalendarMonth(presetDate);
25498 onChangeCallback(dateValue);
25499 setSelectedPresetId(preset.id);
25500 setIsTouched(true);
25501 },
25502 [onChangeCallback]
25503 );
25504 const handleManualDateChange = (0, import_element82.useCallback)(
25505 (newValue) => {
25506 onChangeCallback(newValue);
25507 if (newValue) {
25508 const parsedDate = parseDate(newValue);
25509 if (parsedDate) {
25510 setCalendarMonth(parsedDate);
25511 }
25512 }
25513 setSelectedPresetId(null);
25514 setIsTouched(true);
25515 },
25516 [onChangeCallback]
25517 );
25518 const {
25519 timezone: { string: timezoneString }
25520 } = (0, import_date4.getSettings)();
25521 let displayLabel = label;
25522 if (isValid2?.required && !markWhenOptional) {
25523 displayLabel = `${label} (${(0, import_i18n35.__)("Required")})`;
25524 } else if (!isValid2?.required && markWhenOptional) {
25525 displayLabel = `${label} (${(0, import_i18n35.__)("Optional")})`;
25526 }
25527 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25528 ValidatedDateControl,
25529 {
25530 field,
25531 validity,
25532 inputRefs: validityTargetRef,
25533 isTouched,
25534 setIsTouched,
25535 children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25536 import_components31.BaseControl,
25537 {
25538 id,
25539 className: "dataviews-controls__date",
25540 label: displayLabel,
25541 help: description,
25542 hideLabelFromVision,
25543 children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(Stack, { direction: "column", gap: "lg", children: [
25544 /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
25545 Stack,
25546 {
25547 direction: "row",
25548 gap: "sm",
25549 wrap: "wrap",
25550 justify: "flex-start",
25551 children: [
25552 DATE_PRESETS.map((preset) => {
25553 const isSelected2 = selectedPresetId === preset.id;
25554 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25555 import_components31.Button,
25556 {
25557 className: "dataviews-controls__date-preset",
25558 variant: "tertiary",
25559 isPressed: isSelected2,
25560 size: "small",
25561 disabled: disabled2,
25562 accessibleWhenDisabled: true,
25563 onClick: () => handlePresetClick(preset),
25564 children: preset.label
25565 },
25566 preset.id
25567 );
25568 }),
25569 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25570 import_components31.Button,
25571 {
25572 className: "dataviews-controls__date-preset",
25573 variant: "tertiary",
25574 isPressed: !selectedPresetId,
25575 size: "small",
25576 disabled: !!selectedPresetId || disabled2,
25577 accessibleWhenDisabled: true,
25578 children: (0, import_i18n35.__)("Custom")
25579 }
25580 )
25581 ]
25582 }
25583 ),
25584 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25585 import_components31.__experimentalInputControl,
25586 {
25587 __next40pxDefaultSize: true,
25588 ref: validityTargetRef,
25589 type: "date",
25590 label: (0, import_i18n35.__)("Date"),
25591 hideLabelFromVision: true,
25592 value,
25593 onChange: handleManualDateChange,
25594 required: !!field.isValid?.required,
25595 disabled: disabled2,
25596 min: minConstraint,
25597 max: maxConstraint
25598 }
25599 ),
25600 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25601 DateCalendar2,
25602 {
25603 style: { width: "100%" },
25604 selected: value ? parseDate(value) || void 0 : void 0,
25605 onSelect: onSelectDate,
25606 month: calendarMonth,
25607 onMonthChange: setCalendarMonth,
25608 timeZone: timezoneString || void 0,
25609 weekStartsOn,
25610 disabled: disabled2 || disabledMatchers,
25611 disableNavigation: disabled2
25612 }
25613 )
25614 ] })
25615 }
25616 )
25617 }
25618 );
25619 }
25620 function CalendarDateRangeControl({
25621 data,
25622 field,
25623 onChange,
25624 hideLabelFromVision,
25625 markWhenOptional,
25626 validity
25627 }) {
25628 const {
25629 id,
25630 label,
25631 description,
25632 getValue,
25633 setValue,
25634 isValid: isValid2,
25635 format: fieldFormat
25636 } = field;
25637 const disabled2 = field.isDisabled({ item: data, field });
25638 let value;
25639 const fieldValue = getValue({ item: data });
25640 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
25641 value = fieldValue;
25642 }
25643 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek;
25644 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate);
25645 const onChangeCallback = (0, import_element82.useCallback)(
25646 (newValue) => {
25647 onChange(
25648 setValue({
25649 item: data,
25650 value: newValue
25651 })
25652 );
25653 },
25654 [data, onChange, setValue]
25655 );
25656 const [selectedPresetId, setSelectedPresetId] = (0, import_element82.useState)(
25657 null
25658 );
25659 const selectedRange = (0, import_element82.useMemo)(() => {
25660 if (!value) {
25661 return { from: void 0, to: void 0 };
25662 }
25663 const [from, to] = value;
25664 return {
25665 from: parseDate(from) || void 0,
25666 to: parseDate(to) || void 0
25667 };
25668 }, [value]);
25669 const [calendarMonth, setCalendarMonth] = (0, import_element82.useState)(() => {
25670 return selectedRange.from || /* @__PURE__ */ new Date();
25671 });
25672 const [isTouched, setIsTouched] = (0, import_element82.useState)(false);
25673 const fromInputRef = (0, import_element82.useRef)(null);
25674 const toInputRef = (0, import_element82.useRef)(null);
25675 const updateDateRange = (0, import_element82.useCallback)(
25676 (fromDate, toDate2) => {
25677 if (fromDate && toDate2) {
25678 onChangeCallback([
25679 formatDate(fromDate),
25680 formatDate(toDate2)
25681 ]);
25682 } else if (!fromDate && !toDate2) {
25683 onChangeCallback(void 0);
25684 }
25685 },
25686 [onChangeCallback]
25687 );
25688 const onSelectCalendarRange = (0, import_element82.useCallback)(
25689 (newRange) => {
25690 updateDateRange(newRange?.from, newRange?.to);
25691 setSelectedPresetId(null);
25692 setIsTouched(true);
25693 },
25694 [updateDateRange]
25695 );
25696 const handlePresetClick = (0, import_element82.useCallback)(
25697 (preset) => {
25698 const [startDate, endDate] = preset.getValue();
25699 setCalendarMonth(startDate);
25700 updateDateRange(startDate, endDate);
25701 setSelectedPresetId(preset.id);
25702 setIsTouched(true);
25703 },
25704 [updateDateRange]
25705 );
25706 const handleManualDateChange = (0, import_element82.useCallback)(
25707 (fromOrTo, newValue) => {
25708 const [currentFrom, currentTo] = value || [
25709 void 0,
25710 void 0
25711 ];
25712 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
25713 const updatedTo = fromOrTo === "to" ? newValue : currentTo;
25714 updateDateRange(updatedFrom, updatedTo);
25715 if (newValue) {
25716 const parsedDate = parseDate(newValue);
25717 if (parsedDate) {
25718 setCalendarMonth(parsedDate);
25719 }
25720 }
25721 setSelectedPresetId(null);
25722 setIsTouched(true);
25723 },
25724 [value, updateDateRange]
25725 );
25726 const { timezone } = (0, import_date4.getSettings)();
25727 let displayLabel = label;
25728 if (field.isValid?.required && !markWhenOptional) {
25729 displayLabel = `${label} (${(0, import_i18n35.__)("Required")})`;
25730 } else if (!field.isValid?.required && markWhenOptional) {
25731 displayLabel = `${label} (${(0, import_i18n35.__)("Optional")})`;
25732 }
25733 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25734 ValidatedDateControl,
25735 {
25736 field,
25737 validity,
25738 inputRefs: [fromInputRef, toInputRef],
25739 isTouched,
25740 setIsTouched,
25741 children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25742 import_components31.BaseControl,
25743 {
25744 id,
25745 className: "dataviews-controls__date",
25746 label: displayLabel,
25747 help: description,
25748 hideLabelFromVision,
25749 children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(Stack, { direction: "column", gap: "lg", children: [
25750 /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
25751 Stack,
25752 {
25753 direction: "row",
25754 gap: "sm",
25755 wrap: "wrap",
25756 justify: "flex-start",
25757 children: [
25758 DATE_RANGE_PRESETS.map((preset) => {
25759 const isSelected2 = selectedPresetId === preset.id;
25760 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25761 import_components31.Button,
25762 {
25763 className: "dataviews-controls__date-preset",
25764 variant: "tertiary",
25765 isPressed: isSelected2,
25766 size: "small",
25767 disabled: disabled2,
25768 accessibleWhenDisabled: true,
25769 onClick: () => handlePresetClick(preset),
25770 children: preset.label
25771 },
25772 preset.id
25773 );
25774 }),
25775 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25776 import_components31.Button,
25777 {
25778 className: "dataviews-controls__date-preset",
25779 variant: "tertiary",
25780 isPressed: !selectedPresetId,
25781 size: "small",
25782 accessibleWhenDisabled: true,
25783 disabled: !!selectedPresetId || disabled2,
25784 children: (0, import_i18n35.__)("Custom")
25785 }
25786 )
25787 ]
25788 }
25789 ),
25790 /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
25791 Stack,
25792 {
25793 direction: "row",
25794 gap: "sm",
25795 justify: "space-between",
25796 className: "dataviews-controls__date-range-inputs",
25797 children: [
25798 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25799 import_components31.__experimentalInputControl,
25800 {
25801 __next40pxDefaultSize: true,
25802 ref: fromInputRef,
25803 type: "date",
25804 label: (0, import_i18n35.__)("From"),
25805 hideLabelFromVision: true,
25806 value: value?.[0],
25807 onChange: (newValue) => handleManualDateChange("from", newValue),
25808 required: !!field.isValid?.required,
25809 disabled: disabled2,
25810 min: minConstraint,
25811 max: maxConstraint
25812 }
25813 ),
25814 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25815 import_components31.__experimentalInputControl,
25816 {
25817 __next40pxDefaultSize: true,
25818 ref: toInputRef,
25819 type: "date",
25820 label: (0, import_i18n35.__)("To"),
25821 hideLabelFromVision: true,
25822 value: value?.[1],
25823 onChange: (newValue) => handleManualDateChange("to", newValue),
25824 required: !!field.isValid?.required,
25825 disabled: disabled2,
25826 min: minConstraint,
25827 max: maxConstraint
25828 }
25829 )
25830 ]
25831 }
25832 ),
25833 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25834 DateRangeCalendar,
25835 {
25836 style: { width: "100%" },
25837 selected: selectedRange,
25838 onSelect: onSelectCalendarRange,
25839 month: calendarMonth,
25840 onMonthChange: setCalendarMonth,
25841 timeZone: timezone.string || void 0,
25842 weekStartsOn,
25843 disabled: disabled2 || disabledMatchers
25844 }
25845 )
25846 ] })
25847 }
25848 )
25849 }
25850 );
25851 }
25852 function DateControl({
25853 data,
25854 field,
25855 onChange,
25856 hideLabelFromVision,
25857 markWhenOptional,
25858 operator,
25859 validity
25860 }) {
25861 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
25862 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25863 RelativeDateControl,
25864 {
25865 className: "dataviews-controls__date",
25866 data,
25867 field,
25868 onChange,
25869 hideLabelFromVision,
25870 operator
25871 }
25872 );
25873 }
25874 if (operator === OPERATOR_BETWEEN) {
25875 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25876 CalendarDateRangeControl,
25877 {
25878 data,
25879 field,
25880 onChange,
25881 hideLabelFromVision,
25882 markWhenOptional,
25883 validity
25884 }
25885 );
25886 }
25887 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
25888 CalendarDateControl,
25889 {
25890 data,
25891 field,
25892 onChange,
25893 hideLabelFromVision,
25894 markWhenOptional,
25895 validity
25896 }
25897 );
25898 }
25899
25900 // packages/dataviews/build-module/components/dataform-controls/select.mjs
25901 var import_components32 = __toESM(require_components(), 1);
25902 var import_element83 = __toESM(require_element(), 1);
25903 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
25904 var { ValidatedSelectControl } = unlock2(import_components32.privateApis);
25905 function Select({
25906 data,
25907 field,
25908 onChange,
25909 hideLabelFromVision,
25910 markWhenOptional,
25911 validity
25912 }) {
25913 const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
25914 const disabled2 = field.isDisabled({ item: data, field });
25915 const isMultiple = type === "array";
25916 const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
25917 const onChangeControl = (0, import_element83.useCallback)(
25918 (newValue) => onChange(setValue({ item: data, value: newValue })),
25919 [data, onChange, setValue]
25920 );
25921 const { elements, isLoading } = useElements({
25922 elements: field.elements,
25923 getElements: field.getElements
25924 });
25925 if (isLoading) {
25926 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_components32.Spinner, {});
25927 }
25928 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
25929 ValidatedSelectControl,
25930 {
25931 required: !!field.isValid?.required,
25932 markWhenOptional,
25933 customValidity: getCustomValidity(isValid2, validity),
25934 label,
25935 value,
25936 help: description,
25937 options: elements,
25938 onChange: onChangeControl,
25939 __next40pxDefaultSize: true,
25940 hideLabelFromVision,
25941 multiple: isMultiple,
25942 disabled: disabled2
25943 }
25944 );
25945 }
25946
25947 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs
25948 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
25949 var ELEMENTS_THRESHOLD = 10;
25950 function AdaptiveSelect(props) {
25951 const { field } = props;
25952 const { elements } = useElements({
25953 elements: field.elements,
25954 getElements: field.getElements
25955 });
25956 if (elements.length >= ELEMENTS_THRESHOLD) {
25957 return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Combobox3, { ...props });
25958 }
25959 return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Select, { ...props });
25960 }
25961
25962 // packages/dataviews/build-module/components/dataform-controls/email.mjs
25963 var import_components34 = __toESM(require_components(), 1);
25964
25965 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs
25966 var import_components33 = __toESM(require_components(), 1);
25967 var import_element84 = __toESM(require_element(), 1);
25968 var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
25969 var { ValidatedInputControl: ValidatedInputControl2 } = unlock2(import_components33.privateApis);
25970 function ValidatedText({
25971 data,
25972 field,
25973 onChange,
25974 hideLabelFromVision,
25975 markWhenOptional,
25976 type,
25977 prefix,
25978 suffix,
25979 validity
25980 }) {
25981 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25982 const value = getValue({ item: data });
25983 const disabled2 = field.isDisabled({ item: data, field });
25984 const onChangeControl = (0, import_element84.useCallback)(
25985 (newValue) => onChange(
25986 setValue({
25987 item: data,
25988 value: newValue
25989 })
25990 ),
25991 [data, setValue, onChange]
25992 );
25993 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
25994 ValidatedInputControl2,
25995 {
25996 required: !!isValid2.required,
25997 markWhenOptional,
25998 customValidity: getCustomValidity(isValid2, validity),
25999 label,
26000 placeholder,
26001 value: value ?? "",
26002 help: description,
26003 onChange: onChangeControl,
26004 hideLabelFromVision,
26005 type,
26006 prefix,
26007 suffix,
26008 disabled: disabled2,
26009 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
26010 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
26011 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
26012 __next40pxDefaultSize: true
26013 }
26014 );
26015 }
26016
26017 // packages/dataviews/build-module/components/dataform-controls/email.mjs
26018 var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
26019 function Email({
26020 data,
26021 field,
26022 onChange,
26023 hideLabelFromVision,
26024 markWhenOptional,
26025 validity
26026 }) {
26027 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
26028 ValidatedText,
26029 {
26030 ...{
26031 data,
26032 field,
26033 onChange,
26034 hideLabelFromVision,
26035 markWhenOptional,
26036 validity,
26037 type: "email",
26038 prefix: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_components34.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_components34.Icon, { icon: envelope_default }) })
26039 }
26040 }
26041 );
26042 }
26043
26044 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs
26045 var import_components35 = __toESM(require_components(), 1);
26046 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
26047 function Telephone({
26048 data,
26049 field,
26050 onChange,
26051 hideLabelFromVision,
26052 markWhenOptional,
26053 validity
26054 }) {
26055 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
26056 ValidatedText,
26057 {
26058 ...{
26059 data,
26060 field,
26061 onChange,
26062 hideLabelFromVision,
26063 markWhenOptional,
26064 validity,
26065 type: "tel",
26066 prefix: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_components35.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_components35.Icon, { icon: mobile_default }) })
26067 }
26068 }
26069 );
26070 }
26071
26072 // packages/dataviews/build-module/components/dataform-controls/url.mjs
26073 var import_components36 = __toESM(require_components(), 1);
26074 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
26075 function Url({
26076 data,
26077 field,
26078 onChange,
26079 hideLabelFromVision,
26080 markWhenOptional,
26081 validity
26082 }) {
26083 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
26084 ValidatedText,
26085 {
26086 ...{
26087 data,
26088 field,
26089 onChange,
26090 hideLabelFromVision,
26091 markWhenOptional,
26092 validity,
26093 type: "url",
26094 prefix: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_components36.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_components36.Icon, { icon: link_default }) })
26095 }
26096 }
26097 );
26098 }
26099
26100 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs
26101 var import_components37 = __toESM(require_components(), 1);
26102 var import_element85 = __toESM(require_element(), 1);
26103 var import_i18n36 = __toESM(require_i18n(), 1);
26104 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
26105 var { ValidatedNumberControl } = unlock2(import_components37.privateApis);
26106 function toNumberOrEmpty(value) {
26107 if (value === "" || value === void 0) {
26108 return "";
26109 }
26110 const number = Number(value);
26111 return Number.isFinite(number) ? number : "";
26112 }
26113 function BetweenControls({
26114 value,
26115 onChange,
26116 hideLabelFromVision,
26117 step
26118 }) {
26119 const [min2 = "", max2 = ""] = value;
26120 const onChangeMin = (0, import_element85.useCallback)(
26121 (newValue) => onChange([toNumberOrEmpty(newValue), max2]),
26122 [onChange, max2]
26123 );
26124 const onChangeMax = (0, import_element85.useCallback)(
26125 (newValue) => onChange([min2, toNumberOrEmpty(newValue)]),
26126 [onChange, min2]
26127 );
26128 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
26129 import_components37.BaseControl,
26130 {
26131 help: (0, import_i18n36.__)("The max. value must be greater than the min. value."),
26132 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_components37.Flex, { direction: "row", gap: 4, children: [
26133 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
26134 import_components37.__experimentalNumberControl,
26135 {
26136 label: (0, import_i18n36.__)("Min."),
26137 value: min2,
26138 max: max2 ? Number(max2) - step : void 0,
26139 onChange: onChangeMin,
26140 __next40pxDefaultSize: true,
26141 hideLabelFromVision,
26142 step
26143 }
26144 ),
26145 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
26146 import_components37.__experimentalNumberControl,
26147 {
26148 label: (0, import_i18n36.__)("Max."),
26149 value: max2,
26150 min: min2 ? Number(min2) + step : void 0,
26151 onChange: onChangeMax,
26152 __next40pxDefaultSize: true,
26153 hideLabelFromVision,
26154 step
26155 }
26156 )
26157 ] })
26158 }
26159 );
26160 }
26161 function ValidatedNumber({
26162 data,
26163 field,
26164 onChange,
26165 hideLabelFromVision,
26166 markWhenOptional,
26167 operator,
26168 validity
26169 }) {
26170 const decimals = field.format?.decimals ?? 0;
26171 const step = Math.pow(10, Math.abs(decimals) * -1);
26172 const { label, description, getValue, setValue, isValid: isValid2 } = field;
26173 const value = getValue({ item: data }) ?? "";
26174 const disabled2 = field.isDisabled({ item: data, field });
26175 const onChangeControl = (0, import_element85.useCallback)(
26176 (newValue) => {
26177 onChange(
26178 setValue({
26179 item: data,
26180 // Do not convert an empty string or undefined to a number,
26181 // otherwise there's a mismatch between the UI control (empty)
26182 // and the data relied by onChange (0).
26183 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
26184 })
26185 );
26186 },
26187 [data, onChange, setValue]
26188 );
26189 const onChangeBetweenControls = (0, import_element85.useCallback)(
26190 (newValue) => {
26191 onChange(
26192 setValue({
26193 item: data,
26194 value: newValue
26195 })
26196 );
26197 },
26198 [data, onChange, setValue]
26199 );
26200 if (operator === OPERATOR_BETWEEN) {
26201 let valueBetween = ["", ""];
26202 if (Array.isArray(value) && value.length === 2 && value.every(
26203 (element) => typeof element === "number" || element === ""
26204 )) {
26205 valueBetween = value;
26206 }
26207 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
26208 BetweenControls,
26209 {
26210 value: valueBetween,
26211 onChange: onChangeBetweenControls,
26212 hideLabelFromVision,
26213 step
26214 }
26215 );
26216 }
26217 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
26218 ValidatedNumberControl,
26219 {
26220 required: !!isValid2.required,
26221 markWhenOptional,
26222 customValidity: getCustomValidity(isValid2, validity),
26223 label,
26224 help: description,
26225 value,
26226 onChange: onChangeControl,
26227 __next40pxDefaultSize: true,
26228 hideLabelFromVision,
26229 step,
26230 min: isValid2.min ? isValid2.min.constraint : void 0,
26231 max: isValid2.max ? isValid2.max.constraint : void 0,
26232 disabled: disabled2
26233 }
26234 );
26235 }
26236
26237 // packages/dataviews/build-module/components/dataform-controls/integer.mjs
26238 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
26239 function Integer(props) {
26240 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ValidatedNumber, { ...props });
26241 }
26242
26243 // packages/dataviews/build-module/components/dataform-controls/number.mjs
26244 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
26245 function Number2(props) {
26246 return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ValidatedNumber, { ...props });
26247 }
26248
26249 // packages/dataviews/build-module/components/dataform-controls/radio.mjs
26250 var import_components38 = __toESM(require_components(), 1);
26251 var import_element86 = __toESM(require_element(), 1);
26252 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
26253 var { ValidatedRadioControl } = unlock2(import_components38.privateApis);
26254 function Radio({
26255 data,
26256 field,
26257 onChange,
26258 hideLabelFromVision,
26259 markWhenOptional,
26260 validity
26261 }) {
26262 const { label, description, getValue, setValue, isValid: isValid2 } = field;
26263 const disabled2 = field.isDisabled({ item: data, field });
26264 const { elements, isLoading } = useElements({
26265 elements: field.elements,
26266 getElements: field.getElements
26267 });
26268 const value = getValue({ item: data });
26269 const onChangeControl = (0, import_element86.useCallback)(
26270 (newValue) => onChange(setValue({ item: data, value: newValue })),
26271 [data, onChange, setValue]
26272 );
26273 if (isLoading) {
26274 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components38.Spinner, {});
26275 }
26276 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
26277 ValidatedRadioControl,
26278 {
26279 required: !!field.isValid?.required,
26280 markWhenOptional,
26281 customValidity: getCustomValidity(isValid2, validity),
26282 label,
26283 help: description,
26284 onChange: onChangeControl,
26285 options: elements,
26286 selected: value,
26287 hideLabelFromVision,
26288 disabled: disabled2
26289 }
26290 );
26291 }
26292
26293 // packages/dataviews/build-module/components/dataform-controls/text.mjs
26294 var import_element87 = __toESM(require_element(), 1);
26295 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
26296 function Text3({
26297 data,
26298 field,
26299 onChange,
26300 hideLabelFromVision,
26301 markWhenOptional,
26302 config,
26303 validity
26304 }) {
26305 const { prefix, suffix } = config || {};
26306 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
26307 ValidatedText,
26308 {
26309 ...{
26310 data,
26311 field,
26312 onChange,
26313 hideLabelFromVision,
26314 markWhenOptional,
26315 validity,
26316 prefix: prefix ? (0, import_element87.createElement)(prefix) : void 0,
26317 suffix: suffix ? (0, import_element87.createElement)(suffix) : void 0
26318 }
26319 }
26320 );
26321 }
26322
26323 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs
26324 var import_components39 = __toESM(require_components(), 1);
26325 var import_element88 = __toESM(require_element(), 1);
26326 var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
26327 var { ValidatedToggleControl } = unlock2(import_components39.privateApis);
26328 function Toggle({
26329 field,
26330 onChange,
26331 data,
26332 hideLabelFromVision,
26333 markWhenOptional,
26334 validity
26335 }) {
26336 const { label, description, getValue, setValue, isValid: isValid2 } = field;
26337 const disabled2 = field.isDisabled({ item: data, field });
26338 const onChangeControl = (0, import_element88.useCallback)(() => {
26339 onChange(
26340 setValue({ item: data, value: !getValue({ item: data }) })
26341 );
26342 }, [onChange, setValue, data, getValue]);
26343 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
26344 ValidatedToggleControl,
26345 {
26346 required: !!isValid2.required,
26347 markWhenOptional,
26348 customValidity: getCustomValidity(isValid2, validity),
26349 hidden: hideLabelFromVision,
26350 label,
26351 help: description,
26352 checked: getValue({ item: data }),
26353 onChange: onChangeControl,
26354 disabled: disabled2
26355 }
26356 );
26357 }
26358
26359 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs
26360 var import_components40 = __toESM(require_components(), 1);
26361 var import_element89 = __toESM(require_element(), 1);
26362 var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1);
26363 var { ValidatedTextareaControl } = unlock2(import_components40.privateApis);
26364 function Textarea({
26365 data,
26366 field,
26367 onChange,
26368 hideLabelFromVision,
26369 markWhenOptional,
26370 config,
26371 validity
26372 }) {
26373 const { rows = 4 } = config || {};
26374 const disabled2 = field.isDisabled({ item: data, field });
26375 const { label, placeholder, description, setValue, isValid: isValid2 } = field;
26376 const value = field.getValue({ item: data });
26377 const onChangeControl = (0, import_element89.useCallback)(
26378 (newValue) => onChange(setValue({ item: data, value: newValue })),
26379 [data, onChange, setValue]
26380 );
26381 return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
26382 ValidatedTextareaControl,
26383 {
26384 required: !!isValid2.required,
26385 markWhenOptional,
26386 customValidity: getCustomValidity(isValid2, validity),
26387 label,
26388 placeholder,
26389 value: value ?? "",
26390 help: description,
26391 onChange: onChangeControl,
26392 rows,
26393 disabled: disabled2,
26394 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
26395 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
26396 __next40pxDefaultSize: true,
26397 hideLabelFromVision
26398 }
26399 );
26400 }
26401
26402 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs
26403 var import_components41 = __toESM(require_components(), 1);
26404 var import_element90 = __toESM(require_element(), 1);
26405 var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1);
26406 var { ValidatedToggleGroupControl } = unlock2(import_components41.privateApis);
26407 function ToggleGroup({
26408 data,
26409 field,
26410 onChange,
26411 hideLabelFromVision,
26412 markWhenOptional,
26413 validity
26414 }) {
26415 const { getValue, setValue, isValid: isValid2 } = field;
26416 const disabled2 = field.isDisabled({ item: data, field });
26417 const value = getValue({ item: data });
26418 const onChangeControl = (0, import_element90.useCallback)(
26419 (newValue) => onChange(setValue({ item: data, value: newValue })),
26420 [data, onChange, setValue]
26421 );
26422 const { elements, isLoading } = useElements({
26423 elements: field.elements,
26424 getElements: field.getElements
26425 });
26426 if (isLoading) {
26427 return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_components41.Spinner, {});
26428 }
26429 if (elements.length === 0) {
26430 return null;
26431 }
26432 const selectedOption = elements.find((el) => el.value === value);
26433 return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
26434 ValidatedToggleGroupControl,
26435 {
26436 required: !!field.isValid?.required,
26437 markWhenOptional,
26438 customValidity: getCustomValidity(isValid2, validity),
26439 __next40pxDefaultSize: true,
26440 isBlock: true,
26441 label: field.label,
26442 help: selectedOption?.description || field.description,
26443 onChange: onChangeControl,
26444 value,
26445 hideLabelFromVision,
26446 children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
26447 import_components41.__experimentalToggleGroupControlOption,
26448 {
26449 label: el.label,
26450 value: el.value,
26451 disabled: disabled2
26452 },
26453 el.value
26454 ))
26455 }
26456 );
26457 }
26458
26459 // packages/dataviews/build-module/components/dataform-controls/array.mjs
26460 var import_components42 = __toESM(require_components(), 1);
26461 var import_element91 = __toESM(require_element(), 1);
26462 var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1);
26463 var { ValidatedFormTokenField } = unlock2(import_components42.privateApis);
26464 function ArrayControl({
26465 data,
26466 field,
26467 onChange,
26468 hideLabelFromVision,
26469 markWhenOptional,
26470 validity
26471 }) {
26472 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
26473 const value = getValue({ item: data });
26474 const disabled2 = field.isDisabled({ item: data, field });
26475 const { elements, isLoading } = useElements({
26476 elements: field.elements,
26477 getElements: field.getElements
26478 });
26479 const arrayValueAsElements = (0, import_element91.useMemo)(
26480 () => Array.isArray(value) ? value.map((token) => {
26481 const element = elements?.find(
26482 (suggestion) => suggestion.value === token
26483 );
26484 return element || { value: token, label: token };
26485 }) : [],
26486 [value, elements]
26487 );
26488 const onChangeControl = (0, import_element91.useCallback)(
26489 (tokens) => {
26490 const valueTokens = tokens.map((token) => {
26491 if (typeof token === "object" && "value" in token) {
26492 return token.value;
26493 }
26494 return token;
26495 });
26496 onChange(setValue({ item: data, value: valueTokens }));
26497 },
26498 [onChange, setValue, data]
26499 );
26500 if (isLoading) {
26501 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_components42.Spinner, {});
26502 }
26503 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
26504 ValidatedFormTokenField,
26505 {
26506 required: !!isValid2?.required,
26507 markWhenOptional,
26508 customValidity: getCustomValidity(isValid2, validity),
26509 label: hideLabelFromVision ? void 0 : label,
26510 value: arrayValueAsElements,
26511 onChange: onChangeControl,
26512 placeholder,
26513 suggestions: elements?.map((element) => element.value),
26514 disabled: disabled2,
26515 __experimentalValidateInput: (token) => {
26516 if (field.isValid?.elements && elements) {
26517 return elements.some(
26518 (element) => element.value === token || element.label === token
26519 );
26520 }
26521 return true;
26522 },
26523 __experimentalExpandOnFocus: elements && elements.length > 0,
26524 help: description ?? (field.isValid?.elements ? "" : void 0),
26525 displayTransform: (token) => {
26526 if (typeof token === "object" && "label" in token) {
26527 return token.label;
26528 }
26529 if (typeof token === "string" && elements) {
26530 const element = elements.find(
26531 (el) => el.value === token
26532 );
26533 return element?.label || token;
26534 }
26535 return token;
26536 },
26537 __experimentalRenderItem: ({ item }) => {
26538 if (typeof item === "string" && elements) {
26539 const element = elements.find(
26540 (el) => el.value === item
26541 );
26542 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { children: element?.label || item });
26543 }
26544 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { children: item });
26545 }
26546 }
26547 );
26548 }
26549
26550 // node_modules/colord/index.mjs
26551 var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
26552 var t = function(r3) {
26553 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
26554 };
26555 var n = function(r3, t2, n2) {
26556 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0;
26557 };
26558 var e = function(r3, t2, n2) {
26559 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2;
26560 };
26561 var u = function(r3) {
26562 return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360;
26563 };
26564 var a = function(r3) {
26565 return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) };
26566 };
26567 var o = function(r3) {
26568 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
26569 };
26570 var i = /^#([0-9a-f]{3,8})$/i;
26571 var s = function(r3) {
26572 var t2 = r3.toString(16);
26573 return t2.length < 2 ? "0" + t2 : t2;
26574 };
26575 var h = function(r3) {
26576 var t2 = r3.r, n2 = r3.g, e2 = r3.b, u2 = r3.a, a2 = Math.max(t2, n2, e2), o2 = a2 - Math.min(t2, n2, e2), i2 = o2 ? a2 === t2 ? (n2 - e2) / o2 : a2 === n2 ? 2 + (e2 - t2) / o2 : 4 + (t2 - n2) / o2 : 0;
26577 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
26578 };
26579 var b = function(r3) {
26580 var t2 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a;
26581 t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100;
26582 var a2 = Math.floor(t2), o2 = e2 * (1 - n2), i2 = e2 * (1 - (t2 - a2) * n2), s2 = e2 * (1 - (1 - t2 + a2) * n2), h2 = a2 % 6;
26583 return { r: 255 * [e2, i2, o2, o2, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o2, o2][h2], b: 255 * [o2, o2, s2, e2, e2, i2][h2], a: u2 };
26584 };
26585 var g = function(r3) {
26586 return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) };
26587 };
26588 var d = function(r3) {
26589 return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) };
26590 };
26591 var f = function(r3) {
26592 return b((n2 = (t2 = r3).s, { h: t2.h, s: (n2 *= ((e2 = t2.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t2.a }));
26593 var t2, n2, e2;
26594 };
26595 var c = function(r3) {
26596 return { h: (t2 = h(r3)).h, s: (u2 = (200 - (n2 = t2.s)) * (e2 = t2.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t2.a };
26597 var t2, n2, e2, u2;
26598 };
26599 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
26600 var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
26601 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
26602 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
26603 var y = { string: [[function(r3) {
26604 var t2 = i.exec(r3);
26605 return t2 ? (r3 = t2[1]).length <= 4 ? { r: parseInt(r3[0] + r3[0], 16), g: parseInt(r3[1] + r3[1], 16), b: parseInt(r3[2] + r3[2], 16), a: 4 === r3.length ? n(parseInt(r3[3] + r3[3], 16) / 255, 2) : 1 } : 6 === r3.length || 8 === r3.length ? { r: parseInt(r3.substr(0, 2), 16), g: parseInt(r3.substr(2, 2), 16), b: parseInt(r3.substr(4, 2), 16), a: 8 === r3.length ? n(parseInt(r3.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
26606 }, "hex"], [function(r3) {
26607 var t2 = v.exec(r3) || m.exec(r3);
26608 return t2 ? t2[2] !== t2[4] || t2[4] !== t2[6] ? null : a({ r: Number(t2[1]) / (t2[2] ? 100 / 255 : 1), g: Number(t2[3]) / (t2[4] ? 100 / 255 : 1), b: Number(t2[5]) / (t2[6] ? 100 / 255 : 1), a: void 0 === t2[7] ? 1 : Number(t2[7]) / (t2[8] ? 100 : 1) }) : null;
26609 }, "rgb"], [function(t2) {
26610 var n2 = l.exec(t2) || p.exec(t2);
26611 if (!n2) return null;
26612 var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r2[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) });
26613 return f(a2);
26614 }, "hsl"]], object: [[function(r3) {
26615 var n2 = r3.r, e2 = r3.g, u2 = r3.b, o2 = r3.a, i2 = void 0 === o2 ? 1 : o2;
26616 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
26617 }, "rgb"], [function(r3) {
26618 var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o2 = void 0 === a2 ? 1 : a2;
26619 if (!t(n2) || !t(e2) || !t(u2)) return null;
26620 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) });
26621 return f(i2);
26622 }, "hsl"], [function(r3) {
26623 var n2 = r3.h, a2 = r3.s, o2 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2;
26624 if (!t(n2) || !t(a2) || !t(o2)) return null;
26625 var h2 = (function(r4) {
26626 return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) };
26627 })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) });
26628 return b(h2);
26629 }, "hsv"]] };
26630 var N = function(r3, t2) {
26631 for (var n2 = 0; n2 < t2.length; n2++) {
26632 var e2 = t2[n2][0](r3);
26633 if (e2) return [e2, t2[n2][1]];
26634 }
26635 return [null, void 0];
26636 };
26637 var x = function(r3) {
26638 return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0];
26639 };
26640 var M = function(r3, t2) {
26641 var n2 = c(r3);
26642 return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a };
26643 };
26644 var H = function(r3) {
26645 return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255;
26646 };
26647 var $ = function(r3, t2) {
26648 var n2 = c(r3);
26649 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a };
26650 };
26651 var j = (function() {
26652 function r3(r4) {
26653 this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
26654 }
26655 return r3.prototype.isValid = function() {
26656 return null !== this.parsed;
26657 }, r3.prototype.brightness = function() {
26658 return n(H(this.rgba), 2);
26659 }, r3.prototype.isDark = function() {
26660 return H(this.rgba) < 0.5;
26661 }, r3.prototype.isLight = function() {
26662 return H(this.rgba) >= 0.5;
26663 }, r3.prototype.toHex = function() {
26664 return r4 = o(this.rgba), t2 = r4.r, e2 = r4.g, u2 = r4.b, i2 = (a2 = r4.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t2) + s(e2) + s(u2) + i2;
26665 var r4, t2, e2, u2, a2, i2;
26666 }, r3.prototype.toRgb = function() {
26667 return o(this.rgba);
26668 }, r3.prototype.toRgbString = function() {
26669 return r4 = o(this.rgba), t2 = r4.r, n2 = r4.g, e2 = r4.b, (u2 = r4.a) < 1 ? "rgba(" + t2 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t2 + ", " + n2 + ", " + e2 + ")";
26670 var r4, t2, n2, e2, u2;
26671 }, r3.prototype.toHsl = function() {
26672 return d(c(this.rgba));
26673 }, r3.prototype.toHslString = function() {
26674 return r4 = d(c(this.rgba)), t2 = r4.h, n2 = r4.s, e2 = r4.l, (u2 = r4.a) < 1 ? "hsla(" + t2 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t2 + ", " + n2 + "%, " + e2 + "%)";
26675 var r4, t2, n2, e2, u2;
26676 }, r3.prototype.toHsv = function() {
26677 return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) };
26678 var r4;
26679 }, r3.prototype.invert = function() {
26680 return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a });
26681 var r4;
26682 }, r3.prototype.saturate = function(r4) {
26683 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4));
26684 }, r3.prototype.desaturate = function(r4) {
26685 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4));
26686 }, r3.prototype.grayscale = function() {
26687 return w(M(this.rgba, -1));
26688 }, r3.prototype.lighten = function(r4) {
26689 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4));
26690 }, r3.prototype.darken = function(r4) {
26691 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4));
26692 }, r3.prototype.rotate = function(r4) {
26693 return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4);
26694 }, r3.prototype.alpha = function(r4) {
26695 return "number" == typeof r4 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r4 }) : n(this.rgba.a, 3);
26696 var t2;
26697 }, r3.prototype.hue = function(r4) {
26698 var t2 = c(this.rgba);
26699 return "number" == typeof r4 ? w({ h: r4, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h);
26700 }, r3.prototype.isEqual = function(r4) {
26701 return this.toHex() === w(r4).toHex();
26702 }, r3;
26703 })();
26704 var w = function(r3) {
26705 return r3 instanceof j ? r3 : new j(r3);
26706 };
26707
26708 // packages/dataviews/build-module/components/dataform-controls/color.mjs
26709 var import_components43 = __toESM(require_components(), 1);
26710 var import_element92 = __toESM(require_element(), 1);
26711 var import_i18n37 = __toESM(require_i18n(), 1);
26712 var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1);
26713 var { ValidatedInputControl: ValidatedInputControl3 } = unlock2(import_components43.privateApis);
26714 var ColorPickerDropdown = ({
26715 color,
26716 onColorChange,
26717 disabled: disabled2
26718 }) => {
26719 const validColor = color && w(color).isValid() ? color : "#ffffff";
26720 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
26721 import_components43.Dropdown,
26722 {
26723 className: "dataviews-controls__color-picker-dropdown",
26724 popoverProps: { resize: false },
26725 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
26726 import_components43.Button,
26727 {
26728 onClick: onToggle,
26729 "aria-label": (0, import_i18n37.__)("Open color picker"),
26730 size: "small",
26731 disabled: disabled2,
26732 accessibleWhenDisabled: true,
26733 icon: () => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components43.ColorIndicator, { colorValue: validColor })
26734 }
26735 ),
26736 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components43.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
26737 import_components43.ColorPicker,
26738 {
26739 color: validColor,
26740 onChange: onColorChange,
26741 enableAlpha: true
26742 }
26743 ) })
26744 }
26745 );
26746 };
26747 function Color({
26748 data,
26749 field,
26750 onChange,
26751 hideLabelFromVision,
26752 markWhenOptional,
26753 validity
26754 }) {
26755 const { label, placeholder, description, setValue, isValid: isValid2 } = field;
26756 const disabled2 = field.isDisabled({ item: data, field });
26757 const value = field.getValue({ item: data }) || "";
26758 const handleColorChange = (0, import_element92.useCallback)(
26759 (newColor) => {
26760 onChange(setValue({ item: data, value: newColor }));
26761 },
26762 [data, onChange, setValue]
26763 );
26764 const handleInputChange = (0, import_element92.useCallback)(
26765 (newValue) => {
26766 onChange(setValue({ item: data, value: newValue || "" }));
26767 },
26768 [data, onChange, setValue]
26769 );
26770 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
26771 ValidatedInputControl3,
26772 {
26773 required: !!field.isValid?.required,
26774 markWhenOptional,
26775 customValidity: getCustomValidity(isValid2, validity),
26776 label,
26777 placeholder,
26778 value,
26779 help: description,
26780 onChange: handleInputChange,
26781 hideLabelFromVision,
26782 type: "text",
26783 disabled: disabled2,
26784 prefix: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components43.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
26785 ColorPickerDropdown,
26786 {
26787 color: value,
26788 onColorChange: handleColorChange,
26789 disabled: disabled2
26790 }
26791 ) })
26792 }
26793 );
26794 }
26795
26796 // packages/dataviews/build-module/components/dataform-controls/password.mjs
26797 var import_components44 = __toESM(require_components(), 1);
26798 var import_element93 = __toESM(require_element(), 1);
26799 var import_i18n38 = __toESM(require_i18n(), 1);
26800 var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1);
26801 function Password({
26802 data,
26803 field,
26804 onChange,
26805 hideLabelFromVision,
26806 markWhenOptional,
26807 validity
26808 }) {
26809 const [isVisible2, setIsVisible] = (0, import_element93.useState)(false);
26810 const disabled2 = field.isDisabled({ item: data, field });
26811 const toggleVisibility = (0, import_element93.useCallback)(() => {
26812 setIsVisible((prev) => !prev);
26813 }, []);
26814 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
26815 ValidatedText,
26816 {
26817 ...{
26818 data,
26819 field,
26820 onChange,
26821 hideLabelFromVision,
26822 markWhenOptional,
26823 validity,
26824 type: isVisible2 ? "text" : "password",
26825 suffix: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_components44.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
26826 import_components44.Button,
26827 {
26828 icon: isVisible2 ? unseen_default : seen_default,
26829 onClick: toggleVisibility,
26830 size: "small",
26831 label: isVisible2 ? (0, import_i18n38.__)("Hide password") : (0, import_i18n38.__)("Show password"),
26832 disabled: disabled2,
26833 accessibleWhenDisabled: true
26834 }
26835 ) })
26836 }
26837 }
26838 );
26839 }
26840
26841 // packages/dataviews/build-module/field-types/utils/has-elements.mjs
26842 function hasElements(field) {
26843 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
26844 }
26845
26846 // packages/dataviews/build-module/components/dataform-controls/index.mjs
26847 var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1);
26848 var FORM_CONTROLS = {
26849 adaptiveSelect: AdaptiveSelect,
26850 array: ArrayControl,
26851 checkbox: Checkbox,
26852 color: Color,
26853 combobox: Combobox3,
26854 datetime: DateTime,
26855 date: DateControl,
26856 email: Email,
26857 telephone: Telephone,
26858 url: Url,
26859 integer: Integer,
26860 number: Number2,
26861 password: Password,
26862 radio: Radio,
26863 select: Select,
26864 text: Text3,
26865 toggle: Toggle,
26866 textarea: Textarea,
26867 toggleGroup: ToggleGroup
26868 };
26869 function isEditConfig(value) {
26870 return value && typeof value === "object" && typeof value.control === "string";
26871 }
26872 function createConfiguredControl(config) {
26873 const { control, ...controlConfig } = config;
26874 const BaseControlType = getControlByType(control);
26875 if (BaseControlType === null) {
26876 return null;
26877 }
26878 return function ConfiguredControl(props) {
26879 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(BaseControlType, { ...props, config: controlConfig });
26880 };
26881 }
26882 function getControl(field, fallback) {
26883 if (typeof field.Edit === "function") {
26884 return field.Edit;
26885 }
26886 if (typeof field.Edit === "string") {
26887 return getControlByType(field.Edit);
26888 }
26889 if (isEditConfig(field.Edit)) {
26890 return createConfiguredControl(field.Edit);
26891 }
26892 if (hasElements(field) && field.type !== "array") {
26893 return getControlByType("adaptiveSelect");
26894 }
26895 if (fallback === null) {
26896 return null;
26897 }
26898 return getControlByType(fallback);
26899 }
26900 function getControlByType(type) {
26901 if (Object.keys(FORM_CONTROLS).includes(type)) {
26902 return FORM_CONTROLS[type];
26903 }
26904 return null;
26905 }
26906
26907 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs
26908 function getFilterBy(field, defaultOperators, validOperators) {
26909 if (field.filterBy === false) {
26910 return false;
26911 }
26912 const operators = field.filterBy?.operators?.filter(
26913 (op) => validOperators.includes(op)
26914 ) ?? defaultOperators;
26915 if (operators.length === 0) {
26916 return false;
26917 }
26918 return {
26919 isPrimary: !!field.filterBy?.isPrimary,
26920 operators
26921 };
26922 }
26923 var get_filter_by_default = getFilterBy;
26924
26925 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs
26926 var getValueFromId = (id) => ({ item }) => {
26927 const path = id.split(".");
26928 let value = item;
26929 for (const segment of path) {
26930 if (value.hasOwnProperty(segment)) {
26931 value = value[segment];
26932 } else {
26933 value = void 0;
26934 }
26935 }
26936 return value;
26937 };
26938 var get_value_from_id_default = getValueFromId;
26939
26940 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs
26941 var setValueFromId = (id) => ({ value }) => {
26942 const path = id.split(".");
26943 const result = {};
26944 let current = result;
26945 for (const segment of path.slice(0, -1)) {
26946 current[segment] = {};
26947 current = current[segment];
26948 }
26949 current[path.at(-1)] = value;
26950 return result;
26951 };
26952 var set_value_from_id_default = setValueFromId;
26953
26954 // packages/dataviews/build-module/field-types/email.mjs
26955 var import_i18n39 = __toESM(require_i18n(), 1);
26956
26957 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs
26958 function RenderFromElements({
26959 item,
26960 field
26961 }) {
26962 const { elements, isLoading } = useElements({
26963 elements: field.elements,
26964 getElements: field.getElements
26965 });
26966 const value = field.getValue({ item });
26967 if (isLoading) {
26968 return value;
26969 }
26970 if (elements.length === 0) {
26971 return value;
26972 }
26973 return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
26974 }
26975
26976 // packages/dataviews/build-module/field-types/utils/render-default.mjs
26977 var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1);
26978 function render({
26979 item,
26980 field
26981 }) {
26982 if (field.hasElements) {
26983 return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RenderFromElements, { item, field });
26984 }
26985 return field.getValueFormatted({ item, field });
26986 }
26987
26988 // packages/dataviews/build-module/field-types/utils/sort-text.mjs
26989 var sort_text_default = (a2, b2, direction) => {
26990 return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2);
26991 };
26992
26993 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs
26994 function isValidRequired(item, field) {
26995 const value = field.getValue({ item });
26996 return ![void 0, "", null].includes(value);
26997 }
26998
26999 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs
27000 function isValidMinLength(item, field) {
27001 if (typeof field.isValid.minLength?.constraint !== "number") {
27002 return false;
27003 }
27004 const value = field.getValue({ item });
27005 if ([void 0, "", null].includes(value)) {
27006 return true;
27007 }
27008 return String(value).length >= field.isValid.minLength.constraint;
27009 }
27010
27011 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs
27012 function isValidMaxLength(item, field) {
27013 if (typeof field.isValid.maxLength?.constraint !== "number") {
27014 return false;
27015 }
27016 const value = field.getValue({ item });
27017 if ([void 0, "", null].includes(value)) {
27018 return true;
27019 }
27020 return String(value).length <= field.isValid.maxLength.constraint;
27021 }
27022
27023 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs
27024 function isValidPattern(item, field) {
27025 if (field.isValid.pattern?.constraint === void 0) {
27026 return true;
27027 }
27028 try {
27029 const regexp = new RegExp(field.isValid.pattern.constraint);
27030 const value = field.getValue({ item });
27031 if ([void 0, "", null].includes(value)) {
27032 return true;
27033 }
27034 return regexp.test(String(value));
27035 } catch {
27036 return false;
27037 }
27038 }
27039
27040 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs
27041 function isValidElements(item, field) {
27042 const elements = field.elements ?? [];
27043 const validValues = elements.map((el) => el.value);
27044 if (validValues.length === 0) {
27045 return true;
27046 }
27047 const value = field.getValue({ item });
27048 return [].concat(value).every((v2) => validValues.includes(v2));
27049 }
27050
27051 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs
27052 function getValueFormatted({
27053 item,
27054 field
27055 }) {
27056 return field.getValue({ item });
27057 }
27058 var get_value_formatted_default_default = getValueFormatted;
27059
27060 // packages/dataviews/build-module/field-types/email.mjs
27061 var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
27062 function isValidCustom(item, field) {
27063 const value = field.getValue({ item });
27064 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
27065 return (0, import_i18n39.__)("Value must be a valid email address.");
27066 }
27067 return null;
27068 }
27069 var email_default = {
27070 type: "email",
27071 render,
27072 Edit: "email",
27073 sort: sort_text_default,
27074 enableSorting: true,
27075 enableGlobalSearch: false,
27076 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27077 validOperators: [
27078 OPERATOR_IS,
27079 OPERATOR_IS_NOT,
27080 OPERATOR_CONTAINS,
27081 OPERATOR_NOT_CONTAINS,
27082 OPERATOR_STARTS_WITH,
27083 // Multiple selection
27084 OPERATOR_IS_ANY,
27085 OPERATOR_IS_NONE,
27086 OPERATOR_IS_ALL,
27087 OPERATOR_IS_NOT_ALL
27088 ],
27089 format: {},
27090 getValueFormatted: get_value_formatted_default_default,
27091 validate: {
27092 required: isValidRequired,
27093 pattern: isValidPattern,
27094 minLength: isValidMinLength,
27095 maxLength: isValidMaxLength,
27096 elements: isValidElements,
27097 custom: isValidCustom
27098 }
27099 };
27100
27101 // packages/dataviews/build-module/field-types/integer.mjs
27102 var import_i18n40 = __toESM(require_i18n(), 1);
27103
27104 // packages/dataviews/build-module/field-types/utils/sort-number.mjs
27105 var sort_number_default = (a2, b2, direction) => {
27106 return direction === "asc" ? a2 - b2 : b2 - a2;
27107 };
27108
27109 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs
27110 function isValidMin(item, field) {
27111 if (typeof field.isValid.min?.constraint !== "number") {
27112 return false;
27113 }
27114 const value = field.getValue({ item });
27115 if ([void 0, "", null].includes(value)) {
27116 return true;
27117 }
27118 return Number(value) >= field.isValid.min.constraint;
27119 }
27120
27121 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs
27122 function isValidMax(item, field) {
27123 if (typeof field.isValid.max?.constraint !== "number") {
27124 return false;
27125 }
27126 const value = field.getValue({ item });
27127 if ([void 0, "", null].includes(value)) {
27128 return true;
27129 }
27130 return Number(value) <= field.isValid.max.constraint;
27131 }
27132
27133 // packages/dataviews/build-module/field-types/integer.mjs
27134 var format2 = {
27135 separatorThousand: ","
27136 };
27137 function getValueFormatted2({
27138 item,
27139 field
27140 }) {
27141 let value = field.getValue({ item });
27142 if (value === null || value === void 0) {
27143 return "";
27144 }
27145 value = Number(value);
27146 if (!Number.isFinite(value)) {
27147 return String(value);
27148 }
27149 let formatInteger;
27150 if (field.type !== "integer") {
27151 formatInteger = format2;
27152 } else {
27153 formatInteger = field.format;
27154 }
27155 const { separatorThousand } = formatInteger;
27156 const integerValue = Math.trunc(value);
27157 if (!separatorThousand) {
27158 return String(integerValue);
27159 }
27160 return String(integerValue).replace(
27161 /\B(?=(\d{3})+(?!\d))/g,
27162 separatorThousand
27163 );
27164 }
27165 function isValidCustom2(item, field) {
27166 const value = field.getValue({ item });
27167 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
27168 return (0, import_i18n40.__)("Value must be an integer.");
27169 }
27170 return null;
27171 }
27172 var integer_default = {
27173 type: "integer",
27174 render,
27175 Edit: "integer",
27176 sort: sort_number_default,
27177 enableSorting: true,
27178 enableGlobalSearch: false,
27179 defaultOperators: [
27180 OPERATOR_IS,
27181 OPERATOR_IS_NOT,
27182 OPERATOR_LESS_THAN,
27183 OPERATOR_GREATER_THAN,
27184 OPERATOR_LESS_THAN_OR_EQUAL,
27185 OPERATOR_GREATER_THAN_OR_EQUAL,
27186 OPERATOR_BETWEEN
27187 ],
27188 validOperators: [
27189 // Single-selection
27190 OPERATOR_IS,
27191 OPERATOR_IS_NOT,
27192 OPERATOR_LESS_THAN,
27193 OPERATOR_GREATER_THAN,
27194 OPERATOR_LESS_THAN_OR_EQUAL,
27195 OPERATOR_GREATER_THAN_OR_EQUAL,
27196 OPERATOR_BETWEEN,
27197 // Multiple-selection
27198 OPERATOR_IS_ANY,
27199 OPERATOR_IS_NONE,
27200 OPERATOR_IS_ALL,
27201 OPERATOR_IS_NOT_ALL
27202 ],
27203 format: format2,
27204 getValueFormatted: getValueFormatted2,
27205 validate: {
27206 required: isValidRequired,
27207 min: isValidMin,
27208 max: isValidMax,
27209 elements: isValidElements,
27210 custom: isValidCustom2
27211 }
27212 };
27213
27214 // packages/dataviews/build-module/field-types/number.mjs
27215 var import_i18n41 = __toESM(require_i18n(), 1);
27216 var format3 = {
27217 separatorThousand: ",",
27218 separatorDecimal: ".",
27219 decimals: 2
27220 };
27221 function getValueFormatted3({
27222 item,
27223 field
27224 }) {
27225 let value = field.getValue({ item });
27226 if (value === null || value === void 0) {
27227 return "";
27228 }
27229 value = Number(value);
27230 if (!Number.isFinite(value)) {
27231 return String(value);
27232 }
27233 let formatNumber;
27234 if (field.type !== "number") {
27235 formatNumber = format3;
27236 } else {
27237 formatNumber = field.format;
27238 }
27239 const { separatorThousand, separatorDecimal, decimals } = formatNumber;
27240 const fixedValue = value.toFixed(decimals);
27241 const [integerPart, decimalPart] = fixedValue.split(".");
27242 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
27243 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
27244 }
27245 function isEmpty2(value) {
27246 return value === "" || value === void 0 || value === null;
27247 }
27248 function isValidCustom3(item, field) {
27249 const value = field.getValue({ item });
27250 if (!isEmpty2(value) && !Number.isFinite(value)) {
27251 return (0, import_i18n41.__)("Value must be a number.");
27252 }
27253 return null;
27254 }
27255 var number_default = {
27256 type: "number",
27257 render,
27258 Edit: "number",
27259 sort: sort_number_default,
27260 enableSorting: true,
27261 enableGlobalSearch: false,
27262 defaultOperators: [
27263 OPERATOR_IS,
27264 OPERATOR_IS_NOT,
27265 OPERATOR_LESS_THAN,
27266 OPERATOR_GREATER_THAN,
27267 OPERATOR_LESS_THAN_OR_EQUAL,
27268 OPERATOR_GREATER_THAN_OR_EQUAL,
27269 OPERATOR_BETWEEN
27270 ],
27271 validOperators: [
27272 // Single-selection
27273 OPERATOR_IS,
27274 OPERATOR_IS_NOT,
27275 OPERATOR_LESS_THAN,
27276 OPERATOR_GREATER_THAN,
27277 OPERATOR_LESS_THAN_OR_EQUAL,
27278 OPERATOR_GREATER_THAN_OR_EQUAL,
27279 OPERATOR_BETWEEN,
27280 // Multiple-selection
27281 OPERATOR_IS_ANY,
27282 OPERATOR_IS_NONE,
27283 OPERATOR_IS_ALL,
27284 OPERATOR_IS_NOT_ALL
27285 ],
27286 format: format3,
27287 getValueFormatted: getValueFormatted3,
27288 validate: {
27289 required: isValidRequired,
27290 min: isValidMin,
27291 max: isValidMax,
27292 elements: isValidElements,
27293 custom: isValidCustom3
27294 }
27295 };
27296
27297 // packages/dataviews/build-module/field-types/text.mjs
27298 var text_default = {
27299 type: "text",
27300 render,
27301 Edit: "text",
27302 sort: sort_text_default,
27303 enableSorting: true,
27304 enableGlobalSearch: false,
27305 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27306 validOperators: [
27307 // Single selection
27308 OPERATOR_IS,
27309 OPERATOR_IS_NOT,
27310 OPERATOR_CONTAINS,
27311 OPERATOR_NOT_CONTAINS,
27312 OPERATOR_STARTS_WITH,
27313 // Multiple selection
27314 OPERATOR_IS_ANY,
27315 OPERATOR_IS_NONE,
27316 OPERATOR_IS_ALL,
27317 OPERATOR_IS_NOT_ALL
27318 ],
27319 format: {},
27320 getValueFormatted: get_value_formatted_default_default,
27321 validate: {
27322 required: isValidRequired,
27323 pattern: isValidPattern,
27324 minLength: isValidMinLength,
27325 maxLength: isValidMaxLength,
27326 elements: isValidElements
27327 }
27328 };
27329
27330 // packages/dataviews/build-module/field-types/datetime.mjs
27331 var import_date7 = __toESM(require_date(), 1);
27332
27333 // packages/dataviews/build-module/field-types/utils/is-valid-date-boundary.mjs
27334 var import_date6 = __toESM(require_date(), 1);
27335 function parseDateLike(value) {
27336 if (!value) {
27337 return null;
27338 }
27339 if (!isValid(new Date(value))) {
27340 return null;
27341 }
27342 const parsed = (0, import_date6.getDate)(value);
27343 return parsed && isValid(parsed) ? parsed : null;
27344 }
27345 function validateDateLikeBoundary(item, field, boundary) {
27346 const constraint = field.isValid[boundary]?.constraint;
27347 if (typeof constraint !== "string") {
27348 return false;
27349 }
27350 const value = field.getValue({ item });
27351 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value;
27352 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") {
27353 return true;
27354 }
27355 const parsedConstraint = parseDateLike(constraint);
27356 const parsedValue = parseDateLike(String(boundaryValue));
27357 return !!parsedConstraint && !!parsedValue && (boundary === "min" ? parsedValue.getTime() >= parsedConstraint.getTime() : parsedValue.getTime() <= parsedConstraint.getTime());
27358 }
27359 function isValidMinDate(item, field) {
27360 return validateDateLikeBoundary(item, field, "min");
27361 }
27362 function isValidMaxDate(item, field) {
27363 return validateDateLikeBoundary(item, field, "max");
27364 }
27365
27366 // packages/dataviews/build-module/field-types/datetime.mjs
27367 var format4 = {
27368 datetime: (0, import_date7.getSettings)().formats.datetime,
27369 weekStartsOn: (0, import_date7.getSettings)().l10n.startOfWeek
27370 };
27371 function getValueFormatted4({
27372 item,
27373 field
27374 }) {
27375 const value = field.getValue({ item });
27376 if (["", void 0, null].includes(value)) {
27377 return "";
27378 }
27379 let formatDatetime;
27380 if (field.type !== "datetime") {
27381 formatDatetime = format4;
27382 } else {
27383 formatDatetime = field.format;
27384 }
27385 return (0, import_date7.dateI18n)(formatDatetime.datetime, (0, import_date7.getDate)(value));
27386 }
27387 var sort = (a2, b2, direction) => {
27388 const timeA = new Date(a2).getTime();
27389 const timeB = new Date(b2).getTime();
27390 return direction === "asc" ? timeA - timeB : timeB - timeA;
27391 };
27392 var datetime_default = {
27393 type: "datetime",
27394 render,
27395 Edit: "datetime",
27396 sort,
27397 enableSorting: true,
27398 enableGlobalSearch: false,
27399 defaultOperators: [
27400 OPERATOR_ON,
27401 OPERATOR_NOT_ON,
27402 OPERATOR_BEFORE,
27403 OPERATOR_AFTER,
27404 OPERATOR_BEFORE_INC,
27405 OPERATOR_AFTER_INC,
27406 OPERATOR_IN_THE_PAST,
27407 OPERATOR_OVER
27408 ],
27409 validOperators: [
27410 OPERATOR_ON,
27411 OPERATOR_NOT_ON,
27412 OPERATOR_BEFORE,
27413 OPERATOR_AFTER,
27414 OPERATOR_BEFORE_INC,
27415 OPERATOR_AFTER_INC,
27416 OPERATOR_IN_THE_PAST,
27417 OPERATOR_OVER
27418 ],
27419 format: format4,
27420 getValueFormatted: getValueFormatted4,
27421 validate: {
27422 required: isValidRequired,
27423 elements: isValidElements,
27424 min: isValidMinDate,
27425 max: isValidMaxDate
27426 }
27427 };
27428
27429 // packages/dataviews/build-module/field-types/date.mjs
27430 var import_date8 = __toESM(require_date(), 1);
27431 var format5 = {
27432 date: (0, import_date8.getSettings)().formats.date,
27433 weekStartsOn: (0, import_date8.getSettings)().l10n.startOfWeek
27434 };
27435 function getValueFormatted5({
27436 item,
27437 field
27438 }) {
27439 const value = field.getValue({ item });
27440 if (["", void 0, null].includes(value)) {
27441 return "";
27442 }
27443 let formatDate2;
27444 if (field.type !== "date") {
27445 formatDate2 = format5;
27446 } else {
27447 formatDate2 = field.format;
27448 }
27449 return (0, import_date8.dateI18n)(formatDate2.date, (0, import_date8.getDate)(value));
27450 }
27451 var sort2 = (a2, b2, direction) => {
27452 const timeA = new Date(a2).getTime();
27453 const timeB = new Date(b2).getTime();
27454 return direction === "asc" ? timeA - timeB : timeB - timeA;
27455 };
27456 var date_default = {
27457 type: "date",
27458 render,
27459 Edit: "date",
27460 sort: sort2,
27461 enableSorting: true,
27462 enableGlobalSearch: false,
27463 defaultOperators: [
27464 OPERATOR_ON,
27465 OPERATOR_NOT_ON,
27466 OPERATOR_BEFORE,
27467 OPERATOR_AFTER,
27468 OPERATOR_BEFORE_INC,
27469 OPERATOR_AFTER_INC,
27470 OPERATOR_IN_THE_PAST,
27471 OPERATOR_OVER,
27472 OPERATOR_BETWEEN
27473 ],
27474 validOperators: [
27475 OPERATOR_ON,
27476 OPERATOR_NOT_ON,
27477 OPERATOR_BEFORE,
27478 OPERATOR_AFTER,
27479 OPERATOR_BEFORE_INC,
27480 OPERATOR_AFTER_INC,
27481 OPERATOR_IN_THE_PAST,
27482 OPERATOR_OVER,
27483 OPERATOR_BETWEEN
27484 ],
27485 format: format5,
27486 getValueFormatted: getValueFormatted5,
27487 validate: {
27488 required: isValidRequired,
27489 elements: isValidElements,
27490 min: isValidMinDate,
27491 max: isValidMaxDate
27492 }
27493 };
27494
27495 // packages/dataviews/build-module/field-types/boolean.mjs
27496 var import_i18n42 = __toESM(require_i18n(), 1);
27497
27498 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs
27499 function isValidRequiredForBool(item, field) {
27500 const value = field.getValue({ item });
27501 return value === true;
27502 }
27503
27504 // packages/dataviews/build-module/field-types/boolean.mjs
27505 function getValueFormatted6({
27506 item,
27507 field
27508 }) {
27509 const value = field.getValue({ item });
27510 if (value === true) {
27511 return (0, import_i18n42.__)("True");
27512 }
27513 if (value === false) {
27514 return (0, import_i18n42.__)("False");
27515 }
27516 return "";
27517 }
27518 function isValidCustom4(item, field) {
27519 const value = field.getValue({ item });
27520 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
27521 return (0, import_i18n42.__)("Value must be true, false, or undefined");
27522 }
27523 return null;
27524 }
27525 var sort3 = (a2, b2, direction) => {
27526 const boolA = Boolean(a2);
27527 const boolB = Boolean(b2);
27528 if (boolA === boolB) {
27529 return 0;
27530 }
27531 if (direction === "asc") {
27532 return boolA ? 1 : -1;
27533 }
27534 return boolA ? -1 : 1;
27535 };
27536 var boolean_default = {
27537 type: "boolean",
27538 render,
27539 Edit: "checkbox",
27540 sort: sort3,
27541 validate: {
27542 required: isValidRequiredForBool,
27543 elements: isValidElements,
27544 custom: isValidCustom4
27545 },
27546 enableSorting: true,
27547 enableGlobalSearch: false,
27548 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
27549 validOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
27550 format: {},
27551 getValueFormatted: getValueFormatted6
27552 };
27553
27554 // packages/dataviews/build-module/field-types/media.mjs
27555 var media_default = {
27556 type: "media",
27557 render: () => null,
27558 Edit: null,
27559 sort: () => 0,
27560 enableSorting: false,
27561 enableGlobalSearch: false,
27562 defaultOperators: [],
27563 validOperators: [],
27564 format: {},
27565 getValueFormatted: get_value_formatted_default_default,
27566 // cannot validate any constraint, so
27567 // the only available validation for the field author
27568 // would be providing a custom validator.
27569 validate: {}
27570 };
27571
27572 // packages/dataviews/build-module/field-types/array.mjs
27573 var import_i18n43 = __toESM(require_i18n(), 1);
27574
27575 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs
27576 function isValidRequiredForArray(item, field) {
27577 const value = field.getValue({ item });
27578 return Array.isArray(value) && value.length > 0 && value.every(
27579 (element) => ![void 0, "", null].includes(element)
27580 );
27581 }
27582
27583 // packages/dataviews/build-module/field-types/array.mjs
27584 function getValueFormatted7({
27585 item,
27586 field
27587 }) {
27588 const value = field.getValue({ item });
27589 const arr = Array.isArray(value) ? value : [];
27590 return arr.join(", ");
27591 }
27592 function render2({ item, field }) {
27593 return getValueFormatted7({ item, field });
27594 }
27595 function isValidCustom5(item, field) {
27596 const value = field.getValue({ item });
27597 if (![void 0, "", null].includes(value) && !Array.isArray(value)) {
27598 return (0, import_i18n43.__)("Value must be an array.");
27599 }
27600 if (!value.every((v2) => typeof v2 === "string")) {
27601 return (0, import_i18n43.__)("Every value must be a string.");
27602 }
27603 return null;
27604 }
27605 var sort4 = (a2, b2, direction) => {
27606 const arrA = Array.isArray(a2) ? a2 : [];
27607 const arrB = Array.isArray(b2) ? b2 : [];
27608 if (arrA.length !== arrB.length) {
27609 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
27610 }
27611 const joinedA = arrA.join(",");
27612 const joinedB = arrB.join(",");
27613 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
27614 };
27615 var array_default = {
27616 type: "array",
27617 render: render2,
27618 Edit: "array",
27619 sort: sort4,
27620 enableSorting: true,
27621 enableGlobalSearch: false,
27622 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27623 validOperators: [
27624 OPERATOR_IS_ANY,
27625 OPERATOR_IS_NONE,
27626 OPERATOR_IS_ALL,
27627 OPERATOR_IS_NOT_ALL
27628 ],
27629 format: {},
27630 getValueFormatted: getValueFormatted7,
27631 validate: {
27632 required: isValidRequiredForArray,
27633 elements: isValidElements,
27634 custom: isValidCustom5
27635 }
27636 };
27637
27638 // packages/dataviews/build-module/field-types/password.mjs
27639 function getValueFormatted8({
27640 item,
27641 field
27642 }) {
27643 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
27644 }
27645 var password_default = {
27646 type: "password",
27647 render,
27648 Edit: "password",
27649 sort: () => 0,
27650 // Passwords should not be sortable for security reasons
27651 enableSorting: false,
27652 enableGlobalSearch: false,
27653 defaultOperators: [],
27654 validOperators: [],
27655 format: {},
27656 getValueFormatted: getValueFormatted8,
27657 validate: {
27658 required: isValidRequired,
27659 pattern: isValidPattern,
27660 minLength: isValidMinLength,
27661 maxLength: isValidMaxLength,
27662 elements: isValidElements
27663 }
27664 };
27665
27666 // packages/dataviews/build-module/field-types/telephone.mjs
27667 var telephone_default = {
27668 type: "telephone",
27669 render,
27670 Edit: "telephone",
27671 sort: sort_text_default,
27672 enableSorting: true,
27673 enableGlobalSearch: false,
27674 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27675 validOperators: [
27676 OPERATOR_IS,
27677 OPERATOR_IS_NOT,
27678 OPERATOR_CONTAINS,
27679 OPERATOR_NOT_CONTAINS,
27680 OPERATOR_STARTS_WITH,
27681 // Multiple selection
27682 OPERATOR_IS_ANY,
27683 OPERATOR_IS_NONE,
27684 OPERATOR_IS_ALL,
27685 OPERATOR_IS_NOT_ALL
27686 ],
27687 format: {},
27688 getValueFormatted: get_value_formatted_default_default,
27689 validate: {
27690 required: isValidRequired,
27691 pattern: isValidPattern,
27692 minLength: isValidMinLength,
27693 maxLength: isValidMaxLength,
27694 elements: isValidElements
27695 }
27696 };
27697
27698 // packages/dataviews/build-module/field-types/color.mjs
27699 var import_i18n44 = __toESM(require_i18n(), 1);
27700 var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
27701 function render3({ item, field }) {
27702 if (field.hasElements) {
27703 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(RenderFromElements, { item, field });
27704 }
27705 const value = get_value_formatted_default_default({ item, field });
27706 if (!value || !w(value).isValid()) {
27707 return value;
27708 }
27709 return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
27710 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
27711 "div",
27712 {
27713 style: {
27714 width: "16px",
27715 height: "16px",
27716 borderRadius: "50%",
27717 backgroundColor: value,
27718 border: "1px solid #ddd",
27719 flexShrink: 0
27720 }
27721 }
27722 ),
27723 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { children: value })
27724 ] });
27725 }
27726 function isValidCustom6(item, field) {
27727 const value = field.getValue({ item });
27728 if (![void 0, "", null].includes(value) && !w(value).isValid()) {
27729 return (0, import_i18n44.__)("Value must be a valid color.");
27730 }
27731 return null;
27732 }
27733 var sort5 = (a2, b2, direction) => {
27734 const colorA = w(a2);
27735 const colorB = w(b2);
27736 if (!colorA.isValid() && !colorB.isValid()) {
27737 return 0;
27738 }
27739 if (!colorA.isValid()) {
27740 return direction === "asc" ? 1 : -1;
27741 }
27742 if (!colorB.isValid()) {
27743 return direction === "asc" ? -1 : 1;
27744 }
27745 const hslA = colorA.toHsl();
27746 const hslB = colorB.toHsl();
27747 if (hslA.h !== hslB.h) {
27748 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
27749 }
27750 if (hslA.s !== hslB.s) {
27751 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
27752 }
27753 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
27754 };
27755 var color_default = {
27756 type: "color",
27757 render: render3,
27758 Edit: "color",
27759 sort: sort5,
27760 enableSorting: true,
27761 enableGlobalSearch: false,
27762 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27763 validOperators: [
27764 OPERATOR_IS,
27765 OPERATOR_IS_NOT,
27766 OPERATOR_IS_ANY,
27767 OPERATOR_IS_NONE
27768 ],
27769 format: {},
27770 getValueFormatted: get_value_formatted_default_default,
27771 validate: {
27772 required: isValidRequired,
27773 elements: isValidElements,
27774 custom: isValidCustom6
27775 }
27776 };
27777
27778 // packages/dataviews/build-module/field-types/url.mjs
27779 var url_default = {
27780 type: "url",
27781 render,
27782 Edit: "url",
27783 sort: sort_text_default,
27784 enableSorting: true,
27785 enableGlobalSearch: false,
27786 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27787 validOperators: [
27788 OPERATOR_IS,
27789 OPERATOR_IS_NOT,
27790 OPERATOR_CONTAINS,
27791 OPERATOR_NOT_CONTAINS,
27792 OPERATOR_STARTS_WITH,
27793 // Multiple selection
27794 OPERATOR_IS_ANY,
27795 OPERATOR_IS_NONE,
27796 OPERATOR_IS_ALL,
27797 OPERATOR_IS_NOT_ALL
27798 ],
27799 format: {},
27800 getValueFormatted: get_value_formatted_default_default,
27801 validate: {
27802 required: isValidRequired,
27803 pattern: isValidPattern,
27804 minLength: isValidMinLength,
27805 maxLength: isValidMaxLength,
27806 elements: isValidElements
27807 }
27808 };
27809
27810 // packages/dataviews/build-module/field-types/no-type.mjs
27811 var sort6 = (a2, b2, direction) => {
27812 if (typeof a2 === "number" && typeof b2 === "number") {
27813 return sort_number_default(a2, b2, direction);
27814 }
27815 return sort_text_default(a2, b2, direction);
27816 };
27817 var no_type_default = {
27818 // type: no type for this one
27819 render,
27820 Edit: null,
27821 sort: sort6,
27822 enableSorting: true,
27823 enableGlobalSearch: false,
27824 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
27825 validOperators: getAllOperatorNames(),
27826 format: {},
27827 getValueFormatted: get_value_formatted_default_default,
27828 validate: {
27829 required: isValidRequired,
27830 elements: isValidElements
27831 }
27832 };
27833
27834 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs
27835 function supportsNumericRangeConstraint(type) {
27836 return type === "integer" || type === "number";
27837 }
27838 function supportsDateRangeConstraint(type) {
27839 return type === "date" || type === "datetime";
27840 }
27841 function normalizeRangeRule(value, fieldType, key) {
27842 const validator = fieldType.validate[key];
27843 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsDateRangeConstraint(fieldType.type))) {
27844 return { constraint: value, validate: validator };
27845 }
27846 return void 0;
27847 }
27848 function getIsValid(field, fieldType) {
27849 const rules = field.isValid;
27850 let required;
27851 if (rules?.required === true && fieldType.validate.required !== void 0) {
27852 required = {
27853 constraint: true,
27854 validate: fieldType.validate.required
27855 };
27856 }
27857 let elements;
27858 if ((rules?.elements === true || // elements is enabled unless the field opts-out
27859 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
27860 elements = {
27861 constraint: true,
27862 validate: fieldType.validate.elements
27863 };
27864 }
27865 const min2 = normalizeRangeRule(rules?.min, fieldType, "min");
27866 const max2 = normalizeRangeRule(rules?.max, fieldType, "max");
27867 const minLengthValue = rules?.minLength;
27868 let minLength;
27869 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) {
27870 minLength = {
27871 constraint: minLengthValue,
27872 validate: fieldType.validate.minLength
27873 };
27874 }
27875 const maxLengthValue = rules?.maxLength;
27876 let maxLength;
27877 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) {
27878 maxLength = {
27879 constraint: maxLengthValue,
27880 validate: fieldType.validate.maxLength
27881 };
27882 }
27883 const patternValue = rules?.pattern;
27884 let pattern;
27885 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) {
27886 pattern = {
27887 constraint: patternValue,
27888 validate: fieldType.validate.pattern
27889 };
27890 }
27891 const custom = rules?.custom ?? fieldType.validate.custom;
27892 return {
27893 required,
27894 elements,
27895 min: min2,
27896 max: max2,
27897 minLength,
27898 maxLength,
27899 pattern,
27900 custom
27901 };
27902 }
27903
27904 // packages/dataviews/build-module/field-types/utils/get-filter.mjs
27905 function getFilter(fieldType) {
27906 return fieldType.validOperators.reduce((accumulator, operator) => {
27907 const operatorObj = getOperatorByName(operator);
27908 if (operatorObj?.filter) {
27909 accumulator[operator] = operatorObj.filter;
27910 }
27911 return accumulator;
27912 }, {});
27913 }
27914
27915 // packages/dataviews/build-module/field-types/utils/get-format.mjs
27916 function getFormat(field, fieldType) {
27917 return {
27918 ...fieldType.format,
27919 ...field.format
27920 };
27921 }
27922 var get_format_default = getFormat;
27923
27924 // packages/dataviews/build-module/field-types/index.mjs
27925 function getFieldTypeByName(type) {
27926 const found = [
27927 email_default,
27928 integer_default,
27929 number_default,
27930 text_default,
27931 datetime_default,
27932 date_default,
27933 boolean_default,
27934 media_default,
27935 array_default,
27936 password_default,
27937 telephone_default,
27938 color_default,
27939 url_default
27940 ].find((fieldType) => fieldType?.type === type);
27941 if (!!found) {
27942 return found;
27943 }
27944 return no_type_default;
27945 }
27946 function normalizeFields(fields) {
27947 return fields.map((field) => {
27948 const fieldType = getFieldTypeByName(field.type);
27949 const getValue = field.getValue || get_value_from_id_default(field.id);
27950 const sort7 = function(a2, b2, direction) {
27951 const aValue = getValue({ item: a2 });
27952 const bValue = getValue({ item: b2 });
27953 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
27954 };
27955 return {
27956 id: field.id,
27957 label: field.label || field.id,
27958 header: field.header || field.label || field.id,
27959 description: field.description,
27960 placeholder: field.placeholder,
27961 getValue,
27962 setValue: field.setValue || set_value_from_id_default(field.id),
27963 elements: field.elements,
27964 getElements: field.getElements,
27965 hasElements: hasElements(field),
27966 isVisible: field.isVisible,
27967 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled,
27968 enableHiding: field.enableHiding ?? true,
27969 readOnly: field.readOnly ?? false,
27970 // The type provides defaults for the following props
27971 type: fieldType.type,
27972 render: field.render ?? fieldType.render,
27973 Edit: getControl(field, fieldType.Edit),
27974 sort: sort7,
27975 enableSorting: field.enableSorting ?? fieldType.enableSorting,
27976 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
27977 isValid: getIsValid(field, fieldType),
27978 filterBy: get_filter_by_default(
27979 field,
27980 fieldType.defaultOperators,
27981 fieldType.validOperators
27982 ),
27983 filter: getFilter(fieldType),
27984 format: get_format_default(field, fieldType),
27985 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
27986 };
27987 });
27988 }
27989
27990 // packages/dataviews/build-module/hooks/use-data.mjs
27991 var import_element94 = __toESM(require_element(), 1);
27992 function useData({
27993 view,
27994 data: shownData,
27995 getItemId,
27996 isLoading,
27997 paginationInfo,
27998 selection
27999 }) {
28000 const isInfiniteScrollEnabled = view.infiniteScrollEnabled;
28001 const [hasInitiallyLoaded, setHasInitiallyLoaded] = (0, import_element94.useState)(
28002 !isLoading
28003 );
28004 (0, import_element94.useEffect)(() => {
28005 if (!isLoading) {
28006 setHasInitiallyLoaded(true);
28007 }
28008 }, [isLoading]);
28009 const previousDataRef = (0, import_element94.useRef)(shownData);
28010 const previousPaginationInfoRef = (0, import_element94.useRef)(paginationInfo);
28011 (0, import_element94.useEffect)(() => {
28012 if (!isLoading) {
28013 previousDataRef.current = shownData;
28014 previousPaginationInfoRef.current = paginationInfo;
28015 }
28016 }, [shownData, isLoading, paginationInfo]);
28017 const [visibleEntries, setVisibleEntries] = (0, import_element94.useState)([]);
28018 const positionMapRef = (0, import_element94.useRef)(/* @__PURE__ */ new Map());
28019 const allLoadedRecordsRef = (0, import_element94.useRef)([]);
28020 const prevViewParamsRef = (0, import_element94.useRef)({
28021 search: void 0,
28022 filters: void 0,
28023 perPage: void 0
28024 });
28025 const scrollDirectionRef = (0, import_element94.useRef)(void 0);
28026 const prevStartPositionRef = (0, import_element94.useRef)(void 0);
28027 const hasInitializedRef = (0, import_element94.useRef)(false);
28028 const allLoadedRecords = (0, import_element94.useMemo)(() => {
28029 if (view.startPosition !== void 0 && prevStartPositionRef.current !== void 0) {
28030 if (view.startPosition < prevStartPositionRef.current) {
28031 scrollDirectionRef.current = "up";
28032 } else if (view.startPosition > prevStartPositionRef.current) {
28033 scrollDirectionRef.current = "down";
28034 }
28035 }
28036 prevStartPositionRef.current = view.startPosition;
28037 const currentFiltersKey = JSON.stringify(view.filters ?? []);
28038 const prevFiltersKey = prevViewParamsRef.current.filters;
28039 const shouldReset = !hasInitializedRef.current || !view.infiniteScrollEnabled || view.search !== prevViewParamsRef.current.search || currentFiltersKey !== prevFiltersKey || view.perPage !== prevViewParamsRef.current.perPage;
28040 hasInitializedRef.current = true;
28041 prevViewParamsRef.current = {
28042 search: view.search,
28043 filters: currentFiltersKey,
28044 perPage: view.perPage
28045 };
28046 if (shouldReset) {
28047 positionMapRef.current.clear();
28048 scrollDirectionRef.current = void 0;
28049 const startPosition = view.search ? 1 : view.startPosition ?? 1;
28050 const records = shownData.map((record, index2) => {
28051 const position = startPosition + index2;
28052 positionMapRef.current.set(getItemId(record), position);
28053 return {
28054 ...record,
28055 position
28056 };
28057 });
28058 allLoadedRecordsRef.current = records;
28059 return records;
28060 }
28061 const prev = allLoadedRecordsRef.current;
28062 const shownDataIds = new Set(shownData.map(getItemId));
28063 const scrollDirection = scrollDirectionRef.current;
28064 const basePosition = view.search ? 1 : view.startPosition ?? 1;
28065 const newRecords = shownData.map((record, index2) => {
28066 const itemId = getItemId(record);
28067 const position = view.infiniteScrollEnabled ? basePosition + index2 : void 0;
28068 if (position !== void 0) {
28069 positionMapRef.current.set(itemId, position);
28070 }
28071 return {
28072 ...record,
28073 position
28074 };
28075 });
28076 if (newRecords.length === 0) {
28077 return prev;
28078 }
28079 const prevWithoutDuplicates = prev.filter(
28080 (record) => !shownDataIds.has(getItemId(record))
28081 );
28082 const allRecords = scrollDirection === "up" ? [...newRecords, ...prevWithoutDuplicates] : [...prevWithoutDuplicates, ...newRecords];
28083 allRecords.sort((a2, b2) => {
28084 const posA = a2.position;
28085 const posB = b2.position;
28086 return posA - posB;
28087 });
28088 let result = allRecords;
28089 if (visibleEntries.length > 0) {
28090 const visibleMin = Math.min(...visibleEntries);
28091 const visibleMax = Math.max(...visibleEntries);
28092 const buffer = 20;
28093 const recordPositions = allRecords.map(
28094 (r3) => r3.position
28095 );
28096 const minRecordPos = Math.min(...recordPositions);
28097 const maxRecordPos = Math.max(...recordPositions);
28098 const hasOverlap = !(maxRecordPos < visibleMin - buffer || minRecordPos > visibleMax + buffer);
28099 if (hasOverlap) {
28100 result = allRecords.filter((record) => {
28101 const itemId = getItemId(record);
28102 const isSelected2 = selection?.includes(itemId);
28103 if (isSelected2) {
28104 return true;
28105 }
28106 const itemPosition = record.position;
28107 if (scrollDirection === "up") {
28108 return itemPosition <= visibleMax + buffer;
28109 } else if (scrollDirection === "down") {
28110 return itemPosition >= visibleMin - buffer;
28111 }
28112 return itemPosition >= visibleMin - buffer && itemPosition <= visibleMax + buffer;
28113 });
28114 }
28115 }
28116 allLoadedRecordsRef.current = result;
28117 return result;
28118 }, [
28119 shownData,
28120 view.search,
28121 view.filters,
28122 view.perPage,
28123 view.startPosition,
28124 view.infiniteScrollEnabled,
28125 visibleEntries,
28126 selection,
28127 getItemId
28128 ]);
28129 if (!isInfiniteScrollEnabled) {
28130 const dataToReturn = isLoading && previousDataRef.current?.length ? previousDataRef.current : shownData;
28131 return {
28132 data: dataToReturn.map((item) => ({
28133 ...item,
28134 position: void 0
28135 })),
28136 paginationInfo: isLoading && previousDataRef.current?.length ? previousPaginationInfoRef.current : paginationInfo,
28137 hasInitiallyLoaded,
28138 setVisibleEntries: void 0
28139 };
28140 }
28141 return {
28142 data: allLoadedRecords,
28143 paginationInfo,
28144 hasInitiallyLoaded,
28145 setVisibleEntries
28146 };
28147 }
28148
28149 // packages/dataviews/build-module/hooks/use-infinite-scroll.mjs
28150 var import_element95 = __toESM(require_element(), 1);
28151 var import_compose11 = __toESM(require_compose(), 1);
28152 function captureAnchorElement(container, anchorElementRef, direction) {
28153 const containerRect = container.getBoundingClientRect();
28154 const centerY = containerRect.top + containerRect.height / 2;
28155 const items = Array.from(container.querySelectorAll("[aria-posinset]"));
28156 if (items.length === 0) {
28157 return false;
28158 }
28159 const bestAnchor = items.reduce((best, item) => {
28160 const itemRect = item.getBoundingClientRect();
28161 const itemCenterY = itemRect.top + itemRect.height / 2;
28162 const distance = Math.abs(itemCenterY - centerY);
28163 const bestRect = best.getBoundingClientRect();
28164 const bestCenterY = bestRect.top + bestRect.height / 2;
28165 const bestDistance = Math.abs(bestCenterY - centerY);
28166 return distance < bestDistance ? item : best;
28167 });
28168 const posinset = Number(bestAnchor.getAttribute("aria-posinset"));
28169 const anchorRect = bestAnchor.getBoundingClientRect();
28170 anchorElementRef.current = {
28171 posinset,
28172 viewportOffset: anchorRect.top - containerRect.top,
28173 direction
28174 };
28175 return true;
28176 }
28177 function useInfiniteScroll({
28178 view,
28179 onChangeView,
28180 isLoading,
28181 paginationInfo,
28182 containerRef,
28183 setVisibleEntries
28184 }) {
28185 const anchorElementRef = (0, import_element95.useRef)(null);
28186 const viewRef = (0, import_element95.useRef)(view);
28187 const isLoadingRef = (0, import_element95.useRef)(isLoading);
28188 const onChangeViewRef = (0, import_element95.useRef)(onChangeView);
28189 const totalItemsRef = (0, import_element95.useRef)(paginationInfo.totalItems);
28190 (0, import_element95.useLayoutEffect)(() => {
28191 viewRef.current = view;
28192 isLoadingRef.current = isLoading;
28193 onChangeViewRef.current = onChangeView;
28194 totalItemsRef.current = paginationInfo.totalItems;
28195 }, [view, isLoading, onChangeView, paginationInfo.totalItems]);
28196 const intersectionObserverCallback = (0, import_element95.useCallback)(
28197 (entries) => {
28198 if (!setVisibleEntries) {
28199 return;
28200 }
28201 setVisibleEntries((prev) => {
28202 const newVisibleEntries = new Set(prev);
28203 let hasChanged = false;
28204 entries.forEach((entry) => {
28205 const posInSet = Number(
28206 entry.target?.attributes?.getNamedItem(
28207 "aria-posinset"
28208 )?.value
28209 );
28210 if (isNaN(posInSet)) {
28211 return;
28212 }
28213 if (entry.isIntersecting) {
28214 if (!newVisibleEntries.has(posInSet)) {
28215 newVisibleEntries.add(posInSet);
28216 hasChanged = true;
28217 }
28218 } else if (newVisibleEntries.has(posInSet)) {
28219 newVisibleEntries.delete(posInSet);
28220 hasChanged = true;
28221 }
28222 });
28223 return hasChanged ? Array.from(newVisibleEntries).sort() : prev;
28224 });
28225 },
28226 [setVisibleEntries]
28227 );
28228 (0, import_element95.useLayoutEffect)(() => {
28229 const container = containerRef.current;
28230 const anchor = anchorElementRef.current;
28231 if (!container || !view.infiniteScrollEnabled || !anchor || isLoading) {
28232 return;
28233 }
28234 const anchorElement = container.querySelector(
28235 `[aria-posinset="${anchor.posinset}"]`
28236 );
28237 if (anchorElement) {
28238 const containerRect = container.getBoundingClientRect();
28239 const anchorRect = anchorElement.getBoundingClientRect();
28240 const currentOffset = anchorRect.top - containerRect.top;
28241 const scrollAdjustment = currentOffset - anchor.viewportOffset;
28242 if (Math.abs(scrollAdjustment) > 1) {
28243 container.scrollTop += scrollAdjustment;
28244 }
28245 }
28246 anchorElementRef.current = null;
28247 }, [containerRef, isLoading, view.infiniteScrollEnabled]);
28248 const intersectionObserverRef = (0, import_element95.useRef)(
28249 null
28250 );
28251 (0, import_element95.useEffect)(() => {
28252 if (!view.infiniteScrollEnabled || !intersectionObserverCallback) {
28253 if (intersectionObserverRef.current) {
28254 intersectionObserverRef.current.disconnect();
28255 intersectionObserverRef.current = null;
28256 }
28257 return;
28258 }
28259 intersectionObserverRef.current = new IntersectionObserver(
28260 intersectionObserverCallback,
28261 { root: null, rootMargin: "0px", threshold: 0.1 }
28262 );
28263 return () => {
28264 if (intersectionObserverRef.current) {
28265 intersectionObserverRef.current.disconnect();
28266 intersectionObserverRef.current = null;
28267 }
28268 };
28269 }, [view.infiniteScrollEnabled, intersectionObserverCallback]);
28270 (0, import_element95.useEffect)(() => {
28271 if (!view.infiniteScrollEnabled || !containerRef.current) {
28272 return;
28273 }
28274 let lastScrollTop = 0;
28275 const BOTTOM_THRESHOLD = 600;
28276 const TOP_THRESHOLD = 800;
28277 const handleScroll = (0, import_compose11.throttle)((event) => {
28278 const currentView = viewRef.current;
28279 const totalItems = totalItemsRef.current;
28280 const target = event.target;
28281 const scrollTop = target.scrollTop;
28282 const scrollHeight = target.scrollHeight;
28283 const clientHeight = target.clientHeight;
28284 const scrollDirection = scrollTop > lastScrollTop ? "down" : "up";
28285 lastScrollTop = scrollTop;
28286 if (isLoadingRef.current) {
28287 return;
28288 }
28289 const currentStartPosition = currentView.startPosition || 1;
28290 const batchSize = currentView.perPage || 10;
28291 const currentEndPosition = Math.min(
28292 currentStartPosition + batchSize,
28293 totalItems
28294 );
28295 if (scrollDirection === "down" && scrollTop + clientHeight >= scrollHeight - BOTTOM_THRESHOLD) {
28296 if (currentEndPosition < totalItems) {
28297 const newStartPosition = currentEndPosition;
28298 captureAnchorElement(target, anchorElementRef, "down");
28299 onChangeViewRef.current({
28300 ...currentView,
28301 startPosition: newStartPosition
28302 });
28303 }
28304 }
28305 if (scrollDirection === "up" && scrollTop <= TOP_THRESHOLD) {
28306 if (currentStartPosition > 1) {
28307 const calculatedStartPosition = currentStartPosition - batchSize;
28308 const newStartPosition = calculatedStartPosition < 6 ? 1 : calculatedStartPosition;
28309 captureAnchorElement(target, anchorElementRef, "up");
28310 onChangeViewRef.current({
28311 ...currentView,
28312 startPosition: newStartPosition
28313 });
28314 }
28315 }
28316 }, 50);
28317 const container = containerRef.current;
28318 container.addEventListener("scroll", handleScroll);
28319 return () => {
28320 container.removeEventListener("scroll", handleScroll);
28321 handleScroll.cancel();
28322 };
28323 }, [containerRef, view.infiniteScrollEnabled]);
28324 return {
28325 intersectionObserver: intersectionObserverRef.current
28326 };
28327 }
28328
28329 // packages/dataviews/build-module/dataviews/index.mjs
28330 var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1);
28331 var defaultGetItemId = (item) => item.id;
28332 var defaultIsItemClickable = () => true;
28333 var EMPTY_ARRAY6 = [];
28334 var DEFAULT_LAYOUTS = { table: {}, grid: {}, list: {} };
28335 var dataViewsLayouts = VIEW_LAYOUTS.filter(
28336 (viewLayout) => !viewLayout.isPicker
28337 );
28338 function DefaultUI({
28339 header,
28340 search = true,
28341 searchLabel = void 0
28342 }) {
28343 const { view } = (0, import_element96.useContext)(dataviews_context_default);
28344 const isInfiniteScroll = view.infiniteScrollEnabled;
28345 return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
28346 /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
28347 Stack,
28348 {
28349 direction: "row",
28350 align: "top",
28351 justify: "space-between",
28352 className: clsx_default("dataviews__view-actions", {
28353 "dataviews__view-actions--infinite-scroll": isInfiniteScroll
28354 }),
28355 gap: "xs",
28356 children: [
28357 /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
28358 Stack,
28359 {
28360 direction: "row",
28361 justify: "start",
28362 gap: "sm",
28363 className: "dataviews__search",
28364 children: [
28365 search && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(dataviews_search_default, { label: searchLabel }),
28366 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(toggle_default, {})
28367 ]
28368 }
28369 ),
28370 /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: [
28371 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(dataviews_view_config_default, {}),
28372 header
28373 ] })
28374 ]
28375 }
28376 ),
28377 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }),
28378 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DataViewsLayout, {}),
28379 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(DataViewsFooter, {})
28380 ] });
28381 }
28382 function DataViews({
28383 view,
28384 onChangeView,
28385 fields,
28386 search = true,
28387 searchLabel = void 0,
28388 actions = EMPTY_ARRAY6,
28389 data,
28390 getItemId = defaultGetItemId,
28391 getItemLevel,
28392 isLoading = false,
28393 paginationInfo,
28394 defaultLayouts: defaultLayoutsProperty = DEFAULT_LAYOUTS,
28395 selection: selectionProperty,
28396 onChangeSelection,
28397 onClickItem,
28398 renderItemLink,
28399 isItemClickable = defaultIsItemClickable,
28400 header,
28401 children,
28402 config = { perPageSizes: [10, 20, 50, 100] },
28403 empty,
28404 onReset
28405 }) {
28406 const [selectionState, setSelectionState] = (0, import_element96.useState)([]);
28407 const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0;
28408 const selection = isUncontrolled ? selectionState : selectionProperty;
28409 const {
28410 data: displayData,
28411 paginationInfo: displayPaginationInfo,
28412 hasInitiallyLoaded,
28413 setVisibleEntries
28414 } = useData({
28415 view,
28416 data,
28417 getItemId,
28418 isLoading,
28419 selection,
28420 paginationInfo
28421 });
28422 const containerRef = (0, import_element96.useRef)(null);
28423 const [containerWidth, setContainerWidth] = (0, import_element96.useState)(0);
28424 const resizeObserverRef = (0, import_compose12.useResizeObserver)(
28425 (resizeObserverEntries) => {
28426 setContainerWidth(
28427 resizeObserverEntries[0].borderBoxSize[0].inlineSize
28428 );
28429 },
28430 { box: "border-box" }
28431 );
28432 const [openedFilter, setOpenedFilter] = (0, import_element96.useState)(null);
28433 function setSelectionWithChange(value) {
28434 const newValue = typeof value === "function" ? value(selection) : value;
28435 if (isUncontrolled) {
28436 setSelectionState(newValue);
28437 }
28438 if (onChangeSelection) {
28439 onChangeSelection(newValue);
28440 }
28441 }
28442 const _fields = (0, import_element96.useMemo)(() => normalizeFields(fields), [fields]);
28443 const _selection = (0, import_element96.useMemo)(() => {
28444 if (view.infiniteScrollEnabled) {
28445 return selection;
28446 }
28447 return selection.filter(
28448 (id) => data.some((item) => getItemId(item) === id)
28449 );
28450 }, [selection, data, getItemId, view.infiniteScrollEnabled]);
28451 const filters = use_filters_default(_fields, view);
28452 const hasPrimaryOrLockedFilters = (0, import_element96.useMemo)(
28453 () => (filters || []).some(
28454 (filter) => filter.isPrimary || filter.isLocked
28455 ),
28456 [filters]
28457 );
28458 const [isShowingFilter, setIsShowingFilter] = (0, import_element96.useState)(
28459 hasPrimaryOrLockedFilters
28460 );
28461 const { intersectionObserver } = useInfiniteScroll({
28462 view,
28463 onChangeView,
28464 isLoading,
28465 paginationInfo,
28466 containerRef,
28467 setVisibleEntries
28468 });
28469 (0, import_element96.useEffect)(() => {
28470 if (hasPrimaryOrLockedFilters && !isShowingFilter) {
28471 setIsShowingFilter(true);
28472 }
28473 }, [hasPrimaryOrLockedFilters, isShowingFilter]);
28474 const defaultLayouts = (0, import_element96.useMemo)(
28475 () => Object.fromEntries(
28476 Object.entries(defaultLayoutsProperty).filter(([layoutType]) => {
28477 return dataViewsLayouts.some(
28478 (viewLayout) => viewLayout.type === layoutType
28479 );
28480 }).map(([key, value]) => [
28481 key,
28482 value === true ? {} : value
28483 ])
28484 ),
28485 [defaultLayoutsProperty]
28486 );
28487 if (!defaultLayouts[view.type]) {
28488 return null;
28489 }
28490 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
28491 dataviews_context_default.Provider,
28492 {
28493 value: {
28494 view,
28495 onChangeView,
28496 fields: _fields,
28497 actions,
28498 data: displayData,
28499 isLoading,
28500 paginationInfo: displayPaginationInfo,
28501 selection: _selection,
28502 onChangeSelection: setSelectionWithChange,
28503 openedFilter,
28504 setOpenedFilter,
28505 getItemId,
28506 getItemLevel,
28507 isItemClickable,
28508 onClickItem,
28509 renderItemLink,
28510 containerWidth,
28511 containerRef,
28512 resizeObserverRef,
28513 defaultLayouts,
28514 filters,
28515 isShowingFilter,
28516 setIsShowingFilter,
28517 config,
28518 empty,
28519 hasInitiallyLoaded,
28520 onReset,
28521 intersectionObserver
28522 },
28523 children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "dataviews-wrapper", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
28524 DefaultUI,
28525 {
28526 header,
28527 search,
28528 searchLabel
28529 }
28530 ) })
28531 }
28532 );
28533 }
28534 var DataViewsSubComponents = DataViews;
28535 DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter;
28536 DataViewsSubComponents.Filters = filters_default;
28537 DataViewsSubComponents.FiltersToggled = filters_toggled_default;
28538 DataViewsSubComponents.FiltersToggle = toggle_default;
28539 DataViewsSubComponents.Layout = DataViewsLayout;
28540 DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu;
28541 DataViewsSubComponents.Pagination = DataViewsPagination;
28542 DataViewsSubComponents.Search = dataviews_search_default;
28543 DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown;
28544 DataViewsSubComponents.Footer = DataViewsFooter;
28545 var dataviews_default = DataViewsSubComponents;
28546
28547 // packages/dataviews/build-module/dataform/index.mjs
28548 var import_element108 = __toESM(require_element(), 1);
28549
28550 // packages/dataviews/build-module/components/dataform-context/index.mjs
28551 var import_element97 = __toESM(require_element(), 1);
28552 var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1);
28553 var DataFormContext = (0, import_element97.createContext)({
28554 fields: []
28555 });
28556 DataFormContext.displayName = "DataFormContext";
28557 function DataFormProvider({
28558 fields,
28559 children
28560 }) {
28561 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DataFormContext.Provider, { value: { fields }, children });
28562 }
28563 var dataform_context_default = DataFormContext;
28564
28565 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
28566 var import_element107 = __toESM(require_element(), 1);
28567
28568 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
28569 var import_element98 = __toESM(require_element(), 1);
28570 var import_components45 = __toESM(require_components(), 1);
28571
28572 // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs
28573 var import_i18n45 = __toESM(require_i18n(), 1);
28574 var DEFAULT_LAYOUT = {
28575 type: "regular",
28576 labelPosition: "top"
28577 };
28578 var normalizeCardSummaryField = (sum) => {
28579 if (typeof sum === "string") {
28580 return [{ id: sum, visibility: "when-collapsed" }];
28581 }
28582 return sum.map((item) => {
28583 if (typeof item === "string") {
28584 return { id: item, visibility: "when-collapsed" };
28585 }
28586 return { id: item.id, visibility: item.visibility };
28587 });
28588 };
28589 function normalizeLayout(layout) {
28590 let normalizedLayout = DEFAULT_LAYOUT;
28591 if (layout?.type === "regular") {
28592 normalizedLayout = {
28593 type: "regular",
28594 labelPosition: layout?.labelPosition ?? "top"
28595 };
28596 } else if (layout?.type === "panel") {
28597 const summary = layout.summary ?? [];
28598 const normalizedSummary = Array.isArray(summary) ? summary : [summary];
28599 const openAs = layout?.openAs;
28600 let normalizedOpenAs;
28601 if (typeof openAs === "object" && openAs.type === "modal") {
28602 normalizedOpenAs = {
28603 type: "modal",
28604 applyLabel: openAs.applyLabel?.trim() || (0, import_i18n45.__)("Apply"),
28605 cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n45.__)("Cancel")
28606 };
28607 } else if (openAs === "modal") {
28608 normalizedOpenAs = {
28609 type: "modal",
28610 applyLabel: (0, import_i18n45.__)("Apply"),
28611 cancelLabel: (0, import_i18n45.__)("Cancel")
28612 };
28613 } else {
28614 normalizedOpenAs = { type: "dropdown" };
28615 }
28616 normalizedLayout = {
28617 type: "panel",
28618 labelPosition: layout?.labelPosition ?? "side",
28619 openAs: normalizedOpenAs,
28620 summary: normalizedSummary,
28621 editVisibility: layout?.editVisibility ?? "on-hover"
28622 };
28623 } else if (layout?.type === "card") {
28624 if (layout.withHeader === false) {
28625 normalizedLayout = {
28626 type: "card",
28627 withHeader: false,
28628 isOpened: true,
28629 summary: [],
28630 isCollapsible: false
28631 };
28632 } else {
28633 const summary = layout.summary ?? [];
28634 normalizedLayout = {
28635 type: "card",
28636 withHeader: true,
28637 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
28638 summary: normalizeCardSummaryField(summary),
28639 isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible
28640 };
28641 }
28642 } else if (layout?.type === "row") {
28643 normalizedLayout = {
28644 type: "row",
28645 alignment: layout?.alignment ?? "center",
28646 styles: layout?.styles ?? {}
28647 };
28648 } else if (layout?.type === "details") {
28649 normalizedLayout = {
28650 type: "details",
28651 summary: layout?.summary ?? ""
28652 };
28653 }
28654 return normalizedLayout;
28655 }
28656 function normalizeForm(form) {
28657 const normalizedFormLayout = normalizeLayout(form?.layout);
28658 const normalizedFields = (form.fields ?? []).map(
28659 (field) => {
28660 if (typeof field === "string") {
28661 return {
28662 id: field,
28663 layout: normalizedFormLayout
28664 };
28665 }
28666 const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout;
28667 return {
28668 id: field.id,
28669 layout: fieldLayout,
28670 ...!!field.label && { label: field.label },
28671 ...!!field.description && {
28672 description: field.description
28673 },
28674 ..."children" in field && Array.isArray(field.children) && {
28675 children: normalizeForm({
28676 fields: field.children,
28677 layout: DEFAULT_LAYOUT
28678 }).fields
28679 }
28680 };
28681 }
28682 );
28683 return {
28684 layout: normalizedFormLayout,
28685 fields: normalizedFields
28686 };
28687 }
28688 var normalize_form_default = normalizeForm;
28689
28690 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
28691 var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1);
28692 function Header3({ title }) {
28693 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28694 Stack,
28695 {
28696 direction: "column",
28697 className: "dataforms-layouts-regular__header",
28698 gap: "lg",
28699 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components45.__experimentalHeading, { level: 2, size: 13, children: title }) })
28700 }
28701 );
28702 }
28703 function FormRegularField({
28704 data,
28705 field,
28706 onChange,
28707 hideLabelFromVision,
28708 markWhenOptional,
28709 validity
28710 }) {
28711 const { fields } = (0, import_element98.useContext)(dataform_context_default);
28712 const layout = field.layout;
28713 const form = (0, import_element98.useMemo)(
28714 () => ({
28715 layout: DEFAULT_LAYOUT,
28716 fields: !!field.children ? field.children : []
28717 }),
28718 [field]
28719 );
28720 if (!!field.children) {
28721 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
28722 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Header3, { title: field.label }),
28723 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28724 DataFormLayout,
28725 {
28726 data,
28727 form,
28728 onChange,
28729 validity: validity?.children
28730 }
28731 )
28732 ] });
28733 }
28734 const labelPosition = layout.labelPosition;
28735 const fieldDefinition = fields.find(
28736 (fieldDef) => fieldDef.id === field.id
28737 );
28738 if (!fieldDefinition || !fieldDefinition.Edit) {
28739 return null;
28740 }
28741 if (labelPosition === "side") {
28742 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
28743 Stack,
28744 {
28745 direction: "row",
28746 className: "dataforms-layouts-regular__field",
28747 gap: "sm",
28748 children: [
28749 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28750 "div",
28751 {
28752 className: clsx_default(
28753 "dataforms-layouts-regular__field-label",
28754 `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
28755 ),
28756 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components45.BaseControl.VisualLabel, { children: fieldDefinition.label })
28757 }
28758 ),
28759 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28760 fieldDefinition.render,
28761 {
28762 item: data,
28763 field: fieldDefinition
28764 }
28765 ) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28766 fieldDefinition.Edit,
28767 {
28768 data,
28769 field: fieldDefinition,
28770 onChange,
28771 hideLabelFromVision: true,
28772 markWhenOptional,
28773 validity
28774 },
28775 fieldDefinition.id
28776 ) })
28777 ]
28778 }
28779 );
28780 }
28781 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_jsx_runtime136.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
28782 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components45.BaseControl.VisualLabel, { children: fieldDefinition.label }),
28783 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28784 fieldDefinition.render,
28785 {
28786 item: data,
28787 field: fieldDefinition
28788 }
28789 )
28790 ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
28791 fieldDefinition.Edit,
28792 {
28793 data,
28794 field: fieldDefinition,
28795 onChange,
28796 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
28797 markWhenOptional,
28798 validity
28799 }
28800 ) });
28801 }
28802
28803 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
28804 var import_deepmerge2 = __toESM(require_cjs(), 1);
28805 var import_components48 = __toESM(require_components(), 1);
28806 var import_element103 = __toESM(require_element(), 1);
28807 var import_compose14 = __toESM(require_compose(), 1);
28808
28809 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
28810 var import_components47 = __toESM(require_components(), 1);
28811 var import_i18n46 = __toESM(require_i18n(), 1);
28812 var import_compose13 = __toESM(require_compose(), 1);
28813 var import_element99 = __toESM(require_element(), 1);
28814
28815 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs
28816 function getLabelClassName(labelPosition, showError) {
28817 return clsx_default(
28818 "dataforms-layouts-panel__field-label",
28819 `dataforms-layouts-panel__field-label--label-position-${labelPosition}`,
28820 { "has-error": showError }
28821 );
28822 }
28823 var get_label_classname_default = getLabelClassName;
28824
28825 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs
28826 var import_components46 = __toESM(require_components(), 1);
28827 var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1);
28828 function getLabelContent(showError, errorMessage, fieldLabel) {
28829 return showError ? /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(tooltip_exports.Root, { children: [
28830 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
28831 tooltip_exports.Trigger,
28832 {
28833 render: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [
28834 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components46.Icon, { icon: error_default, size: 16 }),
28835 /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(VisuallyHidden, { children: [
28836 errorMessage,
28837 ": "
28838 ] }),
28839 fieldLabel
28840 ] })
28841 }
28842 ),
28843 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(tooltip_exports.Popup, { children: errorMessage })
28844 ] }) : fieldLabel;
28845 }
28846 var get_label_content_default = getLabelContent;
28847
28848 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs
28849 function getFirstValidationError(validity) {
28850 if (!validity) {
28851 return void 0;
28852 }
28853 const validityRules = Object.keys(validity).filter(
28854 (key) => key !== "children"
28855 );
28856 for (const key of validityRules) {
28857 const rule = validity[key];
28858 if (rule === void 0) {
28859 continue;
28860 }
28861 if (rule.type === "invalid") {
28862 if (rule.message) {
28863 return rule.message;
28864 }
28865 if (key === "required") {
28866 return "A required field is empty";
28867 }
28868 return "Unidentified validation error";
28869 }
28870 }
28871 if (validity.children) {
28872 for (const childValidity of Object.values(validity.children)) {
28873 const childError = getFirstValidationError(childValidity);
28874 if (childError) {
28875 return childError;
28876 }
28877 }
28878 }
28879 return void 0;
28880 }
28881 var get_first_validation_error_default = getFirstValidationError;
28882
28883 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
28884 var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1);
28885 function SummaryButton({
28886 data,
28887 field,
28888 fieldLabel,
28889 summaryFields,
28890 validity,
28891 touched,
28892 disabled: disabled2,
28893 onClick,
28894 "aria-expanded": ariaExpanded
28895 }) {
28896 const { labelPosition, editVisibility } = field.layout;
28897 const errorMessage = get_first_validation_error_default(validity);
28898 const showError = touched && !!errorMessage;
28899 const labelClassName = get_label_classname_default(labelPosition, showError);
28900 const labelContent = get_label_content_default(showError, errorMessage, fieldLabel);
28901 const className = clsx_default(
28902 "dataforms-layouts-panel__field-trigger",
28903 `dataforms-layouts-panel__field-trigger--label-${labelPosition}`,
28904 {
28905 "is-disabled": disabled2,
28906 "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always"
28907 }
28908 );
28909 const controlId = (0, import_compose13.useInstanceId)(
28910 SummaryButton,
28911 "dataforms-layouts-panel__field-control"
28912 );
28913 const ariaLabel = showError ? (0, import_i18n46.sprintf)(
28914 // translators: %s: Field name.
28915 (0, import_i18n46._x)("Edit %s (has errors)", "field"),
28916 fieldLabel || ""
28917 ) : (0, import_i18n46.sprintf)(
28918 // translators: %s: Field name.
28919 (0, import_i18n46._x)("Edit %s", "field"),
28920 fieldLabel || ""
28921 );
28922 const rowRef = (0, import_element99.useRef)(null);
28923 const handleRowClick = () => {
28924 const selection = rowRef.current?.ownerDocument.defaultView?.getSelection();
28925 if (selection && selection.toString().length > 0) {
28926 return;
28927 }
28928 onClick();
28929 };
28930 const handleKeyDown = (event) => {
28931 if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
28932 event.preventDefault();
28933 onClick();
28934 }
28935 };
28936 return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
28937 "div",
28938 {
28939 ref: rowRef,
28940 className,
28941 onClick: !disabled2 ? handleRowClick : void 0,
28942 onKeyDown: !disabled2 ? handleKeyDown : void 0,
28943 children: [
28944 labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("span", { className: labelClassName, children: labelContent }),
28945 labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(tooltip_exports.Root, { children: [
28946 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28947 tooltip_exports.Trigger,
28948 {
28949 render: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28950 "span",
28951 {
28952 className: "dataforms-layouts-panel__field-label-error-content",
28953 role: "img",
28954 "aria-label": errorMessage,
28955 children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_components47.Icon, { icon: error_default, size: 16 })
28956 }
28957 )
28958 }
28959 ),
28960 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(tooltip_exports.Popup, { children: errorMessage })
28961 ] }),
28962 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28963 "span",
28964 {
28965 id: `${controlId}`,
28966 className: "dataforms-layouts-panel__field-control",
28967 children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28968 "span",
28969 {
28970 style: {
28971 display: "flex",
28972 flexDirection: "column",
28973 alignItems: "flex-start",
28974 width: "100%",
28975 gap: "2px"
28976 },
28977 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28978 "span",
28979 {
28980 style: { width: "100%" },
28981 children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28982 summaryField.render,
28983 {
28984 item: data,
28985 field: summaryField
28986 }
28987 )
28988 },
28989 summaryField.id
28990 ))
28991 }
28992 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
28993 summaryField.render,
28994 {
28995 item: data,
28996 field: summaryField
28997 },
28998 summaryField.id
28999 ))
29000 }
29001 ),
29002 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
29003 import_components47.Button,
29004 {
29005 className: "dataforms-layouts-panel__field-trigger-icon",
29006 label: ariaLabel,
29007 icon: pencil_default,
29008 size: "small",
29009 "aria-expanded": ariaExpanded,
29010 "aria-haspopup": "dialog",
29011 "aria-describedby": `${controlId}`
29012 }
29013 )
29014 ]
29015 }
29016 );
29017 }
29018
29019 // packages/dataviews/build-module/hooks/use-form-validity.mjs
29020 var import_deepmerge = __toESM(require_cjs(), 1);
29021 var import_es62 = __toESM(require_es6(), 1);
29022 var import_element100 = __toESM(require_element(), 1);
29023 var import_i18n47 = __toESM(require_i18n(), 1);
29024 function isFormValid(formValidity) {
29025 if (!formValidity) {
29026 return true;
29027 }
29028 return Object.values(formValidity).every((fieldValidation) => {
29029 return Object.entries(fieldValidation).every(
29030 ([key, validation]) => {
29031 if (key === "children" && validation && typeof validation === "object") {
29032 return isFormValid(validation);
29033 }
29034 return validation.type !== "invalid" && validation.type !== "validating";
29035 }
29036 );
29037 });
29038 }
29039 function getFormFieldsToValidate(form, fields) {
29040 const normalizedForm = normalize_form_default(form);
29041 if (normalizedForm.fields.length === 0) {
29042 return [];
29043 }
29044 const fieldsMap = /* @__PURE__ */ new Map();
29045 fields.forEach((field) => {
29046 fieldsMap.set(field.id, field);
29047 });
29048 function processFormField(formField) {
29049 if ("children" in formField && Array.isArray(formField.children)) {
29050 const processedChildren = formField.children.map(processFormField).filter((child) => child !== null);
29051 if (processedChildren.length === 0) {
29052 return null;
29053 }
29054 const fieldDef2 = fieldsMap.get(formField.id);
29055 if (fieldDef2) {
29056 const [normalizedField2] = normalizeFields([
29057 fieldDef2
29058 ]);
29059 return {
29060 id: formField.id,
29061 children: processedChildren,
29062 field: normalizedField2
29063 };
29064 }
29065 return {
29066 id: formField.id,
29067 children: processedChildren
29068 };
29069 }
29070 const fieldDef = fieldsMap.get(formField.id);
29071 if (!fieldDef) {
29072 return null;
29073 }
29074 const [normalizedField] = normalizeFields([fieldDef]);
29075 return {
29076 id: formField.id,
29077 children: [],
29078 field: normalizedField
29079 };
29080 }
29081 const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null);
29082 return toValidate;
29083 }
29084 function setValidityAtPath(formValidity, fieldValidity, path) {
29085 if (!formValidity) {
29086 formValidity = {};
29087 }
29088 if (path.length === 0) {
29089 return formValidity;
29090 }
29091 const result = { ...formValidity };
29092 let current = result;
29093 for (let i2 = 0; i2 < path.length - 1; i2++) {
29094 const segment = path[i2];
29095 if (!current[segment]) {
29096 current[segment] = {};
29097 }
29098 current[segment] = { ...current[segment] };
29099 current = current[segment];
29100 }
29101 const finalKey = path[path.length - 1];
29102 current[finalKey] = {
29103 ...current[finalKey] || {},
29104 ...fieldValidity
29105 };
29106 return result;
29107 }
29108 function removeValidationProperty(formValidity, path, property) {
29109 if (!formValidity || path.length === 0) {
29110 return formValidity;
29111 }
29112 const result = { ...formValidity };
29113 let current = result;
29114 for (let i2 = 0; i2 < path.length - 1; i2++) {
29115 const segment = path[i2];
29116 if (!current[segment]) {
29117 return formValidity;
29118 }
29119 current[segment] = { ...current[segment] };
29120 current = current[segment];
29121 }
29122 const finalKey = path[path.length - 1];
29123 if (!current[finalKey]) {
29124 return formValidity;
29125 }
29126 const fieldValidity = { ...current[finalKey] };
29127 delete fieldValidity[property];
29128 if (Object.keys(fieldValidity).length === 0) {
29129 delete current[finalKey];
29130 } else {
29131 current[finalKey] = fieldValidity;
29132 }
29133 if (Object.keys(result).length === 0) {
29134 return void 0;
29135 }
29136 return result;
29137 }
29138 function handleElementsValidationAsync(promise, formField, promiseHandler) {
29139 const { elementsCounterRef, setFormValidity, path, item } = promiseHandler;
29140 const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1;
29141 elementsCounterRef.current[formField.id] = currentToken;
29142 promise.then((result) => {
29143 if (currentToken !== elementsCounterRef.current[formField.id]) {
29144 return;
29145 }
29146 if (!Array.isArray(result)) {
29147 setFormValidity((prev) => {
29148 const newFormValidity = setValidityAtPath(
29149 prev,
29150 {
29151 elements: {
29152 type: "invalid",
29153 message: (0, import_i18n47.__)("Could not validate elements.")
29154 }
29155 },
29156 [...path, formField.id]
29157 );
29158 return newFormValidity;
29159 });
29160 return;
29161 }
29162 if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, {
29163 ...formField.field,
29164 elements: result
29165 })) {
29166 setFormValidity((prev) => {
29167 const newFormValidity = setValidityAtPath(
29168 prev,
29169 {
29170 elements: {
29171 type: "invalid",
29172 message: (0, import_i18n47.__)(
29173 "Value must be one of the elements."
29174 )
29175 }
29176 },
29177 [...path, formField.id]
29178 );
29179 return newFormValidity;
29180 });
29181 } else {
29182 setFormValidity((prev) => {
29183 return removeValidationProperty(
29184 prev,
29185 [...path, formField.id],
29186 "elements"
29187 );
29188 });
29189 }
29190 }).catch((error2) => {
29191 if (currentToken !== elementsCounterRef.current[formField.id]) {
29192 return;
29193 }
29194 let errorMessage;
29195 if (error2 instanceof Error) {
29196 errorMessage = error2.message;
29197 } else {
29198 errorMessage = String(error2) || (0, import_i18n47.__)(
29199 "Unknown error when running elements validation asynchronously."
29200 );
29201 }
29202 setFormValidity((prev) => {
29203 const newFormValidity = setValidityAtPath(
29204 prev,
29205 {
29206 elements: {
29207 type: "invalid",
29208 message: errorMessage
29209 }
29210 },
29211 [...path, formField.id]
29212 );
29213 return newFormValidity;
29214 });
29215 });
29216 }
29217 function handleCustomValidationAsync(promise, formField, promiseHandler) {
29218 const { customCounterRef, setFormValidity, path } = promiseHandler;
29219 const currentToken = (customCounterRef.current[formField.id] || 0) + 1;
29220 customCounterRef.current[formField.id] = currentToken;
29221 promise.then((result) => {
29222 if (currentToken !== customCounterRef.current[formField.id]) {
29223 return;
29224 }
29225 if (result === null) {
29226 setFormValidity((prev) => {
29227 return removeValidationProperty(
29228 prev,
29229 [...path, formField.id],
29230 "custom"
29231 );
29232 });
29233 return;
29234 }
29235 if (typeof result === "string") {
29236 setFormValidity((prev) => {
29237 const newFormValidity = setValidityAtPath(
29238 prev,
29239 {
29240 custom: {
29241 type: "invalid",
29242 message: result
29243 }
29244 },
29245 [...path, formField.id]
29246 );
29247 return newFormValidity;
29248 });
29249 return;
29250 }
29251 setFormValidity((prev) => {
29252 const newFormValidity = setValidityAtPath(
29253 prev,
29254 {
29255 custom: {
29256 type: "invalid",
29257 message: (0, import_i18n47.__)("Validation could not be processed.")
29258 }
29259 },
29260 [...path, formField.id]
29261 );
29262 return newFormValidity;
29263 });
29264 }).catch((error2) => {
29265 if (currentToken !== customCounterRef.current[formField.id]) {
29266 return;
29267 }
29268 let errorMessage;
29269 if (error2 instanceof Error) {
29270 errorMessage = error2.message;
29271 } else {
29272 errorMessage = String(error2) || (0, import_i18n47.__)(
29273 "Unknown error when running custom validation asynchronously."
29274 );
29275 }
29276 setFormValidity((prev) => {
29277 const newFormValidity = setValidityAtPath(
29278 prev,
29279 {
29280 custom: {
29281 type: "invalid",
29282 message: errorMessage
29283 }
29284 },
29285 [...path, formField.id]
29286 );
29287 return newFormValidity;
29288 });
29289 });
29290 }
29291 function validateFormField(item, formField, promiseHandler) {
29292 if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) {
29293 return {
29294 required: { type: "invalid" }
29295 };
29296 }
29297 if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) {
29298 return {
29299 pattern: {
29300 type: "invalid",
29301 message: (0, import_i18n47.__)("Value does not match the required pattern.")
29302 }
29303 };
29304 }
29305 if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) {
29306 return {
29307 min: {
29308 type: "invalid",
29309 message: (0, import_i18n47.__)("Value is below the minimum.")
29310 }
29311 };
29312 }
29313 if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) {
29314 return {
29315 max: {
29316 type: "invalid",
29317 message: (0, import_i18n47.__)("Value is above the maximum.")
29318 }
29319 };
29320 }
29321 if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) {
29322 return {
29323 minLength: {
29324 type: "invalid",
29325 message: (0, import_i18n47.__)("Value is too short.")
29326 }
29327 };
29328 }
29329 if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) {
29330 return {
29331 maxLength: {
29332 type: "invalid",
29333 message: (0, import_i18n47.__)("Value is too long.")
29334 }
29335 };
29336 }
29337 if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) {
29338 return {
29339 elements: {
29340 type: "invalid",
29341 message: (0, import_i18n47.__)("Value must be one of the elements.")
29342 }
29343 };
29344 }
29345 let customError;
29346 if (!!formField.field && formField.field.isValid.custom) {
29347 try {
29348 const value = formField.field.getValue({ item });
29349 customError = formField.field.isValid.custom(
29350 (0, import_deepmerge.default)(
29351 item,
29352 formField.field.setValue({
29353 item,
29354 value
29355 })
29356 ),
29357 formField.field
29358 );
29359 } catch (error2) {
29360 let errorMessage;
29361 if (error2 instanceof Error) {
29362 errorMessage = error2.message;
29363 } else {
29364 errorMessage = String(error2) || (0, import_i18n47.__)("Unknown error when running custom validation.");
29365 }
29366 return {
29367 custom: {
29368 type: "invalid",
29369 message: errorMessage
29370 }
29371 };
29372 }
29373 }
29374 if (typeof customError === "string") {
29375 return {
29376 custom: {
29377 type: "invalid",
29378 message: customError
29379 }
29380 };
29381 }
29382 const fieldValidity = {};
29383 if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") {
29384 handleElementsValidationAsync(
29385 formField.field.getElements(),
29386 formField,
29387 promiseHandler
29388 );
29389 fieldValidity.elements = {
29390 type: "validating",
29391 message: (0, import_i18n47.__)("Validating\u2026")
29392 };
29393 }
29394 if (customError instanceof Promise) {
29395 handleCustomValidationAsync(customError, formField, promiseHandler);
29396 fieldValidity.custom = {
29397 type: "validating",
29398 message: (0, import_i18n47.__)("Validating\u2026")
29399 };
29400 }
29401 if (Object.keys(fieldValidity).length > 0) {
29402 return fieldValidity;
29403 }
29404 if (formField.children.length > 0) {
29405 const result = {};
29406 formField.children.forEach((child) => {
29407 result[child.id] = validateFormField(item, child, {
29408 ...promiseHandler,
29409 path: [...promiseHandler.path, formField.id, "children"]
29410 });
29411 });
29412 const filteredResult = {};
29413 Object.entries(result).forEach(([key, value]) => {
29414 if (value !== void 0) {
29415 filteredResult[key] = value;
29416 }
29417 });
29418 if (Object.keys(filteredResult).length === 0) {
29419 return void 0;
29420 }
29421 return {
29422 children: filteredResult
29423 };
29424 }
29425 return void 0;
29426 }
29427 function getFormFieldValue(formField, item) {
29428 const fieldValue = formField?.field?.getValue({ item });
29429 if (formField.children.length === 0) {
29430 return fieldValue;
29431 }
29432 const childrenValues = formField.children.map(
29433 (child) => getFormFieldValue(child, item)
29434 );
29435 if (!childrenValues) {
29436 return fieldValue;
29437 }
29438 return {
29439 value: fieldValue,
29440 children: childrenValues
29441 };
29442 }
29443 function useFormValidity(item, fields, form) {
29444 const [formValidity, setFormValidity] = (0, import_element100.useState)();
29445 const customCounterRef = (0, import_element100.useRef)({});
29446 const elementsCounterRef = (0, import_element100.useRef)({});
29447 const previousValuesRef = (0, import_element100.useRef)({});
29448 const validate = (0, import_element100.useCallback)(() => {
29449 const promiseHandler = {
29450 customCounterRef,
29451 elementsCounterRef,
29452 setFormValidity,
29453 path: [],
29454 item
29455 };
29456 const formFieldsToValidate = getFormFieldsToValidate(form, fields);
29457 if (formFieldsToValidate.length === 0) {
29458 setFormValidity(void 0);
29459 return;
29460 }
29461 const newFormValidity = {};
29462 const untouchedFields = [];
29463 formFieldsToValidate.forEach((formField) => {
29464 const value = getFormFieldValue(formField, item);
29465 if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es62.default)(
29466 previousValuesRef.current[formField.id],
29467 value
29468 )) {
29469 untouchedFields.push(formField.id);
29470 return;
29471 }
29472 previousValuesRef.current[formField.id] = value;
29473 const fieldValidity = validateFormField(
29474 item,
29475 formField,
29476 promiseHandler
29477 );
29478 if (fieldValidity !== void 0) {
29479 newFormValidity[formField.id] = fieldValidity;
29480 }
29481 });
29482 setFormValidity((existingFormValidity) => {
29483 let validity = {
29484 ...existingFormValidity,
29485 ...newFormValidity
29486 };
29487 const fieldsToKeep = [
29488 ...untouchedFields,
29489 ...Object.keys(newFormValidity)
29490 ];
29491 Object.keys(validity).forEach((key) => {
29492 if (validity && !fieldsToKeep.includes(key)) {
29493 delete validity[key];
29494 }
29495 });
29496 if (Object.keys(validity).length === 0) {
29497 validity = void 0;
29498 }
29499 const areEqual = (0, import_es62.default)(existingFormValidity, validity);
29500 if (areEqual) {
29501 return existingFormValidity;
29502 }
29503 return validity;
29504 });
29505 }, [item, fields, form]);
29506 (0, import_element100.useEffect)(() => {
29507 validate();
29508 }, [validate]);
29509 return {
29510 validity: formValidity,
29511 isValid: isFormValid(formValidity)
29512 };
29513 }
29514 var use_form_validity_default = useFormValidity;
29515
29516 // packages/dataviews/build-module/hooks/use-report-validity.mjs
29517 var import_element101 = __toESM(require_element(), 1);
29518 function useReportValidity(ref, shouldReport) {
29519 (0, import_element101.useEffect)(() => {
29520 if (shouldReport && ref.current) {
29521 const inputs = ref.current.querySelectorAll(
29522 "input, textarea, select"
29523 );
29524 inputs.forEach((input) => {
29525 input.reportValidity();
29526 });
29527 }
29528 }, [shouldReport, ref]);
29529 }
29530
29531 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
29532 var import_element102 = __toESM(require_element(), 1);
29533
29534 // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs
29535 function extractSummaryIds(summary) {
29536 if (Array.isArray(summary)) {
29537 return summary.map(
29538 (item) => typeof item === "string" ? item : item.id
29539 );
29540 }
29541 return [];
29542 }
29543 var getSummaryFields = (summaryField, fields) => {
29544 if (Array.isArray(summaryField) && summaryField.length > 0) {
29545 const summaryIds = extractSummaryIds(summaryField);
29546 return summaryIds.map(
29547 (summaryId) => fields.find((_field) => _field.id === summaryId)
29548 ).filter((_field) => _field !== void 0);
29549 }
29550 return [];
29551 };
29552
29553 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
29554 var getFieldDefinition = (field, fields) => {
29555 const fieldDefinition = fields.find((_field) => _field.id === field.id);
29556 if (!fieldDefinition) {
29557 return fields.find((_field) => {
29558 if (!!field.children) {
29559 const simpleChildren = field.children.filter(
29560 (child) => !child.children
29561 );
29562 if (simpleChildren.length === 0) {
29563 return false;
29564 }
29565 return _field.id === simpleChildren[0].id;
29566 }
29567 return _field.id === field.id;
29568 });
29569 }
29570 return fieldDefinition;
29571 };
29572 function useFieldFromFormField(field) {
29573 const { fields } = (0, import_element102.useContext)(dataform_context_default);
29574 const layout = field.layout;
29575 const summaryFields = getSummaryFields(layout.summary, fields);
29576 const fieldDefinition = getFieldDefinition(field, fields);
29577 const fieldLabel = !!field.children ? field.label : fieldDefinition?.label;
29578 if (summaryFields.length === 0) {
29579 return {
29580 summaryFields: fieldDefinition ? [fieldDefinition] : [],
29581 fieldDefinition,
29582 fieldLabel
29583 };
29584 }
29585 return {
29586 summaryFields,
29587 fieldDefinition,
29588 fieldLabel
29589 };
29590 }
29591 var use_field_from_form_field_default = useFieldFromFormField;
29592
29593 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
29594 var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1);
29595 function ModalContent({
29596 data,
29597 field,
29598 onChange,
29599 fieldLabel,
29600 onClose,
29601 touched
29602 }) {
29603 const { openAs } = field.layout;
29604 const { applyLabel, cancelLabel } = openAs;
29605 const { fields } = (0, import_element103.useContext)(dataform_context_default);
29606 const [changes, setChanges] = (0, import_element103.useState)({});
29607 const modalData = (0, import_element103.useMemo)(() => {
29608 return (0, import_deepmerge2.default)(data, changes, {
29609 arrayMerge: (target, source) => source
29610 });
29611 }, [data, changes]);
29612 const form = (0, import_element103.useMemo)(
29613 () => ({
29614 layout: DEFAULT_LAYOUT,
29615 fields: !!field.children ? field.children : (
29616 // If not explicit children return the field id itself.
29617 [{ id: field.id, layout: DEFAULT_LAYOUT }]
29618 )
29619 }),
29620 [field]
29621 );
29622 const fieldsAsFieldType = fields.map((f2) => ({
29623 ...f2,
29624 Edit: f2.Edit === null ? void 0 : f2.Edit,
29625 isValid: {
29626 required: f2.isValid.required?.constraint,
29627 elements: f2.isValid.elements?.constraint,
29628 min: f2.isValid.min?.constraint,
29629 max: f2.isValid.max?.constraint,
29630 pattern: f2.isValid.pattern?.constraint,
29631 minLength: f2.isValid.minLength?.constraint,
29632 maxLength: f2.isValid.maxLength?.constraint
29633 }
29634 }));
29635 const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form);
29636 const onApply = () => {
29637 onChange(changes);
29638 onClose();
29639 };
29640 const handleOnChange = (newValue) => {
29641 setChanges(
29642 (prev) => (0, import_deepmerge2.default)(prev, newValue, {
29643 arrayMerge: (target, source) => source
29644 })
29645 );
29646 };
29647 const focusOnMountRef = (0, import_compose14.useFocusOnMount)("firstInputElement");
29648 const contentRef = (0, import_element103.useRef)(null);
29649 const mergedRef = (0, import_compose14.useMergeRefs)([focusOnMountRef, contentRef]);
29650 useReportValidity(contentRef, touched);
29651 return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
29652 import_components48.Modal,
29653 {
29654 className: "dataforms-layouts-panel__modal",
29655 onRequestClose: onClose,
29656 isFullScreen: false,
29657 title: fieldLabel,
29658 size: "medium",
29659 children: [
29660 /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
29661 DataFormLayout,
29662 {
29663 data: modalData,
29664 form,
29665 onChange: handleOnChange,
29666 validity,
29667 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
29668 FieldLayout,
29669 {
29670 data: modalData,
29671 field: childField,
29672 onChange: handleOnChange,
29673 hideLabelFromVision: form.fields.length < 2,
29674 markWhenOptional,
29675 validity: childFieldValidity
29676 },
29677 childField.id
29678 )
29679 }
29680 ) }),
29681 /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
29682 Stack,
29683 {
29684 direction: "row",
29685 className: "dataforms-layouts-panel__modal-footer",
29686 gap: "md",
29687 children: [
29688 /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_components48.__experimentalSpacer, { style: { flex: 1 } }),
29689 /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
29690 import_components48.Button,
29691 {
29692 variant: "tertiary",
29693 onClick: onClose,
29694 __next40pxDefaultSize: true,
29695 children: cancelLabel
29696 }
29697 ),
29698 /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
29699 import_components48.Button,
29700 {
29701 variant: "primary",
29702 onClick: onApply,
29703 __next40pxDefaultSize: true,
29704 children: applyLabel
29705 }
29706 )
29707 ]
29708 }
29709 )
29710 ]
29711 }
29712 );
29713 }
29714 function PanelModal({
29715 data,
29716 field,
29717 onChange,
29718 validity
29719 }) {
29720 const [touched, setTouched] = (0, import_element103.useState)(false);
29721 const [isOpen, setIsOpen] = (0, import_element103.useState)(false);
29722 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
29723 if (!fieldDefinition) {
29724 return null;
29725 }
29726 const handleClose = () => {
29727 setIsOpen(false);
29728 setTouched(true);
29729 };
29730 return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(import_jsx_runtime139.Fragment, { children: [
29731 /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
29732 SummaryButton,
29733 {
29734 data,
29735 field,
29736 fieldLabel,
29737 summaryFields,
29738 validity,
29739 touched,
29740 disabled: fieldDefinition.readOnly === true,
29741 onClick: () => setIsOpen(true),
29742 "aria-expanded": isOpen
29743 }
29744 ),
29745 isOpen && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
29746 ModalContent,
29747 {
29748 data,
29749 field,
29750 onChange,
29751 fieldLabel: fieldLabel ?? "",
29752 onClose: handleClose,
29753 touched
29754 }
29755 )
29756 ] });
29757 }
29758 var modal_default = PanelModal;
29759
29760 // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs
29761 var import_components49 = __toESM(require_components(), 1);
29762 var import_i18n48 = __toESM(require_i18n(), 1);
29763 var import_element104 = __toESM(require_element(), 1);
29764 var import_compose15 = __toESM(require_compose(), 1);
29765 var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1);
29766 function DropdownHeader({
29767 title,
29768 onClose
29769 }) {
29770 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29771 Stack,
29772 {
29773 direction: "column",
29774 className: "dataforms-layouts-panel__dropdown-header",
29775 gap: "lg",
29776 children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [
29777 title && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components49.__experimentalHeading, { level: 2, size: 13, children: title }),
29778 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_components49.__experimentalSpacer, { style: { flex: 1 } }),
29779 onClose && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29780 import_components49.Button,
29781 {
29782 label: (0, import_i18n48.__)("Close"),
29783 icon: close_small_default,
29784 onClick: onClose,
29785 size: "small"
29786 }
29787 )
29788 ] })
29789 }
29790 );
29791 }
29792 function DropdownContentWithValidation({
29793 touched,
29794 children
29795 }) {
29796 const ref = (0, import_element104.useRef)(null);
29797 useReportValidity(ref, touched);
29798 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { ref, children });
29799 }
29800 function PanelDropdown({
29801 data,
29802 field,
29803 onChange,
29804 validity
29805 }) {
29806 const [touched, setTouched] = (0, import_element104.useState)(false);
29807 const [popoverAnchor, setPopoverAnchor] = (0, import_element104.useState)(
29808 null
29809 );
29810 const popoverProps = (0, import_element104.useMemo)(
29811 () => ({
29812 // Anchor the popover to the middle of the entire row so that it doesn't
29813 // move around when the label changes.
29814 anchor: popoverAnchor,
29815 placement: "left-start",
29816 offset: 36,
29817 shift: true
29818 }),
29819 [popoverAnchor]
29820 );
29821 const [dialogRef, dialogProps] = (0, import_compose15.__experimentalUseDialog)({
29822 focusOnMount: "firstInputElement"
29823 });
29824 const form = (0, import_element104.useMemo)(
29825 () => ({
29826 layout: DEFAULT_LAYOUT,
29827 fields: !!field.children ? field.children : (
29828 // If not explicit children return the field id itself.
29829 [{ id: field.id, layout: DEFAULT_LAYOUT }]
29830 )
29831 }),
29832 [field]
29833 );
29834 const formValidity = (0, import_element104.useMemo)(() => {
29835 if (validity === void 0) {
29836 return void 0;
29837 }
29838 if (!!field.children) {
29839 return validity?.children;
29840 }
29841 return { [field.id]: validity };
29842 }, [validity, field]);
29843 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
29844 if (!fieldDefinition) {
29845 return null;
29846 }
29847 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29848 "div",
29849 {
29850 ref: setPopoverAnchor,
29851 className: "dataforms-layouts-panel__field-dropdown-anchor",
29852 children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29853 import_components49.Dropdown,
29854 {
29855 contentClassName: "dataforms-layouts-panel__field-dropdown",
29856 popoverProps,
29857 focusOnMount: false,
29858 onToggle: (willOpen) => {
29859 if (!willOpen) {
29860 setTouched(true);
29861 }
29862 },
29863 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29864 SummaryButton,
29865 {
29866 data,
29867 field,
29868 fieldLabel,
29869 summaryFields,
29870 validity,
29871 touched,
29872 disabled: fieldDefinition.readOnly === true,
29873 onClick: onToggle,
29874 "aria-expanded": isOpen
29875 }
29876 ),
29877 renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [
29878 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29879 DropdownHeader,
29880 {
29881 title: fieldLabel,
29882 onClose
29883 }
29884 ),
29885 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29886 DataFormLayout,
29887 {
29888 data,
29889 form,
29890 onChange,
29891 validity: formValidity,
29892 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
29893 FieldLayout,
29894 {
29895 data,
29896 field: childField,
29897 onChange,
29898 hideLabelFromVision: (form?.fields ?? []).length < 2,
29899 markWhenOptional,
29900 validity: childFieldValidity
29901 },
29902 childField.id
29903 )
29904 }
29905 )
29906 ] }) })
29907 }
29908 )
29909 }
29910 );
29911 }
29912 var dropdown_default = PanelDropdown;
29913
29914 // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs
29915 var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
29916 function FormPanelField({
29917 data,
29918 field,
29919 onChange,
29920 validity
29921 }) {
29922 const layout = field.layout;
29923 if (layout.openAs.type === "modal") {
29924 return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
29925 modal_default,
29926 {
29927 data,
29928 field,
29929 onChange,
29930 validity
29931 }
29932 );
29933 }
29934 return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
29935 dropdown_default,
29936 {
29937 data,
29938 field,
29939 onChange,
29940 validity
29941 }
29942 );
29943 }
29944
29945 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
29946 var import_element105 = __toESM(require_element(), 1);
29947
29948 // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs
29949 var import_i18n49 = __toESM(require_i18n(), 1);
29950 var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1);
29951 function countInvalidFields(validity) {
29952 if (!validity) {
29953 return 0;
29954 }
29955 let count = 0;
29956 const validityRules = Object.keys(validity).filter(
29957 (key) => key !== "children"
29958 );
29959 for (const key of validityRules) {
29960 const rule = validity[key];
29961 if (rule?.type === "invalid") {
29962 count++;
29963 }
29964 }
29965 if (validity.children) {
29966 for (const childValidity of Object.values(validity.children)) {
29967 count += countInvalidFields(childValidity);
29968 }
29969 }
29970 return count;
29971 }
29972 function ValidationBadge({
29973 validity
29974 }) {
29975 const invalidCount = countInvalidFields(validity);
29976 if (invalidCount === 0) {
29977 return null;
29978 }
29979 return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Badge, { intent: "high", children: (0, import_i18n49.sprintf)(
29980 /* translators: %d: Number of fields that need attention */
29981 (0, import_i18n49._n)(
29982 "%d field needs attention",
29983 "%d fields need attention",
29984 invalidCount
29985 ),
29986 invalidCount
29987 ) });
29988 }
29989
29990 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
29991 var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1);
29992 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
29993 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
29994 return false;
29995 }
29996 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
29997 const fieldConfig = summaryConfigArray.find((config) => {
29998 if (typeof config === "string") {
29999 return config === summaryField.id;
30000 }
30001 if (typeof config === "object" && "id" in config) {
30002 return config.id === summaryField.id;
30003 }
30004 return false;
30005 });
30006 if (!fieldConfig) {
30007 return false;
30008 }
30009 if (typeof fieldConfig === "string") {
30010 return true;
30011 }
30012 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
30013 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen;
30014 }
30015 return true;
30016 }
30017 function HeaderContent({
30018 data,
30019 fields,
30020 label,
30021 layout,
30022 isOpen,
30023 touched,
30024 validity
30025 }) {
30026 const summaryFields = getSummaryFields(layout.summary, fields);
30027 const visibleSummaryFields = summaryFields.filter(
30028 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
30029 );
30030 const hasBadge = touched && layout.isCollapsible;
30031 const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader;
30032 return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
30033 Stack,
30034 {
30035 align: "center",
30036 justify: "space-between",
30037 className: "dataforms-layouts-card__field-header-content",
30038 children: [
30039 /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(card_exports.Title, { children: label }),
30040 (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [
30041 hasBadge && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(ValidationBadge, { validity }),
30042 hasSummary && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
30043 summaryField.render,
30044 {
30045 item: data,
30046 field: summaryField
30047 },
30048 summaryField.id
30049 )) })
30050 ] })
30051 ]
30052 }
30053 );
30054 }
30055 function BodyContent({
30056 data,
30057 field,
30058 form,
30059 onChange,
30060 hideLabelFromVision,
30061 markWhenOptional,
30062 validity,
30063 withHeader
30064 }) {
30065 if (field.children) {
30066 return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(import_jsx_runtime143.Fragment, { children: [
30067 field.description && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
30068 /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
30069 DataFormLayout,
30070 {
30071 data,
30072 form,
30073 onChange,
30074 validity: validity?.children
30075 }
30076 )
30077 ] });
30078 }
30079 const SingleFieldLayout = getFormFieldLayout("regular")?.component;
30080 if (!SingleFieldLayout) {
30081 return null;
30082 }
30083 return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
30084 SingleFieldLayout,
30085 {
30086 data,
30087 field,
30088 onChange,
30089 hideLabelFromVision: hideLabelFromVision || withHeader,
30090 markWhenOptional,
30091 validity
30092 }
30093 );
30094 }
30095 function FormCardField({
30096 data,
30097 field,
30098 onChange,
30099 hideLabelFromVision,
30100 markWhenOptional,
30101 validity
30102 }) {
30103 const { fields } = (0, import_element105.useContext)(dataform_context_default);
30104 const layout = field.layout;
30105 const contentRef = (0, import_element105.useRef)(null);
30106 const form = (0, import_element105.useMemo)(
30107 () => ({
30108 layout: DEFAULT_LAYOUT,
30109 fields: field.children ?? []
30110 }),
30111 [field]
30112 );
30113 const { isOpened, isCollapsible } = layout;
30114 const [isOpen, setIsOpen] = (0, import_element105.useState)(isOpened);
30115 const [touched, setTouched] = (0, import_element105.useState)(false);
30116 (0, import_element105.useEffect)(() => {
30117 setIsOpen(isOpened);
30118 }, [isOpened]);
30119 const handleOpenChange = (0, import_element105.useCallback)((open) => {
30120 if (!open) {
30121 setTouched(true);
30122 }
30123 setIsOpen(open);
30124 }, []);
30125 const handleBlur = (0, import_element105.useCallback)(() => {
30126 setTouched(true);
30127 }, []);
30128 useReportValidity(
30129 contentRef,
30130 (isCollapsible ? isOpen : true) && touched
30131 );
30132 let label = field.label;
30133 let withHeader;
30134 if (field.children) {
30135 withHeader = !!label && layout.withHeader;
30136 } else {
30137 const fieldDefinition = fields.find(
30138 (fieldDef) => fieldDef.id === field.id
30139 );
30140 if (!fieldDefinition || !fieldDefinition.Edit) {
30141 return null;
30142 }
30143 label = fieldDefinition.label;
30144 withHeader = !!label && layout.withHeader;
30145 }
30146 const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
30147 BodyContent,
30148 {
30149 data,
30150 field,
30151 form,
30152 onChange,
30153 hideLabelFromVision,
30154 markWhenOptional,
30155 validity,
30156 withHeader
30157 }
30158 );
30159 const headerContent = /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
30160 HeaderContent,
30161 {
30162 data,
30163 fields,
30164 label,
30165 layout,
30166 isOpen: isCollapsible ? !!isOpen : true,
30167 touched,
30168 validity
30169 }
30170 );
30171 if (withHeader && isCollapsible) {
30172 return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
30173 collapsible_card_exports.Root,
30174 {
30175 className: "dataforms-layouts-card__field",
30176 open: isOpen,
30177 onOpenChange: handleOpenChange,
30178 children: [
30179 /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(collapsible_card_exports.Header, { children: headerContent }),
30180 /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
30181 collapsible_card_exports.Content,
30182 {
30183 ref: contentRef,
30184 onBlur: handleBlur,
30185 children: bodyContent
30186 }
30187 )
30188 ]
30189 }
30190 );
30191 }
30192 return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(card_exports.Root, { className: "dataforms-layouts-card__field", children: [
30193 withHeader && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(card_exports.Header, { children: headerContent }),
30194 /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(card_exports.Content, { ref: contentRef, onBlur: handleBlur, children: bodyContent })
30195 ] });
30196 }
30197
30198 // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs
30199 var import_components50 = __toESM(require_components(), 1);
30200 var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1);
30201 function Header4({ title }) {
30202 return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
30203 Stack,
30204 {
30205 direction: "column",
30206 className: "dataforms-layouts-row__header",
30207 gap: "lg",
30208 children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_components50.__experimentalHeading, { level: 2, size: 13, children: title }) })
30209 }
30210 );
30211 }
30212 var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_jsx_runtime144.Fragment, { children });
30213 function FormRowField({
30214 data,
30215 field,
30216 onChange,
30217 hideLabelFromVision,
30218 markWhenOptional,
30219 validity
30220 }) {
30221 const layout = field.layout;
30222 if (!!field.children) {
30223 const form = {
30224 layout: DEFAULT_LAYOUT,
30225 fields: field.children
30226 };
30227 return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
30228 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Header4, { title: field.label }),
30229 /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
30230 DataFormLayout,
30231 {
30232 data,
30233 form,
30234 onChange,
30235 validity: validity?.children,
30236 as: EMPTY_WRAPPER,
30237 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
30238 "div",
30239 {
30240 className: "dataforms-layouts-row__field-control",
30241 style: layout.styles[childField.id],
30242 children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
30243 FieldLayout,
30244 {
30245 data,
30246 field: childField,
30247 onChange,
30248 hideLabelFromVision,
30249 markWhenOptional,
30250 validity: childFieldValidity
30251 }
30252 )
30253 },
30254 childField.id
30255 )
30256 }
30257 ) })
30258 ] });
30259 }
30260 const RegularLayout = getFormFieldLayout("regular")?.component;
30261 if (!RegularLayout) {
30262 return null;
30263 }
30264 return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_jsx_runtime144.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
30265 RegularLayout,
30266 {
30267 data,
30268 field,
30269 onChange,
30270 markWhenOptional,
30271 validity
30272 }
30273 ) }) });
30274 }
30275
30276 // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs
30277 var import_element106 = __toESM(require_element(), 1);
30278 var import_i18n50 = __toESM(require_i18n(), 1);
30279 var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1);
30280 function FormDetailsField({
30281 data,
30282 field,
30283 onChange,
30284 validity
30285 }) {
30286 const { fields } = (0, import_element106.useContext)(dataform_context_default);
30287 const detailsRef = (0, import_element106.useRef)(null);
30288 const contentRef = (0, import_element106.useRef)(null);
30289 const [touched, setTouched] = (0, import_element106.useState)(false);
30290 const [isOpen, setIsOpen] = (0, import_element106.useState)(false);
30291 const form = (0, import_element106.useMemo)(
30292 () => ({
30293 layout: DEFAULT_LAYOUT,
30294 fields: field.children ?? []
30295 }),
30296 [field]
30297 );
30298 (0, import_element106.useEffect)(() => {
30299 const details = detailsRef.current;
30300 if (!details) {
30301 return;
30302 }
30303 const handleToggle = () => {
30304 const nowOpen = details.open;
30305 if (!nowOpen) {
30306 setTouched(true);
30307 }
30308 setIsOpen(nowOpen);
30309 };
30310 details.addEventListener("toggle", handleToggle);
30311 return () => {
30312 details.removeEventListener("toggle", handleToggle);
30313 };
30314 }, []);
30315 useReportValidity(contentRef, isOpen && touched);
30316 const handleBlur = (0, import_element106.useCallback)(() => {
30317 setTouched(true);
30318 }, []);
30319 if (!field.children) {
30320 return null;
30321 }
30322 const summaryFieldId = field.layout.summary ?? "";
30323 const summaryField = summaryFieldId ? fields.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0;
30324 let summaryContent;
30325 if (summaryField && summaryField.render) {
30326 summaryContent = /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(summaryField.render, { item: data, field: summaryField });
30327 } else {
30328 summaryContent = field.label || (0, import_i18n50.__)("More details");
30329 }
30330 return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
30331 "details",
30332 {
30333 ref: detailsRef,
30334 className: "dataforms-layouts-details__details",
30335 children: [
30336 /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
30337 Stack,
30338 {
30339 direction: "row",
30340 align: "center",
30341 gap: "md",
30342 className: "dataforms-layouts-details__summary-content",
30343 children: [
30344 summaryContent,
30345 touched && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(ValidationBadge, { validity })
30346 ]
30347 }
30348 ) }),
30349 /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
30350 "div",
30351 {
30352 ref: contentRef,
30353 className: "dataforms-layouts-details__content",
30354 onBlur: handleBlur,
30355 children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
30356 DataFormLayout,
30357 {
30358 data,
30359 form,
30360 onChange,
30361 validity: validity?.children
30362 }
30363 )
30364 }
30365 )
30366 ]
30367 }
30368 );
30369 }
30370
30371 // packages/dataviews/build-module/components/dataform-layouts/index.mjs
30372 var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1);
30373 var FORM_FIELD_LAYOUTS = [
30374 {
30375 type: "regular",
30376 component: FormRegularField,
30377 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
30378 Stack,
30379 {
30380 direction: "column",
30381 className: "dataforms-layouts__wrapper",
30382 gap: "lg",
30383 children
30384 }
30385 )
30386 },
30387 {
30388 type: "panel",
30389 component: FormPanelField,
30390 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
30391 Stack,
30392 {
30393 direction: "column",
30394 className: "dataforms-layouts__wrapper",
30395 gap: "md",
30396 children
30397 }
30398 )
30399 },
30400 {
30401 type: "card",
30402 component: FormCardField,
30403 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
30404 Stack,
30405 {
30406 direction: "column",
30407 className: "dataforms-layouts__wrapper",
30408 gap: "xl",
30409 children
30410 }
30411 )
30412 },
30413 {
30414 type: "row",
30415 component: FormRowField,
30416 wrapper: ({
30417 children,
30418 layout
30419 }) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
30420 Stack,
30421 {
30422 direction: "column",
30423 className: "dataforms-layouts__wrapper",
30424 gap: "lg",
30425 children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
30426 Stack,
30427 {
30428 direction: "row",
30429 gap: "lg",
30430 align: layout.alignment,
30431 children
30432 }
30433 ) })
30434 }
30435 )
30436 },
30437 {
30438 type: "details",
30439 component: FormDetailsField
30440 }
30441 ];
30442 function getFormFieldLayout(type) {
30443 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
30444 }
30445
30446 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
30447 var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1);
30448 var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children });
30449 function DataFormLayout({
30450 data,
30451 form,
30452 onChange,
30453 validity,
30454 children,
30455 as
30456 }) {
30457 const { fields: fieldDefinitions } = (0, import_element107.useContext)(dataform_context_default);
30458 const markWhenOptional = (0, import_element107.useMemo)(() => {
30459 const requiredCount = fieldDefinitions.filter(
30460 (f2) => !!f2.isValid?.required
30461 ).length;
30462 const optionalCount = fieldDefinitions.length - requiredCount;
30463 return requiredCount > optionalCount;
30464 }, [fieldDefinitions]);
30465 function getFieldDefinition2(field) {
30466 return fieldDefinitions.find(
30467 (fieldDefinition) => fieldDefinition.id === field.id
30468 );
30469 }
30470 const Wrapper = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER;
30471 return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Wrapper, { layout: form.layout, children: form.fields.map((formField) => {
30472 const FieldLayout = getFormFieldLayout(formField.layout.type)?.component;
30473 if (!FieldLayout) {
30474 return null;
30475 }
30476 const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0;
30477 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
30478 return null;
30479 }
30480 if (children) {
30481 return children(
30482 FieldLayout,
30483 formField,
30484 validity?.[formField.id],
30485 markWhenOptional
30486 );
30487 }
30488 return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
30489 FieldLayout,
30490 {
30491 data,
30492 field: formField,
30493 onChange,
30494 markWhenOptional,
30495 validity: validity?.[formField.id]
30496 },
30497 formField.id
30498 );
30499 }) });
30500 }
30501
30502 // packages/dataviews/build-module/dataform/index.mjs
30503 var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1);
30504 function DataForm({
30505 data,
30506 form,
30507 fields,
30508 onChange,
30509 validity
30510 }) {
30511 const normalizedForm = (0, import_element108.useMemo)(() => normalize_form_default(form), [form]);
30512 const normalizedFields = (0, import_element108.useMemo)(
30513 () => normalizeFields(fields),
30514 [fields]
30515 );
30516 if (!form.fields) {
30517 return null;
30518 }
30519 return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
30520 DataFormLayout,
30521 {
30522 data,
30523 form: normalizedForm,
30524 onChange,
30525 validity
30526 }
30527 ) });
30528 }
30529
30530 // widgets/quick-draft/render.tsx
30531 var import_element113 = __toESM(require_element());
30532 var import_escape_html = __toESM(require_escape_html());
30533 var import_i18n53 = __toESM(require_i18n());
30534
30535 // widgets/quick-draft/components/drafts-list/drafts-list.tsx
30536 var import_core_data = __toESM(require_core_data());
30537 var import_data6 = __toESM(require_data());
30538 var import_date10 = __toESM(require_date());
30539 var import_element109 = __toESM(require_element());
30540 var import_html_entities = __toESM(require_html_entities());
30541 var import_i18n51 = __toESM(require_i18n());
30542 var import_url3 = __toESM(require_url());
30543
30544 // packages/style-runtime/src/index.ts
30545 var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash";
30546 function getRuntime23() {
30547 const globalScope = globalThis;
30548 if (globalScope.__wpStyleRuntime) {
30549 return globalScope.__wpStyleRuntime;
30550 }
30551 globalScope.__wpStyleRuntime = {
30552 documents: /* @__PURE__ */ new Map(),
30553 styles: /* @__PURE__ */ new Map(),
30554 injectedStyles: /* @__PURE__ */ new WeakMap()
30555 };
30556 if (typeof document !== "undefined") {
30557 registerDocument23(document);
30558 }
30559 return globalScope.__wpStyleRuntime;
30560 }
30561 function documentContainsStyleHash23(targetDocument, hash) {
30562 if (!targetDocument.head) {
30563 return false;
30564 }
30565 for (const style of targetDocument.head.querySelectorAll(
30566 `style[${STYLE_HASH_ATTRIBUTE23}]`
30567 )) {
30568 if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) {
30569 return true;
30570 }
30571 }
30572 return false;
30573 }
30574 function injectStyle23(targetDocument, hash, css) {
30575 if (!targetDocument.head) {
30576 return;
30577 }
30578 const runtime = getRuntime23();
30579 let injectedStyles = runtime.injectedStyles.get(targetDocument);
30580 if (!injectedStyles) {
30581 injectedStyles = /* @__PURE__ */ new Set();
30582 runtime.injectedStyles.set(targetDocument, injectedStyles);
30583 }
30584 if (injectedStyles.has(hash)) {
30585 return;
30586 }
30587 if (documentContainsStyleHash23(targetDocument, hash)) {
30588 injectedStyles.add(hash);
30589 return;
30590 }
30591 const style = targetDocument.createElement("style");
30592 style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash);
30593 style.appendChild(targetDocument.createTextNode(css));
30594 targetDocument.head.appendChild(style);
30595 injectedStyles.add(hash);
30596 }
30597 function registerDocument23(targetDocument) {
30598 const runtime = getRuntime23();
30599 runtime.documents.set(
30600 targetDocument,
30601 (runtime.documents.get(targetDocument) ?? 0) + 1
30602 );
30603 for (const [hash, css] of runtime.styles) {
30604 injectStyle23(targetDocument, hash, css);
30605 }
30606 return () => {
30607 const count = runtime.documents.get(targetDocument);
30608 if (count === void 0) {
30609 return;
30610 }
30611 if (count <= 1) {
30612 runtime.documents.delete(targetDocument);
30613 return;
30614 }
30615 runtime.documents.set(targetDocument, count - 1);
30616 };
30617 }
30618 function registerStyle23(hash, css) {
30619 const runtime = getRuntime23();
30620 runtime.styles.set(hash, css);
30621 for (const targetDocument of runtime.documents.keys()) {
30622 injectStyle23(targetDocument, hash, css);
30623 }
30624 }
30625
30626 // widgets/quick-draft/components/drafts-list/drafts-list.module.css
30627 if (typeof process === "undefined" || true) {
30628 registerStyle23("8858cd0cc4", "._27c1e13d297c9c75__root{flex:1;min-height:0;min-width:0;overflow:auto}._54b9ae86534218ea__titleHeader{border-top:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);padding-block-end:var(--wpds-dimension-padding-md,12px);padding-block-start:var(--wpds-dimension-padding-md,12px);padding-inline-start:var(--wpds-dimension-padding-md,12px)}._2e31af77792038af__thumbImage{object-fit:cover}._2e31af77792038af__thumbImage,.c4458e85b75cb2ca__thumbPlaceholder{border-radius:var(--wpds-border-radius-md,4px);height:100%;width:100%}.c4458e85b75cb2ca__thumbPlaceholder{align-items:center;background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center}._30dc10ae55a67d24__titleRow{min-width:0;width:100%}.eb5556cdba7ae763__titleLink{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._41963413d9183e83__date{color:var(--wpds-color-fg-content-neutral-weak,#707070)}");
30629 }
30630 var drafts_list_default = { "root": "_27c1e13d297c9c75__root", "titleHeader": "_54b9ae86534218ea__titleHeader", "thumbImage": "_2e31af77792038af__thumbImage", "thumbPlaceholder": "c4458e85b75cb2ca__thumbPlaceholder", "titleRow": "_30dc10ae55a67d24__titleRow", "titleLink": "eb5556cdba7ae763__titleLink", "date": "_41963413d9183e83__date" };
30631
30632 // widgets/quick-draft/components/drafts-list/drafts-list.tsx
30633 var import_jsx_runtime149 = __toESM(require_jsx_runtime());
30634 var DRAFTS_QUERY = {
30635 status: "draft",
30636 orderby: "date",
30637 order: "desc",
30638 per_page: 20,
30639 _embed: "wp:featuredmedia"
30640 };
30641 var DEFAULT_LAYOUTS2 = { list: {} };
30642 var INITIAL_VIEW = {
30643 type: "list",
30644 page: 1,
30645 perPage: DRAFTS_QUERY.per_page,
30646 search: "",
30647 filters: [],
30648 fields: [],
30649 titleField: "title",
30650 descriptionField: "date",
30651 mediaField: "featured",
30652 showMedia: true,
30653 layout: { density: "compact" }
30654 };
30655 function getEditUrl(postId) {
30656 return (0, import_url3.addQueryArgs)("post.php", { post: postId, action: "edit" });
30657 }
30658 function getThumbnailUrl(post) {
30659 const media = post._embedded?.["wp:featuredmedia"]?.[0];
30660 const sizes = media?.media_details?.sizes;
30661 return sizes?.thumbnail?.source_url ?? sizes?.medium?.source_url ?? media?.source_url;
30662 }
30663 function DraftThumbnail({ post }) {
30664 const url = getThumbnailUrl(post);
30665 if (url) {
30666 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
30667 "img",
30668 {
30669 className: drafts_list_default.thumbImage,
30670 src: url,
30671 alt: "",
30672 loading: "lazy"
30673 }
30674 );
30675 }
30676 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: drafts_list_default.thumbPlaceholder, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Icon, { icon: post_featured_image_default }) });
30677 }
30678 function DraftTitle({
30679 post,
30680 onDelete
30681 }) {
30682 const title = (0, import_html_entities.decodeEntities)(post.title?.rendered ?? "") || (0, import_i18n51.__)("(no title)");
30683 return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
30684 Stack,
30685 {
30686 direction: "row",
30687 align: "center",
30688 justify: "space-between",
30689 gap: "sm",
30690 className: drafts_list_default.titleRow,
30691 children: [
30692 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
30693 Link,
30694 {
30695 href: getEditUrl(post.id),
30696 openInNewTab: true,
30697 className: drafts_list_default.titleLink,
30698 children: title
30699 }
30700 ),
30701 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
30702 IconButton,
30703 {
30704 icon: trash_default,
30705 label: (0, import_i18n51.__)("Delete draft"),
30706 variant: "minimal",
30707 size: "small",
30708 onClick: () => onDelete(post.id)
30709 }
30710 )
30711 ]
30712 }
30713 );
30714 }
30715 function DraftDate({ post }) {
30716 const fullDate = (0, import_date10.dateI18n)((0, import_date10.getSettings)().formats.datetime, post.date);
30717 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
30718 Text,
30719 {
30720 variant: "body-sm",
30721 className: drafts_list_default.date,
30722 render: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { title: fullDate }),
30723 children: (0, import_date10.humanTimeDiff)(post.date)
30724 }
30725 );
30726 }
30727 function DraftsList() {
30728 const [view, setView] = (0, import_element109.useState)(INITIAL_VIEW);
30729 const { drafts, isLoading } = (0, import_data6.useSelect)((select) => {
30730 const { getEntityRecords, hasFinishedResolution } = select(import_core_data.store);
30731 const records = getEntityRecords("postType", "post", DRAFTS_QUERY);
30732 return {
30733 drafts: records ?? [],
30734 isLoading: !hasFinishedResolution("getEntityRecords", [
30735 "postType",
30736 "post",
30737 DRAFTS_QUERY
30738 ])
30739 };
30740 }, []);
30741 const { deleteEntityRecord } = (0, import_data6.useDispatch)(import_core_data.store);
30742 const deleteDraft = (0, import_element109.useCallback)(
30743 (id) => {
30744 void deleteEntityRecord("postType", "post", id, void 0);
30745 },
30746 [deleteEntityRecord]
30747 );
30748 const fields = (0, import_element109.useMemo)(
30749 () => [
30750 {
30751 id: "title",
30752 label: (0, import_i18n51.__)("Title"),
30753 enableSorting: false,
30754 enableHiding: false,
30755 render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DraftTitle, { post: item, onDelete: deleteDraft })
30756 },
30757 {
30758 id: "date",
30759 label: (0, import_i18n51.__)("Date"),
30760 enableSorting: false,
30761 enableHiding: false,
30762 render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DraftDate, { post: item })
30763 },
30764 {
30765 id: "featured",
30766 label: (0, import_i18n51.__)("Featured image"),
30767 enableSorting: false,
30768 enableHiding: false,
30769 render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DraftThumbnail, { post: item })
30770 }
30771 ],
30772 [deleteDraft]
30773 );
30774 return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(Stack, { direction: "column", className: drafts_list_default.root, children: [
30775 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Text, { variant: "heading-md", className: drafts_list_default.titleHeader, children: (0, import_i18n51.__)("Your recent drafts") }),
30776 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
30777 dataviews_default,
30778 {
30779 data: drafts,
30780 fields,
30781 view,
30782 onChangeView: setView,
30783 getItemId: (item) => String(item.id),
30784 isLoading,
30785 paginationInfo: { totalItems: drafts.length, totalPages: 1 },
30786 defaultLayouts: DEFAULT_LAYOUTS2,
30787 empty: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(empty_state_exports.Root, { children: [
30788 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(empty_state_exports.Icon, { icon: drafts_default }),
30789 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(empty_state_exports.Description, { children: (0, import_i18n51.__)("No drafts yet.") })
30790 ] }),
30791 children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(dataviews_default.Layout, {})
30792 }
30793 )
30794 ] });
30795 }
30796
30797 // widgets/quick-draft/components/saved-post/saved-post.tsx
30798 var import_element110 = __toESM(require_element());
30799 var import_i18n52 = __toESM(require_i18n());
30800 var import_url4 = __toESM(require_url());
30801
30802 // widgets/quick-draft/components/saved-post/saved-post.module.css
30803 if (typeof process === "undefined" || true) {
30804 registerStyle23("2d2616f744", "._88880a636bc02513__body{height:100%}._20963e427e9696da__icon{background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);border-color:var(--wpds-color-stroke-surface-success,#8ac894);color:var(--wpds-color-fg-content-success,#002900)}.ff3d1c6f8ba60167__continueLink{color:var(--wpds-color-fg-interactive-brand-strong,#fff)}");
30805 }
30806 var saved_post_default = { "body": "_88880a636bc02513__body", "icon": "_20963e427e9696da__icon", "continueLink": "ff3d1c6f8ba60167__continueLink" };
30807
30808 // widgets/quick-draft/components/saved-post/saved-post.tsx
30809 var import_jsx_runtime150 = __toESM(require_jsx_runtime());
30810 function SavedPost({
30811 postId,
30812 postTitle,
30813 onWriteAnother
30814 }) {
30815 const editUrl = (0, import_url4.addQueryArgs)("post.php", {
30816 post: postId,
30817 action: "edit"
30818 });
30819 return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
30820 Stack,
30821 {
30822 direction: "column",
30823 align: "center",
30824 justify: "center",
30825 className: saved_post_default.body,
30826 children: /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(empty_state_exports.Root, { children: [
30827 /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(empty_state_exports.Icon, { icon: check_default, className: saved_post_default.icon }),
30828 /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(empty_state_exports.Title, { children: (0, import_i18n52.__)("Draft saved") }),
30829 /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(empty_state_exports.Description, { children: (0, import_element110.createInterpolateElement)(
30830 (0, import_i18n52.sprintf)(
30831 /* translators: %s: post title */
30832 (0, import_i18n52.__)(
30833 '<strong>"%s"</strong> is ready to keep editing.'
30834 ),
30835 postTitle
30836 ),
30837 {
30838 strong: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("strong", {})
30839 }
30840 ) }),
30841 /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(empty_state_exports.Actions, { children: [
30842 /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
30843 Button4,
30844 {
30845 variant: "solid",
30846 size: "compact",
30847 nativeButton: false,
30848 render: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
30849 Link,
30850 {
30851 href: editUrl,
30852 openInNewTab: true,
30853 className: saved_post_default.continueLink
30854 }
30855 ),
30856 children: (0, import_i18n52.__)("Continue editing")
30857 }
30858 ),
30859 /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
30860 Button4,
30861 {
30862 variant: "minimal",
30863 size: "compact",
30864 onClick: onWriteAnother,
30865 children: (0, import_i18n52.__)("Write another")
30866 }
30867 )
30868 ] })
30869 ] })
30870 }
30871 );
30872 }
30873
30874 // widgets/quick-draft/fields/quick-draft-content-field/quick-draft-content-field.tsx
30875 var import_components51 = __toESM(require_components());
30876 var import_element111 = __toESM(require_element());
30877
30878 // widgets/quick-draft/fields/quick-draft-content-field/quick-draft-content-field.module.css
30879 if (typeof process === "undefined" || true) {
30880 registerStyle23("ca3754f0d9", ".d6b34c2200336d18__root{height:100%;min-height:0}.d6b34c2200336d18__root .components-base-control,.d6b34c2200336d18__root .components-base-control__field{display:flex;flex:1;flex-direction:column;min-height:0}.d6b34c2200336d18__root .components-textarea-control__input{flex:1;min-height:0;resize:none}.dataforms-layouts-regular__field:has(.d6b34c2200336d18__root){flex:1;min-height:0}");
30881 }
30882 var quick_draft_content_field_default = { "root": "d6b34c2200336d18__root" };
30883
30884 // widgets/quick-draft/fields/quick-draft-content-field/quick-draft-content-field.tsx
30885 var import_jsx_runtime151 = __toESM(require_jsx_runtime());
30886 function getErrorMessage(validity) {
30887 if (!validity) {
30888 return void 0;
30889 }
30890 const entries = [
30891 validity.required,
30892 validity.minLength,
30893 validity.maxLength,
30894 validity.pattern,
30895 validity.custom
30896 ];
30897 const invalid = entries.find((entry) => entry?.type === "invalid");
30898 return invalid?.message;
30899 }
30900 function QuickDraftContentField({
30901 data,
30902 field,
30903 onChange,
30904 hideLabelFromVision,
30905 validity
30906 }) {
30907 const value = field.getValue({ item: data });
30908 const disabled2 = field.isDisabled({ item: data, field });
30909 const onChangeValue = (0, import_element111.useCallback)(
30910 (newValue) => onChange(field.setValue({ item: data, value: newValue })),
30911 [data, field, onChange]
30912 );
30913 const errorMessage = getErrorMessage(validity);
30914 const help = errorMessage ?? field.description;
30915 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Stack, { direction: "column", className: quick_draft_content_field_default.root, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
30916 import_components51.TextareaControl,
30917 {
30918 label: field.label,
30919 hideLabelFromVision,
30920 value: value ?? "",
30921 placeholder: field.placeholder,
30922 help,
30923 onChange: onChangeValue,
30924 disabled: disabled2,
30925 rows: 4
30926 }
30927 ) });
30928 }
30929
30930 // widgets/quick-draft/hooks/use-widget-size/use-widget-size.ts
30931 var import_compose16 = __toESM(require_compose());
30932 var import_element112 = __toESM(require_element());
30933 var WIDE_MIN_WIDTH = 560;
30934 var TALL_MIN_HEIGHT = 420;
30935 var INITIAL_SIZE = { width: 0, height: 0 };
30936 function useWidgetSize() {
30937 const [size4, setSize] = (0, import_element112.useState)(INITIAL_SIZE);
30938 const ref = (0, import_compose16.useResizeObserver)(
30939 (entries) => {
30940 const entry = entries[0];
30941 if (!entry) {
30942 return;
30943 }
30944 const box = entry.borderBoxSize?.[0];
30945 const width = box ? box.inlineSize : entry.contentRect.width;
30946 const height = box ? box.blockSize : entry.contentRect.height;
30947 setSize(
30948 (prev) => prev.width === width && prev.height === height ? prev : { width, height }
30949 );
30950 },
30951 { box: "border-box" }
30952 );
30953 return (0, import_element112.useMemo)(
30954 () => ({
30955 ref,
30956 width: size4.width,
30957 height: size4.height,
30958 isWide: size4.width >= WIDE_MIN_WIDTH,
30959 isTall: size4.height >= TALL_MIN_HEIGHT
30960 }),
30961 [ref, size4.width, size4.height]
30962 );
30963 }
30964
30965 // widgets/quick-draft/style.module.css
30966 if (typeof process === "undefined" || true) {
30967 registerStyle23("2f36e3552d", "._1ceea6985c028257__body,.e95823d50a99f185__fill{height:100%}._0325357a2c3b57a4__primaryPane{border-top:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);flex:1;min-height:0;min-width:0;padding:var(--wpds-dimension-padding-lg,16px)}._20004de4c12366b1__listPane{flex:1;min-height:0;min-width:0}._809476aa1889889d__backRow{border-top:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);padding:var(--wpds-dimension-padding-sm,8px)}._264d0da8d26b736f__row ._0325357a2c3b57a4__primaryPane{border-inline-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);margin:0 auto;max-width:calc(var(--wpds-dimension-base, 4px)*100)}._6b9679a01ecee959__formContainer,._6b9679a01ecee959__formContainer>.dataforms-layouts__wrapper{flex:1;min-height:0}");
30968 }
30969 var style_default22 = { "body": "_1ceea6985c028257__body", "fill": "e95823d50a99f185__fill", "primaryPane": "_0325357a2c3b57a4__primaryPane", "listPane": "_20004de4c12366b1__listPane", "backRow": "_809476aa1889889d__backRow", "row": "_264d0da8d26b736f__row", "formContainer": "_6b9679a01ecee959__formContainer" };
30970
30971 // widgets/quick-draft/render.tsx
30972 var import_jsx_runtime152 = __toESM(require_jsx_runtime());
30973 function textToParagraphBlocks(text) {
30974 if (!text.trim()) {
30975 return "";
30976 }
30977 return (0, import_autop.autop)((0, import_escape_html.escapeHTML)(text)).replace(
30978 /<p>([\s\S]*?)<\/p>/g,
30979 "<!-- wp:paragraph -->\n<p>$1</p>\n<!-- /wp:paragraph -->"
30980 );
30981 }
30982 var FORM = {
30983 layout: { type: "regular" },
30984 fields: ["title", "content"]
30985 };
30986 var INITIAL_DATA = {
30987 title: "",
30988 content: ""
30989 };
30990 function QuickDraft() {
30991 const [data, setData] = (0, import_element113.useState)(INITIAL_DATA);
30992 const [isSaving, setIsSaving] = (0, import_element113.useState)(false);
30993 const [createdPost, setCreatedPost] = (0, import_element113.useState)(null);
30994 const [isListOpenInCompact, setIsListOpenInCompact] = (0, import_element113.useState)(false);
30995 const { ref, isWide, isTall } = useWidgetSize();
30996 const showDraftsList = isWide || isTall;
30997 const listBeside = isWide;
30998 const { saveEntityRecord } = (0, import_data7.useDispatch)(import_core_data2.store);
30999 const { hasDrafts } = (0, import_data7.useSelect)(
31000 (select) => {
31001 if (showDraftsList) {
31002 return { hasDrafts: false };
31003 }
31004 const { getEntityRecords } = select(import_core_data2.store);
31005 const anyDrafts = getEntityRecords("postType", "post", {
31006 status: "draft",
31007 per_page: 1
31008 });
31009 return { hasDrafts: (anyDrafts?.length ?? 0) > 0 };
31010 },
31011 [showDraftsList]
31012 );
31013 const fields = (0, import_element113.useMemo)(
31014 () => [
31015 {
31016 id: "title",
31017 type: "text",
31018 label: (0, import_i18n53.__)("Title"),
31019 isValid: { required: true, minLength: 3 },
31020 hideLabelFromVision: true,
31021 help: (0, import_i18n53.__)("Enter a title for your post.")
31022 },
31023 {
31024 id: "content",
31025 type: "text",
31026 label: (0, import_i18n53.__)("Content"),
31027 isValid: { required: true, minLength: 10 },
31028 Edit: QuickDraftContentField,
31029 help: (0, import_i18n53.__)("Enter the content for your post.")
31030 }
31031 ],
31032 []
31033 );
31034 const { validity, isValid: isValid2 } = use_form_validity_default(data, fields, FORM);
31035 const canSave = isValid2 && !isSaving;
31036 const saveDraftPost = async () => {
31037 if (!canSave) {
31038 return;
31039 }
31040 setIsSaving(true);
31041 try {
31042 const saved = await saveEntityRecord("postType", "post", {
31043 title: data.title,
31044 content: textToParagraphBlocks(data.content),
31045 status: "draft"
31046 });
31047 const newId = saved?.id;
31048 if (typeof newId === "number") {
31049 setCreatedPost({ id: newId, title: data.title });
31050 }
31051 setData(INITIAL_DATA);
31052 } finally {
31053 setIsSaving(false);
31054 }
31055 };
31056 const writeAnother = () => {
31057 setCreatedPost(null);
31058 };
31059 let primary;
31060 if (createdPost !== null) {
31061 primary = /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
31062 SavedPost,
31063 {
31064 postId: createdPost.id,
31065 postTitle: createdPost.title,
31066 onWriteAnother: writeAnother
31067 }
31068 );
31069 } else {
31070 primary = /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
31071 Stack,
31072 {
31073 direction: "column",
31074 gap: "md",
31075 justify: "space-between",
31076 className: style_default22.fill,
31077 children: [
31078 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Stack, { direction: "column", className: style_default22.formContainer, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
31079 DataForm,
31080 {
31081 data,
31082 fields,
31083 form: FORM,
31084 validity,
31085 onChange: (edits) => setData((prev) => ({ ...prev, ...edits }))
31086 }
31087 ) }),
31088 /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(Stack, { direction: "row", gap: "md", justify: "flex-start", children: [
31089 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
31090 Button4,
31091 {
31092 variant: "solid",
31093 onClick: saveDraftPost,
31094 loading: isSaving,
31095 disabled: !canSave,
31096 children: (0, import_i18n53.__)("Save as draft")
31097 }
31098 ),
31099 !showDraftsList && hasDrafts && /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
31100 Button4,
31101 {
31102 variant: "minimal",
31103 onClick: () => setIsListOpenInCompact(true),
31104 children: [
31105 (0, import_i18n53.__)("Draft posts"),
31106 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Button4.Icon, { icon: chevron_right_default })
31107 ]
31108 }
31109 )
31110 ] })
31111 ]
31112 }
31113 );
31114 }
31115 if (!showDraftsList && isListOpenInCompact) {
31116 return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(Stack, { ref, direction: "column", className: style_default22.body, children: [
31117 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Stack, { direction: "column", className: style_default22.listPane, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(DraftsList, {}) }),
31118 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
31119 Stack,
31120 {
31121 direction: "row",
31122 justify: "flex-start",
31123 className: style_default22.backRow,
31124 children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
31125 Button4,
31126 {
31127 variant: "minimal",
31128 tone: "neutral",
31129 size: "compact",
31130 onClick: () => setIsListOpenInCompact(false),
31131 children: [
31132 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Button4.Icon, { icon: chevron_left_default }),
31133 (0, import_i18n53.__)("Back")
31134 ]
31135 }
31136 )
31137 }
31138 )
31139 ] });
31140 }
31141 if (!showDraftsList) {
31142 return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Stack, { ref, direction: "column", className: style_default22.body, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Stack, { direction: "column", className: style_default22.primaryPane, children: primary }) });
31143 }
31144 return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
31145 Stack,
31146 {
31147 ref,
31148 direction: listBeside ? "row" : "column",
31149 className: clsx_default(
31150 style_default22.body,
31151 listBeside ? style_default22.row : style_default22.column
31152 ),
31153 children: [
31154 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Stack, { direction: "column", className: style_default22.primaryPane, children: primary }),
31155 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Stack, { direction: "column", className: style_default22.listPane, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(DraftsList, {}) })
31156 ]
31157 }
31158 );
31159 }
31160 export {
31161 QuickDraft as default
31162 };
31163 /*! Bundled license information:
31164
31165 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
31166 (**
31167 * @license React
31168 * use-sync-external-store-shim.development.js
31169 *
31170 * Copyright (c) Meta Platforms, Inc. and affiliates.
31171 *
31172 * This source code is licensed under the MIT license found in the
31173 * LICENSE file in the root directory of this source tree.
31174 *)
31175
31176 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
31177 (**
31178 * @license React
31179 * use-sync-external-store-shim/with-selector.development.js
31180 *
31181 * Copyright (c) Meta Platforms, Inc. and affiliates.
31182 *
31183 * This source code is licensed under the MIT license found in the
31184 * LICENSE file in the root directory of this source tree.
31185 *)
31186 */
31187