edu360-web-ui 1.0.124 → 1.0.126

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.
@@ -153113,6 +153113,16 @@ const _sfc_main = {
153113
153113
  }
153114
153114
  };
153115
153115
  const TiptapVue = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cedcbcbc"]]);
153116
+ if (!Array.prototype.findLast) {
153117
+ Array.prototype.findLast = function(predicate, thisArg) {
153118
+ for (let i = this.length - 1; i >= 0; i--) {
153119
+ if (predicate.call(thisArg, this[i], i, this)) {
153120
+ return this[i];
153121
+ }
153122
+ }
153123
+ return void 0;
153124
+ };
153125
+ }
153116
153126
  const components = [
153117
153127
  {
153118
153128
  name: "TiptapVue",
@@ -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,a=t.algo,o=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]),_=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=a.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 a,u,S,b,T,C,y,v,N,R,O,A=this._hash.words,I=d.words,D=_.words,w=o.words,x=s.words,M=l.words,k=c.words;for(C=a=A[0],y=u=A[1],v=S=A[2],N=b=A[3],R=T=A[4],n=0;n<80;n+=1)O=a+e[t+w[n]]|0,O+=n<16?p(u,S,b)+I[0]:n<32?m(u,S,b)+I[1]:n<48?g(u,S,b)+I[2]:n<64?h(u,S,b)+I[3]:f(u,S,b)+I[4],O=(O=E(O|=0,M[n]))+T|0,a=T,T=b,b=E(S,10),S=u,u=O,O=C+e[t+x[n]]|0,O+=n<16?f(y,v,N)+D[0]:n<32?h(y,v,N)+D[1]:n<48?g(y,v,N)+D[2]:n<64?m(y,v,N)+D[3]:p(y,v,N)+D[4],O=(O=E(O|=0,k[n]))+R|0,C=R,R=N,N=E(v,10),v=y,y=O;O=A[1]+S+N|0,A[1]=A[2]+b+R|0,A[2]=A[3]+T+C|0,A[3]=A[4]+a+y|0,A[4]=A[0]+u+v|0,A[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,a=i.words,o=0;o<5;o++){var s=a[o];a[o]=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 p(e,t,n){return e^t^n}function m(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 E(e,t){return e<<t|e>>>32-t}t.RIPEMD160=i._createHelper(u),t.HmacRIPEMD160=i._createHmacHelper(u)}(),e.RIPEMD160)),_P.exports;var e}(),mP(),function(){return gP||(gP=1,hP.exports=(l=IL(),JL(),mP(),t=(e=l).lib,n=t.Base,r=t.WordArray,i=e.algo,a=i.SHA256,o=i.HMAC,s=i.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=o.create(n.hasher,e),a=r.create(),s=r.create([1]),l=a.words,c=s.words,d=n.keySize,_=n.iterations;l.length<d;){var u=i.update(t).finalize(s);i.reset();for(var p=u.words,m=p.length,g=u,h=1;h<_;h++){g=i.finalize(g),i.reset();for(var f=g.words,E=0;E<m;E++)p[E]^=f[E]}a.concat(u),c[0]++}return a.sigBytes=4*d,a}}),e.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},l.PBKDF2)),hP.exports;var e,t,n,r,i,a,o,s,l}(),SP(),CP(),function(){return yP||(yP=1,vP.exports=(e=IL(),CP(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,r.encryptBlock(i,0);for(var o=0;o<n;o++)e[t+o]^=i[o]}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,a=e.slice(t,t+i);n.call(this,e,t,i,r),this._prevBlock=a}}),t}(),e.mode.CFB)),vP.exports;var e}(),function(){return NP||(NP=1,RP.exports=(n=IL(),CP(),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,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);n.encryptBlock(o,0),a[r-1]=a[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=o[s]}}),e.Decryptor=t,e),n.mode.CTR)),RP.exports;var e,t,n}(),IP(),function(){return DP||(DP=1,wP.exports=(n=IL(),CP(),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,a=this._keystream;i&&(a=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}}),e.Decryptor=t,e),n.mode.OFB)),wP.exports;var e,t,n}(),function(){return xP||(xP=1,MP.exports=(t=IL(),CP(),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)),MP.exports;var e,t}(),function(){return kP||(kP=1,LP.exports=(e=IL(),CP(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,i=r-n%r,a=n+i-1;e.clamp(),e.words[a>>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923)),LP.exports;var e}(),function(){return PP||(PP=1,FP.exports=(e=IL(),CP(),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)),FP.exports;var e}(),function(){return BP||(BP=1,UP.exports=(e=IL(),CP(),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)),UP.exports;var e}(),function(){return GP||(GP=1,YP.exports=(e=IL(),CP(),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)),YP.exports;var e}(),function(){return HP||(HP=1,VP.exports=(e=IL(),CP(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)),VP.exports;var e}(),function(){return zP||(zP=1,qP.exports=(r=IL(),CP(),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)),qP.exports;var e,t,n,r}(),function(){return $P||($P=1,WP.exports=(e=IL(),YL(),WL(),SP(),CP(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],a=[],o=[],s=[],l=[],c=[],d=[],_=[],u=[],p=[];!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 m=r^r<<1^r<<2^r<<3^r<<4;m=m>>>8^255&m^99,i[n]=m,a[m]=n;var g=e[n],h=e[g],f=e[h],E=257*e[m]^16843008*m;o[n]=E<<24|E>>>8,s[n]=E<<16|E>>>16,l[n]=E<<8|E>>>24,c[n]=E,E=16843009*f^65537*h^257*g^16843008*n,d[m]=E<<24|E>>>8,_[m]=E<<16|E>>>16,u[m]=E<<8|E>>>24,p[m]=E,n?(n=g^e[e[e[f^g]]],r^=e[e[r]]):n=r=1}}();var m=[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),a=this._keySchedule=[],o=0;o<r;o++)o<n?a[o]=t[o]:(c=a[o-1],o%n?n>6&&o%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^=m[o/n|0]<<24),a[o]=a[o-n]^c);for(var s=this._invKeySchedule=[],l=0;l<r;l++){if(o=r-l,l%4)var c=a[o];else c=a[o-4];s[l]=l<4||o<=4?c:d[i[c>>>24]]^_[i[c>>>16&255]]^u[i[c>>>8&255]]^p[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,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,_,u,p,a),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var l=this._nRounds,c=e[t]^n[0],d=e[t+1]^n[1],_=e[t+2]^n[2],u=e[t+3]^n[3],p=4,m=1;m<l;m++){var g=r[c>>>24]^i[d>>>16&255]^a[_>>>8&255]^o[255&u]^n[p++],h=r[d>>>24]^i[_>>>16&255]^a[u>>>8&255]^o[255&c]^n[p++],f=r[_>>>24]^i[u>>>16&255]^a[c>>>8&255]^o[255&d]^n[p++],E=r[u>>>24]^i[c>>>16&255]^a[d>>>8&255]^o[255&_]^n[p++];c=g,d=h,_=f,u=E}g=(s[c>>>24]<<24|s[d>>>16&255]<<16|s[_>>>8&255]<<8|s[255&u])^n[p++],h=(s[d>>>24]<<24|s[_>>>16&255]<<16|s[u>>>8&255]<<8|s[255&c])^n[p++],f=(s[_>>>24]<<24|s[u>>>16&255]<<16|s[c>>>8&255]<<8|s[255&d])^n[p++],E=(s[u>>>24]<<24|s[c>>>16&255]<<16|s[d>>>8&255]<<8|s[255&_])^n[p++],e[t]=g,e[t+1]=h,e[t+2]=f,e[t+3]=E},keySize:8});t.AES=n._createHelper(g)}(),e.AES)),WP.exports;var e}(),KP(),function(){return ZP||(ZP=1,XP.exports=(e=IL(),YL(),WL(),SP(),CP(),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 a=0;i<256;i++){var o=i%n,s=t[o>>>2]>>>24-o%4*8&255;a=(a+r[i]+s)%256;var l=r[i];r[i]=r[a],r[a]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){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 a=e[t];e[t]=e[n],e[n]=a,r|=e[(e[t]+e[n])%256]<<24-8*i}return this._i=t,this._j=n,r}t.RC4=n._createHelper(i);var o=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--)a.call(this)}});t.RC4Drop=n._createHelper(o)}(),e.RC4)),XP.exports;var e}(),function(){return JP||(JP=1,eF.exports=(e=IL(),YL(),WL(),SP(),CP(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],a=[],o=[],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 a=t.words,o=a[0],s=a[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),_=c>>>16|4294901760&d,u=d<<16|65535&c;for(i[0]^=c,i[1]^=_,i[2]^=d,i[3]^=u,i[4]^=c,i[5]^=_,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++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[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);o[n]=l^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=n._createHelper(s)}(),e.Rabbit)),eF.exports;var e}(),function(){return tF||(tF=1,nF.exports=(e=IL(),YL(),WL(),SP(),CP(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],a=[],o=[],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 a=t.words,o=a[0],s=a[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),_=c>>>16|4294901760&d,u=d<<16|65535&c;for(r[0]^=c,r[1]^=_,r[2]^=d,r[3]^=u,r[4]^=c,r[5]^=_,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++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[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);o[n]=l^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=n._createHelper(s)}(),e.RabbitLegacy)),nF.exports;var e}(),_F());const uF=qp(NL.exports),pF="0face1314520face";const mF={encrypt:function(e){const t=uF.enc.Utf8.parse(pF),n=uF.enc.Utf8.parse(pF);return uF.AES.encrypt(e,t,{iv:n,mode:uF.mode.CBC,padding:uF.pad.Pkcs7}).toString()},decrypt:function(e){const t=uF.enc.Utf8.parse(pF),n=uF.enc.Utf8.parse(pF);return uF.AES.decrypt(e,t,{iv:n,mode:uF.mode.CBC,padding:uF.pad.Pkcs7}).toString(uF.enc.Utf8)}},gF={class:"floating-menu-top"},hF={class:"floating-menu-top-btns"},fF={class:"floating-menu-common"},EF={class:"floating-menu-common-list"},SF={class:"block-menu-item-icon"},bF={class:"block-menu-item-icon"},TF={class:"block-menu-item-icon"},CF={class:"block-menu-item-icon"},yF={class:"block-menu-item-icon"},vF=By({__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,a=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}),o=(e,t)=>i.editor.isActive(e,t),s=t.ref(null),l=()=>{c(),u("closemenu"),u("showLink")},c=e=>{Object.keys(a).forEach(e=>a[e]=!1),e&&t.nextTick(()=>{u("closemenu",()=>{e&&e()})})},d=e=>{u("closemenu")},_=e=>{i.editor.chain().focus().setImage({src:e.data.show_url}).run()},u=r,p=()=>{o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")||(u("toggleLoading",!0),u("closemenu"))},m=e=>{let t={config:{apiHost:i.apiHost,token:i.token,getFileContent:i.getFileContent},data:{filename:e.data.filekey}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||"");Fx({editor:i.editor,content:t,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},g=()=>{o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("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}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||"");Fx({editor:i.editor,content:t,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},f=()=>{c(),u("closemenu","ai")},E=()=>{o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")||(c(),u("closemenu","codeblock"))};let S=t.ref(!1),b=t.ref(null);const T=e=>{b.value=e,S.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:b.value.row,cols:b.value.col,withHeaderRow:!0}).run():i.editor.chain().focus().insertTable({rows:b.value.row,cols:b.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",gF,[i[23]||(i[23]=t.createElementVNode("p",{class:"floating-menu-tit"},"基础",-1)),t.createElementVNode("div",hF,[t.unref(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"正文",placement:"bottom",visible:a.paragraph,"onUpdate:visible":i[1]||(i[1]=e=>a.paragraph=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"标题1",placement:"bottom",visible:a.heading1,"onUpdate:visible":i[3]||(i[3]=e=>a.heading1=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:2,class:"box-item",effect:"dark",content:"标题2",placement:"bottom",visible:a.heading2,"onUpdate:visible":i[5]||(i[5]=e=>a.heading2=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:3,class:"box-item",effect:"dark",content:"标题3",placement:"bottom",visible:a.heading3,"onUpdate:visible":i[7]||(i[7]=e=>a.heading3=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"标题4",placement:"bottom",visible:a.heading4,"onUpdate:visible":i[9]||(i[9]=e=>a.heading4=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"标题5",placement:"bottom",visible:a.heading5,"onUpdate:visible":i[11]||(i[11]=e=>a.heading5=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"标题6",placement:"bottom",visible:a.heading6,"onUpdate:visible":i[13]||(i[13]=e=>a.heading6=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("bulletList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:7,class:"box-item",effect:"dark",content:"无序列表",placement:"bottom",visible:a.bulletList,"onUpdate:visible":i[15]||(i[15]=e=>a.bulletList=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("orderedList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:8,class:"box-item",effect:"dark",content:"有序列表",placement:"bottom",visible:a.orderedList,"onUpdate:visible":i[17]||(i[17]=e=>a.orderedList=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("taskList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:9,class:"box-item",effect:"dark",content:"待办列表",placement:"bottom",visible:a.taskList,"onUpdate:visible":i[19]||(i[19]=e=>a.taskList=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("link",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:10,class:"box-item",effect:"dark",content:"链接",placement:"bottom",visible:a.link,"onUpdate:visible":i[20]||(i[20]=e=>a.link=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:link-variant",width:"20",onClick:l})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(Lx)("codeBlock",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:11,class:"box-item",effect:"dark",content:"代码块",placement:"bottom",visible:a.codeBlock,"onUpdate:visible":i[21]||(i[21]=e=>a.codeBlock=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:code-braces-box",class:t.normalizeClass(o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")?"icon-gray":""),width:"20",onClick:E},null,8,["class"])]),_:1},8,["visible"])):t.createCommentVNode("",!0)])]),t.createElementVNode("div",fF,[i[29]||(i[29]=t.createElementVNode("p",{class:"floating-menu-tit"},"通用",-1)),t.createElementVNode("div",EF,[t.unref(Lx)("ai",e.showMenu)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"block-menu-item",onClick:f},[t.createElementVNode("div",SF,[t.createVNode(Fy,{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":_,disabled:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}])},[t.createElementVNode("div",bF,[t.createVNode(Fy,{icon:"material-symbols:imagesmode-outline-sharp"})]),i[25]||(i[25]=t.createElementVNode("div",null,"上传本地图片",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(Lx)("image",e.showMenu)]]),t.withDirectives(t.createElementVNode("div",null,[t.createVNode(t.unref(n.ElPopover),{placement:"right",width:224,visible:t.unref(S),"onUpdate:visible":i[22]||(i[22]=e=>t.isRef(S)?S.value=e:S=e),disabled:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{reference:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}]),ref:"tableRef"},[t.createElementVNode("div",TF,[t.createVNode(Fy,{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(vL,{onSelect:T})])]),_:1},8,["visible","disabled"])],512),[[t.vShow,t.unref(Lx)("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":m,"before-upload":p,disabled:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}])},[t.createElementVNode("div",CF,[t.createVNode(Fy,{icon:"tabler:file-word"})]),i[27]||(i[27]=t.createElementVNode("div",null,"上传word文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(Lx)("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:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}])},[t.createElementVNode("div",yF,[t.createVNode(TL,{width:20,height:20,color:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")?"#999999":"currentColor"},null,8,["color"])]),i[28]||(i[28]=t.createElementVNode("div",null,"上传jupyter文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(Lx)("jupyter",e.showMenu)]])])])],4),t.createVNode(SL,{ref_key:"linkRef",ref:s,editor:e.editor},null,8,["editor"])],64))}},[["__scopeId","data-v-6eb1e6f8"]]);function NF(e,n){const r=new Dt("blockMenu");let i=n.wrapperEl||null;const a={isPopoverOpen:!1};return new Ot({key:r,view(o){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(vF,{editor:e,menuState:a,...n.props})});l.mount(s);let c=null,d=!1,_=null;function u(){s.style.display="none",c=null}function p(){clearTimeout(_),_=setTimeout(()=>{d||c&&c.matches(":hover")||u()},100)}function m(e){clearTimeout(_);!function(e){if(c=e,a.isPopoverOpen)return;const t=e.getBoundingClientRect(),n=o.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(){p()}function h(){Array.from(o.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",m),e.removeEventListener("mouseleave",g),e.addEventListener("mouseenter",m),e.addEventListener("mouseleave",g)})}s.addEventListener("mouseenter",()=>{clearTimeout(_),d=!0}),s.addEventListener("mouseleave",()=>{d=!1,p()}),h();const f={update(){h(),c&&!o.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}})}Ho.create({name:"blockMenuExtension",addOptions:()=>({props:{apiHost:"",token:"",uploadUrl:"",uploadDoc:"",uploadJupyter:"",getFileContent:"",isInline:!1,showMenu:[]}}),addProseMirrorPlugins(){return this.options.props.isInline?[]:[NF(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 RF=Cu.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 Dt("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 a=document.createElement("img");if(a.src=e.attrs.src,a.alt=e.attrs.alt||"",a.title=e.attrs.title||"",a.style.display="block",a.style.borderRadius="4px",e.attrs.width&&(a.style.width=e.attrs.width+"px"),e.attrs.height&&(a.style.height=e.attrs.height+"px"),r)return i.appendChild(a),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(a.src=e.attrs.src,a.alt=e.attrs.alt||"",a.title=e.attrs.title||"",e.attrs.width?a.style.width=e.attrs.width+"px":a.style.width="",e.attrs.height?a.style.height=e.attrs.height+"px":a.style.height="",!0),destroy:()=>{i.remove()}};const o=document.createElement("div");o.style.position="absolute",o.style.top="8px",o.style.right="8px",o.style.display="flex",o.style.gap="6px",o.style.opacity="0",o.style.visibility="hidden",o.style.transition="all .2s",o.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","重置大小");o.appendChild(l),o.appendChild(c),o.appendChild(d),l.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("tiptap-image-click",{detail:a.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 o=Math.max(50,i.clientWidth-60),s=(a.naturalWidth||a.offsetWidth||1)/(a.naturalHeight||a.offsetHeight||1),l=Math.round(o),c=Math.round(l/s);if(a.style.width=l+"px",a.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 _=["nw","ne","sw","se"],u={};_.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",()=>{o.style.opacity="1",o.style.visibility="visible",Object.values(u).forEach(e=>{e.style.opacity="1",e.style.visibility="visible"})}),i.addEventListener("mouseleave",()=>{o.style.opacity="0",o.style.visibility="hidden",Object.values(u).forEach(e=>{e.style.opacity="0",e.style.visibility="hidden"})});return _.forEach(r=>{u[r].addEventListener("mousedown",i=>((r,i)=>{r.preventDefault(),r.stopPropagation();const o=r.clientX,s=r.clientY,l=a.offsetWidth,c=a.offsetHeight,d=l/c||1,_=i.includes("w"),u=i.includes("n"),p=e=>{let t,n,r=e.clientX-o,i=e.clientY-s;if(_&&(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)}a.style.width=t+"px",a.style.height=n+"px"},m=r=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m);let i,a,g=r.clientX-o,h=r.clientY-s;if(_&&(g=-g),u&&(h=-h),r.shiftKey)i=Math.max(50,l+g),a=Math.max(50,c+h);else{const e=(g+h)/2;i=Math.max(50,l+e),a=Math.max(50,i/d)}if("function"==typeof n){const r=n(),o=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:Math.round(i),height:Math.round(a)});t.view.dispatch(o)}};document.addEventListener("mousemove",p),document.addEventListener("mouseup",m)})(i,r))}),i.appendChild(a),i.appendChild(o),_.forEach(e=>i.appendChild(u[e])),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(a.src=e.attrs.src,a.alt=e.attrs.alt||"",a.title=e.attrs.title||"",e.attrs.width?a.style.width=e.attrs.width+"px":a.style.width="",e.attrs.height?a.style.height=e.attrs.height+"px":a.style.height="",!0),destroy:()=>{i.remove()}}}}});tR(),T_.extend({content:"inline*"});const OF=Gp.extend({content:"(paragraph | bulletList | orderedList)*",addAttributes(){var e;return{...null==(e=this.parent)?void 0:e.call(this),colspan:{default:1,parseHTML:e=>{const t=e.getAttribute("colspan");return t?parseInt(t,10):1},renderHTML:e=>e.colspan>1?{colspan:e.colspan}:{}},rowspan:{default:1,parseHTML:e=>{const t=e.getAttribute("rowspan");return t?parseInt(t,10):1},renderHTML:e=>e.rowspan>1?{rowspan:e.rowspan}:{}},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("data-colwidth"),n=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):n?n.split(",").map(e=>parseInt(e,10)):null},renderHTML:e=>e.colwidth?{"data-colwidth":e.colwidth.join(",")}:{}}}}}),AF=Yp.extend({content:"(paragraph | bulletList | orderedList)*",addAttributes(){var e;return{...null==(e=this.parent)?void 0:e.call(this),colspan:{default:1,parseHTML:e=>{const t=e.getAttribute("colspan");return t?parseInt(t,10):1},renderHTML:e=>e.colspan>1?{colspan:e.colspan}:{}},rowspan:{default:1,parseHTML:e=>{const t=e.getAttribute("rowspan");return t?parseInt(t,10):1},renderHTML:e=>e.rowspan>1?{rowspan:e.rowspan}:{}},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("data-colwidth"),n=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):n?n.split(",").map(e=>parseInt(e,10)):null},renderHTML:e=>e.colwidth?{"data-colwidth":e.colwidth.join(",")}:{}}}}});function IF(e,t){if(0===e.length)return"";const n=["<table>"];let r=!1,i=!1;for(let a=0;a<e.length;a++){const t=e[a];if("separator"===t.type){r=!0;continue}const o=t.content,s=o.substring(1,o.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 DF=({content:e="",info:t={},limit:r=50,isInline:i=!1,showMenu:a=[],placeholder:o="",blockMenuFn:s,editorWrapper:l,checkSlashTrigger:c}={})=>{const _=new Cl({extensions:[du.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}),MM.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?o||"输入“/”插入内容":null},showOnlyWhenEditable:!0,showOnlyCurrent:!1}),_u,pu,bu,Vp,oR,RF.configure({inline:!1,allowBase64:!1,isInline:i}),Su.configure({multicolor:!0}),Fp.configure({resizable:!0,handleWidth:5,cellMinWidth:25,lastColumnResizable:!0,allowTableNodeSelection:!1,HTMLAttributes:{class:"my-custom-table"}}),OF,AF,Up,sR,iR.configure({isInline:i}),t_.configure({HTMLAttributes:{class:"bullet-list"},nested:!0}),h_.configure({HTMLAttributes:{class:"ordered-list"},nested:!0}),n_.configure({HTMLAttributes:{class:"list-item"},nested:!0}),S_,E_.configure({nested:!1}),aR,Hp.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"],defaultAlignment:"left"}),Zd.configure({openOnClick:!1,defaultProtocol:"https"}),xM.configure({props:{apiHost:t.apiHost,token:t.token,askUrl:t.askUrl,answerUrl:t.answerUrl}}),(u={limit:r},Ho.create({name:"characterLimiter",addProseMirrorPlugins:()=>[new Ot({key:new Dt("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),a=r(e.doc),o=u.limit;return!(a>o&&a>i&&(n.ElMessage.warning(`已超出最大字数限制:${o}`),1))}})]}))],editorProps:{handlePaste:(e,i,a)=>{var o,l;if(Px(e.state.doc)+a.content.size>r)return n.ElMessage.warning(`粘贴失败:内容将超过最大长度限制 ${r}。`),!0;const c=Array.from((null==(o=i.clipboardData)?void 0:o.items)||[]).find(e=>e.type.startsWith("image/"));if(c){const{selection:r}=e.state,{$from:a}=r;let o=!1;for(let e=a.depth;e>0;e--)if("tableCell"===a.node(e).type.name||"tableHeader"===a.node(e).type.name){o=!0;break}if(o)return i.preventDefault(),n.ElMessage.warning("表格中不支持粘贴图片"),!0;i.preventDefault();const s=c.getAsFile();if(!s)return!1;const l=new FormData;l.append("file",s);return((e,t)=>xA({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}},l).then(e=>{e&&e.data&&e.data.show_url?_.chain().focus().setImage({src:e.data.show_url}).run():n.ElMessage.error("图片上传失败")}).catch(e=>{n.ElMessage.error("图片上传失败")}),!0}const d=null==(l=i.clipboardData)?void 0:l.getData("text/plain");if(d&&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}(d)){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=IF(e);n.push(t)}}else n.push(e),r++}return n.join("\n")}(d)}catch(u){e=d}try{t=new Dw({html:!0,linkify:!0,typographer:!1,breaks:!1}).render(e)}catch(p){throw p}try{r=LA(t,[du.configure({codeBlock:!1,strike:!1,bulletList:!1,orderedList:!1,listItem:!1}),bu,Vp,Bp,Hp,t_,h_,n_])}catch(m){throw m}if(r&&r.content){const e=r.content.length;if(e>100){n.ElMessage.info(`正在插入 ${e} 个内容块...`),s&&s(!0);const t=_.isEditable;_.setEditable(!1),Fx({editor:_,content:r.content,type:"json",extensions:[],chunkSize:100,isPaste:!0,onProgress:e=>{if(1===e){performance.now(),startTime;_.setEditable(t),n.ElMessage.success("内容已插入完成"),s&&s(!1)}},onComplete:()=>{_.setEditable(t),s&&s(!1)}})}else _.chain().focus().insertContent(r.content).run(),setTimeout(()=>{_.view.updateState(_.state);const{tr:e}=_.state;_.view.dispatch(e),_.commands.focus()},0)}}catch(g){try{_.chain().focus().insertContent(d).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)||(_.chain().focus("end").run(),!0)}return!1},transformPasted:(e,t)=>{const{selection:r}=t.state,{$from:i}=r;let a=!1;for(let n=i.depth;n>0;n--)if("tableCell"===i.node(n).type.name||"tableHeader"===i.node(n).type.name){a=!0;break}if(!a)return e;let o=!1;const s=new Set,l=e=>{if("image"===e.type.name||"table"===e.type.name||"codeBlock"===e.type.name||"codeBlockCustom"===e.type.name)return o=!0,"image"===e.type.name?s.add("图片"):"table"===e.type.name?s.add("表格"):"codeBlock"!==e.type.name&&"codeBlockCustom"!==e.type.name||s.add("代码块"),null;if(e.content&&e.content.size>0){const t=[];return e.content.forEach(e=>{const n=l(e);n&&t.push(n)}),0===t.length&&"paragraph"!==e.type.name?null:e.copy(d.from(t))}return e},c=[];if(e.content.forEach(e=>{const t=l(e);t&&c.push(t)}),o){const e=Array.from(s).join("、");n.ElMessage.warning(`表格中不支持粘贴${e},已自动过滤`)}return new h(d.from(c),e.openStart,e.openEnd)}},editable:!0,content:"",onDrop({Editor:e}){}});var u;return _},wF=["onClick"],xF={key:0},MF={class:"phrases-btns"},kF={__name:"CommonExpression",props:{from:{type:String,default:""},info:{type:Object,default:()=>{}}},emits:["close"],setup(e,{emit:r}){const i=e;let a=t.ref(!0);const o=r,s=()=>{a.value=!1,o("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}};kA(e).then(e=>{l.value=e.data.list||[]})};c();const d=()=>{l.value.unshift({content:"",editStatus:!0,op:"add"}),_.value=l.value[0]};t.ref(!1);let _=t.ref({});t.ref(!1);const u=t.ref(null),p=e=>{_.value=e,_.value.user_id>0&&(e.editStatus=!0,t.nextTick(()=>{u.value.focus()}))},m=()=>{if(!_.value.content)return void n.ElMessage.warning("请输入常用语");let e={config:{apiHost:i.info.apiHost,token:i.info.token},data:{content:_.value.content,type:0}};"add"==_.value.op?(e.config.apiUrl=i.info.expressionUrls.create,kA(e).then(e=>{n.ElMessage.success("新增成功"),c()})):(e.config.apiUrl=i.info.expressionUrls.update,e.data.id=_.value.id,kA(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 >");o("add",e)};return(e,r)=>(t.openBlock(),t.createBlock(t.unref(n.ElDrawer),{modelValue:t.unref(a),"onUpdate:modelValue":r[1]||(r[1]=e=>t.isRef(a)?a.value=e:a=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(Fy,{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=>p(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:m,maxlength:"500"},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(t.openBlock(),t.createElementBlock("p",xF,t.toDisplayString(e.content),1))],8,wF)]),_: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=>p(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=>{_.value=e;let t={config:{apiHost:i.info.apiHost,token:i.info.token,apiUrl:i.info.expressionUrls.delete},data:{id:_.value.id}};kA(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",MF,[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"]))}},LF=By(kF,[["__scopeId","data-v-28ce6f0a"]]),PF={paragraph:"正文",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6"},FF={class:"toolbar"},BF={key:2,class:"flex-center"},UF={class:"flex-center"},GF={key:3,class:"flex-center"},YF={class:"flex-center"},HF={class:"flex-center"},VF={class:"flex-center"},zF={class:"flex-center"},qF={class:"table-content"},$F={key:7},WF=By({__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(),a=e;let o=t.ref("14px"),s=t.ref("#000"),l=t.ref("");const c=(e,t)=>a.editor.isActive(e,t),d=t.computed(()=>!!a.editor&&(a.editor.isActive("codeBlock")||a.editor.isActive("codeBlockCustom")));let _=t.ref("正文");const u=e=>{if("paragraph"===e)a.editor.chain().focus().setParagraph().run();else{const t=parseInt(e.replace("h",""),10);a.editor.chain().focus().setHeading({level:t}).run()}_.value=PF[e]},p=["12px","14px","16px","18px","20px","24px"],m=e=>{a.editor.chain().focus().setFontSize(e).run(),o.value=e},g=e=>a.editor.chain().focus().setColor(e).run(),h=e=>{e?a.editor.chain().focus().setHighlight({color:e}).run():a.editor.chain().focus().unsetHighlight().run()};let f=t.ref("left");const E=e=>{f.value=e,a.editor.chain().focus().setTextAlign(e).run()},S=e=>{},b=e=>{a.editor.chain().focus().setImage({src:e.data.show_url}).run()},T=()=>{a.editor.chain().focus().insertContent({type:"codeBlock",attrs:{language:"javascript"}}).run()};let C=t.ref(!1);const y=e=>{a.editor.chain().focus().insertTable({rows:e.row,cols:e.col,withHeaderRow:!0}).run(),C.value=!1},v=()=>{N("showLink")},N=r,R=()=>{const{from:e,to:t}=a.editor.state.selection;e!==t?N("showAi"):(a.editor.chain().focus().insertContent({type:"aiAssistant"}).run(),a.editor.setEditable(!1))},O=()=>{N("showSource")},A=()=>{if(!a.editor)return;const e=n.ElMessage({message:"正在处理,请稍候...",type:"info",duration:0,iconClass:"el-icon-loading"});setTimeout(()=>{try{const{state:t}=a.editor,{doc:r}=t;let{tr:i}=t,o=0;const s=[];let l=0;r.descendants(e=>{"paragraph"===e.type.name&&l++}),r.descendants((e,t)=>{if("paragraph"===e.type.name){const n=(e.textContent||"").replace(/\u00a0/g," ").trim(),r=0===e.content.size||""===n;if(/^(In|Out)\s*\[\s*\d*\s*\]\s*:?\s*$/i.test(n))return s.push({type:"replaceJupyter",pos:t,size:e.nodeSize,attrs:e.attrs}),void o++;r&&!(1===l&&r)&&(s.push({type:"delete",pos:t,size:e.nodeSize}),o++)}else if("heading"===e.type.name){let n=!1;e.descendants(e=>{if("link"===e.type.name&&e.marks){e.marks.find(e=>"link"===e.type.name)&&"¶"===e.textContent&&(n=!0)}if("text"===e.type.name&&"¶"===e.text){e.marks&&e.marks.some(e=>"link"===e.type.name&&"anchor-link"===e.attrs.class)&&(n=!0)}}),n&&(s.push({type:"removeAnchorLink",pos:t,node:e}),o++)}else if("codeBlock"===e.type.name||"codeBlockCustom"===e.type.name){const n=e.textContent;if(n&&""!==n.trim()){if(n.includes("\n")){const r=n.split("\n"),i=[];let a=0;for(const e of r)""!==e.trim()?i.push(e):a++;a>0&&i.length>0&&s.push({type:"updateCodeBlock",pos:t,nodeSize:e.nodeSize,newContent:i.join("\n"),emptyCount:a})}}else s.push({type:"delete",pos:t,size:e.nodeSize}),o++}}),s.sort((e,t)=>t.pos-e.pos);for(const e of s)if("delete"===e.type)i=i.delete(e.pos,e.pos+e.size);else if("replaceJupyter"===e.type){const n=t.schema.nodes.paragraph.create(e.attrs||null);i=i.replaceWith(e.pos,e.pos+e.size,n)}else if("updateCodeBlock"===e.type){const n=e.pos+1,r=e.pos+e.nodeSize-1;i=i.replaceWith(n,r,t.schema.text(e.newContent)),o+=e.emptyCount}else if("removeAnchorLink"===e.type){const n=e.node,r=[];n.content.forEach(e=>{if("text"===e.type.name&&"¶"===e.text){if(e.marks&&e.marks.some(e=>"link"===e.type.name&&"anchor-link"===e.attrs.class))return}r.push(e)});const a=t.schema.nodes.heading.create(n.attrs,r);i=i.replaceWith(e.pos,e.pos+n.nodeSize,a)}e.close(),o>0?(0===i.doc.content.size&&(i=i.insert(0,t.schema.nodes.paragraph.create())),a.editor.view.dispatch(i),n.ElMessage.success(`已删除 ${o} 项(空行和代码块空行)`)):n.ElMessage.info("文档已经很干净了,没有需要删除的内容")}catch(t){e.close(),n.ElMessage.error("处理失败: "+t.message)}},100)},I=t.ref(!1),D=()=>{I.value=!0},w=()=>{I.value=!1},x=e=>{a.editor.chain().focus().insertContent(e).run(),I.value=!1},M={paragraph:"正文",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"};a.editor.view.dom.addEventListener("mousedown",e=>{var t;const n=a.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}(a.editor,n.pos),i=(null==(t=null==r?void 0:r.attrs)?void 0:t.textAlign)||"left";f.value=i});const k=()=>{N("toggleLoading",!0)},L=e=>{let t={config:{apiHost:a.info.apiHost,token:a.info.token,getFileContent:a.info.getFileContent},data:{filename:e.data.filekey}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||"");Fx({editor:a.editor,content:t,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)},onComplete:()=>{a.editor.commands.focus("end")}})})},P=()=>{N("toggleLoading",!0)},F=e=>{let t={config:{apiHost:a.info.apiHost,token:a.info.token,getFileContent:a.info.getFileContent},data:{filename:e.data.filekey}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||""),n=(new DOMParser).parseFromString(t,"text/html").body;n.querySelectorAll("script").forEach(e=>e.remove()),n.querySelectorAll("style").forEach(e=>e.remove());const r=n.innerHTML.replace(/<!--[\s\S]*?-->/g,"").replace(/\n\s*\n\s*\n/g,"\n\n").trim();Fx({editor:a.editor,content:r,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)},onComplete:()=>{const{doc:e}=a.editor.state;e.content.size;a.editor.commands.focus("end")}})}).catch(e=>{N("toggleLoading",!1),n.ElMessage.error("Jupyter 文件解析失败: "+e.message)})};return t.watchEffect(()=>{if(!a.editor)return;const{from:e,to:t}=a.editor.state.selection;if(e!==t){const e=a.editor.getAttributes("textStyle");o.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(a.editor.isActive("heading",{level:i})){_.value=M["h"+i],r=!0;break}r||(_.value=M.paragraph)}),(r,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",FF,[t.unref(Lx)("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:R,link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"hugeicons:ai-chat-02",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(_)),1),t.createVNode(Fy,{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:m,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(p,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(o)),1),t.createVNode(Fy,{icon:"ic:baseline-expand-more",width:"16"})],2)]),_:1},8,["disabled"])]),_:1}),t.unref(Lx)("color",e.showMenu)?(t.openBlock(),t.createElementBlock("div",BF,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"字体颜色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",UF,[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(Lx)("bgColor",e.showMenu)?(t.openBlock(),t.createElementBlock("div",GF,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"背景色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",YF,[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(Lx)("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(Fy,{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(Lx)("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(Fy,{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(Lx)("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(Fy,{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(Lx)("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(Fy,{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(Lx)("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(Fy,{icon:"mdi:format-list-bulleted",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(Fy,{icon:"mdi:format-list-numbered",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(Fy,{icon:"mdi:format-list-checkbox",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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:v,type:c("link")?"primary":"",link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(Fy,{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:E,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(Fy,{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(Lx)("center",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"center"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("right",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"right"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("justify",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"justify"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Fy,{icon:`mdi:format-align-${t.unref(f)}`,width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["icon","class"]),t.createVNode(Fy,{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",HF,[!e.isBubble&&t.unref(Lx)("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":S,"on-success":b,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:file-image-box",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",VF,[!e.isBubble&&t.unref(Lx)("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":k,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(Fy,{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",zF,[!e.isBubble&&t.unref(Lx)("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":F,"before-upload":P,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(TL,{width:20,height:20,color:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"#999999":"currentColor"},null,8,["color"])]),_:1},8,["action","headers","disabled"])]),_:1})):t.createCommentVNode("",!0)]),!e.isBubble&&t.unref(Lx)("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:T,link:"",disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(Fy,{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",qF,[t.createVNode(t.unref(n.ElPopover),{placement:"bottom",title:"",width:224,trigger:"click",visible:t.unref(C),"onUpdate:visible":i[9]||(i[9]=e=>t.isRef(C)?C.value=e:C=e),disabled:c("table")||c("bulletList")||c("orderedList")||c("taskList")||c("codeBlock")},{reference:t.withCtx(()=>[t.createVNode(Fy,{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(vL,{onSelect:y})])]),_:1},8,["visible","disabled"])])]),_:1})],512),[[t.vShow,!e.isBubble&&t.unref(Lx)("table",e.showMenu)]]),t.createVNode(t.unref(n.ElButtonGroup),null,{default:t.withCtx(()=>[t.unref(Lx)("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(Fy,{icon:"mdi:undo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(Fy,{icon:"mdi:redo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}),!e.isBubble&&t.unref(Lx)("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(Fy,{icon:"mdi:code-tags",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(Lx)("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:A,link:"",style:{"margin-left":"0px"}},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:format-clear",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(Lx)("expression",e.showMenu)?(t.openBlock(),t.createElementBlock("div",$F,[t.createVNode(t.unref(n.ElButton),{link:"",onClick:D},{default:t.withCtx(()=>[...i[17]||(i[17]=[t.createTextVNode("插入常用语",-1)])]),_:1})])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"default",{},void 0,!0)]),I.value?(t.openBlock(),t.createBlock(LF,{key:0,info:e.info,onClose:w,onAdd:x},null,8,["info"])):t.createCommentVNode("",!0)],64))}},[["__scopeId","data-v-fb5ad3e3"]]),jF={class:"bubble-menu"},QF=By({__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:a,selection:o}=t;return o.node,o.$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 a=n,o=()=>{i.value=!0,a("showAi")},s=()=>{a("showLink")};return(n,i)=>(t.openBlock(),t.createBlock(t.unref(mL),{editor:e.editor,"should-show":r},{default:t.withCtx(()=>[t.createElementVNode("div",jF,[t.createVNode(WF,{editor:e.editor,info:e.info,isBubble:!0,showMenu:e.showMenu,onShowAi:o,onShowLink:s},null,8,["editor","info","showMenu"])])]),_:1},8,["editor"]))}},[["__scopeId","data-v-dc69236f"]]),KF={class:"table-toolbar-btns"},ZF={class:"table-toolbar-btns"},XF={class:"table-toolbar-btns"},JF=By({__name:"TableToolbar",props:{editor:{type:Object,required:!0},editorWrapper:{type:Object,default:null}},setup(e){const r=e,i=t.ref(null),a=t.ref(!1),o=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"}),_=t.computed(()=>r.editor.can().mergeCells()),u=t.computed(()=>r.editor.can().splitCell()),p=()=>{var e,t;const n=r.editor;if(!n||!n.view)return;const i=n.state,{selection:_}=i;if(!n.isActive("table"))return a.value=!1,o.value=!1,void(c.value=!1);const u=Ya(e=>"tableCell"===e.type.name||"tableHeader"===e.type.name)(_);if(!u)return a.value=!1,o.value=!1,void(c.value=!1);const p=Ya(e=>"tableRow"===e.type.name)(_),g=Ya(e=>"table"===e.type.name)(_);if(!p||!g)return a.value=!1,o.value=!1,void(c.value=!1);const h=n.view,f=h.nodeDOM(u.pos),E=h.nodeDOM(p.pos),S=h.nodeDOM(g.pos);if(!(f instanceof HTMLElement&&E instanceof HTMLElement&&S instanceof HTMLElement))return a.value=!1,o.value=!1,void(c.value=!1);const b=h.dom.getBoundingClientRect(),T=f.getBoundingClientRect(),C=E.getBoundingClientRect(),y=S.getBoundingClientRect(),v=C.left-b.left-30,N=(null==(e=r.editorWrapper)?void 0:e.scrollTop)||0,R=C.top-b.top+C.height/2+18-N;s.value={position:"absolute",left:`${Math.max(v,-10)}px`,top:`${Math.max(R,0)}px`,zIndex:1e3},a.value=!0;const O=(T.left+T.right)/2+10-b.left-20,A=(null==(t=h.dom)?void 0:t.scrollTop)||0,I=y.top-b.top-A-N;l.value={position:"absolute",left:`${O}px`,top:`${Math.max(I,0)}px`,zIndex:1e3},o.value=!0;const D=y.right-b.left+10,w=y.top-b.top;d.value={position:"absolute",left:`${D}px`,top:`${Math.max(w,0)}px`,zIndex:1e3};const{from:x,to:M}=_,k=m(n,x,M);c.value=k.length>1},m=(e,t,n)=>{const r=[],{state:i}=e,{doc:a}=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},E=()=>{r.editor.chain().focus().addRowBefore().run(),g.value=!1},S=()=>{r.editor.chain().focus().deleteRow().run(),g.value=!1},b=()=>{r.editor.chain().focus().addColumnAfter().run(),h.value=!1},T=()=>{r.editor.chain().focus().addColumnBefore().run(),h.value=!1},C=()=>{r.editor.chain().focus().deleteColumn().run(),h.value=!1},y=()=>{r.editor.chain().focus().deleteTable().run(),g.value=!1,h.value=!1},v=()=>{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 R=null;return t.onMounted(()=>{r.editor&&(R=()=>p(),r.editor.on&&r.editor.on("selectionUpdate",R)),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0),t.nextTick(()=>{p()})}),t.onBeforeUnmount(()=>{r.editor&&R&&r.editor.off&&r.editor.off("selectionUpdate",R),window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0)}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{class:"table-toolbar-wrapper",ref_key:"toolbarRoot",ref:i},[t.createElementVNode("div",KF,[t.renderSlot(e.$slots,"default",{},void 0,!0)]),a.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(Fy,{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",ZF,[t.createElementVNode("div",{onClick:f},"下方插入行"),t.createElementVNode("div",{onClick:E},"上方插入行"),t.createElementVNode("div",{onClick:S},"删除行"),t.createElementVNode("div",{class:"danger",onClick:y},"删除表格"),_.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:v},"合并单元格")):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:N},"拆分单元格")):t.createCommentVNode("",!0)])]),_:1},8,["visible"])],4)):t.createCommentVNode("",!0),o.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(Fy,{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",XF,[t.createElementVNode("div",{onClick:b},"右方插入列"),t.createElementVNode("div",{onClick:T},"左方插入列"),t.createElementVNode("div",{onClick:C},"删除列"),t.createElementVNode("div",{class:"danger",onClick:y},"删除表格"),_.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:v},"合并单元格")):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-3bf9a61b"]]);function eB(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tB={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function nB(e){tB=e}var rB={exec:()=>null};function iB(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(oB.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var aB=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),oB={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")},sB=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,lB=/(?:[*+-]|\d{1,9}[.)])/,cB=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dB=iB(cB).replace(/bull/g,lB).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(),_B=iB(cB).replace(/bull/g,lB).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(),uB=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pB=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mB=iB(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pB).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gB=iB(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lB).getRegex(),hB="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",fB=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,EB=iB("^ {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",fB).replace("tag",hB).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),SB=iB(uB).replace("hr",sB).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",hB).getRegex(),bB={blockquote:iB(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",SB).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:mB,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:sB,html:EB,lheading:dB,list:gB,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:SB,table:rB,text:/^[^\n]+/},TB=iB("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sB).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",hB).getRegex(),CB={...bB,lheading:_B,table:TB,paragraph:iB(uB).replace("hr",sB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",TB).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",hB).getRegex()},yB={...bB,html:iB("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",fB).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:rB,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:iB(uB).replace("hr",sB).replace("heading"," *#{1,6} *[^\n]").replace("lheading",dB).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vB=/^( {2,}|\\)\n(?!\s*$)/,NB=/[\p{P}\p{S}]/u,RB=/[\s\p{P}\p{S}]/u,OB=/[^\s\p{P}\p{S}]/u,AB=iB(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,RB).getRegex(),IB=/(?!~)[\p{P}\p{S}]/u,DB=iB(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",aB?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),wB=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,xB=iB(wB,"u").replace(/punct/g,NB).getRegex(),MB=iB(wB,"u").replace(/punct/g,IB).getRegex(),kB="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",LB=iB(kB,"gu").replace(/notPunctSpace/g,OB).replace(/punctSpace/g,RB).replace(/punct/g,NB).getRegex(),PB=iB(kB,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,IB).getRegex(),FB=iB("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,OB).replace(/punctSpace/g,RB).replace(/punct/g,NB).getRegex(),BB=iB(/\\(punct)/,"gu").replace(/punct/g,NB).getRegex(),UB=iB(/^<(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(),GB=iB(fB).replace("(?:--\x3e|$)","--\x3e").getRegex(),YB=iB("^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",GB).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),HB=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,VB=iB(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",HB).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zB=iB(/^!?\[(label)\]\[(ref)\]/).replace("label",HB).replace("ref",pB).getRegex(),qB=iB(/^!?\[(ref)\](?:\[\])?/).replace("ref",pB).getRegex(),$B=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,WB={_backpedal:rB,anyPunctuation:BB,autolink:UB,blockSkip:DB,br:vB,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:rB,emStrongLDelim:xB,emStrongRDelimAst:LB,emStrongRDelimUnd:FB,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:VB,nolink:qB,punctuation:AB,reflink:zB,reflinkSearch:iB("reflink|nolink(?!\\()","g").replace("reflink",zB).replace("nolink",qB).getRegex(),tag:YB,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:rB},jB={...WB,link:iB(/^!?\[(label)\]\((.*?)\)/).replace("label",HB).getRegex(),reflink:iB(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",HB).getRegex()},QB={...WB,emStrongRDelimAst:PB,emStrongLDelim:MB,url:iB(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$B).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:iB(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$B).getRegex()},KB={...QB,br:iB(vB).replace("{2,}","*").getRegex(),text:iB(QB.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ZB={normal:bB,gfm:CB,pedantic:yB},XB={normal:WB,gfm:QB,breaks:KB,pedantic:jB},JB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eU=e=>JB[e];function tU(e,t){if(t){if(oB.escapeTest.test(e))return e.replace(oB.escapeReplace,eU)}else if(oB.escapeTestNoEncode.test(e))return e.replace(oB.escapeReplaceNoEncode,eU);return e}function nU(e){try{e=encodeURI(e).replace(oB.percentDecode,"%")}catch{return null}return e}function rU(e,t){var n;let r=e.replace(oB.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(oB.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(oB.slashPipe,"|");return r}function iU(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 aU(e,t,n,r,i){let a=t.href,o=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:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,l}var oU=class{constructor(e){a(this,"options"),a(this,"rules"),a(this,"lexer"),this.options=e||tB}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:iU(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=iU(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:iU(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=iU(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,a=!1,o=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))o.push(e[t]),a=!0;else{if(a)break;o.push(e[t])}e=e.slice(t);let s=o.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,a=t.raw+"\n"+e.join("\n"),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if("list"===(null==d?void 0:d.type)){let t=d,a=t.raw+"\n"+e.join("\n"),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-d.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.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 a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",s="";if(!(t=a.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(),_=0;if(this.options.pedantic?(_=2,s=l.trimStart()):d?_=t[1].length+1:(_=t[2].search(this.rules.other.nonSpaceChar),_=_>4?1:_,s=l.slice(_),_+=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(_),n=this.rules.other.hrRegex(_),i=this.rules.other.fencesBeginRegex(_),a=this.rules.other.headingBeginRegex(_),o=this.rules.other.htmlBeginRegex(_);for(;e;){let u,p=e.split("\n",1)[0];if(c=p,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||a.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=_||!c.trim())s+="\n"+u.slice(_);else{if(d||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||a.test(l)||n.test(l))break;s+="\n"+c}!d&&!c.trim()&&(d=!0),r+=p+"\n",e=e.substring(p.length+1),l=u.slice(_)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let u,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(s),p&&(u="[ ] "!==p[0],s=s.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!p,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=rU(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(null==(t=n[3])?void 0:t.trim())?n[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<r.length;e++)o.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:o.align[e]});for(let e of a)o.rows.push(rU(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}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=iU(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)),aU(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 aU(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,a=[...r[0]].length-1,o=a,s=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+a);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]){o+=i;continue}if((r[5]||r[6])&&a%3&&!((a+i)%3)){s+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+s);let t=[...r[0]][0].length,l=e.slice(0,a+r.index+t+i);if(Math.min(a,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}}}},sU=class e{constructor(e){a(this,"tokens"),a(this,"options"),a(this,"state"),a(this,"tokenizer"),a(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||tB,this.options.tokenizer=this.options.tokenizer||new oU,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:oB,block:ZB.normal,inline:XB.normal};this.options.pedantic?(t.block=ZB.pedantic,t.inline=XB.pedantic):this.options.gfm&&(t.block=ZB.gfm,this.options.breaks?t.inline=XB.breaks:t.inline=XB.gfm),this.tokenizer.rules=t}static get rules(){return{block:ZB,inline:XB}}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(oB.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,a;for(this.options.pedantic&&(e=e.replace(oB.tabCharGlobal," ").replace(oB.spaceLine,""));e;){let o;if(null==(i=null==(r=this.options.extensions)?void 0:r.block)?void 0:i.some(n=>!!(o=n.call({lexer:this},e,t))&&(e=e.substring(o.raw.length),t.push(o),!0)))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);let n=t.at(-1);1===o.raw.length&&void 0!==n?n.raw+="\n":t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.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")+o.raw,n.text+="\n"+o.text,this.inlineQueue.at(-1).src=n.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.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")+o.raw,n.text+="\n"+o.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},t.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(null==(a=this.options.extensions)?void 0:a.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&&(o=this.tokenizer.paragraph(s))){let r=t.at(-1);n&&"paragraph"===(null==r?void 0:r.type)?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+o.raw,r.text+="\n"+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(o),n=s.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);let n=t.at(-1);"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+o.raw,n.text+="\n"+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(o);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,a,o;let s,l=e,c=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(c=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(c=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,c.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(c=this.tokenizer.rules.inline.blockSkip.exec(l));)s=c[2]?c[2].length:0,l=l.slice(0,c.index+s)+"["+"a".repeat(c[0].length-s-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=(null==(r=null==(n=this.options.hooks)?void 0:n.emStrongMask)?void 0:r.call({lexer:this},l))??l;let d=!1,_="";for(;e;){let n;if(d||(_=""),d=!1,null==(a=null==(i=this.options.extensions)?void 0:i.inline)?void 0:a.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,l,_)){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==(o=this.options.extensions)?void 0:o.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)&&(_=n.raw.slice(-1)),d=!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}},lU=class{constructor(e){a(this,"options"),a(this,"parser"),this.options=e||tB}space(e){return""}code({text:e,lang:t,escaped:n}){var r;let i=null==(r=(t||"").match(oB.notSpaceStart))?void 0:r[0],a=e.replace(oB.endingNewline,"")+"\n";return i?'<pre><code class="language-'+tU(i)+'">'+(n?a:tU(a,!0))+"</code></pre>\n":"<pre><code>"+(n?a:tU(a,!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 a=0;a<e.items.length;a++){let t=e.items[a];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+" "+tU(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>${tU(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=nU(e);if(null===i)return r;let a='<a href="'+(e=i)+'"';return t&&(a+=' title="'+tU(t)+'"'),a+=">"+r+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=nU(e);if(null===i)return tU(n);let a=`<img src="${e=i}" alt="${n}"`;return t&&(a+=` title="${tU(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:tU(e.text)}},cU=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""}},dU=class e{constructor(e){a(this,"options"),a(this,"renderer"),a(this,"textRenderer"),this.options=e||tB,this.options.renderer=this.options.renderer||new lU,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new cU}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 a=0;a<e.length;a++){let o=e[a];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[o.type]){let e=o,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=o;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(;a+1<e.length&&"text"===e[a+1].type;)n=e[++a],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 a=0;a<e.length;a++){let o=e[a];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[o.type]){let e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=e||"";continue}}let s=o;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}},_U=(r=class{constructor(e){a(this,"options"),a(this,"block"),this.options=e||tB}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?sU.lex:sU.lexInline}provideParser(){return this.block?dU.parse:dU.parseInline}},a(r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),a(r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),r),uU=new class{constructor(...e){a(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),a(this,"options",this.setOptions),a(this,"parse",this.parseMarkdown(!0)),a(this,"parseInline",this.parseMarkdown(!1)),a(this,"Parser",dU),a(this,"Renderer",lU),a(this,"TextRenderer",cU),a(this,"Lexer",sU),a(this,"Tokenizer",oU),a(this,"Hooks",_U),this.use(...e)}walkTokens(e,t){var n,r;let i=[];for(let a of e)switch(i=i.concat(t.call(this,a)),a.type){case"table":{let e=a;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=a;i=i.concat(this.walkTokens(e.items,t));break}default:{let e=a;(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 lU(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],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=a.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new oU(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],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new _U;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],a=t[r];_U.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&_U.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=a.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 sU.lex(e,t??this.defaults)}parser(e,t){return dU.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return a(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 a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?sU.lex:sU.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?dU.parse:dU.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?sU.lex:sU.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?dU.parse:dU.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(o){return a(o)}}}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>"+tU(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function pU(e,t){return uU.parse(e,t)}pU.options=pU.setOptions=function(e){return uU.setOptions(e),pU.defaults=uU.defaults,nB(pU.defaults),pU},pU.getDefaults=eB,pU.defaults=tB,pU.use=function(...e){return uU.use(...e),pU.defaults=uU.defaults,nB(pU.defaults),pU},pU.walkTokens=function(e,t){return uU.walkTokens(e,t)},pU.parseInline=uU.parseInline,pU.Parser=dU,pU.parser=dU.parse,pU.Renderer=lU,pU.TextRenderer=cU,pU.Lexer=sU,pU.lexer=sU.lex,pU.Tokenizer=oU,pU.Hooks=_U,pU.parse=pU,pU.options,pU.setOptions,pU.use,pU.walkTokens,pU.parseInline,dU.parse,sU.lex;const mU=By({__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 a=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),a=r.editor.view.coordsAtPos(t),o=r.editor.view.dom.getBoundingClientRect();i.value={top:Math.max(n.top,a.top)-o.top+50}})()});const o=n,s=()=>{o("close")};return(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:"ai-content",style:t.normalizeStyle(a.value)},[t.createVNode(DM,{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"]]),gU={key:0,class:"editor-wrapper-toolbar"},hU={key:1},fU={class:"editor-content-container"},EU={ref:"blockMenuRef"},SU=["src"],bU={class:"source-dialog-content"},TU={class:"dialog-footer"},CU={key:2,class:"editor-bottom"},yU={class:"editor-bottom-r"},vU=By({__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 a=e;let o=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,a=i.parent.textBetween(0,i.parentOffset,void 0,"");if(a.endsWith("/")&&!a.endsWith("//")){const e=i.pos-1;s.value.range={from:e,to:e+1},t.nextTick(()=>{const t=d.view.dom;if(!t)return;const 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=DF({content:"",info:a.info,limit:a.limitLength,isInline:a.isInline,showMenu:a.showMenu,placeholder:a.placeholder,blockMenuFn:e=>{o.value=e},editorWrapper:c.value,checkSlashTrigger:l});function _(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(_(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 p(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()}}a.isInline&&d.setEditable(!1);let m=t.ref(!1),g=t.ref({});const h=r;d.on("update",({editor:e})=>{const t=_(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=Px(e.state.doc);h("update:content",e.getHTML(),n)});let f=t.ref(!1);const E=()=>{f.value=!0,t.nextTick(()=>{const{tr:e}=d.state;d.view.dispatch(e)})},S=()=>{f.value=!1,d.setEditable(!0)},b=t.ref(null);let T=t.ref("");const C=e=>{T.value=e||"",b.value.open()};t.ref(0);const y=[];t.watch(()=>a.isInline,e=>{d&&d.setEditable(!e)}),t.onMounted(()=>{window.addEventListener("tiptap-image-click",R),document.addEventListener("click",p),a.content&&t.nextTick(()=>{requestAnimationFrame(()=>{o.value=!0;const e=Fx({editor:d,content:a.content,type:"html",extensions:dR(),chunkSize:15,onFirstVisible:()=>{o.value=!1},onProgress:e=>{e>0&&(o.value=!1)},onComplete:()=>{o.value=!1;const t=y.indexOf(e);t>-1&&y.splice(t,1)}});e&&y.push(e)})})});const v=t.ref(!1),N=t.ref("");function R(e){N.value=e.detail,v.value=!0}const O=t.ref(!1),A=t.ref("");function I(){A.value=d.getHTML(),O.value=!0}function D(){try{O.value=!1,d.commands.clearContent(),setTimeout(()=>{o.value=!0;const e=Fx({editor:d,content:A.value,type:"html",extensions:dR(),chunkSize:20,onFirstVisible:()=>{o.value=!1},onProgress:e=>{e>0&&(o.value=!1)},onComplete:()=>{o.value=!1,n.ElMessage.success("源代码已应用");const t=y.indexOf(e);t>-1&&y.splice(t,1)}});e&&y.push(e)},50)}catch(e){o.value=!1,n.ElMessage.error("应用源代码失败,请检查代码格式")}}const w=e=>{o.value=e};return t.onBeforeUnmount(()=>{y.forEach(e=>{e&&e.cancel&&e.cancel()}),y.length=0,d&&d.destroy(),window.removeEventListener("tiptap-image-click",R),document.removeEventListener("click",p)}),(r,i)=>{const a=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",gU,[t.createVNode(WF,{editor:t.unref(d),info:e.info,limitLength:e.limitLength,showMenu:e.showMenu,onShowLink:i[0]||(i[0]=e=>C("top")),onToggleLoading:w,onShowAi:E,onShowSource:I},null,8,["editor","info","limitLength","showMenu"])])),e.isInline||t.unref(f)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",hU,[t.createVNode(QF,{editor:t.unref(d),info:e.info,showMenu:e.showMenu,onShowAi:E,onShowLink:i[1]||(i[1]=e=>C())},null,8,["editor","info","showMenu"])])),t.createVNode(JF,{editor:t.unref(d),showToolbar:t.unref(m),"onUpdate:showToolbar":i[2]||(i[2]=e=>t.isRef(m)?m.value=e:m=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",fU,[t.createElementVNode("div",{class:t.normalizeClass(["editor-content",{noPadding:e.isInline}]),ref_key:"editorWrapper",ref:c},[t.createVNode(t.unref(yl),{editor:t.unref(d),style:{width:"100%",height:"calc(100% - 40px)"}},null,8,["editor"]),t.unref(f)?(t.openBlock(),t.createBlock(mU,{key:0,editor:t.unref(d),info:e.info,onClose:S},null,8,["editor","info"])):t.createCommentVNode("",!0),t.createVNode(SL,{ref_key:"linkRef",ref:b,editor:t.unref(d),editorWrapper:t.unref(c),linkPosition:t.unref(T)},null,8,["editor","editorWrapper","linkPosition"]),t.withDirectives(t.createElementVNode("div",EU,[t.createVNode(vF,{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:w,onClosemenu:u,onShowLink:i[4]||(i[4]=e=>C())},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:v.value,"onUpdate:modelValue":i[5]||(i[5]=e=>v.value=e),width:"60%"},{default:t.withCtx(()=>[t.createElementVNode("img",{src:N.value,style:{width:"100%"}},null,8,SU)]),_:1},8,["modelValue"]),t.createVNode(t.unref(n.ElDialog),{modelValue:O.value,"onUpdate:modelValue":i[8]||(i[8]=e=>O.value=e),title:"查看源代码",width:"70%","close-on-click-modal":!1},{footer:t.withCtx(()=>[t.createElementVNode("span",TU,[t.createVNode(t.unref(n.ElButton),{onClick:i[7]||(i[7]=e=>O.value=!1)},{default:t.withCtx(()=>[...i[9]||(i[9]=[t.createTextVNode("取消",-1)])]),_:1}),t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:D},{default:t.withCtx(()=>[...i[10]||(i[10]=[t.createTextVNode("确认",-1)])]),_:1})])]),default:t.withCtx(()=>[t.createElementVNode("div",bU,[t.createVNode(t.unref(n.ElInput),{modelValue:A.value,"onUpdate:modelValue":i[6]||(i[6]=e=>A.value=e),type:"textarea",rows:20,placeholder:"HTML源代码"},null,8,["modelValue"])])]),_:1},8,["modelValue"])],2)])),[[a,t.unref(o)]]),e.limitLength==1/0||e.isInline?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",CU,[t.createElementVNode("div",null,[t.renderSlot(r.$slots,"default",{},void 0,!0)]),t.createElementVNode("div",yU,t.toDisplayString(t.unref(Px)(t.unref(d).state.doc))+"/"+t.toDisplayString(e.limitLength),1)]))],4)],6)}}},[["__scopeId","data-v-cedcbcbc"]]),NU=[{name:"TiptapVue",component:vU}],RU={install:e=>{NU.forEach(t=>{e.component(t.name,t.component)})}};e.TiptapVue=vU,e.default=RU,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
20
+ function(){var t=e,n=t.lib,r=n.WordArray,i=n.Hasher,a=t.algo,o=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]),_=r.create([1352829926,1548603684,1836072691,2053994217,0]),u=a.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 a,u,S,b,T,C,y,v,N,R,O,A=this._hash.words,I=d.words,D=_.words,w=o.words,x=s.words,M=l.words,k=c.words;for(C=a=A[0],y=u=A[1],v=S=A[2],N=b=A[3],R=T=A[4],n=0;n<80;n+=1)O=a+e[t+w[n]]|0,O+=n<16?p(u,S,b)+I[0]:n<32?m(u,S,b)+I[1]:n<48?g(u,S,b)+I[2]:n<64?h(u,S,b)+I[3]:f(u,S,b)+I[4],O=(O=E(O|=0,M[n]))+T|0,a=T,T=b,b=E(S,10),S=u,u=O,O=C+e[t+x[n]]|0,O+=n<16?f(y,v,N)+D[0]:n<32?h(y,v,N)+D[1]:n<48?g(y,v,N)+D[2]:n<64?m(y,v,N)+D[3]:p(y,v,N)+D[4],O=(O=E(O|=0,k[n]))+R|0,C=R,R=N,N=E(v,10),v=y,y=O;O=A[1]+S+N|0,A[1]=A[2]+b+R|0,A[2]=A[3]+T+C|0,A[3]=A[4]+a+y|0,A[4]=A[0]+u+v|0,A[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,a=i.words,o=0;o<5;o++){var s=a[o];a[o]=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 p(e,t,n){return e^t^n}function m(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 E(e,t){return e<<t|e>>>32-t}t.RIPEMD160=i._createHelper(u),t.HmacRIPEMD160=i._createHmacHelper(u)}(),e.RIPEMD160)),_P.exports;var e}(),mP(),function(){return gP||(gP=1,hP.exports=(l=IL(),JL(),mP(),t=(e=l).lib,n=t.Base,r=t.WordArray,i=e.algo,a=i.SHA256,o=i.HMAC,s=i.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=o.create(n.hasher,e),a=r.create(),s=r.create([1]),l=a.words,c=s.words,d=n.keySize,_=n.iterations;l.length<d;){var u=i.update(t).finalize(s);i.reset();for(var p=u.words,m=p.length,g=u,h=1;h<_;h++){g=i.finalize(g),i.reset();for(var f=g.words,E=0;E<m;E++)p[E]^=f[E]}a.concat(u),c[0]++}return a.sigBytes=4*d,a}}),e.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},l.PBKDF2)),hP.exports;var e,t,n,r,i,a,o,s,l}(),SP(),CP(),function(){return yP||(yP=1,vP.exports=(e=IL(),CP(),e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var i,a=this._iv;a?(i=a.slice(0),this._iv=void 0):i=this._prevBlock,r.encryptBlock(i,0);for(var o=0;o<n;o++)e[t+o]^=i[o]}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,a=e.slice(t,t+i);n.call(this,e,t,i,r),this._prevBlock=a}}),t}(),e.mode.CFB)),vP.exports;var e}(),function(){return NP||(NP=1,RP.exports=(n=IL(),CP(),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,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);n.encryptBlock(o,0),a[r-1]=a[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=o[s]}}),e.Decryptor=t,e),n.mode.CTR)),RP.exports;var e,t,n}(),IP(),function(){return DP||(DP=1,wP.exports=(n=IL(),CP(),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,a=this._keystream;i&&(a=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(a,0);for(var o=0;o<r;o++)e[t+o]^=a[o]}}),e.Decryptor=t,e),n.mode.OFB)),wP.exports;var e,t,n}(),function(){return xP||(xP=1,MP.exports=(t=IL(),CP(),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)),MP.exports;var e,t}(),function(){return kP||(kP=1,LP.exports=(e=IL(),CP(),e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,i=r-n%r,a=n+i-1;e.clamp(),e.words[a>>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923)),LP.exports;var e}(),function(){return PP||(PP=1,FP.exports=(e=IL(),CP(),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)),FP.exports;var e}(),function(){return BP||(BP=1,UP.exports=(e=IL(),CP(),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)),UP.exports;var e}(),function(){return GP||(GP=1,YP.exports=(e=IL(),CP(),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)),YP.exports;var e}(),function(){return HP||(HP=1,VP.exports=(e=IL(),CP(),e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding)),VP.exports;var e}(),function(){return zP||(zP=1,qP.exports=(r=IL(),CP(),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)),qP.exports;var e,t,n,r}(),function(){return $P||($P=1,WP.exports=(e=IL(),YL(),WL(),SP(),CP(),function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],a=[],o=[],s=[],l=[],c=[],d=[],_=[],u=[],p=[];!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 m=r^r<<1^r<<2^r<<3^r<<4;m=m>>>8^255&m^99,i[n]=m,a[m]=n;var g=e[n],h=e[g],f=e[h],E=257*e[m]^16843008*m;o[n]=E<<24|E>>>8,s[n]=E<<16|E>>>16,l[n]=E<<8|E>>>24,c[n]=E,E=16843009*f^65537*h^257*g^16843008*n,d[m]=E<<24|E>>>8,_[m]=E<<16|E>>>16,u[m]=E<<8|E>>>24,p[m]=E,n?(n=g^e[e[e[f^g]]],r^=e[e[r]]):n=r=1}}();var m=[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),a=this._keySchedule=[],o=0;o<r;o++)o<n?a[o]=t[o]:(c=a[o-1],o%n?n>6&&o%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^=m[o/n|0]<<24),a[o]=a[o-n]^c);for(var s=this._invKeySchedule=[],l=0;l<r;l++){if(o=r-l,l%4)var c=a[o];else c=a[o-4];s[l]=l<4||o<=4?c:d[i[c>>>24]]^_[i[c>>>16&255]]^u[i[c>>>8&255]]^p[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,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,_,u,p,a),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var l=this._nRounds,c=e[t]^n[0],d=e[t+1]^n[1],_=e[t+2]^n[2],u=e[t+3]^n[3],p=4,m=1;m<l;m++){var g=r[c>>>24]^i[d>>>16&255]^a[_>>>8&255]^o[255&u]^n[p++],h=r[d>>>24]^i[_>>>16&255]^a[u>>>8&255]^o[255&c]^n[p++],f=r[_>>>24]^i[u>>>16&255]^a[c>>>8&255]^o[255&d]^n[p++],E=r[u>>>24]^i[c>>>16&255]^a[d>>>8&255]^o[255&_]^n[p++];c=g,d=h,_=f,u=E}g=(s[c>>>24]<<24|s[d>>>16&255]<<16|s[_>>>8&255]<<8|s[255&u])^n[p++],h=(s[d>>>24]<<24|s[_>>>16&255]<<16|s[u>>>8&255]<<8|s[255&c])^n[p++],f=(s[_>>>24]<<24|s[u>>>16&255]<<16|s[c>>>8&255]<<8|s[255&d])^n[p++],E=(s[u>>>24]<<24|s[c>>>16&255]<<16|s[d>>>8&255]<<8|s[255&_])^n[p++],e[t]=g,e[t+1]=h,e[t+2]=f,e[t+3]=E},keySize:8});t.AES=n._createHelper(g)}(),e.AES)),WP.exports;var e}(),KP(),function(){return ZP||(ZP=1,XP.exports=(e=IL(),YL(),WL(),SP(),CP(),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 a=0;i<256;i++){var o=i%n,s=t[o>>>2]>>>24-o%4*8&255;a=(a+r[i]+s)%256;var l=r[i];r[i]=r[a],r[a]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){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 a=e[t];e[t]=e[n],e[n]=a,r|=e[(e[t]+e[n])%256]<<24-8*i}return this._i=t,this._j=n,r}t.RC4=n._createHelper(i);var o=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--)a.call(this)}});t.RC4Drop=n._createHelper(o)}(),e.RC4)),XP.exports;var e}(),function(){return JP||(JP=1,eF.exports=(e=IL(),YL(),WL(),SP(),CP(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],a=[],o=[],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 a=t.words,o=a[0],s=a[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),_=c>>>16|4294901760&d,u=d<<16|65535&c;for(i[0]^=c,i[1]^=_,i[2]^=d,i[3]^=u,i[4]^=c,i[5]^=_,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++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[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);o[n]=l^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=n._createHelper(s)}(),e.Rabbit)),eF.exports;var e}(),function(){return tF||(tF=1,nF.exports=(e=IL(),YL(),WL(),SP(),CP(),function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],a=[],o=[],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 a=t.words,o=a[0],s=a[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),_=c>>>16|4294901760&d,u=d<<16|65535&c;for(r[0]^=c,r[1]^=_,r[2]^=d,r[3]^=u,r[4]^=c,r[5]^=_,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++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[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);o[n]=l^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=n._createHelper(s)}(),e.RabbitLegacy)),nF.exports;var e}(),_F());const uF=qp(NL.exports),pF="0face1314520face";const mF={encrypt:function(e){const t=uF.enc.Utf8.parse(pF),n=uF.enc.Utf8.parse(pF);return uF.AES.encrypt(e,t,{iv:n,mode:uF.mode.CBC,padding:uF.pad.Pkcs7}).toString()},decrypt:function(e){const t=uF.enc.Utf8.parse(pF),n=uF.enc.Utf8.parse(pF);return uF.AES.decrypt(e,t,{iv:n,mode:uF.mode.CBC,padding:uF.pad.Pkcs7}).toString(uF.enc.Utf8)}},gF={class:"floating-menu-top"},hF={class:"floating-menu-top-btns"},fF={class:"floating-menu-common"},EF={class:"floating-menu-common-list"},SF={class:"block-menu-item-icon"},bF={class:"block-menu-item-icon"},TF={class:"block-menu-item-icon"},CF={class:"block-menu-item-icon"},yF={class:"block-menu-item-icon"},vF=By({__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,a=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}),o=(e,t)=>i.editor.isActive(e,t),s=t.ref(null),l=()=>{c(),u("closemenu"),u("showLink")},c=e=>{Object.keys(a).forEach(e=>a[e]=!1),e&&t.nextTick(()=>{u("closemenu",()=>{e&&e()})})},d=e=>{u("closemenu")},_=e=>{i.editor.chain().focus().setImage({src:e.data.show_url}).run()},u=r,p=()=>{o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")||(u("toggleLoading",!0),u("closemenu"))},m=e=>{let t={config:{apiHost:i.apiHost,token:i.token,getFileContent:i.getFileContent},data:{filename:e.data.filekey}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||"");Fx({editor:i.editor,content:t,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},g=()=>{o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("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}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||"");Fx({editor:i.editor,content:t,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&u("toggleLoading",!1)}})})},f=()=>{c(),u("closemenu","ai")},E=()=>{o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")||(c(),u("closemenu","codeblock"))};let S=t.ref(!1),b=t.ref(null);const T=e=>{b.value=e,S.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:b.value.row,cols:b.value.col,withHeaderRow:!0}).run():i.editor.chain().focus().insertTable({rows:b.value.row,cols:b.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",gF,[i[23]||(i[23]=t.createElementVNode("p",{class:"floating-menu-tit"},"基础",-1)),t.createElementVNode("div",hF,[t.unref(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:0,class:"box-item",effect:"dark",content:"正文",placement:"bottom",visible:a.paragraph,"onUpdate:visible":i[1]||(i[1]=e=>a.paragraph=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:1,class:"box-item",effect:"dark",content:"标题1",placement:"bottom",visible:a.heading1,"onUpdate:visible":i[3]||(i[3]=e=>a.heading1=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:2,class:"box-item",effect:"dark",content:"标题2",placement:"bottom",visible:a.heading2,"onUpdate:visible":i[5]||(i[5]=e=>a.heading2=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:3,class:"box-item",effect:"dark",content:"标题3",placement:"bottom",visible:a.heading3,"onUpdate:visible":i[7]||(i[7]=e=>a.heading3=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:4,class:"box-item",effect:"dark",content:"标题4",placement:"bottom",visible:a.heading4,"onUpdate:visible":i[9]||(i[9]=e=>a.heading4=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:5,class:"box-item",effect:"dark",content:"标题5",placement:"bottom",visible:a.heading5,"onUpdate:visible":i[11]||(i[11]=e=>a.heading5=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("heading",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:6,class:"box-item",effect:"dark",content:"标题6",placement:"bottom",visible:a.heading6,"onUpdate:visible":i[13]||(i[13]=e=>a.heading6=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("bulletList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:7,class:"box-item",effect:"dark",content:"无序列表",placement:"bottom",visible:a.bulletList,"onUpdate:visible":i[15]||(i[15]=e=>a.bulletList=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("orderedList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:8,class:"box-item",effect:"dark",content:"有序列表",placement:"bottom",visible:a.orderedList,"onUpdate:visible":i[17]||(i[17]=e=>a.orderedList=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("taskList",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:9,class:"box-item",effect:"dark",content:"待办列表",placement:"bottom",visible:a.taskList,"onUpdate:visible":i[19]||(i[19]=e=>a.taskList=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("link",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:10,class:"box-item",effect:"dark",content:"链接",placement:"bottom",visible:a.link,"onUpdate:visible":i[20]||(i[20]=e=>a.link=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:link-variant",width:"20",onClick:l})]),_:1},8,["visible"])):t.createCommentVNode("",!0),t.unref(Lx)("codeBlock",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElTooltip),{key:11,class:"box-item",effect:"dark",content:"代码块",placement:"bottom",visible:a.codeBlock,"onUpdate:visible":i[21]||(i[21]=e=>a.codeBlock=e)},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:code-braces-box",class:t.normalizeClass(o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")?"icon-gray":""),width:"20",onClick:E},null,8,["class"])]),_:1},8,["visible"])):t.createCommentVNode("",!0)])]),t.createElementVNode("div",fF,[i[29]||(i[29]=t.createElementVNode("p",{class:"floating-menu-tit"},"通用",-1)),t.createElementVNode("div",EF,[t.unref(Lx)("ai",e.showMenu)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"block-menu-item",onClick:f},[t.createElementVNode("div",SF,[t.createVNode(Fy,{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":_,disabled:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}])},[t.createElementVNode("div",bF,[t.createVNode(Fy,{icon:"material-symbols:imagesmode-outline-sharp"})]),i[25]||(i[25]=t.createElementVNode("div",null,"上传本地图片",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(Lx)("image",e.showMenu)]]),t.withDirectives(t.createElementVNode("div",null,[t.createVNode(t.unref(n.ElPopover),{placement:"right",width:224,visible:t.unref(S),"onUpdate:visible":i[22]||(i[22]=e=>t.isRef(S)?S.value=e:S=e),disabled:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{reference:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}]),ref:"tableRef"},[t.createElementVNode("div",TF,[t.createVNode(Fy,{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(vL,{onSelect:T})])]),_:1},8,["visible","disabled"])],512),[[t.vShow,t.unref(Lx)("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":m,"before-upload":p,disabled:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}])},[t.createElementVNode("div",CF,[t.createVNode(Fy,{icon:"tabler:file-word"})]),i[27]||(i[27]=t.createElementVNode("div",null,"上传word文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(Lx)("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:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["block-menu-item",{"icon-gray":o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")}])},[t.createElementVNode("div",yF,[t.createVNode(TL,{width:20,height:20,color:o("codeBlock")||o("table")||o("bulletList")||o("orderedList")||o("taskList")?"#999999":"currentColor"},null,8,["color"])]),i[28]||(i[28]=t.createElementVNode("div",null,"上传jupyter文件",-1))],2)]),_:1},8,["action","headers","disabled"]),[[t.vShow,t.unref(Lx)("jupyter",e.showMenu)]])])])],4),t.createVNode(SL,{ref_key:"linkRef",ref:s,editor:e.editor},null,8,["editor"])],64))}},[["__scopeId","data-v-6eb1e6f8"]]);function NF(e,n){const r=new Dt("blockMenu");let i=n.wrapperEl||null;const a={isPopoverOpen:!1};return new Ot({key:r,view(o){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(vF,{editor:e,menuState:a,...n.props})});l.mount(s);let c=null,d=!1,_=null;function u(){s.style.display="none",c=null}function p(){clearTimeout(_),_=setTimeout(()=>{d||c&&c.matches(":hover")||u()},100)}function m(e){clearTimeout(_);!function(e){if(c=e,a.isPopoverOpen)return;const t=e.getBoundingClientRect(),n=o.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(){p()}function h(){Array.from(o.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",m),e.removeEventListener("mouseleave",g),e.addEventListener("mouseenter",m),e.addEventListener("mouseleave",g)})}s.addEventListener("mouseenter",()=>{clearTimeout(_),d=!0}),s.addEventListener("mouseleave",()=>{d=!1,p()}),h();const f={update(){h(),c&&!o.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}})}Ho.create({name:"blockMenuExtension",addOptions:()=>({props:{apiHost:"",token:"",uploadUrl:"",uploadDoc:"",uploadJupyter:"",getFileContent:"",isInline:!1,showMenu:[]}}),addProseMirrorPlugins(){return this.options.props.isInline?[]:[NF(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 RF=Cu.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 Dt("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 a=document.createElement("img");if(a.src=e.attrs.src,a.alt=e.attrs.alt||"",a.title=e.attrs.title||"",a.style.display="block",a.style.borderRadius="4px",e.attrs.width&&(a.style.width=e.attrs.width+"px"),e.attrs.height&&(a.style.height=e.attrs.height+"px"),r)return i.appendChild(a),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(a.src=e.attrs.src,a.alt=e.attrs.alt||"",a.title=e.attrs.title||"",e.attrs.width?a.style.width=e.attrs.width+"px":a.style.width="",e.attrs.height?a.style.height=e.attrs.height+"px":a.style.height="",!0),destroy:()=>{i.remove()}};const o=document.createElement("div");o.style.position="absolute",o.style.top="8px",o.style.right="8px",o.style.display="flex",o.style.gap="6px",o.style.opacity="0",o.style.visibility="hidden",o.style.transition="all .2s",o.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","重置大小");o.appendChild(l),o.appendChild(c),o.appendChild(d),l.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent("tiptap-image-click",{detail:a.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 o=Math.max(50,i.clientWidth-60),s=(a.naturalWidth||a.offsetWidth||1)/(a.naturalHeight||a.offsetHeight||1),l=Math.round(o),c=Math.round(l/s);if(a.style.width=l+"px",a.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 _=["nw","ne","sw","se"],u={};_.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",()=>{o.style.opacity="1",o.style.visibility="visible",Object.values(u).forEach(e=>{e.style.opacity="1",e.style.visibility="visible"})}),i.addEventListener("mouseleave",()=>{o.style.opacity="0",o.style.visibility="hidden",Object.values(u).forEach(e=>{e.style.opacity="0",e.style.visibility="hidden"})});return _.forEach(r=>{u[r].addEventListener("mousedown",i=>((r,i)=>{r.preventDefault(),r.stopPropagation();const o=r.clientX,s=r.clientY,l=a.offsetWidth,c=a.offsetHeight,d=l/c||1,_=i.includes("w"),u=i.includes("n"),p=e=>{let t,n,r=e.clientX-o,i=e.clientY-s;if(_&&(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)}a.style.width=t+"px",a.style.height=n+"px"},m=r=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m);let i,a,g=r.clientX-o,h=r.clientY-s;if(_&&(g=-g),u&&(h=-h),r.shiftKey)i=Math.max(50,l+g),a=Math.max(50,c+h);else{const e=(g+h)/2;i=Math.max(50,l+e),a=Math.max(50,i/d)}if("function"==typeof n){const r=n(),o=t.view.state.tr.setNodeMarkup(r,null,{...e.attrs,width:Math.round(i),height:Math.round(a)});t.view.dispatch(o)}};document.addEventListener("mousemove",p),document.addEventListener("mouseup",m)})(i,r))}),i.appendChild(a),i.appendChild(o),_.forEach(e=>i.appendChild(u[e])),{dom:i,contentDOM:null,update:e=>"image"===e.type.name&&(a.src=e.attrs.src,a.alt=e.attrs.alt||"",a.title=e.attrs.title||"",e.attrs.width?a.style.width=e.attrs.width+"px":a.style.width="",e.attrs.height?a.style.height=e.attrs.height+"px":a.style.height="",!0),destroy:()=>{i.remove()}}}}});tR(),T_.extend({content:"inline*"});const OF=Gp.extend({content:"(paragraph | bulletList | orderedList)*",addAttributes(){var e;return{...null==(e=this.parent)?void 0:e.call(this),colspan:{default:1,parseHTML:e=>{const t=e.getAttribute("colspan");return t?parseInt(t,10):1},renderHTML:e=>e.colspan>1?{colspan:e.colspan}:{}},rowspan:{default:1,parseHTML:e=>{const t=e.getAttribute("rowspan");return t?parseInt(t,10):1},renderHTML:e=>e.rowspan>1?{rowspan:e.rowspan}:{}},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("data-colwidth"),n=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):n?n.split(",").map(e=>parseInt(e,10)):null},renderHTML:e=>e.colwidth?{"data-colwidth":e.colwidth.join(",")}:{}}}}}),AF=Yp.extend({content:"(paragraph | bulletList | orderedList)*",addAttributes(){var e;return{...null==(e=this.parent)?void 0:e.call(this),colspan:{default:1,parseHTML:e=>{const t=e.getAttribute("colspan");return t?parseInt(t,10):1},renderHTML:e=>e.colspan>1?{colspan:e.colspan}:{}},rowspan:{default:1,parseHTML:e=>{const t=e.getAttribute("rowspan");return t?parseInt(t,10):1},renderHTML:e=>e.rowspan>1?{rowspan:e.rowspan}:{}},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("data-colwidth"),n=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):n?n.split(",").map(e=>parseInt(e,10)):null},renderHTML:e=>e.colwidth?{"data-colwidth":e.colwidth.join(",")}:{}}}}});function IF(e,t){if(0===e.length)return"";const n=["<table>"];let r=!1,i=!1;for(let a=0;a<e.length;a++){const t=e[a];if("separator"===t.type){r=!0;continue}const o=t.content,s=o.substring(1,o.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 DF=({content:e="",info:t={},limit:r=50,isInline:i=!1,showMenu:a=[],placeholder:o="",blockMenuFn:s,editorWrapper:l,checkSlashTrigger:c}={})=>{const _=new Cl({extensions:[du.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}),MM.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?o||"输入“/”插入内容":null},showOnlyWhenEditable:!0,showOnlyCurrent:!1}),_u,pu,bu,Vp,oR,RF.configure({inline:!1,allowBase64:!1,isInline:i}),Su.configure({multicolor:!0}),Fp.configure({resizable:!0,handleWidth:5,cellMinWidth:25,lastColumnResizable:!0,allowTableNodeSelection:!1,HTMLAttributes:{class:"my-custom-table"}}),OF,AF,Up,sR,iR.configure({isInline:i}),t_.configure({HTMLAttributes:{class:"bullet-list"},nested:!0}),h_.configure({HTMLAttributes:{class:"ordered-list"},nested:!0}),n_.configure({HTMLAttributes:{class:"list-item"},nested:!0}),S_,E_.configure({nested:!1}),aR,Hp.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"],defaultAlignment:"left"}),Zd.configure({openOnClick:!1,defaultProtocol:"https"}),xM.configure({props:{apiHost:t.apiHost,token:t.token,askUrl:t.askUrl,answerUrl:t.answerUrl}}),(u={limit:r},Ho.create({name:"characterLimiter",addProseMirrorPlugins:()=>[new Ot({key:new Dt("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),a=r(e.doc),o=u.limit;return!(a>o&&a>i&&(n.ElMessage.warning(`已超出最大字数限制:${o}`),1))}})]}))],editorProps:{handlePaste:(e,i,a)=>{var o,l;if(Px(e.state.doc)+a.content.size>r)return n.ElMessage.warning(`粘贴失败:内容将超过最大长度限制 ${r}。`),!0;const c=Array.from((null==(o=i.clipboardData)?void 0:o.items)||[]).find(e=>e.type.startsWith("image/"));if(c){const{selection:r}=e.state,{$from:a}=r;let o=!1;for(let e=a.depth;e>0;e--)if("tableCell"===a.node(e).type.name||"tableHeader"===a.node(e).type.name){o=!0;break}if(o)return i.preventDefault(),n.ElMessage.warning("表格中不支持粘贴图片"),!0;i.preventDefault();const s=c.getAsFile();if(!s)return!1;const l=new FormData;l.append("file",s);return((e,t)=>xA({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}},l).then(e=>{e&&e.data&&e.data.show_url?_.chain().focus().setImage({src:e.data.show_url}).run():n.ElMessage.error("图片上传失败")}).catch(e=>{n.ElMessage.error("图片上传失败")}),!0}const d=null==(l=i.clipboardData)?void 0:l.getData("text/plain");if(d&&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}(d)){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=IF(e);n.push(t)}}else n.push(e),r++}return n.join("\n")}(d)}catch(u){e=d}try{t=new Dw({html:!0,linkify:!0,typographer:!1,breaks:!1}).render(e)}catch(p){throw p}try{r=LA(t,[du.configure({codeBlock:!1,strike:!1,bulletList:!1,orderedList:!1,listItem:!1}),bu,Vp,Bp,Hp,t_,h_,n_])}catch(m){throw m}if(r&&r.content){const e=r.content.length;if(e>100){n.ElMessage.info(`正在插入 ${e} 个内容块...`),s&&s(!0);const t=_.isEditable;_.setEditable(!1),Fx({editor:_,content:r.content,type:"json",extensions:[],chunkSize:100,isPaste:!0,onProgress:e=>{if(1===e){performance.now(),startTime;_.setEditable(t),n.ElMessage.success("内容已插入完成"),s&&s(!1)}},onComplete:()=>{_.setEditable(t),s&&s(!1)}})}else _.chain().focus().insertContent(r.content).run(),setTimeout(()=>{_.view.updateState(_.state);const{tr:e}=_.state;_.view.dispatch(e),_.commands.focus()},0)}}catch(g){try{_.chain().focus().insertContent(d).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)||(_.chain().focus("end").run(),!0)}return!1},transformPasted:(e,t)=>{const{selection:r}=t.state,{$from:i}=r;let a=!1;for(let n=i.depth;n>0;n--)if("tableCell"===i.node(n).type.name||"tableHeader"===i.node(n).type.name){a=!0;break}if(!a)return e;let o=!1;const s=new Set,l=e=>{if("image"===e.type.name||"table"===e.type.name||"codeBlock"===e.type.name||"codeBlockCustom"===e.type.name)return o=!0,"image"===e.type.name?s.add("图片"):"table"===e.type.name?s.add("表格"):"codeBlock"!==e.type.name&&"codeBlockCustom"!==e.type.name||s.add("代码块"),null;if(e.content&&e.content.size>0){const t=[];return e.content.forEach(e=>{const n=l(e);n&&t.push(n)}),0===t.length&&"paragraph"!==e.type.name?null:e.copy(d.from(t))}return e},c=[];if(e.content.forEach(e=>{const t=l(e);t&&c.push(t)}),o){const e=Array.from(s).join("、");n.ElMessage.warning(`表格中不支持粘贴${e},已自动过滤`)}return new h(d.from(c),e.openStart,e.openEnd)}},editable:!0,content:"",onDrop({Editor:e}){}});var u;return _},wF=["onClick"],xF={key:0},MF={class:"phrases-btns"},kF={__name:"CommonExpression",props:{from:{type:String,default:""},info:{type:Object,default:()=>{}}},emits:["close"],setup(e,{emit:r}){const i=e;let a=t.ref(!0);const o=r,s=()=>{a.value=!1,o("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}};kA(e).then(e=>{l.value=e.data.list||[]})};c();const d=()=>{l.value.unshift({content:"",editStatus:!0,op:"add"}),_.value=l.value[0]};t.ref(!1);let _=t.ref({});t.ref(!1);const u=t.ref(null),p=e=>{_.value=e,_.value.user_id>0&&(e.editStatus=!0,t.nextTick(()=>{u.value.focus()}))},m=()=>{if(!_.value.content)return void n.ElMessage.warning("请输入常用语");let e={config:{apiHost:i.info.apiHost,token:i.info.token},data:{content:_.value.content,type:0}};"add"==_.value.op?(e.config.apiUrl=i.info.expressionUrls.create,kA(e).then(e=>{n.ElMessage.success("新增成功"),c()})):(e.config.apiUrl=i.info.expressionUrls.update,e.data.id=_.value.id,kA(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 >");o("add",e)};return(e,r)=>(t.openBlock(),t.createBlock(t.unref(n.ElDrawer),{modelValue:t.unref(a),"onUpdate:modelValue":r[1]||(r[1]=e=>t.isRef(a)?a.value=e:a=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(Fy,{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=>p(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:m,maxlength:"500"},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(t.openBlock(),t.createElementBlock("p",xF,t.toDisplayString(e.content),1))],8,wF)]),_: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=>p(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=>{_.value=e;let t={config:{apiHost:i.info.apiHost,token:i.info.token,apiUrl:i.info.expressionUrls.delete},data:{id:_.value.id}};kA(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",MF,[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"]))}},LF=By(kF,[["__scopeId","data-v-28ce6f0a"]]),PF={paragraph:"正文",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6"},FF={class:"toolbar"},BF={key:2,class:"flex-center"},UF={class:"flex-center"},GF={key:3,class:"flex-center"},YF={class:"flex-center"},HF={class:"flex-center"},VF={class:"flex-center"},zF={class:"flex-center"},qF={class:"table-content"},$F={key:7},WF=By({__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(),a=e;let o=t.ref("14px"),s=t.ref("#000"),l=t.ref("");const c=(e,t)=>a.editor.isActive(e,t),d=t.computed(()=>!!a.editor&&(a.editor.isActive("codeBlock")||a.editor.isActive("codeBlockCustom")));let _=t.ref("正文");const u=e=>{if("paragraph"===e)a.editor.chain().focus().setParagraph().run();else{const t=parseInt(e.replace("h",""),10);a.editor.chain().focus().setHeading({level:t}).run()}_.value=PF[e]},p=["12px","14px","16px","18px","20px","24px"],m=e=>{a.editor.chain().focus().setFontSize(e).run(),o.value=e},g=e=>a.editor.chain().focus().setColor(e).run(),h=e=>{e?a.editor.chain().focus().setHighlight({color:e}).run():a.editor.chain().focus().unsetHighlight().run()};let f=t.ref("left");const E=e=>{f.value=e,a.editor.chain().focus().setTextAlign(e).run()},S=e=>{},b=e=>{a.editor.chain().focus().setImage({src:e.data.show_url}).run()},T=()=>{a.editor.chain().focus().insertContent({type:"codeBlock",attrs:{language:"javascript"}}).run()};let C=t.ref(!1);const y=e=>{a.editor.chain().focus().insertTable({rows:e.row,cols:e.col,withHeaderRow:!0}).run(),C.value=!1},v=()=>{N("showLink")},N=r,R=()=>{const{from:e,to:t}=a.editor.state.selection;e!==t?N("showAi"):(a.editor.chain().focus().insertContent({type:"aiAssistant"}).run(),a.editor.setEditable(!1))},O=()=>{N("showSource")},A=()=>{if(!a.editor)return;const e=n.ElMessage({message:"正在处理,请稍候...",type:"info",duration:0,iconClass:"el-icon-loading"});setTimeout(()=>{try{const{state:t}=a.editor,{doc:r}=t;let{tr:i}=t,o=0;const s=[];let l=0;r.descendants(e=>{"paragraph"===e.type.name&&l++}),r.descendants((e,t)=>{if("paragraph"===e.type.name){const n=(e.textContent||"").replace(/\u00a0/g," ").trim(),r=0===e.content.size||""===n;if(/^(In|Out)\s*\[\s*\d*\s*\]\s*:?\s*$/i.test(n))return s.push({type:"replaceJupyter",pos:t,size:e.nodeSize,attrs:e.attrs}),void o++;r&&!(1===l&&r)&&(s.push({type:"delete",pos:t,size:e.nodeSize}),o++)}else if("heading"===e.type.name){let n=!1;e.descendants(e=>{if("link"===e.type.name&&e.marks){e.marks.find(e=>"link"===e.type.name)&&"¶"===e.textContent&&(n=!0)}if("text"===e.type.name&&"¶"===e.text){e.marks&&e.marks.some(e=>"link"===e.type.name&&"anchor-link"===e.attrs.class)&&(n=!0)}}),n&&(s.push({type:"removeAnchorLink",pos:t,node:e}),o++)}else if("codeBlock"===e.type.name||"codeBlockCustom"===e.type.name){const n=e.textContent;if(n&&""!==n.trim()){if(n.includes("\n")){const r=n.split("\n"),i=[];let a=0;for(const e of r)""!==e.trim()?i.push(e):a++;a>0&&i.length>0&&s.push({type:"updateCodeBlock",pos:t,nodeSize:e.nodeSize,newContent:i.join("\n"),emptyCount:a})}}else s.push({type:"delete",pos:t,size:e.nodeSize}),o++}}),s.sort((e,t)=>t.pos-e.pos);for(const e of s)if("delete"===e.type)i=i.delete(e.pos,e.pos+e.size);else if("replaceJupyter"===e.type){const n=t.schema.nodes.paragraph.create(e.attrs||null);i=i.replaceWith(e.pos,e.pos+e.size,n)}else if("updateCodeBlock"===e.type){const n=e.pos+1,r=e.pos+e.nodeSize-1;i=i.replaceWith(n,r,t.schema.text(e.newContent)),o+=e.emptyCount}else if("removeAnchorLink"===e.type){const n=e.node,r=[];n.content.forEach(e=>{if("text"===e.type.name&&"¶"===e.text){if(e.marks&&e.marks.some(e=>"link"===e.type.name&&"anchor-link"===e.attrs.class))return}r.push(e)});const a=t.schema.nodes.heading.create(n.attrs,r);i=i.replaceWith(e.pos,e.pos+n.nodeSize,a)}e.close(),o>0?(0===i.doc.content.size&&(i=i.insert(0,t.schema.nodes.paragraph.create())),a.editor.view.dispatch(i),n.ElMessage.success(`已删除 ${o} 项(空行和代码块空行)`)):n.ElMessage.info("文档已经很干净了,没有需要删除的内容")}catch(t){e.close(),n.ElMessage.error("处理失败: "+t.message)}},100)},I=t.ref(!1),D=()=>{I.value=!0},w=()=>{I.value=!1},x=e=>{a.editor.chain().focus().insertContent(e).run(),I.value=!1},M={paragraph:"正文",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"};a.editor.view.dom.addEventListener("mousedown",e=>{var t;const n=a.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}(a.editor,n.pos),i=(null==(t=null==r?void 0:r.attrs)?void 0:t.textAlign)||"left";f.value=i});const k=()=>{N("toggleLoading",!0)},L=e=>{let t={config:{apiHost:a.info.apiHost,token:a.info.token,getFileContent:a.info.getFileContent},data:{filename:e.data.filekey}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||"");Fx({editor:a.editor,content:t,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)},onComplete:()=>{a.editor.commands.focus("end")}})})},P=()=>{N("toggleLoading",!0)},F=e=>{let t={config:{apiHost:a.info.apiHost,token:a.info.token,getFileContent:a.info.getFileContent},data:{filename:e.data.filekey}};MA(t).then(e=>{const t=mF.decrypt(e.data.content||""),n=(new DOMParser).parseFromString(t,"text/html").body;n.querySelectorAll("script").forEach(e=>e.remove()),n.querySelectorAll("style").forEach(e=>e.remove());const r=n.innerHTML.replace(/<!--[\s\S]*?-->/g,"").replace(/\n\s*\n\s*\n/g,"\n\n").trim();Fx({editor:a.editor,content:r,type:"html",extensions:dR(),chunkSize:5,onProgress:e=>{e>0&&N("toggleLoading",!1)},onComplete:()=>{const{doc:e}=a.editor.state;e.content.size;a.editor.commands.focus("end")}})}).catch(e=>{N("toggleLoading",!1),n.ElMessage.error("Jupyter 文件解析失败: "+e.message)})};return t.watchEffect(()=>{if(!a.editor)return;const{from:e,to:t}=a.editor.state.selection;if(e!==t){const e=a.editor.getAttributes("textStyle");o.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(a.editor.isActive("heading",{level:i})){_.value=M["h"+i],r=!0;break}r||(_.value=M.paragraph)}),(r,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",FF,[t.unref(Lx)("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:R,link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"hugeicons:ai-chat-02",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(_)),1),t.createVNode(Fy,{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:m,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(p,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(o)),1),t.createVNode(Fy,{icon:"ic:baseline-expand-more",width:"16"})],2)]),_:1},8,["disabled"])]),_:1}),t.unref(Lx)("color",e.showMenu)?(t.openBlock(),t.createElementBlock("div",BF,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"字体颜色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",UF,[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(Lx)("bgColor",e.showMenu)?(t.openBlock(),t.createElementBlock("div",GF,[t.createVNode(t.unref(n.ElTooltip),{class:"box-item",effect:"dark",content:"背景色",placement:"bottom"},{default:t.withCtx(()=>[t.createElementVNode("div",YF,[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(Lx)("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(Fy,{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(Lx)("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(Fy,{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(Lx)("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(Fy,{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(Lx)("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(Fy,{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(Lx)("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(Fy,{icon:"mdi:format-list-bulleted",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(Fy,{icon:"mdi:format-list-numbered",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(Fy,{icon:"mdi:format-list-checkbox",width:"20"})]),_:1},8,["type"])]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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:v,type:c("link")?"primary":"",link:"",disabled:d.value},{default:t.withCtx(()=>[t.createVNode(Fy,{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:E,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(Fy,{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(Lx)("center",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"center"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("right",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"right"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Lx)("justify",e.showMenu)?(t.openBlock(),t.createBlock(t.unref(n.ElButton),{key:0,type:c({textAlign:"justify"})?"primary":"",link:""},{default:t.withCtx(()=>[t.createVNode(Fy,{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(Fy,{icon:`mdi:format-align-${t.unref(f)}`,width:"20",class:t.normalizeClass({"icon-gray":d.value})},null,8,["icon","class"]),t.createVNode(Fy,{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",HF,[!e.isBubble&&t.unref(Lx)("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":S,"on-success":b,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:file-image-box",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",VF,[!e.isBubble&&t.unref(Lx)("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":k,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(Fy,{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",zF,[!e.isBubble&&t.unref(Lx)("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":F,"before-upload":P,disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(TL,{width:20,height:20,color:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")?"#999999":"currentColor"},null,8,["color"])]),_:1},8,["action","headers","disabled"])]),_:1})):t.createCommentVNode("",!0)]),!e.isBubble&&t.unref(Lx)("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:T,link:"",disabled:c("codeBlock")||c("table")||c("bulletList")||c("orderedList")||c("taskList")},{default:t.withCtx(()=>[t.createVNode(Fy,{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",qF,[t.createVNode(t.unref(n.ElPopover),{placement:"bottom",title:"",width:224,trigger:"click",visible:t.unref(C),"onUpdate:visible":i[9]||(i[9]=e=>t.isRef(C)?C.value=e:C=e),disabled:c("table")||c("bulletList")||c("orderedList")||c("taskList")||c("codeBlock")},{reference:t.withCtx(()=>[t.createVNode(Fy,{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(vL,{onSelect:y})])]),_:1},8,["visible","disabled"])])]),_:1})],512),[[t.vShow,!e.isBubble&&t.unref(Lx)("table",e.showMenu)]]),t.createVNode(t.unref(n.ElButtonGroup),null,{default:t.withCtx(()=>[t.unref(Lx)("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(Fy,{icon:"mdi:undo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.unref(Lx)("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(Fy,{icon:"mdi:redo-variant",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0)]),_:1}),!e.isBubble&&t.unref(Lx)("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(Fy,{icon:"mdi:code-tags",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(Lx)("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:A,link:"",style:{"margin-left":"0px"}},{default:t.withCtx(()=>[t.createVNode(Fy,{icon:"mdi:format-clear",width:"20"})]),_:1})]),_:1})):t.createCommentVNode("",!0),!e.isBubble&&t.unref(Lx)("expression",e.showMenu)?(t.openBlock(),t.createElementBlock("div",$F,[t.createVNode(t.unref(n.ElButton),{link:"",onClick:D},{default:t.withCtx(()=>[...i[17]||(i[17]=[t.createTextVNode("插入常用语",-1)])]),_:1})])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"default",{},void 0,!0)]),I.value?(t.openBlock(),t.createBlock(LF,{key:0,info:e.info,onClose:w,onAdd:x},null,8,["info"])):t.createCommentVNode("",!0)],64))}},[["__scopeId","data-v-fb5ad3e3"]]),jF={class:"bubble-menu"},QF=By({__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:a,selection:o}=t;return o.node,o.$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 a=n,o=()=>{i.value=!0,a("showAi")},s=()=>{a("showLink")};return(n,i)=>(t.openBlock(),t.createBlock(t.unref(mL),{editor:e.editor,"should-show":r},{default:t.withCtx(()=>[t.createElementVNode("div",jF,[t.createVNode(WF,{editor:e.editor,info:e.info,isBubble:!0,showMenu:e.showMenu,onShowAi:o,onShowLink:s},null,8,["editor","info","showMenu"])])]),_:1},8,["editor"]))}},[["__scopeId","data-v-dc69236f"]]),KF={class:"table-toolbar-btns"},ZF={class:"table-toolbar-btns"},XF={class:"table-toolbar-btns"},JF=By({__name:"TableToolbar",props:{editor:{type:Object,required:!0},editorWrapper:{type:Object,default:null}},setup(e){const r=e,i=t.ref(null),a=t.ref(!1),o=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"}),_=t.computed(()=>r.editor.can().mergeCells()),u=t.computed(()=>r.editor.can().splitCell()),p=()=>{var e,t;const n=r.editor;if(!n||!n.view)return;const i=n.state,{selection:_}=i;if(!n.isActive("table"))return a.value=!1,o.value=!1,void(c.value=!1);const u=Ya(e=>"tableCell"===e.type.name||"tableHeader"===e.type.name)(_);if(!u)return a.value=!1,o.value=!1,void(c.value=!1);const p=Ya(e=>"tableRow"===e.type.name)(_),g=Ya(e=>"table"===e.type.name)(_);if(!p||!g)return a.value=!1,o.value=!1,void(c.value=!1);const h=n.view,f=h.nodeDOM(u.pos),E=h.nodeDOM(p.pos),S=h.nodeDOM(g.pos);if(!(f instanceof HTMLElement&&E instanceof HTMLElement&&S instanceof HTMLElement))return a.value=!1,o.value=!1,void(c.value=!1);const b=h.dom.getBoundingClientRect(),T=f.getBoundingClientRect(),C=E.getBoundingClientRect(),y=S.getBoundingClientRect(),v=C.left-b.left-30,N=(null==(e=r.editorWrapper)?void 0:e.scrollTop)||0,R=C.top-b.top+C.height/2+18-N;s.value={position:"absolute",left:`${Math.max(v,-10)}px`,top:`${Math.max(R,0)}px`,zIndex:1e3},a.value=!0;const O=(T.left+T.right)/2+10-b.left-20,A=(null==(t=h.dom)?void 0:t.scrollTop)||0,I=y.top-b.top-A-N;l.value={position:"absolute",left:`${O}px`,top:`${Math.max(I,0)}px`,zIndex:1e3},o.value=!0;const D=y.right-b.left+10,w=y.top-b.top;d.value={position:"absolute",left:`${D}px`,top:`${Math.max(w,0)}px`,zIndex:1e3};const{from:x,to:M}=_,k=m(n,x,M);c.value=k.length>1},m=(e,t,n)=>{const r=[],{state:i}=e,{doc:a}=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},E=()=>{r.editor.chain().focus().addRowBefore().run(),g.value=!1},S=()=>{r.editor.chain().focus().deleteRow().run(),g.value=!1},b=()=>{r.editor.chain().focus().addColumnAfter().run(),h.value=!1},T=()=>{r.editor.chain().focus().addColumnBefore().run(),h.value=!1},C=()=>{r.editor.chain().focus().deleteColumn().run(),h.value=!1},y=()=>{r.editor.chain().focus().deleteTable().run(),g.value=!1,h.value=!1},v=()=>{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 R=null;return t.onMounted(()=>{r.editor&&(R=()=>p(),r.editor.on&&r.editor.on("selectionUpdate",R)),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0),t.nextTick(()=>{p()})}),t.onBeforeUnmount(()=>{r.editor&&R&&r.editor.off&&r.editor.off("selectionUpdate",R),window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0)}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{class:"table-toolbar-wrapper",ref_key:"toolbarRoot",ref:i},[t.createElementVNode("div",KF,[t.renderSlot(e.$slots,"default",{},void 0,!0)]),a.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(Fy,{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",ZF,[t.createElementVNode("div",{onClick:f},"下方插入行"),t.createElementVNode("div",{onClick:E},"上方插入行"),t.createElementVNode("div",{onClick:S},"删除行"),t.createElementVNode("div",{class:"danger",onClick:y},"删除表格"),_.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:v},"合并单元格")):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",{key:1,onClick:N},"拆分单元格")):t.createCommentVNode("",!0)])]),_:1},8,["visible"])],4)):t.createCommentVNode("",!0),o.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(Fy,{icon:"mingcute:dot-grid-line",width:"12",height:"12"})]),default:t.withCtx(()=>[t.createElementVNode("div",XF,[t.createElementVNode("div",{onClick:b},"右方插入列"),t.createElementVNode("div",{onClick:T},"左方插入列"),t.createElementVNode("div",{onClick:C},"删除列"),t.createElementVNode("div",{class:"danger",onClick:y},"删除表格"),_.value?(t.openBlock(),t.createElementBlock("div",{key:0,onClick:v},"合并单元格")):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-3bf9a61b"]]);function eB(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tB={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function nB(e){tB=e}var rB={exec:()=>null};function iB(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(oB.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var aB=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),oB={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")},sB=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,lB=/(?:[*+-]|\d{1,9}[.)])/,cB=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dB=iB(cB).replace(/bull/g,lB).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(),_B=iB(cB).replace(/bull/g,lB).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(),uB=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pB=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mB=iB(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pB).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gB=iB(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lB).getRegex(),hB="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",fB=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,EB=iB("^ {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",fB).replace("tag",hB).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),SB=iB(uB).replace("hr",sB).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",hB).getRegex(),bB={blockquote:iB(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",SB).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:mB,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:sB,html:EB,lheading:dB,list:gB,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:SB,table:rB,text:/^[^\n]+/},TB=iB("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sB).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",hB).getRegex(),CB={...bB,lheading:_B,table:TB,paragraph:iB(uB).replace("hr",sB).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",TB).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",hB).getRegex()},yB={...bB,html:iB("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",fB).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:rB,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:iB(uB).replace("hr",sB).replace("heading"," *#{1,6} *[^\n]").replace("lheading",dB).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vB=/^( {2,}|\\)\n(?!\s*$)/,NB=/[\p{P}\p{S}]/u,RB=/[\s\p{P}\p{S}]/u,OB=/[^\s\p{P}\p{S}]/u,AB=iB(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,RB).getRegex(),IB=/(?!~)[\p{P}\p{S}]/u,DB=iB(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",aB?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),wB=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,xB=iB(wB,"u").replace(/punct/g,NB).getRegex(),MB=iB(wB,"u").replace(/punct/g,IB).getRegex(),kB="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",LB=iB(kB,"gu").replace(/notPunctSpace/g,OB).replace(/punctSpace/g,RB).replace(/punct/g,NB).getRegex(),PB=iB(kB,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,IB).getRegex(),FB=iB("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,OB).replace(/punctSpace/g,RB).replace(/punct/g,NB).getRegex(),BB=iB(/\\(punct)/,"gu").replace(/punct/g,NB).getRegex(),UB=iB(/^<(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(),GB=iB(fB).replace("(?:--\x3e|$)","--\x3e").getRegex(),YB=iB("^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",GB).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),HB=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,VB=iB(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",HB).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zB=iB(/^!?\[(label)\]\[(ref)\]/).replace("label",HB).replace("ref",pB).getRegex(),qB=iB(/^!?\[(ref)\](?:\[\])?/).replace("ref",pB).getRegex(),$B=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,WB={_backpedal:rB,anyPunctuation:BB,autolink:UB,blockSkip:DB,br:vB,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:rB,emStrongLDelim:xB,emStrongRDelimAst:LB,emStrongRDelimUnd:FB,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:VB,nolink:qB,punctuation:AB,reflink:zB,reflinkSearch:iB("reflink|nolink(?!\\()","g").replace("reflink",zB).replace("nolink",qB).getRegex(),tag:YB,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:rB},jB={...WB,link:iB(/^!?\[(label)\]\((.*?)\)/).replace("label",HB).getRegex(),reflink:iB(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",HB).getRegex()},QB={...WB,emStrongRDelimAst:PB,emStrongLDelim:MB,url:iB(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$B).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:iB(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$B).getRegex()},KB={...QB,br:iB(vB).replace("{2,}","*").getRegex(),text:iB(QB.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ZB={normal:bB,gfm:CB,pedantic:yB},XB={normal:WB,gfm:QB,breaks:KB,pedantic:jB},JB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eU=e=>JB[e];function tU(e,t){if(t){if(oB.escapeTest.test(e))return e.replace(oB.escapeReplace,eU)}else if(oB.escapeTestNoEncode.test(e))return e.replace(oB.escapeReplaceNoEncode,eU);return e}function nU(e){try{e=encodeURI(e).replace(oB.percentDecode,"%")}catch{return null}return e}function rU(e,t){var n;let r=e.replace(oB.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(oB.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(oB.slashPipe,"|");return r}function iU(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 aU(e,t,n,r,i){let a=t.href,o=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:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,l}var oU=class{constructor(e){a(this,"options"),a(this,"rules"),a(this,"lexer"),this.options=e||tB}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:iU(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=iU(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:iU(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=iU(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,a=!1,o=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))o.push(e[t]),a=!0;else{if(a)break;o.push(e[t])}e=e.slice(t);let s=o.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,a=t.raw+"\n"+e.join("\n"),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if("list"===(null==d?void 0:d.type)){let t=d,a=t.raw+"\n"+e.join("\n"),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-d.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.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 a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",s="";if(!(t=a.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(),_=0;if(this.options.pedantic?(_=2,s=l.trimStart()):d?_=t[1].length+1:(_=t[2].search(this.rules.other.nonSpaceChar),_=_>4?1:_,s=l.slice(_),_+=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(_),n=this.rules.other.hrRegex(_),i=this.rules.other.fencesBeginRegex(_),a=this.rules.other.headingBeginRegex(_),o=this.rules.other.htmlBeginRegex(_);for(;e;){let u,p=e.split("\n",1)[0];if(c=p,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||a.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=_||!c.trim())s+="\n"+u.slice(_);else{if(d||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||a.test(l)||n.test(l))break;s+="\n"+c}!d&&!c.trim()&&(d=!0),r+=p+"\n",e=e.substring(p.length+1),l=u.slice(_)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let u,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(s),p&&(u="[ ] "!==p[0],s=s.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!p,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=rU(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(null==(t=n[3])?void 0:t.trim())?n[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<r.length;e++)o.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:o.align[e]});for(let e of a)o.rows.push(rU(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}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=iU(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)),aU(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 aU(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,a=[...r[0]].length-1,o=a,s=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+a);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]){o+=i;continue}if((r[5]||r[6])&&a%3&&!((a+i)%3)){s+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+s);let t=[...r[0]][0].length,l=e.slice(0,a+r.index+t+i);if(Math.min(a,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}}}},sU=class e{constructor(e){a(this,"tokens"),a(this,"options"),a(this,"state"),a(this,"tokenizer"),a(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||tB,this.options.tokenizer=this.options.tokenizer||new oU,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:oB,block:ZB.normal,inline:XB.normal};this.options.pedantic?(t.block=ZB.pedantic,t.inline=XB.pedantic):this.options.gfm&&(t.block=ZB.gfm,this.options.breaks?t.inline=XB.breaks:t.inline=XB.gfm),this.tokenizer.rules=t}static get rules(){return{block:ZB,inline:XB}}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(oB.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,a;for(this.options.pedantic&&(e=e.replace(oB.tabCharGlobal," ").replace(oB.spaceLine,""));e;){let o;if(null==(i=null==(r=this.options.extensions)?void 0:r.block)?void 0:i.some(n=>!!(o=n.call({lexer:this},e,t))&&(e=e.substring(o.raw.length),t.push(o),!0)))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);let n=t.at(-1);1===o.raw.length&&void 0!==n?n.raw+="\n":t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.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")+o.raw,n.text+="\n"+o.text,this.inlineQueue.at(-1).src=n.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.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")+o.raw,n.text+="\n"+o.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},t.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(null==(a=this.options.extensions)?void 0:a.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&&(o=this.tokenizer.paragraph(s))){let r=t.at(-1);n&&"paragraph"===(null==r?void 0:r.type)?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+o.raw,r.text+="\n"+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(o),n=s.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);let n=t.at(-1);"text"===(null==n?void 0:n.type)?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+o.raw,n.text+="\n"+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(o);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,a,o;let s,l=e,c=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(c=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(c=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,c.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(c=this.tokenizer.rules.inline.blockSkip.exec(l));)s=c[2]?c[2].length:0,l=l.slice(0,c.index+s)+"["+"a".repeat(c[0].length-s-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=(null==(r=null==(n=this.options.hooks)?void 0:n.emStrongMask)?void 0:r.call({lexer:this},l))??l;let d=!1,_="";for(;e;){let n;if(d||(_=""),d=!1,null==(a=null==(i=this.options.extensions)?void 0:i.inline)?void 0:a.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,l,_)){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==(o=this.options.extensions)?void 0:o.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)&&(_=n.raw.slice(-1)),d=!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}},lU=class{constructor(e){a(this,"options"),a(this,"parser"),this.options=e||tB}space(e){return""}code({text:e,lang:t,escaped:n}){var r;let i=null==(r=(t||"").match(oB.notSpaceStart))?void 0:r[0],a=e.replace(oB.endingNewline,"")+"\n";return i?'<pre><code class="language-'+tU(i)+'">'+(n?a:tU(a,!0))+"</code></pre>\n":"<pre><code>"+(n?a:tU(a,!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 a=0;a<e.items.length;a++){let t=e.items[a];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+" "+tU(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>${tU(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=nU(e);if(null===i)return r;let a='<a href="'+(e=i)+'"';return t&&(a+=' title="'+tU(t)+'"'),a+=">"+r+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=nU(e);if(null===i)return tU(n);let a=`<img src="${e=i}" alt="${n}"`;return t&&(a+=` title="${tU(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:tU(e.text)}},cU=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""}},dU=class e{constructor(e){a(this,"options"),a(this,"renderer"),a(this,"textRenderer"),this.options=e||tB,this.options.renderer=this.options.renderer||new lU,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new cU}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 a=0;a<e.length;a++){let o=e[a];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[o.type]){let e=o,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=o;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(;a+1<e.length&&"text"===e[a+1].type;)n=e[++a],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 a=0;a<e.length;a++){let o=e[a];if(null==(r=null==(n=this.options.extensions)?void 0:n.renderers)?void 0:r[o.type]){let e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=e||"";continue}}let s=o;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}},_U=(r=class{constructor(e){a(this,"options"),a(this,"block"),this.options=e||tB}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?sU.lex:sU.lexInline}provideParser(){return this.block?dU.parse:dU.parseInline}},a(r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),a(r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),r),uU=new class{constructor(...e){a(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),a(this,"options",this.setOptions),a(this,"parse",this.parseMarkdown(!0)),a(this,"parseInline",this.parseMarkdown(!1)),a(this,"Parser",dU),a(this,"Renderer",lU),a(this,"TextRenderer",cU),a(this,"Lexer",sU),a(this,"Tokenizer",oU),a(this,"Hooks",_U),this.use(...e)}walkTokens(e,t){var n,r;let i=[];for(let a of e)switch(i=i.concat(t.call(this,a)),a.type){case"table":{let e=a;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=a;i=i.concat(this.walkTokens(e.items,t));break}default:{let e=a;(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 lU(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],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=a.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new oU(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],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new _U;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],a=t[r];_U.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&_U.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=a.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 sU.lex(e,t??this.defaults)}parser(e,t){return dU.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return a(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 a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?sU.lex:sU.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?dU.parse:dU.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?sU.lex:sU.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?dU.parse:dU.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(o){return a(o)}}}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>"+tU(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function pU(e,t){return uU.parse(e,t)}pU.options=pU.setOptions=function(e){return uU.setOptions(e),pU.defaults=uU.defaults,nB(pU.defaults),pU},pU.getDefaults=eB,pU.defaults=tB,pU.use=function(...e){return uU.use(...e),pU.defaults=uU.defaults,nB(pU.defaults),pU},pU.walkTokens=function(e,t){return uU.walkTokens(e,t)},pU.parseInline=uU.parseInline,pU.Parser=dU,pU.parser=dU.parse,pU.Renderer=lU,pU.TextRenderer=cU,pU.Lexer=sU,pU.lexer=sU.lex,pU.Tokenizer=oU,pU.Hooks=_U,pU.parse=pU,pU.options,pU.setOptions,pU.use,pU.walkTokens,pU.parseInline,dU.parse,sU.lex;const mU=By({__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 a=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),a=r.editor.view.coordsAtPos(t),o=r.editor.view.dom.getBoundingClientRect();i.value={top:Math.max(n.top,a.top)-o.top+50}})()});const o=n,s=()=>{o("close")};return(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:"ai-content",style:t.normalizeStyle(a.value)},[t.createVNode(DM,{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"]]),gU={key:0,class:"editor-wrapper-toolbar"},hU={key:1},fU={class:"editor-content-container"},EU={ref:"blockMenuRef"},SU=["src"],bU={class:"source-dialog-content"},TU={class:"dialog-footer"},CU={key:2,class:"editor-bottom"},yU={class:"editor-bottom-r"},vU=By({__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 a=e;let o=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,a=i.parent.textBetween(0,i.parentOffset,void 0,"");if(a.endsWith("/")&&!a.endsWith("//")){const e=i.pos-1;s.value.range={from:e,to:e+1},t.nextTick(()=>{const t=d.view.dom;if(!t)return;const 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=DF({content:"",info:a.info,limit:a.limitLength,isInline:a.isInline,showMenu:a.showMenu,placeholder:a.placeholder,blockMenuFn:e=>{o.value=e},editorWrapper:c.value,checkSlashTrigger:l});function _(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(_(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 p(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()}}a.isInline&&d.setEditable(!1);let m=t.ref(!1),g=t.ref({});const h=r;d.on("update",({editor:e})=>{const t=_(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=Px(e.state.doc);h("update:content",e.getHTML(),n)});let f=t.ref(!1);const E=()=>{f.value=!0,t.nextTick(()=>{const{tr:e}=d.state;d.view.dispatch(e)})},S=()=>{f.value=!1,d.setEditable(!0)},b=t.ref(null);let T=t.ref("");const C=e=>{T.value=e||"",b.value.open()};t.ref(0);const y=[];t.watch(()=>a.isInline,e=>{d&&d.setEditable(!e)}),t.onMounted(()=>{window.addEventListener("tiptap-image-click",R),document.addEventListener("click",p),a.content&&t.nextTick(()=>{requestAnimationFrame(()=>{o.value=!0;const e=Fx({editor:d,content:a.content,type:"html",extensions:dR(),chunkSize:15,onFirstVisible:()=>{o.value=!1},onProgress:e=>{e>0&&(o.value=!1)},onComplete:()=>{o.value=!1;const t=y.indexOf(e);t>-1&&y.splice(t,1)}});e&&y.push(e)})})});const v=t.ref(!1),N=t.ref("");function R(e){N.value=e.detail,v.value=!0}const O=t.ref(!1),A=t.ref("");function I(){A.value=d.getHTML(),O.value=!0}function D(){try{O.value=!1,d.commands.clearContent(),setTimeout(()=>{o.value=!0;const e=Fx({editor:d,content:A.value,type:"html",extensions:dR(),chunkSize:20,onFirstVisible:()=>{o.value=!1},onProgress:e=>{e>0&&(o.value=!1)},onComplete:()=>{o.value=!1,n.ElMessage.success("源代码已应用");const t=y.indexOf(e);t>-1&&y.splice(t,1)}});e&&y.push(e)},50)}catch(e){o.value=!1,n.ElMessage.error("应用源代码失败,请检查代码格式")}}const w=e=>{o.value=e};return t.onBeforeUnmount(()=>{y.forEach(e=>{e&&e.cancel&&e.cancel()}),y.length=0,d&&d.destroy(),window.removeEventListener("tiptap-image-click",R),document.removeEventListener("click",p)}),(r,i)=>{const a=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",gU,[t.createVNode(WF,{editor:t.unref(d),info:e.info,limitLength:e.limitLength,showMenu:e.showMenu,onShowLink:i[0]||(i[0]=e=>C("top")),onToggleLoading:w,onShowAi:E,onShowSource:I},null,8,["editor","info","limitLength","showMenu"])])),e.isInline||t.unref(f)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",hU,[t.createVNode(QF,{editor:t.unref(d),info:e.info,showMenu:e.showMenu,onShowAi:E,onShowLink:i[1]||(i[1]=e=>C())},null,8,["editor","info","showMenu"])])),t.createVNode(JF,{editor:t.unref(d),showToolbar:t.unref(m),"onUpdate:showToolbar":i[2]||(i[2]=e=>t.isRef(m)?m.value=e:m=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",fU,[t.createElementVNode("div",{class:t.normalizeClass(["editor-content",{noPadding:e.isInline}]),ref_key:"editorWrapper",ref:c},[t.createVNode(t.unref(yl),{editor:t.unref(d),style:{width:"100%",height:"calc(100% - 40px)"}},null,8,["editor"]),t.unref(f)?(t.openBlock(),t.createBlock(mU,{key:0,editor:t.unref(d),info:e.info,onClose:S},null,8,["editor","info"])):t.createCommentVNode("",!0),t.createVNode(SL,{ref_key:"linkRef",ref:b,editor:t.unref(d),editorWrapper:t.unref(c),linkPosition:t.unref(T)},null,8,["editor","editorWrapper","linkPosition"]),t.withDirectives(t.createElementVNode("div",EU,[t.createVNode(vF,{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:w,onClosemenu:u,onShowLink:i[4]||(i[4]=e=>C())},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:v.value,"onUpdate:modelValue":i[5]||(i[5]=e=>v.value=e),width:"60%"},{default:t.withCtx(()=>[t.createElementVNode("img",{src:N.value,style:{width:"100%"}},null,8,SU)]),_:1},8,["modelValue"]),t.createVNode(t.unref(n.ElDialog),{modelValue:O.value,"onUpdate:modelValue":i[8]||(i[8]=e=>O.value=e),title:"查看源代码",width:"70%","close-on-click-modal":!1},{footer:t.withCtx(()=>[t.createElementVNode("span",TU,[t.createVNode(t.unref(n.ElButton),{onClick:i[7]||(i[7]=e=>O.value=!1)},{default:t.withCtx(()=>[...i[9]||(i[9]=[t.createTextVNode("取消",-1)])]),_:1}),t.createVNode(t.unref(n.ElButton),{type:"primary",onClick:D},{default:t.withCtx(()=>[...i[10]||(i[10]=[t.createTextVNode("确认",-1)])]),_:1})])]),default:t.withCtx(()=>[t.createElementVNode("div",bU,[t.createVNode(t.unref(n.ElInput),{modelValue:A.value,"onUpdate:modelValue":i[6]||(i[6]=e=>A.value=e),type:"textarea",rows:20,placeholder:"HTML源代码"},null,8,["modelValue"])])]),_:1},8,["modelValue"])],2)])),[[a,t.unref(o)]]),e.limitLength==1/0||e.isInline?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",CU,[t.createElementVNode("div",null,[t.renderSlot(r.$slots,"default",{},void 0,!0)]),t.createElementVNode("div",yU,t.toDisplayString(t.unref(Px)(t.unref(d).state.doc))+"/"+t.toDisplayString(e.limitLength),1)]))],4)],6)}}},[["__scopeId","data-v-cedcbcbc"]]);Array.prototype.findLast||(Array.prototype.findLast=function(e,t){for(let n=this.length-1;n>=0;n--)if(e.call(t,this[n],n,this))return this[n]});const NU=[{name:"TiptapVue",component:vU}],RU={install:e=>{NU.forEach(t=>{e.component(t.name,t.component)})}};e.TiptapVue=vU,e.default=RU,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.124",
3
+ "version": "1.0.126",
4
4
  "homepage": "https://www.npmjs.com/search?q=shizhanyun-web-ui",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -36,29 +36,29 @@
36
36
  "@iconify/vue": "^5.0.0",
37
37
  "@novnc/novnc": "1.4.0",
38
38
  "@tinymce/tinymce-vue": "^6.1.0",
39
- "@tiptap/core": "3.4.1",
40
- "@tiptap/extension-bubble-menu": "3.4.1",
41
- "@tiptap/extension-code-block-lowlight": "3.4.1",
42
- "@tiptap/extension-floating-menu": "3.4.1",
43
- "@tiptap/extension-highlight": "3.4.1",
44
- "@tiptap/extension-history": "3.4.1",
45
- "@tiptap/extension-image": "3.4.1",
46
- "@tiptap/extension-link": "3.4.1",
47
- "@tiptap/extension-list": "3.4.1",
48
- "@tiptap/extension-paragraph": "3.4.1",
49
- "@tiptap/extension-placeholder": "3.4.1",
50
- "@tiptap/extension-strike": "3.4.1",
51
- "@tiptap/extension-table": "3.4.1",
52
- "@tiptap/extension-table-cell": "3.4.1",
53
- "@tiptap/extension-table-header": "3.4.1",
54
- "@tiptap/extension-table-row": "3.4.1",
55
- "@tiptap/extension-text-align": "3.4.1",
56
- "@tiptap/extension-text-style": "3.4.1",
57
- "@tiptap/extension-underline": "3.4.1",
58
- "@tiptap/html": "3.4.3",
59
- "@tiptap/pm": "3.4.1",
60
- "@tiptap/starter-kit": "3.4.1",
61
- "@tiptap/vue-3": "3.4.1",
39
+ "@tiptap/core": "^3.4.1",
40
+ "@tiptap/extension-bubble-menu": "^3.4.1",
41
+ "@tiptap/extension-code-block-lowlight": "^3.4.1",
42
+ "@tiptap/extension-floating-menu": "^3.4.1",
43
+ "@tiptap/extension-highlight": "^3.4.1",
44
+ "@tiptap/extension-history": "^3.4.1",
45
+ "@tiptap/extension-image": "^3.4.1",
46
+ "@tiptap/extension-link": "^3.4.1",
47
+ "@tiptap/extension-list": "^3.4.1",
48
+ "@tiptap/extension-paragraph": "^3.4.1",
49
+ "@tiptap/extension-placeholder": "^3.4.1",
50
+ "@tiptap/extension-strike": "^3.4.1",
51
+ "@tiptap/extension-table": "^3.4.1",
52
+ "@tiptap/extension-table-cell": "^3.4.1",
53
+ "@tiptap/extension-table-header": "^3.4.1",
54
+ "@tiptap/extension-table-row": "^3.4.1",
55
+ "@tiptap/extension-text-align": "^3.4.1",
56
+ "@tiptap/extension-text-style": "^3.4.1",
57
+ "@tiptap/extension-underline": "^3.4.1",
58
+ "@tiptap/html": "^3.4.3",
59
+ "@tiptap/pm": "^3.4.1",
60
+ "@tiptap/starter-kit": "^3.4.1",
61
+ "@tiptap/vue-3": "^3.4.1",
62
62
  "@vueuse/core": "^12.2.0",
63
63
  "ali-oss": "^6.17.1",
64
64
  "axios": "^1.7.4",
@@ -116,28 +116,5 @@
116
116
  "peerDependencies": {
117
117
  "element-plus": "^2.0.0",
118
118
  "vue": "^3.2.0"
119
- },
120
- "pnpm": {
121
- "overrides": {
122
- "@tiptap/core": "3.4.1",
123
- "@tiptap/pm": "3.4.1",
124
- "@tiptap/extension-bold": "3.4.1",
125
- "@tiptap/extension-blockquote": "3.4.1",
126
- "@tiptap/extension-bullet-list": "3.4.1",
127
- "@tiptap/extension-code": "3.4.1",
128
- "@tiptap/extension-code-block": "3.4.1",
129
- "@tiptap/extension-document": "3.4.1",
130
- "@tiptap/extension-dropcursor": "3.4.1",
131
- "@tiptap/extension-gapcursor": "3.4.1",
132
- "@tiptap/extension-hard-break": "3.4.1",
133
- "@tiptap/extension-heading": "3.4.1",
134
- "@tiptap/extension-horizontal-rule": "3.4.1",
135
- "@tiptap/extension-italic": "3.4.1",
136
- "@tiptap/extension-list-item": "3.4.1",
137
- "@tiptap/extension-list-keymap": "3.4.1",
138
- "@tiptap/extension-ordered-list": "3.4.1",
139
- "@tiptap/extension-text": "3.4.1",
140
- "@tiptap/extensions": "3.4.1"
141
- }
142
119
  }
143
120
  }