WordPress/wp-includes/js/dist/commands.min.js
Tammie Lister 04f631f232 Update editor related npm packages
The npm packages needed updating for 6.4 to the latest.

Props mikachan, mukesdpanchal27, luisherranz, youknowriad, tellthemachines, gziolo, ockham, michalczaplinski

Fixes #59411


Built from https://develop.svn.wordpress.org/trunk@56710


git-svn-id: http://core.svn.wordpress.org/trunk@56222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 14:23:26 +00:00

7 lines
47 KiB
JavaScript

/*! This file is auto-generated */
!function(){var e={4403:function(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:function(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,y,b=p.charAt(h),w=m.indexOf(b,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,(y=e.slice(v,w-1).match(s))&&v>0&&(g*=Math.pow(c,y.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(b,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=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(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={};!function(){"use strict";n.r(r),n.d(r,{CommandMenu:function(){return Ln},privateApis:function(){return An},store:function(){return Sn},useCommand:function(){return Dn},useCommandLoader:function(){return Nn}});var e={};n.r(e),n.d(e,{close:function(){return sn},open:function(){return ln},registerCommand:function(){return on},registerCommandLoader:function(){return cn},unregisterCommand:function(){return an},unregisterCommandLoader:function(){return un}});var t={};n.r(t),n.d(t,{getCommandLoaders:function(){return hn},getCommands:function(){return vn},getContext:function(){return En},isOpen:function(){return gn}});var o={};n.r(o),n.d(o,{setContext:function(){return yn}});var a=window.wp.element;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)}var u=window.React;function i(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 l(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function s(...e){return(0,u.useCallback)(l(...e),e)}function d(...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,u.useMemo)((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}const f=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?u.useLayoutEffect:()=>{},m=u["useId".toString()]||(()=>{});let p=0;function v(e){const[t,n]=u.useState(m());return f((()=>{e||n((e=>null!=e?e:String(p++)))}),[e]),e||(t?`radix-${t}`:"")}function h(e){const t=(0,u.useRef)(e);return(0,u.useEffect)((()=>{t.current=e})),(0,u.useMemo)((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}function g({prop:e,defaultProp:t,onChange:n=(()=>{})}){const[r,o]=function({defaultProp:e,onChange:t}){const n=(0,u.useState)(e),[r]=n,o=(0,u.useRef)(r),a=h(t);return(0,u.useEffect)((()=>{o.current!==r&&(a(r),o.current=r)}),[r,o,a]),n}({defaultProp:t,onChange:n}),a=void 0!==e,c=a?e:r,i=h(n);return[c,(0,u.useCallback)((t=>{if(a){const n="function"==typeof t?t(e):t;n!==e&&i(n)}else o(t)}),[a,e,o,i])]}var E=window.ReactDOM,y=n.n(E);const b=(0,u.forwardRef)(((e,t)=>{const{children:n,...r}=e,o=u.Children.toArray(n),a=o.find(S);if(a){const e=a.props.children,n=o.map((t=>t===a?u.Children.count(e)>1?u.Children.only(null):(0,u.isValidElement)(e)?e.props.children:null:t));return(0,u.createElement)(w,c({},r,{ref:t}),(0,u.isValidElement)(e)?(0,u.cloneElement)(e,void 0,n):null)}return(0,u.createElement)(w,c({},r,{ref:t}),n)}));b.displayName="Slot";const w=(0,u.forwardRef)(((e,t)=>{const{children:n,...r}=e;return(0,u.isValidElement)(n)?(0,u.cloneElement)(n,{...x(r,n.props),ref:l(t,n.ref)}):u.Children.count(n)>1?u.Children.only(null):null}));w.displayName="SlotClone";const C=({children:e})=>(0,u.createElement)(u.Fragment,null,e);function S(e){return(0,u.isValidElement)(e)&&e.type===C}function x(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 O=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=(0,u.forwardRef)(((e,n)=>{const{asChild:r,...o}=e,a=r?b:t;return(0,u.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,u.createElement)(a,c({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});const k="dismissableLayer.update",R="dismissableLayer.pointerDownOutside",L="dismissableLayer.focusOutside";let A;const D=(0,u.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),N=(0,u.forwardRef)(((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:d,...f}=e,m=(0,u.useContext)(D),[p,v]=(0,u.useState)(null),[,g]=(0,u.useState)({}),E=s(t,(e=>v(e))),y=Array.from(m.layers),[b]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),w=y.indexOf(b),C=p?y.indexOf(p):-1,S=m.layersWithOutsidePointerEventsDisabled.size>0,x=C>=w,N=function(e){const t=h(e),n=(0,u.useRef)(!1),r=(0,u.useRef)((()=>{}));return(0,u.useEffect)((()=>{const e=e=>{if(e.target&&!n.current){const o={originalEvent:e};function a(){_(R,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)));x&&!n&&(null==o||o(e),null==l||l(e),e.defaultPrevented||null==d||d())})),P=function(e){const t=h(e),n=(0,u.useRef)(!1);return(0,u.useEffect)((()=>{const e=e=>{if(e.target&&!n.current){_(L,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==a||a(e),null==l||l(e),e.defaultPrevented||null==d||d())}));return function(e){const t=h(e);(0,u.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,u.useEffect)((()=>{if(p)return n&&(0===m.layersWithOutsidePointerEventsDisabled.size&&(A=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(p)),m.layers.add(p),M(),()=>{n&&1===m.layersWithOutsidePointerEventsDisabled.size&&(document.body.style.pointerEvents=A)}}),[p,n,m]),(0,u.useEffect)((()=>()=>{p&&(m.layers.delete(p),m.layersWithOutsidePointerEventsDisabled.delete(p),M())}),[p,m]),(0,u.useEffect)((()=>{const e=()=>g({});return document.addEventListener(k,e),()=>document.removeEventListener(k,e)}),[]),(0,u.createElement)(O.div,c({},f,{ref:E,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:i(e.onFocusCapture,P.onFocusCapture),onBlurCapture:i(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:i(e.onPointerDownCapture,N.onPointerDownCapture)}))}));function M(){const e=new CustomEvent(k);document.dispatchEvent(e)}function _(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,E.flushSync)((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}const P="focusScope.autoFocusOnMount",I="focusScope.autoFocusOnUnmount",T={bubbles:!1,cancelable:!0},F=(0,u.forwardRef)(((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[l,d]=(0,u.useState)(null),f=h(o),m=h(a),p=(0,u.useRef)(null),v=s(t,(e=>d(e))),g=(0,u.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,u.useEffect)((()=>{if(r){function e(e){if(g.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:B(p.current,{select:!0})}function t(e){!g.paused&&l&&(l.contains(e.relatedTarget)||B(p.current,{select:!0}))}return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t)}}}),[r,l,g.paused]),(0,u.useEffect)((()=>{if(l){K.add(g);const t=document.activeElement;if(!l.contains(t)){const n=new CustomEvent(P,T);l.addEventListener(P,f),l.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(B(r,{select:t}),document.activeElement!==n)return}((e=j(l),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&B(l))}return()=>{l.removeEventListener(P,f),setTimeout((()=>{const e=new CustomEvent(I,T);l.addEventListener(I,m),l.dispatchEvent(e),e.defaultPrevented||B(null!=t?t:document.body,{select:!0}),l.removeEventListener(I,m),K.remove(g)}),0)}}var e}),[l,f,m,g]);const E=(0,u.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=j(e),n=W(t,e),r=W(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&B(a,{select:!0})):(e.preventDefault(),n&&B(r,{select:!0})):o===t&&e.preventDefault()}}),[n,r,g.paused]);return(0,u.createElement)(O.div,c({tabIndex:-1},i,{ref:v,onKeyDown:E}))}));function j(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 W(e,t){for(const n of e)if(!U(n,{upTo:t}))return n}function U(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 B(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 K=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=$(e,t),e.unshift(t)},remove(t){var n;e=$(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function $(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const q=(0,u.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?y().createPortal((0,u.createElement)(O.div,c({},o,{ref:t})),r):null}));const z=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=(0,u.useState)(),r=(0,u.useRef)({}),o=(0,u.useRef)(e),a=(0,u.useRef)("none"),c=e?"mounted":"unmounted",[i,l]=function(e,t){return(0,u.useReducer)(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,u.useEffect)((()=>{const e=G(r.current);a.current="mounted"===i?e:"none"}),[i]),f((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,c=G(t);if(e)l("MOUNT");else if("none"===c||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==c?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,l]),f((()=>{if(t){const e=e=>{const n=G(r.current).includes(e.animationName);e.target===t&&n&&(0,E.flushSync)((()=>l("ANIMATION_END")))},n=e=>{e.target===t&&(a.current=G(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,u.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):u.Children.only(n),a=s(r.ref,o.ref);return"function"==typeof n||r.isPresent?(0,u.cloneElement)(o,{ref:a}):null};function G(e){return(null==e?void 0:e.animationName)||"none"}z.displayName="Presence";let H=0;function V(){(0,u.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:X()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:X()),H++,()=>{1===H&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),H--}}),[])}function X(){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 Y=function(){return Y=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},Y.apply(this,arguments)};function Z(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 J(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 Q="right-scroll-bar-position",ee="width-before-scroll-bar";function te(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,u.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 ne(e){return e}function re(e,t){void 0===t&&(t=ne);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 oe=function(e){void 0===e&&(e={});var t=re(null);return t.options=Y({async:!0,ssr:!1},e),t}(),ae=function(){},ce=u.forwardRef((function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:ae,onWheelCapture:ae,onTouchMoveCapture:ae}),o=r[0],a=r[1],c=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,y=Z(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=m,w=te([n,t]),C=Y(Y({},y),o);return u.createElement(u.Fragment,null,d&&u.createElement(b,{sideCar:oe,removeScrollBar:s,shards:f,noIsolation:p,inert:v,setCallbacks:a,allowPinchZoom:!!h,lockRef:n}),c?u.cloneElement(u.Children.only(i),Y(Y({},C),{ref:w})):u.createElement(E,Y({},C,{className:l,ref:w}),i))}));ce.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ce.classNames={fullWidth:ee,zeroRight:Q};var ue,ie=function(e){var t=e.sideCar,n=Z(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 u.createElement(r,Y({},n))};ie.isSideCarExport=!0;function le(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ue||n.nc;return t&&e.setAttribute("nonce",t),e}var se=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=le())&&(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)}}},de=function(){var e,t=(e=se(),function(t,n){u.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}},fe={left:0,top:0,right:0,gap:0},me=function(e){return parseInt(e||"",10)||0},pe=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return fe;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[me(n),me(r),me(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])}},ve=de(),he=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(Q," {\n right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(ee," {\n margin-right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(Q," .").concat(Q," {\n right: 0 ").concat(r,";\n }\n \n .").concat(ee," .").concat(ee," {\n margin-right: 0 ").concat(r,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",": ").concat(u,"px;\n }\n")},ge=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r,a=u.useMemo((function(){return pe(o)}),[o]);return u.createElement(ve,{styles:he(a,!t,o,n?"":"!important")})},Ee=!1;if("undefined"!=typeof window)try{var ye=Object.defineProperty({},"passive",{get:function(){return Ee=!0,!0}});window.addEventListener("test",ye,ye),window.removeEventListener("test",ye,ye)}catch(e){Ee=!1}var be=!!Ee&&{passive:!1},we=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Ce(e,n)){var r=Se(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},Ce=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)},Se=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},xe=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Oe=function(e){return[e.deltaX,e.deltaY]},ke=function(e){return e&&"current"in e?e.current:e},Re=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Le=0,Ae=[];var De,Ne=(De=function(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),o=u.useState(Le++)[0],a=u.useState((function(){return de()}))[0],c=u.useRef(e);u.useEffect((function(){c.current=e}),[e]),u.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=J([e.lockRef.current],(e.shards||[]).map(ke),!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=u.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!c.current.allowPinchZoom;var o,a=xe(e),u=n.current,i="deltaX"in e?e.deltaX:u[0]-a[0],l="deltaY"in e?e.deltaY:u[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=we(d,s);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=we(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=Se(e,u),p=m[0],v=m[1]-m[2]-a*p;(p||v)&&Ce(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=u.useCallback((function(e){var n=e;if(Ae.length&&Ae[Ae.length-1]===a){var r="deltaY"in n?Oe(n):xe(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 u=(c.current.shards||[]).map(ke).filter(Boolean).filter((function(e){return e.contains(n.target)}));(u.length>0?i(n,u[0]):!c.current.noIsolation)&&n.preventDefault()}}}),[]),s=u.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=u.useCallback((function(e){n.current=xe(e),r.current=void 0}),[]),f=u.useCallback((function(t){s(t.type,Oe(t),t.target,i(t,e.lockRef.current))}),[]),m=u.useCallback((function(t){s(t.type,xe(t),t.target,i(t,e.lockRef.current))}),[]);u.useEffect((function(){return Ae.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,be),document.addEventListener("touchmove",l,be),document.addEventListener("touchstart",d,be),function(){Ae=Ae.filter((function(e){return e!==a})),document.removeEventListener("wheel",l,be),document.removeEventListener("touchmove",l,be),document.removeEventListener("touchstart",d,be)}}),[]);var p=e.removeScrollBar,v=e.inert;return u.createElement(u.Fragment,null,v?u.createElement(a,{styles:Re(o)}):null,p?u.createElement(ge,{gapMode:"margin"}):null)},oe.useMedium(De),ie),Me=u.forwardRef((function(e,t){return u.createElement(ce,Y({},e,{ref:t,sideCar:Ne}))}));Me.classNames=ce.classNames;var _e=Me,Pe=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ie=new WeakMap,Te=new WeakMap,Fe={},je=0,We=function(e){return e&&(e.host||We(e.parentNode))},Ue=function(e,t,n,r){var o=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=We(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]);Fe[n]||(Fe[n]=new WeakMap);var a=Fe[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=(Ie.get(e)||0)+1,l=(a.get(e)||0)+1;Ie.set(e,i),a.set(e,l),c.push(e),1===i&&o&&Te.set(e,!0),1===l&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}}))};return s(t),u.clear(),je++,function(){c.forEach((function(e){var t=Ie.get(e)-1,o=a.get(e)-1;Ie.set(e,t),a.set(e,o),t||(Te.has(e)||e.removeAttribute(r),Te.delete(e)),o||e.removeAttribute(n)})),--je||(Ie=new WeakMap,Ie=new WeakMap,Te=new WeakMap,Fe={})}},Be=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||Pe(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Ue(r,o,n,"aria-hidden")):function(){return null}};const Ke="Dialog",[$e,qe]=function(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>(0,u.createContext)(e)));return function(n){const r=(null==n?void 0:n[e])||t;return(0,u.useMemo)((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=(0,u.createContext)(r),a=n.length;function c(t){const{scope:n,children:r,...c}=t,i=(null==n?void 0:n[e][a])||o,l=(0,u.useMemo)((()=>c),Object.values(c));return(0,u.createElement)(i.Provider,{value:l},r)}return n=[...n,r],c.displayName=t+"Provider",[c,function(n,c){const i=(null==c?void 0:c[e][a])||o,l=(0,u.useContext)(i);if(l)return l;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},d(r,...t)]}(Ke),[ze,Ge]=$e(Ke),He=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:c=!0}=e,i=(0,u.useRef)(null),l=(0,u.useRef)(null),[s=!1,d]=g({prop:r,defaultProp:o,onChange:a});return(0,u.createElement)(ze,{scope:t,triggerRef:i,contentRef:l,contentId:v(),titleId:v(),descriptionId:v(),open:s,onOpenChange:d,onOpenToggle:(0,u.useCallback)((()=>d((e=>!e))),[d]),modal:c},n)},Ve="DialogPortal",[Xe,Ye]=$e(Ve,{forceMount:void 0}),Ze=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=Ge(Ve,t);return(0,u.createElement)(Xe,{scope:t,forceMount:n},u.Children.map(r,(e=>(0,u.createElement)(z,{present:n||a.open},(0,u.createElement)(q,{asChild:!0,container:o},e)))))},Je="DialogOverlay",Qe=(0,u.forwardRef)(((e,t)=>{const n=Ye(Je,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=Ge(Je,e.__scopeDialog);return a.modal?(0,u.createElement)(z,{present:r||a.open},(0,u.createElement)(et,c({},o,{ref:t}))):null})),et=(0,u.forwardRef)(((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ge(Je,n);return(0,u.createElement)(_e,{as:b,allowPinchZoom:!0,shards:[o.contentRef]},(0,u.createElement)(O.div,c({"data-state":ut(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))})),tt="DialogContent",nt=(0,u.forwardRef)(((e,t)=>{const n=Ye(tt,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=Ge(tt,e.__scopeDialog);return(0,u.createElement)(z,{present:r||a.open},a.modal?(0,u.createElement)(rt,c({},o,{ref:t})):(0,u.createElement)(ot,c({},o,{ref:t})))})),rt=(0,u.forwardRef)(((e,t)=>{const n=Ge(tt,e.__scopeDialog),r=(0,u.useRef)(null),o=s(t,n.contentRef,r);return(0,u.useEffect)((()=>{const e=r.current;if(e)return Be(e)}),[]),(0,u.createElement)(at,c({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:i(e.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=n.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:i(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:i(e.onFocusOutside,(e=>e.preventDefault()))}))})),ot=(0,u.forwardRef)(((e,t)=>{const n=Ge(tt,e.__scopeDialog),r=(0,u.useRef)(!1);return(0,u.createElement)(at,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()}}))})),at=(0,u.forwardRef)(((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,l=Ge(tt,n),d=s(t,(0,u.useRef)(null));return V(),(0,u.createElement)(u.Fragment,null,(0,u.createElement)(F,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a},(0,u.createElement)(N,c({role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ut(l.open)},i,{ref:d,onDismiss:()=>l.onOpenChange(!1)}))),!1)})),ct="DialogTitle";function ut(e){return e?"open":"closed"}const it="DialogTitleWarning",[lt,st]=function(e,t){const n=(0,u.createContext)(t);function r(e){const{children:t,...r}=e,o=(0,u.useMemo)((()=>r),Object.values(r));return(0,u.createElement)(n.Provider,{value:o},t)}return r.displayName=e+"Provider",[r,function(r){const o=(0,u.useContext)(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(it,{contentName:tt,titleName:ct,docsSlug:"dialog"}),dt=He,ft=Ze,mt=Qe,pt=nt;var vt=n(8670),ht='[cmdk-group=""]',gt='[cmdk-group-items=""]',Et='[cmdk-item=""]',yt=`${Et}:not([aria-disabled="true"])`,bt="cmdk-item-select",wt="data-value",Ct=(e,t)=>vt(e,t),St=u.createContext(void 0),xt=()=>u.useContext(St),Ot=u.createContext(void 0),kt=()=>u.useContext(Ot),Rt=u.createContext(void 0),Lt=u.forwardRef(((e,t)=>{let n=u.useRef(null),r=Kt((()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}}))),o=Kt((()=>new Set)),a=Kt((()=>new Map)),c=Kt((()=>new Map)),i=Kt((()=>new Set)),l=Ut(e),{label:s,children:d,value:f,onValueChange:m,filter:p,shouldFilter:v,...h}=e,g=u.useId(),E=u.useId(),y=u.useId(),b=Gt();Bt((()=>{if(void 0!==f){let e=f.trim().toLowerCase();r.current.value=e,b(6,R),w.emit()}}),[f]);let w=u.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(),b(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||b(5,R)}w.emit()}},emit:()=>{i.current.forEach((e=>e()))}})),[]),C=u.useMemo((()=>({value:(e,t)=>{t!==c.current.get(e)&&(c.current.set(e,t),r.current.filtered.items.set(e,S(t)),b(2,(()=>{x(),w.emit()})))},item:(e,t)=>(o.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),b(3,(()=>{k(),x(),r.current.value||O(),w.emit()})),()=>{c.current.delete(e),o.current.delete(e),r.current.filtered.items.delete(e),b(4,(()=>{k(),O(),w.emit()}))}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{c.current.delete(e),a.current.delete(e)}),filter:()=>l.current.shouldFilter,label:s||e["aria-label"],listId:g,inputId:y,labelId:E})),[]);function S(e){var t;let n=(null==(t=l.current)?void 0:t.filter)??Ct;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=a.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(wt),o=n.getAttribute(wt);return(e.get(o)??0)-(e.get(r)??0)})).forEach((e=>{let t=e.closest(gt);t?t.appendChild(e.parentElement===t?e:e.closest(`${gt} > *`)):o.appendChild(e.parentElement===o?e:e.closest(`${gt} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{let t=n.current.querySelector(`${ht}[${wt}="${e[0]}"]`);null==t||t.parentElement.appendChild(t)}))}function O(){let e=A().find((e=>!e.ariaDisabled)),t=null==e?void 0:e.getAttribute(wt);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(c.current.get(t));r.current.filtered.items.set(t,n),n>0&&e++}for(let[e,t]of a.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(ht))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function L(){return n.current.querySelector(`${Et}[aria-selected="true"]`)}function A(){return Array.from(n.current.querySelectorAll(yt))}function D(e){let t=A()[e];t&&w.setState("value",t.getAttribute(wt))}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(wt))}function M(e){let t,n=L(),r=null==n?void 0:n.closest(ht);for(;r&&!t;)r=e>0?jt(r,ht):Wt(r,ht),t=null==r?void 0:r.querySelector(yt);t?w.setState("value",t.getAttribute(wt)):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 u.createElement("div",{ref:$t([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)}}}}},u.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:Ht},s),u.createElement(Ot.Provider,{value:w},u.createElement(St.Provider,{value:C},d)))})),At=u.forwardRef(((e,t)=>{let n=u.useId(),r=u.useRef(null),o=u.useContext(Rt),a=xt(),c=Ut(e);Bt((()=>a.item(n,o)),[]);let i=zt(n,r,[e.value,e.children,r]),l=kt(),s=qt((e=>e.value&&e.value===i.current)),d=qt((e=>!1===a.filter()||(!e.search||e.filtered.items.get(n)>0)));function f(){var e,t;null==(t=(e=c.current).onSelect)||t.call(e,i.current)}if(u.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 u.createElement("div",{ref:$t([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)})),Dt=u.forwardRef(((e,t)=>{let{heading:n,children:r,...o}=e,a=u.useId(),c=u.useRef(null),i=u.useRef(null),l=u.useId(),s=xt(),d=qt((e=>!1===s.filter()||(!e.search||e.filtered.groups.has(a))));Bt((()=>s.group(a)),[]),zt(a,c,[e.value,e.heading,i]);let f=u.createElement(Rt.Provider,{value:a},r);return u.createElement("div",{ref:$t([c,t]),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&u.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),u.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},f))})),Nt=u.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=u.useRef(null),a=qt((e=>!e.search));return n||a?u.createElement("div",{ref:$t([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),Mt=u.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=kt(),c=qt((e=>e.search)),i=xt();return u.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),u.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:c,onChange:e=>{o||a.setState("search",e.target.value),null==n||n(e.target.value)}})})),_t=u.forwardRef(((e,t)=>{let{children:n,...r}=e,o=u.useRef(null),a=u.useRef(null),c=xt();return u.useEffect((()=>{if(a.current&&o.current){let e,t=a.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)}}}),[]),u.createElement("div",{ref:$t([o,t]),...r,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:c.listId,"aria-labelledby":c.inputId},u.createElement("div",{ref:a,"cmdk-list-sizer":""},n))})),Pt=u.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,container:o,...a}=e;return u.createElement(dt,{open:n,onOpenChange:r},u.createElement(ft,{container:o},u.createElement(mt,{"cmdk-overlay":""}),u.createElement(pt,{"aria-label":e.label,"cmdk-dialog":""},u.createElement(Lt,{ref:t,...a}))))})),It=u.forwardRef(((e,t)=>{let n=u.useRef(!0),r=qt((e=>0===e.filtered.count));return u.useEffect((()=>{n.current=!1}),[]),n.current||!r?null:u.createElement("div",{ref:t,...e,"cmdk-empty":"",role:"presentation"})})),Tt=u.forwardRef(((e,t)=>{let{progress:n,children:r,...o}=e;return u.createElement("div",{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},u.createElement("div",{"aria-hidden":!0},r))})),Ft=Object.assign(Lt,{List:_t,Item:At,Input:Mt,Group:Dt,Separator:Nt,Dialog:Pt,Empty:It,Loading:Tt});function jt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Wt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Ut(e){let t=u.useRef(e);return Bt((()=>{t.current=e})),t}var Bt=typeof window>"u"?u.useEffect:u.useLayoutEffect;function Kt(e){let t=u.useRef();return void 0===t.current&&(t.current=e()),t}function $t(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function qt(e){let t=kt(),n=()=>e(t.snapshot());return u.useSyncExternalStore(t.subscribe,n,n)}function zt(e,t,n){let r=u.useRef(),o=xt();return Bt((()=>{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(wt,c),r.current=c})),r}var Gt=()=>{let[e,t]=u.useState(),n=Kt((()=>new Map));return Bt((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}},Ht={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},Vt=n(4403),Xt=n.n(Vt),Yt=window.wp.data,Zt=window.wp.i18n,Jt=window.wp.components,Qt=window.wp.keyboardShortcuts;var en=(0,a.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,a.cloneElement)(e,{width:t,height:t,...n,ref:r})})),tn=window.wp.primitives;var 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"}));var rn=(0,Yt.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 yn(e){return{type:"SET_CONTEXT",context:e}}var bn=window.wp.privateApis;const{lock:wn,unlock:Cn}=(0,bn.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/commands"),Sn=(0,Yt.createReduxStore)("core/commands",{reducer:rn,actions:e,selectors:t});function xn({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,a.useEffect)((()=>{r(e,u)}),[r,e,u]),i.length?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Ft.List,null,i.map((e=>{var n;return(0,a.createElement)(Ft.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:Xt()("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 On({hook:e,search:t,setLoader:n,close:r}){const o=(0,a.useRef)(e),[c,u]=(0,a.useState)(0);return(0,a.useEffect)((()=>{o.current!==e&&(o.current=e,u((e=>e+1)))}),[e]),(0,a.createElement)(xn,{key:c,hook:o.current,search:t,setLoader:n,close:r})}function kn({isContextual:e,search:t,setLoader:n,close:r}){const{commands:o,loaders:c}=(0,Yt.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)(Ft.Group,null,o.map((e=>{var n;return(0,a.createElement)(Ft.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:Xt()("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)(On,{key:e.name,hook:e.hook,search:t,setLoader:n,close:r})))):null}function Rn({isOpen:e,search:t,setSearch:n}){const r=(0,a.useRef)(),o=qt((e=>e.value)),c=(0,a.useMemo)((()=>{const e=document.querySelector(`[cmdk-item=""][data-value="${o}"]`);return e?.getAttribute("id")}),[o]);return(0,a.useEffect)((()=>{e&&r.current.focus()}),[e]),(0,a.createElement)(Ft.Input,{ref:r,value:t,onValueChange:n,placeholder:(0,Zt.__)("Search for commands"),"aria-activedescendant":c,icon:t})}function Ln(){const{registerShortcut:e}=(0,Yt.useDispatch)(Qt.store),[t,n]=(0,a.useState)(""),r=(0,Yt.useSelect)((e=>e(Sn).isOpen()),[]),{open:o,close:c}=(0,Yt.useDispatch)(Sn),[u,i]=(0,a.useState)({});(0,a.useEffect)((()=>{e({name:"core/commands",category:"global",description:(0,Zt.__)("Open the command palette."),keyCombination:{modifier:"primary",character:"k"}})}),[e]),(0,Qt.useShortcut)("core/commands",(e=>{e.defaultPrevented||(e.preventDefault(),r?c():o())}),{bindGlobal:!0});const l=(0,a.useCallback)(((e,t)=>i((n=>({...n,[e]:t})))),[]),s=()=>{n(""),c()};if(!r)return!1;const d=Object.values(u).some(Boolean);return(0,a.createElement)(Jt.Modal,{className:"commands-command-menu",overlayClassName:"commands-command-menu__overlay",onRequestClose:s,__experimentalHideHeader:!0},(0,a.createElement)("div",{className:"commands-command-menu__container"},(0,a.createElement)(Ft,{label:(0,Zt.__)("Command palette"),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)(Rn,{search:t,setSearch:n,isOpen:r})),(0,a.createElement)(Ft.List,null,t&&!d&&(0,a.createElement)(Ft.Empty,null,(0,Zt.__)("No results found.")),(0,a.createElement)(kn,{search:t,setLoader:l,close:s,isContextual:!0}),t&&(0,a.createElement)(kn,{search:t,setLoader:l,close:s})))))}(0,Yt.register)(Sn),Cn(Sn).registerPrivateActions(o);const An={};function Dn(e){const{registerCommand:t,unregisterCommand:n}=(0,Yt.useDispatch)(Sn),r=(0,a.useRef)(e.callback);(0,a.useEffect)((()=>{r.current=e.callback}),[e.callback]),(0,a.useEffect)((()=>(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,t,n])}function Nn(e){const{registerCommandLoader:t,unregisterCommandLoader:n}=(0,Yt.useDispatch)(Sn);(0,a.useEffect)((()=>(t({name:e.name,hook:e.hook,context:e.context}),()=>{n(e.name)})),[e.name,e.hook,e.context,t,n])}wn(An,{useCommandContext:function(e){const{getContext:t}=(0,Yt.useSelect)(Sn),n=(0,a.useRef)(t()),{setContext:r}=Cn((0,Yt.useDispatch)(Sn));(0,a.useEffect)((()=>{r(e)}),[e,r]),(0,a.useEffect)((()=>{const e=n.current;return()=>r(e)}),[r])}})}(),(window.wp=window.wp||{}).commands=r}();