@yoopta/ui 6.0.0-beta.5 → 6.0.0-beta.6

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 (32) hide show
  1. package/dist/action-menu-list/utils.d.ts +1 -1
  2. package/dist/action-menu-list/utils.d.ts.map +1 -1
  3. package/dist/action-menu-list.js +1 -1
  4. package/dist/block-options/block-options.d.ts +68 -8
  5. package/dist/block-options/block-options.d.ts.map +1 -1
  6. package/dist/block-options/context.d.ts +11 -0
  7. package/dist/block-options/context.d.ts.map +1 -0
  8. package/dist/block-options/hooks.d.ts +14 -894
  9. package/dist/block-options/hooks.d.ts.map +1 -1
  10. package/dist/block-options/index.d.ts +2 -3
  11. package/dist/block-options/index.d.ts.map +1 -1
  12. package/dist/block-options.js +1 -1
  13. package/dist/chunks/floating-ui.react-33212df0.js +5 -0
  14. package/dist/chunks/{highlight-color-picker-13e8f1eb.js → highlight-color-picker-534fa3e2.js} +1 -1
  15. package/dist/chunks/{hooks-8cbb0736.js → hooks-814f49b9.js} +1 -1
  16. package/dist/chunks/{hooks-907f8ea7.js → hooks-879d4b4f.js} +1 -1
  17. package/dist/highlight-color-picker.js +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/overlay.js +1 -1
  22. package/dist/portal.js +1 -1
  23. package/dist/slash-command-menu.js +1 -1
  24. package/dist/toolbar/index.d.ts +1 -1
  25. package/dist/toolbar/index.d.ts.map +1 -1
  26. package/dist/toolbar.js +1 -1
  27. package/package.json +2 -2
  28. package/dist/block-options/store.d.ts +0 -15
  29. package/dist/block-options/store.d.ts.map +0 -1
  30. package/dist/block-options/store.test.d.ts +0 -2
  31. package/dist/block-options/store.test.d.ts.map +0 -1
  32. package/dist/chunks/floating-ui.react-0123aadf.js +0 -5
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,forwardRef as s,useRef as a,useEffect as i,useCallback as l,useMemo as c,useLayoutEffect as d,useReducer as p}from"react";import{useYooptaEditor as f,Blocks as h,getAllowedPluginsFromElement as m,getRootBlockElementType as u}from"@yoopta/editor";import{u as g,a as v,i as b,o as y,f as x,s as w,c as O,b as j}from"./chunks/floating-ui.react-0123aadf.js";import{s as k}from"./chunks/style-inject.es-e87a8d02.js";import"react-dom";const P=({children:t,className:n})=>{const r=e=>{e.stopPropagation(),e.preventDefault()};return e("div",Object.assign({tabIndex:0,role:"listbox","aria-label":"Slash commands",className:`slash-command-content ${n||""}`,onMouseDown:r,onMouseMove:r},{children:t}))};P.displayName="SlashCommand.Content";const E=r(null);function S(){const e=o(E);if(!e)throw new Error("useSlashCommandContext must be used within a SlashCommandProvider");return e}function N(){const{state:e}=S();return e}function C(){const{actionHandlers:e}=S();return e}function _(){const{filteredItems:e,groupedItems:t}=S();return{filteredItems:e,groupedItems:t}}function T(){const{refs:e,floatingStyles:t}=S();return{refs:e,floatingStyles:t}}E.displayName="SlashCommandContext";const I=({children:t,className:n})=>{const{filteredItems:r}=S();return r.length>0?null:e("div",Object.assign({className:`slash-command-empty ${n||""}`},{children:t||"No results found"}))};I.displayName="SlashCommand.Empty";const A=()=>t(n,{children:[t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↑"})),e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↓"})),e("span",{children:"Navigate"})]})),t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↵"})),e("span",{children:"Select"})]})),t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"Esc"})),e("span",{children:"Close"})]}))]}),R=({children:t,className:n,showHints:r=!0})=>e("div",Object.assign({className:`slash-command-footer ${n||""}`},{children:t||r&&e(A,{})}));R.displayName="SlashCommand.Footer";const D=({children:n,heading:r,className:o})=>t("div",Object.assign({role:"group","aria-label":r,className:`slash-command-group ${o||""}`},{children:[r&&e("div",Object.assign({className:"slash-command-group-heading"},{children:r})),n]}));D.displayName="SlashCommand.Group";const B=s(({placeholder:n="Search blocks...",className:r,showTrigger:o=!0,showEscHint:s=!0},a)=>{const{state:i,actionHandlers:l}=S();return t("div",Object.assign({className:`slash-command-input-wrapper ${r||""}`},{children:[o&&e("span",Object.assign({className:"slash-command-input-trigger"},{children:"/"})),e("input",{ref:a,type:"text",className:"slash-command-input",placeholder:n,value:i.search,onChange:e=>l.setSearch(e.target.value),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),s&&e("kbd",Object.assign({className:"slash-command-kbd"},{children:"ESC"}))]}))});B.displayName="SlashCommand.Input";const L=({children:r,value:o,title:s,description:c,icon:d,shortcut:p,disabled:f=!1,onSelect:h,className:m})=>{const{state:u,actionHandlers:g,filteredItems:v}=S(),b=a(null),y=v.findIndex(e=>e.id===o),x=y===u.selectedIndex&&-1!==y,w=-1!==y;i(()=>{x&&b.current&&b.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[x]);const O=l(()=>{f||(h&&h(),g.selectItem(y),g.executeSelected())},[f,h,g,y]),j=l(()=>{f||-1===y||g.selectItem(y)},[f,y,g]);if(!w)return null;const k=r||t(n,{children:[d&&e("div",Object.assign({className:"slash-command-item-icon"},{children:d})),t("div",Object.assign({className:"slash-command-item-content"},{children:[s&&e("div",Object.assign({className:"slash-command-item-title"},{children:s})),c&&e("div",Object.assign({className:"slash-command-item-description"},{children:c}))]})),p&&p.length>0&&e("div",Object.assign({className:"slash-command-item-shortcut"},{children:p.map(t=>e("kbd",Object.assign({className:"slash-command-kbd"},{children:t}),t))}))]});return e("button",Object.assign({ref:b,type:"button",role:"option","aria-selected":x,"aria-disabled":f,"data-selected":x,"data-disabled":f,"data-value":o,className:`slash-command-item ${m||""}`,onClick:O,onMouseEnter:j,onMouseDown:e=>e.preventDefault(),disabled:f},{children:k}))};L.displayName="SlashCommand.Item";const q=({children:t,className:n,style:r})=>e("div",Object.assign({role:"group",className:`slash-command-list ${null!=n?n:""}`,style:r},{children:t}));q.displayName="SlashCommand.List";const M=({children:t,className:n})=>e("div",Object.assign({className:`slash-command-loading ${n||""}`},{children:t||e("div",{className:"slash-command-spinner"})}));M.displayName="SlashCommand.Loading";var z={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=z.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),s=e[n],a=t[n];return z.equals(r,o)&&s>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return z.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),s=e[n],a=t[n];return z.equals(r,o)&&s<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===z.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===z.compare(e,t),isBefore:(e,t)=>-1===z.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===z.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===z.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===z.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===z.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&z.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!z.isAncestor(t,e)&&!z.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:s}=t;(z.equals(s,r)||z.endsBefore(s,r)||z.isAncestor(s,r))&&(r[s.length-1]+=1);break;case"remove_node":var{path:a}=t;if(z.equals(a,r)||z.isAncestor(a,r))return null;z.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:i,position:l}=t;z.equals(i,r)||z.endsBefore(i,r)?r[i.length-1]-=1:z.isAncestor(i,r)&&(r[i.length-1]-=1,r[i.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(z.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else z.endsBefore(c,r)?r[c.length-1]+=1:z.isAncestor(c,r)&&e[c.length]>=d&&(r[c.length-1]+=1,r[c.length]-=d);break;case"move_node":var{path:p,newPath:f}=t;if(z.equals(p,f))return r;if(z.isAncestor(p,r)||z.equals(p,r)){var h=f.slice();return z.endsBefore(p,f)&&p.length<f.length&&(h[p.length-1]-=1),h.concat(r.slice(p.length))}z.isSibling(p,f)&&(z.isAncestor(f,r)||z.equals(f,r))?z.endsBefore(p,r)?r[p.length-1]-=1:r[p.length-1]+=1:z.endsBefore(f,r)||z.equals(f,r)||z.isAncestor(f,r)?(z.endsBefore(p,r)&&(r[p.length-1]-=1),r[f.length-1]+=1):z.endsBefore(p,r)&&(z.equals(f,r)&&(r[f.length-1]+=1),r[p.length-1]-=1)}return r}};function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function V(e){var t=function(e,t){if("object"!==F(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===F(t)?t:String(t)}function H(e,t,n){return(t=V(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var $=["anchor","focus"];function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Z={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return Z.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=Z.edges(e);return t},equals:(e,t)=>pe.equals(e.anchor,t.anchor)&&pe.equals(e.focus,t.focus),surrounds(e,t){var n=Z.intersection(e,t);return!!n&&Z.equals(n,t)},includes(e,t){if(Z.isRange(t)){if(Z.includes(e,t.anchor)||Z.includes(e,t.focus))return!0;var[n,r]=Z.edges(e),[o,s]=Z.edges(t);return pe.isBefore(n,o)&&pe.isAfter(r,s)}var[a,i]=Z.edges(e),l=!1,c=!1;return pe.isPoint(t)?(l=pe.compare(t,a)>=0,c=pe.compare(t,i)<=0):(l=z.compare(t,a.path)>=0,c=z.compare(t,i.path)<=0),l&&c},intersection(e,t){var n=W(e,$),[r,o]=Z.edges(e),[s,a]=Z.edges(t),i=pe.isBefore(r,s)?s:r,l=pe.isBefore(o,a)?o:a;return pe.isBefore(l,i)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:i,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return pe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return pe.equals(t,n)},isExpanded:e=>!Z.isCollapsed(e),isForward:e=>!Z.isBackward(e),isRange:e=>se(e)&&pe.isPoint(e.anchor)&&pe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Z.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:s="inward"}=n;if("inward"===s){var a=Z.isCollapsed(e);Z.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===s?Z.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=s,o=s);var i=pe.transform(e.anchor,t,{affinity:r}),l=pe.transform(e.focus,t,{affinity:o});return i&&l?{anchor:i,focus:l}:null}},G=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!se(e)&&("function"!=typeof e.apply&&(t?ee.isNodeList(e.children):Array.isArray(e.children)))},U={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return se(e)&&ee.isNodeList(e.children,{deep:t})},isElement:G,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>U.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return G(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},X=["children"],Y=["text"];function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ee={ancestor(e,t){var n=ee.get(e,t);if(be.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(he.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of z.ancestors(t,n)){var o=[ee.ancestor(e,r),r];yield o}}()},child(e,t){if(be.isText(e))throw new Error("Cannot get the child of a text node: ".concat(he.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(he.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=ee.ancestor(e,t),{children:s}=o,a=r?s.length-1:0;r?a>=0:a<s.length;){var i=ee.child(o,a),l=t.concat(a);yield[i,l],a=r?a-1:a+1}}()},common(e,t,n){var r=z.common(t,n);return[ee.get(e,r),r]},descendant(e,t){var n=ee.get(e,t);if(le.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(he.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))U.isElement(n)&&(yield[n,r])}()},extractProps:e=>U.isAncestor(e)?W(e,X):W(e,Y),first(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=Z.edges(t),s=ee.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!Z.includes(t,n)}}),a=function(){if(!Z.includes(t,i)){var e=i[i.length-1];Pe(n,z.parent(i),t=>je(t,e,1))}z.equals(i,o.path)&&Ee(n,i,e=>{var t=e.text.slice(0,o.offset);return Q(Q({},e),{},{text:t})}),z.equals(i,r.path)&&Ee(n,i,e=>{var t=e.text.slice(r.offset);return Q(Q({},e),{},{text:t})})};for(var[,i]of s)a();return n.children},get(e,t){var n=ee.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(he.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return be.isText(e)||U.isElement(e,{deep:t})||le.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>ee.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=ee.get(e,t);if(!be.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of z.levels(t,n)){var o=ee.get(e,r);yield[o,r]}}()},matches:(e,t)=>U.isElement(e)&&U.isElementProps(t)&&U.matches(e,t)||be.isText(e)&&be.isTextProps(t)&&be.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:s}=t,a=new Set,i=[],l=e;!s||!(r?z.isBefore(i,s):z.isAfter(i,s));)if(a.has(l)||(yield[l,i]),a.has(l)||be.isText(l)||0===l.children.length||null!=n&&!1!==n([l,i])){if(0===i.length)break;if(!r){var c=z.next(i);if(ee.has(e,c)){i=c,l=ee.get(e,i);continue}}if(r&&0!==i[i.length-1])i=z.previous(i),l=ee.get(e,i);else i=z.parent(i),l=ee.get(e,i),a.add(l)}else{a.add(l);var d=r?l.children.length-1:0;z.isAncestor(i,o)&&(d=o[i.length]),i=i.concat(d),l=ee.get(e,i)}}()},parent(e,t){var n=z.parent(t),r=ee.get(e,n);if(be.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>be.isText(e)?e.text:e.children.map(ee.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))be.isText(n)&&(yield[n,r])}()}};function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re,oe={isNodeOperation:e=>oe.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!se(e))return!1;switch(e.type){case"insert_node":case"remove_node":return z.isPath(e.path)&&ee.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&z.isPath(e.path);case"merge_node":return"number"==typeof e.position&&z.isPath(e.path)&&se(e.properties);case"move_node":return z.isPath(e.path)&&z.isPath(e.newPath);case"set_node":return z.isPath(e.path)&&se(e.properties)&&se(e.newProperties);case"set_selection":return null===e.properties&&Z.isRange(e.newProperties)||null===e.newProperties&&Z.isRange(e.properties)||se(e.properties)&&se(e.newProperties);case"split_node":return z.isPath(e.path)&&"number"==typeof e.position&&se(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>oe.isOperation(e)),isSelectionOperation:e=>oe.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>oe.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ne(ne({},e),{},{type:"remove_node"});case"insert_text":return ne(ne({},e),{},{type:"remove_text"});case"merge_node":return ne(ne({},e),{},{type:"split_node",path:z.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(z.equals(t,n))return e;if(z.isSibling(n,t))return ne(ne({},e),{},{path:t,newPath:n});var r=z.transform(n,e),o=z.transform(z.next(n),e);return ne(ne({},e),{},{path:r,newPath:o});case"remove_node":return ne(ne({},e),{},{type:"insert_node"});case"remove_text":return ne(ne({},e),{},{type:"insert_text"});case"set_node":var{properties:s,newProperties:a}=e;return ne(ne({},e),{},{properties:a,newProperties:s});case"set_selection":var{properties:i,newProperties:l}=e;return ne(ne({},e),{},null==i?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:i}:{properties:l,newProperties:i});case"split_node":return ne(ne({},e),{},{type:"merge_node",path:z.next(e.path)})}}},se=e=>"object"==typeof e&&null!==e,ae=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var s=0;s<r.length;s++)if(r[s]!==o[s])return!1}else if(se(r)&&se(o)){if(!ae(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},ie=e=>e.selection?e.selection:e.children.length>0?le.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(re||(re={})),re.L,re.L,re.V,re.LV,re.LVT,re.LV,re.V,re.V,re.T,re.LVT,re.T,re.T,re.Any,re.Extend,re.ZWJ,re.Any,re.SpacingMark,re.Prepend,re.Any,re.ZWJ,re.ExtPict,re.RI,re.RI;var le={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!se(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||se(e.marks))&&(null===e.selection||Z.isRange(e.selection))&&(!t||ee.isNodeList(e.children))&&oe.isOperationList(e.operations);return n}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var pe={compare(e,t){var n=z.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===pe.compare(e,t),isBefore:(e,t)=>-1===pe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&z.equals(e.path,t.path),isPoint:e=>se(e)&&"number"==typeof e.offset&&z.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:s}=e;switch(t.type){case"insert_node":case"move_node":o=z.transform(o,t,n);break;case"insert_text":z.equals(t.path,o)&&(t.offset<s||t.offset===s&&"forward"===r)&&(s+=t.text.length);break;case"merge_node":z.equals(t.path,o)&&(s+=t.position),o=z.transform(o,t,n);break;case"remove_text":z.equals(t.path,o)&&t.offset<=s&&(s-=Math.min(s-t.offset,t.text.length));break;case"remove_node":if(z.equals(t.path,o)||z.isAncestor(t.path,o))return null;o=z.transform(o,t,n);break;case"split_node":if(z.equals(t.path,o)){if(t.position===s&&null==r)return null;(t.position<s||t.position===s&&"forward"===r)&&(s-=t.position,o=z.transform(o,t,de(de({},n),{},{affinity:"forward"})))}else o=z.transform(o,t,n);break;default:return e}return{path:o,offset:s}}},fe=void 0,he={setScrubber(e){fe=e},stringify:e=>JSON.stringify(e,fe)},me=["text"],ue=["anchor","focus","merge"];function ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ge(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var be={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return W(e,me)}return ae(r?o(e):e,r?o(t):t)},isText:e=>se(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>be.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:ve({},e)}];for(var r of t){var{anchor:o,focus:s,merge:a}=r,i=W(r,ue),[l,c]=Z.edges(r),d=[],p=0,f=l.offset,h=c.offset,m=null!=a?a:Object.assign;for(var{leaf:u}of n){var{length:g}=u.text,v=p;if(p+=g,f<=v&&p<=h)m(u,i),d.push({leaf:u});else if(f!==h&&(f===p||h===v)||f>p||h<v||h===v&&0!==v)d.push({leaf:u});else{var b=u,y=void 0,x=void 0;if(h<p){var w=h-v;x={leaf:ve(ve({},b),{},{text:b.text.slice(w)})},b=ve(ve({},b),{},{text:b.text.slice(0,w)})}if(f>v){var O=f-v;y={leaf:ve(ve({},b),{},{text:b.text.slice(0,O)})},b=ve(ve({},b),{},{text:b.text.slice(O)})}m(b,i),y&&d.push(y),d.push({leaf:b}),x&&d.push(x)}}n=d}if(n.length>1){var j=0;for(var[k,P]of n.entries()){var E=j,S=E+P.leaf.text.length,N={start:E,end:S};0===k&&(N.isFirst=!0),k===n.length-1&&(N.isLast=!0),P.position=N,j=S}}return n}};function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var we=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},Oe=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),s=3;s<r;s++)o[s-3]=arguments[s];return[...e.slice(0,t),...o,...e.slice(t+n)]},je=Oe,ke=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=ee.get(e,t),o=t.slice(),s=n(r);o.length>1;){var a=o.pop(),i=ee.get(e,o);s=xe(xe({},i),{},{children:Oe(i.children,a,1,s)})}var l=o.pop();e.children=Oe(e.children,l,1,s)},Pe=(e,t,n)=>{0===t.length?e.children=n(e.children):ke(e,t,e=>{if(be.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(he.stringify(e)));return xe(xe({},e),{},{children:n(e.children)})})},Ee=(e,t,n)=>ke(e,t,e=>{if(!be.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(e)));return n(e)});function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ce={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;Pe(e,z.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return we(e,t,o)}),n=!0;break;case"insert_text":var{path:s,offset:a,text:i}=t;if(0===i.length)break;Ee(e,s,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return Ne(Ne({},e),{},{text:t+i+n})}),n=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],d=z.previous(l),p=d[d.length-1];Pe(e,z.parent(l),e=>{var t,n=e[c],r=e[p];if(be.isText(n)&&be.isText(r))t=Ne(Ne({},r),{},{text:r.text+n.text});else{if(be.isText(n)||be.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(he.stringify(n)," ").concat(he.stringify(r)));t=Ne(Ne({},r),{},{children:r.children.concat(n.children)})}return Oe(e,p,2,t)}),n=!0;break;case"move_node":var{path:f,newPath:h}=t,m=f[f.length-1];if(z.isAncestor(f,h))throw new Error("Cannot move a path [".concat(f,"] to new path [").concat(h,"] because the destination is inside itself."));var u=ee.get(e,f);Pe(e,z.parent(f),e=>je(e,m,1));var g=z.transform(f,t),v=g[g.length-1];Pe(e,z.parent(g),e=>we(e,v,u)),n=!0;break;case"remove_node":var{path:b}=t,y=b[b.length-1];if(Pe(e,z.parent(b),e=>je(e,y,1)),e.selection){var x=Ne({},e.selection);for(var[w,O]of Z.points(x)){var j=pe.transform(w,t);if(null!=x&&null!=j)x[O]=j;else{var k=void 0,P=void 0;for(var[E,S]of ee.texts(e)){if(-1!==z.compare(S,b)){P=[E,S];break}k=[E,S]}var N=!1;k&&P&&(N=!z.isSibling(k[1],b)&&(!!z.equals(P[1],b)||z.common(k[1],b).length<z.common(P[1],b).length)),k&&!N?x[O]={path:k[1],offset:k[0].text.length}:P?x[O]={path:P[1],offset:0}:x=null}}x&&Z.equals(x,e.selection)||(e.selection=x)}break;case"remove_text":var{path:C,offset:_,text:T}=t;if(0===T.length)break;Ee(e,C,e=>{var t=e.text.slice(0,_),n=e.text.slice(_+T.length);return Ne(Ne({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:I,properties:A,newProperties:R}=t;if(0===I.length)throw new Error("Cannot set properties on the root node!");ke(e,I,e=>{var t=Ne({},e);for(var n in R){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=R[n];null==r?delete t[n]:t[n]=r}for(var o in A)R.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:D}=t;if(null==D){e.selection=null;break}if(null==e.selection){if(!Z.isRange(D))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(he.stringify(D)," when there is no current selection."));e.selection=Ne({},D);break}var B=Ne({},e.selection);for(var L in D){var q=D[L];if(null==q){if("anchor"===L||"focus"===L)throw new Error('Cannot remove the "'.concat(L,'" selection property'));delete B[L]}else B[L]=q}e.selection=B;break;case"split_node":var{path:M,position:F,properties:V}=t,H=M[M.length-1];if(0===M.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(M,"] because the root node cannot be split."));Pe(e,z.parent(M),e=>{var t,n,r=e[H];if(be.isText(r)){var o=r.text.slice(0,F),s=r.text.slice(F);t=Ne(Ne({},r),{},{text:o}),n=Ne(Ne({},V),{},{text:s})}else{var a=r.children.slice(0,F),i=r.children.slice(F);t=Ne(Ne({},r),{},{children:a}),n=Ne(Ne({},V),{},{children:i})}return Oe(e,H,1,t,n)}),n=!0}if(n&&e.selection){var W=Ne({},e.selection);for(var[$,J]of Z.points(W))W[J]=pe.transform($,t);Z.equals(W,e.selection)||(e.selection=W)}}},_e={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Te={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Ie={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};le.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=ie(e)}=n;if(z.isPath(o)&&(o=le.range(e,o)),Z.isRange(o))if(Z.isCollapsed(o))o=o.anchor;else{var s=Z.end(o);if(!r&&le.void(e,{at:s}))return;var a=Z.start(o),i=le.pointRef(e,a),l=le.pointRef(e,s);De.delete(e,{at:o,voids:r});var c=i.unref(),d=l.unref();o=c||d,De.setSelection(e,{anchor:o,focus:o})}if(!(!r&&le.void(e,{at:o})||le.elementReadOnly(e,{at:o}))){var{path:p,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:p,offset:f,text:t})}})}};function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var De=Re(Re(Re(Re({},Ce),_e),Te),Ie);const Be="ArrowUp",Le="ArrowDown",qe="Enter",Me="Escape";function ze(e){return e.toLowerCase().trim()}function Fe(e,t){var n,r,o;if(!t)return 0;const s=ze(t),a=ze(e.title),i=ze(e.id);return a===s?100:a.startsWith(s)?80:i.startsWith(s)?70:(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>ze(e)===s))?60:a.includes(s)?50:(null===(r=e.keywords)||void 0===r?void 0:r.some(e=>ze(e).startsWith(s)))?40:(null===(o=e.keywords)||void 0===o?void 0:o.some(e=>ze(e).includes(s)))?30:e.description&&ze(e.description).includes(s)?20:10}function Ve({items:e,search:t}){const n=c(()=>{const n=e.filter(e=>!e.disabled&&function(e,t){var n;if(!t)return!0;const r=ze(t);return!!(ze(e.title).includes(r)||ze(e.id).includes(r)||e.description&&ze(e.description).includes(r)||(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>ze(e).includes(r))))}(e,t));return t&&n.sort((e,n)=>Fe(n,t)-Fe(e,t)),n},[e,t]),r=c(()=>{const e=new Map;return n.forEach(t=>{const n=t.group||"default",r=e.get(n)||[];e.set(n,[...r,t])}),e},[n]);return{filteredItems:n,groupedItems:r,isEmpty:0===n.length}}const He="undefined"!=typeof window?d:i;const We={isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null};function $e(e,t){switch(t.type){case"OPEN":return Object.assign(Object.assign({},e),{isOpen:!0,search:"",selectedIndex:0,virtualElement:t.virtualElement,floatingContext:t.floatingContext});case"CLOSE":return Object.assign(Object.assign({},e),{isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null});case"SET_SEARCH":return Object.assign(Object.assign({},e),{search:t.search,selectedIndex:0});case"SET_SELECTED_INDEX":return Object.assign(Object.assign({},e),{selectedIndex:t.index});case"RESET_SELECTION":return Object.assign(Object.assign({},e),{selectedIndex:0});default:return e}}function Je({items:e,trigger:t="/",onSelect:n}){const r=f(),[o,s]=p($e,We),a=c(()=>{if(!o.isOpen)return e;let t=null;if("number"==typeof r.path.current){const e=h.getBlockSlate(r,{at:r.path.current});e&&(t=m(r,e))}return t&&t.length>0?t.map(e=>{var t,n;const o=null===(t=r.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(n=null==o?void 0:o.title)&&void 0!==n?n:e,description:null==o?void 0:o.description,icon:null==o?void 0:o.icon}}):e},[e,o.isOpen,r]),{filteredItems:d,groupedItems:u,isEmpty:k}=Ve({items:a,search:o.search}),{refs:P,floatingStyles:E,floatingContext:S}=function({isOpen:e,virtualElement:t}){const{refs:n,floatingStyles:r,context:o,update:s}=g({open:e,placement:"bottom-start",whileElementsMounted:v,middleware:[b(),y(10),x({fallbackPlacements:["top-start","top","bottom"],padding:10,crossAxis:!1,fallbackStrategy:"bestFit"}),w({padding:10}),O({apply({availableHeight:e,elements:t}){Object.assign(t.floating.style,{maxHeight:`${Math.max(200,e-20)}px`})},padding:10})],strategy:"fixed"});return He(()=>{t&&(n.setReference(t),s())},[n,e,t,s]),{refs:n,floatingStyles:r,floatingContext:o}}({isOpen:o.isOpen,virtualElement:o.virtualElement}),{isMounted:N,styles:C}=j(S,{duration:100}),_=l((e,t)=>{s({type:"OPEN",virtualElement:e,floatingContext:t})},[]),T=l(()=>{s({type:"CLOSE"})},[]),I=l(e=>{s({type:"SET_SEARCH",search:e})},[]),A=e=>{s({type:"SET_SELECTED_INDEX",index:e})},R=()=>{const e=d[o.selectedIndex];e&&(e.onSelect&&e.onSelect(),n?n(e):r.toggleBlock(e.id,{scope:"auto",focus:!0,preserveContent:!1}),T())};i(()=>{var e,n;if("number"!=typeof r.path.current)return;if(!h.getBlock(r,{at:r.path.current}))return;const s=r.refElement;if(!s)return;const a=e=>{if(e.isComposing)return;const t=h.getBlockSlate(r,{at:r.path.current});if(!(null==t?void 0:t.selection))return;if(s.contains(e.target)){if(function(e){return function(e){return"/"===e.key||191===e.keyCode||191===e.which||"Slash"===e.code||"/"===e.key||"."===e.key&&e.shiftKey}(e)}(e)){const e=z.parent(t.selection.anchor.path),n=le.string(t,e);if(le.isStart(t,t.selection.anchor,t.selection.focus)&&0===n.trim().length){const e=function(){const e=window.getSelection();if(!e||0===e.rangeCount)return null;const t=e.getRangeAt(0),n=t.getBoundingClientRect(),r=t.getClientRects();return{getBoundingClientRect:()=>n,getClientRects:()=>r}}();e&&_(e,S)}}o.isOpen&&(e.key===Le?(e.preventDefault(),e.stopPropagation(),A(o.selectedIndex===d.length-1?0:o.selectedIndex+1)):e.key===Be?(e.preventDefault(),e.stopPropagation(),A(0===o.selectedIndex?d.length-1:o.selectedIndex-1)):e.key===qe?(e.preventDefault(),e.stopPropagation(),R()):e.key===Me&&(e.preventDefault(),e.stopPropagation(),T()))}},i=e=>{if(e.isComposing)return;if(!o.isOpen)return;if(e.key===Le||e.key===Be)return;const n=h.getBlockSlate(r,{at:r.path.current});if(!(null==n?void 0:n.selection))return;const s=z.parent(n.selection.anchor.path),a=le.string(n,s);if(0===a.length)return void T();const i=a.replace(t,"").trim();I(i)};return null===(e=r.refElement)||void 0===e||e.addEventListener("keydown",a),null===(n=r.refElement)||void 0===n||n.addEventListener("keyup",i),()=>{var e,t;null===(e=r.refElement)||void 0===e||e.removeEventListener("keydown",a),null===(t=r.refElement)||void 0===t||t.removeEventListener("keyup",i)}},[r.path.current,o.isOpen,o.selectedIndex,P.setReference,t,_,T,I,d.length]),i(()=>{if(!o.isOpen)return;const e=e=>{var t,n;const r=e.target;(null===(n=null===(t=P.floating)||void 0===t?void 0:t.current)||void 0===n?void 0:n.contains(r))||T()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[o.isOpen,T,P.floating]),i(()=>{if(!o.isOpen||!k||0===o.search.length)return;const e=setTimeout(()=>{k&&T()},2e3);return()=>clearTimeout(e)},[o.isOpen,k,o.search,T]),i(()=>{if(!o.isOpen)return;const e=document.body.style.overflow,t=document.body.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",n>0&&(document.body.style.paddingRight=`${n}px`),()=>{document.body.style.overflow=e,document.body.style.paddingRight=t}},[o.isOpen]);return{refs:P,state:o,items:e,isEmpty:k,actionHandlers:{open:_,close:T,setSearch:I,selectItem:A,executeSelected:R},groupedItems:u,filteredItems:d,floatingStyles:E,transitionStyles:C,isMounted:N}}k('.slash-command-root{--slash-command-bg:#fff;--slash-command-bg-hover:#f4f4f5;--slash-command-bg-selected:#f4f4f5;--slash-command-border:#e4e4e7;--slash-command-border-radius:.375rem;--slash-command-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--slash-command-text:#18181b;--slash-command-text-muted:#71717a;--slash-command-text-disabled:#a1a1aa;--slash-command-accent:#3b82f6;--slash-command-item-radius:8px;--slash-command-icon-bg:#fff;--slash-command-icon-border:#e4e4e7;--slash-command-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;--slash-command-font-mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace}.dark .slash-command-root,.slash-command-root[data-theme=dark]{--slash-command-bg:#18181b;--slash-command-bg-hover:#27272a;--slash-command-bg-selected:#27272a;--slash-command-border:#3f3f46;--slash-command-text:#fafafa;--slash-command-text-muted:#a1a1aa;--slash-command-text-disabled:#52525b;--slash-command-icon-bg:#27272a;--slash-command-icon-border:#3f3f46}.slash-command-content{animation:slash-command-in .15s ease-out;background-color:var(--slash-command-bg);border:1px solid var(--slash-command-border);border-radius:var(--slash-command-border-radius);box-shadow:var(--slash-command-shadow);display:flex;flex-direction:column;font-family:var(--slash-command-font-family);max-height:400px;overflow:hidden;width:300px;z-index:9999}@keyframes slash-command-in{0%{opacity:0;transform:translateY(-8px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}.slash-command-input-wrapper{align-items:center;border-bottom:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:8px;padding:12px 14px}.slash-command-input-trigger{color:var(--slash-command-text-muted);font-family:var(--slash-command-font-mono);font-size:14px;font-weight:500;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-input{background-color:transparent;border:none;color:var(--slash-command-text);flex:1;font-family:var(--slash-command-font-family);font-size:14px;min-width:0;outline:none}.slash-command-input::-moz-placeholder{color:var(--slash-command-text-muted)}.slash-command-input::placeholder{color:var(--slash-command-text-muted)}.slash-command-kbd{align-items:center;background-color:var(--slash-command-bg-hover);border:1px solid var(--slash-command-border);border-radius:4px;color:var(--slash-command-text-muted);display:inline-flex;font-family:var(--slash-command-font-family);font-size:10px;font-weight:500;justify-content:center;padding:2px 6px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-list{display:flex;flex:1;flex-direction:column;gap:2px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:.5rem .25rem}.slash-command-list::-webkit-scrollbar{width:6px}.slash-command-list::-webkit-scrollbar-track{background:transparent}.slash-command-list::-webkit-scrollbar-thumb{background-color:var(--slash-command-border);border-radius:3px}.slash-command-list::-webkit-scrollbar-thumb:hover{background-color:var(--slash-command-text-muted)}.slash-command-group{margin-bottom:8px}.slash-command-group:last-child{margin-bottom:0}.slash-command-group-heading{color:var(--slash-command-text-muted);font-size:11px;font-weight:600;letter-spacing:.05em;padding:8px 12px 6px;text-transform:uppercase;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-item{align-items:center;background-color:transparent;border:none;border-radius:var(--slash-command-item-radius);cursor:pointer;display:flex;font-family:var(--slash-command-font-family);gap:12px;outline:none;padding:4px 6px;text-align:left;transition:background-color .1s ease;width:100%}.slash-command-item:hover,.slash-command-item[data-selected=true]{background-color:var(--slash-command-bg-selected)}.slash-command-item:focus-visible{outline:2px solid var(--slash-command-accent);outline-offset:-2px}.slash-command-item[data-disabled=true]{cursor:not-allowed;opacity:.5;pointer-events:none}.slash-command-item-icon{align-items:center;background-color:var(--slash-command-icon-bg);border:1px solid var(--slash-command-icon-border);border-radius:8px;color:var(--slash-command-text-muted);display:flex;flex-shrink:0;height:40px;justify-content:center;transition:border-color .1s ease,box-shadow .1s ease;width:40px}.slash-command-item[data-selected=true] .slash-command-item-icon{border-color:var(--slash-command-text-muted);box-shadow:0 1px 3px rgba(0,0,0,.06)}.slash-command-item-icon svg{height:20px;width:20px}.slash-command-item-content{flex:1;min-width:0}.slash-command-item-title{color:var(--slash-command-text);font-size:14px;font-weight:500}.slash-command-item-description,.slash-command-item-title{line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slash-command-item-description{color:var(--slash-command-text-muted);font-size:12px;margin-top:1px}.slash-command-item-shortcut{align-items:center;display:flex;flex-shrink:0;gap:4px}.slash-command-empty{align-items:center;color:var(--slash-command-text-muted);display:flex;flex-direction:column;font-size:14px;justify-content:center;padding:32px 16px;text-align:center}.slash-command-empty-icon{margin-bottom:8px;opacity:.5}.slash-command-separator{background-color:var(--slash-command-border);height:1px;margin:8px 12px}.slash-command-footer{align-items:center;background-color:var(--slash-command-bg-hover);border-top:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:16px;padding:8px 14px}.slash-command-footer-hint{align-items:center;color:var(--slash-command-text-muted);display:flex;font-size:11px;gap:4px}.slash-command-loading{align-items:center;display:flex;justify-content:center;padding:24px}.slash-command-spinner{animation:slash-command-spin .6s linear infinite;border:2px solid var(--slash-command-border);border-radius:50%;border-top-color:var(--slash-command-accent);height:20px;width:20px}@keyframes slash-command-spin{to{transform:rotate(1turn)}}');const Ze=({children:t,items:n,trigger:r="/",onSelect:o,className:s})=>{const a=f(),i=c(()=>{if(Array.isArray(n)&&n.length>0)return n;return Object.keys(a.plugins).filter(e=>{var t,n;const r=u(a.plugins[e].elements),o=r?a.plugins[e].elements[r]:void 0;return"inline"!==(null===(t=null==o?void 0:o.props)||void 0===t?void 0:t.nodeType)&&"inlineVoid"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}).map(e=>{var t,n;const r=null===(t=a.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(n=null==r?void 0:r.title)&&void 0!==n?n:e,description:null==r?void 0:r.description,icon:null==r?void 0:r.icon}})},[n,a]),{state:l,actionHandlers:d,filteredItems:p,groupedItems:h,refs:m,floatingStyles:g,transitionStyles:v,isMounted:b}=Je({items:i,trigger:r,onSelect:o}),y=c(()=>({state:l,actionHandlers:d,items:i,filteredItems:p,groupedItems:h,refs:m,floatingStyles:g}),[l,d,i,p,h,m,g]),x=Object.assign(Object.assign({},g),v),w="function"==typeof t?t({groupedItems:h,items:i}):t;return e(E.Provider,Object.assign({value:y},{children:e("div",Object.assign({ref:m.setFloating,style:x,className:`slash-command-root ${null!=s?s:""}`},{children:b?w:null}))}))};Ze.displayName="SlashCommand.Root";const Ge=({className:t})=>e("div",{role:"separator","aria-orientation":"horizontal",className:`slash-command-separator ${t||""}`});Ge.displayName="SlashCommand.Separator";const Ue=Object.assign(Ze,{Root:Ze,Content:P,Input:B,List:q,Group:D,Item:L,Empty:I,Separator:Ge,Footer:R,Loading:M});export{P as SlashCommandContent,E as SlashCommandContext,I as SlashCommandEmpty,R as SlashCommandFooter,D as SlashCommandGroup,B as SlashCommandInput,L as SlashCommandItem,q as SlashCommandList,M as SlashCommandLoading,Ue as SlashCommandMenu,Ze as SlashCommandRoot,Ge as SlashCommandSeparator,Je as useSlashCommand,C as useSlashCommandActions,S as useSlashCommandContext,_ as useSlashCommandItems,T as useSlashCommandRefs,N as useSlashCommandState};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,forwardRef as s,useRef as a,useEffect as i,useCallback as l,useMemo as c,useLayoutEffect as d,useReducer as p}from"react";import{useYooptaEditor as f,Blocks as h,getAllowedPluginsFromElement as m,getRootBlockElementType as u}from"@yoopta/editor";import{u as g,a as v,i as b,o as y,f as x,s as w,c as O,b as j}from"./chunks/floating-ui.react-33212df0.js";import{s as k}from"./chunks/style-inject.es-e87a8d02.js";import"react-dom";const P=({children:t,className:n})=>{const r=e=>{e.stopPropagation(),e.preventDefault()};return e("div",Object.assign({tabIndex:0,role:"listbox","aria-label":"Slash commands",className:`slash-command-content ${n||""}`,onMouseDown:r,onMouseMove:r},{children:t}))};P.displayName="SlashCommand.Content";const E=r(null);function S(){const e=o(E);if(!e)throw new Error("useSlashCommandContext must be used within a SlashCommandProvider");return e}function N(){const{state:e}=S();return e}function C(){const{actionHandlers:e}=S();return e}function _(){const{filteredItems:e,groupedItems:t}=S();return{filteredItems:e,groupedItems:t}}function T(){const{refs:e,floatingStyles:t}=S();return{refs:e,floatingStyles:t}}E.displayName="SlashCommandContext";const I=({children:t,className:n})=>{const{filteredItems:r}=S();return r.length>0?null:e("div",Object.assign({className:`slash-command-empty ${n||""}`},{children:t||"No results found"}))};I.displayName="SlashCommand.Empty";const A=()=>t(n,{children:[t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↑"})),e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↓"})),e("span",{children:"Navigate"})]})),t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↵"})),e("span",{children:"Select"})]})),t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"Esc"})),e("span",{children:"Close"})]}))]}),R=({children:t,className:n,showHints:r=!0})=>e("div",Object.assign({className:`slash-command-footer ${n||""}`},{children:t||r&&e(A,{})}));R.displayName="SlashCommand.Footer";const D=({children:n,heading:r,className:o})=>t("div",Object.assign({role:"group","aria-label":r,className:`slash-command-group ${o||""}`},{children:[r&&e("div",Object.assign({className:"slash-command-group-heading"},{children:r})),n]}));D.displayName="SlashCommand.Group";const B=s(({placeholder:n="Search blocks...",className:r,showTrigger:o=!0,showEscHint:s=!0},a)=>{const{state:i,actionHandlers:l}=S();return t("div",Object.assign({className:`slash-command-input-wrapper ${r||""}`},{children:[o&&e("span",Object.assign({className:"slash-command-input-trigger"},{children:"/"})),e("input",{ref:a,type:"text",className:"slash-command-input",placeholder:n,value:i.search,onChange:e=>l.setSearch(e.target.value),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),s&&e("kbd",Object.assign({className:"slash-command-kbd"},{children:"ESC"}))]}))});B.displayName="SlashCommand.Input";const L=({children:r,value:o,title:s,description:c,icon:d,shortcut:p,disabled:f=!1,onSelect:h,className:m})=>{const{state:u,actionHandlers:g,filteredItems:v}=S(),b=a(null),y=v.findIndex(e=>e.id===o),x=y===u.selectedIndex&&-1!==y,w=-1!==y;i(()=>{x&&b.current&&b.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[x]);const O=l(()=>{f||(h&&h(),g.selectItem(y),g.executeSelected())},[f,h,g,y]),j=l(()=>{f||-1===y||g.selectItem(y)},[f,y,g]);if(!w)return null;const k=r||t(n,{children:[d&&e("div",Object.assign({className:"slash-command-item-icon"},{children:d})),t("div",Object.assign({className:"slash-command-item-content"},{children:[s&&e("div",Object.assign({className:"slash-command-item-title"},{children:s})),c&&e("div",Object.assign({className:"slash-command-item-description"},{children:c}))]})),p&&p.length>0&&e("div",Object.assign({className:"slash-command-item-shortcut"},{children:p.map(t=>e("kbd",Object.assign({className:"slash-command-kbd"},{children:t}),t))}))]});return e("button",Object.assign({ref:b,type:"button",role:"option","aria-selected":x,"aria-disabled":f,"data-selected":x,"data-disabled":f,"data-value":o,className:`slash-command-item ${m||""}`,onClick:O,onMouseEnter:j,onMouseDown:e=>e.preventDefault(),disabled:f},{children:k}))};L.displayName="SlashCommand.Item";const q=({children:t,className:n,style:r})=>e("div",Object.assign({role:"group",className:`slash-command-list ${null!=n?n:""}`,style:r},{children:t}));q.displayName="SlashCommand.List";const M=({children:t,className:n})=>e("div",Object.assign({className:`slash-command-loading ${n||""}`},{children:t||e("div",{className:"slash-command-spinner"})}));M.displayName="SlashCommand.Loading";var z={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=z.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),s=e[n],a=t[n];return z.equals(r,o)&&s>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return z.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),s=e[n],a=t[n];return z.equals(r,o)&&s<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===z.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===z.compare(e,t),isBefore:(e,t)=>-1===z.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===z.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===z.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===z.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===z.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&z.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!z.isAncestor(t,e)&&!z.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:s}=t;(z.equals(s,r)||z.endsBefore(s,r)||z.isAncestor(s,r))&&(r[s.length-1]+=1);break;case"remove_node":var{path:a}=t;if(z.equals(a,r)||z.isAncestor(a,r))return null;z.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:i,position:l}=t;z.equals(i,r)||z.endsBefore(i,r)?r[i.length-1]-=1:z.isAncestor(i,r)&&(r[i.length-1]-=1,r[i.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(z.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else z.endsBefore(c,r)?r[c.length-1]+=1:z.isAncestor(c,r)&&e[c.length]>=d&&(r[c.length-1]+=1,r[c.length]-=d);break;case"move_node":var{path:p,newPath:f}=t;if(z.equals(p,f))return r;if(z.isAncestor(p,r)||z.equals(p,r)){var h=f.slice();return z.endsBefore(p,f)&&p.length<f.length&&(h[p.length-1]-=1),h.concat(r.slice(p.length))}z.isSibling(p,f)&&(z.isAncestor(f,r)||z.equals(f,r))?z.endsBefore(p,r)?r[p.length-1]-=1:r[p.length-1]+=1:z.endsBefore(f,r)||z.equals(f,r)||z.isAncestor(f,r)?(z.endsBefore(p,r)&&(r[p.length-1]-=1),r[f.length-1]+=1):z.endsBefore(p,r)&&(z.equals(f,r)&&(r[f.length-1]+=1),r[p.length-1]-=1)}return r}};function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function V(e){var t=function(e,t){if("object"!==F(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===F(t)?t:String(t)}function H(e,t,n){return(t=V(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var $=["anchor","focus"];function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Z={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return Z.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=Z.edges(e);return t},equals:(e,t)=>pe.equals(e.anchor,t.anchor)&&pe.equals(e.focus,t.focus),surrounds(e,t){var n=Z.intersection(e,t);return!!n&&Z.equals(n,t)},includes(e,t){if(Z.isRange(t)){if(Z.includes(e,t.anchor)||Z.includes(e,t.focus))return!0;var[n,r]=Z.edges(e),[o,s]=Z.edges(t);return pe.isBefore(n,o)&&pe.isAfter(r,s)}var[a,i]=Z.edges(e),l=!1,c=!1;return pe.isPoint(t)?(l=pe.compare(t,a)>=0,c=pe.compare(t,i)<=0):(l=z.compare(t,a.path)>=0,c=z.compare(t,i.path)<=0),l&&c},intersection(e,t){var n=W(e,$),[r,o]=Z.edges(e),[s,a]=Z.edges(t),i=pe.isBefore(r,s)?s:r,l=pe.isBefore(o,a)?o:a;return pe.isBefore(l,i)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:i,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return pe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return pe.equals(t,n)},isExpanded:e=>!Z.isCollapsed(e),isForward:e=>!Z.isBackward(e),isRange:e=>se(e)&&pe.isPoint(e.anchor)&&pe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Z.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:s="inward"}=n;if("inward"===s){var a=Z.isCollapsed(e);Z.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===s?Z.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=s,o=s);var i=pe.transform(e.anchor,t,{affinity:r}),l=pe.transform(e.focus,t,{affinity:o});return i&&l?{anchor:i,focus:l}:null}},G=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!se(e)&&("function"!=typeof e.apply&&(t?ee.isNodeList(e.children):Array.isArray(e.children)))},U={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return se(e)&&ee.isNodeList(e.children,{deep:t})},isElement:G,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>U.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return G(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},X=["children"],Y=["text"];function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ee={ancestor(e,t){var n=ee.get(e,t);if(be.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(he.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of z.ancestors(t,n)){var o=[ee.ancestor(e,r),r];yield o}}()},child(e,t){if(be.isText(e))throw new Error("Cannot get the child of a text node: ".concat(he.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(he.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=ee.ancestor(e,t),{children:s}=o,a=r?s.length-1:0;r?a>=0:a<s.length;){var i=ee.child(o,a),l=t.concat(a);yield[i,l],a=r?a-1:a+1}}()},common(e,t,n){var r=z.common(t,n);return[ee.get(e,r),r]},descendant(e,t){var n=ee.get(e,t);if(le.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(he.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))U.isElement(n)&&(yield[n,r])}()},extractProps:e=>U.isAncestor(e)?W(e,X):W(e,Y),first(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=Z.edges(t),s=ee.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!Z.includes(t,n)}}),a=function(){if(!Z.includes(t,i)){var e=i[i.length-1];Pe(n,z.parent(i),t=>je(t,e,1))}z.equals(i,o.path)&&Ee(n,i,e=>{var t=e.text.slice(0,o.offset);return Q(Q({},e),{},{text:t})}),z.equals(i,r.path)&&Ee(n,i,e=>{var t=e.text.slice(r.offset);return Q(Q({},e),{},{text:t})})};for(var[,i]of s)a();return n.children},get(e,t){var n=ee.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(he.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return be.isText(e)||U.isElement(e,{deep:t})||le.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>ee.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=ee.get(e,t);if(!be.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of z.levels(t,n)){var o=ee.get(e,r);yield[o,r]}}()},matches:(e,t)=>U.isElement(e)&&U.isElementProps(t)&&U.matches(e,t)||be.isText(e)&&be.isTextProps(t)&&be.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:s}=t,a=new Set,i=[],l=e;!s||!(r?z.isBefore(i,s):z.isAfter(i,s));)if(a.has(l)||(yield[l,i]),a.has(l)||be.isText(l)||0===l.children.length||null!=n&&!1!==n([l,i])){if(0===i.length)break;if(!r){var c=z.next(i);if(ee.has(e,c)){i=c,l=ee.get(e,i);continue}}if(r&&0!==i[i.length-1])i=z.previous(i),l=ee.get(e,i);else i=z.parent(i),l=ee.get(e,i),a.add(l)}else{a.add(l);var d=r?l.children.length-1:0;z.isAncestor(i,o)&&(d=o[i.length]),i=i.concat(d),l=ee.get(e,i)}}()},parent(e,t){var n=z.parent(t),r=ee.get(e,n);if(be.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>be.isText(e)?e.text:e.children.map(ee.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))be.isText(n)&&(yield[n,r])}()}};function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re,oe={isNodeOperation:e=>oe.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!se(e))return!1;switch(e.type){case"insert_node":case"remove_node":return z.isPath(e.path)&&ee.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&z.isPath(e.path);case"merge_node":return"number"==typeof e.position&&z.isPath(e.path)&&se(e.properties);case"move_node":return z.isPath(e.path)&&z.isPath(e.newPath);case"set_node":return z.isPath(e.path)&&se(e.properties)&&se(e.newProperties);case"set_selection":return null===e.properties&&Z.isRange(e.newProperties)||null===e.newProperties&&Z.isRange(e.properties)||se(e.properties)&&se(e.newProperties);case"split_node":return z.isPath(e.path)&&"number"==typeof e.position&&se(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>oe.isOperation(e)),isSelectionOperation:e=>oe.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>oe.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ne(ne({},e),{},{type:"remove_node"});case"insert_text":return ne(ne({},e),{},{type:"remove_text"});case"merge_node":return ne(ne({},e),{},{type:"split_node",path:z.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(z.equals(t,n))return e;if(z.isSibling(n,t))return ne(ne({},e),{},{path:t,newPath:n});var r=z.transform(n,e),o=z.transform(z.next(n),e);return ne(ne({},e),{},{path:r,newPath:o});case"remove_node":return ne(ne({},e),{},{type:"insert_node"});case"remove_text":return ne(ne({},e),{},{type:"insert_text"});case"set_node":var{properties:s,newProperties:a}=e;return ne(ne({},e),{},{properties:a,newProperties:s});case"set_selection":var{properties:i,newProperties:l}=e;return ne(ne({},e),{},null==i?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:i}:{properties:l,newProperties:i});case"split_node":return ne(ne({},e),{},{type:"merge_node",path:z.next(e.path)})}}},se=e=>"object"==typeof e&&null!==e,ae=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var s=0;s<r.length;s++)if(r[s]!==o[s])return!1}else if(se(r)&&se(o)){if(!ae(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},ie=e=>e.selection?e.selection:e.children.length>0?le.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(re||(re={})),re.L,re.L,re.V,re.LV,re.LVT,re.LV,re.V,re.V,re.T,re.LVT,re.T,re.T,re.Any,re.Extend,re.ZWJ,re.Any,re.SpacingMark,re.Prepend,re.Any,re.ZWJ,re.ExtPict,re.RI,re.RI;var le={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!se(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||se(e.marks))&&(null===e.selection||Z.isRange(e.selection))&&(!t||ee.isNodeList(e.children))&&oe.isOperationList(e.operations);return n}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var pe={compare(e,t){var n=z.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===pe.compare(e,t),isBefore:(e,t)=>-1===pe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&z.equals(e.path,t.path),isPoint:e=>se(e)&&"number"==typeof e.offset&&z.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:s}=e;switch(t.type){case"insert_node":case"move_node":o=z.transform(o,t,n);break;case"insert_text":z.equals(t.path,o)&&(t.offset<s||t.offset===s&&"forward"===r)&&(s+=t.text.length);break;case"merge_node":z.equals(t.path,o)&&(s+=t.position),o=z.transform(o,t,n);break;case"remove_text":z.equals(t.path,o)&&t.offset<=s&&(s-=Math.min(s-t.offset,t.text.length));break;case"remove_node":if(z.equals(t.path,o)||z.isAncestor(t.path,o))return null;o=z.transform(o,t,n);break;case"split_node":if(z.equals(t.path,o)){if(t.position===s&&null==r)return null;(t.position<s||t.position===s&&"forward"===r)&&(s-=t.position,o=z.transform(o,t,de(de({},n),{},{affinity:"forward"})))}else o=z.transform(o,t,n);break;default:return e}return{path:o,offset:s}}},fe=void 0,he={setScrubber(e){fe=e},stringify:e=>JSON.stringify(e,fe)},me=["text"],ue=["anchor","focus","merge"];function ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ge(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var be={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return W(e,me)}return ae(r?o(e):e,r?o(t):t)},isText:e=>se(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>be.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:ve({},e)}];for(var r of t){var{anchor:o,focus:s,merge:a}=r,i=W(r,ue),[l,c]=Z.edges(r),d=[],p=0,f=l.offset,h=c.offset,m=null!=a?a:Object.assign;for(var{leaf:u}of n){var{length:g}=u.text,v=p;if(p+=g,f<=v&&p<=h)m(u,i),d.push({leaf:u});else if(f!==h&&(f===p||h===v)||f>p||h<v||h===v&&0!==v)d.push({leaf:u});else{var b=u,y=void 0,x=void 0;if(h<p){var w=h-v;x={leaf:ve(ve({},b),{},{text:b.text.slice(w)})},b=ve(ve({},b),{},{text:b.text.slice(0,w)})}if(f>v){var O=f-v;y={leaf:ve(ve({},b),{},{text:b.text.slice(0,O)})},b=ve(ve({},b),{},{text:b.text.slice(O)})}m(b,i),y&&d.push(y),d.push({leaf:b}),x&&d.push(x)}}n=d}if(n.length>1){var j=0;for(var[k,P]of n.entries()){var E=j,S=E+P.leaf.text.length,N={start:E,end:S};0===k&&(N.isFirst=!0),k===n.length-1&&(N.isLast=!0),P.position=N,j=S}}return n}};function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var we=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},Oe=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),s=3;s<r;s++)o[s-3]=arguments[s];return[...e.slice(0,t),...o,...e.slice(t+n)]},je=Oe,ke=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=ee.get(e,t),o=t.slice(),s=n(r);o.length>1;){var a=o.pop(),i=ee.get(e,o);s=xe(xe({},i),{},{children:Oe(i.children,a,1,s)})}var l=o.pop();e.children=Oe(e.children,l,1,s)},Pe=(e,t,n)=>{0===t.length?e.children=n(e.children):ke(e,t,e=>{if(be.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(he.stringify(e)));return xe(xe({},e),{},{children:n(e.children)})})},Ee=(e,t,n)=>ke(e,t,e=>{if(!be.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(e)));return n(e)});function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ce={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;Pe(e,z.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return we(e,t,o)}),n=!0;break;case"insert_text":var{path:s,offset:a,text:i}=t;if(0===i.length)break;Ee(e,s,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return Ne(Ne({},e),{},{text:t+i+n})}),n=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],d=z.previous(l),p=d[d.length-1];Pe(e,z.parent(l),e=>{var t,n=e[c],r=e[p];if(be.isText(n)&&be.isText(r))t=Ne(Ne({},r),{},{text:r.text+n.text});else{if(be.isText(n)||be.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(he.stringify(n)," ").concat(he.stringify(r)));t=Ne(Ne({},r),{},{children:r.children.concat(n.children)})}return Oe(e,p,2,t)}),n=!0;break;case"move_node":var{path:f,newPath:h}=t,m=f[f.length-1];if(z.isAncestor(f,h))throw new Error("Cannot move a path [".concat(f,"] to new path [").concat(h,"] because the destination is inside itself."));var u=ee.get(e,f);Pe(e,z.parent(f),e=>je(e,m,1));var g=z.transform(f,t),v=g[g.length-1];Pe(e,z.parent(g),e=>we(e,v,u)),n=!0;break;case"remove_node":var{path:b}=t,y=b[b.length-1];if(Pe(e,z.parent(b),e=>je(e,y,1)),e.selection){var x=Ne({},e.selection);for(var[w,O]of Z.points(x)){var j=pe.transform(w,t);if(null!=x&&null!=j)x[O]=j;else{var k=void 0,P=void 0;for(var[E,S]of ee.texts(e)){if(-1!==z.compare(S,b)){P=[E,S];break}k=[E,S]}var N=!1;k&&P&&(N=!z.isSibling(k[1],b)&&(!!z.equals(P[1],b)||z.common(k[1],b).length<z.common(P[1],b).length)),k&&!N?x[O]={path:k[1],offset:k[0].text.length}:P?x[O]={path:P[1],offset:0}:x=null}}x&&Z.equals(x,e.selection)||(e.selection=x)}break;case"remove_text":var{path:C,offset:_,text:T}=t;if(0===T.length)break;Ee(e,C,e=>{var t=e.text.slice(0,_),n=e.text.slice(_+T.length);return Ne(Ne({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:I,properties:A,newProperties:R}=t;if(0===I.length)throw new Error("Cannot set properties on the root node!");ke(e,I,e=>{var t=Ne({},e);for(var n in R){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=R[n];null==r?delete t[n]:t[n]=r}for(var o in A)R.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:D}=t;if(null==D){e.selection=null;break}if(null==e.selection){if(!Z.isRange(D))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(he.stringify(D)," when there is no current selection."));e.selection=Ne({},D);break}var B=Ne({},e.selection);for(var L in D){var q=D[L];if(null==q){if("anchor"===L||"focus"===L)throw new Error('Cannot remove the "'.concat(L,'" selection property'));delete B[L]}else B[L]=q}e.selection=B;break;case"split_node":var{path:M,position:F,properties:V}=t,H=M[M.length-1];if(0===M.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(M,"] because the root node cannot be split."));Pe(e,z.parent(M),e=>{var t,n,r=e[H];if(be.isText(r)){var o=r.text.slice(0,F),s=r.text.slice(F);t=Ne(Ne({},r),{},{text:o}),n=Ne(Ne({},V),{},{text:s})}else{var a=r.children.slice(0,F),i=r.children.slice(F);t=Ne(Ne({},r),{},{children:a}),n=Ne(Ne({},V),{},{children:i})}return Oe(e,H,1,t,n)}),n=!0}if(n&&e.selection){var W=Ne({},e.selection);for(var[$,J]of Z.points(W))W[J]=pe.transform($,t);Z.equals(W,e.selection)||(e.selection=W)}}},_e={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Te={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Ie={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};le.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=ie(e)}=n;if(z.isPath(o)&&(o=le.range(e,o)),Z.isRange(o))if(Z.isCollapsed(o))o=o.anchor;else{var s=Z.end(o);if(!r&&le.void(e,{at:s}))return;var a=Z.start(o),i=le.pointRef(e,a),l=le.pointRef(e,s);De.delete(e,{at:o,voids:r});var c=i.unref(),d=l.unref();o=c||d,De.setSelection(e,{anchor:o,focus:o})}if(!(!r&&le.void(e,{at:o})||le.elementReadOnly(e,{at:o}))){var{path:p,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:p,offset:f,text:t})}})}};function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var De=Re(Re(Re(Re({},Ce),_e),Te),Ie);const Be="ArrowUp",Le="ArrowDown",qe="Enter",Me="Escape";function ze(e){return e.toLowerCase().trim()}function Fe(e,t){var n,r,o;if(!t)return 0;const s=ze(t),a=ze(e.title),i=ze(e.id);return a===s?100:a.startsWith(s)?80:i.startsWith(s)?70:(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>ze(e)===s))?60:a.includes(s)?50:(null===(r=e.keywords)||void 0===r?void 0:r.some(e=>ze(e).startsWith(s)))?40:(null===(o=e.keywords)||void 0===o?void 0:o.some(e=>ze(e).includes(s)))?30:e.description&&ze(e.description).includes(s)?20:10}function Ve({items:e,search:t}){const n=c(()=>{const n=e.filter(e=>!e.disabled&&function(e,t){var n;if(!t)return!0;const r=ze(t);return!!(ze(e.title).includes(r)||ze(e.id).includes(r)||e.description&&ze(e.description).includes(r)||(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>ze(e).includes(r))))}(e,t));return t&&n.sort((e,n)=>Fe(n,t)-Fe(e,t)),n},[e,t]),r=c(()=>{const e=new Map;return n.forEach(t=>{const n=t.group||"default",r=e.get(n)||[];e.set(n,[...r,t])}),e},[n]);return{filteredItems:n,groupedItems:r,isEmpty:0===n.length}}const He="undefined"!=typeof window?d:i;const We={isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null};function $e(e,t){switch(t.type){case"OPEN":return Object.assign(Object.assign({},e),{isOpen:!0,search:"",selectedIndex:0,virtualElement:t.virtualElement,floatingContext:t.floatingContext});case"CLOSE":return Object.assign(Object.assign({},e),{isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null});case"SET_SEARCH":return Object.assign(Object.assign({},e),{search:t.search,selectedIndex:0});case"SET_SELECTED_INDEX":return Object.assign(Object.assign({},e),{selectedIndex:t.index});case"RESET_SELECTION":return Object.assign(Object.assign({},e),{selectedIndex:0});default:return e}}function Je({items:e,trigger:t="/",onSelect:n}){const r=f(),[o,s]=p($e,We),a=c(()=>{if(!o.isOpen)return e;let t=null;if("number"==typeof r.path.current){const e=h.getBlockSlate(r,{at:r.path.current});e&&(t=m(r,e))}return t&&t.length>0?t.map(e=>{var t,n;const o=null===(t=r.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(n=null==o?void 0:o.title)&&void 0!==n?n:e,description:null==o?void 0:o.description,icon:null==o?void 0:o.icon}}):e},[e,o.isOpen,r]),{filteredItems:d,groupedItems:u,isEmpty:k}=Ve({items:a,search:o.search}),{refs:P,floatingStyles:E,floatingContext:S}=function({isOpen:e,virtualElement:t}){const{refs:n,floatingStyles:r,context:o,update:s}=g({open:e,placement:"bottom-start",whileElementsMounted:v,middleware:[b(),y(10),x({fallbackPlacements:["top-start","top","bottom"],padding:10,crossAxis:!1,fallbackStrategy:"bestFit"}),w({padding:10}),O({apply({availableHeight:e,elements:t}){Object.assign(t.floating.style,{maxHeight:`${Math.max(200,e-20)}px`})},padding:10})],strategy:"fixed"});return He(()=>{t&&(n.setReference(t),s())},[n,e,t,s]),{refs:n,floatingStyles:r,floatingContext:o}}({isOpen:o.isOpen,virtualElement:o.virtualElement}),{isMounted:N,styles:C}=j(S,{duration:100}),_=l((e,t)=>{s({type:"OPEN",virtualElement:e,floatingContext:t})},[]),T=l(()=>{s({type:"CLOSE"})},[]),I=l(e=>{s({type:"SET_SEARCH",search:e})},[]),A=e=>{s({type:"SET_SELECTED_INDEX",index:e})},R=()=>{const e=d[o.selectedIndex];e&&(e.onSelect&&e.onSelect(),n?n(e):r.toggleBlock(e.id,{scope:"auto",focus:!0,preserveContent:!1}),T())};i(()=>{var e,n;if("number"!=typeof r.path.current)return;if(!h.getBlock(r,{at:r.path.current}))return;const s=r.refElement;if(!s)return;const a=e=>{if(e.isComposing)return;const t=h.getBlockSlate(r,{at:r.path.current});if(!(null==t?void 0:t.selection))return;if(s.contains(e.target)){if(function(e){return function(e){return"/"===e.key||191===e.keyCode||191===e.which||"Slash"===e.code||"/"===e.key||"."===e.key&&e.shiftKey}(e)}(e)){const e=z.parent(t.selection.anchor.path),n=le.string(t,e);if(le.isStart(t,t.selection.anchor,t.selection.focus)&&0===n.trim().length){const e=function(){const e=window.getSelection();if(!e||0===e.rangeCount)return null;const t=e.getRangeAt(0),n=t.getBoundingClientRect(),r=t.getClientRects();return{getBoundingClientRect:()=>n,getClientRects:()=>r}}();e&&_(e,S)}}o.isOpen&&(e.key===Le?(e.preventDefault(),e.stopPropagation(),A(o.selectedIndex===d.length-1?0:o.selectedIndex+1)):e.key===Be?(e.preventDefault(),e.stopPropagation(),A(0===o.selectedIndex?d.length-1:o.selectedIndex-1)):e.key===qe?(e.preventDefault(),e.stopPropagation(),R()):e.key===Me&&(e.preventDefault(),e.stopPropagation(),T()))}},i=e=>{if(e.isComposing)return;if(!o.isOpen)return;if(e.key===Le||e.key===Be)return;const n=h.getBlockSlate(r,{at:r.path.current});if(!(null==n?void 0:n.selection))return;const s=z.parent(n.selection.anchor.path),a=le.string(n,s);if(0===a.length)return void T();const i=a.replace(t,"").trim();I(i)};return null===(e=r.refElement)||void 0===e||e.addEventListener("keydown",a),null===(n=r.refElement)||void 0===n||n.addEventListener("keyup",i),()=>{var e,t;null===(e=r.refElement)||void 0===e||e.removeEventListener("keydown",a),null===(t=r.refElement)||void 0===t||t.removeEventListener("keyup",i)}},[r.path.current,o.isOpen,o.selectedIndex,P.setReference,t,_,T,I,d.length]),i(()=>{if(!o.isOpen)return;const e=e=>{var t,n;const r=e.target;(null===(n=null===(t=P.floating)||void 0===t?void 0:t.current)||void 0===n?void 0:n.contains(r))||T()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[o.isOpen,T,P.floating]),i(()=>{if(!o.isOpen||!k||0===o.search.length)return;const e=setTimeout(()=>{k&&T()},2e3);return()=>clearTimeout(e)},[o.isOpen,k,o.search,T]),i(()=>{if(!o.isOpen)return;const e=document.body.style.overflow,t=document.body.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",n>0&&(document.body.style.paddingRight=`${n}px`),()=>{document.body.style.overflow=e,document.body.style.paddingRight=t}},[o.isOpen]);return{refs:P,state:o,items:e,isEmpty:k,actionHandlers:{open:_,close:T,setSearch:I,selectItem:A,executeSelected:R},groupedItems:u,filteredItems:d,floatingStyles:E,transitionStyles:C,isMounted:N}}k('.slash-command-root{--slash-command-bg:#fff;--slash-command-bg-hover:#f4f4f5;--slash-command-bg-selected:#f4f4f5;--slash-command-border:#e4e4e7;--slash-command-border-radius:.375rem;--slash-command-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--slash-command-text:#18181b;--slash-command-text-muted:#71717a;--slash-command-text-disabled:#a1a1aa;--slash-command-accent:#3b82f6;--slash-command-item-radius:8px;--slash-command-icon-bg:#fff;--slash-command-icon-border:#e4e4e7;--slash-command-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;--slash-command-font-mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace}.dark .slash-command-root,.slash-command-root[data-theme=dark]{--slash-command-bg:#18181b;--slash-command-bg-hover:#27272a;--slash-command-bg-selected:#27272a;--slash-command-border:#3f3f46;--slash-command-text:#fafafa;--slash-command-text-muted:#a1a1aa;--slash-command-text-disabled:#52525b;--slash-command-icon-bg:#27272a;--slash-command-icon-border:#3f3f46}.slash-command-content{animation:slash-command-in .15s ease-out;background-color:var(--slash-command-bg);border:1px solid var(--slash-command-border);border-radius:var(--slash-command-border-radius);box-shadow:var(--slash-command-shadow);display:flex;flex-direction:column;font-family:var(--slash-command-font-family);max-height:400px;overflow:hidden;width:300px;z-index:9999}@keyframes slash-command-in{0%{opacity:0;transform:translateY(-8px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}.slash-command-input-wrapper{align-items:center;border-bottom:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:8px;padding:12px 14px}.slash-command-input-trigger{color:var(--slash-command-text-muted);font-family:var(--slash-command-font-mono);font-size:14px;font-weight:500;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-input{background-color:transparent;border:none;color:var(--slash-command-text);flex:1;font-family:var(--slash-command-font-family);font-size:14px;min-width:0;outline:none}.slash-command-input::-moz-placeholder{color:var(--slash-command-text-muted)}.slash-command-input::placeholder{color:var(--slash-command-text-muted)}.slash-command-kbd{align-items:center;background-color:var(--slash-command-bg-hover);border:1px solid var(--slash-command-border);border-radius:4px;color:var(--slash-command-text-muted);display:inline-flex;font-family:var(--slash-command-font-family);font-size:10px;font-weight:500;justify-content:center;padding:2px 6px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-list{display:flex;flex:1;flex-direction:column;gap:2px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:.5rem .25rem}.slash-command-list::-webkit-scrollbar{width:6px}.slash-command-list::-webkit-scrollbar-track{background:transparent}.slash-command-list::-webkit-scrollbar-thumb{background-color:var(--slash-command-border);border-radius:3px}.slash-command-list::-webkit-scrollbar-thumb:hover{background-color:var(--slash-command-text-muted)}.slash-command-group{margin-bottom:8px}.slash-command-group:last-child{margin-bottom:0}.slash-command-group-heading{color:var(--slash-command-text-muted);font-size:11px;font-weight:600;letter-spacing:.05em;padding:8px 12px 6px;text-transform:uppercase;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-item{align-items:center;background-color:transparent;border:none;border-radius:var(--slash-command-item-radius);cursor:pointer;display:flex;font-family:var(--slash-command-font-family);gap:12px;outline:none;padding:4px 6px;text-align:left;transition:background-color .1s ease;width:100%}.slash-command-item:hover,.slash-command-item[data-selected=true]{background-color:var(--slash-command-bg-selected)}.slash-command-item:focus-visible{outline:2px solid var(--slash-command-accent);outline-offset:-2px}.slash-command-item[data-disabled=true]{cursor:not-allowed;opacity:.5;pointer-events:none}.slash-command-item-icon{align-items:center;background-color:var(--slash-command-icon-bg);border:1px solid var(--slash-command-icon-border);border-radius:8px;color:var(--slash-command-text-muted);display:flex;flex-shrink:0;height:40px;justify-content:center;transition:border-color .1s ease,box-shadow .1s ease;width:40px}.slash-command-item[data-selected=true] .slash-command-item-icon{border-color:var(--slash-command-text-muted);box-shadow:0 1px 3px rgba(0,0,0,.06)}.slash-command-item-icon svg{height:20px;width:20px}.slash-command-item-content{flex:1;min-width:0}.slash-command-item-title{color:var(--slash-command-text);font-size:14px;font-weight:500}.slash-command-item-description,.slash-command-item-title{line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slash-command-item-description{color:var(--slash-command-text-muted);font-size:12px;margin-top:1px}.slash-command-item-shortcut{align-items:center;display:flex;flex-shrink:0;gap:4px}.slash-command-empty{align-items:center;color:var(--slash-command-text-muted);display:flex;flex-direction:column;font-size:14px;justify-content:center;padding:32px 16px;text-align:center}.slash-command-empty-icon{margin-bottom:8px;opacity:.5}.slash-command-separator{background-color:var(--slash-command-border);height:1px;margin:8px 12px}.slash-command-footer{align-items:center;background-color:var(--slash-command-bg-hover);border-top:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:16px;padding:8px 14px}.slash-command-footer-hint{align-items:center;color:var(--slash-command-text-muted);display:flex;font-size:11px;gap:4px}.slash-command-loading{align-items:center;display:flex;justify-content:center;padding:24px}.slash-command-spinner{animation:slash-command-spin .6s linear infinite;border:2px solid var(--slash-command-border);border-radius:50%;border-top-color:var(--slash-command-accent);height:20px;width:20px}@keyframes slash-command-spin{to{transform:rotate(1turn)}}');const Ze=({children:t,items:n,trigger:r="/",onSelect:o,className:s})=>{const a=f(),i=c(()=>{if(Array.isArray(n)&&n.length>0)return n;return Object.keys(a.plugins).filter(e=>{var t,n;const r=u(a.plugins[e].elements),o=r?a.plugins[e].elements[r]:void 0;return"inline"!==(null===(t=null==o?void 0:o.props)||void 0===t?void 0:t.nodeType)&&"inlineVoid"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}).map(e=>{var t,n;const r=null===(t=a.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(n=null==r?void 0:r.title)&&void 0!==n?n:e,description:null==r?void 0:r.description,icon:null==r?void 0:r.icon}})},[n,a]),{state:l,actionHandlers:d,filteredItems:p,groupedItems:h,refs:m,floatingStyles:g,transitionStyles:v,isMounted:b}=Je({items:i,trigger:r,onSelect:o}),y=c(()=>({state:l,actionHandlers:d,items:i,filteredItems:p,groupedItems:h,refs:m,floatingStyles:g}),[l,d,i,p,h,m,g]),x=Object.assign(Object.assign({},g),v),w="function"==typeof t?t({groupedItems:h,items:i}):t;return e(E.Provider,Object.assign({value:y},{children:e("div",Object.assign({ref:m.setFloating,style:x,className:`slash-command-root ${null!=s?s:""}`},{children:b?w:null}))}))};Ze.displayName="SlashCommand.Root";const Ge=({className:t})=>e("div",{role:"separator","aria-orientation":"horizontal",className:`slash-command-separator ${t||""}`});Ge.displayName="SlashCommand.Separator";const Ue=Object.assign(Ze,{Root:Ze,Content:P,Input:B,List:q,Group:D,Item:L,Empty:I,Separator:Ge,Footer:R,Loading:M});export{P as SlashCommandContent,E as SlashCommandContext,I as SlashCommandEmpty,R as SlashCommandFooter,D as SlashCommandGroup,B as SlashCommandInput,L as SlashCommandItem,q as SlashCommandList,M as SlashCommandLoading,Ue as SlashCommandMenu,Ze as SlashCommandRoot,Ge as SlashCommandSeparator,Je as useSlashCommand,C as useSlashCommandActions,S as useSlashCommandContext,_ as useSlashCommandItems,T as useSlashCommandRefs,N as useSlashCommandState};
@@ -1,6 +1,6 @@
1
+ import './toolbar.css';
1
2
  export { Toolbar } from './toolbar';
