@yoopta/editor 4.8.4 → 4.8.5-rc.10

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 (145) hide show
  1. package/README.md +12 -16
  2. package/dist/UI/BlockOptions/BlockOptions.d.ts.map +1 -1
  3. package/dist/UI/BlockOptions/utils.d.ts.map +1 -1
  4. package/dist/YooptaEditor.d.ts +7 -2
  5. package/dist/YooptaEditor.d.ts.map +1 -1
  6. package/dist/components/Block/Block.d.ts +2 -1
  7. package/dist/components/Block/Block.d.ts.map +1 -1
  8. package/dist/components/Block/FloatingBlockActions.d.ts +14 -0
  9. package/dist/components/Block/FloatingBlockActions.d.ts.map +1 -0
  10. package/dist/components/Block/hooks.d.ts +838 -0
  11. package/dist/components/Block/hooks.d.ts.map +1 -1
  12. package/dist/components/Editor/Editor.d.ts.map +1 -1
  13. package/dist/components/Editor/RenderBlocks.d.ts.map +1 -1
  14. package/dist/components/Editor/dnd.d.ts.map +1 -1
  15. package/dist/components/Editor/selection.d.ts +8 -0
  16. package/dist/components/Editor/selection.d.ts.map +1 -1
  17. package/dist/components/Editor/utils.d.ts +7 -2
  18. package/dist/components/Editor/utils.d.ts.map +1 -1
  19. package/dist/components/SelectionBox/hooks.d.ts.map +1 -1
  20. package/dist/contexts/YooptaContext/ToolsContext.d.ts.map +1 -1
  21. package/dist/contexts/YooptaContext/YooptaContext.d.ts +4 -4
  22. package/dist/contexts/YooptaContext/YooptaContext.d.ts.map +1 -1
  23. package/dist/editor/blocks/buildBlockData.d.ts +12 -0
  24. package/dist/editor/blocks/buildBlockData.d.ts.map +1 -0
  25. package/dist/editor/blocks/decreaseBlockDepth.d.ts +3 -2
  26. package/dist/editor/blocks/decreaseBlockDepth.d.ts.map +1 -1
  27. package/dist/editor/blocks/deleteBlock.d.ts +15 -5
  28. package/dist/editor/blocks/deleteBlock.d.ts.map +1 -1
  29. package/dist/editor/blocks/duplicateBlock.d.ts +12 -4
  30. package/dist/editor/blocks/duplicateBlock.d.ts.map +1 -1
  31. package/dist/editor/blocks/focusBlock.d.ts +5 -3
  32. package/dist/editor/blocks/focusBlock.d.ts.map +1 -1
  33. package/dist/editor/blocks/getBlock.d.ts +2 -2
  34. package/dist/editor/blocks/getBlockSlate.d.ts +7 -0
  35. package/dist/editor/blocks/getBlockSlate.d.ts.map +1 -0
  36. package/dist/editor/blocks/increaseBlockDepth.d.ts +6 -2
  37. package/dist/editor/blocks/increaseBlockDepth.d.ts.map +1 -1
  38. package/dist/editor/blocks/index.d.ts +7 -8
  39. package/dist/editor/blocks/index.d.ts.map +1 -1
  40. package/dist/editor/blocks/insertBlock.d.ts +7 -2
  41. package/dist/editor/blocks/insertBlock.d.ts.map +1 -1
  42. package/dist/editor/blocks/insertBlock.test.d.ts +2 -0
  43. package/dist/editor/blocks/insertBlock.test.d.ts.map +1 -0
  44. package/dist/editor/blocks/mergeBlock.d.ts +3 -0
  45. package/dist/editor/blocks/mergeBlock.d.ts.map +1 -0
  46. package/dist/editor/blocks/moveBlock.d.ts +2 -2
  47. package/dist/editor/blocks/moveBlock.d.ts.map +1 -1
  48. package/dist/editor/blocks/splitBlock.d.ts +6 -2
  49. package/dist/editor/blocks/splitBlock.d.ts.map +1 -1
  50. package/dist/editor/blocks/toggleBlock.d.ts +7 -3
  51. package/dist/editor/blocks/toggleBlock.d.ts.map +1 -1
  52. package/dist/editor/blocks/updateBlock.d.ts +1 -1
  53. package/dist/editor/blocks/updateBlock.d.ts.map +1 -1
  54. package/dist/editor/core/applyTransforms.d.ts +95 -0
  55. package/dist/editor/core/applyTransforms.d.ts.map +1 -0
  56. package/dist/editor/core/batchOperations.d.ts +3 -0
  57. package/dist/editor/core/batchOperations.d.ts.map +1 -0
  58. package/dist/editor/core/blur.d.ts +3 -2
  59. package/dist/editor/core/blur.d.ts.map +1 -1
  60. package/dist/editor/core/getEditorValue.d.ts.map +1 -1
  61. package/dist/editor/core/history.d.ts +24 -0
  62. package/dist/editor/core/history.d.ts.map +1 -0
  63. package/dist/editor/core/setEditorValue.d.ts +1 -1
  64. package/dist/editor/core/setEditorValue.d.ts.map +1 -1
  65. package/dist/editor/elements/createElement.d.ts.map +1 -1
  66. package/dist/editor/elements/deleteElement.d.ts.map +1 -1
  67. package/dist/editor/elements/index.d.ts +1 -0
  68. package/dist/editor/elements/index.d.ts.map +1 -1
  69. package/dist/editor/elements/insertElementText.d.ts.map +1 -1
  70. package/dist/editor/elements/updateElement.d.ts.map +1 -1
  71. package/dist/editor/index.d.ts.map +1 -1
  72. package/dist/editor/paths/getNextPath.d.ts +3 -0
  73. package/dist/editor/paths/getNextPath.d.ts.map +1 -0
  74. package/dist/editor/paths/getPath.d.ts +3 -0
  75. package/dist/editor/paths/getPath.d.ts.map +1 -0
  76. package/dist/editor/paths/getPreviousPath.d.ts +3 -0
  77. package/dist/editor/paths/getPreviousPath.d.ts.map +1 -0
  78. package/dist/editor/paths/getSelectedPaths.d.ts +3 -0
  79. package/dist/editor/paths/getSelectedPaths.d.ts.map +1 -0
  80. package/dist/editor/paths/index.d.ts +20 -0
  81. package/dist/editor/paths/index.d.ts.map +1 -0
  82. package/dist/editor/paths/isBlockSelected.d.ts +3 -0
  83. package/dist/editor/paths/isBlockSelected.d.ts.map +1 -0
  84. package/dist/editor/paths/isPathEmpty.d.ts +3 -0
  85. package/dist/editor/paths/isPathEmpty.d.ts.map +1 -0
  86. package/dist/editor/paths/setPath.d.ts +3 -0
  87. package/dist/editor/paths/setPath.d.ts.map +1 -0
  88. package/dist/editor/textFormats/toggle.d.ts.map +1 -1
  89. package/dist/editor/textFormats/update.d.ts.map +1 -1
  90. package/dist/editor/types.d.ts +71 -46
  91. package/dist/editor/types.d.ts.map +1 -1
  92. package/dist/extensions/shortcuts.d.ts +1 -1
  93. package/dist/extensions/shortcuts.d.ts.map +1 -1
  94. package/dist/handlers/onKeyDown.d.ts.map +1 -1
  95. package/dist/index.d.ts +7 -4
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +2 -9
  98. package/dist/marks/index.d.ts +0 -1
  99. package/dist/marks/index.d.ts.map +1 -1
  100. package/dist/parsers/deserializeHTML.d.ts.map +1 -1
  101. package/dist/parsers/getHTML.d.ts.map +1 -1
  102. package/dist/parsers/getMarkdown.d.ts.map +1 -1
  103. package/dist/plugins/SlateEditorComponent.d.ts.map +1 -1
  104. package/dist/plugins/createYooptaPlugin.d.ts +0 -1
  105. package/dist/plugins/createYooptaPlugin.d.ts.map +1 -1
  106. package/dist/plugins/extenstions/withInlines.d.ts +1 -1
  107. package/dist/plugins/extenstions/withInlines.d.ts.map +1 -1
  108. package/dist/plugins/hooks.d.ts +1 -1
  109. package/dist/plugins/hooks.d.ts.map +1 -1
  110. package/dist/plugins/types.d.ts +1 -1
  111. package/dist/plugins/types.d.ts.map +1 -1
  112. package/dist/utils/buildSlate.d.ts.map +1 -1
  113. package/dist/utils/deepClone.d.ts.map +1 -1
  114. package/dist/utils/editorBuilders.d.ts.map +1 -1
  115. package/dist/utils/findPluginBlockByPath.d.ts +5 -0
  116. package/dist/utils/findPluginBlockByPath.d.ts.map +1 -0
  117. package/dist/utils/findSlateBySelectionPath.d.ts +4 -2
  118. package/dist/utils/findSlateBySelectionPath.d.ts.map +1 -1
  119. package/dist/utils/getLastNodePoint.d.ts +9 -0
  120. package/dist/utils/getLastNodePoint.d.ts.map +1 -0
  121. package/dist/utils/throttle.d.ts +8 -0
  122. package/dist/utils/throttle.d.ts.map +1 -0
  123. package/dist/utils/types.d.ts +2 -0
  124. package/dist/utils/types.d.ts.map +1 -0
  125. package/dist/utils/validateYooptaValue.d.ts +2 -0
  126. package/dist/utils/validateYooptaValue.d.ts.map +1 -0
  127. package/package.json +3 -4
  128. package/dist/components/Block/BlockActions.d.ts +0 -11
  129. package/dist/components/Block/BlockActions.d.ts.map +0 -1
  130. package/dist/editor/blocks/createBlock.d.ts +0 -6
  131. package/dist/editor/blocks/createBlock.d.ts.map +0 -1
  132. package/dist/editor/blocks/deleteBlocks.d.ts +0 -8
  133. package/dist/editor/blocks/deleteBlocks.d.ts.map +0 -1
  134. package/dist/editor/blocks/getSlate.d.ts +0 -7
  135. package/dist/editor/blocks/getSlate.d.ts.map +0 -1
  136. package/dist/editor/blocks/insertBlocks.d.ts +0 -3
  137. package/dist/editor/blocks/insertBlocks.d.ts.map +0 -1
  138. package/dist/editor/selection/setBlockSelected.d.ts +0 -7
  139. package/dist/editor/selection/setBlockSelected.d.ts.map +0 -1
  140. package/dist/editor/selection/setSelection.d.ts +0 -6
  141. package/dist/editor/selection/setSelection.d.ts.map +0 -1
  142. package/dist/utils/findPluginBlockBySelectionPath.d.ts +0 -3
  143. package/dist/utils/findPluginBlockBySelectionPath.d.ts.map +0 -1
  144. package/dist/utils/findPluginBlockByType.d.ts +0 -7
  145. package/dist/utils/findPluginBlockByType.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,13 +1,6 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import r,{createContext as i,useContext as l,useRef as c,useLayoutEffect as a,useEffect as s,useMemo as d,useCallback as u,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import*as m from"react-dom";import{unstable_batchedUpdates as y,createPortal as b}from"react-dom";import{ReactEditor as w,useSelected as x,Slate as k,Editable as E,DefaultElement as O,withReact as C}from"slate-react";import{Editor as S,Transforms as D,Path as j,Range as B,Text as R,Element as A,Operation as _,Node as N,createEditor as T,Point as M}from"slate";class L{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n,elementProps:o,events:r}=e,i=Object.assign(Object.assign({},this.plugin.options),n),l=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=l[e];if(n&&n.render){const o=t[e];let r=n.render;n.render=e=>r(Object.assign(Object.assign({},e),{extendRender:o}))}})),o&&Object.keys(o).forEach((e=>{const t=l[e];if(t){const n=o[e],r=t.props;n&&r&&(t.props=n(r))}})),r&&Object.keys(r).forEach((e=>{const t=r[e];t&&(this.plugin.events||(this.plugin.events={}),this.plugin.events[e]=t)})),new L(Object.assign(Object.assign({},this.plugin),{elements:l,options:i}))}}function P(e,t={}){const n=Object.keys(e.children),{at:o=e.selection}=t,r=n.find((t=>e.children[t].meta.order===(null==o?void 0:o[0])));return r?e.children[r]:null}const I={editor:{id:"",getBlock:()=>null,insertBlock:()=>{},insertBlocks:()=>{},updateBlock:()=>{},moveBlock:()=>{},splitBlock:()=>{},deleteBlock:()=>{},deleteBlocks:()=>{},toggleBlock:()=>{},focusBlock:()=>{},decreaseBlockDepth:()=>{},increaseBlockDepth:()=>{},duplicateBlock:()=>{},setBlockSelected:()=>{},selectedBlocks:[],setSelection:()=>{},applyChanges:()=>{},getEditorValue:()=>({}),setEditorValue:()=>{},blocks:{},shortcuts:{},plugins:{},formats:{},selection:null,readOnly:!1,isEmpty:()=>!1,blockEditorsMap:{},children:{},commands:{},emit:()=>{},on:()=>{},off:()=>{},once:()=>{},blur:()=>{},isFocused:()=>!1,focus:()=>{},getHTML:()=>"",getMarkdown:()=>"",getPlainText:()=>"",refElement:null}},z=i(I),F=({children:t,editorState:n})=>{const o=c(I);return o.current={editor:n.editor},e(z.Provider,Object.assign({value:o.current},{children:t}))},$=()=>{const e=l(z);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},H=e=>$().children[e],U=()=>$().isFocused(),V=()=>$().readOnly,K=e=>{var t;return null===(t=$().plugins[e])||void 0===t?void 0:t.options},W=({blockId:e,path:t})=>{var n;const o=$();if(!e&&!t)throw new Error("useBlockSelected must receive either blockId or path");let r;return e&&(r=o.children[e]),t&&(r=P(o,{at:t})),(null===(n=o.selection)||void 0===n?void 0:n[0])===(null==r?void 0:r.meta.order)};var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},X={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,o,i,l){if("function"!=typeof o)throw new TypeError("The listener must be a function");var c=new r(o,i||e,l),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],c]:e._events[a].push(c):(e._events[a]=c,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},c.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,i=o.length,l=new Array(i);r<i;r++)l[r]=o[r].fn;return l},c.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},c.prototype.emit=function(e,t,o,r,i,l){var c=n?n+e:e;if(!this._events[c])return!1;var a,s,d=this._events[c],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,o),!0;case 4:return d.fn.call(d.context,t,o,r),!0;case 5:return d.fn.call(d.context,t,o,r,i),!0;case 6:return d.fn.call(d.context,t,o,r,i,l),!0}for(s=1,a=new Array(u-1);s<u;s++)a[s-1]=arguments[s];d.fn.apply(d.context,a)}else{var f,p=d.length;for(s=0;s<p;s++)switch(d[s].once&&this.removeListener(e,d[s].fn,void 0,!0),u){case 1:d[s].fn.call(d[s].context);break;case 2:d[s].fn.call(d[s].context,t);break;case 3:d[s].fn.call(d[s].context,t,o);break;case 4:d[s].fn.call(d[s].context,t,o,r);break;default:if(!a)for(f=1,a=new Array(u-1);f<u;f++)a[f-1]=arguments[f];d[s].fn.apply(d[s].context,a)}}return!0},c.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,o,r){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return l(this,i),this;var c=this._events[i];if(c.fn)c.fn!==t||r&&!c.once||o&&c.context!==o||l(this,i);else{for(var a=0,s=[],d=c.length;a<d;a++)(c[a].fn!==t||r&&!c[a].once||o&&c[a].context!==o)&&s.push(c[a]);s.length?this._events[i]=1===s.length?s[0]:s:l(this,i)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&l(this,t)):(this._events=new o,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,e.exports=c}({get exports(){return X},set exports(e){X=e}});var q=X;function Z(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}const G=()=>{var e,t;return"undefined"==typeof window||"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?Z():null===(t=window.crypto)||void 0===t?void 0:t.randomUUID()},J=e=>({id:G(),type:(null==e?void 0:e.type)||"paragraph",children:(null==e?void 0:e.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==e?void 0:e.props)}),Q=e=>({id:(null==e?void 0:e.id)||G(),value:(null==e?void 0:e.value)||[J()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});const ee="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function te(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function ne(e){return"nodeType"in e}function oe(e){var t,n;return e?te(e)?e:ne(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function re(e){const{Document:t}=oe(e);return e instanceof t}function ie(e){return!te(e)&&e instanceof oe(e).HTMLElement}function le(e){return e instanceof oe(e).SVGElement}function ce(e){return e?te(e)?e.document:ne(e)?re(e)?e:ie(e)||le(e)?e.ownerDocument:document:document:document}const ae=ee?a:s;function se(e){const t=c(e);return ae((()=>{t.current=e})),u((function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return null==t.current?void 0:t.current(...n)}),[])}function de(e,t){void 0===t&&(t=[e]);const n=c(e);return ae((()=>{n.current!==e&&(n.current=e)}),t),n}function ue(e,t){const n=c();return d((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function fe(e){const t=se(e),n=c(null),o=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,o]}function pe(e){const t=c();return s((()=>{t.current=e}),[e]),t.current}let he={};function ge(e,t){return d((()=>{if(t)return t;const n=null==he[e]?0:he[e]+1;return he[e]=n,e+"-"+n}),[e,t])}function ve(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce(((t,n)=>{const o=Object.entries(n);for(const[n,r]of o){const o=t[n];null!=o&&(t[n]=o+e*r)}return t}),{...t})}}const me=ve(1),ye=ve(-1);function be(e){if(!e)return!1;const{KeyboardEvent:t}=oe(e.target);return t&&e instanceof t}function we(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=oe(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const xe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[xe.Translate.toString(e),xe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),ke="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ee(e){return e.matches(ke)?e:e.querySelector(ke)}const Oe={display:"none"};function Ce(e){let{id:t,value:n}=e;return r.createElement("div",{id:t,style:Oe},n)}function Se(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;return r.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},n)}const De=i(null);const je={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},Be={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Re(e){let{announcements:t=Be,container:n,hiddenTextDescribedById:o,screenReaderInstructions:i=je}=e;const{announce:c,announcement:a}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=ge("DndLiveRegion"),[h,g]=f(!1);if(s((()=>{g(!0)}),[]),function(e){const t=l(De);s((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(d((()=>({onDragStart(e){let{active:n}=e;c(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&c(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;c(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;c(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;c(t.onDragCancel({active:n,over:o}))}})),[c,t])),!h)return null;const v=r.createElement(r.Fragment,null,r.createElement(Ce,{id:o,value:i.draggable}),r.createElement(Se,{id:p,announcement:a}));return n?b(v,n):v}var Ae;function _e(){}function Ne(e,t){return d((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(Ae||(Ae={}));const Te=Object.freeze({x:0,y:0});function Me(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Le(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function Pe(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Ie(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function ze(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Fe(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const $e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Fe(t,t.left,t.top),i=[];for(const e of o){const{id:t}=e,o=n.get(t);if(o){const n=Me(Fe(o),r);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Le)};function He(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=r-o,c=i-n;if(o<r&&n<i){const n=t.width*t.height,o=e.width*e.height,r=l*c;return Number((r/(n+o-r)).toFixed(4))}return 0}const Ue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=[];for(const e of o){const{id:o}=e,i=n.get(o);if(i){const n=He(i,t);n>0&&r.push({id:o,data:{droppableContainer:e,value:n}})}}return r.sort(Pe)};function Ve(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Te}function Ke(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const We=Ke(1);const Ye={ignoreTransform:!1};function Xe(e,t){void 0===t&&(t=Ye);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=oe(e).getComputedStyle(e);t&&(n=function(e,t,n){const o=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!o)return e;const{scaleX:r,scaleY:i,x:l,y:c}=o,a=e.left-l-(1-r)*parseFloat(n),s=e.top-c-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:s,right:a+d,bottom:s+u,left:a}}(n,t,o))}const{top:o,left:r,width:i,height:l,bottom:c,right:a}=n;return{top:o,left:r,width:i,height:l,bottom:c,right:a}}function qe(e){return Xe(e,{ignoreTransform:!0})}function Ze(e,t){const n=[];return e?function o(r){if(null!=t&&n.length>=t)return n;if(!r)return n;if(re(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!ie(r)||le(r))return n;if(n.includes(r))return n;const i=oe(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=oe(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const o=t[e];return"string"==typeof o&&n.test(o)}))}(r,i)&&n.push(r),function(e,t){return void 0===t&&(t=oe(e).getComputedStyle(e)),"fixed"===t.position}(r,i)?n:o(r.parentNode)}(e):n}function Ge(e){const[t]=Ze(e,1);return null!=t?t:null}function Je(e){return ee&&e?te(e)?e:ne(e)?re(e)||e===ce(e).scrollingElement?window:ie(e)?e:null:null:null}function Qe(e){return te(e)?e.scrollX:e.scrollLeft}function et(e){return te(e)?e.scrollY:e.scrollTop}function tt(e){return{x:Qe(e),y:et(e)}}var nt;function ot(e){return!(!ee||!e)&&e===document.scrollingElement}function rt(e){const t={x:0,y:0},n=ot(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=o.y,isRight:e.scrollLeft>=o.x,maxScroll:o,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(nt||(nt={}));const it={x:.2,y:.2};function lt(e,t,n,o,r){let{top:i,left:l,right:c,bottom:a}=n;void 0===o&&(o=10),void 0===r&&(r=it);const{isTop:s,isBottom:d,isLeft:u,isRight:f}=rt(e),p={x:0,y:0},h={x:0,y:0},g=t.height*r.y,v=t.width*r.x;return!s&&i<=t.top+g?(p.y=nt.Backward,h.y=o*Math.abs((t.top+g-i)/g)):!d&&a>=t.bottom-g&&(p.y=nt.Forward,h.y=o*Math.abs((t.bottom-g-a)/g)),!f&&c>=t.right-v?(p.x=nt.Forward,h.x=o*Math.abs((t.right-v-c)/v)):!u&&l<=t.left+v&&(p.x=nt.Backward,h.x=o*Math.abs((t.left+v-l)/v)),{direction:p,speed:h}}function ct(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function at(e){return e.reduce(((e,t)=>me(e,tt(t))),Te)}const st=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Qe(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+et(t)),0)}]];class dt{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ze(t),o=at(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,r]of st)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=r(n),l=o[e]-t;return this.rect[i]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ut{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var o;null==(o=this.target)||o.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function ft(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t&&o>t.y}var pt,ht;function gt(e){e.preventDefault()}function vt(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(pt||(pt={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(ht||(ht={}));const mt={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter]},yt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class bt{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new ut(ce(t)),this.windowListeners=new ut(oe(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pt.Resize,this.handleCancel),this.windowListeners.add(pt.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(pt.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=Xe),!e)return;const{top:n,left:o,bottom:r,right:i}=t(e);Ge(e)&&(r<=0||i<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Te)}handleKeyDown(e){if(be(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:r=mt,coordinateGetter:i=yt,scrollBehavior:l="smooth"}=o,{code:c}=e;if(r.end.includes(c))return void this.handleEnd(e);if(r.cancel.includes(c))return void this.handleCancel(e);const{collisionRect:a}=n.current,s=a?{x:a.left,y:a.top}:Te;this.referenceCoordinates||(this.referenceCoordinates=s);const d=i(e,{active:t,context:n.current,currentCoordinates:s});if(d){const t=ye(d,s),o={x:0,y:0},{scrollableAncestors:r}=n.current;for(const n of r){const r=e.code,{isTop:i,isRight:c,isLeft:a,isBottom:s,maxScroll:u,minScroll:f}=rt(n),p=ct(n),h={x:Math.min(r===ht.Right?p.right-p.width/2:p.right,Math.max(r===ht.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(r===ht.Down?p.bottom-p.height/2:p.bottom,Math.max(r===ht.Down?p.top:p.top+p.height/2,d.y))},g=r===ht.Right&&!c||r===ht.Left&&!a,v=r===ht.Down&&!s||r===ht.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=r===ht.Right&&e<=u.x||r===ht.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:l});o.x=i?n.scrollLeft-e:r===ht.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,o.x&&n.scrollBy({left:-o.x,behavior:l});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=r===ht.Down&&e<=u.y||r===ht.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:l});o.y=i?n.scrollTop-e:r===ht.Down?n.scrollTop-u.y:n.scrollTop-f.y,o.y&&n.scrollBy({top:-o.y,behavior:l});break}}this.handleMove(e,me(ye(d,this.referenceCoordinates),o))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function wt(e){return Boolean(e&&"distance"in e)}function xt(e){return Boolean(e&&"delay"in e)}bt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=mt,onActivation:r}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(o.start.includes(l)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==r||r({event:e.nativeEvent}),!0)}return!1}}];class kt{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=oe(e);return e instanceof t?e:ce(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=ce(i),this.documentListeners=new ut(this.document),this.listeners=new ut(n),this.windowListeners=new ut(oe(i)),this.initialCoordinates=null!=(o=we(r))?o:Te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(pt.Resize,this.handleCancel),this.windowListeners.add(pt.DragStart,gt),this.windowListeners.add(pt.VisibilityChange,this.handleCancel),this.windowListeners.add(pt.ContextMenu,gt),this.documentListeners.add(pt.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(xt(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(wt(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(pt.Click,vt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pt.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:o,props:r}=this,{onMove:i,options:{activationConstraint:l}}=r;if(!o)return;const c=null!=(t=we(e))?t:Te,a=ye(o,c);if(!n&&l){if(wt(l)){if(null!=l.tolerance&&ft(a,l.tolerance))return this.handleCancel();if(ft(a,l.distance))return this.handleStart()}return xt(l)&&ft(a,l.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(c)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Et={move:{name:"pointermove"},end:{name:"pointerup"}};class Ot extends kt{constructor(e){const{event:t}=e,n=ce(t.target);super(e,Et,n)}}Ot.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!(!n.isPrimary||0!==n.button)&&(null==o||o({event:n}),!0)}}];const Ct={move:{name:"mousemove"},end:{name:"mouseup"}};var St;!function(e){e[e.RightClick=2]="RightClick"}(St||(St={}));(class extends kt{constructor(e){super(e,Ct,ce(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==St.RightClick&&(null==o||o({event:n}),!0)}}];const Dt={move:{name:"touchmove"},end:{name:"touchend"}};var jt,Bt;function Rt(e){let{acceleration:t,activator:n=jt.Pointer,canScroll:o,draggingRect:r,enabled:i,interval:l=5,order:a=Bt.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=function(e){let{delta:t,disabled:n}=e;const o=pe(t);return ue((e=>{if(n||!o||!e)return At;const r={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[nt.Backward]:e.x[nt.Backward]||-1===r.x,[nt.Forward]:e.x[nt.Forward]||1===r.x},y:{[nt.Backward]:e.y[nt.Backward]||-1===r.y,[nt.Forward]:e.y[nt.Forward]||1===r.y}}}),[n,t,o])}({delta:g,disabled:!i}),[y,b]=function(){const e=c(null);return[u(((t,n)=>{e.current=setInterval(t,n)}),[]),u((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=c({x:0,y:0}),x=c({x:0,y:0}),k=d((()=>{switch(n){case jt.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case jt.DraggableRect:return r}}),[n,r,f]),E=c(null),O=u((()=>{const e=E.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),C=d((()=>a===Bt.TreeOrder?[...p].reverse():p),[a,p]);s((()=>{if(i&&p.length&&k){for(const e of C){if(!1===(null==o?void 0:o(e)))continue;const n=p.indexOf(e),r=h[n];if(!r)continue;const{direction:i,speed:c}=lt(e,r,k,t,v);for(const e of["x","y"])m[e][i[e]]||(c[e]=0,i[e]=0);if(c.x>0||c.y>0)return b(),E.current=e,y(O,l),w.current=c,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,O,o,b,i,l,JSON.stringify(k),JSON.stringify(m),y,p,C,h,JSON.stringify(v)])}(class extends kt{constructor(e){super(e,Dt)}static setup(){return window.addEventListener(Dt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Dt.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;const{touches:r}=n;return!(r.length>1)&&(null==o||o({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(jt||(jt={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(Bt||(Bt={}));const At={x:{[nt.Backward]:!1,[nt.Forward]:!1},y:{[nt.Backward]:!1,[nt.Forward]:!1}};var _t,Nt;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(_t||(_t={})),function(e){e.Optimized="optimized"}(Nt||(Nt={}));const Tt=new Map;function Mt(e,t){return ue((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Lt(e){let{callback:t,disabled:n}=e;const o=se(t),r=d((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)}),[n]);return s((()=>()=>null==r?void 0:r.disconnect()),[r]),r}function Pt(e){return new dt(Xe(e),e)}function It(e,t,n){void 0===t&&(t=Pt);const[o,r]=h((function(o){if(!e)return null;var r;if(!1===e.isConnected)return null!=(r=null!=o?o:n)?r:null;const i=t(e);if(JSON.stringify(o)===JSON.stringify(i))return o;return i}),null),i=function(e){let{callback:t,disabled:n}=e;const o=se(t),r=d((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)}),[o,n]);return s((()=>()=>null==r?void 0:r.disconnect()),[r]),r}({callback(t){if(e)for(const n of t){const{type:t,target:o}=n;if("childList"===t&&o instanceof HTMLElement&&o.contains(e)){r();break}}}}),l=Lt({callback:r});return ae((()=>{r(),e?(null==l||l.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==i||i.disconnect())}),[e]),o}const zt=[];function Ft(e,t){void 0===t&&(t=[]);const n=c(null);return s((()=>{n.current=null}),t),s((()=>{const t=e!==Te;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?ye(e,n.current):Te}function $t(e){return d((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Ht=[];function Ut(e){let{measure:t}=e;const[n,o]=f(null),r=u((e=>{for(const{target:n}of e)if(ie(n)){o((e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o}));break}}),[t]),i=Lt({callback:r}),l=u((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ie(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),o(n?t(n):null)}),[t,i]),[c,a]=fe(l);return d((()=>({nodeRef:c,rect:n,setRef:a})),[n,c,a])}const Vt=[{sensor:Ot,options:{}},{sensor:bt,options:{}}],Kt={current:{}},Wt={draggable:{measure:qe},droppable:{measure:qe,strategy:_t.WhileDragging,frequency:Nt.Optimized},dragOverlay:{measure:Xe}};class Yt extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Xt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Yt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_e},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Wt,measureDroppableContainers:_e,windowRect:null,measuringScheduled:!1},qt=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_e,draggableNodes:new Map,over:null,measureDroppableContainers:_e}),Zt=i(Xt);function Gt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yt}}}function Jt(e,t){switch(t.type){case Ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ae.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Ae.DragEnd:case Ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ae.RegisterDroppable:{const{element:n}=t,{id:o}=n,r=new Yt(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Ae.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=t,i=e.droppable.containers.get(n);if(!i||o!==i.key)return e;const l=new Yt(e.droppable.containers);return l.set(n,{...i,disabled:r}),{...e,droppable:{...e.droppable,containers:l}}}case Ae.UnregisterDroppable:{const{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const i=new Yt(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Qt(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:r}=l(qt),i=pe(o),c=pe(null==n?void 0:n.id);return s((()=>{if(!t&&!o&&i&&null!=c){if(!be(i))return;if(document.activeElement===i.target)return;const e=r.get(c);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=Ee(e);if(t){t.focus();break}}}))}}),[o,t,r,c,i]),null}const en=i({...Te,scaleX:1,scaleY:1});var tn;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(tn||(tn={}));const nn=p((function(e){var t,n,o,i;let{id:l,accessibility:a,autoScroll:p=!0,children:g,sensors:v=Vt,collisionDetection:m=Ue,measuring:b,modifiers:w,...x}=e;const k=h(Jt,void 0,Gt),[E,O]=k,[C,S]=function(){const[e]=f((()=>new Set)),t=u((t=>(e.add(t),()=>e.delete(t))),[e]);return[u((t=>{let{type:n,event:o}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,o)}))}),[e]),t]}(),[D,j]=f(tn.Uninitialized),B=D===tn.Initialized,{draggable:{active:R,nodes:A,translate:_},droppable:{containers:N}}=E,T=R?A.get(R):null,M=c({initial:null,translated:null}),L=d((()=>{var e;return null!=R?{id:R,data:null!=(e=null==T?void 0:T.data)?e:Kt,rect:M}:null}),[R,T]),P=c(null),[I,z]=f(null),[F,$]=f(null),H=de(x,Object.values(x)),U=ge("DndDescribedBy",l),V=d((()=>N.getEnabled()),[N]),K=d((()=>({draggable:{...Wt.draggable,...null==W?void 0:W.draggable},droppable:{...Wt.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Wt.dragOverlay,...null==W?void 0:W.dragOverlay}})),[null==(W=b)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:Y,measureDroppableContainers:X,measuringScheduled:q}=function(e,t){let{dragging:n,dependencies:o,config:r}=t;const[i,l]=f(null),{frequency:a,measure:d,strategy:p}=r,h=c(e),g=function(){switch(p){case _t.Always:return!1;case _t.BeforeDragging:return n;default:return!n}}(),v=de(g),m=u((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),y=c(null),b=ue((t=>{if(g&&!n)return Tt;if(!t||t===Tt||h.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new dt(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t}),[e,i,n,g,d]);return s((()=>{h.current=e}),[e]),s((()=>{g||m()}),[n,g]),s((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),s((()=>{g||"number"!=typeof a||null!==y.current||(y.current=setTimeout((()=>{m(),y.current=null}),a))}),[a,g,m,...o]),{droppableRects:b,measureDroppableContainers:m,measuringScheduled:null!=i}}(V,{dragging:B,dependencies:[_.x,_.y],config:K.droppable}),Z=function(e,t){const n=null!==t?e.get(t):void 0,o=n?n.node.current:null;return ue((e=>{var n;return null===t?null:null!=(n=null!=o?o:e)?n:null}),[o,t])}(A,R),G=d((()=>F?we(F):null),[F]),J=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=B&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return Mt(e,t)}(Z,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e;const i=c(!1),{x:l,y:a}="boolean"==typeof r?{x:r,y:r}:r;ae((()=>{if(!l&&!a||!t)return void(i.current=!1);if(i.current||!o)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const r=Ve(n(e),o);if(l||(r.x=0),a||(r.y=0),i.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=Ge(e);t&&t.scrollBy({top:r.y,left:r.x})}}),[t,l,a,o,n])}({activeNode:R?A.get(R):null,config:J.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const te=It(Z,K.draggable.measure,Q),ne=It(Z?Z.parentElement:null),re=c({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=N.getNodeFor(null==(t=re.current.over)?void 0:t.id),le=Ut({measure:K.dragOverlay.measure}),ce=null!=(n=le.nodeRef.current)?n:Z,se=B?null!=(o=le.rect)?o:te:null,fe=Boolean(le.nodeRef.current&&le.rect),pe=Ve(he=fe?null:te,Mt(he));var he;const ve=$t(ce?oe(ce):null),ye=function(e){const t=c(e),n=ue((n=>e?n&&n!==zt&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ze(e):zt),[e]);return s((()=>{t.current=e}),[e]),n}(B?null!=ie?ie:Z:null),be=function(e,t){void 0===t&&(t=Xe);const[n]=e,o=$t(n?oe(n):null),[r,i]=h((function(){return e.length?e.map((e=>ot(e)?o:new dt(t(e),e))):Ht}),Ht),l=Lt({callback:i});return e.length>0&&r===Ht&&i(),ae((()=>{e.length?e.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),i())}),[e]),r}(ye),xe=function(e,t){let{transform:n,...o}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...o})),n):n}(w,{transform:{x:_.x-pe.x,y:_.y-pe.y,scaleX:1,scaleY:1},activatorEvent:F,active:L,activeNodeRect:te,containerNodeRect:ne,draggingNodeRect:se,over:re.current.over,overlayNodeRect:le.rect,scrollableAncestors:ye,scrollableAncestorRects:be,windowRect:ve}),ke=G?me(G,_):null,Ee=function(e){const[t,n]=f(null),o=c(e),r=u((e=>{const t=Je(e.target);t&&n((e=>e?(e.set(t,tt(t)),new Map(e)):null))}),[]);return s((()=>{const t=o.current;if(e!==t){i(t);const l=e.map((e=>{const t=Je(e);return t?(t.addEventListener("scroll",r,{passive:!0}),[t,tt(t)]):null})).filter((e=>null!=e));n(l.length?new Map(l):null),o.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Je(e);null==t||t.removeEventListener("scroll",r)}))}}),[r,e]),d((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>me(e,t)),Te):at(e):Te),[e,t])}(ye),Oe=Ft(Ee),Ce=Ft(Ee,[te]),Se=me(xe,Oe),je=se?We(se,xe):null,Be=L&&je?m({active:L,collisionRect:je,droppableRects:Y,droppableContainers:V,pointerCoordinates:ke}):null,_e=ze(Be,"id"),[Ne,Me]=f(null),Le=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(fe?xe:me(xe,Ce),null!=(i=null==Ne?void 0:Ne.rect)?i:null,te),Pe=u(((e,t)=>{let{sensor:n,options:o}=t;if(null==P.current)return;const r=A.get(P.current);if(!r)return;const i=e.nativeEvent,l=new n({active:P.current,activeNode:r,event:i,options:o,context:re,onStart(e){const t=P.current;if(null==t)return;const n=A.get(t);if(!n)return;const{onDragStart:o}=H.current,r={active:{id:t,data:n.data,rect:M}};y((()=>{null==o||o(r),j(tn.Initializing),O({type:Ae.DragStart,initialCoordinates:e,active:t}),C({type:"onDragStart",event:r})}))},onMove(e){O({type:Ae.DragMove,coordinates:e})},onEnd:c(Ae.DragEnd),onCancel:c(Ae.DragCancel)});function c(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:r}=re.current;let l=null;if(t&&r){const{cancelDrop:c}=H.current;if(l={activatorEvent:i,active:t,collisions:n,delta:r,over:o},e===Ae.DragEnd&&"function"==typeof c){await Promise.resolve(c(l))&&(e=Ae.DragCancel)}}P.current=null,y((()=>{O({type:e}),j(tn.Uninitialized),Me(null),z(null),$(null);const t=e===Ae.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=H.current[t];null==e||e(l),C({type:t,event:l})}}))}}y((()=>{z(l),$(e.nativeEvent)}))}),[A]),Ie=u(((e,t)=>(n,o)=>{const r=n.nativeEvent,i=A.get(o);if(null!==P.current||!i||r.dndKit||r.defaultPrevented)return;const l={active:i};!0===e(n,t.options,l)&&(r.dndKit={capturedBy:t.sensor},P.current=o,Pe(n,t))}),[A,Pe]),Fe=function(e,t){return d((()=>e.reduce(((e,n)=>{const{sensor:o}=n;return[...e,...o.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(v,Ie);!function(e){s((()=>{if(!ee)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(v),ae((()=>{te&&D===tn.Initializing&&j(tn.Initialized)}),[te,D]),s((()=>{const{onDragMove:e}=H.current,{active:t,activatorEvent:n,collisions:o,over:r}=re.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:o,delta:{x:Se.x,y:Se.y},over:r};y((()=>{null==e||e(i),C({type:"onDragMove",event:i})}))}),[Se.x,Se.y]),s((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:r}=re.current;if(!e||null==P.current||!t||!r)return;const{onDragOver:i}=H.current,l=o.get(_e),c=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,a={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:c};y((()=>{Me(c),null==i||i(a),C({type:"onDragOver",event:a})}))}),[_e]),ae((()=>{re.current={activatorEvent:F,active:L,activeNode:Z,collisionRect:je,collisions:Be,droppableRects:Y,draggableNodes:A,draggingNode:ce,draggingNodeRect:se,droppableContainers:N,over:Ne,scrollableAncestors:ye,scrollAdjustedTranslate:Se},M.current={initial:se,translated:je}}),[L,Z,Be,je,A,ce,se,Y,N,Ne,ye,Se]),Rt({...J,delta:_,draggingRect:je,pointerCoordinates:ke,scrollableAncestors:ye,scrollableAncestorRects:be});const $e=d((()=>({active:L,activeNode:Z,activeNodeRect:te,activatorEvent:F,collisions:Be,containerNodeRect:ne,dragOverlay:le,draggableNodes:A,droppableContainers:N,droppableRects:Y,over:Ne,measureDroppableContainers:X,scrollableAncestors:ye,scrollableAncestorRects:be,measuringConfiguration:K,measuringScheduled:q,windowRect:ve})),[L,Z,te,F,Be,ne,le,A,N,Y,Ne,X,ye,be,K,q,ve]),He=d((()=>({activatorEvent:F,activators:Fe,active:L,activeNodeRect:te,ariaDescribedById:{draggable:U},dispatch:O,draggableNodes:A,over:Ne,measureDroppableContainers:X})),[F,Fe,L,te,O,U,A,Ne,X]);return r.createElement(De.Provider,{value:S},r.createElement(qt.Provider,{value:He},r.createElement(Zt.Provider,{value:$e},r.createElement(en.Provider,{value:Le},g)),r.createElement(Qt,{disabled:!1===(null==a?void 0:a.restoreFocus)})),r.createElement(Re,{...a,hiddenTextDescribedById:U}))})),on=i(null),rn="button",ln="Droppable";function cn(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e;const i=ge(ln),{activators:c,activatorEvent:a,active:s,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=l(qt),{role:g=rn,roleDescription:v="draggable",tabIndex:m=0}=null!=r?r:{},y=(null==s?void 0:s.id)===t,b=l(y?en:on),[w,x]=fe(),[k,E]=fe(),O=function(e,t){return d((()=>e.reduce(((e,n)=>{let{eventName:o,handler:r}=n;return e[o]=e=>{r(e,t)},e}),{})),[e,t])}(c,t),C=de(n);ae((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:C}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:s,activatorEvent:a,activeNodeRect:u,attributes:d((()=>({role:g,tabIndex:m,"aria-disabled":o,"aria-pressed":!(!y||g!==rn)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[o,g,m,y,v,f.draggable]),isDragging:y,listeners:o?void 0:O,node:w,over:h,setNodeRef:x,setActivatorNodeRef:E,transform:b}}const an="Droppable",sn={timeout:25};function dn(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function un(e,t){return e.reduce(((e,n,o)=>{const r=t.get(n);return r&&(e[o]=r),e}),Array(e.length))}function fn(e){return null!==e&&e>=0}const pn=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e;const i=dn(t,o,n),l=t[r],c=i[r];return c&&l?{x:c.left-l.left,y:c.top-l.top,scaleX:c.width/l.width,scaleY:c.height/l.height}:null},hn={scaleX:1,scaleY:1},gn=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:i,overIndex:l}=e;const c=null!=(t=i[n])?t:o;if(!c)return null;if(r===n){const e=i[l];return e?{x:0,y:n<l?e.top+e.height-(c.top+c.height):e.top-c.top,...hn}:null}const a=function(e,t,n){const o=e[t],r=e[t-1],i=e[t+1];if(!o)return 0;if(n<t)return r?o.top-(r.top+r.height):i?i.top-(o.top+o.height):0;return i?i.top-(o.top+o.height):r?o.top-(r.top+r.height):0}(i,r,n);return r>n&&r<=l?{x:0,y:-c.height-a,...hn}:r<n&&r>=l?{x:0,y:c.height+a,...hn}:{x:0,y:0,...hn}};const vn="Sortable",mn=r.createContext({activeIndex:-1,containerId:vn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pn,disabled:{draggable:!1,droppable:!1}});function yn(e){let{children:t,id:n,items:o,strategy:i=pn,disabled:a=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=l(Zt),v=ge(vn,n),m=Boolean(null!==f.rect),y=d((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),b=null!=u,w=u?y.indexOf(u.id):-1,x=h?y.indexOf(h.id):-1,k=c(y),E=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(y,k.current),O=-1!==x&&-1===w||E,C=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(a);ae((()=>{E&&b&&g(y)}),[E,y,b,g]),s((()=>{k.current=y}),[y]);const S=d((()=>({activeIndex:w,containerId:v,disabled:C,disableTransforms:O,items:y,overIndex:x,useDragOverlay:m,sortedRects:un(y,p),strategy:i})),[w,v,C.draggable,C.droppable,O,y,x,p,m,i]);return r.createElement(mn.Provider,{value:S},t)}const bn=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return dn(n,o,r).indexOf(t)},wn=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:i,newIndex:l,previousItems:c,previousContainerId:a,transition:s}=e;return!(!s||!o)&&((c===i||r!==l)&&(!!n||l!==r&&t===a))},xn={duration:200,easing:"ease"},kn="transform",En=xe.Transition.toString({property:kn,duration:0,easing:"linear"}),On={roleDescription:"sortable"};function Cn(e){let{animateLayoutChanges:t=wn,attributes:n,disabled:o,data:r,getNewIndex:i=bn,id:a,strategy:p,resizeObserverConfig:h,transition:g=xn}=e;const{items:v,containerId:m,activeIndex:y,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:E,strategy:O}=l(mn),C=function(e,t){var n,o;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(o=null==e?void 0:e.droppable)?o:t.droppable}}(o,b),S=v.indexOf(a),D=d((()=>({sortable:{containerId:m,index:S,items:v},...r})),[m,r,S,v]),j=d((()=>v.slice(v.indexOf(a))),[v,a]),{rect:B,node:R,isOver:A,setNodeRef:_}=function(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e;const i=ge(an),{active:a,dispatch:d,over:f,measureDroppableContainers:p}=l(qt),h=c({disabled:n}),g=c(!1),v=c(null),m=c(null),{disabled:y,updateMeasurementsFor:b,timeout:w}={...sn,...r},x=de(null!=b?b:o),k=Lt({callback:u((()=>{g.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),m.current=null}),w)):g.current=!0}),[w]),disabled:y||!a}),E=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[O,C]=fe(E),S=de(t);return s((()=>{k&&O.current&&(k.disconnect(),g.current=!1,k.observe(O.current))}),[O,k]),ae((()=>(d({type:Ae.RegisterDroppable,element:{id:o,key:i,disabled:n,node:O,rect:v,data:S}}),()=>d({type:Ae.UnregisterDroppable,key:i,id:o}))),[o]),s((()=>{n!==h.current.disabled&&(d({type:Ae.SetDroppableDisabled,id:o,key:i,disabled:n}),h.current.disabled=n)}),[o,i,n,d]),{active:a,rect:v,isOver:(null==f?void 0:f.id)===o,node:O,over:f,setNodeRef:C}}({id:a,data:D,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...h}}),{active:N,activatorEvent:T,activeNodeRect:M,attributes:L,setNodeRef:P,listeners:I,isDragging:z,over:F,setActivatorNodeRef:$,transform:H}=cn({id:a,data:D,attributes:{...On,...n},disabled:C.draggable}),U=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>e=>{t.forEach((t=>t(e)))}),t)}(_,P),V=Boolean(N),K=V&&!w&&fn(y)&&fn(k),W=!E&&z,Y=W&&K?H:null,X=K?null!=Y?Y:(null!=p?p:O)({rects:x,activeNodeRect:M,activeIndex:y,overIndex:k,index:S}):null,q=fn(y)&&fn(k)?i({id:a,items:v,activeIndex:y,overIndex:k}):S,Z=null==N?void 0:N.id,G=c({activeId:Z,items:v,newIndex:q,containerId:m}),J=v!==G.current.items,Q=t({active:N,containerId:m,isDragging:z,isSorting:V,id:a,index:S,items:v,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:g,wasDragging:null!=G.current.activeId}),ee=function(e){let{disabled:t,index:n,node:o,rect:r}=e;const[i,l]=f(null),a=c(n);return ae((()=>{if(!t&&n!==a.current&&o.current){const e=r.current;if(e){const t=Xe(o.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&l(n)}}n!==a.current&&(a.current=n)}),[t,n,o,r]),s((()=>{i&&l(null)}),[i]),i}({disabled:!Q,index:S,node:R,rect:B});return s((()=>{V&&G.current.newIndex!==q&&(G.current.newIndex=q),m!==G.current.containerId&&(G.current.containerId=m),v!==G.current.items&&(G.current.items=v)}),[V,q,m,v]),s((()=>{if(Z===G.current.activeId)return;if(Z&&!G.current.activeId)return void(G.current.activeId=Z);const e=setTimeout((()=>{G.current.activeId=Z}),50);return()=>clearTimeout(e)}),[Z]),{active:N,activeIndex:y,attributes:L,data:D,rect:B,index:S,newIndex:q,items:v,isOver:A,isSorting:V,isDragging:z,listeners:I,node:R,overIndex:k,over:F,setNodeRef:U,setActivatorNodeRef:$,setDroppableNodeRef:_,setDraggableNodeRef:P,transform:null!=ee?ee:X,transition:function(){if(ee||J&&G.current.newIndex===S)return En;if(W&&!be(T)||!g)return;if(V||Q)return xe.Transition.toString({...g,property:kn});return}()}}function Sn(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Dn=[ht.Down,ht.Right,ht.Up,ht.Left],jn=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:i,over:l,scrollableAncestors:c}}=t;if(Dn.includes(e.code)){if(e.preventDefault(),!n||!o)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=r.get(n.id);if(i)switch(e.code){case ht.Down:o.top<i.top&&t.push(n);break;case ht.Up:o.top>i.top&&t.push(n);break;case ht.Left:o.left>i.left&&t.push(n);break;case ht.Right:o.left<i.left&&t.push(n)}}));const a=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=Ie(t),i=[];for(const e of o){const{id:t}=e,o=n.get(t);if(o){const n=Ie(o),l=r.reduce(((e,t,o)=>e+Me(n[o],t)),0),c=Number((l/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:c}})}}return i.sort(Le)})({active:n,collisionRect:o,droppableRects:r,droppableContainers:t,pointerCoordinates:null});let s=ze(a,"id");if(s===(null==l?void 0:l.id)&&a.length>1&&(s=a[1].id),null!=s){const e=i.get(n.id),t=i.get(s),l=t?r.get(t.id):null,a=null==t?void 0:t.node.current;if(a&&l&&e&&t){const n=Ze(a).some(((e,t)=>c[t]!==e)),r=Bn(e,t),i=function(e,t){if(!Sn(e)||!Sn(t))return!1;if(!Bn(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),s=n||!r?{x:0,y:0}:{x:i?o.width-l.width:0,y:i?o.height-l.height:0},d={x:l.left,y:l.top};return s.x&&s.y?d:ye(d,s)}}}};function Bn(e,t){return!(!Sn(e)||!Sn(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var Rn;function An(){return An=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},An.apply(this,arguments)}var _n,Nn=function(e){return o.createElement("svg",An({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Rn||(Rn=o.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Tn.apply(this,arguments)}var Mn=function(e){return o.createElement("svg",Tn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),_n||(_n=o.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function Ln(e,t={}){const n=Object.keys(e.children),{at:o=e.selection}=t,r=n.find((t=>e.children[t].meta.order===(null==o?void 0:o[0])));if(r)return e.blockEditorsMap[r]}function Pn(e){return Fn(e)?(e.nodeName||"").toLowerCase():"#document"}function In(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function zn(e){var t;return null==(t=(Fn(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Fn(e){return e instanceof Node||e instanceof In(e).Node}function $n(e){return e instanceof Element||e instanceof In(e).Element}function Hn(e){return e instanceof HTMLElement||e instanceof In(e).HTMLElement}function Un(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof In(e).ShadowRoot)}function Vn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=qn(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function Kn(e){return["table","td","th"].includes(Pn(e))}function Wn(e){const t=Yn(),n=qn(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Yn(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Xn(e){return["html","body","#document"].includes(Pn(e))}function qn(e){return In(e).getComputedStyle(e)}function Zn(e){return $n(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Gn(e){if("html"===Pn(e))return e;const t=e.assignedSlot||e.parentNode||Un(e)&&e.host||zn(e);return Un(t)?t.host:t}function Jn(e){const t=Gn(e);return Xn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Hn(t)&&Vn(t)?t:Jn(t)}function Qn(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=Jn(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),l=In(r);return i?t.concat(l,l.visualViewport||[],Vn(r)?r:[],l.frameElement&&n?Qn(l.frameElement):[]):t.concat(r,Qn(r,[],n))}const eo=Math.min,to=Math.max,no=Math.round,oo=Math.floor,ro=e=>({x:e,y:e}),io={left:"right",right:"left",bottom:"top",top:"bottom"},lo={start:"end",end:"start"};function co(e,t,n){return to(e,eo(t,n))}function ao(e,t){return"function"==typeof e?e(t):e}function so(e){return e.split("-")[0]}function uo(e){return e.split("-")[1]}function fo(e){return"x"===e?"y":"x"}function po(e){return"y"===e?"height":"width"}function ho(e){return["top","bottom"].includes(so(e))?"y":"x"}function go(e){return fo(ho(e))}function vo(e){return e.replace(/start|end/g,(e=>lo[e]))}function mo(e){return e.replace(/left|right|bottom|top/g,(e=>io[e]))}function yo(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function bo(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function wo(e,t,n){let{reference:o,floating:r}=e;const i=ho(t),l=go(t),c=po(l),a=so(t),s="y"===i,d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,f=o[c]/2-r[c]/2;let p;switch(a){case"top":p={x:d,y:o.y-r.height};break;case"bottom":p={x:d,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-r.width,y:u};break;default:p={x:o.x,y:o.y}}switch(uo(t)){case"start":p[l]-=f*(n&&s?-1:1);break;case"end":p[l]+=f*(n&&s?-1:1)}return p}async function xo(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:a}=e,{boundary:s="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=ao(t,e),h=yo(p),g=c[f?"floating"===u?"reference":"floating":u],v=bo(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:d,strategy:a})),m="floating"===u?{...l.floating,x:o,y:r}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=bo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:m,offsetParent:y,strategy:a}):m);return{top:(v.top-w.top+h.top)/b.y,bottom:(w.bottom-v.bottom+h.bottom)/b.y,left:(v.left-w.left+h.left)/b.x,right:(w.right-v.right+h.right)/b.x}}function ko(e){const t=eo(...e.map((e=>e.left))),n=eo(...e.map((e=>e.top)));return{x:t,y:n,width:to(...e.map((e=>e.right)))-t,height:to(...e.map((e=>e.bottom)))-n}}const Eo=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=t,a=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=so(n),c=uo(n),a="y"===ho(n),s=["left","top"].includes(l)?-1:1,d=i&&a?-1:1,u=ao(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return c&&"number"==typeof h&&(p="end"===c?-1*h:h),a?{x:p*d,y:f*s}:{x:f*s,y:p*d}}(t,e);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}}}}};function Oo(e){const t=qn(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Hn(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,c=no(n)!==i||no(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function Co(e){return $n(e)?e:e.contextElement}function So(e){const t=Co(e);if(!Hn(t))return ro(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Oo(t);let l=(i?no(n.width):n.width)/o,c=(i?no(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Do=ro(0);function jo(e){const t=In(e);return Yn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Do}function Bo(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=Co(e);let l=ro(1);t&&(o?$n(o)&&(l=So(o)):l=So(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==In(e))&&t}(i,n,o)?jo(i):ro(0);let a=(r.left+c.x)/l.x,s=(r.top+c.y)/l.y,d=r.width/l.x,u=r.height/l.y;if(i){const e=In(i),t=o&&$n(o)?In(o):o;let n=e,r=n.frameElement;for(;r&&o&&t!==n;){const e=So(r),t=r.getBoundingClientRect(),o=qn(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;a*=e.x,s*=e.y,d*=e.x,u*=e.y,a+=i,s+=l,n=In(r),r=n.frameElement}}return bo({width:d,height:u,x:a,y:s})}const Ro=[":popover-open",":modal"];function Ao(e){return Ro.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function _o(e){return Bo(zn(e)).left+Zn(e).scrollLeft}function No(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=In(e),o=zn(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,c=0,a=0;if(r){i=r.width,l=r.height;const e=Yn();(!e||e&&"fixed"===t)&&(c=r.offsetLeft,a=r.offsetTop)}return{width:i,height:l,x:c,y:a}}(e,n);else if("document"===t)o=function(e){const t=zn(e),n=Zn(e),o=e.ownerDocument.body,r=to(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=to(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+_o(e);const c=-n.scrollTop;return"rtl"===qn(o).direction&&(l+=to(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(zn(e));else if($n(t))o=function(e,t){const n=Bo(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Hn(e)?So(e):ro(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=jo(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return bo(o)}function To(e,t){const n=Gn(e);return!(n===t||!$n(n)||Xn(n))&&("fixed"===qn(n).position||To(n,t))}function Mo(e,t,n){const o=Hn(t),r=zn(t),i="fixed"===n,l=Bo(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const a=ro(0);if(o||!o&&!i)if(("body"!==Pn(t)||Vn(r))&&(c=Zn(t)),o){const e=Bo(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else r&&(a.x=_o(r));return{x:l.left+c.scrollLeft-a.x,y:l.top+c.scrollTop-a.y,width:l.width,height:l.height}}function Lo(e,t){return Hn(e)&&"fixed"!==qn(e).position?t?t(e):e.offsetParent:null}function Po(e,t){const n=In(e);if(!Hn(e)||Ao(e))return n;let o=Lo(e,t);for(;o&&Kn(o)&&"static"===qn(o).position;)o=Lo(o,t);return o&&("html"===Pn(o)||"body"===Pn(o)&&"static"===qn(o).position&&!Wn(o))?n:o||function(e){let t=Gn(e);for(;Hn(t)&&!Xn(t);){if(Wn(t))return t;t=Gn(t)}return null}(e)||n}const Io={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,l=zn(o),c=!!t&&Ao(t.floating);if(o===l||c&&i)return n;let a={scrollLeft:0,scrollTop:0},s=ro(1);const d=ro(0),u=Hn(o);if((u||!u&&!i)&&(("body"!==Pn(o)||Vn(l))&&(a=Zn(o)),Hn(o))){const e=Bo(o);s=So(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-a.scrollLeft*s.x+d.x,y:n.y*s.y-a.scrollTop*s.y+d.y}},getDocumentElement:zn,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let o=Qn(e,[],!1).filter((e=>$n(e)&&"body"!==Pn(e))),r=null;const i="fixed"===qn(e).position;let l=i?Gn(e):e;for(;$n(l)&&!Xn(l);){const t=qn(l),n=Wn(l);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&["absolute","fixed"].includes(r.position)||Vn(l)&&!n&&To(e,l))?o=o.filter((e=>e!==l)):r=t,l=Gn(l)}return t.set(e,o),o}(t,this._c):[].concat(n),o],l=i[0],c=i.reduce(((e,n)=>{const o=No(t,n,r);return e.top=to(o.top,e.top),e.right=eo(o.right,e.right),e.bottom=eo(o.bottom,e.bottom),e.left=to(o.left,e.left),e}),No(t,l,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:Po,getElementRects:async function(e){const t=this.getOffsetParent||Po,n=this.getDimensions;return{reference:Mo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Oo(e);return{width:t,height:n}},getScale:So,isElement:$n,isRTL:function(e){return"rtl"===qn(e).direction}};function zo(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:a=!1}=o,s=Co(e),d=r||i?[...s?Qn(s):[],...Qn(t)]:[];d.forEach((e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=s&&c?function(e,t){let n,o=null;const r=zn(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(c,a){void 0===c&&(c=!1),void 0===a&&(a=1),i();const{left:s,top:d,width:u,height:f}=e.getBoundingClientRect();if(c||t(),!u||!f)return;const p={rootMargin:-oo(d)+"px "+-oo(r.clientWidth-(s+u))+"px "+-oo(r.clientHeight-(d+f))+"px "+-oo(s)+"px",threshold:to(0,eo(1,a))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==a){if(!h)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}h=!1}try{o=new IntersectionObserver(g,{...p,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(g,p)}o.observe(e)}(!0),i}(s,n):null;let f,p=-1,h=null;l&&(h=new ResizeObserver((e=>{let[o]=e;o&&o.target===s&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),s&&!a&&h.observe(s),h.observe(t));let g=a?Bo(e):null;return a&&function t(){const o=Bo(e);!g||o.x===g.x&&o.y===g.y&&o.width===g.width&&o.height===g.height||n();g=o,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const Fo=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...a}=ao(e,t),s={x:n,y:o},d=await xo(t,a),u=ho(so(r)),f=fo(u);let p=s[f],h=s[u];if(i){const e="y"===f?"bottom":"right";p=co(p+d["y"===f?"top":"left"],p,p-d[e])}if(l){const e="y"===u?"bottom":"right";h=co(h+d["y"===u?"top":"left"],h,h-d[e])}const g=c.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-o}}}}},$o=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:a,elements:s}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=ao(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=so(r),y=so(c)===c,b=await(null==a.isRTL?void 0:a.isRTL(s.floating)),w=f||(y||!g?[mo(c)]:function(e){const t=mo(e);return[vo(e),t,vo(t)]}(c));f||"none"===h||w.push(...function(e,t,n,o){const r=uo(e);let i=function(e,t,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:o:t?o:r;case"left":case"right":return t?i:l;default:return[]}}(so(e),"start"===n,o);return r&&(i=i.map((e=>e+"-"+r)),t&&(i=i.concat(i.map(vo)))),i}(c,g,h,b));const x=[c,...w],k=await xo(t,v),E=[];let O=(null==(o=i.flip)?void 0:o.overflows)||[];if(d&&E.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=uo(e),r=go(e),i=po(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=mo(l)),[l,mo(l)]}(r,l,b);E.push(k[e[0]],k[e[1]])}if(O=[...O,{placement:r,overflows:E}],!E.every((e=>e<=0))){var C,S;const e=((null==(C=i.flip)?void 0:C.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(S=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:S.placement;if(!n)switch(p){case"bestFit":{var D;const e=null==(D=O.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:D[0];e&&(n=e);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},Ho=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=t,{padding:c=2,x:a,y:s}=ao(e,t),d=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),u=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let o=null;for(let e=0;e<t.length;e++){const r=t[e];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map((e=>bo(ko(e))))}(d),f=bo(ko(d)),p=yo(c);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=a&&null!=s)return u.find((e=>a>e.left-p.left&&a<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===ho(n)){const e=u[0],t=u[u.length-1],o="top"===so(n),r=e.top,i=t.bottom,l=o?e.left:t.left,c=o?e.right:t.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const e="left"===so(n),t=to(...u.map((e=>e.right))),o=eo(...u.map((e=>e.left))),r=u.filter((n=>e?n.left===o:n.right===t)),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:t,width:t-o,height:l-i,x:o,y:i}}return f}},floating:o.floating,strategy:l});return r.reference.x!==h.reference.x||r.reference.y!==h.reference.y||r.reference.width!==h.reference.width||r.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Uo=(e,t,n)=>{const o=new Map,r={platform:Io,...n},i={...r.platform,_c:o};return(async(e,t,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(t));let s=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=wo(s,o,a),f=o,p={},h=0;for(let n=0;n<c.length;n++){const{name:i,fn:g}=c[n],{x:v,y:m,data:y,reset:b}=await g({x:d,y:u,initialPlacement:o,placement:f,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(s=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:r}):b.rects),({x:d,y:u}=wo(s,f,a))),n=-1)}return{x:d,y:u,placement:f,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var Vo="undefined"!=typeof document?a:s;function Ko(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;0!=o--;)if(!Ko(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;0!=o--;){const n=r[o];if(("_owner"!==n||!e.$$typeof)&&!Ko(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Wo(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yo(e,t){const n=Wo(e);return Math.round(t*n)/n}function Xo(e){const t=o.useRef(e);return Vo((()=>{t.current=e})),t}
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as i,useContext as l,useRef as a,useMemo as s,useLayoutEffect as c,useEffect as d,useCallback as u,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import{Editor as m,Element as y,Text as b,Transforms as w,Point as x,Path as k,Node as O,Range as E,createEditor as S,Operation as C}from"slate";import{ReactEditor as _,withReact as D,useSelected as j,Slate as R,Editable as A,DefaultElement as P}from"slate-react";import*as B from"react-dom";import{unstable_batchedUpdates as T,createPortal as N}from"react-dom";class M{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n,elementProps:r,events:o}=e,i=Object.assign(Object.assign({},this.plugin.options),n),l=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=l[e];if(n&&n.render){const r=t[e];let o=n.render;n.render=e=>o(Object.assign(Object.assign({},e),{extendRender:r}))}})),r&&Object.keys(r).forEach((e=>{const t=l[e];if(t){const n=r[e],o=t.props;n&&o&&(t.props=n(o))}})),o&&Object.keys(o).forEach((e=>{const t=o[e];t&&(this.plugin.events||(this.plugin.events={}),this.plugin.events[e]=t)})),new M(Object.assign(Object.assign({},this.plugin),{elements:l,options:i}))}}function L(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}const I=()=>{var e,t;return"undefined"==typeof window||"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?L():null===(t=window.crypto)||void 0===t?void 0:t.randomUUID()},z=e=>({id:I(),type:(null==e?void 0:e.type)||"paragraph",children:(null==e?void 0:e.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==e?void 0:e.props)}),F=e=>({id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[z()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});function H(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function V(e){if(!e)return;const t=H(e);return t?e[t]:void 0}function $(e,t={nodeType:"block"}){return{id:I(),type:e,children:[{text:""}],props:t}}function U(e,t,n){var r;return(null===(r=e.children)||void 0===r?void 0:r.map((e=>{const r=t[e];if(!r)throw new Error(`Element definition for ${e} not found`);return z({id:I(),type:e,props:r.props,children:r.children&&r.children.length>0?U(r,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function K(e,t,n){e.plugins[t];const r=e.blocks[t].elements,o=H(r);if(!o)throw new Error(`Root element type not found for block type ${t}`);const i=r[o];return{id:I(),type:o,props:i.props,children:i.children&&i.children.length>0?U(i,r,n):[{text:""}]}}function W(e,t,n={}){var r,o;const{at:i=e.path.current,focus:l=!1,blockData:a}=n,s=e.plugins[t],{onBeforeCreate:c,onCreate:d}=s.events||{};let u;u=a&&Array.isArray(null==a?void 0:a.value)?a.value[0]:(null==c?void 0:c(e))||K(e,t);const f={id:(null==a?void 0:a.id)||I(),type:t,value:[u],meta:{align:(null===(r=null==a?void 0:a.meta)||void 0===r?void 0:r.align)||"left",depth:(null===(o=null==a?void 0:a.meta)||void 0===o?void 0:o.depth)||0,order:"number"==typeof i?i:Object.keys(e.children).length}},p=[];return p.push({type:"insert_block",path:{current:f.meta.order},block:f}),e.applyTransforms(p),null==d||d(e,f.id),l&&e.focusBlock(f.id),f.id}function Y(e){const t=e.path.current;return"number"==typeof t&&0!==t?t-1:null}function X(e,t){e.applyTransforms([{type:"set_block_path",path:t}],{validatePaths:!1})}function q(e){try{let t;const[n,r]=m.last(e,[]);if(y.isElement(n)&&!m.isEditor(n)){const[n,o]=m.last(e,r);b.isText(n)&&(t={path:o,offset:n.text.length})}else b.isText(n)&&(t={path:r,offset:n.text.length});return t}catch(e){return{path:[0,0],offset:0}}}const Z={getPath:function(e){return e.path.current},getNextPath:function(e){const t=e.path.current;return"number"==typeof t?t+1:null},getPreviousPath:Y,isBlockSelected:function(e,t){const n=e.path.selected;return!!Array.isArray(n)&&n.includes(t.meta.order)},getSelectedPaths:function(e){return e.path.selected},isPathEmpty:function(e){return null===e.path.current},setPath:X,getLastNodePoint:q};function J(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlockSlate requires either an id or at");const n=(null==t?void 0:t.id)||Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at))),r=e.blockEditorsMap[n||""],o=e.children[n||""],i=e.blocks[(null==o?void 0:o.type)||""];if(!(null==i?void 0:i.hasCustomEditor)&&!r)throw new Error(`Slate not found with params: ${JSON.stringify(t)}`);return r}function G(e,t){const{focus:n,blockId:r,at:o}=t;if(!r&&"number"!=typeof o)throw new Error("blockId or path should be provided");const i=e.getBlock({id:r,at:o});if(!i)throw new Error("Block not found");const l=Z.getPreviousPath(e),a=null!==l?e.getBlock({at:l}):void 0,s=a?J(e,{id:null==a?void 0:a.id}):void 0,c=e.children[i.id],d=[];if(d.push({type:"delete_block",block:c,path:e.path}),e.applyTransforms(d,{validatePaths:!1}),n&&s&&a){const t=Z.getLastNodePoint(s);e.focusBlock(a.id,{focusAt:t})}}function Q(e,t,n){const r=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));if(!o||!i)return void console.warn("Invalid block ids for move operation");const l=[],a={type:"move_block",prevProperties:{id:t,order:o.meta.order},properties:{id:t,order:r}};l.push(a),e.applyTransforms(l),e.setPath({current:r})}const ee=new WeakMap;function te(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockPath:l=!0}=n,a=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor)try{const e=function(e,t){if(x.isPoint(t))return t;if(k.isPath(t))return{path:t,offset:0};const[,n]=m.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);w.select(o,e),_.focus(o)}catch(e){}l&&setTimeout((()=>{e.setPath({current:i.meta.order})}),0)};o?setTimeout((()=>a()),i):a(),ee.set(e,!0)}function ne(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));return o?e.children[o]:null}function re(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));if(o)return e.blockEditorsMap[o]}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ie={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",l="[object Date]",a="[object Function]",s="[object GeneratorFunction]",c="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",O="[object Int16Array]",E="[object Int32Array]",S="[object Uint8Array]",C="[object Uint8ClampedArray]",_="[object Uint16Array]",D="[object Uint32Array]",j=/\w*$/,R=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,P={};P[o]=P["[object Array]"]=P[y]=P[b]=P[i]=P[l]=P[w]=P[x]=P[k]=P[O]=P[E]=P[c]=P[d]=P[u]=P[p]=P[h]=P[g]=P[v]=P[S]=P[C]=P[_]=P[D]=!0,P["[object Error]"]=P[a]=P[m]=!1;var B="object"==typeof oe&&oe&&oe.Object===Object&&oe,T="object"==typeof self&&self&&self.Object===Object&&self,N=B||T||Function("return this")(),M=t&&!t.nodeType&&t,L=M&&e&&!e.nodeType&&e,I=L&&L.exports===M;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function H(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function U(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var W,Y=Array.prototype,X=Function.prototype,q=Object.prototype,Z=N["__core-js_shared__"],J=(W=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",G=X.toString,Q=q.hasOwnProperty,ee=q.toString,te=RegExp("^"+G.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=I?N.Buffer:void 0,re=N.Symbol,ie=N.Uint8Array,le=U(Object.getPrototypeOf,Object),ae=Object.create,se=q.propertyIsEnumerable,ce=Y.splice,de=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,fe=U(Object.keys,Object),pe=Ie(N,"DataView"),he=Ie(N,"Map"),ge=Ie(N,"Promise"),ve=Ie(N,"Set"),me=Ie(N,"WeakMap"),ye=Ie(Object,"create"),be=$e(pe),we=$e(he),xe=$e(ge),ke=$e(ve),Oe=$e(me),Ee=re?re.prototype:void 0,Se=Ee?Ee.valueOf:void 0;function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new _e(e)}function Re(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&We(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var l in e)!t&&!Q.call(e,l)||i&&("length"==l||He(l,r))||n.push(l);return n}function Ae(e,t,n){var r=e[t];Q.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Pe(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Be(e,t,n,r,f,m,R){var A;if(r&&(A=m?r(e,f,m,R):r(e)),void 0!==A)return A;if(!qe(e))return e;var B=Ke(e);if(B){if(A=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,A)}else{var T=Fe(e),N=T==a||T==s;if(Ye(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==u||T==o||N&&!m){if(V(e))return m?e:{};if(A=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=le(e),qe(t)?ae(t):{});var t}(N?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,Ze(t),e)}(A,e))}else{if(!P[T])return m?e:{};A=function(e,t,n,r){var o=e.constructor;switch(t){case y:return Ne(e);case i:case l:return new o(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case x:case k:case O:case E:case S:case C:case _:case D:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n($(e),!0):$(e);return H(r,z,new e.constructor)}(e,r,n);case d:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,j.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n(K(e),!0):K(e);return H(r,F,new e.constructor)}(e,r,n);case v:return a=e,Se?Object(Se.call(a)):{}}var a}(e,T,Be,t)}}R||(R=new je);var M=R.get(e);if(M)return M;if(R.set(e,A),!B)var L=n?function(e){return function(e,t,n){var r=t(e);return Ke(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,ze)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(L||e,(function(o,i){L&&(o=e[i=o]),Ae(A,i,Be(o,t,n,r,i,e,R))})),A}function Te(e){return!(!qe(e)||(t=e,J&&J in t))&&(Xe(e)||V(e)?te:R).test($e(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],a=r?r(n[l],e[l],l,n,e):void 0;Ae(n,l,void 0===a?e[l]:a)}return n}function Le(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}Ce.prototype.clear=function(){this.__data__=ye?ye(null):{}},Ce.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ce.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Ce.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Q.call(t,e)},Ce.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?n:t,this},_e.prototype.clear=function(){this.__data__=[]},_e.prototype.delete=function(e){var t=this.__data__,n=Pe(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},_e.prototype.get=function(e){var t=this.__data__,n=Pe(t,e);return n<0?void 0:t[n][1]},_e.prototype.has=function(e){return Pe(this.__data__,e)>-1},_e.prototype.set=function(e,t){var n=this.__data__,r=Pe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},De.prototype.clear=function(){this.__data__={hash:new Ce,map:new(he||_e),string:new Ce}},De.prototype.delete=function(e){return Le(this,e).delete(e)},De.prototype.get=function(e){return Le(this,e).get(e)},De.prototype.has=function(e){return Le(this,e).has(e)},De.prototype.set=function(e,t){return Le(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new _e},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof _e){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new De(r)}return n.set(e,t),this};var ze=de?U(de,Object):function(){return[]},Fe=function(e){return ee.call(e)};function He(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function $e(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=b||he&&Fe(new he)!=c||ge&&Fe(ge.resolve())!=f||ve&&Fe(new ve)!=h||me&&Fe(new me)!=m)&&(Fe=function(e){var t=ee.call(e),n=t==u?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case be:return b;case we:return c;case xe:return f;case ke:return h;case Oe:return m}return t});var Ke=Array.isArray;function We(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Xe(e)}var Ye=ue||function(){return!1};function Xe(e){var t=qe(e)?ee.call(e):"";return t==a||t==s}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return We(e)?Re(e):function(e){if(!Ve(e))return fe(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Be(e,!0,!0)}}({get exports(){return ie},set exports(e){ie=e}},ie);var le=ie;function ae(e){return le(e)}function se(e,t={}){const{focus:n=!0}=t,r=ne(e),o=t.slate||re(e);o&&r&&m.withoutNormalizing(o,(()=>{if(!o.selection)return;const t=ae(o.children),i=[],[l,a]=function(e,t){const{path:n,offset:r}=t.focus,[,...o]=n,i=JSON.parse(JSON.stringify(e[0]));function l(e,t,n){if(0!==t.length){const[r,...o]=t,[i,a]=l(e.children[r],o,n),s=e.children.slice(0,r).concat(i?[i]:[]),c=(a?[a]:[]).concat(e.children.slice(r+1));return[Object.assign(Object.assign({},e),{children:s}),Object.assign(Object.assign({},e),{children:c})]}if(O.string(e).length<=n)return[e,null];if("text"in e)return[Object.assign(Object.assign({},e),{text:e.text.slice(0,n)}),Object.assign(Object.assign({},e),{text:e.text.slice(n)})];if("link"===e.type){const[t,r]=l(e.children[0],[],n);return[Object.assign(Object.assign({},e),{children:[t]}),Object.assign(Object.assign({},e),{children:[r]})]}}const[a,s]=l(i,o,r);function c(e){return"children"in e&&(e.children=e.children.filter((e=>""!==e.text&&void 0!==e.text||e.children&&e.children.length>0)),e.children.forEach(c)),e}return[c(a),c(s)].map((e=>[e])).filter((e=>e[0].children.length>0))}(o.children,o.selection),s={id:I(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth,align:r.meta.align},value:[]};i.push({type:"split_block",prevProperties:{originalBlock:r,originalValue:t},properties:{nextBlock:s,nextSlateValue:a||[$("paragraph")],splitSlateValue:l},path:e.path}),e.applyTransforms(i),n&&e.focusBlock(s.id)}))}function ce(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=o.meta.depth+1,l={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([l])}function de(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=Math.max(0,o.meta.depth-1),l={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([l])}function ue(e){return!!e&&("object"==typeof e&&!Array.isArray(e))}function fe(e,t){const{original:n,focus:r,at:o}=t;if(!n)throw new Error("`original` should be provided");if(!n.blockId&&"number"!=typeof n.path)throw new Error("blockId or path should be provided");const{blockId:i,path:l}=n;let a=i?e.children[i]:ne(e,{at:l});if(!a)throw new Error("Block not found");const s=[],c=ae(a);return c.id=I(),c.meta.order=Array.isArray(o)&&"number"==typeof o?o:a.meta.order+1,s.push({type:"insert_block",path:{current:c.meta.order},block:c}),e.applyTransforms(s),r&&e.focusBlock(c.id,{waitExecution:!0}),c.id}function pe(e,t,n){const r=e.children[t];if(!r)return void console.warn(`Block with id ${t} does not exist.`);const o={type:"set_block_meta",id:t,properties:{},prevProperties:{}},i={type:"set_block_value",id:t,value:[]};n.meta&&(o.prevProperties=r.meta,o.properties=Object.assign(Object.assign({},r.meta),n.meta)),n.value&&(i.value=n.value);const l=[];Object.keys(o.properties).length&&l.push(o),i.value.length&&l.push(i),l.length>0&&e.applyTransforms(l,{validatePaths:!1})}const he=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&E.isCollapsed(i)){const{anchor:l}=i,a=m.above(t,{match:e=>y.isElement(e)&&m.isBlock(t,e),mode:"lowest"});if(!a)return;const[,s]=a,c=m.parent(t,s),[d]=c;if(y.isElement(d)&&!b.isText(d.children[0]))return n(r);const u=a?s:[],f={anchor:l,focus:m.start(t,u)},p=m.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return w.select(t,f),w.delete(t),void e.toggleBlock(h.type,{deleteText:!0,focus:!0})}n(r)},t};function ge(e){return he(e,D(S()))}const ve="Paragraph";function me(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:m.isEditor(t)?t.children.flatMap((t=>me(e,t,n,r))):y.isElement(t)?m.isInline(e,t)?[t]:t.children.flatMap((t=>me(e,t,n,r))):[t]}function ye(e){return y.isElement(e)?0===e.children.length||b.isText(e.children[0])?e:ye(e.children[0]):null}function be(e,t,n={}){const r=ne(e,{at:n.at||e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?ve:t;const i=e.plugins[o],{onBeforeCreate:l}=i.events||{},a=re(e,{at:r.meta.order});if(!a)throw new Error(`Slate not found for block in position ${r.meta.order}`);const s=(null==l?void 0:l(e))||K(e,o),c=me(a,a.children[0],r,e),d=ye(s);d&&(d.children=c);const u={id:I(),type:o,meta:Object.assign(Object.assign({},r.meta),{align:void 0}),value:[s]},f=ge(e);f.children=[s];const p=[{type:"delete_block",block:r,path:{current:r.meta.order}},{type:"insert_block",path:{current:r.meta.order},block:u}];return e.applyTransforms(p),n.deleteText&&w.delete(f,{at:[0,0]}),n.focus&&e.focusBlock(u.id),u.id}function we(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlock requires either an id or at");if(null==t?void 0:t.id)return e.children[null==t?void 0:t.id];const n=Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at)));return n?e.children[n]:null}function xe(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");let i=e=>y.isElement(e);(null==n?void 0:n.type)&&(i=e=>y.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=m.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function ke(e,t,n){const r=xe(e,t,n);if(r)return r[0]}const Oe={createElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?m.withoutNormalizing(i,(()=>{const l=e.blocks[o.type],a=l.elements[n.type],s=z({type:n.type,props:Object.assign(Object.assign({},a.props),n.props)}),c=Object.keys(l.elements);let d=[];c.forEach((e=>{const t=l.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=l.elements[e];d.push(z({type:e,props:t.props}))}))})),d.length>0&&(s.children=d);const{path:u,focus:f=!0}=r||{};let p;const h=xe(e,t,{type:n.type});if(h){const[,e]=h;k.isPath(u)?p=u:"prev"===u?p=k.previous(e):"next"===u&&(p=k.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&d.length>0){const n=d[0],r=xe(e,t,{path:p,type:n.type});if(r){const[,e]=r;w.select(i,e)}}})):console.warn("No slate found")},deleteElement:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});o?m.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>y.isElement(e)&&e.type===n.type})})):console.warn("No slate found")},updateElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?m.withoutNormalizing(i,(()=>{const[e]=m.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>y.isElement(e)&&e.type===n.type}),t=null==e?void 0:e[0],o=null==e?void 0:e[1],l=(null==t?void 0:t.props)||{},a={props:Object.assign(Object.assign({},l),n.props)};w.setNodes(i,a,{at:(null==r?void 0:r.path)||o||[0],match:e=>y.isElement(e)&&e.type===n.type,mode:"lowest"})})):console.warn("No slate found")},insertElementText:function(e,t,n){const{blockId:r,focus:o}=n||{},i=r?e.children[r]:ne(e);if(!i)return void console.warn(`To set text programmatically, you must provide a valid blockId. Got: ${r}`);const l=re(e,{at:i.meta.order});if(!l)return void console.warn("No slate found");const a=e.blocks[i.type],s=Array.from({length:Object.keys(a.elements).length},(e=>0));let c=l.selection||s;c?m.withoutNormalizing(l,(()=>{E.isRange(c)&&!E.isCollapsed(c)&&w.collapse(l,{edge:"end"}),w.insertText(l,t,{at:c}),o&&e.focusBlock(i.id,{waitExecution:!0,shouldUpdateBlockPath:!0})})):console.warn("No valid path or selection found for text insertion")},getElement:ke,getElementChildren:function(e,t,n){const r=ke(e,t,n);if(r)return r.children},getElementEntry:xe,isElementEmpty:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");const[i]=m.nodes(o,{at:n.path||o.selection,match:e=>y.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===m.string(o,t).trim().length}return!1},getElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(o)try{return _.findPath(o,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return console.warn("No slate found"),[];try{const e=_.findPath(o,n);return k.parent(e)}catch(e){}}};function Ee(e){var t;const n=ne(e),r=re(e,{at:e.path.current}),o=Z.getPreviousPath(e),i=re(e,{at:o}),l=ne(e,{at:o}),a=e.blocks[(null==l?void 0:l.type)||""];if(!(r&&n&&i&&l))return;const s=Oe.getElement(e,l.id);if(a&&!a.hasCustomEditor&&"void"!==(null===(t=null==s?void 0:s.props)||void 0===t?void 0:t.nodeType)){try{const e=q(i);w.select(i,e)}catch(e){w.select(i,m.start(i,[]))}m.withoutNormalizing(i,(()=>{const t=[],o=function(e,t){const n=JSON.parse(JSON.stringify(e.children)),r=JSON.parse(JSON.stringify(t.children)),o=n[n.length-1],i=r[0];return b.isText(o)&&b.isText(i)?(o.text+=i.text,[...n.slice(0,-1),o,...r.slice(1)]):[...n,...r]}(i.children[0],r.children[0]),a=[Object.assign(Object.assign({},i.children[0]),{children:o})],s=Object.assign(Object.assign({},l),{value:a});t.push({type:"merge_block",prevProperties:{sourceBlock:n,sourceSlateValue:r.children,targetBlock:l,targetSlateValue:i.children},properties:{mergedBlock:s,mergedSlateValue:a},path:e.path}),e.applyTransforms(t),e.setPath({current:l.meta.order});try{_.focus(i)}catch(e){console.error("Error setting focus:",e)}}))}}const Se={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:se,increaseBlockDepth:ce,decreaseBlockDepth:de,duplicateBlock:fe,updateBlock:pe,toggleBlock:be,getBlock:we,getBlockSlate:J,buildBlockData:function(e){var t,n,r;return{id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[{id:I(),type:(null==r?void 0:r.type)||"paragraph",children:(null==r?void 0:r.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==r?void 0:r.props)}],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:(null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.order)||0,depth:(null===(n=null==e?void 0:e.meta)||void 0===n?void 0:n.depth)||0},null==e?void 0:e.meta)}},mergeBlock:Ee};function Ce(e,t){try{_.blur(t),_.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}const _e={underline:{type:"underline",tag:"U"},strike:{type:"strike",tag:"S"},code:{type:"code",tag:"CODE"},italic:{type:"italic",tag:"I"},bold:{type:"bold",tag:"B"}};function De(e,t){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(_e).reduce(((t,n)=>e[n]?`<${_e[n].tag}>${t}</${_e[n].tag}>`:t),e.text),o;if(e.type){const i=function(e,t){return Object.values(e).find((e=>{var n,r;return e.type===(null===(r=null===(n=e.elements)||void 0===n?void 0:n[t])||void 0===r?void 0:r.rootPlugin)}))}(t,e.type);if(i&&(null===(r=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize))return o=i.parsers.html.serialize(e,De(e.children,t)),o}return o})).join("")}function je(e,t){const n=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)){const n=De(t.value[0].children,e.plugins);return o.parsers.html.serialize(t.value[0],n,t.meta)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}var Re=Symbol.for("immer-nothing"),Ae=Symbol.for("immer-draftable"),Pe=Symbol.for("immer-state");function Be(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Te=Object.getPrototypeOf;function Ne(e){return!!e&&!!e[Pe]}function Me(e){return!!e&&(Ie(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor?.[Ae]||$e(e)||Ue(e))}var Le=Object.prototype.constructor.toString();function Ie(e){if(!e||"object"!=typeof e)return!1;const t=Te(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Le}function ze(e,t){0===Fe(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Fe(e){const t=e[Pe];return t?t.type_:Array.isArray(e)?1:$e(e)?2:Ue(e)?3:0}function He(e,t){return 2===Fe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ve(e,t,n){const r=Fe(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function $e(e){return e instanceof Map}function Ue(e){return e instanceof Set}function Ke(e){return e.copy_||e.base_}function We(e,t){if($e(e))return new Map(e);if(Ue(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Ie(e)){if(!Te(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Pe];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Te(e),n)}function Ye(e,t=!1){return qe(e)||Ne(e)||!Me(e)||(Fe(e)>1&&(e.set=e.add=e.clear=e.delete=Xe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ye(t,!0)))),e}function Xe(){Be(2)}function qe(e){return Object.isFrozen(e)}var Ze,Je={};function Ge(e){const t=Je[e];return t||Be(0),t}function Qe(){return Ze}function et(e,t){t&&(Ge("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function tt(e){nt(e),e.drafts_.forEach(ot),e.drafts_=null}function nt(e){e===Ze&&(Ze=e.parent_)}function rt(e){return Ze={drafts_:[],parent_:Ze,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ot(e){const t=e[Pe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function it(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Pe].modified_&&(tt(t),Be(4)),Me(e)&&(e=lt(t,e),t.parent_||st(t,e)),t.patches_&&Ge("Patches").generateReplacementPatches_(n[Pe].base_,e,t.patches_,t.inversePatches_)):e=lt(t,n,[]),tt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Re?e:void 0}function lt(e,t,n){if(qe(t))return t;const r=t[Pe];if(!r)return ze(t,((o,i)=>at(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return st(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),ze(o,((o,l)=>at(e,r,t,o,l,n,i))),st(e,t,!1),n&&e.patches_&&Ge("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function at(e,t,n,r,o,i,l){if(Ne(o)){const l=lt(e,o,i&&t&&3!==t.type_&&!He(t.assigned_,r)?i.concat(r):void 0);if(Ve(n,r,l),!Ne(l))return;e.canAutoFreeze_=!1}else l&&n.add(o);if(Me(o)&&!qe(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;lt(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||st(e,o)}}function st(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ye(t,n)}var ct={get(e,t){if(t===Pe)return e;const n=Ke(e);if(!He(n,t))return function(e,t,n){const r=ft(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Me(r)?r:r===ut(e.base_,t)?(ht(e),e.copy_[t]=gt(r,e)):r},has:(e,t)=>t in Ke(e),ownKeys:e=>Reflect.ownKeys(Ke(e)),set(e,t,n){const r=ft(Ke(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ut(Ke(e),t),l=r?.[Pe];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||He(e.base_,t)))return!0;ht(e),pt(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==ut(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ht(e),pt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ke(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Be(11)},getPrototypeOf:e=>Te(e.base_),setPrototypeOf(){Be(12)}},dt={};function ut(e,t){const n=e[Pe];return(n?Ke(n):e)[t]}function ft(e,t){if(!(t in e))return;let n=Te(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Te(n)}}function pt(e){e.modified_||(e.modified_=!0,e.parent_&&pt(e.parent_))}function ht(e){e.copy_||(e.copy_=We(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ze(ct,((e,t)=>{dt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),dt.deleteProperty=function(e,t){return dt.set.call(this,e,t,void 0)},dt.set=function(e,t,n){return ct.set.call(this,e[0],t,n,e[0])};function gt(e,t){const n=$e(e)?Ge("MapSet").proxyMap_(e,t):Ue(e)?Ge("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Qe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ct;n&&(o=[r],i=dt);const{revoke:l,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=l,a}(e,t);return(t?t.scope_:Qe()).drafts_.push(n),n}function vt(e){if(!Me(e)||qe(e))return e;const t=e[Pe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=We(e,t.scope_.immer_.useStrictShallowCopy_)}else n=We(e,!0);return ze(n,((e,t)=>{Ve(n,e,vt(t))})),t&&(t.finalized_=!1),n}var mt=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&Be(6),void 0!==n&&"function"!=typeof n&&Be(7),Me(e)){const o=rt(this),i=gt(e,void 0);let l=!0;try{r=t(i),l=!1}finally{l?tt(o):nt(o)}return et(o,n),it(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Re&&(r=void 0),this.autoFreeze_&&Ye(r,!0),n){const t=[],o=[];Ge("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Be(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Me(e)||Be(8),Ne(e)&&(e=function(e){Ne(e)||Be(10);return vt(e)}(e));const t=rt(this),n=gt(e,void 0);return n[Pe].isManual_=!0,nt(t),n}finishDraft(e,t){const n=e&&e[Pe];n&&n.isManual_||Be(9);const{scope_:r}=n;return et(r,t),it(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Ge("Patches").applyPatches_;return Ne(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},yt=mt.produce;mt.produceWithPatches.bind(mt),mt.setAutoFreeze.bind(mt),mt.setUseStrictShallowCopy.bind(mt),mt.applyPatches.bind(mt);var bt=mt.createDraft.bind(mt),wt=mt.finishDraft.bind(mt);function xt(e,t){switch(t.type){case"set_slate":{const{properties:n,blockId:r}=t,o=e.blockEditorsMap[r];if(o){const{slateOps:e,selectionBefore:t}=n;m.withoutNormalizing(o,(()=>{for(const t of e)o.apply(t);if(t)try{w.select(o,t),_.focus(o)}catch(e){}}))}break}case"insert_block":e.blockEditorsMap[t.block.id]=ge(e),e.children[t.block.id]=t.block,e.blockEditorsMap[t.block.id].children=t.block.value,Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>=t.block.meta.order&&r.id!==t.block.id&&Ne(e.children[r.id])&&(r.meta.order=r.meta.order+1)}));break;case"delete_block":{delete e.blockEditorsMap[t.block.id],delete e.children[t.block.id];const n=Object.values(e.children);n.forEach((e=>{e.meta.order>t.block.meta.order&&(Ne(e)?e.meta.order--:yt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Ne(e.meta)?e.meta.order=t:yt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}case"set_block_value":{const{id:n,value:r,forceSlate:o}=t,i=e.blockEditorsMap[n];o&&i&&(i.children=r),Array.isArray(r)&&(Ne(e.children[n])?e.children[n].value=r:yt(e.children[n],(e=>{e.value=r})));break}case"set_block_meta":{const{id:n,properties:r}=t,o=e.children[n];if(!o)break;Ne(o)?Object.keys(r).forEach((e=>{o.meta[e]=r[e]})):yt(o,(e=>{e.meta=Object.assign(Object.assign({},e.meta),r)}));break}case"split_block":{const{properties:n}=t,r=ge(e);r.children=n.nextSlateValue,e.children[n.nextBlock.id]=Object.assign(Object.assign({},n.nextBlock),{value:r.children}),e.blockEditorsMap[n.nextBlock.id]=r;const o=e.blockEditorsMap[t.prevProperties.originalBlock.id];o.children=n.splitSlateValue,e.children[t.prevProperties.originalBlock.id].value=o.children,Object.values(e.children).forEach((e=>{e.meta.order>=n.nextBlock.meta.order&&e.id!==n.nextBlock.id&&(Ne(e)?e.meta.order++:yt(e,(e=>{e.meta.order++})))}));break}case"merge_block":{const{prevProperties:n,properties:r}=t;delete e.blockEditorsMap[n.sourceBlock.id],delete e.children[n.sourceBlock.id],e.children[r.mergedBlock.id]=r.mergedBlock,e.blockEditorsMap[r.mergedBlock.id].children=r.mergedSlateValue,Object.values(e.children).forEach((e=>{e.meta.order>r.mergedBlock.meta.order&&(Ne(e)?e.meta.order--:yt(e,(e=>{e.meta.order--})))}));break}case"move_block":{const{prevProperties:n,properties:r}=t,o=e.children[n.id];o&&(o.meta.order=r.order,Object.values(e.children).forEach((e=>{e.id!==n.id&&(n.order<r.order?e.meta.order>n.order&&e.meta.order<=r.order&&e.meta.order--:e.meta.order<n.order&&e.meta.order>=r.order&&e.meta.order++)})));break}case"set_block_path":e.path=t.path;break;case"set_editor_value":{e.children=t.properties.value;const n={};Object.keys(e.children).forEach((t=>{const r=e.children[t],o=ge(e);o.children=r.value,n[t]=o})),e.blockEditorsMap=n;break}case"validate_block_paths":{const t=Object.values(e.children);t.sort(((e,t)=>e.meta.order-t.meta.order)),t.forEach(((e,t)=>{Ne(e.meta)?e.meta.order=t:yt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const kt=100;const Ot=new WeakMap,Et=new WeakMap,St={isMergingHistory:e=>Et.get(e),isSavingHistory:e=>Ot.get(e),withMergingHistory(e,t){const n=St.isMergingHistory(e);Et.set(e,!0),t(),Et.set(e,n)},withSavingHistory(e,t){const n=St.isSavingHistory(e);Ot.set(e,!0),t(),Ot.set(e,n)},withoutMergingHistory(e,t){const n=St.isMergingHistory(e);Et.set(e,!1),t(),Et.set(e,n)},withoutSavingHistory(e,t){const n=St.isSavingHistory(e);Ot.set(e,!1),t(),Ot.set(e,n)},redo:(e,t)=>{const{redos:n}=e.historyStack;if(n.length>0){const r=n[n.length-1];St.withoutSavingHistory(e,(()=>{e.applyTransforms(r.operations,{source:"history"}),e.setPath(r.path);const{scroll:n=!0}=t||{};if(n&&"number"==typeof r.path.current){const t=Se.getBlock(e,{at:r.path.current}),n=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);n&&!Ct(n)&&n.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.pop(),e.historyStack.undos.push(r)}},undo:(e,t)=>{const{undos:n}=e.historyStack;if(n.length>0){const n=e.historyStack.undos[e.historyStack.undos.length-1];St.withoutSavingHistory(e,(()=>{const r=n.operations.flatMap((e=>function(e,t){switch(t.type){case"insert_block":return{type:"delete_block",path:t.path,block:t.block};case"delete_block":return{type:"insert_block",path:t.path,block:t.block};case"set_block_meta":return{type:"set_block_meta",id:t.id,properties:t.prevProperties,prevProperties:t.properties};case"split_block":return[{type:"delete_block",block:t.properties.nextBlock,path:t.path},{type:"set_block_value",id:t.prevProperties.originalBlock.id,value:t.prevProperties.originalValue,forceSlate:!0}];case"merge_block":return[{type:"split_block",properties:{nextBlock:t.prevProperties.sourceBlock,nextSlateValue:t.prevProperties.sourceSlateValue,splitSlateValue:t.prevProperties.targetSlateValue},prevProperties:{originalBlock:t.properties.mergedBlock,originalValue:t.properties.mergedSlateValue},path:t.path}];case"move_block":return{type:"move_block",properties:t.prevProperties,prevProperties:t.properties};case"set_slate":return{type:"set_slate",properties:{slateOps:t.properties.slateOps.map(C.inverse).reverse(),selectionBefore:t.properties.selectionBefore},slate:t.slate,blockId:t.blockId};case"set_editor_value":return{type:"set_editor_value",properties:t.prevProperties,prevProperties:t.properties};default:return t}}(0,e))).reverse();e.applyTransforms(r,{source:"history"}),e.setPath(n.path);const{scroll:o=!0}=t||{};if(o&&"number"==typeof n.path.current){const t=Se.getBlock(e,{at:n.path.current}),r=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);r&&!Ct(r)&&r.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.push(n),e.historyStack.undos.pop()}}};function Ct(e){var t=e.getBoundingClientRect(),n=document.documentElement;return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||n.clientHeight)&&t.right<=(window.innerWidth||n.clientWidth)}var _t={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,l){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,l),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,l=new Array(i);o<i;o++)l[o]=r[o].fn;return l},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,o,i,l){var a=n?n+e:e;if(!this._events[a])return!1;var s,c,d=this._events[a],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,o),!0;case 5:return d.fn.call(d.context,t,r,o,i),!0;case 6:return d.fn.call(d.context,t,r,o,i,l),!0}for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];d.fn.apply(d.context,s)}else{var f,p=d.length;for(c=0;c<p;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),u){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,o);break;default:if(!s)for(f=1,s=new Array(u-1);f<u;f++)s[f-1]=arguments[f];d[c].fn.apply(d[c].context,s)}}return!0},a.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return l(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||r&&a.context!==r||l(this,i);else{for(var s=0,c=[],d=a.length;s<d;s++)(a[s].fn!==t||o&&!a[s].once||r&&a[s].context!==r)&&c.push(a[s]);c.length?this._events[i]=1===c.length?c[0]:c:l(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&l(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}({get exports(){return _t},set exports(e){_t=e}});const Dt=new _t,jt=(e,t)=>Dt.on(e,t),Rt=(e,t)=>Dt.once(e,t),At=(e,t)=>Dt.off(e,t),Pt=(e,t)=>Dt.emit(e,t);function Bt(){const e={id:"",children:{},blockEditorsMap:{},path:{current:null},readOnly:!1,isEmpty:()=>function(e){const t=Object.values(e.children);if(t.length>1)return!1;const n=t[0];if(!n)return!0;if("Paragraph"!==n.type)return!1;const r=re(e,{at:n.meta.order});if(!r)return!0;try{return!(m.string(r,[0]).length>0)}catch(e){return!0}}(e),getEditorValue:()=>function(e){return e.children}(e),setEditorValue:(...t)=>function(e,t){let n;if(null!==t&&ue(t))n=t;else{const e=Se.buildBlockData();n={[e.id]:e}}const r={type:"set_editor_value",properties:{value:n},prevProperties:{value:e.children}};e.applyTransforms([r],{validatePaths:!0})}(e,...t),insertBlock:(...t)=>W(e,...t),deleteBlock:(...t)=>G(e,...t),duplicateBlock:(...t)=>fe(e,...t),toggleBlock:(...t)=>be(e,...t),increaseBlockDepth:(...t)=>ce(e,...t),decreaseBlockDepth:(...t)=>de(e,...t),moveBlock:(...t)=>Q(e,...t),focusBlock:(...t)=>te(e,...t),getBlock:(...t)=>we(e,...t),updateBlock:(...t)=>pe(e,...t),splitBlock:(...t)=>se(e,...t),mergeBlock:(...t)=>Ee(e,...t),setPath:(...t)=>X(e,...t),blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(t,...n)=>function(e,t,n){e.children=bt(e.children),e.path=bt(e.path);const{validatePaths:r=!0,source:o}=n||{},i=[...t];r&&i.push({type:"validate_block_paths"}),i.length>1&&i.sort(((e,t)=>"insert_block"===e.type&&"insert_block"===t.type?e.block.meta.order-t.block.meta.order:0));for(const t of i)"set_slate"===t.type&&"api"===o||xt(e,t);if(Ne(e.children)||(e.children=bt(e.children)),e.children=wt(e.children),Ne(e.path)&&(e.path=wt(e.path)),!1!==e.isSavingHistory()){const t={operations:i.filter((e=>"set_block_path"!==e.type&&"set_block_value"!==e.type&&"validate_block_paths"!==e.type)),path:e.path};t.operations.length>0&&"history"!==o&&(e.historyStack.undos.push(t),e.historyStack.redos=[]),e.historyStack.undos.length>kt&&e.historyStack.undos.shift()}const l={value:e.children,operations:i};e.emit("change",l),e.emit("path-change",e.path)}(e,t,...n),batchOperations:t=>function(e,t){const n=[];let r={};const o=e.applyTransforms;e.applyTransforms=(e,t)=>{t&&(r=t),n.push(...e)},t(),e.applyTransforms=o,n.length>0&&e.applyTransforms(n,r)}(e,t),on:(e,t)=>jt(e,t),off:(e,t)=>At(e,t),emit:(e,...t)=>Pt(e,...t),once:(e,t)=>Rt(e,t),isFocused:()=>function(e){return!!ee.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=ne(e,{at:0});t&&(ee.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:re(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Ce(e,r)),i):(ee.set(e,!1),Ce(e,r),e.emit("blur",!1))}(e,...t),getHTML:t=>je(e,t),getMarkdown:t=>function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,r;const o=e.plugins[t.type];if(o){const e=t.value[0];if(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.markdown)||void 0===r?void 0:r.serialize){const t=o.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""));if(t)return t}}return""})).join("\n")}(e,Object.values(t))}(e,t),getPlainText:t=>function(e,t){const n=je(e,t),r=document.createElement("div");return r.innerHTML=n,r.innerText}(e,t),refElement:null,historyStack:{undos:[],redos:[]},redo:t=>St.redo(e,t),undo:t=>St.undo(e,t),isSavingHistory:()=>St.isSavingHistory(e),isMergingHistory:()=>St.isMergingHistory(e),withoutSavingHistory:t=>St.withoutSavingHistory(e,t),withSavingHistory:t=>St.withSavingHistory(e,t),withoutMergingHistory:t=>St.withoutMergingHistory(e,t),withMergingHistory:t=>St.withMergingHistory(e,t)};return e}const Tt={editor:Bt()},Nt=i(Tt),Mt=({children:t,editorState:n})=>{const r=a(Tt);return r.current={editor:n.editor},e(Nt.Provider,Object.assign({value:r.current},{children:t}))},Lt=()=>{const e=l(Nt);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},It=e=>Lt().children[e],zt=()=>Lt().isFocused(),Ft=()=>Lt().readOnly,Ht=e=>{var t;return null===(t=Lt().plugins[e])||void 0===t?void 0:t.options},Vt=({blockId:e,at:t})=>{const n=Lt();if(!e&&"number"!=typeof t)throw new Error("useBlockSelected must receive either blockId or at");let r;return e&&(r=n.children[e]),t&&(r=Se.getBlock(n,{at:t})),n.path.current===(null==r?void 0:r.meta.order)};const $t="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function Ut(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Kt(e){return"nodeType"in e}function Wt(e){var t,n;return e?Ut(e)?e:Kt(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Yt(e){const{Document:t}=Wt(e);return e instanceof t}function Xt(e){return!Ut(e)&&e instanceof Wt(e).HTMLElement}function qt(e){return e instanceof Wt(e).SVGElement}function Zt(e){return e?Ut(e)?e.document:Kt(e)?Yt(e)?e:Xt(e)||qt(e)?e.ownerDocument:document:document:document}const Jt=$t?c:d;function Gt(e){const t=a(e);return Jt((()=>{t.current=e})),u((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Qt(e,t){void 0===t&&(t=[e]);const n=a(e);return Jt((()=>{n.current!==e&&(n.current=e)}),t),n}function en(e,t){const n=a();return s((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function tn(e){const t=Gt(e),n=a(null),r=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function nn(e){const t=a();return d((()=>{t.current=e}),[e]),t.current}let rn={};function on(e,t){return s((()=>{if(t)return t;const n=null==rn[e]?0:rn[e]+1;return rn[e]=n,e+"-"+n}),[e,t])}function ln(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const an=ln(1),sn=ln(-1);function cn(e){if(!e)return!1;const{KeyboardEvent:t}=Wt(e.target);return t&&e instanceof t}function dn(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Wt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const un=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[un.Translate.toString(e),un.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),fn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function pn(e){return e.matches(fn)?e:e.querySelector(fn)}const hn={display:"none"};function gn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:hn},n)}function vn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return o.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const mn=i(null);const yn={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},bn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function wn(e){let{announcements:t=bn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=yn}=e;const{announce:a,announcement:c}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=on("DndLiveRegion"),[h,g]=f(!1);if(d((()=>{g(!0)}),[]),function(e){const t=l(mn);d((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(s((()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}})),[a,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(gn,{id:r,value:i.draggable}),o.createElement(vn,{id:p,announcement:c}));return n?N(v,n):v}var xn;function kn(){}function On(e,t){return s((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(xn||(xn={}));const En=Object.freeze({x:0,y:0});function Sn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function _n(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Dn(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function jn(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Rn(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const An=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Rn(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Sn(Rn(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Cn)};function Pn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=o-r,a=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=l*a;return Number((o/(n+r-o)).toFixed(4))}return 0}const Bn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=Pn(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(_n)};function Tn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:En}function Nn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Mn=Nn(1);const Ln={ignoreTransform:!1};function In(e,t){void 0===t&&(t=Ln);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Wt(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:l,y:a}=r,s=e.left-l-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:l,bottom:a,right:s}=n;return{top:r,left:o,width:i,height:l,bottom:a,right:s}}function zn(e){return In(e,{ignoreTransform:!0})}function Fn(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(Yt(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Xt(o)||qt(o))return n;if(n.includes(o))return n;const i=Wt(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=Wt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=Wt(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Hn(e){const[t]=Fn(e,1);return null!=t?t:null}function Vn(e){return $t&&e?Ut(e)?e:Kt(e)?Yt(e)||e===Zt(e).scrollingElement?window:Xt(e)?e:null:null:null}function $n(e){return Ut(e)?e.scrollX:e.scrollLeft}function Un(e){return Ut(e)?e.scrollY:e.scrollTop}function Kn(e){return{x:$n(e),y:Un(e)}}var Wn;function Yn(e){return!(!$t||!e)&&e===document.scrollingElement}function Xn(e){const t={x:0,y:0},n=Yn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Wn||(Wn={}));const qn={x:.2,y:.2};function Zn(e,t,n,r,o){let{top:i,left:l,right:a,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=qn);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=Xn(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!c&&i<=t.top+g?(p.y=Wn.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!d&&s>=t.bottom-g&&(p.y=Wn.Forward,h.y=r*Math.abs((t.bottom-g-s)/g)),!f&&a>=t.right-v?(p.x=Wn.Forward,h.x=r*Math.abs((t.right-v-a)/v)):!u&&l<=t.left+v&&(p.x=Wn.Backward,h.x=r*Math.abs((t.left+v-l)/v)),{direction:p,speed:h}}function Jn(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Gn(e){return e.reduce(((e,t)=>an(e,Kn(t))),En)}const Qn=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+$n(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Un(t)),0)}]];class er{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Fn(t),r=Gn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Qn)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),l=r[e]-t;return this.rect[i]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class tr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function nr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var rr,or;function ir(e){e.preventDefault()}function lr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(rr||(rr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(or||(or={}));const ar={start:[or.Space,or.Enter],cancel:[or.Esc],end:[or.Space,or.Enter]},sr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case or.Right:return{...n,x:n.x+25};case or.Left:return{...n,x:n.x-25};case or.Down:return{...n,y:n.y+25};case or.Up:return{...n,y:n.y-25}}};class cr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new tr(Zt(t)),this.windowListeners=new tr(Wt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(rr.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=In),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Hn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(En)}handleKeyDown(e){if(cn(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=ar,coordinateGetter:i=sr,scrollBehavior:l="smooth"}=r,{code:a}=e;if(o.end.includes(a))return void this.handleEnd(e);if(o.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:En;this.referenceCoordinates||(this.referenceCoordinates=c);const d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=sn(d,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:a,isLeft:s,isBottom:c,maxScroll:u,minScroll:f}=Xn(n),p=Jn(n),h={x:Math.min(o===or.Right?p.right-p.width/2:p.right,Math.max(o===or.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(o===or.Down?p.bottom-p.height/2:p.bottom,Math.max(o===or.Down?p.top:p.top+p.height/2,d.y))},g=o===or.Right&&!a||o===or.Left&&!s,v=o===or.Down&&!c||o===or.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=o===or.Right&&e<=u.x||o===or.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=i?n.scrollLeft-e:o===or.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=o===or.Down&&e<=u.y||o===or.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=i?n.scrollTop-e:o===or.Down?n.scrollTop-u.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,an(sn(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function dr(e){return Boolean(e&&"distance"in e)}function ur(e){return Boolean(e&&"delay"in e)}cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ar,onActivation:o}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class fr{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Wt(e);return e instanceof t?e:Zt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=Zt(i),this.documentListeners=new tr(this.document),this.listeners=new tr(n),this.windowListeners=new tr(Wt(i)),this.initialCoordinates=null!=(r=dn(o))?r:En,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.DragStart,ir),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),this.windowListeners.add(rr.ContextMenu,ir),this.documentListeners.add(rr.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ur(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(dr(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(rr.Click,lr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:l}}=o;if(!r)return;const a=null!=(t=dn(e))?t:En,s=sn(r,a);if(!n&&l){if(dr(l)){if(null!=l.tolerance&&nr(s,l.tolerance))return this.handleCancel();if(nr(s,l.distance))return this.handleStart()}return ur(l)&&nr(s,l.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(a)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===or.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const pr={move:{name:"pointermove"},end:{name:"pointerup"}};class hr extends fr{constructor(e){const{event:t}=e,n=Zt(t.target);super(e,pr,n)}}hr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const gr={move:{name:"mousemove"},end:{name:"mouseup"}};var vr;!function(e){e[e.RightClick=2]="RightClick"}(vr||(vr={}));(class extends fr{constructor(e){super(e,gr,Zt(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==vr.RightClick&&(null==r||r({event:n}),!0)}}];const mr={move:{name:"touchmove"},end:{name:"touchend"}};var yr,br;function wr(e){let{acceleration:t,activator:n=yr.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:c=br.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=nn(t);return en((e=>{if(n||!r||!e)return xr;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wn.Backward]:e.x[Wn.Backward]||-1===o.x,[Wn.Forward]:e.x[Wn.Forward]||1===o.x},y:{[Wn.Backward]:e.y[Wn.Backward]||-1===o.y,[Wn.Forward]:e.y[Wn.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[y,b]=function(){const e=a(null);return[u(((t,n)=>{e.current=setInterval(t,n)}),[]),u((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=a({x:0,y:0}),x=a({x:0,y:0}),k=s((()=>{switch(n){case yr.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case yr.DraggableRect:return o}}),[n,o,f]),O=a(null),E=u((()=>{const e=O.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),S=s((()=>c===br.TreeOrder?[...p].reverse():p),[c,p]);d((()=>{if(i&&p.length&&k){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:a}=Zn(e,o,k,t,v);for(const e of["x","y"])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return b(),O.current=e,y(E,l),w.current=a,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,E,r,b,i,l,JSON.stringify(k),JSON.stringify(m),y,p,S,h,JSON.stringify(v)])}(class extends fr{constructor(e){super(e,mr)}static setup(){return window.addEventListener(mr.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(mr.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(yr||(yr={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(br||(br={}));const xr={x:{[Wn.Backward]:!1,[Wn.Forward]:!1},y:{[Wn.Backward]:!1,[Wn.Forward]:!1}};var kr,Or;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(kr||(kr={})),function(e){e.Optimized="optimized"}(Or||(Or={}));const Er=new Map;function Sr(e,t){return en((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Cr(e){let{callback:t,disabled:n}=e;const r=Gt(t),o=s((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return d((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function _r(e){return new er(In(e),e)}function Dr(e,t,n){void 0===t&&(t=_r);const[r,o]=h((function(r){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);if(JSON.stringify(r)===JSON.stringify(i))return r;return i}),null),i=function(e){let{callback:t,disabled:n}=e;const r=Gt(t),o=s((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return d((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),l=Cr({callback:o});return Jt((()=>{o(),e?(null==l||l.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==i||i.disconnect())}),[e]),r}const jr=[];function Rr(e,t){void 0===t&&(t=[]);const n=a(null);return d((()=>{n.current=null}),t),d((()=>{const t=e!==En;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?sn(e,n.current):En}function Ar(e){return s((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Pr=[];function Br(e){let{measure:t}=e;const[n,r]=f(null),o=u((e=>{for(const{target:n}of e)if(Xt(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=Cr({callback:o}),l=u((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xt(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[a,c]=tn(l);return s((()=>({nodeRef:a,rect:n,setRef:c})),[n,a,c])}const Tr=[{sensor:hr,options:{}},{sensor:cr,options:{}}],Nr={current:{}},Mr={draggable:{measure:zn},droppable:{measure:zn,strategy:kr.WhileDragging,frequency:Or.Optimized},dragOverlay:{measure:In}};class Lr extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Ir={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Lr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mr,measureDroppableContainers:kn,windowRect:null,measuringScheduled:!1},zr=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kn,draggableNodes:new Map,over:null,measureDroppableContainers:kn}),Fr=i(Ir);function Hr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Lr}}}function Vr(e,t){switch(t.type){case xn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case xn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case xn.DragEnd:case xn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case xn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Lr(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case xn.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new Lr(e.droppable.containers);return l.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:l}}}case xn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Lr(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function $r(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l(zr),i=nn(r),a=nn(null==n?void 0:n.id);return d((()=>{if(!t&&!r&&i&&null!=a){if(!cn(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=pn(e);if(t){t.focus();break}}}))}}),[r,t,o,a,i]),null}const Ur=i({...En,scaleX:1,scaleY:1});var Kr;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Kr||(Kr={}));const Wr=p((function(e){var t,n,r,i;let{id:l,accessibility:c,autoScroll:p=!0,children:g,sensors:v=Tr,collisionDetection:m=Bn,measuring:y,modifiers:b,...w}=e;const x=h(Vr,void 0,Hr),[k,O]=x,[E,S]=function(){const[e]=f((()=>new Set)),t=u((t=>(e.add(t),()=>e.delete(t))),[e]);return[u((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]}(),[C,_]=f(Kr.Uninitialized),D=C===Kr.Initialized,{draggable:{active:j,nodes:R,translate:A},droppable:{containers:P}}=k,B=j?R.get(j):null,N=a({initial:null,translated:null}),M=s((()=>{var e;return null!=j?{id:j,data:null!=(e=null==B?void 0:B.data)?e:Nr,rect:N}:null}),[j,B]),L=a(null),[I,z]=f(null),[F,H]=f(null),V=Qt(w,Object.values(w)),$=on("DndDescribedBy",l),U=s((()=>P.getEnabled()),[P]),K=s((()=>({draggable:{...Mr.draggable,...null==W?void 0:W.draggable},droppable:{...Mr.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Mr.dragOverlay,...null==W?void 0:W.dragOverlay}})),[null==(W=y)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:Y,measureDroppableContainers:X,measuringScheduled:q}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,l]=f(null),{frequency:s,measure:c,strategy:p}=o,h=a(e),g=function(){switch(p){case kr.Always:return!1;case kr.BeforeDragging:return n;default:return!n}}(),v=Qt(g),m=u((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),y=a(null),b=en((t=>{if(g&&!n)return Er;if(!t||t===Er||h.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new er(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,g,c]);return d((()=>{h.current=e}),[e]),d((()=>{g||m()}),[n,g]),d((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),d((()=>{g||"number"!=typeof s||null!==y.current||(y.current=setTimeout((()=>{m(),y.current=null}),s))}),[s,g,m,...r]),{droppableRects:b,measureDroppableContainers:m,measuringScheduled:null!=i}}(U,{dragging:D,dependencies:[A.x,A.y],config:K.droppable}),Z=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return en((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(R,j),J=s((()=>F?dn(F):null),[F]),G=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=D&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return Sr(e,t)}(Z,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=a(!1),{x:l,y:s}="boolean"==typeof o?{x:o,y:o}:o;Jt((()=>{if(!l&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=Tn(n(e),r);if(l||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Hn(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,l,s,r,n])}({activeNode:j?R.get(j):null,config:G.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=Dr(Z,K.draggable.measure,Q),te=Dr(Z?Z.parentElement:null),ne=a({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=P.getNodeFor(null==(t=ne.current.over)?void 0:t.id),oe=Br({measure:K.dragOverlay.measure}),ie=null!=(n=oe.nodeRef.current)?n:Z,le=D?null!=(r=oe.rect)?r:ee:null,ae=Boolean(oe.nodeRef.current&&oe.rect),se=Tn(ce=ae?null:ee,Sr(ce));var ce;const de=Ar(ie?Wt(ie):null),ue=function(e){const t=a(e),n=en((n=>e?n&&n!==jr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fn(e):jr),[e]);return d((()=>{t.current=e}),[e]),n}(D?null!=re?re:Z:null),fe=function(e,t){void 0===t&&(t=In);const[n]=e,r=Ar(n?Wt(n):null),[o,i]=h((function(){return e.length?e.map((e=>Yn(e)?r:new er(t(e),e))):Pr}),Pr),l=Cr({callback:i});return e.length>0&&o===Pr&&i(),Jt((()=>{e.length?e.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),i())}),[e]),o}(ue),pe=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(b,{transform:{x:A.x-se.x,y:A.y-se.y,scaleX:1,scaleY:1},activatorEvent:F,active:M,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:le,over:ne.current.over,overlayNodeRect:oe.rect,scrollableAncestors:ue,scrollableAncestorRects:fe,windowRect:de}),he=J?an(J,A):null,ge=function(e){const[t,n]=f(null),r=a(e),o=u((e=>{const t=Vn(e.target);t&&n((e=>e?(e.set(t,Kn(t)),new Map(e)):null))}),[]);return d((()=>{const t=r.current;if(e!==t){i(t);const l=e.map((e=>{const t=Vn(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,Kn(t)]):null})).filter((e=>null!=e));n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Vn(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),s((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>an(e,t)),En):Gn(e):En),[e,t])}(ue),ve=Rr(ge),me=Rr(ge,[ee]),ye=an(pe,ve),be=le?Mn(le,pe):null,we=M&&be?m({active:M,collisionRect:be,droppableRects:Y,droppableContainers:U,pointerCoordinates:he}):null,xe=jn(we,"id"),[ke,Oe]=f(null),Ee=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ae?pe:an(pe,me),null!=(i=null==ke?void 0:ke.rect)?i:null,ee),Se=u(((e,t)=>{let{sensor:n,options:r}=t;if(null==L.current)return;const o=R.get(L.current);if(!o)return;const i=e.nativeEvent,l=new n({active:L.current,activeNode:o,event:i,options:r,context:ne,onStart(e){const t=L.current;if(null==t)return;const n=R.get(t);if(!n)return;const{onDragStart:r}=V.current,o={active:{id:t,data:n.data,rect:N}};T((()=>{null==r||r(o),_(Kr.Initializing),O({type:xn.DragStart,initialCoordinates:e,active:t}),E({type:"onDragStart",event:o})}))},onMove(e){O({type:xn.DragMove,coordinates:e})},onEnd:a(xn.DragEnd),onCancel:a(xn.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ne.current;let l=null;if(t&&o){const{cancelDrop:a}=V.current;if(l={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===xn.DragEnd&&"function"==typeof a){await Promise.resolve(a(l))&&(e=xn.DragCancel)}}L.current=null,T((()=>{O({type:e}),_(Kr.Uninitialized),Oe(null),z(null),H(null);const t=e===xn.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=V.current[t];null==e||e(l),E({type:t,event:l})}}))}}T((()=>{z(l),H(e.nativeEvent)}))}),[R]),Ce=u(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=R.get(r);if(null!==L.current||!i||o.dndKit||o.defaultPrevented)return;const l={active:i};!0===e(n,t.options,l)&&(o.dndKit={capturedBy:t.sensor},L.current=r,Se(n,t))}),[R,Se]),_e=function(e,t){return s((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(v,Ce);!function(e){d((()=>{if(!$t)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(v),Jt((()=>{ee&&C===Kr.Initializing&&_(Kr.Initialized)}),[ee,C]),d((()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:o}=ne.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:o};T((()=>{null==e||e(i),E({type:"onDragMove",event:i})}))}),[ye.x,ye.y]),d((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ne.current;if(!e||null==L.current||!t||!o)return;const{onDragOver:i}=V.current,l=r.get(xe),a=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:a};T((()=>{Oe(a),null==i||i(s),E({type:"onDragOver",event:s})}))}),[xe]),Jt((()=>{ne.current={activatorEvent:F,active:M,activeNode:Z,collisionRect:be,collisions:we,droppableRects:Y,draggableNodes:R,draggingNode:ie,draggingNodeRect:le,droppableContainers:P,over:ke,scrollableAncestors:ue,scrollAdjustedTranslate:ye},N.current={initial:le,translated:be}}),[M,Z,we,be,R,ie,le,Y,P,ke,ue,ye]),wr({...G,delta:A,draggingRect:be,pointerCoordinates:he,scrollableAncestors:ue,scrollableAncestorRects:fe});const De=s((()=>({active:M,activeNode:Z,activeNodeRect:ee,activatorEvent:F,collisions:we,containerNodeRect:te,dragOverlay:oe,draggableNodes:R,droppableContainers:P,droppableRects:Y,over:ke,measureDroppableContainers:X,scrollableAncestors:ue,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:q,windowRect:de})),[M,Z,ee,F,we,te,oe,R,P,Y,ke,X,ue,fe,K,q,de]),je=s((()=>({activatorEvent:F,activators:_e,active:M,activeNodeRect:ee,ariaDescribedById:{draggable:$},dispatch:O,draggableNodes:R,over:ke,measureDroppableContainers:X})),[F,_e,M,ee,O,$,R,ke,X]);return o.createElement(mn.Provider,{value:S},o.createElement(zr.Provider,{value:je},o.createElement(Fr.Provider,{value:De},o.createElement(Ur.Provider,{value:Ee},g)),o.createElement($r,{disabled:!1===(null==c?void 0:c.restoreFocus)})),o.createElement(wn,{...c,hiddenTextDescribedById:$}))})),Yr=i(null),Xr="button",qr="Droppable";function Zr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=on(qr),{activators:a,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=l(zr),{role:g=Xr,roleDescription:v="draggable",tabIndex:m=0}=null!=o?o:{},y=(null==d?void 0:d.id)===t,b=l(y?Ur:Yr),[w,x]=tn(),[k,O]=tn(),E=function(e,t){return s((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(a,t),S=Qt(n);Jt((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:S}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:s((()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":!(!y||g!==Xr)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,y,v,f.draggable]),isDragging:y,listeners:r?void 0:E,node:w,over:h,setNodeRef:x,setActivatorNodeRef:O,transform:b}}const Jr="Droppable",Gr={timeout:25};function Qr(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function eo(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function to(e){return null!==e&&e>=0}const no=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Qr(t,r,n),l=t[o],a=i[o];return a&&l?{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}:null},ro={scaleX:1,scaleY:1},oo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:l}=e;const a=null!=(t=i[n])?t:r;if(!a)return null;if(o===n){const e=i[l];return e?{x:0,y:n<l?e.top+e.height-(a.top+a.height):e.top-a.top,...ro}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=l?{x:0,y:-a.height-s,...ro}:o<n&&o>=l?{x:0,y:a.height+s,...ro}:{x:0,y:0,...ro}};const io="Sortable",lo=o.createContext({activeIndex:-1,containerId:io,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:no,disabled:{draggable:!1,droppable:!1}});function ao(e){let{children:t,id:n,items:r,strategy:i=no,disabled:c=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=l(Fr),v=on(io,n),m=Boolean(null!==f.rect),y=s((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=u,w=u?y.indexOf(u.id):-1,x=h?y.indexOf(h.id):-1,k=a(y),O=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(y,k.current),E=-1!==x&&-1===w||O,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);Jt((()=>{O&&b&&g(y)}),[O,y,b,g]),d((()=>{k.current=y}),[y]);const C=s((()=>({activeIndex:w,containerId:v,disabled:S,disableTransforms:E,items:y,overIndex:x,useDragOverlay:m,sortedRects:eo(y,p),strategy:i})),[w,v,S.draggable,S.droppable,E,y,x,p,m,i]);return o.createElement(lo.Provider,{value:C},t)}const so=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Qr(n,r,o).indexOf(t)},co=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:l,previousItems:a,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((a===i||o!==l)&&(!!n||l!==o&&t===s))},uo={duration:200,easing:"ease"},fo="transform",po=un.Transition.toString({property:fo,duration:0,easing:"linear"}),ho={roleDescription:"sortable"};function go(e){let{animateLayoutChanges:t=co,attributes:n,disabled:r,data:o,getNewIndex:i=so,id:c,strategy:p,resizeObserverConfig:h,transition:g=uo}=e;const{items:v,containerId:m,activeIndex:y,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:O,strategy:E}=l(lo),S=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,b),C=v.indexOf(c),_=s((()=>({sortable:{containerId:m,index:C,items:v},...o})),[m,o,C,v]),D=s((()=>v.slice(v.indexOf(c))),[v,c]),{rect:j,node:R,isOver:A,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=on(Jr),{active:s,dispatch:c,over:f,measureDroppableContainers:p}=l(zr),h=a({disabled:n}),g=a(!1),v=a(null),m=a(null),{disabled:y,updateMeasurementsFor:b,timeout:w}={...Gr,...o},x=Qt(null!=b?b:r),k=Cr({callback:u((()=>{g.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),m.current=null}),w)):g.current=!0}),[w]),disabled:y||!s}),O=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[E,S]=tn(O),C=Qt(t);return d((()=>{k&&E.current&&(k.disconnect(),g.current=!1,k.observe(E.current))}),[E,k]),Jt((()=>(c({type:xn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:v,data:C}}),()=>c({type:xn.UnregisterDroppable,key:i,id:r}))),[r]),d((()=>{n!==h.current.disabled&&(c({type:xn.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,c]),{active:s,rect:v,isOver:(null==f?void 0:f.id)===r,node:E,over:f,setNodeRef:S}}({id:c,data:_,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...h}}),{active:B,activatorEvent:T,activeNodeRect:N,attributes:M,setNodeRef:L,listeners:I,isDragging:z,over:F,setActivatorNodeRef:H,transform:V}=Zr({id:c,data:_,attributes:{...ho,...n},disabled:S.draggable}),$=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s((()=>e=>{t.forEach((t=>t(e)))}),t)}(P,L),U=Boolean(B),K=U&&!w&&to(y)&&to(k),W=!O&&z,Y=W&&K?V:null,X=K?null!=Y?Y:(null!=p?p:E)({rects:x,activeNodeRect:N,activeIndex:y,overIndex:k,index:C}):null,q=to(y)&&to(k)?i({id:c,items:v,activeIndex:y,overIndex:k}):C,Z=null==B?void 0:B.id,J=a({activeId:Z,items:v,newIndex:q,containerId:m}),G=v!==J.current.items,Q=t({active:B,containerId:m,isDragging:z,isSorting:U,id:c,index:C,items:v,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:g,wasDragging:null!=J.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,l]=f(null),s=a(n);return Jt((()=>{if(!t&&n!==s.current&&r.current){const e=o.current;if(e){const t=In(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&l(n)}}n!==s.current&&(s.current=n)}),[t,n,r,o]),d((()=>{i&&l(null)}),[i]),i}({disabled:!Q,index:C,node:R,rect:j});return d((()=>{U&&J.current.newIndex!==q&&(J.current.newIndex=q),m!==J.current.containerId&&(J.current.containerId=m),v!==J.current.items&&(J.current.items=v)}),[U,q,m,v]),d((()=>{if(Z===J.current.activeId)return;if(Z&&!J.current.activeId)return void(J.current.activeId=Z);const e=setTimeout((()=>{J.current.activeId=Z}),50);return()=>clearTimeout(e)}),[Z]),{active:B,activeIndex:y,attributes:M,data:_,rect:j,index:C,newIndex:q,items:v,isOver:A,isSorting:U,isDragging:z,listeners:I,node:R,overIndex:k,over:F,setNodeRef:$,setActivatorNodeRef:H,setDroppableNodeRef:P,setDraggableNodeRef:L,transform:null!=ee?ee:X,transition:function(){if(ee||G&&J.current.newIndex===C)return po;if(W&&!cn(T)||!g)return;if(U||Q)return un.Transition.toString({...g,property:fo});return}()}}function vo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const mo=[or.Down,or.Right,or.Up,or.Left],yo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:l,scrollableAncestors:a}}=t;if(mo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case or.Down:r.top<i.top&&t.push(n);break;case or.Up:r.top>i.top&&t.push(n);break;case or.Left:r.left>i.left&&t.push(n);break;case or.Right:r.left<i.left&&t.push(n)}}));const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Dn(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Dn(r),l=o.reduce(((e,t,r)=>e+Sn(n[r],t)),0),a=Number((l/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:a}})}}return i.sort(Cn)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=jn(s,"id");if(c===(null==l?void 0:l.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),l=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&l&&e&&t){const n=Fn(s).some(((e,t)=>a[t]!==e)),o=bo(e,t),i=function(e,t){if(!vo(e)||!vo(t))return!1;if(!bo(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-l.width:0,y:i?r.height-l.height:0},d={x:l.left,y:l.top};return c.x&&c.y?d:sn(d,c)}}}};function bo(e,t){return!(!vo(e)||!vo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const wo=i(void 0),xo=({children:r,tools:o})=>{const i=Ft(),l=s((()=>o?Object.keys(o).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=o[t])||void 0===n?void 0:n.render})}),{}):{}),[o]),a=s((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const l=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,a=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,s=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:a},s),t):null}))),[o]);return e(wo.Provider,Object.assign({value:l},{children:t(n,{children:[a,r]})}))},ko=()=>{const e=l(wo);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function Oo(e){return Co(e)?(e.nodeName||"").toLowerCase():"#document"}function Eo(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function So(e){var t;return null==(t=(Co(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Co(e){return e instanceof Node||e instanceof Eo(e).Node}function _o(e){return e instanceof Element||e instanceof Eo(e).Element}function Do(e){return e instanceof HTMLElement||e instanceof Eo(e).HTMLElement}function jo(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Eo(e).ShadowRoot)}function Ro(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=No(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Ao(e){return["table","td","th"].includes(Oo(e))}function Po(e){const t=Bo(),n=No(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Bo(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function To(e){return["html","body","#document"].includes(Oo(e))}function No(e){return Eo(e).getComputedStyle(e)}function Mo(e){return _o(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Lo(e){if("html"===Oo(e))return e;const t=e.assignedSlot||e.parentNode||jo(e)&&e.host||So(e);return jo(t)?t.host:t}function Io(e){const t=Lo(e);return To(t)?e.ownerDocument?e.ownerDocument.body:e.body:Do(t)&&Ro(t)?t:Io(t)}function zo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Io(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=Eo(o);return i?t.concat(l,l.visualViewport||[],Ro(o)?o:[],l.frameElement&&n?zo(l.frameElement):[]):t.concat(o,zo(o,[],n))}const Fo=Math.min,Ho=Math.max,Vo=Math.round,$o=Math.floor,Uo=e=>({x:e,y:e}),Ko={left:"right",right:"left",bottom:"top",top:"bottom"},Wo={start:"end",end:"start"};function Yo(e,t,n){return Ho(e,Fo(t,n))}function Xo(e,t){return"function"==typeof e?e(t):e}function qo(e){return e.split("-")[0]}function Zo(e){return e.split("-")[1]}function Jo(e){return"x"===e?"y":"x"}function Go(e){return"y"===e?"height":"width"}function Qo(e){return["top","bottom"].includes(qo(e))?"y":"x"}function ei(e){return Jo(Qo(e))}function ti(e){return e.replace(/start|end/g,(e=>Wo[e]))}function ni(e){return e.replace(/left|right|bottom|top/g,(e=>Ko[e]))}function ri(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function oi(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function ii(e,t,n){let{reference:r,floating:o}=e;const i=Qo(t),l=ei(t),a=Go(l),s=qo(t),c="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let p;switch(s){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Zo(t)){case"start":p[l]-=f*(n&&c?-1:1);break;case"end":p[l]+=f*(n&&c?-1:1)}return p}async function li(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Xo(t,e),h=ri(p),g=a[f?"floating"===u?"reference":"floating":u],v=oi(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:s})),m="floating"===u?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=oi(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:y,strategy:s}):m);return{top:(v.top-w.top+h.top)/b.y,bottom:(w.bottom-v.bottom+h.bottom)/b.y,left:(v.left-w.left+h.left)/b.x,right:(w.right-v.right+h.right)/b.x}}function ai(e){const t=Fo(...e.map((e=>e.left))),n=Fo(...e.map((e=>e.top)));return{x:t,y:n,width:Ho(...e.map((e=>e.right)))-t,height:Ho(...e.map((e=>e.bottom)))-n}}const si=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:a}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=qo(n),a=Zo(n),s="y"===Qo(n),c=["left","top"].includes(l)?-1:1,d=i&&s?-1:1,u=Xo(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&"number"==typeof h&&(p="end"===a?-1*h:h),s?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function ci(e){const t=No(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Do(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,a=Vo(n)!==i||Vo(r)!==l;return a&&(n=i,r=l),{width:n,height:r,$:a}}function di(e){return _o(e)?e:e.contextElement}function ui(e){const t=di(e);if(!Do(t))return Uo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ci(t);let l=(i?Vo(n.width):n.width)/r,a=(i?Vo(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const fi=Uo(0);function pi(e){const t=Eo(e);return Bo()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:fi}function hi(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=di(e);let l=Uo(1);t&&(r?_o(r)&&(l=ui(r)):l=ui(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Eo(e))&&t}(i,n,r)?pi(i):Uo(0);let s=(o.left+a.x)/l.x,c=(o.top+a.y)/l.y,d=o.width/l.x,u=o.height/l.y;if(i){const e=Eo(i),t=r&&_o(r)?Eo(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=ui(o),t=o.getBoundingClientRect(),r=No(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,d*=e.x,u*=e.y,s+=i,c+=l,n=Eo(o),o=n.frameElement}}return oi({width:d,height:u,x:s,y:c})}const gi=[":popover-open",":modal"];function vi(e){return gi.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function mi(e){return hi(So(e)).left+Mo(e).scrollLeft}function yi(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Eo(e),r=So(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=Bo();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n);else if("document"===t)r=function(e){const t=So(e),n=Mo(e),r=e.ownerDocument.body,o=Ho(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ho(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+mi(e);const a=-n.scrollTop;return"rtl"===No(r).direction&&(l+=Ho(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(So(e));else if(_o(t))r=function(e,t){const n=hi(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Do(e)?ui(e):Uo(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=pi(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return oi(r)}function bi(e,t){const n=Lo(e);return!(n===t||!_o(n)||To(n))&&("fixed"===No(n).position||bi(n,t))}function wi(e,t,n){const r=Do(t),o=So(t),i="fixed"===n,l=hi(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const s=Uo(0);if(r||!r&&!i)if(("body"!==Oo(t)||Ro(o))&&(a=Mo(t)),r){const e=hi(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=mi(o));return{x:l.left+a.scrollLeft-s.x,y:l.top+a.scrollTop-s.y,width:l.width,height:l.height}}function xi(e,t){return Do(e)&&"fixed"!==No(e).position?t?t(e):e.offsetParent:null}function ki(e,t){const n=Eo(e);if(!Do(e)||vi(e))return n;let r=xi(e,t);for(;r&&Ao(r)&&"static"===No(r).position;)r=xi(r,t);return r&&("html"===Oo(r)||"body"===Oo(r)&&"static"===No(r).position&&!Po(r))?n:r||function(e){let t=Lo(e);for(;Do(t)&&!To(t);){if(Po(t))return t;t=Lo(t)}return null}(e)||n}const Oi={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=So(r),a=!!t&&vi(t.floating);if(r===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},c=Uo(1);const d=Uo(0),u=Do(r);if((u||!u&&!i)&&(("body"!==Oo(r)||Ro(l))&&(s=Mo(r)),Do(r))){const e=hi(r);c=ui(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+d.x,y:n.y*c.y-s.scrollTop*c.y+d.y}},getDocumentElement:So,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=zo(e,[],!1).filter((e=>_o(e)&&"body"!==Oo(e))),o=null;const i="fixed"===No(e).position;let l=i?Lo(e):e;for(;_o(l)&&!To(l);){const t=No(l),n=Po(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Ro(l)&&!n&&bi(e,l))?r=r.filter((e=>e!==l)):o=t,l=Lo(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],a=i.reduce(((e,n)=>{const r=yi(t,n,o);return e.top=Ho(r.top,e.top),e.right=Fo(r.right,e.right),e.bottom=Fo(r.bottom,e.bottom),e.left=Ho(r.left,e.left),e}),yi(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:ki,getElementRects:async function(e){const t=this.getOffsetParent||ki,n=this.getDimensions;return{reference:wi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ci(e);return{width:t,height:n}},getScale:ui,isElement:_o,isRTL:function(e){return"rtl"===No(e).direction}};function Ei(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=di(e),d=o||i?[...c?zo(c):[],...zo(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&a?function(e,t){let n,r=null;const o=So(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),i();const{left:c,top:d,width:u,height:f}=e.getBoundingClientRect();if(a||t(),!u||!f)return;const p={rootMargin:-$o(d)+"px "+-$o(o.clientWidth-(c+u))+"px "+-$o(o.clientHeight-(d+f))+"px "+-$o(c)+"px",threshold:Ho(0,Fo(1,s))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!h)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;l&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!s&&h.observe(c),h.observe(t));let g=s?hi(e):null;return s&&function t(){const r=hi(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const Si=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Xo(e,t),c={x:n,y:r},d=await li(t,s),u=Qo(qo(o)),f=Jo(u);let p=c[f],h=c[u];if(i){const e="y"===f?"bottom":"right";p=Yo(p+d["y"===f?"top":"left"],p,p-d[e])}if(l){const e="y"===u?"bottom":"right";h=Yo(h+d["y"===u?"top":"left"],h,h-d[e])}const g=a.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Ci=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=Xo(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=qo(o),y=qo(a)===a,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(y||!g?[ni(a)]:function(e){const t=ni(e);return[ti(e),t,ti(t)]}(a));f||"none"===h||w.push(...function(e,t,n,r){const o=Zo(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(qo(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(ti)))),i}(a,g,h,b));const x=[a,...w],k=await li(t,v),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&O.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=Zo(e),o=ei(e),i=Go(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ni(l)),[l,ni(l)]}(o,l,b);O.push(k[e[0]],k[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var S,C;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(C=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:C.placement;if(!n)switch(p){case"bestFit":{var _;const e=null==(_=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:_[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},_i=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:l}=t,{padding:a=2,x:s,y:c}=Xo(e,t),d=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map((e=>oi(ai(e))))}(d),f=oi(ai(d)),p=ri(a);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=s&&null!=c)return u.find((e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===Qo(n)){const e=u[0],t=u[u.length-1],r="top"===qo(n),o=e.top,i=t.bottom,l=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:l,right:a,width:a-l,height:i-o,x:l,y:o}}const e="left"===qo(n),t=Ho(...u.map((e=>e.right))),r=Fo(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,l=o[o.length-1].bottom;return{top:i,bottom:l,left:r,right:t,width:t-r,height:l-i,x:r,y:i}}return f}},floating:r.floating,strategy:l});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Di=(e,t,n)=>{const r=new Map,o={platform:Oi,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=ii(c,r,s),f=r,p={},h=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:v,y:m,data:y,reset:b}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:l,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:d,y:u}=ii(c,f,s))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var ji="undefined"!=typeof document?c:d;function Ri(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Ri(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Ri(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ai(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pi(e,t){const n=Ai(e);return Math.round(t*n)/n}function Bi(e){const t=r.useRef(e);return ji((()=>{t.current=e})),t}
2
2
  /*!
3
3
  * tabbable 6.2.0
4
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
5
  */
6
- var qo=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Zo="undefined"==typeof Element,Go=Zo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jo=!Zo&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Qo=function e(t,n){var o;void 0===n&&(n=!0);var r=null==t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},er=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var l=i.shift();if(!Qo(l,!1))if("SLOT"===l.tagName){var c=l.assignedElements(),a=e(c.length?c:l.children,!0,o);o.flatten?r.push.apply(r,a):r.push({scopeParent:l,candidates:a})}else{Go.call(l,qo)&&o.filter(l)&&(n||!t.includes(l))&&r.push(l);var s=l.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(l),d=!Qo(s,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(s&&d){var u=e(!0===s?l.children:s.children,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:l,candidates:u})}else i.unshift.apply(i,l.children)}}return r},tr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},nr=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!tr(e)?0:e.tabIndex},or=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},rr=function(e){return"INPUT"===e.tagName},ir=function(e){return function(e){return rr(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Jo(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},lr=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},cr=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Go.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Go.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return lr(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=Jo(e);if(l&&!l.shadowRoot&&!0===o(l))return lr(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&Jo(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var a,s,d;c=!(null===(s=l=null===(a=i=Jo(l))||void 0===a?void 0:a.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},ar=function(e,t){return!(t.disabled||Qo(t)||function(e){return rr(e)&&"hidden"===e.type}(t)||cr(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!Go.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},sr=function(e,t){return!(ir(t)||nr(t)<0||!ar(e,t))},dr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ur=function e(t){var n=[],o=[];return t.forEach((function(t,r){var i=!!t.scopeParent,l=i?t.scopeParent:t,c=function(e,t){var n=nr(e);return n<0&&t&&!tr(e)?0:n}(l,i),a=i?e(t.candidates):l;0===c?i?n.push.apply(n,a):n.push(l):o.push({documentOrder:r,tabIndex:c,item:t,isScope:i,content:a})})),o.sort(or).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},fr=function(e,t){var n;return n=(t=t||{}).getShadowRoot?er([e],t.includeContainer,{filter:sr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:dr}):function(e,t,n){if(Qo(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(qo));return t&&Go.call(e,qo)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,sr.bind(null,t)),ur(n)};const pr=o["useInsertionEffect".toString()]||(e=>e());var hr="undefined"!=typeof document?a:s;function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},gr.apply(this,arguments)}let vr=!1,mr=0;const yr=()=>"floating-ui-"+mr++;const br=o["useId".toString()]||function(){const[e,t]=o.useState((()=>vr?yr():void 0));return hr((()=>{null==e&&t(yr())}),[]),o.useEffect((()=>{vr||(vr=!0)}),[]),e};const wr=o.createContext(null),xr=o.createContext(null);function kr(e){return"data-floating-ui-"+e}function Er(e){const t=c(e);return hr((()=>{t.current=e})),t}const Or=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cr(e,t){const n=fr(e,Or());"prev"===t&&n.reverse();const o=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(r=e)?void 0:r.ownerDocument)||document));var r;return n.slice(o+1)[0]}function Sr(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Un(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function Dr(e){fr(e,Or()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function jr(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const Br={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 Rr(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Ar=o.forwardRef((function(e,t){const[n,r]=o.useState();hr((()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Rr),()=>{document.removeEventListener("keydown",Rr)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[kr("focus-guard")]:"",style:Br};return o.createElement("span",gr({},e,i))})),_r=o.createContext(null),Nr=kr("portal");function Tr(e){let{children:t,id:n,root:r=null,preserveTabOrder:i=!0}=e;const l=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,i]=o.useState(null),l=br(),c=Mr(),a=o.useRef(null);return hr((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{a.current=null}))}),[r]),hr((()=>{if(a.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(Nr,""),e.appendChild(n),a.current=n,i(n)}),[t,l]),hr((()=>{if(a.current)return;let e=n||(null==c?void 0:c.portalNode);e&&!$n(e)&&(e=e.current),e=e||document.body;let o=null;t&&(o=document.createElement("div"),o.id=t,e.appendChild(o));const r=document.createElement("div");r.id=l,r.setAttribute(Nr,""),e=o||e,e.appendChild(r),a.current=r,i(r)}),[t,n,l,c]),r}({id:n,root:r}),[c,a]=o.useState(null),s=o.useRef(null),d=o.useRef(null),u=o.useRef(null),f=o.useRef(null),p=!!c&&!c.modal&&c.open&&i&&!(!r&&!l);return o.useEffect((()=>{if(l&&i&&(null==c||!c.modal))return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&Sr(e)){("focusin"===e.type?jr:Dr)(l)}}}),[l,i,null==c?void 0:c.modal]),o.createElement(_r.Provider,{value:o.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:l,setFocusManagerState:a})),[i,l])},p&&l&&o.createElement(Ar,{"data-type":"outside",ref:s,onFocus:e=>{if(Sr(e,l)){var t;null==(t=u.current)||t.focus()}else{const e=Cr(document.body,"prev")||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),p&&l&&o.createElement("span",{"aria-owns":l.id,style:Br}),l&&b(t,l),p&&l&&o.createElement(Ar,{"data-type":"outside",ref:d,onFocus:e=>{if(Sr(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=Cr(document.body,"next")||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const Mr=()=>o.useContext(_r),Lr=new Set,Pr=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const i=br();return hr((()=>{if(!n)return;Lr.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,o=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,c=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[o]=r+"px"),e){var a,s;const e=(null==(a=window.visualViewport)?void 0:a.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(c-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{Lr.delete(i),0===Lr.size&&(Object.assign(t,{overflow:"",[o]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,c)))}}),[i,n]),o.createElement("div",gr({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ir(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:i}=e,[l,c]=o.useState(null),a=(null==(t=e.elements)?void 0:t.reference)||l,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:c}={},transform:a=!0,whileElementsMounted:s,open:d}=e,[u,f]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=o.useState(r);Ko(p,r)||h(r);const[g,v]=o.useState(null),[y,b]=o.useState(null),w=o.useCallback((e=>{e!==O.current&&(O.current=e,v(e))}),[]),x=o.useCallback((e=>{e!==C.current&&(C.current=e,b(e))}),[]),k=l||g,E=c||y,O=o.useRef(null),C=o.useRef(null),S=o.useRef(u),D=null!=s,j=Xo(s),B=Xo(i),R=o.useCallback((()=>{if(!O.current||!C.current)return;const e={placement:t,strategy:n,middleware:p};B.current&&(e.platform=B.current),Uo(O.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};A.current&&!Ko(S.current,t)&&(S.current=t,m.flushSync((()=>{f(t)})))}))}),[p,t,n,B]);Vo((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const A=o.useRef(!1);Vo((()=>(A.current=!0,()=>{A.current=!1})),[]),Vo((()=>{if(k&&(O.current=k),E&&(C.current=E),k&&E){if(j.current)return j.current(k,E,R);R()}}),[k,E,R,j,D]);const _=o.useMemo((()=>({reference:O,floating:C,setReference:w,setFloating:x})),[w,x]),N=o.useMemo((()=>({reference:k,floating:E})),[k,E]),T=o.useMemo((()=>{const e={position:n,left:0,top:0};if(!N.floating)return e;const t=Yo(N.floating,u.x),o=Yo(N.floating,u.y);return a?{...e,transform:"translate("+t+"px, "+o+"px)",...Wo(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}}),[n,a,N.floating,u.x,u.y]);return o.useMemo((()=>({...u,update:R,refs:_,elements:N,floatingStyles:T})),[u,R,_,N,T])}(e),d=o.useContext(xr),u=null!=((null==(f=o.useContext(wr))?void 0:f.id)||null);var f;const p=function(e){const t=o.useRef((()=>{}));return pr((()=>{t.current=e})),o.useCallback((function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(g.current.openEvent=t),v.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==r||r(e,t,n)})),h=o.useRef(null),g=o.useRef({}),v=o.useState((()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter((e=>e!==n)))||[])}}}()))[0],y=br(),b=o.useCallback((e=>{const t=$n(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=o.useCallback((e=>{($n(e)||null===e)&&(h.current=e,c(e)),($n(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!$n(e))&&s.refs.setReference(e)}),[s.refs]),x=o.useMemo((()=>({...s.refs,setReference:w,setPositionReference:b,domReference:h})),[s.refs,w,b]),k=o.useMemo((()=>({...s.elements,domReference:a})),[s.elements,a]),E=o.useMemo((()=>({...s,refs:x,elements:k,dataRef:g,nodeId:i,floatingId:y,events:v,open:n,onOpenChange:p})),[s,i,y,v,n,p,x,k]);return hr((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=E)})),o.useMemo((()=>({...s,context:E,refs:x,elements:k})),[s,x,k,E])}const zr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Fr(e,t){return"function"==typeof e?e(t):e}function $r(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:i=250}=t,l=("number"==typeof i?i:i.close)||0,[c,a]=o.useState(!1),[s,d]=o.useState("unmounted"),u=function(e,t){const[n,r]=o.useState(e);return e&&!n&&r(!0),o.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,l);return hr((()=>{c&&!u&&d("unmounted")}),[c,u]),hr((()=>{if(r){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}a(!0),d("close")}}),[n,r]),{isMounted:u,status:s}}function Hr(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:i,common:l,duration:c=250}=t,a=e.placement,s=a.split("-")[0],d=o.useMemo((()=>({side:s,placement:a})),[s,a]),u="number"==typeof c,f=(u?c:c.open)||0,p=(u?c:c.close)||0,[h,g]=o.useState((()=>({...Fr(l,d),...Fr(n,d)}))),{isMounted:v,status:m}=$r(e,{duration:c}),y=Er(n),b=Er(r),w=Er(i),x=Er(l);return hr((()=>{const e=Fr(y.current,d),t=Fr(w.current,d),n=Fr(x.current,d),o=Fr(b.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&g({transitionProperty:Object.keys(o).map(zr).join(","),transitionDuration:f+"ms",...n,...o}),"close"===m){const o=t||e;g({transitionProperty:Object.keys(o).map(zr).join(","),transitionDuration:p+"ms",...n,...o})}}),[p,w,y,b,x,f,m,d]),{isMounted:v,styles:h}}var Ur;function Vr(){return Vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Vr.apply(this,arguments)}var Kr=function(e){return o.createElement("svg",Vr({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ur||(Ur=o.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function Wr(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}var Yr=["color"],Xr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Yr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),qr=["color"],Zr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,qr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Gr=["color"],Jr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Gr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Qr=["color"],ei=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Qr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),ti=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o<e.rangeCount;o++)n.push(e.getRangeAt(o));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},ni={"text/plain":"Text","text/html":"Url",default:"Text"};var oi=function(e,t){var n,o,r,i,l,c,a=!1;t||(t={}),n=t.debug||!1;try{if(r=ti(),i=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),void 0===o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=ni[t.format]||ni.default;window.clipboardData.setData(r,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))})),document.body.appendChild(c),i.selectNodeContents(c),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");a=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(i):l.removeAllRanges()),c&&document.body.removeChild(c),r()}return a};function ri(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ii(e){if(!e)return;const t=ri(e);return t?e[t]:void 0}function li(e,t,n){var o;return(null===(o=e.children)||void 0===o?void 0:o.map((e=>{const o=t[e];if(!o)throw new Error(`Element definition for ${e} not found`);return J({id:G(),type:e,props:o.props,children:o.children&&o.children.length>0?li(o,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function ci(e,t,n){e.plugins[t];const o=e.blocks[t].elements,r=ri(o);if(!r)throw new Error(`Root element type not found for block type ${t}`);const i=o[r];return{id:G(),type:r,props:i.props,children:i.children&&i.children.length>0?li(i,o,n):[{text:""}]}}const ai=i(void 0),si=({children:o,tools:r})=>{const i=V(),l=d((()=>r?Object.keys(r).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=r[t])||void 0===n?void 0:n.render})}),{}):{}),[r]),c=d((()=>!r||i?null:Object.keys(r).map((t=>{var n,o,i;const l=null===(n=null==r?void 0:r[t])||void 0===n?void 0:n.tool,c=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.render,a=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:c},a),t):null}))),[r]);return e(ai.Provider,Object.assign({value:l},{children:t(n,{children:[c,o]})}))},di=()=>{const e=l(ai);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function ui({editor:e,view:t,onClose:n,mode:o="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===o&&(t=t.filter((t=>function(e,t){var n;const o=e.blocks[t];if(!o)return!1;const r=ii(o.elements);return"void"!==(null===(n=null==r?void 0:r.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,o,r,i,l,c;return{type:t,title:(null===(o=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===o?void 0:o.title)||t,description:null===(i=null===(r=e.blocks[t].options)||void 0===r?void 0:r.display)||void 0===i?void 0:i.description,icon:null===(c=null===(l=e.blocks[t].options)||void 0===l?void 0:l.display)||void 0===c?void 0:c.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{"toggle"===o&&e.blocks[t].toggle({focus:!0}),"create"===o&&e.blocks[t].create({deleteText:!0,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}function fi(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const pi=t=>{var{className:n,children:o,lockScroll:r=!0}=t,i=fi(t,["className","children","lockScroll"]);return e(Pr,Object.assign({lockScroll:r,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:o}))},hi=t=>{const[n,o]=f(!1),r=c(null),i=$();return s((()=>{o(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(r.current=document.createElement("div"),r.current.className="yoopta-overlays",e.appendChild(r.current)),()=>{r.current&&r.current.remove()}}),[]),n?e(Tr,Object.assign({id:`${t.id}-${i.id}`,root:r.current||i.refElement},{children:t.children})):null},gi=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),vi=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),mi=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),yi=["delete","duplicate","turnInto","copy"],bi=({isOpen:n,onClose:o,refs:r,style:i,actions:l=yi,children:c})=>{var a,s,d;const u=$(),p=di(),[h,g]=f(!1),{refs:v,floatingStyles:m,context:y}=Ir({placement:"right",open:h,onOpenChange:g,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:b,styles:w}=Hr(y,{duration:100});if(!n)return null;const x=P(u,{at:u.selection}),k=ii(null===(a=u.blocks[(null==x?void 0:x.type)||""])||void 0===a?void 0:a.elements),E="void"===(null===(s=null==k?void 0:k.props)||void 0===s?void 0:s.nodeType),O=p.ActionMenu,C=Object.assign(Object.assign({},m),w),S=ui({editor:u,view:"small",onClose:()=>{g(!1),o()}});return e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:o},{children:e("div",Object.assign({style:i,ref:r.setFloating,contentEditable:!1},{children:t(vi,{children:[null!==l&&t(gi,{children:[e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=u.selection;u.deleteBlock({at:e}),u.setBlockSelected(null),u.setSelection(null),o()}},{children:[e(ei,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{u.duplicateBlock({at:u.selection,focus:!0}),u.setBlockSelected(null),o()}},{children:[e(Xr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!O&&!E&&!(null===(d=u.blocks[(null==x?void 0:x.type)||""])||void 0===d?void 0:d.hasCustomEditor)&&t(mi,{children:[b&&e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:C,ref:v.setFloating},{children:e(O,Object.assign({},S))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Kr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=P(u);e&&(oi(`${window.location.origin}${window.location.pathname}#${e.id}`),u.emit("block:copy",e)),o()}},{children:[e(Jr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),c]})}))}))}))};var wi=Object.freeze({__proto__:null,BlockOptions:bi,BlockOptionsMenuContent:vi,BlockOptionsMenuGroup:gi,BlockOptionsMenuItem:mi,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const xi=({block:n,editor:o,dragHandleProps:r,onChangeActiveBlock:i,showActions:l})=>{const[c,a]=f(!1),{isActionMenuOpen:s,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:g,actionMenuRenderProps:v,ActionMenu:m}=(({editor:e})=>{const t=di().ActionMenu,[n,o]=f(!1),{refs:r,floatingStyles:i,context:l}=Ir({placement:"bottom-start",open:n,onOpenChange:o,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:c,styles:a}=Hr(l,{duration:100}),s=Object.assign(Object.assign({},i),a),d=e=>o(e),u=()=>d(!1),p=ui({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:c,actionMenuStyles:s,actionMenuRefs:r,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:o}),{refs:y,floatingStyles:b,context:x}=Ir({placement:"right-start",open:c,onOpenChange:a,middleware:[Ho(),$o(),Fo(),Eo()]}),{isMounted:k,styles:E}=Hr(x,{duration:100}),{setActivatorNodeRef:O,attributes:C,listeners:j}=r,B=Object.assign(Object.assign({},b),E);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":l,className:"yoopta-block-actions"},{children:[s&&u&&e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:g},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(m,Object.assign({},v))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=Ln(o,{at:[n.meta.order]}),r=o.blocks[n.type];if(!t)return;const i=document.querySelector(`[data-yoopta-block-id="${n.id}"]`),l=ii(r.elements);let c;r.hasCustomEditor||(c=S.string(t,[0]));const a="string"==typeof c&&0===c.trim().length;if(u&&a&&"void"!==(null===(e=null==l?void 0:l.props)||void 0===e?void 0:e.nodeType))o.setSelection([n.meta.order]),o.focusBlock(n.id),d.setReference(i),h(!0);else{const e=Q({id:G()}),t=[n.meta.order+1];o.setSelection([n.meta.order]),o.insertBlock(e,{at:t,focus:!0}),u&&setTimeout((()=>{i&&d.setReference(i.nextSibling),h(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(Mn,{})})),e("button",Object.assign({type:"button",className:"yoopta-block-actions-drag",ref:e=>{O(e),y.setReference(e)}},C,j,{onClick:e=>{e.stopPropagation(),i(n.id);const t=Ln(o,{at:[n.meta.order]});o.focusBlock(n.id),t&&setTimeout((()=>{o.blocks[n.type].hasCustomEditor||(w.blur(t),w.deselect(t),D.deselect(t)),o.setBlockSelected([n.meta.order],{only:!0}),o.setSelection([n.meta.order]),a(!0)}),10)},onMouseDown:e=>e.stopPropagation()},{children:e(Nn,{})})),e(bi,{isOpen:k,refs:y,style:B,onClose:()=>a(!1)})]}))},ki=({children:n,block:o,blockId:i})=>{var l;const c=$(),[a,s]=r.useState(null),{attributes:f,listeners:p,setNodeRef:h,setActivatorNodeRef:g,transform:v,transition:m,isOver:y,isDragging:b}=Cn({id:i,disabled:c.readOnly}),w=((e,t,n,o,r)=>d((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:o?.7:1},content:r&&!o?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,o,r]))(o,v,m,b,y),x=`yoopta-block yoopta-align-${o.meta.align||"left"}`,k=null===(l=c.selectedBlocks)||void 0===l?void 0:l.includes(o.meta.order),E=a===i,O=u((()=>{c.readOnly||s(i)}),[c.readOnly,i]),C=u((()=>{c.readOnly||s(null)}),[c.readOnly]),S=d((()=>({setActivatorNodeRef:g,attributes:f,listeners:p})),[o]);return t("div",Object.assign({ref:h,className:x,onMouseEnter:O,onMouseLeave:C,style:w.container,"data-hovered-block":E,"data-yoopta-block":!0,"data-yoopta-block-id":i,"data-yoopta-block-type":o.type},{children:[!c.readOnly&&e(xi,{block:o,editor:c,dragHandleProps:S,showActions:E,onChangeActiveBlock:s}),e("div",Object.assign({style:w.content},{children:n})),k&&!c.readOnly&&e("div",{className:"yoopta-selection-block"})]}))};var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});for(var Oi="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ci={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Si={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Oi?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Di={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},ji=1;ji<20;ji++)Di["f"+ji]=111+ji;function Bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var o=e.map((function(e){return Ri(e,t)})),r=function(e){return o.some((function(t){return Ai(t,e)}))};return null==n?r:r(n)}function Ri(e,t){var n=t&&t.byKey,o={},r=(e=e.replace("++","+add")).split("+"),i=r.length;for(var l in Ci)o[Ci[l]]=!1;var c=!0,a=!1,s=void 0;try{for(var d,u=r[Symbol.iterator]();!(c=(d=u.next()).done);c=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ni(f),g=Ci[h];if(f.length>1&&!g&&!Si[f]&&!Di[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?o.key=h:o.which=_i(f)),g&&(o[g]=!p||null)}}catch(e){a=!0,s=e}finally{try{!c&&u.return&&u.return()}finally{if(a)throw s}}return o}function Ai(e,t){for(var n in e){var o=e[n],r=void 0;if(null!=o&&((null!=(r="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===o&&93===t.which?91:t.which:t[n])||!1!==o)&&r!==o))return!1}return!0}function _i(e){return e=Ni(e),Di[e]||e.toUpperCase().charCodeAt(0)}function Ni(e){return e=e.toLowerCase(),e=Si[e]||e}Ei.default=Bi,Ei.isHotkey=Bi,Ei.isCodeHotkey=function(e,t){return Bi(e,t)};var Ti=Ei.isKeyHotkey=function(e,t){return Bi(e,{byKey:!0},t)};Ei.parseHotkey=Ri,Ei.compareHotkey=Ai,Ei.toKeyCode=_i,Ei.toKeyName=Ni;const Mi={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},Li={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Pi={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ii=e=>{const t=Mi[e],n=Li[e],o=Pi[e],r=t&&Ti(t),i=n&&Ti(n),l=o&&Ti(o);return e=>!(!r||!r(e))||(!(!i||!i(e))||!(!l||!l(e)))},zi={isBold:Ii("bold"),isCompose:Ii("compose"),isArrowLeft:Ii("arrowLeft"),isArrowRight:Ii("arrowRight"),isArrowUp:Ii("arrowUp"),isArrowDown:Ii("arrowDown"),isDeleteBackward:Ii("deleteBackward"),isDeleteForward:Ii("deleteForward"),isDeleteLineBackward:Ii("deleteLineBackward"),isDeleteLineForward:Ii("deleteLineForward"),isDeleteWordBackward:Ii("deleteWordBackward"),isDeleteWordForward:Ii("deleteWordForward"),isExtendBackward:Ii("extendBackward"),isExtendForward:Ii("extendForward"),isExtendLineBackward:Ii("extendLineBackward"),isExtendLineForward:Ii("extendLineForward"),isItalic:Ii("italic"),isMoveLineBackward:Ii("moveLineBackward"),isMoveLineForward:Ii("moveLineForward"),isCtrlLeft:Ii("ctrlLeft"),isCtrlRight:Ii("ctrlRight"),isRedo:Ii("redo"),isShiftEnter:Ii("shiftEnter"),isEnter:Ii("enter"),isTransposeCharacter:Ii("transposeCharacter"),isUndo:Ii("undo"),isSpace:Ii("space"),isSelect:Ii("select"),isTab:Ii("tab"),isShiftTab:Ii("shiftTab"),isBackspace:Ii("backspace"),isCmdEnter:Ii("cmdEnter"),isCmd:Ii("cmd"),isEscape:Ii("escape"),isSlashCommand:Ii("slashCommand"),isShiftArrowUp:Ii("shiftArrowUp"),isShiftArrowDown:Ii("shiftArrowDown"),isCopy:Ii("copy"),isCut:Ii("cut"),isShiftDelete:Ii("shiftDelete"),isCmdShiftEnter:Ii("cmdShiftEnter"),isCmdShiftRight:Ii("cmdShiftRight"),isCmdShiftLeft:Ii("cmdShiftLeft"),isCmdShiftDelete:Ii("cmdShiftDelete"),isCmdAltDelete:Ii("cmdAltDelete"),isCmdShiftD:Ii("cmdShiftD")};const Fi={onKeyDown:function(e){return t=>{const n=Ln(e,{at:e.selection});if(!n||!n.selection)return;const o=j.parent(n.selection.anchor.path);if(zi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(zi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const r=S.isStart(n,n.selection.anchor,o),i=S.isEnd(n,n.selection.anchor,o);if(!r&&!i)return void e.splitBlock({slate:n,focus:!0});const l=Q({id:G()}),c=e.selection?[e.selection[0]+1]:[0];e.insertBlock(l,{at:c,slate:n,focus:!0})}else if(zi.isBackspace(t)){if(t.isDefaultPrevented())return;const o=j.parent(n.selection.anchor.path);if(S.isStart(n,n.selection.anchor,o)){t.preventDefault();const r=S.string(n,o),i=e.selection?e.selection[0]-1:0,l=Ln(e,{at:[i]}),c=P(e,{at:[i]}),a=e.blocks[(null==c?void 0:c.type)||""];let s;if(l&&!a.hasCustomEditor&&(s=function(e,t){try{const[,n]=S.last(e,t);return{path:n,offset:S.string(e,n).length}}catch(e){return{path:[0,0],offset:0}}}(l,o)),0===r.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:s});{if(B.isExpanded(n.selection))return D.delete(n,{at:n.selection});const t=e.selection?e.selection[0]-1:0,o=P(e,{at:[t]}),r=e.blocks[(null==o?void 0:o.type)||""];if(r&&r.hasCustomEditor)return;if(!l)return;if(0===S.string(l,[0,0]).length)return e.deleteBlock({at:[t],focus:!0,focusAt:s});const i=Array.from(S.nodes(n,{at:[0],match:e=>!S.isEditor(e)&&(R.isText(e)||S.isInline(n,e)),mode:"highest"})).map((([e])=>e));return D.insertNodes(l,i,{at:S.end(l,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:s})}}}else{if(zi.isSelect(t)){if(t.isDefaultPrevented())return;const[,o]=S.first(n,[0]),[,r]=S.last(n,[n.children.length-1]),i=S.range(n,o,r),l=B.equals(n.selection,i),c=0===S.string(n,i).trim().length;if(B.isExpanded(n.selection)&&l||c)return t.preventDefault(),w.blur(n),w.deselect(n),D.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(zi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(zi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(zi.isArrowUp(t)){if(t.isDefaultPrevented())return;if(1===new Set(n.selection.anchor.path).size){const n=e.selection?[e.selection[0]-1]:null,o=Ln(e,{at:n}),r=P(e,{at:n});if(o&&r){const[,n]=S.last(o,[0]),i={path:n,offset:S.string(o,n).length};return t.preventDefault(),void e.focusBlock(r.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(zi.isArrowDown(t)){if(t.isDefaultPrevented())return;const o=j.parent(n.selection.anchor.path);if(S.isEnd(n,n.selection.anchor,o)){const n=e.selection?[e.selection[0]+1]:null,r=Ln(e,{at:n}),i=P(e,{at:n});if(r&&i){const n=function(e,t){try{const[,n]=S.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(r,o);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(B.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Ti(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},$i=({children:t,attributes:n,placeholder:o})=>{const r=x(),i=Object.assign({},n);return r&&o&&(i["data-placeholder"]=o,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))},Hi=new WeakMap;function Ui(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Vi={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"}},Ki=["left","center","right",void 0];function Wi(e,t,n,o){var r,i;let l;if(t.parse){l=t.parse(n,e);if(A.isElement(l)&&"inline"===(null===(r=l.props)||void 0===r?void 0:r.nodeType))return l}const c=e.blocks[t.type],a=ri(c.elements)||"",s=c.elements[a],d="void"===(null===(i=s.props)||void 0===i?void 0:i.nodeType);let u={id:G(),type:a,children:d&&!c.hasCustomEditor?[{text:""}]:o.map(Xi).flat(),props:Object.assign({nodeType:"block"},s.props)};if(l)if(A.isElement(l))u=l;else if(Array.isArray(l)){return l}if(0===u.children.length&&(u.children=[{text:""}]),!l&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Q({id:G(),type:t.type,value:[u],meta:{order:0,depth:p,align:Ki.includes(f)?f:void 0}})}function Yi(e,t,n){var o;if(3===n.nodeType){return{text:null===(o=n.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const r=n;let i=Array.from(r.childNodes).map((n=>Yi(e,t,n))).flat().filter(Boolean);if(Vi[r.nodeName]){const e=Vi[r.nodeName].type;return i.map((t=>"string"==typeof t?{[e]:!0,text:t}:t.text?Object.assign(Object.assign({},t),{[e]:!0}):t))}const l=t[r.nodeName];if(l){if(Array.isArray(l)){return l.map((t=>Wi(e,t,r,i))).filter(Boolean)}return Wi(e,l,r,i)}return i}function Xi(e){if("string"==typeof e)return{text:e};if(A.isElement(e))return e;if(Array.isArray(e))return e.map(Xi).flat();if(null==e?void 0:e.text)return e;if(Ui(e)){return e.value[0].children.map(Xi).flat()}return{text:""}}function qi(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const o=e.plugins[n],{parsers:r}=o;if(r){const{html:e}=r;if(e){const{deserialize:o}=e;if(o){const{nodeNames:e}=o;e&&e.forEach((e=>{const r=t[e];if(r){const i=Array.isArray(r)?r:[r];t[e]=[...i,{type:n,parse:o.parse}]}else t[e]={type:n,parse:o.parse}}))}}}})),t}(e);return Yi(e,n,t).flat().filter(Ui)}function Zi(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}const Gi=(e,t,n)=>{var o,r,i,l;(e=>{const[t]=S.nodes(e,{match:e=>!S.isEditor(e)&&A.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{D.unwrapNodes(e,{match:e=>!S.isEditor(e)&&A.isElement(e)&&"link"===e.type})})(t);const{selection:c}=t,a=c&&B.isCollapsed(c),s=null===(l=null===(i=null===(r=null===(o=e.plugins)||void 0===o?void 0:o.LinkPlugin)||void 0===r?void 0:r.elements)||void 0===i?void 0:i.link)||void 0===l?void 0:l.props,d={type:"link",children:a?[{text:n}]:[],props:{url:n,target:(null==s?void 0:s.target)||"_self",rel:(null==s?void 0:s.rel)||"noopener noreferrer"}};a?D.insertNodes(t,d):(D.wrapNodes(t,d,{split:!0}),D.collapse(t,{edge:"end"}))},Ji=(e,t,n,o,r)=>d((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:l,insertText:c,apply:a}=i,s=Object.keys(o);return s.forEach((e=>{var n;const r=null===(n=o[e].props)||void 0===n?void 0:n.nodeType,l="inline"===r,c="void"===r,a="inlineVoid"===r;a&&(i.markableVoid=t=>t.type===e),(c||a)&&(i.isVoid=t=>t.type===e),(l||a)&&(i.isInline=t=>t.type===e,i=((e,t)=>{const{insertData:n,insertText:o}=t;return t.insertText=n=>{n&&Zi(n)?Gi(e,t,n):o(n)},t.insertData=o=>{const r=o.getData("text/plain");r&&Zi(r)?Gi(e,t,r):n(o)},t})(t,i))})),i.insertText=e=>{Array.isArray(t.selectedBlocks)&&t.setBlockSelected(null),c(e)},i.apply=e=>{_.isSelectionOperation(e)&&Array.isArray(t.selectedBlocks)&&i.selection&&B.isExpanded(i.selection)&&t.setBlockSelected(null),a(e)},i.normalizeNode=e=>{const[o,r]=e,c=t.blocks[n.type].elements;if(Object.keys(c).length>1)return l(e);if(A.isElement(o)){const{type:e}=o,t=ri(c);if(!s.includes(e))return void D.setNodes(i,{type:t,props:Object.assign({},o.props)},{at:r});if(o.type===t)for(const[e,t]of N.children(i,r))if(A.isElement(e)&&!i.isInline(e))return void D.unwrapNodes(i,{at:t})}l(e)},r&&(i=r(i,t,e)),i}),[o,e,r]),Qi=({id:t,customEditor:n,elements:o,marks:r,events:i,options:l,extensions:a,placeholder:s="Type '/' for commands"})=>{var f,p;const h=$(),g=H(t);let v=c(g.value).current;const m=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),y=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(r)),[r]),b=Ji(t,h,g,o,a),w=((e,t,n,o)=>d((()=>{if(!e||t.readOnly)return{};const r=fi(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:zi,currentBlock:n,defaultBlock:Q({id:G()})},l={};return Object.keys(r).forEach((e=>{l[e]=function(n){r[e]&&r[e](t,o,i)(n)}})),l}),[e,t,n]))(i,h,g,b),x=u((e=>{h.updateBlock(t,{value:e})}),[t,h]),k=u((n=>{const o=m[n.element.type],{attributes:r}=n,i=fi(n,["attributes"]);return r["data-element-type"]=i.element.type,o?e(o,Object.assign({},i,{attributes:r,blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(O,Object.assign({},i,{attributes:r}))}),[o,b.children]),E=u((t=>{var n,o,r,i,l;let{children:c,leaf:a,attributes:d}=t;const u=fi(a,["text"]),f=(null===(n=h.selection)||void 0===n?void 0:n[0])===g.meta.order;u&&Object.keys(u).forEach((e=>{const t=y[e];t&&(c=t.render({children:c,leaf:a}))}));const p=!("void"===(null===(l=null===(i=null===(r=null===(o=t.children)||void 0===o?void 0:o.props)||void 0===r?void 0:r.parent)||void 0===i?void 0:i.props)||void 0===l?void 0:l.nodeType))&&f&&a.withPlaceholder;return e($i,Object.assign({attributes:d,placeholder:p?s:void 0},{children:c}))}),[r]),C=u((e=>{var t;h.readOnly||(null===(t=w.onKeyDown)||void 0===t||t.call(w,e),Fi.onKeyDown(h)(e))}),[w.onKeyDown,h.readOnly,null===(f=h.selection)||void 0===f?void 0:f[0],g.meta.order]),D=u((e=>{var t;h.readOnly||null===(t=null==w?void 0:w.onKeyUp)||void 0===t||t.call(w,e)}),[w.onKeyUp,h.readOnly]),j=u((e=>{var t;h.readOnly||(e.preventDefault(),null===(t=null==w?void 0:w.onBlur)||void 0===t||t.call(w,e))}),[w.onBlur,h.readOnly]),R=u((e=>{var t;h.readOnly||(h.isFocused()||(Hi.set(h,!0),h.emit("focus",!0)),null===(t=null==w?void 0:w.onFocus)||void 0===t||t.call(w,e))}),[w.onFocus,h.readOnly]),A=u((e=>{var t;if(h.readOnly)return;null===(t=null==w?void 0:w.onPaste)||void 0===t||t.call(w,e);const n=e.clipboardData.getData("text/html"),o=(new DOMParser).parseFromString(n,"text/html");if(o.body.childNodes.length>0){const t=qi(h,o.body);if(t.length>0)return e.preventDefault(),void h.insertBlocks(t,{at:h.selection,focus:!0})}}),[w.onPaste,h.readOnly]),_=u((e=>{var t;const n=[];if(h.readOnly)return n;const[o,r]=e,i=(null===(t=h.selection)||void 0===t?void 0:t[0])===g.meta.order;return b.selection&&i&&!S.isEditor(o)&&""===S.string(b,[r[0]])&&B.includes(b.selection,r)&&B.isCollapsed(b.selection)&&n.push(Object.assign(Object.assign({},b.selection),{withPlaceholder:!0})),n}),[h.readOnly,null===(p=h.selection)||void 0===p?void 0:p[0],g.meta.order]);return e(el,{id:t,slate:b,initialValue:v,onChange:x,decorate:_,renderLeaf:E,renderElement:k,eventHandlers:w,onKeyDown:C,onKeyUp:D,onFocus:R,onBlur:j,customEditor:n,readOnly:h.readOnly,onPaste:A})},el=p((({id:t,slate:n,initialValue:o,onChange:r,renderLeaf:i,renderElement:l,eventHandlers:c,onKeyDown:a,onKeyUp:s,onFocus:d,onBlur:u,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(k,Object.assign({editor:n,initialValue:o,onChange:r},{children:e(E,Object.assign({renderElement:l,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},c,{onKeyDown:a,onKeyUp:s,onFocus:d,decorate:h,onBlur:u,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));el.displayName="SlateEditorInstance";const tl=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>[...t].filter((e=>null!=e))),[...t])}(Ne(Ot,{activationConstraint:{distance:20}}),Ne(bt,{coordinateGetter:jn})),handleDragEnd:u((t=>{const{active:n,over:o}=t;if(n&&o&&n.id!==o.id){const t=e.children[o.id].meta.order;e.moveBlock(n.id,[t])}}),[]),handleDragStart:u((t=>{e.setBlockSelected(null)}),[])}),nl=[],ol=({editor:t,marks:o,placeholder:r})=>{const i=V(),{sensors:l,handleDragEnd:c,handleDragStart:a}=tl({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?nl:s.sort(((e,n)=>t.children[e].meta.order-t.children[n].meta.order))),[s]),f=[];for(let n=0;n<u.length;n++){const i=u[n],l=t.children[i],c=t.plugins[l.type];l&&c?f.push(e(ki,Object.assign({block:l,blockId:i},{children:e(Qi,{type:l.type,id:i,marks:o,customEditor:c.customEditor,events:c.events,elements:c.elements,options:c.options,extensions:c.extensions,placeholder:r},i)}),i)):console.error(`Plugin ${l.type} not found`)}return i?e(n,{children:f}):e(nn,Object.assign({id:"yoopta-dnd-context",sensors:l,collisionDetection:$e,onDragStart:a,onDragEnd:c},{children:e(yn,Object.assign({disabled:i,items:u,strategy:gn},{children:f}))}))},rl=({editor:e,root:t})=>{const[n,o]=f({origin:[0,0],coords:[0,0],selection:!1}),r=r=>{var i;if(e.readOnly||!1===t)return;const l=null===(i=e.refElement)||void 0===i?void 0:i.contains(r.target);if(!l&&!n.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();l||o({origin:[r.pageX,r.pageY-window.pageYOffset],coords:[r.pageX,r.pageY-window.pageYOffset],selection:!0})},i=r=>{if(!n.selection||e.readOnly||!1===t)return;o((e=>Object.assign(Object.assign({},e),{coords:[r.pageX,r.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var o;const r=[],i=null===(o=e.refElement)||void 0===o?void 0:o.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,o)=>{if(!e)return;const i=e.getBoundingClientRect(),l=Math.min(t[1],n[1]),c=Math.min(t[0],n[0]),a=Math.max(t[1],n[1]),s=Math.max(t[0],n[0]);l<i.bottom&&a>i.top&&c<i.right&&s>i.left&&r.push(o)})),r):r})(e,n.origin,[r.pageX,r.pageY-window.pageYOffset]);e.setBlockSelected(i,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var n;if(e.readOnly||!1===t)return;const o=t&&"current"in t?t.current:t||document;if(!o)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in o))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=e.refElement)||void 0===n?void 0:n.contains(o))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return o.addEventListener("mousedown",r),o.addEventListener("mousemove",i),o.addEventListener("mouseup",l),()=>{o.removeEventListener("mousedown",r),o.removeEventListener("mousemove",i),o.removeEventListener("mouseup",l)}}),[e.selectedBlocks,n,t,e.readOnly]);const c=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:c})},il=({origin:t,coords:n,isOpen:o})=>{if(!o)return null;const r={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:r})};var ll=Symbol.for("immer-nothing"),cl=Symbol.for("immer-draftable"),al=Symbol.for("immer-state");function sl(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dl=Object.getPrototypeOf;function ul(e){return!!e&&!!e[al]}function fl(e){return!!e&&(hl(e)||Array.isArray(e)||!!e[cl]||!!e.constructor?.[cl]||bl(e)||wl(e))}var pl=Object.prototype.constructor.toString();function hl(e){if(!e||"object"!=typeof e)return!1;const t=dl(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===pl}function gl(e,t){0===vl(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function vl(e){const t=e[al];return t?t.type_:Array.isArray(e)?1:bl(e)?2:wl(e)?3:0}function ml(e,t){return 2===vl(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function yl(e,t,n){const o=vl(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function bl(e){return e instanceof Map}function wl(e){return e instanceof Set}function xl(e){return e.copy_||e.base_}function kl(e,t){if(bl(e))return new Map(e);if(wl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&hl(e)){if(!dl(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[al];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(dl(e),n)}function El(e,t=!1){return Cl(e)||ul(e)||!fl(e)||(vl(e)>1&&(e.set=e.add=e.clear=e.delete=Ol),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>El(t,!0)))),e}function Ol(){sl(2)}function Cl(e){return Object.isFrozen(e)}var Sl,Dl={};function jl(e){const t=Dl[e];return t||sl(0),t}function Bl(){return Sl}function Rl(e,t){t&&(jl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Al(e){_l(e),e.drafts_.forEach(Tl),e.drafts_=null}function _l(e){e===Sl&&(Sl=e.parent_)}function Nl(e){return Sl={drafts_:[],parent_:Sl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Tl(e){const t=e[al];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ml(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[al].modified_&&(Al(t),sl(4)),fl(e)&&(e=Ll(t,e),t.parent_||Il(t,e)),t.patches_&&jl("Patches").generateReplacementPatches_(n[al].base_,e,t.patches_,t.inversePatches_)):e=Ll(t,n,[]),Al(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ll?e:void 0}function Ll(e,t,n){if(Cl(t))return t;const o=t[al];if(!o)return gl(t,((r,i)=>Pl(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Il(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),gl(r,((r,l)=>Pl(e,o,t,r,l,n,i))),Il(e,t,!1),n&&e.patches_&&jl("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Pl(e,t,n,o,r,i,l){if(ul(r)){const l=Ll(e,r,i&&t&&3!==t.type_&&!ml(t.assigned_,o)?i.concat(o):void 0);if(yl(n,o,l),!ul(l))return;e.canAutoFreeze_=!1}else l&&n.add(r);if(fl(r)&&!Cl(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ll(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Il(e,r)}}function Il(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&El(t,n)}var zl={get(e,t){if(t===al)return e;const n=xl(e);if(!ml(n,t))return function(e,t,n){const o=Hl(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!fl(o)?o:o===$l(e.base_,t)?(Vl(e),e.copy_[t]=Kl(o,e)):o},has:(e,t)=>t in xl(e),ownKeys:e=>Reflect.ownKeys(xl(e)),set(e,t,n){const o=Hl(xl(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=$l(xl(e),t),l=o?.[al];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(i=o)?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==n||ml(e.base_,t)))return!0;Vl(e),Ul(e)}var r,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==$l(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Vl(e),Ul(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=xl(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){sl(11)},getPrototypeOf:e=>dl(e.base_),setPrototypeOf(){sl(12)}},Fl={};function $l(e,t){const n=e[al];return(n?xl(n):e)[t]}function Hl(e,t){if(!(t in e))return;let n=dl(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=dl(n)}}function Ul(e){e.modified_||(e.modified_=!0,e.parent_&&Ul(e.parent_))}function Vl(e){e.copy_||(e.copy_=kl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}gl(zl,((e,t)=>{Fl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fl.deleteProperty=function(e,t){return Fl.set.call(this,e,t,void 0)},Fl.set=function(e,t,n){return zl.set.call(this,e[0],t,n,e[0])};function Kl(e,t){const n=bl(e)?jl("MapSet").proxyMap_(e,t):wl(e)?jl("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Bl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=zl;n&&(r=[o],i=Fl);const{revoke:l,proxy:c}=Proxy.revocable(r,i);return o.draft_=c,o.revoke_=l,c}(e,t);return(t?t.scope_:Bl()).drafts_.push(n),n}function Wl(e){if(!fl(e)||Cl(e))return e;const t=e[al];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=kl(e,t.scope_.immer_.useStrictShallowCopy_)}else n=kl(e,!0);return gl(n,((e,t)=>{yl(n,e,Wl(t))})),t&&(t.finalized_=!1),n}var Yl=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&sl(6),void 0!==n&&"function"!=typeof n&&sl(7),fl(e)){const r=Nl(this),i=Kl(e,void 0);let l=!0;try{o=t(i),l=!1}finally{l?Al(r):_l(r)}return Rl(r,n),Ml(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===ll&&(o=void 0),this.autoFreeze_&&El(o,!0),n){const t=[],r=[];jl("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}sl(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;return[this.produce(e,t,((e,t)=>{n=e,o=t})),n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){fl(e)||sl(8),ul(e)&&(e=function(e){ul(e)||sl(10);return Wl(e)}(e));const t=Nl(this),n=Kl(e,void 0);return n[al].isManual_=!0,_l(t),n}finishDraft(e,t){const n=e&&e[al];n&&n.isManual_||sl(9);const{scope_:o}=n;return Rl(o,t),Ml(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=jl("Patches").applyPatches_;return ul(e)?o(e,t):this.produce(e,(e=>o(e,t)))}};Yl.produce,Yl.produceWithPatches.bind(Yl),Yl.setAutoFreeze.bind(Yl),Yl.setUseStrictShallowCopy.bind(Yl),Yl.applyPatches.bind(Yl);var Xl=Yl.createDraft.bind(Yl),ql=Yl.finishDraft.bind(Yl);
7
- /*!
8
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
9
- *
10
- * Copyright (c) 2014-2017, Jon Schlinkert.
11
- * Released under the MIT License.
12
- */
13
- function Zl(e){return"[object Object]"===Object.prototype.toString.call(e)}var Gl={isHistory(e){return!1!==Zl(t=e)&&(void 0===(n=t.constructor)||!1!==Zl(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf"))&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||_.isOperationList(e.redos[0].operations))&&(0===e.undos.length||_.isOperationList(e.undos[0].operations));var t,n,o}},Jl=new WeakMap,Ql=new WeakMap,ec={isHistoryEditor:e=>Gl.isHistory(e.history)&&S.isEditor(e),isMerging:e=>Ql.get(e),isSaving:e=>Jl.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=ec.isMerging(e);Ql.set(e,!1),t(),Ql.set(e,n)},withoutSaving(e,t){var n=ec.isSaving(e);Jl.set(e,!1),t(),Jl.set(e,n)}},tc=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var o=n[n.length-1];o.selectionBefore&&D.setSelection(t,o.selectionBefore),ec.withoutSaving(t,(()=>{S.withoutNormalizing(t,(()=>{for(var e of o.operations)t.apply(e)}))})),e.redos.pop(),t.writeHistory("undos",o)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var o=n[n.length-1];ec.withoutSaving(t,(()=>{S.withoutNormalizing(t,(()=>{var e=o.operations.map(_.inverse).reverse();for(var n of e)t.apply(n);o.selectionBefore&&D.setSelection(t,o.selectionBefore)}))})),t.writeHistory("redos",o),e.undos.pop()}},t.apply=e=>{var{operations:o,history:r}=t,{undos:i}=r,l=i[i.length-1],c=l&&l.operations[l.operations.length-1],a=ec.isSaving(t),s=ec.isMerging(t);if(null==a&&(a=oc(e)),a){if(null==s&&(s=null!=l&&(0!==o.length||nc(e,c))),l&&s)l.operations.push(e);else{var d={operations:[e],selectionBefore:t.selection};t.writeHistory("undos",d)}for(;i.length>100;)i.shift();r.redos=[]}n(e)},t.writeHistory=(e,n)=>{t.history[e].push(n)},t},nc=(e,t)=>!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!j.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!j.equals(e.path,t.path)),oc=(e,t)=>"set_selection"!==e.type;const rc=(e,t)=>{const{insertText:n}=t;return t.insertText=o=>{var r;const{selection:i}=t;if(" "===o&&i&&B.isCollapsed(i)){const{anchor:l}=i,c=S.above(t,{match:e=>A.isElement(e)&&S.isBlock(t,e),mode:"lowest"});if(!c)return;const[,a]=c,s=S.parent(t,a),[d]=s;if(A.isElement(d)&&!R.isText(d.children[0]))return n(o);const u=c?a:[],f={anchor:l,focus:S.start(t,u)},p=S.string(t,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(!!h&&!h.isActive())return D.select(t,f),D.delete(t),e.blocks[h.type].toggle({focus:!0}),void Ec.createBlock(e,h.type,{deleteText:!1,focus:!0})}n(o)},t};function ic(e){return rc(e,tc(C(T())))}function lc(e,t,n={}){e.children=Xl(e.children);const{at:o=null,focus:r=!1,slate:i=null}=n,l=P(e),c=e.plugins[t.type].events||{},{onCreate:a}=c,s=o,d={id:G(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let u=!1;if(i&&i.selection){const e=S.string(i,i.selection.anchor.path);u=S.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(s){const[t]=s;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),d.meta.order=t}else{const t=Object.keys(e.children).length;d.meta.order=t}const f=ic(e);e.blockEditorsMap[d.id]=f,u&&l&&(d.meta.order=l.meta.order,l.meta.order+=1),e.children[d.id]=d;const p=null==l?void 0:l.id;e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),null==a||a(e,d.id),r&&e.focusBlock(u&&p?p:d.id)}function cc(e,t={}){const{at:n=e.selection,deleteAll:o=!1,fromPaths:r,focus:i}=t;if(Array.isArray(r)&&r.length>0){e.children=Xl(e.children),r.forEach((t=>{const n=P(e,{at:[t]});if(n){const t=e.plugins[n.type].events||{},{onDestroy:o}=t;null==o||o(e,n.id),delete e.children[n.id],delete e.blockEditorsMap[n.id]}}));return Object.keys(e.children).forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=ql(e.children),e.applyChanges(),void e.emit("change",e.children)}if(o||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=Q({id:G()}),n=ic(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.setBlockSelected(null),e.focusBlock(t.id,{slate:n,waitExecution:!0}),e.applyChanges(),void e.emit("change",e.children)}if(!n)return;e.children=Xl(e.children);const[l]=n,c=Object.keys(e.children),a=c.find((t=>e.children[t].meta.order===l));if(c.forEach((t=>{const n=e.children[t];n.meta.order>l&&(n.meta.order-=1)})),a){const t=e.children[a],n=e.plugins[t.type].events||{},{onDestroy:o}=n;null==o||o(e,a),delete e.children[a],delete e.blockEditorsMap[a]}if(e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,o=P(e,{at:[n]});o&&e.focusBlock(o.id,{focusAt:t.focusAt})}}function ac(e,t={}){const{deleteAll:n=!1,paths:o,blockIds:r,focus:i=!0}=t;if(n||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=Q({id:G()}),n=ic(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t.id,{waitExecution:!0}))}if(Array.isArray(r)&&r.length>0){e.children=Xl(e.children),r.forEach((t=>{delete e.children[t],delete e.blockEditorsMap[t]}));const t=Object.keys(e.children).sort(((t,n)=>e.children[t].meta.order>e.children[n].meta.order?1:-1));return t.forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t[0],{waitExecution:!0}))}if(Array.isArray(o)&&o.length>0){e.children=Xl(e.children),o.forEach((t=>{const n=P(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));const t=Object.keys(e.children).sort(((t,n)=>e.children[t].meta.order>e.children[n].meta.order?1:-1));return t.forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t[0],{waitExecution:!0}))}}function sc(e,t,n){e.children=Xl(e.children);const[o]=n,r=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===o)),l=r.meta.order<i.meta.order,c=r.meta.order>i.meta.order;Object.values(e.children).forEach((e=>{l?e.meta.order>r.meta.order&&e.meta.order<=i.meta.order&&e.meta.order--:c&&e.meta.order<r.meta.order&&e.meta.order>=i.meta.order&&e.meta.order++})),r.meta.order=o,r.meta.depth=i.meta.depth,e.setSelection([o]),e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children)}function dc(e,t,n={}){try{const{focusAt:o,waitExecution:r=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:l=!0}=n,c=()=>{const r=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!r||!i)return;if(!e.blocks[i.type].hasCustomEditor){const e=function(e,t){if(M.isPoint(t))return t;if(j.isPath(t))return{path:t,offset:0};const[,n]=S.first(e,[0]);return{path:n||[0,0],offset:0}}(r,o);D.select(r,e),w.focus(r)}l&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};r?setTimeout((()=>c()),i):c(),Hi.set(e,!0)}catch(e){}}function uc(e,t={}){const{slate:n,focus:o=!0}=t,r=P(e);n&&n.selection&&r&&S.withoutNormalizing(n,(()=>{e.children=Xl(e.children);const t=j.parent(n.selection.anchor.path);D.splitNodes(n,{at:n.selection,match:e=>A.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,l=n.children.slice()[i];D.removeNodes(n,{at:[i],match:e=>A.isElement(e),mode:"highest"});const c={id:G(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth,align:r.meta.align},value:[l]};Object.values(e.children).forEach((e=>{e.meta.order>=c.meta.order&&(e.meta.order+=1)}));const a=ic(e);e.blockEditorsMap[c.id]=a,e.children[c.id]=c,e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(c.id,{slate:a})}))}function fc(e,t={}){const{at:n=e.selection,blockId:o=""}=t;if(!o&&!n)return;e.children=Xl(e.children);const r=e.children[o]||P(e);r&&(r.meta.depth=r.meta.depth+1,e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children))}function pc(e,t={}){const{at:n=e.selection,blockId:o=""}=t;if(!o&&!n)return;e.children=Xl(e.children);const r=e.children[o]||P(e);r&&(r.meta.depth=0===r.meta.depth?0:r.meta.depth-1,e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children))}var hc={};!function(e,t){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object Boolean]",l="[object Date]",c="[object Function]",a="[object GeneratorFunction]",s="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",C="[object Uint8Array]",S="[object Uint8ClampedArray]",D="[object Uint16Array]",j="[object Uint32Array]",B=/\w*$/,R=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,_={};_[r]=_["[object Array]"]=_[y]=_[b]=_[i]=_[l]=_[w]=_[x]=_[k]=_[E]=_[O]=_[s]=_[d]=_[u]=_[p]=_[h]=_[g]=_[v]=_[C]=_[S]=_[D]=_[j]=!0,_["[object Error]"]=_[c]=_[m]=!1;var N="object"==typeof Y&&Y&&Y.Object===Object&&Y,T="object"==typeof self&&self&&self.Object===Object&&self,M=N||T||Function("return this")(),L=t&&!t.nodeType&&t,P=L&&e&&!e.nodeType&&e,I=P&&P.exports===L;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function $(e,t,n,o){var r=-1,i=e?e.length:0;for(o&&i&&(n=e[++r]);++r<i;)n=t(n,e[r],r,e);return n}function H(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function U(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}function V(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var W,X=Array.prototype,q=Function.prototype,Z=Object.prototype,G=M["__core-js_shared__"],J=(W=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Q=q.toString,ee=Z.hasOwnProperty,te=Z.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=I?M.Buffer:void 0,re=M.Symbol,ie=M.Uint8Array,le=V(Object.getPrototypeOf,Object),ce=Object.create,ae=Z.propertyIsEnumerable,se=X.splice,de=Object.getOwnPropertySymbols,ue=oe?oe.isBuffer:void 0,fe=V(Object.keys,Object),pe=Ie(M,"DataView"),he=Ie(M,"Map"),ge=Ie(M,"Promise"),ve=Ie(M,"Set"),me=Ie(M,"WeakMap"),ye=Ie(Object,"create"),be=Ue(pe),we=Ue(he),xe=Ue(ge),ke=Ue(ve),Ee=Ue(me),Oe=re?re.prototype:void 0,Ce=Oe?Oe.valueOf:void 0;function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function De(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function Be(e){this.__data__=new De(e)}function Re(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&We(e)}(e)&&ee.call(e,"callee")&&(!ae.call(e,"callee")||te.call(e)==r)}(e)?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],o=n.length,i=!!o;for(var l in e)!t&&!ee.call(e,l)||i&&("length"==l||$e(l,o))||n.push(l);return n}function Ae(e,t,n){var o=e[t];ee.call(e,t)&&Ve(o,n)&&(void 0!==n||t in e)||(e[t]=n)}function _e(e,t){for(var n=e.length;n--;)if(Ve(e[n][0],t))return n;return-1}function Ne(e,t,n,o,f,m,R){var A;if(o&&(A=m?o(e,f,m,R):o(e)),void 0!==A)return A;if(!qe(e))return e;var N=Ke(e);if(N){if(A=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,o=e.length;t||(t=Array(o));for(;++n<o;)t[n]=e[n];return t}(e,A)}else{var T=Fe(e),M=T==c||T==a;if(Ye(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==u||T==r||M&&!m){if(H(e))return m?e:{};if(A=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=le(e),qe(t)?ce(t):{});var t}(M?{}:e),!t)return function(e,t){return Le(e,ze(e),t)}(e,function(e,t){return e&&Le(t,Ze(t),e)}(A,e))}else{if(!_[T])return m?e:{};A=function(e,t,n,o){var r=e.constructor;switch(t){case y:return Me(e);case i:case l:return new r(+e);case b:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,o);case w:case x:case k:case E:case O:case C:case S:case D:case j:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,o);case s:return function(e,t,n){var o=t?n(U(e),!0):U(e);return $(o,z,new e.constructor)}(e,o,n);case d:case g:return new r(e);case p:return function(e){var t=new e.constructor(e.source,B.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var o=t?n(K(e),!0):K(e);return $(o,F,new e.constructor)}(e,o,n);case v:return c=e,Ce?Object(Ce.call(c)):{}}var c}(e,T,Ne,t)}}R||(R=new Be);var L=R.get(e);if(L)return L;if(R.set(e,A),!N)var P=n?function(e){return function(e,t,n){var o=t(e);return Ke(e)?o:function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}(o,n(e))}(e,Ze,ze)}(e):Ze(e);return function(e,t){for(var n=-1,o=e?e.length:0;++n<o&&!1!==t(e[n],n,e););}(P||e,(function(r,i){P&&(r=e[i=r]),Ae(A,i,Ne(r,t,n,o,i,e,R))})),A}function Te(e){return!(!qe(e)||(t=e,J&&J in t))&&(Xe(e)||H(e)?ne:R).test(Ue(e));var t}function Me(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Le(e,t,n,o){n||(n={});for(var r=-1,i=t.length;++r<i;){var l=t[r],c=o?o(n[l],e[l],l,n,e):void 0;Ae(n,l,void 0===c?e[l]:c)}return n}function Pe(e,t){var n,o,r=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}Se.prototype.clear=function(){this.__data__=ye?ye(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ye){var o=t[e];return o===n?void 0:o}return ee.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?n:t,this},De.prototype.clear=function(){this.__data__=[]},De.prototype.delete=function(e){var t=this.__data__,n=_e(t,e);return!(n<0)&&(n==t.length-1?t.pop():se.call(t,n,1),!0)},De.prototype.get=function(e){var t=this.__data__,n=_e(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return _e(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,o=_e(n,e);return o<0?n.push([e,t]):n[o][1]=t,this},je.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||De),string:new Se}},je.prototype.delete=function(e){return Pe(this,e).delete(e)},je.prototype.get=function(e){return Pe(this,e).get(e)},je.prototype.has=function(e){return Pe(this,e).has(e)},je.prototype.set=function(e,t){return Pe(this,e).set(e,t),this},Be.prototype.clear=function(){this.__data__=new De},Be.prototype.delete=function(e){return this.__data__.delete(e)},Be.prototype.get=function(e){return this.__data__.get(e)},Be.prototype.has=function(e){return this.__data__.has(e)},Be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof De){var o=n.__data__;if(!he||o.length<199)return o.push([e,t]),this;n=this.__data__=new je(o)}return n.set(e,t),this};var ze=de?V(de,Object):function(){return[]},Fe=function(e){return te.call(e)};function $e(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}function Ue(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ve(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=b||he&&Fe(new he)!=s||ge&&Fe(ge.resolve())!=f||ve&&Fe(new ve)!=h||me&&Fe(new me)!=m)&&(Fe=function(e){var t=te.call(e),n=t==u?e.constructor:void 0,o=n?Ue(n):void 0;if(o)switch(o){case be:return b;case we:return s;case xe:return f;case ke:return h;case Ee:return m}return t});var Ke=Array.isArray;function We(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Xe(e)}var Ye=ue||function(){return!1};function Xe(e){var t=qe(e)?te.call(e):"";return t==c||t==a}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return We(e)?Re(e):function(e){if(!He(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Ne(e,!0,!0)}}({get exports(){return hc},set exports(e){hc=e}},hc);var gc=hc;function vc(e,t={}){const{blockId:n,focus:o}=t;if(!n&&!t.at)throw new Error("blockId or path should be provided");let r=null;if(n&&(r=e.children[n],!r))throw new Error(`Block not with blockId: ${n} found`);if(t.at&&(r=P(e,{at:t.at}),!r))throw new Error(`Block in path ${t.at} not found`);if(!r)throw new Error("Block not found");e.children=Xl(e.children);Object.values(e.children).forEach((e=>{e.meta.order>r.meta.order&&(e.meta.order+=1)}));const i=(l=r,"function"==typeof window.structuredClone?window.structuredClone(l):gc(l));var l;const c=ic(e);i.id=G(),i.meta.order=r.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=c;const a=i.id;e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(a,{waitExecution:!0})}function mc(e,t,n){e.children=Xl(e.children);let o=!1;const r=e.children[t];r&&(n.id&&(r.id=n.id,o=!0),n.type&&(r.type=n.type,o=!0),n.meta&&(r.meta=n.meta,o=!0),n.value&&(r.value=n.value),e.children=ql(e.children),o&&e.applyChanges(),e.emit("change",e.children))}const yc="Paragraph";function bc(e,t,n){e.children=Xl(e.children);const o=P(e,{at:(null==n?void 0:n.at)||e.selection});if(!o)throw new Error("Block from not found at current selection");let r=t;o.type===r&&(r=yc);const i=Ln(e,{at:[o.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${o.meta.order}`);const l=ri(e.blocks[r].elements);S.withoutNormalizing(i,(()=>{D.setNodes(i,{type:l},{at:i.selection||[0],mode:"lowest",match:e=>A.isElement(e)&&!S.isInline(i,e)}),(null==n?void 0:n.deleteText)&&D.delete(i,{at:[0,0]});const t={id:G(),type:r,meta:Object.assign(Object.assign({},o.meta),{order:o.meta.order}),value:i.children},c=ic(e);c.children=i.children,delete e.children[o.id],delete e.blockEditorsMap[o.id],e.blockEditorsMap[t.id]=c,e.children[t.id]=t,t.value=c.children,e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(t.id,{slate:c})}))}function wc(e,t,n={}){e.children=Xl(e.children);const{at:o,focus:r}=n;let i=o||[0];const l=P(e),c=Ln(e);let a=!1,s=!1;if(c&&c.selection){const t=j.parent(c.selection.anchor.path),n=S.string(c,t).trim(),o=S.isStart(c,c.selection.anchor,t);a=""===n&&o,s=!o||n.length>0,w.blur(c),e.setSelection(null)}s&&(i=[i[0]+1]),Object.values(e.children).forEach((e=>{e.meta.order>=i[0]&&(e.meta.order+=t.length)}));const d=[];if(t.forEach(((t,n)=>{const o={id:t.id,value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:i[0]+n})};d.push(o.meta.order),e.children[o.id]=o;const r=ic(e);e.blockEditorsMap[o.id]=r})),l&&a){const t=l.meta.order;delete e.children[l.id],delete e.blockEditorsMap[l.id],Object.keys(e.children).forEach((n=>{const o=e.children[n];o.meta.order>t&&(o.meta.order-=1)}))}e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.setBlockSelected(d)}function xc(e,t,n){e.children=Xl(e.children);const o=P(e);if(!o)throw new Error(`No fromBlock found in the current selection path. Passed path: ${e.selection}`);const r=(null==n?void 0:n.slate)||Ln(e,{at:[null==o?void 0:o.meta.order]});if(!r||!r.selection)return;const i=e.blocks[t],l=Q({id:G(),type:i.type,meta:{order:o.meta.order,depth:o.meta.depth,align:o.meta.align}}),c=e.plugins[t].events||{},{onBeforeCreate:a,onCreate:s}=c,d="function"==typeof a?a(e,l.id):ci(e,t);(null==n?void 0:n.deleteText)&&D.delete(r,{at:[0,0]});const u=ic(e);u.children=[d],delete e.children[o.id],delete e.blockEditorsMap[o.id],e.blockEditorsMap[l.id]=u,e.children[l.id]=l,l.value=u.children;const f=l.id;e.children=ql(e.children),e.applyChanges(),e.emit("change",e.children),null==s||s(e,l.id),(null==n?void 0:n.focus)&&e.focusBlock(f,{slate:u,waitExecution:!0})}function kc(e,t){if(!(null==t?void 0:t.id)&&!(null==t?void 0:t.at))throw new Error("getBlock requires either an id or at");if(null==t?void 0:t.id)return e.children[null==t?void 0:t.id];const n=Object.keys(e.children).find((n=>{var o;return e.children[n].meta.order===(null===(o=null==t?void 0:t.at)||void 0===o?void 0:o[0])}));return n?e.children[n]:null}const Ec={insertBlock:lc,deleteBlock:cc,moveBlock:sc,focusBlock:dc,splitBlock:uc,increaseBlockDepth:fc,decreaseBlockDepth:pc,duplicateBlock:vc,updateBlock:mc,toggleBlock:bc,insertBlocks:wc,createBlock:xc,deleteBlocks:ac,getBlock:kc,getSlate:function(e,t){if(!(null==t?void 0:t.id)&&!(null==t?void 0:t.at))throw new Error("getSlate requires either an id or at");const n=(null==t?void 0:t.id)||Object.keys(e.children).find((n=>{var o;return e.children[n].meta.order===(null===(o=null==t?void 0:t.at)||void 0===o?void 0:o[0])})),o=e.blockEditorsMap[n||""],r=e.children[n||""],i=e.blocks[(null==r?void 0:r.type)||""];if(!(null==i?void 0:i.hasCustomEditor)&&!o)throw new Error(`Slate not found with params: ${JSON.stringify(t)}`);return o}};function Oc({editor:e}){const t=c(!1),n=c(!1),o=c(null),r=c(null),i=t=>{const n=t||e.selection;if(n){const t=Ec.getSlate(e,{at:n});if(!t)return;S.withoutNormalizing(t,(()=>{D.select(t,[0]),t.selection&&B.isExpanded(t.selection)&&(w.blur(t),w.deselect(t))}))}},l=l=>{var c;if(!t.current||e.readOnly)return;const a=document.elementFromPoint(l.clientX,l.clientY),s=null==a?void 0:a.closest("[data-yoopta-block]");if(s){const t=s.getAttribute("data-yoopta-block-id")||"",l=null===(c=e.children[t])||void 0===c?void 0:c.meta.order;if(n.current&&"number"==typeof l&&l===o.current)return r.current=l,void e.setBlockSelected([l],{only:!0});if("number"==typeof l&&l!==r.current){r.current=l,n.current=!0;const t=Math.min(o.current,l),c=Math.max(o.current,l);i();const a=Array.from({length:c-t+1},((e,n)=>t+n));e.setBlockSelected(a)}}},a=()=>{var i,c;t.current=!1,n.current=!1,o.current=null,r.current=null,null===(i=e.refElement)||void 0===i||i.removeEventListener("mousemove",l),null===(c=e.refElement)||void 0===c||c.removeEventListener("mouseup",a)};return{onMouseDown:n=>{var c,s,d,u,f;if(e.readOnly)return;Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0&&!n.shiftKey&&!n.altKey&&e.setBlockSelected(null);const p=n.target.closest("[data-yoopta-block]");if(p&&0===n.button){const h=p.getAttribute("data-yoopta-block-id")||"",g=null===(c=e.children[h])||void 0===c?void 0:c.meta.order;if("number"==typeof g){if(t.current=!0,o.current=g,r.current=g,n.shiftKey&&Array.isArray(e.selection)&&g!==(null===(s=e.selection)||void 0===s?void 0:s[0]))return void(t=>{i();const n=e.selection[0],o=Array.from({length:Math.abs(t-n)}).map(((e,o)=>t>n?n+o+1:n-o-1));e.setBlockSelected([...o,n],{only:!0}),e.setSelection([t])})(g);g!==(null===(d=e.selection)||void 0===d?void 0:d[0])&&e.setSelection([g]),null===(u=e.refElement)||void 0===u||u.addEventListener("mousemove",l),null===(f=e.refElement)||void 0===f||f.addEventListener("mouseup",a)}}}}}const Cc={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Sc=({placeholder:n,marks:o,className:r,selectionBoxRoot:i,width:l,style:a,children:d,autoFocus:u=!0})=>{const f=$(),p=V(),h=rl({editor:f,root:i}),g=Oc({editor:f});let v=c(Cc).current;s((()=>{u&&!p&&f.focus()}),[u,p]),s((()=>{if(!p)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),[f.selectedBlocks,p]);const m=()=>{v.indexToSelect=null,v.startedIndexToSelect=null,v.selectionStarted=!1},y=e=>{var t,n,o,r,i;if(!p){if(zi.isSelect(e)){if((null===(t=f.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(f.children).length)return void e.preventDefault();if(v.selectionStarted)return e.preventDefault(),void f.setBlockSelected([],{allSelected:!0})}if((zi.isCopy(e)||zi.isCut(e))&&Array.isArray(f.selectedBlocks)&&f.selectedBlocks.length>0){e.preventDefault();const t=f.getHTML(f.getEditorValue()),n=f.getPlainText(f.getEditorValue()),o=new Blob([t],{type:"text/html"}),r=new Blob([n],{type:"text/plain"}),i=new ClipboardItem({"text/html":o,"text/plain":r});if(navigator.clipboard.write([i]).then((()=>{const e=(new DOMParser).parseFromString(t,"text/html");console.log("HTML copied\n",e.body)})),zi.isCut(e)){const e=f.selectedBlocks.length===Object.keys(f.children).length;f.deleteBlocks({paths:f.selectedBlocks,focus:!1}),f.setBlockSelected(null),m(),e&&f.insertBlock(Q({id:G()}),{at:[0],focus:!0})}}else{if(zi.isBackspace(e)){e.stopPropagation();if(Array.isArray(f.selectedBlocks)&&(null===(n=f.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(f.children).length)return e.preventDefault(),f.deleteBlocks({deleteAll:!0}),f.setBlockSelected(null),void m();if(Array.isArray(f.selectedBlocks)&&(null===(o=f.selectedBlocks)||void 0===o?void 0:o.length)>0)return e.preventDefault(),f.deleteBlocks({paths:f.selectedBlocks,focus:!1}),f.setBlockSelected(null),void m()}if(zi.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(v.selectionStarted&&null!==v.startedIndexToSelect&&null!==v.indexToSelect){const e=v.indexToSelect,t=e-1;if(0===e)return;if(e===v.startedIndexToSelect)return f.setBlockSelected([t]),void(v.indexToSelect=t);if(t<v.startedIndexToSelect)return f.setBlockSelected([t]),void(v.indexToSelect=t);if((null===(r=f.selectedBlocks)||void 0===r?void 0:r.includes(e))&&e!==v.startedIndexToSelect){const n=f.selectedBlocks.filter((t=>t!==e));return f.setBlockSelected(n,{only:!0}),void(v.indexToSelect=t)}return}const t=P(f),n=Ln(f);if(!n||!n.selection||!t)return;const o=j.parent(n.selection.anchor.path),i=S.isStart(n,n.selection.focus,o);if(B.isExpanded(n.selection)&&i){const o=f.selection?[f.selection[0]-1]:[0],r=P(f,{at:o});t&&r&&(e.preventDefault(),w.blur(n),w.deselect(n),D.deselect(n),f.setSelection(null),f.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),v.startedIndexToSelect=t.meta.order,v.indexToSelect=t.meta.order-1,v.selectionStarted=!0)}}if(zi.isShiftArrowDown(e)){if(v.selectionStarted&&null!==v.indexToSelect&&null!==v.startedIndexToSelect){const e=v.indexToSelect,t=e+1;if(t===Object.keys(f.children).length)return;if(e===v.startedIndexToSelect)return f.setBlockSelected([t]),void(v.indexToSelect=t);if(t>v.startedIndexToSelect)return f.setBlockSelected([t]),void(v.indexToSelect=t);if((null===(i=f.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==v.startedIndexToSelect){const n=f.selectedBlocks.filter((t=>t!==e));return f.setBlockSelected(n,{only:!0}),void(v.indexToSelect=t)}return}const t=P(f),n=Ln(f);if(!n||!n.selection||!t)return;const o=j.parent(n.selection.anchor.path),r=S.isEnd(n,n.selection.focus,o);if(B.isExpanded(n.selection)&&r){const o=f.selection?[f.selection[0]+1]:[0],r=P(f,{at:o});t&&r&&(e.preventDefault(),w.blur(n),w.deselect(n),D.deselect(n),f.setSelection(null),f.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),v.startedIndexToSelect=t.meta.order,v.indexToSelect=t.meta.order+1,v.selectionStarted=!0)}}if(zi.isTab(e)){const t=f.selectedBlocks;Array.isArray(t)&&t.length>0&&(e.preventDefault(),t.forEach((e=>{const t=Ec.getBlock(f,{at:[e]});f.increaseBlockDepth({blockId:null==t?void 0:t.id})})))}else if(zi.isShiftTab(e)){const t=f.selectedBlocks;Array.isArray(t)&&t.length>0&&(e.preventDefault(),t.forEach((e=>{const t=Ec.getBlock(f,{at:[e]});f.decreaseBlockDepth({blockId:null==t?void 0:t.id})})))}else;}}},b=e=>{if(!p)return;const t=e.clipboardData,n=window.getSelection();if(n&&n.rangeCount>0){const e=n.getRangeAt(0);if(e.collapsed)return;const o=e.cloneContents().querySelectorAll("[data-yoopta-block-id]");if(!o.length)return;const r=Array.from(o).reduce(((e,t)=>{const n=t.getAttribute("data-yoopta-block-id")||"",o=f.children[n];return o&&(e[n]=o),e}),{}),i=f.getHTML(r),l=f.getPlainText(r);return t.setData("text/html",i),void t.setData("text/plain",l)}},x=(k={userSelect:h.selection?"none":"auto",pointerEvents:h.selection?"none":"auto",width:l||(null==a?void 0:a.width),paddingBottom:null==a?void 0:a.paddingBottom},Object.assign(Object.assign({},k),{width:k.width||400,paddingBottom:"number"==typeof k.paddingBottom?k.paddingBottom:100}));var k;return t("div",Object.assign({ref:e=>f.refElement=e,className:r?`yoopta-editor ${r}`:"yoopta-editor",style:x,onMouseDown:e=>{p||(g.onMouseDown(e),m(),(e=>{var t;const n=f.refElement;if(!n)return;const{bottom:o}=n.getBoundingClientRect(),r=o-parseInt(getComputedStyle(n).paddingBottom,10),i=Q({id:G()});if(e.clientY>=r){const e=Object.keys(f.children).length-1,n=P(f,{at:[e]}),o=Ln(f,{at:[e]});if(n&&o&&o.selection){const e=S.string(o,o.selection.anchor.path),r=j.parent(o.selection.anchor.path),[l]=S.node(o,r);if(n.type===i.type&&A.isElement(l)&&"void"!==(null===(t=l.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void f.focusBlock(n.id,{slate:o})}const r=e+1;f.insertBlock(i,{at:[r],focus:!0})}})(e))},onBlur:e=>{var t;(null===(t=f.refElement)||void 0===t?void 0:t.contains(e.relatedTarget))||p||(m(),Array.isArray(f.selectedBlocks)&&f.selectedBlocks.length>0&&f.setBlockSelected(null))},onCopy:b,onCut:b},{children:[e(ol,{editor:f,marks:o,placeholder:n}),!1!==i&&e(il,{origin:h.origin,coords:h.coords,isOpen:h.selection&&!p}),d]}))};function Dc(e,t){const n=Ln(e);if(!n)return!1;const o=S.marks(n);return!!(null==o?void 0:o[t])}function jc(e,t){const n={};return t.forEach((t=>{const o=t.type;n[o]={hotkey:t.hotkey,type:o,getValue:()=>function(e,t){const n=Ln(e);if(!n)return null;const o=S.marks(n);return null==o?void 0:o[t]}(e,o),isActive:()=>Dc(e,o),toggle:()=>function(e,t){const n=Ln(e),o=Dc(e,t);n&&(o?S.removeMark(n,t):S.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,o),update:t=>function(e,t,n){const o=Ln(e);o&&o.selection&&B.isExpanded(o.selection)&&(S.addMark(o,t,n),e.applyChanges(),e.emit("change",e.children))}(e,o,t)}})),n}function Bc(e){const t={};return Object.keys(e.children).forEach((n=>{const o=ic(e);t[n]=o})),t}function Rc({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const Ac=Rc({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),_c=(()=>{const e=G();return{[e]:Q({id:e})}})(),Nc=new q,Tc=(e,t)=>Nc.on(e,t),Mc=(e,t)=>Nc.once(e,t),Lc=(e,t)=>Nc.off(e,t),Pc=(e,t)=>Nc.emit(e,t);const Ic=({id:t,editor:n,value:o,marks:r,plugins:i,autoFocus:l,className:c,tools:a,selectionBoxRoot:s,children:u,placeholder:p,readOnly:h,width:g,style:v})=>{const m=()=>{x((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},y=d((()=>r?[Ac,...r]:[Ac]),[r]),b=d((()=>i.map((e=>e.getPlugin))),[i]),[w,x]=f((()=>{n.id||(n.id=t||G()),n.applyChanges=m,n.readOnly=h||!1,y&&(n.formats=jc(n,y)),n.blocks=function(e,t){const n={};return t.forEach((t=>{var o;const r=ii(t.elements),i=null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType;if("inline"!==i&&"inlineVoid"!==i){const o={};Object.keys(t.elements).forEach((e=>{const n=fi(t.elements[e],["render"]);o[e]=n}));const{display:r,placeholder:i,shortcuts:l}=t.options||{};n[t.type]={type:t.type,elements:o,hasCustomEditor:!!t.customEditor,options:{display:r,placeholder:i,shortcuts:l},isActive:()=>{const n=P(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:n=>bc(e,t.type,n),create:n=>xc(e,t.type,n),update:(t,n)=>{mc(e,t,n)},delete:t=>{cc(e,t)}}}})),n}(n,b);const e=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(o);return e||void 0===o||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(o)}`),n.children=e?o:_c,n.blockEditorsMap=Bc(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,o,r,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(o=e.options)||void 0===o?void 0:o.shortcuts.length)>0&&(null===(i=null===(r=e.options)||void 0===r?void 0:r.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var o;const r=e.elements[t],i=null===(o=r.props)||void 0===o?void 0:o.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},r),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const o=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:o})}})),t}(b),n.commands=function(e,t){const n={};return t.forEach((t=>{t.commands&&Object.keys(t.commands).forEach((o=>{var r;(null===(r=t.commands)||void 0===r?void 0:r[o])&&(n[o]=(...n)=>{var r;return null===(r=t.commands)||void 0===r?void 0:r[o](e,...n)})}))})),n}(n,b),n.on=Tc,n.once=Mc,n.off=Lc,n.emit=Pc,{editor:n,version:0}}));return e(F,Object.assign({editorState:w},{children:e(si,Object.assign({tools:a},{children:e(Sc,Object.assign({placeholder:p,marks:y,autoFocus:l,className:c,selectionBoxRoot:s,width:g,style:v},{children:u}))}))}))},zc=Object.assign(Object.assign({},wi),{ExtendedBlockActions:({id:o,className:r,style:i,onClick:l,children:c})=>{const a=V(),[s,d]=f(!1),{refs:u,floatingStyles:p,context:h}=Ir({placement:"bottom-start",open:s,onOpenChange:d,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:g,styles:v}=Hr(h,{duration:100}),m=Object.assign(Object.assign({},v),p);return a?null:t(n,{children:[g&&e(bi,Object.assign({isOpen:!0,onClose:()=>d(!1),refs:u,style:m},{children:c})),e("button",Object.assign({type:"button",contentEditable:!1,ref:u.setReference,id:o,className:`yoopta-button yoopta-extended-block-actions ${r||""}`,onClick:()=>{null==l||l(),d(!0)},style:s?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(Zr,{})}))]})},Portal:hi,Overlay:pi});function Fc(e,t){const n=Object.keys(e.children),{type:o}=t||{},r=n.find((t=>e.children[t].type===o));return r?e.children[r]:null}function $c(e,t){var n;const o=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&o.push({text:t.textContent||""}),t.nodeType===Node.ELEMENT_NODE){const n=t;"P"!==n.nodeName&&"SPAN"!==n.nodeName&&"DIV"!==n.nodeName||o.push(Object.assign({},$c(e,n.childNodes)[0])),"B"!==n.nodeName&&"STRONG"!==n.nodeName||o.push(Object.assign({bold:!0},$c(e,n.childNodes)[0])),"I"!==n.nodeName&&"EM"!==n.nodeName||o.push(Object.assign({italic:!0},$c(e,n.childNodes)[0])),"S"!==n.nodeName&&"STRIKE"!==n.nodeName||o.push(Object.assign({strike:!0},$c(e,n.childNodes)[0])),"U"!==n.nodeName&&"INS"!==n.nodeName||o.push(Object.assign({underline:!0},$c(e,n.childNodes)[0])),"CODE"===n.nodeName&&o.push(Object.assign({code:!0},$c(e,n.childNodes)[0])),"A"===n.nodeName&&o.push({id:G(),type:"link",props:{url:n.getAttribute("href")||"",target:n.getAttribute("target")||"",rel:n.getAttribute("rel")||""},children:$c(e,n.childNodes)})}})),0!==o.length||(null===(n=o[0])||void 0===n?void 0:n.text)||o.push({text:""}),o}function Hc(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`<b>${t}</b>`),e.italic&&(t=`<i>${t}</i>`),e.strike&&(t=`<s>${t}</s>`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`<code>${t}</code>`),t}if("link"===e.type){const{url:t,target:n,rel:o}=e.props;return`<a href="${t}" target="${n}" rel="${o}">${Hc(e.children)}</a>`}return""})).join("")}function Uc(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`**${t}**`),e.italic&&(t=`*${t}*`),e.strike&&(t=`~~${t}~~`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`\`${t}\``),t}if("link"===e.type){const{url:t,target:n,rel:o}=e.props;return`[${Uc(e.children)}](${t})`}return""})).join("")}function Vc(e){return Array.from(new Set(e))}function Kc(e,t){try{w.blur(t),w.deselect(t),D.deselect(t)}catch(e){}e.setBlockSelected(null),e.setSelection(null)}const Wc={underline:{type:"underline",tag:"U"},strike:{type:"strike",tag:"S"},code:{type:"code",tag:"CODE"},italic:{type:"italic",tag:"I"},bold:{type:"bold",tag:"B"}};function Yc(e,t){return e.map((e=>{var n,o;let r="";if(e.text)return r=Object.keys(Wc).reduce(((t,n)=>e[n]?`<${Wc[n].tag}>${t}</${Wc[n].tag}>`:t),e.text),r;if(e.type){const i=function(e,t){return Object.values(e).find((e=>{var n,o;return e.type===(null===(o=null===(n=e.elements)||void 0===n?void 0:n[t])||void 0===o?void 0:o.rootPlugin)}))}(t,e.type);if(i&&(null===(o=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===o?void 0:o.serialize))return r=i.parsers.html.serialize(e,Yc(e.children,t)),r}return r})).join("")}function Xc(e,t){const n=Object.values(t).filter((t=>{var n;return!(Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)||(null===(n=e.selectedBlocks)||void 0===n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,o;const r=e.plugins[t.type];if(r&&(null===(o=null===(n=r.parsers)||void 0===n?void 0:n.html)||void 0===o?void 0:o.serialize)){const n=Yc(t.value[0].children,e.plugins);return r.parsers.html.serialize(t.value[0],n,t.meta)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}function qc(){const e={id:"",children:{},selection:null,selectedBlocks:null,readOnly:!1,isEmpty:()=>function(e){const t=Object.values(e.children);if(t.length>1)return!1;const n=t[0];if(!n)return!0;if("Paragraph"!==n.type)return!1;const o=Ln(e,{at:[n.meta.order]});if(!o)return!0;try{return!(S.string(o,[0]).length>0)}catch(e){return!0}}(e),getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),setEditorValue:(...t)=>function(e,t){e.children=t,e.blockEditorsMap=Bc(e),e.applyChanges(),e.emit("change",e.children)}(e,...t),applyChanges:()=>{},insertBlock:(...t)=>lc(e,...t),insertBlocks:(...t)=>wc(e,...t),deleteBlocks:(...t)=>ac(e,...t),deleteBlock:(...t)=>cc(e,...t),duplicateBlock:(...t)=>vc(e,...t),toggleBlock:(...t)=>bc(e,...t),increaseBlockDepth:(...t)=>fc(e,...t),decreaseBlockDepth:(...t)=>pc(e,...t),moveBlock:(...t)=>sc(e,...t),focusBlock:(...t)=>dc(e,...t),getBlock:(...t)=>kc(e,...t),updateBlock:(...t)=>mc(e,...t),splitBlock:(...t)=>uc(e,...t),setSelection:(...t)=>function(e,t,n={}){const{applyChanges:o=!0}=n;e.selection=t,o&&e.applyChanges()}(e,...t),setBlockSelected:(...t)=>function(e,t,n={}){const{only:o=!1,allSelected:r=!1}=n,i=e.selectedBlocks||[];if(null===t)e.selectedBlocks=null;else if(t.length>1)e.selectedBlocks=t;else if(o)e.selectedBlocks=t;else if(r){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=Vc(t)}else e.selectedBlocks=Vc(i.concat(t));e.applyChanges()}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{},isFocused:()=>function(e){return!!Hi.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=P(e,{at:[0]});t&&(Hi.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const o=null!==(n=t.slate)&&void 0!==n?n:Ln(e);if(!o)return;const{waitExecution:r,waitExecutionMs:i}=t;r?setTimeout((()=>Kc(e,o)),i):(Hi.set(e,!1),Kc(e,o),e.emit("blur",!1),e.applyChanges())}(e,...t),getHTML:t=>Xc(e,t),getMarkdown:t=>function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,o;const r=e.plugins[t.type];if(r){const e=t.value[0];if(null===(o=null===(n=r.parsers)||void 0===n?void 0:n.markdown)||void 0===o?void 0:o.serialize){const t=r.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""));if(t)return t}}return""})).join("\n")}(e,Object.values(t))}(e,t),getPlainText:t=>function(e,t){const n=Xc(e,t),o=document.createElement("div");return o.innerHTML=n,o.innerText}(e,t),refElement:null};return e}function Zc(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Ln(e,{at:[o.meta.order]});if(!r)return void console.warn("No slate found");let i=e=>A.isElement(e);(null==n?void 0:n.type)&&(i=e=>A.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=S.nodes(r,{at:(null==n?void 0:n.path)||r.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function Gc(e,t,n){const o=Zc(e,t,n);if(o)return o[0]}const Jc={createElement:function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Ln(e,{at:[r.meta.order]});i?S.withoutNormalizing(i,(()=>{const l=e.blocks[r.type],c=l.elements[n.type],a=J({type:n.type,props:Object.assign(Object.assign({},c.props),n.props)}),s=Object.keys(l.elements);let d=[];s.forEach((e=>{const t=l.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=l.elements[e];d.push(J({type:e,props:t.props}))}))})),d.length>0&&(a.children=d);const{path:u,focus:f=!0}=o||{};let p;const h=Zc(e,t,{type:n.type});if(h){const[,e]=h;j.isPath(u)?p=u:"prev"===u?p=j.previous(e):"next"===u&&(p=j.next(e))}if(D.insertNodes(i,a,{at:p,select:f}),f&&d.length>0){const n=d[0],o=Zc(e,t,{path:p,type:n.type});if(o){const[,e]=o;D.select(i,e)}}e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},deleteElement:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Ln(e,{at:[o.meta.order]});r?S.withoutNormalizing(r,(()=>{D.removeNodes(r,{at:n.path,match:e=>A.isElement(e)&&e.type===n.type}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},updateElement:function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Ln(e,{at:[r.meta.order]});i?S.withoutNormalizing(i,(()=>{const[t]=S.nodes(i,{at:(null==o?void 0:o.path)||[0],match:e=>A.isElement(e)&&e.type===n.type}),r=null==t?void 0:t[0],l=null==t?void 0:t[1],c=(null==r?void 0:r.props)||{},a={props:Object.assign(Object.assign({},c),n.props)};D.setNodes(i,a,{at:(null==o?void 0:o.path)||l||[0],match:e=>A.isElement(e)&&e.type===n.type,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},insertElementText:function(e,t,n){const{blockId:o,focus:r}=n||{},i=o?e.children[o]:P(e);if(!i)return void console.warn(`To set text programmatically, you must provide a valid blockId. Got: ${o}`);const l=Ln(e,{at:[i.meta.order]});if(!l)return void console.warn("No slate found");const c=e.blocks[i.type],a=Array.from({length:Object.keys(c.elements).length},(e=>0));let s=l.selection||a;s?S.withoutNormalizing(l,(()=>{B.isRange(s)&&!B.isCollapsed(s)&&D.collapse(l,{edge:"end"}),D.insertText(l,t,{at:s}),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(i.id,{waitExecution:!0,shouldUpdateBlockSelection:!0})})):console.warn("No valid path or selection found for text insertion")},getElement:Gc,getElementChildren:function(e,t,n){const o=Gc(e,t,n);if(o)return o.children},getElementEntry:Zc,isElementEmpty:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Ln(e,{at:[o.meta.order]});if(!r)return void console.warn("No slate found");const[i]=S.nodes(r,{at:n.path||r.selection,match:e=>A.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===S.string(r,t).trim().length}return!1},getElementPath:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Ln(e,{at:[o.meta.order]});if(r)try{return w.findPath(r,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Ln(e,{at:[o.meta.order]});if(!r)return console.warn("No slate found"),[];try{const e=w.findPath(r,n);return j.parent(e)}catch(e){}}};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}.yoopta-editor *{border:0 solid #e5e7eb;box-sizing:border-box;scrollbar-color:#d3d1cb transparent}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block{background-color:#2383e224;border-radius:.25rem;height:100%;left:0;opacity:1;pointer-events:none;position:absolute;top:0;width:100%;z-index:90}.yoopta-block-actions{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-block-actions[data-hovered-state-open=true]{opacity:1}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}.yoopta-align-left{justify-content:flex-start;text-align:left}.yoopta-align-center{justify-content:center;text-align:center}.yoopta-align-right{justify-content:flex-end;text-align:right}");export{Ec as Blocks,Jc as Elements,zi as HOTKEYS,zc as UI,L as YooptaPlugin,Q as buildBlockData,J as buildBlockElement,ci as buildBlockElementsStructure,qc as createYooptaEditor,Rc as createYooptaMark,Ic as default,$c as deserializeTextNodes,P as findPluginBlockBySelectionPath,Fc as findPluginBlockByType,Ln as findSlateBySelectionPath,G as generateId,ii as getRootBlockElement,ri as getRootBlockElementType,Hc as serializeTextNodes,Uc as serializeTextNodesIntoMarkdown,H as useBlockData,W as useBlockSelected,$ as useYooptaEditor,U as useYooptaFocused,K as useYooptaPluginOptions,V as useYooptaReadOnly,di as useYooptaTools};
6
+ var Ti=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Ni="undefined"==typeof Element,Mi=Ni?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Li=!Ni&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Ii=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},zi=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!Ii(l,!1))if("SLOT"===l.tagName){var a=l.assignedElements(),s=e(a.length?a:l.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:l,candidates:s})}else{Mi.call(l,Ti)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var c=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),d=!Ii(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(c&&d){var u=e(!0===c?l.children:c.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else i.unshift.apply(i,l.children)}}return o},Fi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Hi=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Fi(e)?0:e.tabIndex},Vi=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},$i=function(e){return"INPUT"===e.tagName},Ui=function(e){return function(e){return $i(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Li(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Ki=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Wi=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Mi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Mi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ki(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,a=Li(e);if(l&&!l.shadowRoot&&!0===r(l))return Ki(e);e=e.assignedSlot?e.assignedSlot:l||a===e.ownerDocument?l:a.host}e=i}if(function(e){var t,n,r,o,i=e&&Li(e),l=null===(t=i)||void 0===t?void 0:t.host,a=!1;if(i&&i!==e)for(a=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&l;){var s,c,d;a=!(null===(c=l=null===(s=i=Li(l))||void 0===s?void 0:s.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(l))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Yi=function(e,t){return!(t.disabled||Ii(t)||function(e){return $i(e)&&"hidden"===e.type}(t)||Wi(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Mi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Xi=function(e,t){return!(Ui(t)||Hi(t)<0||!Yi(e,t))},qi=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Zi=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,a=function(e,t){var n=Hi(e);return n<0&&t&&!Fi(e)?0:n}(l,i),s=i?e(t.candidates):l;0===a?i?n.push.apply(n,s):n.push(l):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:s})})),r.sort(Vi).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Ji=function(e,t){var n;return n=(t=t||{}).getShadowRoot?zi([e],t.includeContainer,{filter:Xi.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:qi}):function(e,t,n){if(Ii(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Ti));return t&&Mi.call(e,Ti)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Xi.bind(null,t)),Zi(n)};const Gi=r["useInsertionEffect".toString()]||(e=>e());var Qi="undefined"!=typeof document?c:d;function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},el.apply(this,arguments)}let tl=!1,nl=0;const rl=()=>"floating-ui-"+nl++;const ol=r["useId".toString()]||function(){const[e,t]=r.useState((()=>tl?rl():void 0));return Qi((()=>{null==e&&t(rl())}),[]),r.useEffect((()=>{tl||(tl=!0)}),[]),e};const il=r.createContext(null),ll=r.createContext(null);function al(e){return"data-floating-ui-"+e}function sl(e){const t=a(e);return Qi((()=>{t.current=e})),t}const cl=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function dl(e,t){const n=Ji(e,cl());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function ul(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&jo(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function fl(e){Ji(e,cl()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function pl(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const hl={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 gl(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const vl=r.forwardRef((function(e,t){const[n,o]=r.useState();Qi((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",gl),()=>{document.removeEventListener("keydown",gl)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[al("focus-guard")]:"",style:hl};return r.createElement("span",el({},e,i))})),ml=r.createContext(null),yl=al("portal");function bl(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const l=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),l=ol(),a=wl(),s=r.useRef(null);return Qi((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),Qi((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(yl,""),e.appendChild(n),s.current=n,i(n)}),[t,l]),Qi((()=>{if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!_o(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const o=document.createElement("div");o.id=l,o.setAttribute(yl,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,l,a]),o}({id:n,root:o}),[a,s]=r.useState(null),c=r.useRef(null),d=r.useRef(null),u=r.useRef(null),f=r.useRef(null),p=!!a&&!a.modal&&a.open&&i&&!(!o&&!l);return r.useEffect((()=>{if(l&&i&&(null==a||!a.modal))return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&ul(e)){("focusin"===e.type?pl:fl)(l)}}}),[l,i,null==a?void 0:a.modal]),r.createElement(ml.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:l,setFocusManagerState:s})),[i,l])},p&&l&&r.createElement(vl,{"data-type":"outside",ref:c,onFocus:e=>{if(ul(e,l)){var t;null==(t=u.current)||t.focus()}else{const e=dl(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus()}}}),p&&l&&r.createElement("span",{"aria-owns":l.id,style:hl}),l&&N(t,l),p&&l&&r.createElement(vl,{"data-type":"outside",ref:d,onFocus:e=>{if(ul(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=dl(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,e.nativeEvent))}}}))}const wl=()=>r.useContext(ml),xl=new Set,kl=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=ol();return Qi((()=>{if(!n)return;xl.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,a=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,c;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(a-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{xl.delete(i),0===xl.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,a)))}}),[i,n]),r.createElement("div",el({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Ol(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[l,a]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||l,c=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:a}={},transform:s=!0,whileElementsMounted:c,open:d}=e,[u,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Ri(p,o)||h(o);const[g,v]=r.useState(null),[m,y]=r.useState(null),b=r.useCallback((e=>{e!==O.current&&(O.current=e,v(e))}),[]),w=r.useCallback((e=>{e!==E.current&&(E.current=e,y(e))}),[]),x=l||g,k=a||m,O=r.useRef(null),E=r.useRef(null),S=r.useRef(u),C=null!=c,_=Bi(c),D=Bi(i),j=r.useCallback((()=>{if(!O.current||!E.current)return;const e={placement:t,strategy:n,middleware:p};D.current&&(e.platform=D.current),Di(O.current,E.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Ri(S.current,t)&&(S.current=t,B.flushSync((()=>{f(t)})))}))}),[p,t,n,D]);ji((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const R=r.useRef(!1);ji((()=>(R.current=!0,()=>{R.current=!1})),[]),ji((()=>{if(x&&(O.current=x),k&&(E.current=k),x&&k){if(_.current)return _.current(x,k,j);j()}}),[x,k,j,_,C]);const A=r.useMemo((()=>({reference:O,floating:E,setReference:b,setFloating:w})),[b,w]),P=r.useMemo((()=>({reference:x,floating:k})),[x,k]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!P.floating)return e;const t=Pi(P.floating,u.x),r=Pi(P.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ai(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,P.floating,u.x,u.y]);return r.useMemo((()=>({...u,update:j,refs:A,elements:P,floatingStyles:T})),[u,j,A,P,T])}(e),d=r.useContext(ll),u=null!=((null==(f=r.useContext(il))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return Gi((()=>{t.current=e})),r.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(g.current.openEvent=t),v.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)})),h=r.useRef(null),g=r.useRef({}),v=r.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],m=ol(),y=r.useCallback((e=>{const t=_o(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),b=r.useCallback((e=>{(_o(e)||null===e)&&(h.current=e,a(e)),(_o(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!_o(e))&&c.refs.setReference(e)}),[c.refs]),w=r.useMemo((()=>({...c.refs,setReference:b,setPositionReference:y,domReference:h})),[c.refs,b,y]),x=r.useMemo((()=>({...c.elements,domReference:s})),[c.elements,s]),k=r.useMemo((()=>({...c,refs:w,elements:x,dataRef:g,nodeId:i,floatingId:m,events:v,open:n,onOpenChange:p})),[c,i,m,v,n,p,w,x]);return Qi((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=k)})),r.useMemo((()=>({...c,context:k,refs:w,elements:x})),[c,w,x,k])}const El=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Sl(e,t){return"function"==typeof e?e(t):e}function Cl(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,l=("number"==typeof i?i:i.close)||0,[a,s]=r.useState(!1),[c,d]=r.useState("unmounted"),u=function(e,t){const[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect((()=>{if(!e){const e=setTimeout((()=>o(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,l);return Qi((()=>{a&&!u&&d("unmounted")}),[a,u]),Qi((()=>{if(o){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),d("close")}}),[n,o]),{isMounted:u,status:c}}function _l(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:l,duration:a=250}=t,s=e.placement,c=s.split("-")[0],d=r.useMemo((()=>({side:c,placement:s})),[c,s]),u="number"==typeof a,f=(u?a:a.open)||0,p=(u?a:a.close)||0,[h,g]=r.useState((()=>({...Sl(l,d),...Sl(n,d)}))),{isMounted:v,status:m}=Cl(e,{duration:a}),y=sl(n),b=sl(o),w=sl(i),x=sl(l);return Qi((()=>{const e=Sl(y.current,d),t=Sl(w.current,d),n=Sl(x.current,d),r=Sl(b.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&g({transitionProperty:Object.keys(r).map(El).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(El).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,y,b,x,f,m,d]),{isMounted:v,styles:h}}function Dl({editor:e,view:t,onClose:n,mode:r="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===r&&(t=t.filter((t=>function(e,t){var n;const r=e.blocks[t];if(!r)return!1;const o=V(r.elements);return"void"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,r,o,i,l,a;return{type:t,title:(null===(r=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===r?void 0:r.title)||t,description:null===(i=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===i?void 0:i.description,icon:null===(a=null===(l=e.blocks[t].options)||void 0===l?void 0:l.display)||void 0===a?void 0:a.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{e.toggleBlock(t,{deleteText:"toggle"===r,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const jl=p((({children:n,block:r,blockId:o,onActiveDragHandleChange:i})=>{const l=Lt(),{attributes:a,listeners:c,setNodeRef:d,setActivatorNodeRef:u,transform:f,transition:p,isOver:h,isDragging:g}=go({id:o,disabled:l.readOnly}),v=((e,t,n,r,o)=>s((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:r?.7:1},content:o&&!r?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,r,o]))(r,f,p,g,h),m=`yoopta-block yoopta-align-${r.meta.align||"left"}`,y=Z.isBlockSelected(l,r);return t("div",Object.assign({ref:d,className:m,style:v.container,"data-yoopta-block":!0,"data-yoopta-block-id":o,onMouseEnter:()=>{!l.readOnly&&i&&i({attributes:a,listeners:c,setActivatorNodeRef:u})}},{children:[e("div",Object.assign({style:v.content},{children:n})),y&&!l.readOnly&&e("div",{className:"yoopta-selection-block"})]}))}));function Rl(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}jl.displayName="Block","function"==typeof SuppressedError&&SuppressedError;var Al={};Object.defineProperty(Al,"__esModule",{value:!0});for(var Pl="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Bl={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Tl={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Pl?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Nl={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Ml=1;Ml<20;Ml++)Nl["f"+Ml]=111+Ml;function Ll(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return Il(e,t)})),o=function(e){return r.some((function(t){return zl(t,e)}))};return null==n?o:o(n)}function Il(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var l in Bl)r[Bl[l]]=!1;var a=!0,s=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(a=(d=u.next()).done);a=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Hl(f),g=Bl[h];if(f.length>1&&!g&&!Tl[f]&&!Nl[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=Fl(f)),g&&(r[g]=!p||null)}}catch(e){s=!0,c=e}finally{try{!a&&u.return&&u.return()}finally{if(s)throw c}}return r}function zl(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function Fl(e){return e=Hl(e),Nl[e]||e.toUpperCase().charCodeAt(0)}function Hl(e){return e=e.toLowerCase(),e=Tl[e]||e}Al.default=Ll,Al.isHotkey=Ll,Al.isCodeHotkey=function(e,t){return Ll(e,t)};var Vl=Al.isKeyHotkey=function(e,t){return Ll(e,{byKey:!0},t)};Al.parseHotkey=Il,Al.compareHotkey=zl,Al.toKeyCode=Fl,Al.toKeyName=Hl;const $l={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},Ul={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Kl={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Wl=e=>{const t=$l[e],n=Ul[e],r=Kl[e],o=t&&Vl(t),i=n&&Vl(n),l=r&&Vl(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!l||!l(e)))},Yl={isBold:Wl("bold"),isCompose:Wl("compose"),isArrowLeft:Wl("arrowLeft"),isArrowRight:Wl("arrowRight"),isArrowUp:Wl("arrowUp"),isArrowDown:Wl("arrowDown"),isDeleteBackward:Wl("deleteBackward"),isDeleteForward:Wl("deleteForward"),isDeleteLineBackward:Wl("deleteLineBackward"),isDeleteLineForward:Wl("deleteLineForward"),isDeleteWordBackward:Wl("deleteWordBackward"),isDeleteWordForward:Wl("deleteWordForward"),isExtendBackward:Wl("extendBackward"),isExtendForward:Wl("extendForward"),isExtendLineBackward:Wl("extendLineBackward"),isExtendLineForward:Wl("extendLineForward"),isItalic:Wl("italic"),isMoveLineBackward:Wl("moveLineBackward"),isMoveLineForward:Wl("moveLineForward"),isCtrlLeft:Wl("ctrlLeft"),isCtrlRight:Wl("ctrlRight"),isRedo:Wl("redo"),isShiftEnter:Wl("shiftEnter"),isEnter:Wl("enter"),isTransposeCharacter:Wl("transposeCharacter"),isUndo:Wl("undo"),isSpace:Wl("space"),isSelect:Wl("select"),isTab:Wl("tab"),isShiftTab:Wl("shiftTab"),isBackspace:Wl("backspace"),isCmdEnter:Wl("cmdEnter"),isCmd:Wl("cmd"),isEscape:Wl("escape"),isSlashCommand:Wl("slashCommand"),isShiftArrowUp:Wl("shiftArrowUp"),isShiftArrowDown:Wl("shiftArrowDown"),isCopy:Wl("copy"),isCut:Wl("cut"),isShiftDelete:Wl("shiftDelete"),isCmdShiftEnter:Wl("cmdShiftEnter"),isCmdShiftRight:Wl("cmdShiftRight"),isCmdShiftLeft:Wl("cmdShiftLeft"),isCmdShiftDelete:Wl("cmdShiftDelete"),isCmdAltDelete:Wl("cmdAltDelete"),isCmdShiftD:Wl("cmdShiftD")};const Xl={onKeyDown:function(e){return t=>{const n=re(e,{at:e.path.current});if(Yl.isShiftEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;return t.preventDefault(),void n.insertText("\n")}if(Yl.isUndo(t))t.preventDefault();else if(Yl.isRedo(t))t.preventDefault();else if(Yl.isEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;t.preventDefault();const r=m.first(n,[]),o=m.last(n,[]),i=m.isStart(n,n.selection.anchor,r[1]),l=m.isEnd(n,n.selection.anchor,o[1]);if(E.isExpanded(n.selection)&&w.delete(n,{at:n.selection}),!i&&!l)return void e.splitBlock({slate:n,focus:!0});const a=Se.getBlock(e,{at:e.path.current}),s=Se.buildBlockData({id:I()}),c=m.string(n,[]),d=i&&c.length>0,u=Z.getNextPath(e);e.batchOperations((()=>{e.insertBlock(s.type,{at:d?e.path.current:u,focus:!d}),d&&a&&e.focusBlock(a.id)}))}else if(Yl.isBackspace(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=k.parent(n.selection.anchor.path);if(m.isStart(n,n.selection.anchor,r)){t.preventDefault();if(0===m.string(n,r).trim().length)return void e.deleteBlock({at:e.path.current,focus:!0});{if(E.isExpanded(n.selection))return w.delete(n,{at:n.selection});const t=Se.getBlock(e,{at:Z.getPreviousPath(e)}),r=Se.getBlockSlate(e,{id:null==t?void 0:t.id});if(t&&r){const{node:n}=function(e){const t=m.last(e,[]);return{node:t[0],path:t[1]}}(r);if(0===O.string(n).trim().length)return e.deleteBlock({blockId:t.id,focus:!1}),void e.setPath({current:t.meta.order})}e.mergeBlock()}}}else{if(Yl.isSelect(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const[,r]=m.first(n,[0]),[,o]=m.last(n,[n.children.length-1]),i=m.range(n,r,o),l=E.equals(n.selection,i),a=0===m.string(n,i).trim().length;if(E.isExpanded(n.selection)&&l||a){t.preventDefault(),_.blur(n),_.deselect(n),w.deselect(n);const r=Array.from({length:Object.keys(e.children).length},((e,t)=>t));return void e.setPath({current:null,selected:r})}}if(Yl.isShiftTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{const n=Se.getBlock(e,{at:t});n&&n.meta.depth>0&&e.decreaseBlockDepth({at:t})}))})):void e.decreaseBlockDepth()}if(Yl.isTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{e.increaseBlockDepth({at:t})}))})):void e.increaseBlockDepth()}if(Yl.isArrowUp(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;if(1===new Set(n.selection.anchor.path).size){const n=Z.getPreviousPath(e),r=re(e,{at:n}),o=ne(e,{at:n}),i=e.blocks[(null==o?void 0:o.type)||""];if(r&&o&&!(null==i?void 0:i.hasCustomEditor)){const[,n]=m.last(r,[0]),i={path:n,offset:m.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockPath:!0})}}}if(Yl.isArrowDown(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=k.parent(n.selection.anchor.path);if(m.isEnd(n,n.selection.anchor,r)){const n=Z.getNextPath(e),o=re(e,{at:n}),i=ne(e,{at:n}),l=e.blocks[(null==i?void 0:i.type)||""];if(o&&i&&!(null==l?void 0:l.hasCustomEditor)){const n=function(e,t){try{const[,n]=m.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(n&&n.selection&&E.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Vl(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},ql=({children:t,attributes:n,placeholder:r})=>{const o=j(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Zl(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Jl={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"}},Gl=["left","center","right",void 0];function Ql(e,t,n,r){var o,i;let l;if(t.parse){l=t.parse(n,e);if(y.isElement(l)&&"inline"===(null===(o=l.props)||void 0===o?void 0:o.nodeType))return l}const a=e.blocks[t.type],s=H(a.elements)||"",c=a.elements[s],d="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let u={id:I(),type:s,children:d&&!a.hasCustomEditor?[{text:""}]:r.map(ta).flat(),props:Object.assign({nodeType:"block"},c.props)};if(l)if(y.isElement(l))u=l;else if(Array.isArray(l)){return l}if(0===u.children.length&&(u.children=[{text:""}]),!l&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Se.buildBlockData({id:I(),type:t.type,value:[u],meta:{order:0,depth:p,align:Gl.includes(f)?f:void 0}})}function ea(e,t,n){var r;if(3===n.nodeType){return{text:null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const o=n;let i=Array.from(o.childNodes).map((n=>ea(e,t,n))).flat().filter(Boolean);if(Jl[o.nodeName]){const e=Jl[o.nodeName].type;return i.map((t=>"string"==typeof t?{[e]:!0,text:t}:t.text?Object.assign(Object.assign({},t),{[e]:!0}):t))}const l=t[o.nodeName];if(l){if(Array.isArray(l)){return l.map((t=>Ql(e,t,o,i))).filter(Boolean)}return Ql(e,l,o,i)}return i}function ta(e){if("string"==typeof e)return{text:e};if(y.isElement(e))return e;if(Array.isArray(e))return e.map(ta).flat();if(null==e?void 0:e.text)return e;if(Zl(e)){return e.value[0].children.map(ta).flat()}return{text:""}}function na(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{const o=t[e];if(o){const i=Array.isArray(o)?o:[o];t[e]=[...i,{type:n,parse:r.parse}]}else t[e]={type:n,parse:r.parse}}))}}}})),t}(e);return ea(e,n,t).flat().filter(Zl)}function ra(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}const oa=(e,t,n)=>{var r,o,i,l;(e=>{const[t]=m.nodes(e,{match:e=>!m.isEditor(e)&&y.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{w.unwrapNodes(e,{match:e=>!m.isEditor(e)&&y.isElement(e)&&"link"===e.type})})(t);const{selection:a}=t,s=a&&E.isCollapsed(a),c=null===(l=null===(i=null===(o=null===(r=e.plugins)||void 0===r?void 0:r.LinkPlugin)||void 0===o?void 0:o.elements)||void 0===i?void 0:i.link)||void 0===l?void 0:l.props,d={type:"link",children:s?[{text:n}]:[],props:{url:n,target:(null==c?void 0:c.target)||"_self",rel:(null==c?void 0:c.rel)||"noopener noreferrer"}};s?w.insertNodes(t,d):(w.wrapNodes(t,d,{split:!0}),w.collapse(t,{edge:"end"}))},ia=(e,t,n,r,o)=>s((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:l,insertText:a,apply:s}=i,c=Object.keys(r);return c.forEach((e=>{var n;const o=null===(n=r[e].props)||void 0===n?void 0:n.nodeType,l="inline"===o,a="void"===o,s="inlineVoid"===o;s&&(i.markableVoid=t=>t.type===e),(a||s)&&(i.isVoid=t=>t.type===e),(l||s)&&(i.isInline=t=>t.type===e,i=((e,t)=>{const{insertData:n,insertText:r}=t;return t.insertText=n=>{n&&ra(n)?oa(e,t,n):r(n)},t.insertData=r=>{const o=r.getData("text/plain");o&&ra(o)?oa(e,t,o):n(r)},t})(t,i))})),i.insertText=e=>{const n=Z.getSelectedPaths(t),r=Z.getPath(t);Array.isArray(n)&&n.length>0&&t.setPath({current:r}),a(e)},i.normalizeNode=e=>{const[r,o]=e,a=t.blocks[n.type].elements;if(Object.keys(a).length>1)return l(e);if(y.isElement(r)){const{type:e}=r,t=H(a);if(!c.includes(e))return void w.setNodes(i,{type:t,props:Object.assign({},r.props)},{at:o});if(r.type===t)for(const[e,t]of O.children(i,o))if(y.isElement(e)&&!i.isInline(e))return void w.unwrapNodes(i,{at:t})}l(e)},i.apply=n=>{var r,o,l;if(C.isSelectionOperation(n)){const e=Z.getSelectedPaths(t),n=Z.getPath(t);Array.isArray(e)&&i.selection&&E.isExpanded(i.selection)&&t.setPath({current:n})}let a=t.isSavingHistory();if(void 0===a&&(a=la(n)),a){const a=t.historyStack.undos[t.historyStack.undos.length-1];if(!a||"set_slate"!==(null===(r=null==a?void 0:a.operations[0])||void 0===r?void 0:r.type)){const r={type:"set_slate",properties:{slateOps:[n],selectionBefore:i.selection},blockId:e,slate:i};return t.applyTransforms([r],{source:"api",validatePaths:!1}),void s(n)}const c=null===(l=null===(o=null==a?void 0:a.operations[0])||void 0===o?void 0:o.properties)||void 0===l?void 0:l.slateOps,d=c&&c[c.length-1];let u=aa(n,d);if(0!==i.operations.length&&(u=!0),u)d!==n&&c.push(n);else{const r={operations:[n],selectionBefore:i.selection},o={type:"set_slate",properties:{slateOps:r.operations,selectionBefore:r.selectionBefore},blockId:e,slate:i};t.applyTransforms([o],{source:"api",validatePaths:!1})}}s(n)},o&&(i=o(i,t,e)),i}),[]),la=e=>"set_selection"!==e.type,aa=(e,t)=>t===e||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!k.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!k.equals(e.path,t.path))),sa=({id:t,customEditor:n,elements:r,marks:o,events:i,options:l,extensions:c,placeholder:d="Type '/' for commands"})=>{const f=Lt(),p=It(t);let h=a(p.value).current;const g=s((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(r)),[r]),v=s((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(o)),[o]),y=ia(t,f,p,r,c),b=((e,t,n,r)=>s((()=>{if(!e||t.readOnly)return{};const o=Rl(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:Yl,currentBlock:n,defaultBlock:Se.buildBlockData({id:I()})},l={};return Object.keys(o).forEach((e=>{l[e]=function(n){o[e]&&o[e](t,r,i)(n)}})),l}),[e,t,n]))(i,f,p,y),w=u((e=>{f.readOnly||(window.scheduler?window.scheduler.postTask((()=>f.updateBlock(t,{value:e})),{priority:"background"}):f.updateBlock(t,{value:e}))}),[t]),x=u((n=>{const r=g[n.element.type],{attributes:o}=n,i=Rl(n,["attributes"]);return o["data-element-type"]=i.element.type,r?e(r,Object.assign({},i,{attributes:o,blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(P,Object.assign({},i,{attributes:o}))}),[r]),O=u((t=>{var n,r,o,i;let{children:l,leaf:a,attributes:s}=t;const c=Rl(a,["text"]),u=f.path.current===p.meta.order;c&&Object.keys(c).forEach((e=>{const t=v[e];t&&(l=t.render({children:l,leaf:a}))}));const h=!("void"===(null===(i=null===(o=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===o?void 0:o.props)||void 0===i?void 0:i.nodeType))&&u&&a.withPlaceholder;return e(ql,Object.assign({attributes:s,placeholder:h?d:void 0},{children:l}))}),[o]),S=u((e=>{var t;f.readOnly||(null===(t=b.onKeyDown)||void 0===t||t.call(b,e),Xl.onKeyDown(f)(e))}),[b.onKeyDown,f.readOnly,f.path.current,p.meta.order]),C=u((e=>{var t;f.readOnly||null===(t=null==b?void 0:b.onKeyUp)||void 0===t||t.call(b,e)}),[b.onKeyUp,f.readOnly]),D=u((e=>{var t;f.readOnly||(e.preventDefault(),null===(t=null==b?void 0:b.onBlur)||void 0===t||t.call(b,e))}),[b.onBlur,f.readOnly]),j=u((e=>{var t;f.readOnly||(f.isFocused()||(ee.set(f,!0),f.emit("focus",!0)),null===(t=null==b?void 0:b.onFocus)||void 0===t||t.call(b,e))}),[b.onFocus,f.readOnly]),R=u((e=>{var t;if(f.readOnly)return;null===(t=null==b?void 0:b.onPaste)||void 0===t||t.call(b,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(r.body.childNodes.length>0){const t=na(f,r.body);if(t.length>0&&null!==f.path.current){e.preventDefault();let n=!1,r=!1;if(y&&y.selection){const e=k.parent(y.selection.anchor.path),t=m.string(y,e).trim(),o=m.isStart(y,y.selection.anchor,e);r=""===t&&o,n=!o||t.length>0,_.blur(y)}const o=f.path.current;if(null===o)return;return void f.batchOperations((()=>{const e=[];r&&f.deleteBlock({at:o}),t.forEach(((t,r)=>{let i=n?o+r+1:o+r;e.push(i);const l=Rl(t,["type"]);f.insertBlock(t.type,{at:i,focus:!1,blockData:l})})),f.setPath({current:null,selected:e})}))}}}),[b.onPaste,f.readOnly]),A=u((e=>{const t=[];if(f.readOnly)return t;const[n,r]=e,o=f.path.current===p.meta.order;return y.selection&&o&&!m.isEditor(n)&&""===m.string(y,[r[0]])&&E.includes(y.selection,r)&&E.isCollapsed(y.selection)&&t.push(Object.assign(Object.assign({},y.selection),{withPlaceholder:!0})),t}),[f.readOnly,f.path.current,p.meta.order]);return e(ca,{id:t,slate:y,initialValue:h,onChange:w,decorate:A,renderLeaf:O,renderElement:x,eventHandlers:b,onKeyDown:S,onKeyUp:C,onFocus:j,onBlur:D,customEditor:n,readOnly:f.readOnly,onPaste:R})},ca=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:l,eventHandlers:a,onKeyDown:s,onKeyUp:c,onFocus:d,onBlur:u,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(R,Object.assign({editor:n,initialValue:r,onValueChange:o},{children:e(A,Object.assign({renderElement:l,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},a,{onKeyDown:s,onKeyUp:c,onFocus:d,decorate:h,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));ca.displayName="SlateEditorInstance";const da=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s((()=>[...t].filter((e=>null!=e))),[...t])}(On(hr,{activationConstraint:{distance:20}}),On(cr,{coordinateGetter:yo})),handleDragEnd:u((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,t)}}),[]),handleDragStart:u((t=>{e.setPath({current:null})}),[])});var ua;function fa(){return fa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fa.apply(this,arguments)}var pa,ha=function(e){return r.createElement("svg",fa({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),ua||(ua=r.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function ga(){return ga=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ga.apply(this,arguments)}var va,ma=function(e){return r.createElement("svg",ga({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),pa||(pa=r.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function ya(){return ya=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ya.apply(this,arguments)}var ba=function(e){return r.createElement("svg",ya({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),va||(va=r.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function wa(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var xa=["color"],ka=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=wa(e,xa);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Oa=["color"],Ea=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=wa(e,Oa);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Sa=["color"],Ca=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=wa(e,Sa);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),_a=["color"],Da=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=wa(e,_a);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),ja=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Ra={"text/plain":"Text","text/html":"Url",default:"Text"};var Aa=function(e,t){var n,r,o,i,l,a,s=!1;t||(t={}),n=t.debug||!1;try{if(o=ja(),i=document.createRange(),l=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Ra[t.format]||Ra.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(a),i.selectNodeContents(a),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(i):l.removeAllRanges()),a&&document.body.removeChild(a),o()}return s};const Pa=t=>{var{className:n,children:r,lockScroll:o=!0}=t,i=Rl(t,["className","children","lockScroll"]);return e(kl,Object.assign({lockScroll:o,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:r}))},Ba=t=>{const[n,r]=f(!1),o=a(null),i=Lt();return d((()=>{r(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(o.current=document.createElement("div"),o.current.className="yoopta-overlays",e.appendChild(o.current)),()=>{o.current&&o.current.remove()}}),[]),n?e(bl,Object.assign({id:`${t.id}-${i.id}`,root:o.current||i.refElement},{children:t.children})):null},Ta=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),Na=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),Ma=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),La=["delete","duplicate","turnInto","copy"],Ia=({isOpen:n,onClose:r,refs:o,style:i,actions:l=La,children:a})=>{var s,c,d;const u=Lt(),p=ko(),[h,g]=f(!1),{refs:v,floatingStyles:m,context:y}=Ol({placement:"right",open:h,onOpenChange:g,middleware:[_i(),Ci(),Si(),si(10)],whileElementsMounted:Ei}),{isMounted:b,styles:w}=_l(y,{duration:100});if(!n)return null;const x=ne(u,{at:u.path.current}),k=V(null===(s=u.blocks[(null==x?void 0:x.type)||""])||void 0===s?void 0:s.elements),O="void"===(null===(c=null==k?void 0:k.props)||void 0===c?void 0:c.nodeType),E=p.ActionMenu,S=Object.assign(Object.assign({},m),w),C=Dl({editor:u,view:"small",onClose:()=>{g(!1),r()}});return e(Ba,Object.assign({id:"yoo-block-options-portal"},{children:e(Pa,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating,contentEditable:!1},{children:t(Na,{children:[null!==l&&t(Ta,{children:[e(Ma,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{u.deleteBlock({at:u.path.current}),u.setPath({current:null}),r()}},{children:[e(Da,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(Ma,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{"number"==typeof u.path.current&&(u.duplicateBlock({original:{path:u.path.current},focus:!0}),r())}},{children:[e(ka,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!E&&!O&&!(null===(d=u.blocks[(null==x?void 0:x.type)||""])||void 0===d?void 0:d.hasCustomEditor)&&t(Ma,{children:[b&&e(Ba,Object.assign({id:"yoo-block-options-portal"},{children:e(Pa,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:S,ref:v.setFloating},{children:e(E,Object.assign({},C))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(ba,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(Ma,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=ne(u);e&&(Aa(`${window.location.origin}${window.location.pathname}#${e.id}`),u.emit("block:copy",e)),r()}},{children:[e(Ca,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var za=Object.freeze({__proto__:null,BlockOptions:Ia,BlockOptionsMenuContent:Na,BlockOptionsMenuGroup:Ta,BlockOptionsMenuItem:Ma,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});function Fa(e,t,{leading:n=!0,trailing:r=!0}={}){let o=0,i=null,l=null;const a=t=>{e(...l),o=t,l=null},s=(...e)=>{const s=Date.now();o||n||(o=s);const c=t-(s-o);l=e,c<=0||c>t?(i&&(clearTimeout(i),i=null),a(s)):!i&&r&&(i=setTimeout((()=>{i=null,r&&l&&a(Date.now())}),c))};return s.cancel=()=>{i&&(clearTimeout(i),i=null),l=null,o=0},s}const Ha={position:"fixed",top:0,left:0,opacity:0,transform:"scale(0.95)",transition:"opacity 150ms ease-out"},Va=p((({editor:n,dragHandleProps:r})=>{const[o,i]=f(null),l=a(null),[s,c]=f(Ha),[u,p]=f(!1),{attributes:h,listeners:g,setActivatorNodeRef:v}=r||{},{isBlockOptionsMounted:y,setIsBlockOptionsOpen:b,blockOptionsFloatingStyle:x,blockOptionsRefs:k}=(()=>{const[e,t]=f(!1),{refs:n,floatingStyles:r,context:o}=Ol({placement:"right-start",open:e,onOpenChange:t,middleware:[_i(),Ci(),Si(),si()]}),{isMounted:i,styles:l}=_l(o,{duration:100});return{blockOptionsRefs:n,blockOptionsFloatingStyle:Object.assign(Object.assign({},r),l),isBlockOptionsOpen:e,setIsBlockOptionsOpen:t,isBlockOptionsMounted:i}})(),{isActionMenuOpen:O,actionMenuRefs:E,hasActionMenu:S,actionMenuStyles:C,onChangeActionMenuOpen:D,onCloseActionMenu:j,actionMenuRenderProps:R,ActionMenu:A}=(({editor:e})=>{const t=ko().ActionMenu,[n,r]=f(!1),{refs:o,floatingStyles:i,context:l}=Ol({placement:"bottom-start",open:n,onOpenChange:r,middleware:[_i(),Ci(),Si(),si(10)],whileElementsMounted:Ei}),{isMounted:a,styles:s}=_l(l,{duration:100}),c=Object.assign(Object.assign({},i),s),d=e=>r(e),u=()=>d(!1),p=Dl({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:a,actionMenuStyles:c,actionMenuRefs:o,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:n}),P=()=>{console.log("hideBlockActions"),c((e=>Object.assign(Object.assign({},e),{opacity:0,transform:"scale(0.95)"}))),setTimeout((()=>{i(null)}),150)},B=Fa((e=>{if(n.readOnly)return;const t=e.target.closest("[data-yoopta-block]");if(t){const e=t.getAttribute("data-yoopta-block-id");if(e===(null==o?void 0:o.id))return;const r=n.children[e||""];r&&((e,t)=>{const n=e.getBoundingClientRect();c((e=>Object.assign(Object.assign({},e),{top:n.top+2,left:n.left-50,opacity:1,transform:"scale(1)"}))),i(t)})(t,r)}}),100,{leading:!0,trailing:!0}),T=Fa((e=>{var t;if(!n.refElement)return;const r=n.refElement.getBoundingClientRect(),o=e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom||(null===(t=l.current)||void 0===t?void 0:t.contains(e.target));p(!!o)}),100,{leading:!0,trailing:!0});d((()=>{const e=n.refElement;if(e)return e.addEventListener("mousemove",B),document.addEventListener("scroll",P),document.addEventListener("mousemove",T),()=>{e.removeEventListener("mousemove",B),document.removeEventListener("scroll",P),document.removeEventListener("mousemove",T),B.cancel(),T.cancel()}}),[n.refElement]),d((()=>{u||y||P()}),[u]);return e(Ba,Object.assign({id:"block-actions"},{children:t("div",Object.assign({contentEditable:!1,style:s,className:"yoopta-block-actions",ref:l},{children:[O&&S&&e(Ba,Object.assign({id:"yoo-block-options-portal"},{children:e(Pa,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:j},{children:e("div",Object.assign({style:C,ref:E.setFloating},{children:e(A,Object.assign({},R))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=o;if(!t)return;const r=Se.getBlockSlate(n,{id:t.id}),i=n.blocks[t.type];if(!r)return;const l=document.querySelector(`[data-yoopta-block-id="${t.id}"]`),a=V(i.elements);let s;i.hasCustomEditor||(s=m.string(r,[0]));const c="string"==typeof s&&0===s.trim().length;if(S&&c&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))n.setPath({current:t.meta.order}),n.focusBlock(t.id),E.setReference(l),D(!0);else{const e=Se.buildBlockData({id:I()}),r=t.meta.order+1;n.setPath({current:t.meta.order}),n.insertBlock(e.type,{at:r,focus:!0}),S&&setTimeout((()=>{l&&E.setReference(l.nextSibling),D(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(ma,{})})),e("button",Object.assign({ref:e=>{null==v||v(e),k.setReference(e)},type:"button",className:"yoopta-block-actions-drag",onClick:e=>{e.stopPropagation();const t=o;if(!t)return;const r=re(n,{at:t.meta.order});n.focusBlock(t.id),r&&setTimeout((()=>{n.blocks[t.type].hasCustomEditor||(_.blur(r),_.deselect(r),w.deselect(r)),n.setPath({current:t.meta.order,selected:[t.meta.order]}),b(!0)}),10)}},h,g,{children:e(ha,{})})),e(Ia,{isOpen:y,refs:k,style:x,onClose:()=>b(!1)})]}))}))}));Va.displayName="FloatingBlockActions";const $a=[],Ua=({editor:r,marks:o,placeholder:i})=>{const l=Ft(),{sensors:a,handleDragEnd:c,handleDragStart:d}=da({editor:r}),[u,p]=f(null),h=Object.keys(r.children),g=s((()=>0===h.length?$a:h.sort(((e,t)=>r.children[e].meta.order-r.children[t].meta.order))),[h]),v=[];for(let t=0;t<g.length;t++){const n=g[t],l=r.children[n],a=r.plugins[l.type];l&&a?v.push(e(jl,Object.assign({block:l,blockId:n,onActiveDragHandleChange:p},{children:e(sa,{type:l.type,id:n,marks:o,customEditor:a.customEditor,events:a.events,elements:a.elements,options:a.options,extensions:a.extensions,placeholder:i},n)}),n)):console.error(`Plugin ${l.type} not found`)}return l?e(n,{children:v}):e(Wr,Object.assign({id:"yoopta-dnd-context",sensors:a,collisionDetection:An,onDragStart:d,onDragEnd:c},{children:t(ao,Object.assign({disabled:l,items:g,strategy:oo},{children:[v,e(Va,{editor:r,dragHandleProps:u})]}))}))},Ka=({editor:e,root:t})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),o=o=>{var i;if(e.readOnly||!1===t)return;const l=null===(i=e.refElement)||void 0===i?void 0:i.contains(o.target),s=Z.getSelectedPaths(e);if(!l&&!n.selection&&Array.isArray(s)&&s.length>0)return e.setPath({current:null}),a();l||r({origin:[o.pageX,o.pageY-window.pageYOffset],coords:[o.pageX,o.pageY-window.pageYOffset],selection:!0})},i=o=>{if(!n.selection||e.readOnly||!1===t)return;r((e=>Object.assign(Object.assign({},e),{coords:[o.pageX,o.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var r;const o=[],i=null===(r=e.refElement)||void 0===r?void 0:r.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,r)=>{if(!e)return;const i=e.getBoundingClientRect(),l=Math.min(t[1],n[1]),a=Math.min(t[0],n[0]),s=Math.max(t[1],n[1]),c=Math.max(t[0],n[0]);l<i.bottom&&s>i.top&&a<i.right&&c>i.left&&o.push(r)})),o):o})(e,n.origin,[o.pageX,o.pageY-window.pageYOffset]);e.setPath({current:null,selected:i})},l=()=>{e.readOnly||a()};d((()=>{var n;if(e.readOnly||!1===t)return;const r=t&&"current"in t?t.current:t||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=e.refElement)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",o),r.addEventListener("mousemove",i),r.addEventListener("mouseup",l),()=>{r.removeEventListener("mousedown",o),r.removeEventListener("mousemove",i),r.removeEventListener("mouseup",l)}}),[e.path,n,t,e.readOnly]);const a=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:a})},Wa=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:o})},Ya={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null};function Xa({editor:e}){const t=a(!1),n=a(!1),r=a(null),o=a(null);let i=a(Ya).current;const l=()=>{const t=e.path.current;if("number"==typeof t){const n=Se.getBlockSlate(e,{at:t}),r=Se.getBlock(e,{at:t}),o=e.blocks[(null==r?void 0:r.type)||""];if(!n||(null==o?void 0:o.hasCustomEditor))return;try{m.withoutNormalizing(n,(()=>{w.select(n,[0]),n.selection&&E.isExpanded(n.selection)&&(_.blur(n),_.deselect(n))}))}catch(e){}}},s=i=>{if(!t.current||e.readOnly)return;const a=document.elementFromPoint(i.clientX,i.clientY),s=null==a?void 0:a.closest("[data-yoopta-block]");s&&e.batchOperations((()=>{var t;const i=s.getAttribute("data-yoopta-block-id")||"",a=null===(t=e.children[i])||void 0===t?void 0:t.meta.order;if(n.current&&"number"==typeof a&&a===r.current)return o.current=a,void e.setPath({current:a,selected:[a]});if("number"==typeof a&&a!==o.current){o.current=a,n.current=!0;const t=Math.min(r.current,a),i=Math.max(r.current,a);l();const s=Array.from({length:i-t+1},((e,n)=>t+n));e.setPath({current:a,selected:s})}}))},c=()=>{var i,l;t.current=!1,n.current=!1,r.current=null,o.current=null,null===(i=e.refElement)||void 0===i||i.removeEventListener("mousemove",s),null===(l=e.refElement)||void 0===l||l.removeEventListener("mouseup",c),null===document||void 0===document||document.removeEventListener("mouseup",c)};return{onMouseDown:n=>{e.readOnly||(e.isFocused()||e.focus(),e.batchOperations((()=>{var i,a,d;const u=Z.getSelectedPaths(e);Array.isArray(u)&&u.length>0&&!n.shiftKey&&!n.altKey&&e.setPath({current:null});const f=n.target.closest("[data-yoopta-block]");if(f&&0===n.button){const u=f.getAttribute("data-yoopta-block-id")||"",p=null===(i=e.children[u])||void 0===i?void 0:i.meta.order;if("number"==typeof p){if(t.current=!0,r.current=p,o.current=p,n.shiftKey&&!Z.isPathEmpty(e)&&p!==e.path.current)return void(t=>{l();const n=Z.getPath(e);if("number"!=typeof n)return;const r=Array.from({length:Math.abs(t-n)}).map(((e,r)=>t>n?n+r+1:n-r-1));e.setPath({current:t,selected:[...r,n]})})(p);p!==e.path.current&&e.setPath({current:p}),null===(a=e.refElement)||void 0===a||a.addEventListener("mousemove",s),null===(d=e.refElement)||void 0===d||d.addEventListener("mouseup",c),null===document||void 0===document||document.addEventListener("mouseup",c)}}})))},onShiftArrowUp:t=>{if("function"==typeof t.isDefaultPrevented&&t.isDefaultPrevented())return;if(i.selectionStarted&&null!==i.startedIndexToSelect&&null!==i.indexToSelect){const t=i.indexToSelect,n=t-1;if(0===t)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}if(n<i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=k.parent(r.selection.anchor.path),l=m.isStart(r,r.selection.focus,o);if(E.isExpanded(r.selection)&&l){const o=Y(e);if("number"!=typeof o)return;const l=ne(e,{at:o});if(n&&l){t.preventDefault(),_.blur(r),_.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,n.meta.order-1]:[null==n?void 0:n.meta.order,n.meta.order-1];e.setPath({current:null,selected:o}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order-1,i.selectionStarted=!0}}},onShiftArrowDown:t=>{if(i.selectionStarted&&null!==i.indexToSelect&&null!==i.startedIndexToSelect){const t=i.indexToSelect,n=t+1;if(n===Object.keys(e.children).length)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}if(n>i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=k.parent(r.selection.anchor.path),l=m.isEnd(r,r.selection.focus,o);if(E.isExpanded(r.selection)&&l){const o=Z.getNextPath(e),l=ne(e,{at:o});if(n&&l){t.preventDefault(),_.blur(r),_.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,(null==n?void 0:n.meta.order)+1]:[null==n?void 0:n.meta.order,n.meta.order+1];e.setPath({current:null,selected:o}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order+1,i.selectionStarted=!0}}},selectionState:i}}const qa=({placeholder:n,marks:r,className:o,selectionBoxRoot:i,width:l,style:a,children:s,autoFocus:c=!0})=>{const u=Lt(),f=Ft(),p=Ka({editor:u,root:i}),h=Xa({editor:u});d((()=>{c&&!f&&u.focus()}),[c,f]),d((()=>{if(!f)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[u.path,f]);const g=()=>{h.selectionState.indexToSelect=null,h.selectionState.startedIndexToSelect=null,h.selectionState.selectionStarted=!1},v=e=>{if(!f){if(Yl.isRedo(e))return e.preventDefault(),void u.redo();if(Yl.isUndo(e))return e.preventDefault(),void u.undo();if(Yl.isSelect(e)){const t=Z.getSelectedPaths(u);if((null==t?void 0:t.length)===Object.keys(u.children).length)return void e.preventDefault();if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=Object.keys(u.children).map(((e,t)=>t));return void u.setPath({current:null,selected:t})}}if(Yl.isCopy(e)||Yl.isCut(e)){const t=Z.getSelectedPaths(u);if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=u.getHTML(u.getEditorValue()),n=u.getPlainText(u.getEditorValue()),r=new Blob([t],{type:"text/html"}),o=new Blob([n],{type:"text/plain"}),i=new ClipboardItem({"text/html":r,"text/plain":o});return navigator.clipboard.write([i]).then((()=>{const e=(new DOMParser).parseFromString(t,"text/html");console.log("HTML copied\n",e.body)})),void(Yl.isCut(e)&&(u.batchOperations((()=>{const e=Z.getSelectedPaths(u);if(Array.isArray(e)&&e.length>0){const t=e.length===Object.keys(u.children).length;if(e.forEach((e=>{var t;const n=null===(t=Se.getBlock(u,{at:e}))||void 0===t?void 0:t.id;n&&u.deleteBlock({blockId:n})})),t){const e=F({id:I()});u.insertBlock(e.type,{at:0,focus:!0})}}})),u.setPath({current:null,selected:null}),g()))}}if(Yl.isBackspace(e)){e.stopPropagation();const t=Z.getSelectedPaths(u);return(null==t?void 0:t.length)===Object.keys(u.children).length?(e.preventDefault(),void u.batchOperations((()=>{Object.keys(u.children).forEach((e=>u.deleteBlock({blockId:e}))),u.setPath({current:null,selected:null}),g()}))):void u.batchOperations((()=>{const t=Z.getSelectedPaths(u);Array.isArray(t)&&(null==t?void 0:t.length)>0&&(e.preventDefault(),t.forEach((e=>u.deleteBlock({at:e}))),u.setPath({current:null,selected:null}),g())}))}if(Yl.isShiftArrowUp(e)&&h.onShiftArrowUp(e),Yl.isShiftArrowDown(e)&&h.onShiftArrowDown(e),Yl.isTab(e)){const t=Z.getSelectedPaths(u);Array.isArray(t)&&t.length>0&&(e.preventDefault(),u.batchOperations((()=>{t.forEach((e=>{const t=Se.getBlock(u,{at:e});u.increaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else if(Yl.isShiftTab(e)){const t=Z.getSelectedPaths(u);Array.isArray(t)&&t.length>0&&(e.preventDefault(),u.batchOperations((()=>{t.forEach((e=>{const t=Se.getBlock(u,{at:e});u.decreaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else;}},b=e=>{if(!f)return;const t=e.clipboardData,n=window.getSelection();if(n&&n.rangeCount>0){const e=n.getRangeAt(0);if(e.collapsed)return;const r=e.cloneContents().querySelectorAll("[data-yoopta-block-id]");if(!r.length)return;const o=Array.from(r).reduce(((e,t)=>{const n=t.getAttribute("data-yoopta-block-id")||"",r=u.children[n];return r&&(e[n]=r),e}),{}),i=u.getHTML(o),l=u.getPlainText(o);return t.setData("text/html",i),void t.setData("text/plain",l)}},w=(x={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:l||(null==a?void 0:a.width),paddingBottom:null==a?void 0:a.paddingBottom},Object.assign(Object.assign({},x),{width:x.width||400,paddingBottom:"number"==typeof x.paddingBottom?x.paddingBottom:100}));var x;return t("div",Object.assign({ref:e=>u.refElement=e,className:o?`yoopta-editor ${o}`:"yoopta-editor",style:w,onMouseDown:e=>{f||(h.onMouseDown(e),g(),(e=>{var t;const n=u.refElement;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=F({id:I()});if(e.clientY>=o){const e=Object.keys(u.children).length-1,n=ne(u,{at:e}),r=re(u,{at:e});if(n&&r&&r.selection){const e=m.string(r,r.selection.anchor.path),o=k.parent(r.selection.anchor.path),[l]=m.node(r,o);if(n.type===i.type&&y.isElement(l)&&"void"!==(null===(t=l.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void u.focusBlock(n.id,{slate:r})}const o=e+1;u.insertBlock(i.type,{at:o,focus:!0})}})(e))},onBlur:e=>{var t;if((null===(t=u.refElement)||void 0===t?void 0:t.contains(e.relatedTarget))||f)return;g();const n=Z.getSelectedPaths(u);Array.isArray(n)&&n.length>0&&u.setPath({current:null,selected:null})},onCopy:b,onCut:b},{children:[e(Ua,{editor:u,marks:r,placeholder:n}),!1!==i&&e(Wa,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!f}),s]}))};function Za(e,t){const n=re(e);if(!n)return!1;const r=m.marks(n);return!!(null==r?void 0:r[t])}function Ja(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=re(e);if(!n)return null;const r=m.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>Za(e,r),toggle:()=>function(e,t){const n=re(e),r=Za(e,t);n&&(r?m.removeMark(n,t):m.addMark(n,t,!0))}(e,r),update:t=>function(e,t,n){const r=re(e);r&&r.selection&&E.isExpanded(r.selection)&&m.addMark(r,t,n)}(e,r,t)}})),n}function Ga({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const Qa=Ga({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),es=({id:t,editor:n,value:r,marks:o,plugins:i,autoFocus:l,className:a,tools:c,selectionBoxRoot:p,children:h,placeholder:g,readOnly:v,width:m,style:y,onChange:b})=>{const w=s((()=>o?[Qa,...o]:[Qa]),[o]),x=s((()=>i.map((e=>e.getPlugin))),[i]),[k,O]=f((()=>{n.id||(n.id=t||I()),n.readOnly=v||!1,w&&(n.formats=Ja(n,w)),n.blocks=function(e,t){const n={};return t.forEach((t=>{var r;const o=V(t.elements),i=null===(r=null==o?void 0:o.props)||void 0===r?void 0:r.nodeType;if("inline"!==i&&"inlineVoid"!==i){const r={};Object.keys(t.elements).forEach((e=>{const n=Rl(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,shortcuts:l}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,shortcuts:l},isActive:()=>{const n=ne(e,{at:e.path.current});return(null==n?void 0:n.type)===t.type}}}})),n}(n,x);const e=ue(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),n.children=e?r:{},n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=ge(e);if(0===r.children.length){const t=e.children[n];if(t){const n=K(e,t.type);r.children=[n]}}t[n]=r})),t}(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},o),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(x),n.commands=function(e,t){const n={};return t.forEach((t=>{t.commands&&Object.keys(t.commands).forEach((r=>{var o;(null===(o=t.commands)||void 0===o?void 0:o[r])&&(n[r]=(...n)=>{var o;return null===(o=t.commands)||void 0===o?void 0:o[r](e,...n)})}))})),n}(n,x),{editor:n,version:0}})),[E,S]=f(null),C=u((e=>{S(e)}),[]),_=u(((e,t)=>{if(O((e=>({editor:e.editor,version:e.version+1}))),"function"==typeof b&&Array.isArray(t.operations)){const n=t.operations.filter((e=>"validate_block_paths"!==e.type&&"set_block_path"!==e.type&&"set_slate"!==e.type));n.length>0&&b(e,{operations:n})}}),[]);return d((()=>{const e=e=>{_(e.value,{operations:e.operations})};return n.on("change",e),n.on("path-change",C),()=>{n.off("change",e),n.off("path-change",C)}}),[n,_]),e(Mt,Object.assign({editorState:k},{children:e(xo,Object.assign({tools:c},{children:e(qa,Object.assign({placeholder:g,marks:w,autoFocus:l,className:a,selectionBoxRoot:p,width:m,style:y},{children:h}))}))}))},ts=Object.assign(Object.assign({},za),{ExtendedBlockActions:({id:r,className:o,style:i,onClick:l,children:a})=>{const s=Ft(),[c,d]=f(!1),{refs:u,floatingStyles:p,context:h}=Ol({placement:"bottom-start",open:c,onOpenChange:d,middleware:[_i(),Ci(),Si(),si(10)],whileElementsMounted:Ei}),{isMounted:g,styles:v}=_l(h,{duration:100}),m=Object.assign(Object.assign({},v),p);return s?null:t(n,{children:[g&&e(Ia,Object.assign({isOpen:!0,onClose:()=>d(!1),refs:u,style:m},{children:a})),e("button",Object.assign({type:"button",contentEditable:!1,ref:u.setReference,id:r,className:`yoopta-button yoopta-extended-block-actions ${o||""}`,onClick:()=>{null==l||l(),d(!0)},style:c?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(Ea,{})}))]})},Portal:Ba,Overlay:Pa});function ns(e,t){var n;const r=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&r.push({text:t.textContent||""}),t.nodeType===Node.ELEMENT_NODE){const n=t;"P"!==n.nodeName&&"SPAN"!==n.nodeName&&"DIV"!==n.nodeName||r.push(Object.assign({},ns(e,n.childNodes)[0])),"B"!==n.nodeName&&"STRONG"!==n.nodeName||r.push(Object.assign({bold:!0},ns(e,n.childNodes)[0])),"I"!==n.nodeName&&"EM"!==n.nodeName||r.push(Object.assign({italic:!0},ns(e,n.childNodes)[0])),"S"!==n.nodeName&&"STRIKE"!==n.nodeName||r.push(Object.assign({strike:!0},ns(e,n.childNodes)[0])),"U"!==n.nodeName&&"INS"!==n.nodeName||r.push(Object.assign({underline:!0},ns(e,n.childNodes)[0])),"CODE"===n.nodeName&&r.push(Object.assign({code:!0},ns(e,n.childNodes)[0])),"A"===n.nodeName&&r.push({id:I(),type:"link",props:{url:n.getAttribute("href")||"",target:n.getAttribute("target")||"",rel:n.getAttribute("rel")||""},children:ns(e,n.childNodes)})}})),0!==r.length||(null===(n=r[0])||void 0===n?void 0:n.text)||r.push({text:""}),r}function rs(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`<b>${t}</b>`),e.italic&&(t=`<i>${t}</i>`),e.strike&&(t=`<s>${t}</s>`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`<code>${t}</code>`),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`<a href="${t}" target="${n}" rel="${r}">${rs(e.children)}</a>`}return""})).join("")}function os(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`**${t}**`),e.italic&&(t=`*${t}*`),e.strike&&(t=`~~${t}~~`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`\`${t}\``),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`[${os(e.children)}](${t})`}return""})).join("")}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}.yoopta-editor *{border:0 solid #e5e7eb;box-sizing:border-box;scrollbar-color:#d3d1cb transparent}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder{display:contents;position:relative}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block{background-color:#2383e224;border-radius:.25rem;height:100%;left:0;opacity:1;pointer-events:none;position:absolute;top:0;width:100%;z-index:90}.yoopta-block-actions{display:flex}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}.yoopta-align-left{justify-content:flex-start;text-align:left}.yoopta-align-center{justify-content:center;text-align:center}.yoopta-align-right{justify-content:flex-end;text-align:right}");export{Se as Blocks,Oe as Elements,Yl as HOTKEYS,Z as Paths,ts as UI,M as YooptaPlugin,F as buildBlockData,z as buildBlockElement,K as buildBlockElementsStructure,ge as buildSlateEditor,Bt as createYooptaEditor,Ga as createYooptaMark,es as default,ns as deserializeTextNodes,ne as findPluginBlockByPath,re as findSlateBySelectionPath,I as generateId,V as getRootBlockElement,H as getRootBlockElementType,rs as serializeTextNodes,os as serializeTextNodesIntoMarkdown,It as useBlockData,Vt as useBlockSelected,Lt as useYooptaEditor,zt as useYooptaFocused,Ht as useYooptaPluginOptions,Ft as useYooptaReadOnly,ko as useYooptaTools};