@yoopta/editor 4.0.0-rc.6 → 4.0.0-rc.7
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,4 +9,4 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from
|
|
|
9
9
|
* tabbable 6.2.0
|
|
10
10
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
11
11
|
*/
|
|
12
|
-
var td=["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(","),nd="undefined"==typeof Element,rd=nd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,od=!nd&&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},id=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)},ad=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!id(a,!1))if("SLOT"===a.tagName){var u=a.assignedElements(),s=e(u.length?u:a.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:a,candidates:s})}else{rd.call(a,td)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var l=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),c=!id(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(l&&c){var d=e(!0===l?a.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:a,candidates:d})}else i.unshift.apply(i,a.children)}}return o},ud=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},sd=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))&&!ud(e)?0:e.tabIndex},ld=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},cd=function(e){return"INPUT"===e.tagName},dd=function(e){return function(e){return cd(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||od(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)},fd=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},hd=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=rd.call(e,"details>summary:first-of-type")?e.parentElement:e;if(rd.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return fd(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,u=od(e);if(a&&!a.shadowRoot&&!0===r(a))return fd(e);e=e.assignedSlot?e.assignedSlot:a||u===e.ownerDocument?a:u.host}e=i}if(function(e){var t,n,r,o,i=e&&od(e),a=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(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));!u&&a;){var s,l,c;u=!(null===(l=a=null===(s=i=od(a))||void 0===s?void 0:s.host)||void 0===l||null===(c=l.ownerDocument)||void 0===c||!c.contains(a))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},pd=function(e,t){return!(t.disabled||id(t)||function(e){return cd(e)&&"hidden"===e.type}(t)||hd(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!!rd.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},vd=function(e,t){return!(dd(t)||sd(t)<0||!pd(e,t))},gd=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},md=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,u=function(e,t){var n=sd(e);return n<0&&t&&!ud(e)?0:n}(a,i),s=i?e(t.candidates):a;0===u?i?n.push.apply(n,s):n.push(a):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:s})})),r.sort(ld).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Dd=function(e,t){var n;return n=(t=t||{}).getShadowRoot?ad([e],t.includeContainer,{filter:vd.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:gd}):function(e,t,n){if(id(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(td));return t&&rd.call(e,td)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,vd.bind(null,t)),md(n)};const bd=r["useInsertionEffect".toString()]||(e=>e());var yd="undefined"!=typeof document?s:l;function Cd(){return Cd=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},Cd.apply(this,arguments)}let wd=!1,Bd=0;const Ed=()=>"floating-ui-"+Bd++;const Ad=r["useId".toString()]||function(){const[e,t]=r.useState((()=>wd?Ed():void 0));return yd((()=>{null==e&&t(Ed())}),[]),r.useEffect((()=>{wd||(wd=!0)}),[]),e};const xd=r.createContext(null),Fd=r.createContext(null);function Od(e){return"data-floating-ui-"+e}function kd(e){const t=u(e);return yd((()=>{t.current=e})),t}const Sd=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function jd(e,t){const n=Dd(e,Sd());"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}(function(e){return(null==e?void 0:e.ownerDocument)||document}(e)));return n.slice(r+1)[0]}function Pd(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&&Zl(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function Rd(e){Dd(e,Sd()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Td(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 Nd={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 _d(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Md=r.forwardRef((function(e,t){const[n,o]=r.useState();yd((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",_d),()=>{document.removeEventListener("keydown",_d)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Od("focus-guard")]:"",style:Nd};return r.createElement("span",Cd({},e,i))})),Ld=r.createContext(null),Id=Od("portal");function zd(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=Ad(),u=Wd(),s=r.useRef(null);return yd((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),yd((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=a,n.setAttribute(Id,""),e.appendChild(n),s.current=n,i(n)}),[t,a]),yd((()=>{if(s.current)return;let e=n||(null==u?void 0:u.portalNode);e&&!Xl(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(Id,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,a,u]),o}({id:n,root:o}),[u,s]=r.useState(null),l=r.useRef(null),c=r.useRef(null),d=r.useRef(null),f=r.useRef(null),h=!!u&&!u.modal&&u.open&&i&&!(!o&&!a);return r.useEffect((()=>{if(a&&i&&(null==u||!u.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&&Pd(e)){("focusin"===e.type?Td:Rd)(a)}}}),[a,i,null==u?void 0:u.modal]),r.createElement(Ld.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:f,portalNode:a,setFocusManagerState:s})),[i,a])},h&&a&&r.createElement(Md,{"data-type":"outside",ref:l,onFocus:e=>{if(Pd(e,a)){var t;null==(t=d.current)||t.focus()}else{const e=jd(document.body,"prev")||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),h&&a&&r.createElement("span",{"aria-owns":a.id,style:Nd}),a&&B(t,a),h&&a&&r.createElement(Md,{"data-type":"outside",ref:c,onFocus:e=>{if(Pd(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=jd(document.body,"next")||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent))}}}))}const Wd=()=>r.useContext(Ld),Vd=new Set,qd=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=Ad();return yd((()=>{if(!n)return;Vd.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,u=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,l;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(l=window.visualViewport)?void 0:l.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Vd.delete(i),0===Vd.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,u)))}}),[i,n]),r.createElement("div",Cd({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Ud(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[a,u]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||a,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:u}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=r.useState(o);Jc(h,o)||p(o);const[v,g]=r.useState(null),[m,D]=r.useState(null),b=r.useCallback((e=>{e!==E.current&&(E.current=e,g(e))}),[]),C=r.useCallback((e=>{e!==A.current&&(A.current=e,D(e))}),[]),w=a||v,B=u||m,E=r.useRef(null),A=r.useRef(null),x=r.useRef(d),F=null!=l,O=ed(l),k=ed(i),S=r.useCallback((()=>{if(!E.current||!A.current)return;const e={placement:t,strategy:n,middleware:h};k.current&&(e.platform=k.current),Yc(E.current,A.current,e).then((e=>{const t={...e,isPositioned:!0};j.current&&!Jc(x.current,t)&&(x.current=t,y.flushSync((()=>{f(t)})))}))}),[h,t,n,k]);Zc((()=>{!1===c&&x.current.isPositioned&&(x.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[c]);const j=r.useRef(!1);Zc((()=>(j.current=!0,()=>{j.current=!1})),[]),Zc((()=>{if(w&&(E.current=w),B&&(A.current=B),w&&B){if(O.current)return O.current(w,B,S);S()}}),[w,B,S,O,F]);const P=r.useMemo((()=>({reference:E,floating:A,setReference:b,setFloating:C})),[b,C]),R=r.useMemo((()=>({reference:w,floating:B})),[w,B]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!R.floating)return e;const t=Qc(R.floating,d.x),r=Qc(R.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Gc(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,R.floating,d.x,d.y]);return r.useMemo((()=>({...d,update:S,refs:P,elements:R,floatingStyles:T})),[d,S,P,R,T])}(e),c=r.useContext(Fd),d=null!=((null==(f=r.useContext(xd))?void 0:f.id)||null);var f;const h=function(e){const t=r.useRef((()=>{}));return bd((()=>{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&&(v.current.openEvent=t),g.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==o||o(e,t,n)})),p=r.useRef(null),v=r.useRef({}),g=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=Ad(),D=r.useCallback((e=>{const t=Xl(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),b=r.useCallback((e=>{(Xl(e)||null===e)&&(p.current=e,u(e)),(Xl(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Xl(e))&&l.refs.setReference(e)}),[l.refs]),C=r.useMemo((()=>({...l.refs,setReference:b,setPositionReference:D,domReference:p})),[l.refs,b,D]),w=r.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),B=r.useMemo((()=>({...l,refs:C,elements:w,dataRef:v,nodeId:i,floatingId:m,events:g,open:n,onOpenChange:h})),[l,i,m,g,n,h,C,w]);return yd((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===i));e&&(e.context=B)})),r.useMemo((()=>({...l,context:B,refs:C,elements:w})),[l,C,w,B])}const Hd=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Kd(e,t){return"function"==typeof e?e(t):e}function $d(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,[u,s]=r.useState(!1),[l,c]=r.useState("unmounted"),d=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 yd((()=>{u&&!d&&c("unmounted")}),[u,d]),yd((()=>{if(o){if(n){c("initial");const e=requestAnimationFrame((()=>{c("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),c("close")}}),[n,o]),{isMounted:d,status:l}}function Xd(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:a,duration:u=250}=t,s=e.placement,l=s.split("-")[0],c=r.useMemo((()=>({side:l,placement:s})),[l,s]),d="number"==typeof u,f=(d?u:u.open)||0,h=(d?u:u.close)||0,[p,v]=r.useState((()=>({...Kd(a,c),...Kd(n,c)}))),{isMounted:g,status:m}=$d(e,{duration:u}),D=kd(n),b=kd(o),y=kd(i),C=kd(a);return yd((()=>{const e=Kd(D.current,c),t=Kd(y.current,c),n=Kd(C.current,c),r=Kd(b.current,c)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&v((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&v({transitionProperty:Object.keys(r).map(Hd).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;v({transitionProperty:Object.keys(r).map(Hd).join(","),transitionDuration:h+"ms",...n,...r})}}),[h,y,D,b,C,f,m,c]),{isMounted:g,styles:p}}var Yd;function Zd(){return Zd=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},Zd.apply(this,arguments)}var Jd=function(e){return r.createElement("svg",Zd({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Yd||(Yd=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 Gd(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 Qd=["color"],ef=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,Qd);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),tf=["color"],nf=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,tf);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),rf=["color"],of=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,rf);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),af=["color"],uf=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,af);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),sf=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()}},lf={"text/plain":"Text","text/html":"Url",default:"Text"};var cf=function(e,t){var n,r,o,i,a,u,s=!1;t||(t={}),n=t.debug||!1;try{if(o=sf(),i=document.createRange(),a=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.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=lf[t.format]||lf.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(u),i.selectNodeContents(u),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),u&&document.body.removeChild(u),o()}return s};function df(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ff(e){if(!e)return;const t=df(e);return t?e[t]:void 0}const hf=i(void 0),pf=({children:r,tools:o})=>{const i=c((()=>o?Object.keys(o).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:o[t].render})),{}):{}),[o]);return e(hf.Provider,Object.assign({value:i},{children:t(n,{children:[o&&Object.keys(o).map((t=>{const n=o[t].tool;return e(n,{},t)})),r]})}))},vf=()=>{const e=a(hf);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e},gf=({children:t})=>e("div",Object.assign({className:"flex flex-col"},{children:t})),mf=({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})),Df=({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})),bf=({isOpen:n,onClose:r,refs:o,style:i,children:a})=>{var u;const s=k(),l=vf(),[c,d]=f(!1),{refs:h,floatingStyles:p,context:v}=Ud({placement:"right",open:c,onOpenChange:d,middleware:[Xc(),$c(),Kc(),kc(10)],whileElementsMounted:Hc}),{isMounted:g,styles:m}=Xd(v,{duration:100});if(!n)return null;const D=A(s,{at:s.selection}),b=ff(s.blocks[(null==D?void 0:D.type)||""].elements),y="void"===(null===(u=null==b?void 0:b.props)||void 0===u?void 0:u.nodeType),C=l.ActionMenu,w=Object.assign(Object.assign({},p),m);return e(zd,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(qd,Object.assign({lockScroll:!0,className:"z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating},{children:t(mf,{children:[t(gf,{children:[e(Df,{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(uf,{className:"w-4 h-4 mr-2"}),"Delete"]}))}),e(Df,{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(ef,{className:"w-4 h-4 mr-2"}),"Duplicate"]}))}),!y&&t(Df,{children:[g&&!!C&&e(zd,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(qd,Object.assign({lockScroll:!0,className:"z-[100]",onClick:()=>d(!1)},{children:e("div",Object.assign({style:w,ref:h.setFloating},{children:e(C,{actions:Object.keys(s.blocks),editor:s,selectedAction:"",onClose:()=>d(!1),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:()=>d((e=>!e))},{children:[e(Jd,{className:"w-4 h-4 mr-2"}),"Turn into"]}))]}),e(Df,{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=A(s);e&&cf(`${window.location.origin}${window.location.pathname}#${e.id}`),r()}},{children:[e(of,{className:"w-4 h-4 mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var yf=Object.freeze({__proto__:null,BlockOptions:bf,BlockOptionsMenuContent:mf,BlockOptionsMenuGroup:gf,BlockOptionsMenuItem:Df,BlockOptionsSeparator:({className:t})=>e("div",{className:`h-[1px] bg-[#37352f14] my-[4px] w-full ${t}`})});function Cf(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 wf={actions:"vuZgncnq",hovered:"_8Eqjiv7m",actionButton:"WabGEp54",plusButton:"_0C8RpLmz"};function Bf(...e){return e.filter(Boolean).join(" ")}Cf(".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 Ef=({block:n,editor:r,dragHandleProps:o,showActions:i,onChangeActiveBlock:a})=>{const[u,s]=f(!1),{refs:l,floatingStyles:c,context:d}=Ud({placement:"right-start",open:u,onOpenChange:s,middleware:[Xc(),$c(),Kc(),kc()]}),{isMounted:h,styles:p}=Xd(d,{duration:100}),{setActivatorNodeRef:v,attributes:g,listeners:m}=o,D=Object.assign(Object.assign({},c),p);return t("div",Object.assign({contentEditable:!1,className:Bf(wf.actions,i&&wf.hovered,"yoopta-element-actions")},{children:[e("button",Object.assign({type:"button",onClick:()=>{const e=q({id:W()}),t=[n.meta.order+1];r.setSelection([n.meta.order]),r.insertBlock(e,{at:t,focus:!0})},className:Bf(wf.actionButton,wf.plusButton,"yoopta-element-actions-plus")},{children:e(An,{})})),e("button",Object.assign({type:"button",className:Bf(wf.actionButton,"yoopta-element-actions-drag"),ref:e=>{v(e),l.setReference(e)}},g,m,{onClick:e=>{e.stopPropagation(),a(n.id),console.log("editor.children",r.children);const t=xn(r,{at:[n.meta.order]});console.log("block",n),console.log("slate",t),r.focusBlock(n.id),t&&setTimeout((()=>{Bs.blur(t),Bs.deselect(t),qi.deselect(t),r.setBlockSelected([n.meta.order],{only:!0}),r.setSelection([n.meta.order]),s(!0)}),10)}},{children:e(Bn,{})})),e(bf,{isOpen:h,refs:l,style:D,onClose:()=>s(!1)})]}))},Af=({children:n,block:r,blockId:o})=>{var i;const a=k(),[u,s]=f(null),{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:h,transform:p,transition:v,active:g,over:m,isOver:D,isDragging:b}=vn({id:o}),y={transform:p?`translate3d(${p.x}px, ${p.y}px, 0)`:"none",transition:v,opacity:b?.7:1,marginLeft:20*r.meta.depth+"px"},C=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(r.meta.order),w=u===o,B=e=>s(e);return t("div",Object.assign({className:"relative py-0 px-[2px] mt-[2px] mb-[1px] rounded yoopta-block-wrapper",onMouseEnter:()=>B(o),onMouseLeave:()=>s(null),"data-yoopta-block-id":o,style:y,"data-yoopta-block":!0,ref:d},{children:[e(Ef,{block:r,editor:a,dragHandleProps:{setActivatorNodeRef:h,attributes:l,listeners:c},showActions:w,onChangeActiveBlock:B}),e("div",Object.assign({className:wf.content,style:{borderBottom:D&&!b?"2px solid #007aff":"none"}},{children:n})),C&&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 xf(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;const Ff={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"},Of={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"},kf={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Sf=e=>{const t=Ff[e],n=Of[e],r=kf[e],o=t&&bu(t),i=n&&bu(n),a=r&&bu(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},jf={isBold:Sf("bold"),isCompose:Sf("compose"),isArrowLeft:Sf("arrowLeft"),isArrowRight:Sf("arrowRight"),isArrowUp:Sf("arrowUp"),isArrowDown:Sf("arrowDown"),isDeleteBackward:Sf("deleteBackward"),isDeleteForward:Sf("deleteForward"),isDeleteLineBackward:Sf("deleteLineBackward"),isDeleteLineForward:Sf("deleteLineForward"),isDeleteWordBackward:Sf("deleteWordBackward"),isDeleteWordForward:Sf("deleteWordForward"),isExtendBackward:Sf("extendBackward"),isExtendForward:Sf("extendForward"),isExtendLineBackward:Sf("extendLineBackward"),isExtendLineForward:Sf("extendLineForward"),isItalic:Sf("italic"),isMoveLineBackward:Sf("moveLineBackward"),isMoveLineForward:Sf("moveLineForward"),isCtrlLeft:Sf("ctrlLeft"),isCtrlRight:Sf("ctrlRight"),isRedo:Sf("redo"),isShiftEnter:Sf("shiftEnter"),isEnter:Sf("enter"),isTransposeCharacter:Sf("transposeCharacter"),isUndo:Sf("undo"),isSpace:Sf("space"),isSelect:Sf("select"),isTab:Sf("tab"),isShiftTab:Sf("shiftTab"),isBackspace:Sf("backspace"),isCmdEnter:Sf("cmdEnter"),isCmd:Sf("cmd"),isEscape:Sf("escape"),isSlashCommand:Sf("slashCommand"),isShiftArrowUp:Sf("shiftArrowUp"),isShiftArrowDown:Sf("shiftArrowDown"),isKekceburek:Sf("kekCeburek")};const Pf={onKeyDown:function(e){return t=>{const n=xn(e,{at:e.selection});if(!n||!n.selection)return;const r=ko.parent(n.selection.anchor.path);if(jf.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(jf.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const o=Qo.isStart(n,n.selection.anchor,r),i=Qo.isEnd(n,n.selection.anchor,r);if(!o&&!i)return void e.splitBlock({slate:n,focus:!0});const a=q({id:W()}),u=e.selection?[e.selection[0]+1]:[0];e.insertBlock(a,{at:u,slate:n,focus:!0})}else if(jf.isBackspace(t)){if(t.isDefaultPrevented())return;const r=ko.parent(n.selection.anchor.path);if(Qo.isStart(n,n.selection.anchor,r)){t.preventDefault();const o=Qo.string(n,r),i=e.selection?e.selection[0]-1:0,a=xn(e,{at:[i]});let u;if(a&&(u=function(e,t){const[,n]=Qo.last(e,t);return{path:n,offset:Qo.string(e,n).length}}(a,r)),0===o.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:u});{if(Vo.isExpanded(n.selection))return qi.delete(n,{at:n.selection});if(!a)return;if(0===Qo.string(a,[0,0]).length)return e.deleteBlock({at:[i],focus:!0,focusAt:u});const t=Array.from(Qo.nodes(n,{at:[0],match:e=>!Qo.isEditor(e)&&(di.isText(e)||Qo.isInline(n,e)),mode:"highest"})),r=t.map((([e])=>e));return qi.insertNodes(a,r,{at:Qo.end(a,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:u})}}}else{if(jf.isSelect(t)){if(t.isDefaultPrevented())return;const[,r]=Qo.first(n,[0]),[,o]=Qo.last(n,[n.children.length-1]),i=Qo.range(n,r,o),a=Vo.equals(n.selection,i);if(Vo.isExpanded(n.selection)&&a)return t.preventDefault(),Bs.blur(n),Bs.deselect(n),qi.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(jf.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(jf.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(jf.isArrowUp(t)){if(t.isDefaultPrevented())return;const r=ko.parent(n.selection.anchor.path);if(Qo.isStart(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]-1]:null,r=xn(e,{at:n}),o=A(e,{at:n});if(r&&o){const[,n]=Qo.last(r,[0]),i={path:n,offset:Qo.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(jf.isArrowDown(t)){const r=ko.parent(n.selection.anchor.path);if(Qo.isEnd(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]+1]:null,o=xn(e,{at:n}),i=A(e,{at:n});if(o&&i){const n=function(e,t){const[,n]=Qo.first(e,t);return{path:n,offset:0}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(Vo.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&bu(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},Rf=({children:t,attributes:n,placeholder:r})=>{const o=a(ll),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))},Tf=i(null),Nf={didCatch:!1,error:null};class _f extends v{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Nf}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];null===(t=(n=this.props).onReset)||void 0===t||t.call(n,{args:o,reason:"imperative-api"}),this.setState(Nf)}}componentDidCatch(e,t){var n,r;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;var o,i;n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(o=(i=this.props).onReset)||void 0===o||o.call(i,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Nf))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:o,error:i}=this.state;let a=e;if(o){const e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)a=t(e);else if(n)a=m(n,e);else{if(null!==r&&!D(r))throw i;a=r}}return m(Tf.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},a)}}const Mf=({id:t,customEditor:r,elements:o,marks:i,events:a,options:s,placeholder:l="Type '/' for commands"})=>{const d=k(),f=S(t),h=u(f.value).current,p=f.type,v=c((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),g=c((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(i)),[i]),m=c((()=>{let e=d.blockEditorsMap[t];return Object.keys(o).forEach((e=>{var t;null===(t=o[e].props)||void 0===t||t.nodeType})),console.log(`SLATE EDITOR FOR block: ${f.id}`,m),e}),[]);console.log(`SLATE FOR block: ${f.id}`,m);const D=c((()=>{if(!a)return{};const e={hotkeys:jf,currentBlock:f,defaultBlock:q({id:W()})},t={};return Object.keys(a).forEach((n=>{t[n]=function(t){if(a[n]){a[n](d,m,e)(t)}}})),t}),[a,d,f]);return e(_f,Object.assign({onError:(e,t)=>{console.log("ERROR IN SLATE EDITOR",e),console.log("INFO FOR ERROR",t)},fallbackRender:()=>e("div",{children:"Something went wrong with Editor"})},{children:e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":p},{children:e(Lf,{id:t,slate:m,initialValue:h,onChange:e=>d.updateBlock(t,{value:e}),decorate:e=>{var t;const n=[],[r,o]=e,i=(null===(t=d.selection)||void 0===t?void 0:t[0])===f.meta.order;return m.selection&&i&&!Qo.isEditor(r)&&""===Qo.string(m,[o[0]])&&Vo.includes(m.selection,o)&&Vo.isCollapsed(m.selection)&&n.push(Object.assign(Object.assign({},m.selection),{withPlaceholder:!0})),n},renderLeaf:t=>{var n,r,o,i,a;let{children:u,leaf:s,attributes:c}=t;const h=xf(s,["text"]),p=(null===(n=d.selection)||void 0===n?void 0:n[0])===f.meta.order;h&&Object.keys(h).forEach((e=>{const t=g[e];t&&(u=t.render({children:u,leaf:s}))}));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))&&p&&s.withPlaceholder;return e(Rf,Object.assign({attributes:c,placeholder:v?l:void 0},{children:u}))},renderElement:r=>{const o=v[r.element.type];return o?e(o,Object.assign({},r,{blockId:t,options:s})):e(n,{})},eventHandlers:D,onKeyDown:e=>{var t;null===(t=D.onKeyDown)||void 0===t||t.call(D,e),Pf.onKeyDown(d)(e)},onKeyUp:e=>{var t;null===(t=null==D?void 0:D.onKeyUp)||void 0===t||t.call(D,e)},onFocus:e=>{var t;null===(t=null==D?void 0:D.onFocus)||void 0===t||t.call(D,e)},onMouseDown:e=>{var t,n;(null===(t=d.selection)||void 0===t?void 0:t[0])!==f.meta.order&&d.setSelection([f.meta.order]),null===(n=null==D?void 0:D.onMouseDown)||void 0===n||n.call(D,e)},onBlur:e=>{var t;e.preventDefault(),null===(t=null==D?void 0:D.onBlur)||void 0===t||t.call(D,e)},customEditor:r})}))}))},Lf=h((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:a,eventHandlers:u,onKeyDown:s,onKeyUp:l,onFocus:c,onMouseDown:d,onBlur:f,customEditor:h,decorate:p})=>e(Ml,Object.assign({editor:n,initialValue:r,onChange:o},{children:e(Fl,Object.assign({renderElement:a,renderLeaf:i,className:"focus-visible:outline-none focus:outline-none",spellCheck:!0},u,{onKeyDown:s,onKeyUp:l,onFocus:c,onMouseDown:d,decorate:p,onBlur:f}),`editable-${t}`)}),`slate-${t}`)));Lf.displayName="SlateEditorInstance";const If=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c((()=>[...t].filter((e=>null!=e))),[...t])}(Be(pt,{activationConstraint:{delay:100,tolerance:0}}),Be(lt,{coordinateGetter:Dn})),handleDragEnd:d((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:d((t=>{e.setBlockSelected(null)}),[])}),zf=[],Wf=({editor:t,marks:n})=>{const{sensors:r,handleDragEnd:o,handleDragStart:i}=If({editor:t}),a=Object.keys(t.children),u=c((()=>0===a.length?zf:a.sort(((e,n)=>t.children[e].meta.order-t.children[n].meta.order))),[a]),s=[];for(let r=0;r<u.length;r++){const o=u[r],i=t.children[o],a=t.plugins[i.type];i&&a?s.push(e(Af,Object.assign({block:i,blockId:o},{children:e(Mf,{type:i.type,id:o,marks:n,events:a.events,elements:a.elements,options:a.options},o)}),o)):console.error(`Plugin ${i.type} not found`)}return e(Kt,Object.assign({sensors:r,collisionDetection:je,onDragStart:i,onDragEnd:o},{children:e(sn,Object.assign({items:u,strategy:on},{children:s}))}))},Vf=({editor:e,yooptaEditorRef:t,root:n})=>{const[r,o]=f({origin:[0,0],coords:[0,0],selection:!1}),i=n=>{var i;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),s();a||o({origin:[n.pageX,n.pageY-window.pageYOffset],coords:[n.pageX,n.pageY-window.pageYOffset],selection:!0})},a=t=>{if(!r.selection)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]),u=Math.min(e[0],t[0]),s=Math.max(e[1],t[1]),l=Math.max(e[0],t[0]);a<i.bottom&&s>i.top&&u<i.right&&l>i.left&&n.push(o)})),n})(r.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(n,{only:!0})},u=()=>{s()};l((()=>{var e;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===(e=t.current)||void 0===e?void 0:e.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",a),r.addEventListener("mouseup",u),()=>{r.removeEventListener("mousedown",i),r.removeEventListener("mousemove",a),r.removeEventListener("mouseup",u)}}),[e.selectedBlocks,r,n]);const s=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},r),{onClose:s})},qf=({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})},Uf={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Hf=({marks:n,className:r,autoFocus:o=!0,selectionBoxRoot:i})=>{const a=k(),s=u(null),c=Vf({editor:a,yooptaEditorRef:s,root:i});let d=u(Uf).current;console.log("editor.children",a.children),l((()=>{if(!o)return;const e=A(a,{at:[0]});e&&a.focusBlock(e.id,{waitExecution:!0})}),[o]),l((()=>(document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p))),[a.selectedBlocks]);const f=()=>{Array.isArray(a.selectedBlocks)&&a.selectedBlocks.length>0&&a.setBlockSelected(null)},h=()=>{d.indexToSelect=null,d.startedIndexToSelect=null,d.selectionStarted=!1},p=e=>{var t,n,r,o,i;if(jf.isSelect(e)){if((null===(t=a.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(a.children).length)return void e.preventDefault();if(d.selectionStarted)return e.preventDefault(),void a.setBlockSelected([],{allSelected:!0})}if(jf.isBackspace(e)){e.stopPropagation();if(Array.isArray(a.selectedBlocks)&&(null===(n=a.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(a.children).length)return e.preventDefault(),a.deleteBlock({deleteAll:!0}),a.setBlockSelected(null),void h();if(Array.isArray(a.selectedBlocks)&&(null===(r=a.selectedBlocks)||void 0===r?void 0:r.length)>0)return e.preventDefault(),a.deleteBlock({fromPaths:a.selectedBlocks}),a.setBlockSelected(null),void h()}if(jf.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(d.selectionStarted&&null!==d.startedIndexToSelect&&null!==d.indexToSelect){const e=d.indexToSelect,t=e-1;if(0===e)return;if(e===d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if(t<d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if((null===(o=a.selectedBlocks)||void 0===o?void 0:o.includes(e))&&e!==d.startedIndexToSelect){const n=a.selectedBlocks.filter((t=>t!==e));return a.setBlockSelected(n,{only:!0}),void(d.indexToSelect=t)}return}const t=A(a),n=xn(a);if(!n||!n.selection||!t)return;const r=ko.parent(n.selection.anchor.path),i=Qo.isStart(n,n.selection.focus,r);if(Vo.isExpanded(n.selection)&&i){const r=a.selection?[a.selection[0]-1]:[0],o=A(a,{at:r});t&&o&&(e.preventDefault(),Bs.blur(n),Bs.deselect(n),qi.deselect(n),a.setSelection(null),a.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)-1]),d.startedIndexToSelect=t.meta.order,d.indexToSelect=t.meta.order-1,d.selectionStarted=!0)}}if(jf.isShiftArrowDown(e)){if(d.selectionStarted&&null!==d.indexToSelect&&null!==d.startedIndexToSelect){const e=d.indexToSelect,t=e+1;if(t===Object.keys(a.children).length)return;if(e===d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if(t>d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if((null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==d.startedIndexToSelect){const n=a.selectedBlocks.filter((t=>t!==e));return a.setBlockSelected(n,{only:!0}),void(d.indexToSelect=t)}return}const t=A(a),n=xn(a);if(!n||!n.selection||!t)return;const r=ko.parent(n.selection.anchor.path),o=Qo.isEnd(n,n.selection.focus,r);if(Vo.isExpanded(n.selection)&&o){const r=a.selection?[a.selection[0]+1]:[0],o=A(a,{at:r});t&&o&&(e.preventDefault(),Bs.blur(n),Bs.deselect(n),qi.deselect(n),a.setSelection(null),a.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),d.startedIndexToSelect=t.meta.order,d.indexToSelect=t.meta.order+1,d.selectionStarted=!0)}}},v=(g={userSelect:c.selection?"none":"auto",pointerEvents:c.selection?"none":"auto"},Object.assign({paddingBottom:150},g));var g;return t("div",Object.assign({id:"yoopta-editor",className:r,style:v,ref:s,onClick:e=>{h(),(e=>{var t;const n=s.current;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10);if(e.clientY>=o){const e=Object.keys(a.children).length-1,n=A(a,{at:[e]}),r=xn(a,{at:[e]});if(n&&r&&r.selection){const e=Qo.string(r,r.selection.anchor.path),o=ko.parent(r.selection.anchor.path),[i]=Qo.node(r,o);if(Uo.isElement(i)&&"void"!==(null===(t=i.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void a.focusBlock(n.id,{slate:r})}const o=q({id:W()}),i=e+1;a.insertBlock(o,{at:[i],focus:!0})}})(e),f()},onBlur:e=>{var t;(null===(t=s.current)||void 0===t?void 0:t.contains(e.relatedTarget))||(h(),f())}},{children:[e(Wf,{editor:a,marks:n}),e(qf,{origin:c.origin,coords:c.coords,isOpen:c.selection})]}))},Kf=({children:e,fallback:t=null})=>{const[n,r]=f(!1);return l((()=>r(!0)),[]),n?e:t};var $f={isHistory:e=>xr(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||Jo.isOperationList(e.redos[0]))&&(0===e.undos.length||Jo.isOperationList(e.undos[0]))},Xf=new WeakMap,Yf=new WeakMap,Zf={isHistoryEditor:e=>$f.isHistory(e.history)&&Qo.isEditor(e),isMerging:e=>Yf.get(e),isSaving:e=>Xf.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Zf.isMerging(e);Yf.set(e,!1),t(),Yf.set(e,n)},withoutSaving(e,t){var n=Zf.isSaving(e);Xf.set(e,!1),t(),Xf.set(e,n)}},Jf=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];Zf.withoutSaving(t,(()=>{Qo.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];Zf.withoutSaving(t,(()=>{Qo.withoutNormalizing(t,(()=>{var e=r.map(Jo.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],u=a&&a[a.length-1],s=eh(e,u),l=Zf.isSaving(t),c=Zf.isMerging(t);if(null==l&&(l=Qf(e)),l){if(null==c&&(c=null!=a&&(0!==r.length||(Gf(e,u)||s))),a&&c)s&&a.pop(),a.push(e);else{var d=[e];i.push(d)}for(;i.length>100;)i.shift();th(e)&&(o.redos=[])}n(e)},t},Gf=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!ko.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!ko.equals(e.path,t.path))),Qf=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,eh=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),th=e=>"set_selection"!==e.type;function nh(e,t){const n=xn(e);if(!n)return!1;const r=Qo.marks(n);return!!(null==r?void 0:r[t])}const rh=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&Vo.isCollapsed(i)){const{anchor:a}=i,u=Qo.above(t,{match:e=>Uo.isElement(e)&&Qo.isBlock(t,e),mode:"lowest"});if(!u)return;const[,s]=u,l=Qo.parent(t,s),[c]=l;if(Uo.isElement(c)&&!di.isText(c.children[0]))return n(r);const d=u?s:[],f={anchor:a,focus:Qo.start(t,d)},h=Qo.string(t,f),p=null===(o=e.shortcuts)||void 0===o?void 0:o[h];if(!!p&&!p.isActive())return qi.select(t,f),qi.delete(t),void p.create({deleteText:!1})}n(r)},t};function oh(e,t,n){e.children=mo(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=Do(e.children),e.emit("change",e.children),r&&e.applyChanges()}function ih(e,t,n){e.children=mo(e.children);const r=A(e,{at:e.selection});if(!r)throw new Error("Block from not found at current selection");const o=df(e.blocks[r.type].elements);if(r.type===t)return void(e.children=Do(e.children));const i=xn(e,{at:[r.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${r.meta.order}`);const a=df(e.blocks[t].elements);Qo.withoutNormalizing(i,(()=>{const n=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=>!Qo.isEditor(e)&&Uo.isElement(e);o&&(a=e=>!Qo.isEditor(e)&&Uo.isElement(e)&&e.type===o);const u=ko.parent(i),s=Qo.nodes(e,{at:u,match:a,mode:"lowest"});if(s){const[e]=s;return e}}(i,{elementType:o});console.log({fromBlockRootElementType:o,node:n}),qi.setNodes(i,{type:a},{at:[0],mode:"lowest",match:e=>Uo.isElement(e)&&!Qo.isInline(i,e)});const u={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]=u,e.children=Do(e.children),e.applyChanges()}))}function ah(e,t={}){const{at:n=e.selection,deleteAll:r=!1,fromPaths:o,focus:i}=t;if(console.log("BEFORE options.focusAt",t.focusAt),Array.isArray(o)&&o.length>0){e.children=mo(e.children),o.forEach((t=>{const n=A(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=Do(e.children),void e.applyChanges()}if(r||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=q({id:W()}),n=Jf(rh(e,Vl(Ca())));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}),void e.applyChanges()}if(!n)return;e.children=mo(e.children);const[a]=n,u=Object.keys(e.children),s=u.find((t=>e.children[t].meta.order===a));if(u.forEach((t=>{const n=e.children[t];n.meta.order>a&&(n.meta.order-=1)})),s&&(delete e.children[s],delete e.blockEditorsMap[s]),e.children=Do(e.children),e.applyChanges(),i){const n=e.selection?e.selection[0]-1:0,r=A(e,{at:[n]});r&&e.focusBlock(r.id,{focusAt:t.focusAt})}}function uh(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=xn(e);if(!n)return null;const r=Qo.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>nh(e,r),toggle:()=>function(e,t){const n=xn(e),r=nh(e,t);n&&(r?Qo.removeMark(n,t):Qo.addMark(n,t,!0),e.applyChanges())}(e,r),update:t=>function(e,t,n){const r=xn(e);console.log("update editor.selection",e.selection),console.log("text format slate.selection",r),r&&r.selection&&Vo.isExpanded(r.selection)&&(Qo.addMark(r,t,n),e.applyChanges())}(e,r,t)}})),n}function sh(e,t){const n={};return t.forEach(((t,r)=>{var o;const i=ff(t.elements),a=null===(o=null==i?void 0:i.props)||void 0===o?void 0:o.nodeType;if(!("inline"===a||"inlineVoid"===a)){const o={};Object.keys(t.elements).forEach((e=>{const n=xf(t.elements[e],["render"]);o[e]=n}));const{displayLabel:i,placeholder:a,align:u,shortcuts:s}=t.options||{};n[t.type]={type:t.type,elements:o,order:r,options:{displayLabel:i,placeholder:a,align:u,shortcuts:s},isActive:()=>{const n=A(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:(t,n)=>{ih(e,t)},create:n=>{!function(e,t,n){var r;e.children=mo(e.children);const o=A(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)||xn(e,{at:[null==o?void 0:o.meta.order]});if(!i||!i.selection)return;const a=e.blocks[t],u=df(a.elements),s=a.elements[u];if(!s)return;const l=Object.assign({nodeType:(null===(r=s.props)||void 0===r?void 0:r.nodeType)||"block"},s.props),c=V({id:W(),type:u,props:l});qi.setNodes(i,c,{at:[0,0],match:e=>Uo.isElement(e),mode:"highest"}),(null==n?void 0:n.deleteText)&&qi.delete(i,{at:[0,0]});const d=q({id:o.id,type:a.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[c]}),f=d.id;e.children[f]=d,e.blockEditorsMap[f]=i,e.children=Do(e.children),e.applyChanges(),(null==n?void 0:n.focus)&&e.focusBlock(f,{slate:i,waitExecution:!0})}(e,t.type,n)},update:(t,n)=>{oh(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=xn(e,{at:[o.meta.order]});i?Qo.withoutNormalizing(i,(()=>{const[t]=Qo.nodes(i,{at:[0],match:e=>Uo.isElement(e)&&e.type===n}),o=null==t?void 0:t[0],a=(null==o?void 0:o.props)||{},u={props:Object.assign(Object.assign({},a),r)};console.log("updatedNode",u),qi.setNodes(i,u,{at:[0],match:e=>Uo.isElement(e)&&e.type===n,mode:"lowest"}),e.applyChanges()})):console.warn("No slate found")}(e,t,n,r)},delete:t=>{ah(e,t)}}}})),n}function lh(e){return Jf(rh(e,Vl(Ca())))}const ch=(()=>{const e=W();return{[e]:q({id:e})}})(),dh=new M,fh=(e,t)=>dh.on(e,t),hh=(e,t)=>dh.once(e,t),ph=(e,t)=>dh.off(e,t),vh=(e,t)=>dh.emit(e,t);const gh=({editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:u,tools:s,selectionBoxRoot:l,children:d})=>{const h=()=>{g((e=>Object.assign(Object.assign({},e),{version:e.version+1}))),n.emit("change",n.children)},p=c((()=>i.map((e=>e.getPlugin))),[i]),[v,g]=f((()=>(n.applyChanges=h,o&&(n.formats=uh(n,o)),n.blocks=sh(n,p),n.children=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r)?r:ch,n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=lh(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}(p),n.on=fh,n.once=hh,n.off=ph,n.emit=vh,{editor:n,version:0})));return e(Kf,{children:e(O,Object.assign({editorState:v},{children:t(pf,Object.assign({tools:s},{children:[e(Hf,{marks:o,autoFocus:a,className:u,selectionBoxRoot:l}),d]}))}))})},mh=Object.assign(Object.assign({},yf),{ExtendedBlockActions:({className:r,style:o,onClick:i,children:a})=>{const[u,s]=f(!1),{refs:l,floatingStyles:c,context:d}=Ud({placement:"bottom-start",open:u,onOpenChange:s,middleware:[Xc(),$c(),Kc(),kc(10)],whileElementsMounted:Hc}),{isMounted:h,styles:p}=Xd(d,{duration:100}),v=Object.assign(Object.assign({},p),c);return t(n,{children:[h&&e(bf,Object.assign({isOpen:!0,onClose:()=>s(!1),refs:l,style:v},{children:a})),e("button",Object.assign({type:"button",ref:l.setReference,className:`absolute right-[10px] top-[10px] 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}`,onClick:()=>{null==i||i(),s(!0)},style:o},{children:e(nf,{})}))]})}});function Dh(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 bh(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:a=!0}=n,u=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;const u=function(e,t){if(ri.isPoint(t))return t;if(ko.isPath(t))return{path:t,offset:0};const[,n]=Qo.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);qi.select(o,u),Bs.focus(o),a&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};o?setTimeout((()=>u()),i):u()}function yh(e){return Array.from(new Set(e))}var Ch={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",u="[object Function]",s="[object GeneratorFunction]",l="[object Map]",c="[object Number]",d="[object Object]",f="[object Promise]",h="[object RegExp]",p="[object Set]",v="[object String]",g="[object Symbol]",m="[object WeakMap]",D="[object ArrayBuffer]",b="[object DataView]",y="[object Float32Array]",C="[object Float64Array]",w="[object Int8Array]",B="[object Int16Array]",E="[object Int32Array]",A="[object Uint8Array]",x="[object Uint8ClampedArray]",F="[object Uint16Array]",O="[object Uint32Array]",k=/\w*$/,S=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,P={};P[o]=P["[object Array]"]=P[D]=P[b]=P[i]=P[a]=P[y]=P[C]=P[w]=P[B]=P[E]=P[l]=P[c]=P[d]=P[h]=P[p]=P[v]=P[g]=P[A]=P[x]=P[F]=P[O]=!0,P["[object Error]"]=P[u]=P[m]=!1;var R="object"==typeof N&&N&&N.Object===Object&&N,T="object"==typeof self&&self&&self.Object===Object&&self,_=R||T||Function("return this")(),M=t&&!t.nodeType&&t,L=M&&e&&!e.nodeType&&e,I=L&&L.exports===M;function z(e,t){return e.set(t[0],t[1]),e}function W(e,t){return e.add(t),e}function V(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 q(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function U(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function H(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,Y=Function.prototype,Z=Object.prototype,J=_["__core-js_shared__"],G=($=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",Q=Y.toString,ee=Z.hasOwnProperty,te=Z.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=I?_.Buffer:void 0,oe=_.Symbol,ie=_.Uint8Array,ae=H(Object.getPrototypeOf,Object),ue=Object.create,se=Z.propertyIsEnumerable,le=X.splice,ce=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,fe=H(Object.keys,Object),he=Le(_,"DataView"),pe=Le(_,"Map"),ve=Le(_,"Promise"),ge=Le(_,"Set"),me=Le(_,"WeakMap"),De=Le(Object,"create"),be=qe(he),ye=qe(pe),Ce=qe(ve),we=qe(ge),Be=qe(me),Ee=oe?oe.prototype:void 0,Ae=Ee?Ee.valueOf:void 0;function xe(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 Fe(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 Oe(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 ke(e){this.__data__=new Fe(e)}function Se(e,t){var n=He(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ke(e)}(e)&&ee.call(e,"callee")&&(!se.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||We(a,r))||n.push(a);return n}function je(e,t,n){var r=e[t];ee.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Pe(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Re(e,t,n,r,f,m,S){var j;if(r&&(j=m?r(e,f,m,S):r(e)),void 0!==j)return j;if(!Ye(e))return e;var R=He(e);if(R){if(j=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,j)}else{var T=ze(e),N=T==u||T==s;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(T==d||T==o||N&&!m){if(q(e))return m?e:{};if(j=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ae(e),Ye(t)?ue(t):{});var t}(N?{}:e),!t)return function(e,t){return _e(e,Ie(e),t)}(e,function(e,t){return e&&_e(t,Ze(t),e)}(j,e))}else{if(!P[T])return m?e:{};j=function(e,t,n,r){var o=e.constructor;switch(t){case D:return Ne(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case y:case C:case w:case B:case E:case A:case x:case F:case O:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case l:return function(e,t,n){var r=t?n(U(e),!0):U(e);return V(r,z,new e.constructor)}(e,r,n);case c:case v:return new o(e);case h:return function(e){var t=new e.constructor(e.source,k.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(K(e),!0):K(e);return V(r,W,new e.constructor)}(e,r,n);case g:return u=e,Ae?Object(Ae.call(u)):{}}var u}(e,T,Re,t)}}S||(S=new ke);var _=S.get(e);if(_)return _;if(S.set(e,j),!R)var M=n?function(e){return function(e,t,n){var r=t(e);return He(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,Ie)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(M||e,(function(o,i){M&&(o=e[i=o]),je(j,i,Re(o,t,n,r,i,e,S))})),j}function Te(e){return!(!Ye(e)||(t=e,G&&G in t))&&(Xe(e)||q(e)?ne:S).test(qe(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function _e(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],u=r?r(n[a],e[a],a,n,e):void 0;je(n,a,void 0===u?e[a]:u)}return n}function Me(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 Le(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}xe.prototype.clear=function(){this.__data__=De?De(null):{}},xe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},xe.prototype.get=function(e){var t=this.__data__;if(De){var r=t[e];return r===n?void 0:r}return ee.call(t,e)?t[e]:void 0},xe.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:ee.call(t,e)},xe.prototype.set=function(e,t){return this.__data__[e]=De&&void 0===t?n:t,this},Fe.prototype.clear=function(){this.__data__=[]},Fe.prototype.delete=function(e){var t=this.__data__,n=Pe(t,e);return!(n<0)&&(n==t.length-1?t.pop():le.call(t,n,1),!0)},Fe.prototype.get=function(e){var t=this.__data__,n=Pe(t,e);return n<0?void 0:t[n][1]},Fe.prototype.has=function(e){return Pe(this.__data__,e)>-1},Fe.prototype.set=function(e,t){var n=this.__data__,r=Pe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new xe,map:new(pe||Fe),string:new xe}},Oe.prototype.delete=function(e){return Me(this,e).delete(e)},Oe.prototype.get=function(e){return Me(this,e).get(e)},Oe.prototype.has=function(e){return Me(this,e).has(e)},Oe.prototype.set=function(e,t){return Me(this,e).set(e,t),this},ke.prototype.clear=function(){this.__data__=new Fe},ke.prototype.delete=function(e){return this.__data__.delete(e)},ke.prototype.get=function(e){return this.__data__.get(e)},ke.prototype.has=function(e){return this.__data__.has(e)},ke.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Fe){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Oe(r)}return n.set(e,t),this};var Ie=ce?H(ce,Object):function(){return[]},ze=function(e){return te.call(e)};function We(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||j.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}function qe(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(he&&ze(new he(new ArrayBuffer(1)))!=b||pe&&ze(new pe)!=l||ve&&ze(ve.resolve())!=f||ge&&ze(new ge)!=p||me&&ze(new me)!=m)&&(ze=function(e){var t=te.call(e),n=t==d?e.constructor:void 0,r=n?qe(n):void 0;if(r)switch(r){case be:return b;case ye:return l;case Ce:return f;case we:return p;case Be:return m}return t});var He=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Xe(e)}var $e=de||function(){return!1};function Xe(e){var t=Ye(e)?te.call(e):"";return t==u||t==s}function Ye(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return Ke(e)?Se(e):function(e){if(!Ve(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 Re(e,!0,!0)}}({get exports(){return Ch},set exports(e){Ch=e}},Ch);var wh=Ch;function Bh(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=A(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=mo(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):wh(a));var a;const u=lh(e);i.id=W(),i.meta.order=o.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=u;const s=i.id;e.children=Do(e.children),e.applyChanges(),r&&e.focusBlock(s,{waitExecution:!0})}function Eh(e,t){Bs.blur(t),Bs.deselect(t),qi.deselect(t),e.setBlockSelected(null),e.setSelection(null)}const Ah=()=>{const e={children:{},selection:null,selectedBlocks:null,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),applyChanges:()=>{},insertBlock:(...t)=>function(e,t,n={}){e.children=mo(e.children);const{at:r=null,focus:o=!1,slate:i=null}=n,a=A(e),u=r,s={id:W(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let l=!1;if(i&&i.selection){const e=Qo.string(i,i.selection.anchor.path);l=Qo.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(u){const[t]=u;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),s.meta.order=t}else{const t=Object.keys(e.children).length;s.meta.order=t}const c=lh(e);e.blockEditorsMap[s.id]=c,l&&a&&(s.meta.order=a.meta.order,a.meta.order+=1),e.children[s.id]=s;const d=null==a?void 0:a.id;e.children=Do(e.children),e.applyChanges(),o&&e.focusBlock(l&&d?d:s.id)}(e,...t),deleteBlock:(...t)=>ah(e,...t),duplicateBlock:(...t)=>Bh(e,...t),toggleBlock:(...t)=>ih(e,...t),increaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=mo(e.children);const r=A(e);r&&(r.meta.depth=r.meta.depth+1,e.children=Do(e.children),e.applyChanges())}(e,...t),decreaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=mo(e.children);const r=A(e);r&&(r.meta.depth=0===r.meta.depth?0:r.meta.depth-1,e.children=Do(e.children),e.applyChanges())}(e,...t),moveBlock:(...t)=>function(e,t,n){e.children=mo(e.children);const[r]=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));console.log("blockInNewPosition meta",Object.assign({},i).meta.depth);const a=o.meta.order<i.meta.order,u=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--:u&&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=Do(e.children),e.applyChanges()}(e,...t),focusBlock:(...t)=>bh(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>oh(e,...t),splitBlock:(...t)=>function(e,t={}){const{slate:n,focus:r=!0}=t,o=A(e);n&&n.selection&&o&&Qo.withoutNormalizing(n,(()=>{e.children=mo(e.children);const t=ko.parent(n.selection.anchor.path);qi.splitNodes(n,{at:n.selection,match:e=>Uo.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,a=n.children.slice()[i];qi.removeNodes(n,{at:[i],match:e=>Uo.isElement(e),mode:"highest"});const u={id:W(),type:o.type,meta:{order:o.meta.order+1,depth:o.meta.depth},value:[a]};Object.values(e.children).forEach((e=>{e.meta.order>=u.meta.order&&(e.meta.order+=1)}));const s=lh(e);e.blockEditorsMap[u.id]=s,e.children[u.id]=u,e.children=Do(e.children),e.applyChanges(),r&&e.focusBlock(u.id,{slate:s})}))}(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(r)e.selectedBlocks=t;else if(o){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=yh(t)}else e.selectedBlocks=yh(i.concat(t));e.applyChanges()}(e,...t),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:xn(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Eh(e,r)),i):(Eh(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};function xh({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}Cf('/*! 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-\\[10px\\]{right:10px}.top-0{top:0}.top-\\[10px\\]{top:10px}.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%}.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{jf as HOTKEYS,mh as UI,E as YooptaPlugin,q as buildBlockData,V as buildBlockElement,Ah as createYooptaEditor,xh as createYooptaMark,gh as default,A as findPluginBlockBySelectionPath,Dh as findPluginBlockByType,xn as findSlateBySelectionPath,W as generateId,ff as getRootBlockElement,df as getRootBlockElementType,S as useBlockData,T as useBlockSelected,j as useYooptaBlock,k as useYooptaEditor,P as useYooptaPlugin,R as useYooptaPluginOptions,vf as useYooptaTools};
|
|
12
|
+
var td=["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(","),nd="undefined"==typeof Element,rd=nd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,od=!nd&&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},id=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)},ad=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!id(a,!1))if("SLOT"===a.tagName){var u=a.assignedElements(),s=e(u.length?u:a.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:a,candidates:s})}else{rd.call(a,td)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var l=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),c=!id(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(l&&c){var d=e(!0===l?a.children:l.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:a,candidates:d})}else i.unshift.apply(i,a.children)}}return o},ud=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},sd=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))&&!ud(e)?0:e.tabIndex},ld=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},cd=function(e){return"INPUT"===e.tagName},dd=function(e){return function(e){return cd(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||od(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)},fd=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},hd=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=rd.call(e,"details>summary:first-of-type")?e.parentElement:e;if(rd.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return fd(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,u=od(e);if(a&&!a.shadowRoot&&!0===r(a))return fd(e);e=e.assignedSlot?e.assignedSlot:a||u===e.ownerDocument?a:u.host}e=i}if(function(e){var t,n,r,o,i=e&&od(e),a=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(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));!u&&a;){var s,l,c;u=!(null===(l=a=null===(s=i=od(a))||void 0===s?void 0:s.host)||void 0===l||null===(c=l.ownerDocument)||void 0===c||!c.contains(a))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},pd=function(e,t){return!(t.disabled||id(t)||function(e){return cd(e)&&"hidden"===e.type}(t)||hd(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!!rd.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},vd=function(e,t){return!(dd(t)||sd(t)<0||!pd(e,t))},gd=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},md=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,u=function(e,t){var n=sd(e);return n<0&&t&&!ud(e)?0:n}(a,i),s=i?e(t.candidates):a;0===u?i?n.push.apply(n,s):n.push(a):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:s})})),r.sort(ld).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Dd=function(e,t){var n;return n=(t=t||{}).getShadowRoot?ad([e],t.includeContainer,{filter:vd.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:gd}):function(e,t,n){if(id(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(td));return t&&rd.call(e,td)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,vd.bind(null,t)),md(n)};const bd=r["useInsertionEffect".toString()]||(e=>e());var yd="undefined"!=typeof document?s:l;function Cd(){return Cd=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},Cd.apply(this,arguments)}let wd=!1,Bd=0;const Ed=()=>"floating-ui-"+Bd++;const Ad=r["useId".toString()]||function(){const[e,t]=r.useState((()=>wd?Ed():void 0));return yd((()=>{null==e&&t(Ed())}),[]),r.useEffect((()=>{wd||(wd=!0)}),[]),e};const xd=r.createContext(null),Fd=r.createContext(null);function Od(e){return"data-floating-ui-"+e}function kd(e){const t=u(e);return yd((()=>{t.current=e})),t}const Sd=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function jd(e,t){const n=Dd(e,Sd());"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}(function(e){return(null==e?void 0:e.ownerDocument)||document}(e)));return n.slice(r+1)[0]}function Pd(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&&Zl(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function Rd(e){Dd(e,Sd()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Td(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 Nd={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 _d(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Md=r.forwardRef((function(e,t){const[n,o]=r.useState();yd((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",_d),()=>{document.removeEventListener("keydown",_d)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Od("focus-guard")]:"",style:Nd};return r.createElement("span",Cd({},e,i))})),Ld=r.createContext(null),Id=Od("portal");function zd(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=Ad(),u=Wd(),s=r.useRef(null);return yd((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),yd((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=a,n.setAttribute(Id,""),e.appendChild(n),s.current=n,i(n)}),[t,a]),yd((()=>{if(s.current)return;let e=n||(null==u?void 0:u.portalNode);e&&!Xl(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(Id,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,a,u]),o}({id:n,root:o}),[u,s]=r.useState(null),l=r.useRef(null),c=r.useRef(null),d=r.useRef(null),f=r.useRef(null),h=!!u&&!u.modal&&u.open&&i&&!(!o&&!a);return r.useEffect((()=>{if(a&&i&&(null==u||!u.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&&Pd(e)){("focusin"===e.type?Td:Rd)(a)}}}),[a,i,null==u?void 0:u.modal]),r.createElement(Ld.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:c,beforeInsideRef:d,afterInsideRef:f,portalNode:a,setFocusManagerState:s})),[i,a])},h&&a&&r.createElement(Md,{"data-type":"outside",ref:l,onFocus:e=>{if(Pd(e,a)){var t;null==(t=d.current)||t.focus()}else{const e=jd(document.body,"prev")||(null==u?void 0:u.refs.domReference.current);null==e||e.focus()}}}),h&&a&&r.createElement("span",{"aria-owns":a.id,style:Nd}),a&&B(t,a),h&&a&&r.createElement(Md,{"data-type":"outside",ref:c,onFocus:e=>{if(Pd(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=jd(document.body,"next")||(null==u?void 0:u.refs.domReference.current);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent))}}}))}const Wd=()=>r.useContext(Ld),Vd=new Set,qd=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=Ad();return yd((()=>{if(!n)return;Vd.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,u=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,l;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(l=window.visualViewport)?void 0:l.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(u-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Vd.delete(i),0===Vd.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,u)))}}),[i,n]),r.createElement("div",Cd({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Ud(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[a,u]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||a,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:u}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=r.useState(o);Jc(h,o)||p(o);const[v,g]=r.useState(null),[m,D]=r.useState(null),b=r.useCallback((e=>{e!==E.current&&(E.current=e,g(e))}),[]),C=r.useCallback((e=>{e!==A.current&&(A.current=e,D(e))}),[]),w=a||v,B=u||m,E=r.useRef(null),A=r.useRef(null),x=r.useRef(d),F=null!=l,O=ed(l),k=ed(i),S=r.useCallback((()=>{if(!E.current||!A.current)return;const e={placement:t,strategy:n,middleware:h};k.current&&(e.platform=k.current),Yc(E.current,A.current,e).then((e=>{const t={...e,isPositioned:!0};j.current&&!Jc(x.current,t)&&(x.current=t,y.flushSync((()=>{f(t)})))}))}),[h,t,n,k]);Zc((()=>{!1===c&&x.current.isPositioned&&(x.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[c]);const j=r.useRef(!1);Zc((()=>(j.current=!0,()=>{j.current=!1})),[]),Zc((()=>{if(w&&(E.current=w),B&&(A.current=B),w&&B){if(O.current)return O.current(w,B,S);S()}}),[w,B,S,O,F]);const P=r.useMemo((()=>({reference:E,floating:A,setReference:b,setFloating:C})),[b,C]),R=r.useMemo((()=>({reference:w,floating:B})),[w,B]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!R.floating)return e;const t=Qc(R.floating,d.x),r=Qc(R.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Gc(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,R.floating,d.x,d.y]);return r.useMemo((()=>({...d,update:S,refs:P,elements:R,floatingStyles:T})),[d,S,P,R,T])}(e),c=r.useContext(Fd),d=null!=((null==(f=r.useContext(xd))?void 0:f.id)||null);var f;const h=function(e){const t=r.useRef((()=>{}));return bd((()=>{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&&(v.current.openEvent=t),g.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==o||o(e,t,n)})),p=r.useRef(null),v=r.useRef({}),g=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=Ad(),D=r.useCallback((e=>{const t=Xl(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),b=r.useCallback((e=>{(Xl(e)||null===e)&&(p.current=e,u(e)),(Xl(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Xl(e))&&l.refs.setReference(e)}),[l.refs]),C=r.useMemo((()=>({...l.refs,setReference:b,setPositionReference:D,domReference:p})),[l.refs,b,D]),w=r.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),B=r.useMemo((()=>({...l,refs:C,elements:w,dataRef:v,nodeId:i,floatingId:m,events:g,open:n,onOpenChange:h})),[l,i,m,g,n,h,C,w]);return yd((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===i));e&&(e.context=B)})),r.useMemo((()=>({...l,context:B,refs:C,elements:w})),[l,C,w,B])}const Hd=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Kd(e,t){return"function"==typeof e?e(t):e}function $d(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,[u,s]=r.useState(!1),[l,c]=r.useState("unmounted"),d=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 yd((()=>{u&&!d&&c("unmounted")}),[u,d]),yd((()=>{if(o){if(n){c("initial");const e=requestAnimationFrame((()=>{c("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),c("close")}}),[n,o]),{isMounted:d,status:l}}function Xd(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:a,duration:u=250}=t,s=e.placement,l=s.split("-")[0],c=r.useMemo((()=>({side:l,placement:s})),[l,s]),d="number"==typeof u,f=(d?u:u.open)||0,h=(d?u:u.close)||0,[p,v]=r.useState((()=>({...Kd(a,c),...Kd(n,c)}))),{isMounted:g,status:m}=$d(e,{duration:u}),D=kd(n),b=kd(o),y=kd(i),C=kd(a);return yd((()=>{const e=Kd(D.current,c),t=Kd(y.current,c),n=Kd(C.current,c),r=Kd(b.current,c)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&v((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&v({transitionProperty:Object.keys(r).map(Hd).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;v({transitionProperty:Object.keys(r).map(Hd).join(","),transitionDuration:h+"ms",...n,...r})}}),[h,y,D,b,C,f,m,c]),{isMounted:g,styles:p}}var Yd;function Zd(){return Zd=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},Zd.apply(this,arguments)}var Jd=function(e){return r.createElement("svg",Zd({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Yd||(Yd=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 Gd(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 Qd=["color"],ef=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,Qd);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),tf=["color"],nf=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,tf);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),rf=["color"],of=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,rf);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),af=["color"],uf=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Gd(e,af);return m("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),m("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"}))})),sf=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()}},lf={"text/plain":"Text","text/html":"Url",default:"Text"};var cf=function(e,t){var n,r,o,i,a,u,s=!1;t||(t={}),n=t.debug||!1;try{if(o=sf(),i=document.createRange(),a=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.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=lf[t.format]||lf.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(u),i.selectNodeContents(u),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),u&&document.body.removeChild(u),o()}return s};function df(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ff(e){if(!e)return;const t=df(e);return t?e[t]:void 0}const hf=i(void 0),pf=({children:r,tools:o})=>{const i=c((()=>o?Object.keys(o).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:o[t].render})),{}):{}),[o]);return e(hf.Provider,Object.assign({value:i},{children:t(n,{children:[o&&Object.keys(o).map((t=>{const n=o[t].tool;return e(n,{},t)})),r]})}))},vf=()=>{const e=a(hf);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e},gf=({children:t})=>e("div",Object.assign({className:"flex flex-col"},{children:t})),mf=({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})),Df=({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})),bf=({isOpen:n,onClose:r,refs:o,style:i,children:a})=>{var u;const s=k(),l=vf(),[c,d]=f(!1),{refs:h,floatingStyles:p,context:v}=Ud({placement:"right",open:c,onOpenChange:d,middleware:[Xc(),$c(),Kc(),kc(10)],whileElementsMounted:Hc}),{isMounted:g,styles:m}=Xd(v,{duration:100});if(!n)return null;const D=A(s,{at:s.selection}),b=ff(s.blocks[(null==D?void 0:D.type)||""].elements),y="void"===(null===(u=null==b?void 0:b.props)||void 0===u?void 0:u.nodeType),C=l.ActionMenu,w=Object.assign(Object.assign({},p),m);return e(zd,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(qd,Object.assign({lockScroll:!0,className:"z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating},{children:t(mf,{children:[t(gf,{children:[e(Df,{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(uf,{className:"w-4 h-4 mr-2"}),"Delete"]}))}),e(Df,{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(ef,{className:"w-4 h-4 mr-2"}),"Duplicate"]}))}),!y&&t(Df,{children:[g&&!!C&&e(zd,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(qd,Object.assign({lockScroll:!0,className:"z-[100]",onClick:()=>d(!1)},{children:e("div",Object.assign({style:w,ref:h.setFloating},{children:e(C,{actions:Object.keys(s.blocks),editor:s,selectedAction:"",onClose:()=>d(!1),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:()=>d((e=>!e))},{children:[e(Jd,{className:"w-4 h-4 mr-2"}),"Turn into"]}))]}),e(Df,{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=A(s);e&&cf(`${window.location.origin}${window.location.pathname}#${e.id}`),r()}},{children:[e(of,{className:"w-4 h-4 mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var yf=Object.freeze({__proto__:null,BlockOptions:bf,BlockOptionsMenuContent:mf,BlockOptionsMenuGroup:gf,BlockOptionsMenuItem:Df,BlockOptionsSeparator:({className:t})=>e("div",{className:`h-[1px] bg-[#37352f14] my-[4px] w-full ${t}`})});function Cf(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 wf={actions:"vuZgncnq",hovered:"_8Eqjiv7m",actionButton:"WabGEp54",plusButton:"_0C8RpLmz"};function Bf(...e){return e.filter(Boolean).join(" ")}Cf(".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 Ef=({block:n,editor:r,dragHandleProps:o,showActions:i,onChangeActiveBlock:a})=>{const[u,s]=f(!1),{refs:l,floatingStyles:c,context:d}=Ud({placement:"right-start",open:u,onOpenChange:s,middleware:[Xc(),$c(),Kc(),kc()]}),{isMounted:h,styles:p}=Xd(d,{duration:100}),{setActivatorNodeRef:v,attributes:g,listeners:m}=o,D=Object.assign(Object.assign({},c),p);return t("div",Object.assign({contentEditable:!1,className:Bf(wf.actions,i&&wf.hovered,"yoopta-element-actions")},{children:[e("button",Object.assign({type:"button",onClick:()=>{const e=q({id:W()}),t=[n.meta.order+1];r.setSelection([n.meta.order]),r.insertBlock(e,{at:t,focus:!0})},className:Bf(wf.actionButton,wf.plusButton,"yoopta-element-actions-plus")},{children:e(An,{})})),e("button",Object.assign({type:"button",className:Bf(wf.actionButton,"yoopta-element-actions-drag"),ref:e=>{v(e),l.setReference(e)}},g,m,{onClick:e=>{e.stopPropagation(),a(n.id),console.log("editor.children",r.children);const t=xn(r,{at:[n.meta.order]});console.log("block",n),console.log("slate",t),r.focusBlock(n.id),t&&setTimeout((()=>{Bs.blur(t),Bs.deselect(t),qi.deselect(t),r.setBlockSelected([n.meta.order],{only:!0}),r.setSelection([n.meta.order]),s(!0)}),10)}},{children:e(Bn,{})})),e(bf,{isOpen:h,refs:l,style:D,onClose:()=>s(!1)})]}))},Af=({children:n,block:r,blockId:o})=>{var i;const a=k(),[u,s]=f(null),{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:h,transform:p,transition:v,active:g,over:m,isOver:D,isDragging:b}=vn({id:o}),y={transform:p?`translate3d(${p.x}px, ${p.y}px, 0)`:"none",transition:v,opacity:b?.7:1,marginLeft:20*r.meta.depth+"px"},C=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(r.meta.order),w=u===o,B=e=>s(e);return t("div",Object.assign({className:"relative py-0 px-[2px] mt-[2px] mb-[1px] rounded yoopta-block-wrapper",onMouseEnter:()=>B(o),onMouseLeave:()=>s(null),"data-yoopta-block-id":o,style:y,"data-yoopta-block":!0,ref:d},{children:[e(Ef,{block:r,editor:a,dragHandleProps:{setActivatorNodeRef:h,attributes:l,listeners:c},showActions:w,onChangeActiveBlock:B}),e("div",Object.assign({className:wf.content,style:{borderBottom:D&&!b?"2px solid #007aff":"none"}},{children:n})),C&&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 xf(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;const Ff={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"},Of={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"},kf={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Sf=e=>{const t=Ff[e],n=Of[e],r=kf[e],o=t&&bu(t),i=n&&bu(n),a=r&&bu(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},jf={isBold:Sf("bold"),isCompose:Sf("compose"),isArrowLeft:Sf("arrowLeft"),isArrowRight:Sf("arrowRight"),isArrowUp:Sf("arrowUp"),isArrowDown:Sf("arrowDown"),isDeleteBackward:Sf("deleteBackward"),isDeleteForward:Sf("deleteForward"),isDeleteLineBackward:Sf("deleteLineBackward"),isDeleteLineForward:Sf("deleteLineForward"),isDeleteWordBackward:Sf("deleteWordBackward"),isDeleteWordForward:Sf("deleteWordForward"),isExtendBackward:Sf("extendBackward"),isExtendForward:Sf("extendForward"),isExtendLineBackward:Sf("extendLineBackward"),isExtendLineForward:Sf("extendLineForward"),isItalic:Sf("italic"),isMoveLineBackward:Sf("moveLineBackward"),isMoveLineForward:Sf("moveLineForward"),isCtrlLeft:Sf("ctrlLeft"),isCtrlRight:Sf("ctrlRight"),isRedo:Sf("redo"),isShiftEnter:Sf("shiftEnter"),isEnter:Sf("enter"),isTransposeCharacter:Sf("transposeCharacter"),isUndo:Sf("undo"),isSpace:Sf("space"),isSelect:Sf("select"),isTab:Sf("tab"),isShiftTab:Sf("shiftTab"),isBackspace:Sf("backspace"),isCmdEnter:Sf("cmdEnter"),isCmd:Sf("cmd"),isEscape:Sf("escape"),isSlashCommand:Sf("slashCommand"),isShiftArrowUp:Sf("shiftArrowUp"),isShiftArrowDown:Sf("shiftArrowDown"),isKekceburek:Sf("kekCeburek")};const Pf={onKeyDown:function(e){return t=>{const n=xn(e,{at:e.selection});if(!n||!n.selection)return;const r=ko.parent(n.selection.anchor.path);if(jf.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(jf.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const o=Qo.isStart(n,n.selection.anchor,r),i=Qo.isEnd(n,n.selection.anchor,r);if(!o&&!i)return void e.splitBlock({slate:n,focus:!0});const a=q({id:W()}),u=e.selection?[e.selection[0]+1]:[0];e.insertBlock(a,{at:u,slate:n,focus:!0})}else if(jf.isBackspace(t)){if(t.isDefaultPrevented())return;const r=ko.parent(n.selection.anchor.path);if(Qo.isStart(n,n.selection.anchor,r)){t.preventDefault();const o=Qo.string(n,r),i=e.selection?e.selection[0]-1:0,a=xn(e,{at:[i]});let u;if(a&&(u=function(e,t){const[,n]=Qo.last(e,t);return{path:n,offset:Qo.string(e,n).length}}(a,r)),0===o.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:u});{if(Vo.isExpanded(n.selection))return qi.delete(n,{at:n.selection});if(!a)return;if(0===Qo.string(a,[0,0]).length)return e.deleteBlock({at:[i],focus:!0,focusAt:u});const t=Array.from(Qo.nodes(n,{at:[0],match:e=>!Qo.isEditor(e)&&(di.isText(e)||Qo.isInline(n,e)),mode:"highest"})),r=t.map((([e])=>e));return qi.insertNodes(a,r,{at:Qo.end(a,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:u})}}}else{if(jf.isSelect(t)){if(t.isDefaultPrevented())return;const[,r]=Qo.first(n,[0]),[,o]=Qo.last(n,[n.children.length-1]),i=Qo.range(n,r,o),a=Vo.equals(n.selection,i);if(Vo.isExpanded(n.selection)&&a)return t.preventDefault(),Bs.blur(n),Bs.deselect(n),qi.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(jf.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(jf.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(jf.isArrowUp(t)){if(t.isDefaultPrevented())return;const r=ko.parent(n.selection.anchor.path);if(Qo.isStart(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]-1]:null,r=xn(e,{at:n}),o=A(e,{at:n});if(r&&o){const[,n]=Qo.last(r,[0]),i={path:n,offset:Qo.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(jf.isArrowDown(t)){const r=ko.parent(n.selection.anchor.path);if(Qo.isEnd(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]+1]:null,o=xn(e,{at:n}),i=A(e,{at:n});if(o&&i){const n=function(e,t){const[,n]=Qo.first(e,t);return{path:n,offset:0}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(Vo.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&bu(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},Rf=({children:t,attributes:n,placeholder:r})=>{const o=a(ll),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))},Tf=i(null),Nf={didCatch:!1,error:null};class _f extends v{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Nf}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];null===(t=(n=this.props).onReset)||void 0===t||t.call(n,{args:o,reason:"imperative-api"}),this.setState(Nf)}}componentDidCatch(e,t){var n,r;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;var o,i;n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(o=(i=this.props).onReset)||void 0===o||o.call(i,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Nf))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:o,error:i}=this.state;let a=e;if(o){const e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)a=t(e);else if(n)a=m(n,e);else{if(null!==r&&!D(r))throw i;a=r}}return m(Tf.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},a)}}const Mf=({id:t,customEditor:r,elements:o,marks:i,events:a,options:s,placeholder:l="Type '/' for commands"})=>{const d=k(),f=S(t),h=u(f.value).current,p=f.type,v=c((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),g=c((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(i)),[i]),m=c((()=>{let e=d.blockEditorsMap[t];return Object.keys(o).forEach((e=>{var t;null===(t=o[e].props)||void 0===t||t.nodeType})),console.log(`SLATE EDITOR FOR block: ${f.id}`,e),e}),[]);console.log(`SLATE FOR block: ${f.id}`,m);const D=c((()=>{if(!a)return{};const e={hotkeys:jf,currentBlock:f,defaultBlock:q({id:W()})},t={};return Object.keys(a).forEach((n=>{t[n]=function(t){if(a[n]){a[n](d,m,e)(t)}}})),t}),[a,d,f]);return e(_f,Object.assign({onError:(e,t)=>{console.log("ERROR IN SLATE EDITOR",e),console.log("INFO FOR ERROR",t)},fallbackRender:()=>e("div",{children:"Something went wrong with Editor"})},{children:e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":p},{children:e(Lf,{id:t,slate:m,initialValue:h,onChange:e=>d.updateBlock(t,{value:e}),decorate:e=>{var t;const n=[],[r,o]=e,i=(null===(t=d.selection)||void 0===t?void 0:t[0])===f.meta.order;return m.selection&&i&&!Qo.isEditor(r)&&""===Qo.string(m,[o[0]])&&Vo.includes(m.selection,o)&&Vo.isCollapsed(m.selection)&&n.push(Object.assign(Object.assign({},m.selection),{withPlaceholder:!0})),n},renderLeaf:t=>{var n,r,o,i,a;let{children:u,leaf:s,attributes:c}=t;const h=xf(s,["text"]),p=(null===(n=d.selection)||void 0===n?void 0:n[0])===f.meta.order;h&&Object.keys(h).forEach((e=>{const t=g[e];t&&(u=t.render({children:u,leaf:s}))}));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))&&p&&s.withPlaceholder;return e(Rf,Object.assign({attributes:c,placeholder:v?l:void 0},{children:u}))},renderElement:r=>{const o=v[r.element.type];return o?e(o,Object.assign({},r,{blockId:t,options:s})):e(n,{})},eventHandlers:D,onKeyDown:e=>{var t;null===(t=D.onKeyDown)||void 0===t||t.call(D,e),Pf.onKeyDown(d)(e)},onKeyUp:e=>{var t;null===(t=null==D?void 0:D.onKeyUp)||void 0===t||t.call(D,e)},onFocus:e=>{var t;null===(t=null==D?void 0:D.onFocus)||void 0===t||t.call(D,e)},onMouseDown:e=>{var t,n;(null===(t=d.selection)||void 0===t?void 0:t[0])!==f.meta.order&&d.setSelection([f.meta.order]),null===(n=null==D?void 0:D.onMouseDown)||void 0===n||n.call(D,e)},onBlur:e=>{var t;e.preventDefault(),null===(t=null==D?void 0:D.onBlur)||void 0===t||t.call(D,e)},customEditor:r})}))}))},Lf=h((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:a,eventHandlers:u,onKeyDown:s,onKeyUp:l,onFocus:c,onMouseDown:d,onBlur:f,customEditor:h,decorate:p})=>e(Ml,Object.assign({editor:n,initialValue:r,onChange:o},{children:e(Fl,Object.assign({renderElement:a,renderLeaf:i,className:"focus-visible:outline-none focus:outline-none",spellCheck:!0},u,{onKeyDown:s,onKeyUp:l,onFocus:c,onMouseDown:d,decorate:p,onBlur:f}),`editable-${t}`)}),`slate-${t}`)));Lf.displayName="SlateEditorInstance";const If=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c((()=>[...t].filter((e=>null!=e))),[...t])}(Be(pt,{activationConstraint:{delay:100,tolerance:0}}),Be(lt,{coordinateGetter:Dn})),handleDragEnd:d((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:d((t=>{e.setBlockSelected(null)}),[])}),zf=[],Wf=({editor:t,marks:n})=>{const{sensors:r,handleDragEnd:o,handleDragStart:i}=If({editor:t}),a=Object.keys(t.children),u=c((()=>0===a.length?zf:a.sort(((e,n)=>t.children[e].meta.order-t.children[n].meta.order))),[a]),s=[];for(let r=0;r<u.length;r++){const o=u[r],i=t.children[o],a=t.plugins[i.type];i&&a?s.push(e(Af,Object.assign({block:i,blockId:o},{children:e(Mf,{type:i.type,id:o,marks:n,events:a.events,elements:a.elements,options:a.options},o)}),o)):console.error(`Plugin ${i.type} not found`)}return e(Kt,Object.assign({sensors:r,collisionDetection:je,onDragStart:i,onDragEnd:o},{children:e(sn,Object.assign({items:u,strategy:on},{children:s}))}))},Vf=({editor:e,yooptaEditorRef:t,root:n})=>{const[r,o]=f({origin:[0,0],coords:[0,0],selection:!1}),i=n=>{var i;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),s();a||o({origin:[n.pageX,n.pageY-window.pageYOffset],coords:[n.pageX,n.pageY-window.pageYOffset],selection:!0})},a=t=>{if(!r.selection)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]),u=Math.min(e[0],t[0]),s=Math.max(e[1],t[1]),l=Math.max(e[0],t[0]);a<i.bottom&&s>i.top&&u<i.right&&l>i.left&&n.push(o)})),n})(r.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(n,{only:!0})},u=()=>{s()};l((()=>{var e;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===(e=t.current)||void 0===e?void 0:e.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",a),r.addEventListener("mouseup",u),()=>{r.removeEventListener("mousedown",i),r.removeEventListener("mousemove",a),r.removeEventListener("mouseup",u)}}),[e.selectedBlocks,r,n]);const s=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},r),{onClose:s})},qf=({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})},Uf={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Hf=({marks:n,className:r,autoFocus:o=!0,selectionBoxRoot:i})=>{const a=k(),s=u(null),c=Vf({editor:a,yooptaEditorRef:s,root:i});let d=u(Uf).current;console.log("editor.children",a.children),l((()=>{if(!o)return;const e=A(a,{at:[0]});e&&a.focusBlock(e.id,{waitExecution:!0})}),[o]),l((()=>(document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p))),[a.selectedBlocks]);const f=()=>{Array.isArray(a.selectedBlocks)&&a.selectedBlocks.length>0&&a.setBlockSelected(null)},h=()=>{d.indexToSelect=null,d.startedIndexToSelect=null,d.selectionStarted=!1},p=e=>{var t,n,r,o,i;if(jf.isSelect(e)){if((null===(t=a.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(a.children).length)return void e.preventDefault();if(d.selectionStarted)return e.preventDefault(),void a.setBlockSelected([],{allSelected:!0})}if(jf.isBackspace(e)){e.stopPropagation();if(Array.isArray(a.selectedBlocks)&&(null===(n=a.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(a.children).length)return e.preventDefault(),a.deleteBlock({deleteAll:!0}),a.setBlockSelected(null),void h();if(Array.isArray(a.selectedBlocks)&&(null===(r=a.selectedBlocks)||void 0===r?void 0:r.length)>0)return e.preventDefault(),a.deleteBlock({fromPaths:a.selectedBlocks}),a.setBlockSelected(null),void h()}if(jf.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(d.selectionStarted&&null!==d.startedIndexToSelect&&null!==d.indexToSelect){const e=d.indexToSelect,t=e-1;if(0===e)return;if(e===d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if(t<d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if((null===(o=a.selectedBlocks)||void 0===o?void 0:o.includes(e))&&e!==d.startedIndexToSelect){const n=a.selectedBlocks.filter((t=>t!==e));return a.setBlockSelected(n,{only:!0}),void(d.indexToSelect=t)}return}const t=A(a),n=xn(a);if(!n||!n.selection||!t)return;const r=ko.parent(n.selection.anchor.path),i=Qo.isStart(n,n.selection.focus,r);if(Vo.isExpanded(n.selection)&&i){const r=a.selection?[a.selection[0]-1]:[0],o=A(a,{at:r});t&&o&&(e.preventDefault(),Bs.blur(n),Bs.deselect(n),qi.deselect(n),a.setSelection(null),a.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)-1]),d.startedIndexToSelect=t.meta.order,d.indexToSelect=t.meta.order-1,d.selectionStarted=!0)}}if(jf.isShiftArrowDown(e)){if(d.selectionStarted&&null!==d.indexToSelect&&null!==d.startedIndexToSelect){const e=d.indexToSelect,t=e+1;if(t===Object.keys(a.children).length)return;if(e===d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if(t>d.startedIndexToSelect)return a.setBlockSelected([t]),void(d.indexToSelect=t);if((null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==d.startedIndexToSelect){const n=a.selectedBlocks.filter((t=>t!==e));return a.setBlockSelected(n,{only:!0}),void(d.indexToSelect=t)}return}const t=A(a),n=xn(a);if(!n||!n.selection||!t)return;const r=ko.parent(n.selection.anchor.path),o=Qo.isEnd(n,n.selection.focus,r);if(Vo.isExpanded(n.selection)&&o){const r=a.selection?[a.selection[0]+1]:[0],o=A(a,{at:r});t&&o&&(e.preventDefault(),Bs.blur(n),Bs.deselect(n),qi.deselect(n),a.setSelection(null),a.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),d.startedIndexToSelect=t.meta.order,d.indexToSelect=t.meta.order+1,d.selectionStarted=!0)}}},v=(g={userSelect:c.selection?"none":"auto",pointerEvents:c.selection?"none":"auto"},Object.assign({paddingBottom:150},g));var g;return t("div",Object.assign({id:"yoopta-editor",className:r,style:v,ref:s,onClick:e=>{h(),(e=>{var t;const n=s.current;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10);if(e.clientY>=o){const e=Object.keys(a.children).length-1,n=A(a,{at:[e]}),r=xn(a,{at:[e]});if(n&&r&&r.selection){const e=Qo.string(r,r.selection.anchor.path),o=ko.parent(r.selection.anchor.path),[i]=Qo.node(r,o);if(Uo.isElement(i)&&"void"!==(null===(t=i.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void a.focusBlock(n.id,{slate:r})}const o=q({id:W()}),i=e+1;a.insertBlock(o,{at:[i],focus:!0})}})(e),f()},onBlur:e=>{var t;(null===(t=s.current)||void 0===t?void 0:t.contains(e.relatedTarget))||(h(),f())}},{children:[e(Wf,{editor:a,marks:n}),e(qf,{origin:c.origin,coords:c.coords,isOpen:c.selection})]}))},Kf=({children:e,fallback:t=null})=>{const[n,r]=f(!1);return l((()=>r(!0)),[]),n?e:t};var $f={isHistory:e=>xr(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||Jo.isOperationList(e.redos[0]))&&(0===e.undos.length||Jo.isOperationList(e.undos[0]))},Xf=new WeakMap,Yf=new WeakMap,Zf={isHistoryEditor:e=>$f.isHistory(e.history)&&Qo.isEditor(e),isMerging:e=>Yf.get(e),isSaving:e=>Xf.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Zf.isMerging(e);Yf.set(e,!1),t(),Yf.set(e,n)},withoutSaving(e,t){var n=Zf.isSaving(e);Xf.set(e,!1),t(),Xf.set(e,n)}},Jf=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];Zf.withoutSaving(t,(()=>{Qo.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];Zf.withoutSaving(t,(()=>{Qo.withoutNormalizing(t,(()=>{var e=r.map(Jo.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],u=a&&a[a.length-1],s=eh(e,u),l=Zf.isSaving(t),c=Zf.isMerging(t);if(null==l&&(l=Qf(e)),l){if(null==c&&(c=null!=a&&(0!==r.length||(Gf(e,u)||s))),a&&c)s&&a.pop(),a.push(e);else{var d=[e];i.push(d)}for(;i.length>100;)i.shift();th(e)&&(o.redos=[])}n(e)},t},Gf=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!ko.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!ko.equals(e.path,t.path))),Qf=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,eh=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),th=e=>"set_selection"!==e.type;function nh(e,t){const n=xn(e);if(!n)return!1;const r=Qo.marks(n);return!!(null==r?void 0:r[t])}const rh=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&Vo.isCollapsed(i)){const{anchor:a}=i,u=Qo.above(t,{match:e=>Uo.isElement(e)&&Qo.isBlock(t,e),mode:"lowest"});if(!u)return;const[,s]=u,l=Qo.parent(t,s),[c]=l;if(Uo.isElement(c)&&!di.isText(c.children[0]))return n(r);const d=u?s:[],f={anchor:a,focus:Qo.start(t,d)},h=Qo.string(t,f),p=null===(o=e.shortcuts)||void 0===o?void 0:o[h];if(!!p&&!p.isActive())return qi.select(t,f),qi.delete(t),void p.create({deleteText:!1})}n(r)},t};function oh(e,t,n){e.children=mo(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=Do(e.children),e.emit("change",e.children),r&&e.applyChanges()}function ih(e,t,n){e.children=mo(e.children);const r=A(e,{at:e.selection});if(!r)throw new Error("Block from not found at current selection");const o=df(e.blocks[r.type].elements);if(r.type===t)return void(e.children=Do(e.children));const i=xn(e,{at:[r.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${r.meta.order}`);const a=df(e.blocks[t].elements);Qo.withoutNormalizing(i,(()=>{const n=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=>!Qo.isEditor(e)&&Uo.isElement(e);o&&(a=e=>!Qo.isEditor(e)&&Uo.isElement(e)&&e.type===o);const u=ko.parent(i),s=Qo.nodes(e,{at:u,match:a,mode:"lowest"});if(s){const[e]=s;return e}}(i,{elementType:o});console.log({fromBlockRootElementType:o,node:n}),qi.setNodes(i,{type:a},{at:[0],mode:"lowest",match:e=>Uo.isElement(e)&&!Qo.isInline(i,e)});const u={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]=u,e.children=Do(e.children),e.applyChanges()}))}function ah(e,t={}){const{at:n=e.selection,deleteAll:r=!1,fromPaths:o,focus:i}=t;if(console.log("BEFORE options.focusAt",t.focusAt),Array.isArray(o)&&o.length>0){e.children=mo(e.children),o.forEach((t=>{const n=A(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=Do(e.children),void e.applyChanges()}if(r||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=q({id:W()}),n=Jf(rh(e,Vl(Ca())));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}),void e.applyChanges()}if(!n)return;e.children=mo(e.children);const[a]=n,u=Object.keys(e.children),s=u.find((t=>e.children[t].meta.order===a));if(u.forEach((t=>{const n=e.children[t];n.meta.order>a&&(n.meta.order-=1)})),s&&(delete e.children[s],delete e.blockEditorsMap[s]),e.children=Do(e.children),e.applyChanges(),i){const n=e.selection?e.selection[0]-1:0,r=A(e,{at:[n]});r&&e.focusBlock(r.id,{focusAt:t.focusAt})}}function uh(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=xn(e);if(!n)return null;const r=Qo.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>nh(e,r),toggle:()=>function(e,t){const n=xn(e),r=nh(e,t);n&&(r?Qo.removeMark(n,t):Qo.addMark(n,t,!0),e.applyChanges())}(e,r),update:t=>function(e,t,n){const r=xn(e);console.log("update editor.selection",e.selection),console.log("text format slate.selection",r),r&&r.selection&&Vo.isExpanded(r.selection)&&(Qo.addMark(r,t,n),e.applyChanges())}(e,r,t)}})),n}function sh(e,t){const n={};return t.forEach(((t,r)=>{var o;const i=ff(t.elements),a=null===(o=null==i?void 0:i.props)||void 0===o?void 0:o.nodeType;if(!("inline"===a||"inlineVoid"===a)){const o={};Object.keys(t.elements).forEach((e=>{const n=xf(t.elements[e],["render"]);o[e]=n}));const{displayLabel:i,placeholder:a,align:u,shortcuts:s}=t.options||{};n[t.type]={type:t.type,elements:o,order:r,options:{displayLabel:i,placeholder:a,align:u,shortcuts:s},isActive:()=>{const n=A(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:(t,n)=>{ih(e,t)},create:n=>{!function(e,t,n){var r;e.children=mo(e.children);const o=A(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)||xn(e,{at:[null==o?void 0:o.meta.order]});if(!i||!i.selection)return;const a=e.blocks[t],u=df(a.elements),s=a.elements[u];if(!s)return;const l=Object.assign({nodeType:(null===(r=s.props)||void 0===r?void 0:r.nodeType)||"block"},s.props),c=V({id:W(),type:u,props:l});qi.setNodes(i,c,{at:[0,0],match:e=>Uo.isElement(e),mode:"highest"}),(null==n?void 0:n.deleteText)&&qi.delete(i,{at:[0,0]});const d=q({id:o.id,type:a.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[c]}),f=d.id;e.children[f]=d,e.blockEditorsMap[f]=i,e.children=Do(e.children),e.applyChanges(),(null==n?void 0:n.focus)&&e.focusBlock(f,{slate:i,waitExecution:!0})}(e,t.type,n)},update:(t,n)=>{oh(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=xn(e,{at:[o.meta.order]});i?Qo.withoutNormalizing(i,(()=>{const[t]=Qo.nodes(i,{at:[0],match:e=>Uo.isElement(e)&&e.type===n}),o=null==t?void 0:t[0],a=(null==o?void 0:o.props)||{},u={props:Object.assign(Object.assign({},a),r)};console.log("updatedNode",u),qi.setNodes(i,u,{at:[0],match:e=>Uo.isElement(e)&&e.type===n,mode:"lowest"}),e.applyChanges()})):console.warn("No slate found")}(e,t,n,r)},delete:t=>{ah(e,t)}}}})),n}function lh(e){return Jf(rh(e,Vl(Ca())))}const ch=(()=>{const e=W();return{[e]:q({id:e})}})(),dh=new M,fh=(e,t)=>dh.on(e,t),hh=(e,t)=>dh.once(e,t),ph=(e,t)=>dh.off(e,t),vh=(e,t)=>dh.emit(e,t);const gh=({editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:u,tools:s,selectionBoxRoot:l,children:d})=>{const h=()=>{g((e=>Object.assign(Object.assign({},e),{version:e.version+1}))),n.emit("change",n.children)},p=c((()=>i.map((e=>e.getPlugin))),[i]),[v,g]=f((()=>(n.applyChanges=h,o&&(n.formats=uh(n,o)),n.blocks=sh(n,p),n.children=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r)?r:ch,n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=lh(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}(p),n.on=fh,n.once=hh,n.off=ph,n.emit=vh,{editor:n,version:0})));return e(Kf,{children:e(O,Object.assign({editorState:v},{children:t(pf,Object.assign({tools:s},{children:[e(Hf,{marks:o,autoFocus:a,className:u,selectionBoxRoot:l}),d]}))}))})},mh=Object.assign(Object.assign({},yf),{ExtendedBlockActions:({className:r,style:o,onClick:i,children:a})=>{const[u,s]=f(!1),{refs:l,floatingStyles:c,context:d}=Ud({placement:"bottom-start",open:u,onOpenChange:s,middleware:[Xc(),$c(),Kc(),kc(10)],whileElementsMounted:Hc}),{isMounted:h,styles:p}=Xd(d,{duration:100}),v=Object.assign(Object.assign({},p),c);return t(n,{children:[h&&e(bf,Object.assign({isOpen:!0,onClose:()=>s(!1),refs:l,style:v},{children:a})),e("button",Object.assign({type:"button",ref:l.setReference,className:`absolute right-[10px] top-[10px] 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}`,onClick:()=>{null==i||i(),s(!0)},style:o},{children:e(nf,{})}))]})}});function Dh(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 bh(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:a=!0}=n,u=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;const u=function(e,t){if(ri.isPoint(t))return t;if(ko.isPath(t))return{path:t,offset:0};const[,n]=Qo.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);qi.select(o,u),Bs.focus(o),a&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};o?setTimeout((()=>u()),i):u()}function yh(e){return Array.from(new Set(e))}var Ch={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",u="[object Function]",s="[object GeneratorFunction]",l="[object Map]",c="[object Number]",d="[object Object]",f="[object Promise]",h="[object RegExp]",p="[object Set]",v="[object String]",g="[object Symbol]",m="[object WeakMap]",D="[object ArrayBuffer]",b="[object DataView]",y="[object Float32Array]",C="[object Float64Array]",w="[object Int8Array]",B="[object Int16Array]",E="[object Int32Array]",A="[object Uint8Array]",x="[object Uint8ClampedArray]",F="[object Uint16Array]",O="[object Uint32Array]",k=/\w*$/,S=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,P={};P[o]=P["[object Array]"]=P[D]=P[b]=P[i]=P[a]=P[y]=P[C]=P[w]=P[B]=P[E]=P[l]=P[c]=P[d]=P[h]=P[p]=P[v]=P[g]=P[A]=P[x]=P[F]=P[O]=!0,P["[object Error]"]=P[u]=P[m]=!1;var R="object"==typeof N&&N&&N.Object===Object&&N,T="object"==typeof self&&self&&self.Object===Object&&self,_=R||T||Function("return this")(),M=t&&!t.nodeType&&t,L=M&&e&&!e.nodeType&&e,I=L&&L.exports===M;function z(e,t){return e.set(t[0],t[1]),e}function W(e,t){return e.add(t),e}function V(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 q(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function U(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function H(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,Y=Function.prototype,Z=Object.prototype,J=_["__core-js_shared__"],G=($=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",Q=Y.toString,ee=Z.hasOwnProperty,te=Z.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=I?_.Buffer:void 0,oe=_.Symbol,ie=_.Uint8Array,ae=H(Object.getPrototypeOf,Object),ue=Object.create,se=Z.propertyIsEnumerable,le=X.splice,ce=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,fe=H(Object.keys,Object),he=Le(_,"DataView"),pe=Le(_,"Map"),ve=Le(_,"Promise"),ge=Le(_,"Set"),me=Le(_,"WeakMap"),De=Le(Object,"create"),be=qe(he),ye=qe(pe),Ce=qe(ve),we=qe(ge),Be=qe(me),Ee=oe?oe.prototype:void 0,Ae=Ee?Ee.valueOf:void 0;function xe(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 Fe(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 Oe(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 ke(e){this.__data__=new Fe(e)}function Se(e,t){var n=He(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ke(e)}(e)&&ee.call(e,"callee")&&(!se.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||We(a,r))||n.push(a);return n}function je(e,t,n){var r=e[t];ee.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Pe(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Re(e,t,n,r,f,m,S){var j;if(r&&(j=m?r(e,f,m,S):r(e)),void 0!==j)return j;if(!Ye(e))return e;var R=He(e);if(R){if(j=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,j)}else{var T=ze(e),N=T==u||T==s;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(T==d||T==o||N&&!m){if(q(e))return m?e:{};if(j=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ae(e),Ye(t)?ue(t):{});var t}(N?{}:e),!t)return function(e,t){return _e(e,Ie(e),t)}(e,function(e,t){return e&&_e(t,Ze(t),e)}(j,e))}else{if(!P[T])return m?e:{};j=function(e,t,n,r){var o=e.constructor;switch(t){case D:return Ne(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case y:case C:case w:case B:case E:case A:case x:case F:case O:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case l:return function(e,t,n){var r=t?n(U(e),!0):U(e);return V(r,z,new e.constructor)}(e,r,n);case c:case v:return new o(e);case h:return function(e){var t=new e.constructor(e.source,k.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(K(e),!0):K(e);return V(r,W,new e.constructor)}(e,r,n);case g:return u=e,Ae?Object(Ae.call(u)):{}}var u}(e,T,Re,t)}}S||(S=new ke);var _=S.get(e);if(_)return _;if(S.set(e,j),!R)var M=n?function(e){return function(e,t,n){var r=t(e);return He(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,Ie)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(M||e,(function(o,i){M&&(o=e[i=o]),je(j,i,Re(o,t,n,r,i,e,S))})),j}function Te(e){return!(!Ye(e)||(t=e,G&&G in t))&&(Xe(e)||q(e)?ne:S).test(qe(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function _e(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],u=r?r(n[a],e[a],a,n,e):void 0;je(n,a,void 0===u?e[a]:u)}return n}function Me(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 Le(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}xe.prototype.clear=function(){this.__data__=De?De(null):{}},xe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},xe.prototype.get=function(e){var t=this.__data__;if(De){var r=t[e];return r===n?void 0:r}return ee.call(t,e)?t[e]:void 0},xe.prototype.has=function(e){var t=this.__data__;return De?void 0!==t[e]:ee.call(t,e)},xe.prototype.set=function(e,t){return this.__data__[e]=De&&void 0===t?n:t,this},Fe.prototype.clear=function(){this.__data__=[]},Fe.prototype.delete=function(e){var t=this.__data__,n=Pe(t,e);return!(n<0)&&(n==t.length-1?t.pop():le.call(t,n,1),!0)},Fe.prototype.get=function(e){var t=this.__data__,n=Pe(t,e);return n<0?void 0:t[n][1]},Fe.prototype.has=function(e){return Pe(this.__data__,e)>-1},Fe.prototype.set=function(e,t){var n=this.__data__,r=Pe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new xe,map:new(pe||Fe),string:new xe}},Oe.prototype.delete=function(e){return Me(this,e).delete(e)},Oe.prototype.get=function(e){return Me(this,e).get(e)},Oe.prototype.has=function(e){return Me(this,e).has(e)},Oe.prototype.set=function(e,t){return Me(this,e).set(e,t),this},ke.prototype.clear=function(){this.__data__=new Fe},ke.prototype.delete=function(e){return this.__data__.delete(e)},ke.prototype.get=function(e){return this.__data__.get(e)},ke.prototype.has=function(e){return this.__data__.has(e)},ke.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Fe){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Oe(r)}return n.set(e,t),this};var Ie=ce?H(ce,Object):function(){return[]},ze=function(e){return te.call(e)};function We(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||j.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}function qe(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(he&&ze(new he(new ArrayBuffer(1)))!=b||pe&&ze(new pe)!=l||ve&&ze(ve.resolve())!=f||ge&&ze(new ge)!=p||me&&ze(new me)!=m)&&(ze=function(e){var t=te.call(e),n=t==d?e.constructor:void 0,r=n?qe(n):void 0;if(r)switch(r){case be:return b;case ye:return l;case Ce:return f;case we:return p;case Be:return m}return t});var He=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Xe(e)}var $e=de||function(){return!1};function Xe(e){var t=Ye(e)?te.call(e):"";return t==u||t==s}function Ye(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return Ke(e)?Se(e):function(e){if(!Ve(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 Re(e,!0,!0)}}({get exports(){return Ch},set exports(e){Ch=e}},Ch);var wh=Ch;function Bh(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=A(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=mo(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):wh(a));var a;const u=lh(e);i.id=W(),i.meta.order=o.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=u;const s=i.id;e.children=Do(e.children),e.applyChanges(),r&&e.focusBlock(s,{waitExecution:!0})}function Eh(e,t){Bs.blur(t),Bs.deselect(t),qi.deselect(t),e.setBlockSelected(null),e.setSelection(null)}const Ah=()=>{const e={children:{},selection:null,selectedBlocks:null,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),applyChanges:()=>{},insertBlock:(...t)=>function(e,t,n={}){e.children=mo(e.children);const{at:r=null,focus:o=!1,slate:i=null}=n,a=A(e),u=r,s={id:W(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let l=!1;if(i&&i.selection){const e=Qo.string(i,i.selection.anchor.path);l=Qo.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(u){const[t]=u;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),s.meta.order=t}else{const t=Object.keys(e.children).length;s.meta.order=t}const c=lh(e);e.blockEditorsMap[s.id]=c,l&&a&&(s.meta.order=a.meta.order,a.meta.order+=1),e.children[s.id]=s;const d=null==a?void 0:a.id;e.children=Do(e.children),e.applyChanges(),o&&e.focusBlock(l&&d?d:s.id)}(e,...t),deleteBlock:(...t)=>ah(e,...t),duplicateBlock:(...t)=>Bh(e,...t),toggleBlock:(...t)=>ih(e,...t),increaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=mo(e.children);const r=A(e);r&&(r.meta.depth=r.meta.depth+1,e.children=Do(e.children),e.applyChanges())}(e,...t),decreaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=mo(e.children);const r=A(e);r&&(r.meta.depth=0===r.meta.depth?0:r.meta.depth-1,e.children=Do(e.children),e.applyChanges())}(e,...t),moveBlock:(...t)=>function(e,t,n){e.children=mo(e.children);const[r]=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));console.log("blockInNewPosition meta",Object.assign({},i).meta.depth);const a=o.meta.order<i.meta.order,u=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--:u&&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=Do(e.children),e.applyChanges()}(e,...t),focusBlock:(...t)=>bh(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>oh(e,...t),splitBlock:(...t)=>function(e,t={}){const{slate:n,focus:r=!0}=t,o=A(e);n&&n.selection&&o&&Qo.withoutNormalizing(n,(()=>{e.children=mo(e.children);const t=ko.parent(n.selection.anchor.path);qi.splitNodes(n,{at:n.selection,match:e=>Uo.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,a=n.children.slice()[i];qi.removeNodes(n,{at:[i],match:e=>Uo.isElement(e),mode:"highest"});const u={id:W(),type:o.type,meta:{order:o.meta.order+1,depth:o.meta.depth},value:[a]};Object.values(e.children).forEach((e=>{e.meta.order>=u.meta.order&&(e.meta.order+=1)}));const s=lh(e);e.blockEditorsMap[u.id]=s,e.children[u.id]=u,e.children=Do(e.children),e.applyChanges(),r&&e.focusBlock(u.id,{slate:s})}))}(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(r)e.selectedBlocks=t;else if(o){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=yh(t)}else e.selectedBlocks=yh(i.concat(t));e.applyChanges()}(e,...t),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:xn(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Eh(e,r)),i):(Eh(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};function xh({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}Cf('/*! 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-\\[10px\\]{right:10px}.top-0{top:0}.top-\\[10px\\]{top:10px}.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%}.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{jf as HOTKEYS,mh as UI,E as YooptaPlugin,q as buildBlockData,V as buildBlockElement,Ah as createYooptaEditor,xh as createYooptaMark,gh as default,A as findPluginBlockBySelectionPath,Dh as findPluginBlockByType,xn as findSlateBySelectionPath,W as generateId,ff as getRootBlockElement,df as getRootBlockElementType,S as useBlockData,T as useBlockSelected,j as useYooptaBlock,k as useYooptaEditor,P as useYooptaPlugin,R as useYooptaPluginOptions,vf as useYooptaTools};
|