reactjs-tiptap-editor-pro 0.2.32 → 0.2.34
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/lib/ColorPicker-BGCCdXrc.js +27523 -0
- package/lib/ColorPicker-DGbrNkQ-.cjs +142 -0
- package/lib/extension-bundle.cjs +103 -3
- package/lib/extension-bundle.d.cts +71 -82
- package/lib/extension-bundle.d.ts +71 -82
- package/lib/extension-bundle.js +20642 -2477
- package/lib/index.cjs +140 -1
- package/lib/index.d.cts +71 -80
- package/lib/index.d.ts +71 -80
- package/lib/index.js +3617 -13
- package/lib/{index-M6H3FoBi.js → locale-bundle-CT7qZRHF.js} +444 -105
- package/lib/locale-bundle-PAhriAQT.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +71 -80
- package/lib/locale-bundle.d.ts +71 -80
- package/lib/locale-bundle.js +6 -6
- package/lib/lucide-react-BFZtMawV.js +30462 -0
- package/lib/lucide-react-CMPhLW1m.cjs +7851 -0
- package/lib/style.css +1 -1
- package/package.json +1 -2
- package/lib/RichTextEditor-BwbqJLnA.cjs +0 -141
- package/lib/RichTextEditor-iGJ6-rbq.js +0 -8833
- package/lib/index-DV-nXpU1.cjs +0 -1
- package/lib/tiptap-DkWHMWDt.js +0 -6061
- package/lib/tiptap-gBG-1T-V.cjs +0 -116
- package/lib/vendor-BJ0Yf78E.cjs +0 -8114
- package/lib/vendor-Cpa6z-M0.js +0 -67575
package/lib/index.cjs
CHANGED
|
@@ -1 +1,140 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react"),d=require("./RichTextEditor-BwbqJLnA.cjs"),c=require("./tiptap-gBG-1T-V.cjs");function a(){var r;const e=t.useRef({editor:null}),[i,o]=t.useState(!1),[s,n]=t.useState(null);return t.useEffect(()=>{var u;(u=e.current)!=null&&u.editor&&(o(!0),n(e.current.editor))},[e,(r=e.current)==null?void 0:r.editor]),{isReady:i,editor:s,editorRef:e}}exports.default=d.RichTextEditor;exports.BubbleMenu=c.BubbleMenu;exports.useEditorState=a;
|
|
1
|
+
"use strict";var fn=Object.defineProperty;var mn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var X=(e,t,n)=>mn(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("react"),o=require("react/jsx-runtime"),s=require("./ColorPicker-DGbrNkQ-.cjs"),A=require("./locale-bundle-PAhriAQT.cjs"),hn=require("@radix-ui/react-toast"),J=require("lucide-react"),Le=require("easydrawer"),gn=require("katex"),ze=require("mermaid"),vt=require("tippy.js");function yt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const G=yt(g),R=yt(hn);function pn(){var a;const e=g.useRef({editor:null}),[t,n]=g.useState(!1),[r,i]=g.useState(null);return g.useEffect(()=>{var l;(l=e.current)!=null&&l.editor&&(n(!0),i(e.current.editor))},[e,(a=e.current)==null?void 0:a.editor]),{isReady:t,editor:r,editorRef:e}}function wt(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var B=Array.isArray,Fe=s.Symbol?s.Symbol.prototype:void 0,He=Fe?Fe.toString:void 0;function Q(e){if(typeof e=="string")return e;if(B(e))return wt(e,Q)+"";if(s.isSymbol(e))return He?He.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var xn=1/0,vn=17976931348623157e292;function yn(e){if(!e)return e===0?e:0;if(e=s.toNumber(e),e===xn||e===-1/0){var t=e<0?-1:1;return t*vn}return e===e?e:0}function wn(e){var t=yn(e),n=t%1;return t===t?n?t-n:t:0}function be(e){return e}var bn="[object AsyncFunction]",jn="[object Function]",An="[object GeneratorFunction]",Cn="[object Proxy]";function bt(e){if(!s.isObject(e))return!1;var t=s.baseGetTag(e);return t==jn||t==An||t==bn||t==Cn}var se=s.root["__core-js_shared__"],Ge=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Tn(e){return!!Ge&&Ge in e}var Sn=Function.prototype,En=Sn.toString;function F(e){if(e!=null){try{return En.call(e)}catch{}try{return e+""}catch{}}return""}var Pn=/[\\^$.*+?()[\]{}|]/g,_n=/^\[object .+?Constructor\]$/,In=Function.prototype,On=Object.prototype,Nn=In.toString,Rn=On.hasOwnProperty,$n=RegExp("^"+Nn.call(Rn).replace(Pn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Bn(e){if(!s.isObject(e)||Tn(e))return!1;var t=bt(e)?$n:_n;return t.test(F(e))}function Mn(e,t){return e==null?void 0:e[t]}function H(e,t){var n=Mn(e,t);return Bn(n)?n:void 0}var ue=H(s.root,"WeakMap");function Dn(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var kn=800,Ln=16,zn=Date.now;function Fn(e){var t=0,n=0;return function(){var r=zn(),i=Ln-(r-n);if(n=r,i>0){if(++t>=kn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Hn(e){return function(){return e}}var Ue=function(){try{var e=H(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Gn=Ue?function(e,t){return Ue(e,"toString",{configurable:!0,enumerable:!1,value:Hn(t),writable:!0})}:be,Un=Fn(Gn);function Wn(e,t,n,r){for(var i=e.length,a=n+-1;++a<i;)if(t(e[a],a,e))return a;return-1}function Kn(e){return e!==e}function Vn(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function qn(e,t,n){return t===t?Vn(e,t,n):Wn(e,Kn,n)}function Xn(e,t){var n=e==null?0:e.length;return!!n&&qn(e,t,0)>-1}var Yn=9007199254740991,Zn=/^(?:0|[1-9]\d*)$/;function jt(e,t){var n=typeof e;return t=t??Yn,!!t&&(n=="number"||n!="symbol"&&Zn.test(e))&&e>-1&&e%1==0&&e<t}function At(e,t){return e===t||e!==e&&t!==t}var We=Math.max;function Jn(e,t,n){return t=We(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=We(r.length-t,0),l=Array(a);++i<a;)l[i]=r[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=r[i];return u[t]=n(l),Dn(e,this,u)}}function Qn(e,t){return Un(Jn(e,t,be),e+"")}var er=9007199254740991;function je(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=er}function Ct(e){return e!=null&&je(e.length)&&!bt(e)}var tr=Object.prototype;function nr(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||tr;return e===n}function rr(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var or="[object Arguments]";function Ke(e){return s.isObjectLike(e)&&s.baseGetTag(e)==or}var Tt=Object.prototype,ir=Tt.hasOwnProperty,sr=Tt.propertyIsEnumerable,Ae=Ke(function(){return arguments}())?Ke:function(e){return s.isObjectLike(e)&&ir.call(e,"callee")&&!sr.call(e,"callee")};function ar(){return!1}var St=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ve=St&&typeof module=="object"&&module&&!module.nodeType&&module,lr=Ve&&Ve.exports===St,qe=lr?s.root.Buffer:void 0,cr=qe?qe.isBuffer:void 0,de=cr||ar,ur="[object Arguments]",dr="[object Array]",fr="[object Boolean]",mr="[object Date]",hr="[object Error]",gr="[object Function]",pr="[object Map]",xr="[object Number]",vr="[object Object]",yr="[object RegExp]",wr="[object Set]",br="[object String]",jr="[object WeakMap]",Ar="[object ArrayBuffer]",Cr="[object DataView]",Tr="[object Float32Array]",Sr="[object Float64Array]",Er="[object Int8Array]",Pr="[object Int16Array]",_r="[object Int32Array]",Ir="[object Uint8Array]",Or="[object Uint8ClampedArray]",Nr="[object Uint16Array]",Rr="[object Uint32Array]",I={};I[Tr]=I[Sr]=I[Er]=I[Pr]=I[_r]=I[Ir]=I[Or]=I[Nr]=I[Rr]=!0;I[ur]=I[dr]=I[Ar]=I[fr]=I[Cr]=I[mr]=I[hr]=I[gr]=I[pr]=I[xr]=I[vr]=I[yr]=I[wr]=I[br]=I[jr]=!1;function $r(e){return s.isObjectLike(e)&&je(e.length)&&!!I[s.baseGetTag(e)]}function Ce(e){return function(t){return e(t)}}var Et=typeof exports=="object"&&exports&&!exports.nodeType&&exports,W=Et&&typeof module=="object"&&module&&!module.nodeType&&module,Br=W&&W.exports===Et,ae=Br&&s.freeGlobal.process,ee=function(){try{var e=W&&W.require&&W.require("util").types;return e||ae&&ae.binding&&ae.binding("util")}catch{}}(),Xe=ee&&ee.isTypedArray,Pt=Xe?Ce(Xe):$r,Mr=Object.prototype,Dr=Mr.hasOwnProperty;function kr(e,t){var n=B(e),r=!n&&Ae(e),i=!n&&!r&&de(e),a=!n&&!r&&!i&&Pt(e),l=n||r||i||a,u=l?rr(e.length,String):[],c=u.length;for(var d in e)Dr.call(e,d)&&!(l&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||jt(d,c)))&&u.push(d);return u}function Lr(e,t){return function(n){return e(t(n))}}var zr=Lr(Object.keys,Object),Fr=Object.prototype,Hr=Fr.hasOwnProperty;function Gr(e){if(!nr(e))return zr(e);var t=[];for(var n in Object(e))Hr.call(e,n)&&n!="constructor"&&t.push(n);return t}function _t(e){return Ct(e)?kr(e):Gr(e)}var Ur=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wr=/^\w*$/;function Te(e,t){if(B(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||s.isSymbol(e)?!0:Wr.test(e)||!Ur.test(e)||t!=null&&e in Object(t)}var K=H(Object,"create");function Kr(){this.__data__=K?K(null):{},this.size=0}function Vr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var qr="__lodash_hash_undefined__",Xr=Object.prototype,Yr=Xr.hasOwnProperty;function Zr(e){var t=this.__data__;if(K){var n=t[e];return n===qr?void 0:n}return Yr.call(t,e)?t[e]:void 0}var Jr=Object.prototype,Qr=Jr.hasOwnProperty;function eo(e){var t=this.__data__;return K?t[e]!==void 0:Qr.call(t,e)}var to="__lodash_hash_undefined__";function no(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=K&&t===void 0?to:t,this}function z(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}z.prototype.clear=Kr;z.prototype.delete=Vr;z.prototype.get=Zr;z.prototype.has=eo;z.prototype.set=no;function ro(){this.__data__=[],this.size=0}function te(e,t){for(var n=e.length;n--;)if(At(e[n][0],t))return n;return-1}var oo=Array.prototype,io=oo.splice;function so(e){var t=this.__data__,n=te(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():io.call(t,n,1),--this.size,!0}function ao(e){var t=this.__data__,n=te(t,e);return n<0?void 0:t[n][1]}function lo(e){return te(this.__data__,e)>-1}function co(e,t){var n=this.__data__,r=te(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function D(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}D.prototype.clear=ro;D.prototype.delete=so;D.prototype.get=ao;D.prototype.has=lo;D.prototype.set=co;var V=H(s.root,"Map");function uo(){this.size=0,this.__data__={hash:new z,map:new(V||D),string:new z}}function fo(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ne(e,t){var n=e.__data__;return fo(t)?n[typeof t=="string"?"string":"hash"]:n.map}function mo(e){var t=ne(this,e).delete(e);return this.size-=t?1:0,t}function ho(e){return ne(this,e).get(e)}function go(e){return ne(this,e).has(e)}function po(e,t){var n=ne(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function k(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}k.prototype.clear=uo;k.prototype.delete=mo;k.prototype.get=ho;k.prototype.has=go;k.prototype.set=po;var xo="Expected a function";function Se(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(xo);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var l=e.apply(this,r);return n.cache=a.set(i,l)||a,l};return n.cache=new(Se.Cache||k),n}Se.Cache=k;var vo=500;function yo(e){var t=Se(e,function(r){return n.size===vo&&n.clear(),r}),n=t.cache;return t}var wo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bo=/\\(\\)?/g,jo=yo(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wo,function(n,r,i,a){t.push(i?a.replace(bo,"$1"):r||n)}),t});function fe(e){return e==null?"":Q(e)}function It(e,t){return B(e)?e:Te(e,t)?[e]:jo(fe(e))}function re(e){if(typeof e=="string"||s.isSymbol(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Ot(e,t){t=It(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[re(t[n++])];return n&&n==r?e:void 0}function Ao(e,t,n){var r=e==null?void 0:Ot(e,t);return r===void 0?n:r}function Nt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Ye=s.Symbol?s.Symbol.isConcatSpreadable:void 0;function Co(e){return B(e)||Ae(e)||!!(Ye&&e&&e[Ye])}function To(e,t,n,r,i){var a=-1,l=e.length;for(n||(n=Co),i||(i=[]);++a<l;){var u=e[a];n(u)&&Nt(i,u)}return i}function So(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function Eo(e,t,n){var r=e.length;return n=n===void 0?r:n,n>=r?e:So(e,t,n)}var Po="\\ud800-\\udfff",_o="\\u0300-\\u036f",Io="\\ufe20-\\ufe2f",Oo="\\u20d0-\\u20ff",No=_o+Io+Oo,Ro="\\ufe0e\\ufe0f",$o="\\u200d",Bo=RegExp("["+$o+Po+No+Ro+"]");function Ee(e){return Bo.test(e)}function Mo(e){return e.split("")}var Rt="\\ud800-\\udfff",Do="\\u0300-\\u036f",ko="\\ufe20-\\ufe2f",Lo="\\u20d0-\\u20ff",zo=Do+ko+Lo,Fo="\\ufe0e\\ufe0f",Ho="["+Rt+"]",me="["+zo+"]",he="\\ud83c[\\udffb-\\udfff]",Go="(?:"+me+"|"+he+")",$t="[^"+Rt+"]",Bt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Uo="\\u200d",Dt=Go+"?",kt="["+Fo+"]?",Wo="(?:"+Uo+"(?:"+[$t,Bt,Mt].join("|")+")"+kt+Dt+")*",Ko=kt+Dt+Wo,Vo="(?:"+[$t+me+"?",me,Bt,Mt,Ho].join("|")+")",qo=RegExp(he+"(?="+he+")|"+Vo+Ko,"g");function Xo(e){return e.match(qo)||[]}function Yo(e){return Ee(e)?Xo(e):Mo(e)}function Zo(){this.__data__=new D,this.size=0}function Jo(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Qo(e){return this.__data__.get(e)}function ei(e){return this.__data__.has(e)}var ti=200;function ni(e,t){var n=this.__data__;if(n instanceof D){var r=n.__data__;if(!V||r.length<ti-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new k(r)}return n.set(e,t),this.size=n.size,this}function M(e){var t=this.__data__=new D(e);this.size=t.size}M.prototype.clear=Zo;M.prototype.delete=Jo;M.prototype.get=Qo;M.prototype.has=ei;M.prototype.set=ni;function ri(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var l=e[n];t(l,n,e)&&(a[i++]=l)}return a}function oi(){return[]}var ii=Object.prototype,si=ii.propertyIsEnumerable,Ze=Object.getOwnPropertySymbols,ai=Ze?function(e){return e==null?[]:(e=Object(e),ri(Ze(e),function(t){return si.call(e,t)}))}:oi;function li(e,t,n){var r=t(e);return B(e)?r:Nt(r,n(e))}function Je(e){return li(e,_t,ai)}var ge=H(s.root,"DataView"),pe=H(s.root,"Promise"),xe=H(s.root,"Set"),Qe="[object Map]",ci="[object Object]",et="[object Promise]",tt="[object Set]",nt="[object WeakMap]",rt="[object DataView]",ui=F(ge),di=F(V),fi=F(pe),mi=F(xe),hi=F(ue),L=s.baseGetTag;(ge&&L(new ge(new ArrayBuffer(1)))!=rt||V&&L(new V)!=Qe||pe&&L(pe.resolve())!=et||xe&&L(new xe)!=tt||ue&&L(new ue)!=nt)&&(L=function(e){var t=s.baseGetTag(e),n=t==ci?e.constructor:void 0,r=n?F(n):"";if(r)switch(r){case ui:return rt;case di:return Qe;case fi:return et;case mi:return tt;case hi:return nt}return t});var ot=s.root.Uint8Array,gi="__lodash_hash_undefined__";function pi(e){return this.__data__.set(e,gi),this}function xi(e){return this.__data__.has(e)}function q(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new k;++t<n;)this.add(e[t])}q.prototype.add=q.prototype.push=pi;q.prototype.has=xi;function vi(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Lt(e,t){return e.has(t)}var yi=1,wi=2;function zt(e,t,n,r,i,a){var l=n&yi,u=e.length,c=t.length;if(u!=c&&!(l&&c>u))return!1;var d=a.get(e),m=a.get(t);if(d&&m)return d==t&&m==e;var f=-1,h=!0,p=n&wi?new q:void 0;for(a.set(e,t),a.set(t,e);++f<u;){var x=e[f],v=t[f];if(r)var b=l?r(v,x,f,t,e,a):r(x,v,f,e,t,a);if(b!==void 0){if(b)continue;h=!1;break}if(p){if(!vi(t,function(T,P){if(!Lt(p,P)&&(x===T||i(x,T,n,r,a)))return p.push(P)})){h=!1;break}}else if(!(x===v||i(x,v,n,r,a))){h=!1;break}}return a.delete(e),a.delete(t),h}function bi(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function ji(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Ai=1,Ci=2,Ti="[object Boolean]",Si="[object Date]",Ei="[object Error]",Pi="[object Map]",_i="[object Number]",Ii="[object RegExp]",Oi="[object Set]",Ni="[object String]",Ri="[object Symbol]",$i="[object ArrayBuffer]",Bi="[object DataView]",it=s.Symbol?s.Symbol.prototype:void 0,le=it?it.valueOf:void 0;function Mi(e,t,n,r,i,a,l){switch(n){case Bi:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $i:return!(e.byteLength!=t.byteLength||!a(new ot(e),new ot(t)));case Ti:case Si:case _i:return At(+e,+t);case Ei:return e.name==t.name&&e.message==t.message;case Ii:case Ni:return e==t+"";case Pi:var u=bi;case Oi:var c=r&Ai;if(u||(u=ji),e.size!=t.size&&!c)return!1;var d=l.get(e);if(d)return d==t;r|=Ci,l.set(e,t);var m=zt(u(e),u(t),r,i,a,l);return l.delete(e),m;case Ri:if(le)return le.call(e)==le.call(t)}return!1}var Di=1,ki=Object.prototype,Li=ki.hasOwnProperty;function zi(e,t,n,r,i,a){var l=n&Di,u=Je(e),c=u.length,d=Je(t),m=d.length;if(c!=m&&!l)return!1;for(var f=c;f--;){var h=u[f];if(!(l?h in t:Li.call(t,h)))return!1}var p=a.get(e),x=a.get(t);if(p&&x)return p==t&&x==e;var v=!0;a.set(e,t),a.set(t,e);for(var b=l;++f<c;){h=u[f];var T=e[h],P=t[h];if(r)var _=l?r(P,T,h,t,e,a):r(T,P,h,e,t,a);if(!(_===void 0?T===P||i(T,P,n,r,a):_)){v=!1;break}b||(b=h=="constructor")}if(v&&!b){var j=e.constructor,y=t.constructor;j!=y&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof y=="function"&&y instanceof y)&&(v=!1)}return a.delete(e),a.delete(t),v}var Fi=1,st="[object Arguments]",at="[object Array]",Y="[object Object]",Hi=Object.prototype,lt=Hi.hasOwnProperty;function Gi(e,t,n,r,i,a){var l=B(e),u=B(t),c=l?at:L(e),d=u?at:L(t);c=c==st?Y:c,d=d==st?Y:d;var m=c==Y,f=d==Y,h=c==d;if(h&&de(e)){if(!de(t))return!1;l=!0,m=!1}if(h&&!m)return a||(a=new M),l||Pt(e)?zt(e,t,n,r,i,a):Mi(e,t,c,n,r,i,a);if(!(n&Fi)){var p=m&<.call(e,"__wrapped__"),x=f&<.call(t,"__wrapped__");if(p||x){var v=p?e.value():e,b=x?t.value():t;return a||(a=new M),i(v,b,n,r,a)}}return h?(a||(a=new M),zi(e,t,n,r,i,a)):!1}function Pe(e,t,n,r,i){return e===t?!0:e==null||t==null||!s.isObjectLike(e)&&!s.isObjectLike(t)?e!==e&&t!==t:Gi(e,t,n,r,Pe,i)}var Ui=1,Wi=2;function Ki(e,t,n,r){var i=n.length,a=i;if(e==null)return!a;for(e=Object(e);i--;){var l=n[i];if(l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<a;){l=n[i];var u=l[0],c=e[u],d=l[1];if(l[2]){if(c===void 0&&!(u in e))return!1}else{var m=new M,f;if(!(f===void 0?Pe(d,c,Ui|Wi,r,m):f))return!1}}return!0}function Ft(e){return e===e&&!s.isObject(e)}function Vi(e){for(var t=_t(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Ft(i)]}return t}function Ht(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function qi(e){var t=Vi(e);return t.length==1&&t[0][2]?Ht(t[0][0],t[0][1]):function(n){return n===e||Ki(n,e,t)}}function Xi(e,t){return e!=null&&t in Object(e)}function Yi(e,t,n){t=It(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var l=re(t[r]);if(!(a=e!=null&&n(e,l)))break;e=e[l]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&je(i)&&jt(l,i)&&(B(e)||Ae(e)))}function Zi(e,t){return e!=null&&Yi(e,t,Xi)}var Ji=1,Qi=2;function es(e,t){return Te(e)&&Ft(t)?Ht(re(e),t):function(n){var r=Ao(n,e);return r===void 0&&r===t?Zi(n,e):Pe(t,r,Ji|Qi)}}function Gt(e){return function(t){return t==null?void 0:t[e]}}function ts(e){return function(t){return Ot(t,e)}}function ns(e){return Te(e)?Gt(re(e)):ts(e)}function rs(e){return typeof e=="function"?e:e==null?be:typeof e=="object"?B(e)?es(e[0],e[1]):qi(e):ns(e)}function ce(e){return s.isObjectLike(e)&&Ct(e)}var os=200;function is(e,t,n,r){var i=-1,a=Xn,l=!0,u=e.length,c=[],d=t.length;if(!u)return c;n&&(t=wt(t,Ce(n))),t.length>=os&&(a=Lt,l=!1,t=new q(t));e:for(;++i<u;){var m=e[i],f=n==null?m:n(m);if(m=m!==0?m:0,l&&f===f){for(var h=d;h--;)if(t[h]===f)continue e;c.push(m)}else a(t,f,r)||c.push(m)}return c}function ss(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var as=Qn(function(e,t){var n=ss(t);return ce(n)&&(n=void 0),ce(e)?is(e,To(t,1,ce),rs(n)):[]}),ls="[object RegExp]";function cs(e){return s.isObjectLike(e)&&s.baseGetTag(e)==ls}var ct=ee&&ee.isRegExp,us=ct?Ce(ct):cs,ds=Gt("length"),Ut="\\ud800-\\udfff",fs="\\u0300-\\u036f",ms="\\ufe20-\\ufe2f",hs="\\u20d0-\\u20ff",gs=fs+ms+hs,ps="\\ufe0e\\ufe0f",xs="["+Ut+"]",ve="["+gs+"]",ye="\\ud83c[\\udffb-\\udfff]",vs="(?:"+ve+"|"+ye+")",Wt="[^"+Ut+"]",Kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Vt="[\\ud800-\\udbff][\\udc00-\\udfff]",ys="\\u200d",qt=vs+"?",Xt="["+ps+"]?",ws="(?:"+ys+"(?:"+[Wt,Kt,Vt].join("|")+")"+Xt+qt+")*",bs=Xt+qt+ws,js="(?:"+[Wt+ve+"?",ve,Kt,Vt,xs].join("|")+")",ut=RegExp(ye+"(?="+ye+")|"+js+bs,"g");function As(e){for(var t=ut.lastIndex=0;ut.test(e);)++t;return t}function Cs(e){return Ee(e)?As(e):ds(e)}var Ts=30,Ss="...",Es=/\w*$/;function Ps(e,t){var n=Ts,r=Ss;if(s.isObject(t)){var i="separator"in t?t.separator:i;n="length"in t?wn(t.length):n,r="omission"in t?Q(t.omission):r}e=fe(e);var a=e.length;if(Ee(e)){var l=Yo(e);a=l.length}if(n>=a)return e;var u=n-Cs(r);if(u<1)return r;var c=l?Eo(l,0,u).join(""):e.slice(0,u);if(i===void 0)return c+r;if(l&&(u+=c.length-u),us(i)){if(e.slice(u).search(i)){var d,m=c;for(i.global||(i=RegExp(i.source,fe(Es.exec(i))+"g")),i.lastIndex=0;d=i.exec(m);)var f=d.index;c=c.slice(0,f===void 0?u:f)}}else if(e.indexOf(Q(i),u)!=u){var h=c.lastIndexOf(i);h>-1&&(c=c.slice(0,h))}return c+r}const _s=R.Provider,Yt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Viewport,{ref:n,className:s.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Yt.displayName=R.Viewport.displayName;const Is=s.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md !border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Zt=G.forwardRef(({className:e,variant:t,...n},r)=>o.jsx(R.Root,{ref:r,className:s.cn(Is({variant:t}),e),...n}));Zt.displayName=R.Root.displayName;const Os=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Action,{ref:n,className:s.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md !border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));Os.displayName=R.Action.displayName;const Jt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Close,{ref:n,className:s.cn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:o.jsx(J.X,{className:"h-4 w-4"})}));Jt.displayName=R.Close.displayName;const Qt=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Title,{ref:n,className:s.cn("text-sm font-semibold",e),...t}));Qt.displayName=R.Title.displayName;const en=G.forwardRef(({className:e,...t},n)=>o.jsx(R.Description,{ref:n,className:s.cn("text-sm opacity-90",e),...t}));en.displayName=R.Description.displayName;let U=!1;function Ns({editor:e,attrs:t,extension:n}){const[r,i]=g.useState(!1),a=g.useRef(null),l=g.useRef(null),{alt:u,align:c}=t,d=n==null?void 0:n.options.upload,m=()=>{(async()=>{const w=document.querySelector("#easydrawer");w&&(a.current=new Le.Editor(w,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=Le.makeDropdownToolbar(a.current),l.current.addDefaultToolWidgets(),a.current.loadFromSVG(decodeURIComponent(u)))})()};g.useEffect(()=>{r&&setTimeout(()=>{m()},200)},[r]);const f=async()=>{if(a.current){const C=a.current.toSVG(),w=C.outerHTML,E=`drawer-${s.shortId()}.svg`;let O=s.i(C.outerHTML);if(d){const N=s.dataURLtoFile(O,E);O=await d(N)}e==null||e.chain().focus().setDrawer({type:"drawer",src:O,alt:encodeURIComponent(w),width:426,height:212},!!w).run(),e==null||e.commands.setAlignImageDrawer(c)}i(!1)},h=C=>{const w=a.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");w&&E&&(w.setColor(C),E.serializeState())},p=C=>{const w=a.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");w&&E&&(w.setThickness(C),E.serializeState())},x=C=>{const w=a.current.toolController.getPrimaryTools()[3],E=l.current.getWidgetById("pen-2");w&&E&&(w.setColor(C),E.serializeState())},v=C=>{const w=l.current.getWidgetById("shape");w&&w.setShapeType(C)},b=C=>{const w=a.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setColor(C),E.serializeState())},T=C=>{const w=a.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setThickness(C),E.serializeState())},P=C=>{const w=a.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");w&&E&&(w.setBorderColor(C),E.serializeState())},_=()=>{if(U){for(;a.current.history.redoStackSize>0;)a.current.history.redo();U=!1;return}a.current.history.undo()},j=()=>{U||a.current.history.redo()},y=()=>{if(!U){for(;a.current.history.undoStackSize>0;)_();U=!0}};return o.jsxs(s.Dialog,{onOpenChange:i,open:r,children:[o.jsx(s.DialogTrigger,{asChild:!0,children:o.jsx(s.ActionButton,{action:()=>i(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),o.jsxs(s.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(s.DialogTitle,{children:"Edit Drawer"}),o.jsxs("div",{style:{height:"100%",borderWidth:1,background:"white",position:"relative"},children:[o.jsx("div",{className:"size-full",id:"easydrawer"}),o.jsx(s.ControlDrawer,{changeBorderColorShape:P,changeColorShape:b,changeShape:v,onClear:y,onRedo:j,onThicknessChange:T,onUndo:_,refEditor:a,setColorHighlight:x,setColorPen:h,setThicknessPen:p})]}),o.jsx(s.DialogFooter,{children:o.jsx(s.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})}function tn(e,t){const[n,r]=g.useState(void 0);return g.useEffect(()=>{const i=()=>{const a=e.extensionManager.extensions.find(l=>l.name===t);a&&r(a)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,t]),n}const Rs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function $s({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Bs(e){return e.type.name==="drawer"}function Ms(e){const{lang:t}=A.useLocale(),n=s.useAttributes(e.editor,s.Drawer.name),r=tn(e.editor,s.Drawer.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:c,to:d}=u;let m=!1;return l.view.state.doc.nodesBetween(c.pos,d,f=>{if(Bs(f))return m=!0,!1}),m},a=g.useMemo(()=>e.disabled?[]:ia(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:Rs,children:a!=null&&a.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:a==null?void 0:a.map((l,u)=>l.type==="edit"&&(n!=null&&n.src)?o.jsx(Ns,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-drawer-${u}`):o.jsx($s,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):o.jsx(o.Fragment,{})})})}const Ds={padding:"0 12px 12px"},ks=({width:e,maxWidth:t,height:n,onOk:r,children:i})=>{const{t:a}=A.useLocale(),[l,u]=g.useState({width:"",height:"",maxWidth:""});g.useEffect(()=>{u({width:e,height:n,maxWidth:t})},[n,t,e]);function c(d){d.preventDefault(),d.stopPropagation(),r(l)}return o.jsxs(s.Popover,{modal:!0,children:[o.jsx(s.PopoverTrigger,{asChild:!0,children:i}),o.jsx(s.PopoverContent,{children:o.jsx("div",{style:Ds,children:o.jsxs("form",{className:"flex flex-col gap-2",onSubmit:c,children:[o.jsx(s.Label,{className:"mb-[6px]",children:"Width"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(s.Input,{type:"number",value:l.width,required:!0,onChange:d=>u({...l,width:d.target.value})})})}),o.jsx(s.Label,{className:"mb-[6px]",children:"Max Width"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(s.Input,{type:"number",value:l.maxWidth,required:!0,onChange:d=>u({...l,maxWidth:d.target.value})})})}),o.jsx(s.Label,{className:"mb-[6px]",children:"Height"}),o.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:o.jsx("div",{className:"relative items-center w-full max-w-sm",children:o.jsx(s.Input,{type:"number",value:l.height,required:!0,onChange:d=>u({...l,height:d.target.value})})})}),o.jsx(s.Button,{type:"submit",className:"self-end mt-2",children:a("editor.link.dialog.button.apply")})]})})})]})};function Ls({editor:e}){const{t}=A.useLocale(),{width:n,height:r,url:i}=s.useAttributes(e,s.Iframe.name,{width:0,height:0,url:"",defaultShowPicker:!1}),[a,l]=g.useState(!1),[u,c]=g.useState(""),d=g.useCallback(()=>{l(!1)},[l]);g.useEffect(()=>{a&&c(i)},[a,i]);const m=g.useCallback(()=>{e.chain().updateAttributes(s.Iframe.name,{url:u}).setNodeSelection(e.state.selection.from).focus().run(),l(!1)},[e,u,l]),f=g.useCallback(()=>{window.open(i,"_blank")},[i]),h=g.useCallback(()=>{l(!0)},[l]),p=g.useCallback(b=>{e.chain().updateAttributes(s.Iframe.name,b).setNodeSelection(e.state.selection.from).focus().run()},[e]),x=g.useCallback(()=>e.isActive(s.Iframe.name)&&!i,[e,i]),v=g.useCallback(()=>s.deleteNode(s.Iframe.name,e),[e]);return o.jsxs(o.Fragment,{children:[o.jsx(s.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"iframe-bubble-menu",shouldShow:x,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:o.jsxs("div",{className:"w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background",children:[o.jsx(s.ActionButton,{action:f,icon:"Eye",tooltip:"Visit Link"}),o.jsx(s.ActionButton,{action:h,icon:"Pencil",tooltip:"Open Edit Link"}),o.jsx(ks,{width:n,height:r,onOk:p,children:o.jsx(s.ActionButton,{icon:"Settings",tooltip:t("editor.settings")})}),o.jsx(s.ActionButton,{action:v,icon:"Trash2",tooltip:t("editor.delete")})]})}),o.jsxs(s.Dialog,{open:a,onOpenChange:l,children:[o.jsx(s.DialogTrigger,{}),o.jsxs(s.DialogContent,{children:[o.jsx(s.DialogHeader,{children:o.jsx(s.DialogTitle,{children:"Edit Link Iframe"})}),o.jsx(s.Input,{value:u,onInput:b=>c(b.target.value),type:"url",autoFocus:!0,placeholder:"Enter link"}),o.jsxs(s.DialogFooter,{children:[o.jsx(s.Button,{onClick:d,children:"Cancel"}),o.jsx(s.Button,{onClick:m,children:"OK"})]})]})]})]})}function zs({editor:e,...t}){const n=s.useAttributes(e,s.Katex.name,{text:"",defaultShowPicker:!1}),{text:r,defaultShowPicker:i}=n,[a,l]=g.useState(""),[u,c]=g.useState(!1),d=g.useCallback(()=>e.isActive(s.Katex.name),[e]),m=g.useCallback(()=>s.deleteNode(s.Katex.name,e),[e]),f=g.useCallback(()=>{e.chain().focus().setKatex({text:a}).run(),c(!1)},[e,a]);g.useEffect(()=>{i&&(c(!0),e.chain().updateAttributes(s.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,i,c]),g.useEffect(()=>{u&&l(r||"")},[u]);const h=g.useMemo(()=>{try{return gn.renderToString(`${a}`)}catch{return a}},[a]),p=g.useMemo(()=>`${a}`.trim()?o.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:h||""}}):null,[a,h]);return o.jsx(s.BubbleMenu,{editor:e,pluginKey:"Katex-bubble-menu",shouldShow:d,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{c(!1)}},children:t!=null&&t.disabled?o.jsx(o.Fragment,{}):o.jsx("div",{className:"p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800",children:u?o.jsxs(o.Fragment,{children:[o.jsx(s.Textarea,{value:a,onChange:x=>l(x.target.value),autoFocus:!0,placeholder:"Formula text",rows:3,defaultValue:r,style:{marginBottom:8}}),p&&o.jsx("div",{className:"my-[10px] p-[10px] rounded-[6px] !border-[1px] whitespace-nowrap overflow-auto",children:p}),o.jsxs("div",{className:"flex items-center justify-between gap-[6px]",children:[o.jsx(s.Button,{onClick:f,className:"flex-1",children:"Submit"}),o.jsx("a",{href:"https://katex.org/docs/supported",target:"_blank",rel:"noreferrer noopener",children:o.jsx(J.HelpCircle,{size:16})})]})]}):o.jsxs("div",{className:"flex items-center justify-center gap-[6px]",children:[o.jsx(s.ActionButton,{tooltip:"Edit",action:()=>c(!u),children:o.jsx(J.Pencil,{size:16})}),o.jsx(s.ActionButton,{tooltip:"Delete",action:m,children:o.jsx(J.Trash2,{size:16})})]})})})}const dt=`graph TB
|
|
2
|
+
a-->b`,Fs=({editor:e,attrs:t,extension:n})=>{const{alt:r,align:i}=t,[a,l]=g.useState(decodeURIComponent(r??dt)),[u,c]=g.useState(""),[d,m]=g.useState(!1),f=g.useRef(null),h=n==null?void 0:n.options.upload,p=async b=>{try{const{svg:T}=await ze.render("mermaid-svg",b);c(T)}catch{c("")}},x=()=>{ze.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),p(a)};g.useEffect(()=>{d&&x()},[d]),g.useEffect(()=>{d&&p(a)},[a]);const v=async()=>{if(a!==""){if(a){const b=f.current.querySelector("svg"),{width:T,height:P}=b.getBoundingClientRect(),_=`mermaid-${s.shortId()}.svg`;let j=s.i(b.outerHTML);if(h){const y=s.dataURLtoFile(j,_);j=await h(y)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:j,alt:encodeURIComponent(a),width:T,height:P},!!a).run(),e==null||e.commands.setAlignImageMermaid(i)}m(!1)}};return o.jsxs(s.Dialog,{onOpenChange:m,open:d,children:[o.jsx(s.DialogTrigger,{asChild:!0,children:o.jsx(s.ActionButton,{action:()=>m(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),o.jsxs(s.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(s.DialogTitle,{children:"Edit Mermaid"}),o.jsx("div",{style:{height:"100%",border:"1px solid hsl(var(--border))"},children:o.jsxs("div",{className:"flex gap-[10px] rounded-[10px] p-[10px]",children:[o.jsx(s.Textarea,{autoFocus:!0,className:"flex-1",defaultValue:dt,onChange:b=>l(b.target.value),placeholder:"Text",required:!0,rows:10,value:a,style:{color:"hsl(var(--foreground))"}}),o.jsx("div",{className:"flex flex-1 items-center justify-center rounded-[10px] p-[10px]",dangerouslySetInnerHTML:{__html:u},ref:f,style:{height:"100%",border:"1px solid hsl(var(--border))",minHeight:500,background:"#fff"}})]})}),o.jsx(s.DialogFooter,{children:o.jsx(s.Button,{onClick:v,type:"button",children:"Save changes"})})]})]})},Hs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Gs({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Us(e){return e.type.name==="mermaid"}function Ws(e){const{lang:t}=A.useLocale(),n=s.useAttributes(e.editor,s.Mermaid.name),r=tn(e.editor,s.Mermaid.name),i=({editor:l})=>{const{selection:u}=l.view.state,{$from:c,to:d}=u;let m=!1;return l.view.state.doc.nodesBetween(c.pos,d,f=>{if(Us(f))return m=!0,!1}),m},a=g.useMemo(()=>e.disabled?[]:oa(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:i,tippyOptions:Hs,children:a!=null&&a.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:a==null?void 0:a.map((l,u)=>l.type==="edit"&&(n!=null&&n.src)?o.jsx(Fs,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-mermaid-${u}`):o.jsx(Gs,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):o.jsx(o.Fragment,{})})})}function Ks({editor:e,disabled:t}){const[n,r]=g.useState(!1),{t:i}=A.useLocale(),a=g.useCallback(({editor:c})=>c.isActive(s.Twitter.name),[]),l=c=>{e.commands.updateTweet({src:c}),r(!1)},u=g.useCallback(()=>s.deleteNode(s.Twitter.name,e),[e]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e,shouldShow:a,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?o.jsx(o.Fragment,{}):o.jsx(o.Fragment,{children:n?o.jsx(s.FormEditLinkTwitter,{editor:e,onSetLink:l}):o.jsx("div",{className:"flex items-center gap-2 rounded-lg !border border-neutral-200 bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black",children:o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(s.ActionButton,{icon:"Pencil",tooltip:i("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{r(!0)}}),o.jsx(s.ActionButton,{action:u,icon:"Trash",tooltip:i("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function Vs({editor:e,disabled:t,bubbleMenu:n}){const r=e.extensionManager.extensions.map(a=>a.name),i=()=>{var a,l,u,c,d,m,f,h,p,x,v,b,T,P,_,j;return[r.includes("columns")&&!((a=n==null?void 0:n.columnConfig)!=null&&a.hidden)?o.jsx(Sa,{editor:e},"columns"):null,r.includes("table")&&!((l=n==null?void 0:n.tableConfig)!=null&&l.hidden)?o.jsx(xa,{editor:e,items:(u=n==null?void 0:n.tableConfig)==null?void 0:u.items,actions:(c=n==null?void 0:n.tableConfig)==null?void 0:c.actions},"table"):null,r.includes("link")&&!((d=n==null?void 0:n.linkConfig)!=null&&d.hidden)?o.jsx(ya,{disabled:t,editor:e},"link"):null,r.includes(s.Image.name)&&!((m=n==null?void 0:n.imageConfig)!=null&&m.hidden)?o.jsx(Aa,{disabled:t,editor:e},"image"):null,r.includes(s.ImageGif.name)&&!((f=n==null?void 0:n.imageGifConfig)!=null&&f.hidden)?o.jsx(Ca,{disabled:t,editor:e},"imageGif"):null,r.includes("video")&&!((h=n==null?void 0:n.videoConfig)!=null&&h.hidden)?o.jsx(Ta,{disabled:t,editor:e},"video"):null,r.includes("katex")&&!((p=n==null?void 0:n.katexConfig)!=null&&p.hidden)?o.jsx(zs,{disabled:t,editor:e},"katex"):null,r.includes("mermaid")&&!((x=n==null?void 0:n.mermaidConfig)!=null&&x.hidden)?o.jsx(Ws,{disabled:t,editor:e},"mermaid"):null,r.includes("iframe")&&!((v=n==null?void 0:n.iframeConfig)!=null&&v.hidden)?o.jsx(Ls,{disabled:t,editor:e},"iframe"):null,r.includes("twitter")&&!((b=n==null?void 0:n.twitterConfig)!=null&&b.hidden)?o.jsx(Ks,{disabled:t,editor:e},"twitter"):null,(T=n==null?void 0:n.floatingMenuConfig)!=null&&T.hidden?null:o.jsx(da,{disabled:t,editor:e},"content"),(P=n==null?void 0:n.textConfig)!=null&&P.hidden?null:o.jsx(ma,{disabled:t,editor:e,items:(_=n==null?void 0:n.textConfig)==null?void 0:_.items},"text"),r.includes("drawer")&&!((j=n==null?void 0:n.drawerConfig)!=null&&j.hidden)?o.jsx(Ms,{disabled:t,editor:e},"drawer"):null]};return n!=null&&n.render?n.render({editor:e,disabled:t||!1,bubbleMenu:n},i()):i().filter(Boolean)}function qs({editor:e,disabled:t,toolbar:n}){const{t:r,lang:i}=A.useLocale(),a=g.useMemo(()=>{const d=[...e.extensionManager.extensions].sort((f,h)=>{const p=f.options.sort??-1,x=h.options.sort??-1;return p-x});let m=[];for(const f of d){const{button:h,divider:p=!1,spacer:x=!1,toolbar:v=!0}=f.options;if(!h||!s.isFunction(h)||!v)continue;const b=h({editor:e,extension:f,t:r});if(Array.isArray(b)){const T=b.map((P,_)=>({button:P,divider:_===b.length-1?p:!1,spacer:_===0?x:!1,type:f.type,name:f.name}));m=[...m,...T];continue}m.push({button:b,divider:p,spacer:x,type:f.type,name:f.name})}return m},[e,r,i]),l=c=>o.jsx("div",{className:"toolbar px-1 py-2 !border-b",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:o.jsx("div",{className:"relative flex flex-wrap h-auto gap-y-1 gap-x-1",children:c})}),u=a.map((c,d)=>{var f,h;const m=c.button.component;return o.jsxs("div",{className:"flex items-center",children:[(c==null?void 0:c.spacer)&&o.jsx(s.Separator,{orientation:"vertical",className:"!h-[16px] !mx-[10px]"}),o.jsx(m,{...c.button.componentProps,disabled:t||((h=(f=c==null?void 0:c.button)==null?void 0:f.componentProps)==null?void 0:h.disabled)}),(c==null?void 0:c.divider)&&o.jsx(s.Separator,{orientation:"vertical",className:"!h-auto !mx-2"})]},`toolbar-item-${d}`)});return n&&(n!=null&&n.render)?n.render({editor:e,disabled:t||!1},a,u,l):l(u)}function Xs(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImage({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Ys(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`image-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateImageGif({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Zs(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,a;return(a=(i=e.commands)==null?void 0:i.setAlignImage)==null?void 0:a.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function Js(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,a;return(a=(i=e.commands)==null?void 0:i.setAlignImageGif)==null?void 0:a.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function Qs(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,a;return(a=(i=e.commands)==null?void 0:i.setAlignImageMermaid)==null?void 0:a.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ea(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var i,a;return(a=(i=e.commands)==null?void 0:i.setAlignImageDrawer)==null?void 0:a.call(i,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ta(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,i)=>({type:`video-${r}`,component:s.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[i],action:()=>e.commands.updateVideo({width:A.VIDEO_SIZE[r]}),isActive:()=>e.isActive("video",{width:A.VIDEO_SIZE[r]})}}))}function na(e){return[{type:"flipX",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.tooltip.flipX"),icon:"FlipX",action:()=>{const t=e.getAttributes("image"),{flipX:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!n}).run()}}},{type:"flipY",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.tooltip.flipY"),icon:"FlipY",action:()=>{const t=e.getAttributes("image"),{flipY:n}=t;e.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!n}).run()}}},...Xs(e),...Zs(e),{type:"remove",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;s.deleteSelection(t,n)}}}]}function ra(e){return[...Ys(e),...Js(e),{type:"remove",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;s.deleteSelection(t,n)}}}]}function oa(e){return[...Qs(e),{type:"edit",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;s.deleteSelection(t,n)}}}]}function ia(e){return[...ea(e),{type:"edit",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>(console.log("AAA"),!0)}},{type:"remove",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;s.deleteSelection(t,n)}}}]}function sa(e){return[...ta(e),{type:"remove",component:s.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;s.deleteSelection(t,n)}}}]}function nn(e,t,n=A.BUBBLE_TEXT_LIST){return n.reduce((r,i)=>{if(i==="divider"&&r.length>0)return[...r,{type:"divider",component:void 0,componentProps:{}}];const a=e.extensionManager.extensions.find(l=>l.name===i);return a?[...r,a.configure().options.button({editor:e,t,extension:a})]:r},[])}function _e(e,t,n){const r=[],i=e.node(0);n=typeof n=="number"&&n>=0?n:e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos);const a=new s.NodeRange(e,t,n),l=a.depth===0?0:i.resolve(a.start).posAtIndex(0);return a.parent.forEach((u,c)=>{const d=l+c,m=d+u.nodeSize;if(d<a.start||d>=a.end)return;const f=new s.SelectionRange(i.resolve(d),i.resolve(m));r.push(f)}),r}class Ie{constructor(t,n){X(this,"anchor");X(this,"head");this.anchor=t,this.head=n}map(t){return new Ie(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return new $(n,r)}}class $ extends s.Selection{constructor(n,r,i,a=1){const{doc:l}=n,u=n===r,c=n.pos===l.content.size&&r.pos===l.content.size,d=u&&!c?l.resolve(r.pos+(a>0?1:-1)):r,m=u&&c?l.resolve(n.pos-(a>0?1:-1)):n,f=_e(m.min(d),m.max(d),i);super(d.pos>=n.pos?f[0].$from:f[f.length-1].$to,d.pos>=n.pos?f[f.length-1].$to:f[0].$from,f);X(this,"depth");this.depth=i}get $to(){return this.ranges[this.ranges.length-1].$to}eq(n){return n instanceof $&&n.$from.pos===this.$from.pos&&n.$to.pos===this.$to.pos}map(n,r){const i=n.resolve(r.map(this.anchor)),a=n.resolve(r.map(this.head));return new $(i,a)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:n}=this.$from;if(this.isForwards&&this.ranges.length>1){const a=this.ranges.slice(0,-1),l=a[0].$from,u=a[a.length-1].$to;return new $(l,u,this.depth)}const r=this.ranges[0],i=n.resolve(Math.max(0,r.$from.pos-1));return new $(this.$anchor,i,this.depth)}extendForwards(){const{doc:n}=this.$from;if(this.isBackwards&&this.ranges.length>1){const a=this.ranges.slice(1),l=a[0].$from,u=a[a.length-1].$to;return new $(u,l,this.depth)}const r=this.ranges[this.ranges.length-1],i=n.resolve(Math.min(n.content.size,r.$to.pos+1));return new $(this.$anchor,i,this.depth)}static fromJSON(n,r){return new $(n.resolve(r.anchor),n.resolve(r.head))}static create(n,r,i,a,l=1){return new this(n.resolve(r),n.resolve(i),a,l)}getBookmark(){return new Ie(this.anchor,this.head)}}function aa(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName("*"))],r=[t,...Array.from(t.getElementsByTagName("*"))];return n.forEach((i,a)=>{r[a].style.cssText=function(l){let u="";const c=getComputedStyle(l);for(let d=0;d<c.length;d+=1)u+=`${c[d]}:${c.getPropertyValue(c[d])};`;return u}(i)}),t}function Z(e,t){return window.getComputedStyle(e)[t]}function la(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function ft(e){e.parentNode!==null&&e.parentNode!==void 0&&e.parentNode.removeChild(e)}function rn(e){const{x:t,y:n,direction:r,editor:i}=e;let a=null,l=null,u=null,c=t;for(;l===null&&c<window.innerWidth&&c>0;){const d=document.elementsFromPoint(c,n),m=d.findIndex(h=>h.classList.contains("ProseMirror")),f=d.slice(0,m);if(f.length>0){const h=f[0];if(a=h,u=i.view.posAtDOM(h,0),u>=0){l=i.state.doc.nodeAt(Math.max(u-1,0)),(l===null||l.isText)&&(l=i.state.doc.nodeAt(Math.max(u-1,0))),l||(l=i.state.doc.nodeAt(Math.max(u,0)));break}}r==="left"?c-=1:c+=1}return{resultElement:a,resultNode:l,pos:u!==null?u:null}}function ca(e,t){const{doc:n}=t.view.state,r=rn({editor:t,x:e.clientX,y:e.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const i=e.clientX,a=function(m,f,h){const p=Number.parseInt(Z(m.dom,"paddingLeft"),10),x=Number.parseInt(Z(m.dom,"paddingRight"),10),v=Number.parseInt(Z(m.dom,"borderLeftWidth"),10),b=Number.parseInt(Z(m.dom,"borderLeftWidth"),10),T=m.dom.getBoundingClientRect();return{left:la(f,T.left+p+v,T.right-x-b),top:h}}(t.view,i,e.clientY),l=t.view.posAtCoords(a);if(!l)return[];const{pos:u}=l;if(!n.resolve(u).parent)return[];const c=n.resolve(r.pos),d=n.resolve(r.pos+1);return _e(c,d,0)}function mt(e,t){const n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1}function ht(e,t){const n=e.nodeAt(t),r=e.resolve(t);let{depth:i}=r,a=n;for(;i>0;){const l=r.node(i);i-=1,i===0&&(a=l)}return a}function gt(e,t){let n=t;for(;n&&n.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n}const on=new s.PluginKey("dragHandle");function ua({pluginKey:e=on,element:t,editor:n,tippyOptions:r,onNodeChange:i}){const a=document.createElement("div");let l=null,u=!1,c=null,d=-1;return t.addEventListener("dragstart",m=>{const{view:f}=n;if(!m.dataTransfer)return;const{empty:h,$from:p,$to:x}=f.state.selection,v=ca(m,n),b=_e(p,x,0),T=b.some(O=>v.find(N=>N.$from===O.$from&&N.$to===O.$to)),P=h||!T?v:b;if(P.length===0)return;const{tr:_}=f.state,j=document.createElement("div"),y=P[0].$from.pos,C=P[P.length-1].$to.pos,w=$.create(f.state.doc,y,C),E=w.content();P.forEach(O=>{const N=aa(f.nodeDOM(O.$from.pos));j.append(N)}),j.style.position="absolute",j.style.top="-10000px",document.body.append(j),m.dataTransfer.clearData(),m.dataTransfer.setDragImage(j,0,0),f.dragging={slice:E,move:!0},_.setSelection(w),f.dispatch(_),document.addEventListener("drop",()=>ft(j),{once:!0}),setTimeout(()=>{t&&(t.style.pointerEvents="none")},0)}),t.addEventListener("dragend",()=>{t&&(t.style.pointerEvents="auto")}),new s.Plugin({key:typeof e=="string"?new s.PluginKey(e):e,state:{init:()=>({locked:!1}),apply(m,f){const h=m.getMeta("lockDragHandle"),p=m.getMeta("hideDragHandle");if(h!==void 0&&(u=h),p&&l)return l.hide(),u=!1,c=null,d=-1,i==null||i({editor:n,node:null,pos:-1}),f;if(m.docChanged&&d!==-1&&t&&l){const x=m.mapping.map(d);x!==d&&(d=x)}return f}},view:m=>{return f(),h(n.view.dom),l=vt(m.dom,{...p(),...r}),{update(j,y){if(!x(t,l)||(t.draggable=!u,!v(j,y)))return;const C=b(j);C&&T(j,C)},destroy(){_()}};function f(){t.draggable=!0,t.style.pointerEvents="auto"}function h(j){var y;(y=j.parentElement)==null||y.appendChild(a),a.appendChild(t),Object.assign(a.style,{pointerEvents:"none",position:"absolute",top:"0",left:"0"})}function p(){return{getReferenceClientRect:null,interactive:!0,trigger:"manual",placement:"left-start",hideOnClick:!1,duration:100,zIndex:10,appendTo:a,content:t,popperOptions:{modifiers:[{name:"flip",enabled:!1},{name:"preventOverflow",options:{rootBoundary:"document",mainAxis:!1}}]}}}function x(j,y){return j&&y}function v(j,y){return!j.state.doc.eq(y.doc)&&d!==-1}function b(j){let y=j.nodeDOM(d);return y=gt(j,y),y===j.dom||(y==null?void 0:y.nodeType)!==1?null:y}function T(j,y){const C=j.posAtDOM(y,0),w=ht(n.state.doc,C);if(w===c)return;const E=mt(n.state.doc,C);c=w,d=E,i==null||i({editor:n,node:c,pos:d}),P(y)}function P(j){l.setProps({getReferenceClientRect:()=>j.getBoundingClientRect()}),l.show()}function _(){l==null||l.destroy(),t&&ft(a)}},props:{handleDOMEvents:{mouseleave:(m,f)=>{if(u||!h(f))return!1;return p(),x(),!1;function h(v){return v.target&&!a.contains(v.relatedTarget)}function p(){l==null||l.hide()}function x(){c=null,d=-1,i==null||i({editor:n,node:null,pos:-1})}},mousemove:s.debounce((m,f)=>{if(!t||!l||u)return!1;const h=rn({x:f.clientX,y:f.clientY,direction:"right",editor:n});if(!h.resultElement||h.resultElement===m.dom)return!1;const p=gt(m,h.resultElement);if(p===m.dom||(p==null?void 0:p.nodeType)!==1)return!1;const x=m.posAtDOM(p,0),v=ht(n.state.doc,x);if(v===c)return!1;const b=mt(n.state.doc,x);return c=v,d=b,i==null||i({editor:n,node:c,pos:d}),l.setProps({getReferenceClientRect:()=>p.getBoundingClientRect()}),l.show(),!1},100)}}})}function da(e){var E,O,N;const{pluginKey:t=on}=e,{t:n}=A.useLocale(),[r,i]=g.useState(null),[a,l]=g.useState(-1),u=g.useRef(null),c=g.useRef(null),[d,m]=g.useState(!1),f=e.editor.extensionManager.extensions.some(S=>S.name==="textAlign"),h=e.editor.extensionManager.extensions.some(S=>S.name==="indent"),p=e.editor.extensionManager.extensions.some(S=>S.name==="clear");g.useEffect(()=>{u.current&&!e.editor.isDestroyed&&(c.current=ua({editor:e.editor,element:u.current,pluginKey:"ContentItemMenu",tippyOptions:{offset:[-2,16],zIndex:99,moveTransition:"transform 0.15s ease-out"},onNodeChange:y}),e.editor.registerPlugin(c.current))},[e.editor,u]);function x(){const S=e.editor.chain();S.setNodeSelection(a).unsetAllMarks(),(r==null?void 0:r.type.name)!=="paragraph"&&S.setParagraph(),S.run()}function v(){e.editor.chain().focus().setNodeSelection(a).run(),document.execCommand("copy")}function b(){e.editor.commands.setNodeSelection(a);const{$anchor:S}=e.editor.state.selection,oe=S.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(a+((r==null?void 0:r.nodeSize)||0),oe.toJSON()).run()}function T(S){e.editor.commands.setTextAlign(S)}function P(){const S=s.setNodeIndentMarkup(e.editor.state.tr,a,1);S.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(S)}function _(){const S=s.setNodeIndentMarkup(e.editor.state.tr,a,-1);e.editor.view.dispatch&&e.editor.view.dispatch(S)}function j(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(a).deleteSelection().run()}function y(S){S.node&&i(S.node),l(S.pos)}function C(){var S;if(a!==-1){const oe=(r==null?void 0:r.nodeSize)||0,Be=a+oe,Me=(r==null?void 0:r.type.name)==="paragraph"&&((S=r==null?void 0:r.content)==null?void 0:S.size)===0,dn=Me?a+2:Be+2;e.editor.chain().command(({dispatch:De,tr:ie,state:ke})=>De?(Me?ie.insertText("/",a,a+1):ie.insert(Be,ke.schema.nodes.paragraph.create(null,[ke.schema.text("/")])),De(ie)):!0).focus(dn).run()}}g.useEffect(()=>(d?e.editor.commands.setMeta("lockDragHandle",!0):e.editor.commands.setMeta("lockDragHandle",!1),()=>{e.editor.commands.setMeta("lockDragHandle",!1)}),[d]),g.useEffect(()=>()=>{c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[]),g.useEffect(()=>{var S;(S=e.editor)!=null&&S.isDestroyed&&c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[(E=e.editor)==null?void 0:E.isDestroyed]);const w=S=>{e!=null&&e.disabled||m(S)};return o.jsx("div",{ref:u,className:`drag-handle duration-200 ease-in-out [transition-property:top,_left] ${e==null?void 0:e.className}`,style:{opacity:e!=null&&e.disabled?0:1},children:o.jsxs("div",{className:"flex items-center gap-0.5 duration-200 ease-in-out [transition-property:top,_left]",children:[o.jsx(s.Button,{className:"!size-7 cursor-grab",disabled:e==null?void 0:e.disabled,onClick:C,size:"icon",type:"button",variant:"ghost",children:o.jsx(s.IconComponent,{className:"text-lg text-neutral-600 dark:text-neutral-200",name:"Plus"})}),o.jsxs(s.DropdownMenu,{onOpenChange:w,open:d,children:[o.jsxs("div",{className:"relative flex flex-col",children:[o.jsxs(s.Tooltip,{children:[o.jsx(s.TooltipTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:o.jsx(s.Button,{className:"relative z-[1] !size-7 cursor-grab",disabled:e==null?void 0:e.disabled,size:"icon",type:"button",variant:"ghost",onMouseUp:S=>{S.preventDefault(),!(e!=null&&e.disabled)&&m(!0)},children:o.jsx(s.IconComponent,{className:"text-sm text-neutral-600 dark:text-neutral-200",name:"Grip"})})}),o.jsx(s.TooltipContent,{children:n("editor.draghandle.tooltip")})]}),o.jsx(s.DropdownMenuTrigger,{className:"absolute left-0 top-0 z-0 size-[28px]"})]}),o.jsxs(s.DropdownMenuContent,{align:"start",className:"w-48",side:"bottom",sideOffset:0,children:[o.jsxs(s.DropdownMenuItem,{className:"flex gap-3 bg-opacity-10 hover:bg-red-400 hover:bg-opacity-20 focus:bg-red-400 focus:bg-opacity-30 focus:text-red-500 dark:hover:bg-opacity-20 dark:hover:text-red-500",onClick:j,children:[o.jsx(s.IconComponent,{name:"Trash2"}),o.jsx("span",{children:n("editor.remove")})]}),p?o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",onClick:x,children:[o.jsx(s.IconComponent,{name:"PaintRoller"}),o.jsx("span",{children:n("editor.clear.tooltip")})]}):null,o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",onClick:v,children:[o.jsx(s.IconComponent,{name:"Clipboard"}),o.jsx("span",{children:n("editor.copyToClipboard")})]}),o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",onClick:b,children:[o.jsx(s.IconComponent,{name:"Copy"}),o.jsx("span",{children:n("editor.copy")})]}),f||h?o.jsx(s.DropdownMenuSeparator,{}):null,f?o.jsxs(s.DropdownMenuSub,{children:[o.jsxs(s.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(s.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.tooltip")})]}),o.jsx(s.DropdownMenuPortal,{children:o.jsxs(s.DropdownMenuSubContent,{children:[o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",onClick:()=>T("left"),children:[o.jsx(s.IconComponent,{name:"AlignLeft"}),o.jsx("span",{children:n("editor.textalign.left.tooltip")})]}),o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",onClick:()=>T("center"),children:[o.jsx(s.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.center.tooltip")})]}),o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",onClick:()=>T("right"),children:[o.jsx(s.IconComponent,{name:"AlignRight"}),o.jsx("span",{children:n("editor.textalign.right.tooltip")})]})]})})]}):null,h?o.jsxs(s.DropdownMenuSub,{children:[o.jsxs(s.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(s.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent")})]}),o.jsx(s.DropdownMenuPortal,{children:o.jsxs(s.DropdownMenuSubContent,{children:[o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",disabled:((O=r==null?void 0:r.attrs)==null?void 0:O.indent)>=s.IndentProps.max,onClick:P,children:[o.jsx(s.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent.tooltip")})]}),o.jsxs(s.DropdownMenuItem,{className:"flex gap-3",disabled:((N=r==null?void 0:r.attrs)==null?void 0:N.indent)<=s.IndentProps.min,onClick:_,children:[o.jsx(s.IconComponent,{name:"IndentDecrease"}),o.jsx("span",{children:n("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}const fa={maxWidth:"auto",zIndex:20,moveTransition:"transform 0.1s ease-out"};function sn({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n}):o.jsx(o.Fragment,{})}function ma(e){const{t,lang:n}=A.useLocale(),r=({editor:a})=>{const{selection:l}=a.view.state,{$from:u,to:c}=l;return u.pos===c?!1:l instanceof s.TextSelection},i=g.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:nn(e.editor,t,e.items),[e.disabled,e.editor,e.items,n,t]);return o.jsx(s.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:fa,children:i!=null&&i.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap",children:i==null?void 0:i.map((a,l)=>(a==null?void 0:a.type)==="divider"?o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"},`bubbleMenu-divider-${l}`):o.jsx(sn,{disabled:e.disabled,editor:e.editor,item:a},`bubbleMenu-text-${l}`))})}):o.jsx(o.Fragment,{})})}function Oe({children:e,vertical:t}){return o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:`relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap ${t?"h-max flex-col":""}`,children:e})})}function ha({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:v})=>!x||!v?!1:s.isRowGripSelected({editor:e,view:p,state:x,from:v}),[e]);function i(){e.chain().focus().addRowBefore().run()}function a(){e.chain().focus().addRowAfter().run()}function l(){e.chain().focus().deleteRow().run()}return t?null:o.jsx(s.BubbleMenu,{editor:e,pluginKey:"tableRowMenu",shouldShow:r,updateDelay:0,tippyOptions:{placement:"left",offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Oe,{vertical:!0,children:[o.jsx(s.ActionButton,{action:i,disabled:!((c=e==null?void 0:(u=e.can()).addRowBefore)!=null&&c.call(u)),icon:"BetweenVerticalEnd",tooltip:n("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15}}),o.jsx(s.ActionButton,{action:a,disabled:!((m=(d=e==null?void 0:e.can())==null?void 0:d.addRowAfter)!=null&&m.call(d)),icon:"BetweenVerticalStart",tooltip:n("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15}}),o.jsx(s.ActionButton,{action:l,disabled:!((h=(f=e==null?void 0:e.can())==null?void 0:f.deleteRow)!=null&&h.call(f)),icon:"DeleteRow",tooltip:n("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15}})]})})}function ga({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:v})=>x?s.isColumnGripSelected({editor:e,view:p,state:x,from:v||0}):!1,[e]);function i(){e.chain().focus().addColumnBefore().run()}function a(){e.chain().focus().addColumnAfter().run()}function l(){e.chain().focus().deleteColumn().run()}return t?null:o.jsx(s.BubbleMenu,{editor:e,pluginKey:"tableColumnMenu",shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Oe,{children:[o.jsx(s.ActionButton,{action:i,disabled:!((c=(u=e==null?void 0:e.can())==null?void 0:u.addColumnBefore)!=null&&c.call(u)),icon:"BetweenHorizonalEnd",tooltip:n("editor.table.menu.insertColumnBefore"),"tooltip-options":{sideOffset:15}}),o.jsx(s.ActionButton,{action:a,disabled:!((m=(d=e==null?void 0:e.can())==null?void 0:d.addColumnAfter)!=null&&m.call(d)),icon:"BetweenHorizonalStart",tooltip:n("editor.table.menu.insertColumnAfter"),"tooltip-options":{sideOffset:15}}),o.jsx(s.ActionButton,{action:l,disabled:!((h=e==null?void 0:(f=e.can()).deleteColumn)!=null&&h.call(f)),icon:"DeleteColumn",tooltip:n("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15}})]})})}function pa({editor:e,disabled:t,actions:n,...r}){var v,b,T,P,_,j;const i=({editor:y,view:C,state:w,from:E})=>{const{selection:O}=y.view.state,{$from:N,to:S}=O;return N.pos===S||!w||!E?!1:O instanceof s.TextSelection||s.isRowGripSelected({editor:y,view:C,state:w,from:E})||s.isColumnGripSelected({editor:y,view:C,state:w,from:E})},a=({editor:y})=>s.isActive(y.view.state,"table"),l=y=>a(y)&&!i(y),{t:u,lang:c}=A.useLocale();function d(){e.chain().focus().mergeCells().run()}function m(){e==null||e.chain().focus().splitCell().run()}function f(){e.chain().focus().deleteTable().run()}function h(y){e.chain().focus().setTableCellBackground(y).run()}const p=()=>{var N;const{view:y,state:{selection:{from:C}}}=e,w=y.domAtPos(C).node;if(!w)return new DOMRect(-1e3,-1e3,0,0);const E=(N=w==null?void 0:w.closest)==null?void 0:N.call(w,".tableWrapper");return E?E.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)},x=g.useMemo(()=>t||!e?[]:nn(e,u,r.items||[]),[t,e,r.items,c,u]);return t?null:o.jsx(s.BubbleMenu,{editor:e,pluginKey:"table",shouldShow:l,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},maxWidth:"auto",getReferenceClientRect:p,plugins:[vt.sticky],sticky:"popper"},children:o.jsxs(Oe,{children:[n&&o.jsxs(o.Fragment,{children:[n.map((y,C)=>o.jsx(s.ActionButton,{...y},C)),o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),r.items&&o.jsxs(o.Fragment,{children:[x.map((y,C)=>o.jsx(sn,{disabled:t,editor:e,item:y},C)),o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),o.jsx(s.ActionButton,{action:d,disabled:!((b=(v=e==null?void 0:e.can())==null?void 0:v.mergeCells)!=null&&b.call(v)),icon:"TableCellsMerge",tooltip:u("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15}}),o.jsx(s.ActionButton,{action:m,disabled:!((P=(T=e==null?void 0:e.can())==null?void 0:T.splitCell)!=null&&P.call(T)),icon:"TableCellsSplit",tooltip:u("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15}}),o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}),o.jsx(s.HighlightActionButton,{action:h,editor:e,tooltip:u("editor.table.menu.setCellsBgColor"),tooltipOptions:{sideOffset:15}}),o.jsx(s.ActionButton,{action:f,disabled:!((j=(_=e==null?void 0:e.can())==null?void 0:_.deleteTable)!=null&&j.call(_)),icon:"Trash2",tooltip:u("editor.table.menu.deleteTable"),"tooltip-options":{sideOffset:15}})]})})}function xa(e){return o.jsxs(o.Fragment,{children:[o.jsx(pa,{...e}),o.jsx(ha,{...e}),o.jsx(ga,{...e})]})}function va(e){const{t}=A.useLocale();return o.jsxs("div",{className:"flex items-center gap-2 p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800",children:[o.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline break-all",children:Ps(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&o.jsx(s.Separator,{orientation:"vertical",className:"!h-4"}),o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(s.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),o.jsx(s.ActionButton,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function ya({editor:e,disabled:t}){const[n,r]=g.useState(!1),i=g.useMemo(()=>{const{href:c}=e.getAttributes("link");return c},[e]),a=g.useCallback(({editor:c})=>c.isActive("link"),[]),l=(c,d,m)=>{e.chain().extendMarkRange("link").insertContent({type:"text",text:d,marks:[{type:"link",attrs:{href:c,target:m?"_blank":""}}]}).setLink({href:c}).focus().run(),r(!1)},u=g.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),r(!1)},[e]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e,shouldShow:a,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{r(!1)}},children:t?o.jsx(o.Fragment,{}):o.jsx(o.Fragment,{children:n?o.jsx(s.LinkEditBlock,{onSetLink:l,editor:e}):o.jsx(va,{editor:e,onClear:u,onEdit:()=>{r(!0)},link:i})})})})}const Ne={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Re({item:e,disabled:t,editor:n}){var i;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(s.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:n})}):o.jsx(o.Fragment,{})}function wa(e){return e.type.name===s.Image.name}function ba(e){return e.type.name===s.ImageGif.name}function ja(e){return e.type.name===s.Video.name}function Aa(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:a}=i.view.state,{$from:l,to:u}=a;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(wa(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:na(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Ne,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,a)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-${a}`))})}):o.jsx(o.Fragment,{})})})}function Ca(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:a}=i.view.state,{$from:l,to:u}=a;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(ba(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:ra(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Ne,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,a)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-gif-${a}`))})}):o.jsx(o.Fragment,{})})})}function Ta(e){const{lang:t}=A.useLocale(),n=({editor:i})=>{const{selection:a}=i.view.state,{$from:l,to:u}=a;let c=!1;return i.view.state.doc.nodesBetween(l.pos,u,d=>{if(ja(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:sa(e.editor),[e.editor,e.disabled,t]);return o.jsx(o.Fragment,{children:o.jsx(s.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Ne,children:r!=null&&r.length?o.jsx("div",{className:"pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800",children:o.jsx("div",{className:"relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap",children:r==null?void 0:r.map((i,a)=>o.jsx(Re,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-video-${a}`))})}):o.jsx(o.Fragment,{})})})}function Sa({editor:e}){const{t}=A.useLocale(),n=g.useCallback(()=>e.isActive(s.MultiColumn.name),[e]),r=g.useCallback(()=>s.deleteNode(s.MultiColumn.name,e),[e]),i=g.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),a=g.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),l=g.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return o.jsx(s.BubbleMenu,{pluginKey:"columns-bubble-menu",editor:e,shouldShow:n,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:o.jsxs("div",{className:"w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background",children:[o.jsx(s.ActionButton,{action:i,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),o.jsx(s.ActionButton,{action:a,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),o.jsx(s.ActionButton,{action:l,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),o.jsx(s.ActionButton,{action:r,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}function Ea({editor:e,extensions:t}){const{t:n}=A.useLocale(),r=g.useMemo(()=>{var i,a,l;return(l=(a=(i=t==null?void 0:t.find(u=>u.name==="base-kit"))==null?void 0:i.options)==null?void 0:a.characterCount)==null?void 0:l.limit},[t]);return r?o.jsx("div",{className:"flex items-center justify-between p-3 border-t",children:o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"flex justify-end gap-3 text-sm",children:o.jsxs("span",{children:[e.storage.characterCount.characters(),"/",r," ",n("editor.characters")]})})})}):o.jsx("div",{className:"flex items-center justify-between p-3 border-t",children:o.jsx("div",{className:"flex flex-col",children:o.jsx("div",{className:"flex justify-end gap-3 text-sm",children:o.jsxs("span",{children:[e.storage.characterCount.characters()," ",n("editor.characters")]})})})})}function Pa(){const{toasts:e}=s.useToast();return o.jsxs(_s,{children:[e.map(({id:t,title:n,description:r,action:i,...a})=>o.jsxs(Zt,{...a,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(Qt,{children:n}),r&&o.jsx(en,{children:r})]}),i,o.jsx(Jt,{})]},t)),o.jsx(Yt,{})]})}const _a=`
|
|
3
|
+
.reactjs-tiptap-editor,
|
|
4
|
+
.dialog-content {
|
|
5
|
+
button,
|
|
6
|
+
input:where([type=button]),
|
|
7
|
+
input:where([type=reset]),
|
|
8
|
+
input:where([type=submit]) {
|
|
9
|
+
-webkit-appearance: button;
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
background-image: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
input,
|
|
15
|
+
optgroup,
|
|
16
|
+
select,
|
|
17
|
+
textarea {
|
|
18
|
+
font-family: inherit;
|
|
19
|
+
font-feature-settings: inherit;
|
|
20
|
+
font-variation-settings: inherit;
|
|
21
|
+
font-size: 100%;
|
|
22
|
+
font-weight: inherit;
|
|
23
|
+
line-height: inherit;
|
|
24
|
+
letter-spacing: inherit;
|
|
25
|
+
color: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
button {
|
|
29
|
+
font-family: inherit;
|
|
30
|
+
font-feature-settings: inherit;
|
|
31
|
+
font-variation-settings: inherit;
|
|
32
|
+
font-size: 100%;
|
|
33
|
+
font-weight: inherit;
|
|
34
|
+
line-height: inherit;
|
|
35
|
+
letter-spacing: inherit;
|
|
36
|
+
color: inherit;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
*,
|
|
40
|
+
::before,
|
|
41
|
+
::after {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
border-width: 0;
|
|
44
|
+
border-style: solid;
|
|
45
|
+
border-color: hsl(var(--border));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
background-color: hsl(var(--background));
|
|
49
|
+
color: hsl(var(--foreground));
|
|
50
|
+
|
|
51
|
+
hr {
|
|
52
|
+
height: 0;
|
|
53
|
+
color: inherit;
|
|
54
|
+
border-top-width: 1px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
a {
|
|
58
|
+
color: inherit;
|
|
59
|
+
text-decoration: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
b,
|
|
63
|
+
strong {
|
|
64
|
+
font-weight: bolder;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
code,
|
|
68
|
+
kbd,
|
|
69
|
+
samp,
|
|
70
|
+
pre {
|
|
71
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
72
|
+
font-feature-settings: normal;
|
|
73
|
+
font-variation-settings: normal;
|
|
74
|
+
font-size: 1em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
table {
|
|
78
|
+
text-indent: 0;
|
|
79
|
+
border-color: inherit;
|
|
80
|
+
border-collapse: collapse;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
input, textarea {
|
|
84
|
+
border-width: 1px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
textarea {
|
|
88
|
+
resize: vertical;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input::placeholder,
|
|
92
|
+
textarea::placeholder {
|
|
93
|
+
opacity: 1;
|
|
94
|
+
color: #9ca3af;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
button, input, textarea {
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
color: inherit;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
img,
|
|
103
|
+
svg,
|
|
104
|
+
video,
|
|
105
|
+
canvas,
|
|
106
|
+
audio,
|
|
107
|
+
iframe,
|
|
108
|
+
embed,
|
|
109
|
+
object {
|
|
110
|
+
display: block;
|
|
111
|
+
vertical-align: middle;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
img,
|
|
115
|
+
video {
|
|
116
|
+
max-width: 100%;
|
|
117
|
+
height: auto;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
div[data-radix-popper-content-wrapper],
|
|
122
|
+
div[data-tippy-root] {
|
|
123
|
+
*,
|
|
124
|
+
::before,
|
|
125
|
+
::after {
|
|
126
|
+
box-sizing: border-box;
|
|
127
|
+
border-width: 0;
|
|
128
|
+
border-style: solid;
|
|
129
|
+
border-color: hsl(var(--border));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
background-color: hsl(var(--background));
|
|
133
|
+
color: hsl(var(--foreground));
|
|
134
|
+
|
|
135
|
+
button, input, textarea {
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
color: inherit;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`,Ia=g.memo(({children:e,id:t})=>{const[,n]=s.useStoreEditableEditor(l=>l.value),[,r]=s.useStoreTheme(l=>l.value),i=l=>{n({value:l.detail})},a=l=>{r({value:l.detail})};return g.useEffect(()=>{const l=s.listenEvent(s.EVENTS.EDIT(t),i),u=s.listenEvent(s.EVENTS.UPDATE_THEME(t),a);return()=>{l(),u()}},[]),o.jsx(o.Fragment,{children:e})});function Oa({children:e,id:t}){return o.jsx(s.ProviderEditableEditor,{children:o.jsx(s.ProviderTheme,{children:o.jsx(Ia,{id:t,children:e})})})}const pt="data-rc-order",xt="data-rc-priority",Na="rc-util-key",we=new Map;function Ra(e,t){if(!e)return!1;if(e.contains)return e.contains(t);let n=t;for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function an({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:Na}function $e(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function $a(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function ln(e){return[...(we.get(e)||e).children].filter(t=>t.tagName==="STYLE")}function cn(e,t={}){const{csp:n,prepend:r,priority:i=0}=t,a=$a(r),l=a==="prependQueue",u=document.createElement("style");u.setAttribute(pt,a),l&&i&&u.setAttribute(xt,`${i}`),n!=null&&n.nonce&&(u.nonce=n==null?void 0:n.nonce),u.innerHTML=e;const c=$e(t),{firstChild:d}=c;if(r){if(l){const m=ln(c).filter(f=>{if(!["prepend","prependQueue"].includes(f.getAttribute(pt)))return!1;const h=Number(f.getAttribute(xt)||0);return i>=h});if(m.length>0)return c.insertBefore(u,m.at(-1).nextSibling),u}d.before(u)}else c.append(u);return u}function un(e,t={}){const n=$e(t);return ln(n).find(r=>r.getAttribute(an(t))===e)}function Ba(e,t={}){const n=un(e,t);n&&n.remove()}function Ma(e,t){const n=we.get(e);if(!n||!Ra(document,n)){const r=cn("",t),{parentNode:i}=r;we.set(e,i),r.remove()}}function Da(e,t,n={}){var l,u,c;const r=$e(n);Ma(r,n);const i=un(t,n);if(i)return(l=n.csp)!=null&&l.nonce&&i.nonce!==((u=n.csp)==null?void 0:u.nonce)&&(i.nonce=(c=n.csp)==null?void 0:c.nonce),i.innerHTML!==e&&(i.innerHTML=e),i;const a=cn(e,n);return a.setAttribute(an(n),t),a}function ka(e,t){const{content:n,extensions:r,useEditorOptions:i={}}=e,a=g.useId(),l=g.useMemo(()=>{const f=as(r,r,"name");return[...r.map(p=>{const x=r.find(v=>v.name===p.name);return x?p.configure(x.options):p}),...f].map((p,x)=>p.configure({sort:x}))},[r]),u=s.throttle(f=>{var p;const h=d(f,e.output);(p=e==null?void 0:e.onChangeContent)==null||p.call(e,h)},A.EDITOR_UPDATE_WATCH_THROTTLE_WAIT_TIME),c=s.useEditor({extensions:l,content:n,onUpdate:({editor:f})=>{u&&u(f)},...i});g.useImperativeHandle(t,()=>({editor:c})),g.useEffect(()=>{document.documentElement.classList.toggle("dark",e.dark),s.themeActions.setTheme(a,e.dark?"dark":"light")},[e.dark]),g.useEffect(()=>{c==null||c.setEditable(!(e!=null&&e.disabled)),s.editableEditorActions.setDisable(a,!(e!=null&&e.disabled))},[c,e==null?void 0:e.disabled]),g.useEffect(()=>((e==null?void 0:e.resetCSS)!==!1&&Da(_a,"react-tiptap-reset"),()=>{Ba("react-tiptap-reset")}),[e==null?void 0:e.resetCSS]);function d(f,h){return e!=null&&e.removeDefaultWrapper?h==="html"?f.isEmpty?"":f.getHTML():h==="json"?f.isEmpty?{}:f.getJSON():h==="text"?f.isEmpty?"":f.getText():"":h==="html"?f.getHTML():h==="json"?f.getJSON():h==="text"?f.getText():""}g.useLayoutEffect(()=>{c&&(c.id=a)},[a,c]),g.useEffect(()=>()=>{var f;(f=c==null?void 0:c.destroy)==null||f.call(c)},[]);const m=s.hasExtension(c,"characterCount");return c?o.jsxs("div",{className:"reactjs-tiptap-editor",children:[o.jsx(Oa,{id:a,children:o.jsx(s.TooltipProvider,{delayDuration:0,disableHoverableContent:!0,children:o.jsx("div",{className:"overflow-hidden rounded-[0.5rem] bg-background",children:o.jsxs("div",{className:"flex max-h-full w-full flex-col",children:[!(e!=null&&e.hideToolbar)&&o.jsx(qs,{disabled:!!(e!=null&&e.disabled),editor:c,toolbar:e.toolbar}),o.jsx(s.EditorContent,{className:`relative ${(e==null?void 0:e.contentClass)||""}`,editor:c}),m&&o.jsx(Ea,{editor:c,extensions:r}),!(e!=null&&e.hideBubble)&&o.jsx(Vs,{bubbleMenu:e==null?void 0:e.bubbleMenu,disabled:e==null?void 0:e.disabled,editor:c})]})})})}),o.jsx(Pa,{})]}):o.jsx(o.Fragment,{})}const La=g.forwardRef(ka);exports.BubbleMenu=s.BubbleMenu;exports.default=La;exports.useEditorState=pn;
|
package/lib/index.d.cts
CHANGED
|
@@ -293,25 +293,19 @@ declare module '@tiptap/core' {
|
|
|
293
293
|
|
|
294
294
|
declare module '@tiptap/core' {
|
|
295
295
|
interface Commands<ReturnType> {
|
|
296
|
-
|
|
296
|
+
imageUpload: {
|
|
297
297
|
/**
|
|
298
|
-
*
|
|
298
|
+
* Add an image
|
|
299
299
|
*/
|
|
300
|
-
|
|
300
|
+
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
301
301
|
/**
|
|
302
|
-
*
|
|
302
|
+
* Update an image
|
|
303
303
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
declare module '@tiptap/core' {
|
|
311
|
-
interface Commands<ReturnType> {
|
|
312
|
-
tableCellBackground: {
|
|
313
|
-
setTableCellBackground: (color: string) => ReturnType;
|
|
314
|
-
unsetTableCellBackground: () => ReturnType;
|
|
304
|
+
updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
305
|
+
/**
|
|
306
|
+
* Set image alignment
|
|
307
|
+
*/
|
|
308
|
+
setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
315
309
|
};
|
|
316
310
|
}
|
|
317
311
|
}
|
|
@@ -319,11 +313,13 @@ declare module '@tiptap/core' {
|
|
|
319
313
|
|
|
320
314
|
declare module '@tiptap/core' {
|
|
321
315
|
interface Commands<ReturnType> {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
emoji: string;
|
|
316
|
+
columns: {
|
|
317
|
+
insertColumns: (attrs?: {
|
|
318
|
+
cols: number;
|
|
326
319
|
}) => ReturnType;
|
|
320
|
+
addColBefore: () => ReturnType;
|
|
321
|
+
addColAfter: () => ReturnType;
|
|
322
|
+
deleteCol: () => ReturnType;
|
|
327
323
|
};
|
|
328
324
|
}
|
|
329
325
|
}
|
|
@@ -331,8 +327,9 @@ declare module '@tiptap/core' {
|
|
|
331
327
|
|
|
332
328
|
declare module '@tiptap/core' {
|
|
333
329
|
interface Commands<ReturnType> {
|
|
334
|
-
|
|
335
|
-
|
|
330
|
+
lineHeight: {
|
|
331
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
332
|
+
unsetLineHeight: () => ReturnType;
|
|
336
333
|
};
|
|
337
334
|
}
|
|
338
335
|
}
|
|
@@ -340,19 +337,15 @@ declare module '@tiptap/core' {
|
|
|
340
337
|
|
|
341
338
|
declare module '@tiptap/core' {
|
|
342
339
|
interface Commands<ReturnType> {
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Add an image
|
|
346
|
-
*/
|
|
347
|
-
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
340
|
+
indent: {
|
|
348
341
|
/**
|
|
349
|
-
*
|
|
342
|
+
* Set the indent attribute
|
|
350
343
|
*/
|
|
351
|
-
|
|
344
|
+
indent: () => ReturnType;
|
|
352
345
|
/**
|
|
353
|
-
* Set
|
|
346
|
+
* Set the outdent attribute
|
|
354
347
|
*/
|
|
355
|
-
|
|
348
|
+
outdent: () => ReturnType;
|
|
356
349
|
};
|
|
357
350
|
}
|
|
358
351
|
}
|
|
@@ -360,8 +353,9 @@ declare module '@tiptap/core' {
|
|
|
360
353
|
|
|
361
354
|
declare module '@tiptap/core' {
|
|
362
355
|
interface Commands<ReturnType> {
|
|
363
|
-
|
|
364
|
-
|
|
356
|
+
tableCellBackground: {
|
|
357
|
+
setTableCellBackground: (color: string) => ReturnType;
|
|
358
|
+
unsetTableCellBackground: () => ReturnType;
|
|
365
359
|
};
|
|
366
360
|
}
|
|
367
361
|
}
|
|
@@ -369,14 +363,8 @@ declare module '@tiptap/core' {
|
|
|
369
363
|
|
|
370
364
|
declare module '@tiptap/core' {
|
|
371
365
|
interface Commands<ReturnType> {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
375
|
-
replace: () => ReturnType;
|
|
376
|
-
replaceAll: () => ReturnType;
|
|
377
|
-
goToPrevSearchResult: () => void;
|
|
378
|
-
goToNextSearchResult: () => void;
|
|
379
|
-
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
366
|
+
painter: {
|
|
367
|
+
setPainter: (marks: Mark[]) => ReturnType;
|
|
380
368
|
};
|
|
381
369
|
}
|
|
382
370
|
}
|
|
@@ -399,13 +387,8 @@ declare module '@tiptap/core' {
|
|
|
399
387
|
|
|
400
388
|
declare module '@tiptap/core' {
|
|
401
389
|
interface Commands<ReturnType> {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
cols: number;
|
|
405
|
-
}) => ReturnType;
|
|
406
|
-
addColBefore: () => ReturnType;
|
|
407
|
-
addColAfter: () => ReturnType;
|
|
408
|
-
deleteCol: () => ReturnType;
|
|
390
|
+
exportWord: {
|
|
391
|
+
exportToWord: () => ReturnType;
|
|
409
392
|
};
|
|
410
393
|
}
|
|
411
394
|
}
|
|
@@ -413,9 +396,11 @@ declare module '@tiptap/core' {
|
|
|
413
396
|
|
|
414
397
|
declare module '@tiptap/core' {
|
|
415
398
|
interface Commands<ReturnType> {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
399
|
+
emoji: {
|
|
400
|
+
setEmoji: (emoji: {
|
|
401
|
+
name: string;
|
|
402
|
+
emoji: string;
|
|
403
|
+
}) => ReturnType;
|
|
419
404
|
};
|
|
420
405
|
}
|
|
421
406
|
}
|
|
@@ -423,8 +408,14 @@ declare module '@tiptap/core' {
|
|
|
423
408
|
|
|
424
409
|
declare module '@tiptap/core' {
|
|
425
410
|
interface Commands<ReturnType> {
|
|
426
|
-
|
|
427
|
-
|
|
411
|
+
search: {
|
|
412
|
+
setSearchTerm: (searchTerm: string) => ReturnType;
|
|
413
|
+
setReplaceTerm: (replaceTerm: string) => ReturnType;
|
|
414
|
+
replace: () => ReturnType;
|
|
415
|
+
replaceAll: () => ReturnType;
|
|
416
|
+
goToPrevSearchResult: () => void;
|
|
417
|
+
goToNextSearchResult: () => void;
|
|
418
|
+
setCaseSensitive: (caseSensitive: boolean) => ReturnType;
|
|
428
419
|
};
|
|
429
420
|
}
|
|
430
421
|
}
|
|
@@ -432,8 +423,8 @@ declare module '@tiptap/core' {
|
|
|
432
423
|
|
|
433
424
|
declare module '@tiptap/core' {
|
|
434
425
|
interface Commands<ReturnType> {
|
|
435
|
-
|
|
436
|
-
|
|
426
|
+
katex: {
|
|
427
|
+
setKatex: (arg?: IKatexAttrs) => ReturnType;
|
|
437
428
|
};
|
|
438
429
|
}
|
|
439
430
|
}
|
|
@@ -449,26 +440,6 @@ declare module '@tiptap/core' {
|
|
|
449
440
|
}
|
|
450
441
|
|
|
451
442
|
|
|
452
|
-
declare module '@tiptap/core' {
|
|
453
|
-
interface Commands<ReturnType> {
|
|
454
|
-
imageGifUpload: {
|
|
455
|
-
/**
|
|
456
|
-
* Add an image gif
|
|
457
|
-
*/
|
|
458
|
-
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
459
|
-
/**
|
|
460
|
-
* Update an image gif
|
|
461
|
-
*/
|
|
462
|
-
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
463
|
-
/**
|
|
464
|
-
* Set image alignment
|
|
465
|
-
*/
|
|
466
|
-
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
|
|
472
443
|
declare module '@tiptap/core' {
|
|
473
444
|
interface Commands<ReturnType> {
|
|
474
445
|
attachment: {
|
|
@@ -480,9 +451,9 @@ declare module '@tiptap/core' {
|
|
|
480
451
|
|
|
481
452
|
declare module '@tiptap/core' {
|
|
482
453
|
interface Commands<ReturnType> {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
454
|
+
drawer: {
|
|
455
|
+
setDrawer: (options: any, replace?: any) => ReturnType;
|
|
456
|
+
setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
486
457
|
};
|
|
487
458
|
}
|
|
488
459
|
}
|
|
@@ -490,9 +461,19 @@ declare module '@tiptap/core' {
|
|
|
490
461
|
|
|
491
462
|
declare module '@tiptap/core' {
|
|
492
463
|
interface Commands<ReturnType> {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
464
|
+
imageGifUpload: {
|
|
465
|
+
/**
|
|
466
|
+
* Add an image gif
|
|
467
|
+
*/
|
|
468
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
469
|
+
/**
|
|
470
|
+
* Update an image gif
|
|
471
|
+
*/
|
|
472
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
473
|
+
/**
|
|
474
|
+
* Set image alignment
|
|
475
|
+
*/
|
|
476
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
496
477
|
};
|
|
497
478
|
}
|
|
498
479
|
}
|
|
@@ -511,3 +492,13 @@ declare module '@tiptap/core' {
|
|
|
511
492
|
};
|
|
512
493
|
}
|
|
513
494
|
}
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
declare module '@tiptap/core' {
|
|
498
|
+
interface Commands<ReturnType> {
|
|
499
|
+
mermaid: {
|
|
500
|
+
setMermaid: (options: any, replace?: any) => ReturnType;
|
|
501
|
+
setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}
|