2
3
  export { useToolbar } from './hooks';
3
4
  export { useToolbarStore } from './store';
4
5
  export type { ToolbarState, ToolbarStore } from './store';
5
- import './toolbar.css';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG1D,OAAO,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar/index.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
package/dist/toolbar.js CHANGED
@@ -1 +1 @@
1
- export{T as Toolbar,u as useToolbar,a as useToolbarStore}from"./chunks/hooks-907f8ea7.js";import{s as o}from"./chunks/style-inject.es-e87a8d02.js";import"./chunks/_tslib-5e145dfd.js";import"react/jsx-runtime";import"react";import"./portal.js";import"./chunks/floating-ui.react-0123aadf.js";import"react-dom";import"@yoopta/editor";import"./chunks/index-06d5c4e7.js";import"./chunks/throttle-dea4a39e.js";o(".yoopta-ui-toolbar{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-toolbar-radius,.5rem);box-shadow:var(\n --yoopta-ui-toolbar-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );display:flex;gap:var(--yoopta-ui-toolbar-gap,4px);padding:var(--yoopta-ui-toolbar-padding,6px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:var(--yoopta-ui-toolbar-z-index,99)}.yoopta-ui-toolbar-group{align-items:center;display:flex;gap:var(--yoopta-ui-toolbar-group-gap,2px)}.yoopta-ui-toolbar-separator{background:hsl(var(--yoopta-ui-border));height:var(--yoopta-ui-toolbar-separator-height,24px);margin:0 var(--yoopta-ui-toolbar-separator-margin,4px);width:1px}.yoopta-ui-toolbar-button{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-toolbar-button-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:inline-flex;font-size:var(--yoopta-ui-toolbar-button-font-size,.875rem);font-weight:var(--yoopta-ui-toolbar-button-font-weight,500);gap:var(--yoopta-ui-toolbar-button-gap,4px);justify-content:center;min-height:var(--yoopta-ui-toolbar-button-min-height,32px);min-width:var(--yoopta-ui-toolbar-button-min-width,32px);outline:none;padding:var(--yoopta-ui-toolbar-button-padding-y,6px) var(--yoopta-ui-toolbar-button-padding-x,8px);transition:all .15s cubic-bezier(.4,0,.2,1);white-space:nowrap}.yoopta-ui-toolbar-button:hover:not(:disabled){background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-toolbar-button:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:var(--yoopta-ui-toolbar-ring-offset,2px)}.yoopta-ui-toolbar-button[data-active=true]{background:hsl(var(--yoopta-ui-primary,221.2 83.2% 53.3%));color:hsl(var(--yoopta-ui-primary-foreground,210 40% 98%))}.yoopta-ui-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.yoopta-ui-toolbar-button svg{height:var(--yoopta-ui-toolbar-icon-size,1rem);width:var(--yoopta-ui-toolbar-icon-size,1rem)}:root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-primary:221.2 83.2% 53.3%;--yoopta-ui-primary-foreground:210 40% 98%;--yoopta-ui-toolbar-gap:4px;--yoopta-ui-toolbar-padding:6px;--yoopta-ui-toolbar-radius:0.5rem;--yoopta-ui-toolbar-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-toolbar-z-index:99;--yoopta-ui-toolbar-group-gap:2px;--yoopta-ui-toolbar-separator-height:24px;--yoopta-ui-toolbar-separator-margin:4px;--yoopta-ui-toolbar-button-min-width:32px;--yoopta-ui-toolbar-button-min-height:32px;--yoopta-ui-toolbar-button-padding-y:6px;--yoopta-ui-toolbar-button-padding-x:8px;--yoopta-ui-toolbar-button-font-size:0.875rem;--yoopta-ui-toolbar-button-font-weight:500;--yoopta-ui-toolbar-button-gap:4px;--yoopta-ui-toolbar-button-radius:0.375rem;--yoopta-ui-toolbar-icon-size:1rem;--yoopta-ui-toolbar-ring-offset:2px}.dark,[data-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%}");
1
+ import{s as o}from"./chunks/style-inject.es-e87a8d02.js";export{T as Toolbar,u as useToolbar,a as useToolbarStore}from"./chunks/hooks-879d4b4f.js";import"./chunks/_tslib-5e145dfd.js";import"react/jsx-runtime";import"react";import"./portal.js";import"./chunks/floating-ui.react-33212df0.js";import"react-dom";import"@yoopta/editor";import"./chunks/index-06d5c4e7.js";import"./chunks/throttle-dea4a39e.js";o(":root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-primary:221.2 83.2% 53.3%;--yoopta-ui-primary-foreground:210 40% 98%;--yoopta-ui-toolbar-gap:4px;--yoopta-ui-toolbar-padding:6px;--yoopta-ui-toolbar-radius:0.5rem;--yoopta-ui-toolbar-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-toolbar-z-index:99;--yoopta-ui-toolbar-group-gap:2px;--yoopta-ui-toolbar-separator-height:24px;--yoopta-ui-toolbar-separator-margin:4px;--yoopta-ui-toolbar-button-min-width:32px;--yoopta-ui-toolbar-button-min-height:32px;--yoopta-ui-toolbar-button-padding-y:6px;--yoopta-ui-toolbar-button-padding-x:8px;--yoopta-ui-toolbar-button-font-size:0.875rem;--yoopta-ui-toolbar-button-font-weight:500;--yoopta-ui-toolbar-button-gap:4px;--yoopta-ui-toolbar-button-radius:0.375rem;--yoopta-ui-toolbar-icon-size:1rem;--yoopta-ui-toolbar-ring-offset:2px}.dark,[data-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%}.yoopta-ui-toolbar{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-toolbar-radius,.5rem);box-shadow:var(--yoopta-ui-toolbar-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));display:flex;gap:var(--yoopta-ui-toolbar-gap,4px);padding:var(--yoopta-ui-toolbar-padding,6px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:var(--yoopta-ui-toolbar-z-index,99)}.yoopta-ui-toolbar-group{align-items:center;display:flex;gap:var(--yoopta-ui-toolbar-group-gap,2px)}.yoopta-ui-toolbar-separator{background:hsl(var(--yoopta-ui-border));height:var(--yoopta-ui-toolbar-separator-height,24px);margin:0 var(--yoopta-ui-toolbar-separator-margin,4px);width:1px}.yoopta-ui-toolbar-button{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-toolbar-button-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:inline-flex;font-size:var(--yoopta-ui-toolbar-button-font-size,.875rem);font-weight:var(--yoopta-ui-toolbar-button-font-weight,500);gap:var(--yoopta-ui-toolbar-button-gap,4px);justify-content:center;min-height:var(--yoopta-ui-toolbar-button-min-height,32px);min-width:var(--yoopta-ui-toolbar-button-min-width,32px);outline:none;padding:var(--yoopta-ui-toolbar-button-padding-y,6px) var(--yoopta-ui-toolbar-button-padding-x,8px);transition:all .15s cubic-bezier(.4,0,.2,1);white-space:nowrap}.yoopta-ui-toolbar-button:hover:not(:disabled){background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-toolbar-button:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:var(--yoopta-ui-toolbar-ring-offset,2px)}.yoopta-ui-toolbar-button[data-active=true]{background:hsl(var(--yoopta-ui-primary,221.2 83.2% 53.3%));color:hsl(var(--yoopta-ui-primary-foreground,210 40% 98%))}.yoopta-ui-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.yoopta-ui-toolbar-button svg{height:var(--yoopta-ui-toolbar-icon-size,1rem);width:var(--yoopta-ui-toolbar-icon-size,1rem)}");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/ui",
3
- "version": "6.0.0-beta.5",
3
+ "version": "6.0.0-beta.6",
4
4
  "description": "UI components for Yoopta Editor",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
