@yoopta/ui 6.0.0-beta.9 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/action-menu-list/action-menu-list.d.ts.map +1 -1
  2. package/dist/action-menu-list/context.d.ts +3 -1
  3. package/dist/action-menu-list/context.d.ts.map +1 -1
  4. package/dist/action-menu-list.js +1 -1
  5. package/dist/action-menu-list.js.map +1 -0
  6. package/dist/block-dnd/block-dnd-context.d.ts.map +1 -1
  7. package/dist/block-dnd/sortable-block.d.ts.map +1 -1
  8. package/dist/block-dnd.js +7 -1
  9. package/dist/block-dnd.js.map +1 -0
  10. package/dist/block-options/block-options.d.ts +0 -7
  11. package/dist/block-options/block-options.d.ts.map +1 -1
  12. package/dist/block-options.js +1 -1
  13. package/dist/block-options.js.map +1 -0
  14. package/dist/chunks/_tslib-29461875.js +1 -0
  15. package/dist/chunks/_tslib-8c24563b.js +57 -0
  16. package/dist/chunks/_tslib-8c24563b.js.map +1 -0
  17. package/dist/chunks/createLucideIcon-6ba35914.js +56 -0
  18. package/dist/chunks/createLucideIcon-6ba35914.js.map +1 -0
  19. package/dist/chunks/createLucideIcon-8605f860.js +13 -0
  20. package/dist/chunks/debounce-1e7f29bf.js +40 -0
  21. package/dist/chunks/debounce-1e7f29bf.js.map +1 -0
  22. package/dist/chunks/{index-e0185864.js → debounce-c595d128.js} +1 -1
  23. package/dist/chunks/floating-ui.react-0f8b5c36.js +5 -0
  24. package/dist/chunks/floating-ui.react-77cadca5.js +2469 -0
  25. package/dist/chunks/floating-ui.react-77cadca5.js.map +1 -0
  26. package/dist/chunks/floating-ui.react-dom-3fffb30c.js +2356 -0
  27. package/dist/chunks/floating-ui.react-dom-3fffb30c.js.map +1 -0
  28. package/dist/chunks/floating-ui.react-dom-dc823237.js +1 -0
  29. package/dist/chunks/style-inject.es-746bb8ed.js +29 -0
  30. package/dist/chunks/style-inject.es-746bb8ed.js.map +1 -0
  31. package/dist/chunks/throttle-278836f4.js +45 -0
  32. package/dist/chunks/throttle-278836f4.js.map +1 -0
  33. package/dist/element-options/components/element-options-color-picker.d.ts.map +1 -1
  34. package/dist/element-options/components/element-options-content.d.ts.map +1 -1
  35. package/dist/element-options/components/element-options-root.d.ts +1 -1
  36. package/dist/element-options/components/element-options-root.d.ts.map +1 -1
  37. package/dist/element-options/components/element-options-select.d.ts.map +1 -1
  38. package/dist/element-options/components/element-options-slider.d.ts.map +1 -1
  39. package/dist/element-options/components/element-options-toggle.d.ts.map +1 -1
  40. package/dist/element-options/components/element-options-trigger.d.ts +1 -1
  41. package/dist/element-options/components/element-options-trigger.d.ts.map +1 -1
  42. package/dist/element-options/context/element-options-context.d.ts +1 -1
  43. package/dist/element-options/index.d.ts +3 -3
  44. package/dist/element-options/types.d.ts +1 -14
  45. package/dist/element-options/types.d.ts.map +1 -1
  46. package/dist/element-options.js +3 -3
  47. package/dist/element-options.js.map +1 -0
  48. package/dist/floating-block-actions/floating-block-actions.d.ts +4 -3
  49. package/dist/floating-block-actions/floating-block-actions.d.ts.map +1 -1
  50. package/dist/floating-block-actions.js +1 -1
  51. package/dist/floating-block-actions.js.map +1 -0
  52. package/dist/floating-toolbar/floating-toolbar.d.ts +4 -4
  53. package/dist/floating-toolbar/floating-toolbar.d.ts.map +1 -1
  54. package/dist/floating-toolbar.js +1 -1
  55. package/dist/floating-toolbar.js.map +1 -0
  56. package/dist/highlight-color-picker/highlight-color-picker.d.ts +1 -0
  57. package/dist/highlight-color-picker/highlight-color-picker.d.ts.map +1 -1
  58. package/dist/highlight-color-picker/index.d.ts +0 -1
  59. package/dist/highlight-color-picker/index.d.ts.map +1 -1
  60. package/dist/highlight-color-picker.js +1 -1
  61. package/dist/highlight-color-picker.js.map +1 -0
  62. package/dist/index.js +1 -1
  63. package/dist/index.js.map +1 -0
  64. package/dist/overlay.js +1 -1
  65. package/dist/overlay.js.map +1 -0
  66. package/dist/portal/Portal.d.ts +1 -1
  67. package/dist/portal/Portal.d.ts.map +1 -1
  68. package/dist/portal.js +1 -1
  69. package/dist/portal.js.map +1 -0
  70. package/dist/selection-box/SelectionBox.d.ts.map +1 -1
  71. package/dist/selection-box/hooks.d.ts.map +1 -1
  72. package/dist/selection-box.js +1 -1
  73. package/dist/selection-box.js.map +1 -0
  74. package/dist/slash-command-menu/components/{SlashCommandContent.d.ts → slash-command-content.d.ts} +1 -1
  75. package/dist/slash-command-menu/components/slash-command-content.d.ts.map +1 -0
  76. package/dist/slash-command-menu/components/{SlashCommandEmpty.d.ts → slash-command-empty.d.ts} +1 -1
  77. package/dist/slash-command-menu/components/slash-command-empty.d.ts.map +1 -0
  78. package/dist/slash-command-menu/components/{SlashCommandFooter.d.ts → slash-command-footer.d.ts} +1 -1
  79. package/dist/slash-command-menu/components/slash-command-footer.d.ts.map +1 -0
  80. package/dist/slash-command-menu/components/{SlashCommandGroup.d.ts → slash-command-group.d.ts} +1 -1
  81. package/dist/slash-command-menu/components/slash-command-group.d.ts.map +1 -0
  82. package/dist/slash-command-menu/components/{SlashCommandInput.d.ts → slash-command-input.d.ts} +1 -1
  83. package/dist/slash-command-menu/components/slash-command-input.d.ts.map +1 -0
  84. package/dist/slash-command-menu/components/{SlashCommandItem.d.ts → slash-command-item.d.ts} +1 -1
  85. package/dist/slash-command-menu/components/slash-command-item.d.ts.map +1 -0
  86. package/dist/slash-command-menu/components/{SlashCommandList.d.ts → slash-command-list.d.ts} +1 -1
  87. package/dist/slash-command-menu/components/slash-command-list.d.ts.map +1 -0
  88. package/dist/slash-command-menu/components/{SlashCommandLoading.d.ts → slash-command-loading.d.ts} +1 -1
  89. package/dist/slash-command-menu/components/slash-command-loading.d.ts.map +1 -0
  90. package/dist/slash-command-menu/components/{SlashCommandRoot.d.ts → slash-command-root.d.ts} +1 -1
  91. package/dist/slash-command-menu/components/slash-command-root.d.ts.map +1 -0
  92. package/dist/slash-command-menu/components/{SlashCommandSeparator.d.ts → slash-command-separator.d.ts} +1 -1
  93. package/dist/slash-command-menu/components/slash-command-separator.d.ts.map +1 -0
  94. package/dist/slash-command-menu/constants.d.ts.map +1 -1
  95. package/dist/slash-command-menu/context/{SlashCommandContext.d.ts → slash-command-context.d.ts} +1 -1
  96. package/dist/slash-command-menu/context/slash-command-context.d.ts.map +1 -0
  97. package/dist/slash-command-menu/index.d.ts +32 -32
  98. package/dist/slash-command-menu/index.d.ts.map +1 -1
  99. package/dist/slash-command-menu.js +1 -1
  100. package/dist/slash-command-menu.js.map +1 -0
  101. package/dist/utils/debounce.d.ts +5 -0
  102. package/dist/utils/debounce.d.ts.map +1 -0
  103. package/package.json +8 -6
  104. package/LICENSE +0 -21
  105. package/dist/chunks/_tslib-5e145dfd.js +0 -1
  106. package/dist/chunks/floating-ui.react-727e4287.js +0 -5
  107. package/dist/chunks/highlight-color-picker-ce0b19ac.js +0 -1
  108. package/dist/slash-command-menu/components/SlashCommandContent.d.ts.map +0 -1
  109. package/dist/slash-command-menu/components/SlashCommandEmpty.d.ts.map +0 -1
  110. package/dist/slash-command-menu/components/SlashCommandFooter.d.ts.map +0 -1
  111. package/dist/slash-command-menu/components/SlashCommandGroup.d.ts.map +0 -1
  112. package/dist/slash-command-menu/components/SlashCommandInput.d.ts.map +0 -1
  113. package/dist/slash-command-menu/components/SlashCommandItem.d.ts.map +0 -1
  114. package/dist/slash-command-menu/components/SlashCommandList.d.ts.map +0 -1
  115. package/dist/slash-command-menu/components/SlashCommandLoading.d.ts.map +0 -1
  116. package/dist/slash-command-menu/components/SlashCommandRoot.d.ts.map +0 -1
  117. package/dist/slash-command-menu/components/SlashCommandSeparator.d.ts.map +0 -1
  118. package/dist/slash-command-menu/context/SlashCommandContext.d.ts.map +0 -1
