@yoopta/editor 1.9.24-rc → 1.9.25-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import r,{useState as o,useEffect as i,useContext as a,useMemo as s,memo as l,useRef as c,useCallback as d}from"react";import{Editor as u,Operation as f,Path as p,Transforms as h,Element as g,Text as v,Range as y,Node as m,createEditor as b}from"slate";import{ReactEditor as w,useSlate as _,useSelected as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import r,{useState as o,useEffect as i,useContext as a,useMemo as s,memo as l,useRef as c,useCallback as d}from"react";import{Editor as u,Operation as f,Path as p,Transforms as h,Element as g,Text as v,Range as y,Node as m,createEditor as b}from"slate";import{ReactEditor as w,useSlate as _,useSelected as x,Editable as O,withReact as E,Slate as j}from"slate-react";import{randomFillSync as k}from"crypto";import{createPortal as N}from"react-dom";const S=({children:e,fallback:t=null})=>{const[n,r]=o(!1);return i((()=>r(!0)),[]),n?e:t};
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
|
-
*/function P(e){return"[object Object]"===Object.prototype.toString.call(e)}function D(e){var t,n;return!1!==P(e)&&(void 0===(t=e.constructor)||!1!==P(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var A={isHistory:e=>D(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||f.isOperationList(e.redos[0]))&&(0===e.undos.length||f.isOperationList(e.undos[0]))},C=new WeakMap,T=new WeakMap,L={isHistoryEditor:e=>A.isHistory(e.history)&&u.isEditor(e),isMerging:e=>T.get(e),isSaving:e=>C.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=L.isMerging(e);T.set(e,!1),t(),T.set(e,n)},withoutSaving(e,t){var n=L.isSaving(e);C.set(e,!1),t(),C.set(e,n)}},M=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!p.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!p.equals(e.path,t.path))),B=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,F=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),z=e=>"set_selection"!==e.type;function H(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function I(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}"function"==typeof SuppressedError&&SuppressedError;var R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},V=200,W="__lodash_hash_undefined__",U="[object Function]",Z="[object GeneratorFunction]",$=/^\[object .+?Constructor\]$/,q="object"==typeof R&&R&&R.Object===Object&&R,K="object"==typeof self&&self&&self.Object===Object&&self,G=q||K||Function("return this")();function J(e,t){return!!(e?e.length:0)&&function(e,t,n){if(t!=t)return function(e,t,n,r){var o=e.length,i=n+(r?1:-1);for(;r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,Q,n);var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,0)>-1}function X(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function Q(e){return e!=e}function Y(e,t){return e.has(t)}function ee(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var te,ne=Array.prototype,re=Function.prototype,oe=Object.prototype,ie=G["__core-js_shared__"],ae=(te=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||""))?"Symbol(src)_1."+te:"",se=re.toString,le=oe.hasOwnProperty,ce=oe.toString,de=RegExp("^"+se.call(le).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=ne.splice,fe=xe(G,"Map"),pe=xe(G,"Set"),he=xe(Object,"create");function ge(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ye(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=e?e.length:0;for(this.__data__=new ye;++t<n;)this.add(e[t])}function be(e,t){for(var n,r,o=e.length;o--;)if((n=e[o][0])===(r=t)||n!=n&&r!=r)return o;return-1}function we(e){if(!Ee(e)||(t=e,ae&&ae in t))return!1;var t,n=function(e){var t=Ee(e)?ce.call(e):"";return t==U||t==Z}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?de:$;return n.test(function(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}ge.prototype.clear=function(){this.__data__=he?he(null):{}},ge.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ge.prototype.get=function(e){var t=this.__data__;if(he){var n=t[e];return n===W?void 0:n}return le.call(t,e)?t[e]:void 0},ge.prototype.has=function(e){var t=this.__data__;return he?void 0!==t[e]:le.call(t,e)},ge.prototype.set=function(e,t){return this.__data__[e]=he&&void 0===t?W:t,this},ve.prototype.clear=function(){this.__data__=[]},ve.prototype.delete=function(e){var t=this.__data__,n=be(t,e);return!(n<0)&&(n==t.length-1?t.pop():ue.call(t,n,1),!0)},ve.prototype.get=function(e){var t=this.__data__,n=be(t,e);return n<0?void 0:t[n][1]},ve.prototype.has=function(e){return be(this.__data__,e)>-1},ve.prototype.set=function(e,t){var n=this.__data__,r=be(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ye.prototype.clear=function(){this.__data__={hash:new ge,map:new(fe||ve),string:new ge}},ye.prototype.delete=function(e){return Oe(this,e).delete(e)},ye.prototype.get=function(e){return Oe(this,e).get(e)},ye.prototype.has=function(e){return Oe(this,e).has(e)},ye.prototype.set=function(e,t){return Oe(this,e).set(e,t),this},me.prototype.add=me.prototype.push=function(e){return this.__data__.set(e,W),this},me.prototype.has=function(e){return this.__data__.has(e)};var _e=pe&&1/ee(new pe([,-0]))[1]==1/0?function(e){return new pe(e)}:function(){};function Oe(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function xe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return we(n)?n:void 0}function Ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var je,ke=function(e,t){return e&&e.length?function(e,t,n){var r=-1,o=J,i=e.length,a=!0,s=[],l=s;if(n)a=!1,o=X;else if(i>=V){var c=t?null:_e(e);if(c)return ee(c);a=!1,o=Y,l=new me}else l=t?[]:s;e:for(;++r<i;){var d=e[r],u=t?t(d):d;if(d=n||0!==d?d:0,a&&u==u){for(var f=l.length;f--;)if(l[f]===u)continue e;t&&l.push(u),s.push(d)}else o(l,u,n)||(l!==s&&l.push(u),s.push(d))}return s}(e,void 0,t):[]};class Ne{constructor(e){je.set(this,void 0),function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,je,Object.freeze(Object.assign({},e)),"f")}extend(e){const{type:t=I(this,je,"f").type,renderer:n=I(this,je,"f").renderer,placeholder:r=I(this,je,"f").placeholder,shortcut:o=I(this,je,"f").shortcut,exports:i=I(this,je,"f").exports,events:a=I(this,je,"f").events,options:s}=e,l=Object.freeze(Object.assign(Object.assign({},I(this,je,"f")),{type:t,renderer:n,placeholder:r,shortcut:o,exports:i,events:a,options:Object.assign(Object.assign({},I(this,je,"f").options),s)}));return new Ne(l)}get getPlugin(){return I(this,je,"f")}}function Se(e){return new Ne(e)}function Pe(e){const t=e.map((e=>{const t=e.getPlugin,{childPlugin:n}=t,r=H(t,["childPlugin"]);return n?[r,Object.assign(Object.assign({},n.getPlugin),{hasParent:!0})]:r})).flat();return ke(t,((e,t)=>e.type===t.type))}je=new WeakMap;let De,Ae,Ce=(e=21)=>{var t;t=e-=0,!De||De.length<t?(De=Buffer.allocUnsafe(128*t),k(De),Ae=0):Ae+t>De.length&&(k(De),Ae=0),Ae+=t;let n="";for(let t=Ae-e;t<Ae;t++)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&De[t]];return n};const Te=()=>{var e;return"undefined"==typeof window?Ce():"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?function(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}():Ce()};function Le(e){return!!Array.isArray(e)&&0!==e.length}var Me={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",s="[object Function]",l="[object GeneratorFunction]",c="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",_="[object Float64Array]",O="[object Int8Array]",x="[object Int16Array]",E="[object Int32Array]",j="[object Uint8Array]",k="[object Uint8ClampedArray]",N="[object Uint16Array]",S="[object Uint32Array]",P=/\w*$/,D=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,C={};C[o]=C["[object Array]"]=C[m]=C[b]=C[i]=C[a]=C[w]=C[_]=C[O]=C[x]=C[E]=C[c]=C[d]=C[u]=C[p]=C[h]=C[g]=C[v]=C[j]=C[k]=C[N]=C[S]=!0,C["[object Error]"]=C[s]=C[y]=!1;var T="object"==typeof R&&R&&R.Object===Object&&R,L="object"==typeof self&&self&&self.Object===Object&&self,M=T||L||Function("return this")(),B=t&&!t.nodeType&&t,F=B&&e&&!e.nodeType&&e,z=F&&F.exports===B;function H(e,t){return e.set(t[0],t[1]),e}function I(e,t){return e.add(t),e}function V(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function W(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function U(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Z(e,t){return function(n){return e(t(n))}}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var q=Array.prototype,K=Function.prototype,G=Object.prototype,J=M["__core-js_shared__"],X=function(){var e=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Q=K.toString,Y=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+Q.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=z?M.Buffer:void 0,re=M.Symbol,oe=M.Uint8Array,ie=Z(Object.getPrototypeOf,Object),ae=Object.create,se=G.propertyIsEnumerable,le=q.splice,ce=Object.getOwnPropertySymbols,de=ne?ne.isBuffer:void 0,ue=Z(Object.keys,Object),fe=Fe(M,"DataView"),pe=Fe(M,"Map"),he=Fe(M,"Promise"),ge=Fe(M,"Set"),ve=Fe(M,"WeakMap"),ye=Fe(Object,"create"),me=Ve(fe),be=Ve(pe),we=Ve(he),_e=Ve(ge),Oe=Ve(ve),xe=re?re.prototype:void 0,Ee=xe?xe.valueOf:void 0;function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ke(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){this.__data__=new ke(e)}function Pe(e,t){var n=Ue(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ze(e)}(e)&&Y.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var a in e)!t&&!Y.call(e,a)||i&&("length"==a||Ie(a,r))||n.push(a);return n}function De(e,t,n){var r=e[t];Y.call(e,t)&&We(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if(We(e[n][0],t))return n;return-1}function Ce(e,t,n,r,f,y,D){var A;if(r&&(A=y?r(e,f,y,D):r(e)),void 0!==A)return A;if(!Ke(e))return e;var T=Ue(e);if(T){if(A=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Y.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,A)}else{var L=He(e),M=L==s||L==l;if($e(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(L==u||L==o||M&&!y){if(W(e))return y?e:{};if(A=function(e){return"function"!=typeof e.constructor||Re(e)?{}:(t=ie(e),Ke(t)?ae(t):{});var t}(M?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,Ge(t),e)}(A,e))}else{if(!C[L])return y?e:{};A=function(e,t,n,r){var o=e.constructor;switch(t){case m:return Le(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case _:case O:case x:case E:case j:case k:case N:case S:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(U(e),!0):U(e);return V(r,H,new e.constructor)}(e,r,n);case d:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,P.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n($(e),!0):$(e);return V(r,I,new e.constructor)}(e,r,n);case v:return s=e,Ee?Object(Ee.call(s)):{}}var s}(e,L,Ce,t)}}D||(D=new Se);var B=D.get(e);if(B)return B;if(D.set(e,A),!T)var F=n?function(e){return function(e,t,n){var r=t(e);return Ue(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ge,ze)}(e):Ge(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(F||e,(function(o,i){F&&(o=e[i=o]),De(A,i,Ce(o,t,n,r,i,e,D))})),A}function Te(e){return!(!Ke(e)||(t=e,X&&X in t))&&(qe(e)||W(e)?te:D).test(Ve(e));var t}function Le(e){var t=new e.constructor(e.byteLength);return new oe(t).set(new oe(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],s=r?r(n[a],e[a],a,n,e):void 0;De(n,a,void 0===s?e[a]:s)}return n}function Be(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Fe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}je.prototype.clear=function(){this.__data__=ye?ye(null):{}},je.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},je.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Y.call(t,e)?t[e]:void 0},je.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Y.call(t,e)},je.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?n:t,this},ke.prototype.clear=function(){this.__data__=[]},ke.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():le.call(t,n,1),!0)},ke.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},ke.prototype.has=function(e){return Ae(this.__data__,e)>-1},ke.prototype.set=function(e,t){var n=this.__data__,r=Ae(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ne.prototype.clear=function(){this.__data__={hash:new je,map:new(pe||ke),string:new je}},Ne.prototype.delete=function(e){return Be(this,e).delete(e)},Ne.prototype.get=function(e){return Be(this,e).get(e)},Ne.prototype.has=function(e){return Be(this,e).has(e)},Ne.prototype.set=function(e,t){return Be(this,e).set(e,t),this},Se.prototype.clear=function(){this.__data__=new ke},Se.prototype.delete=function(e){return this.__data__.delete(e)},Se.prototype.get=function(e){return this.__data__.get(e)},Se.prototype.has=function(e){return this.__data__.has(e)},Se.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ke){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ne(r)}return n.set(e,t),this};var ze=ce?Z(ce,Object):function(){return[]},He=function(e){return ee.call(e)};function Ie(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function Re(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function We(e,t){return e===t||e!=e&&t!=t}(fe&&He(new fe(new ArrayBuffer(1)))!=b||pe&&He(new pe)!=c||he&&He(he.resolve())!=f||ge&&He(new ge)!=h||ve&&He(new ve)!=y)&&(He=function(e){var t=ee.call(e),n=t==u?e.constructor:void 0,r=n?Ve(n):void 0;if(r)switch(r){case me:return b;case be:return c;case we:return f;case _e:return h;case Oe:return y}return t});var Ue=Array.isArray;function Ze(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!qe(e)}var $e=de||function(){return!1};function qe(e){var t=Ke(e)?ee.call(e):"";return t==s||t==l}function Ke(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return Ze(e)?Pe(e):function(e){if(!Re(e))return ue(e);var t=[];for(var n in Object(e))Y.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Ce(e,!0,!0)}}({get exports(){return Me},set exports(e){Me=e}},Me);var Be=Me;function Fe(e){return"function"==typeof window.structuredClone?window.structuredClone(e):Be(e)}const ze={from:{path:null,element:null,parent:null},to:{path:null,element:null,parent:null}};var He=!1;if("undefined"!=typeof window){var Ie={get passive(){He=!0}};window.addEventListener("testPassive",null,Ie),window.removeEventListener("testPassive",null,Ie)}var Re="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),Ve=[],We=!1,Ue=-1,Ze=void 0,$e=void 0,qe=void 0,Ke=function(e){return Ve.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ge=function(e){var t=e||window.event;return!!Ke(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},Je=function(e,t){if(e){if(!Ve.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};Ve=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(Ve),[n]),Re?window.requestAnimationFrame((function(){if(void 0===$e){$e={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,r=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout((function(){return window.requestAnimationFrame((function(){var e=r-window.innerHeight;e&&t>=r&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===qe){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);qe=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===Ze&&(Ze=document.body.style.overflow,document.body.style.overflow="hidden")}(t),Re&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(Ue=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-Ue;!Ke(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?Ge(e):e.stopPropagation())}(t,e)},We||(document.addEventListener("touchmove",Ge,He?{passive:!1}:void 0),We=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},Xe=function(e){e?(Ve=Ve.filter((function(t){return t.targetElement!==e})),Re&&(e.ontouchstart=null,e.ontouchmove=null,We&&0===Ve.length&&(document.removeEventListener("touchmove",Ge,He?{passive:!1}:void 0),We=!1)),Re?function(){if(void 0!==$e){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=$e.position,document.body.style.top=$e.top,document.body.style.left=$e.left,window.scrollTo(t,e),$e=void 0}}():(void 0!==qe&&(document.body.style.paddingRight=qe,qe=void 0),void 0!==Ze&&(document.body.style.overflow=Ze,Ze=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},Qe=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Ye={"text/plain":"Text","text/html":"Url",default:"Text"};var et=function(e,t){var n,r,o,i,a,s,l=!1;t||(t={}),n=t.debug||!1;try{if(o=Qe(),i=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Ye[t.format]||Ye.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),l=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),s&&document.body.removeChild(s),o()}return l};const tt=e=>({id:e,type:"paragraph",nodeType:"block",children:[{text:""}]});function nt(e,t,n=!1){n&&Object.keys(u.marks(e)||{}).forEach((t=>{u.removeMark(e,t)})),!function(e,t){const n=u.marks(e);return!!(null==n?void 0:n[t])}(e,t)?u.addMark(e,t,!0):u.removeMark(e,t)}const rt={hoveredElement:null,isElementOptionsOpen:!1,nodeSettingsPos:null,dndState:ze,disableWhileDrag:!1,DRAG_MAP:new Map,selectedNodeElement:null},ot=r.createContext([rt,{openNodeSettings:(e,t)=>{},closeNodeSettings:()=>{},hoverIn:(e,t)=>{},triggerPlusButton:e=>{},deleteNode:()=>{},duplicateNode:()=>{},copyLinkNode:()=>{},onDrop:e=>{},onDragEnd:e=>{},onDragEnter:e=>{},onDragStart:e=>{},changeHoveredNode:e=>{},changeSelectedNodeElement:e=>{}}]),it=({children:t})=>{const n=_(),[r,i]=(e=>{const[t,n]=o(!1),[r,i]=o(ze),[a]=o((()=>new Map)),s=t=>{var n;t.preventDefault(),t.stopPropagation();const r=t.target.closest("[data-element-id]");if(r){const{elementId:t,elementType:o}=r.dataset;if(!t||!o)return;const s=a.get(t);if(null===(n=s.data)||void 0===n?void 0:n.skipDrag)return;const l=w.findPath(e,s);i((e=>({from:e.from,to:{path:l,element:{id:t,type:o},parent:null}})))}};return[{dndState:r,disableWhileDrag:t,DRAG_MAP:a},{onDrop:t=>{try{u.withoutNormalizing(e,(()=>{var n,o;if(t.preventDefault(),t.stopPropagation(),(null===(n=r.from.element)||void 0===n?void 0:n.id)===(null===(o=r.to.element)||void 0===o?void 0:o.id))return;const i=r.from.path,s=a.get(r.to.element.id);let l=w.findPath(e,s);if(!i||!l)return;const[c,d]=u.node(e,i),[f,v]=u.parent(e,d);if(console.log("fromPath",i),console.log("fromElementPath",d),console.log("toPath",l),console.log("toPath next",p.next(l)),console.log("fromElementNode",c),console.log("parentElementNode",f),l.length>1){const t=Fe(c);l.length>i.length?(h.insertNodes(e,t,{at:l.length===i.length?l:p.next(l),match:e=>g.isElement(e),mode:"lowest"}),h.removeNodes(e,{at:i,match:e=>g.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"})):(h.removeNodes(e,{at:i,match:e=>g.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"}),h.insertNodes(e,t,{at:l.length===i.length?l:p.next(l),match:e=>g.isElement(e),mode:"lowest"})),1===f.children.length&&g.isElement(f.children[0])&&h.removeNodes(e,{at:v,match:e=>g.isElement(e)&&f.id===e.id,mode:"lowest"})}else h.moveNodes(e,{at:i,to:l,match:e=>g.isElement(e)&&g.isElement(c)&&c.type===e.type,mode:"lowest"});t.dataTransfer.clearData(),a.clear()}))}catch(e){console.error(e)}},onDragEnd:e=>{e.stopPropagation(),e.target.removeAttribute("draggable"),e.target.ondragstart=null,e.target.ondragend=null,e.target.ondragenter=null,e.target.ondragover=null,n(!1),i(ze)},onDragEnter:s,onDragStart:(e,t)=>{n(!0),e.dataTransfer.setData("Text",""),e.dataTransfer.effectAllowed="move";const r=document.getElementById("yoopta-contenteditable");r&&(r.ondragenter=e=>s(e),r.ondragover=e=>(e.stopPropagation(),e.preventDefault(),!1),i((e=>({to:e.to,from:t}))))}}]})(n),[a,l]=o(null),[c,d]=o((()=>(({children:e})=>{if(1===e.length)return e[0];return null})(n))),[f,v]=o(null),[y,m]=o(!1),b=Object.assign({hoveredElement:c,isElementOptionsOpen:y,nodeSettingsPos:a,selectedNodeElement:f},r),O=s((()=>Object.assign({hoverIn:(e,t)=>{var n;if(y)return e.preventDefault();(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.skipSettings)||d(t)},changeSelectedNodeElement:e=>{console.log("changeSelectedNodeElement node ",e),v(e)},changeHoveredNode:e=>d(e),triggerPlusButton:e=>{u.withoutNormalizing(n,(()=>{if(!n.selection||!e)return;const t=w.findPath(n,e),r=p.next([t[0]]),o=tt(Te());h.insertNodes(n,o,{at:r,select:!0}),d(o)}))},openNodeSettings:(e,t)=>{Je(document.body,{reserveScrollBarGap:!0}),m(!0),v(t);let r=w.findPath(n,t).concat(0);if(g.isElement(null==t?void 0:t.children[0])&&(r=r.concat(0)),h.select(n,{path:r,offset:0}),d(t),e.current){const t=e.current.getBoundingClientRect();l({left:t.left+t.width+10,top:t.top})}},closeNodeSettings:()=>{Xe(document.body),m(!1),l(null),v(null)},deleteNode:()=>{if(c)try{u.withoutNormalizing(n,(()=>{var e;const t=w.findPath(n,c),[r,o]=u.parent(n,t);if(!t)return;let i="highest";if(g.isElement(r)){if(1===r.children.length&&g.isElement(r.children[0]))return h.removeNodes(n,{at:o,match:e=>g.isElement(e)&&e.id===r.id,mode:"highest"}),d(null),void O.closeNodeSettings();(null===(e=r.data)||void 0===e?void 0:e.depth)>0&&(i="lowest")}h.removeNodes(n,{at:t,match:e=>g.isElement(e),mode:i}),d(null),O.closeNodeSettings()}))}catch(e){console.log({error:e})}},duplicateNode:()=>{u.withoutNormalizing(n,(()=>{if(!c)return;const e=w.findPath(n,c),t=p.next(e),r=Fe(c);r.id=Te(),h.insertNodes(n,r,{at:t,match:e=>g.isElement(e),mode:"highest",select:!0}),w.focus(n),d(null),O.closeNodeSettings()}))},copyLinkNode:()=>{0===window.location.hash.length?et(`${window.location.href}#${null==c?void 0:c.id}`):et(`${window.location.href.split("#")[0]}#${null==c?void 0:c.id}`),O.closeNodeSettings()}},i)),[c,y,r,n.children]),x=s((()=>[b,O]),[c,y,r,n.selection,n.children]);return e(ot.Provider,Object.assign({value:x},{children:t}))},at=()=>a(ot);var st,lt={};
|
|
7
|
+
*/function P(e){return"[object Object]"===Object.prototype.toString.call(e)}function D(e){var t,n;return!1!==P(e)&&(void 0===(t=e.constructor)||!1!==P(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var A={isHistory:e=>D(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||f.isOperationList(e.redos[0]))&&(0===e.undos.length||f.isOperationList(e.undos[0]))},C=new WeakMap,T=new WeakMap,L={isHistoryEditor:e=>A.isHistory(e.history)&&u.isEditor(e),isMerging:e=>T.get(e),isSaving:e=>C.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=L.isMerging(e);T.set(e,!1),t(),T.set(e,n)},withoutSaving(e,t){var n=L.isSaving(e);C.set(e,!1),t(),C.set(e,n)}},M=(e,t)=>"set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!p.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!p.equals(e.path,t.path))),B=(e,t)=>"set_selection"!==e.type||null!=e.properties&&null!=e.newProperties,F=(e,t)=>!(!t||"set_selection"!==e.type||"set_selection"!==t.type),z=e=>"set_selection"!==e.type;function H(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function I(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}"function"==typeof SuppressedError&&SuppressedError;var R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},V=200,W="__lodash_hash_undefined__",U="[object Function]",Z="[object GeneratorFunction]",$=/^\[object .+?Constructor\]$/,q="object"==typeof R&&R&&R.Object===Object&&R,K="object"==typeof self&&self&&self.Object===Object&&self,G=q||K||Function("return this")();function J(e,t){return!!(e?e.length:0)&&function(e,t,n){if(t!=t)return function(e,t,n,r){var o=e.length,i=n+(r?1:-1);for(;r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,Q,n);var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,0)>-1}function X(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function Q(e){return e!=e}function Y(e,t){return e.has(t)}function ee(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var te,ne=Array.prototype,re=Function.prototype,oe=Object.prototype,ie=G["__core-js_shared__"],ae=(te=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||""))?"Symbol(src)_1."+te:"",se=re.toString,le=oe.hasOwnProperty,ce=oe.toString,de=RegExp("^"+se.call(le).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=ne.splice,fe=Oe(G,"Map"),pe=Oe(G,"Set"),he=Oe(Object,"create");function ge(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ye(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=e?e.length:0;for(this.__data__=new ye;++t<n;)this.add(e[t])}function be(e,t){for(var n,r,o=e.length;o--;)if((n=e[o][0])===(r=t)||n!=n&&r!=r)return o;return-1}function we(e){if(!Ee(e)||(t=e,ae&&ae in t))return!1;var t,n=function(e){var t=Ee(e)?ce.call(e):"";return t==U||t==Z}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?de:$;return n.test(function(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}ge.prototype.clear=function(){this.__data__=he?he(null):{}},ge.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ge.prototype.get=function(e){var t=this.__data__;if(he){var n=t[e];return n===W?void 0:n}return le.call(t,e)?t[e]:void 0},ge.prototype.has=function(e){var t=this.__data__;return he?void 0!==t[e]:le.call(t,e)},ge.prototype.set=function(e,t){return this.__data__[e]=he&&void 0===t?W:t,this},ve.prototype.clear=function(){this.__data__=[]},ve.prototype.delete=function(e){var t=this.__data__,n=be(t,e);return!(n<0)&&(n==t.length-1?t.pop():ue.call(t,n,1),!0)},ve.prototype.get=function(e){var t=this.__data__,n=be(t,e);return n<0?void 0:t[n][1]},ve.prototype.has=function(e){return be(this.__data__,e)>-1},ve.prototype.set=function(e,t){var n=this.__data__,r=be(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},ye.prototype.clear=function(){this.__data__={hash:new ge,map:new(fe||ve),string:new ge}},ye.prototype.delete=function(e){return xe(this,e).delete(e)},ye.prototype.get=function(e){return xe(this,e).get(e)},ye.prototype.has=function(e){return xe(this,e).has(e)},ye.prototype.set=function(e,t){return xe(this,e).set(e,t),this},me.prototype.add=me.prototype.push=function(e){return this.__data__.set(e,W),this},me.prototype.has=function(e){return this.__data__.has(e)};var _e=pe&&1/ee(new pe([,-0]))[1]==1/0?function(e){return new pe(e)}:function(){};function xe(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Oe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return we(n)?n:void 0}function Ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var je,ke=function(e,t){return e&&e.length?function(e,t,n){var r=-1,o=J,i=e.length,a=!0,s=[],l=s;if(n)a=!1,o=X;else if(i>=V){var c=t?null:_e(e);if(c)return ee(c);a=!1,o=Y,l=new me}else l=t?[]:s;e:for(;++r<i;){var d=e[r],u=t?t(d):d;if(d=n||0!==d?d:0,a&&u==u){for(var f=l.length;f--;)if(l[f]===u)continue e;t&&l.push(u),s.push(d)}else o(l,u,n)||(l!==s&&l.push(u),s.push(d))}return s}(e,void 0,t):[]};class Ne{constructor(e){je.set(this,void 0),function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?o.call(e,n):o?o.value=n:t.set(e,n)}(this,je,Object.freeze(Object.assign({},e)),"f")}extend(e){const{type:t=I(this,je,"f").type,renderer:n=I(this,je,"f").renderer,placeholder:r=I(this,je,"f").placeholder,shortcut:o=I(this,je,"f").shortcut,exports:i=I(this,je,"f").exports,events:a=I(this,je,"f").events,options:s}=e,l=Object.freeze(Object.assign(Object.assign({},I(this,je,"f")),{type:t,renderer:n,placeholder:r,shortcut:o,exports:i,events:a,options:Object.assign(Object.assign({},I(this,je,"f").options),s)}));return new Ne(l)}get getPlugin(){return I(this,je,"f")}}function Se(e){return new Ne(e)}function Pe(e){const t=e.map((e=>{const t=e.getPlugin,{childPlugin:n}=t,r=H(t,["childPlugin"]);return n?[r,Object.assign(Object.assign({},n.getPlugin),{hasParent:!0})]:r})).flat();return ke(t,((e,t)=>e.type===t.type))}je=new WeakMap;let De,Ae,Ce=(e=21)=>{var t;t=e-=0,!De||De.length<t?(De=Buffer.allocUnsafe(128*t),k(De),Ae=0):Ae+t>De.length&&(k(De),Ae=0),Ae+=t;let n="";for(let t=Ae-e;t<Ae;t++)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&De[t]];return n};const Te=()=>{var e;return"undefined"==typeof window?Ce():"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?function(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}():Ce()};function Le(e){return!!Array.isArray(e)&&0!==e.length}var Me={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",s="[object Function]",l="[object GeneratorFunction]",c="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",_="[object Float64Array]",x="[object Int8Array]",O="[object Int16Array]",E="[object Int32Array]",j="[object Uint8Array]",k="[object Uint8ClampedArray]",N="[object Uint16Array]",S="[object Uint32Array]",P=/\w*$/,D=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,C={};C[o]=C["[object Array]"]=C[m]=C[b]=C[i]=C[a]=C[w]=C[_]=C[x]=C[O]=C[E]=C[c]=C[d]=C[u]=C[p]=C[h]=C[g]=C[v]=C[j]=C[k]=C[N]=C[S]=!0,C["[object Error]"]=C[s]=C[y]=!1;var T="object"==typeof R&&R&&R.Object===Object&&R,L="object"==typeof self&&self&&self.Object===Object&&self,M=T||L||Function("return this")(),B=t&&!t.nodeType&&t,F=B&&e&&!e.nodeType&&e,z=F&&F.exports===B;function H(e,t){return e.set(t[0],t[1]),e}function I(e,t){return e.add(t),e}function V(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function W(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function U(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Z(e,t){return function(n){return e(t(n))}}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var q=Array.prototype,K=Function.prototype,G=Object.prototype,J=M["__core-js_shared__"],X=function(){var e=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Q=K.toString,Y=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+Q.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=z?M.Buffer:void 0,re=M.Symbol,oe=M.Uint8Array,ie=Z(Object.getPrototypeOf,Object),ae=Object.create,se=G.propertyIsEnumerable,le=q.splice,ce=Object.getOwnPropertySymbols,de=ne?ne.isBuffer:void 0,ue=Z(Object.keys,Object),fe=Fe(M,"DataView"),pe=Fe(M,"Map"),he=Fe(M,"Promise"),ge=Fe(M,"Set"),ve=Fe(M,"WeakMap"),ye=Fe(Object,"create"),me=Ve(fe),be=Ve(pe),we=Ve(he),_e=Ve(ge),xe=Ve(ve),Oe=re?re.prototype:void 0,Ee=Oe?Oe.valueOf:void 0;function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ke(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){this.__data__=new ke(e)}function Pe(e,t){var n=Ue(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ze(e)}(e)&&Y.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var a in e)!t&&!Y.call(e,a)||i&&("length"==a||Ie(a,r))||n.push(a);return n}function De(e,t,n){var r=e[t];Y.call(e,t)&&We(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if(We(e[n][0],t))return n;return-1}function Ce(e,t,n,r,f,y,D){var A;if(r&&(A=y?r(e,f,y,D):r(e)),void 0!==A)return A;if(!Ke(e))return e;var T=Ue(e);if(T){if(A=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Y.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,A)}else{var L=He(e),M=L==s||L==l;if($e(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(L==u||L==o||M&&!y){if(W(e))return y?e:{};if(A=function(e){return"function"!=typeof e.constructor||Re(e)?{}:(t=ie(e),Ke(t)?ae(t):{});var t}(M?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,Ge(t),e)}(A,e))}else{if(!C[L])return y?e:{};A=function(e,t,n,r){var o=e.constructor;switch(t){case m:return Le(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case _:case x:case O:case E:case j:case k:case N:case S:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(U(e),!0):U(e);return V(r,H,new e.constructor)}(e,r,n);case d:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,P.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n($(e),!0):$(e);return V(r,I,new e.constructor)}(e,r,n);case v:return s=e,Ee?Object(Ee.call(s)):{}}var s}(e,L,Ce,t)}}D||(D=new Se);var B=D.get(e);if(B)return B;if(D.set(e,A),!T)var F=n?function(e){return function(e,t,n){var r=t(e);return Ue(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ge,ze)}(e):Ge(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(F||e,(function(o,i){F&&(o=e[i=o]),De(A,i,Ce(o,t,n,r,i,e,D))})),A}function Te(e){return!(!Ke(e)||(t=e,X&&X in t))&&(qe(e)||W(e)?te:D).test(Ve(e));var t}function Le(e){var t=new e.constructor(e.byteLength);return new oe(t).set(new oe(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],s=r?r(n[a],e[a],a,n,e):void 0;De(n,a,void 0===s?e[a]:s)}return n}function Be(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Fe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}je.prototype.clear=function(){this.__data__=ye?ye(null):{}},je.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},je.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Y.call(t,e)?t[e]:void 0},je.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Y.call(t,e)},je.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?n:t,this},ke.prototype.clear=function(){this.__data__=[]},ke.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():le.call(t,n,1),!0)},ke.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},ke.prototype.has=function(e){return Ae(this.__data__,e)>-1},ke.prototype.set=function(e,t){var n=this.__data__,r=Ae(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ne.prototype.clear=function(){this.__data__={hash:new je,map:new(pe||ke),string:new je}},Ne.prototype.delete=function(e){return Be(this,e).delete(e)},Ne.prototype.get=function(e){return Be(this,e).get(e)},Ne.prototype.has=function(e){return Be(this,e).has(e)},Ne.prototype.set=function(e,t){return Be(this,e).set(e,t),this},Se.prototype.clear=function(){this.__data__=new ke},Se.prototype.delete=function(e){return this.__data__.delete(e)},Se.prototype.get=function(e){return this.__data__.get(e)},Se.prototype.has=function(e){return this.__data__.has(e)},Se.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ke){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ne(r)}return n.set(e,t),this};var ze=ce?Z(ce,Object):function(){return[]},He=function(e){return ee.call(e)};function Ie(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function Re(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function We(e,t){return e===t||e!=e&&t!=t}(fe&&He(new fe(new ArrayBuffer(1)))!=b||pe&&He(new pe)!=c||he&&He(he.resolve())!=f||ge&&He(new ge)!=h||ve&&He(new ve)!=y)&&(He=function(e){var t=ee.call(e),n=t==u?e.constructor:void 0,r=n?Ve(n):void 0;if(r)switch(r){case me:return b;case be:return c;case we:return f;case _e:return h;case xe:return y}return t});var Ue=Array.isArray;function Ze(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!qe(e)}var $e=de||function(){return!1};function qe(e){var t=Ke(e)?ee.call(e):"";return t==s||t==l}function Ke(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return Ze(e)?Pe(e):function(e){if(!Re(e))return ue(e);var t=[];for(var n in Object(e))Y.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Ce(e,!0,!0)}}({get exports(){return Me},set exports(e){Me=e}},Me);var Be=Me;function Fe(e){return"function"==typeof window.structuredClone?window.structuredClone(e):Be(e)}const ze={from:{path:null,element:null,parent:null},to:{path:null,element:null,parent:null}};var He=!1;if("undefined"!=typeof window){var Ie={get passive(){He=!0}};window.addEventListener("testPassive",null,Ie),window.removeEventListener("testPassive",null,Ie)}var Re="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),Ve=[],We=!1,Ue=-1,Ze=void 0,$e=void 0,qe=void 0,Ke=function(e){return Ve.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},Ge=function(e){var t=e||window.event;return!!Ke(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},Je=function(e,t){if(e){if(!Ve.some((function(t){return t.targetElement===e}))){var n={targetElement:e,options:t||{}};Ve=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(Ve),[n]),Re?window.requestAnimationFrame((function(){if(void 0===$e){$e={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,r=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout((function(){return window.requestAnimationFrame((function(){var e=r-window.innerHeight;e&&t>=r&&(document.body.style.top=-(t+e))}))}),300)}})):function(e){if(void 0===qe){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);qe=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}void 0===Ze&&(Ze=document.body.style.overflow,document.body.style.overflow="hidden")}(t),Re&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(Ue=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-Ue;!Ke(e.target)&&(t&&0===t.scrollTop&&n>0||function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?Ge(e):e.stopPropagation())}(t,e)},We||(document.addEventListener("touchmove",Ge,He?{passive:!1}:void 0),We=!0))}}else console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},Xe=function(e){e?(Ve=Ve.filter((function(t){return t.targetElement!==e})),Re&&(e.ontouchstart=null,e.ontouchmove=null,We&&0===Ve.length&&(document.removeEventListener("touchmove",Ge,He?{passive:!1}:void 0),We=!1)),Re?function(){if(void 0!==$e){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=$e.position,document.body.style.top=$e.top,document.body.style.left=$e.left,window.scrollTo(t,e),$e=void 0}}():(void 0!==qe&&(document.body.style.paddingRight=qe,qe=void 0),void 0!==Ze&&(document.body.style.overflow=Ze,Ze=void 0))):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},Qe=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Ye={"text/plain":"Text","text/html":"Url",default:"Text"};var et=function(e,t){var n,r,o,i,a,s,l=!1;t||(t={}),n=t.debug||!1;try{if(o=Qe(),i=document.createRange(),a=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Ye[t.format]||Ye.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),l=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),s&&document.body.removeChild(s),o()}return l};const tt=e=>({id:e,type:"paragraph",nodeType:"block",children:[{text:""}]});function nt(e,t,n=!1){n&&Object.keys(u.marks(e)||{}).forEach((t=>{u.removeMark(e,t)})),!function(e,t){const n=u.marks(e);return!!(null==n?void 0:n[t])}(e,t)?u.addMark(e,t,!0):u.removeMark(e,t)}const rt={hoveredElement:null,isElementOptionsOpen:!1,nodeSettingsPos:null,dndState:ze,disableWhileDrag:!1,DRAG_MAP:new Map,selectedNodeElement:null},ot=r.createContext([rt,{openNodeSettings:(e,t)=>{},closeNodeSettings:()=>{},hoverIn:(e,t)=>{},triggerPlusButton:e=>{},deleteNode:()=>{},duplicateNode:()=>{},copyLinkNode:()=>{},onDrop:e=>{},onDragEnd:e=>{},onDragEnter:e=>{},onDragStart:e=>{},changeHoveredNode:e=>{},changeSelectedNodeElement:e=>{}}]),it=({children:t})=>{const n=_(),[r,i]=(e=>{const[t,n]=o(!1),[r,i]=o(ze),[a]=o((()=>new Map)),s=t=>{var n;t.preventDefault(),t.stopPropagation();const r=t.target.closest("[data-element-id]");if(r){const{elementId:t,elementType:o}=r.dataset;if(!t||!o)return;const s=a.get(t);if(null===(n=s.data)||void 0===n?void 0:n.skipDrag)return;const l=w.findPath(e,s);i((e=>({from:e.from,to:{path:l,element:{id:t,type:o},parent:null}})))}};return[{dndState:r,disableWhileDrag:t,DRAG_MAP:a},{onDrop:t=>{try{u.withoutNormalizing(e,(()=>{var n,o;if(t.preventDefault(),t.stopPropagation(),(null===(n=r.from.element)||void 0===n?void 0:n.id)===(null===(o=r.to.element)||void 0===o?void 0:o.id))return;const i=r.from.path,s=a.get(r.to.element.id);let l=w.findPath(e,s);if(!i||!l)return;const[c,d]=u.node(e,i),[f,v]=u.parent(e,d);if(console.log("fromPath",i),console.log("fromElementPath",d),console.log("toPath",l),console.log("toPath next",p.next(l)),console.log("fromElementNode",c),console.log("parentElementNode",f),l.length>1){const t=Fe(c);l.length>i.length?(h.insertNodes(e,t,{at:l.length===i.length?l:p.next(l),match:e=>g.isElement(e),mode:"lowest"}),h.removeNodes(e,{at:i,match:e=>g.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"})):(h.removeNodes(e,{at:i,match:e=>g.isElement(e)&&e.id===(null==t?void 0:t.id),mode:"lowest"}),h.insertNodes(e,t,{at:l.length===i.length?l:p.next(l),match:e=>g.isElement(e),mode:"lowest"})),1===f.children.length&&g.isElement(f.children[0])&&h.removeNodes(e,{at:v,match:e=>g.isElement(e)&&f.id===e.id,mode:"lowest"})}else h.moveNodes(e,{at:i,to:l,match:e=>g.isElement(e)&&g.isElement(c)&&c.type===e.type,mode:"lowest"});t.dataTransfer.clearData(),a.clear()}))}catch(e){console.error(e)}},onDragEnd:e=>{e.stopPropagation(),e.target.removeAttribute("draggable"),e.target.ondragstart=null,e.target.ondragend=null,e.target.ondragenter=null,e.target.ondragover=null,n(!1),i(ze)},onDragEnter:s,onDragStart:(e,t)=>{n(!0),e.dataTransfer.setData("Text",""),e.dataTransfer.effectAllowed="move";const r=document.getElementById("yoopta-contenteditable");r&&(r.ondragenter=e=>s(e),r.ondragover=e=>(e.stopPropagation(),e.preventDefault(),!1),i((e=>({to:e.to,from:t}))))}}]})(n),[a,l]=o(null),[c,d]=o((()=>(({children:e})=>{if(1===e.length)return e[0];return null})(n))),[f,v]=o(null),[y,m]=o(!1),b=Object.assign({hoveredElement:c,isElementOptionsOpen:y,nodeSettingsPos:a,selectedNodeElement:f},r),x=s((()=>Object.assign({hoverIn:(e,t)=>{var n;if(y)return e.preventDefault();(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.skipSettings)||d(t)},changeSelectedNodeElement:e=>{console.log("changeSelectedNodeElement node ",e),v(e)},changeHoveredNode:e=>d(e),triggerPlusButton:e=>{u.withoutNormalizing(n,(()=>{if(!n.selection||!e)return;const t=w.findPath(n,e),r=p.next([t[0]]),o=tt(Te());h.insertNodes(n,o,{at:r,select:!0}),d(o)}))},openNodeSettings:(e,t)=>{Je(document.body,{reserveScrollBarGap:!0}),m(!0),v(t);let r=w.findPath(n,t).concat(0);if(g.isElement(null==t?void 0:t.children[0])&&(r=r.concat(0)),h.select(n,{path:r,offset:0}),d(t),e.current){const t=e.current.getBoundingClientRect();l({left:t.left+t.width+10,top:t.top})}},closeNodeSettings:()=>{Xe(document.body),m(!1),l(null),v(null)},deleteNode:()=>{if(c)try{u.withoutNormalizing(n,(()=>{var e;const t=w.findPath(n,c),[r,o]=u.parent(n,t);if(!t)return;let i="highest";if(g.isElement(r)){if(1===r.children.length&&g.isElement(r.children[0]))return h.removeNodes(n,{at:o,match:e=>g.isElement(e)&&e.id===r.id,mode:"highest"}),d(null),void x.closeNodeSettings();(null===(e=r.data)||void 0===e?void 0:e.depth)>0&&(i="lowest")}h.removeNodes(n,{at:t,match:e=>g.isElement(e),mode:i}),d(null),x.closeNodeSettings()}))}catch(e){console.log({error:e})}},duplicateNode:()=>{u.withoutNormalizing(n,(()=>{if(!c)return;const e=w.findPath(n,c),t=p.next(e),r=Fe(c);r.id=Te(),h.insertNodes(n,r,{at:t,match:e=>g.isElement(e),mode:"highest",select:!0}),w.focus(n),d(null),x.closeNodeSettings()}))},copyLinkNode:()=>{0===window.location.hash.length?et(`${window.location.href}#${null==c?void 0:c.id}`):et(`${window.location.href.split("#")[0]}#${null==c?void 0:c.id}`),x.closeNodeSettings()}},i)),[c,y,r,n.children]),O=s((()=>[b,x]),[c,y,r,n.selection,n.children]);return e(ot.Provider,Object.assign({value:O},{children:t}))},at=()=>a(ot);var st,lt={};
|
|
8
8
|
/*!
|
|
9
9
|
Copyright (c) 2018 Jed Watson.
|
|
10
10
|
Licensed under the MIT License (MIT), see
|
|
11
11
|
http://jedwatson.github.io/classnames
|
|
12
12
|
*/
|
|
13
|
-
st={get exports(){return lt},set exports(e){lt=e}},function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var s in o)e.call(o,s)&&o[s]&&n.push(s)}}}return n.join(" ")}st.exports?(t.default=t,st.exports=t):window.classNames=t}();var ct=lt;function dt(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var ut="u-OdDyDx",ft="xA0VqV0c";dt(".u-OdDyDx:after{color:#aaa;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);user-select:none}.xA0VqV0c{background-color:#accef7}");const pt={margin:"1px 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:"inherit"},ht=l((({attributes:t,children:n,placeholder:r,leaf:o})=>{const i=O();return e("span",Object.assign({},t,{"data-placeholder":r,style:pt,className:ct({[ut]:o.withPlaceholder&&r&&i,[ft]:o.selection})},{children:n}))}));ht.displayName="TextLeaf";var gt;function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}var yt,mt=function(e){return n.createElement("svg",vt({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),gt||(gt=n.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function bt(){return bt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bt.apply(this,arguments)}var wt=function(e){return n.createElement("svg",bt({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),yt||(yt=n.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))},_t="QEROK9NJ",Ot="ZLDKsGEc",xt="_0wBAdXIb",Et="P40m4iJS",jt="_7iHqOybQ";dt(".QEROK9NJ{inset:0;overflow:hidden;pointer-events:none;position:fixed;z-index:999}.ZLDKsGEc,._0wBAdXIb{position:relative;z-index:0}._0wBAdXIb{pointer-events:auto}.P40m4iJS{height:100vh;left:0;position:fixed;top:0;width:100vw}._7iHqOybQ{pointer-events:auto;position:relative;top:100%}");const kt=({children:n,onClose:r})=>{const[a]=o((()=>document.createElement("div")));return i((()=>(a.className="yoopta-overlay",document.body.appendChild(a),()=>{document.body.removeChild(a)})),[a]),N(t("div",Object.assign({className:_t},{children:[e("div",{className:Ot}),t("div",Object.assign({className:xt},{children:[e("div",{className:Et,onClick:r}),e("div",Object.assign({className:jt,onClick:e=>e.stopPropagation()},{children:n}))]}))]})),a)};var Nt;function St(){return St=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},St.apply(this,arguments)}var Pt,Dt=function(e){return n.createElement("svg",St({viewBox:"0 0 16 16",className:"trash_svg__trash",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Nt||(Nt=n.createElement("path",{d:"M4.862 15.429h6.283c1.045 0 1.722-.636 1.77-1.689l.465-9.85h.752c.342 0 .608-.26.608-.602a.594.594 0 0 0-.608-.595H11.09V1.668C11.09.622 10.427 0 9.292 0H6.694C5.566 0 4.896.622 4.896 1.668v1.025H1.861a.598.598 0 1 0 0 1.196h.76l.464 9.858c.048 1.053.718 1.682 1.777 1.682Zm1.292-13.7c0-.355.246-.58.63-.58h2.42c.382 0 .628.225.628.58v.964H6.154V1.73ZM4.992 14.22c-.376 0-.65-.274-.67-.677L3.864 3.89h8.251l-.444 9.652c-.014.403-.287.677-.677.677H4.992Zm.991-1.1c.288 0 .472-.185.465-.452l-.205-7.164c-.007-.274-.198-.451-.472-.451-.287 0-.471.184-.464.45l.205 7.165c.007.273.198.451.471.451Zm2.017 0c.287 0 .479-.185.479-.452V5.503c0-.267-.192-.451-.479-.451s-.479.184-.479.45v7.165c0 .267.192.451.479.451Zm2.017 0c.273 0 .458-.179.464-.452l.212-7.164c.007-.267-.184-.451-.464-.451-.274 0-.465.177-.472.45l-.212 7.165c-.007.267.184.451.472.451Z"})))};function At(){return At=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},At.apply(this,arguments)}var Ct,Tt=function(e){return n.createElement("svg",At({viewBox:"0 0 16 16",className:"duplicate_svg__duplicate",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Pt||(Pt=n.createElement("path",{d:"M2.839 12.152H4v1.033c0 1.456.759 2.214 2.242 2.214h6.918c1.477 0 2.242-.758 2.242-2.214V6.212c0-1.456-.765-2.215-2.242-2.215H12V2.965c0-1.456-.766-2.215-2.242-2.215H2.839C1.362.75.597 1.502.597 2.965V9.93c0 1.463.765 2.221 2.242 2.221Zm.082-1.34c-.636 0-.984-.328-.984-.99v-6.74c0-.664.348-.999.984-.999h6.76c.63 0 .985.335.985.998v.916H6.243c-1.483 0-2.242.759-2.242 2.215v4.6h-1.08Zm3.397 3.248c-.635 0-.977-.329-.977-.992v-6.74c0-.663.342-.991.977-.991h6.761c.629 0 .984.328.984.991v6.74c0 .663-.355.992-.984.992H6.32Z"})))};function Lt(){return Lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lt.apply(this,arguments)}var Mt,Bt=function(e){return n.createElement("svg",Lt({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ct||(Ct=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 Ft(){return Ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ft.apply(this,arguments)}var zt=function(e){return n.createElement("svg",Ft({viewBox:"0 0 16 16",className:"copy_svg__link",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Mt||(Mt=n.createElement("path",{d:"m7.7 10.895 1.038-1.046c-.82-.076-1.394-.335-1.818-.76-1.155-1.154-1.155-2.795-.007-3.943l2.27-2.27c1.155-1.155 2.789-1.155 3.944 0 1.162 1.169 1.155 2.796.007 3.944l-1.176 1.176a2.74 2.74 0 0 1 .17 1.634l1.963-1.955c1.682-1.675 1.688-4.054-.007-5.75C12.389.225 10.01.238 8.335 1.913L5.956 4.298c-1.675 1.675-1.688 4.054.007 5.749.403.396.943.697 1.736.848Zm.6-5.763L7.27 6.178c.813.075 1.394.342 1.811.759 1.162 1.162 1.162 2.795.007 3.944l-2.27 2.27c-1.155 1.155-2.782 1.155-3.944 0-1.162-1.163-1.155-2.796 0-3.945L4.042 8.03a2.788 2.788 0 0 1-.17-1.634L1.915 8.352c-1.682 1.674-1.688 4.06.007 5.755 1.695 1.696 4.074 1.682 5.749.007l2.372-2.379c1.682-1.681 1.688-4.06-.007-5.749-.396-.403-.936-.704-1.736-.854Z"})))};const Ht=r.createContext({marks:{},elements:{}}),It=({children:t,plugins:n,marks:o,tools:i})=>{const a=_(),l=c(),d=e=>{if(!a.selection)return!1;const[t]=u.nodes(a,{at:u.unhangRange(a,a.selection),match:t=>!u.isEditor(t)&&g.isElement(t)&&!u.isInline(a,t)&&t.type===e,mode:"highest"});return!!t},f=()=>{const e={};return n.forEach((t=>{const{createElement:n,defineElement:r,type:o,options:i,hasParent:s}=t;e[t.type]={create:n,define:r,toggle:e=>((e,t)=>{u.withoutNormalizing(a,(()=>{var n;if(!a.selection)return;const{offset:r,path:o}=a.selection.anchor,{shouldDeleteText:i}=t||{};i&&h.delete(a,{at:{anchor:{path:o,offset:0},focus:{path:o,offset:r}}});const s=u.above(a,{at:a.selection,mode:"highest",match:e=>!u.isEditor(e)&&g.isElement(e)}),[l,c]=u.parent(a,p.parent(a.selection.anchor.path)),[d]=s||[];(null==d?void 0:d.type)!==e.type?(g.isElement(l)&&!u.isEditor(l)&&h.unwrapNodes(a,{at:c,match:e=>!u.isEditor(e)&&!v.isText(e)&&g.isElement(l)&&e.type===l.type}),null===(n=e.createElement)||void 0===n||n.call(e,a,{id:d.id})):h.setNodes(a,tt(Te()),{mode:"highest",match:e=>!u.isEditor(e)&&g.isElement(e)})}))})(t,e),type:o,isActive:!s&&d(o),options:{displayLabel:null==i?void 0:i.displayLabel}}})),e},y=s((()=>f()),[n,a.selection]),m=e=>{const t=u.marks(a);return!!(null==t?void 0:t[e])},b=s((()=>{const e={};return null==o||o.forEach((t=>{e[t.type]={toggle:e=>((e,t=!1)=>{t&&Object.keys(u.marks(a)||{}).forEach((e=>{u.removeMark(a,e)})),m(e)?u.removeMark(a,e):u.addMark(a,e,!0)})(t.type,null==e?void 0:e.only),isActive:m(t.type)}})),e}),[o,a.selection]),w=s((()=>{const e=Object.keys(i||{});if(0===e.length)return;const t={};return e.forEach((e=>{const o=null==i?void 0:i[e];o&&r.isValidElement(o)&&(t[e]=e=>{var{style:t,className:i}=e,a=H(e,["style","className"]);return r.cloneElement(o,Object.assign(Object.assign({style:t,className:i,plugins:n,fromHook:!0},null==o?void 0:o.props),a))})})),t}),[i]);return l.current={elements:y,marks:b,tools:w},e(Ht.Provider,Object.assign({value:l.current},{children:t}))},Rt=()=>a(Ht),Vt=()=>a(Ht).marks,Wt=()=>a(Ht).elements,Ut=()=>a(Ht).tools;var Zt="IMJgzRnZ",$t="nFfAiJWo",qt="DeARgIyF",Kt="kyuzONcU",Gt="_95up7F66",Jt="_9d0T-cEo";dt(".IMJgzRnZ{align-items:center;background:#fff;border-radius:4px;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:auto;max-height:70vh;max-width:calc(100vw - 24px);min-width:200px;opacity:1;overflow:hidden;position:fixed;transform-origin:0 top;width:auto}.nFfAiJWo{flex-grow:1;margin-bottom:0;margin-right:0;min-height:0;overflow:hidden auto;position:relative;transform:translateZ(0);width:100%;z-index:1}.DeARgIyF{box-shadow:0 -1px 0 rgba(55,53,47,.09);padding-bottom:6px;padding-top:6px}.kyuzONcU{align-items:center;background:inherit;border:none;border-radius:3px;color:#000;cursor:pointer;display:flex;font-size:14px;line-height:120%;margin-left:4px;margin-right:4px;min-height:28px;transition:background 20ms ease-in 0s;user-select:none;width:calc(100% - 8px)}.kyuzONcU:hover{background-color:rgba(55,53,47,.08);color:#000}._95up7F66{align-items:center;color:#000;display:flex;justify-content:center;margin-left:10px;margin-right:4px}._9d0T-cEo{flex:1 1 auto;margin-left:6px;margin-right:6px;overflow:hidden;text-align:left;text-overflow:ellipsis}._5FdNFUNm,._9d0T-cEo{min-width:0;white-space:nowrap}._5FdNFUNm{color:rgba(55,53,47,.5);flex-shrink:0;font-size:12px;margin-left:auto;margin-right:12px}");const Xt={position:"fixed",opacity:1,bottom:"auto",right:"auto"},Qt=n=>{var{onClose:r,style:i,element:a,render:s}=n,l=H(n,["onClose","style","element","render"]);const[d,f]=o({style:Xt,open:!1}),p=c(null),h=_(),g=Ut(),[,v]=at(),{ActionMenu:y}=g||{},m=!!y,b=u.isVoid(h,a),w=()=>f({style:Xt,open:!1});return e(kt,Object.assign({onClose:r},{children:e("div",Object.assign({style:i,className:ct(Zt,"yoopta-element-options"),ref:p},{children:t("div",Object.assign({className:$t},{children:[d.open&&y&&e(kt,Object.assign({onClose:w},{children:y&&e(y,{style:d.style,options:{shouldDeleteText:!1},on:{toggle:()=>{w(),v.closeNodeSettings()}}})})),t("div",Object.assign({className:qt},{children:[t("button",Object.assign({type:"button",className:Kt,onClick:()=>{var e;v.deleteNode(),null===(e=l.onDelete)||void 0===e||e.call(l)}},{children:[e("div",Object.assign({className:Gt},{children:e(Dt,{})})),e("div",Object.assign({className:Jt},{children:"Delete"}))]})),t("button",Object.assign({type:"button",className:Kt,onClick:()=>{var e;v.duplicateNode(),null===(e=l.onDuplicate)||void 0===e||e.call(l)}},{children:[e("div",Object.assign({className:Gt},{children:e(Tt,{})})),e("div",Object.assign({className:Jt},{children:"Duplicate"}))]})),!b&&m&&t("button",Object.assign({type:"button",className:Kt,onClick:e=>{var t;const n=p.current.getBoundingClientRect(),r=null===(t=document.querySelector(".yoopta-action-menu-list"))||void 0===t?void 0:t.getBoundingClientRect(),o={left:n.left+n.width+10,top:n.top+n.height};r&&o.left+r.width>window.innerWidth&&(o.left=n.left-r.width-10),r&&o.top<r.height&&(o.top=r.height+20),f((e=>({open:!e.open,style:Object.assign(Object.assign({},e.style),o)})))}},{children:[e("div",Object.assign({className:Gt},{children:e(Bt,{})})),e("div",Object.assign({className:Jt},{children:"Turn into"}))]})),t("button",Object.assign({type:"button",className:Kt,onClick:()=>{var e;v.copyLinkNode(),null===(e=l.onCopy)||void 0===e||e.call(l)}},{children:[e("div",Object.assign({className:Gt},{children:e(zt,{})})),e("div",Object.assign({className:Jt},{children:"Copy link to block"}))]}))]}))]}))}))}))};var Yt="yCQ-VdE5",en="b--398nS",tn="_6VhqH6wy",nn="k9i48GWd",rn="TNeDy6y5",on="jVfkavqE",an="_87oFW01f",sn="oz5S7EmO";dt('.yCQ-VdE5{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}.b--398nS{opacity:1}._6VhqH6wy{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}._6VhqH6wy:active,._6VhqH6wy:focus,._6VhqH6wy:hover{background-color:rgba(55,54,47,.08)}.k9i48GWd{width:24px}.TNeDy6y5{position:relative;transition:opacity .18s cubic-bezier(.4,0,.2,1)}.jVfkavqE:after{background-color:#007aff;bottom:-7px;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:before{top:-5px}._87oFW01f:after,._87oFW01f:before{background-color:inherit;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:after{bottom:-7px}.oz5S7EmO{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:background-color .18s cubic-bezier(.4,0,.2,1);z-index:81}');const ln=({element:n,editor:r,values:o,handlers:i})=>{const a=c(null),{hoveredElement:s,isElementOptionsOpen:l,nodeSettingsPos:d}=o,{onDragEnd:f,onDragStart:p,openNodeSettings:h,closeNodeSettings:v,triggerPlusButton:y}=i,m=e=>{e.stopPropagation();const t=a.current,o=document.querySelector(`[data-element-id="${null==n?void 0:n.id}"]`),i=w.findPath(r,n),s=u.parent(r,i);g.isElement(n)&&(null==t||t.setAttribute("draggable","false"),o&&(o.setAttribute("draggable","true"),o.ondragstart=e=>{const t={path:i,element:{id:n.id,type:n.type},parent:s};p(e,t)},o.ondragend=f))},b=(null==s?void 0:s.id)===n.id;return t("div",Object.assign({contentEditable:!1,className:ct(Yt,{[en]:b},"yoopta-element-actions")},{children:[b&&l&&e(Qt,{element:n,style:d||void 0,onClose:v}),e("button",Object.assign({type:"button",onMouseDown:m,className:ct(tn,nn,"yoopta-element-actions-plus"),onClick:()=>y(n)},{children:e(wt,{})})),e("button",Object.assign({type:"button",onMouseDown:m,className:ct(tn,"yoopta-element-actions-drag"),onClick:()=>h(a,n),ref:a},{children:e(mt,{})}))]}))},cn=({children:n,element:r,attributes:o,nodeType:i,render:a,HTMLAttributes:l})=>{var c,d;const u=_(),[f,p]=at(),h="inline"===i,{hoverIn:g,onDrop:v}=p,{dndState:y,DRAG_MAP:m}=f,b=s((()=>{var e,t;if(null===y.from.element||null===y.to.element)return{isDragging:!1,isDragOver:!1,isDragSelf:!1};const n=(null===(e=f.dndState.from.element)||void 0===e?void 0:e.id)===r.id,o=(null===(t=f.dndState.to.element)||void 0===t?void 0:t.id)===r.id;return{isDragging:n,isDragOver:o,isDragSelf:n&&o}}),[f.dndState.from,f.dndState.to]),w=null===(c=r.data)||void 0===c?void 0:c.skipSettings,{isDragging:O,isDragOver:x,isDragSelf:E}=b,j={opacity:O?.7:1};return m.set(r.id,r),h?a({attributes:o,element:r,children:n,HTMLAttributes:l}):t("div",Object.assign({"data-element-id":r.id,"data-element-type":r.type,onMouseEnter:e=>{w||g(e,r)},onDrop:v,className:ct(rn,{[on]:x,[an]:E}),style:j},o,{children:[w?null:e(ln,{editor:u,element:r,handlers:p,values:f}),a({attributes:o,element:r,children:n,HTMLAttributes:l}),(null===(d=f.selectedNodeElement)||void 0===d?void 0:d.id)===r.id&&e("div",{className:ct(sn,"yoopta-selected-node-element")})]}))};cn.displayName="ElementWrapper";var dn={};Object.defineProperty(dn,"__esModule",{value:!0});for(var un="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),fn={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},pn={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:un?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},hn={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},gn=1;gn<20;gn++)hn["f"+gn]=111+gn;function vn(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return yn(e,t)})),o=function(e){return r.some((function(t){return mn(t,e)}))};return null==n?o:o(n)}function yn(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in fn)r[fn[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(s=(d=u.next()).done);s=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=wn(f),g=fn[h];if(f.length>1&&!g&&!pn[f]&&!hn[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=bn(f)),g&&(r[g]=!p||null)}}catch(e){l=!0,c=e}finally{try{!s&&u.return&&u.return()}finally{if(l)throw c}}return r}function mn(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function bn(e){return e=wn(e),hn[e]||e.toUpperCase().charCodeAt(0)}function wn(e){return e=e.toLowerCase(),e=pn[e]||e}dn.default=vn;var _n=dn.isHotkey=vn,On=dn.isCodeHotkey=function(e,t){return vn(e,t)},xn=dn.isKeyHotkey=function(e,t){return vn(e,{byKey:!0},t)};dn.parseHotkey=yn,dn.compareHotkey=mn,dn.toKeyCode=bn,dn.toKeyName=wn;const En={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",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",kekCeburek:"mod+enter"},jn={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"},kn={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Nn=e=>{const t=En[e],n=jn[e],r=kn[e],o=t&&xn(t),i=n&&xn(n),a=r&&xn(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},Sn={isBold:Nn("bold"),isCompose:Nn("compose"),isArrowLeft:Nn("arrowLeft"),isArrowRight:Nn("arrowRight"),isArrowUp:Nn("arrowUp"),isArrowDown:Nn("arrowDown"),isDeleteBackward:Nn("deleteBackward"),isDeleteForward:Nn("deleteForward"),isDeleteLineBackward:Nn("deleteLineBackward"),isDeleteLineForward:Nn("deleteLineForward"),isDeleteWordBackward:Nn("deleteWordBackward"),isDeleteWordForward:Nn("deleteWordForward"),isExtendBackward:Nn("extendBackward"),isExtendForward:Nn("extendForward"),isExtendLineBackward:Nn("extendLineBackward"),isExtendLineForward:Nn("extendLineForward"),isItalic:Nn("italic"),isMoveLineBackward:Nn("moveLineBackward"),isMoveLineForward:Nn("moveLineForward"),isCtrlLeft:Nn("ctrlLeft"),isCtrlRight:Nn("ctrlRight"),isRedo:Nn("redo"),isShiftEnter:Nn("shiftEnter"),isEnter:Nn("enter"),isTransposeCharacter:Nn("transposeCharacter"),isUndo:Nn("undo"),isSpace:Nn("space"),isSelect:Nn("select"),isTab:Nn("tab"),isShiftTab:Nn("shiftTab"),isBackspace:Nn("backspace"),isCmdEnter:Nn("cmdEnter"),isCmd:Nn("cmd"),isEscape:Nn("escape"),isKekceburek:Nn("kekCeburek")},Pn=(e,t)=>!!((e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(u.nodes(e,{at:u.unhangRange(e,n),match:e=>!u.isEditor(e)&&g.isElement(e)&&e.type===t}));return r})(e,t),Dn=(e,t,n="lowest")=>{var r;const o=Array.from(u.nodes(e,{match:t=>u.isEditor(e)&&g.isElement(t),at:t||(null===(r=e.selection)||void 0===r?void 0:r.anchor.path),mode:n}))[0];return o?o[0]:e.children[0]};function An(e,t){var n,r;if(v.isText(e))return function(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,(e=>t[e]))}(e.text);const o=e.children.map((e=>An(e,t))).join(""),i=t[e.type];return"function"==typeof(null===(r=null===(n=i.exports)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)?i.exports.html.serialize(e,o):o}function Cn(e,t){return e.map((e=>An(e,t))).join("")}const Tn={outline:"none"},Ln={hotkeys:Sn,defaultNode:tt(Te())},Mn=({editor:n,placeholder:r,marks:o,readOnly:a,plugins:l,className:f,PLUGINS_MAP:v})=>{i((()=>{const e=window.location.hash.length>0?window.location.hash.replace("#",""):null;if(e){const t=document.getElementById(e)||document.querySelector(`[data-element-id="${e}"]`);t&&window.scrollTo({top:t.offsetTop,behavior:"smooth"})}}),[]);const m=c(null),[{disableWhileDrag:b},{changeHoveredNode:_}]=at(),O=Ut(),{ActionMenu:E,Toolbar:j}=O||{},k=b||a,N=s((()=>t=>{var r;const o=v[t.element.type];if(!o)return null;const i=function(e){return"function"==typeof e.renderer?e.renderer:e.renderer.editor}(o)(n,o);return e(cn,Object.assign({element:t.element,attributes:t.attributes,nodeType:t.element.nodeType,render:i,HTMLAttributes:null===(r=o.options)||void 0===r?void 0:r.HTMLAttributes},{children:t.children}))}),[l,n]),S=s((()=>e=>{const t=[],[r,o]=e;return l.forEach((o=>{const i=o.decorator;"function"==typeof i&&g.isElement(r)&&r.type===o.type&&t.push(...i(n)(e))})),n.selection&&!u.isEditor(r)&&""===u.string(n,[o[0]])&&y.includes(n.selection,o)&&y.isCollapsed(n.selection)&&t.push(Object.assign(Object.assign({},n.selection),{withPlaceholder:!0})),t}),[l,n]),P=s((()=>t=>{var i;const a=Object.assign({},t);let s;l.forEach((e=>{if(e.leaf){const t=e.leaf(n)(a);t&&(a.children=t)}})),null==o||o.forEach((e=>{a.leaf[e.type]&&(a.children=e.render(a))}));const c=null===(i=a.children.props)||void 0===i?void 0:i.parent;if(!function(e){var t,n;return 1!==(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)||0!==(null===(n=null==e?void 0:e.children[0])||void 0===n?void 0:n.text.length)}(c)){const e=v[null==c?void 0:c.type];s=null===(null==e?void 0:e.placeholder)?null:(null==e?void 0:e.placeholder)||r}return e(ht,Object.assign({},a,{placeholder:s}))}),[l,n]),D=s((()=>{const e=l.map((e=>Object.keys(e.events||{}))).flat().filter(((e,t,n)=>n.indexOf(e)===t)),t={};return e.forEach((e=>{t[e]=function(t){l.forEach((r=>{var o;if(null===(o=r.events)||void 0===o?void 0:o[e]){r.events[e](n,Ln)(t)}}))}})),t}),[l,n]),A=d((e=>{u.withoutNormalizing(n,(()=>{var t;if(!n.selection)return;const r=tt(Te());null==o||o.forEach((t=>{t.hotkey&&xn(t.hotkey)(e)&&(e.preventDefault(),nt(n,t.type,!1))})),null===(t=D.onKeyDown)||void 0===t||t.call(D,e);const i=u.above(n,{match:e=>!u.isEditor(e),mode:"lowest"});if(Sn.isEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=Object.keys(u.marks(n)||{});t.length>0&&t.forEach((e=>u.removeMark(n,e)));const o=p.parent(n.selection.anchor.path),a=u.string(n,o),s=i&&i[0].type!==r.type;if(s&&0===a.length)return void h.setNodes(n,r,{at:o});if(u.isStart(n,n.selection.anchor,n.selection.anchor.path)&&s){const[e]=i;return h.setNodes(n,r,{at:o}),h.delete(n,{unit:"block"}),h.insertNodes(n,Fe(e),{at:p.next(o)}),void h.select(n,{path:[p.next(n.selection.anchor.path)[0]+1,0],offset:0})}return h.splitNodes(n,{always:!0}),h.setNodes(n,r),void _(r)}if(Sn.isShiftEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault(),n.insertText("\n")}if(Sn.isSelect(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=u.above(n,{at:n.selection.anchor.path,match:e=>!u.isEditor(e)&&g.isElement(e)});if(!t)return;const r=u.string(n,t[1]);return y.isExpanded(n.selection)||0===r.length?void h.select(n,[]):void h.select(n,t[1])}}))}),[]);return t("div",Object.assign({id:"yoopta-editor",className:f,ref:m,onMouseDown:e=>{a||(e.preventDefault(),e.currentTarget===e.target&&n.selection&&u.withoutNormalizing(n,(()=>{const e=[n.children.length-1,0],t=Dn(n,e,"highest"),r=u.string(n,e),o={anchor:{path:e,offset:0},focus:{path:e,offset:0}};if("paragraph"===t.type&&0===r.length)return h.select(n,{path:o.anchor.path,offset:0}),_(t),w.focus(n);const i=tt(Te());_(i),h.insertNodes(n,i,{at:[n.children.length],select:!0}),w.focus(n)})))}},{children:[!!E&&e(E,{}),!!j&&e(j,{}),e(x,Object.assign({id:"yoopta-contenteditable",renderLeaf:P,renderElement:N,readOnly:k,decorate:S,onCopy:e=>{if(!n.selection)return;const t=Cn(u.fragment(n,n.selection),n.plugins);return e.clipboardData.setData("text/html",t),e.clipboardData},spellCheck:!0},D,{onKeyDown:A,onMouseDown:e=>{var t;null===(t=D.onMouseDown)||void 0===t||t.call(D,e),(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})(e)},style:Tn}))]}))};function Bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fn=new WeakMap,zn=new WeakMap;class Hn{}class In extends Hn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class Rn extends Hn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var Vn=e=>zn.get(e);function Wn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wn(Object(n),!0).forEach((function(t){Bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Zn=new WeakSet,$n=e=>{var t=[],n=e=>{if(null!=e){var r=t[t.length-1];if("string"==typeof e){var o={text:e};Zn.add(o),e=o}if(v.isText(e)){var i=e;v.isText(r)&&Zn.has(r)&&Zn.has(i)&&v.equals(r,i,{loose:!0})?r.text+=i.text:t.push(i)}else if(g.isElement(e))t.push(e);else{if(!(e instanceof Hn))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];v.isText(a)||(n(""),a=t[t.length-1]),e instanceof In?((e,t)=>{var n=e.text.length;Fn.set(e,[n,t])})(a,e):e instanceof Rn&&((e,t)=>{var n=e.text.length;zn.set(e,[n,t])})(a,e)}}};for(var r of e.flat(1/0))n(r);return t};function qn(e,t,n){return Un(Un({},t),{},{children:$n(n)})}function Kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(n),!0).forEach((function(t){Bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Jn,Xn={anchor:function(e,t,n){return new In(t)},cursor:function(e,t,n){return[new In(t),new Rn(t)]},editor:(Jn=b,(e,t,n)=>{var r,o=[];for(var i of n)y.isRange(i)?r=i:o.push(i);var a,s=$n(o),l={},c=Jn();for(var[d,u]of(Object.assign(c,t),c.children=s,m.texts(c))){var f=(a=d,Fn.get(a)),p=Vn(d);if(null!=f){var[h]=f;l.anchor={path:u,offset:h}}if(null!=p){var[g]=p;l.focus={path:u,offset:g}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=r?c.selection=r:y.isRange(l)&&(c.selection=l),c}),element:qn,focus:function(e,t,n){return new Rn(t)},fragment:function(e,t,n){return $n(n)},selection:function(e,t,n){var r=n.find((e=>e instanceof In)),o=n.find((e=>e instanceof Rn));if(!r||null==r.offset||null==r.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return Un({anchor:{offset:r.offset,path:r.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,t,n){var r=$n(n);if(r.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[o]=r;if(null==o&&(o={text:""}),!v.isText(o))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return Zn.delete(o),Object.assign(o,t),o}},Qn=e=>function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=e[t];if(!a)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==n&&(n={}),D(n)||(o=[n].concat(o),n={}),a(t,n,o=o.filter((e=>Boolean(e))).flat())},Yn=e=>{var t={},n=function(n){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>qn(0,Gn(Gn({},r),t),n)};for(var r in e)n(r);return t},er=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=Yn(t),r=Gn(Gn(Gn({},Xn),n),e.creators);return Qn(r)}();const tr={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},nr=(e,t)=>{var n,r,o,i;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:a}=e;let s=e,l=Array.from(s.childNodes).map((e=>nr(e,t))).flat();if(0===l.length&&(l=[{text:""}]),"BODY"===e.nodeName)return er("fragment",{},l);if(t[a]){const s=t[a];if(s){let t=s.defineElement();if("function"==typeof(null===(r=null===(n=s.exports)||void 0===n?void 0:n.html.deserialize)||void 0===r?void 0:r.parse)){const n=null===(i=null===(o=s.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.parse(e);t=Object.assign(Object.assign({},t),{data:n})}return er("element",t,l)}}if(v.isTextList(l)&&(l=l.filter((e=>""!==e.text)),l.length>0))return er("element",t.P.defineElement(),l);if(tr[a]){const t=tr[a](e);return l.map((e=>v.isText(e)?er("text",t,e):e))}return l};function rr(e,t){try{const n=function(e){const t={};return Object.keys(e).forEach((n=>{var r,o,i,a,s,l,c,d;const u=e[n];if(null===(o=null===(r=u.exports)||void 0===r?void 0:r.html.deserialize)||void 0===o?void 0:o.nodeName){if(Array.isArray(null===(a=null===(i=u.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.nodeName))return void(null===(l=null===(s=u.exports)||void 0===s?void 0:s.html.deserialize)||void 0===l||l.nodeName.forEach((e=>{t[e]=u})));t[null===(d=null===(c=u.exports)||void 0===c?void 0:c.html.deserialize)||void 0===d?void 0:d.nodeName]=u}})),t}(t),r=(new DOMParser).parseFromString(e,"text/html");return nr(r.body,n)}catch(e){return console.error(e),null}}const or=({key:t,value:n,plugins:r,marks:a,readOnly:l,onChange:c,placeholder:_,autoFocus:O=!0,offline:x,className:k,tools:N})=>{const S=function(e){return"string"==typeof e?e:"yoopta-content"}(x),[P,D]=o((()=>function(e,t,n){const r=[{id:Te(),type:"paragraph",children:[{text:""}]}],o=Le(n)?n:r;if(!t)return localStorage.removeItem(e),o;try{const t=JSON.parse(localStorage.getItem(e)||"[]");return Le(t)?t:o}catch(t){return localStorage.removeItem(e),r}}(S,x,n))),A=d((e=>{if(c(e),D(e),!x)return;if(I.operations.some((e=>"set_selection"!==e.type)))try{const t=JSON.stringify(e);localStorage.setItem(S,t)}catch(e){}}),[x]),C=s((()=>{if(!Array.isArray(r))throw new Error("Props `plugins` should be array of plugins");if(Array.isArray(r)&&0===r.length)throw new Error("Props `plugins` cannot be empty. Pass an array of plugins");const e=Pe(r),t=function(e){const t={};return e.forEach((e=>t[e.type]=e)),t}(e);return{yooptaPlugins:e,PLUGINS_MAP:t}}),[r]),{yooptaPlugins:T,PLUGINS_MAP:H}=C,I=s((()=>{let e=(e=>{const{insertData:t}=e;return e.insertData=n=>{if(!e.selection)return;const r=n.getData("text/html");if(r){const t=rr(r,e.plugins);h.insertFragment(e,t)}else t(n)},e})((e=>{const{deleteFragment:t}=e;return e.deleteFragment=()=>{const{selection:n}=e;if(!n)return;const[,r]=u.first(e,[0]),[,o]=u.last(e,[e.children.length-1]),i=u.range(e,r,o);if(y.equals(n,i))return h.removeNodes(e,{mode:"highest",hanging:!0}),void h.select(e,[0]);t()},e})((e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r]=n;if(u.isEditor(r)&&0===e.children.length){const t=tt(Te());h.insertNodes(e,t,{at:[0]})}else t(n)},e})((e=>{const{insertBreak:t,deleteBackward:n}=e;return e.insertBreak=()=>{if(!e.selection||!y.isCollapsed(e.selection))return t();const n=p.parent(e.selection.anchor.path),r=m.get(e,n);g.isElement(r)&&u.isVoid(e,r)?u.insertNode(e,{id:Te(),type:"paragraph",children:[{text:""}],nodeType:"block"}):t()},e.deleteBackward=t=>{if(!e.selection||!y.isCollapsed(e.selection)||0!==e.selection.anchor.offset)return n(t);const r=p.parent(e.selection.anchor.path),o=m.get(e,r);if(0===m.string(o).length&&p.hasPrevious(r)){const t=p.previous(r),n=m.get(e,t);if(g.isElement(n)&&u.isVoid(e,n))return h.removeNodes(e),h.select(e,t)}n(t)},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];L.withoutSaving(t,(()=>{u.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];L.withoutSaving(t,(()=>{u.withoutNormalizing(t,(()=>{var e=r.map(f.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],s=a&&a[a.length-1],l=F(e,s),c=L.isSaving(t),d=L.isMerging(t);if(null==c&&(c=B(e)),c){if(null==d&&(d=null!=a&&(0!==r.length||M(e,s)||l)),a&&d)l&&a.pop(),a.push(e);else{var u=[e];i.push(u)}for(;i.length>100;)i.shift();z(e)&&(o.redos=[])}n(e)},t})((e=>{const{insertText:t}=e;return e.insertText=n=>{var r,o;const{selection:i}=e;if(" "===n&&i&&y.isCollapsed(i)){const{anchor:a}=i,s=u.above(e,{match:t=>g.isElement(t)&&u.isBlock(e,t),mode:"lowest"});if(!s)return;const[,l]=s,c=u.parent(e,l),[d]=c;if(g.isElement(d)&&!v.isText(d.children[0]))return t(n);const f=s?l:[],p={anchor:a,focus:u.start(e,f)},y=u.string(e,p),m=null===(r=e.shortcuts)||void 0===r?void 0:r[y];if(m)return h.select(e,p),h.delete(e),void(null===(o=m.createElement)||void 0===o||o.call(m,e))}t(n)},e})(E(b())))))));e.plugins=H;const t={};return T.forEach((n=>{var r;n.shortcut&&(Array.isArray(n.shortcut)?n.shortcut.forEach((e=>t[e]=n)):t[n.shortcut]=n),e=(null===(r=n.extendEditor)||void 0===r?void 0:r.call(n,e))||e})),e.shortcuts=t,e}),[T]);return i((()=>{if(O)try{const[,e]=u.first(I,[0]);h.select(I,{anchor:{path:e,offset:0},focus:{path:e,offset:0}}),w.focus(I)}catch(e){}}),[O,I]),e(j,Object.assign({editor:I,initialValue:P,onChange:A},{children:e(it,{children:e(It,Object.assign({plugins:T,marks:a,tools:N},{children:e(Mn,{editor:I,readOnly:l,placeholder:_,plugins:T,marks:a,PLUGINS_MAP:H,className:k})}))})}),t)},ir=t=>e(S,{children:e(or,Object.assign({},t,{value:t.value,onChange:t.onChange}))});function ar({type:t,hotkey:n,className:r,as:o}){return Object.freeze({type:t,hotkey:n,render:n=>e(o||"span",Object.assign({},n.attributes,{className:ct(r,`yoopta-leaf-${t}`)},{children:n.children}))})}function sr(e){const{element:t,HTMLAttributes:n,className:r}=e;return`yoopta-${t.type} ${(null==n?void 0:n.className)||""} ${r}`}const lr={ElementOptions:Qt,Overlay:kt};export{Sn as HOTKEYS,lr as UI_HELPERS,Ne as YooptaPlugin,ar as createYooptaMark,Se as createYooptaPlugin,ct as cx,Fe as deepClone,ir as default,Je as disableBodyScroll,Xe as enableBodyScroll,Te as generateId,Dn as getElementByPath,sr as getElementClassname,On as isCodeHotkey,Pn as isElementActive,_n as isHotkey,xn as isKeyHotkey,Le as isValidYooptaNodes,Pe as mergePlugins,Wt as useElements,Vt as useMarks,at as useNodeElementSettings,Ut as useTools,Rt as useYoopta};
|
|
13
|
+
st={get exports(){return lt},set exports(e){lt=e}},function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var s in o)e.call(o,s)&&o[s]&&n.push(s)}}}return n.join(" ")}st.exports?(t.default=t,st.exports=t):window.classNames=t}();var ct=lt;function dt(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var ut="u-OdDyDx",ft="xA0VqV0c";dt(".u-OdDyDx:after{color:#aaa;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);user-select:none}.xA0VqV0c{background-color:#accef7}");const pt={margin:"1px 0",whiteSpace:"pre-wrap",wordBreak:"break-word",color:"inherit",fontSize:"inherit",lineHeight:"inherit",fontWeight:"inherit"},ht=l((({attributes:t,children:n,placeholder:r,leaf:o})=>{const i=x();return e("span",Object.assign({},t,{"data-placeholder":r,style:pt,className:ct({[ut]:o.withPlaceholder&&r&&i,[ft]:o.selection})},{children:n}))}));ht.displayName="TextLeaf";var gt;function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}var yt,mt=function(e){return n.createElement("svg",vt({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),gt||(gt=n.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function bt(){return bt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bt.apply(this,arguments)}var wt=function(e){return n.createElement("svg",bt({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),yt||(yt=n.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))},_t="QEROK9NJ",xt="ZLDKsGEc",Ot="_0wBAdXIb",Et="P40m4iJS",jt="_7iHqOybQ";dt(".QEROK9NJ{inset:0;overflow:hidden;pointer-events:none;position:fixed;z-index:999}.ZLDKsGEc,._0wBAdXIb{position:relative;z-index:0}._0wBAdXIb{pointer-events:auto}.P40m4iJS{height:100vh;left:0;position:fixed;top:0;width:100vw}._7iHqOybQ{pointer-events:auto;position:relative;top:100%}");const kt=({children:n,onClose:r})=>{const[a]=o((()=>document.createElement("div")));return i((()=>(a.className="yoopta-overlay",document.body.appendChild(a),()=>{document.body.removeChild(a)})),[a]),N(t("div",Object.assign({className:_t},{children:[e("div",{className:xt}),t("div",Object.assign({className:Ot},{children:[e("div",{className:Et,onClick:r}),e("div",Object.assign({className:jt,onClick:e=>e.stopPropagation()},{children:n}))]}))]})),a)};var Nt;function St(){return St=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},St.apply(this,arguments)}var Pt,Dt=function(e){return n.createElement("svg",St({viewBox:"0 0 16 16",className:"trash_svg__trash",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Nt||(Nt=n.createElement("path",{d:"M4.862 15.429h6.283c1.045 0 1.722-.636 1.77-1.689l.465-9.85h.752c.342 0 .608-.26.608-.602a.594.594 0 0 0-.608-.595H11.09V1.668C11.09.622 10.427 0 9.292 0H6.694C5.566 0 4.896.622 4.896 1.668v1.025H1.861a.598.598 0 1 0 0 1.196h.76l.464 9.858c.048 1.053.718 1.682 1.777 1.682Zm1.292-13.7c0-.355.246-.58.63-.58h2.42c.382 0 .628.225.628.58v.964H6.154V1.73ZM4.992 14.22c-.376 0-.65-.274-.67-.677L3.864 3.89h8.251l-.444 9.652c-.014.403-.287.677-.677.677H4.992Zm.991-1.1c.288 0 .472-.185.465-.452l-.205-7.164c-.007-.274-.198-.451-.472-.451-.287 0-.471.184-.464.45l.205 7.165c.007.273.198.451.471.451Zm2.017 0c.287 0 .479-.185.479-.452V5.503c0-.267-.192-.451-.479-.451s-.479.184-.479.45v7.165c0 .267.192.451.479.451Zm2.017 0c.273 0 .458-.179.464-.452l.212-7.164c.007-.267-.184-.451-.464-.451-.274 0-.465.177-.472.45l-.212 7.165c-.007.267.184.451.472.451Z"})))};function At(){return At=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},At.apply(this,arguments)}var Ct,Tt=function(e){return n.createElement("svg",At({viewBox:"0 0 16 16",className:"duplicate_svg__duplicate",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Pt||(Pt=n.createElement("path",{d:"M2.839 12.152H4v1.033c0 1.456.759 2.214 2.242 2.214h6.918c1.477 0 2.242-.758 2.242-2.214V6.212c0-1.456-.765-2.215-2.242-2.215H12V2.965c0-1.456-.766-2.215-2.242-2.215H2.839C1.362.75.597 1.502.597 2.965V9.93c0 1.463.765 2.221 2.242 2.221Zm.082-1.34c-.636 0-.984-.328-.984-.99v-6.74c0-.664.348-.999.984-.999h6.76c.63 0 .985.335.985.998v.916H6.243c-1.483 0-2.242.759-2.242 2.215v4.6h-1.08Zm3.397 3.248c-.635 0-.977-.329-.977-.992v-6.74c0-.663.342-.991.977-.991h6.761c.629 0 .984.328.984.991v6.74c0 .663-.355.992-.984.992H6.32Z"})))};function Lt(){return Lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Lt.apply(this,arguments)}var Mt,Bt=function(e){return n.createElement("svg",Lt({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ct||(Ct=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 Ft(){return Ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ft.apply(this,arguments)}var zt=function(e){return n.createElement("svg",Ft({viewBox:"0 0 16 16",className:"copy_svg__link",style:{width:16,height:16,display:"block",fill:"currentColor",flexShrink:0,backfaceVisibility:"hidden"}},e),Mt||(Mt=n.createElement("path",{d:"m7.7 10.895 1.038-1.046c-.82-.076-1.394-.335-1.818-.76-1.155-1.154-1.155-2.795-.007-3.943l2.27-2.27c1.155-1.155 2.789-1.155 3.944 0 1.162 1.169 1.155 2.796.007 3.944l-1.176 1.176a2.74 2.74 0 0 1 .17 1.634l1.963-1.955c1.682-1.675 1.688-4.054-.007-5.75C12.389.225 10.01.238 8.335 1.913L5.956 4.298c-1.675 1.675-1.688 4.054.007 5.749.403.396.943.697 1.736.848Zm.6-5.763L7.27 6.178c.813.075 1.394.342 1.811.759 1.162 1.162 1.162 2.795.007 3.944l-2.27 2.27c-1.155 1.155-2.782 1.155-3.944 0-1.162-1.163-1.155-2.796 0-3.945L4.042 8.03a2.788 2.788 0 0 1-.17-1.634L1.915 8.352c-1.682 1.674-1.688 4.06.007 5.755 1.695 1.696 4.074 1.682 5.749.007l2.372-2.379c1.682-1.681 1.688-4.06-.007-5.749-.396-.403-.936-.704-1.736-.854Z"})))};const Ht=r.createContext({marks:{},elements:{}}),It=({children:t,plugins:n,marks:o,tools:i})=>{const a=_(),l=c(),d=e=>{if(!a.selection)return!1;const[t]=u.nodes(a,{at:u.unhangRange(a,a.selection),match:t=>!u.isEditor(t)&&g.isElement(t)&&!u.isInline(a,t)&&t.type===e,mode:"highest"});return!!t},f=()=>{const e={};return n.forEach((t=>{const{createElement:n,defineElement:r,type:o,options:i,hasParent:s}=t;e[t.type]={create:n,define:r,toggle:e=>((e,t)=>{u.withoutNormalizing(a,(()=>{var n;if(!a.selection)return;const{offset:r,path:o}=a.selection.anchor,{shouldDeleteText:i}=t||{};i&&h.delete(a,{at:{anchor:{path:o,offset:0},focus:{path:o,offset:r}}});const s=u.above(a,{at:a.selection,mode:"highest",match:e=>!u.isEditor(e)&&g.isElement(e)}),[l,c]=u.parent(a,p.parent(a.selection.anchor.path)),[d]=s||[];(null==d?void 0:d.type)!==e.type?(g.isElement(l)&&!u.isEditor(l)&&h.unwrapNodes(a,{at:c,match:e=>!u.isEditor(e)&&!v.isText(e)&&g.isElement(l)&&e.type===l.type}),null===(n=e.createElement)||void 0===n||n.call(e,a,{id:d.id})):h.setNodes(a,tt(Te()),{mode:"highest",match:e=>!u.isEditor(e)&&g.isElement(e)})}))})(t,e),type:o,isActive:!s&&d(o),options:{displayLabel:null==i?void 0:i.displayLabel}}})),e},y=s((()=>f()),[n,a.selection]),m=e=>{const t=u.marks(a);return!!(null==t?void 0:t[e])},b=s((()=>{const e={};return null==o||o.forEach((t=>{e[t.type]={toggle:e=>((e,t=!1)=>{t&&Object.keys(u.marks(a)||{}).forEach((e=>{u.removeMark(a,e)})),m(e)?u.removeMark(a,e):u.addMark(a,e,!0)})(t.type,null==e?void 0:e.only),isActive:m(t.type)}})),e}),[o,a.selection]),w=s((()=>{const e=Object.keys(i||{});if(0===e.length)return;const t={};return e.forEach((e=>{const o=null==i?void 0:i[e];o&&r.isValidElement(o)&&(t[e]=e=>{var{style:t,className:i}=e,a=H(e,["style","className"]);return r.cloneElement(o,Object.assign(Object.assign({style:t,className:i,plugins:n,fromHook:!0},null==o?void 0:o.props),a))})})),t}),[i]);return l.current={elements:y,marks:b,tools:w},e(Ht.Provider,Object.assign({value:l.current},{children:t}))},Rt=()=>a(Ht),Vt=()=>a(Ht).marks,Wt=()=>a(Ht).elements,Ut=()=>a(Ht).tools;var Zt="IMJgzRnZ",$t="nFfAiJWo",qt="DeARgIyF",Kt="kyuzONcU",Gt="_95up7F66",Jt="_9d0T-cEo";dt(".IMJgzRnZ{align-items:center;background:#fff;border-radius:4px;box-shadow:0 0 0 1px hsla(0,0%,6%,.05),0 3px 6px hsla(0,0%,6%,.1),0 9px 24px hsla(0,0%,6%,.2);display:flex;flex-direction:column;height:auto;max-height:70vh;max-width:calc(100vw - 24px);min-width:200px;opacity:1;overflow:hidden;position:fixed;transform-origin:0 top;width:auto}.nFfAiJWo{flex-grow:1;margin-bottom:0;margin-right:0;min-height:0;overflow:hidden auto;position:relative;transform:translateZ(0);width:100%;z-index:1}.DeARgIyF{box-shadow:0 -1px 0 rgba(55,53,47,.09);padding-bottom:6px;padding-top:6px}.kyuzONcU{align-items:center;background:inherit;border:none;border-radius:3px;color:#000;cursor:pointer;display:flex;font-size:14px;line-height:120%;margin-left:4px;margin-right:4px;min-height:28px;transition:background 20ms ease-in 0s;user-select:none;width:calc(100% - 8px)}.kyuzONcU:hover{background-color:rgba(55,53,47,.08);color:#000}._95up7F66{align-items:center;color:#000;display:flex;justify-content:center;margin-left:10px;margin-right:4px}._9d0T-cEo{flex:1 1 auto;margin-left:6px;margin-right:6px;overflow:hidden;text-align:left;text-overflow:ellipsis}._5FdNFUNm,._9d0T-cEo{min-width:0;white-space:nowrap}._5FdNFUNm{color:rgba(55,53,47,.5);flex-shrink:0;font-size:12px;margin-left:auto;margin-right:12px}");const Xt={position:"fixed",opacity:1,bottom:"auto",right:"auto"},Qt=n=>{var{onClose:r,style:i,element:a,render:s}=n,l=H(n,["onClose","style","element","render"]);const[d,f]=o({style:Xt,open:!1}),p=c(null),h=_(),g=Ut(),[,v]=at(),{ActionMenu:y}=g||{},m=!!y,b=u.isVoid(h,a),w=()=>f({style:Xt,open:!1});return e(kt,Object.assign({onClose:r},{children:e("div",Object.assign({style:i,className:ct(Zt,"yoopta-element-options"),ref:p},{children:t("div",Object.assign({className:$t},{children:[d.open&&y&&e(kt,Object.assign({onClose:w},{children:y&&e(y,{style:d.style,options:{shouldDeleteText:!1},on:{toggle:()=>{w(),v.closeNodeSettings()}}})})),t("div",Object.assign({className:qt},{children:[t("button",Object.assign({type:"button",className:Kt,onClick:()=>{var e;v.deleteNode(),null===(e=l.onDelete)||void 0===e||e.call(l)}},{children:[e("div",Object.assign({className:Gt},{children:e(Dt,{})})),e("div",Object.assign({className:Jt},{children:"Delete"}))]})),t("button",Object.assign({type:"button",className:Kt,onClick:()=>{var e;v.duplicateNode(),null===(e=l.onDuplicate)||void 0===e||e.call(l)}},{children:[e("div",Object.assign({className:Gt},{children:e(Tt,{})})),e("div",Object.assign({className:Jt},{children:"Duplicate"}))]})),!b&&m&&t("button",Object.assign({type:"button",className:Kt,onClick:e=>{var t;const n=p.current.getBoundingClientRect(),r=null===(t=document.querySelector(".yoopta-action-menu-list"))||void 0===t?void 0:t.getBoundingClientRect(),o={left:n.left+n.width+10,top:n.top+n.height};r&&o.left+r.width>window.innerWidth&&(o.left=n.left-r.width-10),r&&o.top<r.height&&(o.top=r.height+20),f((e=>({open:!e.open,style:Object.assign(Object.assign({},e.style),o)})))}},{children:[e("div",Object.assign({className:Gt},{children:e(Bt,{})})),e("div",Object.assign({className:Jt},{children:"Turn into"}))]})),t("button",Object.assign({type:"button",className:Kt,onClick:()=>{var e;v.copyLinkNode(),null===(e=l.onCopy)||void 0===e||e.call(l)}},{children:[e("div",Object.assign({className:Gt},{children:e(zt,{})})),e("div",Object.assign({className:Jt},{children:"Copy link to block"}))]}))]}))]}))}))}))};var Yt="yCQ-VdE5",en="b--398nS",tn="_6VhqH6wy",nn="k9i48GWd",rn="TNeDy6y5",on="jVfkavqE",an="_87oFW01f",sn="oz5S7EmO";dt('.yCQ-VdE5{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}.b--398nS{opacity:1}._6VhqH6wy{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}._6VhqH6wy:active,._6VhqH6wy:focus,._6VhqH6wy:hover{background-color:rgba(55,54,47,.08)}.k9i48GWd{width:24px}.TNeDy6y5{position:relative;transition:opacity .18s cubic-bezier(.4,0,.2,1)}.jVfkavqE:after{background-color:#007aff;bottom:-7px;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:before{top:-5px}._87oFW01f:after,._87oFW01f:before{background-color:inherit;content:"";height:3px;left:50%;position:absolute;transform:translateX(-50%);width:100%}._87oFW01f:after{bottom:-7px}.oz5S7EmO{background:rgba(35,131,226,.14);border-radius:3px;inset:0;opacity:1;pointer-events:none;position:absolute;transition:background-color .18s cubic-bezier(.4,0,.2,1);z-index:81}');const ln=({element:n,editor:r,values:o,handlers:i})=>{const a=c(null),{hoveredElement:s,isElementOptionsOpen:l,nodeSettingsPos:d}=o,{onDragEnd:f,onDragStart:p,openNodeSettings:h,closeNodeSettings:v,triggerPlusButton:y}=i,m=e=>{e.stopPropagation();const t=a.current,o=document.querySelector(`[data-element-id="${null==n?void 0:n.id}"]`),i=w.findPath(r,n),s=u.parent(r,i);g.isElement(n)&&(null==t||t.setAttribute("draggable","false"),o&&(o.setAttribute("draggable","true"),o.ondragstart=e=>{const t={path:i,element:{id:n.id,type:n.type},parent:s};p(e,t)},o.ondragend=f))},b=(null==s?void 0:s.id)===n.id;return t("div",Object.assign({contentEditable:!1,className:ct(Yt,{[en]:b},"yoopta-element-actions")},{children:[b&&l&&e(Qt,{element:n,style:d||void 0,onClose:v}),e("button",Object.assign({type:"button",onMouseDown:m,className:ct(tn,nn,"yoopta-element-actions-plus"),onClick:()=>y(n)},{children:e(wt,{})})),e("button",Object.assign({type:"button",onMouseDown:m,className:ct(tn,"yoopta-element-actions-drag"),onClick:()=>h(a,n),ref:a},{children:e(mt,{})}))]}))},cn=({children:n,element:r,attributes:o,nodeType:i,render:a,HTMLAttributes:l})=>{var c,d;const u=_(),[f,p]=at(),h="inline"===i,{hoverIn:g,onDrop:v}=p,{dndState:y,DRAG_MAP:m}=f,b=s((()=>{var e,t;if(null===y.from.element||null===y.to.element)return{isDragging:!1,isDragOver:!1,isDragSelf:!1};const n=(null===(e=f.dndState.from.element)||void 0===e?void 0:e.id)===r.id,o=(null===(t=f.dndState.to.element)||void 0===t?void 0:t.id)===r.id;return{isDragging:n,isDragOver:o,isDragSelf:n&&o}}),[f.dndState.from,f.dndState.to]),w=null===(c=r.data)||void 0===c?void 0:c.skipSettings,{isDragging:x,isDragOver:O,isDragSelf:E}=b,j={opacity:x?.7:1};return m.set(r.id,r),h?a({attributes:o,element:r,children:n,HTMLAttributes:l}):t("div",Object.assign({"data-element-id":r.id,"data-element-type":r.type,onMouseEnter:e=>{w||g(e,r)},onDrop:v,className:ct(rn,{[on]:O,[an]:E}),style:j},o,{children:[w?null:e(ln,{editor:u,element:r,handlers:p,values:f}),a({attributes:o,element:r,children:n,HTMLAttributes:l}),(null===(d=f.selectedNodeElement)||void 0===d?void 0:d.id)===r.id&&e("div",{className:ct(sn,"yoopta-selected-node-element")})]}))};cn.displayName="ElementWrapper";var dn={};Object.defineProperty(dn,"__esModule",{value:!0});for(var un="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),fn={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},pn={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:un?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},hn={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},gn=1;gn<20;gn++)hn["f"+gn]=111+gn;function vn(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return yn(e,t)})),o=function(e){return r.some((function(t){return mn(t,e)}))};return null==n?o:o(n)}function yn(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in fn)r[fn[a]]=!1;var s=!0,l=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(s=(d=u.next()).done);s=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=wn(f),g=fn[h];if(f.length>1&&!g&&!pn[f]&&!hn[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=bn(f)),g&&(r[g]=!p||null)}}catch(e){l=!0,c=e}finally{try{!s&&u.return&&u.return()}finally{if(l)throw c}}return r}function mn(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function bn(e){return e=wn(e),hn[e]||e.toUpperCase().charCodeAt(0)}function wn(e){return e=e.toLowerCase(),e=pn[e]||e}dn.default=vn;var _n=dn.isHotkey=vn,xn=dn.isCodeHotkey=function(e,t){return vn(e,t)},On=dn.isKeyHotkey=function(e,t){return vn(e,{byKey:!0},t)};dn.parseHotkey=yn,dn.compareHotkey=mn,dn.toKeyCode=bn,dn.toKeyName=wn;const En={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",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",kekCeburek:"mod+enter"},jn={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"},kn={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Nn=e=>{const t=En[e],n=jn[e],r=kn[e],o=t&&On(t),i=n&&On(n),a=r&&On(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},Sn={isBold:Nn("bold"),isCompose:Nn("compose"),isArrowLeft:Nn("arrowLeft"),isArrowRight:Nn("arrowRight"),isArrowUp:Nn("arrowUp"),isArrowDown:Nn("arrowDown"),isDeleteBackward:Nn("deleteBackward"),isDeleteForward:Nn("deleteForward"),isDeleteLineBackward:Nn("deleteLineBackward"),isDeleteLineForward:Nn("deleteLineForward"),isDeleteWordBackward:Nn("deleteWordBackward"),isDeleteWordForward:Nn("deleteWordForward"),isExtendBackward:Nn("extendBackward"),isExtendForward:Nn("extendForward"),isExtendLineBackward:Nn("extendLineBackward"),isExtendLineForward:Nn("extendLineForward"),isItalic:Nn("italic"),isMoveLineBackward:Nn("moveLineBackward"),isMoveLineForward:Nn("moveLineForward"),isCtrlLeft:Nn("ctrlLeft"),isCtrlRight:Nn("ctrlRight"),isRedo:Nn("redo"),isShiftEnter:Nn("shiftEnter"),isEnter:Nn("enter"),isTransposeCharacter:Nn("transposeCharacter"),isUndo:Nn("undo"),isSpace:Nn("space"),isSelect:Nn("select"),isTab:Nn("tab"),isShiftTab:Nn("shiftTab"),isBackspace:Nn("backspace"),isCmdEnter:Nn("cmdEnter"),isCmd:Nn("cmd"),isEscape:Nn("escape"),isKekceburek:Nn("kekCeburek")},Pn=(e,t)=>!!((e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(u.nodes(e,{at:u.unhangRange(e,n),match:e=>!u.isEditor(e)&&g.isElement(e)&&e.type===t}));return r})(e,t),Dn=(e,t,n="lowest")=>{var r;const o=Array.from(u.nodes(e,{match:t=>u.isEditor(e)&&g.isElement(t),at:t||(null===(r=e.selection)||void 0===r?void 0:r.anchor.path),mode:n}))[0];return o?o[0]:e.children[0]};function An(e,t){var n,r;if(v.isText(e))return function(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,(e=>t[e]))}(e.text);const o=e.children.map((e=>An(e,t))).join(""),i=t[e.type];return"function"==typeof(null===(r=null===(n=i.exports)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)?i.exports.html.serialize(e,o):o}function Cn(e,t){return e.map((e=>An(e,t))).join("")}const Tn={outline:"none"},Ln={hotkeys:Sn,defaultNode:tt(Te())},Mn=({editor:n,placeholder:r,marks:o,readOnly:a,plugins:l,className:f,PLUGINS_MAP:v})=>{i((()=>{const e=window.location.hash.length>0?window.location.hash.replace("#",""):null;if(e){const t=document.getElementById(e)||document.querySelector(`[data-element-id="${e}"]`);t&&window.scrollTo({top:t.offsetTop,behavior:"smooth"})}}),[]);const m=c(null),[{disableWhileDrag:b},{changeHoveredNode:_}]=at(),x=Ut(),{ActionMenu:E,Toolbar:j}=x||{},k=b||a,N=s((()=>t=>{var r;const o=v[t.element.type];if(!o)return null;const i=function(e){return"function"==typeof e.renderer?e.renderer:e.renderer.editor}(o)(n,o);return e(cn,Object.assign({element:t.element,attributes:t.attributes,nodeType:t.element.nodeType,render:i,HTMLAttributes:null===(r=o.options)||void 0===r?void 0:r.HTMLAttributes},{children:t.children}))}),[l,n]),S=s((()=>e=>{const t=[],[r,o]=e;return l.forEach((o=>{const i=o.decorator;"function"==typeof i&&g.isElement(r)&&r.type===o.type&&t.push(...i(n)(e))})),n.selection&&!u.isEditor(r)&&""===u.string(n,[o[0]])&&y.includes(n.selection,o)&&y.isCollapsed(n.selection)&&t.push(Object.assign(Object.assign({},n.selection),{withPlaceholder:!0})),t}),[l,n]),P=s((()=>t=>{var i;const a=Object.assign({},t);let s;l.forEach((e=>{if(e.leaf){const t=e.leaf(n)(a);t&&(a.children=t)}})),null==o||o.forEach((e=>{a.leaf[e.type]&&(a.children=e.render(a))}));const c=null===(i=a.children.props)||void 0===i?void 0:i.parent;if(!function(e){var t,n;return 1!==(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)||0!==(null===(n=null==e?void 0:e.children[0])||void 0===n?void 0:n.text.length)}(c)){const e=v[null==c?void 0:c.type];s=null===(null==e?void 0:e.placeholder)?null:(null==e?void 0:e.placeholder)||r}return e(ht,Object.assign({},a,{placeholder:s}))}),[l,n]),D=s((()=>{const e=l.map((e=>Object.keys(e.events||{}))).flat().filter(((e,t,n)=>n.indexOf(e)===t)),t={};return e.forEach((e=>{t[e]=function(t){l.forEach((r=>{var o;if(null===(o=r.events)||void 0===o?void 0:o[e]){r.events[e](n,Ln)(t)}}))}})),t}),[l,n]),A=d((e=>{u.withoutNormalizing(n,(()=>{var t;if(!n.selection)return;const r=tt(Te());null==o||o.forEach((t=>{t.hotkey&&On(t.hotkey)(e)&&(e.preventDefault(),nt(n,t.type,!1))})),null===(t=D.onKeyDown)||void 0===t||t.call(D,e);const i=u.above(n,{match:e=>!u.isEditor(e),mode:"lowest"});if(Sn.isEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=Object.keys(u.marks(n)||{});t.length>0&&t.forEach((e=>u.removeMark(n,e)));const o=p.parent(n.selection.anchor.path),a=u.string(n,o),s=i&&i[0].type!==r.type;if(s&&0===a.length)return void h.setNodes(n,r,{at:o});if(u.isStart(n,n.selection.anchor,n.selection.anchor.path)&&s){const[e]=i;return h.setNodes(n,r,{at:o}),h.delete(n,{unit:"block"}),h.insertNodes(n,Fe(e),{at:p.next(o)}),void h.select(n,{path:[p.next(n.selection.anchor.path)[0]+1,0],offset:0})}return h.splitNodes(n,{always:!0}),h.setNodes(n,r),void _(r)}if(Sn.isShiftEnter(e)){if(e.isDefaultPrevented())return;e.preventDefault(),n.insertText("\n")}if(Sn.isSelect(e)){if(e.isDefaultPrevented())return;e.preventDefault();const t=u.above(n,{at:n.selection.anchor.path,match:e=>!u.isEditor(e)&&g.isElement(e)});if(!t)return;const r=u.string(n,t[1]);return y.isExpanded(n.selection)||0===r.length?void h.select(n,[]):void h.select(n,t[1])}}))}),[]);return t("div",Object.assign({id:"yoopta-editor",className:f,ref:m,onMouseDown:e=>{a||(e.preventDefault(),e.currentTarget===e.target&&n.selection&&u.withoutNormalizing(n,(()=>{const e=[n.children.length-1,0],t=Dn(n,e,"highest"),r=u.string(n,e),o={anchor:{path:e,offset:0},focus:{path:e,offset:0}};if("paragraph"===t.type&&0===r.length)return h.select(n,{path:o.anchor.path,offset:0}),_(t),w.focus(n);const i=tt(Te());_(i),h.insertNodes(n,i,{at:[n.children.length],select:!0}),w.focus(n)})))}},{children:[!!E&&e(E,{}),!!j&&e(j,{}),e(O,Object.assign({id:"yoopta-contenteditable",renderLeaf:P,renderElement:N,readOnly:k,decorate:S,onCopy:e=>{if(!n.selection)return;const t=Cn(u.fragment(n,n.selection),n.plugins);return e.clipboardData.setData("text/html",t),e.clipboardData},spellCheck:!0},D,{onKeyDown:A,onMouseDown:e=>{var t;null===(t=D.onMouseDown)||void 0===t||t.call(D,e),(e=>{e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()})(e)},style:Tn}))]}))};function Bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fn=new WeakMap,zn=new WeakMap;class Hn{}class In extends Hn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}class Rn extends Hn{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();var{offset:t,path:n}=e;this.offset=t,this.path=n}}var Vn=e=>zn.get(e);function Wn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wn(Object(n),!0).forEach((function(t){Bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Zn=new WeakSet,$n=e=>{var t=[],n=e=>{if(null!=e){var r=t[t.length-1];if("string"==typeof e){var o={text:e};Zn.add(o),e=o}if(v.isText(e)){var i=e;v.isText(r)&&Zn.has(r)&&Zn.has(i)&&v.equals(r,i,{loose:!0})?r.text+=i.text:t.push(i)}else if(g.isElement(e))t.push(e);else{if(!(e instanceof Hn))throw new Error("Unexpected hyperscript child object: ".concat(e));var a=t[t.length-1];v.isText(a)||(n(""),a=t[t.length-1]),e instanceof In?((e,t)=>{var n=e.text.length;Fn.set(e,[n,t])})(a,e):e instanceof Rn&&((e,t)=>{var n=e.text.length;zn.set(e,[n,t])})(a,e)}}};for(var r of e.flat(1/0))n(r);return t};function qn(e,t,n){return Un(Un({},t),{},{children:$n(n)})}function Kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(n),!0).forEach((function(t){Bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Jn,Xn={anchor:function(e,t,n){return new In(t)},cursor:function(e,t,n){return[new In(t),new Rn(t)]},editor:(Jn=b,(e,t,n)=>{var r,o=[];for(var i of n)y.isRange(i)?r=i:o.push(i);var a,s=$n(o),l={},c=Jn();for(var[d,u]of(Object.assign(c,t),c.children=s,m.texts(c))){var f=(a=d,Fn.get(a)),p=Vn(d);if(null!=f){var[h]=f;l.anchor={path:u,offset:h}}if(null!=p){var[g]=p;l.focus={path:u,offset:g}}}if(l.anchor&&!l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!l.anchor&&l.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=r?c.selection=r:y.isRange(l)&&(c.selection=l),c}),element:qn,focus:function(e,t,n){return new Rn(t)},fragment:function(e,t,n){return $n(n)},selection:function(e,t,n){var r=n.find((e=>e instanceof In)),o=n.find((e=>e instanceof Rn));if(!r||null==r.offset||null==r.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return Un({anchor:{offset:r.offset,path:r.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,t,n){var r=$n(n);if(r.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[o]=r;if(null==o&&(o={text:""}),!v.isText(o))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return Zn.delete(o),Object.assign(o,t),o}},Qn=e=>function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=e[t];if(!a)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==n&&(n={}),D(n)||(o=[n].concat(o),n={}),a(t,n,o=o.filter((e=>Boolean(e))).flat())},Yn=e=>{var t={},n=function(n){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>qn(0,Gn(Gn({},r),t),n)};for(var r in e)n(r);return t},er=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,n=Yn(t),r=Gn(Gn(Gn({},Xn),n),e.creators);return Qn(r)}();const tr={DEL:()=>({strikethrough:!0}),EM:()=>({italic:!0}),I:()=>({italic:!0}),S:()=>({strikethrough:!0}),STRONG:()=>({bold:!0}),U:()=>({underline:!0})},nr=(e,t)=>{var n,r,o,i;if(3===e.nodeType)return e.textContent;if(1!==e.nodeType)return null;if("BR"===e.nodeName)return"\n";const{nodeName:a}=e;let s=e,l=Array.from(s.childNodes).map((e=>nr(e,t))).flat();if(0===l.length&&(l=[{text:""}]),"BODY"===e.nodeName)return er("fragment",{},l);if(t[a]){const s=t[a];if(s){let t=s.defineElement();if("function"==typeof(null===(r=null===(n=s.exports)||void 0===n?void 0:n.html.deserialize)||void 0===r?void 0:r.parse)){const n=null===(i=null===(o=s.exports)||void 0===o?void 0:o.html.deserialize)||void 0===i?void 0:i.parse(e);t=Object.assign(Object.assign({},t),{data:n})}return er("element",t,l)}}if(v.isTextList(l)&&(l=l.filter((e=>""!==e.text)),l.length>0))return er("element",t.P.defineElement(),l);if(tr[a]){const t=tr[a](e);return l.map((e=>v.isText(e)?er("text",t,e):e))}return l};function rr(e,t){try{const n=function(e){const t={};return Object.keys(e).forEach((n=>{var r,o,i,a,s,l,c,d;const u=e[n];if(null===(o=null===(r=u.exports)||void 0===r?void 0:r.html.deserialize)||void 0===o?void 0:o.nodeName){if(Array.isArray(null===(a=null===(i=u.exports)||void 0===i?void 0:i.html.deserialize)||void 0===a?void 0:a.nodeName))return void(null===(l=null===(s=u.exports)||void 0===s?void 0:s.html.deserialize)||void 0===l||l.nodeName.forEach((e=>{t[e]=u})));t[null===(d=null===(c=u.exports)||void 0===c?void 0:c.html.deserialize)||void 0===d?void 0:d.nodeName]=u}})),t}(t),r=(new DOMParser).parseFromString(e,"text/html");return nr(r.body,n)}catch(e){return console.error(e),null}}const or=({key:t,value:n,plugins:r,marks:a,readOnly:l,onChange:c,placeholder:_,autoFocus:x=!0,offline:O,className:k,tools:N})=>{const S=function(e){return"string"==typeof e?e:"yoopta-content"}(O),[P,D]=o((()=>function(e,t,n){const r=[{id:Te(),type:"paragraph",children:[{text:""}]}],o=Le(n)?n:r;if(!t)return localStorage.removeItem(e),o;try{const t=JSON.parse(localStorage.getItem(e)||"[]");return Le(t)?t:o}catch(t){return localStorage.removeItem(e),r}}(S,O,n))),A=d((e=>{if(c(e),D(e),!O)return;if(I.operations.some((e=>"set_selection"!==e.type)))try{const t=JSON.stringify(e);localStorage.setItem(S,t)}catch(e){}}),[O]),C=s((()=>{if(!Array.isArray(r))throw new Error("Props `plugins` should be array of plugins");if(Array.isArray(r)&&0===r.length)throw new Error("Props `plugins` cannot be empty. Pass an array of plugins");const e=Pe(r),t=function(e){const t={};return e.forEach((e=>t[e.type]=e)),t}(e);return{yooptaPlugins:e,PLUGINS_MAP:t}}),[r]),{yooptaPlugins:T,PLUGINS_MAP:H}=C,I=s((()=>{let e=(e=>{const{insertData:t}=e;return e.insertData=n=>{if(!e.selection)return;const r=n.getData("text/html");if(r){const t=rr(r,e.plugins).filter((e=>!v.isText(e)));h.insertFragment(e,t)}else t(n)},e})((e=>{const{deleteFragment:t}=e;return e.deleteFragment=()=>{const{selection:n}=e;if(!n)return;const[,r]=u.first(e,[0]),[,o]=u.last(e,[e.children.length-1]),i=u.range(e,r,o);if(y.equals(n,i))return h.removeNodes(e,{mode:"highest",hanging:!0}),void h.select(e,[0]);t()},e})((e=>{const{normalizeNode:t}=e;return e.normalizeNode=n=>{const[r]=n;if(u.isEditor(r)&&0===e.children.length){const t=tt(Te());h.insertNodes(e,t,{at:[0]})}else t(n)},e})((e=>{const{insertBreak:t,deleteBackward:n}=e;return e.insertBreak=()=>{if(!e.selection||!y.isCollapsed(e.selection))return t();const n=p.parent(e.selection.anchor.path),r=m.get(e,n);g.isElement(r)&&u.isVoid(e,r)?u.insertNode(e,{id:Te(),type:"paragraph",children:[{text:""}],nodeType:"block"}):t()},e.deleteBackward=t=>{if(!e.selection||!y.isCollapsed(e.selection)||0!==e.selection.anchor.offset)return n(t);const r=p.parent(e.selection.anchor.path),o=m.get(e,r);if(0===m.string(o).length&&p.hasPrevious(r)){const t=p.previous(r),n=m.get(e,t);if(g.isElement(n)&&u.isVoid(e,n))return h.removeNodes(e),h.select(e,t)}n(t)},e})((e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var r=n[n.length-1];L.withoutSaving(t,(()=>{u.withoutNormalizing(t,(()=>{for(var e of r)t.apply(e)}))})),e.redos.pop(),e.undos.push(r)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var r=n[n.length-1];L.withoutSaving(t,(()=>{u.withoutNormalizing(t,(()=>{var e=r.map(f.inverse).reverse();for(var n of e)t.apply(n)}))})),e.redos.push(r),e.undos.pop()}},t.apply=e=>{var{operations:r,history:o}=t,{undos:i}=o,a=i[i.length-1],s=a&&a[a.length-1],l=F(e,s),c=L.isSaving(t),d=L.isMerging(t);if(null==c&&(c=B(e)),c){if(null==d&&(d=null!=a&&(0!==r.length||M(e,s)||l)),a&&d)l&&a.pop(),a.push(e);else{var u=[e];i.push(u)}for(;i.length>100;)i.shift();z(e)&&(o.redos=[])}n(e)},t})((e=>{const{insertText:t}=e;return e.insertText=n=>{var r,o;const{selection:i}=e;if(" "===n&&i&&y.isCollapsed(i)){const{anchor:a}=i,s=u.above(e,{match:t=>g.isElement(t)&&u.isBlock(e,t),mode:"lowest"});if(!s)return;const[,l]=s,c=u.parent(e,l),[d]=c;if(g.isElement(d)&&!v.isText(d.children[0]))return t(n);const f=s?l:[],p={anchor:a,focus:u.start(e,f)},y=u.string(e,p),m=null===(r=e.shortcuts)||void 0===r?void 0:r[y];if(m)return h.select(e,p),h.delete(e),void(null===(o=m.createElement)||void 0===o||o.call(m,e))}t(n)},e})(E(b())))))));e.plugins=H;const t={};return T.forEach((n=>{var r;n.shortcut&&(Array.isArray(n.shortcut)?n.shortcut.forEach((e=>t[e]=n)):t[n.shortcut]=n),e=(null===(r=n.extendEditor)||void 0===r?void 0:r.call(n,e))||e})),e.shortcuts=t,e}),[T]);return i((()=>{if(x)try{const[,e]=u.first(I,[0]);h.select(I,{anchor:{path:e,offset:0},focus:{path:e,offset:0}}),w.focus(I)}catch(e){}}),[x,I]),e(j,Object.assign({editor:I,initialValue:P,onChange:A},{children:e(it,{children:e(It,Object.assign({plugins:T,marks:a,tools:N},{children:e(Mn,{editor:I,readOnly:l,placeholder:_,plugins:T,marks:a,PLUGINS_MAP:H,className:k})}))})}),t)},ir=t=>e(S,{children:e(or,Object.assign({},t,{value:t.value,onChange:t.onChange}))});function ar({type:t,hotkey:n,className:r,as:o}){return Object.freeze({type:t,hotkey:n,render:n=>e(o||"span",Object.assign({},n.attributes,{className:ct(r,`yoopta-leaf-${t}`)},{children:n.children}))})}function sr(e){const{element:t,HTMLAttributes:n,className:r}=e;return`yoopta-${t.type} ${(null==n?void 0:n.className)||""} ${r}`}const lr={ElementOptions:Qt,Overlay:kt};export{Sn as HOTKEYS,lr as UI_HELPERS,Ne as YooptaPlugin,ar as createYooptaMark,Se as createYooptaPlugin,ct as cx,Fe as deepClone,ir as default,Je as disableBodyScroll,Xe as enableBodyScroll,Te as generateId,Dn as getElementByPath,sr as getElementClassname,xn as isCodeHotkey,Pn as isElementActive,_n as isHotkey,On as isKeyHotkey,Le as isValidYooptaNodes,Pe as mergePlugins,Wt as useElements,Vt as useMarks,at as useNodeElementSettings,Ut as useTools,Rt as useYoopta};
|