@@ -123,5 +123,5 @@
123
123
  "bugs": {
124
124
  "url": "https://github.com/Darginec05/Yoopta-Editor/issues"
125
125
  },
126
- "gitHead": "057e2317fa9f18704c8343af6b021c9355de4056"
126
+ "gitHead": "4c99cc586ce4c17cd837e3136a068121af44cc8f"
127
127
  }
@@ -1,15 +0,0 @@
1
- export type BlockOptionsStore = {
2
- blockId: string | null;
3
- state: 'open' | 'closed';
4
- reference: HTMLElement | null;
5
- open: (options: {
6
- reference: HTMLElement;
7
- blockId?: string;
8
- }) => void;
9
- close: () => void;
10
- toggle: (actionState: 'open' | 'closed', reference?: HTMLElement | null, blockId?: string | null) => void;
11
- setReference: (node: HTMLElement | null) => void;
12
- reset: () => void;
13
- };
14
- export declare const useBlockOptionsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<BlockOptionsStore>>;
15
- //# sourceMappingURL=store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/block-options/store.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAE9B,IAAI,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACtE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,CACN,WAAW,EAAE,MAAM,GAAG,QAAQ,EAC9B,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,EAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,KACpB,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,oBAAoB,gFAkD9B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=store.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.test.d.ts","sourceRoot":"","sources":["../../src/block-options/store.test.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import*as t from"react";import{useLayoutEffect as e,useEffect as n,useRef as o}from"react";import*as r from"react-dom";function i(){return"undefined"!=typeof window}function l(t){return s(t)?(t.nodeName||"").toLowerCase():"#document"}function c(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function a(t){var e;return null==(e=(s(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function s(t){return!!i()&&(t instanceof Node||t instanceof c(t).Node)}function u(t){return!!i()&&(t instanceof Element||t instanceof c(t).Element)}function f(t){return!!i()&&(t instanceof HTMLElement||t instanceof c(t).HTMLElement)}function d(t){return!(!i()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof c(t).ShadowRoot)}const p=new Set(["inline","contents"]);function m(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=A(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!p.has(r)}const h=new Set(["table","td","th"]);function g(t){return h.has(l(t))}const y=[":popover-open",":modal"];function v(t){return y.some(e=>{try{return t.matches(e)}catch(t){return!1}})}const w=["transform","translate","scale","rotate","perspective"],b=["transform","translate","scale","rotate","perspective","filter"],x=["paint","layout","strict","content"];function R(t){const e=S(),n=u(t)?A(t):t;return w.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||b.some(t=>(n.willChange||"").includes(t))||x.some(t=>(n.contain||"").includes(t))}function S(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const E=new Set(["html","body","#document"]);function C(t){return E.has(l(t))}function A(t){return c(t).getComputedStyle(t)}function T(t){return u(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function L(t){if("html"===l(t))return t;const e=t.assignedSlot||t.parentNode||d(t)&&t.host||a(t);return d(e)?e.host:e}function O(t){const e=L(t);return C(e)?t.ownerDocument?t.ownerDocument.body:t.body:f(e)&&m(e)?e:O(e)}function D(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const r=O(t),i=r===(null==(o=t.ownerDocument)?void 0:o.body),l=c(r);if(i){const t=P(l);return e.concat(l,l.visualViewport||[],m(r)?r:[],t&&n?D(t):[])}return e.concat(r,D(r,[],n))}function P(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const k=Math.min,M=Math.max,F=Math.round,N=Math.floor,I=t=>({x:t,y:t}),B={left:"right",right:"left",bottom:"top",top:"bottom"},j={start:"end",end:"start"};function V(t,e,n){return M(t,k(e,n))}function W(t,e){return"function"==typeof t?t(e):t}function z(t){return t.split("-")[0]}function H(t){return t.split("-")[1]}function q(t){return"x"===t?"y":"x"}function $(t){return"y"===t?"height":"width"}const U=new Set(["top","bottom"]);function X(t){return U.has(z(t))?"y":"x"}function Y(t){return q(X(t))}function _(t){return t.replace(/start|end/g,t=>j[t])}const Z=["left","right"],G=["right","left"],J=["top","bottom"],K=["bottom","top"];function Q(t,e,n,o){const r=H(t);let i=function(t,e,n){switch(t){case"top":case"bottom":return n?e?G:Z:e?Z:G;case"left":case"right":return e?J:K;default:return[]}}(z(t),"start"===n,o);return r&&(i=i.map(t=>t+"-"+r),e&&(i=i.concat(i.map(_)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,t=>B[t])}function et(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function nt(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}
2
- /*!
3
- * tabbable 6.4.0
4
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
- */var ot=["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(","),rt="undefined"==typeof Element,it=rt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lt=!rt&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},ct=function(t,e){var n;void 0===e&&(e=!0);var o=null==t||null===(n=t.getAttribute)||void 0===n?void 0:n.call(t,"inert");return""===o||"true"===o||e&&t&&("function"==typeof t.closest?t.closest("[inert]"):ct(t.parentNode))},at=function(t,e,n){for(var o=[],r=Array.from(t);r.length;){var i=r.shift();if(!ct(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,a=at(c,!0,n);n.flatten?o.push.apply(o,a):o.push({scopeParent:i,candidates:a})}else{it.call(i,ot)&&n.filter(i)&&(e||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),u=!ct(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&u){var f=at(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},st=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ut=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,n=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===n||"true"===n}(t))&&!st(t)?0:t.tabIndex},ft=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},dt=function(t){return"INPUT"===t.tagName},pt=function(t){return function(t){return dt(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||lt(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){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",t.message),!1}var r=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!r||r===t}(t)},mt=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},ht=function(t,e){var n=e.displayCheck,o=e.getShadowRoot;if("full-native"===n&&"checkVisibility"in t)return!t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(t).visibility)return!0;var r=it.call(t,"details>summary:first-of-type")?t.parentElement:t;if(it.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return mt(t)}else{if("function"==typeof o){for(var i=t;t;){var l=t.parentElement,c=lt(t);if(l&&!l.shadowRoot&&!0===o(l))return mt(t);t=t.assignedSlot?t.assignedSlot:l||c===t.ownerDocument?l:c.host}t=i}if(function(t){var e,n,o,r,i=t&&lt(t),l=null===(e=i)||void 0===e?void 0:e.host,c=!1;if(i&&i!==t)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(r=t.ownerDocument)&&void 0!==r&&r.contains(t));!c&&l;){var a,s,u;c=!(null===(s=l=null===(a=i=lt(l))||void 0===a?void 0:a.host)||void 0===s||null===(u=s.ownerDocument)||void 0===u||!u.contains(l))}return c}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},gt=function(t,e){return!(e.disabled||function(t){return dt(t)&&"hidden"===t.type}(e)||ht(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some(function(t){return"SUMMARY"===t.tagName})}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var o=e.children.item(n);if("LEGEND"===o.tagName)return!!it.call(e,"fieldset[disabled] *")||!o.contains(t)}return!0}e=e.parentElement}return!1}(e))},yt=function(t,e){return!(pt(e)||ut(e)<0||!gt(t,e))},vt=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},wt=function(t){var e=[],n=[];return t.forEach(function(t,o){var r=!!t.scopeParent,i=r?t.scopeParent:t,l=function(t,e){var n=ut(t);return n<0&&e&&!st(t)?0:n}(i,r),c=r?wt(t.candidates):i;0===l?r?e.push.apply(e,c):e.push(i):n.push({documentOrder:o,tabIndex:l,item:t,isScope:r,content:c})}),n.sort(ft).reduce(function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t},[]).concat(e)},bt=function(t,e){var n;return n=(e=e||{}).getShadowRoot?at([t],e.includeContainer,{filter:yt.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:vt}):function(t,e,n){if(ct(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(ot));return e&&it.call(t,ot)&&o.unshift(t),o.filter(n)}(t,e.includeContainer,yt.bind(null,e)),wt(n)};function xt(t,e,n){let{reference:o,floating:r}=t;const i=X(e),l=Y(e),c=$(l),a=z(e),s="y"===i,u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(a){case"top":p={x:u,y:o.y-r.height};break;case"bottom":p={x:u,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(H(e)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function Rt(t,e){var n;void 0===e&&(e={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:a}=t,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=W(e,t),m=et(p),h=c[d?"floating"===f?"reference":"floating":f],g=nt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:u,strategy:a})),y="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},b=nt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:v,strategy:a}):y);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function St(t){const e=k(...t.map(t=>t.left)),n=k(...t.map(t=>t.top));return{x:e,y:n,width:M(...t.map(t=>t.right))-e,height:M(...t.map(t=>t.bottom))-n}}const Et=new Set(["left","top"]);function Ct(t){const e=A(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=f(t),i=r?t.offsetWidth:n,l=r?t.offsetHeight:o,c=F(n)!==i||F(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function At(t){return u(t)?t:t.contextElement}function Tt(t){const e=At(t);if(!f(e))return I(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Ct(e);let l=(i?F(n.width):n.width)/o,c=(i?F(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Lt=I(0);function Ot(t){const e=c(t);return S()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Lt}function Dt(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const r=t.getBoundingClientRect(),i=At(t);let l=I(1);e&&(o?u(o)&&(l=Tt(o)):l=Tt(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==c(t))&&e}(i,n,o)?Ot(i):I(0);let s=(r.left+a.x)/l.x,f=(r.top+a.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const t=c(i),e=o&&u(o)?c(o):o;let n=t,r=P(n);for(;r&&o&&e!==n;){const t=Tt(r),e=r.getBoundingClientRect(),o=A(r),i=e.left+(r.clientLeft+parseFloat(o.paddingLeft))*t.x,l=e.top+(r.clientTop+parseFloat(o.paddingTop))*t.y;s*=t.x,f*=t.y,d*=t.x,p*=t.y,s+=i,f+=l,n=c(r),r=P(n)}}return nt({width:d,height:p,x:s,y:f})}function Pt(t,e){const n=T(t).scrollLeft;return e?e.left+n:Dt(a(t)).left+n}function kt(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-Pt(t,n),y:n.top+e.scrollTop}}const Mt=new Set(["absolute","fixed"]);function Ft(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=c(t),o=a(t),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,u=0;if(r){i=r.width,l=r.height;const t=S();(!t||t&&"fixed"===e)&&(s=r.offsetLeft,u=r.offsetTop)}const f=Pt(o);if(f<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),r="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-e.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:u}}(t,n);else if("document"===e)o=function(t){const e=a(t),n=T(t),o=t.ownerDocument.body,r=M(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=M(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Pt(t);const c=-n.scrollTop;return"rtl"===A(o).direction&&(l+=M(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(a(t));else if(u(e))o=function(t,e){const n=Dt(t,!0,"fixed"===e),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=f(t)?Tt(t):I(1);return{width:t.clientWidth*i.x,height:t.clientHeight*i.y,x:r*i.x,y:o*i.y}}(e,n);else{const n=Ot(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return nt(o)}function Nt(t,e){const n=L(t);return!(n===e||!u(n)||C(n))&&("fixed"===A(n).position||Nt(n,e))}function It(t,e,n){const o=f(e),r=a(e),i="fixed"===n,c=Dt(t,!0,i,e);let s={scrollLeft:0,scrollTop:0};const u=I(0);function d(){u.x=Pt(r)}if(o||!o&&!i)if(("body"!==l(e)||m(r))&&(s=T(e)),o){const t=Dt(e,!0,i,e);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?I(0):kt(r,s);return{x:c.left+s.scrollLeft-u.x-p.x,y:c.top+s.scrollTop-u.y-p.y,width:c.width,height:c.height}}function Bt(t){return"static"===A(t).position}function jt(t,e){if(!f(t)||"fixed"===A(t).position)return null;if(e)return e(t);let n=t.offsetParent;return a(t)===n&&(n=n.ownerDocument.body),n}function Vt(t,e){const n=c(t);if(v(t))return n;if(!f(t)){let e=L(t);for(;e&&!C(e);){if(u(e)&&!Bt(e))return e;e=L(e)}return n}let o=jt(t,e);for(;o&&g(o)&&Bt(o);)o=jt(o,e);return o&&C(o)&&Bt(o)&&!R(o)?n:o||function(t){let e=L(t);for(;f(e)&&!C(e);){if(R(e))return e;if(v(e))return null;e=L(e)}return null}(t)||n}const Wt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i="fixed"===r,c=a(o),s=!!e&&v(e.floating);if(o===c||s&&i)return n;let u={scrollLeft:0,scrollTop:0},d=I(1);const p=I(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(u=T(o)),f(o))){const t=Dt(o);d=Tt(o),p.x=t.x+o.clientLeft,p.y=t.y+o.clientTop}const g=!c||h||i?I(0):kt(c,u);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-u.scrollTop*d.y+p.y+g.y}},getDocumentElement:a,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[..."clippingAncestors"===n?v(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=D(t,[],!1).filter(t=>u(t)&&"body"!==l(t)),r=null;const i="fixed"===A(t).position;let c=i?L(t):t;for(;u(c)&&!C(c);){const e=A(c),n=R(c);n||"fixed"!==e.position||(r=null),(i?!n&&!r:!n&&"static"===e.position&&r&&Mt.has(r.position)||m(c)&&!n&&Nt(t,c))?o=o.filter(t=>t!==c):r=e,c=L(c)}return e.set(t,o),o}(e,this._c):[].concat(n),o],c=i[0],a=i.reduce((t,n)=>{const o=Ft(e,n,r);return t.top=M(o.top,t.top),t.right=k(o.right,t.right),t.bottom=k(o.bottom,t.bottom),t.left=M(o.left,t.left),t},Ft(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Vt,getElementRects:async function(t){const e=this.getOffsetParent||Vt,n=this.getDimensions,o=await n(t.floating);return{reference:It(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Ct(t);return{width:e,height:n}},getScale:Tt,isElement:u,isRTL:function(t){return"rtl"===A(t).direction}};function zt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ht(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,u=At(t),f=r||i?[...u?D(u):[],...D(e)]:[];f.forEach(t=>{r&&t.addEventListener("scroll",n,{passive:!0}),i&&t.addEventListener("resize",n)});const d=u&&c?function(t,e){let n,o=null;const r=a(t);function i(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function l(c,a){void 0===c&&(c=!1),void 0===a&&(a=1),i();const s=t.getBoundingClientRect(),{left:u,top:f,width:d,height:p}=s;if(c||e(),!d||!p)return;const m={rootMargin:-N(f)+"px "+-N(r.clientWidth-(u+d))+"px "+-N(r.clientHeight-(f+p))+"px "+-N(u)+"px",threshold:M(0,k(1,a))||1};let h=!0;function g(e){const o=e[0].intersectionRatio;if(o!==a){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||zt(s,t.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(t){o=new IntersectionObserver(g,m)}o.observe(t)}(!0),i}(u,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(t=>{let[o]=t;o&&o.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var t;null==(t=h)||t.observe(e)})),n()}),u&&!s&&h.observe(u),h.observe(e));let g=s?Dt(t):null;return s&&function e(){const o=Dt(t);g&&!zt(g,o)&&n();g=o,p=requestAnimationFrame(e)}(),n(),()=>{var t;f.forEach(t=>{r&&t.removeEventListener("scroll",n),i&&t.removeEventListener("resize",n)}),null==d||d(),null==(t=h)||t.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const qt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=e,a=await async function(t,e){const{placement:n,platform:o,elements:r}=t,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=z(n),c=H(n),a="y"===X(n),s=Et.has(l)?-1:1,u=i&&a?-1:1,f=W(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),a?{x:p*u,y:d*s}:{x:d*s,y:p*u}}(e,t);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:l}}}}},$t=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...a}=W(t,e),s={x:n,y:o},u=await Rt(e,a),f=X(z(r)),d=q(f);let p=s[d],m=s[f];if(i){const t="y"===d?"bottom":"right";p=V(p+u["y"===d?"top":"left"],p,p-u[t])}if(l){const t="y"===f?"bottom":"right";m=V(m+u["y"===f?"top":"left"],m,m-u[t])}const h=c.fn({...e,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},Ut=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:a,elements:s}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=W(t,e);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=z(r),v=X(c),w=z(c)===c,b=await(null==a.isRTL?void 0:a.isRTL(s.floating)),x=d||(w||!h?[tt(c)]:function(t){const e=tt(t);return[_(t),e,_(e)]}(c)),R="none"!==m;!d&&R&&x.push(...Q(c,h,m,b));const S=[c,...x],E=await Rt(e,g),C=[];let A=(null==(o=i.flip)?void 0:o.overflows)||[];if(u&&C.push(E[y]),f){const t=function(t,e,n){void 0===n&&(n=!1);const o=H(t),r=Y(t),i=$(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[i]>e.floating[i]&&(l=tt(l)),[l,tt(l)]}(r,l,b);C.push(E[t[0]],E[t[1]])}if(A=[...A,{placement:r,overflows:C}],!C.every(t=>t<=0)){var T,L;const t=((null==(T=i.flip)?void 0:T.index)||0)+1,e=S[t];if(e){if(!("alignment"===f&&v!==X(e))||A.every(t=>X(t.placement)!==v||t.overflows[0]>0))return{data:{index:t,overflows:A},reset:{placement:e}}}let n=null==(L=A.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:L.placement;if(!n)switch(p){case"bestFit":{var O;const t=null==(O=A.filter(t=>{if(R){const e=X(t.placement);return e===v||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:O[0];t&&(n=t);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},Xt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:l,elements:c}=e,{apply:a=()=>{},...s}=W(t,e),u=await Rt(e,s),f=z(r),d=H(r),p="y"===X(r),{width:m,height:h}=i.floating;let g,y;"top"===f||"bottom"===f?(g=f,y=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(y=f,g="end"===d?"top":"bottom");const v=h-u.top-u.bottom,w=m-u.left-u.right,b=k(h-u[g],v),x=k(m-u[y],w),R=!e.middlewareData.shift;let S=b,E=x;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(E=w),null!=(o=e.middlewareData.shift)&&o.enabled.y&&(S=v),R&&!d){const t=M(u.left,0),e=M(u.right,0),n=M(u.top,0),o=M(u.bottom,0);p?E=m-2*(0!==t||0!==e?t+e:M(u.left,u.right)):S=h-2*(0!==n||0!==o?n+o:M(u.top,u.bottom))}await a({...e,availableWidth:E,availableHeight:S});const C=await l.getDimensions(c.floating);return m!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}},Yt=function(t){return void 0===t&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=e,{padding:c=2,x:a,y:s}=W(t,e),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(t){const e=t.slice().sort((t,e)=>t.y-e.y),n=[];let o=null;for(let t=0;t<e.length;t++){const r=e[t];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(t=>nt(St(t)))}(u),d=nt(St(u)),p=et(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=a&&null!=s)return f.find(t=>a>t.left-p.left&&a<t.right+p.right&&s>t.top-p.top&&s<t.bottom+p.bottom)||d;if(f.length>=2){if("y"===X(n)){const t=f[0],e=f[f.length-1],o="top"===z(n),r=t.top,i=e.bottom,l=o?t.left:e.left,c=o?t.right:e.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const t="left"===z(n),e=M(...f.map(t=>t.right)),o=k(...f.map(t=>t.left)),r=f.filter(n=>t?n.left===o:n.right===e),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:e,width:e-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},_t=(t,e,n)=>{const o=new Map,r={platform:Wt,...n},i={...r.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let s=await l.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:f}=xt(s,o,a),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:y,data:v,reset:w}=await h({x:u,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:t,floating:e}});u=null!=g?g:u,f=null!=y?y:f,p={...p,[i]:{...p[i],...v}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:t,floating:e,strategy:r}):w.rects),({x:u,y:f}=xt(s,d,a))),n=-1)}return{x:u,y:f,placement:d,strategy:r,middlewareData:p}})(t,e,{...r,platform:i})};var Zt="undefined"!=typeof document?e:function(){};function Gt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;0!==o--;)if(!Gt(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!t.$$typeof)&&!Gt(t[n],e[n]))return!1}return!0}return t!=t&&e!=e}function Jt(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Kt(t,e){const n=Jt(t);return Math.round(e*n)/n}function Qt(e){const n=t.useRef(e);return Zt(()=>{n.current=e}),n}const te=(t,e)=>({...qt(t),options:[t,e]}),ee=(t,e)=>({...$t(t),options:[t,e]}),ne=(t,e)=>({...Ut(t),options:[t,e]}),oe=(t,e)=>({...Xt(t),options:[t,e]}),re=(t,e)=>({...Yt(t),options:[t,e]}),ie={...t},le=ie.useInsertionEffect||(t=>t());var ce="undefined"!=typeof document?e:n;function ae(){return ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ae.apply(this,arguments)}let se=!1,ue=0;const fe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ue++;const de=ie.useId||function(){const[e,n]=t.useState(()=>se?fe():void 0);return ce(()=>{null==e&&n(fe())},[]),t.useEffect(()=>{se=!0},[]),e};const pe=t.createContext(null),me=t.createContext(null);function he(t){return"data-floating-ui-"+t}function ge(t){const e=o(t);return ce(()=>{e.current=t}),e}const ye=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ve(t,e){const n=bt(t,ye());"prev"===e&&n.reverse();const o=n.indexOf(function(t){let e=t.activeElement;for(;null!=(null==(n=e)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;e=e.shadowRoot.activeElement}return e}((null==(r=t)?void 0:r.ownerDocument)||document));var r;return n.slice(o+1)[0]}function we(t,e){const n=e||t.currentTarget,o=t.relatedTarget;return!o||!function(t,e){if(!t||!e)return!1;const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&d(n)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function be(t){bt(t,ye()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function xe(t){t.querySelectorAll("[data-tabindex]").forEach(t=>{const e=t.dataset.tabindex;delete t.dataset.tabindex,e?t.setAttribute("tabindex",e):t.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 Se(t){"Tab"===t.key&&(t.target,clearTimeout(undefined))}const Ee=t.forwardRef(function(e,n){const[o,r]=t.useState();ce(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Se),()=>{document.removeEventListener("keydown",Se)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[he("focus-guard")]:"",style:Re};return t.createElement("span",ae({},e,i))}),Ce=t.createContext(null),Ae=he("portal");function Te(e){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=e,c=function(e){void 0===e&&(e={});const{id:n,root:o}=e,r=de(),i=Le(),[l,c]=t.useState(null),a=t.useRef(null);return ce(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{a.current=null})},[l]),ce(()=>{if(!r)return;if(a.current)return;const t=n?document.getElementById(n):null;if(!t)return;const e=document.createElement("div");e.id=r,e.setAttribute(Ae,""),t.appendChild(e),a.current=e,c(e)},[n,r]),ce(()=>{if(null===o)return;if(!r)return;if(a.current)return;let t=o||(null==i?void 0:i.portalNode);t&&!u(t)&&(t=t.current),t=t||document.body;let e=null;n&&(e=document.createElement("div"),e.id=n,t.appendChild(e));const l=document.createElement("div");l.id=r,l.setAttribute(Ae,""),t=e||t,t.appendChild(l),a.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[a,s]=t.useState(null),f=t.useRef(null),d=t.useRef(null),p=t.useRef(null),m=t.useRef(null),h=null==a?void 0:a.modal,g=null==a?void 0:a.open,y=!!a&&!a.modal&&a.open&&l&&!(!i&&!c);return t.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",t,!0),c.addEventListener("focusout",t,!0),()=>{c.removeEventListener("focusin",t,!0),c.removeEventListener("focusout",t,!0)};function t(t){if(c&&we(t)){("focusin"===t.type?xe:be)(c)}}},[c,l,h]),t.useEffect(()=>{c&&(g||xe(c))},[g,c]),t.createElement(Ce.Provider,{value:t.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},y&&c&&t.createElement(Ee,{"data-type":"outside",ref:f,onFocus:t=>{if(we(t,c)){var e;null==(e=p.current)||e.focus()}else{const t=ve(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus()}}}),y&&c&&t.createElement("span",{"aria-owns":c.id,style:Re}),c&&r.createPortal(n,c),y&&c&&t.createElement(Ee,{"data-type":"outside",ref:d,onFocus:t=>{if(we(t,c)){var e;null==(e=m.current)||e.focus()}else{const e=ve(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,t.nativeEvent,"focus-out"))}}}))}const Le=()=>t.useContext(Ce);let Oe=0;function De(){const t=/iP(hone|ad|od)|iOS/.test(function(){const t=navigator.userAgentData;return null!=t&&t.platform?t.platform:navigator.platform}()),e=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=e.left?parseFloat(e.left):window.scrollX,i=e.top?parseFloat(e.top):window.scrollY;if(e.overflow="hidden",o&&(e[n]=o+"px"),t){var l,c;const t=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(e,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(t))+"px",right:"0"})}return()=>{Object.assign(e,{overflow:"",[n]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}let Pe=()=>{};const ke=t.forwardRef(function(e,n){const{lockScroll:o=!1,...r}=e;return ce(()=>{if(o)return Oe++,1===Oe&&(Pe=De()),()=>{Oe--,0===Oe&&Pe()}},[o]),t.createElement("div",ae({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))});function Me(e){const{open:n=!1,onOpenChange:o,elements:r}=e,i=de(),l=t.useRef({}),[c]=t.useState(()=>function(){const t=new Map;return{emit(e,n){var o;null==(o=t.get(e))||o.forEach(t=>t(n))},on(e,n){t.set(e,[...t.get(e)||[],n])},off(e,n){var o;t.set(e,(null==(o=t.get(e))?void 0:o.filter(t=>t!==n))||[])}}}()),a=null!=((null==(s=t.useContext(pe))?void 0:s.id)||null);var s;const[u,f]=t.useState(r.reference),d=function(e){const n=t.useRef(()=>{});return le(()=>{n.current=e}),t.useCallback(function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return null==n.current?void 0:n.current(...e)},[])}((t,e,n)=>{l.current.openEvent=t?e:void 0,c.emit("openchange",{open:t,event:e,reason:n,nested:a}),null==o||o(t,e,n)}),p=t.useMemo(()=>({setPositionReference:f}),[]),m=t.useMemo(()=>({reference:u||r.reference||null,floating:r.floating||null,domReference:r.reference}),[u,r.reference,r.floating]);return t.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function Fe(e){void 0===e&&(e={});const{nodeId:n}=e,o=Me({...e,elements:{reference:null,floating:null,...e.elements}}),i=e.rootContext||o,l=i.elements,[c,a]=t.useState(null),[s,f]=t.useState(null),d=(null==l?void 0:l.domReference)||c,p=t.useRef(null),m=t.useContext(me);ce(()=>{d&&(p.current=d)},[d]);const h=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:a}={},transform:s=!0,whileElementsMounted:u,open:f}=e,[d,p]=t.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=t.useState(i);Gt(m,i)||h(i);const[g,y]=t.useState(null),[v,w]=t.useState(null),b=t.useCallback(t=>{t!==E.current&&(E.current=t,y(t))},[]),x=t.useCallback(t=>{t!==C.current&&(C.current=t,w(t))},[]),R=c||g,S=a||v,E=t.useRef(null),C=t.useRef(null),A=t.useRef(d),T=null!=u,L=Qt(u),O=Qt(l),D=Qt(f),P=t.useCallback(()=>{if(!E.current||!C.current)return;const t={placement:n,strategy:o,middleware:m};O.current&&(t.platform=O.current),_t(E.current,C.current,t).then(t=>{const e={...t,isPositioned:!1!==D.current};k.current&&!Gt(A.current,e)&&(A.current=e,r.flushSync(()=>{p(e)}))})},[m,n,o,O,D]);Zt(()=>{!1===f&&A.current.isPositioned&&(A.current.isPositioned=!1,p(t=>({...t,isPositioned:!1})))},[f]);const k=t.useRef(!1);Zt(()=>(k.current=!0,()=>{k.current=!1}),[]),Zt(()=>{if(R&&(E.current=R),S&&(C.current=S),R&&S){if(L.current)return L.current(R,S,P);P()}},[R,S,P,L,T]);const M=t.useMemo(()=>({reference:E,floating:C,setReference:b,setFloating:x}),[b,x]),F=t.useMemo(()=>({reference:R,floating:S}),[R,S]),N=t.useMemo(()=>{const t={position:o,left:0,top:0};if(!F.floating)return t;const e=Kt(F.floating,d.x),n=Kt(F.floating,d.y);return s?{...t,transform:"translate("+e+"px, "+n+"px)",...Jt(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:e,top:n}},[o,s,F.floating,d.x,d.y]);return t.useMemo(()=>({...d,update:P,refs:M,elements:F,floatingStyles:N}),[d,P,M,F,N])}({...e,elements:{...l,...s&&{reference:s}}}),g=t.useCallback(t=>{const e=u(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),contextElement:t}:t;f(e),h.refs.setReference(e)},[h.refs]),y=t.useCallback(t=>{(u(t)||null===t)&&(p.current=t,a(t)),(u(h.refs.reference.current)||null===h.refs.reference.current||null!==t&&!u(t))&&h.refs.setReference(t)},[h.refs]),v=t.useMemo(()=>({...h.refs,setReference:y,setPositionReference:g,domReference:p}),[h.refs,y,g]),w=t.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=t.useMemo(()=>({...h,...i,refs:v,elements:w,nodeId:n}),[h,v,w,n,i]);return ce(()=>{i.dataRef.current.floatingContext=b;const t=null==m?void 0:m.nodesRef.current.find(t=>t.id===n);t&&(t.context=b)}),t.useMemo(()=>({...h,context:b,refs:v,elements:w}),[h,v,w,b])}const Ne=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,e)=>(e?"-":"")+t.toLowerCase());function Ie(t,e){return"function"==typeof t?t(e):t}function Be(e,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=e,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,a]=t.useState("unmounted"),s=function(e,n){const[o,r]=t.useState(e);return e&&!o&&r(!0),t.useEffect(()=>{if(!e&&o){const t=setTimeout(()=>r(!1),n);return()=>clearTimeout(t)}},[e,o,n]),o}(o,l);return s||"close"!==c||a("unmounted"),ce(()=>{if(r){if(o){a("initial");const t=requestAnimationFrame(()=>{a("open")});return()=>{cancelAnimationFrame(t)}}a("close")}},[o,r]),{isMounted:s,status:c}}function je(e,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,a=e.placement,s=a.split("-")[0],u=t.useMemo(()=>({side:s,placement:a}),[s,a]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=t.useState(()=>({...Ie(l,u),...Ie(o,u)})),{isMounted:g,status:y}=Be(e,{duration:c}),v=ge(o),w=ge(r),b=ge(i),x=ge(l);return ce(()=>{const t=Ie(v.current,u),e=Ie(b.current,u),n=Ie(x.current,u),o=Ie(w.current,u)||Object.keys(t).reduce((t,e)=>(t[e]="",t),{});if("initial"===y&&h(e=>({transitionProperty:e.transitionProperty,...n,...t})),"open"===y&&h({transitionProperty:Object.keys(o).map(Ne).join(","),transitionDuration:d+"ms",...n,...o}),"close"===y){const o=e||t;h({transitionProperty:Object.keys(o).map(Ne).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,v,w,x,d,y,u]),{isMounted:g,styles:m}}export{Te as F,Ht as a,je as b,oe as c,ke as d,ne as f,re as i,te as o,ee as s,Fe as u};