PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 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 All 404 releases
gutenberg / build / routes / identity / content.js

content.js in Gutenberg trunk, at build/routes/identity/content.js

33,453 lines 1.2 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 = (to2, from, except, desc) => {
15 if (from && typeof from === "object" || typeof from === "function") {
16 for (let key of __getOwnPropNames(from))
17 if (!__hasOwnProp.call(to2, key) && key !== except)
18 __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19 }
20 return to2;
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/i18n
32 var require_i18n = __commonJS({
33 "package-external:@wordpress/i18n"(exports, module) {
34 module.exports = window.wp.i18n;
35 }
36 });
37
38 // package-external:@wordpress/element
39 var require_element = __commonJS({
40 "package-external:@wordpress/element"(exports, module) {
41 module.exports = window.wp.element;
42 }
43 });
44
45 // vendor-external:react
46 var require_react = __commonJS({
47 "vendor-external:react"(exports, module) {
48 module.exports = window.React;
49 }
50 });
51
52 // vendor-external:react/jsx-runtime
53 var require_jsx_runtime = __commonJS({
54 "vendor-external:react/jsx-runtime"(exports, module) {
55 module.exports = window.ReactJSXRuntime;
56 }
57 });
58
59 // vendor-external:react-dom
60 var require_react_dom = __commonJS({
61 "vendor-external:react-dom"(exports, module) {
62 module.exports = window.ReactDOM;
63 }
64 });
65
66 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
67 var require_use_sync_external_store_shim_development = __commonJS({
68 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
69 "use strict";
70 (function() {
71 function is2(x2, y2) {
72 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
73 }
74 function useSyncExternalStore$2(subscribe, getSnapshot) {
75 didWarnOld18Alpha || void 0 === React105.startTransition || (didWarnOld18Alpha = true, console.error(
76 "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."
77 ));
78 var value = getSnapshot();
79 if (!didWarnUncachedGetSnapshot) {
80 var cachedValue = getSnapshot();
81 objectIs(value, cachedValue) || (console.error(
82 "The result of getSnapshot should be cached to avoid an infinite loop"
83 ), didWarnUncachedGetSnapshot = true);
84 }
85 cachedValue = useState37({
86 inst: { value, getSnapshot }
87 });
88 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
89 useLayoutEffect6(
90 function() {
91 inst.value = value;
92 inst.getSnapshot = getSnapshot;
93 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
94 },
95 [subscribe, value, getSnapshot]
96 );
97 useEffect33(
98 function() {
99 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
100 return subscribe(function() {
101 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
102 });
103 },
104 [subscribe]
105 );
106 useDebugValue2(value);
107 return value;
108 }
109 function checkIfSnapshotChanged(inst) {
110 var latestGetSnapshot = inst.getSnapshot;
111 inst = inst.value;
112 try {
113 var nextValue = latestGetSnapshot();
114 return !objectIs(inst, nextValue);
115 } catch (error2) {
116 return true;
117 }
118 }
119 function useSyncExternalStore$1(subscribe, getSnapshot) {
120 return getSnapshot();
121 }
122 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
123 var React105 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is2, useState37 = React105.useState, useEffect33 = React105.useEffect, useLayoutEffect6 = React105.useLayoutEffect, useDebugValue2 = React105.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
124 exports.useSyncExternalStore = void 0 !== React105.useSyncExternalStore ? React105.useSyncExternalStore : shim;
125 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
126 })();
127 }
128 });
129
130 // node_modules/use-sync-external-store/shim/index.js
131 var require_shim = __commonJS({
132 "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
133 "use strict";
134 if (false) {
135 module.exports = null;
136 } else {
137 module.exports = require_use_sync_external_store_shim_development();
138 }
139 }
140 });
141
142 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
143 var require_with_selector_development = __commonJS({
144 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
145 "use strict";
146 (function() {
147 function is2(x2, y2) {
148 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
149 }
150 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
151 var React105 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is2, useSyncExternalStore3 = shim.useSyncExternalStore, useRef56 = React105.useRef, useEffect33 = React105.useEffect, useMemo43 = React105.useMemo, useDebugValue2 = React105.useDebugValue;
152 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual2) {
153 var instRef = useRef56(null);
154 if (null === instRef.current) {
155 var inst = { hasValue: false, value: null };
156 instRef.current = inst;
157 } else inst = instRef.current;
158 instRef = useMemo43(
159 function() {
160 function memoizedSelector(nextSnapshot) {
161 if (!hasMemo) {
162 hasMemo = true;
163 memoizedSnapshot = nextSnapshot;
164 nextSnapshot = selector(nextSnapshot);
165 if (void 0 !== isEqual2 && inst.hasValue) {
166 var currentSelection = inst.value;
167 if (isEqual2(currentSelection, nextSnapshot))
168 return memoizedSelection = currentSelection;
169 }
170 return memoizedSelection = nextSnapshot;
171 }
172 currentSelection = memoizedSelection;
173 if (objectIs(memoizedSnapshot, nextSnapshot))
174 return currentSelection;
175 var nextSelection = selector(nextSnapshot);
176 if (void 0 !== isEqual2 && isEqual2(currentSelection, nextSelection))
177 return memoizedSnapshot = nextSnapshot, currentSelection;
178 memoizedSnapshot = nextSnapshot;
179 return memoizedSelection = nextSelection;
180 }
181 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
182 return [
183 function() {
184 return memoizedSelector(getSnapshot());
185 },
186 null === maybeGetServerSnapshot ? void 0 : function() {
187 return memoizedSelector(maybeGetServerSnapshot());
188 }
189 ];
190 },
191 [getSnapshot, getServerSnapshot, selector, isEqual2]
192 );
193 var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
194 useEffect33(
195 function() {
196 inst.hasValue = true;
197 inst.value = value;
198 },
199 [value]
200 );
201 useDebugValue2(value);
202 return value;
203 };
204 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
205 })();
206 }
207 });
208
209 // node_modules/use-sync-external-store/shim/with-selector.js
210 var require_with_selector = __commonJS({
211 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
212 "use strict";
213 if (false) {
214 module.exports = null;
215 } else {
216 module.exports = require_with_selector_development();
217 }
218 }
219 });
220
221 // package-external:@wordpress/compose
222 var require_compose = __commonJS({
223 "package-external:@wordpress/compose"(exports, module) {
224 module.exports = window.wp.compose;
225 }
226 });
227
228 // package-external:@wordpress/theme
229 var require_theme = __commonJS({
230 "package-external:@wordpress/theme"(exports, module) {
231 module.exports = window.wp.theme;
232 }
233 });
234
235 // package-external:@wordpress/private-apis
236 var require_private_apis = __commonJS({
237 "package-external:@wordpress/private-apis"(exports, module) {
238 module.exports = window.wp.privateApis;
239 }
240 });
241
242 // package-external:@wordpress/primitives
243 var require_primitives = __commonJS({
244 "package-external:@wordpress/primitives"(exports, module) {
245 module.exports = window.wp.primitives;
246 }
247 });
248
249 // package-external:@wordpress/components
250 var require_components = __commonJS({
251 "package-external:@wordpress/components"(exports, module) {
252 module.exports = window.wp.components;
253 }
254 });
255
256 // package-external:@wordpress/data
257 var require_data = __commonJS({
258 "package-external:@wordpress/data"(exports, module) {
259 module.exports = window.wp.data;
260 }
261 });
262
263 // package-external:@wordpress/core-data
264 var require_core_data = __commonJS({
265 "package-external:@wordpress/core-data"(exports, module) {
266 module.exports = window.wp.coreData;
267 }
268 });
269
270 // node_modules/fast-deep-equal/es6/index.js
271 var require_es6 = __commonJS({
272 "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
273 "use strict";
274 module.exports = function equal(a, b) {
275 if (a === b) return true;
276 if (a && b && typeof a == "object" && typeof b == "object") {
277 if (a.constructor !== b.constructor) return false;
278 var length, i, keys;
279 if (Array.isArray(a)) {
280 length = a.length;
281 if (length != b.length) return false;
282 for (i = length; i-- !== 0; )
283 if (!equal(a[i], b[i])) return false;
284 return true;
285 }
286 if (a instanceof Map && b instanceof Map) {
287 if (a.size !== b.size) return false;
288 for (i of a.entries())
289 if (!b.has(i[0])) return false;
290 for (i of a.entries())
291 if (!equal(i[1], b.get(i[0]))) return false;
292 return true;
293 }
294 if (a instanceof Set && b instanceof Set) {
295 if (a.size !== b.size) return false;
296 for (i of a.entries())
297 if (!b.has(i[0])) return false;
298 return true;
299 }
300 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
301 length = a.length;
302 if (length != b.length) return false;
303 for (i = length; i-- !== 0; )
304 if (a[i] !== b[i]) return false;
305 return true;
306 }
307 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
308 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
309 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
310 keys = Object.keys(a);
311 length = keys.length;
312 if (length !== Object.keys(b).length) return false;
313 for (i = length; i-- !== 0; )
314 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
315 for (i = length; i-- !== 0; ) {
316 var key = keys[i];
317 if (!equal(a[key], b[key])) return false;
318 }
319 return true;
320 }
321 return a !== a && b !== b;
322 };
323 }
324 });
325
326 // package-external:@wordpress/date
327 var require_date = __commonJS({
328 "package-external:@wordpress/date"(exports, module) {
329 module.exports = window.wp.date;
330 }
331 });
332
333 // node_modules/deepmerge/dist/cjs.js
334 var require_cjs = __commonJS({
335 "node_modules/deepmerge/dist/cjs.js"(exports, module) {
336 "use strict";
337 var isMergeableObject = function isMergeableObject2(value) {
338 return isNonNullObject(value) && !isSpecial(value);
339 };
340 function isNonNullObject(value) {
341 return !!value && typeof value === "object";
342 }
343 function isSpecial(value) {
344 var stringValue = Object.prototype.toString.call(value);
345 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
346 }
347 var canUseSymbol = typeof Symbol === "function" && Symbol.for;
348 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
349 function isReactElement(value) {
350 return value.$$typeof === REACT_ELEMENT_TYPE;
351 }
352 function emptyTarget(val) {
353 return Array.isArray(val) ? [] : {};
354 }
355 function cloneUnlessOtherwiseSpecified(value, options) {
356 return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
357 }
358 function defaultArrayMerge(target, source, options) {
359 return target.concat(source).map(function(element) {
360 return cloneUnlessOtherwiseSpecified(element, options);
361 });
362 }
363 function getMergeFunction(key, options) {
364 if (!options.customMerge) {
365 return deepmerge;
366 }
367 var customMerge = options.customMerge(key);
368 return typeof customMerge === "function" ? customMerge : deepmerge;
369 }
370 function getEnumerableOwnPropertySymbols(target) {
371 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
372 return Object.propertyIsEnumerable.call(target, symbol);
373 }) : [];
374 }
375 function getKeys(target) {
376 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
377 }
378 function propertyIsOnObject(object, property) {
379 try {
380 return property in object;
381 } catch (_) {
382 return false;
383 }
384 }
385 function propertyIsUnsafe(target, key) {
386 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
387 }
388 function mergeObject(target, source, options) {
389 var destination = {};
390 if (options.isMergeableObject(target)) {
391 getKeys(target).forEach(function(key) {
392 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
393 });
394 }
395 getKeys(source).forEach(function(key) {
396 if (propertyIsUnsafe(target, key)) {
397 return;
398 }
399 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
400 destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
401 } else {
402 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
403 }
404 });
405 return destination;
406 }
407 function deepmerge(target, source, options) {
408 options = options || {};
409 options.arrayMerge = options.arrayMerge || defaultArrayMerge;
410 options.isMergeableObject = options.isMergeableObject || isMergeableObject;
411 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
412 var sourceIsArray = Array.isArray(source);
413 var targetIsArray = Array.isArray(target);
414 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
415 if (!sourceAndTargetTypesMatch) {
416 return cloneUnlessOtherwiseSpecified(source, options);
417 } else if (sourceIsArray) {
418 return options.arrayMerge(target, source, options);
419 } else {
420 return mergeObject(target, source, options);
421 }
422 }
423 deepmerge.all = function deepmergeAll(array, options) {
424 if (!Array.isArray(array)) {
425 throw new Error("first argument should be an array");
426 }
427 return array.reduce(function(prev, next) {
428 return deepmerge(prev, next, options);
429 }, {});
430 };
431 var deepmerge_1 = deepmerge;
432 module.exports = deepmerge_1;
433 }
434 });
435
436 // package-external:@wordpress/preferences
437 var require_preferences = __commonJS({
438 "package-external:@wordpress/preferences"(exports, module) {
439 module.exports = window.wp.preferences;
440 }
441 });
442
443 // package-external:@wordpress/notices
444 var require_notices = __commonJS({
445 "package-external:@wordpress/notices"(exports, module) {
446 module.exports = window.wp.notices;
447 }
448 });
449
450 // package-external:@wordpress/html-entities
451 var require_html_entities = __commonJS({
452 "package-external:@wordpress/html-entities"(exports, module) {
453 module.exports = window.wp.htmlEntities;
454 }
455 });
456
457 // package-external:@wordpress/blob
458 var require_blob = __commonJS({
459 "package-external:@wordpress/blob"(exports, module) {
460 module.exports = window.wp.blob;
461 }
462 });
463
464 // package-external:@wordpress/media-utils
465 var require_media_utils = __commonJS({
466 "package-external:@wordpress/media-utils"(exports, module) {
467 module.exports = window.wp.mediaUtils;
468 }
469 });
470
471 // node_modules/clsx/dist/clsx.mjs
472 function r(e) {
473 var t, f, n = "";
474 if ("string" == typeof e || "number" == typeof e) n += e;
475 else if ("object" == typeof e) if (Array.isArray(e)) {
476 var o = e.length;
477 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
478 } else for (f in e) e[f] && (n && (n += " "), n += f);
479 return n;
480 }
481 function clsx() {
482 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
483 return n;
484 }
485 var clsx_default = clsx;
486
487 // packages/ui/build-module/badge/badge.mjs
488 var import_element11 = __toESM(require_element(), 1);
489
490 // node_modules/@base-ui/utils/useControlled.mjs
491 var React = __toESM(require_react(), 1);
492
493 // node_modules/@base-ui/utils/createLogOnce.mjs
494 var loggedMessages;
495 if (true) {
496 loggedMessages = /* @__PURE__ */ new Set();
497 }
498 function createLogOnce(severity, prefix2) {
499 return function logOnce(...messages) {
500 if (true) {
501 const message2 = messages.join(" ");
502 const output = prefix2 ? `${prefix2}: ${message2}` : message2;
503 const key = `${severity}:${output}`;
504 if (!loggedMessages.has(key)) {
505 loggedMessages.add(key);
506 if (severity === "warn") {
507 console.warn(output);
508 } else {
509 console.error(output);
510 }
511 }
512 }
513 };
514 }
515
516 // node_modules/@base-ui/utils/error.mjs
517 var error = createLogOnce("error", "Base UI");
518
519 // node_modules/@base-ui/utils/useControlled.mjs
520 function useControlled({
521 controlled,
522 default: defaultProp,
523 name,
524 state = "value"
525 }) {
526 const {
527 current: isControlled
528 } = React.useRef(controlled !== void 0);
529 const [valueState, setValue] = React.useState(defaultProp);
530 const value = isControlled && controlled !== void 0 ? controlled : valueState;
531 if (true) {
532 React.useEffect(() => {
533 if (isControlled !== (controlled !== void 0)) {
534 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"));
535 }
536 }, [state, name, controlled]);
537 const {
538 current: defaultValue
539 } = React.useRef(defaultProp);
540 React.useEffect(() => {
541 if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
542 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"));
543 }
544 }, [defaultProp]);
545 }
546 const setValueIfUncontrolled = React.useCallback((newValue) => {
547 if (!isControlled) {
548 setValue(newValue);
549 }
550 }, []);
551 return [value, setValueIfUncontrolled];
552 }
553 function serializeToDevModeString(input) {
554 let nextId2 = 0;
555 const seen = /* @__PURE__ */ new WeakMap();
556 try {
557 const result = JSON.stringify(input, function replacer(key, value) {
558 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
559 return void 0;
560 }
561 if (typeof value === "bigint") {
562 return `__bigint__:${value}`;
563 }
564 if (value !== null && typeof value === "object") {
565 const id = seen.get(value);
566 if (id !== void 0) {
567 return `__object__:${id}`;
568 }
569 seen.set(value, nextId2);
570 nextId2 += 1;
571 }
572 return value;
573 });
574 return result ?? `__top__:${typeof input}`;
575 } catch {
576 return "__unserializable__";
577 }
578 }
579
580 // node_modules/@base-ui/utils/safeReact.mjs
581 var React2 = __toESM(require_react(), 1);
582 var SafeReact = {
583 ...React2
584 };
585
586 // node_modules/@base-ui/utils/useRefWithInit.mjs
587 var React3 = __toESM(require_react(), 1);
588 var UNINITIALIZED = {};
589 function useRefWithInit(init, initArg) {
590 const ref = React3.useRef(UNINITIALIZED);
591 if (ref.current === UNINITIALIZED) {
592 ref.current = init(initArg);
593 }
594 return ref;
595 }
596
597 // node_modules/@base-ui/utils/useStableCallback.mjs
598 var useInsertionEffect = SafeReact.useInsertionEffect;
599 var useSafeInsertionEffect = (
600 // React 17 doesn't have useInsertionEffect.
601 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
602 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
603 );
604 function useStableCallback(callback) {
605 const stable = useRefWithInit(createStableCallback).current;
606 stable.next = callback;
607 useSafeInsertionEffect(stable.effect);
608 return stable.trampoline;
609 }
610 function createStableCallback() {
611 const stable = {
612 next: void 0,
613 callback: assertNotCalled,
614 trampoline: (...args) => stable.callback?.(...args),
615 effect: () => {
616 stable.callback = stable.next;
617 }
618 };
619 return stable;
620 }
621 function assertNotCalled() {
622 if (true) {
623 throw (
624 /* minify-error-disabled */
625 new Error("Base UI: Cannot call an event handler while rendering.")
626 );
627 }
628 }
629
630 // node_modules/@base-ui/utils/warn.mjs
631 var warn = createLogOnce("warn", "Base UI");
632
633 // node_modules/@base-ui/utils/empty.mjs
634 function NOOP() {
635 }
636 var EMPTY_ARRAY = Object.freeze([]);
637 var EMPTY_OBJECT = Object.freeze({});
638
639 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
640 var React4 = __toESM(require_react(), 1);
641 var noop = () => {
642 };
643 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;
644
645 // node_modules/@base-ui/react/internals/useRenderElement.mjs
646 var React7 = __toESM(require_react(), 1);
647
648 // node_modules/@base-ui/utils/useMergedRefs.mjs
649 function useMergedRefs(a, b, c6, d) {
650 const forkRef = useRefWithInit(createForkRef).current;
651 if (didChange(forkRef, a, b, c6, d)) {
652 update(forkRef, [a, b, c6, d]);
653 }
654 return forkRef.callback;
655 }
656 function useMergedRefsN(refs) {
657 const forkRef = useRefWithInit(createForkRef).current;
658 if (didChangeN(forkRef, refs)) {
659 update(forkRef, refs);
660 }
661 return forkRef.callback;
662 }
663 function createForkRef() {
664 return {
665 callback: null,
666 cleanup: null,
667 refs: []
668 };
669 }
670 function didChange(forkRef, a, b, c6, d) {
671 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c6 || forkRef.refs[3] !== d;
672 }
673 function didChangeN(forkRef, newRefs) {
674 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
675 }
676 function update(forkRef, refs) {
677 forkRef.refs = refs;
678 if (refs.every((ref) => ref == null)) {
679 forkRef.callback = null;
680 return;
681 }
682 forkRef.callback = (instance) => {
683 if (forkRef.cleanup) {
684 forkRef.cleanup();
685 forkRef.cleanup = null;
686 }
687 if (instance != null) {
688 const cleanupCallbacks = Array(refs.length).fill(null);
689 for (let i = 0; i < refs.length; i += 1) {
690 const ref = refs[i];
691 if (ref == null) {
692 continue;
693 }
694 switch (typeof ref) {
695 case "function": {
696 const refCleanup = ref(instance);
697 if (typeof refCleanup === "function") {
698 cleanupCallbacks[i] = refCleanup;
699 }
700 break;
701 }
702 case "object": {
703 ref.current = instance;
704 break;
705 }
706 default:
707 }
708 }
709 forkRef.cleanup = () => {
710 for (let i = 0; i < refs.length; i += 1) {
711 const ref = refs[i];
712 if (ref == null) {
713 continue;
714 }
715 switch (typeof ref) {
716 case "function": {
717 const cleanupCallback = cleanupCallbacks[i];
718 if (typeof cleanupCallback === "function") {
719 cleanupCallback();
720 } else {
721 void ref(null);
722 }
723 break;
724 }
725 case "object": {
726 ref.current = null;
727 break;
728 }
729 default:
730 }
731 }
732 };
733 }
734 };
735 }
736
737 // node_modules/@base-ui/utils/getReactElementRef.mjs
738 var React6 = __toESM(require_react(), 1);
739
740 // node_modules/@base-ui/utils/reactVersion.mjs
741 var React5 = __toESM(require_react(), 1);
742 var majorVersion = parseInt(React5.version, 10);
743 function isReactVersionAtLeast(reactVersionToCheck) {
744 return majorVersion >= reactVersionToCheck;
745 }
746
747 // node_modules/@base-ui/utils/getReactElementRef.mjs
748 function getReactElementRef(element) {
749 if (!/* @__PURE__ */ React6.isValidElement(element)) {
750 return null;
751 }
752 const reactElement = element;
753 const propsWithRef = reactElement.props;
754 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
755 }
756
757 // node_modules/@base-ui/utils/mergeObjects.mjs
758 function mergeObjects(a, b) {
759 if (a && !b) {
760 return a;
761 }
762 if (!a && b) {
763 return b;
764 }
765 if (a || b) {
766 return {
767 ...a,
768 ...b
769 };
770 }
771 return void 0;
772 }
773
774 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
775 function getStateAttributesProps(state, customMapping) {
776 const props = {};
777 for (const key in state) {
778 const value = state[key];
779 if (customMapping?.hasOwnProperty(key)) {
780 const customProps = customMapping[key](value);
781 if (customProps != null) {
782 Object.assign(props, customProps);
783 }
784 continue;
785 }
786 if (value === true) {
787 props[`data-${key.toLowerCase()}`] = "";
788 } else if (value) {
789 props[`data-${key.toLowerCase()}`] = value.toString();
790 }
791 }
792 return props;
793 }
794
795 // node_modules/@base-ui/react/utils/resolveClassName.mjs
796 function resolveClassName(className, state) {
797 return typeof className === "function" ? className(state) : className;
798 }
799
800 // node_modules/@base-ui/react/utils/resolveStyle.mjs
801 function resolveStyle(style, state) {
802 return typeof style === "function" ? style(state) : style;
803 }
804
805 // node_modules/@base-ui/react/merge-props/mergeProps.mjs
806 var EMPTY_PROPS = {};
807 function mergeProps(a, b, c6, d, e) {
808 if (!c6 && !d && !e && !a) {
809 return createInitialMergedProps(b);
810 }
811 let merged = createInitialMergedProps(a);
812 if (b) {
813 merged = mergeInto(merged, b);
814 }
815 if (c6) {
816 merged = mergeInto(merged, c6);
817 }
818 if (d) {
819 merged = mergeInto(merged, d);
820 }
821 if (e) {
822 merged = mergeInto(merged, e);
823 }
824 return merged;
825 }
826 function mergePropsN(props) {
827 if (props.length === 0) {
828 return EMPTY_PROPS;
829 }
830 if (props.length === 1) {
831 return createInitialMergedProps(props[0]);
832 }
833 let merged = createInitialMergedProps(props[0]);
834 for (let i = 1; i < props.length; i += 1) {
835 merged = mergeInto(merged, props[i]);
836 }
837 return merged;
838 }
839 function createInitialMergedProps(inputProps) {
840 if (isPropsGetter(inputProps)) {
841 return {
842 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
843 };
844 }
845 return copyInitialProps(inputProps);
846 }
847 function mergeInto(merged, inputProps) {
848 if (isPropsGetter(inputProps)) {
849 return resolvePropsGetter(inputProps, merged);
850 }
851 return mutablyMergeInto(merged, inputProps);
852 }
853 function copyInitialProps(inputProps) {
854 const copiedProps = {
855 ...inputProps
856 };
857 for (const propName in copiedProps) {
858 const propValue = copiedProps[propName];
859 if (isEventHandler(propName, propValue)) {
860 copiedProps[propName] = wrapEventHandler(propValue);
861 }
862 }
863 return copiedProps;
864 }
865 function mutablyMergeInto(mergedProps, externalProps) {
866 if (!externalProps) {
867 return mergedProps;
868 }
869 for (const propName in externalProps) {
870 const externalPropValue = externalProps[propName];
871 switch (propName) {
872 case "style": {
873 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
874 break;
875 }
876 case "className": {
877 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
878 break;
879 }
880 default: {
881 if (isEventHandler(propName, externalPropValue)) {
882 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
883 } else {
884 mergedProps[propName] = externalPropValue;
885 }
886 }
887 }
888 }
889 return mergedProps;
890 }
891 function isEventHandler(key, value) {
892 const code0 = key.charCodeAt(0);
893 const code1 = key.charCodeAt(1);
894 const code2 = key.charCodeAt(2);
895 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
896 }
897 function isPropsGetter(inputProps) {
898 return typeof inputProps === "function";
899 }
900 function resolvePropsGetter(inputProps, previousProps) {
901 if (isPropsGetter(inputProps)) {
902 return inputProps(previousProps);
903 }
904 return inputProps ?? EMPTY_PROPS;
905 }
906 function mergeEventHandlers(ourHandler, theirHandler) {
907 if (!theirHandler) {
908 return ourHandler;
909 }
910 if (!ourHandler) {
911 return wrapEventHandler(theirHandler);
912 }
913 return (...args) => {
914 const event = args[0];
915 if (isSyntheticEvent(event)) {
916 const baseUIEvent = event;
917 makeEventPreventable(baseUIEvent);
918 const result2 = theirHandler(...args);
919 if (!baseUIEvent.baseUIHandlerPrevented) {
920 ourHandler?.(...args);
921 }
922 return result2;
923 }
924 const result = theirHandler(...args);
925 ourHandler?.(...args);
926 return result;
927 };
928 }
929 function wrapEventHandler(handler) {
930 if (!handler) {
931 return handler;
932 }
933 return (...args) => {
934 const event = args[0];
935 if (isSyntheticEvent(event)) {
936 makeEventPreventable(event);
937 }
938 return handler(...args);
939 };
940 }
941 function makeEventPreventable(event) {
942 event.preventBaseUIHandler = () => {
943 event.baseUIHandlerPrevented = true;
944 };
945 return event;
946 }
947 function mergeClassNames(ourClassName, theirClassName) {
948 if (theirClassName) {
949 if (ourClassName) {
950 return theirClassName + " " + ourClassName;
951 }
952 return theirClassName;
953 }
954 return ourClassName;
955 }
956 function isSyntheticEvent(event) {
957 return event != null && typeof event === "object" && "nativeEvent" in event;
958 }
959
960 // node_modules/@base-ui/react/internals/useRenderElement.mjs
961 var import_react = __toESM(require_react(), 1);
962 function useRenderElement(element, componentProps, params = {}) {
963 let renderProp = componentProps.render;
964 if (params.enabled !== false) {
965 renderProp = unwrapLazyRenderProp(renderProp);
966 }
967 const outProps = useRenderElementProps(componentProps, params, renderProp);
968 if (params.enabled === false) {
969 return null;
970 }
971 const state = params.state ?? EMPTY_OBJECT;
972 return evaluateRenderProp(element, renderProp, outProps, state);
973 }
974 function useRenderElementProps(componentProps, params, renderProp) {
975 const {
976 className: classNameProp,
977 style: styleProp
978 } = componentProps;
979 const {
980 state = EMPTY_OBJECT,
981 ref,
982 props,
983 stateAttributesMapping: stateAttributesMapping3,
984 enabled = true
985 } = params;
986 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
987 const style = enabled ? resolveStyle(styleProp, state) : void 0;
988 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT;
989 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
990 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
991 if (typeof document !== "undefined") {
992 if (!enabled) {
993 void useMergedRefs(null, null);
994 } else if (Array.isArray(ref)) {
995 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
996 } else {
997 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
998 }
999 }
1000 if (!enabled) {
1001 return EMPTY_OBJECT;
1002 }
1003 if (className !== void 0) {
1004 outProps.className = mergeClassNames(outProps.className, className);
1005 }
1006 if (style !== void 0) {
1007 outProps.style = mergeObjects(outProps.style, style);
1008 }
1009 return outProps;
1010 }
1011 function resolveRenderFunctionProps(props) {
1012 if (Array.isArray(props)) {
1013 return mergePropsN(props);
1014 }
1015 return mergeProps(void 0, props);
1016 }
1017 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
1018 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
1019 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
1020 function unwrapLazyRenderProp(render4) {
1021 if (render4?.$$typeof !== REACT_LAZY_TYPE) {
1022 return render4;
1023 }
1024 const unwrapped = React7.Children.toArray(render4)[0];
1025 return /* @__PURE__ */ React7.isValidElement(unwrapped) ? unwrapped : render4;
1026 }
1027 function evaluateRenderProp(element, render4, props, state) {
1028 if (render4) {
1029 if (typeof render4 === "function") {
1030 if (true) {
1031 warnIfRenderPropLooksLikeComponent(render4);
1032 }
1033 return render4(props, state);
1034 }
1035 const mergedProps = mergeProps(props, render4.props);
1036 mergedProps.ref = props.ref;
1037 if (true) {
1038 if (!/* @__PURE__ */ React7.isValidElement(render4)) {
1039 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"));
1040 }
1041 }
1042 return /* @__PURE__ */ React7.cloneElement(render4, mergedProps);
1043 }
1044 if (element) {
1045 if (typeof element === "string") {
1046 return renderTag(element, props);
1047 }
1048 }
1049 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1050 }
1051 function warnIfRenderPropLooksLikeComponent(renderFn) {
1052 const functionName = renderFn.name;
1053 if (functionName.length === 0) {
1054 return;
1055 }
1056 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1057 return;
1058 }
1059 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1060 return;
1061 }
1062 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");
1063 }
1064 function renderTag(Tag, props) {
1065 if (Tag === "button") {
1066 return /* @__PURE__ */ (0, import_react.createElement)("button", {
1067 type: "button",
1068 ...props,
1069 key: props.key
1070 });
1071 }
1072 if (Tag === "img") {
1073 return /* @__PURE__ */ (0, import_react.createElement)("img", {
1074 alt: "",
1075 ...props,
1076 key: props.key
1077 });
1078 }
1079 return /* @__PURE__ */ React7.createElement(Tag, props);
1080 }
1081
1082 // node_modules/@base-ui/utils/useId.mjs
1083 var React8 = __toESM(require_react(), 1);
1084 var globalId = 0;
1085 function useGlobalId(idOverride, prefix2 = "mui") {
1086 const [defaultId, setDefaultId] = React8.useState(idOverride);
1087 const id = idOverride || defaultId;
1088 React8.useEffect(() => {
1089 if (defaultId == null) {
1090 globalId += 1;
1091 setDefaultId(`${prefix2}-${globalId}`);
1092 }
1093 }, [defaultId, prefix2]);
1094 return id;
1095 }
1096 var maybeReactUseId = SafeReact.useId;
1097 function useId(idOverride, prefix2) {
1098 if (maybeReactUseId !== void 0) {
1099 const reactId = maybeReactUseId();
1100 return idOverride ?? (prefix2 ? `${prefix2}-${reactId}` : reactId);
1101 }
1102 return useGlobalId(idOverride, prefix2);
1103 }
1104
1105 // node_modules/@base-ui/react/internals/useBaseUiId.mjs
1106 function useBaseUiId(idOverride) {
1107 return useId(idOverride, "base-ui");
1108 }
1109
1110 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
1111 var React11 = __toESM(require_react(), 1);
1112
1113 // node_modules/@base-ui/react/internals/reason-parts.mjs
1114 var reason_parts_exports = {};
1115 __export(reason_parts_exports, {
1116 cancelOpen: () => cancelOpen,
1117 chipRemovePress: () => chipRemovePress,
1118 clearPress: () => clearPress,
1119 closePress: () => closePress,
1120 closeWatcher: () => closeWatcher,
1121 decrementPress: () => decrementPress,
1122 disabled: () => disabled,
1123 drag: () => drag,
1124 escapeKey: () => escapeKey,
1125 focusOut: () => focusOut,
1126 imperativeAction: () => imperativeAction,
1127 incrementPress: () => incrementPress,
1128 initial: () => initial,
1129 inputBlur: () => inputBlur,
1130 inputChange: () => inputChange,
1131 inputClear: () => inputClear,
1132 inputPaste: () => inputPaste,
1133 inputPress: () => inputPress,
1134 itemPress: () => itemPress,
1135 keyboard: () => keyboard,
1136 linkPress: () => linkPress,
1137 listNavigation: () => listNavigation,
1138 missing: () => missing,
1139 none: () => none,
1140 outsidePress: () => outsidePress,
1141 pointer: () => pointer,
1142 scrub: () => scrub,
1143 siblingOpen: () => siblingOpen,
1144 swipe: () => swipe,
1145 trackPress: () => trackPress,
1146 triggerFocus: () => triggerFocus,
1147 triggerHover: () => triggerHover,
1148 triggerPress: () => triggerPress,
1149 wheel: () => wheel,
1150 windowResize: () => windowResize
1151 });
1152 var none = "none";
1153 var triggerPress = "trigger-press";
1154 var triggerHover = "trigger-hover";
1155 var triggerFocus = "trigger-focus";
1156 var outsidePress = "outside-press";
1157 var itemPress = "item-press";
1158 var closePress = "close-press";
1159 var linkPress = "link-press";
1160 var clearPress = "clear-press";
1161 var chipRemovePress = "chip-remove-press";
1162 var trackPress = "track-press";
1163 var incrementPress = "increment-press";
1164 var decrementPress = "decrement-press";
1165 var inputChange = "input-change";
1166 var inputClear = "input-clear";
1167 var inputBlur = "input-blur";
1168 var inputPaste = "input-paste";
1169 var inputPress = "input-press";
1170 var focusOut = "focus-out";
1171 var escapeKey = "escape-key";
1172 var closeWatcher = "close-watcher";
1173 var listNavigation = "list-navigation";
1174 var keyboard = "keyboard";
1175 var pointer = "pointer";
1176 var drag = "drag";
1177 var wheel = "wheel";
1178 var scrub = "scrub";
1179 var cancelOpen = "cancel-open";
1180 var siblingOpen = "sibling-open";
1181 var disabled = "disabled";
1182 var missing = "missing";
1183 var initial = "initial";
1184 var imperativeAction = "imperative-action";
1185 var swipe = "swipe";
1186 var windowResize = "window-resize";
1187
1188 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
1189 function createChangeEventDetails(reason, event, trigger, customProperties) {
1190 let canceled = false;
1191 let allowPropagation = false;
1192 const custom = customProperties ?? EMPTY_OBJECT;
1193 const details = {
1194 reason,
1195 event: event ?? new Event("base-ui"),
1196 cancel() {
1197 canceled = true;
1198 },
1199 allowPropagation() {
1200 allowPropagation = true;
1201 },
1202 get isCanceled() {
1203 return canceled;
1204 },
1205 get isPropagationAllowed() {
1206 return allowPropagation;
1207 },
1208 trigger,
1209 ...custom
1210 };
1211 return details;
1212 }
1213
1214 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1215 var React10 = __toESM(require_react(), 1);
1216
1217 // node_modules/@base-ui/utils/useOnMount.mjs
1218 var React9 = __toESM(require_react(), 1);
1219 function useOnMount(fn) {
1220 React9.useEffect(fn, EMPTY_ARRAY);
1221 }
1222
1223 // node_modules/@base-ui/utils/useAnimationFrame.mjs
1224 var EMPTY = null;
1225 var LAST_RAF = globalThis.requestAnimationFrame;
1226 var Scheduler = class {
1227 /* This implementation uses an array as a backing data-structure for frame callbacks.
1228 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1229 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1230 * be much more efficient if there is a call pattern that alterns as
1231 * "request-cancel-request-cancel-…".
1232 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1233 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1234 callbacks = [];
1235 callbacksCount = 0;
1236 nextId = 1;
1237 startId = 1;
1238 isScheduled = false;
1239 tick = (timestamp) => {
1240 this.isScheduled = false;
1241 const currentCallbacks = this.callbacks;
1242 const currentCallbacksCount = this.callbacksCount;
1243 this.callbacks = [];
1244 this.callbacksCount = 0;
1245 this.startId = this.nextId;
1246 if (currentCallbacksCount > 0) {
1247 for (let i = 0; i < currentCallbacks.length; i += 1) {
1248 currentCallbacks[i]?.(timestamp);
1249 }
1250 }
1251 };
1252 request(fn) {
1253 const id = this.nextId;
1254 this.nextId += 1;
1255 this.callbacks.push(fn);
1256 this.callbacksCount += 1;
1257 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1258 if (!this.isScheduled || didRAFChange) {
1259 requestAnimationFrame(this.tick);
1260 this.isScheduled = true;
1261 }
1262 return id;
1263 }
1264 cancel(id) {
1265 const index2 = id - this.startId;
1266 if (index2 < 0 || index2 >= this.callbacks.length) {
1267 return;
1268 }
1269 if (this.callbacks[index2] === null) {
1270 return;
1271 }
1272 this.callbacks[index2] = null;
1273 this.callbacksCount -= 1;
1274 }
1275 };
1276 var scheduler = new Scheduler();
1277 var AnimationFrame = class _AnimationFrame {
1278 static create() {
1279 return new _AnimationFrame();
1280 }
1281 static request(fn) {
1282 return scheduler.request(fn);
1283 }
1284 static cancel(id) {
1285 return scheduler.cancel(id);
1286 }
1287 currentId = EMPTY;
1288 /**
1289 * Executes `fn` after `delay`, clearing any previously scheduled call.
1290 */
1291 request(fn) {
1292 this.cancel();
1293 this.currentId = scheduler.request(() => {
1294 this.currentId = EMPTY;
1295 fn();
1296 });
1297 }
1298 cancel = () => {
1299 if (this.currentId !== EMPTY) {
1300 scheduler.cancel(this.currentId);
1301 this.currentId = EMPTY;
1302 }
1303 };
1304 disposeEffect = () => {
1305 return this.cancel;
1306 };
1307 };
1308 function useAnimationFrame() {
1309 const timeout = useRefWithInit(AnimationFrame.create).current;
1310 useOnMount(timeout.disposeEffect);
1311 return timeout;
1312 }
1313
1314 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1315 function useTransitionStatus(open3, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) {
1316 const [transitionStatus, setTransitionStatus] = React10.useState(open3 && enableIdleState ? "idle" : void 0);
1317 const [mounted, setMounted] = React10.useState(open3 && !animateInitialOpen);
1318 if (open3 && !mounted) {
1319 setMounted(true);
1320 setTransitionStatus("starting");
1321 }
1322 if (!open3 && mounted && transitionStatus !== "ending" && !deferEndingState) {
1323 setTransitionStatus("ending");
1324 }
1325 if (!open3 && !mounted && transitionStatus === "ending") {
1326 setTransitionStatus(void 0);
1327 }
1328 useIsoLayoutEffect(() => {
1329 if (!open3 && mounted && transitionStatus !== "ending" && deferEndingState) {
1330 const frame = AnimationFrame.request(() => {
1331 setTransitionStatus("ending");
1332 });
1333 return () => {
1334 AnimationFrame.cancel(frame);
1335 };
1336 }
1337 return void 0;
1338 }, [open3, mounted, transitionStatus, deferEndingState]);
1339 useIsoLayoutEffect(() => {
1340 if (!open3 || enableIdleState) {
1341 return void 0;
1342 }
1343 const frame = AnimationFrame.request(() => {
1344 setTransitionStatus(void 0);
1345 });
1346 return () => {
1347 AnimationFrame.cancel(frame);
1348 };
1349 }, [enableIdleState, open3]);
1350 useIsoLayoutEffect(() => {
1351 if (!open3 || !enableIdleState) {
1352 return void 0;
1353 }
1354 if (open3 && mounted && transitionStatus !== "idle") {
1355 setTransitionStatus("starting");
1356 }
1357 const frame = AnimationFrame.request(() => {
1358 setTransitionStatus("idle");
1359 });
1360 return () => {
1361 AnimationFrame.cancel(frame);
1362 };
1363 }, [enableIdleState, open3, mounted, transitionStatus]);
1364 return {
1365 mounted,
1366 setMounted,
1367 transitionStatus
1368 };
1369 }
1370
1371 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
1372 function useCollapsibleRoot(parameters) {
1373 const {
1374 open: openParam,
1375 defaultOpen = false,
1376 onOpenChange,
1377 disabled: disabled2
1378 } = parameters;
1379 const [open3, setOpen] = useControlled({
1380 controlled: openParam,
1381 default: defaultOpen,
1382 name: "Collapsible",
1383 state: "open"
1384 });
1385 const {
1386 mounted,
1387 setMounted,
1388 transitionStatus
1389 } = useTransitionStatus(open3, true, true);
1390 const defaultPanelId = useBaseUiId();
1391 const [registeredPanelId, setPanelIdState] = React11.useState();
1392 const panelId = registeredPanelId === null ? void 0 : registeredPanelId ?? defaultPanelId;
1393 const handleTrigger = useStableCallback((event) => {
1394 const nextOpen = !open3;
1395 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent);
1396 onOpenChange(nextOpen, eventDetails);
1397 if (eventDetails.isCanceled) {
1398 return;
1399 }
1400 setOpen(nextOpen);
1401 });
1402 return React11.useMemo(() => ({
1403 defaultPanelId,
1404 disabled: disabled2,
1405 handleTrigger,
1406 mounted,
1407 open: open3,
1408 panelId,
1409 setMounted,
1410 setOpen,
1411 setPanelIdState,
1412 transitionStatus
1413 }), [defaultPanelId, disabled2, handleTrigger, mounted, open3, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);
1414 }
1415
1416 // node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs
1417 var React12 = __toESM(require_react(), 1);
1418 var CollapsibleRootContext = /* @__PURE__ */ React12.createContext(void 0);
1419 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext";
1420 function useCollapsibleRootContext() {
1421 const context = React12.useContext(CollapsibleRootContext);
1422 if (context === void 0) {
1423 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15));
1424 }
1425 return context;
1426 }
1427
1428 // node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs
1429 var TransitionStatusDataAttributes_exports = {};
1430 __export(TransitionStatusDataAttributes_exports, {
1431 endingStyle: () => endingStyle,
1432 startingStyle: () => startingStyle
1433 });
1434 var startingStyle = "data-starting-style";
1435 var endingStyle = "data-ending-style";
1436
1437 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
1438 var STARTING_HOOK = {
1439 [startingStyle]: ""
1440 };
1441 var ENDING_HOOK = {
1442 [endingStyle]: ""
1443 };
1444 var transitionStatusMapping = {
1445 transitionStatus(value) {
1446 if (value === "starting") {
1447 return STARTING_HOOK;
1448 }
1449 if (value === "ending") {
1450 return ENDING_HOOK;
1451 }
1452 return null;
1453 }
1454 };
1455
1456 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs
1457 var open = "data-open";
1458 var closed = "data-closed";
1459 var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle;
1460 var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle;
1461
1462 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs
1463 var panelOpen = "data-panel-open";
1464
1465 // node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs
1466 var PANEL_OPEN_HOOK = {
1467 [open]: ""
1468 };
1469 var PANEL_CLOSED_HOOK = {
1470 [closed]: ""
1471 };
1472 var triggerOpenStateMapping = {
1473 open(value) {
1474 if (value) {
1475 return {
1476 [panelOpen]: ""
1477 };
1478 }
1479 return null;
1480 }
1481 };
1482 var collapsibleOpenStateMapping = {
1483 open(value) {
1484 if (value) {
1485 return PANEL_OPEN_HOOK;
1486 }
1487 return PANEL_CLOSED_HOOK;
1488 }
1489 };
1490
1491 // node_modules/@base-ui/react/internals/use-button/useButton.mjs
1492 var React15 = __toESM(require_react(), 1);
1493
1494 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1495 function hasWindow() {
1496 return typeof window !== "undefined";
1497 }
1498 function getNodeName(node) {
1499 if (isNode(node)) {
1500 return (node.nodeName || "").toLowerCase();
1501 }
1502 return "#document";
1503 }
1504 function getWindow(node) {
1505 var _node$ownerDocument;
1506 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1507 }
1508 function getDocumentElement(node) {
1509 var _ref;
1510 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1511 }
1512 function isNode(value) {
1513 if (!hasWindow()) {
1514 return false;
1515 }
1516 return value instanceof Node || value instanceof getWindow(value).Node;
1517 }
1518 function isElement(value) {
1519 if (!hasWindow()) {
1520 return false;
1521 }
1522 return value instanceof Element || value instanceof getWindow(value).Element;
1523 }
1524 function isHTMLElement(value) {
1525 if (!hasWindow()) {
1526 return false;
1527 }
1528 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1529 }
1530 function isShadowRoot(value) {
1531 if (!hasWindow() || typeof ShadowRoot === "undefined") {
1532 return false;
1533 }
1534 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1535 }
1536 function isOverflowElement(element) {
1537 const {
1538 overflow,
1539 overflowX,
1540 overflowY,
1541 display
1542 } = getComputedStyle2(element);
1543 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1544 }
1545 function isTableElement(element) {
1546 return /^(table|td|th)$/.test(getNodeName(element));
1547 }
1548 function isTopLayer(element) {
1549 try {
1550 if (element.matches(":popover-open")) {
1551 return true;
1552 }
1553 } catch (_e) {
1554 }
1555 try {
1556 return element.matches(":modal");
1557 } catch (_e) {
1558 return false;
1559 }
1560 }
1561 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1562 var containRe = /paint|layout|strict|content/;
1563 var isNotNone = (value) => !!value && value !== "none";
1564 var isWebKitValue;
1565 function isContainingBlock(elementOrCss) {
1566 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1567 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 || "");
1568 }
1569 function getContainingBlock(element) {
1570 let currentNode = getParentNode(element);
1571 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1572 if (isContainingBlock(currentNode)) {
1573 return currentNode;
1574 } else if (isTopLayer(currentNode)) {
1575 return null;
1576 }
1577 currentNode = getParentNode(currentNode);
1578 }
1579 return null;
1580 }
1581 function isWebKit() {
1582 if (isWebKitValue == null) {
1583 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1584 }
1585 return isWebKitValue;
1586 }
1587 function isLastTraversableNode(node) {
1588 return /^(html|body|#document)$/.test(getNodeName(node));
1589 }
1590 function getComputedStyle2(element) {
1591 return getWindow(element).getComputedStyle(element);
1592 }
1593 function getNodeScroll(element) {
1594 if (isElement(element)) {
1595 return {
1596 scrollLeft: element.scrollLeft,
1597 scrollTop: element.scrollTop
1598 };
1599 }
1600 return {
1601 scrollLeft: element.scrollX,
1602 scrollTop: element.scrollY
1603 };
1604 }
1605 function getParentNode(node) {
1606 if (getNodeName(node) === "html") {
1607 return node;
1608 }
1609 const result = (
1610 // Step into the shadow DOM of the parent of a slotted node.
1611 node.assignedSlot || // DOM Element detected.
1612 node.parentNode || // ShadowRoot detected.
1613 isShadowRoot(node) && node.host || // Fallback.
1614 getDocumentElement(node)
1615 );
1616 return isShadowRoot(result) ? result.host : result;
1617 }
1618 function getNearestOverflowAncestor(node) {
1619 const parentNode = getParentNode(node);
1620 if (isLastTraversableNode(parentNode)) {
1621 return (node.ownerDocument || node).body;
1622 }
1623 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1624 return parentNode;
1625 }
1626 return getNearestOverflowAncestor(parentNode);
1627 }
1628 function getOverflowAncestors(node, list, traverseIframes) {
1629 var _node$ownerDocument2;
1630 if (list === void 0) {
1631 list = [];
1632 }
1633 if (traverseIframes === void 0) {
1634 traverseIframes = true;
1635 }
1636 const scrollableAncestor = getNearestOverflowAncestor(node);
1637 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1638 const win = getWindow(scrollableAncestor);
1639 if (isBody) {
1640 const frameElement = getFrameElement(win);
1641 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1642 } else {
1643 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1644 }
1645 }
1646 function getFrameElement(win) {
1647 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1648 }
1649
1650 // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs
1651 var React13 = __toESM(require_react(), 1);
1652 var CompositeRootContext = /* @__PURE__ */ React13.createContext(void 0);
1653 if (true) CompositeRootContext.displayName = "CompositeRootContext";
1654 function useCompositeRootContext(optional = false) {
1655 const context = React13.useContext(CompositeRootContext);
1656 if (context === void 0 && !optional) {
1657 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
1658 }
1659 return context;
1660 }
1661
1662 // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs
1663 var React14 = __toESM(require_react(), 1);
1664 function useFocusableWhenDisabled(parameters) {
1665 const {
1666 focusableWhenDisabled,
1667 disabled: disabled2,
1668 composite = false,
1669 tabIndex: tabIndexProp = 0,
1670 isNativeButton
1671 } = parameters;
1672 const isFocusableComposite = composite && focusableWhenDisabled !== false;
1673 const isNonFocusableComposite = composite && focusableWhenDisabled === false;
1674 const props = React14.useMemo(() => {
1675 const additionalProps = {
1676 // allow Tabbing away from focusableWhenDisabled elements
1677 onKeyDown(event) {
1678 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
1679 event.preventDefault();
1680 }
1681 }
1682 };
1683 if (!composite) {
1684 additionalProps.tabIndex = tabIndexProp;
1685 if (!isNativeButton && disabled2) {
1686 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
1687 }
1688 }
1689 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
1690 additionalProps["aria-disabled"] = disabled2;
1691 }
1692 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
1693 additionalProps.disabled = disabled2;
1694 }
1695 return additionalProps;
1696 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
1697 return {
1698 props
1699 };
1700 }
1701
1702 // node_modules/@base-ui/utils/owner.mjs
1703 function ownerDocument(node) {
1704 return node?.ownerDocument || document;
1705 }
1706
1707 // node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs
1708 function dispatchClickWithModifiers(target, sourceEvent, {
1709 detail = 0
1710 } = {}) {
1711 target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
1712 bubbles: true,
1713 cancelable: true,
1714 composed: true,
1715 detail,
1716 shiftKey: sourceEvent.shiftKey,
1717 ctrlKey: sourceEvent.ctrlKey,
1718 altKey: sourceEvent.altKey,
1719 metaKey: sourceEvent.metaKey
1720 }));
1721 }
1722
1723 // node_modules/@base-ui/react/internals/use-button/useButton.mjs
1724 function useButton(parameters = {}) {
1725 const {
1726 disabled: disabled2 = false,
1727 focusableWhenDisabled,
1728 tabIndex = 0,
1729 native: isNativeButton = true,
1730 composite: compositeProp
1731 } = parameters;
1732 const elementRef = React15.useRef(null);
1733 const compositeRootContext = useCompositeRootContext(true);
1734 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
1735 const {
1736 props: focusableWhenDisabledProps
1737 } = useFocusableWhenDisabled({
1738 focusableWhenDisabled,
1739 disabled: disabled2,
1740 composite: isCompositeItem,
1741 tabIndex,
1742 isNativeButton
1743 });
1744 if (true) {
1745 React15.useEffect(() => {
1746 if (!elementRef.current) {
1747 return;
1748 }
1749 const isButtonTag = isButtonElement(elementRef.current);
1750 if (isNativeButton) {
1751 if (!isButtonTag) {
1752 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1753 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`.";
1754 error(`${message2}${ownerStackMessage}`);
1755 }
1756 } else if (isButtonTag) {
1757 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1758 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`.";
1759 error(`${message2}${ownerStackMessage}`);
1760 }
1761 }, [isNativeButton]);
1762 }
1763 const updateDisabled = React15.useCallback(() => {
1764 const element = elementRef.current;
1765 if (!isButtonElement(element)) {
1766 return;
1767 }
1768 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
1769 element.disabled = false;
1770 }
1771 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]);
1772 useIsoLayoutEffect(updateDisabled, [updateDisabled]);
1773 const getButtonProps = React15.useCallback((externalProps = {}) => {
1774 const {
1775 onClick: externalOnClick,
1776 onMouseDown: externalOnMouseDown,
1777 onKeyUp: externalOnKeyUp,
1778 onKeyDown: externalOnKeyDown,
1779 onPointerDown: externalOnPointerDown,
1780 ...otherExternalProps
1781 } = externalProps;
1782 return mergeProps({
1783 onClick(event) {
1784 if (disabled2) {
1785 event.preventDefault();
1786 return;
1787 }
1788 externalOnClick?.(event);
1789 },
1790 onMouseDown(event) {
1791 if (!disabled2) {
1792 externalOnMouseDown?.(event);
1793 }
1794 },
1795 onKeyDown(event) {
1796 if (disabled2) {
1797 return;
1798 }
1799 makeEventPreventable(event);
1800 externalOnKeyDown?.(event);
1801 if (event.baseUIHandlerPrevented) {
1802 return;
1803 }
1804 const isCurrentTarget = event.target === event.currentTarget;
1805 const currentTarget = event.currentTarget;
1806 const isButton = isButtonElement(currentTarget);
1807 const isLink = !isNativeButton && isValidLinkElement(currentTarget);
1808 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
1809 const isEnterKey = event.key === "Enter";
1810 const isSpaceKey = event.key === " ";
1811 const role = currentTarget.getAttribute("role");
1812 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
1813 if (isCurrentTarget && isCompositeItem && isSpaceKey) {
1814 if (event.defaultPrevented && isTextNavigationRole) {
1815 return;
1816 }
1817 event.preventDefault();
1818 if (!isNativeButton || isButton) {
1819 event.preventBaseUIHandler();
1820 dispatchClickWithModifiers(currentTarget, event);
1821 }
1822 return;
1823 }
1824 if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
1825 if (isCurrentTarget && isLink && isSpaceKey) {
1826 event.preventDefault();
1827 }
1828 return;
1829 }
1830 if (event.defaultPrevented) {
1831 return;
1832 }
1833 event.preventDefault();
1834 if (isEnterKey) {
1835 event.preventBaseUIHandler();
1836 dispatchClickWithModifiers(currentTarget, event);
1837 }
1838 },
1839 onKeyUp(event) {
1840 if (disabled2) {
1841 return;
1842 }
1843 makeEventPreventable(event);
1844 externalOnKeyUp?.(event);
1845 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
1846 event.preventDefault();
1847 return;
1848 }
1849 if (event.baseUIHandlerPrevented) {
1850 return;
1851 }
1852 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") {
1853 event.preventBaseUIHandler();
1854 dispatchClickWithModifiers(event.currentTarget, event);
1855 }
1856 },
1857 onPointerDown(event) {
1858 if (disabled2) {
1859 event.preventDefault();
1860 return;
1861 }
1862 externalOnPointerDown?.(event);
1863 }
1864 }, isNativeButton ? {
1865 type: "button"
1866 } : {
1867 role: "button"
1868 }, focusableWhenDisabledProps, otherExternalProps);
1869 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
1870 const buttonRef = useStableCallback((element) => {
1871 elementRef.current = element;
1872 updateDisabled();
1873 });
1874 return {
1875 getButtonProps,
1876 buttonRef
1877 };
1878 }
1879 function isButtonElement(elem) {
1880 return isHTMLElement(elem) && elem.tagName === "BUTTON";
1881 }
1882 function isValidLinkElement(elem) {
1883 return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href);
1884 }
1885
1886 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs
1887 var React17 = __toESM(require_react(), 1);
1888
1889 // node_modules/@base-ui/utils/addEventListener.mjs
1890 function addEventListener(target, type, listener, options) {
1891 target.addEventListener(type, listener, options);
1892 return () => {
1893 target.removeEventListener(type, listener, options);
1894 };
1895 }
1896
1897 // node_modules/@base-ui/utils/useValueAsRef.mjs
1898 function useValueAsRef(value) {
1899 const latest = useRefWithInit(createLatestRef, value).current;
1900 latest.next = value;
1901 useIsoLayoutEffect(latest.effect);
1902 return latest;
1903 }
1904 function createLatestRef(value) {
1905 const latest = {
1906 current: value,
1907 next: value,
1908 effect: () => {
1909 latest.current = latest.next;
1910 }
1911 };
1912 return latest;
1913 }
1914
1915 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1916 var React16 = __toESM(require_react(), 1);
1917
1918 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1919 var ReactDOM = __toESM(require_react_dom(), 1);
1920
1921 // node_modules/@base-ui/react/utils/resolveRef.mjs
1922 function resolveRef(maybeRef) {
1923 if (maybeRef == null) {
1924 return maybeRef;
1925 }
1926 return "current" in maybeRef ? maybeRef.current : maybeRef;
1927 }
1928
1929 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1930 var pendingCallbacks = null;
1931 function flushBeforePaint(fn) {
1932 if (!pendingCallbacks) {
1933 const callbacks = [];
1934 pendingCallbacks = callbacks;
1935 queueMicrotask(() => {
1936 pendingCallbacks = null;
1937 ReactDOM.flushSync(() => {
1938 for (const callback of callbacks) {
1939 callback();
1940 }
1941 });
1942 });
1943 }
1944 pendingCallbacks.push(fn);
1945 }
1946 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) {
1947 const frame = useAnimationFrame();
1948 return useStableCallback((fnToExecute, signal = null) => {
1949 frame.cancel();
1950 const element = resolveRef(elementOrRef);
1951 if (element == null) {
1952 return;
1953 }
1954 const resolvedElement = element;
1955 const done = () => {
1956 if (!batch) {
1957 ReactDOM.flushSync(fnToExecute);
1958 return;
1959 }
1960 flushBeforePaint(() => {
1961 if (!signal?.aborted) {
1962 fnToExecute();
1963 }
1964 });
1965 };
1966 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1967 fnToExecute();
1968 return;
1969 }
1970 function exec() {
1971 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1972 if (!signal?.aborted) {
1973 done();
1974 }
1975 }, () => {
1976 if (signal?.aborted) {
1977 return;
1978 }
1979 const currentAnimations = resolvedElement.getAnimations();
1980 if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1981 exec();
1982 return;
1983 }
1984 done();
1985 });
1986 }
1987 if (waitForStartingStyleRemoved) {
1988 const startingStyleAttribute = startingStyle;
1989 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1990 frame.request(exec);
1991 return;
1992 }
1993 const attributeObserver = new MutationObserver(() => {
1994 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1995 attributeObserver.disconnect();
1996 exec();
1997 }
1998 });
1999 attributeObserver.observe(resolvedElement, {
2000 attributes: true,
2001 attributeFilter: [startingStyleAttribute]
2002 });
2003 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
2004 once: true
2005 });
2006 return;
2007 }
2008 frame.request(exec);
2009 });
2010 }
2011
2012 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
2013 function useOpenChangeComplete(parameters) {
2014 const {
2015 enabled = true,
2016 open: open3,
2017 ref,
2018 batch = false,
2019 onComplete: onCompleteParam
2020 } = parameters;
2021 const onComplete = useStableCallback(onCompleteParam);
2022 const runOnceAnimationsFinish = useAnimationsFinished(ref, open3, batch);
2023 React16.useEffect(() => {
2024 if (!enabled) {
2025 return void 0;
2026 }
2027 const abortController = new AbortController();
2028 runOnceAnimationsFinish(onComplete, abortController.signal);
2029 return () => {
2030 abortController.abort();
2031 };
2032 }, [enabled, open3, onComplete, runOnceAnimationsFinish]);
2033 }
2034
2035 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs
2036 var EMPTY_DIMENSIONS = {
2037 height: void 0,
2038 width: void 0
2039 };
2040 function useCollapsiblePanel(parameters) {
2041 const {
2042 externalRef,
2043 hiddenUntilFound,
2044 id: idParam,
2045 keepMounted,
2046 mounted,
2047 onOpenChange,
2048 open: open3,
2049 setMounted,
2050 setOpen,
2051 transitionStatus
2052 } = parameters;
2053 const panelRef = React17.useRef(null);
2054 const animationTypeRef = React17.useRef(null);
2055 const [dimensions, setDimensionsUnwrapped] = React17.useState(EMPTY_DIMENSIONS);
2056 const lastMeasuredDimensionsRef = React17.useRef(EMPTY_DIMENSIONS);
2057 const shouldSkipNextOpenRef = React17.useRef(false);
2058 const shouldPreventMountAnimationRef = React17.useRef(open3);
2059 const shouldPreventActivityResumeAnimationRef = React17.useRef(false);
2060 const [forcePanelIdle, setForcePanelIdle] = React17.useState(false);
2061 const pendingTemporaryStyleRestoreRef = React17.useRef(null);
2062 const mergedPanelRef = useMergedRefs(externalRef, panelRef);
2063 const latestOpenRef = useValueAsRef(open3);
2064 const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef);
2065 const hidden = !open3 && !mounted;
2066 const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus;
2067 const shouldPreventOpenAnimation = open3 && // These 2 refs are safe to read in render, they are only written from committed
2068 // layout/effect paths and gate one-shot motion suppression for the next open
2069 // lifecycle. They intentionally expose the last committed motion snapshot.
2070 (shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current);
2071 const renderedDimensions = !open3 && mounted && // These 2 refs are also safe to read in render, both hold the last committed
2072 // animation mode and measurement. This fallback only restores a previously
2073 // measured pixel size after the live dimensions state has been reset back to `auto`.
2074 animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions;
2075 const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation";
2076 const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => {
2077 if (shouldCacheMeasurement) {
2078 lastMeasuredDimensionsRef.current = nextDimensions;
2079 }
2080 setDimensionsUnwrapped(nextDimensions);
2081 });
2082 const restorePendingTemporaryStyle = useStableCallback(() => {
2083 pendingTemporaryStyleRestoreRef.current?.();
2084 pendingTemporaryStyleRestoreRef.current = null;
2085 });
2086 const setPendingTemporaryStyleRestore = useStableCallback((restore) => {
2087 restorePendingTemporaryStyle();
2088 pendingTemporaryStyleRestoreRef.current = () => {
2089 pendingTemporaryStyleRestoreRef.current = null;
2090 restore();
2091 };
2092 });
2093 const markActivityResumeAnimationSuppressed = useStableCallback(() => {
2094 if (open3 && mounted && animationTypeRef.current === "css-animation") {
2095 shouldPreventActivityResumeAnimationRef.current = true;
2096 }
2097 });
2098 useIsoLayoutEffect(() => {
2099 if (!forcePanelIdle || transitionStatus === "starting") {
2100 return;
2101 }
2102 setForcePanelIdle(false);
2103 }, [forcePanelIdle, transitionStatus]);
2104 React17.useEffect(() => {
2105 return () => {
2106 markActivityResumeAnimationSuppressed();
2107 restorePendingTemporaryStyle();
2108 };
2109 }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]);
2110 useIsoLayoutEffect(() => {
2111 const panel = panelRef.current;
2112 if (!panel) {
2113 return void 0;
2114 }
2115 if (!open3 && pendingTemporaryStyleRestoreRef.current) {
2116 restorePendingTemporaryStyle();
2117 }
2118 const animationType = getAnimationType(panel, shouldPreventOpenAnimation);
2119 animationTypeRef.current = animationType;
2120 if (open3 && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") {
2121 lastMeasuredDimensionsRef.current = getDimensions(panel);
2122 return void 0;
2123 }
2124 if (open3 && transitionStatus === "starting") {
2125 const skipNextOpen = shouldSkipNextOpenRef.current;
2126 shouldSkipNextOpenRef.current = false;
2127 if (animationType === "none") {
2128 setDimensions(getDimensions(panel));
2129 setForcePanelIdle(true);
2130 return void 0;
2131 }
2132 if (animationType === "css-transition") {
2133 const restoreLayoutStyles = resetLayoutStyles(panel);
2134 setDimensions(getDimensions(panel));
2135 if (!skipNextOpen) {
2136 return restoreLayoutStyles;
2137 }
2138 const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s");
2139 setPendingTemporaryStyleRestore(restoreTransitionDuration);
2140 setForcePanelIdle(true);
2141 return restoreLayoutStyles;
2142 }
2143 setDimensions(getDimensions(panel));
2144 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none");
2145 if (!skipNextOpen) {
2146 restoreAnimationName();
2147 return void 0;
2148 }
2149 const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s");
2150 restoreAnimationName();
2151 setPendingTemporaryStyleRestore(restoreAnimationDuration);
2152 setForcePanelIdle(true);
2153 return void 0;
2154 }
2155 if (!open3 && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) {
2156 shouldPreventMountAnimationRef.current = false;
2157 shouldPreventActivityResumeAnimationRef.current = false;
2158 if (animationType === "none") {
2159 setDimensions(EMPTY_DIMENSIONS, false);
2160 setMounted(false);
2161 return void 0;
2162 }
2163 setDimensions(getDimensions(panel));
2164 return void 0;
2165 }
2166 if (transitionStatus !== "ending") {
2167 return void 0;
2168 }
2169 if (animationType === "none") {
2170 setMounted(false);
2171 return void 0;
2172 }
2173 const nextDimensions = getDimensions(panel);
2174 const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0;
2175 if (!hasMeasuredSize) {
2176 setMounted(false);
2177 return void 0;
2178 }
2179 setDimensions(nextDimensions);
2180 if (animationType === "css-animation") {
2181 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none");
2182 restoreAnimationName();
2183 }
2184 return void 0;
2185 }, [mounted, open3, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]);
2186 useOpenChangeComplete({
2187 enabled: open3 && mounted && panelTransitionStatus === "idle",
2188 open: true,
2189 ref: panelRef,
2190 onComplete() {
2191 if (!open3) {
2192 return;
2193 }
2194 setDimensions(EMPTY_DIMENSIONS, false);
2195 }
2196 });
2197 React17.useEffect(() => {
2198 if (open3 || !mounted || panelTransitionStatus !== "ending") {
2199 return void 0;
2200 }
2201 const panel = panelRef.current;
2202 if (!panel) {
2203 return void 0;
2204 }
2205 const abortController = new AbortController();
2206 let endingStyleFrame = -1;
2207 function handleComplete() {
2208 if (latestOpenRef.current) {
2209 return;
2210 }
2211 setMounted(false);
2212 setDimensions(EMPTY_DIMENSIONS, false);
2213 }
2214 endingStyleFrame = AnimationFrame.request(() => {
2215 runOnceCloseAnimationsFinish(handleComplete, abortController.signal);
2216 });
2217 return () => {
2218 AnimationFrame.cancel(endingStyleFrame);
2219 abortController.abort();
2220 };
2221 }, [latestOpenRef, mounted, open3, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]);
2222 useIsoLayoutEffect(() => {
2223 const panel = panelRef.current;
2224 if (!panel || !hiddenUntilFound || !hidden) {
2225 return;
2226 }
2227 panel.setAttribute("hidden", "until-found");
2228 }, [hidden, hiddenUntilFound]);
2229 React17.useEffect(function registerBeforeMatchListener() {
2230 const panel = panelRef.current;
2231 if (!panel) {
2232 return void 0;
2233 }
2234 function handleBeforeMatch(event) {
2235 const eventDetails = createChangeEventDetails(reason_parts_exports.none, event);
2236 onOpenChange(true, eventDetails);
2237 if (eventDetails.isCanceled) {
2238 return;
2239 }
2240 shouldSkipNextOpenRef.current = true;
2241 setOpen(true);
2242 }
2243 return addEventListener(panel, "beforematch", handleBeforeMatch);
2244 }, [onOpenChange, setOpen]);
2245 const shouldRender = keepMounted || hiddenUntilFound || mounted || open3;
2246 return {
2247 height: renderedDimensions.height,
2248 props: {
2249 ...shouldPersistHiddenTransitionStyles ? {
2250 [startingStyle2]: ""
2251 } : void 0,
2252 hidden,
2253 id: idParam
2254 },
2255 ref: mergedPanelRef,
2256 shouldPreventOpenAnimation,
2257 shouldRender,
2258 transitionStatus: panelTransitionStatus,
2259 width: renderedDimensions.width
2260 };
2261 }
2262 function getDimensions(element) {
2263 return {
2264 height: element.scrollHeight,
2265 width: element.scrollWidth
2266 };
2267 }
2268 function getAnimationType(element, hasSuppressedMountAnimation) {
2269 const panelStyles = getWindow(element).getComputedStyle(element);
2270 const hasAnimation = (panelStyles.animationName.split(",").map((name) => name.trim()).some((name) => name !== "" && name !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration);
2271 const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration);
2272 if (hasAnimation && hasTransition) {
2273 if (true) {
2274 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.");
2275 }
2276 return "css-transition";
2277 }
2278 if (hasTransition) {
2279 return "css-transition";
2280 }
2281 if (hasAnimation) {
2282 return "css-animation";
2283 }
2284 return "none";
2285 }
2286 function hasNonZeroDuration(value) {
2287 return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0);
2288 }
2289 function setTemporaryStyle(element, property, value) {
2290 const previousValue = element.style.getPropertyValue(property);
2291 const previousPriority = element.style.getPropertyPriority(property);
2292 element.style.setProperty(property, value);
2293 return () => {
2294 if (previousValue === "") {
2295 element.style.removeProperty(property);
2296 return;
2297 }
2298 element.style.setProperty(property, previousValue, previousPriority);
2299 };
2300 }
2301 function resetLayoutStyles(element) {
2302 const originalLayoutStyles = {
2303 "justify-content": element.style.justifyContent,
2304 "align-items": element.style.alignItems,
2305 "align-content": element.style.alignContent,
2306 "justify-items": element.style.justifyItems
2307 };
2308 Object.keys(originalLayoutStyles).forEach((key) => {
2309 element.style.setProperty(key, "initial", "important");
2310 });
2311 function restoreLayoutStyles() {
2312 Object.entries(originalLayoutStyles).forEach(([key, value]) => {
2313 if (value === "") {
2314 element.style.removeProperty(key);
2315 return;
2316 }
2317 element.style.setProperty(key, value);
2318 });
2319 }
2320 const frame = AnimationFrame.request(restoreLayoutStyles);
2321 return () => {
2322 AnimationFrame.cancel(frame);
2323 restoreLayoutStyles();
2324 };
2325 }
2326
2327 // node_modules/@base-ui/utils/platform/parts.mjs
2328 var parts_exports = {};
2329 __export(parts_exports, {
2330 engine: () => engine_exports,
2331 env: () => env_exports,
2332 mediaQuery: () => media_query_exports,
2333 os: () => os_exports,
2334 screenReader: () => screen_reader_exports
2335 });
2336
2337 // node_modules/@base-ui/utils/platform/os.mjs
2338 var os_exports = {};
2339 __export(os_exports, {
2340 android: () => android,
2341 apple: () => apple,
2342 ios: () => ios,
2343 linux: () => linux,
2344 mac: () => mac,
2345 windows: () => windows
2346 });
2347
2348 // node_modules/@base-ui/utils/platform/shared.mjs
2349 function readRawData() {
2350 if (typeof navigator === "undefined") {
2351 return {
2352 userAgent: "",
2353 platform: "",
2354 maxTouchPoints: 0
2355 };
2356 }
2357 if (true) {
2358 const uaData = navigator.userAgentData;
2359 if (uaData && Array.isArray(uaData.brands)) {
2360 return {
2361 userAgent: uaData.brands.map(({
2362 brand,
2363 version: version2
2364 }) => `${brand}/${version2}`).join(" "),
2365 platform: uaData.platform ?? navigator.platform ?? "",
2366 maxTouchPoints: navigator.maxTouchPoints ?? 0
2367 };
2368 }
2369 }
2370 return {
2371 userAgent: navigator.userAgent,
2372 platform: navigator.platform ?? "",
2373 maxTouchPoints: navigator.maxTouchPoints ?? 0
2374 };
2375 }
2376 var {
2377 userAgent,
2378 platform,
2379 maxTouchPoints
2380 } = readRawData();
2381 var lowerUserAgent = userAgent.toLowerCase();
2382 var lowerPlatform = platform.toLowerCase();
2383
2384 // node_modules/@base-ui/utils/platform/os.mjs
2385 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
2386 var ANDROID_STRING = "android";
2387 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
2388 var mac = !ios && lowerPlatform.startsWith("mac");
2389 var windows = lowerPlatform.startsWith("win");
2390 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
2391 var apple = mac || ios;
2392
2393 // node_modules/@base-ui/utils/platform/engine.mjs
2394 var engine_exports = {};
2395 __export(engine_exports, {
2396 blink: () => blink,
2397 gecko: () => gecko,
2398 webkit: () => webkit
2399 });
2400 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
2401 var gecko = !webkit && lowerUserAgent.includes("firefox");
2402 var blink = !webkit && lowerUserAgent.includes("chrom");
2403
2404 // node_modules/@base-ui/utils/platform/screen-reader.mjs
2405 var screen_reader_exports = {};
2406 __export(screen_reader_exports, {
2407 voiceOver: () => voiceOver
2408 });
2409 var voiceOver = apple;
2410
2411 // node_modules/@base-ui/utils/platform/env.mjs
2412 var env_exports = {};
2413 __export(env_exports, {
2414 jsdom: () => jsdom
2415 });
2416 var jsdom = /jsdom|happydom/.test(lowerUserAgent);
2417
2418 // node_modules/@base-ui/utils/platform/media-query.mjs
2419 var media_query_exports = {};
2420 __export(media_query_exports, {
2421 iOS: () => iOS
2422 });
2423 var iOS = "@supports (-webkit-touch-callout: none)";
2424
2425 // node_modules/@base-ui/utils/useTimeout.mjs
2426 var EMPTY2 = 0;
2427 var Timeout = class _Timeout {
2428 static create() {
2429 return new _Timeout();
2430 }
2431 currentId = EMPTY2;
2432 /**
2433 * Executes `fn` after `delay`, clearing any previously scheduled call.
2434 */
2435 start(delay, fn) {
2436 this.clear();
2437 this.currentId = setTimeout(() => {
2438 this.currentId = EMPTY2;
2439 fn();
2440 }, delay);
2441 }
2442 isStarted() {
2443 return this.currentId !== EMPTY2;
2444 }
2445 clear = () => {
2446 if (this.currentId !== EMPTY2) {
2447 clearTimeout(this.currentId);
2448 this.currentId = EMPTY2;
2449 }
2450 };
2451 disposeEffect = () => {
2452 return this.clear;
2453 };
2454 };
2455 function useTimeout() {
2456 const timeout = useRefWithInit(Timeout.create).current;
2457 useOnMount(timeout.disposeEffect);
2458 return timeout;
2459 }
2460
2461 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2462 var React18 = __toESM(require_react(), 1);
2463
2464 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
2465 function isReactEvent(event) {
2466 return "nativeEvent" in event;
2467 }
2468 function isVirtualClick(event) {
2469 if (event.pointerType === "" && event.isTrusted) {
2470 return true;
2471 }
2472 if (parts_exports.os.android && event.pointerType) {
2473 return event.type === "click" && event.buttons === 1;
2474 }
2475 return event.detail === 0 && !event.pointerType;
2476 }
2477 function isMouseLikePointerType(pointerType, strict) {
2478 const values = ["mouse", "pen"];
2479 if (!strict) {
2480 values.push("", void 0);
2481 }
2482 return values.includes(pointerType);
2483 }
2484 function isClickLikeEvent(event) {
2485 const type = event.type;
2486 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
2487 }
2488
2489 // node_modules/@base-ui/utils/shadowDom.mjs
2490 function activeElement(doc) {
2491 let element = doc.activeElement;
2492 while (element?.shadowRoot?.activeElement != null) {
2493 element = element.shadowRoot.activeElement;
2494 }
2495 return element;
2496 }
2497 function contains(parent, child) {
2498 if (!parent || !child) {
2499 return false;
2500 }
2501 const rootNode = child.getRootNode?.();
2502 if (parent.contains(child)) {
2503 return true;
2504 }
2505 if (rootNode && isShadowRoot(rootNode)) {
2506 let next = child;
2507 while (next) {
2508 if (parent === next) {
2509 return true;
2510 }
2511 next = next.parentNode || next.host;
2512 }
2513 }
2514 return false;
2515 }
2516 function getTarget(event) {
2517 if ("composedPath" in event) {
2518 return event.composedPath()[0] ?? event.target;
2519 }
2520 return event.target;
2521 }
2522
2523 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
2524 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
2525 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
2526
2527 // node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs
2528 var open2 = "data-open";
2529 var closed2 = "data-closed";
2530 var anchorHidden = "data-anchor-hidden";
2531
2532 // node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs
2533 var CommonTriggerDataAttributes_exports = {};
2534 __export(CommonTriggerDataAttributes_exports, {
2535 popupOpen: () => popupOpen,
2536 pressed: () => pressed
2537 });
2538 var popupOpen = "data-popup-open";
2539 var pressed = "data-pressed";
2540
2541 // node_modules/@base-ui/react/utils/popupStateMapping.mjs
2542 var TRIGGER_HOOK = {
2543 [popupOpen]: ""
2544 };
2545 var PRESSABLE_TRIGGER_HOOK = {
2546 [popupOpen]: "",
2547 [pressed]: ""
2548 };
2549 var POPUP_OPEN_HOOK = {
2550 [open2]: ""
2551 };
2552 var POPUP_CLOSED_HOOK = {
2553 [closed2]: ""
2554 };
2555 var ANCHOR_HIDDEN_HOOK = {
2556 [anchorHidden]: ""
2557 };
2558 var triggerOpenStateMapping2 = {
2559 open(value) {
2560 if (value) {
2561 return TRIGGER_HOOK;
2562 }
2563 return null;
2564 }
2565 };
2566 var popupStateMapping = {
2567 open(value) {
2568 if (value) {
2569 return POPUP_OPEN_HOOK;
2570 }
2571 return POPUP_CLOSED_HOOK;
2572 },
2573 anchorHidden(value) {
2574 if (value) {
2575 return ANCHOR_HIDDEN_HOOK;
2576 }
2577 return null;
2578 }
2579 };
2580 var popupTransitionStateMapping = {
2581 ...popupStateMapping,
2582 ...transitionStatusMapping
2583 };
2584
2585 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs
2586 var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen;
2587 var triggerDisabled = "data-trigger-disabled";
2588
2589 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
2590 function isTargetInsideEnabledTrigger(target, triggerElements) {
2591 if (!isElement(target)) {
2592 return false;
2593 }
2594 const targetElement = target;
2595 if (triggerElements.hasElement(targetElement)) {
2596 return !targetElement.hasAttribute(triggerDisabled);
2597 }
2598 for (const [, trigger] of triggerElements.entries()) {
2599 if (contains(trigger, targetElement)) {
2600 return !trigger.hasAttribute(triggerDisabled);
2601 }
2602 }
2603 return false;
2604 }
2605 function isEventTargetWithin(event, node) {
2606 if (node == null) {
2607 return false;
2608 }
2609 if ("composedPath" in event) {
2610 return event.composedPath().includes(node);
2611 }
2612 const eventAgain = event;
2613 return eventAgain.target != null && node.contains(eventAgain.target);
2614 }
2615 function isRootElement(element) {
2616 return element.matches("html,body");
2617 }
2618 function isTypeableElement(element) {
2619 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
2620 }
2621 function isInteractiveElement(element) {
2622 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
2623 }
2624 function matchesFocusVisible(element) {
2625 if (!element || parts_exports.env.jsdom) {
2626 return true;
2627 }
2628 try {
2629 return element.matches(":focus-visible");
2630 } catch (_e) {
2631 return true;
2632 }
2633 }
2634
2635 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
2636 function resolveValue(value, pointerType) {
2637 if (pointerType != null && !isMouseLikePointerType(pointerType)) {
2638 return 0;
2639 }
2640 if (typeof value === "function") {
2641 return value();
2642 }
2643 return value;
2644 }
2645 function getDelay(value, prop, pointerType) {
2646 const result = resolveValue(value, pointerType);
2647 if (typeof result === "number") {
2648 return result;
2649 }
2650 return result?.[prop];
2651 }
2652 function getRestMs(value) {
2653 if (typeof value === "function") {
2654 return value();
2655 }
2656 return value;
2657 }
2658 function isClickLikeOpenEvent(openEventType, interactedInside) {
2659 return interactedInside || openEventType === "click" || openEventType === "mousedown";
2660 }
2661 function isHoverOpenEvent(openEventType) {
2662 return openEventType?.includes("mouse") && openEventType !== "mousedown";
2663 }
2664
2665 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2666 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
2667 var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({
2668 hasProvider: false,
2669 timeoutMs: 0,
2670 delayRef: {
2671 current: 0
2672 },
2673 initialDelayRef: {
2674 current: 0
2675 },
2676 timeout: new Timeout(),
2677 currentIdRef: {
2678 current: null
2679 },
2680 currentContextRef: {
2681 current: null
2682 }
2683 });
2684 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
2685 function resetDelayRef(delayRef, initialDelayRef) {
2686 delayRef.current = initialDelayRef.current;
2687 }
2688 function FloatingDelayGroup(props) {
2689 const {
2690 children,
2691 delay,
2692 timeoutMs = 0
2693 } = props;
2694 const delayRef = React18.useRef(delay);
2695 const initialDelayRef = React18.useRef(delay);
2696 const currentIdRef = React18.useRef(null);
2697 const currentContextRef = React18.useRef(null);
2698 const timeout = useTimeout();
2699 useIsoLayoutEffect(() => {
2700 initialDelayRef.current = delay;
2701 if (!currentIdRef.current) {
2702 delayRef.current = delay;
2703 return;
2704 }
2705 delayRef.current = {
2706 open: getDelay(delayRef.current, "open"),
2707 close: getDelay(delay, "close")
2708 };
2709 }, [delay, currentIdRef, delayRef, initialDelayRef]);
2710 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, {
2711 value: React18.useMemo(() => ({
2712 hasProvider: true,
2713 delayRef,
2714 initialDelayRef,
2715 currentIdRef,
2716 timeoutMs,
2717 currentContextRef,
2718 timeout
2719 }), [timeoutMs, timeout]),
2720 children
2721 });
2722 }
2723 function useDelayGroup(context, options = {
2724 open: false
2725 }) {
2726 const {
2727 open: open3
2728 } = options;
2729 const store = "rootStore" in context ? context.rootStore : context;
2730 const floatingId = store.useState("floatingId");
2731 const groupContext = React18.useContext(FloatingDelayGroupContext);
2732 const {
2733 currentIdRef,
2734 delayRef,
2735 timeoutMs,
2736 initialDelayRef,
2737 currentContextRef,
2738 hasProvider,
2739 timeout
2740 } = groupContext;
2741 const [isInstantPhase, setIsInstantPhase] = React18.useState(false);
2742 const openRef = React18.useRef(open3);
2743 useIsoLayoutEffect(() => {
2744 openRef.current = open3;
2745 }, [open3]);
2746 useIsoLayoutEffect(() => {
2747 function unset() {
2748 currentContextRef.current?.setIsInstantPhase(false);
2749 currentIdRef.current = null;
2750 currentContextRef.current = null;
2751 delayRef.current = initialDelayRef.current;
2752 timeout.clear();
2753 }
2754 if (!currentIdRef.current) {
2755 return void 0;
2756 }
2757 if (!open3 && currentIdRef.current === floatingId) {
2758 setIsInstantPhase(false);
2759 if (timeoutMs) {
2760 const closingId = floatingId;
2761 timeout.start(timeoutMs, () => {
2762 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
2763 return;
2764 }
2765 unset();
2766 });
2767 return () => {
2768 if (openRef.current || currentIdRef.current !== closingId) {
2769 timeout.clear();
2770 }
2771 };
2772 }
2773 unset();
2774 }
2775 return void 0;
2776 }, [open3, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]);
2777 useIsoLayoutEffect(() => {
2778 if (!open3) {
2779 return;
2780 }
2781 const prevContext = currentContextRef.current;
2782 const prevId = currentIdRef.current;
2783 timeout.clear();
2784 currentContextRef.current = {
2785 onOpenChange: store.setOpen,
2786 setIsInstantPhase
2787 };
2788 currentIdRef.current = floatingId;
2789 delayRef.current = {
2790 open: 0,
2791 close: getDelay(initialDelayRef.current, "close")
2792 };
2793 if (prevId !== null && prevId !== floatingId) {
2794 setIsInstantPhase(true);
2795 prevContext?.setIsInstantPhase(true);
2796 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
2797 } else {
2798 setIsInstantPhase(false);
2799 prevContext?.setIsInstantPhase(false);
2800 }
2801 }, [open3, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
2802 useIsoLayoutEffect(() => {
2803 return () => {
2804 if (currentIdRef.current === floatingId) {
2805 currentContextRef.current = null;
2806 if (!openRef.current) {
2807 return;
2808 }
2809 currentIdRef.current = null;
2810 resetDelayRef(delayRef, initialDelayRef);
2811 timeout.clear();
2812 }
2813 };
2814 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
2815 return React18.useMemo(() => ({
2816 activeIdRef: currentIdRef,
2817 hasProvider,
2818 delayRef,
2819 isInstantPhase
2820 }), [currentIdRef, hasProvider, delayRef, isInstantPhase]);
2821 }
2822
2823 // node_modules/@base-ui/utils/mergeCleanups.mjs
2824 function mergeCleanups(...cleanups) {
2825 return () => {
2826 for (let i = 0; i < cleanups.length; i += 1) {
2827 const cleanup = cleanups[i];
2828 if (cleanup) {
2829 cleanup();
2830 }
2831 }
2832 };
2833 }
2834
2835 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2836 var React19 = __toESM(require_react(), 1);
2837
2838 // node_modules/@base-ui/utils/visuallyHidden.mjs
2839 var visuallyHiddenBase = {
2840 clipPath: "inset(50%)",
2841 overflow: "hidden",
2842 whiteSpace: "nowrap",
2843 border: 0,
2844 padding: 0,
2845 width: 1,
2846 height: 1,
2847 margin: -1
2848 };
2849 var visuallyHidden = {
2850 ...visuallyHiddenBase,
2851 position: "fixed",
2852 top: 0,
2853 left: 0
2854 };
2855 var visuallyHiddenInput = {
2856 ...visuallyHiddenBase,
2857 position: "absolute"
2858 };
2859
2860 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2861 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2862 var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) {
2863 const [role, setRole] = React19.useState();
2864 useIsoLayoutEffect(() => {
2865 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
2866 setRole("button");
2867 }
2868 }, []);
2869 const restProps = {
2870 tabIndex: 0,
2871 // Role is only for VoiceOver
2872 role
2873 };
2874 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
2875 ...props,
2876 ref,
2877 style: visuallyHidden,
2878 "aria-hidden": role ? void 0 : true,
2879 ...restProps,
2880 "data-base-ui-focus-guard": ""
2881 });
2882 });
2883 if (true) FocusGuard.displayName = "FocusGuard";
2884
2885 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2886 var min = Math.min;
2887 var max = Math.max;
2888 var round = Math.round;
2889 var floor = Math.floor;
2890 var createCoords = (v2) => ({
2891 x: v2,
2892 y: v2
2893 });
2894 var oppositeSideMap = {
2895 left: "right",
2896 right: "left",
2897 bottom: "top",
2898 top: "bottom"
2899 };
2900 function clamp(start2, value, end) {
2901 return max(start2, min(value, end));
2902 }
2903 function evaluate(value, param) {
2904 return typeof value === "function" ? value(param) : value;
2905 }
2906 function getSide(placement) {
2907 return placement.split("-")[0];
2908 }
2909 function getAlignment(placement) {
2910 return placement.split("-")[1];
2911 }
2912 function getOppositeAxis(axis) {
2913 return axis === "x" ? "y" : "x";
2914 }
2915 function getAxisLength(axis) {
2916 return axis === "y" ? "height" : "width";
2917 }
2918 function getSideAxis(placement) {
2919 const firstChar = placement[0];
2920 return firstChar === "t" || firstChar === "b" ? "y" : "x";
2921 }
2922 function getAlignmentAxis(placement) {
2923 return getOppositeAxis(getSideAxis(placement));
2924 }
2925 function getAlignmentSides(placement, rects, rtl) {
2926 if (rtl === void 0) {
2927 rtl = false;
2928 }
2929 const alignment = getAlignment(placement);
2930 const alignmentAxis = getAlignmentAxis(placement);
2931 const length = getAxisLength(alignmentAxis);
2932 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2933 if (rects.reference[length] > rects.floating[length]) {
2934 mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2935 }
2936 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2937 }
2938 function getExpandedPlacements(placement) {
2939 const oppositePlacement = getOppositePlacement(placement);
2940 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2941 }
2942 function getOppositeAlignmentPlacement(placement) {
2943 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2944 }
2945 var lrPlacement = ["left", "right"];
2946 var rlPlacement = ["right", "left"];
2947 var tbPlacement = ["top", "bottom"];
2948 var btPlacement = ["bottom", "top"];
2949 function getSideList(side, isStart, rtl) {
2950 switch (side) {
2951 case "top":
2952 case "bottom":
2953 if (rtl) return isStart ? rlPlacement : lrPlacement;
2954 return isStart ? lrPlacement : rlPlacement;
2955 case "left":
2956 case "right":
2957 return isStart ? tbPlacement : btPlacement;
2958 default:
2959 return [];
2960 }
2961 }
2962 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2963 const alignment = getAlignment(placement);
2964 let list = getSideList(getSide(placement), direction === "start", rtl);
2965 if (alignment) {
2966 list = list.map((side) => side + "-" + alignment);
2967 if (flipAlignment) {
2968 list = list.concat(list.map(getOppositeAlignmentPlacement));
2969 }
2970 }
2971 return list;
2972 }
2973 function getOppositePlacement(placement) {
2974 const side = getSide(placement);
2975 return oppositeSideMap[side] + placement.slice(side.length);
2976 }
2977 function expandPaddingObject(padding) {
2978 var _padding$top, _padding$right, _padding$bottom, _padding$left;
2979 return {
2980 top: (_padding$top = padding.top) != null ? _padding$top : 0,
2981 right: (_padding$right = padding.right) != null ? _padding$right : 0,
2982 bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
2983 left: (_padding$left = padding.left) != null ? _padding$left : 0
2984 };
2985 }
2986 function getPaddingObject(padding) {
2987 return typeof padding !== "number" ? expandPaddingObject(padding) : {
2988 top: padding,
2989 right: padding,
2990 bottom: padding,
2991 left: padding
2992 };
2993 }
2994 function rectToClientRect(rect) {
2995 const {
2996 x: x2,
2997 y: y2,
2998 width,
2999 height
3000 } = rect;
3001 return {
3002 width,
3003 height,
3004 top: y2,
3005 left: x2,
3006 right: x2 + width,
3007 bottom: y2 + height,
3008 x: x2,
3009 y: y2
3010 };
3011 }
3012
3013 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
3014 function isHiddenByStyles(styles) {
3015 return styles.visibility === "hidden" || styles.visibility === "collapse";
3016 }
3017 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
3018 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
3019 return false;
3020 }
3021 if (typeof element.checkVisibility === "function") {
3022 return element.checkVisibility();
3023 }
3024 return styles.display !== "none" && styles.display !== "contents";
3025 }
3026
3027 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
3028 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
3029 function getParentElement(element) {
3030 const assignedSlot = element.assignedSlot;
3031 if (assignedSlot) {
3032 return assignedSlot;
3033 }
3034 if (element.parentElement) {
3035 return element.parentElement;
3036 }
3037 const rootNode = element.getRootNode();
3038 return isShadowRoot(rootNode) ? rootNode.host : null;
3039 }
3040 function getDetailsSummary(details) {
3041 for (const child of Array.from(details.children)) {
3042 if (getNodeName(child) === "summary") {
3043 return child;
3044 }
3045 }
3046 return null;
3047 }
3048 function isWithinOpenDetailsSummary(element, details) {
3049 const summary = getDetailsSummary(details);
3050 return !!summary && (element === summary || contains(summary, element));
3051 }
3052 function isFocusableCandidate(element) {
3053 const nodeName = element ? getNodeName(element) : "";
3054 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");
3055 }
3056 function isFocusableElement(element) {
3057 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
3058 return false;
3059 }
3060 for (let current = element; current; current = getParentElement(current)) {
3061 const isAncestor = current !== element;
3062 const isSlot = getNodeName(current) === "slot";
3063 if (current.hasAttribute("inert")) {
3064 return false;
3065 }
3066 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
3067 return false;
3068 }
3069 }
3070 return true;
3071 }
3072 function isVisibleInTabbableTree(element, isAncestor) {
3073 const styles = getComputedStyle2(element);
3074 if (!isAncestor) {
3075 return isElementVisible(element, styles);
3076 }
3077 return styles.display !== "none";
3078 }
3079 function getTabIndex(element) {
3080 const tabIndex = element.tabIndex;
3081 if (tabIndex < 0) {
3082 const nodeName = getNodeName(element);
3083 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
3084 return 0;
3085 }
3086 }
3087 return tabIndex;
3088 }
3089 function getNamedRadioInput(element) {
3090 if (getNodeName(element) !== "input") {
3091 return null;
3092 }
3093 const input = element;
3094 return input.type === "radio" && input.name !== "" ? input : null;
3095 }
3096 function isTabbableRadio(element, candidates) {
3097 const input = getNamedRadioInput(element);
3098 if (!input) {
3099 return true;
3100 }
3101 const checkedRadio = candidates.find((candidate) => {
3102 const radio = getNamedRadioInput(candidate);
3103 return radio?.name === input.name && radio.form === input.form && radio.checked;
3104 });
3105 if (checkedRadio) {
3106 return checkedRadio === input;
3107 }
3108 return candidates.find((candidate) => {
3109 const radio = getNamedRadioInput(candidate);
3110 return radio?.name === input.name && radio.form === input.form;
3111 }) === input;
3112 }
3113 function getComposedChildren(container) {
3114 if (isHTMLElement(container) && getNodeName(container) === "slot") {
3115 const assignedElements = container.assignedElements({
3116 flatten: true
3117 });
3118 if (assignedElements.length > 0) {
3119 return assignedElements;
3120 }
3121 }
3122 if (isHTMLElement(container) && container.shadowRoot) {
3123 return Array.from(container.shadowRoot.children);
3124 }
3125 return Array.from(container.children);
3126 }
3127 function appendCandidates(container, list) {
3128 getComposedChildren(container).forEach((child) => {
3129 if (isFocusableCandidate(child)) {
3130 list.push(child);
3131 }
3132 appendCandidates(child, list);
3133 });
3134 }
3135 function appendMatchingElements(container, selector, list) {
3136 getComposedChildren(container).forEach((child) => {
3137 if (isHTMLElement(child) && child.matches(selector)) {
3138 list.push(child);
3139 }
3140 appendMatchingElements(child, selector, list);
3141 });
3142 }
3143 function focusable(container) {
3144 const candidates = [];
3145 appendCandidates(container, candidates);
3146 return candidates.filter(isFocusableElement);
3147 }
3148 function tabbable(container) {
3149 const candidates = focusable(container);
3150 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
3151 }
3152 function getTabbableIn(container, dir) {
3153 const list = tabbable(container);
3154 const len = list.length;
3155 if (len === 0) {
3156 return void 0;
3157 }
3158 const active = activeElement(ownerDocument(container));
3159 const index2 = list.indexOf(active);
3160 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
3161 return list[nextIndex];
3162 }
3163 function getNextTabbable(referenceElement) {
3164 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
3165 }
3166 function getPreviousTabbable(referenceElement) {
3167 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
3168 }
3169 function isOutsideEvent(event, container) {
3170 const containerElement = container || event.currentTarget;
3171 const relatedTarget = event.relatedTarget;
3172 return !relatedTarget || !contains(containerElement, relatedTarget);
3173 }
3174 function disableFocusInside(container) {
3175 const tabbableElements = tabbable(container);
3176 tabbableElements.forEach((element) => {
3177 element.dataset.tabindex = element.getAttribute("tabindex") || "";
3178 element.setAttribute("tabindex", "-1");
3179 });
3180 }
3181 function enableFocusInside(container) {
3182 const elements = [];
3183 appendMatchingElements(container, "[data-tabindex]", elements);
3184 elements.forEach((element) => {
3185 const tabindex = element.dataset.tabindex;
3186 delete element.dataset.tabindex;
3187 if (tabindex) {
3188 element.setAttribute("tabindex", tabindex);
3189 } else {
3190 element.removeAttribute("tabindex");
3191 }
3192 });
3193 }
3194
3195 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
3196 function getNodeChildren(nodes, id, onlyOpenChildren = true) {
3197 const directChildren = nodes.filter((node) => node.parentId === id);
3198 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
3199 }
3200
3201 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
3202 function createAttribute(name) {
3203 return `data-base-ui-${name}`;
3204 }
3205
3206 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3207 var React20 = __toESM(require_react(), 1);
3208 var ReactDOM2 = __toESM(require_react_dom(), 1);
3209
3210 // node_modules/@base-ui/react/internals/constants.mjs
3211 var DISABLED_TRANSITIONS_STYLE = {
3212 style: {
3213 transition: "none"
3214 }
3215 };
3216 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
3217 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
3218 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
3219 var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
3220 var POPUP_COLLISION_AVOIDANCE = {
3221 fallbackAxisSide: "end"
3222 };
3223 var ownerVisuallyHidden = {
3224 clipPath: "inset(50%)",
3225 position: "fixed",
3226 top: 0,
3227 left: 0
3228 };
3229
3230 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3231 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
3232 var PortalContext = /* @__PURE__ */ React20.createContext(null);
3233 if (true) PortalContext.displayName = "PortalContext";
3234 var usePortalContext = () => React20.useContext(PortalContext);
3235 var attr = createAttribute("portal");
3236 function useFloatingPortalNode(props = {}) {
3237 const {
3238 ref,
3239 container: containerProp,
3240 componentProps = EMPTY_OBJECT,
3241 elementProps
3242 } = props;
3243 const uniqueId = useId();
3244 const portalContext = usePortalContext();
3245 const parentPortalNode = portalContext?.portalNode;
3246 const [containerElement, setContainerElement] = React20.useState(null);
3247 const [portalNode, setPortalNode] = React20.useState(null);
3248 const setPortalNodeRef = useStableCallback((node) => {
3249 if (node !== null) {
3250 setPortalNode(node);
3251 }
3252 });
3253 const containerRef = React20.useRef(null);
3254 useIsoLayoutEffect(() => {
3255 if (containerProp === null) {
3256 if (containerRef.current) {
3257 containerRef.current = null;
3258 setPortalNode(null);
3259 setContainerElement(null);
3260 }
3261 return;
3262 }
3263 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
3264 if (resolvedContainer == null) {
3265 if (containerRef.current) {
3266 containerRef.current = null;
3267 setPortalNode(null);
3268 setContainerElement(null);
3269 }
3270 return;
3271 }
3272 if (containerRef.current !== resolvedContainer) {
3273 containerRef.current = resolvedContainer;
3274 setPortalNode(null);
3275 setContainerElement(resolvedContainer);
3276 }
3277 }, [containerProp, parentPortalNode]);
3278 const portalElement = useRenderElement("div", componentProps, {
3279 ref: [ref, setPortalNodeRef],
3280 props: [{
3281 id: uniqueId,
3282 [attr]: ""
3283 }, elementProps]
3284 });
3285 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
3286 return {
3287 node: portalNode,
3288 // `id` and `render` props can override or remove the generated ID. Use the exact
3289 // rendered value so `aria-owns` never points at an ID absent from the DOM.
3290 nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0,
3291 subtree: portalSubtree
3292 };
3293 }
3294 var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
3295 const {
3296 render: render4,
3297 className,
3298 style,
3299 children,
3300 container,
3301 portalOwnerRole,
3302 ...elementProps
3303 } = componentProps;
3304 const {
3305 node: portalNode,
3306 nodeId: portalNodeId,
3307 subtree: portalSubtree
3308 } = useFloatingPortalNode({
3309 container,
3310 ref: forwardedRef,
3311 componentProps,
3312 elementProps
3313 });
3314 const beforeOutsideRef = React20.useRef(null);
3315 const afterOutsideRef = React20.useRef(null);
3316 const beforeInsideRef = React20.useRef(null);
3317 const afterInsideRef = React20.useRef(null);
3318 const [focusManagerState, setFocusManagerState] = React20.useState(null);
3319 const focusInsideDisabledRef = React20.useRef(false);
3320 const modal = focusManagerState?.modal;
3321 const open3 = focusManagerState?.open;
3322 const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
3323 React20.useEffect(() => {
3324 if (!portalNode || modal) {
3325 return void 0;
3326 }
3327 function onFocus(event) {
3328 if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
3329 if (event.type === "focusin") {
3330 if (focusInsideDisabledRef.current) {
3331 enableFocusInside(portalNode);
3332 focusInsideDisabledRef.current = false;
3333 }
3334 } else {
3335 disableFocusInside(portalNode);
3336 focusInsideDisabledRef.current = true;
3337 }
3338 }
3339 }
3340 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
3341 }, [portalNode, modal]);
3342 useIsoLayoutEffect(() => {
3343 if (!portalNode || open3 !== true || !focusInsideDisabledRef.current) {
3344 return;
3345 }
3346 enableFocusInside(portalNode);
3347 focusInsideDisabledRef.current = false;
3348 }, [open3, portalNode]);
3349 const portalContextValue = React20.useMemo(() => ({
3350 beforeOutsideRef,
3351 afterOutsideRef,
3352 beforeInsideRef,
3353 afterInsideRef,
3354 portalNode,
3355 setFocusManagerState
3356 }), [portalNode]);
3357 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React20.Fragment, {
3358 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, {
3359 value: portalContextValue,
3360 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3361 "data-type": "outside",
3362 ref: beforeOutsideRef,
3363 onFocus: (event) => {
3364 if (isOutsideEvent(event, portalNode)) {
3365 beforeInsideRef.current?.focus();
3366 } else {
3367 const domReference = focusManagerState ? focusManagerState.domReference : null;
3368 const prevTabbable = getPreviousTabbable(domReference);
3369 prevTabbable?.focus();
3370 }
3371 }
3372 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
3373 role: portalOwnerRole,
3374 "aria-owns": portalNodeId,
3375 style: ownerVisuallyHidden
3376 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3377 "data-type": "outside",
3378 ref: afterOutsideRef,
3379 onFocus: (event) => {
3380 if (isOutsideEvent(event, portalNode)) {
3381 afterInsideRef.current?.focus();
3382 } else {
3383 const domReference = focusManagerState ? focusManagerState.domReference : null;
3384 const nextTabbable = getNextTabbable(domReference);
3385 nextTabbable?.focus();
3386 if (focusManagerState?.closeOnFocusOut) {
3387 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
3388 }
3389 }
3390 }
3391 })]
3392 })]
3393 });
3394 });
3395 if (true) FloatingPortal.displayName = "FloatingPortal";
3396
3397 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3398 var React21 = __toESM(require_react(), 1);
3399
3400 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
3401 function createEventEmitter() {
3402 const map = /* @__PURE__ */ new Map();
3403 return {
3404 emit(event, data) {
3405 map.get(event)?.forEach((listener) => listener(data));
3406 },
3407 on(event, listener) {
3408 if (!map.has(event)) {
3409 map.set(event, /* @__PURE__ */ new Set());
3410 }
3411 map.get(event).add(listener);
3412 },
3413 off(event, listener) {
3414 map.get(event)?.delete(listener);
3415 }
3416 };
3417 }
3418
3419 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3420 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
3421 var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null);
3422 if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
3423 var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null);
3424 if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
3425 var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null;
3426 var useFloatingTree = (externalTree) => {
3427 const contextTree = React21.useContext(FloatingTreeContext);
3428 return externalTree ?? contextTree;
3429 };
3430
3431 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
3432 var React22 = __toESM(require_react(), 1);
3433 function createVirtualElement(domElement, data) {
3434 let offsetX = null;
3435 let offsetY = null;
3436 let isAutoUpdateEvent = false;
3437 return {
3438 contextElement: domElement || void 0,
3439 getBoundingClientRect() {
3440 const domRect = domElement?.getBoundingClientRect() || {
3441 width: 0,
3442 height: 0,
3443 x: 0,
3444 y: 0
3445 };
3446 const isXAxis = data.axis === "x" || data.axis === "both";
3447 const isYAxis = data.axis === "y" || data.axis === "both";
3448 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
3449 let width = domRect.width;
3450 let height = domRect.height;
3451 let x2 = domRect.x;
3452 let y2 = domRect.y;
3453 if (offsetX == null && data.x && isXAxis) {
3454 offsetX = domRect.x - data.x;
3455 }
3456 if (offsetY == null && data.y && isYAxis) {
3457 offsetY = domRect.y - data.y;
3458 }
3459 x2 -= offsetX || 0;
3460 y2 -= offsetY || 0;
3461 width = 0;
3462 height = 0;
3463 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
3464 width = data.axis === "y" ? domRect.width : 0;
3465 height = data.axis === "x" ? domRect.height : 0;
3466 x2 = isXAxis && data.x != null ? data.x : x2;
3467 y2 = isYAxis && data.y != null ? data.y : y2;
3468 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
3469 height = data.axis === "x" ? domRect.height : height;
3470 width = data.axis === "y" ? domRect.width : width;
3471 }
3472 isAutoUpdateEvent = true;
3473 return {
3474 width,
3475 height,
3476 x: x2,
3477 y: y2,
3478 top: y2,
3479 right: x2 + width,
3480 bottom: y2 + height,
3481 left: x2
3482 };
3483 }
3484 };
3485 }
3486 function isMouseBasedEvent(event) {
3487 return event != null && event.clientX != null;
3488 }
3489 function useClientPoint(context, props = {}) {
3490 const {
3491 enabled = true,
3492 axis = "both"
3493 } = props;
3494 const store = "rootStore" in context ? context.rootStore : context;
3495 const open3 = store.useState("open");
3496 const floating = store.useState("floatingElement");
3497 const domReference = store.useState("domReferenceElement");
3498 const dataRef = store.context.dataRef;
3499 const initialRef = React22.useRef(false);
3500 const cleanupListenerRef = React22.useRef(null);
3501 const [pointerType, setPointerType] = React22.useState();
3502 const [reactive, setReactive] = React22.useState([]);
3503 const resetReference = useStableCallback((reference2) => {
3504 store.set("positionReference", reference2);
3505 });
3506 const setReference = useStableCallback((newX, newY, referenceElement) => {
3507 if (initialRef.current) {
3508 return;
3509 }
3510 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
3511 return;
3512 }
3513 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
3514 x: newX,
3515 y: newY,
3516 axis,
3517 dataRef,
3518 pointerType
3519 }));
3520 });
3521 const handleReferenceEnterOrMove = useStableCallback((event) => {
3522 if (!open3) {
3523 setReference(event.clientX, event.clientY, event.currentTarget);
3524 } else if (!cleanupListenerRef.current) {
3525 setReference(event.clientX, event.clientY, event.currentTarget);
3526 setReactive([]);
3527 }
3528 });
3529 const openCheck = isMouseLikePointerType(pointerType) ? floating : open3;
3530 React22.useEffect(() => {
3531 if (!enabled) {
3532 resetReference(domReference);
3533 return void 0;
3534 }
3535 if (!openCheck) {
3536 return void 0;
3537 }
3538 function cleanupListener() {
3539 cleanupListenerRef.current?.();
3540 cleanupListenerRef.current = null;
3541 }
3542 const win = getWindow(floating);
3543 function handleMouseMove(event) {
3544 const target = getTarget(event);
3545 if (!contains(floating, target)) {
3546 setReference(event.clientX, event.clientY);
3547 } else {
3548 cleanupListener();
3549 }
3550 }
3551 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
3552 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
3553 } else {
3554 resetReference(domReference);
3555 }
3556 return cleanupListener;
3557 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]);
3558 React22.useEffect(() => () => {
3559 store.set("positionReference", null);
3560 }, [store]);
3561 React22.useEffect(() => {
3562 if (enabled && !floating) {
3563 initialRef.current = false;
3564 }
3565 }, [enabled, floating]);
3566 React22.useEffect(() => {
3567 if (!enabled && open3) {
3568 initialRef.current = true;
3569 }
3570 }, [enabled, open3]);
3571 const reference = React22.useMemo(() => {
3572 function setPointerTypeRef(event) {
3573 setPointerType(event.pointerType);
3574 }
3575 return {
3576 onPointerDown: setPointerTypeRef,
3577 onPointerEnter: setPointerTypeRef,
3578 onMouseMove: handleReferenceEnterOrMove,
3579 onMouseEnter: handleReferenceEnterOrMove
3580 };
3581 }, [handleReferenceEnterOrMove]);
3582 return React22.useMemo(() => enabled ? {
3583 reference,
3584 trigger: reference
3585 } : {}, [enabled, reference]);
3586 }
3587
3588 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
3589 var React23 = __toESM(require_react(), 1);
3590 function alwaysFalse() {
3591 return false;
3592 }
3593 function normalizeProp(normalizable) {
3594 return {
3595 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
3596 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
3597 };
3598 }
3599 function useDismiss(context, props = {}) {
3600 const {
3601 enabled = true,
3602 escapeKey: escapeKey2 = true,
3603 outsidePress: outsidePressProp = true,
3604 outsidePressEvent = "sloppy",
3605 referencePress = alwaysFalse,
3606 bubbles,
3607 externalTree
3608 } = props;
3609 const store = "rootStore" in context ? context.rootStore : context;
3610 const open3 = store.useState("open");
3611 const floatingElement = store.useState("floatingElement");
3612 const {
3613 dataRef,
3614 events
3615 } = store.context;
3616 const tree = useFloatingTree(externalTree);
3617 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
3618 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
3619 const outsidePressEnabled = outsidePress2 !== false;
3620 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
3621 const {
3622 escapeKey: escapeKeyBubbles,
3623 outsidePress: outsidePressBubbles
3624 } = normalizeProp(bubbles);
3625 const pressStartedInsideRef = React23.useRef(false);
3626 const pressStartPreventedRef = React23.useRef(false);
3627 const suppressNextOutsideClickRef = React23.useRef(false);
3628 const sawPressWhileOpenRef = React23.useRef(false);
3629 const isComposingRef = React23.useRef(false);
3630 const currentPointerTypeRef = React23.useRef("");
3631 const touchStateRef = React23.useRef(null);
3632 const cancelDismissOnEndTimeout = useTimeout();
3633 const clearInsideReactTreeTimeout = useTimeout();
3634 const clearInsideReactTree = useStableCallback(() => {
3635 clearInsideReactTreeTimeout.clear();
3636 dataRef.current.insideReactTree = false;
3637 });
3638 const hasBlockingChild = useStableCallback((bubbleKey) => {
3639 const nodeId = dataRef.current.floatingContext?.nodeId;
3640 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
3641 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
3642 });
3643 const isEventWithinOwnElements = useStableCallback((event) => {
3644 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"));
3645 });
3646 const closeOnReferencePress = useStableCallback((event) => {
3647 if (!referencePress()) {
3648 return;
3649 }
3650 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
3651 });
3652 const closeOnEscapeKeyDown = useStableCallback((event) => {
3653 if (!open3 || !enabled || !escapeKey2 || event.key !== "Escape") {
3654 return;
3655 }
3656 if (isComposingRef.current) {
3657 return;
3658 }
3659 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
3660 return;
3661 }
3662 const native = isReactEvent(event) ? event.nativeEvent : event;
3663 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
3664 store.setOpen(false, eventDetails);
3665 if (!eventDetails.isCanceled) {
3666 event.preventDefault();
3667 }
3668 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
3669 event.stopPropagation();
3670 }
3671 });
3672 const markInsideReactTree = useStableCallback(() => {
3673 dataRef.current.insideReactTree = true;
3674 clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
3675 });
3676 const markPressStartedInsideReactTree = useStableCallback((event) => {
3677 if (!open3 || !enabled || event.button !== 0) {
3678 return;
3679 }
3680 const target = getTarget(event.nativeEvent);
3681 if (!contains(store.select("floatingElement"), target)) {
3682 return;
3683 }
3684 if (!pressStartedInsideRef.current) {
3685 pressStartedInsideRef.current = true;
3686 pressStartPreventedRef.current = false;
3687 }
3688 });
3689 const markInsidePressStartPrevented = useStableCallback((event) => {
3690 if (!open3 || !enabled) {
3691 return;
3692 }
3693 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
3694 return;
3695 }
3696 if (pressStartedInsideRef.current) {
3697 pressStartPreventedRef.current = true;
3698 }
3699 });
3700 React23.useEffect(() => {
3701 function handleOpenChange(details) {
3702 if (!details.open) {
3703 sawPressWhileOpenRef.current = false;
3704 }
3705 }
3706 events.on("openchange", handleOpenChange);
3707 return () => {
3708 events.off("openchange", handleOpenChange);
3709 };
3710 }, [events]);
3711 React23.useEffect(() => {
3712 if (!open3 || !enabled) {
3713 if (!open3) {
3714 sawPressWhileOpenRef.current = false;
3715 }
3716 return clearInsideReactTree;
3717 }
3718 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
3719 dataRef.current.__outsidePressBubbles = outsidePressBubbles;
3720 const compositionTimeout = new Timeout();
3721 const preventedPressSuppressionTimeout = new Timeout();
3722 const doc = ownerDocument(floatingElement);
3723 function handleCompositionStart() {
3724 compositionTimeout.clear();
3725 isComposingRef.current = true;
3726 }
3727 function handleCompositionEnd() {
3728 compositionTimeout.start(
3729 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
3730 // Only apply to WebKit for the test to remain 0ms.
3731 parts_exports.engine.webkit ? 5 : 0,
3732 () => {
3733 isComposingRef.current = false;
3734 }
3735 );
3736 }
3737 function suppressImmediateOutsideClickAfterPreventedStart() {
3738 suppressNextOutsideClickRef.current = true;
3739 preventedPressSuppressionTimeout.start(0, () => {
3740 suppressNextOutsideClickRef.current = false;
3741 });
3742 }
3743 function resetPressStartState() {
3744 pressStartedInsideRef.current = false;
3745 pressStartPreventedRef.current = false;
3746 }
3747 function getOutsidePressEvent() {
3748 const type = currentPointerTypeRef.current;
3749 const computedType = type === "pen" || !type ? "mouse" : type;
3750 const outsidePressEventValue = getOutsidePressEventProp();
3751 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
3752 if (typeof resolved === "string") {
3753 return resolved;
3754 }
3755 return resolved[computedType];
3756 }
3757 function shouldIgnoreEvent(event) {
3758 const computedOutsidePressEvent = getOutsidePressEvent();
3759 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
3760 }
3761 function isEventWithinFloatingTree(event) {
3762 const nodeId = dataRef.current.floatingContext?.nodeId;
3763 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
3764 return isEventWithinOwnElements(event) || targetIsInsideChildren;
3765 }
3766 function closeOnPressOutside(event) {
3767 if (shouldIgnoreEvent(event)) {
3768 if (event.type !== "click" && !isEventWithinOwnElements(event)) {
3769 preventedPressSuppressionTimeout.clear();
3770 suppressNextOutsideClickRef.current = false;
3771 }
3772 clearInsideReactTree();
3773 return;
3774 }
3775 if (dataRef.current.insideReactTree) {
3776 clearInsideReactTree();
3777 return;
3778 }
3779 const target = getTarget(event);
3780 const inertSelector = `[${createAttribute("inert")}]`;
3781 const targetRoot = isElement(target) ? target.getRootNode() : null;
3782 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector));
3783 const triggers = store.context.triggerElements;
3784 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
3785 return;
3786 }
3787 let targetRootAncestor = isElement(target) ? target : null;
3788 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
3789 const nextParent = getParentNode(targetRootAncestor);
3790 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
3791 break;
3792 }
3793 targetRootAncestor = nextParent;
3794 }
3795 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
3796 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the
3797 // element was injected after the floating element rendered.
3798 markers.every((marker) => !contains(targetRootAncestor, marker))) {
3799 return;
3800 }
3801 if (isHTMLElement(target) && !("touches" in event)) {
3802 const lastTraversableNode = isLastTraversableNode(target);
3803 const style = getComputedStyle2(target);
3804 const scrollRe = /auto|scroll/;
3805 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
3806 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
3807 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
3808 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
3809 const isRTL6 = style.direction === "rtl";
3810 const pressedVerticalScrollbar = canScrollY && (isRTL6 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
3811 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
3812 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
3813 return;
3814 }
3815 }
3816 if (isEventWithinFloatingTree(event)) {
3817 return;
3818 }
3819 if (getOutsidePressEvent() === "intentional") {
3820 if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) {
3821 return;
3822 }
3823 if (suppressNextOutsideClickRef.current) {
3824 preventedPressSuppressionTimeout.clear();
3825 suppressNextOutsideClickRef.current = false;
3826 return;
3827 }
3828 }
3829 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3830 return;
3831 }
3832 if (hasBlockingChild("__outsidePressBubbles")) {
3833 return;
3834 }
3835 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
3836 clearInsideReactTree();
3837 }
3838 function handlePointerDown(event) {
3839 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
3840 return;
3841 }
3842 closeOnPressOutside(event);
3843 }
3844 function handleTouchStart(event) {
3845 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
3846 return;
3847 }
3848 const touch = event.touches[0];
3849 if (touch) {
3850 touchStateRef.current = {
3851 startTime: Date.now(),
3852 startX: touch.clientX,
3853 startY: touch.clientY,
3854 dismissOnTouchEnd: false,
3855 dismissOnMouseDown: true
3856 };
3857 cancelDismissOnEndTimeout.start(1e3, () => {
3858 if (touchStateRef.current) {
3859 touchStateRef.current.dismissOnTouchEnd = false;
3860 touchStateRef.current.dismissOnMouseDown = false;
3861 }
3862 });
3863 }
3864 }
3865 function addTargetEventListenerOnce(event, listener) {
3866 const target = getTarget(event);
3867 if (!target) {
3868 return;
3869 }
3870 const unsubscribe2 = addEventListener(target, event.type, () => {
3871 listener(event);
3872 unsubscribe2();
3873 });
3874 }
3875 function handleTouchStartCapture(event) {
3876 currentPointerTypeRef.current = "touch";
3877 addTargetEventListenerOnce(event, handleTouchStart);
3878 }
3879 function closeOnPressOutsideCapture(event) {
3880 cancelDismissOnEndTimeout.clear();
3881 if (event.type === "pointerdown") {
3882 if (event.button === 0) {
3883 sawPressWhileOpenRef.current = true;
3884 }
3885 currentPointerTypeRef.current = event.pointerType;
3886 }
3887 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
3888 return;
3889 }
3890 addTargetEventListenerOnce(event, (targetEvent) => {
3891 if (targetEvent.type === "pointerdown") {
3892 handlePointerDown(targetEvent);
3893 } else {
3894 closeOnPressOutside(targetEvent);
3895 }
3896 });
3897 }
3898 function handlePressEndCapture(event) {
3899 if (event.type === "pointercancel") {
3900 sawPressWhileOpenRef.current = false;
3901 }
3902 if (!pressStartedInsideRef.current) {
3903 return;
3904 }
3905 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
3906 resetPressStartState();
3907 if (getOutsidePressEvent() !== "intentional") {
3908 return;
3909 }
3910 if (event.type === "pointercancel") {
3911 if (pressStartedInsideDefaultPrevented) {
3912 suppressImmediateOutsideClickAfterPreventedStart();
3913 }
3914 return;
3915 }
3916 if (isEventWithinFloatingTree(event)) {
3917 return;
3918 }
3919 if (pressStartedInsideDefaultPrevented) {
3920 suppressImmediateOutsideClickAfterPreventedStart();
3921 return;
3922 }
3923 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3924 return;
3925 }
3926 preventedPressSuppressionTimeout.clear();
3927 suppressNextOutsideClickRef.current = true;
3928 clearInsideReactTree();
3929 }
3930 function handleTouchMove(event) {
3931 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3932 return;
3933 }
3934 const touch = event.touches[0];
3935 if (!touch) {
3936 return;
3937 }
3938 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
3939 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
3940 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
3941 if (distance > 5) {
3942 touchStateRef.current.dismissOnTouchEnd = true;
3943 }
3944 if (distance > 10) {
3945 closeOnPressOutside(event);
3946 cancelDismissOnEndTimeout.clear();
3947 touchStateRef.current = null;
3948 }
3949 }
3950 function handleTouchMoveCapture(event) {
3951 addTargetEventListenerOnce(event, handleTouchMove);
3952 }
3953 function handleTouchEnd(event) {
3954 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3955 return;
3956 }
3957 if (touchStateRef.current.dismissOnTouchEnd) {
3958 closeOnPressOutside(event);
3959 }
3960 cancelDismissOnEndTimeout.clear();
3961 touchStateRef.current = null;
3962 }
3963 function handleTouchEndCapture(event) {
3964 addTargetEventListenerOnce(event, handleTouchEnd);
3965 }
3966 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, {
3967 capture: true,
3968 passive: true
3969 }), addEventListener(doc, "touchmove", handleTouchMoveCapture, {
3970 capture: true,
3971 passive: true
3972 }), addEventListener(doc, "touchend", handleTouchEndCapture, {
3973 capture: true,
3974 passive: true
3975 })));
3976 return () => {
3977 unsubscribe();
3978 compositionTimeout.clear();
3979 preventedPressSuppressionTimeout.clear();
3980 resetPressStartState();
3981 suppressNextOutsideClickRef.current = false;
3982 clearInsideReactTree();
3983 };
3984 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open3, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);
3985 const reference = React23.useMemo(() => ({
3986 onKeyDown: closeOnEscapeKeyDown,
3987 onPointerDown: closeOnReferencePress,
3988 onClick: closeOnReferencePress
3989 }), [closeOnEscapeKeyDown, closeOnReferencePress]);
3990 const floating = React23.useMemo(() => ({
3991 onKeyDown: closeOnEscapeKeyDown,
3992 // `onMouseDown` may be blocked if `event.preventDefault()` is called in
3993 // `onPointerDown`, such as with <NumberField.ScrubArea>.
3994 // See https://github.com/mui/base-ui/pull/3379
3995 onPointerDown: markInsidePressStartPrevented,
3996 onMouseDown: markInsidePressStartPrevented,
3997 onClickCapture: markInsideReactTree,
3998 onMouseDownCapture(event) {
3999 markInsideReactTree();
4000 markPressStartedInsideReactTree(event);
4001 },
4002 onPointerDownCapture(event) {
4003 markInsideReactTree();
4004 markPressStartedInsideReactTree(event);
4005 },
4006 onMouseUpCapture: markInsideReactTree,
4007 onTouchEndCapture: markInsideReactTree,
4008 onTouchMoveCapture: markInsideReactTree
4009 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
4010 return React23.useMemo(() => enabled ? {
4011 reference,
4012 floating,
4013 trigger: reference
4014 } : {}, [enabled, reference, floating]);
4015 }
4016
4017 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
4018 var React31 = __toESM(require_react(), 1);
4019
4020 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
4021 function computeCoordsFromPlacement(_ref, placement, rtl) {
4022 let {
4023 reference,
4024 floating
4025 } = _ref;
4026 const sideAxis = getSideAxis(placement);
4027 const alignmentAxis = getAlignmentAxis(placement);
4028 const alignLength = getAxisLength(alignmentAxis);
4029 const side = getSide(placement);
4030 const isVertical = sideAxis === "y";
4031 const commonX = reference.x + reference.width / 2 - floating.width / 2;
4032 const commonY = reference.y + reference.height / 2 - floating.height / 2;
4033 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
4034 let coords;
4035 switch (side) {
4036 case "top":
4037 coords = {
4038 x: commonX,
4039 y: reference.y - floating.height
4040 };
4041 break;
4042 case "bottom":
4043 coords = {
4044 x: commonX,
4045 y: reference.y + reference.height
4046 };
4047 break;
4048 case "right":
4049 coords = {
4050 x: reference.x + reference.width,
4051 y: commonY
4052 };
4053 break;
4054 case "left":
4055 coords = {
4056 x: reference.x - floating.width,
4057 y: commonY
4058 };
4059 break;
4060 default:
4061 coords = {
4062 x: reference.x,
4063 y: reference.y
4064 };
4065 }
4066 const alignment = getAlignment(placement);
4067 if (alignment) {
4068 coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
4069 }
4070 return coords;
4071 }
4072 async function detectOverflow(state, options) {
4073 var _await$platform$isEle;
4074 if (options === void 0) {
4075 options = {};
4076 }
4077 const {
4078 x: x2,
4079 y: y2,
4080 platform: platform3,
4081 rects,
4082 elements,
4083 strategy
4084 } = state;
4085 const {
4086 boundary = "clippingAncestors",
4087 rootBoundary = "viewport",
4088 elementContext = "floating",
4089 altBoundary = false,
4090 padding = 0
4091 } = evaluate(options, state);
4092 const paddingObject = getPaddingObject(padding);
4093 const altContext = elementContext === "floating" ? "reference" : "floating";
4094 const element = elements[altBoundary ? altContext : elementContext];
4095 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
4096 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)),
4097 boundary,
4098 rootBoundary,
4099 strategy
4100 }));
4101 const rect = elementContext === "floating" ? {
4102 x: x2,
4103 y: y2,
4104 width: rects.floating.width,
4105 height: rects.floating.height
4106 } : rects.reference;
4107 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
4108 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
4109 x: 1,
4110 y: 1
4111 };
4112 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
4113 elements,
4114 rect,
4115 offsetParent,
4116 strategy
4117 }) : rect);
4118 return {
4119 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
4120 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
4121 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
4122 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
4123 };
4124 }
4125 var MAX_RESET_COUNT = 50;
4126 var computePosition = async (reference, floating, config2) => {
4127 const {
4128 placement = "bottom",
4129 strategy = "absolute",
4130 middleware = [],
4131 platform: platform3
4132 } = config2;
4133 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
4134 ...platform3,
4135 detectOverflow
4136 };
4137 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
4138 let rects = await platform3.getElementRects({
4139 reference,
4140 floating,
4141 strategy
4142 });
4143 let {
4144 x: x2,
4145 y: y2
4146 } = computeCoordsFromPlacement(rects, placement, rtl);
4147 let statefulPlacement = placement;
4148 let resetCount = 0;
4149 const middlewareData = {};
4150 for (let i = 0; i < middleware.length; i++) {
4151 const currentMiddleware = middleware[i];
4152 if (!currentMiddleware) {
4153 continue;
4154 }
4155 const {
4156 name,
4157 fn
4158 } = currentMiddleware;
4159 const {
4160 x: nextX,
4161 y: nextY,
4162 data,
4163 reset
4164 } = await fn({
4165 x: x2,
4166 y: y2,
4167 initialPlacement: placement,
4168 placement: statefulPlacement,
4169 strategy,
4170 middlewareData,
4171 rects,
4172 platform: platformWithDetectOverflow,
4173 elements: {
4174 reference,
4175 floating
4176 }
4177 });
4178 x2 = nextX != null ? nextX : x2;
4179 y2 = nextY != null ? nextY : y2;
4180 middlewareData[name] = {
4181 ...middlewareData[name],
4182 ...data
4183 };
4184 if (reset && resetCount < MAX_RESET_COUNT) {
4185 resetCount++;
4186 if (typeof reset === "object") {
4187 if (reset.placement) {
4188 statefulPlacement = reset.placement;
4189 }
4190 if (reset.rects) {
4191 rects = reset.rects === true ? await platform3.getElementRects({
4192 reference,
4193 floating,
4194 strategy
4195 }) : reset.rects;
4196 }
4197 ({
4198 x: x2,
4199 y: y2
4200 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
4201 }
4202 i = -1;
4203 }
4204 }
4205 return {
4206 x: x2,
4207 y: y2,
4208 placement: statefulPlacement,
4209 strategy,
4210 middlewareData
4211 };
4212 };
4213 var flip = function(options) {
4214 if (options === void 0) {
4215 options = {};
4216 }
4217 return {
4218 name: "flip",
4219 options,
4220 async fn(state) {
4221 var _middlewareData$arrow, _middlewareData$flip;
4222 const {
4223 placement,
4224 middlewareData,
4225 rects,
4226 initialPlacement,
4227 platform: platform3,
4228 elements
4229 } = state;
4230 const {
4231 mainAxis: checkMainAxis = true,
4232 crossAxis: checkCrossAxis = true,
4233 fallbackPlacements: specifiedFallbackPlacements,
4234 fallbackStrategy = "bestFit",
4235 fallbackAxisSideDirection = "none",
4236 flipAlignment = true,
4237 ...detectOverflowOptions
4238 } = evaluate(options, state);
4239 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4240 return {};
4241 }
4242 const side = getSide(placement);
4243 const initialSideAxis = getSideAxis(initialPlacement);
4244 const isBasePlacement = getSide(initialPlacement) === initialPlacement;
4245 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4246 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
4247 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
4248 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
4249 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
4250 }
4251 const placements2 = [initialPlacement, ...fallbackPlacements];
4252 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4253 const overflows = [];
4254 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
4255 if (checkMainAxis) {
4256 overflows.push(overflow[side]);
4257 }
4258 if (checkCrossAxis) {
4259 const sides2 = getAlignmentSides(placement, rects, rtl);
4260 overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
4261 }
4262 overflowsData = [...overflowsData, {
4263 placement,
4264 overflows
4265 }];
4266 if (!overflows.every((side2) => side2 <= 0)) {
4267 var _middlewareData$flip2, _overflowsData$filter;
4268 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
4269 const nextPlacement = placements2[nextIndex];
4270 if (nextPlacement) {
4271 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
4272 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
4273 // overflows the main axis.
4274 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
4275 return {
4276 data: {
4277 index: nextIndex,
4278 overflows: overflowsData
4279 },
4280 reset: {
4281 placement: nextPlacement
4282 }
4283 };
4284 }
4285 }
4286 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
4287 if (!resetPlacement) {
4288 switch (fallbackStrategy) {
4289 case "bestFit": {
4290 var _overflowsData$filter2;
4291 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
4292 if (hasFallbackAxisSideDirection) {
4293 const currentSideAxis = getSideAxis(d.placement);
4294 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
4295 // reading directions favoring greater width.
4296 currentSideAxis === "y";
4297 }
4298 return true;
4299 }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
4300 if (placement2) {
4301 resetPlacement = placement2;
4302 }
4303 break;
4304 }
4305 case "initialPlacement":
4306 resetPlacement = initialPlacement;
4307 break;
4308 }
4309 }
4310 if (placement !== resetPlacement) {
4311 return {
4312 reset: {
4313 placement: resetPlacement
4314 }
4315 };
4316 }
4317 }
4318 return {};
4319 }
4320 };
4321 };
4322 var originSides = /* @__PURE__ */ new Set(["left", "top"]);
4323 async function convertValueToCoords(state, options) {
4324 const {
4325 placement,
4326 platform: platform3,
4327 elements
4328 } = state;
4329 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4330 const side = getSide(placement);
4331 const alignment = getAlignment(placement);
4332 const isVertical = getSideAxis(placement) === "y";
4333 const mainAxisMulti = originSides.has(side) ? -1 : 1;
4334 const crossAxisMulti = rtl && isVertical ? -1 : 1;
4335 const rawValue = evaluate(options, state);
4336 let {
4337 mainAxis,
4338 crossAxis,
4339 alignmentAxis
4340 } = typeof rawValue === "number" ? {
4341 mainAxis: rawValue,
4342 crossAxis: 0,
4343 alignmentAxis: null
4344 } : {
4345 mainAxis: rawValue.mainAxis || 0,
4346 crossAxis: rawValue.crossAxis || 0,
4347 alignmentAxis: rawValue.alignmentAxis
4348 };
4349 if (alignment && typeof alignmentAxis === "number") {
4350 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
4351 }
4352 return isVertical ? {
4353 x: crossAxis * crossAxisMulti,
4354 y: mainAxis * mainAxisMulti
4355 } : {
4356 x: mainAxis * mainAxisMulti,
4357 y: crossAxis * crossAxisMulti
4358 };
4359 }
4360 var offset = function(options) {
4361 if (options === void 0) {
4362 options = 0;
4363 }
4364 return {
4365 name: "offset",
4366 options,
4367 async fn(state) {
4368 var _middlewareData$offse, _middlewareData$arrow;
4369 const {
4370 x: x2,
4371 y: y2,
4372 placement,
4373 middlewareData
4374 } = state;
4375 const diffCoords = await convertValueToCoords(state, options);
4376 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4377 return {};
4378 }
4379 return {
4380 x: x2 + diffCoords.x,
4381 y: y2 + diffCoords.y,
4382 data: {
4383 ...diffCoords,
4384 placement
4385 }
4386 };
4387 }
4388 };
4389 };
4390 var shift = function(options) {
4391 if (options === void 0) {
4392 options = {};
4393 }
4394 return {
4395 name: "shift",
4396 options,
4397 async fn(state) {
4398 const {
4399 x: x2,
4400 y: y2,
4401 placement,
4402 platform: platform3
4403 } = state;
4404 const {
4405 mainAxis: checkMainAxis = true,
4406 crossAxis: checkCrossAxis = false,
4407 limiter = {
4408 fn: (_ref) => {
4409 let {
4410 x: x3,
4411 y: y3
4412 } = _ref;
4413 return {
4414 x: x3,
4415 y: y3
4416 };
4417 }
4418 },
4419 ...detectOverflowOptions
4420 } = evaluate(options, state);
4421 const coords = {
4422 x: x2,
4423 y: y2
4424 };
4425 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4426 const crossAxis = getSideAxis(placement);
4427 const mainAxis = getOppositeAxis(crossAxis);
4428 let mainAxisCoord = coords[mainAxis];
4429 let crossAxisCoord = coords[crossAxis];
4430 const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
4431 if (checkMainAxis) {
4432 mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
4433 }
4434 if (checkCrossAxis) {
4435 crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
4436 }
4437 const limitedCoords = limiter.fn({
4438 ...state,
4439 [mainAxis]: mainAxisCoord,
4440 [crossAxis]: crossAxisCoord
4441 });
4442 return {
4443 ...limitedCoords,
4444 data: {
4445 x: limitedCoords.x - x2,
4446 y: limitedCoords.y - y2,
4447 enabled: {
4448 [mainAxis]: checkMainAxis,
4449 [crossAxis]: checkCrossAxis
4450 }
4451 }
4452 };
4453 }
4454 };
4455 };
4456 var limitShift = function(options) {
4457 if (options === void 0) {
4458 options = {};
4459 }
4460 return {
4461 options,
4462 fn(state) {
4463 var _rawOffset$mainAxis, _rawOffset$crossAxis;
4464 const {
4465 x: x2,
4466 y: y2,
4467 placement,
4468 rects,
4469 middlewareData
4470 } = state;
4471 const {
4472 offset: offset4 = 0,
4473 mainAxis: checkMainAxis = true,
4474 crossAxis: checkCrossAxis = true
4475 } = evaluate(options, state);
4476 const coords = {
4477 x: x2,
4478 y: y2
4479 };
4480 const crossAxis = getSideAxis(placement);
4481 const mainAxis = getOppositeAxis(crossAxis);
4482 let mainAxisCoord = coords[mainAxis];
4483 let crossAxisCoord = coords[crossAxis];
4484 const rawOffset = evaluate(offset4, state);
4485 const computedOffset = typeof rawOffset === "number" ? {
4486 mainAxis: rawOffset,
4487 crossAxis: 0
4488 } : {
4489 mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
4490 crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
4491 };
4492 if (checkMainAxis) {
4493 const len = mainAxis === "y" ? "height" : "width";
4494 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
4495 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
4496 if (mainAxisCoord < limitMin) {
4497 mainAxisCoord = limitMin;
4498 } else if (mainAxisCoord > limitMax) {
4499 mainAxisCoord = limitMax;
4500 }
4501 }
4502 if (checkCrossAxis) {
4503 var _middlewareData$offse, _middlewareData$offse2;
4504 const len = mainAxis === "y" ? "width" : "height";
4505 const isOriginSide = originSides.has(getSide(placement));
4506 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);
4507 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);
4508 if (crossAxisCoord < limitMin) {
4509 crossAxisCoord = limitMin;
4510 } else if (crossAxisCoord > limitMax) {
4511 crossAxisCoord = limitMax;
4512 }
4513 }
4514 return {
4515 [mainAxis]: mainAxisCoord,
4516 [crossAxis]: crossAxisCoord
4517 };
4518 }
4519 };
4520 };
4521 var size = function(options) {
4522 if (options === void 0) {
4523 options = {};
4524 }
4525 return {
4526 name: "size",
4527 options,
4528 async fn(state) {
4529 const {
4530 placement,
4531 rects,
4532 platform: platform3,
4533 elements
4534 } = state;
4535 const {
4536 apply = () => {
4537 },
4538 ...detectOverflowOptions
4539 } = evaluate(options, state);
4540 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4541 const side = getSide(placement);
4542 const alignment = getAlignment(placement);
4543 const isYAxis = getSideAxis(placement) === "y";
4544 const {
4545 width,
4546 height
4547 } = rects.floating;
4548 let heightSide;
4549 let widthSide;
4550 if (side === "top" || side === "bottom") {
4551 heightSide = side;
4552 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
4553 } else {
4554 widthSide = side;
4555 heightSide = alignment === "end" ? "top" : "bottom";
4556 }
4557 const maximumClippingHeight = height - overflow.top - overflow.bottom;
4558 const maximumClippingWidth = width - overflow.left - overflow.right;
4559 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
4560 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
4561 const shiftData = state.middlewareData.shift;
4562 const noShift = !shiftData;
4563 let availableHeight2 = overflowAvailableHeight;
4564 let availableWidth2 = overflowAvailableWidth;
4565 if (shiftData != null && shiftData.enabled.x) {
4566 availableWidth2 = maximumClippingWidth;
4567 }
4568 if (shiftData != null && shiftData.enabled.y) {
4569 availableHeight2 = maximumClippingHeight;
4570 }
4571 if (noShift && !alignment) {
4572 if (isYAxis) {
4573 availableWidth2 = width - 2 * max(overflow.left, overflow.right);
4574 } else {
4575 availableHeight2 = height - 2 * max(overflow.top, overflow.bottom);
4576 }
4577 }
4578 await apply({
4579 ...state,
4580 availableWidth: availableWidth2,
4581 availableHeight: availableHeight2
4582 });
4583 const nextDimensions = await platform3.getDimensions(elements.floating);
4584 if (width !== nextDimensions.width || height !== nextDimensions.height) {
4585 return {
4586 reset: {
4587 rects: true
4588 }
4589 };
4590 }
4591 return {};
4592 }
4593 };
4594 };
4595
4596 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
4597 function getCssDimensions(element) {
4598 const css = getComputedStyle2(element);
4599 let width = parseFloat(css.width) || 0;
4600 let height = parseFloat(css.height) || 0;
4601 const hasOffset = isHTMLElement(element);
4602 const offsetWidth = hasOffset ? element.offsetWidth : width;
4603 const offsetHeight = hasOffset ? element.offsetHeight : height;
4604 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
4605 if (shouldFallback) {
4606 width = offsetWidth;
4607 height = offsetHeight;
4608 }
4609 return {
4610 width,
4611 height,
4612 $: shouldFallback
4613 };
4614 }
4615 function unwrapElement(element) {
4616 return !isElement(element) ? element.contextElement : element;
4617 }
4618 function getScale(element) {
4619 const domElement = unwrapElement(element);
4620 if (!isHTMLElement(domElement)) {
4621 return createCoords(1);
4622 }
4623 const rect = domElement.getBoundingClientRect();
4624 const {
4625 width,
4626 height,
4627 $: $2
4628 } = getCssDimensions(domElement);
4629 let x2 = ($2 ? round(rect.width) : rect.width) / width;
4630 let y2 = ($2 ? round(rect.height) : rect.height) / height;
4631 if (!x2 || !Number.isFinite(x2)) {
4632 x2 = 1;
4633 }
4634 if (!y2 || !Number.isFinite(y2)) {
4635 y2 = 1;
4636 }
4637 return {
4638 x: x2,
4639 y: y2
4640 };
4641 }
4642 var noOffsets = /* @__PURE__ */ createCoords(0);
4643 function getVisualOffsets(element) {
4644 const win = getWindow(element);
4645 if (!isWebKit() || !win.visualViewport) {
4646 return noOffsets;
4647 }
4648 return {
4649 x: win.visualViewport.offsetLeft,
4650 y: win.visualViewport.offsetTop
4651 };
4652 }
4653 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
4654 if (isFixed === void 0) {
4655 isFixed = false;
4656 }
4657 return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
4658 }
4659 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
4660 if (includeScale === void 0) {
4661 includeScale = false;
4662 }
4663 if (isFixedStrategy === void 0) {
4664 isFixedStrategy = false;
4665 }
4666 const clientRect = element.getBoundingClientRect();
4667 const domElement = unwrapElement(element);
4668 let scale = createCoords(1);
4669 if (includeScale) {
4670 if (offsetParent) {
4671 if (isElement(offsetParent)) {
4672 scale = getScale(offsetParent);
4673 }
4674 } else {
4675 scale = getScale(element);
4676 }
4677 }
4678 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
4679 let x2 = (clientRect.left + visualOffsets.x) / scale.x;
4680 let y2 = (clientRect.top + visualOffsets.y) / scale.y;
4681 let width = clientRect.width / scale.x;
4682 let height = clientRect.height / scale.y;
4683 if (domElement && offsetParent) {
4684 const win = getWindow(domElement);
4685 const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
4686 let currentWin = win;
4687 let currentIFrame = getFrameElement(currentWin);
4688 while (currentIFrame && offsetWin !== currentWin) {
4689 const iframeScale = getScale(currentIFrame);
4690 const iframeRect = currentIFrame.getBoundingClientRect();
4691 const css = getComputedStyle2(currentIFrame);
4692 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
4693 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
4694 x2 *= iframeScale.x;
4695 y2 *= iframeScale.y;
4696 width *= iframeScale.x;
4697 height *= iframeScale.y;
4698 x2 += left;
4699 y2 += top;
4700 currentWin = getWindow(currentIFrame);
4701 currentIFrame = getFrameElement(currentWin);
4702 }
4703 }
4704 return rectToClientRect({
4705 width,
4706 height,
4707 x: x2,
4708 y: y2
4709 });
4710 }
4711 function getWindowScrollBarX(element, rect) {
4712 const leftScroll = getNodeScroll(element).scrollLeft;
4713 if (!rect) {
4714 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
4715 }
4716 return rect.left + leftScroll;
4717 }
4718 function getHTMLOffset(documentElement, scroll) {
4719 const htmlRect = documentElement.getBoundingClientRect();
4720 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
4721 const y2 = htmlRect.top + scroll.scrollTop;
4722 return {
4723 x: x2,
4724 y: y2
4725 };
4726 }
4727 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4728 let {
4729 elements,
4730 rect,
4731 offsetParent,
4732 strategy
4733 } = _ref;
4734 const isFixed = strategy === "fixed";
4735 const documentElement = getDocumentElement(offsetParent);
4736 const topLayer = elements ? isTopLayer(elements.floating) : false;
4737 if (offsetParent === documentElement || topLayer && isFixed) {
4738 return rect;
4739 }
4740 let scroll = {
4741 scrollLeft: 0,
4742 scrollTop: 0
4743 };
4744 let scale = createCoords(1);
4745 const offsets = createCoords(0);
4746 const isOffsetParentAnElement = isHTMLElement(offsetParent);
4747 if (isOffsetParentAnElement || !isFixed) {
4748 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4749 scroll = getNodeScroll(offsetParent);
4750 }
4751 if (isOffsetParentAnElement) {
4752 const offsetRect = getBoundingClientRect(offsetParent);
4753 scale = getScale(offsetParent);
4754 offsets.x = offsetRect.x + offsetParent.clientLeft;
4755 offsets.y = offsetRect.y + offsetParent.clientTop;
4756 }
4757 }
4758 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4759 return {
4760 width: rect.width * scale.x,
4761 height: rect.height * scale.y,
4762 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
4763 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
4764 };
4765 }
4766 function getClientRects(element) {
4767 return element.getClientRects ? Array.from(element.getClientRects()) : [];
4768 }
4769 function getDocumentRect(html) {
4770 const scroll = getNodeScroll(html);
4771 const body = html.ownerDocument.body;
4772 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
4773 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
4774 let x2 = -scroll.scrollLeft + getWindowScrollBarX(html);
4775 const y2 = -scroll.scrollTop;
4776 if (getComputedStyle2(body).direction === "rtl") {
4777 x2 += max(html.clientWidth, body.clientWidth) - width;
4778 }
4779 return {
4780 width,
4781 height,
4782 x: x2,
4783 y: y2
4784 };
4785 }
4786 var SCROLLBAR_MAX = 25;
4787 function getViewportRect(element, strategy, rootBoundary) {
4788 if (rootBoundary === void 0) {
4789 rootBoundary = "viewport";
4790 }
4791 const isLayoutViewport = rootBoundary === "layoutViewport";
4792 const win = getWindow(element);
4793 const html = getDocumentElement(element);
4794 const visualViewport = win.visualViewport;
4795 let width = html.clientWidth;
4796 let height = html.clientHeight;
4797 let x2 = 0;
4798 let y2 = 0;
4799 if (visualViewport) {
4800 const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
4801 if (isLayoutViewport) {
4802 if (!layoutRelativeClientCoords) {
4803 x2 = -visualViewport.offsetLeft;
4804 y2 = -visualViewport.offsetTop;
4805 }
4806 } else {
4807 width = visualViewport.width;
4808 height = visualViewport.height;
4809 if (layoutRelativeClientCoords) {
4810 x2 = visualViewport.offsetLeft;
4811 y2 = visualViewport.offsetTop;
4812 }
4813 }
4814 }
4815 const windowScrollbarX = getWindowScrollBarX(html);
4816 if (windowScrollbarX <= 0) {
4817 const doc = html.ownerDocument;
4818 const body = doc.body;
4819 const bodyStyles = getComputedStyle(body);
4820 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
4821 const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
4822 const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
4823 if (gutter <= SCROLLBAR_MAX) {
4824 width -= gutter;
4825 }
4826 }
4827 return {
4828 width,
4829 height,
4830 x: x2,
4831 y: y2
4832 };
4833 }
4834 function getInnerBoundingClientRect(element, strategy) {
4835 const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
4836 const top = clientRect.top + element.clientTop;
4837 const left = clientRect.left + element.clientLeft;
4838 const scale = getScale(element);
4839 const width = element.clientWidth * scale.x;
4840 const height = element.clientHeight * scale.y;
4841 const x2 = left * scale.x;
4842 const y2 = top * scale.y;
4843 return {
4844 width,
4845 height,
4846 x: x2,
4847 y: y2
4848 };
4849 }
4850 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
4851 let rect;
4852 if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
4853 rect = getViewportRect(element, strategy, clippingAncestor);
4854 } else if (clippingAncestor === "document") {
4855 rect = getDocumentRect(getDocumentElement(element));
4856 } else if (isElement(clippingAncestor)) {
4857 rect = getInnerBoundingClientRect(clippingAncestor, strategy);
4858 } else {
4859 const visualOffsets = getVisualOffsets(element);
4860 rect = {
4861 x: clippingAncestor.x - visualOffsets.x,
4862 y: clippingAncestor.y - visualOffsets.y,
4863 width: clippingAncestor.width,
4864 height: clippingAncestor.height
4865 };
4866 }
4867 return rectToClientRect(rect);
4868 }
4869 function getClippingElementAncestors(element, cache) {
4870 const cachedResult = cache.get(element);
4871 if (cachedResult) {
4872 return cachedResult;
4873 }
4874 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
4875 let lastKeptComputedStyle = null;
4876 const elementIsFixed = getComputedStyle2(element).position === "fixed";
4877 let currentNode = elementIsFixed ? getParentNode(element) : element;
4878 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
4879 const computedStyle = getComputedStyle2(currentNode);
4880 const currentNodeIsContaining = isContainingBlock(currentNode);
4881 const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
4882 const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
4883 if (shouldDropCurrentNode) {
4884 result = result.filter((ancestor) => ancestor !== currentNode);
4885 } else {
4886 lastKeptComputedStyle = computedStyle;
4887 }
4888 currentNode = getParentNode(currentNode);
4889 }
4890 cache.set(element, result);
4891 return result;
4892 }
4893 function getClippingRect(_ref) {
4894 let {
4895 element,
4896 boundary,
4897 rootBoundary,
4898 strategy
4899 } = _ref;
4900 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
4901 const clippingAncestors = [...elementClippingAncestors, rootBoundary];
4902 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
4903 let top = firstRect.top;
4904 let right = firstRect.right;
4905 let bottom = firstRect.bottom;
4906 let left = firstRect.left;
4907 for (let i = 1; i < clippingAncestors.length; i++) {
4908 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
4909 top = max(rect.top, top);
4910 right = min(rect.right, right);
4911 bottom = min(rect.bottom, bottom);
4912 left = max(rect.left, left);
4913 }
4914 return {
4915 width: right - left,
4916 height: bottom - top,
4917 x: left,
4918 y: top
4919 };
4920 }
4921 function getDimensions2(element) {
4922 const {
4923 width,
4924 height
4925 } = getCssDimensions(element);
4926 return {
4927 width,
4928 height
4929 };
4930 }
4931 function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
4932 const isOffsetParentAnElement = isHTMLElement(offsetParent);
4933 const documentElement = getDocumentElement(offsetParent);
4934 const isFixed = strategy === "fixed";
4935 const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
4936 let scroll = {
4937 scrollLeft: 0,
4938 scrollTop: 0
4939 };
4940 const offsets = createCoords(0);
4941 if (isOffsetParentAnElement || !isFixed) {
4942 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4943 scroll = getNodeScroll(offsetParent);
4944 }
4945 if (isOffsetParentAnElement) {
4946 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
4947 offsets.x = offsetRect.x + offsetParent.clientLeft;
4948 offsets.y = offsetRect.y + offsetParent.clientTop;
4949 }
4950 }
4951 if (!isOffsetParentAnElement && documentElement) {
4952 offsets.x = getWindowScrollBarX(documentElement);
4953 }
4954 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4955 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
4956 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
4957 return {
4958 x: x2,
4959 y: y2,
4960 width: rect.width,
4961 height: rect.height
4962 };
4963 }
4964 function isStaticPositioned(element) {
4965 return getComputedStyle2(element).position === "static";
4966 }
4967 function getTrueOffsetParent(element, polyfill) {
4968 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
4969 return null;
4970 }
4971 if (polyfill) {
4972 return polyfill(element);
4973 }
4974 let rawOffsetParent = element.offsetParent;
4975 if (getDocumentElement(element) === rawOffsetParent) {
4976 rawOffsetParent = rawOffsetParent.ownerDocument.body;
4977 }
4978 return rawOffsetParent;
4979 }
4980 function getOffsetParent(element, polyfill) {
4981 const win = getWindow(element);
4982 if (isTopLayer(element)) {
4983 return win;
4984 }
4985 if (!isHTMLElement(element)) {
4986 let svgOffsetParent = getParentNode(element);
4987 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
4988 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
4989 return svgOffsetParent;
4990 }
4991 svgOffsetParent = getParentNode(svgOffsetParent);
4992 }
4993 return win;
4994 }
4995 let offsetParent = getTrueOffsetParent(element, polyfill);
4996 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
4997 offsetParent = getTrueOffsetParent(offsetParent, polyfill);
4998 }
4999 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
5000 return win;
5001 }
5002 return offsetParent || getContainingBlock(element) || win;
5003 }
5004 var getElementRects = async function(data) {
5005 const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5006 const getDimensionsFn = this.getDimensions;
5007 const floatingDimensions = await getDimensionsFn(data.floating);
5008 return {
5009 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
5010 floating: {
5011 x: 0,
5012 y: 0,
5013 width: floatingDimensions.width,
5014 height: floatingDimensions.height
5015 }
5016 };
5017 };
5018 function isRTL(element) {
5019 return getComputedStyle2(element).direction === "rtl";
5020 }
5021 var platform2 = {
5022 convertOffsetParentRelativeRectToViewportRelativeRect,
5023 getDocumentElement,
5024 getClippingRect,
5025 getOffsetParent,
5026 getElementRects,
5027 getClientRects,
5028 getDimensions: getDimensions2,
5029 getScale,
5030 isElement,
5031 isRTL
5032 };
5033 function rectsAreEqual(a, b) {
5034 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
5035 }
5036 function observeMove(element, onMove, ancestorResize) {
5037 let io = null;
5038 let timeoutId;
5039 const root = getDocumentElement(element);
5040 function cleanup() {
5041 var _io;
5042 clearTimeout(timeoutId);
5043 (_io = io) == null || _io.disconnect();
5044 io = null;
5045 }
5046 function refresh(skip, threshold) {
5047 if (skip === void 0) {
5048 skip = false;
5049 }
5050 if (threshold === void 0) {
5051 threshold = 1;
5052 }
5053 cleanup();
5054 const elementRectForRootMargin = element.getBoundingClientRect();
5055 const {
5056 left,
5057 top,
5058 width,
5059 height
5060 } = elementRectForRootMargin;
5061 if (!skip) {
5062 onMove();
5063 }
5064 if (!width || !height) {
5065 return;
5066 }
5067 const insetTop = floor(top);
5068 const insetRight = floor(root.clientWidth - (left + width));
5069 const insetBottom = floor(root.clientHeight - (top + height));
5070 const insetLeft = floor(left);
5071 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
5072 const options = {
5073 rootMargin,
5074 threshold: max(0, min(1, threshold)) || 1
5075 };
5076 let isFirstUpdate = true;
5077 function handleObserve(entries) {
5078 const ratio = entries[0].intersectionRatio;
5079 if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
5080 return refresh();
5081 }
5082 if (ratio !== threshold) {
5083 if (!isFirstUpdate) {
5084 return refresh();
5085 }
5086 if (!ratio) {
5087 timeoutId = setTimeout(() => {
5088 refresh(false, 1e-7);
5089 }, 1e3);
5090 } else {
5091 refresh(false, ratio);
5092 }
5093 }
5094 isFirstUpdate = false;
5095 }
5096 try {
5097 io = new IntersectionObserver(handleObserve, {
5098 ...options,
5099 // Handle <iframe>s
5100 root: root.ownerDocument
5101 });
5102 } catch (_e) {
5103 io = new IntersectionObserver(handleObserve, options);
5104 }
5105 io.observe(element);
5106 }
5107 const win = getWindow(element);
5108 const handleResize = () => refresh(ancestorResize);
5109 win.addEventListener("resize", handleResize);
5110 refresh(true);
5111 return () => {
5112 win.removeEventListener("resize", handleResize);
5113 cleanup();
5114 };
5115 }
5116 function autoUpdate(reference, floating, update4, options) {
5117 if (options === void 0) {
5118 options = {};
5119 }
5120 const {
5121 ancestorScroll = true,
5122 ancestorResize = true,
5123 elementResize = typeof ResizeObserver === "function",
5124 layoutShift = typeof IntersectionObserver === "function",
5125 animationFrame = false
5126 } = options;
5127 const referenceEl = unwrapElement(reference);
5128 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
5129 ancestors.forEach((ancestor) => {
5130 ancestorScroll && ancestor.addEventListener("scroll", update4);
5131 ancestorResize && ancestor.addEventListener("resize", update4);
5132 });
5133 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update4, ancestorResize) : null;
5134 let reobserveFrame = -1;
5135 let resizeObserver = null;
5136 if (elementResize) {
5137 resizeObserver = new ResizeObserver((_ref) => {
5138 let [firstEntry] = _ref;
5139 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5140 resizeObserver.unobserve(floating);
5141 cancelAnimationFrame(reobserveFrame);
5142 reobserveFrame = requestAnimationFrame(() => {
5143 var _resizeObserver;
5144 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
5145 });
5146 }
5147 update4();
5148 });
5149 if (referenceEl && !animationFrame) {
5150 resizeObserver.observe(referenceEl);
5151 }
5152 if (floating) {
5153 resizeObserver.observe(floating);
5154 }
5155 }
5156 let frameId;
5157 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
5158 if (animationFrame) {
5159 frameLoop2();
5160 }
5161 function frameLoop2() {
5162 const nextRefRect = getBoundingClientRect(reference);
5163 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
5164 update4();
5165 }
5166 prevRefRect = nextRefRect;
5167 frameId = requestAnimationFrame(frameLoop2);
5168 }
5169 update4();
5170 return () => {
5171 var _resizeObserver2;
5172 ancestors.forEach((ancestor) => {
5173 ancestorScroll && ancestor.removeEventListener("scroll", update4);
5174 ancestorResize && ancestor.removeEventListener("resize", update4);
5175 });
5176 cleanupIo == null || cleanupIo();
5177 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
5178 resizeObserver = null;
5179 if (animationFrame) {
5180 cancelAnimationFrame(frameId);
5181 }
5182 };
5183 }
5184 var offset2 = offset;
5185 var shift2 = shift;
5186 var flip2 = flip;
5187 var size2 = size;
5188 var limitShift2 = limitShift;
5189 var computePosition2 = (reference, floating, options) => {
5190 const cache = /* @__PURE__ */ new Map();
5191 const mergedOptions = options != null ? options : {};
5192 const platformWithCache = {
5193 ...platform2,
5194 ...mergedOptions.platform,
5195 _c: cache
5196 };
5197 return computePosition(reference, floating, {
5198 ...mergedOptions,
5199 platform: platformWithCache
5200 });
5201 };
5202
5203 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
5204 var React24 = __toESM(require_react(), 1);
5205 var import_react2 = __toESM(require_react(), 1);
5206 var ReactDOM3 = __toESM(require_react_dom(), 1);
5207 var isClient = typeof document !== "undefined";
5208 var noop2 = function noop3() {
5209 };
5210 var index = isClient ? import_react2.useLayoutEffect : noop2;
5211 function deepEqual(a, b) {
5212 if (a === b) {
5213 return true;
5214 }
5215 if (typeof a !== typeof b) {
5216 return false;
5217 }
5218 if (typeof a === "function" && a.toString() === b.toString()) {
5219 return true;
5220 }
5221 let length;
5222 let i;
5223 let keys;
5224 if (a && b && typeof a === "object") {
5225 if (Array.isArray(a)) {
5226 length = a.length;
5227 if (length !== b.length) return false;
5228 for (i = length; i-- !== 0; ) {
5229 if (!deepEqual(a[i], b[i])) {
5230 return false;
5231 }
5232 }
5233 return true;
5234 }
5235 keys = Object.keys(a);
5236 length = keys.length;
5237 if (length !== Object.keys(b).length) {
5238 return false;
5239 }
5240 for (i = length; i-- !== 0; ) {
5241 if (!{}.hasOwnProperty.call(b, keys[i])) {
5242 return false;
5243 }
5244 }
5245 for (i = length; i-- !== 0; ) {
5246 const key = keys[i];
5247 if (key === "_owner" && a.$$typeof) {
5248 continue;
5249 }
5250 if (!deepEqual(a[key], b[key])) {
5251 return false;
5252 }
5253 }
5254 return true;
5255 }
5256 return a !== a && b !== b;
5257 }
5258 function getDPR(element) {
5259 if (typeof window === "undefined") {
5260 return 1;
5261 }
5262 const win = element.ownerDocument.defaultView || window;
5263 return win.devicePixelRatio || 1;
5264 }
5265 function roundByDPR(element, value) {
5266 const dpr = getDPR(element);
5267 return Math.round(value * dpr) / dpr;
5268 }
5269 function useLatestRef(value) {
5270 const ref = React24.useRef(value);
5271 index(() => {
5272 ref.current = value;
5273 });
5274 return ref;
5275 }
5276 function useFloating(options) {
5277 if (options === void 0) {
5278 options = {};
5279 }
5280 const {
5281 placement = "bottom",
5282 strategy = "absolute",
5283 middleware = [],
5284 platform: platform3,
5285 elements: {
5286 reference: externalReference,
5287 floating: externalFloating
5288 } = {},
5289 transform = true,
5290 whileElementsMounted,
5291 open: open3
5292 } = options;
5293 const [data, setData] = React24.useState({
5294 x: 0,
5295 y: 0,
5296 strategy,
5297 placement,
5298 middlewareData: {},
5299 isPositioned: false
5300 });
5301 const [latestMiddleware, setLatestMiddleware] = React24.useState(middleware);
5302 if (!deepEqual(latestMiddleware, middleware)) {
5303 setLatestMiddleware(middleware);
5304 }
5305 const [_reference, _setReference] = React24.useState(null);
5306 const [_floating, _setFloating] = React24.useState(null);
5307 const setReference = React24.useCallback((node) => {
5308 if (node !== referenceRef.current) {
5309 referenceRef.current = node;
5310 _setReference(node);
5311 }
5312 }, []);
5313 const setFloating = React24.useCallback((node) => {
5314 if (node !== floatingRef.current) {
5315 floatingRef.current = node;
5316 _setFloating(node);
5317 }
5318 }, []);
5319 const referenceEl = externalReference || _reference;
5320 const floatingEl = externalFloating || _floating;
5321 const referenceRef = React24.useRef(null);
5322 const floatingRef = React24.useRef(null);
5323 const dataRef = React24.useRef(data);
5324 const hasWhileElementsMounted = whileElementsMounted != null;
5325 const whileElementsMountedRef = useLatestRef(whileElementsMounted);
5326 const platformRef = useLatestRef(platform3);
5327 const openRef = useLatestRef(open3);
5328 const update4 = React24.useCallback(() => {
5329 if (!referenceRef.current || !floatingRef.current) {
5330 return;
5331 }
5332 const config2 = {
5333 placement,
5334 strategy,
5335 middleware: latestMiddleware
5336 };
5337 if (platformRef.current) {
5338 config2.platform = platformRef.current;
5339 }
5340 computePosition2(referenceRef.current, floatingRef.current, config2).then((data2) => {
5341 const fullData = {
5342 ...data2,
5343 // The floating element's position may be recomputed while it's closed
5344 // but still mounted (such as when transitioning out). To ensure
5345 // `isPositioned` will be `false` initially on the next open, avoid
5346 // setting it to `true` when `open === false` (must be specified).
5347 isPositioned: openRef.current !== false
5348 };
5349 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
5350 dataRef.current = fullData;
5351 ReactDOM3.flushSync(() => {
5352 setData(fullData);
5353 });
5354 }
5355 });
5356 }, [latestMiddleware, placement, strategy, platformRef, openRef]);
5357 index(() => {
5358 if (open3 === false && dataRef.current.isPositioned) {
5359 dataRef.current.isPositioned = false;
5360 setData((data2) => ({
5361 ...data2,
5362 isPositioned: false
5363 }));
5364 }
5365 }, [open3]);
5366 const isMountedRef = React24.useRef(false);
5367 index(() => {
5368 isMountedRef.current = true;
5369 return () => {
5370 isMountedRef.current = false;
5371 };
5372 }, []);
5373 index(() => {
5374 if (referenceEl) referenceRef.current = referenceEl;
5375 if (floatingEl) floatingRef.current = floatingEl;
5376 if (referenceEl && floatingEl) {
5377 if (whileElementsMountedRef.current) {
5378 return whileElementsMountedRef.current(referenceEl, floatingEl, update4);
5379 }
5380 update4();
5381 }
5382 }, [referenceEl, floatingEl, update4, whileElementsMountedRef, hasWhileElementsMounted]);
5383 const refs = React24.useMemo(() => ({
5384 reference: referenceRef,
5385 floating: floatingRef,
5386 setReference,
5387 setFloating
5388 }), [setReference, setFloating]);
5389 const elements = React24.useMemo(() => ({
5390 reference: referenceEl,
5391 floating: floatingEl
5392 }), [referenceEl, floatingEl]);
5393 const floatingStyles = React24.useMemo(() => {
5394 const initialStyles = {
5395 position: strategy,
5396 left: 0,
5397 top: 0
5398 };
5399 if (!elements.floating) {
5400 return initialStyles;
5401 }
5402 const x2 = roundByDPR(elements.floating, data.x);
5403 const y2 = roundByDPR(elements.floating, data.y);
5404 if (transform) {
5405 return {
5406 ...initialStyles,
5407 transform: "translate(" + x2 + "px, " + y2 + "px)",
5408 ...getDPR(elements.floating) >= 1.5 && {
5409 willChange: "transform"
5410 }
5411 };
5412 }
5413 return {
5414 position: strategy,
5415 left: x2,
5416 top: y2
5417 };
5418 }, [strategy, transform, elements.floating, data.x, data.y]);
5419 return React24.useMemo(() => ({
5420 ...data,
5421 update: update4,
5422 refs,
5423 elements,
5424 floatingStyles
5425 }), [data, update4, refs, elements, floatingStyles]);
5426 }
5427 var offset3 = (options, deps) => {
5428 const result = offset2(options);
5429 return {
5430 name: result.name,
5431 fn: result.fn,
5432 options: [options, deps]
5433 };
5434 };
5435 var shift3 = (options, deps) => {
5436 const result = shift2(options);
5437 return {
5438 name: result.name,
5439 fn: result.fn,
5440 options: [options, deps]
5441 };
5442 };
5443 var limitShift3 = (options, deps) => {
5444 const result = limitShift2(options);
5445 return {
5446 fn: result.fn,
5447 options: [options, deps]
5448 };
5449 };
5450 var flip3 = (options, deps) => {
5451 const result = flip2(options);
5452 return {
5453 name: result.name,
5454 fn: result.fn,
5455 options: [options, deps]
5456 };
5457 };
5458 var size3 = (options, deps) => {
5459 const result = size2(options);
5460 return {
5461 name: result.name,
5462 fn: result.fn,
5463 options: [options, deps]
5464 };
5465 };
5466
5467 // node_modules/@base-ui/react/utils/popups/popupHandle.mjs
5468 var BasePopupHandle = class {
5469 /**
5470 * Stores of every root currently using this handle, in attach order. A handle is meant to be used
5471 * by a single mounted root, but roots can transiently overlap (e.g. during an animated route
5472 * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of
5473 * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.
5474 */
5475 attachedStores = [];
5476 /**
5477 * Store of the root that currently controls the handle: the most recently attached one still
5478 * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.
5479 */
5480 attachedStoreValue = null;
5481 /**
5482 * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.
5483 */
5484 storeListeners = /* @__PURE__ */ new Set();
5485 /**
5486 * Creates a handle backed by the store used while no root is attached.
5487 *
5488 * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,
5489 * so they can render and register without a mounted root. Triggers register into whichever store
5490 * `store` currently resolves to, so while detached they live in this store's trigger map and
5491 * migrate themselves to the root's store (and back) as it attaches/detaches.
5492 * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces
5493 * `MenuHandle.open()` in warning text.
5494 * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is
5495 * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,
5496 * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.
5497 */
5498 constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {
5499 this.fallbackStore = fallbackStore;
5500 this.componentName = componentName;
5501 this.throwOnMissingTrigger = throwOnMissingTrigger;
5502 }
5503 get attachedStore() {
5504 return this.attachedStoreValue;
5505 }
5506 /**
5507 * Store that detached triggers read from: the attached root's store, or an inert fallback store
5508 * used while no root is attached.
5509 * @internal
5510 */
5511 get store() {
5512 return this.attachedStoreValue ?? this.fallbackStore;
5513 }
5514 /**
5515 * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on
5516 * the handle during render because a handle can be shared by concurrent server-rendered requests.
5517 * @internal
5518 */
5519 get serverStore() {
5520 return this.fallbackStore;
5521 }
5522 /**
5523 * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind
5524 * when a root attaches or detaches. Returns a function that removes the listener.
5525 * @internal
5526 */
5527 subscribeStore(listener) {
5528 this.storeListeners.add(listener);
5529 return () => {
5530 this.storeListeners.delete(listener);
5531 };
5532 }
5533 /**
5534 * Points the handle at a root's store and notifies subscribers so detached triggers re-render and
5535 * re-register into it (their registration effect migrates them when the store pointer changes).
5536 * Returns a cleanup function that detaches the store again.
5537 * @internal
5538 */
5539 attachStore(newStore) {
5540 this.attachedStores.push(newStore);
5541 this.setActiveStore(newStore);
5542 if (true) {
5543 if (this.attachedStores.length > 1) {
5544 const dev = this;
5545 (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => {
5546 if (this.attachedStores.length > 1) {
5547 console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.");
5548 }
5549 });
5550 }
5551 }
5552 return () => {
5553 const index2 = this.attachedStores.lastIndexOf(newStore);
5554 if (index2 !== -1) {
5555 this.attachedStores.splice(index2, 1);
5556 }
5557 this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);
5558 };
5559 }
5560 /**
5561 * Sets the store that currently controls the handle and notifies subscribers when it changes, so
5562 * detached triggers re-render and migrate their registration to the new store.
5563 */
5564 setActiveStore(store) {
5565 if (this.attachedStoreValue !== store) {
5566 this.attachedStoreValue = store;
5567 this.storeListeners.forEach((listener) => {
5568 listener();
5569 });
5570 }
5571 }
5572 /**
5573 * Opens the attached root's store and associates it with the trigger with the given id, or a
5574 * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public
5575 * `open()` method, which only narrows the parameter type.
5576 *
5577 * When a trigger id is given but no matching trigger is registered, anchored popups throw (see
5578 * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.
5579 *
5580 * This method should only be called in an event handler or an effect (not during rendering).
5581 *
5582 * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open
5583 * without associating any trigger.
5584 */
5585 openByTrigger(triggerId) {
5586 const attachedStore = this.attachedStore;
5587 if (attachedStore === null) {
5588 if (true) {
5589 console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);
5590 }
5591 return;
5592 }
5593 let triggerElement;
5594 if (triggerId) {
5595 for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {
5596 triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);
5597 }
5598 triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);
5599 }
5600 if (triggerId && !triggerElement) {
5601 if (this.throwOnMissingTrigger) {
5602 throw new Error(true ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id "${triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName));
5603 }
5604 if (true) {
5605 console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${triggerId}". The popup will open, but the trigger will not be associated with it.`);
5606 }
5607 }
5608 attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
5609 }
5610 /**
5611 * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)
5612 * while no root is attached. Shared by every concrete handle's public `close()` method.
5613 *
5614 * This method should only be called in an event handler or an effect (not during rendering).
5615 */
5616 closePopup() {
5617 const attachedStore = this.attachedStore;
5618 if (attachedStore === null) {
5619 if (true) {
5620 console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);
5621 }
5622 return;
5623 }
5624 attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
5625 }
5626 };
5627
5628 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
5629 var React29 = __toESM(require_react(), 1);
5630 var ReactDOM4 = __toESM(require_react_dom(), 1);
5631
5632 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
5633 var React28 = __toESM(require_react(), 1);
5634
5635 // node_modules/@base-ui/utils/store/useStore.mjs
5636 var React26 = __toESM(require_react(), 1);
5637 var import_shim = __toESM(require_shim(), 1);
5638 var import_with_selector = __toESM(require_with_selector(), 1);
5639
5640 // node_modules/@base-ui/utils/fastHooks.mjs
5641 var React25 = __toESM(require_react(), 1);
5642 var hooks = [];
5643 var currentInstance = void 0;
5644 function getInstance() {
5645 return currentInstance;
5646 }
5647 function register(hook) {
5648 hooks.push(hook);
5649 }
5650 function fastComponent(fn) {
5651 const FastComponent = (props, forwardedRef) => {
5652 const instance = useRefWithInit(createInstance).current;
5653 let result;
5654 try {
5655 currentInstance = instance;
5656 for (const hook of hooks) {
5657 hook.before(instance);
5658 }
5659 result = fn(props, forwardedRef);
5660 for (const hook of hooks) {
5661 hook.after(instance);
5662 }
5663 instance.didInitialize = true;
5664 } finally {
5665 currentInstance = void 0;
5666 }
5667 return result;
5668 };
5669 FastComponent.displayName = fn.displayName || fn.name;
5670 return FastComponent;
5671 }
5672 function fastComponentRef(fn) {
5673 return /* @__PURE__ */ React25.forwardRef(fastComponent(fn));
5674 }
5675 function createInstance() {
5676 return {
5677 didInitialize: false
5678 };
5679 }
5680
5681 // node_modules/@base-ui/utils/store/useStore.mjs
5682 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
5683 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
5684 function useStore(store, selector, a1, a2, a3) {
5685 return useStoreImplementation(store, selector, a1, a2, a3);
5686 }
5687 function useStoreR19(store, selector, a1, a2, a3) {
5688 const getSelection = React26.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);
5689 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection);
5690 }
5691 register({
5692 before(instance) {
5693 instance.syncIndex = 0;
5694 if (!instance.didInitialize) {
5695 instance.syncTick = 1;
5696 instance.syncHooks = [];
5697 instance.didChangeStore = true;
5698 instance.getSnapshot = () => {
5699 let didChange2 = false;
5700 for (let i = 0; i < instance.syncHooks.length; i += 1) {
5701 const hook = instance.syncHooks[i];
5702 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
5703 if (!Object.is(hook.value, value)) {
5704 didChange2 = true;
5705 hook.value = value;
5706 }
5707 }
5708 if (didChange2) {
5709 instance.syncTick += 1;
5710 }
5711 return instance.syncTick;
5712 };
5713 }
5714 },
5715 after(instance) {
5716 if (instance.syncHooks.length > 0) {
5717 if (instance.didChangeStore) {
5718 instance.didChangeStore = false;
5719 instance.subscribe = (onStoreChange) => {
5720 const stores = /* @__PURE__ */ new Set();
5721 for (const hook of instance.syncHooks) {
5722 stores.add(hook.store);
5723 }
5724 const unsubscribes = [];
5725 for (const store of stores) {
5726 unsubscribes.push(store.subscribe(onStoreChange));
5727 }
5728 return () => {
5729 for (const unsubscribe of unsubscribes) {
5730 unsubscribe();
5731 }
5732 };
5733 };
5734 }
5735 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
5736 }
5737 }
5738 });
5739 function useStoreFast(store, selector, a1, a2, a3) {
5740 const instance = getInstance();
5741 if (!instance) {
5742 return useStoreR19(store, selector, a1, a2, a3);
5743 }
5744 const index2 = instance.syncIndex;
5745 instance.syncIndex += 1;
5746 let hook;
5747 if (!instance.didInitialize) {
5748 hook = {
5749 store,
5750 selector,
5751 a1,
5752 a2,
5753 a3,
5754 value: selector(store.getSnapshot(), a1, a2, a3)
5755 };
5756 instance.syncHooks.push(hook);
5757 } else {
5758 hook = instance.syncHooks[index2];
5759 if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
5760 if (hook.store !== store) {
5761 instance.didChangeStore = true;
5762 }
5763 hook.store = store;
5764 hook.selector = selector;
5765 hook.a1 = a1;
5766 hook.a2 = a2;
5767 hook.a3 = a3;
5768 hook.value = selector(store.getSnapshot(), a1, a2, a3);
5769 }
5770 }
5771 return hook.value;
5772 }
5773 function useStoreLegacy(store, selector, a1, a2, a3) {
5774 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3));
5775 }
5776
5777 // node_modules/@base-ui/utils/store/Store.mjs
5778 var Store = class {
5779 /**
5780 * Creates a store with the given initial state, constructing the class it is called on.
5781 * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that
5782 * class but degrades the inferred instance type to `Store`; use `new` there instead.
5783 */
5784 static create(state) {
5785 return new this(state);
5786 }
5787 /**
5788 * The current state of the store.
5789 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
5790 * 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).
5791 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
5792 *
5793 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
5794 */
5795 // Internal state to handle recursive `setState()` calls
5796 constructor(state) {
5797 this.state = state;
5798 this.listeners = /* @__PURE__ */ new Set();
5799 this.updateTick = 0;
5800 }
5801 /**
5802 * Registers a listener that will be called whenever the store's state changes.
5803 *
5804 * @param fn The listener function to be called on state changes.
5805 * @returns A function to unsubscribe the listener.
5806 */
5807 subscribe = (fn) => {
5808 this.listeners.add(fn);
5809 return () => {
5810 this.listeners.delete(fn);
5811 };
5812 };
5813 /**
5814 * Returns the current state of the store.
5815 */
5816 getSnapshot = () => {
5817 return this.state;
5818 };
5819 /**
5820 * Updates the entire store's state and notifies all registered listeners.
5821 *
5822 * @param newState The new state to set for the store.
5823 */
5824 setState(newState) {
5825 if (this.state === newState) {
5826 return;
5827 }
5828 this.state = newState;
5829 this.updateTick += 1;
5830 const currentTick = this.updateTick;
5831 for (const listener of this.listeners) {
5832 if (currentTick !== this.updateTick) {
5833 return;
5834 }
5835 listener(newState);
5836 }
5837 }
5838 /**
5839 * Merges the provided changes into the current state and notifies listeners if there are changes.
5840 * Each value must match its state key. Pass an exact known subset rather than a broad
5841 * `Partial<State>`, which may contain `undefined` for required state fields.
5842 *
5843 * @param changes An object containing the changes to apply to the current state.
5844 */
5845 update(changes) {
5846 for (const key in changes) {
5847 if (!Object.is(this.state[key], changes[key])) {
5848 this.setState({
5849 ...this.state,
5850 ...changes
5851 });
5852 return;
5853 }
5854 }
5855 }
5856 /**
5857 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
5858 *
5859 * @param key The key in the store's state to update.
5860 * @param value The new value to set for the specified key.
5861 */
5862 set(key, value) {
5863 if (!Object.is(this.state[key], value)) {
5864 this.setState({
5865 ...this.state,
5866 [key]: value
5867 });
5868 }
5869 }
5870 /**
5871 * Gives the state a new reference and updates all registered listeners.
5872 */
5873 notifyAll() {
5874 const newState = {
5875 ...this.state
5876 };
5877 this.setState(newState);
5878 }
5879 use(selector, a1, a2, a3) {
5880 return useStore(this, selector, a1, a2, a3);
5881 }
5882 };
5883
5884 // node_modules/@base-ui/utils/store/ReactStore.mjs
5885 var React27 = __toESM(require_react(), 1);
5886 var ReactStore = class extends Store {
5887 /**
5888 * Creates a new ReactStore instance.
5889 *
5890 * @param state Initial state of the store.
5891 * @param context Non-reactive context values.
5892 * @param selectors Optional selectors for use with `useState`.
5893 */
5894 constructor(state, context = {}, selectors3) {
5895 super(state);
5896 this.context = context;
5897 this.selectors = selectors3;
5898 }
5899 /**
5900 * Non-reactive values such as refs, callbacks, etc.
5901 */
5902 /**
5903 * Synchronizes a single external value into the store.
5904 *
5905 * Note that the while the value in `state` is updated immediately, the value returned
5906 * by `useState` is updated before the next render (similarly to React's `useState`).
5907 */
5908 useSyncedValue(key, value) {
5909 React27.useDebugValue(key);
5910 const store = this;
5911 useIsoLayoutEffect(() => {
5912 if (store.state[key] !== value) {
5913 store.set(key, value);
5914 }
5915 }, [store, key, value]);
5916 }
5917 /**
5918 * Synchronizes a single external value into the store and
5919 * cleans it up (sets to `undefined`) on unmount.
5920 *
5921 * Note that the while the value in `state` is updated immediately, the value returned
5922 * by `useState` is updated before the next render (similarly to React's `useState`).
5923 */
5924 useSyncedValueWithCleanup(key, value) {
5925 const store = this;
5926 useIsoLayoutEffect(() => {
5927 if (store.state[key] !== value) {
5928 store.set(key, value);
5929 }
5930 return () => {
5931 store.set(key, void 0);
5932 };
5933 }, [store, key, value]);
5934 }
5935 /**
5936 * Synchronizes multiple external values into the store.
5937 * Each value must match its state key. Pass an exact known subset rather than a broad
5938 * `Partial<State>`, which may contain `undefined` for required state fields.
5939 *
5940 * Note that the while the values in `state` are updated immediately, the values returned
5941 * by `useState` are updated before the next render (similarly to React's `useState`).
5942 *
5943 * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted.
5944 */
5945 useSyncedValues(statePart) {
5946 const store = this;
5947 if (true) {
5948 React27.useDebugValue(statePart, (p2) => Object.keys(p2));
5949 const keys = React27.useRef(Object.keys(statePart)).current;
5950 const nextKeys = Object.keys(statePart);
5951 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
5952 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
5953 }
5954 }
5955 const dependencies = Object.values(statePart);
5956 useIsoLayoutEffect(() => {
5957 store.update(statePart);
5958 }, [store, ...dependencies]);
5959 }
5960 /**
5961 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
5962 * is non-undefined, the store's state at `key` is updated to match `controlled`.
5963 */
5964 useControlledProp(key, controlled) {
5965 React27.useDebugValue(key);
5966 const store = this;
5967 const isControlled = controlled !== void 0;
5968 useIsoLayoutEffect(() => {
5969 if (isControlled && !Object.is(store.state[key], controlled)) {
5970 store.setState({
5971 ...store.state,
5972 [key]: controlled
5973 });
5974 }
5975 }, [store, key, controlled, isControlled]);
5976 if (true) {
5977 const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
5978 if (!cache.has(key)) {
5979 cache.set(key, isControlled);
5980 }
5981 const previouslyControlled = cache.get(key);
5982 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
5983 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).`);
5984 }
5985 }
5986 }
5987 /** Gets the current value from the store using a selector with the provided key.
5988 *
5989 * @param key Key of the selector to use.
5990 */
5991 select(key, a1, a2, a3) {
5992 const selector = this.selectors[key];
5993 return selector(this.state, a1, a2, a3);
5994 }
5995 /**
5996 * Returns a value from the store's state using a selector function.
5997 * Used to subscribe to specific parts of the state.
5998 * This methods causes a rerender whenever the selected state changes.
5999 *
6000 * @param key Key of the selector to use.
6001 */
6002 useState(key, a1, a2, a3) {
6003 React27.useDebugValue(key);
6004 return useStore(this, this.selectors[key], a1, a2, a3);
6005 }
6006 /**
6007 * Wraps a function with `useStableCallback` to ensure it has a stable reference
6008 * and assigns it to the context.
6009 *
6010 * @param key Key of the event callback. Must be a function in the context.
6011 * @param fn Function to assign.
6012 */
6013 useContextCallback(key, fn) {
6014 React27.useDebugValue(key);
6015 const stableFunction = useStableCallback(fn ?? NOOP);
6016 this.context[key] = stableFunction;
6017 }
6018 /**
6019 * Returns a stable setter function for a specific key in the store's state.
6020 * It's commonly used to pass as a ref callback to React elements.
6021 *
6022 * @param key Key of the state to set.
6023 */
6024 useStateSetter(key) {
6025 const ref = React27.useRef(void 0);
6026 if (ref.current === void 0) {
6027 ref.current = (value) => {
6028 this.set(key, value);
6029 };
6030 }
6031 return ref.current;
6032 }
6033 /**
6034 * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
6035 *
6036 * @param key Key of the selector to observe.
6037 * @param listener Listener function called when the selector result changes.
6038 */
6039 observe(selector, listener) {
6040 let selectFn;
6041 if (typeof selector === "function") {
6042 selectFn = selector;
6043 } else {
6044 selectFn = this.selectors[selector];
6045 }
6046 let prevValue = selectFn(this.state);
6047 listener(prevValue, prevValue, this);
6048 return this.subscribe((nextState) => {
6049 const nextValue = selectFn(nextState);
6050 if (!Object.is(prevValue, nextValue)) {
6051 const oldValue = prevValue;
6052 prevValue = nextValue;
6053 listener(nextValue, oldValue, this);
6054 }
6055 });
6056 }
6057 };
6058
6059 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
6060 var selectors = {
6061 open: (state) => state.open,
6062 transitionStatus: (state) => state.transitionStatus,
6063 domReferenceElement: (state) => state.domReferenceElement,
6064 referenceElement: (state) => state.positionReference ?? state.referenceElement,
6065 floatingElement: (state) => state.floatingElement,
6066 floatingId: (state) => state.floatingId
6067 };
6068 var FloatingRootStore = class extends ReactStore {
6069 constructor(options) {
6070 const {
6071 syncOnly,
6072 nested,
6073 onOpenChange,
6074 triggerElements,
6075 ...initialState
6076 } = options;
6077 super({
6078 ...initialState,
6079 positionReference: initialState.referenceElement,
6080 domReferenceElement: initialState.referenceElement
6081 }, {
6082 onOpenChange,
6083 dataRef: {
6084 current: {}
6085 },
6086 events: createEventEmitter(),
6087 nested,
6088 triggerElements
6089 }, selectors);
6090 this.syncOnly = syncOnly;
6091 }
6092 /**
6093 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
6094 */
6095 syncOpenEvent = (newOpen, event) => {
6096 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
6097 // click events to upgrade a hover-open.
6098 event != null && isClickLikeEvent(event)) {
6099 this.context.dataRef.current.openEvent = newOpen ? event : void 0;
6100 }
6101 };
6102 /**
6103 * Runs the root-owned side effects for an open state change.
6104 */
6105 dispatchOpenChange = (newOpen, eventDetails) => {
6106 this.syncOpenEvent(newOpen, eventDetails.event);
6107 const details = {
6108 open: newOpen,
6109 reason: eventDetails.reason,
6110 nativeEvent: eventDetails.event,
6111 nested: this.context.nested,
6112 triggerElement: eventDetails.trigger
6113 };
6114 this.context.events.emit("openchange", details);
6115 };
6116 /**
6117 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
6118 *
6119 * @param newOpen The new open state.
6120 * @param eventDetails Details about the event that triggered the open state change.
6121 */
6122 setOpen = (newOpen, eventDetails) => {
6123 if (this.syncOnly) {
6124 this.context.onOpenChange?.(newOpen, eventDetails);
6125 return;
6126 }
6127 this.dispatchOpenChange(newOpen, eventDetails);
6128 this.context.onOpenChange?.(newOpen, eventDetails);
6129 };
6130 };
6131
6132 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
6133 function useSyncedFloatingRootContext(options) {
6134 const {
6135 popupStore,
6136 treatPopupAsFloatingElement = false,
6137 floatingRootContext: floatingRootContextProp,
6138 floatingId,
6139 nested,
6140 onOpenChange
6141 } = options;
6142 const open3 = popupStore.useState("open");
6143 const referenceElement = popupStore.useState("activeTriggerElement");
6144 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
6145 const triggerElements = popupStore.context.triggerElements;
6146 const handleOpenChange = onOpenChange;
6147 const internalStoreRef = React28.useRef(null);
6148 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
6149 internalStoreRef.current = new FloatingRootStore({
6150 open: open3,
6151 transitionStatus: void 0,
6152 referenceElement,
6153 floatingElement,
6154 triggerElements,
6155 onOpenChange: handleOpenChange,
6156 floatingId,
6157 syncOnly: true,
6158 nested
6159 });
6160 }
6161 const store = floatingRootContextProp ?? internalStoreRef.current;
6162 popupStore.useSyncedValue("floatingId", floatingId);
6163 useIsoLayoutEffect(() => {
6164 const valuesToSync = {
6165 open: open3,
6166 floatingId,
6167 referenceElement,
6168 floatingElement
6169 };
6170 if (isElement(referenceElement)) {
6171 valuesToSync.domReferenceElement = referenceElement;
6172 }
6173 if (store.state.positionReference === store.state.referenceElement) {
6174 valuesToSync.positionReference = referenceElement;
6175 }
6176 store.update(valuesToSync);
6177 }, [open3, floatingId, referenceElement, floatingElement, store]);
6178 store.context.onOpenChange = handleOpenChange;
6179 store.context.nested = nested;
6180 return store;
6181 }
6182
6183 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
6184 var FOCUSABLE_POPUP_PROPS = {
6185 tabIndex: -1,
6186 [FOCUSABLE_ATTRIBUTE]: ""
6187 };
6188 function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {
6189 const floatingId = useId();
6190 const nested = useFloatingParentNodeId() != null;
6191 const store = useRefWithInit(() => createStore(floatingId, nested)).current;
6192 useSyncedFloatingRootContext({
6193 popupStore: store,
6194 treatPopupAsFloatingElement,
6195 floatingRootContext: store.state.floatingRootContext,
6196 floatingId,
6197 nested,
6198 onOpenChange: store.setOpen
6199 });
6200 return store;
6201 }
6202 function PopupHandleAttachment({
6203 handle,
6204 store
6205 }) {
6206 useIsoLayoutEffect(() => {
6207 return handle.attachStore(store);
6208 }, [handle, store]);
6209 return null;
6210 }
6211 function syncTriggerCount(store) {
6212 const triggerCount = store.context.triggerElements.size;
6213 if (store.select("open") && store.state.triggerCount !== triggerCount) {
6214 store.set("triggerCount", triggerCount);
6215 }
6216 }
6217 function useTriggerRegistration(id, store) {
6218 const registrationRef = React29.useRef(null);
6219 return useStableCallback((element) => {
6220 const registration = registrationRef.current;
6221 if (registration !== null) {
6222 if (registration.element === element && registration.store === store && registration.id === id) {
6223 return;
6224 }
6225 registrationRef.current = null;
6226 const registeredStore = registration.store;
6227 if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) {
6228 registeredStore.context.triggerElements.delete(registration.id);
6229 syncTriggerCount(registeredStore);
6230 }
6231 }
6232 if (element !== null && id !== void 0) {
6233 registrationRef.current = {
6234 store,
6235 id,
6236 element
6237 };
6238 store.context.triggerElements.add(id, element);
6239 syncTriggerCount(store);
6240 }
6241 });
6242 }
6243 function createPopupOpenState(state, open3, trigger, preventUnmountOnClose = false) {
6244 let preventUnmountingOnClose = state.preventUnmountingOnClose;
6245 if (open3) {
6246 preventUnmountingOnClose = false;
6247 } else if (preventUnmountOnClose) {
6248 preventUnmountingOnClose = true;
6249 }
6250 const triggerId = trigger?.id ?? null;
6251 let activeTriggerId = state.activeTriggerId;
6252 let activeTriggerElement = state.activeTriggerElement;
6253 if (triggerId || open3) {
6254 activeTriggerId = triggerId;
6255 activeTriggerElement = trigger ?? null;
6256 }
6257 return {
6258 open: open3,
6259 preventUnmountingOnClose,
6260 activeTriggerId,
6261 activeTriggerElement
6262 };
6263 }
6264 function attachPreventUnmountOnClose(eventDetails) {
6265 let preventUnmountOnClose = false;
6266 eventDetails.preventUnmountOnClose = () => {
6267 preventUnmountOnClose = true;
6268 };
6269 return () => preventUnmountOnClose;
6270 }
6271 function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {
6272 const reason = eventDetails.reason;
6273 const isHover = reason === reason_parts_exports.triggerHover;
6274 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
6275 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
6276 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
6277 store.context.onOpenChange?.(nextOpen, eventDetails);
6278 if (eventDetails.isCanceled) {
6279 return;
6280 }
6281 options.onBeforeDispatch?.();
6282 store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
6283 const changeState = () => {
6284 const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
6285 const updatedState = {
6286 ...options.extraState,
6287 ...popupOpenState
6288 };
6289 if (isFocusOpen) {
6290 updatedState.instantType = "focus";
6291 } else if (isDismissClose) {
6292 updatedState.instantType = "dismiss";
6293 } else if (isHover) {
6294 updatedState.instantType = void 0;
6295 }
6296 store.update(updatedState);
6297 };
6298 if (isHover) {
6299 ReactDOM4.flushSync(changeState);
6300 } else {
6301 changeState();
6302 }
6303 }
6304 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {
6305 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId);
6306 const baseRegisterTrigger = useTriggerRegistration(triggerId, store);
6307 const applyTriggerData = useStableCallback((element) => {
6308 const open3 = store.select("open");
6309 const activeTriggerId = store.select("activeTriggerId");
6310 if (activeTriggerId === triggerId) {
6311 const changes = {
6312 activeTriggerElement: element,
6313 ...open3 ? stateUpdates : null
6314 };
6315 store.update(changes);
6316 return;
6317 }
6318 if (activeTriggerId == null && open3) {
6319 const changes = {
6320 activeTriggerId: triggerId ?? null,
6321 activeTriggerElement: element,
6322 ...stateUpdates
6323 };
6324 store.update(changes);
6325 }
6326 });
6327 const registerTrigger = useStableCallback((element) => {
6328 baseRegisterTrigger(element);
6329 if (element) {
6330 applyTriggerData(element);
6331 }
6332 });
6333 useIsoLayoutEffect(() => {
6334 registerTrigger(triggerElementRef.current);
6335 return () => registerTrigger(null);
6336 }, [registerTrigger, triggerElementRef, store, triggerId]);
6337 useIsoLayoutEffect(() => {
6338 if (isMountedByThisTrigger) {
6339 const changes = {
6340 activeTriggerElement: triggerElementRef.current,
6341 ...stateUpdates
6342 };
6343 store.update(changes);
6344 }
6345 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);
6346 return {
6347 registerTrigger,
6348 isMountedByThisTrigger
6349 };
6350 }
6351 function useImplicitActiveTrigger(store, options = {}) {
6352 const {
6353 closeOnActiveTriggerUnmount = false
6354 } = options;
6355 const resolvedActiveTriggerIdRef = React29.useRef(null);
6356 const open3 = store.useState("open");
6357 const reactiveTriggerCount = store.useState("triggerCount");
6358 const activeTriggerId = store.useState("activeTriggerId");
6359 const reactiveActiveTriggerElement = store.useState("activeTriggerElement");
6360 useIsoLayoutEffect(() => {
6361 if (!open3) {
6362 resolvedActiveTriggerIdRef.current = null;
6363 if (store.state.triggerCount !== 0) {
6364 store.set("triggerCount", 0);
6365 }
6366 return;
6367 }
6368 const triggerCount = store.context.triggerElements.size;
6369 const stateUpdates = {};
6370 if (store.state.triggerCount !== triggerCount) {
6371 stateUpdates.triggerCount = triggerCount;
6372 }
6373 const currentActiveTriggerId = store.select("activeTriggerId");
6374 let lostActiveTriggerId = null;
6375 if (currentActiveTriggerId) {
6376 const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);
6377 if (!activeTriggerElement) {
6378 for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {
6379 if (triggerElement === store.state.activeTriggerElement) {
6380 stateUpdates.activeTriggerId = triggerId;
6381 stateUpdates.activeTriggerElement = triggerElement;
6382 resolvedActiveTriggerIdRef.current = triggerId;
6383 break;
6384 }
6385 }
6386 if (stateUpdates.activeTriggerId === void 0) {
6387 if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {
6388 lostActiveTriggerId = currentActiveTriggerId;
6389 } else {
6390 resolvedActiveTriggerIdRef.current = null;
6391 }
6392 }
6393 } else {
6394 resolvedActiveTriggerIdRef.current = currentActiveTriggerId;
6395 if (activeTriggerElement !== store.state.activeTriggerElement) {
6396 stateUpdates.activeTriggerElement = activeTriggerElement;
6397 }
6398 }
6399 } else {
6400 resolvedActiveTriggerIdRef.current = null;
6401 }
6402 if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {
6403 const iteratorResult = store.context.triggerElements.entries().next();
6404 if (!iteratorResult.done) {
6405 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
6406 stateUpdates.activeTriggerId = implicitTriggerId;
6407 stateUpdates.activeTriggerElement = implicitTriggerElement;
6408 resolvedActiveTriggerIdRef.current = implicitTriggerId;
6409 }
6410 }
6411 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
6412 store.update(stateUpdates);
6413 }
6414 if (lostActiveTriggerId) {
6415 if (closeOnActiveTriggerUnmount) {
6416 queueMicrotask(() => {
6417 if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {
6418 const eventDetails = createChangeEventDetails(reason_parts_exports.none);
6419 store.setOpen(false, eventDetails);
6420 if (!eventDetails.isCanceled) {
6421 store.update({
6422 activeTriggerId: null,
6423 activeTriggerElement: null
6424 });
6425 }
6426 }
6427 });
6428 }
6429 }
6430 }, [open3, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);
6431 }
6432 function useOpenStateTransitions(open3, store, onUnmount, animateInitialOpen) {
6433 const {
6434 mounted,
6435 setMounted,
6436 transitionStatus
6437 } = useTransitionStatus(open3, false, false, animateInitialOpen);
6438 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose");
6439 const syncedPreventUnmountingOnClose = open3 ? false : preventUnmountingOnClose;
6440 store.useSyncedValues({
6441 mounted,
6442 transitionStatus,
6443 preventUnmountingOnClose: syncedPreventUnmountingOnClose
6444 });
6445 const forceUnmount = useStableCallback(() => {
6446 setMounted(false);
6447 store.update({
6448 activeTriggerId: null,
6449 activeTriggerElement: null,
6450 mounted: false,
6451 preventUnmountingOnClose: false
6452 });
6453 onUnmount?.();
6454 store.context.onOpenChangeComplete?.(false);
6455 });
6456 useOpenChangeComplete({
6457 enabled: mounted && !open3 && !syncedPreventUnmountingOnClose,
6458 open: open3,
6459 ref: store.context.popupRef,
6460 onComplete() {
6461 if (!open3) {
6462 forceUnmount();
6463 }
6464 }
6465 });
6466 return {
6467 forceUnmount,
6468 transitionStatus
6469 };
6470 }
6471 function usePopupInteractionProps(store, statePart) {
6472 store.useSyncedValues(statePart);
6473 useIsoLayoutEffect(() => () => {
6474 store.update({
6475 activeTriggerProps: EMPTY_OBJECT,
6476 inactiveTriggerProps: EMPTY_OBJECT,
6477 popupProps: EMPTY_OBJECT
6478 });
6479 }, [store]);
6480 }
6481
6482 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
6483 var devElementIdsByMap;
6484 function getDevElementIds(map) {
6485 devElementIdsByMap ??= /* @__PURE__ */ new WeakMap();
6486 let elementIds = devElementIdsByMap.get(map);
6487 if (!elementIds) {
6488 elementIds = /* @__PURE__ */ new WeakMap();
6489 devElementIdsByMap.set(map, elementIds);
6490 }
6491 return elementIds;
6492 }
6493 var PopupTriggerMap = class {
6494 constructor() {
6495 this.idMap = /* @__PURE__ */ new Map();
6496 }
6497 /**
6498 * Adds a trigger element with the given ID.
6499 *
6500 * Note: The provided element is assumed to not be registered under multiple IDs.
6501 */
6502 add(id, element) {
6503 if (true) {
6504 const elementIds = getDevElementIds(this);
6505 const existingId = elementIds.get(element);
6506 if (existingId !== void 0 && existingId !== id) {
6507 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
6508 }
6509 const previousElement = this.idMap.get(id);
6510 if (previousElement !== void 0 && previousElement !== element) {
6511 elementIds.delete(previousElement);
6512 }
6513 elementIds.set(element, id);
6514 }
6515 this.idMap.set(id, element);
6516 }
6517 /**
6518 * Removes the trigger element with the given ID.
6519 */
6520 delete(id) {
6521 if (true) {
6522 const element = this.idMap.get(id);
6523 if (element !== void 0) {
6524 devElementIdsByMap?.get(this)?.delete(element);
6525 }
6526 }
6527 this.idMap.delete(id);
6528 }
6529 /**
6530 * Whether the given element is registered as a trigger.
6531 */
6532 hasElement(element) {
6533 for (const registered of this.idMap.values()) {
6534 if (registered === element) {
6535 return true;
6536 }
6537 }
6538 return false;
6539 }
6540 /**
6541 * Whether there is a registered trigger element matching the given predicate.
6542 */
6543 hasMatchingElement(predicate) {
6544 for (const element of this.idMap.values()) {
6545 if (predicate(element)) {
6546 return true;
6547 }
6548 }
6549 return false;
6550 }
6551 /**
6552 * Returns the trigger element associated with the given ID, or undefined if no such element exists.
6553 */
6554 getById(id) {
6555 return this.idMap.get(id);
6556 }
6557 /**
6558 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
6559 */
6560 entries() {
6561 return this.idMap.entries();
6562 }
6563 /**
6564 * Returns an iterable of all registered trigger elements.
6565 */
6566 elements() {
6567 return this.idMap.values();
6568 }
6569 /**
6570 * Returns the number of registered trigger elements.
6571 */
6572 get size() {
6573 return this.idMap.size;
6574 }
6575 };
6576
6577 // node_modules/@base-ui/react/utils/popups/store.mjs
6578 function createInitialPopupStoreState(triggerElements, floatingId, nested = false) {
6579 return {
6580 open: false,
6581 openProp: void 0,
6582 mounted: false,
6583 transitionStatus: void 0,
6584 floatingRootContext: new FloatingRootStore({
6585 open: false,
6586 transitionStatus: void 0,
6587 floatingElement: null,
6588 referenceElement: null,
6589 triggerElements,
6590 floatingId,
6591 syncOnly: true,
6592 nested,
6593 onOpenChange: void 0
6594 }),
6595 floatingId,
6596 triggerCount: 0,
6597 preventUnmountingOnClose: false,
6598 payload: void 0,
6599 activeTriggerId: null,
6600 activeTriggerElement: null,
6601 triggerIdProp: void 0,
6602 popupElement: null,
6603 positionerElement: null,
6604 activeTriggerProps: EMPTY_OBJECT,
6605 inactiveTriggerProps: EMPTY_OBJECT,
6606 popupProps: EMPTY_OBJECT
6607 };
6608 }
6609 var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId;
6610 var openSelector = (state) => state.openProp ?? state.open;
6611 var popupIdSelector = (state) => {
6612 const popupId = state.popupElement?.id ?? state.floatingId;
6613 return popupId || void 0;
6614 };
6615 function triggerOwnsOpenPopup(state, triggerId) {
6616 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
6617 }
6618 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
6619 if (triggerOwnsOpenPopup(state, triggerId)) {
6620 return true;
6621 }
6622 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
6623 }
6624 var popupStoreSelectors = {
6625 open: openSelector,
6626 mounted: (state) => state.mounted,
6627 transitionStatus: (state) => state.transitionStatus,
6628 floatingRootContext: (state) => state.floatingRootContext,
6629 triggerCount: (state) => state.triggerCount,
6630 preventUnmountingOnClose: (state) => state.preventUnmountingOnClose,
6631 payload: (state) => state.payload,
6632 activeTriggerId: activeTriggerIdSelector,
6633 activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null,
6634 popupId: popupIdSelector,
6635 /**
6636 * Whether the trigger with the given ID was used to open the popup.
6637 */
6638 isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId,
6639 /**
6640 * Whether the popup is open and was activated by a trigger with the given ID.
6641 */
6642 isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),
6643 /**
6644 * Whether the popup is mounted and was activated by a trigger with the given ID.
6645 */
6646 isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted,
6647 triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,
6648 /**
6649 * Popup id for the trigger that currently owns the open popup.
6650 */
6651 triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0,
6652 popupProps: (state) => state.popupProps,
6653 popupElement: (state) => state.popupElement,
6654 positionerElement: (state) => state.positionerElement
6655 };
6656
6657 // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs
6658 var React30 = __toESM(require_react(), 1);
6659 var import_shim2 = __toESM(require_shim(), 1);
6660 function usePopupHandleStore(handle) {
6661 const subscribe = React30.useCallback((listener) => {
6662 if (handle === void 0) {
6663 return NOOP;
6664 }
6665 return handle.subscribeStore(listener);
6666 }, [handle]);
6667 const getSnapshot = React30.useCallback(() => {
6668 return handle === void 0 ? void 0 : handle.store;
6669 }, [handle]);
6670 return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
6671 }
6672
6673 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
6674 function useBaseUIFloating(options) {
6675 return useFloatingWithStore(options, options.rootContext);
6676 }
6677 function useFloatingWithStore(options, store) {
6678 const {
6679 nodeId,
6680 externalTree
6681 } = options;
6682 const referenceElement = store.useState("referenceElement");
6683 const floatingElement = store.useState("floatingElement");
6684 const domReferenceElement = store.useState("domReferenceElement");
6685 const open3 = store.useState("open");
6686 const floatingId = store.useState("floatingId");
6687 const [positionReference, setPositionReferenceRaw] = React31.useState(null);
6688 const [localDomReference, setLocalDomReference] = React31.useState(void 0);
6689 const [localFloatingElement, setLocalFloatingElement] = React31.useState(void 0);
6690 const domReferenceRef = React31.useRef(null);
6691 const tree = useFloatingTree(externalTree);
6692 const storeElements = React31.useMemo(() => ({
6693 reference: referenceElement,
6694 floating: floatingElement,
6695 domReference: domReferenceElement
6696 }), [referenceElement, floatingElement, domReferenceElement]);
6697 const position = useFloating({
6698 ...options,
6699 elements: {
6700 ...storeElements,
6701 ...positionReference && {
6702 reference: positionReference
6703 }
6704 }
6705 });
6706 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
6707 const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement;
6708 store.useSyncedValue("referenceElement", localDomReference ?? null);
6709 store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
6710 store.useSyncedValue("floatingElement", syncedFloatingElement);
6711 const setPositionReference = React31.useCallback((node) => {
6712 const computedPositionReference = isElement(node) ? {
6713 getBoundingClientRect: () => node.getBoundingClientRect(),
6714 getClientRects: () => node.getClientRects(),
6715 contextElement: node
6716 } : node;
6717 setPositionReferenceRaw(computedPositionReference);
6718 position.refs.setReference(computedPositionReference);
6719 }, [position.refs]);
6720 const setReference = React31.useCallback((node) => {
6721 if (isElement(node) || node === null) {
6722 domReferenceRef.current = node;
6723 setLocalDomReference(node);
6724 }
6725 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
6726 // `null` to support `positionReference` + an unstable `reference`
6727 // callback ref.
6728 node !== null && !isElement(node)) {
6729 position.refs.setReference(node);
6730 }
6731 }, [position.refs, setLocalDomReference]);
6732 const setFloating = React31.useCallback((node) => {
6733 setLocalFloatingElement(node);
6734 position.refs.setFloating(node);
6735 }, [position.refs]);
6736 const refs = React31.useMemo(() => ({
6737 ...position.refs,
6738 setReference,
6739 setFloating,
6740 setPositionReference,
6741 domReference: domReferenceRef
6742 }), [position.refs, setReference, setFloating, setPositionReference]);
6743 const elements = React31.useMemo(() => ({
6744 ...position.elements,
6745 domReference: domReferenceElement
6746 }), [position.elements, domReferenceElement]);
6747 const context = React31.useMemo(() => ({
6748 ...position,
6749 dataRef: store.context.dataRef,
6750 open: open3,
6751 onOpenChange: store.setOpen,
6752 events: store.context.events,
6753 floatingId,
6754 refs,
6755 elements,
6756 nodeId,
6757 rootStore: store
6758 }), [position, refs, elements, nodeId, store, open3, floatingId]);
6759 useIsoLayoutEffect(() => {
6760 if (domReferenceElement) {
6761 domReferenceRef.current = domReferenceElement;
6762 }
6763 }, [domReferenceElement]);
6764 useIsoLayoutEffect(() => {
6765 store.context.dataRef.current.floatingContext = context;
6766 const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
6767 if (node) {
6768 node.context = context;
6769 }
6770 });
6771 return React31.useMemo(() => ({
6772 ...position,
6773 context,
6774 refs,
6775 elements,
6776 rootStore: store
6777 }), [position, refs, elements, context, store]);
6778 }
6779
6780 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
6781 var React32 = __toESM(require_react(), 1);
6782 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
6783 function useFocus(context, props = {}) {
6784 const {
6785 enabled = true,
6786 delay
6787 } = props;
6788 const store = "rootStore" in context ? context.rootStore : context;
6789 const {
6790 events,
6791 dataRef
6792 } = store.context;
6793 const blockFocusRef = React32.useRef(false);
6794 const blockedReferenceRef = React32.useRef(null);
6795 const keyboardModalityRef = React32.useRef(true);
6796 const timeout = useTimeout();
6797 React32.useEffect(() => {
6798 const domReference = store.select("domReferenceElement");
6799 if (!enabled) {
6800 return void 0;
6801 }
6802 const win = getWindow(domReference);
6803 function onBlur() {
6804 const currentDomReference = store.select("domReferenceElement");
6805 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
6806 blockFocusRef.current = true;
6807 blockedReferenceRef.current = currentDomReference;
6808 }
6809 }
6810 function onKeyDown() {
6811 keyboardModalityRef.current = true;
6812 }
6813 function onPointerDown() {
6814 keyboardModalityRef.current = false;
6815 }
6816 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
6817 }, [store, enabled]);
6818 React32.useEffect(() => {
6819 if (!enabled) {
6820 return void 0;
6821 }
6822 function onOpenChangeLocal(details) {
6823 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
6824 const referenceElement = store.select("domReferenceElement");
6825 if (isElement(referenceElement)) {
6826 blockedReferenceRef.current = referenceElement;
6827 blockFocusRef.current = true;
6828 }
6829 }
6830 }
6831 events.on("openchange", onOpenChangeLocal);
6832 return () => {
6833 events.off("openchange", onOpenChangeLocal);
6834 };
6835 }, [events, enabled, store]);
6836 const reference = React32.useMemo(() => {
6837 function resetBlockedFocus() {
6838 blockFocusRef.current = false;
6839 blockedReferenceRef.current = null;
6840 }
6841 return {
6842 onMouseLeave() {
6843 resetBlockedFocus();
6844 },
6845 onFocus(event) {
6846 const focusTarget = event.currentTarget;
6847 if (blockFocusRef.current) {
6848 if (blockedReferenceRef.current === focusTarget) {
6849 return;
6850 }
6851 resetBlockedFocus();
6852 }
6853 const target = getTarget(event.nativeEvent);
6854 if (isElement(target)) {
6855 if (isMacSafari && !event.relatedTarget) {
6856 if (!keyboardModalityRef.current && !isTypeableElement(target)) {
6857 return;
6858 }
6859 } else if (!matchesFocusVisible(target)) {
6860 return;
6861 }
6862 }
6863 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements);
6864 const {
6865 nativeEvent,
6866 currentTarget
6867 } = event;
6868 const delayValue = typeof delay === "function" ? delay() : delay;
6869 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
6870 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6871 return;
6872 }
6873 timeout.start(delayValue, () => {
6874 if (blockFocusRef.current) {
6875 return;
6876 }
6877 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6878 });
6879 },
6880 onBlur(event) {
6881 resetBlockedFocus();
6882 const relatedTarget = event.relatedTarget;
6883 const nativeEvent = event.nativeEvent;
6884 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
6885 timeout.start(0, () => {
6886 const domReference = store.select("domReferenceElement");
6887 const activeEl = activeElement(ownerDocument(domReference));
6888 if (!relatedTarget && activeEl === domReference) {
6889 return;
6890 }
6891 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
6892 return;
6893 }
6894 const nextFocusedElement = relatedTarget ?? activeEl;
6895 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) {
6896 return;
6897 }
6898 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
6899 });
6900 }
6901 };
6902 }, [dataRef, delay, store, timeout]);
6903 return React32.useMemo(() => enabled ? {
6904 reference,
6905 trigger: reference
6906 } : {}, [enabled, reference]);
6907 }
6908
6909 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6910 var React33 = __toESM(require_react(), 1);
6911
6912 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
6913 var HoverInteraction = class _HoverInteraction {
6914 constructor() {
6915 this.pointerType = void 0;
6916 this.interactedInside = false;
6917 this.handler = void 0;
6918 this.blockMouseMove = true;
6919 this.performedPointerEventsMutation = false;
6920 this.pointerEventsScopeElement = null;
6921 this.pointerEventsReferenceElement = null;
6922 this.pointerEventsFloatingElement = null;
6923 this.restTimeoutPending = false;
6924 this.openChangeTimeout = new Timeout();
6925 this.restTimeout = new Timeout();
6926 this.handleCloseOptions = void 0;
6927 }
6928 static create() {
6929 return new _HoverInteraction();
6930 }
6931 dispose = () => {
6932 this.openChangeTimeout.clear();
6933 this.restTimeout.clear();
6934 };
6935 disposeEffect = () => {
6936 return this.dispose;
6937 };
6938 };
6939 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
6940 function clearSafePolygonPointerEventsMutation(instance) {
6941 if (!instance.performedPointerEventsMutation) {
6942 return;
6943 }
6944 const scopeElement = instance.pointerEventsScopeElement;
6945 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
6946 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
6947 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
6948 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
6949 pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
6950 }
6951 instance.performedPointerEventsMutation = false;
6952 instance.pointerEventsScopeElement = null;
6953 instance.pointerEventsReferenceElement = null;
6954 instance.pointerEventsFloatingElement = null;
6955 }
6956 function applySafePolygonPointerEventsMutation(instance, options) {
6957 const {
6958 scopeElement,
6959 referenceElement,
6960 floatingElement
6961 } = options;
6962 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
6963 if (existingOwner && existingOwner !== instance) {
6964 clearSafePolygonPointerEventsMutation(existingOwner);
6965 }
6966 clearSafePolygonPointerEventsMutation(instance);
6967 instance.performedPointerEventsMutation = true;
6968 instance.pointerEventsScopeElement = scopeElement;
6969 instance.pointerEventsReferenceElement = referenceElement;
6970 instance.pointerEventsFloatingElement = floatingElement;
6971 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
6972 scopeElement.style.pointerEvents = "none";
6973 referenceElement.style.pointerEvents = "auto";
6974 floatingElement.style.pointerEvents = "auto";
6975 }
6976 function useHoverInteractionSharedState(store) {
6977 const data = store.context.dataRef.current;
6978 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
6979 if (!data.hoverInteractionState) {
6980 data.hoverInteractionState = instance;
6981 }
6982 useOnMount(data.hoverInteractionState.disposeEffect);
6983 return data.hoverInteractionState;
6984 }
6985
6986 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6987 function useHoverFloatingInteraction(context, parameters = {}) {
6988 const {
6989 enabled = true,
6990 closeDelay: closeDelayProp = 0,
6991 nodeId: nodeIdProp
6992 } = parameters;
6993 const store = "rootStore" in context ? context.rootStore : context;
6994 const open3 = store.useState("open");
6995 const floatingElement = store.useState("floatingElement");
6996 const domReferenceElement = store.useState("domReferenceElement");
6997 const {
6998 dataRef
6999 } = store.context;
7000 const tree = useFloatingTree();
7001 const parentId = useFloatingParentNodeId();
7002 const instance = useHoverInteractionSharedState(store);
7003 const childClosedTimeout = useTimeout();
7004 const isClickLikeOpenEvent2 = useStableCallback(() => {
7005 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7006 });
7007 const isHoverOpen = useStableCallback(() => {
7008 return isHoverOpenEvent(dataRef.current.openEvent?.type);
7009 });
7010 const clearPointerEvents = useStableCallback(() => {
7011 clearSafePolygonPointerEventsMutation(instance);
7012 });
7013 useIsoLayoutEffect(() => {
7014 if (!open3) {
7015 instance.pointerType = void 0;
7016 instance.restTimeoutPending = false;
7017 instance.interactedInside = false;
7018 clearPointerEvents();
7019 }
7020 }, [open3, instance, clearPointerEvents]);
7021 React33.useEffect(() => {
7022 return clearPointerEvents;
7023 }, [clearPointerEvents]);
7024 useIsoLayoutEffect(() => {
7025 if (!enabled) {
7026 return void 0;
7027 }
7028 if (open3 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
7029 const ref = domReferenceElement;
7030 const floatingEl = floatingElement;
7031 const doc = ownerDocument(floatingElement);
7032 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
7033 if (parentFloating) {
7034 parentFloating.style.pointerEvents = "";
7035 }
7036 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
7037 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
7038 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
7039 applySafePolygonPointerEventsMutation(instance, {
7040 scopeElement,
7041 referenceElement: ref,
7042 floatingElement: floatingEl
7043 });
7044 return () => {
7045 clearPointerEvents();
7046 };
7047 }
7048 return void 0;
7049 }, [enabled, open3, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
7050 React33.useEffect(() => {
7051 if (!enabled) {
7052 return void 0;
7053 }
7054 function hasParentChildren() {
7055 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
7056 }
7057 function closeWithDelay(event) {
7058 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
7059 const close = () => {
7060 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7061 tree?.events.emit("floating.closed", event);
7062 };
7063 if (closeDelay) {
7064 instance.openChangeTimeout.start(closeDelay, close);
7065 } else {
7066 instance.openChangeTimeout.clear();
7067 close();
7068 }
7069 }
7070 function handleInteractInside(event) {
7071 const target = getTarget(event);
7072 if (!isInteractiveElement(target)) {
7073 instance.interactedInside = false;
7074 return;
7075 }
7076 instance.interactedInside = target?.closest("[aria-haspopup]") != null;
7077 }
7078 function onFloatingMouseEnter() {
7079 instance.openChangeTimeout.clear();
7080 childClosedTimeout.clear();
7081 tree?.events.off("floating.closed", onNodeClosed);
7082 clearPointerEvents();
7083 }
7084 function onFloatingMouseLeave(event) {
7085 if (hasParentChildren() && tree) {
7086 tree.events.on("floating.closed", onNodeClosed);
7087 return;
7088 }
7089 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
7090 return;
7091 }
7092 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
7093 const relatedTarget = event.relatedTarget;
7094 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
7095 if (isMovingIntoDescendantFloating) {
7096 return;
7097 }
7098 if (instance.handler) {
7099 instance.handler(event);
7100 return;
7101 }
7102 clearPointerEvents();
7103 if (isHoverOpen() && !isClickLikeOpenEvent2()) {
7104 closeWithDelay(event);
7105 }
7106 }
7107 function onNodeClosed(event) {
7108 if (!tree || !parentId || hasParentChildren()) {
7109 return;
7110 }
7111 childClosedTimeout.start(0, () => {
7112 tree.events.off("floating.closed", onNodeClosed);
7113 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7114 tree.events.emit("floating.closed", event);
7115 });
7116 }
7117 const floating = floatingElement;
7118 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
7119 tree?.events.off("floating.closed", onNodeClosed);
7120 });
7121 }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
7122 }
7123
7124 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
7125 var React34 = __toESM(require_react(), 1);
7126 var ReactDOM5 = __toESM(require_react_dom(), 1);
7127 var EMPTY_REF = {
7128 current: null
7129 };
7130 function useHoverReferenceInteraction(context, props = {}) {
7131 const {
7132 enabled = true,
7133 delay = 0,
7134 handleClose = null,
7135 mouseOnly = false,
7136 restMs = 0,
7137 move = true,
7138 triggerElementRef = EMPTY_REF,
7139 externalTree,
7140 isActiveTrigger = true,
7141 getHandleCloseContext,
7142 isClosing,
7143 shouldOpen: shouldOpenProp,
7144 guardStaleOpen = false
7145 } = props;
7146 const store = "rootStore" in context ? context.rootStore : context;
7147 const {
7148 dataRef,
7149 events
7150 } = store.context;
7151 const tree = useFloatingTree(externalTree);
7152 const instance = useHoverInteractionSharedState(store);
7153 const isHoverCloseActiveRef = React34.useRef(false);
7154 const handleCloseRef = useValueAsRef(handleClose);
7155 const delayRef = useValueAsRef(delay);
7156 const restMsRef = useValueAsRef(restMs);
7157 const enabledRef = useValueAsRef(enabled);
7158 const shouldOpenRef = useValueAsRef(shouldOpenProp);
7159 const isClosingRef = useValueAsRef(isClosing);
7160 const isClickLikeOpenEvent2 = useStableCallback(() => {
7161 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7162 });
7163 const checkShouldOpen = useStableCallback(() => {
7164 return shouldOpenRef.current?.() !== false;
7165 });
7166 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
7167 const allTriggers = store.context.triggerElements;
7168 if (allTriggers.hasElement(currentTarget)) {
7169 return !currentDomReference || !contains(currentDomReference, currentTarget);
7170 }
7171 if (!isElement(target)) {
7172 return false;
7173 }
7174 const targetElement = target;
7175 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
7176 });
7177 const cleanupMouseMoveHandler = useStableCallback(() => {
7178 if (!instance.handler) {
7179 return;
7180 }
7181 const doc = ownerDocument(store.select("domReferenceElement"));
7182 doc.removeEventListener("mousemove", instance.handler);
7183 instance.handler = void 0;
7184 });
7185 const clearPointerEvents = useStableCallback(() => {
7186 clearSafePolygonPointerEventsMutation(instance);
7187 });
7188 if (isActiveTrigger) {
7189 instance.handleCloseOptions = handleClose?.__options;
7190 }
7191 React34.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
7192 React34.useEffect(() => {
7193 if (!enabled) {
7194 return void 0;
7195 }
7196 function onOpenChangeLocal(details) {
7197 if (!details.open) {
7198 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
7199 cleanupMouseMoveHandler();
7200 instance.openChangeTimeout.clear();
7201 instance.restTimeout.clear();
7202 instance.blockMouseMove = true;
7203 instance.restTimeoutPending = false;
7204 } else {
7205 isHoverCloseActiveRef.current = false;
7206 }
7207 }
7208 events.on("openchange", onOpenChangeLocal);
7209 return () => {
7210 events.off("openchange", onOpenChangeLocal);
7211 };
7212 }, [enabled, events, instance, cleanupMouseMoveHandler]);
7213 React34.useEffect(() => {
7214 if (!enabled) {
7215 return void 0;
7216 }
7217 function closeWithDelay(event, runElseBranch = true) {
7218 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
7219 if (closeDelay) {
7220 instance.openChangeTimeout.start(closeDelay, () => {
7221 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7222 tree?.events.emit("floating.closed", event);
7223 });
7224 } else if (runElseBranch) {
7225 instance.openChangeTimeout.clear();
7226 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7227 tree?.events.emit("floating.closed", event);
7228 }
7229 }
7230 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null);
7231 if (!isElement(trigger)) {
7232 return void 0;
7233 }
7234 function onMouseEnter(event) {
7235 instance.openChangeTimeout.clear();
7236 instance.blockMouseMove = false;
7237 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7238 return;
7239 }
7240 const restMsValue = getRestMs(restMsRef.current);
7241 const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
7242 const eventTarget = getTarget(event);
7243 const currentTarget = event.currentTarget ?? null;
7244 const currentDomReference = store.select("domReferenceElement");
7245 let triggerNode = currentTarget;
7246 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {
7247 for (const triggerElement of store.context.triggerElements.elements()) {
7248 if (contains(triggerElement, eventTarget)) {
7249 triggerNode = triggerElement;
7250 break;
7251 }
7252 }
7253 }
7254 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
7255 triggerNode = currentDomReference;
7256 }
7257 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
7258 const isOpen = store.select("open");
7259 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending";
7260 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
7261 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
7262 const isRestOnlyDelay = restMsValue > 0 && !openDelay;
7263 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
7264 const shouldOpen = !isOpen || isOverInactive;
7265 if (shouldOpenImmediately) {
7266 if (checkShouldOpen()) {
7267 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7268 }
7269 return;
7270 }
7271 if (isRestOnlyDelay) {
7272 return;
7273 }
7274 if (openDelay) {
7275 instance.openChangeTimeout.start(openDelay, () => {
7276 if (shouldOpen && checkShouldOpen()) {
7277 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7278 }
7279 });
7280 } else if (shouldOpen) {
7281 if (checkShouldOpen()) {
7282 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7283 }
7284 }
7285 }
7286 function onMouseLeave(event) {
7287 if (isClickLikeOpenEvent2()) {
7288 clearPointerEvents();
7289 return;
7290 }
7291 cleanupMouseMoveHandler();
7292 const domReferenceElement = store.select("domReferenceElement");
7293 const doc = ownerDocument(domReferenceElement);
7294 instance.restTimeout.clear();
7295 instance.restTimeoutPending = false;
7296 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
7297 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
7298 return;
7299 }
7300 if (handleCloseRef.current && handleCloseContextBase) {
7301 if (!store.select("open")) {
7302 instance.openChangeTimeout.clear();
7303 }
7304 const currentTrigger = triggerElementRef.current;
7305 instance.handler = handleCloseRef.current({
7306 ...handleCloseContextBase,
7307 tree,
7308 x: event.clientX,
7309 y: event.clientY,
7310 onClose() {
7311 clearPointerEvents();
7312 cleanupMouseMoveHandler();
7313 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) {
7314 closeWithDelay(event, true);
7315 }
7316 }
7317 });
7318 doc.addEventListener("mousemove", instance.handler);
7319 instance.handler(event);
7320 return;
7321 }
7322 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true;
7323 if (shouldClose) {
7324 closeWithDelay(event);
7325 }
7326 }
7327 function onMouseOut(event) {
7328 if (contains(trigger, event.relatedTarget)) {
7329 return;
7330 }
7331 instance.openChangeTimeout.clear();
7332 instance.restTimeout.clear();
7333 instance.restTimeoutPending = false;
7334 }
7335 const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0;
7336 if (move) {
7337 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
7338 once: true
7339 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
7340 }
7341 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
7342 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);
7343 return React34.useMemo(() => {
7344 if (!enabled) {
7345 return void 0;
7346 }
7347 function setPointerRef(event) {
7348 instance.pointerType = event.pointerType;
7349 }
7350 return {
7351 onPointerDown: setPointerRef,
7352 onPointerEnter: setPointerRef,
7353 onMouseMove(event) {
7354 const {
7355 nativeEvent
7356 } = event;
7357 const trigger = event.currentTarget;
7358 const currentDomReference = store.select("domReferenceElement");
7359 const currentOpen = store.select("open");
7360 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
7361 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7362 return;
7363 }
7364 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
7365 const floatingElement = store.select("floatingElement");
7366 if (floatingElement) {
7367 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
7368 applySafePolygonPointerEventsMutation(instance, {
7369 scopeElement,
7370 referenceElement: trigger,
7371 floatingElement
7372 });
7373 }
7374 }
7375 const restMsValue = getRestMs(restMsRef.current);
7376 if (currentOpen && !isOverInactive || restMsValue === 0) {
7377 return;
7378 }
7379 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
7380 return;
7381 }
7382 instance.restTimeout.clear();
7383 function handleMouseMove() {
7384 instance.restTimeoutPending = false;
7385 if (isClickLikeOpenEvent2()) {
7386 return;
7387 }
7388 const latestOpen = store.select("open");
7389 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
7390 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
7391 }
7392 }
7393 if (instance.pointerType === "touch") {
7394 ReactDOM5.flushSync(() => {
7395 handleMouseMove();
7396 });
7397 } else if (isOverInactive && currentOpen) {
7398 handleMouseMove();
7399 } else {
7400 instance.restTimeoutPending = true;
7401 instance.restTimeout.start(restMsValue, handleMouseMove);
7402 }
7403 }
7404 };
7405 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);
7406 }
7407
7408 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
7409 var CURSOR_SPEED_THRESHOLD = 0.1;
7410 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
7411 var POLYGON_BUFFER = 0.5;
7412 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
7413 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
7414 }
7415 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
7416 let isInsideValue = false;
7417 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
7418 isInsideValue = !isInsideValue;
7419 }
7420 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
7421 isInsideValue = !isInsideValue;
7422 }
7423 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
7424 isInsideValue = !isInsideValue;
7425 }
7426 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
7427 isInsideValue = !isInsideValue;
7428 }
7429 return isInsideValue;
7430 }
7431 function isInsideRect(pointX, pointY, rect) {
7432 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
7433 }
7434 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
7435 const minX = Math.min(x1, x2);
7436 const maxX = Math.max(x1, x2);
7437 const minY = Math.min(y1, y2);
7438 const maxY = Math.max(y1, y2);
7439 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
7440 }
7441 function safePolygon(options = {}) {
7442 const {
7443 blockPointerEvents = false
7444 } = options;
7445 const timeout = new Timeout();
7446 const fn = ({
7447 x: x2,
7448 y: y2,
7449 placement,
7450 elements,
7451 onClose,
7452 nodeId,
7453 tree
7454 }) => {
7455 const side = placement?.split("-")[0];
7456 let hasLanded = false;
7457 let lastX = null;
7458 let lastY = null;
7459 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
7460 function isCursorMovingSlowly(nextX, nextY) {
7461 const currentTime = performance.now();
7462 const elapsedTime = currentTime - lastCursorTime;
7463 if (lastX === null || lastY === null || elapsedTime === 0) {
7464 lastX = nextX;
7465 lastY = nextY;
7466 lastCursorTime = currentTime;
7467 return false;
7468 }
7469 const deltaX = nextX - lastX;
7470 const deltaY = nextY - lastY;
7471 const distanceSquared = deltaX * deltaX + deltaY * deltaY;
7472 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
7473 lastX = nextX;
7474 lastY = nextY;
7475 lastCursorTime = currentTime;
7476 return distanceSquared < thresholdSquared;
7477 }
7478 function close() {
7479 timeout.clear();
7480 onClose();
7481 }
7482 return function onMouseMove(event) {
7483 timeout.clear();
7484 const domReference = elements.domReference;
7485 const floating = elements.floating;
7486 if (!domReference || !floating || side == null || x2 == null || y2 == null) {
7487 return void 0;
7488 }
7489 const {
7490 clientX,
7491 clientY
7492 } = event;
7493 const target = getTarget(event);
7494 const isLeave = event.type === "mouseleave";
7495 const isOverFloatingEl = contains(floating, target);
7496 const isOverReferenceEl = contains(domReference, target);
7497 if (isOverFloatingEl) {
7498 hasLanded = true;
7499 if (!isLeave) {
7500 return void 0;
7501 }
7502 }
7503 if (isOverReferenceEl) {
7504 hasLanded = false;
7505 if (!isLeave) {
7506 hasLanded = true;
7507 return void 0;
7508 }
7509 }
7510 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
7511 return void 0;
7512 }
7513 function hasOpenChildNode() {
7514 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
7515 }
7516 function closeIfNoOpenChild() {
7517 if (!hasOpenChildNode()) {
7518 close();
7519 }
7520 }
7521 if (hasOpenChildNode()) {
7522 return void 0;
7523 }
7524 const refRect = domReference.getBoundingClientRect();
7525 const rect = floating.getBoundingClientRect();
7526 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2;
7527 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2;
7528 const isFloatingWider = rect.width > refRect.width;
7529 const isFloatingTaller = rect.height > refRect.height;
7530 const left = (isFloatingWider ? refRect : rect).left;
7531 const right = (isFloatingWider ? refRect : rect).right;
7532 const top = (isFloatingTaller ? refRect : rect).top;
7533 const bottom = (isFloatingTaller ? refRect : rect).bottom;
7534 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) {
7535 closeIfNoOpenChild();
7536 return void 0;
7537 }
7538 let isInsideTroughRect = false;
7539 switch (side) {
7540 case "top":
7541 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
7542 break;
7543 case "bottom":
7544 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
7545 break;
7546 case "left":
7547 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
7548 break;
7549 case "right":
7550 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
7551 break;
7552 default:
7553 }
7554 if (isInsideTroughRect) {
7555 return void 0;
7556 }
7557 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
7558 closeIfNoOpenChild();
7559 return void 0;
7560 }
7561 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
7562 closeIfNoOpenChild();
7563 return void 0;
7564 }
7565 let isInsidePolygon = false;
7566 switch (side) {
7567 case "top": {
7568 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7569 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7570 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7571 const cursorPointY = y2 + POLYGON_BUFFER + 1;
7572 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
7573 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
7574 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7575 break;
7576 }
7577 case "bottom": {
7578 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7579 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7580 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7581 const cursorPointY = y2 - POLYGON_BUFFER;
7582 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
7583 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
7584 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7585 break;
7586 }
7587 case "left": {
7588 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7589 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7590 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7591 const cursorPointX = x2 + POLYGON_BUFFER + 1;
7592 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
7593 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
7594 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
7595 break;
7596 }
7597 case "right": {
7598 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7599 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7600 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7601 const cursorPointX = x2 - POLYGON_BUFFER;
7602 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
7603 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
7604 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
7605 break;
7606 }
7607 default:
7608 }
7609 if (!isInsidePolygon) {
7610 closeIfNoOpenChild();
7611 } else if (!hasLanded) {
7612 timeout.start(40, closeIfNoOpenChild);
7613 }
7614 return void 0;
7615 };
7616 };
7617 fn.__options = {
7618 ...options,
7619 blockPointerEvents
7620 };
7621 return fn;
7622 }
7623
7624 // node_modules/@base-ui/react/utils/NullStore.mjs
7625 var NullStore = class extends ReactStore {
7626 // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding
7627 // `setState` alone would neutralize them today. They are overridden explicitly so the store stays
7628 // inert even if a future base-class change stops routing a mutator through `setState`.
7629 setState(_newState) {
7630 }
7631 update(_changes) {
7632 }
7633 set(_key, _value) {
7634 }
7635 notifyAll() {
7636 }
7637 };
7638
7639 // node_modules/@base-ui/utils/inertValue.mjs
7640 function inertValue(value) {
7641 if (isReactVersionAtLeast(19)) {
7642 return value;
7643 }
7644 return value ? "true" : void 0;
7645 }
7646
7647 // node_modules/@base-ui/react/internals/useValueChanged.mjs
7648 var React35 = __toESM(require_react(), 1);
7649 function useValueChanged(value, onChange) {
7650 const valueRef = React35.useRef(value);
7651 const onChangeCallback = useStableCallback(onChange);
7652 useIsoLayoutEffect(() => {
7653 if (valueRef.current !== value) {
7654 onChangeCallback(valueRef.current);
7655 }
7656 valueRef.current = value;
7657 }, [value, onChangeCallback]);
7658 }
7659
7660 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
7661 var React36 = __toESM(require_react(), 1);
7662
7663 // node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs
7664 var valid = "data-valid";
7665 var invalid = "data-invalid";
7666
7667 // node_modules/@base-ui/react/internals/field-constants/constants.mjs
7668 var DEFAULT_VALIDITY_STATE = {
7669 badInput: false,
7670 customError: false,
7671 patternMismatch: false,
7672 rangeOverflow: false,
7673 rangeUnderflow: false,
7674 stepMismatch: false,
7675 tooLong: false,
7676 tooShort: false,
7677 typeMismatch: false,
7678 valid: null,
7679 valueMissing: false
7680 };
7681 var DEFAULT_FIELD_STATE_ATTRIBUTES = {
7682 valid: null,
7683 touched: false,
7684 dirty: false,
7685 filled: false,
7686 focused: false
7687 };
7688 var DEFAULT_FIELD_ROOT_STATE = {
7689 disabled: false,
7690 ...DEFAULT_FIELD_STATE_ATTRIBUTES
7691 };
7692 var fieldValidityMapping = {
7693 valid(value) {
7694 if (value === null) {
7695 return null;
7696 }
7697 if (value) {
7698 return {
7699 [valid]: ""
7700 };
7701 }
7702 return {
7703 [invalid]: ""
7704 };
7705 }
7706 };
7707
7708 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
7709 var DEFAULT_FIELD_ROOT_CONTEXT = {
7710 invalid: void 0,
7711 name: void 0,
7712 validityData: {
7713 state: DEFAULT_VALIDITY_STATE,
7714 errors: [],
7715 error: "",
7716 value: "",
7717 initialValue: null
7718 },
7719 setValidityData: NOOP,
7720 disabled: void 0,
7721 setTouched: NOOP,
7722 setDirty: NOOP,
7723 setFilled: NOOP,
7724 setFocused: NOOP,
7725 validationMode: "onSubmit",
7726 shouldValidateOnChange: () => false,
7727 state: DEFAULT_FIELD_ROOT_STATE,
7728 registerFieldControl: NOOP,
7729 validation: {
7730 getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
7731 inputRef: {
7732 current: null
7733 },
7734 registeredInputs: /* @__PURE__ */ new Map(),
7735 registerInput: NOOP,
7736 getInputControl: () => null,
7737 commit: async () => {
7738 },
7739 change: NOOP
7740 }
7741 };
7742 var FieldRootContext = /* @__PURE__ */ React36.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
7743 if (true) FieldRootContext.displayName = "FieldRootContext";
7744 function useFieldRootContext(optional = true) {
7745 const context = React36.useContext(FieldRootContext);
7746 if (context.setValidityData === NOOP && !optional) {
7747 throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28));
7748 }
7749 return context;
7750 }
7751
7752 // node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
7753 function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
7754 const {
7755 registerFieldControl
7756 } = useFieldRootContext();
7757 const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
7758 useIsoLayoutEffect(() => {
7759 const source = sourceRef.current;
7760 if (!enabled) {
7761 registerFieldControl(source, void 0);
7762 return;
7763 }
7764 const registration = {
7765 controlRef,
7766 getValue: getFormValueOverride,
7767 id,
7768 name,
7769 value
7770 };
7771 registerFieldControl(source, registration);
7772 }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);
7773 useIsoLayoutEffect(() => {
7774 const source = sourceRef.current;
7775 return () => {
7776 registerFieldControl(source, void 0);
7777 };
7778 }, [registerFieldControl, sourceRef]);
7779 }
7780
7781 // node_modules/@base-ui/react/internals/form-context/FormContext.mjs
7782 var React37 = __toESM(require_react(), 1);
7783 var FormContext = /* @__PURE__ */ React37.createContext({
7784 elementRef: {
7785 current: null
7786 },
7787 formRef: {
7788 current: {
7789 fields: /* @__PURE__ */ new Map()
7790 }
7791 },
7792 errors: {},
7793 clearErrors: NOOP,
7794 validationMode: "onSubmit",
7795 submitCountRef: {
7796 current: 0
7797 }
7798 });
7799 if (true) FormContext.displayName = "FormContext";
7800 function useFormContext() {
7801 return React37.useContext(FormContext);
7802 }
7803
7804 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
7805 var React39 = __toESM(require_react(), 1);
7806
7807 // node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
7808 var React38 = __toESM(require_react(), 1);
7809 var LabelableContext = /* @__PURE__ */ React38.createContext({
7810 controlId: void 0,
7811 registerControlId: NOOP,
7812 resetControlId: NOOP,
7813 labelId: void 0,
7814 setLabelId: NOOP,
7815 messageIds: [],
7816 setMessageIds: NOOP,
7817 getDescriptionProps: (externalProps) => externalProps
7818 });
7819 if (true) LabelableContext.displayName = "LabelableContext";
7820 function useLabelableContext() {
7821 return React38.useContext(LabelableContext);
7822 }
7823
7824 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
7825 function useLabelableId(params = {}) {
7826 const {
7827 id,
7828 enabled = true
7829 } = params;
7830 const {
7831 controlId,
7832 registerControlId,
7833 resetControlId
7834 } = useLabelableContext();
7835 const defaultId = useBaseUiId();
7836 const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
7837 const hasRegisteredRef = React39.useRef(false);
7838 const hadExplicitIdRef = React39.useRef(false);
7839 const unregisterControlId = useStableCallback(() => {
7840 if (!hasRegisteredRef.current || registerControlId === NOOP) {
7841 return;
7842 }
7843 hasRegisteredRef.current = false;
7844 registerControlId(controlSourceRef.current, void 0);
7845 });
7846 useIsoLayoutEffect(() => {
7847 if (!enabled || registerControlId === NOOP) {
7848 unregisterControlId();
7849 return void 0;
7850 }
7851 let nextId2;
7852 if (id !== void 0) {
7853 hadExplicitIdRef.current = true;
7854 nextId2 = id;
7855 } else if (hadExplicitIdRef.current) {
7856 nextId2 = defaultId;
7857 } else {
7858 resetControlId();
7859 return void 0;
7860 }
7861 if (nextId2 === void 0) {
7862 unregisterControlId();
7863 return void 0;
7864 }
7865 hasRegisteredRef.current = true;
7866 registerControlId(controlSourceRef.current, nextId2);
7867 return void 0;
7868 }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]);
7869 useIsoLayoutEffect(() => {
7870 return unregisterControlId;
7871 }, [unregisterControlId]);
7872 return (enabled ? controlId : void 0) ?? id ?? defaultId;
7873 }
7874
7875 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
7876 var React40 = __toESM(require_react(), 1);
7877 var DirectionContext = /* @__PURE__ */ React40.createContext(void 0);
7878 if (true) DirectionContext.displayName = "DirectionContext";
7879 function useDirection() {
7880 const context = React40.useContext(DirectionContext);
7881 return context?.direction ?? "ltr";
7882 }
7883
7884 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
7885 var React41 = __toESM(require_react(), 1);
7886
7887 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
7888 var baseArrow = (options) => ({
7889 name: "arrow",
7890 options,
7891 async fn(state) {
7892 const {
7893 x: x2,
7894 y: y2,
7895 placement,
7896 rects,
7897 platform: platform3,
7898 elements,
7899 middlewareData
7900 } = state;
7901 const {
7902 element,
7903 padding = 0,
7904 offsetParent = "real"
7905 } = evaluate(options, state) || {};
7906 if (element == null) {
7907 return {};
7908 }
7909 const paddingObject = getPaddingObject(padding);
7910 const coords = {
7911 x: x2,
7912 y: y2
7913 };
7914 const axis = getAlignmentAxis(placement);
7915 const length = getAxisLength(axis);
7916 const arrowDimensions = await platform3.getDimensions(element);
7917 const isYAxis = axis === "y";
7918 const minProp = isYAxis ? "top" : "left";
7919 const maxProp = isYAxis ? "bottom" : "right";
7920 const clientProp = isYAxis ? "clientHeight" : "clientWidth";
7921 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
7922 const startDiff = coords[axis] - rects.reference[axis];
7923 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
7924 let clientSize = elements.floating[clientProp] || rects.floating[length];
7925 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
7926 clientSize = elements.floating[clientProp] || rects.floating[length];
7927 }
7928 const centerToReference = endDiff / 2 - startDiff / 2;
7929 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
7930 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
7931 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
7932 const min3 = minPadding;
7933 const max3 = clientSize - arrowDimensions[length] - maxPadding;
7934 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
7935 const offset4 = clamp(min3, center, max3);
7936 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min3 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
7937 const alignmentOffset = shouldAddOffset ? center < min3 ? center - min3 : center - max3 : 0;
7938 return {
7939 [axis]: coords[axis] + alignmentOffset,
7940 data: {
7941 [axis]: offset4,
7942 centerOffset: center - offset4 - alignmentOffset,
7943 ...shouldAddOffset && {
7944 alignmentOffset
7945 }
7946 },
7947 reset: shouldAddOffset
7948 };
7949 }
7950 });
7951 var arrow4 = (options, deps) => {
7952 const {
7953 name,
7954 fn
7955 } = baseArrow(options);
7956 return {
7957 name,
7958 fn,
7959 options: [options, deps]
7960 };
7961 };
7962
7963 // node_modules/@base-ui/react/utils/hideMiddleware.mjs
7964 var hide4 = {
7965 name: "hide",
7966 async fn(state) {
7967 const {
7968 width,
7969 height,
7970 x: x2,
7971 y: y2
7972 } = state.rects.reference;
7973 const anchorHidden2 = width === 0 && height === 0 && x2 === 0 && y2 === 0;
7974 const overflow = await state.platform.detectOverflow(state, {
7975 elementContext: "reference"
7976 });
7977 const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;
7978 return {
7979 data: {
7980 referenceHidden: referenceHidden || anchorHidden2
7981 }
7982 };
7983 }
7984 };
7985
7986 // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs
7987 var DEFAULT_SIDES = {
7988 sideX: "left",
7989 sideY: "top"
7990 };
7991
7992 // node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs
7993 var availableWidth = "--available-width";
7994 var availableHeight = "--available-height";
7995 var anchorWidth = "--anchor-width";
7996 var anchorHeight = "--anchor-height";
7997 var transformOrigin = "--transform-origin";
7998 var positionerWidth = "--positioner-width";
7999 var positionerHeight = "--positioner-height";
8000
8001 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
8002 var AVAILABLE_WIDTH_VAR = availableWidth;
8003 var AVAILABLE_HEIGHT_VAR = availableHeight;
8004 function getLogicalSide(sideParam, renderedSide, isRtl) {
8005 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
8006 const logicalRight = isRtl ? "inline-start" : "inline-end";
8007 const logicalLeft = isRtl ? "inline-end" : "inline-start";
8008 return {
8009 top: "top",
8010 right: isLogicalSideParam ? logicalRight : "right",
8011 bottom: "bottom",
8012 left: isLogicalSideParam ? logicalLeft : "left"
8013 }[renderedSide];
8014 }
8015 function getOffsetData(state, sideParam, isRtl) {
8016 const {
8017 rects,
8018 placement
8019 } = state;
8020 const data = {
8021 side: getLogicalSide(sideParam, getSide(placement), isRtl),
8022 align: getAlignment(placement) || "center",
8023 anchor: {
8024 width: rects.reference.width,
8025 height: rects.reference.height
8026 },
8027 positioner: {
8028 width: rects.floating.width,
8029 height: rects.floating.height
8030 }
8031 };
8032 return data;
8033 }
8034 function useAnchorPositioning(params) {
8035 return useAnchorPositioningWithHook(params, useBaseUIFloating);
8036 }
8037 function useAnchorPositioningWithHook(params, useFloatingHook) {
8038 const {
8039 // Public parameters
8040 anchor,
8041 positionMethod = "absolute",
8042 side: sideParam = "bottom",
8043 sideOffset = 0,
8044 align = "center",
8045 alignOffset = 0,
8046 collisionBoundary,
8047 collisionPadding: collisionPaddingParam = 5,
8048 sticky = false,
8049 arrowPadding = 5,
8050 disableAnchorTracking = false,
8051 inline: inlineMiddleware,
8052 // Private parameters
8053 keepMounted = false,
8054 floatingRootContext,
8055 mounted,
8056 collisionAvoidance,
8057 shift: shift4,
8058 nodeId,
8059 adaptiveOrigin: adaptiveOrigin2,
8060 lazyFlip = false,
8061 externalTree
8062 } = params;
8063 const [mountSide, setMountSide] = React41.useState(null);
8064 if (!mounted && mountSide !== null) {
8065 setMountSide(null);
8066 }
8067 const collisionAvoidanceSide = collisionAvoidance.side || "flip";
8068 const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
8069 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
8070 const shiftCrossAxis = shift4?.crossAxis ?? false;
8071 const shiftRootBoundary = shift4?.rootBoundary;
8072 const anchorFn = typeof anchor === "function" ? anchor : void 0;
8073 const anchorFnCallback = useStableCallback(anchorFn);
8074 const anchorDep = anchorFn ? anchorFnCallback : anchor;
8075 const anchorValueRef = useValueAsRef(anchor);
8076 const mountedRef = useValueAsRef(mounted);
8077 const direction = useDirection();
8078 const isRtl = direction === "rtl";
8079 const side = mountSide || {
8080 top: "top",
8081 right: "right",
8082 bottom: "bottom",
8083 left: "left",
8084 "inline-end": isRtl ? "left" : "right",
8085 "inline-start": isRtl ? "right" : "left"
8086 }[sideParam];
8087 const placement = align === "center" ? side : `${side}-${align}`;
8088 let collisionPadding = collisionPaddingParam;
8089 if (typeof collisionPadding === "number") {
8090 collisionPadding = {
8091 top: collisionPadding,
8092 right: collisionPadding,
8093 bottom: collisionPadding,
8094 left: collisionPadding
8095 };
8096 } else if (collisionPadding) {
8097 collisionPadding = {
8098 top: collisionPadding.top || 0,
8099 right: collisionPadding.right || 0,
8100 bottom: collisionPadding.bottom || 0,
8101 left: collisionPadding.left || 0
8102 };
8103 }
8104 const bias = 1;
8105 const biasTop = sideParam === "bottom" ? bias : 0;
8106 const biasBottom = sideParam === "top" ? bias : 0;
8107 const biasLeft = sideParam === "right" ? bias : 0;
8108 const biasRight = sideParam === "left" ? bias : 0;
8109 const commonCollisionProps = {
8110 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
8111 padding: collisionPadding
8112 };
8113 const arrowRef = React41.useRef(null);
8114 const sideOffsetRef = useValueAsRef(sideOffset);
8115 const alignOffsetRef = useValueAsRef(alignOffset);
8116 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
8117 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
8118 const middleware = [];
8119 if (inlineMiddleware) {
8120 middleware.push(inlineMiddleware);
8121 }
8122 middleware.push(offset3((state) => {
8123 const data = getOffsetData(state, sideParam, isRtl);
8124 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
8125 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
8126 return {
8127 mainAxis: sideAxis,
8128 crossAxis: alignAxis,
8129 alignmentAxis: alignAxis
8130 };
8131 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
8132 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
8133 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
8134 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
8135 ...commonCollisionProps,
8136 // Ensure the popup flips if it's been limited by its --available-height and it resizes.
8137 // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
8138 padding: {
8139 top: collisionPadding.top + bias + biasTop,
8140 right: collisionPadding.right + bias + biasRight,
8141 bottom: collisionPadding.bottom + bias + biasBottom,
8142 left: collisionPadding.left + bias + biasLeft
8143 },
8144 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
8145 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
8146 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
8147 });
8148 const shiftMiddleware = shiftDisabled ? null : shift3({
8149 ...commonCollisionProps,
8150 // Use the Layout Viewport to avoid shifting around when pinch-zooming.
8151 rootBoundary: shiftRootBoundary,
8152 mainAxis: collisionAvoidanceAlign !== "none",
8153 crossAxis: crossAxisShiftEnabled,
8154 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
8155 if (!arrowRef.current) {
8156 return {};
8157 }
8158 const {
8159 width,
8160 height
8161 } = arrowRef.current.getBoundingClientRect();
8162 const sideAxis = getSideAxis(getSide(limitData.placement));
8163 const arrowSize = sideAxis === "y" ? width : height;
8164 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
8165 return {
8166 offset: arrowSize / 2 + offsetAmount / 2
8167 };
8168 })
8169 }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);
8170 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
8171 middleware.push(shiftMiddleware, flipMiddleware);
8172 } else {
8173 middleware.push(flipMiddleware, shiftMiddleware);
8174 }
8175 middleware.push(size3({
8176 ...commonCollisionProps,
8177 apply({
8178 elements: {
8179 floating
8180 },
8181 availableWidth: availableWidth2,
8182 availableHeight: availableHeight2,
8183 rects
8184 }) {
8185 if (!mountedRef.current) {
8186 return;
8187 }
8188 const floatingStyle = floating.style;
8189 floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`);
8190 floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`);
8191 const dpr = getWindow(floating).devicePixelRatio || 1;
8192 const {
8193 x: x3,
8194 y: y3,
8195 width,
8196 height
8197 } = rects.reference;
8198 const anchorWidth2 = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr;
8199 const anchorHeight2 = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr;
8200 floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`);
8201 floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`);
8202 }
8203 }), arrow4((state) => ({
8204 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
8205 // we'll create a fake element.
8206 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
8207 // No padding for the fake arrow: it would displace aligned popups on narrow anchors.
8208 padding: arrowRef.current ? arrowPadding : 0,
8209 offsetParent: "floating"
8210 }), [arrowPadding]), {
8211 name: "transformOrigin",
8212 fn(state) {
8213 const {
8214 elements: {
8215 floating
8216 },
8217 middlewareData: middlewareData2,
8218 placement: renderedPlacement2,
8219 platform: platform3,
8220 rects,
8221 y: y3
8222 } = state;
8223 const renderedSide2 = getSide(renderedPlacement2);
8224 const renderedAlign2 = getAlignment(renderedPlacement2);
8225 const isVertical = getSideAxis(renderedSide2) === "y";
8226 const arrowEl = arrowRef.current;
8227 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
8228 let crossOrigin;
8229 if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) {
8230 crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%";
8231 } else {
8232 const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0;
8233 const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;
8234 crossOrigin = `${arrowOffset + arrowSize / 2}px`;
8235 }
8236 let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;
8237 if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) {
8238 sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y3}px`;
8239 }
8240 floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);
8241 return {};
8242 }
8243 }, hide4, adaptiveOrigin2);
8244 useIsoLayoutEffect(() => {
8245 if (!mounted && floatingRootContext) {
8246 floatingRootContext.update({
8247 referenceElement: null,
8248 floatingElement: null,
8249 domReferenceElement: null,
8250 positionReference: null
8251 });
8252 }
8253 }, [mounted, floatingRootContext]);
8254 const autoUpdateOptions = React41.useMemo(() => ({
8255 ancestorScroll: !disableAnchorTracking,
8256 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
8257 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
8258 }), [disableAnchorTracking]);
8259 const {
8260 refs,
8261 elements,
8262 x: x2,
8263 y: y2,
8264 middlewareData,
8265 update: update4,
8266 placement: renderedPlacement,
8267 context,
8268 isPositioned,
8269 floatingStyles: originalFloatingStyles
8270 } = useFloatingHook({
8271 rootContext: floatingRootContext,
8272 open: keepMounted ? mounted : void 0,
8273 placement,
8274 middleware,
8275 strategy: positionMethod,
8276 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
8277 nodeId,
8278 externalTree
8279 });
8280 const {
8281 sideX,
8282 sideY
8283 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
8284 const resolvedPosition = isPositioned ? positionMethod : "fixed";
8285 const floatingStyles = React41.useMemo(() => {
8286 let base;
8287 if (!isPositioned) {
8288 base = {
8289 position: resolvedPosition,
8290 top: 0,
8291 left: 0
8292 };
8293 } else if (adaptiveOrigin2) {
8294 base = {
8295 position: resolvedPosition,
8296 [sideX]: x2,
8297 [sideY]: y2
8298 };
8299 } else {
8300 base = {
8301 ...originalFloatingStyles,
8302 position: resolvedPosition
8303 };
8304 }
8305 base[AVAILABLE_WIDTH_VAR] = "100vw";
8306 base[AVAILABLE_HEIGHT_VAR] = "100vh";
8307 if (!isPositioned) {
8308 base.opacity = 0;
8309 }
8310 return base;
8311 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]);
8312 const registeredPositionReferenceRef = React41.useRef(null);
8313 useIsoLayoutEffect(() => {
8314 if (!mounted) {
8315 return;
8316 }
8317 const anchorValue = anchorValueRef.current;
8318 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
8319 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
8320 const finalAnchor = unwrappedElement || null;
8321 if (finalAnchor !== registeredPositionReferenceRef.current) {
8322 refs.setPositionReference(finalAnchor);
8323 registeredPositionReferenceRef.current = finalAnchor;
8324 }
8325 }, [mounted, refs, anchorDep, anchorValueRef]);
8326 React41.useEffect(() => {
8327 if (!mounted) {
8328 return;
8329 }
8330 const anchorValue = anchorValueRef.current;
8331 if (typeof anchorValue === "function") {
8332 return;
8333 }
8334 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
8335 refs.setPositionReference(anchorValue.current);
8336 registeredPositionReferenceRef.current = anchorValue.current;
8337 }
8338 }, [mounted, refs, anchorDep, anchorValueRef]);
8339 React41.useEffect(() => {
8340 if (keepMounted && mounted && elements.reference && elements.floating) {
8341 return autoUpdate(elements.reference, elements.floating, update4, autoUpdateOptions);
8342 }
8343 return void 0;
8344 }, [keepMounted, mounted, elements, update4, autoUpdateOptions]);
8345 const renderedSide = getSide(renderedPlacement);
8346 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
8347 const renderedAlign = getAlignment(renderedPlacement) || "center";
8348 const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden);
8349 useIsoLayoutEffect(() => {
8350 if (lazyFlip && mounted && isPositioned && renderedSide !== side) {
8351 setMountSide(renderedSide);
8352 }
8353 }, [lazyFlip, mounted, isPositioned, renderedSide, side]);
8354 const arrowStyles = React41.useMemo(() => ({
8355 position: "absolute",
8356 top: middlewareData.arrow?.y,
8357 left: middlewareData.arrow?.x
8358 }), [middlewareData.arrow]);
8359 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
8360 return React41.useMemo(() => ({
8361 positionerStyles: floatingStyles,
8362 arrowStyles,
8363 arrowRef,
8364 arrowUncentered,
8365 side: logicalRenderedSide,
8366 align: renderedAlign,
8367 physicalSide: renderedSide,
8368 anchorHidden: anchorHidden2,
8369 refs,
8370 context,
8371 isPositioned,
8372 update: update4
8373 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update4]);
8374 }
8375 function isRef(param) {
8376 return param != null && "current" in param;
8377 }
8378
8379 // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs
8380 function getDisabledMountTransitionStyles(transitionStatus) {
8381 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
8382 }
8383
8384 // node_modules/@base-ui/react/utils/usePositioner.mjs
8385 function usePositioner(componentProps, state, {
8386 styles,
8387 transitionStatus,
8388 props,
8389 refs,
8390 hidden,
8391 inert = false
8392 }) {
8393 const style = {
8394 ...styles
8395 };
8396 if (inert) {
8397 style.pointerEvents = "none";
8398 }
8399 return useRenderElement("div", componentProps, {
8400 state,
8401 ref: refs,
8402 props: [{
8403 role: "presentation",
8404 hidden,
8405 style
8406 }, getDisabledMountTransitionStyles(transitionStatus), props],
8407 stateAttributesMapping: popupStateMapping
8408 });
8409 }
8410
8411 // node_modules/@base-ui/react/button/Button.mjs
8412 var React42 = __toESM(require_react(), 1);
8413 var Button = /* @__PURE__ */ React42.forwardRef(function Button2(componentProps, forwardedRef) {
8414 const {
8415 render: render4,
8416 className,
8417 disabled: disabled2 = false,
8418 focusableWhenDisabled = false,
8419 nativeButton = true,
8420 style,
8421 ...elementProps
8422 } = componentProps;
8423 const {
8424 getButtonProps,
8425 buttonRef
8426 } = useButton({
8427 disabled: disabled2,
8428 focusableWhenDisabled,
8429 native: nativeButton
8430 });
8431 const state = {
8432 disabled: disabled2
8433 };
8434 return useRenderElement("button", componentProps, {
8435 state,
8436 ref: [forwardedRef, buttonRef],
8437 props: [elementProps, getButtonProps]
8438 });
8439 });
8440 if (true) Button.displayName = "Button";
8441
8442 // node_modules/@base-ui/react/field/item/FieldItemContext.mjs
8443 var React43 = __toESM(require_react(), 1);
8444 var FieldItemContext = /* @__PURE__ */ React43.createContext({
8445 disabled: false
8446 });
8447 if (true) FieldItemContext.displayName = "FieldItemContext";
8448 function useFieldItemContext() {
8449 const context = React43.useContext(FieldItemContext);
8450 return context;
8451 }
8452
8453 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs
8454 var React44 = __toESM(require_react(), 1);
8455
8456 // node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs
8457 function getCombinedFieldValidityData(validityData, invalid2) {
8458 return {
8459 ...validityData,
8460 state: {
8461 ...validityData.state,
8462 valid: !invalid2 && validityData.state.valid
8463 }
8464 };
8465 }
8466
8467 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs
8468 var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE);
8469 function isEligibleInput(input, formElement) {
8470 if (input.matches(":disabled")) {
8471 return false;
8472 }
8473 if (!formElement || input.form === formElement) {
8474 return true;
8475 }
8476 return input.form === null && !input.hasAttribute("form");
8477 }
8478 function findRepresentativeInput(inputs, formElement) {
8479 let fallback = null;
8480 for (const input of inputs.keys()) {
8481 if (!isEligibleInput(input, formElement)) {
8482 continue;
8483 }
8484 if (!input.validity.valid) {
8485 return input;
8486 }
8487 fallback ??= input;
8488 }
8489 return fallback;
8490 }
8491 function makeState(customError) {
8492 return {
8493 ...DEFAULT_VALIDITY_STATE,
8494 valid: !customError,
8495 customError
8496 };
8497 }
8498 function getNativeErrors(element) {
8499 return element && element.validationMessage ? [element.validationMessage] : [];
8500 }
8501 function useFieldValidation(params) {
8502 const {
8503 elementRef,
8504 formRef
8505 } = useFormContext();
8506 const {
8507 setValidityData,
8508 validate,
8509 validityData,
8510 validationDebounceTime,
8511 invalid: invalid2,
8512 markedDirtyRef,
8513 state,
8514 shouldValidateOnChange,
8515 validationMode,
8516 registeredFieldIdRef
8517 } = params;
8518 const {
8519 controlId,
8520 getDescriptionProps
8521 } = useLabelableContext();
8522 const timeout = useTimeout();
8523 const inputRef = React44.useRef(null);
8524 const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current;
8525 const validationCommitIdRef = React44.useRef(0);
8526 const customValidityRef = React44.useRef(null);
8527 const registerInput = React44.useCallback((element, registration) => {
8528 registeredInputs.set(element, registration);
8529 return () => {
8530 registeredInputs.delete(element);
8531 };
8532 }, [registeredInputs]);
8533 const getInputControl = useStableCallback(() => {
8534 const element = findRepresentativeInput(registeredInputs, elementRef.current);
8535 return element && registeredInputs.get(element)?.controlRef.current || null;
8536 });
8537 const commit = useStableCallback(async (value, revalidate = false) => {
8538 validationCommitIdRef.current += 1;
8539 const validationCommitId = validationCommitIdRef.current;
8540 function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) {
8541 const fieldId = registeredFieldIdRef.current ?? controlId;
8542 if (fieldId == null) {
8543 return;
8544 }
8545 const currentFieldData = formRef.current.fields.get(fieldId);
8546 if (!currentFieldData) {
8547 return;
8548 }
8549 const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid);
8550 formRef.current.fields.set(fieldId, {
8551 ...currentFieldData,
8552 validityData: validityDataWithFormErrors
8553 });
8554 }
8555 function makeValidityData(validityState, errorMessages) {
8556 const errors = validityState.valid === false ? errorMessages : [];
8557 return {
8558 value,
8559 state: validityState,
8560 error: errors[0] ?? "",
8561 errors,
8562 initialValue: validityData.initialValue
8563 };
8564 }
8565 function setCustomValidity(element2, message2) {
8566 const displaced = element2.validity.customError ? element2.validationMessage : "";
8567 const ownedMessage = message2.replace(/\r\n?/g, "\n");
8568 element2.setCustomValidity(ownedMessage);
8569 customValidityRef.current = [element2, ownedMessage, displaced];
8570 }
8571 function clearCustomValidity() {
8572 const record = customValidityRef.current;
8573 customValidityRef.current = null;
8574 if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) {
8575 record[0].setCustomValidity(record[2]);
8576 }
8577 }
8578 function publish(validityState, errorMessages, externalInvalid) {
8579 const nextValidityData = makeValidityData(validityState, errorMessages);
8580 updateRegisteredFieldValidity(nextValidityData, externalInvalid);
8581 setValidityData(nextValidityData);
8582 }
8583 function getState(el) {
8584 const computedState = validityKeys.reduce((acc, key) => {
8585 acc[key] = el.validity[key];
8586 return acc;
8587 }, {});
8588 let hasOnlyValueMissingError = false;
8589 for (const key of validityKeys) {
8590 if (key === "valid") {
8591 continue;
8592 }
8593 if (key === "valueMissing" && computedState[key]) {
8594 hasOnlyValueMissingError = true;
8595 } else if (computedState[key]) {
8596 return computedState;
8597 }
8598 }
8599 if (hasOnlyValueMissingError && !markedDirtyRef.current) {
8600 computedState.valid = true;
8601 computedState.valueMissing = false;
8602 }
8603 return computedState;
8604 }
8605 function resolveRepresentativeInput() {
8606 return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current;
8607 }
8608 let element = resolveRepresentativeInput();
8609 function refreshState() {
8610 element = resolveRepresentativeInput();
8611 return element?.willValidate ? getState(element) : makeState(false);
8612 }
8613 if (revalidate) {
8614 if (state.valid !== false || !element) {
8615 return;
8616 }
8617 if (!element.validity.valueMissing) {
8618 clearCustomValidity();
8619 const currentElement = resolveRepresentativeInput();
8620 const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : [];
8621 publish(makeState(foreign.length > 0), foreign, false);
8622 return;
8623 }
8624 for (const key of validityKeys) {
8625 if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) {
8626 return;
8627 }
8628 }
8629 }
8630 timeout.clear();
8631 clearCustomValidity();
8632 let nextState = refreshState();
8633 let validationErrors = getNativeErrors(element);
8634 const isValidatingOnChange = shouldValidateOnChange();
8635 if (validationErrors.length === 0 || isValidatingOnChange) {
8636 const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => {
8637 if (field.name) {
8638 acc[field.name] = field.getValue();
8639 }
8640 return acc;
8641 }, {});
8642 const resultOrPromise = validate(value, formValues);
8643 let result;
8644 if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) {
8645 if (nextState.valid === false) {
8646 publish(nextState, validationErrors);
8647 } else if (validationMode === "onSubmit" || !validityData.state.customError) {
8648 nextState.valid = null;
8649 publish(nextState, validationErrors);
8650 }
8651 result = await resultOrPromise;
8652 if (validationCommitId !== validationCommitIdRef.current) {
8653 return;
8654 }
8655 nextState = refreshState();
8656 } else {
8657 result = resultOrPromise;
8658 }
8659 validationErrors = result ? [].concat(result).filter(Boolean) : [];
8660 if (validationErrors.length > 0) {
8661 nextState.valid = false;
8662 nextState.customError = true;
8663 if (element?.willValidate) {
8664 setCustomValidity(element, validationErrors.join("\n"));
8665 }
8666 } else {
8667 validationErrors = getNativeErrors(element);
8668 }
8669 }
8670 publish(nextState, validationErrors);
8671 });
8672 const change = useStableCallback((value, cancelPending = false) => {
8673 timeout.clear();
8674 validationCommitIdRef.current += 1;
8675 if (cancelPending) {
8676 return;
8677 }
8678 const validateOnChange = shouldValidateOnChange();
8679 if (validateOnChange && value !== "" && validationDebounceTime) {
8680 timeout.start(validationDebounceTime, () => {
8681 commit(value);
8682 });
8683 } else {
8684 commit(value, !validateOnChange);
8685 }
8686 });
8687 const getValidationProps = React44.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? {
8688 "aria-invalid": true
8689 } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]);
8690 return React44.useMemo(() => ({
8691 getValidationProps,
8692 inputRef,
8693 registeredInputs,
8694 registerInput,
8695 getInputControl,
8696 commit,
8697 change
8698 }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]);
8699 }
8700
8701 // node_modules/@base-ui/react/collapsible/index.parts.mjs
8702 var index_parts_exports = {};
8703 __export(index_parts_exports, {
8704 Panel: () => CollapsiblePanel,
8705 Root: () => CollapsibleRoot,
8706 Trigger: () => CollapsibleTrigger
8707 });
8708
8709 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs
8710 var React45 = __toESM(require_react(), 1);
8711
8712 // node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs
8713 var collapsibleStateAttributesMapping = {
8714 ...collapsibleOpenStateMapping,
8715 ...transitionStatusMapping
8716 };
8717
8718 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs
8719 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
8720 var CollapsibleRoot = /* @__PURE__ */ React45.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) {
8721 const {
8722 render: render4,
8723 className,
8724 defaultOpen = false,
8725 disabled: disabled2 = false,
8726 onOpenChange: onOpenChangeProp,
8727 open: open3,
8728 style,
8729 ...elementProps
8730 } = componentProps;
8731 const onOpenChange = useStableCallback(onOpenChangeProp);
8732 const collapsible = useCollapsibleRoot({
8733 open: open3,
8734 defaultOpen,
8735 onOpenChange,
8736 disabled: disabled2
8737 });
8738 const state = React45.useMemo(() => ({
8739 open: collapsible.open,
8740 disabled: collapsible.disabled,
8741 transitionStatus: collapsible.transitionStatus
8742 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);
8743 const contextValue = React45.useMemo(() => ({
8744 ...collapsible,
8745 onOpenChange,
8746 state
8747 }), [collapsible, onOpenChange, state]);
8748 const element = useRenderElement("div", componentProps, {
8749 state,
8750 ref: forwardedRef,
8751 props: elementProps,
8752 stateAttributesMapping: collapsibleStateAttributesMapping
8753 });
8754 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapsibleRootContext.Provider, {
8755 value: contextValue,
8756 children: element
8757 });
8758 });
8759 if (true) CollapsibleRoot.displayName = "CollapsibleRoot";
8760
8761 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs
8762 var React46 = __toESM(require_react(), 1);
8763 var stateAttributesMapping = {
8764 ...triggerOpenStateMapping,
8765 ...transitionStatusMapping
8766 };
8767 var CollapsibleTrigger = /* @__PURE__ */ React46.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) {
8768 const {
8769 panelId,
8770 open: open3,
8771 handleTrigger,
8772 state,
8773 disabled: contextDisabled
8774 } = useCollapsibleRootContext();
8775 const {
8776 className,
8777 disabled: disabled2 = contextDisabled,
8778 render: render4,
8779 nativeButton = true,
8780 style,
8781 ...elementProps
8782 } = componentProps;
8783 const {
8784 getButtonProps,
8785 buttonRef
8786 } = useButton({
8787 disabled: disabled2,
8788 focusableWhenDisabled: true,
8789 native: nativeButton
8790 });
8791 const element = useRenderElement("button", componentProps, {
8792 state,
8793 ref: [forwardedRef, buttonRef],
8794 props: [{
8795 "aria-controls": open3 ? panelId : void 0,
8796 "aria-expanded": open3,
8797 onClick: handleTrigger
8798 }, elementProps, getButtonProps],
8799 stateAttributesMapping
8800 });
8801 return element;
8802 });
8803 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger";
8804
8805 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs
8806 var React47 = __toESM(require_react(), 1);
8807
8808 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs
8809 var collapsiblePanelHeight = "--collapsible-panel-height";
8810 var collapsiblePanelWidth = "--collapsible-panel-width";
8811
8812 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs
8813 var CollapsiblePanel = /* @__PURE__ */ React47.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) {
8814 const {
8815 className,
8816 hiddenUntilFound: hiddenUntilFoundProp,
8817 keepMounted: keepMountedProp,
8818 render: render4,
8819 id: idProp,
8820 style,
8821 ...elementProps
8822 } = componentProps;
8823 if (true) {
8824 React47.useEffect(() => {
8825 if (hiddenUntilFoundProp && keepMountedProp === false) {
8826 warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.");
8827 }
8828 }, [hiddenUntilFoundProp, keepMountedProp]);
8829 }
8830 const {
8831 defaultPanelId,
8832 mounted,
8833 onOpenChange,
8834 open: open3,
8835 setMounted,
8836 setPanelIdState,
8837 setOpen,
8838 state,
8839 transitionStatus
8840 } = useCollapsibleRootContext();
8841 const hiddenUntilFound = hiddenUntilFoundProp ?? false;
8842 const keepMounted = keepMountedProp ?? false;
8843 const registeredId = idProp || void 0;
8844 const id = registeredId ?? defaultPanelId;
8845 useIsoLayoutEffect(() => {
8846 setPanelIdState((currentId) => registeredId ?? (currentId === null ? void 0 : currentId));
8847 return () => {
8848 setPanelIdState((currentId) => currentId === registeredId ? null : currentId);
8849 };
8850 }, [registeredId, setPanelIdState]);
8851 const {
8852 height,
8853 props,
8854 ref,
8855 shouldPreventOpenAnimation,
8856 shouldRender,
8857 transitionStatus: panelTransitionStatus,
8858 width
8859 } = useCollapsiblePanel({
8860 externalRef: forwardedRef,
8861 hiddenUntilFound,
8862 id,
8863 keepMounted,
8864 mounted,
8865 onOpenChange,
8866 open: open3,
8867 setMounted,
8868 setOpen,
8869 transitionStatus
8870 });
8871 const panelState = {
8872 ...state,
8873 transitionStatus: panelTransitionStatus
8874 };
8875 const resolvedStyle = resolveStyle(style, panelState);
8876 const element = useRenderElement("div", {
8877 ...componentProps,
8878 style: void 0
8879 }, {
8880 state: panelState,
8881 ref,
8882 props: [
8883 props,
8884 {
8885 style: {
8886 [collapsiblePanelHeight]: height === void 0 ? "auto" : `${height}px`,
8887 [collapsiblePanelWidth]: width === void 0 ? "auto" : `${width}px`
8888 }
8889 },
8890 elementProps,
8891 resolvedStyle ? {
8892 style: resolvedStyle
8893 } : void 0,
8894 // Resolve the public `style` prop so temporary `animationName: 'none'`
8895 // can still win after user's inline styles have been merged.
8896 shouldPreventOpenAnimation ? {
8897 style: {
8898 animationName: "none"
8899 }
8900 } : void 0
8901 ],
8902 stateAttributesMapping: collapsibleStateAttributesMapping
8903 });
8904 if (!shouldRender) {
8905 return null;
8906 }
8907 return element;
8908 });
8909 if (true) CollapsiblePanel.displayName = "CollapsiblePanel";
8910
8911 // node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs
8912 function useRegisteredLabelId(idProp, setLabelId) {
8913 const id = useBaseUiId(idProp);
8914 useIsoLayoutEffect(() => {
8915 setLabelId(id);
8916 return () => {
8917 setLabelId((currentId) => currentId === id ? void 0 : currentId);
8918 };
8919 }, [id, setLabelId]);
8920 return id;
8921 }
8922
8923 // node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs
8924 function useLabel(params = {}) {
8925 const {
8926 id: idProp,
8927 fallbackControlId,
8928 native = false,
8929 setLabelId: setLabelIdProp,
8930 focusControl: focusControlProp
8931 } = params;
8932 const {
8933 controlId: contextControlId,
8934 setLabelId: setContextLabelId
8935 } = useLabelableContext();
8936 const syncLabelId = useStableCallback((nextLabelId) => {
8937 setContextLabelId(nextLabelId);
8938 setLabelIdProp?.(nextLabelId);
8939 });
8940 const id = useRegisteredLabelId(idProp, syncLabelId);
8941 const resolvedControlId = contextControlId ?? fallbackControlId;
8942 function focusControl(event) {
8943 if (focusControlProp) {
8944 focusControlProp(event, resolvedControlId);
8945 return;
8946 }
8947 if (!resolvedControlId) {
8948 return;
8949 }
8950 const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId);
8951 if (isHTMLElement(controlElement)) {
8952 focusElementWithVisible(controlElement);
8953 }
8954 }
8955 function handleInteraction(event) {
8956 const target = getTarget(event.nativeEvent);
8957 if (target?.closest("button,input,select,textarea")) {
8958 return;
8959 }
8960 if (!event.defaultPrevented && event.detail > 1) {
8961 event.preventDefault();
8962 }
8963 if (native) {
8964 return;
8965 }
8966 focusControl(event);
8967 }
8968 return native ? {
8969 id,
8970 htmlFor: resolvedControlId,
8971 onMouseDown: handleInteraction
8972 } : {
8973 id,
8974 onClick: handleInteraction,
8975 onPointerDown(event) {
8976 event.preventDefault();
8977 }
8978 };
8979 }
8980 function focusElementWithVisible(element) {
8981 element.focus({
8982 // Available from Chrome 144+ (January 2026).
8983 // Safari and Firefox already support it.
8984 focusVisible: true
8985 });
8986 }
8987
8988 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
8989 var React51 = __toESM(require_react(), 1);
8990 var ReactDOM6 = __toESM(require_react_dom(), 1);
8991
8992 // node_modules/@base-ui/utils/usePreviousValue.mjs
8993 var React48 = __toESM(require_react(), 1);
8994 function usePreviousValue(value) {
8995 const [state, setState] = React48.useState({
8996 current: value,
8997 previous: null
8998 });
8999 if (!Object.is(value, state.current)) {
9000 setState({
9001 current: value,
9002 previous: state.current
9003 });
9004 }
9005 return state.previous;
9006 }
9007
9008 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
9009 var React49 = __toESM(require_react(), 1);
9010
9011 // node_modules/@base-ui/react/utils/getCssDimensions.mjs
9012 function getCssDimensions2(element) {
9013 const css = getComputedStyle2(element);
9014 let width = parseFloat(css.width) || 0;
9015 let height = parseFloat(css.height) || 0;
9016 const hasOffset = isHTMLElement(element);
9017 const offsetWidth = hasOffset ? element.offsetWidth : width;
9018 const offsetHeight = hasOffset ? element.offsetHeight : height;
9019 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
9020 if (shouldFallback) {
9021 width = offsetWidth;
9022 height = offsetHeight;
9023 }
9024 return {
9025 width,
9026 height
9027 };
9028 }
9029
9030 // node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs
9031 var popupWidth = "--popup-width";
9032 var popupHeight = "--popup-height";
9033
9034 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
9035 function usePopupAutoResize(parameters) {
9036 const {
9037 popupElement,
9038 positionerElement,
9039 content,
9040 mounted,
9041 onMeasureLayout: onMeasureLayoutParam,
9042 onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
9043 side,
9044 direction
9045 } = parameters;
9046 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true);
9047 const animationFrame = useAnimationFrame();
9048 const committedDimensionsRef = React49.useRef(null);
9049 const isInitialRenderRef = React49.useRef(true);
9050 const restoreAnchoringStylesRef = React49.useRef(NOOP);
9051 const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
9052 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
9053 const anchoringStyles = React49.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]);
9054 useIsoLayoutEffect(() => {
9055 if (!mounted) {
9056 restoreAnchoringStylesRef.current = NOOP;
9057 isInitialRenderRef.current = true;
9058 committedDimensionsRef.current = null;
9059 return void 0;
9060 }
9061 if (!popupElement || !positionerElement) {
9062 return void 0;
9063 }
9064 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
9065 setPopupCssSize(popupElement, "auto");
9066 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
9067 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
9068 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
9069 const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
9070 [availableWidth]: "max-content",
9071 [availableHeight]: "max-content"
9072 });
9073 function restoreMeasurementOverrides() {
9074 restorePopupPosition();
9075 restorePopupTransform();
9076 restorePositionerAvailableSize();
9077 }
9078 function restoreMeasurementOverridesIncludingScale() {
9079 restoreMeasurementOverrides();
9080 restorePopupScale();
9081 }
9082 onMeasureLayout?.();
9083 if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
9084 setPositionerCssSize(positionerElement, "max-content");
9085 const dimensions = getCssDimensions2(popupElement);
9086 committedDimensionsRef.current = dimensions;
9087 setPositionerCssSize(positionerElement, dimensions);
9088 restoreMeasurementOverridesIncludingScale();
9089 onMeasureLayoutComplete?.(null, dimensions);
9090 isInitialRenderRef.current = false;
9091 return () => {
9092 restoreAnchoringStylesRef.current();
9093 restoreAnchoringStylesRef.current = NOOP;
9094 };
9095 }
9096 setPositionerCssSize(positionerElement, "max-content");
9097 const previousDimensions = committedDimensionsRef.current;
9098 const newDimensions = getCssDimensions2(popupElement);
9099 committedDimensionsRef.current = newDimensions;
9100 setPopupCssSize(popupElement, previousDimensions);
9101 restoreMeasurementOverridesIncludingScale();
9102 onMeasureLayoutComplete?.(previousDimensions, newDimensions);
9103 setPositionerCssSize(positionerElement, newDimensions);
9104 const abortController = new AbortController();
9105 animationFrame.request(() => {
9106 setPopupCssSize(popupElement, newDimensions);
9107 runOnceAnimationsFinish(() => {
9108 popupElement.style.setProperty(popupWidth, "auto");
9109 popupElement.style.setProperty(popupHeight, "auto");
9110 }, abortController.signal);
9111 });
9112 return () => {
9113 abortController.abort();
9114 animationFrame.cancel();
9115 restoreAnchoringStylesRef.current();
9116 restoreAnchoringStylesRef.current = NOOP;
9117 };
9118 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
9119 }
9120 function getPopupAnchoringStyles(side, direction) {
9121 const isPhysicalTop = side === "top";
9122 const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start");
9123 if (!isPhysicalTop && !isPhysicalLeft) {
9124 return EMPTY_OBJECT;
9125 }
9126 return {
9127 position: "absolute",
9128 [isPhysicalTop ? "bottom" : "top"]: "0",
9129 [isPhysicalLeft ? "right" : "left"]: "0"
9130 };
9131 }
9132 function overrideElementStyle(element, property, value) {
9133 const originalValue = element.style.getPropertyValue(property);
9134 element.style.setProperty(property, value);
9135 return () => {
9136 element.style.setProperty(property, originalValue);
9137 };
9138 }
9139 function applyElementStyles(element, styles) {
9140 const restorers = [];
9141 for (const [key, value] of Object.entries(styles)) {
9142 restorers.push(overrideElementStyle(element, key, value));
9143 }
9144 return restorers.length ? () => {
9145 restorers.forEach((restore) => restore());
9146 } : NOOP;
9147 }
9148 function setPopupCssSize(popupElement, size4) {
9149 const width = size4 === "auto" ? "auto" : `${size4.width}px`;
9150 const height = size4 === "auto" ? "auto" : `${size4.height}px`;
9151 popupElement.style.setProperty(popupWidth, width);
9152 popupElement.style.setProperty(popupHeight, height);
9153 }
9154 function setPositionerCssSize(positionerElement, size4) {
9155 const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
9156 const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
9157 positionerElement.style.setProperty(positionerWidth, width);
9158 positionerElement.style.setProperty(positionerHeight, height);
9159 }
9160
9161 // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs
9162 var React50 = __toESM(require_react(), 1);
9163 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
9164 var DirectionProvider = function DirectionProvider2(props) {
9165 const {
9166 direction = "ltr"
9167 } = props;
9168 const contextValue = React50.useMemo(() => ({
9169 direction
9170 }), [direction]);
9171 return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DirectionContext.Provider, {
9172 value: contextValue,
9173 children: props.children
9174 });
9175 };
9176 if (true) DirectionProvider.displayName = "DirectionProvider";
9177
9178 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
9179 var adaptiveOrigin = {
9180 name: "adaptiveOrigin",
9181 async fn(state) {
9182 const {
9183 x: rawX,
9184 y: rawY,
9185 rects: {
9186 floating: floatRect
9187 },
9188 elements: {
9189 floating
9190 },
9191 platform: platform3,
9192 strategy,
9193 placement
9194 } = state;
9195 const win = getWindow(floating);
9196 const styles = win.getComputedStyle(floating);
9197 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
9198 if (!hasTransition) {
9199 return {
9200 x: rawX,
9201 y: rawY,
9202 data: DEFAULT_SIDES
9203 };
9204 }
9205 const offsetParent = await platform3.getOffsetParent?.(floating);
9206 let offsetDimensions = {
9207 width: 0,
9208 height: 0
9209 };
9210 if (strategy === "fixed" && win?.visualViewport) {
9211 offsetDimensions = {
9212 width: win.visualViewport.width,
9213 height: win.visualViewport.height
9214 };
9215 } else if (offsetParent === win) {
9216 const doc = ownerDocument(floating);
9217 offsetDimensions = {
9218 width: doc.documentElement.clientWidth,
9219 height: doc.documentElement.clientHeight
9220 };
9221 } else if (await platform3.isElement?.(offsetParent)) {
9222 offsetDimensions = await platform3.getDimensions(offsetParent);
9223 }
9224 const currentSide = getSide(placement);
9225 let x2 = rawX;
9226 let y2 = rawY;
9227 if (currentSide === "left") {
9228 x2 = offsetDimensions.width - (rawX + floatRect.width);
9229 }
9230 if (currentSide === "top") {
9231 y2 = offsetDimensions.height - (rawY + floatRect.height);
9232 }
9233 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
9234 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
9235 return {
9236 x: x2,
9237 y: y2,
9238 data: {
9239 sideX,
9240 sideY
9241 }
9242 };
9243 }
9244 };
9245
9246 // node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs
9247 var activationDirection = "data-activation-direction";
9248
9249 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
9250 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
9251 var popupViewportStateMapping = {
9252 activationDirection: (value) => value ? {
9253 [activationDirection]: value
9254 } : null
9255 };
9256 function usePopupViewport(parameters) {
9257 const {
9258 store,
9259 side,
9260 children
9261 } = parameters;
9262 const direction = useDirection();
9263 const activeTrigger = store.useState("activeTriggerElement");
9264 const activeTriggerId = store.useState("activeTriggerId");
9265 const open3 = store.useState("open");
9266 const payload = store.useState("payload");
9267 const mounted = store.useState("mounted");
9268 const popupElement = store.useState("popupElement");
9269 const positionerElement = store.useState("positionerElement");
9270 const previousActiveTrigger = usePreviousValue(open3 ? activeTrigger : null);
9271 const currentContentKey = usePopupContentKey(activeTriggerId, payload);
9272 const capturedNodeRef = React51.useRef(null);
9273 const [previousContentNode, setPreviousContentNode] = React51.useState(null);
9274 const [newTriggerOffset, setNewTriggerOffset] = React51.useState(null);
9275 const currentContainerRef = React51.useRef(null);
9276 const previousContainerRef = React51.useRef(null);
9277 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true);
9278 const cleanupFrame = useAnimationFrame();
9279 const cleanupControllerRef = React51.useRef(null);
9280 const [previousContentDimensions, setPreviousContentDimensions] = React51.useState(null);
9281 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React51.useState(false);
9282 useIsoLayoutEffect(() => {
9283 store.set("adaptiveOrigin", adaptiveOrigin);
9284 return () => {
9285 store.set("adaptiveOrigin", void 0);
9286 };
9287 }, [store]);
9288 const handleMeasureLayout = useStableCallback(() => {
9289 currentContainerRef.current?.style.setProperty("animation", "none");
9290 currentContainerRef.current?.style.setProperty("transition", "none");
9291 previousContainerRef.current?.style.setProperty("display", "none");
9292 });
9293 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
9294 currentContainerRef.current?.style.removeProperty("animation");
9295 currentContainerRef.current?.style.removeProperty("transition");
9296 previousContainerRef.current?.style.removeProperty("display");
9297 if (previousDimensions) {
9298 setPreviousContentDimensions(previousDimensions);
9299 }
9300 });
9301 const armViewportCleanup = useStableCallback(() => {
9302 cleanupControllerRef.current?.abort();
9303 const controller = new AbortController();
9304 cleanupControllerRef.current = controller;
9305 onAnimationsFinished(() => {
9306 setPreviousContentNode(null);
9307 setPreviousContentDimensions(null);
9308 capturedNodeRef.current = null;
9309 }, controller.signal);
9310 });
9311 const lastHandledTriggerRef = React51.useRef(null);
9312 useIsoLayoutEffect(() => {
9313 if (!open3 || !mounted) {
9314 lastHandledTriggerRef.current = null;
9315 }
9316 }, [open3, mounted]);
9317 useIsoLayoutEffect(() => {
9318 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
9319 setPreviousContentNode(capturedNodeRef.current);
9320 setShowStartingStyleAttribute(true);
9321 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
9322 setNewTriggerOffset(offset4);
9323 lastHandledTriggerRef.current = activeTrigger;
9324 }
9325 }, [activeTrigger, previousActiveTrigger]);
9326 useIsoLayoutEffect(() => {
9327 if (previousContentNode == null) {
9328 return;
9329 }
9330 cleanupControllerRef.current?.abort();
9331 setShowStartingStyleAttribute(true);
9332 cleanupFrame.request(() => {
9333 ReactDOM6.flushSync(() => {
9334 setShowStartingStyleAttribute(false);
9335 });
9336 armViewportCleanup();
9337 });
9338 }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]);
9339 useIsoLayoutEffect(() => {
9340 const source = currentContainerRef.current;
9341 if (!source) {
9342 return;
9343 }
9344 const wrapper = ownerDocument(source).createElement("div");
9345 for (const child of Array.from(source.childNodes)) {
9346 wrapper.appendChild(child.cloneNode(true));
9347 }
9348 capturedNodeRef.current = wrapper;
9349 });
9350 const isTransitioning = previousContentNode != null;
9351 let childrenToRender;
9352 if (!isTransitioning) {
9353 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9354 "data-current": true,
9355 ref: currentContainerRef,
9356 children
9357 }, currentContentKey);
9358 } else {
9359 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React51.Fragment, {
9360 children: [/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9361 "data-previous": true,
9362 inert: inertValue(true),
9363 ref: previousContainerRef,
9364 style: {
9365 ...previousContentDimensions ? {
9366 [popupWidth]: `${previousContentDimensions.width}px`,
9367 [popupHeight]: `${previousContentDimensions.height}px`
9368 } : null,
9369 position: "absolute"
9370 },
9371 "data-ending-style": showStartingStyleAttribute ? void 0 : ""
9372 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9373 "data-current": true,
9374 ref: currentContainerRef,
9375 "data-starting-style": showStartingStyleAttribute ? "" : void 0,
9376 children
9377 }, currentContentKey)]
9378 });
9379 }
9380 useIsoLayoutEffect(() => {
9381 const container = previousContainerRef.current;
9382 if (!container || !previousContentNode) {
9383 return;
9384 }
9385 container.replaceChildren(...Array.from(previousContentNode.childNodes));
9386 }, [previousContentNode]);
9387 usePopupAutoResize({
9388 popupElement,
9389 positionerElement,
9390 mounted,
9391 content: payload,
9392 onMeasureLayout: handleMeasureLayout,
9393 onMeasureLayoutComplete: handleMeasureLayoutComplete,
9394 side,
9395 direction
9396 });
9397 const state = {
9398 activationDirection: getActivationDirection(newTriggerOffset),
9399 transitioning: isTransitioning
9400 };
9401 return {
9402 children: childrenToRender,
9403 state
9404 };
9405 }
9406 function getActivationDirection(offset4) {
9407 if (!offset4) {
9408 return void 0;
9409 }
9410 return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
9411 }
9412 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
9413 if (value > tolerance) {
9414 return positiveLabel;
9415 }
9416 if (value < -tolerance) {
9417 return negativeLabel;
9418 }
9419 return "";
9420 }
9421 function calculateRelativePosition(from, to2) {
9422 const fromRect = from.getBoundingClientRect();
9423 const toRect = to2.getBoundingClientRect();
9424 const fromCenter = {
9425 x: fromRect.left + fromRect.width / 2,
9426 y: fromRect.top + fromRect.height / 2
9427 };
9428 const toCenter = {
9429 x: toRect.left + toRect.width / 2,
9430 y: toRect.top + toRect.height / 2
9431 };
9432 return {
9433 horizontal: toCenter.x - fromCenter.x,
9434 vertical: toCenter.y - fromCenter.y
9435 };
9436 }
9437 function usePopupContentKey(activeTriggerId, payload) {
9438 const [contentKey, setContentKey] = React51.useState(0);
9439 const previousActiveTriggerIdRef = React51.useRef(activeTriggerId);
9440 const previousPayloadRef = React51.useRef(payload);
9441 const pendingPayloadUpdateRef = React51.useRef(false);
9442 useIsoLayoutEffect(() => {
9443 const previousActiveTriggerId = previousActiveTriggerIdRef.current;
9444 const previousPayload = previousPayloadRef.current;
9445 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
9446 const payloadChanged = payload !== previousPayload;
9447 if (triggerIdChanged) {
9448 setContentKey((value) => value + 1);
9449 pendingPayloadUpdateRef.current = !payloadChanged;
9450 } else if (pendingPayloadUpdateRef.current && payloadChanged) {
9451 setContentKey((value) => value + 1);
9452 pendingPayloadUpdateRef.current = false;
9453 }
9454 previousActiveTriggerIdRef.current = activeTriggerId;
9455 previousPayloadRef.current = payload;
9456 }, [activeTriggerId, payload]);
9457 return `${activeTriggerId ?? "current"}-${contentKey}`;
9458 }
9459
9460 // node_modules/@base-ui/react/field/index.parts.mjs
9461 var index_parts_exports2 = {};
9462 __export(index_parts_exports2, {
9463 Control: () => FieldControl,
9464 Description: () => FieldDescription,
9465 Error: () => FieldError,
9466 Item: () => FieldItem,
9467 Label: () => FieldLabel,
9468 Root: () => FieldRoot,
9469 Validity: () => FieldValidity
9470 });
9471
9472 // node_modules/@base-ui/react/field/root/FieldRoot.mjs
9473 var React55 = __toESM(require_react(), 1);
9474
9475 // node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs
9476 var React52 = __toESM(require_react(), 1);
9477 var FieldsetRootContext = /* @__PURE__ */ React52.createContext(void 0);
9478 if (true) FieldsetRootContext.displayName = "FieldsetRootContext";
9479 function useFieldsetRootContext(optional = false) {
9480 const context = React52.useContext(FieldsetRootContext);
9481 if (!context && !optional) {
9482 throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86));
9483 }
9484 return context;
9485 }
9486
9487 // node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs
9488 var React53 = __toESM(require_react(), 1);
9489 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
9490 var LabelableProvider = function LabelableProvider2(props) {
9491 const defaultId = useBaseUiId();
9492 const [controlIdState, setControlIdState] = React53.useState(defaultId);
9493 const [labelId, setLabelId] = React53.useState();
9494 const [messageIds, setMessageIds] = React53.useState([]);
9495 const controlId = controlIdState === void 0 ? defaultId : controlIdState;
9496 const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map());
9497 const {
9498 messageIds: parentMessageIds
9499 } = useLabelableContext();
9500 const registerControlId = useStableCallback((source, nextId2) => {
9501 const registrations = registrationsRef.current;
9502 if (nextId2 === void 0) {
9503 registrations.delete(source);
9504 } else {
9505 registrations.set(source, nextId2);
9506 }
9507 setControlIdState((prev) => {
9508 if (registrations.size === 0) {
9509 return prev;
9510 }
9511 let nextControlId;
9512 for (const id of registrations.values()) {
9513 if (id === prev) {
9514 return prev;
9515 }
9516 if (nextControlId === void 0) {
9517 nextControlId = id;
9518 }
9519 }
9520 return nextControlId;
9521 });
9522 });
9523 const resetControlId = useStableCallback(() => {
9524 if (registrationsRef.current.size === 0) {
9525 setControlIdState(defaultId);
9526 }
9527 });
9528 const getDescriptionProps = React53.useCallback((externalProps) => {
9529 const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : [];
9530 ids.push(...parentMessageIds, ...messageIds);
9531 return {
9532 ...externalProps,
9533 "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0
9534 };
9535 }, [parentMessageIds, messageIds]);
9536 const contextValue = React53.useMemo(() => ({
9537 controlId,
9538 registerControlId,
9539 resetControlId,
9540 labelId,
9541 setLabelId,
9542 messageIds,
9543 setMessageIds,
9544 getDescriptionProps
9545 }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]);
9546 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LabelableContext.Provider, {
9547 value: contextValue,
9548 children: props.children
9549 });
9550 };
9551 if (true) LabelableProvider.displayName = "LabelableProvider";
9552
9553 // node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs
9554 var React54 = __toESM(require_react(), 1);
9555 function useFieldControlRegistration(params) {
9556 const {
9557 change,
9558 commit,
9559 invalid: invalid2,
9560 markedDirtyRef,
9561 name,
9562 setRegisteredFieldName,
9563 registeredFieldIdRef,
9564 setValidityData,
9565 validityData
9566 } = params;
9567 const {
9568 formRef
9569 } = useFormContext();
9570 const activeFieldControlSourceRef = React54.useRef(null);
9571 const registrationRef = React54.useRef(null);
9572 const initialValueCapturedRef = React54.useRef(false);
9573 const getValueForForm = useStableCallback(() => {
9574 const registration = registrationRef.current;
9575 if (!registration) {
9576 return void 0;
9577 }
9578 if (registration.getValue) {
9579 return registration.getValue();
9580 }
9581 return registration.value;
9582 });
9583 function getRegistrationValue(registration) {
9584 return registration.value === void 0 ? getValueForForm() : registration.value;
9585 }
9586 const validate = useStableCallback(() => {
9587 const registration = registrationRef.current;
9588 markedDirtyRef.current = true;
9589 if (!registration) {
9590 commit(validityData.value);
9591 return;
9592 }
9593 commit(getRegistrationValue(registration));
9594 });
9595 function refreshRegistration() {
9596 const registration = registrationRef.current;
9597 if (!registration || !registration.id) {
9598 return;
9599 }
9600 formRef.current.fields.set(registration.id, {
9601 getValue: getValueForForm,
9602 name: name ?? registration.name,
9603 controlRef: registration.controlRef,
9604 validityData: getCombinedFieldValidityData(validityData, invalid2),
9605 validate
9606 });
9607 }
9608 function deleteRegistration(id = registrationRef.current?.id) {
9609 if (id) {
9610 formRef.current.fields.delete(id);
9611 }
9612 }
9613 function captureInitialValue(registration) {
9614 if (initialValueCapturedRef.current) {
9615 return;
9616 }
9617 initialValueCapturedRef.current = true;
9618 const initialValue = getRegistrationValue(registration);
9619 setValidityData((prev) => prev.initialValue === initialValue ? prev : {
9620 ...prev,
9621 initialValue
9622 });
9623 }
9624 useIsoLayoutEffect(() => {
9625 const registration = registrationRef.current;
9626 if (!registration || !registration.id) {
9627 return;
9628 }
9629 setRegisteredFieldName(name ? void 0 : registration.name);
9630 formRef.current.fields.set(registration.id, {
9631 getValue: getValueForForm,
9632 name: name ?? registration.name,
9633 controlRef: registration.controlRef,
9634 validityData: getCombinedFieldValidityData(validityData, invalid2),
9635 validate
9636 });
9637 }, [formRef, getValueForForm, invalid2, name, setRegisteredFieldName, validate, validityData]);
9638 useIsoLayoutEffect(() => {
9639 const fields2 = formRef.current.fields;
9640 return () => {
9641 const id = registrationRef.current?.id;
9642 if (id) {
9643 fields2.delete(id);
9644 }
9645 };
9646 }, [formRef]);
9647 const register2 = useStableCallback((source, registration) => {
9648 if (!registration) {
9649 if (activeFieldControlSourceRef.current === source) {
9650 activeFieldControlSourceRef.current = null;
9651 change(void 0, true);
9652 deleteRegistration();
9653 registrationRef.current = null;
9654 setRegisteredFieldName(void 0);
9655 registeredFieldIdRef.current = void 0;
9656 }
9657 return;
9658 }
9659 const previousId = registrationRef.current?.id;
9660 const previousSource = activeFieldControlSourceRef.current;
9661 if (previousSource && previousSource !== source) {
9662 change(void 0, true);
9663 }
9664 activeFieldControlSourceRef.current = source;
9665 registrationRef.current = registration;
9666 if (!name) {
9667 setRegisteredFieldName(registration.name);
9668 }
9669 registeredFieldIdRef.current = registration.id;
9670 if (previousId && previousId !== registration.id) {
9671 deleteRegistration(previousId);
9672 }
9673 captureInitialValue(registration);
9674 refreshRegistration();
9675 });
9676 return [validate, register2];
9677 }
9678
9679 // node_modules/@base-ui/react/field/root/FieldRoot.mjs
9680 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
9681 var FieldRootInner = /* @__PURE__ */ React55.forwardRef(function FieldRootInner2(componentProps, forwardedRef) {
9682 const {
9683 errors,
9684 validationMode: formValidationMode,
9685 submitCountRef
9686 } = useFormContext();
9687 const {
9688 render: render4,
9689 className,
9690 validate: validateProp,
9691 validationDebounceTime = 0,
9692 validationMode = formValidationMode,
9693 name,
9694 disabled: disabledProp = false,
9695 invalid: invalidProp,
9696 dirty: dirtyProp,
9697 touched: touchedProp,
9698 actionsRef,
9699 style,
9700 ...elementProps
9701 } = componentProps;
9702 const disabledFieldset = useFieldsetRootContext(true)?.disabled;
9703 const validate = useStableCallback(validateProp || (() => null));
9704 const disabled2 = disabledFieldset || disabledProp;
9705 const [touchedState, setTouchedUnwrapped] = React55.useState(false);
9706 const [dirtyState, setDirtyUnwrapped] = React55.useState(false);
9707 const [filled, setFilled] = React55.useState(false);
9708 const [focused, setFocused] = React55.useState(false);
9709 const dirty = dirtyProp ?? dirtyState;
9710 const touched = touchedProp ?? touchedState;
9711 const markedDirtyRef = React55.useRef(dirty);
9712 const registeredFieldIdRef = React55.useRef(void 0);
9713 const [registeredFieldName, setRegisteredFieldName] = React55.useState();
9714 const effectiveName = name ?? registeredFieldName;
9715 useIsoLayoutEffect(() => {
9716 if (dirtyProp !== void 0) {
9717 markedDirtyRef.current = dirtyProp;
9718 }
9719 }, [dirtyProp]);
9720 const setDirty = useStableCallback((value) => {
9721 if (dirtyProp !== void 0) {
9722 return;
9723 }
9724 if (value) {
9725 markedDirtyRef.current = true;
9726 }
9727 setDirtyUnwrapped(value);
9728 });
9729 const setTouched = useStableCallback((value) => {
9730 if (touchedProp !== void 0) {
9731 return;
9732 }
9733 setTouchedUnwrapped(value);
9734 });
9735 const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0);
9736 const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null;
9737 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
9738 const invalid2 = invalidProp === true || hasFormError;
9739 const [validityData, setValidityData] = React55.useState({
9740 state: DEFAULT_VALIDITY_STATE,
9741 error: "",
9742 errors: [],
9743 value: null,
9744 initialValue: null
9745 });
9746 const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid);
9747 const state = React55.useMemo(() => ({
9748 disabled: disabled2,
9749 touched,
9750 dirty,
9751 valid: valid2,
9752 filled,
9753 focused
9754 }), [disabled2, touched, dirty, valid2, filled, focused]);
9755 const validation = useFieldValidation({
9756 setValidityData,
9757 validate,
9758 validityData,
9759 validationDebounceTime,
9760 invalid: invalid2,
9761 markedDirtyRef,
9762 state,
9763 shouldValidateOnChange,
9764 validationMode,
9765 registeredFieldIdRef
9766 });
9767 const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({
9768 change: validation.change,
9769 commit: validation.commit,
9770 invalid: invalid2,
9771 markedDirtyRef,
9772 name,
9773 setRegisteredFieldName,
9774 registeredFieldIdRef,
9775 setValidityData,
9776 validityData
9777 });
9778 React55.useImperativeHandle(actionsRef, () => ({
9779 validate: validateFieldControl
9780 }), [validateFieldControl]);
9781 const contextValue = React55.useMemo(() => ({
9782 invalid: invalid2,
9783 name: effectiveName,
9784 validityData,
9785 setValidityData,
9786 disabled: disabled2,
9787 setTouched,
9788 setDirty,
9789 setFilled,
9790 setFocused,
9791 validationMode,
9792 shouldValidateOnChange,
9793 state,
9794 registerFieldControl,
9795 validation
9796 }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]);
9797 const element = useRenderElement("div", componentProps, {
9798 ref: forwardedRef,
9799 state,
9800 props: elementProps,
9801 stateAttributesMapping: fieldValidityMapping
9802 });
9803 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldRootContext.Provider, {
9804 value: contextValue,
9805 children: element
9806 });
9807 });
9808 if (true) FieldRootInner.displayName = "FieldRootInner";
9809 var FieldRoot = /* @__PURE__ */ React55.forwardRef(function FieldRoot2(componentProps, forwardedRef) {
9810 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelableProvider, {
9811 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldRootInner, {
9812 ...componentProps,
9813 ref: forwardedRef
9814 })
9815 });
9816 });
9817 if (true) FieldRoot.displayName = "FieldRoot";
9818
9819 // node_modules/@base-ui/react/field/label/FieldLabel.mjs
9820 var React56 = __toESM(require_react(), 1);
9821 var FieldLabel = /* @__PURE__ */ React56.forwardRef(function FieldLabel2(componentProps, forwardedRef) {
9822 const {
9823 render: render4,
9824 className,
9825 style,
9826 id: idProp,
9827 nativeLabel = true,
9828 ...elementProps
9829 } = componentProps;
9830 const fieldRootContext = useFieldRootContext(false);
9831 const fieldItemContext = useFieldItemContext();
9832 const {
9833 labelId
9834 } = useLabelableContext();
9835 const state = {
9836 ...fieldRootContext.state,
9837 disabled: fieldRootContext.disabled || fieldItemContext.disabled
9838 };
9839 const labelRef = React56.useRef(null);
9840 const labelProps = useLabel({
9841 id: labelId ?? idProp,
9842 native: nativeLabel
9843 });
9844 if (true) {
9845 React56.useEffect(() => {
9846 if (!labelRef.current) {
9847 return;
9848 }
9849 const isLabelTag = labelRef.current.tagName === "LABEL";
9850 if (nativeLabel) {
9851 if (!isLabelTag) {
9852 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
9853 const message2 = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`.";
9854 error(`${message2}${ownerStackMessage}`);
9855 }
9856 } else if (isLabelTag) {
9857 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
9858 const message2 = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`.";
9859 error(`${message2}${ownerStackMessage}`);
9860 }
9861 }, [nativeLabel]);
9862 }
9863 const element = useRenderElement("label", componentProps, {
9864 ref: [forwardedRef, labelRef],
9865 state,
9866 props: [labelProps, elementProps],
9867 stateAttributesMapping: fieldValidityMapping
9868 });
9869 return element;
9870 });
9871 if (true) FieldLabel.displayName = "FieldLabel";
9872
9873 // node_modules/@base-ui/react/field/error/FieldError.mjs
9874 var React57 = __toESM(require_react(), 1);
9875 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
9876 var stateAttributesMapping2 = {
9877 ...fieldValidityMapping,
9878 ...transitionStatusMapping
9879 };
9880 var FieldError = /* @__PURE__ */ React57.forwardRef(function FieldError2(componentProps, forwardedRef) {
9881 const {
9882 render: render4,
9883 id: idProp,
9884 className,
9885 match: match2,
9886 style,
9887 ...elementProps
9888 } = componentProps;
9889 const id = useBaseUiId(idProp);
9890 const {
9891 validityData,
9892 state: fieldState,
9893 name
9894 } = useFieldRootContext(false);
9895 const {
9896 setMessageIds
9897 } = useLabelableContext();
9898 const {
9899 errors
9900 } = useFormContext();
9901 const formError = name && Object.hasOwn(errors, name) ? errors[name] : null;
9902 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
9903 const hasSpecificMatch = typeof match2 === "string";
9904 let rendered = false;
9905 if (match2 === true) {
9906 rendered = true;
9907 } else if (fieldState.disabled) {
9908 rendered = false;
9909 } else if (hasSpecificMatch) {
9910 rendered = Boolean(validityData.state[match2]);
9911 } else {
9912 rendered = hasFormError || validityData.state.valid === false;
9913 }
9914 const {
9915 mounted,
9916 transitionStatus,
9917 setMounted
9918 } = useTransitionStatus(rendered);
9919 useIsoLayoutEffect(() => {
9920 if (!rendered || !id) {
9921 return void 0;
9922 }
9923 setMessageIds((v2) => v2.concat(id));
9924 return () => {
9925 setMessageIds((v2) => v2.filter((item) => item !== id));
9926 };
9927 }, [rendered, id, setMessageIds]);
9928 const errorRef = React57.useRef(null);
9929 const [lastRenderedMessage, setLastRenderedMessage] = React57.useState(null);
9930 const [lastRenderedMessageKey, setLastRenderedMessageKey] = React57.useState(null);
9931 let error2 = validityData.error;
9932 if (!hasSpecificMatch && hasFormError) {
9933 error2 = formError;
9934 } else if (validityData.errors.length > 1) {
9935 error2 = validityData.errors;
9936 }
9937 let errorMessage = error2;
9938 if (Array.isArray(error2)) {
9939 errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", {
9940 children: error2.map((message2) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", {
9941 children: message2
9942 }, message2))
9943 }) : error2[0];
9944 }
9945 const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2;
9946 if (rendered && errorKey !== lastRenderedMessageKey) {
9947 setLastRenderedMessageKey(errorKey);
9948 setLastRenderedMessage(errorMessage);
9949 }
9950 useOpenChangeComplete({
9951 open: rendered,
9952 ref: errorRef,
9953 onComplete() {
9954 if (!rendered) {
9955 setMounted(false);
9956 }
9957 }
9958 });
9959 const state = {
9960 ...fieldState,
9961 transitionStatus
9962 };
9963 const element = useRenderElement("div", componentProps, {
9964 ref: [forwardedRef, errorRef],
9965 state,
9966 props: [{
9967 id,
9968 children: rendered ? errorMessage : lastRenderedMessage
9969 }, elementProps],
9970 stateAttributesMapping: stateAttributesMapping2,
9971 enabled: mounted
9972 });
9973 if (!mounted) {
9974 return null;
9975 }
9976 return element;
9977 });
9978 if (true) FieldError.displayName = "FieldError";
9979
9980 // node_modules/@base-ui/react/field/description/FieldDescription.mjs
9981 var React58 = __toESM(require_react(), 1);
9982 var FieldDescription = /* @__PURE__ */ React58.forwardRef(function FieldDescription2(componentProps, forwardedRef) {
9983 const {
9984 render: render4,
9985 id: idProp,
9986 className,
9987 style,
9988 ...elementProps
9989 } = componentProps;
9990 const id = useBaseUiId(idProp);
9991 const fieldRootContext = useFieldRootContext(false);
9992 const fieldItemContext = useFieldItemContext();
9993 const {
9994 setMessageIds
9995 } = useLabelableContext();
9996 const state = {
9997 ...fieldRootContext.state,
9998 disabled: fieldRootContext.disabled || fieldItemContext.disabled
9999 };
10000 useIsoLayoutEffect(() => {
10001 if (!id) {
10002 return void 0;
10003 }
10004 setMessageIds((v2) => v2.concat(id));
10005 return () => {
10006 setMessageIds((v2) => v2.filter((item) => item !== id));
10007 };
10008 }, [id, setMessageIds]);
10009 const element = useRenderElement("p", componentProps, {
10010 ref: forwardedRef,
10011 state,
10012 props: [{
10013 id
10014 }, elementProps],
10015 stateAttributesMapping: fieldValidityMapping
10016 });
10017 return element;
10018 });
10019 if (true) FieldDescription.displayName = "FieldDescription";
10020
10021 // node_modules/@base-ui/react/field/control/FieldControl.mjs
10022 var React59 = __toESM(require_react(), 1);
10023 var FieldControl = /* @__PURE__ */ React59.forwardRef(function FieldControl2(componentProps, forwardedRef) {
10024 const {
10025 render: render4,
10026 className,
10027 id: idProp,
10028 name: nameProp,
10029 value: valueProp,
10030 disabled: disabledProp = false,
10031 onValueChange,
10032 defaultValue,
10033 autoFocus = false,
10034 style,
10035 ...elementProps
10036 } = componentProps;
10037 const {
10038 state: fieldState,
10039 name: fieldName,
10040 disabled: fieldDisabled,
10041 setTouched,
10042 setDirty,
10043 validityData,
10044 setFocused,
10045 setFilled,
10046 validationMode,
10047 validation
10048 } = useFieldRootContext();
10049 const {
10050 clearErrors,
10051 elementRef: formElementRef,
10052 submitCountRef
10053 } = useFormContext();
10054 const disabled2 = fieldDisabled || disabledProp;
10055 const name = fieldName ?? nameProp;
10056 const state = {
10057 ...fieldState,
10058 disabled: disabled2
10059 };
10060 const {
10061 labelId
10062 } = useLabelableContext();
10063 const id = useLabelableId({
10064 id: idProp
10065 });
10066 const [valueUnwrapped] = useControlled({
10067 controlled: valueProp,
10068 default: defaultValue,
10069 name: "FieldControl",
10070 state: "value"
10071 });
10072 const isControlled = valueProp !== void 0;
10073 const value = isControlled ? valueUnwrapped : void 0;
10074 const serializedValue = value == null ? void 0 : String(value);
10075 const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
10076 useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp);
10077 useIsoLayoutEffect(() => {
10078 const currentValue = serializedValue ?? validation.inputRef.current?.value;
10079 if (currentValue !== void 0) {
10080 setFilled(currentValue !== "");
10081 }
10082 }, [serializedValue, validation.inputRef, setFilled]);
10083 useValueChanged(serializedValue, () => {
10084 if (serializedValue === void 0) {
10085 return;
10086 }
10087 clearErrors(name);
10088 setDirty(serializedValue !== (validityData.initialValue ?? ""));
10089 validation.change(serializedValue);
10090 });
10091 const inputRef = React59.useRef(null);
10092 const enterValidationTimeout = useTimeout();
10093 useIsoLayoutEffect(() => {
10094 if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {
10095 setFocused(true);
10096 }
10097 }, [autoFocus, setFocused]);
10098 const element = useRenderElement("input", componentProps, {
10099 ref: [forwardedRef, inputRef],
10100 state,
10101 props: [{
10102 id,
10103 disabled: disabled2,
10104 name,
10105 ref: validation.inputRef,
10106 "aria-labelledby": labelId,
10107 autoFocus,
10108 ...isControlled ? {
10109 value
10110 } : {
10111 defaultValue
10112 },
10113 onChange(event) {
10114 const inputValue = event.currentTarget.value;
10115 const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent);
10116 onValueChange?.(inputValue, details);
10117 if (isControlled) {
10118 return;
10119 }
10120 setDirty(inputValue !== (validityData.initialValue ?? ""));
10121 setFilled(inputValue !== "");
10122 if (!event.nativeEvent.defaultPrevented && !details.isCanceled) {
10123 clearErrors(name);
10124 validation.change(inputValue);
10125 }
10126 },
10127 onFocus() {
10128 setFocused(true);
10129 },
10130 onBlur(event) {
10131 setTouched(true);
10132 setFocused(false);
10133 if (validationMode === "onBlur") {
10134 const inputValue = event.currentTarget.value;
10135 validation.commit(inputValue);
10136 if (isControlled) {
10137 queueMicrotask(() => {
10138 const nextValue = validation.inputRef.current?.value;
10139 if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) {
10140 validation.commit(nextValue);
10141 }
10142 });
10143 }
10144 }
10145 },
10146 onKeyDown(event) {
10147 if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
10148 setTouched(true);
10149 const value2 = event.currentTarget.value;
10150 const form = event.currentTarget.form;
10151 if (form && form === formElementRef.current && !event.defaultPrevented) {
10152 const input = event.currentTarget;
10153 const submitCount = submitCountRef.current;
10154 enterValidationTimeout.start(0, () => {
10155 if (submitCountRef.current === submitCount) {
10156 validation.commit(input.value);
10157 }
10158 });
10159 } else {
10160 validation.commit(value2);
10161 }
10162 }
10163 }
10164 }, elementProps, (props) => validation.getValidationProps(disabled2, props)],
10165 stateAttributesMapping: fieldValidityMapping
10166 });
10167 return element;
10168 });
10169 if (true) FieldControl.displayName = "FieldControl";
10170
10171 // node_modules/@base-ui/react/field/validity/FieldValidity.mjs
10172 var React60 = __toESM(require_react(), 1);
10173 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
10174 var FieldValidity = function FieldValidity2(props) {
10175 const {
10176 children
10177 } = props;
10178 const {
10179 validityData,
10180 invalid: invalid2
10181 } = useFieldRootContext(false);
10182 const combinedFieldValidityData = React60.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]);
10183 const isInvalid = combinedFieldValidityData.state.valid === false;
10184 const {
10185 transitionStatus
10186 } = useTransitionStatus(isInvalid);
10187 const fieldValidityState = React60.useMemo(() => {
10188 return {
10189 ...combinedFieldValidityData,
10190 validity: combinedFieldValidityData.state,
10191 transitionStatus
10192 };
10193 }, [combinedFieldValidityData, transitionStatus]);
10194 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(React60.Fragment, {
10195 children: children(fieldValidityState)
10196 });
10197 };
10198 if (true) FieldValidity.displayName = "FieldValidity";
10199
10200 // node_modules/@base-ui/react/field/item/FieldItem.mjs
10201 var React61 = __toESM(require_react(), 1);
10202 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
10203 var FieldItem = /* @__PURE__ */ React61.forwardRef(function FieldItem2(componentProps, forwardedRef) {
10204 const {
10205 render: render4,
10206 className,
10207 style,
10208 disabled: disabledProp = false,
10209 ...elementProps
10210 } = componentProps;
10211 const {
10212 state: fieldState,
10213 disabled: rootDisabled
10214 } = useFieldRootContext(false);
10215 const disabled2 = rootDisabled || disabledProp;
10216 const state = {
10217 ...fieldState,
10218 disabled: disabled2
10219 };
10220 const fieldItemContext = React61.useMemo(() => ({
10221 disabled: disabled2
10222 }), [disabled2]);
10223 const element = useRenderElement("div", componentProps, {
10224 ref: forwardedRef,
10225 state,
10226 props: elementProps,
10227 stateAttributesMapping: fieldValidityMapping
10228 });
10229 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LabelableProvider, {
10230 children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldItemContext.Provider, {
10231 value: fieldItemContext,
10232 children: element
10233 })
10234 });
10235 });
10236 if (true) FieldItem.displayName = "FieldItem";
10237
10238 // node_modules/@base-ui/react/input/Input.mjs
10239 var React62 = __toESM(require_react(), 1);
10240 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
10241 var Input = /* @__PURE__ */ React62.forwardRef(function Input2(props, forwardedRef) {
10242 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(index_parts_exports2.Control, {
10243 ref: forwardedRef,
10244 ...props
10245 });
10246 });
10247 if (true) Input.displayName = "Input";
10248
10249 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
10250 var React63 = __toESM(require_react(), 1);
10251 var ReactDOM7 = __toESM(require_react_dom(), 1);
10252 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
10253 var FloatingPortalLite = /* @__PURE__ */ React63.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
10254 const {
10255 children,
10256 container,
10257 className,
10258 render: render4,
10259 style,
10260 ...elementProps
10261 } = componentProps;
10262 const {
10263 node: portalNode,
10264 subtree: portalSubtree
10265 } = useFloatingPortalNode({
10266 container,
10267 ref: forwardedRef,
10268 componentProps,
10269 elementProps
10270 });
10271 if (!portalSubtree && !portalNode) {
10272 return null;
10273 }
10274 return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(React63.Fragment, {
10275 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)]
10276 });
10277 });
10278 if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
10279
10280 // node_modules/@base-ui/react/tooltip/index.parts.mjs
10281 var index_parts_exports3 = {};
10282 __export(index_parts_exports3, {
10283 Arrow: () => TooltipArrow,
10284 Handle: () => TooltipHandle,
10285 Popup: () => TooltipPopup,
10286 Portal: () => TooltipPortal,
10287 Positioner: () => TooltipPositioner,
10288 Provider: () => TooltipProvider,
10289 Root: () => TooltipRoot,
10290 Trigger: () => TooltipTrigger,
10291 Viewport: () => TooltipViewport,
10292 createHandle: () => createTooltipHandle
10293 });
10294
10295 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
10296 var React66 = __toESM(require_react(), 1);
10297
10298 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
10299 var React64 = __toESM(require_react(), 1);
10300 var TooltipRootContext = /* @__PURE__ */ React64.createContext(void 0);
10301 if (true) TooltipRootContext.displayName = "TooltipRootContext";
10302 function useTooltipRootContext(optional) {
10303 const context = React64.useContext(TooltipRootContext);
10304 if (context === void 0 && !optional) {
10305 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
10306 }
10307 return context;
10308 }
10309
10310 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
10311 var React65 = __toESM(require_react(), 1);
10312 var selectors2 = {
10313 ...popupStoreSelectors,
10314 disabled: (state) => state.disabled,
10315 instantType: (state) => state.instantType,
10316 isInstantPhase: (state) => state.isInstantPhase,
10317 trackCursorAxis: (state) => state.trackCursorAxis,
10318 disableHoverablePopup: (state) => state.disableHoverablePopup,
10319 lastOpenChangeReason: (state) => state.openChangeReason,
10320 closeOnClick: (state) => state.closeOnClick,
10321 closeDelay: (state) => state.closeDelay,
10322 adaptiveOrigin: (state) => state.adaptiveOrigin
10323 };
10324 var TooltipStore = class extends ReactStore {
10325 constructor(initialState, floatingId, nested) {
10326 const triggerElements = new PopupTriggerMap();
10327 super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2);
10328 }
10329 setOpen = (nextOpen, eventDetails) => {
10330 applyPopupOpenChange(this, nextOpen, eventDetails, {
10331 extraState: {
10332 openChangeReason: eventDetails.reason
10333 }
10334 });
10335 };
10336 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
10337 cancelPendingOpen(event) {
10338 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
10339 }
10340 };
10341 function createNullTooltipStore() {
10342 const triggerElements = new PopupTriggerMap();
10343 const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2);
10344 return Object.assign(store, {
10345 setOpen: NOOP,
10346 cancelPendingOpen: NOOP
10347 });
10348 }
10349 function createInitialState(initialState, triggerElements, floatingId, nested = false) {
10350 const state = {
10351 ...createInitialPopupStoreState(triggerElements, floatingId, nested),
10352 disabled: false,
10353 instantType: void 0,
10354 isInstantPhase: false,
10355 trackCursorAxis: "none",
10356 disableHoverablePopup: false,
10357 openChangeReason: null,
10358 closeOnClick: true,
10359 closeDelay: 0,
10360 adaptiveOrigin: void 0,
10361 ...initialState
10362 };
10363 return state;
10364 }
10365 function createInitialContext(triggerElements) {
10366 return {
10367 popupRef: /* @__PURE__ */ React65.createRef(),
10368 onOpenChange: void 0,
10369 onOpenChangeComplete: void 0,
10370 triggerElements
10371 };
10372 }
10373
10374 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
10375 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
10376 var TooltipRoot = fastComponent(function TooltipRoot2(props) {
10377 const {
10378 disabled: disabled2 = false,
10379 defaultOpen = false,
10380 open: openProp,
10381 disableHoverablePopup = false,
10382 trackCursorAxis = "none",
10383 actionsRef,
10384 onOpenChange,
10385 onOpenChangeComplete,
10386 handle,
10387 triggerId: triggerIdProp,
10388 defaultTriggerId: defaultTriggerIdProp = null,
10389 children
10390 } = props;
10391 const store = usePopupRootStore((floatingId, nested) => new TooltipStore({
10392 open: defaultOpen,
10393 openProp,
10394 activeTriggerId: defaultTriggerIdProp,
10395 triggerIdProp
10396 }, floatingId, nested));
10397 store.useControlledProp("openProp", openProp);
10398 store.useControlledProp("triggerIdProp", triggerIdProp);
10399 store.useContextCallback("onOpenChange", onOpenChange);
10400 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
10401 const openState = store.useState("open");
10402 const open3 = !disabled2 && openState;
10403 const activeTriggerId = store.useState("activeTriggerId");
10404 const mounted = store.useState("mounted");
10405 const payload = store.useState("payload");
10406 store.useSyncedValues({
10407 trackCursorAxis,
10408 disableHoverablePopup,
10409 disabled: disabled2
10410 });
10411 useImplicitActiveTrigger(store, {
10412 closeOnActiveTriggerUnmount: true
10413 });
10414 const {
10415 forceUnmount,
10416 transitionStatus
10417 } = useOpenStateTransitions(open3, store);
10418 const isInstantPhase = store.useState("isInstantPhase");
10419 const instantType = store.useState("instantType");
10420 const lastOpenChangeReason = store.useState("lastOpenChangeReason");
10421 const previousInstantTypeRef = React66.useRef(null);
10422 useIsoLayoutEffect(() => {
10423 if (openState && disabled2) {
10424 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
10425 }
10426 }, [openState, disabled2, store]);
10427 useIsoLayoutEffect(() => {
10428 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
10429 if (instantType !== "delay") {
10430 previousInstantTypeRef.current = instantType;
10431 }
10432 store.set("instantType", "delay");
10433 } else if (previousInstantTypeRef.current !== null) {
10434 store.set("instantType", previousInstantTypeRef.current);
10435 previousInstantTypeRef.current = null;
10436 }
10437 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]);
10438 useIsoLayoutEffect(() => {
10439 if (open3) {
10440 if (activeTriggerId == null) {
10441 store.set("payload", void 0);
10442 }
10443 }
10444 }, [store, activeTriggerId, open3]);
10445 React66.useImperativeHandle(actionsRef, () => ({
10446 unmount: forceUnmount,
10447 close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction))
10448 }), [forceUnmount, store]);
10449 const shouldRenderInteractions = open3 || mounted || !disabled2 && trackCursorAxis !== "none";
10450 return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipRootContext.Provider, {
10451 value: store,
10452 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PopupHandleAttachment, {
10453 handle,
10454 store
10455 }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipInteractions, {
10456 store,
10457 disabled: disabled2,
10458 trackCursorAxis
10459 }), typeof children === "function" ? children({
10460 payload
10461 }) : children]
10462 });
10463 });
10464 if (true) TooltipRoot.displayName = "TooltipRoot";
10465 function TooltipInteractions({
10466 store,
10467 disabled: disabled2,
10468 trackCursorAxis
10469 }) {
10470 const floatingRootContext = store.useState("floatingRootContext");
10471 const dismiss = useDismiss(floatingRootContext, {
10472 enabled: !disabled2,
10473 referencePress: () => store.select("closeOnClick")
10474 });
10475 const clientPoint = useClientPoint(floatingRootContext, {
10476 enabled: !disabled2 && trackCursorAxis !== "none",
10477 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
10478 });
10479 const triggerProps = React66.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
10480 usePopupInteractionProps(store, {
10481 activeTriggerProps: triggerProps,
10482 inactiveTriggerProps: triggerProps,
10483 popupProps: dismiss.floating ?? EMPTY_OBJECT
10484 });
10485 return null;
10486 }
10487
10488 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
10489 var React68 = __toESM(require_react(), 1);
10490
10491 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
10492 var React67 = __toESM(require_react(), 1);
10493 var TooltipProviderContext = /* @__PURE__ */ React67.createContext(void 0);
10494 if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
10495 function useTooltipProviderContext() {
10496 return React67.useContext(TooltipProviderContext);
10497 }
10498
10499 // node_modules/@base-ui/react/tooltip/utils/constants.mjs
10500 var OPEN_DELAY = 600;
10501
10502 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
10503 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
10504 function getTargetElement(event) {
10505 if ("composedPath" in event) {
10506 const path = event.composedPath();
10507 for (let i = 0; i < path.length; i += 1) {
10508 const element = path[i];
10509 if (isElement(element)) {
10510 return element;
10511 }
10512 }
10513 }
10514 const target = event.target;
10515 if (isElement(target)) {
10516 return target;
10517 }
10518 return null;
10519 }
10520 function closestEnabledTooltipTrigger(element) {
10521 let current = element;
10522 while (current) {
10523 const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`);
10524 if (trigger) {
10525 return trigger;
10526 }
10527 const root = current.getRootNode();
10528 current = "host" in root && isElement(root.host) ? root.host : null;
10529 }
10530 return null;
10531 }
10532 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
10533 const {
10534 render: render4,
10535 className,
10536 style,
10537 handle,
10538 payload,
10539 disabled: disabledProp,
10540 delay,
10541 closeOnClick = true,
10542 closeDelay,
10543 id: idProp,
10544 ...elementProps
10545 } = componentProps;
10546 const rootContext = useTooltipRootContext(true);
10547 const handleStore = usePopupHandleStore(handle);
10548 const store = handleStore ?? rootContext;
10549 if (!store) {
10550 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));
10551 }
10552 const thisTriggerId = useBaseUiId(idProp);
10553 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
10554 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
10555 const floatingRootContext = store.useState("floatingRootContext");
10556 const triggerElementRef = React68.useRef(null);
10557 const closeDelayWithDefault = closeDelay ?? 0;
10558 const {
10559 registerTrigger,
10560 isMountedByThisTrigger
10561 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
10562 payload,
10563 closeOnClick,
10564 closeDelay: closeDelayWithDefault
10565 });
10566 const providerDelay = useTooltipProviderContext();
10567 const {
10568 activeIdRef,
10569 delayRef,
10570 isInstantPhase,
10571 hasProvider
10572 } = useDelayGroup(floatingRootContext, {
10573 open: isOpenedByThisTrigger
10574 });
10575 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
10576 store.useSyncedValue("isInstantPhase", isInstantPhase);
10577 const rootDisabled = store.useState("disabled");
10578 const disabled2 = disabledProp ?? rootDisabled;
10579 const disabledRef = useValueAsRef(disabled2);
10580 const trackCursorAxis = store.useState("trackCursorAxis");
10581 const disableHoverablePopup = store.useState("disableHoverablePopup");
10582 const isNestedTriggerHoveredRef = React68.useRef(false);
10583 const nestedTriggerOpenTimeout = useTimeout();
10584 const pointerTypeRef = React68.useRef(void 0);
10585 function getOpenDelay() {
10586 if (hasProvider && activeIdRef.current != null) {
10587 return 0;
10588 }
10589 return delay ?? providerDelay ?? OPEN_DELAY;
10590 }
10591 function isEnabledNestedTriggerTarget(target) {
10592 const triggerEl = triggerElementRef.current;
10593 if (!triggerEl || !target) {
10594 return false;
10595 }
10596 const nearestTrigger = closestEnabledTooltipTrigger(target);
10597 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
10598 }
10599 function detectNestedTriggerHover(target) {
10600 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
10601 isNestedTriggerHoveredRef.current = nestedTriggerHovered;
10602 if (nestedTriggerHovered) {
10603 hoverInteraction.openChangeTimeout.clear();
10604 hoverInteraction.restTimeout.clear();
10605 hoverInteraction.restTimeoutPending = false;
10606 nestedTriggerOpenTimeout.clear();
10607 }
10608 return nestedTriggerHovered;
10609 }
10610 const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
10611 enabled: !disabled2,
10612 mouseOnly: true,
10613 move: false,
10614 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
10615 restMs: getOpenDelay,
10616 delay() {
10617 if (closeDelay == null && hasProvider) {
10618 return {
10619 close: getDelay(delayRef.current, "close")
10620 };
10621 }
10622 return {
10623 close: closeDelayWithDefault
10624 };
10625 },
10626 triggerElementRef,
10627 isActiveTrigger: isTriggerActive,
10628 isClosing: () => store.select("transitionStatus") === "ending",
10629 shouldOpen() {
10630 return !isNestedTriggerHoveredRef.current;
10631 }
10632 });
10633 const focusProps = useFocus(floatingRootContext, {
10634 enabled: !disabled2
10635 }).reference;
10636 const handleNestedTriggerHover = (event) => {
10637 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
10638 const target = getTargetElement(event);
10639 const nestedTriggerHovered = detectNestedTriggerHover(target);
10640 const triggerEl = triggerElementRef.current;
10641 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
10642 if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
10643 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
10644 return;
10645 }
10646 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
10647 isMouseLikePointerType(pointerTypeRef.current)) {
10648 const open3 = () => {
10649 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) {
10650 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
10651 }
10652 };
10653 const openDelay = getOpenDelay();
10654 if (openDelay === 0) {
10655 nestedTriggerOpenTimeout.clear();
10656 open3();
10657 } else {
10658 nestedTriggerOpenTimeout.start(openDelay, open3);
10659 }
10660 }
10661 };
10662 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
10663 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
10664 const state = {
10665 open: isOpenedByThisTrigger
10666 };
10667 const element = useRenderElement("button", componentProps, {
10668 state,
10669 ref: [forwardedRef, registerTrigger, triggerElementRef],
10670 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
10671 onMouseOver(event) {
10672 handleNestedTriggerHover(event.nativeEvent);
10673 },
10674 onFocus(event) {
10675 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
10676 event.preventBaseUIHandler();
10677 }
10678 },
10679 onMouseLeave() {
10680 isNestedTriggerHoveredRef.current = false;
10681 nestedTriggerOpenTimeout.clear();
10682 pointerTypeRef.current = void 0;
10683 },
10684 onPointerEnter(event) {
10685 pointerTypeRef.current = event.pointerType;
10686 },
10687 onPointerDown(event) {
10688 pointerTypeRef.current = event.pointerType;
10689 store.set("closeOnClick", closeOnClick);
10690 if (closeOnClick && !store.select("open")) {
10691 store.cancelPendingOpen(event.nativeEvent);
10692 }
10693 },
10694 onClick(event) {
10695 if (closeOnClick && !store.select("open")) {
10696 store.cancelPendingOpen(event.nativeEvent);
10697 }
10698 },
10699 id: thisTriggerId,
10700 [triggerDisabled]: disabled2 ? "" : void 0,
10701 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
10702 }, elementProps],
10703 stateAttributesMapping: triggerOpenStateMapping2
10704 });
10705 return element;
10706 });
10707 if (true) TooltipTrigger.displayName = "TooltipTrigger";
10708
10709 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
10710 var React70 = __toESM(require_react(), 1);
10711
10712 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
10713 var React69 = __toESM(require_react(), 1);
10714 var TooltipPortalContext = /* @__PURE__ */ React69.createContext(void 0);
10715 if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
10716 function useTooltipPortalContext() {
10717 const value = React69.useContext(TooltipPortalContext);
10718 if (value === void 0) {
10719 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
10720 }
10721 return value;
10722 }
10723
10724 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
10725 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
10726 var TooltipPortal = /* @__PURE__ */ React70.forwardRef(function TooltipPortal2(props, forwardedRef) {
10727 const {
10728 keepMounted = false,
10729 ...portalProps
10730 } = props;
10731 const store = useTooltipRootContext();
10732 const mounted = store.useState("mounted");
10733 const shouldRender = mounted || keepMounted;
10734 if (!shouldRender) {
10735 return null;
10736 }
10737 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipPortalContext.Provider, {
10738 value: keepMounted,
10739 children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FloatingPortalLite, {
10740 ref: forwardedRef,
10741 ...portalProps
10742 })
10743 });
10744 });
10745 if (true) TooltipPortal.displayName = "TooltipPortal";
10746
10747 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
10748 var React72 = __toESM(require_react(), 1);
10749
10750 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
10751 var React71 = __toESM(require_react(), 1);
10752 var TooltipPositionerContext = /* @__PURE__ */ React71.createContext(void 0);
10753 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
10754 function useTooltipPositionerContext() {
10755 const context = React71.useContext(TooltipPositionerContext);
10756 if (context === void 0) {
10757 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
10758 }
10759 return context;
10760 }
10761
10762 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
10763 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
10764 var TooltipPositioner = /* @__PURE__ */ React72.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
10765 const {
10766 render: render4,
10767 className,
10768 anchor,
10769 positionMethod = "absolute",
10770 side = "top",
10771 align = "center",
10772 sideOffset = 0,
10773 alignOffset = 0,
10774 collisionBoundary = "clipping-ancestors",
10775 collisionPadding = 5,
10776 arrowPadding = 5,
10777 sticky = false,
10778 disableAnchorTracking = false,
10779 collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
10780 style,
10781 ...elementProps
10782 } = componentProps;
10783 const store = useTooltipRootContext();
10784 const keepMounted = useTooltipPortalContext();
10785 const open3 = store.useState("open");
10786 const mounted = store.useState("mounted");
10787 const trackCursorAxis = store.useState("trackCursorAxis");
10788 const disableHoverablePopup = store.useState("disableHoverablePopup");
10789 const floatingRootContext = store.useState("floatingRootContext");
10790 const instantType = store.useState("instantType");
10791 const transitionStatus = store.useState("transitionStatus");
10792 const adaptiveOrigin2 = store.useState("adaptiveOrigin");
10793 const positioning = useAnchorPositioning({
10794 anchor,
10795 positionMethod,
10796 floatingRootContext,
10797 mounted,
10798 side,
10799 sideOffset,
10800 align,
10801 alignOffset,
10802 collisionBoundary,
10803 collisionPadding,
10804 sticky,
10805 arrowPadding,
10806 disableAnchorTracking,
10807 keepMounted,
10808 collisionAvoidance,
10809 adaptiveOrigin: adaptiveOrigin2
10810 });
10811 const state = React72.useMemo(() => ({
10812 open: open3,
10813 side: positioning.side,
10814 align: positioning.align,
10815 anchorHidden: positioning.anchorHidden,
10816 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
10817 }), [open3, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
10818 const element = usePositioner(componentProps, state, {
10819 styles: positioning.positionerStyles,
10820 transitionStatus,
10821 props: elementProps,
10822 refs: [forwardedRef, store.useStateSetter("positionerElement")],
10823 hidden: !mounted,
10824 inert: !open3 || trackCursorAxis === "both" || disableHoverablePopup
10825 });
10826 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipPositionerContext.Provider, {
10827 value: positioning,
10828 children: element
10829 });
10830 });
10831 if (true) TooltipPositioner.displayName = "TooltipPositioner";
10832
10833 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
10834 var React73 = __toESM(require_react(), 1);
10835 var TooltipPopup = /* @__PURE__ */ React73.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
10836 const {
10837 render: render4,
10838 className,
10839 style,
10840 ...elementProps
10841 } = componentProps;
10842 const store = useTooltipRootContext();
10843 const {
10844 side,
10845 align
10846 } = useTooltipPositionerContext();
10847 const open3 = store.useState("open");
10848 const instantType = store.useState("instantType");
10849 const transitionStatus = store.useState("transitionStatus");
10850 const popupProps = store.useState("popupProps");
10851 const floatingContext = store.useState("floatingRootContext");
10852 const disabled2 = store.useState("disabled");
10853 const closeDelay = store.useState("closeDelay");
10854 useOpenChangeComplete({
10855 open: open3,
10856 ref: store.context.popupRef,
10857 onComplete() {
10858 if (open3) {
10859 store.context.onOpenChangeComplete?.(true);
10860 }
10861 }
10862 });
10863 useHoverFloatingInteraction(floatingContext, {
10864 enabled: !disabled2,
10865 closeDelay
10866 });
10867 const setPopupElement = store.useStateSetter("popupElement");
10868 const state = {
10869 open: open3,
10870 side,
10871 align,
10872 instant: instantType,
10873 transitionStatus
10874 };
10875 const element = useRenderElement("div", componentProps, {
10876 state,
10877 ref: [forwardedRef, store.context.popupRef, setPopupElement],
10878 props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
10879 stateAttributesMapping: popupTransitionStateMapping
10880 });
10881 return element;
10882 });
10883 if (true) TooltipPopup.displayName = "TooltipPopup";
10884
10885 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
10886 var React74 = __toESM(require_react(), 1);
10887 var TooltipArrow = /* @__PURE__ */ React74.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
10888 const {
10889 render: render4,
10890 className,
10891 style,
10892 ...elementProps
10893 } = componentProps;
10894 const store = useTooltipRootContext();
10895 const {
10896 arrowRef,
10897 side,
10898 align,
10899 arrowUncentered,
10900 arrowStyles
10901 } = useTooltipPositionerContext();
10902 const open3 = store.useState("open");
10903 const instantType = store.useState("instantType");
10904 const state = {
10905 open: open3,
10906 side,
10907 align,
10908 uncentered: arrowUncentered,
10909 instant: instantType
10910 };
10911 const element = useRenderElement("div", componentProps, {
10912 state,
10913 ref: [forwardedRef, arrowRef],
10914 props: [{
10915 style: arrowStyles,
10916 "aria-hidden": true
10917 }, elementProps],
10918 stateAttributesMapping: popupStateMapping
10919 });
10920 return element;
10921 });
10922 if (true) TooltipArrow.displayName = "TooltipArrow";
10923
10924 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
10925 var React75 = __toESM(require_react(), 1);
10926 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
10927 var TooltipProvider = function TooltipProvider2(props) {
10928 const {
10929 delay,
10930 closeDelay,
10931 timeout = 400
10932 } = props;
10933 const delayValue = React75.useMemo(() => ({
10934 open: delay,
10935 close: closeDelay
10936 }), [delay, closeDelay]);
10937 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipProviderContext.Provider, {
10938 value: delay,
10939 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FloatingDelayGroup, {
10940 delay: delayValue,
10941 timeoutMs: timeout,
10942 children: props.children
10943 })
10944 });
10945 };
10946 if (true) TooltipProvider.displayName = "TooltipProvider";
10947
10948 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
10949 var React76 = __toESM(require_react(), 1);
10950 var TooltipViewport = /* @__PURE__ */ React76.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
10951 const {
10952 render: render4,
10953 className,
10954 style,
10955 children,
10956 ...elementProps
10957 } = componentProps;
10958 const store = useTooltipRootContext();
10959 const positioner = useTooltipPositionerContext();
10960 const instantType = store.useState("instantType");
10961 const {
10962 children: childrenToRender,
10963 state: viewportState
10964 } = usePopupViewport({
10965 store,
10966 side: positioner.side,
10967 children
10968 });
10969 const state = {
10970 activationDirection: viewportState.activationDirection,
10971 transitioning: viewportState.transitioning,
10972 instant: instantType
10973 };
10974 return useRenderElement("div", componentProps, {
10975 state,
10976 ref: forwardedRef,
10977 props: [elementProps, {
10978 children: childrenToRender
10979 }],
10980 stateAttributesMapping: popupViewportStateMapping
10981 });
10982 });
10983 if (true) TooltipViewport.displayName = "TooltipViewport";
10984
10985 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
10986 var TooltipHandle = class extends BasePopupHandle {
10987 constructor() {
10988 super(createNullTooltipStore(), "Tooltip");
10989 }
10990 /**
10991 * Opens the tooltip and associates it with the trigger with the given id.
10992 *
10993 * This method should only be called in an event handler or an effect (not during rendering).
10994 *
10995 * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching
10996 * `Tooltip.Trigger` with this handle passed as a prop.
10997 */
10998 open(triggerId) {
10999 this.openByTrigger(triggerId);
11000 }
11001 /**
11002 * Closes the tooltip.
11003 *
11004 * This method should only be called in an event handler or an effect (not during rendering).
11005 */
11006 close() {
11007 this.closePopup();
11008 }
11009 /**
11010 * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle.
11011 */
11012 get isOpen() {
11013 return this.attachedStore?.select("open") ?? false;
11014 }
11015 };
11016 function createTooltipHandle() {
11017 return new TooltipHandle();
11018 }
11019
11020 // node_modules/@base-ui/react/use-render/useRender.mjs
11021 function useRender(params) {
11022 return useRenderElement(params.defaultTagName ?? "div", params, params);
11023 }
11024
11025 // packages/ui/build-module/text/text.mjs
11026 var import_element10 = __toESM(require_element(), 1);
11027 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
11028 function getRuntime() {
11029 const globalScope = globalThis;
11030 if (globalScope.__wpStyleRuntime) {
11031 return globalScope.__wpStyleRuntime;
11032 }
11033 globalScope.__wpStyleRuntime = {
11034 documents: /* @__PURE__ */ new Map(),
11035 styles: /* @__PURE__ */ new Map(),
11036 injectedStyles: /* @__PURE__ */ new WeakMap()
11037 };
11038 if (typeof document !== "undefined") {
11039 registerDocument(document);
11040 }
11041 return globalScope.__wpStyleRuntime;
11042 }
11043 function documentContainsStyleHash(targetDocument, hash) {
11044 if (!targetDocument.head) {
11045 return false;
11046 }
11047 for (const style of targetDocument.head.querySelectorAll(
11048 `style[${STYLE_HASH_ATTRIBUTE}]`
11049 )) {
11050 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
11051 return true;
11052 }
11053 }
11054 return false;
11055 }
11056 function injectStyle(targetDocument, hash, css) {
11057 if (!targetDocument.head) {
11058 return;
11059 }
11060 const runtime = getRuntime();
11061 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11062 if (!injectedStyles) {
11063 injectedStyles = /* @__PURE__ */ new Set();
11064 runtime.injectedStyles.set(targetDocument, injectedStyles);
11065 }
11066 if (injectedStyles.has(hash)) {
11067 return;
11068 }
11069 if (documentContainsStyleHash(targetDocument, hash)) {
11070 injectedStyles.add(hash);
11071 return;
11072 }
11073 const style = targetDocument.createElement("style");
11074 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
11075 style.appendChild(targetDocument.createTextNode(css));
11076 targetDocument.head.appendChild(style);
11077 injectedStyles.add(hash);
11078 }
11079 function registerDocument(targetDocument) {
11080 const runtime = getRuntime();
11081 runtime.documents.set(
11082 targetDocument,
11083 (runtime.documents.get(targetDocument) ?? 0) + 1
11084 );
11085 for (const [hash, css] of runtime.styles) {
11086 injectStyle(targetDocument, hash, css);
11087 }
11088 return () => {
11089 const count = runtime.documents.get(targetDocument);
11090 if (count === void 0) {
11091 return;
11092 }
11093 if (count <= 1) {
11094 runtime.documents.delete(targetDocument);
11095 return;
11096 }
11097 runtime.documents.set(targetDocument, count - 1);
11098 };
11099 }
11100 function registerStyle(hash, css) {
11101 const runtime = getRuntime();
11102 runtime.styles.set(hash, css);
11103 for (const targetDocument of runtime.documents.keys()) {
11104 injectStyle(targetDocument, hash, css);
11105 }
11106 }
11107 if (typeof process === "undefined" || true) {
11108 registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;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-emphasis,600);--_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-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_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-emphasis,600);--_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-emphasis,600);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-emphasis,600);--_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-emphasis,600);--_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-emphasis,600);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-default,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-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,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-default,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-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,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)}}}');
11109 }
11110 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" };
11111 if (typeof process === "undefined" || true) {
11112 registerStyle("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
11113 }
11114 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", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
11115 var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) {
11116 const element = useRender({
11117 render: render4,
11118 defaultTagName: "span",
11119 ref,
11120 props: mergeProps(props, {
11121 className: clsx_default(
11122 style_default.text,
11123 global_css_defense_default.heading,
11124 global_css_defense_default.p,
11125 style_default[variant],
11126 className
11127 )
11128 })
11129 });
11130 return element;
11131 });
11132
11133 // packages/ui/build-module/badge/badge.mjs
11134 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
11135 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
11136 function getRuntime2() {
11137 const globalScope = globalThis;
11138 if (globalScope.__wpStyleRuntime) {
11139 return globalScope.__wpStyleRuntime;
11140 }
11141 globalScope.__wpStyleRuntime = {
11142 documents: /* @__PURE__ */ new Map(),
11143 styles: /* @__PURE__ */ new Map(),
11144 injectedStyles: /* @__PURE__ */ new WeakMap()
11145 };
11146 if (typeof document !== "undefined") {
11147 registerDocument2(document);
11148 }
11149 return globalScope.__wpStyleRuntime;
11150 }
11151 function documentContainsStyleHash2(targetDocument, hash) {
11152 if (!targetDocument.head) {
11153 return false;
11154 }
11155 for (const style of targetDocument.head.querySelectorAll(
11156 `style[${STYLE_HASH_ATTRIBUTE2}]`
11157 )) {
11158 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
11159 return true;
11160 }
11161 }
11162 return false;
11163 }
11164 function injectStyle2(targetDocument, hash, css) {
11165 if (!targetDocument.head) {
11166 return;
11167 }
11168 const runtime = getRuntime2();
11169 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11170 if (!injectedStyles) {
11171 injectedStyles = /* @__PURE__ */ new Set();
11172 runtime.injectedStyles.set(targetDocument, injectedStyles);
11173 }
11174 if (injectedStyles.has(hash)) {
11175 return;
11176 }
11177 if (documentContainsStyleHash2(targetDocument, hash)) {
11178 injectedStyles.add(hash);
11179 return;
11180 }
11181 const style = targetDocument.createElement("style");
11182 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
11183 style.appendChild(targetDocument.createTextNode(css));
11184 targetDocument.head.appendChild(style);
11185 injectedStyles.add(hash);
11186 }
11187 function registerDocument2(targetDocument) {
11188 const runtime = getRuntime2();
11189 runtime.documents.set(
11190 targetDocument,
11191 (runtime.documents.get(targetDocument) ?? 0) + 1
11192 );
11193 for (const [hash, css] of runtime.styles) {
11194 injectStyle2(targetDocument, hash, css);
11195 }
11196 return () => {
11197 const count = runtime.documents.get(targetDocument);
11198 if (count === void 0) {
11199 return;
11200 }
11201 if (count <= 1) {
11202 runtime.documents.delete(targetDocument);
11203 return;
11204 }
11205 runtime.documents.set(targetDocument, count - 1);
11206 };
11207 }
11208 function registerStyle2(hash, css) {
11209 const runtime = getRuntime2();
11210 runtime.styles.set(hash, css);
11211 for (const targetDocument of runtime.documents.keys()) {
11212 injectStyle2(targetDocument, hash, css);
11213 }
11214 }
11215 if (typeof process === "undefined" || true) {
11216 registerStyle2("40ea4a6382", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-error,#fae5e1);color:var(--wpds-color-foreground-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-background-surface-warning,#fde6be);color:var(--wpds-color-foreground-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-background-surface-caution,#fee995);color:var(--wpds-color-foreground-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-background-surface-success,#c2f8ca);color:var(--wpds-color-foreground-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-background-surface-info,#deebfa);color:var(--wpds-color-foreground-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-foreground-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))}}}");
11217 }
11218 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" };
11219 var Badge = (0, import_element11.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) {
11220 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11221 Text,
11222 {
11223 ref,
11224 className: clsx_default(
11225 style_default2.badge,
11226 style_default2[`is-${intent}-intent`],
11227 className
11228 ),
11229 ...props,
11230 variant: "body-sm"
11231 }
11232 );
11233 });
11234
11235 // packages/ui/build-module/tooltip/index.mjs
11236 var tooltip_exports = {};
11237 __export(tooltip_exports, {
11238 Popup: () => Popup,
11239 Portal: () => Portal,
11240 Positioner: () => Positioner,
11241 Provider: () => Provider,
11242 Root: () => Root,
11243 Trigger: () => Trigger
11244 });
11245
11246 // packages/ui/build-module/tooltip/popup.mjs
11247 var import_element15 = __toESM(require_element(), 1);
11248
11249 // packages/ui/build-module/tooltip/portal.mjs
11250 var import_element12 = __toESM(require_element(), 1);
11251
11252 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
11253 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
11254 function getRuntime3() {
11255 const globalScope = globalThis;
11256 if (globalScope.__wpStyleRuntime) {
11257 return globalScope.__wpStyleRuntime;
11258 }
11259 globalScope.__wpStyleRuntime = {
11260 documents: /* @__PURE__ */ new Map(),
11261 styles: /* @__PURE__ */ new Map(),
11262 injectedStyles: /* @__PURE__ */ new WeakMap()
11263 };
11264 if (typeof document !== "undefined") {
11265 registerDocument3(document);
11266 }
11267 return globalScope.__wpStyleRuntime;
11268 }
11269 function documentContainsStyleHash3(targetDocument, hash) {
11270 if (!targetDocument.head) {
11271 return false;
11272 }
11273 for (const style of targetDocument.head.querySelectorAll(
11274 `style[${STYLE_HASH_ATTRIBUTE3}]`
11275 )) {
11276 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
11277 return true;
11278 }
11279 }
11280 return false;
11281 }
11282 function injectStyle3(targetDocument, hash, css) {
11283 if (!targetDocument.head) {
11284 return;
11285 }
11286 const runtime = getRuntime3();
11287 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11288 if (!injectedStyles) {
11289 injectedStyles = /* @__PURE__ */ new Set();
11290 runtime.injectedStyles.set(targetDocument, injectedStyles);
11291 }
11292 if (injectedStyles.has(hash)) {
11293 return;
11294 }
11295 if (documentContainsStyleHash3(targetDocument, hash)) {
11296 injectedStyles.add(hash);
11297 return;
11298 }
11299 const style = targetDocument.createElement("style");
11300 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
11301 style.appendChild(targetDocument.createTextNode(css));
11302 targetDocument.head.appendChild(style);
11303 injectedStyles.add(hash);
11304 }
11305 function registerDocument3(targetDocument) {
11306 const runtime = getRuntime3();
11307 runtime.documents.set(
11308 targetDocument,
11309 (runtime.documents.get(targetDocument) ?? 0) + 1
11310 );
11311 for (const [hash, css] of runtime.styles) {
11312 injectStyle3(targetDocument, hash, css);
11313 }
11314 return () => {
11315 const count = runtime.documents.get(targetDocument);
11316 if (count === void 0) {
11317 return;
11318 }
11319 if (count <= 1) {
11320 runtime.documents.delete(targetDocument);
11321 return;
11322 }
11323 runtime.documents.set(targetDocument, count - 1);
11324 };
11325 }
11326 function registerStyle3(hash, css) {
11327 const runtime = getRuntime3();
11328 runtime.styles.set(hash, css);
11329 for (const targetDocument of runtime.documents.keys()) {
11330 injectStyle3(targetDocument, hash, css);
11331 }
11332 }
11333 if (typeof process === "undefined" || true) {
11334 registerStyle3("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}");
11335 }
11336 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
11337 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
11338 function resolveOwnerDocument() {
11339 return typeof document === "undefined" ? null : document;
11340 }
11341 function isInWordPressEnvironment() {
11342 let topWp;
11343 try {
11344 topWp = window.top?.wp;
11345 } catch {
11346 }
11347 const wp = topWp ?? window.wp;
11348 return typeof wp?.components === "object" && wp.components !== null;
11349 }
11350 var cachedSlot = null;
11351 function ensureSlotIsAccessible(element) {
11352 element.setAttribute("aria-hidden", "false");
11353 return element;
11354 }
11355 function createSlot(ownerDocument2) {
11356 const element = ownerDocument2.createElement("div");
11357 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
11358 if (wp_compat_overlay_slot_default.slot) {
11359 element.classList.add(wp_compat_overlay_slot_default.slot);
11360 }
11361 ownerDocument2.body.appendChild(element);
11362 return element;
11363 }
11364 function getWpCompatOverlaySlot() {
11365 if (typeof window === "undefined") {
11366 return void 0;
11367 }
11368 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
11369 return void 0;
11370 }
11371 const ownerDocument2 = resolveOwnerDocument();
11372 if (!ownerDocument2 || !ownerDocument2.body) {
11373 return void 0;
11374 }
11375 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
11376 return ensureSlotIsAccessible(cachedSlot);
11377 }
11378 const existing = ownerDocument2.querySelector(
11379 `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
11380 );
11381 if (existing instanceof HTMLDivElement) {
11382 cachedSlot = ensureSlotIsAccessible(existing);
11383 return cachedSlot;
11384 }
11385 if (cachedSlot?.isConnected) {
11386 cachedSlot.remove();
11387 }
11388 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2));
11389 return cachedSlot;
11390 }
11391
11392 // packages/ui/build-module/tooltip/portal.mjs
11393 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
11394 var Portal = (0, import_element12.forwardRef)(
11395 function TooltipPortal3({ container, ...restProps }, ref) {
11396 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
11397 index_parts_exports3.Portal,
11398 {
11399 container: container ?? getWpCompatOverlaySlot(),
11400 ...restProps,
11401 ref
11402 }
11403 );
11404 }
11405 );
11406
11407 // packages/ui/build-module/tooltip/positioner.mjs
11408 var import_element13 = __toESM(require_element(), 1);
11409 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
11410 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
11411 function getRuntime4() {
11412 const globalScope = globalThis;
11413 if (globalScope.__wpStyleRuntime) {
11414 return globalScope.__wpStyleRuntime;
11415 }
11416 globalScope.__wpStyleRuntime = {
11417 documents: /* @__PURE__ */ new Map(),
11418 styles: /* @__PURE__ */ new Map(),
11419 injectedStyles: /* @__PURE__ */ new WeakMap()
11420 };
11421 if (typeof document !== "undefined") {
11422 registerDocument4(document);
11423 }
11424 return globalScope.__wpStyleRuntime;
11425 }
11426 function documentContainsStyleHash4(targetDocument, hash) {
11427 if (!targetDocument.head) {
11428 return false;
11429 }
11430 for (const style of targetDocument.head.querySelectorAll(
11431 `style[${STYLE_HASH_ATTRIBUTE4}]`
11432 )) {
11433 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
11434 return true;
11435 }
11436 }
11437 return false;
11438 }
11439 function injectStyle4(targetDocument, hash, css) {
11440 if (!targetDocument.head) {
11441 return;
11442 }
11443 const runtime = getRuntime4();
11444 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11445 if (!injectedStyles) {
11446 injectedStyles = /* @__PURE__ */ new Set();
11447 runtime.injectedStyles.set(targetDocument, injectedStyles);
11448 }
11449 if (injectedStyles.has(hash)) {
11450 return;
11451 }
11452 if (documentContainsStyleHash4(targetDocument, hash)) {
11453 injectedStyles.add(hash);
11454 return;
11455 }
11456 const style = targetDocument.createElement("style");
11457 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
11458 style.appendChild(targetDocument.createTextNode(css));
11459 targetDocument.head.appendChild(style);
11460 injectedStyles.add(hash);
11461 }
11462 function registerDocument4(targetDocument) {
11463 const runtime = getRuntime4();
11464 runtime.documents.set(
11465 targetDocument,
11466 (runtime.documents.get(targetDocument) ?? 0) + 1
11467 );
11468 for (const [hash, css] of runtime.styles) {
11469 injectStyle4(targetDocument, hash, css);
11470 }
11471 return () => {
11472 const count = runtime.documents.get(targetDocument);
11473 if (count === void 0) {
11474 return;
11475 }
11476 if (count <= 1) {
11477 runtime.documents.delete(targetDocument);
11478 return;
11479 }
11480 runtime.documents.set(targetDocument, count - 1);
11481 };
11482 }
11483 function registerStyle4(hash, css) {
11484 const runtime = getRuntime4();
11485 runtime.styles.set(hash, css);
11486 for (const targetDocument of runtime.documents.keys()) {
11487 injectStyle4(targetDocument, hash, css);
11488 }
11489 }
11490 if (typeof process === "undefined" || true) {
11491 registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
11492 }
11493 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
11494 if (typeof process === "undefined" || true) {
11495 registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-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}}}}');
11496 }
11497 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
11498 var Positioner = (0, import_element13.forwardRef)(
11499 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
11500 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11501 index_parts_exports3.Positioner,
11502 {
11503 ref,
11504 align,
11505 side,
11506 sideOffset,
11507 ...props,
11508 className: clsx_default(
11509 resets_default["box-sizing"],
11510 style_default3.positioner,
11511 className
11512 )
11513 }
11514 );
11515 }
11516 );
11517
11518 // packages/ui/build-module/utils/render-slot-with-children.mjs
11519 var import_element14 = __toESM(require_element(), 1);
11520 function renderSlotWithChildren(slot, defaultSlot, children) {
11521 return (0, import_element14.cloneElement)(slot ?? defaultSlot, { children });
11522 }
11523
11524 // packages/ui/build-module/utils/theme-provider.mjs
11525 var theme = __toESM(require_theme(), 1);
11526
11527 // packages/ui/build-module/lock-unlock.mjs
11528 var import_private_apis = __toESM(require_private_apis(), 1);
11529 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
11530 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
11531 "@wordpress/ui"
11532 );
11533
11534 // packages/ui/build-module/utils/theme-provider.mjs
11535 function getThemeProvider() {
11536 const themePackage = theme;
11537 if (themePackage.ThemeProvider) {
11538 return themePackage.ThemeProvider;
11539 }
11540 if (!themePackage.privateApis) {
11541 throw new Error(
11542 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
11543 );
11544 }
11545 return unlock(
11546 themePackage.privateApis
11547 ).ThemeProvider;
11548 }
11549 var ThemeProvider = getThemeProvider();
11550
11551 // packages/ui/build-module/tooltip/popup.mjs
11552 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
11553 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
11554 function getRuntime5() {
11555 const globalScope = globalThis;
11556 if (globalScope.__wpStyleRuntime) {
11557 return globalScope.__wpStyleRuntime;
11558 }
11559 globalScope.__wpStyleRuntime = {
11560 documents: /* @__PURE__ */ new Map(),
11561 styles: /* @__PURE__ */ new Map(),
11562 injectedStyles: /* @__PURE__ */ new WeakMap()
11563 };
11564 if (typeof document !== "undefined") {
11565 registerDocument5(document);
11566 }
11567 return globalScope.__wpStyleRuntime;
11568 }
11569 function documentContainsStyleHash5(targetDocument, hash) {
11570 if (!targetDocument.head) {
11571 return false;
11572 }
11573 for (const style of targetDocument.head.querySelectorAll(
11574 `style[${STYLE_HASH_ATTRIBUTE5}]`
11575 )) {
11576 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
11577 return true;
11578 }
11579 }
11580 return false;
11581 }
11582 function injectStyle5(targetDocument, hash, css) {
11583 if (!targetDocument.head) {
11584 return;
11585 }
11586 const runtime = getRuntime5();
11587 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11588 if (!injectedStyles) {
11589 injectedStyles = /* @__PURE__ */ new Set();
11590 runtime.injectedStyles.set(targetDocument, injectedStyles);
11591 }
11592 if (injectedStyles.has(hash)) {
11593 return;
11594 }
11595 if (documentContainsStyleHash5(targetDocument, hash)) {
11596 injectedStyles.add(hash);
11597 return;
11598 }
11599 const style = targetDocument.createElement("style");
11600 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
11601 style.appendChild(targetDocument.createTextNode(css));
11602 targetDocument.head.appendChild(style);
11603 injectedStyles.add(hash);
11604 }
11605 function registerDocument5(targetDocument) {
11606 const runtime = getRuntime5();
11607 runtime.documents.set(
11608 targetDocument,
11609 (runtime.documents.get(targetDocument) ?? 0) + 1
11610 );
11611 for (const [hash, css] of runtime.styles) {
11612 injectStyle5(targetDocument, hash, css);
11613 }
11614 return () => {
11615 const count = runtime.documents.get(targetDocument);
11616 if (count === void 0) {
11617 return;
11618 }
11619 if (count <= 1) {
11620 runtime.documents.delete(targetDocument);
11621 return;
11622 }
11623 runtime.documents.set(targetDocument, count - 1);
11624 };
11625 }
11626 function registerStyle5(hash, css) {
11627 const runtime = getRuntime5();
11628 runtime.styles.set(hash, css);
11629 for (const targetDocument of runtime.documents.keys()) {
11630 injectStyle5(targetDocument, hash, css);
11631 }
11632 }
11633 if (typeof process === "undefined" || true) {
11634 registerStyle5("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-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}}}}');
11635 }
11636 var style_default4 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
11637 var POPUP_COLOR = { background: "#1e1e1e" };
11638 var Popup = (0, import_element15.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
11639 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
11640 index_parts_exports3.Popup,
11641 {
11642 ref,
11643 className: clsx_default(style_default4.popup, className),
11644 ...props,
11645 children
11646 }
11647 ) });
11648 const positionedPopup = renderSlotWithChildren(
11649 positioner,
11650 /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Positioner, {}),
11651 popupContent
11652 );
11653 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Portal, {}), positionedPopup);
11654 });
11655
11656 // packages/ui/build-module/tooltip/trigger.mjs
11657 var import_element16 = __toESM(require_element(), 1);
11658 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
11659 var Trigger = (0, import_element16.forwardRef)(
11660 function TooltipTrigger3(props, ref) {
11661 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports3.Trigger, { ref, ...props });
11662 }
11663 );
11664
11665 // packages/ui/build-module/utils/direction-provider.mjs
11666 var import_i18n = __toESM(require_i18n(), 1);
11667 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
11668 function DirectionProvider3({ children }) {
11669 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children });
11670 }
11671
11672 // packages/ui/build-module/tooltip/root.mjs
11673 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
11674 function Root(props) {
11675 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(index_parts_exports3.Root, { ...props }) });
11676 }
11677
11678 // packages/ui/build-module/tooltip/provider.mjs
11679 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
11680 function Provider({ ...props }) {
11681 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(index_parts_exports3.Provider, { ...props });
11682 }
11683
11684 // packages/ui/build-module/link/link.mjs
11685 var import_element17 = __toESM(require_element(), 1);
11686 var import_i18n2 = __toESM(require_i18n(), 1);
11687 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
11688 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
11689 function getRuntime6() {
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 registerDocument6(document);
11701 }
11702 return globalScope.__wpStyleRuntime;
11703 }
11704 function documentContainsStyleHash6(targetDocument, hash) {
11705 if (!targetDocument.head) {
11706 return false;
11707 }
11708 for (const style of targetDocument.head.querySelectorAll(
11709 `style[${STYLE_HASH_ATTRIBUTE6}]`
11710 )) {
11711 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
11712 return true;
11713 }
11714 }
11715 return false;
11716 }
11717 function injectStyle6(targetDocument, hash, css) {
11718 if (!targetDocument.head) {
11719 return;
11720 }
11721 const runtime = getRuntime6();
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 (documentContainsStyleHash6(targetDocument, hash)) {
11731 injectedStyles.add(hash);
11732 return;
11733 }
11734 const style = targetDocument.createElement("style");
11735 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
11736 style.appendChild(targetDocument.createTextNode(css));
11737 targetDocument.head.appendChild(style);
11738 injectedStyles.add(hash);
11739 }
11740 function registerDocument6(targetDocument) {
11741 const runtime = getRuntime6();
11742 runtime.documents.set(
11743 targetDocument,
11744 (runtime.documents.get(targetDocument) ?? 0) + 1
11745 );
11746 for (const [hash, css] of runtime.styles) {
11747 injectStyle6(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 registerStyle6(hash, css) {
11762 const runtime = getRuntime6();
11763 runtime.styles.set(hash, css);
11764 for (const targetDocument of runtime.documents.keys()) {
11765 injectStyle6(targetDocument, hash, css);
11766 }
11767 }
11768 if (typeof process === "undefined" || true) {
11769 registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
11770 }
11771 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
11772 if (typeof process === "undefined" || true) {
11773 registerStyle6("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
11774 }
11775 var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
11776 if (typeof process === "undefined" || true) {
11777 registerStyle6("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-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-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-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-default,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"}}}');
11778 }
11779 var style_default5 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" };
11780 if (typeof process === "undefined" || true) {
11781 registerStyle6("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
11782 }
11783 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", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
11784 var Link = (0, import_element17.forwardRef)(function Link2({
11785 children,
11786 variant = "default",
11787 tone = "brand",
11788 openInNewTab = false,
11789 target,
11790 render: render4,
11791 className,
11792 ...props
11793 }, ref) {
11794 const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? "");
11795 const element = useRender({
11796 render: render4,
11797 defaultTagName: "a",
11798 ref,
11799 props: mergeProps(props, {
11800 className: clsx_default(
11801 global_css_defense_default2.a,
11802 resets_default2["box-sizing"],
11803 focus_module_default["outset-ring--focus-except-active"],
11804 variant !== "unstyled" && style_default5.link,
11805 variant !== "unstyled" && style_default5[`is-${tone}`],
11806 variant === "unstyled" && style_default5["is-unstyled"],
11807 className
11808 ),
11809 target: target ?? (openInNewTab ? "_blank" : void 0),
11810 children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
11811 children,
11812 shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
11813 "span",
11814 {
11815 className: style_default5["link-icon"],
11816 role: "img",
11817 "aria-label": (
11818 /* translators: accessibility text appended to link text */
11819 (0, import_i18n2.__)("(opens in a new tab)")
11820 )
11821 }
11822 )
11823 ] })
11824 })
11825 });
11826 return element;
11827 });
11828
11829 // packages/icons/build-module/library/archive.mjs
11830 var import_primitives = __toESM(require_primitives(), 1);
11831 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
11832 var archive_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives.Path, { d: "M8.5 11H15.5M8.5 14.5H15.5M20.25 17.5V8.5C20.25 7.80964 19.6904 7.25 19 7.25H13.3463C12.8352 7.25 12.3755 6.93881 12.1857 6.46424L11.8143 5.53576C11.6245 5.06119 11.1648 4.75 10.6537 4.75H5C4.30964 4.75 3.75 5.30964 3.75 6V17.5C3.75 18.1904 4.30964 18.75 5 18.75H19C19.6904 18.75 20.25 18.1904 20.25 17.5Z", vectorEffect: "non-scaling-stroke" }) });
11833
11834 // packages/icons/build-module/library/audio.mjs
11835 var import_primitives2 = __toESM(require_primitives(), 1);
11836 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
11837 var audio_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11838 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives2.Path, { d: "M13.25 16.5C13.25 18.0188 12.0188 19.25 10.5 19.25C8.98122 19.25 7.75 18.0188 7.75 16.5C7.75 14.9812 8.98122 13.75 10.5 13.75C12.0188 13.75 13.25 14.9812 13.25 16.5Z", fill: "currentColor", stroke: "none" }),
11839 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives2.Path, { d: "M10.5 19.25C12.0188 19.25 13.25 18.0188 13.25 16.5C13.25 14.9812 12.0188 13.75 10.5 13.75C8.98122 13.75 7.75 14.9812 7.75 16.5C7.75 18.0188 8.98122 19.25 10.5 19.25ZM10.5 19.25C13.4867 19.25 13.75 16.5 13.75 15.1379V7.99998C13.75 4.9108 16.4 5.00254 18 5.00233", vectorEffect: "non-scaling-stroke" })
11840 ] });
11841
11842 // packages/icons/build-module/library/chevron-down.mjs
11843 var import_primitives3 = __toESM(require_primitives(), 1);
11844 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
11845 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives3.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) });
11846
11847 // packages/icons/build-module/library/chevron-left.mjs
11848 var import_primitives4 = __toESM(require_primitives(), 1);
11849 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
11850 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives4.Path, { d: "M14 6.5L9 12L14 17.5", vectorEffect: "non-scaling-stroke" }) });
11851
11852 // packages/icons/build-module/library/chevron-right.mjs
11853 var import_primitives5 = __toESM(require_primitives(), 1);
11854 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
11855 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives5.Path, { d: "M10 6.5L15 12L10 17.5", vectorEffect: "non-scaling-stroke" }) });
11856
11857 // packages/icons/build-module/library/chevron-up.mjs
11858 var import_primitives6 = __toESM(require_primitives(), 1);
11859 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
11860 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives6.Path, { d: "M7 13L12 9L17 13", vectorEffect: "non-scaling-stroke" }) });
11861
11862 // packages/icons/build-module/library/close-small.mjs
11863 var import_primitives7 = __toESM(require_primitives(), 1);
11864 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
11865 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives7.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) });
11866
11867 // packages/icons/build-module/library/envelope.mjs
11868 var import_primitives8 = __toESM(require_primitives(), 1);
11869 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
11870 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives8.Path, { d: "M20.25 8.5V7C20.25 6.30964 19.6904 5.75 19 5.75H5C4.30964 5.75 3.75 6.30964 3.75 7V8.5M20.25 8.5V17C20.25 17.6904 19.6904 18.25 19 18.25H5C4.30964 18.25 3.75 17.6904 3.75 17V8.5M20.25 8.5L12 14.5L3.75 8.5", vectorEffect: "non-scaling-stroke" }) });
11871
11872 // packages/icons/build-module/library/error.mjs
11873 var import_primitives9 = __toESM(require_primitives(), 1);
11874 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
11875 var error_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives9.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) });
11876
11877 // packages/icons/build-module/library/file.mjs
11878 var import_primitives10 = __toESM(require_primitives(), 1);
11879 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
11880 var file_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives10.Path, { d: "M3.75 6V17.5C3.75 18.1904 4.30964 18.75 5 18.75H19C19.6904 18.75 20.25 18.1904 20.25 17.5V8.5C20.25 7.80964 19.6904 7.25 19 7.25H13.3463C12.8352 7.25 12.3755 6.93881 12.1857 6.46424L11.8143 5.53576C11.6245 5.06119 11.1648 4.75 10.6537 4.75H5C4.30964 4.75 3.75 5.30964 3.75 6Z", vectorEffect: "non-scaling-stroke" }) });
11881
11882 // packages/icons/build-module/library/link.mjs
11883 var import_primitives11 = __toESM(require_primitives(), 1);
11884 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
11885 var link_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives11.Path, { d: "M9.5 12L14.5 12M10 7.75H8.25C5.90279 7.75 4 9.65279 4 12C4 14.3472 5.90279 16.25 8.25 16.25H10M14 16.25H15.75C18.0972 16.25 20 14.3472 20 12C20 9.65279 18.0972 7.75 15.75 7.75L14 7.75", vectorEffect: "non-scaling-stroke" }) });
11886
11887 // packages/icons/build-module/library/mobile.mjs
11888 var import_primitives12 = __toESM(require_primitives(), 1);
11889 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
11890 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives12.Path, { d: "M11 16.5H13M16.25 18V6C16.25 5.30964 15.6904 4.75 15 4.75H9C8.30964 4.75 7.75 5.30964 7.75 6L7.75 18C7.75 18.6904 8.30964 19.25 9 19.25H15C15.6904 19.25 16.25 18.6904 16.25 18Z", vectorEffect: "non-scaling-stroke" }) });
11891
11892 // packages/icons/build-module/library/pencil.mjs
11893 var import_primitives13 = __toESM(require_primitives(), 1);
11894 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
11895 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11896 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives13.Path, { d: "M5 19.25H12", vectorEffect: "non-scaling-stroke" }),
11897 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives13.Path, { d: "M10 15L7.5 15.5L8 13L16 5L18 7L10 15Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
11898 ] });
11899
11900 // packages/icons/build-module/library/published.mjs
11901 var import_primitives14 = __toESM(require_primitives(), 1);
11902 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
11903 var published_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11904 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives14.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }),
11905 /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives14.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" })
11906 ] });
11907
11908 // packages/icons/build-module/library/seen.mjs
11909 var import_primitives15 = __toESM(require_primitives(), 1);
11910 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
11911 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11912 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives15.Path, { d: "M20.0645 13C18.5918 10.0366 15.5337 8 12 8C8.46631 8 5.40825 10.0366 3.93555 13", vectorEffect: "non-scaling-stroke" }),
11913 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives15.Circle, { cx: "12", cy: "12.5", r: "3", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
11914 ] });
11915
11916 // packages/icons/build-module/library/unseen.mjs
11917 var import_primitives16 = __toESM(require_primitives(), 1);
11918 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
11919 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11920 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives16.Path, { d: "M8 21L10.6587 15.1842M13.1523 9.72929L13.8553 8.19144L16 3.5M20.0645 13C19.2118 11.2841 17.8276 9.87898 16.1272 9M3.93555 13C5.40825 10.0366 8.46631 8 12 8C12.636 8 13.2566 8.06597 13.8553 8.19144M13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842M13.1523 9.72929L10.6587 15.1842M13.1755 15.261C14.2481 14.8037 15 13.7397 15 12.5C15 12.1819 14.9505 11.8753 14.8587 11.5876", vectorEffect: "non-scaling-stroke" }),
11921 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives16.Path, { d: "M12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842L13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
11922 ] });
11923
11924 // packages/icons/build-module/library/video.mjs
11925 var import_primitives17 = __toESM(require_primitives(), 1);
11926 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
11927 var video_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11928 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives17.Path, { d: "M10 15L15 12L10 9V15Z", fill: "currentColor", stroke: "none" }),
11929 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives17.Path, { d: "M4.75 6C4.75 5.30964 5.30964 4.75 6 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V18C19.25 18.6904 18.6904 19.25 18 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V6Z", vectorEffect: "non-scaling-stroke" })
11930 ] });
11931
11932 // packages/ui/build-module/icon/icon.mjs
11933 var import_element18 = __toESM(require_element(), 1);
11934 var import_primitives18 = __toESM(require_primitives(), 1);
11935 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
11936 var Icon = (0, import_element18.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) {
11937 const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0;
11938 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11939 import_primitives18.SVG,
11940 {
11941 ref,
11942 ...icon.props,
11943 ...restProps,
11944 ...mergedStyle ? { style: mergedStyle } : {},
11945 width: size4,
11946 height: size4
11947 }
11948 );
11949 });
11950
11951 // packages/ui/build-module/utils/keyboard-shortcut.mjs
11952 var import_element20 = __toESM(require_element(), 1);
11953 var import_i18n3 = __toESM(require_i18n(), 1);
11954
11955 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
11956 var import_element19 = __toESM(require_element(), 1);
11957 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash";
11958 function getRuntime7() {
11959 const globalScope = globalThis;
11960 if (globalScope.__wpStyleRuntime) {
11961 return globalScope.__wpStyleRuntime;
11962 }
11963 globalScope.__wpStyleRuntime = {
11964 documents: /* @__PURE__ */ new Map(),
11965 styles: /* @__PURE__ */ new Map(),
11966 injectedStyles: /* @__PURE__ */ new WeakMap()
11967 };
11968 if (typeof document !== "undefined") {
11969 registerDocument7(document);
11970 }
11971 return globalScope.__wpStyleRuntime;
11972 }
11973 function documentContainsStyleHash7(targetDocument, hash) {
11974 if (!targetDocument.head) {
11975 return false;
11976 }
11977 for (const style of targetDocument.head.querySelectorAll(
11978 `style[${STYLE_HASH_ATTRIBUTE7}]`
11979 )) {
11980 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) {
11981 return true;
11982 }
11983 }
11984 return false;
11985 }
11986 function injectStyle7(targetDocument, hash, css) {
11987 if (!targetDocument.head) {
11988 return;
11989 }
11990 const runtime = getRuntime7();
11991 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11992 if (!injectedStyles) {
11993 injectedStyles = /* @__PURE__ */ new Set();
11994 runtime.injectedStyles.set(targetDocument, injectedStyles);
11995 }
11996 if (injectedStyles.has(hash)) {
11997 return;
11998 }
11999 if (documentContainsStyleHash7(targetDocument, hash)) {
12000 injectedStyles.add(hash);
12001 return;
12002 }
12003 const style = targetDocument.createElement("style");
12004 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash);
12005 style.appendChild(targetDocument.createTextNode(css));
12006 targetDocument.head.appendChild(style);
12007 injectedStyles.add(hash);
12008 }
12009 function registerDocument7(targetDocument) {
12010 const runtime = getRuntime7();
12011 runtime.documents.set(
12012 targetDocument,
12013 (runtime.documents.get(targetDocument) ?? 0) + 1
12014 );
12015 for (const [hash, css] of runtime.styles) {
12016 injectStyle7(targetDocument, hash, css);
12017 }
12018 return () => {
12019 const count = runtime.documents.get(targetDocument);
12020 if (count === void 0) {
12021 return;
12022 }
12023 if (count <= 1) {
12024 runtime.documents.delete(targetDocument);
12025 return;
12026 }
12027 runtime.documents.set(targetDocument, count - 1);
12028 };
12029 }
12030 function registerStyle7(hash, css) {
12031 const runtime = getRuntime7();
12032 runtime.styles.set(hash, css);
12033 for (const targetDocument of runtime.documents.keys()) {
12034 injectStyle7(targetDocument, hash, css);
12035 }
12036 }
12037 if (typeof process === "undefined" || true) {
12038 registerStyle7("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}");
12039 }
12040 var style_default6 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
12041 var VisuallyHidden = (0, import_element19.forwardRef)(
12042 function VisuallyHidden2({ render: render4, ...restProps }, ref) {
12043 const element = useRender({
12044 render: render4,
12045 ref,
12046 props: mergeProps(
12047 { className: style_default6["visually-hidden"] },
12048 restProps,
12049 {
12050 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
12051 "data-visually-hidden": ""
12052 }
12053 )
12054 });
12055 return element;
12056 }
12057 );
12058
12059 // packages/ui/build-module/utils/keyboard-shortcut.mjs
12060 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
12061 function useKeyboardShortcutProps({
12062 "aria-describedby": ariaDescribedBy,
12063 "aria-keyshortcuts": ariaKeyShortcuts,
12064 shortcut
12065 }) {
12066 const generatedDescriptionId = (0, import_element20.useId)();
12067 const descriptionId = shortcut ? generatedDescriptionId : void 0;
12068 const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" ");
12069 return {
12070 descriptionId,
12071 targetProps: {
12072 "aria-describedby": describedBy || void 0,
12073 "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts
12074 }
12075 };
12076 }
12077 var KeyboardShortcutDescription = (0, import_element20.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) {
12078 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
12079 VisuallyHidden,
12080 {
12081 id: descriptionId,
12082 "aria-hidden": "true",
12083 render: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { ref }),
12084 children: (0, import_i18n3.sprintf)(
12085 /* translators: %s: keyboard shortcut. */
12086 (0, import_i18n3.__)("Keyboard shortcut: %s"),
12087 shortcut.label ?? shortcut.ariaKeyShortcut
12088 )
12089 }
12090 );
12091 });
12092 var KeyboardShortcutDisplay = (0, import_element20.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) {
12093 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut });
12094 });
12095
12096 // packages/ui/build-module/button/button.mjs
12097 var import_element21 = __toESM(require_element(), 1);
12098 var import_i18n4 = __toESM(require_i18n(), 1);
12099 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
12100 import { speak } from "@wordpress/a11y";
12101 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash";
12102 function getRuntime8() {
12103 const globalScope = globalThis;
12104 if (globalScope.__wpStyleRuntime) {
12105 return globalScope.__wpStyleRuntime;
12106 }
12107 globalScope.__wpStyleRuntime = {
12108 documents: /* @__PURE__ */ new Map(),
12109 styles: /* @__PURE__ */ new Map(),
12110 injectedStyles: /* @__PURE__ */ new WeakMap()
12111 };
12112 if (typeof document !== "undefined") {
12113 registerDocument8(document);
12114 }
12115 return globalScope.__wpStyleRuntime;
12116 }
12117 function documentContainsStyleHash8(targetDocument, hash) {
12118 if (!targetDocument.head) {
12119 return false;
12120 }
12121 for (const style of targetDocument.head.querySelectorAll(
12122 `style[${STYLE_HASH_ATTRIBUTE8}]`
12123 )) {
12124 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) {
12125 return true;
12126 }
12127 }
12128 return false;
12129 }
12130 function injectStyle8(targetDocument, hash, css) {
12131 if (!targetDocument.head) {
12132 return;
12133 }
12134 const runtime = getRuntime8();
12135 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12136 if (!injectedStyles) {
12137 injectedStyles = /* @__PURE__ */ new Set();
12138 runtime.injectedStyles.set(targetDocument, injectedStyles);
12139 }
12140 if (injectedStyles.has(hash)) {
12141 return;
12142 }
12143 if (documentContainsStyleHash8(targetDocument, hash)) {
12144 injectedStyles.add(hash);
12145 return;
12146 }
12147 const style = targetDocument.createElement("style");
12148 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash);
12149 style.appendChild(targetDocument.createTextNode(css));
12150 targetDocument.head.appendChild(style);
12151 injectedStyles.add(hash);
12152 }
12153 function registerDocument8(targetDocument) {
12154 const runtime = getRuntime8();
12155 runtime.documents.set(
12156 targetDocument,
12157 (runtime.documents.get(targetDocument) ?? 0) + 1
12158 );
12159 for (const [hash, css] of runtime.styles) {
12160 injectStyle8(targetDocument, hash, css);
12161 }
12162 return () => {
12163 const count = runtime.documents.get(targetDocument);
12164 if (count === void 0) {
12165 return;
12166 }
12167 if (count <= 1) {
12168 runtime.documents.delete(targetDocument);
12169 return;
12170 }
12171 runtime.documents.set(targetDocument, count - 1);
12172 };
12173 }
12174 function registerStyle8(hash, css) {
12175 const runtime = getRuntime8();
12176 runtime.styles.set(hash, css);
12177 for (const targetDocument of runtime.documents.keys()) {
12178 injectStyle8(targetDocument, hash, css);
12179 }
12180 }
12181 if (typeof process === "undefined" || true) {
12182 registerStyle8("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-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-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-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:var(--wpds-dimension-size-lg,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-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/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:border-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:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-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-background-interactive-brand-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-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-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-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-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-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{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)}}}');
12183 }
12184 var style_default7 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "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" };
12185 if (typeof process === "undefined" || true) {
12186 registerStyle8("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
12187 }
12188 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
12189 if (typeof process === "undefined" || true) {
12190 registerStyle8("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
12191 }
12192 var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
12193 if (typeof process === "undefined" || true) {
12194 registerStyle8("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
12195 }
12196 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", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
12197 var Button3 = (0, import_element21.forwardRef)(
12198 function Button22({
12199 tone = "brand",
12200 variant = "solid",
12201 size: size4 = "default",
12202 className,
12203 focusableWhenDisabled = true,
12204 disabled: disabled2,
12205 loading,
12206 loadingAnnouncement = (0, import_i18n4.__)("Loading"),
12207 children,
12208 ...props
12209 }, ref) {
12210 const mergedClassName = clsx_default(
12211 global_css_defense_default3.button,
12212 resets_default3["box-sizing"],
12213 focus_module_default2["outset-ring--focus-except-active"],
12214 variant !== "unstyled" && style_default7.button,
12215 style_default7[`is-${tone}`],
12216 style_default7[`is-${variant}`],
12217 style_default7[`is-${size4}`],
12218 loading && style_default7["is-loading"],
12219 className
12220 );
12221 (0, import_element21.useEffect)(() => {
12222 if (loading && loadingAnnouncement) {
12223 speak(loadingAnnouncement);
12224 }
12225 }, [loading, loadingAnnouncement]);
12226 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
12227 Button,
12228 {
12229 ref,
12230 className: mergedClassName,
12231 focusableWhenDisabled,
12232 disabled: disabled2 ?? loading,
12233 ...props,
12234 children
12235 }
12236 );
12237 }
12238 );
12239
12240 // packages/ui/build-module/button/icon.mjs
12241 var import_element22 = __toESM(require_element(), 1);
12242 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
12243 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash";
12244 function getRuntime9() {
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 registerDocument9(document);
12256 }
12257 return globalScope.__wpStyleRuntime;
12258 }
12259 function documentContainsStyleHash9(targetDocument, hash) {
12260 if (!targetDocument.head) {
12261 return false;
12262 }
12263 for (const style of targetDocument.head.querySelectorAll(
12264 `style[${STYLE_HASH_ATTRIBUTE9}]`
12265 )) {
12266 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) {
12267 return true;
12268 }
12269 }
12270 return false;
12271 }
12272 function injectStyle9(targetDocument, hash, css) {
12273 if (!targetDocument.head) {
12274 return;
12275 }
12276 const runtime = getRuntime9();
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 (documentContainsStyleHash9(targetDocument, hash)) {
12286 injectedStyles.add(hash);
12287 return;
12288 }
12289 const style = targetDocument.createElement("style");
12290 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash);
12291 style.appendChild(targetDocument.createTextNode(css));
12292 targetDocument.head.appendChild(style);
12293 injectedStyles.add(hash);
12294 }
12295 function registerDocument9(targetDocument) {
12296 const runtime = getRuntime9();
12297 runtime.documents.set(
12298 targetDocument,
12299 (runtime.documents.get(targetDocument) ?? 0) + 1
12300 );
12301 for (const [hash, css] of runtime.styles) {
12302 injectStyle9(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 registerStyle9(hash, css) {
12317 const runtime = getRuntime9();
12318 runtime.styles.set(hash, css);
12319 for (const targetDocument of runtime.documents.keys()) {
12320 injectStyle9(targetDocument, hash, css);
12321 }
12322 }
12323 if (typeof process === "undefined" || true) {
12324 registerStyle9("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-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-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-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:var(--wpds-dimension-size-lg,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-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/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:border-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:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-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-background-interactive-brand-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-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-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-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-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-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{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)}}}');
12325 }
12326 var style_default8 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "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" };
12327 var ButtonIcon = (0, import_element22.forwardRef)(
12328 function ButtonIcon2({ className, icon, ...props }, ref) {
12329 return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
12330 Icon,
12331 {
12332 ref,
12333 icon,
12334 className: clsx_default(style_default8.icon, className),
12335 size: 24,
12336 ...props
12337 }
12338 );
12339 }
12340 );
12341
12342 // packages/ui/build-module/button/index.mjs
12343 ButtonIcon.displayName = "Button.Icon";
12344 var Button4 = Object.assign(Button3, {
12345 /**
12346 * An icon component specifically designed to work well when rendered inside
12347 * a `Button` component.
12348 */
12349 Icon: ButtonIcon
12350 });
12351
12352 // node_modules/@date-fns/tz/tzName/index.js
12353 function tzName(timeZone, date, format7 = "long") {
12354 return new Intl.DateTimeFormat("en-US", {
12355 // Enforces engine to render the time. Without the option JavaScriptCore omits it.
12356 hour: "numeric",
12357 timeZone,
12358 timeZoneName: format7
12359 }).format(date).split(/\s/g).slice(2).join(" ");
12360 }
12361
12362 // node_modules/@date-fns/tz/tzOffset/index.js
12363 var offsetFormatCache = {};
12364 var offsetCache = {};
12365 function tzOffset(timeZone, date) {
12366 try {
12367 const format7 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
12368 timeZone,
12369 timeZoneName: "longOffset"
12370 }).format;
12371 const offsetStr = format7(date).split("GMT")[1];
12372 if (offsetStr in offsetCache) return offsetCache[offsetStr];
12373 return calcOffset(offsetStr, offsetStr.split(":"));
12374 } catch {
12375 if (timeZone in offsetCache) return offsetCache[timeZone];
12376 const captures = timeZone?.match(offsetRe);
12377 if (captures) return calcOffset(timeZone, captures.slice(1));
12378 return NaN;
12379 }
12380 }
12381 var offsetRe = /([+-]\d\d):?(\d\d)?/;
12382 function calcOffset(cacheStr, values) {
12383 const hours = +(values[0] || 0);
12384 const minutes = +(values[1] || 0);
12385 const seconds = +(values[2] || 0) / 60;
12386 return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
12387 }
12388
12389 // node_modules/@date-fns/tz/date/mini.js
12390 var TZDateMini = class _TZDateMini extends Date {
12391 //#region static
12392 constructor(...args) {
12393 super();
12394 if (args.length > 1 && typeof args[args.length - 1] === "string") {
12395 this.timeZone = args.pop();
12396 }
12397 this.internal = /* @__PURE__ */ new Date();
12398 if (isNaN(tzOffset(this.timeZone, this))) {
12399 this.setTime(NaN);
12400 } else {
12401 if (!args.length) {
12402 this.setTime(Date.now());
12403 } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
12404 this.setTime(args[0]);
12405 } else if (typeof args[0] === "string") {
12406 this.setTime(+new Date(args[0]));
12407 } else if (args[0] instanceof Date) {
12408 this.setTime(+args[0]);
12409 } else {
12410 this.setTime(+new Date(...args));
12411 adjustToSystemTZ(this, args);
12412 }
12413 }
12414 }
12415 static tz(tz, ...args) {
12416 return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
12417 }
12418 //#endregion
12419 //#region time zone
12420 withTimeZone(timeZone) {
12421 return new _TZDateMini(+this, timeZone);
12422 }
12423 getTimezoneOffset() {
12424 const offset4 = -tzOffset(this.timeZone, this);
12425 return offset4 > 0 ? Math.floor(offset4) : Math.ceil(offset4);
12426 }
12427 //#endregion
12428 //#region time
12429 setTime(_time) {
12430 Date.prototype.setTime.apply(this, arguments);
12431 syncToInternal(this);
12432 return +this;
12433 }
12434 //#endregion
12435 //#region date-fns integration
12436 [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
12437 return new _TZDateMini(+new Date(date), this.timeZone);
12438 }
12439 //#endregion
12440 };
12441 var re = /^(get|set)(?!UTC)/;
12442 Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
12443 if (!re.test(method)) return;
12444 const utcMethod = method.replace(re, "$1UTC");
12445 if (!TZDateMini.prototype[utcMethod]) return;
12446 if (method.startsWith("get")) {
12447 TZDateMini.prototype[method] = function() {
12448 return this.internal[utcMethod]();
12449 };
12450 } else {
12451 TZDateMini.prototype[method] = function() {
12452 Date.prototype[utcMethod].apply(this.internal, arguments);
12453 syncFromInternal(this);
12454 return +this;
12455 };
12456 TZDateMini.prototype[utcMethod] = function() {
12457 Date.prototype[utcMethod].apply(this, arguments);
12458 syncToInternal(this);
12459 return +this;
12460 };
12461 }
12462 });
12463 function syncToInternal(date) {
12464 date.internal.setTime(+date);
12465 date.internal.setUTCSeconds(date.internal.getUTCSeconds() - // Round after converting minutes to seconds to avoid fractional offset
12466 // precision errors from historical offsets.
12467 Math.round(-tzOffset(date.timeZone, date) * 60));
12468 }
12469 function syncFromInternal(date) {
12470 Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
12471 Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
12472 adjustToSystemTZ(date);
12473 }
12474 function adjustToSystemTZ(date, constructorArgs) {
12475 const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal;
12476 const offsetWithSeconds = tzOffset(date.timeZone, date);
12477 const offset4 = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds);
12478 const prevHour = /* @__PURE__ */ new Date(+date);
12479 prevHour.setUTCHours(prevHour.getUTCHours() - 1);
12480 const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
12481 const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
12482 const systemDSTChange = systemOffset - prevHourSystemOffset;
12483 let systemOffsetForDiff = systemOffset;
12484 if (systemDSTChange && systemOffset !== offset4) {
12485 const systemHour = Date.prototype.getHours.apply(date);
12486 const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours();
12487 if (systemHour !== expectedHour) {
12488 const testDate = /* @__PURE__ */ new Date(+date);
12489 const testOffsetDiff = systemOffset - offset4;
12490 if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff);
12491 const testOffsetWithSeconds = tzOffset(date.timeZone, testDate);
12492 const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds);
12493 if (testOffset === offset4) systemOffsetForDiff = prevHourSystemOffset;
12494 }
12495 }
12496 const offsetDiff = systemOffsetForDiff - offset4;
12497 if (offsetDiff)
12498 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
12499 const systemDate = /* @__PURE__ */ new Date(+date);
12500 systemDate.setUTCSeconds(0);
12501 const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
12502 const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
12503 if (secondsOffset || systemSecondsOffset)
12504 Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
12505 const postOffsetWithSeconds = tzOffset(date.timeZone, date);
12506 const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds);
12507 const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
12508 const postOffsetDiff = postSystemOffset - postOffset;
12509 const offsetChanged = postOffset !== offset4;
12510 const postDiff = postOffsetDiff - offsetDiff;
12511 const targetDSTShift = postOffset - offset4;
12512 const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1e3;
12513 const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1e3 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime;
12514 if (offsetChanged && postDiff && !normalizedTargetDSTGap) {
12515 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
12516 const newOffsetWithSeconds = tzOffset(date.timeZone, date);
12517 const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds);
12518 const offsetChange = postOffset - newOffset;
12519 if (offsetChange && postDiff < 0) {
12520 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
12521 }
12522 }
12523 syncToInternal(date);
12524 const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1e3;
12525 const drift = expectedTime - +date.internal;
12526 if (drift && Math.abs(drift) < 30 * 60 * 1e3) {
12527 Date.prototype.setTime.call(date, +date + drift);
12528 syncToInternal(date);
12529 }
12530 }
12531 function constructorArgsToInternalTime(args) {
12532 return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3));
12533 }
12534 function targetInternalTime(date, time) {
12535 const internal = new Date(time ?? +date);
12536 internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60));
12537 return +internal;
12538 }
12539
12540 // node_modules/@date-fns/tz/date/index.js
12541 var TZDate = class _TZDate extends TZDateMini {
12542 //#region static
12543 static tz(tz, ...args) {
12544 return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
12545 }
12546 //#endregion
12547 //#region representation
12548 toISOString() {
12549 const [sign, hours, minutes] = this.tzComponents();
12550 const tz = `${sign}${hours}:${minutes}`;
12551 return this.internal.toISOString().slice(0, -1) + tz;
12552 }
12553 toString() {
12554 return `${this.toDateString()} ${this.toTimeString()}`;
12555 }
12556 toDateString() {
12557 const [day, date, month, year] = this.internal.toUTCString().split(" ");
12558 return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
12559 }
12560 toTimeString() {
12561 const time = this.internal.toUTCString().split(" ")[4];
12562 const [sign, hours, minutes] = this.tzComponents();
12563 return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
12564 }
12565 toLocaleString(locales, options) {
12566 return Date.prototype.toLocaleString.call(this, locales, {
12567 ...options,
12568 timeZone: options?.timeZone || this.timeZone
12569 });
12570 }
12571 toLocaleDateString(locales, options) {
12572 return Date.prototype.toLocaleDateString.call(this, locales, {
12573 ...options,
12574 timeZone: options?.timeZone || this.timeZone
12575 });
12576 }
12577 toLocaleTimeString(locales, options) {
12578 return Date.prototype.toLocaleTimeString.call(this, locales, {
12579 ...options,
12580 timeZone: options?.timeZone || this.timeZone
12581 });
12582 }
12583 //#endregion
12584 //#region private
12585 tzComponents() {
12586 const offset4 = this.getTimezoneOffset();
12587 const sign = offset4 > 0 ? "-" : "+";
12588 const hours = String(Math.floor(Math.abs(offset4) / 60)).padStart(2, "0");
12589 const minutes = String(Math.abs(offset4) % 60).padStart(2, "0");
12590 return [sign, hours, minutes];
12591 }
12592 //#endregion
12593 withTimeZone(timeZone) {
12594 return new _TZDate(+this, timeZone);
12595 }
12596 //#region date-fns integration
12597 [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
12598 return new _TZDate(+new Date(date), this.timeZone);
12599 }
12600 //#endregion
12601 };
12602
12603 // node_modules/date-fns/constants.js
12604 var daysInYear = 365.2425;
12605 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
12606 var minTime = -maxTime;
12607 var millisecondsInWeek = 6048e5;
12608 var millisecondsInDay = 864e5;
12609 var millisecondsInMinute = 6e4;
12610 var millisecondsInHour = 36e5;
12611 var millisecondsInSecond = 1e3;
12612 var secondsInHour = 3600;
12613 var secondsInDay = secondsInHour * 24;
12614 var secondsInWeek = secondsInDay * 7;
12615 var secondsInYear = secondsInDay * daysInYear;
12616 var secondsInMonth = secondsInYear / 12;
12617 var secondsInQuarter = secondsInMonth * 3;
12618 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
12619
12620 // node_modules/date-fns/constructFrom.js
12621 function constructFrom(date, value) {
12622 if (typeof date === "function") return date(value);
12623 if (date && typeof date === "object" && constructFromSymbol in date)
12624 return date[constructFromSymbol](value);
12625 if (date instanceof Date) return new date.constructor(value);
12626 return new Date(value);
12627 }
12628
12629 // node_modules/date-fns/toDate.js
12630 function toDate(argument, context) {
12631 return constructFrom(context || argument, argument);
12632 }
12633
12634 // node_modules/date-fns/addDays.js
12635 function addDays(date, amount, options) {
12636 const _date = toDate(date, options?.in);
12637 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
12638 if (!amount) return _date;
12639 _date.setDate(_date.getDate() + amount);
12640 return _date;
12641 }
12642
12643 // node_modules/date-fns/addMonths.js
12644 function addMonths(date, amount, options) {
12645 const _date = toDate(date, options?.in);
12646 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
12647 if (!amount) {
12648 return _date;
12649 }
12650 const dayOfMonth = _date.getDate();
12651 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
12652 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
12653 const daysInMonth = endOfDesiredMonth.getDate();
12654 if (dayOfMonth >= daysInMonth) {
12655 return endOfDesiredMonth;
12656 } else {
12657 _date.setFullYear(
12658 endOfDesiredMonth.getFullYear(),
12659 endOfDesiredMonth.getMonth(),
12660 dayOfMonth
12661 );
12662 return _date;
12663 }
12664 }
12665
12666 // node_modules/date-fns/_lib/defaultOptions.js
12667 var defaultOptions = {};
12668 function getDefaultOptions() {
12669 return defaultOptions;
12670 }
12671
12672 // node_modules/date-fns/startOfWeek.js
12673 function startOfWeek(date, options) {
12674 const defaultOptions2 = getDefaultOptions();
12675 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
12676 const _date = toDate(date, options?.in);
12677 const day = _date.getDay();
12678 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
12679 _date.setDate(_date.getDate() - diff);
12680 _date.setHours(0, 0, 0, 0);
12681 return _date;
12682 }
12683
12684 // node_modules/date-fns/startOfISOWeek.js
12685 function startOfISOWeek(date, options) {
12686 return startOfWeek(date, { ...options, weekStartsOn: 1 });
12687 }
12688
12689 // node_modules/date-fns/getISOWeekYear.js
12690 function getISOWeekYear(date, options) {
12691 const _date = toDate(date, options?.in);
12692 const year = _date.getFullYear();
12693 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
12694 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
12695 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
12696 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
12697 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
12698 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
12699 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
12700 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
12701 if (_date.getTime() >= startOfNextYear.getTime()) {
12702 return year + 1;
12703 } else if (_date.getTime() >= startOfThisYear.getTime()) {
12704 return year;
12705 } else {
12706 return year - 1;
12707 }
12708 }
12709
12710 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
12711 function getTimezoneOffsetInMilliseconds(date) {
12712 const _date = toDate(date);
12713 const utcDate = new Date(
12714 Date.UTC(
12715 _date.getFullYear(),
12716 _date.getMonth(),
12717 _date.getDate(),
12718 _date.getHours(),
12719 _date.getMinutes(),
12720 _date.getSeconds(),
12721 _date.getMilliseconds()
12722 )
12723 );
12724 utcDate.setUTCFullYear(_date.getFullYear());
12725 return +date - +utcDate;
12726 }
12727
12728 // node_modules/date-fns/_lib/normalizeDates.js
12729 function normalizeDates(context, ...dates) {
12730 const normalize = constructFrom.bind(
12731 null,
12732 context || dates.find((date) => typeof date === "object")
12733 );
12734 return dates.map(normalize);
12735 }
12736
12737 // node_modules/date-fns/startOfDay.js
12738 function startOfDay(date, options) {
12739 const _date = toDate(date, options?.in);
12740 _date.setHours(0, 0, 0, 0);
12741 return _date;
12742 }
12743
12744 // node_modules/date-fns/differenceInCalendarDays.js
12745 function differenceInCalendarDays(laterDate, earlierDate, options) {
12746 const [laterDate_, earlierDate_] = normalizeDates(
12747 options?.in,
12748 laterDate,
12749 earlierDate
12750 );
12751 const laterStartOfDay = startOfDay(laterDate_);
12752 const earlierStartOfDay = startOfDay(earlierDate_);
12753 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
12754 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
12755 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
12756 }
12757
12758 // node_modules/date-fns/startOfISOWeekYear.js
12759 function startOfISOWeekYear(date, options) {
12760 const year = getISOWeekYear(date, options);
12761 const fourthOfJanuary = constructFrom(options?.in || date, 0);
12762 fourthOfJanuary.setFullYear(year, 0, 4);
12763 fourthOfJanuary.setHours(0, 0, 0, 0);
12764 return startOfISOWeek(fourthOfJanuary);
12765 }
12766
12767 // node_modules/date-fns/addWeeks.js
12768 function addWeeks(date, amount, options) {
12769 return addDays(date, amount * 7, options);
12770 }
12771
12772 // node_modules/date-fns/addYears.js
12773 function addYears(date, amount, options) {
12774 return addMonths(date, amount * 12, options);
12775 }
12776
12777 // node_modules/date-fns/areIntervalsOverlapping.js
12778 function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
12779 const [leftStartTime, leftEndTime] = [
12780 +toDate(intervalLeft.start, options?.in),
12781 +toDate(intervalLeft.end, options?.in)
12782 ].sort((a, b) => a - b);
12783 const [rightStartTime, rightEndTime] = [
12784 +toDate(intervalRight.start, options?.in),
12785 +toDate(intervalRight.end, options?.in)
12786 ].sort((a, b) => a - b);
12787 if (options?.inclusive)
12788 return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
12789 return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
12790 }
12791
12792 // node_modules/date-fns/max.js
12793 function max2(dates, options) {
12794 let result;
12795 let context = options?.in;
12796 dates.forEach((date) => {
12797 if (!context && typeof date === "object")
12798 context = constructFrom.bind(null, date);
12799 const date_ = toDate(date, context);
12800 if (!result || result < date_ || isNaN(+date_)) result = date_;
12801 });
12802 return constructFrom(context, result || NaN);
12803 }
12804
12805 // node_modules/date-fns/min.js
12806 function min2(dates, options) {
12807 let result;
12808 let context = options?.in;
12809 dates.forEach((date) => {
12810 if (!context && typeof date === "object")
12811 context = constructFrom.bind(null, date);
12812 const date_ = toDate(date, context);
12813 if (!result || result > date_ || isNaN(+date_)) result = date_;
12814 });
12815 return constructFrom(context, result || NaN);
12816 }
12817
12818 // node_modules/date-fns/isSameDay.js
12819 function isSameDay(laterDate, earlierDate, options) {
12820 const [dateLeft_, dateRight_] = normalizeDates(
12821 options?.in,
12822 laterDate,
12823 earlierDate
12824 );
12825 return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
12826 }
12827
12828 // node_modules/date-fns/isDate.js
12829 function isDate(value) {
12830 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
12831 }
12832
12833 // node_modules/date-fns/isValid.js
12834 function isValid(date) {
12835 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
12836 }
12837
12838 // node_modules/date-fns/differenceInCalendarMonths.js
12839 function differenceInCalendarMonths(laterDate, earlierDate, options) {
12840 const [laterDate_, earlierDate_] = normalizeDates(
12841 options?.in,
12842 laterDate,
12843 earlierDate
12844 );
12845 const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
12846 const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
12847 return yearsDiff * 12 + monthsDiff;
12848 }
12849
12850 // node_modules/date-fns/endOfMonth.js
12851 function endOfMonth(date, options) {
12852 const _date = toDate(date, options?.in);
12853 const month = _date.getMonth();
12854 _date.setFullYear(_date.getFullYear(), month + 1, 0);
12855 _date.setHours(23, 59, 59, 999);
12856 return _date;
12857 }
12858
12859 // node_modules/date-fns/_lib/normalizeInterval.js
12860 function normalizeInterval(context, interval) {
12861 const [start2, end] = normalizeDates(context, interval.start, interval.end);
12862 return { start: start2, end };
12863 }
12864
12865 // node_modules/date-fns/eachMonthOfInterval.js
12866 function eachMonthOfInterval(interval, options) {
12867 const { start: start2, end } = normalizeInterval(options?.in, interval);
12868 let reversed = +start2 > +end;
12869 const endTime = reversed ? +start2 : +end;
12870 const date = reversed ? end : start2;
12871 date.setHours(0, 0, 0, 0);
12872 date.setDate(1);
12873 let step = options?.step ?? 1;
12874 if (!step) return [];
12875 if (step < 0) {
12876 step = -step;
12877 reversed = !reversed;
12878 }
12879 const dates = [];
12880 while (+date <= endTime) {
12881 dates.push(constructFrom(start2, date));
12882 date.setMonth(date.getMonth() + step);
12883 }
12884 return reversed ? dates.reverse() : dates;
12885 }
12886
12887 // node_modules/date-fns/startOfMonth.js
12888 function startOfMonth(date, options) {
12889 const _date = toDate(date, options?.in);
12890 _date.setDate(1);
12891 _date.setHours(0, 0, 0, 0);
12892 return _date;
12893 }
12894
12895 // node_modules/date-fns/endOfYear.js
12896 function endOfYear(date, options) {
12897 const _date = toDate(date, options?.in);
12898 const year = _date.getFullYear();
12899 _date.setFullYear(year + 1, 0, 0);
12900 _date.setHours(23, 59, 59, 999);
12901 return _date;
12902 }
12903
12904 // node_modules/date-fns/startOfYear.js
12905 function startOfYear(date, options) {
12906 const date_ = toDate(date, options?.in);
12907 date_.setFullYear(date_.getFullYear(), 0, 1);
12908 date_.setHours(0, 0, 0, 0);
12909 return date_;
12910 }
12911
12912 // node_modules/date-fns/eachYearOfInterval.js
12913 function eachYearOfInterval(interval, options) {
12914 const { start: start2, end } = normalizeInterval(options?.in, interval);
12915 let reversed = +start2 > +end;
12916 const endTime = reversed ? +start2 : +end;
12917 const date = reversed ? end : start2;
12918 date.setHours(0, 0, 0, 0);
12919 date.setMonth(0, 1);
12920 let step = options?.step ?? 1;
12921 if (!step) return [];
12922 if (step < 0) {
12923 step = -step;
12924 reversed = !reversed;
12925 }
12926 const dates = [];
12927 while (+date <= endTime) {
12928 dates.push(constructFrom(start2, date));
12929 date.setFullYear(date.getFullYear() + step);
12930 }
12931 return reversed ? dates.reverse() : dates;
12932 }
12933
12934 // node_modules/date-fns/endOfWeek.js
12935 function endOfWeek(date, options) {
12936 const defaultOptions2 = getDefaultOptions();
12937 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
12938 const _date = toDate(date, options?.in);
12939 const day = _date.getDay();
12940 const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
12941 _date.setDate(_date.getDate() + diff);
12942 _date.setHours(23, 59, 59, 999);
12943 return _date;
12944 }
12945
12946 // node_modules/date-fns/endOfISOWeek.js
12947 function endOfISOWeek(date, options) {
12948 return endOfWeek(date, { ...options, weekStartsOn: 1 });
12949 }
12950
12951 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js
12952 var formatDistanceLocale = {
12953 lessThanXSeconds: {
12954 one: "less than a second",
12955 other: "less than {{count}} seconds"
12956 },
12957 xSeconds: {
12958 one: "1 second",
12959 other: "{{count}} seconds"
12960 },
12961 halfAMinute: "half a minute",
12962 lessThanXMinutes: {
12963 one: "less than a minute",
12964 other: "less than {{count}} minutes"
12965 },
12966 xMinutes: {
12967 one: "1 minute",
12968 other: "{{count}} minutes"
12969 },
12970 aboutXHours: {
12971 one: "about 1 hour",
12972 other: "about {{count}} hours"
12973 },
12974 xHours: {
12975 one: "1 hour",
12976 other: "{{count}} hours"
12977 },
12978 xDays: {
12979 one: "1 day",
12980 other: "{{count}} days"
12981 },
12982 aboutXWeeks: {
12983 one: "about 1 week",
12984 other: "about {{count}} weeks"
12985 },
12986 xWeeks: {
12987 one: "1 week",
12988 other: "{{count}} weeks"
12989 },
12990 aboutXMonths: {
12991 one: "about 1 month",
12992 other: "about {{count}} months"
12993 },
12994 xMonths: {
12995 one: "1 month",
12996 other: "{{count}} months"
12997 },
12998 aboutXYears: {
12999 one: "about 1 year",
13000 other: "about {{count}} years"
13001 },
13002 xYears: {
13003 one: "1 year",
13004 other: "{{count}} years"
13005 },
13006 overXYears: {
13007 one: "over 1 year",
13008 other: "over {{count}} years"
13009 },
13010 almostXYears: {
13011 one: "almost 1 year",
13012 other: "almost {{count}} years"
13013 }
13014 };
13015 var formatDistance = (token, count, options) => {
13016 let result;
13017 const tokenValue = formatDistanceLocale[token];
13018 if (typeof tokenValue === "string") {
13019 result = tokenValue;
13020 } else if (count === 1) {
13021 result = tokenValue.one;
13022 } else {
13023 result = tokenValue.other.replace("{{count}}", count.toString());
13024 }
13025 if (options?.addSuffix) {
13026 if (options.comparison && options.comparison > 0) {
13027 return "in " + result;
13028 } else {
13029 return result + " ago";
13030 }
13031 }
13032 return result;
13033 };
13034
13035 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js
13036 function buildFormatLongFn(args) {
13037 return (options = {}) => {
13038 const width = options.width ? String(options.width) : args.defaultWidth;
13039 const format7 = args.formats[width] || args.formats[args.defaultWidth];
13040 return format7;
13041 };
13042 }
13043
13044 // node_modules/date-fns/locale/en-US/_lib/formatLong.js
13045 var dateFormats = {
13046 full: "EEEE, MMMM do, y",
13047 long: "MMMM do, y",
13048 medium: "MMM d, y",
13049 short: "MM/dd/yyyy"
13050 };
13051 var timeFormats = {
13052 full: "h:mm:ss a zzzz",
13053 long: "h:mm:ss a z",
13054 medium: "h:mm:ss a",
13055 short: "h:mm a"
13056 };
13057 var dateTimeFormats = {
13058 full: "{{date}} 'at' {{time}}",
13059 long: "{{date}} 'at' {{time}}",
13060 medium: "{{date}}, {{time}}",
13061 short: "{{date}}, {{time}}"
13062 };
13063 var formatLong = {
13064 date: buildFormatLongFn({
13065 formats: dateFormats,
13066 defaultWidth: "full"
13067 }),
13068 time: buildFormatLongFn({
13069 formats: timeFormats,
13070 defaultWidth: "full"
13071 }),
13072 dateTime: buildFormatLongFn({
13073 formats: dateTimeFormats,
13074 defaultWidth: "full"
13075 })
13076 };
13077
13078 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js
13079 var formatRelativeLocale = {
13080 lastWeek: "'last' eeee 'at' p",
13081 yesterday: "'yesterday at' p",
13082 today: "'today at' p",
13083 tomorrow: "'tomorrow at' p",
13084 nextWeek: "eeee 'at' p",
13085 other: "P"
13086 };
13087 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
13088
13089 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js
13090 function buildLocalizeFn(args) {
13091 return (value, options) => {
13092 const context = options?.context ? String(options.context) : "standalone";
13093 let valuesArray;
13094 if (context === "formatting" && args.formattingValues) {
13095 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
13096 const width = options?.width ? String(options.width) : defaultWidth;
13097 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
13098 } else {
13099 const defaultWidth = args.defaultWidth;
13100 const width = options?.width ? String(options.width) : args.defaultWidth;
13101 valuesArray = args.values[width] || args.values[defaultWidth];
13102 }
13103 const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
13104 return valuesArray[index2];
13105 };
13106 }
13107
13108 // node_modules/date-fns/locale/en-US/_lib/localize.js
13109 var eraValues = {
13110 narrow: ["B", "A"],
13111 abbreviated: ["BC", "AD"],
13112 wide: ["Before Christ", "Anno Domini"]
13113 };
13114 var quarterValues = {
13115 narrow: ["1", "2", "3", "4"],
13116 abbreviated: ["Q1", "Q2", "Q3", "Q4"],
13117 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
13118 };
13119 var monthValues = {
13120 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
13121 abbreviated: [
13122 "Jan",
13123 "Feb",
13124 "Mar",
13125 "Apr",
13126 "May",
13127 "Jun",
13128 "Jul",
13129 "Aug",
13130 "Sep",
13131 "Oct",
13132 "Nov",
13133 "Dec"
13134 ],
13135 wide: [
13136 "January",
13137 "February",
13138 "March",
13139 "April",
13140 "May",
13141 "June",
13142 "July",
13143 "August",
13144 "September",
13145 "October",
13146 "November",
13147 "December"
13148 ]
13149 };
13150 var dayValues = {
13151 narrow: ["S", "M", "T", "W", "T", "F", "S"],
13152 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
13153 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
13154 wide: [
13155 "Sunday",
13156 "Monday",
13157 "Tuesday",
13158 "Wednesday",
13159 "Thursday",
13160 "Friday",
13161 "Saturday"
13162 ]
13163 };
13164 var dayPeriodValues = {
13165 narrow: {
13166 am: "a",
13167 pm: "p",
13168 midnight: "mi",
13169 noon: "n",
13170 morning: "morning",
13171 afternoon: "afternoon",
13172 evening: "evening",
13173 night: "night"
13174 },
13175 abbreviated: {
13176 am: "AM",
13177 pm: "PM",
13178 midnight: "midnight",
13179 noon: "noon",
13180 morning: "morning",
13181 afternoon: "afternoon",
13182 evening: "evening",
13183 night: "night"
13184 },
13185 wide: {
13186 am: "a.m.",
13187 pm: "p.m.",
13188 midnight: "midnight",
13189 noon: "noon",
13190 morning: "morning",
13191 afternoon: "afternoon",
13192 evening: "evening",
13193 night: "night"
13194 }
13195 };
13196 var formattingDayPeriodValues = {
13197 narrow: {
13198 am: "a",
13199 pm: "p",
13200 midnight: "mi",
13201 noon: "n",
13202 morning: "in the morning",
13203 afternoon: "in the afternoon",
13204 evening: "in the evening",
13205 night: "at night"
13206 },
13207 abbreviated: {
13208 am: "AM",
13209 pm: "PM",
13210 midnight: "midnight",
13211 noon: "noon",
13212 morning: "in the morning",
13213 afternoon: "in the afternoon",
13214 evening: "in the evening",
13215 night: "at night"
13216 },
13217 wide: {
13218 am: "a.m.",
13219 pm: "p.m.",
13220 midnight: "midnight",
13221 noon: "noon",
13222 morning: "in the morning",
13223 afternoon: "in the afternoon",
13224 evening: "in the evening",
13225 night: "at night"
13226 }
13227 };
13228 var ordinalNumber = (dirtyNumber, _options) => {
13229 const number = Number(dirtyNumber);
13230 const rem100 = number % 100;
13231 if (rem100 > 20 || rem100 < 10) {
13232 switch (rem100 % 10) {
13233 case 1:
13234 return number + "st";
13235 case 2:
13236 return number + "nd";
13237 case 3:
13238 return number + "rd";
13239 }
13240 }
13241 return number + "th";
13242 };
13243 var localize = {
13244 ordinalNumber,
13245 era: buildLocalizeFn({
13246 values: eraValues,
13247 defaultWidth: "wide"
13248 }),
13249 quarter: buildLocalizeFn({
13250 values: quarterValues,
13251 defaultWidth: "wide",
13252 argumentCallback: (quarter) => quarter - 1
13253 }),
13254 month: buildLocalizeFn({
13255 values: monthValues,
13256 defaultWidth: "wide"
13257 }),
13258 day: buildLocalizeFn({
13259 values: dayValues,
13260 defaultWidth: "wide"
13261 }),
13262 dayPeriod: buildLocalizeFn({
13263 values: dayPeriodValues,
13264 defaultWidth: "wide",
13265 formattingValues: formattingDayPeriodValues,
13266 defaultFormattingWidth: "wide"
13267 })
13268 };
13269
13270 // node_modules/date-fns/locale/_lib/buildMatchFn.js
13271 function buildMatchFn(args) {
13272 return (string, options = {}) => {
13273 const width = options.width;
13274 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
13275 const matchResult = string.match(matchPattern);
13276 if (!matchResult) {
13277 return null;
13278 }
13279 const matchedString = matchResult[0];
13280 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
13281 const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
13282 // [TODO] -- I challenge you to fix the type
13283 findKey(parsePatterns, (pattern) => pattern.test(matchedString))
13284 );
13285 let value;
13286 value = args.valueCallback ? args.valueCallback(key) : key;
13287 value = options.valueCallback ? (
13288 // [TODO] -- I challenge you to fix the type
13289 options.valueCallback(value)
13290 ) : value;
13291 const rest = string.slice(matchedString.length);
13292 return { value, rest };
13293 };
13294 }
13295 function findKey(object, predicate) {
13296 for (const key in object) {
13297 if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
13298 return key;
13299 }
13300 }
13301 return void 0;
13302 }
13303 function findIndex(array, predicate) {
13304 for (let key = 0; key < array.length; key++) {
13305 if (predicate(array[key])) {
13306 return key;
13307 }
13308 }
13309 return void 0;
13310 }
13311
13312 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
13313 function buildMatchPatternFn(args) {
13314 return (string, options = {}) => {
13315 const matchResult = string.match(args.matchPattern);
13316 if (!matchResult) return null;
13317 const matchedString = matchResult[0];
13318 const parseResult = string.match(args.parsePattern);
13319 if (!parseResult) return null;
13320 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
13321 value = options.valueCallback ? options.valueCallback(value) : value;
13322 const rest = string.slice(matchedString.length);
13323 return { value, rest };
13324 };
13325 }
13326
13327 // node_modules/date-fns/locale/en-US/_lib/match.js
13328 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
13329 var parseOrdinalNumberPattern = /\d+/i;
13330 var matchEraPatterns = {
13331 narrow: /^(b|a)/i,
13332 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
13333 wide: /^(before christ|before common era|anno domini|common era)/i
13334 };
13335 var parseEraPatterns = {
13336 any: [/^b/i, /^(a|c)/i]
13337 };
13338 var matchQuarterPatterns = {
13339 narrow: /^[1234]/i,
13340 abbreviated: /^q[1234]/i,
13341 wide: /^[1234](th|st|nd|rd)? quarter/i
13342 };
13343 var parseQuarterPatterns = {
13344 any: [/1/i, /2/i, /3/i, /4/i]
13345 };
13346 var matchMonthPatterns = {
13347 narrow: /^[jfmasond]/i,
13348 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
13349 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
13350 };
13351 var parseMonthPatterns = {
13352 narrow: [
13353 /^j/i,
13354 /^f/i,
13355 /^m/i,
13356 /^a/i,
13357 /^m/i,
13358 /^j/i,
13359 /^j/i,
13360 /^a/i,
13361 /^s/i,
13362 /^o/i,
13363 /^n/i,
13364 /^d/i
13365 ],
13366 any: [
13367 /^ja/i,
13368 /^f/i,
13369 /^mar/i,
13370 /^ap/i,
13371 /^may/i,
13372 /^jun/i,
13373 /^jul/i,
13374 /^au/i,
13375 /^s/i,
13376 /^o/i,
13377 /^n/i,
13378 /^d/i
13379 ]
13380 };
13381 var matchDayPatterns = {
13382 narrow: /^[smtwf]/i,
13383 short: /^(su|mo|tu|we|th|fr|sa)/i,
13384 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
13385 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
13386 };
13387 var parseDayPatterns = {
13388 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
13389 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
13390 };
13391 var matchDayPeriodPatterns = {
13392 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
13393 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
13394 };
13395 var parseDayPeriodPatterns = {
13396 any: {
13397 am: /^a/i,
13398 pm: /^p/i,
13399 midnight: /^mi/i,
13400 noon: /^no/i,
13401 morning: /morning/i,
13402 afternoon: /afternoon/i,
13403 evening: /evening/i,
13404 night: /night/i
13405 }
13406 };
13407 var match = {
13408 ordinalNumber: buildMatchPatternFn({
13409 matchPattern: matchOrdinalNumberPattern,
13410 parsePattern: parseOrdinalNumberPattern,
13411 valueCallback: (value) => parseInt(value, 10)
13412 }),
13413 era: buildMatchFn({
13414 matchPatterns: matchEraPatterns,
13415 defaultMatchWidth: "wide",
13416 parsePatterns: parseEraPatterns,
13417 defaultParseWidth: "any"
13418 }),
13419 quarter: buildMatchFn({
13420 matchPatterns: matchQuarterPatterns,
13421 defaultMatchWidth: "wide",
13422 parsePatterns: parseQuarterPatterns,
13423 defaultParseWidth: "any",
13424 valueCallback: (index2) => index2 + 1
13425 }),
13426 month: buildMatchFn({
13427 matchPatterns: matchMonthPatterns,
13428 defaultMatchWidth: "wide",
13429 parsePatterns: parseMonthPatterns,
13430 defaultParseWidth: "any"
13431 }),
13432 day: buildMatchFn({
13433 matchPatterns: matchDayPatterns,
13434 defaultMatchWidth: "wide",
13435 parsePatterns: parseDayPatterns,
13436 defaultParseWidth: "any"
13437 }),
13438 dayPeriod: buildMatchFn({
13439 matchPatterns: matchDayPeriodPatterns,
13440 defaultMatchWidth: "any",
13441 parsePatterns: parseDayPeriodPatterns,
13442 defaultParseWidth: "any"
13443 })
13444 };
13445
13446 // node_modules/date-fns/locale/en-US.js
13447 var enUS = {
13448 code: "en-US",
13449 formatDistance,
13450 formatLong,
13451 formatRelative,
13452 localize,
13453 match,
13454 options: {
13455 weekStartsOn: 0,
13456 firstWeekContainsDate: 1
13457 }
13458 };
13459
13460 // node_modules/date-fns/getDayOfYear.js
13461 function getDayOfYear(date, options) {
13462 const _date = toDate(date, options?.in);
13463 const diff = differenceInCalendarDays(_date, startOfYear(_date));
13464 const dayOfYear = diff + 1;
13465 return dayOfYear;
13466 }
13467
13468 // node_modules/date-fns/getISOWeek.js
13469 function getISOWeek(date, options) {
13470 const _date = toDate(date, options?.in);
13471 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
13472 return Math.round(diff / millisecondsInWeek) + 1;
13473 }
13474
13475 // node_modules/date-fns/getWeekYear.js
13476 function getWeekYear(date, options) {
13477 const _date = toDate(date, options?.in);
13478 const year = _date.getFullYear();
13479 const defaultOptions2 = getDefaultOptions();
13480 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
13481 const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
13482 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
13483 firstWeekOfNextYear.setHours(0, 0, 0, 0);
13484 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
13485 const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
13486 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
13487 firstWeekOfThisYear.setHours(0, 0, 0, 0);
13488 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
13489 if (+_date >= +startOfNextYear) {
13490 return year + 1;
13491 } else if (+_date >= +startOfThisYear) {
13492 return year;
13493 } else {
13494 return year - 1;
13495 }
13496 }
13497
13498 // node_modules/date-fns/startOfWeekYear.js
13499 function startOfWeekYear(date, options) {
13500 const defaultOptions2 = getDefaultOptions();
13501 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
13502 const year = getWeekYear(date, options);
13503 const firstWeek = constructFrom(options?.in || date, 0);
13504 firstWeek.setFullYear(year, 0, firstWeekContainsDate);
13505 firstWeek.setHours(0, 0, 0, 0);
13506 const _date = startOfWeek(firstWeek, options);
13507 return _date;
13508 }
13509
13510 // node_modules/date-fns/getWeek.js
13511 function getWeek(date, options) {
13512 const _date = toDate(date, options?.in);
13513 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
13514 return Math.round(diff / millisecondsInWeek) + 1;
13515 }
13516
13517 // node_modules/date-fns/_lib/addLeadingZeros.js
13518 function addLeadingZeros(number, targetLength) {
13519 const sign = number < 0 ? "-" : "";
13520 const output = Math.abs(number).toString().padStart(targetLength, "0");
13521 return sign + output;
13522 }
13523
13524 // node_modules/date-fns/_lib/format/lightFormatters.js
13525 var lightFormatters = {
13526 // Year
13527 y(date, token) {
13528 const signedYear = date.getFullYear();
13529 const year = signedYear > 0 ? signedYear : 1 - signedYear;
13530 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
13531 },
13532 // Month
13533 M(date, token) {
13534 const month = date.getMonth();
13535 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
13536 },
13537 // Day of the month
13538 d(date, token) {
13539 return addLeadingZeros(date.getDate(), token.length);
13540 },
13541 // AM or PM
13542 a(date, token) {
13543 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
13544 switch (token) {
13545 case "a":
13546 case "aa":
13547 return dayPeriodEnumValue.toUpperCase();
13548 case "aaa":
13549 return dayPeriodEnumValue;
13550 case "aaaaa":
13551 return dayPeriodEnumValue[0];
13552 case "aaaa":
13553 default:
13554 return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
13555 }
13556 },
13557 // Hour [1-12]
13558 h(date, token) {
13559 return addLeadingZeros(date.getHours() % 12 || 12, token.length);
13560 },
13561 // Hour [0-23]
13562 H(date, token) {
13563 return addLeadingZeros(date.getHours(), token.length);
13564 },
13565 // Minute
13566 m(date, token) {
13567 return addLeadingZeros(date.getMinutes(), token.length);
13568 },
13569 // Second
13570 s(date, token) {
13571 return addLeadingZeros(date.getSeconds(), token.length);
13572 },
13573 // Fraction of second
13574 S(date, token) {
13575 const numberOfDigits = token.length;
13576 const milliseconds = date.getMilliseconds();
13577 const fractionalSeconds = Math.trunc(
13578 milliseconds * Math.pow(10, numberOfDigits - 3)
13579 );
13580 return addLeadingZeros(fractionalSeconds, token.length);
13581 }
13582 };
13583
13584 // node_modules/date-fns/_lib/format/formatters.js
13585 var dayPeriodEnum = {
13586 am: "am",
13587 pm: "pm",
13588 midnight: "midnight",
13589 noon: "noon",
13590 morning: "morning",
13591 afternoon: "afternoon",
13592 evening: "evening",
13593 night: "night"
13594 };
13595 var formatters = {
13596 // Era
13597 G: function(date, token, localize2) {
13598 const era = date.getFullYear() > 0 ? 1 : 0;
13599 switch (token) {
13600 // AD, BC
13601 case "G":
13602 case "GG":
13603 case "GGG":
13604 return localize2.era(era, { width: "abbreviated" });
13605 // A, B
13606 case "GGGGG":
13607 return localize2.era(era, { width: "narrow" });
13608 // Anno Domini, Before Christ
13609 case "GGGG":
13610 default:
13611 return localize2.era(era, { width: "wide" });
13612 }
13613 },
13614 // Year
13615 y: function(date, token, localize2) {
13616 if (token === "yo") {
13617 const signedYear = date.getFullYear();
13618 const year = signedYear > 0 ? signedYear : 1 - signedYear;
13619 return localize2.ordinalNumber(year, { unit: "year" });
13620 }
13621 return lightFormatters.y(date, token);
13622 },
13623 // Local week-numbering year
13624 Y: function(date, token, localize2, options) {
13625 const signedWeekYear = getWeekYear(date, options);
13626 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
13627 if (token === "YY") {
13628 const twoDigitYear = weekYear % 100;
13629 return addLeadingZeros(twoDigitYear, 2);
13630 }
13631 if (token === "Yo") {
13632 return localize2.ordinalNumber(weekYear, { unit: "year" });
13633 }
13634 return addLeadingZeros(weekYear, token.length);
13635 },
13636 // ISO week-numbering year
13637 R: function(date, token) {
13638 const isoWeekYear = getISOWeekYear(date);
13639 return addLeadingZeros(isoWeekYear, token.length);
13640 },
13641 // Extended year. This is a single number designating the year of this calendar system.
13642 // The main difference between `y` and `u` localizers are B.C. years:
13643 // | Year | `y` | `u` |
13644 // |------|-----|-----|
13645 // | AC 1 | 1 | 1 |
13646 // | BC 1 | 1 | 0 |
13647 // | BC 2 | 2 | -1 |
13648 // Also `yy` always returns the last two digits of a year,
13649 // while `uu` pads single digit years to 2 characters and returns other years unchanged.
13650 u: function(date, token) {
13651 const year = date.getFullYear();
13652 return addLeadingZeros(year, token.length);
13653 },
13654 // Quarter
13655 Q: function(date, token, localize2) {
13656 const quarter = Math.ceil((date.getMonth() + 1) / 3);
13657 switch (token) {
13658 // 1, 2, 3, 4
13659 case "Q":
13660 return String(quarter);
13661 // 01, 02, 03, 04
13662 case "QQ":
13663 return addLeadingZeros(quarter, 2);
13664 // 1st, 2nd, 3rd, 4th
13665 case "Qo":
13666 return localize2.ordinalNumber(quarter, { unit: "quarter" });
13667 // Q1, Q2, Q3, Q4
13668 case "QQQ":
13669 return localize2.quarter(quarter, {
13670 width: "abbreviated",
13671 context: "formatting"
13672 });
13673 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13674 case "QQQQQ":
13675 return localize2.quarter(quarter, {
13676 width: "narrow",
13677 context: "formatting"
13678 });
13679 // 1st quarter, 2nd quarter, ...
13680 case "QQQQ":
13681 default:
13682 return localize2.quarter(quarter, {
13683 width: "wide",
13684 context: "formatting"
13685 });
13686 }
13687 },
13688 // Stand-alone quarter
13689 q: function(date, token, localize2) {
13690 const quarter = Math.ceil((date.getMonth() + 1) / 3);
13691 switch (token) {
13692 // 1, 2, 3, 4
13693 case "q":
13694 return String(quarter);
13695 // 01, 02, 03, 04
13696 case "qq":
13697 return addLeadingZeros(quarter, 2);
13698 // 1st, 2nd, 3rd, 4th
13699 case "qo":
13700 return localize2.ordinalNumber(quarter, { unit: "quarter" });
13701 // Q1, Q2, Q3, Q4
13702 case "qqq":
13703 return localize2.quarter(quarter, {
13704 width: "abbreviated",
13705 context: "standalone"
13706 });
13707 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13708 case "qqqqq":
13709 return localize2.quarter(quarter, {
13710 width: "narrow",
13711 context: "standalone"
13712 });
13713 // 1st quarter, 2nd quarter, ...
13714 case "qqqq":
13715 default:
13716 return localize2.quarter(quarter, {
13717 width: "wide",
13718 context: "standalone"
13719 });
13720 }
13721 },
13722 // Month
13723 M: function(date, token, localize2) {
13724 const month = date.getMonth();
13725 switch (token) {
13726 case "M":
13727 case "MM":
13728 return lightFormatters.M(date, token);
13729 // 1st, 2nd, ..., 12th
13730 case "Mo":
13731 return localize2.ordinalNumber(month + 1, { unit: "month" });
13732 // Jan, Feb, ..., Dec
13733 case "MMM":
13734 return localize2.month(month, {
13735 width: "abbreviated",
13736 context: "formatting"
13737 });
13738 // J, F, ..., D
13739 case "MMMMM":
13740 return localize2.month(month, {
13741 width: "narrow",
13742 context: "formatting"
13743 });
13744 // January, February, ..., December
13745 case "MMMM":
13746 default:
13747 return localize2.month(month, { width: "wide", context: "formatting" });
13748 }
13749 },
13750 // Stand-alone month
13751 L: function(date, token, localize2) {
13752 const month = date.getMonth();
13753 switch (token) {
13754 // 1, 2, ..., 12
13755 case "L":
13756 return String(month + 1);
13757 // 01, 02, ..., 12
13758 case "LL":
13759 return addLeadingZeros(month + 1, 2);
13760 // 1st, 2nd, ..., 12th
13761 case "Lo":
13762 return localize2.ordinalNumber(month + 1, { unit: "month" });
13763 // Jan, Feb, ..., Dec
13764 case "LLL":
13765 return localize2.month(month, {
13766 width: "abbreviated",
13767 context: "standalone"
13768 });
13769 // J, F, ..., D
13770 case "LLLLL":
13771 return localize2.month(month, {
13772 width: "narrow",
13773 context: "standalone"
13774 });
13775 // January, February, ..., December
13776 case "LLLL":
13777 default:
13778 return localize2.month(month, { width: "wide", context: "standalone" });
13779 }
13780 },
13781 // Local week of year
13782 w: function(date, token, localize2, options) {
13783 const week = getWeek(date, options);
13784 if (token === "wo") {
13785 return localize2.ordinalNumber(week, { unit: "week" });
13786 }
13787 return addLeadingZeros(week, token.length);
13788 },
13789 // ISO week of year
13790 I: function(date, token, localize2) {
13791 const isoWeek = getISOWeek(date);
13792 if (token === "Io") {
13793 return localize2.ordinalNumber(isoWeek, { unit: "week" });
13794 }
13795 return addLeadingZeros(isoWeek, token.length);
13796 },
13797 // Day of the month
13798 d: function(date, token, localize2) {
13799 if (token === "do") {
13800 return localize2.ordinalNumber(date.getDate(), { unit: "date" });
13801 }
13802 return lightFormatters.d(date, token);
13803 },
13804 // Day of year
13805 D: function(date, token, localize2) {
13806 const dayOfYear = getDayOfYear(date);
13807 if (token === "Do") {
13808 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
13809 }
13810 return addLeadingZeros(dayOfYear, token.length);
13811 },
13812 // Day of week
13813 E: function(date, token, localize2) {
13814 const dayOfWeek = date.getDay();
13815 switch (token) {
13816 // Tue
13817 case "E":
13818 case "EE":
13819 case "EEE":
13820 return localize2.day(dayOfWeek, {
13821 width: "abbreviated",
13822 context: "formatting"
13823 });
13824 // T
13825 case "EEEEE":
13826 return localize2.day(dayOfWeek, {
13827 width: "narrow",
13828 context: "formatting"
13829 });
13830 // Tu
13831 case "EEEEEE":
13832 return localize2.day(dayOfWeek, {
13833 width: "short",
13834 context: "formatting"
13835 });
13836 // Tuesday
13837 case "EEEE":
13838 default:
13839 return localize2.day(dayOfWeek, {
13840 width: "wide",
13841 context: "formatting"
13842 });
13843 }
13844 },
13845 // Local day of week
13846 e: function(date, token, localize2, options) {
13847 const dayOfWeek = date.getDay();
13848 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
13849 switch (token) {
13850 // Numerical value (Nth day of week with current locale or weekStartsOn)
13851 case "e":
13852 return String(localDayOfWeek);
13853 // Padded numerical value
13854 case "ee":
13855 return addLeadingZeros(localDayOfWeek, 2);
13856 // 1st, 2nd, ..., 7th
13857 case "eo":
13858 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
13859 case "eee":
13860 return localize2.day(dayOfWeek, {
13861 width: "abbreviated",
13862 context: "formatting"
13863 });
13864 // T
13865 case "eeeee":
13866 return localize2.day(dayOfWeek, {
13867 width: "narrow",
13868 context: "formatting"
13869 });
13870 // Tu
13871 case "eeeeee":
13872 return localize2.day(dayOfWeek, {
13873 width: "short",
13874 context: "formatting"
13875 });
13876 // Tuesday
13877 case "eeee":
13878 default:
13879 return localize2.day(dayOfWeek, {
13880 width: "wide",
13881 context: "formatting"
13882 });
13883 }
13884 },
13885 // Stand-alone local day of week
13886 c: function(date, token, localize2, options) {
13887 const dayOfWeek = date.getDay();
13888 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
13889 switch (token) {
13890 // Numerical value (same as in `e`)
13891 case "c":
13892 return String(localDayOfWeek);
13893 // Padded numerical value
13894 case "cc":
13895 return addLeadingZeros(localDayOfWeek, token.length);
13896 // 1st, 2nd, ..., 7th
13897 case "co":
13898 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
13899 case "ccc":
13900 return localize2.day(dayOfWeek, {
13901 width: "abbreviated",
13902 context: "standalone"
13903 });
13904 // T
13905 case "ccccc":
13906 return localize2.day(dayOfWeek, {
13907 width: "narrow",
13908 context: "standalone"
13909 });
13910 // Tu
13911 case "cccccc":
13912 return localize2.day(dayOfWeek, {
13913 width: "short",
13914 context: "standalone"
13915 });
13916 // Tuesday
13917 case "cccc":
13918 default:
13919 return localize2.day(dayOfWeek, {
13920 width: "wide",
13921 context: "standalone"
13922 });
13923 }
13924 },
13925 // ISO day of week
13926 i: function(date, token, localize2) {
13927 const dayOfWeek = date.getDay();
13928 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
13929 switch (token) {
13930 // 2
13931 case "i":
13932 return String(isoDayOfWeek);
13933 // 02
13934 case "ii":
13935 return addLeadingZeros(isoDayOfWeek, token.length);
13936 // 2nd
13937 case "io":
13938 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
13939 // Tue
13940 case "iii":
13941 return localize2.day(dayOfWeek, {
13942 width: "abbreviated",
13943 context: "formatting"
13944 });
13945 // T
13946 case "iiiii":
13947 return localize2.day(dayOfWeek, {
13948 width: "narrow",
13949 context: "formatting"
13950 });
13951 // Tu
13952 case "iiiiii":
13953 return localize2.day(dayOfWeek, {
13954 width: "short",
13955 context: "formatting"
13956 });
13957 // Tuesday
13958 case "iiii":
13959 default:
13960 return localize2.day(dayOfWeek, {
13961 width: "wide",
13962 context: "formatting"
13963 });
13964 }
13965 },
13966 // AM or PM
13967 a: function(date, token, localize2) {
13968 const hours = date.getHours();
13969 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
13970 switch (token) {
13971 case "a":
13972 case "aa":
13973 return localize2.dayPeriod(dayPeriodEnumValue, {
13974 width: "abbreviated",
13975 context: "formatting"
13976 });
13977 case "aaa":
13978 return localize2.dayPeriod(dayPeriodEnumValue, {
13979 width: "abbreviated",
13980 context: "formatting"
13981 }).toLowerCase();
13982 case "aaaaa":
13983 return localize2.dayPeriod(dayPeriodEnumValue, {
13984 width: "narrow",
13985 context: "formatting"
13986 });
13987 case "aaaa":
13988 default:
13989 return localize2.dayPeriod(dayPeriodEnumValue, {
13990 width: "wide",
13991 context: "formatting"
13992 });
13993 }
13994 },
13995 // AM, PM, midnight, noon
13996 b: function(date, token, localize2) {
13997 const hours = date.getHours();
13998 let dayPeriodEnumValue;
13999 if (hours === 12) {
14000 dayPeriodEnumValue = dayPeriodEnum.noon;
14001 } else if (hours === 0) {
14002 dayPeriodEnumValue = dayPeriodEnum.midnight;
14003 } else {
14004 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
14005 }
14006 switch (token) {
14007 case "b":
14008 case "bb":
14009 return localize2.dayPeriod(dayPeriodEnumValue, {
14010 width: "abbreviated",
14011 context: "formatting"
14012 });
14013 case "bbb":
14014 return localize2.dayPeriod(dayPeriodEnumValue, {
14015 width: "abbreviated",
14016 context: "formatting"
14017 }).toLowerCase();
14018 case "bbbbb":
14019 return localize2.dayPeriod(dayPeriodEnumValue, {
14020 width: "narrow",
14021 context: "formatting"
14022 });
14023 case "bbbb":
14024 default:
14025 return localize2.dayPeriod(dayPeriodEnumValue, {
14026 width: "wide",
14027 context: "formatting"
14028 });
14029 }
14030 },
14031 // in the morning, in the afternoon, in the evening, at night
14032 B: function(date, token, localize2) {
14033 const hours = date.getHours();
14034 let dayPeriodEnumValue;
14035 if (hours >= 17) {
14036 dayPeriodEnumValue = dayPeriodEnum.evening;
14037 } else if (hours >= 12) {
14038 dayPeriodEnumValue = dayPeriodEnum.afternoon;
14039 } else if (hours >= 4) {
14040 dayPeriodEnumValue = dayPeriodEnum.morning;
14041 } else {
14042 dayPeriodEnumValue = dayPeriodEnum.night;
14043 }
14044 switch (token) {
14045 case "B":
14046 case "BB":
14047 case "BBB":
14048 return localize2.dayPeriod(dayPeriodEnumValue, {
14049 width: "abbreviated",
14050 context: "formatting"
14051 });
14052 case "BBBBB":
14053 return localize2.dayPeriod(dayPeriodEnumValue, {
14054 width: "narrow",
14055 context: "formatting"
14056 });
14057 case "BBBB":
14058 default:
14059 return localize2.dayPeriod(dayPeriodEnumValue, {
14060 width: "wide",
14061 context: "formatting"
14062 });
14063 }
14064 },
14065 // Hour [1-12]
14066 h: function(date, token, localize2) {
14067 if (token === "ho") {
14068 let hours = date.getHours() % 12;
14069 if (hours === 0) hours = 12;
14070 return localize2.ordinalNumber(hours, { unit: "hour" });
14071 }
14072 return lightFormatters.h(date, token);
14073 },
14074 // Hour [0-23]
14075 H: function(date, token, localize2) {
14076 if (token === "Ho") {
14077 return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
14078 }
14079 return lightFormatters.H(date, token);
14080 },
14081 // Hour [0-11]
14082 K: function(date, token, localize2) {
14083 const hours = date.getHours() % 12;
14084 if (token === "Ko") {
14085 return localize2.ordinalNumber(hours, { unit: "hour" });
14086 }
14087 return addLeadingZeros(hours, token.length);
14088 },
14089 // Hour [1-24]
14090 k: function(date, token, localize2) {
14091 let hours = date.getHours();
14092 if (hours === 0) hours = 24;
14093 if (token === "ko") {
14094 return localize2.ordinalNumber(hours, { unit: "hour" });
14095 }
14096 return addLeadingZeros(hours, token.length);
14097 },
14098 // Minute
14099 m: function(date, token, localize2) {
14100 if (token === "mo") {
14101 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
14102 }
14103 return lightFormatters.m(date, token);
14104 },
14105 // Second
14106 s: function(date, token, localize2) {
14107 if (token === "so") {
14108 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
14109 }
14110 return lightFormatters.s(date, token);
14111 },
14112 // Fraction of second
14113 S: function(date, token) {
14114 return lightFormatters.S(date, token);
14115 },
14116 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
14117 X: function(date, token, _localize) {
14118 const timezoneOffset = date.getTimezoneOffset();
14119 if (timezoneOffset === 0) {
14120 return "Z";
14121 }
14122 switch (token) {
14123 // Hours and optional minutes
14124 case "X":
14125 return formatTimezoneWithOptionalMinutes(timezoneOffset);
14126 // Hours, minutes and optional seconds without `:` delimiter
14127 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14128 // so this token always has the same output as `XX`
14129 case "XXXX":
14130 case "XX":
14131 return formatTimezone(timezoneOffset);
14132 // Hours, minutes and optional seconds with `:` delimiter
14133 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14134 // so this token always has the same output as `XXX`
14135 case "XXXXX":
14136 case "XXX":
14137 // Hours and minutes with `:` delimiter
14138 default:
14139 return formatTimezone(timezoneOffset, ":");
14140 }
14141 },
14142 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
14143 x: function(date, token, _localize) {
14144 const timezoneOffset = date.getTimezoneOffset();
14145 switch (token) {
14146 // Hours and optional minutes
14147 case "x":
14148 return formatTimezoneWithOptionalMinutes(timezoneOffset);
14149 // Hours, minutes and optional seconds without `:` delimiter
14150 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14151 // so this token always has the same output as `xx`
14152 case "xxxx":
14153 case "xx":
14154 return formatTimezone(timezoneOffset);
14155 // Hours, minutes and optional seconds with `:` delimiter
14156 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14157 // so this token always has the same output as `xxx`
14158 case "xxxxx":
14159 case "xxx":
14160 // Hours and minutes with `:` delimiter
14161 default:
14162 return formatTimezone(timezoneOffset, ":");
14163 }
14164 },
14165 // Timezone (GMT)
14166 O: function(date, token, _localize) {
14167 const timezoneOffset = date.getTimezoneOffset();
14168 switch (token) {
14169 // Short
14170 case "O":
14171 case "OO":
14172 case "OOO":
14173 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
14174 // Long
14175 case "OOOO":
14176 default:
14177 return "GMT" + formatTimezone(timezoneOffset, ":");
14178 }
14179 },
14180 // Timezone (specific non-location)
14181 z: function(date, token, _localize) {
14182 const timezoneOffset = date.getTimezoneOffset();
14183 switch (token) {
14184 // Short
14185 case "z":
14186 case "zz":
14187 case "zzz":
14188 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
14189 // Long
14190 case "zzzz":
14191 default:
14192 return "GMT" + formatTimezone(timezoneOffset, ":");
14193 }
14194 },
14195 // Seconds timestamp
14196 t: function(date, token, _localize) {
14197 const timestamp = Math.trunc(+date / 1e3);
14198 return addLeadingZeros(timestamp, token.length);
14199 },
14200 // Milliseconds timestamp
14201 T: function(date, token, _localize) {
14202 return addLeadingZeros(+date, token.length);
14203 }
14204 };
14205 function formatTimezoneShort(offset4, delimiter = "") {
14206 const sign = offset4 > 0 ? "-" : "+";
14207 const absOffset = Math.abs(offset4);
14208 const hours = Math.trunc(absOffset / 60);
14209 const minutes = absOffset % 60;
14210 if (minutes === 0) {
14211 return sign + String(hours);
14212 }
14213 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
14214 }
14215 function formatTimezoneWithOptionalMinutes(offset4, delimiter) {
14216 if (offset4 % 60 === 0) {
14217 const sign = offset4 > 0 ? "-" : "+";
14218 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2);
14219 }
14220 return formatTimezone(offset4, delimiter);
14221 }
14222 function formatTimezone(offset4, delimiter = "") {
14223 const sign = offset4 > 0 ? "-" : "+";
14224 const absOffset = Math.abs(offset4);
14225 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
14226 const minutes = addLeadingZeros(absOffset % 60, 2);
14227 return sign + hours + delimiter + minutes;
14228 }
14229
14230 // node_modules/date-fns/_lib/format/longFormatters.js
14231 var dateLongFormatter = (pattern, formatLong2) => {
14232 switch (pattern) {
14233 case "P":
14234 return formatLong2.date({ width: "short" });
14235 case "PP":
14236 return formatLong2.date({ width: "medium" });
14237 case "PPP":
14238 return formatLong2.date({ width: "long" });
14239 case "PPPP":
14240 default:
14241 return formatLong2.date({ width: "full" });
14242 }
14243 };
14244 var timeLongFormatter = (pattern, formatLong2) => {
14245 switch (pattern) {
14246 case "p":
14247 return formatLong2.time({ width: "short" });
14248 case "pp":
14249 return formatLong2.time({ width: "medium" });
14250 case "ppp":
14251 return formatLong2.time({ width: "long" });
14252 case "pppp":
14253 default:
14254 return formatLong2.time({ width: "full" });
14255 }
14256 };
14257 var dateTimeLongFormatter = (pattern, formatLong2) => {
14258 const matchResult = pattern.match(/(P+)(p+)?/) || [];
14259 const datePattern = matchResult[1];
14260 const timePattern = matchResult[2];
14261 if (!timePattern) {
14262 return dateLongFormatter(pattern, formatLong2);
14263 }
14264 let dateTimeFormat;
14265 switch (datePattern) {
14266 case "P":
14267 dateTimeFormat = formatLong2.dateTime({ width: "short" });
14268 break;
14269 case "PP":
14270 dateTimeFormat = formatLong2.dateTime({ width: "medium" });
14271 break;
14272 case "PPP":
14273 dateTimeFormat = formatLong2.dateTime({ width: "long" });
14274 break;
14275 case "PPPP":
14276 default:
14277 dateTimeFormat = formatLong2.dateTime({ width: "full" });
14278 break;
14279 }
14280 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
14281 };
14282 var longFormatters = {
14283 p: timeLongFormatter,
14284 P: dateTimeLongFormatter
14285 };
14286
14287 // node_modules/date-fns/_lib/protectedTokens.js
14288 var dayOfYearTokenRE = /^D+$/;
14289 var weekYearTokenRE = /^Y+$/;
14290 var throwTokens = ["D", "DD", "YY", "YYYY"];
14291 function isProtectedDayOfYearToken(token) {
14292 return dayOfYearTokenRE.test(token);
14293 }
14294 function isProtectedWeekYearToken(token) {
14295 return weekYearTokenRE.test(token);
14296 }
14297 function warnOrThrowProtectedError(token, format7, input) {
14298 const _message = message(token, format7, input);
14299 console.warn(_message);
14300 if (throwTokens.includes(token)) throw new RangeError(_message);
14301 }
14302 function message(token, format7, input) {
14303 const subject = token[0] === "Y" ? "years" : "days of the month";
14304 return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format7}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
14305 }
14306
14307 // node_modules/date-fns/format.js
14308 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
14309 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
14310 var escapedStringRegExp = /^'([^]*?)'?$/;
14311 var doubleQuoteRegExp = /''/g;
14312 var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
14313 function format(date, formatStr, options) {
14314 const defaultOptions2 = getDefaultOptions();
14315 const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
14316 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
14317 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
14318 const originalDate = toDate(date, options?.in);
14319 if (!isValid(originalDate)) {
14320 throw new RangeError("Invalid time value");
14321 }
14322 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
14323 const firstCharacter = substring[0];
14324 if (firstCharacter === "p" || firstCharacter === "P") {
14325 const longFormatter = longFormatters[firstCharacter];
14326 return longFormatter(substring, locale.formatLong);
14327 }
14328 return substring;
14329 }).join("").match(formattingTokensRegExp).map((substring) => {
14330 if (substring === "''") {
14331 return { isToken: false, value: "'" };
14332 }
14333 const firstCharacter = substring[0];
14334 if (firstCharacter === "'") {
14335 return { isToken: false, value: cleanEscapedString(substring) };
14336 }
14337 if (formatters[firstCharacter]) {
14338 return { isToken: true, value: substring };
14339 }
14340 if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
14341 throw new RangeError(
14342 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
14343 );
14344 }
14345 return { isToken: false, value: substring };
14346 });
14347 if (locale.localize.preprocessor) {
14348 parts = locale.localize.preprocessor(originalDate, parts);
14349 }
14350 const formatterOptions = {
14351 firstWeekContainsDate,
14352 weekStartsOn,
14353 locale
14354 };
14355 return parts.map((part) => {
14356 if (!part.isToken) return part.value;
14357 const token = part.value;
14358 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
14359 warnOrThrowProtectedError(token, formatStr, String(date));
14360 }
14361 const formatter = formatters[token[0]];
14362 return formatter(originalDate, token, locale.localize, formatterOptions);
14363 }).join("");
14364 }
14365 function cleanEscapedString(input) {
14366 const matched = input.match(escapedStringRegExp);
14367 if (!matched) {
14368 return input;
14369 }
14370 return matched[1].replace(doubleQuoteRegExp, "'");
14371 }
14372
14373 // node_modules/date-fns/getDaysInMonth.js
14374 function getDaysInMonth(date, options) {
14375 const _date = toDate(date, options?.in);
14376 const year = _date.getFullYear();
14377 const monthIndex = _date.getMonth();
14378 const lastDayOfMonth = constructFrom(_date, 0);
14379 lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
14380 lastDayOfMonth.setHours(0, 0, 0, 0);
14381 return lastDayOfMonth.getDate();
14382 }
14383
14384 // node_modules/date-fns/getDefaultOptions.js
14385 function getDefaultOptions2() {
14386 return Object.assign({}, getDefaultOptions());
14387 }
14388
14389 // node_modules/date-fns/getISODay.js
14390 function getISODay(date, options) {
14391 const day = toDate(date, options?.in).getDay();
14392 return day === 0 ? 7 : day;
14393 }
14394
14395 // node_modules/date-fns/getMonth.js
14396 function getMonth(date, options) {
14397 return toDate(date, options?.in).getMonth();
14398 }
14399
14400 // node_modules/date-fns/getYear.js
14401 function getYear(date, options) {
14402 return toDate(date, options?.in).getFullYear();
14403 }
14404
14405 // node_modules/date-fns/isAfter.js
14406 function isAfter(date, dateToCompare) {
14407 return +toDate(date) > +toDate(dateToCompare);
14408 }
14409
14410 // node_modules/date-fns/isBefore.js
14411 function isBefore(date, dateToCompare) {
14412 return +toDate(date) < +toDate(dateToCompare);
14413 }
14414
14415 // node_modules/date-fns/transpose.js
14416 function transpose(date, constructor) {
14417 const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0);
14418 date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
14419 date_.setHours(
14420 date.getHours(),
14421 date.getMinutes(),
14422 date.getSeconds(),
14423 date.getMilliseconds()
14424 );
14425 return date_;
14426 }
14427 function isConstructor(constructor) {
14428 return typeof constructor === "function" && constructor.prototype?.constructor === constructor;
14429 }
14430
14431 // node_modules/date-fns/parse/_lib/Setter.js
14432 var TIMEZONE_UNIT_PRIORITY = 10;
14433 var Setter = class {
14434 subPriority = 0;
14435 validate(_utcDate, _options) {
14436 return true;
14437 }
14438 };
14439 var ValueSetter = class extends Setter {
14440 constructor(value, validateValue, setValue, priority2, subPriority) {
14441 super();
14442 this.value = value;
14443 this.validateValue = validateValue;
14444 this.setValue = setValue;
14445 this.priority = priority2;
14446 if (subPriority) {
14447 this.subPriority = subPriority;
14448 }
14449 }
14450 validate(date, options) {
14451 return this.validateValue(date, this.value, options);
14452 }
14453 set(date, flags, options) {
14454 return this.setValue(date, flags, this.value, options);
14455 }
14456 };
14457 var DateTimezoneSetter = class extends Setter {
14458 priority = TIMEZONE_UNIT_PRIORITY;
14459 subPriority = -1;
14460 constructor(context, reference) {
14461 super();
14462 this.context = context || ((date) => constructFrom(reference, date));
14463 }
14464 set(date, flags) {
14465 if (flags.timestampIsSet) return date;
14466 return constructFrom(date, transpose(date, this.context));
14467 }
14468 };
14469
14470 // node_modules/date-fns/parse/_lib/Parser.js
14471 var Parser = class {
14472 run(dateString, token, match2, options) {
14473 const result = this.parse(dateString, token, match2, options);
14474 if (!result) {
14475 return null;
14476 }
14477 return {
14478 setter: new ValueSetter(
14479 result.value,
14480 this.validate,
14481 this.set,
14482 this.priority,
14483 this.subPriority
14484 ),
14485 rest: result.rest
14486 };
14487 }
14488 validate(_utcDate, _value, _options) {
14489 return true;
14490 }
14491 };
14492
14493 // node_modules/date-fns/parse/_lib/parsers/EraParser.js
14494 var EraParser = class extends Parser {
14495 priority = 140;
14496 parse(dateString, token, match2) {
14497 switch (token) {
14498 // AD, BC
14499 case "G":
14500 case "GG":
14501 case "GGG":
14502 return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
14503 // A, B
14504 case "GGGGG":
14505 return match2.era(dateString, { width: "narrow" });
14506 // Anno Domini, Before Christ
14507 case "GGGG":
14508 default:
14509 return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
14510 }
14511 }
14512 set(date, flags, value) {
14513 flags.era = value;
14514 date.setFullYear(value, 0, 1);
14515 date.setHours(0, 0, 0, 0);
14516 return date;
14517 }
14518 incompatibleTokens = ["R", "u", "t", "T"];
14519 };
14520
14521 // node_modules/date-fns/parse/_lib/constants.js
14522 var numericPatterns = {
14523 month: /^(1[0-2]|0?\d)/,
14524 // 0 to 12
14525 date: /^(3[0-1]|[0-2]?\d)/,
14526 // 0 to 31
14527 dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
14528 // 0 to 366
14529 week: /^(5[0-3]|[0-4]?\d)/,
14530 // 0 to 53
14531 hour23h: /^(2[0-3]|[0-1]?\d)/,
14532 // 0 to 23
14533 hour24h: /^(2[0-4]|[0-1]?\d)/,
14534 // 0 to 24
14535 hour11h: /^(1[0-1]|0?\d)/,
14536 // 0 to 11
14537 hour12h: /^(1[0-2]|0?\d)/,
14538 // 0 to 12
14539 minute: /^[0-5]?\d/,
14540 // 0 to 59
14541 second: /^[0-5]?\d/,
14542 // 0 to 59
14543 singleDigit: /^\d/,
14544 // 0 to 9
14545 twoDigits: /^\d{1,2}/,
14546 // 0 to 99
14547 threeDigits: /^\d{1,3}/,
14548 // 0 to 999
14549 fourDigits: /^\d{1,4}/,
14550 // 0 to 9999
14551 anyDigitsSigned: /^-?\d+/,
14552 singleDigitSigned: /^-?\d/,
14553 // 0 to 9, -0 to -9
14554 twoDigitsSigned: /^-?\d{1,2}/,
14555 // 0 to 99, -0 to -99
14556 threeDigitsSigned: /^-?\d{1,3}/,
14557 // 0 to 999, -0 to -999
14558 fourDigitsSigned: /^-?\d{1,4}/
14559 // 0 to 9999, -0 to -9999
14560 };
14561 var timezonePatterns = {
14562 basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
14563 basic: /^([+-])(\d{2})(\d{2})|Z/,
14564 basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
14565 extended: /^([+-])(\d{2}):(\d{2})|Z/,
14566 extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
14567 };
14568
14569 // node_modules/date-fns/parse/_lib/utils.js
14570 function mapValue(parseFnResult, mapFn) {
14571 if (!parseFnResult) {
14572 return parseFnResult;
14573 }
14574 return {
14575 value: mapFn(parseFnResult.value),
14576 rest: parseFnResult.rest
14577 };
14578 }
14579 function parseNumericPattern(pattern, dateString) {
14580 const matchResult = dateString.match(pattern);
14581 if (!matchResult) {
14582 return null;
14583 }
14584 return {
14585 value: parseInt(matchResult[0], 10),
14586 rest: dateString.slice(matchResult[0].length)
14587 };
14588 }
14589 function parseTimezonePattern(pattern, dateString) {
14590 const matchResult = dateString.match(pattern);
14591 if (!matchResult) {
14592 return null;
14593 }
14594 if (matchResult[0] === "Z") {
14595 return {
14596 value: 0,
14597 rest: dateString.slice(1)
14598 };
14599 }
14600 const sign = matchResult[1] === "+" ? 1 : -1;
14601 const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
14602 const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
14603 const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
14604 return {
14605 value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
14606 rest: dateString.slice(matchResult[0].length)
14607 };
14608 }
14609 function parseAnyDigitsSigned(dateString) {
14610 return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
14611 }
14612 function parseNDigits(n, dateString) {
14613 switch (n) {
14614 case 1:
14615 return parseNumericPattern(numericPatterns.singleDigit, dateString);
14616 case 2:
14617 return parseNumericPattern(numericPatterns.twoDigits, dateString);
14618 case 3:
14619 return parseNumericPattern(numericPatterns.threeDigits, dateString);
14620 case 4:
14621 return parseNumericPattern(numericPatterns.fourDigits, dateString);
14622 default:
14623 return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
14624 }
14625 }
14626 function parseNDigitsSigned(n, dateString) {
14627 switch (n) {
14628 case 1:
14629 return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
14630 case 2:
14631 return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
14632 case 3:
14633 return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
14634 case 4:
14635 return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
14636 default:
14637 return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
14638 }
14639 }
14640 function dayPeriodEnumToHours(dayPeriod) {
14641 switch (dayPeriod) {
14642 case "morning":
14643 return 4;
14644 case "evening":
14645 return 17;
14646 case "pm":
14647 case "noon":
14648 case "afternoon":
14649 return 12;
14650 case "am":
14651 case "midnight":
14652 case "night":
14653 default:
14654 return 0;
14655 }
14656 }
14657 function normalizeTwoDigitYear(twoDigitYear, currentYear) {
14658 const isCommonEra = currentYear > 0;
14659 const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
14660 let result;
14661 if (absCurrentYear <= 50) {
14662 result = twoDigitYear || 100;
14663 } else {
14664 const rangeEnd = absCurrentYear + 50;
14665 const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
14666 const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
14667 result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
14668 }
14669 return isCommonEra ? result : 1 - result;
14670 }
14671 function isLeapYearIndex(year) {
14672 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
14673 }
14674
14675 // node_modules/date-fns/parse/_lib/parsers/YearParser.js
14676 var YearParser = class extends Parser {
14677 priority = 130;
14678 incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
14679 parse(dateString, token, match2) {
14680 const valueCallback = (year) => ({
14681 year,
14682 isTwoDigitYear: token === "yy"
14683 });
14684 switch (token) {
14685 case "y":
14686 return mapValue(parseNDigits(4, dateString), valueCallback);
14687 case "yo":
14688 return mapValue(
14689 match2.ordinalNumber(dateString, {
14690 unit: "year"
14691 }),
14692 valueCallback
14693 );
14694 default:
14695 return mapValue(parseNDigits(token.length, dateString), valueCallback);
14696 }
14697 }
14698 validate(_date, value) {
14699 return value.isTwoDigitYear || value.year > 0;
14700 }
14701 set(date, flags, value) {
14702 const currentYear = date.getFullYear();
14703 if (value.isTwoDigitYear) {
14704 const normalizedTwoDigitYear = normalizeTwoDigitYear(
14705 value.year,
14706 currentYear
14707 );
14708 date.setFullYear(normalizedTwoDigitYear, 0, 1);
14709 date.setHours(0, 0, 0, 0);
14710 return date;
14711 }
14712 const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
14713 date.setFullYear(year, 0, 1);
14714 date.setHours(0, 0, 0, 0);
14715 return date;
14716 }
14717 };
14718
14719 // node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js
14720 var LocalWeekYearParser = class extends Parser {
14721 priority = 130;
14722 parse(dateString, token, match2) {
14723 const valueCallback = (year) => ({
14724 year,
14725 isTwoDigitYear: token === "YY"
14726 });
14727 switch (token) {
14728 case "Y":
14729 return mapValue(parseNDigits(4, dateString), valueCallback);
14730 case "Yo":
14731 return mapValue(
14732 match2.ordinalNumber(dateString, {
14733 unit: "year"
14734 }),
14735 valueCallback
14736 );
14737 default:
14738 return mapValue(parseNDigits(token.length, dateString), valueCallback);
14739 }
14740 }
14741 validate(_date, value) {
14742 return value.isTwoDigitYear || value.year > 0;
14743 }
14744 set(date, flags, value, options) {
14745 const currentYear = getWeekYear(date, options);
14746 if (value.isTwoDigitYear) {
14747 const normalizedTwoDigitYear = normalizeTwoDigitYear(
14748 value.year,
14749 currentYear
14750 );
14751 date.setFullYear(
14752 normalizedTwoDigitYear,
14753 0,
14754 options.firstWeekContainsDate
14755 );
14756 date.setHours(0, 0, 0, 0);
14757 return startOfWeek(date, options);
14758 }
14759 const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
14760 date.setFullYear(year, 0, options.firstWeekContainsDate);
14761 date.setHours(0, 0, 0, 0);
14762 return startOfWeek(date, options);
14763 }
14764 incompatibleTokens = [
14765 "y",
14766 "R",
14767 "u",
14768 "Q",
14769 "q",
14770 "M",
14771 "L",
14772 "I",
14773 "d",
14774 "D",
14775 "i",
14776 "t",
14777 "T"
14778 ];
14779 };
14780
14781 // node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js
14782 var ISOWeekYearParser = class extends Parser {
14783 priority = 130;
14784 parse(dateString, token) {
14785 if (token === "R") {
14786 return parseNDigitsSigned(4, dateString);
14787 }
14788 return parseNDigitsSigned(token.length, dateString);
14789 }
14790 set(date, _flags, value) {
14791 const firstWeekOfYear = constructFrom(date, 0);
14792 firstWeekOfYear.setFullYear(value, 0, 4);
14793 firstWeekOfYear.setHours(0, 0, 0, 0);
14794 return startOfISOWeek(firstWeekOfYear);
14795 }
14796 incompatibleTokens = [
14797 "G",
14798 "y",
14799 "Y",
14800 "u",
14801 "Q",
14802 "q",
14803 "M",
14804 "L",
14805 "w",
14806 "d",
14807 "D",
14808 "e",
14809 "c",
14810 "t",
14811 "T"
14812 ];
14813 };
14814
14815 // node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js
14816 var ExtendedYearParser = class extends Parser {
14817 priority = 130;
14818 parse(dateString, token) {
14819 if (token === "u") {
14820 return parseNDigitsSigned(4, dateString);
14821 }
14822 return parseNDigitsSigned(token.length, dateString);
14823 }
14824 set(date, _flags, value) {
14825 date.setFullYear(value, 0, 1);
14826 date.setHours(0, 0, 0, 0);
14827 return date;
14828 }
14829 incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
14830 };
14831
14832 // node_modules/date-fns/parse/_lib/parsers/QuarterParser.js
14833 var QuarterParser = class extends Parser {
14834 priority = 120;
14835 parse(dateString, token, match2) {
14836 switch (token) {
14837 // 1, 2, 3, 4
14838 case "Q":
14839 case "QQ":
14840 return parseNDigits(token.length, dateString);
14841 // 1st, 2nd, 3rd, 4th
14842 case "Qo":
14843 return match2.ordinalNumber(dateString, { unit: "quarter" });
14844 // Q1, Q2, Q3, Q4
14845 case "QQQ":
14846 return match2.quarter(dateString, {
14847 width: "abbreviated",
14848 context: "formatting"
14849 }) || match2.quarter(dateString, {
14850 width: "narrow",
14851 context: "formatting"
14852 });
14853 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
14854 case "QQQQQ":
14855 return match2.quarter(dateString, {
14856 width: "narrow",
14857 context: "formatting"
14858 });
14859 // 1st quarter, 2nd quarter, ...
14860 case "QQQQ":
14861 default:
14862 return match2.quarter(dateString, {
14863 width: "wide",
14864 context: "formatting"
14865 }) || match2.quarter(dateString, {
14866 width: "abbreviated",
14867 context: "formatting"
14868 }) || match2.quarter(dateString, {
14869 width: "narrow",
14870 context: "formatting"
14871 });
14872 }
14873 }
14874 validate(_date, value) {
14875 return value >= 1 && value <= 4;
14876 }
14877 set(date, _flags, value) {
14878 date.setMonth((value - 1) * 3, 1);
14879 date.setHours(0, 0, 0, 0);
14880 return date;
14881 }
14882 incompatibleTokens = [
14883 "Y",
14884 "R",
14885 "q",
14886 "M",
14887 "L",
14888 "w",
14889 "I",
14890 "d",
14891 "D",
14892 "i",
14893 "e",
14894 "c",
14895 "t",
14896 "T"
14897 ];
14898 };
14899
14900 // node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js
14901 var StandAloneQuarterParser = class extends Parser {
14902 priority = 120;
14903 parse(dateString, token, match2) {
14904 switch (token) {
14905 // 1, 2, 3, 4
14906 case "q":
14907 case "qq":
14908 return parseNDigits(token.length, dateString);
14909 // 1st, 2nd, 3rd, 4th
14910 case "qo":
14911 return match2.ordinalNumber(dateString, { unit: "quarter" });
14912 // Q1, Q2, Q3, Q4
14913 case "qqq":
14914 return match2.quarter(dateString, {
14915 width: "abbreviated",
14916 context: "standalone"
14917 }) || match2.quarter(dateString, {
14918 width: "narrow",
14919 context: "standalone"
14920 });
14921 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
14922 case "qqqqq":
14923 return match2.quarter(dateString, {
14924 width: "narrow",
14925 context: "standalone"
14926 });
14927 // 1st quarter, 2nd quarter, ...
14928 case "qqqq":
14929 default:
14930 return match2.quarter(dateString, {
14931 width: "wide",
14932 context: "standalone"
14933 }) || match2.quarter(dateString, {
14934 width: "abbreviated",
14935 context: "standalone"
14936 }) || match2.quarter(dateString, {
14937 width: "narrow",
14938 context: "standalone"
14939 });
14940 }
14941 }
14942 validate(_date, value) {
14943 return value >= 1 && value <= 4;
14944 }
14945 set(date, _flags, value) {
14946 date.setMonth((value - 1) * 3, 1);
14947 date.setHours(0, 0, 0, 0);
14948 return date;
14949 }
14950 incompatibleTokens = [
14951 "Y",
14952 "R",
14953 "Q",
14954 "M",
14955 "L",
14956 "w",
14957 "I",
14958 "d",
14959 "D",
14960 "i",
14961 "e",
14962 "c",
14963 "t",
14964 "T"
14965 ];
14966 };
14967
14968 // node_modules/date-fns/parse/_lib/parsers/MonthParser.js
14969 var MonthParser = class extends Parser {
14970 incompatibleTokens = [
14971 "Y",
14972 "R",
14973 "q",
14974 "Q",
14975 "L",
14976 "w",
14977 "I",
14978 "D",
14979 "i",
14980 "e",
14981 "c",
14982 "t",
14983 "T"
14984 ];
14985 priority = 110;
14986 parse(dateString, token, match2) {
14987 const valueCallback = (value) => value - 1;
14988 switch (token) {
14989 // 1, 2, ..., 12
14990 case "M":
14991 return mapValue(
14992 parseNumericPattern(numericPatterns.month, dateString),
14993 valueCallback
14994 );
14995 // 01, 02, ..., 12
14996 case "MM":
14997 return mapValue(parseNDigits(2, dateString), valueCallback);
14998 // 1st, 2nd, ..., 12th
14999 case "Mo":
15000 return mapValue(
15001 match2.ordinalNumber(dateString, {
15002 unit: "month"
15003 }),
15004 valueCallback
15005 );
15006 // Jan, Feb, ..., Dec
15007 case "MMM":
15008 return match2.month(dateString, {
15009 width: "abbreviated",
15010 context: "formatting"
15011 }) || match2.month(dateString, { width: "narrow", context: "formatting" });
15012 // J, F, ..., D
15013 case "MMMMM":
15014 return match2.month(dateString, {
15015 width: "narrow",
15016 context: "formatting"
15017 });
15018 // January, February, ..., December
15019 case "MMMM":
15020 default:
15021 return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
15022 width: "abbreviated",
15023 context: "formatting"
15024 }) || match2.month(dateString, { width: "narrow", context: "formatting" });
15025 }
15026 }
15027 validate(_date, value) {
15028 return value >= 0 && value <= 11;
15029 }
15030 set(date, _flags, value) {
15031 date.setMonth(value, 1);
15032 date.setHours(0, 0, 0, 0);
15033 return date;
15034 }
15035 };
15036
15037 // node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js
15038 var StandAloneMonthParser = class extends Parser {
15039 priority = 110;
15040 parse(dateString, token, match2) {
15041 const valueCallback = (value) => value - 1;
15042 switch (token) {
15043 // 1, 2, ..., 12
15044 case "L":
15045 return mapValue(
15046 parseNumericPattern(numericPatterns.month, dateString),
15047 valueCallback
15048 );
15049 // 01, 02, ..., 12
15050 case "LL":
15051 return mapValue(parseNDigits(2, dateString), valueCallback);
15052 // 1st, 2nd, ..., 12th
15053 case "Lo":
15054 return mapValue(
15055 match2.ordinalNumber(dateString, {
15056 unit: "month"
15057 }),
15058 valueCallback
15059 );
15060 // Jan, Feb, ..., Dec
15061 case "LLL":
15062 return match2.month(dateString, {
15063 width: "abbreviated",
15064 context: "standalone"
15065 }) || match2.month(dateString, { width: "narrow", context: "standalone" });
15066 // J, F, ..., D
15067 case "LLLLL":
15068 return match2.month(dateString, {
15069 width: "narrow",
15070 context: "standalone"
15071 });
15072 // January, February, ..., December
15073 case "LLLL":
15074 default:
15075 return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
15076 width: "abbreviated",
15077 context: "standalone"
15078 }) || match2.month(dateString, { width: "narrow", context: "standalone" });
15079 }
15080 }
15081 validate(_date, value) {
15082 return value >= 0 && value <= 11;
15083 }
15084 set(date, _flags, value) {
15085 date.setMonth(value, 1);
15086 date.setHours(0, 0, 0, 0);
15087 return date;
15088 }
15089 incompatibleTokens = [
15090 "Y",
15091 "R",
15092 "q",
15093 "Q",
15094 "M",
15095 "w",
15096 "I",
15097 "D",
15098 "i",
15099 "e",
15100 "c",
15101 "t",
15102 "T"
15103 ];
15104 };
15105
15106 // node_modules/date-fns/setWeek.js
15107 function setWeek(date, week, options) {
15108 const date_ = toDate(date, options?.in);
15109 const diff = getWeek(date_, options) - week;
15110 date_.setDate(date_.getDate() - diff * 7);
15111 return toDate(date_, options?.in);
15112 }
15113
15114 // node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js
15115 var LocalWeekParser = class extends Parser {
15116 priority = 100;
15117 parse(dateString, token, match2) {
15118 switch (token) {
15119 case "w":
15120 return parseNumericPattern(numericPatterns.week, dateString);
15121 case "wo":
15122 return match2.ordinalNumber(dateString, { unit: "week" });
15123 default:
15124 return parseNDigits(token.length, dateString);
15125 }
15126 }
15127 validate(_date, value) {
15128 return value >= 1 && value <= 53;
15129 }
15130 set(date, _flags, value, options) {
15131 return startOfWeek(setWeek(date, value, options), options);
15132 }
15133 incompatibleTokens = [
15134 "y",
15135 "R",
15136 "u",
15137 "q",
15138 "Q",
15139 "M",
15140 "L",
15141 "I",
15142 "d",
15143 "D",
15144 "i",
15145 "t",
15146 "T"
15147 ];
15148 };
15149
15150 // node_modules/date-fns/setISOWeek.js
15151 function setISOWeek(date, week, options) {
15152 const _date = toDate(date, options?.in);
15153 const diff = getISOWeek(_date, options) - week;
15154 _date.setDate(_date.getDate() - diff * 7);
15155 return _date;
15156 }
15157
15158 // node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js
15159 var ISOWeekParser = class extends Parser {
15160 priority = 100;
15161 parse(dateString, token, match2) {
15162 switch (token) {
15163 case "I":
15164 return parseNumericPattern(numericPatterns.week, dateString);
15165 case "Io":
15166 return match2.ordinalNumber(dateString, { unit: "week" });
15167 default:
15168 return parseNDigits(token.length, dateString);
15169 }
15170 }
15171 validate(_date, value) {
15172 return value >= 1 && value <= 53;
15173 }
15174 set(date, _flags, value) {
15175 return startOfISOWeek(setISOWeek(date, value));
15176 }
15177 incompatibleTokens = [
15178 "y",
15179 "Y",
15180 "u",
15181 "q",
15182 "Q",
15183 "M",
15184 "L",
15185 "w",
15186 "d",
15187 "D",
15188 "e",
15189 "c",
15190 "t",
15191 "T"
15192 ];
15193 };
15194
15195 // node_modules/date-fns/parse/_lib/parsers/DateParser.js
15196 var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
15197 var DAYS_IN_MONTH_LEAP_YEAR = [
15198 31,
15199 29,
15200 31,
15201 30,
15202 31,
15203 30,
15204 31,
15205 31,
15206 30,
15207 31,
15208 30,
15209 31
15210 ];
15211 var DateParser = class extends Parser {
15212 priority = 90;
15213 subPriority = 1;
15214 parse(dateString, token, match2) {
15215 switch (token) {
15216 case "d":
15217 return parseNumericPattern(numericPatterns.date, dateString);
15218 case "do":
15219 return match2.ordinalNumber(dateString, { unit: "date" });
15220 default:
15221 return parseNDigits(token.length, dateString);
15222 }
15223 }
15224 validate(date, value) {
15225 const year = date.getFullYear();
15226 const isLeapYear = isLeapYearIndex(year);
15227 const month = date.getMonth();
15228 if (isLeapYear) {
15229 return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
15230 } else {
15231 return value >= 1 && value <= DAYS_IN_MONTH[month];
15232 }
15233 }
15234 set(date, _flags, value) {
15235 date.setDate(value);
15236 date.setHours(0, 0, 0, 0);
15237 return date;
15238 }
15239 incompatibleTokens = [
15240 "Y",
15241 "R",
15242 "q",
15243 "Q",
15244 "w",
15245 "I",
15246 "D",
15247 "i",
15248 "e",
15249 "c",
15250 "t",
15251 "T"
15252 ];
15253 };
15254
15255 // node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js
15256 var DayOfYearParser = class extends Parser {
15257 priority = 90;
15258 subpriority = 1;
15259 parse(dateString, token, match2) {
15260 switch (token) {
15261 case "D":
15262 case "DD":
15263 return parseNumericPattern(numericPatterns.dayOfYear, dateString);
15264 case "Do":
15265 return match2.ordinalNumber(dateString, { unit: "date" });
15266 default:
15267 return parseNDigits(token.length, dateString);
15268 }
15269 }
15270 validate(date, value) {
15271 const year = date.getFullYear();
15272 const isLeapYear = isLeapYearIndex(year);
15273 if (isLeapYear) {
15274 return value >= 1 && value <= 366;
15275 } else {
15276 return value >= 1 && value <= 365;
15277 }
15278 }
15279 set(date, _flags, value) {
15280 date.setMonth(0, value);
15281 date.setHours(0, 0, 0, 0);
15282 return date;
15283 }
15284 incompatibleTokens = [
15285 "Y",
15286 "R",
15287 "q",
15288 "Q",
15289 "M",
15290 "L",
15291 "w",
15292 "I",
15293 "d",
15294 "E",
15295 "i",
15296 "e",
15297 "c",
15298 "t",
15299 "T"
15300 ];
15301 };
15302
15303 // node_modules/date-fns/setDay.js
15304 function setDay(date, day, options) {
15305 const defaultOptions2 = getDefaultOptions();
15306 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
15307 const date_ = toDate(date, options?.in);
15308 const currentDay = date_.getDay();
15309 const remainder = day % 7;
15310 const dayIndex = (remainder + 7) % 7;
15311 const delta = 7 - weekStartsOn;
15312 const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
15313 return addDays(date_, diff, options);
15314 }
15315
15316 // node_modules/date-fns/parse/_lib/parsers/DayParser.js
15317 var DayParser = class extends Parser {
15318 priority = 90;
15319 parse(dateString, token, match2) {
15320 switch (token) {
15321 // Tue
15322 case "E":
15323 case "EE":
15324 case "EEE":
15325 return match2.day(dateString, {
15326 width: "abbreviated",
15327 context: "formatting"
15328 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15329 // T
15330 case "EEEEE":
15331 return match2.day(dateString, {
15332 width: "narrow",
15333 context: "formatting"
15334 });
15335 // Tu
15336 case "EEEEEE":
15337 return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15338 // Tuesday
15339 case "EEEE":
15340 default:
15341 return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
15342 width: "abbreviated",
15343 context: "formatting"
15344 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15345 }
15346 }
15347 validate(_date, value) {
15348 return value >= 0 && value <= 6;
15349 }
15350 set(date, _flags, value, options) {
15351 date = setDay(date, value, options);
15352 date.setHours(0, 0, 0, 0);
15353 return date;
15354 }
15355 incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
15356 };
15357
15358 // node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js
15359 var LocalDayParser = class extends Parser {
15360 priority = 90;
15361 parse(dateString, token, match2, options) {
15362 const valueCallback = (value) => {
15363 const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
15364 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
15365 };
15366 switch (token) {
15367 // 3
15368 case "e":
15369 case "ee":
15370 return mapValue(parseNDigits(token.length, dateString), valueCallback);
15371 // 3rd
15372 case "eo":
15373 return mapValue(
15374 match2.ordinalNumber(dateString, {
15375 unit: "day"
15376 }),
15377 valueCallback
15378 );
15379 // Tue
15380 case "eee":
15381 return match2.day(dateString, {
15382 width: "abbreviated",
15383 context: "formatting"
15384 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15385 // T
15386 case "eeeee":
15387 return match2.day(dateString, {
15388 width: "narrow",
15389 context: "formatting"
15390 });
15391 // Tu
15392 case "eeeeee":
15393 return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15394 // Tuesday
15395 case "eeee":
15396 default:
15397 return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
15398 width: "abbreviated",
15399 context: "formatting"
15400 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15401 }
15402 }
15403 validate(_date, value) {
15404 return value >= 0 && value <= 6;
15405 }
15406 set(date, _flags, value, options) {
15407 date = setDay(date, value, options);
15408 date.setHours(0, 0, 0, 0);
15409 return date;
15410 }
15411 incompatibleTokens = [
15412 "y",
15413 "R",
15414 "u",
15415 "q",
15416 "Q",
15417 "M",
15418 "L",
15419 "I",
15420 "d",
15421 "D",
15422 "E",
15423 "i",
15424 "c",
15425 "t",
15426 "T"
15427 ];
15428 };
15429
15430 // node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js
15431 var StandAloneLocalDayParser = class extends Parser {
15432 priority = 90;
15433 parse(dateString, token, match2, options) {
15434 const valueCallback = (value) => {
15435 const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
15436 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
15437 };
15438 switch (token) {
15439 // 3
15440 case "c":
15441 case "cc":
15442 return mapValue(parseNDigits(token.length, dateString), valueCallback);
15443 // 3rd
15444 case "co":
15445 return mapValue(
15446 match2.ordinalNumber(dateString, {
15447 unit: "day"
15448 }),
15449 valueCallback
15450 );
15451 // Tue
15452 case "ccc":
15453 return match2.day(dateString, {
15454 width: "abbreviated",
15455 context: "standalone"
15456 }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
15457 // T
15458 case "ccccc":
15459 return match2.day(dateString, {
15460 width: "narrow",
15461 context: "standalone"
15462 });
15463 // Tu
15464 case "cccccc":
15465 return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
15466 // Tuesday
15467 case "cccc":
15468 default:
15469 return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
15470 width: "abbreviated",
15471 context: "standalone"
15472 }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
15473 }
15474 }
15475 validate(_date, value) {
15476 return value >= 0 && value <= 6;
15477 }
15478 set(date, _flags, value, options) {
15479 date = setDay(date, value, options);
15480 date.setHours(0, 0, 0, 0);
15481 return date;
15482 }
15483 incompatibleTokens = [
15484 "y",
15485 "R",
15486 "u",
15487 "q",
15488 "Q",
15489 "M",
15490 "L",
15491 "I",
15492 "d",
15493 "D",
15494 "E",
15495 "i",
15496 "e",
15497 "t",
15498 "T"
15499 ];
15500 };
15501
15502 // node_modules/date-fns/setISODay.js
15503 function setISODay(date, day, options) {
15504 const date_ = toDate(date, options?.in);
15505 const currentDay = getISODay(date_, options);
15506 const diff = day - currentDay;
15507 return addDays(date_, diff, options);
15508 }
15509
15510 // node_modules/date-fns/parse/_lib/parsers/ISODayParser.js
15511 var ISODayParser = class extends Parser {
15512 priority = 90;
15513 parse(dateString, token, match2) {
15514 const valueCallback = (value) => {
15515 if (value === 0) {
15516 return 7;
15517 }
15518 return value;
15519 };
15520 switch (token) {
15521 // 2
15522 case "i":
15523 case "ii":
15524 return parseNDigits(token.length, dateString);
15525 // 2nd
15526 case "io":
15527 return match2.ordinalNumber(dateString, { unit: "day" });
15528 // Tue
15529 case "iii":
15530 return mapValue(
15531 match2.day(dateString, {
15532 width: "abbreviated",
15533 context: "formatting"
15534 }) || match2.day(dateString, {
15535 width: "short",
15536 context: "formatting"
15537 }) || match2.day(dateString, {
15538 width: "narrow",
15539 context: "formatting"
15540 }),
15541 valueCallback
15542 );
15543 // T
15544 case "iiiii":
15545 return mapValue(
15546 match2.day(dateString, {
15547 width: "narrow",
15548 context: "formatting"
15549 }),
15550 valueCallback
15551 );
15552 // Tu
15553 case "iiiiii":
15554 return mapValue(
15555 match2.day(dateString, {
15556 width: "short",
15557 context: "formatting"
15558 }) || match2.day(dateString, {
15559 width: "narrow",
15560 context: "formatting"
15561 }),
15562 valueCallback
15563 );
15564 // Tuesday
15565 case "iiii":
15566 default:
15567 return mapValue(
15568 match2.day(dateString, {
15569 width: "wide",
15570 context: "formatting"
15571 }) || match2.day(dateString, {
15572 width: "abbreviated",
15573 context: "formatting"
15574 }) || match2.day(dateString, {
15575 width: "short",
15576 context: "formatting"
15577 }) || match2.day(dateString, {
15578 width: "narrow",
15579 context: "formatting"
15580 }),
15581 valueCallback
15582 );
15583 }
15584 }
15585 validate(_date, value) {
15586 return value >= 1 && value <= 7;
15587 }
15588 set(date, _flags, value) {
15589 date = setISODay(date, value);
15590 date.setHours(0, 0, 0, 0);
15591 return date;
15592 }
15593 incompatibleTokens = [
15594 "y",
15595 "Y",
15596 "u",
15597 "q",
15598 "Q",
15599 "M",
15600 "L",
15601 "w",
15602 "d",
15603 "D",
15604 "E",
15605 "e",
15606 "c",
15607 "t",
15608 "T"
15609 ];
15610 };
15611
15612 // node_modules/date-fns/parse/_lib/parsers/AMPMParser.js
15613 var AMPMParser = class extends Parser {
15614 priority = 80;
15615 parse(dateString, token, match2) {
15616 switch (token) {
15617 case "a":
15618 case "aa":
15619 case "aaa":
15620 return match2.dayPeriod(dateString, {
15621 width: "abbreviated",
15622 context: "formatting"
15623 }) || match2.dayPeriod(dateString, {
15624 width: "narrow",
15625 context: "formatting"
15626 });
15627 case "aaaaa":
15628 return match2.dayPeriod(dateString, {
15629 width: "narrow",
15630 context: "formatting"
15631 });
15632 case "aaaa":
15633 default:
15634 return match2.dayPeriod(dateString, {
15635 width: "wide",
15636 context: "formatting"
15637 }) || match2.dayPeriod(dateString, {
15638 width: "abbreviated",
15639 context: "formatting"
15640 }) || match2.dayPeriod(dateString, {
15641 width: "narrow",
15642 context: "formatting"
15643 });
15644 }
15645 }
15646 set(date, _flags, value) {
15647 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
15648 return date;
15649 }
15650 incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
15651 };
15652
15653 // node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js
15654 var AMPMMidnightParser = class extends Parser {
15655 priority = 80;
15656 parse(dateString, token, match2) {
15657 switch (token) {
15658 case "b":
15659 case "bb":
15660 case "bbb":
15661 return match2.dayPeriod(dateString, {
15662 width: "abbreviated",
15663 context: "formatting"
15664 }) || match2.dayPeriod(dateString, {
15665 width: "narrow",
15666 context: "formatting"
15667 });
15668 case "bbbbb":
15669 return match2.dayPeriod(dateString, {
15670 width: "narrow",
15671 context: "formatting"
15672 });
15673 case "bbbb":
15674 default:
15675 return match2.dayPeriod(dateString, {
15676 width: "wide",
15677 context: "formatting"
15678 }) || match2.dayPeriod(dateString, {
15679 width: "abbreviated",
15680 context: "formatting"
15681 }) || match2.dayPeriod(dateString, {
15682 width: "narrow",
15683 context: "formatting"
15684 });
15685 }
15686 }
15687 set(date, _flags, value) {
15688 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
15689 return date;
15690 }
15691 incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
15692 };
15693
15694 // node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js
15695 var DayPeriodParser = class extends Parser {
15696 priority = 80;
15697 parse(dateString, token, match2) {
15698 switch (token) {
15699 case "B":
15700 case "BB":
15701 case "BBB":
15702 return match2.dayPeriod(dateString, {
15703 width: "abbreviated",
15704 context: "formatting"
15705 }) || match2.dayPeriod(dateString, {
15706 width: "narrow",
15707 context: "formatting"
15708 });
15709 case "BBBBB":
15710 return match2.dayPeriod(dateString, {
15711 width: "narrow",
15712 context: "formatting"
15713 });
15714 case "BBBB":
15715 default:
15716 return match2.dayPeriod(dateString, {
15717 width: "wide",
15718 context: "formatting"
15719 }) || match2.dayPeriod(dateString, {
15720 width: "abbreviated",
15721 context: "formatting"
15722 }) || match2.dayPeriod(dateString, {
15723 width: "narrow",
15724 context: "formatting"
15725 });
15726 }
15727 }
15728 set(date, _flags, value) {
15729 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
15730 return date;
15731 }
15732 incompatibleTokens = ["a", "b", "t", "T"];
15733 };
15734
15735 // node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js
15736 var Hour1to12Parser = class extends Parser {
15737 priority = 70;
15738 parse(dateString, token, match2) {
15739 switch (token) {
15740 case "h":
15741 return parseNumericPattern(numericPatterns.hour12h, dateString);
15742 case "ho":
15743 return match2.ordinalNumber(dateString, { unit: "hour" });
15744 default:
15745 return parseNDigits(token.length, dateString);
15746 }
15747 }
15748 validate(_date, value) {
15749 return value >= 1 && value <= 12;
15750 }
15751 set(date, _flags, value) {
15752 const isPM = date.getHours() >= 12;
15753 if (isPM && value < 12) {
15754 date.setHours(value + 12, 0, 0, 0);
15755 } else if (!isPM && value === 12) {
15756 date.setHours(0, 0, 0, 0);
15757 } else {
15758 date.setHours(value, 0, 0, 0);
15759 }
15760 return date;
15761 }
15762 incompatibleTokens = ["H", "K", "k", "t", "T"];
15763 };
15764
15765 // node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js
15766 var Hour0to23Parser = class extends Parser {
15767 priority = 70;
15768 parse(dateString, token, match2) {
15769 switch (token) {
15770 case "H":
15771 return parseNumericPattern(numericPatterns.hour23h, dateString);
15772 case "Ho":
15773 return match2.ordinalNumber(dateString, { unit: "hour" });
15774 default:
15775 return parseNDigits(token.length, dateString);
15776 }
15777 }
15778 validate(_date, value) {
15779 return value >= 0 && value <= 23;
15780 }
15781 set(date, _flags, value) {
15782 date.setHours(value, 0, 0, 0);
15783 return date;
15784 }
15785 incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
15786 };
15787
15788 // node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js
15789 var Hour0To11Parser = class extends Parser {
15790 priority = 70;
15791 parse(dateString, token, match2) {
15792 switch (token) {
15793 case "K":
15794 return parseNumericPattern(numericPatterns.hour11h, dateString);
15795 case "Ko":
15796 return match2.ordinalNumber(dateString, { unit: "hour" });
15797 default:
15798 return parseNDigits(token.length, dateString);
15799 }
15800 }
15801 validate(_date, value) {
15802 return value >= 0 && value <= 11;
15803 }
15804 set(date, _flags, value) {
15805 const isPM = date.getHours() >= 12;
15806 if (isPM && value < 12) {
15807 date.setHours(value + 12, 0, 0, 0);
15808 } else {
15809 date.setHours(value, 0, 0, 0);
15810 }
15811 return date;
15812 }
15813 incompatibleTokens = ["h", "H", "k", "t", "T"];
15814 };
15815
15816 // node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js
15817 var Hour1To24Parser = class extends Parser {
15818 priority = 70;
15819 parse(dateString, token, match2) {
15820 switch (token) {
15821 case "k":
15822 return parseNumericPattern(numericPatterns.hour24h, dateString);
15823 case "ko":
15824 return match2.ordinalNumber(dateString, { unit: "hour" });
15825 default:
15826 return parseNDigits(token.length, dateString);
15827 }
15828 }
15829 validate(_date, value) {
15830 return value >= 1 && value <= 24;
15831 }
15832 set(date, _flags, value) {
15833 const hours = value <= 24 ? value % 24 : value;
15834 date.setHours(hours, 0, 0, 0);
15835 return date;
15836 }
15837 incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
15838 };
15839
15840 // node_modules/date-fns/parse/_lib/parsers/MinuteParser.js
15841 var MinuteParser = class extends Parser {
15842 priority = 60;
15843 parse(dateString, token, match2) {
15844 switch (token) {
15845 case "m":
15846 return parseNumericPattern(numericPatterns.minute, dateString);
15847 case "mo":
15848 return match2.ordinalNumber(dateString, { unit: "minute" });
15849 default:
15850 return parseNDigits(token.length, dateString);
15851 }
15852 }
15853 validate(_date, value) {
15854 return value >= 0 && value <= 59;
15855 }
15856 set(date, _flags, value) {
15857 date.setMinutes(value, 0, 0);
15858 return date;
15859 }
15860 incompatibleTokens = ["t", "T"];
15861 };
15862
15863 // node_modules/date-fns/parse/_lib/parsers/SecondParser.js
15864 var SecondParser = class extends Parser {
15865 priority = 50;
15866 parse(dateString, token, match2) {
15867 switch (token) {
15868 case "s":
15869 return parseNumericPattern(numericPatterns.second, dateString);
15870 case "so":
15871 return match2.ordinalNumber(dateString, { unit: "second" });
15872 default:
15873 return parseNDigits(token.length, dateString);
15874 }
15875 }
15876 validate(_date, value) {
15877 return value >= 0 && value <= 59;
15878 }
15879 set(date, _flags, value) {
15880 date.setSeconds(value, 0);
15881 return date;
15882 }
15883 incompatibleTokens = ["t", "T"];
15884 };
15885
15886 // node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js
15887 var FractionOfSecondParser = class extends Parser {
15888 priority = 30;
15889 parse(dateString, token) {
15890 const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
15891 return mapValue(parseNDigits(token.length, dateString), valueCallback);
15892 }
15893 set(date, _flags, value) {
15894 date.setMilliseconds(value);
15895 return date;
15896 }
15897 incompatibleTokens = ["t", "T"];
15898 };
15899
15900 // node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js
15901 var ISOTimezoneWithZParser = class extends Parser {
15902 priority = 10;
15903 parse(dateString, token) {
15904 switch (token) {
15905 case "X":
15906 return parseTimezonePattern(
15907 timezonePatterns.basicOptionalMinutes,
15908 dateString
15909 );
15910 case "XX":
15911 return parseTimezonePattern(timezonePatterns.basic, dateString);
15912 case "XXXX":
15913 return parseTimezonePattern(
15914 timezonePatterns.basicOptionalSeconds,
15915 dateString
15916 );
15917 case "XXXXX":
15918 return parseTimezonePattern(
15919 timezonePatterns.extendedOptionalSeconds,
15920 dateString
15921 );
15922 case "XXX":
15923 default:
15924 return parseTimezonePattern(timezonePatterns.extended, dateString);
15925 }
15926 }
15927 set(date, flags, value) {
15928 if (flags.timestampIsSet) return date;
15929 return constructFrom(
15930 date,
15931 date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
15932 );
15933 }
15934 incompatibleTokens = ["t", "T", "x"];
15935 };
15936
15937 // node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js
15938 var ISOTimezoneParser = class extends Parser {
15939 priority = 10;
15940 parse(dateString, token) {
15941 switch (token) {
15942 case "x":
15943 return parseTimezonePattern(
15944 timezonePatterns.basicOptionalMinutes,
15945 dateString
15946 );
15947 case "xx":
15948 return parseTimezonePattern(timezonePatterns.basic, dateString);
15949 case "xxxx":
15950 return parseTimezonePattern(
15951 timezonePatterns.basicOptionalSeconds,
15952 dateString
15953 );
15954 case "xxxxx":
15955 return parseTimezonePattern(
15956 timezonePatterns.extendedOptionalSeconds,
15957 dateString
15958 );
15959 case "xxx":
15960 default:
15961 return parseTimezonePattern(timezonePatterns.extended, dateString);
15962 }
15963 }
15964 set(date, flags, value) {
15965 if (flags.timestampIsSet) return date;
15966 return constructFrom(
15967 date,
15968 date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
15969 );
15970 }
15971 incompatibleTokens = ["t", "T", "X"];
15972 };
15973
15974 // node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js
15975 var TimestampSecondsParser = class extends Parser {
15976 priority = 40;
15977 parse(dateString) {
15978 return parseAnyDigitsSigned(dateString);
15979 }
15980 set(date, _flags, value) {
15981 return [constructFrom(date, value * 1e3), { timestampIsSet: true }];
15982 }
15983 incompatibleTokens = "*";
15984 };
15985
15986 // node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js
15987 var TimestampMillisecondsParser = class extends Parser {
15988 priority = 20;
15989 parse(dateString) {
15990 return parseAnyDigitsSigned(dateString);
15991 }
15992 set(date, _flags, value) {
15993 return [constructFrom(date, value), { timestampIsSet: true }];
15994 }
15995 incompatibleTokens = "*";
15996 };
15997
15998 // node_modules/date-fns/parse/_lib/parsers.js
15999 var parsers = {
16000 G: new EraParser(),
16001 y: new YearParser(),
16002 Y: new LocalWeekYearParser(),
16003 R: new ISOWeekYearParser(),
16004 u: new ExtendedYearParser(),
16005 Q: new QuarterParser(),
16006 q: new StandAloneQuarterParser(),
16007 M: new MonthParser(),
16008 L: new StandAloneMonthParser(),
16009 w: new LocalWeekParser(),
16010 I: new ISOWeekParser(),
16011 d: new DateParser(),
16012 D: new DayOfYearParser(),
16013 E: new DayParser(),
16014 e: new LocalDayParser(),
16015 c: new StandAloneLocalDayParser(),
16016 i: new ISODayParser(),
16017 a: new AMPMParser(),
16018 b: new AMPMMidnightParser(),
16019 B: new DayPeriodParser(),
16020 h: new Hour1to12Parser(),
16021 H: new Hour0to23Parser(),
16022 K: new Hour0To11Parser(),
16023 k: new Hour1To24Parser(),
16024 m: new MinuteParser(),
16025 s: new SecondParser(),
16026 S: new FractionOfSecondParser(),
16027 X: new ISOTimezoneWithZParser(),
16028 x: new ISOTimezoneParser(),
16029 t: new TimestampSecondsParser(),
16030 T: new TimestampMillisecondsParser()
16031 };
16032
16033 // node_modules/date-fns/parse.js
16034 var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
16035 var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
16036 var escapedStringRegExp2 = /^'([^]*?)'?$/;
16037 var doubleQuoteRegExp2 = /''/g;
16038 var notWhitespaceRegExp = /\S/;
16039 var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/;
16040 function parse(dateStr, formatStr, referenceDate, options) {
16041 const invalidDate = () => constructFrom(options?.in || referenceDate, NaN);
16042 const defaultOptions2 = getDefaultOptions2();
16043 const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
16044 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
16045 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
16046 if (!formatStr)
16047 return dateStr ? invalidDate() : toDate(referenceDate, options?.in);
16048 const subFnOptions = {
16049 firstWeekContainsDate,
16050 weekStartsOn,
16051 locale
16052 };
16053 const setters = [new DateTimezoneSetter(options?.in, referenceDate)];
16054 const tokens = formatStr.match(longFormattingTokensRegExp2).map((substring) => {
16055 const firstCharacter = substring[0];
16056 if (firstCharacter in longFormatters) {
16057 const longFormatter = longFormatters[firstCharacter];
16058 return longFormatter(substring, locale.formatLong);
16059 }
16060 return substring;
16061 }).join("").match(formattingTokensRegExp2);
16062 const usedTokens = [];
16063 for (let token of tokens) {
16064 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) {
16065 warnOrThrowProtectedError(token, formatStr, dateStr);
16066 }
16067 if (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
16068 warnOrThrowProtectedError(token, formatStr, dateStr);
16069 }
16070 const firstCharacter = token[0];
16071 const parser = parsers[firstCharacter];
16072 if (parser) {
16073 const { incompatibleTokens } = parser;
16074 if (Array.isArray(incompatibleTokens)) {
16075 const incompatibleToken = usedTokens.find(
16076 (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
16077 );
16078 if (incompatibleToken) {
16079 throw new RangeError(
16080 `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
16081 );
16082 }
16083 } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
16084 throw new RangeError(
16085 `The format string mustn't contain \`${token}\` and any other token at the same time`
16086 );
16087 }
16088 usedTokens.push({ token: firstCharacter, fullToken: token });
16089 const parseResult = parser.run(
16090 dateStr,
16091 token,
16092 locale.match,
16093 subFnOptions
16094 );
16095 if (!parseResult) {
16096 return invalidDate();
16097 }
16098 setters.push(parseResult.setter);
16099 dateStr = parseResult.rest;
16100 } else {
16101 if (firstCharacter.match(unescapedLatinCharacterRegExp2)) {
16102 throw new RangeError(
16103 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
16104 );
16105 }
16106 if (token === "''") {
16107 token = "'";
16108 } else if (firstCharacter === "'") {
16109 token = cleanEscapedString2(token);
16110 }
16111 if (dateStr.indexOf(token) === 0) {
16112 dateStr = dateStr.slice(token.length);
16113 } else {
16114 return invalidDate();
16115 }
16116 }
16117 }
16118 if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
16119 return invalidDate();
16120 }
16121 const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority2, index2, array) => array.indexOf(priority2) === index2).map(
16122 (priority2) => setters.filter((setter) => setter.priority === priority2).sort((a, b) => b.subPriority - a.subPriority)
16123 ).map((setterArray) => setterArray[0]);
16124 let date = toDate(referenceDate, options?.in);
16125 if (isNaN(+date)) return invalidDate();
16126 const flags = {};
16127 for (const setter of uniquePrioritySetters) {
16128 if (!setter.validate(date, subFnOptions)) {
16129 return invalidDate();
16130 }
16131 const result = setter.set(date, flags, subFnOptions);
16132 if (Array.isArray(result)) {
16133 date = result[0];
16134 Object.assign(flags, result[1]);
16135 } else {
16136 date = result;
16137 }
16138 }
16139 return date;
16140 }
16141 function cleanEscapedString2(input) {
16142 return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'");
16143 }
16144
16145 // node_modules/date-fns/isSameMonth.js
16146 function isSameMonth(laterDate, earlierDate, options) {
16147 const [laterDate_, earlierDate_] = normalizeDates(
16148 options?.in,
16149 laterDate,
16150 earlierDate
16151 );
16152 return laterDate_.getFullYear() === earlierDate_.getFullYear() && laterDate_.getMonth() === earlierDate_.getMonth();
16153 }
16154
16155 // node_modules/date-fns/isSameYear.js
16156 function isSameYear(laterDate, earlierDate, options) {
16157 const [laterDate_, earlierDate_] = normalizeDates(
16158 options?.in,
16159 laterDate,
16160 earlierDate
16161 );
16162 return laterDate_.getFullYear() === earlierDate_.getFullYear();
16163 }
16164
16165 // node_modules/date-fns/subDays.js
16166 function subDays(date, amount, options) {
16167 return addDays(date, -amount, options);
16168 }
16169
16170 // node_modules/date-fns/parseISO.js
16171 function parseISO(argument, options) {
16172 const invalidDate = () => constructFrom(options?.in, NaN);
16173 const additionalDigits = options?.additionalDigits ?? 2;
16174 const dateStrings = splitDateString(argument);
16175 let date;
16176 if (dateStrings.date) {
16177 const parseYearResult = parseYear(dateStrings.date, additionalDigits);
16178 date = parseDate(parseYearResult.restDateString, parseYearResult.year);
16179 }
16180 if (!date || isNaN(+date)) return invalidDate();
16181 const timestamp = +date;
16182 let time = 0;
16183 let offset4;
16184 if (dateStrings.time) {
16185 time = parseTime(dateStrings.time);
16186 if (isNaN(time)) return invalidDate();
16187 }
16188 if (dateStrings.timezone) {
16189 offset4 = parseTimezone(dateStrings.timezone);
16190 if (isNaN(offset4)) return invalidDate();
16191 } else {
16192 const tmpDate = new Date(timestamp + time);
16193 const result = toDate(0, options?.in);
16194 result.setFullYear(
16195 tmpDate.getUTCFullYear(),
16196 tmpDate.getUTCMonth(),
16197 tmpDate.getUTCDate()
16198 );
16199 result.setHours(
16200 tmpDate.getUTCHours(),
16201 tmpDate.getUTCMinutes(),
16202 tmpDate.getUTCSeconds(),
16203 tmpDate.getUTCMilliseconds()
16204 );
16205 return result;
16206 }
16207 return toDate(timestamp + time + offset4, options?.in);
16208 }
16209 var patterns = {
16210 dateTimeDelimiter: /[T ]/,
16211 timeZoneDelimiter: /[Z ]/i,
16212 timezone: /([Z+-].*)$/
16213 };
16214 var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
16215 var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
16216 var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
16217 function splitDateString(dateString) {
16218 const dateStrings = {};
16219 const array = dateString.split(patterns.dateTimeDelimiter);
16220 let timeString;
16221 if (array.length > 2) {
16222 return dateStrings;
16223 }
16224 if (/:/.test(array[0])) {
16225 timeString = array[0];
16226 } else {
16227 dateStrings.date = array[0];
16228 timeString = array[1];
16229 if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
16230 dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
16231 timeString = dateString.substr(
16232 dateStrings.date.length,
16233 dateString.length
16234 );
16235 }
16236 }
16237 if (timeString) {
16238 const token = patterns.timezone.exec(timeString);
16239 if (token) {
16240 dateStrings.time = timeString.replace(token[1], "");
16241 dateStrings.timezone = token[1];
16242 } else {
16243 dateStrings.time = timeString;
16244 }
16245 }
16246 return dateStrings;
16247 }
16248 function parseYear(dateString, additionalDigits) {
16249 const regex = new RegExp(
16250 "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
16251 );
16252 const captures = dateString.match(regex);
16253 if (!captures) return { year: NaN, restDateString: "" };
16254 const year = captures[1] ? parseInt(captures[1]) : null;
16255 const century = captures[2] ? parseInt(captures[2]) : null;
16256 return {
16257 year: century === null ? year : century * 100,
16258 restDateString: dateString.slice((captures[1] || captures[2]).length)
16259 };
16260 }
16261 function parseDate(dateString, year) {
16262 if (year === null) return /* @__PURE__ */ new Date(NaN);
16263 const captures = dateString.match(dateRegex);
16264 if (!captures) return /* @__PURE__ */ new Date(NaN);
16265 const isWeekDate = !!captures[4];
16266 const dayOfYear = parseDateUnit(captures[1]);
16267 const month = parseDateUnit(captures[2]) - 1;
16268 const day = parseDateUnit(captures[3]);
16269 const week = parseDateUnit(captures[4]);
16270 const dayOfWeek = parseDateUnit(captures[5]) - 1;
16271 if (isWeekDate) {
16272 if (!validateWeekDate(year, week, dayOfWeek)) {
16273 return /* @__PURE__ */ new Date(NaN);
16274 }
16275 return dayOfISOWeekYear(year, week, dayOfWeek);
16276 } else {
16277 const date = /* @__PURE__ */ new Date(0);
16278 if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
16279 return /* @__PURE__ */ new Date(NaN);
16280 }
16281 date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
16282 return date;
16283 }
16284 }
16285 function parseDateUnit(value) {
16286 return value ? parseInt(value) : 1;
16287 }
16288 function parseTime(timeString) {
16289 const captures = timeString.match(timeRegex);
16290 if (!captures) return NaN;
16291 const hours = parseTimeUnit(captures[1]);
16292 const minutes = parseTimeUnit(captures[2]);
16293 const seconds = parseTimeUnit(captures[3]);
16294 if (!validateTime(hours, minutes, seconds)) {
16295 return NaN;
16296 }
16297 return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
16298 }
16299 function parseTimeUnit(value) {
16300 return value && parseFloat(value.replace(",", ".")) || 0;
16301 }
16302 function parseTimezone(timezoneString) {
16303 if (timezoneString === "Z") return 0;
16304 const captures = timezoneString.match(timezoneRegex);
16305 if (!captures) return 0;
16306 const sign = captures[1] === "+" ? -1 : 1;
16307 const hours = parseInt(captures[2]);
16308 const minutes = captures[3] && parseInt(captures[3]) || 0;
16309 if (!validateTimezone(hours, minutes)) {
16310 return NaN;
16311 }
16312 return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
16313 }
16314 function dayOfISOWeekYear(isoWeekYear, week, day) {
16315 const date = /* @__PURE__ */ new Date(0);
16316 date.setUTCFullYear(isoWeekYear, 0, 4);
16317 const fourthOfJanuaryDay = date.getUTCDay() || 7;
16318 const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
16319 date.setUTCDate(date.getUTCDate() + diff);
16320 return date;
16321 }
16322 var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
16323 function isLeapYearIndex2(year) {
16324 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
16325 }
16326 function validateDate(year, month, date) {
16327 return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28));
16328 }
16329 function validateDayOfYearDate(year, dayOfYear) {
16330 return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365);
16331 }
16332 function validateWeekDate(_year, week, day) {
16333 return week >= 1 && week <= 53 && day >= 0 && day <= 6;
16334 }
16335 function validateTime(hours, minutes, seconds) {
16336 if (hours === 24) {
16337 return minutes === 0 && seconds === 0;
16338 }
16339 return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
16340 }
16341 function validateTimezone(_hours, minutes) {
16342 return minutes >= 0 && minutes <= 59;
16343 }
16344
16345 // node_modules/date-fns/setMonth.js
16346 function setMonth(date, month, options) {
16347 const _date = toDate(date, options?.in);
16348 const year = _date.getFullYear();
16349 const day = _date.getDate();
16350 const midMonth = constructFrom(options?.in || date, 0);
16351 midMonth.setFullYear(year, month, 15);
16352 midMonth.setHours(0, 0, 0, 0);
16353 const daysInMonth = getDaysInMonth(midMonth);
16354 _date.setMonth(month, Math.min(day, daysInMonth));
16355 return _date;
16356 }
16357
16358 // node_modules/date-fns/setYear.js
16359 function setYear(date, year, options) {
16360 const date_ = toDate(date, options?.in);
16361 if (isNaN(+date_)) return constructFrom(options?.in || date, NaN);
16362 date_.setFullYear(year);
16363 return date_;
16364 }
16365
16366 // node_modules/date-fns/subMonths.js
16367 function subMonths(date, amount, options) {
16368 return addMonths(date, -amount, options);
16369 }
16370
16371 // node_modules/date-fns/subWeeks.js
16372 function subWeeks(date, amount, options) {
16373 return addWeeks(date, -amount, options);
16374 }
16375
16376 // node_modules/date-fns/subYears.js
16377 function subYears(date, amount, options) {
16378 return addYears(date, -amount, options);
16379 }
16380
16381 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js
16382 var FIVE_WEEKS = 5;
16383 var FOUR_WEEKS = 4;
16384 function getBroadcastWeeksInMonth(month, dateLib) {
16385 const firstDayOfMonth = dateLib.startOfMonth(month);
16386 const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
16387 const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
16388 const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
16389 const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek) ? FIVE_WEEKS : FOUR_WEEKS;
16390 return numberOfWeeks;
16391 }
16392
16393 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js
16394 function startOfBroadcastWeek(date, dateLib) {
16395 const firstOfMonth = dateLib.startOfMonth(date);
16396 const dayOfWeek = firstOfMonth.getDay();
16397 if (dayOfWeek === 1) {
16398 return firstOfMonth;
16399 } else if (dayOfWeek === 0) {
16400 return dateLib.addDays(firstOfMonth, -1 * 6);
16401 } else {
16402 return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
16403 }
16404 }
16405
16406 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js
16407 function endOfBroadcastWeek(date, dateLib) {
16408 const startDate = startOfBroadcastWeek(date, dateLib);
16409 const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
16410 const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
16411 return endDate;
16412 }
16413
16414 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/locale/en-US.js
16415 var enUS2 = {
16416 ...enUS,
16417 labels: {
16418 labelDayButton: (date, modifiers, options, dateLib) => {
16419 let formatDate2;
16420 if (dateLib && typeof dateLib.format === "function") {
16421 formatDate2 = dateLib.format.bind(dateLib);
16422 } else {
16423 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16424 }
16425 let label = formatDate2(date, "PPPP");
16426 if (modifiers.today)
16427 label = `Today, ${label}`;
16428 if (modifiers.selected)
16429 label = `${label}, selected`;
16430 return label;
16431 },
16432 labelMonthDropdown: "Choose the Month",
16433 labelNext: "Go to the Next Month",
16434 labelPrevious: "Go to the Previous Month",
16435 labelWeekNumber: (weekNumber) => `Week ${weekNumber}`,
16436 labelYearDropdown: "Choose the Year",
16437 labelGrid: (date, options, dateLib) => {
16438 let formatDate2;
16439 if (dateLib && typeof dateLib.format === "function") {
16440 formatDate2 = dateLib.format.bind(dateLib);
16441 } else {
16442 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16443 }
16444 return formatDate2(date, "LLLL yyyy");
16445 },
16446 labelGridcell: (date, modifiers, options, dateLib) => {
16447 let formatDate2;
16448 if (dateLib && typeof dateLib.format === "function") {
16449 formatDate2 = dateLib.format.bind(dateLib);
16450 } else {
16451 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16452 }
16453 let label = formatDate2(date, "PPPP");
16454 if (modifiers?.today) {
16455 label = `Today, ${label}`;
16456 }
16457 return label;
16458 },
16459 labelNav: "Navigation bar",
16460 labelWeekNumberHeader: "Week Number",
16461 labelWeekday: (date, options, dateLib) => {
16462 let formatDate2;
16463 if (dateLib && typeof dateLib.format === "function") {
16464 formatDate2 = dateLib.format.bind(dateLib);
16465 } else {
16466 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16467 }
16468 return formatDate2(date, "cccc");
16469 }
16470 }
16471 };
16472
16473 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/DateLib.js
16474 var DateLib = class _DateLib {
16475 /**
16476 * Creates an instance of `DateLib`.
16477 *
16478 * @param options Configuration options for the date library.
16479 * @param overrides Custom overrides for the date library functions.
16480 */
16481 constructor(options, overrides) {
16482 this.today = () => {
16483 if (this.overrides?.today) {
16484 return this.overrides.today();
16485 }
16486 if (this.options.timeZone) {
16487 return TZDate.tz(this.options.timeZone);
16488 }
16489 const DateCtor = this.options.Date ?? Date;
16490 return new DateCtor();
16491 };
16492 this.newDate = (year, monthIndex, date) => {
16493 if (this.overrides?.newDate) {
16494 return this.overrides.newDate(year, monthIndex, date);
16495 }
16496 if (this.options.timeZone) {
16497 return new TZDate(year, monthIndex, date, this.options.timeZone);
16498 }
16499 return new Date(year, monthIndex, date);
16500 };
16501 this.addDays = (date, amount) => {
16502 return this.overrides?.addDays ? this.overrides.addDays(date, amount) : addDays(date, amount);
16503 };
16504 this.addMonths = (date, amount) => {
16505 return this.overrides?.addMonths ? this.overrides.addMonths(date, amount) : addMonths(date, amount);
16506 };
16507 this.addWeeks = (date, amount) => {
16508 return this.overrides?.addWeeks ? this.overrides.addWeeks(date, amount) : addWeeks(date, amount);
16509 };
16510 this.addYears = (date, amount) => {
16511 return this.overrides?.addYears ? this.overrides.addYears(date, amount) : addYears(date, amount);
16512 };
16513 this.differenceInCalendarDays = (dateLeft, dateRight) => {
16514 return this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(dateLeft, dateRight) : differenceInCalendarDays(dateLeft, dateRight);
16515 };
16516 this.differenceInCalendarMonths = (dateLeft, dateRight) => {
16517 return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
16518 };
16519 this.eachMonthOfInterval = (interval) => {
16520 return this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(interval) : eachMonthOfInterval(interval);
16521 };
16522 this.eachYearOfInterval = (interval) => {
16523 const years = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(interval) : eachYearOfInterval(interval);
16524 const uniqueYears = new Set(years.map((d) => this.getYear(d)));
16525 if (uniqueYears.size === years.length) {
16526 return years;
16527 }
16528 const yearsArray = [];
16529 uniqueYears.forEach((y2) => {
16530 yearsArray.push(new Date(y2, 0, 1));
16531 });
16532 return yearsArray;
16533 };
16534 this.endOfBroadcastWeek = (date) => {
16535 return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date) : endOfBroadcastWeek(date, this);
16536 };
16537 this.endOfISOWeek = (date) => {
16538 return this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(date) : endOfISOWeek(date);
16539 };
16540 this.endOfMonth = (date) => {
16541 return this.overrides?.endOfMonth ? this.overrides.endOfMonth(date) : endOfMonth(date);
16542 };
16543 this.endOfWeek = (date, options2) => {
16544 return this.overrides?.endOfWeek ? this.overrides.endOfWeek(date, options2) : endOfWeek(date, this.options);
16545 };
16546 this.endOfYear = (date) => {
16547 return this.overrides?.endOfYear ? this.overrides.endOfYear(date) : endOfYear(date);
16548 };
16549 this.format = (date, formatStr, _options) => {
16550 const formatted = this.overrides?.format ? this.overrides.format(date, formatStr, this.options) : format(date, formatStr, this.options);
16551 if (this.options.numerals && this.options.numerals !== "latn") {
16552 return this.replaceDigits(formatted);
16553 }
16554 return formatted;
16555 };
16556 this.getISOWeek = (date) => {
16557 return this.overrides?.getISOWeek ? this.overrides.getISOWeek(date) : getISOWeek(date);
16558 };
16559 this.getMonth = (date, _options) => {
16560 return this.overrides?.getMonth ? this.overrides.getMonth(date, this.options) : getMonth(date, this.options);
16561 };
16562 this.getYear = (date, _options) => {
16563 return this.overrides?.getYear ? this.overrides.getYear(date, this.options) : getYear(date, this.options);
16564 };
16565 this.getWeek = (date, _options) => {
16566 return this.overrides?.getWeek ? this.overrides.getWeek(date, this.options) : getWeek(date, this.options);
16567 };
16568 this.isAfter = (date, dateToCompare) => {
16569 return this.overrides?.isAfter ? this.overrides.isAfter(date, dateToCompare) : isAfter(date, dateToCompare);
16570 };
16571 this.isBefore = (date, dateToCompare) => {
16572 return this.overrides?.isBefore ? this.overrides.isBefore(date, dateToCompare) : isBefore(date, dateToCompare);
16573 };
16574 this.isDate = (value) => {
16575 return this.overrides?.isDate ? this.overrides.isDate(value) : isDate(value);
16576 };
16577 this.isSameDay = (dateLeft, dateRight) => {
16578 return this.overrides?.isSameDay ? this.overrides.isSameDay(dateLeft, dateRight) : isSameDay(dateLeft, dateRight);
16579 };
16580 this.isSameMonth = (dateLeft, dateRight) => {
16581 return this.overrides?.isSameMonth ? this.overrides.isSameMonth(dateLeft, dateRight) : isSameMonth(dateLeft, dateRight);
16582 };
16583 this.isSameYear = (dateLeft, dateRight) => {
16584 return this.overrides?.isSameYear ? this.overrides.isSameYear(dateLeft, dateRight) : isSameYear(dateLeft, dateRight);
16585 };
16586 this.max = (dates) => {
16587 return this.overrides?.max ? this.overrides.max(dates) : max2(dates);
16588 };
16589 this.min = (dates) => {
16590 return this.overrides?.min ? this.overrides.min(dates) : min2(dates);
16591 };
16592 this.setMonth = (date, month) => {
16593 return this.overrides?.setMonth ? this.overrides.setMonth(date, month) : setMonth(date, month);
16594 };
16595 this.setYear = (date, year) => {
16596 return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
16597 };
16598 this.startOfBroadcastWeek = (date, _dateLib) => {
16599 return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
16600 };
16601 this.startOfDay = (date) => {
16602 return this.overrides?.startOfDay ? this.overrides.startOfDay(date) : startOfDay(date);
16603 };
16604 this.startOfISOWeek = (date) => {
16605 return this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(date) : startOfISOWeek(date);
16606 };
16607 this.startOfMonth = (date) => {
16608 return this.overrides?.startOfMonth ? this.overrides.startOfMonth(date) : startOfMonth(date);
16609 };
16610 this.startOfWeek = (date, _options) => {
16611 return this.overrides?.startOfWeek ? this.overrides.startOfWeek(date, this.options) : startOfWeek(date, this.options);
16612 };
16613 this.startOfYear = (date) => {
16614 return this.overrides?.startOfYear ? this.overrides.startOfYear(date) : startOfYear(date);
16615 };
16616 this.options = { locale: enUS2, ...options };
16617 this.overrides = overrides;
16618 }
16619 /**
16620 * Generates a mapping of Arabic digits (0-9) to the target numbering system
16621 * digits.
16622 *
16623 * @since 9.5.0
16624 * @returns A record mapping Arabic digits to the target numerals.
16625 */
16626 getDigitMap() {
16627 const { numerals = "latn" } = this.options;
16628 const formatter = new Intl.NumberFormat("en-US", {
16629 numberingSystem: numerals
16630 });
16631 const digitMap = {};
16632 for (let i = 0; i < 10; i++) {
16633 digitMap[i.toString()] = formatter.format(i);
16634 }
16635 return digitMap;
16636 }
16637 /**
16638 * Replaces Arabic digits in a string with the target numbering system digits.
16639 *
16640 * @since 9.5.0
16641 * @param input The string containing Arabic digits.
16642 * @returns The string with digits replaced.
16643 */
16644 replaceDigits(input) {
16645 const digitMap = this.getDigitMap();
16646 return input.replace(/\d/g, (digit) => digitMap[digit] || digit);
16647 }
16648 /**
16649 * Formats a number using the configured numbering system.
16650 *
16651 * @since 9.5.0
16652 * @param value The number to format.
16653 * @returns The formatted number as a string.
16654 */
16655 formatNumber(value) {
16656 return this.replaceDigits(value.toString());
16657 }
16658 /**
16659 * Returns the preferred ordering for month and year labels for the current
16660 * locale.
16661 */
16662 getMonthYearOrder() {
16663 const code = this.options.locale?.code;
16664 if (!code) {
16665 return "month-first";
16666 }
16667 return _DateLib.yearFirstLocales.has(code) ? "year-first" : "month-first";
16668 }
16669 /**
16670 * Formats the month/year pair respecting locale conventions.
16671 *
16672 * @since 9.11.0
16673 */
16674 formatMonthYear(date) {
16675 const { locale, timeZone, numerals } = this.options;
16676 const localeCode = locale?.code;
16677 if (localeCode && _DateLib.yearFirstLocales.has(localeCode)) {
16678 try {
16679 const intl = new Intl.DateTimeFormat(localeCode, {
16680 month: "long",
16681 year: "numeric",
16682 timeZone,
16683 numberingSystem: numerals
16684 });
16685 const formatted = intl.format(date);
16686 return formatted;
16687 } catch {
16688 }
16689 }
16690 const pattern = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
16691 return this.format(date, pattern);
16692 }
16693 };
16694 DateLib.yearFirstLocales = /* @__PURE__ */ new Set([
16695 "eu",
16696 "hu",
16697 "ja",
16698 "ja-Hira",
16699 "ja-JP",
16700 "ko",
16701 "ko-KR",
16702 "lt",
16703 "lt-LT",
16704 "lv",
16705 "lv-LV",
16706 "mn",
16707 "mn-MN",
16708 "zh",
16709 "zh-CN",
16710 "zh-HK",
16711 "zh-TW"
16712 ]);
16713 var defaultDateLib = new DateLib();
16714
16715 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js
16716 var CalendarDay = class {
16717 constructor(date, displayMonth, dateLib = defaultDateLib) {
16718 this.date = date;
16719 this.displayMonth = displayMonth;
16720 this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));
16721 this.dateLib = dateLib;
16722 this.isoDate = dateLib.format(date, "yyyy-MM-dd");
16723 this.displayMonthId = dateLib.format(displayMonth, "yyyy-MM");
16724 this.dateMonthId = dateLib.format(date, "yyyy-MM");
16725 }
16726 /**
16727 * Checks if this day is equal to another `CalendarDay`, considering both the
16728 * date and the displayed month.
16729 *
16730 * @param day The `CalendarDay` to compare with.
16731 * @returns `true` if the days are equal, otherwise `false`.
16732 */
16733 isEqualTo(day) {
16734 return this.dateLib.isSameDay(day.date, this.date) && this.dateLib.isSameMonth(day.displayMonth, this.displayMonth);
16735 }
16736 };
16737
16738 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js
16739 var CalendarMonth = class {
16740 constructor(month, weeks) {
16741 this.date = month;
16742 this.weeks = weeks;
16743 }
16744 };
16745
16746 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js
16747 var CalendarWeek = class {
16748 constructor(weekNumber, days) {
16749 this.days = days;
16750 this.weekNumber = weekNumber;
16751 }
16752 };
16753
16754 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/custom-components.js
16755 var custom_components_exports = {};
16756 __export(custom_components_exports, {
16757 CaptionLabel: () => CaptionLabel,
16758 Chevron: () => Chevron,
16759 Day: () => Day,
16760 DayButton: () => DayButton,
16761 Dropdown: () => Dropdown,
16762 DropdownNav: () => DropdownNav,
16763 Footer: () => Footer,
16764 Month: () => Month,
16765 MonthCaption: () => MonthCaption,
16766 MonthGrid: () => MonthGrid,
16767 Months: () => Months,
16768 MonthsDropdown: () => MonthsDropdown,
16769 Nav: () => Nav,
16770 NextMonthButton: () => NextMonthButton,
16771 Option: () => Option,
16772 PreviousMonthButton: () => PreviousMonthButton,
16773 Root: () => Root2,
16774 Select: () => Select,
16775 Week: () => Week,
16776 WeekNumber: () => WeekNumber,
16777 WeekNumberHeader: () => WeekNumberHeader,
16778 Weekday: () => Weekday,
16779 Weekdays: () => Weekdays,
16780 Weeks: () => Weeks,
16781 YearsDropdown: () => YearsDropdown
16782 });
16783
16784 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js
16785 var import_react6 = __toESM(require_react(), 1);
16786 function CaptionLabel(props) {
16787 return import_react6.default.createElement("span", { ...props });
16788 }
16789
16790 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Chevron.js
16791 var import_react7 = __toESM(require_react(), 1);
16792 function Chevron(props) {
16793 const { size: size4 = 24, orientation = "left", className, style } = props;
16794 return import_react7.default.createElement(
16795 "svg",
16796 { className, style, width: size4, height: size4, viewBox: "0 0 24 24" },
16797 orientation === "up" && import_react7.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
16798 orientation === "down" && import_react7.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
16799 orientation === "left" && import_react7.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
16800 orientation === "right" && import_react7.default.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
16801 );
16802 }
16803
16804 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Day.js
16805 var import_react8 = __toESM(require_react(), 1);
16806 function Day(props) {
16807 const { day, modifiers, ...tdProps } = props;
16808 return import_react8.default.createElement("td", { ...tdProps });
16809 }
16810
16811 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DayButton.js
16812 var import_react9 = __toESM(require_react(), 1);
16813 function DayButton(props) {
16814 const { day, modifiers, ...buttonProps } = props;
16815 const ref = import_react9.default.useRef(null);
16816 import_react9.default.useEffect(() => {
16817 if (modifiers.focused)
16818 ref.current?.focus();
16819 }, [modifiers.focused]);
16820 return import_react9.default.createElement("button", { ref, ...buttonProps });
16821 }
16822
16823 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js
16824 var import_react11 = __toESM(require_react(), 1);
16825
16826 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/UI.js
16827 var UI;
16828 (function(UI2) {
16829 UI2["Root"] = "root";
16830 UI2["Chevron"] = "chevron";
16831 UI2["Day"] = "day";
16832 UI2["DayButton"] = "day_button";
16833 UI2["CaptionLabel"] = "caption_label";
16834 UI2["Dropdowns"] = "dropdowns";
16835 UI2["Dropdown"] = "dropdown";
16836 UI2["DropdownRoot"] = "dropdown_root";
16837 UI2["Footer"] = "footer";
16838 UI2["MonthGrid"] = "month_grid";
16839 UI2["MonthCaption"] = "month_caption";
16840 UI2["MonthsDropdown"] = "months_dropdown";
16841 UI2["Month"] = "month";
16842 UI2["Months"] = "months";
16843 UI2["Nav"] = "nav";
16844 UI2["NextMonthButton"] = "button_next";
16845 UI2["PreviousMonthButton"] = "button_previous";
16846 UI2["Week"] = "week";
16847 UI2["Weeks"] = "weeks";
16848 UI2["Weekday"] = "weekday";
16849 UI2["Weekdays"] = "weekdays";
16850 UI2["WeekNumber"] = "week_number";
16851 UI2["WeekNumberHeader"] = "week_number_header";
16852 UI2["YearsDropdown"] = "years_dropdown";
16853 })(UI || (UI = {}));
16854 var DayFlag;
16855 (function(DayFlag2) {
16856 DayFlag2["disabled"] = "disabled";
16857 DayFlag2["hidden"] = "hidden";
16858 DayFlag2["outside"] = "outside";
16859 DayFlag2["focused"] = "focused";
16860 DayFlag2["today"] = "today";
16861 })(DayFlag || (DayFlag = {}));
16862 var SelectionState;
16863 (function(SelectionState2) {
16864 SelectionState2["range_end"] = "range_end";
16865 SelectionState2["range_middle"] = "range_middle";
16866 SelectionState2["range_start"] = "range_start";
16867 SelectionState2["selected"] = "selected";
16868 })(SelectionState || (SelectionState = {}));
16869 var Animation;
16870 (function(Animation3) {
16871 Animation3["weeks_before_enter"] = "weeks_before_enter";
16872 Animation3["weeks_before_exit"] = "weeks_before_exit";
16873 Animation3["weeks_after_enter"] = "weeks_after_enter";
16874 Animation3["weeks_after_exit"] = "weeks_after_exit";
16875 Animation3["caption_after_enter"] = "caption_after_enter";
16876 Animation3["caption_after_exit"] = "caption_after_exit";
16877 Animation3["caption_before_enter"] = "caption_before_enter";
16878 Animation3["caption_before_exit"] = "caption_before_exit";
16879 })(Animation || (Animation = {}));
16880
16881 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useDayPicker.js
16882 var import_react10 = __toESM(require_react(), 1);
16883 var dayPickerContext = (0, import_react10.createContext)(void 0);
16884 function useDayPicker() {
16885 const context = (0, import_react10.useContext)(dayPickerContext);
16886 if (context === void 0) {
16887 throw new Error("useDayPicker() must be used within a custom component.");
16888 }
16889 return context;
16890 }
16891
16892 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js
16893 function Dropdown(props) {
16894 const { options, className, ...selectProps } = props;
16895 const { classNames, components, styles } = useDayPicker();
16896 const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
16897 const selectedOption = options?.find(({ value }) => value === selectProps.value);
16898 return import_react11.default.createElement(
16899 "span",
16900 { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] },
16901 import_react11.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled: disabled2 }) => import_react11.default.createElement(components.Option, { key: value, value, disabled: disabled2 }, label))),
16902 import_react11.default.createElement(
16903 "span",
16904 { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], "aria-hidden": true },
16905 selectedOption?.label,
16906 import_react11.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] })
16907 )
16908 );
16909 }
16910
16911 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DropdownNav.js
16912 var import_react12 = __toESM(require_react(), 1);
16913 function DropdownNav(props) {
16914 return import_react12.default.createElement("div", { ...props });
16915 }
16916
16917 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Footer.js
16918 var import_react13 = __toESM(require_react(), 1);
16919 function Footer(props) {
16920 return import_react13.default.createElement("div", { ...props });
16921 }
16922
16923 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Month.js
16924 var import_react14 = __toESM(require_react(), 1);
16925 function Month(props) {
16926 const { calendarMonth, displayIndex, ...divProps } = props;
16927 return import_react14.default.createElement("div", { ...divProps }, props.children);
16928 }
16929
16930 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthCaption.js
16931 var import_react15 = __toESM(require_react(), 1);
16932 function MonthCaption(props) {
16933 const { calendarMonth, displayIndex, ...divProps } = props;
16934 return import_react15.default.createElement("div", { ...divProps });
16935 }
16936
16937 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthGrid.js
16938 var import_react16 = __toESM(require_react(), 1);
16939 function MonthGrid(props) {
16940 return import_react16.default.createElement("table", { ...props });
16941 }
16942
16943 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Months.js
16944 var import_react17 = __toESM(require_react(), 1);
16945 function Months(props) {
16946 return import_react17.default.createElement("div", { ...props });
16947 }
16948
16949 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js
16950 var import_react18 = __toESM(require_react(), 1);
16951 function MonthsDropdown(props) {
16952 const { components } = useDayPicker();
16953 return import_react18.default.createElement(components.Dropdown, { ...props });
16954 }
16955
16956 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Nav.js
16957 var import_react19 = __toESM(require_react(), 1);
16958 function Nav(props) {
16959 const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
16960 const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
16961 const handleNextClick = (0, import_react19.useCallback)((e) => {
16962 if (nextMonth) {
16963 onNextClick?.(e);
16964 }
16965 }, [nextMonth, onNextClick]);
16966 const handlePreviousClick = (0, import_react19.useCallback)((e) => {
16967 if (previousMonth) {
16968 onPreviousClick?.(e);
16969 }
16970 }, [previousMonth, onPreviousClick]);
16971 return import_react19.default.createElement(
16972 "nav",
16973 { ...navProps },
16974 import_react19.default.createElement(
16975 components.PreviousMonthButton,
16976 { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
16977 import_react19.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: "left" })
16978 ),
16979 import_react19.default.createElement(
16980 components.NextMonthButton,
16981 { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
16982 import_react19.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] })
16983 )
16984 );
16985 }
16986
16987 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js
16988 var import_react20 = __toESM(require_react(), 1);
16989 function NextMonthButton(props) {
16990 return import_react20.default.createElement("button", { ...props });
16991 }
16992
16993 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Option.js
16994 var import_react21 = __toESM(require_react(), 1);
16995 function Option(props) {
16996 return import_react21.default.createElement("option", { ...props });
16997 }
16998
16999 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js
17000 var import_react22 = __toESM(require_react(), 1);
17001 function PreviousMonthButton(props) {
17002 return import_react22.default.createElement("button", { ...props });
17003 }
17004
17005 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Root.js
17006 var import_react23 = __toESM(require_react(), 1);
17007 function Root2(props) {
17008 const { rootRef, ...rest } = props;
17009 return import_react23.default.createElement("div", { ...rest, ref: rootRef });
17010 }
17011
17012 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Select.js
17013 var import_react24 = __toESM(require_react(), 1);
17014 function Select(props) {
17015 return import_react24.default.createElement("select", { ...props });
17016 }
17017
17018 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Week.js
17019 var import_react25 = __toESM(require_react(), 1);
17020 function Week(props) {
17021 const { week, ...trProps } = props;
17022 return import_react25.default.createElement("tr", { ...trProps });
17023 }
17024
17025 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekday.js
17026 var import_react26 = __toESM(require_react(), 1);
17027 function Weekday(props) {
17028 return import_react26.default.createElement("th", { ...props });
17029 }
17030
17031 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekdays.js
17032 var import_react27 = __toESM(require_react(), 1);
17033 function Weekdays(props) {
17034 return import_react27.default.createElement(
17035 "thead",
17036 { "aria-hidden": true },
17037 import_react27.default.createElement("tr", { ...props })
17038 );
17039 }
17040
17041 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumber.js
17042 var import_react28 = __toESM(require_react(), 1);
17043 function WeekNumber(props) {
17044 const { week, ...thProps } = props;
17045 return import_react28.default.createElement("th", { ...thProps });
17046 }
17047
17048 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js
17049 var import_react29 = __toESM(require_react(), 1);
17050 function WeekNumberHeader(props) {
17051 return import_react29.default.createElement("th", { ...props });
17052 }
17053
17054 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weeks.js
17055 var import_react30 = __toESM(require_react(), 1);
17056 function Weeks(props) {
17057 return import_react30.default.createElement("tbody", { ...props });
17058 }
17059
17060 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js
17061 var import_react31 = __toESM(require_react(), 1);
17062 function YearsDropdown(props) {
17063 const { components } = useDayPicker();
17064 return import_react31.default.createElement(components.Dropdown, { ...props });
17065 }
17066
17067 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js
17068 var import_react36 = __toESM(require_react(), 1);
17069
17070 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js
17071 function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) {
17072 let { from, to: to2 } = range;
17073 const { differenceInCalendarDays: differenceInCalendarDays2, isSameDay: isSameDay2 } = dateLib;
17074 if (from && to2) {
17075 const isRangeInverted = differenceInCalendarDays2(to2, from) < 0;
17076 if (isRangeInverted) {
17077 [from, to2] = [to2, from];
17078 }
17079 const isInRange = differenceInCalendarDays2(date, from) >= (excludeEnds ? 1 : 0) && differenceInCalendarDays2(to2, date) >= (excludeEnds ? 1 : 0);
17080 return isInRange;
17081 }
17082 if (!excludeEnds && to2) {
17083 return isSameDay2(to2, date);
17084 }
17085 if (!excludeEnds && from) {
17086 return isSameDay2(from, date);
17087 }
17088 return false;
17089 }
17090
17091 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/typeguards.js
17092 function isDateInterval(matcher) {
17093 return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher);
17094 }
17095 function isDateRange(value) {
17096 return Boolean(value && typeof value === "object" && "from" in value);
17097 }
17098 function isDateAfterType(value) {
17099 return Boolean(value && typeof value === "object" && "after" in value);
17100 }
17101 function isDateBeforeType(value) {
17102 return Boolean(value && typeof value === "object" && "before" in value);
17103 }
17104 function isDayOfWeekType(value) {
17105 return Boolean(value && typeof value === "object" && "dayOfWeek" in value);
17106 }
17107 function isDatesArray(value, dateLib) {
17108 return Array.isArray(value) && value.every(dateLib.isDate);
17109 }
17110
17111 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js
17112 function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
17113 const matchersArr = !Array.isArray(matchers) ? [matchers] : matchers;
17114 const { isSameDay: isSameDay2, differenceInCalendarDays: differenceInCalendarDays2, isAfter: isAfter2 } = dateLib;
17115 return matchersArr.some((matcher) => {
17116 if (typeof matcher === "boolean") {
17117 return matcher;
17118 }
17119 if (dateLib.isDate(matcher)) {
17120 return isSameDay2(date, matcher);
17121 }
17122 if (isDatesArray(matcher, dateLib)) {
17123 return matcher.some((matcherDate) => isSameDay2(date, matcherDate));
17124 }
17125 if (isDateRange(matcher)) {
17126 return rangeIncludesDate(matcher, date, false, dateLib);
17127 }
17128 if (isDayOfWeekType(matcher)) {
17129 if (!Array.isArray(matcher.dayOfWeek)) {
17130 return matcher.dayOfWeek === date.getDay();
17131 }
17132 return matcher.dayOfWeek.includes(date.getDay());
17133 }
17134 if (isDateInterval(matcher)) {
17135 const diffBefore = differenceInCalendarDays2(matcher.before, date);
17136 const diffAfter = differenceInCalendarDays2(matcher.after, date);
17137 const isDayBefore = diffBefore > 0;
17138 const isDayAfter = diffAfter < 0;
17139 const isClosedInterval = isAfter2(matcher.before, matcher.after);
17140 if (isClosedInterval) {
17141 return isDayAfter && isDayBefore;
17142 } else {
17143 return isDayBefore || isDayAfter;
17144 }
17145 }
17146 if (isDateAfterType(matcher)) {
17147 return differenceInCalendarDays2(date, matcher.after) > 0;
17148 }
17149 if (isDateBeforeType(matcher)) {
17150 return differenceInCalendarDays2(matcher.before, date) > 0;
17151 }
17152 if (typeof matcher === "function") {
17153 return matcher(date);
17154 }
17155 return false;
17156 });
17157 }
17158
17159 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js
17160 function createGetModifiers(days, props, navStart, navEnd, dateLib) {
17161 const { disabled: disabled2, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today() } = props;
17162 const { isSameDay: isSameDay2, isSameMonth: isSameMonth2, startOfMonth: startOfMonth2, isBefore: isBefore2, endOfMonth: endOfMonth2, isAfter: isAfter2 } = dateLib;
17163 const computedNavStart = navStart && startOfMonth2(navStart);
17164 const computedNavEnd = navEnd && endOfMonth2(navEnd);
17165 const internalModifiersMap = {
17166 [DayFlag.focused]: [],
17167 [DayFlag.outside]: [],
17168 [DayFlag.disabled]: [],
17169 [DayFlag.hidden]: [],
17170 [DayFlag.today]: []
17171 };
17172 const customModifiersMap = {};
17173 for (const day of days) {
17174 const { date, displayMonth } = day;
17175 const isOutside = Boolean(displayMonth && !isSameMonth2(date, displayMonth));
17176 const isBeforeNavStart = Boolean(computedNavStart && isBefore2(date, computedNavStart));
17177 const isAfterNavEnd = Boolean(computedNavEnd && isAfter2(date, computedNavEnd));
17178 const isDisabled = Boolean(disabled2 && dateMatchModifiers(date, disabled2, dateLib));
17179 const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeNavStart || isAfterNavEnd || // Broadcast calendar will show outside days as default
17180 !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
17181 const isToday = isSameDay2(date, today);
17182 if (isOutside)
17183 internalModifiersMap.outside.push(day);
17184 if (isDisabled)
17185 internalModifiersMap.disabled.push(day);
17186 if (isHidden)
17187 internalModifiersMap.hidden.push(day);
17188 if (isToday)
17189 internalModifiersMap.today.push(day);
17190 if (modifiers) {
17191 Object.keys(modifiers).forEach((name) => {
17192 const modifierValue = modifiers?.[name];
17193 const isMatch = modifierValue ? dateMatchModifiers(date, modifierValue, dateLib) : false;
17194 if (!isMatch)
17195 return;
17196 if (customModifiersMap[name]) {
17197 customModifiersMap[name].push(day);
17198 } else {
17199 customModifiersMap[name] = [day];
17200 }
17201 });
17202 }
17203 }
17204 return (day) => {
17205 const dayFlags = {
17206 [DayFlag.focused]: false,
17207 [DayFlag.disabled]: false,
17208 [DayFlag.hidden]: false,
17209 [DayFlag.outside]: false,
17210 [DayFlag.today]: false
17211 };
17212 const customModifiers = {};
17213 for (const name in internalModifiersMap) {
17214 const days2 = internalModifiersMap[name];
17215 dayFlags[name] = days2.some((d) => d === day);
17216 }
17217 for (const name in customModifiersMap) {
17218 customModifiers[name] = customModifiersMap[name].some((d) => d === day);
17219 }
17220 return {
17221 ...dayFlags,
17222 // custom modifiers should override all the previous ones
17223 ...customModifiers
17224 };
17225 };
17226 }
17227
17228 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js
17229 function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) {
17230 const modifierClassNames = Object.entries(modifiers).filter(([, active]) => active === true).reduce((previousValue, [key]) => {
17231 if (modifiersClassNames[key]) {
17232 previousValue.push(modifiersClassNames[key]);
17233 } else if (classNames[DayFlag[key]]) {
17234 previousValue.push(classNames[DayFlag[key]]);
17235 } else if (classNames[SelectionState[key]]) {
17236 previousValue.push(classNames[SelectionState[key]]);
17237 }
17238 return previousValue;
17239 }, [classNames[UI.Day]]);
17240 return modifierClassNames;
17241 }
17242
17243 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getComponents.js
17244 function getComponents(customComponents) {
17245 return {
17246 ...custom_components_exports,
17247 ...customComponents
17248 };
17249 }
17250
17251 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js
17252 function getDataAttributes(props) {
17253 const dataAttributes = {
17254 "data-mode": props.mode ?? void 0,
17255 "data-required": "required" in props ? props.required : void 0,
17256 "data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || void 0,
17257 "data-week-numbers": props.showWeekNumber || void 0,
17258 "data-broadcast-calendar": props.broadcastCalendar || void 0,
17259 "data-nav-layout": props.navLayout || void 0
17260 };
17261 Object.entries(props).forEach(([key, val]) => {
17262 if (key.startsWith("data-")) {
17263 dataAttributes[key] = val;
17264 }
17265 });
17266 return dataAttributes;
17267 }
17268
17269 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js
17270 function getDefaultClassNames() {
17271 const classNames = {};
17272 for (const key in UI) {
17273 classNames[UI[key]] = `rdp-${UI[key]}`;
17274 }
17275 for (const key in DayFlag) {
17276 classNames[DayFlag[key]] = `rdp-${DayFlag[key]}`;
17277 }
17278 for (const key in SelectionState) {
17279 classNames[SelectionState[key]] = `rdp-${SelectionState[key]}`;
17280 }
17281 for (const key in Animation) {
17282 classNames[Animation[key]] = `rdp-${Animation[key]}`;
17283 }
17284 return classNames;
17285 }
17286
17287 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/index.js
17288 var formatters_exports = {};
17289 __export(formatters_exports, {
17290 formatCaption: () => formatCaption,
17291 formatDay: () => formatDay,
17292 formatMonthDropdown: () => formatMonthDropdown,
17293 formatWeekNumber: () => formatWeekNumber,
17294 formatWeekNumberHeader: () => formatWeekNumberHeader,
17295 formatWeekdayName: () => formatWeekdayName,
17296 formatYearDropdown: () => formatYearDropdown
17297 });
17298
17299 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js
17300 function formatCaption(month, options, dateLib) {
17301 const lib = dateLib ?? new DateLib(options);
17302 return lib.formatMonthYear(month);
17303 }
17304
17305 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatDay.js
17306 function formatDay(date, options, dateLib) {
17307 return (dateLib ?? new DateLib(options)).format(date, "d");
17308 }
17309
17310 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js
17311 function formatMonthDropdown(month, dateLib = defaultDateLib) {
17312 return dateLib.format(month, "LLLL");
17313 }
17314
17315 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js
17316 function formatWeekdayName(weekday, options, dateLib) {
17317 return (dateLib ?? new DateLib(options)).format(weekday, "cccccc");
17318 }
17319
17320 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js
17321 function formatWeekNumber(weekNumber, dateLib = defaultDateLib) {
17322 if (weekNumber < 10) {
17323 return dateLib.formatNumber(`0${weekNumber.toLocaleString()}`);
17324 }
17325 return dateLib.formatNumber(`${weekNumber.toLocaleString()}`);
17326 }
17327
17328 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js
17329 function formatWeekNumberHeader() {
17330 return ``;
17331 }
17332
17333 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js
17334 function formatYearDropdown(year, dateLib = defaultDateLib) {
17335 return dateLib.format(year, "yyyy");
17336 }
17337
17338 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js
17339 function getFormatters(customFormatters) {
17340 return {
17341 ...formatters_exports,
17342 ...customFormatters
17343 };
17344 }
17345
17346 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/index.js
17347 var labels_exports = {};
17348 __export(labels_exports, {
17349 labelDayButton: () => labelDayButton,
17350 labelGrid: () => labelGrid,
17351 labelGridcell: () => labelGridcell,
17352 labelMonthDropdown: () => labelMonthDropdown,
17353 labelNav: () => labelNav,
17354 labelNext: () => labelNext,
17355 labelPrevious: () => labelPrevious,
17356 labelWeekNumber: () => labelWeekNumber,
17357 labelWeekNumberHeader: () => labelWeekNumberHeader,
17358 labelWeekday: () => labelWeekday,
17359 labelYearDropdown: () => labelYearDropdown
17360 });
17361
17362 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js
17363 function labelDayButton(date, modifiers, options, dateLib) {
17364 let label = (dateLib ?? new DateLib(options)).format(date, "PPPP");
17365 if (modifiers.today)
17366 label = `Today, ${label}`;
17367 if (modifiers.selected)
17368 label = `${label}, selected`;
17369 return label;
17370 }
17371
17372 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGrid.js
17373 function labelGrid(date, options, dateLib) {
17374 const lib = dateLib ?? new DateLib(options);
17375 return lib.formatMonthYear(date);
17376 }
17377
17378 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js
17379 function labelGridcell(date, modifiers, options, dateLib) {
17380 let label = (dateLib ?? new DateLib(options)).format(date, "PPPP");
17381 if (modifiers?.today) {
17382 label = `Today, ${label}`;
17383 }
17384 return label;
17385 }
17386
17387 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js
17388 function labelMonthDropdown(_options) {
17389 return "Choose the Month";
17390 }
17391
17392 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNav.js
17393 function labelNav() {
17394 return "";
17395 }
17396
17397 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNext.js
17398 var defaultLabel = "Go to the Next Month";
17399 function labelNext(_month, _options) {
17400 return defaultLabel;
17401 }
17402
17403 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js
17404 function labelPrevious(_month) {
17405 return "Go to the Previous Month";
17406 }
17407
17408 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js
17409 function labelWeekday(date, options, dateLib) {
17410 return (dateLib ?? new DateLib(options)).format(date, "cccc");
17411 }
17412
17413 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js
17414 function labelWeekNumber(weekNumber, _options) {
17415 return `Week ${weekNumber}`;
17416 }
17417
17418 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js
17419 function labelWeekNumberHeader(_options) {
17420 return "Week Number";
17421 }
17422
17423 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js
17424 function labelYearDropdown(_options) {
17425 return "Choose the Year";
17426 }
17427
17428 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getLabels.js
17429 var resolveLabel = (defaultLabel2, customLabel, localeLabel) => {
17430 if (customLabel)
17431 return customLabel;
17432 if (localeLabel) {
17433 return typeof localeLabel === "function" ? localeLabel : (..._args) => localeLabel;
17434 }
17435 return defaultLabel2;
17436 };
17437 function getLabels(customLabels, options) {
17438 const localeLabels = options.locale?.labels ?? {};
17439 return {
17440 ...labels_exports,
17441 ...customLabels ?? {},
17442 labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton),
17443 labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown),
17444 labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext),
17445 labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious),
17446 labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber),
17447 labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown),
17448 labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid),
17449 labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell),
17450 labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav),
17451 labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader),
17452 labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday)
17453 };
17454 }
17455
17456 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js
17457 function getMonthOptions(displayMonth, navStart, navEnd, formatters2, dateLib) {
17458 const { startOfMonth: startOfMonth2, startOfYear: startOfYear2, endOfYear: endOfYear2, eachMonthOfInterval: eachMonthOfInterval2, getMonth: getMonth2 } = dateLib;
17459 const months = eachMonthOfInterval2({
17460 start: startOfYear2(displayMonth),
17461 end: endOfYear2(displayMonth)
17462 });
17463 const options = months.map((month) => {
17464 const label = formatters2.formatMonthDropdown(month, dateLib);
17465 const value = getMonth2(month);
17466 const disabled2 = navStart && month < startOfMonth2(navStart) || navEnd && month > startOfMonth2(navEnd) || false;
17467 return { value, label, disabled: disabled2 };
17468 });
17469 return options;
17470 }
17471
17472 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js
17473 function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) {
17474 let style = { ...styles?.[UI.Day] };
17475 Object.entries(dayModifiers).filter(([, active]) => active === true).forEach(([modifier]) => {
17476 style = {
17477 ...style,
17478 ...modifiersStyles?.[modifier]
17479 };
17480 });
17481 return style;
17482 }
17483
17484 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js
17485 function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) {
17486 const referenceToday = today ?? dateLib.today();
17487 const start2 = broadcastCalendar ? dateLib.startOfBroadcastWeek(referenceToday, dateLib) : ISOWeek ? dateLib.startOfISOWeek(referenceToday) : dateLib.startOfWeek(referenceToday);
17488 const days = [];
17489 for (let i = 0; i < 7; i++) {
17490 const day = dateLib.addDays(start2, i);
17491 days.push(day);
17492 }
17493 return days;
17494 }
17495
17496 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js
17497 function getYearOptions(navStart, navEnd, formatters2, dateLib, reverse = false) {
17498 if (!navStart)
17499 return void 0;
17500 if (!navEnd)
17501 return void 0;
17502 const { startOfYear: startOfYear2, endOfYear: endOfYear2, eachYearOfInterval: eachYearOfInterval2, getYear: getYear2 } = dateLib;
17503 const firstNavYear = startOfYear2(navStart);
17504 const lastNavYear = endOfYear2(navEnd);
17505 const years = eachYearOfInterval2({ start: firstNavYear, end: lastNavYear });
17506 if (reverse)
17507 years.reverse();
17508 return years.map((year) => {
17509 const label = formatters2.formatYearDropdown(year, dateLib);
17510 return {
17511 value: getYear2(year),
17512 label,
17513 disabled: false
17514 };
17515 });
17516 }
17517
17518 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/noonDateLib.js
17519 function createNoonOverrides(timeZone, options = {}) {
17520 const { weekStartsOn, locale } = options;
17521 const fallbackWeekStartsOn = weekStartsOn ?? locale?.options?.weekStartsOn ?? 0;
17522 const toNoonTZDate = (date) => {
17523 const normalizedDate = typeof date === "number" || typeof date === "string" ? new Date(date) : date;
17524 return new TZDate(normalizedDate.getFullYear(), normalizedDate.getMonth(), normalizedDate.getDate(), 12, 0, 0, timeZone);
17525 };
17526 const toCalendarDate2 = (date) => {
17527 const zoned = toNoonTZDate(date);
17528 return new Date(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 0, 0, 0, 0);
17529 };
17530 return {
17531 today: () => {
17532 return toNoonTZDate(TZDate.tz(timeZone));
17533 },
17534 newDate: (year, monthIndex, date) => {
17535 return new TZDate(year, monthIndex, date, 12, 0, 0, timeZone);
17536 },
17537 startOfDay: (date) => {
17538 return toNoonTZDate(date);
17539 },
17540 startOfWeek: (date, options2) => {
17541 const base = toNoonTZDate(date);
17542 const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn;
17543 const diff = (base.getDay() - weekStartsOnValue + 7) % 7;
17544 base.setDate(base.getDate() - diff);
17545 return base;
17546 },
17547 startOfISOWeek: (date) => {
17548 const base = toNoonTZDate(date);
17549 const diff = (base.getDay() - 1 + 7) % 7;
17550 base.setDate(base.getDate() - diff);
17551 return base;
17552 },
17553 startOfMonth: (date) => {
17554 const base = toNoonTZDate(date);
17555 base.setDate(1);
17556 return base;
17557 },
17558 startOfYear: (date) => {
17559 const base = toNoonTZDate(date);
17560 base.setMonth(0, 1);
17561 return base;
17562 },
17563 endOfWeek: (date, options2) => {
17564 const base = toNoonTZDate(date);
17565 const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn;
17566 const endDow = (weekStartsOnValue + 6) % 7;
17567 const diff = (endDow - base.getDay() + 7) % 7;
17568 base.setDate(base.getDate() + diff);
17569 return base;
17570 },
17571 endOfISOWeek: (date) => {
17572 const base = toNoonTZDate(date);
17573 const diff = (7 - base.getDay()) % 7;
17574 base.setDate(base.getDate() + diff);
17575 return base;
17576 },
17577 endOfMonth: (date) => {
17578 const base = toNoonTZDate(date);
17579 base.setMonth(base.getMonth() + 1, 0);
17580 return base;
17581 },
17582 endOfYear: (date) => {
17583 const base = toNoonTZDate(date);
17584 base.setMonth(11, 31);
17585 return base;
17586 },
17587 eachMonthOfInterval: (interval) => {
17588 const start2 = toNoonTZDate(interval.start);
17589 const end = toNoonTZDate(interval.end);
17590 const result = [];
17591 const cursor = new TZDate(start2.getFullYear(), start2.getMonth(), 1, 12, 0, 0, timeZone);
17592 const endKey = end.getFullYear() * 12 + end.getMonth();
17593 while (cursor.getFullYear() * 12 + cursor.getMonth() <= endKey) {
17594 result.push(new TZDate(cursor, timeZone));
17595 cursor.setMonth(cursor.getMonth() + 1, 1);
17596 }
17597 return result;
17598 },
17599 // Normalize to noon once before arithmetic (avoid DST/midnight edge cases),
17600 // mutate the same TZDate, and return it.
17601 addDays: (date, amount) => {
17602 const base = toNoonTZDate(date);
17603 base.setDate(base.getDate() + amount);
17604 return base;
17605 },
17606 addWeeks: (date, amount) => {
17607 const base = toNoonTZDate(date);
17608 base.setDate(base.getDate() + amount * 7);
17609 return base;
17610 },
17611 addMonths: (date, amount) => {
17612 const base = toNoonTZDate(date);
17613 base.setMonth(base.getMonth() + amount);
17614 return base;
17615 },
17616 addYears: (date, amount) => {
17617 const base = toNoonTZDate(date);
17618 base.setFullYear(base.getFullYear() + amount);
17619 return base;
17620 },
17621 eachYearOfInterval: (interval) => {
17622 const start2 = toNoonTZDate(interval.start);
17623 const end = toNoonTZDate(interval.end);
17624 const years = [];
17625 const cursor = new TZDate(start2.getFullYear(), 0, 1, 12, 0, 0, timeZone);
17626 while (cursor.getFullYear() <= end.getFullYear()) {
17627 years.push(new TZDate(cursor, timeZone));
17628 cursor.setFullYear(cursor.getFullYear() + 1, 0, 1);
17629 }
17630 return years;
17631 },
17632 getWeek: (date, options2) => {
17633 const base = toCalendarDate2(date);
17634 return getWeek(base, {
17635 weekStartsOn: options2?.weekStartsOn ?? fallbackWeekStartsOn,
17636 firstWeekContainsDate: options2?.firstWeekContainsDate ?? locale?.options?.firstWeekContainsDate ?? 1
17637 });
17638 },
17639 getISOWeek: (date) => {
17640 const base = toCalendarDate2(date);
17641 return getISOWeek(base);
17642 },
17643 differenceInCalendarDays: (dateLeft, dateRight) => {
17644 const left = toCalendarDate2(dateLeft);
17645 const right = toCalendarDate2(dateRight);
17646 return differenceInCalendarDays(left, right);
17647 },
17648 differenceInCalendarMonths: (dateLeft, dateRight) => {
17649 const left = toCalendarDate2(dateLeft);
17650 const right = toCalendarDate2(dateRight);
17651 return differenceInCalendarMonths(left, right);
17652 }
17653 };
17654 }
17655
17656 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useAnimation.js
17657 var import_react32 = __toESM(require_react(), 1);
17658 var asHtmlElement = (element) => {
17659 if (element instanceof HTMLElement)
17660 return element;
17661 return null;
17662 };
17663 var queryMonthEls = (element) => [
17664 ...element.querySelectorAll("[data-animated-month]") ?? []
17665 ];
17666 var queryMonthEl = (element) => asHtmlElement(element.querySelector("[data-animated-month]"));
17667 var queryCaptionEl = (element) => asHtmlElement(element.querySelector("[data-animated-caption]"));
17668 var queryWeeksEl = (element) => asHtmlElement(element.querySelector("[data-animated-weeks]"));
17669 var queryNavEl = (element) => asHtmlElement(element.querySelector("[data-animated-nav]"));
17670 var queryWeekdaysEl = (element) => asHtmlElement(element.querySelector("[data-animated-weekdays]"));
17671 function useAnimation(rootElRef, enabled, { classNames, months, focused, dateLib }) {
17672 const previousRootElSnapshotRef = (0, import_react32.useRef)(null);
17673 const previousMonthsRef = (0, import_react32.useRef)(months);
17674 const animatingRef = (0, import_react32.useRef)(false);
17675 (0, import_react32.useLayoutEffect)(() => {
17676 const previousMonths = previousMonthsRef.current;
17677 previousMonthsRef.current = months;
17678 if (!enabled || !rootElRef.current || // safety check because the ref can be set to anything by consumers
17679 !(rootElRef.current instanceof HTMLElement) || // validation required for the animation to work as expected
17680 months.length === 0 || previousMonths.length === 0 || months.length !== previousMonths.length) {
17681 return;
17682 }
17683 const isSameMonth2 = dateLib.isSameMonth(months[0].date, previousMonths[0].date);
17684 const isAfterPreviousMonth = dateLib.isAfter(months[0].date, previousMonths[0].date);
17685 const captionAnimationClass = isAfterPreviousMonth ? classNames[Animation.caption_after_enter] : classNames[Animation.caption_before_enter];
17686 const weeksAnimationClass = isAfterPreviousMonth ? classNames[Animation.weeks_after_enter] : classNames[Animation.weeks_before_enter];
17687 const previousRootElSnapshot = previousRootElSnapshotRef.current;
17688 const rootElSnapshot = rootElRef.current.cloneNode(true);
17689 if (rootElSnapshot instanceof HTMLElement) {
17690 const currentMonthElsSnapshot = queryMonthEls(rootElSnapshot);
17691 currentMonthElsSnapshot.forEach((currentMonthElSnapshot) => {
17692 if (!(currentMonthElSnapshot instanceof HTMLElement))
17693 return;
17694 const previousMonthElSnapshot = queryMonthEl(currentMonthElSnapshot);
17695 if (previousMonthElSnapshot && currentMonthElSnapshot.contains(previousMonthElSnapshot)) {
17696 currentMonthElSnapshot.removeChild(previousMonthElSnapshot);
17697 }
17698 const captionEl = queryCaptionEl(currentMonthElSnapshot);
17699 if (captionEl) {
17700 captionEl.classList.remove(captionAnimationClass);
17701 }
17702 const weeksEl = queryWeeksEl(currentMonthElSnapshot);
17703 if (weeksEl) {
17704 weeksEl.classList.remove(weeksAnimationClass);
17705 }
17706 });
17707 previousRootElSnapshotRef.current = rootElSnapshot;
17708 } else {
17709 previousRootElSnapshotRef.current = null;
17710 }
17711 if (animatingRef.current || isSameMonth2 || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
17712 focused) {
17713 return;
17714 }
17715 const previousMonthEls = previousRootElSnapshot instanceof HTMLElement ? queryMonthEls(previousRootElSnapshot) : [];
17716 const currentMonthEls = queryMonthEls(rootElRef.current);
17717 if (currentMonthEls?.every((el) => el instanceof HTMLElement) && previousMonthEls?.every((el) => el instanceof HTMLElement)) {
17718 animatingRef.current = true;
17719 const cleanUpFunctions = [];
17720 rootElRef.current.style.isolation = "isolate";
17721 const navEl = queryNavEl(rootElRef.current);
17722 if (navEl) {
17723 navEl.style.zIndex = "1";
17724 }
17725 currentMonthEls.forEach((currentMonthEl, index2) => {
17726 const previousMonthEl = previousMonthEls[index2];
17727 if (!previousMonthEl) {
17728 return;
17729 }
17730 currentMonthEl.style.position = "relative";
17731 currentMonthEl.style.overflow = "hidden";
17732 const captionEl = queryCaptionEl(currentMonthEl);
17733 if (captionEl) {
17734 captionEl.classList.add(captionAnimationClass);
17735 }
17736 const weeksEl = queryWeeksEl(currentMonthEl);
17737 if (weeksEl) {
17738 weeksEl.classList.add(weeksAnimationClass);
17739 }
17740 const cleanUp = () => {
17741 animatingRef.current = false;
17742 if (rootElRef.current) {
17743 rootElRef.current.style.isolation = "";
17744 }
17745 if (navEl) {
17746 navEl.style.zIndex = "";
17747 }
17748 if (captionEl) {
17749 captionEl.classList.remove(captionAnimationClass);
17750 }
17751 if (weeksEl) {
17752 weeksEl.classList.remove(weeksAnimationClass);
17753 }
17754 currentMonthEl.style.position = "";
17755 currentMonthEl.style.overflow = "";
17756 if (currentMonthEl.contains(previousMonthEl)) {
17757 currentMonthEl.removeChild(previousMonthEl);
17758 }
17759 };
17760 cleanUpFunctions.push(cleanUp);
17761 previousMonthEl.style.pointerEvents = "none";
17762 previousMonthEl.style.position = "absolute";
17763 previousMonthEl.style.overflow = "hidden";
17764 previousMonthEl.setAttribute("aria-hidden", "true");
17765 const previousWeekdaysEl = queryWeekdaysEl(previousMonthEl);
17766 if (previousWeekdaysEl) {
17767 previousWeekdaysEl.style.opacity = "0";
17768 }
17769 const previousCaptionEl = queryCaptionEl(previousMonthEl);
17770 if (previousCaptionEl) {
17771 previousCaptionEl.classList.add(isAfterPreviousMonth ? classNames[Animation.caption_before_exit] : classNames[Animation.caption_after_exit]);
17772 previousCaptionEl.addEventListener("animationend", cleanUp);
17773 }
17774 const previousWeeksEl = queryWeeksEl(previousMonthEl);
17775 if (previousWeeksEl) {
17776 previousWeeksEl.classList.add(isAfterPreviousMonth ? classNames[Animation.weeks_before_exit] : classNames[Animation.weeks_after_exit]);
17777 }
17778 currentMonthEl.insertBefore(previousMonthEl, currentMonthEl.firstChild);
17779 });
17780 }
17781 });
17782 }
17783
17784 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js
17785 var import_react34 = __toESM(require_react(), 1);
17786
17787 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDates.js
17788 function getDates(displayMonths, maxDate, props, dateLib) {
17789 const firstMonth = displayMonths[0];
17790 const lastMonth = displayMonths[displayMonths.length - 1];
17791 const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {};
17792 const { addDays: addDays2, differenceInCalendarDays: differenceInCalendarDays2, differenceInCalendarMonths: differenceInCalendarMonths2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, isAfter: isAfter2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
17793 const startWeekFirstDate = broadcastCalendar ? startOfBroadcastWeek2(firstMonth, dateLib) : ISOWeek ? startOfISOWeek2(firstMonth) : startOfWeek2(firstMonth);
17794 const displayMonthsWeekEnd = broadcastCalendar ? endOfBroadcastWeek2(lastMonth) : ISOWeek ? endOfISOWeek2(endOfMonth2(lastMonth)) : endOfWeek2(endOfMonth2(lastMonth));
17795 const constraintWeekEnd = maxDate && (broadcastCalendar ? endOfBroadcastWeek2(maxDate) : ISOWeek ? endOfISOWeek2(maxDate) : endOfWeek2(maxDate));
17796 const gridEndDate = constraintWeekEnd && isAfter2(displayMonthsWeekEnd, constraintWeekEnd) ? constraintWeekEnd : displayMonthsWeekEnd;
17797 const nOfDays = differenceInCalendarDays2(gridEndDate, startWeekFirstDate);
17798 const nOfMonths = differenceInCalendarMonths2(lastMonth, firstMonth) + 1;
17799 const dates = [];
17800 for (let i = 0; i <= nOfDays; i++) {
17801 const date = addDays2(startWeekFirstDate, i);
17802 dates.push(date);
17803 }
17804 const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;
17805 const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
17806 if (fixedWeeks && dates.length < extraDates) {
17807 const daysToAdd = extraDates - dates.length;
17808 for (let i = 0; i < daysToAdd; i++) {
17809 const date = addDays2(dates[dates.length - 1], 1);
17810 dates.push(date);
17811 }
17812 }
17813 return dates;
17814 }
17815
17816 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDays.js
17817 function getDays(calendarMonths) {
17818 const initialDays = [];
17819 return calendarMonths.reduce((days, month) => {
17820 const weekDays = month.weeks.reduce((weekDays2, week) => {
17821 return weekDays2.concat(week.days.slice());
17822 }, initialDays.slice());
17823 return days.concat(weekDays.slice());
17824 }, initialDays.slice());
17825 }
17826
17827 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js
17828 function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) {
17829 const { numberOfMonths = 1 } = props;
17830 const months = [];
17831 for (let i = 0; i < numberOfMonths; i++) {
17832 const month = dateLib.addMonths(firstDisplayedMonth, i);
17833 if (calendarEndMonth && month > calendarEndMonth) {
17834 break;
17835 }
17836 months.push(month);
17837 }
17838 return months;
17839 }
17840
17841 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js
17842 function getInitialMonth(props, navStart, navEnd, dateLib) {
17843 const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1 } = props;
17844 let initialMonth = month || defaultMonth || today;
17845 const { differenceInCalendarMonths: differenceInCalendarMonths2, addMonths: addMonths2, startOfMonth: startOfMonth2 } = dateLib;
17846 if (navEnd && differenceInCalendarMonths2(navEnd, initialMonth) < numberOfMonths - 1) {
17847 const offset4 = -1 * (numberOfMonths - 1);
17848 initialMonth = addMonths2(navEnd, offset4);
17849 }
17850 if (navStart && differenceInCalendarMonths2(initialMonth, navStart) < 0) {
17851 initialMonth = navStart;
17852 }
17853 return startOfMonth2(initialMonth);
17854 }
17855
17856 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonths.js
17857 function getMonths(displayMonths, dates, props, dateLib) {
17858 const { addDays: addDays2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, getISOWeek: getISOWeek2, getWeek: getWeek2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
17859 const dayPickerMonths = displayMonths.reduce((months, month) => {
17860 const firstDateOfFirstWeek = props.broadcastCalendar ? startOfBroadcastWeek2(month, dateLib) : props.ISOWeek ? startOfISOWeek2(month) : startOfWeek2(month);
17861 const lastDateOfLastWeek = props.broadcastCalendar ? endOfBroadcastWeek2(month) : props.ISOWeek ? endOfISOWeek2(endOfMonth2(month)) : endOfWeek2(endOfMonth2(month));
17862 const monthDates = dates.filter((date) => {
17863 return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
17864 });
17865 const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;
17866 if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
17867 const extraDates = dates.filter((date) => {
17868 const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;
17869 return date > lastDateOfLastWeek && date <= addDays2(lastDateOfLastWeek, daysToAdd);
17870 });
17871 monthDates.push(...extraDates);
17872 }
17873 const weeks = monthDates.reduce((weeks2, date) => {
17874 const weekNumber = props.ISOWeek ? getISOWeek2(date) : getWeek2(date);
17875 const week = weeks2.find((week2) => week2.weekNumber === weekNumber);
17876 const day = new CalendarDay(date, month, dateLib);
17877 if (!week) {
17878 weeks2.push(new CalendarWeek(weekNumber, [day]));
17879 } else {
17880 week.days.push(day);
17881 }
17882 return weeks2;
17883 }, []);
17884 const dayPickerMonth = new CalendarMonth(month, weeks);
17885 months.push(dayPickerMonth);
17886 return months;
17887 }, []);
17888 if (!props.reverseMonths) {
17889 return dayPickerMonths;
17890 } else {
17891 return dayPickerMonths.reverse();
17892 }
17893 }
17894
17895 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js
17896 function getNavMonths(props, dateLib) {
17897 let { startMonth, endMonth } = props;
17898 const { startOfYear: startOfYear2, startOfDay: startOfDay2, startOfMonth: startOfMonth2, endOfMonth: endOfMonth2, addYears: addYears2, endOfYear: endOfYear2, today } = dateLib;
17899 const hasYearDropdown = props.captionLayout === "dropdown" || props.captionLayout === "dropdown-years";
17900 if (startMonth) {
17901 startMonth = startOfMonth2(startMonth);
17902 } else if (!startMonth && hasYearDropdown) {
17903 startMonth = startOfYear2(addYears2(props.today ?? today(), -100));
17904 }
17905 if (endMonth) {
17906 endMonth = endOfMonth2(endMonth);
17907 } else if (!endMonth && hasYearDropdown) {
17908 endMonth = endOfYear2(props.today ?? today());
17909 }
17910 return [
17911 startMonth ? startOfDay2(startMonth) : startMonth,
17912 endMonth ? startOfDay2(endMonth) : endMonth
17913 ];
17914 }
17915
17916 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js
17917 function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) {
17918 if (options.disableNavigation) {
17919 return void 0;
17920 }
17921 const { pagedNavigation, numberOfMonths = 1 } = options;
17922 const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib;
17923 const offset4 = pagedNavigation ? numberOfMonths : 1;
17924 const month = startOfMonth2(firstDisplayedMonth);
17925 if (!calendarEndMonth) {
17926 return addMonths2(month, offset4);
17927 }
17928 const monthsDiff = differenceInCalendarMonths2(calendarEndMonth, firstDisplayedMonth);
17929 if (monthsDiff < numberOfMonths) {
17930 return void 0;
17931 }
17932 return addMonths2(month, offset4);
17933 }
17934
17935 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js
17936 function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) {
17937 if (options.disableNavigation) {
17938 return void 0;
17939 }
17940 const { pagedNavigation, numberOfMonths } = options;
17941 const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib;
17942 const offset4 = pagedNavigation ? numberOfMonths ?? 1 : 1;
17943 const month = startOfMonth2(firstDisplayedMonth);
17944 if (!calendarStartMonth) {
17945 return addMonths2(month, -offset4);
17946 }
17947 const monthsDiff = differenceInCalendarMonths2(month, calendarStartMonth);
17948 if (monthsDiff <= 0) {
17949 return void 0;
17950 }
17951 return addMonths2(month, -offset4);
17952 }
17953
17954 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js
17955 function getWeeks(months) {
17956 const initialWeeks = [];
17957 return months.reduce((weeks, month) => {
17958 return weeks.concat(month.weeks.slice());
17959 }, initialWeeks.slice());
17960 }
17961
17962 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js
17963 var import_react33 = __toESM(require_react(), 1);
17964 function useControlledValue(defaultValue, controlledValue) {
17965 const [uncontrolledValue, setValue] = (0, import_react33.useState)(defaultValue);
17966 const value = controlledValue === void 0 ? uncontrolledValue : controlledValue;
17967 return [value, setValue];
17968 }
17969
17970 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js
17971 function useCalendar(props, dateLib) {
17972 const [navStart, navEnd] = getNavMonths(props, dateLib);
17973 const { startOfMonth: startOfMonth2, endOfMonth: endOfMonth2 } = dateLib;
17974 const initialMonth = getInitialMonth(props, navStart, navEnd, dateLib);
17975 const [firstMonth, setFirstMonth] = useControlledValue(
17976 initialMonth,
17977 // initialMonth is always computed from props.month if provided
17978 props.month ? initialMonth : void 0
17979 );
17980 (0, import_react34.useEffect)(() => {
17981 const newInitialMonth = getInitialMonth(props, navStart, navEnd, dateLib);
17982 setFirstMonth(newInitialMonth);
17983 }, [props.timeZone]);
17984 const { months, weeks, days, previousMonth, nextMonth } = (0, import_react34.useMemo)(() => {
17985 const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib);
17986 const dates = getDates(displayMonths, props.endMonth ? endOfMonth2(props.endMonth) : void 0, {
17987 ISOWeek: props.ISOWeek,
17988 fixedWeeks: props.fixedWeeks,
17989 broadcastCalendar: props.broadcastCalendar
17990 }, dateLib);
17991 const months2 = getMonths(displayMonths, dates, {
17992 broadcastCalendar: props.broadcastCalendar,
17993 fixedWeeks: props.fixedWeeks,
17994 ISOWeek: props.ISOWeek,
17995 reverseMonths: props.reverseMonths
17996 }, dateLib);
17997 const weeks2 = getWeeks(months2);
17998 const days2 = getDays(months2);
17999 const previousMonth2 = getPreviousMonth(firstMonth, navStart, props, dateLib);
18000 const nextMonth2 = getNextMonth(firstMonth, navEnd, props, dateLib);
18001 return {
18002 months: months2,
18003 weeks: weeks2,
18004 days: days2,
18005 previousMonth: previousMonth2,
18006 nextMonth: nextMonth2
18007 };
18008 }, [
18009 dateLib,
18010 firstMonth.getTime(),
18011 navEnd?.getTime(),
18012 navStart?.getTime(),
18013 props.disableNavigation,
18014 props.broadcastCalendar,
18015 props.endMonth?.getTime(),
18016 props.fixedWeeks,
18017 props.ISOWeek,
18018 props.numberOfMonths,
18019 props.pagedNavigation,
18020 props.reverseMonths
18021 ]);
18022 const { disableNavigation, onMonthChange } = props;
18023 const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day)));
18024 const goToMonth = (date) => {
18025 if (disableNavigation) {
18026 return;
18027 }
18028 let newMonth = startOfMonth2(date);
18029 if (navStart && newMonth < startOfMonth2(navStart)) {
18030 newMonth = startOfMonth2(navStart);
18031 }
18032 if (navEnd && newMonth > startOfMonth2(navEnd)) {
18033 newMonth = startOfMonth2(navEnd);
18034 }
18035 setFirstMonth(newMonth);
18036 onMonthChange?.(newMonth);
18037 };
18038 const goToDay = (day) => {
18039 if (isDayInCalendar(day)) {
18040 return;
18041 }
18042 goToMonth(day.date);
18043 };
18044 const calendar = {
18045 months,
18046 weeks,
18047 days,
18048 navStart,
18049 navEnd,
18050 previousMonth,
18051 nextMonth,
18052 goToMonth,
18053 goToDay
18054 };
18055 return calendar;
18056 }
18057
18058 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js
18059 var import_react35 = __toESM(require_react(), 1);
18060
18061 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js
18062 var FocusTargetPriority;
18063 (function(FocusTargetPriority2) {
18064 FocusTargetPriority2[FocusTargetPriority2["Today"] = 0] = "Today";
18065 FocusTargetPriority2[FocusTargetPriority2["Selected"] = 1] = "Selected";
18066 FocusTargetPriority2[FocusTargetPriority2["LastFocused"] = 2] = "LastFocused";
18067 FocusTargetPriority2[FocusTargetPriority2["FocusedModifier"] = 3] = "FocusedModifier";
18068 })(FocusTargetPriority || (FocusTargetPriority = {}));
18069 function isFocusableDay(modifiers) {
18070 return !modifiers[DayFlag.disabled] && !modifiers[DayFlag.hidden] && !modifiers[DayFlag.outside];
18071 }
18072 function calculateFocusTarget(days, getModifiers, isSelected, lastFocused) {
18073 let focusTarget;
18074 let foundFocusTargetPriority = -1;
18075 for (const day of days) {
18076 const modifiers = getModifiers(day);
18077 if (isFocusableDay(modifiers)) {
18078 if (modifiers[DayFlag.focused] && foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) {
18079 focusTarget = day;
18080 foundFocusTargetPriority = FocusTargetPriority.FocusedModifier;
18081 } else if (lastFocused?.isEqualTo(day) && foundFocusTargetPriority < FocusTargetPriority.LastFocused) {
18082 focusTarget = day;
18083 foundFocusTargetPriority = FocusTargetPriority.LastFocused;
18084 } else if (isSelected(day.date) && foundFocusTargetPriority < FocusTargetPriority.Selected) {
18085 focusTarget = day;
18086 foundFocusTargetPriority = FocusTargetPriority.Selected;
18087 } else if (modifiers[DayFlag.today] && foundFocusTargetPriority < FocusTargetPriority.Today) {
18088 focusTarget = day;
18089 foundFocusTargetPriority = FocusTargetPriority.Today;
18090 }
18091 }
18092 }
18093 if (!focusTarget) {
18094 focusTarget = days.find((day) => isFocusableDay(getModifiers(day)));
18095 }
18096 return focusTarget;
18097 }
18098
18099 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js
18100 function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
18101 const { ISOWeek, broadcastCalendar } = props;
18102 const { addDays: addDays2, addMonths: addMonths2, addWeeks: addWeeks2, addYears: addYears2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfWeek: endOfWeek2, max: max3, min: min3, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
18103 const moveFns = {
18104 day: addDays2,
18105 week: addWeeks2,
18106 month: addMonths2,
18107 year: addYears2,
18108 startOfWeek: (date) => broadcastCalendar ? startOfBroadcastWeek2(date, dateLib) : ISOWeek ? startOfISOWeek2(date) : startOfWeek2(date),
18109 endOfWeek: (date) => broadcastCalendar ? endOfBroadcastWeek2(date) : ISOWeek ? endOfISOWeek2(date) : endOfWeek2(date)
18110 };
18111 let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
18112 if (moveDir === "before" && navStart) {
18113 focusableDate = max3([navStart, focusableDate]);
18114 } else if (moveDir === "after" && navEnd) {
18115 focusableDate = min3([navEnd, focusableDate]);
18116 }
18117 return focusableDate;
18118 }
18119
18120 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js
18121 function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) {
18122 if (attempt > 365) {
18123 return void 0;
18124 }
18125 const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib);
18126 const isDisabled = Boolean(props.disabled && dateMatchModifiers(focusableDate, props.disabled, dateLib));
18127 const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib));
18128 const targetMonth = focusableDate;
18129 const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib);
18130 if (!isDisabled && !isHidden) {
18131 return focusDay;
18132 }
18133 return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1);
18134 }
18135
18136 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js
18137 function useFocus2(props, calendar, getModifiers, isSelected, dateLib) {
18138 const { autoFocus } = props;
18139 const [lastFocused, setLastFocused] = (0, import_react35.useState)();
18140 const focusTarget = calculateFocusTarget(calendar.days, getModifiers, isSelected || (() => false), lastFocused);
18141 const [focusedDay, setFocused] = (0, import_react35.useState)(autoFocus ? focusTarget : void 0);
18142 const blur = () => {
18143 setLastFocused(focusedDay);
18144 setFocused(void 0);
18145 };
18146 const moveFocus = (moveBy, moveDir) => {
18147 if (!focusedDay)
18148 return;
18149 const nextFocus = getNextFocus(moveBy, moveDir, focusedDay, calendar.navStart, calendar.navEnd, props, dateLib);
18150 if (!nextFocus)
18151 return;
18152 if (props.disableNavigation) {
18153 const isNextInCalendar = calendar.days.some((day) => day.isEqualTo(nextFocus));
18154 if (!isNextInCalendar) {
18155 return;
18156 }
18157 }
18158 calendar.goToDay(nextFocus);
18159 setFocused(nextFocus);
18160 };
18161 const isFocusTarget = (day) => {
18162 return Boolean(focusTarget?.isEqualTo(day));
18163 };
18164 const useFocus3 = {
18165 isFocusTarget,
18166 setFocused,
18167 focused: focusedDay,
18168 blur,
18169 moveFocus
18170 };
18171 return useFocus3;
18172 }
18173
18174 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useMulti.js
18175 function useMulti(props, dateLib) {
18176 const { selected: initiallySelected, required, onSelect } = props;
18177 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
18178 const selected = !onSelect ? internallySelected : initiallySelected;
18179 const { isSameDay: isSameDay2 } = dateLib;
18180 const isSelected = (date) => {
18181 return selected?.some((d) => isSameDay2(d, date)) ?? false;
18182 };
18183 const { min: min3, max: max3 } = props;
18184 const select2 = (triggerDate, modifiers, e) => {
18185 let newDates = [...selected ?? []];
18186 if (isSelected(triggerDate)) {
18187 if (selected?.length === min3) {
18188 return;
18189 }
18190 if (required && selected?.length === 1) {
18191 return;
18192 }
18193 newDates = selected?.filter((d) => !isSameDay2(d, triggerDate));
18194 } else {
18195 if (selected?.length === max3) {
18196 newDates = [triggerDate];
18197 } else {
18198 newDates = [...newDates, triggerDate];
18199 }
18200 }
18201 if (!onSelect) {
18202 setSelected(newDates);
18203 }
18204 onSelect?.(newDates, triggerDate, modifiers, e);
18205 return newDates;
18206 };
18207 return {
18208 selected,
18209 select: select2,
18210 isSelected
18211 };
18212 }
18213
18214 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/addToRange.js
18215 function addToRange(date, initialRange, min3 = 0, max3 = 0, required = false, dateLib = defaultDateLib) {
18216 const { from, to: to2 } = initialRange || {};
18217 const { isSameDay: isSameDay2, isAfter: isAfter2, isBefore: isBefore2 } = dateLib;
18218 let range;
18219 if (!from && !to2) {
18220 range = { from: date, to: min3 > 0 ? void 0 : date };
18221 } else if (from && !to2) {
18222 if (isSameDay2(from, date)) {
18223 if (min3 === 0) {
18224 range = { from, to: date };
18225 } else if (required) {
18226 range = { from, to: void 0 };
18227 } else {
18228 range = void 0;
18229 }
18230 } else if (isBefore2(date, from)) {
18231 range = { from: date, to: from };
18232 } else {
18233 range = { from, to: date };
18234 }
18235 } else if (from && to2) {
18236 if (isSameDay2(from, date) && isSameDay2(to2, date)) {
18237 if (required) {
18238 range = { from, to: to2 };
18239 } else {
18240 range = void 0;
18241 }
18242 } else if (isSameDay2(from, date)) {
18243 range = { from, to: min3 > 0 ? void 0 : date };
18244 } else if (isSameDay2(to2, date)) {
18245 range = { from: date, to: min3 > 0 ? void 0 : date };
18246 } else if (isBefore2(date, from)) {
18247 range = { from: date, to: to2 };
18248 } else if (isAfter2(date, from)) {
18249 range = { from, to: date };
18250 } else if (isAfter2(date, to2)) {
18251 range = { from, to: date };
18252 } else {
18253 throw new Error("Invalid range");
18254 }
18255 }
18256 if (range?.from && range?.to) {
18257 const diff = dateLib.differenceInCalendarDays(range.to, range.from);
18258 if (max3 > 0 && diff > max3) {
18259 range = { from: date, to: void 0 };
18260 } else if (min3 > 1 && diff < min3) {
18261 range = { from: date, to: void 0 };
18262 }
18263 }
18264 return range;
18265 }
18266
18267 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js
18268 function rangeContainsDayOfWeek(range, dayOfWeek, dateLib = defaultDateLib) {
18269 const dayOfWeekArr = !Array.isArray(dayOfWeek) ? [dayOfWeek] : dayOfWeek;
18270 let date = range.from;
18271 const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);
18272 const totalDaysLimit = Math.min(totalDays, 6);
18273 for (let i = 0; i <= totalDaysLimit; i++) {
18274 if (dayOfWeekArr.includes(date.getDay())) {
18275 return true;
18276 }
18277 date = dateLib.addDays(date, 1);
18278 }
18279 return false;
18280 }
18281
18282 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js
18283 function rangeOverlaps(rangeLeft, rangeRight, dateLib = defaultDateLib) {
18284 return rangeIncludesDate(rangeLeft, rangeRight.from, false, dateLib) || rangeIncludesDate(rangeLeft, rangeRight.to, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.from, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.to, false, dateLib);
18285 }
18286
18287 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js
18288 function rangeContainsModifiers(range, modifiers, dateLib = defaultDateLib) {
18289 const matchers = Array.isArray(modifiers) ? modifiers : [modifiers];
18290 const nonFunctionMatchers = matchers.filter((matcher) => typeof matcher !== "function");
18291 const nonFunctionMatchersResult = nonFunctionMatchers.some((matcher) => {
18292 if (typeof matcher === "boolean")
18293 return matcher;
18294 if (dateLib.isDate(matcher)) {
18295 return rangeIncludesDate(range, matcher, false, dateLib);
18296 }
18297 if (isDatesArray(matcher, dateLib)) {
18298 return matcher.some((date) => rangeIncludesDate(range, date, false, dateLib));
18299 }
18300 if (isDateRange(matcher)) {
18301 if (matcher.from && matcher.to) {
18302 return rangeOverlaps(range, { from: matcher.from, to: matcher.to }, dateLib);
18303 }
18304 return false;
18305 }
18306 if (isDayOfWeekType(matcher)) {
18307 return rangeContainsDayOfWeek(range, matcher.dayOfWeek, dateLib);
18308 }
18309 if (isDateInterval(matcher)) {
18310 const isClosedInterval = dateLib.isAfter(matcher.before, matcher.after);
18311 if (isClosedInterval) {
18312 return rangeOverlaps(range, {
18313 from: dateLib.addDays(matcher.after, 1),
18314 to: dateLib.addDays(matcher.before, -1)
18315 }, dateLib);
18316 }
18317 return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib);
18318 }
18319 if (isDateAfterType(matcher) || isDateBeforeType(matcher)) {
18320 return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib);
18321 }
18322 return false;
18323 });
18324 if (nonFunctionMatchersResult) {
18325 return true;
18326 }
18327 const functionMatchers = matchers.filter((matcher) => typeof matcher === "function");
18328 if (functionMatchers.length) {
18329 let date = range.from;
18330 const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);
18331 for (let i = 0; i <= totalDays; i++) {
18332 if (functionMatchers.some((matcher) => matcher(date))) {
18333 return true;
18334 }
18335 date = dateLib.addDays(date, 1);
18336 }
18337 }
18338 return false;
18339 }
18340
18341 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useRange.js
18342 function useRange(props, dateLib) {
18343 const { disabled: disabled2, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect } = props;
18344 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
18345 const selected = !onSelect ? internallySelected : initiallySelected;
18346 const isSelected = (date) => selected && rangeIncludesDate(selected, date, false, dateLib);
18347 const select2 = (triggerDate, modifiers, e) => {
18348 const { min: min3, max: max3 } = props;
18349 let newRange;
18350 if (triggerDate) {
18351 const selectedFrom = selected?.from;
18352 const selectedTo = selected?.to;
18353 const hasFullRange = !!selectedFrom && !!selectedTo;
18354 const isClickingSingleDayRange = !!selectedFrom && !!selectedTo && dateLib.isSameDay(selectedFrom, selectedTo) && dateLib.isSameDay(triggerDate, selectedFrom);
18355 if (resetOnSelect && (hasFullRange || !selected?.from)) {
18356 if (!required && isClickingSingleDayRange) {
18357 newRange = void 0;
18358 } else {
18359 newRange = { from: triggerDate, to: void 0 };
18360 }
18361 } else {
18362 newRange = addToRange(triggerDate, selected, min3, max3, required, dateLib);
18363 }
18364 }
18365 if (excludeDisabled && disabled2 && newRange?.from && newRange.to) {
18366 if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled2, dateLib)) {
18367 newRange.from = triggerDate;
18368 newRange.to = void 0;
18369 }
18370 }
18371 if (!onSelect) {
18372 setSelected(newRange);
18373 }
18374 onSelect?.(newRange, triggerDate, modifiers, e);
18375 return newRange;
18376 };
18377 return {
18378 selected,
18379 select: select2,
18380 isSelected
18381 };
18382 }
18383
18384 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useSingle.js
18385 function useSingle(props, dateLib) {
18386 const { selected: initiallySelected, required, onSelect } = props;
18387 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
18388 const selected = !onSelect ? internallySelected : initiallySelected;
18389 const { isSameDay: isSameDay2 } = dateLib;
18390 const isSelected = (compareDate) => {
18391 return selected ? isSameDay2(selected, compareDate) : false;
18392 };
18393 const select2 = (triggerDate, modifiers, e) => {
18394 let newDate = triggerDate;
18395 if (!required && selected && selected && isSameDay2(triggerDate, selected)) {
18396 newDate = void 0;
18397 }
18398 if (!onSelect) {
18399 setSelected(newDate);
18400 }
18401 if (required) {
18402 onSelect?.(newDate, triggerDate, modifiers, e);
18403 } else {
18404 onSelect?.(newDate, triggerDate, modifiers, e);
18405 }
18406 return newDate;
18407 };
18408 return {
18409 selected,
18410 select: select2,
18411 isSelected
18412 };
18413 }
18414
18415 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useSelection.js
18416 function useSelection(props, dateLib) {
18417 const single = useSingle(props, dateLib);
18418 const multi = useMulti(props, dateLib);
18419 const range = useRange(props, dateLib);
18420 switch (props.mode) {
18421 case "single":
18422 return single;
18423 case "multiple":
18424 return multi;
18425 case "range":
18426 return range;
18427 default:
18428 return void 0;
18429 }
18430 }
18431
18432 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js
18433 function toTimeZone(date, timeZone) {
18434 if (date instanceof TZDate && date.timeZone === timeZone) {
18435 return date;
18436 }
18437 return new TZDate(date, timeZone);
18438 }
18439
18440 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js
18441 function toZoneNoon(date, timeZone, noonSafe) {
18442 if (!noonSafe)
18443 return toTimeZone(date, timeZone);
18444 const zoned = toTimeZone(date, timeZone);
18445 const noonZoned = new TZDate(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 12, 0, 0, timeZone);
18446 return new Date(noonZoned.getTime());
18447 }
18448 function convertMatcher(matcher, timeZone, noonSafe) {
18449 if (typeof matcher === "boolean" || typeof matcher === "function") {
18450 return matcher;
18451 }
18452 if (matcher instanceof Date) {
18453 return toZoneNoon(matcher, timeZone, noonSafe);
18454 }
18455 if (Array.isArray(matcher)) {
18456 return matcher.map((value) => value instanceof Date ? toZoneNoon(value, timeZone, noonSafe) : value);
18457 }
18458 if (isDateRange(matcher)) {
18459 return {
18460 ...matcher,
18461 from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from,
18462 to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to
18463 };
18464 }
18465 if (isDateInterval(matcher)) {
18466 return {
18467 before: toZoneNoon(matcher.before, timeZone, noonSafe),
18468 after: toZoneNoon(matcher.after, timeZone, noonSafe)
18469 };
18470 }
18471 if (isDateAfterType(matcher)) {
18472 return {
18473 after: toZoneNoon(matcher.after, timeZone, noonSafe)
18474 };
18475 }
18476 if (isDateBeforeType(matcher)) {
18477 return {
18478 before: toZoneNoon(matcher.before, timeZone, noonSafe)
18479 };
18480 }
18481 return matcher;
18482 }
18483 function convertMatchersToTimeZone(matchers, timeZone, noonSafe) {
18484 if (!matchers) {
18485 return matchers;
18486 }
18487 if (Array.isArray(matchers)) {
18488 return matchers.map((matcher) => convertMatcher(matcher, timeZone, noonSafe));
18489 }
18490 return convertMatcher(matchers, timeZone, noonSafe);
18491 }
18492
18493 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js
18494 function DayPicker(initialProps) {
18495 let props = initialProps;
18496 const timeZone = props.timeZone;
18497 if (timeZone) {
18498 props = {
18499 ...initialProps,
18500 timeZone
18501 };
18502 if (props.today) {
18503 props.today = toTimeZone(props.today, timeZone);
18504 }
18505 if (props.month) {
18506 props.month = toTimeZone(props.month, timeZone);
18507 }
18508 if (props.defaultMonth) {
18509 props.defaultMonth = toTimeZone(props.defaultMonth, timeZone);
18510 }
18511 if (props.startMonth) {
18512 props.startMonth = toTimeZone(props.startMonth, timeZone);
18513 }
18514 if (props.endMonth) {
18515 props.endMonth = toTimeZone(props.endMonth, timeZone);
18516 }
18517 if (props.mode === "single" && props.selected) {
18518 props.selected = toTimeZone(props.selected, timeZone);
18519 } else if (props.mode === "multiple" && props.selected) {
18520 props.selected = props.selected?.map((date) => toTimeZone(date, timeZone));
18521 } else if (props.mode === "range" && props.selected) {
18522 props.selected = {
18523 from: props.selected.from ? toTimeZone(props.selected.from, timeZone) : props.selected.from,
18524 to: props.selected.to ? toTimeZone(props.selected.to, timeZone) : props.selected.to
18525 };
18526 }
18527 if (props.disabled !== void 0) {
18528 props.disabled = convertMatchersToTimeZone(props.disabled, timeZone);
18529 }
18530 if (props.hidden !== void 0) {
18531 props.hidden = convertMatchersToTimeZone(props.hidden, timeZone);
18532 }
18533 if (props.modifiers) {
18534 const nextModifiers = {};
18535 Object.keys(props.modifiers).forEach((key) => {
18536 nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone);
18537 });
18538 props.modifiers = nextModifiers;
18539 }
18540 }
18541 const { components, formatters: formatters2, labels, dateLib, locale, classNames } = (0, import_react36.useMemo)(() => {
18542 const locale2 = { ...enUS2, ...props.locale };
18543 const weekStartsOn = props.broadcastCalendar ? 1 : props.weekStartsOn;
18544 const noonOverrides = props.noonSafe && props.timeZone ? createNoonOverrides(props.timeZone, {
18545 weekStartsOn,
18546 locale: locale2
18547 }) : void 0;
18548 const overrides = props.dateLib && noonOverrides ? { ...noonOverrides, ...props.dateLib } : props.dateLib ?? noonOverrides;
18549 const dateLib2 = new DateLib({
18550 locale: locale2,
18551 weekStartsOn,
18552 firstWeekContainsDate: props.firstWeekContainsDate,
18553 useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
18554 useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,
18555 timeZone: props.timeZone,
18556 numerals: props.numerals
18557 }, overrides);
18558 return {
18559 dateLib: dateLib2,
18560 components: getComponents(props.components),
18561 formatters: getFormatters(props.formatters),
18562 labels: getLabels(props.labels, dateLib2.options),
18563 locale: locale2,
18564 classNames: { ...getDefaultClassNames(), ...props.classNames }
18565 };
18566 }, [
18567 props.locale,
18568 props.broadcastCalendar,
18569 props.weekStartsOn,
18570 props.firstWeekContainsDate,
18571 props.useAdditionalWeekYearTokens,
18572 props.useAdditionalDayOfYearTokens,
18573 props.timeZone,
18574 props.numerals,
18575 props.dateLib,
18576 props.noonSafe,
18577 props.components,
18578 props.formatters,
18579 props.labels,
18580 props.classNames
18581 ]);
18582 if (!props.today) {
18583 props = { ...props, today: dateLib.today() };
18584 }
18585 const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles } = props;
18586 const { formatCaption: formatCaption2, formatDay: formatDay2, formatMonthDropdown: formatMonthDropdown2, formatWeekNumber: formatWeekNumber2, formatWeekNumberHeader: formatWeekNumberHeader2, formatWeekdayName: formatWeekdayName2, formatYearDropdown: formatYearDropdown2 } = formatters2;
18587 const calendar = useCalendar(props, dateLib);
18588 const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth } = calendar;
18589 const getModifiers = createGetModifiers(days, props, navStart, navEnd, dateLib);
18590 const { isSelected, select: select2, selected: selectedValue } = useSelection(props, dateLib) ?? {};
18591 const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus2(props, calendar, getModifiers, isSelected ?? (() => false), dateLib);
18592 const { labelDayButton: labelDayButton2, labelGridcell: labelGridcell2, labelGrid: labelGrid2, labelMonthDropdown: labelMonthDropdown2, labelNav: labelNav2, labelPrevious: labelPrevious2, labelNext: labelNext2, labelWeekday: labelWeekday2, labelWeekNumber: labelWeekNumber2, labelWeekNumberHeader: labelWeekNumberHeader2, labelYearDropdown: labelYearDropdown2 } = labels;
18593 const weekdays = (0, import_react36.useMemo)(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [dateLib, props.ISOWeek, props.broadcastCalendar, props.today]);
18594 const isInteractive = mode !== void 0 || onDayClick !== void 0;
18595 const handlePreviousClick = (0, import_react36.useCallback)(() => {
18596 if (!previousMonth)
18597 return;
18598 goToMonth(previousMonth);
18599 onPrevClick?.(previousMonth);
18600 }, [previousMonth, goToMonth, onPrevClick]);
18601 const handleNextClick = (0, import_react36.useCallback)(() => {
18602 if (!nextMonth)
18603 return;
18604 goToMonth(nextMonth);
18605 onNextClick?.(nextMonth);
18606 }, [goToMonth, nextMonth, onNextClick]);
18607 const handleDayClick = (0, import_react36.useCallback)((day, m2) => (e) => {
18608 e.preventDefault();
18609 e.stopPropagation();
18610 setFocused(day);
18611 if (m2.disabled) {
18612 return;
18613 }
18614 select2?.(day.date, m2, e);
18615 onDayClick?.(day.date, m2, e);
18616 }, [select2, onDayClick, setFocused]);
18617 const handleDayFocus = (0, import_react36.useCallback)((day, m2) => (e) => {
18618 setFocused(day);
18619 onDayFocus?.(day.date, m2, e);
18620 }, [onDayFocus, setFocused]);
18621 const handleDayBlur = (0, import_react36.useCallback)((day, m2) => (e) => {
18622 blur();
18623 onDayBlur?.(day.date, m2, e);
18624 }, [blur, onDayBlur]);
18625 const handleDayKeyDown = (0, import_react36.useCallback)((day, modifiers) => (e) => {
18626 const keyMap = {
18627 ArrowLeft: [
18628 e.shiftKey ? "month" : "day",
18629 props.dir === "rtl" ? "after" : "before"
18630 ],
18631 ArrowRight: [
18632 e.shiftKey ? "month" : "day",
18633 props.dir === "rtl" ? "before" : "after"
18634 ],
18635 ArrowDown: [e.shiftKey ? "year" : "week", "after"],
18636 ArrowUp: [e.shiftKey ? "year" : "week", "before"],
18637 PageUp: [e.shiftKey ? "year" : "month", "before"],
18638 PageDown: [e.shiftKey ? "year" : "month", "after"],
18639 Home: ["startOfWeek", "before"],
18640 End: ["endOfWeek", "after"]
18641 };
18642 if (keyMap[e.key]) {
18643 e.preventDefault();
18644 e.stopPropagation();
18645 const [moveBy, moveDir] = keyMap[e.key];
18646 moveFocus(moveBy, moveDir);
18647 }
18648 onDayKeyDown?.(day.date, modifiers, e);
18649 }, [moveFocus, onDayKeyDown, props.dir]);
18650 const handleDayMouseEnter = (0, import_react36.useCallback)((day, modifiers) => (e) => {
18651 onDayMouseEnter?.(day.date, modifiers, e);
18652 }, [onDayMouseEnter]);
18653 const handleDayMouseLeave = (0, import_react36.useCallback)((day, modifiers) => (e) => {
18654 onDayMouseLeave?.(day.date, modifiers, e);
18655 }, [onDayMouseLeave]);
18656 const handleMonthChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => {
18657 const selectedMonth = Number(e.target.value);
18658 const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
18659 goToMonth(dateLib.addMonths(month, -monthOffset));
18660 }, [dateLib, goToMonth]);
18661 const handleYearChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => {
18662 const selectedYear = Number(e.target.value);
18663 const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
18664 goToMonth(dateLib.addMonths(month, -monthOffset));
18665 }, [dateLib, goToMonth]);
18666 const { className, style } = (0, import_react36.useMemo)(() => ({
18667 className: [classNames[UI.Root], props.className].filter(Boolean).join(" "),
18668 style: { ...styles?.[UI.Root], ...props.style }
18669 }), [classNames, props.className, props.style, styles]);
18670 const dataAttributes = getDataAttributes(props);
18671 const getDropdownStyle = (dropdown) => {
18672 const dropdownStyle = styles?.[UI.Dropdown];
18673 const specificDropdownStyle = styles?.[dropdown];
18674 if (!dropdownStyle && !specificDropdownStyle) {
18675 return void 0;
18676 }
18677 return {
18678 ...dropdownStyle,
18679 ...specificDropdownStyle
18680 };
18681 };
18682 const rootElRef = (0, import_react36.useRef)(null);
18683 useAnimation(rootElRef, Boolean(props.animate), {
18684 classNames,
18685 months,
18686 focused,
18687 dateLib
18688 });
18689 const contextValue = {
18690 dayPickerProps: props,
18691 selected: selectedValue,
18692 select: select2,
18693 isSelected,
18694 months,
18695 nextMonth,
18696 previousMonth,
18697 goToMonth,
18698 getModifiers,
18699 components,
18700 classNames,
18701 styles,
18702 labels,
18703 formatters: formatters2
18704 };
18705 return import_react36.default.createElement(
18706 dayPickerContext.Provider,
18707 { value: contextValue },
18708 import_react36.default.createElement(
18709 components.Root,
18710 { rootRef: props.animate ? rootElRef : void 0, className, style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes },
18711 import_react36.default.createElement(
18712 components.Months,
18713 { className: classNames[UI.Months], style: styles?.[UI.Months] },
18714 !props.hideNavigation && !navLayout && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
18715 months.map((calendarMonth, displayIndex) => {
18716 const monthOffset = props.reverseMonths ? months.length - 1 - displayIndex : displayIndex;
18717 return import_react36.default.createElement(
18718 components.Month,
18719 {
18720 "data-animated-month": props.animate ? "true" : void 0,
18721 className: classNames[UI.Month],
18722 style: styles?.[UI.Month],
18723 // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
18724 key: displayIndex,
18725 displayIndex,
18726 calendarMonth
18727 },
18728 navLayout === "around" && !props.hideNavigation && displayIndex === 0 && import_react36.default.createElement(
18729 components.PreviousMonthButton,
18730 { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
18731 import_react36.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
18732 ),
18733 import_react36.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth, displayIndex }, captionLayout?.startsWith("dropdown") ? import_react36.default.createElement(
18734 components.DropdownNav,
18735 { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] },
18736 (() => {
18737 const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react36.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
18738 const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react36.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
18739 const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
18740 return controls;
18741 })(),
18742 import_react36.default.createElement("span", { role: "status", "aria-live": "polite", style: {
18743 border: 0,
18744 clip: "rect(0 0 0 0)",
18745 height: "1px",
18746 margin: "-1px",
18747 overflow: "hidden",
18748 padding: 0,
18749 position: "absolute",
18750 width: "1px",
18751 whiteSpace: "nowrap",
18752 wordWrap: "normal"
18753 } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
18754 ) : import_react36.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
18755 navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && import_react36.default.createElement(
18756 components.NextMonthButton,
18757 { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
18758 import_react36.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
18759 ),
18760 displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
18761 import_react36.default.createElement(
18762 components.MonthGrid,
18763 { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
18764 !props.hideWeekdays && import_react36.default.createElement(
18765 components.Weekdays,
18766 { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
18767 showWeekNumber && import_react36.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
18768 weekdays.map((weekday) => import_react36.default.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib)))
18769 ),
18770 import_react36.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
18771 return import_react36.default.createElement(
18772 components.Week,
18773 { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
18774 showWeekNumber && import_react36.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
18775 locale
18776 }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
18777 week.days.map((day) => {
18778 const { date } = day;
18779 const modifiers = getModifiers(day);
18780 modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
18781 modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
18782 if (isDateRange(selectedValue)) {
18783 const { from, to: to2 } = selectedValue;
18784 modifiers[SelectionState.range_start] = Boolean(from && to2 && dateLib.isSameDay(date, from));
18785 modifiers[SelectionState.range_end] = Boolean(from && to2 && dateLib.isSameDay(date, to2));
18786 modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
18787 }
18788 const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
18789 const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
18790 const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
18791 return import_react36.default.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? import_react36.default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib));
18792 })
18793 );
18794 }))
18795 )
18796 );
18797 })
18798 ),
18799 props.footer && import_react36.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
18800 )
18801 );
18802 }
18803
18804 // packages/ui/build-module/calendar/calendar.mjs
18805 var import_element29 = __toESM(require_element(), 1);
18806
18807 // packages/ui/build-module/calendar/utils/components.mjs
18808 var import_element25 = __toESM(require_element(), 1);
18809 var import_compose = __toESM(require_compose(), 1);
18810 var import_i18n5 = __toESM(require_i18n(), 1);
18811
18812 // packages/ui/build-module/icon-button/icon-button.mjs
18813 var import_element23 = __toESM(require_element(), 1);
18814 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
18815 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash";
18816 function getRuntime10() {
18817 const globalScope = globalThis;
18818 if (globalScope.__wpStyleRuntime) {
18819 return globalScope.__wpStyleRuntime;
18820 }
18821 globalScope.__wpStyleRuntime = {
18822 documents: /* @__PURE__ */ new Map(),
18823 styles: /* @__PURE__ */ new Map(),
18824 injectedStyles: /* @__PURE__ */ new WeakMap()
18825 };
18826 if (typeof document !== "undefined") {
18827 registerDocument10(document);
18828 }
18829 return globalScope.__wpStyleRuntime;
18830 }
18831 function documentContainsStyleHash10(targetDocument, hash) {
18832 if (!targetDocument.head) {
18833 return false;
18834 }
18835 for (const style of targetDocument.head.querySelectorAll(
18836 `style[${STYLE_HASH_ATTRIBUTE10}]`
18837 )) {
18838 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) {
18839 return true;
18840 }
18841 }
18842 return false;
18843 }
18844 function injectStyle10(targetDocument, hash, css) {
18845 if (!targetDocument.head) {
18846 return;
18847 }
18848 const runtime = getRuntime10();
18849 let injectedStyles = runtime.injectedStyles.get(targetDocument);
18850 if (!injectedStyles) {
18851 injectedStyles = /* @__PURE__ */ new Set();
18852 runtime.injectedStyles.set(targetDocument, injectedStyles);
18853 }
18854 if (injectedStyles.has(hash)) {
18855 return;
18856 }
18857 if (documentContainsStyleHash10(targetDocument, hash)) {
18858 injectedStyles.add(hash);
18859 return;
18860 }
18861 const style = targetDocument.createElement("style");
18862 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash);
18863 style.appendChild(targetDocument.createTextNode(css));
18864 targetDocument.head.appendChild(style);
18865 injectedStyles.add(hash);
18866 }
18867 function registerDocument10(targetDocument) {
18868 const runtime = getRuntime10();
18869 runtime.documents.set(
18870 targetDocument,
18871 (runtime.documents.get(targetDocument) ?? 0) + 1
18872 );
18873 for (const [hash, css] of runtime.styles) {
18874 injectStyle10(targetDocument, hash, css);
18875 }
18876 return () => {
18877 const count = runtime.documents.get(targetDocument);
18878 if (count === void 0) {
18879 return;
18880 }
18881 if (count <= 1) {
18882 runtime.documents.delete(targetDocument);
18883 return;
18884 }
18885 runtime.documents.set(targetDocument, count - 1);
18886 };
18887 }
18888 function registerStyle10(hash, css) {
18889 const runtime = getRuntime10();
18890 runtime.styles.set(hash, css);
18891 for (const targetDocument of runtime.documents.keys()) {
18892 injectStyle10(targetDocument, hash, css);
18893 }
18894 }
18895 if (typeof process === "undefined" || true) {
18896 registerStyle10("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}");
18897 }
18898 var style_default9 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" };
18899 var IconButton = (0, import_element23.forwardRef)(
18900 function IconButton2({
18901 label,
18902 className,
18903 // Prevent accidental forwarding of `children`
18904 children: _children,
18905 disabled: disabled2,
18906 focusableWhenDisabled = true,
18907 icon,
18908 size: size4,
18909 shortcut,
18910 positioner,
18911 "aria-describedby": ariaDescribedBy,
18912 "aria-keyshortcuts": ariaKeyShortcuts,
18913 ...restProps
18914 }, ref) {
18915 const classes = clsx_default(style_default9["icon-button"], className);
18916 const { descriptionId, targetProps } = useKeyboardShortcutProps({
18917 "aria-describedby": ariaDescribedBy,
18918 "aria-keyshortcuts": ariaKeyShortcuts,
18919 shortcut
18920 });
18921 return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Root, { children: [
18922 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
18923 Trigger,
18924 {
18925 ref,
18926 ...targetProps,
18927 disabled: disabled2 && !focusableWhenDisabled,
18928 render: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18929 Button4,
18930 {
18931 ...restProps,
18932 size: size4,
18933 "aria-label": label,
18934 disabled: disabled2,
18935 focusableWhenDisabled
18936 }
18937 ),
18938 className: classes,
18939 children: [
18940 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { icon, size: 24, className: style_default9.icon }),
18941 shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18942 KeyboardShortcutDescription,
18943 {
18944 descriptionId,
18945 shortcut
18946 }
18947 )
18948 ]
18949 }
18950 ),
18951 /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Popup, { positioner, children: [
18952 label,
18953 shortcut && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
18954 " ",
18955 /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KeyboardShortcutDisplay, { shortcut })
18956 ] })
18957 ] })
18958 ] });
18959 }
18960 );
18961
18962 // packages/ui/build-module/calendar/utils/root-context.mjs
18963 var import_element24 = __toESM(require_element(), 1);
18964 var RootContext = (0, import_element24.createContext)({});
18965
18966 // packages/ui/build-module/calendar/utils/components.mjs
18967 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
18968 var PreviewDashStartAndEnd = () => {
18969 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
18970 "svg",
18971 {
18972 viewBox: "0 0 32 32",
18973 xmlns: "http://www.w3.org/2000/svg",
18974 fill: "none",
18975 stroke: "currentColor",
18976 strokeDasharray: "3.7677",
18977 strokeDashoffset: "3.2",
18978 strokeWidth: "1",
18979 children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M29.5,0.5 h-27 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h27 a2,2 0 0 0 2,-2 v-27 a2,2 0 0 0 -2,-2" })
18980 }
18981 );
18982 };
18983 var PreviewDashStart = () => {
18984 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
18985 "svg",
18986 {
18987 viewBox: "0 0 32 32",
18988 xmlns: "http://www.w3.org/2000/svg",
18989 fill: "none",
18990 stroke: "currentColor",
18991 strokeDasharray: "3.84516",
18992 strokeDashoffset: "1.9226",
18993 strokeWidth: "1",
18994 children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M32,0.5 h-29.5 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h30" })
18995 }
18996 );
18997 };
18998 var PreviewDashMiddle = () => {
18999 return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
19000 "svg",
19001 {
19002 viewBox: "0 0 32 32",
19003 xmlns: "http://www.w3.org/2000/svg",
19004 fill: "none",
19005 stroke: "currentColor",
19006 strokeDasharray: "3.9 4",
19007 strokeDashoffset: "2",
19008 strokeWidth: "1",
19009 children: [
19010 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("line", { x1: "0", y1: "0.5", x2: "100", y2: "0.5" }),
19011 /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("line", { x1: "0", y1: "31.5", x2: "100", y2: "31.5" })
19012 ]
19013 }
19014 );
19015 };
19016 var PreviewDashEnd = () => {
19017 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
19018 "svg",
19019 {
19020 viewBox: "0 0 32 32",
19021 xmlns: "http://www.w3.org/2000/svg",
19022 fill: "none",
19023 stroke: "currentColor",
19024 strokeDasharray: "3.84516",
19025 strokeDashoffset: "1.9226",
19026 strokeWidth: "1",
19027 children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: "M0,0.5 h29.5 a2,2 0 0 1 2,2 v27 a2,2 0 0 1 -2,2 h-29.5" })
19028 }
19029 );
19030 };
19031 function Day2(props) {
19032 const { day, modifiers, children, ...tdProps } = props;
19033 let PreviewDash;
19034 if (modifiers.preview_start && modifiers.preview_end) {
19035 PreviewDash = PreviewDashStartAndEnd;
19036 } else if (modifiers.preview_start) {
19037 PreviewDash = PreviewDashStart;
19038 } else if (modifiers.preview_end) {
19039 PreviewDash = PreviewDashEnd;
19040 } else if (modifiers.preview) {
19041 PreviewDash = PreviewDashMiddle;
19042 }
19043 return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("td", { ...tdProps, children: [
19044 PreviewDash && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PreviewDash, {}),
19045 children
19046 ] });
19047 }
19048 function Root3({ rootRef, ...props }) {
19049 const { render: render4, ref, role, defaultAriaLabel } = (0, import_element25.useContext)(RootContext);
19050 const { months, labels } = useDayPicker();
19051 const hasExplicitLabel = props["aria-label"] !== void 0 || props["aria-labelledby"] !== void 0;
19052 let ariaLabel = props["aria-label"];
19053 if (!hasExplicitLabel && defaultAriaLabel && role === "application") {
19054 const currentMonth = months[0];
19055 ariaLabel = currentMonth ? (0, import_i18n5.sprintf)(
19056 // translators: 1: Calendar type. 2: Current month and year.
19057 (0, import_i18n5.__)("%1$s, %2$s"),
19058 defaultAriaLabel,
19059 labels.labelGrid(currentMonth.date)
19060 ) : defaultAriaLabel;
19061 }
19062 const mergedRef = (0, import_compose.useMergeRefs)([rootRef ?? null, ref ?? null]);
19063 return useRender({
19064 render: render4,
19065 defaultTagName: "div",
19066 ref: mergedRef,
19067 props: { ...props, role, "aria-label": ariaLabel }
19068 });
19069 }
19070 function NavButton({
19071 icon,
19072 className,
19073 children: _children,
19074 "aria-label": label,
19075 "aria-disabled": ariaDisabled,
19076 ...props
19077 }) {
19078 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
19079 IconButton,
19080 {
19081 ...props,
19082 className,
19083 label,
19084 icon,
19085 variant: "minimal",
19086 tone: "neutral",
19087 size: "compact",
19088 disabled: ariaDisabled === true || ariaDisabled === "true",
19089 focusableWhenDisabled: true
19090 }
19091 );
19092 }
19093 function PreviousMonthButton2(props) {
19094 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(NavButton, { ...props, icon: chevron_left_default });
19095 }
19096 function NextMonthButton2(props) {
19097 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(NavButton, { ...props, icon: chevron_right_default });
19098 }
19099
19100 // packages/ui/build-module/calendar/utils/constants.mjs
19101 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash";
19102 function getRuntime11() {
19103 const globalScope = globalThis;
19104 if (globalScope.__wpStyleRuntime) {
19105 return globalScope.__wpStyleRuntime;
19106 }
19107 globalScope.__wpStyleRuntime = {
19108 documents: /* @__PURE__ */ new Map(),
19109 styles: /* @__PURE__ */ new Map(),
19110 injectedStyles: /* @__PURE__ */ new WeakMap()
19111 };
19112 if (typeof document !== "undefined") {
19113 registerDocument11(document);
19114 }
19115 return globalScope.__wpStyleRuntime;
19116 }
19117 function documentContainsStyleHash11(targetDocument, hash) {
19118 if (!targetDocument.head) {
19119 return false;
19120 }
19121 for (const style of targetDocument.head.querySelectorAll(
19122 `style[${STYLE_HASH_ATTRIBUTE11}]`
19123 )) {
19124 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) {
19125 return true;
19126 }
19127 }
19128 return false;
19129 }
19130 function injectStyle11(targetDocument, hash, css) {
19131 if (!targetDocument.head) {
19132 return;
19133 }
19134 const runtime = getRuntime11();
19135 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19136 if (!injectedStyles) {
19137 injectedStyles = /* @__PURE__ */ new Set();
19138 runtime.injectedStyles.set(targetDocument, injectedStyles);
19139 }
19140 if (injectedStyles.has(hash)) {
19141 return;
19142 }
19143 if (documentContainsStyleHash11(targetDocument, hash)) {
19144 injectedStyles.add(hash);
19145 return;
19146 }
19147 const style = targetDocument.createElement("style");
19148 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash);
19149 style.appendChild(targetDocument.createTextNode(css));
19150 targetDocument.head.appendChild(style);
19151 injectedStyles.add(hash);
19152 }
19153 function registerDocument11(targetDocument) {
19154 const runtime = getRuntime11();
19155 runtime.documents.set(
19156 targetDocument,
19157 (runtime.documents.get(targetDocument) ?? 0) + 1
19158 );
19159 for (const [hash, css] of runtime.styles) {
19160 injectStyle11(targetDocument, hash, css);
19161 }
19162 return () => {
19163 const count = runtime.documents.get(targetDocument);
19164 if (count === void 0) {
19165 return;
19166 }
19167 if (count <= 1) {
19168 runtime.documents.delete(targetDocument);
19169 return;
19170 }
19171 runtime.documents.set(targetDocument, count - 1);
19172 };
19173 }
19174 function registerStyle11(hash, css) {
19175 const runtime = getRuntime11();
19176 runtime.styles.set(hash, css);
19177 for (const targetDocument of runtime.documents.keys()) {
19178 injectStyle11(targetDocument, hash, css);
19179 }
19180 }
19181 if (typeof process === "undefined" || true) {
19182 registerStyle11("9d2212290a", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2c7ac60ba97b3411__root{--wp-ui-calendar-cell-size:var(--wpds-dimension-size-md,32px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-block;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-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);position:relative;z-index:0}._172c492625235710__day{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);padding:0;position:relative;&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&:has(._1b64226e315835f8__day-button:focus-visible),&:has(._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}}._1b64226e315835f8__day-button{align-items:center;background:none;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:inherit;cursor:var(--wpds-cursor-control,pointer);display:flex;font:inherit;font-variant-numeric:tabular-nums;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin:0;padding:0;position:relative;width:var(--wp-ui-calendar-cell-size);&:before{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border:none;border-radius:var(--wpds-border-radius-sm,2px);z-index:-1}&:after,&:before{content:"";inset:0;position:absolute}&:after{pointer-events:none;z-index:1}&:disabled{cursor:revert;&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}@media (forced-colors:active){text-decoration:line-through}}&:focus-visible:before,&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed)}}._66b9a8120581fd4b__caption-label{align-items:center;border:0;display:inline-flex;position:relative;text-transform:capitalize;white-space:nowrap;z-index:1}._2c7ac60ba97b3411__root[dir=rtl] ._395a75bb1930f57e__nav-button{transform:rotate(180deg);transform-origin:50%}._337e5337d49b7f3d__month-caption{align-content:center;display:flex;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin-bottom:var(--wpds-dimension-gap-md,12px)}._110e46230c68e498__months{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-lg,16px);justify-content:center;max-width:fit-content;position:relative}._92915239fedb1fea__month-grid{border-collapse:separate;border-spacing:0 var(--wpds-dimension-gap-xs,4px)}._66b1d4a7b488b496__nav{align-items:center;display:flex;height:var(--wp-ui-calendar-cell-size);inset-block-start:0;inset-inline-end:0;inset-inline-start:0;justify-content:space-between;position:absolute}._7207199709ca5776__weekday{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-weight:var(--wpds-typography-font-weight-default,400);height:var(--wp-ui-calendar-cell-size);padding:0;text-align:center;text-transform:uppercase;width:var(--wp-ui-calendar-cell-size)}._058175f0f9c495e0__today:after{border:2px solid;border-radius:50%;content:"";height:0;inset-block-start:2px;inset-inline-end:2px;position:absolute;width:0;z-index:1}.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle){&:has(._1b64226e315835f8__day-button,._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0)}&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);border:1px solid transparent}&:disabled:before{background-color:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6)}&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e)}}}.c259c5c255fda10f__outside{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}._4d8957a0ca4ec8f0__hidden{visibility:hidden}.f2523033db055ffe__range-start:not(.c04a453de7b11520__range-end) ._1b64226e315835f8__day-button{&,&:before{border-end-end-radius:0;border-start-end-radius:0}}._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-color:transparent;border-radius:0;border-style:solid;border-width:1px 0}}.c04a453de7b11520__range-end:not(.f2523033db055ffe__range-start) ._1b64226e315835f8__day-button{&,&:before{border-end-start-radius:0;border-start-start-radius:0}}._81b244e7c541d95e__preview svg{color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);inset:0;pointer-events:none;position:absolute;@media (forced-colors:active){color:inherit}}._81b244e7c541d95e__preview.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle) svg{display:none}._2c7ac60ba97b3411__root[dir=rtl] ._81b244e7c541d95e__preview svg{transform:scaleX(-1)}._81b244e7c541d95e__preview._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button:before{border:none}@keyframes _255a1a462a5377db__slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes c21e45f616d6db39__slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes aed80001de9ae226__slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes _7d4779a7f29408f2__slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes _83ba6321b055d687__fade-in{0%{opacity:0}to{opacity:1}}@keyframes _96fbead71248d210__fade-out{0%{opacity:1}to{opacity:0}}._1563bccb09e39c30__caption-after-enter,._60ac2a7fc3208801__weeks-before-exit,._735dacf9052adecd__caption-before-exit,._7f73a6ab85101202__weeks-after-exit,._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter,.c7a3082839155d29__caption-after-exit,.cb8a5ec82ad0885e__caption-before-enter{animation-duration:0s;animation-fill-mode:forwards;animation-timing-function:var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1));@media not (prefers-reduced-motion){animation-duration:var(--wpds-motion-duration-lg,.3s)}}._2c7ac60ba97b3411__root[dir=rtl] ._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter{animation-name:_255a1a462a5377db__slide-in-left}._2c7ac60ba97b3411__root[dir=rtl] ._7f73a6ab85101202__weeks-after-exit,._60ac2a7fc3208801__weeks-before-exit{animation-name:aed80001de9ae226__slide-out-left}._2c7ac60ba97b3411__root[dir=rtl] ._9721326fbc23a5fb__weeks-before-enter,._805d698b56ba4a29__weeks-after-enter{animation-name:c21e45f616d6db39__slide-in-right}._2c7ac60ba97b3411__root[dir=rtl] ._60ac2a7fc3208801__weeks-before-exit,._7f73a6ab85101202__weeks-after-exit{animation-name:_7d4779a7f29408f2__slide-out-right}._1563bccb09e39c30__caption-after-enter,.cb8a5ec82ad0885e__caption-before-enter{animation-name:_83ba6321b055d687__fade-in}._735dacf9052adecd__caption-before-exit,.c7a3082839155d29__caption-after-exit{animation-name:_96fbead71248d210__fade-out}}}');
19183 }
19184 var style_default10 = { "root": "_2c7ac60ba97b3411__root", "day": "_172c492625235710__day", "day-button": "_1b64226e315835f8__day-button", "caption-label": "_66b9a8120581fd4b__caption-label", "nav-button": "_395a75bb1930f57e__nav-button", "month-caption": "_337e5337d49b7f3d__month-caption", "months": "_110e46230c68e498__months", "month-grid": "_92915239fedb1fea__month-grid", "nav": "_66b1d4a7b488b496__nav", "weekday": "_7207199709ca5776__weekday", "today": "_058175f0f9c495e0__today", "selected": "acb642920fb0bef5__selected", "range-middle": "_165d91a726feca9c__range-middle", "outside": "c259c5c255fda10f__outside", "hidden": "_4d8957a0ca4ec8f0__hidden", "range-start": "f2523033db055ffe__range-start", "range-end": "c04a453de7b11520__range-end", "preview": "_81b244e7c541d95e__preview", "weeks-before-enter": "_9721326fbc23a5fb__weeks-before-enter", "weeks-before-exit": "_60ac2a7fc3208801__weeks-before-exit", "weeks-after-enter": "_805d698b56ba4a29__weeks-after-enter", "weeks-after-exit": "_7f73a6ab85101202__weeks-after-exit", "caption-after-enter": "_1563bccb09e39c30__caption-after-enter", "caption-after-exit": "c7a3082839155d29__caption-after-exit", "caption-before-enter": "cb8a5ec82ad0885e__caption-before-enter", "caption-before-exit": "_735dacf9052adecd__caption-before-exit", "slide-in-left": "_255a1a462a5377db__slide-in-left", "slide-out-left": "aed80001de9ae226__slide-out-left", "slide-in-right": "c21e45f616d6db39__slide-in-right", "slide-out-right": "_7d4779a7f29408f2__slide-out-right", "fade-in": "_83ba6321b055d687__fade-in", "fade-out": "_96fbead71248d210__fade-out" };
19185 if (typeof process === "undefined" || true) {
19186 registerStyle11("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
19187 }
19188 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
19189 if (typeof process === "undefined" || true) {
19190 registerStyle11("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
19191 }
19192 var focus_module_default3 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
19193 if (typeof process === "undefined" || true) {
19194 registerStyle11("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
19195 }
19196 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", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
19197 var CLASSNAMES = {
19198 root: clsx_default(style_default10.root, resets_default4["box-sizing"]),
19199 day: style_default10.day,
19200 day_button: clsx_default(
19201 style_default10["day-button"],
19202 global_css_defense_default4.button,
19203 focus_module_default3["outset-ring--focus-visible"]
19204 ),
19205 outside: style_default10.outside,
19206 caption_label: style_default10["caption-label"],
19207 button_next: style_default10["nav-button"],
19208 button_previous: style_default10["nav-button"],
19209 nav: style_default10.nav,
19210 month_caption: style_default10["month-caption"],
19211 months: style_default10.months,
19212 month_grid: style_default10["month-grid"],
19213 weekday: style_default10.weekday,
19214 today: style_default10.today,
19215 selected: style_default10.selected,
19216 /*
19217 * Disabled days are styled through `:has(.day-button:disabled)` rather than
19218 * a modifier class on the cell, because the two are not equivalent: the
19219 * focused day keeps its button enabled so it stays reachable. Mapped to
19220 * `undefined` on purpose, so `@daypicker/react` doesn't fall back to its
19221 * own `rdp-disabled` class for a modifier we don't style.
19222 */
19223 disabled: void 0,
19224 hidden: style_default10.hidden,
19225 range_start: style_default10["range-start"],
19226 range_end: style_default10["range-end"],
19227 range_middle: style_default10["range-middle"],
19228 weeks_before_enter: style_default10["weeks-before-enter"],
19229 weeks_before_exit: style_default10["weeks-before-exit"],
19230 weeks_after_enter: style_default10["weeks-after-enter"],
19231 weeks_after_exit: style_default10["weeks-after-exit"],
19232 caption_after_enter: style_default10["caption-after-enter"],
19233 caption_after_exit: style_default10["caption-after-exit"],
19234 caption_before_enter: style_default10["caption-before-enter"],
19235 caption_before_exit: style_default10["caption-before-exit"]
19236 };
19237 var MODIFIER_CLASSNAMES = {
19238 preview: style_default10.preview
19239 };
19240 var COMMON_PROPS = {
19241 animate: true,
19242 // Only show days in the current month
19243 showOutsideDays: false,
19244 // Hide week number column
19245 showWeekNumber: false,
19246 // Show weekdays row
19247 hideWeekdays: false,
19248 // Month and year caption are not interactive
19249 captionLayout: "label",
19250 // Show a variable number of weeks depending on the month
19251 fixedWeeks: false,
19252 // Show navigation buttons
19253 hideNavigation: false,
19254 // Class names
19255 classNames: CLASSNAMES,
19256 components: {
19257 Day: Day2,
19258 Root: Root3,
19259 PreviousMonthButton: PreviousMonthButton2,
19260 NextMonthButton: NextMonthButton2
19261 }
19262 };
19263
19264 // packages/ui/build-module/calendar/utils/misc.mjs
19265 function clampNumberOfMonths(numberOfMonths) {
19266 return Math.min(3, Math.max(1, numberOfMonths));
19267 }
19268
19269 // packages/ui/build-module/calendar/utils/use-controlled-value.mjs
19270 var import_element26 = __toESM(require_element(), 1);
19271 function useControlledValue2({
19272 defaultValue,
19273 onChange,
19274 value: valueProp
19275 }) {
19276 const hasValue = typeof valueProp !== "undefined";
19277 const initialValue = hasValue ? valueProp : defaultValue;
19278 const [state, setState] = (0, import_element26.useState)(initialValue);
19279 const value = hasValue ? valueProp : state;
19280 const uncontrolledSetValue = (0, import_element26.useCallback)(
19281 (nextValue, ...args) => {
19282 setState(nextValue);
19283 onChange?.(nextValue, ...args);
19284 },
19285 [onChange]
19286 );
19287 let setValue;
19288 if (hasValue && typeof onChange === "function") {
19289 setValue = onChange;
19290 } else if (!hasValue && typeof onChange === "function") {
19291 setValue = uncontrolledSetValue;
19292 } else {
19293 setValue = setState;
19294 }
19295 return [value, setValue];
19296 }
19297
19298 // packages/ui/build-module/calendar/utils/use-localization-props.mjs
19299 var import_i18n6 = __toESM(require_i18n(), 1);
19300 var import_element27 = __toESM(require_element(), 1);
19301 function isLocaleRTL(locale) {
19302 const direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction;
19303 if (direction) {
19304 return direction === "rtl";
19305 }
19306 return [
19307 "ar",
19308 // Arabic
19309 "he",
19310 // Hebrew
19311 "fa",
19312 // Persian (Farsi)
19313 "ur",
19314 // Urdu
19315 "ps",
19316 // Pashto
19317 "syr",
19318 // Syriac
19319 "dv",
19320 // Divehi
19321 "ku",
19322 // Kurdish (Sorani)
19323 "ckb",
19324 // Central Kurdish (Sorani)
19325 "ug",
19326 // Uyghur
19327 "yi"
19328 // Yiddish
19329 ].includes(locale.language);
19330 }
19331 function getSupportedLocaleCode(localeCode) {
19332 if (!localeCode) {
19333 return;
19334 }
19335 let supportedLocaleCode;
19336 try {
19337 supportedLocaleCode = Intl.DateTimeFormat.supportedLocalesOf([
19338 localeCode
19339 ])[0];
19340 } catch {
19341 }
19342 return supportedLocaleCode;
19343 }
19344 function getWeekStartsOn(locale) {
19345 const firstDay = (locale.getWeekInfo?.() ?? locale.weekInfo)?.firstDay;
19346 if (firstDay === void 0 || firstDay < 1 || firstDay > 7) {
19347 return;
19348 }
19349 return firstDay % 7;
19350 }
19351 var useLocalizationProps = ({
19352 locale,
19353 timeZone,
19354 mode
19355 }) => {
19356 return (0, import_element27.useMemo)(() => {
19357 const isLocaleString = typeof locale === "string";
19358 const dateFnsLocale = isLocaleString || locale === void 0 ? enUS : locale;
19359 const supportedLocaleCode = getSupportedLocaleCode(
19360 isLocaleString ? locale : locale?.code
19361 );
19362 const localeCode = supportedLocaleCode ?? "en-US";
19363 const intlLocale = new Intl.Locale(localeCode);
19364 const isRightToLeft = supportedLocaleCode !== void 0 ? isLocaleRTL(intlLocale) : (0, import_i18n6.isRTL)();
19365 const weekStartsOn = isLocaleString || supportedLocaleCode !== void 0 ? getWeekStartsOn(intlLocale) : void 0;
19366 const monthNameFormatter = new Intl.DateTimeFormat(localeCode, {
19367 calendar: "gregory",
19368 year: "numeric",
19369 month: "long",
19370 timeZone
19371 });
19372 const weekdayNarrowFormatter = new Intl.DateTimeFormat(localeCode, {
19373 calendar: "gregory",
19374 weekday: "narrow",
19375 timeZone
19376 });
19377 const weekdayLongFormatter = new Intl.DateTimeFormat(localeCode, {
19378 calendar: "gregory",
19379 weekday: "long",
19380 timeZone
19381 });
19382 const fullDateFormatter = new Intl.DateTimeFormat(localeCode, {
19383 calendar: "gregory",
19384 weekday: "long",
19385 year: "numeric",
19386 month: "long",
19387 day: "numeric",
19388 timeZone
19389 });
19390 const dayNumberFormatter = new Intl.DateTimeFormat(localeCode, {
19391 calendar: "gregory",
19392 day: "numeric",
19393 timeZone
19394 });
19395 return {
19396 "aria-label": mode === "single" ? (0, import_i18n6.__)("Date calendar") : (0, import_i18n6.__)("Date range calendar"),
19397 labels: {
19398 /** The label for the navigation toolbar. */
19399 labelNav: () => (0, import_i18n6.__)("Navigation bar"),
19400 /**
19401 * The label for the month grid.
19402 * @param date
19403 */
19404 labelGrid: monthNameFormatter.format,
19405 /**
19406 * The label for the gridcell, when the calendar is not interactive.
19407 * @param date
19408 * @param modifiers
19409 */
19410 labelGridcell: (date, modifiers) => {
19411 const formattedDate = fullDateFormatter.format(date);
19412 let label = formattedDate;
19413 if (modifiers?.today) {
19414 label = (0, import_i18n6.sprintf)(
19415 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19416 (0, import_i18n6.__)("Today, %s"),
19417 formattedDate
19418 );
19419 }
19420 return label;
19421 },
19422 /** The label for the "next month" button. */
19423 labelNext: () => (0, import_i18n6.__)("Next month"),
19424 /** The label for the "previous month" button. */
19425 labelPrevious: () => (0, import_i18n6.__)("Previous month"),
19426 /**
19427 * The label for the day button.
19428 * @param date
19429 * @param modifiers
19430 */
19431 labelDayButton: (date, modifiers) => {
19432 const formattedDate = fullDateFormatter.format(date);
19433 let label = formattedDate;
19434 if (modifiers?.today && modifiers?.selected) {
19435 return (0, import_i18n6.sprintf)(
19436 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19437 (0, import_i18n6.__)("Today, %s, selected"),
19438 formattedDate
19439 );
19440 }
19441 if (modifiers?.today) {
19442 label = (0, import_i18n6.sprintf)(
19443 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19444 (0, import_i18n6.__)("Today, %s"),
19445 formattedDate
19446 );
19447 }
19448 if (modifiers?.selected) {
19449 label = (0, import_i18n6.sprintf)(
19450 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19451 (0, import_i18n6.__)("%s, selected"),
19452 formattedDate
19453 );
19454 }
19455 return label;
19456 },
19457 /**
19458 * The label for the weekday.
19459 * @param date
19460 */
19461 labelWeekday: weekdayLongFormatter.format
19462 },
19463 locale: dateFnsLocale,
19464 lang: localeCode,
19465 dir: isRightToLeft ? "rtl" : "ltr",
19466 ...weekStartsOn === void 0 ? {} : { weekStartsOn },
19467 formatters: {
19468 formatDay: dayNumberFormatter.format,
19469 formatWeekdayName: weekdayNarrowFormatter.format,
19470 formatCaption: monthNameFormatter.format
19471 },
19472 timeZone
19473 };
19474 }, [locale, timeZone, mode]);
19475 };
19476
19477 // packages/ui/build-module/calendar/utils/use-preserve-day-focus.mjs
19478 var import_compose2 = __toESM(require_compose(), 1);
19479 var import_element28 = __toESM(require_element(), 1);
19480 function usePreserveDayFocus(forwardedRef, month) {
19481 const rootRef = (0, import_element28.useRef)(null);
19482 const hadDayFocusRef = (0, import_element28.useRef)(false);
19483 const mergedRef = (0, import_compose2.useMergeRefs)([rootRef, forwardedRef]);
19484 const monthIndex = month ? month.getFullYear() * 12 + month.getMonth() : void 0;
19485 const onDayFocus = (0, import_element28.useCallback)(() => {
19486 hadDayFocusRef.current = true;
19487 }, []);
19488 const onDayBlur = (0, import_element28.useCallback)(() => {
19489 hadDayFocusRef.current = false;
19490 }, []);
19491 (0, import_element28.useEffect)(() => {
19492 if (!hadDayFocusRef.current) {
19493 return;
19494 }
19495 const root = rootRef.current;
19496 if (!root) {
19497 return;
19498 }
19499 const { activeElement: activeElement2, body } = root.ownerDocument;
19500 if (activeElement2 !== body) {
19501 const grid = activeElement2?.closest('[role="grid"]');
19502 hadDayFocusRef.current = !!grid && root.contains(grid);
19503 return;
19504 }
19505 hadDayFocusRef.current = false;
19506 const focusTarget = root.querySelector(
19507 '[role="grid"] button[tabindex="0"]:not(:disabled)'
19508 );
19509 const enabledControl = root.querySelector(
19510 'button:not(:disabled):not([aria-disabled="true"])'
19511 );
19512 const focusableControl = root.querySelector(
19513 "button:not(:disabled)"
19514 );
19515 (focusTarget ?? enabledControl ?? focusableControl)?.focus();
19516 }, [monthIndex]);
19517 return { ref: mergedRef, onDayFocus, onDayBlur };
19518 }
19519
19520 // packages/ui/build-module/calendar/calendar.mjs
19521 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
19522 var Calendar = (0, import_element29.forwardRef)(
19523 function Calendar2({
19524 defaultValue,
19525 value: valueProp,
19526 onValueChange,
19527 numberOfMonths = 1,
19528 locale,
19529 timeZone,
19530 month,
19531 render: render4,
19532 role = "application",
19533 "aria-label": ariaLabel,
19534 labels: customLabels,
19535 ...props
19536 }, ref) {
19537 const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({
19538 locale,
19539 timeZone,
19540 mode: "single"
19541 });
19542 const labels = (0, import_element29.useMemo)(
19543 () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels,
19544 [localizationProps.labels, customLabels]
19545 );
19546 const onChange = (0, import_element29.useCallback)(
19547 (selected2, triggerDate, modifiers, e) => {
19548 onValueChange?.(
19549 selected2 ?? null,
19550 triggerDate,
19551 modifiers,
19552 e
19553 );
19554 },
19555 [onValueChange]
19556 );
19557 const [selected, setSelected] = useControlledValue2({
19558 defaultValue,
19559 value: valueProp,
19560 onChange
19561 });
19562 const dayFocusProps = usePreserveDayFocus(ref, month);
19563 const rootContextValue = (0, import_element29.useMemo)(
19564 () => ({
19565 render: render4,
19566 ref: dayFocusProps.ref,
19567 role,
19568 defaultAriaLabel
19569 }),
19570 [render4, dayFocusProps.ref, role, defaultAriaLabel]
19571 );
19572 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
19573 DayPicker,
19574 {
19575 ...COMMON_PROPS,
19576 ...localizationProps,
19577 ...props,
19578 "aria-label": ariaLabel,
19579 mode: "single",
19580 month,
19581 numberOfMonths: clampNumberOfMonths(numberOfMonths),
19582 labels,
19583 selected: selected ?? void 0,
19584 onSelect: setSelected,
19585 onDayFocus: dayFocusProps.onDayFocus,
19586 onDayBlur: dayFocusProps.onDayBlur
19587 }
19588 ) });
19589 }
19590 );
19591
19592 // packages/ui/build-module/calendar/range-calendar.mjs
19593 var import_element30 = __toESM(require_element(), 1);
19594 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
19595 function usePreviewRange({
19596 value,
19597 hoveredDate,
19598 excludeDisabled,
19599 resetOnSelect,
19600 min: min3,
19601 max: max3,
19602 disabled: disabled2
19603 }) {
19604 return (0, import_element30.useMemo)(() => {
19605 if (!hoveredDate || !value?.from) {
19606 return;
19607 }
19608 if (resetOnSelect && value.to) {
19609 return {
19610 from: hoveredDate,
19611 to: hoveredDate
19612 };
19613 }
19614 let previewHighlight;
19615 let potentialNewRange;
19616 if (hoveredDate < value.from) {
19617 previewHighlight = {
19618 from: hoveredDate,
19619 to: value.from
19620 };
19621 potentialNewRange = {
19622 from: hoveredDate,
19623 to: value.to ?? value.from
19624 };
19625 } else if (value.to && hoveredDate > value.from && hoveredDate < value.to) {
19626 previewHighlight = {
19627 from: value.from,
19628 to: hoveredDate
19629 };
19630 potentialNewRange = {
19631 from: value.from,
19632 to: hoveredDate
19633 };
19634 } else if (hoveredDate > value.from) {
19635 previewHighlight = {
19636 from: value.to ?? value.from,
19637 to: hoveredDate
19638 };
19639 potentialNewRange = {
19640 from: value.from,
19641 to: hoveredDate
19642 };
19643 }
19644 if (min3 !== void 0 && min3 > 0 && potentialNewRange && differenceInCalendarDays(
19645 potentialNewRange.to,
19646 potentialNewRange.from
19647 ) < min3) {
19648 previewHighlight = {
19649 from: hoveredDate,
19650 to: hoveredDate
19651 };
19652 }
19653 if (max3 !== void 0 && max3 > 0 && potentialNewRange && differenceInCalendarDays(
19654 potentialNewRange.to,
19655 potentialNewRange.from
19656 ) > max3) {
19657 previewHighlight = {
19658 from: hoveredDate,
19659 to: hoveredDate
19660 };
19661 }
19662 if (excludeDisabled && disabled2 && potentialNewRange && rangeContainsModifiers(potentialNewRange, disabled2)) {
19663 previewHighlight = {
19664 from: hoveredDate,
19665 to: hoveredDate
19666 };
19667 }
19668 return previewHighlight;
19669 }, [
19670 value,
19671 hoveredDate,
19672 excludeDisabled,
19673 resetOnSelect,
19674 min3,
19675 max3,
19676 disabled2
19677 ]);
19678 }
19679 var RangeCalendar = (0, import_element30.forwardRef)(
19680 function RangeCalendar2({
19681 defaultValue,
19682 value: valueProp,
19683 onValueChange,
19684 numberOfMonths = 1,
19685 excludeDisabled,
19686 resetOnSelect = true,
19687 min: min3,
19688 max: max3,
19689 disabled: disabled2,
19690 locale,
19691 timeZone,
19692 month,
19693 render: render4,
19694 role = "application",
19695 "aria-label": ariaLabel,
19696 labels: customLabels,
19697 ...props
19698 }, ref) {
19699 const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({
19700 locale,
19701 timeZone,
19702 mode: "range"
19703 });
19704 const labels = (0, import_element30.useMemo)(
19705 () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels,
19706 [localizationProps.labels, customLabels]
19707 );
19708 const onChange = (0, import_element30.useCallback)(
19709 (selected2, triggerDate, modifiers2, e) => {
19710 onValueChange?.(
19711 selected2 ?? null,
19712 triggerDate,
19713 modifiers2,
19714 e
19715 );
19716 },
19717 [onValueChange]
19718 );
19719 const [selected, setSelected] = useControlledValue2({
19720 defaultValue,
19721 value: valueProp,
19722 onChange
19723 });
19724 const dayFocusProps = usePreserveDayFocus(ref, month);
19725 const [hoveredDate, setHoveredDate] = (0, import_element30.useState)(
19726 void 0
19727 );
19728 const previewRange = usePreviewRange({
19729 value: selected,
19730 hoveredDate,
19731 excludeDisabled,
19732 resetOnSelect,
19733 min: min3,
19734 max: max3,
19735 disabled: disabled2
19736 });
19737 const modifiers = (0, import_element30.useMemo)(() => {
19738 return {
19739 preview: previewRange,
19740 preview_start: previewRange?.from,
19741 preview_end: previewRange?.to
19742 };
19743 }, [previewRange]);
19744 const rootContextValue = (0, import_element30.useMemo)(
19745 () => ({
19746 render: render4,
19747 ref: dayFocusProps.ref,
19748 role,
19749 defaultAriaLabel
19750 }),
19751 [render4, dayFocusProps.ref, role, defaultAriaLabel]
19752 );
19753 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
19754 DayPicker,
19755 {
19756 ...COMMON_PROPS,
19757 ...localizationProps,
19758 ...props,
19759 "aria-label": ariaLabel,
19760 mode: "range",
19761 month,
19762 numberOfMonths: clampNumberOfMonths(numberOfMonths),
19763 disabled: disabled2,
19764 excludeDisabled,
19765 resetOnSelect,
19766 min: min3,
19767 max: max3,
19768 labels,
19769 selected: selected ?? void 0,
19770 onSelect: setSelected,
19771 onDayFocus: dayFocusProps.onDayFocus,
19772 onDayBlur: dayFocusProps.onDayBlur,
19773 onDayMouseEnter: (date) => setHoveredDate(date),
19774 onDayMouseLeave: () => setHoveredDate(void 0),
19775 modifiers,
19776 modifiersClassNames: MODIFIER_CLASSNAMES
19777 }
19778 ) });
19779 }
19780 );
19781
19782 // packages/ui/build-module/card/index.mjs
19783 var card_exports = {};
19784 __export(card_exports, {
19785 Content: () => Content,
19786 FullBleed: () => FullBleed,
19787 Header: () => Header,
19788 Root: () => Root4,
19789 Title: () => Title
19790 });
19791
19792 // packages/ui/build-module/card/root.mjs
19793 var import_element31 = __toESM(require_element(), 1);
19794 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash";
19795 function getRuntime12() {
19796 const globalScope = globalThis;
19797 if (globalScope.__wpStyleRuntime) {
19798 return globalScope.__wpStyleRuntime;
19799 }
19800 globalScope.__wpStyleRuntime = {
19801 documents: /* @__PURE__ */ new Map(),
19802 styles: /* @__PURE__ */ new Map(),
19803 injectedStyles: /* @__PURE__ */ new WeakMap()
19804 };
19805 if (typeof document !== "undefined") {
19806 registerDocument12(document);
19807 }
19808 return globalScope.__wpStyleRuntime;
19809 }
19810 function documentContainsStyleHash12(targetDocument, hash) {
19811 if (!targetDocument.head) {
19812 return false;
19813 }
19814 for (const style of targetDocument.head.querySelectorAll(
19815 `style[${STYLE_HASH_ATTRIBUTE12}]`
19816 )) {
19817 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) {
19818 return true;
19819 }
19820 }
19821 return false;
19822 }
19823 function injectStyle12(targetDocument, hash, css) {
19824 if (!targetDocument.head) {
19825 return;
19826 }
19827 const runtime = getRuntime12();
19828 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19829 if (!injectedStyles) {
19830 injectedStyles = /* @__PURE__ */ new Set();
19831 runtime.injectedStyles.set(targetDocument, injectedStyles);
19832 }
19833 if (injectedStyles.has(hash)) {
19834 return;
19835 }
19836 if (documentContainsStyleHash12(targetDocument, hash)) {
19837 injectedStyles.add(hash);
19838 return;
19839 }
19840 const style = targetDocument.createElement("style");
19841 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash);
19842 style.appendChild(targetDocument.createTextNode(css));
19843 targetDocument.head.appendChild(style);
19844 injectedStyles.add(hash);
19845 }
19846 function registerDocument12(targetDocument) {
19847 const runtime = getRuntime12();
19848 runtime.documents.set(
19849 targetDocument,
19850 (runtime.documents.get(targetDocument) ?? 0) + 1
19851 );
19852 for (const [hash, css] of runtime.styles) {
19853 injectStyle12(targetDocument, hash, css);
19854 }
19855 return () => {
19856 const count = runtime.documents.get(targetDocument);
19857 if (count === void 0) {
19858 return;
19859 }
19860 if (count <= 1) {
19861 runtime.documents.delete(targetDocument);
19862 return;
19863 }
19864 runtime.documents.set(targetDocument, count - 1);
19865 };
19866 }
19867 function registerStyle12(hash, css) {
19868 const runtime = getRuntime12();
19869 runtime.styles.set(hash, css);
19870 for (const targetDocument of runtime.documents.keys()) {
19871 injectStyle12(targetDocument, hash, css);
19872 }
19873 }
19874 if (typeof process === "undefined" || true) {
19875 registerStyle12("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
19876 }
19877 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
19878 if (typeof process === "undefined" || true) {
19879 registerStyle12("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}");
19880 }
19881 var style_default11 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
19882 var Root4 = (0, import_element31.forwardRef)(function Card({ render: render4, ...restProps }, ref) {
19883 const mergedClassName = clsx_default(style_default11.root, resets_default5["box-sizing"]);
19884 const element = useRender({
19885 defaultTagName: "div",
19886 render: render4,
19887 ref,
19888 props: mergeProps({ className: mergedClassName }, restProps)
19889 });
19890 return element;
19891 });
19892
19893 // packages/ui/build-module/card/header.mjs
19894 var import_element32 = __toESM(require_element(), 1);
19895 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash";
19896 function getRuntime13() {
19897 const globalScope = globalThis;
19898 if (globalScope.__wpStyleRuntime) {
19899 return globalScope.__wpStyleRuntime;
19900 }
19901 globalScope.__wpStyleRuntime = {
19902 documents: /* @__PURE__ */ new Map(),
19903 styles: /* @__PURE__ */ new Map(),
19904 injectedStyles: /* @__PURE__ */ new WeakMap()
19905 };
19906 if (typeof document !== "undefined") {
19907 registerDocument13(document);
19908 }
19909 return globalScope.__wpStyleRuntime;
19910 }
19911 function documentContainsStyleHash13(targetDocument, hash) {
19912 if (!targetDocument.head) {
19913 return false;
19914 }
19915 for (const style of targetDocument.head.querySelectorAll(
19916 `style[${STYLE_HASH_ATTRIBUTE13}]`
19917 )) {
19918 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) {
19919 return true;
19920 }
19921 }
19922 return false;
19923 }
19924 function injectStyle13(targetDocument, hash, css) {
19925 if (!targetDocument.head) {
19926 return;
19927 }
19928 const runtime = getRuntime13();
19929 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19930 if (!injectedStyles) {
19931 injectedStyles = /* @__PURE__ */ new Set();
19932 runtime.injectedStyles.set(targetDocument, injectedStyles);
19933 }
19934 if (injectedStyles.has(hash)) {
19935 return;
19936 }
19937 if (documentContainsStyleHash13(targetDocument, hash)) {
19938 injectedStyles.add(hash);
19939 return;
19940 }
19941 const style = targetDocument.createElement("style");
19942 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash);
19943 style.appendChild(targetDocument.createTextNode(css));
19944 targetDocument.head.appendChild(style);
19945 injectedStyles.add(hash);
19946 }
19947 function registerDocument13(targetDocument) {
19948 const runtime = getRuntime13();
19949 runtime.documents.set(
19950 targetDocument,
19951 (runtime.documents.get(targetDocument) ?? 0) + 1
19952 );
19953 for (const [hash, css] of runtime.styles) {
19954 injectStyle13(targetDocument, hash, css);
19955 }
19956 return () => {
19957 const count = runtime.documents.get(targetDocument);
19958 if (count === void 0) {
19959 return;
19960 }
19961 if (count <= 1) {
19962 runtime.documents.delete(targetDocument);
19963 return;
19964 }
19965 runtime.documents.set(targetDocument, count - 1);
19966 };
19967 }
19968 function registerStyle13(hash, css) {
19969 const runtime = getRuntime13();
19970 runtime.styles.set(hash, css);
19971 for (const targetDocument of runtime.documents.keys()) {
19972 injectStyle13(targetDocument, hash, css);
19973 }
19974 }
19975 if (typeof process === "undefined" || true) {
19976 registerStyle13("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}");
19977 }
19978 var style_default12 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
19979 var Header = (0, import_element32.forwardRef)(
19980 function CardHeader({ render: render4, ...props }, ref) {
19981 const element = useRender({
19982 defaultTagName: "div",
19983 render: render4,
19984 ref,
19985 props: mergeProps({ className: style_default12.header }, props)
19986 });
19987 return element;
19988 }
19989 );
19990
19991 // packages/ui/build-module/card/content.mjs
19992 var import_element33 = __toESM(require_element(), 1);
19993 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash";
19994 function getRuntime14() {
19995 const globalScope = globalThis;
19996 if (globalScope.__wpStyleRuntime) {
19997 return globalScope.__wpStyleRuntime;
19998 }
19999 globalScope.__wpStyleRuntime = {
20000 documents: /* @__PURE__ */ new Map(),
20001 styles: /* @__PURE__ */ new Map(),
20002 injectedStyles: /* @__PURE__ */ new WeakMap()
20003 };
20004 if (typeof document !== "undefined") {
20005 registerDocument14(document);
20006 }
20007 return globalScope.__wpStyleRuntime;
20008 }
20009 function documentContainsStyleHash14(targetDocument, hash) {
20010 if (!targetDocument.head) {
20011 return false;
20012 }
20013 for (const style of targetDocument.head.querySelectorAll(
20014 `style[${STYLE_HASH_ATTRIBUTE14}]`
20015 )) {
20016 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) {
20017 return true;
20018 }
20019 }
20020 return false;
20021 }
20022 function injectStyle14(targetDocument, hash, css) {
20023 if (!targetDocument.head) {
20024 return;
20025 }
20026 const runtime = getRuntime14();
20027 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20028 if (!injectedStyles) {
20029 injectedStyles = /* @__PURE__ */ new Set();
20030 runtime.injectedStyles.set(targetDocument, injectedStyles);
20031 }
20032 if (injectedStyles.has(hash)) {
20033 return;
20034 }
20035 if (documentContainsStyleHash14(targetDocument, hash)) {
20036 injectedStyles.add(hash);
20037 return;
20038 }
20039 const style = targetDocument.createElement("style");
20040 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash);
20041 style.appendChild(targetDocument.createTextNode(css));
20042 targetDocument.head.appendChild(style);
20043 injectedStyles.add(hash);
20044 }
20045 function registerDocument14(targetDocument) {
20046 const runtime = getRuntime14();
20047 runtime.documents.set(
20048 targetDocument,
20049 (runtime.documents.get(targetDocument) ?? 0) + 1
20050 );
20051 for (const [hash, css] of runtime.styles) {
20052 injectStyle14(targetDocument, hash, css);
20053 }
20054 return () => {
20055 const count = runtime.documents.get(targetDocument);
20056 if (count === void 0) {
20057 return;
20058 }
20059 if (count <= 1) {
20060 runtime.documents.delete(targetDocument);
20061 return;
20062 }
20063 runtime.documents.set(targetDocument, count - 1);
20064 };
20065 }
20066 function registerStyle14(hash, css) {
20067 const runtime = getRuntime14();
20068 runtime.styles.set(hash, css);
20069 for (const targetDocument of runtime.documents.keys()) {
20070 injectStyle14(targetDocument, hash, css);
20071 }
20072 }
20073 if (typeof process === "undefined" || true) {
20074 registerStyle14("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}");
20075 }
20076 var style_default13 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
20077 var Content = (0, import_element33.forwardRef)(
20078 function CardContent({ render: render4, ...props }, ref) {
20079 const element = useRender({
20080 defaultTagName: "div",
20081 render: render4,
20082 ref,
20083 props: mergeProps({ className: style_default13.content }, props)
20084 });
20085 return element;
20086 }
20087 );
20088
20089 // packages/ui/build-module/card/full-bleed.mjs
20090 var import_element34 = __toESM(require_element(), 1);
20091 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash";
20092 function getRuntime15() {
20093 const globalScope = globalThis;
20094 if (globalScope.__wpStyleRuntime) {
20095 return globalScope.__wpStyleRuntime;
20096 }
20097 globalScope.__wpStyleRuntime = {
20098 documents: /* @__PURE__ */ new Map(),
20099 styles: /* @__PURE__ */ new Map(),
20100 injectedStyles: /* @__PURE__ */ new WeakMap()
20101 };
20102 if (typeof document !== "undefined") {
20103 registerDocument15(document);
20104 }
20105 return globalScope.__wpStyleRuntime;
20106 }
20107 function documentContainsStyleHash15(targetDocument, hash) {
20108 if (!targetDocument.head) {
20109 return false;
20110 }
20111 for (const style of targetDocument.head.querySelectorAll(
20112 `style[${STYLE_HASH_ATTRIBUTE15}]`
20113 )) {
20114 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) {
20115 return true;
20116 }
20117 }
20118 return false;
20119 }
20120 function injectStyle15(targetDocument, hash, css) {
20121 if (!targetDocument.head) {
20122 return;
20123 }
20124 const runtime = getRuntime15();
20125 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20126 if (!injectedStyles) {
20127 injectedStyles = /* @__PURE__ */ new Set();
20128 runtime.injectedStyles.set(targetDocument, injectedStyles);
20129 }
20130 if (injectedStyles.has(hash)) {
20131 return;
20132 }
20133 if (documentContainsStyleHash15(targetDocument, hash)) {
20134 injectedStyles.add(hash);
20135 return;
20136 }
20137 const style = targetDocument.createElement("style");
20138 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash);
20139 style.appendChild(targetDocument.createTextNode(css));
20140 targetDocument.head.appendChild(style);
20141 injectedStyles.add(hash);
20142 }
20143 function registerDocument15(targetDocument) {
20144 const runtime = getRuntime15();
20145 runtime.documents.set(
20146 targetDocument,
20147 (runtime.documents.get(targetDocument) ?? 0) + 1
20148 );
20149 for (const [hash, css] of runtime.styles) {
20150 injectStyle15(targetDocument, hash, css);
20151 }
20152 return () => {
20153 const count = runtime.documents.get(targetDocument);
20154 if (count === void 0) {
20155 return;
20156 }
20157 if (count <= 1) {
20158 runtime.documents.delete(targetDocument);
20159 return;
20160 }
20161 runtime.documents.set(targetDocument, count - 1);
20162 };
20163 }
20164 function registerStyle15(hash, css) {
20165 const runtime = getRuntime15();
20166 runtime.styles.set(hash, css);
20167 for (const targetDocument of runtime.documents.keys()) {
20168 injectStyle15(targetDocument, hash, css);
20169 }
20170 }
20171 if (typeof process === "undefined" || true) {
20172 registerStyle15("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}");
20173 }
20174 var style_default14 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
20175 var FullBleed = (0, import_element34.forwardRef)(
20176 function CardFullBleed({ render: render4, ...props }, ref) {
20177 const element = useRender({
20178 defaultTagName: "div",
20179 render: render4,
20180 ref,
20181 props: mergeProps(
20182 { className: style_default14.fullbleed },
20183 props
20184 )
20185 });
20186 return element;
20187 }
20188 );
20189
20190 // packages/ui/build-module/card/title.mjs
20191 var import_element35 = __toESM(require_element(), 1);
20192 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
20193 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", {});
20194 var Title = (0, import_element35.forwardRef)(
20195 function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) {
20196 return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
20197 Text,
20198 {
20199 ref,
20200 variant: "heading-lg",
20201 render: render4,
20202 ...props,
20203 children
20204 }
20205 );
20206 }
20207 );
20208
20209 // packages/ui/build-module/collapsible/panel.mjs
20210 var import_element36 = __toESM(require_element(), 1);
20211 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
20212 var Panel = (0, import_element36.forwardRef)(
20213 function CollapsiblePanel3(props, forwardedRef) {
20214 return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props });
20215 }
20216 );
20217
20218 // packages/ui/build-module/collapsible/root.mjs
20219 var import_element37 = __toESM(require_element(), 1);
20220 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
20221 var Root5 = (0, import_element37.forwardRef)(
20222 function CollapsibleRoot3(props, forwardedRef) {
20223 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props });
20224 }
20225 );
20226
20227 // packages/ui/build-module/collapsible/trigger.mjs
20228 var import_element38 = __toESM(require_element(), 1);
20229 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
20230 var Trigger2 = (0, import_element38.forwardRef)(
20231 function CollapsibleTrigger3(props, forwardedRef) {
20232 return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props });
20233 }
20234 );
20235
20236 // packages/ui/build-module/collapsible-card/index.mjs
20237 var collapsible_card_exports = {};
20238 __export(collapsible_card_exports, {
20239 Content: () => Content2,
20240 Header: () => Header2,
20241 HeaderDescription: () => HeaderDescription,
20242 Root: () => Root32
20243 });
20244
20245 // packages/ui/build-module/collapsible-card/root.mjs
20246 var import_element39 = __toESM(require_element(), 1);
20247 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
20248 var Root32 = (0, import_element39.forwardRef)(
20249 function CollapsibleCardRoot({ render: render4, ...restProps }, ref) {
20250 return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
20251 Root5,
20252 {
20253 ref,
20254 render: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Root4, { render: render4 }),
20255 ...restProps
20256 }
20257 );
20258 }
20259 );
20260
20261 // packages/ui/build-module/collapsible-card/header.mjs
20262 var import_compose3 = __toESM(require_compose(), 1);
20263 var import_element41 = __toESM(require_element(), 1);
20264
20265 // packages/ui/build-module/collapsible-card/context.mjs
20266 var import_element40 = __toESM(require_element(), 1);
20267 var HeaderDescriptionIdContext = (0, import_element40.createContext)(null);
20268
20269 // packages/ui/build-module/collapsible-card/header.mjs
20270 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
20271 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash";
20272 function getRuntime16() {
20273 const globalScope = globalThis;
20274 if (globalScope.__wpStyleRuntime) {
20275 return globalScope.__wpStyleRuntime;
20276 }
20277 globalScope.__wpStyleRuntime = {
20278 documents: /* @__PURE__ */ new Map(),
20279 styles: /* @__PURE__ */ new Map(),
20280 injectedStyles: /* @__PURE__ */ new WeakMap()
20281 };
20282 if (typeof document !== "undefined") {
20283 registerDocument16(document);
20284 }
20285 return globalScope.__wpStyleRuntime;
20286 }
20287 function documentContainsStyleHash16(targetDocument, hash) {
20288 if (!targetDocument.head) {
20289 return false;
20290 }
20291 for (const style of targetDocument.head.querySelectorAll(
20292 `style[${STYLE_HASH_ATTRIBUTE16}]`
20293 )) {
20294 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) {
20295 return true;
20296 }
20297 }
20298 return false;
20299 }
20300 function injectStyle16(targetDocument, hash, css) {
20301 if (!targetDocument.head) {
20302 return;
20303 }
20304 const runtime = getRuntime16();
20305 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20306 if (!injectedStyles) {
20307 injectedStyles = /* @__PURE__ */ new Set();
20308 runtime.injectedStyles.set(targetDocument, injectedStyles);
20309 }
20310 if (injectedStyles.has(hash)) {
20311 return;
20312 }
20313 if (documentContainsStyleHash16(targetDocument, hash)) {
20314 injectedStyles.add(hash);
20315 return;
20316 }
20317 const style = targetDocument.createElement("style");
20318 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash);
20319 style.appendChild(targetDocument.createTextNode(css));
20320 targetDocument.head.appendChild(style);
20321 injectedStyles.add(hash);
20322 }
20323 function registerDocument16(targetDocument) {
20324 const runtime = getRuntime16();
20325 runtime.documents.set(
20326 targetDocument,
20327 (runtime.documents.get(targetDocument) ?? 0) + 1
20328 );
20329 for (const [hash, css] of runtime.styles) {
20330 injectStyle16(targetDocument, hash, css);
20331 }
20332 return () => {
20333 const count = runtime.documents.get(targetDocument);
20334 if (count === void 0) {
20335 return;
20336 }
20337 if (count <= 1) {
20338 runtime.documents.delete(targetDocument);
20339 return;
20340 }
20341 runtime.documents.set(targetDocument, count - 1);
20342 };
20343 }
20344 function registerStyle16(hash, css) {
20345 const runtime = getRuntime16();
20346 runtime.styles.set(hash, css);
20347 for (const targetDocument of runtime.documents.keys()) {
20348 injectStyle16(targetDocument, hash, css);
20349 }
20350 }
20351 if (typeof process === "undefined" || true) {
20352 registerStyle16("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);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-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{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 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)}}}}");
20353 }
20354 var style_default15 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "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", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
20355 if (typeof process === "undefined" || true) {
20356 registerStyle16("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
20357 }
20358 var global_css_defense_default5 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
20359 if (typeof process === "undefined" || true) {
20360 registerStyle16("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
20361 }
20362 var focus_module_default4 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
20363 var Header2 = (0, import_element41.forwardRef)(
20364 function CollapsibleCardHeader({
20365 children,
20366 className,
20367 render: render4,
20368 "aria-describedby": ariaDescribedByProp,
20369 ...restProps
20370 }, ref) {
20371 const [descriptionIds, setDescriptionIds] = (0, import_element41.useState)(
20372 []
20373 );
20374 const [orderedDescriptionIds, setOrderedDescriptionIds] = (0, import_element41.useState)([]);
20375 const headerContentRef = (0, import_element41.useRef)(null);
20376 const registerDescriptionId = (0, import_element41.useCallback)((id) => {
20377 setDescriptionIds((currentDescriptionIds) => {
20378 if (currentDescriptionIds.includes(id)) {
20379 return currentDescriptionIds;
20380 }
20381 return [...currentDescriptionIds, id];
20382 });
20383 return () => {
20384 setDescriptionIds(
20385 (currentDescriptionIds) => currentDescriptionIds.filter(
20386 (descriptionId) => descriptionId !== id
20387 )
20388 );
20389 };
20390 }, []);
20391 const contextValue = (0, import_element41.useMemo)(
20392 () => ({ registerDescriptionId }),
20393 [registerDescriptionId]
20394 );
20395 (0, import_compose3.useIsomorphicLayoutEffect)(() => {
20396 const registeredDescriptionIds = new Set(descriptionIds);
20397 const nextDescriptionIds = Array.from(
20398 headerContentRef.current?.querySelectorAll("[id]") ?? []
20399 ).map((element) => element.id).filter((id) => registeredDescriptionIds.has(id));
20400 setOrderedDescriptionIds((currentDescriptionIds) => {
20401 if (currentDescriptionIds.length === nextDescriptionIds.length && currentDescriptionIds.every(
20402 (id, index2) => id === nextDescriptionIds[index2]
20403 )) {
20404 return currentDescriptionIds;
20405 }
20406 return nextDescriptionIds;
20407 });
20408 });
20409 const ariaDescribedBy = Array.from(
20410 /* @__PURE__ */ new Set([
20411 ...ariaDescribedByProp?.split(/\s+/).filter(Boolean) ?? [],
20412 ...orderedDescriptionIds
20413 ])
20414 ).join(" ") || void 0;
20415 return useRender({
20416 defaultTagName: "div",
20417 render: render4,
20418 ref,
20419 props: mergeProps(restProps, {
20420 className: clsx_default(
20421 global_css_defense_default5.heading,
20422 style_default15["heading-wrapper"],
20423 className
20424 ),
20425 children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
20426 Trigger2,
20427 {
20428 className: style_default15.header,
20429 render: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Header, {}),
20430 nativeButton: false,
20431 "aria-describedby": ariaDescribedBy,
20432 children: [
20433 /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
20434 "div",
20435 {
20436 ref: headerContentRef,
20437 className: style_default15["header-content"],
20438 children
20439 }
20440 ),
20441 /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
20442 "div",
20443 {
20444 className: clsx_default(
20445 style_default15["header-trigger-positioner"]
20446 ),
20447 children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
20448 "div",
20449 {
20450 className: clsx_default(
20451 style_default15["header-trigger-wrapper"],
20452 global_css_defense_default5.div,
20453 // While the interactive trigger element is the whole header,
20454 // the focus ring will be displayed only on the icon to visually
20455 // emulate it being the button.
20456 focus_module_default4["outset-ring--focus-parent-visible"]
20457 ),
20458 children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
20459 Icon,
20460 {
20461 icon: chevron_down_default,
20462 className: style_default15["header-trigger"]
20463 }
20464 )
20465 }
20466 )
20467 }
20468 )
20469 ]
20470 }
20471 ) })
20472 })
20473 });
20474 }
20475 );
20476
20477 // packages/ui/build-module/collapsible-card/header-description.mjs
20478 var import_element42 = __toESM(require_element(), 1);
20479 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
20480 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash";
20481 function getRuntime17() {
20482 const globalScope = globalThis;
20483 if (globalScope.__wpStyleRuntime) {
20484 return globalScope.__wpStyleRuntime;
20485 }
20486 globalScope.__wpStyleRuntime = {
20487 documents: /* @__PURE__ */ new Map(),
20488 styles: /* @__PURE__ */ new Map(),
20489 injectedStyles: /* @__PURE__ */ new WeakMap()
20490 };
20491 if (typeof document !== "undefined") {
20492 registerDocument17(document);
20493 }
20494 return globalScope.__wpStyleRuntime;
20495 }
20496 function documentContainsStyleHash17(targetDocument, hash) {
20497 if (!targetDocument.head) {
20498 return false;
20499 }
20500 for (const style of targetDocument.head.querySelectorAll(
20501 `style[${STYLE_HASH_ATTRIBUTE17}]`
20502 )) {
20503 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) {
20504 return true;
20505 }
20506 }
20507 return false;
20508 }
20509 function injectStyle17(targetDocument, hash, css) {
20510 if (!targetDocument.head) {
20511 return;
20512 }
20513 const runtime = getRuntime17();
20514 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20515 if (!injectedStyles) {
20516 injectedStyles = /* @__PURE__ */ new Set();
20517 runtime.injectedStyles.set(targetDocument, injectedStyles);
20518 }
20519 if (injectedStyles.has(hash)) {
20520 return;
20521 }
20522 if (documentContainsStyleHash17(targetDocument, hash)) {
20523 injectedStyles.add(hash);
20524 return;
20525 }
20526 const style = targetDocument.createElement("style");
20527 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash);
20528 style.appendChild(targetDocument.createTextNode(css));
20529 targetDocument.head.appendChild(style);
20530 injectedStyles.add(hash);
20531 }
20532 function registerDocument17(targetDocument) {
20533 const runtime = getRuntime17();
20534 runtime.documents.set(
20535 targetDocument,
20536 (runtime.documents.get(targetDocument) ?? 0) + 1
20537 );
20538 for (const [hash, css] of runtime.styles) {
20539 injectStyle17(targetDocument, hash, css);
20540 }
20541 return () => {
20542 const count = runtime.documents.get(targetDocument);
20543 if (count === void 0) {
20544 return;
20545 }
20546 if (count <= 1) {
20547 runtime.documents.delete(targetDocument);
20548 return;
20549 }
20550 runtime.documents.set(targetDocument, count - 1);
20551 };
20552 }
20553 function registerStyle17(hash, css) {
20554 const runtime = getRuntime17();
20555 runtime.styles.set(hash, css);
20556 for (const targetDocument of runtime.documents.keys()) {
20557 injectStyle17(targetDocument, hash, css);
20558 }
20559 }
20560 if (typeof process === "undefined" || true) {
20561 registerStyle17("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);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-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{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 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)}}}}");
20562 }
20563 var style_default16 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "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", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
20564 var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", {});
20565 var HeaderDescription = (0, import_element42.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, id: idProp, render: render4 = DEFAULT_TAG2, ...restProps }, ref) {
20566 const generatedId = (0, import_element42.useId)();
20567 const descriptionId = idProp ?? generatedId;
20568 const context = (0, import_element42.useContext)(HeaderDescriptionIdContext);
20569 if (!context) {
20570 throw new Error(
20571 "CollapsibleCard.HeaderDescription: Missing parent <CollapsibleCard.Header>. Render <CollapsibleCard.HeaderDescription> inside <CollapsibleCard.Header>."
20572 );
20573 }
20574 (0, import_element42.useEffect)(() => {
20575 return context?.registerDescriptionId(descriptionId);
20576 }, [context, descriptionId]);
20577 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
20578 Text,
20579 {
20580 ref,
20581 variant: "body-md",
20582 render: render4,
20583 id: descriptionId,
20584 "aria-hidden": "true",
20585 className: clsx_default(style_default16["header-description"], className),
20586 ...restProps,
20587 children
20588 }
20589 );
20590 });
20591
20592 // packages/ui/build-module/collapsible-card/content.mjs
20593 var import_element43 = __toESM(require_element(), 1);
20594 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
20595 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash";
20596 function getRuntime18() {
20597 const globalScope = globalThis;
20598 if (globalScope.__wpStyleRuntime) {
20599 return globalScope.__wpStyleRuntime;
20600 }
20601 globalScope.__wpStyleRuntime = {
20602 documents: /* @__PURE__ */ new Map(),
20603 styles: /* @__PURE__ */ new Map(),
20604 injectedStyles: /* @__PURE__ */ new WeakMap()
20605 };
20606 if (typeof document !== "undefined") {
20607 registerDocument18(document);
20608 }
20609 return globalScope.__wpStyleRuntime;
20610 }
20611 function documentContainsStyleHash18(targetDocument, hash) {
20612 if (!targetDocument.head) {
20613 return false;
20614 }
20615 for (const style of targetDocument.head.querySelectorAll(
20616 `style[${STYLE_HASH_ATTRIBUTE18}]`
20617 )) {
20618 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) {
20619 return true;
20620 }
20621 }
20622 return false;
20623 }
20624 function injectStyle18(targetDocument, hash, css) {
20625 if (!targetDocument.head) {
20626 return;
20627 }
20628 const runtime = getRuntime18();
20629 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20630 if (!injectedStyles) {
20631 injectedStyles = /* @__PURE__ */ new Set();
20632 runtime.injectedStyles.set(targetDocument, injectedStyles);
20633 }
20634 if (injectedStyles.has(hash)) {
20635 return;
20636 }
20637 if (documentContainsStyleHash18(targetDocument, hash)) {
20638 injectedStyles.add(hash);
20639 return;
20640 }
20641 const style = targetDocument.createElement("style");
20642 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash);
20643 style.appendChild(targetDocument.createTextNode(css));
20644 targetDocument.head.appendChild(style);
20645 injectedStyles.add(hash);
20646 }
20647 function registerDocument18(targetDocument) {
20648 const runtime = getRuntime18();
20649 runtime.documents.set(
20650 targetDocument,
20651 (runtime.documents.get(targetDocument) ?? 0) + 1
20652 );
20653 for (const [hash, css] of runtime.styles) {
20654 injectStyle18(targetDocument, hash, css);
20655 }
20656 return () => {
20657 const count = runtime.documents.get(targetDocument);
20658 if (count === void 0) {
20659 return;
20660 }
20661 if (count <= 1) {
20662 runtime.documents.delete(targetDocument);
20663 return;
20664 }
20665 runtime.documents.set(targetDocument, count - 1);
20666 };
20667 }
20668 function registerStyle18(hash, css) {
20669 const runtime = getRuntime18();
20670 runtime.styles.set(hash, css);
20671 for (const targetDocument of runtime.documents.keys()) {
20672 injectStyle18(targetDocument, hash, css);
20673 }
20674 }
20675 if (typeof process === "undefined" || true) {
20676 registerStyle18("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);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-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{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 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)}}}}");
20677 }
20678 var style_default17 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "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", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
20679 var Content2 = (0, import_element43.forwardRef)(
20680 function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) {
20681 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20682 Panel,
20683 {
20684 ref,
20685 className: (state) => clsx_default(
20686 style_default17.content,
20687 state.open && state.transitionStatus === "idle" && style_default17["overflow-visible"],
20688 className
20689 ),
20690 hiddenUntilFound,
20691 ...restProps,
20692 children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20693 Content,
20694 {
20695 className: style_default17["content-inner"],
20696 render: render4,
20697 children
20698 }
20699 )
20700 }
20701 );
20702 }
20703 );
20704
20705 // packages/ui/build-module/stack/stack.mjs
20706 var import_element44 = __toESM(require_element(), 1);
20707 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash";
20708 function getRuntime19() {
20709 const globalScope = globalThis;
20710 if (globalScope.__wpStyleRuntime) {
20711 return globalScope.__wpStyleRuntime;
20712 }
20713 globalScope.__wpStyleRuntime = {
20714 documents: /* @__PURE__ */ new Map(),
20715 styles: /* @__PURE__ */ new Map(),
20716 injectedStyles: /* @__PURE__ */ new WeakMap()
20717 };
20718 if (typeof document !== "undefined") {
20719 registerDocument19(document);
20720 }
20721 return globalScope.__wpStyleRuntime;
20722 }
20723 function documentContainsStyleHash19(targetDocument, hash) {
20724 if (!targetDocument.head) {
20725 return false;
20726 }
20727 for (const style of targetDocument.head.querySelectorAll(
20728 `style[${STYLE_HASH_ATTRIBUTE19}]`
20729 )) {
20730 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) {
20731 return true;
20732 }
20733 }
20734 return false;
20735 }
20736 function injectStyle19(targetDocument, hash, css) {
20737 if (!targetDocument.head) {
20738 return;
20739 }
20740 const runtime = getRuntime19();
20741 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20742 if (!injectedStyles) {
20743 injectedStyles = /* @__PURE__ */ new Set();
20744 runtime.injectedStyles.set(targetDocument, injectedStyles);
20745 }
20746 if (injectedStyles.has(hash)) {
20747 return;
20748 }
20749 if (documentContainsStyleHash19(targetDocument, hash)) {
20750 injectedStyles.add(hash);
20751 return;
20752 }
20753 const style = targetDocument.createElement("style");
20754 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash);
20755 style.appendChild(targetDocument.createTextNode(css));
20756 targetDocument.head.appendChild(style);
20757 injectedStyles.add(hash);
20758 }
20759 function registerDocument19(targetDocument) {
20760 const runtime = getRuntime19();
20761 runtime.documents.set(
20762 targetDocument,
20763 (runtime.documents.get(targetDocument) ?? 0) + 1
20764 );
20765 for (const [hash, css] of runtime.styles) {
20766 injectStyle19(targetDocument, hash, css);
20767 }
20768 return () => {
20769 const count = runtime.documents.get(targetDocument);
20770 if (count === void 0) {
20771 return;
20772 }
20773 if (count <= 1) {
20774 runtime.documents.delete(targetDocument);
20775 return;
20776 }
20777 runtime.documents.set(targetDocument, count - 1);
20778 };
20779 }
20780 function registerStyle19(hash, css) {
20781 const runtime = getRuntime19();
20782 runtime.styles.set(hash, css);
20783 for (const targetDocument of runtime.documents.keys()) {
20784 injectStyle19(targetDocument, hash, css);
20785 }
20786 }
20787 if (typeof process === "undefined" || true) {
20788 registerStyle19("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
20789 }
20790 var style_default18 = { "stack": "_19ce0419607e1896__stack" };
20791 var gapTokens = {
20792 xs: "var(--wpds-dimension-gap-xs, 4px)",
20793 sm: "var(--wpds-dimension-gap-sm, 8px)",
20794 md: "var(--wpds-dimension-gap-md, 12px)",
20795 lg: "var(--wpds-dimension-gap-lg, 16px)",
20796 xl: "var(--wpds-dimension-gap-xl, 24px)",
20797 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
20798 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
20799 };
20800 var Stack = (0, import_element44.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) {
20801 const style = {
20802 gap: gap && gapTokens[gap],
20803 alignItems: align,
20804 justifyContent: justify,
20805 flexDirection: direction,
20806 flexWrap: wrap
20807 };
20808 const element = useRender({
20809 render: render4,
20810 ref,
20811 props: mergeProps(props, { style, className: style_default18.stack })
20812 });
20813 return element;
20814 });
20815
20816 // packages/ui/build-module/form/primitives/input/input.mjs
20817 var import_element47 = __toESM(require_element(), 1);
20818
20819 // packages/ui/build-module/form/primitives/input-layout/input-layout.mjs
20820 var import_element45 = __toESM(require_element(), 1);
20821 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
20822 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash";
20823 function getRuntime20() {
20824 const globalScope = globalThis;
20825 if (globalScope.__wpStyleRuntime) {
20826 return globalScope.__wpStyleRuntime;
20827 }
20828 globalScope.__wpStyleRuntime = {
20829 documents: /* @__PURE__ */ new Map(),
20830 styles: /* @__PURE__ */ new Map(),
20831 injectedStyles: /* @__PURE__ */ new WeakMap()
20832 };
20833 if (typeof document !== "undefined") {
20834 registerDocument20(document);
20835 }
20836 return globalScope.__wpStyleRuntime;
20837 }
20838 function documentContainsStyleHash20(targetDocument, hash) {
20839 if (!targetDocument.head) {
20840 return false;
20841 }
20842 for (const style of targetDocument.head.querySelectorAll(
20843 `style[${STYLE_HASH_ATTRIBUTE20}]`
20844 )) {
20845 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) {
20846 return true;
20847 }
20848 }
20849 return false;
20850 }
20851 function injectStyle20(targetDocument, hash, css) {
20852 if (!targetDocument.head) {
20853 return;
20854 }
20855 const runtime = getRuntime20();
20856 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20857 if (!injectedStyles) {
20858 injectedStyles = /* @__PURE__ */ new Set();
20859 runtime.injectedStyles.set(targetDocument, injectedStyles);
20860 }
20861 if (injectedStyles.has(hash)) {
20862 return;
20863 }
20864 if (documentContainsStyleHash20(targetDocument, hash)) {
20865 injectedStyles.add(hash);
20866 return;
20867 }
20868 const style = targetDocument.createElement("style");
20869 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash);
20870 style.appendChild(targetDocument.createTextNode(css));
20871 targetDocument.head.appendChild(style);
20872 injectedStyles.add(hash);
20873 }
20874 function registerDocument20(targetDocument) {
20875 const runtime = getRuntime20();
20876 runtime.documents.set(
20877 targetDocument,
20878 (runtime.documents.get(targetDocument) ?? 0) + 1
20879 );
20880 for (const [hash, css] of runtime.styles) {
20881 injectStyle20(targetDocument, hash, css);
20882 }
20883 return () => {
20884 const count = runtime.documents.get(targetDocument);
20885 if (count === void 0) {
20886 return;
20887 }
20888 if (count <= 1) {
20889 runtime.documents.delete(targetDocument);
20890 return;
20891 }
20892 runtime.documents.set(targetDocument, count - 1);
20893 };
20894 }
20895 function registerStyle20(hash, css) {
20896 const runtime = getRuntime20();
20897 runtime.styles.set(hash, css);
20898 for (const targetDocument of runtime.documents.keys()) {
20899 injectStyle20(targetDocument, hash, css);
20900 }
20901 }
20902 if (typeof process === "undefined" || true) {
20903 registerStyle20("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
20904 }
20905 var global_css_defense_default6 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
20906 if (typeof process === "undefined" || true) {
20907 registerStyle20("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
20908 }
20909 var resets_default6 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
20910 if (typeof process === "undefined" || true) {
20911 registerStyle20("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display: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:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
20912 }
20913 var style_default19 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
20914 var InputLayout = (0, import_element45.forwardRef)(
20915 function InputLayout2({
20916 className,
20917 children,
20918 visuallyDisabled,
20919 size: size4 = "default",
20920 isBorderless,
20921 prefix: prefix2,
20922 suffix,
20923 ...restProps
20924 }, ref) {
20925 return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
20926 "div",
20927 {
20928 ref,
20929 className: clsx_default(
20930 global_css_defense_default6.div,
20931 resets_default6["box-sizing"],
20932 style_default19["input-layout"],
20933 style_default19[`is-size-${size4}`],
20934 visuallyDisabled && style_default19["is-disabled"],
20935 isBorderless && style_default19["is-borderless"],
20936 className
20937 ),
20938 ...restProps,
20939 children: [
20940 import_element45.Children.count(prefix2) > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
20941 "div",
20942 {
20943 className: style_default19["slot-wrapper"],
20944 "data-slot-type": "prefix",
20945 children: prefix2
20946 }
20947 ),
20948 children,
20949 import_element45.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
20950 "div",
20951 {
20952 className: style_default19["slot-wrapper"],
20953 "data-slot-type": "suffix",
20954 children: suffix
20955 }
20956 )
20957 ]
20958 }
20959 );
20960 }
20961 );
20962
20963 // packages/ui/build-module/form/primitives/input-layout/slot.mjs
20964 var import_element46 = __toESM(require_element(), 1);
20965 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
20966 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash";
20967 function getRuntime21() {
20968 const globalScope = globalThis;
20969 if (globalScope.__wpStyleRuntime) {
20970 return globalScope.__wpStyleRuntime;
20971 }
20972 globalScope.__wpStyleRuntime = {
20973 documents: /* @__PURE__ */ new Map(),
20974 styles: /* @__PURE__ */ new Map(),
20975 injectedStyles: /* @__PURE__ */ new WeakMap()
20976 };
20977 if (typeof document !== "undefined") {
20978 registerDocument21(document);
20979 }
20980 return globalScope.__wpStyleRuntime;
20981 }
20982 function documentContainsStyleHash21(targetDocument, hash) {
20983 if (!targetDocument.head) {
20984 return false;
20985 }
20986 for (const style of targetDocument.head.querySelectorAll(
20987 `style[${STYLE_HASH_ATTRIBUTE21}]`
20988 )) {
20989 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) {
20990 return true;
20991 }
20992 }
20993 return false;
20994 }
20995 function injectStyle21(targetDocument, hash, css) {
20996 if (!targetDocument.head) {
20997 return;
20998 }
20999 const runtime = getRuntime21();
21000 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21001 if (!injectedStyles) {
21002 injectedStyles = /* @__PURE__ */ new Set();
21003 runtime.injectedStyles.set(targetDocument, injectedStyles);
21004 }
21005 if (injectedStyles.has(hash)) {
21006 return;
21007 }
21008 if (documentContainsStyleHash21(targetDocument, hash)) {
21009 injectedStyles.add(hash);
21010 return;
21011 }
21012 const style = targetDocument.createElement("style");
21013 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash);
21014 style.appendChild(targetDocument.createTextNode(css));
21015 targetDocument.head.appendChild(style);
21016 injectedStyles.add(hash);
21017 }
21018 function registerDocument21(targetDocument) {
21019 const runtime = getRuntime21();
21020 runtime.documents.set(
21021 targetDocument,
21022 (runtime.documents.get(targetDocument) ?? 0) + 1
21023 );
21024 for (const [hash, css] of runtime.styles) {
21025 injectStyle21(targetDocument, hash, css);
21026 }
21027 return () => {
21028 const count = runtime.documents.get(targetDocument);
21029 if (count === void 0) {
21030 return;
21031 }
21032 if (count <= 1) {
21033 runtime.documents.delete(targetDocument);
21034 return;
21035 }
21036 runtime.documents.set(targetDocument, count - 1);
21037 };
21038 }
21039 function registerStyle21(hash, css) {
21040 const runtime = getRuntime21();
21041 runtime.styles.set(hash, css);
21042 for (const targetDocument of runtime.documents.keys()) {
21043 injectStyle21(targetDocument, hash, css);
21044 }
21045 }
21046 if (typeof process === "undefined" || true) {
21047 registerStyle21("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display: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:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
21048 }
21049 var style_default20 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
21050 var InputLayoutSlot = (0, import_element46.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) {
21051 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
21052 "div",
21053 {
21054 ref,
21055 className: clsx_default(
21056 style_default20["input-layout-slot"],
21057 style_default20[`is-padding-${padding}`],
21058 className
21059 ),
21060 ...restProps
21061 }
21062 );
21063 });
21064 InputLayoutSlot.displayName = "InputLayout.Slot";
21065
21066 // packages/ui/build-module/form/primitives/input-layout/index.mjs
21067 var InputLayout3 = Object.assign(InputLayout, {
21068 Slot: InputLayoutSlot
21069 });
21070
21071 // packages/ui/build-module/form/primitives/input/input.mjs
21072 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
21073 var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash";
21074 function getRuntime22() {
21075 const globalScope = globalThis;
21076 if (globalScope.__wpStyleRuntime) {
21077 return globalScope.__wpStyleRuntime;
21078 }
21079 globalScope.__wpStyleRuntime = {
21080 documents: /* @__PURE__ */ new Map(),
21081 styles: /* @__PURE__ */ new Map(),
21082 injectedStyles: /* @__PURE__ */ new WeakMap()
21083 };
21084 if (typeof document !== "undefined") {
21085 registerDocument22(document);
21086 }
21087 return globalScope.__wpStyleRuntime;
21088 }
21089 function documentContainsStyleHash22(targetDocument, hash) {
21090 if (!targetDocument.head) {
21091 return false;
21092 }
21093 for (const style of targetDocument.head.querySelectorAll(
21094 `style[${STYLE_HASH_ATTRIBUTE22}]`
21095 )) {
21096 if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) {
21097 return true;
21098 }
21099 }
21100 return false;
21101 }
21102 function injectStyle22(targetDocument, hash, css) {
21103 if (!targetDocument.head) {
21104 return;
21105 }
21106 const runtime = getRuntime22();
21107 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21108 if (!injectedStyles) {
21109 injectedStyles = /* @__PURE__ */ new Set();
21110 runtime.injectedStyles.set(targetDocument, injectedStyles);
21111 }
21112 if (injectedStyles.has(hash)) {
21113 return;
21114 }
21115 if (documentContainsStyleHash22(targetDocument, hash)) {
21116 injectedStyles.add(hash);
21117 return;
21118 }
21119 const style = targetDocument.createElement("style");
21120 style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash);
21121 style.appendChild(targetDocument.createTextNode(css));
21122 targetDocument.head.appendChild(style);
21123 injectedStyles.add(hash);
21124 }
21125 function registerDocument22(targetDocument) {
21126 const runtime = getRuntime22();
21127 runtime.documents.set(
21128 targetDocument,
21129 (runtime.documents.get(targetDocument) ?? 0) + 1
21130 );
21131 for (const [hash, css] of runtime.styles) {
21132 injectStyle22(targetDocument, hash, css);
21133 }
21134 return () => {
21135 const count = runtime.documents.get(targetDocument);
21136 if (count === void 0) {
21137 return;
21138 }
21139 if (count <= 1) {
21140 runtime.documents.delete(targetDocument);
21141 return;
21142 }
21143 runtime.documents.set(targetDocument, count - 1);
21144 };
21145 }
21146 function registerStyle22(hash, css) {
21147 const runtime = getRuntime22();
21148 runtime.styles.set(hash, css);
21149 for (const targetDocument of runtime.documents.keys()) {
21150 injectStyle22(targetDocument, hash, css);
21151 }
21152 }
21153 if (typeof process === "undefined" || true) {
21154 registerStyle22("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
21155 }
21156 var global_css_defense_default7 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
21157 if (typeof process === "undefined" || true) {
21158 registerStyle22("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
21159 }
21160 var focus_module_default5 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
21161 if (typeof process === "undefined" || true) {
21162 registerStyle22("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}");
21163 }
21164 var style_default21 = { "input": "_2ae7be2fc1bb17a3__input" };
21165 var Input3 = (0, import_element47.forwardRef)(function Input22({ className, size: size4 = "default", prefix: prefix2, suffix, style, ...restProps }, ref) {
21166 return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
21167 InputLayout3,
21168 {
21169 className: clsx_default(
21170 focus_module_default5["outset-ring--focus-within"],
21171 className
21172 ),
21173 style,
21174 size: size4,
21175 visuallyDisabled: restProps.disabled,
21176 prefix: prefix2,
21177 suffix,
21178 children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
21179 Input,
21180 {
21181 ref,
21182 className: clsx_default(global_css_defense_default7.input, style_default21.input),
21183 ...restProps
21184 }
21185 )
21186 }
21187 );
21188 });
21189
21190 // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs
21191 var import_i18n7 = __toESM(require_i18n(), 1);
21192 var import_element49 = __toESM(require_element(), 1);
21193
21194 // packages/ui/build-module/spinner/spinner.mjs
21195 var import_element48 = __toESM(require_element(), 1);
21196 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
21197 var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash";
21198 function getRuntime23() {
21199 const globalScope = globalThis;
21200 if (globalScope.__wpStyleRuntime) {
21201 return globalScope.__wpStyleRuntime;
21202 }
21203 globalScope.__wpStyleRuntime = {
21204 documents: /* @__PURE__ */ new Map(),
21205 styles: /* @__PURE__ */ new Map(),
21206 injectedStyles: /* @__PURE__ */ new WeakMap()
21207 };
21208 if (typeof document !== "undefined") {
21209 registerDocument23(document);
21210 }
21211 return globalScope.__wpStyleRuntime;
21212 }
21213 function documentContainsStyleHash23(targetDocument, hash) {
21214 if (!targetDocument.head) {
21215 return false;
21216 }
21217 for (const style of targetDocument.head.querySelectorAll(
21218 `style[${STYLE_HASH_ATTRIBUTE23}]`
21219 )) {
21220 if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) {
21221 return true;
21222 }
21223 }
21224 return false;
21225 }
21226 function injectStyle23(targetDocument, hash, css) {
21227 if (!targetDocument.head) {
21228 return;
21229 }
21230 const runtime = getRuntime23();
21231 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21232 if (!injectedStyles) {
21233 injectedStyles = /* @__PURE__ */ new Set();
21234 runtime.injectedStyles.set(targetDocument, injectedStyles);
21235 }
21236 if (injectedStyles.has(hash)) {
21237 return;
21238 }
21239 if (documentContainsStyleHash23(targetDocument, hash)) {
21240 injectedStyles.add(hash);
21241 return;
21242 }
21243 const style = targetDocument.createElement("style");
21244 style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash);
21245 style.appendChild(targetDocument.createTextNode(css));
21246 targetDocument.head.appendChild(style);
21247 injectedStyles.add(hash);
21248 }
21249 function registerDocument23(targetDocument) {
21250 const runtime = getRuntime23();
21251 runtime.documents.set(
21252 targetDocument,
21253 (runtime.documents.get(targetDocument) ?? 0) + 1
21254 );
21255 for (const [hash, css] of runtime.styles) {
21256 injectStyle23(targetDocument, hash, css);
21257 }
21258 return () => {
21259 const count = runtime.documents.get(targetDocument);
21260 if (count === void 0) {
21261 return;
21262 }
21263 if (count <= 1) {
21264 runtime.documents.delete(targetDocument);
21265 return;
21266 }
21267 runtime.documents.set(targetDocument, count - 1);
21268 };
21269 }
21270 function registerStyle23(hash, css) {
21271 const runtime = getRuntime23();
21272 runtime.styles.set(hash, css);
21273 for (const targetDocument of runtime.documents.keys()) {
21274 injectStyle23(targetDocument, hash, css);
21275 }
21276 }
21277 if (typeof process === "undefined" || true) {
21278 registerStyle23("bbbecfe373", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.ab4d64c07c0ba587__spinner{background-color:transparent;display:inline-block;height:var(--wpds-dimension-size-2xs,16px);opacity:1;overflow:visible;position:relative;width:var(--wpds-dimension-size-2xs,16px)}.a7654e10245bb7d2__indicator,.dc51f80c84b35fe2__track{fill:transparent;stroke-width:1.5px}.dc51f80c84b35fe2__track{stroke:var(--wpds-color-background-track-neutral,#dbdbdb)}.a7654e10245bb7d2__indicator{stroke:var(--wpds-color-background-thumb-brand,var(--wp-admin-theme-color,#3858e9));stroke-linecap:round;animation:_02322d973909703c__spinner-spin 1.4s linear infinite both;transform-origin:50% 50%}@keyframes _02322d973909703c__spinner-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}}}");
21279 }
21280 var style_default22 = { "spinner": "ab4d64c07c0ba587__spinner", "track": "dc51f80c84b35fe2__track", "indicator": "a7654e10245bb7d2__indicator", "spinner-spin": "_02322d973909703c__spinner-spin" };
21281 var Spinner = (0, import_element48.forwardRef)(
21282 function Spinner2({ className, ...props }, ref) {
21283 return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
21284 "svg",
21285 {
21286 className: clsx_default(style_default22.spinner, className),
21287 viewBox: "0 0 100 100",
21288 xmlns: "http://www.w3.org/2000/svg",
21289 role: "presentation",
21290 focusable: "false",
21291 ...props,
21292 ref,
21293 children: [
21294 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
21295 "circle",
21296 {
21297 className: style_default22.track,
21298 cx: "50",
21299 cy: "50",
21300 r: "50",
21301 vectorEffect: "non-scaling-stroke"
21302 }
21303 ),
21304 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
21305 "path",
21306 {
21307 className: style_default22.indicator,
21308 d: "m 50 0 a 50 50 0 0 1 50 50",
21309 vectorEffect: "non-scaling-stroke"
21310 }
21311 )
21312 ]
21313 }
21314 );
21315 }
21316 );
21317
21318 // packages/ui/build-module/form/primitives/validity-indicator/validity-indicator.mjs
21319 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
21320 var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash";
21321 function getRuntime24() {
21322 const globalScope = globalThis;
21323 if (globalScope.__wpStyleRuntime) {
21324 return globalScope.__wpStyleRuntime;
21325 }
21326 globalScope.__wpStyleRuntime = {
21327 documents: /* @__PURE__ */ new Map(),
21328 styles: /* @__PURE__ */ new Map(),
21329 injectedStyles: /* @__PURE__ */ new WeakMap()
21330 };
21331 if (typeof document !== "undefined") {
21332 registerDocument24(document);
21333 }
21334 return globalScope.__wpStyleRuntime;
21335 }
21336 function documentContainsStyleHash24(targetDocument, hash) {
21337 if (!targetDocument.head) {
21338 return false;
21339 }
21340 for (const style of targetDocument.head.querySelectorAll(
21341 `style[${STYLE_HASH_ATTRIBUTE24}]`
21342 )) {
21343 if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) {
21344 return true;
21345 }
21346 }
21347 return false;
21348 }
21349 function injectStyle24(targetDocument, hash, css) {
21350 if (!targetDocument.head) {
21351 return;
21352 }
21353 const runtime = getRuntime24();
21354 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21355 if (!injectedStyles) {
21356 injectedStyles = /* @__PURE__ */ new Set();
21357 runtime.injectedStyles.set(targetDocument, injectedStyles);
21358 }
21359 if (injectedStyles.has(hash)) {
21360 return;
21361 }
21362 if (documentContainsStyleHash24(targetDocument, hash)) {
21363 injectedStyles.add(hash);
21364 return;
21365 }
21366 const style = targetDocument.createElement("style");
21367 style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash);
21368 style.appendChild(targetDocument.createTextNode(css));
21369 targetDocument.head.appendChild(style);
21370 injectedStyles.add(hash);
21371 }
21372 function registerDocument24(targetDocument) {
21373 const runtime = getRuntime24();
21374 runtime.documents.set(
21375 targetDocument,
21376 (runtime.documents.get(targetDocument) ?? 0) + 1
21377 );
21378 for (const [hash, css] of runtime.styles) {
21379 injectStyle24(targetDocument, hash, css);
21380 }
21381 return () => {
21382 const count = runtime.documents.get(targetDocument);
21383 if (count === void 0) {
21384 return;
21385 }
21386 if (count <= 1) {
21387 runtime.documents.delete(targetDocument);
21388 return;
21389 }
21390 runtime.documents.set(targetDocument, count - 1);
21391 };
21392 }
21393 function registerStyle24(hash, css) {
21394 const runtime = getRuntime24();
21395 runtime.styles.set(hash, css);
21396 for (const targetDocument of runtime.documents.keys()) {
21397 injectStyle24(targetDocument, hash, css);
21398 }
21399 }
21400 if (typeof process === "undefined" || true) {
21401 registerStyle24("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
21402 }
21403 var global_css_defense_default8 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
21404 if (typeof process === "undefined" || true) {
21405 registerStyle24("d11816833c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7a7ac88e306348e7__indicator{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);align-items:flex-start;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display: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(--wpds-typography-font-size-sm,12px);gap:var(--wpds-dimension-gap-xs,4px);line-height:var(--wpds-typography-line-height-xs,16px);@media not (prefers-reduced-motion){animation:_48722cc5dd090ce4__indicator-jump var(--wpds-motion-duration-md,.2s) cubic-bezier(.68,-.55,.27,1.55)}}._57a3bbbfbe38a5c6__is-invalid{color:var(--wpds-color-foreground-content-error-weak,#cc1818)}._9e944dc198aac10b__is-valid{color:var(--wpds-color-foreground-content-success-weak,#008030)}.e482806667437c6a__indicator-icon{flex-shrink:0}._6e46434cc23019d2__indicator-spinner{height:var(--wpds-dimension-size-3xs,12px);margin:2px;width:var(--wpds-dimension-size-3xs,12px)}@keyframes _48722cc5dd090ce4__indicator-jump{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}}}');
21406 }
21407 var style_default23 = { "indicator": "_7a7ac88e306348e7__indicator", "indicator-jump": "_48722cc5dd090ce4__indicator-jump", "is-invalid": "_57a3bbbfbe38a5c6__is-invalid", "is-valid": "_9e944dc198aac10b__is-valid", "indicator-icon": "e482806667437c6a__indicator-icon", "indicator-spinner": "_6e46434cc23019d2__indicator-spinner" };
21408 var ICON = {
21409 valid: published_default,
21410 invalid: error_default
21411 };
21412 function ValidityIndicator({
21413 id,
21414 type,
21415 message: message2
21416 }) {
21417 return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
21418 "p",
21419 {
21420 id,
21421 className: clsx_default(
21422 global_css_defense_default8.p,
21423 style_default23.indicator,
21424 style_default23[`is-${type}`]
21425 ),
21426 children: [
21427 type === "validating" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Spinner, { className: style_default23["indicator-spinner"] }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
21428 Icon,
21429 {
21430 className: style_default23["indicator-icon"],
21431 icon: ICON[type],
21432 size: 16,
21433 fill: "currentColor"
21434 }
21435 ),
21436 message2
21437 ]
21438 }
21439 );
21440 }
21441
21442 // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs
21443 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
21444 var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Stack, { ...props, direction: "column", gap: "sm" });
21445 function appendRequiredIndicator(label, required, markWhenOptional) {
21446 let suffix;
21447 if (required && !markWhenOptional) {
21448 suffix = `(${(0, import_i18n7.__)("Required")})`;
21449 } else if (!required && markWhenOptional) {
21450 suffix = `(${(0, import_i18n7.__)("Optional")})`;
21451 }
21452 if (!suffix) {
21453 return label;
21454 }
21455 if (typeof label === "string") {
21456 return `${label} ${suffix}`;
21457 }
21458 return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
21459 label,
21460 " ",
21461 suffix
21462 ] });
21463 }
21464 var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible";
21465 var ControlWithError = (0, import_element49.forwardRef)(function ControlWithError2({
21466 required,
21467 markWhenOptional,
21468 customValidity,
21469 getValidityTarget,
21470 children,
21471 render: render4 = DEFAULT_RENDER,
21472 ...restProps
21473 }, forwardedRef) {
21474 const [errorMessage, setErrorMessage] = (0, import_element49.useState)();
21475 const [statusMessage, setStatusMessage] = (0, import_element49.useState)();
21476 const [showMessage, setShowMessage] = (0, import_element49.useState)(false);
21477 const [isTouched, setIsTouched] = (0, import_element49.useState)(false);
21478 const wrapperRef = (0, import_element49.useRef)(null);
21479 (0, import_element49.useEffect)(() => {
21480 const validityTarget = getValidityTarget();
21481 const handler = () => {
21482 if (customValidity?.type !== "validating") {
21483 setErrorMessage(validityTarget?.validationMessage);
21484 }
21485 setShowMessage(true);
21486 validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
21487 };
21488 validityTarget?.addEventListener("invalid", handler);
21489 return () => validityTarget?.removeEventListener("invalid", handler);
21490 }, [customValidity?.type, getValidityTarget]);
21491 (0, import_element49.useEffect)(() => {
21492 const validityTarget = getValidityTarget();
21493 const suppressNativePopover = (event) => {
21494 event.preventDefault();
21495 if (!event.isTrusted) {
21496 return;
21497 }
21498 const target = event.target;
21499 const firstErrorInForm = Array.from(
21500 target.form?.elements ?? []
21501 ).find((el) => !el.validity.valid);
21502 if (!target.form || firstErrorInForm === target) {
21503 target.focus();
21504 }
21505 };
21506 const radioSiblings = validityTarget?.type === "radio" && validityTarget?.name ? Array.from(
21507 wrapperRef.current?.querySelectorAll(
21508 `input[type="radio"][name="${validityTarget?.name}"]`
21509 ) ?? []
21510 ).filter((sibling) => sibling !== validityTarget) : [];
21511 validityTarget?.addEventListener("invalid", suppressNativePopover);
21512 radioSiblings.forEach(
21513 (sibling) => sibling.addEventListener("invalid", suppressNativePopover)
21514 );
21515 return () => {
21516 validityTarget?.removeEventListener(
21517 "invalid",
21518 suppressNativePopover
21519 );
21520 radioSiblings.forEach(
21521 (sibling) => sibling.removeEventListener("invalid", suppressNativePopover)
21522 );
21523 };
21524 }, [getValidityTarget]);
21525 (0, import_element49.useEffect)(() => {
21526 const validityTarget = getValidityTarget();
21527 if (!customValidity?.type) {
21528 validityTarget?.setCustomValidity("");
21529 setErrorMessage(validityTarget?.validationMessage);
21530 setStatusMessage(void 0);
21531 return;
21532 }
21533 switch (customValidity.type) {
21534 case "validating": {
21535 validityTarget?.setCustomValidity("");
21536 setErrorMessage(void 0);
21537 setStatusMessage({
21538 type: "validating",
21539 message: customValidity.message
21540 });
21541 break;
21542 }
21543 case "valid": {
21544 validityTarget?.setCustomValidity("");
21545 setErrorMessage(validityTarget?.validationMessage);
21546 setStatusMessage({
21547 type: "valid",
21548 message: customValidity.message
21549 });
21550 break;
21551 }
21552 case "invalid": {
21553 validityTarget?.setCustomValidity(
21554 customValidity.message ?? ""
21555 );
21556 setErrorMessage(validityTarget?.validationMessage);
21557 setStatusMessage(void 0);
21558 break;
21559 }
21560 }
21561 }, [customValidity, getValidityTarget]);
21562 (0, import_element49.useEffect)(() => {
21563 if (!isTouched || showMessage) {
21564 return;
21565 }
21566 if (customValidity?.type === "validating") {
21567 const timer = setTimeout(() => {
21568 setShowMessage(true);
21569 }, 1e3);
21570 return () => clearTimeout(timer);
21571 }
21572 setShowMessage(true);
21573 }, [isTouched, customValidity?.type, showMessage]);
21574 const onBlur = (event) => {
21575 if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
21576 return;
21577 }
21578 if (!isTouched) {
21579 setIsTouched(true);
21580 getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
21581 }
21582 const validityTarget = getValidityTarget();
21583 const isValidating = customValidity?.type === "validating";
21584 window.queueMicrotask(() => {
21585 if (!isValidating) {
21586 setErrorMessage(validityTarget?.validationMessage);
21587 }
21588 });
21589 };
21590 const messageId = (0, import_element49.useId)();
21591 const message2 = (() => {
21592 if (errorMessage) {
21593 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
21594 ValidityIndicator,
21595 {
21596 id: messageId,
21597 type: "invalid",
21598 message: errorMessage
21599 }
21600 );
21601 }
21602 if (statusMessage?.type) {
21603 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
21604 ValidityIndicator,
21605 {
21606 id: messageId,
21607 type: statusMessage.type,
21608 message: statusMessage.message
21609 }
21610 );
21611 }
21612 return null;
21613 })();
21614 const visibleMessage = showMessage ? message2 : null;
21615 (0, import_element49.useEffect)(() => {
21616 const target = getValidityTarget();
21617 if (!target) {
21618 return;
21619 }
21620 function setDescribedBy(el, shouldAdd) {
21621 const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((id) => id && id !== messageId);
21622 if (shouldAdd) {
21623 ids.push(messageId);
21624 }
21625 if (ids.length) {
21626 el.setAttribute("aria-describedby", ids.join(" "));
21627 } else {
21628 el.removeAttribute("aria-describedby");
21629 }
21630 }
21631 setDescribedBy(target, !!visibleMessage);
21632 return () => setDescribedBy(target, false);
21633 }, [visibleMessage, messageId, getValidityTarget]);
21634 return useRender({
21635 render: render4,
21636 ref: [forwardedRef, wrapperRef],
21637 props: mergeProps(restProps, {
21638 onBlur,
21639 children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
21640 (0, import_element49.cloneElement)(children, {
21641 label: appendRequiredIndicator(
21642 children.props.label,
21643 required,
21644 markWhenOptional
21645 ),
21646 required
21647 }),
21648 visibleMessage
21649 ] })
21650 })
21651 });
21652 });
21653
21654 // packages/ui/build-module/form/primitives/field/index.mjs
21655 var field_exports = {};
21656 __export(field_exports, {
21657 Control: () => Control,
21658 Description: () => Description,
21659 Details: () => Details,
21660 Item: () => Item,
21661 Label: () => Label,
21662 Root: () => Root6,
21663 VisualLabel: () => VisualLabel
21664 });
21665
21666 // packages/ui/build-module/form/primitives/field/root.mjs
21667 var import_element50 = __toESM(require_element(), 1);
21668 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
21669 var STYLE_HASH_ATTRIBUTE25 = "data-wp-hash";
21670 function getRuntime25() {
21671 const globalScope = globalThis;
21672 if (globalScope.__wpStyleRuntime) {
21673 return globalScope.__wpStyleRuntime;
21674 }
21675 globalScope.__wpStyleRuntime = {
21676 documents: /* @__PURE__ */ new Map(),
21677 styles: /* @__PURE__ */ new Map(),
21678 injectedStyles: /* @__PURE__ */ new WeakMap()
21679 };
21680 if (typeof document !== "undefined") {
21681 registerDocument25(document);
21682 }
21683 return globalScope.__wpStyleRuntime;
21684 }
21685 function documentContainsStyleHash25(targetDocument, hash) {
21686 if (!targetDocument.head) {
21687 return false;
21688 }
21689 for (const style of targetDocument.head.querySelectorAll(
21690 `style[${STYLE_HASH_ATTRIBUTE25}]`
21691 )) {
21692 if (style.getAttribute(STYLE_HASH_ATTRIBUTE25) === hash) {
21693 return true;
21694 }
21695 }
21696 return false;
21697 }
21698 function injectStyle25(targetDocument, hash, css) {
21699 if (!targetDocument.head) {
21700 return;
21701 }
21702 const runtime = getRuntime25();
21703 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21704 if (!injectedStyles) {
21705 injectedStyles = /* @__PURE__ */ new Set();
21706 runtime.injectedStyles.set(targetDocument, injectedStyles);
21707 }
21708 if (injectedStyles.has(hash)) {
21709 return;
21710 }
21711 if (documentContainsStyleHash25(targetDocument, hash)) {
21712 injectedStyles.add(hash);
21713 return;
21714 }
21715 const style = targetDocument.createElement("style");
21716 style.setAttribute(STYLE_HASH_ATTRIBUTE25, hash);
21717 style.appendChild(targetDocument.createTextNode(css));
21718 targetDocument.head.appendChild(style);
21719 injectedStyles.add(hash);
21720 }
21721 function registerDocument25(targetDocument) {
21722 const runtime = getRuntime25();
21723 runtime.documents.set(
21724 targetDocument,
21725 (runtime.documents.get(targetDocument) ?? 0) + 1
21726 );
21727 for (const [hash, css] of runtime.styles) {
21728 injectStyle25(targetDocument, hash, css);
21729 }
21730 return () => {
21731 const count = runtime.documents.get(targetDocument);
21732 if (count === void 0) {
21733 return;
21734 }
21735 if (count <= 1) {
21736 runtime.documents.delete(targetDocument);
21737 return;
21738 }
21739 runtime.documents.set(targetDocument, count - 1);
21740 };
21741 }
21742 function registerStyle25(hash, css) {
21743 const runtime = getRuntime25();
21744 runtime.styles.set(hash, css);
21745 for (const targetDocument of runtime.documents.keys()) {
21746 injectStyle25(targetDocument, hash, css);
21747 }
21748 }
21749 if (typeof process === "undefined" || true) {
21750 registerStyle25("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
21751 }
21752 var resets_default7 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
21753 var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Stack, { ...props, direction: "column", gap: "sm" });
21754 var Root6 = (0, import_element50.forwardRef)(function Root22({ className, render: render4 = DEFAULT_RENDER2, ...restProps }, ref) {
21755 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
21756 index_parts_exports2.Root,
21757 {
21758 ref,
21759 className: clsx_default(resets_default7["box-sizing"], className),
21760 render: render4,
21761 ...restProps
21762 }
21763 );
21764 });
21765
21766 // packages/ui/build-module/form/primitives/field/item.mjs
21767 var import_element51 = __toESM(require_element(), 1);
21768 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
21769 var Item = (0, import_element51.forwardRef)(function Item2(props, ref) {
21770 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(index_parts_exports2.Item, { ref, ...props });
21771 });
21772
21773 // packages/ui/build-module/form/primitives/field/label.mjs
21774 var import_element52 = __toESM(require_element(), 1);
21775 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
21776 var STYLE_HASH_ATTRIBUTE26 = "data-wp-hash";
21777 function getRuntime26() {
21778 const globalScope = globalThis;
21779 if (globalScope.__wpStyleRuntime) {
21780 return globalScope.__wpStyleRuntime;
21781 }
21782 globalScope.__wpStyleRuntime = {
21783 documents: /* @__PURE__ */ new Map(),
21784 styles: /* @__PURE__ */ new Map(),
21785 injectedStyles: /* @__PURE__ */ new WeakMap()
21786 };
21787 if (typeof document !== "undefined") {
21788 registerDocument26(document);
21789 }
21790 return globalScope.__wpStyleRuntime;
21791 }
21792 function documentContainsStyleHash26(targetDocument, hash) {
21793 if (!targetDocument.head) {
21794 return false;
21795 }
21796 for (const style of targetDocument.head.querySelectorAll(
21797 `style[${STYLE_HASH_ATTRIBUTE26}]`
21798 )) {
21799 if (style.getAttribute(STYLE_HASH_ATTRIBUTE26) === hash) {
21800 return true;
21801 }
21802 }
21803 return false;
21804 }
21805 function injectStyle26(targetDocument, hash, css) {
21806 if (!targetDocument.head) {
21807 return;
21808 }
21809 const runtime = getRuntime26();
21810 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21811 if (!injectedStyles) {
21812 injectedStyles = /* @__PURE__ */ new Set();
21813 runtime.injectedStyles.set(targetDocument, injectedStyles);
21814 }
21815 if (injectedStyles.has(hash)) {
21816 return;
21817 }
21818 if (documentContainsStyleHash26(targetDocument, hash)) {
21819 injectedStyles.add(hash);
21820 return;
21821 }
21822 const style = targetDocument.createElement("style");
21823 style.setAttribute(STYLE_HASH_ATTRIBUTE26, hash);
21824 style.appendChild(targetDocument.createTextNode(css));
21825 targetDocument.head.appendChild(style);
21826 injectedStyles.add(hash);
21827 }
21828 function registerDocument26(targetDocument) {
21829 const runtime = getRuntime26();
21830 runtime.documents.set(
21831 targetDocument,
21832 (runtime.documents.get(targetDocument) ?? 0) + 1
21833 );
21834 for (const [hash, css] of runtime.styles) {
21835 injectStyle26(targetDocument, hash, css);
21836 }
21837 return () => {
21838 const count = runtime.documents.get(targetDocument);
21839 if (count === void 0) {
21840 return;
21841 }
21842 if (count <= 1) {
21843 runtime.documents.delete(targetDocument);
21844 return;
21845 }
21846 runtime.documents.set(targetDocument, count - 1);
21847 };
21848 }
21849 function registerStyle26(hash, css) {
21850 const runtime = getRuntime26();
21851 runtime.styles.set(hash, css);
21852 for (const targetDocument of runtime.documents.keys()) {
21853 injectStyle26(targetDocument, hash, css);
21854 }
21855 }
21856 if (typeof process === "undefined" || true) {
21857 registerStyle26("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}');
21858 }
21859 var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
21860 var Label = (0, import_element52.forwardRef)(
21861 function Label2({ className, hideFromVision, variant, ...restProps }, ref) {
21862 const label = /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
21863 index_parts_exports2.Label,
21864 {
21865 ref,
21866 className: clsx_default(
21867 field_default.label,
21868 variant && field_default[`is-${variant}`],
21869 className
21870 ),
21871 ...restProps
21872 }
21873 );
21874 if (hideFromVision) {
21875 return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(VisuallyHidden, { render: label });
21876 }
21877 return label;
21878 }
21879 );
21880
21881 // packages/ui/build-module/form/primitives/field/description.mjs
21882 var import_element53 = __toESM(require_element(), 1);
21883 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
21884 var STYLE_HASH_ATTRIBUTE27 = "data-wp-hash";
21885 function getRuntime27() {
21886 const globalScope = globalThis;
21887 if (globalScope.__wpStyleRuntime) {
21888 return globalScope.__wpStyleRuntime;
21889 }
21890 globalScope.__wpStyleRuntime = {
21891 documents: /* @__PURE__ */ new Map(),
21892 styles: /* @__PURE__ */ new Map(),
21893 injectedStyles: /* @__PURE__ */ new WeakMap()
21894 };
21895 if (typeof document !== "undefined") {
21896 registerDocument27(document);
21897 }
21898 return globalScope.__wpStyleRuntime;
21899 }
21900 function documentContainsStyleHash27(targetDocument, hash) {
21901 if (!targetDocument.head) {
21902 return false;
21903 }
21904 for (const style of targetDocument.head.querySelectorAll(
21905 `style[${STYLE_HASH_ATTRIBUTE27}]`
21906 )) {
21907 if (style.getAttribute(STYLE_HASH_ATTRIBUTE27) === hash) {
21908 return true;
21909 }
21910 }
21911 return false;
21912 }
21913 function injectStyle27(targetDocument, hash, css) {
21914 if (!targetDocument.head) {
21915 return;
21916 }
21917 const runtime = getRuntime27();
21918 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21919 if (!injectedStyles) {
21920 injectedStyles = /* @__PURE__ */ new Set();
21921 runtime.injectedStyles.set(targetDocument, injectedStyles);
21922 }
21923 if (injectedStyles.has(hash)) {
21924 return;
21925 }
21926 if (documentContainsStyleHash27(targetDocument, hash)) {
21927 injectedStyles.add(hash);
21928 return;
21929 }
21930 const style = targetDocument.createElement("style");
21931 style.setAttribute(STYLE_HASH_ATTRIBUTE27, hash);
21932 style.appendChild(targetDocument.createTextNode(css));
21933 targetDocument.head.appendChild(style);
21934 injectedStyles.add(hash);
21935 }
21936 function registerDocument27(targetDocument) {
21937 const runtime = getRuntime27();
21938 runtime.documents.set(
21939 targetDocument,
21940 (runtime.documents.get(targetDocument) ?? 0) + 1
21941 );
21942 for (const [hash, css] of runtime.styles) {
21943 injectStyle27(targetDocument, hash, css);
21944 }
21945 return () => {
21946 const count = runtime.documents.get(targetDocument);
21947 if (count === void 0) {
21948 return;
21949 }
21950 if (count <= 1) {
21951 runtime.documents.delete(targetDocument);
21952 return;
21953 }
21954 runtime.documents.set(targetDocument, count - 1);
21955 };
21956 }
21957 function registerStyle27(hash, css) {
21958 const runtime = getRuntime27();
21959 runtime.styles.set(hash, css);
21960 for (const targetDocument of runtime.documents.keys()) {
21961 injectStyle27(targetDocument, hash, css);
21962 }
21963 }
21964 if (typeof process === "undefined" || true) {
21965 registerStyle27("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
21966 }
21967 var global_css_defense_default9 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
21968 if (typeof process === "undefined" || true) {
21969 registerStyle27("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}');
21970 }
21971 var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
21972 var Description = (0, import_element53.forwardRef)(function Description2({ className, ...restProps }, ref) {
21973 return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
21974 index_parts_exports2.Description,
21975 {
21976 ref,
21977 className: clsx_default(
21978 global_css_defense_default9.p,
21979 field_default2.description,
21980 className
21981 ),
21982 ...restProps
21983 }
21984 );
21985 });
21986
21987 // packages/ui/build-module/form/primitives/field/details.mjs
21988 var import_element54 = __toESM(require_element(), 1);
21989 var import_i18n8 = __toESM(require_i18n(), 1);
21990 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
21991 var STYLE_HASH_ATTRIBUTE28 = "data-wp-hash";
21992 function getRuntime28() {
21993 const globalScope = globalThis;
21994 if (globalScope.__wpStyleRuntime) {
21995 return globalScope.__wpStyleRuntime;
21996 }
21997 globalScope.__wpStyleRuntime = {
21998 documents: /* @__PURE__ */ new Map(),
21999 styles: /* @__PURE__ */ new Map(),
22000 injectedStyles: /* @__PURE__ */ new WeakMap()
22001 };
22002 if (typeof document !== "undefined") {
22003 registerDocument28(document);
22004 }
22005 return globalScope.__wpStyleRuntime;
22006 }
22007 function documentContainsStyleHash28(targetDocument, hash) {
22008 if (!targetDocument.head) {
22009 return false;
22010 }
22011 for (const style of targetDocument.head.querySelectorAll(
22012 `style[${STYLE_HASH_ATTRIBUTE28}]`
22013 )) {
22014 if (style.getAttribute(STYLE_HASH_ATTRIBUTE28) === hash) {
22015 return true;
22016 }
22017 }
22018 return false;
22019 }
22020 function injectStyle28(targetDocument, hash, css) {
22021 if (!targetDocument.head) {
22022 return;
22023 }
22024 const runtime = getRuntime28();
22025 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22026 if (!injectedStyles) {
22027 injectedStyles = /* @__PURE__ */ new Set();
22028 runtime.injectedStyles.set(targetDocument, injectedStyles);
22029 }
22030 if (injectedStyles.has(hash)) {
22031 return;
22032 }
22033 if (documentContainsStyleHash28(targetDocument, hash)) {
22034 injectedStyles.add(hash);
22035 return;
22036 }
22037 const style = targetDocument.createElement("style");
22038 style.setAttribute(STYLE_HASH_ATTRIBUTE28, hash);
22039 style.appendChild(targetDocument.createTextNode(css));
22040 targetDocument.head.appendChild(style);
22041 injectedStyles.add(hash);
22042 }
22043 function registerDocument28(targetDocument) {
22044 const runtime = getRuntime28();
22045 runtime.documents.set(
22046 targetDocument,
22047 (runtime.documents.get(targetDocument) ?? 0) + 1
22048 );
22049 for (const [hash, css] of runtime.styles) {
22050 injectStyle28(targetDocument, hash, css);
22051 }
22052 return () => {
22053 const count = runtime.documents.get(targetDocument);
22054 if (count === void 0) {
22055 return;
22056 }
22057 if (count <= 1) {
22058 runtime.documents.delete(targetDocument);
22059 return;
22060 }
22061 runtime.documents.set(targetDocument, count - 1);
22062 };
22063 }
22064 function registerStyle28(hash, css) {
22065 const runtime = getRuntime28();
22066 runtime.styles.set(hash, css);
22067 for (const targetDocument of runtime.documents.keys()) {
22068 injectStyle28(targetDocument, hash, css);
22069 }
22070 }
22071 if (typeof process === "undefined" || true) {
22072 registerStyle28("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}');
22073 }
22074 var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
22075 var Details = (0, import_element54.forwardRef)(
22076 function Details2({ className, ...restProps }, ref) {
22077 return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
22078 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(index_parts_exports2.Description, {}), children: (0, import_i18n8.__)("More details follow the field.") }),
22079 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
22080 "div",
22081 {
22082 ref,
22083 className: clsx_default(field_default3.description, className),
22084 ...restProps
22085 }
22086 )
22087 ] });
22088 }
22089 );
22090
22091 // packages/ui/build-module/form/primitives/field/control.mjs
22092 var import_element55 = __toESM(require_element(), 1);
22093 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
22094 var Control = (0, import_element55.forwardRef)(
22095 function Control2(props, ref) {
22096 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(index_parts_exports2.Control, { ref, ...props });
22097 }
22098 );
22099
22100 // packages/ui/build-module/form/primitives/field/visual-label.mjs
22101 var import_element56 = __toESM(require_element(), 1);
22102 var STYLE_HASH_ATTRIBUTE29 = "data-wp-hash";
22103 function getRuntime29() {
22104 const globalScope = globalThis;
22105 if (globalScope.__wpStyleRuntime) {
22106 return globalScope.__wpStyleRuntime;
22107 }
22108 globalScope.__wpStyleRuntime = {
22109 documents: /* @__PURE__ */ new Map(),
22110 styles: /* @__PURE__ */ new Map(),
22111 injectedStyles: /* @__PURE__ */ new WeakMap()
22112 };
22113 if (typeof document !== "undefined") {
22114 registerDocument29(document);
22115 }
22116 return globalScope.__wpStyleRuntime;
22117 }
22118 function documentContainsStyleHash29(targetDocument, hash) {
22119 if (!targetDocument.head) {
22120 return false;
22121 }
22122 for (const style of targetDocument.head.querySelectorAll(
22123 `style[${STYLE_HASH_ATTRIBUTE29}]`
22124 )) {
22125 if (style.getAttribute(STYLE_HASH_ATTRIBUTE29) === hash) {
22126 return true;
22127 }
22128 }
22129 return false;
22130 }
22131 function injectStyle29(targetDocument, hash, css) {
22132 if (!targetDocument.head) {
22133 return;
22134 }
22135 const runtime = getRuntime29();
22136 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22137 if (!injectedStyles) {
22138 injectedStyles = /* @__PURE__ */ new Set();
22139 runtime.injectedStyles.set(targetDocument, injectedStyles);
22140 }
22141 if (injectedStyles.has(hash)) {
22142 return;
22143 }
22144 if (documentContainsStyleHash29(targetDocument, hash)) {
22145 injectedStyles.add(hash);
22146 return;
22147 }
22148 const style = targetDocument.createElement("style");
22149 style.setAttribute(STYLE_HASH_ATTRIBUTE29, hash);
22150 style.appendChild(targetDocument.createTextNode(css));
22151 targetDocument.head.appendChild(style);
22152 injectedStyles.add(hash);
22153 }
22154 function registerDocument29(targetDocument) {
22155 const runtime = getRuntime29();
22156 runtime.documents.set(
22157 targetDocument,
22158 (runtime.documents.get(targetDocument) ?? 0) + 1
22159 );
22160 for (const [hash, css] of runtime.styles) {
22161 injectStyle29(targetDocument, hash, css);
22162 }
22163 return () => {
22164 const count = runtime.documents.get(targetDocument);
22165 if (count === void 0) {
22166 return;
22167 }
22168 if (count <= 1) {
22169 runtime.documents.delete(targetDocument);
22170 return;
22171 }
22172 runtime.documents.set(targetDocument, count - 1);
22173 };
22174 }
22175 function registerStyle29(hash, css) {
22176 const runtime = getRuntime29();
22177 runtime.styles.set(hash, css);
22178 for (const targetDocument of runtime.documents.keys()) {
22179 injectStyle29(targetDocument, hash, css);
22180 }
22181 }
22182 if (typeof process === "undefined" || true) {
22183 registerStyle29("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}');
22184 }
22185 var field_default4 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
22186 var VisualLabel = (0, import_element56.forwardRef)(
22187 function VisualLabel2({ className, render: render4, variant, ...restProps }, ref) {
22188 return useRender({
22189 defaultTagName: "span",
22190 render: render4,
22191 ref,
22192 props: mergeProps(restProps, {
22193 className: clsx_default(
22194 field_default4.label,
22195 variant && field_default4[`is-${variant}`],
22196 className
22197 )
22198 })
22199 });
22200 }
22201 );
22202 VisualLabel.displayName = "Field.VisualLabel";
22203
22204 // packages/ui/build-module/form/primitives/textarea/textarea.mjs
22205 var import_element57 = __toESM(require_element(), 1);
22206 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
22207 var STYLE_HASH_ATTRIBUTE30 = "data-wp-hash";
22208 function getRuntime30() {
22209 const globalScope = globalThis;
22210 if (globalScope.__wpStyleRuntime) {
22211 return globalScope.__wpStyleRuntime;
22212 }
22213 globalScope.__wpStyleRuntime = {
22214 documents: /* @__PURE__ */ new Map(),
22215 styles: /* @__PURE__ */ new Map(),
22216 injectedStyles: /* @__PURE__ */ new WeakMap()
22217 };
22218 if (typeof document !== "undefined") {
22219 registerDocument30(document);
22220 }
22221 return globalScope.__wpStyleRuntime;
22222 }
22223 function documentContainsStyleHash30(targetDocument, hash) {
22224 if (!targetDocument.head) {
22225 return false;
22226 }
22227 for (const style of targetDocument.head.querySelectorAll(
22228 `style[${STYLE_HASH_ATTRIBUTE30}]`
22229 )) {
22230 if (style.getAttribute(STYLE_HASH_ATTRIBUTE30) === hash) {
22231 return true;
22232 }
22233 }
22234 return false;
22235 }
22236 function injectStyle30(targetDocument, hash, css) {
22237 if (!targetDocument.head) {
22238 return;
22239 }
22240 const runtime = getRuntime30();
22241 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22242 if (!injectedStyles) {
22243 injectedStyles = /* @__PURE__ */ new Set();
22244 runtime.injectedStyles.set(targetDocument, injectedStyles);
22245 }
22246 if (injectedStyles.has(hash)) {
22247 return;
22248 }
22249 if (documentContainsStyleHash30(targetDocument, hash)) {
22250 injectedStyles.add(hash);
22251 return;
22252 }
22253 const style = targetDocument.createElement("style");
22254 style.setAttribute(STYLE_HASH_ATTRIBUTE30, hash);
22255 style.appendChild(targetDocument.createTextNode(css));
22256 targetDocument.head.appendChild(style);
22257 injectedStyles.add(hash);
22258 }
22259 function registerDocument30(targetDocument) {
22260 const runtime = getRuntime30();
22261 runtime.documents.set(
22262 targetDocument,
22263 (runtime.documents.get(targetDocument) ?? 0) + 1
22264 );
22265 for (const [hash, css] of runtime.styles) {
22266 injectStyle30(targetDocument, hash, css);
22267 }
22268 return () => {
22269 const count = runtime.documents.get(targetDocument);
22270 if (count === void 0) {
22271 return;
22272 }
22273 if (count <= 1) {
22274 runtime.documents.delete(targetDocument);
22275 return;
22276 }
22277 runtime.documents.set(targetDocument, count - 1);
22278 };
22279 }
22280 function registerStyle30(hash, css) {
22281 const runtime = getRuntime30();
22282 runtime.styles.set(hash, css);
22283 for (const targetDocument of runtime.documents.keys()) {
22284 injectStyle30(targetDocument, hash, css);
22285 }
22286 }
22287 if (typeof process === "undefined" || true) {
22288 registerStyle30("1540cbc709", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._1e441c22c9dc5d28__wrapper{--wp-ui-textarea-min-height:var(--wpds-dimension-size-lg,40px)}._414844876c32ecee__textarea{min-height:calc(var(--wp-ui-textarea-min-height) - 2px);resize:block}}@layer compositions{._1e441c22c9dc5d28__wrapper{--wp-ui-input-padding-block:9.9px;height:auto;line-height:1.4}}}");
22289 }
22290 var style_default24 = { "wrapper": "_1e441c22c9dc5d28__wrapper", "textarea": "_414844876c32ecee__textarea" };
22291 if (typeof process === "undefined" || true) {
22292 registerStyle30("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-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,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-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 transparent)}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-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));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 transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
22293 }
22294 var global_css_defense_default10 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
22295 var wrappedRender = (render4, restProps) => {
22296 return function textareaRender(props) {
22297 return typeof render4 === "function" ? render4(mergeProps(props, restProps)) : (0, import_element57.cloneElement)(render4, mergeProps(props, restProps));
22298 };
22299 };
22300 var Textarea = (0, import_element57.forwardRef)(
22301 function Textarea2({
22302 className,
22303 defaultValue,
22304 disabled: disabled2,
22305 onValueChange,
22306 render: render4,
22307 rows = 4,
22308 style,
22309 value,
22310 ...restProps
22311 }, ref) {
22312 return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
22313 Input3,
22314 {
22315 className: clsx_default(style_default24.wrapper, className),
22316 style,
22317 render: wrappedRender(
22318 render4 || ((props) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("textarea", { ...props })),
22319 {
22320 className: clsx_default(
22321 global_css_defense_default10.textarea,
22322 style_default24.textarea
22323 ),
22324 ref,
22325 rows,
22326 ...restProps
22327 }
22328 ),
22329 value,
22330 defaultValue,
22331 onValueChange,
22332 disabled: disabled2
22333 }
22334 );
22335 }
22336 );
22337
22338 // packages/ui/build-module/form/input-control/input-control.mjs
22339 var import_element58 = __toESM(require_element(), 1);
22340 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
22341 var STYLE_HASH_ATTRIBUTE31 = "data-wp-hash";
22342 function getRuntime31() {
22343 const globalScope = globalThis;
22344 if (globalScope.__wpStyleRuntime) {
22345 return globalScope.__wpStyleRuntime;
22346 }
22347 globalScope.__wpStyleRuntime = {
22348 documents: /* @__PURE__ */ new Map(),
22349 styles: /* @__PURE__ */ new Map(),
22350 injectedStyles: /* @__PURE__ */ new WeakMap()
22351 };
22352 if (typeof document !== "undefined") {
22353 registerDocument31(document);
22354 }
22355 return globalScope.__wpStyleRuntime;
22356 }
22357 function documentContainsStyleHash31(targetDocument, hash) {
22358 if (!targetDocument.head) {
22359 return false;
22360 }
22361 for (const style of targetDocument.head.querySelectorAll(
22362 `style[${STYLE_HASH_ATTRIBUTE31}]`
22363 )) {
22364 if (style.getAttribute(STYLE_HASH_ATTRIBUTE31) === hash) {
22365 return true;
22366 }
22367 }
22368 return false;
22369 }
22370 function injectStyle31(targetDocument, hash, css) {
22371 if (!targetDocument.head) {
22372 return;
22373 }
22374 const runtime = getRuntime31();
22375 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22376 if (!injectedStyles) {
22377 injectedStyles = /* @__PURE__ */ new Set();
22378 runtime.injectedStyles.set(targetDocument, injectedStyles);
22379 }
22380 if (injectedStyles.has(hash)) {
22381 return;
22382 }
22383 if (documentContainsStyleHash31(targetDocument, hash)) {
22384 injectedStyles.add(hash);
22385 return;
22386 }
22387 const style = targetDocument.createElement("style");
22388 style.setAttribute(STYLE_HASH_ATTRIBUTE31, hash);
22389 style.appendChild(targetDocument.createTextNode(css));
22390 targetDocument.head.appendChild(style);
22391 injectedStyles.add(hash);
22392 }
22393 function registerDocument31(targetDocument) {
22394 const runtime = getRuntime31();
22395 runtime.documents.set(
22396 targetDocument,
22397 (runtime.documents.get(targetDocument) ?? 0) + 1
22398 );
22399 for (const [hash, css] of runtime.styles) {
22400 injectStyle31(targetDocument, hash, css);
22401 }
22402 return () => {
22403 const count = runtime.documents.get(targetDocument);
22404 if (count === void 0) {
22405 return;
22406 }
22407 if (count <= 1) {
22408 runtime.documents.delete(targetDocument);
22409 return;
22410 }
22411 runtime.documents.set(targetDocument, count - 1);
22412 };
22413 }
22414 function registerStyle31(hash, css) {
22415 const runtime = getRuntime31();
22416 runtime.styles.set(hash, css);
22417 for (const targetDocument of runtime.documents.keys()) {
22418 injectStyle31(targetDocument, hash, css);
22419 }
22420 }
22421 if (typeof process === "undefined" || true) {
22422 registerStyle31("0c752c3d08", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.a9211a7e6af24bed__root input[type=date]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=datetime-local]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=time]:not([data-filled]):not(:focus){--_gcd-input-color:transparent;--_gcd-input-color-disabled:transparent;color:transparent;&:disabled::-webkit-datetime-edit-text{color:transparent}}}}}");
22423 }
22424 var style_default25 = { "root": "a9211a7e6af24bed__root" };
22425 var InputControl = (0, import_element58.forwardRef)(
22426 function InputControl2({
22427 className,
22428 label,
22429 description,
22430 details,
22431 hideLabelFromVision,
22432 ...restProps
22433 }, ref) {
22434 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(field_exports.Root, { className: clsx_default(style_default25.root, className), children: [
22435 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }),
22436 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Input3, { ref, ...restProps }),
22437 description && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(field_exports.Description, { children: description }),
22438 details && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(field_exports.Details, { children: details })
22439 ] });
22440 }
22441 );
22442
22443 // packages/ui/build-module/form/textarea-control/textarea-control.mjs
22444 var import_element59 = __toESM(require_element(), 1);
22445 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
22446 var TextareaControl = (0, import_element59.forwardRef)(function TextareaControl2({
22447 className,
22448 label,
22449 description,
22450 details,
22451 hideLabelFromVision,
22452 ...restProps
22453 }, ref) {
22454 return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(field_exports.Root, { className, children: [
22455 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }),
22456 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Textarea, { ref, ...restProps }),
22457 description && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(field_exports.Description, { children: description }),
22458 details && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(field_exports.Details, { children: details })
22459 ] });
22460 });
22461
22462 // packages/ui/build-module/form/with-validation/validated-input-control/validated-input-control.mjs
22463 var import_element60 = __toESM(require_element(), 1);
22464 var import_compose4 = __toESM(require_compose(), 1);
22465 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
22466 var ValidatedInputControl = (0, import_element60.forwardRef)(function ValidatedInputControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) {
22467 const validityTargetRef = (0, import_element60.useRef)(null);
22468 const mergedRefs = (0, import_compose4.useMergeRefs)([forwardedRef, validityTargetRef]);
22469 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
22470 ControlWithError,
22471 {
22472 required,
22473 markWhenOptional,
22474 customValidity,
22475 getValidityTarget: () => validityTargetRef.current,
22476 children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(InputControl, { ref: mergedRefs, ...restProps })
22477 }
22478 );
22479 });
22480
22481 // packages/ui/build-module/form/with-validation/validated-textarea-control/validated-textarea-control.mjs
22482 var import_element61 = __toESM(require_element(), 1);
22483 var import_compose5 = __toESM(require_compose(), 1);
22484 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
22485 var ValidatedTextareaControl = (0, import_element61.forwardRef)(function ValidatedTextareaControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) {
22486 const validityTargetRef = (0, import_element61.useRef)(null);
22487 const mergedRefs = (0, import_compose5.useMergeRefs)([forwardedRef, validityTargetRef]);
22488 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
22489 ControlWithError,
22490 {
22491 required,
22492 markWhenOptional,
22493 customValidity,
22494 getValidityTarget: () => validityTargetRef.current,
22495 children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(TextareaControl, { ref: mergedRefs, ...restProps })
22496 }
22497 );
22498 });
22499
22500 // packages/admin-ui/build-module/navigable-region/index.mjs
22501 var import_element62 = __toESM(require_element(), 1);
22502 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
22503 var NavigableRegion = (0, import_element62.forwardRef)(
22504 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
22505 return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
22506 Tag,
22507 {
22508 ref,
22509 className: clsx_default("admin-ui-navigable-region", className),
22510 "aria-label": ariaLabel,
22511 role: "region",
22512 tabIndex: "-1",
22513 ...props,
22514 children
22515 }
22516 );
22517 }
22518 );
22519 NavigableRegion.displayName = "NavigableRegion";
22520 var navigable_region_default = NavigableRegion;
22521
22522 // packages/admin-ui/build-module/navigation/index.mjs
22523 var import_i18n9 = __toESM(require_i18n(), 1);
22524 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
22525 var STYLE_HASH_ATTRIBUTE32 = "data-wp-hash";
22526 function getRuntime32() {
22527 const globalScope = globalThis;
22528 if (globalScope.__wpStyleRuntime) {
22529 return globalScope.__wpStyleRuntime;
22530 }
22531 globalScope.__wpStyleRuntime = {
22532 documents: /* @__PURE__ */ new Map(),
22533 styles: /* @__PURE__ */ new Map(),
22534 injectedStyles: /* @__PURE__ */ new WeakMap()
22535 };
22536 if (typeof document !== "undefined") {
22537 registerDocument32(document);
22538 }
22539 return globalScope.__wpStyleRuntime;
22540 }
22541 function documentContainsStyleHash32(targetDocument, hash) {
22542 if (!targetDocument.head) {
22543 return false;
22544 }
22545 for (const style of targetDocument.head.querySelectorAll(
22546 `style[${STYLE_HASH_ATTRIBUTE32}]`
22547 )) {
22548 if (style.getAttribute(STYLE_HASH_ATTRIBUTE32) === hash) {
22549 return true;
22550 }
22551 }
22552 return false;
22553 }
22554 function injectStyle32(targetDocument, hash, css) {
22555 if (!targetDocument.head) {
22556 return;
22557 }
22558 const runtime = getRuntime32();
22559 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22560 if (!injectedStyles) {
22561 injectedStyles = /* @__PURE__ */ new Set();
22562 runtime.injectedStyles.set(targetDocument, injectedStyles);
22563 }
22564 if (injectedStyles.has(hash)) {
22565 return;
22566 }
22567 if (documentContainsStyleHash32(targetDocument, hash)) {
22568 injectedStyles.add(hash);
22569 return;
22570 }
22571 const style = targetDocument.createElement("style");
22572 style.setAttribute(STYLE_HASH_ATTRIBUTE32, hash);
22573 style.appendChild(targetDocument.createTextNode(css));
22574 targetDocument.head.appendChild(style);
22575 injectedStyles.add(hash);
22576 }
22577 function registerDocument32(targetDocument) {
22578 const runtime = getRuntime32();
22579 runtime.documents.set(
22580 targetDocument,
22581 (runtime.documents.get(targetDocument) ?? 0) + 1
22582 );
22583 for (const [hash, css] of runtime.styles) {
22584 injectStyle32(targetDocument, hash, css);
22585 }
22586 return () => {
22587 const count = runtime.documents.get(targetDocument);
22588 if (count === void 0) {
22589 return;
22590 }
22591 if (count <= 1) {
22592 runtime.documents.delete(targetDocument);
22593 return;
22594 }
22595 runtime.documents.set(targetDocument, count - 1);
22596 };
22597 }
22598 function registerStyle32(hash, css) {
22599 const runtime = getRuntime32();
22600 runtime.styles.set(hash, css);
22601 for (const targetDocument of runtime.documents.keys()) {
22602 injectStyle32(targetDocument, hash, css);
22603 }
22604 }
22605 if (typeof process === "undefined" || true) {
22606 registerStyle32("72ef022400", ".bfb5a2dd8cceebd3__list{--focus-ring-size:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*2);list-style:none;margin:calc(var(--focus-ring-size)*-1);overflow-x:auto;padding:var(--focus-ring-size);scroll-padding:var(--focus-ring-size)}.a4759b4cb2c8bd92__li{flex-shrink:0}._07da506d3f2d9afe__item{align-items:center;color:var(--wpds-color-foreground-interactive-neutral-weak,#707070);display:flex;font-weight:var(--wpds-typography-font-weight-default,400);min-block-size:44px;min-inline-size:44px;text-decoration:none}._07da506d3f2d9afe__item:hover,._07da506d3f2d9afe__item[aria-current=page]{color:var(--wpds-color-foreground-interactive-neutral-weak-active,#1e1e1e)}._07da506d3f2d9afe__item[aria-current=page]{font-weight:var(--wpds-typography-font-weight-emphasis,600)}");
22607 }
22608 var style_default26 = { "list": "bfb5a2dd8cceebd3__list", "li": "a4759b4cb2c8bd92__li", "item": "_07da506d3f2d9afe__item" };
22609 var Navigation = ({
22610 items,
22611 currentHref,
22612 ariaLabel = (0, import_i18n9.__)("Sections"),
22613 linkComponent,
22614 className
22615 }) => {
22616 if (!items.length) {
22617 return null;
22618 }
22619 const LinkComponent = linkComponent ?? "a";
22620 if (true) {
22621 const invalidItem = items.find(
22622 (item) => typeof item.href !== "string"
22623 );
22624 if (invalidItem) {
22625 throw new Error(
22626 `Navigation: item "${invalidItem.label}" is missing an \`href\` prop.`
22627 );
22628 }
22629 const duplicate = items.find(
22630 (item, index2) => items.findIndex((other) => other.href === item.href) !== index2
22631 );
22632 if (duplicate) {
22633 throw new Error(
22634 `Navigation: duplicate \`href\` "${duplicate.href}". Each item must have a unique \`href\` so a single item receives \`aria-current="page"\`.`
22635 );
22636 }
22637 }
22638 return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("nav", { "aria-label": ariaLabel, className, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
22639 Stack,
22640 {
22641 render: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("ul", { role: "list" }),
22642 direction: "row",
22643 align: "center",
22644 gap: "md",
22645 className: style_default26.list,
22646 children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("li", { className: style_default26.li, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
22647 Text,
22648 {
22649 variant: "body-md",
22650 className: style_default26.item,
22651 render: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
22652 Link,
22653 {
22654 variant: "unstyled",
22655 "aria-current": item.href === currentHref ? "page" : void 0,
22656 render: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(LinkComponent, { href: item.href })
22657 }
22658 ),
22659 children: item.label
22660 }
22661 ) }, item.href))
22662 }
22663 ) });
22664 };
22665 var navigation_default = Navigation;
22666
22667 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs
22668 var import_components2 = __toESM(require_components(), 1);
22669 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components2.createSlotFill)("SidebarToggle");
22670
22671 // packages/admin-ui/build-module/page/header.mjs
22672 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
22673 var STYLE_HASH_ATTRIBUTE33 = "data-wp-hash";
22674 function getRuntime33() {
22675 const globalScope = globalThis;
22676 if (globalScope.__wpStyleRuntime) {
22677 return globalScope.__wpStyleRuntime;
22678 }
22679 globalScope.__wpStyleRuntime = {
22680 documents: /* @__PURE__ */ new Map(),
22681 styles: /* @__PURE__ */ new Map(),
22682 injectedStyles: /* @__PURE__ */ new WeakMap()
22683 };
22684 if (typeof document !== "undefined") {
22685 registerDocument33(document);
22686 }
22687 return globalScope.__wpStyleRuntime;
22688 }
22689 function documentContainsStyleHash33(targetDocument, hash) {
22690 if (!targetDocument.head) {
22691 return false;
22692 }
22693 for (const style of targetDocument.head.querySelectorAll(
22694 `style[${STYLE_HASH_ATTRIBUTE33}]`
22695 )) {
22696 if (style.getAttribute(STYLE_HASH_ATTRIBUTE33) === hash) {
22697 return true;
22698 }
22699 }
22700 return false;
22701 }
22702 function injectStyle33(targetDocument, hash, css) {
22703 if (!targetDocument.head) {
22704 return;
22705 }
22706 const runtime = getRuntime33();
22707 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22708 if (!injectedStyles) {
22709 injectedStyles = /* @__PURE__ */ new Set();
22710 runtime.injectedStyles.set(targetDocument, injectedStyles);
22711 }
22712 if (injectedStyles.has(hash)) {
22713 return;
22714 }
22715 if (documentContainsStyleHash33(targetDocument, hash)) {
22716 injectedStyles.add(hash);
22717 return;
22718 }
22719 const style = targetDocument.createElement("style");
22720 style.setAttribute(STYLE_HASH_ATTRIBUTE33, hash);
22721 style.appendChild(targetDocument.createTextNode(css));
22722 targetDocument.head.appendChild(style);
22723 injectedStyles.add(hash);
22724 }
22725 function registerDocument33(targetDocument) {
22726 const runtime = getRuntime33();
22727 runtime.documents.set(
22728 targetDocument,
22729 (runtime.documents.get(targetDocument) ?? 0) + 1
22730 );
22731 for (const [hash, css] of runtime.styles) {
22732 injectStyle33(targetDocument, hash, css);
22733 }
22734 return () => {
22735 const count = runtime.documents.get(targetDocument);
22736 if (count === void 0) {
22737 return;
22738 }
22739 if (count <= 1) {
22740 runtime.documents.delete(targetDocument);
22741 return;
22742 }
22743 runtime.documents.set(targetDocument, count - 1);
22744 };
22745 }
22746 function registerStyle33(hash, css) {
22747 const runtime = getRuntime33();
22748 runtime.styles.set(hash, css);
22749 for (const targetDocument of runtime.documents.keys()) {
22750 injectStyle33(targetDocument, hash, css);
22751 }
22752 }
22753 if (typeof process === "undefined" || true) {
22754 registerStyle33("1f3750277d", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8bcd33103b451f30__header-lockup{min-width:0}._8113be94e7caf73c__header-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation,._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation ._60fea2f6bf5319cd__header-subtitle{padding-block-end:0}._673c99dcbfb58211__header-navigation{margin-block-start:var(--wpds-dimension-gap-md,12px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");
22755 }
22756 var style_default27 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-lockup": "_8bcd33103b451f30__header-lockup", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "has-navigation": "_4b0f17e503d11619__has-navigation", "header-navigation": "_673c99dcbfb58211__header-navigation", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" };
22757 function Header3({
22758 headingLevel = 1,
22759 breadcrumbs,
22760 badges,
22761 visual,
22762 title,
22763 subTitle,
22764 actions,
22765 navigation,
22766 components,
22767 showSidebarToggle = true
22768 }) {
22769 const HeadingTag = `h${headingLevel}`;
22770 const hasNavigation = !!navigation?.items?.length;
22771 return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
22772 Stack,
22773 {
22774 direction: "column",
22775 className: clsx_default(
22776 style_default27.header,
22777 hasNavigation && style_default27["has-navigation"]
22778 ),
22779 children: [
22780 /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
22781 Stack,
22782 {
22783 className: style_default27["header-content"],
22784 direction: "row",
22785 gap: "sm",
22786 justify: "space-between",
22787 children: [
22788 /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
22789 Stack,
22790 {
22791 direction: "row",
22792 gap: "sm",
22793 align: "center",
22794 justify: "start",
22795 className: style_default27["header-lockup"],
22796 children: [
22797 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
22798 SidebarToggleSlot,
22799 {
22800 bubblesVirtually: true,
22801 className: style_default27["sidebar-toggle-slot"]
22802 }
22803 ),
22804 visual && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
22805 "div",
22806 {
22807 className: style_default27["header-visual"],
22808 "aria-hidden": "true",
22809 children: visual
22810 }
22811 ),
22812 title && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
22813 Text,
22814 {
22815 className: style_default27["header-title"],
22816 render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(HeadingTag, {}),
22817 variant: "heading-lg",
22818 children: title
22819 }
22820 ),
22821 breadcrumbs,
22822 badges
22823 ]
22824 }
22825 ),
22826 actions && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
22827 Stack,
22828 {
22829 align: "center",
22830 className: style_default27["header-actions"],
22831 direction: "row",
22832 gap: "sm",
22833 children: actions
22834 }
22835 )
22836 ]
22837 }
22838 ),
22839 subTitle && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
22840 Text,
22841 {
22842 render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", {}),
22843 variant: "body-md",
22844 className: style_default27["header-subtitle"],
22845 children: subTitle
22846 }
22847 ),
22848 hasNavigation && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
22849 navigation_default,
22850 {
22851 ...navigation,
22852 linkComponent: components?.link,
22853 className: style_default27["header-navigation"]
22854 }
22855 )
22856 ]
22857 }
22858 );
22859 }
22860
22861 // packages/admin-ui/build-module/page/index.mjs
22862 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
22863 var STYLE_HASH_ATTRIBUTE34 = "data-wp-hash";
22864 function getRuntime34() {
22865 const globalScope = globalThis;
22866 if (globalScope.__wpStyleRuntime) {
22867 return globalScope.__wpStyleRuntime;
22868 }
22869 globalScope.__wpStyleRuntime = {
22870 documents: /* @__PURE__ */ new Map(),
22871 styles: /* @__PURE__ */ new Map(),
22872 injectedStyles: /* @__PURE__ */ new WeakMap()
22873 };
22874 if (typeof document !== "undefined") {
22875 registerDocument34(document);
22876 }
22877 return globalScope.__wpStyleRuntime;
22878 }
22879 function documentContainsStyleHash34(targetDocument, hash) {
22880 if (!targetDocument.head) {
22881 return false;
22882 }
22883 for (const style of targetDocument.head.querySelectorAll(
22884 `style[${STYLE_HASH_ATTRIBUTE34}]`
22885 )) {
22886 if (style.getAttribute(STYLE_HASH_ATTRIBUTE34) === hash) {
22887 return true;
22888 }
22889 }
22890 return false;
22891 }
22892 function injectStyle34(targetDocument, hash, css) {
22893 if (!targetDocument.head) {
22894 return;
22895 }
22896 const runtime = getRuntime34();
22897 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22898 if (!injectedStyles) {
22899 injectedStyles = /* @__PURE__ */ new Set();
22900 runtime.injectedStyles.set(targetDocument, injectedStyles);
22901 }
22902 if (injectedStyles.has(hash)) {
22903 return;
22904 }
22905 if (documentContainsStyleHash34(targetDocument, hash)) {
22906 injectedStyles.add(hash);
22907 return;
22908 }
22909 const style = targetDocument.createElement("style");
22910 style.setAttribute(STYLE_HASH_ATTRIBUTE34, hash);
22911 style.appendChild(targetDocument.createTextNode(css));
22912 targetDocument.head.appendChild(style);
22913 injectedStyles.add(hash);
22914 }
22915 function registerDocument34(targetDocument) {
22916 const runtime = getRuntime34();
22917 runtime.documents.set(
22918 targetDocument,
22919 (runtime.documents.get(targetDocument) ?? 0) + 1
22920 );
22921 for (const [hash, css] of runtime.styles) {
22922 injectStyle34(targetDocument, hash, css);
22923 }
22924 return () => {
22925 const count = runtime.documents.get(targetDocument);
22926 if (count === void 0) {
22927 return;
22928 }
22929 if (count <= 1) {
22930 runtime.documents.delete(targetDocument);
22931 return;
22932 }
22933 runtime.documents.set(targetDocument, count - 1);
22934 };
22935 }
22936 function registerStyle34(hash, css) {
22937 const runtime = getRuntime34();
22938 runtime.styles.set(hash, css);
22939 for (const targetDocument of runtime.documents.keys()) {
22940 injectStyle34(targetDocument, hash, css);
22941 }
22942 }
22943 if (typeof process === "undefined" || true) {
22944 registerStyle34("1f3750277d", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8bcd33103b451f30__header-lockup{min-width:0}._8113be94e7caf73c__header-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation,._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation ._60fea2f6bf5319cd__header-subtitle{padding-block-end:0}._673c99dcbfb58211__header-navigation{margin-block-start:var(--wpds-dimension-gap-md,12px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");
22945 }
22946 var style_default28 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-lockup": "_8bcd33103b451f30__header-lockup", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "has-navigation": "_4b0f17e503d11619__has-navigation", "header-navigation": "_673c99dcbfb58211__header-navigation", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" };
22947 function Page({
22948 headingLevel,
22949 breadcrumbs,
22950 badges,
22951 visual,
22952 title,
22953 subTitle,
22954 children,
22955 className,
22956 actions,
22957 navigation,
22958 components,
22959 ariaLabel,
22960 hasPadding = false,
22961 showSidebarToggle = true
22962 }) {
22963 const classes = clsx_default(style_default28.page, className);
22964 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : "");
22965 return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [
22966 (title || breadcrumbs || badges || actions || visual || !!navigation?.items?.length) && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
22967 Header3,
22968 {
22969 headingLevel,
22970 breadcrumbs,
22971 badges,
22972 visual,
22973 title,
22974 subTitle,
22975 actions,
22976 navigation,
22977 components,
22978 showSidebarToggle
22979 }
22980 ),
22981 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
22982 "div",
22983 {
22984 className: clsx_default(
22985 style_default28.content,
22986 style_default28["has-padding"]
22987 ),
22988 children
22989 }
22990 ) : children
22991 ] });
22992 }
22993 Page.SidebarToggleFill = SidebarToggleFill;
22994 var page_default = Page;
22995
22996 // routes/identity/stage.tsx
22997 var import_i18n33 = __toESM(require_i18n());
22998 var import_data5 = __toESM(require_data());
22999 var import_core_data3 = __toESM(require_core_data());
23000
23001 // packages/dataviews/build-module/constants.mjs
23002 var import_i18n10 = __toESM(require_i18n(), 1);
23003 var OPERATOR_IS_ANY = "isAny";
23004 var OPERATOR_IS_NONE = "isNone";
23005 var OPERATOR_IS_ALL = "isAll";
23006 var OPERATOR_IS_NOT_ALL = "isNotAll";
23007 var OPERATOR_BETWEEN = "between";
23008 var OPERATOR_IN_THE_PAST = "inThePast";
23009 var OPERATOR_OVER = "over";
23010 var OPERATOR_IS = "is";
23011 var OPERATOR_IS_NOT = "isNot";
23012 var OPERATOR_LESS_THAN = "lessThan";
23013 var OPERATOR_GREATER_THAN = "greaterThan";
23014 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
23015 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
23016 var OPERATOR_BEFORE = "before";
23017 var OPERATOR_AFTER = "after";
23018 var OPERATOR_BEFORE_INC = "beforeInc";
23019 var OPERATOR_AFTER_INC = "afterInc";
23020 var OPERATOR_CONTAINS = "contains";
23021 var OPERATOR_NOT_CONTAINS = "notContains";
23022 var OPERATOR_STARTS_WITH = "startsWith";
23023 var OPERATOR_ON = "on";
23024 var OPERATOR_NOT_ON = "notOn";
23025 var sortLabels = {
23026 asc: (0, import_i18n10.__)("Sort ascending"),
23027 desc: (0, import_i18n10.__)("Sort descending")
23028 };
23029
23030 // packages/dataviews/build-module/hooks/use-elements.mjs
23031 var import_element63 = __toESM(require_element(), 1);
23032 var EMPTY_ARRAY2 = [];
23033 function useElements({
23034 elements,
23035 getElements
23036 }) {
23037 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY2;
23038 const [records, setRecords] = (0, import_element63.useState)(staticElements);
23039 const [isLoading, setIsLoading] = (0, import_element63.useState)(false);
23040 (0, import_element63.useEffect)(() => {
23041 if (!getElements) {
23042 setRecords(staticElements);
23043 return;
23044 }
23045 let cancelled = false;
23046 setIsLoading(true);
23047 getElements().then((fetchedElements) => {
23048 if (!cancelled) {
23049 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
23050 setRecords(dynamicElements);
23051 }
23052 }).catch(() => {
23053 if (!cancelled) {
23054 setRecords(staticElements);
23055 }
23056 }).finally(() => {
23057 if (!cancelled) {
23058 setIsLoading(false);
23059 }
23060 });
23061 return () => {
23062 cancelled = true;
23063 };
23064 }, [getElements, staticElements]);
23065 return {
23066 elements: records,
23067 isLoading
23068 };
23069 }
23070
23071 // packages/dataviews/build-module/utils/operators.mjs
23072 var import_i18n11 = __toESM(require_i18n(), 1);
23073 var import_element64 = __toESM(require_element(), 1);
23074 var import_date2 = __toESM(require_date(), 1);
23075
23076 // packages/dataviews/build-module/field-types/utils/parse-time.mjs
23077 var ZONE_DESIGNATOR = /(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)$/;
23078 var TIME_FORMATS = ["HH:mm", "HH:mm:ss"];
23079 var REFERENCE_DATE = new Date(2e3, 0, 1);
23080 function parseTime2(value) {
23081 if (typeof value !== "string") {
23082 return null;
23083 }
23084 const time = value.trim().replace(ZONE_DESIGNATOR, "");
23085 for (const timeFormat of TIME_FORMATS) {
23086 const parsed = parse(time, timeFormat, REFERENCE_DATE);
23087 if (isValid(parsed)) {
23088 return parsed.getHours() * 3600 + parsed.getMinutes() * 60 + parsed.getSeconds();
23089 }
23090 }
23091 return null;
23092 }
23093
23094 // packages/dataviews/build-module/utils/operators.mjs
23095 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
23096 var filterTextWrappers = {
23097 Name: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
23098 Value: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
23099 };
23100 function toComparableTemporals(fieldValue, filterValue) {
23101 const filterTime = parseTime2(filterValue);
23102 if (filterTime !== null) {
23103 return [parseTime2(fieldValue) ?? NaN, filterTime];
23104 }
23105 return [
23106 (0, import_date2.getDate)(fieldValue).getTime(),
23107 (0, import_date2.getDate)(filterValue).getTime()
23108 ];
23109 }
23110 function getRelativeDate(value, unit) {
23111 switch (unit) {
23112 case "days":
23113 return subDays(/* @__PURE__ */ new Date(), value);
23114 case "weeks":
23115 return subWeeks(/* @__PURE__ */ new Date(), value);
23116 case "months":
23117 return subMonths(/* @__PURE__ */ new Date(), value);
23118 case "years":
23119 return subYears(/* @__PURE__ */ new Date(), value);
23120 default:
23121 return /* @__PURE__ */ new Date();
23122 }
23123 }
23124 var isNoneOperatorDefinition = {
23125 /* translators: DataViews operator name */
23126 label: (0, import_i18n11.__)("Is none of"),
23127 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23128 (0, import_i18n11.sprintf)(
23129 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
23130 (0, import_i18n11.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
23131 filter.name,
23132 activeElements.map((element) => element.label).join(", ")
23133 ),
23134 filterTextWrappers
23135 ),
23136 filter: ((item, field, filterValue) => {
23137 if (!filterValue?.length) {
23138 return true;
23139 }
23140 const fieldValue = field.getValue({ item });
23141 if (Array.isArray(fieldValue)) {
23142 return !filterValue.some(
23143 (fv) => fieldValue.includes(fv)
23144 );
23145 } else if (typeof fieldValue === "string" || typeof fieldValue === "number") {
23146 return !filterValue.includes(fieldValue);
23147 }
23148 return false;
23149 }),
23150 selection: "multi"
23151 };
23152 var OPERATORS = [
23153 {
23154 name: OPERATOR_IS_ANY,
23155 /* translators: DataViews operator name */
23156 label: (0, import_i18n11.__)("Includes"),
23157 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23158 (0, import_i18n11.sprintf)(
23159 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
23160 (0, import_i18n11.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
23161 filter.name,
23162 activeElements.map((element) => element.label).join(", ")
23163 ),
23164 filterTextWrappers
23165 ),
23166 filter(item, field, filterValue) {
23167 if (!filterValue?.length) {
23168 return true;
23169 }
23170 const fieldValue = field.getValue({ item });
23171 if (Array.isArray(fieldValue)) {
23172 return filterValue.some(
23173 (fv) => fieldValue.includes(fv)
23174 );
23175 } else if (typeof fieldValue === "string" || typeof fieldValue === "number") {
23176 return filterValue.includes(fieldValue);
23177 }
23178 return false;
23179 },
23180 selection: "multi"
23181 },
23182 {
23183 name: OPERATOR_IS_NONE,
23184 ...isNoneOperatorDefinition
23185 },
23186 {
23187 name: OPERATOR_IS_ALL,
23188 /* translators: DataViews operator name */
23189 label: (0, import_i18n11.__)("Includes all"),
23190 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23191 (0, import_i18n11.sprintf)(
23192 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
23193 (0, import_i18n11.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
23194 filter.name,
23195 activeElements.map((element) => element.label).join(", ")
23196 ),
23197 filterTextWrappers
23198 ),
23199 filter(item, field, filterValue) {
23200 if (!filterValue?.length) {
23201 return true;
23202 }
23203 const fieldValue = field.getValue({ item });
23204 if (!Array.isArray(fieldValue)) {
23205 return false;
23206 }
23207 return filterValue.every(
23208 (value) => fieldValue.includes(value)
23209 );
23210 },
23211 selection: "multi"
23212 },
23213 {
23214 name: OPERATOR_IS_NOT_ALL,
23215 ...isNoneOperatorDefinition
23216 },
23217 {
23218 name: OPERATOR_BETWEEN,
23219 /* translators: DataViews operator name */
23220 label: (0, import_i18n11.__)("Between (inc)"),
23221 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23222 (0, import_i18n11.sprintf)(
23223 /* 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". */
23224 (0, import_i18n11.__)(
23225 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
23226 ),
23227 filter.name,
23228 activeElements[0].label[0],
23229 activeElements[0].label[1]
23230 ),
23231 filterTextWrappers
23232 ),
23233 filter(item, field, filterValue) {
23234 if (!Array.isArray(filterValue) || filterValue.length !== 2 || // An unfilled bound is `undefined` from the controls, `''`
23235 // when it arrives from a persisted view, or `null` once
23236 // `undefined` round-trips through JSON persistence.
23237 filterValue.includes(void 0) || filterValue.includes("") || filterValue.includes(null)) {
23238 return true;
23239 }
23240 const fieldValue = field.getValue({ item });
23241 const [min3, max3] = filterValue.map(parseTime2);
23242 if (min3 !== null && max3 !== null) {
23243 const value = parseTime2(fieldValue);
23244 return value !== null && value >= min3 && value <= max3;
23245 }
23246 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
23247 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1];
23248 }
23249 return false;
23250 },
23251 selection: "custom"
23252 },
23253 {
23254 name: OPERATOR_IN_THE_PAST,
23255 /* translators: DataViews operator name */
23256 label: (0, import_i18n11.__)("In the past"),
23257 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23258 (0, import_i18n11.sprintf)(
23259 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
23260 (0, import_i18n11.__)(
23261 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
23262 ),
23263 filter.name,
23264 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
23265 ),
23266 filterTextWrappers
23267 ),
23268 filter(item, field, filterValue) {
23269 if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
23270 return true;
23271 }
23272 const targetDate = getRelativeDate(
23273 filterValue.value,
23274 filterValue.unit
23275 );
23276 const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
23277 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
23278 },
23279 selection: "custom"
23280 },
23281 {
23282 name: OPERATOR_OVER,
23283 /* translators: DataViews operator name */
23284 label: (0, import_i18n11.__)("Over"),
23285 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23286 (0, import_i18n11.sprintf)(
23287 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
23288 (0, import_i18n11.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
23289 filter.name,
23290 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
23291 ),
23292 filterTextWrappers
23293 ),
23294 filter(item, field, filterValue) {
23295 if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
23296 return true;
23297 }
23298 const targetDate = getRelativeDate(
23299 filterValue.value,
23300 filterValue.unit
23301 );
23302 const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
23303 return fieldValue < targetDate;
23304 },
23305 selection: "custom"
23306 },
23307 {
23308 name: OPERATOR_IS,
23309 /* translators: DataViews operator name */
23310 label: (0, import_i18n11.__)("Is"),
23311 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23312 (0, import_i18n11.sprintf)(
23313 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
23314 (0, import_i18n11.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
23315 filter.name,
23316 activeElements[0].label
23317 ),
23318 filterTextWrappers
23319 ),
23320 filter(item, field, filterValue) {
23321 return filterValue === field.getValue({ item }) || filterValue === void 0;
23322 },
23323 selection: "single"
23324 },
23325 {
23326 name: OPERATOR_IS_NOT,
23327 /* translators: DataViews operator name */
23328 label: (0, import_i18n11.__)("Is not"),
23329 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23330 (0, import_i18n11.sprintf)(
23331 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
23332 (0, import_i18n11.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
23333 filter.name,
23334 activeElements[0].label
23335 ),
23336 filterTextWrappers
23337 ),
23338 filter(item, field, filterValue) {
23339 return filterValue !== field.getValue({ item });
23340 },
23341 selection: "single"
23342 },
23343 {
23344 name: OPERATOR_LESS_THAN,
23345 /* translators: DataViews operator name */
23346 label: (0, import_i18n11.__)("Less than"),
23347 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23348 (0, import_i18n11.sprintf)(
23349 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
23350 (0, import_i18n11.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
23351 filter.name,
23352 activeElements[0].label
23353 ),
23354 filterTextWrappers
23355 ),
23356 filter(item, field, filterValue) {
23357 if (filterValue === void 0) {
23358 return true;
23359 }
23360 const fieldValue = field.getValue({ item });
23361 return fieldValue < filterValue;
23362 },
23363 selection: "single"
23364 },
23365 {
23366 name: OPERATOR_GREATER_THAN,
23367 /* translators: DataViews operator name */
23368 label: (0, import_i18n11.__)("Greater than"),
23369 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23370 (0, import_i18n11.sprintf)(
23371 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
23372 (0, import_i18n11.__)(
23373 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
23374 ),
23375 filter.name,
23376 activeElements[0].label
23377 ),
23378 filterTextWrappers
23379 ),
23380 filter(item, field, filterValue) {
23381 if (filterValue === void 0) {
23382 return true;
23383 }
23384 const fieldValue = field.getValue({ item });
23385 return fieldValue > filterValue;
23386 },
23387 selection: "single"
23388 },
23389 {
23390 name: OPERATOR_LESS_THAN_OR_EQUAL,
23391 /* translators: DataViews operator name */
23392 label: (0, import_i18n11.__)("Less than or equal"),
23393 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23394 (0, import_i18n11.sprintf)(
23395 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
23396 (0, import_i18n11.__)(
23397 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
23398 ),
23399 filter.name,
23400 activeElements[0].label
23401 ),
23402 filterTextWrappers
23403 ),
23404 filter(item, field, filterValue) {
23405 if (filterValue === void 0) {
23406 return true;
23407 }
23408 const fieldValue = field.getValue({ item });
23409 return fieldValue <= filterValue;
23410 },
23411 selection: "single"
23412 },
23413 {
23414 name: OPERATOR_GREATER_THAN_OR_EQUAL,
23415 /* translators: DataViews operator name */
23416 label: (0, import_i18n11.__)("Greater than or equal"),
23417 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23418 (0, import_i18n11.sprintf)(
23419 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
23420 (0, import_i18n11.__)(
23421 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
23422 ),
23423 filter.name,
23424 activeElements[0].label
23425 ),
23426 filterTextWrappers
23427 ),
23428 filter(item, field, filterValue) {
23429 if (filterValue === void 0) {
23430 return true;
23431 }
23432 const fieldValue = field.getValue({ item });
23433 return fieldValue >= filterValue;
23434 },
23435 selection: "single"
23436 },
23437 {
23438 name: OPERATOR_BEFORE,
23439 /* translators: DataViews operator name */
23440 label: (0, import_i18n11.__)("Before"),
23441 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23442 (0, import_i18n11.sprintf)(
23443 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
23444 (0, import_i18n11.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
23445 filter.name,
23446 activeElements[0].label
23447 ),
23448 filterTextWrappers
23449 ),
23450 filter(item, field, filterValue) {
23451 if (filterValue === void 0) {
23452 return true;
23453 }
23454 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23455 field.getValue({ item }),
23456 filterValue
23457 );
23458 return fieldTemporal < filterTemporal;
23459 },
23460 selection: "single"
23461 },
23462 {
23463 name: OPERATOR_AFTER,
23464 /* translators: DataViews operator name */
23465 label: (0, import_i18n11.__)("After"),
23466 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23467 (0, import_i18n11.sprintf)(
23468 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
23469 (0, import_i18n11.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
23470 filter.name,
23471 activeElements[0].label
23472 ),
23473 filterTextWrappers
23474 ),
23475 filter(item, field, filterValue) {
23476 if (filterValue === void 0) {
23477 return true;
23478 }
23479 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23480 field.getValue({ item }),
23481 filterValue
23482 );
23483 return fieldTemporal > filterTemporal;
23484 },
23485 selection: "single"
23486 },
23487 {
23488 name: OPERATOR_BEFORE_INC,
23489 /* translators: DataViews operator name */
23490 label: (0, import_i18n11.__)("Before (inc)"),
23491 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23492 (0, import_i18n11.sprintf)(
23493 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
23494 (0, import_i18n11.__)(
23495 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
23496 ),
23497 filter.name,
23498 activeElements[0].label
23499 ),
23500 filterTextWrappers
23501 ),
23502 filter(item, field, filterValue) {
23503 if (filterValue === void 0) {
23504 return true;
23505 }
23506 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23507 field.getValue({ item }),
23508 filterValue
23509 );
23510 return fieldTemporal <= filterTemporal;
23511 },
23512 selection: "single"
23513 },
23514 {
23515 name: OPERATOR_AFTER_INC,
23516 /* translators: DataViews operator name */
23517 label: (0, import_i18n11.__)("After (inc)"),
23518 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23519 (0, import_i18n11.sprintf)(
23520 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
23521 (0, import_i18n11.__)(
23522 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
23523 ),
23524 filter.name,
23525 activeElements[0].label
23526 ),
23527 filterTextWrappers
23528 ),
23529 filter(item, field, filterValue) {
23530 if (filterValue === void 0) {
23531 return true;
23532 }
23533 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23534 field.getValue({ item }),
23535 filterValue
23536 );
23537 return fieldTemporal >= filterTemporal;
23538 },
23539 selection: "single"
23540 },
23541 {
23542 name: OPERATOR_CONTAINS,
23543 /* translators: DataViews operator name */
23544 label: (0, import_i18n11.__)("Contains"),
23545 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23546 (0, import_i18n11.sprintf)(
23547 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
23548 (0, import_i18n11.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
23549 filter.name,
23550 activeElements[0].label
23551 ),
23552 filterTextWrappers
23553 ),
23554 filter(item, field, filterValue) {
23555 if (filterValue === void 0) {
23556 return true;
23557 }
23558 const fieldValue = field.getValue({ item });
23559 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
23560 },
23561 selection: "single"
23562 },
23563 {
23564 name: OPERATOR_NOT_CONTAINS,
23565 /* translators: DataViews operator name */
23566 label: (0, import_i18n11.__)("Doesn't contain"),
23567 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23568 (0, import_i18n11.sprintf)(
23569 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
23570 (0, import_i18n11.__)(
23571 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
23572 ),
23573 filter.name,
23574 activeElements[0].label
23575 ),
23576 filterTextWrappers
23577 ),
23578 filter(item, field, filterValue) {
23579 if (filterValue === void 0) {
23580 return true;
23581 }
23582 const fieldValue = field.getValue({ item });
23583 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
23584 },
23585 selection: "single"
23586 },
23587 {
23588 name: OPERATOR_STARTS_WITH,
23589 /* translators: DataViews operator name */
23590 label: (0, import_i18n11.__)("Starts with"),
23591 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23592 (0, import_i18n11.sprintf)(
23593 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
23594 (0, import_i18n11.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
23595 filter.name,
23596 activeElements[0].label
23597 ),
23598 filterTextWrappers
23599 ),
23600 filter(item, field, filterValue) {
23601 if (filterValue === void 0) {
23602 return true;
23603 }
23604 const fieldValue = field.getValue({ item });
23605 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase());
23606 },
23607 selection: "single"
23608 },
23609 {
23610 name: OPERATOR_ON,
23611 /* translators: DataViews operator name */
23612 label: (0, import_i18n11.__)("On"),
23613 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23614 (0, import_i18n11.sprintf)(
23615 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
23616 (0, import_i18n11.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
23617 filter.name,
23618 activeElements[0].label
23619 ),
23620 filterTextWrappers
23621 ),
23622 filter(item, field, filterValue) {
23623 if (filterValue === void 0) {
23624 return true;
23625 }
23626 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23627 field.getValue({ item }),
23628 filterValue
23629 );
23630 return fieldTemporal === filterTemporal;
23631 },
23632 selection: "single"
23633 },
23634 {
23635 name: OPERATOR_NOT_ON,
23636 /* translators: DataViews operator name */
23637 label: (0, import_i18n11.__)("Not on"),
23638 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23639 (0, import_i18n11.sprintf)(
23640 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
23641 (0, import_i18n11.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
23642 filter.name,
23643 activeElements[0].label
23644 ),
23645 filterTextWrappers
23646 ),
23647 filter(item, field, filterValue) {
23648 if (filterValue === void 0) {
23649 return true;
23650 }
23651 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23652 field.getValue({ item }),
23653 filterValue
23654 );
23655 return fieldTemporal !== filterTemporal;
23656 },
23657 selection: "single"
23658 }
23659 ];
23660 var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name);
23661 var getAllOperatorNames = () => OPERATORS.map((op) => op.name);
23662
23663 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
23664 var import_element73 = __toESM(require_element(), 1);
23665
23666 // packages/dataviews/build-module/components/validated-form-controls/checkbox-control.mjs
23667 var import_element65 = __toESM(require_element(), 1);
23668 var import_compose6 = __toESM(require_compose(), 1);
23669 var import_components3 = __toESM(require_components(), 1);
23670 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
23671 var UnforwardedValidatedCheckboxControl = ({
23672 required,
23673 customValidity,
23674 markWhenOptional,
23675 ...restProps
23676 }, forwardedRef) => {
23677 const validityTargetRef = (0, import_element65.useRef)(null);
23678 const mergedRefs = (0, import_compose6.useMergeRefs)([forwardedRef, validityTargetRef]);
23679 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
23680 ControlWithError,
23681 {
23682 className: "dataviews-validated-control",
23683 required,
23684 markWhenOptional,
23685 ref: mergedRefs,
23686 customValidity,
23687 getValidityTarget: () => validityTargetRef.current?.querySelector(
23688 'input[type="checkbox"]'
23689 ),
23690 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
23691 import_components3.CheckboxControl,
23692 {
23693 ...restProps
23694 }
23695 )
23696 }
23697 );
23698 };
23699 var ValidatedCheckboxControl = (0, import_element65.forwardRef)(UnforwardedValidatedCheckboxControl);
23700 ValidatedCheckboxControl.displayName = "ValidatedCheckboxControl";
23701
23702 // packages/dataviews/build-module/components/validated-form-controls/combobox-control.mjs
23703 var import_element66 = __toESM(require_element(), 1);
23704 var import_compose7 = __toESM(require_compose(), 1);
23705 var import_components4 = __toESM(require_components(), 1);
23706 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
23707 var UnforwardedValidatedComboboxControl = ({
23708 required,
23709 customValidity,
23710 markWhenOptional,
23711 ...restProps
23712 }, forwardedRef) => {
23713 const validityTargetRef = (0, import_element66.useRef)(null);
23714 const mergedRefs = (0, import_compose7.useMergeRefs)([forwardedRef, validityTargetRef]);
23715 (0, import_element66.useEffect)(() => {
23716 const input = validityTargetRef.current?.querySelector(
23717 'input[role="combobox"]'
23718 );
23719 if (input) {
23720 input.required = required ?? false;
23721 }
23722 }, [required]);
23723 return (
23724 // TODO: Bug - Missing value error is not cleared immediately on change, waits for blur.
23725 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
23726 ControlWithError,
23727 {
23728 className: "dataviews-validated-control",
23729 required,
23730 markWhenOptional,
23731 ref: mergedRefs,
23732 customValidity,
23733 getValidityTarget: () => validityTargetRef.current?.querySelector(
23734 'input[role="combobox"]'
23735 ),
23736 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components4.ComboboxControl, { ...restProps })
23737 }
23738 )
23739 );
23740 };
23741 var ValidatedComboboxControl = (0, import_element66.forwardRef)(UnforwardedValidatedComboboxControl);
23742 ValidatedComboboxControl.displayName = "ValidatedComboboxControl";
23743
23744 // packages/dataviews/build-module/components/validated-form-controls/form-token-field.mjs
23745 var import_element67 = __toESM(require_element(), 1);
23746 var import_components5 = __toESM(require_components(), 1);
23747 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
23748 var UnforwardedValidatedFormTokenField = ({
23749 required,
23750 customValidity,
23751 markWhenOptional,
23752 ...restProps
23753 }, forwardedRef) => {
23754 const validityTargetRef = (0, import_element67.useRef)(null);
23755 return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
23756 "div",
23757 {
23758 className: "dataviews-validated-control__wrapper-with-error-delegate",
23759 ref: forwardedRef,
23760 children: [
23761 /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
23762 ControlWithError,
23763 {
23764 className: "dataviews-validated-control",
23765 required,
23766 markWhenOptional,
23767 customValidity,
23768 getValidityTarget: () => validityTargetRef.current,
23769 children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_components5.FormTokenField, { ...restProps })
23770 }
23771 ),
23772 /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
23773 "input",
23774 {
23775 className: "dataviews-validated-control__error-delegate",
23776 type: "text",
23777 ref: validityTargetRef,
23778 required,
23779 value: restProps.value && restProps.value.length > 0 ? "hasvalue" : "",
23780 tabIndex: -1,
23781 onChange: () => {
23782 },
23783 onFocus: (e) => {
23784 e.target.previousElementSibling?.querySelector(
23785 'input[type="text"]'
23786 )?.focus();
23787 }
23788 }
23789 )
23790 ]
23791 }
23792 );
23793 };
23794 var ValidatedFormTokenField = (0, import_element67.forwardRef)(UnforwardedValidatedFormTokenField);
23795 ValidatedFormTokenField.displayName = "ValidatedFormTokenField";
23796
23797 // packages/dataviews/build-module/components/validated-form-controls/number-control.mjs
23798 var import_element68 = __toESM(require_element(), 1);
23799 var import_compose8 = __toESM(require_compose(), 1);
23800 var import_components6 = __toESM(require_components(), 1);
23801 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
23802 var UnforwardedValidatedNumberControl = ({
23803 required,
23804 customValidity,
23805 markWhenOptional,
23806 ...restProps
23807 }, forwardedRef) => {
23808 const validityTargetRef = (0, import_element68.useRef)(null);
23809 const mergedRefs = (0, import_compose8.useMergeRefs)([forwardedRef, validityTargetRef]);
23810 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
23811 ControlWithError,
23812 {
23813 className: "dataviews-validated-control",
23814 required,
23815 markWhenOptional,
23816 customValidity,
23817 getValidityTarget: () => validityTargetRef.current,
23818 children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components6.__experimentalNumberControl, { ref: mergedRefs, ...restProps })
23819 }
23820 );
23821 };
23822 var ValidatedNumberControl = (0, import_element68.forwardRef)(UnforwardedValidatedNumberControl);
23823 ValidatedNumberControl.displayName = "ValidatedNumberControl";
23824
23825 // packages/dataviews/build-module/components/validated-form-controls/radio-control.mjs
23826 var import_element69 = __toESM(require_element(), 1);
23827 var import_compose9 = __toESM(require_compose(), 1);
23828 var import_components7 = __toESM(require_components(), 1);
23829 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
23830 var UnforwardedValidatedRadioControl = ({
23831 required,
23832 customValidity,
23833 markWhenOptional,
23834 ...restProps
23835 }, forwardedRef) => {
23836 const validityTargetRef = (0, import_element69.useRef)(null);
23837 const mergedRefs = (0, import_compose9.useMergeRefs)([forwardedRef, validityTargetRef]);
23838 return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
23839 ControlWithError,
23840 {
23841 className: "dataviews-validated-control",
23842 required,
23843 markWhenOptional,
23844 ref: mergedRefs,
23845 customValidity,
23846 getValidityTarget: () => validityTargetRef.current?.querySelector(
23847 'input[type="radio"]'
23848 ),
23849 children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components7.RadioControl, { ...restProps })
23850 }
23851 );
23852 };
23853 var ValidatedRadioControl = (0, import_element69.forwardRef)(UnforwardedValidatedRadioControl);
23854 ValidatedRadioControl.displayName = "ValidatedRadioControl";
23855
23856 // packages/dataviews/build-module/components/validated-form-controls/select-control.mjs
23857 var import_element70 = __toESM(require_element(), 1);
23858 var import_compose10 = __toESM(require_compose(), 1);
23859 var import_components8 = __toESM(require_components(), 1);
23860 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
23861 var UnforwardedValidatedSelectControl = ({
23862 required,
23863 customValidity,
23864 markWhenOptional,
23865 ...restProps
23866 }, forwardedRef) => {
23867 const validityTargetRef = (0, import_element70.useRef)(null);
23868 const mergedRefs = (0, import_compose10.useMergeRefs)([forwardedRef, validityTargetRef]);
23869 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
23870 ControlWithError,
23871 {
23872 className: "dataviews-validated-control",
23873 required,
23874 markWhenOptional,
23875 customValidity,
23876 getValidityTarget: () => validityTargetRef.current,
23877 children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
23878 import_components8.SelectControl,
23879 {
23880 ref: mergedRefs,
23881 // A runtime boolean cannot statically discriminate
23882 // SelectControl's single/multiple props union.
23883 ...restProps
23884 }
23885 )
23886 }
23887 );
23888 };
23889 var ValidatedSelectControl = (0, import_element70.forwardRef)(UnforwardedValidatedSelectControl);
23890 ValidatedSelectControl.displayName = "ValidatedSelectControl";
23891
23892 // packages/dataviews/build-module/components/validated-form-controls/toggle-control.mjs
23893 var import_element71 = __toESM(require_element(), 1);
23894 var import_compose11 = __toESM(require_compose(), 1);
23895 var import_components9 = __toESM(require_components(), 1);
23896 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
23897 var UnforwardedValidatedToggleControl = ({
23898 required,
23899 customValidity,
23900 markWhenOptional,
23901 ...restProps
23902 }, forwardedRef) => {
23903 const validityTargetRef = (0, import_element71.useRef)(null);
23904 const mergedRefs = (0, import_compose11.useMergeRefs)([forwardedRef, validityTargetRef]);
23905 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
23906 ControlWithError,
23907 {
23908 className: "dataviews-validated-control",
23909 required,
23910 markWhenOptional,
23911 customValidity,
23912 getValidityTarget: () => validityTargetRef.current,
23913 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
23914 import_components9.ToggleControl,
23915 {
23916 ref: mergedRefs,
23917 required,
23918 ...restProps
23919 }
23920 )
23921 }
23922 );
23923 };
23924 var ValidatedToggleControl = (0, import_element71.forwardRef)(UnforwardedValidatedToggleControl);
23925 ValidatedToggleControl.displayName = "ValidatedToggleControl";
23926
23927 // packages/dataviews/build-module/components/validated-form-controls/toggle-group-control.mjs
23928 var import_element72 = __toESM(require_element(), 1);
23929 var import_components10 = __toESM(require_components(), 1);
23930 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
23931 var UnforwardedValidatedToggleGroupControl = ({
23932 required,
23933 customValidity,
23934 markWhenOptional,
23935 ...restProps
23936 }, forwardedRef) => {
23937 const validityTargetRef = (0, import_element72.useRef)(null);
23938 const nameAttr = (0, import_element72.useId)();
23939 return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "dataviews-validated-control__wrapper-with-error-delegate", children: [
23940 /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
23941 ControlWithError,
23942 {
23943 className: "dataviews-validated-control",
23944 required,
23945 markWhenOptional,
23946 customValidity,
23947 getValidityTarget: () => validityTargetRef.current,
23948 children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_components10.__experimentalToggleGroupControl, { ref: forwardedRef, ...restProps })
23949 }
23950 ),
23951 /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
23952 "input",
23953 {
23954 className: "dataviews-validated-control__error-delegate",
23955 type: "radio",
23956 ref: validityTargetRef,
23957 required,
23958 checked: restProps.value !== void 0,
23959 tabIndex: -1,
23960 name: nameAttr,
23961 onChange: () => {
23962 },
23963 onFocus: (e) => {
23964 e.target.previousElementSibling?.querySelector(
23965 '[data-active-item="true"]'
23966 )?.focus();
23967 }
23968 }
23969 )
23970 ] });
23971 };
23972 var ValidatedToggleGroupControl = (0, import_element72.forwardRef)(UnforwardedValidatedToggleGroupControl);
23973 ValidatedToggleGroupControl.displayName = "ValidatedToggleGroupControl";
23974
23975 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs
23976 function getCustomValidity(isValid2, validity) {
23977 let customValidity;
23978 if (isValid2?.required && validity?.required) {
23979 customValidity = validity.required.message ? {
23980 type: validity.required.type,
23981 message: validity.required.message
23982 } : void 0;
23983 } else if (isValid2?.pattern && validity?.pattern) {
23984 customValidity = validity.pattern;
23985 } else if (isValid2?.min && validity?.min) {
23986 customValidity = validity.min;
23987 } else if (isValid2?.max && validity?.max) {
23988 customValidity = validity.max;
23989 } else if (isValid2?.minLength && validity?.minLength) {
23990 customValidity = validity.minLength;
23991 } else if (isValid2?.maxLength && validity?.maxLength) {
23992 customValidity = validity.maxLength;
23993 } else if (isValid2?.elements && validity?.elements) {
23994 customValidity = validity.elements;
23995 } else if (validity?.custom) {
23996 customValidity = validity.custom;
23997 }
23998 return customValidity;
23999 }
24000
24001 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
24002 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
24003 function Checkbox({
24004 field,
24005 onChange,
24006 data,
24007 hideLabelFromVision,
24008 markWhenOptional,
24009 validity
24010 }) {
24011 const { getValue, setValue, label, description, isValid: isValid2 } = field;
24012 const disabled2 = field.isDisabled({ item: data, field });
24013 const onChangeControl = (0, import_element73.useCallback)(() => {
24014 onChange(
24015 setValue({ item: data, value: !getValue({ item: data }) })
24016 );
24017 }, [data, getValue, onChange, setValue]);
24018 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
24019 ValidatedCheckboxControl,
24020 {
24021 required: !!field.isValid?.required,
24022 markWhenOptional,
24023 customValidity: getCustomValidity(isValid2, validity),
24024 hidden: hideLabelFromVision,
24025 label,
24026 help: description,
24027 checked: getValue({ item: data }),
24028 onChange: onChangeControl,
24029 disabled: disabled2
24030 }
24031 );
24032 }
24033
24034 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs
24035 var import_components11 = __toESM(require_components(), 1);
24036 var import_element74 = __toESM(require_element(), 1);
24037 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
24038 function Combobox({
24039 data,
24040 field,
24041 onChange,
24042 hideLabelFromVision,
24043 validity
24044 }) {
24045 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field;
24046 const value = getValue({ item: data }) ?? "";
24047 const onChangeControl = (0, import_element74.useCallback)(
24048 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
24049 [data, onChange, setValue]
24050 );
24051 const { elements, isLoading } = useElements({
24052 elements: field.elements,
24053 getElements: field.getElements
24054 });
24055 if (isLoading) {
24056 return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_components11.Spinner, {});
24057 }
24058 return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
24059 ValidatedComboboxControl,
24060 {
24061 required: !!field.isValid?.required,
24062 customValidity: getCustomValidity(isValid2, validity),
24063 label,
24064 value,
24065 help: description,
24066 placeholder,
24067 options: elements,
24068 onChange: onChangeControl,
24069 hideLabelFromVision,
24070 allowReset: true,
24071 expandOnFocus: true
24072 }
24073 );
24074 }
24075
24076 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
24077 var import_components13 = __toESM(require_components(), 1);
24078 var import_element77 = __toESM(require_element(), 1);
24079 var import_i18n14 = __toESM(require_i18n(), 1);
24080 var import_date5 = __toESM(require_date(), 1);
24081 import { speak as speak2 } from "@wordpress/a11y";
24082
24083 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs
24084 var import_components12 = __toESM(require_components(), 1);
24085 var import_element75 = __toESM(require_element(), 1);
24086 var import_i18n12 = __toESM(require_i18n(), 1);
24087 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
24088 var TIME_UNITS_OPTIONS = {
24089 [OPERATOR_IN_THE_PAST]: [
24090 { value: "days", label: (0, import_i18n12.__)("Days") },
24091 { value: "weeks", label: (0, import_i18n12.__)("Weeks") },
24092 { value: "months", label: (0, import_i18n12.__)("Months") },
24093 { value: "years", label: (0, import_i18n12.__)("Years") }
24094 ],
24095 [OPERATOR_OVER]: [
24096 { value: "days", label: (0, import_i18n12.__)("Days ago") },
24097 { value: "weeks", label: (0, import_i18n12.__)("Weeks ago") },
24098 { value: "months", label: (0, import_i18n12.__)("Months ago") },
24099 { value: "years", label: (0, import_i18n12.__)("Years ago") }
24100 ]
24101 };
24102 function RelativeDateControl({
24103 className,
24104 data,
24105 field,
24106 onChange,
24107 hideLabelFromVision,
24108 operator
24109 }) {
24110 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
24111 const { id, label, description, getValue, setValue } = field;
24112 const disabled2 = field.isDisabled({ item: data, field });
24113 const fieldValue = getValue({ item: data });
24114 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
24115 const onChangeValue = (0, import_element75.useCallback)(
24116 (newValue) => onChange(
24117 setValue({
24118 item: data,
24119 value: { value: Number(newValue), unit }
24120 })
24121 ),
24122 [onChange, setValue, data, unit]
24123 );
24124 const onChangeUnit = (0, import_element75.useCallback)(
24125 (newUnit) => onChange(
24126 setValue({
24127 item: data,
24128 value: { value: relValue, unit: newUnit }
24129 })
24130 ),
24131 [onChange, setValue, data, relValue]
24132 );
24133 return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
24134 import_components12.BaseControl,
24135 {
24136 id,
24137 className: clsx_default(className, "dataviews-controls__relative-date"),
24138 label,
24139 hideLabelFromVision,
24140 help: description,
24141 children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Stack, { direction: "row", gap: "sm", children: [
24142 /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
24143 import_components12.__experimentalNumberControl,
24144 {
24145 className: "dataviews-controls__relative-date-number",
24146 spinControls: "none",
24147 min: 1,
24148 step: 1,
24149 value: relValue,
24150 onChange: onChangeValue,
24151 disabled: disabled2
24152 }
24153 ),
24154 /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
24155 import_components12.SelectControl,
24156 {
24157 className: "dataviews-controls__relative-date-unit",
24158 label: (0, import_i18n12.__)("Unit"),
24159 value: unit,
24160 options,
24161 onChange: onChangeUnit,
24162 hideLabelFromVision: true,
24163 disabled: disabled2
24164 }
24165 )
24166 ] })
24167 }
24168 );
24169 }
24170
24171 // packages/dataviews/build-module/components/dataform-controls/utils/to-calendar-date.mjs
24172 function toCalendarDate(date, timeZone) {
24173 return timeZone ? new TZDate(date, timeZone) : date;
24174 }
24175
24176 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs
24177 var import_element76 = __toESM(require_element(), 1);
24178 function useDisabledDateMatchers(isValid2, parseDateFn) {
24179 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
24180 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
24181 const disabledMatchers = (0, import_element76.useMemo)(() => {
24182 const matchers = [];
24183 if (minConstraint) {
24184 const minDate = parseDateFn(minConstraint);
24185 if (minDate) {
24186 matchers.push({ before: minDate });
24187 }
24188 }
24189 if (maxConstraint) {
24190 const maxDate = parseDateFn(maxConstraint);
24191 if (maxDate) {
24192 matchers.push({ after: maxDate });
24193 }
24194 }
24195 return matchers.length > 0 ? matchers : void 0;
24196 }, [minConstraint, maxConstraint, parseDateFn]);
24197 return { minConstraint, maxConstraint, disabledMatchers };
24198 }
24199
24200 // packages/dataviews/build-module/components/dataform-controls/utils/get-calendar-locale.mjs
24201 var LANGUAGE_ALIASES = {
24202 ary: "ar-MA",
24203 // Moroccan Arabic.
24204 haz: "fa"
24205 // Hazaragi, a variety of Persian.
24206 };
24207 function getCalendarLocale(wpLocale) {
24208 const subtags = wpLocale?.trim().split(/[_-]/) ?? [];
24209 const language = subtags.shift()?.toLowerCase();
24210 if (!language) {
24211 return void 0;
24212 }
24213 const normalized = [LANGUAGE_ALIASES[language] ?? language];
24214 for (const subtag of subtags) {
24215 if (/^[a-z]{4}$/i.test(subtag) || /^([a-z]{2}|\d{3})$/i.test(subtag)) {
24216 normalized.push(subtag);
24217 }
24218 }
24219 return normalized.join("-");
24220 }
24221
24222 // packages/dataviews/build-module/components/dataform-controls/utils/get-timezone-description.mjs
24223 var import_date3 = __toESM(require_date(), 1);
24224 var import_i18n13 = __toESM(require_i18n(), 1);
24225 function getTimezoneDescription() {
24226 const { timezone } = (0, import_date3.getSettings)();
24227 const userTimezoneOffset = -1 * ((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60);
24228 if (Number(timezone.offset) === userTimezoneOffset) {
24229 return void 0;
24230 }
24231 const offsetSymbol = Number(timezone.offset) >= 0 ? "+" : "";
24232 const zoneAbbr = "" !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`;
24233 const prettyTimezoneString = timezone.string.replaceAll("_", " ");
24234 let timezoneDetail = zoneAbbr;
24235 if ("UTC" === timezone.string) {
24236 timezoneDetail = (0, import_i18n13.__)("Coordinated Universal Time");
24237 } else if (prettyTimezoneString.trim().length > 0) {
24238 timezoneDetail = `(${zoneAbbr}) ${prettyTimezoneString}`;
24239 }
24240 return (0, import_i18n13.sprintf)(
24241 /* translators: %s: timezone detail, e.g. "(CEST) Europe/Madrid" or "UTC+3". */
24242 (0, import_i18n13.__)("Timezone: %s"),
24243 timezoneDetail
24244 );
24245 }
24246
24247 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs
24248 var import_date4 = __toESM(require_date(), 1);
24249 function parseDateTime(dateTimeString) {
24250 if (!dateTimeString) {
24251 return null;
24252 }
24253 const parsed = (0, import_date4.getDate)(dateTimeString);
24254 return parsed && isValid(parsed) ? parsed : null;
24255 }
24256
24257 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
24258 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
24259 var formatDateTime = (value) => {
24260 if (!value) {
24261 return "";
24262 }
24263 return (0, import_date5.dateI18n)("Y-m-d\\TH:i", (0, import_date5.getDate)(value));
24264 };
24265 function CalendarDateTimeControl({
24266 data,
24267 field,
24268 onChange,
24269 hideLabelFromVision,
24270 markWhenOptional,
24271 validity,
24272 config: config2
24273 }) {
24274 const { compact } = config2 || {};
24275 const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
24276 const disabled2 = field.isDisabled({ item: data, field });
24277 const fieldValue = getValue({ item: data });
24278 const value = typeof fieldValue === "string" ? fieldValue : void 0;
24279 const { timezone } = (0, import_date5.getSettings)();
24280 const timeZone = timezone.string || (0, import_date5.dateI18n)("P");
24281 const [calendarMonth, setCalendarMonth] = (0, import_element77.useState)(() => {
24282 const parsedDate = parseDateTime(value);
24283 return toCalendarDate(parsedDate || /* @__PURE__ */ new Date(), timeZone);
24284 });
24285 (0, import_element77.useEffect)(() => {
24286 const parsedDate = parseDateTime(value);
24287 if (parsedDate) {
24288 const targetMonth = toCalendarDate(parsedDate, timeZone);
24289 setCalendarMonth(
24290 (currentMonth) => isSameMonth(
24291 targetMonth,
24292 toCalendarDate(currentMonth, timeZone)
24293 ) ? currentMonth : targetMonth
24294 );
24295 }
24296 }, [timeZone, value]);
24297 const inputControlRef = (0, import_element77.useRef)(null);
24298 const validationTimeoutRef = (0, import_element77.useRef)(void 0);
24299 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime);
24300 const onChangeCallback = (0, import_element77.useCallback)(
24301 (newValue) => onChange(setValue({ item: data, value: newValue })),
24302 [data, onChange, setValue]
24303 );
24304 (0, import_element77.useEffect)(() => {
24305 return () => clearTimeout(validationTimeoutRef.current);
24306 }, []);
24307 const onSelectDate = (0, import_element77.useCallback)(
24308 (newDate) => {
24309 if (newDate) {
24310 const wpDate = (0, import_date5.dateI18n)("Y-m-d", newDate);
24311 const wpTime = value ? (0, import_date5.dateI18n)("H:i", (0, import_date5.getDate)(value)) : "00:00";
24312 const finalDateTime = (0, import_date5.getDate)(`${wpDate}T${wpTime}`);
24313 onChangeCallback(finalDateTime.toISOString());
24314 } else {
24315 onChangeCallback(void 0);
24316 }
24317 clearTimeout(validationTimeoutRef.current);
24318 validationTimeoutRef.current = setTimeout(() => {
24319 const input = inputControlRef.current;
24320 if (!input) {
24321 return;
24322 }
24323 input.dispatchEvent(
24324 new Event("invalid", { cancelable: true })
24325 );
24326 if (input.validationMessage) {
24327 speak2(input.validationMessage);
24328 }
24329 }, 0);
24330 },
24331 [onChangeCallback, value]
24332 );
24333 const handleManualDateTimeChange = (0, import_element77.useCallback)(
24334 (newValue) => {
24335 if (newValue) {
24336 const dateTime = (0, import_date5.getDate)(newValue);
24337 onChangeCallback(dateTime.toISOString());
24338 const parsedDate = parseDateTime(dateTime.toISOString());
24339 if (parsedDate) {
24340 setCalendarMonth(toCalendarDate(parsedDate, timeZone));
24341 }
24342 } else {
24343 onChangeCallback(void 0);
24344 }
24345 },
24346 [onChangeCallback, timeZone]
24347 );
24348 const { format: fieldFormat } = field;
24349 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek;
24350 const locale = getCalendarLocale((0, import_date5.getSettings)().l10n.locale);
24351 let displayLabel = label;
24352 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) {
24353 displayLabel = `${label} (${(0, import_i18n14.__)("Required")})`;
24354 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) {
24355 displayLabel = `${label} (${(0, import_i18n14.__)("Optional")})`;
24356 }
24357 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
24358 import_components13.BaseControl,
24359 {
24360 id,
24361 label: displayLabel,
24362 help: description,
24363 hideLabelFromVision,
24364 children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24365 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
24366 ValidatedInputControl,
24367 {
24368 ref: inputControlRef,
24369 required: !!isValid2?.required,
24370 customValidity: getCustomValidity(isValid2, validity),
24371 type: "datetime-local",
24372 label: (0, import_i18n14.__)("Date time"),
24373 hideLabelFromVision: true,
24374 value: formatDateTime(value),
24375 onValueChange: handleManualDateTimeChange,
24376 disabled: disabled2,
24377 description: getTimezoneDescription(),
24378 min: minConstraint ? formatDateTime(minConstraint) : void 0,
24379 max: maxConstraint ? formatDateTime(maxConstraint) : void 0
24380 }
24381 ),
24382 !compact && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
24383 Calendar,
24384 {
24385 style: { width: "100%" },
24386 value: value ? parseDateTime(value) : null,
24387 onValueChange: onSelectDate,
24388 month: calendarMonth,
24389 onMonthChange: setCalendarMonth,
24390 timeZone,
24391 locale,
24392 dir: (0, import_i18n14.isRTL)() ? "rtl" : "ltr",
24393 weekStartsOn,
24394 disabled: disabled2 || disabledMatchers
24395 }
24396 )
24397 ] })
24398 }
24399 );
24400 }
24401 function DateTime({
24402 data,
24403 field,
24404 onChange,
24405 hideLabelFromVision,
24406 markWhenOptional,
24407 operator,
24408 validity,
24409 config: config2
24410 }) {
24411 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
24412 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
24413 RelativeDateControl,
24414 {
24415 className: "dataviews-controls__datetime",
24416 data,
24417 field,
24418 onChange,
24419 hideLabelFromVision,
24420 operator
24421 }
24422 );
24423 }
24424 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
24425 CalendarDateTimeControl,
24426 {
24427 data,
24428 field,
24429 onChange,
24430 hideLabelFromVision,
24431 markWhenOptional,
24432 validity,
24433 config: config2
24434 }
24435 );
24436 }
24437
24438 // packages/dataviews/build-module/components/dataform-controls/date.mjs
24439 var import_components14 = __toESM(require_components(), 1);
24440 var import_element78 = __toESM(require_element(), 1);
24441 var import_i18n15 = __toESM(require_i18n(), 1);
24442 var import_date6 = __toESM(require_date(), 1);
24443 import { speak as speak3 } from "@wordpress/a11y";
24444 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
24445 var DATE_PRESETS = [
24446 {
24447 id: "today",
24448 label: (0, import_i18n15.__)("Today"),
24449 getValue: () => (0, import_date6.getDate)(null)
24450 },
24451 {
24452 id: "yesterday",
24453 label: (0, import_i18n15.__)("Yesterday"),
24454 getValue: () => {
24455 const today = (0, import_date6.getDate)(null);
24456 return subDays(today, 1);
24457 }
24458 },
24459 {
24460 id: "past-week",
24461 label: (0, import_i18n15.__)("Past week"),
24462 getValue: () => {
24463 const today = (0, import_date6.getDate)(null);
24464 return subDays(today, 7);
24465 }
24466 },
24467 {
24468 id: "past-month",
24469 label: (0, import_i18n15.__)("Past month"),
24470 getValue: () => {
24471 const today = (0, import_date6.getDate)(null);
24472 return subMonths(today, 1);
24473 }
24474 }
24475 ];
24476 var DATE_RANGE_PRESETS = [
24477 {
24478 id: "last-7-days",
24479 label: (0, import_i18n15.__)("Last 7 days"),
24480 getValue: () => {
24481 const today = (0, import_date6.getDate)(null);
24482 return [subDays(today, 7), today];
24483 }
24484 },
24485 {
24486 id: "last-30-days",
24487 label: (0, import_i18n15.__)("Last 30 days"),
24488 getValue: () => {
24489 const today = (0, import_date6.getDate)(null);
24490 return [subDays(today, 30), today];
24491 }
24492 },
24493 {
24494 id: "month-to-date",
24495 label: (0, import_i18n15.__)("Month to date"),
24496 getValue: () => {
24497 const today = (0, import_date6.getDate)(null);
24498 return [startOfMonth(today), today];
24499 }
24500 },
24501 {
24502 id: "last-year",
24503 label: (0, import_i18n15.__)("Last year"),
24504 getValue: () => {
24505 const today = (0, import_date6.getDate)(null);
24506 return [subYears(today, 1), today];
24507 }
24508 },
24509 {
24510 id: "year-to-date",
24511 label: (0, import_i18n15.__)("Year to date"),
24512 getValue: () => {
24513 const today = (0, import_date6.getDate)(null);
24514 return [startOfYear(today), today];
24515 }
24516 }
24517 ];
24518 var parseDate2 = (dateString) => {
24519 if (!dateString) {
24520 return null;
24521 }
24522 const parsed = parseISO(dateString);
24523 return isValid(parsed) ? parsed : null;
24524 };
24525 var formatDate = (date) => {
24526 if (!date) {
24527 return "";
24528 }
24529 return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
24530 };
24531 function ValidatedDateControl({
24532 field,
24533 validity,
24534 inputRefs,
24535 isTouched,
24536 setIsTouched,
24537 children
24538 }) {
24539 const { isValid: isValid2 } = field;
24540 const [customValidity, setCustomValidity] = (0, import_element78.useState)(void 0);
24541 const validateRefs = (0, import_element78.useCallback)(() => {
24542 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
24543 for (const ref of refs) {
24544 const input = ref.current;
24545 if (input && !input.validity.valid) {
24546 setCustomValidity({
24547 type: "invalid",
24548 message: input.validationMessage
24549 });
24550 return;
24551 }
24552 }
24553 setCustomValidity(void 0);
24554 }, [inputRefs]);
24555 (0, import_element78.useEffect)(() => {
24556 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
24557 const result = validity ? getCustomValidity(isValid2, validity) : void 0;
24558 for (const ref of refs) {
24559 const input = ref.current;
24560 if (input) {
24561 input.setCustomValidity(
24562 result?.type === "invalid" && result.message ? result.message : ""
24563 );
24564 }
24565 }
24566 }, [inputRefs, isValid2, validity]);
24567 (0, import_element78.useEffect)(() => {
24568 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
24569 const handleInvalid = (event) => {
24570 event.preventDefault();
24571 setIsTouched(true);
24572 };
24573 for (const ref of refs) {
24574 ref.current?.addEventListener("invalid", handleInvalid);
24575 }
24576 return () => {
24577 for (const ref of refs) {
24578 ref.current?.removeEventListener("invalid", handleInvalid);
24579 }
24580 };
24581 }, [inputRefs, setIsTouched]);
24582 (0, import_element78.useEffect)(() => {
24583 if (!isTouched) {
24584 return;
24585 }
24586 const result = validity ? getCustomValidity(isValid2, validity) : void 0;
24587 if (result) {
24588 setCustomValidity(result);
24589 } else {
24590 validateRefs();
24591 }
24592 }, [isTouched, isValid2, validity, validateRefs]);
24593 (0, import_element78.useEffect)(() => {
24594 if (isTouched && customValidity?.message) {
24595 speak3(customValidity.message);
24596 }
24597 }, [isTouched, customValidity?.message]);
24598 const onBlur = (event) => {
24599 if (isTouched) {
24600 return;
24601 }
24602 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
24603 setIsTouched(true);
24604 }
24605 };
24606 return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Stack, { direction: "column", gap: "sm", onBlur, children: [
24607 children,
24608 customValidity && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24609 ValidityIndicator,
24610 {
24611 type: customValidity.type,
24612 message: customValidity.message
24613 }
24614 )
24615 ] });
24616 }
24617 function CalendarDateControl({
24618 data,
24619 field,
24620 onChange,
24621 hideLabelFromVision,
24622 markWhenOptional,
24623 validity
24624 }) {
24625 const {
24626 id,
24627 label,
24628 description,
24629 setValue,
24630 getValue,
24631 isValid: isValid2,
24632 format: fieldFormat
24633 } = field;
24634 const disabled2 = field.isDisabled({ item: data, field });
24635 const [selectedPresetId, setSelectedPresetId] = (0, import_element78.useState)(
24636 null
24637 );
24638 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek;
24639 const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale);
24640 const fieldValue = getValue({ item: data });
24641 const value = typeof fieldValue === "string" ? fieldValue : void 0;
24642 const [calendarMonth, setCalendarMonth] = (0, import_element78.useState)(() => {
24643 const parsedDate = parseDate2(value);
24644 return parsedDate || /* @__PURE__ */ new Date();
24645 });
24646 (0, import_element78.useEffect)(() => {
24647 const parsedDate = parseDate2(value);
24648 if (parsedDate) {
24649 setCalendarMonth(
24650 (currentMonth) => isSameMonth(parsedDate, currentMonth) ? currentMonth : parsedDate
24651 );
24652 }
24653 }, [value]);
24654 const [isTouched, setIsTouched] = (0, import_element78.useState)(false);
24655 const validityTargetRef = (0, import_element78.useRef)(null);
24656 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2);
24657 const onChangeCallback = (0, import_element78.useCallback)(
24658 (newValue) => onChange(setValue({ item: data, value: newValue })),
24659 [data, onChange, setValue]
24660 );
24661 const onSelectDate = (0, import_element78.useCallback)(
24662 (newDate) => {
24663 const dateValue = newDate ? formatDate(newDate) : void 0;
24664 onChangeCallback(dateValue);
24665 setSelectedPresetId(null);
24666 setIsTouched(true);
24667 },
24668 [onChangeCallback]
24669 );
24670 const handlePresetClick = (0, import_element78.useCallback)(
24671 (preset) => {
24672 const presetDate = preset.getValue();
24673 const dateValue = formatDate(presetDate);
24674 setCalendarMonth(presetDate);
24675 onChangeCallback(dateValue);
24676 setSelectedPresetId(preset.id);
24677 setIsTouched(true);
24678 },
24679 [onChangeCallback]
24680 );
24681 const handleManualDateChange = (0, import_element78.useCallback)(
24682 (newValue) => {
24683 onChangeCallback(newValue);
24684 if (newValue) {
24685 const parsedDate = parseDate2(newValue);
24686 if (parsedDate) {
24687 setCalendarMonth(parsedDate);
24688 }
24689 }
24690 setSelectedPresetId(null);
24691 setIsTouched(true);
24692 },
24693 [onChangeCallback]
24694 );
24695 let displayLabel = label;
24696 if (isValid2?.required && !markWhenOptional) {
24697 displayLabel = `${label} (${(0, import_i18n15.__)("Required")})`;
24698 } else if (!isValid2?.required && markWhenOptional) {
24699 displayLabel = `${label} (${(0, import_i18n15.__)("Optional")})`;
24700 }
24701 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24702 ValidatedDateControl,
24703 {
24704 field,
24705 validity,
24706 inputRefs: validityTargetRef,
24707 isTouched,
24708 setIsTouched,
24709 children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24710 import_components14.BaseControl,
24711 {
24712 id,
24713 className: "dataviews-controls__date",
24714 label: displayLabel,
24715 help: description,
24716 hideLabelFromVision,
24717 children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24718 /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
24719 Stack,
24720 {
24721 direction: "row",
24722 gap: "sm",
24723 wrap: "wrap",
24724 justify: "flex-start",
24725 children: [
24726 DATE_PRESETS.map((preset) => {
24727 const isSelected = selectedPresetId === preset.id;
24728 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24729 import_components14.Button,
24730 {
24731 className: "dataviews-controls__date-preset",
24732 variant: "tertiary",
24733 isPressed: isSelected,
24734 size: "small",
24735 disabled: disabled2,
24736 accessibleWhenDisabled: true,
24737 onClick: () => handlePresetClick(preset),
24738 children: preset.label
24739 },
24740 preset.id
24741 );
24742 }),
24743 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24744 import_components14.Button,
24745 {
24746 className: "dataviews-controls__date-preset",
24747 variant: "tertiary",
24748 isPressed: !selectedPresetId,
24749 size: "small",
24750 disabled: !!selectedPresetId || disabled2,
24751 accessibleWhenDisabled: true,
24752 children: (0, import_i18n15.__)("Custom")
24753 }
24754 )
24755 ]
24756 }
24757 ),
24758 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24759 import_components14.__experimentalInputControl,
24760 {
24761 ref: validityTargetRef,
24762 type: "date",
24763 label: (0, import_i18n15.__)("Date"),
24764 hideLabelFromVision: true,
24765 value,
24766 onChange: handleManualDateChange,
24767 required: !!field.isValid?.required,
24768 disabled: disabled2,
24769 min: minConstraint,
24770 max: maxConstraint
24771 }
24772 ),
24773 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24774 Calendar,
24775 {
24776 style: { width: "100%" },
24777 value: value ? parseDate2(value) : null,
24778 onValueChange: onSelectDate,
24779 month: calendarMonth,
24780 onMonthChange: setCalendarMonth,
24781 locale,
24782 dir: (0, import_i18n15.isRTL)() ? "rtl" : "ltr",
24783 weekStartsOn,
24784 disabled: disabled2 || disabledMatchers,
24785 disableNavigation: disabled2
24786 }
24787 )
24788 ] })
24789 }
24790 )
24791 }
24792 );
24793 }
24794 function CalendarDateRangeControl({
24795 data,
24796 field,
24797 onChange,
24798 hideLabelFromVision,
24799 markWhenOptional,
24800 validity
24801 }) {
24802 const {
24803 id,
24804 label,
24805 description,
24806 getValue,
24807 setValue,
24808 isValid: isValid2,
24809 format: fieldFormat
24810 } = field;
24811 const disabled2 = field.isDisabled({ item: data, field });
24812 let value;
24813 const fieldValue = getValue({ item: data });
24814 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
24815 value = fieldValue;
24816 }
24817 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek;
24818 const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale);
24819 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2);
24820 const onChangeCallback = (0, import_element78.useCallback)(
24821 (newValue) => {
24822 onChange(
24823 setValue({
24824 item: data,
24825 value: newValue
24826 })
24827 );
24828 },
24829 [data, onChange, setValue]
24830 );
24831 const [selectedPresetId, setSelectedPresetId] = (0, import_element78.useState)(
24832 null
24833 );
24834 const selectedRange = (0, import_element78.useMemo)(() => {
24835 if (!value) {
24836 return null;
24837 }
24838 const [from, to2] = value;
24839 return {
24840 from: parseDate2(from) || void 0,
24841 to: parseDate2(to2) || void 0
24842 };
24843 }, [value]);
24844 const [calendarMonth, setCalendarMonth] = (0, import_element78.useState)(() => {
24845 return selectedRange?.from || /* @__PURE__ */ new Date();
24846 });
24847 const [fromValue, toValue] = value ?? [];
24848 (0, import_element78.useEffect)(() => {
24849 setCalendarMonth((currentMonth) => {
24850 const from = parseDate2(fromValue);
24851 const to2 = parseDate2(toValue);
24852 const targetMonth = from ?? to2;
24853 const isRangeVisible = from && to2 ? areIntervalsOverlapping(
24854 { start: from, end: to2 },
24855 {
24856 start: startOfMonth(currentMonth),
24857 end: endOfMonth(currentMonth)
24858 },
24859 { inclusive: true }
24860 ) : [from, to2].some(
24861 (date) => date && isSameMonth(date, currentMonth)
24862 );
24863 return targetMonth && !isRangeVisible ? targetMonth : currentMonth;
24864 });
24865 }, [fromValue, toValue]);
24866 const [isTouched, setIsTouched] = (0, import_element78.useState)(false);
24867 const fromInputRef = (0, import_element78.useRef)(null);
24868 const toInputRef = (0, import_element78.useRef)(null);
24869 const updateDateRange = (0, import_element78.useCallback)(
24870 (fromDate, toDate2) => {
24871 if (!fromDate && !toDate2) {
24872 onChangeCallback(void 0);
24873 return;
24874 }
24875 onChangeCallback([
24876 formatDate(fromDate),
24877 formatDate(toDate2)
24878 ]);
24879 },
24880 [onChangeCallback]
24881 );
24882 const onSelectCalendarRange = (0, import_element78.useCallback)(
24883 (newRange) => {
24884 updateDateRange(newRange?.from, newRange?.to);
24885 setSelectedPresetId(null);
24886 setIsTouched(true);
24887 },
24888 [updateDateRange]
24889 );
24890 const handlePresetClick = (0, import_element78.useCallback)(
24891 (preset) => {
24892 const [startDate, endDate] = preset.getValue();
24893 setCalendarMonth(startDate);
24894 updateDateRange(startDate, endDate);
24895 setSelectedPresetId(preset.id);
24896 setIsTouched(true);
24897 },
24898 [updateDateRange]
24899 );
24900 const handleManualDateChange = (0, import_element78.useCallback)(
24901 (fromOrTo, newValue) => {
24902 const [currentFrom, currentTo] = value || [
24903 void 0,
24904 void 0
24905 ];
24906 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
24907 const updatedTo = fromOrTo === "to" ? newValue : currentTo;
24908 updateDateRange(updatedFrom, updatedTo);
24909 if (newValue) {
24910 const parsedDate = parseDate2(newValue);
24911 if (parsedDate) {
24912 setCalendarMonth(parsedDate);
24913 }
24914 }
24915 setSelectedPresetId(null);
24916 setIsTouched(true);
24917 },
24918 [value, updateDateRange]
24919 );
24920 let displayLabel = label;
24921 if (field.isValid?.required && !markWhenOptional) {
24922 displayLabel = `${label} (${(0, import_i18n15.__)("Required")})`;
24923 } else if (!field.isValid?.required && markWhenOptional) {
24924 displayLabel = `${label} (${(0, import_i18n15.__)("Optional")})`;
24925 }
24926 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24927 ValidatedDateControl,
24928 {
24929 field,
24930 validity,
24931 inputRefs: [fromInputRef, toInputRef],
24932 isTouched,
24933 setIsTouched,
24934 children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24935 import_components14.BaseControl,
24936 {
24937 id,
24938 className: "dataviews-controls__date",
24939 label: displayLabel,
24940 help: description,
24941 hideLabelFromVision,
24942 children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24943 /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
24944 Stack,
24945 {
24946 direction: "row",
24947 gap: "sm",
24948 wrap: "wrap",
24949 justify: "flex-start",
24950 children: [
24951 DATE_RANGE_PRESETS.map((preset) => {
24952 const isSelected = selectedPresetId === preset.id;
24953 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24954 import_components14.Button,
24955 {
24956 className: "dataviews-controls__date-preset",
24957 variant: "tertiary",
24958 isPressed: isSelected,
24959 size: "small",
24960 disabled: disabled2,
24961 accessibleWhenDisabled: true,
24962 onClick: () => handlePresetClick(preset),
24963 children: preset.label
24964 },
24965 preset.id
24966 );
24967 }),
24968 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24969 import_components14.Button,
24970 {
24971 className: "dataviews-controls__date-preset",
24972 variant: "tertiary",
24973 isPressed: !selectedPresetId,
24974 size: "small",
24975 accessibleWhenDisabled: true,
24976 disabled: !!selectedPresetId || disabled2,
24977 children: (0, import_i18n15.__)("Custom")
24978 }
24979 )
24980 ]
24981 }
24982 ),
24983 /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
24984 Stack,
24985 {
24986 direction: "row",
24987 gap: "sm",
24988 justify: "space-between",
24989 className: "dataviews-controls__date-range-inputs",
24990 children: [
24991 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
24992 import_components14.__experimentalInputControl,
24993 {
24994 ref: fromInputRef,
24995 type: "date",
24996 label: (0, import_i18n15.__)("From"),
24997 hideLabelFromVision: true,
24998 value: value?.[0],
24999 onChange: (newValue) => handleManualDateChange("from", newValue),
25000 required: !!field.isValid?.required,
25001 disabled: disabled2,
25002 min: minConstraint,
25003 max: maxConstraint
25004 }
25005 ),
25006 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
25007 import_components14.__experimentalInputControl,
25008 {
25009 ref: toInputRef,
25010 type: "date",
25011 label: (0, import_i18n15.__)("To"),
25012 hideLabelFromVision: true,
25013 value: value?.[1],
25014 onChange: (newValue) => handleManualDateChange("to", newValue),
25015 required: !!field.isValid?.required,
25016 disabled: disabled2,
25017 min: minConstraint,
25018 max: maxConstraint
25019 }
25020 )
25021 ]
25022 }
25023 ),
25024 /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
25025 RangeCalendar,
25026 {
25027 style: { width: "100%" },
25028 value: selectedRange,
25029 onValueChange: onSelectCalendarRange,
25030 month: calendarMonth,
25031 onMonthChange: setCalendarMonth,
25032 locale,
25033 dir: (0, import_i18n15.isRTL)() ? "rtl" : "ltr",
25034 weekStartsOn,
25035 disabled: disabled2 || disabledMatchers
25036 }
25037 )
25038 ] })
25039 }
25040 )
25041 }
25042 );
25043 }
25044 function DateControl({
25045 data,
25046 field,
25047 onChange,
25048 hideLabelFromVision,
25049 markWhenOptional,
25050 operator,
25051 validity
25052 }) {
25053 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
25054 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
25055 RelativeDateControl,
25056 {
25057 className: "dataviews-controls__date",
25058 data,
25059 field,
25060 onChange,
25061 hideLabelFromVision,
25062 operator
25063 }
25064 );
25065 }
25066 if (operator === OPERATOR_BETWEEN) {
25067 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
25068 CalendarDateRangeControl,
25069 {
25070 data,
25071 field,
25072 onChange,
25073 hideLabelFromVision,
25074 markWhenOptional,
25075 validity
25076 }
25077 );
25078 }
25079 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
25080 CalendarDateControl,
25081 {
25082 data,
25083 field,
25084 onChange,
25085 hideLabelFromVision,
25086 markWhenOptional,
25087 validity
25088 }
25089 );
25090 }
25091
25092 // packages/dataviews/build-module/components/dataform-controls/select.mjs
25093 var import_components15 = __toESM(require_components(), 1);
25094 var import_element79 = __toESM(require_element(), 1);
25095 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
25096 function Select2({
25097 data,
25098 field,
25099 onChange,
25100 hideLabelFromVision,
25101 markWhenOptional,
25102 validity
25103 }) {
25104 const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
25105 const disabled2 = field.isDisabled({ item: data, field });
25106 const isMultiple = type === "array";
25107 const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
25108 const onChangeControl = (0, import_element79.useCallback)(
25109 (newValue) => onChange(setValue({ item: data, value: newValue })),
25110 [data, onChange, setValue]
25111 );
25112 const { elements, isLoading } = useElements({
25113 elements: field.elements,
25114 getElements: field.getElements
25115 });
25116 if (isLoading) {
25117 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components15.Spinner, {});
25118 }
25119 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
25120 ValidatedSelectControl,
25121 {
25122 required: !!field.isValid?.required,
25123 markWhenOptional,
25124 customValidity: getCustomValidity(isValid2, validity),
25125 label,
25126 value,
25127 help: description,
25128 options: elements,
25129 onChange: onChangeControl,
25130 hideLabelFromVision,
25131 multiple: isMultiple,
25132 disabled: disabled2
25133 }
25134 );
25135 }
25136
25137 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs
25138 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
25139 var ELEMENTS_THRESHOLD = 10;
25140 function AdaptiveSelect(props) {
25141 const { field } = props;
25142 const { elements } = useElements({
25143 elements: field.elements,
25144 getElements: field.getElements
25145 });
25146 if (elements.length >= ELEMENTS_THRESHOLD) {
25147 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Combobox, { ...props });
25148 }
25149 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Select2, { ...props });
25150 }
25151
25152 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs
25153 var import_element80 = __toESM(require_element(), 1);
25154 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
25155 function ValidatedText({
25156 data,
25157 field,
25158 onChange,
25159 hideLabelFromVision,
25160 markWhenOptional,
25161 type,
25162 prefix: prefix2,
25163 suffix,
25164 validity
25165 }) {
25166 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25167 const value = getValue({ item: data });
25168 const disabled2 = field.isDisabled({ item: data, field });
25169 const onValueChangeControl = (0, import_element80.useCallback)(
25170 (newValue) => onChange(
25171 setValue({
25172 item: data,
25173 value: newValue
25174 })
25175 ),
25176 [data, setValue, onChange]
25177 );
25178 return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
25179 ValidatedInputControl,
25180 {
25181 required: !!isValid2.required,
25182 markWhenOptional,
25183 customValidity: getCustomValidity(isValid2, validity),
25184 label,
25185 placeholder,
25186 value: value ?? "",
25187 description: typeof description === "string" ? description : void 0,
25188 details: typeof description === "string" ? void 0 : description,
25189 onValueChange: onValueChangeControl,
25190 hideLabelFromVision,
25191 type,
25192 prefix: prefix2,
25193 suffix,
25194 disabled: disabled2,
25195 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
25196 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
25197 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0
25198 }
25199 );
25200 }
25201
25202 // packages/dataviews/build-module/components/dataform-controls/email.mjs
25203 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
25204 function Email({
25205 data,
25206 field,
25207 onChange,
25208 hideLabelFromVision,
25209 markWhenOptional,
25210 validity
25211 }) {
25212 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
25213 ValidatedText,
25214 {
25215 ...{
25216 data,
25217 field,
25218 onChange,
25219 hideLabelFromVision,
25220 markWhenOptional,
25221 validity,
25222 type: "email",
25223 prefix: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Icon, { icon: envelope_default }) })
25224 }
25225 }
25226 );
25227 }
25228
25229 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs
25230 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
25231 function Telephone({
25232 data,
25233 field,
25234 onChange,
25235 hideLabelFromVision,
25236 markWhenOptional,
25237 validity
25238 }) {
25239 return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
25240 ValidatedText,
25241 {
25242 ...{
25243 data,
25244 field,
25245 onChange,
25246 hideLabelFromVision,
25247 markWhenOptional,
25248 validity,
25249 type: "tel",
25250 prefix: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Icon, { icon: mobile_default }) })
25251 }
25252 }
25253 );
25254 }
25255
25256 // packages/dataviews/build-module/components/dataform-controls/url.mjs
25257 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
25258 function Url({
25259 data,
25260 field,
25261 onChange,
25262 hideLabelFromVision,
25263 markWhenOptional,
25264 validity
25265 }) {
25266 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
25267 ValidatedText,
25268 {
25269 ...{
25270 data,
25271 field,
25272 onChange,
25273 hideLabelFromVision,
25274 markWhenOptional,
25275 validity,
25276 type: "url",
25277 prefix: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Icon, { icon: link_default }) })
25278 }
25279 }
25280 );
25281 }
25282
25283 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs
25284 var import_components16 = __toESM(require_components(), 1);
25285 var import_element81 = __toESM(require_element(), 1);
25286 var import_i18n16 = __toESM(require_i18n(), 1);
25287 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
25288 function toNumberOrEmpty(value) {
25289 if (value === "" || value === void 0) {
25290 return "";
25291 }
25292 const number = Number(value);
25293 return Number.isFinite(number) ? number : "";
25294 }
25295 function BetweenControls({
25296 value,
25297 onChange,
25298 hideLabelFromVision,
25299 step
25300 }) {
25301 const [min3 = "", max3 = ""] = value;
25302 const onChangeMin = (0, import_element81.useCallback)(
25303 (newValue) => onChange([toNumberOrEmpty(newValue), max3]),
25304 [onChange, max3]
25305 );
25306 const onChangeMax = (0, import_element81.useCallback)(
25307 (newValue) => onChange([min3, toNumberOrEmpty(newValue)]),
25308 [onChange, min3]
25309 );
25310 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
25311 import_components16.BaseControl,
25312 {
25313 help: (0, import_i18n16.__)("The max. value must be greater than the min. value."),
25314 children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_components16.Flex, { direction: "row", gap: 4, children: [
25315 /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
25316 import_components16.__experimentalNumberControl,
25317 {
25318 label: (0, import_i18n16.__)("Min."),
25319 value: min3,
25320 max: max3 ? Number(max3) - step : void 0,
25321 onChange: onChangeMin,
25322 hideLabelFromVision,
25323 step
25324 }
25325 ),
25326 /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
25327 import_components16.__experimentalNumberControl,
25328 {
25329 label: (0, import_i18n16.__)("Max."),
25330 value: max3,
25331 min: min3 ? Number(min3) + step : void 0,
25332 onChange: onChangeMax,
25333 hideLabelFromVision,
25334 step
25335 }
25336 )
25337 ] })
25338 }
25339 );
25340 }
25341 function ValidatedNumber({
25342 data,
25343 field,
25344 onChange,
25345 hideLabelFromVision,
25346 markWhenOptional,
25347 operator,
25348 validity
25349 }) {
25350 const decimals = field.format?.decimals ?? 0;
25351 const step = Math.pow(10, Math.abs(decimals) * -1);
25352 const { label, description, getValue, setValue, isValid: isValid2 } = field;
25353 const value = getValue({ item: data }) ?? "";
25354 const disabled2 = field.isDisabled({ item: data, field });
25355 const onChangeControl = (0, import_element81.useCallback)(
25356 (newValue) => {
25357 onChange(
25358 setValue({
25359 item: data,
25360 // Do not convert an empty string or undefined to a number,
25361 // otherwise there's a mismatch between the UI control (empty)
25362 // and the data relied by onChange (0).
25363 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
25364 })
25365 );
25366 },
25367 [data, onChange, setValue]
25368 );
25369 const onChangeBetweenControls = (0, import_element81.useCallback)(
25370 (newValue) => {
25371 onChange(
25372 setValue({
25373 item: data,
25374 value: newValue
25375 })
25376 );
25377 },
25378 [data, onChange, setValue]
25379 );
25380 if (operator === OPERATOR_BETWEEN) {
25381 let valueBetween = ["", ""];
25382 if (Array.isArray(value) && value.length === 2 && value.every(
25383 (element) => typeof element === "number" || element === ""
25384 )) {
25385 valueBetween = value;
25386 }
25387 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
25388 BetweenControls,
25389 {
25390 value: valueBetween,
25391 onChange: onChangeBetweenControls,
25392 hideLabelFromVision,
25393 step
25394 }
25395 );
25396 }
25397 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
25398 ValidatedNumberControl,
25399 {
25400 required: !!isValid2.required,
25401 markWhenOptional,
25402 customValidity: getCustomValidity(isValid2, validity),
25403 label,
25404 help: description,
25405 value,
25406 onChange: onChangeControl,
25407 hideLabelFromVision,
25408 step,
25409 min: typeof isValid2.min?.constraint === "number" ? isValid2.min.constraint : void 0,
25410 max: typeof isValid2.max?.constraint === "number" ? isValid2.max.constraint : void 0,
25411 disabled: disabled2
25412 }
25413 );
25414 }
25415
25416 // packages/dataviews/build-module/components/dataform-controls/integer.mjs
25417 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
25418 function Integer(props) {
25419 return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(ValidatedNumber, { ...props });
25420 }
25421
25422 // packages/dataviews/build-module/components/dataform-controls/number.mjs
25423 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
25424 function Number2(props) {
25425 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(ValidatedNumber, { ...props });
25426 }
25427
25428 // packages/dataviews/build-module/components/dataform-controls/radio.mjs
25429 var import_components17 = __toESM(require_components(), 1);
25430 var import_element82 = __toESM(require_element(), 1);
25431 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
25432 function Radio({
25433 data,
25434 field,
25435 onChange,
25436 hideLabelFromVision,
25437 markWhenOptional,
25438 validity
25439 }) {
25440 const { label, description, getValue, setValue, isValid: isValid2 } = field;
25441 const disabled2 = field.isDisabled({ item: data, field });
25442 const { elements, isLoading } = useElements({
25443 elements: field.elements,
25444 getElements: field.getElements
25445 });
25446 const value = getValue({ item: data });
25447 const onChangeControl = (0, import_element82.useCallback)(
25448 (newValue) => onChange(setValue({ item: data, value: newValue })),
25449 [data, onChange, setValue]
25450 );
25451 if (isLoading) {
25452 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_components17.Spinner, {});
25453 }
25454 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
25455 ValidatedRadioControl,
25456 {
25457 required: !!field.isValid?.required,
25458 markWhenOptional,
25459 customValidity: getCustomValidity(isValid2, validity),
25460 label,
25461 help: description,
25462 onChange: onChangeControl,
25463 options: elements,
25464 selected: value,
25465 hideLabelFromVision,
25466 disabled: disabled2
25467 }
25468 );
25469 }
25470
25471 // packages/dataviews/build-module/components/dataform-controls/text.mjs
25472 var import_element83 = __toESM(require_element(), 1);
25473 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
25474 function Text3({
25475 data,
25476 field,
25477 onChange,
25478 hideLabelFromVision,
25479 markWhenOptional,
25480 config: config2,
25481 validity
25482 }) {
25483 const { prefix: prefix2, suffix } = config2 || {};
25484 return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
25485 ValidatedText,
25486 {
25487 ...{
25488 data,
25489 field,
25490 onChange,
25491 hideLabelFromVision,
25492 markWhenOptional,
25493 validity,
25494 prefix: prefix2 ? (0, import_element83.createElement)(prefix2) : void 0,
25495 suffix: suffix ? (0, import_element83.createElement)(suffix) : void 0
25496 }
25497 }
25498 );
25499 }
25500
25501 // packages/dataviews/build-module/components/dataform-controls/time.mjs
25502 var import_components18 = __toESM(require_components(), 1);
25503 var import_element84 = __toESM(require_element(), 1);
25504 var import_i18n17 = __toESM(require_i18n(), 1);
25505 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
25506 function getStep(timeFormat, values) {
25507 const tokens = (timeFormat ?? "").replace(/\\./g, "");
25508 const hasSeconds = tokens.includes("s") || values.some((value) => (parseTime2(value) ?? 0) % 60 !== 0);
25509 return hasSeconds ? 1 : void 0;
25510 }
25511 function toInputValue(value) {
25512 const seconds = parseTime2(value);
25513 if (seconds === null) {
25514 return "";
25515 }
25516 const parts = [
25517 Math.floor(seconds / 3600),
25518 Math.floor(seconds % 3600 / 60)
25519 ];
25520 if (seconds % 60 !== 0) {
25521 parts.push(seconds % 60);
25522 }
25523 return parts.map((part) => String(part).padStart(2, "0")).join(":");
25524 }
25525 function BetweenControls2({
25526 value,
25527 onChange,
25528 hideLabelFromVision,
25529 disabled: disabled2,
25530 step,
25531 min: min3,
25532 max: max3
25533 }) {
25534 const [from = "", to2 = ""] = value;
25535 const onChangeFrom = (0, import_element84.useCallback)(
25536 (newValue) => onChange([newValue ?? "", to2]),
25537 [onChange, to2]
25538 );
25539 const onChangeTo = (0, import_element84.useCallback)(
25540 (newValue) => onChange([from, newValue ?? ""]),
25541 [onChange, from]
25542 );
25543 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
25544 import_components18.BaseControl,
25545 {
25546 help: (0, import_i18n17.__)("The end time must be later than the start time."),
25547 children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Stack, { direction: "row", gap: "sm", justify: "space-between", children: [
25548 /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
25549 ValidatedInputControl,
25550 {
25551 type: "time",
25552 label: (0, import_i18n17.__)("From"),
25553 value: from,
25554 onValueChange: onChangeFrom,
25555 hideLabelFromVision,
25556 disabled: disabled2,
25557 step,
25558 min: min3,
25559 max: to2 || max3
25560 }
25561 ),
25562 /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
25563 ValidatedInputControl,
25564 {
25565 type: "time",
25566 label: (0, import_i18n17.__)("To"),
25567 value: to2,
25568 onValueChange: onChangeTo,
25569 hideLabelFromVision,
25570 disabled: disabled2,
25571 step,
25572 min: from || min3,
25573 max: max3
25574 }
25575 )
25576 ] })
25577 }
25578 );
25579 }
25580 function Time({
25581 data,
25582 field,
25583 onChange,
25584 hideLabelFromVision,
25585 markWhenOptional,
25586 operator,
25587 validity
25588 }) {
25589 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25590 const value = getValue({ item: data });
25591 const disabled2 = field.isDisabled({ item: data, field });
25592 const timeFormat = field.format?.time;
25593 const min3 = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
25594 const max3 = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
25595 const onChangeControl = (0, import_element84.useCallback)(
25596 (newValue) => onChange(
25597 setValue({
25598 item: data,
25599 value: newValue === "" ? void 0 : newValue
25600 })
25601 ),
25602 [data, onChange, setValue]
25603 );
25604 const onChangeBetweenControls = (0, import_element84.useCallback)(
25605 ([from, to2]) => onChange(
25606 setValue({
25607 item: data,
25608 // An unfilled bound is stored as `undefined`, which the
25609 // `between` operator reads as "do not apply the filter".
25610 value: [from || void 0, to2 || void 0]
25611 })
25612 ),
25613 [data, onChange, setValue]
25614 );
25615 if (operator === OPERATOR_BETWEEN) {
25616 let valueBetween = ["", ""];
25617 if (Array.isArray(value) && value.length === 2) {
25618 valueBetween = [
25619 toInputValue(value[0]),
25620 toInputValue(value[1])
25621 ];
25622 }
25623 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
25624 BetweenControls2,
25625 {
25626 value: valueBetween,
25627 onChange: onChangeBetweenControls,
25628 hideLabelFromVision,
25629 disabled: disabled2,
25630 step: getStep(timeFormat, valueBetween),
25631 min: min3,
25632 max: max3
25633 }
25634 );
25635 }
25636 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
25637 ValidatedInputControl,
25638 {
25639 required: !!isValid2.required,
25640 markWhenOptional,
25641 customValidity: getCustomValidity(isValid2, validity),
25642 type: "time",
25643 label,
25644 placeholder,
25645 description: typeof description === "string" ? description : void 0,
25646 details: typeof description === "string" ? void 0 : description,
25647 value: toInputValue(value),
25648 onValueChange: onChangeControl,
25649 hideLabelFromVision,
25650 disabled: disabled2,
25651 step: getStep(timeFormat, [value]),
25652 min: min3,
25653 max: max3
25654 }
25655 );
25656 }
25657
25658 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs
25659 var import_element85 = __toESM(require_element(), 1);
25660 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
25661 function Toggle({
25662 field,
25663 onChange,
25664 data,
25665 hideLabelFromVision,
25666 markWhenOptional,
25667 validity
25668 }) {
25669 const { label, description, getValue, setValue, isValid: isValid2 } = field;
25670 const disabled2 = field.isDisabled({ item: data, field });
25671 const onChangeControl = (0, import_element85.useCallback)(() => {
25672 onChange(
25673 setValue({ item: data, value: !getValue({ item: data }) })
25674 );
25675 }, [onChange, setValue, data, getValue]);
25676 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
25677 ValidatedToggleControl,
25678 {
25679 required: !!isValid2.required,
25680 markWhenOptional,
25681 customValidity: getCustomValidity(isValid2, validity),
25682 hidden: hideLabelFromVision,
25683 label,
25684 help: description,
25685 checked: getValue({ item: data }),
25686 onChange: onChangeControl,
25687 disabled: disabled2
25688 }
25689 );
25690 }
25691
25692 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs
25693 var import_element86 = __toESM(require_element(), 1);
25694 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
25695 function Textarea3({
25696 data,
25697 field,
25698 onChange,
25699 hideLabelFromVision,
25700 markWhenOptional,
25701 config: config2,
25702 validity
25703 }) {
25704 const { rows = 4 } = config2 || {};
25705 const disabled2 = field.isDisabled({ item: data, field });
25706 const { label, placeholder, description, setValue, isValid: isValid2 } = field;
25707 const value = field.getValue({ item: data });
25708 const onValueChangeControl = (0, import_element86.useCallback)(
25709 (newValue) => onChange(setValue({ item: data, value: newValue })),
25710 [data, onChange, setValue]
25711 );
25712 return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
25713 ValidatedTextareaControl,
25714 {
25715 required: !!isValid2.required,
25716 markWhenOptional,
25717 customValidity: getCustomValidity(isValid2, validity),
25718 label,
25719 placeholder,
25720 value: value ?? "",
25721 description: typeof description === "string" ? description : void 0,
25722 details: typeof description === "string" ? void 0 : description,
25723 onValueChange: onValueChangeControl,
25724 rows,
25725 disabled: disabled2,
25726 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
25727 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
25728 hideLabelFromVision
25729 }
25730 );
25731 }
25732
25733 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs
25734 var import_components19 = __toESM(require_components(), 1);
25735 var import_element87 = __toESM(require_element(), 1);
25736 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
25737 function ToggleGroup({
25738 data,
25739 field,
25740 onChange,
25741 hideLabelFromVision,
25742 markWhenOptional,
25743 validity
25744 }) {
25745 const { getValue, setValue, isValid: isValid2 } = field;
25746 const disabled2 = field.isDisabled({ item: data, field });
25747 const value = getValue({ item: data });
25748 const onChangeControl = (0, import_element87.useCallback)(
25749 (newValue) => onChange(setValue({ item: data, value: newValue })),
25750 [data, onChange, setValue]
25751 );
25752 const { elements, isLoading } = useElements({
25753 elements: field.elements,
25754 getElements: field.getElements
25755 });
25756 if (isLoading) {
25757 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_components19.Spinner, {});
25758 }
25759 if (elements.length === 0) {
25760 return null;
25761 }
25762 const selectedOption = elements.find((el) => el.value === value);
25763 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
25764 ValidatedToggleGroupControl,
25765 {
25766 required: !!field.isValid?.required,
25767 markWhenOptional,
25768 customValidity: getCustomValidity(isValid2, validity),
25769 isBlock: true,
25770 label: field.label,
25771 help: selectedOption?.description || field.description,
25772 onChange: onChangeControl,
25773 value,
25774 hideLabelFromVision,
25775 children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
25776 import_components19.__experimentalToggleGroupControlOption,
25777 {
25778 label: el.label,
25779 value: el.value,
25780 disabled: disabled2
25781 },
25782 el.value
25783 ))
25784 }
25785 );
25786 }
25787
25788 // packages/dataviews/build-module/components/dataform-controls/array.mjs
25789 var import_components20 = __toESM(require_components(), 1);
25790 var import_element88 = __toESM(require_element(), 1);
25791 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
25792 function ArrayControl({
25793 data,
25794 field,
25795 onChange,
25796 hideLabelFromVision,
25797 markWhenOptional,
25798 validity
25799 }) {
25800 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25801 const value = getValue({ item: data });
25802 const disabled2 = field.isDisabled({ item: data, field });
25803 const { elements, isLoading } = useElements({
25804 elements: field.elements,
25805 getElements: field.getElements
25806 });
25807 const arrayValueAsElements = (0, import_element88.useMemo)(
25808 () => Array.isArray(value) ? value.map((token) => {
25809 const element = elements?.find(
25810 (suggestion) => suggestion.value === token
25811 );
25812 return element || { value: token, label: token };
25813 }) : [],
25814 [value, elements]
25815 );
25816 const onChangeControl = (0, import_element88.useCallback)(
25817 (tokens) => {
25818 const valueTokens = tokens.map((token) => {
25819 if (typeof token === "object" && "value" in token) {
25820 return token.value;
25821 }
25822 return token;
25823 });
25824 onChange(setValue({ item: data, value: valueTokens }));
25825 },
25826 [onChange, setValue, data]
25827 );
25828 if (isLoading) {
25829 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_components20.Spinner, {});
25830 }
25831 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
25832 ValidatedFormTokenField,
25833 {
25834 required: !!isValid2?.required,
25835 markWhenOptional,
25836 customValidity: getCustomValidity(isValid2, validity),
25837 label: hideLabelFromVision ? void 0 : label,
25838 value: arrayValueAsElements,
25839 onChange: onChangeControl,
25840 placeholder,
25841 suggestions: elements?.map((element) => element.value),
25842 disabled: disabled2,
25843 __experimentalValidateInput: (token) => {
25844 if (field.isValid?.elements && elements) {
25845 return elements.some(
25846 (element) => element.value === token || element.label === token
25847 );
25848 }
25849 return true;
25850 },
25851 __experimentalExpandOnFocus: elements && elements.length > 0,
25852 help: description ?? (field.isValid?.elements ? "" : void 0),
25853 displayTransform: (token) => {
25854 if (typeof token === "object" && "label" in token) {
25855 return token.label;
25856 }
25857 if (typeof token === "string" && elements) {
25858 const element = elements.find(
25859 (el) => el.value === token
25860 );
25861 return element?.label || token;
25862 }
25863 return token;
25864 },
25865 __experimentalRenderItem: ({ item }) => {
25866 if (typeof item === "string" && elements) {
25867 const element = elements.find(
25868 (el) => el.value === item
25869 );
25870 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("span", { children: element?.label || item });
25871 }
25872 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("span", { children: item });
25873 }
25874 }
25875 );
25876 }
25877
25878 // node_modules/colord/index.mjs
25879 for (r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r3) {
25880 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
25881 }, n = function(r3, t2, n2) {
25882 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0;
25883 }, u = function(r3, t2, n2) {
25884 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2;
25885 }, e = function(r3) {
25886 return (r3 = isFinite(r3) ? r3 % 360 : 0) < 0 ? r3 + 360 : r3;
25887 }, o = function(r3, t2) {
25888 return void 0 === t2 && (t2 = 0), n(r3, t2) % 360;
25889 }, a = function(r3) {
25890 return { r: u(r3.r, 0, 255), g: u(r3.g, 0, 255), b: u(r3.b, 0, 255), a: u(r3.a) };
25891 }, i = function(r3) {
25892 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
25893 }, s = /^#([0-9a-f]{3,8})$/i, d = function(r3, t2) {
25894 var n2 = r3.charCodeAt(t2);
25895 return (15 & n2) + 9 * (n2 >> 6);
25896 }, h = function(r3, t2) {
25897 return d(r3, t2) << 4 | d(r3, t2 + 1);
25898 }, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16));
25899 var r2;
25900 var t;
25901 var n;
25902 var u;
25903 var e;
25904 var o;
25905 var a;
25906 var i;
25907 var s;
25908 var d;
25909 var h;
25910 var b;
25911 var f;
25912 var g = function(r2) {
25913 return b[u(r2, 0, 255)];
25914 };
25915 var c = function(r2) {
25916 var t = r2.r, n = r2.g, u = r2.b, e = r2.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0;
25917 return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e };
25918 };
25919 var v = function(r2) {
25920 var t = r2.h, n = r2.s, u = r2.v, e = r2.a;
25921 t = t / 360 * 6, n /= 100, u /= 100;
25922 var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6;
25923 return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e };
25924 };
25925 var l = function(r2) {
25926 return { h: e(r2.h), s: u(r2.s, 0, 100), l: u(r2.l, 0, 100), a: u(r2.a) };
25927 };
25928 var p = function(r2) {
25929 return { h: o(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
25930 };
25931 var m = function(r2) {
25932 return v((n = (t = r2).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a }));
25933 var t, n, u;
25934 };
25935 var y = function(r2) {
25936 return { h: (t = c(r2)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a };
25937 var t, n, u, e;
25938 };
25939 var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25940 var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25941 var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25942 var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25943 var $ = { string: [[function(r2) {
25944 if (!s.test(r2)) return null;
25945 var t = r2.length;
25946 return t <= 5 ? { r: 17 * d(r2, 1), g: 17 * d(r2, 2), b: 17 * d(r2, 3), a: 5 === t ? n(17 * d(r2, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r2, 1), g: h(r2, 3), b: h(r2, 5), a: 9 === t ? n(h(r2, 7) / 255, 2) : 1 } : null;
25947 }, "hex"], [function(r2) {
25948 var t = M.exec(r2) || H.exec(r2);
25949 return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
25950 }, "rgb"], [function(t) {
25951 var n = N.exec(t) || x.exec(t);
25952 if (!n) return null;
25953 var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r2[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) });
25954 return m(o);
25955 }, "hsl"]], object: [[function(r2) {
25956 var n = r2.r, u = r2.g, e = r2.b, o = r2.a, i = void 0 === o ? 1 : o;
25957 return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null;
25958 }, "rgb"], [function(r2) {
25959 var n = r2.h, u = r2.s, e = r2.l, o = r2.a, a = void 0 === o ? 1 : o;
25960 if (!t(n) || !t(u) || !t(e)) return null;
25961 var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) });
25962 return m(i);
25963 }, "hsl"], [function(r2) {
25964 var n = r2.h, o = r2.s, a = r2.v, i = r2.a, s = void 0 === i ? 1 : i;
25965 if (!t(n) || !t(o) || !t(a)) return null;
25966 var d = (function(r3) {
25967 return { h: e(r3.h), s: u(r3.s, 0, 100), v: u(r3.v, 0, 100), a: u(r3.a) };
25968 })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) });
25969 return v(d);
25970 }, "hsv"]] };
25971 var j = function(r2, t) {
25972 for (var n = 0; n < t.length; n++) {
25973 var u = t[n][0](r2);
25974 if (u) return [u, t[n][1]];
25975 }
25976 return [null, void 0];
25977 };
25978 var w = function(r2) {
25979 return "string" == typeof r2 ? j(r2.trim(), $.string) : "object" == typeof r2 && null !== r2 ? j(r2, $.object) : [null, void 0];
25980 };
25981 var k = function(r2, t) {
25982 var n = y(r2);
25983 return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a };
25984 };
25985 var E = function(r2) {
25986 return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
25987 };
25988 var R = function(r2, t) {
25989 var n = y(r2);
25990 return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a };
25991 };
25992 var q = (function() {
25993 function r2(r3) {
25994 this.parsed = w(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
25995 }
25996 return r2.prototype.isValid = function() {
25997 return null !== this.parsed;
25998 }, r2.prototype.brightness = function() {
25999 return n(E(this.rgba), 2);
26000 }, r2.prototype.isDark = function() {
26001 return E(this.rgba) < 0.5;
26002 }, r2.prototype.isLight = function() {
26003 return E(this.rgba) >= 0.5;
26004 }, r2.prototype.toHex = function() {
26005 return r3 = i(this.rgba), t = r3.r, u = r3.g, e = r3.b, a = (o = r3.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a;
26006 var r3, t, u, e, o, a;
26007 }, r2.prototype.toRgb = function() {
26008 return i(this.rgba);
26009 }, r2.prototype.toRgbString = function() {
26010 return r3 = i(this.rgba), t = r3.r, n = r3.g, u = r3.b, (e = r3.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")";
26011 var r3, t, n, u, e;
26012 }, r2.prototype.toHsl = function() {
26013 return p(y(this.rgba));
26014 }, r2.prototype.toHslString = function() {
26015 return r3 = p(y(this.rgba)), t = r3.h, n = r3.s, u = r3.l, (e = r3.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)";
26016 var r3, t, n, u, e;
26017 }, r2.prototype.toHsv = function() {
26018 return r3 = c(this.rgba), { h: o(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
26019 var r3;
26020 }, r2.prototype.invert = function() {
26021 return A({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
26022 var r3;
26023 }, r2.prototype.saturate = function(r3) {
26024 return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, r3));
26025 }, r2.prototype.desaturate = function(r3) {
26026 return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, -r3));
26027 }, r2.prototype.grayscale = function() {
26028 return A(k(this.rgba, -1));
26029 }, r2.prototype.lighten = function(r3) {
26030 return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, r3));
26031 }, r2.prototype.darken = function(r3) {
26032 return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, -r3));
26033 }, r2.prototype.rotate = function(r3) {
26034 return void 0 === r3 && (r3 = 15), this.hue(y(this.rgba).h + r3);
26035 }, r2.prototype.alpha = function(r3) {
26036 return "number" == typeof r3 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r3 }) : n(this.rgba.a, 3);
26037 var t;
26038 }, r2.prototype.hue = function(r3) {
26039 var t = y(this.rgba);
26040 return "number" == typeof r3 ? A({ h: r3, s: t.s, l: t.l, a: t.a }) : o(t.h);
26041 }, r2.prototype.isEqual = function(r3) {
26042 return this.toHex() === A(r3).toHex();
26043 }, r2;
26044 })();
26045 var A = function(r2) {
26046 return r2 instanceof q ? r2 : new q(r2);
26047 };
26048
26049 // packages/dataviews/build-module/components/dataform-controls/color.mjs
26050 var import_components21 = __toESM(require_components(), 1);
26051 var import_element89 = __toESM(require_element(), 1);
26052 var import_i18n18 = __toESM(require_i18n(), 1);
26053 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
26054 var ColorPickerDropdown = ({
26055 color,
26056 onColorChange,
26057 disabled: disabled2
26058 }) => {
26059 const validColor = color && A(color).isValid() ? color : "#ffffff";
26060 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
26061 import_components21.Dropdown,
26062 {
26063 className: "dataviews-controls__color-picker-dropdown",
26064 popoverProps: { resize: false },
26065 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
26066 import_components21.Button,
26067 {
26068 onClick: onToggle,
26069 "aria-label": (0, import_i18n18.__)("Open color picker"),
26070 size: "small",
26071 disabled: disabled2,
26072 accessibleWhenDisabled: true,
26073 icon: () => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components21.ColorIndicator, { colorValue: validColor })
26074 }
26075 ),
26076 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components21.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
26077 import_components21.ColorPicker,
26078 {
26079 color: validColor,
26080 onChange: onColorChange,
26081 enableAlpha: true
26082 }
26083 ) })
26084 }
26085 );
26086 };
26087 function Color({
26088 data,
26089 field,
26090 onChange,
26091 hideLabelFromVision,
26092 markWhenOptional,
26093 validity
26094 }) {
26095 const { label, placeholder, description, setValue, isValid: isValid2 } = field;
26096 const disabled2 = field.isDisabled({ item: data, field });
26097 const value = field.getValue({ item: data }) || "";
26098 const handleColorChange = (0, import_element89.useCallback)(
26099 (newColor) => {
26100 onChange(setValue({ item: data, value: newColor }));
26101 },
26102 [data, onChange, setValue]
26103 );
26104 const handleInputChange = (0, import_element89.useCallback)(
26105 (newValue) => {
26106 onChange(setValue({ item: data, value: newValue || "" }));
26107 },
26108 [data, onChange, setValue]
26109 );
26110 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
26111 ValidatedInputControl,
26112 {
26113 required: !!field.isValid?.required,
26114 markWhenOptional,
26115 customValidity: getCustomValidity(isValid2, validity),
26116 label,
26117 placeholder,
26118 value,
26119 description: typeof description === "string" ? description : void 0,
26120 details: typeof description === "string" ? void 0 : description,
26121 onValueChange: handleInputChange,
26122 hideLabelFromVision,
26123 type: "text",
26124 disabled: disabled2,
26125 prefix: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
26126 ColorPickerDropdown,
26127 {
26128 color: value,
26129 onColorChange: handleColorChange,
26130 disabled: disabled2
26131 }
26132 ) })
26133 }
26134 );
26135 }
26136
26137 // packages/dataviews/build-module/components/dataform-controls/password.mjs
26138 var import_components22 = __toESM(require_components(), 1);
26139 var import_element90 = __toESM(require_element(), 1);
26140 var import_i18n19 = __toESM(require_i18n(), 1);
26141 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
26142 function Password({
26143 data,
26144 field,
26145 onChange,
26146 hideLabelFromVision,
26147 markWhenOptional,
26148 validity
26149 }) {
26150 const [isVisible, setIsVisible] = (0, import_element90.useState)(false);
26151 const disabled2 = field.isDisabled({ item: data, field });
26152 const toggleVisibility = (0, import_element90.useCallback)(() => {
26153 setIsVisible((prev) => !prev);
26154 }, []);
26155 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
26156 ValidatedText,
26157 {
26158 ...{
26159 data,
26160 field,
26161 onChange,
26162 hideLabelFromVision,
26163 markWhenOptional,
26164 validity,
26165 type: isVisible ? "text" : "password",
26166 suffix: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
26167 import_components22.Button,
26168 {
26169 icon: isVisible ? unseen_default : seen_default,
26170 onClick: toggleVisibility,
26171 size: "small",
26172 label: isVisible ? (0, import_i18n19.__)("Hide password") : (0, import_i18n19.__)("Show password"),
26173 disabled: disabled2,
26174 accessibleWhenDisabled: true
26175 }
26176 ) })
26177 }
26178 }
26179 );
26180 }
26181
26182 // packages/dataviews/build-module/field-types/utils/has-elements.mjs
26183 function hasElements(field) {
26184 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
26185 }
26186
26187 // packages/dataviews/build-module/components/dataform-controls/index.mjs
26188 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
26189 var FORM_CONTROLS = {
26190 adaptiveSelect: AdaptiveSelect,
26191 array: ArrayControl,
26192 checkbox: Checkbox,
26193 color: Color,
26194 combobox: Combobox,
26195 datetime: DateTime,
26196 date: DateControl,
26197 email: Email,
26198 telephone: Telephone,
26199 url: Url,
26200 integer: Integer,
26201 number: Number2,
26202 password: Password,
26203 radio: Radio,
26204 select: Select2,
26205 text: Text3,
26206 time: Time,
26207 toggle: Toggle,
26208 textarea: Textarea3,
26209 toggleGroup: ToggleGroup
26210 };
26211 function isEditConfig(value) {
26212 return value && typeof value === "object" && typeof value.control === "string";
26213 }
26214 function createConfiguredControl(config2) {
26215 const { control, ...controlConfig } = config2;
26216 const BaseControlType = getControlByType(control);
26217 if (BaseControlType === null) {
26218 return null;
26219 }
26220 return function ConfiguredControl(props) {
26221 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(BaseControlType, { ...props, config: controlConfig });
26222 };
26223 }
26224 function getControl(field, fallback) {
26225 if (typeof field.Edit === "function") {
26226 return field.Edit;
26227 }
26228 if (typeof field.Edit === "string") {
26229 return getControlByType(field.Edit);
26230 }
26231 if (isEditConfig(field.Edit)) {
26232 return createConfiguredControl(field.Edit);
26233 }
26234 if (hasElements(field) && field.type !== "array") {
26235 return getControlByType("adaptiveSelect");
26236 }
26237 if (fallback === null) {
26238 return null;
26239 }
26240 return getControlByType(fallback);
26241 }
26242 function getControlByType(type) {
26243 if (Object.keys(FORM_CONTROLS).includes(type)) {
26244 return FORM_CONTROLS[type];
26245 }
26246 return null;
26247 }
26248
26249 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs
26250 function getFilterBy(field, defaultOperators, validOperators) {
26251 if (field.filterBy === false) {
26252 return false;
26253 }
26254 const operators = field.filterBy?.operators?.filter(
26255 (op) => validOperators.includes(op)
26256 ) ?? defaultOperators;
26257 if (operators.length === 0) {
26258 return false;
26259 }
26260 return {
26261 isPrimary: !!field.filterBy?.isPrimary,
26262 operators
26263 };
26264 }
26265 var get_filter_by_default = getFilterBy;
26266
26267 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs
26268 var getValueFromId = (id) => ({ item }) => {
26269 const path = id.split(".");
26270 let value = item;
26271 for (const segment of path) {
26272 if (value.hasOwnProperty(segment)) {
26273 value = value[segment];
26274 } else {
26275 value = void 0;
26276 }
26277 }
26278 return value;
26279 };
26280 var get_value_from_id_default = getValueFromId;
26281
26282 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs
26283 var setValueFromId = (id) => ({ value }) => {
26284 const path = id.split(".");
26285 const result = {};
26286 let current = result;
26287 for (const segment of path.slice(0, -1)) {
26288 current[segment] = {};
26289 current = current[segment];
26290 }
26291 current[path.at(-1)] = value;
26292 return result;
26293 };
26294 var set_value_from_id_default = setValueFromId;
26295
26296 // packages/dataviews/build-module/field-types/email.mjs
26297 var import_i18n20 = __toESM(require_i18n(), 1);
26298
26299 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs
26300 function RenderFromElements({
26301 item,
26302 field
26303 }) {
26304 const { elements, isLoading } = useElements({
26305 elements: field.elements,
26306 getElements: field.getElements
26307 });
26308 const value = field.getValue({ item });
26309 if (isLoading) {
26310 return value;
26311 }
26312 if (elements.length === 0) {
26313 return value;
26314 }
26315 return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
26316 }
26317
26318 // packages/dataviews/build-module/field-types/utils/render-default.mjs
26319 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
26320 function render({
26321 item,
26322 field
26323 }) {
26324 if (field.hasElements) {
26325 return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(RenderFromElements, { item, field });
26326 }
26327 return field.getValueFormatted({ item, field });
26328 }
26329
26330 // packages/dataviews/build-module/field-types/utils/sort-text.mjs
26331 var sort_text_default = (a, b, direction) => {
26332 return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a);
26333 };
26334
26335 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs
26336 function isValidRequired(item, field) {
26337 const value = field.getValue({ item });
26338 return ![void 0, "", null].includes(value);
26339 }
26340
26341 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs
26342 function isValidMinLength(item, field) {
26343 if (typeof field.isValid.minLength?.constraint !== "number") {
26344 return false;
26345 }
26346 const value = field.getValue({ item });
26347 if ([void 0, "", null].includes(value)) {
26348 return true;
26349 }
26350 return String(value).length >= field.isValid.minLength.constraint;
26351 }
26352
26353 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs
26354 function isValidMaxLength(item, field) {
26355 if (typeof field.isValid.maxLength?.constraint !== "number") {
26356 return false;
26357 }
26358 const value = field.getValue({ item });
26359 if ([void 0, "", null].includes(value)) {
26360 return true;
26361 }
26362 return String(value).length <= field.isValid.maxLength.constraint;
26363 }
26364
26365 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs
26366 function isValidPattern(item, field) {
26367 if (field.isValid.pattern?.constraint === void 0) {
26368 return true;
26369 }
26370 try {
26371 const regexp = new RegExp(field.isValid.pattern.constraint);
26372 const value = field.getValue({ item });
26373 if ([void 0, "", null].includes(value)) {
26374 return true;
26375 }
26376 return regexp.test(String(value));
26377 } catch {
26378 return false;
26379 }
26380 }
26381
26382 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs
26383 function isValidElements(item, field) {
26384 const elements = field.elements ?? [];
26385 const validValues = elements.map((el) => el.value);
26386 if (validValues.length === 0) {
26387 return true;
26388 }
26389 const value = field.getValue({ item });
26390 return [].concat(value).every((v2) => validValues.includes(v2));
26391 }
26392
26393 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs
26394 function getValueFormatted({
26395 item,
26396 field
26397 }) {
26398 return field.getValue({ item });
26399 }
26400 var get_value_formatted_default_default = getValueFormatted;
26401
26402 // packages/dataviews/build-module/field-types/email.mjs
26403 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])?)*$/;
26404 function isValidCustom(item, field) {
26405 const value = field.getValue({ item });
26406 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
26407 return (0, import_i18n20.__)("Value must be a valid email address.");
26408 }
26409 return null;
26410 }
26411 var email_default = {
26412 type: "email",
26413 render,
26414 Edit: "email",
26415 sort: sort_text_default,
26416 enableSorting: true,
26417 enableGlobalSearch: false,
26418 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26419 validOperators: [
26420 OPERATOR_IS,
26421 OPERATOR_IS_NOT,
26422 OPERATOR_CONTAINS,
26423 OPERATOR_NOT_CONTAINS,
26424 OPERATOR_STARTS_WITH,
26425 // Multiple selection
26426 OPERATOR_IS_ANY,
26427 OPERATOR_IS_NONE,
26428 OPERATOR_IS_NOT_ALL
26429 ],
26430 format: {},
26431 getValueFormatted: get_value_formatted_default_default,
26432 validate: {
26433 required: isValidRequired,
26434 pattern: isValidPattern,
26435 minLength: isValidMinLength,
26436 maxLength: isValidMaxLength,
26437 elements: isValidElements,
26438 custom: isValidCustom
26439 }
26440 };
26441
26442 // packages/dataviews/build-module/field-types/integer.mjs
26443 var import_i18n21 = __toESM(require_i18n(), 1);
26444
26445 // packages/dataviews/build-module/field-types/utils/sort-number.mjs
26446 var sort_number_default = (a, b, direction) => {
26447 return direction === "asc" ? a - b : b - a;
26448 };
26449
26450 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs
26451 function isValidMin(item, field) {
26452 if (typeof field.isValid.min?.constraint !== "number") {
26453 return false;
26454 }
26455 const value = field.getValue({ item });
26456 if ([void 0, "", null].includes(value)) {
26457 return true;
26458 }
26459 return Number(value) >= field.isValid.min.constraint;
26460 }
26461
26462 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs
26463 function isValidMax(item, field) {
26464 if (typeof field.isValid.max?.constraint !== "number") {
26465 return false;
26466 }
26467 const value = field.getValue({ item });
26468 if ([void 0, "", null].includes(value)) {
26469 return true;
26470 }
26471 return Number(value) <= field.isValid.max.constraint;
26472 }
26473
26474 // packages/dataviews/build-module/field-types/integer.mjs
26475 var format2 = {
26476 separatorThousand: ","
26477 };
26478 function getValueFormatted2({
26479 item,
26480 field
26481 }) {
26482 let value = field.getValue({ item });
26483 if (value === null || value === void 0) {
26484 return "";
26485 }
26486 value = Number(value);
26487 if (!Number.isFinite(value)) {
26488 return String(value);
26489 }
26490 let formatInteger;
26491 if (field.type !== "integer") {
26492 formatInteger = format2;
26493 } else {
26494 formatInteger = field.format;
26495 }
26496 const { separatorThousand } = formatInteger;
26497 const integerValue = Math.trunc(value);
26498 if (!separatorThousand) {
26499 return String(integerValue);
26500 }
26501 return String(integerValue).replace(
26502 /\B(?=(\d{3})+(?!\d))/g,
26503 separatorThousand
26504 );
26505 }
26506 function isValidCustom2(item, field) {
26507 const value = field.getValue({ item });
26508 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
26509 return (0, import_i18n21.__)("Value must be an integer.");
26510 }
26511 return null;
26512 }
26513 var integer_default = {
26514 type: "integer",
26515 render,
26516 Edit: "integer",
26517 sort: sort_number_default,
26518 enableSorting: true,
26519 enableGlobalSearch: false,
26520 defaultOperators: [
26521 OPERATOR_IS,
26522 OPERATOR_IS_NOT,
26523 OPERATOR_LESS_THAN,
26524 OPERATOR_GREATER_THAN,
26525 OPERATOR_LESS_THAN_OR_EQUAL,
26526 OPERATOR_GREATER_THAN_OR_EQUAL,
26527 OPERATOR_BETWEEN
26528 ],
26529 validOperators: [
26530 // Single-selection
26531 OPERATOR_IS,
26532 OPERATOR_IS_NOT,
26533 OPERATOR_LESS_THAN,
26534 OPERATOR_GREATER_THAN,
26535 OPERATOR_LESS_THAN_OR_EQUAL,
26536 OPERATOR_GREATER_THAN_OR_EQUAL,
26537 OPERATOR_BETWEEN,
26538 // Multiple-selection
26539 OPERATOR_IS_ANY,
26540 OPERATOR_IS_NONE,
26541 OPERATOR_IS_NOT_ALL
26542 ],
26543 format: format2,
26544 getValueFormatted: getValueFormatted2,
26545 validate: {
26546 required: isValidRequired,
26547 min: isValidMin,
26548 max: isValidMax,
26549 elements: isValidElements,
26550 custom: isValidCustom2
26551 }
26552 };
26553
26554 // packages/dataviews/build-module/field-types/number.mjs
26555 var import_i18n22 = __toESM(require_i18n(), 1);
26556 var format3 = {
26557 separatorThousand: ",",
26558 separatorDecimal: ".",
26559 decimals: 2
26560 };
26561 function getValueFormatted3({
26562 item,
26563 field
26564 }) {
26565 let value = field.getValue({ item });
26566 if (value === null || value === void 0) {
26567 return "";
26568 }
26569 value = Number(value);
26570 if (!Number.isFinite(value)) {
26571 return String(value);
26572 }
26573 let formatNumber;
26574 if (field.type !== "number") {
26575 formatNumber = format3;
26576 } else {
26577 formatNumber = field.format;
26578 }
26579 const { separatorThousand, separatorDecimal, decimals } = formatNumber;
26580 const fixedValue = value.toFixed(decimals);
26581 const [integerPart, decimalPart] = fixedValue.split(".");
26582 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
26583 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
26584 }
26585 function isEmpty(value) {
26586 return value === "" || value === void 0 || value === null;
26587 }
26588 function isValidCustom3(item, field) {
26589 const value = field.getValue({ item });
26590 if (!isEmpty(value) && !Number.isFinite(value)) {
26591 return (0, import_i18n22.__)("Value must be a number.");
26592 }
26593 return null;
26594 }
26595 var number_default = {
26596 type: "number",
26597 render,
26598 Edit: "number",
26599 sort: sort_number_default,
26600 enableSorting: true,
26601 enableGlobalSearch: false,
26602 defaultOperators: [
26603 OPERATOR_IS,
26604 OPERATOR_IS_NOT,
26605 OPERATOR_LESS_THAN,
26606 OPERATOR_GREATER_THAN,
26607 OPERATOR_LESS_THAN_OR_EQUAL,
26608 OPERATOR_GREATER_THAN_OR_EQUAL,
26609 OPERATOR_BETWEEN
26610 ],
26611 validOperators: [
26612 // Single-selection
26613 OPERATOR_IS,
26614 OPERATOR_IS_NOT,
26615 OPERATOR_LESS_THAN,
26616 OPERATOR_GREATER_THAN,
26617 OPERATOR_LESS_THAN_OR_EQUAL,
26618 OPERATOR_GREATER_THAN_OR_EQUAL,
26619 OPERATOR_BETWEEN,
26620 // Multiple-selection
26621 OPERATOR_IS_ANY,
26622 OPERATOR_IS_NONE,
26623 OPERATOR_IS_NOT_ALL
26624 ],
26625 format: format3,
26626 getValueFormatted: getValueFormatted3,
26627 validate: {
26628 required: isValidRequired,
26629 min: isValidMin,
26630 max: isValidMax,
26631 elements: isValidElements,
26632 custom: isValidCustom3
26633 }
26634 };
26635
26636 // packages/dataviews/build-module/field-types/text.mjs
26637 var text_default = {
26638 type: "text",
26639 render,
26640 Edit: "text",
26641 sort: sort_text_default,
26642 enableSorting: true,
26643 enableGlobalSearch: false,
26644 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26645 validOperators: [
26646 // Single selection
26647 OPERATOR_IS,
26648 OPERATOR_IS_NOT,
26649 OPERATOR_CONTAINS,
26650 OPERATOR_NOT_CONTAINS,
26651 OPERATOR_STARTS_WITH,
26652 // Multiple selection
26653 OPERATOR_IS_ANY,
26654 OPERATOR_IS_NONE,
26655 OPERATOR_IS_NOT_ALL
26656 ],
26657 format: {},
26658 getValueFormatted: get_value_formatted_default_default,
26659 validate: {
26660 required: isValidRequired,
26661 pattern: isValidPattern,
26662 minLength: isValidMinLength,
26663 maxLength: isValidMaxLength,
26664 elements: isValidElements
26665 }
26666 };
26667
26668 // packages/dataviews/build-module/field-types/datetime.mjs
26669 var import_date9 = __toESM(require_date(), 1);
26670
26671 // packages/dataviews/build-module/field-types/utils/is-valid-boundary.mjs
26672 var import_date8 = __toESM(require_date(), 1);
26673 function parseDateLike(value) {
26674 if (!isValid(new Date(value))) {
26675 return null;
26676 }
26677 const parsed = (0, import_date8.getDate)(value);
26678 return parsed && isValid(parsed) ? parsed.getTime() : null;
26679 }
26680 function validateBoundary(item, field, boundary, parse2) {
26681 const constraint = field.isValid[boundary]?.constraint;
26682 if (typeof constraint !== "string") {
26683 return false;
26684 }
26685 const value = field.getValue({ item });
26686 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value;
26687 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") {
26688 return true;
26689 }
26690 const parsedConstraint = parse2(constraint);
26691 const parsedValue = parse2(String(boundaryValue));
26692 if (parsedConstraint === null || parsedValue === null) {
26693 return false;
26694 }
26695 return boundary === "min" ? parsedValue >= parsedConstraint : parsedValue <= parsedConstraint;
26696 }
26697 function isValidMinDate(item, field) {
26698 return validateBoundary(item, field, "min", parseDateLike);
26699 }
26700 function isValidMaxDate(item, field) {
26701 return validateBoundary(item, field, "max", parseDateLike);
26702 }
26703 function isValidMinTime(item, field) {
26704 return validateBoundary(item, field, "min", parseTime2);
26705 }
26706 function isValidMaxTime(item, field) {
26707 return validateBoundary(item, field, "max", parseTime2);
26708 }
26709
26710 // packages/dataviews/build-module/field-types/datetime.mjs
26711 var format4 = {
26712 datetime: (0, import_date9.getSettings)().formats.datetime,
26713 weekStartsOn: (0, import_date9.getSettings)().l10n.startOfWeek
26714 };
26715 function getValueFormatted4({
26716 item,
26717 field
26718 }) {
26719 const value = field.getValue({ item });
26720 if (["", void 0, null].includes(value)) {
26721 return "";
26722 }
26723 let formatDatetime;
26724 if (field.type !== "datetime") {
26725 formatDatetime = format4;
26726 } else {
26727 formatDatetime = field.format;
26728 }
26729 return (0, import_date9.dateI18n)(formatDatetime.datetime, (0, import_date9.getDate)(value));
26730 }
26731 var sort = (a, b, direction) => {
26732 const timeA = new Date(a).getTime();
26733 const timeB = new Date(b).getTime();
26734 return direction === "asc" ? timeA - timeB : timeB - timeA;
26735 };
26736 var datetime_default = {
26737 type: "datetime",
26738 render,
26739 Edit: "datetime",
26740 sort,
26741 enableSorting: true,
26742 enableGlobalSearch: false,
26743 defaultOperators: [
26744 OPERATOR_ON,
26745 OPERATOR_NOT_ON,
26746 OPERATOR_BEFORE,
26747 OPERATOR_AFTER,
26748 OPERATOR_BEFORE_INC,
26749 OPERATOR_AFTER_INC,
26750 OPERATOR_IN_THE_PAST,
26751 OPERATOR_OVER
26752 ],
26753 validOperators: [
26754 OPERATOR_ON,
26755 OPERATOR_NOT_ON,
26756 OPERATOR_BEFORE,
26757 OPERATOR_AFTER,
26758 OPERATOR_BEFORE_INC,
26759 OPERATOR_AFTER_INC,
26760 OPERATOR_IN_THE_PAST,
26761 OPERATOR_OVER
26762 ],
26763 format: format4,
26764 getValueFormatted: getValueFormatted4,
26765 validate: {
26766 required: isValidRequired,
26767 elements: isValidElements,
26768 min: isValidMinDate,
26769 max: isValidMaxDate
26770 }
26771 };
26772
26773 // packages/dataviews/build-module/field-types/date.mjs
26774 var import_date10 = __toESM(require_date(), 1);
26775 var format5 = {
26776 date: (0, import_date10.getSettings)().formats.date,
26777 weekStartsOn: (0, import_date10.getSettings)().l10n.startOfWeek
26778 };
26779 function getValueFormatted5({
26780 item,
26781 field
26782 }) {
26783 const value = field.getValue({ item });
26784 if (["", void 0, null].includes(value)) {
26785 return "";
26786 }
26787 let formatDate2;
26788 if (field.type !== "date") {
26789 formatDate2 = format5;
26790 } else {
26791 formatDate2 = field.format;
26792 }
26793 return (0, import_date10.dateI18n)(formatDate2.date, (0, import_date10.getDate)(value));
26794 }
26795 var sort2 = (a, b, direction) => {
26796 const timeA = new Date(a).getTime();
26797 const timeB = new Date(b).getTime();
26798 return direction === "asc" ? timeA - timeB : timeB - timeA;
26799 };
26800 var date_default = {
26801 type: "date",
26802 render,
26803 Edit: "date",
26804 sort: sort2,
26805 enableSorting: true,
26806 enableGlobalSearch: false,
26807 defaultOperators: [
26808 OPERATOR_ON,
26809 OPERATOR_NOT_ON,
26810 OPERATOR_BEFORE,
26811 OPERATOR_AFTER,
26812 OPERATOR_BEFORE_INC,
26813 OPERATOR_AFTER_INC,
26814 OPERATOR_IN_THE_PAST,
26815 OPERATOR_OVER,
26816 OPERATOR_BETWEEN
26817 ],
26818 validOperators: [
26819 OPERATOR_ON,
26820 OPERATOR_NOT_ON,
26821 OPERATOR_BEFORE,
26822 OPERATOR_AFTER,
26823 OPERATOR_BEFORE_INC,
26824 OPERATOR_AFTER_INC,
26825 OPERATOR_IN_THE_PAST,
26826 OPERATOR_OVER,
26827 OPERATOR_BETWEEN
26828 ],
26829 format: format5,
26830 getValueFormatted: getValueFormatted5,
26831 validate: {
26832 required: isValidRequired,
26833 elements: isValidElements,
26834 min: isValidMinDate,
26835 max: isValidMaxDate
26836 }
26837 };
26838
26839 // packages/dataviews/build-module/field-types/time.mjs
26840 var import_date11 = __toESM(require_date(), 1);
26841 var format6 = {
26842 time: (0, import_date11.getSettings)().formats.time
26843 };
26844 var ANCHOR_DATE = "2000-01-01";
26845 function toAnchoredDate(secondsSinceMidnight) {
26846 const hours = Math.floor(secondsSinceMidnight / 3600);
26847 const minutes = Math.floor(secondsSinceMidnight % 3600 / 60);
26848 const seconds = secondsSinceMidnight % 60;
26849 const time = [hours, minutes, seconds].map((part) => String(part).padStart(2, "0")).join(":");
26850 return (0, import_date11.getDate)(`${ANCHOR_DATE}T${time}`);
26851 }
26852 function getValueFormatted6({
26853 item,
26854 field
26855 }) {
26856 const secondsSinceMidnight = parseTime2(field.getValue({ item }));
26857 if (secondsSinceMidnight === null) {
26858 return "";
26859 }
26860 let formatTime;
26861 if (field.type !== "time") {
26862 formatTime = format6;
26863 } else {
26864 formatTime = field.format;
26865 }
26866 return (0, import_date11.dateI18n)(formatTime.time, toAnchoredDate(secondsSinceMidnight));
26867 }
26868 var sort3 = (a, b, direction) => {
26869 const timeA = parseTime2(a);
26870 const timeB = parseTime2(b);
26871 if (timeA === null || timeB === null) {
26872 if (timeA === timeB) {
26873 return 0;
26874 }
26875 return timeA === null ? 1 : -1;
26876 }
26877 return direction === "asc" ? timeA - timeB : timeB - timeA;
26878 };
26879 var time_default = {
26880 type: "time",
26881 render,
26882 Edit: "time",
26883 sort: sort3,
26884 enableSorting: true,
26885 enableGlobalSearch: false,
26886 defaultOperators: [
26887 OPERATOR_ON,
26888 OPERATOR_NOT_ON,
26889 OPERATOR_BEFORE,
26890 OPERATOR_AFTER,
26891 OPERATOR_BEFORE_INC,
26892 OPERATOR_AFTER_INC,
26893 OPERATOR_BETWEEN
26894 ],
26895 validOperators: [
26896 OPERATOR_ON,
26897 OPERATOR_NOT_ON,
26898 OPERATOR_BEFORE,
26899 OPERATOR_AFTER,
26900 OPERATOR_BEFORE_INC,
26901 OPERATOR_AFTER_INC,
26902 OPERATOR_BETWEEN
26903 ],
26904 format: format6,
26905 getValueFormatted: getValueFormatted6,
26906 validate: {
26907 required: isValidRequired,
26908 elements: isValidElements,
26909 min: isValidMinTime,
26910 max: isValidMaxTime
26911 }
26912 };
26913
26914 // packages/dataviews/build-module/field-types/boolean.mjs
26915 var import_i18n23 = __toESM(require_i18n(), 1);
26916
26917 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs
26918 function isValidRequiredForBool(item, field) {
26919 const value = field.getValue({ item });
26920 return value === true;
26921 }
26922
26923 // packages/dataviews/build-module/field-types/boolean.mjs
26924 function getValueFormatted7({
26925 item,
26926 field
26927 }) {
26928 const value = field.getValue({ item });
26929 if (value === true) {
26930 return (0, import_i18n23.__)("True");
26931 }
26932 if (value === false) {
26933 return (0, import_i18n23.__)("False");
26934 }
26935 return "";
26936 }
26937 function isValidCustom4(item, field) {
26938 const value = field.getValue({ item });
26939 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
26940 return (0, import_i18n23.__)("Value must be true, false, or undefined");
26941 }
26942 return null;
26943 }
26944 var sort4 = (a, b, direction) => {
26945 const boolA = Boolean(a);
26946 const boolB = Boolean(b);
26947 if (boolA === boolB) {
26948 return 0;
26949 }
26950 if (direction === "asc") {
26951 return boolA ? 1 : -1;
26952 }
26953 return boolA ? -1 : 1;
26954 };
26955 var boolean_default = {
26956 type: "boolean",
26957 render,
26958 Edit: "checkbox",
26959 sort: sort4,
26960 validate: {
26961 required: isValidRequiredForBool,
26962 elements: isValidElements,
26963 custom: isValidCustom4
26964 },
26965 enableSorting: true,
26966 enableGlobalSearch: false,
26967 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26968 validOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26969 format: {},
26970 getValueFormatted: getValueFormatted7
26971 };
26972
26973 // packages/dataviews/build-module/field-types/media.mjs
26974 var media_default = {
26975 type: "media",
26976 render: () => null,
26977 Edit: null,
26978 sort: () => 0,
26979 enableSorting: false,
26980 enableGlobalSearch: false,
26981 defaultOperators: [],
26982 validOperators: [],
26983 format: {},
26984 getValueFormatted: get_value_formatted_default_default,
26985 // cannot validate any constraint, so
26986 // the only available validation for the field author
26987 // would be providing a custom validator.
26988 validate: {}
26989 };
26990
26991 // packages/dataviews/build-module/field-types/array.mjs
26992 var import_i18n24 = __toESM(require_i18n(), 1);
26993
26994 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs
26995 function isValidRequiredForArray(item, field) {
26996 const value = field.getValue({ item });
26997 return Array.isArray(value) && value.length > 0 && value.every(
26998 (element) => ![void 0, "", null].includes(element)
26999 );
27000 }
27001
27002 // packages/dataviews/build-module/field-types/array.mjs
27003 function getValueFormatted8({
27004 item,
27005 field
27006 }) {
27007 const value = field.getValue({ item });
27008 const arr = Array.isArray(value) ? value : [];
27009 return arr.join(", ");
27010 }
27011 function render2({ item, field }) {
27012 return getValueFormatted8({ item, field });
27013 }
27014 function isValidCustom5(item, field) {
27015 const value = field.getValue({ item });
27016 if ([void 0, "", null].includes(value)) {
27017 return null;
27018 }
27019 if (!Array.isArray(value)) {
27020 return (0, import_i18n24.__)("Value must be an array.");
27021 }
27022 if (!value.every((v2) => typeof v2 === "string")) {
27023 return (0, import_i18n24.__)("Every value must be a string.");
27024 }
27025 return null;
27026 }
27027 var sort5 = (a, b, direction) => {
27028 const arrA = Array.isArray(a) ? a : [];
27029 const arrB = Array.isArray(b) ? b : [];
27030 if (arrA.length !== arrB.length) {
27031 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
27032 }
27033 const joinedA = arrA.join(",");
27034 const joinedB = arrB.join(",");
27035 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
27036 };
27037 var array_default = {
27038 type: "array",
27039 render: render2,
27040 Edit: "array",
27041 sort: sort5,
27042 enableSorting: true,
27043 enableGlobalSearch: false,
27044 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27045 validOperators: [
27046 OPERATOR_IS_ANY,
27047 OPERATOR_IS_NONE,
27048 OPERATOR_IS_ALL,
27049 OPERATOR_IS_NOT_ALL
27050 ],
27051 format: {},
27052 getValueFormatted: getValueFormatted8,
27053 validate: {
27054 required: isValidRequiredForArray,
27055 elements: isValidElements,
27056 custom: isValidCustom5
27057 }
27058 };
27059
27060 // packages/dataviews/build-module/field-types/password.mjs
27061 function getValueFormatted9({
27062 item,
27063 field
27064 }) {
27065 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
27066 }
27067 var password_default = {
27068 type: "password",
27069 render,
27070 Edit: "password",
27071 sort: () => 0,
27072 // Passwords should not be sortable for security reasons
27073 enableSorting: false,
27074 enableGlobalSearch: false,
27075 defaultOperators: [],
27076 validOperators: [],
27077 format: {},
27078 getValueFormatted: getValueFormatted9,
27079 validate: {
27080 required: isValidRequired,
27081 pattern: isValidPattern,
27082 minLength: isValidMinLength,
27083 maxLength: isValidMaxLength,
27084 elements: isValidElements
27085 }
27086 };
27087
27088 // packages/dataviews/build-module/field-types/telephone.mjs
27089 var telephone_default = {
27090 type: "telephone",
27091 render,
27092 Edit: "telephone",
27093 sort: sort_text_default,
27094 enableSorting: true,
27095 enableGlobalSearch: false,
27096 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27097 validOperators: [
27098 OPERATOR_IS,
27099 OPERATOR_IS_NOT,
27100 OPERATOR_CONTAINS,
27101 OPERATOR_NOT_CONTAINS,
27102 OPERATOR_STARTS_WITH,
27103 // Multiple selection
27104 OPERATOR_IS_ANY,
27105 OPERATOR_IS_NONE,
27106 OPERATOR_IS_NOT_ALL
27107 ],
27108 format: {},
27109 getValueFormatted: get_value_formatted_default_default,
27110 validate: {
27111 required: isValidRequired,
27112 pattern: isValidPattern,
27113 minLength: isValidMinLength,
27114 maxLength: isValidMaxLength,
27115 elements: isValidElements
27116 }
27117 };
27118
27119 // packages/dataviews/build-module/field-types/color.mjs
27120 var import_i18n25 = __toESM(require_i18n(), 1);
27121 var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
27122 function render3({ item, field }) {
27123 if (field.hasElements) {
27124 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(RenderFromElements, { item, field });
27125 }
27126 const value = get_value_formatted_default_default({ item, field });
27127 if (!value || !A(value).isValid()) {
27128 return value;
27129 }
27130 return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
27131 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
27132 "div",
27133 {
27134 style: {
27135 width: "16px",
27136 height: "16px",
27137 borderRadius: "50%",
27138 backgroundColor: value,
27139 border: "1px solid #ddd",
27140 flexShrink: 0
27141 }
27142 }
27143 ),
27144 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { children: value })
27145 ] });
27146 }
27147 function isValidCustom6(item, field) {
27148 const value = field.getValue({ item });
27149 if (![void 0, "", null].includes(value) && !A(value).isValid()) {
27150 return (0, import_i18n25.__)("Value must be a valid color.");
27151 }
27152 return null;
27153 }
27154 var sort6 = (a, b, direction) => {
27155 const colorA = A(a);
27156 const colorB = A(b);
27157 if (!colorA.isValid() && !colorB.isValid()) {
27158 return 0;
27159 }
27160 if (!colorA.isValid()) {
27161 return direction === "asc" ? 1 : -1;
27162 }
27163 if (!colorB.isValid()) {
27164 return direction === "asc" ? -1 : 1;
27165 }
27166 const hslA = colorA.toHsl();
27167 const hslB = colorB.toHsl();
27168 if (hslA.h !== hslB.h) {
27169 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
27170 }
27171 if (hslA.s !== hslB.s) {
27172 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
27173 }
27174 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
27175 };
27176 var color_default = {
27177 type: "color",
27178 render: render3,
27179 Edit: "color",
27180 sort: sort6,
27181 enableSorting: true,
27182 enableGlobalSearch: false,
27183 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27184 validOperators: [
27185 OPERATOR_IS,
27186 OPERATOR_IS_NOT,
27187 OPERATOR_IS_ANY,
27188 OPERATOR_IS_NONE
27189 ],
27190 format: {},
27191 getValueFormatted: get_value_formatted_default_default,
27192 validate: {
27193 required: isValidRequired,
27194 elements: isValidElements,
27195 custom: isValidCustom6
27196 }
27197 };
27198
27199 // packages/dataviews/build-module/field-types/url.mjs
27200 var url_default = {
27201 type: "url",
27202 render,
27203 Edit: "url",
27204 sort: sort_text_default,
27205 enableSorting: true,
27206 enableGlobalSearch: false,
27207 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27208 validOperators: [
27209 OPERATOR_IS,
27210 OPERATOR_IS_NOT,
27211 OPERATOR_CONTAINS,
27212 OPERATOR_NOT_CONTAINS,
27213 OPERATOR_STARTS_WITH,
27214 // Multiple selection
27215 OPERATOR_IS_ANY,
27216 OPERATOR_IS_NONE,
27217 OPERATOR_IS_NOT_ALL
27218 ],
27219 format: {},
27220 getValueFormatted: get_value_formatted_default_default,
27221 validate: {
27222 required: isValidRequired,
27223 pattern: isValidPattern,
27224 minLength: isValidMinLength,
27225 maxLength: isValidMaxLength,
27226 elements: isValidElements
27227 }
27228 };
27229
27230 // packages/dataviews/build-module/field-types/no-type.mjs
27231 var sort7 = (a, b, direction) => {
27232 if (typeof a === "number" && typeof b === "number") {
27233 return sort_number_default(a, b, direction);
27234 }
27235 return sort_text_default(a, b, direction);
27236 };
27237 var no_type_default = {
27238 // type: no type for this one
27239 render,
27240 Edit: null,
27241 sort: sort7,
27242 enableSorting: true,
27243 enableGlobalSearch: false,
27244 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
27245 validOperators: getAllOperatorNames(),
27246 format: {},
27247 getValueFormatted: get_value_formatted_default_default,
27248 validate: {
27249 required: isValidRequired,
27250 elements: isValidElements
27251 }
27252 };
27253
27254 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs
27255 function supportsNumericRangeConstraint(type) {
27256 return type === "integer" || type === "number";
27257 }
27258 function supportsStringRangeConstraint(type) {
27259 return type === "date" || type === "datetime" || type === "time";
27260 }
27261 function normalizeRangeRule(value, fieldType, key) {
27262 const validator = fieldType.validate[key];
27263 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsStringRangeConstraint(fieldType.type))) {
27264 return { constraint: value, validate: validator };
27265 }
27266 return void 0;
27267 }
27268 function getIsValid(field, fieldType) {
27269 const rules = field.isValid;
27270 let required;
27271 if (rules?.required === true && fieldType.validate.required !== void 0) {
27272 required = {
27273 constraint: true,
27274 validate: fieldType.validate.required
27275 };
27276 }
27277 let elements;
27278 if ((rules?.elements === true || // elements is enabled unless the field opts-out
27279 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
27280 elements = {
27281 constraint: true,
27282 validate: fieldType.validate.elements
27283 };
27284 }
27285 const min3 = normalizeRangeRule(rules?.min, fieldType, "min");
27286 const max3 = normalizeRangeRule(rules?.max, fieldType, "max");
27287 const minLengthValue = rules?.minLength;
27288 let minLength;
27289 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) {
27290 minLength = {
27291 constraint: minLengthValue,
27292 validate: fieldType.validate.minLength
27293 };
27294 }
27295 const maxLengthValue = rules?.maxLength;
27296 let maxLength;
27297 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) {
27298 maxLength = {
27299 constraint: maxLengthValue,
27300 validate: fieldType.validate.maxLength
27301 };
27302 }
27303 const patternValue = rules?.pattern;
27304 let pattern;
27305 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) {
27306 pattern = {
27307 constraint: patternValue,
27308 validate: fieldType.validate.pattern
27309 };
27310 }
27311 const custom = rules?.custom ?? fieldType.validate.custom;
27312 return {
27313 required,
27314 elements,
27315 min: min3,
27316 max: max3,
27317 minLength,
27318 maxLength,
27319 pattern,
27320 custom
27321 };
27322 }
27323
27324 // packages/dataviews/build-module/field-types/utils/get-filter.mjs
27325 function getFilter(fieldType) {
27326 return fieldType.validOperators.reduce((accumulator, operator) => {
27327 const operatorObj = getOperatorByName(operator);
27328 if (operatorObj?.filter) {
27329 accumulator[operator] = operatorObj.filter;
27330 }
27331 return accumulator;
27332 }, {});
27333 }
27334
27335 // packages/dataviews/build-module/field-types/utils/get-format.mjs
27336 function getFormat(field, fieldType) {
27337 return {
27338 ...fieldType.format,
27339 ...field.format
27340 };
27341 }
27342 var get_format_default = getFormat;
27343
27344 // packages/dataviews/build-module/field-types/index.mjs
27345 function getFieldTypeByName(type) {
27346 const found = [
27347 email_default,
27348 integer_default,
27349 number_default,
27350 text_default,
27351 datetime_default,
27352 date_default,
27353 time_default,
27354 boolean_default,
27355 media_default,
27356 array_default,
27357 password_default,
27358 telephone_default,
27359 color_default,
27360 url_default
27361 ].find((fieldType) => fieldType?.type === type);
27362 if (!!found) {
27363 return found;
27364 }
27365 return no_type_default;
27366 }
27367 function normalizeFields(fields2) {
27368 return fields2.map((field) => {
27369 const fieldType = getFieldTypeByName(field.type);
27370 const getValue = field.getValue || get_value_from_id_default(field.id);
27371 const sort8 = function(a, b, direction) {
27372 const aValue = getValue({ item: a });
27373 const bValue = getValue({ item: b });
27374 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
27375 };
27376 return {
27377 id: field.id,
27378 label: field.label || field.id,
27379 header: field.header || field.label || field.id,
27380 description: field.description,
27381 placeholder: field.placeholder,
27382 getValue,
27383 setValue: field.setValue || set_value_from_id_default(field.id),
27384 elements: field.elements,
27385 getElements: field.getElements,
27386 hasElements: hasElements(field),
27387 isVisible: field.isVisible,
27388 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled,
27389 enableHiding: field.enableHiding ?? true,
27390 readOnly: field.readOnly ?? false,
27391 // The type provides defaults for the following props
27392 type: fieldType.type,
27393 render: field.render ?? fieldType.render,
27394 Edit: getControl(field, fieldType.Edit),
27395 sort: sort8,
27396 enableSorting: field.enableSorting ?? fieldType.enableSorting,
27397 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
27398 isValid: getIsValid(field, fieldType),
27399 filterBy: get_filter_by_default(
27400 field,
27401 fieldType.defaultOperators,
27402 fieldType.validOperators
27403 ),
27404 filter: getFilter(fieldType),
27405 format: get_format_default(field, fieldType),
27406 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
27407 };
27408 });
27409 }
27410
27411 // packages/dataviews/build-module/dataform/index.mjs
27412 var import_element101 = __toESM(require_element(), 1);
27413
27414 // packages/dataviews/build-module/components/dataform-context/index.mjs
27415 var import_element91 = __toESM(require_element(), 1);
27416 var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
27417 var DataFormContext = (0, import_element91.createContext)({
27418 fields: []
27419 });
27420 DataFormContext.displayName = "DataFormContext";
27421 function DataFormProvider({
27422 fields: fields2,
27423 children
27424 }) {
27425 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(DataFormContext.Provider, { value: { fields: fields2 }, children });
27426 }
27427 var dataform_context_default = DataFormContext;
27428
27429 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
27430 var import_element100 = __toESM(require_element(), 1);
27431
27432 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
27433 var import_element92 = __toESM(require_element(), 1);
27434 var import_components23 = __toESM(require_components(), 1);
27435
27436 // packages/dataviews/build-module/components/dataform-layouts/can-render-field.mjs
27437 function canRenderField(field) {
27438 return !!field && (field.readOnly === true || !!field.Edit);
27439 }
27440
27441 // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs
27442 var import_i18n26 = __toESM(require_i18n(), 1);
27443 var DEFAULT_LAYOUT = {
27444 type: "regular",
27445 labelPosition: "top"
27446 };
27447 var normalizeCardSummaryField = (sum) => {
27448 if (typeof sum === "string") {
27449 return [{ id: sum, visibility: "when-collapsed" }];
27450 }
27451 return sum.map((item) => {
27452 if (typeof item === "string") {
27453 return { id: item, visibility: "when-collapsed" };
27454 }
27455 return { id: item.id, visibility: item.visibility };
27456 });
27457 };
27458 function normalizeLayout(layout) {
27459 let normalizedLayout = DEFAULT_LAYOUT;
27460 if (layout?.type === "regular") {
27461 normalizedLayout = {
27462 type: "regular",
27463 labelPosition: layout?.labelPosition ?? "top"
27464 };
27465 } else if (layout?.type === "panel") {
27466 const summary = layout.summary ?? [];
27467 const normalizedSummary = Array.isArray(summary) ? summary : [summary];
27468 const openAs = layout?.openAs;
27469 let normalizedOpenAs;
27470 if (typeof openAs === "object" && openAs.type === "modal") {
27471 normalizedOpenAs = {
27472 type: "modal",
27473 applyLabel: openAs.applyLabel?.trim() || (0, import_i18n26.__)("Apply"),
27474 cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n26.__)("Cancel")
27475 };
27476 } else if (openAs === "modal") {
27477 normalizedOpenAs = {
27478 type: "modal",
27479 applyLabel: (0, import_i18n26.__)("Apply"),
27480 cancelLabel: (0, import_i18n26.__)("Cancel")
27481 };
27482 } else {
27483 normalizedOpenAs = { type: "dropdown" };
27484 }
27485 normalizedLayout = {
27486 type: "panel",
27487 labelPosition: layout?.labelPosition ?? "side",
27488 openAs: normalizedOpenAs,
27489 summary: normalizedSummary,
27490 editVisibility: layout?.editVisibility ?? "on-hover",
27491 showPlaceholderIfEmpty: layout?.showPlaceholderIfEmpty ?? false
27492 };
27493 } else if (layout?.type === "card") {
27494 if (layout.withHeader === false) {
27495 normalizedLayout = {
27496 type: "card",
27497 withHeader: false,
27498 isOpened: true,
27499 summary: [],
27500 isCollapsible: false
27501 };
27502 } else {
27503 const summary = layout.summary ?? [];
27504 normalizedLayout = {
27505 type: "card",
27506 withHeader: true,
27507 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
27508 summary: normalizeCardSummaryField(summary),
27509 isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible
27510 };
27511 }
27512 } else if (layout?.type === "row") {
27513 normalizedLayout = {
27514 type: "row",
27515 alignment: layout?.alignment ?? "center",
27516 styles: layout?.styles ?? {}
27517 };
27518 } else if (layout?.type === "details") {
27519 normalizedLayout = {
27520 type: "details",
27521 summary: layout?.summary ?? ""
27522 };
27523 }
27524 return normalizedLayout;
27525 }
27526 function normalizeForm(form) {
27527 const normalizedFormLayout = normalizeLayout(form?.layout);
27528 const normalizedFields = (form.fields ?? []).map(
27529 (field) => {
27530 if (typeof field === "string") {
27531 return {
27532 id: field,
27533 layout: normalizedFormLayout
27534 };
27535 }
27536 const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout;
27537 return {
27538 id: field.id,
27539 layout: fieldLayout,
27540 ...!!field.label && { label: field.label },
27541 ...!!field.description && {
27542 description: field.description
27543 },
27544 ..."children" in field && Array.isArray(field.children) && {
27545 children: normalizeForm({
27546 fields: field.children,
27547 layout: DEFAULT_LAYOUT
27548 }).fields
27549 }
27550 };
27551 }
27552 );
27553 return {
27554 layout: normalizedFormLayout,
27555 fields: normalizedFields
27556 };
27557 }
27558 var normalize_form_default = normalizeForm;
27559
27560 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
27561 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
27562 function Header4({ title }) {
27563 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27564 Stack,
27565 {
27566 direction: "column",
27567 className: "dataforms-layouts-regular__header",
27568 gap: "lg",
27569 children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_components23.__experimentalHeading, { level: 2, size: 13, children: title }) })
27570 }
27571 );
27572 }
27573 function FormRegularField({
27574 data,
27575 field,
27576 onChange,
27577 hideLabelFromVision,
27578 markWhenOptional,
27579 validity
27580 }) {
27581 const { fields: fields2 } = (0, import_element92.useContext)(dataform_context_default);
27582 const layout = field.layout;
27583 const form = (0, import_element92.useMemo)(
27584 () => ({
27585 layout: DEFAULT_LAYOUT,
27586 fields: !!field.children ? field.children : []
27587 }),
27588 [field]
27589 );
27590 if (!!field.children) {
27591 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(import_jsx_runtime118.Fragment, { children: [
27592 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Header4, { title: field.label }),
27593 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27594 DataFormLayout,
27595 {
27596 data,
27597 form,
27598 onChange,
27599 validity: validity?.children
27600 }
27601 )
27602 ] });
27603 }
27604 const labelPosition = layout.labelPosition;
27605 const fieldDefinition = fields2.find(
27606 (fieldDef) => fieldDef.id === field.id
27607 );
27608 if (!canRenderField(fieldDefinition)) {
27609 return null;
27610 }
27611 if (labelPosition === "side") {
27612 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(
27613 Stack,
27614 {
27615 direction: "row",
27616 className: "dataforms-layouts-regular__field",
27617 gap: "sm",
27618 children: [
27619 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27620 "div",
27621 {
27622 className: clsx_default(
27623 "dataforms-layouts-regular__field-label",
27624 `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
27625 ),
27626 children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_components23.BaseControl.VisualLabel, { children: fieldDefinition.label })
27627 }
27628 ),
27629 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27630 fieldDefinition.render,
27631 {
27632 item: data,
27633 field: fieldDefinition
27634 }
27635 ) : fieldDefinition.Edit && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27636 fieldDefinition.Edit,
27637 {
27638 data,
27639 field: fieldDefinition,
27640 onChange,
27641 hideLabelFromVision: true,
27642 markWhenOptional,
27643 validity
27644 },
27645 fieldDefinition.id
27646 ) })
27647 ]
27648 }
27649 );
27650 }
27651 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_jsx_runtime118.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(import_jsx_runtime118.Fragment, { children: [
27652 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(import_components23.BaseControl.VisualLabel, { children: fieldDefinition.label }),
27653 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27654 fieldDefinition.render,
27655 {
27656 item: data,
27657 field: fieldDefinition
27658 }
27659 )
27660 ] }) }) : fieldDefinition.Edit && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
27661 fieldDefinition.Edit,
27662 {
27663 data,
27664 field: fieldDefinition,
27665 onChange,
27666 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
27667 markWhenOptional,
27668 validity
27669 }
27670 ) });
27671 }
27672
27673 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
27674 var import_deepmerge2 = __toESM(require_cjs(), 1);
27675 var import_components26 = __toESM(require_components(), 1);
27676 var import_element96 = __toESM(require_element(), 1);
27677 var import_compose13 = __toESM(require_compose(), 1);
27678
27679 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
27680 var import_components25 = __toESM(require_components(), 1);
27681 var import_i18n27 = __toESM(require_i18n(), 1);
27682 var import_compose12 = __toESM(require_compose(), 1);
27683
27684 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs
27685 function getLabelClassName(labelPosition, showError) {
27686 return clsx_default(
27687 "dataforms-layouts-panel__field-label",
27688 `dataforms-layouts-panel__field-label--label-position-${labelPosition}`,
27689 { "has-error": showError }
27690 );
27691 }
27692 var get_label_classname_default = getLabelClassName;
27693
27694 // packages/dataviews/build-module/components/dataform-layouts/panel/field-label-content.mjs
27695 var import_components24 = __toESM(require_components(), 1);
27696 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
27697 function FieldLabelContent({
27698 showError,
27699 errorMessage,
27700 fieldLabel,
27701 errorId
27702 }) {
27703 if (!showError) {
27704 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_jsx_runtime119.Fragment, { children: fieldLabel });
27705 }
27706 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [
27707 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_components24.Icon, { icon: error_default, size: 16 }),
27708 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VisuallyHidden, { id: errorId, children: errorMessage }),
27709 fieldLabel
27710 ] });
27711 }
27712 var field_label_content_default = FieldLabelContent;
27713
27714 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs
27715 function getFirstValidationError(validity) {
27716 if (!validity) {
27717 return void 0;
27718 }
27719 const validityRules = Object.keys(validity).filter(
27720 (key) => key !== "children"
27721 );
27722 for (const key of validityRules) {
27723 const rule = validity[key];
27724 if (rule === void 0) {
27725 continue;
27726 }
27727 if (rule.type === "invalid") {
27728 if (rule.message) {
27729 return rule.message;
27730 }
27731 if (key === "required") {
27732 return "A required field is empty";
27733 }
27734 return "Unidentified validation error";
27735 }
27736 }
27737 if (validity.children) {
27738 for (const childValidity of Object.values(validity.children)) {
27739 const childError = getFirstValidationError(childValidity);
27740 if (childError) {
27741 return childError;
27742 }
27743 }
27744 }
27745 return void 0;
27746 }
27747 var get_first_validation_error_default = getFirstValidationError;
27748
27749 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
27750 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
27751 function SummaryValue({
27752 item,
27753 field,
27754 showPlaceholderIfEmpty
27755 }) {
27756 if (showPlaceholderIfEmpty && field.placeholder && [void 0, null, ""].includes(field.getValue({ item }))) {
27757 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "dataforms-layouts-panel__field-placeholder", children: field.placeholder });
27758 }
27759 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(field.render, { item, field });
27760 }
27761 function SummaryButton({
27762 data,
27763 field,
27764 fieldLabel,
27765 summaryFields,
27766 validity,
27767 touched,
27768 disabled: disabled2,
27769 isOpen,
27770 onClick
27771 }) {
27772 const { labelPosition, editVisibility, showPlaceholderIfEmpty } = field.layout;
27773 const errorMessage = get_first_validation_error_default(validity);
27774 const showError = touched && !!errorMessage;
27775 const labelClassName = get_label_classname_default(labelPosition, showError);
27776 const className = clsx_default(
27777 "dataforms-layouts-panel__field-trigger",
27778 `dataforms-layouts-panel__field-trigger--label-${labelPosition}`,
27779 {
27780 "is-disabled": disabled2,
27781 "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always"
27782 }
27783 );
27784 const controlId = (0, import_compose12.useInstanceId)(
27785 SummaryButton,
27786 "dataforms-layouts-panel__field-control"
27787 );
27788 const errorId = `${controlId}-error`;
27789 const ariaLabel = showError ? (0, import_i18n27.sprintf)(
27790 // translators: %s: Field name.
27791 (0, import_i18n27._x)("Edit %s (has errors)", "field"),
27792 fieldLabel || ""
27793 ) : (0, import_i18n27.sprintf)(
27794 // translators: %s: Field name.
27795 (0, import_i18n27._x)("Edit %s", "field"),
27796 fieldLabel || ""
27797 );
27798 return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className, children: [
27799 labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: labelClassName, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27800 field_label_content_default,
27801 {
27802 showError,
27803 errorMessage,
27804 fieldLabel,
27805 errorId
27806 }
27807 ) }),
27808 labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27809 field_label_content_default,
27810 {
27811 showError: true,
27812 errorMessage,
27813 errorId
27814 }
27815 ),
27816 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27817 "span",
27818 {
27819 id: `${controlId}`,
27820 className: "dataforms-layouts-panel__field-control",
27821 children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27822 "span",
27823 {
27824 style: {
27825 display: "flex",
27826 flexDirection: "column",
27827 alignItems: "flex-start",
27828 width: "100%",
27829 gap: "2px"
27830 },
27831 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27832 "span",
27833 {
27834 style: { width: "100%" },
27835 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27836 SummaryValue,
27837 {
27838 item: data,
27839 field: summaryField,
27840 showPlaceholderIfEmpty
27841 }
27842 )
27843 },
27844 summaryField.id
27845 ))
27846 }
27847 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27848 SummaryValue,
27849 {
27850 item: data,
27851 field: summaryField,
27852 showPlaceholderIfEmpty
27853 },
27854 summaryField.id
27855 ))
27856 }
27857 ),
27858 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
27859 import_components25.Button,
27860 {
27861 className: "dataforms-layouts-panel__field-trigger-icon",
27862 label: ariaLabel,
27863 icon: pencil_default,
27864 size: "small",
27865 "aria-expanded": isOpen,
27866 "aria-haspopup": "dialog",
27867 "aria-describedby": showError ? `${controlId} ${errorId}` : controlId,
27868 onClick
27869 }
27870 )
27871 ] });
27872 }
27873
27874 // packages/dataviews/build-module/hooks/use-form-validity.mjs
27875 var import_deepmerge = __toESM(require_cjs(), 1);
27876 var import_es6 = __toESM(require_es6(), 1);
27877 var import_element93 = __toESM(require_element(), 1);
27878 var import_i18n28 = __toESM(require_i18n(), 1);
27879 function isFormValid(formValidity) {
27880 if (!formValidity) {
27881 return true;
27882 }
27883 return Object.values(formValidity).every((fieldValidation) => {
27884 return Object.entries(fieldValidation).every(
27885 ([key, validation]) => {
27886 if (key === "children" && validation && typeof validation === "object") {
27887 return isFormValid(validation);
27888 }
27889 return validation.type !== "invalid" && validation.type !== "validating";
27890 }
27891 );
27892 });
27893 }
27894 function getFormFieldsToValidate(form, fields2) {
27895 const normalizedForm = normalize_form_default(form);
27896 if (normalizedForm.fields.length === 0) {
27897 return [];
27898 }
27899 const fieldsMap = /* @__PURE__ */ new Map();
27900 fields2.forEach((field) => {
27901 fieldsMap.set(field.id, field);
27902 });
27903 function processFormField(formField) {
27904 if ("children" in formField && Array.isArray(formField.children)) {
27905 const processedChildren = formField.children.map(processFormField).filter((child) => child !== null);
27906 if (processedChildren.length === 0) {
27907 return null;
27908 }
27909 return {
27910 id: formField.id,
27911 children: processedChildren
27912 };
27913 }
27914 const fieldDef = fieldsMap.get(formField.id);
27915 if (!fieldDef) {
27916 return null;
27917 }
27918 const [normalizedField] = normalizeFields([fieldDef]);
27919 return {
27920 id: formField.id,
27921 children: [],
27922 field: normalizedField
27923 };
27924 }
27925 const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null);
27926 return toValidate;
27927 }
27928 function setValidityAtPath(formValidity, fieldValidity, path) {
27929 if (!formValidity) {
27930 formValidity = {};
27931 }
27932 if (path.length === 0) {
27933 return formValidity;
27934 }
27935 const result = { ...formValidity };
27936 let current = result;
27937 for (let i = 0; i < path.length - 1; i++) {
27938 const segment = path[i];
27939 if (!current[segment]) {
27940 current[segment] = {};
27941 }
27942 current[segment] = { ...current[segment] };
27943 current = current[segment];
27944 }
27945 const finalKey = path[path.length - 1];
27946 current[finalKey] = {
27947 ...current[finalKey] || {},
27948 ...fieldValidity
27949 };
27950 return result;
27951 }
27952 function removeValidationProperty(formValidity, path, property) {
27953 if (!formValidity || path.length === 0) {
27954 return formValidity;
27955 }
27956 const result = { ...formValidity };
27957 let current = result;
27958 for (let i = 0; i < path.length - 1; i++) {
27959 const segment = path[i];
27960 if (!current[segment]) {
27961 return formValidity;
27962 }
27963 current[segment] = { ...current[segment] };
27964 current = current[segment];
27965 }
27966 const finalKey = path[path.length - 1];
27967 if (!current[finalKey]) {
27968 return formValidity;
27969 }
27970 const fieldValidity = { ...current[finalKey] };
27971 delete fieldValidity[property];
27972 if (Object.keys(fieldValidity).length === 0) {
27973 delete current[finalKey];
27974 } else {
27975 current[finalKey] = fieldValidity;
27976 }
27977 if (Object.keys(result).length === 0) {
27978 return void 0;
27979 }
27980 return result;
27981 }
27982 function handleElementsValidationAsync(promise, formField, promiseHandler) {
27983 const { elementsCounterRef, setFormValidity, path, item } = promiseHandler;
27984 const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1;
27985 elementsCounterRef.current[formField.id] = currentToken;
27986 promise.then((result) => {
27987 if (currentToken !== elementsCounterRef.current[formField.id]) {
27988 return;
27989 }
27990 if (!Array.isArray(result)) {
27991 setFormValidity((prev) => {
27992 const newFormValidity = setValidityAtPath(
27993 prev,
27994 {
27995 elements: {
27996 type: "invalid",
27997 message: (0, import_i18n28.__)("Could not validate elements.")
27998 }
27999 },
28000 [...path, formField.id]
28001 );
28002 return newFormValidity;
28003 });
28004 return;
28005 }
28006 if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, {
28007 ...formField.field,
28008 elements: result
28009 })) {
28010 setFormValidity((prev) => {
28011 const newFormValidity = setValidityAtPath(
28012 prev,
28013 {
28014 elements: {
28015 type: "invalid",
28016 message: (0, import_i18n28.__)(
28017 "Value must be one of the elements."
28018 )
28019 }
28020 },
28021 [...path, formField.id]
28022 );
28023 return newFormValidity;
28024 });
28025 } else {
28026 setFormValidity((prev) => {
28027 return removeValidationProperty(
28028 prev,
28029 [...path, formField.id],
28030 "elements"
28031 );
28032 });
28033 }
28034 }).catch((error2) => {
28035 if (currentToken !== elementsCounterRef.current[formField.id]) {
28036 return;
28037 }
28038 let errorMessage;
28039 if (error2 instanceof Error) {
28040 errorMessage = error2.message;
28041 } else {
28042 errorMessage = String(error2) || (0, import_i18n28.__)(
28043 "Unknown error when running elements validation asynchronously."
28044 );
28045 }
28046 setFormValidity((prev) => {
28047 const newFormValidity = setValidityAtPath(
28048 prev,
28049 {
28050 elements: {
28051 type: "invalid",
28052 message: errorMessage
28053 }
28054 },
28055 [...path, formField.id]
28056 );
28057 return newFormValidity;
28058 });
28059 });
28060 }
28061 function handleCustomValidationAsync(promise, formField, promiseHandler) {
28062 const { customCounterRef, setFormValidity, path } = promiseHandler;
28063 const currentToken = (customCounterRef.current[formField.id] || 0) + 1;
28064 customCounterRef.current[formField.id] = currentToken;
28065 promise.then((result) => {
28066 if (currentToken !== customCounterRef.current[formField.id]) {
28067 return;
28068 }
28069 if (result === null) {
28070 setFormValidity((prev) => {
28071 return removeValidationProperty(
28072 prev,
28073 [...path, formField.id],
28074 "custom"
28075 );
28076 });
28077 return;
28078 }
28079 if (typeof result === "string") {
28080 setFormValidity((prev) => {
28081 const newFormValidity = setValidityAtPath(
28082 prev,
28083 {
28084 custom: {
28085 type: "invalid",
28086 message: result
28087 }
28088 },
28089 [...path, formField.id]
28090 );
28091 return newFormValidity;
28092 });
28093 return;
28094 }
28095 setFormValidity((prev) => {
28096 const newFormValidity = setValidityAtPath(
28097 prev,
28098 {
28099 custom: {
28100 type: "invalid",
28101 message: (0, import_i18n28.__)("Validation could not be processed.")
28102 }
28103 },
28104 [...path, formField.id]
28105 );
28106 return newFormValidity;
28107 });
28108 }).catch((error2) => {
28109 if (currentToken !== customCounterRef.current[formField.id]) {
28110 return;
28111 }
28112 let errorMessage;
28113 if (error2 instanceof Error) {
28114 errorMessage = error2.message;
28115 } else {
28116 errorMessage = String(error2) || (0, import_i18n28.__)(
28117 "Unknown error when running custom validation asynchronously."
28118 );
28119 }
28120 setFormValidity((prev) => {
28121 const newFormValidity = setValidityAtPath(
28122 prev,
28123 {
28124 custom: {
28125 type: "invalid",
28126 message: errorMessage
28127 }
28128 },
28129 [...path, formField.id]
28130 );
28131 return newFormValidity;
28132 });
28133 });
28134 }
28135 function isFormFieldHidden(formField, item) {
28136 return formField.children.length === 0 && !!formField.field?.isVisible && !formField.field.isVisible(item);
28137 }
28138 function validateFormField(item, formField, promiseHandler) {
28139 if (isFormFieldHidden(formField, item)) {
28140 const { customCounterRef, elementsCounterRef } = promiseHandler;
28141 if (customCounterRef.current[formField.id]) {
28142 customCounterRef.current[formField.id] += 1;
28143 }
28144 if (elementsCounterRef.current[formField.id]) {
28145 elementsCounterRef.current[formField.id] += 1;
28146 }
28147 return void 0;
28148 }
28149 if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) {
28150 return {
28151 required: { type: "invalid" }
28152 };
28153 }
28154 if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) {
28155 return {
28156 pattern: {
28157 type: "invalid",
28158 message: (0, import_i18n28.__)("Value does not match the required pattern.")
28159 }
28160 };
28161 }
28162 if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) {
28163 return {
28164 min: {
28165 type: "invalid",
28166 message: (0, import_i18n28.__)("Value is below the minimum.")
28167 }
28168 };
28169 }
28170 if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) {
28171 return {
28172 max: {
28173 type: "invalid",
28174 message: (0, import_i18n28.__)("Value is above the maximum.")
28175 }
28176 };
28177 }
28178 if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) {
28179 return {
28180 minLength: {
28181 type: "invalid",
28182 message: (0, import_i18n28.__)("Value is too short.")
28183 }
28184 };
28185 }
28186 if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) {
28187 return {
28188 maxLength: {
28189 type: "invalid",
28190 message: (0, import_i18n28.__)("Value is too long.")
28191 }
28192 };
28193 }
28194 if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) {
28195 return {
28196 elements: {
28197 type: "invalid",
28198 message: (0, import_i18n28.__)("Value must be one of the elements.")
28199 }
28200 };
28201 }
28202 let customError;
28203 if (!!formField.field && formField.field.isValid.custom) {
28204 try {
28205 const value = formField.field.getValue({ item });
28206 customError = formField.field.isValid.custom(
28207 (0, import_deepmerge.default)(
28208 item,
28209 formField.field.setValue({
28210 item,
28211 value
28212 })
28213 ),
28214 formField.field
28215 );
28216 } catch (error2) {
28217 let errorMessage;
28218 if (error2 instanceof Error) {
28219 errorMessage = error2.message;
28220 } else {
28221 errorMessage = String(error2) || (0, import_i18n28.__)("Unknown error when running custom validation.");
28222 }
28223 return {
28224 custom: {
28225 type: "invalid",
28226 message: errorMessage
28227 }
28228 };
28229 }
28230 }
28231 if (typeof customError === "string") {
28232 return {
28233 custom: {
28234 type: "invalid",
28235 message: customError
28236 }
28237 };
28238 }
28239 const fieldValidity = {};
28240 if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") {
28241 handleElementsValidationAsync(
28242 formField.field.getElements(),
28243 formField,
28244 promiseHandler
28245 );
28246 fieldValidity.elements = {
28247 type: "validating",
28248 message: (0, import_i18n28.__)("Validating\u2026")
28249 };
28250 }
28251 if (customError instanceof Promise) {
28252 handleCustomValidationAsync(customError, formField, promiseHandler);
28253 fieldValidity.custom = {
28254 type: "validating",
28255 message: (0, import_i18n28.__)("Validating\u2026")
28256 };
28257 }
28258 if (Object.keys(fieldValidity).length > 0) {
28259 return fieldValidity;
28260 }
28261 if (formField.children.length > 0) {
28262 const result = {};
28263 formField.children.forEach((child) => {
28264 result[child.id] = validateFormField(item, child, {
28265 ...promiseHandler,
28266 path: [...promiseHandler.path, formField.id, "children"]
28267 });
28268 });
28269 const filteredResult = {};
28270 Object.entries(result).forEach(([key, value]) => {
28271 if (value !== void 0) {
28272 filteredResult[key] = value;
28273 }
28274 });
28275 if (Object.keys(filteredResult).length === 0) {
28276 return void 0;
28277 }
28278 return {
28279 children: filteredResult
28280 };
28281 }
28282 return void 0;
28283 }
28284 function getFormFieldValue(formField, item) {
28285 const fieldValue = formField?.field?.getValue({ item });
28286 const isHidden = isFormFieldHidden(formField, item);
28287 if (formField.children.length === 0) {
28288 return { value: fieldValue, isHidden };
28289 }
28290 const childrenValues = formField.children.map(
28291 (child) => getFormFieldValue(child, item)
28292 );
28293 return {
28294 value: fieldValue,
28295 isHidden,
28296 children: childrenValues
28297 };
28298 }
28299 function useFormValidity(item, fields2, form) {
28300 const [formValidity, setFormValidity] = (0, import_element93.useState)();
28301 const customCounterRef = (0, import_element93.useRef)({});
28302 const elementsCounterRef = (0, import_element93.useRef)({});
28303 const previousValuesRef = (0, import_element93.useRef)({});
28304 const validate = (0, import_element93.useCallback)(() => {
28305 const promiseHandler = {
28306 customCounterRef,
28307 elementsCounterRef,
28308 setFormValidity,
28309 path: [],
28310 item
28311 };
28312 const formFieldsToValidate = getFormFieldsToValidate(form, fields2);
28313 if (formFieldsToValidate.length === 0) {
28314 setFormValidity(void 0);
28315 return;
28316 }
28317 const newFormValidity = {};
28318 const untouchedFields = [];
28319 formFieldsToValidate.forEach((formField) => {
28320 const value = getFormFieldValue(formField, item);
28321 if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es6.default)(
28322 previousValuesRef.current[formField.id],
28323 value
28324 )) {
28325 untouchedFields.push(formField.id);
28326 return;
28327 }
28328 previousValuesRef.current[formField.id] = value;
28329 const fieldValidity = validateFormField(
28330 item,
28331 formField,
28332 promiseHandler
28333 );
28334 if (fieldValidity !== void 0) {
28335 newFormValidity[formField.id] = fieldValidity;
28336 }
28337 });
28338 setFormValidity((existingFormValidity) => {
28339 let validity = {
28340 ...existingFormValidity,
28341 ...newFormValidity
28342 };
28343 const fieldsToKeep = [
28344 ...untouchedFields,
28345 ...Object.keys(newFormValidity)
28346 ];
28347 Object.keys(validity).forEach((key) => {
28348 if (validity && !fieldsToKeep.includes(key)) {
28349 delete validity[key];
28350 }
28351 });
28352 if (Object.keys(validity).length === 0) {
28353 validity = void 0;
28354 }
28355 const areEqual = (0, import_es6.default)(existingFormValidity, validity);
28356 if (areEqual) {
28357 return existingFormValidity;
28358 }
28359 return validity;
28360 });
28361 }, [item, fields2, form]);
28362 (0, import_element93.useEffect)(() => {
28363 validate();
28364 }, [validate]);
28365 return {
28366 validity: formValidity,
28367 isValid: isFormValid(formValidity)
28368 };
28369 }
28370 var use_form_validity_default = useFormValidity;
28371
28372 // packages/dataviews/build-module/hooks/use-reveal-validity.mjs
28373 var import_element94 = __toESM(require_element(), 1);
28374 function useRevealValidity(ref, shouldReveal) {
28375 const revealValidity = (0, import_element94.useCallback)(() => {
28376 const inputs = ref.current?.querySelectorAll("input, textarea, select");
28377 let revealedCount = 0;
28378 inputs?.forEach((input) => {
28379 if (input.willValidate && !input.validity.valid) {
28380 revealedCount++;
28381 input.dispatchEvent(
28382 new Event("invalid", { cancelable: true })
28383 );
28384 }
28385 });
28386 return revealedCount;
28387 }, [ref]);
28388 (0, import_element94.useEffect)(() => {
28389 if (shouldReveal) {
28390 revealValidity();
28391 }
28392 }, [shouldReveal, revealValidity]);
28393 return revealValidity;
28394 }
28395
28396 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
28397 var import_element95 = __toESM(require_element(), 1);
28398
28399 // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs
28400 function extractSummaryIds(summary) {
28401 if (Array.isArray(summary)) {
28402 return summary.map(
28403 (item) => typeof item === "string" ? item : item.id
28404 );
28405 }
28406 return [];
28407 }
28408 var getSummaryFields = (summaryField, fields2) => {
28409 if (Array.isArray(summaryField) && summaryField.length > 0) {
28410 const summaryIds = extractSummaryIds(summaryField);
28411 return summaryIds.map(
28412 (summaryId) => fields2.find((_field) => _field.id === summaryId)
28413 ).filter((_field) => _field !== void 0);
28414 }
28415 return [];
28416 };
28417
28418 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
28419 var getFieldDefinition = (field, fields2) => {
28420 if (!!field.children) {
28421 const simpleChildren = field.children.filter(
28422 (child) => !child.children
28423 );
28424 if (simpleChildren.length === 0) {
28425 return void 0;
28426 }
28427 return fields2.find(
28428 (_field) => _field.id === simpleChildren[0].id
28429 );
28430 }
28431 return fields2.find((_field) => _field.id === field.id);
28432 };
28433 function useFieldFromFormField(field) {
28434 const { fields: fields2 } = (0, import_element95.useContext)(dataform_context_default);
28435 const layout = field.layout;
28436 const summaryFields = getSummaryFields(layout.summary, fields2);
28437 const fieldDefinition = getFieldDefinition(field, fields2);
28438 const fieldLabel = !!field.children ? field.label : fieldDefinition?.label;
28439 if (summaryFields.length === 0) {
28440 return {
28441 summaryFields: fieldDefinition ? [fieldDefinition] : [],
28442 fieldDefinition,
28443 fieldLabel
28444 };
28445 }
28446 return {
28447 summaryFields,
28448 fieldDefinition,
28449 fieldLabel
28450 };
28451 }
28452 var use_field_from_form_field_default = useFieldFromFormField;
28453
28454 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
28455 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
28456 function ModalContent({
28457 data,
28458 field,
28459 onChange,
28460 fieldLabel,
28461 onClose,
28462 touched
28463 }) {
28464 const { openAs } = field.layout;
28465 const { applyLabel, cancelLabel } = openAs;
28466 const { fields: fields2 } = (0, import_element96.useContext)(dataform_context_default);
28467 const [changes, setChanges] = (0, import_element96.useState)({});
28468 const modalData = (0, import_element96.useMemo)(() => {
28469 return (0, import_deepmerge2.default)(data, changes, {
28470 arrayMerge: (target, source) => source
28471 });
28472 }, [data, changes]);
28473 const form = (0, import_element96.useMemo)(
28474 () => ({
28475 layout: DEFAULT_LAYOUT,
28476 fields: !!field.children ? field.children : (
28477 // If not explicit children return the field id itself.
28478 [{ id: field.id, layout: DEFAULT_LAYOUT }]
28479 )
28480 }),
28481 [field]
28482 );
28483 const fieldsAsFieldType = fields2.map((f) => ({
28484 ...f,
28485 Edit: f.Edit === null ? void 0 : f.Edit,
28486 isValid: {
28487 required: f.isValid.required?.constraint,
28488 elements: f.isValid.elements?.constraint,
28489 min: f.isValid.min?.constraint,
28490 max: f.isValid.max?.constraint,
28491 pattern: f.isValid.pattern?.constraint,
28492 minLength: f.isValid.minLength?.constraint,
28493 maxLength: f.isValid.maxLength?.constraint
28494 }
28495 }));
28496 const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form);
28497 const onApply = () => {
28498 onChange(changes);
28499 onClose();
28500 };
28501 const handleOnChange = (newValue) => {
28502 setChanges(
28503 (prev) => (0, import_deepmerge2.default)(prev, newValue, {
28504 arrayMerge: (target, source) => source
28505 })
28506 );
28507 };
28508 const focusOnMountRef = (0, import_compose13.useFocusOnMount)("firstInputElement");
28509 const contentRef = (0, import_element96.useRef)(null);
28510 const mergedRef = (0, import_compose13.useMergeRefs)([focusOnMountRef, contentRef]);
28511 useRevealValidity(contentRef, touched);
28512 return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
28513 import_components26.Modal,
28514 {
28515 className: "dataforms-layouts-panel__modal",
28516 onRequestClose: onClose,
28517 isFullScreen: false,
28518 title: fieldLabel,
28519 size: "medium",
28520 children: [
28521 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
28522 DataFormLayout,
28523 {
28524 data: modalData,
28525 form,
28526 onChange: handleOnChange,
28527 validity,
28528 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
28529 FieldLayout,
28530 {
28531 data: modalData,
28532 field: childField,
28533 onChange: handleOnChange,
28534 hideLabelFromVision: form.fields.length < 2,
28535 markWhenOptional,
28536 validity: childFieldValidity
28537 },
28538 childField.id
28539 )
28540 }
28541 ) }),
28542 /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
28543 Stack,
28544 {
28545 direction: "row",
28546 className: "dataforms-layouts-panel__modal-footer",
28547 gap: "md",
28548 children: [
28549 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_components26.__experimentalSpacer, { style: { flex: 1 } }),
28550 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
28551 import_components26.Button,
28552 {
28553 variant: "tertiary",
28554 onClick: onClose,
28555 __next40pxDefaultSize: true,
28556 children: cancelLabel
28557 }
28558 ),
28559 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
28560 import_components26.Button,
28561 {
28562 variant: "primary",
28563 onClick: onApply,
28564 __next40pxDefaultSize: true,
28565 children: applyLabel
28566 }
28567 )
28568 ]
28569 }
28570 )
28571 ]
28572 }
28573 );
28574 }
28575 function PanelModal({
28576 data,
28577 field,
28578 onChange,
28579 validity
28580 }) {
28581 const [touched, setTouched] = (0, import_element96.useState)(false);
28582 const [isOpen, setIsOpen] = (0, import_element96.useState)(false);
28583 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
28584 if (!fieldDefinition) {
28585 return null;
28586 }
28587 const isDisabled = fieldDefinition.readOnly === true || fieldDefinition.isDisabled({ item: data, field: fieldDefinition });
28588 const handleClose = () => {
28589 setIsOpen(false);
28590 setTouched(true);
28591 };
28592 return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
28593 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
28594 SummaryButton,
28595 {
28596 data,
28597 field,
28598 fieldLabel,
28599 summaryFields,
28600 validity,
28601 touched,
28602 disabled: isDisabled,
28603 onClick: () => setIsOpen(true),
28604 isOpen
28605 }
28606 ),
28607 isOpen && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
28608 ModalContent,
28609 {
28610 data,
28611 field,
28612 onChange,
28613 fieldLabel: fieldLabel ?? "",
28614 onClose: handleClose,
28615 touched
28616 }
28617 )
28618 ] });
28619 }
28620 var modal_default = PanelModal;
28621
28622 // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs
28623 var import_components27 = __toESM(require_components(), 1);
28624 var import_i18n29 = __toESM(require_i18n(), 1);
28625 var import_element97 = __toESM(require_element(), 1);
28626 var import_compose14 = __toESM(require_compose(), 1);
28627 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
28628 function DropdownHeader({
28629 title,
28630 onClose
28631 }) {
28632 return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28633 Stack,
28634 {
28635 direction: "column",
28636 className: "dataforms-layouts-panel__dropdown-header",
28637 gap: "lg",
28638 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [
28639 title && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_components27.__experimentalHeading, { level: 2, size: 13, children: title }),
28640 /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_components27.__experimentalSpacer, { style: { flex: 1 } }),
28641 onClose && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28642 import_components27.Button,
28643 {
28644 label: (0, import_i18n29.__)("Close"),
28645 icon: close_small_default,
28646 onClick: onClose,
28647 size: "small"
28648 }
28649 )
28650 ] })
28651 }
28652 );
28653 }
28654 function DropdownContentWithValidation({
28655 touched,
28656 children
28657 }) {
28658 const ref = (0, import_element97.useRef)(null);
28659 useRevealValidity(ref, touched);
28660 return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { ref, children });
28661 }
28662 function PanelDropdown({
28663 data,
28664 field,
28665 onChange,
28666 validity
28667 }) {
28668 const [touched, setTouched] = (0, import_element97.useState)(false);
28669 const [popoverAnchor, setPopoverAnchor] = (0, import_element97.useState)(
28670 null
28671 );
28672 const popoverProps = (0, import_element97.useMemo)(
28673 () => ({
28674 // Anchor the popover to the middle of the entire row so that it doesn't
28675 // move around when the label changes.
28676 anchor: popoverAnchor,
28677 placement: "left-start",
28678 offset: 36,
28679 shift: true
28680 }),
28681 [popoverAnchor]
28682 );
28683 const [dialogRef, dialogProps] = (0, import_compose14.__experimentalUseDialog)({
28684 focusOnMount: "firstInputElement"
28685 });
28686 const form = (0, import_element97.useMemo)(
28687 () => ({
28688 layout: DEFAULT_LAYOUT,
28689 fields: !!field.children ? field.children : (
28690 // If not explicit children return the field id itself.
28691 [{ id: field.id, layout: DEFAULT_LAYOUT }]
28692 )
28693 }),
28694 [field]
28695 );
28696 const formValidity = (0, import_element97.useMemo)(() => {
28697 if (validity === void 0) {
28698 return void 0;
28699 }
28700 if (!!field.children) {
28701 return validity?.children;
28702 }
28703 return { [field.id]: validity };
28704 }, [validity, field]);
28705 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
28706 if (!fieldDefinition) {
28707 return null;
28708 }
28709 const isDisabled = fieldDefinition.readOnly === true || fieldDefinition.isDisabled({ item: data, field: fieldDefinition });
28710 return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28711 "div",
28712 {
28713 ref: setPopoverAnchor,
28714 className: "dataforms-layouts-panel__field-dropdown-anchor",
28715 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28716 import_components27.Dropdown,
28717 {
28718 contentClassName: "dataforms-layouts-panel__field-dropdown",
28719 popoverProps,
28720 focusOnMount: false,
28721 onToggle: (willOpen) => {
28722 if (!willOpen) {
28723 setTouched(true);
28724 }
28725 },
28726 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28727 SummaryButton,
28728 {
28729 data,
28730 field,
28731 fieldLabel,
28732 summaryFields,
28733 validity,
28734 touched,
28735 disabled: isDisabled,
28736 isOpen,
28737 onClick: onToggle
28738 }
28739 ),
28740 renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [
28741 /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28742 DropdownHeader,
28743 {
28744 title: fieldLabel,
28745 onClose
28746 }
28747 ),
28748 /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28749 DataFormLayout,
28750 {
28751 data,
28752 form,
28753 onChange,
28754 validity: formValidity,
28755 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
28756 FieldLayout,
28757 {
28758 data,
28759 field: childField,
28760 onChange,
28761 hideLabelFromVision: (form?.fields ?? []).length < 2,
28762 markWhenOptional,
28763 validity: childFieldValidity
28764 },
28765 childField.id
28766 )
28767 }
28768 )
28769 ] }) })
28770 }
28771 )
28772 }
28773 );
28774 }
28775 var dropdown_default = PanelDropdown;
28776
28777 // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs
28778 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
28779 function FormPanelField({
28780 data,
28781 field,
28782 onChange,
28783 validity
28784 }) {
28785 const layout = field.layout;
28786 if (layout.openAs.type === "modal") {
28787 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
28788 modal_default,
28789 {
28790 data,
28791 field,
28792 onChange,
28793 validity
28794 }
28795 );
28796 }
28797 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
28798 dropdown_default,
28799 {
28800 data,
28801 field,
28802 onChange,
28803 validity
28804 }
28805 );
28806 }
28807
28808 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
28809 var import_element98 = __toESM(require_element(), 1);
28810 var import_compose15 = __toESM(require_compose(), 1);
28811 import { speak as speak4 } from "@wordpress/a11y";
28812
28813 // packages/dataviews/build-module/components/dataform-layouts/get-validation-message.mjs
28814 var import_i18n30 = __toESM(require_i18n(), 1);
28815 function countInvalidFields(validity) {
28816 if (!validity) {
28817 return 0;
28818 }
28819 let count = 0;
28820 const validityRules = Object.keys(validity).filter(
28821 (key) => key !== "children"
28822 );
28823 for (const key of validityRules) {
28824 const rule = validity[key];
28825 if (rule?.type === "invalid") {
28826 count++;
28827 }
28828 }
28829 if (validity.children) {
28830 for (const childValidity of Object.values(validity.children)) {
28831 count += countInvalidFields(childValidity);
28832 }
28833 }
28834 return count;
28835 }
28836 function getValidationMessage(validity) {
28837 const invalidCount = countInvalidFields(validity);
28838 if (invalidCount === 0) {
28839 return void 0;
28840 }
28841 return (0, import_i18n30.sprintf)(
28842 /* translators: %d: Number of fields that need attention */
28843 (0, import_i18n30._n)(
28844 "%d field needs attention",
28845 "%d fields need attention",
28846 invalidCount
28847 ),
28848 invalidCount
28849 );
28850 }
28851
28852 // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs
28853 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
28854 function ValidationBadge({
28855 validity
28856 }) {
28857 const message2 = getValidationMessage(validity);
28858 if (!message2) {
28859 return null;
28860 }
28861 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Badge, { intent: "high", children: message2 });
28862 }
28863
28864 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
28865 var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
28866 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
28867 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
28868 return false;
28869 }
28870 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
28871 const fieldConfig = summaryConfigArray.find((config2) => {
28872 if (typeof config2 === "string") {
28873 return config2 === summaryField.id;
28874 }
28875 if (typeof config2 === "object" && "id" in config2) {
28876 return config2.id === summaryField.id;
28877 }
28878 return false;
28879 });
28880 if (!fieldConfig) {
28881 return false;
28882 }
28883 if (typeof fieldConfig === "string") {
28884 return true;
28885 }
28886 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
28887 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen;
28888 }
28889 return true;
28890 }
28891 function HeaderContent({
28892 data,
28893 fields: fields2,
28894 label,
28895 layout,
28896 isOpen,
28897 touched,
28898 validity
28899 }) {
28900 const summaryFields = getSummaryFields(layout.summary, fields2);
28901 const visibleSummaryFields = summaryFields.filter(
28902 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
28903 );
28904 const hasBadge = touched && layout.isCollapsible;
28905 const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader;
28906 return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
28907 Stack,
28908 {
28909 align: "center",
28910 justify: "space-between",
28911 className: "dataforms-layouts-card__field-header-content",
28912 children: [
28913 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(card_exports.Title, { children: label }),
28914 (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [
28915 hasBadge && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ValidationBadge, { validity }),
28916 hasSummary && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
28917 summaryField.render,
28918 {
28919 item: data,
28920 field: summaryField
28921 },
28922 summaryField.id
28923 )) })
28924 ] })
28925 ]
28926 }
28927 );
28928 }
28929 function BodyContent({
28930 data,
28931 field,
28932 form,
28933 onChange,
28934 hideLabelFromVision,
28935 markWhenOptional,
28936 validity,
28937 withHeader
28938 }) {
28939 if (field.children) {
28940 return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_jsx_runtime125.Fragment, { children: [
28941 field.description && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
28942 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
28943 DataFormLayout,
28944 {
28945 data,
28946 form,
28947 onChange,
28948 validity: validity?.children
28949 }
28950 )
28951 ] });
28952 }
28953 const SingleFieldLayout = getFormFieldLayout("regular")?.component;
28954 if (!SingleFieldLayout) {
28955 return null;
28956 }
28957 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
28958 SingleFieldLayout,
28959 {
28960 data,
28961 field,
28962 onChange,
28963 hideLabelFromVision: hideLabelFromVision || withHeader,
28964 markWhenOptional,
28965 validity
28966 }
28967 );
28968 }
28969 function FormCardField({
28970 data,
28971 field,
28972 onChange,
28973 hideLabelFromVision,
28974 markWhenOptional,
28975 validity
28976 }) {
28977 const { fields: fields2 } = (0, import_element98.useContext)(dataform_context_default);
28978 const layout = field.layout;
28979 const contentRef = (0, import_element98.useRef)(null);
28980 const hasFocusedContentRef = (0, import_element98.useRef)(false);
28981 const form = (0, import_element98.useMemo)(
28982 () => ({
28983 layout: DEFAULT_LAYOUT,
28984 fields: field.children ?? []
28985 }),
28986 [field]
28987 );
28988 const { isOpened, isCollapsible } = layout;
28989 const [isOpen, setIsOpen] = (0, import_element98.useState)(isOpened);
28990 const [touched, setTouched] = (0, import_element98.useState)(false);
28991 (0, import_element98.useEffect)(() => {
28992 setIsOpen(isOpened);
28993 }, [isOpened]);
28994 const handleOpenChange = (0, import_element98.useCallback)((open3) => {
28995 if (!open3) {
28996 setTouched(true);
28997 }
28998 setIsOpen(open3);
28999 }, []);
29000 const revealValidity = useRevealValidity(
29001 contentRef,
29002 (isCollapsible ? isOpen : true) && touched
29003 );
29004 const handleContentFocus = (0, import_element98.useCallback)(() => {
29005 hasFocusedContentRef.current = true;
29006 }, []);
29007 const handleFocusOutside = (0, import_element98.useCallback)(() => {
29008 if (!hasFocusedContentRef.current) {
29009 return;
29010 }
29011 setTouched(true);
29012 if (isCollapsible && !isOpen) {
29013 return;
29014 }
29015 const revealedCount = revealValidity();
29016 const message2 = getValidationMessage(validity);
29017 if (revealedCount > 0 && message2) {
29018 speak4(message2, "polite");
29019 }
29020 }, [isCollapsible, isOpen, revealValidity, validity]);
29021 const focusOutsideProps = (0, import_compose15.__experimentalUseFocusOutside)(handleFocusOutside);
29022 let label = field.label;
29023 let withHeader;
29024 if (field.children) {
29025 withHeader = !!label && layout.withHeader;
29026 } else {
29027 const fieldDefinition = fields2.find(
29028 (fieldDef) => fieldDef.id === field.id
29029 );
29030 if (!canRenderField(fieldDefinition)) {
29031 return null;
29032 }
29033 label = fieldDefinition.label;
29034 withHeader = !!label && layout.withHeader;
29035 }
29036 const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
29037 BodyContent,
29038 {
29039 data,
29040 field,
29041 form,
29042 onChange,
29043 hideLabelFromVision,
29044 markWhenOptional,
29045 validity,
29046 withHeader
29047 }
29048 );
29049 const headerContent = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
29050 HeaderContent,
29051 {
29052 data,
29053 fields: fields2,
29054 label,
29055 layout,
29056 isOpen: isCollapsible ? !!isOpen : true,
29057 touched,
29058 validity
29059 }
29060 );
29061 if (withHeader && isCollapsible) {
29062 return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
29063 collapsible_card_exports.Root,
29064 {
29065 className: "dataforms-layouts-card__field",
29066 open: isOpen,
29067 onOpenChange: handleOpenChange,
29068 ...focusOutsideProps,
29069 children: [
29070 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(collapsible_card_exports.Header, { children: headerContent }),
29071 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
29072 collapsible_card_exports.Content,
29073 {
29074 ref: contentRef,
29075 onFocus: handleContentFocus,
29076 children: bodyContent
29077 }
29078 )
29079 ]
29080 }
29081 );
29082 }
29083 return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
29084 card_exports.Root,
29085 {
29086 className: "dataforms-layouts-card__field",
29087 ...focusOutsideProps,
29088 children: [
29089 withHeader && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(card_exports.Header, { children: headerContent }),
29090 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(card_exports.Content, { ref: contentRef, onFocus: handleContentFocus, children: bodyContent })
29091 ]
29092 }
29093 );
29094 }
29095
29096 // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs
29097 var import_components28 = __toESM(require_components(), 1);
29098 var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1);
29099 function Header5({ title }) {
29100 return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
29101 Stack,
29102 {
29103 direction: "column",
29104 className: "dataforms-layouts-row__header",
29105 gap: "lg",
29106 children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_components28.__experimentalHeading, { level: 2, size: 13, children: title }) })
29107 }
29108 );
29109 }
29110 var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_jsx_runtime126.Fragment, { children });
29111 function FormRowField({
29112 data,
29113 field,
29114 onChange,
29115 hideLabelFromVision,
29116 markWhenOptional,
29117 validity
29118 }) {
29119 const layout = field.layout;
29120 if (!!field.children) {
29121 const form = {
29122 layout: DEFAULT_LAYOUT,
29123 fields: field.children
29124 };
29125 return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
29126 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Header5, { title: field.label }),
29127 /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
29128 DataFormLayout,
29129 {
29130 data,
29131 form,
29132 onChange,
29133 validity: validity?.children,
29134 as: EMPTY_WRAPPER,
29135 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
29136 "div",
29137 {
29138 className: "dataforms-layouts-row__field-control",
29139 style: layout.styles[childField.id],
29140 children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
29141 FieldLayout,
29142 {
29143 data,
29144 field: childField,
29145 onChange,
29146 hideLabelFromVision,
29147 markWhenOptional,
29148 validity: childFieldValidity
29149 }
29150 )
29151 },
29152 childField.id
29153 )
29154 }
29155 ) })
29156 ] });
29157 }
29158 const RegularLayout = getFormFieldLayout("regular")?.component;
29159 if (!RegularLayout) {
29160 return null;
29161 }
29162 return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(import_jsx_runtime126.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
29163 RegularLayout,
29164 {
29165 data,
29166 field,
29167 onChange,
29168 markWhenOptional,
29169 validity
29170 }
29171 ) }) });
29172 }
29173
29174 // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs
29175 var import_element99 = __toESM(require_element(), 1);
29176 var import_i18n31 = __toESM(require_i18n(), 1);
29177 var import_compose16 = __toESM(require_compose(), 1);
29178 import { speak as speak5 } from "@wordpress/a11y";
29179 var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1);
29180 function FormDetailsField({
29181 data,
29182 field,
29183 onChange,
29184 validity
29185 }) {
29186 const { fields: fields2 } = (0, import_element99.useContext)(dataform_context_default);
29187 const detailsRef = (0, import_element99.useRef)(null);
29188 const contentRef = (0, import_element99.useRef)(null);
29189 const hasFocusedContentRef = (0, import_element99.useRef)(false);
29190 const [touched, setTouched] = (0, import_element99.useState)(false);
29191 const [isOpen, setIsOpen] = (0, import_element99.useState)(false);
29192 const form = (0, import_element99.useMemo)(
29193 () => ({
29194 layout: DEFAULT_LAYOUT,
29195 fields: field.children ?? []
29196 }),
29197 [field]
29198 );
29199 (0, import_element99.useEffect)(() => {
29200 const details = detailsRef.current;
29201 if (!details) {
29202 return;
29203 }
29204 const handleToggle = () => {
29205 const nowOpen = details.open;
29206 if (!nowOpen) {
29207 setTouched(true);
29208 }
29209 setIsOpen(nowOpen);
29210 };
29211 details.addEventListener("toggle", handleToggle);
29212 return () => {
29213 details.removeEventListener("toggle", handleToggle);
29214 };
29215 }, []);
29216 const revealValidity = useRevealValidity(contentRef, isOpen && touched);
29217 const handleContentFocus = (0, import_element99.useCallback)(() => {
29218 hasFocusedContentRef.current = true;
29219 }, []);
29220 const handleFocusOutside = (0, import_element99.useCallback)(() => {
29221 if (!hasFocusedContentRef.current) {
29222 return;
29223 }
29224 setTouched(true);
29225 if (!detailsRef.current?.open) {
29226 return;
29227 }
29228 const revealedCount = revealValidity();
29229 const message2 = getValidationMessage(validity);
29230 if (revealedCount > 0 && message2) {
29231 speak5(message2, "polite");
29232 }
29233 }, [revealValidity, validity]);
29234 const focusOutsideProps = (0, import_compose16.__experimentalUseFocusOutside)(handleFocusOutside);
29235 if (!field.children) {
29236 return null;
29237 }
29238 const summaryFieldId = field.layout.summary ?? "";
29239 const summaryField = summaryFieldId ? fields2.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0;
29240 let summaryContent;
29241 if (summaryField && summaryField.render) {
29242 summaryContent = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(summaryField.render, { item: data, field: summaryField });
29243 } else {
29244 summaryContent = field.label || (0, import_i18n31.__)("More details");
29245 }
29246 return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
29247 "details",
29248 {
29249 ref: detailsRef,
29250 className: "dataforms-layouts-details__details",
29251 ...focusOutsideProps,
29252 children: [
29253 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
29254 Stack,
29255 {
29256 direction: "row",
29257 align: "center",
29258 gap: "md",
29259 className: "dataforms-layouts-details__summary-content",
29260 children: [
29261 summaryContent,
29262 touched && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ValidationBadge, { validity })
29263 ]
29264 }
29265 ) }),
29266 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
29267 "div",
29268 {
29269 ref: contentRef,
29270 className: "dataforms-layouts-details__content",
29271 onFocus: handleContentFocus,
29272 children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
29273 DataFormLayout,
29274 {
29275 data,
29276 form,
29277 onChange,
29278 validity: validity?.children
29279 }
29280 )
29281 }
29282 )
29283 ]
29284 }
29285 );
29286 }
29287
29288 // packages/dataviews/build-module/components/dataform-layouts/index.mjs
29289 var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1);
29290 var FORM_FIELD_LAYOUTS = [
29291 {
29292 type: "regular",
29293 component: FormRegularField,
29294 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
29295 Stack,
29296 {
29297 direction: "column",
29298 className: "dataforms-layouts__wrapper",
29299 gap: "lg",
29300 children
29301 }
29302 )
29303 },
29304 {
29305 type: "panel",
29306 component: FormPanelField,
29307 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
29308 Stack,
29309 {
29310 direction: "column",
29311 className: "dataforms-layouts__wrapper",
29312 gap: "md",
29313 children
29314 }
29315 )
29316 },
29317 {
29318 type: "card",
29319 component: FormCardField,
29320 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
29321 Stack,
29322 {
29323 direction: "column",
29324 className: "dataforms-layouts__wrapper",
29325 gap: "xl",
29326 children
29327 }
29328 )
29329 },
29330 {
29331 type: "row",
29332 component: FormRowField,
29333 wrapper: ({
29334 children,
29335 layout
29336 }) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
29337 Stack,
29338 {
29339 direction: "column",
29340 className: "dataforms-layouts__wrapper",
29341 gap: "lg",
29342 children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
29343 Stack,
29344 {
29345 direction: "row",
29346 gap: "lg",
29347 align: layout.alignment,
29348 children
29349 }
29350 ) })
29351 }
29352 )
29353 },
29354 {
29355 type: "details",
29356 component: FormDetailsField
29357 }
29358 ];
29359 function getFormFieldLayout(type) {
29360 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
29361 }
29362
29363 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
29364 var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1);
29365 var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children });
29366 function DataFormLayout({
29367 data,
29368 form,
29369 onChange,
29370 validity,
29371 children,
29372 as
29373 }) {
29374 const { fields: fieldDefinitions } = (0, import_element100.useContext)(dataform_context_default);
29375 const markWhenOptional = (0, import_element100.useMemo)(() => {
29376 const requiredCount = fieldDefinitions.filter(
29377 (f) => !!f.isValid?.required
29378 ).length;
29379 const optionalCount = fieldDefinitions.length - requiredCount;
29380 return requiredCount > optionalCount;
29381 }, [fieldDefinitions]);
29382 function getFieldDefinition2(field) {
29383 return fieldDefinitions.find(
29384 (fieldDefinition) => fieldDefinition.id === field.id
29385 );
29386 }
29387 const Wrapper = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER;
29388 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Wrapper, { layout: form.layout, children: form.fields.map((formField) => {
29389 const FieldLayout = getFormFieldLayout(
29390 formField.layout.type
29391 )?.component;
29392 if (!FieldLayout) {
29393 return null;
29394 }
29395 const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0;
29396 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
29397 return null;
29398 }
29399 if (children) {
29400 return children(
29401 FieldLayout,
29402 formField,
29403 validity?.[formField.id],
29404 markWhenOptional
29405 );
29406 }
29407 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
29408 FieldLayout,
29409 {
29410 data,
29411 field: formField,
29412 onChange,
29413 markWhenOptional,
29414 validity: validity?.[formField.id]
29415 },
29416 formField.id
29417 );
29418 }) });
29419 }
29420
29421 // packages/dataviews/build-module/dataform/index.mjs
29422 var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1);
29423 function DataForm({
29424 data,
29425 form,
29426 fields: fields2,
29427 onChange,
29428 validity
29429 }) {
29430 const normalizedForm = (0, import_element101.useMemo)(() => normalize_form_default(form), [form]);
29431 const normalizedFields = (0, import_element101.useMemo)(
29432 () => normalizeFields(fields2),
29433 [fields2]
29434 );
29435 if (!form.fields) {
29436 return null;
29437 }
29438 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
29439 DataFormLayout,
29440 {
29441 data,
29442 form: normalizedForm,
29443 onChange,
29444 validity
29445 }
29446 ) });
29447 }
29448
29449 // packages/views/build-module/use-view.mjs
29450 var import_element102 = __toESM(require_element(), 1);
29451 var import_data = __toESM(require_data(), 1);
29452 var import_preferences = __toESM(require_preferences(), 1);
29453
29454 // packages/views/build-module/load-view.mjs
29455 var import_data2 = __toESM(require_data(), 1);
29456 var import_preferences2 = __toESM(require_preferences(), 1);
29457
29458 // packages/views/build-module/use-view-config.mjs
29459 var import_data3 = __toESM(require_data(), 1);
29460 var import_core_data = __toESM(require_core_data(), 1);
29461
29462 // packages/views/build-module/lock-unlock.mjs
29463 var import_private_apis2 = __toESM(require_private_apis(), 1);
29464 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
29465 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
29466 "@wordpress/views"
29467 );
29468
29469 // packages/views/build-module/use-view-config.mjs
29470 function useViewConfig({
29471 kind,
29472 name,
29473 fields: fields2
29474 }) {
29475 const fieldList = Array.isArray(fields2) ? fields2 : fields2?.split(",");
29476 const fieldsKey = fieldList ? [...fieldList].sort().join(",") : void 0;
29477 return (0, import_data3.useSelect)(
29478 (select2) => {
29479 return unlock2(select2(import_core_data.store)).getViewConfig(
29480 kind,
29481 name,
29482 fieldsKey ? {
29483 fields: fieldsKey
29484 } : void 0
29485 );
29486 },
29487 [kind, name, fieldsKey]
29488 );
29489 }
29490
29491 // packages/fields/build-module/lock-unlock.mjs
29492 var import_private_apis3 = __toESM(require_private_apis(), 1);
29493 var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
29494 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
29495 "@wordpress/fields"
29496 );
29497
29498 // packages/fields/build-module/components/media-edit/index.mjs
29499 var import_components29 = __toESM(require_components(), 1);
29500 var import_blob = __toESM(require_blob(), 1);
29501 var import_core_data2 = __toESM(require_core_data(), 1);
29502 var import_data4 = __toESM(require_data(), 1);
29503 var import_element104 = __toESM(require_element(), 1);
29504 var import_i18n32 = __toESM(require_i18n(), 1);
29505 var import_html_entities = __toESM(require_html_entities(), 1);
29506 var import_media_utils = __toESM(require_media_utils(), 1);
29507 var import_notices = __toESM(require_notices(), 1);
29508 import { speak as speak6 } from "@wordpress/a11y";
29509
29510 // node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js
29511 var updateQueue = makeQueue();
29512 var raf = (fn) => schedule(fn, updateQueue);
29513 var writeQueue = makeQueue();
29514 raf.write = (fn) => schedule(fn, writeQueue);
29515 var onStartQueue = makeQueue();
29516 raf.onStart = (fn) => schedule(fn, onStartQueue);
29517 var onFrameQueue = makeQueue();
29518 raf.onFrame = (fn) => schedule(fn, onFrameQueue);
29519 var onFinishQueue = makeQueue();
29520 raf.onFinish = (fn) => schedule(fn, onFinishQueue);
29521 var timeouts = [];
29522 raf.setTimeout = (handler, ms) => {
29523 let time = raf.now() + ms;
29524 let cancel = () => {
29525 let i = timeouts.findIndex((t) => t.cancel == cancel);
29526 if (~i) timeouts.splice(i, 1);
29527 pendingCount -= ~i ? 1 : 0;
29528 };
29529 let timeout = {
29530 time,
29531 handler,
29532 cancel
29533 };
29534 timeouts.splice(findTimeout(time), 0, timeout);
29535 pendingCount += 1;
29536 start();
29537 return timeout;
29538 };
29539 var findTimeout = (time) => ~(~timeouts.findIndex((t) => t.time > time) || ~timeouts.length);
29540 raf.cancel = (fn) => {
29541 onStartQueue.delete(fn);
29542 onFrameQueue.delete(fn);
29543 onFinishQueue.delete(fn);
29544 updateQueue.delete(fn);
29545 writeQueue.delete(fn);
29546 };
29547 raf.sync = (fn) => {
29548 sync = true;
29549 raf.batchedUpdates(fn);
29550 sync = false;
29551 };
29552 raf.throttle = (fn) => {
29553 let lastArgs;
29554 function queuedFn() {
29555 try {
29556 fn(...lastArgs);
29557 } finally {
29558 lastArgs = null;
29559 }
29560 }
29561 function throttled(...args) {
29562 lastArgs = args;
29563 raf.onStart(queuedFn);
29564 }
29565 throttled.handler = fn;
29566 throttled.cancel = () => {
29567 onStartQueue.delete(queuedFn);
29568 lastArgs = null;
29569 };
29570 return throttled;
29571 };
29572 var nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => {
29573 };
29574 raf.use = (impl) => nativeRaf = impl;
29575 raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now;
29576 raf.batchedUpdates = (fn) => fn();
29577 raf.catch = console.error;
29578 raf.frameLoop = "always";
29579 raf.advance = () => {
29580 if (raf.frameLoop !== "demand") {
29581 console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand");
29582 } else {
29583 update2();
29584 }
29585 };
29586 var ts = -1;
29587 var pendingCount = 0;
29588 var sync = false;
29589 function schedule(fn, queue) {
29590 if (sync) {
29591 queue.delete(fn);
29592 fn(0);
29593 } else {
29594 queue.add(fn);
29595 start();
29596 }
29597 }
29598 function start() {
29599 if (ts < 0) {
29600 ts = 0;
29601 if (raf.frameLoop !== "demand") {
29602 nativeRaf(loop);
29603 }
29604 }
29605 }
29606 function stop() {
29607 ts = -1;
29608 }
29609 function loop() {
29610 if (~ts) {
29611 nativeRaf(loop);
29612 raf.batchedUpdates(update2);
29613 }
29614 }
29615 function update2() {
29616 let prevTs = ts;
29617 ts = raf.now();
29618 let count = findTimeout(ts);
29619 if (count) {
29620 eachSafely(timeouts.splice(0, count), (t) => t.handler());
29621 pendingCount -= count;
29622 }
29623 if (!pendingCount) {
29624 stop();
29625 return;
29626 }
29627 onStartQueue.flush();
29628 updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
29629 onFrameQueue.flush();
29630 writeQueue.flush();
29631 onFinishQueue.flush();
29632 }
29633 function makeQueue() {
29634 let next = /* @__PURE__ */ new Set();
29635 let current = next;
29636 return {
29637 add(fn) {
29638 pendingCount += current == next && !next.has(fn) ? 1 : 0;
29639 next.add(fn);
29640 },
29641 delete(fn) {
29642 pendingCount -= current == next && next.has(fn) ? 1 : 0;
29643 return next.delete(fn);
29644 },
29645 flush(arg) {
29646 if (current.size) {
29647 next = /* @__PURE__ */ new Set();
29648 pendingCount -= current.size;
29649 eachSafely(current, (fn) => fn(arg) && next.add(fn));
29650 pendingCount += next.size;
29651 current = next;
29652 }
29653 }
29654 };
29655 }
29656 function eachSafely(values, each2) {
29657 values.forEach((value) => {
29658 try {
29659 each2(value);
29660 } catch (e) {
29661 raf.catch(e);
29662 }
29663 });
29664 }
29665
29666 // node_modules/@react-spring/shared/dist/react-spring-shared.esm.js
29667 var import_react50 = __toESM(require_react());
29668 function noop4() {
29669 }
29670 var defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
29671 value,
29672 writable: true,
29673 configurable: true
29674 });
29675 var is = {
29676 arr: Array.isArray,
29677 obj: (a) => !!a && a.constructor.name === "Object",
29678 fun: (a) => typeof a === "function",
29679 str: (a) => typeof a === "string",
29680 num: (a) => typeof a === "number",
29681 und: (a) => a === void 0
29682 };
29683 function isEqual(a, b) {
29684 if (is.arr(a)) {
29685 if (!is.arr(b) || a.length !== b.length) return false;
29686 for (let i = 0; i < a.length; i++) {
29687 if (a[i] !== b[i]) return false;
29688 }
29689 return true;
29690 }
29691 return a === b;
29692 }
29693 var each = (obj, fn) => obj.forEach(fn);
29694 function eachProp(obj, fn, ctx2) {
29695 if (is.arr(obj)) {
29696 for (let i = 0; i < obj.length; i++) {
29697 fn.call(ctx2, obj[i], `${i}`);
29698 }
29699 return;
29700 }
29701 for (const key in obj) {
29702 if (obj.hasOwnProperty(key)) {
29703 fn.call(ctx2, obj[key], key);
29704 }
29705 }
29706 }
29707 var toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
29708 function flush(queue, iterator) {
29709 if (queue.size) {
29710 const items = Array.from(queue);
29711 queue.clear();
29712 each(items, iterator);
29713 }
29714 }
29715 var flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args));
29716 var isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent);
29717 var createStringInterpolator$1;
29718 var to;
29719 var colors$1 = null;
29720 var skipAnimation = false;
29721 var willAdvance = noop4;
29722 var assign = (globals2) => {
29723 if (globals2.to) to = globals2.to;
29724 if (globals2.now) raf.now = globals2.now;
29725 if (globals2.colors !== void 0) colors$1 = globals2.colors;
29726 if (globals2.skipAnimation != null) skipAnimation = globals2.skipAnimation;
29727 if (globals2.createStringInterpolator) createStringInterpolator$1 = globals2.createStringInterpolator;
29728 if (globals2.requestAnimationFrame) raf.use(globals2.requestAnimationFrame);
29729 if (globals2.batchedUpdates) raf.batchedUpdates = globals2.batchedUpdates;
29730 if (globals2.willAdvance) willAdvance = globals2.willAdvance;
29731 if (globals2.frameLoop) raf.frameLoop = globals2.frameLoop;
29732 };
29733 var globals = /* @__PURE__ */ Object.freeze({
29734 __proto__: null,
29735 get createStringInterpolator() {
29736 return createStringInterpolator$1;
29737 },
29738 get to() {
29739 return to;
29740 },
29741 get colors() {
29742 return colors$1;
29743 },
29744 get skipAnimation() {
29745 return skipAnimation;
29746 },
29747 get willAdvance() {
29748 return willAdvance;
29749 },
29750 assign
29751 });
29752 var startQueue = /* @__PURE__ */ new Set();
29753 var currentFrame = [];
29754 var prevFrame = [];
29755 var priority = 0;
29756 var frameLoop = {
29757 get idle() {
29758 return !startQueue.size && !currentFrame.length;
29759 },
29760 start(animation) {
29761 if (priority > animation.priority) {
29762 startQueue.add(animation);
29763 raf.onStart(flushStartQueue);
29764 } else {
29765 startSafely(animation);
29766 raf(advance);
29767 }
29768 },
29769 advance,
29770 sort(animation) {
29771 if (priority) {
29772 raf.onFrame(() => frameLoop.sort(animation));
29773 } else {
29774 const prevIndex = currentFrame.indexOf(animation);
29775 if (~prevIndex) {
29776 currentFrame.splice(prevIndex, 1);
29777 startUnsafely(animation);
29778 }
29779 }
29780 },
29781 clear() {
29782 currentFrame = [];
29783 startQueue.clear();
29784 }
29785 };
29786 function flushStartQueue() {
29787 startQueue.forEach(startSafely);
29788 startQueue.clear();
29789 raf(advance);
29790 }
29791 function startSafely(animation) {
29792 if (!currentFrame.includes(animation)) startUnsafely(animation);
29793 }
29794 function startUnsafely(animation) {
29795 currentFrame.splice(findIndex2(currentFrame, (other) => other.priority > animation.priority), 0, animation);
29796 }
29797 function advance(dt) {
29798 const nextFrame = prevFrame;
29799 for (let i = 0; i < currentFrame.length; i++) {
29800 const animation = currentFrame[i];
29801 priority = animation.priority;
29802 if (!animation.idle) {
29803 willAdvance(animation);
29804 animation.advance(dt);
29805 if (!animation.idle) {
29806 nextFrame.push(animation);
29807 }
29808 }
29809 }
29810 priority = 0;
29811 prevFrame = currentFrame;
29812 prevFrame.length = 0;
29813 currentFrame = nextFrame;
29814 return currentFrame.length > 0;
29815 }
29816 function findIndex2(arr, test) {
29817 const index2 = arr.findIndex(test);
29818 return index2 < 0 ? arr.length : index2;
29819 }
29820 var colors = {
29821 transparent: 0,
29822 aliceblue: 4042850303,
29823 antiquewhite: 4209760255,
29824 aqua: 16777215,
29825 aquamarine: 2147472639,
29826 azure: 4043309055,
29827 beige: 4126530815,
29828 bisque: 4293182719,
29829 black: 255,
29830 blanchedalmond: 4293643775,
29831 blue: 65535,
29832 blueviolet: 2318131967,
29833 brown: 2771004159,
29834 burlywood: 3736635391,
29835 burntsienna: 3934150143,
29836 cadetblue: 1604231423,
29837 chartreuse: 2147418367,
29838 chocolate: 3530104575,
29839 coral: 4286533887,
29840 cornflowerblue: 1687547391,
29841 cornsilk: 4294499583,
29842 crimson: 3692313855,
29843 cyan: 16777215,
29844 darkblue: 35839,
29845 darkcyan: 9145343,
29846 darkgoldenrod: 3095792639,
29847 darkgray: 2846468607,
29848 darkgreen: 6553855,
29849 darkgrey: 2846468607,
29850 darkkhaki: 3182914559,
29851 darkmagenta: 2332068863,
29852 darkolivegreen: 1433087999,
29853 darkorange: 4287365375,
29854 darkorchid: 2570243327,
29855 darkred: 2332033279,
29856 darksalmon: 3918953215,
29857 darkseagreen: 2411499519,
29858 darkslateblue: 1211993087,
29859 darkslategray: 793726975,
29860 darkslategrey: 793726975,
29861 darkturquoise: 13554175,
29862 darkviolet: 2483082239,
29863 deeppink: 4279538687,
29864 deepskyblue: 12582911,
29865 dimgray: 1768516095,
29866 dimgrey: 1768516095,
29867 dodgerblue: 512819199,
29868 firebrick: 2988581631,
29869 floralwhite: 4294635775,
29870 forestgreen: 579543807,
29871 fuchsia: 4278255615,
29872 gainsboro: 3705462015,
29873 ghostwhite: 4177068031,
29874 gold: 4292280575,
29875 goldenrod: 3668254975,
29876 gray: 2155905279,
29877 green: 8388863,
29878 greenyellow: 2919182335,
29879 grey: 2155905279,
29880 honeydew: 4043305215,
29881 hotpink: 4285117695,
29882 indianred: 3445382399,
29883 indigo: 1258324735,
29884 ivory: 4294963455,
29885 khaki: 4041641215,
29886 lavender: 3873897215,
29887 lavenderblush: 4293981695,
29888 lawngreen: 2096890111,
29889 lemonchiffon: 4294626815,
29890 lightblue: 2916673279,
29891 lightcoral: 4034953471,
29892 lightcyan: 3774873599,
29893 lightgoldenrodyellow: 4210742015,
29894 lightgray: 3553874943,
29895 lightgreen: 2431553791,
29896 lightgrey: 3553874943,
29897 lightpink: 4290167295,
29898 lightsalmon: 4288707327,
29899 lightseagreen: 548580095,
29900 lightskyblue: 2278488831,
29901 lightslategray: 2005441023,
29902 lightslategrey: 2005441023,
29903 lightsteelblue: 2965692159,
29904 lightyellow: 4294959359,
29905 lime: 16711935,
29906 limegreen: 852308735,
29907 linen: 4210091775,
29908 magenta: 4278255615,
29909 maroon: 2147483903,
29910 mediumaquamarine: 1724754687,
29911 mediumblue: 52735,
29912 mediumorchid: 3126187007,
29913 mediumpurple: 2473647103,
29914 mediumseagreen: 1018393087,
29915 mediumslateblue: 2070474495,
29916 mediumspringgreen: 16423679,
29917 mediumturquoise: 1221709055,
29918 mediumvioletred: 3340076543,
29919 midnightblue: 421097727,
29920 mintcream: 4127193855,
29921 mistyrose: 4293190143,
29922 moccasin: 4293178879,
29923 navajowhite: 4292783615,
29924 navy: 33023,
29925 oldlace: 4260751103,
29926 olive: 2155872511,
29927 olivedrab: 1804477439,
29928 orange: 4289003775,
29929 orangered: 4282712319,
29930 orchid: 3664828159,
29931 palegoldenrod: 4008225535,
29932 palegreen: 2566625535,
29933 paleturquoise: 2951671551,
29934 palevioletred: 3681588223,
29935 papayawhip: 4293907967,
29936 peachpuff: 4292524543,
29937 peru: 3448061951,
29938 pink: 4290825215,
29939 plum: 3718307327,
29940 powderblue: 2967529215,
29941 purple: 2147516671,
29942 rebeccapurple: 1714657791,
29943 red: 4278190335,
29944 rosybrown: 3163525119,
29945 royalblue: 1097458175,
29946 saddlebrown: 2336560127,
29947 salmon: 4202722047,
29948 sandybrown: 4104413439,
29949 seagreen: 780883967,
29950 seashell: 4294307583,
29951 sienna: 2689740287,
29952 silver: 3233857791,
29953 skyblue: 2278484991,
29954 slateblue: 1784335871,
29955 slategray: 1887473919,
29956 slategrey: 1887473919,
29957 snow: 4294638335,
29958 springgreen: 16744447,
29959 steelblue: 1182971135,
29960 tan: 3535047935,
29961 teal: 8421631,
29962 thistle: 3636451583,
29963 tomato: 4284696575,
29964 turquoise: 1088475391,
29965 violet: 4001558271,
29966 wheat: 4125012991,
29967 white: 4294967295,
29968 whitesmoke: 4126537215,
29969 yellow: 4294902015,
29970 yellowgreen: 2597139199
29971 };
29972 var NUMBER = "[-+]?\\d*\\.?\\d+";
29973 var PERCENTAGE = NUMBER + "%";
29974 function call(...parts) {
29975 return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)";
29976 }
29977 var rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
29978 var rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
29979 var hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
29980 var hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
29981 var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
29982 var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
29983 var hex6 = /^#([0-9a-fA-F]{6})$/;
29984 var hex8 = /^#([0-9a-fA-F]{8})$/;
29985 function normalizeColor(color) {
29986 let match2;
29987 if (typeof color === "number") {
29988 return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
29989 }
29990 if (match2 = hex6.exec(color)) return parseInt(match2[1] + "ff", 16) >>> 0;
29991 if (colors$1 && colors$1[color] !== void 0) {
29992 return colors$1[color];
29993 }
29994 if (match2 = rgb.exec(color)) {
29995 return (parse255(match2[1]) << 24 | parse255(match2[2]) << 16 | parse255(match2[3]) << 8 | 255) >>> 0;
29996 }
29997 if (match2 = rgba.exec(color)) {
29998 return (parse255(match2[1]) << 24 | parse255(match2[2]) << 16 | parse255(match2[3]) << 8 | parse1(match2[4])) >>> 0;
29999 }
30000 if (match2 = hex3.exec(color)) {
30001 return parseInt(match2[1] + match2[1] + match2[2] + match2[2] + match2[3] + match2[3] + "ff", 16) >>> 0;
30002 }
30003 if (match2 = hex8.exec(color)) return parseInt(match2[1], 16) >>> 0;
30004 if (match2 = hex4.exec(color)) {
30005 return parseInt(match2[1] + match2[1] + match2[2] + match2[2] + match2[3] + match2[3] + match2[4] + match2[4], 16) >>> 0;
30006 }
30007 if (match2 = hsl.exec(color)) {
30008 return (hslToRgb(parse360(match2[1]), parsePercentage(match2[2]), parsePercentage(match2[3])) | 255) >>> 0;
30009 }
30010 if (match2 = hsla.exec(color)) {
30011 return (hslToRgb(parse360(match2[1]), parsePercentage(match2[2]), parsePercentage(match2[3])) | parse1(match2[4])) >>> 0;
30012 }
30013 return null;
30014 }
30015 function hue2rgb(p2, q2, t) {
30016 if (t < 0) t += 1;
30017 if (t > 1) t -= 1;
30018 if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
30019 if (t < 1 / 2) return q2;
30020 if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
30021 return p2;
30022 }
30023 function hslToRgb(h, s, l2) {
30024 const q2 = l2 < 0.5 ? l2 * (1 + s) : l2 + s - l2 * s;
30025 const p2 = 2 * l2 - q2;
30026 const r2 = hue2rgb(p2, q2, h + 1 / 3);
30027 const g2 = hue2rgb(p2, q2, h);
30028 const b = hue2rgb(p2, q2, h - 1 / 3);
30029 return Math.round(r2 * 255) << 24 | Math.round(g2 * 255) << 16 | Math.round(b * 255) << 8;
30030 }
30031 function parse255(str) {
30032 const int = parseInt(str, 10);
30033 if (int < 0) return 0;
30034 if (int > 255) return 255;
30035 return int;
30036 }
30037 function parse360(str) {
30038 const int = parseFloat(str);
30039 return (int % 360 + 360) % 360 / 360;
30040 }
30041 function parse1(str) {
30042 const num = parseFloat(str);
30043 if (num < 0) return 0;
30044 if (num > 1) return 255;
30045 return Math.round(num * 255);
30046 }
30047 function parsePercentage(str) {
30048 const int = parseFloat(str);
30049 if (int < 0) return 0;
30050 if (int > 100) return 1;
30051 return int / 100;
30052 }
30053 function colorToRgba(input) {
30054 let int32Color = normalizeColor(input);
30055 if (int32Color === null) return input;
30056 int32Color = int32Color || 0;
30057 let r2 = (int32Color & 4278190080) >>> 24;
30058 let g2 = (int32Color & 16711680) >>> 16;
30059 let b = (int32Color & 65280) >>> 8;
30060 let a = (int32Color & 255) / 255;
30061 return `rgba(${r2}, ${g2}, ${b}, ${a})`;
30062 }
30063 var createInterpolator = (range, output, extrapolate) => {
30064 if (is.fun(range)) {
30065 return range;
30066 }
30067 if (is.arr(range)) {
30068 return createInterpolator({
30069 range,
30070 output,
30071 extrapolate
30072 });
30073 }
30074 if (is.str(range.output[0])) {
30075 return createStringInterpolator$1(range);
30076 }
30077 const config2 = range;
30078 const outputRange = config2.output;
30079 const inputRange = config2.range || [0, 1];
30080 const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend";
30081 const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend";
30082 const easing = config2.easing || ((t) => t);
30083 return (input) => {
30084 const range2 = findRange(input, inputRange);
30085 return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config2.map);
30086 };
30087 };
30088 function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
30089 let result = map ? map(input) : input;
30090 if (result < inputMin) {
30091 if (extrapolateLeft === "identity") return result;
30092 else if (extrapolateLeft === "clamp") result = inputMin;
30093 }
30094 if (result > inputMax) {
30095 if (extrapolateRight === "identity") return result;
30096 else if (extrapolateRight === "clamp") result = inputMax;
30097 }
30098 if (outputMin === outputMax) return outputMin;
30099 if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax;
30100 if (inputMin === -Infinity) result = -result;
30101 else if (inputMax === Infinity) result = result - inputMin;
30102 else result = (result - inputMin) / (inputMax - inputMin);
30103 result = easing(result);
30104 if (outputMin === -Infinity) result = -result;
30105 else if (outputMax === Infinity) result = result + outputMin;
30106 else result = result * (outputMax - outputMin) + outputMin;
30107 return result;
30108 }
30109 function findRange(input, inputRange) {
30110 for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break;
30111 return i - 1;
30112 }
30113 function _extends() {
30114 _extends = Object.assign ? Object.assign.bind() : function(target) {
30115 for (var i = 1; i < arguments.length; i++) {
30116 var source = arguments[i];
30117 for (var key in source) {
30118 if (Object.prototype.hasOwnProperty.call(source, key)) {
30119 target[key] = source[key];
30120 }
30121 }
30122 }
30123 return target;
30124 };
30125 return _extends.apply(this, arguments);
30126 }
30127 var $get = /* @__PURE__ */ Symbol.for("FluidValue.get");
30128 var $observers = /* @__PURE__ */ Symbol.for("FluidValue.observers");
30129 var hasFluidValue = (arg) => Boolean(arg && arg[$get]);
30130 var getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg;
30131 var getFluidObservers = (target) => target[$observers] || null;
30132 function callFluidObserver(observer, event) {
30133 if (observer.eventObserved) {
30134 observer.eventObserved(event);
30135 } else {
30136 observer(event);
30137 }
30138 }
30139 function callFluidObservers(target, event) {
30140 let observers = target[$observers];
30141 if (observers) {
30142 observers.forEach((observer) => {
30143 callFluidObserver(observer, event);
30144 });
30145 }
30146 }
30147 var FluidValue = class {
30148 constructor(get) {
30149 this[$get] = void 0;
30150 this[$observers] = void 0;
30151 if (!get && !(get = this.get)) {
30152 throw Error("Unknown getter");
30153 }
30154 setFluidGetter(this, get);
30155 }
30156 };
30157 var setFluidGetter = (target, get) => setHidden(target, $get, get);
30158 function addFluidObserver(target, observer) {
30159 if (target[$get]) {
30160 let observers = target[$observers];
30161 if (!observers) {
30162 setHidden(target, $observers, observers = /* @__PURE__ */ new Set());
30163 }
30164 if (!observers.has(observer)) {
30165 observers.add(observer);
30166 if (target.observerAdded) {
30167 target.observerAdded(observers.size, observer);
30168 }
30169 }
30170 }
30171 return observer;
30172 }
30173 function removeFluidObserver(target, observer) {
30174 let observers = target[$observers];
30175 if (observers && observers.has(observer)) {
30176 const count = observers.size - 1;
30177 if (count) {
30178 observers.delete(observer);
30179 } else {
30180 target[$observers] = null;
30181 }
30182 if (target.observerRemoved) {
30183 target.observerRemoved(count, observer);
30184 }
30185 }
30186 }
30187 var setHidden = (target, key, value) => Object.defineProperty(target, key, {
30188 value,
30189 writable: true,
30190 configurable: true
30191 });
30192 var numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
30193 var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
30194 var unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, "i");
30195 var rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi;
30196 var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
30197 var variableToRgba = (input) => {
30198 const [token, fallback] = parseCSSVariable(input);
30199 if (!token || isSSR()) {
30200 return input;
30201 }
30202 const value = window.getComputedStyle(document.documentElement).getPropertyValue(token);
30203 if (value) {
30204 return value.trim();
30205 } else if (fallback && fallback.startsWith("--")) {
30206 const _value = window.getComputedStyle(document.documentElement).getPropertyValue(fallback);
30207 if (_value) {
30208 return _value;
30209 } else {
30210 return input;
30211 }
30212 } else if (fallback && cssVariableRegex.test(fallback)) {
30213 return variableToRgba(fallback);
30214 } else if (fallback) {
30215 return fallback;
30216 }
30217 return input;
30218 };
30219 var parseCSSVariable = (current) => {
30220 const match2 = cssVariableRegex.exec(current);
30221 if (!match2) return [,];
30222 const [, token, fallback] = match2;
30223 return [token, fallback];
30224 };
30225 var namedColorRegex;
30226 var rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`;
30227 var createStringInterpolator = (config2) => {
30228 if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join("|")})(?!\\w)`, "g") : /^\b$/;
30229 const output = config2.output.map((value) => {
30230 return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba);
30231 });
30232 const keyframes = output.map((value) => value.match(numberRegex).map(Number));
30233 const outputRanges = keyframes[0].map((_, i) => keyframes.map((values) => {
30234 if (!(i in values)) {
30235 throw Error('The arity of each "output" value must be equal');
30236 }
30237 return values[i];
30238 }));
30239 const interpolators = outputRanges.map((output2) => createInterpolator(_extends({}, config2, {
30240 output: output2
30241 })));
30242 return (input) => {
30243 var _output$find;
30244 const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find((value) => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, ""));
30245 let i = 0;
30246 return output[0].replace(numberRegex, () => `${interpolators[i++](input)}${missingUnit || ""}`).replace(rgbaRegex, rgbaRound);
30247 };
30248 };
30249 var prefix = "react-spring: ";
30250 var once = (fn) => {
30251 const func = fn;
30252 let called = false;
30253 if (typeof func != "function") {
30254 throw new TypeError(`${prefix}once requires a function parameter`);
30255 }
30256 return (...args) => {
30257 if (!called) {
30258 func(...args);
30259 called = true;
30260 }
30261 };
30262 };
30263 var warnInterpolate = once(console.warn);
30264 function deprecateInterpolate() {
30265 warnInterpolate(`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`);
30266 }
30267 var warnDirectCall = once(console.warn);
30268 function isAnimatedString(value) {
30269 return is.str(value) && (value[0] == "#" || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {}));
30270 }
30271 var useIsomorphicLayoutEffect2 = isSSR() ? import_react50.useEffect : import_react50.useLayoutEffect;
30272 var useIsMounted = () => {
30273 const isMounted = (0, import_react50.useRef)(false);
30274 useIsomorphicLayoutEffect2(() => {
30275 isMounted.current = true;
30276 return () => {
30277 isMounted.current = false;
30278 };
30279 }, []);
30280 return isMounted;
30281 };
30282 function useForceUpdate() {
30283 const update4 = (0, import_react50.useState)()[1];
30284 const isMounted = useIsMounted();
30285 return () => {
30286 if (isMounted.current) {
30287 update4(Math.random());
30288 }
30289 };
30290 }
30291 function useMemoOne(getResult, inputs) {
30292 const [initial2] = (0, import_react50.useState)(() => ({
30293 inputs,
30294 result: getResult()
30295 }));
30296 const committed = (0, import_react50.useRef)();
30297 const prevCache = committed.current;
30298 let cache = prevCache;
30299 if (cache) {
30300 const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs));
30301 if (!useCache) {
30302 cache = {
30303 inputs,
30304 result: getResult()
30305 };
30306 }
30307 } else {
30308 cache = initial2;
30309 }
30310 (0, import_react50.useEffect)(() => {
30311 committed.current = cache;
30312 if (prevCache == initial2) {
30313 initial2.inputs = initial2.result = void 0;
30314 }
30315 }, [cache]);
30316 return cache.result;
30317 }
30318 function areInputsEqual(next, prev) {
30319 if (next.length !== prev.length) {
30320 return false;
30321 }
30322 for (let i = 0; i < next.length; i++) {
30323 if (next[i] !== prev[i]) {
30324 return false;
30325 }
30326 }
30327 return true;
30328 }
30329 var useOnce = (effect) => (0, import_react50.useEffect)(effect, emptyDeps);
30330 var emptyDeps = [];
30331
30332 // node_modules/@react-spring/core/dist/react-spring-core.esm.js
30333 var React104 = __toESM(require_react());
30334 var import_react52 = __toESM(require_react());
30335
30336 // node_modules/@react-spring/animated/dist/react-spring-animated.esm.js
30337 var React103 = __toESM(require_react());
30338 var import_react51 = __toESM(require_react());
30339 var $node = /* @__PURE__ */ Symbol.for("Animated:node");
30340 var isAnimated = (value) => !!value && value[$node] === value;
30341 var getAnimated = (owner) => owner && owner[$node];
30342 var setAnimated = (owner, node) => defineHidden(owner, $node, node);
30343 var getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload();
30344 var Animated = class {
30345 constructor() {
30346 this.payload = void 0;
30347 setAnimated(this, this);
30348 }
30349 getPayload() {
30350 return this.payload || [];
30351 }
30352 };
30353 var AnimatedValue = class _AnimatedValue extends Animated {
30354 constructor(_value) {
30355 super();
30356 this.done = true;
30357 this.elapsedTime = void 0;
30358 this.lastPosition = void 0;
30359 this.lastVelocity = void 0;
30360 this.v0 = void 0;
30361 this.durationProgress = 0;
30362 this._value = _value;
30363 if (is.num(this._value)) {
30364 this.lastPosition = this._value;
30365 }
30366 }
30367 static create(value) {
30368 return new _AnimatedValue(value);
30369 }
30370 getPayload() {
30371 return [this];
30372 }
30373 getValue() {
30374 return this._value;
30375 }
30376 setValue(value, step) {
30377 if (is.num(value)) {
30378 this.lastPosition = value;
30379 if (step) {
30380 value = Math.round(value / step) * step;
30381 if (this.done) {
30382 this.lastPosition = value;
30383 }
30384 }
30385 }
30386 if (this._value === value) {
30387 return false;
30388 }
30389 this._value = value;
30390 return true;
30391 }
30392 reset() {
30393 const {
30394 done
30395 } = this;
30396 this.done = false;
30397 if (is.num(this._value)) {
30398 this.elapsedTime = 0;
30399 this.durationProgress = 0;
30400 this.lastPosition = this._value;
30401 if (done) this.lastVelocity = null;
30402 this.v0 = null;
30403 }
30404 }
30405 };
30406 var AnimatedString = class _AnimatedString extends AnimatedValue {
30407 constructor(value) {
30408 super(0);
30409 this._string = null;
30410 this._toString = void 0;
30411 this._toString = createInterpolator({
30412 output: [value, value]
30413 });
30414 }
30415 static create(value) {
30416 return new _AnimatedString(value);
30417 }
30418 getValue() {
30419 let value = this._string;
30420 return value == null ? this._string = this._toString(this._value) : value;
30421 }
30422 setValue(value) {
30423 if (is.str(value)) {
30424 if (value == this._string) {
30425 return false;
30426 }
30427 this._string = value;
30428 this._value = 1;
30429 } else if (super.setValue(value)) {
30430 this._string = null;
30431 } else {
30432 return false;
30433 }
30434 return true;
30435 }
30436 reset(goal) {
30437 if (goal) {
30438 this._toString = createInterpolator({
30439 output: [this.getValue(), goal]
30440 });
30441 }
30442 this._value = 0;
30443 super.reset();
30444 }
30445 };
30446 var TreeContext = {
30447 dependencies: null
30448 };
30449 var AnimatedObject = class extends Animated {
30450 constructor(source) {
30451 super();
30452 this.source = source;
30453 this.setValue(source);
30454 }
30455 getValue(animated2) {
30456 const values = {};
30457 eachProp(this.source, (source, key) => {
30458 if (isAnimated(source)) {
30459 values[key] = source.getValue(animated2);
30460 } else if (hasFluidValue(source)) {
30461 values[key] = getFluidValue(source);
30462 } else if (!animated2) {
30463 values[key] = source;
30464 }
30465 });
30466 return values;
30467 }
30468 setValue(source) {
30469 this.source = source;
30470 this.payload = this._makePayload(source);
30471 }
30472 reset() {
30473 if (this.payload) {
30474 each(this.payload, (node) => node.reset());
30475 }
30476 }
30477 _makePayload(source) {
30478 if (source) {
30479 const payload = /* @__PURE__ */ new Set();
30480 eachProp(source, this._addToPayload, payload);
30481 return Array.from(payload);
30482 }
30483 }
30484 _addToPayload(source) {
30485 if (TreeContext.dependencies && hasFluidValue(source)) {
30486 TreeContext.dependencies.add(source);
30487 }
30488 const payload = getPayload(source);
30489 if (payload) {
30490 each(payload, (node) => this.add(node));
30491 }
30492 }
30493 };
30494 var AnimatedArray = class _AnimatedArray extends AnimatedObject {
30495 constructor(source) {
30496 super(source);
30497 }
30498 static create(source) {
30499 return new _AnimatedArray(source);
30500 }
30501 getValue() {
30502 return this.source.map((node) => node.getValue());
30503 }
30504 setValue(source) {
30505 const payload = this.getPayload();
30506 if (source.length == payload.length) {
30507 return payload.map((node, i) => node.setValue(source[i])).some(Boolean);
30508 }
30509 super.setValue(source.map(makeAnimated));
30510 return true;
30511 }
30512 };
30513 function makeAnimated(value) {
30514 const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue;
30515 return nodeType.create(value);
30516 }
30517 function getAnimatedType(value) {
30518 const parentNode = getAnimated(value);
30519 return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
30520 }
30521 function _extends2() {
30522 _extends2 = Object.assign ? Object.assign.bind() : function(target) {
30523 for (var i = 1; i < arguments.length; i++) {
30524 var source = arguments[i];
30525 for (var key in source) {
30526 if (Object.prototype.hasOwnProperty.call(source, key)) {
30527 target[key] = source[key];
30528 }
30529 }
30530 }
30531 return target;
30532 };
30533 return _extends2.apply(this, arguments);
30534 }
30535 var withAnimated = (Component, host2) => {
30536 const hasInstance = !is.fun(Component) || Component.prototype && Component.prototype.isReactComponent;
30537 return (0, import_react51.forwardRef)((givenProps, givenRef) => {
30538 const instanceRef = (0, import_react51.useRef)(null);
30539 const ref = hasInstance && (0, import_react51.useCallback)((value) => {
30540 instanceRef.current = updateRef(givenRef, value);
30541 }, [givenRef]);
30542 const [props, deps] = getAnimatedState(givenProps, host2);
30543 const forceUpdate = useForceUpdate();
30544 const callback = () => {
30545 const instance = instanceRef.current;
30546 if (hasInstance && !instance) {
30547 return;
30548 }
30549 const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false;
30550 if (didUpdate === false) {
30551 forceUpdate();
30552 }
30553 };
30554 const observer = new PropsObserver(callback, deps);
30555 const observerRef = (0, import_react51.useRef)();
30556 useIsomorphicLayoutEffect2(() => {
30557 observerRef.current = observer;
30558 each(deps, (dep) => addFluidObserver(dep, observer));
30559 return () => {
30560 if (observerRef.current) {
30561 each(observerRef.current.deps, (dep) => removeFluidObserver(dep, observerRef.current));
30562 raf.cancel(observerRef.current.update);
30563 }
30564 };
30565 });
30566 (0, import_react51.useEffect)(callback, []);
30567 useOnce(() => () => {
30568 const observer2 = observerRef.current;
30569 each(observer2.deps, (dep) => removeFluidObserver(dep, observer2));
30570 });
30571 const usedProps = host2.getComponentProps(props.getValue());
30572 return React103.createElement(Component, _extends2({}, usedProps, {
30573 ref
30574 }));
30575 });
30576 };
30577 var PropsObserver = class {
30578 constructor(update4, deps) {
30579 this.update = update4;
30580 this.deps = deps;
30581 }
30582 eventObserved(event) {
30583 if (event.type == "change") {
30584 raf.write(this.update);
30585 }
30586 }
30587 };
30588 function getAnimatedState(props, host2) {
30589 const dependencies = /* @__PURE__ */ new Set();
30590 TreeContext.dependencies = dependencies;
30591 if (props.style) props = _extends2({}, props, {
30592 style: host2.createAnimatedStyle(props.style)
30593 });
30594 props = new AnimatedObject(props);
30595 TreeContext.dependencies = null;
30596 return [props, dependencies];
30597 }
30598 function updateRef(ref, value) {
30599 if (ref) {
30600 if (is.fun(ref)) ref(value);
30601 else ref.current = value;
30602 }
30603 return value;
30604 }
30605 var cacheKey = /* @__PURE__ */ Symbol.for("AnimatedComponent");
30606 var createHost = (components, {
30607 applyAnimatedValues: _applyAnimatedValues = () => false,
30608 createAnimatedStyle: _createAnimatedStyle = (style) => new AnimatedObject(style),
30609 getComponentProps: _getComponentProps = (props) => props
30610 } = {}) => {
30611 const hostConfig = {
30612 applyAnimatedValues: _applyAnimatedValues,
30613 createAnimatedStyle: _createAnimatedStyle,
30614 getComponentProps: _getComponentProps
30615 };
30616 const animated2 = (Component) => {
30617 const displayName = getDisplayName(Component) || "Anonymous";
30618 if (is.str(Component)) {
30619 Component = animated2[Component] || (animated2[Component] = withAnimated(Component, hostConfig));
30620 } else {
30621 Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig));
30622 }
30623 Component.displayName = `Animated(${displayName})`;
30624 return Component;
30625 };
30626 eachProp(components, (Component, key) => {
30627 if (is.arr(components)) {
30628 key = getDisplayName(Component);
30629 }
30630 animated2[key] = animated2(Component);
30631 });
30632 return {
30633 animated: animated2
30634 };
30635 };
30636 var getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null;
30637
30638 // node_modules/@react-spring/core/dist/react-spring-core.esm.js
30639 function _extends3() {
30640 _extends3 = Object.assign ? Object.assign.bind() : function(target) {
30641 for (var i = 1; i < arguments.length; i++) {
30642 var source = arguments[i];
30643 for (var key in source) {
30644 if (Object.prototype.hasOwnProperty.call(source, key)) {
30645 target[key] = source[key];
30646 }
30647 }
30648 }
30649 return target;
30650 };
30651 return _extends3.apply(this, arguments);
30652 }
30653 function callProp(value, ...args) {
30654 return is.fun(value) ? value(...args) : value;
30655 }
30656 var matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));
30657 var resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop;
30658 var getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0;
30659 var noopTransform = (value) => value;
30660 var getDefaultProps = (props, transform = noopTransform) => {
30661 let keys = DEFAULT_PROPS;
30662 if (props.default && props.default !== true) {
30663 props = props.default;
30664 keys = Object.keys(props);
30665 }
30666 const defaults2 = {};
30667 for (const key of keys) {
30668 const value = transform(props[key], key);
30669 if (!is.und(value)) {
30670 defaults2[key] = value;
30671 }
30672 }
30673 return defaults2;
30674 };
30675 var DEFAULT_PROPS = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"];
30676 var RESERVED_PROPS = {
30677 config: 1,
30678 from: 1,
30679 to: 1,
30680 ref: 1,
30681 loop: 1,
30682 reset: 1,
30683 pause: 1,
30684 cancel: 1,
30685 reverse: 1,
30686 immediate: 1,
30687 default: 1,
30688 delay: 1,
30689 onProps: 1,
30690 onStart: 1,
30691 onChange: 1,
30692 onPause: 1,
30693 onResume: 1,
30694 onRest: 1,
30695 onResolve: 1,
30696 items: 1,
30697 trail: 1,
30698 sort: 1,
30699 expires: 1,
30700 initial: 1,
30701 enter: 1,
30702 update: 1,
30703 leave: 1,
30704 children: 1,
30705 onDestroyed: 1,
30706 keys: 1,
30707 callId: 1,
30708 parentId: 1
30709 };
30710 function getForwardProps(props) {
30711 const forward = {};
30712 let count = 0;
30713 eachProp(props, (value, prop) => {
30714 if (!RESERVED_PROPS[prop]) {
30715 forward[prop] = value;
30716 count++;
30717 }
30718 });
30719 if (count) {
30720 return forward;
30721 }
30722 }
30723 function inferTo(props) {
30724 const to2 = getForwardProps(props);
30725 if (to2) {
30726 const out = {
30727 to: to2
30728 };
30729 eachProp(props, (val, key) => key in to2 || (out[key] = val));
30730 return out;
30731 }
30732 return _extends3({}, props);
30733 }
30734 function computeGoal(value) {
30735 value = getFluidValue(value);
30736 return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({
30737 range: [0, 1],
30738 output: [value, value]
30739 })(1) : value;
30740 }
30741 function isAsyncTo(to2) {
30742 return is.fun(to2) || is.arr(to2) && is.obj(to2[0]);
30743 }
30744 var config = {
30745 default: {
30746 tension: 170,
30747 friction: 26
30748 },
30749 gentle: {
30750 tension: 120,
30751 friction: 14
30752 },
30753 wobbly: {
30754 tension: 180,
30755 friction: 12
30756 },
30757 stiff: {
30758 tension: 210,
30759 friction: 20
30760 },
30761 slow: {
30762 tension: 280,
30763 friction: 60
30764 },
30765 molasses: {
30766 tension: 280,
30767 friction: 120
30768 }
30769 };
30770 var c1 = 1.70158;
30771 var c2 = c1 * 1.525;
30772 var c3 = c1 + 1;
30773 var c4 = 2 * Math.PI / 3;
30774 var c5 = 2 * Math.PI / 4.5;
30775 var bounceOut = (x2) => {
30776 const n1 = 7.5625;
30777 const d1 = 2.75;
30778 if (x2 < 1 / d1) {
30779 return n1 * x2 * x2;
30780 } else if (x2 < 2 / d1) {
30781 return n1 * (x2 -= 1.5 / d1) * x2 + 0.75;
30782 } else if (x2 < 2.5 / d1) {
30783 return n1 * (x2 -= 2.25 / d1) * x2 + 0.9375;
30784 } else {
30785 return n1 * (x2 -= 2.625 / d1) * x2 + 0.984375;
30786 }
30787 };
30788 var easings = {
30789 linear: (x2) => x2,
30790 easeInQuad: (x2) => x2 * x2,
30791 easeOutQuad: (x2) => 1 - (1 - x2) * (1 - x2),
30792 easeInOutQuad: (x2) => x2 < 0.5 ? 2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 2) / 2,
30793 easeInCubic: (x2) => x2 * x2 * x2,
30794 easeOutCubic: (x2) => 1 - Math.pow(1 - x2, 3),
30795 easeInOutCubic: (x2) => x2 < 0.5 ? 4 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 3) / 2,
30796 easeInQuart: (x2) => x2 * x2 * x2 * x2,
30797 easeOutQuart: (x2) => 1 - Math.pow(1 - x2, 4),
30798 easeInOutQuart: (x2) => x2 < 0.5 ? 8 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 4) / 2,
30799 easeInQuint: (x2) => x2 * x2 * x2 * x2 * x2,
30800 easeOutQuint: (x2) => 1 - Math.pow(1 - x2, 5),
30801 easeInOutQuint: (x2) => x2 < 0.5 ? 16 * x2 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 5) / 2,
30802 easeInSine: (x2) => 1 - Math.cos(x2 * Math.PI / 2),
30803 easeOutSine: (x2) => Math.sin(x2 * Math.PI / 2),
30804 easeInOutSine: (x2) => -(Math.cos(Math.PI * x2) - 1) / 2,
30805 easeInExpo: (x2) => x2 === 0 ? 0 : Math.pow(2, 10 * x2 - 10),
30806 easeOutExpo: (x2) => x2 === 1 ? 1 : 1 - Math.pow(2, -10 * x2),
30807 easeInOutExpo: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : x2 < 0.5 ? Math.pow(2, 20 * x2 - 10) / 2 : (2 - Math.pow(2, -20 * x2 + 10)) / 2,
30808 easeInCirc: (x2) => 1 - Math.sqrt(1 - Math.pow(x2, 2)),
30809 easeOutCirc: (x2) => Math.sqrt(1 - Math.pow(x2 - 1, 2)),
30810 easeInOutCirc: (x2) => x2 < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x2, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x2 + 2, 2)) + 1) / 2,
30811 easeInBack: (x2) => c3 * x2 * x2 * x2 - c1 * x2 * x2,
30812 easeOutBack: (x2) => 1 + c3 * Math.pow(x2 - 1, 3) + c1 * Math.pow(x2 - 1, 2),
30813 easeInOutBack: (x2) => x2 < 0.5 ? Math.pow(2 * x2, 2) * ((c2 + 1) * 2 * x2 - c2) / 2 : (Math.pow(2 * x2 - 2, 2) * ((c2 + 1) * (x2 * 2 - 2) + c2) + 2) / 2,
30814 easeInElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : -Math.pow(2, 10 * x2 - 10) * Math.sin((x2 * 10 - 10.75) * c4),
30815 easeOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : Math.pow(2, -10 * x2) * Math.sin((x2 * 10 - 0.75) * c4) + 1,
30816 easeInOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : x2 < 0.5 ? -(Math.pow(2, 20 * x2 - 10) * Math.sin((20 * x2 - 11.125) * c5)) / 2 : Math.pow(2, -20 * x2 + 10) * Math.sin((20 * x2 - 11.125) * c5) / 2 + 1,
30817 easeInBounce: (x2) => 1 - bounceOut(1 - x2),
30818 easeOutBounce: bounceOut,
30819 easeInOutBounce: (x2) => x2 < 0.5 ? (1 - bounceOut(1 - 2 * x2)) / 2 : (1 + bounceOut(2 * x2 - 1)) / 2
30820 };
30821 var defaults = _extends3({}, config.default, {
30822 mass: 1,
30823 damping: 1,
30824 easing: easings.linear,
30825 clamp: false
30826 });
30827 var AnimationConfig = class {
30828 constructor() {
30829 this.tension = void 0;
30830 this.friction = void 0;
30831 this.frequency = void 0;
30832 this.damping = void 0;
30833 this.mass = void 0;
30834 this.velocity = 0;
30835 this.restVelocity = void 0;
30836 this.precision = void 0;
30837 this.progress = void 0;
30838 this.duration = void 0;
30839 this.easing = void 0;
30840 this.clamp = void 0;
30841 this.bounce = void 0;
30842 this.decay = void 0;
30843 this.round = void 0;
30844 Object.assign(this, defaults);
30845 }
30846 };
30847 function mergeConfig(config2, newConfig, defaultConfig) {
30848 if (defaultConfig) {
30849 defaultConfig = _extends3({}, defaultConfig);
30850 sanitizeConfig(defaultConfig, newConfig);
30851 newConfig = _extends3({}, defaultConfig, newConfig);
30852 }
30853 sanitizeConfig(config2, newConfig);
30854 Object.assign(config2, newConfig);
30855 for (const key in defaults) {
30856 if (config2[key] == null) {
30857 config2[key] = defaults[key];
30858 }
30859 }
30860 let {
30861 mass,
30862 frequency,
30863 damping
30864 } = config2;
30865 if (!is.und(frequency)) {
30866 if (frequency < 0.01) frequency = 0.01;
30867 if (damping < 0) damping = 0;
30868 config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;
30869 config2.friction = 4 * Math.PI * damping * mass / frequency;
30870 }
30871 return config2;
30872 }
30873 function sanitizeConfig(config2, props) {
30874 if (!is.und(props.decay)) {
30875 config2.duration = void 0;
30876 } else {
30877 const isTensionConfig = !is.und(props.tension) || !is.und(props.friction);
30878 if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) {
30879 config2.duration = void 0;
30880 config2.decay = void 0;
30881 }
30882 if (isTensionConfig) {
30883 config2.frequency = void 0;
30884 }
30885 }
30886 }
30887 var emptyArray = [];
30888 var Animation2 = class {
30889 constructor() {
30890 this.changed = false;
30891 this.values = emptyArray;
30892 this.toValues = null;
30893 this.fromValues = emptyArray;
30894 this.to = void 0;
30895 this.from = void 0;
30896 this.config = new AnimationConfig();
30897 this.immediate = false;
30898 }
30899 };
30900 function scheduleProps(callId, {
30901 key,
30902 props,
30903 defaultProps,
30904 state,
30905 actions
30906 }) {
30907 return new Promise((resolve, reject) => {
30908 var _props$cancel;
30909 let delay;
30910 let timeout;
30911 let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key);
30912 if (cancel) {
30913 onStart();
30914 } else {
30915 if (!is.und(props.pause)) {
30916 state.paused = matchProp(props.pause, key);
30917 }
30918 let pause = defaultProps == null ? void 0 : defaultProps.pause;
30919 if (pause !== true) {
30920 pause = state.paused || matchProp(pause, key);
30921 }
30922 delay = callProp(props.delay || 0, key);
30923 if (pause) {
30924 state.resumeQueue.add(onResume);
30925 actions.pause();
30926 } else {
30927 actions.resume();
30928 onResume();
30929 }
30930 }
30931 function onPause() {
30932 state.resumeQueue.add(onResume);
30933 state.timeouts.delete(timeout);
30934 timeout.cancel();
30935 delay = timeout.time - raf.now();
30936 }
30937 function onResume() {
30938 if (delay > 0 && !globals.skipAnimation) {
30939 state.delayed = true;
30940 timeout = raf.setTimeout(onStart, delay);
30941 state.pauseQueue.add(onPause);
30942 state.timeouts.add(timeout);
30943 } else {
30944 onStart();
30945 }
30946 }
30947 function onStart() {
30948 if (state.delayed) {
30949 state.delayed = false;
30950 }
30951 state.pauseQueue.delete(onPause);
30952 state.timeouts.delete(timeout);
30953 if (callId <= (state.cancelId || 0)) {
30954 cancel = true;
30955 }
30956 try {
30957 actions.start(_extends3({}, props, {
30958 callId,
30959 cancel
30960 }), resolve);
30961 } catch (err) {
30962 reject(err);
30963 }
30964 }
30965 });
30966 }
30967 var getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some((result) => result.cancelled) ? getCancelledResult(target.get()) : results.every((result) => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every((result) => result.finished));
30968 var getNoopResult = (value) => ({
30969 value,
30970 noop: true,
30971 finished: true,
30972 cancelled: false
30973 });
30974 var getFinishedResult = (value, finished, cancelled = false) => ({
30975 value,
30976 finished,
30977 cancelled
30978 });
30979 var getCancelledResult = (value) => ({
30980 value,
30981 cancelled: true,
30982 finished: false
30983 });
30984 function runAsync(to2, props, state, target) {
30985 const {
30986 callId,
30987 parentId,
30988 onRest
30989 } = props;
30990 const {
30991 asyncTo: prevTo,
30992 promise: prevPromise
30993 } = state;
30994 if (!parentId && to2 === prevTo && !props.reset) {
30995 return prevPromise;
30996 }
30997 return state.promise = (async () => {
30998 state.asyncId = callId;
30999 state.asyncTo = to2;
31000 const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value);
31001 let preventBail;
31002 let bail;
31003 const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject));
31004 const bailIfEnded = (bailSignal) => {
31005 const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false);
31006 if (bailResult) {
31007 bailSignal.result = bailResult;
31008 bail(bailSignal);
31009 throw bailSignal;
31010 }
31011 };
31012 const animate = (arg1, arg2) => {
31013 const bailSignal = new BailSignal();
31014 const skipAnimationSignal = new SkipAniamtionSignal();
31015 return (async () => {
31016 if (globals.skipAnimation) {
31017 stopAsync(state);
31018 skipAnimationSignal.result = getFinishedResult(target, false);
31019 bail(skipAnimationSignal);
31020 throw skipAnimationSignal;
31021 }
31022 bailIfEnded(bailSignal);
31023 const props2 = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, {
31024 to: arg1
31025 });
31026 props2.parentId = callId;
31027 eachProp(defaultProps, (value, key) => {
31028 if (is.und(props2[key])) {
31029 props2[key] = value;
31030 }
31031 });
31032 const result2 = await target.start(props2);
31033 bailIfEnded(bailSignal);
31034 if (state.paused) {
31035 await new Promise((resume) => {
31036 state.resumeQueue.add(resume);
31037 });
31038 }
31039 return result2;
31040 })();
31041 };
31042 let result;
31043 if (globals.skipAnimation) {
31044 stopAsync(state);
31045 return getFinishedResult(target, false);
31046 }
31047 try {
31048 let animating;
31049 if (is.arr(to2)) {
31050 animating = (async (queue) => {
31051 for (const props2 of queue) {
31052 await animate(props2);
31053 }
31054 })(to2);
31055 } else {
31056 animating = Promise.resolve(to2(animate, target.stop.bind(target)));
31057 }
31058 await Promise.all([animating.then(preventBail), bailPromise]);
31059 result = getFinishedResult(target.get(), true, false);
31060 } catch (err) {
31061 if (err instanceof BailSignal) {
31062 result = err.result;
31063 } else if (err instanceof SkipAniamtionSignal) {
31064 result = err.result;
31065 } else {
31066 throw err;
31067 }
31068 } finally {
31069 if (callId == state.asyncId) {
31070 state.asyncId = parentId;
31071 state.asyncTo = parentId ? prevTo : void 0;
31072 state.promise = parentId ? prevPromise : void 0;
31073 }
31074 }
31075 if (is.fun(onRest)) {
31076 raf.batchedUpdates(() => {
31077 onRest(result, target, target.item);
31078 });
31079 }
31080 return result;
31081 })();
31082 }
31083 function stopAsync(state, cancelId) {
31084 flush(state.timeouts, (t) => t.cancel());
31085 state.pauseQueue.clear();
31086 state.resumeQueue.clear();
31087 state.asyncId = state.asyncTo = state.promise = void 0;
31088 if (cancelId) state.cancelId = cancelId;
31089 }
31090 var BailSignal = class extends Error {
31091 constructor() {
31092 super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.");
31093 this.result = void 0;
31094 }
31095 };
31096 var SkipAniamtionSignal = class extends Error {
31097 constructor() {
31098 super("SkipAnimationSignal");
31099 this.result = void 0;
31100 }
31101 };
31102 var isFrameValue = (value) => value instanceof FrameValue;
31103 var nextId$1 = 1;
31104 var FrameValue = class extends FluidValue {
31105 constructor(...args) {
31106 super(...args);
31107 this.id = nextId$1++;
31108 this.key = void 0;
31109 this._priority = 0;
31110 }
31111 get priority() {
31112 return this._priority;
31113 }
31114 set priority(priority2) {
31115 if (this._priority != priority2) {
31116 this._priority = priority2;
31117 this._onPriorityChange(priority2);
31118 }
31119 }
31120 get() {
31121 const node = getAnimated(this);
31122 return node && node.getValue();
31123 }
31124 to(...args) {
31125 return globals.to(this, args);
31126 }
31127 interpolate(...args) {
31128 deprecateInterpolate();
31129 return globals.to(this, args);
31130 }
31131 toJSON() {
31132 return this.get();
31133 }
31134 observerAdded(count) {
31135 if (count == 1) this._attach();
31136 }
31137 observerRemoved(count) {
31138 if (count == 0) this._detach();
31139 }
31140 _attach() {
31141 }
31142 _detach() {
31143 }
31144 _onChange(value, idle = false) {
31145 callFluidObservers(this, {
31146 type: "change",
31147 parent: this,
31148 value,
31149 idle
31150 });
31151 }
31152 _onPriorityChange(priority2) {
31153 if (!this.idle) {
31154 frameLoop.sort(this);
31155 }
31156 callFluidObservers(this, {
31157 type: "priority",
31158 parent: this,
31159 priority: priority2
31160 });
31161 }
31162 };
31163 var $P = /* @__PURE__ */ Symbol.for("SpringPhase");
31164 var HAS_ANIMATED = 1;
31165 var IS_ANIMATING = 2;
31166 var IS_PAUSED = 4;
31167 var hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0;
31168 var isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0;
31169 var isPaused = (target) => (target[$P] & IS_PAUSED) > 0;
31170 var setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING;
31171 var setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED;
31172 var SpringValue = class extends FrameValue {
31173 constructor(arg1, arg2) {
31174 super();
31175 this.key = void 0;
31176 this.animation = new Animation2();
31177 this.queue = void 0;
31178 this.defaultProps = {};
31179 this._state = {
31180 paused: false,
31181 delayed: false,
31182 pauseQueue: /* @__PURE__ */ new Set(),
31183 resumeQueue: /* @__PURE__ */ new Set(),
31184 timeouts: /* @__PURE__ */ new Set()
31185 };
31186 this._pendingCalls = /* @__PURE__ */ new Set();
31187 this._lastCallId = 0;
31188 this._lastToId = 0;
31189 this._memoizedDuration = 0;
31190 if (!is.und(arg1) || !is.und(arg2)) {
31191 const props = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, {
31192 from: arg1
31193 });
31194 if (is.und(props.default)) {
31195 props.default = true;
31196 }
31197 this.start(props);
31198 }
31199 }
31200 get idle() {
31201 return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);
31202 }
31203 get goal() {
31204 return getFluidValue(this.animation.to);
31205 }
31206 get velocity() {
31207 const node = getAnimated(this);
31208 return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0);
31209 }
31210 get hasAnimated() {
31211 return hasAnimated(this);
31212 }
31213 get isAnimating() {
31214 return isAnimating(this);
31215 }
31216 get isPaused() {
31217 return isPaused(this);
31218 }
31219 get isDelayed() {
31220 return this._state.delayed;
31221 }
31222 advance(dt) {
31223 let idle = true;
31224 let changed = false;
31225 const anim = this.animation;
31226 let {
31227 config: config2,
31228 toValues
31229 } = anim;
31230 const payload = getPayload(anim.to);
31231 if (!payload && hasFluidValue(anim.to)) {
31232 toValues = toArray(getFluidValue(anim.to));
31233 }
31234 anim.values.forEach((node2, i) => {
31235 if (node2.done) return;
31236 const to2 = node2.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i];
31237 let finished = anim.immediate;
31238 let position = to2;
31239 if (!finished) {
31240 position = node2.lastPosition;
31241 if (config2.tension <= 0) {
31242 node2.done = true;
31243 return;
31244 }
31245 let elapsed = node2.elapsedTime += dt;
31246 const from = anim.fromValues[i];
31247 const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i] : config2.velocity;
31248 let velocity;
31249 const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3));
31250 if (!is.und(config2.duration)) {
31251 let p2 = 1;
31252 if (config2.duration > 0) {
31253 if (this._memoizedDuration !== config2.duration) {
31254 this._memoizedDuration = config2.duration;
31255 if (node2.durationProgress > 0) {
31256 node2.elapsedTime = config2.duration * node2.durationProgress;
31257 elapsed = node2.elapsedTime += dt;
31258 }
31259 }
31260 p2 = (config2.progress || 0) + elapsed / this._memoizedDuration;
31261 p2 = p2 > 1 ? 1 : p2 < 0 ? 0 : p2;
31262 node2.durationProgress = p2;
31263 }
31264 position = from + config2.easing(p2) * (to2 - from);
31265 velocity = (position - node2.lastPosition) / dt;
31266 finished = p2 == 1;
31267 } else if (config2.decay) {
31268 const decay = config2.decay === true ? 0.998 : config2.decay;
31269 const e = Math.exp(-(1 - decay) * elapsed);
31270 position = from + v0 / (1 - decay) * (1 - e);
31271 finished = Math.abs(node2.lastPosition - position) <= precision;
31272 velocity = v0 * e;
31273 } else {
31274 velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity;
31275 const restVelocity = config2.restVelocity || precision / 10;
31276 const bounceFactor = config2.clamp ? 0 : config2.bounce;
31277 const canBounce = !is.und(bounceFactor);
31278 const isGrowing = from == to2 ? node2.v0 > 0 : from < to2;
31279 let isMoving;
31280 let isBouncing = false;
31281 const step = 1;
31282 const numSteps = Math.ceil(dt / step);
31283 for (let n = 0; n < numSteps; ++n) {
31284 isMoving = Math.abs(velocity) > restVelocity;
31285 if (!isMoving) {
31286 finished = Math.abs(to2 - position) <= precision;
31287 if (finished) {
31288 break;
31289 }
31290 }
31291 if (canBounce) {
31292 isBouncing = position == to2 || position > to2 == isGrowing;
31293 if (isBouncing) {
31294 velocity = -velocity * bounceFactor;
31295 position = to2;
31296 }
31297 }
31298 const springForce = -config2.tension * 1e-6 * (position - to2);
31299 const dampingForce = -config2.friction * 1e-3 * velocity;
31300 const acceleration = (springForce + dampingForce) / config2.mass;
31301 velocity = velocity + acceleration * step;
31302 position = position + velocity * step;
31303 }
31304 }
31305 node2.lastVelocity = velocity;
31306 if (Number.isNaN(position)) {
31307 console.warn(`Got NaN while animating:`, this);
31308 finished = true;
31309 }
31310 }
31311 if (payload && !payload[i].done) {
31312 finished = false;
31313 }
31314 if (finished) {
31315 node2.done = true;
31316 } else {
31317 idle = false;
31318 }
31319 if (node2.setValue(position, config2.round)) {
31320 changed = true;
31321 }
31322 });
31323 const node = getAnimated(this);
31324 const currVal = node.getValue();
31325 if (idle) {
31326 const finalVal = getFluidValue(anim.to);
31327 if ((currVal !== finalVal || changed) && !config2.decay) {
31328 node.setValue(finalVal);
31329 this._onChange(finalVal);
31330 } else if (changed && config2.decay) {
31331 this._onChange(currVal);
31332 }
31333 this._stop();
31334 } else if (changed) {
31335 this._onChange(currVal);
31336 }
31337 }
31338 set(value) {
31339 raf.batchedUpdates(() => {
31340 this._stop();
31341 this._focus(value);
31342 this._set(value);
31343 });
31344 return this;
31345 }
31346 pause() {
31347 this._update({
31348 pause: true
31349 });
31350 }
31351 resume() {
31352 this._update({
31353 pause: false
31354 });
31355 }
31356 finish() {
31357 if (isAnimating(this)) {
31358 const {
31359 to: to2,
31360 config: config2
31361 } = this.animation;
31362 raf.batchedUpdates(() => {
31363 this._onStart();
31364 if (!config2.decay) {
31365 this._set(to2, false);
31366 }
31367 this._stop();
31368 });
31369 }
31370 return this;
31371 }
31372 update(props) {
31373 const queue = this.queue || (this.queue = []);
31374 queue.push(props);
31375 return this;
31376 }
31377 start(to2, arg2) {
31378 let queue;
31379 if (!is.und(to2)) {
31380 queue = [is.obj(to2) ? to2 : _extends3({}, arg2, {
31381 to: to2
31382 })];
31383 } else {
31384 queue = this.queue || [];
31385 this.queue = [];
31386 }
31387 return Promise.all(queue.map((props) => {
31388 const up = this._update(props);
31389 return up;
31390 })).then((results) => getCombinedResult(this, results));
31391 }
31392 stop(cancel) {
31393 const {
31394 to: to2
31395 } = this.animation;
31396 this._focus(this.get());
31397 stopAsync(this._state, cancel && this._lastCallId);
31398 raf.batchedUpdates(() => this._stop(to2, cancel));
31399 return this;
31400 }
31401 reset() {
31402 this._update({
31403 reset: true
31404 });
31405 }
31406 eventObserved(event) {
31407 if (event.type == "change") {
31408 this._start();
31409 } else if (event.type == "priority") {
31410 this.priority = event.priority + 1;
31411 }
31412 }
31413 _prepareNode(props) {
31414 const key = this.key || "";
31415 let {
31416 to: to2,
31417 from
31418 } = props;
31419 to2 = is.obj(to2) ? to2[key] : to2;
31420 if (to2 == null || isAsyncTo(to2)) {
31421 to2 = void 0;
31422 }
31423 from = is.obj(from) ? from[key] : from;
31424 if (from == null) {
31425 from = void 0;
31426 }
31427 const range = {
31428 to: to2,
31429 from
31430 };
31431 if (!hasAnimated(this)) {
31432 if (props.reverse) [to2, from] = [from, to2];
31433 from = getFluidValue(from);
31434 if (!is.und(from)) {
31435 this._set(from);
31436 } else if (!getAnimated(this)) {
31437 this._set(to2);
31438 }
31439 }
31440 return range;
31441 }
31442 _update(_ref, isLoop) {
31443 let props = _extends3({}, _ref);
31444 const {
31445 key,
31446 defaultProps
31447 } = this;
31448 if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value));
31449 mergeActiveFn(this, props, "onProps");
31450 sendEvent(this, "onProps", props, this);
31451 const range = this._prepareNode(props);
31452 if (Object.isFrozen(this)) {
31453 throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");
31454 }
31455 const state = this._state;
31456 return scheduleProps(++this._lastCallId, {
31457 key,
31458 props,
31459 defaultProps,
31460 state,
31461 actions: {
31462 pause: () => {
31463 if (!isPaused(this)) {
31464 setPausedBit(this, true);
31465 flushCalls(state.pauseQueue);
31466 sendEvent(this, "onPause", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
31467 }
31468 },
31469 resume: () => {
31470 if (isPaused(this)) {
31471 setPausedBit(this, false);
31472 if (isAnimating(this)) {
31473 this._resume();
31474 }
31475 flushCalls(state.resumeQueue);
31476 sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
31477 }
31478 },
31479 start: this._merge.bind(this, range)
31480 }
31481 }).then((result) => {
31482 if (props.loop && result.finished && !(isLoop && result.noop)) {
31483 const nextProps = createLoopUpdate(props);
31484 if (nextProps) {
31485 return this._update(nextProps, true);
31486 }
31487 }
31488 return result;
31489 });
31490 }
31491 _merge(range, props, resolve) {
31492 if (props.cancel) {
31493 this.stop(true);
31494 return resolve(getCancelledResult(this));
31495 }
31496 const hasToProp = !is.und(range.to);
31497 const hasFromProp = !is.und(range.from);
31498 if (hasToProp || hasFromProp) {
31499 if (props.callId > this._lastToId) {
31500 this._lastToId = props.callId;
31501 } else {
31502 return resolve(getCancelledResult(this));
31503 }
31504 }
31505 const {
31506 key,
31507 defaultProps,
31508 animation: anim
31509 } = this;
31510 const {
31511 to: prevTo,
31512 from: prevFrom
31513 } = anim;
31514 let {
31515 to: to2 = prevTo,
31516 from = prevFrom
31517 } = range;
31518 if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) {
31519 to2 = from;
31520 }
31521 if (props.reverse) [to2, from] = [from, to2];
31522 const hasFromChanged = !isEqual(from, prevFrom);
31523 if (hasFromChanged) {
31524 anim.from = from;
31525 }
31526 from = getFluidValue(from);
31527 const hasToChanged = !isEqual(to2, prevTo);
31528 if (hasToChanged) {
31529 this._focus(to2);
31530 }
31531 const hasAsyncTo = isAsyncTo(props.to);
31532 const {
31533 config: config2
31534 } = anim;
31535 const {
31536 decay,
31537 velocity
31538 } = config2;
31539 if (hasToProp || hasFromProp) {
31540 config2.velocity = 0;
31541 }
31542 if (props.config && !hasAsyncTo) {
31543 mergeConfig(config2, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0);
31544 }
31545 let node = getAnimated(this);
31546 if (!node || is.und(to2)) {
31547 return resolve(getFinishedResult(this, true));
31548 }
31549 const reset = is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key);
31550 const value = reset ? from : this.get();
31551 const goal = computeGoal(to2);
31552 const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal);
31553 const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));
31554 if (hasToChanged) {
31555 const nodeType = getAnimatedType(to2);
31556 if (nodeType !== node.constructor) {
31557 if (immediate) {
31558 node = this._set(goal);
31559 } else throw Error(`Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`);
31560 }
31561 }
31562 const goalType = node.constructor;
31563 let started = hasFluidValue(to2);
31564 let finished = false;
31565 if (!started) {
31566 const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
31567 if (hasToChanged || hasValueChanged) {
31568 finished = isEqual(computeGoal(value), goal);
31569 started = !finished;
31570 }
31571 if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
31572 started = true;
31573 }
31574 }
31575 if (finished && isAnimating(this)) {
31576 if (anim.changed && !reset) {
31577 started = true;
31578 } else if (!started) {
31579 this._stop(prevTo);
31580 }
31581 }
31582 if (!hasAsyncTo) {
31583 if (started || hasFluidValue(prevTo)) {
31584 anim.values = node.getPayload();
31585 anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
31586 }
31587 if (anim.immediate != immediate) {
31588 anim.immediate = immediate;
31589 if (!immediate && !reset) {
31590 this._set(prevTo);
31591 }
31592 }
31593 if (started) {
31594 const {
31595 onRest
31596 } = anim;
31597 each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type));
31598 const result = getFinishedResult(this, checkFinished(this, prevTo));
31599 flushCalls(this._pendingCalls, result);
31600 this._pendingCalls.add(resolve);
31601 if (anim.changed) raf.batchedUpdates(() => {
31602 anim.changed = !reset;
31603 onRest == null ? void 0 : onRest(result, this);
31604 if (reset) {
31605 callProp(defaultProps.onRest, result);
31606 } else {
31607 anim.onStart == null ? void 0 : anim.onStart(result, this);
31608 }
31609 });
31610 }
31611 }
31612 if (reset) {
31613 this._set(value);
31614 }
31615 if (hasAsyncTo) {
31616 resolve(runAsync(props.to, props, this._state, this));
31617 } else if (started) {
31618 this._start();
31619 } else if (isAnimating(this) && !hasToChanged) {
31620 this._pendingCalls.add(resolve);
31621 } else {
31622 resolve(getNoopResult(value));
31623 }
31624 }
31625 _focus(value) {
31626 const anim = this.animation;
31627 if (value !== anim.to) {
31628 if (getFluidObservers(this)) {
31629 this._detach();
31630 }
31631 anim.to = value;
31632 if (getFluidObservers(this)) {
31633 this._attach();
31634 }
31635 }
31636 }
31637 _attach() {
31638 let priority2 = 0;
31639 const {
31640 to: to2
31641 } = this.animation;
31642 if (hasFluidValue(to2)) {
31643 addFluidObserver(to2, this);
31644 if (isFrameValue(to2)) {
31645 priority2 = to2.priority + 1;
31646 }
31647 }
31648 this.priority = priority2;
31649 }
31650 _detach() {
31651 const {
31652 to: to2
31653 } = this.animation;
31654 if (hasFluidValue(to2)) {
31655 removeFluidObserver(to2, this);
31656 }
31657 }
31658 _set(arg, idle = true) {
31659 const value = getFluidValue(arg);
31660 if (!is.und(value)) {
31661 const oldNode = getAnimated(this);
31662 if (!oldNode || !isEqual(value, oldNode.getValue())) {
31663 const nodeType = getAnimatedType(value);
31664 if (!oldNode || oldNode.constructor != nodeType) {
31665 setAnimated(this, nodeType.create(value));
31666 } else {
31667 oldNode.setValue(value);
31668 }
31669 if (oldNode) {
31670 raf.batchedUpdates(() => {
31671 this._onChange(value, idle);
31672 });
31673 }
31674 }
31675 }
31676 return getAnimated(this);
31677 }
31678 _onStart() {
31679 const anim = this.animation;
31680 if (!anim.changed) {
31681 anim.changed = true;
31682 sendEvent(this, "onStart", getFinishedResult(this, checkFinished(this, anim.to)), this);
31683 }
31684 }
31685 _onChange(value, idle) {
31686 if (!idle) {
31687 this._onStart();
31688 callProp(this.animation.onChange, value, this);
31689 }
31690 callProp(this.defaultProps.onChange, value, this);
31691 super._onChange(value, idle);
31692 }
31693 _start() {
31694 const anim = this.animation;
31695 getAnimated(this).reset(getFluidValue(anim.to));
31696 if (!anim.immediate) {
31697 anim.fromValues = anim.values.map((node) => node.lastPosition);
31698 }
31699 if (!isAnimating(this)) {
31700 setActiveBit(this, true);
31701 if (!isPaused(this)) {
31702 this._resume();
31703 }
31704 }
31705 }
31706 _resume() {
31707 if (globals.skipAnimation) {
31708 this.finish();
31709 } else {
31710 frameLoop.start(this);
31711 }
31712 }
31713 _stop(goal, cancel) {
31714 if (isAnimating(this)) {
31715 setActiveBit(this, false);
31716 const anim = this.animation;
31717 each(anim.values, (node) => {
31718 node.done = true;
31719 });
31720 if (anim.toValues) {
31721 anim.onChange = anim.onPause = anim.onResume = void 0;
31722 }
31723 callFluidObservers(this, {
31724 type: "idle",
31725 parent: this
31726 });
31727 const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to));
31728 flushCalls(this._pendingCalls, result);
31729 if (anim.changed) {
31730 anim.changed = false;
31731 sendEvent(this, "onRest", result, this);
31732 }
31733 }
31734 }
31735 };
31736 function checkFinished(target, to2) {
31737 const goal = computeGoal(to2);
31738 const value = computeGoal(target.get());
31739 return isEqual(value, goal);
31740 }
31741 function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
31742 let loopRet = callProp(loop2);
31743 if (loopRet) {
31744 const overrides = loopRet !== true && inferTo(loopRet);
31745 const reverse = (overrides || props).reverse;
31746 const reset = !overrides || overrides.reset;
31747 return createUpdate(_extends3({}, props, {
31748 loop: loop2,
31749 default: false,
31750 pause: void 0,
31751 to: !reverse || isAsyncTo(to2) ? to2 : void 0,
31752 from: reset ? props.from : void 0,
31753 reset
31754 }, overrides));
31755 }
31756 }
31757 function createUpdate(props) {
31758 const {
31759 to: to2,
31760 from
31761 } = props = inferTo(props);
31762 const keys = /* @__PURE__ */ new Set();
31763 if (is.obj(to2)) findDefined(to2, keys);
31764 if (is.obj(from)) findDefined(from, keys);
31765 props.keys = keys.size ? Array.from(keys) : null;
31766 return props;
31767 }
31768 function findDefined(values, keys) {
31769 eachProp(values, (value, key) => value != null && keys.add(key));
31770 }
31771 var ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"];
31772 function mergeActiveFn(target, props, type) {
31773 target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0;
31774 }
31775 function sendEvent(target, type, ...args) {
31776 var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;
31777 (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args);
31778 (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args);
31779 }
31780 var BATCHED_EVENTS = ["onStart", "onChange", "onRest"];
31781 var nextId = 1;
31782 var Controller = class {
31783 constructor(props, flush2) {
31784 this.id = nextId++;
31785 this.springs = {};
31786 this.queue = [];
31787 this.ref = void 0;
31788 this._flush = void 0;
31789 this._initialProps = void 0;
31790 this._lastAsyncId = 0;
31791 this._active = /* @__PURE__ */ new Set();
31792 this._changed = /* @__PURE__ */ new Set();
31793 this._started = false;
31794 this._item = void 0;
31795 this._state = {
31796 paused: false,
31797 pauseQueue: /* @__PURE__ */ new Set(),
31798 resumeQueue: /* @__PURE__ */ new Set(),
31799 timeouts: /* @__PURE__ */ new Set()
31800 };
31801 this._events = {
31802 onStart: /* @__PURE__ */ new Map(),
31803 onChange: /* @__PURE__ */ new Map(),
31804 onRest: /* @__PURE__ */ new Map()
31805 };
31806 this._onFrame = this._onFrame.bind(this);
31807 if (flush2) {
31808 this._flush = flush2;
31809 }
31810 if (props) {
31811 this.start(_extends3({
31812 default: true
31813 }, props));
31814 }
31815 }
31816 get idle() {
31817 return !this._state.asyncTo && Object.values(this.springs).every((spring) => {
31818 return spring.idle && !spring.isDelayed && !spring.isPaused;
31819 });
31820 }
31821 get item() {
31822 return this._item;
31823 }
31824 set item(item) {
31825 this._item = item;
31826 }
31827 get() {
31828 const values = {};
31829 this.each((spring, key) => values[key] = spring.get());
31830 return values;
31831 }
31832 set(values) {
31833 for (const key in values) {
31834 const value = values[key];
31835 if (!is.und(value)) {
31836 this.springs[key].set(value);
31837 }
31838 }
31839 }
31840 update(props) {
31841 if (props) {
31842 this.queue.push(createUpdate(props));
31843 }
31844 return this;
31845 }
31846 start(props) {
31847 let {
31848 queue
31849 } = this;
31850 if (props) {
31851 queue = toArray(props).map(createUpdate);
31852 } else {
31853 this.queue = [];
31854 }
31855 if (this._flush) {
31856 return this._flush(this, queue);
31857 }
31858 prepareKeys(this, queue);
31859 return flushUpdateQueue(this, queue);
31860 }
31861 stop(arg, keys) {
31862 if (arg !== !!arg) {
31863 keys = arg;
31864 }
31865 if (keys) {
31866 const springs = this.springs;
31867 each(toArray(keys), (key) => springs[key].stop(!!arg));
31868 } else {
31869 stopAsync(this._state, this._lastAsyncId);
31870 this.each((spring) => spring.stop(!!arg));
31871 }
31872 return this;
31873 }
31874 pause(keys) {
31875 if (is.und(keys)) {
31876 this.start({
31877 pause: true
31878 });
31879 } else {
31880 const springs = this.springs;
31881 each(toArray(keys), (key) => springs[key].pause());
31882 }
31883 return this;
31884 }
31885 resume(keys) {
31886 if (is.und(keys)) {
31887 this.start({
31888 pause: false
31889 });
31890 } else {
31891 const springs = this.springs;
31892 each(toArray(keys), (key) => springs[key].resume());
31893 }
31894 return this;
31895 }
31896 each(iterator) {
31897 eachProp(this.springs, iterator);
31898 }
31899 _onFrame() {
31900 const {
31901 onStart,
31902 onChange,
31903 onRest
31904 } = this._events;
31905 const active = this._active.size > 0;
31906 const changed = this._changed.size > 0;
31907 if (active && !this._started || changed && !this._started) {
31908 this._started = true;
31909 flush(onStart, ([onStart2, result]) => {
31910 result.value = this.get();
31911 onStart2(result, this, this._item);
31912 });
31913 }
31914 const idle = !active && this._started;
31915 const values = changed || idle && onRest.size ? this.get() : null;
31916 if (changed && onChange.size) {
31917 flush(onChange, ([onChange2, result]) => {
31918 result.value = values;
31919 onChange2(result, this, this._item);
31920 });
31921 }
31922 if (idle) {
31923 this._started = false;
31924 flush(onRest, ([onRest2, result]) => {
31925 result.value = values;
31926 onRest2(result, this, this._item);
31927 });
31928 }
31929 }
31930 eventObserved(event) {
31931 if (event.type == "change") {
31932 this._changed.add(event.parent);
31933 if (!event.idle) {
31934 this._active.add(event.parent);
31935 }
31936 } else if (event.type == "idle") {
31937 this._active.delete(event.parent);
31938 } else return;
31939 raf.onFrame(this._onFrame);
31940 }
31941 };
31942 function flushUpdateQueue(ctrl, queue) {
31943 return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then((results) => getCombinedResult(ctrl, results));
31944 }
31945 async function flushUpdate(ctrl, props, isLoop) {
31946 const {
31947 keys,
31948 to: to2,
31949 from,
31950 loop: loop2,
31951 onRest,
31952 onResolve
31953 } = props;
31954 const defaults2 = is.obj(props.default) && props.default;
31955 if (loop2) {
31956 props.loop = false;
31957 }
31958 if (to2 === false) props.to = null;
31959 if (from === false) props.from = null;
31960 const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0;
31961 if (asyncTo) {
31962 props.to = void 0;
31963 props.onRest = void 0;
31964 if (defaults2) {
31965 defaults2.onRest = void 0;
31966 }
31967 } else {
31968 each(BATCHED_EVENTS, (key) => {
31969 const handler = props[key];
31970 if (is.fun(handler)) {
31971 const queue = ctrl["_events"][key];
31972 props[key] = ({
31973 finished,
31974 cancelled
31975 }) => {
31976 const result2 = queue.get(handler);
31977 if (result2) {
31978 if (!finished) result2.finished = false;
31979 if (cancelled) result2.cancelled = true;
31980 } else {
31981 queue.set(handler, {
31982 value: null,
31983 finished: finished || false,
31984 cancelled: cancelled || false
31985 });
31986 }
31987 };
31988 if (defaults2) {
31989 defaults2[key] = props[key];
31990 }
31991 }
31992 });
31993 }
31994 const state = ctrl["_state"];
31995 if (props.pause === !state.paused) {
31996 state.paused = props.pause;
31997 flushCalls(props.pause ? state.pauseQueue : state.resumeQueue);
31998 } else if (state.paused) {
31999 props.pause = true;
32000 }
32001 const promises = (keys || Object.keys(ctrl.springs)).map((key) => ctrl.springs[key].start(props));
32002 const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true;
32003 if (asyncTo || cancel && state.asyncId) {
32004 promises.push(scheduleProps(++ctrl["_lastAsyncId"], {
32005 props,
32006 state,
32007 actions: {
32008 pause: noop4,
32009 resume: noop4,
32010 start(props2, resolve) {
32011 if (cancel) {
32012 stopAsync(state, ctrl["_lastAsyncId"]);
32013 resolve(getCancelledResult(ctrl));
32014 } else {
32015 props2.onRest = onRest;
32016 resolve(runAsync(asyncTo, props2, state, ctrl));
32017 }
32018 }
32019 }
32020 }));
32021 }
32022 if (state.paused) {
32023 await new Promise((resume) => {
32024 state.resumeQueue.add(resume);
32025 });
32026 }
32027 const result = getCombinedResult(ctrl, await Promise.all(promises));
32028 if (loop2 && result.finished && !(isLoop && result.noop)) {
32029 const nextProps = createLoopUpdate(props, loop2, to2);
32030 if (nextProps) {
32031 prepareKeys(ctrl, [nextProps]);
32032 return flushUpdate(ctrl, nextProps, true);
32033 }
32034 }
32035 if (onResolve) {
32036 raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item));
32037 }
32038 return result;
32039 }
32040 function createSpring(key, observer) {
32041 const spring = new SpringValue();
32042 spring.key = key;
32043 if (observer) {
32044 addFluidObserver(spring, observer);
32045 }
32046 return spring;
32047 }
32048 function prepareSprings(springs, props, create) {
32049 if (props.keys) {
32050 each(props.keys, (key) => {
32051 const spring = springs[key] || (springs[key] = create(key));
32052 spring["_prepareNode"](props);
32053 });
32054 }
32055 }
32056 function prepareKeys(ctrl, queue) {
32057 each(queue, (props) => {
32058 prepareSprings(ctrl.springs, props, (key) => {
32059 return createSpring(key, ctrl);
32060 });
32061 });
32062 }
32063 function _objectWithoutPropertiesLoose(source, excluded) {
32064 if (source == null) return {};
32065 var target = {};
32066 var sourceKeys = Object.keys(source);
32067 var key, i;
32068 for (i = 0; i < sourceKeys.length; i++) {
32069 key = sourceKeys[i];
32070 if (excluded.indexOf(key) >= 0) continue;
32071 target[key] = source[key];
32072 }
32073 return target;
32074 }
32075 var _excluded$3 = ["children"];
32076 var SpringContext = (_ref) => {
32077 let {
32078 children
32079 } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
32080 const inherited = (0, import_react52.useContext)(ctx);
32081 const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate;
32082 props = useMemoOne(() => ({
32083 pause,
32084 immediate
32085 }), [pause, immediate]);
32086 const {
32087 Provider: Provider2
32088 } = ctx;
32089 return React104.createElement(Provider2, {
32090 value: props
32091 }, children);
32092 };
32093 var ctx = makeContext(SpringContext, {});
32094 SpringContext.Provider = ctx.Provider;
32095 SpringContext.Consumer = ctx.Consumer;
32096 function makeContext(target, init) {
32097 Object.assign(target, React104.createContext(init));
32098 target.Provider._context = target;
32099 target.Consumer._context = target;
32100 return target;
32101 }
32102 var TransitionPhase;
32103 (function(TransitionPhase2) {
32104 TransitionPhase2["MOUNT"] = "mount";
32105 TransitionPhase2["ENTER"] = "enter";
32106 TransitionPhase2["UPDATE"] = "update";
32107 TransitionPhase2["LEAVE"] = "leave";
32108 })(TransitionPhase || (TransitionPhase = {}));
32109 var Interpolation = class extends FrameValue {
32110 constructor(source, args) {
32111 super();
32112 this.key = void 0;
32113 this.idle = true;
32114 this.calc = void 0;
32115 this._active = /* @__PURE__ */ new Set();
32116 this.source = source;
32117 this.calc = createInterpolator(...args);
32118 const value = this._get();
32119 const nodeType = getAnimatedType(value);
32120 setAnimated(this, nodeType.create(value));
32121 }
32122 advance(_dt) {
32123 const value = this._get();
32124 const oldValue = this.get();
32125 if (!isEqual(value, oldValue)) {
32126 getAnimated(this).setValue(value);
32127 this._onChange(value, this.idle);
32128 }
32129 if (!this.idle && checkIdle(this._active)) {
32130 becomeIdle(this);
32131 }
32132 }
32133 _get() {
32134 const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
32135 return this.calc(...inputs);
32136 }
32137 _start() {
32138 if (this.idle && !checkIdle(this._active)) {
32139 this.idle = false;
32140 each(getPayload(this), (node) => {
32141 node.done = false;
32142 });
32143 if (globals.skipAnimation) {
32144 raf.batchedUpdates(() => this.advance());
32145 becomeIdle(this);
32146 } else {
32147 frameLoop.start(this);
32148 }
32149 }
32150 }
32151 _attach() {
32152 let priority2 = 1;
32153 each(toArray(this.source), (source) => {
32154 if (hasFluidValue(source)) {
32155 addFluidObserver(source, this);
32156 }
32157 if (isFrameValue(source)) {
32158 if (!source.idle) {
32159 this._active.add(source);
32160 }
32161 priority2 = Math.max(priority2, source.priority + 1);
32162 }
32163 });
32164 this.priority = priority2;
32165 this._start();
32166 }
32167 _detach() {
32168 each(toArray(this.source), (source) => {
32169 if (hasFluidValue(source)) {
32170 removeFluidObserver(source, this);
32171 }
32172 });
32173 this._active.clear();
32174 becomeIdle(this);
32175 }
32176 eventObserved(event) {
32177 if (event.type == "change") {
32178 if (event.idle) {
32179 this.advance();
32180 } else {
32181 this._active.add(event.parent);
32182 this._start();
32183 }
32184 } else if (event.type == "idle") {
32185 this._active.delete(event.parent);
32186 } else if (event.type == "priority") {
32187 this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
32188 }
32189 }
32190 };
32191 function isIdle(source) {
32192 return source.idle !== false;
32193 }
32194 function checkIdle(active) {
32195 return !active.size || Array.from(active).every(isIdle);
32196 }
32197 function becomeIdle(self) {
32198 if (!self.idle) {
32199 self.idle = true;
32200 each(getPayload(self), (node) => {
32201 node.done = true;
32202 });
32203 callFluidObservers(self, {
32204 type: "idle",
32205 parent: self
32206 });
32207 }
32208 }
32209 globals.assign({
32210 createStringInterpolator,
32211 to: (source, args) => new Interpolation(source, args)
32212 });
32213 var update3 = frameLoop.advance;
32214
32215 // node_modules/@react-spring/web/dist/react-spring-web.esm.js
32216 var import_react_dom3 = __toESM(require_react_dom());
32217 function _objectWithoutPropertiesLoose2(source, excluded) {
32218 if (source == null) return {};
32219 var target = {};
32220 var sourceKeys = Object.keys(source);
32221 var key, i;
32222 for (i = 0; i < sourceKeys.length; i++) {
32223 key = sourceKeys[i];
32224 if (excluded.indexOf(key) >= 0) continue;
32225 target[key] = source[key];
32226 }
32227 return target;
32228 }
32229 var _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"];
32230 var isCustomPropRE = /^--/;
32231 function dangerousStyleValue(name, value) {
32232 if (value == null || typeof value === "boolean" || value === "") return "";
32233 if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + "px";
32234 return ("" + value).trim();
32235 }
32236 var attributeCache = {};
32237 function applyAnimatedValues(instance, props) {
32238 if (!instance.nodeType || !instance.setAttribute) {
32239 return false;
32240 }
32241 const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter";
32242 const _ref = props, {
32243 style,
32244 children,
32245 scrollTop,
32246 scrollLeft
32247 } = _ref, attributes = _objectWithoutPropertiesLoose2(_ref, _excluded$2);
32248 const values = Object.values(attributes);
32249 const names = Object.keys(attributes).map((name) => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, (n) => "-" + n.toLowerCase())));
32250 if (children !== void 0) {
32251 instance.textContent = children;
32252 }
32253 for (let name in style) {
32254 if (style.hasOwnProperty(name)) {
32255 const value = dangerousStyleValue(name, style[name]);
32256 if (isCustomPropRE.test(name)) {
32257 instance.style.setProperty(name, value);
32258 } else {
32259 instance.style[name] = value;
32260 }
32261 }
32262 }
32263 names.forEach((name, i) => {
32264 instance.setAttribute(name, values[i]);
32265 });
32266 if (scrollTop !== void 0) {
32267 instance.scrollTop = scrollTop;
32268 }
32269 if (scrollLeft !== void 0) {
32270 instance.scrollLeft = scrollLeft;
32271 }
32272 }
32273 var isUnitlessNumber = {
32274 animationIterationCount: true,
32275 borderImageOutset: true,
32276 borderImageSlice: true,
32277 borderImageWidth: true,
32278 boxFlex: true,
32279 boxFlexGroup: true,
32280 boxOrdinalGroup: true,
32281 columnCount: true,
32282 columns: true,
32283 flex: true,
32284 flexGrow: true,
32285 flexPositive: true,
32286 flexShrink: true,
32287 flexNegative: true,
32288 flexOrder: true,
32289 gridRow: true,
32290 gridRowEnd: true,
32291 gridRowSpan: true,
32292 gridRowStart: true,
32293 gridColumn: true,
32294 gridColumnEnd: true,
32295 gridColumnSpan: true,
32296 gridColumnStart: true,
32297 fontWeight: true,
32298 lineClamp: true,
32299 lineHeight: true,
32300 opacity: true,
32301 order: true,
32302 orphans: true,
32303 tabSize: true,
32304 widows: true,
32305 zIndex: true,
32306 zoom: true,
32307 fillOpacity: true,
32308 floodOpacity: true,
32309 stopOpacity: true,
32310 strokeDasharray: true,
32311 strokeDashoffset: true,
32312 strokeMiterlimit: true,
32313 strokeOpacity: true,
32314 strokeWidth: true
32315 };
32316 var prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
32317 var prefixes = ["Webkit", "Ms", "Moz", "O"];
32318 isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
32319 prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]);
32320 return acc;
32321 }, isUnitlessNumber);
32322 var _excluded$1 = ["x", "y", "z"];
32323 var domTransforms = /^(matrix|translate|scale|rotate|skew)/;
32324 var pxTransforms = /^(translate)/;
32325 var degTransforms = /^(rotate|skew)/;
32326 var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value;
32327 var isValueIdentity = (value, id) => is.arr(value) ? value.every((v2) => isValueIdentity(v2, id)) : is.num(value) ? value === id : parseFloat(value) === id;
32328 var AnimatedStyle = class extends AnimatedObject {
32329 constructor(_ref) {
32330 let {
32331 x: x2,
32332 y: y2,
32333 z
32334 } = _ref, style = _objectWithoutPropertiesLoose2(_ref, _excluded$1);
32335 const inputs = [];
32336 const transforms = [];
32337 if (x2 || y2 || z) {
32338 inputs.push([x2 || 0, y2 || 0, z || 0]);
32339 transforms.push((xyz) => [`translate3d(${xyz.map((v2) => addUnit(v2, "px")).join(",")})`, isValueIdentity(xyz, 0)]);
32340 }
32341 eachProp(style, (value, key) => {
32342 if (key === "transform") {
32343 inputs.push([value || ""]);
32344 transforms.push((transform) => [transform, transform === ""]);
32345 } else if (domTransforms.test(key)) {
32346 delete style[key];
32347 if (is.und(value)) return;
32348 const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
32349 inputs.push(toArray(value));
32350 transforms.push(key === "rotate3d" ? ([x3, y3, z2, deg]) => [`rotate3d(${x3},${y3},${z2},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`${key}(${input.map((v2) => addUnit(v2, unit)).join(",")})`, isValueIdentity(input, key.startsWith("scale") ? 1 : 0)]);
32351 }
32352 });
32353 if (inputs.length) {
32354 style.transform = new FluidTransform(inputs, transforms);
32355 }
32356 super(style);
32357 }
32358 };
32359 var FluidTransform = class extends FluidValue {
32360 constructor(inputs, transforms) {
32361 super();
32362 this._value = null;
32363 this.inputs = inputs;
32364 this.transforms = transforms;
32365 }
32366 get() {
32367 return this._value || (this._value = this._get());
32368 }
32369 _get() {
32370 let transform = "";
32371 let identity = true;
32372 each(this.inputs, (input, i) => {
32373 const arg1 = getFluidValue(input[0]);
32374 const [t, id] = this.transforms[i](is.arr(arg1) ? arg1 : input.map(getFluidValue));
32375 transform += " " + t;
32376 identity = identity && id;
32377 });
32378 return identity ? "none" : transform;
32379 }
32380 observerAdded(count) {
32381 if (count == 1) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && addFluidObserver(value, this)));
32382 }
32383 observerRemoved(count) {
32384 if (count == 0) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && removeFluidObserver(value, this)));
32385 }
32386 eventObserved(event) {
32387 if (event.type == "change") {
32388 this._value = null;
32389 }
32390 callFluidObservers(this, event);
32391 }
32392 };
32393 var primitives = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
32394 var _excluded = ["scrollTop", "scrollLeft"];
32395 globals.assign({
32396 batchedUpdates: import_react_dom3.unstable_batchedUpdates,
32397 createStringInterpolator,
32398 colors
32399 });
32400 var host = createHost(primitives, {
32401 applyAnimatedValues,
32402 createAnimatedStyle: (style) => new AnimatedStyle(style),
32403 getComponentProps: (_ref) => {
32404 let props = _objectWithoutPropertiesLoose2(_ref, _excluded);
32405 return props;
32406 }
32407 });
32408 var animated = host.animated;
32409
32410 // packages/fields/build-module/components/media-edit/use-moving-animation.mjs
32411 var import_element103 = __toESM(require_element(), 1);
32412 function getAbsolutePosition(element) {
32413 return {
32414 top: element.offsetTop,
32415 left: element.offsetLeft
32416 };
32417 }
32418 function useMovingAnimation(triggerAnimationOnChange) {
32419 const ref = (0, import_element103.useRef)(null);
32420 const previousRef = (0, import_element103.useRef)(void 0);
32421 if (ref.current) {
32422 previousRef.current = getAbsolutePosition(ref.current);
32423 }
32424 (0, import_element103.useLayoutEffect)(() => {
32425 const previous = previousRef.current;
32426 if (!previous || !ref.current) {
32427 return;
32428 }
32429 if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
32430 return;
32431 }
32432 const controller = new Controller({
32433 x: 0,
32434 y: 0,
32435 config: { mass: 5, tension: 2e3, friction: 200 },
32436 onChange({ value }) {
32437 if (!ref.current) {
32438 return;
32439 }
32440 let { x: x22, y: y22 } = value;
32441 x22 = Math.round(x22);
32442 y22 = Math.round(y22);
32443 const finishedMoving = x22 === 0 && y22 === 0;
32444 ref.current.style.transform = finishedMoving ? "" : `translate3d(${x22}px,${y22}px,0)`;
32445 }
32446 });
32447 ref.current.style.transform = "";
32448 const destination = getAbsolutePosition(ref.current);
32449 const x2 = Math.round(previous.left - destination.left);
32450 const y2 = Math.round(previous.top - destination.top);
32451 controller.start({ x: 0, y: 0, from: { x: x2, y: y2 } });
32452 return () => {
32453 controller.stop();
32454 controller.set({ x: 0, y: 0 });
32455 };
32456 }, [triggerAnimationOnChange]);
32457 return ref;
32458 }
32459
32460 // packages/fields/build-module/components/media-edit/index.mjs
32461 var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1);
32462 var { MediaUploadModal } = unlock3(import_media_utils.privateApis);
32463 function AnimatedMediaItem({
32464 children,
32465 index: index2,
32466 className
32467 }) {
32468 const ref = useMovingAnimation(index2);
32469 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { ref, className, children });
32470 }
32471 function normalizeValue(value) {
32472 if (Array.isArray(value)) {
32473 return value;
32474 }
32475 return value ? [value] : [];
32476 }
32477 function ConditionalMediaUpload({ render: render4, multiple, ...props }) {
32478 const [isModalOpen, setIsModalOpen] = (0, import_element104.useState)(false);
32479 if (window.__experimentalDataViewsMediaModal) {
32480 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
32481 render4 && render4({ open: () => setIsModalOpen(true) }),
32482 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32483 MediaUploadModal,
32484 {
32485 ...props,
32486 multiple: !!multiple,
32487 isOpen: isModalOpen,
32488 onClose: () => {
32489 setIsModalOpen(false);
32490 props.onClose?.();
32491 },
32492 onSelect: (media) => {
32493 setIsModalOpen(false);
32494 props.onSelect?.(media);
32495 }
32496 }
32497 )
32498 ] });
32499 }
32500 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_media_utils.MediaUpload, { ...props, render: render4, multiple });
32501 }
32502 var FilteredMediaUpload = (0, import_components29.withFilters)("editor.MediaUpload")(
32503 ConditionalMediaUpload
32504 );
32505 function MediaPickerButton({
32506 open: open3,
32507 children,
32508 label,
32509 showTooltip = false,
32510 onFilesDrop,
32511 attachment,
32512 isUploading = false
32513 }) {
32514 const isBlob = attachment && (0, import_blob.isBlobURL)(attachment.source_url);
32515 const mediaPickerButton = /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
32516 "div",
32517 {
32518 className: clsx_default("fields__media-edit-picker-button", {
32519 "has-attachment": attachment
32520 }),
32521 role: "button",
32522 tabIndex: 0,
32523 onClick: () => {
32524 if (!isUploading) {
32525 open3();
32526 }
32527 },
32528 onKeyDown: (event) => {
32529 if (isUploading) {
32530 return;
32531 }
32532 if (event.key === "Enter" || event.key === " ") {
32533 event.preventDefault();
32534 open3();
32535 }
32536 },
32537 "aria-label": label,
32538 "aria-disabled": isUploading,
32539 children: [
32540 children,
32541 isBlob && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "fields__media-edit-picker-button-spinner", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.Spinner, {}) }),
32542 !isUploading && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32543 import_components29.DropZone,
32544 {
32545 onFilesDrop: (files) => onFilesDrop(files, attachment?.id)
32546 }
32547 )
32548 ]
32549 }
32550 );
32551 if (!showTooltip) {
32552 return mediaPickerButton;
32553 }
32554 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(tooltip_exports.Root, { children: [
32555 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(tooltip_exports.Trigger, { render: mediaPickerButton }),
32556 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(tooltip_exports.Popup, { children: label })
32557 ] });
32558 }
32559 var archiveMimeTypes = [
32560 "application/zip",
32561 "application/x-zip-compressed",
32562 "application/x-rar-compressed",
32563 "application/x-7z-compressed",
32564 "application/x-tar",
32565 "application/x-gzip"
32566 ];
32567 function MediaTitle({ attachment }) {
32568 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.__experimentalTruncate, { className: "fields__media-edit-filename", children: (0, import_html_entities.decodeEntities)(attachment.title.rendered) });
32569 }
32570 function MediaEditPlaceholder(props) {
32571 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MediaPickerButton, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "fields__media-edit-placeholder", children: props.label }) });
32572 }
32573 function MoveButtons({
32574 itemId,
32575 index: index2,
32576 totalItems,
32577 isUploading,
32578 moveItem,
32579 orientation = "vertical"
32580 }) {
32581 const isHorizontal = orientation === "horizontal";
32582 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
32583 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32584 import_components29.Button,
32585 {
32586 __next40pxDefaultSize: true,
32587 icon: isHorizontal ? chevron_left_default : chevron_up_default,
32588 label: isHorizontal ? (0, import_i18n32.__)("Move left") : (0, import_i18n32.__)("Move up"),
32589 size: "small",
32590 disabled: isUploading || index2 === 0,
32591 accessibleWhenDisabled: true,
32592 tooltipPosition: "top",
32593 onClick: (event) => {
32594 event.stopPropagation();
32595 moveItem(itemId, "up");
32596 }
32597 }
32598 ),
32599 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32600 import_components29.Button,
32601 {
32602 __next40pxDefaultSize: true,
32603 icon: isHorizontal ? chevron_right_default : chevron_down_default,
32604 label: isHorizontal ? (0, import_i18n32.__)("Move right") : (0, import_i18n32.__)("Move down"),
32605 size: "small",
32606 disabled: isUploading || index2 === totalItems - 1,
32607 accessibleWhenDisabled: true,
32608 tooltipPosition: "top",
32609 onClick: (event) => {
32610 event.stopPropagation();
32611 moveItem(itemId, "down");
32612 }
32613 }
32614 )
32615 ] });
32616 }
32617 function MediaPreview({ attachment }) {
32618 const url = attachment.source_url;
32619 const mimeType = attachment.mime_type || "";
32620 if (mimeType.startsWith("image")) {
32621 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32622 "img",
32623 {
32624 className: "fields__media-edit-thumbnail",
32625 alt: attachment.alt_text || "",
32626 src: url
32627 }
32628 );
32629 } else if (mimeType.startsWith("audio")) {
32630 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.Icon, { icon: audio_default });
32631 } else if (mimeType.startsWith("video")) {
32632 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.Icon, { icon: video_default });
32633 } else if (archiveMimeTypes.includes(mimeType)) {
32634 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.Icon, { icon: archive_default });
32635 }
32636 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.Icon, { icon: file_default });
32637 }
32638 function ExpandedMediaEditAttachments({
32639 allItems,
32640 addButtonLabel,
32641 multiple,
32642 removeItem,
32643 moveItem,
32644 open: open3,
32645 onFilesDrop,
32646 isUploading,
32647 setTargetItemId
32648 }) {
32649 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
32650 "div",
32651 {
32652 className: clsx_default("fields__media-edit-expanded", {
32653 "is-multiple": multiple,
32654 "is-single": !multiple,
32655 "is-empty": !allItems?.length
32656 }),
32657 children: [
32658 allItems?.map((attachment, index2) => {
32659 const hasPreviewImage = attachment.mime_type?.startsWith("image");
32660 const isBlob = (0, import_blob.isBlobURL)(attachment.source_url);
32661 const attachmentNumericId = attachment.id;
32662 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
32663 AnimatedMediaItem,
32664 {
32665 index: index2,
32666 className: clsx_default("fields__media-edit-expanded-item", {
32667 "has-preview-image": hasPreviewImage
32668 }),
32669 children: [
32670 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32671 MediaPickerButton,
32672 {
32673 open: () => {
32674 setTargetItemId(attachmentNumericId);
32675 open3();
32676 },
32677 label: !isBlob ? (0, import_i18n32.sprintf)(
32678 /* translators: %s: The title of the media item. */
32679 (0, import_i18n32.__)("Replace %s"),
32680 (0, import_html_entities.decodeEntities)(
32681 attachment.title.rendered
32682 )
32683 ) : (0, import_i18n32.__)("Replace"),
32684 showTooltip: true,
32685 onFilesDrop,
32686 attachment,
32687 isUploading,
32688 children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "fields__media-edit-expanded-preview", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32689 import_components29.__experimentalVStack,
32690 {
32691 spacing: 0,
32692 alignment: "center",
32693 justify: "center",
32694 className: "fields__media-edit-expanded-preview-stack",
32695 children: (!isBlob || hasPreviewImage) && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32696 MediaPreview,
32697 {
32698 attachment
32699 }
32700 )
32701 }
32702 ) })
32703 }
32704 ),
32705 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
32706 import_components29.__experimentalHStack,
32707 {
32708 className: "fields__media-edit-expanded-actions",
32709 spacing: 0,
32710 alignment: "flex-end",
32711 expanded: false,
32712 children: [
32713 multiple && allItems.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32714 MoveButtons,
32715 {
32716 itemId: attachmentNumericId,
32717 index: index2,
32718 totalItems: allItems.length,
32719 isUploading,
32720 moveItem,
32721 orientation: "horizontal"
32722 }
32723 ),
32724 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32725 import_components29.Button,
32726 {
32727 __next40pxDefaultSize: true,
32728 icon: close_small_default,
32729 label: (0, import_i18n32.__)("Remove"),
32730 size: "small",
32731 disabled: isUploading,
32732 accessibleWhenDisabled: true,
32733 tooltipPosition: "top",
32734 onClick: (event) => {
32735 event.stopPropagation();
32736 removeItem(attachmentNumericId);
32737 }
32738 }
32739 )
32740 ]
32741 }
32742 ) })
32743 ]
32744 },
32745 attachment.id
32746 );
32747 }),
32748 (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32749 MediaEditPlaceholder,
32750 {
32751 open: () => {
32752 setTargetItemId(void 0);
32753 open3();
32754 },
32755 label: addButtonLabel,
32756 onFilesDrop,
32757 isUploading
32758 }
32759 )
32760 ]
32761 }
32762 );
32763 }
32764 function CompactMediaEditAttachments({
32765 allItems,
32766 addButtonLabel,
32767 multiple,
32768 removeItem,
32769 moveItem,
32770 open: open3,
32771 onFilesDrop,
32772 isUploading,
32773 setTargetItemId
32774 }) {
32775 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
32776 !!allItems?.length && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32777 "div",
32778 {
32779 className: clsx_default("fields__media-edit-compact-group", {
32780 "is-single": allItems.length === 1
32781 }),
32782 children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.__experimentalVStack, { spacing: 0, children: allItems.map((attachment, index2) => {
32783 const isBlob = (0, import_blob.isBlobURL)(attachment.source_url);
32784 const showMoveButtons = multiple && allItems.length > 1;
32785 const attachmentNumericId = attachment.id;
32786 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
32787 AnimatedMediaItem,
32788 {
32789 index: index2,
32790 className: "fields__media-edit-compact",
32791 children: [
32792 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32793 MediaPickerButton,
32794 {
32795 open: () => {
32796 setTargetItemId(
32797 attachmentNumericId
32798 );
32799 open3();
32800 },
32801 label: (0, import_i18n32.__)("Replace"),
32802 showTooltip: true,
32803 onFilesDrop,
32804 attachment,
32805 isUploading,
32806 children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
32807 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32808 MediaPreview,
32809 {
32810 attachment
32811 }
32812 ),
32813 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32814 MediaTitle,
32815 {
32816 attachment
32817 }
32818 )
32819 ] })
32820 }
32821 ),
32822 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
32823 import_components29.__experimentalHStack,
32824 {
32825 className: "fields__media-edit-compact-movers",
32826 spacing: 0,
32827 alignment: "flex-end",
32828 expanded: false,
32829 children: [
32830 showMoveButtons && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32831 MoveButtons,
32832 {
32833 itemId: attachmentNumericId,
32834 index: index2,
32835 totalItems: allItems.length,
32836 isUploading,
32837 moveItem,
32838 orientation: "vertical"
32839 }
32840 ),
32841 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32842 import_components29.Button,
32843 {
32844 __next40pxDefaultSize: true,
32845 icon: close_small_default,
32846 label: (0, import_i18n32.__)("Remove"),
32847 size: "small",
32848 disabled: isUploading,
32849 accessibleWhenDisabled: true,
32850 tooltipPosition: "top",
32851 onClick: (event) => {
32852 event.stopPropagation();
32853 removeItem(
32854 attachmentNumericId
32855 );
32856 }
32857 }
32858 )
32859 ]
32860 }
32861 )
32862 ]
32863 },
32864 attachment.id
32865 );
32866 }) })
32867 }
32868 ),
32869 (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
32870 MediaEditPlaceholder,
32871 {
32872 open: () => {
32873 setTargetItemId(void 0);
32874 open3();
32875 },
32876 label: addButtonLabel,
32877 onFilesDrop,
32878 isUploading
32879 }
32880 )
32881 ] });
32882 }
32883 function MediaEdit(props) {
32884 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(MediaEditControl, { ...props });
32885 }
32886 function MediaEditControl({
32887 data,
32888 field,
32889 onChange,
32890 hideLabelFromVision,
32891 allowedTypes = ["image"],
32892 multiple,
32893 isExpanded,
32894 validity,
32895 isPickerFiltered,
32896 featuredImageFlow,
32897 pickerTitle
32898 }) {
32899 const MediaUploadComponent = isPickerFiltered ? FilteredMediaUpload : ConditionalMediaUpload;
32900 const value = field.getValue({ item: data });
32901 const canUpload = (0, import_data4.useSelect)(
32902 (select2) => select2(import_core_data2.store).canUser("create", {
32903 kind: "postType",
32904 name: "attachment"
32905 }) ?? true,
32906 []
32907 );
32908 const [isTouched, setIsTouched] = (0, import_element104.useState)(false);
32909 const validityTargetRef = (0, import_element104.useRef)(null);
32910 const [customValidity, setCustomValidity] = (0, import_element104.useState)(void 0);
32911 (0, import_element104.useEffect)(() => {
32912 const validityTarget = validityTargetRef.current;
32913 const handler = () => {
32914 setIsTouched(true);
32915 };
32916 validityTarget?.addEventListener("invalid", handler);
32917 return () => validityTarget?.removeEventListener("invalid", handler);
32918 }, []);
32919 const attachments = (0, import_data4.useSelect)(
32920 (select2) => {
32921 if (!value) {
32922 return null;
32923 }
32924 const normalizedValue = normalizeValue(value);
32925 const sortedIds = normalizedValue.toSorted((a, b) => a - b);
32926 const { getEntityRecords } = select2(import_core_data2.store);
32927 return getEntityRecords("postType", "attachment", {
32928 include: sortedIds
32929 });
32930 },
32931 [value]
32932 );
32933 const stableAttachmentsRef = (0, import_element104.useRef)(
32934 null
32935 );
32936 if (attachments !== null) {
32937 stableAttachmentsRef.current = attachments;
32938 }
32939 let stableAttachments = attachments;
32940 if (attachments === null && stableAttachmentsRef.current && value) {
32941 const stableIds = new Set(
32942 stableAttachmentsRef.current.map((a) => a.id)
32943 );
32944 if (normalizeValue(value).every((id) => stableIds.has(id))) {
32945 stableAttachments = stableAttachmentsRef.current;
32946 }
32947 }
32948 const orderedAttachments = (0, import_element104.useMemo)(() => {
32949 if (!stableAttachments) {
32950 return null;
32951 }
32952 const normalizedValue = normalizeValue(value);
32953 const attachmentMap = new Map(
32954 stableAttachments.map((a) => [a.id, a])
32955 );
32956 return normalizedValue.map((id) => attachmentMap.get(id)).filter((a) => a !== void 0);
32957 }, [stableAttachments, value]);
32958 const { createErrorNotice } = (0, import_data4.useDispatch)(import_notices.store);
32959 const { receiveEntityRecords } = (0, import_data4.useDispatch)(import_core_data2.store);
32960 const [targetItemId, setTargetItemId] = (0, import_element104.useState)();
32961 const openModalRef = (0, import_element104.useRef)(void 0);
32962 const [pendingOpen, setPendingOpen] = (0, import_element104.useState)(false);
32963 const [blobs, setBlobs] = (0, import_element104.useState)([]);
32964 (0, import_element104.useEffect)(() => {
32965 if (pendingOpen) {
32966 setPendingOpen(false);
32967 openModalRef.current?.();
32968 }
32969 }, [pendingOpen]);
32970 const onChangeControl = (0, import_element104.useCallback)(
32971 (newValue) => onChange(field.setValue({ item: data, value: newValue })),
32972 [data, field, onChange]
32973 );
32974 const removeItem = (0, import_element104.useCallback)(
32975 (itemId) => {
32976 const currentIds = normalizeValue(value);
32977 const newIds = currentIds.filter((id) => id !== itemId);
32978 setIsTouched(true);
32979 onChangeControl(newIds.length ? newIds : void 0);
32980 },
32981 [value, onChangeControl]
32982 );
32983 const moveItem = (0, import_element104.useCallback)(
32984 (itemId, direction) => {
32985 if (!orderedAttachments) {
32986 return;
32987 }
32988 const currentIds = orderedAttachments.map((a) => a.id);
32989 const index2 = currentIds.indexOf(itemId);
32990 const newIndex = direction === "up" ? index2 - 1 : index2 + 1;
32991 [currentIds[index2], currentIds[newIndex]] = [
32992 currentIds[newIndex],
32993 currentIds[index2]
32994 ];
32995 onChangeControl(currentIds);
32996 },
32997 [orderedAttachments, onChangeControl]
32998 );
32999 const onFilesDrop = (0, import_element104.useCallback)(
33000 (files, _targetItemId) => {
33001 setTargetItemId(_targetItemId);
33002 (0, import_media_utils.uploadMedia)({
33003 allowedTypes: allowedTypes?.length ? allowedTypes : void 0,
33004 filesList: files,
33005 onFileChange(uploadedMedia) {
33006 const blobUrls = uploadedMedia.filter((item) => (0, import_blob.isBlobURL)(item.url)).map((item) => item.url);
33007 setBlobs(blobUrls);
33008 if (!!blobUrls.length) {
33009 return;
33010 }
33011 receiveEntityRecords(
33012 "postType",
33013 "attachment",
33014 [],
33015 void 0,
33016 true
33017 );
33018 const uploadedIds = uploadedMedia.map(
33019 (item) => item.id
33020 );
33021 if (!multiple) {
33022 onChangeControl(uploadedIds[0]);
33023 setTargetItemId(void 0);
33024 return;
33025 }
33026 const currentValue = normalizeValue(value);
33027 if (_targetItemId === void 0) {
33028 onChangeControl([...currentValue, ...uploadedIds]);
33029 } else {
33030 const newValue = [...currentValue];
33031 newValue.splice(
33032 currentValue.indexOf(_targetItemId),
33033 1,
33034 ...uploadedIds
33035 );
33036 onChangeControl(newValue);
33037 }
33038 setTargetItemId(void 0);
33039 },
33040 onError(error2) {
33041 setTargetItemId(void 0);
33042 setBlobs([]);
33043 createErrorNotice(error2.message, { type: "snackbar" });
33044 },
33045 multiple: !!multiple
33046 });
33047 },
33048 [
33049 allowedTypes,
33050 value,
33051 multiple,
33052 createErrorNotice,
33053 onChangeControl,
33054 receiveEntityRecords
33055 ]
33056 );
33057 const addButtonLabel = field.placeholder || (multiple ? (0, import_i18n32.__)("Choose files") : (0, import_i18n32.__)("Choose file"));
33058 const allItems = (0, import_element104.useMemo)(() => {
33059 if (!blobs.length) {
33060 return orderedAttachments;
33061 }
33062 const items = [
33063 ...orderedAttachments || []
33064 ];
33065 const blobItems = blobs.map((url) => ({
33066 id: url,
33067 source_url: url,
33068 mime_type: (0, import_blob.getBlobTypeByURL)(url)
33069 }));
33070 if (targetItemId !== void 0) {
33071 const targetIndex = items.findIndex(
33072 (a) => a.id === targetItemId
33073 );
33074 items.splice(targetIndex, 1, ...blobItems);
33075 } else {
33076 items.push(...blobItems);
33077 }
33078 return items;
33079 }, [orderedAttachments, targetItemId, blobs]);
33080 (0, import_element104.useEffect)(() => {
33081 if (!isTouched) {
33082 return;
33083 }
33084 const input = validityTargetRef.current;
33085 if (!input) {
33086 return;
33087 }
33088 if (validity) {
33089 const customValidityResult = validity?.custom;
33090 setCustomValidity(customValidityResult);
33091 if (customValidityResult?.type === "invalid") {
33092 input.setCustomValidity(
33093 customValidityResult.message || (0, import_i18n32.__)("Invalid")
33094 );
33095 } else {
33096 input.setCustomValidity("");
33097 }
33098 } else {
33099 input.setCustomValidity("");
33100 setCustomValidity(void 0);
33101 }
33102 }, [isTouched, field.isValid, validity]);
33103 (0, import_element104.useEffect)(() => {
33104 if (isTouched && customValidity?.message) {
33105 speak6(customValidity.message);
33106 }
33107 }, [isTouched, customValidity?.message]);
33108 const onBlur = (0, import_element104.useCallback)(
33109 (event) => {
33110 if (isTouched) {
33111 return;
33112 }
33113 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
33114 setIsTouched(true);
33115 }
33116 },
33117 [isTouched]
33118 );
33119 if (!canUpload) {
33120 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_components29.__experimentalText, { children: (0, import_i18n32.sprintf)(
33121 /* translators: %s: The field label. */
33122 (0, import_i18n32.__)(
33123 "%s: To edit this field, you need permission to upload media."
33124 ),
33125 field.label
33126 ) }) });
33127 }
33128 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(Stack, { direction: "column", gap: "sm", onBlur, children: [
33129 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
33130 MediaUploadComponent,
33131 {
33132 title: pickerTitle ?? field.label,
33133 featuredImageFlow,
33134 unstableFeaturedImageFlow: featuredImageFlow,
33135 onSelect: (selectedMedia) => {
33136 if (!multiple) {
33137 onChangeControl(selectedMedia.id);
33138 setTargetItemId(void 0);
33139 return;
33140 }
33141 const newIds = Array.isArray(selectedMedia) ? selectedMedia.map((m2) => m2.id) : [selectedMedia.id];
33142 const currentValue = normalizeValue(value);
33143 if (!currentValue.length) {
33144 onChangeControl(newIds);
33145 } else if (targetItemId === void 0) {
33146 const existingItems = currentValue.filter(
33147 (id) => newIds.includes(id)
33148 );
33149 const newItems = newIds.filter(
33150 (id) => !currentValue.includes(id)
33151 );
33152 onChangeControl([
33153 ...existingItems,
33154 ...newItems
33155 ]);
33156 } else if (selectedMedia.id !== targetItemId) {
33157 const filtered = currentValue.filter(
33158 (id) => id !== selectedMedia.id
33159 );
33160 onChangeControl(
33161 filtered.map(
33162 (id) => id === targetItemId ? selectedMedia.id : id
33163 )
33164 );
33165 }
33166 setTargetItemId(void 0);
33167 },
33168 onClose: () => setTargetItemId(void 0),
33169 allowedTypes,
33170 value: targetItemId !== void 0 ? targetItemId : value,
33171 multiple: multiple && targetItemId === void 0 ? "add" : false,
33172 render: ({ open: open3 }) => {
33173 openModalRef.current = open3;
33174 const AttachmentsComponent = isExpanded ? ExpandedMediaEditAttachments : CompactMediaEditAttachments;
33175 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_components29.__experimentalVStack, { spacing: 2, children: [
33176 field.label && (hideLabelFromVision ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("legend", {}), children: field.label }) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
33177 import_components29.BaseControl.VisualLabel,
33178 {
33179 as: "legend",
33180 style: { marginBottom: 0 },
33181 children: field.label
33182 }
33183 )),
33184 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
33185 AttachmentsComponent,
33186 {
33187 allItems,
33188 addButtonLabel,
33189 multiple,
33190 removeItem,
33191 moveItem,
33192 open: () => setPendingOpen(true),
33193 onFilesDrop,
33194 isUploading: !!blobs.length,
33195 setTargetItemId
33196 }
33197 ),
33198 field.description && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
33199 import_components29.__experimentalText,
33200 {
33201 variant: "muted",
33202 className: "fields__media-edit-description",
33203 children: field.description
33204 }
33205 )
33206 ] });
33207 }
33208 }
33209 ) }),
33210 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
33211 "input",
33212 {
33213 type: "text",
33214 ref: validityTargetRef,
33215 value: value ?? "",
33216 tabIndex: -1,
33217 "aria-hidden": "true",
33218 onChange: () => {
33219 }
33220 }
33221 ) }),
33222 customValidity && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
33223 ValidityIndicator,
33224 {
33225 type: customValidity.type,
33226 message: customValidity.message
33227 }
33228 )
33229 ] });
33230 }
33231
33232 // routes/identity/stage.tsx
33233 var import_element105 = __toESM(require_element());
33234 var import_html_entities2 = __toESM(require_html_entities());
33235 import { loadEditorAssets } from "@wordpress/lazy-editor";
33236
33237 // packages/style-runtime/src/index.ts
33238 var STYLE_HASH_ATTRIBUTE35 = "data-wp-hash";
33239 function getRuntime35() {
33240 const globalScope = globalThis;
33241 if (globalScope.__wpStyleRuntime) {
33242 return globalScope.__wpStyleRuntime;
33243 }
33244 globalScope.__wpStyleRuntime = {
33245 documents: /* @__PURE__ */ new Map(),
33246 styles: /* @__PURE__ */ new Map(),
33247 injectedStyles: /* @__PURE__ */ new WeakMap()
33248 };
33249 if (typeof document !== "undefined") {
33250 registerDocument35(document);
33251 }
33252 return globalScope.__wpStyleRuntime;
33253 }
33254 function documentContainsStyleHash35(targetDocument, hash) {
33255 if (!targetDocument.head) {
33256 return false;
33257 }
33258 for (const style of targetDocument.head.querySelectorAll(
33259 `style[${STYLE_HASH_ATTRIBUTE35}]`
33260 )) {
33261 if (style.getAttribute(STYLE_HASH_ATTRIBUTE35) === hash) {
33262 return true;
33263 }
33264 }
33265 return false;
33266 }
33267 function injectStyle35(targetDocument, hash, css) {
33268 if (!targetDocument.head) {
33269 return;
33270 }
33271 const runtime = getRuntime35();
33272 let injectedStyles = runtime.injectedStyles.get(targetDocument);
33273 if (!injectedStyles) {
33274 injectedStyles = /* @__PURE__ */ new Set();
33275 runtime.injectedStyles.set(targetDocument, injectedStyles);
33276 }
33277 if (injectedStyles.has(hash)) {
33278 return;
33279 }
33280 if (documentContainsStyleHash35(targetDocument, hash)) {
33281 injectedStyles.add(hash);
33282 return;
33283 }
33284 const style = targetDocument.createElement("style");
33285 style.setAttribute(STYLE_HASH_ATTRIBUTE35, hash);
33286 style.appendChild(targetDocument.createTextNode(css));
33287 targetDocument.head.appendChild(style);
33288 injectedStyles.add(hash);
33289 }
33290 function registerDocument35(targetDocument) {
33291 const runtime = getRuntime35();
33292 runtime.documents.set(
33293 targetDocument,
33294 (runtime.documents.get(targetDocument) ?? 0) + 1
33295 );
33296 for (const [hash, css] of runtime.styles) {
33297 injectStyle35(targetDocument, hash, css);
33298 }
33299 return () => {
33300 const count = runtime.documents.get(targetDocument);
33301 if (count === void 0) {
33302 return;
33303 }
33304 if (count <= 1) {
33305 runtime.documents.delete(targetDocument);
33306 return;
33307 }
33308 runtime.documents.set(targetDocument, count - 1);
33309 };
33310 }
33311 function registerStyle35(hash, css) {
33312 const runtime = getRuntime35();
33313 runtime.styles.set(hash, css);
33314 for (const targetDocument of runtime.documents.keys()) {
33315 injectStyle35(targetDocument, hash, css);
33316 }
33317 }
33318
33319 // routes/identity/style.module.scss
33320 if (typeof process === "undefined" || true) {
33321 registerStyle35("95479f68d7", ".ec88ce3dd902eabd__form{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);flex-grow:1;min-height:0;overflow:auto;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}");
33322 }
33323 var style_module_default = { "form": "ec88ce3dd902eabd__form" };
33324
33325 // routes/identity/stage.tsx
33326 var import_jsx_runtime132 = __toESM(require_jsx_runtime());
33327 function MediaEditWithEditorAssets(props) {
33328 const [isReady, setIsReady] = (0, import_element105.useState)(
33329 () => !!window.wp?.media
33330 );
33331 (0, import_element105.useEffect)(() => {
33332 if (!isReady) {
33333 loadEditorAssets().then(() => setIsReady(true));
33334 }
33335 }, [isReady]);
33336 return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
33337 "div",
33338 {
33339 "aria-busy": !isReady || void 0,
33340 style: !isReady ? { opacity: 0.6 } : void 0,
33341 inert: !isReady ? "true" : void 0,
33342 children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(MediaEdit, { ...props })
33343 }
33344 );
33345 }
33346 var fields = [
33347 {
33348 id: "title",
33349 type: "text",
33350 label: (0, import_i18n33.__)("Site Title"),
33351 description: (0, import_i18n33.__)(
33352 "Displays in your site's layout via the Site Title block."
33353 ),
33354 getValue: ({ item }) => (0, import_html_entities2.decodeEntities)(item.title ?? "")
33355 },
33356 {
33357 id: "description",
33358 type: "text",
33359 label: (0, import_i18n33.__)("Site Tagline"),
33360 description: (0, import_i18n33.__)(
33361 "In a few words, explain what this site is about. Displays in your site's layout via the Site Tagline block."
33362 ),
33363 getValue: ({ item }) => (0, import_html_entities2.decodeEntities)(item.description ?? "")
33364 },
33365 {
33366 id: "site_logo",
33367 type: "media",
33368 label: (0, import_i18n33.__)("Site Logo"),
33369 description: (0, import_i18n33.__)(
33370 "Displays in your site's layout via the Site Logo block."
33371 ),
33372 placeholder: (0, import_i18n33.__)("Choose logo"),
33373 Edit: MediaEditWithEditorAssets,
33374 setValue: ({ value }) => ({
33375 site_logo: value ?? 0
33376 })
33377 },
33378 {
33379 id: "site_icon",
33380 type: "media",
33381 label: (0, import_i18n33.__)("Site Icon"),
33382 description: (0, import_i18n33.__)(
33383 "Shown in browser tabs, bookmarks, and mobile apps. It should be square and at least 512 by 512 pixels."
33384 ),
33385 placeholder: (0, import_i18n33.__)("Choose icon"),
33386 Edit: MediaEditWithEditorAssets,
33387 setValue: ({ value }) => ({
33388 site_icon: value ?? 0
33389 })
33390 }
33391 ];
33392 var VIEW_CONFIG_FIELDS = ["form"];
33393 function Identity() {
33394 const data = (0, import_data5.useSelect)(
33395 (select2) => select2(import_core_data3.store).getEditedEntityRecord(
33396 "root",
33397 "site",
33398 // The site entity is a singleton and has no record key.
33399 void 0
33400 ),
33401 []
33402 );
33403 const { editEntityRecord } = (0, import_data5.useDispatch)(import_core_data3.store);
33404 const { form } = useViewConfig({
33405 kind: "root",
33406 name: "site",
33407 fields: VIEW_CONFIG_FIELDS
33408 });
33409 const onChange = (edits) => {
33410 editEntityRecord("root", "site", void 0, edits);
33411 };
33412 if (!form) {
33413 return null;
33414 }
33415 return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(page_default, { title: (0, import_i18n33._x)("Identity", "site identity"), headingLevel: 2, children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: style_module_default.form, children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
33416 DataForm,
33417 {
33418 data,
33419 fields,
33420 form,
33421 onChange
33422 }
33423 ) }) });
33424 }
33425 var stage = Identity;
33426 export {
33427 stage
33428 };
33429 /*! Bundled license information:
33430
33431 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
33432 (**
33433 * @license React
33434 * use-sync-external-store-shim.development.js
33435 *
33436 * Copyright (c) Meta Platforms, Inc. and affiliates.
33437 *
33438 * This source code is licensed under the MIT license found in the
33439 * LICENSE file in the root directory of this source tree.
33440 *)
33441
33442 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
33443 (**
33444 * @license React
33445 * use-sync-external-store-shim/with-selector.development.js
33446 *
33447 * Copyright (c) Meta Platforms, Inc. and affiliates.
33448 *
33449 * This source code is licensed under the MIT license found in the
33450 * LICENSE file in the root directory of this source tree.
33451 *)
33452 */
33453