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