@yoopta/editor 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockActions.d.ts","sourceRoot":"","sources":["../../../src/components/Block/BlockActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAuBjF,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,eAAe,EAAE,GAAG,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,YAAY,yEAA0E,YAAY,
|
|
1
|
+
{"version":3,"file":"BlockActions.d.ts","sourceRoot":"","sources":["../../../src/components/Block/BlockActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAuBjF,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,eAAe,EAAE,GAAG,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,YAAY,yEAA0E,YAAY,4CAyIvG,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/handlers/onKeyDown.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAyB1E,MAAM;AAEN,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,WAC1B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"onKeyDown.d.ts","sourceRoot":"","sources":["../../src/handlers/onKeyDown.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAyB1E,MAAM;AAEN,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,WAC1B,mBAAmB,UA+MnC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import*as n from
|
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var Zn=["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(","),qn="undefined"==typeof Element,Gn=qn?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jn=!qn&&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},Qn=function e(t,o){var n;void 0===o&&(o=!0);var r=null==t||null===(n=t.getAttribute)||void 0===n?void 0:n.call(t,"inert");return""===r||"true"===r||o&&t&&e(t.parentNode)},er=function e(t,o,n){for(var r=[],i=Array.from(t);i.length;){var a=i.shift();if(!Qn(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),c=e(l.length?l:a.children,!0,n);n.flatten?r.push.apply(r,c):r.push({scopeParent:a,candidates:c})}else{Gn.call(a,Zn)&&n.filter(a)&&(o||!t.includes(a))&&r.push(a);var s=a.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(a),d=!Qn(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(s&&d){var u=e(!0===s?a.children:s.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},tr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},or=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,o=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===o||"true"===o}(e))&&!tr(e)?0:e.tabIndex},nr=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},rr=function(e){return"INPUT"===e.tagName},ir=function(e){return function(e){return rr(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,o=e.form||Jn(e),n=function(e){return o.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=n(window.CSS.escape(e.name));else try{t=n(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]}(t,e.form);return!r||r===e}(e)},ar=function(e){var t=e.getBoundingClientRect(),o=t.width,n=t.height;return 0===o&&0===n},lr=function(e,t){var o=t.displayCheck,n=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Gn.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Gn.call(r,"details:not([open]) *"))return!0;if(o&&"full"!==o&&"legacy-full"!==o){if("non-zero-area"===o)return ar(e)}else{if("function"==typeof n){for(var i=e;e;){var a=e.parentElement,l=Jn(e);if(a&&!a.shadowRoot&&!0===n(a))return ar(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,o,n,r,i=e&&Jn(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(o=a)&&void 0!==o&&null!==(n=o.ownerDocument)&&void 0!==n&&n.contains(a)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!l&&a;){var c,s,d;l=!(null===(s=a=null===(c=i=Jn(a))||void 0===c?void 0:c.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==o)return!0}return!1},cr=function(e,t){return!(t.disabled||Qn(t)||function(e){return rr(e)&&"hidden"===e.type}(t)||lr(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var o=0;o<t.children.length;o++){var n=t.children.item(o);if("LEGEND"===n.tagName)return!!Gn.call(t,"fieldset[disabled] *")||!n.contains(e)}return!0}t=t.parentElement}return!1}(t))},sr=function(e,t){return!(ir(t)||or(t)<0||!cr(e,t))},dr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ur=function e(t){var o=[],n=[];return t.forEach((function(t,r){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var o=or(e);return o<0&&t&&!tr(e)?0:o}(a,i),c=i?e(t.candidates):a;0===l?i?o.push.apply(o,c):o.push(a):n.push({documentOrder:r,tabIndex:l,item:t,isScope:i,content:c})})),n.sort(nr).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(o)},fr=function(e,t){var o;return o=(t=t||{}).getShadowRoot?er([e],t.includeContainer,{filter:sr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:dr}):function(e,t,o){if(Qn(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(Zn));return t&&Gn.call(e,Zn)&&n.unshift(e),n.filter(o)}(e,t.includeContainer,sr.bind(null,t)),ur(o)};const pr=n["useInsertionEffect".toString()]||(e=>e());var hr="undefined"!=typeof document?c:s;function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},yr.apply(this,arguments)}let gr=!1,vr=0;const mr=()=>"floating-ui-"+vr++;const br=n["useId".toString()]||function(){const[e,t]=n.useState((()=>gr?mr():void 0));return hr((()=>{null==e&&t(mr())}),[]),n.useEffect((()=>{gr||(gr=!0)}),[]),e};const wr=n.createContext(null),xr=n.createContext(null);function kr(e){return"data-floating-ui-"+e}function Or(e){const t=l(e);return hr((()=>{t.current=e})),t}const Er=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cr(e,t){const o=fr(e,Er());"prev"===t&&o.reverse();const n=o.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(o=t)||null==(o=o.shadowRoot)?void 0:o.activeElement);){var o;t=t.shadowRoot.activeElement}return t}((null==(r=e)?void 0:r.ownerDocument)||document));var r;return o.slice(n+1)[0]}function Sr(e,t){const o=t||e.currentTarget,n=e.relatedTarget;return!n||!function(e,t){if(!e||!t)return!1;const o=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&Vo(o)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}(o,n)}function _r(e){fr(e,Er()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Dr(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const Rr={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 jr(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Br=n.forwardRef((function(e,t){const[o,r]=n.useState();hr((()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",jr),()=>{document.removeEventListener("keydown",jr)})),[]);const i={ref:t,tabIndex:0,role:o,"aria-hidden":!o||void 0,[kr("focus-guard")]:"",style:Rr};return n.createElement("span",yr({},e,i))})),Ar=n.createContext(null),Tr=kr("portal");function Mr(e){let{children:t,id:o,root:r=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:o}=void 0===e?{}:e;const[r,i]=n.useState(null),a=br(),l=Lr(),c=n.useRef(null);return hr((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{c.current=null}))}),[r]),hr((()=>{if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const o=document.createElement("div");o.id=a,o.setAttribute(Tr,""),e.appendChild(o),c.current=o,i(o)}),[t,a]),hr((()=>{if(c.current)return;let e=o||(null==l?void 0:l.portalNode);e&&!Ho(e)&&(e=e.current),e=e||document.body;let n=null;t&&(n=document.createElement("div"),n.id=t,e.appendChild(n));const r=document.createElement("div");r.id=a,r.setAttribute(Tr,""),e=n||e,e.appendChild(r),c.current=r,i(r)}),[t,o,a,l]),r}({id:o,root:r}),[l,c]=n.useState(null),s=n.useRef(null),d=n.useRef(null),u=n.useRef(null),f=n.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!r&&!a);return n.useEffect((()=>{if(a&&i&&(null==l||!l.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&Sr(e)){("focusin"===e.type?Dr:_r)(a)}}}),[a,i,null==l?void 0:l.modal]),n.createElement(Ar.Provider,{value:n.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:a,setFocusManagerState:c})),[i,a])},p&&a&&n.createElement(Br,{"data-type":"outside",ref:s,onFocus:e=>{if(Sr(e,a)){var t;null==(t=u.current)||t.focus()}else{const e=Cr(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&a&&n.createElement("span",{"aria-owns":a.id,style:Rr}),a&&b(t,a),p&&a&&n.createElement(Br,{"data-type":"outside",ref:d,onFocus:e=>{if(Sr(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=Cr(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))}const Lr=()=>n.useContext(Ar),Nr=new Set,Ir=n.forwardRef((function(e,t){let{lockScroll:o=!1,...r}=e;const i=br();return hr((()=>{if(!o)return;Nr.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,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,o=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(o))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Nr.delete(i),0===Nr.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[i,o]),n.createElement("div",yr({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Pr(e){var t;void 0===e&&(e={});const{open:o=!1,onOpenChange:r,nodeId:i}=e,[a,l]=n.useState(null),c=(null==(t=e.elements)?void 0:t.reference)||a,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:s,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=n.useState(r);Wn(p,r)||h(r);const[y,g]=n.useState(null),[m,b]=n.useState(null),w=n.useCallback((e=>{e!==E.current&&(E.current=e,g(e))}),[]),x=n.useCallback((e=>{e!==C.current&&(C.current=e,b(e))}),[]),k=a||y,O=l||m,E=n.useRef(null),C=n.useRef(null),S=n.useRef(u),_=null!=s,D=Xn(s),R=Xn(i),j=n.useCallback((()=>{if(!E.current||!C.current)return;const e={placement:t,strategy:o,middleware:p};R.current&&(e.platform=R.current),Vn(E.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};B.current&&!Wn(S.current,t)&&(S.current=t,v.flushSync((()=>{f(t)})))}))}),[p,t,o,R]);Kn((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const B=n.useRef(!1);Kn((()=>(B.current=!0,()=>{B.current=!1})),[]),Kn((()=>{if(k&&(E.current=k),O&&(C.current=O),k&&O){if(D.current)return D.current(k,O,j);j()}}),[k,O,j,D,_]);const A=n.useMemo((()=>({reference:E,floating:C,setReference:w,setFloating:x})),[w,x]),T=n.useMemo((()=>({reference:k,floating:O})),[k,O]),M=n.useMemo((()=>{const e={position:o,left:0,top:0};if(!T.floating)return e;const t=$n(T.floating,u.x),n=$n(T.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Yn(T.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}}),[o,c,T.floating,u.x,u.y]);return n.useMemo((()=>({...u,update:j,refs:A,elements:T,floatingStyles:M})),[u,j,A,T,M])}(e),d=n.useContext(xr),u=null!=((null==(f=n.useContext(wr))?void 0:f.id)||null);var f;const p=function(e){const t=n.useRef((()=>{}));return pr((()=>{t.current=e})),n.useCallback((function(){for(var e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];return null==t.current?void 0:t.current(...o)}),[])}(((e,t,o)=>{e&&(y.current.openEvent=t),g.emit("openchange",{open:e,event:t,reason:o,nested:u}),null==r||r(e,t,o)})),h=n.useRef(null),y=n.useRef({}),g=n.useState((()=>function(){const e=new Map;return{emit(t,o){var n;null==(n=e.get(t))||n.forEach((e=>e(o)))},on(t,o){e.set(t,[...e.get(t)||[],o])},off(t,o){var n;e.set(t,(null==(n=e.get(t))?void 0:n.filter((e=>e!==o)))||[])}}}()))[0],m=br(),b=n.useCallback((e=>{const t=Ho(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=n.useCallback((e=>{(Ho(e)||null===e)&&(h.current=e,l(e)),(Ho(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!Ho(e))&&s.refs.setReference(e)}),[s.refs]),x=n.useMemo((()=>({...s.refs,setReference:w,setPositionReference:b,domReference:h})),[s.refs,w,b]),k=n.useMemo((()=>({...s.elements,domReference:c})),[s.elements,c]),O=n.useMemo((()=>({...s,refs:x,elements:k,dataRef:y,nodeId:i,floatingId:m,events:g,open:o,onOpenChange:p})),[s,i,m,g,o,p,x,k]);return hr((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=O)})),n.useMemo((()=>({...s,context:O,refs:x,elements:k})),[s,x,k,O])}const Fr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function zr(e,t){return"function"==typeof e?e(t):e}function Hr(e,t){void 0===t&&(t={});const{open:o,elements:{floating:r}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[l,c]=n.useState(!1),[s,d]=n.useState("unmounted"),u=function(e,t){const[o,r]=n.useState(e);return e&&!o&&r(!0),n.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),o}(o,a);return hr((()=>{l&&!u&&d("unmounted")}),[l,u]),hr((()=>{if(r){if(o){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}c(!0),d("close")}}),[o,r]),{isMounted:u,status:s}}function Ur(e,t){void 0===t&&(t={});const{initial:o={opacity:0},open:r,close:i,common:a,duration:l=250}=t,c=e.placement,s=c.split("-")[0],d=n.useMemo((()=>({side:s,placement:c})),[s,c]),u="number"==typeof l,f=(u?l:l.open)||0,p=(u?l:l.close)||0,[h,y]=n.useState((()=>({...zr(a,d),...zr(o,d)}))),{isMounted:g,status:v}=Hr(e,{duration:l}),m=Or(o),b=Or(r),w=Or(i),x=Or(a);return hr((()=>{const e=zr(m.current,d),t=zr(w.current,d),o=zr(x.current,d),n=zr(b.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===v&&y((t=>({transitionProperty:t.transitionProperty,...o,...e}))),"open"===v&&y({transitionProperty:Object.keys(n).map(Fr).join(","),transitionDuration:f+"ms",...o,...n}),"close"===v){const n=t||e;y({transitionProperty:Object.keys(n).map(Fr).join(","),transitionDuration:p+"ms",...o,...n})}}),[p,w,m,b,x,f,v,d]),{isMounted:g,styles:h}}var Vr;function Kr(){return Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},Kr.apply(this,arguments)}var Wr=function(e){return n.createElement("svg",Kr({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Vr||(Vr=n.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 Yr(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}var $r=["color"],Xr=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,$r);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Zr=["color"],qr=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,Zr);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Gr=["color"],Jr=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,Gr);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Qr=["color"],ei=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,Qr);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),ti=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,o=[],n=0;n<e.rangeCount;n++)o.push(e.getRangeAt(n));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||o.forEach((function(t){e.addRange(t)})),t&&t.focus()}},oi={"text/plain":"Text","text/html":"Url",default:"Text"};var ni=function(e,t){var o,n,r,i,a,l,c=!1;t||(t={}),o=t.debug||!1;try{if(r=ti(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=oi[t.format]||oi.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(r){o&&console.error("unable to copy using execCommand: ",r),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(r){o&&console.error("unable to copy using clipboardData: ",r),o&&console.error("falling back to prompt"),n=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(n,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),r()}return c};function ri(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ii(e){if(!e)return;const t=ri(e);return t?e[t]:void 0}const ai=i(void 0),li=({children:n,tools:r})=>{const i=K(),a=d((()=>r?Object.keys(r).reduce(((e,t)=>{var o;return Object.assign(Object.assign({},e),{[t]:null===(o=r[t])||void 0===o?void 0:o.render})}),{}):{}),[r]),l=d((()=>!r||i?null:Object.keys(r).map((t=>{var o,n,i;const a=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.tool,l=null===(n=null==r?void 0:r[t])||void 0===n?void 0:n.render,c=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return a?e(a,Object.assign({render:l},c),t):null}))),[r]);return e(ai.Provider,Object.assign({value:a},{children:t(o,{children:[l,n]})}))},ci=()=>{const e=a(ai);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function si({editor:e,view:t,onClose:o,mode:n="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===n&&(t=t.filter((t=>function(e,t){var o;const n=e.blocks[t];if(!n)return!1;const r=ii(n.elements);return"void"!==(null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType)}(e,t)))),t.map((t=>{var o,n,r,i;return{type:t,title:(null===(n=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===n?void 0:n.title)||t,description:null===(i=null===(r=e.blocks[t].options)||void 0===r?void 0:r.display)||void 0===i?void 0:i.description}}))})(),onClose:o,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{"toggle"===n&&e.blocks[t].toggle({focus:!0}),"create"===n&&e.blocks[t].create({deleteText:!0,focus:!0}),o()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const di=({children:t})=>e("div",Object.assign({className:"yoo-editor-flex yoo-editor-flex-col"},{children:t})),ui=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoo-editor-bg-[#FFF] yoo-editor-relative yoo-editor-min-w-[200px] yoo-editor-w-auto yoo-editor-overflow-hidden yoo-editor-rounded-md yoo-editor-border yoo-editor-border-solid yoo-editor-border-[#e5e7eb] yoo-editor-bg-popover yoo-editor-py-[6px] yoo-editor-px-0 yoo-editor-text-popover-foreground yoo-editor-shadow-md data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),fi=({children:t})=>e("div",Object.assign({className:"yoo-editor-relative yoo-editor-flex yoo-editor-cursor-default yoo-editor-select-none yoo-editor-items-center yoo-editor-text-sm yoo-editor-outline-none yoo-editor-transition-colors focus:yoo-editor-bg-accent focus:yoo-editor-text-accent-foreground data-[disabled]:yoo-editor-pointer-events-none data-[disabled]:yoo-editor-opacity-50"},{children:t})),pi=({isOpen:o,onClose:n,refs:r,style:i,children:a})=>{var l,c;const s=z(),d=ci(),[u,p]=f(!1),{refs:h,floatingStyles:y,context:g}=Pr({placement:"right",open:u,onOpenChange:p,middleware:[Un(),Hn(),zn(),On(10)],whileElementsMounted:Fn}),{isMounted:v,styles:m}=Ur(g,{duration:100});if(!o)return null;const b=N(s,{at:s.selection}),w=ii(s.blocks[(null==b?void 0:b.type)||""].elements),x="void"===(null===(l=null==w?void 0:w.props)||void 0===l?void 0:l.nodeType),k=d.ActionMenu,O=Object.assign(Object.assign({},y),m),E=si({editor:s,view:"small",onClose:()=>{p(!1),n()}});return e(Mr,Object.assign({id:"yoo-block-options-portal",root:document.getElementById("yoopta-editor")},{children:e(Ir,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:n},{children:e("div",Object.assign({style:i,ref:r.setFloating},{children:t(ui,{children:[t(di,{children:[e(fi,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{const e=s.selection;s.deleteBlock({at:e}),s.setBlockSelected(null),s.setSelection(null),n()}},{children:[e(ei,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(fi,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{s.duplicateBlock({at:s.selection,focus:!0}),s.setBlockSelected(null),n()}},{children:[e(Xr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!k&&!x&&!(null===(c=s.blocks[(null==b?void 0:b.type)||""])||void 0===c?void 0:c.hasCustomEditor)&&t(fi,{children:[v&&e(Mr,Object.assign({id:"yoo-block-options-portal",root:document.getElementById("yoopta-editor")},{children:e(Ir,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>p(!1)},{children:e("div",Object.assign({style:O,ref:h.setFloating},{children:e(k,Object.assign({},E))}))}))})),t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",ref:h.setReference,onClick:()=>p((e=>!e))},{children:[e(Wr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(fi,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{const e=N(s);e&&(ni(`${window.location.origin}${window.location.pathname}#${e.id}`),s.emit("block:copy",e)),n()}},{children:[e(Jr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var hi=Object.freeze({__proto__:null,BlockOptions:pi,BlockOptionsMenuContent:ui,BlockOptionsMenuGroup:di,BlockOptionsMenuItem:fi,BlockOptionsSeparator:({className:t})=>e("div",{className:`yoo-editor-h-[1px] yoo-editor-bg-[#37352f14] yoo-editor-my-[4px] yoo-editor-w-full ${t}`})});const yi=({block:o,editor:n,dragHandleProps:r,onChangeActiveBlock:i,showActions:a})=>{const[l,c]=f(!1),{isActionMenuOpen:s,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:y,actionMenuRenderProps:g,ActionMenu:v}=(({editor:e})=>{const t=ci().ActionMenu,[o,n]=f(!1),{refs:r,floatingStyles:i,context:a}=Pr({placement:"bottom-start",open:o,onOpenChange:n,middleware:[Un(),Hn(),zn(),On(10)],whileElementsMounted:Fn}),{isMounted:l,styles:c}=Ur(a,{duration:100}),s=Object.assign(Object.assign({},i),c),d=e=>n(e),u=()=>d(!1),p=si({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:l,actionMenuStyles:s,actionMenuRefs:r,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:n}),{refs:m,floatingStyles:b,context:x}=Pr({placement:"right-start",open:l,onOpenChange:c,middleware:[Un(),Hn(),zn(),On()]}),{isMounted:k,styles:O}=Ur(x,{duration:100}),{setActivatorNodeRef:E,attributes:C,listeners:D}=r,R=Object.assign(Object.assign({},b),O);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":a,className:'yoo-editor-flex yoo-editor-absolute -yoo-editor-left-[50px] yoo-editor-top-[2px] yoo-editor-opacity-0 yoo-editor-transition-opacity yoopta-element-actions data-[hovered-state-open="true"]:yoo-editor-opacity-100'},{children:[s&&u&&e(Mr,Object.assign({id:"yoo-block-options-portal",root:document.getElementById("yoopta-editor")},{children:e(Ir,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:y},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(v,Object.assign({},g))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=No(n,{at:[o.meta.order]});if(!t)return;const r=document.querySelector(`[data-yoopta-block-id="${o.id}"]`),i=S.string(t,[0]),a=ii(n.blocks[o.type].elements),l=0===i.trim().length;if(u&&l&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))n.setSelection([o.meta.order]),n.focusBlock(o.id),d.setReference(r),h(!0);else{const e=Q({id:G()}),t=[o.meta.order+1];n.setSelection([o.meta.order]),n.insertBlock(e,{at:t,focus:!0}),u&&setTimeout((()=>{r&&d.setReference(r.nextSibling),h(!0)}),0)}},className:"yoo-editor-cursor-pointer yoo-editor-rounded-[6px] yoo-editor-h-[24px] yoo-editor-flex yoo-editor-items-center yoo-editor-justify-center yoo-editor-bg-inherit yoo-editor-bg-transparent yoo-editor-transition-colors yoo-editor-duration-[180ms] yoo-editor-ease-[cubic-bezier(0.4,0,0.2,1)] yoo-editor-relative yoo-editor-w-[18px] yoo-editor-p-0 yoo-editor-text-[rgba(55,53,47,0.35)] yoo-editor-m-[0_1px] hover:yoo-editor-bg-[rgba(55,54,47,0.08)] focus:yoo-editor-bg-[rgba(55,54,47,0.08)] active:yoo-editor-bg-[rgba(55,54,47,0.08)] yoo-editor-w-[24px] yoopta-element-actions-plus"},{children:e(Lo,{})})),e("button",Object.assign({type:"button",className:"yoo-editor-cursor-pointer yoo-editor-rounded-[6px] yoo-editor-h-[24px] yoo-editor-flex yoo-editor-items-center yoo-editor-justify-center yoo-editor-bg-inherit yoo-editor-bg-transparent yoo-editor-transition-colors yoo-editor-duration-[180ms] yoo-editor-ease-[cubic-bezier(0.4,0,0.2,1)] yoo-editor-relative yoo-editor-w-[18px] yoo-editor-p-0 yoo-editor-text-[rgba(55,53,47,0.35)] yoo-editor-m-[0_1px] hover:yoo-editor-bg-[rgba(55,54,47,0.08)] focus:yoo-editor-bg-[rgba(55,54,47,0.08)] active:yoo-editor-bg-[rgba(55,54,47,0.08)] yoopta-element-actions-drag",ref:e=>{E(e),m.setReference(e)}},C,D,{onClick:e=>{e.stopPropagation(),i(o.id);const t=No(n,{at:[o.meta.order]});n.focusBlock(o.id),t&&setTimeout((()=>{n.blocks[o.type].hasCustomEditor||(w.blur(t),w.deselect(t),_.deselect(t)),n.setBlockSelected([o.meta.order],{only:!0}),n.setSelection([o.meta.order]),c(!0)}),10)}},{children:e(To,{})})),e(pi,{isOpen:k,refs:m,style:R,onClose:()=>c(!1)})]}))},gi=({children:o,block:n,blockId:r})=>{var i;const a=z(),[l,c]=f(null),{attributes:s,listeners:d,setNodeRef:u,setActivatorNodeRef:p,transform:h,transition:y,isOver:g,isDragging:v}=Co({id:r,disabled:a.readOnly}),m={transform:h?`translate3d(${h.x}px, ${h.y}px, 0)`:"none",transition:y,opacity:v?.7:1,marginLeft:20*n.meta.depth+"px"},b=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(n.meta.order),w=l===r,x={borderBottom:g&&!v?"2px solid #007aff":"none"};return t("div",Object.assign({ref:u,className:"yoo-editor-relative yoo-editor-py-0 yoo-editor-px-[2px] yoo-editor-mt-[2px] yoo-editor-mb-[1px] yoo-editor-rounded yoopta-block-wrapper",onMouseEnter:()=>{a.readOnly||c(r)},onMouseLeave:()=>{a.readOnly||c(null)},style:m,"data-hovered-block":w,"data-yoopta-block":!0,"data-yoopta-block-id":r},{children:[!a.readOnly&&e(yi,{block:n,editor:a,dragHandleProps:{setActivatorNodeRef:p,attributes:s,listeners:d},showActions:w,onChangeActiveBlock:e=>c(e)}),e("div",Object.assign({style:x},{children:o})),b&&!a.readOnly&&e("div",{className:"yoo-editor-absolute yoo-editor-left-0 yoo-editor-top-0 yoo-editor-bg-[#2383e224] yoo-editor-z-[90] yoo-editor-rounded yoo-editor-opacity-100 yoo-editor-h-full yoo-editor-w-full yoo-editor-pointer-events-none yoopta-selection-block"})]}))};function vi(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;var mi={};Object.defineProperty(mi,"__esModule",{value:!0});for(var bi="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),wi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},xi={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:bi?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},ki={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Oi=1;Oi<20;Oi++)ki["f"+Oi]=111+Oi;function Ei(e,t,o){t&&!("byKey"in t)&&(o=t,t=null),Array.isArray(e)||(e=[e]);var n=e.map((function(e){return Ci(e,t)})),r=function(e){return n.some((function(t){return Si(t,e)}))};return null==o?r:r(o)}function Ci(e,t){var o=t&&t.byKey,n={},r=(e=e.replace("++","+add")).split("+"),i=r.length;for(var a in wi)n[wi[a]]=!1;var l=!0,c=!1,s=void 0;try{for(var d,u=r[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Di(f),y=wi[h];if(f.length>1&&!y&&!xi[f]&&!ki[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&y||(o?n.key=h:n.which=_i(f)),y&&(n[y]=!p||null)}}catch(e){c=!0,s=e}finally{try{!l&&u.return&&u.return()}finally{if(c)throw s}}return n}function Si(e,t){for(var o in e){var n=e[o],r=void 0;if(null!=n&&((null!=(r="key"===o&&null!=t.key?t.key.toLowerCase():"which"===o?91===n&&93===t.which?91:t.which:t[o])||!1!==n)&&r!==n))return!1}return!0}function _i(e){return e=Di(e),ki[e]||e.toUpperCase().charCodeAt(0)}function Di(e){return e=e.toLowerCase(),e=xi[e]||e}mi.default=Ei,mi.isHotkey=Ei,mi.isCodeHotkey=function(e,t){return Ei(e,t)};var Ri=mi.isKeyHotkey=function(e,t){return Ei(e,{byKey:!0},t)};mi.parseHotkey=Ci,mi.compareHotkey=Si,mi.toKeyCode=_i,mi.toKeyName=Di;const ji={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"},Bi={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"},Ai={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ti=e=>{const t=ji[e],o=Bi[e],n=Ai[e],r=t&&Ri(t),i=o&&Ri(o),a=n&&Ri(n);return e=>!(!r||!r(e))||(!(!i||!i(e))||!(!a||!a(e)))},Mi={isBold:Ti("bold"),isCompose:Ti("compose"),isArrowLeft:Ti("arrowLeft"),isArrowRight:Ti("arrowRight"),isArrowUp:Ti("arrowUp"),isArrowDown:Ti("arrowDown"),isDeleteBackward:Ti("deleteBackward"),isDeleteForward:Ti("deleteForward"),isDeleteLineBackward:Ti("deleteLineBackward"),isDeleteLineForward:Ti("deleteLineForward"),isDeleteWordBackward:Ti("deleteWordBackward"),isDeleteWordForward:Ti("deleteWordForward"),isExtendBackward:Ti("extendBackward"),isExtendForward:Ti("extendForward"),isExtendLineBackward:Ti("extendLineBackward"),isExtendLineForward:Ti("extendLineForward"),isItalic:Ti("italic"),isMoveLineBackward:Ti("moveLineBackward"),isMoveLineForward:Ti("moveLineForward"),isCtrlLeft:Ti("ctrlLeft"),isCtrlRight:Ti("ctrlRight"),isRedo:Ti("redo"),isShiftEnter:Ti("shiftEnter"),isEnter:Ti("enter"),isTransposeCharacter:Ti("transposeCharacter"),isUndo:Ti("undo"),isSpace:Ti("space"),isSelect:Ti("select"),isTab:Ti("tab"),isShiftTab:Ti("shiftTab"),isBackspace:Ti("backspace"),isCmdEnter:Ti("cmdEnter"),isCmd:Ti("cmd"),isEscape:Ti("escape"),isSlashCommand:Ti("slashCommand"),isShiftArrowUp:Ti("shiftArrowUp"),isShiftArrowDown:Ti("shiftArrowDown"),isKekceburek:Ti("kekCeburek")};const Li={onKeyDown:function(e){return t=>{const o=No(e,{at:e.selection});if(!o||!o.selection)return;const n=D.parent(o.selection.anchor.path);if(Mi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void o.insertText("\n")}if(Mi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const r=S.isStart(o,o.selection.anchor,n),i=S.isEnd(o,o.selection.anchor,n);if(!r&&!i)return void e.splitBlock({slate:o,focus:!0});const a=Q({id:G()}),l=e.selection?[e.selection[0]+1]:[0];e.insertBlock(a,{at:l,slate:o,focus:!0})}else if(Mi.isBackspace(t)){if(t.isDefaultPrevented())return;const n=N(e,{at:e.selection}),r=e.blocks[(null==n?void 0:n.type)||""],i=D.parent(o.selection.anchor.path);if(S.isStart(o,o.selection.anchor,i)){t.preventDefault();const n=S.string(o,i),a=e.selection?e.selection[0]-1:0,l=No(e,{at:[a]});let c;if(l&&!r.hasCustomEditor&&(c=function(e,t){const[,o]=S.last(e,t);return{path:o,offset:S.string(e,o).length}}(l,i)),0===n.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:c});{if(R.isExpanded(o.selection))return _.delete(o,{at:o.selection});if(!l)return;if(0===S.string(l,[0,0]).length)return e.deleteBlock({at:[a],focus:!0,focusAt:c});const t=Array.from(S.nodes(o,{at:[0],match:e=>!S.isEditor(e)&&(j.isText(e)||S.isInline(o,e)),mode:"highest"})).map((([e])=>e));return _.insertNodes(l,t,{at:S.end(l,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:c})}}}else{if(Mi.isSelect(t)){if(t.isDefaultPrevented())return;const[,n]=S.first(o,[0]),[,r]=S.last(o,[o.children.length-1]),i=S.range(o,n,r),a=R.equals(o.selection,i);if(R.isExpanded(o.selection)&&a)return t.preventDefault(),w.blur(o),w.deselect(o),_.deselect(o),void e.setBlockSelected([],{allSelected:!0})}if(Mi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(Mi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(Mi.isArrowUp(t)){if(t.isDefaultPrevented())return;const n=D.parent(o.selection.anchor.path);if(S.isStart(o,o.selection.anchor,n)){const o=e.selection?[e.selection[0]-1]:null,n=No(e,{at:o}),r=N(e,{at:o});if(n&&r){const[,o]=S.last(n,[0]),i={path:o,offset:S.string(n,o).length};return t.preventDefault(),void e.focusBlock(r.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(Mi.isArrowDown(t)){if(t.isDefaultPrevented())return;const n=D.parent(o.selection.anchor.path);if(S.isEnd(o,o.selection.anchor,n)){const o=e.selection?[e.selection[0]+1]:null,r=No(e,{at:o}),i=N(e,{at:o});if(r&&i){const o=function(e,t){const[,o]=S.first(e,t);return{path:o,offset:0}}(r,n);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:o,waitExecution:!1})}}}if(R.isExpanded(o.selection)){if(Object.values(e.formats).length>0)for(const o of Object.values(e.formats))if(o.hotkey&&Ri(o.hotkey)(t)){t.preventDefault(),e.formats[o.type].toggle();break}}}}}},Ni=({children:t,attributes:o,placeholder:n})=>{const r=x(),i=Object.assign({},o);return r&&n&&(i["data-placeholder"]=n,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Ii(e){try{return new URL(e),!0}catch(e){return!1}}const Pi=(e,t)=>{(e=>{const[t]=S.nodes(e,{match:e=>!S.isEditor(e)&&B.isElement(e)&&"link"===e.type});return!!t})(e)&&(e=>{_.unwrapNodes(e,{match:e=>!S.isEditor(e)&&B.isElement(e)&&"link"===e.type})})(e);const{selection:o}=e,n=o&&R.isCollapsed(o),r={type:"link",children:n?[{text:t}]:[],props:{url:t,target:"_blank",rel:"noreferrer"}};n?_.insertNodes(e,r):(_.wrapNodes(e,r,{split:!0}),_.collapse(e,{edge:"end"}))};function Fi(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const zi={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"code"}};function Hi(e,t,o){var n,r,i;if(3===o.nodeType){return null===(n=o.textContent)||void 0===n?void 0:n.replace(/[\t\n\r\f\v]+/g," ")}if(1!==o.nodeType)return null;if("BR"===o.nodeName)return"\n";const a=o;let l=Array.from(a.childNodes).map((o=>Hi(e,t,o))).flat();if(zi[o.nodeName]){return{[zi[o.nodeName].type]:!0,text:null===(r=o.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(t[o.nodeName]){const n=t[o.nodeName],r=e.blocks[n.type],a=ri(r.elements)||"",c=r.elements[a],s="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:G(),type:a,children:s&&!r.hasCustomEditor?[{text:""}]:l.map(Ui),props:Object.assign({nodeType:"block"},c.props)};if(n.parse){const e=n.parse(o);if(e)if(B.isElement(e))d=e;else if(Array.isArray(e)){return e}}0===d.children.length&&(d.children=[{text:""}]);return Q({id:G(),type:n.type,value:[d],meta:{order:0,depth:0}})}return l}function Ui(e){if("string"==typeof e)return{text:e};if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(Fi(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}const Vi={html:{deserialize:function(e,t){console.log("pasted html",t);const o=function(e){const t={};return Object.keys(e.plugins).forEach((o=>{const n=e.plugins[o],{parsers:r}=n;if(r){const{html:e}=r;if(e){const{deserialize:n}=e;if(n){const{nodeNames:e}=n;e&&e.forEach((e=>{t[e]={type:o,parse:n.parse}}))}}}})),t}(e);return Hi(e,o,t).filter(Fi)},serialize:function(){}},markdown:{}},Ki=({id:t,customEditor:o,elements:n,marks:r,events:i,options:a,placeholder:c="Type '/' for commands"})=>{var s,f,p;const h=z(),y=H(t),g=l(y.value).current,v=y.type,m=d((()=>(e=>{const t={};return Object.keys(e).forEach((o=>t[o]=e[o].render)),t})(n)),[n]),b=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(r)),[r]),w=d((()=>{let e=h.blockEditorsMap[t];return Object.keys(n).forEach((t=>{var o;const r=null===(o=n[t].props)||void 0===o?void 0:o.nodeType,i="inline"===r,a="void"===r,l="inlineVoid"===r;l&&(e.markableVoid=e=>e.type===t),(a||l)&&(e.isVoid=e=>e.type===t),(i||l)&&(e.isInline=e=>e.type===t,e=(e=>{const{insertData:t,insertText:o}=e;return e.insertText=t=>{t&&Ii(t)?Pi(e,t):o(t)},e.insertData=o=>{const n=o.getData("text/plain");n&&Ii(n)?Pi(e,n):t(o)},e})(e))})),e}),[]),x=d((()=>{if(!i||h.readOnly)return{};const e={hotkeys:Mi,currentBlock:y,defaultBlock:Q({id:G()})},t={};return Object.keys(i).forEach((o=>{t[o]=function(t){if(i[o]){i[o](h,w,e)(t)}}})),t}),[i,h,y]),k=u((e=>h.updateBlock(t,{value:e})),[t]),O=u((o=>{const n=m[o.element.type];return n?e(n,Object.assign({},o,{blockId:t,HTMLAttributes:null==a?void 0:a.HTMLAttributes})):e(E,Object.assign({},o))}),[n]),C=u((t=>{var o,n,r,i,a;let{children:l,leaf:s,attributes:d}=t;const u=vi(s,["text"]),f=(null===(o=h.selection)||void 0===o?void 0:o[0])===y.meta.order;u&&Object.keys(u).forEach((e=>{const t=b[e];t&&(l=t.render({children:l,leaf:s}))}));const p=!("void"===(null===(a=null===(i=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===i?void 0:i.props)||void 0===a?void 0:a.nodeType))&&f&&s.withPlaceholder;return e(Ni,Object.assign({attributes:d,placeholder:p?c:void 0},{children:l}))}),[r]),_=u((e=>{var t;h.readOnly||(null===(t=x.onKeyDown)||void 0===t||t.call(x,e),Li.onKeyDown(h)(e))}),[x.onKeyDown,h.readOnly,null===(s=h.selection)||void 0===s?void 0:s[0],y.meta.order]),D=u((e=>{var t;h.readOnly||null===(t=null==x?void 0:x.onKeyUp)||void 0===t||t.call(x,e)}),[x.onKeyUp,h.readOnly]),j=u((e=>{var t,o;h.readOnly||((null===(t=h.selection)||void 0===t?void 0:t[0])!==y.meta.order&&h.setSelection([y.meta.order]),null===(o=null==x?void 0:x.onClick)||void 0===o||o.call(x,e))}),[x.onClick,h.readOnly,null===(f=h.selection)||void 0===f?void 0:f[0],y.meta.order]),B=u((e=>{var t;h.readOnly||(e.preventDefault(),null===(t=null==x?void 0:x.onBlur)||void 0===t||t.call(x,e))}),[x.onBlur,h.readOnly]),A=u((e=>{var t;h.readOnly||null===(t=null==x?void 0:x.onFocus)||void 0===t||t.call(x,e)}),[x.onFocus,h.readOnly]),T=u((e=>{var t;if(h.readOnly)return;null===(t=null==x?void 0:x.onPaste)||void 0===t||t.call(x,e);const o=e.clipboardData.getData("text/html"),n=(new DOMParser).parseFromString(o,"text/html");if(n.body.childNodes.length>0){const e=Vi.html.deserialize(h,n.body);if(e.length>0)return void h.insertBlocks(e,{at:h.selection,focus:!0})}}),[x.onPaste,h.readOnly]),M=u((e=>{var t;const o=[];if(h.readOnly)return o;const[n,r]=e,i=(null===(t=h.selection)||void 0===t?void 0:t[0])===y.meta.order;return w.selection&&i&&!S.isEditor(n)&&""===S.string(w,[r[0]])&&R.includes(w.selection,r)&&R.isCollapsed(w.selection)&&o.push(Object.assign(Object.assign({},w.selection),{withPlaceholder:!0})),o}),[h.readOnly,null===(p=h.selection)||void 0===p?void 0:p[0],y.meta.order]);return e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":v},{children:e(Wi,{id:t,slate:w,initialValue:g,onChange:k,decorate:M,renderLeaf:C,renderElement:O,eventHandlers:x,onKeyDown:_,onKeyUp:D,onFocus:A,onClick:j,onBlur:B,customEditor:o,readOnly:h.readOnly,onPaste:T})}))},Wi=p((({id:t,slate:o,initialValue:n,onChange:r,renderLeaf:i,renderElement:a,eventHandlers:l,onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,onBlur:f,onPaste:p,customEditor:h,decorate:y,readOnly:g})=>"function"==typeof h?h({blockId:t}):e(k,Object.assign({editor:o,initialValue:n,onChange:r},{children:e(O,Object.assign({id:`yoopta-slate-editor-${t}`,renderElement:a,renderLeaf:i,className:"focus-visible:yoo-editor-outline-none focus:yoo-editor-outline-none",spellCheck:!0},l,{onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,decorate:y,onBlur:f,readOnly:g,onPaste:p}),`editable-${t}`)}),`slate-${t}`)));Wi.displayName="SlateEditorInstance";const Yi=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return d((()=>[...t].filter((e=>null!=e))),[...t])}(Te(Et,{activationConstraint:{delay:100,tolerance:0}}),Te(bt,{coordinateGetter:Do})),handleDragEnd:u((t=>{const{active:o,over:n}=t;if(o&&n&&o.id!==n.id){const t=e.children[n.id].meta.order;e.moveBlock(o.id,[t])}}),[]),handleDragStart:u((t=>{e.setBlockSelected(null)}),[])}),$i=[],Xi=({editor:t,marks:n,placeholder:r})=>{const i=K(),{sensors:a,handleDragEnd:l,handleDragStart:c}=Yi({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?$i:s.sort(((e,o)=>t.children[e].meta.order-t.children[o].meta.order))),[s]),f=[];for(let o=0;o<u.length;o++){const i=u[o],a=t.children[i],l=t.plugins[a.type];a&&l?f.push(e(gi,Object.assign({block:a,blockId:i},{children:e(Ki,{type:a.type,id:i,marks:n,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,placeholder:r},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e(o,{children:f}):e(oo,Object.assign({sensors:a,collisionDetection:He,onDragStart:c,onDragEnd:l},{children:e(mo,Object.assign({disabled:i,items:u,strategy:yo},{children:f}))}))},Zi=({editor:e,yooptaEditorRef:t,root:o})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),i=i=>{var a;if(e.readOnly||!1===o)return;const l=null===(a=t.current)||void 0===a?void 0:a.contains(i.target);if(!l&&!n.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();l||r({origin:[i.pageX,i.pageY-window.pageYOffset],coords:[i.pageX,i.pageY-window.pageYOffset],selection:!0})},a=t=>{if(!n.selection||e.readOnly||!1===o)return;r((e=>Object.assign(Object.assign({},e),{coords:[t.pageX,t.pageY-window.pageYOffset]})));const i=((e,t)=>{const o=[];return document.querySelectorAll("[data-yoopta-block]").forEach(((n,r)=>{if(!n)return;const i=n.getBoundingClientRect(),a=Math.min(e[1],t[1]),l=Math.min(e[0],t[0]),c=Math.max(e[1],t[1]),s=Math.max(e[0],t[0]);a<i.bottom&&c>i.top&&l<i.right&&s>i.left&&o.push(r)})),o})(n.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(i,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var n;if(e.readOnly||!1===o)return;const r=o&&"current"in o?o.current:o||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=t.current)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",i),r.addEventListener("mousemove",a),r.addEventListener("mouseup",l),()=>{r.removeEventListener("mousedown",i),r.removeEventListener("mousemove",a),r.removeEventListener("mouseup",l)}}),[e.selectedBlocks,n,o,e.readOnly]);const c=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:c})},qi=({origin:t,coords:o,isOpen:n})=>{if(!n)return null;const r={zIndex:10,left:t[0],top:t[1],height:Math.abs(o[1]-t[1]-1),width:Math.abs(o[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>o[1]&&t[0]>o[0]?"scaleY(-1) scaleX(-1)":t[1]>o[1]?"scaleY(-1)":t[0]>o[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:r})},Gi={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Ji=({placeholder:o,marks:n,className:r,selectionBoxRoot:i,width:a,autoFocus:c=!0})=>{const d=z(),u=K(),f=l(null),p=Zi({editor:d,yooptaEditorRef:f,root:i});let h=l(Gi).current;s((()=>{if(!c||u)return;const e=N(d,{at:[0]});e&&d.focusBlock(e.id,{waitExecution:!0})}),[c,u]),s((()=>{if(!u)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[d.selectedBlocks,u]);const y=()=>{u||Array.isArray(d.selectedBlocks)&&d.selectedBlocks.length>0&&d.setBlockSelected(null)},g=()=>{h.indexToSelect=null,h.startedIndexToSelect=null,h.selectionStarted=!1},v=e=>{var t,o,n,r,i;if(!u){if(Mi.isSelect(e)){if((null===(t=d.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(d.children).length)return void e.preventDefault();if(h.selectionStarted)return e.preventDefault(),void d.setBlockSelected([],{allSelected:!0})}if(Mi.isBackspace(e)){e.stopPropagation();if(Array.isArray(d.selectedBlocks)&&(null===(o=d.selectedBlocks)||void 0===o?void 0:o.length)===Object.keys(d.children).length)return e.preventDefault(),d.deleteBlock({deleteAll:!0}),d.setBlockSelected(null),void g();if(Array.isArray(d.selectedBlocks)&&(null===(n=d.selectedBlocks)||void 0===n?void 0:n.length)>0)return e.preventDefault(),d.deleteBlock({fromPaths:d.selectedBlocks}),d.setBlockSelected(null),void g()}if(Mi.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(h.selectionStarted&&null!==h.startedIndexToSelect&&null!==h.indexToSelect){const e=h.indexToSelect,t=e-1;if(0===e)return;if(e===h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if(t<h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if((null===(r=d.selectedBlocks)||void 0===r?void 0:r.includes(e))&&e!==h.startedIndexToSelect){const o=d.selectedBlocks.filter((t=>t!==e));return d.setBlockSelected(o,{only:!0}),void(h.indexToSelect=t)}return}const t=N(d),o=No(d);if(!o||!o.selection||!t)return;const n=D.parent(o.selection.anchor.path),i=S.isStart(o,o.selection.focus,n);if(R.isExpanded(o.selection)&&i){const n=d.selection?[d.selection[0]-1]:[0],r=N(d,{at:n});t&&r&&(e.preventDefault(),w.blur(o),w.deselect(o),_.deselect(o),d.setSelection(null),d.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),h.startedIndexToSelect=t.meta.order,h.indexToSelect=t.meta.order-1,h.selectionStarted=!0)}}if(Mi.isShiftArrowDown(e)){if(h.selectionStarted&&null!==h.indexToSelect&&null!==h.startedIndexToSelect){const e=h.indexToSelect,t=e+1;if(t===Object.keys(d.children).length)return;if(e===h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if(t>h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if((null===(i=d.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==h.startedIndexToSelect){const o=d.selectedBlocks.filter((t=>t!==e));return d.setBlockSelected(o,{only:!0}),void(h.indexToSelect=t)}return}const t=N(d),o=No(d);if(!o||!o.selection||!t)return;const n=D.parent(o.selection.anchor.path),r=S.isEnd(o,o.selection.focus,n);if(R.isExpanded(o.selection)&&r){const n=d.selection?[d.selection[0]+1]:[0],r=N(d,{at:n});t&&r&&(e.preventDefault(),w.blur(o),w.deselect(o),_.deselect(o),d.setSelection(null),d.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),h.startedIndexToSelect=t.meta.order,h.indexToSelect=t.meta.order+1,h.selectionStarted=!0)}}}},m=(b={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:a},Object.assign({paddingBottom:150},b));var b;return t("div",Object.assign({id:"yoopta-editor",className:r,style:m,ref:f,onClick:e=>{u||(g(),(e=>{var t;const o=f.current;if(!o)return;const{bottom:n}=o.getBoundingClientRect(),r=n-parseInt(getComputedStyle(o).paddingBottom,10),i=Q({id:G()});if(e.clientY>=r){const e=Object.keys(d.children).length-1,o=N(d,{at:[e]}),n=No(d,{at:[e]});if(o&&n&&n.selection){const e=S.string(n,n.selection.anchor.path),r=D.parent(n.selection.anchor.path),[a]=S.node(n,r);if(o.type===i.type&&B.isElement(a)&&"void"!==(null===(t=a.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void d.focusBlock(o.id,{slate:n})}const r=e+1;d.insertBlock(i,{at:[r],focus:!0})}})(e),y())},onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||u||(g(),y())}},{children:[e(Xi,{editor:d,marks:n,placeholder:o}),!1!==i&&e(qi,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!u})]}))},Qi=({children:e,fallback:t=null})=>{const[o,n]=f(!1);return s((()=>n(!0)),[]),o?e:t};
|
|
6
|
+
var Zn=["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(","),qn="undefined"==typeof Element,Gn=qn?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jn=!qn&&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},Qn=function e(t,o){var n;void 0===o&&(o=!0);var r=null==t||null===(n=t.getAttribute)||void 0===n?void 0:n.call(t,"inert");return""===r||"true"===r||o&&t&&e(t.parentNode)},er=function e(t,o,n){for(var r=[],i=Array.from(t);i.length;){var a=i.shift();if(!Qn(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),c=e(l.length?l:a.children,!0,n);n.flatten?r.push.apply(r,c):r.push({scopeParent:a,candidates:c})}else{Gn.call(a,Zn)&&n.filter(a)&&(o||!t.includes(a))&&r.push(a);var s=a.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(a),d=!Qn(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(s&&d){var u=e(!0===s?a.children:s.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},tr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},or=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,o=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===o||"true"===o}(e))&&!tr(e)?0:e.tabIndex},nr=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},rr=function(e){return"INPUT"===e.tagName},ir=function(e){return function(e){return rr(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,o=e.form||Jn(e),n=function(e){return o.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=n(window.CSS.escape(e.name));else try{t=n(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]}(t,e.form);return!r||r===e}(e)},ar=function(e){var t=e.getBoundingClientRect(),o=t.width,n=t.height;return 0===o&&0===n},lr=function(e,t){var o=t.displayCheck,n=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Gn.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Gn.call(r,"details:not([open]) *"))return!0;if(o&&"full"!==o&&"legacy-full"!==o){if("non-zero-area"===o)return ar(e)}else{if("function"==typeof n){for(var i=e;e;){var a=e.parentElement,l=Jn(e);if(a&&!a.shadowRoot&&!0===n(a))return ar(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,o,n,r,i=e&&Jn(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(o=a)&&void 0!==o&&null!==(n=o.ownerDocument)&&void 0!==n&&n.contains(a)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!l&&a;){var c,s,d;l=!(null===(s=a=null===(c=i=Jn(a))||void 0===c?void 0:c.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==o)return!0}return!1},cr=function(e,t){return!(t.disabled||Qn(t)||function(e){return rr(e)&&"hidden"===e.type}(t)||lr(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var o=0;o<t.children.length;o++){var n=t.children.item(o);if("LEGEND"===n.tagName)return!!Gn.call(t,"fieldset[disabled] *")||!n.contains(e)}return!0}t=t.parentElement}return!1}(t))},sr=function(e,t){return!(ir(t)||or(t)<0||!cr(e,t))},dr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ur=function e(t){var o=[],n=[];return t.forEach((function(t,r){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var o=or(e);return o<0&&t&&!tr(e)?0:o}(a,i),c=i?e(t.candidates):a;0===l?i?o.push.apply(o,c):o.push(a):n.push({documentOrder:r,tabIndex:l,item:t,isScope:i,content:c})})),n.sort(nr).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(o)},fr=function(e,t){var o;return o=(t=t||{}).getShadowRoot?er([e],t.includeContainer,{filter:sr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:dr}):function(e,t,o){if(Qn(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(Zn));return t&&Gn.call(e,Zn)&&n.unshift(e),n.filter(o)}(e,t.includeContainer,sr.bind(null,t)),ur(o)};const pr=n["useInsertionEffect".toString()]||(e=>e());var hr="undefined"!=typeof document?c:s;function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},yr.apply(this,arguments)}let gr=!1,vr=0;const mr=()=>"floating-ui-"+vr++;const br=n["useId".toString()]||function(){const[e,t]=n.useState((()=>gr?mr():void 0));return hr((()=>{null==e&&t(mr())}),[]),n.useEffect((()=>{gr||(gr=!0)}),[]),e};const wr=n.createContext(null),xr=n.createContext(null);function kr(e){return"data-floating-ui-"+e}function Or(e){const t=l(e);return hr((()=>{t.current=e})),t}const Er=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cr(e,t){const o=fr(e,Er());"prev"===t&&o.reverse();const n=o.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(o=t)||null==(o=o.shadowRoot)?void 0:o.activeElement);){var o;t=t.shadowRoot.activeElement}return t}((null==(r=e)?void 0:r.ownerDocument)||document));var r;return o.slice(n+1)[0]}function Sr(e,t){const o=t||e.currentTarget,n=e.relatedTarget;return!n||!function(e,t){if(!e||!t)return!1;const o=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&Vo(o)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}(o,n)}function _r(e){fr(e,Er()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Dr(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const Rr={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 jr(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Br=n.forwardRef((function(e,t){const[o,r]=n.useState();hr((()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",jr),()=>{document.removeEventListener("keydown",jr)})),[]);const i={ref:t,tabIndex:0,role:o,"aria-hidden":!o||void 0,[kr("focus-guard")]:"",style:Rr};return n.createElement("span",yr({},e,i))})),Ar=n.createContext(null),Tr=kr("portal");function Mr(e){let{children:t,id:o,root:r=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:o}=void 0===e?{}:e;const[r,i]=n.useState(null),a=br(),l=Lr(),c=n.useRef(null);return hr((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{c.current=null}))}),[r]),hr((()=>{if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const o=document.createElement("div");o.id=a,o.setAttribute(Tr,""),e.appendChild(o),c.current=o,i(o)}),[t,a]),hr((()=>{if(c.current)return;let e=o||(null==l?void 0:l.portalNode);e&&!Ho(e)&&(e=e.current),e=e||document.body;let n=null;t&&(n=document.createElement("div"),n.id=t,e.appendChild(n));const r=document.createElement("div");r.id=a,r.setAttribute(Tr,""),e=n||e,e.appendChild(r),c.current=r,i(r)}),[t,o,a,l]),r}({id:o,root:r}),[l,c]=n.useState(null),s=n.useRef(null),d=n.useRef(null),u=n.useRef(null),f=n.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!r&&!a);return n.useEffect((()=>{if(a&&i&&(null==l||!l.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&Sr(e)){("focusin"===e.type?Dr:_r)(a)}}}),[a,i,null==l?void 0:l.modal]),n.createElement(Ar.Provider,{value:n.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:a,setFocusManagerState:c})),[i,a])},p&&a&&n.createElement(Br,{"data-type":"outside",ref:s,onFocus:e=>{if(Sr(e,a)){var t;null==(t=u.current)||t.focus()}else{const e=Cr(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&a&&n.createElement("span",{"aria-owns":a.id,style:Rr}),a&&b(t,a),p&&a&&n.createElement(Br,{"data-type":"outside",ref:d,onFocus:e=>{if(Sr(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=Cr(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))}const Lr=()=>n.useContext(Ar),Nr=new Set,Ir=n.forwardRef((function(e,t){let{lockScroll:o=!1,...r}=e;const i=br();return hr((()=>{if(!o)return;Nr.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,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,o=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(o))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Nr.delete(i),0===Nr.size&&(Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[i,o]),n.createElement("div",yr({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Pr(e){var t;void 0===e&&(e={});const{open:o=!1,onOpenChange:r,nodeId:i}=e,[a,l]=n.useState(null),c=(null==(t=e.elements)?void 0:t.reference)||a,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:s,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=n.useState(r);Wn(p,r)||h(r);const[y,g]=n.useState(null),[m,b]=n.useState(null),w=n.useCallback((e=>{e!==E.current&&(E.current=e,g(e))}),[]),x=n.useCallback((e=>{e!==C.current&&(C.current=e,b(e))}),[]),k=a||y,O=l||m,E=n.useRef(null),C=n.useRef(null),S=n.useRef(u),_=null!=s,D=Xn(s),R=Xn(i),j=n.useCallback((()=>{if(!E.current||!C.current)return;const e={placement:t,strategy:o,middleware:p};R.current&&(e.platform=R.current),Vn(E.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};B.current&&!Wn(S.current,t)&&(S.current=t,v.flushSync((()=>{f(t)})))}))}),[p,t,o,R]);Kn((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const B=n.useRef(!1);Kn((()=>(B.current=!0,()=>{B.current=!1})),[]),Kn((()=>{if(k&&(E.current=k),O&&(C.current=O),k&&O){if(D.current)return D.current(k,O,j);j()}}),[k,O,j,D,_]);const A=n.useMemo((()=>({reference:E,floating:C,setReference:w,setFloating:x})),[w,x]),T=n.useMemo((()=>({reference:k,floating:O})),[k,O]),M=n.useMemo((()=>{const e={position:o,left:0,top:0};if(!T.floating)return e;const t=$n(T.floating,u.x),n=$n(T.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Yn(T.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}}),[o,c,T.floating,u.x,u.y]);return n.useMemo((()=>({...u,update:j,refs:A,elements:T,floatingStyles:M})),[u,j,A,T,M])}(e),d=n.useContext(xr),u=null!=((null==(f=n.useContext(wr))?void 0:f.id)||null);var f;const p=function(e){const t=n.useRef((()=>{}));return pr((()=>{t.current=e})),n.useCallback((function(){for(var e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];return null==t.current?void 0:t.current(...o)}),[])}(((e,t,o)=>{e&&(y.current.openEvent=t),g.emit("openchange",{open:e,event:t,reason:o,nested:u}),null==r||r(e,t,o)})),h=n.useRef(null),y=n.useRef({}),g=n.useState((()=>function(){const e=new Map;return{emit(t,o){var n;null==(n=e.get(t))||n.forEach((e=>e(o)))},on(t,o){e.set(t,[...e.get(t)||[],o])},off(t,o){var n;e.set(t,(null==(n=e.get(t))?void 0:n.filter((e=>e!==o)))||[])}}}()))[0],m=br(),b=n.useCallback((e=>{const t=Ho(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=n.useCallback((e=>{(Ho(e)||null===e)&&(h.current=e,l(e)),(Ho(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!Ho(e))&&s.refs.setReference(e)}),[s.refs]),x=n.useMemo((()=>({...s.refs,setReference:w,setPositionReference:b,domReference:h})),[s.refs,w,b]),k=n.useMemo((()=>({...s.elements,domReference:c})),[s.elements,c]),O=n.useMemo((()=>({...s,refs:x,elements:k,dataRef:y,nodeId:i,floatingId:m,events:g,open:o,onOpenChange:p})),[s,i,m,g,o,p,x,k]);return hr((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=O)})),n.useMemo((()=>({...s,context:O,refs:x,elements:k})),[s,x,k,O])}const Fr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function zr(e,t){return"function"==typeof e?e(t):e}function Hr(e,t){void 0===t&&(t={});const{open:o,elements:{floating:r}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[l,c]=n.useState(!1),[s,d]=n.useState("unmounted"),u=function(e,t){const[o,r]=n.useState(e);return e&&!o&&r(!0),n.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),o}(o,a);return hr((()=>{l&&!u&&d("unmounted")}),[l,u]),hr((()=>{if(r){if(o){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}c(!0),d("close")}}),[o,r]),{isMounted:u,status:s}}function Ur(e,t){void 0===t&&(t={});const{initial:o={opacity:0},open:r,close:i,common:a,duration:l=250}=t,c=e.placement,s=c.split("-")[0],d=n.useMemo((()=>({side:s,placement:c})),[s,c]),u="number"==typeof l,f=(u?l:l.open)||0,p=(u?l:l.close)||0,[h,y]=n.useState((()=>({...zr(a,d),...zr(o,d)}))),{isMounted:g,status:v}=Hr(e,{duration:l}),m=Or(o),b=Or(r),w=Or(i),x=Or(a);return hr((()=>{const e=zr(m.current,d),t=zr(w.current,d),o=zr(x.current,d),n=zr(b.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===v&&y((t=>({transitionProperty:t.transitionProperty,...o,...e}))),"open"===v&&y({transitionProperty:Object.keys(n).map(Fr).join(","),transitionDuration:f+"ms",...o,...n}),"close"===v){const n=t||e;y({transitionProperty:Object.keys(n).map(Fr).join(","),transitionDuration:p+"ms",...o,...n})}}),[p,w,m,b,x,f,v,d]),{isMounted:g,styles:h}}var Vr;function Kr(){return Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},Kr.apply(this,arguments)}var Wr=function(e){return n.createElement("svg",Kr({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Vr||(Vr=n.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 Yr(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}var $r=["color"],Xr=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,$r);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Zr=["color"],qr=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,Zr);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Gr=["color"],Jr=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,Gr);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),Qr=["color"],ei=y((function(e,t){var o=e.color,n=void 0===o?"currentColor":o,r=Yr(e,Qr);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:t}),g("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:n,fillRule:"evenodd",clipRule:"evenodd"}))})),ti=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,o=[],n=0;n<e.rangeCount;n++)o.push(e.getRangeAt(n));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||o.forEach((function(t){e.addRange(t)})),t&&t.focus()}},oi={"text/plain":"Text","text/html":"Url",default:"Text"};var ni=function(e,t){var o,n,r,i,a,l,c=!1;t||(t={}),o=t.debug||!1;try{if(r=ti(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=oi[t.format]||oi.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(r){o&&console.error("unable to copy using execCommand: ",r),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(r){o&&console.error("unable to copy using clipboardData: ",r),o&&console.error("falling back to prompt"),n=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(n,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),r()}return c};function ri(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ii(e){if(!e)return;const t=ri(e);return t?e[t]:void 0}const ai=i(void 0),li=({children:n,tools:r})=>{const i=K(),a=d((()=>r?Object.keys(r).reduce(((e,t)=>{var o;return Object.assign(Object.assign({},e),{[t]:null===(o=r[t])||void 0===o?void 0:o.render})}),{}):{}),[r]),l=d((()=>!r||i?null:Object.keys(r).map((t=>{var o,n,i;const a=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.tool,l=null===(n=null==r?void 0:r[t])||void 0===n?void 0:n.render,c=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return a?e(a,Object.assign({render:l},c),t):null}))),[r]);return e(ai.Provider,Object.assign({value:a},{children:t(o,{children:[l,n]})}))},ci=()=>{const e=a(ai);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function si({editor:e,view:t,onClose:o,mode:n="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===n&&(t=t.filter((t=>function(e,t){var o;const n=e.blocks[t];if(!n)return!1;const r=ii(n.elements);return"void"!==(null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType)}(e,t)))),t.map((t=>{var o,n,r,i;return{type:t,title:(null===(n=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===n?void 0:n.title)||t,description:null===(i=null===(r=e.blocks[t].options)||void 0===r?void 0:r.display)||void 0===i?void 0:i.description}}))})(),onClose:o,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{"toggle"===n&&e.blocks[t].toggle({focus:!0}),"create"===n&&e.blocks[t].create({deleteText:!0,focus:!0}),o()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const di=({children:t})=>e("div",Object.assign({className:"yoo-editor-flex yoo-editor-flex-col"},{children:t})),ui=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoo-editor-bg-[#FFF] yoo-editor-relative yoo-editor-min-w-[200px] yoo-editor-w-auto yoo-editor-overflow-hidden yoo-editor-rounded-md yoo-editor-border yoo-editor-border-solid yoo-editor-border-[#e5e7eb] yoo-editor-bg-popover yoo-editor-py-[6px] yoo-editor-px-0 yoo-editor-text-popover-foreground yoo-editor-shadow-md data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),fi=({children:t})=>e("div",Object.assign({className:"yoo-editor-relative yoo-editor-flex yoo-editor-cursor-default yoo-editor-select-none yoo-editor-items-center yoo-editor-text-sm yoo-editor-outline-none yoo-editor-transition-colors focus:yoo-editor-bg-accent focus:yoo-editor-text-accent-foreground data-[disabled]:yoo-editor-pointer-events-none data-[disabled]:yoo-editor-opacity-50"},{children:t})),pi=({isOpen:o,onClose:n,refs:r,style:i,children:a})=>{var l,c;const s=z(),d=ci(),[u,p]=f(!1),{refs:h,floatingStyles:y,context:g}=Pr({placement:"right",open:u,onOpenChange:p,middleware:[Un(),Hn(),zn(),On(10)],whileElementsMounted:Fn}),{isMounted:v,styles:m}=Ur(g,{duration:100});if(!o)return null;const b=N(s,{at:s.selection}),w=ii(s.blocks[(null==b?void 0:b.type)||""].elements),x="void"===(null===(l=null==w?void 0:w.props)||void 0===l?void 0:l.nodeType),k=d.ActionMenu,O=Object.assign(Object.assign({},y),m),E=si({editor:s,view:"small",onClose:()=>{p(!1),n()}});return e(Mr,Object.assign({id:"yoo-block-options-portal",root:document.getElementById("yoopta-editor")},{children:e(Ir,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:n},{children:e("div",Object.assign({style:i,ref:r.setFloating},{children:t(ui,{children:[t(di,{children:[e(fi,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{const e=s.selection;s.deleteBlock({at:e}),s.setBlockSelected(null),s.setSelection(null),n()}},{children:[e(ei,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(fi,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{s.duplicateBlock({at:s.selection,focus:!0}),s.setBlockSelected(null),n()}},{children:[e(Xr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!k&&!x&&!(null===(c=s.blocks[(null==b?void 0:b.type)||""])||void 0===c?void 0:c.hasCustomEditor)&&t(fi,{children:[v&&e(Mr,Object.assign({id:"yoo-block-options-portal",root:document.getElementById("yoopta-editor")},{children:e(Ir,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>p(!1)},{children:e("div",Object.assign({style:O,ref:h.setFloating},{children:e(k,Object.assign({},E))}))}))})),t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",ref:h.setReference,onClick:()=>p((e=>!e))},{children:[e(Wr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(fi,{children:t("button",Object.assign({type:"button",className:"yoo-editor-rounded-sm hover:yoo-editor-bg-[#37352f14] yoo-editor-leading-[120%] yoo-editor-px-2 yoo-editor-py-1.5 yoo-editor-mx-[4px] yoo-editor-cursor-pointer yoo-editor-w-full yoo-editor-flex yoo-editor-justify-start",onClick:()=>{const e=N(s);e&&(ni(`${window.location.origin}${window.location.pathname}#${e.id}`),s.emit("block:copy",e)),n()}},{children:[e(Jr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var hi=Object.freeze({__proto__:null,BlockOptions:pi,BlockOptionsMenuContent:ui,BlockOptionsMenuGroup:di,BlockOptionsMenuItem:fi,BlockOptionsSeparator:({className:t})=>e("div",{className:`yoo-editor-h-[1px] yoo-editor-bg-[#37352f14] yoo-editor-my-[4px] yoo-editor-w-full ${t}`})});const yi=({block:o,editor:n,dragHandleProps:r,onChangeActiveBlock:i,showActions:a})=>{const[l,c]=f(!1),{isActionMenuOpen:s,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:y,actionMenuRenderProps:g,ActionMenu:v}=(({editor:e})=>{const t=ci().ActionMenu,[o,n]=f(!1),{refs:r,floatingStyles:i,context:a}=Pr({placement:"bottom-start",open:o,onOpenChange:n,middleware:[Un(),Hn(),zn(),On(10)],whileElementsMounted:Fn}),{isMounted:l,styles:c}=Ur(a,{duration:100}),s=Object.assign(Object.assign({},i),c),d=e=>n(e),u=()=>d(!1),p=si({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:l,actionMenuStyles:s,actionMenuRefs:r,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:n}),{refs:m,floatingStyles:b,context:x}=Pr({placement:"right-start",open:l,onOpenChange:c,middleware:[Un(),Hn(),zn(),On()]}),{isMounted:k,styles:O}=Ur(x,{duration:100}),{setActivatorNodeRef:E,attributes:C,listeners:D}=r,R=Object.assign(Object.assign({},b),O);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":a,className:'yoo-editor-flex yoo-editor-absolute -yoo-editor-left-[50px] yoo-editor-top-[2px] yoo-editor-opacity-0 yoo-editor-transition-opacity yoopta-element-actions data-[hovered-state-open="true"]:yoo-editor-opacity-100'},{children:[s&&u&&e(Mr,Object.assign({id:"yoo-block-options-portal",root:document.getElementById("yoopta-editor")},{children:e(Ir,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:y},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(v,Object.assign({},g))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=No(n,{at:[o.meta.order]}),r=n.blocks[o.type];if(!t)return;const i=document.querySelector(`[data-yoopta-block-id="${o.id}"]`),a=ii(r.elements);let l;r.hasCustomEditor||(l=S.string(t,[0]));const c="string"==typeof l&&0===l.trim().length;if(u&&c&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))n.setSelection([o.meta.order]),n.focusBlock(o.id),d.setReference(i),h(!0);else{const e=Q({id:G()}),t=[o.meta.order+1];n.setSelection([o.meta.order]),n.insertBlock(e,{at:t,focus:!0}),u&&setTimeout((()=>{i&&d.setReference(i.nextSibling),h(!0)}),0)}},className:"yoo-editor-cursor-pointer yoo-editor-rounded-[6px] yoo-editor-h-[24px] yoo-editor-flex yoo-editor-items-center yoo-editor-justify-center yoo-editor-bg-inherit yoo-editor-bg-transparent yoo-editor-transition-colors yoo-editor-duration-[180ms] yoo-editor-ease-[cubic-bezier(0.4,0,0.2,1)] yoo-editor-relative yoo-editor-w-[18px] yoo-editor-p-0 yoo-editor-text-[rgba(55,53,47,0.35)] yoo-editor-m-[0_1px] hover:yoo-editor-bg-[rgba(55,54,47,0.08)] focus:yoo-editor-bg-[rgba(55,54,47,0.08)] active:yoo-editor-bg-[rgba(55,54,47,0.08)] yoo-editor-w-[24px] yoopta-element-actions-plus"},{children:e(Lo,{})})),e("button",Object.assign({type:"button",className:"yoo-editor-cursor-pointer yoo-editor-rounded-[6px] yoo-editor-h-[24px] yoo-editor-flex yoo-editor-items-center yoo-editor-justify-center yoo-editor-bg-inherit yoo-editor-bg-transparent yoo-editor-transition-colors yoo-editor-duration-[180ms] yoo-editor-ease-[cubic-bezier(0.4,0,0.2,1)] yoo-editor-relative yoo-editor-w-[18px] yoo-editor-p-0 yoo-editor-text-[rgba(55,53,47,0.35)] yoo-editor-m-[0_1px] hover:yoo-editor-bg-[rgba(55,54,47,0.08)] focus:yoo-editor-bg-[rgba(55,54,47,0.08)] active:yoo-editor-bg-[rgba(55,54,47,0.08)] yoopta-element-actions-drag",ref:e=>{E(e),m.setReference(e)}},C,D,{onClick:e=>{e.stopPropagation(),i(o.id);const t=No(n,{at:[o.meta.order]});n.focusBlock(o.id),t&&setTimeout((()=>{n.blocks[o.type].hasCustomEditor||(w.blur(t),w.deselect(t),_.deselect(t)),n.setBlockSelected([o.meta.order],{only:!0}),n.setSelection([o.meta.order]),c(!0)}),10)}},{children:e(To,{})})),e(pi,{isOpen:k,refs:m,style:R,onClose:()=>c(!1)})]}))},gi=({children:o,block:n,blockId:r})=>{var i;const a=z(),[l,c]=f(null),{attributes:s,listeners:d,setNodeRef:u,setActivatorNodeRef:p,transform:h,transition:y,isOver:g,isDragging:v}=Co({id:r,disabled:a.readOnly}),m={transform:h?`translate3d(${h.x}px, ${h.y}px, 0)`:"none",transition:y,opacity:v?.7:1,marginLeft:20*n.meta.depth+"px"},b=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(n.meta.order),w=l===r,x={borderBottom:g&&!v?"2px solid #007aff":"none"};return t("div",Object.assign({ref:u,className:"yoo-editor-relative yoo-editor-py-0 yoo-editor-px-[2px] yoo-editor-mt-[2px] yoo-editor-mb-[1px] yoo-editor-rounded yoopta-block-wrapper",onMouseEnter:()=>{a.readOnly||c(r)},onMouseLeave:()=>{a.readOnly||c(null)},style:m,"data-hovered-block":w,"data-yoopta-block":!0,"data-yoopta-block-id":r},{children:[!a.readOnly&&e(yi,{block:n,editor:a,dragHandleProps:{setActivatorNodeRef:p,attributes:s,listeners:d},showActions:w,onChangeActiveBlock:e=>c(e)}),e("div",Object.assign({style:x},{children:o})),b&&!a.readOnly&&e("div",{className:"yoo-editor-absolute yoo-editor-left-0 yoo-editor-top-0 yoo-editor-bg-[#2383e224] yoo-editor-z-[90] yoo-editor-rounded yoo-editor-opacity-100 yoo-editor-h-full yoo-editor-w-full yoo-editor-pointer-events-none yoopta-selection-block"})]}))};function vi(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;var mi={};Object.defineProperty(mi,"__esModule",{value:!0});for(var bi="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),wi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},xi={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:bi?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},ki={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Oi=1;Oi<20;Oi++)ki["f"+Oi]=111+Oi;function Ei(e,t,o){t&&!("byKey"in t)&&(o=t,t=null),Array.isArray(e)||(e=[e]);var n=e.map((function(e){return Ci(e,t)})),r=function(e){return n.some((function(t){return Si(t,e)}))};return null==o?r:r(o)}function Ci(e,t){var o=t&&t.byKey,n={},r=(e=e.replace("++","+add")).split("+"),i=r.length;for(var a in wi)n[wi[a]]=!1;var l=!0,c=!1,s=void 0;try{for(var d,u=r[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Di(f),y=wi[h];if(f.length>1&&!y&&!xi[f]&&!ki[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&y||(o?n.key=h:n.which=_i(f)),y&&(n[y]=!p||null)}}catch(e){c=!0,s=e}finally{try{!l&&u.return&&u.return()}finally{if(c)throw s}}return n}function Si(e,t){for(var o in e){var n=e[o],r=void 0;if(null!=n&&((null!=(r="key"===o&&null!=t.key?t.key.toLowerCase():"which"===o?91===n&&93===t.which?91:t.which:t[o])||!1!==n)&&r!==n))return!1}return!0}function _i(e){return e=Di(e),ki[e]||e.toUpperCase().charCodeAt(0)}function Di(e){return e=e.toLowerCase(),e=xi[e]||e}mi.default=Ei,mi.isHotkey=Ei,mi.isCodeHotkey=function(e,t){return Ei(e,t)};var Ri=mi.isKeyHotkey=function(e,t){return Ei(e,{byKey:!0},t)};mi.parseHotkey=Ci,mi.compareHotkey=Si,mi.toKeyCode=_i,mi.toKeyName=Di;const ji={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"},Bi={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"},Ai={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ti=e=>{const t=ji[e],o=Bi[e],n=Ai[e],r=t&&Ri(t),i=o&&Ri(o),a=n&&Ri(n);return e=>!(!r||!r(e))||(!(!i||!i(e))||!(!a||!a(e)))},Mi={isBold:Ti("bold"),isCompose:Ti("compose"),isArrowLeft:Ti("arrowLeft"),isArrowRight:Ti("arrowRight"),isArrowUp:Ti("arrowUp"),isArrowDown:Ti("arrowDown"),isDeleteBackward:Ti("deleteBackward"),isDeleteForward:Ti("deleteForward"),isDeleteLineBackward:Ti("deleteLineBackward"),isDeleteLineForward:Ti("deleteLineForward"),isDeleteWordBackward:Ti("deleteWordBackward"),isDeleteWordForward:Ti("deleteWordForward"),isExtendBackward:Ti("extendBackward"),isExtendForward:Ti("extendForward"),isExtendLineBackward:Ti("extendLineBackward"),isExtendLineForward:Ti("extendLineForward"),isItalic:Ti("italic"),isMoveLineBackward:Ti("moveLineBackward"),isMoveLineForward:Ti("moveLineForward"),isCtrlLeft:Ti("ctrlLeft"),isCtrlRight:Ti("ctrlRight"),isRedo:Ti("redo"),isShiftEnter:Ti("shiftEnter"),isEnter:Ti("enter"),isTransposeCharacter:Ti("transposeCharacter"),isUndo:Ti("undo"),isSpace:Ti("space"),isSelect:Ti("select"),isTab:Ti("tab"),isShiftTab:Ti("shiftTab"),isBackspace:Ti("backspace"),isCmdEnter:Ti("cmdEnter"),isCmd:Ti("cmd"),isEscape:Ti("escape"),isSlashCommand:Ti("slashCommand"),isShiftArrowUp:Ti("shiftArrowUp"),isShiftArrowDown:Ti("shiftArrowDown"),isKekceburek:Ti("kekCeburek")};const Li={onKeyDown:function(e){return t=>{const o=No(e,{at:e.selection});if(!o||!o.selection)return;const n=D.parent(o.selection.anchor.path);if(Mi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void o.insertText("\n")}if(Mi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const r=S.isStart(o,o.selection.anchor,n),i=S.isEnd(o,o.selection.anchor,n);if(!r&&!i)return void e.splitBlock({slate:o,focus:!0});const a=Q({id:G()}),l=e.selection?[e.selection[0]+1]:[0];e.insertBlock(a,{at:l,slate:o,focus:!0})}else if(Mi.isBackspace(t)){if(t.isDefaultPrevented())return;const n=N(e,{at:e.selection});e.blocks[(null==n?void 0:n.type)||""];const r=D.parent(o.selection.anchor.path);if(S.isStart(o,o.selection.anchor,r)){t.preventDefault();const n=S.string(o,r),i=e.selection?e.selection[0]-1:0,a=No(e,{at:[i]}),l=N(e,{at:[i]}),c=e.blocks[(null==l?void 0:l.type)||""];let s;if(a&&!c.hasCustomEditor&&(s=function(e,t){const[,o]=S.last(e,t);return{path:o,offset:S.string(e,o).length}}(a,r)),0===n.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:s});{if(R.isExpanded(o.selection))return _.delete(o,{at:o.selection});const t=e.selection?e.selection[0]-1:0,n=N(e,{at:[t]});if(e.blocks[(null==n?void 0:n.type)||""].hasCustomEditor)return;if(!a)return;if(0===S.string(a,[0,0]).length)return e.deleteBlock({at:[t],focus:!0,focusAt:s});const r=Array.from(S.nodes(o,{at:[0],match:e=>!S.isEditor(e)&&(j.isText(e)||S.isInline(o,e)),mode:"highest"})).map((([e])=>e));return _.insertNodes(a,r,{at:S.end(a,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:s})}}}else{if(Mi.isSelect(t)){if(t.isDefaultPrevented())return;const[,n]=S.first(o,[0]),[,r]=S.last(o,[o.children.length-1]),i=S.range(o,n,r),a=R.equals(o.selection,i);if(R.isExpanded(o.selection)&&a)return t.preventDefault(),w.blur(o),w.deselect(o),_.deselect(o),void e.setBlockSelected([],{allSelected:!0})}if(Mi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(Mi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(Mi.isArrowUp(t)){if(t.isDefaultPrevented())return;const n=D.parent(o.selection.anchor.path);if(S.isStart(o,o.selection.anchor,n)){const o=e.selection?[e.selection[0]-1]:null,n=No(e,{at:o}),r=N(e,{at:o});if(n&&r){const[,o]=S.last(n,[0]),i={path:o,offset:S.string(n,o).length};return t.preventDefault(),void e.focusBlock(r.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(Mi.isArrowDown(t)){if(t.isDefaultPrevented())return;const n=D.parent(o.selection.anchor.path);if(S.isEnd(o,o.selection.anchor,n)){const o=e.selection?[e.selection[0]+1]:null,r=No(e,{at:o}),i=N(e,{at:o});if(r&&i){const o=function(e,t){const[,o]=S.first(e,t);return{path:o,offset:0}}(r,n);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:o,waitExecution:!1})}}}if(R.isExpanded(o.selection)){if(Object.values(e.formats).length>0)for(const o of Object.values(e.formats))if(o.hotkey&&Ri(o.hotkey)(t)){t.preventDefault(),e.formats[o.type].toggle();break}}}}}},Ni=({children:t,attributes:o,placeholder:n})=>{const r=x(),i=Object.assign({},o);return r&&n&&(i["data-placeholder"]=n,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Ii(e){try{return new URL(e),!0}catch(e){return!1}}const Pi=(e,t)=>{(e=>{const[t]=S.nodes(e,{match:e=>!S.isEditor(e)&&B.isElement(e)&&"link"===e.type});return!!t})(e)&&(e=>{_.unwrapNodes(e,{match:e=>!S.isEditor(e)&&B.isElement(e)&&"link"===e.type})})(e);const{selection:o}=e,n=o&&R.isCollapsed(o),r={type:"link",children:n?[{text:t}]:[],props:{url:t,target:"_blank",rel:"noreferrer"}};n?_.insertNodes(e,r):(_.wrapNodes(e,r,{split:!0}),_.collapse(e,{edge:"end"}))};function Fi(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const zi={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"code"}};function Hi(e,t,o){var n,r,i;if(3===o.nodeType){return null===(n=o.textContent)||void 0===n?void 0:n.replace(/[\t\n\r\f\v]+/g," ")}if(1!==o.nodeType)return null;if("BR"===o.nodeName)return"\n";const a=o;let l=Array.from(a.childNodes).map((o=>Hi(e,t,o))).flat();if(zi[o.nodeName]){return{[zi[o.nodeName].type]:!0,text:null===(r=o.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(t[o.nodeName]){const n=t[o.nodeName],r=e.blocks[n.type],a=ri(r.elements)||"",c=r.elements[a],s="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:G(),type:a,children:s&&!r.hasCustomEditor?[{text:""}]:l.map(Ui),props:Object.assign({nodeType:"block"},c.props)};if(n.parse){const e=n.parse(o);if(e)if(B.isElement(e))d=e;else if(Array.isArray(e)){return e}}0===d.children.length&&(d.children=[{text:""}]);return Q({id:G(),type:n.type,value:[d],meta:{order:0,depth:0}})}return l}function Ui(e){if("string"==typeof e)return{text:e};if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(Fi(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}const Vi={html:{deserialize:function(e,t){console.log("pasted html",t);const o=function(e){const t={};return Object.keys(e.plugins).forEach((o=>{const n=e.plugins[o],{parsers:r}=n;if(r){const{html:e}=r;if(e){const{deserialize:n}=e;if(n){const{nodeNames:e}=n;e&&e.forEach((e=>{t[e]={type:o,parse:n.parse}}))}}}})),t}(e);return Hi(e,o,t).filter(Fi)},serialize:function(){}},markdown:{}},Ki=({id:t,customEditor:o,elements:n,marks:r,events:i,options:a,placeholder:c="Type '/' for commands"})=>{var s,f,p;const h=z(),y=H(t),g=l(y.value).current,v=y.type,m=d((()=>(e=>{const t={};return Object.keys(e).forEach((o=>t[o]=e[o].render)),t})(n)),[n]),b=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(r)),[r]),w=d((()=>{let e=h.blockEditorsMap[t];return Object.keys(n).forEach((t=>{var o;const r=null===(o=n[t].props)||void 0===o?void 0:o.nodeType,i="inline"===r,a="void"===r,l="inlineVoid"===r;l&&(e.markableVoid=e=>e.type===t),(a||l)&&(e.isVoid=e=>e.type===t),(i||l)&&(e.isInline=e=>e.type===t,e=(e=>{const{insertData:t,insertText:o}=e;return e.insertText=t=>{t&&Ii(t)?Pi(e,t):o(t)},e.insertData=o=>{const n=o.getData("text/plain");n&&Ii(n)?Pi(e,n):t(o)},e})(e))})),e}),[]),x=d((()=>{if(!i||h.readOnly)return{};const e={hotkeys:Mi,currentBlock:y,defaultBlock:Q({id:G()})},t={};return Object.keys(i).forEach((o=>{t[o]=function(t){if(i[o]){i[o](h,w,e)(t)}}})),t}),[i,h,y]),k=u((e=>h.updateBlock(t,{value:e})),[t]),O=u((o=>{const n=m[o.element.type];return n?e(n,Object.assign({},o,{blockId:t,HTMLAttributes:null==a?void 0:a.HTMLAttributes})):e(E,Object.assign({},o))}),[n]),C=u((t=>{var o,n,r,i,a;let{children:l,leaf:s,attributes:d}=t;const u=vi(s,["text"]),f=(null===(o=h.selection)||void 0===o?void 0:o[0])===y.meta.order;u&&Object.keys(u).forEach((e=>{const t=b[e];t&&(l=t.render({children:l,leaf:s}))}));const p=!("void"===(null===(a=null===(i=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===i?void 0:i.props)||void 0===a?void 0:a.nodeType))&&f&&s.withPlaceholder;return e(Ni,Object.assign({attributes:d,placeholder:p?c:void 0},{children:l}))}),[r]),_=u((e=>{var t;h.readOnly||(null===(t=x.onKeyDown)||void 0===t||t.call(x,e),Li.onKeyDown(h)(e))}),[x.onKeyDown,h.readOnly,null===(s=h.selection)||void 0===s?void 0:s[0],y.meta.order]),D=u((e=>{var t;h.readOnly||null===(t=null==x?void 0:x.onKeyUp)||void 0===t||t.call(x,e)}),[x.onKeyUp,h.readOnly]),j=u((e=>{var t,o;h.readOnly||((null===(t=h.selection)||void 0===t?void 0:t[0])!==y.meta.order&&h.setSelection([y.meta.order]),null===(o=null==x?void 0:x.onClick)||void 0===o||o.call(x,e))}),[x.onClick,h.readOnly,null===(f=h.selection)||void 0===f?void 0:f[0],y.meta.order]),B=u((e=>{var t;h.readOnly||(e.preventDefault(),null===(t=null==x?void 0:x.onBlur)||void 0===t||t.call(x,e))}),[x.onBlur,h.readOnly]),A=u((e=>{var t;h.readOnly||null===(t=null==x?void 0:x.onFocus)||void 0===t||t.call(x,e)}),[x.onFocus,h.readOnly]),T=u((e=>{var t;if(h.readOnly)return;null===(t=null==x?void 0:x.onPaste)||void 0===t||t.call(x,e);const o=e.clipboardData.getData("text/html"),n=(new DOMParser).parseFromString(o,"text/html");if(n.body.childNodes.length>0){const e=Vi.html.deserialize(h,n.body);if(e.length>0)return void h.insertBlocks(e,{at:h.selection,focus:!0})}}),[x.onPaste,h.readOnly]),M=u((e=>{var t;const o=[];if(h.readOnly)return o;const[n,r]=e,i=(null===(t=h.selection)||void 0===t?void 0:t[0])===y.meta.order;return w.selection&&i&&!S.isEditor(n)&&""===S.string(w,[r[0]])&&R.includes(w.selection,r)&&R.isCollapsed(w.selection)&&o.push(Object.assign(Object.assign({},w.selection),{withPlaceholder:!0})),o}),[h.readOnly,null===(p=h.selection)||void 0===p?void 0:p[0],y.meta.order]);return e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":v},{children:e(Wi,{id:t,slate:w,initialValue:g,onChange:k,decorate:M,renderLeaf:C,renderElement:O,eventHandlers:x,onKeyDown:_,onKeyUp:D,onFocus:A,onClick:j,onBlur:B,customEditor:o,readOnly:h.readOnly,onPaste:T})}))},Wi=p((({id:t,slate:o,initialValue:n,onChange:r,renderLeaf:i,renderElement:a,eventHandlers:l,onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,onBlur:f,onPaste:p,customEditor:h,decorate:y,readOnly:g})=>"function"==typeof h?h({blockId:t}):e(k,Object.assign({editor:o,initialValue:n,onChange:r},{children:e(O,Object.assign({id:`yoopta-slate-editor-${t}`,renderElement:a,renderLeaf:i,className:"focus-visible:yoo-editor-outline-none focus:yoo-editor-outline-none",spellCheck:!0},l,{onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,decorate:y,onBlur:f,readOnly:g,onPaste:p}),`editable-${t}`)}),`slate-${t}`)));Wi.displayName="SlateEditorInstance";const Yi=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return d((()=>[...t].filter((e=>null!=e))),[...t])}(Te(Et,{activationConstraint:{delay:100,tolerance:0}}),Te(bt,{coordinateGetter:Do})),handleDragEnd:u((t=>{const{active:o,over:n}=t;if(o&&n&&o.id!==n.id){const t=e.children[n.id].meta.order;e.moveBlock(o.id,[t])}}),[]),handleDragStart:u((t=>{e.setBlockSelected(null)}),[])}),$i=[],Xi=({editor:t,marks:n,placeholder:r})=>{const i=K(),{sensors:a,handleDragEnd:l,handleDragStart:c}=Yi({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?$i:s.sort(((e,o)=>t.children[e].meta.order-t.children[o].meta.order))),[s]),f=[];for(let o=0;o<u.length;o++){const i=u[o],a=t.children[i],l=t.plugins[a.type];a&&l?f.push(e(gi,Object.assign({block:a,blockId:i},{children:e(Ki,{type:a.type,id:i,marks:n,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,placeholder:r},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e(o,{children:f}):e(oo,Object.assign({sensors:a,collisionDetection:He,onDragStart:c,onDragEnd:l},{children:e(mo,Object.assign({disabled:i,items:u,strategy:yo},{children:f}))}))},Zi=({editor:e,yooptaEditorRef:t,root:o})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),i=i=>{var a;if(e.readOnly||!1===o)return;const l=null===(a=t.current)||void 0===a?void 0:a.contains(i.target);if(!l&&!n.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();l||r({origin:[i.pageX,i.pageY-window.pageYOffset],coords:[i.pageX,i.pageY-window.pageYOffset],selection:!0})},a=t=>{if(!n.selection||e.readOnly||!1===o)return;r((e=>Object.assign(Object.assign({},e),{coords:[t.pageX,t.pageY-window.pageYOffset]})));const i=((e,t)=>{const o=[];return document.querySelectorAll("[data-yoopta-block]").forEach(((n,r)=>{if(!n)return;const i=n.getBoundingClientRect(),a=Math.min(e[1],t[1]),l=Math.min(e[0],t[0]),c=Math.max(e[1],t[1]),s=Math.max(e[0],t[0]);a<i.bottom&&c>i.top&&l<i.right&&s>i.left&&o.push(r)})),o})(n.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(i,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var n;if(e.readOnly||!1===o)return;const r=o&&"current"in o?o.current:o||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=t.current)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",i),r.addEventListener("mousemove",a),r.addEventListener("mouseup",l),()=>{r.removeEventListener("mousedown",i),r.removeEventListener("mousemove",a),r.removeEventListener("mouseup",l)}}),[e.selectedBlocks,n,o,e.readOnly]);const c=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:c})},qi=({origin:t,coords:o,isOpen:n})=>{if(!n)return null;const r={zIndex:10,left:t[0],top:t[1],height:Math.abs(o[1]-t[1]-1),width:Math.abs(o[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>o[1]&&t[0]>o[0]?"scaleY(-1) scaleX(-1)":t[1]>o[1]?"scaleY(-1)":t[0]>o[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:r})},Gi={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Ji=({placeholder:o,marks:n,className:r,selectionBoxRoot:i,width:a,autoFocus:c=!0})=>{const d=z(),u=K(),f=l(null),p=Zi({editor:d,yooptaEditorRef:f,root:i});let h=l(Gi).current;s((()=>{if(!c||u)return;const e=N(d,{at:[0]});e&&d.focusBlock(e.id,{waitExecution:!0})}),[c,u]),s((()=>{if(!u)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[d.selectedBlocks,u]);const y=()=>{u||Array.isArray(d.selectedBlocks)&&d.selectedBlocks.length>0&&d.setBlockSelected(null)},g=()=>{h.indexToSelect=null,h.startedIndexToSelect=null,h.selectionStarted=!1},v=e=>{var t,o,n,r,i;if(!u){if(Mi.isSelect(e)){if((null===(t=d.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(d.children).length)return void e.preventDefault();if(h.selectionStarted)return e.preventDefault(),void d.setBlockSelected([],{allSelected:!0})}if(Mi.isBackspace(e)){e.stopPropagation();if(Array.isArray(d.selectedBlocks)&&(null===(o=d.selectedBlocks)||void 0===o?void 0:o.length)===Object.keys(d.children).length)return e.preventDefault(),d.deleteBlock({deleteAll:!0}),d.setBlockSelected(null),void g();if(Array.isArray(d.selectedBlocks)&&(null===(n=d.selectedBlocks)||void 0===n?void 0:n.length)>0)return e.preventDefault(),d.deleteBlock({fromPaths:d.selectedBlocks}),d.setBlockSelected(null),void g()}if(Mi.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(h.selectionStarted&&null!==h.startedIndexToSelect&&null!==h.indexToSelect){const e=h.indexToSelect,t=e-1;if(0===e)return;if(e===h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if(t<h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if((null===(r=d.selectedBlocks)||void 0===r?void 0:r.includes(e))&&e!==h.startedIndexToSelect){const o=d.selectedBlocks.filter((t=>t!==e));return d.setBlockSelected(o,{only:!0}),void(h.indexToSelect=t)}return}const t=N(d),o=No(d);if(!o||!o.selection||!t)return;const n=D.parent(o.selection.anchor.path),i=S.isStart(o,o.selection.focus,n);if(R.isExpanded(o.selection)&&i){const n=d.selection?[d.selection[0]-1]:[0],r=N(d,{at:n});t&&r&&(e.preventDefault(),w.blur(o),w.deselect(o),_.deselect(o),d.setSelection(null),d.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),h.startedIndexToSelect=t.meta.order,h.indexToSelect=t.meta.order-1,h.selectionStarted=!0)}}if(Mi.isShiftArrowDown(e)){if(h.selectionStarted&&null!==h.indexToSelect&&null!==h.startedIndexToSelect){const e=h.indexToSelect,t=e+1;if(t===Object.keys(d.children).length)return;if(e===h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if(t>h.startedIndexToSelect)return d.setBlockSelected([t]),void(h.indexToSelect=t);if((null===(i=d.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==h.startedIndexToSelect){const o=d.selectedBlocks.filter((t=>t!==e));return d.setBlockSelected(o,{only:!0}),void(h.indexToSelect=t)}return}const t=N(d),o=No(d);if(!o||!o.selection||!t)return;const n=D.parent(o.selection.anchor.path),r=S.isEnd(o,o.selection.focus,n);if(R.isExpanded(o.selection)&&r){const n=d.selection?[d.selection[0]+1]:[0],r=N(d,{at:n});t&&r&&(e.preventDefault(),w.blur(o),w.deselect(o),_.deselect(o),d.setSelection(null),d.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),h.startedIndexToSelect=t.meta.order,h.indexToSelect=t.meta.order+1,h.selectionStarted=!0)}}}},m=(b={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:a},Object.assign({paddingBottom:150},b));var b;return t("div",Object.assign({id:"yoopta-editor",className:r,style:m,ref:f,onClick:e=>{u||(g(),(e=>{var t;const o=f.current;if(!o)return;const{bottom:n}=o.getBoundingClientRect(),r=n-parseInt(getComputedStyle(o).paddingBottom,10),i=Q({id:G()});if(e.clientY>=r){const e=Object.keys(d.children).length-1,o=N(d,{at:[e]}),n=No(d,{at:[e]});if(o&&n&&n.selection){const e=S.string(n,n.selection.anchor.path),r=D.parent(n.selection.anchor.path),[a]=S.node(n,r);if(o.type===i.type&&B.isElement(a)&&"void"!==(null===(t=a.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void d.focusBlock(o.id,{slate:n})}const r=e+1;d.insertBlock(i,{at:[r],focus:!0})}})(e),y())},onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||u||(g(),y())}},{children:[e(Xi,{editor:d,marks:n,placeholder:o}),!1!==i&&e(qi,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!u})]}))},Qi=({children:e,fallback:t=null})=>{const[o,n]=f(!1);return s((()=>n(!0)),[]),o?e:t};
|
|
7
7
|
/*!
|
|
8
8
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
9
9
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
68
68
|
},
|
|
69
69
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "e843316d38c4484f89874a0ad5fa59342635078d"
|
|
71
71
|
}
|