reactjs-tiptap-editor-pro 0.2.32 → 0.2.33

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/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 hn=Object.defineProperty;var gn=(e,t,n)=>t in e?hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Y=(e,t,n)=>gn(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"),i=require("./ColorPicker-ZncOwjAP.cjs"),A=require("./locale-bundle-DiqW5jwb.cjs"),pn=require("@radix-ui/react-toast"),Q=require("lucide-react"),ze=require("easydrawer"),xn=require("katex"),Fe=require("mermaid"),wt=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 U=yt(g),R=yt(pn);function vn(){var a;const e=g.useRef({editor:null}),[t,n]=g.useState(!1),[r,s]=g.useState(null);return g.useEffect(()=>{var l;(l=e.current)!=null&&l.editor&&(n(!0),s(e.current.editor))},[e,(a=e.current)==null?void 0:a.editor]),{isReady:t,editor:r,editorRef:e}}function bt(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var B=Array.isArray,He=i.Symbol?i.Symbol.prototype:void 0,Ge=He?He.toString:void 0;function ee(e){if(typeof e=="string")return e;if(B(e))return bt(e,ee)+"";if(i.isSymbol(e))return Ge?Ge.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var wn=1/0,yn=17976931348623157e292;function bn(e){if(!e)return e===0?e:0;if(e=i.toNumber(e),e===wn||e===-1/0){var t=e<0?-1:1;return t*yn}return e===e?e:0}function jn(e){var t=bn(e),n=t%1;return t===t?n?t-n:t:0}function je(e){return e}var An="[object AsyncFunction]",Cn="[object Function]",Sn="[object GeneratorFunction]",Tn="[object Proxy]";function jt(e){if(!i.isObject(e))return!1;var t=i.baseGetTag(e);return t==Cn||t==Sn||t==An||t==Tn}var ae=i.root["__core-js_shared__"],Ue=function(){var e=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function En(e){return!!Ue&&Ue in e}var Pn=Function.prototype,In=Pn.toString;function H(e){if(e!=null){try{return In.call(e)}catch{}try{return e+""}catch{}}return""}var _n=/[\\^$.*+?()[\]{}|]/g,On=/^\[object .+?Constructor\]$/,Nn=Function.prototype,Rn=Object.prototype,$n=Nn.toString,Bn=Rn.hasOwnProperty,Mn=RegExp("^"+$n.call(Bn).replace(_n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dn(e){if(!i.isObject(e)||En(e))return!1;var t=jt(e)?Mn:On;return t.test(H(e))}function kn(e,t){return e==null?void 0:e[t]}function G(e,t){var n=kn(e,t);return Dn(n)?n:void 0}var de=G(i.root,"WeakMap");function Ln(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 zn=800,Fn=16,Hn=Date.now;function Gn(e){var t=0,n=0;return function(){var r=Hn(),s=Fn-(r-n);if(n=r,s>0){if(++t>=zn)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Un(e){return function(){return e}}var We=function(){try{var e=G(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Wn=We?function(e,t){return We(e,"toString",{configurable:!0,enumerable:!1,value:Un(t),writable:!0})}:je,Kn=Gn(Wn);function Vn(e,t,n,r){for(var s=e.length,a=n+-1;++a<s;)if(t(e[a],a,e))return a;return-1}function qn(e){return e!==e}function Xn(e,t,n){for(var r=n-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}function Yn(e,t,n){return t===t?Xn(e,t,n):Vn(e,qn,n)}function Zn(e,t){var n=e==null?0:e.length;return!!n&&Yn(e,t,0)>-1}var Jn=9007199254740991,Qn=/^(?:0|[1-9]\d*)$/;function At(e,t){var n=typeof e;return t=t??Jn,!!t&&(n=="number"||n!="symbol"&&Qn.test(e))&&e>-1&&e%1==0&&e<t}function Ct(e,t){return e===t||e!==e&&t!==t}var Ke=Math.max;function er(e,t,n){return t=Ke(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,a=Ke(r.length-t,0),l=Array(a);++s<a;)l[s]=r[t+s];s=-1;for(var u=Array(t+1);++s<t;)u[s]=r[s];return u[t]=n(l),Ln(e,this,u)}}function tr(e,t){return Kn(er(e,t,je),e+"")}var nr=9007199254740991;function Ae(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=nr}function St(e){return e!=null&&Ae(e.length)&&!jt(e)}var rr=Object.prototype;function or(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||rr;return e===n}function ir(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var sr="[object Arguments]";function Ve(e){return i.isObjectLike(e)&&i.baseGetTag(e)==sr}var Tt=Object.prototype,ar=Tt.hasOwnProperty,lr=Tt.propertyIsEnumerable,Ce=Ve(function(){return arguments}())?Ve:function(e){return i.isObjectLike(e)&&ar.call(e,"callee")&&!lr.call(e,"callee")};function cr(){return!1}var Et=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qe=Et&&typeof module=="object"&&module&&!module.nodeType&&module,ur=qe&&qe.exports===Et,Xe=ur?i.root.Buffer:void 0,dr=Xe?Xe.isBuffer:void 0,fe=dr||cr,fr="[object Arguments]",mr="[object Array]",hr="[object Boolean]",gr="[object Date]",pr="[object Error]",xr="[object Function]",vr="[object Map]",wr="[object Number]",yr="[object Object]",br="[object RegExp]",jr="[object Set]",Ar="[object String]",Cr="[object WeakMap]",Sr="[object ArrayBuffer]",Tr="[object DataView]",Er="[object Float32Array]",Pr="[object Float64Array]",Ir="[object Int8Array]",_r="[object Int16Array]",Or="[object Int32Array]",Nr="[object Uint8Array]",Rr="[object Uint8ClampedArray]",$r="[object Uint16Array]",Br="[object Uint32Array]",_={};_[Er]=_[Pr]=_[Ir]=_[_r]=_[Or]=_[Nr]=_[Rr]=_[$r]=_[Br]=!0;_[fr]=_[mr]=_[Sr]=_[hr]=_[Tr]=_[gr]=_[pr]=_[xr]=_[vr]=_[wr]=_[yr]=_[br]=_[jr]=_[Ar]=_[Cr]=!1;function Mr(e){return i.isObjectLike(e)&&Ae(e.length)&&!!_[i.baseGetTag(e)]}function Se(e){return function(t){return e(t)}}var Pt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,K=Pt&&typeof module=="object"&&module&&!module.nodeType&&module,Dr=K&&K.exports===Pt,le=Dr&&i.freeGlobal.process,te=function(){try{var e=K&&K.require&&K.require("util").types;return e||le&&le.binding&&le.binding("util")}catch{}}(),Ye=te&&te.isTypedArray,It=Ye?Se(Ye):Mr,kr=Object.prototype,Lr=kr.hasOwnProperty;function zr(e,t){var n=B(e),r=!n&&Ce(e),s=!n&&!r&&fe(e),a=!n&&!r&&!s&&It(e),l=n||r||s||a,u=l?ir(e.length,String):[],c=u.length;for(var d in e)Lr.call(e,d)&&!(l&&(d=="length"||s&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||At(d,c)))&&u.push(d);return u}function Fr(e,t){return function(n){return e(t(n))}}var Hr=Fr(Object.keys,Object),Gr=Object.prototype,Ur=Gr.hasOwnProperty;function Wr(e){if(!or(e))return Hr(e);var t=[];for(var n in Object(e))Ur.call(e,n)&&n!="constructor"&&t.push(n);return t}function _t(e){return St(e)?zr(e):Wr(e)}var Kr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vr=/^\w*$/;function Te(e,t){if(B(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||i.isSymbol(e)?!0:Vr.test(e)||!Kr.test(e)||t!=null&&e in Object(t)}var V=G(Object,"create");function qr(){this.__data__=V?V(null):{},this.size=0}function Xr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Yr="__lodash_hash_undefined__",Zr=Object.prototype,Jr=Zr.hasOwnProperty;function Qr(e){var t=this.__data__;if(V){var n=t[e];return n===Yr?void 0:n}return Jr.call(t,e)?t[e]:void 0}var eo=Object.prototype,to=eo.hasOwnProperty;function no(e){var t=this.__data__;return V?t[e]!==void 0:to.call(t,e)}var ro="__lodash_hash_undefined__";function oo(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=V&&t===void 0?ro:t,this}function F(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])}}F.prototype.clear=qr;F.prototype.delete=Xr;F.prototype.get=Qr;F.prototype.has=no;F.prototype.set=oo;function io(){this.__data__=[],this.size=0}function ne(e,t){for(var n=e.length;n--;)if(Ct(e[n][0],t))return n;return-1}var so=Array.prototype,ao=so.splice;function lo(e){var t=this.__data__,n=ne(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():ao.call(t,n,1),--this.size,!0}function co(e){var t=this.__data__,n=ne(t,e);return n<0?void 0:t[n][1]}function uo(e){return ne(this.__data__,e)>-1}function fo(e,t){var n=this.__data__,r=ne(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=io;D.prototype.delete=lo;D.prototype.get=co;D.prototype.has=uo;D.prototype.set=fo;var q=G(i.root,"Map");function mo(){this.size=0,this.__data__={hash:new F,map:new(q||D),string:new F}}function ho(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function re(e,t){var n=e.__data__;return ho(t)?n[typeof t=="string"?"string":"hash"]:n.map}function go(e){var t=re(this,e).delete(e);return this.size-=t?1:0,t}function po(e){return re(this,e).get(e)}function xo(e){return re(this,e).has(e)}function vo(e,t){var n=re(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=mo;k.prototype.delete=go;k.prototype.get=po;k.prototype.has=xo;k.prototype.set=vo;var wo="Expected a function";function Ee(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(wo);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=n.cache;if(a.has(s))return a.get(s);var l=e.apply(this,r);return n.cache=a.set(s,l)||a,l};return n.cache=new(Ee.Cache||k),n}Ee.Cache=k;var yo=500;function bo(e){var t=Ee(e,function(r){return n.size===yo&&n.clear(),r}),n=t.cache;return t}var jo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ao=/\\(\\)?/g,Co=bo(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(jo,function(n,r,s,a){t.push(s?a.replace(Ao,"$1"):r||n)}),t});function me(e){return e==null?"":ee(e)}function Ot(e,t){return B(e)?e:Te(e,t)?[e]:Co(me(e))}function oe(e){if(typeof e=="string"||i.isSymbol(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Nt(e,t){t=Ot(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[oe(t[n++])];return n&&n==r?e:void 0}function So(e,t,n){var r=e==null?void 0:Nt(e,t);return r===void 0?n:r}function Rt(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}var Ze=i.Symbol?i.Symbol.isConcatSpreadable:void 0;function To(e){return B(e)||Ce(e)||!!(Ze&&e&&e[Ze])}function Eo(e,t,n,r,s){var a=-1,l=e.length;for(n||(n=To),s||(s=[]);++a<l;){var u=e[a];n(u)&&Rt(s,u)}return s}function Po(e,t,n){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(s);++r<s;)a[r]=e[r+t];return a}function Io(e,t,n){var r=e.length;return n=n===void 0?r:n,n>=r?e:Po(e,t,n)}var _o="\\ud800-\\udfff",Oo="\\u0300-\\u036f",No="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",$o=Oo+No+Ro,Bo="\\ufe0e\\ufe0f",Mo="\\u200d",Do=RegExp("["+Mo+_o+$o+Bo+"]");function Pe(e){return Do.test(e)}function ko(e){return e.split("")}var $t="\\ud800-\\udfff",Lo="\\u0300-\\u036f",zo="\\ufe20-\\ufe2f",Fo="\\u20d0-\\u20ff",Ho=Lo+zo+Fo,Go="\\ufe0e\\ufe0f",Uo="["+$t+"]",he="["+Ho+"]",ge="\\ud83c[\\udffb-\\udfff]",Wo="(?:"+he+"|"+ge+")",Bt="[^"+$t+"]",Mt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ko="\\u200d",kt=Wo+"?",Lt="["+Go+"]?",Vo="(?:"+Ko+"(?:"+[Bt,Mt,Dt].join("|")+")"+Lt+kt+")*",qo=Lt+kt+Vo,Xo="(?:"+[Bt+he+"?",he,Mt,Dt,Uo].join("|")+")",Yo=RegExp(ge+"(?="+ge+")|"+Xo+qo,"g");function Zo(e){return e.match(Yo)||[]}function Jo(e){return Pe(e)?Zo(e):ko(e)}function Qo(){this.__data__=new D,this.size=0}function ei(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ti(e){return this.__data__.get(e)}function ni(e){return this.__data__.has(e)}var ri=200;function oi(e,t){var n=this.__data__;if(n instanceof D){var r=n.__data__;if(!q||r.length<ri-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=Qo;M.prototype.delete=ei;M.prototype.get=ti;M.prototype.has=ni;M.prototype.set=oi;function ii(e,t){for(var n=-1,r=e==null?0:e.length,s=0,a=[];++n<r;){var l=e[n];t(l,n,e)&&(a[s++]=l)}return a}function si(){return[]}var ai=Object.prototype,li=ai.propertyIsEnumerable,Je=Object.getOwnPropertySymbols,ci=Je?function(e){return e==null?[]:(e=Object(e),ii(Je(e),function(t){return li.call(e,t)}))}:si;function ui(e,t,n){var r=t(e);return B(e)?r:Rt(r,n(e))}function Qe(e){return ui(e,_t,ci)}var pe=G(i.root,"DataView"),xe=G(i.root,"Promise"),ve=G(i.root,"Set"),et="[object Map]",di="[object Object]",tt="[object Promise]",nt="[object Set]",rt="[object WeakMap]",ot="[object DataView]",fi=H(pe),mi=H(q),hi=H(xe),gi=H(ve),pi=H(de),L=i.baseGetTag;(pe&&L(new pe(new ArrayBuffer(1)))!=ot||q&&L(new q)!=et||xe&&L(xe.resolve())!=tt||ve&&L(new ve)!=nt||de&&L(new de)!=rt)&&(L=function(e){var t=i.baseGetTag(e),n=t==di?e.constructor:void 0,r=n?H(n):"";if(r)switch(r){case fi:return ot;case mi:return et;case hi:return tt;case gi:return nt;case pi:return rt}return t});var it=i.root.Uint8Array,xi="__lodash_hash_undefined__";function vi(e){return this.__data__.set(e,xi),this}function wi(e){return this.__data__.has(e)}function X(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new k;++t<n;)this.add(e[t])}X.prototype.add=X.prototype.push=vi;X.prototype.has=wi;function yi(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 zt(e,t){return e.has(t)}var bi=1,ji=2;function Ft(e,t,n,r,s,a){var l=n&bi,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&ji?new X:void 0;for(a.set(e,t),a.set(t,e);++f<u;){var x=e[f],w=t[f];if(r)var b=l?r(w,x,f,t,e,a):r(x,w,f,e,t,a);if(b!==void 0){if(b)continue;h=!1;break}if(p){if(!yi(t,function(S,P){if(!zt(p,P)&&(x===S||s(x,S,n,r,a)))return p.push(P)})){h=!1;break}}else if(!(x===w||s(x,w,n,r,a))){h=!1;break}}return a.delete(e),a.delete(t),h}function Ai(e){var t=-1,n=Array(e.size);return e.forEach(function(r,s){n[++t]=[s,r]}),n}function Ci(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Si=1,Ti=2,Ei="[object Boolean]",Pi="[object Date]",Ii="[object Error]",_i="[object Map]",Oi="[object Number]",Ni="[object RegExp]",Ri="[object Set]",$i="[object String]",Bi="[object Symbol]",Mi="[object ArrayBuffer]",Di="[object DataView]",st=i.Symbol?i.Symbol.prototype:void 0,ce=st?st.valueOf:void 0;function ki(e,t,n,r,s,a,l){switch(n){case Di:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Mi:return!(e.byteLength!=t.byteLength||!a(new it(e),new it(t)));case Ei:case Pi:case Oi:return Ct(+e,+t);case Ii:return e.name==t.name&&e.message==t.message;case Ni:case $i:return e==t+"";case _i:var u=Ai;case Ri:var c=r&Si;if(u||(u=Ci),e.size!=t.size&&!c)return!1;var d=l.get(e);if(d)return d==t;r|=Ti,l.set(e,t);var m=Ft(u(e),u(t),r,s,a,l);return l.delete(e),m;case Bi:if(ce)return ce.call(e)==ce.call(t)}return!1}var Li=1,zi=Object.prototype,Fi=zi.hasOwnProperty;function Hi(e,t,n,r,s,a){var l=n&Li,u=Qe(e),c=u.length,d=Qe(t),m=d.length;if(c!=m&&!l)return!1;for(var f=c;f--;){var h=u[f];if(!(l?h in t:Fi.call(t,h)))return!1}var p=a.get(e),x=a.get(t);if(p&&x)return p==t&&x==e;var w=!0;a.set(e,t),a.set(t,e);for(var b=l;++f<c;){h=u[f];var S=e[h],P=t[h];if(r)var I=l?r(P,S,h,t,e,a):r(S,P,h,e,t,a);if(!(I===void 0?S===P||s(S,P,n,r,a):I)){w=!1;break}b||(b=h=="constructor")}if(w&&!b){var j=e.constructor,v=t.constructor;j!=v&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof v=="function"&&v instanceof v)&&(w=!1)}return a.delete(e),a.delete(t),w}var Gi=1,at="[object Arguments]",lt="[object Array]",Z="[object Object]",Ui=Object.prototype,ct=Ui.hasOwnProperty;function Wi(e,t,n,r,s,a){var l=B(e),u=B(t),c=l?lt:L(e),d=u?lt:L(t);c=c==at?Z:c,d=d==at?Z:d;var m=c==Z,f=d==Z,h=c==d;if(h&&fe(e)){if(!fe(t))return!1;l=!0,m=!1}if(h&&!m)return a||(a=new M),l||It(e)?Ft(e,t,n,r,s,a):ki(e,t,c,n,r,s,a);if(!(n&Gi)){var p=m&&ct.call(e,"__wrapped__"),x=f&&ct.call(t,"__wrapped__");if(p||x){var w=p?e.value():e,b=x?t.value():t;return a||(a=new M),s(w,b,n,r,a)}}return h?(a||(a=new M),Hi(e,t,n,r,s,a)):!1}function Ie(e,t,n,r,s){return e===t?!0:e==null||t==null||!i.isObjectLike(e)&&!i.isObjectLike(t)?e!==e&&t!==t:Wi(e,t,n,r,Ie,s)}var Ki=1,Vi=2;function qi(e,t,n,r){var s=n.length,a=s;if(e==null)return!a;for(e=Object(e);s--;){var l=n[s];if(l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<a;){l=n[s];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?Ie(d,c,Ki|Vi,r,m):f))return!1}}return!0}function Ht(e){return e===e&&!i.isObject(e)}function Xi(e){for(var t=_t(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,Ht(s)]}return t}function Gt(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Yi(e){var t=Xi(e);return t.length==1&&t[0][2]?Gt(t[0][0],t[0][1]):function(n){return n===e||qi(n,e,t)}}function Zi(e,t){return e!=null&&t in Object(e)}function Ji(e,t,n){t=Ot(t,e);for(var r=-1,s=t.length,a=!1;++r<s;){var l=oe(t[r]);if(!(a=e!=null&&n(e,l)))break;e=e[l]}return a||++r!=s?a:(s=e==null?0:e.length,!!s&&Ae(s)&&At(l,s)&&(B(e)||Ce(e)))}function Qi(e,t){return e!=null&&Ji(e,t,Zi)}var es=1,ts=2;function ns(e,t){return Te(e)&&Ht(t)?Gt(oe(e),t):function(n){var r=So(n,e);return r===void 0&&r===t?Qi(n,e):Ie(t,r,es|ts)}}function Ut(e){return function(t){return t==null?void 0:t[e]}}function rs(e){return function(t){return Nt(t,e)}}function os(e){return Te(e)?Ut(oe(e)):rs(e)}function is(e){return typeof e=="function"?e:e==null?je:typeof e=="object"?B(e)?ns(e[0],e[1]):Yi(e):os(e)}function ue(e){return i.isObjectLike(e)&&St(e)}var ss=200;function as(e,t,n,r){var s=-1,a=Zn,l=!0,u=e.length,c=[],d=t.length;if(!u)return c;n&&(t=bt(t,Se(n))),t.length>=ss&&(a=zt,l=!1,t=new X(t));e:for(;++s<u;){var m=e[s],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 ls(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var cs=tr(function(e,t){var n=ls(t);return ue(n)&&(n=void 0),ue(e)?as(e,Eo(t,1,ue),is(n)):[]}),us="[object RegExp]";function ds(e){return i.isObjectLike(e)&&i.baseGetTag(e)==us}var ut=te&&te.isRegExp,fs=ut?Se(ut):ds,ms=Ut("length"),Wt="\\ud800-\\udfff",hs="\\u0300-\\u036f",gs="\\ufe20-\\ufe2f",ps="\\u20d0-\\u20ff",xs=hs+gs+ps,vs="\\ufe0e\\ufe0f",ws="["+Wt+"]",we="["+xs+"]",ye="\\ud83c[\\udffb-\\udfff]",ys="(?:"+we+"|"+ye+")",Kt="[^"+Wt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",qt="[\\ud800-\\udbff][\\udc00-\\udfff]",bs="\\u200d",Xt=ys+"?",Yt="["+vs+"]?",js="(?:"+bs+"(?:"+[Kt,Vt,qt].join("|")+")"+Yt+Xt+")*",As=Yt+Xt+js,Cs="(?:"+[Kt+we+"?",we,Vt,qt,ws].join("|")+")",dt=RegExp(ye+"(?="+ye+")|"+Cs+As,"g");function Ss(e){for(var t=dt.lastIndex=0;dt.test(e);)++t;return t}function Ts(e){return Pe(e)?Ss(e):ms(e)}var Es=30,Ps="...",Is=/\w*$/;function _s(e,t){var n=Es,r=Ps;if(i.isObject(t)){var s="separator"in t?t.separator:s;n="length"in t?jn(t.length):n,r="omission"in t?ee(t.omission):r}e=me(e);var a=e.length;if(Pe(e)){var l=Jo(e);a=l.length}if(n>=a)return e;var u=n-Ts(r);if(u<1)return r;var c=l?Io(l,0,u).join(""):e.slice(0,u);if(s===void 0)return c+r;if(l&&(u+=c.length-u),fs(s)){if(e.slice(u).search(s)){var d,m=c;for(s.global||(s=RegExp(s.source,me(Is.exec(s))+"g")),s.lastIndex=0;d=s.exec(m);)var f=d.index;c=c.slice(0,f===void 0?u:f)}}else if(e.indexOf(ee(s),u)!=u){var h=c.lastIndexOf(s);h>-1&&(c=c.slice(0,h))}return c+r}const Os=R.Provider,Zt=U.forwardRef(({className:e,...t},n)=>o.jsx(R.Viewport,{ref:n,className:i.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}));Zt.displayName=R.Viewport.displayName;const Ns=i.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"}}),Jt=U.forwardRef(({className:e,variant:t,...n},r)=>o.jsx(R.Root,{ref:r,className:i.cn(Ns({variant:t}),e),...n}));Jt.displayName=R.Root.displayName;const Rs=U.forwardRef(({className:e,...t},n)=>o.jsx(R.Action,{ref:n,className:i.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}));Rs.displayName=R.Action.displayName;const Qt=U.forwardRef(({className:e,...t},n)=>o.jsx(R.Close,{ref:n,className:i.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(Q.X,{className:"h-4 w-4"})}));Qt.displayName=R.Close.displayName;const en=U.forwardRef(({className:e,...t},n)=>o.jsx(R.Title,{ref:n,className:i.cn("text-sm font-semibold",e),...t}));en.displayName=R.Title.displayName;const tn=U.forwardRef(({className:e,...t},n)=>o.jsx(R.Description,{ref:n,className:i.cn("text-sm opacity-90",e),...t}));tn.displayName=R.Description.displayName;let W=!1;function $s({editor:e,attrs:t,extension:n}){const[r,s]=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 y=document.querySelector("#easydrawer");y&&(a.current=new ze.Editor(y,{wheelEventsEnabled:!1,disableZoom:!0}),l.current=ze.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(),y=C.outerHTML,E=`drawer-${i.shortId()}.svg`;let O=i.i(C.outerHTML);if(d){const N=i.dataURLtoFile(O,E);O=await d(N)}e==null||e.chain().focus().setDrawer({type:"drawer",src:O,alt:encodeURIComponent(y),width:426,height:212},!!y).run(),e==null||e.commands.setAlignImageDrawer(c)}s(!1)},h=C=>{const y=a.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");y&&E&&(y.setColor(C),E.serializeState())},p=C=>{const y=a.current.toolController.getPrimaryTools()[2],E=l.current.getWidgetById("pen-1");y&&E&&(y.setThickness(C),E.serializeState())},x=C=>{const y=a.current.toolController.getPrimaryTools()[3],E=l.current.getWidgetById("pen-2");y&&E&&(y.setColor(C),E.serializeState())},w=C=>{const y=l.current.getWidgetById("shape");y&&y.setShapeType(C)},b=C=>{const y=a.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");y&&E&&(y.setColor(C),E.serializeState())},S=C=>{const y=a.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");y&&E&&(y.setThickness(C),E.serializeState())},P=C=>{const y=a.current.toolController.getPrimaryTools()[5],E=l.current.getWidgetById("shape");y&&E&&(y.setBorderColor(C),E.serializeState())},I=()=>{if(W){for(;a.current.history.redoStackSize>0;)a.current.history.redo();W=!1;return}a.current.history.undo()},j=()=>{W||a.current.history.redo()},v=()=>{if(!W){for(;a.current.history.undoStackSize>0;)I();W=!0}};return o.jsxs(i.Dialog,{onOpenChange:s,open:r,children:[o.jsx(i.DialogTrigger,{asChild:!0,children:o.jsx(i.ActionButton,{action:()=>s(!0),icon:"Pencil",tooltip:"Edit Drawer"})}),o.jsxs(i.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(i.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(i.ControlDrawer,{changeBorderColorShape:P,changeColorShape:b,changeShape:w,onClear:v,onRedo:j,onThicknessChange:S,onUndo:I,refEditor:a,setColorHighlight:x,setColorPen:h,setThicknessPen:p})]}),o.jsx(i.DialogFooter,{children:o.jsx(i.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})}function nn(e,t){const[n,r]=g.useState(void 0);return g.useEffect(()=>{const s=()=>{const a=e.extensionManager.extensions.find(l=>l.name===t);a&&r(a)};return e.on("selectionUpdate",s),e.on("transaction",s),()=>{e.off("selectionUpdate",s),e.off("transaction",s)}},[e,t]),n}const Bs={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Ms({item:e,disabled:t,editor:n}){var s;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Ds(e){return e.type.name==="drawer"}function ks(e){const{lang:t}=A.useLocale(),n=i.useAttributes(e.editor,i.Drawer.name),r=nn(e.editor,i.Drawer.name),s=({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(Ds(f))return m=!0,!1}),m},a=g.useMemo(()=>e.disabled?[]:la(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(i.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:s,tippyOptions:Bs,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($s,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-drawer-${u}`):o.jsx(Ms,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-drawer-${u}`))})}):o.jsx(o.Fragment,{})})})}const Ls={padding:"0 12px 12px"},rn=({width:e,maxWidth:t,height:n,onOk:r,children:s})=>{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(i.Popover,{modal:!0,children:[o.jsx(i.PopoverTrigger,{asChild:!0,children:s}),o.jsx(i.PopoverContent,{children:o.jsx("div",{style:Ls,children:o.jsxs("form",{className:"flex flex-col gap-2",onSubmit:c,children:[o.jsx(i.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(i.Input,{type:"number",value:l.width,required:!0,onChange:d=>u({...l,width:d.target.value})})})}),o.jsx(i.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(i.Input,{type:"number",value:l.maxWidth,required:!0,onChange:d=>u({...l,maxWidth:d.target.value})})})}),o.jsx(i.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(i.Input,{type:"number",value:l.height,required:!0,onChange:d=>u({...l,height:d.target.value})})})}),o.jsx(i.Button,{type:"submit",className:"self-end mt-2",children:a("editor.link.dialog.button.apply")})]})})})]})},z=new Map;function zs(e){const t=e.options.element;z.has("width")||z.set("width",t.clientWidth),z.has("width")&&z.get("width")<=0&&z.set("width",t.clientWidth);const n={attributes:!0,childList:!0,subtree:!0},r=function(){z.set("width",t.clientWidth)},s=new MutationObserver(r);return s.observe(t,n),e.on("destroy",()=>{s.disconnect()}),{width:z.get("width")}}function Fs({editor:e}){const{t}=A.useLocale(),{width:n}=zs(e),r=i.useAttributes(e,i.Excalidraw.name,{defaultShowPicker:!1,createUser:"",width:0,height:0}),{defaultShowPicker:s,createUser:a,width:l,height:u}=r,c=g.useCallback(h=>{e.chain().updateAttributes(i.Excalidraw.name,h).setNodeSelection(e.state.selection.from).focus().run()},[e]),d=g.useCallback(()=>{i.triggerOpenExcalidrawSettingModal(r)},[e,r]),m=g.useCallback(()=>e.isActive(i.Excalidraw.name),[e]),f=g.useCallback(()=>i.deleteNode(i.Excalidraw.name,e),[e]);return g.useEffect(()=>{s&&(d(),e.chain().updateAttributes(i.Excalidraw.name,{defaultShowPicker:!1}).focus().run())},[a,s,e,d]),o.jsx(i.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"excalidraw-bubble-menu",shouldShow:m,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(i.ActionButton,{icon:"Pencil",action:d,tooltip:t("editor.edit")}),o.jsx(rn,{width:l,maxWidth:n,height:u,onOk:c,children:o.jsx(i.ActionButton,{icon:"Settings",tooltip:t("editor.settings")})}),o.jsx(i.ActionButton,{icon:"Trash2",action:f,tooltip:t("editor.delete")})]})})}function Hs({editor:e}){const{t}=A.useLocale(),{width:n,height:r,url:s}=i.useAttributes(e,i.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(s)},[a,s]);const m=g.useCallback(()=>{e.chain().updateAttributes(i.Iframe.name,{url:u}).setNodeSelection(e.state.selection.from).focus().run(),l(!1)},[e,u,l]),f=g.useCallback(()=>{window.open(s,"_blank")},[s]),h=g.useCallback(()=>{l(!0)},[l]),p=g.useCallback(b=>{e.chain().updateAttributes(i.Iframe.name,b).setNodeSelection(e.state.selection.from).focus().run()},[e]),x=g.useCallback(()=>e.isActive(i.Iframe.name)&&!s,[e,s]),w=g.useCallback(()=>i.deleteNode(i.Iframe.name,e),[e]);return o.jsxs(o.Fragment,{children:[o.jsx(i.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(i.ActionButton,{action:f,icon:"Eye",tooltip:"Visit Link"}),o.jsx(i.ActionButton,{action:h,icon:"Pencil",tooltip:"Open Edit Link"}),o.jsx(rn,{width:n,height:r,onOk:p,children:o.jsx(i.ActionButton,{icon:"Settings",tooltip:t("editor.settings")})}),o.jsx(i.ActionButton,{action:w,icon:"Trash2",tooltip:t("editor.delete")})]})}),o.jsxs(i.Dialog,{open:a,onOpenChange:l,children:[o.jsx(i.DialogTrigger,{}),o.jsxs(i.DialogContent,{children:[o.jsx(i.DialogHeader,{children:o.jsx(i.DialogTitle,{children:"Edit Link Iframe"})}),o.jsx(i.Input,{value:u,onInput:b=>c(b.target.value),type:"url",autoFocus:!0,placeholder:"Enter link"}),o.jsxs(i.DialogFooter,{children:[o.jsx(i.Button,{onClick:d,children:"Cancel"}),o.jsx(i.Button,{onClick:m,children:"OK"})]})]})]})]})}function Gs({editor:e,...t}){const n=i.useAttributes(e,i.Katex.name,{text:"",defaultShowPicker:!1}),{text:r,defaultShowPicker:s}=n,[a,l]=g.useState(""),[u,c]=g.useState(!1),d=g.useCallback(()=>e.isActive(i.Katex.name),[e]),m=g.useCallback(()=>i.deleteNode(i.Katex.name,e),[e]),f=g.useCallback(()=>{e.chain().focus().setKatex({text:a}).run(),c(!1)},[e,a]);g.useEffect(()=>{s&&(c(!0),e.chain().updateAttributes(i.Katex.name,{defaultShowPicker:!1}).focus().run())},[e,s,c]),g.useEffect(()=>{u&&l(r||"")},[u]);const h=g.useMemo(()=>{try{return xn.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(i.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(i.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(i.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(Q.HelpCircle,{size:16})})]})]}):o.jsxs("div",{className:"flex items-center justify-center gap-[6px]",children:[o.jsx(i.ActionButton,{tooltip:"Edit",action:()=>c(!u),children:o.jsx(Q.Pencil,{size:16})}),o.jsx(i.ActionButton,{tooltip:"Delete",action:m,children:o.jsx(Q.Trash2,{size:16})})]})})})}const ft=`graph TB
2
+ a-->b`,Us=({editor:e,attrs:t,extension:n})=>{const{alt:r,align:s}=t,[a,l]=g.useState(decodeURIComponent(r??ft)),[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:S}=await Fe.render("mermaid-svg",b);c(S)}catch{c("")}},x=()=>{Fe.initialize({darkMode:!1,startOnLoad:!1,fontSize:12,theme:"base"}),p(a)};g.useEffect(()=>{d&&x()},[d]),g.useEffect(()=>{d&&p(a)},[a]);const w=async()=>{if(a!==""){if(a){const b=f.current.querySelector("svg"),{width:S,height:P}=b.getBoundingClientRect(),I=`mermaid-${i.shortId()}.svg`;let j=i.i(b.outerHTML);if(h){const v=i.dataURLtoFile(j,I);j=await h(v)}e==null||e.chain().focus().setMermaid({type:"mermaid",src:j,alt:encodeURIComponent(a),width:S,height:P},!!a).run(),e==null||e.commands.setAlignImageMermaid(s)}m(!1)}};return o.jsxs(i.Dialog,{onOpenChange:m,open:d,children:[o.jsx(i.DialogTrigger,{asChild:!0,children:o.jsx(i.ActionButton,{action:()=>m(!0),icon:"Pencil",tooltip:"Edit Mermaid"})}),o.jsxs(i.DialogContent,{className:"z-[99999] !max-w-[1300px]",children:[o.jsx(i.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(i.Textarea,{autoFocus:!0,className:"flex-1",defaultValue:ft,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(i.DialogFooter,{children:o.jsx(i.Button,{onClick:w,type:"button",children:"Save changes"})})]})]})},Ws={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Ks({item:e,disabled:t,editor:n}){var s;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Vs(e){return e.type.name==="mermaid"}function qs(e){const{lang:t}=A.useLocale(),n=i.useAttributes(e.editor,i.Mermaid.name),r=nn(e.editor,i.Mermaid.name),s=({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(Vs(f))return m=!0,!1}),m},a=g.useMemo(()=>e.disabled?[]:aa(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(i.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:s,tippyOptions:Ws,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(Us,{attrs:n,editor:e.editor,extension:r},`bubbleMenu-mermaid-${u}`):o.jsx(Ks,{disabled:e.disabled,editor:e.editor,item:l},`bubbleMenu-mermaid-${u}`))})}):o.jsx(o.Fragment,{})})})}function Xs({editor:e,disabled:t}){const[n,r]=g.useState(!1),{t:s}=A.useLocale(),a=g.useCallback(({editor:c})=>c.isActive(i.Twitter.name),[]),l=c=>{e.commands.updateTweet({src:c}),r(!1)},u=g.useCallback(()=>i.deleteNode(i.Twitter.name,e),[e]);return o.jsx(o.Fragment,{children:o.jsx(i.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(i.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(i.ActionButton,{icon:"Pencil",tooltip:s("editor.link.edit.tooltip"),tooltipOptions:{sideOffset:15},action:()=>{r(!0)}}),o.jsx(i.ActionButton,{action:u,icon:"Trash",tooltip:s("editor.delete"),tooltipOptions:{sideOffset:15}})]})})})})})}function Ys({editor:e,disabled:t,bubbleMenu:n}){const r=e.extensionManager.extensions.map(a=>a.name),s=()=>{var a,l,u,c,d,m,f,h,p,x,w,b,S,P,I,j,v;return[r.includes("columns")&&!((a=n==null?void 0:n.columnConfig)!=null&&a.hidden)?o.jsx(Ia,{editor:e},"columns"):null,r.includes("table")&&!((l=n==null?void 0:n.tableConfig)!=null&&l.hidden)?o.jsx(ya,{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(ja,{disabled:t,editor:e},"link"):null,r.includes(i.Image.name)&&!((m=n==null?void 0:n.imageConfig)!=null&&m.hidden)?o.jsx(Ta,{disabled:t,editor:e},"image"):null,r.includes(i.ImageGif.name)&&!((f=n==null?void 0:n.imageGifConfig)!=null&&f.hidden)?o.jsx(Ea,{disabled:t,editor:e},"imageGif"):null,r.includes("video")&&!((h=n==null?void 0:n.videoConfig)!=null&&h.hidden)?o.jsx(Pa,{disabled:t,editor:e},"video"):null,r.includes("katex")&&!((p=n==null?void 0:n.katexConfig)!=null&&p.hidden)?o.jsx(Gs,{disabled:t,editor:e},"katex"):null,r.includes("excalidraw")&&!((x=n==null?void 0:n.excalidrawConfig)!=null&&x.hidden)?o.jsx(Fs,{disabled:t,editor:e},"excalidraw"):null,r.includes("mermaid")&&!((w=n==null?void 0:n.mermaidConfig)!=null&&w.hidden)?o.jsx(qs,{disabled:t,editor:e},"mermaid"):null,r.includes("iframe")&&!((b=n==null?void 0:n.iframeConfig)!=null&&b.hidden)?o.jsx(Hs,{disabled:t,editor:e},"iframe"):null,r.includes("twitter")&&!((S=n==null?void 0:n.twitterConfig)!=null&&S.hidden)?o.jsx(Xs,{disabled:t,editor:e},"twitter"):null,(P=n==null?void 0:n.floatingMenuConfig)!=null&&P.hidden?null:o.jsx(ha,{disabled:t,editor:e},"content"),(I=n==null?void 0:n.textConfig)!=null&&I.hidden?null:o.jsx(pa,{disabled:t,editor:e,items:(j=n==null?void 0:n.textConfig)==null?void 0:j.items},"text"),r.includes("drawer")&&!((v=n==null?void 0:n.drawerConfig)!=null&&v.hidden)?o.jsx(ks,{disabled:t,editor:e},"drawer"):null]};return n!=null&&n.render?n.render({editor:e,disabled:t||!1,bubbleMenu:n},s()):s().filter(Boolean)}function Zs({editor:e,disabled:t,toolbar:n}){const{t:r,lang:s}=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:w=!0}=f.options;if(!h||!i.isFunction(h)||!w)continue;const b=h({editor:e,extension:f,t:r});if(Array.isArray(b)){const S=b.map((P,I)=>({button:P,divider:I===b.length-1?p:!1,spacer:I===0?x:!1,type:f.type,name:f.name}));m=[...m,...S];continue}m.push({button:b,divider:p,spacer:x,type:f.type,name:f.name})}return m},[e,r,s]),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(i.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(i.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 Js(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,s)=>({type:`image-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[s],action:()=>e.commands.updateImage({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function Qs(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,s)=>({type:`image-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[s],action:()=>e.commands.updateImageGif({width:A.IMAGE_SIZE[r]}),isActive:()=>e.isActive("image",{width:A.IMAGE_SIZE[r]})}}))}function ea(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var s,a;return(a=(s=e.commands)==null?void 0:s.setAlignImage)==null?void 0:a.call(s,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ta(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var s,a;return(a=(s=e.commands)==null?void 0:s.setAlignImageGif)==null?void 0:a.call(s,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function na(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var s,a;return(a=(s=e.commands)==null?void 0:s.setAlignImageMermaid)==null?void 0:a.call(s,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function ra(e){const t=["left","center","right"],n={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};return t.map(r=>({type:`image-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.textalign.${r}.tooltip`),icon:n[r],action:()=>{var s,a;return(a=(s=e.commands)==null?void 0:s.setAlignImageDrawer)==null?void 0:a.call(s,r)},isActive:()=>e.isActive({align:r})||!1,disabled:!1}}))}function oa(e){const t=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return t.map((r,s)=>({type:`video-${r}`,component:i.ActionButton,componentProps:{tooltip:A.localeActions.t(`editor.${r.replace("-",".")}.tooltip`),icon:n[s],action:()=>e.commands.updateVideo({width:A.VIDEO_SIZE[r]}),isActive:()=>e.isActive("video",{width:A.VIDEO_SIZE[r]})}}))}function ia(e){return[{type:"flipX",component:i.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:i.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()}}},...Js(e),...ea(e),{type:"remove",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;i.deleteSelection(t,n)}}}]}function sa(e){return[...Qs(e),...ta(e),{type:"remove",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;i.deleteSelection(t,n)}}}]}function aa(e){return[...na(e),{type:"edit",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>!0}},{type:"remove",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;i.deleteSelection(t,n)}}}]}function la(e){return[...ra(e),{type:"edit",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.edit"),icon:"Pencil",action:()=>(console.log("AAA"),!0)}},{type:"remove",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;i.deleteSelection(t,n)}}}]}function ca(e){return[...oa(e),{type:"remove",component:i.ActionButton,componentProps:{editor:e,tooltip:A.localeActions.t("editor.remove"),icon:"Trash2",action:()=>{const{state:t,dispatch:n}=e.view;i.deleteSelection(t,n)}}}]}function on(e,t,n=A.BUBBLE_TEXT_LIST){return n.reduce((r,s)=>{if(s==="divider"&&r.length>0)return[...r,{type:"divider",component:void 0,componentProps:{}}];const a=e.extensionManager.extensions.find(l=>l.name===s);return a?[...r,a.configure().options.button({editor:e,t,extension:a})]:r},[])}function _e(e,t,n){const r=[],s=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 i.NodeRange(e,t,n),l=a.depth===0?0:s.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 i.SelectionRange(s.resolve(d),s.resolve(m));r.push(f)}),r}class Oe{constructor(t,n){Y(this,"anchor");Y(this,"head");this.anchor=t,this.head=n}map(t){return new Oe(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 i.Selection{constructor(n,r,s,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),s);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);Y(this,"depth");this.depth=s}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 s=n.resolve(r.map(this.anchor)),a=n.resolve(r.map(this.head));return new $(s,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],s=n.resolve(Math.max(0,r.$from.pos-1));return new $(this.$anchor,s,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],s=n.resolve(Math.min(n.content.size,r.$to.pos+1));return new $(this.$anchor,s,this.depth)}static fromJSON(n,r){return new $(n.resolve(r.anchor),n.resolve(r.head))}static create(n,r,s,a,l=1){return new this(n.resolve(r),n.resolve(s),a,l)}getBookmark(){return new Oe(this.anchor,this.head)}}function ua(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName("*"))],r=[t,...Array.from(t.getElementsByTagName("*"))];return n.forEach((s,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}(s)}),t}function J(e,t){return window.getComputedStyle(e)[t]}function da(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function mt(e){e.parentNode!==null&&e.parentNode!==void 0&&e.parentNode.removeChild(e)}function sn(e){const{x:t,y:n,direction:r,editor:s}=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=s.view.posAtDOM(h,0),u>=0){l=s.state.doc.nodeAt(Math.max(u-1,0)),(l===null||l.isText)&&(l=s.state.doc.nodeAt(Math.max(u-1,0))),l||(l=s.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 fa(e,t){const{doc:n}=t.view.state,r=sn({editor:t,x:e.clientX,y:e.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const s=e.clientX,a=function(m,f,h){const p=Number.parseInt(J(m.dom,"paddingLeft"),10),x=Number.parseInt(J(m.dom,"paddingRight"),10),w=Number.parseInt(J(m.dom,"borderLeftWidth"),10),b=Number.parseInt(J(m.dom,"borderLeftWidth"),10),S=m.dom.getBoundingClientRect();return{left:da(f,S.left+p+w,S.right-x-b),top:h}}(t.view,s,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 ht(e,t){const n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1}function gt(e,t){const n=e.nodeAt(t),r=e.resolve(t);let{depth:s}=r,a=n;for(;s>0;){const l=r.node(s);s-=1,s===0&&(a=l)}return a}function pt(e,t){let n=t;for(;n&&n.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n}const an=new i.PluginKey("dragHandle");function ma({pluginKey:e=an,element:t,editor:n,tippyOptions:r,onNodeChange:s}){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,w=fa(m,n),b=_e(p,x,0),S=b.some(O=>w.find(N=>N.$from===O.$from&&N.$to===O.$to)),P=h||!S?w:b;if(P.length===0)return;const{tr:I}=f.state,j=document.createElement("div"),v=P[0].$from.pos,C=P[P.length-1].$to.pos,y=$.create(f.state.doc,v,C),E=y.content();P.forEach(O=>{const N=ua(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},I.setSelection(y),f.dispatch(I),document.addEventListener("drop",()=>mt(j),{once:!0}),setTimeout(()=>{t&&(t.style.pointerEvents="none")},0)}),t.addEventListener("dragend",()=>{t&&(t.style.pointerEvents="auto")}),new i.Plugin({key:typeof e=="string"?new i.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,s==null||s({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=wt(m.dom,{...p(),...r}),{update(j,v){if(!x(t,l)||(t.draggable=!u,!w(j,v)))return;const C=b(j);C&&S(j,C)},destroy(){I()}};function f(){t.draggable=!0,t.style.pointerEvents="auto"}function h(j){var v;(v=j.parentElement)==null||v.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,v){return j&&v}function w(j,v){return!j.state.doc.eq(v.doc)&&d!==-1}function b(j){let v=j.nodeDOM(d);return v=pt(j,v),v===j.dom||(v==null?void 0:v.nodeType)!==1?null:v}function S(j,v){const C=j.posAtDOM(v,0),y=gt(n.state.doc,C);if(y===c)return;const E=ht(n.state.doc,C);c=y,d=E,s==null||s({editor:n,node:c,pos:d}),P(v)}function P(j){l.setProps({getReferenceClientRect:()=>j.getBoundingClientRect()}),l.show()}function I(){l==null||l.destroy(),t&&mt(a)}},props:{handleDOMEvents:{mouseleave:(m,f)=>{if(u||!h(f))return!1;return p(),x(),!1;function h(w){return w.target&&!a.contains(w.relatedTarget)}function p(){l==null||l.hide()}function x(){c=null,d=-1,s==null||s({editor:n,node:null,pos:-1})}},mousemove:i.debounce((m,f)=>{if(!t||!l||u)return!1;const h=sn({x:f.clientX,y:f.clientY,direction:"right",editor:n});if(!h.resultElement||h.resultElement===m.dom)return!1;const p=pt(m,h.resultElement);if(p===m.dom||(p==null?void 0:p.nodeType)!==1)return!1;const x=m.posAtDOM(p,0),w=gt(n.state.doc,x);if(w===c)return!1;const b=ht(n.state.doc,x);return c=w,d=b,s==null||s({editor:n,node:c,pos:d}),l.setProps({getReferenceClientRect:()=>p.getBoundingClientRect()}),l.show(),!1},100)}}})}function ha(e){var E,O,N;const{pluginKey:t=an}=e,{t:n}=A.useLocale(),[r,s]=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(T=>T.name==="textAlign"),h=e.editor.extensionManager.extensions.some(T=>T.name==="indent"),p=e.editor.extensionManager.extensions.some(T=>T.name==="clear");g.useEffect(()=>{u.current&&!e.editor.isDestroyed&&(c.current=ma({editor:e.editor,element:u.current,pluginKey:"ContentItemMenu",tippyOptions:{offset:[-2,16],zIndex:99,moveTransition:"transform 0.15s ease-out"},onNodeChange:v}),e.editor.registerPlugin(c.current))},[e.editor,u]);function x(){const T=e.editor.chain();T.setNodeSelection(a).unsetAllMarks(),(r==null?void 0:r.type.name)!=="paragraph"&&T.setParagraph(),T.run()}function w(){e.editor.chain().focus().setNodeSelection(a).run(),document.execCommand("copy")}function b(){e.editor.commands.setNodeSelection(a);const{$anchor:T}=e.editor.state.selection,ie=T.node(1)||e.editor.state.selection.node;e.editor.chain().setMeta("hideDragHandle",!0).insertContentAt(a+((r==null?void 0:r.nodeSize)||0),ie.toJSON()).run()}function S(T){e.editor.commands.setTextAlign(T)}function P(){const T=i.setNodeIndentMarkup(e.editor.state.tr,a,1);T.setMeta("hideDragHandle",!0),e.editor.view.dispatch&&e.editor.view.dispatch(T)}function I(){const T=i.setNodeIndentMarkup(e.editor.state.tr,a,-1);e.editor.view.dispatch&&e.editor.view.dispatch(T)}function j(){e.editor.chain().setMeta("hideDragHandle",!0).setNodeSelection(a).deleteSelection().run()}function v(T){T.node&&s(T.node),l(T.pos)}function C(){var T;if(a!==-1){const ie=(r==null?void 0:r.nodeSize)||0,Me=a+ie,De=(r==null?void 0:r.type.name)==="paragraph"&&((T=r==null?void 0:r.content)==null?void 0:T.size)===0,mn=De?a+2:Me+2;e.editor.chain().command(({dispatch:ke,tr:se,state:Le})=>ke?(De?se.insertText("/",a,a+1):se.insert(Me,Le.schema.nodes.paragraph.create(null,[Le.schema.text("/")])),ke(se)):!0).focus(mn).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 T;(T=e.editor)!=null&&T.isDestroyed&&c.current&&(e.editor.unregisterPlugin(t),c.current=null)},[(E=e.editor)==null?void 0:E.isDestroyed]);const y=T=>{e!=null&&e.disabled||m(T)};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(i.Button,{className:"!size-7 cursor-grab",disabled:e==null?void 0:e.disabled,onClick:C,size:"icon",type:"button",variant:"ghost",children:o.jsx(i.IconComponent,{className:"text-lg text-neutral-600 dark:text-neutral-200",name:"Plus"})}),o.jsxs(i.DropdownMenu,{onOpenChange:y,open:d,children:[o.jsxs("div",{className:"relative flex flex-col",children:[o.jsxs(i.Tooltip,{children:[o.jsx(i.TooltipTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:o.jsx(i.Button,{className:"relative z-[1] !size-7 cursor-grab",disabled:e==null?void 0:e.disabled,size:"icon",type:"button",variant:"ghost",onMouseUp:T=>{T.preventDefault(),!(e!=null&&e.disabled)&&m(!0)},children:o.jsx(i.IconComponent,{className:"text-sm text-neutral-600 dark:text-neutral-200",name:"Grip"})})}),o.jsx(i.TooltipContent,{children:n("editor.draghandle.tooltip")})]}),o.jsx(i.DropdownMenuTrigger,{className:"absolute left-0 top-0 z-0 size-[28px]"})]}),o.jsxs(i.DropdownMenuContent,{align:"start",className:"w-48",side:"bottom",sideOffset:0,children:[o.jsxs(i.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(i.IconComponent,{name:"Trash2"}),o.jsx("span",{children:n("editor.remove")})]}),p?o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",onClick:x,children:[o.jsx(i.IconComponent,{name:"PaintRoller"}),o.jsx("span",{children:n("editor.clear.tooltip")})]}):null,o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",onClick:w,children:[o.jsx(i.IconComponent,{name:"Clipboard"}),o.jsx("span",{children:n("editor.copyToClipboard")})]}),o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",onClick:b,children:[o.jsx(i.IconComponent,{name:"Copy"}),o.jsx("span",{children:n("editor.copy")})]}),f||h?o.jsx(i.DropdownMenuSeparator,{}):null,f?o.jsxs(i.DropdownMenuSub,{children:[o.jsxs(i.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(i.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.tooltip")})]}),o.jsx(i.DropdownMenuPortal,{children:o.jsxs(i.DropdownMenuSubContent,{children:[o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("left"),children:[o.jsx(i.IconComponent,{name:"AlignLeft"}),o.jsx("span",{children:n("editor.textalign.left.tooltip")})]}),o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("center"),children:[o.jsx(i.IconComponent,{name:"AlignCenter"}),o.jsx("span",{children:n("editor.textalign.center.tooltip")})]}),o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",onClick:()=>S("right"),children:[o.jsx(i.IconComponent,{name:"AlignRight"}),o.jsx("span",{children:n("editor.textalign.right.tooltip")})]})]})})]}):null,h?o.jsxs(i.DropdownMenuSub,{children:[o.jsxs(i.DropdownMenuSubTrigger,{className:"flex gap-3",children:[o.jsx(i.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent")})]}),o.jsx(i.DropdownMenuPortal,{children:o.jsxs(i.DropdownMenuSubContent,{children:[o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",disabled:((O=r==null?void 0:r.attrs)==null?void 0:O.indent)>=i.IndentProps.max,onClick:P,children:[o.jsx(i.IconComponent,{name:"IndentIncrease"}),o.jsx("span",{children:n("editor.indent.tooltip")})]}),o.jsxs(i.DropdownMenuItem,{className:"flex gap-3",disabled:((N=r==null?void 0:r.attrs)==null?void 0:N.indent)<=i.IndentProps.min,onClick:I,children:[o.jsx(i.IconComponent,{name:"IndentDecrease"}),o.jsx("span",{children:n("editor.outdent.tooltip")})]})]})})]}):null]})]})]})})}const ga={maxWidth:"auto",zIndex:20,moveTransition:"transform 0.1s ease-out"};function ln({item:e,disabled:t,editor:n}){var s;const r=e.component;return r?o.jsx(r,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n}):o.jsx(o.Fragment,{})}function pa(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 i.TextSelection},s=g.useMemo(()=>e.disabled||!(e!=null&&e.editor)?[]:on(e.editor,t,e.items),[e.disabled,e.editor,e.items,n,t]);return o.jsx(i.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:ga,children:s!=null&&s.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:s==null?void 0:s.map((a,l)=>(a==null?void 0:a.type)==="divider"?o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"},`bubbleMenu-divider-${l}`):o.jsx(ln,{disabled:e.disabled,editor:e.editor,item:a},`bubbleMenu-text-${l}`))})}):o.jsx(o.Fragment,{})})}function Ne({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 xa({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:w})=>!x||!w?!1:i.isRowGripSelected({editor:e,view:p,state:x,from:w}),[e]);function s(){e.chain().focus().addRowBefore().run()}function a(){e.chain().focus().addRowAfter().run()}function l(){e.chain().focus().deleteRow().run()}return t?null:o.jsx(i.BubbleMenu,{editor:e,pluginKey:"tableRowMenu",shouldShow:r,updateDelay:0,tippyOptions:{placement:"left",offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Ne,{vertical:!0,children:[o.jsx(i.ActionButton,{action:s,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(i.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(i.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 va({editor:e,disabled:t}){var u,c,d,m,f,h;const{t:n}=A.useLocale(),r=g.useCallback(({view:p,state:x,from:w})=>x?i.isColumnGripSelected({editor:e,view:p,state:x,from:w||0}):!1,[e]);function s(){e.chain().focus().addColumnBefore().run()}function a(){e.chain().focus().addColumnAfter().run()}function l(){e.chain().focus().deleteColumn().run()}return t?null:o.jsx(i.BubbleMenu,{editor:e,pluginKey:"tableColumnMenu",shouldShow:r,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]}},children:o.jsxs(Ne,{children:[o.jsx(i.ActionButton,{action:s,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(i.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(i.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 wa({editor:e,disabled:t,actions:n,...r}){var w,b,S,P,I,j;const s=({editor:v,view:C,state:y,from:E})=>{const{selection:O}=v.view.state,{$from:N,to:T}=O;return N.pos===T||!y||!E?!1:O instanceof i.TextSelection||i.isRowGripSelected({editor:v,view:C,state:y,from:E})||i.isColumnGripSelected({editor:v,view:C,state:y,from:E})},a=({editor:v})=>i.isActive(v.view.state,"table"),l=v=>a(v)&&!s(v),{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(v){e.chain().focus().setTableCellBackground(v).run()}const p=()=>{var N;const{view:v,state:{selection:{from:C}}}=e,y=v.domAtPos(C).node;if(!y)return new DOMRect(-1e3,-1e3,0,0);const E=(N=y==null?void 0:y.closest)==null?void 0:N.call(y,".tableWrapper");return E?E.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)},x=g.useMemo(()=>t||!e?[]:on(e,u,r.items||[]),[t,e,r.items,c,u]);return t?null:o.jsx(i.BubbleMenu,{editor:e,pluginKey:"table",shouldShow:l,updateDelay:0,tippyOptions:{offset:[0,15],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},maxWidth:"auto",getReferenceClientRect:p,plugins:[wt.sticky],sticky:"popper"},children:o.jsxs(Ne,{children:[n&&o.jsxs(o.Fragment,{children:[n.map((v,C)=>o.jsx(i.ActionButton,{...v},C)),o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),r.items&&o.jsxs(o.Fragment,{children:[x.map((v,C)=>o.jsx(ln,{disabled:t,editor:e,item:v},C)),o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"})]}),o.jsx(i.ActionButton,{action:d,disabled:!((b=(w=e==null?void 0:e.can())==null?void 0:w.mergeCells)!=null&&b.call(w)),icon:"TableCellsMerge",tooltip:u("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15}}),o.jsx(i.ActionButton,{action:m,disabled:!((P=(S=e==null?void 0:e.can())==null?void 0:S.splitCell)!=null&&P.call(S)),icon:"TableCellsSplit",tooltip:u("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15}}),o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}),o.jsx(i.HighlightActionButton,{action:h,editor:e,tooltip:u("editor.table.menu.setCellsBgColor"),tooltipOptions:{sideOffset:15}}),o.jsx(i.ActionButton,{action:f,disabled:!((j=(I=e==null?void 0:e.can())==null?void 0:I.deleteTable)!=null&&j.call(I)),icon:"Trash2",tooltip:u("editor.table.menu.deleteTable"),"tooltip-options":{sideOffset:15}})]})})}function ya(e){return o.jsxs(o.Fragment,{children:[o.jsx(wa,{...e}),o.jsx(xa,{...e}),o.jsx(va,{...e})]})}function ba(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:_s(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&o.jsx(i.Separator,{orientation:"vertical",className:"!h-4"}),o.jsxs("div",{className:"flex flex-nowrap",children:[o.jsx(i.ActionButton,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),o.jsx(i.ActionButton,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function ja({editor:e,disabled:t}){const[n,r]=g.useState(!1),s=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(i.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(i.LinkEditBlock,{onSetLink:l,editor:e}):o.jsx(ba,{editor:e,onClear:u,onEdit:()=>{r(!0)},link:s})})})})}const Re={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function $e({item:e,disabled:t,editor:n}){var s;const r=e.component;return r?o.jsx(g.Fragment,{children:e.type==="divider"?o.jsx(i.Separator,{className:"!mx-1 !my-2 !h-[16px]",orientation:"vertical"}):o.jsx(r,{...e.componentProps,disabled:t||((s=e==null?void 0:e.componentProps)==null?void 0:s.disabled),editor:n})}):o.jsx(o.Fragment,{})}function Aa(e){return e.type.name===i.Image.name}function Ca(e){return e.type.name===i.ImageGif.name}function Sa(e){return e.type.name===i.Video.name}function Ta(e){const{lang:t}=A.useLocale(),n=({editor:s})=>{const{selection:a}=s.view.state,{$from:l,to:u}=a;let c=!1;return s.view.state.doc.nodesBetween(l.pos,u,d=>{if(Aa(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:ia(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(i.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Re,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((s,a)=>o.jsx($e,{disabled:e.disabled,editor:e.editor,item:s},`bubbleMenu-image-${a}`))})}):o.jsx(o.Fragment,{})})})}function Ea(e){const{lang:t}=A.useLocale(),n=({editor:s})=>{const{selection:a}=s.view.state,{$from:l,to:u}=a;let c=!1;return s.view.state.doc.nodesBetween(l.pos,u,d=>{if(Ca(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:sa(e.editor),[e.disabled,e.editor,t]);return o.jsx(o.Fragment,{children:o.jsx(i.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Re,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((s,a)=>o.jsx($e,{disabled:e.disabled,editor:e.editor,item:s},`bubbleMenu-image-gif-${a}`))})}):o.jsx(o.Fragment,{})})})}function Pa(e){const{lang:t}=A.useLocale(),n=({editor:s})=>{const{selection:a}=s.view.state,{$from:l,to:u}=a;let c=!1;return s.view.state.doc.nodesBetween(l.pos,u,d=>{if(Sa(d))return c=!0,!1}),c},r=g.useMemo(()=>e.disabled?[]:ca(e.editor),[e.editor,e.disabled,t]);return o.jsx(o.Fragment,{children:o.jsx(i.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:n,tippyOptions:Re,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((s,a)=>o.jsx($e,{disabled:e.disabled,editor:e.editor,item:s},`bubbleMenu-video-${a}`))})}):o.jsx(o.Fragment,{})})})}function Ia({editor:e}){const{t}=A.useLocale(),n=g.useCallback(()=>e.isActive(i.MultiColumn.name),[e]),r=g.useCallback(()=>i.deleteNode(i.MultiColumn.name,e),[e]),s=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(i.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(i.ActionButton,{action:s,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),o.jsx(i.ActionButton,{action:a,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),o.jsx(i.ActionButton,{action:l,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),o.jsx(i.ActionButton,{action:r,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}function _a({editor:e,extensions:t}){const{t:n}=A.useLocale(),r=g.useMemo(()=>{var s,a,l;return(l=(a=(s=t==null?void 0:t.find(u=>u.name==="base-kit"))==null?void 0:s.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 Oa(){const{toasts:e}=i.useToast();return o.jsxs(Os,{children:[e.map(({id:t,title:n,description:r,action:s,...a})=>o.jsxs(Jt,{...a,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(en,{children:n}),r&&o.jsx(tn,{children:r})]}),s,o.jsx(Qt,{})]},t)),o.jsx(Zt,{})]})}const Na=`
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
+ `,Ra=g.memo(({children:e,id:t})=>{const[,n]=i.useStoreEditableEditor(l=>l.value),[,r]=i.useStoreTheme(l=>l.value),s=l=>{n({value:l.detail})},a=l=>{r({value:l.detail})};return g.useEffect(()=>{const l=i.listenEvent(i.EVENTS.EDIT(t),s),u=i.listenEvent(i.EVENTS.UPDATE_THEME(t),a);return()=>{l(),u()}},[]),o.jsx(o.Fragment,{children:e})});function $a({children:e,id:t}){return o.jsx(i.ProviderEditableEditor,{children:o.jsx(i.ProviderTheme,{children:o.jsx(Ra,{id:t,children:e})})})}const xt="data-rc-order",vt="data-rc-priority",Ba="rc-util-key",be=new Map;function Ma(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 cn({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:Ba}function Be(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Da(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function un(e){return[...(be.get(e)||e).children].filter(t=>t.tagName==="STYLE")}function dn(e,t={}){const{csp:n,prepend:r,priority:s=0}=t,a=Da(r),l=a==="prependQueue",u=document.createElement("style");u.setAttribute(xt,a),l&&s&&u.setAttribute(vt,`${s}`),n!=null&&n.nonce&&(u.nonce=n==null?void 0:n.nonce),u.innerHTML=e;const c=Be(t),{firstChild:d}=c;if(r){if(l){const m=un(c).filter(f=>{if(!["prepend","prependQueue"].includes(f.getAttribute(xt)))return!1;const h=Number(f.getAttribute(vt)||0);return s>=h});if(m.length>0)return c.insertBefore(u,m.at(-1).nextSibling),u}d.before(u)}else c.append(u);return u}function fn(e,t={}){const n=Be(t);return un(n).find(r=>r.getAttribute(cn(t))===e)}function ka(e,t={}){const n=fn(e,t);n&&n.remove()}function La(e,t){const n=be.get(e);if(!n||!Ma(document,n)){const r=dn("",t),{parentNode:s}=r;be.set(e,s),r.remove()}}function za(e,t,n={}){var l,u,c;const r=Be(n);La(r,n);const s=fn(t,n);if(s)return(l=n.csp)!=null&&l.nonce&&s.nonce!==((u=n.csp)==null?void 0:u.nonce)&&(s.nonce=(c=n.csp)==null?void 0:c.nonce),s.innerHTML!==e&&(s.innerHTML=e),s;const a=dn(e,n);return a.setAttribute(cn(n),t),a}function Fa(e,t){const{content:n,extensions:r,useEditorOptions:s={}}=e,a=g.useId(),l=g.useMemo(()=>{const f=cs(r,r,"name");return[...r.map(p=>{const x=r.find(w=>w.name===p.name);return x?p.configure(x.options):p}),...f].map((p,x)=>p.configure({sort:x}))},[r]),u=i.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=i.useEditor({extensions:l,content:n,onUpdate:({editor:f})=>{u&&u(f)},...s});g.useImperativeHandle(t,()=>({editor:c})),g.useEffect(()=>{document.documentElement.classList.toggle("dark",e.dark),i.themeActions.setTheme(a,e.dark?"dark":"light")},[e.dark]),g.useEffect(()=>{c==null||c.setEditable(!(e!=null&&e.disabled)),i.editableEditorActions.setDisable(a,!(e!=null&&e.disabled))},[c,e==null?void 0:e.disabled]),g.useEffect(()=>((e==null?void 0:e.resetCSS)!==!1&&za(Na,"react-tiptap-reset"),()=>{ka("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=i.hasExtension(c,"characterCount");return c?o.jsxs("div",{className:"reactjs-tiptap-editor",children:[o.jsx($a,{id:a,children:o.jsx(i.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(Zs,{disabled:!!(e!=null&&e.disabled),editor:c,toolbar:e.toolbar}),o.jsx(i.EditorContent,{className:`relative ${(e==null?void 0:e.contentClass)||""}`,editor:c}),m&&o.jsx(_a,{editor:c,extensions:r}),!(e!=null&&e.hideBubble)&&o.jsx(Ys,{bubbleMenu:e==null?void 0:e.bubbleMenu,disabled:e==null?void 0:e.disabled,editor:c})]})})})}),o.jsx(Oa,{})]}):o.jsx(o.Fragment,{})}const Ha=g.forwardRef(Fa);exports.BubbleMenu=i.BubbleMenu;exports.default=Ha;exports.useEditorState=vn;
package/lib/index.d.cts CHANGED
@@ -309,30 +309,9 @@ declare module '@tiptap/core' {
309
309
 
310
310
  declare module '@tiptap/core' {
311
311
  interface Commands<ReturnType> {
312
- tableCellBackground: {
313
- setTableCellBackground: (color: string) => ReturnType;
314
- unsetTableCellBackground: () => ReturnType;
315
- };
316
- }
317
- }
318
-
319
-
320
- declare module '@tiptap/core' {
321
- interface Commands<ReturnType> {
322
- emoji: {
323
- setEmoji: (emoji: {
324
- name: string;
325
- emoji: string;
326
- }) => ReturnType;
327
- };
328
- }
329
- }
330
-
331
-
332
- declare module '@tiptap/core' {
333
- interface Commands<ReturnType> {
334
- painter: {
335
- setPainter: (marks: Mark[]) => ReturnType;
312
+ lineHeight: {
313
+ setLineHeight: (lineHeight: string) => ReturnType;
314
+ unsetLineHeight: () => ReturnType;
336
315
  };
337
316
  }
338
317
  }
@@ -360,8 +339,8 @@ declare module '@tiptap/core' {
360
339
 
361
340
  declare module '@tiptap/core' {
362
341
  interface Commands<ReturnType> {
363
- katex: {
364
- setKatex: (arg?: IKatexAttrs) => ReturnType;
342
+ painter: {
343
+ setPainter: (marks: Mark[]) => ReturnType;
365
344
  };
366
345
  }
367
346
  }
@@ -369,14 +348,23 @@ declare module '@tiptap/core' {
369
348
 
370
349
  declare module '@tiptap/core' {
371
350
  interface Commands<ReturnType> {
372
- search: {
373
- setSearchTerm: (searchTerm: string) => ReturnType;
374
- setReplaceTerm: (replaceTerm: string) => ReturnType;
375
- replace: () => ReturnType;
376
- replaceAll: () => ReturnType;
377
- goToPrevSearchResult: () => void;
378
- goToNextSearchResult: () => void;
379
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
351
+ columns: {
352
+ insertColumns: (attrs?: {
353
+ cols: number;
354
+ }) => ReturnType;
355
+ addColBefore: () => ReturnType;
356
+ addColAfter: () => ReturnType;
357
+ deleteCol: () => ReturnType;
358
+ };
359
+ }
360
+ }
361
+
362
+
363
+ declare module '@tiptap/core' {
364
+ interface Commands<ReturnType> {
365
+ tableCellBackground: {
366
+ setTableCellBackground: (color: string) => ReturnType;
367
+ unsetTableCellBackground: () => ReturnType;
380
368
  };
381
369
  }
382
370
  }
@@ -399,13 +387,14 @@ declare module '@tiptap/core' {
399
387
 
400
388
  declare module '@tiptap/core' {
401
389
  interface Commands<ReturnType> {
402
- columns: {
403
- insertColumns: (attrs?: {
404
- cols: number;
405
- }) => ReturnType;
406
- addColBefore: () => ReturnType;
407
- addColAfter: () => ReturnType;
408
- deleteCol: () => ReturnType;
390
+ search: {
391
+ setSearchTerm: (searchTerm: string) => ReturnType;
392
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
393
+ replace: () => ReturnType;
394
+ replaceAll: () => ReturnType;
395
+ goToPrevSearchResult: () => void;
396
+ goToNextSearchResult: () => void;
397
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
409
398
  };
410
399
  }
411
400
  }
@@ -413,9 +402,11 @@ declare module '@tiptap/core' {
413
402
 
414
403
  declare module '@tiptap/core' {
415
404
  interface Commands<ReturnType> {
416
- lineHeight: {
417
- setLineHeight: (lineHeight: string) => ReturnType;
418
- unsetLineHeight: () => ReturnType;
405
+ emoji: {
406
+ setEmoji: (emoji: {
407
+ name: string;
408
+ emoji: string;
409
+ }) => ReturnType;
419
410
  };
420
411
  }
421
412
  }
@@ -423,8 +414,8 @@ declare module '@tiptap/core' {
423
414
 
424
415
  declare module '@tiptap/core' {
425
416
  interface Commands<ReturnType> {
426
- exportWord: {
427
- exportToWord: () => ReturnType;
417
+ katex: {
418
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
428
419
  };
429
420
  }
430
421
  }
@@ -449,6 +440,15 @@ declare module '@tiptap/core' {
449
440
  }
450
441
 
451
442
 
443
+ declare module '@tiptap/core' {
444
+ interface Commands<ReturnType> {
445
+ exportWord: {
446
+ exportToWord: () => ReturnType;
447
+ };
448
+ }
449
+ }
450
+
451
+
452
452
  declare module '@tiptap/core' {
453
453
  interface Commands<ReturnType> {
454
454
  imageGifUpload: {
@@ -488,16 +488,6 @@ declare module '@tiptap/core' {
488
488
  }
489
489
 
490
490
 
491
- declare module '@tiptap/core' {
492
- interface Commands<ReturnType> {
493
- drawer: {
494
- setDrawer: (options: any, replace?: any) => ReturnType;
495
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
496
- };
497
- }
498
- }
499
-
500
-
501
491
  declare module '@tiptap/core' {
502
492
  interface Commands<ReturnType> {
503
493
  twitter: {
@@ -511,3 +501,13 @@ declare module '@tiptap/core' {
511
501
  };
512
502
  }
513
503
  }
504
+
505
+
506
+ declare module '@tiptap/core' {
507
+ interface Commands<ReturnType> {
508
+ drawer: {
509
+ setDrawer: (options: any, replace?: any) => ReturnType;
510
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
511
+ };
512
+ }
513
+ }