@@ -0,0 +1,5 @@
1
+ import*as e from"react";import{useLayoutEffect as t,useEffect as n,useRef as r}from"react";import{i as o,a as i,b as u,g as c,u as l,c as s,d as a,e as f,f as d,h as p}from"./floating-ui.react-dom-dc823237.js";import*as v from"react-dom";function m(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function h(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&o(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function g(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function y(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}function b(e){return!y().includes("jsdom/")&&(!E()&&0===e.width&&0===e.height||E()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function E(){const e=/android/i;return e.test(g())||e.test(y())}function w(e){return(null==e?void 0:e.ownerDocument)||document}function R(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function x(e){return"composedPath"in e?e.composedPath()[0]:e.target}function S(e){e.preventDefault(),e.stopPropagation()}function A(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return i(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}
2
+ /*!
3
+ * tabbable 6.4.0
4
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
+ */var k=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),C="undefined"==typeof Element,O=C?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,M=!C&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},L=function(e,t){var n;void 0===t&&(t=!0);var r=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===r||"true"===r||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):L(e.parentNode))},P=function(e,t,n){for(var r=[],o=Array.from(e);o.length;){var i=o.shift();if(!L(i,!1))if("SLOT"===i.tagName){var u=i.assignedElements(),c=u.length?u:i.children,l=P(c,!0,n);n.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{O.call(i,k)&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!L(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=P(!0===s?i.children:s.children,!0,n);n.flatten?r.push.apply(r,f):r.push({scopeParent:i,candidates:f})}else o.unshift.apply(o,i.children)}}return r},I=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},T=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!I(e)?0:e.tabIndex},N=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},D=function(e){return"INPUT"===e.tagName},F=function(e){return function(e){return D(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||M(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},j=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},q=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var o=O.call(e,"details>summary:first-of-type")?e.parentElement:e;if(O.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return j(e)}else{if("function"==typeof r){for(var i=e;e;){var u=e.parentElement,c=M(e);if(u&&!u.shadowRoot&&!0===r(u))return j(e);e=e.assignedSlot?e.assignedSlot:u||c===e.ownerDocument?u:c.host}e=i}if(function(e){var t,n,r,o,i=e&&M(e),u=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(u)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!c&&u;){var l,s,a;c=!(null===(s=u=null===(l=i=M(u))||void 0===l?void 0:l.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},W=function(e,t){return!(t.disabled||function(e){return D(e)&&"hidden"===e.type}(t)||q(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some(function(e){return"SUMMARY"===e.tagName})}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!O.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},B=function(e,t){return!(F(t)||T(t)<0||!W(e,t))},K=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},V=function(e){var t=[],n=[];return e.forEach(function(e,r){var o=!!e.scopeParent,i=o?e.scopeParent:e,u=function(e,t){var n=T(e);return n<0&&t&&!I(e)?0:n}(i,o),c=o?V(e.candidates):i;0===u?o?t.push.apply(t,c):t.push(i):n.push({documentOrder:r,tabIndex:u,item:e,isScope:o,content:c})}),n.sort(N).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},_=function(e,t){var n;return n=(t=t||{}).getShadowRoot?P([e],t.includeContainer,{filter:B.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:K}):function(e,t,n){if(L(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(k));return t&&O.call(e,k)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,B.bind(null,t)),V(n)};function H(t){return e.useMemo(()=>t.every(e=>null==e)?null:e=>{t.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})},t)}const U={...e},z=U.useInsertionEffect||(e=>e());function X(t){const n=e.useRef(()=>{});return z(()=>{n.current=t}),e.useCallback(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)},[])}var Y="undefined"!=typeof document?t:n;function Z(){return Z=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},Z.apply(this,arguments)}let $=!1,G=0;const J=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+G++;const Q=U.useId||function(){const[t,n]=e.useState(()=>$?J():void 0);return Y(()=>{null==t&&n(J())},[]),e.useEffect(()=>{$=!0},[]),t};const ee=e.createContext(null),te=e.createContext(null),ne=()=>e.useContext(te);function re(e){return"data-floating-ui-"+e}function oe(e){const t=r(e);return Y(()=>{t.current=e}),t}let ie=0;function ue(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ie);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():ie=requestAnimationFrame(i)}function ce(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}let le=new WeakMap,se=new WeakSet,ae={},fe=0;const de=e=>e&&(e.host||de(e.parentNode));function pe(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=(c=t,e.map(e=>{if(c.contains(e))return e;const t=de(e);return c.contains(t)?t:null}).filter(e=>null!=e));var c;const l=new Set,a=new Set(u),f=[];ae[o]||(ae[o]=new WeakMap);const d=ae[o];return u.forEach(function e(t){if(!t||l.has(t))return;l.add(t),t.parentNode&&e(t.parentNode)}),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,t=>{if("script"!==s(t))if(l.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(le.get(t)||0)+1,u=(d.get(t)||0)+1;le.set(t,r),d.set(t,u),f.push(t),1===r&&n&&se.add(t),1===u&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}})}(t),l.clear(),fe++,()=>{f.forEach(e=>{const t=(le.get(e)||0)-1,n=(d.get(e)||0)-1;le.set(e,t),d.set(e,n),t||(!se.has(e)&&i&&e.removeAttribute(i),se.delete(e)),n||e.removeAttribute(o)}),fe--,fe||(le=new WeakMap,le=new WeakMap,se=new WeakSet,ae={})}}function ve(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=w(e[0]).body;return pe(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const me=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function he(e,t){const n=_(e,me());"prev"===t&&n.reverse();const r=n.indexOf(m(w(e)));return n.slice(r+1)[0]}function ge(){return he(document.body,"next")}function ye(){return he(document.body,"prev")}function be(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!h(n,r)}function Ee(e){_(e,me()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function we(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const Re={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function xe(e){"Tab"===e.key&&(e.target,clearTimeout(void 0))}const Se=e.forwardRef(function(t,n){const[r,o]=e.useState();Y(()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",xe),()=>{document.removeEventListener("keydown",xe)}),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[re("focus-guard")]:"",style:Re};return e.createElement("span",Z({},t,i))}),Ae=e.createContext(null),ke=re("portal");function Ce(t){const{children:n,id:r,root:o,preserveTabOrder:i=!0}=t,c=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=Q(),i=Oe(),[c,l]=e.useState(null),s=e.useRef(null);return Y(()=>()=>{null==c||c.remove(),queueMicrotask(()=>{s.current=null})},[c]),Y(()=>{if(!o)return;if(s.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(ke,""),e.appendChild(t),s.current=t,l(t)},[n,o]),Y(()=>{if(null===r)return;if(!o)return;if(s.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!u(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const c=document.createElement("div");c.id=o,c.setAttribute(ke,""),e=t||e,e.appendChild(c),s.current=c,l(c)},[n,r,o,i]),c}({id:r,root:o}),[l,s]=e.useState(null),a=e.useRef(null),f=e.useRef(null),d=e.useRef(null),p=e.useRef(null),m=null==l?void 0:l.modal,h=null==l?void 0:l.open,g=!!l&&!l.modal&&l.open&&i&&!(!o&&!c);return e.useEffect(()=>{if(c&&i&&!m)return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&be(e)){("focusin"===e.type?we:Ee)(c)}}},[c,i,m]),e.useEffect(()=>{c&&(h||we(c))},[h,c]),e.createElement(Ae.Provider,{value:e.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:p,portalNode:c,setFocusManagerState:s}),[i,c])},g&&c&&e.createElement(Se,{"data-type":"outside",ref:a,onFocus:e=>{if(be(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=ye()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),g&&c&&e.createElement("span",{"aria-owns":c.id,style:Re}),c&&v.createPortal(n,c),g&&c&&e.createElement(Se,{"data-type":"outside",ref:f,onFocus:e=>{if(be(e,c)){var t;null==(t=p.current)||t.focus()}else{const t=ge()||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const Oe=()=>e.useContext(Ae),Me="data-floating-ui-focusable";let Le=[];function Pe(e){Le=Le.filter(e=>e.isConnected);let t=e;if(t&&"body"!==s(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==O.call(e,k)&&B(t,e)}(t,me())){const e=_(t,me())[0];e&&(t=e)}Le.push(t),Le.length>20&&(Le=Le.slice(-20))}}function Ie(){return Le.slice().reverse().find(e=>e.isConnected)}const Te=e.forwardRef(function(t,n){return e.createElement("button",Z({},t,{type:"button",ref:n,tabIndex:-1,style:Re}))});function Ne(t){const{context:n,children:r,disabled:o=!1,order:u=["content"],guards:c=!0,initialFocus:l=0,returnFocus:s=!0,restoreFocus:a=!1,modal:f=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:p=!0}=t,{open:v,refs:g,nodeId:y,onOpenChange:R,events:k,dataRef:C,floatingId:O,elements:{domReference:M,floating:L}}=n,P="number"==typeof l&&l<0,I=A(M)&&P,T="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||c,N=oe(u),D=oe(l),F=oe(s),j=ne(),q=Oe(),W=e.useRef(null),B=e.useRef(null),K=e.useRef(!1),V=e.useRef(!1),H=e.useRef(-1),U=null!=q,z=(Z=L)?Z.hasAttribute(Me)?Z:Z.querySelector("["+Me+"]")||Z:null;var Z;const $=X(function(e){return void 0===e&&(e=z),e?_(e,me()):[]}),G=X(e=>{const t=$(e);return N.current.map(e=>M&&"reference"===e?M:z&&"floating"===e?z:t).filter(Boolean).flat()});function J(t){return!o&&d&&f?e.createElement(Te,{ref:"start"===t?W:B,onClick:e=>R(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}e.useEffect(()=>{if(o)return;if(!f)return;function e(e){if("Tab"===e.key){h(z,m(w(z)))&&0===$().length&&!I&&S(e);const t=G(),n=x(e);"reference"===N.current[0]&&n===M&&(S(e),e.shiftKey?ue(t[t.length-1]):ue(t[1])),"floating"===N.current[1]&&n===z&&e.shiftKey&&(S(e),ue(t[0]))}}const t=w(z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[o,M,z,f,N,I,$,G]),e.useEffect(()=>{if(!o&&L)return L.addEventListener("focusin",e),()=>{L.removeEventListener("focusin",e)};function e(e){const t=x(e),n=$().indexOf(t);-1!==n&&(H.current=n)}},[o,L,$]),e.useEffect(()=>{if(!o&&p)return L&&i(M)?(M.addEventListener("focusout",t),M.addEventListener("pointerdown",e),L.addEventListener("focusout",t),()=>{M.removeEventListener("focusout",t),M.removeEventListener("pointerdown",e),L.removeEventListener("focusout",t)}):void 0;function e(){V.current=!0,setTimeout(()=>{V.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(h(M,t)||h(L,t)||h(t,L)||h(null==q?void 0:q.portalNode,t)||null!=t&&t.hasAttribute(re("focus-guard"))||j&&(ce(j.nodesRef.current,y).find(e=>{var n,r;return h(null==(n=e.context)?void 0:n.elements.floating,t)||h(null==(r=e.context)?void 0:r.elements.domReference,t)})||function(e,t){var n;let r=[],o=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;o;){const t=e.find(e=>e.id===o);o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(j.nodesRef.current,y).find(e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t})));if(a&&n&&m(w(z))===w(z).body){i(z)&&z.focus();const e=H.current,t=$(),n=t[e]||t[t.length-1]||z;i(n)&&n.focus()}!I&&f||!t||!n||V.current||t===Ie()||(K.current=!0,R(!1,e,"focus-out"))})}},[o,M,L,z,f,y,j,q,R,p,a,$,I]),e.useEffect(()=>{var e;if(o)return;const t=Array.from((null==q||null==(e=q.portalNode)?void 0:e.querySelectorAll("["+re("portal")+"]"))||[]);if(L){const e=[L,...t,W.current,B.current,N.current.includes("reference")||I?M:null].filter(e=>null!=e),n=f||I?ve(e,T,!T):ve(e);return()=>{n()}}},[o,M,L,f,N,q,I,T]),Y(()=>{if(o||!i(z))return;const e=m(w(z));queueMicrotask(()=>{const t=G(z),n=D.current,r=("number"==typeof n?t[n]:n.current)||z,o=h(z,e);P||o||!v||ue(r,{preventScroll:r===z})})},[o,v,z,P,G,D]),Y(()=>{if(o||!z)return;let e=!1;const t=w(z),n=m(t);let r=C.current.openEvent;function u(t){let{open:n,reason:o,event:i,nested:u}=t;n&&(r=i),"escape-key"===o&&g.domReference.current&&Pe(g.domReference.current),"hover"===o&&"mouseleave"===i.type&&(K.current=!0),"outside-press"===o&&(u?(K.current=!1,e=!0):K.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(E()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||b(i)))}Pe(n),k.on("openchange",u);const c=t.createElement("span");return c.setAttribute("tabindex","-1"),c.setAttribute("aria-hidden","true"),Object.assign(c.style,Re),U&&M&&M.insertAdjacentElement("afterend",c),()=>{k.off("openchange",u);const n=m(t),o=h(L,n)||j&&ce(j.nodesRef.current,y).some(e=>{var t;return h(null==(t=e.context)?void 0:t.elements.floating,n)});(o||r&&["click","mousedown"].includes(r.type))&&g.domReference.current&&Pe(g.domReference.current);const l="boolean"==typeof F.current?Ie()||c:F.current.current||c;queueMicrotask(()=>{F.current&&!K.current&&i(l)&&(l===n||n===t.body||o)&&l.focus({preventScroll:e}),c.remove()})}},[o,L,z,F,C,g,k,j,y,U,M]),e.useEffect(()=>{queueMicrotask(()=>{K.current=!1})},[o]),Y(()=>{if(!o&&q)return q.setFocusManagerState({modal:f,closeOnFocusOut:p,open:v,onOpenChange:R,refs:g}),()=>{q.setFocusManagerState(null)}},[o,q,f,v,R,g,p]),Y(()=>{if(o)return;if(!z)return;if("function"!=typeof MutationObserver)return;if(P)return;const e=()=>{const e=z.getAttribute("tabindex"),t=$(),n=m(w(L)),r=t.indexOf(n);-1!==r&&(H.current=r),N.current.includes("floating")||n!==g.domReference.current&&0===t.length?"0"!==e&&z.setAttribute("tabindex","0"):"-1"!==e&&z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[o,L,z,g,N,$,P]);const Q=!o&&T&&(!f||!I)&&(U||f);return e.createElement(e.Fragment,null,Q&&e.createElement(Se,{"data-type":"inside",ref:null==q?void 0:q.beforeInsideRef,onFocus:e=>{if(f){const e=G();ue("reference"===u[0]?e[0]:e[e.length-1])}else if(null!=q&&q.preserveTabOrder&&q.portalNode)if(K.current=!1,be(e,q.portalNode)){const e=ge()||M;null==e||e.focus()}else{var t;null==(t=q.beforeOutsideRef.current)||t.focus()}}}),!I&&J("start"),r,J("end"),Q&&e.createElement(Se,{"data-type":"inside",ref:null==q?void 0:q.afterInsideRef,onFocus:e=>{if(f)ue(G()[0]);else if(null!=q&&q.preserveTabOrder&&q.portalNode)if(p&&(K.current=!0),be(e,q.portalNode)){const e=ye()||M;null==e||e.focus()}else{var t;null==(t=q.afterOutsideRef.current)||t.focus()}}}))}let De=0;let Fe=()=>{};const je=e.forwardRef(function(t,n){const{lockScroll:r=!1,...o}=t;return Y(()=>{if(r)return De++,1===De&&(Fe=function(){const e=/iP(hone|ad|od)|iOS/.test(g()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var u,c;const e=(null==(u=window.visualViewport)?void 0:u.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(o-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,i))}}()),()=>{De--,0===De&&Fe()}},[r]),e.createElement("div",Z({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}),qe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},We={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Be=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function Ke(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:l,dataRef:s}=t,{enabled:v=!0,escapeKey:m=!0,outsidePress:g=!0,outsidePressEvent:y="pointerdown",referencePress:b=!1,referencePressEvent:E="pointerdown",ancestorScroll:S=!1,bubbles:A,capture:k}=n,C=ne(),O=X("function"==typeof g?g:()=>!1),M="function"==typeof g?O:g,L=e.useRef(!1),P=e.useRef(!1),{escapeKey:I,outsidePress:T}=Be(A),{escapeKey:N,outsidePress:D}=Be(k),F=e.useRef(!1),j=X(e=>{var t;if(!r||!v||!m||"Escape"!==e.key)return;if(F.current)return;const n=null==(t=s.current.floatingContext)?void 0:t.nodeId,i=C?ce(C.nodesRef.current,n):[];if(!I&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),q=X(e=>{var t;const n=()=>{var t;j(e),null==(t=x(e))||t.removeEventListener("keydown",n)};null==(t=x(e))||t.addEventListener("keydown",n)}),W=X(e=>{var t;const n=L.current;L.current=!1;const r=P.current;if(P.current=!1,"click"===y&&r)return;if(n)return;if("function"==typeof M&&!M(e))return;const c=x(e),p="["+re("inert")+"]",v=w(l.floating).querySelectorAll(p);let m=u(c)?c:null;for(;m&&!a(m);){const e=f(m);if(a(e)||!u(e))break;m=e}if(v.length&&u(c)&&!c.matches("html,body")&&!h(c,l.floating)&&Array.from(v).every(e=>!h(m,e)))return;if(i(c)&&V){const t=c.clientWidth>0&&c.scrollWidth>c.clientWidth,n=c.clientHeight>0&&c.scrollHeight>c.clientHeight;let r=n&&e.offsetX>c.clientWidth;if(n){"rtl"===d(c).direction&&(r=e.offsetX<=c.offsetWidth-c.clientWidth)}if(r||t&&e.offsetY>c.clientHeight)return}const g=null==(t=s.current.floatingContext)?void 0:t.nodeId,b=C&&ce(C.nodesRef.current,g).some(t=>{var n;return R(e,null==(n=t.context)?void 0:n.elements.floating)});if(R(e,l.floating)||R(e,l.domReference)||b)return;const E=C?ce(C.nodesRef.current,g):[];if(E.length>0){let e=!0;if(E.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}o(!1,e,"outside-press")}),B=X(e=>{var t;const n=()=>{var t;W(e),null==(t=x(e))||t.removeEventListener(y,n)};null==(t=x(e))||t.addEventListener(y,n)});e.useEffect(()=>{if(!r||!v)return;s.current.__escapeKeyBubbles=I,s.current.__outsidePressBubbles=T;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),F.current=!0}function i(){e=window.setTimeout(()=>{F.current=!1},p()?5:0)}const a=w(l.floating);m&&(a.addEventListener("keydown",N?q:j,N),a.addEventListener("compositionstart",n),a.addEventListener("compositionend",i)),M&&a.addEventListener(y,D?B:W,D);let f=[];return S&&(u(l.domReference)&&(f=c(l.domReference)),u(l.floating)&&(f=f.concat(c(l.floating))),!u(l.reference)&&l.reference&&l.reference.contextElement&&(f=f.concat(c(l.reference.contextElement)))),f=f.filter(e=>{var t;return e!==(null==(t=a.defaultView)?void 0:t.visualViewport)}),f.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{m&&(a.removeEventListener("keydown",N?q:j,N),a.removeEventListener("compositionstart",n),a.removeEventListener("compositionend",i)),M&&a.removeEventListener(y,D?B:W,D),f.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[s,l,m,M,y,r,o,S,v,I,T,j,N,q,W,D,B]),e.useEffect(()=>{L.current=!1},[M,y]);const K=e.useMemo(()=>({onKeyDown:j,[qe[E]]:e=>{b&&o(!1,e.nativeEvent,"reference-press")}}),[j,o,b,E]),V=e.useMemo(()=>({onKeyDown:j,onMouseDown(){P.current=!0},onMouseUp(){P.current=!0},[We[y]]:()=>{L.current=!0}}),[j,y]);return e.useMemo(()=>v?{reference:K,floating:V}:{},[v,K,V])}function Ve(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=Q(),u=e.useRef({}),[c]=e.useState(()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}()),l=null!=((null==(s=e.useContext(ee))?void 0:s.id)||null);var s;const[a,f]=e.useState(o.reference),d=X((e,t,n)=>{u.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:l}),null==r||r(e,t,n)}),p=e.useMemo(()=>({setPositionReference:f}),[]),v=e.useMemo(()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference}),[a,o.reference,o.floating]);return e.useMemo(()=>({dataRef:u,open:n,onOpenChange:d,elements:v,events:c,floatingId:i,refs:p}),[n,d,v,c,i,p])}function _e(t){void 0===t&&(t={});const{nodeId:n}=t,r=Ve({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[c,s]=e.useState(null),[a,f]=e.useState(null),d=(null==i?void 0:i.domReference)||c,p=e.useRef(null),v=ne();Y(()=>{d&&(p.current=d)},[d]);const m=l({...t,elements:{...i,...a&&{reference:a}}}),h=e.useCallback(e=>{const t=u(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;f(t),m.refs.setReference(t)},[m.refs]),g=e.useCallback(e=>{(u(e)||null===e)&&(p.current=e,s(e)),(u(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!u(e))&&m.refs.setReference(e)},[m.refs]),y=e.useMemo(()=>({...m.refs,setReference:g,setPositionReference:h,domReference:p}),[m.refs,g,h]),b=e.useMemo(()=>({...m.elements,domReference:d}),[m.elements,d]),E=e.useMemo(()=>({...m,...o,refs:y,elements:b,nodeId:n}),[m,y,b,n,o]);return Y(()=>{o.dataRef.current.floatingContext=E;const e=null==v?void 0:v.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),e.useMemo(()=>({...m,context:E,refs:y,elements:b}),[m,y,b,E])}const He="active",Ue="selected";function ze(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[He]:t,[Ue]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[Me]:""},...i,...t.map(t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var u;o&&[He,Ue].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(u=r.get(n))||u.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...o)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}function Xe(t){void 0===t&&(t=[]);const n=t.map(e=>null==e?void 0:e.reference),r=t.map(e=>null==e?void 0:e.floating),o=t.map(e=>null==e?void 0:e.item),i=e.useCallback(e=>ze(e,t,"reference"),n),u=e.useCallback(e=>ze(e,t,"floating"),r),c=e.useCallback(e=>ze(e,t,"item"),o);return e.useMemo(()=>({getReferenceProps:i,getFloatingProps:u,getItemProps:c}),[i,u,c])}const Ye=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Ze(e,t){return"function"==typeof e?e(t):e}function $e(t,n){void 0===n&&(n={});const{open:r,elements:{floating:o}}=t,{duration:i=250}=n,u=("number"==typeof i?i:i.close)||0,[c,l]=e.useState("unmounted"),s=function(t,n){const[r,o]=e.useState(t);return t&&!r&&o(!0),e.useEffect(()=>{if(!t&&r){const e=setTimeout(()=>o(!1),n);return()=>clearTimeout(e)}},[t,r,n]),r}(r,u);return s||"close"!==c||l("unmounted"),Y(()=>{if(o){if(r){l("initial");const e=requestAnimationFrame(()=>{l("open")});return()=>{cancelAnimationFrame(e)}}l("close")}},[r,o]),{isMounted:s,status:c}}function Ge(t,n){void 0===n&&(n={});const{initial:r={opacity:0},open:o,close:i,common:u,duration:c=250}=n,l=t.placement,s=l.split("-")[0],a=e.useMemo(()=>({side:s,placement:l}),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[v,m]=e.useState(()=>({...Ze(u,a),...Ze(r,a)})),{isMounted:h,status:g}=$e(t,{duration:c}),y=oe(r),b=oe(o),E=oe(i),w=oe(u);return Y(()=>{const e=Ze(y.current,a),t=Ze(E.current,a),n=Ze(w.current,a),r=Ze(b.current,a)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===g&&m(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===g&&m({transitionProperty:Object.keys(r).map(Ye).join(","),transitionDuration:d+"ms",...n,...r}),"close"===g){const r=t||e;m({transitionProperty:Object.keys(r).map(Ye).join(","),transitionDuration:p+"ms",...n,...r})}},[p,E,y,b,w,d,g,a]),{isMounted:h,styles:v}}export{Ce as F,Ge as a,H as b,Ke as c,Xe as d,Ne as e,Q as f,je as g,_e as u};