@yoopta/editor 4.0.0-rc.22 → 4.0.0-rc.24
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.
- package/dist/UI/BlockOptions/BlockOptions.d.ts.map +1 -1
- package/dist/YooptaEditor.d.ts +3 -2
- package/dist/YooptaEditor.d.ts.map +1 -1
- package/dist/components/Editor/Editor.d.ts +3 -2
- package/dist/components/Editor/Editor.d.ts.map +1 -1
- package/dist/components/SelectionBox/SelectionBox.d.ts +1 -1
- package/dist/components/SelectionBox/SelectionBox.d.ts.map +1 -1
- package/dist/editor/selection/setBlockSelected.d.ts +2 -2
- package/dist/editor/selection/setBlockSelected.d.ts.map +1 -1
- package/dist/editor/types.d.ts +2 -3
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.js +2 -2
- package/dist/plugins/SlateEditorComponent.d.ts.map +1 -1
- package/dist/plugins/createYooptaPlugin.d.ts +1 -1
- package/dist/plugins/createYooptaPlugin.d.ts.map +1 -1
- package/dist/utils/generateId.d.ts.map +1 -1
- package/package.json +2 -3
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 a,useRef as l,useLayoutEffect as c,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{randomFillSync as m}from"crypto";import*as b from"react-dom";import{unstable_batchedUpdates as y,createPortal as w}from"react-dom";import{ReactEditor as x,useSelected as k,Slate as E,Editable as C,DefaultElement as O,withReact as S}from"slate-react";import{Path as D,Editor as _,Element as R,Transforms as j,Range as B,Text as A,createEditor as T,Point as L}from"slate";class M{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n}=e,r=Object.assign(Object.assign({},this.plugin.options),n),o=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=o[e];n&&n.render&&(o[e].render=n=>t[e](n))})),new M({type:this.plugin.type,elements:o,events:this.plugin.events,parsers:this.plugin.parsers,options:r})}}function N(e,t={}){const n=Object.keys(e.children),{at:r=e.selection}=t,o=n.find((t=>e.children[t].meta.order===(null==r?void 0:r[0])));return o?e.children[o]:null}const I={editor:{getBlock:()=>{},insertBlock:()=>{},insertBlocks:()=>{},updateBlock:()=>{},moveBlock:()=>{},splitBlock:()=>{},deleteBlock:()=>{},toggleBlock:()=>{},focusBlock:()=>{},setSelection:()=>{},applyChanges:()=>{},decreaseBlockDepth:()=>{},increaseBlockDepth:()=>{},setBlockSelected:()=>{},selectedBlocks:[],duplicateBlock:()=>{},getEditorValue:()=>{},blur:()=>{},blocks:{},shortcuts:{},plugins:{},formats:{},selection:null,readOnly:!1,blockEditorsMap:{},children:{},emit:()=>{},on:()=>{},off:()=>{},once:()=>{}}},P=i(I),z=({children:t,editorState:n})=>{const r=l(I);return r.current={editor:n.editor},e(P.Provider,Object.assign({value:r.current},{children:t}))},F=()=>{const e=a(P);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},U=e=>F().children[e],H=e=>F().blocks[e],V=e=>F().plugins[e],W=()=>F().readOnly,K=e=>{var t;return null===(t=V(e))||void 0===t?void 0:t.options},Y=({blockId:e,path:t})=>{var n;const r=F();if(!e&&!t)throw new Error("useBlockSelected must receive either blockId or path");let o;return e&&(o=r.children[e]),t&&(o=N(r,{at:t})),(null===(n=r.selection)||void 0===n?void 0:n[0])===(null==o?void 0:o.meta.order)};var X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},$={};!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,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new o(r,i||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],l]:e._events[c].push(l):(e._events[c]=l,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.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},l.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,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,o,i,a){var l=n?n+e:e;if(!this._events[l])return!1;var c,s,d=this._events[l],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,a),!0}for(s=1,c=new Array(u-1);s<u;s++)c[s-1]=arguments[s];d.fn.apply(d.context,c)}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,r);break;case 4:d[s].fn.call(d[s].context,t,r,o);break;default:if(!c)for(f=1,c=new Array(u-1);f<u;f++)c[f-1]=arguments[f];d[s].fn.apply(d[s].context,c)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||o&&!l.once||r&&l.context!==r||a(this,i);else{for(var c=0,s=[],d=l.length;c<d;c++)(l[c].fn!==t||o&&!l[c].once||r&&l[c].context!==r)&&s.push(l[c]);s.length?this._events[i]=1===s.length?s[0]:s:a(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}({get exports(){return $},set exports(e){$=e}});var Z=$;let q,G,J=(e=21)=>{var t;t=e-=0,!q||q.length<t?(q=Buffer.allocUnsafe(128*t),m(q),G=0):G+t>q.length&&(m(q),G=0),G+=t;let n="";for(let t=G-e;t<G;t++)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&q[t]];return n};const Q=()=>{var e;return"undefined"==typeof window?J():"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?function(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}():J()},ee=e=>({id:Q(),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)}),te=e=>({id:(null==e?void 0:e.id)||Q(),value:(null==e?void 0:e.value)||[ee()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});const ne="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function re(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function oe(e){return"nodeType"in e}function ie(e){var t,n;return e?re(e)?e:oe(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function ae(e){const{Document:t}=ie(e);return e instanceof t}function le(e){return!re(e)&&e instanceof ie(e).HTMLElement}function ce(e){return e instanceof ie(e).SVGElement}function se(e){return e?re(e)?e.document:oe(e)?ae(e)?e:le(e)||ce(e)?e.ownerDocument:document:document:document}const de=ne?c:s;function ue(e){const t=l(e);return de((()=>{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 fe(e,t){void 0===t&&(t=[e]);const n=l(e);return de((()=>{n.current!==e&&(n.current=e)}),t),n}function pe(e,t){const n=l();return d((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function he(e){const t=ue(e),n=l(null),r=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function ge(e){const t=l();return s((()=>{t.current=e}),[e]),t.current}let ve={};function me(e,t){return d((()=>{if(t)return t;const n=null==ve[e]?0:ve[e]+1;return ve[e]=n,e+"-"+n}),[e,t])}function be(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 ye=be(1),we=be(-1);function xe(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function ke(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=ie(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 Ee=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[Ee.Translate.toString(e),Ee.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ce="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Oe(e){return e.matches(Ce)?e:e.querySelector(Ce)}const Se={display:"none"};function De(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:Se},n)}function _e(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 Re=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 Ae(e){let{announcements:t=Be,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=je}=e;const{announce:l,announcement:c}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=me("DndLiveRegion"),[h,g]=f(!1);if(s((()=>{g(!0)}),[]),function(e){const t=a(Re);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;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}})),[l,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(De,{id:r,value:i.draggable}),o.createElement(_e,{id:p,announcement:c}));return n?w(v,n):v}var Te;function Le(){}function Me(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"}(Te||(Te={}));const Ne=Object.freeze({x:0,y:0});function Ie(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Pe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ze(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Fe(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 Ue(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function He(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 Ve=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=He(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Ie(He(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Pe)};function We(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),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const Ke=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=We(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(ze)};function Ye(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ne}function Xe(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 $e=Xe(1);const Ze={ignoreTransform:!1};function qe(e,t){void 0===t&&(t=Ze);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=ie(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:a,y:l}=r,c=e.left-a-(1-o)*parseFloat(n),s=e.top-l-(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:s,right:c+d,bottom:s+u,left:c}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:c}}function Ge(e){return qe(e,{ignoreTransform:!0})}function Je(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(ae(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!le(o)||ce(o))return n;if(n.includes(o))return n;const i=ie(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=ie(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=ie(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Qe(e){const[t]=Je(e,1);return null!=t?t:null}function et(e){return ne&&e?re(e)?e:oe(e)?ae(e)||e===se(e).scrollingElement?window:le(e)?e:null:null:null}function tt(e){return re(e)?e.scrollX:e.scrollLeft}function nt(e){return re(e)?e.scrollY:e.scrollTop}function rt(e){return{x:tt(e),y:nt(e)}}var ot;function it(e){return!(!ne||!e)&&e===document.scrollingElement}function at(e){const t={x:0,y:0},n=it(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"}(ot||(ot={}));const lt={x:.2,y:.2};function ct(e,t,n,r,o){let{top:i,left:a,right:l,bottom:c}=n;void 0===r&&(r=10),void 0===o&&(o=lt);const{isTop:s,isBottom:d,isLeft:u,isRight:f}=at(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!s&&i<=t.top+g?(p.y=ot.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!d&&c>=t.bottom-g&&(p.y=ot.Forward,h.y=r*Math.abs((t.bottom-g-c)/g)),!f&&l>=t.right-v?(p.x=ot.Forward,h.x=r*Math.abs((t.right-v-l)/v)):!u&&a<=t.left+v&&(p.x=ot.Backward,h.x=r*Math.abs((t.left+v-a)/v)),{direction:p,speed:h}}function st(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 dt(e){return e.reduce(((e,t)=>ye(e,rt(t))),Ne)}const ut=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+tt(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+nt(t)),0)}]];class ft{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=Je(t),r=dt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of ut)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class pt{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 ht(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 gt,vt;function mt(e){e.preventDefault()}function bt(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"}(gt||(gt={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(vt||(vt={}));const yt={start:[vt.Space,vt.Enter],cancel:[vt.Esc],end:[vt.Space,vt.Enter]},wt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case vt.Right:return{...n,x:n.x+25};case vt.Left:return{...n,x:n.x-25};case vt.Down:return{...n,y:n.y+25};case vt.Up:return{...n,y:n.y-25}}};class xt{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 pt(se(t)),this.windowListeners=new pt(ie(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(gt.Resize,this.handleCancel),this.windowListeners.add(gt.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(gt.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=qe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Qe(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Ne)}handleKeyDown(e){if(xe(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=yt,coordinateGetter:i=wt,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=n.current,s=c?{x:c.left,y:c.top}:Ne;this.referenceCoordinates||(this.referenceCoordinates=s);const d=i(e,{active:t,context:n.current,currentCoordinates:s});if(d){const t=we(d,s),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:c,isBottom:s,maxScroll:u,minScroll:f}=at(n),p=st(n),h={x:Math.min(o===vt.Right?p.right-p.width/2:p.right,Math.max(o===vt.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(o===vt.Down?p.bottom-p.height/2:p.bottom,Math.max(o===vt.Down?p.top:p.top+p.height/2,d.y))},g=o===vt.Right&&!l||o===vt.Left&&!c,v=o===vt.Down&&!s||o===vt.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=o===vt.Right&&e<=u.x||o===vt.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===vt.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=o===vt.Down&&e<=u.y||o===vt.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===vt.Down?n.scrollTop-u.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,ye(we(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 kt(e){return Boolean(e&&"distance"in e)}function Et(e){return Boolean(e&&"delay"in e)}xt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=yt,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class Ct{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=ie(e);return e instanceof t?e:se(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=se(i),this.documentListeners=new pt(this.document),this.listeners=new pt(n),this.windowListeners=new pt(ie(i)),this.initialCoordinates=null!=(r=ke(o))?r:Ne,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(gt.Resize,this.handleCancel),this.windowListeners.add(gt.DragStart,mt),this.windowListeners.add(gt.VisibilityChange,this.handleCancel),this.windowListeners.add(gt.ContextMenu,mt),this.documentListeners.add(gt.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Et(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(kt(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(gt.Click,bt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(gt.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=ke(e))?t:Ne,c=we(r,l);if(!n&&a){if(kt(a)){if(null!=a.tolerance&&ht(c,a.tolerance))return this.handleCancel();if(ht(c,a.distance))return this.handleStart()}return Et(a)&&ht(c,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===vt.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ot={move:{name:"pointermove"},end:{name:"pointerup"}};class St extends Ct{constructor(e){const{event:t}=e,n=se(t.target);super(e,Ot,n)}}St.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 Dt={move:{name:"mousemove"},end:{name:"mouseup"}};var _t;!function(e){e[e.RightClick=2]="RightClick"}(_t||(_t={}));(class extends Ct{constructor(e){super(e,Dt,se(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==_t.RightClick&&(null==r||r({event:n}),!0)}}];const Rt={move:{name:"touchmove"},end:{name:"touchend"}};var jt,Bt;function At(e){let{acceleration:t,activator:n=jt.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:c=Bt.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=ge(t);return pe((e=>{if(n||!r||!e)return Tt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ot.Backward]:e.x[ot.Backward]||-1===o.x,[ot.Forward]:e.x[ot.Forward]||1===o.x},y:{[ot.Backward]:e.y[ot.Backward]||-1===o.y,[ot.Forward]:e.y[ot.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[b,y]=function(){const e=l(null);return[u(((t,n)=>{e.current=setInterval(t,n)}),[]),u((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=l({x:0,y:0}),x=l({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 o}}),[n,o,f]),E=l(null),C=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)}),[]),O=d((()=>c===Bt.TreeOrder?[...p].reverse():p),[c,p]);s((()=>{if(i&&p.length&&k){for(const e of O){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:l}=ct(e,o,k,t,v);for(const e of["x","y"])m[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0)return y(),E.current=e,b(C,a),w.current=l,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},y()}else y()}),[t,C,r,y,i,a,JSON.stringify(k),JSON.stringify(m),b,p,O,h,JSON.stringify(v)])}(class extends Ct{constructor(e){super(e,Rt)}static setup(){return window.addEventListener(Rt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Rt.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"}(jt||(jt={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(Bt||(Bt={}));const Tt={x:{[ot.Backward]:!1,[ot.Forward]:!1},y:{[ot.Backward]:!1,[ot.Forward]:!1}};var Lt,Mt;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Lt||(Lt={})),function(e){e.Optimized="optimized"}(Mt||(Mt={}));const Nt=new Map;function It(e,t){return pe((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Pt(e){let{callback:t,disabled:n}=e;const r=ue(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return s((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function zt(e){return new ft(qe(e),e)}function Ft(e,t,n){void 0===t&&(t=zt);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=ue(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return s((()=>()=>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}}}}),a=Pt({callback:o});return de((()=>{o(),e?(null==a||a.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==i||i.disconnect())}),[e]),r}const Ut=[];function Ht(e,t){void 0===t&&(t=[]);const n=l(null);return s((()=>{n.current=null}),t),s((()=>{const t=e!==Ne;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?we(e,n.current):Ne}function Vt(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 Wt=[];function Kt(e){let{measure:t}=e;const[n,r]=f(null),o=u((e=>{for(const{target:n}of e)if(le(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=Pt({callback:o}),a=u((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return le(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[l,c]=he(a);return d((()=>({nodeRef:l,rect:n,setRef:c})),[n,l,c])}const Yt=[{sensor:St,options:{}},{sensor:xt,options:{}}],Xt={current:{}},$t={draggable:{measure:Ge},droppable:{measure:Ge,strategy:Lt.WhileDragging,frequency:Mt.Optimized},dragOverlay:{measure:qe}};class Zt 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 qt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Zt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Le},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$t,measureDroppableContainers:Le,windowRect:null,measuringScheduled:!1},Gt=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Le,draggableNodes:new Map,over:null,measureDroppableContainers:Le}),Jt=i(qt);function Qt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Zt}}}function en(e,t){switch(t.type){case Te.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Te.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 Te.DragEnd:case Te.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Te.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Zt(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Te.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Zt(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Te.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Zt(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function tn(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=a(Gt),i=ge(r),l=ge(null==n?void 0:n.id);return s((()=>{if(!t&&!r&&i&&null!=l){if(!xe(i))return;if(document.activeElement===i.target)return;const e=o.get(l);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=Oe(e);if(t){t.focus();break}}}))}}),[r,t,o,l,i]),null}const nn=i({...Ne,scaleX:1,scaleY:1});var rn;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(rn||(rn={}));const on=p((function(e){var t,n,r,i;let{id:a,accessibility:c,autoScroll:p=!0,children:g,sensors:v=Yt,collisionDetection:m=Ke,measuring:b,modifiers:w,...x}=e;const k=h(en,void 0,Qt),[E,C]=k,[O,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]}(),[D,_]=f(rn.Uninitialized),R=D===rn.Initialized,{draggable:{active:j,nodes:B,translate:A},droppable:{containers:T}}=E,L=j?B.get(j):null,M=l({initial:null,translated:null}),N=d((()=>{var e;return null!=j?{id:j,data:null!=(e=null==L?void 0:L.data)?e:Xt,rect:M}:null}),[j,L]),I=l(null),[P,z]=f(null),[F,U]=f(null),H=fe(x,Object.values(x)),V=me("DndDescribedBy",a),W=d((()=>T.getEnabled()),[T]),K=d((()=>({draggable:{...$t.draggable,...null==Y?void 0:Y.draggable},droppable:{...$t.droppable,...null==Y?void 0:Y.droppable},dragOverlay:{...$t.dragOverlay,...null==Y?void 0:Y.dragOverlay}})),[null==(Y=b)?void 0:Y.draggable,null==Y?void 0:Y.droppable,null==Y?void 0:Y.dragOverlay]);var Y;const{droppableRects:X,measureDroppableContainers:$,measuringScheduled:Z}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=f(null),{frequency:c,measure:d,strategy:p}=o,h=l(e),g=function(){switch(p){case Lt.Always:return!1;case Lt.BeforeDragging:return n;default:return!n}}(),v=fe(g),m=u((function(e){void 0===e&&(e=[]),v.current||a((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),b=l(null),y=pe((t=>{if(g&&!n)return Nt;if(!t||t===Nt||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 ft(d(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}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&&a(null)}),[JSON.stringify(i)]),s((()=>{g||"number"!=typeof c||null!==b.current||(b.current=setTimeout((()=>{m(),b.current=null}),c))}),[c,g,m,...r]),{droppableRects:y,measureDroppableContainers:m,measuringScheduled:null!=i}}(W,{dragging:R,dependencies:[A.x,A.y],config:K.droppable}),q=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return pe((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(B,j),G=d((()=>F?ke(F):null),[F]),J=function(){const e=!1===(null==P?void 0:P.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=R&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return It(e,t)}(q,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l(!1),{x:a,y:c}="boolean"==typeof o?{x:o,y:o}:o;de((()=>{if(!a&&!c||!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=Ye(n(e),r);if(a||(o.x=0),c||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Qe(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,a,c,r,n])}({activeNode:j?B.get(j):null,config:J.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=Ft(q,K.draggable.measure,Q),te=Ft(q?q.parentElement:null),re=l({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:B,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=T.getNodeFor(null==(t=re.current.over)?void 0:t.id),ae=Kt({measure:K.dragOverlay.measure}),le=null!=(n=ae.nodeRef.current)?n:q,ce=R?null!=(r=ae.rect)?r:ee:null,se=Boolean(ae.nodeRef.current&&ae.rect),ue=Ye(he=se?null:ee,It(he));var he;const ge=Vt(le?ie(le):null),ve=function(e){const t=l(e),n=pe((n=>e?n&&n!==Ut&&e&&t.current&&e.parentNode===t.current.parentNode?n:Je(e):Ut),[e]);return s((()=>{t.current=e}),[e]),n}(R?null!=oe?oe:q:null),be=function(e,t){void 0===t&&(t=qe);const[n]=e,r=Vt(n?ie(n):null),[o,i]=h((function(){return e.length?e.map((e=>it(e)?r:new ft(t(e),e))):Wt}),Wt),a=Pt({callback:i});return e.length>0&&o===Wt&&i(),de((()=>{e.length?e.forEach((e=>null==a?void 0:a.observe(e))):(null==a||a.disconnect(),i())}),[e]),o}(ve),we=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(w,{transform:{x:A.x-ue.x,y:A.y-ue.y,scaleX:1,scaleY:1},activatorEvent:F,active:N,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:ce,over:re.current.over,overlayNodeRect:ae.rect,scrollableAncestors:ve,scrollableAncestorRects:be,windowRect:ge}),xe=G?ye(G,A):null,Ee=function(e){const[t,n]=f(null),r=l(e),o=u((e=>{const t=et(e.target);t&&n((e=>e?(e.set(t,rt(t)),new Map(e)):null))}),[]);return s((()=>{const t=r.current;if(e!==t){i(t);const a=e.map((e=>{const t=et(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,rt(t)]):null})).filter((e=>null!=e));n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=et(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),d((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>ye(e,t)),Ne):dt(e):Ne),[e,t])}(ve),Ce=Ht(Ee),Oe=Ht(Ee,[ee]),Se=ye(we,Ce),De=ce?$e(ce,we):null,_e=N&&De?m({active:N,collisionRect:De,droppableRects:X,droppableContainers:W,pointerCoordinates:xe}):null,je=Ue(_e,"id"),[Be,Le]=f(null),Me=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(se?we:ye(we,Oe),null!=(i=null==Be?void 0:Be.rect)?i:null,ee),Ie=u(((e,t)=>{let{sensor:n,options:r}=t;if(null==I.current)return;const o=B.get(I.current);if(!o)return;const i=e.nativeEvent,a=new n({active:I.current,activeNode:o,event:i,options:r,context:re,onStart(e){const t=I.current;if(null==t)return;const n=B.get(t);if(!n)return;const{onDragStart:r}=H.current,o={active:{id:t,data:n.data,rect:M}};y((()=>{null==r||r(o),_(rn.Initializing),C({type:Te.DragStart,initialCoordinates:e,active:t}),O({type:"onDragStart",event:o})}))},onMove(e){C({type:Te.DragMove,coordinates:e})},onEnd:l(Te.DragEnd),onCancel:l(Te.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=re.current;let a=null;if(t&&o){const{cancelDrop:l}=H.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===Te.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=Te.DragCancel)}}I.current=null,y((()=>{C({type:e}),_(rn.Uninitialized),Le(null),z(null),U(null);const t=e===Te.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=H.current[t];null==e||e(a),O({type:t,event:a})}}))}}y((()=>{z(a),U(e.nativeEvent)}))}),[B]),Pe=u(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=B.get(r);if(null!==I.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},I.current=r,Ie(n,t))}),[B,Ie]),ze=function(e,t){return d((()=>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,Pe);!function(e){s((()=>{if(!ne)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),de((()=>{ee&&D===rn.Initializing&&_(rn.Initialized)}),[ee,D]),s((()=>{const{onDragMove:e}=H.current,{active:t,activatorEvent:n,collisions:r,over:o}=re.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:o};y((()=>{null==e||e(i),O({type:"onDragMove",event:i})}))}),[Se.x,Se.y]),s((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=re.current;if(!e||null==I.current||!t||!o)return;const{onDragOver:i}=H.current,a=r.get(je),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};y((()=>{Le(l),null==i||i(c),O({type:"onDragOver",event:c})}))}),[je]),de((()=>{re.current={activatorEvent:F,active:N,activeNode:q,collisionRect:De,collisions:_e,droppableRects:X,draggableNodes:B,draggingNode:le,draggingNodeRect:ce,droppableContainers:T,over:Be,scrollableAncestors:ve,scrollAdjustedTranslate:Se},M.current={initial:ce,translated:De}}),[N,q,_e,De,B,le,ce,X,T,Be,ve,Se]),At({...J,delta:A,draggingRect:De,pointerCoordinates:xe,scrollableAncestors:ve,scrollableAncestorRects:be});const Fe=d((()=>({active:N,activeNode:q,activeNodeRect:ee,activatorEvent:F,collisions:_e,containerNodeRect:te,dragOverlay:ae,draggableNodes:B,droppableContainers:T,droppableRects:X,over:Be,measureDroppableContainers:$,scrollableAncestors:ve,scrollableAncestorRects:be,measuringConfiguration:K,measuringScheduled:Z,windowRect:ge})),[N,q,ee,F,_e,te,ae,B,T,X,Be,$,ve,be,K,Z,ge]),He=d((()=>({activatorEvent:F,activators:ze,active:N,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:C,draggableNodes:B,over:Be,measureDroppableContainers:$})),[F,ze,N,ee,C,V,B,Be,$]);return o.createElement(Re.Provider,{value:S},o.createElement(Gt.Provider,{value:He},o.createElement(Jt.Provider,{value:Fe},o.createElement(nn.Provider,{value:Me},g)),o.createElement(tn,{disabled:!1===(null==c?void 0:c.restoreFocus)})),o.createElement(Ae,{...c,hiddenTextDescribedById:V}))})),an=i(null),ln="button",cn="Droppable";function sn(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=me(cn),{activators:l,activatorEvent:c,active:s,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=a(Gt),{role:g=ln,roleDescription:v="draggable",tabIndex:m=0}=null!=o?o:{},b=(null==s?void 0:s.id)===t,y=a(b?nn:an),[w,x]=he(),[k,E]=he(),C=function(e,t){return d((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(l,t),O=fe(n);de((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:O}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:s,activatorEvent:c,activeNodeRect:u,attributes:d((()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":!(!b||g!==ln)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,b,v,f.draggable]),isDragging:b,listeners:r?void 0:C,node:w,over:h,setNodeRef:x,setActivatorNodeRef:E,transform:y}}const dn="Droppable",un={timeout:25};function fn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function pn(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function hn(e){return null!==e&&e>=0}const gn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=fn(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},vn={scaleX:1,scaleY:1},mn=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...vn}:null}const c=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<=a?{x:0,y:-l.height-c,...vn}:o<n&&o>=a?{x:0,y:l.height+c,...vn}:{x:0,y:0,...vn}};const bn="Sortable",yn=o.createContext({activeIndex:-1,containerId:bn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gn,disabled:{draggable:!1,droppable:!1}});function wn(e){let{children:t,id:n,items:r,strategy:i=gn,disabled:c=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=a(Jt),v=me(bn,n),m=Boolean(null!==f.rect),b=d((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),y=null!=u,w=u?b.indexOf(u.id):-1,x=h?b.indexOf(h.id):-1,k=l(b),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}(b,k.current),C=-1!==x&&-1===w||E,O=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);de((()=>{E&&y&&g(b)}),[E,b,y,g]),s((()=>{k.current=b}),[b]);const S=d((()=>({activeIndex:w,containerId:v,disabled:O,disableTransforms:C,items:b,overIndex:x,useDragOverlay:m,sortedRects:pn(b,p),strategy:i})),[w,v,O.draggable,O.droppable,C,b,x,p,m,i]);return o.createElement(yn.Provider,{value:S},t)}const xn=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return fn(n,r,o).indexOf(t)},kn=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:s}=e;return!(!s||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===c))},En={duration:200,easing:"ease"},Cn="transform",On=Ee.Transition.toString({property:Cn,duration:0,easing:"linear"}),Sn={roleDescription:"sortable"};function Dn(e){let{animateLayoutChanges:t=kn,attributes:n,disabled:r,data:o,getNewIndex:i=xn,id:c,strategy:p,resizeObserverConfig:h,transition:g=En}=e;const{items:v,containerId:m,activeIndex:b,disabled:y,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:E,strategy:C}=a(yn),O=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,y),S=v.indexOf(c),D=d((()=>({sortable:{containerId:m,index:S,items:v},...o})),[m,o,S,v]),_=d((()=>v.slice(v.indexOf(c))),[v,c]),{rect:R,node:j,isOver:B,setNodeRef:A}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=me(dn),{active:c,dispatch:d,over:f,measureDroppableContainers:p}=a(Gt),h=l({disabled:n}),g=l(!1),v=l(null),m=l(null),{disabled:b,updateMeasurementsFor:y,timeout:w}={...un,...o},x=fe(null!=y?y:r),k=Pt({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:b||!c}),E=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[C,O]=he(E),S=fe(t);return s((()=>{k&&C.current&&(k.disconnect(),g.current=!1,k.observe(C.current))}),[C,k]),de((()=>(d({type:Te.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:v,data:S}}),()=>d({type:Te.UnregisterDroppable,key:i,id:r}))),[r]),s((()=>{n!==h.current.disabled&&(d({type:Te.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,d]),{active:c,rect:v,isOver:(null==f?void 0:f.id)===r,node:C,over:f,setNodeRef:O}}({id:c,data:D,disabled:O.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...h}}),{active:T,activatorEvent:L,activeNodeRect:M,attributes:N,setNodeRef:I,listeners:P,isDragging:z,over:F,setActivatorNodeRef:U,transform:H}=sn({id:c,data:D,attributes:{...Sn,...n},disabled:O.draggable}),V=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)}(A,I),W=Boolean(T),K=W&&!w&&hn(b)&&hn(k),Y=!E&&z,X=Y&&K?H:null,$=K?null!=X?X:(null!=p?p:C)({rects:x,activeNodeRect:M,activeIndex:b,overIndex:k,index:S}):null,Z=hn(b)&&hn(k)?i({id:c,items:v,activeIndex:b,overIndex:k}):S,q=null==T?void 0:T.id,G=l({activeId:q,items:v,newIndex:Z,containerId:m}),J=v!==G.current.items,Q=t({active:T,containerId:m,isDragging:z,isSorting:W,id:c,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:r,rect:o}=e;const[i,a]=f(null),c=l(n);return de((()=>{if(!t&&n!==c.current&&r.current){const e=o.current;if(e){const t=qe(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)&&a(n)}}n!==c.current&&(c.current=n)}),[t,n,r,o]),s((()=>{i&&a(null)}),[i]),i}({disabled:!Q,index:S,node:j,rect:R});return s((()=>{W&&G.current.newIndex!==Z&&(G.current.newIndex=Z),m!==G.current.containerId&&(G.current.containerId=m),v!==G.current.items&&(G.current.items=v)}),[W,Z,m,v]),s((()=>{if(q===G.current.activeId)return;if(q&&!G.current.activeId)return void(G.current.activeId=q);const e=setTimeout((()=>{G.current.activeId=q}),50);return()=>clearTimeout(e)}),[q]),{active:T,activeIndex:b,attributes:N,data:D,rect:R,index:S,newIndex:Z,items:v,isOver:B,isSorting:W,isDragging:z,listeners:P,node:j,overIndex:k,over:F,setNodeRef:V,setActivatorNodeRef:U,setDroppableNodeRef:A,setDraggableNodeRef:I,transform:null!=ee?ee:$,transition:function(){if(ee||J&&G.current.newIndex===S)return On;if(Y&&!xe(L)||!g)return;if(W||Q)return Ee.Transition.toString({...g,property:Cn});return}()}}function _n(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 Rn=[vt.Down,vt.Right,vt.Up,vt.Left],jn=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(Rn.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 vt.Down:r.top<i.top&&t.push(n);break;case vt.Up:r.top>i.top&&t.push(n);break;case vt.Left:r.left>i.left&&t.push(n);break;case vt.Right:r.left<i.left&&t.push(n)}}));const c=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Fe(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Fe(r),a=o.reduce(((e,t,r)=>e+Ie(n[r],t)),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(Pe)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let s=Ue(c,"id");if(s===(null==a?void 0:a.id)&&c.length>1&&(s=c[1].id),null!=s){const e=i.get(n.id),t=i.get(s),a=t?o.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&a&&e&&t){const n=Je(c).some(((e,t)=>l[t]!==e)),o=Bn(e,t),i=function(e,t){if(!_n(e)||!_n(t))return!1;if(!Bn(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),s=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},d={x:a.left,y:a.top};return s.x&&s.y?d:we(d,s)}}}};function Bn(e,t){return!(!_n(e)||!_n(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var An;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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tn.apply(this,arguments)}var Ln,Mn=function(e){return r.createElement("svg",Tn({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),An||(An=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 Nn(){return Nn=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},Nn.apply(this,arguments)}var In=function(e){return r.createElement("svg",Nn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Ln||(Ln=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 Pn(e,t={}){const n=Object.keys(e.children),{at:r=e.selection}=t,o=n.find((t=>e.children[t].meta.order===(null==r?void 0:r[0])));if(o)return e.blockEditorsMap[o]}function zn(e){return Hn(e)?(e.nodeName||"").toLowerCase():"#document"}function Fn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Un(e){var t;return null==(t=(Hn(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Hn(e){return e instanceof Node||e instanceof Fn(e).Node}function Vn(e){return e instanceof Element||e instanceof Fn(e).Element}function Wn(e){return e instanceof HTMLElement||e instanceof Fn(e).HTMLElement}function Kn(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Fn(e).ShadowRoot)}function Yn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Xn(e){return["table","td","th"].includes(zn(e))}function $n(e){const t=Zn(),n=Gn(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 Zn(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function qn(e){return["html","body","#document"].includes(zn(e))}function Gn(e){return Fn(e).getComputedStyle(e)}function Jn(e){return Vn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Qn(e){if("html"===zn(e))return e;const t=e.assignedSlot||e.parentNode||Kn(e)&&e.host||Un(e);return Kn(t)?t.host:t}function er(e){const t=Qn(e);return qn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Wn(t)&&Yn(t)?t:er(t)}function tr(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=er(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Fn(o);return i?t.concat(a,a.visualViewport||[],Yn(o)?o:[],a.frameElement&&n?tr(a.frameElement):[]):t.concat(o,tr(o,[],n))}const nr=Math.min,rr=Math.max,or=Math.round,ir=Math.floor,ar=e=>({x:e,y:e}),lr={left:"right",right:"left",bottom:"top",top:"bottom"},cr={start:"end",end:"start"};function sr(e,t,n){return rr(e,nr(t,n))}function dr(e,t){return"function"==typeof e?e(t):e}function ur(e){return e.split("-")[0]}function fr(e){return e.split("-")[1]}function pr(e){return"x"===e?"y":"x"}function hr(e){return"y"===e?"height":"width"}function gr(e){return["top","bottom"].includes(ur(e))?"y":"x"}function vr(e){return pr(gr(e))}function mr(e){return e.replace(/start|end/g,(e=>cr[e]))}function br(e){return e.replace(/left|right|bottom|top/g,(e=>lr[e]))}function yr(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 wr(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function xr(e,t,n){let{reference:r,floating:o}=e;const i=gr(t),a=vr(t),l=hr(a),c=ur(t),s="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(c){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(fr(t)){case"start":p[a]-=f*(n&&s?-1:1);break;case"end":p[a]+=f*(n&&s?-1:1)}return p}async function kr(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:s="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=dr(t,e),h=yr(p),g=l[f?"floating"===u?"reference":"floating":u],v=wr(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(l.floating)),boundary:s,rootBoundary:d,strategy:c})),m="floating"===u?{...a.floating,x:r,y:o}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=wr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:m,offsetParent:b,strategy:c}):m);return{top:(v.top-w.top+h.top)/y.y,bottom:(w.bottom-v.bottom+h.bottom)/y.y,left:(v.left-w.left+h.left)/y.x,right:(w.right-v.right+h.right)/y.x}}function Er(e){const t=nr(...e.map((e=>e.left))),n=nr(...e.map((e=>e.top)));return{x:t,y:n,width:rr(...e.map((e=>e.right)))-t,height:rr(...e.map((e=>e.bottom)))-n}}const Cr=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,c=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=ur(n),l=fr(n),c="y"===gr(n),s=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,u=dr(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 l&&"number"==typeof h&&(p="end"===l?-1*h:h),c?{x:p*d,y:f*s}:{x:f*s,y:p*d}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}};function Or(e){const t=Gn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Wn(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=or(n)!==i||or(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Sr(e){return Vn(e)?e:e.contextElement}function Dr(e){const t=Sr(e);if(!Wn(t))return ar(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Or(t);let a=(i?or(n.width):n.width)/r,l=(i?or(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const _r=ar(0);function Rr(e){const t=Fn(e);return Zn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:_r}function jr(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Sr(e);let a=ar(1);t&&(r?Vn(r)&&(a=Dr(r)):a=Dr(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Fn(e))&&t}(i,n,r)?Rr(i):ar(0);let c=(o.left+l.x)/a.x,s=(o.top+l.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const e=Fn(i),t=r&&Vn(r)?Fn(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=Dr(o),t=o.getBoundingClientRect(),r=Gn(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,s*=e.y,d*=e.x,u*=e.y,c+=i,s+=a,n=Fn(o),o=n.frameElement}}return wr({width:d,height:u,x:c,y:s})}const Br=[":popover-open",":modal"];function Ar(e){return Br.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Tr(e){return jr(Un(e)).left+Jn(e).scrollLeft}function Lr(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Fn(e),r=Un(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;const e=Zn();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:l,y:c}}(e,n);else if("document"===t)r=function(e){const t=Un(e),n=Jn(e),r=e.ownerDocument.body,o=rr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=rr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Tr(e);const l=-n.scrollTop;return"rtl"===Gn(r).direction&&(a+=rr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(Un(e));else if(Vn(t))r=function(e,t){const n=jr(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Wn(e)?Dr(e):ar(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=Rr(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return wr(r)}function Mr(e,t){const n=Qn(e);return!(n===t||!Vn(n)||qn(n))&&("fixed"===Gn(n).position||Mr(n,t))}function Nr(e,t,n){const r=Wn(t),o=Un(t),i="fixed"===n,a=jr(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=ar(0);if(r||!r&&!i)if(("body"!==zn(t)||Yn(o))&&(l=Jn(t)),r){const e=jr(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&(c.x=Tr(o));return{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function Ir(e,t){return Wn(e)&&"fixed"!==Gn(e).position?t?t(e):e.offsetParent:null}function Pr(e,t){const n=Fn(e);if(!Wn(e)||Ar(e))return n;let r=Ir(e,t);for(;r&&Xn(r)&&"static"===Gn(r).position;)r=Ir(r,t);return r&&("html"===zn(r)||"body"===zn(r)&&"static"===Gn(r).position&&!$n(r))?n:r||function(e){let t=Qn(e);for(;Wn(t)&&!qn(t);){if($n(t))return t;t=Qn(t)}return null}(e)||n}const zr={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Un(r),l=!!t&&Ar(t.floating);if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},s=ar(1);const d=ar(0),u=Wn(r);if((u||!u&&!i)&&(("body"!==zn(r)||Yn(a))&&(c=Jn(r)),Wn(r))){const e=jr(r);s=Dr(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-c.scrollLeft*s.x+d.x,y:n.y*s.y-c.scrollTop*s.y+d.y}},getDocumentElement:Un,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=tr(e,[],!1).filter((e=>Vn(e)&&"body"!==zn(e))),o=null;const i="fixed"===Gn(e).position;let a=i?Qn(e):e;for(;Vn(a)&&!qn(a);){const t=Gn(a),n=$n(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Yn(a)&&!n&&Mr(e,a))?r=r.filter((e=>e!==a)):o=t,a=Qn(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],l=i.reduce(((e,n)=>{const r=Lr(t,n,o);return e.top=rr(r.top,e.top),e.right=nr(r.right,e.right),e.bottom=nr(r.bottom,e.bottom),e.left=rr(r.left,e.left),e}),Lr(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Pr,getElementRects:async function(e){const t=this.getOffsetParent||Pr,n=this.getDimensions;return{reference:Nr(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}=Or(e);return{width:t,height:n}},getScale:Dr,isElement:Vn,isRTL:function(e){return"rtl"===Gn(e).direction}};function Fr(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,s=Sr(e),d=o||i?[...s?tr(s):[],...tr(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=s&&l?function(e,t){let n,r=null;const o=Un(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,c){void 0===l&&(l=!1),void 0===c&&(c=1),i();const{left:s,top:d,width:u,height:f}=e.getBoundingClientRect();if(l||t(),!u||!f)return;const p={rootMargin:-ir(d)+"px "+-ir(o.clientWidth-(s+u))+"px "+-ir(o.clientHeight-(d+f))+"px "+-ir(s)+"px",threshold:rr(0,nr(1,c))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==c){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!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}(s,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===s&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),s&&!c&&h.observe(s),h.observe(t));let g=c?jr(e):null;return c&&function t(){const r=jr(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,c&&cancelAnimationFrame(f)}}const Ur=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:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=dr(e,t),s={x:n,y:r},d=await kr(t,c),u=gr(ur(o)),f=pr(u);let p=s[f],h=s[u];if(i){const e="y"===f?"bottom":"right";p=sr(p+d["y"===f?"top":"left"],p,p-d[e])}if(a){const e="y"===u?"bottom":"right";h=sr(h+d["y"===u?"top":"left"],h,h-d[e])}const g=l.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Hr=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:s}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=dr(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=ur(o),b=ur(l)===l,y=await(null==c.isRTL?void 0:c.isRTL(s.floating)),w=f||(b||!g?[br(l)]:function(e){const t=br(e);return[mr(e),t,mr(t)]}(l));f||"none"===h||w.push(...function(e,t,n,r){const o=fr(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(ur(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(mr)))),i}(l,g,h,y));const x=[l,...w],k=await kr(t,v),E=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&E.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=fr(e),o=vr(e),i=hr(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=br(a)),[a,br(a)]}(o,a,y);E.push(k[e[0]],k[e[1]])}if(C=[...C,{placement:o,overflows:E}],!E.every((e=>e<=0))){var O,S;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(S=C.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=C.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=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Vr=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:l=2,x:c,y:s}=dr(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=>wr(Er(e))))}(d),f=wr(Er(d)),p=yr(l);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=c&&null!=s)return u.find((e=>c>e.left-p.left&&c<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===gr(n)){const e=u[0],t=u[u.length-1],r="top"===ur(n),o=e.top,i=t.bottom,a=r?e.left:t.left,l=r?e.right:t.right;return{top:o,bottom:i,left:a,right:l,width:l-a,height:i-o,x:a,y:o}}const e="left"===ur(n),t=rr(...u.map((e=>e.right))),r=nr(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});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}}:{}}}},Wr=(e,t,n)=>{const r=new Map,o={platform:zr,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),c=await(null==a.isRTL?void 0:a.isRTL(t));let s=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=xr(s,r,c),f=r,p={},h=0;for(let n=0;n<l.length;n++){const{name:i,fn:g}=l[n],{x:v,y:m,data:b,reset:y}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:s,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...b}},y&&h<=50&&(h++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(s=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:d,y:u}=xr(s,f,c))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Kr="undefined"!=typeof document?c:s;function Yr(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(!Yr(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)&&!Yr(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Xr(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $r(e,t){const n=Xr(e);return Math.round(t*n)/n}function Zr(e){const t=r.useRef(e);return Kr((()=>{t.current=e})),t}
|
|
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 a,useLayoutEffect as c,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 y from"react-dom";import{unstable_batchedUpdates as m,createPortal as b}from"react-dom";import{ReactEditor as w,useSelected as x,Slate as k,Editable as E,DefaultElement as C,withReact as O}from"slate-react";import{Path as S,Editor as D,Element as _,Transforms as R,Range as j,Text as B,createEditor as A,Point as T}from"slate";class L{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n}=e,o=Object.assign(Object.assign({},this.plugin.options),n),r=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=r[e];n&&n.render&&(r[e].render=n=>t[e](n))})),new L({type:this.plugin.type,elements:r,events:this.plugin.events,parsers:this.plugin.parsers,options:o})}}function M(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 N={editor:{getBlock:()=>{},insertBlock:()=>{},insertBlocks:()=>{},updateBlock:()=>{},moveBlock:()=>{},splitBlock:()=>{},deleteBlock:()=>{},toggleBlock:()=>{},focusBlock:()=>{},setSelection:()=>{},applyChanges:()=>{},decreaseBlockDepth:()=>{},increaseBlockDepth:()=>{},setBlockSelected:()=>{},selectedBlocks:[],duplicateBlock:()=>{},getEditorValue:()=>{},blur:()=>{},blocks:{},shortcuts:{},plugins:{},formats:{},selection:null,readOnly:!1,blockEditorsMap:{},children:{},emit:()=>{},on:()=>{},off:()=>{},once:()=>{}}},I=i(N),P=({children:t,editorState:n})=>{const o=a(N);return o.current={editor:n.editor},e(I.Provider,Object.assign({value:o.current},{children:t}))},z=()=>{const e=l(I);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},F=e=>z().children[e],U=e=>z().blocks[e],H=e=>z().plugins[e],V=()=>z().readOnly,W=e=>{var t;return null===(t=H(e))||void 0===t?void 0:t.options},K=({blockId:e,path:t})=>{var n;const o=z();if(!e&&!t)throw new Error("useBlockSelected must receive either blockId or path");let r;return e&&(r=o.children[e]),t&&(r=M(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:{},$={};!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 a=new r(o,i||e,l),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),a.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},a.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},a.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,r,i,l){var a=n?n+e:e;if(!this._events[a])return!1;var c,s,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,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,c=new Array(u-1);s<u;s++)c[s-1]=arguments[s];d.fn.apply(d.context,c)}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(!c)for(f=1,c=new Array(u-1);f<u;f++)c[f-1]=arguments[f];d[s].fn.apply(d[s].context,c)}}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,o,r){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||r&&!a.once||o&&a.context!==o||l(this,i);else{for(var c=0,s=[],d=a.length;c<d;c++)(a[c].fn!==t||r&&!a[c].once||o&&a[c].context!==o)&&s.push(a[c]);s.length?this._events[i]=1===s.length?s[0]:s: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 o,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 $},set exports(e){$=e}});var 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 q=()=>{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()},G=e=>({id:q(),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)}),J=e=>({id:(null==e?void 0:e.id)||q(),value:(null==e?void 0:e.value)||[G()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ee(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function te(e){return"nodeType"in e}function ne(e){var t,n;return e?ee(e)?e:te(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function oe(e){const{Document:t}=ne(e);return e instanceof t}function re(e){return!ee(e)&&e instanceof ne(e).HTMLElement}function ie(e){return e instanceof ne(e).SVGElement}function le(e){return e?ee(e)?e.document:te(e)?oe(e)?e:re(e)||ie(e)?e.ownerDocument:document:document:document}const ae=Q?c:s;function ce(e){const t=a(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 se(e,t){void 0===t&&(t=[e]);const n=a(e);return ae((()=>{n.current!==e&&(n.current=e)}),t),n}function de(e,t){const n=a();return d((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function ue(e){const t=ce(e),n=a(null),o=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,o]}function fe(e){const t=a();return s((()=>{t.current=e}),[e]),t.current}let pe={};function he(e,t){return d((()=>{if(t)return t;const n=null==pe[e]?0:pe[e]+1;return pe[e]=n,e+"-"+n}),[e,t])}function ge(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 ve=ge(1),ye=ge(-1);function me(e){if(!e)return!1;const{KeyboardEvent:t}=ne(e.target);return t&&e instanceof t}function be(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=ne(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 we=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[we.Translate.toString(e),we.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),xe="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ke(e){return e.matches(xe)?e:e.querySelector(xe)}const Ee={display:"none"};function Ce(e){let{id:t,value:n}=e;return r.createElement("div",{id:t,style:Ee},n)}function Oe(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 Se=i(null);const De={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 "},_e={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=_e,container:n,hiddenTextDescribedById:o,screenReaderInstructions:i=De}=e;const{announce:a,announcement:c}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=he("DndLiveRegion"),[h,g]=f(!1);if(s((()=>{g(!0)}),[]),function(e){const t=l(Se);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;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:o}=e;t.onDragMove&&a(t.onDragMove({active:n,over:o}))},onDragOver(e){let{active:n,over:o}=e;a(t.onDragOver({active:n,over:o}))},onDragEnd(e){let{active:n,over:o}=e;a(t.onDragEnd({active:n,over:o}))},onDragCancel(e){let{active:n,over:o}=e;a(t.onDragCancel({active:n,over:o}))}})),[a,t])),!h)return null;const v=r.createElement(r.Fragment,null,r.createElement(Ce,{id:o,value:i.draggable}),r.createElement(Oe,{id:p,announcement:c}));return n?b(v,n):v}var je;function Be(){}function Ae(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"}(je||(je={}));const Te=Object.freeze({x:0,y:0});function Le(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Me(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function Ne(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 Pe(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function ze(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 Fe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=ze(t,t.left,t.top),i=[];for(const e of o){const{id:t}=e,o=n.get(t);if(o){const n=Le(ze(o),r);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Me)};function Ue(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,a=i-n;if(o<r&&n<i){const n=t.width*t.height,o=e.width*e.height,r=l*a;return Number((r/(n+o-r)).toFixed(4))}return 0}const He=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=Ue(i,t);n>0&&r.push({id:o,data:{droppableContainer:e,value:n}})}}return r.sort(Ne)};function Ve(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Te}function We(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 Ke=We(1);const Ye={ignoreTransform:!1};function $e(e,t){void 0===t&&(t=Ye);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:o}=ne(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:a}=o,c=e.left-l-(1-r)*parseFloat(n),s=e.top-a-(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:c+d,bottom:s+u,left:c}}(n,t,o))}const{top:o,left:r,width:i,height:l,bottom:a,right:c}=n;return{top:o,left:r,width:i,height:l,bottom:a,right:c}}function Xe(e){return $e(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(oe(r)&&null!=r.scrollingElement&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!re(r)||ie(r))return n;if(n.includes(r))return n;const i=ne(e).getComputedStyle(r);return r!==e&&function(e,t){void 0===t&&(t=ne(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=ne(e).getComputedStyle(e)),"fixed"===t.position}(r,i)?n:o(r.parentNode)}(e):n}function qe(e){const[t]=Ze(e,1);return null!=t?t:null}function Ge(e){return Q&&e?ee(e)?e:te(e)?oe(e)||e===le(e).scrollingElement?window:re(e)?e:null:null:null}function Je(e){return ee(e)?e.scrollX:e.scrollLeft}function Qe(e){return ee(e)?e.scrollY:e.scrollTop}function et(e){return{x:Je(e),y:Qe(e)}}var tt;function nt(e){return!(!Q||!e)&&e===document.scrollingElement}function ot(e){const t={x:0,y:0},n=nt(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"}(tt||(tt={}));const rt={x:.2,y:.2};function it(e,t,n,o,r){let{top:i,left:l,right:a,bottom:c}=n;void 0===o&&(o=10),void 0===r&&(r=rt);const{isTop:s,isBottom:d,isLeft:u,isRight:f}=ot(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=tt.Backward,h.y=o*Math.abs((t.top+g-i)/g)):!d&&c>=t.bottom-g&&(p.y=tt.Forward,h.y=o*Math.abs((t.bottom-g-c)/g)),!f&&a>=t.right-v?(p.x=tt.Forward,h.x=o*Math.abs((t.right-v-a)/v)):!u&&l<=t.left+v&&(p.x=tt.Backward,h.x=o*Math.abs((t.left+v-l)/v)),{direction:p,speed:h}}function lt(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)=>ve(e,et(t))),Te)}const ct=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Je(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Qe(t)),0)}]];class st{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 ct)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 dt{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 ut(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 ft,pt;function ht(e){e.preventDefault()}function gt(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"}(ft||(ft={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(pt||(pt={}));const vt={start:[pt.Space,pt.Enter],cancel:[pt.Esc],end:[pt.Space,pt.Enter]},yt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case pt.Right:return{...n,x:n.x+25};case pt.Left:return{...n,x:n.x-25};case pt.Down:return{...n,y:n.y+25};case pt.Up:return{...n,y:n.y-25}}};class mt{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 dt(le(t)),this.windowListeners=new dt(ne(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ft.Resize,this.handleCancel),this.windowListeners.add(ft.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(ft.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=$e),!e)return;const{top:n,left:o,bottom:r,right:i}=t(e);qe(e)&&(r<=0||i<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Te)}handleKeyDown(e){if(me(e)){const{active:t,context:n,options:o}=this.props,{keyboardCodes:r=vt,coordinateGetter:i=yt,scrollBehavior:l="smooth"}=o,{code:a}=e;if(r.end.includes(a))return void this.handleEnd(e);if(r.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:c}=n.current,s=c?{x:c.left,y:c.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:a,isLeft:c,isBottom:s,maxScroll:u,minScroll:f}=ot(n),p=lt(n),h={x:Math.min(r===pt.Right?p.right-p.width/2:p.right,Math.max(r===pt.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(r===pt.Down?p.bottom-p.height/2:p.bottom,Math.max(r===pt.Down?p.top:p.top+p.height/2,d.y))},g=r===pt.Right&&!a||r===pt.Left&&!c,v=r===pt.Down&&!s||r===pt.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=r===pt.Right&&e<=u.x||r===pt.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:l});o.x=i?n.scrollLeft-e:r===pt.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===pt.Down&&e<=u.y||r===pt.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:l});o.y=i?n.scrollTop-e:r===pt.Down?n.scrollTop-u.y:n.scrollTop-f.y,o.y&&n.scrollBy({top:-o.y,behavior:l});break}}this.handleMove(e,ve(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 bt(e){return Boolean(e&&"distance"in e)}function wt(e){return Boolean(e&&"delay"in e)}mt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=vt,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 xt{constructor(e,t,n){var o;void 0===n&&(n=function(e){const{EventTarget:t}=ne(e);return e instanceof t?e:le(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=le(i),this.documentListeners=new dt(this.document),this.listeners=new dt(n),this.windowListeners=new dt(ne(i)),this.initialCoordinates=null!=(o=be(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(ft.Resize,this.handleCancel),this.windowListeners.add(ft.DragStart,ht),this.windowListeners.add(ft.VisibilityChange,this.handleCancel),this.windowListeners.add(ft.ContextMenu,ht),this.documentListeners.add(ft.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(wt(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(bt(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(ft.Click,gt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ft.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 a=null!=(t=be(e))?t:Te,c=ye(o,a);if(!n&&l){if(bt(l)){if(null!=l.tolerance&&ut(c,l.tolerance))return this.handleCancel();if(ut(c,l.distance))return this.handleStart()}return wt(l)&&ut(c,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===pt.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const kt={move:{name:"pointermove"},end:{name:"pointerup"}};class Et extends xt{constructor(e){const{event:t}=e,n=le(t.target);super(e,kt,n)}}Et.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 Ot;!function(e){e[e.RightClick=2]="RightClick"}(Ot||(Ot={}));(class extends xt{constructor(e){super(e,Ct,le(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button!==Ot.RightClick&&(null==o||o({event:n}),!0)}}];const St={move:{name:"touchmove"},end:{name:"touchend"}};var Dt,_t;function Rt(e){let{acceleration:t,activator:n=Dt.Pointer,canScroll:o,draggingRect:r,enabled:i,interval:l=5,order:c=_t.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const y=function(e){let{delta:t,disabled:n}=e;const o=fe(t);return de((e=>{if(n||!o||!e)return jt;const r={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[tt.Backward]:e.x[tt.Backward]||-1===r.x,[tt.Forward]:e.x[tt.Forward]||1===r.x},y:{[tt.Backward]:e.y[tt.Backward]||-1===r.y,[tt.Forward]:e.y[tt.Forward]||1===r.y}}}),[n,t,o])}({delta:g,disabled:!i}),[m,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=d((()=>{switch(n){case Dt.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Dt.DraggableRect:return r}}),[n,r,f]),E=a(null),C=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)}),[]),O=d((()=>c===_t.TreeOrder?[...p].reverse():p),[c,p]);s((()=>{if(i&&p.length&&k){for(const e of O){if(!1===(null==o?void 0:o(e)))continue;const n=p.indexOf(e),r=h[n];if(!r)continue;const{direction:i,speed:a}=it(e,r,k,t,v);for(const e of["x","y"])y[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return b(),E.current=e,m(C,l),w.current=a,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,C,o,b,i,l,JSON.stringify(k),JSON.stringify(y),m,p,O,h,JSON.stringify(v)])}(class extends xt{constructor(e){super(e,St)}static setup(){return window.addEventListener(St.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(St.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"}(Dt||(Dt={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(_t||(_t={}));const jt={x:{[tt.Backward]:!1,[tt.Forward]:!1},y:{[tt.Backward]:!1,[tt.Forward]:!1}};var Bt,At;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Bt||(Bt={})),function(e){e.Optimized="optimized"}(At||(At={}));const Tt=new Map;function Lt(e,t){return de((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Mt(e){let{callback:t,disabled:n}=e;const o=ce(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 Nt(e){return new st($e(e),e)}function It(e,t,n){void 0===t&&(t=Nt);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=ce(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=Mt({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 Pt=[];function zt(e,t){void 0===t&&(t=[]);const n=a(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 Ft(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 Ut=[];function Ht(e){let{measure:t}=e;const[n,o]=f(null),r=u((e=>{for(const{target:n}of e)if(re(n)){o((e=>{const o=t(n);return e?{...e,width:o.width,height:o.height}:o}));break}}),[t]),i=Mt({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 re(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),o(n?t(n):null)}),[t,i]),[a,c]=ue(l);return d((()=>({nodeRef:a,rect:n,setRef:c})),[n,a,c])}const Vt=[{sensor:Et,options:{}},{sensor:mt,options:{}}],Wt={current:{}},Kt={draggable:{measure:Xe},droppable:{measure:Xe,strategy:Bt.WhileDragging,frequency:At.Optimized},dragOverlay:{measure:$e}};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 $t={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:Be},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kt,measureDroppableContainers:Be,windowRect:null,measuringScheduled:!1},Xt=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Be,draggableNodes:new Map,over:null,measureDroppableContainers:Be}),Zt=i($t);function qt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yt}}}function Gt(e,t){switch(t.type){case je.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case je.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 je.DragEnd:case je.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case je.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 je.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 je.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 Jt(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:r}=l(Xt),i=fe(o),a=fe(null==n?void 0:n.id);return s((()=>{if(!t&&!o&&i&&null!=a){if(!me(i))return;if(document.activeElement===i.target)return;const e=r.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=ke(e);if(t){t.focus();break}}}))}}),[o,t,r,a,i]),null}const Qt=i({...Te,scaleX:1,scaleY:1});var en;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(en||(en={}));const tn=p((function(e){var t,n,o,i;let{id:l,accessibility:c,autoScroll:p=!0,children:g,sensors:v=Vt,collisionDetection:y=He,measuring:b,modifiers:w,...x}=e;const k=h(Gt,void 0,qt),[E,C]=k,[O,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,_]=f(en.Uninitialized),R=D===en.Initialized,{draggable:{active:j,nodes:B,translate:A},droppable:{containers:T}}=E,L=j?B.get(j):null,M=a({initial:null,translated:null}),N=d((()=>{var e;return null!=j?{id:j,data:null!=(e=null==L?void 0:L.data)?e:Wt,rect:M}:null}),[j,L]),I=a(null),[P,z]=f(null),[F,U]=f(null),H=se(x,Object.values(x)),V=he("DndDescribedBy",l),W=d((()=>T.getEnabled()),[T]),K=d((()=>({draggable:{...Kt.draggable,...null==Y?void 0:Y.draggable},droppable:{...Kt.droppable,...null==Y?void 0:Y.droppable},dragOverlay:{...Kt.dragOverlay,...null==Y?void 0:Y.dragOverlay}})),[null==(Y=b)?void 0:Y.draggable,null==Y?void 0:Y.droppable,null==Y?void 0:Y.dragOverlay]);var Y;const{droppableRects:$,measureDroppableContainers:X,measuringScheduled:Z}=function(e,t){let{dragging:n,dependencies:o,config:r}=t;const[i,l]=f(null),{frequency:c,measure:d,strategy:p}=r,h=a(e),g=function(){switch(p){case Bt.Always:return!1;case Bt.BeforeDragging:return n;default:return!n}}(),v=se(g),y=u((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),m=a(null),b=de((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 st(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||y()}),[n,g]),s((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),s((()=>{g||"number"!=typeof c||null!==m.current||(m.current=setTimeout((()=>{y(),m.current=null}),c))}),[c,g,y,...o]),{droppableRects:b,measureDroppableContainers:y,measuringScheduled:null!=i}}(W,{dragging:R,dependencies:[A.x,A.y],config:K.droppable}),q=function(e,t){const n=null!==t?e.get(t):void 0,o=n?n.node.current:null;return de((e=>{var n;return null===t?null:null!=(n=null!=o?o:e)?n:null}),[o,t])}(B,j),G=d((()=>F?be(F):null),[F]),J=function(){const e=!1===(null==P?void 0:P.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=R&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),ee=function(e,t){return Lt(e,t)}(q,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e;const i=a(!1),{x:l,y:c}="boolean"==typeof r?{x:r,y:r}:r;ae((()=>{if(!l&&!c||!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),c||(r.y=0),i.current=!0,Math.abs(r.x)>0||Math.abs(r.y)>0){const t=qe(e);t&&t.scrollBy({top:r.y,left:r.x})}}),[t,l,c,o,n])}({activeNode:j?B.get(j):null,config:J.layoutShiftCompensation,initialRect:ee,measure:K.draggable.measure});const te=It(q,K.draggable.measure,ee),oe=It(q?q.parentElement:null),re=a({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:$,draggableNodes:B,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=T.getNodeFor(null==(t=re.current.over)?void 0:t.id),le=Ht({measure:K.dragOverlay.measure}),ce=null!=(n=le.nodeRef.current)?n:q,ue=R?null!=(o=le.rect)?o:te:null,fe=Boolean(le.nodeRef.current&&le.rect),pe=Ve(ge=fe?null:te,Lt(ge));var ge;const ye=Ft(ce?ne(ce):null),me=function(e){const t=a(e),n=de((n=>e?n&&n!==Pt&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ze(e):Pt),[e]);return s((()=>{t.current=e}),[e]),n}(R?null!=ie?ie:q:null),we=function(e,t){void 0===t&&(t=$e);const[n]=e,o=Ft(n?ne(n):null),[r,i]=h((function(){return e.length?e.map((e=>nt(e)?o:new st(t(e),e))):Ut}),Ut),l=Mt({callback:i});return e.length>0&&r===Ut&&i(),ae((()=>{e.length?e.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),i())}),[e]),r}(me),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:A.x-pe.x,y:A.y-pe.y,scaleX:1,scaleY:1},activatorEvent:F,active:N,activeNodeRect:te,containerNodeRect:oe,draggingNodeRect:ue,over:re.current.over,overlayNodeRect:le.rect,scrollableAncestors:me,scrollableAncestorRects:we,windowRect:ye}),ke=G?ve(G,A):null,Ee=function(e){const[t,n]=f(null),o=a(e),r=u((e=>{const t=Ge(e.target);t&&n((e=>e?(e.set(t,et(t)),new Map(e)):null))}),[]);return s((()=>{const t=o.current;if(e!==t){i(t);const l=e.map((e=>{const t=Ge(e);return t?(t.addEventListener("scroll",r,{passive:!0}),[t,et(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=Ge(e);null==t||t.removeEventListener("scroll",r)}))}}),[r,e]),d((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>ve(e,t)),Te):at(e):Te),[e,t])}(me),Ce=zt(Ee),Oe=zt(Ee,[te]),De=ve(xe,Ce),_e=ue?Ke(ue,xe):null,Be=N&&_e?y({active:N,collisionRect:_e,droppableRects:$,droppableContainers:W,pointerCoordinates:ke}):null,Ae=Pe(Be,"id"),[Le,Me]=f(null),Ne=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(fe?xe:ve(xe,Oe),null!=(i=null==Le?void 0:Le.rect)?i:null,te),Ie=u(((e,t)=>{let{sensor:n,options:o}=t;if(null==I.current)return;const r=B.get(I.current);if(!r)return;const i=e.nativeEvent,l=new n({active:I.current,activeNode:r,event:i,options:o,context:re,onStart(e){const t=I.current;if(null==t)return;const n=B.get(t);if(!n)return;const{onDragStart:o}=H.current,r={active:{id:t,data:n.data,rect:M}};m((()=>{null==o||o(r),_(en.Initializing),C({type:je.DragStart,initialCoordinates:e,active:t}),O({type:"onDragStart",event:r})}))},onMove(e){C({type:je.DragMove,coordinates:e})},onEnd:a(je.DragEnd),onCancel:a(je.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:r}=re.current;let l=null;if(t&&r){const{cancelDrop:a}=H.current;if(l={activatorEvent:i,active:t,collisions:n,delta:r,over:o},e===je.DragEnd&&"function"==typeof a){await Promise.resolve(a(l))&&(e=je.DragCancel)}}I.current=null,m((()=>{C({type:e}),_(en.Uninitialized),Me(null),z(null),U(null);const t=e===je.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=H.current[t];null==e||e(l),O({type:t,event:l})}}))}}m((()=>{z(l),U(e.nativeEvent)}))}),[B]),ze=u(((e,t)=>(n,o)=>{const r=n.nativeEvent,i=B.get(o);if(null!==I.current||!i||r.dndKit||r.defaultPrevented)return;const l={active:i};!0===e(n,t.options,l)&&(r.dndKit={capturedBy:t.sensor},I.current=o,Ie(n,t))}),[B,Ie]),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,ze);!function(e){s((()=>{if(!Q)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===en.Initializing&&_(en.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:De.x,y:De.y},over:r};m((()=>{null==e||e(i),O({type:"onDragMove",event:i})}))}),[De.x,De.y]),s((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:r}=re.current;if(!e||null==I.current||!t||!r)return;const{onDragOver:i}=H.current,l=o.get(Ae),a=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:r.x,y:r.y},over:a};m((()=>{Me(a),null==i||i(c),O({type:"onDragOver",event:c})}))}),[Ae]),ae((()=>{re.current={activatorEvent:F,active:N,activeNode:q,collisionRect:_e,collisions:Be,droppableRects:$,draggableNodes:B,draggingNode:ce,draggingNodeRect:ue,droppableContainers:T,over:Le,scrollableAncestors:me,scrollAdjustedTranslate:De},M.current={initial:ue,translated:_e}}),[N,q,Be,_e,B,ce,ue,$,T,Le,me,De]),Rt({...J,delta:A,draggingRect:_e,pointerCoordinates:ke,scrollableAncestors:me,scrollableAncestorRects:we});const Ue=d((()=>({active:N,activeNode:q,activeNodeRect:te,activatorEvent:F,collisions:Be,containerNodeRect:oe,dragOverlay:le,draggableNodes:B,droppableContainers:T,droppableRects:$,over:Le,measureDroppableContainers:X,scrollableAncestors:me,scrollableAncestorRects:we,measuringConfiguration:K,measuringScheduled:Z,windowRect:ye})),[N,q,te,F,Be,oe,le,B,T,$,Le,X,me,we,K,Z,ye]),We=d((()=>({activatorEvent:F,activators:Fe,active:N,activeNodeRect:te,ariaDescribedById:{draggable:V},dispatch:C,draggableNodes:B,over:Le,measureDroppableContainers:X})),[F,Fe,N,te,C,V,B,Le,X]);return r.createElement(Se.Provider,{value:S},r.createElement(Xt.Provider,{value:We},r.createElement(Zt.Provider,{value:Ue},r.createElement(Qt.Provider,{value:Ne},g)),r.createElement(Jt,{disabled:!1===(null==c?void 0:c.restoreFocus)})),r.createElement(Re,{...c,hiddenTextDescribedById:V}))})),nn=i(null),on="button",rn="Droppable";function ln(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e;const i=he(rn),{activators:a,activatorEvent:c,active:s,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=l(Xt),{role:g=on,roleDescription:v="draggable",tabIndex:y=0}=null!=r?r:{},m=(null==s?void 0:s.id)===t,b=l(m?Qt:nn),[w,x]=ue(),[k,E]=ue(),C=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])}(a,t),O=se(n);ae((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:O}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:s,activatorEvent:c,activeNodeRect:u,attributes:d((()=>({role:g,tabIndex:y,"aria-disabled":o,"aria-pressed":!(!m||g!==on)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[o,g,y,m,v,f.draggable]),isDragging:m,listeners:o?void 0:C,node:w,over:h,setNodeRef:x,setActivatorNodeRef:E,transform:b}}const an="Droppable",cn={timeout:25};function sn(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function dn(e,t){return e.reduce(((e,n,o)=>{const r=t.get(n);return r&&(e[o]=r),e}),Array(e.length))}function un(e){return null!==e&&e>=0}const fn=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e;const i=sn(t,o,n),l=t[r],a=i[r];return a&&l?{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}:null},pn={scaleX:1,scaleY:1},hn=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:i,overIndex:l}=e;const a=null!=(t=i[n])?t:o;if(!a)return null;if(r===n){const e=i[l];return e?{x:0,y:n<l?e.top+e.height-(a.top+a.height):e.top-a.top,...pn}:null}const c=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:-a.height-c,...pn}:r<n&&r>=l?{x:0,y:a.height+c,...pn}:{x:0,y:0,...pn}};const gn="Sortable",vn=r.createContext({activeIndex:-1,containerId:gn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fn,disabled:{draggable:!1,droppable:!1}});function yn(e){let{children:t,id:n,items:o,strategy:i=fn,disabled:c=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=l(Zt),v=he(gn,n),y=Boolean(null!==f.rect),m=d((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),b=null!=u,w=u?m.indexOf(u.id):-1,x=h?m.indexOf(h.id):-1,k=a(m),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}(m,k.current),C=-1!==x&&-1===w||E,O=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);ae((()=>{E&&b&&g(m)}),[E,m,b,g]),s((()=>{k.current=m}),[m]);const S=d((()=>({activeIndex:w,containerId:v,disabled:O,disableTransforms:C,items:m,overIndex:x,useDragOverlay:y,sortedRects:dn(m,p),strategy:i})),[w,v,O.draggable,O.droppable,C,m,x,p,y,i]);return r.createElement(vn.Provider,{value:S},t)}const mn=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return sn(n,o,r).indexOf(t)},bn=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:i,newIndex:l,previousItems:a,previousContainerId:c,transition:s}=e;return!(!s||!o)&&((a===i||r!==l)&&(!!n||l!==r&&t===c))},wn={duration:200,easing:"ease"},xn="transform",kn=we.Transition.toString({property:xn,duration:0,easing:"linear"}),En={roleDescription:"sortable"};function Cn(e){let{animateLayoutChanges:t=bn,attributes:n,disabled:o,data:r,getNewIndex:i=mn,id:c,strategy:p,resizeObserverConfig:h,transition:g=wn}=e;const{items:v,containerId:y,activeIndex:m,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:E,strategy:C}=l(vn),O=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(c),D=d((()=>({sortable:{containerId:y,index:S,items:v},...r})),[y,r,S,v]),_=d((()=>v.slice(v.indexOf(c))),[v,c]),{rect:R,node:j,isOver:B,setNodeRef:A}=function(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e;const i=he(an),{active:c,dispatch:d,over:f,measureDroppableContainers:p}=l(Xt),h=a({disabled:n}),g=a(!1),v=a(null),y=a(null),{disabled:m,updateMeasurementsFor:b,timeout:w}={...cn,...r},x=se(null!=b?b:o),k=Mt({callback:u((()=>{g.current?(null!=y.current&&clearTimeout(y.current),y.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),y.current=null}),w)):g.current=!0}),[w]),disabled:m||!c}),E=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[C,O]=ue(E),S=se(t);return s((()=>{k&&C.current&&(k.disconnect(),g.current=!1,k.observe(C.current))}),[C,k]),ae((()=>(d({type:je.RegisterDroppable,element:{id:o,key:i,disabled:n,node:C,rect:v,data:S}}),()=>d({type:je.UnregisterDroppable,key:i,id:o}))),[o]),s((()=>{n!==h.current.disabled&&(d({type:je.SetDroppableDisabled,id:o,key:i,disabled:n}),h.current.disabled=n)}),[o,i,n,d]),{active:c,rect:v,isOver:(null==f?void 0:f.id)===o,node:C,over:f,setNodeRef:O}}({id:c,data:D,disabled:O.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...h}}),{active:T,activatorEvent:L,activeNodeRect:M,attributes:N,setNodeRef:I,listeners:P,isDragging:z,over:F,setActivatorNodeRef:U,transform:H}=ln({id:c,data:D,attributes:{...En,...n},disabled:O.draggable}),V=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)}(A,I),W=Boolean(T),K=W&&!w&&un(m)&&un(k),Y=!E&&z,$=Y&&K?H:null,X=K?null!=$?$:(null!=p?p:C)({rects:x,activeNodeRect:M,activeIndex:m,overIndex:k,index:S}):null,Z=un(m)&&un(k)?i({id:c,items:v,activeIndex:m,overIndex:k}):S,q=null==T?void 0:T.id,G=a({activeId:q,items:v,newIndex:Z,containerId:y}),J=v!==G.current.items,Q=t({active:T,containerId:y,isDragging:z,isSorting:W,id:c,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),c=a(n);return ae((()=>{if(!t&&n!==c.current&&o.current){const e=r.current;if(e){const t=$e(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!==c.current&&(c.current=n)}),[t,n,o,r]),s((()=>{i&&l(null)}),[i]),i}({disabled:!Q,index:S,node:j,rect:R});return s((()=>{W&&G.current.newIndex!==Z&&(G.current.newIndex=Z),y!==G.current.containerId&&(G.current.containerId=y),v!==G.current.items&&(G.current.items=v)}),[W,Z,y,v]),s((()=>{if(q===G.current.activeId)return;if(q&&!G.current.activeId)return void(G.current.activeId=q);const e=setTimeout((()=>{G.current.activeId=q}),50);return()=>clearTimeout(e)}),[q]),{active:T,activeIndex:m,attributes:N,data:D,rect:R,index:S,newIndex:Z,items:v,isOver:B,isSorting:W,isDragging:z,listeners:P,node:j,overIndex:k,over:F,setNodeRef:V,setActivatorNodeRef:U,setDroppableNodeRef:A,setDraggableNodeRef:I,transform:null!=ee?ee:X,transition:function(){if(ee||J&&G.current.newIndex===S)return kn;if(Y&&!me(L)||!g)return;if(W||Q)return we.Transition.toString({...g,property:xn});return}()}}function On(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 Sn=[pt.Down,pt.Right,pt.Up,pt.Left],Dn=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:i,over:l,scrollableAncestors:a}}=t;if(Sn.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 pt.Down:o.top<i.top&&t.push(n);break;case pt.Up:o.top>i.top&&t.push(n);break;case pt.Left:o.left>i.left&&t.push(n);break;case pt.Right:o.left<i.left&&t.push(n)}}));const c=(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+Le(n[o],t)),0),a=Number((l/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:a}})}}return i.sort(Me)})({active:n,collisionRect:o,droppableRects:r,droppableContainers:t,pointerCoordinates:null});let s=Pe(c,"id");if(s===(null==l?void 0:l.id)&&c.length>1&&(s=c[1].id),null!=s){const e=i.get(n.id),t=i.get(s),l=t?r.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&l&&e&&t){const n=Ze(c).some(((e,t)=>a[t]!==e)),r=_n(e,t),i=function(e,t){if(!On(e)||!On(t))return!1;if(!_n(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 _n(e,t){return!(!On(e)||!On(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var Rn;function jn(){return jn=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},jn.apply(this,arguments)}var Bn,An=function(e){return o.createElement("svg",jn({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 Ln=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),Bn||(Bn=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 Mn(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 Nn(e){return zn(e)?(e.nodeName||"").toLowerCase():"#document"}function In(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Pn(e){var t;return null==(t=(zn(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function zn(e){return e instanceof Node||e instanceof In(e).Node}function Fn(e){return e instanceof Element||e instanceof In(e).Element}function Un(e){return e instanceof HTMLElement||e instanceof In(e).HTMLElement}function Hn(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}=Xn(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function Wn(e){return["table","td","th"].includes(Nn(e))}function Kn(e){const t=Yn(),n=Xn(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 $n(e){return["html","body","#document"].includes(Nn(e))}function Xn(e){return In(e).getComputedStyle(e)}function Zn(e){return Fn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function qn(e){if("html"===Nn(e))return e;const t=e.assignedSlot||e.parentNode||Hn(e)&&e.host||Pn(e);return Hn(t)?t.host:t}function Gn(e){const t=qn(e);return $n(t)?e.ownerDocument?e.ownerDocument.body:e.body:Un(t)&&Vn(t)?t:Gn(t)}function Jn(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=Gn(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?Jn(l.frameElement):[]):t.concat(r,Jn(r,[],n))}const Qn=Math.min,eo=Math.max,to=Math.round,no=Math.floor,oo=e=>({x:e,y:e}),ro={left:"right",right:"left",bottom:"top",top:"bottom"},io={start:"end",end:"start"};function lo(e,t,n){return eo(e,Qn(t,n))}function ao(e,t){return"function"==typeof e?e(t):e}function co(e){return e.split("-")[0]}function so(e){return e.split("-")[1]}function uo(e){return"x"===e?"y":"x"}function fo(e){return"y"===e?"height":"width"}function po(e){return["top","bottom"].includes(co(e))?"y":"x"}function ho(e){return uo(po(e))}function go(e){return e.replace(/start|end/g,(e=>io[e]))}function vo(e){return e.replace(/left|right|bottom|top/g,(e=>ro[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 mo(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function bo(e,t,n){let{reference:o,floating:r}=e;const i=po(t),l=ho(t),a=fo(l),c=co(t),s="y"===i,d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,f=o[a]/2-r[a]/2;let p;switch(c){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(so(t)){case"start":p[l]-=f*(n&&s?-1:1);break;case"end":p[l]+=f*(n&&s?-1:1)}return p}async function wo(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:l,elements:a,strategy:c}=e,{boundary:s="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=ao(t,e),h=yo(p),g=a[f?"floating"===u?"reference":"floating":u],v=mo(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:s,rootBoundary:d,strategy:c})),y="floating"===u?{...l.floating,x:o,y:r}:l.reference,m=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(m))&&await(null==i.getScale?void 0:i.getScale(m))||{x:1,y:1},w=mo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:m,strategy:c}):y);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 xo(e){const t=Qn(...e.map((e=>e.left))),n=Qn(...e.map((e=>e.top)));return{x:t,y:n,width:eo(...e.map((e=>e.right)))-t,height:eo(...e.map((e=>e.bottom)))-n}}const ko=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:a}=t,c=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=co(n),a=so(n),c="y"===po(n),s=["left","top"].includes(l)?-1:1,d=i&&c?-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 a&&"number"==typeof h&&(p="end"===a?-1*h:h),c?{x:p*d,y:f*s}:{x:f*s,y:p*d}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:l}}}}};function Eo(e){const t=Xn(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Un(e),i=r?e.offsetWidth:n,l=r?e.offsetHeight:o,a=to(n)!==i||to(o)!==l;return a&&(n=i,o=l),{width:n,height:o,$:a}}function Co(e){return Fn(e)?e:e.contextElement}function Oo(e){const t=Co(e);if(!Un(t))return oo(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Eo(t);let l=(i?to(n.width):n.width)/o,a=(i?to(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const So=oo(0);function Do(e){const t=In(e);return Yn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:So}function _o(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=Co(e);let l=oo(1);t&&(o?Fn(o)&&(l=Oo(o)):l=Oo(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==In(e))&&t}(i,n,o)?Do(i):oo(0);let c=(r.left+a.x)/l.x,s=(r.top+a.y)/l.y,d=r.width/l.x,u=r.height/l.y;if(i){const e=In(i),t=o&&Fn(o)?In(o):o;let n=e,r=n.frameElement;for(;r&&o&&t!==n;){const e=Oo(r),t=r.getBoundingClientRect(),o=Xn(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;c*=e.x,s*=e.y,d*=e.x,u*=e.y,c+=i,s+=l,n=In(r),r=n.frameElement}}return mo({width:d,height:u,x:c,y:s})}const Ro=[":popover-open",":modal"];function jo(e){return Ro.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Bo(e){return _o(Pn(e)).left+Zn(e).scrollLeft}function Ao(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=In(e),o=Pn(e),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,a=0,c=0;if(r){i=r.width,l=r.height;const e=Yn();(!e||e&&"fixed"===t)&&(a=r.offsetLeft,c=r.offsetTop)}return{width:i,height:l,x:a,y:c}}(e,n);else if("document"===t)o=function(e){const t=Pn(e),n=Zn(e),o=e.ownerDocument.body,r=eo(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=eo(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Bo(e);const a=-n.scrollTop;return"rtl"===Xn(o).direction&&(l+=eo(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:a}}(Pn(e));else if(Fn(t))o=function(e,t){const n=_o(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Un(e)?Oo(e):oo(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=Do(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return mo(o)}function To(e,t){const n=qn(e);return!(n===t||!Fn(n)||$n(n))&&("fixed"===Xn(n).position||To(n,t))}function Lo(e,t,n){const o=Un(t),r=Pn(t),i="fixed"===n,l=_o(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=oo(0);if(o||!o&&!i)if(("body"!==Nn(t)||Vn(r))&&(a=Zn(t)),o){const e=_o(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else r&&(c.x=Bo(r));return{x:l.left+a.scrollLeft-c.x,y:l.top+a.scrollTop-c.y,width:l.width,height:l.height}}function Mo(e,t){return Un(e)&&"fixed"!==Xn(e).position?t?t(e):e.offsetParent:null}function No(e,t){const n=In(e);if(!Un(e)||jo(e))return n;let o=Mo(e,t);for(;o&&Wn(o)&&"static"===Xn(o).position;)o=Mo(o,t);return o&&("html"===Nn(o)||"body"===Nn(o)&&"static"===Xn(o).position&&!Kn(o))?n:o||function(e){let t=qn(e);for(;Un(t)&&!$n(t);){if(Kn(t))return t;t=qn(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=Pn(o),a=!!t&&jo(t.floating);if(o===l||a&&i)return n;let c={scrollLeft:0,scrollTop:0},s=oo(1);const d=oo(0),u=Un(o);if((u||!u&&!i)&&(("body"!==Nn(o)||Vn(l))&&(c=Zn(o)),Un(o))){const e=_o(o);s=Oo(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-c.scrollLeft*s.x+d.x,y:n.y*s.y-c.scrollTop*s.y+d.y}},getDocumentElement:Pn,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=Jn(e,[],!1).filter((e=>Fn(e)&&"body"!==Nn(e))),r=null;const i="fixed"===Xn(e).position;let l=i?qn(e):e;for(;Fn(l)&&!$n(l);){const t=Xn(l),n=Kn(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=qn(l)}return t.set(e,o),o}(t,this._c):[].concat(n),o],l=i[0],a=i.reduce(((e,n)=>{const o=Ao(t,n,r);return e.top=eo(o.top,e.top),e.right=Qn(o.right,e.right),e.bottom=Qn(o.bottom,e.bottom),e.left=eo(o.left,e.left),e}),Ao(t,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:No,getElementRects:async function(e){const t=this.getOffsetParent||No,n=this.getDimensions;return{reference:Lo(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}=Eo(e);return{width:t,height:n}},getScale:Oo,isElement:Fn,isRTL:function(e){return"rtl"===Xn(e).direction}};function Po(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=o,s=Co(e),d=r||i?[...s?Jn(s):[],...Jn(t)]:[];d.forEach((e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=s&&a?function(e,t){let n,o=null;const r=Pn(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function l(a,c){void 0===a&&(a=!1),void 0===c&&(c=1),i();const{left:s,top:d,width:u,height:f}=e.getBoundingClientRect();if(a||t(),!u||!f)return;const p={rootMargin:-no(d)+"px "+-no(r.clientWidth-(s+u))+"px "+-no(r.clientHeight-(d+f))+"px "+-no(s)+"px",threshold:eo(0,Qn(1,c))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==c){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&&!c&&h.observe(s),h.observe(t));let g=c?_o(e):null;return c&&function t(){const o=_o(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,c&&cancelAnimationFrame(f)}}const zo=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:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ao(e,t),s={x:n,y:o},d=await wo(t,c),u=po(co(r)),f=uo(u);let p=s[f],h=s[u];if(i){const e="y"===f?"bottom":"right";p=lo(p+d["y"===f?"top":"left"],p,p-d[e])}if(l){const e="y"===u?"bottom":"right";h=lo(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-o}}}}},Fo=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:a,platform:c,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 y=co(r),m=co(a)===a,b=await(null==c.isRTL?void 0:c.isRTL(s.floating)),w=f||(m||!g?[vo(a)]:function(e){const t=vo(e);return[go(e),t,go(t)]}(a));f||"none"===h||w.push(...function(e,t,n,o){const r=so(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[]}}(co(e),"start"===n,o);return r&&(i=i.map((e=>e+"-"+r)),t&&(i=i.concat(i.map(go)))),i}(a,g,h,b));const x=[a,...w],k=await wo(t,v),E=[];let C=(null==(o=i.flip)?void 0:o.overflows)||[];if(d&&E.push(k[y]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=so(e),r=ho(e),i=fo(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=vo(l)),[l,vo(l)]}(r,l,b);E.push(k[e[0]],k[e[1]])}if(C=[...C,{placement:r,overflows:E}],!E.every((e=>e<=0))){var O,S;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(S=C.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=C.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=a}if(r!==n)return{reset:{placement:n}}}return{}}}},Uo=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:a=2,x:c,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=>mo(xo(e))))}(d),f=mo(xo(d)),p=yo(a);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=c&&null!=s)return u.find((e=>c>e.left-p.left&&c<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===po(n)){const e=u[0],t=u[u.length-1],o="top"===co(n),r=e.top,i=t.bottom,l=o?e.left:t.left,a=o?e.right:t.right;return{top:r,bottom:i,left:l,right:a,width:a-l,height:i-r,x:l,y:r}}const e="left"===co(n),t=eo(...u.map((e=>e.right))),o=Qn(...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}}:{}}}},Ho=(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,a=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=bo(s,o,c),f=o,p={},h=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:v,y:y,data:m,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!=y?y:u,p={...p,[i]:{...p[i],...m}},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}=bo(s,f,c))),n=-1)}return{x:d,y:u,placement:f,strategy:r,middlewareData:p}})(e,t,{...r,platform:i})};var Vo="undefined"!=typeof document?c:s;function Wo(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(!Wo(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)&&!Wo(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ko(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yo(e,t){const n=Ko(e);return Math.round(t*n)/n}function $o(e){const t=o.useRef(e);return Vo((()=>{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 qr=["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(","),Gr="undefined"==typeof Element,Jr=Gr?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Qr=!Gr&&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},eo=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)},to=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!eo(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),c=e(l.length?l:a.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:a,candidates:c})}else{Jr.call(a,qr)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var s=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),d=!eo(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(s&&d){var u=e(!0===s?a.children:s.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return o},no=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ro=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))&&!no(e)?0:e.tabIndex},oo=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},io=function(e){return"INPUT"===e.tagName},ao=function(e){return function(e){return io(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Qr(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)},lo=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},co=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Jr.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Jr.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return lo(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,l=Qr(e);if(a&&!a.shadowRoot&&!0===r(a))return lo(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,n,r,o,i=e&&Qr(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&a;){var c,s,d;l=!(null===(s=a=null===(c=i=Qr(a))||void 0===c?void 0:c.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},so=function(e,t){return!(t.disabled||eo(t)||function(e){return io(e)&&"hidden"===e.type}(t)||co(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!!Jr.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},uo=function(e,t){return!(ao(t)||ro(t)<0||!so(e,t))},fo=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},po=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var n=ro(e);return n<0&&t&&!no(e)?0:n}(a,i),c=i?e(t.candidates):a;0===l?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:o,tabIndex:l,item:t,isScope:i,content:c})})),r.sort(oo).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ho=function(e,t){var n;return n=(t=t||{}).getShadowRoot?to([e],t.includeContainer,{filter:uo.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:fo}):function(e,t,n){if(eo(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(qr));return t&&Jr.call(e,qr)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,uo.bind(null,t)),po(n)};const go=r["useInsertionEffect".toString()]||(e=>e());var vo="undefined"!=typeof document?c:s;function mo(){return mo=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},mo.apply(this,arguments)}let bo=!1,yo=0;const wo=()=>"floating-ui-"+yo++;const xo=r["useId".toString()]||function(){const[e,t]=r.useState((()=>bo?wo():void 0));return vo((()=>{null==e&&t(wo())}),[]),r.useEffect((()=>{bo||(bo=!0)}),[]),e};const ko=r.createContext(null),Eo=r.createContext(null);function Co(e){return"data-floating-ui-"+e}function Oo(e){const t=l(e);return vo((()=>{t.current=e})),t}const So=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Do(e,t){const n=ho(e,So());"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 _o(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&&Kn(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function Ro(e){ho(e,So()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function jo(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 Bo={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 Ao(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const To=r.forwardRef((function(e,t){const[n,o]=r.useState();vo((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",Ao),()=>{document.removeEventListener("keydown",Ao)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Co("focus-guard")]:"",style:Bo};return r.createElement("span",mo({},e,i))})),Lo=r.createContext(null),Mo=Co("portal");function No(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),a=xo(),l=Io(),c=r.useRef(null);return vo((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{c.current=null}))}),[o]),vo((()=>{if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=a,n.setAttribute(Mo,""),e.appendChild(n),c.current=n,i(n)}),[t,a]),vo((()=>{if(c.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!Vn(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=a,o.setAttribute(Mo,""),e=r||e,e.appendChild(o),c.current=o,i(o)}),[t,n,a,l]),o}({id:n,root:o}),[l,c]=r.useState(null),s=r.useRef(null),d=r.useRef(null),u=r.useRef(null),f=r.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!o&&!a);return r.useEffect((()=>{if(a&&i&&(null==l||!l.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&_o(e)){("focusin"===e.type?jo:Ro)(a)}}}),[a,i,null==l?void 0:l.modal]),r.createElement(Lo.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:a,setFocusManagerState:c})),[i,a])},p&&a&&r.createElement(To,{"data-type":"outside",ref:s,onFocus:e=>{if(_o(e,a)){var t;null==(t=u.current)||t.focus()}else{const e=Do(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&a&&r.createElement("span",{"aria-owns":a.id,style:Bo}),a&&w(t,a),p&&a&&r.createElement(To,{"data-type":"outside",ref:d,onFocus:e=>{if(_o(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=Do(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))}const Io=()=>r.useContext(Lo),Po=new Set,zo=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=xo();return vo((()=>{if(!n)return;Po.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,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Po.delete(i),0===Po.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[i,n]),r.createElement("div",mo({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Fo(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[a,l]=r.useState(null),c=(null==(t=e.elements)?void 0:t.reference)||a,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:s,open:d}=e,[u,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Yr(p,o)||h(o);const[g,v]=r.useState(null),[m,y]=r.useState(null),w=r.useCallback((e=>{e!==C.current&&(C.current=e,v(e))}),[]),x=r.useCallback((e=>{e!==O.current&&(O.current=e,y(e))}),[]),k=a||g,E=l||m,C=r.useRef(null),O=r.useRef(null),S=r.useRef(u),D=null!=s,_=Zr(s),R=Zr(i),j=r.useCallback((()=>{if(!C.current||!O.current)return;const e={placement:t,strategy:n,middleware:p};R.current&&(e.platform=R.current),Wr(C.current,O.current,e).then((e=>{const t={...e,isPositioned:!0};B.current&&!Yr(S.current,t)&&(S.current=t,b.flushSync((()=>{f(t)})))}))}),[p,t,n,R]);Kr((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const B=r.useRef(!1);Kr((()=>(B.current=!0,()=>{B.current=!1})),[]),Kr((()=>{if(k&&(C.current=k),E&&(O.current=E),k&&E){if(_.current)return _.current(k,E,j);j()}}),[k,E,j,_,D]);const A=r.useMemo((()=>({reference:C,floating:O,setReference:w,setFloating:x})),[w,x]),T=r.useMemo((()=>({reference:k,floating:E})),[k,E]),L=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!T.floating)return e;const t=$r(T.floating,u.x),r=$r(T.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...Xr(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,c,T.floating,u.x,u.y]);return r.useMemo((()=>({...u,update:j,refs:A,elements:T,floatingStyles:L})),[u,j,A,T,L])}(e),d=r.useContext(Eo),u=null!=((null==(f=r.useContext(ko))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return go((()=>{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=xo(),y=r.useCallback((e=>{const t=Vn(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=r.useCallback((e=>{(Vn(e)||null===e)&&(h.current=e,l(e)),(Vn(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!Vn(e))&&s.refs.setReference(e)}),[s.refs]),x=r.useMemo((()=>({...s.refs,setReference:w,setPositionReference:y,domReference:h})),[s.refs,w,y]),k=r.useMemo((()=>({...s.elements,domReference:c})),[s.elements,c]),E=r.useMemo((()=>({...s,refs:x,elements:k,dataRef:g,nodeId:i,floatingId:m,events:v,open:n,onOpenChange:p})),[s,i,m,v,n,p,x,k]);return vo((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=E)})),r.useMemo((()=>({...s,context:E,refs:x,elements:k})),[s,x,k,E])}const Uo=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Ho(e,t){return"function"==typeof e?e(t):e}function Vo(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[l,c]=r.useState(!1),[s,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,a);return vo((()=>{l&&!u&&d("unmounted")}),[l,u]),vo((()=>{if(o){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}c(!0),d("close")}}),[n,o]),{isMounted:u,status:s}}function Wo(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:a,duration:l=250}=t,c=e.placement,s=c.split("-")[0],d=r.useMemo((()=>({side:s,placement:c})),[s,c]),u="number"==typeof l,f=(u?l:l.open)||0,p=(u?l:l.close)||0,[h,g]=r.useState((()=>({...Ho(a,d),...Ho(n,d)}))),{isMounted:v,status:m}=Vo(e,{duration:l}),b=Oo(n),y=Oo(o),w=Oo(i),x=Oo(a);return vo((()=>{const e=Ho(b.current,d),t=Ho(w.current,d),n=Ho(x.current,d),r=Ho(y.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(Uo).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(Uo).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,b,y,x,f,m,d]),{isMounted:v,styles:h}}var Ko;function Yo(){return Yo=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},Yo.apply(this,arguments)}var Xo=function(e){return r.createElement("svg",Yo({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ko||(Ko=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 $o(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 Zo=["color"],qo=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=$o(e,Zo);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"}))})),Go=["color"],Jo=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=$o(e,Go);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"}))})),Qo=["color"],ei=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=$o(e,Qo);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"}))})),ti=["color"],ni=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=$o(e,ti);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"}))})),ri=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()}},oi={"text/plain":"Text","text/html":"Url",default:"Text"};var ii=function(e,t){var n,r,o,i,a,l,c=!1;t||(t={}),n=t.debug||!1;try{if(o=ri(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.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=oi[t.format]||oi.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(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!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),c=!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{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return c};function ai(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function li(e){if(!e)return;const t=ai(e);return t?e[t]:void 0}const ci=i(void 0),si=({children:r,tools:o})=>{const i=W(),a=d((()=>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]),l=d((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const a=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,l=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,c=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return a?e(a,Object.assign({render:l},c),t):null}))),[d]);return e(ci.Provider,Object.assign({value:a},{children:t(n,{children:[l,r]})}))},di=()=>{const e=a(ci);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e},ui=({children:t})=>e("div",Object.assign({className:"flex flex-col"},{children:t})),fi=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"bg-[#FFF] relative min-w-[200px] w-auto overflow-hidden rounded-md border bg-popover py-[6px] px-0 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"},{children:t})),pi=({children:t})=>e("div",Object.assign({className:"relative flex cursor-default select-none items-center text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"},{children:t})),hi=({isOpen:n,onClose:r,refs:o,style:i,children:a})=>{var l,c;const s=F(),d=di(),[u,p]=f(!1),{refs:h,floatingStyles:g,context:v}=Fo({placement:"right",open:u,onOpenChange:p,middleware:[Vr(),Hr(),Ur(),Cr(10)],whileElementsMounted:Fr}),{isMounted:m,styles:b}=Wo(v,{duration:100});if(!n)return null;const y=N(s,{at:s.selection}),w=li(s.blocks[(null==y?void 0:y.type)||""].elements),x="void"===(null===(l=null==w?void 0:w.props)||void 0===l?void 0:l.nodeType),k=d.ActionMenu,E=Object.assign(Object.assign({},g),b);return e(No,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(zo,Object.assign({lockScroll:!0,className:"z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating},{children:t(fi,{children:[t(ui,{children:[e(pi,{children:t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{const e=s.selection;s.deleteBlock({at:e}),s.setBlockSelected(null),s.setSelection(null),r()}},{children:[e(ni,{className:"w-4 h-4 mr-2"}),"Delete"]}))}),e(pi,{children:t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{s.duplicateBlock({at:s.selection,focus:!0}),s.setBlockSelected(null),r()}},{children:[e(qo,{className:"w-4 h-4 mr-2"}),"Duplicate"]}))}),!x&&!(null===(c=s.blocks[(null==y?void 0:y.type)||""])||void 0===c?void 0:c.hasCustomEditor)&&t(pi,{children:[m&&!!k&&e(No,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(zo,Object.assign({lockScroll:!0,className:"z-[100]",onClick:()=>p(!1)},{children:e("div",Object.assign({style:E,ref:h.setFloating},{children:e(k,{actions:Object.keys(s.blocks),editor:s,selectedAction:"",onClose:()=>{p(!1),r()},empty:!1,onMouseEnter:()=>{},mode:"toggle"})}))}))})),t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",ref:h.setReference,onClick:()=>p((e=>!e))},{children:[e(Xo,{className:"w-4 h-4 mr-2"}),"Turn into"]}))]}),e(pi,{children:t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{const e=N(s);e&&(ii(`${window.location.origin}${window.location.pathname}#${e.id}`),s.emit("block:copy",e)),r()}},{children:[e(ei,{className:"w-4 h-4 mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var gi=Object.freeze({__proto__:null,BlockOptions:hi,BlockOptionsMenuContent:fi,BlockOptionsMenuGroup:ui,BlockOptionsMenuItem:pi,BlockOptionsSeparator:({className:t})=>e("div",{className:`h-[1px] bg-[#37352f14] my-[4px] w-full ${t}`})});function vi(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))}}var mi={actions:"vuZgncnq",hovered:"_8Eqjiv7m",actionButton:"WabGEp54",plusButton:"_0C8RpLmz"};function bi(...e){return e.filter(Boolean).join(" ")}vi(".vuZgncnq{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}._8Eqjiv7m{opacity:1}.WabGEp54{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}.WabGEp54:active,.WabGEp54:focus,.WabGEp54:hover{background-color:rgba(55,54,47,.08)}._0C8RpLmz{width:24px}");const yi=({block:n,editor:r,dragHandleProps:o,showActions:i,onChangeActiveBlock:a})=>{const[l,c]=f(!1),{refs:s,floatingStyles:d,context:u}=Fo({placement:"right-start",open:l,onOpenChange:c,middleware:[Vr(),Hr(),Ur(),Cr()]}),{isMounted:p,styles:h}=Wo(u,{duration:100}),{setActivatorNodeRef:g,attributes:v,listeners:m}=o,b=Object.assign(Object.assign({},d),h);return t("div",Object.assign({contentEditable:!1,className:bi(mi.actions,i&&mi.hovered,"yoopta-element-actions")},{children:[e("button",Object.assign({type:"button",onClick:()=>{const e=te({id:Q()}),t=[n.meta.order+1];r.setSelection([n.meta.order]),r.insertBlock(e,{at:t,focus:!0})},className:bi(mi.actionButton,mi.plusButton,"yoopta-element-actions-plus")},{children:e(In,{})})),e("button",Object.assign({type:"button",className:bi(mi.actionButton,"yoopta-element-actions-drag"),ref:e=>{g(e),s.setReference(e)}},v,m,{onClick:e=>{e.stopPropagation(),a(n.id);const t=Pn(r,{at:[n.meta.order]});r.focusBlock(n.id),t&&setTimeout((()=>{r.blocks[n.type].hasCustomEditor||(x.blur(t),x.deselect(t),j.deselect(t)),r.setBlockSelected([n.meta.order],{only:!0}),r.setSelection([n.meta.order]),c(!0)}),10)}},{children:e(Mn,{})})),e(hi,{isOpen:p,refs:s,style:b,onClose:()=>c(!1)})]}))},wi=({children:n,block:r,blockId:o})=>{var i;const a=F(),[l,c]=f(null),{attributes:s,listeners:d,setNodeRef:u,setActivatorNodeRef:p,transform:h,transition:g,isOver:v,isDragging:m}=Dn({id:o,disabled:a.readOnly}),b={transform:h?`translate3d(${h.x}px, ${h.y}px, 0)`:"none",transition:g,opacity:m?.7:1,marginLeft:20*r.meta.depth+"px"},y=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(r.meta.order),w=l===o,x={borderBottom:v&&!m?"2px solid #007aff":"none"};return t("div",Object.assign({className:"relative py-0 px-[2px] mt-[2px] mb-[1px] rounded yoopta-block-wrapper",onMouseEnter:()=>{a.readOnly||c(o)},onMouseLeave:()=>{a.readOnly||c(null)},"data-yoopta-block-id":o,style:b,"data-yoopta-block":!0,ref:u},{children:[!a.readOnly&&e(yi,{block:r,editor:a,dragHandleProps:{setActivatorNodeRef:p,attributes:s,listeners:d},showActions:w,onChangeActiveBlock:e=>c(e)}),e("div",Object.assign({className:mi.content,style:x},{children:n})),y&&!a.readOnly&&e("div",{className:"absolute left-0 top-0 bg-[#2383e224] z-[90] rounded opacity-100 h-full w-full pointer-events-none yoopta-selection-block"})]}))};function xi(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}"function"==typeof SuppressedError&&SuppressedError;var ki={};Object.defineProperty(ki,"__esModule",{value:!0});for(var Ei="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ci={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Oi={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Ei?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Si={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},Di=1;Di<20;Di++)Si["f"+Di]=111+Di;function _i(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return Ri(e,t)})),o=function(e){return r.some((function(t){return ji(t,e)}))};return null==n?o:o(n)}function Ri(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in Ci)r[Ci[a]]=!1;var l=!0,c=!1,s=void 0;try{for(var d,u=o[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ai(f),g=Ci[h];if(f.length>1&&!g&&!Oi[f]&&!Si[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=Bi(f)),g&&(r[g]=!p||null)}}catch(e){c=!0,s=e}finally{try{!l&&u.return&&u.return()}finally{if(c)throw s}}return r}function ji(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 Bi(e){return e=Ai(e),Si[e]||e.toUpperCase().charCodeAt(0)}function Ai(e){return e=e.toLowerCase(),e=Oi[e]||e}ki.default=_i,ki.isHotkey=_i,ki.isCodeHotkey=function(e,t){return _i(e,t)};var Ti=ki.isKeyHotkey=function(e,t){return _i(e,{byKey:!0},t)};ki.parseHotkey=Ri,ki.compareHotkey=ji,ki.toKeyCode=Bi,ki.toKeyName=Ai;const Li={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",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",slashCommand:"/",kekCeburek:"mod+enter"},Mi={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"},Ni={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ii=e=>{const t=Li[e],n=Mi[e],r=Ni[e],o=t&&Ti(t),i=n&&Ti(n),a=r&&Ti(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},Pi={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"),isKekceburek:Ii("kekCeburek")};const zi={onKeyDown:function(e){return t=>{const n=Pn(e,{at:e.selection});if(!n||!n.selection)return;const r=D.parent(n.selection.anchor.path);if(Pi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(Pi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const o=_.isStart(n,n.selection.anchor,r),i=_.isEnd(n,n.selection.anchor,r);if(!o&&!i)return void e.splitBlock({slate:n,focus:!0});const a=te({id:Q()}),l=e.selection?[e.selection[0]+1]:[0];e.insertBlock(a,{at:l,slate:n,focus:!0})}else if(Pi.isBackspace(t)){if(t.isDefaultPrevented())return;const r=N(e,{at:e.selection}),o=e.blocks[(null==r?void 0:r.type)||""],i=D.parent(n.selection.anchor.path);if(_.isStart(n,n.selection.anchor,i)){t.preventDefault();const r=_.string(n,i),a=e.selection?e.selection[0]-1:0,l=Pn(e,{at:[a]});let c;if(l&&!o.hasCustomEditor&&(c=function(e,t){const[,n]=_.last(e,t);return{path:n,offset:_.string(e,n).length}}(l,i)),0===r.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:c});{if(B.isExpanded(n.selection))return j.delete(n,{at:n.selection});if(!l)return;if(0===_.string(l,[0,0]).length)return e.deleteBlock({at:[a],focus:!0,focusAt:c});const t=Array.from(_.nodes(n,{at:[0],match:e=>!_.isEditor(e)&&(A.isText(e)||_.isInline(n,e)),mode:"highest"})).map((([e])=>e));return j.insertNodes(l,t,{at:_.end(l,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:c})}}}else{if(Pi.isSelect(t)){if(t.isDefaultPrevented())return;const[,r]=_.first(n,[0]),[,o]=_.last(n,[n.children.length-1]),i=_.range(n,r,o),a=B.equals(n.selection,i);if(B.isExpanded(n.selection)&&a)return t.preventDefault(),x.blur(n),x.deselect(n),j.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(Pi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(Pi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(Pi.isArrowUp(t)){if(t.isDefaultPrevented())return;const r=D.parent(n.selection.anchor.path);if(_.isStart(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]-1]:null,r=Pn(e,{at:n}),o=N(e,{at:n});if(r&&o){const[,n]=_.last(r,[0]),i={path:n,offset:_.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(Pi.isArrowDown(t)){const r=D.parent(n.selection.anchor.path);if(_.isEnd(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]+1]:null,o=Pn(e,{at:n}),i=N(e,{at:n});if(o&&i){const n=function(e,t){const[,n]=_.first(e,t);return{path:n,offset:0}}(o,r);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}}}}}},Fi=({children:t,attributes:n,placeholder:r})=>{const o=k(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Ui(e){try{return new URL(e),!0}catch(e){return!1}}const Hi=(e,t)=>{(e=>{const[t]=_.nodes(e,{match:e=>!_.isEditor(e)&&R.isElement(e)&&"link"===e.type});return!!t})(e)&&(e=>{j.unwrapNodes(e,{match:e=>!_.isEditor(e)&&R.isElement(e)&&"link"===e.type})})(e);const{selection:n}=e,r=n&&B.isCollapsed(n),o={type:"link",children:r?[{text:t}]:[],props:{url:t,target:"_blank",rel:"noreferrer"}};r?j.insertNodes(e,o):(j.wrapNodes(e,o,{split:!0}),j.collapse(e,{edge:"end"}))};function Vi(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Wi={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"code"}};function Ki(e,t,n){var r,o,i;if(3===n.nodeType){return 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"\n";const a=n;let l=Array.from(a.childNodes).map((n=>Ki(e,t,n))).flat();if(Wi[n.nodeName]){return{[Wi[n.nodeName].type]:!0,text:null===(o=n.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}}if(t[n.nodeName]){const r=t[n.nodeName],o=e.blocks[r.type],a=ai(o.elements)||"",c=o.elements[a],s="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:Q(),type:a,children:s&&!o.hasCustomEditor?[{text:""}]:l.map(Yi),props:Object.assign({nodeType:"block"},c.props)};if(r.parse){const e=r.parse(n);if(e)if(R.isElement(e))d=e;else if(Array.isArray(e)){return e}}0===d.children.length&&(d.children=[{text:""}]);return te({id:Q(),type:r.type,value:[d],meta:{order:0,depth:0}})}return l}function Yi(e){if("string"==typeof e)return{text:e};if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(Vi(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}const Xi={html:{deserialize:function(e,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=>{t[e]={type:n,parse:r.parse}}))}}}})),t}(e),r=Ki(e,n,t).filter(Vi);return console.log("html",t),r},serialize:function(){}},markdown:{}},$i=({id:t,customEditor:n,elements:r,marks:o,events:i,options:a,placeholder:c="Type '/' for commands"})=>{const s=F(),u=U(t),f=l(u.value).current,p=u.type,h=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(r)),[r]),g=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(o)),[o]),v=d((()=>{let e=s.blockEditorsMap[t];return Object.keys(r).forEach((t=>{var n;const o=null===(n=r[t].props)||void 0===n?void 0:n.nodeType,i="inline"===o,a="void"===o,l="inlineVoid"===o;l&&(e.markableVoid=e=>e.type===t),(a||l)&&(e.isVoid=e=>e.type===t),(i||l)&&(e.isInline=e=>e.type===t,e=(e=>{const{insertData:t,insertText:n}=e;return e.insertText=t=>{t&&Ui(t)?Hi(e,t):n(t)},e.insertData=n=>{const r=n.getData("text/plain");r&&Ui(r)?Hi(e,r):t(n)},e})(e))})),e}),[]),m=d((()=>{if(!i||s.readOnly)return{};const e={hotkeys:Pi,currentBlock:u,defaultBlock:te({id:Q()})},t={};return Object.keys(i).forEach((n=>{t[n]=function(t){if(i[n]){i[n](s,v,e)(t)}}})),t}),[i,s,u]);return e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":p},{children:e(Zi,{id:t,slate:v,initialValue:f,onChange:e=>s.updateBlock(t,{value:e}),decorate:e=>{var t;const n=[];if(s.readOnly)return n;const[r,o]=e,i=(null===(t=s.selection)||void 0===t?void 0:t[0])===u.meta.order;return v.selection&&i&&!_.isEditor(r)&&""===_.string(v,[o[0]])&&B.includes(v.selection,o)&&B.isCollapsed(v.selection)&&n.push(Object.assign(Object.assign({},v.selection),{withPlaceholder:!0})),n},renderLeaf:t=>{var n,r,o,i,a;let{children:l,leaf:d,attributes:f}=t;const p=xi(d,["text"]),h=(null===(n=s.selection)||void 0===n?void 0:n[0])===u.meta.order;p&&Object.keys(p).forEach((e=>{const t=g[e];t&&(l=t.render({children:l,leaf:d}))}));const v=!("void"===(null===(a=null===(i=null===(o=null===(r=t.children)||void 0===r?void 0:r.props)||void 0===o?void 0:o.parent)||void 0===i?void 0:i.props)||void 0===a?void 0:a.nodeType))&&h&&d.withPlaceholder;return e(Fi,Object.assign({attributes:f,placeholder:v?c:void 0},{children:l}))},renderElement:n=>{const r=h[n.element.type];return r?e(r,Object.assign({},n,{blockId:t,HTMLAttributes:null==a?void 0:a.HTMLAttributes})):e(O,Object.assign({},n))},eventHandlers:m,onKeyDown:e=>{var t;s.readOnly||(null===(t=m.onKeyDown)||void 0===t||t.call(m,e),zi.onKeyDown(s)(e))},onKeyUp:e=>{var t;s.readOnly||null===(t=null==m?void 0:m.onKeyUp)||void 0===t||t.call(m,e)},onFocus:e=>{var t;s.readOnly||null===(t=null==m?void 0:m.onFocus)||void 0===t||t.call(m,e)},onClick:e=>{var t,n;s.readOnly||((null===(t=s.selection)||void 0===t?void 0:t[0])!==u.meta.order&&s.setSelection([u.meta.order]),null===(n=null==m?void 0:m.onClick)||void 0===n||n.call(m,e))},onBlur:e=>{var t;s.readOnly||(e.preventDefault(),null===(t=null==m?void 0:m.onBlur)||void 0===t||t.call(m,e))},customEditor:n,readOnly:s.readOnly,onPaste:e=>{var t;if(s.readOnly)return;null===(t=null==m?void 0:m.onPaste)||void 0===t||t.call(m,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(r.body.childNodes.length>0){e.preventDefault();const t=Xi.html.deserialize(s,r.body);if(t.length>0)return void s.insertBlocks(t,{at:s.selection,focus:!0})}},onCopy:e=>{var t;s.readOnly||null===(t=null==m?void 0:m.onCopy)||void 0===t||t.call(m,e)}})}))},Zi=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:a,eventHandlers:l,onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,onBlur:f,onPaste:p,customEditor:h,decorate:g,readOnly:v})=>"function"==typeof h?h({blockId:t}):e(E,Object.assign({editor:n,initialValue:r,onChange:o},{children:e(C,Object.assign({renderElement:a,renderLeaf:i,className:"focus-visible:outline-none focus:outline-none",spellCheck:!0},l,{onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,decorate:g,onBlur:f,readOnly:v,onPaste:p}),`editable-${t}`)}),`slate-${t}`)));Zi.displayName="SlateEditorInstance";const qi=({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])}(Me(St,{activationConstraint:{delay:100,tolerance:0}}),Me(xt,{coordinateGetter:jn})),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.setBlockSelected(null)}),[])}),Gi=[],Ji=({editor:t,marks:r,placeholder:o})=>{const i=W(),{sensors:a,handleDragEnd:l,handleDragStart:c}=qi({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?Gi: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],a=t.children[i],l=t.plugins[a.type];a&&l?f.push(e(wi,Object.assign({block:a,blockId:i},{children:e($i,{type:a.type,id:i,marks:r,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,placeholder:o},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e(n,{children:f}):e(on,Object.assign({sensors:a,collisionDetection:Ve,onDragStart:c,onDragEnd:l},{children:e(wn,Object.assign({disabled:i,items:u,strategy:mn},{children:f}))}))},Qi=({editor:e,yooptaEditorRef:t,root:n})=>{const[r,o]=f({origin:[0,0],coords:[0,0],selection:!1}),i=n=>{var i;if(e.readOnly)return;const a=null===(i=t.current)||void 0===i?void 0:i.contains(n.target);if(!a&&!r.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();a||o({origin:[n.pageX,n.pageY-window.pageYOffset],coords:[n.pageX,n.pageY-window.pageYOffset],selection:!0})},a=t=>{if(!r.selection||e.readOnly)return;o((e=>Object.assign(Object.assign({},e),{coords:[t.pageX,t.pageY-window.pageYOffset]})));const n=((e,t)=>{const n=[];return document.querySelectorAll("[data-yoopta-block]").forEach(((r,o)=>{if(!r)return;const i=r.getBoundingClientRect(),a=Math.min(e[1],t[1]),l=Math.min(e[0],t[0]),c=Math.max(e[1],t[1]),s=Math.max(e[0],t[0]);a<i.bottom&&c>i.top&&l<i.right&&s>i.left&&n.push(o)})),n})(r.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(n,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var r;if(e.readOnly)return;const o=n&&"current"in n?n.current:n||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===(r=t.current)||void 0===r?void 0:r.contains(o))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return o.addEventListener("mousedown",i),o.addEventListener("mousemove",a),o.addEventListener("mouseup",l),()=>{o.removeEventListener("mousedown",i),o.removeEventListener("mousemove",a),o.removeEventListener("mouseup",l)}}),[e.selectedBlocks,r,n,e.readOnly]);const c=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},r),{onClose:c})},ea=({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})},ta={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},na=({placeholder:n,marks:r,className:o,autoFocus:i=!0,selectionBoxRoot:a})=>{const c=F(),d=W(),u=l(null),f=Qi({editor:c,yooptaEditorRef:u,root:a});let p=l(ta).current;s((()=>{if(!i||d)return;const e=N(c,{at:[0]});e&&c.focusBlock(e.id,{waitExecution:!0})}),[i,d]),s((()=>{if(!d)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[c.selectedBlocks,d]);const h=()=>{d||Array.isArray(c.selectedBlocks)&&c.selectedBlocks.length>0&&c.setBlockSelected(null)},g=()=>{p.indexToSelect=null,p.startedIndexToSelect=null,p.selectionStarted=!1},v=e=>{var t,n,r,o,i;if(!d){if(Pi.isSelect(e)){if((null===(t=c.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(c.children).length)return void e.preventDefault();if(p.selectionStarted)return e.preventDefault(),void c.setBlockSelected([],{allSelected:!0})}if(Pi.isBackspace(e)){e.stopPropagation();if(Array.isArray(c.selectedBlocks)&&(null===(n=c.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(c.children).length)return e.preventDefault(),c.deleteBlock({deleteAll:!0}),c.setBlockSelected(null),void g();if(Array.isArray(c.selectedBlocks)&&(null===(r=c.selectedBlocks)||void 0===r?void 0:r.length)>0)return e.preventDefault(),c.deleteBlock({fromPaths:c.selectedBlocks}),c.setBlockSelected(null),void g()}if(Pi.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(p.selectionStarted&&null!==p.startedIndexToSelect&&null!==p.indexToSelect){const e=p.indexToSelect,t=e-1;if(0===e)return;if(e===p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if(t<p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if((null===(o=c.selectedBlocks)||void 0===o?void 0:o.includes(e))&&e!==p.startedIndexToSelect){const n=c.selectedBlocks.filter((t=>t!==e));return c.setBlockSelected(n,{only:!0}),void(p.indexToSelect=t)}return}const t=N(c),n=Pn(c);if(!n||!n.selection||!t)return;const r=D.parent(n.selection.anchor.path),i=_.isStart(n,n.selection.focus,r);if(B.isExpanded(n.selection)&&i){const r=c.selection?[c.selection[0]-1]:[0],o=N(c,{at:r});t&&o&&(e.preventDefault(),x.blur(n),x.deselect(n),j.deselect(n),c.setSelection(null),c.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),p.startedIndexToSelect=t.meta.order,p.indexToSelect=t.meta.order-1,p.selectionStarted=!0)}}if(Pi.isShiftArrowDown(e)){if(p.selectionStarted&&null!==p.indexToSelect&&null!==p.startedIndexToSelect){const e=p.indexToSelect,t=e+1;if(t===Object.keys(c.children).length)return;if(e===p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if(t>p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if((null===(i=c.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==p.startedIndexToSelect){const n=c.selectedBlocks.filter((t=>t!==e));return c.setBlockSelected(n,{only:!0}),void(p.indexToSelect=t)}return}const t=N(c),n=Pn(c);if(!n||!n.selection||!t)return;const r=D.parent(n.selection.anchor.path),o=_.isEnd(n,n.selection.focus,r);if(B.isExpanded(n.selection)&&o){const r=c.selection?[c.selection[0]+1]:[0],o=N(c,{at:r});t&&o&&(e.preventDefault(),x.blur(n),x.deselect(n),j.deselect(n),c.setSelection(null),c.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),p.startedIndexToSelect=t.meta.order,p.indexToSelect=t.meta.order+1,p.selectionStarted=!0)}}}},m=(b={userSelect:f.selection?"none":"auto",pointerEvents:f.selection?"none":"auto"},Object.assign({paddingBottom:150},b));var b;return t("div",Object.assign({id:"yoopta-editor",className:o,style:m,ref:u,onClick:e=>{d||(g(),(e=>{var t;const n=u.current;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=te({id:Q()});if(e.clientY>=o){const e=Object.keys(c.children).length-1,n=N(c,{at:[e]}),r=Pn(c,{at:[e]});if(n&&r&&r.selection){const e=_.string(r,r.selection.anchor.path),o=D.parent(r.selection.anchor.path),[a]=_.node(r,o);if(n.type===i.type&&R.isElement(a)&&"void"!==(null===(t=a.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void c.focusBlock(n.id,{slate:r})}const o=e+1;c.insertBlock(i,{at:[o],focus:!0})}})(e),h())},onBlur:e=>{var t;(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||d||(g(),h())}},{children:[e(Ji,{editor:c,marks:r,placeholder:n}),e(ea,{origin:f.origin,coords:f.coords,isOpen:f.selection&&!d||null===a})]}))},ra=({children:e,fallback:t=null})=>{const[n,r]=f(!1);return s((()=>r(!0)),[]),n?e:t};var oa=Symbol.for("immer-nothing"),ia=Symbol.for("immer-draftable"),aa=Symbol.for("immer-state");function la(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ca=Object.getPrototypeOf;function sa(e){return!!e&&!!e[aa]}function da(e){return!!e&&(fa(e)||Array.isArray(e)||!!e[ia]||!!e.constructor?.[ia]||ma(e)||ba(e))}var ua=Object.prototype.constructor.toString();function fa(e){if(!e||"object"!=typeof e)return!1;const t=ca(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)===ua}function pa(e,t){0===ha(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function ha(e){const t=e[aa];return t?t.type_:Array.isArray(e)?1:ma(e)?2:ba(e)?3:0}function ga(e,t){return 2===ha(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function va(e,t,n){const r=ha(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ma(e){return e instanceof Map}function ba(e){return e instanceof Set}function ya(e){return e.copy_||e.base_}function wa(e,t){if(ma(e))return new Map(e);if(ba(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&fa(e)){if(!ca(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[aa];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(ca(e),n)}function xa(e,t=!1){return Ea(e)||sa(e)||!da(e)||(ha(e)>1&&(e.set=e.add=e.clear=e.delete=ka),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>xa(t,!0)))),e}function ka(){la(2)}function Ea(e){return Object.isFrozen(e)}var Ca,Oa={};function Sa(e){const t=Oa[e];return t||la(0),t}function Da(){return Ca}function _a(e,t){t&&(Sa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ra(e){ja(e),e.drafts_.forEach(Aa),e.drafts_=null}function ja(e){e===Ca&&(Ca=e.parent_)}function Ba(e){return Ca={drafts_:[],parent_:Ca,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Aa(e){const t=e[aa];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ta(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[aa].modified_&&(Ra(t),la(4)),da(e)&&(e=La(t,e),t.parent_||Na(t,e)),t.patches_&&Sa("Patches").generateReplacementPatches_(n[aa].base_,e,t.patches_,t.inversePatches_)):e=La(t,n,[]),Ra(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==oa?e:void 0}function La(e,t,n){if(Ea(t))return t;const r=t[aa];if(!r)return pa(t,((o,i)=>Ma(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Na(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),pa(o,((o,a)=>Ma(e,r,t,o,a,n,i))),Na(e,t,!1),n&&e.patches_&&Sa("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ma(e,t,n,r,o,i,a){if(sa(o)){const a=La(e,o,i&&t&&3!==t.type_&&!ga(t.assigned_,r)?i.concat(r):void 0);if(va(n,r,a),!sa(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(da(o)&&!Ea(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;La(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||Na(e,o)}}function Na(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&xa(t,n)}var Ia={get(e,t){if(t===aa)return e;const n=ya(e);if(!ga(n,t))return function(e,t,n){const r=Fa(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_||!da(r)?r:r===za(e.base_,t)?(Ha(e),e.copy_[t]=Va(r,e)):r},has:(e,t)=>t in ya(e),ownKeys:e=>Reflect.ownKeys(ya(e)),set(e,t,n){const r=Fa(ya(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=za(ya(e),t),a=r?.[aa];if(a&&a.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||ga(e.base_,t)))return!0;Ha(e),Ua(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!==za(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Ha(e),Ua(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ya(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){la(11)},getPrototypeOf:e=>ca(e.base_),setPrototypeOf(){la(12)}},Pa={};function za(e,t){const n=e[aa];return(n?ya(n):e)[t]}function Fa(e,t){if(!(t in e))return;let n=ca(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ca(n)}}function Ua(e){e.modified_||(e.modified_=!0,e.parent_&&Ua(e.parent_))}function Ha(e){e.copy_||(e.copy_=wa(e.base_,e.scope_.immer_.useStrictShallowCopy_))}pa(Ia,((e,t)=>{Pa[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Pa.deleteProperty=function(e,t){return Pa.set.call(this,e,t,void 0)},Pa.set=function(e,t,n){return Ia.set.call(this,e[0],t,n,e[0])};function Va(e,t){const n=ma(e)?Sa("MapSet").proxyMap_(e,t):ba(e)?Sa("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Da(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ia;n&&(o=[r],i=Pa);const{revoke:a,proxy:l}=Proxy.revocable(o,i);return r.draft_=l,r.revoke_=a,l}(e,t);return(t?t.scope_:Da()).drafts_.push(n),n}function Wa(e){if(!da(e)||Ea(e))return e;const t=e[aa];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=wa(e,t.scope_.immer_.useStrictShallowCopy_)}else n=wa(e,!0);return pa(n,((e,t)=>{va(n,e,Wa(t))})),t&&(t.finalized_=!1),n}var Ka=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&&la(6),void 0!==n&&"function"!=typeof n&&la(7),da(e)){const o=Ba(this),i=Va(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?Ra(o):ja(o)}return _a(o,n),Ta(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===oa&&(r=void 0),this.autoFreeze_&&xa(r,!0),n){const t=[],o=[];Sa("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}la(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){da(e)||la(8),sa(e)&&(e=function(e){sa(e)||la(10);return Wa(e)}(e));const t=Ba(this),n=Va(e,void 0);return n[aa].isManual_=!0,ja(t),n}finishDraft(e,t){const n=e&&e[aa];n&&n.isManual_||la(9);const{scope_:r}=n;return _a(r,t),Ta(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=Sa("Patches").applyPatches_;return sa(e)?r(e,t):this.produce(e,(e=>r(e,t)))}};Ka.produce,Ka.produceWithPatches.bind(Ka),Ka.setAutoFreeze.bind(Ka),Ka.setUseStrictShallowCopy.bind(Ka),Ka.applyPatches.bind(Ka);var Ya=Ka.createDraft.bind(Ka),Xa=Ka.finishDraft.bind(Ka);function $a(e,t){const n=Pn(e);if(!n)return!1;const r=_.marks(n);return!!(null==r?void 0:r[t])}const Za=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&B.isCollapsed(i)){const{anchor:a}=i,l=_.above(t,{match:e=>R.isElement(e)&&_.isBlock(t,e),mode:"lowest"});if(!l)return;const[,c]=l,s=_.parent(t,c),[d]=s;if(R.isElement(d)&&!A.isText(d.children[0]))return n(r);const u=l?c:[],f={anchor:a,focus:_.start(t,u)},p=_.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return j.select(t,f),j.delete(t),void h.create({deleteText:!1})}n(r)},t};function qa(e,t,n){e.children=Ya(e.children);let r=!1;const o=e.children[t];if(!o)throw Error(`Block with id ${t} not found`);n.id&&(o.id=n.id,r=!0),n.type&&(o.type=n.type,r=!0),n.meta&&(o.meta=n.meta,r=!0),n.value&&(o.value=n.value),e.children=Xa(e.children),r&&e.applyChanges(),e.emit("change",e.children)}function Ga(e,t,n){e.children=Ya(e.children);const r=N(e,{at:e.selection});if(!r)throw new Error("Block from not found at current selection");const o=ai(e.blocks[r.type].elements);if(r.type===t)return void(e.children=Xa(e.children));const i=Pn(e,{at:[r.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${r.meta.order}`);const a=ai(e.blocks[t].elements);_.withoutNormalizing(i,(()=>{!function(e,t={}){var n;const{at:r,elementType:o}=t,i=r||(null===(n=e.selection)||void 0===n?void 0:n.anchor.path);if(!i)return;let a=e=>!_.isEditor(e)&&R.isElement(e);o&&(a=e=>!_.isEditor(e)&&R.isElement(e)&&e.type===o);const l=D.parent(i),c=_.nodes(e,{at:l,match:a,mode:"lowest"});if(c){const[e]=c}}(i,{elementType:o}),j.setNodes(i,{type:a},{at:[0],mode:"lowest",match:e=>R.isElement(e)&&!_.isInline(i,e)});const n={id:r.id,type:t,meta:Object.assign(Object.assign({},r.meta),{order:r.meta.order}),value:i.children};e.blockEditorsMap[r.id]=i,e.children[r.id]=n,e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children)}))}function Ja(e,t={}){const{at:n=e.selection,deleteAll:r=!1,fromPaths:o,focus:i}=t;if(Array.isArray(o)&&o.length>0){e.children=Ya(e.children),o.forEach((t=>{const n=N(e,{at:[t]});n&&(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=Xa(e.children),e.applyChanges(),void e.emit("change",e.children)}if(r||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=te({id:Q()}),n=tl(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=Ya(e.children);const[a]=n,l=Object.keys(e.children),c=l.find((t=>e.children[t].meta.order===a));if(l.forEach((t=>{const n=e.children[t];n.meta.order>a&&(n.meta.order-=1)})),c&&(delete e.children[c],delete e.blockEditorsMap[c]),e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,r=N(e,{at:[n]});r&&e.focusBlock(r.id,{focusAt:t.focusAt})}}function Qa(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=Pn(e);if(!n)return null;const r=_.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>$a(e,r),toggle:()=>function(e,t){const n=Pn(e),r=$a(e,t);n&&(r?_.removeMark(n,t):_.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,r),update:t=>function(e,t,n){const r=Pn(e);r&&r.selection&&B.isExpanded(r.selection)&&(_.addMark(r,t,n),e.applyChanges(),e.emit("change",e.children))}(e,r,t)}})),n}function el(e,t){const n={};return t.forEach(((t,r)=>{var o;const i=li(t.elements),a=null===(o=null==i?void 0:i.props)||void 0===o?void 0:o.nodeType;if(!("inline"===a||"inlineVoid"===a)){const r={};Object.keys(t.elements).forEach((e=>{const n=xi(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,align:a,shortcuts:l}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,align:a,shortcuts:l},isActive:()=>{const n=N(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:(t,n)=>{Ga(e,t)},create:n=>{!function(e,t,n){var r;e.children=Ya(e.children);const o=N(e);if(!o)throw new Error(`No block found in the current selection path. Passed path: ${e.selection}`);const i=(null==n?void 0:n.slate)||Pn(e,{at:[null==o?void 0:o.meta.order]});if(!i||!i.selection)return;const a=e.blocks[t],l=ai(a.elements),c=a.elements[l];if(!c)return;const s=Object.assign({nodeType:(null===(r=c.props)||void 0===r?void 0:r.nodeType)||"block"},c.props),d=ee({id:Q(),type:l,props:s});j.setNodes(i,d,{at:[0,0],match:e=>R.isElement(e),mode:"highest"}),(null==n?void 0:n.deleteText)&&j.delete(i,{at:[0,0]});const u=te({id:o.id,type:a.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[d]}),f=u.id;e.children[f]=u,e.blockEditorsMap[f]=i,e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(f,{slate:i,waitExecution:!0})}(e,t.type,n)},update:(t,n)=>{qa(e,t,n)},updateElement:(t,n,r)=>{!function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=Pn(e,{at:[o.meta.order]});i?_.withoutNormalizing(i,(()=>{const[t]=_.nodes(i,{at:[0],match:e=>R.isElement(e)&&e.type===n}),o=null==t?void 0:t[0],a=(null==o?void 0:o.props)||{},l={props:Object.assign(Object.assign({},a),r)};j.setNodes(i,l,{at:[0],match:e=>R.isElement(e)&&e.type===n,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")}(e,t,n,r)},delete:t=>{Ja(e,t)}}}})),n}function tl(e){return Za(e,S(T()))}function nl({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const rl=nl({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),ol=(()=>{const e=Q();return{[e]:te({id:e})}})(),il=new Z,al=(e,t)=>il.on(e,t),ll=(e,t)=>il.once(e,t),cl=(e,t)=>il.off(e,t),sl=(e,t)=>il.emit(e,t);const dl=({editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:l,tools:c,selectionBoxRoot:s,children:u,placeholder:p,readOnly:h})=>{const g=()=>{y((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},v=d((()=>o?[rl,...o]:[rl]),[o]),m=d((()=>i.map((e=>e.getPlugin))),[i]),[b,y]=f((()=>(n.applyChanges=g,n.readOnly=h||!1,v&&(n.formats=Qa(n,v)),n.blocks=el(n,m),n.children=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r)?r:ol,n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=tl(e);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]=o)})),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}(m),n.on=al,n.once=ll,n.off=cl,n.emit=sl,{editor:n,version:0})));return e(ra,{children:e(z,Object.assign({editorState:b},{children:t(si,Object.assign({tools:c},{children:[e(na,{placeholder:p,marks:v,autoFocus:a,className:l,selectionBoxRoot:s}),u]}))}))})},ul=Object.assign(Object.assign({},gi),{ExtendedBlockActions:({className:r,style:o,onClick:i,children:a})=>{const l=W(),[c,s]=f(!1),{refs:d,floatingStyles:u,context:p}=Fo({placement:"bottom-start",open:c,onOpenChange:s,middleware:[Vr(),Hr(),Ur(),Cr(10)],whileElementsMounted:Fr}),{isMounted:h,styles:g}=Wo(p,{duration:100}),v=Object.assign(Object.assign({},g),u);return l?null:t(n,{children:[h&&e(hi,Object.assign({isOpen:!0,onClose:()=>s(!1),refs:d,style:v},{children:a})),e("button",Object.assign({type:"button",ref:d.setReference,className:`absolute right-[8px] top-[8px] flex items-center justify-between z-10 opacity-1 bg-[#eee] w-[22px] h-[22px] transition-opacity duration-150 ease-in border-none cursor-pointer rounded-[2px] p-[0_4px] ${r||""} yoopta-extended-block-actions`,onClick:()=>{null==i||i(),s(!0)},style:c?Object.assign(Object.assign({},o),{opacity:1}):o},{children:e(Jo,{})}))]})}});function fl(e,t){const n=Object.keys(e.children),{type:r}=t||{},o=n.find((t=>e.children[t].type===r));return o?e.children[o]:null}function pl(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:a=!0}=n,l=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor){const e=function(e,t){if(L.isPoint(t))return t;if(D.isPath(t))return{path:t,offset:0};const[,n]=_.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);j.select(o,e),x.focus(o)}a&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};o?setTimeout((()=>l()),i):l()}function hl(e){return Array.from(new Set(e))}var gl={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",l="[object Function]",c="[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]",b="[object ArrayBuffer]",y="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",S="[object Uint8ClampedArray]",D="[object Uint16Array]",_="[object Uint32Array]",R=/\w*$/,j=/^\[object .+?Constructor\]$/,B=/^(?:0|[1-9]\d*)$/,A={};A[o]=A["[object Array]"]=A[b]=A[y]=A[i]=A[a]=A[w]=A[x]=A[k]=A[E]=A[C]=A[s]=A[d]=A[u]=A[p]=A[h]=A[g]=A[v]=A[O]=A[S]=A[D]=A[_]=!0,A["[object Error]"]=A[l]=A[m]=!1;var T="object"==typeof X&&X&&X.Object===Object&&X,L="object"==typeof self&&self&&self.Object===Object&&self,M=T||L||Function("return this")(),N=t&&!t.nodeType&&t,I=N&&e&&!e.nodeType&&e,P=I&&I.exports===N;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(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 H(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function W(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 Y,$=Array.prototype,Z=Function.prototype,q=Object.prototype,G=M["__core-js_shared__"],J=(Y=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",Q=Z.toString,ee=q.hasOwnProperty,te=q.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=P?M.Buffer:void 0,oe=M.Symbol,ie=M.Uint8Array,ae=W(Object.getPrototypeOf,Object),le=Object.create,ce=q.propertyIsEnumerable,se=$.splice,de=Object.getOwnPropertySymbols,ue=re?re.isBuffer:void 0,fe=W(Object.keys,Object),pe=Pe(M,"DataView"),he=Pe(M,"Map"),ge=Pe(M,"Promise"),ve=Pe(M,"Set"),me=Pe(M,"WeakMap"),be=Pe(Object,"create"),ye=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Ee=Ve(me),Ce=oe?oe.prototype:void 0,Oe=Ce?Ce.valueOf:void 0;function Se(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 _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 Re(e){this.__data__=new De(e)}function je(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&ee.call(e,"callee")&&(!ce.call(e,"callee")||te.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 a in e)!t&&!ee.call(e,a)||i&&("length"==a||Ue(a,r))||n.push(a);return n}function Be(e,t,n){var r=e[t];ee.call(e,t)&&We(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if(We(e[n][0],t))return n;return-1}function Te(e,t,n,r,f,m,j){var B;if(r&&(B=m?r(e,f,m,j):r(e)),void 0!==B)return B;if(!Ze(e))return e;var T=Ke(e);if(T){if(B=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,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,B)}else{var L=Fe(e),M=L==l||L==c;if(Xe(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(L==u||L==o||M&&!m){if(H(e))return m?e:{};if(B=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ae(e),Ze(t)?le(t):{});var t}(M?{}:e),!t)return function(e,t){return Ne(e,ze(e),t)}(e,function(e,t){return e&&Ne(t,qe(t),e)}(B,e))}else{if(!A[L])return m?e:{};B=function(e,t,n,r){var o=e.constructor;switch(t){case b:return Me(e);case i:case a:return new o(+e);case y:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case x:case k:case E:case C:case O:case S:case D:case _:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case s:return function(e,t,n){var r=t?n(V(e),!0):V(e);return U(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,R.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 U(r,F,new e.constructor)}(e,r,n);case v:return l=e,Oe?Object(Oe.call(l)):{}}var l}(e,L,Te,t)}}j||(j=new Re);var N=j.get(e);if(N)return N;if(j.set(e,B),!T)var I=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,qe,ze)}(e):qe(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(I||e,(function(o,i){I&&(o=e[i=o]),Be(B,i,Te(o,t,n,r,i,e,j))})),B}function Le(e){return!(!Ze(e)||(t=e,J&&J in t))&&($e(e)||H(e)?ne:j).test(Ve(e));var t}function Me(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],l=r?r(n[a],e[a],a,n,e):void 0;Be(n,a,void 0===l?e[a]:l)}return n}function Ie(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 Pe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Se.prototype.clear=function(){this.__data__=be?be(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(be){var r=t[e];return r===n?void 0:r}return ee.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=be&&void 0===t?n:t,this},De.prototype.clear=function(){this.__data__=[]},De.prototype.delete=function(e){var t=this.__data__,n=Ae(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=Ae(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return Ae(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,r=Ae(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},_e.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||De),string:new Se}},_e.prototype.delete=function(e){return Ie(this,e).delete(e)},_e.prototype.get=function(e){return Ie(this,e).get(e)},_e.prototype.has=function(e){return Ie(this,e).has(e)},_e.prototype.set=function(e,t){return Ie(this,e).set(e,t),this},Re.prototype.clear=function(){this.__data__=new De},Re.prototype.delete=function(e){return this.__data__.delete(e)},Re.prototype.get=function(e){return this.__data__.get(e)},Re.prototype.has=function(e){return this.__data__.has(e)},Re.prototype.set=function(e,t){var n=this.__data__;if(n instanceof De){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new _e(r)}return n.set(e,t),this};var ze=de?W(de,Object):function(){return[]},Fe=function(e){return te.call(e)};function Ue(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||B.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function We(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=y||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,r=n?Ve(n):void 0;if(r)switch(r){case ye:return y;case we:return s;case xe:return f;case ke:return h;case Ee:return m}return t});var Ke=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!$e(e)}var Xe=ue||function(){return!1};function $e(e){var t=Ze(e)?te.call(e):"";return t==l||t==c}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function qe(e){return Ye(e)?je(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 Te(e,!0,!0)}}({get exports(){return gl},set exports(e){gl=e}},gl);var vl=gl;function ml(e,t={}){const{blockId:n,focus:r}=t;if(!n&&!t.at)throw new Error("blockId or path should be provided");let o=null;if(n&&(o=e.children[n],!o))throw new Error(`Block not with blockId: ${n} found`);if(t.at&&(o=N(e,{at:t.at}),!o))throw new Error(`Block in path ${t.at} not found`);if(!o)throw new Error("Block not found");e.children=Ya(e.children);Object.values(e.children).forEach((e=>{e.meta.order>o.meta.order&&(e.meta.order+=1)}));const i=(a=o,"function"==typeof window.structuredClone?window.structuredClone(a):vl(a));var a;const l=tl(e);i.id=Q(),i.meta.order=o.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=l;const c=i.id;e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(c,{waitExecution:!0})}function bl(e,t){x.blur(t),x.deselect(t),j.deselect(t),e.setBlockSelected(null),e.setSelection(null)}const yl=()=>{const e={children:{},selection:null,selectedBlocks:null,readOnly:!1,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),applyChanges:()=>{},insertBlock:(...t)=>function(e,t,n={}){e.children=Ya(e.children);const{at:r=null,focus:o=!1,slate:i=null}=n,a=N(e),l=r,c={id:Q(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let s=!1;if(i&&i.selection){const e=_.string(i,i.selection.anchor.path);s=_.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(l){const[t]=l;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),c.meta.order=t}else{const t=Object.keys(e.children).length;c.meta.order=t}const d=tl(e);e.blockEditorsMap[c.id]=d,s&&a&&(c.meta.order=a.meta.order,a.meta.order+=1),e.children[c.id]=c;const u=null==a?void 0:a.id;e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(s&&u?u:c.id)}(e,...t),insertBlocks:(...t)=>function(e,t,n={}){e.children=Ya(e.children);const{at:r,focus:o}=n;let i=r||[0];const a=N(e),l=Pn(e);let c=!1,s=!1;if(l&&l.selection){const t=D.parent(l.selection.anchor.path),n=_.string(l,t).trim(),r=_.isStart(l,l.selection.anchor,t);c=""===n&&r,s=!r||n.length>0,x.blur(l),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 r={id:t.id,value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:i[0]+n})};d.push([r.meta.order]),e.children[r.id]=r;const o=tl(e);e.blockEditorsMap[r.id]=o})),a&&c){const t=a.meta.order;delete e.children[a.id],delete e.blockEditorsMap[a.id],Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>t&&(r.meta.order-=1)}))}e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.setBlockSelected(d)}(e,...t),deleteBlock:(...t)=>Ja(e,...t),duplicateBlock:(...t)=>ml(e,...t),toggleBlock:(...t)=>Ga(e,...t),increaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=Ya(e.children);const r=N(e);r&&(r.meta.depth=r.meta.depth+1,e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),decreaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=Ya(e.children);const r=N(e);r&&(r.meta.depth=0===r.meta.depth?0:r.meta.depth-1,e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),moveBlock:(...t)=>function(e,t,n){e.children=Ya(e.children);const[r]=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r)),a=o.meta.order<i.meta.order,l=o.meta.order>i.meta.order;Object.values(e.children).forEach((e=>{a?e.meta.order>o.meta.order&&e.meta.order<=i.meta.order&&e.meta.order--:l&&e.meta.order<o.meta.order&&e.meta.order>=i.meta.order&&e.meta.order++})),o.meta.order=r,o.meta.depth=i.meta.depth,e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children)}(e,...t),focusBlock:(...t)=>pl(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>qa(e,...t),splitBlock:(...t)=>function(e,t={}){const{slate:n,focus:r=!0}=t,o=N(e);n&&n.selection&&o&&_.withoutNormalizing(n,(()=>{e.children=Ya(e.children);const t=D.parent(n.selection.anchor.path);j.splitNodes(n,{at:n.selection,match:e=>R.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,a=n.children.slice()[i];j.removeNodes(n,{at:[i],match:e=>R.isElement(e),mode:"highest"});const l={id:Q(),type:o.type,meta:{order:o.meta.order+1,depth:o.meta.depth},value:[a]};Object.values(e.children).forEach((e=>{e.meta.order>=l.meta.order&&(e.meta.order+=1)}));const c=tl(e);e.blockEditorsMap[l.id]=c,e.children[l.id]=l,e.children=Xa(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(l.id,{slate:c})}))}(e,...t),setSelection:(...t)=>function(e,t,n={}){const{applyChanges:r=!0}=n;e.selection=t,r&&e.applyChanges()}(e,...t),setBlockSelected:(...t)=>function(e,t,n={}){const{only:r=!1,allSelected:o=!1}=n,i=e.selectedBlocks||[];if(null===t)e.selectedBlocks=null;else if(t.length>1)e.selectedBlocks=t.flat();else if(r)e.selectedBlocks=t.flat();else if(o){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=hl(t)}else e.selectedBlocks=hl(i.concat(t.flat()));e.applyChanges()}(e,...t),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:Pn(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>bl(e,r)),i):(bl(e,r),e.applyChanges())}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{}};return e};vi('/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.right-\\[8px\\]{right:8px}.top-0{top:0}.top-\\[8px\\]{top:8px}.z-10{z-index:10}.z-\\[100\\]{z-index:100}.z-\\[90\\]{z-index:90}.mx-\\[4px\\]{margin-left:4px;margin-right:4px}.my-\\[4px\\]{margin-bottom:4px;margin-top:4px}.mb-\\[1px\\]{margin-bottom:1px}.mr-2{margin-right:.5rem}.mt-\\[2px\\]{margin-top:2px}.\\!block{display:block!important}.block{display:block}.inline{display:inline}.flex{display:flex}.h-4{height:1rem}.h-\\[1px\\]{height:1px}.h-\\[22px\\]{height:22px}.h-full{height:100%}.w-4{width:1rem}.w-\\[22px\\]{width:22px}.w-auto{width:auto}.w-full{width:100%}.min-w-\\[200px\\]{min-width:200px}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-\\[2px\\]{border-radius:2px}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-none{border-style:none}.bg-\\[\\#2383e224\\]{background-color:#2383e224}.bg-\\[\\#37352f14\\]{background-color:#37352f14}.bg-\\[\\#FFF\\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-\\[\\#eee\\]{--tw-bg-opacity:1;background-color:rgb(238 238 238/var(--tw-bg-opacity))}.p-\\[0_4px\\]{padding:0 4px}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-\\[2px\\]{padding-left:2px;padding-right:2px}.py-0{padding-bottom:0;padding-top:0}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-\\[6px\\]{padding-bottom:6px;padding-top:6px}.text-sm{font-size:.875rem;line-height:1.25rem}.italic{font-style:italic}.leading-\\[120\\%\\]{line-height:120%}.underline{text-decoration-line:underline}.opacity-100{opacity:1}.shadow-md{--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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}::-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}.hover\\:bg-\\[\\#37352f14\\]:hover{background-color:#37352f14}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}');export{Pi as HOTKEYS,ul as UI,M as YooptaPlugin,te as buildBlockData,ee as buildBlockElement,yl as createYooptaEditor,nl as createYooptaMark,dl as default,N as findPluginBlockBySelectionPath,fl as findPluginBlockByType,Pn as findSlateBySelectionPath,Q as generateId,li as getRootBlockElement,ai as getRootBlockElementType,U as useBlockData,Y as useBlockSelected,H as useYooptaBlock,F as useYooptaEditor,V as useYooptaPlugin,K as useYooptaPluginOptions,W as useYooptaReadOnly,di as useYooptaTools};
|
|
6
|
+
var Xo=["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,qo=Zo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Go=!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},Jo=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)},Qo=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var l=i.shift();if(!Jo(l,!1))if("SLOT"===l.tagName){var a=l.assignedElements(),c=e(a.length?a:l.children,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:l,candidates:c})}else{qo.call(l,Xo)&&o.filter(l)&&(n||!t.includes(l))&&r.push(l);var s=l.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(l),d=!Jo(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},er=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},tr=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))&&!er(e)?0:e.tabIndex},nr=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},or=function(e){return"INPUT"===e.tagName},rr=function(e){return function(e){return or(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Go(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)},ir=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},lr=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=qo.call(e,"details>summary:first-of-type")?e.parentElement:e;if(qo.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return ir(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,a=Go(e);if(l&&!l.shadowRoot&&!0===o(l))return ir(e);e=e.assignedSlot?e.assignedSlot:l||a===e.ownerDocument?l:a.host}e=i}if(function(e){var t,n,o,r,i=e&&Go(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!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!a&&l;){var c,s,d;a=!(null===(s=l=null===(c=i=Go(l))||void 0===c?void 0:c.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(l))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},ar=function(e,t){return!(t.disabled||Jo(t)||function(e){return or(e)&&"hidden"===e.type}(t)||lr(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!!qo.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},cr=function(e,t){return!(rr(t)||tr(t)<0||!ar(e,t))},sr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},dr=function e(t){var n=[],o=[];return t.forEach((function(t,r){var i=!!t.scopeParent,l=i?t.scopeParent:t,a=function(e,t){var n=tr(e);return n<0&&t&&!er(e)?0:n}(l,i),c=i?e(t.candidates):l;0===a?i?n.push.apply(n,c):n.push(l):o.push({documentOrder:r,tabIndex:a,item:t,isScope:i,content:c})})),o.sort(nr).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ur=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Qo([e],t.includeContainer,{filter:cr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:sr}):function(e,t,n){if(Jo(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Xo));return t&&qo.call(e,Xo)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,cr.bind(null,t)),dr(n)};const fr=o["useInsertionEffect".toString()]||(e=>e());var pr="undefined"!=typeof document?c:s;function hr(){return hr=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},hr.apply(this,arguments)}let gr=!1,vr=0;const yr=()=>"floating-ui-"+vr++;const mr=o["useId".toString()]||function(){const[e,t]=o.useState((()=>gr?yr():void 0));return pr((()=>{null==e&&t(yr())}),[]),o.useEffect((()=>{gr||(gr=!0)}),[]),e};const br=o.createContext(null),wr=o.createContext(null);function xr(e){return"data-floating-ui-"+e}function kr(e){const t=a(e);return pr((()=>{t.current=e})),t}const Er=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cr(e,t){const n=ur(e,Er());"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 Or(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&&Hn(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function Sr(e){ur(e,Er()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Dr(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 _r={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 jr=o.forwardRef((function(e,t){const[n,r]=o.useState();pr((()=>(/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,[xr("focus-guard")]:"",style:_r};return o.createElement("span",hr({},e,i))})),Br=o.createContext(null),Ar=xr("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=mr(),a=Lr(),c=o.useRef(null);return pr((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{c.current=null}))}),[r]),pr((()=>{if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(Ar,""),e.appendChild(n),c.current=n,i(n)}),[t,l]),pr((()=>{if(c.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!Fn(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(Ar,""),e=o||e,e.appendChild(r),c.current=r,i(r)}),[t,n,l,a]),r}({id:n,root:r}),[a,c]=o.useState(null),s=o.useRef(null),d=o.useRef(null),u=o.useRef(null),f=o.useRef(null),p=!!a&&!a.modal&&a.open&&i&&!(!r&&!l);return o.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&&Or(e)){("focusin"===e.type?Dr:Sr)(l)}}}),[l,i,null==a?void 0:a.modal]),o.createElement(Br.Provider,{value:o.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:l,setFocusManagerState:c})),[i,l])},p&&l&&o.createElement(jr,{"data-type":"outside",ref:s,onFocus:e=>{if(Or(e,l)){var t;null==(t=u.current)||t.focus()}else{const e=Cr(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus()}}}),p&&l&&o.createElement("span",{"aria-owns":l.id,style:_r}),l&&b(t,l),p&&l&&o.createElement(jr,{"data-type":"outside",ref:d,onFocus:e=>{if(Or(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=Cr(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 Lr=()=>o.useContext(Br),Mr=new Set,Nr=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const i=mr();return pr((()=>{if(!n)return;Mr.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,a=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[o]=r+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(a-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{Mr.delete(i),0===Mr.size&&(Object.assign(t,{overflow:"",[o]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,a)))}}),[i,n]),o.createElement("div",hr({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,a]=o.useState(null),c=(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:a}={},transform:c=!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);Wo(p,r)||h(r);const[g,v]=o.useState(null),[m,b]=o.useState(null),w=o.useCallback((e=>{e!==C.current&&(C.current=e,v(e))}),[]),x=o.useCallback((e=>{e!==O.current&&(O.current=e,b(e))}),[]),k=l||g,E=a||m,C=o.useRef(null),O=o.useRef(null),S=o.useRef(u),D=null!=s,_=$o(s),R=$o(i),j=o.useCallback((()=>{if(!C.current||!O.current)return;const e={placement:t,strategy:n,middleware:p};R.current&&(e.platform=R.current),Ho(C.current,O.current,e).then((e=>{const t={...e,isPositioned:!0};B.current&&!Wo(S.current,t)&&(S.current=t,y.flushSync((()=>{f(t)})))}))}),[p,t,n,R]);Vo((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const B=o.useRef(!1);Vo((()=>(B.current=!0,()=>{B.current=!1})),[]),Vo((()=>{if(k&&(C.current=k),E&&(O.current=E),k&&E){if(_.current)return _.current(k,E,j);j()}}),[k,E,j,_,D]);const A=o.useMemo((()=>({reference:C,floating:O,setReference:w,setFloating:x})),[w,x]),T=o.useMemo((()=>({reference:k,floating:E})),[k,E]),L=o.useMemo((()=>{const e={position:n,left:0,top:0};if(!T.floating)return e;const t=Yo(T.floating,u.x),o=Yo(T.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+o+"px)",...Ko(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}}),[n,c,T.floating,u.x,u.y]);return o.useMemo((()=>({...u,update:j,refs:A,elements:T,floatingStyles:L})),[u,j,A,T,L])}(e),d=o.useContext(wr),u=null!=((null==(f=o.useContext(br))?void 0:f.id)||null);var f;const p=function(e){const t=o.useRef((()=>{}));return fr((()=>{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],m=mr(),b=o.useCallback((e=>{const t=Fn(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=o.useCallback((e=>{(Fn(e)||null===e)&&(h.current=e,a(e)),(Fn(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!Fn(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:c})),[s.elements,c]),E=o.useMemo((()=>({...s,refs:x,elements:k,dataRef:g,nodeId:i,floatingId:m,events:v,open:n,onOpenChange:p})),[s,i,m,v,n,p,x,k]);return pr((()=>{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 Pr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function zr(e,t){return"function"==typeof e?e(t):e}function Fr(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,[a,c]=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 pr((()=>{a&&!u&&d("unmounted")}),[a,u]),pr((()=>{if(r){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}c(!0),d("close")}}),[n,r]),{isMounted:u,status:s}}function Ur(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:i,common:l,duration:a=250}=t,c=e.placement,s=c.split("-")[0],d=o.useMemo((()=>({side:s,placement:c})),[s,c]),u="number"==typeof a,f=(u?a:a.open)||0,p=(u?a:a.close)||0,[h,g]=o.useState((()=>({...zr(l,d),...zr(n,d)}))),{isMounted:v,status:y}=Fr(e,{duration:a}),m=kr(n),b=kr(r),w=kr(i),x=kr(l);return pr((()=>{const e=zr(m.current,d),t=zr(w.current,d),n=zr(x.current,d),o=zr(b.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(o).map(Pr).join(","),transitionDuration:f+"ms",...n,...o}),"close"===y){const o=t||e;g({transitionProperty:Object.keys(o).map(Pr).join(","),transitionDuration:p+"ms",...n,...o})}}),[p,w,m,b,x,f,y,d]),{isMounted:v,styles:h}}var Hr;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 Wr=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),Hr||(Hr=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 Kr(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"],$r=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Kr(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"}))})),Xr=["color"],Zr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Kr(e,Xr);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"}))})),qr=["color"],Gr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Kr(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:"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"}))})),Jr=["color"],Qr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Kr(e,Jr);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"}))})),ei=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()}},ti={"text/plain":"Text","text/html":"Url",default:"Text"};var ni=function(e,t){var n,o,r,i,l,a,c=!1;t||(t={}),n=t.debug||!1;try{if(r=ei(),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(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=ti[t.format]||ti.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(a),i.selectNodeContents(a),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!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),c=!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()),a&&document.body.removeChild(a),r()}return c};function oi(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ri(e){if(!e)return;const t=oi(e);return t?e[t]:void 0}const ii=i(void 0),li=({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]),a=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,a=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.render,c=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:a},c),t):null}))),[d]);return e(ii.Provider,Object.assign({value:l},{children:t(n,{children:[a,o]})}))},ai=()=>{const e=l(ii);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e},ci=({children:t})=>e("div",Object.assign({className:"yoo-editor-flex yoo-editor-flex-col"},{children:t})),si=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoo-editor-bg-[#FFF] yoo-editor-relative yoo-editor-min-w-[200px] yoo-editor-w-auto yoo-editor-overflow-hidden yoo-editor-rounded-md yoo-editor-border yoo-editor-bg-popover yoo-editor-py-[6px] yoo-editor-px-0 yoo-editor-text-popover-foreground yoo-editor-shadow-md 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})),di=({children:t})=>e("div",Object.assign({className:"yoo-editor-relative yoo-editor-flex yoo-editor-cursor-default yoo-editor-select-none yoo-editor-items-center yoo-editor-text-sm yoo-editor-outline-none yoo-editor-transition-colors focus:yoo-editor-bg-accent focus:yoo-editor-text-accent-foreground data-[disabled]:yoo-editor-pointer-events-none data-[disabled]:yoo-editor-opacity-50"},{children:t})),ui=({isOpen:n,onClose:o,refs:r,style:i,children:l})=>{var a,c;const s=z(),d=ai(),[u,p]=f(!1),{refs:h,floatingStyles:g,context:v}=Ir({placement:"right",open:u,onOpenChange:p,middleware:[Uo(),Fo(),zo(),ko(10)],whileElementsMounted:Po}),{isMounted:y,styles:m}=Ur(v,{duration:100});if(!n)return null;const b=M(s,{at:s.selection}),w=ri(s.blocks[(null==b?void 0:b.type)||""].elements),x="void"===(null===(a=null==w?void 0:w.props)||void 0===a?void 0:a.nodeType),k=d.ActionMenu,E=Object.assign(Object.assign({},g),m);return e(Tr,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(Nr,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:o},{children:e("div",Object.assign({style:i,ref:r.setFloating},{children:t(si,{children:[t(ci,{children:[e(di,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{const e=s.selection;s.deleteBlock({at:e}),s.setBlockSelected(null),s.setSelection(null),o()}},{children:[e(Qr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(di,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{s.duplicateBlock({at:s.selection,focus:!0}),s.setBlockSelected(null),o()}},{children:[e($r,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!x&&!(null===(c=s.blocks[(null==b?void 0:b.type)||""])||void 0===c?void 0:c.hasCustomEditor)&&t(di,{children:[y&&!!k&&e(Tr,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(Nr,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>p(!1)},{children:e("div",Object.assign({style:E,ref:h.setFloating},{children:e(k,{actions:Object.keys(s.blocks),editor:s,selectedAction:"",onClose:()=>{p(!1),o()},empty:!1,onMouseEnter:()=>{},mode:"toggle"})}))}))})),t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",ref:h.setReference,onClick:()=>p((e=>!e))},{children:[e(Wr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(di,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{const e=M(s);e&&(ni(`${window.location.origin}${window.location.pathname}#${e.id}`),s.emit("block:copy",e)),o()}},{children:[e(Gr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),l]})}))}))}))};var fi=Object.freeze({__proto__:null,BlockOptions:ui,BlockOptionsMenuContent:si,BlockOptionsMenuGroup:ci,BlockOptionsMenuItem:di,BlockOptionsSeparator:({className:t})=>e("div",{className:`yoo-editor-h-[1px] yoo-editor-bg-[#37352f14] yoo-editor-my-[4px] yoo-editor-w-full ${t}`})});function pi(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))}}var hi={actions:"vuZgncnq",hovered:"_8Eqjiv7m",actionButton:"WabGEp54",plusButton:"_0C8RpLmz"};function gi(...e){return e.filter(Boolean).join(" ")}pi(".vuZgncnq{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}._8Eqjiv7m{opacity:1}.WabGEp54{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}.WabGEp54:active,.WabGEp54:focus,.WabGEp54:hover{background-color:rgba(55,54,47,.08)}._0C8RpLmz{width:24px}");const vi=({block:n,editor:o,dragHandleProps:r,showActions:i,onChangeActiveBlock:l})=>{const[a,c]=f(!1),{refs:s,floatingStyles:d,context:u}=Ir({placement:"right-start",open:a,onOpenChange:c,middleware:[Uo(),Fo(),zo(),ko()]}),{isMounted:p,styles:h}=Ur(u,{duration:100}),{setActivatorNodeRef:g,attributes:v,listeners:y}=r,m=Object.assign(Object.assign({},d),h);return t("div",Object.assign({contentEditable:!1,className:gi(hi.actions,i&&hi.hovered,"yoopta-element-actions")},{children:[e("button",Object.assign({type:"button",onClick:()=>{const e=J({id:q()}),t=[n.meta.order+1];o.setSelection([n.meta.order]),o.insertBlock(e,{at:t,focus:!0})},className:gi(hi.actionButton,hi.plusButton,"yoopta-element-actions-plus")},{children:e(Ln,{})})),e("button",Object.assign({type:"button",className:gi(hi.actionButton,"yoopta-element-actions-drag"),ref:e=>{g(e),s.setReference(e)}},v,y,{onClick:e=>{e.stopPropagation(),l(n.id);const t=Mn(o,{at:[n.meta.order]});o.focusBlock(n.id),t&&setTimeout((()=>{o.blocks[n.type].hasCustomEditor||(w.blur(t),w.deselect(t),R.deselect(t)),o.setBlockSelected([n.meta.order],{only:!0}),o.setSelection([n.meta.order]),c(!0)}),10)}},{children:e(An,{})})),e(ui,{isOpen:p,refs:s,style:m,onClose:()=>c(!1)})]}))},yi=({children:n,block:o,blockId:r})=>{var i;const l=z(),[a,c]=f(null),{attributes:s,listeners:d,setNodeRef:u,setActivatorNodeRef:p,transform:h,transition:g,isOver:v,isDragging:y}=Cn({id:r,disabled:l.readOnly}),m={transform:h?`translate3d(${h.x}px, ${h.y}px, 0)`:"none",transition:g,opacity:y?.7:1,marginLeft:20*o.meta.depth+"px"},b=null===(i=l.selectedBlocks)||void 0===i?void 0:i.includes(o.meta.order),w=a===r,x={borderBottom:v&&!y?"2px solid #007aff":"none"};return t("div",Object.assign({className:"yoo-editor-relative yoo-editor-py-0 yoo-editor-px-[2px] yoo-editor-mt-[2px] yoo-editor-mb-[1px] yoo-editor-rounded yoopta-block-wrapper",onMouseEnter:()=>{l.readOnly||c(r)},onMouseLeave:()=>{l.readOnly||c(null)},"data-yoopta-block-id":r,style:m,"data-yoopta-block":!0,ref:u},{children:[!l.readOnly&&e(vi,{block:o,editor:l,dragHandleProps:{setActivatorNodeRef:p,attributes:s,listeners:d},showActions:w,onChangeActiveBlock:e=>c(e)}),e("div",Object.assign({className:hi.content,style:x},{children:n})),b&&!l.readOnly&&e("div",{className:"yoo-editor-absolute yoo-editor-left-0 yoo-editor-top-0 yoo-editor-bg-[#2383e224] yoo-editor-z-[90] yoo-editor-rounded yoo-editor-opacity-100 yoo-editor-h-full yoo-editor-w-full yoo-editor-pointer-events-none yoopta-selection-block"})]}))};function mi(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;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});for(var wi="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),xi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},ki={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:wi?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Ei={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},Ci=1;Ci<20;Ci++)Ei["f"+Ci]=111+Ci;function Oi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var o=e.map((function(e){return Si(e,t)})),r=function(e){return o.some((function(t){return Di(t,e)}))};return null==n?r:r(n)}function Si(e,t){var n=t&&t.byKey,o={},r=(e=e.replace("++","+add")).split("+"),i=r.length;for(var l in xi)o[xi[l]]=!1;var a=!0,c=!1,s=void 0;try{for(var d,u=r[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=Ri(f),g=xi[h];if(f.length>1&&!g&&!ki[f]&&!Ei[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){c=!0,s=e}finally{try{!a&&u.return&&u.return()}finally{if(c)throw s}}return o}function Di(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=Ri(e),Ei[e]||e.toUpperCase().charCodeAt(0)}function Ri(e){return e=e.toLowerCase(),e=ki[e]||e}bi.default=Oi,bi.isHotkey=Oi,bi.isCodeHotkey=function(e,t){return Oi(e,t)};var ji=bi.isKeyHotkey=function(e,t){return Oi(e,{byKey:!0},t)};bi.parseHotkey=Si,bi.compareHotkey=Di,bi.toKeyCode=_i,bi.toKeyName=Ri;const Bi={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",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",slashCommand:"/",kekCeburek:"mod+enter"},Ai={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"},Ti={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Li=e=>{const t=Bi[e],n=Ai[e],o=Ti[e],r=t&&ji(t),i=n&&ji(n),l=o&&ji(o);return e=>!(!r||!r(e))||(!(!i||!i(e))||!(!l||!l(e)))},Mi={isBold:Li("bold"),isCompose:Li("compose"),isArrowLeft:Li("arrowLeft"),isArrowRight:Li("arrowRight"),isArrowUp:Li("arrowUp"),isArrowDown:Li("arrowDown"),isDeleteBackward:Li("deleteBackward"),isDeleteForward:Li("deleteForward"),isDeleteLineBackward:Li("deleteLineBackward"),isDeleteLineForward:Li("deleteLineForward"),isDeleteWordBackward:Li("deleteWordBackward"),isDeleteWordForward:Li("deleteWordForward"),isExtendBackward:Li("extendBackward"),isExtendForward:Li("extendForward"),isExtendLineBackward:Li("extendLineBackward"),isExtendLineForward:Li("extendLineForward"),isItalic:Li("italic"),isMoveLineBackward:Li("moveLineBackward"),isMoveLineForward:Li("moveLineForward"),isCtrlLeft:Li("ctrlLeft"),isCtrlRight:Li("ctrlRight"),isRedo:Li("redo"),isShiftEnter:Li("shiftEnter"),isEnter:Li("enter"),isTransposeCharacter:Li("transposeCharacter"),isUndo:Li("undo"),isSpace:Li("space"),isSelect:Li("select"),isTab:Li("tab"),isShiftTab:Li("shiftTab"),isBackspace:Li("backspace"),isCmdEnter:Li("cmdEnter"),isCmd:Li("cmd"),isEscape:Li("escape"),isSlashCommand:Li("slashCommand"),isShiftArrowUp:Li("shiftArrowUp"),isShiftArrowDown:Li("shiftArrowDown"),isKekceburek:Li("kekCeburek")};const Ni={onKeyDown:function(e){return t=>{const n=Mn(e,{at:e.selection});if(!n||!n.selection)return;const o=S.parent(n.selection.anchor.path);if(Mi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(Mi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const r=D.isStart(n,n.selection.anchor,o),i=D.isEnd(n,n.selection.anchor,o);if(!r&&!i)return void e.splitBlock({slate:n,focus:!0});const l=J({id:q()}),a=e.selection?[e.selection[0]+1]:[0];e.insertBlock(l,{at:a,slate:n,focus:!0})}else if(Mi.isBackspace(t)){if(t.isDefaultPrevented())return;const o=M(e,{at:e.selection}),r=e.blocks[(null==o?void 0:o.type)||""],i=S.parent(n.selection.anchor.path);if(D.isStart(n,n.selection.anchor,i)){t.preventDefault();const o=D.string(n,i),l=e.selection?e.selection[0]-1:0,a=Mn(e,{at:[l]});let c;if(a&&!r.hasCustomEditor&&(c=function(e,t){const[,n]=D.last(e,t);return{path:n,offset:D.string(e,n).length}}(a,i)),0===o.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:c});{if(j.isExpanded(n.selection))return R.delete(n,{at:n.selection});if(!a)return;if(0===D.string(a,[0,0]).length)return e.deleteBlock({at:[l],focus:!0,focusAt:c});const t=Array.from(D.nodes(n,{at:[0],match:e=>!D.isEditor(e)&&(B.isText(e)||D.isInline(n,e)),mode:"highest"})).map((([e])=>e));return R.insertNodes(a,t,{at:D.end(a,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:c})}}}else{if(Mi.isSelect(t)){if(t.isDefaultPrevented())return;const[,o]=D.first(n,[0]),[,r]=D.last(n,[n.children.length-1]),i=D.range(n,o,r),l=j.equals(n.selection,i);if(j.isExpanded(n.selection)&&l)return t.preventDefault(),w.blur(n),w.deselect(n),R.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(Mi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(Mi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(Mi.isArrowUp(t)){if(t.isDefaultPrevented())return;const o=S.parent(n.selection.anchor.path);if(D.isStart(n,n.selection.anchor,o)){const n=e.selection?[e.selection[0]-1]:null,o=Mn(e,{at:n}),r=M(e,{at:n});if(o&&r){const[,n]=D.last(o,[0]),i={path:n,offset:D.string(o,n).length};return t.preventDefault(),void e.focusBlock(r.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(Mi.isArrowDown(t)){const o=S.parent(n.selection.anchor.path);if(D.isEnd(n,n.selection.anchor,o)){const n=e.selection?[e.selection[0]+1]:null,r=Mn(e,{at:n}),i=M(e,{at:n});if(r&&i){const n=function(e,t){const[,n]=D.first(e,t);return{path:n,offset:0}}(r,o);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(j.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&ji(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},Ii=({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}))};function Pi(e){try{return new URL(e),!0}catch(e){return!1}}const zi=(e,t)=>{(e=>{const[t]=D.nodes(e,{match:e=>!D.isEditor(e)&&_.isElement(e)&&"link"===e.type});return!!t})(e)&&(e=>{R.unwrapNodes(e,{match:e=>!D.isEditor(e)&&_.isElement(e)&&"link"===e.type})})(e);const{selection:n}=e,o=n&&j.isCollapsed(n),r={type:"link",children:o?[{text:t}]:[],props:{url:t,target:"_blank",rel:"noreferrer"}};o?R.insertNodes(e,r):(R.wrapNodes(e,r,{split:!0}),R.collapse(e,{edge:"end"}))};function Fi(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Ui={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"code"}};function Hi(e,t,n){var o,r,i;if(3===n.nodeType){return 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"\n";const l=n;let a=Array.from(l.childNodes).map((n=>Hi(e,t,n))).flat();if(Ui[n.nodeName]){return{[Ui[n.nodeName].type]:!0,text:null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(t[n.nodeName]){const o=t[n.nodeName],r=e.blocks[o.type],l=oi(r.elements)||"",c=r.elements[l],s="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:q(),type:l,children:s&&!r.hasCustomEditor?[{text:""}]:a.map(Vi),props:Object.assign({nodeType:"block"},c.props)};if(o.parse){const e=o.parse(n);if(e)if(_.isElement(e))d=e;else if(Array.isArray(e)){return e}}0===d.children.length&&(d.children=[{text:""}]);return J({id:q(),type:o.type,value:[d],meta:{order:0,depth:0}})}return a}function Vi(e){if("string"==typeof e)return{text:e};if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(Fi(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}const Wi={html:{deserialize:function(e,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=>{t[e]={type:n,parse:o.parse}}))}}}})),t}(e),o=Hi(e,n,t).filter(Fi);return console.log("html",t),o},serialize:function(){}},markdown:{}},Ki=({id:t,customEditor:n,elements:o,marks:r,events:i,options:l,placeholder:c="Type '/' for commands"})=>{const s=z(),u=F(t),f=a(u.value).current,p=u.type,h=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),g=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(r)),[r]),v=d((()=>{let e=s.blockEditorsMap[t];return Object.keys(o).forEach((t=>{var n;const r=null===(n=o[t].props)||void 0===n?void 0:n.nodeType,i="inline"===r,l="void"===r,a="inlineVoid"===r;a&&(e.markableVoid=e=>e.type===t),(l||a)&&(e.isVoid=e=>e.type===t),(i||a)&&(e.isInline=e=>e.type===t,e=(e=>{const{insertData:t,insertText:n}=e;return e.insertText=t=>{t&&Pi(t)?zi(e,t):n(t)},e.insertData=n=>{const o=n.getData("text/plain");o&&Pi(o)?zi(e,o):t(n)},e})(e))})),e}),[]),y=d((()=>{if(!i||s.readOnly)return{};const e={hotkeys:Mi,currentBlock:u,defaultBlock:J({id:q()})},t={};return Object.keys(i).forEach((n=>{t[n]=function(t){if(i[n]){i[n](s,v,e)(t)}}})),t}),[i,s,u]);return e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":p},{children:e(Yi,{id:t,slate:v,initialValue:f,onChange:e=>s.updateBlock(t,{value:e}),decorate:e=>{var t;const n=[];if(s.readOnly)return n;const[o,r]=e,i=(null===(t=s.selection)||void 0===t?void 0:t[0])===u.meta.order;return v.selection&&i&&!D.isEditor(o)&&""===D.string(v,[r[0]])&&j.includes(v.selection,r)&&j.isCollapsed(v.selection)&&n.push(Object.assign(Object.assign({},v.selection),{withPlaceholder:!0})),n},renderLeaf:t=>{var n,o,r,i,l;let{children:a,leaf:d,attributes:f}=t;const p=mi(d,["text"]),h=(null===(n=s.selection)||void 0===n?void 0:n[0])===u.meta.order;p&&Object.keys(p).forEach((e=>{const t=g[e];t&&(a=t.render({children:a,leaf:d}))}));const v=!("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))&&h&&d.withPlaceholder;return e(Ii,Object.assign({attributes:f,placeholder:v?c:void 0},{children:a}))},renderElement:n=>{const o=h[n.element.type];return o?e(o,Object.assign({},n,{blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(C,Object.assign({},n))},eventHandlers:y,onKeyDown:e=>{var t;s.readOnly||(null===(t=y.onKeyDown)||void 0===t||t.call(y,e),Ni.onKeyDown(s)(e))},onKeyUp:e=>{var t;s.readOnly||null===(t=null==y?void 0:y.onKeyUp)||void 0===t||t.call(y,e)},onFocus:e=>{var t;s.readOnly||null===(t=null==y?void 0:y.onFocus)||void 0===t||t.call(y,e)},onClick:e=>{var t,n;s.readOnly||((null===(t=s.selection)||void 0===t?void 0:t[0])!==u.meta.order&&s.setSelection([u.meta.order]),null===(n=null==y?void 0:y.onClick)||void 0===n||n.call(y,e))},onBlur:e=>{var t;s.readOnly||(e.preventDefault(),null===(t=null==y?void 0:y.onBlur)||void 0===t||t.call(y,e))},customEditor:n,readOnly:s.readOnly,onPaste:e=>{var t;if(s.readOnly)return;null===(t=null==y?void 0:y.onPaste)||void 0===t||t.call(y,e);const n=e.clipboardData.getData("text/html"),o=(new DOMParser).parseFromString(n,"text/html");if(o.body.childNodes.length>0){const e=Wi.html.deserialize(s,o.body);if(e.length>0)return void s.insertBlocks(e,{at:s.selection,focus:!0})}},onCopy:e=>{var t;s.readOnly||null===(t=null==y?void 0:y.onCopy)||void 0===t||t.call(y,e)}})}))},Yi=p((({id:t,slate:n,initialValue:o,onChange:r,renderLeaf:i,renderElement:l,eventHandlers:a,onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,onBlur:f,onPaste:p,customEditor:h,decorate:g,readOnly:v})=>"function"==typeof h?h({blockId:t}):e(k,Object.assign({editor:n,initialValue:o,onChange:r},{children:e(E,Object.assign({renderElement:l,renderLeaf:i,className:"focus-visible:yoo-editor-outline-none focus:yoo-editor-outline-none",spellCheck:!0},a,{onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,decorate:g,onBlur:f,readOnly:v,onPaste:p}),`editable-${t}`)}),`slate-${t}`)));Yi.displayName="SlateEditorInstance";const $i=({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])}(Ae(Et,{activationConstraint:{delay:100,tolerance:0}}),Ae(mt,{coordinateGetter:Dn})),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)}),[])}),Xi=[],Zi=({editor:t,marks:o,placeholder:r})=>{const i=V(),{sensors:l,handleDragEnd:a,handleDragStart:c}=$i({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?Xi: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],a=t.plugins[l.type];l&&a?f.push(e(yi,Object.assign({block:l,blockId:i},{children:e(Ki,{type:l.type,id:i,marks:o,customEditor:a.customEditor,events:a.events,elements:a.elements,options:a.options,placeholder:r},i)}),i)):console.error(`Plugin ${l.type} not found`)}return i?e(n,{children:f}):e(tn,Object.assign({sensors:l,collisionDetection:Fe,onDragStart:c,onDragEnd:a},{children:e(yn,Object.assign({disabled:i,items:u,strategy:hn},{children:f}))}))},qi=({editor:e,yooptaEditorRef:t,root:n})=>{const[o,r]=f({origin:[0,0],coords:[0,0],selection:!1}),i=i=>{var l;if(e.readOnly||!1===n)return;const a=null===(l=t.current)||void 0===l?void 0:l.contains(i.target);if(!a&&!o.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();a||r({origin:[i.pageX,i.pageY-window.pageYOffset],coords:[i.pageX,i.pageY-window.pageYOffset],selection:!0})},l=t=>{if(!o.selection||e.readOnly||!1===n)return;r((e=>Object.assign(Object.assign({},e),{coords:[t.pageX,t.pageY-window.pageYOffset]})));const i=((e,t)=>{const n=[];return document.querySelectorAll("[data-yoopta-block]").forEach(((o,r)=>{if(!o)return;const i=o.getBoundingClientRect(),l=Math.min(e[1],t[1]),a=Math.min(e[0],t[0]),c=Math.max(e[1],t[1]),s=Math.max(e[0],t[0]);l<i.bottom&&c>i.top&&a<i.right&&s>i.left&&n.push(r)})),n})(o.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(i,{only:!0})},a=()=>{e.readOnly||c()};s((()=>{var o;if(e.readOnly||!1===n)return;const r=n&&"current"in n?n.current:n||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===(o=t.current)||void 0===o?void 0:o.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",i),r.addEventListener("mousemove",l),r.addEventListener("mouseup",a),()=>{r.removeEventListener("mousedown",i),r.removeEventListener("mousemove",l),r.removeEventListener("mouseup",a)}}),[e.selectedBlocks,o,n,e.readOnly]);const c=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},o),{onClose:c})},Gi=({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})},Ji={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Qi=({placeholder:n,marks:o,className:r,selectionBoxRoot:i,width:l,autoFocus:c=!0})=>{const d=z(),u=V(),f=a(null),p=qi({editor:d,yooptaEditorRef:f,root:i});let h=a(Ji).current;s((()=>{if(!c||u)return;const e=M(d,{at:[0]});e&&d.focusBlock(e.id,{waitExecution:!0})}),[c,u]),s((()=>{if(!u)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),[d.selectedBlocks,u]);const g=()=>{u||Array.isArray(d.selectedBlocks)&&d.selectedBlocks.length>0&&d.setBlockSelected(null)},v=()=>{h.indexToSelect=null,h.startedIndexToSelect=null,h.selectionStarted=!1},y=e=>{var t,n,o,r,i;if(!u){if(Mi.isSelect(e)){if((null===(t=d.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(d.children).length)return void e.preventDefault();if(h.selectionStarted)return e.preventDefault(),void d.setBlockSelected([],{allSelected:!0})}if(Mi.isBackspace(e)){e.stopPropagation();if(Array.isArray(d.selectedBlocks)&&(null===(n=d.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(d.children).length)return e.preventDefault(),d.deleteBlock({deleteAll:!0}),d.setBlockSelected(null),void v();if(Array.isArray(d.selectedBlocks)&&(null===(o=d.selectedBlocks)||void 0===o?void 0:o.length)>0)return e.preventDefault(),d.deleteBlock({fromPaths:d.selectedBlocks}),d.setBlockSelected(null),void v()}if(Mi.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(h.selectionStarted&&null!==h.startedIndexToSelect&&null!==h.indexToSelect){const e=h.indexToSelect,t=e-1;if(0===e)return;if(e===h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if(t<h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if((null===(r=d.selectedBlocks)||void 0===r?void 0:r.includes(e))&&e!==h.startedIndexToSelect){const n=d.selectedBlocks.filter((t=>t!==e));return d.setBlockSelected(n,{only:!0}),void(h.indexToSelect=t)}return}const t=M(d),n=Mn(d);if(!n||!n.selection||!t)return;const o=S.parent(n.selection.anchor.path),i=D.isStart(n,n.selection.focus,o);if(j.isExpanded(n.selection)&&i){const o=d.selection?[d.selection[0]-1]:[0],r=M(d,{at:o});t&&r&&(e.preventDefault(),w.blur(n),w.deselect(n),R.deselect(n),d.setSelection(null),d.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),h.startedIndexToSelect=t.meta.order,h.indexToSelect=t.meta.order-1,h.selectionStarted=!0)}}if(Mi.isShiftArrowDown(e)){if(h.selectionStarted&&null!==h.indexToSelect&&null!==h.startedIndexToSelect){const e=h.indexToSelect,t=e+1;if(t===Object.keys(d.children).length)return;if(e===h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if(t>h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if((null===(i=d.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==h.startedIndexToSelect){const n=d.selectedBlocks.filter((t=>t!==e));return d.setBlockSelected(n,{only:!0}),void(h.indexToSelect=t)}return}const t=M(d),n=Mn(d);if(!n||!n.selection||!t)return;const o=S.parent(n.selection.anchor.path),r=D.isEnd(n,n.selection.focus,o);if(j.isExpanded(n.selection)&&r){const o=d.selection?[d.selection[0]+1]:[0],r=M(d,{at:o});t&&r&&(e.preventDefault(),w.blur(n),w.deselect(n),R.deselect(n),d.setSelection(null),d.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),h.startedIndexToSelect=t.meta.order,h.indexToSelect=t.meta.order+1,h.selectionStarted=!0)}}}},m=(b={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:l},Object.assign({paddingBottom:150},b));var b;return t("div",Object.assign({id:"yoopta-editor",className:r,style:m,ref:f,onClick:e=>{u||(v(),(e=>{var t;const n=f.current;if(!n)return;const{bottom:o}=n.getBoundingClientRect(),r=o-parseInt(getComputedStyle(n).paddingBottom,10),i=J({id:q()});if(e.clientY>=r){const e=Object.keys(d.children).length-1,n=M(d,{at:[e]}),o=Mn(d,{at:[e]});if(n&&o&&o.selection){const e=D.string(o,o.selection.anchor.path),r=S.parent(o.selection.anchor.path),[l]=D.node(o,r);if(n.type===i.type&&_.isElement(l)&&"void"!==(null===(t=l.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void d.focusBlock(n.id,{slate:o})}const r=e+1;d.insertBlock(i,{at:[r],focus:!0})}})(e),g())},onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||u||(v(),g())}},{children:[e(Zi,{editor:d,marks:o,placeholder:n}),!1!==i&&e(Gi,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!u})]}))},el=({children:e,fallback:t=null})=>{const[n,o]=f(!1);return s((()=>o(!0)),[]),n?e:t};var tl=Symbol.for("immer-nothing"),nl=Symbol.for("immer-draftable"),ol=Symbol.for("immer-state");function rl(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var il=Object.getPrototypeOf;function ll(e){return!!e&&!!e[ol]}function al(e){return!!e&&(sl(e)||Array.isArray(e)||!!e[nl]||!!e.constructor?.[nl]||hl(e)||gl(e))}var cl=Object.prototype.constructor.toString();function sl(e){if(!e||"object"!=typeof e)return!1;const t=il(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)===cl}function dl(e,t){0===ul(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function ul(e){const t=e[ol];return t?t.type_:Array.isArray(e)?1:hl(e)?2:gl(e)?3:0}function fl(e,t){return 2===ul(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function pl(e,t,n){const o=ul(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function hl(e){return e instanceof Map}function gl(e){return e instanceof Set}function vl(e){return e.copy_||e.base_}function yl(e,t){if(hl(e))return new Map(e);if(gl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&sl(e)){if(!il(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ol];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(il(e),n)}function ml(e,t=!1){return wl(e)||ll(e)||!al(e)||(ul(e)>1&&(e.set=e.add=e.clear=e.delete=bl),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>ml(t,!0)))),e}function bl(){rl(2)}function wl(e){return Object.isFrozen(e)}var xl,kl={};function El(e){const t=kl[e];return t||rl(0),t}function Cl(){return xl}function Ol(e,t){t&&(El("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Sl(e){Dl(e),e.drafts_.forEach(Rl),e.drafts_=null}function Dl(e){e===xl&&(xl=e.parent_)}function _l(e){return xl={drafts_:[],parent_:xl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Rl(e){const t=e[ol];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function jl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ol].modified_&&(Sl(t),rl(4)),al(e)&&(e=Bl(t,e),t.parent_||Tl(t,e)),t.patches_&&El("Patches").generateReplacementPatches_(n[ol].base_,e,t.patches_,t.inversePatches_)):e=Bl(t,n,[]),Sl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==tl?e:void 0}function Bl(e,t,n){if(wl(t))return t;const o=t[ol];if(!o)return dl(t,((r,i)=>Al(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Tl(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),dl(r,((r,l)=>Al(e,o,t,r,l,n,i))),Tl(e,t,!1),n&&e.patches_&&El("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Al(e,t,n,o,r,i,l){if(ll(r)){const l=Bl(e,r,i&&t&&3!==t.type_&&!fl(t.assigned_,o)?i.concat(o):void 0);if(pl(n,o,l),!ll(l))return;e.canAutoFreeze_=!1}else l&&n.add(r);if(al(r)&&!wl(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Bl(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Tl(e,r)}}function Tl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ml(t,n)}var Ll={get(e,t){if(t===ol)return e;const n=vl(e);if(!fl(n,t))return function(e,t,n){const o=Il(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_||!al(o)?o:o===Nl(e.base_,t)?(zl(e),e.copy_[t]=Fl(o,e)):o},has:(e,t)=>t in vl(e),ownKeys:e=>Reflect.ownKeys(vl(e)),set(e,t,n){const o=Il(vl(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Nl(vl(e),t),l=o?.[ol];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||fl(e.base_,t)))return!0;zl(e),Pl(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!==Nl(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,zl(e),Pl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=vl(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){rl(11)},getPrototypeOf:e=>il(e.base_),setPrototypeOf(){rl(12)}},Ml={};function Nl(e,t){const n=e[ol];return(n?vl(n):e)[t]}function Il(e,t){if(!(t in e))return;let n=il(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=il(n)}}function Pl(e){e.modified_||(e.modified_=!0,e.parent_&&Pl(e.parent_))}function zl(e){e.copy_||(e.copy_=yl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}dl(Ll,((e,t)=>{Ml[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ml.deleteProperty=function(e,t){return Ml.set.call(this,e,t,void 0)},Ml.set=function(e,t,n){return Ll.set.call(this,e[0],t,n,e[0])};function Fl(e,t){const n=hl(e)?El("MapSet").proxyMap_(e,t):gl(e)?El("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Cl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Ll;n&&(r=[o],i=Ml);const{revoke:l,proxy:a}=Proxy.revocable(r,i);return o.draft_=a,o.revoke_=l,a}(e,t);return(t?t.scope_:Cl()).drafts_.push(n),n}function Ul(e){if(!al(e)||wl(e))return e;const t=e[ol];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=yl(e,t.scope_.immer_.useStrictShallowCopy_)}else n=yl(e,!0);return dl(n,((e,t)=>{pl(n,e,Ul(t))})),t&&(t.finalized_=!1),n}var Hl=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&&rl(6),void 0!==n&&"function"!=typeof n&&rl(7),al(e)){const r=_l(this),i=Fl(e,void 0);let l=!0;try{o=t(i),l=!1}finally{l?Sl(r):Dl(r)}return Ol(r,n),jl(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===tl&&(o=void 0),this.autoFreeze_&&ml(o,!0),n){const t=[],r=[];El("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}rl(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){al(e)||rl(8),ll(e)&&(e=function(e){ll(e)||rl(10);return Ul(e)}(e));const t=_l(this),n=Fl(e,void 0);return n[ol].isManual_=!0,Dl(t),n}finishDraft(e,t){const n=e&&e[ol];n&&n.isManual_||rl(9);const{scope_:o}=n;return Ol(o,t),jl(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=El("Patches").applyPatches_;return ll(e)?o(e,t):this.produce(e,(e=>o(e,t)))}};Hl.produce,Hl.produceWithPatches.bind(Hl),Hl.setAutoFreeze.bind(Hl),Hl.setUseStrictShallowCopy.bind(Hl),Hl.applyPatches.bind(Hl);var Vl=Hl.createDraft.bind(Hl),Wl=Hl.finishDraft.bind(Hl);function Kl(e,t){const n=Mn(e);if(!n)return!1;const o=D.marks(n);return!!(null==o?void 0:o[t])}const Yl=(e,t)=>{const{insertText:n}=t;return t.insertText=o=>{var r;const{selection:i}=t;if(" "===o&&i&&j.isCollapsed(i)){const{anchor:l}=i,a=D.above(t,{match:e=>_.isElement(e)&&D.isBlock(t,e),mode:"lowest"});if(!a)return;const[,c]=a,s=D.parent(t,c),[d]=s;if(_.isElement(d)&&!B.isText(d.children[0]))return n(o);const u=a?c:[],f={anchor:l,focus:D.start(t,u)},p=D.string(t,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(!!h&&!h.isActive())return R.select(t,f),R.delete(t),void h.create({deleteText:!1})}n(o)},t};function $l(e,t,n){e.children=Vl(e.children);let o=!1;const r=e.children[t];if(!r)throw Error(`Block with id ${t} not found`);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=Wl(e.children),o&&e.applyChanges(),e.emit("change",e.children)}function Xl(e,t,n){e.children=Vl(e.children);const o=M(e,{at:e.selection});if(!o)throw new Error("Block from not found at current selection");const r=oi(e.blocks[o.type].elements);if(o.type===t)return void(e.children=Wl(e.children));const i=Mn(e,{at:[o.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${o.meta.order}`);const l=oi(e.blocks[t].elements);D.withoutNormalizing(i,(()=>{!function(e,t={}){var n;const{at:o,elementType:r}=t,i=o||(null===(n=e.selection)||void 0===n?void 0:n.anchor.path);if(!i)return;let l=e=>!D.isEditor(e)&&_.isElement(e);r&&(l=e=>!D.isEditor(e)&&_.isElement(e)&&e.type===r);const a=S.parent(i),c=D.nodes(e,{at:a,match:l,mode:"lowest"});if(c){const[e]=c}}(i,{elementType:r}),R.setNodes(i,{type:l},{at:[0],mode:"lowest",match:e=>_.isElement(e)&&!D.isInline(i,e)});const n={id:o.id,type:t,meta:Object.assign(Object.assign({},o.meta),{order:o.meta.order}),value:i.children};e.blockEditorsMap[o.id]=i,e.children[o.id]=n,e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children)}))}function Zl(e,t={}){const{at:n=e.selection,deleteAll:o=!1,fromPaths:r,focus:i}=t;if(Array.isArray(r)&&r.length>0){e.children=Vl(e.children),r.forEach((t=>{const n=M(e,{at:[t]});n&&(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=Wl(e.children),e.applyChanges(),void e.emit("change",e.children)}if(o||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=J({id:q()}),n=Jl(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=Vl(e.children);const[l]=n,a=Object.keys(e.children),c=a.find((t=>e.children[t].meta.order===l));if(a.forEach((t=>{const n=e.children[t];n.meta.order>l&&(n.meta.order-=1)})),c&&(delete e.children[c],delete e.blockEditorsMap[c]),e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,o=M(e,{at:[n]});o&&e.focusBlock(o.id,{focusAt:t.focusAt})}}function ql(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=Mn(e);if(!n)return null;const o=D.marks(n);return null==o?void 0:o[t]}(e,o),isActive:()=>Kl(e,o),toggle:()=>function(e,t){const n=Mn(e),o=Kl(e,t);n&&(o?D.removeMark(n,t):D.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,o),update:t=>function(e,t,n){const o=Mn(e);o&&o.selection&&j.isExpanded(o.selection)&&(D.addMark(o,t,n),e.applyChanges(),e.emit("change",e.children))}(e,o,t)}})),n}function Gl(e,t){const n={};return t.forEach(((t,o)=>{var r;const i=ri(t.elements),l=null===(r=null==i?void 0:i.props)||void 0===r?void 0:r.nodeType;if(!("inline"===l||"inlineVoid"===l)){const o={};Object.keys(t.elements).forEach((e=>{const n=mi(t.elements[e],["render"]);o[e]=n}));const{display:r,placeholder:i,align:l,shortcuts:a}=t.options||{};n[t.type]={type:t.type,elements:o,hasCustomEditor:!!t.customEditor,options:{display:r,placeholder:i,align:l,shortcuts:a},isActive:()=>{const n=M(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:(t,n)=>{Xl(e,t)},create:n=>{!function(e,t,n){var o;e.children=Vl(e.children);const r=M(e);if(!r)throw new Error(`No block found in the current selection path. Passed path: ${e.selection}`);const i=(null==n?void 0:n.slate)||Mn(e,{at:[null==r?void 0:r.meta.order]});if(!i||!i.selection)return;const l=e.blocks[t],a=oi(l.elements),c=l.elements[a];if(!c)return;const s=Object.assign({nodeType:(null===(o=c.props)||void 0===o?void 0:o.nodeType)||"block"},c.props),d=G({id:q(),type:a,props:s});R.setNodes(i,d,{at:[0,0],match:e=>_.isElement(e),mode:"highest"}),(null==n?void 0:n.deleteText)&&R.delete(i,{at:[0,0]});const u=J({id:r.id,type:l.type,meta:{order:r.meta.order,depth:r.meta.depth},value:[d]}),f=u.id;e.children[f]=u,e.blockEditorsMap[f]=i,e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(f,{slate:i,waitExecution:!0})}(e,t.type,n)},update:(t,n)=>{$l(e,t,n)},updateElement:(t,n,o)=>{!function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Mn(e,{at:[r.meta.order]});i?D.withoutNormalizing(i,(()=>{const[t]=D.nodes(i,{at:[0],match:e=>_.isElement(e)&&e.type===n}),r=null==t?void 0:t[0],l=(null==r?void 0:r.props)||{},a={props:Object.assign(Object.assign({},l),o)};R.setNodes(i,a,{at:[0],match:e=>_.isElement(e)&&e.type===n,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")}(e,t,n,o)},delete:t=>{Zl(e,t)}}}})),n}function Jl(e){return Yl(e,O(A()))}function Ql({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const ea=Ql({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),ta=(()=>{const e=q();return{[e]:J({id:e})}})(),na=new X,oa=(e,t)=>na.on(e,t),ra=(e,t)=>na.once(e,t),ia=(e,t)=>na.off(e,t),la=(e,t)=>na.emit(e,t);const aa=({editor:n,value:o,marks:r,plugins:i,autoFocus:l,className:a,tools:c,selectionBoxRoot:s,children:u,placeholder:p,readOnly:h,width:g})=>{const v=()=>{w((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},y=d((()=>r?[ea,...r]:[ea]),[r]),m=d((()=>i.map((e=>e.getPlugin))),[i]),[b,w]=f((()=>(n.applyChanges=v,n.readOnly=h||!1,y&&(n.formats=ql(n,y)),n.blocks=Gl(n,m),n.children=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(o)?o:ta,n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const o=Jl(e);t[n]=o})),t}(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]=r)})),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}(m),n.on=oa,n.once=ra,n.off=ia,n.emit=la,{editor:n,version:0})));return e(el,{children:e(P,Object.assign({editorState:b},{children:t(li,Object.assign({tools:c},{children:[e(Qi,{placeholder:p,marks:y,autoFocus:l,className:a,selectionBoxRoot:s,width:g}),u]}))}))})},ca=Object.assign(Object.assign({},fi),{ExtendedBlockActions:({className:o,style:r,onClick:i,children:l})=>{const a=V(),[c,s]=f(!1),{refs:d,floatingStyles:u,context:p}=Ir({placement:"bottom-start",open:c,onOpenChange:s,middleware:[Uo(),Fo(),zo(),ko(10)],whileElementsMounted:Po}),{isMounted:h,styles:g}=Ur(p,{duration:100}),v=Object.assign(Object.assign({},g),u);return a?null:t(n,{children:[h&&e(ui,Object.assign({isOpen:!0,onClose:()=>s(!1),refs:d,style:v},{children:l})),e("button",Object.assign({type:"button",ref:d.setReference,className:`yoo-editor-absolute yoo-editor-right-[8px] yoo-editor-top-[8px] yoo-editor-flex yoo-editor-items-center yoo-editor-justify-between yoo-editor-z-10 yoo-editor-opacity-1 yoo-editor-bg-[#eee] yoo-editor-w-[22px] yoo-editor-h-[22px] yoo-editor-transition-opacity yoo-editor-duration-150 yoo-editor-ease-in yoo-editor-border-none yoo-editor-cursor-pointer yoo-editor-rounded-[2px] yoo-editor-p-[0_4px] ${o||""} yoopta-extended-block-actions`,onClick:()=>{null==i||i(),s(!0)},style:c?Object.assign(Object.assign({},r),{opacity:1}):r},{children:e(Zr,{})}))]})}});function sa(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 da(e,t,n={}){const{focusAt:o,waitExecution:r=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:l=!0}=n,a=()=>{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(T.isPoint(t))return t;if(S.isPath(t))return{path:t,offset:0};const[,n]=D.first(e,[0]);return{path:n||[0,0],offset:0}}(r,o);R.select(r,e),w.focus(r)}l&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};r?setTimeout((()=>a()),i):a()}function ua(e){return Array.from(new Set(e))}var fa={};!function(e,t){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object Boolean]",l="[object Date]",a="[object Function]",c="[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]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",S="[object Uint8ClampedArray]",D="[object Uint16Array]",_="[object Uint32Array]",R=/\w*$/,j=/^\[object .+?Constructor\]$/,B=/^(?:0|[1-9]\d*)$/,A={};A[r]=A["[object Array]"]=A[m]=A[b]=A[i]=A[l]=A[w]=A[x]=A[k]=A[E]=A[C]=A[s]=A[d]=A[u]=A[p]=A[h]=A[g]=A[v]=A[O]=A[S]=A[D]=A[_]=!0,A["[object Error]"]=A[a]=A[y]=!1;var T="object"==typeof Y&&Y&&Y.Object===Object&&Y,L="object"==typeof self&&self&&self.Object===Object&&self,M=T||L||Function("return this")(),N=t&&!t.nodeType&&t,I=N&&e&&!e.nodeType&&e,P=I&&I.exports===N;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(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 V(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}function W(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 $,X=Array.prototype,Z=Function.prototype,q=Object.prototype,G=M["__core-js_shared__"],J=($=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",Q=Z.toString,ee=q.hasOwnProperty,te=q.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=P?M.Buffer:void 0,re=M.Symbol,ie=M.Uint8Array,le=W(Object.getPrototypeOf,Object),ae=Object.create,ce=q.propertyIsEnumerable,se=X.splice,de=Object.getOwnPropertySymbols,ue=oe?oe.isBuffer:void 0,fe=W(Object.keys,Object),pe=Pe(M,"DataView"),he=Pe(M,"Map"),ge=Pe(M,"Promise"),ve=Pe(M,"Set"),ye=Pe(M,"WeakMap"),me=Pe(Object,"create"),be=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Ee=Ve(ye),Ce=re?re.prototype:void 0,Oe=Ce?Ce.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 _e(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 Re(e){this.__data__=new De(e)}function je(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&ee.call(e,"callee")&&(!ce.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||Ue(l,o))||n.push(l);return n}function Be(e,t,n){var o=e[t];ee.call(e,t)&&We(o,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if(We(e[n][0],t))return n;return-1}function Te(e,t,n,o,f,y,j){var B;if(o&&(B=y?o(e,f,y,j):o(e)),void 0!==B)return B;if(!Ze(e))return e;var T=Ke(e);if(T){if(B=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,B)}else{var L=Fe(e),M=L==a||L==c;if($e(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(L==u||L==r||M&&!y){if(H(e))return y?e:{};if(B=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=le(e),Ze(t)?ae(t):{});var t}(M?{}:e),!t)return function(e,t){return Ne(e,ze(e),t)}(e,function(e,t){return e&&Ne(t,qe(t),e)}(B,e))}else{if(!A[L])return y?e:{};B=function(e,t,n,o){var r=e.constructor;switch(t){case m: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 C:case O:case S:case D:case _: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(V(e),!0):V(e);return U(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,R.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 U(o,F,new e.constructor)}(e,o,n);case v:return a=e,Oe?Object(Oe.call(a)):{}}var a}(e,L,Te,t)}}j||(j=new Re);var N=j.get(e);if(N)return N;if(j.set(e,B),!T)var I=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,qe,ze)}(e):qe(e);return function(e,t){for(var n=-1,o=e?e.length:0;++n<o&&!1!==t(e[n],n,e););}(I||e,(function(r,i){I&&(r=e[i=r]),Be(B,i,Te(r,t,n,o,i,e,j))})),B}function Le(e){return!(!Ze(e)||(t=e,J&&J in t))&&(Xe(e)||H(e)?ne:j).test(Ve(e));var t}function Me(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,n,o){n||(n={});for(var r=-1,i=t.length;++r<i;){var l=t[r],a=o?o(n[l],e[l],l,n,e):void 0;Be(n,l,void 0===a?e[l]:a)}return n}function Ie(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 Pe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Se.prototype.clear=function(){this.__data__=me?me(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(me){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 me?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?n:t,this},De.prototype.clear=function(){this.__data__=[]},De.prototype.delete=function(e){var t=this.__data__,n=Ae(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=Ae(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return Ae(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,o=Ae(n,e);return o<0?n.push([e,t]):n[o][1]=t,this},_e.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||De),string:new Se}},_e.prototype.delete=function(e){return Ie(this,e).delete(e)},_e.prototype.get=function(e){return Ie(this,e).get(e)},_e.prototype.has=function(e){return Ie(this,e).has(e)},_e.prototype.set=function(e,t){return Ie(this,e).set(e,t),this},Re.prototype.clear=function(){this.__data__=new De},Re.prototype.delete=function(e){return this.__data__.delete(e)},Re.prototype.get=function(e){return this.__data__.get(e)},Re.prototype.has=function(e){return this.__data__.has(e)},Re.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 _e(o)}return n.set(e,t),this};var ze=de?W(de,Object):function(){return[]},Fe=function(e){return te.call(e)};function Ue(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||B.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function We(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||ye&&Fe(new ye)!=y)&&(Fe=function(e){var t=te.call(e),n=t==u?e.constructor:void 0,o=n?Ve(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 y}return t});var Ke=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Xe(e)}var $e=ue||function(){return!1};function Xe(e){var t=Ze(e)?te.call(e):"";return t==a||t==c}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function qe(e){return Ye(e)?je(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 Te(e,!0,!0)}}({get exports(){return fa},set exports(e){fa=e}},fa);var pa=fa;function ha(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=M(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=Vl(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):pa(l));var l;const a=Jl(e);i.id=q(),i.meta.order=r.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=a;const c=i.id;e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(c,{waitExecution:!0})}function ga(e,t){w.blur(t),w.deselect(t),R.deselect(t),e.setBlockSelected(null),e.setSelection(null)}const va=()=>{const e={children:{},selection:null,selectedBlocks:null,readOnly:!1,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),applyChanges:()=>{},insertBlock:(...t)=>function(e,t,n={}){e.children=Vl(e.children);const{at:o=null,focus:r=!1,slate:i=null}=n,l=M(e),a=o,c={id:q(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let s=!1;if(i&&i.selection){const e=D.string(i,i.selection.anchor.path);s=D.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(a){const[t]=a;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),c.meta.order=t}else{const t=Object.keys(e.children).length;c.meta.order=t}const d=Jl(e);e.blockEditorsMap[c.id]=d,s&&l&&(c.meta.order=l.meta.order,l.meta.order+=1),e.children[c.id]=c;const u=null==l?void 0:l.id;e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(s&&u?u:c.id)}(e,...t),insertBlocks:(...t)=>function(e,t,n={}){e.children=Vl(e.children);const{at:o,focus:r}=n;let i=o||[0];const l=M(e),a=Mn(e);let c=!1,s=!1;if(a&&a.selection){const t=S.parent(a.selection.anchor.path),n=D.string(a,t).trim(),o=D.isStart(a,a.selection.anchor,t);c=""===n&&o,s=!o||n.length>0,w.blur(a),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=Jl(e);e.blockEditorsMap[o.id]=r})),l&&c){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=Wl(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.setBlockSelected(d)}(e,...t),deleteBlock:(...t)=>Zl(e,...t),duplicateBlock:(...t)=>ha(e,...t),toggleBlock:(...t)=>Xl(e,...t),increaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=Vl(e.children);const o=M(e);o&&(o.meta.depth=o.meta.depth+1,e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),decreaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=Vl(e.children);const o=M(e);o&&(o.meta.depth=0===o.meta.depth?0:o.meta.depth-1,e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),moveBlock:(...t)=>function(e,t,n){e.children=Vl(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,a=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--:a&&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.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children)}(e,...t),focusBlock:(...t)=>da(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>$l(e,...t),splitBlock:(...t)=>function(e,t={}){const{slate:n,focus:o=!0}=t,r=M(e);n&&n.selection&&r&&D.withoutNormalizing(n,(()=>{e.children=Vl(e.children);const t=S.parent(n.selection.anchor.path);R.splitNodes(n,{at:n.selection,match:e=>_.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,l=n.children.slice()[i];R.removeNodes(n,{at:[i],match:e=>_.isElement(e),mode:"highest"});const a={id:q(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth},value:[l]};Object.values(e.children).forEach((e=>{e.meta.order>=a.meta.order&&(e.meta.order+=1)}));const c=Jl(e);e.blockEditorsMap[a.id]=c,e.children[a.id]=a,e.children=Wl(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(a.id,{slate:c})}))}(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=ua(t)}else e.selectedBlocks=ua(i.concat(t));e.applyChanges()}(e,...t),blur:(...t)=>function(e,t={}){var n;const o=null!==(n=t.slate)&&void 0!==n?n:Mn(e);if(!o)return;const{waitExecution:r,waitExecutionMs:i}=t;r?setTimeout((()=>ga(e,o)),i):(ga(e,o),e.applyChanges())}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{}};return e};pi('/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.yoo-editor-pointer-events-none{pointer-events:none}.yoo-editor-absolute{position:absolute}.yoo-editor-relative{position:relative}.yoo-editor-left-0{left:0}.yoo-editor-right-\\[8px\\]{right:8px}.yoo-editor-top-0{top:0}.yoo-editor-top-\\[8px\\]{top:8px}.yoo-editor-z-10{z-index:10}.yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-z-\\[90\\]{z-index:90}.yoo-editor-mx-\\[4px\\]{margin-left:4px;margin-right:4px}.yoo-editor-my-\\[4px\\]{margin-bottom:4px;margin-top:4px}.yoo-editor-mb-\\[1px\\]{margin-bottom:1px}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-mt-\\[2px\\]{margin-top:2px}.yoo-editor-flex{display:flex}.yoo-editor-h-4{height:1rem}.yoo-editor-h-\\[1px\\]{height:1px}.yoo-editor-h-\\[22px\\]{height:22px}.yoo-editor-h-full{height:100%}.yoo-editor-w-4{width:1rem}.yoo-editor-w-\\[22px\\]{width:22px}.yoo-editor-w-auto{width:auto}.yoo-editor-w-full{width:100%}.yoo-editor-min-w-\\[200px\\]{min-width:200px}.yoo-editor-cursor-default{cursor:default}.yoo-editor-cursor-pointer{cursor:pointer}.yoo-editor-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoo-editor-flex-col{flex-direction:column}.yoo-editor-items-center{align-items:center}.yoo-editor-justify-start{justify-content:flex-start}.yoo-editor-justify-between{justify-content:space-between}.yoo-editor-overflow-hidden{overflow:hidden}.yoo-editor-rounded{border-radius:.25rem}.yoo-editor-rounded-\\[2px\\]{border-radius:2px}.yoo-editor-rounded-md{border-radius:.375rem}.yoo-editor-rounded-sm{border-radius:.125rem}.yoo-editor-border{border-width:1px}.yoo-editor-border-none{border-style:none}.yoo-editor-bg-\\[\\#2383e224\\]{background-color:#2383e224}.yoo-editor-bg-\\[\\#37352f14\\]{background-color:#37352f14}.yoo-editor-bg-\\[\\#FFF\\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.yoo-editor-bg-\\[\\#eee\\]{--tw-bg-opacity:1;background-color:rgb(238 238 238/var(--tw-bg-opacity))}.yoo-editor-p-\\[0_4px\\]{padding:0 4px}.yoo-editor-px-0{padding-left:0;padding-right:0}.yoo-editor-px-2{padding-left:.5rem;padding-right:.5rem}.yoo-editor-px-\\[2px\\]{padding-left:2px;padding-right:2px}.yoo-editor-py-0{padding-bottom:0;padding-top:0}.yoo-editor-py-1{padding-bottom:.25rem;padding-top:.25rem}.yoo-editor-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.yoo-editor-py-\\[6px\\]{padding-bottom:6px;padding-top:6px}.yoo-editor-text-sm{font-size:.875rem;line-height:1.25rem}.yoo-editor-leading-\\[120\\%\\]{line-height:120%}.yoo-editor-opacity-100{opacity:1}.yoo-editor-shadow-md{--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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.yoo-editor-outline-none{outline:2px solid transparent;outline-offset:2px}.yoo-editor-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoo-editor-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoo-editor-duration-150{transition-duration:.15s}.yoo-editor-ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}#yoopta-editor{height:auto;min-width:400px}.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}.hover\\:yoo-editor-bg-\\[\\#37352f14\\]:hover{background-color:#37352f14}.focus\\:yoo-editor-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:yoo-editor-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.data-\\[disabled\\]\\:yoo-editor-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[disabled\\]\\:yoo-editor-opacity-50[data-disabled]{opacity:.5}');export{Mi as HOTKEYS,ca as UI,L as YooptaPlugin,J as buildBlockData,G as buildBlockElement,va as createYooptaEditor,Ql as createYooptaMark,aa as default,M as findPluginBlockBySelectionPath,sa as findPluginBlockByType,Mn as findSlateBySelectionPath,q as generateId,ri as getRootBlockElement,oi as getRootBlockElementType,F as useBlockData,K as useBlockSelected,U as useYooptaBlock,z as useYooptaEditor,H as useYooptaPlugin,W as useYooptaPluginOptions,V as useYooptaReadOnly,ai as useYooptaTools};
|