reactjs-tiptap-editor-pro 0.2.33 → 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-MEAh4MhG.js → ColorPicker-BGCCdXrc.js} +5665 -6323
- package/lib/ColorPicker-DGbrNkQ-.cjs +142 -0
- package/lib/extension-bundle.cjs +2 -2
- package/lib/extension-bundle.d.cts +60 -71
- package/lib/extension-bundle.d.ts +60 -71
- package/lib/extension-bundle.js +9 -10
- package/lib/index.cjs +3 -3
- package/lib/index.d.cts +60 -69
- package/lib/index.d.ts +60 -69
- package/lib/index.js +927 -1007
- package/lib/{locale-bundle-DxCAtRDI.js → locale-bundle-CT7qZRHF.js} +6 -7
- package/lib/locale-bundle-PAhriAQT.cjs +1 -0
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +60 -69
- package/lib/locale-bundle.d.ts +60 -69
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -2
- package/lib/ColorPicker-ZncOwjAP.cjs +0 -142
- package/lib/locale-bundle-DiqW5jwb.cjs +0 -1
package/lib/extension-bundle.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as wy,
|
|
1
|
+
import { Y as aa, Z as oa, B as _n, av as Xo, _ as sa, aw as $o, ax as Ct, ay as tn, az as An, aA as Fe, A as Ce, aB as $e, U as Ze, R as Ve, a9 as Jt, aC as Bo, Q as xi, aD as fi, aE as Et, aF as Pt, X as kn, $ as Fn, a0 as Sn, a1 as Hh, d as nt, aG as Vo, x as jh, aH as gi, aI as yt, W as st, aJ as Xh, aK as Ko, aL as Ne, aM as Zn, a2 as Fd, aN as Lo, aO as $h, aP as Go, P as Fi, q as Si, v as Bi, aQ as Zo, V as Vh, aR as Kh, aa as Gh, aS as jn, aT as Zh, aU as Yh, aV as Qh, aW as Jh, aX as ef, ae as tf, aY as nf, aZ as rf, a_ as af, a$ as Yo, b0 as of, b1 as sf, b2 as cf, b3 as uc, b4 as Sd, b5 as uf, b6 as df, b7 as lf, b8 as hf, ag as ff, b9 as gf, ba as dc, a7 as Oi, bb as pf, bc as mf, bd as xn, an as Mt, E as bf, be as yf, af as Df, bf as Qo, am as lc, L as Na, I as hc, bg as vf, bh as xf, bi as _f, bj as Qt, bk as wf, ah as Tf, as as Uf, bl as Ot, bm as Ef, bn as Af, bo as Cf, bp as kf, bq as Ff, br as Bd } from "./ColorPicker-BGCCdXrc.js";
|
|
2
|
+
import { n as wy, w as Ty, G as Uy, K as Ey, M as Ay, bs as Cy, z as ky } from "./ColorPicker-BGCCdXrc.js";
|
|
3
3
|
import { bundledThemes as Ld, bundledLanguages as Nd, createHighlighter as Sf } from "shiki";
|
|
4
4
|
import { jsxs as be, jsx as G, Fragment as ca } from "react/jsx-runtime";
|
|
5
5
|
import * as Bn from "react";
|
|
6
6
|
import Bf, { useMemo as Dt, useState as je, useRef as nn, useCallback as en, Fragment as Jo, forwardRef as es, useImperativeHandle as ts, useEffect as ot } from "react";
|
|
7
|
-
import { M as Lf, D as Rd, u as kt, a as Nf, b as Rf, c as fc, l as Ke, d as Wd, e as Wf } from "./locale-bundle-
|
|
7
|
+
import { M as Lf, D as Rd, u as kt, a as Nf, b as Rf, c as fc, l as Ke, d as Wd, e as Wf } from "./locale-bundle-CT7qZRHF.js";
|
|
8
8
|
import { ChevronDown as ns, Check as If, ChevronUp as Of, Copy as Mf, CopyCheck as Pf, SearchIcon as qf, LoaderIcon as zf, LucideTableProperties as Hf, LucideSheet as jf, LucideImage as Xf, LucideFile as $f, LucideVideo as Vf, LucideAudioLines as Kf } from "lucide-react";
|
|
9
9
|
import * as Pe from "@radix-ui/react-select";
|
|
10
10
|
import { Slot as Gf } from "@radix-ui/react-slot";
|
|
@@ -23882,7 +23882,6 @@ export {
|
|
|
23882
23882
|
oy as ColumnActionButton,
|
|
23883
23883
|
wy as Drawer,
|
|
23884
23884
|
gy as Emoji,
|
|
23885
|
-
Ty as Excalidraw,
|
|
23886
23885
|
py as ExportPdf,
|
|
23887
23886
|
by as ExportWord,
|
|
23888
23887
|
$b as FontFamily,
|
|
@@ -23892,17 +23891,17 @@ export {
|
|
|
23892
23891
|
Yb as Highlight,
|
|
23893
23892
|
ay as History,
|
|
23894
23893
|
ry as HorizontalRule,
|
|
23895
|
-
|
|
23894
|
+
Ty as Iframe,
|
|
23896
23895
|
bf as Image,
|
|
23897
|
-
|
|
23896
|
+
Uy as ImageGif,
|
|
23898
23897
|
my as ImportWord,
|
|
23899
23898
|
dy as Indent,
|
|
23900
23899
|
zb as Italic,
|
|
23901
|
-
|
|
23900
|
+
Ey as Katex,
|
|
23902
23901
|
ly as LineHeight,
|
|
23903
23902
|
iy as Link,
|
|
23904
23903
|
Dy as Mention,
|
|
23905
|
-
|
|
23904
|
+
Ay as Mermaid,
|
|
23906
23905
|
uy as MoreMark,
|
|
23907
23906
|
ff as MultiColumn,
|
|
23908
23907
|
ey as OrderedList,
|
|
@@ -23910,12 +23909,12 @@ export {
|
|
|
23910
23909
|
hy as SlashCommand,
|
|
23911
23910
|
jb as Strike,
|
|
23912
23911
|
cy as SubAndSuperScript,
|
|
23913
|
-
|
|
23912
|
+
Cy as Table,
|
|
23914
23913
|
gb as TableOfContents,
|
|
23915
23914
|
ty as TaskList,
|
|
23916
23915
|
Kb as TextAlign,
|
|
23917
23916
|
yy as TextDirection,
|
|
23918
|
-
|
|
23917
|
+
ky as Twitter,
|
|
23919
23918
|
Hb as Underline,
|
|
23920
23919
|
Df as Video
|
|
23921
23920
|
};
|
package/lib/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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=`
|
|
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
3
|
.reactjs-tiptap-editor,
|
|
4
4
|
.dialog-content {
|
|
5
5
|
button,
|
|
@@ -137,4 +137,4 @@ div[data-tippy-root] {
|
|
|
137
137
|
color: inherit;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
`,
|
|
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;
|