edu360-web-ui 1.0.106 → 1.0.107

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.
@@ -120542,7 +120542,7 @@ const CustomImage = index_default$6.extend({
120542
120542
  const keepRatio = !moveEvent.shiftKey;
120543
120543
  let newW, newH;
120544
120544
  if (keepRatio) {
120545
- const d2 = Math.max(dx, dy);
120545
+ const d2 = (dx + dy) / 2;
120546
120546
  newW = Math.max(50, startWidth + d2);
120547
120547
  newH = Math.max(50, newW / aspect);
120548
120548
  } else {
@@ -120562,7 +120562,7 @@ const CustomImage = index_default$6.extend({
120562
120562
  const keepRatio = !upEvent.shiftKey;
120563
120563
  let finalW, finalH;
120564
120564
  if (keepRatio) {
120565
- const d2 = Math.max(dx, dy);
120565
+ const d2 = (dx + dy) / 2;
120566
120566
  finalW = Math.max(50, startWidth + d2);
120567
120567
  finalH = Math.max(50, finalW / aspect);
120568
120568
  } else {
@@ -17,4 +17,4 @@ e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function n(e){
17
17
 
18
18
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19
19
  */
20
- function(){var t=e,n=t.lib,r=n.WordArray,i=n.Hasher,o=t.algo,a=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),p=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=o.RIPEMD160=i.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,u,E,S,v,y,T,C,N,w,O,x=this._hash.words,R=d.words,A=p.words,k=a.words,I=s.words,D=l.words,M=c.words;for(y=o=x[0],T=u=x[1],C=E=x[2],N=S=x[3],w=v=x[4],n=0;n<80;n+=1)O=o+e[t+k[n]]|0,O+=n<16?m(u,E,S)+R[0]:n<32?_(u,E,S)+R[1]:n<48?g(u,E,S)+R[2]:n<64?h(u,E,S)+R[3]:f(u,E,S)+R[4],O=(O=b(O|=0,D[n]))+v|0,o=v,v=S,S=b(E,10),E=u,u=O,O=y+e[t+I[n]]|0,O+=n<16?f(T,C,N)+A[0]:n<32?h(T,C,N)+A[1]:n<48?g(T,C,N)+A[2]:n<64?_(T,C,N)+A[3]:m(T,C,N)+A[4],O=(O=b(O|=0,M[n]))+w|0,y=w,w=N,N=b(C,10),C=T,T=O;O=x[1]+E+N|0,x[1]=x[2]+S+w|0,x[2]=x[3]+v+y|0,x[3]=x[4]+o+T|0,x[4]=x[0]+u+C|0,x[0]=O},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function m(e,t,n){return e^t^n}function _(e,t,n){return e&t|~e&n}function g(e,t,n){return(e|~t)^n}function h(e,t,n){return e&n|t&~n}function f(e,t,n){return e^(t|~n)}function b(e,t){return e<<t|e>>>32-t}t.RIPEMD160=i._createHelper(u),t.HmacRIPEMD160=i._createHmacHelper(u)}(),e.RIPEMD160)),PL.exports;var e}(),UL(),function(){return zL||(zL=1,GL.exports=(l=eL(),CL(),UL(),t=(e=l).lib,n=t.Base,r=t.WordArray,i=e.algo,o=i.SHA256,a=i.HMAC,s=i.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=a.create(n.hasher,e),o=r.create(),s=r.create([1]),l=o.words,c=s.words,d=n.keySize,p=n.iterations;l.length<d;){var u=i.update(t).finalize(s);i.reset();for(var m=u.words,_=m.length,g=u,h=1;h<p;h++){g=i.finalize(g),i.reset();for(var f=g.words,b=0;b<_;b++)m[b]^=f[b]}o.concat(u),c[0]++}return o.sigBytes=4*d,o}}),e.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},l.PBKDF2)),GL.exports;var e,t,n,r,i,o,a,s,l}(),HL(),jL(),function(){return WL||(WL=1,KL.exports=(e=eL(),jL(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,r.encryptBlock(i,0);for(var a=0;a<n;a++)e[t+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;n.call(this,e,t,i,r),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=e.slice(t,t+i);n.call(this,e,t,i,r),this._prevBlock=o}}),t}(),e.mode.CFB)),KL.exports;var e}(),function(){return QL||(QL=1,ZL.exports=(n=eL(),jL(),n.mode.CTR=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0);var a=o.slice(0);n.encryptBlock(a,0),o[r-1]=o[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=a[s]}}),e.Decryptor=t,e),n.mode.CTR)),ZL.exports;var e,t,n}(),eP(),function(){return tP||(tP=1,nP.exports=(n=eL(),jL(),n.mode.OFB=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=this._iv,o=this._keystream;i&&(o=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(o,0);for(var a=0;a<r;a++)e[t+a]^=o[a]}}),e.Decryptor=t,e),n.mode.OFB)),nP.exports;var e,t,n}(),function(){return rP||(rP=1,iP.exports=(t=eL(),jL(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e),t.mode.ECB)),iP.exports;var e,t}(),function(){return oP||(oP=1,aP.exports=(e=eL(),jL(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,i=r-n%r,o=n+i-1;e.clamp(),e.words[o>>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923)),aP.exports;var e}(),function(){return sP||(sP=1,lP.exports=(e=eL(),jL(),e.pad.Iso10126={pad:function(t,n){var r=4*n,i=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126)),lP.exports;var e}(),function(){return cP||(cP=1,dP.exports=(e=eL(),jL(),e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971)),dP.exports;var e}(),function(){return pP||(pP=1,uP.exports=(e=eL(),jL(),e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding)),uP.exports;var e}(),function(){return mP||(mP=1,_P.exports=(e=eL(),jL(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)),_P.exports;var e}(),function(){return gP||(gP=1,hP.exports=(r=eL(),jL(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var r=n.parse(e);return t.create({ciphertext:r})}},r.format.Hex)),hP.exports;var e,t,n,r}(),function(){return fP||(fP=1,bP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],o=[],a=[],s=[],l=[],c=[],d=[],p=[],u=[],m=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var _=r^r<<1^r<<2^r<<3^r<<4;_=_>>>8^255&_^99,i[n]=_,o[_]=n;var g=e[n],h=e[g],f=e[h],b=257*e[_]^16843008*_;a[n]=b<<24|b>>>8,s[n]=b<<16|b>>>16,l[n]=b<<8|b>>>24,c[n]=b,b=16843009*f^65537*h^257*g^16843008*n,d[_]=b<<24|b>>>8,p[_]=b<<16|b>>>16,u[_]=b<<8|b>>>24,m[_]=b,n?(n=g^e[e[e[f^g]]],r^=e[e[r]]):n=r=1}}();var _=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),o=this._keySchedule=[],a=0;a<r;a++)a<n?o[a]=t[a]:(c=o[a-1],a%n?n>6&&a%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=_[a/n|0]<<24),o[a]=o[a-n]^c);for(var s=this._invKeySchedule=[],l=0;l<r;l++){if(a=r-l,l%4)var c=o[a];else c=o[a-4];s[l]=l<4||a<=4?c:d[i[c>>>24]]^p[i[c>>>16&255]]^u[i[c>>>8&255]]^m[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,l,c,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,d,p,u,m,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,a,s){for(var l=this._nRounds,c=e[t]^n[0],d=e[t+1]^n[1],p=e[t+2]^n[2],u=e[t+3]^n[3],m=4,_=1;_<l;_++){var g=r[c>>>24]^i[d>>>16&255]^o[p>>>8&255]^a[255&u]^n[m++],h=r[d>>>24]^i[p>>>16&255]^o[u>>>8&255]^a[255&c]^n[m++],f=r[p>>>24]^i[u>>>16&255]^o[c>>>8&255]^a[255&d]^n[m++],b=r[u>>>24]^i[c>>>16&255]^o[d>>>8&255]^a[255&p]^n[m++];c=g,d=h,p=f,u=b}g=(s[c>>>24]<<24|s[d>>>16&255]<<16|s[p>>>8&255]<<8|s[255&u])^n[m++],h=(s[d>>>24]<<24|s[p>>>16&255]<<16|s[u>>>8&255]<<8|s[255&c])^n[m++],f=(s[p>>>24]<<24|s[u>>>16&255]<<16|s[c>>>8&255]<<8|s[255&d])^n[m++],b=(s[u>>>24]<<24|s[c>>>16&255]<<16|s[d>>>8&255]<<8|s[255&p])^n[m++],e[t]=g,e[t+1]=h,e[t+2]=f,e[t+3]=b},keySize:8});t.AES=n._createHelper(g)}(),e.AES)),bP.exports;var e}(),vP(),function(){return yP||(yP=1,TP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],i=0;i<256;i++)r[i]=i;i=0;for(var o=0;i<256;i++){var a=i%n,s=t[a>>>2]>>>24-a%4*8&255;o=(o+r[i]+s)%256;var l=r[i];r[i]=r[o],r[o]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,r=0,i=0;i<4;i++){n=(n+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[n],e[n]=o,r|=e[(e[t]+e[n])%256]<<24-8*i}return this._i=t,this._j=n,r}t.RC4=n._createHelper(i);var a=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=n._createHelper(a)}(),e.RC4)),TP.exports;var e}(),function(){return CP||(CP=1,NP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],o=[],a=[],s=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)l.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var o=t.words,a=o[0],s=o[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),p=c>>>16|4294901760&d,u=d<<16|65535&c;for(i[0]^=c,i[1]^=p,i[2]^=d,i[3]^=u,i[4]^=c,i[5]^=p,i[6]^=d,i[7]^=u,n=0;n<4;n++)l.call(this)}},_doProcessBlock:function(e,t){var n=this._X;l.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)i[r]=16711935&(i[r]<<8|i[r]>>>24)|4278255360&(i[r]<<24|i[r]>>>8),e[t+r]^=i[r]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],i=65535&r,s=r>>>16,l=((i*i>>>17)+i*s>>>15)+s*s,c=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=n._createHelper(s)}(),e.Rabbit)),NP.exports;var e}(),function(){return wP||(wP=1,OP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],o=[],a=[],s=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=n[i+4&7];if(t){var o=t.words,a=o[0],s=o[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),p=c>>>16|4294901760&d,u=d<<16|65535&c;for(r[0]^=c,r[1]^=p,r[2]^=d,r[3]^=u,r[4]^=c,r[5]^=p,r[6]^=d,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var n=this._X;l.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)i[r]=16711935&(i[r]<<8|i[r]>>>24)|4278255360&(i[r]<<24|i[r]>>>8),e[t+r]^=i[r]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],i=65535&r,s=r>>>16,l=((i*i>>>17)+i*s>>>15)+s*s,c=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=n._createHelper(s)}(),e.RabbitLegacy)),OP.exports;var e}(),PP());const BP=Hm(QM.exports),FP="0face1314520face";const UP={encrypt:function(e){const t=BP.enc.Utf8.parse(FP),n=BP.enc.Utf8.parse(FP);return BP.AES.encrypt(e,t,{iv:n,mode:BP.mode.CBC,padding:BP.pad.Pkcs7}).toString()},decrypt:function(e){const t=BP.enc.Utf8.parse(FP),n=BP.enc.Utf8.parse(FP);return BP.AES.decrypt(e,t,{iv:n,mode:BP.mode.CBC,padding:BP.pad.Pkcs7}).toString(BP.enc.Utf8)}},zP={class:"floating-menu-top"},GP={class:"floating-menu-top-btns"},$P={class:"floating-menu-common"},qP={class:"floating-menu-common-list"},HP={class:"block-menu-item-icon"},VP={class:"block-menu-item"},YP={class:"block-menu-item-icon"},jP={class:"block-menu-item-icon"},WP={class:"block-menu-item-icon"},KP={class:"block-menu-item-icon"},QP=RT({__name:"BlockMenu",props:{editor:Object,apiHost:String,token:String,uploadUrl:String,uploadJupyter:String,uploadDoc:String,getFileContent:String,showMenu:{type:Array,default:()=>[]},coords:{type:Object,default:()=>({left:0,top:0})},editorWrapper:Object},emits:["toggleLoading","closemenu","showLink"],setup(e,{emit:r}){const i=e,o=t.reactive({paragraph:!1,heading1:!1,heading2:!1,heading3:!1,heading4:!1,heading5:!1,heading6:!1,bulletList:!1,orderedList:!1,taskList:!1,link:!1,codeBlock:!1,undo:!1,redo:!1}),a=(e,t)=>i.editor.isActive(e,t),s=t.ref(null),l=()=>{c(),u("closemenu"),u("showLink")},c=e=>{Object.keys(o).forEach(e=>o[e]=!1),e&&t.nextTick(()=>{u("closemenu",()=>{e&&e()})})},d=e=>{u("closemenu")},p=e=>{i.editor.chain().focus().setImage({src:e.data.show_url}).run()},u=r,m=()=>{a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")||(u("toggleLoading",!0),u("closemenu"))},_=e=>{let t={config:{apiHost:i.apiHost,token:i.token,getFileContent:i.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||"");mI({editor:i.editor,content:t,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},g=()=>{a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")||(u("toggleLoading",!0),c(),u("closemenu"))},h=e=>{let t={config:{apiHost:i.apiHost,token:i.token,getFileContent:i.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||"");mI({editor:i.editor,content:t,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},f=()=>{c(),u("closemenu","ai")},b=()=>{a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")||(c(),u("closemenu","codeblock"))};let E=t.ref(!1),S=t.ref(null);const v=e=>{S.value=e,E.value=!1,t.nextTick(()=>{u("closemenu",()=>{setTimeout(()=>{const{state:e}=i.editor,{$from:t}=e.selection,n=t.node();n&&"paragraph"===n.type.name&&n.content.size>0?i.editor.chain().focus().insertContent("<p></p>").insertTable({rows:S.value.row,cols:S.value.col,withHeaderRow:!0}).run():i.editor.chain().focus().insertTable({rows:S.value.row,cols:S.value.col,withHeaderRow:!0}).run()},50)})})};return(r,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{class:"floating-menu-cont",style:t.normalizeStyle({left:e.coords.left+"px",top:e.coords.top+"px"})},[t.createElementVNode("div",zP,[i[23]||(i[23]=t.createElementVNode("p",{class:"floating-menu-tit"},"基础",-1)),t.createElementVNode("div",GP,[t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"正文",placement:"bottom",visible:o.paragraph,"onUpdate:visible":i[1]||(i[1]=e=>o.paragraph=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-paragraph",width:"20",onClick:i[0]||(i[0]=t=>{c(()=>{e.editor.chain().focus().setParagraph().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"标题1",placement:"bottom",visible:o.heading1,"onUpdate:visible":i[3]||(i[3]=e=>o.heading1=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-1",width:"20",onClick:i[2]||(i[2]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:1}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:2,class:"box-item",effect:"dark",content:"标题2",placement:"bottom",visible:o.heading2,"onUpdate:visible":i[5]||(i[5]=e=>o.heading2=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-2",width:"20",onClick:i[4]||(i[4]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:2}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:3,class:"box-item",effect:"dark",content:"标题3",placement:"bottom",visible:o.heading3,"onUpdate:visible":i[7]||(i[7]=e=>o.heading3=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-3",width:"20",onClick:i[6]||(i[6]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:3}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"标题4",placement:"bottom",visible:o.heading4,"onUpdate:visible":i[9]||(i[9]=e=>o.heading4=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-4",width:"20",onClick:i[8]||(i[8]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:4}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"标题5",placement:"bottom",visible:o.heading5,"onUpdate:visible":i[11]||(i[11]=e=>o.heading5=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-5",width:"20",onClick:i[10]||(i[10]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:5}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"标题6",placement:"bottom",visible:o.heading6,"onUpdate:visible":i[13]||(i[13]=e=>o.heading6=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-6",width:"20",onClick:i[12]||(i[12]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:6}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("bulletList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:7,class:"box-item",effect:"dark",content:"无序列表",placement:"bottom",visible:o.bulletList,"onUpdate:visible":i[15]||(i[15]=e=>o.bulletList=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-bulleted",width:"20",onClick:i[14]||(i[14]=t=>{c(()=>{e.editor.chain().focus().toggleBulletList().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("orderedList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:8,class:"box-item",effect:"dark",content:"有序列表",placement:"bottom",visible:o.orderedList,"onUpdate:visible":i[17]||(i[17]=e=>o.orderedList=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-numbered",width:"20",onClick:i[16]||(i[16]=t=>{c(()=>{e.editor.chain().focus().toggleOrderedList().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("taskList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:9,class:"box-item",effect:"dark",content:"待办列表",placement:"bottom",visible:o.taskList,"onUpdate:visible":i[19]||(i[19]=e=>o.taskList=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-checkbox",width:"20",onClick:i[18]||(i[18]=t=>{c(()=>{e.editor.chain().focus().toggleTaskList().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("link",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:10,class:"box-item",effect:"dark",content:"链接",placement:"bottom",visible:o.link,"onUpdate:visible":i[20]||(i[20]=e=>o.link=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:link-variant",width:"20",onClick:l})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("codeBlock",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:11,class:"box-item",effect:"dark",content:"代码块",placement:"bottom",visible:o.codeBlock,"onUpdate:visible":i[21]||(i[21]=e=>o.codeBlock=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:code-braces-box",class:t.normalizeClass(a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")?"icon-gray":""),width:"20",onClick:b},null,8,["class"])]),_:1},8,["visible"])):t.createCommentVNode("",!0)])]),t.createElementVNode("div",$P,[i[29]||(i[29]=t.createElementVNode("p",{class:"floating-menu-tit"},"通用",-1)),t.createElementVNode("div",qP,[t.unref(pI)("ai",e.showMenu)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"block-menu-item",onClick:f},[t.createElementVNode("div",HP,[t.createVNode(t.unref(xT),{icon:"hugeicons:ai-chat-02"})]),i[24]||(i[24]=t.createElementVNode("div",null,"AI创作",-1))])):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-file","show-file-list":!1,action:e.apiHost+e.uploadUrl,data:{type:2},headers:{"access-token":e.token},accept:".jpg,.png,.jpeg,.gif","before-upload":d,"on-success":p},{default:t.withCtx(()=>[t.createElementVNode("div",VP,[t.createElementVNode("div",YP,[t.createVNode(t.unref(xT),{icon:"material-symbols:imagesmode-outline-sharp"})]),i[25]||(i[25]=t.createElementVNode("div",null,"上传本地图片",-1))])]),_:1},8,["action","headers"]),[[t.vShow,t.unref(pI)("image",e.showMenu)]]),t.withDirectives(t.createElementVNode("div",null,[t.createVNode(t.unref(n.ElPopover),{placement:"right",width:224,visible:t.unref(E),"onUpdate:visible":i[22]||(i[22]=e=>t.isRef(E)?E.value=e:E=e),disabled:a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")},{reference:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")}]),ref:"tableRef"},[t.createElementVNode("div",jP,[t.createVNode(t.unref(xT),{icon:"material-symbols:table-outline-sharp",width:"20"})]),i[26]||(i[26]=t.createElementVNode("div",null,"表格",-1))],2)]),default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(KM,{onSelect:v})])]),_:1},8,["visible","disabled"])],512),[[t.vShow,t.unref(pI)("table",e.showMenu)]]),t.withDirectives(t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-file","show-file-list":!1,action:e.apiHost+e.uploadDoc,data:{type:2},headers:{"access-token":e.token},accept:".doc,.docx","on-success":_,"before-upload":m,disabled:a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")}])},[t.createElementVNode("div",WP,[t.createVNode(t.unref(xT),{icon:"tabler:file-word"})]),i[27]||(i[27]=t.createElementVNode("div",null,"上传word文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(pI)("doc",e.showMenu)]]),t.withDirectives(t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-file","show-file-list":!1,action:e.apiHost+e.uploadJupyter,data:{type:2},headers:{"access-token":e.token},accept:".ipynb","on-success":h,"before-upload":g,disabled:a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")}])},[t.createElementVNode("div",KP,[t.createVNode(t.unref(xT),{icon:"logos:jupyter"})]),i[28]||(i[28]=t.createElementVNode("div",null,"上传jupyter文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(pI)("jupyter",e.showMenu)]])])])],4),t.createVNode(YM,{ref_key:"linkRef",ref:s,editor:e.editor},null,8,["editor"])],64))}},[["__scopeId","data-v-49f2614c"]]);function ZP(e,n){const r=new At("blockMenu");let i=n.wrapperEl||null;const o={isPopoverOpen:!1};return new Ot({key:r,view(a){let s=document.createElement("div");s.className="block-menu-container",s.style.display="none",s.style.position="absolute",s.style.zIndex=9999,n.props.editorWrapper&&(n.props.editorWrapper.style.position="relative",n.props.editorWrapper.appendChild(s));const l=t.createApp({render:()=>t.h(QP,{editor:e,menuState:o,...n.props})});l.mount(s);let c=null,d=!1,p=null;function u(){s.style.display="none",c=null}function m(){clearTimeout(p),p=setTimeout(()=>{d||c&&c.matches(":hover")||u()},100)}function _(e){clearTimeout(p);!function(e){if(c=e,o.isPopoverOpen)return;const t=e.getBoundingClientRect(),n=a.dom.getBoundingClientRect();s.style.display="block",s.style.top=t.top-n.top+30+"px",s.style.left=t.left-n.left+"px"}(e.currentTarget)}function g(){m()}function h(){Array.from(a.dom.children).filter(e=>["P","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE","TABLE","DIV"].includes(e.tagName)).forEach(e=>{e.removeEventListener("mouseenter",_),e.removeEventListener("mouseleave",g),e.addEventListener("mouseenter",_),e.addEventListener("mouseleave",g)})}s.addEventListener("mouseenter",()=>{clearTimeout(p),d=!0}),s.addEventListener("mouseleave",()=>{d=!1,m()}),h();const f={update(){h(),c&&!a.dom.contains(c)&&u()},destroy(){s.remove(),l.unmount()},setWrapper(e){i=e,i&&s&&i.appendChild(s)}};return e.storage[r.key]=f,f}})}$a.create({name:"blockMenuExtension",addOptions:()=>({props:{apiHost:"",token:"",uploadUrl:"",uploadDoc:"",uploadJupyter:"",getFileContent:"",isInline:!1,showMenu:[]}}),addProseMirrorPlugins(){return this.options.props.isInline?[]:[ZP(this.editor,this.options)]},addCommands(){return{setBlockMenuWrapper:e=>({editor:t})=>{var n;return this.options.wrapperEl=e,null==(n=t.storage.blockMenu$)||n.setWrapper(e),!0}}}});const XP=Tu.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),isInline:!1}},addAttributes(){var e;return{...null==(e=this.parent)?void 0:e.call(this),width:{default:null,renderHTML:e=>e.width?{width:e.width+"px"}:{},parseHTML:e=>{const t=e.getAttribute("width")||e.style.width;return t?parseInt(t):null}},height:{default:null,renderHTML:e=>e.height?{height:e.height+"px"}:{},parseHTML:e=>{const t=e.getAttribute("height")||e.style.height;return t?parseInt(t):null}}}},addProseMirrorPlugins(){const e=new At("customImageClick");return[new Ot({key:e,props:{handleDOMEvents:{click:()=>!1}}})]},addNodeView(){return({node:e,editor:t,getPos:n})=>{const r=this.options.isInline,i=document.createElement("div");i.style.position="relative",i.style.display="inline-block",i.style.lineHeight="0";const o=document.createElement("img");if(o.src=e.attrs.src,o.alt=e.attrs.alt||"",o.title=e.attrs.title||"",o.style.display="block",o.style.borderRadius="4px",e.attrs.width&&(o.style.width=e.attrs.width+"px"),e.attrs.height&&(o.style.height=e.attrs.height+"px"),r)return i.appendChild(o),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(o.src=e.attrs.src,o.alt=e.attrs.alt||"",o.title=e.attrs.title||"",e.attrs.width?o.style.width=e.attrs.width+"px":o.style.width="",e.attrs.height?o.style.height=e.attrs.height+"px":o.style.height="",!0),destroy:()=>{i.remove()}};const a=document.createElement("div");a.style.position="absolute",a.style.top="8px",a.style.right="8px",a.style.display="flex",a.style.gap="6px",a.style.opacity="0",a.style.visibility="hidden",a.style.transition="all .2s",a.style.zIndex="2";const s=(e,t)=>{const n=document.createElement("button");return n.type="button",n.title=t,n.style.width="30px",n.style.height="30px",n.style.padding="0",n.style.border="none",n.style.borderRadius="6px",n.style.background="rgba(0,0,0,.7)",n.style.color="#fff",n.style.cursor="pointer",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.transition="all .2s",n.style.boxShadow="0 2px 8px rgba(0,0,0,.2)",n.innerHTML=(e=>"view"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>':"reset"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>':"fit"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="18" height="12" rx="2" ry="2"></rect><polyline points="8 12 11 9 11 15 8 12"></polyline><polyline points="16 12 13 9 13 15 16 12"></polyline></svg>':"")(e),n.addEventListener("mouseenter",()=>{n.style.background="rgba(0,0,0,.9)"}),n.addEventListener("mouseleave",()=>{n.style.background="rgba(0,0,0,.7)"}),n},l=s("view","查看原图"),c=s("fit","适配编辑区宽度"),d=s("reset","重置大小");a.appendChild(l),a.appendChild(c),a.appendChild(d),l.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("tiptap-image-click",{detail:o.src}))}),d.addEventListener("click",r=>{if(r.preventDefault(),r.stopPropagation(),"function"==typeof n){const r=n(),i=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:null,height:null});t.view.dispatch(i)}}),c.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const i=t.view.dom;if(!i)return;const a=Math.max(50,i.clientWidth-60),s=(o.naturalWidth||o.offsetWidth||1)/(o.naturalHeight||o.offsetHeight||1),l=Math.round(a),c=Math.round(l/s);if(o.style.width=l+"px",o.style.height=c+"px","function"==typeof n){const r=n(),i=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:l,height:c});t.view.dispatch(i)}});const p=["nw","ne","sw","se"],u={};p.forEach(e=>{u[e]=(e=>{const t=document.createElement("div");return t.dataset.position=e,t.style.position="absolute",t.style.width="8px",t.style.height="8px",t.style.background="#fff",t.style.border="2px solid rgb(37,108,251)",t.style.borderRadius="50%",t.style.opacity="0",t.style.visibility="hidden",t.style.transition="all .2s",t.style.zIndex="1",t.style.boxShadow="0 2px 6px rgba(0,0,0,.15)","nw"===e&&(t.style.top="-4px",t.style.left="10px",t.style.cursor="nwse-resize"),"ne"===e&&(t.style.top="-4px",t.style.right="14px",t.style.cursor="nesw-resize"),"sw"===e&&(t.style.bottom="-4px",t.style.left="10px",t.style.cursor="nesw-resize"),"se"===e&&(t.style.bottom="-4px",t.style.right="14px",t.style.cursor="nwse-resize"),t.addEventListener("mouseenter",()=>{t.style.background="rgb(37,108,251)",t.style.transform="scale(1.3)"}),t.addEventListener("mouseleave",()=>{t.style.background="#fff",t.style.transform="scale(1)"}),t})(e)});i.addEventListener("mouseenter",()=>{a.style.opacity="1",a.style.visibility="visible",Object.values(u).forEach(e=>{e.style.opacity="1",e.style.visibility="visible"})}),i.addEventListener("mouseleave",()=>{a.style.opacity="0",a.style.visibility="hidden",Object.values(u).forEach(e=>{e.style.opacity="0",e.style.visibility="hidden"})});return p.forEach(r=>{u[r].addEventListener("mousedown",i=>((r,i)=>{r.preventDefault(),r.stopPropagation();const a=r.clientX,s=r.clientY,l=o.offsetWidth,c=o.offsetHeight,d=l/c||1,p=i.includes("w"),u=i.includes("n"),m=e=>{let t,n,r=e.clientX-a,i=e.clientY-s;if(p&&(r=-r),u&&(i=-i),e.shiftKey)t=Math.max(50,l+r),n=Math.max(50,c+i);else{const e=Math.max(r,i);t=Math.max(50,l+e),n=Math.max(50,t/d)}o.style.width=t+"px",o.style.height=n+"px"},_=r=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",_);let i,o,g=r.clientX-a,h=r.clientY-s;if(p&&(g=-g),u&&(h=-h),r.shiftKey)i=Math.max(50,l+g),o=Math.max(50,c+h);else{const e=Math.max(g,h);i=Math.max(50,l+e),o=Math.max(50,i/d)}if("function"==typeof n){const r=n(),a=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:Math.round(i),height:Math.round(o)});t.view.dispatch(a)}};document.addEventListener("mousemove",m),document.addEventListener("mouseup",_)})(i,r))}),i.appendChild(o),i.appendChild(a),p.forEach(e=>i.appendChild(u[e])),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(o.src=e.attrs.src,o.alt=e.attrs.alt||"",o.title=e.attrs.title||"",e.attrs.width?o.style.width=e.attrs.width+"px":o.style.width="",e.attrs.height?o.style.height=e.attrs.height+"px":o.style.height="",!0),destroy:()=>{i.remove()}}}}});DN(),vp.extend({content:"inline*"});const JP=Um.extend({content:"(paragraph | bulletList | orderedList)*"});function eB(e,t){if(0===e.length)return"";const n=["<table>"];let r=!1,i=!1;for(let o=0;o<e.length;o++){const t=e[o];if("separator"===t.type){r=!0;continue}const a=t.content,s=a.substring(1,a.length-1).split("|");if(r&&!i){n.push("<thead><tr>");for(let e=0;e<s.length;e++)n.push("<th>",s[e].trim(),"</th>");n.push("</tr></thead><tbody>"),i=!0}else{i||(n.push("<tbody>"),i=!0),n.push("<tr>");for(let e=0;e<s.length;e++)n.push("<td>",s[e].trim(),"</td>");n.push("</tr>")}}return n.push("</tbody></table>"),n.join("")}const tB=({content:e="",info:t={},limit:r=50,isInline:i=!1,showMenu:o=[],placeholder:a="",blockMenuFn:s,editorWrapper:l,checkSlashTrigger:c}={})=>{const d=new yl({extensions:[cu.configure({paragraph:{},codeBlock:!1,blockquote:!0,heading:{levels:[1,2,3,4,5,6]},bulletList:!1,orderedList:!1,listItem:!1,strike:!1,bold:!0,italic:!0}),aD.configure({placeholder:({node:e,editor:t})=>{const n=t.state.doc;return 1===n.childCount&&"paragraph"===n.content.firstChild.type.name&&0===n.content.firstChild.content.size&&e===n.content.firstChild?a||"输入“/”插入内容":null},showOnlyWhenEditable:!0,showOnlyCurrent:!1}),du,uu,Eu,$m,FN,XP.configure({inline:!1,allowBase64:!1,isInline:i}),bu.configure({multicolor:!0}),Bm.configure({table:{resizable:!0},extensions:[JP,Fm,zm]}),UN,Fm,zm,Um,PN.configure({isInline:i}),tp.configure({HTMLAttributes:{class:"bullet-list"},nested:!0}),hp.configure({HTMLAttributes:{class:"ordered-list"},nested:!0}),np.configure({HTMLAttributes:{class:"list-item"},nested:!0}),Ep,bp.configure({nested:!1}),BN,Gm.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"],defaultAlignment:"left"}),Zd.configure({openOnClick:!1,defaultProtocol:"https"}),oD.configure({props:{apiHost:t.apiHost,token:t.token,askUrl:t.askUrl,answerUrl:t.answerUrl}}),(p={limit:r},$a.create({name:"characterLimiter",addProseMirrorPlugins:()=>[new Ot({key:new At("characterLimiter"),filterTransaction:(e,t)=>{if(!e.docChanged)return!0;const r=e=>{let t=0;return e.descendants(e=>{e.isText&&(t+=Array.from(e.text).length)}),t},i=r(t.doc),o=r(e.doc),a=p.limit;return!(o>a&&o>i&&(n.ElMessage.warning(`已超出最大字数限制:${a}`),1))}})]}))],editorProps:{handlePaste:(e,i,o)=>{var a,l;if(uI(e.state.doc)+o.content.size>r)return n.ElMessage.warning(`粘贴失败:内容将超过最大长度限制 ${r}。`),!0;const c=Array.from((null==(a=i.clipboardData)?void 0:a.items)||[]).find(e=>e.type.startsWith("image/"));if(c){i.preventDefault();const e=c.getAsFile();if(!e)return!1;const r=new FormData;r.append("file",e);return((e,t)=>lx({baseURL:e.config.apiHost,url:e.config.getFileContent,method:"post",token:e.config.token,data:t,onAuthFail:()=>{},onError:e=>n.ElMessage.error(e)}))({config:{apiHost:t.apiHost,token:t.token,getFileContent:t.uploadUrl}},r).then(e=>{e&&e.data&&e.data.show_url?d.chain().focus().setImage({src:e.data.show_url}).run():n.ElMessage.error("图片上传失败")}).catch(e=>{n.ElMessage.error("图片上传失败")}),!0}const p=null==(l=i.clipboardData)?void 0:l.getData("text/plain");if(p&&function(e){return!(!e||e.length<3)&&[/^#{1,6}\s+/m,/^\*\*[^*]+\*\*/m,/^__[^_]+__/m,/^\*[^*]+\*/m,/^_[^_]+_/m,/^\[.+\]\(.+\)/m,/^!\[.*\]\(.+\)/m,/^```/m,/^`[^`]+`/m,/^[-*+]\s+/m,/^\d+\.\s+/m,/^>\s+/m,/^\|.+\|.+\|/m,/^---+$/m,/^___+$/m,/^\*\*\*+$/m].filter(t=>t.test(e)).length>=2}(p)){i.preventDefault();try{let e,t,r;try{e=function(e){if(!e.includes("|"))return e;const t=e.split("\n");let n=[],r=0;const i=/^\|[\s:|-]+\|$/;for(;r<t.length;){const e=t[r].trim();if("|"===e[0]&&"|"===e[e.length-1]){const e=[];for(;r<t.length;){const n=t[r].trim();if("|"!==n[0]||"|"!==n[n.length-1])break;i.test(n)?e.push({type:"separator",content:n}):e.push({type:"data",content:n}),r++}if(e.length>0){const t=eB(e);n.push(t)}}else n.push(e),r++}return n.join("\n")}(p)}catch(u){e=p}try{t=new ak({html:!0,linkify:!0,typographer:!1,breaks:!1}).render(e)}catch(m){throw m}try{r=px(t,[cu.configure({codeBlock:!1,strike:!1,bulletList:!1,orderedList:!1,listItem:!1}),Eu,$m,Bm,Gm,tp,hp,np])}catch(_){throw _}if(r&&r.content){const e=r.content.length;if(e>100){n.ElMessage.info(`正在插入 ${e} 个内容块...`),s&&s(!0);const t=d.isEditable;d.setEditable(!1),mI({editor:d,content:r.content,type:"json",extensions:[],chunkSize:100,isPaste:!0,onProgress:e=>{if(1===e){performance.now(),startTime;d.setEditable(t),n.ElMessage.success("内容已插入完成"),s&&s(!1)}},onComplete:()=>{d.setEditable(t),s&&s(!1)}})}else d.chain().focus().insertContent(r.content).run(),setTimeout(()=>{d.view.updateState(d.state);const{tr:e}=d.state;d.view.dispatch(e),d.commands.focus()},0)}}catch(g){try{d.chain().focus().insertContent(p).run(),n.ElMessage.warning("Markdown 解析失败,已作为纯文本插入")}catch(h){n.ElMessage.error("内容插入失败,请检查控制台")}}return!0}return!1},handleDOMEvents:{},handleClick(e,t,n){let r=n.target;if(r===e.dom){if(r.closest("img")||r.closest("table")||r.closest("pre")||r.closest(".ai-block"))return!1;return!(t>=e.state.doc.content.size-1)||(d.chain().focus("end").run(),!0)}return!1}},editable:!i,content:"",onDrop({Editor:e}){}});var p;return d},nB=["onClick"],rB={key:0},iB={class:"phrases-btns"},oB={__name:"CommonExpression",props:{from:{type:String,default:""},info:{type:Object,default:()=>{}}},emits:["close"],setup(e,{emit:r}){const i=e;let o=t.ref(!0);const a=r,s=()=>{o.value=!1,a("close")};let l=t.ref([]);const c=()=>{let e={config:{apiHost:i.info.apiHost,token:i.info.token,apiUrl:i.info.expressionUrls.list},data:{page:1,page_size:999,type:0}};dx(e).then(e=>{l.value=e.data.list||[]})};c();const d=()=>{l.value.unshift({content:"",editStatus:!0,op:"add"}),p.value=l.value[0]};t.ref(!1);let p=t.ref({});t.ref(!1);const u=t.ref(null),m=e=>{p.value=e,p.value.user_id>0&&(e.editStatus=!0,t.nextTick(()=>{u.value.focus()}))},_=()=>{if(!p.value.content)return void n.ElMessage.warning("请输入常用语");let e={config:{apiHost:i.info.apiHost,token:i.info.token},data:{content:p.value.content,type:0}};"add"==p.value.op?(e.config.apiUrl=i.info.expressionUrls.create,dx(e).then(e=>{n.ElMessage.success("新增成功"),c()})):(e.config.apiUrl=i.info.expressionUrls.update,e.data.id=p.value.id,dx(e).then(e=>{n.ElMessage.success("编辑成功"),c()}))};let g=[];const h=e=>{g=e},f=()=>{if(!g.length)return void n.ElMessage.warning("请选择常用语");let e=g.map(e=>e.content).join("<br >");a("add",e)};return(e,r)=>(t.openBlock(),t.createBlock(t.unref(n.ElDrawer),{modelValue:t.unref(o),"onUpdate:modelValue":r[1]||(r[1]=e=>t.isRef(o)?o.value=e:o=e),"show-close":!1,size:900,class:"my-drawer",onClose:r[2]||(r[2]=e=>s())},{header:t.withCtx(()=>[...r[3]||(r[3]=[t.createElementVNode("div",{class:"dialog-header"},[t.createElementVNode("div",null,"选择常用语")],-1)])]),default:t.withCtx(()=>[t.createElementVNode("div",{class:"close",onClick:r[0]||(r[0]=e=>s())},[t.createVNode(t.unref(xT),{icon:"ic:baseline-close",width:"16"})]),t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:d},{default:t.withCtx(()=>[...r[4]||(r[4]=[t.createTextVNode("新增",-1)])]),_:1}),t.createVNode(t.unref(n.ElTable),{style:{margin:"10px 0"},data:t.unref(l),border:"",onSelectionChange:h},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElTableColumn),{type:"selection",width:"55"}),t.createVNode(t.unref(n.ElTableColumn),{type:"index",label:"序号",width:"90"}),t.createVNode(t.unref(n.ElTableColumn),{prop:"content",label:"常用语"},{default:t.withCtx(({row:e})=>[t.createElementVNode("div",{onClick:t=>m(e)},[e.editStatus?(t.openBlock(),t.createBlock(t.unref(n.ElInput),{key:1,modelValue:e.content,"onUpdate:modelValue":t=>e.content=t,style:{width:"100%"},rows:2,type:"textarea",ref_key:"inputRef",ref:u,placeholder:"请输入常用语",onBlur:t=>e.editStatus=!1,onChange:_,maxlength:"500"},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(t.openBlock(),t.createElementBlock("p",rB,t.toDisplayString(e.content),1))],8,nB)]),_:1}),t.createVNode(t.unref(n.ElTableColumn),{label:"类型",width:"100"},{default:t.withCtx(({row:e})=>[t.createTextVNode(t.toDisplayString(e.user_id?e.user_id>0?"自定义":"公共":""),1)]),_:1}),t.createVNode(t.unref(n.ElTableColumn),{prop:"address",label:"操作",width:"120"},{default:t.withCtx(({row:e})=>[e.user_id>0?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:"primary",link:"",onClick:t=>m(e)},{default:t.withCtx(()=>[...r[5]||(r[5]=[t.createTextVNode("编辑",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0),e.user_id>0?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:1,type:"danger",link:"",onClick:t=>(e=>{p.value=e;let t={config:{apiHost:i.info.apiHost,token:i.info.token,apiUrl:i.info.expressionUrls.delete},data:{id:p.value.id}};dx(t).then(e=>{n.ElMessage.success("删除成功"),c()})})(e)},{default:t.withCtx(()=>[...r[6]||(r[6]=[t.createTextVNode("删除",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0)]),_:1})]),_:1},8,["data"]),t.createElementVNode("div",iB,[t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:f},{default:t.withCtx(()=>[...r[7]||(r[7]=[t.createTextVNode("确定",-1)])]),_:1}),t.createVNode(t.unref(n.ElButton),{type:"primary",plain:"",onClick:s},{default:t.withCtx(()=>[...r[8]||(r[8]=[t.createTextVNode("取消",-1)])]),_:1})])]),_:1},8,["modelValue"]))}},aB=RT(oB,[["__scopeId","data-v-be715d1d"]]),sB={paragraph:"正文",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6"},lB={class:"toolbar"},cB={key:2,class:"flex-center"},dB={class:"flex-center"},pB={key:3,class:"flex-center"},uB={class:"flex-center"},mB={class:"flex-center"},_B={class:"flex-center"},gB={class:"flex-center"},hB={class:"table-content"},fB={key:7},bB=RT({__name:"EditorToolbar",props:{editor:Object,info:{type:Object,default:()=>({})},limitLength:{type:Number},isBubble:{type:Boolean,default:!1},showMenu:{type:Array,default:()=>[]}},emits:["showAi","showLink","toggleLoading","showSource"],setup(e,{emit:r}){const{appContext:i}=t.getCurrentInstance(),o=e;let a=t.ref("14px"),s=t.ref("#000"),l=t.ref("");const c=(e,t)=>o.editor.isActive(e,t),d=t.computed(()=>!!o.editor&&(o.editor.isActive("codeBlock")||o.editor.isActive("codeBlockCustom")));let p=t.ref("正文");const u=e=>{if("paragraph"===e)o.editor.chain().focus().setParagraph().run();else{const t=parseInt(e.replace("h",""),10);o.editor.chain().focus().setHeading({level:t}).run()}p.value=sB[e]},m=["12px","14px","16px","18px","20px","24px"],_=e=>{o.editor.chain().focus().setFontSize(e).run(),a.value=e},g=e=>o.editor.chain().focus().setColor(e).run(),h=e=>{e?o.editor.chain().focus().setHighlight({color:e}).run():o.editor.chain().focus().unsetHighlight().run()};let f=t.ref("left");const b=e=>{f.value=e,o.editor.chain().focus().setTextAlign(e).run()},E=e=>{},S=e=>{o.editor.chain().focus().setImage({src:e.data.show_url}).run()},v=()=>{o.editor.chain().focus().insertContent({type:"codeBlock",attrs:{language:"javascript"}}).run()};let y=t.ref(!1);const T=e=>{o.editor.chain().focus().insertTable({rows:e.row,cols:e.col,withHeaderRow:!0}).run(),y.value=!1},C=()=>{N("showLink")},N=r,w=()=>{const{from:e,to:t}=o.editor.state.selection;e!==t?N("showAi"):(o.editor.chain().focus().insertContent({type:"aiAssistant"}).run(),o.editor.setEditable(!1))},O=()=>{N("showSource")},x=()=>{if(!o.editor)return;const{state:e}=o.editor,{doc:t}=e;let{tr:r}=e,i=0;const a=[];t.descendants((e,t)=>{if("paragraph"===e.type.name){(0===e.content.size||""===e.textContent.trim())&&a.push({pos:t,size:e.nodeSize,type:"paragraph"})}else if("codeBlock"===e.type.name||"codeBlockCustom"===e.type.name){(0===e.content.size||""===e.textContent.trim())&&a.push({pos:t,size:e.nodeSize,type:"codeBlock"})}});for(let n=a.length-1;n>=0;n--){const{pos:e,size:t}=a[n];r=r.delete(e,e+t),i++}i>0?(0===r.doc.content.size&&(r=r.insert(0,e.schema.nodes.paragraph.create())),o.editor.view.dispatch(r),n.ElMessage.success(`已删除 ${i} 个空行和空代码块`)):n.ElMessage.info("没有找到空行或空代码块")},R=t.ref(!1),A=()=>{R.value=!0},k=()=>{R.value=!1},I=e=>{o.editor.chain().focus().insertContent(e).run(),R.value=!1},D={paragraph:"正文",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"};o.editor.view.dom.addEventListener("mousedown",e=>{var t;const n=o.editor.view.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return;const r=function(e,t){let n=null;return e.state.doc.nodesBetween(t,t,e=>{if(e.type.isBlock)return n=e,!1}),n}(o.editor,n.pos),i=(null==(t=null==r?void 0:r.attrs)?void 0:t.textAlign)||"left";f.value=i});const M=()=>{N("toggleLoading",!0)},L=e=>{let t={config:{apiHost:o.info.apiHost,token:o.info.token,getFileContent:o.info.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||"");mI({editor:o.editor,content:t,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)}})})},P=()=>{N("toggleLoading",!0)},B=e=>{let t={config:{apiHost:o.info.apiHost,token:o.info.token,getFileContent:o.info.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||""),n=(new DOMParser).parseFromString(t,"text/html").body.innerHTML;mI({editor:o.editor,content:n,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)}})})};return t.watchEffect(()=>{if(!o.editor)return;const{from:e,to:t}=o.editor.state.selection;if(e!==t){const e=o.editor.getAttributes("textStyle");a.value=e.fontSize||"14px",s.value=e.color||"#000000",l.value=e.backgroundColor||""}const n=[1,2,3,4,5,6];let r=!1;for(let i of n)if(o.editor.isActive("heading",{level:i})){p.value=D["h"+i],r=!0;break}r||(p.value=D.paragraph)}),(r,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",lB,[t.unref(pI)("ai",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"AI",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{onClick:w,link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"hugeicons:ai-chat-02",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"标题",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdown),{onCommand:u,trigger:"click","popper-class":"tiptap-drop-down",disabled:d.value},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownMenu),null,{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownItem),{command:"paragraph"},{default:t.withCtx(()=>[...i[12]||(i[12]=[t.createTextVNode("正文",-1)])]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h1"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:1})?"is-active":"")},"标题 1",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h2"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:2})?"is-active":"")},"标题 2",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h3"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:3})?"is-active":"")},"标题 3",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h4"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:4})?"is-active":"")},"标题 4",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h5"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:5})?"is-active":"")},"标题 5",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h6"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:6})?"is-active":"")},"标题 6",2)]),_:1})]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["el-dropdown-link",{disabled:d.value}])},[t.createElementVNode("p",null,t.toDisplayString(t.unref(p)),1),t.createVNode(t.unref(xT),{icon:"ic:baseline-expand-more",width:"16"})],2)]),_:1},8,["disabled"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"字号",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdown),{onCommand:_,trigger:"click","popper-class":"tiptap-drop-down",disabled:d.value},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownMenu),null,{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(m,e=>t.createVNode(t.unref(n.ElDropdownItem),{key:e,command:e},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("textStyle",{fontSize:e})?"is-active":"")},t.toDisplayString(e),3)]),_:2},1032,["command"])),64))]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["el-dropdown-link",{disabled:d.value}])},[t.createElementVNode("p",null,t.toDisplayString(t.unref(a)),1),t.createVNode(t.unref(xT),{icon:"ic:baseline-expand-more",width:"16"})],2)]),_:1},8,["disabled"])]),_:1}),t.unref(pI)("color",e.showMenu)?(t.openBlock(),t.createElementBlock("div",cB,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"字体颜色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",dB,[t.createVNode(t.unref(n.ElColorPicker),{modelValue:t.unref(s),"onUpdate:modelValue":i[0]||(i[0]=e=>t.isRef(s)?s.value=e:s=e),onChange:g,size:"small","show-alpha":"",disabled:d.value},null,8,["modelValue","disabled"])])]),_:1})])):t.createCommentVNode("",!0),t.unref(pI)("bgColor",e.showMenu)?(t.openBlock(),t.createElementBlock("div",pB,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"背景色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",uB,[t.createVNode(t.unref(n.ElColorPicker),{modelValue:t.unref(l),"onUpdate:modelValue":i[1]||(i[1]=e=>t.isRef(l)?l.value=e:l=e),onChange:h,size:"small","show-alpha":"",disabled:d.value},null,8,["modelValue","disabled"])])]),_:1})])):t.createCommentVNode("",!0),t.createVNode(t.unref(n.ElButtonGroup),null,{default:t.withCtx(()=>[t.unref(pI)("bold",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"加粗",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("bold")?"primary":"",onClick:i[2]||(i[2]=t=>e.editor.chain().focus().toggleBold().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-bold",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("italic",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"斜体",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("italic")?"primary":"",onClick:i[3]||(i[3]=t=>e.editor.chain().focus().toggleItalic().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-italic",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("underline",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:2,class:"box-item",effect:"dark",content:"下划线",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("underline")?"primary":"",onClick:i[4]||(i[4]=t=>e.editor.chain().focus().toggleUnderline().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-underline",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("strike",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:3,class:"box-item",effect:"dark",content:"中划线",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("strike")?"primary":"",onClick:i[5]||(i[5]=t=>e.editor.chain().focus().toggleStrike().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-strikethrough",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("bulletList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"无序列表",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{type:c("bulletList")?"primary":"",onClick:i[6]||(i[6]=t=>e.editor.chain().focus().toggleBulletList().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-bulleted",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("orderedList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"有序列表",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{type:c("orderedList")?"primary":"",onClick:i[7]||(i[7]=t=>e.editor.chain().focus().toggleOrderedList().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-numbered",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("taskList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"待办列表",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{type:c("taskList")?"primary":"",onClick:i[8]||(i[8]=t=>e.editor.chain().focus().toggleTaskList().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-checkbox",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("link",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:7,class:"box-item",effect:"dark",content:"链接",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{onClick:C,type:c("link")?"primary":"",link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:link-variant",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0)]),_:1}),t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"对齐方式",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdown),{onCommand:b,trigger:"click",teleported:!1,disabled:d.value},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownMenu),null,{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownItem),{command:"left"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"left"})?"is-active":""])},[t.createVNode(t.unref(n.ElButton),{type:c({textAlign:"left"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-left",width:"20"})]),_:1},8,["type"]),i[13]||(i[13]=t.createElementVNode("p",null,"左对齐",-1))],2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"center"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"center"})?"is-active":""])},[t.unref(pI)("center",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"center"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-center",width:"20"})]),_:1},8,["type"])):t.createCommentVNode("",!0),i[14]||(i[14]=t.createElementVNode("p",null,"居中",-1))],2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"right"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"right"})?"is-active":""])},[t.unref(pI)("right",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"right"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-right",width:"20"})]),_:1},8,["type"])):t.createCommentVNode("",!0),i[15]||(i[15]=t.createElementVNode("p",null,"右对齐",-1))],2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"justify"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"justify"})?"is-active":""])},[t.unref(pI)("justify",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"justify"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-justify",width:"20"})]),_:1},8,["type"])):t.createCommentVNode("",!0),i[16]||(i[16]=t.createElementVNode("p",null,"水平对齐",-1))],2)]),_:1})]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["el-dropdown-link",{disabled:d.value}])},[t.createVNode(t.unref(xT),{icon:`mdi:format-align-${t.unref(f)}`,width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["icon","class"]),t.createVNode(t.unref(xT),{icon:"ic:baseline-expand-more",width:"16",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])],2)]),_:1},8,["disabled"])]),_:1}),t.createElementVNode("div",mB,[!e.isBubble&&t.unref(pI)("image",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"上传图片",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-demo","show-file-list":!1,action:e.info.apiHost+e.info.uploadUrl,data:{type:2},headers:{"access-token":e.info.token},accept:".jpg,.png,.jpeg,.gif","before-upload":E,"on-success":S},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:file-image-box",width:"20"})]),_:1},8,["action","headers"])]),_:1})):t.createCommentVNode("",!0)]),t.createElementVNode("div",_B,[!e.isBubble&&t.unref(pI)("doc",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"上传Word文件",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElUpload),{class:"upload-demo","show-file-list":!1,action:e.info.apiHost+e.info.uploadDoc,data:{type:2},headers:{"access-token":e.info.token},accept:".doc,.docx","on-success":L,"before-upload":M,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:file-word",width:"20",class:t.normalizeClass(c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"icon-gray":"")},null,8,["class"])]),_:1},8,["action","headers","disabled"])]),_:1})):t.createCommentVNode("",!0)]),t.createElementVNode("div",gB,[!e.isBubble&&t.unref(pI)("jupyter",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"上传Jupyter文件",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElUpload),{class:"upload-demo","show-file-list":!1,action:e.info.apiHost+e.info.uploadJupyter,data:{type:2},headers:{"access-token":e.info.token},accept:".ipynb","on-success":B,"before-upload":P,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"logos:jupyter",class:t.normalizeClass(c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"icon-gray":"")},null,8,["class"])]),_:1},8,["action","headers","disabled"])]),_:1})):t.createCommentVNode("",!0)]),!e.isBubble&&t.unref(pI)("codeBlock",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"代码块",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("codeBlock")?"primary":"",onClick:v,link:"",disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:code-braces-box",width:"20",class:t.normalizeClass(c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"icon-gray":"")},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",null,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"表格",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",hB,[t.createVNode(t.unref(n.ElPopover),{placement:"bottom",title:"",width:224,trigger:"click",visible:t.unref(y),"onUpdate:visible":i[9]||(i[9]=e=>t.isRef(y)?y.value=e:y=e),disabled:c("table")||c("bulletList")||c("orderedList")||c("taskList")||c("codeBlock")},{reference:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:table",width:"20",class:t.normalizeClass(c("table")||c("bulletList")||c("orderedList")||c("taskList")||c("codeBlock")?"icon-gray":"")},null,8,["class"])]),default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(KM,{onSelect:T})])]),_:1},8,["visible","disabled"])])]),_:1})],512),[[t.vShow,!e.isBubble&&t.unref(pI)("table",e.showMenu)]]),t.createVNode(t.unref(n.ElButtonGroup),null,{default:t.withCtx(()=>[t.unref(pI)("undo",e.showMenu)&&!e.isBubble?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"撤销",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:i[10]||(i[10]=t=>e.editor.chain().focus().undo().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:undo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("redo",e.showMenu)&&!e.isBubble?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"重做",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:i[11]||(i[11]=t=>e.editor.chain().focus().redo().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:redo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}),!e.isBubble&&t.unref(pI)("viewSource",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"查看源代码",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:O,link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:code-tags",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(pI)("removeEmptyLines",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"去除空行",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:x,link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-clear",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(pI)("expression",e.showMenu)?(t.openBlock(),t.createElementBlock("div",fB,[t.createVNode(t.unref(n.ElButton),{link:"",onClick:A},{default:t.withCtx(()=>[...i[17]||(i[17]=[t.createTextVNode("插入常用语",-1)])]),_:1})])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"default",{},void 0,!0)]),R.value?(t.openBlock(),t.createBlock(aB,{key:0,info:e.info,onClose:k,onAdd:I},null,8,["info"])):t.createCommentVNode("",!0)],64))}},[["__scopeId","data-v-ade24cad"]]),EB={class:"bubble-menu"},SB=RT({__name:"BubbleMenu",props:{editor:Object,info:{type:Object,default:()=>({})},showMenu:{type:Array,default:()=>[]}},emits:["showAi","showLink"],setup(e,{emit:n}){const r=({editor:e,state:t,from:n,to:r})=>{if(i.value)return!1;if(!e.isFocused||n===r)return!1;const{doc:o,selection:a}=t;return a.node,a.$from,!e.isActive("image")&&(!e.isActive("codeBlock")&&!e.isActive("codeBlockCustom")&&(!(e.isActive("table")||e.isActive("tableRow")||e.isActive("tableCell")||e.isActive("tableHeader"))&&!e.isActive("aiAssistant")))};let i=t.ref(!1);const o=n,a=()=>{i.value=!0,o("showAi")},s=()=>{o("showLink")};return(n,i)=>(t.openBlock(),t.createBlock(t.unref(GM),{editor:e.editor,"should-show":r},{default:t.withCtx(()=>[t.createElementVNode("div",EB,[t.createVNode(bB,{editor:e.editor,info:e.info,isBubble:!0,showMenu:e.showMenu,onShowAi:a,onShowLink:s},null,8,["editor","info","showMenu"])])]),_:1},8,["editor"]))}},[["__scopeId","data-v-dc69236f"]]),vB={class:"table-toolbar-btns"},yB={class:"table-toolbar-btns"},TB={class:"table-toolbar-btns"},CB=RT({__name:"TableToolbar",props:{editor:{type:Object,required:!0},editorWrapper:{type:Object,default:null}},setup(e){const r=e,i=t.ref(null),o=t.ref(!1),a=t.ref(!1),s=t.ref({top:"0px",left:"0px"}),l=t.ref({top:"0px",left:"0px"}),c=t.ref(!1),d=t.ref({top:"0px",left:"0px"}),p=t.computed(()=>r.editor.can().mergeCells()),u=t.computed(()=>r.editor.can().splitCell()),m=()=>{const e=r.editor;if(!e||!e.view)return;const t=e.state,{selection:n}=t;if(!e.isActive("table"))return o.value=!1,a.value=!1,void(c.value=!1);const i=$o(e=>"tableCell"===e.type.name||"tableHeader"===e.type.name)(n);if(!i)return o.value=!1,a.value=!1,void(c.value=!1);const p=$o(e=>"tableRow"===e.type.name)(n),u=$o(e=>"table"===e.type.name)(n);if(!p||!u)return o.value=!1,a.value=!1,void(c.value=!1);const m=e.view,g=m.nodeDOM(i.pos),h=m.nodeDOM(p.pos),f=m.nodeDOM(u.pos);if(!(g instanceof HTMLElement&&h instanceof HTMLElement&&f instanceof HTMLElement))return o.value=!1,a.value=!1,void(c.value=!1);const b=m.dom.getBoundingClientRect(),E=g.getBoundingClientRect(),S=h.getBoundingClientRect(),v=f.getBoundingClientRect(),y=S.left-b.left-30,T=S.top-b.top+S.height/2+18-r.editorWrapper.scrollTop;s.value={position:"absolute",left:`${Math.max(y,-10)}px`,top:`${Math.max(T,0)}px`,zIndex:1e3},o.value=!0;const C=(E.left+E.right)/2+10-b.left-20,N=v.top-b.top-m.dom.scrollTop-r.editorWrapper.scrollTop;l.value={position:"absolute",left:`${C}px`,top:`${Math.max(N,0)}px`,zIndex:1e3},a.value=!0;const w=v.right-b.left+10,O=v.top-b.top;d.value={position:"absolute",left:`${w}px`,top:`${Math.max(O,0)}px`,zIndex:1e3};const{from:x,to:R}=n,A=_(e,x,R);c.value=A.length>1},_=(e,t,n)=>{const r=[],{state:i}=e,{doc:o}=i;return i.doc.nodesBetween(t,n,(e,t)=>{"tableCell"!==e.type.name&&"tableHeader"!==e.type.name||r.push({node:e,pos:t})}),r};let g=t.ref(!1),h=t.ref(!1);const f=()=>{r.editor.chain().focus().addRowAfter().run(),g.value=!1},b=()=>{r.editor.chain().focus().addRowBefore().run(),g.value=!1},E=()=>{r.editor.chain().focus().deleteRow().run(),g.value=!1},S=()=>{r.editor.chain().focus().addColumnAfter().run(),h.value=!1},v=()=>{r.editor.chain().focus().addColumnBefore().run(),h.value=!1},y=()=>{r.editor.chain().focus().deleteColumn().run(),h.value=!1},T=()=>{r.editor.chain().focus().deleteTable().run(),g.value=!1,h.value=!1},C=()=>{r.editor.chain().focus().mergeCells().run(),g.value=!1,h.value=!1,c.value=!1},N=()=>{u.value&&(r.editor.chain().focus().splitCell().run(),g.value=!1,h.value=!1,c.value=!1)};let w=null;return t.onMounted(()=>{r.editor&&(w=()=>m(),r.editor.on&&r.editor.on("selectionUpdate",w)),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),t.nextTick(()=>{m()})}),t.onBeforeUnmount(()=>{r.editor&&w&&r.editor.off&&r.editor.off("selectionUpdate",w),window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{class:"table-toolbar-wrapper",ref_key:"toolbarRoot",ref:i},[t.createElementVNode("div",vB,[t.renderSlot(e.$slots,"default",{},void 0,!0)]),o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"table-side-icon row-icon",style:t.normalizeStyle(s.value),onClick:r[1]||(r[1]=(...t)=>e.onRowIconClick&&e.onRowIconClick(...t))},[t.createVNode(t.unref(n.ElPopover),{placement:"right-start",trigger:"click",visible:t.unref(g),"onUpdate:visible":r[0]||(r[0]=e=>t.isRef(g)?g.value=e:g=e),teleported:!1},{reference:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",yB,[t.createElementVNode("div",{onClick:f},"下方插入行"),t.createElementVNode("div",{onClick:b},"上方插入行"),t.createElementVNode("div",{onClick:E},"删除行"),t.createElementVNode("div",{class:"danger",onClick:T},"删除表格"),p.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:C},"合并单元格")):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:N},"拆分单元格")):t.createCommentVNode("",!0)])]),_:1},8,["visible"])],4)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"table-side-icon col-icon",style:t.normalizeStyle(l.value),onClick:r[3]||(r[3]=(...t)=>e.onColIconClick&&e.onColIconClick(...t))},[t.createVNode(t.unref(n.ElPopover),{placement:"right-start",width:200,trigger:"click",teleported:!1,visible:t.unref(h),"onUpdate:visible":r[2]||(r[2]=e=>t.isRef(h)?h.value=e:h=e)},{reference:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",TB,[t.createElementVNode("div",{onClick:S},"右方插入列"),t.createElementVNode("div",{onClick:v},"左方插入列"),t.createElementVNode("div",{onClick:y},"删除列"),t.createElementVNode("div",{class:"danger",onClick:T},"删除表格"),p.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:C},"合并单元格")):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:N},"拆分单元格")):t.createCommentVNode("",!0)])]),_:1},8,["visible"])],4)):t.createCommentVNode("",!0)],512))}},[["__scopeId","data-v-291951b5"]]);function NB(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wB={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function OB(e){wB=e}var xB={exec:()=>null};function RB(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(AB.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var AB={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},kB=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,IB=/(?:[*+-]|\d{1,9}[.)])/,DB=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,MB=RB(DB).replace(/bull/g,IB).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),LB=RB(DB).replace(/bull/g,IB).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),PB=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,BB=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,FB=RB(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",BB).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UB=RB(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,IB).getRegex(),zB="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",GB=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$B=RB("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",GB).replace("tag",zB).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qB=RB(PB).replace("hr",kB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zB).getRegex(),HB={blockquote:RB(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qB).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:FB,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:kB,html:$B,lheading:MB,list:UB,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:qB,table:xB,text:/^[^\n]+/},VB=RB("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zB).getRegex(),YB={...HB,lheading:LB,table:VB,paragraph:RB(PB).replace("hr",kB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",VB).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zB).getRegex()},jB={...HB,html:RB("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",GB).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xB,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:RB(PB).replace("hr",kB).replace("heading"," *#{1,6} *[^\n]").replace("lheading",MB).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},WB=/^( {2,}|\\)\n(?!\s*$)/,KB=/[\p{P}\p{S}]/u,QB=/[\s\p{P}\p{S}]/u,ZB=/[^\s\p{P}\p{S}]/u,XB=RB(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,QB).getRegex(),JB=/(?!~)[\p{P}\p{S}]/u,eF=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,tF=RB(eF,"u").replace(/punct/g,KB).getRegex(),nF=RB(eF,"u").replace(/punct/g,JB).getRegex(),rF="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",iF=RB(rF,"gu").replace(/notPunctSpace/g,ZB).replace(/punctSpace/g,QB).replace(/punct/g,KB).getRegex(),oF=RB(rF,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,JB).getRegex(),aF=RB("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ZB).replace(/punctSpace/g,QB).replace(/punct/g,KB).getRegex(),sF=RB(/\\(punct)/,"gu").replace(/punct/g,KB).getRegex(),lF=RB(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),cF=RB(GB).replace("(?:--\x3e|$)","--\x3e").getRegex(),dF=RB("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",cF).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pF=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,uF=RB(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pF).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mF=RB(/^!?\[(label)\]\[(ref)\]/).replace("label",pF).replace("ref",BB).getRegex(),_F=RB(/^!?\[(ref)\](?:\[\])?/).replace("ref",BB).getRegex(),gF={_backpedal:xB,anyPunctuation:sF,autolink:lF,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:WB,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:xB,emStrongLDelim:tF,emStrongRDelimAst:iF,emStrongRDelimUnd:aF,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:uF,nolink:_F,punctuation:XB,reflink:mF,reflinkSearch:RB("reflink|nolink(?!\\()","g").replace("reflink",mF).replace("nolink",_F).getRegex(),tag:dF,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:xB},hF={...gF,link:RB(/^!?\[(label)\]\((.*?)\)/).replace("label",pF).getRegex(),reflink:RB(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pF).getRegex()},fF={...gF,emStrongRDelimAst:oF,emStrongLDelim:nF,url:RB(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},bF={...fF,br:RB(WB).replace("{2,}","*").getRegex(),text:RB(fF.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},EF={normal:HB,gfm:YB,pedantic:jB},SF={normal:gF,gfm:fF,breaks:bF,pedantic:hF},vF={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},yF=e=>vF[e];function TF(e,t){if(t){if(AB.escapeTest.test(e))return e.replace(AB.escapeReplace,yF)}else if(AB.escapeTestNoEncode.test(e))return e.replace(AB.escapeReplaceNoEncode,yF);return e}function CF(e){try{e=encodeURI(e).replace(AB.percentDecode,"%")}catch{return null}return e}function NF(e,t){var n;let r=e.replace(AB.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(AB.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!(null==(n=r.at(-1))?void 0:n.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(AB.slashPipe,"|");return r}function wF(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function OF(e,t,n,r,i){let o=t.href,a=t.title||null,s=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:o,title:a,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,l}var xF=class{constructor(e){o(this,"options"),o(this,"rules"),o(this,"lexer"),this.options=e||wB}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:wF(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=wF(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:wF(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=wF(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,o=!1,a=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))a.push(e[t]),o=!0;else{if(o)break;a.push(e[t])}e=e.slice(t);let s=a.join("\n"),l=s.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${s}`:s,r=r?`${r}\n${l}`:l;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,i,!0),this.lexer.state.top=c,0===e.length)break;let d=i.at(-1);if("code"===(null==d?void 0:d.type))break;if("blockquote"===(null==d?void 0:d.type)){let t=d,o=t.raw+"\n"+e.join("\n"),a=this.blockquote(o);i[i.length-1]=a,n=n.substring(0,n.length-t.raw.length)+a.raw,r=r.substring(0,r.length-t.text.length)+a.text;break}if("list"===(null==d?void 0:d.type)){let t=d,o=t.raw+"\n"+e.join("\n"),a=this.list(o);i[i.length-1]=a,n=n.substring(0,n.length-d.raw.length)+a.raw,r=r.substring(0,r.length-t.raw.length)+a.raw,e=o.substring(i.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;e;){let n=!1,r="",s="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],d=!l.trim(),p=0;if(this.options.pedantic?(p=2,s=l.trimStart()):d?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=l.slice(p),p+=t[1].length),d&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),o=this.rules.other.headingBeginRegex(p),a=this.rules.other.htmlBeginRegex(p);for(;e;){let u,m=e.split("\n",1)[0];if(c=m,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||o.test(c)||a.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=p||!c.trim())s+="\n"+u.slice(p);else{if(d||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||o.test(l)||n.test(l))break;s+="\n"+c}!d&&!c.trim()&&(d=!0),r+=m+"\n",e=e.substring(m.length+1),l=u.slice(p)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(a=!0));let u,m=null;this.options.gfm&&(m=this.rules.other.listIsTask.exec(s),m&&(u="[ ] "!==m[0],s=s.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!m,checked:u,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(!s)return;s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){var t;let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=NF(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(null==(t=n[3])?void 0:t.trim())?n[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],a={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?a.align.push("right"):this.rules.other.tableAlignCenter.test(e)?a.align.push("center"):this.rules.other.tableAlignLeft.test(e)?a.align.push("left"):a.align.push(null);for(let e=0;e<r.length;e++)a.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:a.align[e]});for(let e of o)a.rows.push(NF(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=wF(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),OF(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return OF(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,o=[...r[0]].length-1,a=o,s=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+o);null!=(r=l.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){a+=i;continue}if((r[5]||r[6])&&o%3&&!((o+i)%3)){s+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+s);let t=[...r[0]][0].length,l=e.slice(0,o+r.index+t+i);if(Math.min(o,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var t;let n;if(n=this.rules.inline.url.exec(e)){let e,r;if("@"===n[2])e=n[0],r="mailto:"+e;else{let i;do{i=n[0],n[0]=(null==(t=this.rules.inline._backpedal.exec(n[0]))?void 0:t[0])??""}while(i!==n[0]);e=n[0],r="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},RF=class e{constructor(e){o(this,"tokens"),o(this,"options"),o(this,"state"),o(this,"tokenizer"),o(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wB,this.options.tokenizer=this.options.tokenizer||new xF,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:AB,block:EF.normal,inline:SF.normal};this.options.pedantic?(t.block=EF.pedantic,t.inline=SF.pedantic):this.options.gfm&&(t.block=EF.gfm,this.options.breaks?t.inline=SF.breaks:t.inline=SF.gfm),this.tokenizer.rules=t}static get rules(){return{block:EF,inline:SF}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(AB.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var r,i,o;for(this.options.pedantic&&(e=e.replace(AB.tabCharGlobal," ").replace(AB.spaceLine,""));e;){let a;if(null==(i=null==(r=this.options.extensions)?void 0:r.block)?void 0:i.some(n=>!!(a=n.call({lexer:this},e,t))&&(e=e.substring(a.raw.length),t.push(a),!0)))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let n=t.at(-1);1===a.raw.length&&void 0!==n?n.raw+="\n":t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let n=t.at(-1);"paragraph"===(null==n?void 0:n.type)||"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+a.raw,n.text+="\n"+a.text,this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let n=t.at(-1);"paragraph"===(null==n?void 0:n.type)||"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+a.raw,n.text+="\n"+a.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let s=e;if(null==(o=this.options.extensions)?void 0:o.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(this.state.top&&(a=this.tokenizer.paragraph(s))){let r=t.at(-1);n&&"paragraph"===(null==r?void 0:r.type)?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+a.raw,r.text+="\n"+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(a),n=s.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let n=t.at(-1);"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+a.raw,n.text+="\n"+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var n,r,i,o,a;let s=e,l=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(l=this.tokenizer.rules.inline.reflinkSearch.exec(s));)e.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(l=this.tokenizer.rules.inline.anyPunctuation.exec(s));)s=s.slice(0,l.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(l=this.tokenizer.rules.inline.blockSkip.exec(s));)s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=(null==(r=null==(n=this.options.hooks)?void 0:n.emStrongMask)?void 0:r.call({lexer:this},s))??s;let c=!1,d="";for(;e;){let n;if(c||(d=""),c=!1,null==(o=null==(i=this.options.extensions)?void 0:i.inline)?void 0:o.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);"text"===n.type&&"text"===(null==r?void 0:r.type)?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,s,d)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let r=e;if(null==(a=this.options.extensions)?void 0:a.startInline){let t,n=1/0,i=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},i),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(r=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(d=n.raw.slice(-1)),c=!0;let r=t.at(-1);"text"===(null==r?void 0:r.type)?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}return t}},AF=class{constructor(e){o(this,"options"),o(this,"parser"),this.options=e||wB}space(e){return""}code({text:e,lang:t,escaped:n}){var r;let i=null==(r=(t||"").match(AB.notSpaceStart))?void 0:r[0],o=e.replace(AB.endingNewline,"")+"\n";return i?'<pre><code class="language-'+TF(i)+'">'+(n?o:TF(o,!0))+"</code></pre>\n":"<pre><code>"+(n?o:TF(o,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o<e.items.length;o++){let t=e.items[o];r+=this.listitem(t)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){var t;let n="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===(null==(t=e.tokens[0])?void 0:t.type)?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=r+" "+TF(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):n+=r+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){let t=e.rows[i];n="";for(let e=0;e<t.length;e++)n+=this.tablecell(t[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${TF(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=CF(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+TF(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=CF(e);if(null===i)return TF(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${TF(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:TF(e.text)}},kF=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},IF=class e{constructor(e){o(this,"options"),o(this,"renderer"),o(this,"textRenderer"),this.options=e||wB,this.options.renderer=this.options.renderer||new AF,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kF}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){var n,r;let i="";for(let o=0;o<e.length;o++){let a=e[o];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[a.type]){let e=a,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){i+=t||"";continue}}let s=a;switch(s.type){case"space":i+=this.renderer.space(s);continue;case"hr":i+=this.renderer.hr(s);continue;case"heading":i+=this.renderer.heading(s);continue;case"code":i+=this.renderer.code(s);continue;case"table":i+=this.renderer.table(s);continue;case"blockquote":i+=this.renderer.blockquote(s);continue;case"list":i+=this.renderer.list(s);continue;case"html":i+=this.renderer.html(s);continue;case"def":i+=this.renderer.def(s);continue;case"paragraph":i+=this.renderer.paragraph(s);continue;case"text":{let n=s,r=this.renderer.text(n);for(;o+1<e.length&&"text"===e[o+1].type;)n=e[++o],r+="\n"+this.renderer.text(n);i+=t?this.renderer.paragraph({type:"paragraph",raw:r,text:r,tokens:[{type:"text",raw:r,text:r,escaped:!0}]}):r;continue}default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return i}parseInline(e,t=this.renderer){var n,r;let i="";for(let o=0;o<e.length;o++){let a=e[o];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[a.type]){let e=this.options.extensions.renderers[a.type].call({parser:this},a);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=e||"";continue}}let s=a;switch(s.type){case"escape":case"text":i+=t.text(s);break;case"html":i+=t.html(s);break;case"link":i+=t.link(s);break;case"image":i+=t.image(s);break;case"strong":i+=t.strong(s);break;case"em":i+=t.em(s);break;case"codespan":i+=t.codespan(s);break;case"br":i+=t.br(s);break;case"del":i+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return i}},DF=(r=class{constructor(e){o(this,"options"),o(this,"block"),this.options=e||wB}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?RF.lex:RF.lexInline}provideParser(){return this.block?IF.parse:IF.parseInline}},o(r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),o(r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),r),MF=new class{constructor(...e){o(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),o(this,"options",this.setOptions),o(this,"parse",this.parseMarkdown(!0)),o(this,"parseInline",this.parseMarkdown(!1)),o(this,"Parser",IF),o(this,"Renderer",AF),o(this,"TextRenderer",kF),o(this,"Lexer",RF),o(this,"Tokenizer",xF),o(this,"Hooks",DF),this.use(...e)}walkTokens(e,t){var n,r;let i=[];for(let o of e)switch(i=i.concat(t.call(this,o)),o.type){case"table":{let e=o;for(let n of e.header)i=i.concat(this.walkTokens(n.tokens,t));for(let n of e.rows)for(let e of n)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=o;i=i.concat(this.walkTokens(e.items,t));break}default:{let e=o;(null==(r=null==(n=this.defaults.extensions)?void 0:n.childTokens)?void 0:r[e.type])?this.defaults.extensions.childTokens[e.type].forEach(n=>{let r=e[n].flat(1/0);i=i.concat(this.walkTokens(r,t))}):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new AF(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new xF(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new DF;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],o=t[r];DF.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&DF.passThroughHooksRespectAsync.has(n))return Promise.resolve(i.call(t,e)).then(e=>o.call(t,e));let r=i.call(t,e);return o.call(t,r)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return RF.lex(e,t??this.defaults)}parser(e,t){return IF.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let a=i.hooks?i.hooks.provideLexer():e?RF.lex:RF.lexInline,s=i.hooks?i.hooks.provideParser():e?IF.parse:IF.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>a(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let e=a(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(l){return o(l)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+TF(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function LF(e,t){return MF.parse(e,t)}LF.options=LF.setOptions=function(e){return MF.setOptions(e),LF.defaults=MF.defaults,OB(LF.defaults),LF},LF.getDefaults=NB,LF.defaults=wB,LF.use=function(...e){return MF.use(...e),LF.defaults=MF.defaults,OB(LF.defaults),LF},LF.walkTokens=function(e,t){return MF.walkTokens(e,t)},LF.parseInline=MF.parseInline,LF.Parser=IF,LF.parser=IF.parse,LF.Renderer=AF,LF.TextRenderer=kF,LF.Lexer=RF,LF.lexer=RF.lex,LF.Tokenizer=xF,LF.Hooks=DF,LF.parse=LF,LF.options,LF.setOptions,LF.use,LF.walkTokens,LF.parseInline,IF.parse,RF.lex;const PF=RT({__name:"FloatAi",props:{editor:Object,info:Object},emits:["close"],setup(e,{emit:n}){const r=e;let i=t.ref({top:0,left:0});const o=t.computed(()=>({top:i.value.top+"px",left:"20px"}));t.onMounted(()=>{(()=>{if(!r.editor)return;const{from:e,to:t}=r.editor.state.selection;if(e===t)return void(visible.value=!1);const n=r.editor.view.coordsAtPos(e),o=r.editor.view.coordsAtPos(t),a=r.editor.view.dom.getBoundingClientRect();i.value={top:Math.max(n.top,o.top)-a.top+50}})()});const a=n,s=()=>{a("close")};return(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:"ai-content",style:t.normalizeStyle(o.value)},[t.createVNode(rD,{editor:e.editor,apiHost:e.info.apiHost,token:e.info.token,askUrl:e.info.askUrl,answerUrl:e.info.answerUrl,onClose:s,isBubble:!0},null,8,["editor","apiHost","token","askUrl","answerUrl"])],4))}},[["__scopeId","data-v-39837116"]]),BF={key:0,class:"editor-wrapper-toolbar"},FF={key:1},UF={class:"editor-content-container"},zF={ref:"blockMenuRef"},GF=["src"],$F={class:"source-dialog-content"},qF={class:"dialog-footer"},HF={key:2,class:"editor-bottom"},VF={class:"editor-bottom-r"},YF=RT({__name:"index",props:{info:{type:Object,default:()=>({})},limitLength:{type:Number,default:1/0},height:{type:String,default:"100%"},content:{type:String,default:""},isInline:{type:Boolean,default:!1},showMenu:{type:Array,default:()=>[]},placeholder:{type:String,default:"输入 / 调出菜单"}},emits:["update:content"],setup(e,{emit:r}){t.ref(!0);const{appContext:i}=t.getCurrentInstance();i.app.directive("loading",n.ElLoading.directive);const o=e;let a=t.ref(!1);const s=t.ref({isOpen:!1,coords:{left:0,top:0},selectedIndex:0,range:null}),l=()=>{const{state:e,view:n}=d,{selection:r}=e,{$from:i}=r,o=i.parent.textBetween(0,i.parentOffset,void 0,"");if(o.endsWith("/")&&!o.endsWith("//")){const e=i.pos-1;s.value.range={from:e,to:e+1},t.nextTick(()=>{const t=d.view.dom,n=d.view.coordsAtPos(e),r=t.getBoundingClientRect(),i={left:n.left-r.left+t.scrollLeft,top:n.bottom-r.top+t.scrollTop};s.value.coords={left:i.left,top:i.top+30},s.value.isOpen=!0,s.value.selectedIndex=0})}else s.value.isOpen=!1};let c=t.ref(null);const d=tB({content:o.content,info:o.info,limit:o.limitLength,isInline:o.isInline,showMenu:o.showMenu,placeholder:o.placeholder,blockMenuFn:e=>{a.value=e},editorWrapper:c.value,checkSlashTrigger:l});function p(e){const{state:t}=e,{$from:n}=t.selection;return n.parent.textBetween(0,n.parentOffset,void 0,"")}function u(e){if(s.value.isOpen){try{const{from:t,to:n}=d.state.selection;if(p(d).endsWith("/")&&"undele"!=e){const e=t-1;d.chain().focus().deleteRange({from:e,to:t}).run()}s.value.isOpen=!1,s.value.range=null}finally{}"ai"==e?(d.chain().focus().insertContent({type:"aiAssistant"}).run(),d.setEditable(!1)):"codeblock"==e?d.chain().focus().insertContent({type:"codeBlock",attrs:{language:"javascript"}}).run():"function"==typeof e?t.nextTick(()=>{e()}):e&&"undele"!=e&&e()}}function m(e){if(!s.value.isOpen)return;const n=e.target,r=t.ref(null).value,i=d.view.dom;if(!r||!r.contains(n)){if(i.contains(n)){const t=d.view.posAtCoords({left:e.clientX,top:e.clientY}),n=s.value.range;if(t&&n&&t.pos>=n.from&&t.pos<=n.to)return}u()}}let _=t.ref(!1),g=t.ref({});const h=r;d.on("update",({editor:e})=>{const t=p(e);if(t.endsWith("//"))return void(s.value.isOpen&&u("undele"));if(t.endsWith("/")&&!t.endsWith("//"))return void l();s.value.isOpen&&u();let n=uI(e.state.doc);h("update:content",e.getHTML(),n)});let f=t.ref(!1);const b=()=>{f.value=!0,t.nextTick(()=>{const{tr:e}=d.state;d.view.dispatch(e)})},E=()=>{f.value=!1,d.setEditable(!0)},S=t.ref(null);let v=t.ref("");const y=e=>{v.value=e||"",S.value.open()};t.ref(0),t.onMounted(()=>{o.content&&(a.value=!0,mI({editor:d,content:o.content,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&(a.value=!1)}})),window.addEventListener("tiptap-image-click",N),document.addEventListener("click",m)});const T=t.ref(!1),C=t.ref("");function N(e){C.value=e.detail,T.value=!0}const w=t.ref(!1),O=t.ref("");function x(){O.value=d.getHTML(),w.value=!0}function R(){try{a.value=!0,d.commands.clearContent(),mI({editor:d,content:O.value,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&(a.value=!1)}}),w.value=!1,n.ElMessage.success("源代码已应用")}catch(e){n.ElMessage.error("应用源代码失败,请检查代码格式")}}const A=e=>{a.value=e};return t.onBeforeUnmount(()=>{d&&d.destroy(),window.removeEventListener("tiptap-image-click",N),document.removeEventListener("click",m)}),(r,i)=>{const o=t.resolveDirective("loading");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["tiptap-vue",{"is-inline":e.isInline}]),style:t.normalizeStyle({height:e.height})},[t.createElementVNode("div",{class:"editor-wrapper",style:t.normalizeStyle([{height:"100%"},{border:e.isInline?"none":"1px solid #eeeeee"}])},[e.isInline?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",BF,[t.createVNode(bB,{editor:t.unref(d),info:e.info,limitLength:e.limitLength,showMenu:e.showMenu,onShowLink:i[0]||(i[0]=e=>y("top")),onToggleLoading:A,onShowAi:b,onShowSource:x},null,8,["editor","info","limitLength","showMenu"])])),e.isInline||t.unref(f)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",FF,[t.createVNode(SB,{editor:t.unref(d),info:e.info,showMenu:e.showMenu,onShowAi:b,onShowLink:i[1]||(i[1]=e=>y())},null,8,["editor","info","showMenu"])])),t.createVNode(CB,{editor:t.unref(d),showToolbar:t.unref(_),"onUpdate:showToolbar":i[2]||(i[2]=e=>t.isRef(_)?_.value=e:_=e),toolbarStyle:t.unref(g),"onUpdate:toolbarStyle":i[3]||(i[3]=e=>t.isRef(g)?g.value=e:g=e),editorWrapper:t.unref(c)},null,8,["editor","showToolbar","toolbarStyle","editorWrapper"]),t.withDirectives((t.openBlock(),t.createElementBlock("div",UF,[t.createElementVNode("div",{class:t.normalizeClass(["editor-content",{noPadding:e.isInline}]),ref_key:"editorWrapper",ref:c},[t.createVNode(t.unref(Tl),{editor:t.unref(d),style:{width:"100%",height:"calc(100% - 40px)"}},null,8,["editor"]),t.unref(f)?(t.openBlock(),t.createBlock(PF,{key:0,editor:t.unref(d),info:e.info,onClose:E},null,8,["editor","info"])):t.createCommentVNode("",!0),t.createVNode(YM,{ref_key:"linkRef",ref:S,editor:t.unref(d),editorWrapper:t.unref(c),linkPosition:t.unref(v)},null,8,["editor","editorWrapper","linkPosition"]),t.withDirectives(t.createElementVNode("div",zF,[t.createVNode(QP,{editor:t.unref(d),editorWrapper:t.unref(c),coords:s.value.coords,apiHost:e.info.apiHost,token:e.info.token,uploadUrl:e.info.uploadUrl,uploadJupyter:e.info.uploadJupyter,uploadDoc:e.info.uploadDoc,getFileContent:e.info.getFileContent,showMenu:e.showMenu,onToggleLoading:A,onClosemenu:u,onShowLink:i[4]||(i[4]=e=>y())},null,8,["editor","editorWrapper","coords","apiHost","token","uploadUrl","uploadJupyter","uploadDoc","getFileContent","showMenu"])],512),[[t.vShow,s.value.isOpen&&!e.isInline]]),t.createVNode(t.unref(n.ElDialog),{modelValue:T.value,"onUpdate:modelValue":i[5]||(i[5]=e=>T.value=e),width:"60%"},{default:t.withCtx(()=>[t.createElementVNode("img",{src:C.value,style:{width:"100%"}},null,8,GF)]),_:1},8,["modelValue"]),t.createVNode(t.unref(n.ElDialog),{modelValue:w.value,"onUpdate:modelValue":i[8]||(i[8]=e=>w.value=e),title:"查看源代码",width:"70%","close-on-click-modal":!1},{footer:t.withCtx(()=>[t.createElementVNode("span",qF,[t.createVNode(t.unref(n.ElButton),{onClick:i[7]||(i[7]=e=>w.value=!1)},{default:t.withCtx(()=>[...i[9]||(i[9]=[t.createTextVNode("取消",-1)])]),_:1}),t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:R},{default:t.withCtx(()=>[...i[10]||(i[10]=[t.createTextVNode("确认",-1)])]),_:1})])]),default:t.withCtx(()=>[t.createElementVNode("div",$F,[t.createVNode(t.unref(n.ElInput),{modelValue:O.value,"onUpdate:modelValue":i[6]||(i[6]=e=>O.value=e),type:"textarea",rows:20,placeholder:"HTML源代码"},null,8,["modelValue"])])]),_:1},8,["modelValue"])],2)])),[[o,t.unref(a)]]),e.limitLength==1/0||e.isInline?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",HF,[t.createElementVNode("div",null,[t.renderSlot(r.$slots,"default",{},void 0,!0)]),t.createElementVNode("div",VF,t.toDisplayString(t.unref(uI)(t.unref(d).state.doc))+"/"+t.toDisplayString(e.limitLength),1)]))],4)],6)}}},[["__scopeId","data-v-61a8ac4c"]]),jF=[{name:"TiptapVue",component:YF}],WF={install:e=>{jF.forEach(t=>{e.component(t.name,t.component)})}};e.TiptapVue=YF,e.default=WF,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
20
+ function(){var t=e,n=t.lib,r=n.WordArray,i=n.Hasher,o=t.algo,a=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),p=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=o.RIPEMD160=i.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,u,E,S,v,y,T,C,N,w,O,x=this._hash.words,R=d.words,A=p.words,k=a.words,I=s.words,D=l.words,M=c.words;for(y=o=x[0],T=u=x[1],C=E=x[2],N=S=x[3],w=v=x[4],n=0;n<80;n+=1)O=o+e[t+k[n]]|0,O+=n<16?m(u,E,S)+R[0]:n<32?_(u,E,S)+R[1]:n<48?g(u,E,S)+R[2]:n<64?h(u,E,S)+R[3]:f(u,E,S)+R[4],O=(O=b(O|=0,D[n]))+v|0,o=v,v=S,S=b(E,10),E=u,u=O,O=y+e[t+I[n]]|0,O+=n<16?f(T,C,N)+A[0]:n<32?h(T,C,N)+A[1]:n<48?g(T,C,N)+A[2]:n<64?_(T,C,N)+A[3]:m(T,C,N)+A[4],O=(O=b(O|=0,M[n]))+w|0,y=w,w=N,N=b(C,10),C=T,T=O;O=x[1]+E+N|0,x[1]=x[2]+S+w|0,x[2]=x[3]+v+y|0,x[3]=x[4]+o+T|0,x[4]=x[0]+u+C|0,x[0]=O},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function m(e,t,n){return e^t^n}function _(e,t,n){return e&t|~e&n}function g(e,t,n){return(e|~t)^n}function h(e,t,n){return e&n|t&~n}function f(e,t,n){return e^(t|~n)}function b(e,t){return e<<t|e>>>32-t}t.RIPEMD160=i._createHelper(u),t.HmacRIPEMD160=i._createHmacHelper(u)}(),e.RIPEMD160)),PL.exports;var e}(),UL(),function(){return zL||(zL=1,GL.exports=(l=eL(),CL(),UL(),t=(e=l).lib,n=t.Base,r=t.WordArray,i=e.algo,o=i.SHA256,a=i.HMAC,s=i.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:o,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=a.create(n.hasher,e),o=r.create(),s=r.create([1]),l=o.words,c=s.words,d=n.keySize,p=n.iterations;l.length<d;){var u=i.update(t).finalize(s);i.reset();for(var m=u.words,_=m.length,g=u,h=1;h<p;h++){g=i.finalize(g),i.reset();for(var f=g.words,b=0;b<_;b++)m[b]^=f[b]}o.concat(u),c[0]++}return o.sigBytes=4*d,o}}),e.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},l.PBKDF2)),GL.exports;var e,t,n,r,i,o,a,s,l}(),HL(),jL(),function(){return WL||(WL=1,KL.exports=(e=eL(),jL(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,r.encryptBlock(i,0);for(var a=0;a<n;a++)e[t+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;n.call(this,e,t,i,r),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=e.slice(t,t+i);n.call(this,e,t,i,r),this._prevBlock=o}}),t}(),e.mode.CFB)),KL.exports;var e}(),function(){return QL||(QL=1,ZL.exports=(n=eL(),jL(),n.mode.CTR=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0);var a=o.slice(0);n.encryptBlock(a,0),o[r-1]=o[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=a[s]}}),e.Decryptor=t,e),n.mode.CTR)),ZL.exports;var e,t,n}(),eP(),function(){return tP||(tP=1,nP.exports=(n=eL(),jL(),n.mode.OFB=(e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=this._iv,o=this._keystream;i&&(o=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(o,0);for(var a=0;a<r;a++)e[t+a]^=o[a]}}),e.Decryptor=t,e),n.mode.OFB)),nP.exports;var e,t,n}(),function(){return rP||(rP=1,iP.exports=(t=eL(),jL(),t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),e.Decryptor=e.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),e),t.mode.ECB)),iP.exports;var e,t}(),function(){return oP||(oP=1,aP.exports=(e=eL(),jL(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,i=r-n%r,o=n+i-1;e.clamp(),e.words[o>>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923)),aP.exports;var e}(),function(){return sP||(sP=1,lP.exports=(e=eL(),jL(),e.pad.Iso10126={pad:function(t,n){var r=4*n,i=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126)),lP.exports;var e}(),function(){return cP||(cP=1,dP.exports=(e=eL(),jL(),e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971)),dP.exports;var e}(),function(){return pP||(pP=1,uP.exports=(e=eL(),jL(),e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding)),uP.exports;var e}(),function(){return mP||(mP=1,_P.exports=(e=eL(),jL(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)),_P.exports;var e}(),function(){return gP||(gP=1,hP.exports=(r=eL(),jL(),t=(e=r).lib.CipherParams,n=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var r=n.parse(e);return t.create({ciphertext:r})}},r.format.Hex)),hP.exports;var e,t,n,r}(),function(){return fP||(fP=1,bP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],o=[],a=[],s=[],l=[],c=[],d=[],p=[],u=[],m=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var _=r^r<<1^r<<2^r<<3^r<<4;_=_>>>8^255&_^99,i[n]=_,o[_]=n;var g=e[n],h=e[g],f=e[h],b=257*e[_]^16843008*_;a[n]=b<<24|b>>>8,s[n]=b<<16|b>>>16,l[n]=b<<8|b>>>24,c[n]=b,b=16843009*f^65537*h^257*g^16843008*n,d[_]=b<<24|b>>>8,p[_]=b<<16|b>>>16,u[_]=b<<8|b>>>24,m[_]=b,n?(n=g^e[e[e[f^g]]],r^=e[e[r]]):n=r=1}}();var _=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),o=this._keySchedule=[],a=0;a<r;a++)a<n?o[a]=t[a]:(c=o[a-1],a%n?n>6&&a%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=_[a/n|0]<<24),o[a]=o[a-n]^c);for(var s=this._invKeySchedule=[],l=0;l<r;l++){if(a=r-l,l%4)var c=o[a];else c=o[a-4];s[l]=l<4||a<=4?c:d[i[c>>>24]]^p[i[c>>>16&255]]^u[i[c>>>8&255]]^m[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,l,c,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,d,p,u,m,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,a,s){for(var l=this._nRounds,c=e[t]^n[0],d=e[t+1]^n[1],p=e[t+2]^n[2],u=e[t+3]^n[3],m=4,_=1;_<l;_++){var g=r[c>>>24]^i[d>>>16&255]^o[p>>>8&255]^a[255&u]^n[m++],h=r[d>>>24]^i[p>>>16&255]^o[u>>>8&255]^a[255&c]^n[m++],f=r[p>>>24]^i[u>>>16&255]^o[c>>>8&255]^a[255&d]^n[m++],b=r[u>>>24]^i[c>>>16&255]^o[d>>>8&255]^a[255&p]^n[m++];c=g,d=h,p=f,u=b}g=(s[c>>>24]<<24|s[d>>>16&255]<<16|s[p>>>8&255]<<8|s[255&u])^n[m++],h=(s[d>>>24]<<24|s[p>>>16&255]<<16|s[u>>>8&255]<<8|s[255&c])^n[m++],f=(s[p>>>24]<<24|s[u>>>16&255]<<16|s[c>>>8&255]<<8|s[255&d])^n[m++],b=(s[u>>>24]<<24|s[c>>>16&255]<<16|s[d>>>8&255]<<8|s[255&p])^n[m++],e[t]=g,e[t+1]=h,e[t+2]=f,e[t+3]=b},keySize:8});t.AES=n._createHelper(g)}(),e.AES)),bP.exports;var e}(),vP(),function(){return yP||(yP=1,TP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],i=0;i<256;i++)r[i]=i;i=0;for(var o=0;i<256;i++){var a=i%n,s=t[a>>>2]>>>24-a%4*8&255;o=(o+r[i]+s)%256;var l=r[i];r[i]=r[o],r[o]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,r=0,i=0;i<4;i++){n=(n+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[n],e[n]=o,r|=e[(e[t]+e[n])%256]<<24-8*i}return this._i=t,this._j=n,r}t.RC4=n._createHelper(i);var a=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=n._createHelper(a)}(),e.RC4)),TP.exports;var e}(),function(){return CP||(CP=1,NP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],o=[],a=[],s=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)l.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var o=t.words,a=o[0],s=o[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),p=c>>>16|4294901760&d,u=d<<16|65535&c;for(i[0]^=c,i[1]^=p,i[2]^=d,i[3]^=u,i[4]^=c,i[5]^=p,i[6]^=d,i[7]^=u,n=0;n<4;n++)l.call(this)}},_doProcessBlock:function(e,t){var n=this._X;l.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)i[r]=16711935&(i[r]<<8|i[r]>>>24)|4278255360&(i[r]<<24|i[r]>>>8),e[t+r]^=i[r]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],i=65535&r,s=r>>>16,l=((i*i>>>17)+i*s>>>15)+s*s,c=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=n._createHelper(s)}(),e.Rabbit)),NP.exports;var e}(),function(){return wP||(wP=1,OP.exports=(e=eL(),uL(),bL(),HL(),jL(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],o=[],a=[],s=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=n[i+4&7];if(t){var o=t.words,a=o[0],s=o[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),p=c>>>16|4294901760&d,u=d<<16|65535&c;for(r[0]^=c,r[1]^=p,r[2]^=d,r[3]^=u,r[4]^=c,r[5]^=p,r[6]^=d,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var n=this._X;l.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)i[r]=16711935&(i[r]<<8|i[r]>>>24)|4278255360&(i[r]<<24|i[r]>>>8),e[t+r]^=i[r]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],i=65535&r,s=r>>>16,l=((i*i>>>17)+i*s>>>15)+s*s,c=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=l^c}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=n._createHelper(s)}(),e.RabbitLegacy)),OP.exports;var e}(),PP());const BP=Hm(QM.exports),FP="0face1314520face";const UP={encrypt:function(e){const t=BP.enc.Utf8.parse(FP),n=BP.enc.Utf8.parse(FP);return BP.AES.encrypt(e,t,{iv:n,mode:BP.mode.CBC,padding:BP.pad.Pkcs7}).toString()},decrypt:function(e){const t=BP.enc.Utf8.parse(FP),n=BP.enc.Utf8.parse(FP);return BP.AES.decrypt(e,t,{iv:n,mode:BP.mode.CBC,padding:BP.pad.Pkcs7}).toString(BP.enc.Utf8)}},zP={class:"floating-menu-top"},GP={class:"floating-menu-top-btns"},$P={class:"floating-menu-common"},qP={class:"floating-menu-common-list"},HP={class:"block-menu-item-icon"},VP={class:"block-menu-item"},YP={class:"block-menu-item-icon"},jP={class:"block-menu-item-icon"},WP={class:"block-menu-item-icon"},KP={class:"block-menu-item-icon"},QP=RT({__name:"BlockMenu",props:{editor:Object,apiHost:String,token:String,uploadUrl:String,uploadJupyter:String,uploadDoc:String,getFileContent:String,showMenu:{type:Array,default:()=>[]},coords:{type:Object,default:()=>({left:0,top:0})},editorWrapper:Object},emits:["toggleLoading","closemenu","showLink"],setup(e,{emit:r}){const i=e,o=t.reactive({paragraph:!1,heading1:!1,heading2:!1,heading3:!1,heading4:!1,heading5:!1,heading6:!1,bulletList:!1,orderedList:!1,taskList:!1,link:!1,codeBlock:!1,undo:!1,redo:!1}),a=(e,t)=>i.editor.isActive(e,t),s=t.ref(null),l=()=>{c(),u("closemenu"),u("showLink")},c=e=>{Object.keys(o).forEach(e=>o[e]=!1),e&&t.nextTick(()=>{u("closemenu",()=>{e&&e()})})},d=e=>{u("closemenu")},p=e=>{i.editor.chain().focus().setImage({src:e.data.show_url}).run()},u=r,m=()=>{a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")||(u("toggleLoading",!0),u("closemenu"))},_=e=>{let t={config:{apiHost:i.apiHost,token:i.token,getFileContent:i.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||"");mI({editor:i.editor,content:t,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},g=()=>{a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")||(u("toggleLoading",!0),c(),u("closemenu"))},h=e=>{let t={config:{apiHost:i.apiHost,token:i.token,getFileContent:i.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||"");mI({editor:i.editor,content:t,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},f=()=>{c(),u("closemenu","ai")},b=()=>{a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")||(c(),u("closemenu","codeblock"))};let E=t.ref(!1),S=t.ref(null);const v=e=>{S.value=e,E.value=!1,t.nextTick(()=>{u("closemenu",()=>{setTimeout(()=>{const{state:e}=i.editor,{$from:t}=e.selection,n=t.node();n&&"paragraph"===n.type.name&&n.content.size>0?i.editor.chain().focus().insertContent("<p></p>").insertTable({rows:S.value.row,cols:S.value.col,withHeaderRow:!0}).run():i.editor.chain().focus().insertTable({rows:S.value.row,cols:S.value.col,withHeaderRow:!0}).run()},50)})})};return(r,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{class:"floating-menu-cont",style:t.normalizeStyle({left:e.coords.left+"px",top:e.coords.top+"px"})},[t.createElementVNode("div",zP,[i[23]||(i[23]=t.createElementVNode("p",{class:"floating-menu-tit"},"基础",-1)),t.createElementVNode("div",GP,[t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"正文",placement:"bottom",visible:o.paragraph,"onUpdate:visible":i[1]||(i[1]=e=>o.paragraph=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-paragraph",width:"20",onClick:i[0]||(i[0]=t=>{c(()=>{e.editor.chain().focus().setParagraph().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"标题1",placement:"bottom",visible:o.heading1,"onUpdate:visible":i[3]||(i[3]=e=>o.heading1=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-1",width:"20",onClick:i[2]||(i[2]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:1}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:2,class:"box-item",effect:"dark",content:"标题2",placement:"bottom",visible:o.heading2,"onUpdate:visible":i[5]||(i[5]=e=>o.heading2=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-2",width:"20",onClick:i[4]||(i[4]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:2}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:3,class:"box-item",effect:"dark",content:"标题3",placement:"bottom",visible:o.heading3,"onUpdate:visible":i[7]||(i[7]=e=>o.heading3=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-3",width:"20",onClick:i[6]||(i[6]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:3}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"标题4",placement:"bottom",visible:o.heading4,"onUpdate:visible":i[9]||(i[9]=e=>o.heading4=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-4",width:"20",onClick:i[8]||(i[8]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:4}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"标题5",placement:"bottom",visible:o.heading5,"onUpdate:visible":i[11]||(i[11]=e=>o.heading5=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-5",width:"20",onClick:i[10]||(i[10]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:5}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"标题6",placement:"bottom",visible:o.heading6,"onUpdate:visible":i[13]||(i[13]=e=>o.heading6=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-header-6",width:"20",onClick:i[12]||(i[12]=t=>{c(()=>{e.editor.chain().focus().setHeading({level:6}).run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("bulletList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:7,class:"box-item",effect:"dark",content:"无序列表",placement:"bottom",visible:o.bulletList,"onUpdate:visible":i[15]||(i[15]=e=>o.bulletList=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-bulleted",width:"20",onClick:i[14]||(i[14]=t=>{c(()=>{e.editor.chain().focus().toggleBulletList().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("orderedList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:8,class:"box-item",effect:"dark",content:"有序列表",placement:"bottom",visible:o.orderedList,"onUpdate:visible":i[17]||(i[17]=e=>o.orderedList=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-numbered",width:"20",onClick:i[16]||(i[16]=t=>{c(()=>{e.editor.chain().focus().toggleOrderedList().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("taskList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:9,class:"box-item",effect:"dark",content:"待办列表",placement:"bottom",visible:o.taskList,"onUpdate:visible":i[19]||(i[19]=e=>o.taskList=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-checkbox",width:"20",onClick:i[18]||(i[18]=t=>{c(()=>{e.editor.chain().focus().toggleTaskList().run()})})})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("link",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:10,class:"box-item",effect:"dark",content:"链接",placement:"bottom",visible:o.link,"onUpdate:visible":i[20]||(i[20]=e=>o.link=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:link-variant",width:"20",onClick:l})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(pI)("codeBlock",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:11,class:"box-item",effect:"dark",content:"代码块",placement:"bottom",visible:o.codeBlock,"onUpdate:visible":i[21]||(i[21]=e=>o.codeBlock=e)},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:code-braces-box",class:t.normalizeClass(a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")?"icon-gray":""),width:"20",onClick:b},null,8,["class"])]),_:1},8,["visible"])):t.createCommentVNode("",!0)])]),t.createElementVNode("div",$P,[i[29]||(i[29]=t.createElementVNode("p",{class:"floating-menu-tit"},"通用",-1)),t.createElementVNode("div",qP,[t.unref(pI)("ai",e.showMenu)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"block-menu-item",onClick:f},[t.createElementVNode("div",HP,[t.createVNode(t.unref(xT),{icon:"hugeicons:ai-chat-02"})]),i[24]||(i[24]=t.createElementVNode("div",null,"AI创作",-1))])):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-file","show-file-list":!1,action:e.apiHost+e.uploadUrl,data:{type:2},headers:{"access-token":e.token},accept:".jpg,.png,.jpeg,.gif","before-upload":d,"on-success":p},{default:t.withCtx(()=>[t.createElementVNode("div",VP,[t.createElementVNode("div",YP,[t.createVNode(t.unref(xT),{icon:"material-symbols:imagesmode-outline-sharp"})]),i[25]||(i[25]=t.createElementVNode("div",null,"上传本地图片",-1))])]),_:1},8,["action","headers"]),[[t.vShow,t.unref(pI)("image",e.showMenu)]]),t.withDirectives(t.createElementVNode("div",null,[t.createVNode(t.unref(n.ElPopover),{placement:"right",width:224,visible:t.unref(E),"onUpdate:visible":i[22]||(i[22]=e=>t.isRef(E)?E.value=e:E=e),disabled:a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")},{reference:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")}]),ref:"tableRef"},[t.createElementVNode("div",jP,[t.createVNode(t.unref(xT),{icon:"material-symbols:table-outline-sharp",width:"20"})]),i[26]||(i[26]=t.createElementVNode("div",null,"表格",-1))],2)]),default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(KM,{onSelect:v})])]),_:1},8,["visible","disabled"])],512),[[t.vShow,t.unref(pI)("table",e.showMenu)]]),t.withDirectives(t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-file","show-file-list":!1,action:e.apiHost+e.uploadDoc,data:{type:2},headers:{"access-token":e.token},accept:".doc,.docx","on-success":_,"before-upload":m,disabled:a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")}])},[t.createElementVNode("div",WP,[t.createVNode(t.unref(xT),{icon:"tabler:file-word"})]),i[27]||(i[27]=t.createElementVNode("div",null,"上传word文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(pI)("doc",e.showMenu)]]),t.withDirectives(t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-file","show-file-list":!1,action:e.apiHost+e.uploadJupyter,data:{type:2},headers:{"access-token":e.token},accept:".ipynb","on-success":h,"before-upload":g,disabled:a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":a("codeBlock")||a("table")||a("bulletList")||a("orderedList")||a("taskList")}])},[t.createElementVNode("div",KP,[t.createVNode(t.unref(xT),{icon:"logos:jupyter"})]),i[28]||(i[28]=t.createElementVNode("div",null,"上传jupyter文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(pI)("jupyter",e.showMenu)]])])])],4),t.createVNode(YM,{ref_key:"linkRef",ref:s,editor:e.editor},null,8,["editor"])],64))}},[["__scopeId","data-v-49f2614c"]]);function ZP(e,n){const r=new At("blockMenu");let i=n.wrapperEl||null;const o={isPopoverOpen:!1};return new Ot({key:r,view(a){let s=document.createElement("div");s.className="block-menu-container",s.style.display="none",s.style.position="absolute",s.style.zIndex=9999,n.props.editorWrapper&&(n.props.editorWrapper.style.position="relative",n.props.editorWrapper.appendChild(s));const l=t.createApp({render:()=>t.h(QP,{editor:e,menuState:o,...n.props})});l.mount(s);let c=null,d=!1,p=null;function u(){s.style.display="none",c=null}function m(){clearTimeout(p),p=setTimeout(()=>{d||c&&c.matches(":hover")||u()},100)}function _(e){clearTimeout(p);!function(e){if(c=e,o.isPopoverOpen)return;const t=e.getBoundingClientRect(),n=a.dom.getBoundingClientRect();s.style.display="block",s.style.top=t.top-n.top+30+"px",s.style.left=t.left-n.left+"px"}(e.currentTarget)}function g(){m()}function h(){Array.from(a.dom.children).filter(e=>["P","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE","TABLE","DIV"].includes(e.tagName)).forEach(e=>{e.removeEventListener("mouseenter",_),e.removeEventListener("mouseleave",g),e.addEventListener("mouseenter",_),e.addEventListener("mouseleave",g)})}s.addEventListener("mouseenter",()=>{clearTimeout(p),d=!0}),s.addEventListener("mouseleave",()=>{d=!1,m()}),h();const f={update(){h(),c&&!a.dom.contains(c)&&u()},destroy(){s.remove(),l.unmount()},setWrapper(e){i=e,i&&s&&i.appendChild(s)}};return e.storage[r.key]=f,f}})}$a.create({name:"blockMenuExtension",addOptions:()=>({props:{apiHost:"",token:"",uploadUrl:"",uploadDoc:"",uploadJupyter:"",getFileContent:"",isInline:!1,showMenu:[]}}),addProseMirrorPlugins(){return this.options.props.isInline?[]:[ZP(this.editor,this.options)]},addCommands(){return{setBlockMenuWrapper:e=>({editor:t})=>{var n;return this.options.wrapperEl=e,null==(n=t.storage.blockMenu$)||n.setWrapper(e),!0}}}});const XP=Tu.extend({addOptions(){var e;return{...null==(e=this.parent)?void 0:e.call(this),isInline:!1}},addAttributes(){var e;return{...null==(e=this.parent)?void 0:e.call(this),width:{default:null,renderHTML:e=>e.width?{width:e.width+"px"}:{},parseHTML:e=>{const t=e.getAttribute("width")||e.style.width;return t?parseInt(t):null}},height:{default:null,renderHTML:e=>e.height?{height:e.height+"px"}:{},parseHTML:e=>{const t=e.getAttribute("height")||e.style.height;return t?parseInt(t):null}}}},addProseMirrorPlugins(){const e=new At("customImageClick");return[new Ot({key:e,props:{handleDOMEvents:{click:()=>!1}}})]},addNodeView(){return({node:e,editor:t,getPos:n})=>{const r=this.options.isInline,i=document.createElement("div");i.style.position="relative",i.style.display="inline-block",i.style.lineHeight="0";const o=document.createElement("img");if(o.src=e.attrs.src,o.alt=e.attrs.alt||"",o.title=e.attrs.title||"",o.style.display="block",o.style.borderRadius="4px",e.attrs.width&&(o.style.width=e.attrs.width+"px"),e.attrs.height&&(o.style.height=e.attrs.height+"px"),r)return i.appendChild(o),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(o.src=e.attrs.src,o.alt=e.attrs.alt||"",o.title=e.attrs.title||"",e.attrs.width?o.style.width=e.attrs.width+"px":o.style.width="",e.attrs.height?o.style.height=e.attrs.height+"px":o.style.height="",!0),destroy:()=>{i.remove()}};const a=document.createElement("div");a.style.position="absolute",a.style.top="8px",a.style.right="8px",a.style.display="flex",a.style.gap="6px",a.style.opacity="0",a.style.visibility="hidden",a.style.transition="all .2s",a.style.zIndex="2";const s=(e,t)=>{const n=document.createElement("button");return n.type="button",n.title=t,n.style.width="30px",n.style.height="30px",n.style.padding="0",n.style.border="none",n.style.borderRadius="6px",n.style.background="rgba(0,0,0,.7)",n.style.color="#fff",n.style.cursor="pointer",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.transition="all .2s",n.style.boxShadow="0 2px 8px rgba(0,0,0,.2)",n.innerHTML=(e=>"view"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>':"reset"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>':"fit"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="18" height="12" rx="2" ry="2"></rect><polyline points="8 12 11 9 11 15 8 12"></polyline><polyline points="16 12 13 9 13 15 16 12"></polyline></svg>':"")(e),n.addEventListener("mouseenter",()=>{n.style.background="rgba(0,0,0,.9)"}),n.addEventListener("mouseleave",()=>{n.style.background="rgba(0,0,0,.7)"}),n},l=s("view","查看原图"),c=s("fit","适配编辑区宽度"),d=s("reset","重置大小");a.appendChild(l),a.appendChild(c),a.appendChild(d),l.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("tiptap-image-click",{detail:o.src}))}),d.addEventListener("click",r=>{if(r.preventDefault(),r.stopPropagation(),"function"==typeof n){const r=n(),i=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:null,height:null});t.view.dispatch(i)}}),c.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();const i=t.view.dom;if(!i)return;const a=Math.max(50,i.clientWidth-60),s=(o.naturalWidth||o.offsetWidth||1)/(o.naturalHeight||o.offsetHeight||1),l=Math.round(a),c=Math.round(l/s);if(o.style.width=l+"px",o.style.height=c+"px","function"==typeof n){const r=n(),i=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:l,height:c});t.view.dispatch(i)}});const p=["nw","ne","sw","se"],u={};p.forEach(e=>{u[e]=(e=>{const t=document.createElement("div");return t.dataset.position=e,t.style.position="absolute",t.style.width="8px",t.style.height="8px",t.style.background="#fff",t.style.border="2px solid rgb(37,108,251)",t.style.borderRadius="50%",t.style.opacity="0",t.style.visibility="hidden",t.style.transition="all .2s",t.style.zIndex="1",t.style.boxShadow="0 2px 6px rgba(0,0,0,.15)","nw"===e&&(t.style.top="-4px",t.style.left="10px",t.style.cursor="nwse-resize"),"ne"===e&&(t.style.top="-4px",t.style.right="14px",t.style.cursor="nesw-resize"),"sw"===e&&(t.style.bottom="-4px",t.style.left="10px",t.style.cursor="nesw-resize"),"se"===e&&(t.style.bottom="-4px",t.style.right="14px",t.style.cursor="nwse-resize"),t.addEventListener("mouseenter",()=>{t.style.background="rgb(37,108,251)",t.style.transform="scale(1.3)"}),t.addEventListener("mouseleave",()=>{t.style.background="#fff",t.style.transform="scale(1)"}),t})(e)});i.addEventListener("mouseenter",()=>{a.style.opacity="1",a.style.visibility="visible",Object.values(u).forEach(e=>{e.style.opacity="1",e.style.visibility="visible"})}),i.addEventListener("mouseleave",()=>{a.style.opacity="0",a.style.visibility="hidden",Object.values(u).forEach(e=>{e.style.opacity="0",e.style.visibility="hidden"})});return p.forEach(r=>{u[r].addEventListener("mousedown",i=>((r,i)=>{r.preventDefault(),r.stopPropagation();const a=r.clientX,s=r.clientY,l=o.offsetWidth,c=o.offsetHeight,d=l/c||1,p=i.includes("w"),u=i.includes("n"),m=e=>{let t,n,r=e.clientX-a,i=e.clientY-s;if(p&&(r=-r),u&&(i=-i),e.shiftKey)t=Math.max(50,l+r),n=Math.max(50,c+i);else{const e=(r+i)/2;t=Math.max(50,l+e),n=Math.max(50,t/d)}o.style.width=t+"px",o.style.height=n+"px"},_=r=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",_);let i,o,g=r.clientX-a,h=r.clientY-s;if(p&&(g=-g),u&&(h=-h),r.shiftKey)i=Math.max(50,l+g),o=Math.max(50,c+h);else{const e=(g+h)/2;i=Math.max(50,l+e),o=Math.max(50,i/d)}if("function"==typeof n){const r=n(),a=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:Math.round(i),height:Math.round(o)});t.view.dispatch(a)}};document.addEventListener("mousemove",m),document.addEventListener("mouseup",_)})(i,r))}),i.appendChild(o),i.appendChild(a),p.forEach(e=>i.appendChild(u[e])),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(o.src=e.attrs.src,o.alt=e.attrs.alt||"",o.title=e.attrs.title||"",e.attrs.width?o.style.width=e.attrs.width+"px":o.style.width="",e.attrs.height?o.style.height=e.attrs.height+"px":o.style.height="",!0),destroy:()=>{i.remove()}}}}});DN(),vp.extend({content:"inline*"});const JP=Um.extend({content:"(paragraph | bulletList | orderedList)*"});function eB(e,t){if(0===e.length)return"";const n=["<table>"];let r=!1,i=!1;for(let o=0;o<e.length;o++){const t=e[o];if("separator"===t.type){r=!0;continue}const a=t.content,s=a.substring(1,a.length-1).split("|");if(r&&!i){n.push("<thead><tr>");for(let e=0;e<s.length;e++)n.push("<th>",s[e].trim(),"</th>");n.push("</tr></thead><tbody>"),i=!0}else{i||(n.push("<tbody>"),i=!0),n.push("<tr>");for(let e=0;e<s.length;e++)n.push("<td>",s[e].trim(),"</td>");n.push("</tr>")}}return n.push("</tbody></table>"),n.join("")}const tB=({content:e="",info:t={},limit:r=50,isInline:i=!1,showMenu:o=[],placeholder:a="",blockMenuFn:s,editorWrapper:l,checkSlashTrigger:c}={})=>{const d=new yl({extensions:[cu.configure({paragraph:{},codeBlock:!1,blockquote:!0,heading:{levels:[1,2,3,4,5,6]},bulletList:!1,orderedList:!1,listItem:!1,strike:!1,bold:!0,italic:!0}),aD.configure({placeholder:({node:e,editor:t})=>{const n=t.state.doc;return 1===n.childCount&&"paragraph"===n.content.firstChild.type.name&&0===n.content.firstChild.content.size&&e===n.content.firstChild?a||"输入“/”插入内容":null},showOnlyWhenEditable:!0,showOnlyCurrent:!1}),du,uu,Eu,$m,FN,XP.configure({inline:!1,allowBase64:!1,isInline:i}),bu.configure({multicolor:!0}),Bm.configure({table:{resizable:!0},extensions:[JP,Fm,zm]}),UN,Fm,zm,Um,PN.configure({isInline:i}),tp.configure({HTMLAttributes:{class:"bullet-list"},nested:!0}),hp.configure({HTMLAttributes:{class:"ordered-list"},nested:!0}),np.configure({HTMLAttributes:{class:"list-item"},nested:!0}),Ep,bp.configure({nested:!1}),BN,Gm.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"],defaultAlignment:"left"}),Zd.configure({openOnClick:!1,defaultProtocol:"https"}),oD.configure({props:{apiHost:t.apiHost,token:t.token,askUrl:t.askUrl,answerUrl:t.answerUrl}}),(p={limit:r},$a.create({name:"characterLimiter",addProseMirrorPlugins:()=>[new Ot({key:new At("characterLimiter"),filterTransaction:(e,t)=>{if(!e.docChanged)return!0;const r=e=>{let t=0;return e.descendants(e=>{e.isText&&(t+=Array.from(e.text).length)}),t},i=r(t.doc),o=r(e.doc),a=p.limit;return!(o>a&&o>i&&(n.ElMessage.warning(`已超出最大字数限制:${a}`),1))}})]}))],editorProps:{handlePaste:(e,i,o)=>{var a,l;if(uI(e.state.doc)+o.content.size>r)return n.ElMessage.warning(`粘贴失败:内容将超过最大长度限制 ${r}。`),!0;const c=Array.from((null==(a=i.clipboardData)?void 0:a.items)||[]).find(e=>e.type.startsWith("image/"));if(c){i.preventDefault();const e=c.getAsFile();if(!e)return!1;const r=new FormData;r.append("file",e);return((e,t)=>lx({baseURL:e.config.apiHost,url:e.config.getFileContent,method:"post",token:e.config.token,data:t,onAuthFail:()=>{},onError:e=>n.ElMessage.error(e)}))({config:{apiHost:t.apiHost,token:t.token,getFileContent:t.uploadUrl}},r).then(e=>{e&&e.data&&e.data.show_url?d.chain().focus().setImage({src:e.data.show_url}).run():n.ElMessage.error("图片上传失败")}).catch(e=>{n.ElMessage.error("图片上传失败")}),!0}const p=null==(l=i.clipboardData)?void 0:l.getData("text/plain");if(p&&function(e){return!(!e||e.length<3)&&[/^#{1,6}\s+/m,/^\*\*[^*]+\*\*/m,/^__[^_]+__/m,/^\*[^*]+\*/m,/^_[^_]+_/m,/^\[.+\]\(.+\)/m,/^!\[.*\]\(.+\)/m,/^```/m,/^`[^`]+`/m,/^[-*+]\s+/m,/^\d+\.\s+/m,/^>\s+/m,/^\|.+\|.+\|/m,/^---+$/m,/^___+$/m,/^\*\*\*+$/m].filter(t=>t.test(e)).length>=2}(p)){i.preventDefault();try{let e,t,r;try{e=function(e){if(!e.includes("|"))return e;const t=e.split("\n");let n=[],r=0;const i=/^\|[\s:|-]+\|$/;for(;r<t.length;){const e=t[r].trim();if("|"===e[0]&&"|"===e[e.length-1]){const e=[];for(;r<t.length;){const n=t[r].trim();if("|"!==n[0]||"|"!==n[n.length-1])break;i.test(n)?e.push({type:"separator",content:n}):e.push({type:"data",content:n}),r++}if(e.length>0){const t=eB(e);n.push(t)}}else n.push(e),r++}return n.join("\n")}(p)}catch(u){e=p}try{t=new ak({html:!0,linkify:!0,typographer:!1,breaks:!1}).render(e)}catch(m){throw m}try{r=px(t,[cu.configure({codeBlock:!1,strike:!1,bulletList:!1,orderedList:!1,listItem:!1}),Eu,$m,Bm,Gm,tp,hp,np])}catch(_){throw _}if(r&&r.content){const e=r.content.length;if(e>100){n.ElMessage.info(`正在插入 ${e} 个内容块...`),s&&s(!0);const t=d.isEditable;d.setEditable(!1),mI({editor:d,content:r.content,type:"json",extensions:[],chunkSize:100,isPaste:!0,onProgress:e=>{if(1===e){performance.now(),startTime;d.setEditable(t),n.ElMessage.success("内容已插入完成"),s&&s(!1)}},onComplete:()=>{d.setEditable(t),s&&s(!1)}})}else d.chain().focus().insertContent(r.content).run(),setTimeout(()=>{d.view.updateState(d.state);const{tr:e}=d.state;d.view.dispatch(e),d.commands.focus()},0)}}catch(g){try{d.chain().focus().insertContent(p).run(),n.ElMessage.warning("Markdown 解析失败,已作为纯文本插入")}catch(h){n.ElMessage.error("内容插入失败,请检查控制台")}}return!0}return!1},handleDOMEvents:{},handleClick(e,t,n){let r=n.target;if(r===e.dom){if(r.closest("img")||r.closest("table")||r.closest("pre")||r.closest(".ai-block"))return!1;return!(t>=e.state.doc.content.size-1)||(d.chain().focus("end").run(),!0)}return!1}},editable:!i,content:"",onDrop({Editor:e}){}});var p;return d},nB=["onClick"],rB={key:0},iB={class:"phrases-btns"},oB={__name:"CommonExpression",props:{from:{type:String,default:""},info:{type:Object,default:()=>{}}},emits:["close"],setup(e,{emit:r}){const i=e;let o=t.ref(!0);const a=r,s=()=>{o.value=!1,a("close")};let l=t.ref([]);const c=()=>{let e={config:{apiHost:i.info.apiHost,token:i.info.token,apiUrl:i.info.expressionUrls.list},data:{page:1,page_size:999,type:0}};dx(e).then(e=>{l.value=e.data.list||[]})};c();const d=()=>{l.value.unshift({content:"",editStatus:!0,op:"add"}),p.value=l.value[0]};t.ref(!1);let p=t.ref({});t.ref(!1);const u=t.ref(null),m=e=>{p.value=e,p.value.user_id>0&&(e.editStatus=!0,t.nextTick(()=>{u.value.focus()}))},_=()=>{if(!p.value.content)return void n.ElMessage.warning("请输入常用语");let e={config:{apiHost:i.info.apiHost,token:i.info.token},data:{content:p.value.content,type:0}};"add"==p.value.op?(e.config.apiUrl=i.info.expressionUrls.create,dx(e).then(e=>{n.ElMessage.success("新增成功"),c()})):(e.config.apiUrl=i.info.expressionUrls.update,e.data.id=p.value.id,dx(e).then(e=>{n.ElMessage.success("编辑成功"),c()}))};let g=[];const h=e=>{g=e},f=()=>{if(!g.length)return void n.ElMessage.warning("请选择常用语");let e=g.map(e=>e.content).join("<br >");a("add",e)};return(e,r)=>(t.openBlock(),t.createBlock(t.unref(n.ElDrawer),{modelValue:t.unref(o),"onUpdate:modelValue":r[1]||(r[1]=e=>t.isRef(o)?o.value=e:o=e),"show-close":!1,size:900,class:"my-drawer",onClose:r[2]||(r[2]=e=>s())},{header:t.withCtx(()=>[...r[3]||(r[3]=[t.createElementVNode("div",{class:"dialog-header"},[t.createElementVNode("div",null,"选择常用语")],-1)])]),default:t.withCtx(()=>[t.createElementVNode("div",{class:"close",onClick:r[0]||(r[0]=e=>s())},[t.createVNode(t.unref(xT),{icon:"ic:baseline-close",width:"16"})]),t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:d},{default:t.withCtx(()=>[...r[4]||(r[4]=[t.createTextVNode("新增",-1)])]),_:1}),t.createVNode(t.unref(n.ElTable),{style:{margin:"10px 0"},data:t.unref(l),border:"",onSelectionChange:h},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElTableColumn),{type:"selection",width:"55"}),t.createVNode(t.unref(n.ElTableColumn),{type:"index",label:"序号",width:"90"}),t.createVNode(t.unref(n.ElTableColumn),{prop:"content",label:"常用语"},{default:t.withCtx(({row:e})=>[t.createElementVNode("div",{onClick:t=>m(e)},[e.editStatus?(t.openBlock(),t.createBlock(t.unref(n.ElInput),{key:1,modelValue:e.content,"onUpdate:modelValue":t=>e.content=t,style:{width:"100%"},rows:2,type:"textarea",ref_key:"inputRef",ref:u,placeholder:"请输入常用语",onBlur:t=>e.editStatus=!1,onChange:_,maxlength:"500"},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(t.openBlock(),t.createElementBlock("p",rB,t.toDisplayString(e.content),1))],8,nB)]),_:1}),t.createVNode(t.unref(n.ElTableColumn),{label:"类型",width:"100"},{default:t.withCtx(({row:e})=>[t.createTextVNode(t.toDisplayString(e.user_id?e.user_id>0?"自定义":"公共":""),1)]),_:1}),t.createVNode(t.unref(n.ElTableColumn),{prop:"address",label:"操作",width:"120"},{default:t.withCtx(({row:e})=>[e.user_id>0?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:"primary",link:"",onClick:t=>m(e)},{default:t.withCtx(()=>[...r[5]||(r[5]=[t.createTextVNode("编辑",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0),e.user_id>0?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:1,type:"danger",link:"",onClick:t=>(e=>{p.value=e;let t={config:{apiHost:i.info.apiHost,token:i.info.token,apiUrl:i.info.expressionUrls.delete},data:{id:p.value.id}};dx(t).then(e=>{n.ElMessage.success("删除成功"),c()})})(e)},{default:t.withCtx(()=>[...r[6]||(r[6]=[t.createTextVNode("删除",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0)]),_:1})]),_:1},8,["data"]),t.createElementVNode("div",iB,[t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:f},{default:t.withCtx(()=>[...r[7]||(r[7]=[t.createTextVNode("确定",-1)])]),_:1}),t.createVNode(t.unref(n.ElButton),{type:"primary",plain:"",onClick:s},{default:t.withCtx(()=>[...r[8]||(r[8]=[t.createTextVNode("取消",-1)])]),_:1})])]),_:1},8,["modelValue"]))}},aB=RT(oB,[["__scopeId","data-v-be715d1d"]]),sB={paragraph:"正文",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6"},lB={class:"toolbar"},cB={key:2,class:"flex-center"},dB={class:"flex-center"},pB={key:3,class:"flex-center"},uB={class:"flex-center"},mB={class:"flex-center"},_B={class:"flex-center"},gB={class:"flex-center"},hB={class:"table-content"},fB={key:7},bB=RT({__name:"EditorToolbar",props:{editor:Object,info:{type:Object,default:()=>({})},limitLength:{type:Number},isBubble:{type:Boolean,default:!1},showMenu:{type:Array,default:()=>[]}},emits:["showAi","showLink","toggleLoading","showSource"],setup(e,{emit:r}){const{appContext:i}=t.getCurrentInstance(),o=e;let a=t.ref("14px"),s=t.ref("#000"),l=t.ref("");const c=(e,t)=>o.editor.isActive(e,t),d=t.computed(()=>!!o.editor&&(o.editor.isActive("codeBlock")||o.editor.isActive("codeBlockCustom")));let p=t.ref("正文");const u=e=>{if("paragraph"===e)o.editor.chain().focus().setParagraph().run();else{const t=parseInt(e.replace("h",""),10);o.editor.chain().focus().setHeading({level:t}).run()}p.value=sB[e]},m=["12px","14px","16px","18px","20px","24px"],_=e=>{o.editor.chain().focus().setFontSize(e).run(),a.value=e},g=e=>o.editor.chain().focus().setColor(e).run(),h=e=>{e?o.editor.chain().focus().setHighlight({color:e}).run():o.editor.chain().focus().unsetHighlight().run()};let f=t.ref("left");const b=e=>{f.value=e,o.editor.chain().focus().setTextAlign(e).run()},E=e=>{},S=e=>{o.editor.chain().focus().setImage({src:e.data.show_url}).run()},v=()=>{o.editor.chain().focus().insertContent({type:"codeBlock",attrs:{language:"javascript"}}).run()};let y=t.ref(!1);const T=e=>{o.editor.chain().focus().insertTable({rows:e.row,cols:e.col,withHeaderRow:!0}).run(),y.value=!1},C=()=>{N("showLink")},N=r,w=()=>{const{from:e,to:t}=o.editor.state.selection;e!==t?N("showAi"):(o.editor.chain().focus().insertContent({type:"aiAssistant"}).run(),o.editor.setEditable(!1))},O=()=>{N("showSource")},x=()=>{if(!o.editor)return;const{state:e}=o.editor,{doc:t}=e;let{tr:r}=e,i=0;const a=[];t.descendants((e,t)=>{if("paragraph"===e.type.name){(0===e.content.size||""===e.textContent.trim())&&a.push({pos:t,size:e.nodeSize,type:"paragraph"})}else if("codeBlock"===e.type.name||"codeBlockCustom"===e.type.name){(0===e.content.size||""===e.textContent.trim())&&a.push({pos:t,size:e.nodeSize,type:"codeBlock"})}});for(let n=a.length-1;n>=0;n--){const{pos:e,size:t}=a[n];r=r.delete(e,e+t),i++}i>0?(0===r.doc.content.size&&(r=r.insert(0,e.schema.nodes.paragraph.create())),o.editor.view.dispatch(r),n.ElMessage.success(`已删除 ${i} 个空行和空代码块`)):n.ElMessage.info("没有找到空行或空代码块")},R=t.ref(!1),A=()=>{R.value=!0},k=()=>{R.value=!1},I=e=>{o.editor.chain().focus().insertContent(e).run(),R.value=!1},D={paragraph:"正文",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"};o.editor.view.dom.addEventListener("mousedown",e=>{var t;const n=o.editor.view.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return;const r=function(e,t){let n=null;return e.state.doc.nodesBetween(t,t,e=>{if(e.type.isBlock)return n=e,!1}),n}(o.editor,n.pos),i=(null==(t=null==r?void 0:r.attrs)?void 0:t.textAlign)||"left";f.value=i});const M=()=>{N("toggleLoading",!0)},L=e=>{let t={config:{apiHost:o.info.apiHost,token:o.info.token,getFileContent:o.info.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||"");mI({editor:o.editor,content:t,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)}})})},P=()=>{N("toggleLoading",!0)},B=e=>{let t={config:{apiHost:o.info.apiHost,token:o.info.token,getFileContent:o.info.getFileContent},data:{filename:e.data.filekey}};cx(t).then(e=>{const t=UP.decrypt(e.data.content||""),n=(new DOMParser).parseFromString(t,"text/html").body.innerHTML;mI({editor:o.editor,content:n,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)}})})};return t.watchEffect(()=>{if(!o.editor)return;const{from:e,to:t}=o.editor.state.selection;if(e!==t){const e=o.editor.getAttributes("textStyle");a.value=e.fontSize||"14px",s.value=e.color||"#000000",l.value=e.backgroundColor||""}const n=[1,2,3,4,5,6];let r=!1;for(let i of n)if(o.editor.isActive("heading",{level:i})){p.value=D["h"+i],r=!0;break}r||(p.value=D.paragraph)}),(r,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",lB,[t.unref(pI)("ai",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"AI",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{onClick:w,link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"hugeicons:ai-chat-02",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"标题",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdown),{onCommand:u,trigger:"click","popper-class":"tiptap-drop-down",disabled:d.value},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownMenu),null,{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownItem),{command:"paragraph"},{default:t.withCtx(()=>[...i[12]||(i[12]=[t.createTextVNode("正文",-1)])]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h1"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:1})?"is-active":"")},"标题 1",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h2"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:2})?"is-active":"")},"标题 2",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h3"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:3})?"is-active":"")},"标题 3",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h4"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:4})?"is-active":"")},"标题 4",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h5"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:5})?"is-active":"")},"标题 5",2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"h6"},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("heading",{level:6})?"is-active":"")},"标题 6",2)]),_:1})]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["el-dropdown-link",{disabled:d.value}])},[t.createElementVNode("p",null,t.toDisplayString(t.unref(p)),1),t.createVNode(t.unref(xT),{icon:"ic:baseline-expand-more",width:"16"})],2)]),_:1},8,["disabled"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"字号",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdown),{onCommand:_,trigger:"click","popper-class":"tiptap-drop-down",disabled:d.value},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownMenu),null,{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(m,e=>t.createVNode(t.unref(n.ElDropdownItem),{key:e,command:e},{default:t.withCtx(()=>[t.createElementVNode("p",{class:t.normalizeClass(c("textStyle",{fontSize:e})?"is-active":"")},t.toDisplayString(e),3)]),_:2},1032,["command"])),64))]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["el-dropdown-link",{disabled:d.value}])},[t.createElementVNode("p",null,t.toDisplayString(t.unref(a)),1),t.createVNode(t.unref(xT),{icon:"ic:baseline-expand-more",width:"16"})],2)]),_:1},8,["disabled"])]),_:1}),t.unref(pI)("color",e.showMenu)?(t.openBlock(),t.createElementBlock("div",cB,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"字体颜色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",dB,[t.createVNode(t.unref(n.ElColorPicker),{modelValue:t.unref(s),"onUpdate:modelValue":i[0]||(i[0]=e=>t.isRef(s)?s.value=e:s=e),onChange:g,size:"small","show-alpha":"",disabled:d.value},null,8,["modelValue","disabled"])])]),_:1})])):t.createCommentVNode("",!0),t.unref(pI)("bgColor",e.showMenu)?(t.openBlock(),t.createElementBlock("div",pB,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"背景色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",uB,[t.createVNode(t.unref(n.ElColorPicker),{modelValue:t.unref(l),"onUpdate:modelValue":i[1]||(i[1]=e=>t.isRef(l)?l.value=e:l=e),onChange:h,size:"small","show-alpha":"",disabled:d.value},null,8,["modelValue","disabled"])])]),_:1})])):t.createCommentVNode("",!0),t.createVNode(t.unref(n.ElButtonGroup),null,{default:t.withCtx(()=>[t.unref(pI)("bold",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"加粗",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("bold")?"primary":"",onClick:i[2]||(i[2]=t=>e.editor.chain().focus().toggleBold().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-bold",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("italic",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"斜体",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("italic")?"primary":"",onClick:i[3]||(i[3]=t=>e.editor.chain().focus().toggleItalic().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-italic",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("underline",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:2,class:"box-item",effect:"dark",content:"下划线",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("underline")?"primary":"",onClick:i[4]||(i[4]=t=>e.editor.chain().focus().toggleUnderline().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-underline",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("strike",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:3,class:"box-item",effect:"dark",content:"中划线",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("strike")?"primary":"",onClick:i[5]||(i[5]=t=>e.editor.chain().focus().toggleStrike().run()),link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-strikethrough",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("bulletList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"无序列表",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{type:c("bulletList")?"primary":"",onClick:i[6]||(i[6]=t=>e.editor.chain().focus().toggleBulletList().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-bulleted",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("orderedList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"有序列表",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{type:c("orderedList")?"primary":"",onClick:i[7]||(i[7]=t=>e.editor.chain().focus().toggleOrderedList().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-numbered",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("taskList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"待办列表",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{type:c("taskList")?"primary":"",onClick:i[8]||(i[8]=t=>e.editor.chain().focus().toggleTaskList().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-list-checkbox",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("link",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:7,class:"box-item",effect:"dark",content:"链接",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{onClick:C,type:c("link")?"primary":"",link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:link-variant",width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0)]),_:1}),t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"对齐方式",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdown),{onCommand:b,trigger:"click",teleported:!1,disabled:d.value},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownMenu),null,{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElDropdownItem),{command:"left"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"left"})?"is-active":""])},[t.createVNode(t.unref(n.ElButton),{type:c({textAlign:"left"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-left",width:"20"})]),_:1},8,["type"]),i[13]||(i[13]=t.createElementVNode("p",null,"左对齐",-1))],2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"center"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"center"})?"is-active":""])},[t.unref(pI)("center",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"center"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-center",width:"20"})]),_:1},8,["type"])):t.createCommentVNode("",!0),i[14]||(i[14]=t.createElementVNode("p",null,"居中",-1))],2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"right"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"right"})?"is-active":""])},[t.unref(pI)("right",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"right"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-right",width:"20"})]),_:1},8,["type"])):t.createCommentVNode("",!0),i[15]||(i[15]=t.createElementVNode("p",null,"右对齐",-1))],2)]),_:1}),t.createVNode(t.unref(n.ElDropdownItem),{command:"justify"},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["align-item",c({textAlign:"justify"})?"is-active":""])},[t.unref(pI)("justify",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"justify"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-align-justify",width:"20"})]),_:1},8,["type"])):t.createCommentVNode("",!0),i[16]||(i[16]=t.createElementVNode("p",null,"水平对齐",-1))],2)]),_:1})]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["el-dropdown-link",{disabled:d.value}])},[t.createVNode(t.unref(xT),{icon:`mdi:format-align-${t.unref(f)}`,width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["icon","class"]),t.createVNode(t.unref(xT),{icon:"ic:baseline-expand-more",width:"16",class:t.normalizeClass({"icon-gray":d.value})},null,8,["class"])],2)]),_:1},8,["disabled"])]),_:1}),t.createElementVNode("div",mB,[!e.isBubble&&t.unref(pI)("image",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"上传图片",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElUpload),{class:"tiptap-upload-demo","show-file-list":!1,action:e.info.apiHost+e.info.uploadUrl,data:{type:2},headers:{"access-token":e.info.token},accept:".jpg,.png,.jpeg,.gif","before-upload":E,"on-success":S},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:file-image-box",width:"20"})]),_:1},8,["action","headers"])]),_:1})):t.createCommentVNode("",!0)]),t.createElementVNode("div",_B,[!e.isBubble&&t.unref(pI)("doc",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"上传Word文件",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElUpload),{class:"upload-demo","show-file-list":!1,action:e.info.apiHost+e.info.uploadDoc,data:{type:2},headers:{"access-token":e.info.token},accept:".doc,.docx","on-success":L,"before-upload":M,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:file-word",width:"20",class:t.normalizeClass(c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"icon-gray":"")},null,8,["class"])]),_:1},8,["action","headers","disabled"])]),_:1})):t.createCommentVNode("",!0)]),t.createElementVNode("div",gB,[!e.isBubble&&t.unref(pI)("jupyter",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"上传Jupyter文件",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElUpload),{class:"upload-demo","show-file-list":!1,action:e.info.apiHost+e.info.uploadJupyter,data:{type:2},headers:{"access-token":e.info.token},accept:".ipynb","on-success":B,"before-upload":P,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"logos:jupyter",class:t.normalizeClass(c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"icon-gray":"")},null,8,["class"])]),_:1},8,["action","headers","disabled"])]),_:1})):t.createCommentVNode("",!0)]),!e.isBubble&&t.unref(pI)("codeBlock",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"代码块",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",type:c("codeBlock")?"primary":"",onClick:v,link:"",disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:code-braces-box",width:"20",class:t.normalizeClass(c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"icon-gray":"")},null,8,["class"])]),_:1},8,["type","disabled"])]),_:1})):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",null,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"表格",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",hB,[t.createVNode(t.unref(n.ElPopover),{placement:"bottom",title:"",width:224,trigger:"click",visible:t.unref(y),"onUpdate:visible":i[9]||(i[9]=e=>t.isRef(y)?y.value=e:y=e),disabled:c("table")||c("bulletList")||c("orderedList")||c("taskList")||c("codeBlock")},{reference:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:table",width:"20",class:t.normalizeClass(c("table")||c("bulletList")||c("orderedList")||c("taskList")||c("codeBlock")?"icon-gray":"")},null,8,["class"])]),default:t.withCtx(()=>[t.createElementVNode("div",null,[t.createVNode(KM,{onSelect:T})])]),_:1},8,["visible","disabled"])])]),_:1})],512),[[t.vShow,!e.isBubble&&t.unref(pI)("table",e.showMenu)]]),t.createVNode(t.unref(n.ElButtonGroup),null,{default:t.withCtx(()=>[t.unref(pI)("undo",e.showMenu)&&!e.isBubble?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"撤销",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:i[10]||(i[10]=t=>e.editor.chain().focus().undo().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:undo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(pI)("redo",e.showMenu)&&!e.isBubble?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"重做",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:i[11]||(i[11]=t=>e.editor.chain().focus().redo().run()),link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:redo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}),!e.isBubble&&t.unref(pI)("viewSource",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"查看源代码",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:O,link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:code-tags",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(pI)("removeEmptyLines",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"去除空行",placement:"bottom"},{default:t.withCtx(()=>[t.createVNode(t.unref(n.ElButton),{size:"small",onClick:x,link:""},{default:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mdi:format-clear",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(pI)("expression",e.showMenu)?(t.openBlock(),t.createElementBlock("div",fB,[t.createVNode(t.unref(n.ElButton),{link:"",onClick:A},{default:t.withCtx(()=>[...i[17]||(i[17]=[t.createTextVNode("插入常用语",-1)])]),_:1})])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"default",{},void 0,!0)]),R.value?(t.openBlock(),t.createBlock(aB,{key:0,info:e.info,onClose:k,onAdd:I},null,8,["info"])):t.createCommentVNode("",!0)],64))}},[["__scopeId","data-v-ade24cad"]]),EB={class:"bubble-menu"},SB=RT({__name:"BubbleMenu",props:{editor:Object,info:{type:Object,default:()=>({})},showMenu:{type:Array,default:()=>[]}},emits:["showAi","showLink"],setup(e,{emit:n}){const r=({editor:e,state:t,from:n,to:r})=>{if(i.value)return!1;if(!e.isFocused||n===r)return!1;const{doc:o,selection:a}=t;return a.node,a.$from,!e.isActive("image")&&(!e.isActive("codeBlock")&&!e.isActive("codeBlockCustom")&&(!(e.isActive("table")||e.isActive("tableRow")||e.isActive("tableCell")||e.isActive("tableHeader"))&&!e.isActive("aiAssistant")))};let i=t.ref(!1);const o=n,a=()=>{i.value=!0,o("showAi")},s=()=>{o("showLink")};return(n,i)=>(t.openBlock(),t.createBlock(t.unref(GM),{editor:e.editor,"should-show":r},{default:t.withCtx(()=>[t.createElementVNode("div",EB,[t.createVNode(bB,{editor:e.editor,info:e.info,isBubble:!0,showMenu:e.showMenu,onShowAi:a,onShowLink:s},null,8,["editor","info","showMenu"])])]),_:1},8,["editor"]))}},[["__scopeId","data-v-dc69236f"]]),vB={class:"table-toolbar-btns"},yB={class:"table-toolbar-btns"},TB={class:"table-toolbar-btns"},CB=RT({__name:"TableToolbar",props:{editor:{type:Object,required:!0},editorWrapper:{type:Object,default:null}},setup(e){const r=e,i=t.ref(null),o=t.ref(!1),a=t.ref(!1),s=t.ref({top:"0px",left:"0px"}),l=t.ref({top:"0px",left:"0px"}),c=t.ref(!1),d=t.ref({top:"0px",left:"0px"}),p=t.computed(()=>r.editor.can().mergeCells()),u=t.computed(()=>r.editor.can().splitCell()),m=()=>{const e=r.editor;if(!e||!e.view)return;const t=e.state,{selection:n}=t;if(!e.isActive("table"))return o.value=!1,a.value=!1,void(c.value=!1);const i=$o(e=>"tableCell"===e.type.name||"tableHeader"===e.type.name)(n);if(!i)return o.value=!1,a.value=!1,void(c.value=!1);const p=$o(e=>"tableRow"===e.type.name)(n),u=$o(e=>"table"===e.type.name)(n);if(!p||!u)return o.value=!1,a.value=!1,void(c.value=!1);const m=e.view,g=m.nodeDOM(i.pos),h=m.nodeDOM(p.pos),f=m.nodeDOM(u.pos);if(!(g instanceof HTMLElement&&h instanceof HTMLElement&&f instanceof HTMLElement))return o.value=!1,a.value=!1,void(c.value=!1);const b=m.dom.getBoundingClientRect(),E=g.getBoundingClientRect(),S=h.getBoundingClientRect(),v=f.getBoundingClientRect(),y=S.left-b.left-30,T=S.top-b.top+S.height/2+18-r.editorWrapper.scrollTop;s.value={position:"absolute",left:`${Math.max(y,-10)}px`,top:`${Math.max(T,0)}px`,zIndex:1e3},o.value=!0;const C=(E.left+E.right)/2+10-b.left-20,N=v.top-b.top-m.dom.scrollTop-r.editorWrapper.scrollTop;l.value={position:"absolute",left:`${C}px`,top:`${Math.max(N,0)}px`,zIndex:1e3},a.value=!0;const w=v.right-b.left+10,O=v.top-b.top;d.value={position:"absolute",left:`${w}px`,top:`${Math.max(O,0)}px`,zIndex:1e3};const{from:x,to:R}=n,A=_(e,x,R);c.value=A.length>1},_=(e,t,n)=>{const r=[],{state:i}=e,{doc:o}=i;return i.doc.nodesBetween(t,n,(e,t)=>{"tableCell"!==e.type.name&&"tableHeader"!==e.type.name||r.push({node:e,pos:t})}),r};let g=t.ref(!1),h=t.ref(!1);const f=()=>{r.editor.chain().focus().addRowAfter().run(),g.value=!1},b=()=>{r.editor.chain().focus().addRowBefore().run(),g.value=!1},E=()=>{r.editor.chain().focus().deleteRow().run(),g.value=!1},S=()=>{r.editor.chain().focus().addColumnAfter().run(),h.value=!1},v=()=>{r.editor.chain().focus().addColumnBefore().run(),h.value=!1},y=()=>{r.editor.chain().focus().deleteColumn().run(),h.value=!1},T=()=>{r.editor.chain().focus().deleteTable().run(),g.value=!1,h.value=!1},C=()=>{r.editor.chain().focus().mergeCells().run(),g.value=!1,h.value=!1,c.value=!1},N=()=>{u.value&&(r.editor.chain().focus().splitCell().run(),g.value=!1,h.value=!1,c.value=!1)};let w=null;return t.onMounted(()=>{r.editor&&(w=()=>m(),r.editor.on&&r.editor.on("selectionUpdate",w)),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),t.nextTick(()=>{m()})}),t.onBeforeUnmount(()=>{r.editor&&w&&r.editor.off&&r.editor.off("selectionUpdate",w),window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{class:"table-toolbar-wrapper",ref_key:"toolbarRoot",ref:i},[t.createElementVNode("div",vB,[t.renderSlot(e.$slots,"default",{},void 0,!0)]),o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"table-side-icon row-icon",style:t.normalizeStyle(s.value),onClick:r[1]||(r[1]=(...t)=>e.onRowIconClick&&e.onRowIconClick(...t))},[t.createVNode(t.unref(n.ElPopover),{placement:"right-start",trigger:"click",visible:t.unref(g),"onUpdate:visible":r[0]||(r[0]=e=>t.isRef(g)?g.value=e:g=e),teleported:!1},{reference:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",yB,[t.createElementVNode("div",{onClick:f},"下方插入行"),t.createElementVNode("div",{onClick:b},"上方插入行"),t.createElementVNode("div",{onClick:E},"删除行"),t.createElementVNode("div",{class:"danger",onClick:T},"删除表格"),p.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:C},"合并单元格")):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:N},"拆分单元格")):t.createCommentVNode("",!0)])]),_:1},8,["visible"])],4)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:"table-side-icon col-icon",style:t.normalizeStyle(l.value),onClick:r[3]||(r[3]=(...t)=>e.onColIconClick&&e.onColIconClick(...t))},[t.createVNode(t.unref(n.ElPopover),{placement:"right-start",width:200,trigger:"click",teleported:!1,visible:t.unref(h),"onUpdate:visible":r[2]||(r[2]=e=>t.isRef(h)?h.value=e:h=e)},{reference:t.withCtx(()=>[t.createVNode(t.unref(xT),{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",TB,[t.createElementVNode("div",{onClick:S},"右方插入列"),t.createElementVNode("div",{onClick:v},"左方插入列"),t.createElementVNode("div",{onClick:y},"删除列"),t.createElementVNode("div",{class:"danger",onClick:T},"删除表格"),p.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:C},"合并单元格")):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:N},"拆分单元格")):t.createCommentVNode("",!0)])]),_:1},8,["visible"])],4)):t.createCommentVNode("",!0)],512))}},[["__scopeId","data-v-291951b5"]]);function NB(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wB={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function OB(e){wB=e}var xB={exec:()=>null};function RB(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(AB.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var AB={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},kB=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,IB=/(?:[*+-]|\d{1,9}[.)])/,DB=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,MB=RB(DB).replace(/bull/g,IB).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),LB=RB(DB).replace(/bull/g,IB).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),PB=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,BB=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,FB=RB(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",BB).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),UB=RB(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,IB).getRegex(),zB="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",GB=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$B=RB("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",GB).replace("tag",zB).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qB=RB(PB).replace("hr",kB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zB).getRegex(),HB={blockquote:RB(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qB).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:FB,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:kB,html:$B,lheading:MB,list:UB,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:qB,table:xB,text:/^[^\n]+/},VB=RB("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zB).getRegex(),YB={...HB,lheading:LB,table:VB,paragraph:RB(PB).replace("hr",kB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",VB).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",zB).getRegex()},jB={...HB,html:RB("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",GB).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xB,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:RB(PB).replace("hr",kB).replace("heading"," *#{1,6} *[^\n]").replace("lheading",MB).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},WB=/^( {2,}|\\)\n(?!\s*$)/,KB=/[\p{P}\p{S}]/u,QB=/[\s\p{P}\p{S}]/u,ZB=/[^\s\p{P}\p{S}]/u,XB=RB(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,QB).getRegex(),JB=/(?!~)[\p{P}\p{S}]/u,eF=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,tF=RB(eF,"u").replace(/punct/g,KB).getRegex(),nF=RB(eF,"u").replace(/punct/g,JB).getRegex(),rF="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",iF=RB(rF,"gu").replace(/notPunctSpace/g,ZB).replace(/punctSpace/g,QB).replace(/punct/g,KB).getRegex(),oF=RB(rF,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,JB).getRegex(),aF=RB("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ZB).replace(/punctSpace/g,QB).replace(/punct/g,KB).getRegex(),sF=RB(/\\(punct)/,"gu").replace(/punct/g,KB).getRegex(),lF=RB(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),cF=RB(GB).replace("(?:--\x3e|$)","--\x3e").getRegex(),dF=RB("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",cF).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pF=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,uF=RB(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pF).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mF=RB(/^!?\[(label)\]\[(ref)\]/).replace("label",pF).replace("ref",BB).getRegex(),_F=RB(/^!?\[(ref)\](?:\[\])?/).replace("ref",BB).getRegex(),gF={_backpedal:xB,anyPunctuation:sF,autolink:lF,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:WB,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:xB,emStrongLDelim:tF,emStrongRDelimAst:iF,emStrongRDelimUnd:aF,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:uF,nolink:_F,punctuation:XB,reflink:mF,reflinkSearch:RB("reflink|nolink(?!\\()","g").replace("reflink",mF).replace("nolink",_F).getRegex(),tag:dF,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:xB},hF={...gF,link:RB(/^!?\[(label)\]\((.*?)\)/).replace("label",pF).getRegex(),reflink:RB(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pF).getRegex()},fF={...gF,emStrongRDelimAst:oF,emStrongLDelim:nF,url:RB(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},bF={...fF,br:RB(WB).replace("{2,}","*").getRegex(),text:RB(fF.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},EF={normal:HB,gfm:YB,pedantic:jB},SF={normal:gF,gfm:fF,breaks:bF,pedantic:hF},vF={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},yF=e=>vF[e];function TF(e,t){if(t){if(AB.escapeTest.test(e))return e.replace(AB.escapeReplace,yF)}else if(AB.escapeTestNoEncode.test(e))return e.replace(AB.escapeReplaceNoEncode,yF);return e}function CF(e){try{e=encodeURI(e).replace(AB.percentDecode,"%")}catch{return null}return e}function NF(e,t){var n;let r=e.replace(AB.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(AB.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!(null==(n=r.at(-1))?void 0:n.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(AB.slashPipe,"|");return r}function wF(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function OF(e,t,n,r,i){let o=t.href,a=t.title||null,s=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:o,title:a,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,l}var xF=class{constructor(e){o(this,"options"),o(this,"rules"),o(this,"lexer"),this.options=e||wB}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:wF(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=wF(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:wF(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=wF(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,o=!1,a=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))a.push(e[t]),o=!0;else{if(o)break;a.push(e[t])}e=e.slice(t);let s=a.join("\n"),l=s.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${s}`:s,r=r?`${r}\n${l}`:l;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,i,!0),this.lexer.state.top=c,0===e.length)break;let d=i.at(-1);if("code"===(null==d?void 0:d.type))break;if("blockquote"===(null==d?void 0:d.type)){let t=d,o=t.raw+"\n"+e.join("\n"),a=this.blockquote(o);i[i.length-1]=a,n=n.substring(0,n.length-t.raw.length)+a.raw,r=r.substring(0,r.length-t.text.length)+a.text;break}if("list"===(null==d?void 0:d.type)){let t=d,o=t.raw+"\n"+e.join("\n"),a=this.list(o);i[i.length-1]=a,n=n.substring(0,n.length-d.raw.length)+a.raw,r=r.substring(0,r.length-t.raw.length)+a.raw,e=o.substring(i.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;e;){let n=!1,r="",s="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],d=!l.trim(),p=0;if(this.options.pedantic?(p=2,s=l.trimStart()):d?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=l.slice(p),p+=t[1].length),d&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),o=this.rules.other.headingBeginRegex(p),a=this.rules.other.htmlBeginRegex(p);for(;e;){let u,m=e.split("\n",1)[0];if(c=m,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||o.test(c)||a.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=p||!c.trim())s+="\n"+u.slice(p);else{if(d||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||o.test(l)||n.test(l))break;s+="\n"+c}!d&&!c.trim()&&(d=!0),r+=m+"\n",e=e.substring(m.length+1),l=u.slice(p)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(a=!0));let u,m=null;this.options.gfm&&(m=this.rules.other.listIsTask.exec(s),m&&(u="[ ] "!==m[0],s=s.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!m,checked:u,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(!s)return;s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){var t;let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=NF(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(null==(t=n[3])?void 0:t.trim())?n[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],a={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?a.align.push("right"):this.rules.other.tableAlignCenter.test(e)?a.align.push("center"):this.rules.other.tableAlignLeft.test(e)?a.align.push("left"):a.align.push(null);for(let e=0;e<r.length;e++)a.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:a.align[e]});for(let e of o)a.rows.push(NF(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=wF(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),OF(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return OF(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,o=[...r[0]].length-1,a=o,s=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+o);null!=(r=l.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){a+=i;continue}if((r[5]||r[6])&&o%3&&!((o+i)%3)){s+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+s);let t=[...r[0]][0].length,l=e.slice(0,o+r.index+t+i);if(Math.min(o,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var t;let n;if(n=this.rules.inline.url.exec(e)){let e,r;if("@"===n[2])e=n[0],r="mailto:"+e;else{let i;do{i=n[0],n[0]=(null==(t=this.rules.inline._backpedal.exec(n[0]))?void 0:t[0])??""}while(i!==n[0]);e=n[0],r="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},RF=class e{constructor(e){o(this,"tokens"),o(this,"options"),o(this,"state"),o(this,"tokenizer"),o(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wB,this.options.tokenizer=this.options.tokenizer||new xF,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:AB,block:EF.normal,inline:SF.normal};this.options.pedantic?(t.block=EF.pedantic,t.inline=SF.pedantic):this.options.gfm&&(t.block=EF.gfm,this.options.breaks?t.inline=SF.breaks:t.inline=SF.gfm),this.tokenizer.rules=t}static get rules(){return{block:EF,inline:SF}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(AB.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var r,i,o;for(this.options.pedantic&&(e=e.replace(AB.tabCharGlobal," ").replace(AB.spaceLine,""));e;){let a;if(null==(i=null==(r=this.options.extensions)?void 0:r.block)?void 0:i.some(n=>!!(a=n.call({lexer:this},e,t))&&(e=e.substring(a.raw.length),t.push(a),!0)))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let n=t.at(-1);1===a.raw.length&&void 0!==n?n.raw+="\n":t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let n=t.at(-1);"paragraph"===(null==n?void 0:n.type)||"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+a.raw,n.text+="\n"+a.text,this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let n=t.at(-1);"paragraph"===(null==n?void 0:n.type)||"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+a.raw,n.text+="\n"+a.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let s=e;if(null==(o=this.options.extensions)?void 0:o.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(this.state.top&&(a=this.tokenizer.paragraph(s))){let r=t.at(-1);n&&"paragraph"===(null==r?void 0:r.type)?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+a.raw,r.text+="\n"+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(a),n=s.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let n=t.at(-1);"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+a.raw,n.text+="\n"+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var n,r,i,o,a;let s=e,l=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(l=this.tokenizer.rules.inline.reflinkSearch.exec(s));)e.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(l=this.tokenizer.rules.inline.anyPunctuation.exec(s));)s=s.slice(0,l.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(l=this.tokenizer.rules.inline.blockSkip.exec(s));)s=s.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=(null==(r=null==(n=this.options.hooks)?void 0:n.emStrongMask)?void 0:r.call({lexer:this},s))??s;let c=!1,d="";for(;e;){let n;if(c||(d=""),c=!1,null==(o=null==(i=this.options.extensions)?void 0:i.inline)?void 0:o.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);"text"===n.type&&"text"===(null==r?void 0:r.type)?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,s,d)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let r=e;if(null==(a=this.options.extensions)?void 0:a.startInline){let t,n=1/0,i=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},i),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(r=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(d=n.raw.slice(-1)),c=!0;let r=t.at(-1);"text"===(null==r?void 0:r.type)?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}return t}},AF=class{constructor(e){o(this,"options"),o(this,"parser"),this.options=e||wB}space(e){return""}code({text:e,lang:t,escaped:n}){var r;let i=null==(r=(t||"").match(AB.notSpaceStart))?void 0:r[0],o=e.replace(AB.endingNewline,"")+"\n";return i?'<pre><code class="language-'+TF(i)+'">'+(n?o:TF(o,!0))+"</code></pre>\n":"<pre><code>"+(n?o:TF(o,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o<e.items.length;o++){let t=e.items[o];r+=this.listitem(t)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){var t;let n="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===(null==(t=e.tokens[0])?void 0:t.type)?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=r+" "+TF(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):n+=r+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){let t=e.rows[i];n="";for(let e=0;e<t.length;e++)n+=this.tablecell(t[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${TF(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=CF(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+TF(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=CF(e);if(null===i)return TF(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${TF(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:TF(e.text)}},kF=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},IF=class e{constructor(e){o(this,"options"),o(this,"renderer"),o(this,"textRenderer"),this.options=e||wB,this.options.renderer=this.options.renderer||new AF,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new kF}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){var n,r;let i="";for(let o=0;o<e.length;o++){let a=e[o];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[a.type]){let e=a,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){i+=t||"";continue}}let s=a;switch(s.type){case"space":i+=this.renderer.space(s);continue;case"hr":i+=this.renderer.hr(s);continue;case"heading":i+=this.renderer.heading(s);continue;case"code":i+=this.renderer.code(s);continue;case"table":i+=this.renderer.table(s);continue;case"blockquote":i+=this.renderer.blockquote(s);continue;case"list":i+=this.renderer.list(s);continue;case"html":i+=this.renderer.html(s);continue;case"def":i+=this.renderer.def(s);continue;case"paragraph":i+=this.renderer.paragraph(s);continue;case"text":{let n=s,r=this.renderer.text(n);for(;o+1<e.length&&"text"===e[o+1].type;)n=e[++o],r+="\n"+this.renderer.text(n);i+=t?this.renderer.paragraph({type:"paragraph",raw:r,text:r,tokens:[{type:"text",raw:r,text:r,escaped:!0}]}):r;continue}default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return i}parseInline(e,t=this.renderer){var n,r;let i="";for(let o=0;o<e.length;o++){let a=e[o];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[a.type]){let e=this.options.extensions.renderers[a.type].call({parser:this},a);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=e||"";continue}}let s=a;switch(s.type){case"escape":case"text":i+=t.text(s);break;case"html":i+=t.html(s);break;case"link":i+=t.link(s);break;case"image":i+=t.image(s);break;case"strong":i+=t.strong(s);break;case"em":i+=t.em(s);break;case"codespan":i+=t.codespan(s);break;case"br":i+=t.br(s);break;case"del":i+=t.del(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return i}},DF=(r=class{constructor(e){o(this,"options"),o(this,"block"),this.options=e||wB}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?RF.lex:RF.lexInline}provideParser(){return this.block?IF.parse:IF.parseInline}},o(r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),o(r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),r),MF=new class{constructor(...e){o(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),o(this,"options",this.setOptions),o(this,"parse",this.parseMarkdown(!0)),o(this,"parseInline",this.parseMarkdown(!1)),o(this,"Parser",IF),o(this,"Renderer",AF),o(this,"TextRenderer",kF),o(this,"Lexer",RF),o(this,"Tokenizer",xF),o(this,"Hooks",DF),this.use(...e)}walkTokens(e,t){var n,r;let i=[];for(let o of e)switch(i=i.concat(t.call(this,o)),o.type){case"table":{let e=o;for(let n of e.header)i=i.concat(this.walkTokens(n.tokens,t));for(let n of e.rows)for(let e of n)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=o;i=i.concat(this.walkTokens(e.items,t));break}default:{let e=o;(null==(r=null==(n=this.defaults.extensions)?void 0:n.childTokens)?void 0:r[e.type])?this.defaults.extensions.childTokens[e.type].forEach(n=>{let r=e[n].flat(1/0);i=i.concat(this.walkTokens(r,t))}):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new AF(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new xF(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new DF;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],o=t[r];DF.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&DF.passThroughHooksRespectAsync.has(n))return Promise.resolve(i.call(t,e)).then(e=>o.call(t,e));let r=i.call(t,e);return o.call(t,r)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return RF.lex(e,t??this.defaults)}parser(e,t){return IF.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let a=i.hooks?i.hooks.provideLexer():e?RF.lex:RF.lexInline,s=i.hooks?i.hooks.provideParser():e?IF.parse:IF.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>a(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let e=a(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(l){return o(l)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+TF(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function LF(e,t){return MF.parse(e,t)}LF.options=LF.setOptions=function(e){return MF.setOptions(e),LF.defaults=MF.defaults,OB(LF.defaults),LF},LF.getDefaults=NB,LF.defaults=wB,LF.use=function(...e){return MF.use(...e),LF.defaults=MF.defaults,OB(LF.defaults),LF},LF.walkTokens=function(e,t){return MF.walkTokens(e,t)},LF.parseInline=MF.parseInline,LF.Parser=IF,LF.parser=IF.parse,LF.Renderer=AF,LF.TextRenderer=kF,LF.Lexer=RF,LF.lexer=RF.lex,LF.Tokenizer=xF,LF.Hooks=DF,LF.parse=LF,LF.options,LF.setOptions,LF.use,LF.walkTokens,LF.parseInline,IF.parse,RF.lex;const PF=RT({__name:"FloatAi",props:{editor:Object,info:Object},emits:["close"],setup(e,{emit:n}){const r=e;let i=t.ref({top:0,left:0});const o=t.computed(()=>({top:i.value.top+"px",left:"20px"}));t.onMounted(()=>{(()=>{if(!r.editor)return;const{from:e,to:t}=r.editor.state.selection;if(e===t)return void(visible.value=!1);const n=r.editor.view.coordsAtPos(e),o=r.editor.view.coordsAtPos(t),a=r.editor.view.dom.getBoundingClientRect();i.value={top:Math.max(n.top,o.top)-a.top+50}})()});const a=n,s=()=>{a("close")};return(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:"ai-content",style:t.normalizeStyle(o.value)},[t.createVNode(rD,{editor:e.editor,apiHost:e.info.apiHost,token:e.info.token,askUrl:e.info.askUrl,answerUrl:e.info.answerUrl,onClose:s,isBubble:!0},null,8,["editor","apiHost","token","askUrl","answerUrl"])],4))}},[["__scopeId","data-v-39837116"]]),BF={key:0,class:"editor-wrapper-toolbar"},FF={key:1},UF={class:"editor-content-container"},zF={ref:"blockMenuRef"},GF=["src"],$F={class:"source-dialog-content"},qF={class:"dialog-footer"},HF={key:2,class:"editor-bottom"},VF={class:"editor-bottom-r"},YF=RT({__name:"index",props:{info:{type:Object,default:()=>({})},limitLength:{type:Number,default:1/0},height:{type:String,default:"100%"},content:{type:String,default:""},isInline:{type:Boolean,default:!1},showMenu:{type:Array,default:()=>[]},placeholder:{type:String,default:"输入 / 调出菜单"}},emits:["update:content"],setup(e,{emit:r}){t.ref(!0);const{appContext:i}=t.getCurrentInstance();i.app.directive("loading",n.ElLoading.directive);const o=e;let a=t.ref(!1);const s=t.ref({isOpen:!1,coords:{left:0,top:0},selectedIndex:0,range:null}),l=()=>{const{state:e,view:n}=d,{selection:r}=e,{$from:i}=r,o=i.parent.textBetween(0,i.parentOffset,void 0,"");if(o.endsWith("/")&&!o.endsWith("//")){const e=i.pos-1;s.value.range={from:e,to:e+1},t.nextTick(()=>{const t=d.view.dom,n=d.view.coordsAtPos(e),r=t.getBoundingClientRect(),i={left:n.left-r.left+t.scrollLeft,top:n.bottom-r.top+t.scrollTop};s.value.coords={left:i.left,top:i.top+30},s.value.isOpen=!0,s.value.selectedIndex=0})}else s.value.isOpen=!1};let c=t.ref(null);const d=tB({content:o.content,info:o.info,limit:o.limitLength,isInline:o.isInline,showMenu:o.showMenu,placeholder:o.placeholder,blockMenuFn:e=>{a.value=e},editorWrapper:c.value,checkSlashTrigger:l});function p(e){const{state:t}=e,{$from:n}=t.selection;return n.parent.textBetween(0,n.parentOffset,void 0,"")}function u(e){if(s.value.isOpen){try{const{from:t,to:n}=d.state.selection;if(p(d).endsWith("/")&&"undele"!=e){const e=t-1;d.chain().focus().deleteRange({from:e,to:t}).run()}s.value.isOpen=!1,s.value.range=null}finally{}"ai"==e?(d.chain().focus().insertContent({type:"aiAssistant"}).run(),d.setEditable(!1)):"codeblock"==e?d.chain().focus().insertContent({type:"codeBlock",attrs:{language:"javascript"}}).run():"function"==typeof e?t.nextTick(()=>{e()}):e&&"undele"!=e&&e()}}function m(e){if(!s.value.isOpen)return;const n=e.target,r=t.ref(null).value,i=d.view.dom;if(!r||!r.contains(n)){if(i.contains(n)){const t=d.view.posAtCoords({left:e.clientX,top:e.clientY}),n=s.value.range;if(t&&n&&t.pos>=n.from&&t.pos<=n.to)return}u()}}let _=t.ref(!1),g=t.ref({});const h=r;d.on("update",({editor:e})=>{const t=p(e);if(t.endsWith("//"))return void(s.value.isOpen&&u("undele"));if(t.endsWith("/")&&!t.endsWith("//"))return void l();s.value.isOpen&&u();let n=uI(e.state.doc);h("update:content",e.getHTML(),n)});let f=t.ref(!1);const b=()=>{f.value=!0,t.nextTick(()=>{const{tr:e}=d.state;d.view.dispatch(e)})},E=()=>{f.value=!1,d.setEditable(!0)},S=t.ref(null);let v=t.ref("");const y=e=>{v.value=e||"",S.value.open()};t.ref(0),t.onMounted(()=>{o.content&&(a.value=!0,mI({editor:d,content:o.content,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&(a.value=!1)}})),window.addEventListener("tiptap-image-click",N),document.addEventListener("click",m)});const T=t.ref(!1),C=t.ref("");function N(e){C.value=e.detail,T.value=!0}const w=t.ref(!1),O=t.ref("");function x(){O.value=d.getHTML(),w.value=!0}function R(){try{a.value=!0,d.commands.clearContent(),mI({editor:d,content:O.value,type:"html",extensions:zN(),chunkSize:5,onProgress:e=>{e>0&&(a.value=!1)}}),w.value=!1,n.ElMessage.success("源代码已应用")}catch(e){n.ElMessage.error("应用源代码失败,请检查代码格式")}}const A=e=>{a.value=e};return t.onBeforeUnmount(()=>{d&&d.destroy(),window.removeEventListener("tiptap-image-click",N),document.removeEventListener("click",m)}),(r,i)=>{const o=t.resolveDirective("loading");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["tiptap-vue",{"is-inline":e.isInline}]),style:t.normalizeStyle({height:e.height})},[t.createElementVNode("div",{class:"editor-wrapper",style:t.normalizeStyle([{height:"100%"},{border:e.isInline?"none":"1px solid #eeeeee"}])},[e.isInline?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",BF,[t.createVNode(bB,{editor:t.unref(d),info:e.info,limitLength:e.limitLength,showMenu:e.showMenu,onShowLink:i[0]||(i[0]=e=>y("top")),onToggleLoading:A,onShowAi:b,onShowSource:x},null,8,["editor","info","limitLength","showMenu"])])),e.isInline||t.unref(f)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",FF,[t.createVNode(SB,{editor:t.unref(d),info:e.info,showMenu:e.showMenu,onShowAi:b,onShowLink:i[1]||(i[1]=e=>y())},null,8,["editor","info","showMenu"])])),t.createVNode(CB,{editor:t.unref(d),showToolbar:t.unref(_),"onUpdate:showToolbar":i[2]||(i[2]=e=>t.isRef(_)?_.value=e:_=e),toolbarStyle:t.unref(g),"onUpdate:toolbarStyle":i[3]||(i[3]=e=>t.isRef(g)?g.value=e:g=e),editorWrapper:t.unref(c)},null,8,["editor","showToolbar","toolbarStyle","editorWrapper"]),t.withDirectives((t.openBlock(),t.createElementBlock("div",UF,[t.createElementVNode("div",{class:t.normalizeClass(["editor-content",{noPadding:e.isInline}]),ref_key:"editorWrapper",ref:c},[t.createVNode(t.unref(Tl),{editor:t.unref(d),style:{width:"100%",height:"calc(100% - 40px)"}},null,8,["editor"]),t.unref(f)?(t.openBlock(),t.createBlock(PF,{key:0,editor:t.unref(d),info:e.info,onClose:E},null,8,["editor","info"])):t.createCommentVNode("",!0),t.createVNode(YM,{ref_key:"linkRef",ref:S,editor:t.unref(d),editorWrapper:t.unref(c),linkPosition:t.unref(v)},null,8,["editor","editorWrapper","linkPosition"]),t.withDirectives(t.createElementVNode("div",zF,[t.createVNode(QP,{editor:t.unref(d),editorWrapper:t.unref(c),coords:s.value.coords,apiHost:e.info.apiHost,token:e.info.token,uploadUrl:e.info.uploadUrl,uploadJupyter:e.info.uploadJupyter,uploadDoc:e.info.uploadDoc,getFileContent:e.info.getFileContent,showMenu:e.showMenu,onToggleLoading:A,onClosemenu:u,onShowLink:i[4]||(i[4]=e=>y())},null,8,["editor","editorWrapper","coords","apiHost","token","uploadUrl","uploadJupyter","uploadDoc","getFileContent","showMenu"])],512),[[t.vShow,s.value.isOpen&&!e.isInline]]),t.createVNode(t.unref(n.ElDialog),{modelValue:T.value,"onUpdate:modelValue":i[5]||(i[5]=e=>T.value=e),width:"60%"},{default:t.withCtx(()=>[t.createElementVNode("img",{src:C.value,style:{width:"100%"}},null,8,GF)]),_:1},8,["modelValue"]),t.createVNode(t.unref(n.ElDialog),{modelValue:w.value,"onUpdate:modelValue":i[8]||(i[8]=e=>w.value=e),title:"查看源代码",width:"70%","close-on-click-modal":!1},{footer:t.withCtx(()=>[t.createElementVNode("span",qF,[t.createVNode(t.unref(n.ElButton),{onClick:i[7]||(i[7]=e=>w.value=!1)},{default:t.withCtx(()=>[...i[9]||(i[9]=[t.createTextVNode("取消",-1)])]),_:1}),t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:R},{default:t.withCtx(()=>[...i[10]||(i[10]=[t.createTextVNode("确认",-1)])]),_:1})])]),default:t.withCtx(()=>[t.createElementVNode("div",$F,[t.createVNode(t.unref(n.ElInput),{modelValue:O.value,"onUpdate:modelValue":i[6]||(i[6]=e=>O.value=e),type:"textarea",rows:20,placeholder:"HTML源代码"},null,8,["modelValue"])])]),_:1},8,["modelValue"])],2)])),[[o,t.unref(a)]]),e.limitLength==1/0||e.isInline?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",HF,[t.createElementVNode("div",null,[t.renderSlot(r.$slots,"default",{},void 0,!0)]),t.createElementVNode("div",VF,t.toDisplayString(t.unref(uI)(t.unref(d).state.doc))+"/"+t.toDisplayString(e.limitLength),1)]))],4)],6)}}},[["__scopeId","data-v-61a8ac4c"]]),jF=[{name:"TiptapVue",component:YF}],WF={install:e=>{jF.forEach(t=>{e.component(t.name,t.component)})}};e.TiptapVue=YF,e.default=WF,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edu360-web-ui",
3
- "version": "1.0.106",
3
+ "version": "1.0.107",
4
4
  "homepage": "https://www.npmjs.com/search?q=shizhanyun-web-ui",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",