[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/script-modules/workflow/ -> index.js (source)

   1  var __create = Object.create;
   2  var __defProp = Object.defineProperty;
   3  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   4  var __getOwnPropNames = Object.getOwnPropertyNames;
   5  var __getProtoOf = Object.getPrototypeOf;
   6  var __hasOwnProp = Object.prototype.hasOwnProperty;
   7  var __commonJS = (cb, mod) => function __require() {
   8    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
   9  };
  10  var __copyProps = (to, from, except, desc) => {
  11    if (from && typeof from === "object" || typeof from === "function") {
  12      for (let key of __getOwnPropNames(from))
  13        if (!__hasOwnProp.call(to, key) && key !== except)
  14          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15    }
  16    return to;
  17  };
  18  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  19    // If the importer is in node compatibility mode or this is not an ESM
  20    // file that has been converted to a CommonJS file using a Babel-
  21    // compatible transform (i.e. "__esModule" has not been set), then set
  22    // "default" to the CommonJS "module.exports" for node compatibility.
  23    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  24    mod
  25  ));
  26  
  27  // package-external:@wordpress/element
  28  var require_element = __commonJS({
  29    "package-external:@wordpress/element"(exports, module) {
  30      module.exports = window.wp.element;
  31    }
  32  });
  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/i18n
  63  var require_i18n = __commonJS({
  64    "package-external:@wordpress/i18n"(exports, module) {
  65      module.exports = window.wp.i18n;
  66    }
  67  });
  68  
  69  // package-external:@wordpress/components
  70  var require_components = __commonJS({
  71    "package-external:@wordpress/components"(exports, module) {
  72      module.exports = window.wp.components;
  73    }
  74  });
  75  
  76  // package-external:@wordpress/keyboard-shortcuts
  77  var require_keyboard_shortcuts = __commonJS({
  78    "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
  79      module.exports = window.wp.keyboardShortcuts;
  80    }
  81  });
  82  
  83  // package-external:@wordpress/primitives
  84  var require_primitives = __commonJS({
  85    "package-external:@wordpress/primitives"(exports, module) {
  86      module.exports = window.wp.primitives;
  87    }
  88  });
  89  
  90  // package-external:@wordpress/private-apis
  91  var require_private_apis = __commonJS({
  92    "package-external:@wordpress/private-apis"(exports, module) {
  93      module.exports = window.wp.privateApis;
  94    }
  95  });
  96  
  97  // packages/workflow/build-module/index.mjs
  98  var import_element3 = __toESM(require_element(), 1);
  99  
 100  // node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
 101  var U = 1;
 102  var Y = 0.9;
 103  var H = 0.8;
 104  var J = 0.17;
 105  var p = 0.1;
 106  var u = 0.999;
 107  var $ = 0.9999;
 108  var k = 0.99;
 109  var m = /[\\\/_+.#"@\[\(\{&]/;
 110  var B = /[\\\/_+.#"@\[\(\{&]/g;
 111  var K = /[\s-]/;
 112  var X = /[\s-]/g;
 113  function G(_, C, h, P2, A, f, O) {
 114    if (f === C.length) return A === _.length ? U : k;
 115    var T2 = `$A},$f}`;
 116    if (O[T2] !== void 0) return O[T2];
 117    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);
 118    return O[T2] = S, S;
 119  }
 120  function D(_) {
 121    return _.toLowerCase().replace(X, " ");
 122  }
 123  function W(_, C, h) {
 124    return _ = h && h.length > 0 ? `$_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
 125  }
 126  
 127  // node_modules/@radix-ui/react-dialog/dist/index.mjs
 128  var React24 = __toESM(require_react(), 1);
 129  
 130  // node_modules/@radix-ui/primitive/dist/index.mjs
 131  var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
 132  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
 133    return function handleEvent(event) {
 134      originalEventHandler?.(event);
 135      if (checkForDefaultPrevented === false || !event.defaultPrevented) {
 136        return ourEventHandler?.(event);
 137      }
 138    };
 139  }
 140  
 141  // node_modules/@radix-ui/react-compose-refs/dist/index.mjs
 142  var React = __toESM(require_react(), 1);
 143  function setRef(ref, value) {
 144    if (typeof ref === "function") {
 145      return ref(value);
 146    } else if (ref !== null && ref !== void 0) {
 147      ref.current = value;
 148    }
 149  }
 150  function composeRefs(...refs) {
 151    return (node) => {
 152      let hasCleanup = false;
 153      const cleanups = refs.map((ref) => {
 154        const cleanup = setRef(ref, node);
 155        if (!hasCleanup && typeof cleanup == "function") {
 156          hasCleanup = true;
 157        }
 158        return cleanup;
 159      });
 160      if (hasCleanup) {
 161        return () => {
 162          for (let i = 0; i < cleanups.length; i++) {
 163            const cleanup = cleanups[i];
 164            if (typeof cleanup == "function") {
 165              cleanup();
 166            } else {
 167              setRef(refs[i], null);
 168            }
 169          }
 170        };
 171      }
 172    };
 173  }
 174  function useComposedRefs(...refs) {
 175    return React.useCallback(composeRefs(...refs), refs);
 176  }
 177  
 178  // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.mjs
 179  var React2 = __toESM(require_react(), 1);
 180  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
 181  function createContext2(rootComponentName, defaultContext) {
 182    const Context = React2.createContext(defaultContext);
 183    const Provider = (props) => {
 184      const { children, ...context } = props;
 185      const value = React2.useMemo(() => context, Object.values(context));
 186      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
 187    };
 188    Provider.displayName = rootComponentName + "Provider";
 189    function useContext22(consumerName) {
 190      const context = React2.useContext(Context);
 191      if (context) return context;
 192      if (defaultContext !== void 0) return defaultContext;
 193      throw new Error(`\`$consumerName}\` must be used within \`$rootComponentName}\``);
 194    }
 195    return [Provider, useContext22];
 196  }
 197  function createContextScope(scopeName, createContextScopeDeps = []) {
 198    let defaultContexts = [];
 199    function createContext32(rootComponentName, defaultContext) {
 200      const BaseContext = React2.createContext(defaultContext);
 201      const index = defaultContexts.length;
 202      defaultContexts = [...defaultContexts, defaultContext];
 203      const Provider = (props) => {
 204        const { scope, children, ...context } = props;
 205        const Context = scope?.[scopeName]?.[index] || BaseContext;
 206        const value = React2.useMemo(() => context, Object.values(context));
 207        return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
 208      };
 209      Provider.displayName = rootComponentName + "Provider";
 210      function useContext22(consumerName, scope) {
 211        const Context = scope?.[scopeName]?.[index] || BaseContext;
 212        const context = React2.useContext(Context);
 213        if (context) return context;
 214        if (defaultContext !== void 0) return defaultContext;
 215        throw new Error(`\`$consumerName}\` must be used within \`$rootComponentName}\``);
 216      }
 217      return [Provider, useContext22];
 218    }
 219    const createScope = () => {
 220      const scopeContexts = defaultContexts.map((defaultContext) => {
 221        return React2.createContext(defaultContext);
 222      });
 223      return function useScope(scope) {
 224        const contexts = scope?.[scopeName] || scopeContexts;
 225        return React2.useMemo(
 226          () => ({ [`__scope$scopeName}`]: { ...scope, [scopeName]: contexts } }),
 227          [scope, contexts]
 228        );
 229      };
 230    };
 231    createScope.scopeName = scopeName;
 232    return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
 233  }
 234  function composeContextScopes(...scopes) {
 235    const baseScope = scopes[0];
 236    if (scopes.length === 1) return baseScope;
 237    const createScope = () => {
 238      const scopeHooks = scopes.map((createScope2) => ({
 239        useScope: createScope2(),
 240        scopeName: createScope2.scopeName
 241      }));
 242      return function useComposedScopes(overrideScopes) {
 243        const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
 244          const scopeProps = useScope(overrideScopes);
 245          const currentScope = scopeProps[`__scope$scopeName}`];
 246          return { ...nextScopes2, ...currentScope };
 247        }, {});
 248        return React2.useMemo(() => ({ [`__scope$baseScope.scopeName}`]: nextScopes }), [nextScopes]);
 249      };
 250    };
 251    createScope.scopeName = baseScope.scopeName;
 252    return createScope;
 253  }
 254  
 255  // node_modules/@radix-ui/react-id/dist/index.mjs
 256  var React4 = __toESM(require_react(), 1);
 257  
 258  // node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
 259  var React3 = __toESM(require_react(), 1);
 260  var useLayoutEffect2 = globalThis?.document ? React3.useLayoutEffect : () => {
 261  };
 262  
 263  // node_modules/@radix-ui/react-id/dist/index.mjs
 264  var useReactId = React4[" useId ".trim().toString()] || (() => void 0);
 265  var count = 0;
 266  function useId(deterministicId) {
 267    const [id, setId] = React4.useState(useReactId());
 268    useLayoutEffect2(() => {
 269      if (!deterministicId) setId((reactId) => reactId ?? String(count++));
 270    }, [deterministicId]);
 271    return deterministicId || (id ? `radix-$id}` : "");
 272  }
 273  
 274  // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
 275  var React5 = __toESM(require_react(), 1);
 276  var React22 = __toESM(require_react(), 1);
 277  var useInsertionEffect = React5[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
 278  function useControllableState({
 279    prop,
 280    defaultProp,
 281    onChange = () => {
 282    },
 283    caller
 284  }) {
 285    const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
 286      defaultProp,
 287      onChange
 288    });
 289    const isControlled = prop !== void 0;
 290    const value = isControlled ? prop : uncontrolledProp;
 291    if (true) {
 292      const isControlledRef = React5.useRef(prop !== void 0);
 293      React5.useEffect(() => {
 294        const wasControlled = isControlledRef.current;
 295        if (wasControlled !== isControlled) {
 296          const from = wasControlled ? "controlled" : "uncontrolled";
 297          const to = isControlled ? "controlled" : "uncontrolled";
 298          console.warn(
 299            `$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.`
 300          );
 301        }
 302        isControlledRef.current = isControlled;
 303      }, [isControlled, caller]);
 304    }
 305    const setValue = React5.useCallback(
 306      (nextValue) => {
 307        if (isControlled) {
 308          const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
 309          if (value2 !== prop) {
 310            onChangeRef.current?.(value2);
 311          }
 312        } else {
 313          setUncontrolledProp(nextValue);
 314        }
 315      },
 316      [isControlled, prop, setUncontrolledProp, onChangeRef]
 317    );
 318    return [value, setValue];
 319  }
 320  function useUncontrolledState({
 321    defaultProp,
 322    onChange
 323  }) {
 324    const [value, setValue] = React5.useState(defaultProp);
 325    const prevValueRef = React5.useRef(value);
 326    const onChangeRef = React5.useRef(onChange);
 327    useInsertionEffect(() => {
 328      onChangeRef.current = onChange;
 329    }, [onChange]);
 330    React5.useEffect(() => {
 331      if (prevValueRef.current !== value) {
 332        onChangeRef.current?.(value);
 333        prevValueRef.current = value;
 334      }
 335    }, [value, prevValueRef]);
 336    return [value, setValue, onChangeRef];
 337  }
 338  function isFunction(value) {
 339    return typeof value === "function";
 340  }
 341  
 342  // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
 343  var React10 = __toESM(require_react(), 1);
 344  
 345  // node_modules/@radix-ui/react-primitive/dist/index.mjs
 346  var React7 = __toESM(require_react(), 1);
 347  var ReactDOM = __toESM(require_react_dom(), 1);
 348  
 349  // node_modules/@radix-ui/react-slot/dist/index.mjs
 350  var React6 = __toESM(require_react(), 1);
 351  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
 352  // @__NO_SIDE_EFFECTS__
 353  function createSlot(ownerName) {
 354    const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
 355    const Slot2 = React6.forwardRef((props, forwardedRef) => {
 356      const { children, ...slotProps } = props;
 357      const childrenArray = React6.Children.toArray(children);
 358      const slottable = childrenArray.find(isSlottable);
 359      if (slottable) {
 360        const newElement = slottable.props.children;
 361        const newChildren = childrenArray.map((child) => {
 362          if (child === slottable) {
 363            if (React6.Children.count(newElement) > 1) return React6.Children.only(null);
 364            return React6.isValidElement(newElement) ? newElement.props.children : null;
 365          } else {
 366            return child;
 367          }
 368        });
 369        return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React6.isValidElement(newElement) ? React6.cloneElement(newElement, void 0, newChildren) : null });
 370      }
 371      return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
 372    });
 373    Slot2.displayName = `$ownerName}.Slot`;
 374    return Slot2;
 375  }
 376  // @__NO_SIDE_EFFECTS__
 377  function createSlotClone(ownerName) {
 378    const SlotClone = React6.forwardRef((props, forwardedRef) => {
 379      const { children, ...slotProps } = props;
 380      if (React6.isValidElement(children)) {
 381        const childrenRef = getElementRef(children);
 382        const props2 = mergeProps(slotProps, children.props);
 383        if (children.type !== React6.Fragment) {
 384          props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
 385        }
 386        return React6.cloneElement(children, props2);
 387      }
 388      return React6.Children.count(children) > 1 ? React6.Children.only(null) : null;
 389    });
 390    SlotClone.displayName = `$ownerName}.SlotClone`;
 391    return SlotClone;
 392  }
 393  var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
 394  function isSlottable(child) {
 395    return React6.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
 396  }
 397  function mergeProps(slotProps, childProps) {
 398    const overrideProps = { ...childProps };
 399    for (const propName in childProps) {
 400      const slotPropValue = slotProps[propName];
 401      const childPropValue = childProps[propName];
 402      const isHandler = /^on[A-Z]/.test(propName);
 403      if (isHandler) {
 404        if (slotPropValue && childPropValue) {
 405          overrideProps[propName] = (...args) => {
 406            const result = childPropValue(...args);
 407            slotPropValue(...args);
 408            return result;
 409          };
 410        } else if (slotPropValue) {
 411          overrideProps[propName] = slotPropValue;
 412        }
 413      } else if (propName === "style") {
 414        overrideProps[propName] = { ...slotPropValue, ...childPropValue };
 415      } else if (propName === "className") {
 416        overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
 417      }
 418    }
 419    return { ...slotProps, ...overrideProps };
 420  }
 421  function getElementRef(element) {
 422    let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
 423    let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
 424    if (mayWarn) {
 425      return element.ref;
 426    }
 427    getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
 428    mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
 429    if (mayWarn) {
 430      return element.props.ref;
 431    }
 432    return element.props.ref || element.ref;
 433  }
 434  
 435  // node_modules/@radix-ui/react-primitive/dist/index.mjs
 436  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
 437  var NODES = [
 438    "a",
 439    "button",
 440    "div",
 441    "form",
 442    "h2",
 443    "h3",
 444    "img",
 445    "input",
 446    "label",
 447    "li",
 448    "nav",
 449    "ol",
 450    "p",
 451    "select",
 452    "span",
 453    "svg",
 454    "ul"
 455  ];
 456  var Primitive = NODES.reduce((primitive, node) => {
 457    const Slot2 = createSlot(`Primitive.$node}`);
 458    const Node2 = React7.forwardRef((props, forwardedRef) => {
 459      const { asChild, ...primitiveProps } = props;
 460      const Comp = asChild ? Slot2 : node;
 461      if (typeof window !== "undefined") {
 462        window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
 463      }
 464      return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
 465    });
 466    Node2.displayName = `Primitive.$node}`;
 467    return { ...primitive, [node]: Node2 };
 468  }, {});
 469  function dispatchDiscreteCustomEvent(target, event) {
 470    if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
 471  }
 472  
 473  // node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
 474  var React8 = __toESM(require_react(), 1);
 475  function useCallbackRef(callback) {
 476    const callbackRef = React8.useRef(callback);
 477    React8.useEffect(() => {
 478      callbackRef.current = callback;
 479    });
 480    return React8.useMemo(() => (...args) => callbackRef.current?.(...args), []);
 481  }
 482  
 483  // node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
 484  var React9 = __toESM(require_react(), 1);
 485  function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
 486    const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
 487    React9.useEffect(() => {
 488      const handleKeyDown = (event) => {
 489        if (event.key === "Escape") {
 490          onEscapeKeyDown(event);
 491        }
 492      };
 493      ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
 494      return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
 495    }, [onEscapeKeyDown, ownerDocument]);
 496  }
 497  
 498  // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
 499  var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
 500  var DISMISSABLE_LAYER_NAME = "DismissableLayer";
 501  var CONTEXT_UPDATE = "dismissableLayer.update";
 502  var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
 503  var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
 504  var originalBodyPointerEvents;
 505  var DismissableLayerContext = React10.createContext({
 506    layers: /* @__PURE__ */ new Set(),
 507    layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
 508    branches: /* @__PURE__ */ new Set()
 509  });
 510  var DismissableLayer = React10.forwardRef(
 511    (props, forwardedRef) => {
 512      const {
 513        disableOutsidePointerEvents = false,
 514        onEscapeKeyDown,
 515        onPointerDownOutside,
 516        onFocusOutside,
 517        onInteractOutside,
 518        onDismiss,
 519        ...layerProps
 520      } = props;
 521      const context = React10.useContext(DismissableLayerContext);
 522      const [node, setNode] = React10.useState(null);
 523      const ownerDocument = node?.ownerDocument ?? globalThis?.document;
 524      const [, force] = React10.useState({});
 525      const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
 526      const layers = Array.from(context.layers);
 527      const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
 528      const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
 529      const index = node ? layers.indexOf(node) : -1;
 530      const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
 531      const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
 532      const pointerDownOutside = usePointerDownOutside((event) => {
 533        const target = event.target;
 534        const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
 535        if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
 536        onPointerDownOutside?.(event);
 537        onInteractOutside?.(event);
 538        if (!event.defaultPrevented) onDismiss?.();
 539      }, ownerDocument);
 540      const focusOutside = useFocusOutside((event) => {
 541        const target = event.target;
 542        const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
 543        if (isFocusInBranch) return;
 544        onFocusOutside?.(event);
 545        onInteractOutside?.(event);
 546        if (!event.defaultPrevented) onDismiss?.();
 547      }, ownerDocument);
 548      useEscapeKeydown((event) => {
 549        const isHighestLayer = index === context.layers.size - 1;
 550        if (!isHighestLayer) return;
 551        onEscapeKeyDown?.(event);
 552        if (!event.defaultPrevented && onDismiss) {
 553          event.preventDefault();
 554          onDismiss();
 555        }
 556      }, ownerDocument);
 557      React10.useEffect(() => {
 558        if (!node) return;
 559        if (disableOutsidePointerEvents) {
 560          if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
 561            originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
 562            ownerDocument.body.style.pointerEvents = "none";
 563          }
 564          context.layersWithOutsidePointerEventsDisabled.add(node);
 565        }
 566        context.layers.add(node);
 567        dispatchUpdate();
 568        return () => {
 569          if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
 570            ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
 571          }
 572        };
 573      }, [node, ownerDocument, disableOutsidePointerEvents, context]);
 574      React10.useEffect(() => {
 575        return () => {
 576          if (!node) return;
 577          context.layers.delete(node);
 578          context.layersWithOutsidePointerEventsDisabled.delete(node);
 579          dispatchUpdate();
 580        };
 581      }, [node, context]);
 582      React10.useEffect(() => {
 583        const handleUpdate = () => force({});
 584        document.addEventListener(CONTEXT_UPDATE, handleUpdate);
 585        return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
 586      }, []);
 587      return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
 588        Primitive.div,
 589        {
 590          ...layerProps,
 591          ref: composedRefs,
 592          style: {
 593            pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
 594            ...props.style
 595          },
 596          onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
 597          onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
 598          onPointerDownCapture: composeEventHandlers(
 599            props.onPointerDownCapture,
 600            pointerDownOutside.onPointerDownCapture
 601          )
 602        }
 603      );
 604    }
 605  );
 606  DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
 607  var BRANCH_NAME = "DismissableLayerBranch";
 608  var DismissableLayerBranch = React10.forwardRef((props, forwardedRef) => {
 609    const context = React10.useContext(DismissableLayerContext);
 610    const ref = React10.useRef(null);
 611    const composedRefs = useComposedRefs(forwardedRef, ref);
 612    React10.useEffect(() => {
 613      const node = ref.current;
 614      if (node) {
 615        context.branches.add(node);
 616        return () => {
 617          context.branches.delete(node);
 618        };
 619      }
 620    }, [context.branches]);
 621    return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Primitive.div, { ...props, ref: composedRefs });
 622  });
 623  DismissableLayerBranch.displayName = BRANCH_NAME;
 624  function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
 625    const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
 626    const isPointerInsideReactTreeRef = React10.useRef(false);
 627    const handleClickRef = React10.useRef(() => {
 628    });
 629    React10.useEffect(() => {
 630      const handlePointerDown = (event) => {
 631        if (event.target && !isPointerInsideReactTreeRef.current) {
 632          let handleAndDispatchPointerDownOutsideEvent2 = function() {
 633            handleAndDispatchCustomEvent(
 634              POINTER_DOWN_OUTSIDE,
 635              handlePointerDownOutside,
 636              eventDetail,
 637              { discrete: true }
 638            );
 639          };
 640          var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
 641          const eventDetail = { originalEvent: event };
 642          if (event.pointerType === "touch") {
 643            ownerDocument.removeEventListener("click", handleClickRef.current);
 644            handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
 645            ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
 646          } else {
 647            handleAndDispatchPointerDownOutsideEvent2();
 648          }
 649        } else {
 650          ownerDocument.removeEventListener("click", handleClickRef.current);
 651        }
 652        isPointerInsideReactTreeRef.current = false;
 653      };
 654      const timerId = window.setTimeout(() => {
 655        ownerDocument.addEventListener("pointerdown", handlePointerDown);
 656      }, 0);
 657      return () => {
 658        window.clearTimeout(timerId);
 659        ownerDocument.removeEventListener("pointerdown", handlePointerDown);
 660        ownerDocument.removeEventListener("click", handleClickRef.current);
 661      };
 662    }, [ownerDocument, handlePointerDownOutside]);
 663    return {
 664      // ensures we check React component tree (not just DOM tree)
 665      onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
 666    };
 667  }
 668  function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
 669    const handleFocusOutside = useCallbackRef(onFocusOutside);
 670    const isFocusInsideReactTreeRef = React10.useRef(false);
 671    React10.useEffect(() => {
 672      const handleFocus = (event) => {
 673        if (event.target && !isFocusInsideReactTreeRef.current) {
 674          const eventDetail = { originalEvent: event };
 675          handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
 676            discrete: false
 677          });
 678        }
 679      };
 680      ownerDocument.addEventListener("focusin", handleFocus);
 681      return () => ownerDocument.removeEventListener("focusin", handleFocus);
 682    }, [ownerDocument, handleFocusOutside]);
 683    return {
 684      onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
 685      onBlurCapture: () => isFocusInsideReactTreeRef.current = false
 686    };
 687  }
 688  function dispatchUpdate() {
 689    const event = new CustomEvent(CONTEXT_UPDATE);
 690    document.dispatchEvent(event);
 691  }
 692  function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
 693    const target = detail.originalEvent.target;
 694    const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
 695    if (handler) target.addEventListener(name, handler, { once: true });
 696    if (discrete) {
 697      dispatchDiscreteCustomEvent(target, event);
 698    } else {
 699      target.dispatchEvent(event);
 700    }
 701  }
 702  
 703  // node_modules/@radix-ui/react-focus-scope/dist/index.mjs
 704  var React11 = __toESM(require_react(), 1);
 705  var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
 706  var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
 707  var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
 708  var EVENT_OPTIONS = { bubbles: false, cancelable: true };
 709  var FOCUS_SCOPE_NAME = "FocusScope";
 710  var FocusScope = React11.forwardRef((props, forwardedRef) => {
 711    const {
 712      loop = false,
 713      trapped = false,
 714      onMountAutoFocus: onMountAutoFocusProp,
 715      onUnmountAutoFocus: onUnmountAutoFocusProp,
 716      ...scopeProps
 717    } = props;
 718    const [container, setContainer] = React11.useState(null);
 719    const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
 720    const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
 721    const lastFocusedElementRef = React11.useRef(null);
 722    const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
 723    const focusScope = React11.useRef({
 724      paused: false,
 725      pause() {
 726        this.paused = true;
 727      },
 728      resume() {
 729        this.paused = false;
 730      }
 731    }).current;
 732    React11.useEffect(() => {
 733      if (trapped) {
 734        let handleFocusIn2 = function(event) {
 735          if (focusScope.paused || !container) return;
 736          const target = event.target;
 737          if (container.contains(target)) {
 738            lastFocusedElementRef.current = target;
 739          } else {
 740            focus(lastFocusedElementRef.current, { select: true });
 741          }
 742        }, handleFocusOut2 = function(event) {
 743          if (focusScope.paused || !container) return;
 744          const relatedTarget = event.relatedTarget;
 745          if (relatedTarget === null) return;
 746          if (!container.contains(relatedTarget)) {
 747            focus(lastFocusedElementRef.current, { select: true });
 748          }
 749        }, handleMutations2 = function(mutations) {
 750          const focusedElement = document.activeElement;
 751          if (focusedElement !== document.body) return;
 752          for (const mutation of mutations) {
 753            if (mutation.removedNodes.length > 0) focus(container);
 754          }
 755        };
 756        var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;
 757        document.addEventListener("focusin", handleFocusIn2);
 758        document.addEventListener("focusout", handleFocusOut2);
 759        const mutationObserver = new MutationObserver(handleMutations2);
 760        if (container) mutationObserver.observe(container, { childList: true, subtree: true });
 761        return () => {
 762          document.removeEventListener("focusin", handleFocusIn2);
 763          document.removeEventListener("focusout", handleFocusOut2);
 764          mutationObserver.disconnect();
 765        };
 766      }
 767    }, [trapped, container, focusScope.paused]);
 768    React11.useEffect(() => {
 769      if (container) {
 770        focusScopesStack.add(focusScope);
 771        const previouslyFocusedElement = document.activeElement;
 772        const hasFocusedCandidate = container.contains(previouslyFocusedElement);
 773        if (!hasFocusedCandidate) {
 774          const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
 775          container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
 776          container.dispatchEvent(mountEvent);
 777          if (!mountEvent.defaultPrevented) {
 778            focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
 779            if (document.activeElement === previouslyFocusedElement) {
 780              focus(container);
 781            }
 782          }
 783        }
 784        return () => {
 785          container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
 786          setTimeout(() => {
 787            const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
 788            container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
 789            container.dispatchEvent(unmountEvent);
 790            if (!unmountEvent.defaultPrevented) {
 791              focus(previouslyFocusedElement ?? document.body, { select: true });
 792            }
 793            container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
 794            focusScopesStack.remove(focusScope);
 795          }, 0);
 796        };
 797      }
 798    }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
 799    const handleKeyDown = React11.useCallback(
 800      (event) => {
 801        if (!loop && !trapped) return;
 802        if (focusScope.paused) return;
 803        const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
 804        const focusedElement = document.activeElement;
 805        if (isTabKey && focusedElement) {
 806          const container2 = event.currentTarget;
 807          const [first, last] = getTabbableEdges(container2);
 808          const hasTabbableElementsInside = first && last;
 809          if (!hasTabbableElementsInside) {
 810            if (focusedElement === container2) event.preventDefault();
 811          } else {
 812            if (!event.shiftKey && focusedElement === last) {
 813              event.preventDefault();
 814              if (loop) focus(first, { select: true });
 815            } else if (event.shiftKey && focusedElement === first) {
 816              event.preventDefault();
 817              if (loop) focus(last, { select: true });
 818            }
 819          }
 820        }
 821      },
 822      [loop, trapped, focusScope.paused]
 823    );
 824    return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
 825  });
 826  FocusScope.displayName = FOCUS_SCOPE_NAME;
 827  function focusFirst(candidates, { select = false } = {}) {
 828    const previouslyFocusedElement = document.activeElement;
 829    for (const candidate of candidates) {
 830      focus(candidate, { select });
 831      if (document.activeElement !== previouslyFocusedElement) return;
 832    }
 833  }
 834  function getTabbableEdges(container) {
 835    const candidates = getTabbableCandidates(container);
 836    const first = findVisible(candidates, container);
 837    const last = findVisible(candidates.reverse(), container);
 838    return [first, last];
 839  }
 840  function getTabbableCandidates(container) {
 841    const nodes = [];
 842    const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
 843      acceptNode: (node) => {
 844        const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
 845        if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
 846        return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
 847      }
 848    });
 849    while (walker.nextNode()) nodes.push(walker.currentNode);
 850    return nodes;
 851  }
 852  function findVisible(elements, container) {
 853    for (const element of elements) {
 854      if (!isHidden(element, { upTo: container })) return element;
 855    }
 856  }
 857  function isHidden(node, { upTo }) {
 858    if (getComputedStyle(node).visibility === "hidden") return true;
 859    while (node) {
 860      if (upTo !== void 0 && node === upTo) return false;
 861      if (getComputedStyle(node).display === "none") return true;
 862      node = node.parentElement;
 863    }
 864    return false;
 865  }
 866  function isSelectableInput(element) {
 867    return element instanceof HTMLInputElement && "select" in element;
 868  }
 869  function focus(element, { select = false } = {}) {
 870    if (element && element.focus) {
 871      const previouslyFocusedElement = document.activeElement;
 872      element.focus({ preventScroll: true });
 873      if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
 874        element.select();
 875    }
 876  }
 877  var focusScopesStack = createFocusScopesStack();
 878  function createFocusScopesStack() {
 879    let stack = [];
 880    return {
 881      add(focusScope) {
 882        const activeFocusScope = stack[0];
 883        if (focusScope !== activeFocusScope) {
 884          activeFocusScope?.pause();
 885        }
 886        stack = arrayRemove(stack, focusScope);
 887        stack.unshift(focusScope);
 888      },
 889      remove(focusScope) {
 890        stack = arrayRemove(stack, focusScope);
 891        stack[0]?.resume();
 892      }
 893    };
 894  }
 895  function arrayRemove(array, item) {
 896    const updatedArray = [...array];
 897    const index = updatedArray.indexOf(item);
 898    if (index !== -1) {
 899      updatedArray.splice(index, 1);
 900    }
 901    return updatedArray;
 902  }
 903  function removeLinks(items) {
 904    return items.filter((item) => item.tagName !== "A");
 905  }
 906  
 907  // node_modules/@radix-ui/react-portal/dist/index.mjs
 908  var React12 = __toESM(require_react(), 1);
 909  var import_react_dom = __toESM(require_react_dom(), 1);
 910  var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
 911  var PORTAL_NAME = "Portal";
 912  var Portal = React12.forwardRef((props, forwardedRef) => {
 913    const { container: containerProp, ...portalProps } = props;
 914    const [mounted, setMounted] = React12.useState(false);
 915    useLayoutEffect2(() => setMounted(true), []);
 916    const container = containerProp || mounted && globalThis?.document?.body;
 917    return container ? import_react_dom.default.createPortal(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
 918  });
 919  Portal.displayName = PORTAL_NAME;
 920  
 921  // node_modules/@radix-ui/react-presence/dist/index.mjs
 922  var React23 = __toESM(require_react(), 1);
 923  var React13 = __toESM(require_react(), 1);
 924  function useStateMachine(initialState, machine) {
 925    return React13.useReducer((state, event) => {
 926      const nextState = machine[state][event];
 927      return nextState ?? state;
 928    }, initialState);
 929  }
 930  var Presence = (props) => {
 931    const { present, children } = props;
 932    const presence = usePresence(present);
 933    const child = typeof children === "function" ? children({ present: presence.isPresent }) : React23.Children.only(children);
 934    const ref = useComposedRefs(presence.ref, getElementRef2(child));
 935    const forceMount = typeof children === "function";
 936    return forceMount || presence.isPresent ? React23.cloneElement(child, { ref }) : null;
 937  };
 938  Presence.displayName = "Presence";
 939  function usePresence(present) {
 940    const [node, setNode] = React23.useState();
 941    const stylesRef = React23.useRef(null);
 942    const prevPresentRef = React23.useRef(present);
 943    const prevAnimationNameRef = React23.useRef("none");
 944    const initialState = present ? "mounted" : "unmounted";
 945    const [state, send] = useStateMachine(initialState, {
 946      mounted: {
 947        UNMOUNT: "unmounted",
 948        ANIMATION_OUT: "unmountSuspended"
 949      },
 950      unmountSuspended: {
 951        MOUNT: "mounted",
 952        ANIMATION_END: "unmounted"
 953      },
 954      unmounted: {
 955        MOUNT: "mounted"
 956      }
 957    });
 958    React23.useEffect(() => {
 959      const currentAnimationName = getAnimationName(stylesRef.current);
 960      prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
 961    }, [state]);
 962    useLayoutEffect2(() => {
 963      const styles = stylesRef.current;
 964      const wasPresent = prevPresentRef.current;
 965      const hasPresentChanged = wasPresent !== present;
 966      if (hasPresentChanged) {
 967        const prevAnimationName = prevAnimationNameRef.current;
 968        const currentAnimationName = getAnimationName(styles);
 969        if (present) {
 970          send("MOUNT");
 971        } else if (currentAnimationName === "none" || styles?.display === "none") {
 972          send("UNMOUNT");
 973        } else {
 974          const isAnimating = prevAnimationName !== currentAnimationName;
 975          if (wasPresent && isAnimating) {
 976            send("ANIMATION_OUT");
 977          } else {
 978            send("UNMOUNT");
 979          }
 980        }
 981        prevPresentRef.current = present;
 982      }
 983    }, [present, send]);
 984    useLayoutEffect2(() => {
 985      if (node) {
 986        let timeoutId;
 987        const ownerWindow = node.ownerDocument.defaultView ?? window;
 988        const handleAnimationEnd = (event) => {
 989          const currentAnimationName = getAnimationName(stylesRef.current);
 990          const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
 991          if (event.target === node && isCurrentAnimation) {
 992            send("ANIMATION_END");
 993            if (!prevPresentRef.current) {
 994              const currentFillMode = node.style.animationFillMode;
 995              node.style.animationFillMode = "forwards";
 996              timeoutId = ownerWindow.setTimeout(() => {
 997                if (node.style.animationFillMode === "forwards") {
 998                  node.style.animationFillMode = currentFillMode;
 999                }
1000              });
1001            }
1002          }
1003        };
1004        const handleAnimationStart = (event) => {
1005          if (event.target === node) {
1006            prevAnimationNameRef.current = getAnimationName(stylesRef.current);
1007          }
1008        };
1009        node.addEventListener("animationstart", handleAnimationStart);
1010        node.addEventListener("animationcancel", handleAnimationEnd);
1011        node.addEventListener("animationend", handleAnimationEnd);
1012        return () => {
1013          ownerWindow.clearTimeout(timeoutId);
1014          node.removeEventListener("animationstart", handleAnimationStart);
1015          node.removeEventListener("animationcancel", handleAnimationEnd);
1016          node.removeEventListener("animationend", handleAnimationEnd);
1017        };
1018      } else {
1019        send("ANIMATION_END");
1020      }
1021    }, [node, send]);
1022    return {
1023      isPresent: ["mounted", "unmountSuspended"].includes(state),
1024      ref: React23.useCallback((node2) => {
1025        stylesRef.current = node2 ? getComputedStyle(node2) : null;
1026        setNode(node2);
1027      }, [])
1028    };
1029  }
1030  function getAnimationName(styles) {
1031    return styles?.animationName || "none";
1032  }
1033  function getElementRef2(element) {
1034    let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1035    let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1036    if (mayWarn) {
1037      return element.ref;
1038    }
1039    getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1040    mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1041    if (mayWarn) {
1042      return element.props.ref;
1043    }
1044    return element.props.ref || element.ref;
1045  }
1046  
1047  // node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
1048  var React14 = __toESM(require_react(), 1);
1049  var count2 = 0;
1050  function useFocusGuards() {
1051    React14.useEffect(() => {
1052      const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
1053      document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
1054      document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
1055      count2++;
1056      return () => {
1057        if (count2 === 1) {
1058          document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
1059        }
1060        count2--;
1061      };
1062    }, []);
1063  }
1064  function createFocusGuard() {
1065    const element = document.createElement("span");
1066    element.setAttribute("data-radix-focus-guard", "");
1067    element.tabIndex = 0;
1068    element.style.outline = "none";
1069    element.style.opacity = "0";
1070    element.style.position = "fixed";
1071    element.style.pointerEvents = "none";
1072    return element;
1073  }
1074  
1075  // node_modules/tslib/tslib.es6.mjs
1076  var __assign = function() {
1077    __assign = Object.assign || function __assign2(t2) {
1078      for (var s, i = 1, n = arguments.length; i < n; i++) {
1079        s = arguments[i];
1080        for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t2[p2] = s[p2];
1081      }
1082      return t2;
1083    };
1084    return __assign.apply(this, arguments);
1085  };
1086  function __rest(s, e) {
1087    var t2 = {};
1088    for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2) && e.indexOf(p2) < 0)
1089      t2[p2] = s[p2];
1090    if (s != null && typeof Object.getOwnPropertySymbols === "function")
1091      for (var i = 0, p2 = Object.getOwnPropertySymbols(s); i < p2.length; i++) {
1092        if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p2[i]))
1093          t2[p2[i]] = s[p2[i]];
1094      }
1095    return t2;
1096  }
1097  function __spreadArray(to, from, pack) {
1098    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1099      if (ar || !(i in from)) {
1100        if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1101        ar[i] = from[i];
1102      }
1103    }
1104    return to.concat(ar || Array.prototype.slice.call(from));
1105  }
1106  
1107  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js
1108  var React21 = __toESM(require_react());
1109  
1110  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js
1111  var React17 = __toESM(require_react());
1112  
1113  // node_modules/react-remove-scroll-bar/dist/es2015/constants.js
1114  var zeroRightClassName = "right-scroll-bar-position";
1115  var fullWidthClassName = "width-before-scroll-bar";
1116  var noScrollbarsClassName = "with-scroll-bars-hidden";
1117  var removedBarSizeVariable = "--removed-body-scroll-bar-size";
1118  
1119  // node_modules/use-callback-ref/dist/es2015/assignRef.js
1120  function assignRef(ref, value) {
1121    if (typeof ref === "function") {
1122      ref(value);
1123    } else if (ref) {
1124      ref.current = value;
1125    }
1126    return ref;
1127  }
1128  
1129  // node_modules/use-callback-ref/dist/es2015/useRef.js
1130  var import_react = __toESM(require_react());
1131  function useCallbackRef2(initialValue, callback) {
1132    var ref = (0, import_react.useState)(function() {
1133      return {
1134        // value
1135        value: initialValue,
1136        // last callback
1137        callback,
1138        // "memoized" public interface
1139        facade: {
1140          get current() {
1141            return ref.value;
1142          },
1143          set current(value) {
1144            var last = ref.value;
1145            if (last !== value) {
1146              ref.value = value;
1147              ref.callback(value, last);
1148            }
1149          }
1150        }
1151      };
1152    })[0];
1153    ref.callback = callback;
1154    return ref.facade;
1155  }
1156  
1157  // node_modules/use-callback-ref/dist/es2015/useMergeRef.js
1158  var React15 = __toESM(require_react());
1159  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React15.useLayoutEffect : React15.useEffect;
1160  var currentValues = /* @__PURE__ */ new WeakMap();
1161  function useMergeRefs(refs, defaultValue) {
1162    var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
1163      return refs.forEach(function(ref) {
1164        return assignRef(ref, newValue);
1165      });
1166    });
1167    useIsomorphicLayoutEffect(function() {
1168      var oldValue = currentValues.get(callbackRef);
1169      if (oldValue) {
1170        var prevRefs_1 = new Set(oldValue);
1171        var nextRefs_1 = new Set(refs);
1172        var current_1 = callbackRef.current;
1173        prevRefs_1.forEach(function(ref) {
1174          if (!nextRefs_1.has(ref)) {
1175            assignRef(ref, null);
1176          }
1177        });
1178        nextRefs_1.forEach(function(ref) {
1179          if (!prevRefs_1.has(ref)) {
1180            assignRef(ref, current_1);
1181          }
1182        });
1183      }
1184      currentValues.set(callbackRef, refs);
1185    }, [refs]);
1186    return callbackRef;
1187  }
1188  
1189  // node_modules/use-sidecar/dist/es2015/medium.js
1190  function ItoI(a) {
1191    return a;
1192  }
1193  function innerCreateMedium(defaults, middleware) {
1194    if (middleware === void 0) {
1195      middleware = ItoI;
1196    }
1197    var buffer = [];
1198    var assigned = false;
1199    var medium = {
1200      read: function() {
1201        if (assigned) {
1202          throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
1203        }
1204        if (buffer.length) {
1205          return buffer[buffer.length - 1];
1206        }
1207        return defaults;
1208      },
1209      useMedium: function(data) {
1210        var item = middleware(data, assigned);
1211        buffer.push(item);
1212        return function() {
1213          buffer = buffer.filter(function(x) {
1214            return x !== item;
1215          });
1216        };
1217      },
1218      assignSyncMedium: function(cb) {
1219        assigned = true;
1220        while (buffer.length) {
1221          var cbs = buffer;
1222          buffer = [];
1223          cbs.forEach(cb);
1224        }
1225        buffer = {
1226          push: function(x) {
1227            return cb(x);
1228          },
1229          filter: function() {
1230            return buffer;
1231          }
1232        };
1233      },
1234      assignMedium: function(cb) {
1235        assigned = true;
1236        var pendingQueue = [];
1237        if (buffer.length) {
1238          var cbs = buffer;
1239          buffer = [];
1240          cbs.forEach(cb);
1241          pendingQueue = buffer;
1242        }
1243        var executeQueue = function() {
1244          var cbs2 = pendingQueue;
1245          pendingQueue = [];
1246          cbs2.forEach(cb);
1247        };
1248        var cycle = function() {
1249          return Promise.resolve().then(executeQueue);
1250        };
1251        cycle();
1252        buffer = {
1253          push: function(x) {
1254            pendingQueue.push(x);
1255            cycle();
1256          },
1257          filter: function(filter) {
1258            pendingQueue = pendingQueue.filter(filter);
1259            return buffer;
1260          }
1261        };
1262      }
1263    };
1264    return medium;
1265  }
1266  function createSidecarMedium(options) {
1267    if (options === void 0) {
1268      options = {};
1269    }
1270    var medium = innerCreateMedium(null);
1271    medium.options = __assign({ async: true, ssr: false }, options);
1272    return medium;
1273  }
1274  
1275  // node_modules/use-sidecar/dist/es2015/exports.js
1276  var React16 = __toESM(require_react());
1277  var SideCar = function(_a) {
1278    var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
1279    if (!sideCar) {
1280      throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1281    }
1282    var Target = sideCar.read();
1283    if (!Target) {
1284      throw new Error("Sidecar medium not found");
1285    }
1286    return React16.createElement(Target, __assign({}, rest));
1287  };
1288  SideCar.isSideCarExport = true;
1289  function exportSidecar(medium, exported) {
1290    medium.useMedium(exported);
1291    return SideCar;
1292  }
1293  
1294  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js
1295  var effectCar = createSidecarMedium();
1296  
1297  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js
1298  var nothing = function() {
1299    return;
1300  };
1301  var RemoveScroll = React17.forwardRef(function(props, parentRef) {
1302    var ref = React17.useRef(null);
1303    var _a = React17.useState({
1304      onScrollCapture: nothing,
1305      onWheelCapture: nothing,
1306      onTouchMoveCapture: nothing
1307    }), callbacks = _a[0], setCallbacks = _a[1];
1308    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"]);
1309    var SideCar2 = sideCar;
1310    var containerRef = useMergeRefs([ref, parentRef]);
1311    var containerProps = __assign(__assign({}, rest), callbacks);
1312    return React17.createElement(
1313      React17.Fragment,
1314      null,
1315      enabled && React17.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
1316      forwardProps ? React17.cloneElement(React17.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React17.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
1317    );
1318  });
1319  RemoveScroll.defaultProps = {
1320    enabled: true,
1321    removeScrollBar: true,
1322    inert: false
1323  };
1324  RemoveScroll.classNames = {
1325    fullWidth: fullWidthClassName,
1326    zeroRight: zeroRightClassName
1327  };
1328  
1329  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
1330  var React20 = __toESM(require_react());
1331  
1332  // node_modules/react-remove-scroll-bar/dist/es2015/component.js
1333  var React19 = __toESM(require_react());
1334  
1335  // node_modules/react-style-singleton/dist/es2015/hook.js
1336  var React18 = __toESM(require_react());
1337  
1338  // node_modules/get-nonce/dist/es2015/index.js
1339  var currentNonce;
1340  var getNonce = function() {
1341    if (currentNonce) {
1342      return currentNonce;
1343    }
1344    if (typeof __webpack_nonce__ !== "undefined") {
1345      return __webpack_nonce__;
1346    }
1347    return void 0;
1348  };
1349  
1350  // node_modules/react-style-singleton/dist/es2015/singleton.js
1351  function makeStyleTag() {
1352    if (!document)
1353      return null;
1354    var tag = document.createElement("style");
1355    tag.type = "text/css";
1356    var nonce = getNonce();
1357    if (nonce) {
1358      tag.setAttribute("nonce", nonce);
1359    }
1360    return tag;
1361  }
1362  function injectStyles(tag, css) {
1363    if (tag.styleSheet) {
1364      tag.styleSheet.cssText = css;
1365    } else {
1366      tag.appendChild(document.createTextNode(css));
1367    }
1368  }
1369  function insertStyleTag(tag) {
1370    var head = document.head || document.getElementsByTagName("head")[0];
1371    head.appendChild(tag);
1372  }
1373  var stylesheetSingleton = function() {
1374    var counter = 0;
1375    var stylesheet = null;
1376    return {
1377      add: function(style) {
1378        if (counter == 0) {
1379          if (stylesheet = makeStyleTag()) {
1380            injectStyles(stylesheet, style);
1381            insertStyleTag(stylesheet);
1382          }
1383        }
1384        counter++;
1385      },
1386      remove: function() {
1387        counter--;
1388        if (!counter && stylesheet) {
1389          stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
1390          stylesheet = null;
1391        }
1392      }
1393    };
1394  };
1395  
1396  // node_modules/react-style-singleton/dist/es2015/hook.js
1397  var styleHookSingleton = function() {
1398    var sheet = stylesheetSingleton();
1399    return function(styles, isDynamic) {
1400      React18.useEffect(function() {
1401        sheet.add(styles);
1402        return function() {
1403          sheet.remove();
1404        };
1405      }, [styles && isDynamic]);
1406    };
1407  };
1408  
1409  // node_modules/react-style-singleton/dist/es2015/component.js
1410  var styleSingleton = function() {
1411    var useStyle = styleHookSingleton();
1412    var Sheet = function(_a) {
1413      var styles = _a.styles, dynamic = _a.dynamic;
1414      useStyle(styles, dynamic);
1415      return null;
1416    };
1417    return Sheet;
1418  };
1419  
1420  // node_modules/react-remove-scroll-bar/dist/es2015/utils.js
1421  var zeroGap = {
1422    left: 0,
1423    top: 0,
1424    right: 0,
1425    gap: 0
1426  };
1427  var parse = function(x) {
1428    return parseInt(x || "", 10) || 0;
1429  };
1430  var getOffset = function(gapMode) {
1431    var cs = window.getComputedStyle(document.body);
1432    var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
1433    var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
1434    var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
1435    return [parse(left), parse(top), parse(right)];
1436  };
1437  var getGapWidth = function(gapMode) {
1438    if (gapMode === void 0) {
1439      gapMode = "margin";
1440    }
1441    if (typeof window === "undefined") {
1442      return zeroGap;
1443    }
1444    var offsets = getOffset(gapMode);
1445    var documentWidth = document.documentElement.clientWidth;
1446    var windowWidth = window.innerWidth;
1447    return {
1448      left: offsets[0],
1449      top: offsets[1],
1450      right: offsets[2],
1451      gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
1452    };
1453  };
1454  
1455  // node_modules/react-remove-scroll-bar/dist/es2015/component.js
1456  var Style = styleSingleton();
1457  var lockAttribute = "data-scroll-locked";
1458  var getStyles = function(_a, allowRelative, gapMode, important) {
1459    var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
1460    if (gapMode === void 0) {
1461      gapMode = "margin";
1462    }
1463    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([
1464      allowRelative && "position: relative ".concat(important, ";"),
1465      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    "),
1466      gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
1467    ].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");
1468  };
1469  var getCurrentUseCounter = function() {
1470    var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
1471    return isFinite(counter) ? counter : 0;
1472  };
1473  var useLockAttribute = function() {
1474    React19.useEffect(function() {
1475      document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
1476      return function() {
1477        var newCounter = getCurrentUseCounter() - 1;
1478        if (newCounter <= 0) {
1479          document.body.removeAttribute(lockAttribute);
1480        } else {
1481          document.body.setAttribute(lockAttribute, newCounter.toString());
1482        }
1483      };
1484    }, []);
1485  };
1486  var RemoveScrollBar = function(_a) {
1487    var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
1488    useLockAttribute();
1489    var gap = React19.useMemo(function() {
1490      return getGapWidth(gapMode);
1491    }, [gapMode]);
1492    return React19.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
1493  };
1494  
1495  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
1496  var passiveSupported = false;
1497  if (typeof window !== "undefined") {
1498    try {
1499      options = Object.defineProperty({}, "passive", {
1500        get: function() {
1501          passiveSupported = true;
1502          return true;
1503        }
1504      });
1505      window.addEventListener("test", options, options);
1506      window.removeEventListener("test", options, options);
1507    } catch (err) {
1508      passiveSupported = false;
1509    }
1510  }
1511  var options;
1512  var nonPassive = passiveSupported ? { passive: false } : false;
1513  
1514  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
1515  var alwaysContainsScroll = function(node) {
1516    return node.tagName === "TEXTAREA";
1517  };
1518  var elementCanBeScrolled = function(node, overflow) {
1519    if (!(node instanceof Element)) {
1520      return false;
1521    }
1522    var styles = window.getComputedStyle(node);
1523    return (
1524      // not-not-scrollable
1525      styles[overflow] !== "hidden" && // contains scroll inside self
1526      !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
1527    );
1528  };
1529  var elementCouldBeVScrolled = function(node) {
1530    return elementCanBeScrolled(node, "overflowY");
1531  };
1532  var elementCouldBeHScrolled = function(node) {
1533    return elementCanBeScrolled(node, "overflowX");
1534  };
1535  var locationCouldBeScrolled = function(axis, node) {
1536    var ownerDocument = node.ownerDocument;
1537    var current = node;
1538    do {
1539      if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
1540        current = current.host;
1541      }
1542      var isScrollable = elementCouldBeScrolled(axis, current);
1543      if (isScrollable) {
1544        var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
1545        if (scrollHeight > clientHeight) {
1546          return true;
1547        }
1548      }
1549      current = current.parentNode;
1550    } while (current && current !== ownerDocument.body);
1551    return false;
1552  };
1553  var getVScrollVariables = function(_a) {
1554    var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
1555    return [
1556      scrollTop,
1557      scrollHeight,
1558      clientHeight
1559    ];
1560  };
1561  var getHScrollVariables = function(_a) {
1562    var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
1563    return [
1564      scrollLeft,
1565      scrollWidth,
1566      clientWidth
1567    ];
1568  };
1569  var elementCouldBeScrolled = function(axis, node) {
1570    return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
1571  };
1572  var getScrollVariables = function(axis, node) {
1573    return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
1574  };
1575  var getDirectionFactor = function(axis, direction) {
1576    return axis === "h" && direction === "rtl" ? -1 : 1;
1577  };
1578  var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
1579    var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
1580    var delta = directionFactor * sourceDelta;
1581    var target = event.target;
1582    var targetInLock = endTarget.contains(target);
1583    var shouldCancelScroll = false;
1584    var isDeltaPositive = delta > 0;
1585    var availableScroll = 0;
1586    var availableScrollTop = 0;
1587    do {
1588      if (!target) {
1589        break;
1590      }
1591      var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
1592      var elementScroll = scroll_1 - capacity - directionFactor * position;
1593      if (position || elementScroll) {
1594        if (elementCouldBeScrolled(axis, target)) {
1595          availableScroll += elementScroll;
1596          availableScrollTop += position;
1597        }
1598      }
1599      var parent_1 = target.parentNode;
1600      target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
1601    } while (
1602      // portaled content
1603      !targetInLock && target !== document.body || // self content
1604      targetInLock && (endTarget.contains(target) || endTarget === target)
1605    );
1606    if (isDeltaPositive && (noOverscroll && Math.abs(availableScroll) < 1 || !noOverscroll && delta > availableScroll)) {
1607      shouldCancelScroll = true;
1608    } else if (!isDeltaPositive && (noOverscroll && Math.abs(availableScrollTop) < 1 || !noOverscroll && -delta > availableScrollTop)) {
1609      shouldCancelScroll = true;
1610    }
1611    return shouldCancelScroll;
1612  };
1613  
1614  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
1615  var getTouchXY = function(event) {
1616    return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
1617  };
1618  var getDeltaXY = function(event) {
1619    return [event.deltaX, event.deltaY];
1620  };
1621  var extractRef = function(ref) {
1622    return ref && "current" in ref ? ref.current : ref;
1623  };
1624  var deltaCompare = function(x, y) {
1625    return x[0] === y[0] && x[1] === y[1];
1626  };
1627  var generateStyle = function(id) {
1628    return "\n  .block-interactivity-".concat(id, " {pointer-events: none;}\n  .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
1629  };
1630  var idCounter = 0;
1631  var lockStack = [];
1632  function RemoveScrollSideCar(props) {
1633    var shouldPreventQueue = React20.useRef([]);
1634    var touchStartRef = React20.useRef([0, 0]);
1635    var activeAxis = React20.useRef();
1636    var id = React20.useState(idCounter++)[0];
1637    var Style2 = React20.useState(styleSingleton)[0];
1638    var lastProps = React20.useRef(props);
1639    React20.useEffect(function() {
1640      lastProps.current = props;
1641    }, [props]);
1642    React20.useEffect(function() {
1643      if (props.inert) {
1644        document.body.classList.add("block-interactivity-".concat(id));
1645        var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
1646        allow_1.forEach(function(el) {
1647          return el.classList.add("allow-interactivity-".concat(id));
1648        });
1649        return function() {
1650          document.body.classList.remove("block-interactivity-".concat(id));
1651          allow_1.forEach(function(el) {
1652            return el.classList.remove("allow-interactivity-".concat(id));
1653          });
1654        };
1655      }
1656      return;
1657    }, [props.inert, props.lockRef.current, props.shards]);
1658    var shouldCancelEvent = React20.useCallback(function(event, parent) {
1659      if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
1660        return !lastProps.current.allowPinchZoom;
1661      }
1662      var touch = getTouchXY(event);
1663      var touchStart = touchStartRef.current;
1664      var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
1665      var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
1666      var currentAxis;
1667      var target = event.target;
1668      var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
1669      if ("touches" in event && moveDirection === "h" && target.type === "range") {
1670        return false;
1671      }
1672      var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1673      if (!canBeScrolledInMainDirection) {
1674        return true;
1675      }
1676      if (canBeScrolledInMainDirection) {
1677        currentAxis = moveDirection;
1678      } else {
1679        currentAxis = moveDirection === "v" ? "h" : "v";
1680        canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1681      }
1682      if (!canBeScrolledInMainDirection) {
1683        return false;
1684      }
1685      if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
1686        activeAxis.current = currentAxis;
1687      }
1688      if (!currentAxis) {
1689        return true;
1690      }
1691      var cancelingAxis = activeAxis.current || currentAxis;
1692      return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
1693    }, []);
1694    var shouldPrevent = React20.useCallback(function(_event) {
1695      var event = _event;
1696      if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
1697        return;
1698      }
1699      var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
1700      var sourceEvent = shouldPreventQueue.current.filter(function(e) {
1701        return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
1702      })[0];
1703      if (sourceEvent && sourceEvent.should) {
1704        if (event.cancelable) {
1705          event.preventDefault();
1706        }
1707        return;
1708      }
1709      if (!sourceEvent) {
1710        var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
1711          return node.contains(event.target);
1712        });
1713        var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
1714        if (shouldStop) {
1715          if (event.cancelable) {
1716            event.preventDefault();
1717          }
1718        }
1719      }
1720    }, []);
1721    var shouldCancel = React20.useCallback(function(name, delta, target, should) {
1722      var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
1723      shouldPreventQueue.current.push(event);
1724      setTimeout(function() {
1725        shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
1726          return e !== event;
1727        });
1728      }, 1);
1729    }, []);
1730    var scrollTouchStart = React20.useCallback(function(event) {
1731      touchStartRef.current = getTouchXY(event);
1732      activeAxis.current = void 0;
1733    }, []);
1734    var scrollWheel = React20.useCallback(function(event) {
1735      shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1736    }, []);
1737    var scrollTouchMove = React20.useCallback(function(event) {
1738      shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1739    }, []);
1740    React20.useEffect(function() {
1741      lockStack.push(Style2);
1742      props.setCallbacks({
1743        onScrollCapture: scrollWheel,
1744        onWheelCapture: scrollWheel,
1745        onTouchMoveCapture: scrollTouchMove
1746      });
1747      document.addEventListener("wheel", shouldPrevent, nonPassive);
1748      document.addEventListener("touchmove", shouldPrevent, nonPassive);
1749      document.addEventListener("touchstart", scrollTouchStart, nonPassive);
1750      return function() {
1751        lockStack = lockStack.filter(function(inst) {
1752          return inst !== Style2;
1753        });
1754        document.removeEventListener("wheel", shouldPrevent, nonPassive);
1755        document.removeEventListener("touchmove", shouldPrevent, nonPassive);
1756        document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
1757      };
1758    }, []);
1759    var removeScrollBar = props.removeScrollBar, inert = props.inert;
1760    return React20.createElement(
1761      React20.Fragment,
1762      null,
1763      inert ? React20.createElement(Style2, { styles: generateStyle(id) }) : null,
1764      removeScrollBar ? React20.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
1765    );
1766  }
1767  function getOutermostShadowParent(node) {
1768    var shadowParent = null;
1769    while (node !== null) {
1770      if (node instanceof ShadowRoot) {
1771        shadowParent = node.host;
1772        node = node.host;
1773      }
1774      node = node.parentNode;
1775    }
1776    return shadowParent;
1777  }
1778  
1779  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js
1780  var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
1781  
1782  // node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js
1783  var ReactRemoveScroll = React21.forwardRef(function(props, ref) {
1784    return React21.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
1785  });
1786  ReactRemoveScroll.classNames = RemoveScroll.classNames;
1787  var Combination_default = ReactRemoveScroll;
1788  
1789  // node_modules/aria-hidden/dist/es2015/index.js
1790  var getDefaultParent = function(originalTarget) {
1791    if (typeof document === "undefined") {
1792      return null;
1793    }
1794    var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
1795    return sampleTarget.ownerDocument.body;
1796  };
1797  var counterMap = /* @__PURE__ */ new WeakMap();
1798  var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1799  var markerMap = {};
1800  var lockCount = 0;
1801  var unwrapHost = function(node) {
1802    return node && (node.host || unwrapHost(node.parentNode));
1803  };
1804  var correctTargets = function(parent, targets) {
1805    return targets.map(function(target) {
1806      if (parent.contains(target)) {
1807        return target;
1808      }
1809      var correctedTarget = unwrapHost(target);
1810      if (correctedTarget && parent.contains(correctedTarget)) {
1811        return correctedTarget;
1812      }
1813      console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
1814      return null;
1815    }).filter(function(x) {
1816      return Boolean(x);
1817    });
1818  };
1819  var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
1820    var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1821    if (!markerMap[markerName]) {
1822      markerMap[markerName] = /* @__PURE__ */ new WeakMap();
1823    }
1824    var markerCounter = markerMap[markerName];
1825    var hiddenNodes = [];
1826    var elementsToKeep = /* @__PURE__ */ new Set();
1827    var elementsToStop = new Set(targets);
1828    var keep = function(el) {
1829      if (!el || elementsToKeep.has(el)) {
1830        return;
1831      }
1832      elementsToKeep.add(el);
1833      keep(el.parentNode);
1834    };
1835    targets.forEach(keep);
1836    var deep = function(parent) {
1837      if (!parent || elementsToStop.has(parent)) {
1838        return;
1839      }
1840      Array.prototype.forEach.call(parent.children, function(node) {
1841        if (elementsToKeep.has(node)) {
1842          deep(node);
1843        } else {
1844          try {
1845            var attr = node.getAttribute(controlAttribute);
1846            var alreadyHidden = attr !== null && attr !== "false";
1847            var counterValue = (counterMap.get(node) || 0) + 1;
1848            var markerValue = (markerCounter.get(node) || 0) + 1;
1849            counterMap.set(node, counterValue);
1850            markerCounter.set(node, markerValue);
1851            hiddenNodes.push(node);
1852            if (counterValue === 1 && alreadyHidden) {
1853              uncontrolledNodes.set(node, true);
1854            }
1855            if (markerValue === 1) {
1856              node.setAttribute(markerName, "true");
1857            }
1858            if (!alreadyHidden) {
1859              node.setAttribute(controlAttribute, "true");
1860            }
1861          } catch (e) {
1862            console.error("aria-hidden: cannot operate on ", node, e);
1863          }
1864        }
1865      });
1866    };
1867    deep(parentNode);
1868    elementsToKeep.clear();
1869    lockCount++;
1870    return function() {
1871      hiddenNodes.forEach(function(node) {
1872        var counterValue = counterMap.get(node) - 1;
1873        var markerValue = markerCounter.get(node) - 1;
1874        counterMap.set(node, counterValue);
1875        markerCounter.set(node, markerValue);
1876        if (!counterValue) {
1877          if (!uncontrolledNodes.has(node)) {
1878            node.removeAttribute(controlAttribute);
1879          }
1880          uncontrolledNodes.delete(node);
1881        }
1882        if (!markerValue) {
1883          node.removeAttribute(markerName);
1884        }
1885      });
1886      lockCount--;
1887      if (!lockCount) {
1888        counterMap = /* @__PURE__ */ new WeakMap();
1889        counterMap = /* @__PURE__ */ new WeakMap();
1890        uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1891        markerMap = {};
1892      }
1893    };
1894  };
1895  var hideOthers = function(originalTarget, parentNode, markerName) {
1896    if (markerName === void 0) {
1897      markerName = "data-aria-hidden";
1898    }
1899    var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1900    var activeParentNode = parentNode || getDefaultParent(originalTarget);
1901    if (!activeParentNode) {
1902      return function() {
1903        return null;
1904      };
1905    }
1906    targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
1907    return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1908  };
1909  
1910  // node_modules/@radix-ui/react-dialog/dist/index.mjs
1911  var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
1912  var DIALOG_NAME = "Dialog";
1913  var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
1914  var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
1915  var Dialog = (props) => {
1916    const {
1917      __scopeDialog,
1918      children,
1919      open: openProp,
1920      defaultOpen,
1921      onOpenChange,
1922      modal = true
1923    } = props;
1924    const triggerRef = React24.useRef(null);
1925    const contentRef = React24.useRef(null);
1926    const [open, setOpen] = useControllableState({
1927      prop: openProp,
1928      defaultProp: defaultOpen ?? false,
1929      onChange: onOpenChange,
1930      caller: DIALOG_NAME
1931    });
1932    return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1933      DialogProvider,
1934      {
1935        scope: __scopeDialog,
1936        triggerRef,
1937        contentRef,
1938        contentId: useId(),
1939        titleId: useId(),
1940        descriptionId: useId(),
1941        open,
1942        onOpenChange: setOpen,
1943        onOpenToggle: React24.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
1944        modal,
1945        children
1946      }
1947    );
1948  };
1949  Dialog.displayName = DIALOG_NAME;
1950  var TRIGGER_NAME = "DialogTrigger";
1951  var DialogTrigger = React24.forwardRef(
1952    (props, forwardedRef) => {
1953      const { __scopeDialog, ...triggerProps } = props;
1954      const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
1955      const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
1956      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1957        Primitive.button,
1958        {
1959          type: "button",
1960          "aria-haspopup": "dialog",
1961          "aria-expanded": context.open,
1962          "aria-controls": context.contentId,
1963          "data-state": getState(context.open),
1964          ...triggerProps,
1965          ref: composedTriggerRef,
1966          onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
1967        }
1968      );
1969    }
1970  );
1971  DialogTrigger.displayName = TRIGGER_NAME;
1972  var PORTAL_NAME2 = "DialogPortal";
1973  var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME2, {
1974    forceMount: void 0
1975  });
1976  var DialogPortal = (props) => {
1977    const { __scopeDialog, forceMount, children, container } = props;
1978    const context = useDialogContext(PORTAL_NAME2, __scopeDialog);
1979    return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: React24.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Portal, { asChild: true, container, children: child }) })) });
1980  };
1981  DialogPortal.displayName = PORTAL_NAME2;
1982  var OVERLAY_NAME = "DialogOverlay";
1983  var DialogOverlay = React24.forwardRef(
1984    (props, forwardedRef) => {
1985      const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
1986      const { forceMount = portalContext.forceMount, ...overlayProps } = props;
1987      const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
1988      return context.modal ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
1989    }
1990  );
1991  DialogOverlay.displayName = OVERLAY_NAME;
1992  var Slot = createSlot("DialogOverlay.RemoveScroll");
1993  var DialogOverlayImpl = React24.forwardRef(
1994    (props, forwardedRef) => {
1995      const { __scopeDialog, ...overlayProps } = props;
1996      const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
1997      return (
1998        // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1999        // ie. when `Overlay` and `Content` are siblings
2000        /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Combination_default, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2001          Primitive.div,
2002          {
2003            "data-state": getState(context.open),
2004            ...overlayProps,
2005            ref: forwardedRef,
2006            style: { pointerEvents: "auto", ...overlayProps.style }
2007          }
2008        ) })
2009      );
2010    }
2011  );
2012  var CONTENT_NAME = "DialogContent";
2013  var DialogContent = React24.forwardRef(
2014    (props, forwardedRef) => {
2015      const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
2016      const { forceMount = portalContext.forceMount, ...contentProps } = props;
2017      const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2018      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
2019    }
2020  );
2021  DialogContent.displayName = CONTENT_NAME;
2022  var DialogContentModal = React24.forwardRef(
2023    (props, forwardedRef) => {
2024      const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2025      const contentRef = React24.useRef(null);
2026      const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
2027      React24.useEffect(() => {
2028        const content = contentRef.current;
2029        if (content) return hideOthers(content);
2030      }, []);
2031      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2032        DialogContentImpl,
2033        {
2034          ...props,
2035          ref: composedRefs,
2036          trapFocus: context.open,
2037          disableOutsidePointerEvents: true,
2038          onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
2039            event.preventDefault();
2040            context.triggerRef.current?.focus();
2041          }),
2042          onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
2043            const originalEvent = event.detail.originalEvent;
2044            const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
2045            const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
2046            if (isRightClick) event.preventDefault();
2047          }),
2048          onFocusOutside: composeEventHandlers(
2049            props.onFocusOutside,
2050            (event) => event.preventDefault()
2051          )
2052        }
2053      );
2054    }
2055  );
2056  var DialogContentNonModal = React24.forwardRef(
2057    (props, forwardedRef) => {
2058      const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
2059      const hasInteractedOutsideRef = React24.useRef(false);
2060      const hasPointerDownOutsideRef = React24.useRef(false);
2061      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2062        DialogContentImpl,
2063        {
2064          ...props,
2065          ref: forwardedRef,
2066          trapFocus: false,
2067          disableOutsidePointerEvents: false,
2068          onCloseAutoFocus: (event) => {
2069            props.onCloseAutoFocus?.(event);
2070            if (!event.defaultPrevented) {
2071              if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
2072              event.preventDefault();
2073            }
2074            hasInteractedOutsideRef.current = false;
2075            hasPointerDownOutsideRef.current = false;
2076          },
2077          onInteractOutside: (event) => {
2078            props.onInteractOutside?.(event);
2079            if (!event.defaultPrevented) {
2080              hasInteractedOutsideRef.current = true;
2081              if (event.detail.originalEvent.type === "pointerdown") {
2082                hasPointerDownOutsideRef.current = true;
2083              }
2084            }
2085            const target = event.target;
2086            const targetIsTrigger = context.triggerRef.current?.contains(target);
2087            if (targetIsTrigger) event.preventDefault();
2088            if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2089              event.preventDefault();
2090            }
2091          }
2092        }
2093      );
2094    }
2095  );
2096  var DialogContentImpl = React24.forwardRef(
2097    (props, forwardedRef) => {
2098      const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
2099      const context = useDialogContext(CONTENT_NAME, __scopeDialog);
2100      const contentRef = React24.useRef(null);
2101      const composedRefs = useComposedRefs(forwardedRef, contentRef);
2102      useFocusGuards();
2103      return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2104        /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2105          FocusScope,
2106          {
2107            asChild: true,
2108            loop: true,
2109            trapped: trapFocus,
2110            onMountAutoFocus: onOpenAutoFocus,
2111            onUnmountAutoFocus: onCloseAutoFocus,
2112            children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2113              DismissableLayer,
2114              {
2115                role: "dialog",
2116                id: context.contentId,
2117                "aria-describedby": context.descriptionId,
2118                "aria-labelledby": context.titleId,
2119                "data-state": getState(context.open),
2120                ...contentProps,
2121                ref: composedRefs,
2122                onDismiss: () => context.onOpenChange(false)
2123              }
2124            )
2125          }
2126        ),
2127        /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
2128          /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TitleWarning, { titleId: context.titleId }),
2129          /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
2130        ] })
2131      ] });
2132    }
2133  );
2134  var TITLE_NAME = "DialogTitle";
2135  var DialogTitle = React24.forwardRef(
2136    (props, forwardedRef) => {
2137      const { __scopeDialog, ...titleProps } = props;
2138      const context = useDialogContext(TITLE_NAME, __scopeDialog);
2139      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
2140    }
2141  );
2142  DialogTitle.displayName = TITLE_NAME;
2143  var DESCRIPTION_NAME = "DialogDescription";
2144  var DialogDescription = React24.forwardRef(
2145    (props, forwardedRef) => {
2146      const { __scopeDialog, ...descriptionProps } = props;
2147      const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
2148      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
2149    }
2150  );
2151  DialogDescription.displayName = DESCRIPTION_NAME;
2152  var CLOSE_NAME = "DialogClose";
2153  var DialogClose = React24.forwardRef(
2154    (props, forwardedRef) => {
2155      const { __scopeDialog, ...closeProps } = props;
2156      const context = useDialogContext(CLOSE_NAME, __scopeDialog);
2157      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2158        Primitive.button,
2159        {
2160          type: "button",
2161          ...closeProps,
2162          ref: forwardedRef,
2163          onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
2164        }
2165      );
2166    }
2167  );
2168  DialogClose.displayName = CLOSE_NAME;
2169  function getState(open) {
2170    return open ? "open" : "closed";
2171  }
2172  var TITLE_WARNING_NAME = "DialogTitleWarning";
2173  var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
2174    contentName: CONTENT_NAME,
2175    titleName: TITLE_NAME,
2176    docsSlug: "dialog"
2177  });
2178  var TitleWarning = ({ titleId }) => {
2179    const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
2180    const MESSAGE = `\`$titleWarningContext.contentName}\` requires a \`$titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
2181  
2182  If you want to hide the \`$titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
2183  
2184  For more information, see https://radix-ui.com/primitives/docs/components/$titleWarningContext.docsSlug}`;
2185    React24.useEffect(() => {
2186      if (titleId) {
2187        const hasTitle = document.getElementById(titleId);
2188        if (!hasTitle) console.error(MESSAGE);
2189      }
2190    }, [MESSAGE, titleId]);
2191    return null;
2192  };
2193  var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
2194  var DescriptionWarning = ({ contentRef, descriptionId }) => {
2195    const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
2196    const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {$descriptionWarningContext.contentName}}.`;
2197    React24.useEffect(() => {
2198      const describedById = contentRef.current?.getAttribute("aria-describedby");
2199      if (descriptionId && describedById) {
2200        const hasDescription = document.getElementById(descriptionId);
2201        if (!hasDescription) console.warn(MESSAGE);
2202      }
2203    }, [MESSAGE, contentRef, descriptionId]);
2204    return null;
2205  };
2206  var Root = Dialog;
2207  var Portal2 = DialogPortal;
2208  var Overlay = DialogOverlay;
2209  var Content = DialogContent;
2210  
2211  // node_modules/cmdk/dist/index.mjs
2212  var t = __toESM(require_react(), 1);
2213  var N = '[cmdk-group=""]';
2214  var Y2 = '[cmdk-group-items=""]';
2215  var be = '[cmdk-group-heading=""]';
2216  var le = '[cmdk-item=""]';
2217  var ce = `$le}:not([aria-disabled="true"])`;
2218  var Z = "cmdk-item-select";
2219  var T = "data-value";
2220  var Re = (r, o, n) => W(r, o, n);
2221  var ue = t.createContext(void 0);
2222  var K2 = () => t.useContext(ue);
2223  var de = t.createContext(void 0);
2224  var ee = () => t.useContext(de);
2225  var fe = t.createContext(void 0);
2226  var me = t.forwardRef((r, o) => {
2227    let n = L(() => {
2228      var e, a;
2229      return { search: "", value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
2230    }), u2 = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: b, children: m2, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = false, vimBindings: j = true, ...O } = r, $2 = useId(), q = useId(), _ = useId(), I = t.useRef(null), v = ke();
2231    k2(() => {
2232      if (R !== void 0) {
2233        let e = R.trim();
2234        n.current.value = e, E.emit();
2235      }
2236    }, [R]), k2(() => {
2237      v(6, ne);
2238    }, []);
2239    let E = t.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => n.current, setState: (e, a, s) => {
2240      var i, l, g, y;
2241      if (!Object.is(n.current[e], a)) {
2242        if (n.current[e] = a, e === "search") J2(), z(), v(1, W2);
2243        else if (e === "value") {
2244          if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
2245            let h = document.getElementById(_);
2246            h ? h.focus() : (i = document.getElementById($2)) == null || i.focus();
2247          }
2248          if (v(7, () => {
2249            var h;
2250            n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit();
2251          }), s || v(5, ne), ((l = p2.current) == null ? void 0 : l.value) !== void 0) {
2252            let h = a != null ? a : "";
2253            (y = (g = p2.current).onValueChange) == null || y.call(g, h);
2254            return;
2255          }
2256        }
2257        E.emit();
2258      }
2259    }, emit: () => {
2260      f.current.forEach((e) => e());
2261    } }), []), U2 = t.useMemo(() => ({ value: (e, a, s) => {
2262      var i;
2263      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, () => {
2264        z(), E.emit();
2265      }));
2266    }, 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, () => {
2267      J2(), z(), n.current.value || W2(), E.emit();
2268    }), () => {
2269      d.current.delete(e), u2.current.delete(e), n.current.filtered.items.delete(e);
2270      let s = M();
2271      v(4, () => {
2272        J2(), (s == null ? void 0 : s.getAttribute("id")) === e && W2(), E.emit();
2273      });
2274    }), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
2275      d.current.delete(e), c.current.delete(e);
2276    }), filter: () => p2.current.shouldFilter, label: b || r["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: $2, inputId: _, labelId: q, listInnerRef: I }), []);
2277    function te(e, a) {
2278      var i, l;
2279      let s = (l = (i = p2.current) == null ? void 0 : i.filter) != null ? l : Re;
2280      return e ? s(e, n.current.search, a) : 0;
2281    }
2282    function z() {
2283      if (!n.current.search || p2.current.shouldFilter === false) return;
2284      let e = n.current.filtered.items, a = [];
2285      n.current.filtered.groups.forEach((i) => {
2286        let l = c.current.get(i), g = 0;
2287        l.forEach((y) => {
2288          let h = e.get(y);
2289          g = Math.max(h, g);
2290        }), a.push([i, g]);
2291      });
2292      let s = I.current;
2293      V().sort((i, l) => {
2294        var h, F;
2295        let g = i.getAttribute("id"), y = l.getAttribute("id");
2296        return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0);
2297      }).forEach((i) => {
2298        let l = i.closest(Y2);
2299        l ? l.appendChild(i.parentElement === l ? i : i.closest(`$Y2} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`$Y2} > *`));
2300      }), a.sort((i, l) => l[1] - i[1]).forEach((i) => {
2301        var g;
2302        let l = (g = I.current) == null ? void 0 : g.querySelector(`$N}[$T}="$encodeURIComponent(i[0])}"]`);
2303        l == null || l.parentElement.appendChild(l);
2304      });
2305    }
2306    function W2() {
2307      let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T);
2308      E.setState("value", a || void 0);
2309    }
2310    function J2() {
2311      var a, s, i, l;
2312      if (!n.current.search || p2.current.shouldFilter === false) {
2313        n.current.filtered.count = u2.current.size;
2314        return;
2315      }
2316      n.current.filtered.groups = /* @__PURE__ */ new Set();
2317      let e = 0;
2318      for (let g of u2.current) {
2319        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);
2320        n.current.filtered.items.set(g, F), F > 0 && e++;
2321      }
2322      for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
2323        n.current.filtered.groups.add(g);
2324        break;
2325      }
2326      n.current.filtered.count = e;
2327    }
2328    function ne() {
2329      var a, s, i;
2330      let e = M();
2331      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" }));
2332    }
2333    function M() {
2334      var e;
2335      return (e = I.current) == null ? void 0 : e.querySelector(`$le}[aria-selected="true"]`);
2336    }
2337    function V() {
2338      var e;
2339      return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
2340    }
2341    function X2(e) {
2342      let s = V()[e];
2343      s && E.setState("value", s.getAttribute(T));
2344    }
2345    function Q(e) {
2346      var g;
2347      let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e];
2348      (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));
2349    }
2350    function re(e) {
2351      let a = M(), s = a == null ? void 0 : a.closest(N), i;
2352      for (; s && !i; ) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
2353      i ? E.setState("value", i.getAttribute(T)) : Q(e);
2354    }
2355    let oe = () => X2(V().length - 1), ie = (e) => {
2356      e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
2357    }, se = (e) => {
2358      e.preventDefault(), e.metaKey ? X2(0) : e.altKey ? re(-1) : Q(-1);
2359    };
2360    return t.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
2361      var s;
2362      (s = O.onKeyDown) == null || s.call(O, e);
2363      let a = e.nativeEvent.isComposing || e.keyCode === 229;
2364      if (!(e.defaultPrevented || a)) switch (e.key) {
2365        case "n":
2366        case "j": {
2367          j && e.ctrlKey && ie(e);
2368          break;
2369        }
2370        case "ArrowDown": {
2371          ie(e);
2372          break;
2373        }
2374        case "p":
2375        case "k": {
2376          j && e.ctrlKey && se(e);
2377          break;
2378        }
2379        case "ArrowUp": {
2380          se(e);
2381          break;
2382        }
2383        case "Home": {
2384          e.preventDefault(), X2(0);
2385          break;
2386        }
2387        case "End": {
2388          e.preventDefault(), oe();
2389          break;
2390        }
2391        case "Enter": {
2392          e.preventDefault();
2393          let i = M();
2394          if (i) {
2395            let l = new Event(Z);
2396            i.dispatchEvent(l);
2397          }
2398        }
2399      }
2400    } }, t.createElement("label", { "cmdk-label": "", htmlFor: U2.inputId, id: U2.labelId, style: Te }, b), B2(r, (e) => t.createElement(de.Provider, { value: E }, t.createElement(ue.Provider, { value: U2 }, e))));
2401  });
2402  var he = t.forwardRef((r, o) => {
2403    var _, I;
2404    let n = useId(), u2 = t.useRef(null), c = t.useContext(fe), d = K2(), f = pe(r), p2 = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
2405    k2(() => {
2406      if (!p2) return d.item(n, c == null ? void 0 : c.id);
2407    }, [p2]);
2408    let b = ve(n, u2, [r.value, r.children, u2], r.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);
2409    t.useEffect(() => {
2410      let v = u2.current;
2411      if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
2412    }, [x, r.onSelect, r.disabled]);
2413    function C() {
2414      var v, E;
2415      S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current);
2416    }
2417    function S() {
2418      m2.setState("value", b.current, true);
2419    }
2420    if (!x) return null;
2421    let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $2, ...q } = r;
2422    return t.createElement(Primitive.div, { ref: composeRefs(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 }, r.children);
2423  });
2424  var Ee = t.forwardRef((r, o) => {
2425    let { heading: n, children: u2, forceMount: c, ...d } = r, f = useId(), p2 = t.useRef(null), b = t.useRef(null), m2 = useId(), R = K2(), x = P((S) => c || R.filter() === false ? true : S.search ? S.filtered.groups.has(f) : true);
2426    k2(() => R.group(f), []), ve(f, p2, [r.value, r.heading, b]);
2427    let C = t.useMemo(() => ({ id: f, forceMount: c }), [c]);
2428    return t.createElement(Primitive.div, { ref: composeRefs(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(r, (S) => t.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? m2 : void 0 }, t.createElement(fe.Provider, { value: C }, S))));
2429  });
2430  var ye = t.forwardRef((r, o) => {
2431    let { alwaysRender: n, ...u2 } = r, c = t.useRef(null), d = P((f) => !f.search);
2432    return !n && !d ? null : t.createElement(Primitive.div, { ref: composeRefs(c, o), ...u2, "cmdk-separator": "", role: "separator" });
2433  });
2434  var Se = t.forwardRef((r, o) => {
2435    let { onValueChange: n, ...u2 } = r, c = r.value != null, d = ee(), f = P((m2) => m2.search), p2 = P((m2) => m2.selectedItemId), b = K2();
2436    return t.useEffect(() => {
2437      r.value != null && d.setState("search", r.value);
2438    }, [r.value]), t.createElement(Primitive.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 ? r.value : f, onChange: (m2) => {
2439      c || d.setState("search", m2.target.value), n == null || n(m2.target.value);
2440    } });
2441  });
2442  var Ce = t.forwardRef((r, o) => {
2443    let { children: n, label: u2 = "Suggestions", ...c } = r, d = t.useRef(null), f = t.useRef(null), p2 = P((m2) => m2.selectedItemId), b = K2();
2444    return t.useEffect(() => {
2445      if (f.current && d.current) {
2446        let m2 = f.current, R = d.current, x, C = new ResizeObserver(() => {
2447          x = requestAnimationFrame(() => {
2448            let S = m2.offsetHeight;
2449            R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
2450          });
2451        });
2452        return C.observe(m2), () => {
2453          cancelAnimationFrame(x), C.unobserve(m2);
2454        };
2455      }
2456    }, []), t.createElement(Primitive.div, { ref: composeRefs(d, o), ...c, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": p2, "aria-label": u2, id: b.listId }, B2(r, (m2) => t.createElement("div", { ref: composeRefs(f, b.listInnerRef), "cmdk-list-sizer": "" }, m2)));
2457  });
2458  var xe = t.forwardRef((r, o) => {
2459    let { open: n, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
2460    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": r.label, "cmdk-dialog": "", className: d }, t.createElement(me, { ref: o, ...p2 }))));
2461  });
2462  var Ie = t.forwardRef((r, o) => P((u2) => u2.filtered.count === 0) ? t.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null);
2463  var Pe = t.forwardRef((r, o) => {
2464    let { progress: n, children: u2, label: c = "Loading...", ...d } = r;
2465    return t.createElement(Primitive.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, B2(r, (f) => t.createElement("div", { "aria-hidden": true }, f)));
2466  });
2467  var _e = Object.assign(me, { List: Ce, Item: he, Input: Se, Group: Ee, Separator: ye, Dialog: xe, Empty: Ie, Loading: Pe });
2468  function we(r, o) {
2469    let n = r.nextElementSibling;
2470    for (; n; ) {
2471      if (n.matches(o)) return n;
2472      n = n.nextElementSibling;
2473    }
2474  }
2475  function De(r, o) {
2476    let n = r.previousElementSibling;
2477    for (; n; ) {
2478      if (n.matches(o)) return n;
2479      n = n.previousElementSibling;
2480    }
2481  }
2482  function pe(r) {
2483    let o = t.useRef(r);
2484    return k2(() => {
2485      o.current = r;
2486    }), o;
2487  }
2488  var k2 = typeof window == "undefined" ? t.useEffect : t.useLayoutEffect;
2489  function L(r) {
2490    let o = t.useRef();
2491    return o.current === void 0 && (o.current = r()), o;
2492  }
2493  function P(r) {
2494    let o = ee(), n = () => r(o.snapshot());
2495    return t.useSyncExternalStore(o.subscribe, n, n);
2496  }
2497  function ve(r, o, n, u2 = []) {
2498    let c = t.useRef(), d = K2();
2499    return k2(() => {
2500      var b;
2501      let f = (() => {
2502        var m2;
2503        for (let R of n) {
2504          if (typeof R == "string") return R.trim();
2505          if (typeof R == "object" && "current" in R) return R.current ? (m2 = R.current.textContent) == null ? void 0 : m2.trim() : c.current;
2506        }
2507      })(), p2 = u2.map((m2) => m2.trim());
2508      d.value(r, f, p2), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
2509    }), c;
2510  }
2511  var ke = () => {
2512    let [r, o] = t.useState(), n = L(() => /* @__PURE__ */ new Map());
2513    return k2(() => {
2514      n.current.forEach((u2) => u2()), n.current = /* @__PURE__ */ new Map();
2515    }, [r]), (u2, c) => {
2516      n.current.set(u2, c), o({});
2517    };
2518  };
2519  function Me(r) {
2520    let o = r.type;
2521    return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r;
2522  }
2523  function B2({ asChild: r, children: o }, n) {
2524    return r && t.isValidElement(o) ? t.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o);
2525  }
2526  var Te = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
2527  
2528  // packages/workflow/build-module/components/workflow-menu.mjs
2529  var import_data = __toESM(require_data(), 1);
2530  var import_element2 = __toESM(require_element(), 1);
2531  var import_i18n = __toESM(require_i18n(), 1);
2532  var import_components = __toESM(require_components(), 1);
2533  var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
2534  
2535  // packages/icons/build-module/icon/index.mjs
2536  var import_element = __toESM(require_element(), 1);
2537  var icon_default = (0, import_element.forwardRef)(
2538    ({ icon, size = 24, ...props }, ref) => {
2539      return (0, import_element.cloneElement)(icon, {
2540        width: size,
2541        height: size,
2542        ...props,
2543        ref
2544      });
2545    }
2546  );
2547  
2548  // packages/icons/build-module/library/search.mjs
2549  var import_primitives = __toESM(require_primitives(), 1);
2550  var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
2551  var search_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.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" }) });
2552  
2553  // packages/workflow/build-module/components/workflow-menu.mjs
2554  import { executeAbility, store as abilitiesStore } from "@wordpress/abilities";
2555  
2556  // packages/workflow/build-module/lock-unlock.mjs
2557  var import_private_apis = __toESM(require_private_apis(), 1);
2558  var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
2559    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
2560    "@wordpress/workflows"
2561  );
2562  
2563  // packages/workflow/build-module/components/workflow-menu.mjs
2564  var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
2565  if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='846895dde0']")) {
2566    const style = document.createElement("style");
2567    style.setAttribute("data-wp-hash", "846895dde0");
2568    style.appendChild(document.createTextNode(":root{--wp-block-synced-color:#7a00df;--wp-block-synced-color--rgb:122,0,223;--wp-bound-block-color:var(--wp-block-synced-color);--wp-editor-canvas-background:#ddd;--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,160.5;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.workflows-workflow-menu{border-radius:4px;margin:auto;max-width:400px;position:relative;top:calc(5% + 64px);width:calc(100% - 32px)}@media (min-width:600px){.workflows-workflow-menu{top:calc(10% + 64px)}}.workflows-workflow-menu .components-modal__content{margin:0;padding:0}.workflows-workflow-menu__overlay{align-items:start;display:block}.workflows-workflow-menu__header{padding:0 16px}.workflows-workflow-menu__header-search-icon:dir(ltr){transform:scaleX(-1)}.workflows-workflow-menu__container{will-change:transform}.workflows-workflow-menu__container:focus{outline:none}.workflows-workflow-menu__container [cmdk-input]{border:none;border-radius:0;color:#1e1e1e;font-size:15px;line-height:28px;margin:0;outline:none;padding:16px 4px;width:100%}.workflows-workflow-menu__container [cmdk-input]::placeholder{color:#757575}.workflows-workflow-menu__container [cmdk-input]:focus{box-shadow:none;outline:none}.workflows-workflow-menu__container [cmdk-item]{align-items:center;border-radius:2px;color:#1e1e1e;cursor:var(--wpds-cursor-control,pointer);display:flex;font-size:13px}.workflows-workflow-menu__container [cmdk-item]:active,.workflows-workflow-menu__container [cmdk-item][aria-selected=true]{background:var(--wp-admin-theme-color);color:#fff}.workflows-workflow-menu__container [cmdk-item][aria-disabled=true]{color:#949494;cursor:not-allowed}.workflows-workflow-menu__container [cmdk-item]>div{min-height:40px;padding:4px 4px 4px 16px}.workflows-workflow-menu__container [cmdk-root]>[cmdk-list]{max-height:376px;overflow:auto}.workflows-workflow-menu__container [cmdk-root]>[cmdk-list] [cmdk-list-sizer]>[cmdk-group]:last-child [cmdk-group-items]:not(:empty){padding-bottom:8px}.workflows-workflow-menu__container [cmdk-root]>[cmdk-list] [cmdk-list-sizer]>[cmdk-group]>[cmdk-group-items]:not(:empty){padding:0 8px}.workflows-workflow-menu__container [cmdk-empty]{align-items:center;color:#1e1e1e;display:flex;justify-content:center;padding:8px 0 32px;white-space:pre-wrap}.workflows-workflow-menu__container [cmdk-loading]{padding:16px}.workflows-workflow-menu__container [cmdk-list-sizer]{position:relative}.workflows-workflow-menu__item span{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.workflows-workflow-menu__item mark{background:unset;color:inherit;font-weight:var(--wpds-typography-font-weight-emphasis,600)}.workflows-workflow-menu__output{padding:16px}.workflows-workflow-menu__output-header{border-bottom:1px solid #ddd;margin-bottom:16px;padding-bottom:8px}.workflows-workflow-menu__output-header h3{color:#1e1e1e;font-size:16px;font-weight:var(--wpds-typography-font-weight-emphasis,600);margin:0 0 4px}.workflows-workflow-menu__output-hint{color:#757575;font-size:12px;margin:0}.workflows-workflow-menu__output-content{max-height:400px;overflow:auto}.workflows-workflow-menu__output-content pre{background:#f0f0f0;border-radius:2px;color:#1e1e1e;font-size:12px;line-height:1.5;margin:0;padding:12px;white-space:pre-wrap;word-break:break-word}.workflows-workflow-menu__output-error{background:#e0e0e0;border:1px solid #9e1313;border-radius:2px;color:#cc1818;padding:12px}.workflows-workflow-menu__output-error p{font-size:13px;margin:0}.workflows-workflow-menu__executing{color:#757575;font-size:14px;padding:24px 16px}"));
2569    document.head.appendChild(style);
2570  }
2571  var { withIgnoreIMEEvents } = unlock(import_components.privateApis);
2572  var EMPTY_ARRAY = [];
2573  var inputLabel = (0, import_i18n.__)("Run abilities and workflows");
2574  function WorkflowInput({ isOpen, search, setSearch, abilities }) {
2575    const workflowMenuInput = (0, import_element2.useRef)();
2576    const _value = P((state) => state.value);
2577    const selectedItemId = (0, import_element2.useMemo)(() => {
2578      const ability = abilities.find((a) => a.label === _value);
2579      return ability?.name;
2580    }, [_value, abilities]);
2581    (0, import_element2.useEffect)(() => {
2582      if (isOpen) {
2583        workflowMenuInput.current.focus();
2584      }
2585    }, [isOpen]);
2586    return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2587      _e.Input,
2588      {
2589        ref: workflowMenuInput,
2590        value: search,
2591        onValueChange: setSearch,
2592        placeholder: inputLabel,
2593        "aria-activedescendant": selectedItemId
2594      }
2595    );
2596  }
2597  function WorkflowMenu() {
2598    const { registerShortcut } = (0, import_data.useDispatch)(import_keyboard_shortcuts.store);
2599    const [search, setSearch] = (0, import_element2.useState)("");
2600    const [isOpen, setIsOpen] = (0, import_element2.useState)(false);
2601    const [abilityOutput, setAbilityOutput] = (0, import_element2.useState)(null);
2602    const [isExecuting, setIsExecuting] = (0, import_element2.useState)(false);
2603    const containerRef = (0, import_element2.useRef)();
2604    const abilities = (0, import_data.useSelect)((select) => {
2605      const allAbilities = select(abilitiesStore).getAbilities();
2606      return allAbilities || EMPTY_ARRAY;
2607    }, []);
2608    const filteredAbilities = (0, import_element2.useMemo)(() => {
2609      if (!search) {
2610        return abilities;
2611      }
2612      const searchLower = search.toLowerCase();
2613      return abilities.filter(
2614        (ability) => ability.label?.toLowerCase().includes(searchLower) || ability.name?.toLowerCase().includes(searchLower)
2615      );
2616    }, [abilities, search]);
2617    (0, import_element2.useEffect)(() => {
2618      if (abilityOutput && containerRef.current) {
2619        containerRef.current.focus();
2620      }
2621    }, [abilityOutput]);
2622    (0, import_element2.useEffect)(() => {
2623      registerShortcut({
2624        name: "core/workflows",
2625        category: "global",
2626        description: (0, import_i18n.__)("Open the workflow palette."),
2627        keyCombination: {
2628          modifier: "primary",
2629          character: "j"
2630        }
2631      });
2632    }, [registerShortcut]);
2633    (0, import_keyboard_shortcuts.useShortcut)(
2634      "core/workflows",
2635      /** @type {React.KeyboardEventHandler} */
2636      withIgnoreIMEEvents((event) => {
2637        if (event.defaultPrevented) {
2638          return;
2639        }
2640        event.preventDefault();
2641        setIsOpen(!isOpen);
2642      }),
2643      {
2644        bindGlobal: true
2645      }
2646    );
2647    (0, import_element2.useEffect)(() => {
2648      if (isOpen) {
2649        import("@wordpress/core-abilities");
2650      }
2651    }, [isOpen]);
2652    const closeAndReset = () => {
2653      setSearch("");
2654      setIsOpen(false);
2655      setAbilityOutput(null);
2656      setIsExecuting(false);
2657    };
2658    const goBack = () => {
2659      setAbilityOutput(null);
2660      setIsExecuting(false);
2661      setSearch("");
2662    };
2663    const handleExecuteAbility = async (ability) => {
2664      setIsExecuting(true);
2665      try {
2666        const result = await executeAbility(ability.name);
2667        setAbilityOutput({
2668          name: ability.name,
2669          label: ability?.label || ability.name,
2670          description: ability?.description || "",
2671          success: true,
2672          data: result
2673        });
2674      } catch (error) {
2675        setAbilityOutput({
2676          name: ability.name,
2677          label: ability?.label || ability.name,
2678          description: ability?.description || "",
2679          success: false,
2680          error: error.message || String(error)
2681        });
2682      } finally {
2683        setIsExecuting(false);
2684      }
2685    };
2686    const onContainerKeyDown = (event) => {
2687      if (abilityOutput && (event.key === "Escape" || event.key === "Backspace" || event.key === "Delete")) {
2688        event.preventDefault();
2689        event.stopPropagation();
2690        goBack();
2691      }
2692    };
2693    if (!isOpen) {
2694      return null;
2695    }
2696    return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2697      import_components.Modal,
2698      {
2699        className: "workflows-workflow-menu",
2700        overlayClassName: "workflows-workflow-menu__overlay",
2701        onRequestClose: abilityOutput ? goBack : closeAndReset,
2702        __experimentalHideHeader: true,
2703        contentLabel: (0, import_i18n.__)("Workflow palette"),
2704        children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2705          "div",
2706          {
2707            className: "workflows-workflow-menu__container",
2708            onKeyDown: withIgnoreIMEEvents(onContainerKeyDown),
2709            ref: containerRef,
2710            tabIndex: -1,
2711            role: "presentation",
2712            children: abilityOutput ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "workflows-workflow-menu__output", children: [
2713              /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "workflows-workflow-menu__output-header", children: [
2714                /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: abilityOutput.label }),
2715                abilityOutput.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "workflows-workflow-menu__output-hint", children: abilityOutput.description })
2716              ] }),
2717              /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "workflows-workflow-menu__output-content", children: abilityOutput.success ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { children: JSON.stringify(
2718                abilityOutput.data,
2719                null,
2720                2
2721              ) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "workflows-workflow-menu__output-error", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: abilityOutput.error }) }) })
2722            ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(_e, { label: inputLabel, shouldFilter: false, children: [
2723              /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components.__experimentalHStack, { className: "workflows-workflow-menu__header", children: [
2724                /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2725                  icon_default,
2726                  {
2727                    className: "workflows-workflow-menu__header-search-icon",
2728                    icon: search_default
2729                  }
2730                ),
2731                /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2732                  WorkflowInput,
2733                  {
2734                    search,
2735                    setSearch,
2736                    isOpen,
2737                    abilities
2738                  }
2739                )
2740              ] }),
2741              /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(_e.List, { label: (0, import_i18n.__)("Workflow suggestions"), children: [
2742                isExecuting && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2743                  import_components.__experimentalHStack,
2744                  {
2745                    className: "workflows-workflow-menu__executing",
2746                    align: "center",
2747                    children: (0, import_i18n.__)("Executing ability…")
2748                  }
2749                ),
2750                !isExecuting && search && filteredAbilities.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(_e.Empty, { children: (0, import_i18n.__)("No results found.") }),
2751                !isExecuting && filteredAbilities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(_e.Group, { children: filteredAbilities.map((ability) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2752                  _e.Item,
2753                  {
2754                    value: ability.label,
2755                    className: "workflows-workflow-menu__item",
2756                    onSelect: () => handleExecuteAbility(ability),
2757                    id: ability.name,
2758                    children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components.__experimentalHStack, { alignment: "left", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2759                      import_components.TextHighlight,
2760                      {
2761                        text: ability.label,
2762                        highlight: search
2763                      }
2764                    ) }) })
2765                  },
2766                  ability.name
2767                )) })
2768              ] })
2769            ] })
2770          }
2771        )
2772      }
2773    );
2774  }
2775  
2776  // packages/workflow/build-module/index.mjs
2777  var root = document.createElement("div");
2778  document.body.appendChild(root);
2779  (0, import_element3.createRoot)(root).render((0, import_element3.createElement)(WorkflowMenu));


Generated : Sat Jul 25 08:20:20 2026 Cross-referenced by PHPXref