PluginProbe
Gutenberg / 22.9.0
Gutenberg v22.9.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 12.6.0 7.4.0 All 402 releases
gutenberg / build / scripts / commands / index.js

index.js in Gutenberg 22.9.0, at build/scripts/commands/index.js

4,093 lines 156.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var wp;
2 (wp ||= {}).commands = (() => {
3 var __create = Object.create;
4 var __defProp = Object.defineProperty;
5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6 var __getOwnPropNames = Object.getOwnPropertyNames;
7 var __getProtoOf = Object.getPrototypeOf;
8 var __hasOwnProp = Object.prototype.hasOwnProperty;
9 var __commonJS = (cb, mod) => function __require() {
10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11 };
12 var __export = (target, all) => {
13 for (var name in all)
14 __defProp(target, name, { get: all[name], enumerable: true });
15 };
16 var __copyProps = (to, from, except, desc) => {
17 if (from && typeof from === "object" || typeof from === "function") {
18 for (let key of __getOwnPropNames(from))
19 if (!__hasOwnProp.call(to, key) && key !== except)
20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21 }
22 return to;
23 };
24 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25 // If the importer is in node compatibility mode or this is not an ESM
26 // file that has been converted to a CommonJS file using a Babel-
27 // compatible transform (i.e. "__esModule" has not been set), then set
28 // "default" to the CommonJS "module.exports" for node compatibility.
29 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30 mod
31 ));
32 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
34 // vendor-external:react
35 var require_react = __commonJS({
36 "vendor-external:react"(exports, module) {
37 module.exports = window.React;
38 }
39 });
40
41 // vendor-external:react/jsx-runtime
42 var require_jsx_runtime = __commonJS({
43 "vendor-external:react/jsx-runtime"(exports, module) {
44 module.exports = window.ReactJSXRuntime;
45 }
46 });
47
48 // vendor-external:react-dom
49 var require_react_dom = __commonJS({
50 "vendor-external:react-dom"(exports, module) {
51 module.exports = window.ReactDOM;
52 }
53 });
54
55 // package-external:@wordpress/data
56 var require_data = __commonJS({
57 "package-external:@wordpress/data"(exports, module) {
58 module.exports = window.wp.data;
59 }
60 });
61
62 // package-external:@wordpress/element
63 var require_element = __commonJS({
64 "package-external:@wordpress/element"(exports, module) {
65 module.exports = window.wp.element;
66 }
67 });
68
69 // package-external:@wordpress/i18n
70 var require_i18n = __commonJS({
71 "package-external:@wordpress/i18n"(exports, module) {
72 module.exports = window.wp.i18n;
73 }
74 });
75
76 // package-external:@wordpress/components
77 var require_components = __commonJS({
78 "package-external:@wordpress/components"(exports, module) {
79 module.exports = window.wp.components;
80 }
81 });
82
83 // package-external:@wordpress/keyboard-shortcuts
84 var require_keyboard_shortcuts = __commonJS({
85 "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
86 module.exports = window.wp.keyboardShortcuts;
87 }
88 });
89
90 // package-external:@wordpress/primitives
91 var require_primitives = __commonJS({
92 "package-external:@wordpress/primitives"(exports, module) {
93 module.exports = window.wp.primitives;
94 }
95 });
96
97 // package-external:@wordpress/private-apis
98 var require_private_apis = __commonJS({
99 "package-external:@wordpress/private-apis"(exports, module) {
100 module.exports = window.wp.privateApis;
101 }
102 });
103
104 // package-external:@wordpress/preferences
105 var require_preferences = __commonJS({
106 "package-external:@wordpress/preferences"(exports, module) {
107 module.exports = window.wp.preferences;
108 }
109 });
110
111 // packages/commands/build-module/index.mjs
112 var index_exports = {};
113 __export(index_exports, {
114 CommandMenu: () => CommandMenu,
115 privateApis: () => privateApis,
116 store: () => store,
117 useCommand: () => useCommand,
118 useCommandLoader: () => useCommandLoader,
119 useCommands: () => useCommands
120 });
121
122 // node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
123 var U = 1;
124 var Y = 0.9;
125 var H = 0.8;
126 var J = 0.17;
127 var p = 0.1;
128 var u = 0.999;
129 var $ = 0.9999;
130 var k = 0.99;
131 var m = /[\\\/_+.#"@\[\(\{&]/;
132 var B = /[\\\/_+.#"@\[\(\{&]/g;
133 var K = /[\s-]/;
134 var X = /[\s-]/g;
135 function G(_, C, h, P2, A, f, O) {
136 if (f === C.length) return A === _.length ? U : k;
137 var T2 = `${A},${f}`;
138 if (O[T2] !== void 0) return O[T2];
139 for (var L2 = P2.charAt(f), c = h.indexOf(L2, A), S = 0, E, N2, R, M; c >= 0; ) E = G(_, C, h, P2, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K.test(_.charAt(c - 1)) ? (E *= Y, M = _.slice(A, c - 1).match(X), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P2.charAt(f + 1) || P2.charAt(f + 1) === P2.charAt(f) && h.charAt(c - 1) !== P2.charAt(f)) && (N2 = G(_, C, h, P2, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L2, c + 1);
140 return O[T2] = S, S;
141 }
142 function D(_) {
143 return _.toLowerCase().replace(X, " ");
144 }
145 function W(_, C, h) {
146 return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
147 }
148
149 // node_modules/@radix-ui/react-dialog/dist/index.mjs
150 var React37 = __toESM(require_react(), 1);
151
152 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.mjs
153 var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
154 function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
155 return function handleEvent(event) {
156 originalEventHandler?.(event);
157 if (checkForDefaultPrevented === false || !event.defaultPrevented) {
158 return ourEventHandler?.(event);
159 }
160 };
161 }
162
163 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
164 var React = __toESM(require_react(), 1);
165 function setRef(ref, value) {
166 if (typeof ref === "function") {
167 return ref(value);
168 } else if (ref !== null && ref !== void 0) {
169 ref.current = value;
170 }
171 }
172 function composeRefs(...refs) {
173 return (node) => {
174 let hasCleanup = false;
175 const cleanups = refs.map((ref) => {
176 const cleanup = setRef(ref, node);
177 if (!hasCleanup && typeof cleanup == "function") {
178 hasCleanup = true;
179 }
180 return cleanup;
181 });
182 if (hasCleanup) {
183 return () => {
184 for (let i = 0; i < cleanups.length; i++) {
185 const cleanup = cleanups[i];
186 if (typeof cleanup == "function") {
187 cleanup();
188 } else {
189 setRef(refs[i], null);
190 }
191 }
192 };
193 }
194 };
195 }
196 function useComposedRefs(...refs) {
197 return React.useCallback(composeRefs(...refs), refs);
198 }
199
200 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.mjs
201 var React2 = __toESM(require_react(), 1);
202 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
203 function createContext2(rootComponentName, defaultContext) {
204 const Context = React2.createContext(defaultContext);
205 const Provider = (props) => {
206 const { children, ...context2 } = props;
207 const value = React2.useMemo(() => context2, Object.values(context2));
208 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
209 };
210 Provider.displayName = rootComponentName + "Provider";
211 function useContext22(consumerName) {
212 const context2 = React2.useContext(Context);
213 if (context2) return context2;
214 if (defaultContext !== void 0) return defaultContext;
215 throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
216 }
217 return [Provider, useContext22];
218 }
219 function createContextScope(scopeName, createContextScopeDeps = []) {
220 let defaultContexts = [];
221 function createContext32(rootComponentName, defaultContext) {
222 const BaseContext = React2.createContext(defaultContext);
223 const index = defaultContexts.length;
224 defaultContexts = [...defaultContexts, defaultContext];
225 const Provider = (props) => {
226 const { scope, children, ...context2 } = props;
227 const Context = scope?.[scopeName]?.[index] || BaseContext;
228 const value = React2.useMemo(() => context2, Object.values(context2));
229 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
230 };
231 Provider.displayName = rootComponentName + "Provider";
232 function useContext22(consumerName, scope) {
233 const Context = scope?.[scopeName]?.[index] || BaseContext;
234 const context2 = React2.useContext(Context);
235 if (context2) return context2;
236 if (defaultContext !== void 0) return defaultContext;
237 throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
238 }
239 return [Provider, useContext22];
240 }
241 const createScope = () => {
242 const scopeContexts = defaultContexts.map((defaultContext) => {
243 return React2.createContext(defaultContext);
244 });
245 return function useScope(scope) {
246 const contexts = scope?.[scopeName] || scopeContexts;
247 return React2.useMemo(
248 () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
249 [scope, contexts]
250 );
251 };
252 };
253 createScope.scopeName = scopeName;
254 return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
255 }
256 function composeContextScopes(...scopes) {
257 const baseScope = scopes[0];
258 if (scopes.length === 1) return baseScope;
259 const createScope = () => {
260 const scopeHooks = scopes.map((createScope2) => ({
261 useScope: createScope2(),
262 scopeName: createScope2.scopeName
263 }));
264 return function useComposedScopes(overrideScopes) {
265 const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
266 const scopeProps = useScope(overrideScopes);
267 const currentScope = scopeProps[`__scope${scopeName}`];
268 return { ...nextScopes2, ...currentScope };
269 }, {});
270 return React2.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
271 };
272 };
273 createScope.scopeName = baseScope.scopeName;
274 return createScope;
275 }
276
277 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.mjs
278 var React4 = __toESM(require_react(), 1);
279
280 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
281 var React3 = __toESM(require_react(), 1);
282 var useLayoutEffect2 = globalThis?.document ? React3.useLayoutEffect : () => {
283 };
284
285 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.mjs
286 var useReactId = React4[" useId ".trim().toString()] || (() => void 0);
287 var count = 0;
288 function useId(deterministicId) {
289 const [id, setId] = React4.useState(useReactId());
290 useLayoutEffect2(() => {
291 if (!deterministicId) setId((reactId) => reactId ?? String(count++));
292 }, [deterministicId]);
293 return deterministicId || (id ? `radix-${id}` : "");
294 }
295
296 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
297 var React5 = __toESM(require_react(), 1);
298 var React22 = __toESM(require_react(), 1);
299 var useInsertionEffect = React5[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
300 function useControllableState({
301 prop,
302 defaultProp,
303 onChange = () => {
304 },
305 caller
306 }) {
307 const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
308 defaultProp,
309 onChange
310 });
311 const isControlled = prop !== void 0;
312 const value = isControlled ? prop : uncontrolledProp;
313 if (true) {
314 const isControlledRef = React5.useRef(prop !== void 0);
315 React5.useEffect(() => {
316 const wasControlled = isControlledRef.current;
317 if (wasControlled !== isControlled) {
318 const from = wasControlled ? "controlled" : "uncontrolled";
319 const to = isControlled ? "controlled" : "uncontrolled";
320 console.warn(
321 `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
322 );
323 }
324 isControlledRef.current = isControlled;
325 }, [isControlled, caller]);
326 }
327 const setValue = React5.useCallback(
328 (nextValue) => {
329 if (isControlled) {
330 const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
331 if (value2 !== prop) {
332 onChangeRef.current?.(value2);
333 }
334 } else {
335 setUncontrolledProp(nextValue);
336 }
337 },
338 [isControlled, prop, setUncontrolledProp, onChangeRef]
339 );
340 return [value, setValue];
341 }
342 function useUncontrolledState({
343 defaultProp,
344 onChange
345 }) {
346 const [value, setValue] = React5.useState(defaultProp);
347 const prevValueRef = React5.useRef(value);
348 const onChangeRef = React5.useRef(onChange);
349 useInsertionEffect(() => {
350 onChangeRef.current = onChange;
351 }, [onChange]);
352 React5.useEffect(() => {
353 if (prevValueRef.current !== value) {
354 onChangeRef.current?.(value);
355 prevValueRef.current = value;
356 }
357 }, [value, prevValueRef]);
358 return [value, setValue, onChangeRef];
359 }
360 function isFunction(value) {
361 return typeof value === "function";
362 }
363
364 // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
365 var React11 = __toESM(require_react(), 1);
366
367 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive/dist/index.mjs
368 var canUseDOM2 = !!(typeof window !== "undefined" && window.document && window.document.createElement);
369 function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
370 return function handleEvent(event) {
371 originalEventHandler?.(event);
372 if (checkForDefaultPrevented === false || !event.defaultPrevented) {
373 return ourEventHandler?.(event);
374 }
375 };
376 }
377
378 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs
379 var React8 = __toESM(require_react(), 1);
380 var ReactDOM = __toESM(require_react_dom(), 1);
381
382 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-slot/dist/index.mjs
383 var React7 = __toESM(require_react(), 1);
384
385 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
386 var React6 = __toESM(require_react(), 1);
387 function setRef2(ref, value) {
388 if (typeof ref === "function") {
389 return ref(value);
390 } else if (ref !== null && ref !== void 0) {
391 ref.current = value;
392 }
393 }
394 function composeRefs2(...refs) {
395 return (node) => {
396 let hasCleanup = false;
397 const cleanups = refs.map((ref) => {
398 const cleanup = setRef2(ref, node);
399 if (!hasCleanup && typeof cleanup == "function") {
400 hasCleanup = true;
401 }
402 return cleanup;
403 });
404 if (hasCleanup) {
405 return () => {
406 for (let i = 0; i < cleanups.length; i++) {
407 const cleanup = cleanups[i];
408 if (typeof cleanup == "function") {
409 cleanup();
410 } else {
411 setRef2(refs[i], null);
412 }
413 }
414 };
415 }
416 };
417 }
418 function useComposedRefs2(...refs) {
419 return React6.useCallback(composeRefs2(...refs), refs);
420 }
421
422 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-slot/dist/index.mjs
423 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
424 // @__NO_SIDE_EFFECTS__
425 function createSlot(ownerName) {
426 const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
427 const Slot2 = React7.forwardRef((props, forwardedRef) => {
428 const { children, ...slotProps } = props;
429 const childrenArray = React7.Children.toArray(children);
430 const slottable = childrenArray.find(isSlottable);
431 if (slottable) {
432 const newElement = slottable.props.children;
433 const newChildren = childrenArray.map((child) => {
434 if (child === slottable) {
435 if (React7.Children.count(newElement) > 1) return React7.Children.only(null);
436 return React7.isValidElement(newElement) ? newElement.props.children : null;
437 } else {
438 return child;
439 }
440 });
441 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React7.isValidElement(newElement) ? React7.cloneElement(newElement, void 0, newChildren) : null });
442 }
443 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
444 });
445 Slot2.displayName = `${ownerName}.Slot`;
446 return Slot2;
447 }
448 // @__NO_SIDE_EFFECTS__
449 function createSlotClone(ownerName) {
450 const SlotClone = React7.forwardRef((props, forwardedRef) => {
451 const { children, ...slotProps } = props;
452 if (React7.isValidElement(children)) {
453 const childrenRef = getElementRef(children);
454 const props2 = mergeProps(slotProps, children.props);
455 if (children.type !== React7.Fragment) {
456 props2.ref = forwardedRef ? composeRefs2(forwardedRef, childrenRef) : childrenRef;
457 }
458 return React7.cloneElement(children, props2);
459 }
460 return React7.Children.count(children) > 1 ? React7.Children.only(null) : null;
461 });
462 SlotClone.displayName = `${ownerName}.SlotClone`;
463 return SlotClone;
464 }
465 var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
466 function isSlottable(child) {
467 return React7.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
468 }
469 function mergeProps(slotProps, childProps) {
470 const overrideProps = { ...childProps };
471 for (const propName in childProps) {
472 const slotPropValue = slotProps[propName];
473 const childPropValue = childProps[propName];
474 const isHandler = /^on[A-Z]/.test(propName);
475 if (isHandler) {
476 if (slotPropValue && childPropValue) {
477 overrideProps[propName] = (...args) => {
478 const result = childPropValue(...args);
479 slotPropValue(...args);
480 return result;
481 };
482 } else if (slotPropValue) {
483 overrideProps[propName] = slotPropValue;
484 }
485 } else if (propName === "style") {
486 overrideProps[propName] = { ...slotPropValue, ...childPropValue };
487 } else if (propName === "className") {
488 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
489 }
490 }
491 return { ...slotProps, ...overrideProps };
492 }
493 function getElementRef(element) {
494 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
495 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
496 if (mayWarn) {
497 return element.ref;
498 }
499 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
500 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
501 if (mayWarn) {
502 return element.props.ref;
503 }
504 return element.props.ref || element.ref;
505 }
506
507 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs
508 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
509 var NODES = [
510 "a",
511 "button",
512 "div",
513 "form",
514 "h2",
515 "h3",
516 "img",
517 "input",
518 "label",
519 "li",
520 "nav",
521 "ol",
522 "p",
523 "select",
524 "span",
525 "svg",
526 "ul"
527 ];
528 var Primitive = NODES.reduce((primitive, node) => {
529 const Slot2 = createSlot(`Primitive.${node}`);
530 const Node2 = React8.forwardRef((props, forwardedRef) => {
531 const { asChild, ...primitiveProps } = props;
532 const Comp = asChild ? Slot2 : node;
533 if (typeof window !== "undefined") {
534 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
535 }
536 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
537 });
538 Node2.displayName = `Primitive.${node}`;
539 return { ...primitive, [node]: Node2 };
540 }, {});
541 function dispatchDiscreteCustomEvent(target, event) {
542 if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
543 }
544
545 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
546 var React9 = __toESM(require_react(), 1);
547 function useCallbackRef(callback) {
548 const callbackRef = React9.useRef(callback);
549 React9.useEffect(() => {
550 callbackRef.current = callback;
551 });
552 return React9.useMemo(() => (...args) => callbackRef.current?.(...args), []);
553 }
554
555 // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
556 var React10 = __toESM(require_react(), 1);
557 function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
558 const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
559 React10.useEffect(() => {
560 const handleKeyDown = (event) => {
561 if (event.key === "Escape") {
562 onEscapeKeyDown(event);
563 }
564 };
565 ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
566 return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
567 }, [onEscapeKeyDown, ownerDocument]);
568 }
569
570 // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
571 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
572 var DISMISSABLE_LAYER_NAME = "DismissableLayer";
573 var CONTEXT_UPDATE = "dismissableLayer.update";
574 var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
575 var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
576 var originalBodyPointerEvents;
577 var DismissableLayerContext = React11.createContext({
578 layers: /* @__PURE__ */ new Set(),
579 layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
580 branches: /* @__PURE__ */ new Set()
581 });
582 var DismissableLayer = React11.forwardRef(
583 (props, forwardedRef) => {
584 const {
585 disableOutsidePointerEvents = false,
586 onEscapeKeyDown,
587 onPointerDownOutside,
588 onFocusOutside,
589 onInteractOutside,
590 onDismiss,
591 ...layerProps
592 } = props;
593 const context2 = React11.useContext(DismissableLayerContext);
594 const [node, setNode] = React11.useState(null);
595 const ownerDocument = node?.ownerDocument ?? globalThis?.document;
596 const [, force] = React11.useState({});
597 const composedRefs = useComposedRefs2(forwardedRef, (node2) => setNode(node2));
598 const layers = Array.from(context2.layers);
599 const [highestLayerWithOutsidePointerEventsDisabled] = [...context2.layersWithOutsidePointerEventsDisabled].slice(-1);
600 const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
601 const index = node ? layers.indexOf(node) : -1;
602 const isBodyPointerEventsDisabled = context2.layersWithOutsidePointerEventsDisabled.size > 0;
603 const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
604 const pointerDownOutside = usePointerDownOutside((event) => {
605 const target = event.target;
606 const isPointerDownOnBranch = [...context2.branches].some((branch) => branch.contains(target));
607 if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
608 onPointerDownOutside?.(event);
609 onInteractOutside?.(event);
610 if (!event.defaultPrevented) onDismiss?.();
611 }, ownerDocument);
612 const focusOutside = useFocusOutside((event) => {
613 const target = event.target;
614 const isFocusInBranch = [...context2.branches].some((branch) => branch.contains(target));
615 if (isFocusInBranch) return;
616 onFocusOutside?.(event);
617 onInteractOutside?.(event);
618 if (!event.defaultPrevented) onDismiss?.();
619 }, ownerDocument);
620 useEscapeKeydown((event) => {
621 const isHighestLayer = index === context2.layers.size - 1;
622 if (!isHighestLayer) return;
623 onEscapeKeyDown?.(event);
624 if (!event.defaultPrevented && onDismiss) {
625 event.preventDefault();
626 onDismiss();
627 }
628 }, ownerDocument);
629 React11.useEffect(() => {
630 if (!node) return;
631 if (disableOutsidePointerEvents) {
632 if (context2.layersWithOutsidePointerEventsDisabled.size === 0) {
633 originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
634 ownerDocument.body.style.pointerEvents = "none";
635 }
636 context2.layersWithOutsidePointerEventsDisabled.add(node);
637 }
638 context2.layers.add(node);
639 dispatchUpdate();
640 return () => {
641 if (disableOutsidePointerEvents && context2.layersWithOutsidePointerEventsDisabled.size === 1) {
642 ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
643 }
644 };
645 }, [node, ownerDocument, disableOutsidePointerEvents, context2]);
646 React11.useEffect(() => {
647 return () => {
648 if (!node) return;
649 context2.layers.delete(node);
650 context2.layersWithOutsidePointerEventsDisabled.delete(node);
651 dispatchUpdate();
652 };
653 }, [node, context2]);
654 React11.useEffect(() => {
655 const handleUpdate = () => force({});
656 document.addEventListener(CONTEXT_UPDATE, handleUpdate);
657 return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
658 }, []);
659 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
660 Primitive.div,
661 {
662 ...layerProps,
663 ref: composedRefs,
664 style: {
665 pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
666 ...props.style
667 },
668 onFocusCapture: composeEventHandlers2(props.onFocusCapture, focusOutside.onFocusCapture),
669 onBlurCapture: composeEventHandlers2(props.onBlurCapture, focusOutside.onBlurCapture),
670 onPointerDownCapture: composeEventHandlers2(
671 props.onPointerDownCapture,
672 pointerDownOutside.onPointerDownCapture
673 )
674 }
675 );
676 }
677 );
678 DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
679 var BRANCH_NAME = "DismissableLayerBranch";
680 var DismissableLayerBranch = React11.forwardRef((props, forwardedRef) => {
681 const context2 = React11.useContext(DismissableLayerContext);
682 const ref = React11.useRef(null);
683 const composedRefs = useComposedRefs2(forwardedRef, ref);
684 React11.useEffect(() => {
685 const node = ref.current;
686 if (node) {
687 context2.branches.add(node);
688 return () => {
689 context2.branches.delete(node);
690 };
691 }
692 }, [context2.branches]);
693 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Primitive.div, { ...props, ref: composedRefs });
694 });
695 DismissableLayerBranch.displayName = BRANCH_NAME;
696 function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
697 const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
698 const isPointerInsideReactTreeRef = React11.useRef(false);
699 const handleClickRef = React11.useRef(() => {
700 });
701 React11.useEffect(() => {
702 const handlePointerDown = (event) => {
703 if (event.target && !isPointerInsideReactTreeRef.current) {
704 let handleAndDispatchPointerDownOutsideEvent2 = function() {
705 handleAndDispatchCustomEvent(
706 POINTER_DOWN_OUTSIDE,
707 handlePointerDownOutside,
708 eventDetail,
709 { discrete: true }
710 );
711 };
712 var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
713 const eventDetail = { originalEvent: event };
714 if (event.pointerType === "touch") {
715 ownerDocument.removeEventListener("click", handleClickRef.current);
716 handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
717 ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
718 } else {
719 handleAndDispatchPointerDownOutsideEvent2();
720 }
721 } else {
722 ownerDocument.removeEventListener("click", handleClickRef.current);
723 }
724 isPointerInsideReactTreeRef.current = false;
725 };
726 const timerId = window.setTimeout(() => {
727 ownerDocument.addEventListener("pointerdown", handlePointerDown);
728 }, 0);
729 return () => {
730 window.clearTimeout(timerId);
731 ownerDocument.removeEventListener("pointerdown", handlePointerDown);
732 ownerDocument.removeEventListener("click", handleClickRef.current);
733 };
734 }, [ownerDocument, handlePointerDownOutside]);
735 return {
736 // ensures we check React component tree (not just DOM tree)
737 onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
738 };
739 }
740 function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
741 const handleFocusOutside = useCallbackRef(onFocusOutside);
742 const isFocusInsideReactTreeRef = React11.useRef(false);
743 React11.useEffect(() => {
744 const handleFocus = (event) => {
745 if (event.target && !isFocusInsideReactTreeRef.current) {
746 const eventDetail = { originalEvent: event };
747 handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
748 discrete: false
749 });
750 }
751 };
752 ownerDocument.addEventListener("focusin", handleFocus);
753 return () => ownerDocument.removeEventListener("focusin", handleFocus);
754 }, [ownerDocument, handleFocusOutside]);
755 return {
756 onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
757 onBlurCapture: () => isFocusInsideReactTreeRef.current = false
758 };
759 }
760 function dispatchUpdate() {
761 const event = new CustomEvent(CONTEXT_UPDATE);
762 document.dispatchEvent(event);
763 }
764 function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
765 const target = detail.originalEvent.target;
766 const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
767 if (handler) target.addEventListener(name, handler, { once: true });
768 if (discrete) {
769 dispatchDiscreteCustomEvent(target, event);
770 } else {
771 target.dispatchEvent(event);
772 }
773 }
774
775 // node_modules/@radix-ui/react-focus-scope/dist/index.mjs
776 var React16 = __toESM(require_react(), 1);
777
778 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
779 var React12 = __toESM(require_react(), 1);
780 function setRef3(ref, value) {
781 if (typeof ref === "function") {
782 return ref(value);
783 } else if (ref !== null && ref !== void 0) {
784 ref.current = value;
785 }
786 }
787 function composeRefs3(...refs) {
788 return (node) => {
789 let hasCleanup = false;
790 const cleanups = refs.map((ref) => {
791 const cleanup = setRef3(ref, node);
792 if (!hasCleanup && typeof cleanup == "function") {
793 hasCleanup = true;
794 }
795 return cleanup;
796 });
797 if (hasCleanup) {
798 return () => {
799 for (let i = 0; i < cleanups.length; i++) {
800 const cleanup = cleanups[i];
801 if (typeof cleanup == "function") {
802 cleanup();
803 } else {
804 setRef3(refs[i], null);
805 }
806 }
807 };
808 }
809 };
810 }
811 function useComposedRefs3(...refs) {
812 return React12.useCallback(composeRefs3(...refs), refs);
813 }
814
815 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.mjs
816 var React14 = __toESM(require_react(), 1);
817 var ReactDOM2 = __toESM(require_react_dom(), 1);
818
819 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-slot/dist/index.mjs
820 var React13 = __toESM(require_react(), 1);
821 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
822 // @__NO_SIDE_EFFECTS__
823 function createSlot2(ownerName) {
824 const SlotClone = /* @__PURE__ */ createSlotClone2(ownerName);
825 const Slot2 = React13.forwardRef((props, forwardedRef) => {
826 const { children, ...slotProps } = props;
827 const childrenArray = React13.Children.toArray(children);
828 const slottable = childrenArray.find(isSlottable2);
829 if (slottable) {
830 const newElement = slottable.props.children;
831 const newChildren = childrenArray.map((child) => {
832 if (child === slottable) {
833 if (React13.Children.count(newElement) > 1) return React13.Children.only(null);
834 return React13.isValidElement(newElement) ? newElement.props.children : null;
835 } else {
836 return child;
837 }
838 });
839 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React13.isValidElement(newElement) ? React13.cloneElement(newElement, void 0, newChildren) : null });
840 }
841 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
842 });
843 Slot2.displayName = `${ownerName}.Slot`;
844 return Slot2;
845 }
846 // @__NO_SIDE_EFFECTS__
847 function createSlotClone2(ownerName) {
848 const SlotClone = React13.forwardRef((props, forwardedRef) => {
849 const { children, ...slotProps } = props;
850 if (React13.isValidElement(children)) {
851 const childrenRef = getElementRef2(children);
852 const props2 = mergeProps2(slotProps, children.props);
853 if (children.type !== React13.Fragment) {
854 props2.ref = forwardedRef ? composeRefs3(forwardedRef, childrenRef) : childrenRef;
855 }
856 return React13.cloneElement(children, props2);
857 }
858 return React13.Children.count(children) > 1 ? React13.Children.only(null) : null;
859 });
860 SlotClone.displayName = `${ownerName}.SlotClone`;
861 return SlotClone;
862 }
863 var SLOTTABLE_IDENTIFIER2 = /* @__PURE__ */ Symbol("radix.slottable");
864 function isSlottable2(child) {
865 return React13.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER2;
866 }
867 function mergeProps2(slotProps, childProps) {
868 const overrideProps = { ...childProps };
869 for (const propName in childProps) {
870 const slotPropValue = slotProps[propName];
871 const childPropValue = childProps[propName];
872 const isHandler = /^on[A-Z]/.test(propName);
873 if (isHandler) {
874 if (slotPropValue && childPropValue) {
875 overrideProps[propName] = (...args) => {
876 const result = childPropValue(...args);
877 slotPropValue(...args);
878 return result;
879 };
880 } else if (slotPropValue) {
881 overrideProps[propName] = slotPropValue;
882 }
883 } else if (propName === "style") {
884 overrideProps[propName] = { ...slotPropValue, ...childPropValue };
885 } else if (propName === "className") {
886 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
887 }
888 }
889 return { ...slotProps, ...overrideProps };
890 }
891 function getElementRef2(element) {
892 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
893 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
894 if (mayWarn) {
895 return element.ref;
896 }
897 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
898 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
899 if (mayWarn) {
900 return element.props.ref;
901 }
902 return element.props.ref || element.ref;
903 }
904
905 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.mjs
906 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
907 var NODES2 = [
908 "a",
909 "button",
910 "div",
911 "form",
912 "h2",
913 "h3",
914 "img",
915 "input",
916 "label",
917 "li",
918 "nav",
919 "ol",
920 "p",
921 "select",
922 "span",
923 "svg",
924 "ul"
925 ];
926 var Primitive2 = NODES2.reduce((primitive, node) => {
927 const Slot2 = createSlot2(`Primitive.${node}`);
928 const Node2 = React14.forwardRef((props, forwardedRef) => {
929 const { asChild, ...primitiveProps } = props;
930 const Comp = asChild ? Slot2 : node;
931 if (typeof window !== "undefined") {
932 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
933 }
934 return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
935 });
936 Node2.displayName = `Primitive.${node}`;
937 return { ...primitive, [node]: Node2 };
938 }, {});
939
940 // node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
941 var React15 = __toESM(require_react(), 1);
942 function useCallbackRef2(callback) {
943 const callbackRef = React15.useRef(callback);
944 React15.useEffect(() => {
945 callbackRef.current = callback;
946 });
947 return React15.useMemo(() => (...args) => callbackRef.current?.(...args), []);
948 }
949
950 // node_modules/@radix-ui/react-focus-scope/dist/index.mjs
951 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
952 var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
953 var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
954 var EVENT_OPTIONS = { bubbles: false, cancelable: true };
955 var FOCUS_SCOPE_NAME = "FocusScope";
956 var FocusScope = React16.forwardRef((props, forwardedRef) => {
957 const {
958 loop = false,
959 trapped = false,
960 onMountAutoFocus: onMountAutoFocusProp,
961 onUnmountAutoFocus: onUnmountAutoFocusProp,
962 ...scopeProps
963 } = props;
964 const [container, setContainer] = React16.useState(null);
965 const onMountAutoFocus = useCallbackRef2(onMountAutoFocusProp);
966 const onUnmountAutoFocus = useCallbackRef2(onUnmountAutoFocusProp);
967 const lastFocusedElementRef = React16.useRef(null);
968 const composedRefs = useComposedRefs3(forwardedRef, (node) => setContainer(node));
969 const focusScope = React16.useRef({
970 paused: false,
971 pause() {
972 this.paused = true;
973 },
974 resume() {
975 this.paused = false;
976 }
977 }).current;
978 React16.useEffect(() => {
979 if (trapped) {
980 let handleFocusIn2 = function(event) {
981 if (focusScope.paused || !container) return;
982 const target = event.target;
983 if (container.contains(target)) {
984 lastFocusedElementRef.current = target;
985 } else {
986 focus(lastFocusedElementRef.current, { select: true });
987 }
988 }, handleFocusOut2 = function(event) {
989 if (focusScope.paused || !container) return;
990 const relatedTarget = event.relatedTarget;
991 if (relatedTarget === null) return;
992 if (!container.contains(relatedTarget)) {
993 focus(lastFocusedElementRef.current, { select: true });
994 }
995 }, handleMutations2 = function(mutations) {
996 const focusedElement = document.activeElement;
997 if (focusedElement !== document.body) return;
998 for (const mutation of mutations) {
999 if (mutation.removedNodes.length > 0) focus(container);
1000 }
1001 };
1002 var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
1003 document.addEventListener("focusin", handleFocusIn2);
1004 document.addEventListener("focusout", handleFocusOut2);
1005 const mutationObserver = new MutationObserver(handleMutations2);
1006 if (container) mutationObserver.observe(container, { childList: true, subtree: true });
1007 return () => {
1008 document.removeEventListener("focusin", handleFocusIn2);
1009 document.removeEventListener("focusout", handleFocusOut2);
1010 mutationObserver.disconnect();
1011 };
1012 }
1013 }, [trapped, container, focusScope.paused]);
1014 React16.useEffect(() => {
1015 if (container) {
1016 focusScopesStack.add(focusScope);
1017 const previouslyFocusedElement = document.activeElement;
1018 const hasFocusedCandidate = container.contains(previouslyFocusedElement);
1019 if (!hasFocusedCandidate) {
1020 const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
1021 container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
1022 container.dispatchEvent(mountEvent);
1023 if (!mountEvent.defaultPrevented) {
1024 focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
1025 if (document.activeElement === previouslyFocusedElement) {
1026 focus(container);
1027 }
1028 }
1029 }
1030 return () => {
1031 container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
1032 setTimeout(() => {
1033 const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
1034 container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
1035 container.dispatchEvent(unmountEvent);
1036 if (!unmountEvent.defaultPrevented) {
1037 focus(previouslyFocusedElement ?? document.body, { select: true });
1038 }
1039 container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
1040 focusScopesStack.remove(focusScope);
1041 }, 0);
1042 };
1043 }
1044 }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
1045 const handleKeyDown = React16.useCallback(
1046 (event) => {
1047 if (!loop && !trapped) return;
1048 if (focusScope.paused) return;
1049 const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
1050 const focusedElement = document.activeElement;
1051 if (isTabKey && focusedElement) {
1052 const container2 = event.currentTarget;
1053 const [first, last] = getTabbableEdges(container2);
1054 const hasTabbableElementsInside = first && last;
1055 if (!hasTabbableElementsInside) {
1056 if (focusedElement === container2) event.preventDefault();
1057 } else {
1058 if (!event.shiftKey && focusedElement === last) {
1059 event.preventDefault();
1060 if (loop) focus(first, { select: true });
1061 } else if (event.shiftKey && focusedElement === first) {
1062 event.preventDefault();
1063 if (loop) focus(last, { select: true });
1064 }
1065 }
1066 }
1067 },
1068 [loop, trapped, focusScope.paused]
1069 );
1070 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive2.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
1071 });
1072 FocusScope.displayName = FOCUS_SCOPE_NAME;
1073 function focusFirst(candidates, { select = false } = {}) {
1074 const previouslyFocusedElement = document.activeElement;
1075 for (const candidate of candidates) {
1076 focus(candidate, { select });
1077 if (document.activeElement !== previouslyFocusedElement) return;
1078 }
1079 }
1080 function getTabbableEdges(container) {
1081 const candidates = getTabbableCandidates(container);
1082 const first = findVisible(candidates, container);
1083 const last = findVisible(candidates.reverse(), container);
1084 return [first, last];
1085 }
1086 function getTabbableCandidates(container) {
1087 const nodes = [];
1088 const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
1089 acceptNode: (node) => {
1090 const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
1091 if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
1092 return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1093 }
1094 });
1095 while (walker.nextNode()) nodes.push(walker.currentNode);
1096 return nodes;
1097 }
1098 function findVisible(elements, container) {
1099 for (const element of elements) {
1100 if (!isHidden(element, { upTo: container })) return element;
1101 }
1102 }
1103 function isHidden(node, { upTo }) {
1104 if (getComputedStyle(node).visibility === "hidden") return true;
1105 while (node) {
1106 if (upTo !== void 0 && node === upTo) return false;
1107 if (getComputedStyle(node).display === "none") return true;
1108 node = node.parentElement;
1109 }
1110 return false;
1111 }
1112 function isSelectableInput(element) {
1113 return element instanceof HTMLInputElement && "select" in element;
1114 }
1115 function focus(element, { select = false } = {}) {
1116 if (element && element.focus) {
1117 const previouslyFocusedElement = document.activeElement;
1118 element.focus({ preventScroll: true });
1119 if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
1120 element.select();
1121 }
1122 }
1123 var focusScopesStack = createFocusScopesStack();
1124 function createFocusScopesStack() {
1125 let stack = [];
1126 return {
1127 add(focusScope) {
1128 const activeFocusScope = stack[0];
1129 if (focusScope !== activeFocusScope) {
1130 activeFocusScope?.pause();
1131 }
1132 stack = arrayRemove(stack, focusScope);
1133 stack.unshift(focusScope);
1134 },
1135 remove(focusScope) {
1136 stack = arrayRemove(stack, focusScope);
1137 stack[0]?.resume();
1138 }
1139 };
1140 }
1141 function arrayRemove(array, item) {
1142 const updatedArray = [...array];
1143 const index = updatedArray.indexOf(item);
1144 if (index !== -1) {
1145 updatedArray.splice(index, 1);
1146 }
1147 return updatedArray;
1148 }
1149 function removeLinks(items) {
1150 return items.filter((item) => item.tagName !== "A");
1151 }
1152
1153 // node_modules/@radix-ui/react-portal/dist/index.mjs
1154 var React21 = __toESM(require_react(), 1);
1155 var import_react_dom = __toESM(require_react_dom(), 1);
1156
1157 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive/dist/index.mjs
1158 var React19 = __toESM(require_react(), 1);
1159 var ReactDOM3 = __toESM(require_react_dom(), 1);
1160
1161 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-slot/dist/index.mjs
1162 var React18 = __toESM(require_react(), 1);
1163
1164 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
1165 var React17 = __toESM(require_react(), 1);
1166 function setRef4(ref, value) {
1167 if (typeof ref === "function") {
1168 return ref(value);
1169 } else if (ref !== null && ref !== void 0) {
1170 ref.current = value;
1171 }
1172 }
1173 function composeRefs4(...refs) {
1174 return (node) => {
1175 let hasCleanup = false;
1176 const cleanups = refs.map((ref) => {
1177 const cleanup = setRef4(ref, node);
1178 if (!hasCleanup && typeof cleanup == "function") {
1179 hasCleanup = true;
1180 }
1181 return cleanup;
1182 });
1183 if (hasCleanup) {
1184 return () => {
1185 for (let i = 0; i < cleanups.length; i++) {
1186 const cleanup = cleanups[i];
1187 if (typeof cleanup == "function") {
1188 cleanup();
1189 } else {
1190 setRef4(refs[i], null);
1191 }
1192 }
1193 };
1194 }
1195 };
1196 }
1197
1198 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-slot/dist/index.mjs
1199 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
1200 // @__NO_SIDE_EFFECTS__
1201 function createSlot3(ownerName) {
1202 const SlotClone = /* @__PURE__ */ createSlotClone3(ownerName);
1203 const Slot2 = React18.forwardRef((props, forwardedRef) => {
1204 const { children, ...slotProps } = props;
1205 const childrenArray = React18.Children.toArray(children);
1206 const slottable = childrenArray.find(isSlottable3);
1207 if (slottable) {
1208 const newElement = slottable.props.children;
1209 const newChildren = childrenArray.map((child) => {
1210 if (child === slottable) {
1211 if (React18.Children.count(newElement) > 1) return React18.Children.only(null);
1212 return React18.isValidElement(newElement) ? newElement.props.children : null;
1213 } else {
1214 return child;
1215 }
1216 });
1217 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React18.isValidElement(newElement) ? React18.cloneElement(newElement, void 0, newChildren) : null });
1218 }
1219 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
1220 });
1221 Slot2.displayName = `${ownerName}.Slot`;
1222 return Slot2;
1223 }
1224 // @__NO_SIDE_EFFECTS__
1225 function createSlotClone3(ownerName) {
1226 const SlotClone = React18.forwardRef((props, forwardedRef) => {
1227 const { children, ...slotProps } = props;
1228 if (React18.isValidElement(children)) {
1229 const childrenRef = getElementRef3(children);
1230 const props2 = mergeProps3(slotProps, children.props);
1231 if (children.type !== React18.Fragment) {
1232 props2.ref = forwardedRef ? composeRefs4(forwardedRef, childrenRef) : childrenRef;
1233 }
1234 return React18.cloneElement(children, props2);
1235 }
1236 return React18.Children.count(children) > 1 ? React18.Children.only(null) : null;
1237 });
1238 SlotClone.displayName = `${ownerName}.SlotClone`;
1239 return SlotClone;
1240 }
1241 var SLOTTABLE_IDENTIFIER3 = /* @__PURE__ */ Symbol("radix.slottable");
1242 function isSlottable3(child) {
1243 return React18.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER3;
1244 }
1245 function mergeProps3(slotProps, childProps) {
1246 const overrideProps = { ...childProps };
1247 for (const propName in childProps) {
1248 const slotPropValue = slotProps[propName];
1249 const childPropValue = childProps[propName];
1250 const isHandler = /^on[A-Z]/.test(propName);
1251 if (isHandler) {
1252 if (slotPropValue && childPropValue) {
1253 overrideProps[propName] = (...args) => {
1254 const result = childPropValue(...args);
1255 slotPropValue(...args);
1256 return result;
1257 };
1258 } else if (slotPropValue) {
1259 overrideProps[propName] = slotPropValue;
1260 }
1261 } else if (propName === "style") {
1262 overrideProps[propName] = { ...slotPropValue, ...childPropValue };
1263 } else if (propName === "className") {
1264 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
1265 }
1266 }
1267 return { ...slotProps, ...overrideProps };
1268 }
1269 function getElementRef3(element) {
1270 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1271 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1272 if (mayWarn) {
1273 return element.ref;
1274 }
1275 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1276 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1277 if (mayWarn) {
1278 return element.props.ref;
1279 }
1280 return element.props.ref || element.ref;
1281 }
1282
1283 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive/dist/index.mjs
1284 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
1285 var NODES3 = [
1286 "a",
1287 "button",
1288 "div",
1289 "form",
1290 "h2",
1291 "h3",
1292 "img",
1293 "input",
1294 "label",
1295 "li",
1296 "nav",
1297 "ol",
1298 "p",
1299 "select",
1300 "span",
1301 "svg",
1302 "ul"
1303 ];
1304 var Primitive3 = NODES3.reduce((primitive, node) => {
1305 const Slot2 = createSlot3(`Primitive.${node}`);
1306 const Node2 = React19.forwardRef((props, forwardedRef) => {
1307 const { asChild, ...primitiveProps } = props;
1308 const Comp = asChild ? Slot2 : node;
1309 if (typeof window !== "undefined") {
1310 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
1311 }
1312 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
1313 });
1314 Node2.displayName = `Primitive.${node}`;
1315 return { ...primitive, [node]: Node2 };
1316 }, {});
1317
1318 // node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
1319 var React20 = __toESM(require_react(), 1);
1320 var useLayoutEffect22 = globalThis?.document ? React20.useLayoutEffect : () => {
1321 };
1322
1323 // node_modules/@radix-ui/react-portal/dist/index.mjs
1324 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
1325 var PORTAL_NAME = "Portal";
1326 var Portal = React21.forwardRef((props, forwardedRef) => {
1327 const { container: containerProp, ...portalProps } = props;
1328 const [mounted, setMounted] = React21.useState(false);
1329 useLayoutEffect22(() => setMounted(true), []);
1330 const container = containerProp || mounted && globalThis?.document?.body;
1331 return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Primitive3.div, { ...portalProps, ref: forwardedRef }), container) : null;
1332 });
1333 Portal.displayName = PORTAL_NAME;
1334
1335 // node_modules/@radix-ui/react-presence/dist/index.mjs
1336 var React25 = __toESM(require_react(), 1);
1337
1338 // node_modules/@radix-ui/react-presence/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
1339 var React23 = __toESM(require_react(), 1);
1340 function setRef5(ref, value) {
1341 if (typeof ref === "function") {
1342 return ref(value);
1343 } else if (ref !== null && ref !== void 0) {
1344 ref.current = value;
1345 }
1346 }
1347 function composeRefs5(...refs) {
1348 return (node) => {
1349 let hasCleanup = false;
1350 const cleanups = refs.map((ref) => {
1351 const cleanup = setRef5(ref, node);
1352 if (!hasCleanup && typeof cleanup == "function") {
1353 hasCleanup = true;
1354 }
1355 return cleanup;
1356 });
1357 if (hasCleanup) {
1358 return () => {
1359 for (let i = 0; i < cleanups.length; i++) {
1360 const cleanup = cleanups[i];
1361 if (typeof cleanup == "function") {
1362 cleanup();
1363 } else {
1364 setRef5(refs[i], null);
1365 }
1366 }
1367 };
1368 }
1369 };
1370 }
1371 function useComposedRefs4(...refs) {
1372 return React23.useCallback(composeRefs5(...refs), refs);
1373 }
1374
1375 // node_modules/@radix-ui/react-presence/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
1376 var React24 = __toESM(require_react(), 1);
1377 var useLayoutEffect23 = globalThis?.document ? React24.useLayoutEffect : () => {
1378 };
1379
1380 // node_modules/@radix-ui/react-presence/dist/index.mjs
1381 var React26 = __toESM(require_react(), 1);
1382 function useStateMachine(initialState, machine) {
1383 return React26.useReducer((state, event) => {
1384 const nextState = machine[state][event];
1385 return nextState ?? state;
1386 }, initialState);
1387 }
1388 var Presence = (props) => {
1389 const { present, children } = props;
1390 const presence = usePresence(present);
1391 const child = typeof children === "function" ? children({ present: presence.isPresent }) : React25.Children.only(children);
1392 const ref = useComposedRefs4(presence.ref, getElementRef4(child));
1393 const forceMount = typeof children === "function";
1394 return forceMount || presence.isPresent ? React25.cloneElement(child, { ref }) : null;
1395 };
1396 Presence.displayName = "Presence";
1397 function usePresence(present) {
1398 const [node, setNode] = React25.useState();
1399 const stylesRef = React25.useRef(null);
1400 const prevPresentRef = React25.useRef(present);
1401 const prevAnimationNameRef = React25.useRef("none");
1402 const initialState = present ? "mounted" : "unmounted";
1403 const [state, send] = useStateMachine(initialState, {
1404 mounted: {
1405 UNMOUNT: "unmounted",
1406 ANIMATION_OUT: "unmountSuspended"
1407 },
1408 unmountSuspended: {
1409 MOUNT: "mounted",
1410 ANIMATION_END: "unmounted"
1411 },
1412 unmounted: {
1413 MOUNT: "mounted"
1414 }
1415 });
1416 React25.useEffect(() => {
1417 const currentAnimationName = getAnimationName(stylesRef.current);
1418 prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
1419 }, [state]);
1420 useLayoutEffect23(() => {
1421 const styles = stylesRef.current;
1422 const wasPresent = prevPresentRef.current;
1423 const hasPresentChanged = wasPresent !== present;
1424 if (hasPresentChanged) {
1425 const prevAnimationName = prevAnimationNameRef.current;
1426 const currentAnimationName = getAnimationName(styles);
1427 if (present) {
1428 send("MOUNT");
1429 } else if (currentAnimationName === "none" || styles?.display === "none") {
1430 send("UNMOUNT");
1431 } else {
1432 const isAnimating = prevAnimationName !== currentAnimationName;
1433 if (wasPresent && isAnimating) {
1434 send("ANIMATION_OUT");
1435 } else {
1436 send("UNMOUNT");
1437 }
1438 }
1439 prevPresentRef.current = present;
1440 }
1441 }, [present, send]);
1442 useLayoutEffect23(() => {
1443 if (node) {
1444 let timeoutId;
1445 const ownerWindow = node.ownerDocument.defaultView ?? window;
1446 const handleAnimationEnd = (event) => {
1447 const currentAnimationName = getAnimationName(stylesRef.current);
1448 const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
1449 if (event.target === node && isCurrentAnimation) {
1450 send("ANIMATION_END");
1451 if (!prevPresentRef.current) {
1452 const currentFillMode = node.style.animationFillMode;
1453 node.style.animationFillMode = "forwards";
1454 timeoutId = ownerWindow.setTimeout(() => {
1455 if (node.style.animationFillMode === "forwards") {
1456 node.style.animationFillMode = currentFillMode;
1457 }
1458 });
1459 }
1460 }
1461 };
1462 const handleAnimationStart = (event) => {
1463 if (event.target === node) {
1464 prevAnimationNameRef.current = getAnimationName(stylesRef.current);
1465 }
1466 };
1467 node.addEventListener("animationstart", handleAnimationStart);
1468 node.addEventListener("animationcancel", handleAnimationEnd);
1469 node.addEventListener("animationend", handleAnimationEnd);
1470 return () => {
1471 ownerWindow.clearTimeout(timeoutId);
1472 node.removeEventListener("animationstart", handleAnimationStart);
1473 node.removeEventListener("animationcancel", handleAnimationEnd);
1474 node.removeEventListener("animationend", handleAnimationEnd);
1475 };
1476 } else {
1477 send("ANIMATION_END");
1478 }
1479 }, [node, send]);
1480 return {
1481 isPresent: ["mounted", "unmountSuspended"].includes(state),
1482 ref: React25.useCallback((node2) => {
1483 stylesRef.current = node2 ? getComputedStyle(node2) : null;
1484 setNode(node2);
1485 }, [])
1486 };
1487 }
1488 function getAnimationName(styles) {
1489 return styles?.animationName || "none";
1490 }
1491 function getElementRef4(element) {
1492 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1493 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1494 if (mayWarn) {
1495 return element.ref;
1496 }
1497 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1498 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1499 if (mayWarn) {
1500 return element.props.ref;
1501 }
1502 return element.props.ref || element.ref;
1503 }
1504
1505 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.mjs
1506 var React28 = __toESM(require_react(), 1);
1507 var ReactDOM5 = __toESM(require_react_dom(), 1);
1508
1509 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.mjs
1510 var React27 = __toESM(require_react(), 1);
1511 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
1512 // @__NO_SIDE_EFFECTS__
1513 function createSlot4(ownerName) {
1514 const SlotClone = /* @__PURE__ */ createSlotClone4(ownerName);
1515 const Slot2 = React27.forwardRef((props, forwardedRef) => {
1516 const { children, ...slotProps } = props;
1517 const childrenArray = React27.Children.toArray(children);
1518 const slottable = childrenArray.find(isSlottable4);
1519 if (slottable) {
1520 const newElement = slottable.props.children;
1521 const newChildren = childrenArray.map((child) => {
1522 if (child === slottable) {
1523 if (React27.Children.count(newElement) > 1) return React27.Children.only(null);
1524 return React27.isValidElement(newElement) ? newElement.props.children : null;
1525 } else {
1526 return child;
1527 }
1528 });
1529 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React27.isValidElement(newElement) ? React27.cloneElement(newElement, void 0, newChildren) : null });
1530 }
1531 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
1532 });
1533 Slot2.displayName = `${ownerName}.Slot`;
1534 return Slot2;
1535 }
1536 // @__NO_SIDE_EFFECTS__
1537 function createSlotClone4(ownerName) {
1538 const SlotClone = React27.forwardRef((props, forwardedRef) => {
1539 const { children, ...slotProps } = props;
1540 if (React27.isValidElement(children)) {
1541 const childrenRef = getElementRef5(children);
1542 const props2 = mergeProps4(slotProps, children.props);
1543 if (children.type !== React27.Fragment) {
1544 props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
1545 }
1546 return React27.cloneElement(children, props2);
1547 }
1548 return React27.Children.count(children) > 1 ? React27.Children.only(null) : null;
1549 });
1550 SlotClone.displayName = `${ownerName}.SlotClone`;
1551 return SlotClone;
1552 }
1553 var SLOTTABLE_IDENTIFIER4 = /* @__PURE__ */ Symbol("radix.slottable");
1554 function isSlottable4(child) {
1555 return React27.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER4;
1556 }
1557 function mergeProps4(slotProps, childProps) {
1558 const overrideProps = { ...childProps };
1559 for (const propName in childProps) {
1560 const slotPropValue = slotProps[propName];
1561 const childPropValue = childProps[propName];
1562 const isHandler = /^on[A-Z]/.test(propName);
1563 if (isHandler) {
1564 if (slotPropValue && childPropValue) {
1565 overrideProps[propName] = (...args) => {
1566 const result = childPropValue(...args);
1567 slotPropValue(...args);
1568 return result;
1569 };
1570 } else if (slotPropValue) {
1571 overrideProps[propName] = slotPropValue;
1572 }
1573 } else if (propName === "style") {
1574 overrideProps[propName] = { ...slotPropValue, ...childPropValue };
1575 } else if (propName === "className") {
1576 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
1577 }
1578 }
1579 return { ...slotProps, ...overrideProps };
1580 }
1581 function getElementRef5(element) {
1582 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1583 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1584 if (mayWarn) {
1585 return element.ref;
1586 }
1587 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1588 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1589 if (mayWarn) {
1590 return element.props.ref;
1591 }
1592 return element.props.ref || element.ref;
1593 }
1594
1595 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.mjs
1596 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
1597 var NODES4 = [
1598 "a",
1599 "button",
1600 "div",
1601 "form",
1602 "h2",
1603 "h3",
1604 "img",
1605 "input",
1606 "label",
1607 "li",
1608 "nav",
1609 "ol",
1610 "p",
1611 "select",
1612 "span",
1613 "svg",
1614 "ul"
1615 ];
1616 var Primitive4 = NODES4.reduce((primitive, node) => {
1617 const Slot2 = createSlot4(`Primitive.${node}`);
1618 const Node2 = React28.forwardRef((props, forwardedRef) => {
1619 const { asChild, ...primitiveProps } = props;
1620 const Comp = asChild ? Slot2 : node;
1621 if (typeof window !== "undefined") {
1622 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
1623 }
1624 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
1625 });
1626 Node2.displayName = `Primitive.${node}`;
1627 return { ...primitive, [node]: Node2 };
1628 }, {});
1629
1630 // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
1631 var React29 = __toESM(require_react(), 1);
1632 var count2 = 0;
1633 function useFocusGuards() {
1634 React29.useEffect(() => {
1635 const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
1636 document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
1637 document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
1638 count2++;
1639 return () => {
1640 if (count2 === 1) {
1641 document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
1642 }
1643 count2--;
1644 };
1645 }, []);
1646 }
1647 function createFocusGuard() {
1648 const element = document.createElement("span");
1649 element.setAttribute("data-radix-focus-guard", "");
1650 element.tabIndex = 0;
1651 element.style.outline = "none";
1652 element.style.opacity = "0";
1653 element.style.position = "fixed";
1654 element.style.pointerEvents = "none";
1655 return element;
1656 }
1657
1658 // node_modules/tslib/tslib.es6.mjs
1659 var __assign = function() {
1660 __assign = Object.assign || function __assign2(t2) {
1661 for (var s, i = 1, n = arguments.length; i < n; i++) {
1662 s = arguments[i];
1663 for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t2[p2] = s[p2];
1664 }
1665 return t2;
1666 };
1667 return __assign.apply(this, arguments);
1668 };
1669 function __rest(s, e) {
1670 var t2 = {};
1671 for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0)
1672 t2[p2] = s[p2];
1673 if (s != null && typeof Object.getOwnPropertySymbols === "function")
1674 for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++) {
1675 if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]))
1676 t2[p2[i]] = s[p2[i]];
1677 }
1678 return t2;
1679 }
1680 function __spreadArray(to, from, pack) {
1681 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1682 if (ar || !(i in from)) {
1683 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1684 ar[i] = from[i];
1685 }
1686 }
1687 return to.concat(ar || Array.prototype.slice.call(from));
1688 }
1689
1690 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js
1691 var React36 = __toESM(require_react());
1692
1693 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js
1694 var React32 = __toESM(require_react());
1695
1696 // node_modules/react-remove-scroll-bar/dist/es2015/constants.js
1697 var zeroRightClassName = "right-scroll-bar-position";
1698 var fullWidthClassName = "width-before-scroll-bar";
1699 var noScrollbarsClassName = "with-scroll-bars-hidden";
1700 var removedBarSizeVariable = "--removed-body-scroll-bar-size";
1701
1702 // node_modules/use-callback-ref/dist/es2015/assignRef.js
1703 function assignRef(ref, value) {
1704 if (typeof ref === "function") {
1705 ref(value);
1706 } else if (ref) {
1707 ref.current = value;
1708 }
1709 return ref;
1710 }
1711
1712 // node_modules/use-callback-ref/dist/es2015/useRef.js
1713 var import_react = __toESM(require_react());
1714 function useCallbackRef3(initialValue, callback) {
1715 var ref = (0, import_react.useState)(function() {
1716 return {
1717 // value
1718 value: initialValue,
1719 // last callback
1720 callback,
1721 // "memoized" public interface
1722 facade: {
1723 get current() {
1724 return ref.value;
1725 },
1726 set current(value) {
1727 var last = ref.value;
1728 if (last !== value) {
1729 ref.value = value;
1730 ref.callback(value, last);
1731 }
1732 }
1733 }
1734 };
1735 })[0];
1736 ref.callback = callback;
1737 return ref.facade;
1738 }
1739
1740 // node_modules/use-callback-ref/dist/es2015/useMergeRef.js
1741 var React30 = __toESM(require_react());
1742 var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React30.useLayoutEffect : React30.useEffect;
1743 var currentValues = /* @__PURE__ */ new WeakMap();
1744 function useMergeRefs(refs, defaultValue) {
1745 var callbackRef = useCallbackRef3(defaultValue || null, function(newValue) {
1746 return refs.forEach(function(ref) {
1747 return assignRef(ref, newValue);
1748 });
1749 });
1750 useIsomorphicLayoutEffect(function() {
1751 var oldValue = currentValues.get(callbackRef);
1752 if (oldValue) {
1753 var prevRefs_1 = new Set(oldValue);
1754 var nextRefs_1 = new Set(refs);
1755 var current_1 = callbackRef.current;
1756 prevRefs_1.forEach(function(ref) {
1757 if (!nextRefs_1.has(ref)) {
1758 assignRef(ref, null);
1759 }
1760 });
1761 nextRefs_1.forEach(function(ref) {
1762 if (!prevRefs_1.has(ref)) {
1763 assignRef(ref, current_1);
1764 }
1765 });
1766 }
1767 currentValues.set(callbackRef, refs);
1768 }, [refs]);
1769 return callbackRef;
1770 }
1771
1772 // node_modules/use-sidecar/dist/es2015/medium.js
1773 function ItoI(a) {
1774 return a;
1775 }
1776 function innerCreateMedium(defaults, middleware) {
1777 if (middleware === void 0) {
1778 middleware = ItoI;
1779 }
1780 var buffer = [];
1781 var assigned = false;
1782 var medium = {
1783 read: function() {
1784 if (assigned) {
1785 throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
1786 }
1787 if (buffer.length) {
1788 return buffer[buffer.length - 1];
1789 }
1790 return defaults;
1791 },
1792 useMedium: function(data) {
1793 var item = middleware(data, assigned);
1794 buffer.push(item);
1795 return function() {
1796 buffer = buffer.filter(function(x) {
1797 return x !== item;
1798 });
1799 };
1800 },
1801 assignSyncMedium: function(cb) {
1802 assigned = true;
1803 while (buffer.length) {
1804 var cbs = buffer;
1805 buffer = [];
1806 cbs.forEach(cb);
1807 }
1808 buffer = {
1809 push: function(x) {
1810 return cb(x);
1811 },
1812 filter: function() {
1813 return buffer;
1814 }
1815 };
1816 },
1817 assignMedium: function(cb) {
1818 assigned = true;
1819 var pendingQueue = [];
1820 if (buffer.length) {
1821 var cbs = buffer;
1822 buffer = [];
1823 cbs.forEach(cb);
1824 pendingQueue = buffer;
1825 }
1826 var executeQueue = function() {
1827 var cbs2 = pendingQueue;
1828 pendingQueue = [];
1829 cbs2.forEach(cb);
1830 };
1831 var cycle = function() {
1832 return Promise.resolve().then(executeQueue);
1833 };
1834 cycle();
1835 buffer = {
1836 push: function(x) {
1837 pendingQueue.push(x);
1838 cycle();
1839 },
1840 filter: function(filter) {
1841 pendingQueue = pendingQueue.filter(filter);
1842 return buffer;
1843 }
1844 };
1845 }
1846 };
1847 return medium;
1848 }
1849 function createSidecarMedium(options) {
1850 if (options === void 0) {
1851 options = {};
1852 }
1853 var medium = innerCreateMedium(null);
1854 medium.options = __assign({ async: true, ssr: false }, options);
1855 return medium;
1856 }
1857
1858 // node_modules/use-sidecar/dist/es2015/exports.js
1859 var React31 = __toESM(require_react());
1860 var SideCar = function(_a) {
1861 var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
1862 if (!sideCar) {
1863 throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1864 }
1865 var Target = sideCar.read();
1866 if (!Target) {
1867 throw new Error("Sidecar medium not found");
1868 }
1869 return React31.createElement(Target, __assign({}, rest));
1870 };
1871 SideCar.isSideCarExport = true;
1872 function exportSidecar(medium, exported) {
1873 medium.useMedium(exported);
1874 return SideCar;
1875 }
1876
1877 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js
1878 var effectCar = createSidecarMedium();
1879
1880 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js
1881 var nothing = function() {
1882 return;
1883 };
1884 var RemoveScroll = React32.forwardRef(function(props, parentRef) {
1885 var ref = React32.useRef(null);
1886 var _a = React32.useState({
1887 onScrollCapture: nothing,
1888 onWheelCapture: nothing,
1889 onTouchMoveCapture: nothing
1890 }), callbacks = _a[0], setCallbacks = _a[1];
1891 var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1892 var SideCar2 = sideCar;
1893 var containerRef = useMergeRefs([ref, parentRef]);
1894 var containerProps = __assign(__assign({}, rest), callbacks);
1895 return React32.createElement(
1896 React32.Fragment,
1897 null,
1898 enabled && React32.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
1899 forwardProps ? React32.cloneElement(React32.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React32.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
1900 );
1901 });
1902 RemoveScroll.defaultProps = {
1903 enabled: true,
1904 removeScrollBar: true,
1905 inert: false
1906 };
1907 RemoveScroll.classNames = {
1908 fullWidth: fullWidthClassName,
1909 zeroRight: zeroRightClassName
1910 };
1911
1912 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
1913 var React35 = __toESM(require_react());
1914
1915 // node_modules/react-remove-scroll-bar/dist/es2015/component.js
1916 var React34 = __toESM(require_react());
1917
1918 // node_modules/react-style-singleton/dist/es2015/hook.js
1919 var React33 = __toESM(require_react());
1920
1921 // node_modules/get-nonce/dist/es2015/index.js
1922 var currentNonce;
1923 var getNonce = function() {
1924 if (currentNonce) {
1925 return currentNonce;
1926 }
1927 if (typeof __webpack_nonce__ !== "undefined") {
1928 return __webpack_nonce__;
1929 }
1930 return void 0;
1931 };
1932
1933 // node_modules/react-style-singleton/dist/es2015/singleton.js
1934 function makeStyleTag() {
1935 if (!document)
1936 return null;
1937 var tag = document.createElement("style");
1938 tag.type = "text/css";
1939 var nonce = getNonce();
1940 if (nonce) {
1941 tag.setAttribute("nonce", nonce);
1942 }
1943 return tag;
1944 }
1945 function injectStyles(tag, css) {
1946 if (tag.styleSheet) {
1947 tag.styleSheet.cssText = css;
1948 } else {
1949 tag.appendChild(document.createTextNode(css));
1950 }
1951 }
1952 function insertStyleTag(tag) {
1953 var head = document.head || document.getElementsByTagName("head")[0];
1954 head.appendChild(tag);
1955 }
1956 var stylesheetSingleton = function() {
1957 var counter = 0;
1958 var stylesheet = null;
1959 return {
1960 add: function(style) {
1961 if (counter == 0) {
1962 if (stylesheet = makeStyleTag()) {
1963 injectStyles(stylesheet, style);
1964 insertStyleTag(stylesheet);
1965 }
1966 }
1967 counter++;
1968 },
1969 remove: function() {
1970 counter--;
1971 if (!counter && stylesheet) {
1972 stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
1973 stylesheet = null;
1974 }
1975 }
1976 };
1977 };
1978
1979 // node_modules/react-style-singleton/dist/es2015/hook.js
1980 var styleHookSingleton = function() {
1981 var sheet = stylesheetSingleton();
1982 return function(styles, isDynamic) {
1983 React33.useEffect(function() {
1984 sheet.add(styles);
1985 return function() {
1986 sheet.remove();
1987 };
1988 }, [styles && isDynamic]);
1989 };
1990 };
1991
1992 // node_modules/react-style-singleton/dist/es2015/component.js
1993 var styleSingleton = function() {
1994 var useStyle = styleHookSingleton();
1995 var Sheet = function(_a) {
1996 var styles = _a.styles, dynamic = _a.dynamic;
1997 useStyle(styles, dynamic);
1998 return null;
1999 };
2000 return Sheet;
2001 };
2002
2003 // node_modules/react-remove-scroll-bar/dist/es2015/utils.js
2004 var zeroGap = {
2005 left: 0,
2006 top: 0,
2007 right: 0,
2008 gap: 0
2009 };
2010 var parse = function(x) {
2011 return parseInt(x || "", 10) || 0;
2012 };
2013 var getOffset = function(gapMode) {
2014 var cs = window.getComputedStyle(document.body);
2015 var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
2016 var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
2017 var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
2018 return [parse(left), parse(top), parse(right)];
2019 };
2020 var getGapWidth = function(gapMode) {
2021 if (gapMode === void 0) {
2022 gapMode = "margin";
2023 }
2024 if (typeof window === "undefined") {
2025 return zeroGap;
2026 }
2027 var offsets = getOffset(gapMode);
2028 var documentWidth = document.documentElement.clientWidth;
2029 var windowWidth = window.innerWidth;
2030 return {
2031 left: offsets[0],
2032 top: offsets[1],
2033 right: offsets[2],
2034 gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
2035 };
2036 };
2037
2038 // node_modules/react-remove-scroll-bar/dist/es2015/component.js
2039 var Style = styleSingleton();
2040 var lockAttribute = "data-scroll-locked";
2041 var getStyles = function(_a, allowRelative, gapMode, important) {
2042 var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
2043 if (gapMode === void 0) {
2044 gapMode = "margin";
2045 }
2046 return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
2047 allowRelative && "position: relative ".concat(important, ";"),
2048 gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
2049 gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
2050 ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
2051 };
2052 var getCurrentUseCounter = function() {
2053 var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
2054 return isFinite(counter) ? counter : 0;
2055 };
2056 var useLockAttribute = function() {
2057 React34.useEffect(function() {
2058 document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
2059 return function() {
2060 var newCounter = getCurrentUseCounter() - 1;
2061 if (newCounter <= 0) {
2062 document.body.removeAttribute(lockAttribute);
2063 } else {
2064 document.body.setAttribute(lockAttribute, newCounter.toString());
2065 }
2066 };
2067 }, []);
2068 };
2069 var RemoveScrollBar = function(_a) {
2070 var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
2071 useLockAttribute();
2072 var gap = React34.useMemo(function() {
2073 return getGapWidth(gapMode);
2074 }, [gapMode]);
2075 return React34.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
2076 };
2077
2078 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
2079 var passiveSupported = false;
2080 if (typeof window !== "undefined") {
2081 try {
2082 options = Object.defineProperty({}, "passive", {
2083 get: function() {
2084 passiveSupported = true;
2085 return true;
2086 }
2087 });
2088 window.addEventListener("test", options, options);
2089 window.removeEventListener("test", options, options);
2090 } catch (err) {
2091 passiveSupported = false;
2092 }
2093 }
2094 var options;
2095 var nonPassive = passiveSupported ? { passive: false } : false;
2096
2097 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
2098 var alwaysContainsScroll = function(node) {
2099 return node.tagName === "TEXTAREA";
2100 };
2101 var elementCanBeScrolled = function(node, overflow) {
2102 if (!(node instanceof Element)) {
2103 return false;
2104 }
2105 var styles = window.getComputedStyle(node);
2106 return (
2107 // not-not-scrollable
2108 styles[overflow] !== "hidden" && // contains scroll inside self
2109 !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
2110 );
2111 };
2112 var elementCouldBeVScrolled = function(node) {
2113 return elementCanBeScrolled(node, "overflowY");
2114 };
2115 var elementCouldBeHScrolled = function(node) {
2116 return elementCanBeScrolled(node, "overflowX");
2117 };
2118 var locationCouldBeScrolled = function(axis, node) {
2119 var ownerDocument = node.ownerDocument;
2120 var current = node;
2121 do {
2122 if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
2123 current = current.host;
2124 }
2125 var isScrollable = elementCouldBeScrolled(axis, current);
2126 if (isScrollable) {
2127 var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
2128 if (scrollHeight > clientHeight) {
2129 return true;
2130 }
2131 }
2132 current = current.parentNode;
2133 } while (current && current !== ownerDocument.body);
2134 return false;
2135 };
2136 var getVScrollVariables = function(_a) {
2137 var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
2138 return [
2139 scrollTop,
2140 scrollHeight,
2141 clientHeight
2142 ];
2143 };
2144 var getHScrollVariables = function(_a) {
2145 var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
2146 return [
2147 scrollLeft,
2148 scrollWidth,
2149 clientWidth
2150 ];
2151 };
2152 var elementCouldBeScrolled = function(axis, node) {
2153 return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
2154 };
2155 var getScrollVariables = function(axis, node) {
2156 return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
2157 };
2158 var getDirectionFactor = function(axis, direction) {
2159 return axis === "h" && direction === "rtl" ? -1 : 1;
2160 };
2161 var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
2162 var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
2163 var delta = directionFactor * sourceDelta;
2164 var target = event.target;
2165 var targetInLock = endTarget.contains(target);
2166 var shouldCancelScroll = false;
2167 var isDeltaPositive = delta > 0;
2168 var availableScroll = 0;
2169 var availableScrollTop = 0;
2170 do {
2171 if (!target) {
2172 break;
2173 }
2174 var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
2175 var elementScroll = scroll_1 - capacity - directionFactor * position;
2176 if (position || elementScroll) {
2177 if (elementCouldBeScrolled(axis, target)) {
2178 availableScroll += elementScroll;
2179 availableScrollTop += position;
2180 }
2181 }
2182 var parent_1 = target.parentNode;
2183 target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
2184 } while (
2185 // portaled content
2186 !targetInLock && target !== document.body || // self content
2187 targetInLock && (endTarget.contains(target) || endTarget === target)
2188 );
2189 if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) {
2190 shouldCancelScroll = true;
2191 } else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) {
2192 shouldCancelScroll = true;
2193 }
2194 return shouldCancelScroll;
2195 };
2196
2197 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
2198 var getTouchXY = function(event) {
2199 return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
2200 };
2201 var getDeltaXY = function(event) {
2202 return [event.deltaX, event.deltaY];
2203 };
2204 var extractRef = function(ref) {
2205 return ref && "current" in ref ? ref.current : ref;
2206 };
2207 var deltaCompare = function(x, y) {
2208 return x[0] === y[0] && x[1] === y[1];
2209 };
2210 var generateStyle = function(id) {
2211 return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
2212 };
2213 var idCounter = 0;
2214 var lockStack = [];
2215 function RemoveScrollSideCar(props) {
2216 var shouldPreventQueue = React35.useRef([]);
2217 var touchStartRef = React35.useRef([0, 0]);
2218 var activeAxis = React35.useRef();
2219 var id = React35.useState(idCounter++)[0];
2220 var Style2 = React35.useState(styleSingleton)[0];
2221 var lastProps = React35.useRef(props);
2222 React35.useEffect(function() {
2223 lastProps.current = props;
2224 }, [props]);
2225 React35.useEffect(function() {
2226 if (props.inert) {
2227 document.body.classList.add("block-interactivity-".concat(id));
2228 var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
2229 allow_1.forEach(function(el) {
2230 return el.classList.add("allow-interactivity-".concat(id));
2231 });
2232 return function() {
2233 document.body.classList.remove("block-interactivity-".concat(id));
2234 allow_1.forEach(function(el) {
2235 return el.classList.remove("allow-interactivity-".concat(id));
2236 });
2237 };
2238 }
2239 return;
2240 }, [props.inert, props.lockRef.current, props.shards]);
2241 var shouldCancelEvent = React35.useCallback(function(event, parent) {
2242 if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
2243 return !lastProps.current.allowPinchZoom;
2244 }
2245 var touch = getTouchXY(event);
2246 var touchStart = touchStartRef.current;
2247 var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
2248 var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
2249 var currentAxis;
2250 var target = event.target;
2251 var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
2252 if ("touches" in event && moveDirection === "h" && target.type === "range") {
2253 return false;
2254 }
2255 var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
2256 if (!canBeScrolledInMainDirection) {
2257 return true;
2258 }
2259 if (canBeScrolledInMainDirection) {
2260 currentAxis = moveDirection;
2261 } else {
2262 currentAxis = moveDirection === "v" ? "h" : "v";
2263 canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
2264 }
2265 if (!canBeScrolledInMainDirection) {
2266 return false;
2267 }
2268 if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
2269 activeAxis.current = currentAxis;
2270 }
2271 if (!currentAxis) {
2272 return true;
2273 }
2274 var cancelingAxis = activeAxis.current || currentAxis;
2275 return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
2276 }, []);
2277 var shouldPrevent = React35.useCallback(function(_event) {
2278 var event = _event;
2279 if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
2280 return;
2281 }
2282 var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
2283 var sourceEvent = shouldPreventQueue.current.filter(function(e) {
2284 return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
2285 })[0];
2286 if (sourceEvent && sourceEvent.should) {
2287 if (event.cancelable) {
2288 event.preventDefault();
2289 }
2290 return;
2291 }
2292 if (!sourceEvent) {
2293 var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
2294 return node.contains(event.target);
2295 });
2296 var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
2297 if (shouldStop) {
2298 if (event.cancelable) {
2299 event.preventDefault();
2300 }
2301 }
2302 }
2303 }, []);
2304 var shouldCancel = React35.useCallback(function(name, delta, target, should) {
2305 var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
2306 shouldPreventQueue.current.push(event);
2307 setTimeout(function() {
2308 shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
2309 return e !== event;
2310 });
2311 }, 1);
2312 }, []);
2313 var scrollTouchStart = React35.useCallback(function(event) {
2314 touchStartRef.current = getTouchXY(event);
2315 activeAxis.current = void 0;
2316 }, []);
2317 var scrollWheel = React35.useCallback(function(event) {
2318 shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
2319 }, []);
2320 var scrollTouchMove = React35.useCallback(function(event) {
2321 shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
2322 }, []);
2323 React35.useEffect(function() {
2324 lockStack.push(Style2);
2325 props.setCallbacks({
2326 onScrollCapture: scrollWheel,
2327 onWheelCapture: scrollWheel,
2328 onTouchMoveCapture: scrollTouchMove
2329 });
2330 document.addEventListener("wheel", shouldPrevent, nonPassive);
2331 document.addEventListener("touchmove", shouldPrevent, nonPassive);
2332 document.addEventListener("touchstart", scrollTouchStart, nonPassive);
2333 return function() {
2334 lockStack = lockStack.filter(function(inst) {
2335 return inst !== Style2;
2336 });
2337 document.removeEventListener("wheel", shouldPrevent, nonPassive);
2338 document.removeEventListener("touchmove", shouldPrevent, nonPassive);
2339 document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
2340 };
2341 }, []);
2342 var removeScrollBar = props.removeScrollBar, inert = props.inert;
2343 return React35.createElement(
2344 React35.Fragment,
2345 null,
2346 inert ? React35.createElement(Style2, { styles: generateStyle(id) }) : null,
2347 removeScrollBar ? React35.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
2348 );
2349 }
2350 function getOutermostShadowParent(node) {
2351 var shadowParent = null;
2352 while (node !== null) {
2353 if (node instanceof ShadowRoot) {
2354 shadowParent = node.host;
2355 node = node.host;
2356 }
2357 node = node.parentNode;
2358 }
2359 return shadowParent;
2360 }
2361
2362 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js
2363 var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
2364
2365 // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js
2366 var ReactRemoveScroll = React36.forwardRef(function(props, ref) {
2367 return React36.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
2368 });
2369 ReactRemoveScroll.classNames = RemoveScroll.classNames;
2370 var Combination_default = ReactRemoveScroll;
2371
2372 // node_modules/aria-hidden/dist/es2015/index.js
2373 var getDefaultParent = function(originalTarget) {
2374 if (typeof document === "undefined") {
2375 return null;
2376 }
2377 var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
2378 return sampleTarget.ownerDocument.body;
2379 };
2380 var counterMap = /* @__PURE__ */ new WeakMap();
2381 var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
2382 var markerMap = {};
2383 var lockCount = 0;
2384 var unwrapHost = function(node) {
2385 return node && (node.host || unwrapHost(node.parentNode));
2386 };
2387 var correctTargets = function(parent, targets) {
2388 return targets.map(function(target) {
2389 if (parent.contains(target)) {
2390 return target;
2391 }
2392 var correctedTarget = unwrapHost(target);
2393 if (correctedTarget && parent.contains(correctedTarget)) {
2394 return correctedTarget;
2395 }
2396 console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
2397 return null;
2398 }).filter(function(x) {
2399 return Boolean(x);
2400 });
2401 };
2402 var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
2403 var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
2404 if (!markerMap[markerName]) {
2405 markerMap[markerName] = /* @__PURE__ */ new WeakMap();
2406 }
2407 var markerCounter = markerMap[markerName];
2408 var hiddenNodes = [];
2409 var elementsToKeep = /* @__PURE__ */ new Set();
2410 var elementsToStop = new Set(targets);
2411 var keep = function(el) {
2412 if (!el || elementsToKeep.has(el)) {
2413 return;
2414 }
2415 elementsToKeep.add(el);
2416 keep(el.parentNode);
2417 };
2418 targets.forEach(keep);
2419 var deep = function(parent) {
2420 if (!parent || elementsToStop.has(parent)) {
2421 return;
2422 }
2423 Array.prototype.forEach.call(parent.children, function(node) {
2424 if (elementsToKeep.has(node)) {
2425 deep(node);
2426 } else {
2427 try {
2428 var attr = node.getAttribute(controlAttribute);
2429 var alreadyHidden = attr !== null && attr !== "false";
2430 var counterValue = (counterMap.get(node) || 0) + 1;
2431 var markerValue = (markerCounter.get(node) || 0) + 1;
2432 counterMap.set(node, counterValue);
2433 markerCounter.set(node, markerValue);
2434 hiddenNodes.push(node);
2435 if (counterValue === 1 && alreadyHidden) {
2436 uncontrolledNodes.set(node, true);
2437 }
2438 if (markerValue === 1) {
2439 node.setAttribute(markerName, "true");
2440 }
2441 if (!alreadyHidden) {
2442 node.setAttribute(controlAttribute, "true");
2443 }
2444 } catch (e) {
2445 console.error("aria-hidden: cannot operate on ", node, e);
2446 }
2447 }
2448 });
2449 };
2450 deep(parentNode);
2451 elementsToKeep.clear();
2452 lockCount++;
2453 return function() {
2454 hiddenNodes.forEach(function(node) {
2455 var counterValue = counterMap.get(node) - 1;
2456 var markerValue = markerCounter.get(node) - 1;
2457 counterMap.set(node, counterValue);
2458 markerCounter.set(node, markerValue);
2459 if (!counterValue) {
2460 if (!uncontrolledNodes.has(node)) {
2461 node.removeAttribute(controlAttribute);
2462 }
2463 uncontrolledNodes.delete(node);
2464 }
2465 if (!markerValue) {
2466 node.removeAttribute(markerName);
2467 }
2468 });
2469 lockCount--;
2470 if (!lockCount) {
2471 counterMap = /* @__PURE__ */ new WeakMap();
2472 counterMap = /* @__PURE__ */ new WeakMap();
2473 uncontrolledNodes = /* @__PURE__ */ new WeakMap();
2474 markerMap = {};
2475 }
2476 };
2477 };
2478 var hideOthers = function(originalTarget, parentNode, markerName) {
2479 if (markerName === void 0) {
2480 markerName = "data-aria-hidden";
2481 }
2482 var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
2483 var activeParentNode = parentNode || getDefaultParent(originalTarget);
2484 if (!activeParentNode) {
2485 return function() {
2486 return null;
2487 };
2488 }
2489 targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
2490 return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
2491 };
2492
2493 // node_modules/@radix-ui/react-dialog/dist/index.mjs
2494 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
2495 var DIALOG_NAME = "Dialog";
2496 var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
2497 var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
2498 var Dialog = (props) => {
2499 const {
2500 __scopeDialog,
2501 children,
2502 open: openProp,
2503 defaultOpen,
2504 onOpenChange,
2505 modal = true
2506 } = props;
2507 const triggerRef = React37.useRef(null);
2508 const contentRef = React37.useRef(null);
2509 const [open2, setOpen] = useControllableState({
2510 prop: openProp,
2511 defaultProp: defaultOpen ?? false,
2512 onChange: onOpenChange,
2513 caller: DIALOG_NAME
2514 });
2515 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2516 DialogProvider,
2517 {
2518 scope: __scopeDialog,
2519 triggerRef,
2520 contentRef,
2521 contentId: useId(),
2522 titleId: useId(),
2523 descriptionId: useId(),
2524 open: open2,
2525 onOpenChange: setOpen,
2526 onOpenToggle: React37.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
2527 modal,
2528 children
2529 }
2530 );
2531 };
2532 Dialog.displayName = DIALOG_NAME;
2533 var TRIGGER_NAME = "DialogTrigger";
2534 var DialogTrigger = React37.forwardRef(
2535 (props, forwardedRef) => {
2536 const { __scopeDialog, ...triggerProps } = props;
2537 const context2 = useDialogContext(TRIGGER_NAME, __scopeDialog);
2538 const composedTriggerRef = useComposedRefs(forwardedRef, context2.triggerRef);
2539 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2540 Primitive4.button,
2541 {
2542 type: "button",
2543 "aria-haspopup": "dialog",
2544 "aria-expanded": context2.open,
2545 "aria-controls": context2.contentId,
2546 "data-state": getState(context2.open),
2547 ...triggerProps,
2548 ref: composedTriggerRef,
2549 onClick: composeEventHandlers(props.onClick, context2.onOpenToggle)
2550 }
2551 );
2552 }
2553 );
2554 DialogTrigger.displayName = TRIGGER_NAME;
2555 var PORTAL_NAME2 = "DialogPortal";
2556 var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
2557 forceMount: void 0
2558 });
2559 var DialogPortal = (props) => {
2560 const { __scopeDialog, forceMount, children, container } = props;
2561 const context2 = useDialogContext(PORTAL_NAME2, __scopeDialog);
2562 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React37.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context2.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Portal, { asChild: true, container, children: child }) })) });
2563 };
2564 DialogPortal.displayName = PORTAL_NAME2;
2565 var OVERLAY_NAME = "DialogOverlay";
2566 var DialogOverlay = React37.forwardRef(
2567 (props, forwardedRef) => {
2568 const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
2569 const { forceMount = portalContext.forceMount, ...overlayProps } = props;
2570 const context2 = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
2571 return context2.modal ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context2.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
2572 }
2573 );
2574 DialogOverlay.displayName = OVERLAY_NAME;
2575 var Slot = createSlot4("DialogOverlay.RemoveScroll");
2576 var DialogOverlayImpl = React37.forwardRef(
2577 (props, forwardedRef) => {
2578 const { __scopeDialog, ...overlayProps } = props;
2579 const context2 = useDialogContext(OVERLAY_NAME, __scopeDialog);
2580 return (
2581 // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2582 // ie. when `Overlay` and `Content` are siblings
2583 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context2.contentRef], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2584 Primitive4.div,
2585 {
2586 "data-state": getState(context2.open),
2587 ...overlayProps,
2588 ref: forwardedRef,
2589 style: { pointerEvents: "auto", ...overlayProps.style }
2590 }
2591 ) })
2592 );
2593 }
2594 );
2595 var CONTENT_NAME = "DialogContent";
2596 var DialogContent = React37.forwardRef(
2597 (props, forwardedRef) => {
2598 const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
2599 const { forceMount = portalContext.forceMount, ...contentProps } = props;
2600 const context2 = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2601 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context2.open, children: context2.modal ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
2602 }
2603 );
2604 DialogContent.displayName = CONTENT_NAME;
2605 var DialogContentModal = React37.forwardRef(
2606 (props, forwardedRef) => {
2607 const context2 = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2608 const contentRef = React37.useRef(null);
2609 const composedRefs = useComposedRefs(forwardedRef, context2.contentRef, contentRef);
2610 React37.useEffect(() => {
2611 const content = contentRef.current;
2612 if (content) return hideOthers(content);
2613 }, []);
2614 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2615 DialogContentImpl,
2616 {
2617 ...props,
2618 ref: composedRefs,
2619 trapFocus: context2.open,
2620 disableOutsidePointerEvents: true,
2621 onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
2622 event.preventDefault();
2623 context2.triggerRef.current?.focus();
2624 }),
2625 onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
2626 const originalEvent = event.detail.originalEvent;
2627 const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
2628 const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
2629 if (isRightClick) event.preventDefault();
2630 }),
2631 onFocusOutside: composeEventHandlers(
2632 props.onFocusOutside,
2633 (event) => event.preventDefault()
2634 )
2635 }
2636 );
2637 }
2638 );
2639 var DialogContentNonModal = React37.forwardRef(
2640 (props, forwardedRef) => {
2641 const context2 = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2642 const hasInteractedOutsideRef = React37.useRef(false);
2643 const hasPointerDownOutsideRef = React37.useRef(false);
2644 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2645 DialogContentImpl,
2646 {
2647 ...props,
2648 ref: forwardedRef,
2649 trapFocus: false,
2650 disableOutsidePointerEvents: false,
2651 onCloseAutoFocus: (event) => {
2652 props.onCloseAutoFocus?.(event);
2653 if (!event.defaultPrevented) {
2654 if (!hasInteractedOutsideRef.current) context2.triggerRef.current?.focus();
2655 event.preventDefault();
2656 }
2657 hasInteractedOutsideRef.current = false;
2658 hasPointerDownOutsideRef.current = false;
2659 },
2660 onInteractOutside: (event) => {
2661 props.onInteractOutside?.(event);
2662 if (!event.defaultPrevented) {
2663 hasInteractedOutsideRef.current = true;
2664 if (event.detail.originalEvent.type === "pointerdown") {
2665 hasPointerDownOutsideRef.current = true;
2666 }
2667 }
2668 const target = event.target;
2669 const targetIsTrigger = context2.triggerRef.current?.contains(target);
2670 if (targetIsTrigger) event.preventDefault();
2671 if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2672 event.preventDefault();
2673 }
2674 }
2675 }
2676 );
2677 }
2678 );
2679 var DialogContentImpl = React37.forwardRef(
2680 (props, forwardedRef) => {
2681 const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
2682 const context2 = useDialogContext(CONTENT_NAME, __scopeDialog);
2683 const contentRef = React37.useRef(null);
2684 const composedRefs = useComposedRefs(forwardedRef, contentRef);
2685 useFocusGuards();
2686 return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2687 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2688 FocusScope,
2689 {
2690 asChild: true,
2691 loop: true,
2692 trapped: trapFocus,
2693 onMountAutoFocus: onOpenAutoFocus,
2694 onUnmountAutoFocus: onCloseAutoFocus,
2695 children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2696 DismissableLayer,
2697 {
2698 role: "dialog",
2699 id: context2.contentId,
2700 "aria-describedby": context2.descriptionId,
2701 "aria-labelledby": context2.titleId,
2702 "data-state": getState(context2.open),
2703 ...contentProps,
2704 ref: composedRefs,
2705 onDismiss: () => context2.onOpenChange(false)
2706 }
2707 )
2708 }
2709 ),
2710 /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2711 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TitleWarning, { titleId: context2.titleId }),
2712 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DescriptionWarning, { contentRef, descriptionId: context2.descriptionId })
2713 ] })
2714 ] });
2715 }
2716 );
2717 var TITLE_NAME = "DialogTitle";
2718 var DialogTitle = React37.forwardRef(
2719 (props, forwardedRef) => {
2720 const { __scopeDialog, ...titleProps } = props;
2721 const context2 = useDialogContext(TITLE_NAME, __scopeDialog);
2722 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Primitive4.h2, { id: context2.titleId, ...titleProps, ref: forwardedRef });
2723 }
2724 );
2725 DialogTitle.displayName = TITLE_NAME;
2726 var DESCRIPTION_NAME = "DialogDescription";
2727 var DialogDescription = React37.forwardRef(
2728 (props, forwardedRef) => {
2729 const { __scopeDialog, ...descriptionProps } = props;
2730 const context2 = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
2731 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Primitive4.p, { id: context2.descriptionId, ...descriptionProps, ref: forwardedRef });
2732 }
2733 );
2734 DialogDescription.displayName = DESCRIPTION_NAME;
2735 var CLOSE_NAME = "DialogClose";
2736 var DialogClose = React37.forwardRef(
2737 (props, forwardedRef) => {
2738 const { __scopeDialog, ...closeProps } = props;
2739 const context2 = useDialogContext(CLOSE_NAME, __scopeDialog);
2740 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2741 Primitive4.button,
2742 {
2743 type: "button",
2744 ...closeProps,
2745 ref: forwardedRef,
2746 onClick: composeEventHandlers(props.onClick, () => context2.onOpenChange(false))
2747 }
2748 );
2749 }
2750 );
2751 DialogClose.displayName = CLOSE_NAME;
2752 function getState(open2) {
2753 return open2 ? "open" : "closed";
2754 }
2755 var TITLE_WARNING_NAME = "DialogTitleWarning";
2756 var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
2757 contentName: CONTENT_NAME,
2758 titleName: TITLE_NAME,
2759 docsSlug: "dialog"
2760 });
2761 var TitleWarning = ({ titleId }) => {
2762 const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
2763 const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
2764
2765 If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
2766
2767 For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
2768 React37.useEffect(() => {
2769 if (titleId) {
2770 const hasTitle = document.getElementById(titleId);
2771 if (!hasTitle) console.error(MESSAGE);
2772 }
2773 }, [MESSAGE, titleId]);
2774 return null;
2775 };
2776 var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
2777 var DescriptionWarning = ({ contentRef, descriptionId }) => {
2778 const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
2779 const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
2780 React37.useEffect(() => {
2781 const describedById = contentRef.current?.getAttribute("aria-describedby");
2782 if (descriptionId && describedById) {
2783 const hasDescription = document.getElementById(descriptionId);
2784 if (!hasDescription) console.warn(MESSAGE);
2785 }
2786 }, [MESSAGE, contentRef, descriptionId]);
2787 return null;
2788 };
2789 var Root = Dialog;
2790 var Portal2 = DialogPortal;
2791 var Overlay = DialogOverlay;
2792 var Content = DialogContent;
2793
2794 // node_modules/cmdk/dist/index.mjs
2795 var t = __toESM(require_react(), 1);
2796
2797 // node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.mjs
2798 var React40 = __toESM(require_react(), 1);
2799 var ReactDOM6 = __toESM(require_react_dom(), 1);
2800
2801 // node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.mjs
2802 var React39 = __toESM(require_react(), 1);
2803
2804 // node_modules/cmdk/node_modules/@radix-ui/react-compose-refs/dist/index.mjs
2805 var React38 = __toESM(require_react(), 1);
2806 function setRef6(ref, value) {
2807 if (typeof ref === "function") {
2808 return ref(value);
2809 } else if (ref !== null && ref !== void 0) {
2810 ref.current = value;
2811 }
2812 }
2813 function composeRefs6(...refs) {
2814 return (node) => {
2815 let hasCleanup = false;
2816 const cleanups = refs.map((ref) => {
2817 const cleanup = setRef6(ref, node);
2818 if (!hasCleanup && typeof cleanup == "function") {
2819 hasCleanup = true;
2820 }
2821 return cleanup;
2822 });
2823 if (hasCleanup) {
2824 return () => {
2825 for (let i = 0; i < cleanups.length; i++) {
2826 const cleanup = cleanups[i];
2827 if (typeof cleanup == "function") {
2828 cleanup();
2829 } else {
2830 setRef6(refs[i], null);
2831 }
2832 }
2833 };
2834 }
2835 };
2836 }
2837
2838 // node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.mjs
2839 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
2840 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
2841 var use = React39[" use ".trim().toString()];
2842 function isPromiseLike(value) {
2843 return typeof value === "object" && value !== null && "then" in value;
2844 }
2845 function isLazyComponent(element) {
2846 return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
2847 }
2848 // @__NO_SIDE_EFFECTS__
2849 function createSlot5(ownerName) {
2850 const SlotClone = /* @__PURE__ */ createSlotClone5(ownerName);
2851 const Slot2 = React39.forwardRef((props, forwardedRef) => {
2852 let { children, ...slotProps } = props;
2853 if (isLazyComponent(children) && typeof use === "function") {
2854 children = use(children._payload);
2855 }
2856 const childrenArray = React39.Children.toArray(children);
2857 const slottable = childrenArray.find(isSlottable5);
2858 if (slottable) {
2859 const newElement = slottable.props.children;
2860 const newChildren = childrenArray.map((child) => {
2861 if (child === slottable) {
2862 if (React39.Children.count(newElement) > 1) return React39.Children.only(null);
2863 return React39.isValidElement(newElement) ? newElement.props.children : null;
2864 } else {
2865 return child;
2866 }
2867 });
2868 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React39.isValidElement(newElement) ? React39.cloneElement(newElement, void 0, newChildren) : null });
2869 }
2870 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
2871 });
2872 Slot2.displayName = `${ownerName}.Slot`;
2873 return Slot2;
2874 }
2875 // @__NO_SIDE_EFFECTS__
2876 function createSlotClone5(ownerName) {
2877 const SlotClone = React39.forwardRef((props, forwardedRef) => {
2878 let { children, ...slotProps } = props;
2879 if (isLazyComponent(children) && typeof use === "function") {
2880 children = use(children._payload);
2881 }
2882 if (React39.isValidElement(children)) {
2883 const childrenRef = getElementRef6(children);
2884 const props2 = mergeProps5(slotProps, children.props);
2885 if (children.type !== React39.Fragment) {
2886 props2.ref = forwardedRef ? composeRefs6(forwardedRef, childrenRef) : childrenRef;
2887 }
2888 return React39.cloneElement(children, props2);
2889 }
2890 return React39.Children.count(children) > 1 ? React39.Children.only(null) : null;
2891 });
2892 SlotClone.displayName = `${ownerName}.SlotClone`;
2893 return SlotClone;
2894 }
2895 var SLOTTABLE_IDENTIFIER5 = /* @__PURE__ */ Symbol("radix.slottable");
2896 function isSlottable5(child) {
2897 return React39.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER5;
2898 }
2899 function mergeProps5(slotProps, childProps) {
2900 const overrideProps = { ...childProps };
2901 for (const propName in childProps) {
2902 const slotPropValue = slotProps[propName];
2903 const childPropValue = childProps[propName];
2904 const isHandler = /^on[A-Z]/.test(propName);
2905 if (isHandler) {
2906 if (slotPropValue && childPropValue) {
2907 overrideProps[propName] = (...args) => {
2908 const result = childPropValue(...args);
2909 slotPropValue(...args);
2910 return result;
2911 };
2912 } else if (slotPropValue) {
2913 overrideProps[propName] = slotPropValue;
2914 }
2915 } else if (propName === "style") {
2916 overrideProps[propName] = { ...slotPropValue, ...childPropValue };
2917 } else if (propName === "className") {
2918 overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
2919 }
2920 }
2921 return { ...slotProps, ...overrideProps };
2922 }
2923 function getElementRef6(element) {
2924 let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
2925 let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
2926 if (mayWarn) {
2927 return element.ref;
2928 }
2929 getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
2930 mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
2931 if (mayWarn) {
2932 return element.props.ref;
2933 }
2934 return element.props.ref || element.ref;
2935 }
2936
2937 // node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.mjs
2938 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
2939 var NODES5 = [
2940 "a",
2941 "button",
2942 "div",
2943 "form",
2944 "h2",
2945 "h3",
2946 "img",
2947 "input",
2948 "label",
2949 "li",
2950 "nav",
2951 "ol",
2952 "p",
2953 "select",
2954 "span",
2955 "svg",
2956 "ul"
2957 ];
2958 var Primitive5 = NODES5.reduce((primitive, node) => {
2959 const Slot2 = createSlot5(`Primitive.${node}`);
2960 const Node2 = React40.forwardRef((props, forwardedRef) => {
2961 const { asChild, ...primitiveProps } = props;
2962 const Comp = asChild ? Slot2 : node;
2963 if (typeof window !== "undefined") {
2964 window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
2965 }
2966 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
2967 });
2968 Node2.displayName = `Primitive.${node}`;
2969 return { ...primitive, [node]: Node2 };
2970 }, {});
2971
2972 // node_modules/cmdk/node_modules/@radix-ui/react-id/dist/index.mjs
2973 var React42 = __toESM(require_react(), 1);
2974
2975 // node_modules/cmdk/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
2976 var React41 = __toESM(require_react(), 1);
2977 var useLayoutEffect24 = globalThis?.document ? React41.useLayoutEffect : () => {
2978 };
2979
2980 // node_modules/cmdk/node_modules/@radix-ui/react-id/dist/index.mjs
2981 var useReactId2 = React42[" useId ".trim().toString()] || (() => void 0);
2982 var count3 = 0;
2983 function useId2(deterministicId) {
2984 const [id, setId] = React42.useState(useReactId2());
2985 useLayoutEffect24(() => {
2986 if (!deterministicId) setId((reactId) => reactId ?? String(count3++));
2987 }, [deterministicId]);
2988 return deterministicId || (id ? `radix-${id}` : "");
2989 }
2990
2991 // node_modules/cmdk/dist/index.mjs
2992 var N = '[cmdk-group=""]';
2993 var Y2 = '[cmdk-group-items=""]';
2994 var be = '[cmdk-group-heading=""]';
2995 var le = '[cmdk-item=""]';
2996 var ce = `${le}:not([aria-disabled="true"])`;
2997 var Z = "cmdk-item-select";
2998 var T = "data-value";
2999 var Re = (r2, o, n) => W(r2, o, n);
3000 var ue = t.createContext(void 0);
3001 var K2 = () => t.useContext(ue);
3002 var de = t.createContext(void 0);
3003 var ee = () => t.useContext(de);
3004 var fe = t.createContext(void 0);
3005 var me = t.forwardRef((r2, o) => {
3006 let n = L(() => {
3007 var e, a;
3008 return { search: "", value: (a = (e = r2.value) != null ? e : r2.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
3009 }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r2), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r2, $2 = useId2(), q = useId2(), _ = useId2(), I = t.useRef(null), v = ke();
3010 k2(() => {
3011 if (R !== void 0) {
3012 let e = R.trim();
3013 n.current.value = e, E.emit();
3014 }
3015 }, [R]), k2(() => {
3016 v(6, ne);
3017 }, []);
3018 let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => {
3019 var i, l, g, y;
3020 if (!Object.is(n.current[e], a)) {
3021 if (n.current[e] = a, e === "search") J2(), z(), v(1, W2);
3022 else if (e === "value") {
3023 if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
3024 let h = document.getElementById(_);
3025 h ? h.focus() : (i = document.getElementById($2)) == null || i.focus();
3026 }
3027 if (v(7, () => {
3028 var h;
3029 n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit();
3030 }), s || v(5, ne), ((l = p2.current) == null ? void 0 : l.value) !== void 0) {
3031 let h = a != null ? a : "";
3032 (y = (g = p2.current).onValueChange) == null || y.call(g, h);
3033 return;
3034 }
3035 }
3036 E.emit();
3037 }
3038 }, emit: () => {
3039 f.current.forEach((e) => e());
3040 } }), []), U2 = t.useMemo(() => ({ value: (e, a, s) => {
3041 var i;
3042 a !== ((i = d.current.get(e)) == null ? void 0 : i.value) && (d.current.set(e, { value: a, keywords: s }), n.current.filtered.items.set(e, te(a, s)), v(2, () => {
3043 z(), E.emit();
3044 }));
3045 }, item: (e, a) => (u2.current.add(e), a && (c.current.has(a) ? c.current.get(a).add(e) : c.current.set(a, /* @__PURE__ */ new Set([e]))), v(3, () => {
3046 J2(), z(), n.current.value || W2(), E.emit();
3047 }), () => {
3048 d.current.delete(e), u2.current.delete(e), n.current.filtered.items.delete(e);
3049 let s = M();
3050 v(4, () => {
3051 J2(), (s == null ? void 0 : s.getAttribute("id")) === e && W2(), E.emit();
3052 });
3053 }), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
3054 d.current.delete(e), c.current.delete(e);
3055 }), filter: () => p2.current.shouldFilter, label: b || r2["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: $2, inputId: _, labelId: q, listInnerRef: I }), []);
3056 function te(e, a) {
3057 var i, l;
3058 let s = (l = (i = p2.current) == null ? void 0 : i.filter) != null ? l : Re;
3059 return e ? s(e, n.current.search, a) : 0;
3060 }
3061 function z() {
3062 if (!n.current.search || p2.current.shouldFilter === false) return;
3063 let e = n.current.filtered.items, a = [];
3064 n.current.filtered.groups.forEach((i) => {
3065 let l = c.current.get(i), g = 0;
3066 l.forEach((y) => {
3067 let h = e.get(y);
3068 g = Math.max(h, g);
3069 }), a.push([i, g]);
3070 });
3071 let s = I.current;
3072 V().sort((i, l) => {
3073 var h, F;
3074 let g = i.getAttribute("id"), y = l.getAttribute("id");
3075 return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0);
3076 }).forEach((i) => {
3077 let l = i.closest(Y2);
3078 l ? l.appendChild(i.parentElement === l ? i : i.closest(`${Y2} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`${Y2} > *`));
3079 }), a.sort((i, l) => l[1] - i[1]).forEach((i) => {
3080 var g;
3081 let l = (g = I.current) == null ? void 0 : g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);
3082 l == null || l.parentElement.appendChild(l);
3083 });
3084 }
3085 function W2() {
3086 let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T);
3087 E.setState("value", a || void 0);
3088 }
3089 function J2() {
3090 var a, s, i, l;
3091 if (!n.current.search || p2.current.shouldFilter === false) {
3092 n.current.filtered.count = u2.current.size;
3093 return;
3094 }
3095 n.current.filtered.groups = /* @__PURE__ */ new Set();
3096 let e = 0;
3097 for (let g of u2.current) {
3098 let y = (s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", h = (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : [], F = te(y, h);
3099 n.current.filtered.items.set(g, F), F > 0 && e++;
3100 }
3101 for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
3102 n.current.filtered.groups.add(g);
3103 break;
3104 }
3105 n.current.filtered.count = e;
3106 }
3107 function ne() {
3108 var a, s, i;
3109 let e = M();
3110 e && (((a = e.parentElement) == null ? void 0 : a.firstChild) === e && ((i = (s = e.closest(N)) == null ? void 0 : s.querySelector(be)) == null || i.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" }));
3111 }
3112 function M() {
3113 var e;
3114 return (e = I.current) == null ? void 0 : e.querySelector(`${le}[aria-selected="true"]`);
3115 }
3116 function V() {
3117 var e;
3118 return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
3119 }
3120 function X2(e) {
3121 let s = V()[e];
3122 s && E.setState("value", s.getAttribute(T));
3123 }
3124 function Q(e) {
3125 var g;
3126 let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e];
3127 (g = p2.current) != null && g.loop && (l = i + e < 0 ? s[s.length - 1] : i + e === s.length ? s[0] : s[i + e]), l && E.setState("value", l.getAttribute(T));
3128 }
3129 function re(e) {
3130 let a = M(), s = a == null ? void 0 : a.closest(N), i;
3131 for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
3132 i ? E.setState("value", i.getAttribute(T)) : Q(e);
3133 }
3134 let oe = () => X2(V().length - 1), ie = (e) => {
3135 e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
3136 }, se = (e) => {
3137 e.preventDefault(), e.metaKey ? X2(0) : e.altKey ? re(-1) : Q(-1);
3138 };
3139 return t.createElement(Primitive5.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
3140 var s;
3141 (s = O.onKeyDown) == null || s.call(O, e);
3142 let a = e.nativeEvent.isComposing || e.keyCode === 229;
3143 if (!(e.defaultPrevented || a)) switch (e.key) {
3144 case "n":
3145 case "j": {
3146 j && e.ctrlKey && ie(e);
3147 break;
3148 }
3149 case "ArrowDown": {
3150 ie(e);
3151 break;
3152 }
3153 case "p":
3154 case "k": {
3155 j && e.ctrlKey && se(e);
3156 break;
3157 }
3158 case "ArrowUp": {
3159 se(e);
3160 break;
3161 }
3162 case "Home": {
3163 e.preventDefault(), X2(0);
3164 break;
3165 }
3166 case "End": {
3167 e.preventDefault(), oe();
3168 break;
3169 }
3170 case "Enter": {
3171 e.preventDefault();
3172 let i = M();
3173 if (i) {
3174 let l = new Event(Z);
3175 i.dispatchEvent(l);
3176 }
3177 }
3178 }
3179 } }, t.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r2, (e) => t.createElement(de.Provider, { value: E }, t.createElement(ue.Provider, { value: U2 }, e))));
3180 });
3181 var he = t.forwardRef((r2, o) => {
3182 var _, I;
3183 let n = useId2(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r2), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
3184 k2(() => {
3185 if (!p2) return d.item(n, c == null ? void 0 : c.id);
3186 }, [p2]);
3187 let b = ve(n, u2, [r2.value, r2.children, u2], r2.keywords), m2 = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p2 || d.filter() === false ? true : v.search ? v.filtered.items.get(n) > 0 : true);
3188 t.useEffect(() => {
3189 let v = u2.current;
3190 if (!(!v || r2.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
3191 }, [x, r2.onSelect, r2.disabled]);
3192 function C() {
3193 var v, E;
3194 S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current);
3195 }
3196 function S() {
3197 m2.setState("value", b.current, true);
3198 }
3199 if (!x) return null;
3200 let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r2;
3201 return t.createElement(Primitive5.div, { ref: composeRefs6(u2, o), ...q, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!A, "aria-selected": !!R, "data-disabled": !!A, "data-selected": !!R, onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S, onClick: A ? void 0 : C }, r2.children);
3202 });
3203 var Ee = t.forwardRef((r2, o) => {
3204 let { heading: n, children: u2, forceMount: c, ...d } = r2, f = useId2(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId2(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
3205 k2(() => R.group(f), []), ve(f, p2, [r2.value, r2.heading, b]);
3206 let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
3207 return t.createElement(Primitive5.div, { ref: composeRefs6(p2, o), ...d, "cmdk-group": "", role: "presentation", hidden: x ? void 0 : true }, n && t.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": true, id: m2 }, n), B2(r2, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
3208 });
3209 var ye = t.forwardRef((r2, o) => {
3210 let { alwaysRender: n, ...u2 } = r2, c = t.useRef(null), d = P((f) => !f.search);
3211 return !n && !d ? null : t.createElement(Primitive5.div, { ref: composeRefs6(c, o), ...u2, "cmdk-separator": "", role: "separator" });
3212 });
3213 var Se = t.forwardRef((r2, o) => {
3214 let { onValueChange: n, ...u2 } = r2, c = r2.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
3215 return t.useEffect(() => {
3216 r2.value != null && d.setState("search", r2.value);
3217 }, [r2.value]), t.createElement(Primitive5.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": p2, id: b.inputId, type: "text", value: c ? r2.value : f, onChange: (m2) => {
3218 c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
3219 } });
3220 });
3221 var Ce = t.forwardRef((r2, o) => {
3222 let { children: n, label: u2 = "Suggestions", ...c } = r2, d = t.useRef(null), f = t.useRef(null), p2 = P((m2) => m2.selectedItemId), b = K2();
3223 return t.useEffect(() => {
3224 if (f.current && d.current) {
3225 let m2 = f.current, R = d.current, x, C = new ResizeObserver(() => {
3226 x = requestAnimationFrame(() => {
3227 let S = m2.offsetHeight;
3228 R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
3229 });
3230 });
3231 return C.observe(m2), () => {
3232 cancelAnimationFrame(x), C.unobserve(m2);
3233 };
3234 }
3235 }, []), t.createElement(Primitive5.div, { ref: composeRefs6(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r2, (m2) => t.createElement("div", { ref: composeRefs6(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
3236 });
3237 var xe = t.forwardRef((r2, o) => {
3238 let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r2;
3239 return t.createElement(Root, { open: n, onOpenChange: u2 }, t.createElement(Portal2, { container: f }, t.createElement(Overlay, { "cmdk-overlay": "", className: c }), t.createElement(Content, { "aria-label": r2.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
3240 });
3241 var Ie = t.forwardRef((r2, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive5.div, { ref: o, ...r2, "cmdk-empty": "", role: "presentation" }) : null);
3242 var Pe = t.forwardRef((r2, o) => {
3243 let { progress: n, children: u2, label: c = "Loading...", ...d } = r2;
3244 return t.createElement(Primitive5.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r2, (f) => t.createElement("div", { "aria-hidden": true }, f)));
3245 });
3246 var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
3247 function we(r2, o) {
3248 let n = r2.nextElementSibling;
3249 for (; n; ) {
3250 if (n.matches(o)) return n;
3251 n = n.nextElementSibling;
3252 }
3253 }
3254 function De(r2, o) {
3255 let n = r2.previousElementSibling;
3256 for (; n; ) {
3257 if (n.matches(o)) return n;
3258 n = n.previousElementSibling;
3259 }
3260 }
3261 function pe(r2) {
3262 let o = t.useRef(r2);
3263 return k2(() => {
3264 o.current = r2;
3265 }), o;
3266 }
3267 var k2 = typeof window == "undefined" ? t.useEffect : t.useLayoutEffect;
3268 function L(r2) {
3269 let o = t.useRef();
3270 return o.current === void 0 && (o.current = r2()), o;
3271 }
3272 function P(r2) {
3273 let o = ee(), n = () => r2(o.snapshot());
3274 return t.useSyncExternalStore(o.subscribe, n, n);
3275 }
3276 function ve(r2, o, n, u2 = []) {
3277 let c = t.useRef(), d = K2();
3278 return k2(() => {
3279 var b;
3280 let f = (() => {
3281 var m2;
3282 for (let R of n) {
3283 if (typeof R == "string") return R.trim();
3284 if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
3285 }
3286 })(), p2 = u2.map((m2) => m2.trim());
3287 d.value(r2, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
3288 }), c;
3289 }
3290 var ke = () => {
3291 let [r2, o] = t.useState(), n = L(() => /* @__PURE__ */ new Map());
3292 return k2(() => {
3293 n.current.forEach((u2) => u2()), n.current = /* @__PURE__ */ new Map();
3294 }, [r2]), (u2, c) => {
3295 n.current.set(u2, c), o({});
3296 };
3297 };
3298 function Me(r2) {
3299 let o = r2.type;
3300 return typeof o == "function" ? o(r2.props) : "render" in o ? o.render(r2.props) : r2;
3301 }
3302 function B2({ asChild: r2, children: o }, n) {
3303 return r2 && t.isValidElement(o) ? t.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o);
3304 }
3305 var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
3306
3307 // node_modules/clsx/dist/clsx.mjs
3308 function r(e) {
3309 var t2, f, n = "";
3310 if ("string" == typeof e || "number" == typeof e) n += e;
3311 else if ("object" == typeof e) if (Array.isArray(e)) {
3312 var o = e.length;
3313 for (t2 = 0; t2 < o; t2++) e[t2] && (f = r(e[t2])) && (n && (n += " "), n += f);
3314 } else for (f in e) e[f] && (n && (n += " "), n += f);
3315 return n;
3316 }
3317 function clsx() {
3318 for (var e, t2, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t2 = r(e)) && (n && (n += " "), n += t2);
3319 return n;
3320 }
3321 var clsx_default = clsx;
3322
3323 // packages/commands/build-module/components/command-menu.mjs
3324 var import_data5 = __toESM(require_data(), 1);
3325 var import_element3 = __toESM(require_element(), 1);
3326 var import_i18n = __toESM(require_i18n(), 1);
3327 var import_components = __toESM(require_components(), 1);
3328 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
3329
3330 // packages/icons/build-module/icon/index.mjs
3331 var import_element = __toESM(require_element(), 1);
3332 var icon_default = (0, import_element.forwardRef)(
3333 ({ icon, size = 24, ...props }, ref) => {
3334 return (0, import_element.cloneElement)(icon, {
3335 width: size,
3336 height: size,
3337 ...props,
3338 ref
3339 });
3340 }
3341 );
3342
3343 // packages/icons/build-module/library/arrow-right.mjs
3344 var import_primitives = __toESM(require_primitives(), 1);
3345 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
3346 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) });
3347
3348 // packages/icons/build-module/library/search.mjs
3349 var import_primitives2 = __toESM(require_primitives(), 1);
3350 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
3351 var search_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives2.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) });
3352
3353 // packages/commands/build-module/store/index.mjs
3354 var import_data3 = __toESM(require_data(), 1);
3355
3356 // packages/commands/build-module/store/reducer.mjs
3357 var import_data = __toESM(require_data(), 1);
3358 function commands(state = {}, action) {
3359 switch (action.type) {
3360 case "REGISTER_COMMAND":
3361 return {
3362 ...state,
3363 [action.name]: {
3364 name: action.name,
3365 label: action.label,
3366 searchLabel: action.searchLabel,
3367 context: action.context,
3368 category: action.category,
3369 callback: action.callback,
3370 icon: action.icon,
3371 keywords: action.keywords
3372 }
3373 };
3374 case "UNREGISTER_COMMAND": {
3375 const { [action.name]: _, ...remainingState } = state;
3376 return remainingState;
3377 }
3378 }
3379 return state;
3380 }
3381 function commandLoaders(state = {}, action) {
3382 switch (action.type) {
3383 case "REGISTER_COMMAND_LOADER":
3384 return {
3385 ...state,
3386 [action.name]: {
3387 name: action.name,
3388 context: action.context,
3389 category: action.category,
3390 hook: action.hook
3391 }
3392 };
3393 case "UNREGISTER_COMMAND_LOADER": {
3394 const { [action.name]: _, ...remainingState } = state;
3395 return remainingState;
3396 }
3397 }
3398 return state;
3399 }
3400 function isOpen(state = false, action) {
3401 switch (action.type) {
3402 case "OPEN":
3403 return true;
3404 case "CLOSE":
3405 return false;
3406 }
3407 return state;
3408 }
3409 function context(state = "root", action) {
3410 switch (action.type) {
3411 case "SET_CONTEXT":
3412 return action.context;
3413 }
3414 return state;
3415 }
3416 function loaderStates(state = {}, action) {
3417 switch (action.type) {
3418 case "SET_LOADER_LOADING":
3419 return {
3420 ...state,
3421 [action.name]: action.isLoading
3422 };
3423 }
3424 return state;
3425 }
3426 var reducer = (0, import_data.combineReducers)({
3427 commands,
3428 commandLoaders,
3429 isOpen,
3430 context,
3431 loaderStates
3432 });
3433 var reducer_default = reducer;
3434
3435 // packages/commands/build-module/store/actions.mjs
3436 var actions_exports = {};
3437 __export(actions_exports, {
3438 close: () => close,
3439 open: () => open,
3440 registerCommand: () => registerCommand,
3441 registerCommandLoader: () => registerCommandLoader,
3442 unregisterCommand: () => unregisterCommand,
3443 unregisterCommandLoader: () => unregisterCommandLoader
3444 });
3445 var REGISTERABLE_CATEGORIES = /* @__PURE__ */ new Set([
3446 "command",
3447 "view",
3448 "edit",
3449 "action"
3450 ]);
3451 function registerCommand(config) {
3452 let { category } = config;
3453 if (!category || !REGISTERABLE_CATEGORIES.has(category)) {
3454 category = "action";
3455 }
3456 return {
3457 type: "REGISTER_COMMAND",
3458 ...config,
3459 category
3460 };
3461 }
3462 function unregisterCommand(name) {
3463 return {
3464 type: "UNREGISTER_COMMAND",
3465 name
3466 };
3467 }
3468 function registerCommandLoader(config) {
3469 let { category } = config;
3470 if (!category || !REGISTERABLE_CATEGORIES.has(category)) {
3471 category = "action";
3472 }
3473 return {
3474 type: "REGISTER_COMMAND_LOADER",
3475 ...config,
3476 category
3477 };
3478 }
3479 function unregisterCommandLoader(name) {
3480 return {
3481 type: "UNREGISTER_COMMAND_LOADER",
3482 name
3483 };
3484 }
3485 function open() {
3486 return {
3487 type: "OPEN"
3488 };
3489 }
3490 function close() {
3491 return {
3492 type: "CLOSE"
3493 };
3494 }
3495
3496 // packages/commands/build-module/store/selectors.mjs
3497 var selectors_exports = {};
3498 __export(selectors_exports, {
3499 getCommandLoaders: () => getCommandLoaders,
3500 getCommands: () => getCommands,
3501 getContext: () => getContext,
3502 isOpen: () => isOpen2
3503 });
3504 var import_data2 = __toESM(require_data(), 1);
3505 var getCommands = (0, import_data2.createSelector)(
3506 (state, contextual = false) => Object.values(state.commands).filter((command) => {
3507 const isContextual = command.context && command.context === state.context;
3508 return contextual ? isContextual : !isContextual;
3509 }),
3510 (state) => [state.commands, state.context]
3511 );
3512 var getCommandLoaders = (0, import_data2.createSelector)(
3513 (state, contextual = false) => Object.values(state.commandLoaders).filter((loader) => {
3514 const isContextual = loader.context && loader.context === state.context;
3515 return contextual ? isContextual : !isContextual;
3516 }),
3517 (state) => [state.commandLoaders, state.context]
3518 );
3519 function isOpen2(state) {
3520 return state.isOpen;
3521 }
3522 function getContext(state) {
3523 return state.context;
3524 }
3525
3526 // packages/commands/build-module/store/private-actions.mjs
3527 var private_actions_exports = {};
3528 __export(private_actions_exports, {
3529 setContext: () => setContext,
3530 setLoaderLoading: () => setLoaderLoading
3531 });
3532 function setContext(context2) {
3533 return {
3534 type: "SET_CONTEXT",
3535 context: context2
3536 };
3537 }
3538 function setLoaderLoading(name, isLoading2) {
3539 return {
3540 type: "SET_LOADER_LOADING",
3541 name,
3542 isLoading: isLoading2
3543 };
3544 }
3545
3546 // packages/commands/build-module/store/private-selectors.mjs
3547 var private_selectors_exports = {};
3548 __export(private_selectors_exports, {
3549 isLoading: () => isLoading
3550 });
3551 function isLoading(state) {
3552 return Object.values(state.loaderStates).some(Boolean);
3553 }
3554
3555 // packages/commands/build-module/lock-unlock.mjs
3556 var import_private_apis = __toESM(require_private_apis(), 1);
3557 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
3558 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
3559 "@wordpress/commands"
3560 );
3561
3562 // packages/commands/build-module/store/index.mjs
3563 var STORE_NAME = "core/commands";
3564 var store = (0, import_data3.createReduxStore)(STORE_NAME, {
3565 reducer: reducer_default,
3566 actions: actions_exports,
3567 selectors: selectors_exports
3568 });
3569 (0, import_data3.register)(store);
3570 unlock(store).registerPrivateActions(private_actions_exports);
3571 unlock(store).registerPrivateSelectors(private_selectors_exports);
3572
3573 // packages/commands/build-module/components/use-recent-commands.mjs
3574 var import_data4 = __toESM(require_data(), 1);
3575 var import_preferences = __toESM(require_preferences(), 1);
3576 var import_element2 = __toESM(require_element(), 1);
3577 var MAX_RECENTLY_SAVED = 30;
3578 var MAX_RECENTLY_DISPLAYED = 5;
3579 var EMPTY_ARRAY = [];
3580 var EMPTY_SET = /* @__PURE__ */ new Set();
3581 function recordUsage(name) {
3582 const current = (0, import_data4.select)(import_preferences.store).get(
3583 "core/commands",
3584 "recentlyUsed"
3585 ) ?? [];
3586 const next = [name, ...current.filter((n) => n !== name)].slice(
3587 0,
3588 MAX_RECENTLY_SAVED
3589 );
3590 (0, import_data4.dispatch)(import_preferences.store).set("core/commands", "recentlyUsed", next);
3591 }
3592 function useLoaderCollector(hook, name, filterNames, onResolved) {
3593 const { setLoaderLoading: setLoaderLoading2 } = unlock((0, import_data4.useDispatch)(store));
3594 const { isLoading: loading, commands: commands2 = [] } = hook({ search: "" }) ?? {};
3595 (0, import_element2.useEffect)(() => {
3596 setLoaderLoading2(name, loading);
3597 }, [setLoaderLoading2, name, loading]);
3598 const filtered = filterNames ? commands2.filter((c) => filterNames.has(c.name)) : commands2;
3599 (0, import_element2.useEffect)(() => {
3600 onResolved(name, filtered);
3601 }, [onResolved, name, filtered]);
3602 (0, import_element2.useEffect)(() => {
3603 return () => onResolved(name, []);
3604 }, [onResolved, name]);
3605 }
3606 function useRecentCommands() {
3607 const {
3608 contextualCommands,
3609 staticCommands,
3610 contextualLoaders,
3611 staticLoaders,
3612 recentlyUsedNames = EMPTY_ARRAY
3613 } = (0, import_data4.useSelect)((select) => {
3614 const { getCommands: getCommands2, getCommandLoaders: getCommandLoaders2 } = select(store);
3615 return {
3616 contextualCommands: getCommands2(true),
3617 staticCommands: getCommands2(false),
3618 contextualLoaders: getCommandLoaders2(true),
3619 staticLoaders: getCommandLoaders2(false),
3620 recentlyUsedNames: select(import_preferences.store).get(
3621 "core/commands",
3622 "recentlyUsed"
3623 )
3624 };
3625 }, []);
3626 const [resolvedMap, setResolvedMap] = (0, import_element2.useState)(() => /* @__PURE__ */ new Map());
3627 const onResolved = (0, import_element2.useCallback)((loaderName, cmds) => {
3628 setResolvedMap((prev) => {
3629 const prevCmds = prev.get(loaderName);
3630 if (prevCmds && prevCmds.length === cmds.length && prevCmds.every((c, i) => c.name === cmds[i].name)) {
3631 return prev;
3632 }
3633 const next = new Map(prev);
3634 next.set(loaderName, cmds);
3635 return next;
3636 });
3637 }, []);
3638 const { recentNames, recentSet } = (0, import_element2.useMemo)(() => {
3639 const names = recentlyUsedNames.slice(0, MAX_RECENTLY_DISPLAYED);
3640 return { recentNames: names, recentSet: new Set(names) };
3641 }, [recentlyUsedNames]);
3642 if (!recentlyUsedNames.length) {
3643 return {
3644 commands: [],
3645 loaders: [],
3646 recentSet: EMPTY_SET,
3647 onResolved
3648 };
3649 }
3650 const allStaticCommands = [...contextualCommands, ...staticCommands];
3651 const loaders = [...contextualLoaders, ...staticLoaders];
3652 const allByName = /* @__PURE__ */ new Map();
3653 allStaticCommands.forEach((c) => allByName.set(c.name, c));
3654 for (const cmds of resolvedMap.values()) {
3655 cmds.forEach((c) => {
3656 if (!allByName.has(c.name)) {
3657 allByName.set(c.name, c);
3658 }
3659 });
3660 }
3661 const commands2 = recentNames.map((n) => allByName.get(n)).filter(Boolean);
3662 return { commands: commands2, loaders, recentSet, onResolved };
3663 }
3664
3665 // packages/commands/build-module/components/command-menu.mjs
3666 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
3667 var { withIgnoreIMEEvents } = unlock(import_components.privateApis);
3668 var ITEM_ID_PREFIX = "command-palette-item-";
3669 var inputLabel = (0, import_i18n.__)("Search commands and settings");
3670 var CATEGORY_ICONS = {
3671 view: arrow_right_default
3672 };
3673 var CATEGORY_LABELS = {
3674 command: (0, import_i18n.__)("Command"),
3675 view: (0, import_i18n.__)("View"),
3676 edit: (0, import_i18n.__)("Edit"),
3677 action: (0, import_i18n.__)("Action"),
3678 workflow: (0, import_i18n.__)("Workflow")
3679 };
3680 function isValidIcon(icon) {
3681 return !!icon && (typeof icon === "string" || (0, import_element3.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element3.Component);
3682 }
3683 function CommandItem({ command, search, category, valuePrefix }) {
3684 const { close: close2 } = (0, import_data5.useDispatch)(store);
3685 const commandCategory = category ?? command.category;
3686 const label = command.searchLabel ?? command.label;
3687 const value = valuePrefix ? `${valuePrefix}${command.name}` : label;
3688 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3689 _e.Item,
3690 {
3691 id: `${ITEM_ID_PREFIX}${value.toLowerCase()}`,
3692 value,
3693 keywords: valuePrefix ? [...command.keywords ?? [], label] : command.keywords,
3694 onSelect: () => {
3695 recordUsage(command.name);
3696 command.callback({ close: close2 });
3697 },
3698 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3699 import_components.__experimentalHStack,
3700 {
3701 alignment: "left",
3702 className: clsx_default("commands-command-menu__item", {
3703 "has-icon": CATEGORY_ICONS[commandCategory] || command.icon
3704 }),
3705 children: [
3706 CATEGORY_ICONS[commandCategory] ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(icon_default, { icon: CATEGORY_ICONS[commandCategory] }) : isValidIcon(command.icon) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(icon_default, { icon: command.icon }),
3707 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "commands-command-menu__item-label", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3708 import_components.TextHighlight,
3709 {
3710 text: command.label,
3711 highlight: search
3712 }
3713 ) }),
3714 CATEGORY_LABELS[commandCategory] && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "commands-command-menu__item-category", children: CATEGORY_LABELS[commandCategory] })
3715 ]
3716 }
3717 )
3718 },
3719 command.name
3720 );
3721 }
3722 function CommandMenuLoader({ name, search, hook, category, valuePrefix }) {
3723 const { setLoaderLoading: setLoaderLoading2 } = unlock((0, import_data5.useDispatch)(store));
3724 const { isLoading: loading, commands: commands2 = [] } = hook({ search }) ?? {};
3725 (0, import_element3.useEffect)(() => {
3726 setLoaderLoading2(name, loading);
3727 }, [setLoaderLoading2, name, loading]);
3728 if (!commands2.length) {
3729 return null;
3730 }
3731 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: commands2.map((command) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3732 CommandItem,
3733 {
3734 command,
3735 search,
3736 category: command.category ?? category,
3737 valuePrefix
3738 },
3739 command.name
3740 )) });
3741 }
3742 function CommandMenuLoaderWrapper({ hook, ...props }) {
3743 const currentLoaderRef = (0, import_element3.useRef)(hook);
3744 const [key, setKey] = (0, import_element3.useState)(0);
3745 (0, import_element3.useEffect)(() => {
3746 if (currentLoaderRef.current !== hook) {
3747 currentLoaderRef.current = hook;
3748 setKey((prevKey) => prevKey + 1);
3749 }
3750 }, [hook]);
3751 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3752 CommandMenuLoader,
3753 {
3754 hook: currentLoaderRef.current,
3755 ...props
3756 },
3757 key
3758 );
3759 }
3760 function CommandList({ search, commands: commands2, loaders, valuePrefix }) {
3761 return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3762 commands2.map((command) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3763 CommandItem,
3764 {
3765 command,
3766 search,
3767 valuePrefix
3768 },
3769 command.name
3770 )),
3771 loaders.map((loader) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3772 CommandMenuLoaderWrapper,
3773 {
3774 name: loader.name,
3775 search,
3776 hook: loader.hook,
3777 category: loader.category,
3778 valuePrefix
3779 },
3780 loader.name
3781 ))
3782 ] });
3783 }
3784 function RecentLoaderRunner({ hook, name, filterNames, onResolved }) {
3785 useLoaderCollector(hook, name, filterNames, onResolved);
3786 return null;
3787 }
3788 function RecentGroup() {
3789 const { commands: commands2, loaders, recentSet, onResolved } = useRecentCommands();
3790 if (!commands2.length && !loaders.length) {
3791 return null;
3792 }
3793 return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e.Group, { heading: (0, import_i18n.__)("Recent"), children: [
3794 loaders.map((loader) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3795 RecentLoaderRunner,
3796 {
3797 name: loader.name,
3798 hook: loader.hook,
3799 filterNames: recentSet,
3800 onResolved
3801 },
3802 loader.name
3803 )),
3804 commands2.map((command) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3805 CommandItem,
3806 {
3807 command,
3808 search: "",
3809 valuePrefix: "recent-"
3810 },
3811 command.name
3812 ))
3813 ] });
3814 }
3815 function SuggestionsGroup() {
3816 const { commands: commands2, loaders } = (0, import_data5.useSelect)((select) => {
3817 const { getCommands: getCommands2, getCommandLoaders: getCommandLoaders2 } = select(store);
3818 return {
3819 commands: getCommands2(true),
3820 loaders: getCommandLoaders2(true)
3821 };
3822 }, []);
3823 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(_e.Group, { heading: (0, import_i18n.__)("Suggestions"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CommandList, { search: "", commands: commands2, loaders }) });
3824 }
3825 function ResultsGroup({ search }) {
3826 const { commands: commands2, contextualCommands, loaders, contextualLoaders } = (0, import_data5.useSelect)((select) => {
3827 const { getCommands: getCommands2, getCommandLoaders: getCommandLoaders2 } = select(store);
3828 return {
3829 commands: getCommands2(false),
3830 contextualCommands: getCommands2(true),
3831 loaders: getCommandLoaders2(false),
3832 contextualLoaders: getCommandLoaders2(true)
3833 };
3834 }, []);
3835 return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e.Group, { heading: (0, import_i18n.__)("Results"), children: [
3836 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3837 CommandList,
3838 {
3839 search,
3840 commands: commands2,
3841 loaders
3842 }
3843 ),
3844 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3845 CommandList,
3846 {
3847 search,
3848 commands: contextualCommands,
3849 loaders: contextualLoaders
3850 }
3851 )
3852 ] });
3853 }
3854 function CommandInput({ search, setSearch }) {
3855 const commandMenuInput = (0, import_element3.useRef)();
3856 const _value = P((state) => state.value);
3857 const selectedItemId = _value ? `${ITEM_ID_PREFIX}${_value}` : null;
3858 (0, import_element3.useEffect)(() => {
3859 commandMenuInput.current.focus();
3860 }, []);
3861 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3862 _e.Input,
3863 {
3864 ref: commandMenuInput,
3865 value: search,
3866 onValueChange: setSearch,
3867 placeholder: inputLabel,
3868 "aria-activedescendant": selectedItemId
3869 }
3870 );
3871 }
3872 function CommandMenu() {
3873 const { registerShortcut } = (0, import_data5.useDispatch)(import_keyboard_shortcuts.store);
3874 const [search, setSearch] = (0, import_element3.useState)("");
3875 const { isOpen: paletteIsOpen, loadersLoading } = (0, import_data5.useSelect)(
3876 (select) => ({
3877 isOpen: select(store).isOpen(),
3878 loadersLoading: unlock(select(store)).isLoading()
3879 }),
3880 []
3881 );
3882 const { open: open2, close: close2 } = (0, import_data5.useDispatch)(store);
3883 (0, import_element3.useEffect)(() => {
3884 registerShortcut({
3885 name: "core/commands",
3886 category: "global",
3887 description: (0, import_i18n.__)("Open the command palette."),
3888 keyCombination: {
3889 modifier: "primary",
3890 character: "k"
3891 }
3892 });
3893 }, [registerShortcut]);
3894 (0, import_keyboard_shortcuts.useShortcut)(
3895 "core/commands",
3896 /** @type {React.KeyboardEventHandler} */
3897 withIgnoreIMEEvents((event) => {
3898 if (event.defaultPrevented) {
3899 return;
3900 }
3901 event.preventDefault();
3902 if (paletteIsOpen) {
3903 close2();
3904 } else {
3905 open2();
3906 }
3907 }),
3908 {
3909 bindGlobal: true
3910 }
3911 );
3912 const closeAndReset = () => {
3913 setSearch("");
3914 close2();
3915 };
3916 if (!paletteIsOpen) {
3917 return false;
3918 }
3919 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3920 import_components.Modal,
3921 {
3922 className: "commands-command-menu",
3923 overlayClassName: "commands-command-menu__overlay",
3924 onRequestClose: closeAndReset,
3925 __experimentalHideHeader: true,
3926 size: "medium",
3927 contentLabel: (0, import_i18n.__)("Command palette"),
3928 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "commands-command-menu__container", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e, { label: inputLabel, loop: true, children: [
3929 /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "commands-command-menu__header", children: [
3930 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3931 icon_default,
3932 {
3933 className: "commands-command-menu__header-search-icon",
3934 icon: search_default
3935 }
3936 ),
3937 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3938 CommandInput,
3939 {
3940 search,
3941 setSearch
3942 }
3943 )
3944 ] }),
3945 /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(_e.List, { label: (0, import_i18n.__)("Command suggestions"), children: [
3946 search && !loadersLoading && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(_e.Empty, { children: (0, import_i18n.__)("No results found.") }),
3947 !search && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RecentGroup, {}),
3948 !search && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SuggestionsGroup, {}),
3949 search && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ResultsGroup, { search })
3950 ] })
3951 ] }) })
3952 }
3953 );
3954 }
3955
3956 // packages/commands/build-module/hooks/use-command-context.mjs
3957 var import_element4 = __toESM(require_element(), 1);
3958 var import_data6 = __toESM(require_data(), 1);
3959 function useCommandContext(context2) {
3960 const { getContext: getContext2 } = (0, import_data6.useSelect)(store);
3961 const initialContext = (0, import_element4.useRef)(getContext2());
3962 const { setContext: setContext2 } = unlock((0, import_data6.useDispatch)(store));
3963 (0, import_element4.useEffect)(() => {
3964 setContext2(context2);
3965 }, [context2, setContext2]);
3966 (0, import_element4.useEffect)(() => {
3967 const initialContextRef = initialContext.current;
3968 return () => setContext2(initialContextRef);
3969 }, [setContext2]);
3970 }
3971
3972 // packages/commands/build-module/private-apis.mjs
3973 var privateApis = {};
3974 lock(privateApis, {
3975 useCommandContext
3976 });
3977
3978 // packages/commands/build-module/hooks/use-command.mjs
3979 var import_element5 = __toESM(require_element(), 1);
3980 var import_data7 = __toESM(require_data(), 1);
3981 function useCommand(command) {
3982 const { registerCommand: registerCommand2, unregisterCommand: unregisterCommand2 } = (0, import_data7.useDispatch)(store);
3983 const currentCallbackRef = (0, import_element5.useRef)(command.callback);
3984 (0, import_element5.useEffect)(() => {
3985 currentCallbackRef.current = command.callback;
3986 }, [command.callback]);
3987 (0, import_element5.useEffect)(() => {
3988 if (command.disabled) {
3989 return;
3990 }
3991 registerCommand2({
3992 name: command.name,
3993 context: command.context,
3994 category: command.category,
3995 label: command.label,
3996 searchLabel: command.searchLabel,
3997 icon: command.icon,
3998 keywords: command.keywords,
3999 callback: (...args) => currentCallbackRef.current(...args)
4000 });
4001 return () => {
4002 unregisterCommand2(command.name);
4003 };
4004 }, [
4005 command.name,
4006 command.label,
4007 command.searchLabel,
4008 command.icon,
4009 command.context,
4010 command.category,
4011 command.keywords,
4012 command.disabled,
4013 registerCommand2,
4014 unregisterCommand2
4015 ]);
4016 }
4017 function useCommands(commands2) {
4018 const { registerCommand: registerCommand2, unregisterCommand: unregisterCommand2 } = (0, import_data7.useDispatch)(store);
4019 const currentCallbacksRef = (0, import_element5.useRef)({});
4020 (0, import_element5.useEffect)(() => {
4021 if (!commands2) {
4022 return;
4023 }
4024 commands2.forEach((command) => {
4025 if (command.callback) {
4026 currentCallbacksRef.current[command.name] = command.callback;
4027 }
4028 });
4029 }, [commands2]);
4030 (0, import_element5.useEffect)(() => {
4031 if (!commands2) {
4032 return;
4033 }
4034 commands2.forEach((command) => {
4035 if (command.disabled) {
4036 return;
4037 }
4038 registerCommand2({
4039 name: command.name,
4040 context: command.context,
4041 category: command.category,
4042 label: command.label,
4043 searchLabel: command.searchLabel,
4044 icon: command.icon,
4045 keywords: command.keywords,
4046 callback: (...args) => {
4047 const callback = currentCallbacksRef.current[command.name];
4048 if (callback) {
4049 callback(...args);
4050 }
4051 }
4052 });
4053 });
4054 return () => {
4055 commands2.forEach((command) => {
4056 unregisterCommand2(command.name);
4057 });
4058 };
4059 }, [commands2, registerCommand2, unregisterCommand2]);
4060 }
4061
4062 // packages/commands/build-module/hooks/use-command-loader.mjs
4063 var import_element6 = __toESM(require_element(), 1);
4064 var import_data8 = __toESM(require_data(), 1);
4065 function useCommandLoader(loader) {
4066 const { registerCommandLoader: registerCommandLoader2, unregisterCommandLoader: unregisterCommandLoader2 } = (0, import_data8.useDispatch)(store);
4067 (0, import_element6.useEffect)(() => {
4068 if (loader.disabled) {
4069 return;
4070 }
4071 registerCommandLoader2({
4072 name: loader.name,
4073 hook: loader.hook,
4074 context: loader.context,
4075 category: loader.category
4076 });
4077 return () => {
4078 unregisterCommandLoader2(loader.name);
4079 };
4080 }, [
4081 loader.name,
4082 loader.hook,
4083 loader.context,
4084 loader.category,
4085 loader.disabled,
4086 registerCommandLoader2,
4087 unregisterCommandLoader2
4088 ]);
4089 }
4090 return __toCommonJS(index_exports);
4091 })();
4092 //# sourceMappingURL=index.js.map
4093