WordPress/wp-includes/js/dist/commands.min.js

7 lines
47 KiB
JavaScript

/*! This file is auto-generated */
(()=>{var e={4403:(e,t)=>{var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var c=o.apply(null,n);c&&e.push(c)}}else if("object"===a){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var u in n)r.call(n,u)&&n[u]&&e.push(u)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},8670:e=>{var t=1,n=.9,r=.3,o=.1,a=0,c=.999,u=.9999,i=.99,l=/[\\\/\-_+.# \t"@\[\(\{&]/,s=/[\\\/\-_+.# \t"@\[\(\{&]/g;function d(e,f,m,p,v,h){if(h===f.length)return v===e.length?t:i;for(var g,E,b,y=p.charAt(h),w=m.indexOf(y,v),C=0;w>=0;)(g=d(e,f,m,p,w+1,h+1))>C&&(w===v?g*=t:l.test(e.charAt(w-1))?(g*=n,(b=e.slice(v,w-1).match(s))&&v>0&&(g*=Math.pow(c,b.length))):l.test(e.slice(v,w-1))?(g*=a,v>0&&(g*=Math.pow(c,w-v))):(g*=r,v>0&&(g*=Math.pow(c,w-v))),e.charAt(w)!==f.charAt(h)&&(g*=u)),g<o&&m.charAt(w-1)===p.charAt(h+1)&&m.charAt(w-1)!==p.charAt(h)&&(E=d(e,f,m,p,w+1,h+2))*o>g&&(g=E*o),g>C&&(C=g),w=m.indexOf(y,w+1);return C}e.exports=function(e,t){return d(e,t,e.toLowerCase(),t.toLowerCase(),0,0)}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};(()=>{"use strict";n.r(r),n.d(r,{CommandMenu:()=>An,privateApis:()=>Dn,store:()=>Sn,useCommand:()=>Nn,useCommandLoader:()=>Mn});var e={};n.r(e),n.d(e,{close:()=>sn,open:()=>ln,registerCommand:()=>on,registerCommandLoader:()=>cn,unregisterCommand:()=>an,unregisterCommandLoader:()=>un});var t={};n.r(t),n.d(t,{getCommandLoaders:()=>hn,getCommands:()=>vn,getContext:()=>En,isOpen:()=>gn});var o={};n.r(o),n.d(o,{setContext:()=>bn});const a=window.React;function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function u(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function i(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function l(...e){return(0,a.useCallback)(i(...e),e)}function s(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return(0,a.useMemo)((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}const d=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?a.useLayoutEffect:()=>{},f=a["useId".toString()]||(()=>{});let m=0;function p(e){const[t,n]=a.useState(f());return d((()=>{e||n((e=>null!=e?e:String(m++)))}),[e]),e||(t?`radix-${t}`:"")}function v(e){const t=(0,a.useRef)(e);return(0,a.useEffect)((()=>{t.current=e})),(0,a.useMemo)((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}function h({prop:e,defaultProp:t,onChange:n=(()=>{})}){const[r,o]=function({defaultProp:e,onChange:t}){const n=(0,a.useState)(e),[r]=n,o=(0,a.useRef)(r),c=v(t);return(0,a.useEffect)((()=>{o.current!==r&&(c(r),o.current=r)}),[r,o,c]),n}({defaultProp:t,onChange:n}),c=void 0!==e,u=c?e:r,i=v(n);return[u,(0,a.useCallback)((t=>{if(c){const n="function"==typeof t?t(e):t;n!==e&&i(n)}else o(t)}),[c,e,o,i])]}const g=window.ReactDOM;var E=n.n(g);const b=(0,a.forwardRef)(((e,t)=>{const{children:n,...r}=e,o=a.Children.toArray(n),u=o.find(C);if(u){const e=u.props.children,n=o.map((t=>t===u?a.Children.count(e)>1?a.Children.only(null):(0,a.isValidElement)(e)?e.props.children:null:t));return(0,a.createElement)(y,c({},r,{ref:t}),(0,a.isValidElement)(e)?(0,a.cloneElement)(e,void 0,n):null)}return(0,a.createElement)(y,c({},r,{ref:t}),n)}));b.displayName="Slot";const y=(0,a.forwardRef)(((e,t)=>{const{children:n,...r}=e;return(0,a.isValidElement)(n)?(0,a.cloneElement)(n,{...S(r,n.props),ref:i(t,n.ref)}):a.Children.count(n)>1?a.Children.only(null):null}));y.displayName="SlotClone";const w=({children:e})=>(0,a.createElement)(a.Fragment,null,e);function C(e){return(0,a.isValidElement)(e)&&e.type===w}function S(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?n[r]=(...e)=>{null==a||a(...e),null==o||o(...e)}:"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}const x=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=(0,a.forwardRef)(((e,n)=>{const{asChild:r,...o}=e,u=r?b:t;return(0,a.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,a.createElement)(u,c({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});const O="dismissableLayer.update",k="dismissableLayer.pointerDownOutside",R="dismissableLayer.focusOutside";let L;const A=(0,a.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D=(0,a.forwardRef)(((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:d,...f}=e,m=(0,a.useContext)(A),[p,h]=(0,a.useState)(null),[,g]=(0,a.useState)({}),E=l(t,(e=>h(e))),b=Array.from(m.layers),[y]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(y),C=p?b.indexOf(p):-1,S=m.layersWithOutsidePointerEventsDisabled.size>0,D=C>=w,_=function(e){const t=v(e),n=(0,a.useRef)(!1),r=(0,a.useRef)((()=>{}));return(0,a.useEffect)((()=>{const e=e=>{if(e.target&&!n.current){const o={originalEvent:e};function a(){M(k,t,o,{discrete:!0})}"touch"===e.pointerType?(document.removeEventListener("click",r.current),r.current=a,document.addEventListener("click",r.current,{once:!0})):a()}n.current=!1},o=window.setTimeout((()=>{document.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(o),document.removeEventListener("pointerdown",e),document.removeEventListener("click",r.current)}}),[t]),{onPointerDownCapture:()=>n.current=!0}}((e=>{const t=e.target,n=[...m.branches].some((e=>e.contains(t)));D&&!n&&(null==o||o(e),null==s||s(e),e.defaultPrevented||null==d||d())})),P=function(e){const t=v(e),n=(0,a.useRef)(!1);return(0,a.useEffect)((()=>{const e=e=>{if(e.target&&!n.current){M(R,t,{originalEvent:e},{discrete:!1})}};return document.addEventListener("focusin",e),()=>document.removeEventListener("focusin",e)}),[t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}((e=>{const t=e.target;[...m.branches].some((e=>e.contains(t)))||(null==i||i(e),null==s||s(e),e.defaultPrevented||null==d||d())}));return function(e){const t=v(e);(0,a.useEffect)((()=>{const e=e=>{"Escape"===e.key&&t(e)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[t])}((e=>{C===m.layers.size-1&&(null==r||r(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))})),(0,a.useEffect)((()=>{if(p)return n&&(0===m.layersWithOutsidePointerEventsDisabled.size&&(L=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(p)),m.layers.add(p),N(),()=>{n&&1===m.layersWithOutsidePointerEventsDisabled.size&&(document.body.style.pointerEvents=L)}}),[p,n,m]),(0,a.useEffect)((()=>()=>{p&&(m.layers.delete(p),m.layersWithOutsidePointerEventsDisabled.delete(p),N())}),[p,m]),(0,a.useEffect)((()=>{const e=()=>g({});return document.addEventListener(O,e),()=>document.removeEventListener(O,e)}),[]),(0,a.createElement)(x.div,c({},f,{ref:E,style:{pointerEvents:S?D?"auto":"none":void 0,...e.style},onFocusCapture:u(e.onFocusCapture,P.onFocusCapture),onBlurCapture:u(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:u(e.onPointerDownCapture,_.onPointerDownCapture)}))}));function N(){const e=new CustomEvent(O);document.dispatchEvent(e)}function M(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&(0,g.flushSync)((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}const _="focusScope.autoFocusOnMount",P="focusScope.autoFocusOnUnmount",I={bubbles:!1,cancelable:!0},T=(0,a.forwardRef)(((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:u,...i}=e,[s,d]=(0,a.useState)(null),f=v(o),m=v(u),p=(0,a.useRef)(null),h=l(t,(e=>d(e))),g=(0,a.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,a.useEffect)((()=>{if(r){function e(e){if(g.paused||!s)return;const t=e.target;s.contains(t)?p.current=t:U(p.current,{select:!0})}function t(e){!g.paused&&s&&(s.contains(e.relatedTarget)||U(p.current,{select:!0}))}return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t)}}}),[r,s,g.paused]),(0,a.useEffect)((()=>{if(s){B.add(g);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent(_,I);s.addEventListener(_,f),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(U(r,{select:t}),document.activeElement!==n)return}((e=F(s),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&U(s))}return()=>{s.removeEventListener(_,f),setTimeout((()=>{const e=new CustomEvent(P,I);s.addEventListener(P,m),s.dispatchEvent(e),e.defaultPrevented||U(null!=t?t:document.body,{select:!0}),s.removeEventListener(P,m),B.remove(g)}),0)}}var e}),[s,f,m,g]);const E=(0,a.useCallback)((e=>{if(!n&&!r)return;if(g.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=F(e),n=j(t,e),r=j(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&U(a,{select:!0})):(e.preventDefault(),n&&U(r,{select:!0})):o===t&&e.preventDefault()}}),[n,r,g.paused]);return(0,a.createElement)(x.div,c({tabIndex:-1},i,{ref:h,onKeyDown:E}))}));function F(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function j(e,t){for(const n of e)if(!W(n,{upTo:t}))return n}function W(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function U(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const B=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=K(e,t),e.unshift(t)},remove(t){var n;e=K(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function K(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const $=(0,a.forwardRef)(((e,t)=>{var n;const{container:r=(null===globalThis||void 0===globalThis||null===(n=globalThis.document)||void 0===n?void 0:n.body),...o}=e;return r?E().createPortal((0,a.createElement)(x.div,c({},o,{ref:t})),r):null}));const q=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=(0,a.useState)(),r=(0,a.useRef)({}),o=(0,a.useRef)(e),c=(0,a.useRef)("none"),u=e?"mounted":"unmounted",[i,l]=function(e,t){return(0,a.useReducer)(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,a.useEffect)((()=>{const e=z(r.current);c.current="mounted"===i?e:"none"}),[i]),d((()=>{const t=r.current,n=o.current;if(n!==e){const r=c.current,a=z(t);if(e)l("MOUNT");else if("none"===a||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,l]),d((()=>{if(t){const e=e=>{const n=z(r.current).includes(e.animationName);e.target===t&&n&&(0,g.flushSync)((()=>l("ANIMATION_END")))},n=e=>{e.target===t&&(c.current=z(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}l("ANIMATION_END")}),[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:(0,a.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):a.Children.only(n),c=l(r.ref,o.ref);return"function"==typeof n||r.isPresent?(0,a.cloneElement)(o,{ref:c}):null};function z(e){return(null==e?void 0:e.animationName)||"none"}q.displayName="Presence";let G=0;function H(){(0,a.useEffect)((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:V()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:V()),G++,()=>{1===G&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),G--}}),[])}function V(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var X=function(){return X=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},X.apply(this,arguments)};function Y(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}Object.create;function Z(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var J="right-scroll-bar-position",Q="width-before-scroll-bar";function ee(e,t){return n=t||null,r=function(t){return e.forEach((function(e){return function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}(e,t)}))},(o=(0,a.useState)((function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}}))[0]).callback=r,o.facade;var n,r,o}function te(e){return e}function ne(e,t){void 0===t&&(t=te);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(e){t.push(e),c()},filter:function(e){return t=t.filter(e),n}}}};return o}var re=function(e){void 0===e&&(e={});var t=ne(null);return t.options=X({async:!0,ssr:!1},e),t}(),oe=function(){},ae=a.forwardRef((function(e,t){var n=a.useRef(null),r=a.useState({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:oe}),o=r[0],c=r[1],u=e.forwardProps,i=e.children,l=e.className,s=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noIsolation,v=e.inert,h=e.allowPinchZoom,g=e.as,E=void 0===g?"div":g,b=Y(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=m,w=ee([n,t]),C=X(X({},b),o);return a.createElement(a.Fragment,null,d&&a.createElement(y,{sideCar:re,removeScrollBar:s,shards:f,noIsolation:p,inert:v,setCallbacks:c,allowPinchZoom:!!h,lockRef:n}),u?a.cloneElement(a.Children.only(i),X(X({},C),{ref:w})):a.createElement(E,X({},C,{className:l,ref:w}),i))}));ae.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ae.classNames={fullWidth:Q,zeroRight:J};var ce,ue=function(e){var t=e.sideCar,n=Y(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return a.createElement(r,X({},n))};ue.isSideCarExport=!0;function ie(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ce||n.nc;return t&&e.setAttribute("nonce",t),e}var le=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=ie())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},se=function(){var e,t=(e=le(),function(t,n){a.useEffect((function(){return e.add(t),function(){e.remove()}}),[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},de={left:0,top:0,right:0,gap:0},fe=function(e){return parseInt(e||"",10)||0},me=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return de;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[fe(n),fe(r),fe(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},pe=se(),ve=function(e,t,n,r){var o=e.left,a=e.top,c=e.right,u=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(u,"px ").concat(r,";\n }\n body {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(c,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(u,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(J," {\n right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(Q," {\n margin-right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(J," .").concat(J," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Q," .").concat(Q," {\n margin-right: 0 ").concat(r,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",": ").concat(u,"px;\n }\n")},he=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r,c=a.useMemo((function(){return me(o)}),[o]);return a.createElement(pe,{styles:ve(c,!t,o,n?"":"!important")})},ge=!1;if("undefined"!=typeof window)try{var Ee=Object.defineProperty({},"passive",{get:function(){return ge=!0,!0}});window.addEventListener("test",Ee,Ee),window.removeEventListener("test",Ee,Ee)}catch(e){ge=!1}var be=!!ge&&{passive:!1},ye=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),we(e,n)){var r=Ce(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},we=function(e,t){return"v"===e?function(e){var t=window.getComputedStyle(e);return"hidden"!==t.overflowY&&!(t.overflowY===t.overflowX&&"visible"===t.overflowY)}(t):function(e){var t=window.getComputedStyle(e);return"hidden"!==t.overflowX&&!(t.overflowY===t.overflowX&&"visible"===t.overflowX)}(t)},Ce=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Se=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},xe=function(e){return[e.deltaX,e.deltaY]},Oe=function(e){return e&&"current"in e?e.current:e},ke=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Re=0,Le=[];const Ae=(De=function(e){var t=a.useRef([]),n=a.useRef([0,0]),r=a.useRef(),o=a.useState(Re++)[0],c=a.useState((function(){return se()}))[0],u=a.useRef(e);a.useEffect((function(){u.current=e}),[e]),a.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=Z([e.lockRef.current],(e.shards||[]).map(Oe),!0).filter(Boolean);return t.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[e.inert,e.lockRef.current,e.shards]);var i=a.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!u.current.allowPinchZoom;var o,a=Se(e),c=n.current,i="deltaX"in e?e.deltaX:c[0]-a[0],l="deltaY"in e?e.deltaY:c[1]-a[1],s=e.target,d=Math.abs(i)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===d&&"range"===s.type)return!1;var f=ye(d,s);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=ye(d,s)),!f)return!1;if(!r.current&&"changedTouches"in e&&(i||l)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r,o){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),c=a*r,u=n.target,i=t.contains(u),l=!1,s=c>0,d=0,f=0;do{var m=Ce(e,u),p=m[0],v=m[1]-m[2]-a*p;(p||v)&&we(e,u)&&(d+=v,f+=p),u=u.parentNode}while(!i&&u!==document.body||i&&(t.contains(u)||t===u));return(s&&(o&&0===d||!o&&c>d)||!s&&(o&&0===f||!o&&-c>f))&&(l=!0),l}(m,t,e,"h"===m?i:l,!0)}),[]),l=a.useCallback((function(e){var n=e;if(Le.length&&Le[Le.length-1]===c){var r="deltaY"in n?xe(n):Se(n),o=t.current.filter((function(e){return e.name===n.type&&e.target===n.target&&function(e,t){return e[0]===t[0]&&e[1]===t[1]}(e.delta,r)}))[0];if(o&&o.should)n.preventDefault();else if(!o){var a=(u.current.shards||[]).map(Oe).filter(Boolean).filter((function(e){return e.contains(n.target)}));(a.length>0?i(n,a[0]):!u.current.noIsolation)&&n.preventDefault()}}}),[]),s=a.useCallback((function(e,n,r,o){var a={name:e,delta:n,target:r,should:o};t.current.push(a),setTimeout((function(){t.current=t.current.filter((function(e){return e!==a}))}),1)}),[]),d=a.useCallback((function(e){n.current=Se(e),r.current=void 0}),[]),f=a.useCallback((function(t){s(t.type,xe(t),t.target,i(t,e.lockRef.current))}),[]),m=a.useCallback((function(t){s(t.type,Se(t),t.target,i(t,e.lockRef.current))}),[]);a.useEffect((function(){return Le.push(c),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,be),document.addEventListener("touchmove",l,be),document.addEventListener("touchstart",d,be),function(){Le=Le.filter((function(e){return e!==c})),document.removeEventListener("wheel",l,be),document.removeEventListener("touchmove",l,be),document.removeEventListener("touchstart",d,be)}}),[]);var p=e.removeScrollBar,v=e.inert;return a.createElement(a.Fragment,null,v?a.createElement(c,{styles:ke(o)}):null,p?a.createElement(he,{gapMode:"margin"}):null)},re.useMedium(De),ue);var De,Ne=a.forwardRef((function(e,t){return a.createElement(ae,X({},e,{ref:t,sideCar:Ae}))}));Ne.classNames=ae.classNames;const Me=Ne;var _e=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pe=new WeakMap,Ie=new WeakMap,Te={},Fe=0,je=function(e){return e&&(e.host||je(e.parentNode))},We=function(e,t,n,r){var o=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=je(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(t,Array.isArray(e)?e:[e]);Te[n]||(Te[n]=new WeakMap);var a=Te[n],c=[],u=new Set,i=new Set(o),l=function(e){e&&!u.has(e)&&(u.add(e),l(e.parentNode))};o.forEach(l);var s=function(e){e&&!i.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(u.has(e))s(e);else{var t=e.getAttribute(r),o=null!==t&&"false"!==t,i=(Pe.get(e)||0)+1,l=(a.get(e)||0)+1;Pe.set(e,i),a.set(e,l),c.push(e),1===i&&o&&Ie.set(e,!0),1===l&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}}))};return s(t),u.clear(),Fe++,function(){c.forEach((function(e){var t=Pe.get(e)-1,o=a.get(e)-1;Pe.set(e,t),a.set(e,o),t||(Ie.has(e)||e.removeAttribute(r),Ie.delete(e)),o||e.removeAttribute(n)})),--Fe||(Pe=new WeakMap,Pe=new WeakMap,Ie=new WeakMap,Te={})}},Ue=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||_e(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),We(r,o,n,"aria-hidden")):function(){return null}};const Be="Dialog",[Ke,$e]=function(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>(0,a.createContext)(e)));return function(n){const r=(null==n?void 0:n[e])||t;return(0,a.useMemo)((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=(0,a.createContext)(r),c=n.length;function u(t){const{scope:n,children:r,...u}=t,i=(null==n?void 0:n[e][c])||o,l=(0,a.useMemo)((()=>u),Object.values(u));return(0,a.createElement)(i.Provider,{value:l},r)}return n=[...n,r],u.displayName=t+"Provider",[u,function(n,u){const i=(null==u?void 0:u[e][c])||o,l=(0,a.useContext)(i);if(l)return l;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},s(r,...t)]}(Be),[qe,ze]=Ke(Be),Ge=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:c,modal:u=!0}=e,i=(0,a.useRef)(null),l=(0,a.useRef)(null),[s=!1,d]=h({prop:r,defaultProp:o,onChange:c});return(0,a.createElement)(qe,{scope:t,triggerRef:i,contentRef:l,contentId:p(),titleId:p(),descriptionId:p(),open:s,onOpenChange:d,onOpenToggle:(0,a.useCallback)((()=>d((e=>!e))),[d]),modal:u},n)},He="DialogPortal",[Ve,Xe]=Ke(He,{forceMount:void 0}),Ye=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,c=ze(He,t);return(0,a.createElement)(Ve,{scope:t,forceMount:n},a.Children.map(r,(e=>(0,a.createElement)(q,{present:n||c.open},(0,a.createElement)($,{asChild:!0,container:o},e)))))},Ze="DialogOverlay",Je=(0,a.forwardRef)(((e,t)=>{const n=Xe(Ze,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,u=ze(Ze,e.__scopeDialog);return u.modal?(0,a.createElement)(q,{present:r||u.open},(0,a.createElement)(Qe,c({},o,{ref:t}))):null})),Qe=(0,a.forwardRef)(((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Ze,n);return(0,a.createElement)(Me,{as:b,allowPinchZoom:!0,shards:[o.contentRef]},(0,a.createElement)(x.div,c({"data-state":ct(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))})),et="DialogContent",tt=(0,a.forwardRef)(((e,t)=>{const n=Xe(et,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,u=ze(et,e.__scopeDialog);return(0,a.createElement)(q,{present:r||u.open},u.modal?(0,a.createElement)(nt,c({},o,{ref:t})):(0,a.createElement)(rt,c({},o,{ref:t})))})),nt=(0,a.forwardRef)(((e,t)=>{const n=ze(et,e.__scopeDialog),r=(0,a.useRef)(null),o=l(t,n.contentRef,r);return(0,a.useEffect)((()=>{const e=r.current;if(e)return Ue(e)}),[]),(0,a.createElement)(ot,c({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:u(e.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=n.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:u(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:u(e.onFocusOutside,(e=>e.preventDefault()))}))})),rt=(0,a.forwardRef)(((e,t)=>{const n=ze(et,e.__scopeDialog),r=(0,a.useRef)(!1);return(0,a.createElement)(ot,c({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var o,a;(null===(o=e.onCloseAutoFocus)||void 0===o||o.call(e,t),t.defaultPrevented)||(r.current||null===(a=n.triggerRef.current)||void 0===a||a.focus(),t.preventDefault());r.current=!1},onInteractOutside:t=>{var o,a;null===(o=e.onInteractOutside)||void 0===o||o.call(e,t),t.defaultPrevented||(r.current=!0);const c=t.target;(null===(a=n.triggerRef.current)||void 0===a?void 0:a.contains(c))&&t.preventDefault()}}))})),ot=(0,a.forwardRef)(((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:u,...i}=e,s=ze(et,n),d=l(t,(0,a.useRef)(null));return H(),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(T,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:u},(0,a.createElement)(D,c({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ct(s.open)},i,{ref:d,onDismiss:()=>s.onOpenChange(!1)}))),!1)})),at="DialogTitle";function ct(e){return e?"open":"closed"}const ut="DialogTitleWarning",[it,lt]=function(e,t){const n=(0,a.createContext)(t);function r(e){const{children:t,...r}=e,o=(0,a.useMemo)((()=>r),Object.values(r));return(0,a.createElement)(n.Provider,{value:o},t)}return r.displayName=e+"Provider",[r,function(r){const o=(0,a.useContext)(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(ut,{contentName:et,titleName:at,docsSlug:"dialog"}),st=Ge,dt=Ye,ft=Je,mt=tt;var pt=n(8670),vt='[cmdk-group=""]',ht='[cmdk-group-items=""]',gt='[cmdk-item=""]',Et=`${gt}:not([aria-disabled="true"])`,bt="cmdk-item-select",yt="data-value",wt=(e,t)=>pt(e,t),Ct=a.createContext(void 0),St=()=>a.useContext(Ct),xt=a.createContext(void 0),Ot=()=>a.useContext(xt),kt=a.createContext(void 0),Rt=a.forwardRef(((e,t)=>{let n=a.useRef(null),r=Bt((()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}}))),o=Bt((()=>new Set)),c=Bt((()=>new Map)),u=Bt((()=>new Map)),i=Bt((()=>new Set)),l=Wt(e),{label:s,children:d,value:f,onValueChange:m,filter:p,shouldFilter:v,...h}=e,g=a.useId(),E=a.useId(),b=a.useId(),y=zt();Ut((()=>{if(void 0!==f){let e=f.trim().toLowerCase();r.current.value=e,y(6,R),w.emit()}}),[f]);let w=a.useMemo((()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var o,a,c;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)k(),x(),y(1,O);else if("value"===e){if(void 0!==(null==(o=l.current)?void 0:o.value))return void(null==(c=(a=l.current).onValueChange)||c.call(a,t));n||y(5,R)}w.emit()}},emit:()=>{i.current.forEach((e=>e()))}})),[]),C=a.useMemo((()=>({value:(e,t)=>{t!==u.current.get(e)&&(u.current.set(e,t),r.current.filtered.items.set(e,S(t)),y(2,(()=>{x(),w.emit()})))},item:(e,t)=>(o.current.add(e),t&&(c.current.has(t)?c.current.get(t).add(e):c.current.set(t,new Set([e]))),y(3,(()=>{k(),x(),r.current.value||O(),w.emit()})),()=>{u.current.delete(e),o.current.delete(e),r.current.filtered.items.delete(e),y(4,(()=>{k(),O(),w.emit()}))}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{u.current.delete(e),c.current.delete(e)}),filter:()=>l.current.shouldFilter,label:s||e["aria-label"],listId:g,inputId:b,labelId:E})),[]);function S(e){var t;let n=(null==(t=l.current)?void 0:t.filter)??wt;return e?n(e,r.current.search):0}function x(){if(!n.current||!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach((n=>{let r=c.current.get(n),o=0;r.forEach((t=>{let n=e.get(t);o=Math.max(n,o)})),t.push([n,o])}));let o=n.current.querySelector('[cmdk-list-sizer=""]');A().sort(((t,n)=>{let r=t.getAttribute(yt),o=n.getAttribute(yt);return(e.get(o)??0)-(e.get(r)??0)})).forEach((e=>{let t=e.closest(ht);t?t.appendChild(e.parentElement===t?e:e.closest(`${ht} > *`)):o.appendChild(e.parentElement===o?e:e.closest(`${ht} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{let t=n.current.querySelector(`${vt}[${yt}="${e[0]}"]`);null==t||t.parentElement.appendChild(t)}))}function O(){let e=A().find((e=>!e.ariaDisabled)),t=null==e?void 0:e.getAttribute(yt);w.setState("value",t||void 0)}function k(){if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=o.current.size);r.current.filtered.groups=new Set;let e=0;for(let t of o.current){let n=S(u.current.get(t));r.current.filtered.items.set(t,n),n>0&&e++}for(let[e,t]of c.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=e}function R(){var e,t,n;let r=L();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(vt))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function L(){return n.current.querySelector(`${gt}[aria-selected="true"]`)}function A(){return Array.from(n.current.querySelectorAll(Et))}function D(e){let t=A()[e];t&&w.setState("value",t.getAttribute(yt))}function N(e){var t;let n=L(),r=A(),o=r.findIndex((e=>e===n)),a=r[o+e];null!=(t=l.current)&&t.loop&&(a=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),a&&w.setState("value",a.getAttribute(yt))}function M(e){let t,n=L(),r=null==n?void 0:n.closest(vt);for(;r&&!t;)r=e>0?Ft(r,vt):jt(r,vt),t=null==r?void 0:r.querySelector(Et);t?w.setState("value",t.getAttribute(yt)):N(e)}let _=()=>D(A().length-1),P=e=>{e.preventDefault(),e.metaKey?_():e.altKey?M(1):N(1)},I=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?M(-1):N(-1)};return a.createElement("div",{ref:Kt([n,t]),...h,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=h.onKeyDown)||t.call(h,e),!e.defaultPrevented)switch(e.key){case"n":case"j":e.ctrlKey&&P(e);break;case"ArrowDown":P(e);break;case"p":case"k":e.ctrlKey&&I(e);break;case"ArrowUp":I(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),_();break;case"Enter":{e.preventDefault();let t=L();if(t){let e=new Event(bt);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:Gt},s),a.createElement(xt.Provider,{value:w},a.createElement(Ct.Provider,{value:C},d)))})),Lt=a.forwardRef(((e,t)=>{let n=a.useId(),r=a.useRef(null),o=a.useContext(kt),c=St(),u=Wt(e);Ut((()=>c.item(n,o)),[]);let i=qt(n,r,[e.value,e.children,r]),l=Ot(),s=$t((e=>e.value&&e.value===i.current)),d=$t((e=>!1===c.filter()||(!e.search||e.filtered.items.get(n)>0)));function f(){var e,t;null==(t=(e=u.current).onSelect)||t.call(e,i.current)}if(a.useEffect((()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(bt,f),()=>t.removeEventListener(bt,f)}),[d,e.onSelect,e.disabled]),!d)return null;let{disabled:m,value:p,onSelect:v,...h}=e;return a.createElement("div",{ref:Kt([r,t]),...h,"cmdk-item":"",role:"option","aria-disabled":m||void 0,"aria-selected":s||void 0,"data-selected":s||void 0,onPointerMove:m?void 0:function(){l.setState("value",i.current,!0)},onClick:m?void 0:f},e.children)})),At=a.forwardRef(((e,t)=>{let{heading:n,children:r,...o}=e,c=a.useId(),u=a.useRef(null),i=a.useRef(null),l=a.useId(),s=St(),d=$t((e=>!1===s.filter()||(!e.search||e.filtered.groups.has(c))));Ut((()=>s.group(c)),[]),qt(c,u,[e.value,e.heading,i]);let f=a.createElement(kt.Provider,{value:c},r);return a.createElement("div",{ref:Kt([u,t]),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&a.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},f))})),Dt=a.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=a.useRef(null),c=$t((e=>!e.search));return n||c?a.createElement("div",{ref:Kt([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),Nt=a.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,c=Ot(),u=$t((e=>e.search)),i=St();return a.useEffect((()=>{null!=e.value&&c.setState("search",e.value)}),[e.value]),a.createElement("input",{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,id:i.inputId,type:"text",value:o?e.value:u,onChange:e=>{o||c.setState("search",e.target.value),null==n||n(e.target.value)}})})),Mt=a.forwardRef(((e,t)=>{let{children:n,...r}=e,o=a.useRef(null),c=a.useRef(null),u=St();return a.useEffect((()=>{if(c.current&&o.current){let e,t=c.current,n=o.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{let e=t.getBoundingClientRect().height;n.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),a.createElement("div",{ref:Kt([o,t]),...r,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:u.listId,"aria-labelledby":u.inputId},a.createElement("div",{ref:c,"cmdk-list-sizer":""},n))})),_t=a.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,container:o,...c}=e;return a.createElement(st,{open:n,onOpenChange:r},a.createElement(dt,{container:o},a.createElement(ft,{"cmdk-overlay":""}),a.createElement(mt,{"aria-label":e.label,"cmdk-dialog":""},a.createElement(Rt,{ref:t,...c}))))})),Pt=a.forwardRef(((e,t)=>{let n=a.useRef(!0),r=$t((e=>0===e.filtered.count));return a.useEffect((()=>{n.current=!1}),[]),n.current||!r?null:a.createElement("div",{ref:t,...e,"cmdk-empty":"",role:"presentation"})})),It=a.forwardRef(((e,t)=>{let{progress:n,children:r,...o}=e;return a.createElement("div",{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},a.createElement("div",{"aria-hidden":!0},r))})),Tt=Object.assign(Rt,{List:Mt,Item:Lt,Input:Nt,Group:At,Separator:Dt,Dialog:_t,Empty:Pt,Loading:It});function Ft(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function jt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Wt(e){let t=a.useRef(e);return Ut((()=>{t.current=e})),t}var Ut=typeof window>"u"?a.useEffect:a.useLayoutEffect;function Bt(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Kt(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function $t(e){let t=Ot(),n=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,n,n)}function qt(e,t,n){let r=a.useRef(),o=St();return Ut((()=>{var a;let c=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim().toLowerCase();if("object"==typeof t&&"current"in t&&t.current)return null==(e=t.current.textContent)?void 0:e.trim().toLowerCase()}})();o.value(e,c),null==(a=t.current)||a.setAttribute(yt,c),r.current=c})),r}var zt=()=>{let[e,t]=a.useState(),n=Bt((()=>new Map));return Ut((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}},Gt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},Ht=n(4403),Vt=n.n(Ht);const Xt=window.wp.data,Yt=window.wp.element,Zt=window.wp.i18n,Jt=window.wp.components,Qt=window.wp.keyboardShortcuts;const en=(0,Yt.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,Yt.cloneElement)(e,{width:t,height:t,...n,ref:r})})),tn=window.wp.primitives,nn=(0,a.createElement)(tn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(tn.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"}));const rn=(0,Xt.combineReducers)({commands:function(e={},t){switch(t.type){case"REGISTER_COMMAND":return{...e,[t.name]:{name:t.name,label:t.label,searchLabel:t.searchLabel,context:t.context,callback:t.callback,icon:t.icon}};case"UNREGISTER_COMMAND":{const{[t.name]:n,...r}=e;return r}}return e},commandLoaders:function(e={},t){switch(t.type){case"REGISTER_COMMAND_LOADER":return{...e,[t.name]:{name:t.name,context:t.context,hook:t.hook}};case"UNREGISTER_COMMAND_LOADER":{const{[t.name]:n,...r}=e;return r}}return e},isOpen:function(e=!1,t){switch(t.type){case"OPEN":return!0;case"CLOSE":return!1}return e},context:function(e="root",t){return"SET_CONTEXT"===t.type?t.context:e}});function on(e){return{type:"REGISTER_COMMAND",...e}}function an(e){return{type:"UNREGISTER_COMMAND",name:e}}function cn(e){return{type:"REGISTER_COMMAND_LOADER",...e}}function un(e){return{type:"UNREGISTER_COMMAND_LOADER",name:e}}function ln(){return{type:"OPEN"}}function sn(){return{type:"CLOSE"}}var dn={};function fn(e){return[e]}function mn(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function pn(e,t){var n,r=t||fn;function o(){n=new WeakMap}function a(){var t,o,a,c,u,i=arguments.length;for(c=new Array(i),a=0;a<i;a++)c[a]=arguments[a];for(t=function(e){var t,r,o,a,c,u=n,i=!0;for(t=0;t<e.length;t++){if(!(c=r=e[t])||"object"!=typeof c){i=!1;break}u.has(r)?u=u.get(r):(o=new WeakMap,u.set(r,o),u=o)}return u.has(dn)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=i,u.set(dn,a)),u.get(dn)}(u=r.apply(null,c)),t.isUniqueByDependants||(t.lastDependants&&!mn(u,t.lastDependants,0)&&t.clear(),t.lastDependants=u),o=t.head;o;){if(mn(o.args,c,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,c)},c[0]=null,o.args=c,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}const vn=pn(((e,t=!1)=>Object.values(e.commands).filter((n=>{const r=n.context&&n.context===e.context;return t?r:!r}))),(e=>[e.commands,e.context])),hn=pn(((e,t=!1)=>Object.values(e.commandLoaders).filter((n=>{const r=n.context&&n.context===e.context;return t?r:!r}))),(e=>[e.commandLoaders,e.context]));function gn(e){return e.isOpen}function En(e){return e.context}function bn(e){return{type:"SET_CONTEXT",context:e}}const yn=window.wp.privateApis,{lock:wn,unlock:Cn}=(0,yn.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/commands"),Sn=(0,Xt.createReduxStore)("core/commands",{reducer:rn,actions:e,selectors:t});(0,Xt.register)(Sn),Cn(Sn).registerPrivateActions(o);const xn=(0,Zt.__)("Search for commands");function On({name:e,search:t,hook:n,setLoader:r,close:o}){var c;const{isLoading:u,commands:i=[]}=null!==(c=n({search:t}))&&void 0!==c?c:{};return(0,Yt.useEffect)((()=>{r(e,u)}),[r,e,u]),i.length?(0,a.createElement)(a.Fragment,null,i.map((e=>{var n;return(0,a.createElement)(Tt.Item,{key:e.name,value:null!==(n=e.searchLabel)&&void 0!==n?n:e.label,onSelect:()=>e.callback({close:o}),id:e.name},(0,a.createElement)(Jt.__experimentalHStack,{alignment:"left",className:Vt()("commands-command-menu__item",{"has-icon":e.icon})},e.icon&&(0,a.createElement)(en,{icon:e.icon}),(0,a.createElement)("span",null,(0,a.createElement)(Jt.TextHighlight,{text:e.label,highlight:t}))))}))):null}function kn({hook:e,search:t,setLoader:n,close:r}){const o=(0,Yt.useRef)(e),[c,u]=(0,Yt.useState)(0);return(0,Yt.useEffect)((()=>{o.current!==e&&(o.current=e,u((e=>e+1)))}),[e]),(0,a.createElement)(On,{key:c,hook:o.current,search:t,setLoader:n,close:r})}function Rn({isContextual:e,search:t,setLoader:n,close:r}){const{commands:o,loaders:c}=(0,Xt.useSelect)((t=>{const{getCommands:n,getCommandLoaders:r}=t(Sn);return{commands:n(e),loaders:r(e)}}),[e]);return o.length||c.length?(0,a.createElement)(Tt.Group,null,o.map((e=>{var n;return(0,a.createElement)(Tt.Item,{key:e.name,value:null!==(n=e.searchLabel)&&void 0!==n?n:e.label,onSelect:()=>e.callback({close:r}),id:e.name},(0,a.createElement)(Jt.__experimentalHStack,{alignment:"left",className:Vt()("commands-command-menu__item",{"has-icon":e.icon})},e.icon&&(0,a.createElement)(en,{icon:e.icon}),(0,a.createElement)("span",null,(0,a.createElement)(Jt.TextHighlight,{text:e.label,highlight:t}))))})),c.map((e=>(0,a.createElement)(kn,{key:e.name,hook:e.hook,search:t,setLoader:n,close:r})))):null}function Ln({isOpen:e,search:t,setSearch:n}){const r=(0,Yt.useRef)(),o=$t((e=>e.value)),c=(0,Yt.useMemo)((()=>{const e=document.querySelector(`[cmdk-item=""][data-value="${o}"]`);return e?.getAttribute("id")}),[o]);return(0,Yt.useEffect)((()=>{e&&r.current.focus()}),[e]),(0,a.createElement)(Tt.Input,{ref:r,value:t,onValueChange:n,placeholder:xn,"aria-activedescendant":c,icon:t})}function An(){const{registerShortcut:e}=(0,Xt.useDispatch)(Qt.store),[t,n]=(0,Yt.useState)(""),r=(0,Xt.useSelect)((e=>e(Sn).isOpen()),[]),{open:o,close:c}=(0,Xt.useDispatch)(Sn),[u,i]=(0,Yt.useState)({}),l=(0,Yt.useRef)();(0,Yt.useEffect)((()=>{e({name:"core/commands",category:"global",description:(0,Zt.__)("Open the command palette."),keyCombination:{modifier:"primary",character:"k"}})}),[e]),(0,Yt.useEffect)((()=>{l.current?.removeAttribute("aria-labelledby"),l.current?.setAttribute("aria-label",(0,Zt.__)("Command suggestions"))}),[l.current]),(0,Qt.useShortcut)("core/commands",(e=>{e.defaultPrevented||(e.preventDefault(),r?c():o())}),{bindGlobal:!0});const s=(0,Yt.useCallback)(((e,t)=>i((n=>({...n,[e]:t})))),[]),d=()=>{n(""),c()};if(!r)return!1;const f=Object.values(u).some(Boolean);return(0,a.createElement)(Jt.Modal,{className:"commands-command-menu",overlayClassName:"commands-command-menu__overlay",onRequestClose:d,__experimentalHideHeader:!0,contentLabel:(0,Zt.__)("Command palette")},(0,a.createElement)("div",{className:"commands-command-menu__container"},(0,a.createElement)(Tt,{label:xn,onKeyDown:e=>{(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()}},(0,a.createElement)("div",{className:"commands-command-menu__header"},(0,a.createElement)(en,{icon:nn}),(0,a.createElement)(Ln,{search:t,setSearch:n,isOpen:r})),(0,a.createElement)(Tt.List,{ref:l},t&&!f&&(0,a.createElement)(Tt.Empty,null,(0,Zt.__)("No results found.")),(0,a.createElement)(Rn,{search:t,setLoader:s,close:d,isContextual:!0}),t&&(0,a.createElement)(Rn,{search:t,setLoader:s,close:d})))))}const Dn={};function Nn(e){const{registerCommand:t,unregisterCommand:n}=(0,Xt.useDispatch)(Sn),r=(0,Yt.useRef)(e.callback);(0,Yt.useEffect)((()=>{r.current=e.callback}),[e.callback]),(0,Yt.useEffect)((()=>{if(!e.disabled)return t({name:e.name,context:e.context,label:e.label,searchLabel:e.searchLabel,icon:e.icon,callback:(...e)=>r.current(...e)}),()=>{n(e.name)}}),[e.name,e.label,e.searchLabel,e.icon,e.context,e.disabled,t,n])}function Mn(e){const{registerCommandLoader:t,unregisterCommandLoader:n}=(0,Xt.useDispatch)(Sn);(0,Yt.useEffect)((()=>{if(!e.disabled)return t({name:e.name,hook:e.hook,context:e.context}),()=>{n(e.name)}}),[e.name,e.hook,e.context,e.disabled,t,n])}wn(Dn,{useCommandContext:function(e){const{getContext:t}=(0,Xt.useSelect)(Sn),n=(0,Yt.useRef)(t()),{setContext:r}=Cn((0,Xt.useDispatch)(Sn));(0,Yt.useEffect)((()=>{r(e)}),[e,r]),(0,Yt.useEffect)((()=>{const e=n.current;return()=>r(e)}),[r])}})})(),(window.wp=window.wp||{}).commands=r})();