@nocobase/app 2.0.0-alpha.5 → 2.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/113.736e29a0.async.js +7 -0
- package/dist/client/1145.0351040a.async.js +3 -0
- package/dist/client/1161.0b3b5766.async.js +40 -0
- package/dist/client/1442.be509f94.async.js +5 -0
- package/dist/client/1595.9f992743.async.js +44 -0
- package/dist/client/1758.eeeacf43.async.js +5 -0
- package/dist/client/1883.6ee256ab.async.js +17 -0
- package/dist/client/1905.ff0793ff.async.js +12 -0
- package/dist/client/2042.feb4b9ac.async.js +10 -0
- package/dist/client/2097.919e4d8a.async.js +14 -0
- package/dist/client/{2190.90c718a9.async.js → 2190.4f5395e5.async.js} +1 -1
- package/dist/client/2380.900b7a22.async.js +15 -0
- package/dist/client/2612.0865e67e.async.js +19 -0
- package/dist/client/2775.455c3402.async.js +47 -0
- package/dist/client/2936.902710e4.async.js +28 -0
- package/dist/client/3357.be95167c.async.js +28 -0
- package/dist/client/341.fba65e23.async.js +28 -0
- package/dist/client/3451.a9466e73.async.js +24 -0
- package/dist/client/4327.68c0f17b.async.js +16 -0
- package/dist/client/4351.efe05af2.async.js +15 -0
- package/dist/client/4356.d61392c6.async.js +18 -0
- package/dist/client/4666.fb83d11a.async.js +9 -0
- package/dist/client/4727.0f6df8fb.async.js +1 -0
- package/dist/client/4750.ce3051f3.async.js +31 -0
- package/dist/client/4926.58238954.async.js +17 -0
- package/dist/client/5013.b14730ba.async.js +3 -0
- package/dist/client/5501.22d50b3a.async.js +23 -0
- package/dist/client/5505.a71c2922.async.js +2 -0
- package/dist/client/5662.8c643e63.async.js +26 -0
- package/dist/client/5882.abae55ef.async.js +50 -0
- package/dist/client/5950.179a885e.async.js +4 -0
- package/dist/client/6021.cdefa0d3.async.js +22 -0
- package/dist/client/645.ab5af584.async.js +55 -0
- package/dist/client/6474.49632e37.async.js +21 -0
- package/dist/client/6534.6ea6468b.async.js +33 -0
- package/dist/client/6747.de538558.async.js +22 -0
- package/dist/client/689.4de33d65.async.js +3 -0
- package/dist/client/6920.497d7e80.async.js +59 -0
- package/dist/client/6939.d7d780b7.async.js +17 -0
- package/dist/client/6996.ae27c9d6.async.js +9 -0
- package/dist/client/703.7ad807b0.async.js +17 -0
- package/dist/client/7087.5646e199.async.js +6 -0
- package/dist/client/7483.546ddcb6.async.js +23 -0
- package/dist/client/7534.0d69e071.async.js +34 -0
- package/dist/client/7764.a3ae7727.async.js +25 -0
- package/dist/client/8183.4c6f7e21.async.js +12 -0
- package/dist/client/8408.c0ef773c.async.js +84 -0
- package/dist/client/8805.819c4f44.async.js +20 -0
- package/dist/client/9017.4ae5c322.async.js +6 -0
- package/dist/client/9042.3d21f631.async.js +45 -0
- package/dist/client/908.0e8c8a54.async.js +14 -0
- package/dist/client/9317.fe6ffa9a.async.js +13 -0
- package/dist/client/935.97d45ffa.async.js +27 -0
- package/dist/client/95.24aa76c4.async.js +6 -0
- package/dist/client/9547.a442df93.async.js +25 -0
- package/dist/client/9801.34b13a74.async.js +9 -0
- package/dist/client/9844.6f484975.async.js +37 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/npm._at_jridgewell.72fd4dd4.async.js +1 -0
- package/dist/client/{npm._at_umijs.47085d01.async.js → npm._at_umijs.f64c1387.async.js} +1 -1
- package/dist/client/npm.acorn.59eb4103.async.js +11 -0
- package/dist/client/npm.antd-mobile.55661292.async.js +2 -0
- package/dist/client/npm.babel-runtime.eed49798.async.js +1 -0
- package/dist/client/{npm.highlight.js.c1f693ec.async.js → npm.highlight.js.5db864c8.async.js} +2 -2
- package/dist/client/{npm.htmlparser2.a2f8d64d.async.js → npm.htmlparser2.ee1fb042.async.js} +1 -1
- package/dist/client/npm.liquidjs.7be2e0df.async.js +13 -0
- package/dist/client/npm.sucrase.1cb664e8.async.js +135 -0
- package/dist/client/{npm.unknown.1838c8f4.chunk.css → npm.unknown.d9b587d9.chunk.css} +26 -1
- package/dist/client/npm.vditor.eb5da290.async.js +233 -0
- package/dist/client/p__index.40592ced.async.js +2484 -0
- package/dist/client/{umi.121d6f3f.js → umi.642fefe0.js} +17 -17
- package/lib/config/telemetry.js +1 -0
- package/package.json +6 -6
- package/src/config/telemetry.ts +1 -0
- package/dist/client/1145.4029b0be.async.js +0 -3
- package/dist/client/1617.dd671a87.async.js +0 -6
- package/dist/client/1833.82373d30.async.js +0 -6
- package/dist/client/2134.1d86e440.async.js +0 -5
- package/dist/client/2498.be8b1194.async.js +0 -7
- package/dist/client/260.5b02a0a5.async.js +0 -4
- package/dist/client/2953.2e77d77c.async.js +0 -24
- package/dist/client/3170.6147bd19.async.js +0 -24
- package/dist/client/3255.e6303833.async.js +0 -10
- package/dist/client/3520.81fd6362.async.js +0 -24
- package/dist/client/3522.674f2264.async.js +0 -4
- package/dist/client/4088.0568ef31.async.js +0 -5
- package/dist/client/4205.c3eac46d.async.js +0 -9
- package/dist/client/4644.ae01f8a6.async.js +0 -4
- package/dist/client/4666.d20ff352.async.js +0 -8
- package/dist/client/4840.477401f9.async.js +0 -8
- package/dist/client/5068.72e9d750.async.js +0 -5
- package/dist/client/5087.468f5500.async.js +0 -6
- package/dist/client/5950.b83f8586.async.js +0 -4
- package/dist/client/6416.361c93ff.async.js +0 -4
- package/dist/client/6472.ac05f778.async.js +0 -7
- package/dist/client/6779.47fc1971.async.js +0 -10
- package/dist/client/6816.1ff200ac.async.js +0 -5
- package/dist/client/6996.836a3f7f.async.js +0 -8
- package/dist/client/7463.70ca58ce.async.js +0 -20
- package/dist/client/7482.3924bcd9.async.js +0 -1
- package/dist/client/7522.1f91be5c.async.js +0 -23
- package/dist/client/7596.232a7185.async.js +0 -10
- package/dist/client/7688.85d6d7bb.async.js +0 -4
- package/dist/client/8106.829fd6b5.async.js +0 -10
- package/dist/client/8541.e3110aaa.async.js +0 -8
- package/dist/client/9017.28eacc5a.async.js +0 -6
- package/dist/client/937.a55819ab.async.js +0 -5
- package/dist/client/9462.a7773548.async.js +0 -35
- package/dist/client/9489.25ca39a9.async.js +0 -7
- package/dist/client/9663.c04b2ad1.async.js +0 -5
- package/dist/client/9729.0d7a5c47.async.js +0 -8
- package/dist/client/9848.18f8d3db.async.js +0 -4
- package/dist/client/npm._at_babel.94b2dd75.async.js +0 -3
- package/dist/client/npm.acorn.1f389fab.async.js +0 -6
- package/dist/client/npm.antd-mobile.1a8a8320.async.js +0 -2
- package/dist/client/npm.async-validator.32d9020f.async.js +0 -12
- package/dist/client/p__index.b57f4995.async.js +0 -2316
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
(self.webpackChunknocobase=self.webpackChunknocobase||[]).push([[9063],{62820:function(){"use strict"},93061:function(Tn){(function(Rt,lt){Tn.exports=lt()})(this,()=>(()=>{var Rt={471:ee=>{var A=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},E=-1;A.Diff=function(d,m){return[d,m]},A.prototype.diff_main=function(d,m,s,y){y===void 0&&(y=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+1e3*this.Diff_Timeout);var l=y;if(d==null||m==null)throw new Error("Null input. (diff_main)");if(d==m)return d?[new A.Diff(0,d)]:[];s===void 0&&(s=!0);var u=s,h=this.diff_commonPrefix(d,m),b=d.substring(0,h);d=d.substring(h),m=m.substring(h),h=this.diff_commonSuffix(d,m);var L=d.substring(d.length-h);d=d.substring(0,d.length-h),m=m.substring(0,m.length-h);var S=this.diff_compute_(d,m,u,l);return b&&S.unshift(new A.Diff(0,b)),L&&S.push(new A.Diff(0,L)),this.diff_cleanupMerge(S),S},A.prototype.diff_compute_=function(d,m,s,y){var l;if(!d)return[new A.Diff(1,m)];if(!m)return[new A.Diff(E,d)];var u=d.length>m.length?d:m,h=d.length>m.length?m:d,b=u.indexOf(h);if(b!=-1)return l=[new A.Diff(1,u.substring(0,b)),new A.Diff(0,h),new A.Diff(1,u.substring(b+h.length))],d.length>m.length&&(l[0][0]=l[2][0]=E),l;if(h.length==1)return[new A.Diff(E,d),new A.Diff(1,m)];var L=this.diff_halfMatch_(d,m);if(L){var S=L[0],T=L[1],w=L[2],k=L[3],p=L[4],x=this.diff_main(S,w,s,y),I=this.diff_main(T,k,s,y);return x.concat([new A.Diff(0,p)],I)}return s&&d.length>100&&m.length>100?this.diff_lineMode_(d,m,y):this.diff_bisect_(d,m,y)},A.prototype.diff_lineMode_=function(d,m,s){var y=this.diff_linesToChars_(d,m);d=y.chars1,m=y.chars2;var l=y.lineArray,u=this.diff_main(d,m,!1,s);this.diff_charsToLines_(u,l),this.diff_cleanupSemantic(u),u.push(new A.Diff(0,""));for(var h=0,b=0,L=0,S="",T="";h<u.length;){switch(u[h][0]){case 1:L++,T+=u[h][1];break;case E:b++,S+=u[h][1];break;case 0:if(b>=1&&L>=1){u.splice(h-b-L,b+L),h=h-b-L;for(var w=this.diff_main(S,T,!1,s),k=w.length-1;k>=0;k--)u.splice(h,0,w[k]);h+=w.length}L=0,b=0,S="",T=""}h++}return u.pop(),u},A.prototype.diff_bisect_=function(d,m,s){for(var y=d.length,l=m.length,u=Math.ceil((y+l)/2),h=u,b=2*u,L=new Array(b),S=new Array(b),T=0;T<b;T++)L[T]=-1,S[T]=-1;L[h+1]=0,S[h+1]=0;for(var w=y-l,k=w%2!=0,p=0,x=0,I=0,W=0,N=0;N<u&&!(new Date().getTime()>s);N++){for(var Z=-N+p;Z<=N-x;Z+=2){for(var te=h+Z,pe=(Ee=Z==-N||Z!=N&&L[te-1]<L[te+1]?L[te+1]:L[te-1]+1)-Z;Ee<y&&pe<l&&d.charAt(Ee)==m.charAt(pe);)Ee++,pe++;if(L[te]=Ee,Ee>y)x+=2;else if(pe>l)p+=2;else if(k&&(fe=h+w-Z)>=0&&fe<b&&S[fe]!=-1&&Ee>=(se=y-S[fe]))return this.diff_bisectSplit_(d,m,Ee,pe,s)}for(var ce=-N+I;ce<=N-W;ce+=2){for(var se,fe=h+ce,Le=(se=ce==-N||ce!=N&&S[fe-1]<S[fe+1]?S[fe+1]:S[fe-1]+1)-ce;se<y&&Le<l&&d.charAt(y-se-1)==m.charAt(l-Le-1);)se++,Le++;if(S[fe]=se,se>y)W+=2;else if(Le>l)I+=2;else if(!k&&(te=h+w-ce)>=0&&te<b&&L[te]!=-1){var Ee;if(pe=h+(Ee=L[te])-te,Ee>=(se=y-se))return this.diff_bisectSplit_(d,m,Ee,pe,s)}}}return[new A.Diff(E,d),new A.Diff(1,m)]},A.prototype.diff_bisectSplit_=function(d,m,s,y,l){var u=d.substring(0,s),h=m.substring(0,y),b=d.substring(s),L=m.substring(y),S=this.diff_main(u,h,!1,l),T=this.diff_main(b,L,!1,l);return S.concat(T)},A.prototype.diff_linesToChars_=function(d,m){var s=[],y={};function l(b){for(var L="",S=0,T=-1,w=s.length;T<b.length-1;){(T=b.indexOf(`
|
|
2
|
+
`,S))==-1&&(T=b.length-1);var k=b.substring(S,T+1);(y.hasOwnProperty?y.hasOwnProperty(k):y[k]!==void 0)?L+=String.fromCharCode(y[k]):(w==u&&(k=b.substring(S),T=b.length),L+=String.fromCharCode(w),y[k]=w,s[w++]=k),S=T+1}return L}s[0]="";var u=4e4,h=l(d);return u=65535,{chars1:h,chars2:l(m),lineArray:s}},A.prototype.diff_charsToLines_=function(d,m){for(var s=0;s<d.length;s++){for(var y=d[s][1],l=[],u=0;u<y.length;u++)l[u]=m[y.charCodeAt(u)];d[s][1]=l.join("")}},A.prototype.diff_commonPrefix=function(d,m){if(!d||!m||d.charAt(0)!=m.charAt(0))return 0;for(var s=0,y=Math.min(d.length,m.length),l=y,u=0;s<l;)d.substring(u,l)==m.substring(u,l)?u=s=l:y=l,l=Math.floor((y-s)/2+s);return l},A.prototype.diff_commonSuffix=function(d,m){if(!d||!m||d.charAt(d.length-1)!=m.charAt(m.length-1))return 0;for(var s=0,y=Math.min(d.length,m.length),l=y,u=0;s<l;)d.substring(d.length-l,d.length-u)==m.substring(m.length-l,m.length-u)?u=s=l:y=l,l=Math.floor((y-s)/2+s);return l},A.prototype.diff_commonOverlap_=function(d,m){var s=d.length,y=m.length;if(s==0||y==0)return 0;s>y?d=d.substring(s-y):s<y&&(m=m.substring(0,s));var l=Math.min(s,y);if(d==m)return l;for(var u=0,h=1;;){var b=d.substring(l-h),L=m.indexOf(b);if(L==-1)return u;h+=L,L!=0&&d.substring(l-h)!=m.substring(0,h)||(u=h,h++)}},A.prototype.diff_halfMatch_=function(d,m){if(this.Diff_Timeout<=0)return null;var s=d.length>m.length?d:m,y=d.length>m.length?m:d;if(s.length<4||2*y.length<s.length)return null;var l=this;function u(p,x,I){for(var W,N,Z,te,pe=p.substring(I,I+Math.floor(p.length/4)),ce=-1,se="";(ce=x.indexOf(pe,ce+1))!=-1;){var fe=l.diff_commonPrefix(p.substring(I),x.substring(ce)),Le=l.diff_commonSuffix(p.substring(0,I),x.substring(0,ce));se.length<Le+fe&&(se=x.substring(ce-Le,ce)+x.substring(ce,ce+fe),W=p.substring(0,I-Le),N=p.substring(I+fe),Z=x.substring(0,ce-Le),te=x.substring(ce+fe))}return 2*se.length>=p.length?[W,N,Z,te,se]:null}var h,b,L,S,T,w=u(s,y,Math.ceil(s.length/4)),k=u(s,y,Math.ceil(s.length/2));return w||k?(h=k?w&&w[4].length>k[4].length?w:k:w,d.length>m.length?(b=h[0],L=h[1],S=h[2],T=h[3]):(S=h[0],T=h[1],b=h[2],L=h[3]),[b,L,S,T,h[4]]):null},A.prototype.diff_cleanupSemantic=function(d){for(var m=!1,s=[],y=0,l=null,u=0,h=0,b=0,L=0,S=0;u<d.length;)d[u][0]==0?(s[y++]=u,h=L,b=S,L=0,S=0,l=d[u][1]):(d[u][0]==1?L+=d[u][1].length:S+=d[u][1].length,l&&l.length<=Math.max(h,b)&&l.length<=Math.max(L,S)&&(d.splice(s[y-1],0,new A.Diff(E,l)),d[s[y-1]+1][0]=1,y--,u=--y>0?s[y-1]:-1,h=0,b=0,L=0,S=0,l=null,m=!0)),u++;for(m&&this.diff_cleanupMerge(d),this.diff_cleanupSemanticLossless(d),u=1;u<d.length;){if(d[u-1][0]==E&&d[u][0]==1){var T=d[u-1][1],w=d[u][1],k=this.diff_commonOverlap_(T,w),p=this.diff_commonOverlap_(w,T);k>=p?(k>=T.length/2||k>=w.length/2)&&(d.splice(u,0,new A.Diff(0,w.substring(0,k))),d[u-1][1]=T.substring(0,T.length-k),d[u+1][1]=w.substring(k),u++):(p>=T.length/2||p>=w.length/2)&&(d.splice(u,0,new A.Diff(0,T.substring(0,p))),d[u-1][0]=1,d[u-1][1]=w.substring(0,w.length-p),d[u+1][0]=E,d[u+1][1]=T.substring(p),u++),u++}u++}},A.prototype.diff_cleanupSemanticLossless=function(d){function m(p,x){if(!p||!x)return 6;var I=p.charAt(p.length-1),W=x.charAt(0),N=I.match(A.nonAlphaNumericRegex_),Z=W.match(A.nonAlphaNumericRegex_),te=N&&I.match(A.whitespaceRegex_),pe=Z&&W.match(A.whitespaceRegex_),ce=te&&I.match(A.linebreakRegex_),se=pe&&W.match(A.linebreakRegex_),fe=ce&&p.match(A.blanklineEndRegex_),Le=se&&x.match(A.blanklineStartRegex_);return fe||Le?5:ce||se?4:N&&!te&&pe?3:te||pe?2:N||Z?1:0}for(var s=1;s<d.length-1;){if(d[s-1][0]==0&&d[s+1][0]==0){var y=d[s-1][1],l=d[s][1],u=d[s+1][1],h=this.diff_commonSuffix(y,l);if(h){var b=l.substring(l.length-h);y=y.substring(0,y.length-h),l=b+l.substring(0,l.length-h),u=b+u}for(var L=y,S=l,T=u,w=m(y,l)+m(l,u);l.charAt(0)===u.charAt(0);){y+=l.charAt(0),l=l.substring(1)+u.charAt(0),u=u.substring(1);var k=m(y,l)+m(l,u);k>=w&&(w=k,L=y,S=l,T=u)}d[s-1][1]!=L&&(L?d[s-1][1]=L:(d.splice(s-1,1),s--),d[s][1]=S,T?d[s+1][1]=T:(d.splice(s+1,1),s--))}s++}},A.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,A.whitespaceRegex_=/\s/,A.linebreakRegex_=/[\r\n]/,A.blanklineEndRegex_=/\n\r?\n$/,A.blanklineStartRegex_=/^\r?\n\r?\n/,A.prototype.diff_cleanupEfficiency=function(d){for(var m=!1,s=[],y=0,l=null,u=0,h=!1,b=!1,L=!1,S=!1;u<d.length;)d[u][0]==0?(d[u][1].length<this.Diff_EditCost&&(L||S)?(s[y++]=u,h=L,b=S,l=d[u][1]):(y=0,l=null),L=S=!1):(d[u][0]==E?S=!0:L=!0,l&&(h&&b&&L&&S||l.length<this.Diff_EditCost/2&&h+b+L+S==3)&&(d.splice(s[y-1],0,new A.Diff(E,l)),d[s[y-1]+1][0]=1,y--,l=null,h&&b?(L=S=!0,y=0):(u=--y>0?s[y-1]:-1,L=S=!1),m=!0)),u++;m&&this.diff_cleanupMerge(d)},A.prototype.diff_cleanupMerge=function(d){d.push(new A.Diff(0,""));for(var m,s=0,y=0,l=0,u="",h="";s<d.length;)switch(d[s][0]){case 1:l++,h+=d[s][1],s++;break;case E:y++,u+=d[s][1],s++;break;case 0:y+l>1?(y!==0&&l!==0&&((m=this.diff_commonPrefix(h,u))!==0&&(s-y-l>0&&d[s-y-l-1][0]==0?d[s-y-l-1][1]+=h.substring(0,m):(d.splice(0,0,new A.Diff(0,h.substring(0,m))),s++),h=h.substring(m),u=u.substring(m)),(m=this.diff_commonSuffix(h,u))!==0&&(d[s][1]=h.substring(h.length-m)+d[s][1],h=h.substring(0,h.length-m),u=u.substring(0,u.length-m))),s-=y+l,d.splice(s,y+l),u.length&&(d.splice(s,0,new A.Diff(E,u)),s++),h.length&&(d.splice(s,0,new A.Diff(1,h)),s++),s++):s!==0&&d[s-1][0]==0?(d[s-1][1]+=d[s][1],d.splice(s,1)):s++,l=0,y=0,u="",h=""}d[d.length-1][1]===""&&d.pop();var b=!1;for(s=1;s<d.length-1;)d[s-1][0]==0&&d[s+1][0]==0&&(d[s][1].substring(d[s][1].length-d[s-1][1].length)==d[s-1][1]?(d[s][1]=d[s-1][1]+d[s][1].substring(0,d[s][1].length-d[s-1][1].length),d[s+1][1]=d[s-1][1]+d[s+1][1],d.splice(s-1,1),b=!0):d[s][1].substring(0,d[s+1][1].length)==d[s+1][1]&&(d[s-1][1]+=d[s+1][1],d[s][1]=d[s][1].substring(d[s+1][1].length)+d[s+1][1],d.splice(s+1,1),b=!0)),s++;b&&this.diff_cleanupMerge(d)},A.prototype.diff_xIndex=function(d,m){var s,y=0,l=0,u=0,h=0;for(s=0;s<d.length&&(d[s][0]!==1&&(y+=d[s][1].length),d[s][0]!==E&&(l+=d[s][1].length),!(y>m));s++)u=y,h=l;return d.length!=s&&d[s][0]===E?h:h+(m-u)},A.prototype.diff_prettyHtml=function(d){for(var m=[],s=/&/g,y=/</g,l=/>/g,u=/\n/g,h=0;h<d.length;h++){var b=d[h][0],L=d[h][1].replace(s,"&").replace(y,"<").replace(l,">").replace(u,"¶<br>");switch(b){case 1:m[h]='<ins style="background:#e6ffe6;">'+L+"</ins>";break;case E:m[h]='<del style="background:#ffe6e6;">'+L+"</del>";break;case 0:m[h]="<span>"+L+"</span>"}}return m.join("")},A.prototype.diff_text1=function(d){for(var m=[],s=0;s<d.length;s++)d[s][0]!==1&&(m[s]=d[s][1]);return m.join("")},A.prototype.diff_text2=function(d){for(var m=[],s=0;s<d.length;s++)d[s][0]!==E&&(m[s]=d[s][1]);return m.join("")},A.prototype.diff_levenshtein=function(d){for(var m=0,s=0,y=0,l=0;l<d.length;l++){var u=d[l][0],h=d[l][1];switch(u){case 1:s+=h.length;break;case E:y+=h.length;break;case 0:m+=Math.max(s,y),s=0,y=0}}return m+=Math.max(s,y)},A.prototype.diff_toDelta=function(d){for(var m=[],s=0;s<d.length;s++)switch(d[s][0]){case 1:m[s]="+"+encodeURI(d[s][1]);break;case E:m[s]="-"+d[s][1].length;break;case 0:m[s]="="+d[s][1].length}return m.join(" ").replace(/%20/g," ")},A.prototype.diff_fromDelta=function(d,m){for(var s=[],y=0,l=0,u=m.split(/\t/g),h=0;h<u.length;h++){var b=u[h].substring(1);switch(u[h].charAt(0)){case"+":try{s[y++]=new A.Diff(1,decodeURI(b))}catch{throw new Error("Illegal escape in diff_fromDelta: "+b)}break;case"-":case"=":var L=parseInt(b,10);if(isNaN(L)||L<0)throw new Error("Invalid number in diff_fromDelta: "+b);var S=d.substring(l,l+=L);u[h].charAt(0)=="="?s[y++]=new A.Diff(0,S):s[y++]=new A.Diff(E,S);break;default:if(u[h])throw new Error("Invalid diff operation in diff_fromDelta: "+u[h])}}if(l!=d.length)throw new Error("Delta length ("+l+") does not equal source text length ("+d.length+").");return s},A.prototype.match_main=function(d,m,s){if(d==null||m==null||s==null)throw new Error("Null input. (match_main)");return s=Math.max(0,Math.min(s,d.length)),d==m?0:d.length?d.substring(s,s+m.length)==m?s:this.match_bitap_(d,m,s):-1},A.prototype.match_bitap_=function(d,m,s){if(m.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var y=this.match_alphabet_(m),l=this;function u(pe,ce){var se=pe/m.length,fe=Math.abs(s-ce);return l.Match_Distance?se+fe/l.Match_Distance:fe?1:se}var h=this.Match_Threshold,b=d.indexOf(m,s);b!=-1&&(h=Math.min(u(0,b),h),(b=d.lastIndexOf(m,s+m.length))!=-1&&(h=Math.min(u(0,b),h)));var L,S,T=1<<m.length-1;b=-1;for(var w,k=m.length+d.length,p=0;p<m.length;p++){for(L=0,S=k;L<S;)u(p,s+S)<=h?L=S:k=S,S=Math.floor((k-L)/2+L);k=S;var x=Math.max(1,s-S+1),I=Math.min(s+S,d.length)+m.length,W=Array(I+2);W[I+1]=(1<<p)-1;for(var N=I;N>=x;N--){var Z=y[d.charAt(N-1)];if(W[N]=p===0?(W[N+1]<<1|1)&Z:(W[N+1]<<1|1)&Z|(w[N+1]|w[N])<<1|1|w[N+1],W[N]&T){var te=u(p,N-1);if(te<=h){if(h=te,!((b=N-1)>s))break;x=Math.max(1,2*s-b)}}}if(u(p+1,s)>h)break;w=W}return b},A.prototype.match_alphabet_=function(d){for(var m={},s=0;s<d.length;s++)m[d.charAt(s)]=0;for(s=0;s<d.length;s++)m[d.charAt(s)]|=1<<d.length-s-1;return m},A.prototype.patch_addContext_=function(d,m){if(m.length!=0){if(d.start2===null)throw Error("patch not initialized");for(var s=m.substring(d.start2,d.start2+d.length1),y=0;m.indexOf(s)!=m.lastIndexOf(s)&&s.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)y+=this.Patch_Margin,s=m.substring(d.start2-y,d.start2+d.length1+y);y+=this.Patch_Margin;var l=m.substring(d.start2-y,d.start2);l&&d.diffs.unshift(new A.Diff(0,l));var u=m.substring(d.start2+d.length1,d.start2+d.length1+y);u&&d.diffs.push(new A.Diff(0,u)),d.start1-=l.length,d.start2-=l.length,d.length1+=l.length+u.length,d.length2+=l.length+u.length}},A.prototype.patch_make=function(d,m,s){var y,l;if(typeof d=="string"&&typeof m=="string"&&s===void 0)y=d,(l=this.diff_main(y,m,!0)).length>2&&(this.diff_cleanupSemantic(l),this.diff_cleanupEfficiency(l));else if(d&&typeof d=="object"&&m===void 0&&s===void 0)l=d,y=this.diff_text1(l);else if(typeof d=="string"&&m&&typeof m=="object"&&s===void 0)y=d,l=m;else{if(typeof d!="string"||typeof m!="string"||!s||typeof s!="object")throw new Error("Unknown call format to patch_make.");y=d,l=s}if(l.length===0)return[];for(var u=[],h=new A.patch_obj,b=0,L=0,S=0,T=y,w=y,k=0;k<l.length;k++){var p=l[k][0],x=l[k][1];switch(b||p===0||(h.start1=L,h.start2=S),p){case 1:h.diffs[b++]=l[k],h.length2+=x.length,w=w.substring(0,S)+x+w.substring(S);break;case E:h.length1+=x.length,h.diffs[b++]=l[k],w=w.substring(0,S)+w.substring(S+x.length);break;case 0:x.length<=2*this.Patch_Margin&&b&&l.length!=k+1?(h.diffs[b++]=l[k],h.length1+=x.length,h.length2+=x.length):x.length>=2*this.Patch_Margin&&b&&(this.patch_addContext_(h,T),u.push(h),h=new A.patch_obj,b=0,T=w,L=S)}p!==1&&(L+=x.length),p!==E&&(S+=x.length)}return b&&(this.patch_addContext_(h,T),u.push(h)),u},A.prototype.patch_deepCopy=function(d){for(var m=[],s=0;s<d.length;s++){var y=d[s],l=new A.patch_obj;l.diffs=[];for(var u=0;u<y.diffs.length;u++)l.diffs[u]=new A.Diff(y.diffs[u][0],y.diffs[u][1]);l.start1=y.start1,l.start2=y.start2,l.length1=y.length1,l.length2=y.length2,m[s]=l}return m},A.prototype.patch_apply=function(d,m){if(d.length==0)return[m,[]];d=this.patch_deepCopy(d);var s=this.patch_addPadding(d);m=s+m+s,this.patch_splitMax(d);for(var y=0,l=[],u=0;u<d.length;u++){var h,b,L=d[u].start2+y,S=this.diff_text1(d[u].diffs),T=-1;if(S.length>this.Match_MaxBits?(h=this.match_main(m,S.substring(0,this.Match_MaxBits),L))!=-1&&((T=this.match_main(m,S.substring(S.length-this.Match_MaxBits),L+S.length-this.Match_MaxBits))==-1||h>=T)&&(h=-1):h=this.match_main(m,S,L),h==-1)l[u]=!1,y-=d[u].length2-d[u].length1;else if(l[u]=!0,y=h-L,S==(b=T==-1?m.substring(h,h+S.length):m.substring(h,T+this.Match_MaxBits)))m=m.substring(0,h)+this.diff_text2(d[u].diffs)+m.substring(h+S.length);else{var w=this.diff_main(S,b,!1);if(S.length>this.Match_MaxBits&&this.diff_levenshtein(w)/S.length>this.Patch_DeleteThreshold)l[u]=!1;else{this.diff_cleanupSemanticLossless(w);for(var k,p=0,x=0;x<d[u].diffs.length;x++){var I=d[u].diffs[x];I[0]!==0&&(k=this.diff_xIndex(w,p)),I[0]===1?m=m.substring(0,h+k)+I[1]+m.substring(h+k):I[0]===E&&(m=m.substring(0,h+k)+m.substring(h+this.diff_xIndex(w,p+I[1].length))),I[0]!==E&&(p+=I[1].length)}}}}return[m=m.substring(s.length,m.length-s.length),l]},A.prototype.patch_addPadding=function(d){for(var m=this.Patch_Margin,s="",y=1;y<=m;y++)s+=String.fromCharCode(y);for(y=0;y<d.length;y++)d[y].start1+=m,d[y].start2+=m;var l=d[0],u=l.diffs;if(u.length==0||u[0][0]!=0)u.unshift(new A.Diff(0,s)),l.start1-=m,l.start2-=m,l.length1+=m,l.length2+=m;else if(m>u[0][1].length){var h=m-u[0][1].length;u[0][1]=s.substring(u[0][1].length)+u[0][1],l.start1-=h,l.start2-=h,l.length1+=h,l.length2+=h}return(u=(l=d[d.length-1]).diffs).length==0||u[u.length-1][0]!=0?(u.push(new A.Diff(0,s)),l.length1+=m,l.length2+=m):m>u[u.length-1][1].length&&(h=m-u[u.length-1][1].length,u[u.length-1][1]+=s.substring(0,h),l.length1+=h,l.length2+=h),s},A.prototype.patch_splitMax=function(d){for(var m=this.Match_MaxBits,s=0;s<d.length;s++)if(!(d[s].length1<=m)){var y=d[s];d.splice(s--,1);for(var l=y.start1,u=y.start2,h="";y.diffs.length!==0;){var b=new A.patch_obj,L=!0;for(b.start1=l-h.length,b.start2=u-h.length,h!==""&&(b.length1=b.length2=h.length,b.diffs.push(new A.Diff(0,h)));y.diffs.length!==0&&b.length1<m-this.Patch_Margin;){var S=y.diffs[0][0],T=y.diffs[0][1];S===1?(b.length2+=T.length,u+=T.length,b.diffs.push(y.diffs.shift()),L=!1):S===E&&b.diffs.length==1&&b.diffs[0][0]==0&&T.length>2*m?(b.length1+=T.length,l+=T.length,L=!1,b.diffs.push(new A.Diff(S,T)),y.diffs.shift()):(T=T.substring(0,m-b.length1-this.Patch_Margin),b.length1+=T.length,l+=T.length,S===0?(b.length2+=T.length,u+=T.length):L=!1,b.diffs.push(new A.Diff(S,T)),T==y.diffs[0][1]?y.diffs.shift():y.diffs[0][1]=y.diffs[0][1].substring(T.length))}h=(h=this.diff_text2(b.diffs)).substring(h.length-this.Patch_Margin);var w=this.diff_text1(y.diffs).substring(0,this.Patch_Margin);w!==""&&(b.length1+=w.length,b.length2+=w.length,b.diffs.length!==0&&b.diffs[b.diffs.length-1][0]===0?b.diffs[b.diffs.length-1][1]+=w:b.diffs.push(new A.Diff(0,w))),L||d.splice(++s,0,b)}}},A.prototype.patch_toText=function(d){for(var m=[],s=0;s<d.length;s++)m[s]=d[s];return m.join("")},A.prototype.patch_fromText=function(d){var m=[];if(!d)return m;for(var s=d.split(`
|
|
3
|
+
`),y=0,l=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;y<s.length;){var u=s[y].match(l);if(!u)throw new Error("Invalid patch string: "+s[y]);var h=new A.patch_obj;for(m.push(h),h.start1=parseInt(u[1],10),u[2]===""?(h.start1--,h.length1=1):u[2]=="0"?h.length1=0:(h.start1--,h.length1=parseInt(u[2],10)),h.start2=parseInt(u[3],10),u[4]===""?(h.start2--,h.length2=1):u[4]=="0"?h.length2=0:(h.start2--,h.length2=parseInt(u[4],10)),y++;y<s.length;){var b=s[y].charAt(0);try{var L=decodeURI(s[y].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+L)}if(b=="-")h.diffs.push(new A.Diff(E,L));else if(b=="+")h.diffs.push(new A.Diff(1,L));else if(b==" ")h.diffs.push(new A.Diff(0,L));else{if(b=="@")break;if(b!=="")throw new Error('Invalid patch mode "'+b+'" in: '+L)}y++}}return m},(A.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){for(var d,m=["@@ -"+(this.length1===0?this.start1+",0":this.length1==1?this.start1+1:this.start1+1+","+this.length1)+" +"+(this.length2===0?this.start2+",0":this.length2==1?this.start2+1:this.start2+1+","+this.length2)+` @@
|
|
4
|
+
`],s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case 1:d="+";break;case E:d="-";break;case 0:d=" "}m[s+1]=d+encodeURI(this.diffs[s][1])+`
|
|
5
|
+
`}return m.join("").replace(/%20/g," ")},ee.exports=A,ee.exports.diff_match_patch=A,ee.exports.DIFF_DELETE=E,ee.exports.DIFF_INSERT=1,ee.exports.DIFF_EQUAL=0},872:(ee,A,E)=>{"use strict";E.d(A,{default:()=>st});var d=E(478),m=E(156),s=E(314),y=E(730),l=E(66),u=E(218),h=E(702),b=function(K){K===void 0&&(K=document);var me=function(V){var j=document.createElement("img");j.src=V.getAttribute("data-src"),j.addEventListener("load",function(){V.getAttribute("style")||V.getAttribute("class")||V.getAttribute("width")||V.getAttribute("height")||j.naturalHeight>j.naturalWidth&&j.naturalWidth/j.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&j.naturalHeight>window.innerHeight-40&&(V.style.height=window.innerHeight-40+"px"),V.src=j.src}),V.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return K.querySelectorAll("img").forEach(function(V){V.getAttribute("data-src")&&me(V)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),K.querySelectorAll("img").forEach(function(V){window.vditorImageIntersectionObserver.observe(V)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(V){V.forEach(function(j){(j.isIntersecting===void 0?j.intersectionRatio!==0:j.isIntersecting)&&j.target.getAttribute("data-src")&&me(j.target)})}),K.querySelectorAll("img").forEach(function(V){window.vditorImageIntersectionObserver.observe(V)}))},L=E(466),S=E(554),T=E(40),w=E(563),k=E(749),p=E(818),x=E(408),I=E(54),W=E(227),N=E(526),Z=E(827),te=E(640),pe=E(895),ce=E(393),se=function(K,me){if(me===void 0&&(me="zh_CN"),typeof speechSynthesis<"u"&&typeof SpeechSynthesisUtterance<"u"){var V=function(){var ue,de;return speechSynthesis.getVoices().forEach(function(X){X.lang===me.replace("_","-")&&(ue=X),X.default&&(de=X)}),ue||(ue=de),ue},j='<svg><use xlink:href="#vditor-icon-play"></use></svg>',re='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(j='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',re='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var ae=document.querySelector(".vditor-speech");ae||((ae=document.createElement("button")).className="vditor-speech",K.insertAdjacentElement("beforeend",ae),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=V));var ie=V(),Te=new SpeechSynthesisUtterance;Te.voice=ie,Te.onend=Te.onerror=function(){ae.style.display="none",speechSynthesis.cancel(),ae.classList.remove("vditor-speech--current"),ae.innerHTML=j},K.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(ue){var de=ue.target;if(de.classList.contains("vditor-speech")||de.parentElement.classList.contains("vditor-speech"))return ae.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),ae.innerHTML=re):(speechSynthesis.pause(),ae.innerHTML=j)):(Te.text=ae.getAttribute("data-text"),speechSynthesis.speak(Te),ae.classList.add("vditor-speech--current"),ae.innerHTML=re),(0,ce.Hc)(window.vditorSpeechRange),void K.focus();if(ae.style.display="none",speechSynthesis.cancel(),ae.classList.remove("vditor-speech--current"),ae.innerHTML=j,getSelection().rangeCount!==0){var X=getSelection().getRangeAt(0),je=X.toString().trim();if(je){window.vditorSpeechRange=X.cloneRange();var Ue=X.getBoundingClientRect();ae.innerHTML=j,ae.style.display="block",ae.style.top=Ue.top+Ue.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?ae.style.left=ue.changedTouches[ue.changedTouches.length-1].pageX+2+"px":ae.style.left=ue.clientX+2+"px",ae.setAttribute("data-text",je)}}})}},fe=function(K,me,V,j){return new(V||(V=Promise))(function(re,ae){function ie(de){try{ue(j.next(de))}catch(X){ae(X)}}function Te(de){try{ue(j.throw(de))}catch(X){ae(X)}}function ue(de){var X;de.done?re(de.value):(X=de.value,X instanceof V?X:new V(function(je){je(X)})).then(ie,Te)}ue((j=j.apply(K,me||[])).next())})},Le=function(K,me){var V,j,re,ae,ie={label:0,sent:function(){if(1&re[0])throw re[1];return re[1]},trys:[],ops:[]};return ae={next:Te(0),throw:Te(1),return:Te(2)},typeof Symbol=="function"&&(ae[Symbol.iterator]=function(){return this}),ae;function Te(ue){return function(de){return function(X){if(V)throw new TypeError("Generator is already executing.");for(;ie;)try{if(V=1,j&&(re=2&X[0]?j.return:X[0]?j.throw||((re=j.return)&&re.call(j),0):j.next)&&!(re=re.call(j,X[1])).done)return re;switch(j=0,re&&(X=[2&X[0],re.value]),X[0]){case 0:case 1:re=X;break;case 4:return ie.label++,{value:X[1],done:!1};case 5:ie.label++,j=X[1],X=[0];continue;case 7:X=ie.ops.pop(),ie.trys.pop();continue;default:if(re=ie.trys,!((re=re.length>0&&re[re.length-1])||X[0]!==6&&X[0]!==2)){ie=0;continue}if(X[0]===3&&(!re||X[1]>re[0]&&X[1]<re[3])){ie.label=X[1];break}if(X[0]===6&&ie.label<re[1]){ie.label=re[1],re=X;break}if(re&&ie.label<re[2]){ie.label=re[2],ie.ops.push(X);break}re[2]&&ie.ops.pop(),ie.trys.pop();continue}X=me.call(K,ie)}catch(je){X=[6,je],j=0}finally{V=re=0}if(5&X[0])throw X[1];return{value:X[0]?X[1]:void 0,done:!0}}([ue,de])}}},Ee=function(K){var me,V={anchor:0,cdn:I.g.CDN,customEmoji:{},emojiPath:I.g.CDN+"/dist/images/emoji",hljs:I.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:I.g.MARKDOWN_OPTIONS,math:I.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:I.g.THEME_OPTIONS};return K.cdn&&(!((me=K.theme)===null||me===void 0)&&me.path||(V.theme.path=K.cdn+"/dist/css/content-theme"),K.emojiPath||(V.emojiPath=K.cdn+"/dist/images/emoji")),(0,te.T)(V,K)},Be=function(K,me){var V=Ee(me);return(0,N.G)(V.cdn+"/dist/js/lute/lute.min.js","vditorLuteScript").then(function(){var j=(0,pe.X)({autoSpace:V.markdown.autoSpace,gfmAutoLink:V.markdown.gfmAutoLink,codeBlockPreview:V.markdown.codeBlockPreview,emojiSite:V.emojiPath,emojis:V.customEmoji,fixTermTypo:V.markdown.fixTermTypo,footnotes:V.markdown.footnotes,headingAnchor:V.anchor!==0,inlineMathDigit:V.math.inlineDigit,lazyLoadImage:V.lazyLoadImage,linkBase:V.markdown.linkBase,linkPrefix:V.markdown.linkPrefix,listStyle:V.markdown.listStyle,mark:V.markdown.mark,mathBlockPreview:V.markdown.mathBlockPreview,paragraphBeginningSpace:V.markdown.paragraphBeginningSpace,sanitize:V.markdown.sanitize,toc:V.markdown.toc});return me!=null&&me.renderers&&j.SetJSRenderers({renderers:{Md2HTML:me.renderers}}),j.SetHeadingID(!0),j.Md2HTML(K)})},we=function(K,me,V){return fe(void 0,void 0,void 0,function(){var j,re,ae;return Le(this,function(ie){switch(ie.label){case 0:return j=Ee(V),[4,Be(me,j)];case 1:if(re=ie.sent(),j.transform&&(re=j.transform(re)),K.innerHTML=re,K.classList.add("vditor-reset"),j.i18n)return[3,5];if(["en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(j.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return ae="vditorI18nScript"+j.lang,document.querySelectorAll('head script[id^="vditorI18nScript"]').forEach(function(ue){ue.id!==ae&&document.head.removeChild(ue)}),[4,(0,N.G)(j.cdn+"/dist/js/i18n/"+j.lang+".js",ae)];case 3:ie.sent(),ie.label=4;case 4:return[3,6];case 5:window.VditorI18n=j.i18n,ie.label=6;case 6:return j.icon?[4,(0,N.G)(j.cdn+"/dist/js/icons/"+j.icon+".js","vditorIconScript")]:[3,8];case 7:ie.sent(),ie.label=8;case 8:return(0,W.Z)(j.theme.current,j.theme.path),j.anchor===1&&K.classList.add("vditor-reset--anchor"),(0,y.O)(K,j.hljs),(0,h.s)(j.hljs,K,j.cdn),(0,L.H)(K,{cdn:j.cdn,math:j.math}),(0,T.i)(K,j.cdn,j.mode),(0,w.K)(K,j.cdn,j.mode),(0,l.P)(K,j.cdn),(0,u.v)(K,j.cdn),(0,s.p)(K,j.cdn,j.mode),(0,k.P)(K,j.cdn,j.mode),(0,x.B)(K,j.cdn),(0,d.Q)(K,j.cdn),j.render.media.enable&&(0,S.Y)(K),j.speech.enable&&se(K),j.anchor!==0&&(Te=j.anchor,document.querySelectorAll(".vditor-anchor").forEach(function(ue){Te===1&&ue.classList.add("vditor-anchor--left"),ue.onclick=function(){var de=ue.getAttribute("href").substr(1),X=document.getElementById("vditorAnchor-"+de).offsetTop;document.querySelector("html").scrollTop=X}}),window.onhashchange=function(){var ue=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));ue&&(document.querySelector("html").scrollTop=ue.offsetTop)}),j.after&&j.after(),j.lazyLoadImage&&b(K),K.addEventListener("click",function(ue){var de=(0,Z.lG)(ue.target,"SPAN");if(de&&(0,Z.fb)(de,"vditor-toc")){var X=K.querySelector("#"+de.getAttribute("data-target-id"));X&&window.scrollTo(window.scrollX,X.offsetTop)}}),[2]}var Te})})},C=E(863),Oe=E(312);const st=function(){function K(){}return K.adapterRender=m,K.previewImage=C.E,K.codeRender=y.O,K.graphvizRender=u.v,K.highlightRender=h.s,K.mathRender=L.H,K.mermaidRender=T.i,K.markmapRender=w.K,K.flowchartRender=l.P,K.chartRender=s.p,K.abcRender=d.Q,K.mindmapRender=k.P,K.plantumlRender=x.B,K.outlineRender=p.k,K.mediaRender=S.Y,K.speechRender=se,K.lazyLoadImageRender=b,K.md2html=Be,K.preview=we,K.setCodeTheme=Oe.Y,K.setContentTheme=W.Z,K}()},54:(ee,A,E)=>{"use strict";E.d(A,{H:()=>d,g:()=>m});var d="3.10.4",m=function(){function s(){}return s.ZWSP="\u200B",s.DROP_EDITOR="application/editor",s.MOBILE_WIDTH=520,s.CLASS_MENU_DISABLED="vditor-menu--disabled",s.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],s.CODE_THEME=["abap","algol","algol_nu","arduino","autumn","borland","bw","colorful","dracula","emacs","friendly","fruity","github","igor","lovelace","manni","monokai","monokailight","murphy","native","paraiso-dark","paraiso-light","pastie","perldoc","pygments","rainbow_dash","rrt","solarized-dark","solarized-dark256","solarized-light","swapoff","tango","trac","vim","vs","xcode","ant-design"],s.CODE_LANGUAGES=["mermaid","echarts","mindmap","plantuml","abc","graphviz","flowchart","apache","js","ts","html","markmap","properties","apache","bash","c","csharp","cpp","css","coffeescript","diff","go","xml","http","json","java","javascript","kotlin","less","lua","makefile","markdown","nginx","objectivec","php","php-template","perl","plaintext","python","python-repl","r","ruby","rust","scss","sql","shell","swift","ini","typescript","vbnet","yaml","ada","clojure","dart","erb","fortran","gradle","haskell","julia","julia-repl","lisp","matlab","pgsql","powershell","sql_more","stata","cmake","mathematica","solidity","yul"],s.CDN="https://unpkg.com/vditor@3.10.4",s.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},s.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},s.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},s.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:s.CDN+"/dist/css/content-theme"},s}()},478:(ee,A,E)=>{"use strict";E.d(A,{Q:()=>y});var d=E(54),m=E(526),s=E(156),y=function(l,u){l===void 0&&(l=document),u===void 0&&(u=d.g.CDN);var h=s.abcRenderAdapter.getElements(l);h.length>0&&(0,m.G)(u+"/dist/js/abcjs/abcjs_basic.min.js","vditorAbcjsScript").then(function(){h.forEach(function(b){b.parentElement.classList.contains("vditor-wysiwyg__pre")||b.parentElement.classList.contains("vditor-ir__marker--pre")||b.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(b,s.abcRenderAdapter.getCode(b).trim()),b.style.overflowX="auto",b.setAttribute("data-processed","true"))})})}},156:(ee,A,E)=>{"use strict";E.r(A),E.d(A,{abcRenderAdapter:()=>u,chartRenderAdapter:()=>l,flowchartRenderAdapter:()=>b,graphvizRenderAdapter:()=>h,markmapRenderAdapter:()=>s,mathRenderAdapter:()=>d,mermaidRenderAdapter:()=>m,mindmapRenderAdapter:()=>y,plantumlRenderAdapter:()=>L});var d={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-math")}},m={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-mermaid")}},s={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-markmap")}},y={getCode:function(S){return S.getAttribute("data-code")},getElements:function(S){return S.querySelectorAll(".language-mindmap")}},l={getCode:function(S){return S.innerText},getElements:function(S){return S.querySelectorAll(".language-echarts")}},u={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-abc")}},h={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-graphviz")}},b={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-flowchart")}},L={getCode:function(S){return S.textContent},getElements:function(S){return S.querySelectorAll(".language-plantuml")}}},314:(ee,A,E)=>{"use strict";E.d(A,{p:()=>y});var d=E(54),m=E(526),s=E(156),y=function(l,u,h){l===void 0&&(l=document),u===void 0&&(u=d.g.CDN);var b=s.chartRenderAdapter.getElements(l);b.length>0&&(0,m.G)(u+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then(function(){b.forEach(function(L){if(!L.parentElement.classList.contains("vditor-wysiwyg__pre")&&!L.parentElement.classList.contains("vditor-ir__marker--pre")){var S=s.chartRenderAdapter.getCode(L).trim();if(S)try{if(L.getAttribute("data-processed")==="true")return;var T=JSON.parse(S);echarts.init(L,h==="dark"?"dark":void 0).setOption(T),L.setAttribute("data-processed","true")}catch(w){L.className="vditor-reset--error",L.innerHTML="echarts render error: <br>"+w}}})})}},730:(ee,A,E)=>{"use strict";E.d(A,{O:()=>s});var d=E(51),m=E(54),s=function(y,l){Array.from(y.querySelectorAll("pre > code")).filter(function(u,h){return!u.parentElement.classList.contains("vditor-wysiwyg__pre")&&!u.parentElement.classList.contains("vditor-ir__marker--pre")&&!(u.classList.contains("language-mermaid")||u.classList.contains("language-flowchart")||u.classList.contains("language-echarts")||u.classList.contains("language-mindmap")||u.classList.contains("language-plantuml")||u.classList.contains("language-markmap")||u.classList.contains("language-abc")||u.classList.contains("language-graphviz")||u.classList.contains("language-math"))&&!(u.style.maxHeight.indexOf("px")>-1)&&!(y.classList.contains("vditor-preview")&&h>5)}).forEach(function(u){var h,b,L,S=u.innerText;if(u.classList.contains("highlight-chroma")){var T=u.cloneNode(!0);T.querySelectorAll(".highlight-ln").forEach(function(x){x.remove()}),S=T.innerText}else S.endsWith(`
|
|
6
|
+
`)&&(S=S.substr(0,S.length-1));var w='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(w='<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>');var k=document.createElement("div");k.className="vditor-copy",k.innerHTML='<span aria-label="'+(((h=window.VditorI18n)===null||h===void 0?void 0:h.copy)||"\u590D\u5236")+`"
|
|
7
|
+
onmouseover="this.setAttribute('aria-label', '`+(((b=window.VditorI18n)===null||b===void 0?void 0:b.copy)||"\u590D\u5236")+`')"
|
|
8
|
+
class="vditor-tooltipped vditor-tooltipped__w"
|
|
9
|
+
onclick="this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`+(((L=window.VditorI18n)===null||L===void 0?void 0:L.copied)||"\u5DF2\u590D\u5236")+`');this.previousElementSibling.blur()">`+w+"</span>";var p=document.createElement("textarea");p.value=(0,d.X)(S),k.insertAdjacentElement("afterbegin",p),l&&l.renderMenu&&l.renderMenu(u,k),u.before(k),u.style.maxHeight=window.outerHeight-40+"px",u.insertAdjacentHTML("afterend",'<span style="position: absolute">'+m.g.ZWSP+"</span>")})}},66:(ee,A,E)=>{"use strict";E.d(A,{P:()=>y});var d=E(54),m=E(526),s=E(156),y=function(l,u){u===void 0&&(u=d.g.CDN);var h=s.flowchartRenderAdapter.getElements(l);h.length!==0&&(0,m.G)(u+"/dist/js/flowchart.js/flowchart.min.js","vditorFlowchartScript").then(function(){h.forEach(function(b){if(b.getAttribute("data-processed")!=="true"){var L=flowchart.parse(s.flowchartRenderAdapter.getCode(b));b.innerHTML="",L.drawSVG(b),b.setAttribute("data-processed","true")}})})}},218:(ee,A,E)=>{"use strict";E.d(A,{v:()=>y});var d=E(54),m=E(526),s=E(156),y=function(l,u){u===void 0&&(u=d.g.CDN);var h=s.graphvizRenderAdapter.getElements(l);h.length!==0&&(0,m.G)(u+"/dist/js/graphviz/viz.js","vditorGraphVizScript").then(function(){h.forEach(function(b){var L=s.graphvizRenderAdapter.getCode(b);if(!b.parentElement.classList.contains("vditor-wysiwyg__pre")&&!b.parentElement.classList.contains("vditor-ir__marker--pre")&&b.getAttribute("data-processed")!=="true"&&L.trim()!==""){try{var S=new Blob(["importScripts('"+document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js")+"');"],{type:"application/javascript"}),T=(window.URL||window.webkitURL).createObjectURL(S),w=new Worker(T);new Viz({worker:w}).renderSVGElement(L).then(function(k){b.innerHTML=k.outerHTML}).catch(function(k){b.innerHTML="graphviz render error: <br>"+k,b.className="vditor-reset--error"})}catch(k){console.error("graphviz error",k)}b.setAttribute("data-processed","true")}})})}},702:(ee,A,E)=>{"use strict";E.d(A,{s:()=>y});var d=E(54),m=E(526),s=E(578),y=function(l,u,h){u===void 0&&(u=document),h===void 0&&(h=d.g.CDN);var b=l.style;d.g.CODE_THEME.includes(b)||(b="github");var L=document.getElementById("vditorHljsStyle"),S=h+"/dist/js/highlight.js/styles/"+b+".css";L&&L.getAttribute("href")!==S&&L.remove(),(0,s.c)(h+"/dist/js/highlight.js/styles/"+b+".css","vditorHljsStyle"),l.enable!==!1&&u.querySelectorAll("pre > code").length!==0&&(0,m.G)(h+"/dist/js/highlight.js/highlight.pack.js","vditorHljsScript").then(function(){(0,m.G)(h+"/dist/js/highlight.js/solidity.min.js","vditorHljsSolidityScript").then(function(){(0,m.G)(h+"/dist/js/highlight.js/yul.min.js","vditorHljsYulScript").then(function(){u.querySelectorAll("pre > code").forEach(function(T){if(!T.parentElement.classList.contains("vditor-ir__marker--pre")&&!T.parentElement.classList.contains("vditor-wysiwyg__pre")&&!(T.classList.contains("language-mermaid")||T.classList.contains("language-flowchart")||T.classList.contains("language-echarts")||T.classList.contains("language-mindmap")||T.classList.contains("language-plantuml")||T.classList.contains("language-abc")||T.classList.contains("language-graphviz")||T.classList.contains("language-math"))&&(l.defaultLang!==""&&T.className.indexOf("language-")===-1&&T.classList.add("language-"+l.defaultLang),hljs.highlightElement(T),l.lineNumber)){T.classList.add("vditor-linenumber");var w=T.querySelector(".vditor-linenumber__temp");w||((w=document.createElement("div")).className="vditor-linenumber__temp",T.insertAdjacentElement("beforeend",w));var k=getComputedStyle(T).whiteSpace,p=!1;k!=="pre-wrap"&&k!=="pre-line"||(p=!0);var x="",I=T.textContent.split(/\r\n|\r|\n/g);I.pop(),I.map(function(W){var N="";p&&(w.textContent=W||`
|
|
10
|
+
`,N=' style="height:'+w.getBoundingClientRect().height+'px"'),x+="<span"+N+"></span>"}),w.style.display="none",x='<span class="vditor-linenumber__rows">'+x+"</span>",T.insertAdjacentHTML("beforeend",x)}})})})})}},563:(ee,A,E)=>{"use strict";E.d(A,{K:()=>u});var d=E(54),m=E(526),s=E(156),y={},l=function(h,b){var L=window.markmap,S=L.Transformer,T=L.Markmap,w=L.deriveOptions,k=(L.globalCSS,new S);h.innerHTML='<svg style="width:100%"></svg>';var p=h.firstChild,x=T.create(p,null),I=function(te,pe){var ce=te.transform(pe),se=Object.keys(ce.features).filter(function(we){return!y[we]});se.forEach(function(we){y[we]=!0});var fe=te.getAssets(se),Le=fe.styles,Ee=fe.scripts,Be=window.markmap;return Le&&Be.loadCSS(Le),Ee&&Be.loadJS(Ee),ce}(k,b),W=I.root,N=I.frontmatter,Z=w(N==null?void 0:N.markmap);x.setData(W,Z),x.fit()},u=function(h,b,L){b===void 0&&(b=d.g.CDN);var S=s.markmapRenderAdapter.getElements(h);S.length!==0&&(0,m.G)(b+"/dist/js/markmap/markmap.min.js","vditorMermaidScript").then(function(){S.forEach(function(T){var w=s.markmapRenderAdapter.getCode(T);if(T.getAttribute("data-processed")!=="true"&&w.trim()!==""){var k=document.createElement("div");k.className="language-markmap",T.parentNode.appendChild(k),l(k,w),T.parentNode.childNodes[0].nodeName=="CODE"&&T.parentNode.removeChild(T.parentNode.childNodes[0])}})})}},466:(ee,A,E)=>{"use strict";E.d(A,{H:()=>u});var d=E(54),m=E(526),s=E(578),y=E(51),l=E(156),u=function(h,b){var L=l.mathRenderAdapter.getElements(h);if(L.length!==0){var S={cdn:d.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(b&&b.math&&(b.math=Object.assign({},S.math,b.math)),(b=Object.assign({},S,b)).math.engine==="KaTeX")(0,s.c)(b.cdn+"/dist/js/katex/katex.min.css?v=0.16.9","vditorKatexStyle"),(0,m.G)(b.cdn+"/dist/js/katex/katex.min.js?v=0.16.9","vditorKatexScript").then(function(){(0,m.G)(b.cdn+"/dist/js/katex/mhchem.min.js?v=0.16.9","vditorKatexChemScript").then(function(){L.forEach(function(w){if(!w.parentElement.classList.contains("vditor-wysiwyg__pre")&&!w.parentElement.classList.contains("vditor-ir__marker--pre")&&!w.getAttribute("data-math")){var k=(0,y.X)(l.mathRenderAdapter.getCode(w));w.setAttribute("data-math",k);try{w.innerHTML=katex.renderToString(k,{displayMode:w.tagName==="DIV",output:"html",macros:b.math.macros})}catch(p){w.innerHTML=p.message,w.className="language-math vditor-reset--error"}w.addEventListener("copy",function(p){p.stopPropagation(),p.preventDefault();var x=p.currentTarget.closest(".language-math");p.clipboardData.setData("text/html",x.innerHTML),p.clipboardData.setData("text/plain",x.getAttribute("data-math"))})}})})});else if(b.math.engine==="MathJax"){window.MathJax||(window.MathJax={loader:{paths:{mathjax:b.cdn+"/dist/js/mathjax"}},startup:{typeset:!1},tex:{macros:b.math.macros}},Object.assign(window.MathJax,b.math.mathJaxOptions)),(0,m.J)(b.cdn+"/dist/js/mathjax/tex-svg-full.js","protyleMathJaxScript");var T=function(w,k){var p=(0,y.X)(w.textContent).trim(),x=window.MathJax.getMetricsFor(w);x.display=w.tagName==="DIV",window.MathJax.tex2svgPromise(p,x).then(function(I){w.innerHTML="",w.setAttribute("data-math",p),w.append(I),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var W=I.querySelector('[data-mml-node="merror"]');W&&W.textContent.trim()!==""&&(w.innerHTML=W.textContent.trim(),w.className="vditor-reset--error"),k&&k()})};window.MathJax.startup.promise.then(function(){for(var w=[],k=function(x){var I=L[x];I.parentElement.classList.contains("vditor-wysiwyg__pre")||I.parentElement.classList.contains("vditor-ir__marker--pre")||I.getAttribute("data-math")||!(0,y.X)(I.textContent).trim()||w.push(function(W){x===L.length-1?T(I):T(I,W)})},p=0;p<L.length;p++)k(p);(function(x){if(x.length!==0){var I=0,W=x[x.length-1],N=function(){var Z=x[I++];Z===W?Z():Z(N)};N()}})(w)})}}}},554:(ee,A,E)=>{"use strict";E.d(A,{Y:()=>m});var d=E(835),m=function(s){s&&s.querySelectorAll("a").forEach(function(y){var l=y.getAttribute("href");l&&(l.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?function(u,h){u.insertAdjacentHTML("afterend",'<video controls="controls" src="'+h+'"></video>'),u.remove()}(y,l):l.match(/^.+.(mp3|wav|flac)$/)?function(u,h){u.insertAdjacentHTML("afterend",'<audio controls="controls" src="'+h+'"></audio>'),u.remove()}(y,l):function(u,h){var b=h.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),L=h.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),S=h.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),T=h.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),w=h.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),k=h.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),p=h.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),x=h.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(b&&b[1].length===11)u.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'+b[1]+(b[2]?"?start="+b[2]:"")+'"></iframe>'),u.remove();else if(L&&L[1])u.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'+L[1]+'"></iframe>'),u.remove();else if(S&&S[1])u.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='+S[1]+'"></iframe>'),u.remove();else if(T&&T[1])u.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
11
|
+
src="//coub.com/embed/`+T[1]+'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>'),u.remove();else if(w&&w[0])u.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
12
|
+
src="https://www.facebook.com/plugins/video.php?href=`+encodeURIComponent(w[0])+'"></iframe>'),u.remove();else if(k&&k[2])u.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
13
|
+
src="https://www.dailymotion.com/embed/video/`+k[2]+'"></iframe>'),u.remove();else if(h.indexOf("bilibili.com")>-1&&(h.indexOf("bvid=")>-1||p&&p[1])){var I={bvid:(0,d.o)("bvid",h)||p&&p[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(h.startsWith("http")?h:"https:"+h).search.split("&").forEach(function(Z,te){if(Z){te===0&&(Z=Z.substr(1));var pe=Z.split("=");I[pe[0]]=pe[1]}});var W="https://player.bilibili.com/player.html?",N=Object.keys(I);N.forEach(function(Z,te){W+=Z+"="+I[Z],te<N.length-1&&(W+="&")}),u.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'+W+'"></iframe>'),u.remove()}else x&&x[1]&&(u.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'+x[1]+'"></iframe>'),u.remove())}(y,l))})}},40:(ee,A,E)=>{"use strict";E.d(A,{i:()=>h});var d=E(54),m=E(526),s=E(156),y=E(835),l=function(b,L,S,T){return new(S||(S=Promise))(function(w,k){function p(W){try{I(T.next(W))}catch(N){k(N)}}function x(W){try{I(T.throw(W))}catch(N){k(N)}}function I(W){var N;W.done?w(W.value):(N=W.value,N instanceof S?N:new S(function(Z){Z(N)})).then(p,x)}I((T=T.apply(b,L||[])).next())})},u=function(b,L){var S,T,w,k,p={label:0,sent:function(){if(1&w[0])throw w[1];return w[1]},trys:[],ops:[]};return k={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function x(I){return function(W){return function(N){if(S)throw new TypeError("Generator is already executing.");for(;p;)try{if(S=1,T&&(w=2&N[0]?T.return:N[0]?T.throw||((w=T.return)&&w.call(T),0):T.next)&&!(w=w.call(T,N[1])).done)return w;switch(T=0,w&&(N=[2&N[0],w.value]),N[0]){case 0:case 1:w=N;break;case 4:return p.label++,{value:N[1],done:!1};case 5:p.label++,T=N[1],N=[0];continue;case 7:N=p.ops.pop(),p.trys.pop();continue;default:if(w=p.trys,!((w=w.length>0&&w[w.length-1])||N[0]!==6&&N[0]!==2)){p=0;continue}if(N[0]===3&&(!w||N[1]>w[0]&&N[1]<w[3])){p.label=N[1];break}if(N[0]===6&&p.label<w[1]){p.label=w[1],w=N;break}if(w&&p.label<w[2]){p.label=w[2],p.ops.push(N);break}w[2]&&p.ops.pop(),p.trys.pop();continue}N=L.call(b,p)}catch(Z){N=[6,Z],T=0}finally{S=w=0}if(5&N[0])throw N[1];return{value:N[0]?N[1]:void 0,done:!0}}([I,W])}}},h=function(b,L,S){L===void 0&&(L=d.g.CDN);var T=s.mermaidRenderAdapter.getElements(b);T.length!==0&&(0,m.G)(L+"/dist/js/mermaid/mermaid.min.js","vditorMermaidScript").then(function(){var w={securityLevel:"loose",altFontFamily:"sans-serif",fontFamily:"sans-serif",startOnLoad:!1,flowchart:{htmlLabels:!0,useMaxWidth:!0},sequence:{useMaxWidth:!0,diagramMarginX:8,diagramMarginY:8,boxMargin:8,showSequenceNumbers:!0},gantt:{leftPadding:75,rightPadding:20}};S==="dark"&&(w.theme="dark"),mermaid.initialize(w),T.forEach(function(k){return l(void 0,void 0,void 0,function(){var p,x,I,W,N;return u(this,function(Z){switch(Z.label){case 0:if(p=s.mermaidRenderAdapter.getCode(k),k.getAttribute("data-processed")==="true"||p.trim()==="")return[2];x="mermaid"+(0,y.W)(),Z.label=1;case 1:return Z.trys.push([1,3,,4]),[4,mermaid.render(x,k.textContent)];case 2:return I=Z.sent(),k.innerHTML=I.svg,[3,4];case 3:return W=Z.sent(),N=document.querySelector("#"+x),k.innerHTML=N.outerHTML+`<br>
|
|
14
|
+
<div style="text-align: left"><small>`+W.message.replace(/\n/,"<br>")+"</small></div>",N.parentElement.remove(),[3,4];case 4:return k.setAttribute("data-processed","true"),[2]}})})})})}},749:(ee,A,E)=>{"use strict";E.d(A,{P:()=>y});var d=E(54),m=E(526),s=E(156),y=function(l,u,h){l===void 0&&(l=document),u===void 0&&(u=d.g.CDN);var b=s.mindmapRenderAdapter.getElements(l);b.length>0&&(0,m.G)(u+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then(function(){b.forEach(function(L){if(!L.parentElement.classList.contains("vditor-wysiwyg__pre")&&!L.parentElement.classList.contains("vditor-ir__marker--pre")){var S=s.mindmapRenderAdapter.getCode(L);if(S)try{if(L.getAttribute("data-processed")==="true")return;echarts.init(L,h==="dark"?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(S))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(T,w){var k;return!((k=w==null?void 0:w.data)===null||k===void 0)&&k.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),L.setAttribute("data-processed","true")}catch(T){L.className="vditor-reset--error",L.innerHTML="mindmap render error: <br>"+T}}})})}},818:(ee,A,E)=>{"use strict";E.d(A,{k:()=>s});var d=E(64),m=E(466),s=function(y,l,u){var h="",b=[];if(Array.from(y.children).forEach(function(w,k){if((0,d.W)(w)){if(u){var p=w.id.lastIndexOf("_");w.id=w.id.substring(0,p===-1?void 0:p)+"_"+k}b.push(w.id),h+=w.outerHTML.replace("<wbr>","")}}),h==="")return l.innerHTML="","";var L=document.createElement("div");if(u)u.lute.SetToC(!0),u.currentMode!=="wysiwyg"||u.preview.element.contains(y)?u.currentMode!=="ir"||u.preview.element.contains(y)?L.innerHTML=u.lute.HTML2VditorDOM("<p>[ToC]</p>"+h):L.innerHTML=u.lute.SpinVditorIRDOM("<p>[ToC]</p>"+h):L.innerHTML=u.lute.SpinVditorDOM("<p>[ToC]</p>"+h),u.lute.SetToC(u.options.preview.markdown.toc);else{l.classList.add("vditor-outline");var S=Lute.New();S.SetToC(!0),L.innerHTML=S.HTML2VditorDOM("<p>[ToC]</p>"+h)}var T=L.firstElementChild.querySelectorAll("li > span[data-target-id]");return T.forEach(function(w,k){if(w.nextElementSibling&&w.nextElementSibling.tagName==="UL"){var p="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(p='<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>'),w.innerHTML=p+"<span>"+w.innerHTML+"</span>"}else w.innerHTML="<svg></svg><span>"+w.innerHTML+"</span>";w.setAttribute("data-target-id",b[k])}),h=L.firstElementChild.innerHTML,T.length===0?(l.innerHTML="",h):(l.innerHTML=h,u&&(0,m.H)(l,{cdn:u.options.cdn,math:u.options.preview.math}),l.firstElementChild.addEventListener("click",function(w){for(var k=w.target;k&&!k.isEqualNode(l);){if(k.classList.contains("vditor-outline__action")){k.classList.contains("vditor-outline__action--close")?(k.classList.remove("vditor-outline__action--close"),k.parentElement.nextElementSibling.setAttribute("style","display:block")):(k.classList.add("vditor-outline__action--close"),k.parentElement.nextElementSibling.setAttribute("style","display:none")),w.preventDefault(),w.stopPropagation();break}if(k.getAttribute("data-target-id")){w.preventDefault(),w.stopPropagation();var p=document.getElementById(k.getAttribute("data-target-id"));if(!p)return;if(u)if(u.options.height==="auto"){var x=p.offsetTop+u.element.offsetTop;u.options.toolbarConfig.pin||(x+=u.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,x)}else u.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,u.element.offsetTop),u.preview.element.contains(y)?y.parentElement.scrollTop=p.offsetTop:y.scrollTop=p.offsetTop;else window.scrollTo(window.scrollX,p.offsetTop);break}k=k.parentElement}}),h)}},408:(ee,A,E)=>{"use strict";E.d(A,{B:()=>y});var d=E(54),m=E(526),s=E(156),y=function(l,u){l===void 0&&(l=document),u===void 0&&(u=d.g.CDN);var h=s.plantumlRenderAdapter.getElements(l);h.length!==0&&(0,m.G)(u+"/dist/js/plantuml/plantuml-encoder.min.js","vditorPlantumlScript").then(function(){h.forEach(function(b){if(!b.parentElement.classList.contains("vditor-wysiwyg__pre")&&!b.parentElement.classList.contains("vditor-ir__marker--pre")){var L=s.plantumlRenderAdapter.getCode(b).trim();if(L)try{b.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'+plantumlEncoder.encode(L)+'"/>'}catch(S){b.className="vditor-reset--error",b.innerHTML="plantuml render error: <br>"+S}}})})}},895:(ee,A,E)=>{"use strict";E.d(A,{X:()=>d});var d=function(m){var s=Lute.New();return s.PutEmojis(m.emojis),s.SetEmojiSite(m.emojiSite),s.SetHeadingAnchor(m.headingAnchor),s.SetInlineMathAllowDigitAfterOpenMarker(m.inlineMathDigit),s.SetAutoSpace(m.autoSpace),s.SetToC(m.toc),s.SetFootnotes(m.footnotes),s.SetFixTermTypo(m.fixTermTypo),s.SetVditorCodeBlockPreview(m.codeBlockPreview),s.SetVditorMathBlockPreview(m.mathBlockPreview),s.SetSanitize(m.sanitize),s.SetChineseParagraphBeginningSpace(m.paragraphBeginningSpace),s.SetRenderListStyle(m.listStyle),s.SetLinkBase(m.linkBase),s.SetLinkPrefix(m.linkPrefix),s.SetMark(m.mark),s.SetGFMAutoLink(m.gfmAutoLink),m.lazyLoadImage&&s.SetImageLazyLoading(m.lazyLoadImage),s}},863:(ee,A,E)=>{"use strict";E.d(A,{E:()=>d});var d=function(m,s,y){s===void 0&&(s="zh_CN"),y===void 0&&(y="classic");var l=m.getBoundingClientRect();document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'+(y==="dark"?" vditor--dark":"")+`">
|
|
15
|
+
<div class="vditor-img__bar">
|
|
16
|
+
<span class="vditor-img__btn" data-deg="0">
|
|
17
|
+
<svg><use xlink:href="#vditor-icon-redo"></use></svg>
|
|
18
|
+
`+window.VditorI18n.spin+`
|
|
19
|
+
</span>
|
|
20
|
+
<span class="vditor-img__btn" onclick="this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|
21
|
+
X `+window.VditorI18n.close+`
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="vditor-img__img" onclick="this.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|
25
|
+
<img style="width: `+m.width+"px;height:"+m.height+"px;transform: translate3d("+l.left+"px, "+(l.top-36)+'px, 0)" src="'+m.getAttribute("src")+`">
|
|
26
|
+
</div>
|
|
27
|
+
</div>`),document.body.style.overflow="hidden";var u=document.querySelector(".vditor-img img"),h="translate3d("+Math.max(0,window.innerWidth-m.naturalWidth)/2+"px, "+Math.max(0,window.innerHeight-36-m.naturalHeight)/2+"px, 0)";setTimeout(function(){u.setAttribute("style","transition: transform .3s ease-in-out;transform: "+h),setTimeout(function(){u.parentElement.scrollTo((u.parentElement.scrollWidth-u.parentElement.clientWidth)/2,(u.parentElement.scrollHeight-u.parentElement.clientHeight)/2)},400)});var b=document.querySelector(".vditor-img__btn");b.addEventListener("click",function(){var L=parseInt(b.getAttribute("data-deg"),10)+90;L/90%2==1&&m.naturalWidth>u.parentElement.clientHeight?u.style.transform="translate3d("+Math.max(0,window.innerWidth-m.naturalWidth)/2+"px, "+(m.naturalWidth/2-m.naturalHeight/2)+"px, 0) rotateZ("+L+"deg)":u.style.transform=h+" rotateZ("+L+"deg)",b.setAttribute("data-deg",L.toString()),setTimeout(function(){u.parentElement.scrollTo((u.parentElement.scrollWidth-u.parentElement.clientWidth)/2,(u.parentElement.scrollHeight-u.parentElement.clientHeight)/2)},400)})}},312:(ee,A,E)=>{"use strict";E.d(A,{Y:()=>s});var d=E(54),m=E(578),s=function(y,l){l===void 0&&(l=d.g.CDN),d.g.CODE_THEME.includes(y)||(y="github");var u=document.getElementById("vditorHljsStyle"),h=l+"/dist/js/highlight.js/styles/"+y+".css";u?u.getAttribute("href")!==h&&(u.remove(),(0,m.c)(h,"vditorHljsStyle")):(0,m.c)(h,"vditorHljsStyle")}},227:(ee,A,E)=>{"use strict";E.d(A,{Z:()=>m});var d=E(578),m=function(s,y){if(s&&y){var l=document.getElementById("vditorContentTheme"),u=y+"/"+s+".css";l?l.getAttribute("href")!==u&&(l.remove(),(0,d.c)(u,"vditorContentTheme")):(0,d.c)(u,"vditorContentTheme")}}},526:(ee,A,E)=>{"use strict";E.d(A,{G:()=>m,J:()=>d});var d=function(s,y){if(document.getElementById(y))return!1;var l=new XMLHttpRequest;l.open("GET",s,!1),l.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),l.send("");var u=document.createElement("script");u.type="text/javascript",u.text=l.responseText,u.id=y,document.head.appendChild(u)},m=function(s,y){return new Promise(function(l,u){if(document.getElementById(y))return l(),!1;var h=document.createElement("script");h.src=s,h.async=!0,document.head.appendChild(h),h.onerror=function(b){u(b)},h.onload=function(){if(document.getElementById(y))return h.remove(),l(),!1;h.id=y,l()}})}},578:(ee,A,E)=>{"use strict";E.d(A,{c:()=>d});var d=function(m,s){if(!document.getElementById(s)){var y=document.createElement("link");y.id=s,y.rel="stylesheet",y.type="text/css",y.href=m,document.getElementsByTagName("head")[0].appendChild(y)}}},51:(ee,A,E)=>{"use strict";E.d(A,{X:()=>d});var d=function(m){return m.replace(/\u00a0/g," ")}},794:(ee,A,E)=>{"use strict";E.d(A,{G6:()=>d,Le:()=>y,i7:()=>h,ns:()=>u,pK:()=>s,vU:()=>m,yl:()=>l});var d=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},m=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},s=function(){try{return typeof localStorage<"u"}catch{return!1}},y=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},l=function(b){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!(!b.metaKey||b.ctrlKey):!(b.metaKey||!b.ctrlKey)},u=function(b){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?b.indexOf("\u21E7")>-1&&m()&&(b=b.replace(";",":").replace("=","+").replace("-","_")):(b=(b=b.startsWith("\u2318")?b.replace("\u2318","\u2318+"):b.startsWith("\u2325")&&b.substr(1,1)!=="\u2318"?b.replace("\u2325","\u2325+"):b.replace("\u21E7\u2318","\u2318+\u21E7+").replace("\u2325\u2318","\u2325+\u2318+")).replace("\u2318","Ctrl").replace("\u21E7","Shift").replace("\u2325","Alt")).indexOf("Shift")>-1&&(b=b.replace(";",":").replace("=","+").replace("-","_")),b},h=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}},835:(ee,A,E)=>{"use strict";E.d(A,{W:()=>d,o:()=>m});var d=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(s){return(parseInt(s,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(s,10)/4).toString(16)})},m=function(s,y){y===void 0&&(y=window.location.search);var l=y.substring(y.indexOf("?")),u=l.indexOf("#");return new URLSearchParams(l.substring(0,u>=0?u:void 0)).get(s)}},827:(ee,A,E)=>{"use strict";E.d(A,{DX:()=>L,E2:()=>s,F9:()=>u,JQ:()=>m,O9:()=>y,a1:()=>l,fb:()=>b,lG:()=>h});var d=E(64),m=function(S,T){for(var w=b(S,T),k=!1,p=!1;w&&!w.classList.contains("vditor-reset")&&!p;)(k=b(w.parentElement,T))?w=k:p=!0;return w||!1},s=function(S,T){for(var w=(0,d.S)(S,T),k=!1,p=!1;w&&!w.classList.contains("vditor-reset")&&!p;)(k=(0,d.S)(w.parentElement,T))?w=k:p=!0;return w||!1},y=function(S){var T=s(S,"UL"),w=s(S,"OL"),k=T;return w&&(!T||T&&w.contains(T))&&(k=w),k},l=function(S,T,w){if(!S)return!1;S.nodeType===3&&(S=S.parentElement);for(var k=S,p=!1;k&&!p&&!k.classList.contains("vditor-reset");)k.getAttribute(T)===w?p=!0:k=k.parentElement;return p&&k},u=function(S){if(!S)return!1;S.nodeType===3&&(S=S.parentElement);var T=S,w=!1,k=l(S,"data-block","0");if(k)return k;for(;T&&!w&&!T.classList.contains("vditor-reset");)T.tagName==="H1"||T.tagName==="H2"||T.tagName==="H3"||T.tagName==="H4"||T.tagName==="H5"||T.tagName==="H6"||T.tagName==="P"||T.tagName==="BLOCKQUOTE"||T.tagName==="OL"||T.tagName==="UL"?w=!0:T=T.parentElement;return w&&T},h=function(S,T){if(!S)return!1;S.nodeType===3&&(S=S.parentElement);for(var w=S,k=!1;w&&!k&&!w.classList.contains("vditor-reset");)w.nodeName===T?k=!0:w=w.parentElement;return k&&w},b=function(S,T){if(!S)return!1;S.nodeType===3&&(S=S.parentElement);for(var w=S,k=!1;w&&!k&&!w.classList.contains("vditor-reset");)w.classList.contains(T)?k=!0:w=w.parentElement;return k&&w},L=function(S){for(;S&&S.lastChild;)S=S.lastChild;return S}},64:(ee,A,E)=>{"use strict";E.d(A,{S:()=>d,W:()=>m});var d=function(s,y){if(!s)return!1;s.nodeType===3&&(s=s.parentElement);for(var l=s,u=!1;l&&!u&&!l.classList.contains("vditor-reset");)l.nodeName.indexOf(y)===0?u=!0:l=l.parentElement;return u&&l},m=function(s){var y=d(s,"H");return!(!y||y.tagName.length!==2||y.tagName==="HR")&&y}},640:(ee,A,E)=>{"use strict";E.d(A,{T:()=>d});var d=function(){for(var m=[],s=0;s<arguments.length;s++)m[s]=arguments[s];for(var y={},l=function(h){for(var b in h)h.hasOwnProperty(b)&&(Object.prototype.toString.call(h[b])==="[object Object]"?y[b]=d(y[b],h[b]):y[b]=h[b])},u=0;u<m.length;u++)l(m[u]);return y}},393:(ee,A,E)=>{"use strict";E.d(A,{$j:()=>L,Gb:()=>u,Hc:()=>h,Ny:()=>l,ib:()=>S,im:()=>b,oC:()=>T,zh:()=>y});var d=E(54),m=E(794),s=E(827),y=function(w){var k,p=w[w.currentMode].element;return getSelection().rangeCount>0&&(k=getSelection().getRangeAt(0),p.isEqualNode(k.startContainer)||p.contains(k.startContainer))?k:w[w.currentMode].range?w[w.currentMode].range:(p.focus(),(k=p.ownerDocument.createRange()).setStart(p,0),k.collapse(!0),k)},l=function(w){var k=window.getSelection().getRangeAt(0);if(!w.contains(k.startContainer)&&!(0,s.fb)(k.startContainer,"vditor-panel--none"))return{left:0,top:0};var p,x=w.parentElement.getBoundingClientRect();if(k.getClientRects().length===0)if(k.startContainer.nodeType===3){var I=k.startContainer.parentElement;if(!(I&&I.getClientRects().length>0))return{left:0,top:0};p=I.getClientRects()[0]}else{var W=k.startContainer.children;if(W[k.startOffset]&&W[k.startOffset].getClientRects().length>0)p=W[k.startOffset].getClientRects()[0];else if(k.startContainer.childNodes.length>0){var N=k.cloneRange();k.selectNode(k.startContainer.childNodes[Math.max(0,k.startOffset-1)]),p=k.getClientRects()[0],k.setEnd(N.endContainer,N.endOffset),k.setStart(N.startContainer,N.startOffset)}else p=k.startContainer.getClientRects()[0];if(!p){for(var Z=k.startContainer.childNodes[k.startOffset];!Z.getClientRects||Z.getClientRects&&Z.getClientRects().length===0;)Z=Z.parentElement;p=Z.getClientRects()[0]}}else p=k.getClientRects()[0];return{left:p.left-x.left,top:p.top-x.top}},u=function(w,k){if(!k){if(getSelection().rangeCount===0)return!1;k=getSelection().getRangeAt(0)}var p=k.commonAncestorContainer;return w.isEqualNode(p)||w.contains(p)},h=function(w){var k=window.getSelection();k.removeAllRanges(),k.addRange(w)},b=function(w,k,p){var x={end:0,start:0};if(!p){if(getSelection().rangeCount===0)return x;p=window.getSelection().getRangeAt(0)}if(u(k,p)){var I=p.cloneRange();w.childNodes[0]&&w.childNodes[0].childNodes[0]?I.setStart(w.childNodes[0].childNodes[0],0):I.selectNodeContents(w),I.setEnd(p.startContainer,p.startOffset),x.start=I.toString().length,x.end=x.start+p.toString().length}return x},L=function(w,k,p){var x=0,I=0,W=p.childNodes[I],N=!1,Z=!1;w=Math.max(0,w),k=Math.max(0,k);var te=p.ownerDocument.createRange();for(te.setStart(W||p,0),te.collapse(!0);!Z&&W;){var pe=x+W.textContent.length;if(!N&&w>=x&&w<=pe&&(w===0?te.setStart(W,0):W.childNodes[0].nodeType===3?te.setStart(W.childNodes[0],w-x):W.nextSibling?te.setStartBefore(W.nextSibling):te.setStartAfter(W),N=!0,w===k)){Z=!0;break}N&&k>=x&&k<=pe&&(k===0?te.setEnd(W,0):W.childNodes[0].nodeType===3?te.setEnd(W.childNodes[0],k-x):W.nextSibling?te.setEndBefore(W.nextSibling):te.setEndAfter(W),Z=!0),x=pe,W=p.childNodes[++I]}return!Z&&p.childNodes[I-1]&&te.setStartBefore(p.childNodes[I-1]),h(te),te},S=function(w,k){var p=w.querySelector("wbr");if(p){if(p.previousElementSibling)if(p.previousElementSibling.isSameNode(p.previousSibling)){if(p.previousElementSibling.lastChild)return k.setStartBefore(p),k.collapse(!0),h(k),!(0,m.i7)()||p.previousElementSibling.tagName!=="EM"&&p.previousElementSibling.tagName!=="STRONG"&&p.previousElementSibling.tagName!=="S"||(k.insertNode(document.createTextNode(d.g.ZWSP)),k.collapse(!1)),void p.remove();k.setStartAfter(p.previousElementSibling)}else k.setStart(p.previousSibling,p.previousSibling.textContent.length);else p.previousSibling?k.setStart(p.previousSibling,p.previousSibling.textContent.length):p.nextSibling?p.nextSibling.nodeType===3?k.setStart(p.nextSibling,0):k.setStartBefore(p.nextSibling):k.setStart(p.parentElement,0);k.collapse(!0),p.remove(),h(k)}},T=function(w,k){var p=document.createElement("div");p.innerHTML=w;var x=p.querySelectorAll("p");x.length===1&&!x[0].previousSibling&&!x[0].nextSibling&&k[k.currentMode].element.children.length>0&&p.firstElementChild.tagName==="P"&&(w=x[0].innerHTML.trim());var I=document.createElement("div");I.innerHTML=w;var W=y(k);if(W.toString()!==""&&(k[k.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),I.firstElementChild&&I.firstElementChild.getAttribute("data-block")==="0"){I.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var N=(0,s.F9)(W.startContainer);N?N.insertAdjacentHTML("afterend",I.innerHTML):k[k.currentMode].element.insertAdjacentHTML("beforeend",I.innerHTML),S(k[k.currentMode].element,W)}else{var Z=document.createElement("template");Z.innerHTML=w,W.insertNode(Z.content.cloneNode(!0)),W.collapse(!1),h(W)}}}},lt={};function le(ee){var A=lt[ee];if(A!==void 0)return A.exports;var E=lt[ee]={exports:{}};return Rt[ee](E,E.exports,le),E.exports}le.d=(ee,A)=>{for(var E in A)le.o(A,E)&&!le.o(ee,E)&&Object.defineProperty(ee,E,{enumerable:!0,get:A[E]})},le.o=(ee,A)=>Object.prototype.hasOwnProperty.call(ee,A),le.r=ee=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(ee,"__esModule",{value:!0})};var bt={};return(()=>{"use strict";le.d(bt,{default:()=>Yr});var ee,A=le(872),E=le(54),d=le(51),m=function(e){return e.currentMode==="sv"?(0,d.X)((e.sv.element.textContent+`
|
|
28
|
+
`).replace(/\n\n$/,`
|
|
29
|
+
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},s=le(526),y=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-devtools",this.element.innerHTML='<div class="vditor-reset--error"></div><div style="height: 100%;"></div>'}return e.prototype.renderEchart=function(t){var n=this;t.devtools.element.style.display==="block"&&(0,s.G)(t.options.cdn+"/dist/js/echarts/echarts.min.js","vditorEchartsScript").then(function(){n.ASTChart||(n.ASTChart=echarts.init(t.devtools.element.lastElementChild));try{n.element.lastElementChild.style.display="block",n.element.firstElementChild.innerHTML="",n.ASTChart.setOption({series:[{data:JSON.parse(t.lute.RenderEChartsJSON(m(t))),initialTreeDepth:-1,label:{align:"left",backgroundColor:"rgba(68, 77, 86, .68)",borderRadius:3,color:"#d1d5da",fontSize:12,lineHeight:12,offset:[9,12],padding:[2,4,2,4],position:"top",verticalAlign:"middle"},lineStyle:{color:"#4285f4",type:"curve",width:1},orient:"vertical",roam:!0,type:"tree"}],toolbox:{bottom:25,emphasis:{iconStyle:{color:"#4285f4"}},feature:{restore:{show:!0},saveAsImage:{show:!0}},right:15,show:!0}}),n.ASTChart.resize()}catch(i){n.element.lastElementChild.style.display="none",n.element.firstElementChild.innerHTML=i}})},e}(),l=le(794),u=function(e,t){t.forEach(function(n){if(e[n]){var i=e[n].children[0];i&&i.classList.contains("vditor-menu--current")&&i.classList.remove("vditor-menu--current")}})},h=function(e,t){t.forEach(function(n){if(e[n]){var i=e[n].children[0];i&&!i.classList.contains("vditor-menu--current")&&i.classList.add("vditor-menu--current")}})},b=function(e,t){t.forEach(function(n){if(e[n]){var i=e[n].children[0];i&&i.classList.contains(E.g.CLASS_MENU_DISABLED)&&i.classList.remove(E.g.CLASS_MENU_DISABLED)}})},L=function(e,t){t.forEach(function(n){if(e[n]){var i=e[n].children[0];i&&!i.classList.contains(E.g.CLASS_MENU_DISABLED)&&i.classList.add(E.g.CLASS_MENU_DISABLED)}})},S=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},T=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},w=function(e,t,n){t.includes("subToolbar")&&(e.toolbar.element.querySelectorAll(".vditor-hint").forEach(function(i){n&&i.isEqualNode(n)||(i.style.display="none")}),e.toolbar.elements.emoji&&(e.toolbar.elements.emoji.lastElementChild.style.display="none")),t.includes("hint")&&(e.hint.element.style.display="none"),e.wysiwyg.popover&&t.includes("popover")&&(e.wysiwyg.popover.style.display="none")},k=function(e,t,n,i){n.addEventListener((0,l.Le)(),function(r){r.preventDefault(),r.stopPropagation(),n.classList.contains(E.g.CLASS_MENU_DISABLED)||(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach(function(o){o.classList.remove("vditor-hint--current")}),t.style.display==="block"?t.style.display="none":(w(e,["subToolbar","hint","popover"],n.parentElement.parentElement),n.classList.contains("vditor-tooltipped")||n.classList.add("vditor-hint--current"),t.style.display="block",e.toolbar.element.getBoundingClientRect().right-n.getBoundingClientRect().right<250?t.classList.add("vditor-panel--left"):t.classList.remove("vditor-panel--left")))})},p=le(827),x=le(64),I=function(e,t,n,i){i&&console.log(e+" - "+n+": "+t)},W=le(478),N=le(314),Z=le(730),te=le(66),pe=le(218),ce=le(702),se=le(466),fe=le(40),Le=le(563),Ee=le(749),Be=le(408),we=function(e,t){if(e)if(e.parentElement.getAttribute("data-type")!=="html-block"){var n=e.firstElementChild.className.replace("language-","");n==="abc"?(0,W.Q)(e,t.options.cdn):n==="mermaid"?(0,fe.i)(e,t.options.cdn,t.options.theme):n==="markmap"?(0,Le.K)(e,t.options.cdn,t.options.theme):n==="flowchart"?(0,te.P)(e,t.options.cdn):n==="echarts"?(0,N.p)(e,t.options.cdn,t.options.theme):n==="mindmap"?(0,Ee.P)(e,t.options.cdn,t.options.theme):n==="plantuml"?(0,Be.B)(e,t.options.cdn):n==="graphviz"?(0,pe.v)(e,t.options.cdn):n==="math"?(0,se.H)(e,{cdn:t.options.cdn,math:t.options.preview.math}):t.options.customRenders.find(function(i){if(i.language===n)return i.render(e,t),!0})||((0,ce.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,Z.O)(e,t.options.preview.hljs)),e.setAttribute("data-render","1")}else e.setAttribute("data-render","1")},C=le(393),Oe=function(e){if(e.currentMode!=="sv"){var t=e[e.currentMode].element,n=e.outline.render(e);n===""&&(n="[ToC]"),t.querySelectorAll('[data-type="toc-block"]').forEach(function(i){i.innerHTML=n,(0,se.H)(i,{cdn:e.options.cdn,math:e.options.preview.math})})}},st=function(e,t){var n=(0,p.lG)(e.target,"SPAN");if(n&&(0,p.fb)(n,"vditor-toc")){var i=t[t.currentMode].element.querySelector("#"+n.getAttribute("data-target-id"));if(i)if(t.options.height==="auto"){var r=i.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(r+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,r)}else t.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,t.element.offsetTop),t[t.currentMode].element.scrollTop=i.offsetTop}},K=function(e,t,n,i){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,C.im)(e,t[t.currentMode].element,i).start===0)return e.previousElementSibling.remove(),oe(t),!0;if(Je(t,n,i,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,C.im)(e,t[t.currentMode].element,i).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),oe(t),!0;if(it(t,n,i,e,e.nextElementSibling))return!0}if(n.key==="Backspace"||n.key==="Delete"){var r=(0,p.fb)(i.startContainer,"vditor-toc");if(r)return r.remove(),oe(t),!0}},me=function(e,t,n,i){n===void 0&&(n=!1);var r=(0,p.F9)(t.startContainer);if(r&&!n&&r.getAttribute("data-type")!=="code-block"){if(Ht(r.innerHTML)&&r.previousElementSibling||Nt(r.innerHTML))return;for(var o=(0,C.im)(r,e.ir.element,t).start,a=!0,c=o-1;c>r.textContent.substr(0,o).lastIndexOf(`
|
|
30
|
+
`);c--)if(r.textContent.charAt(c)!==" "&&r.textContent.charAt(c)!==" "){a=!1;break}o===0&&(a=!1);var v=!0;for(c=o-1;c<r.textContent.length;c++)if(r.textContent.charAt(c)!==" "&&r.textContent.charAt(c)!==`
|
|
31
|
+
`){v=!1;break}if(a)return void(typeof e.options.input=="function"&&e.options.input(m(e)));if(v&&!(0,p.fb)(t.startContainer,"vditor-ir__marker")){var g=t.startContainer.previousSibling;return g&&g.nodeType!==3&&g.classList.contains("vditor-ir__node--expand")&&g.classList.remove("vditor-ir__node--expand"),void(typeof e.options.input=="function"&&e.options.input(m(e)))}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(G){G.classList.remove("vditor-ir__node--expand")}),r||(r=e.ir.element),!r.querySelector("wbr")){var f=(0,p.fb)(t.startContainer,"vditor-ir__preview");f?f.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}r.querySelectorAll("[style]").forEach(function(G){G.removeAttribute("style")}),r.getAttribute("data-type")==="link-ref-defs-block"&&(r=e.ir.element);var _,O=r.isEqualNode(e.ir.element),U=(0,p.a1)(r,"data-type","footnotes-block"),M="";if(O)M=r.innerHTML;else{var R=(0,x.S)(t.startContainer,"BLOCKQUOTE"),q=(0,p.O9)(t.startContainer);if(q&&(r=q),R&&(!q||q&&!R.contains(q))&&(r=R),U&&(r=U),M=r.outerHTML,r.tagName==="UL"||r.tagName==="OL"){var D=r.previousElementSibling,B=r.nextElementSibling;!D||D.tagName!=="UL"&&D.tagName!=="OL"||(M=D.outerHTML+M,D.remove()),!B||B.tagName!=="UL"&&B.tagName!=="OL"||(M+=B.outerHTML,B.remove()),M=M.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else r.previousElementSibling&&r.previousElementSibling.textContent.replace(E.g.ZWSP,"")!==""&&i&&i.inputType==="insertParagraph"&&(M=r.previousElementSibling.outerHTML+M,r.previousElementSibling.remove());r.innerText.startsWith("```")||(e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(G){G&&!r.isEqualNode(G)&&(M+=G.outerHTML,G.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(G){G&&!r.isEqualNode(G)&&(M+=G.outerHTML,G.remove())}))}if(I("SpinVditorIRDOM",M,"argument",e.options.debugger),M=e.lute.SpinVditorIRDOM(M),I("SpinVditorIRDOM",M,"result",e.options.debugger),O)r.innerHTML=M;else if(r.outerHTML=M,U){var P=(0,p.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(P){var H=P.textContent,F=H.substring(1,H.indexOf("]:")),$=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+F+'"]');$&&$.setAttribute("aria-label",H.substr(F.length+3).trim().substr(0,24))}}var J,Q=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");Q.forEach(function(G,ne){ne===0?_=G:(_.insertAdjacentHTML("beforeend",G.innerHTML),G.remove())}),Q.length>0&&e.ir.element.insertAdjacentElement("beforeend",Q[0]);var Y=e.ir.element.querySelectorAll("[data-type='footnotes-block']");Y.forEach(function(G,ne){ne===0?J=G:(J.insertAdjacentHTML("beforeend",G.innerHTML),G.remove())}),Y.length>0&&e.ir.element.insertAdjacentElement("beforeend",Y[0]),(0,C.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(G){we(G,e)}),Oe(e),Re(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},V=function(e,t){if(e==="")return!1;if(e.indexOf("\u21E7")===-1&&e.indexOf("\u2318")===-1&&e.indexOf("\u2325")===-1)return!((0,l.yl)(t)||t.altKey||t.shiftKey||t.code!==e);if(e==="\u21E7Tab")return!((0,l.yl)(t)||t.altKey||!t.shiftKey||t.code!=="Tab");var n=e.split("");if(e.startsWith("\u2325")){var i=n.length===3?n[2]:n[1];return!((n.length===3?!(0,l.yl)(t):(0,l.yl)(t))||!t.altKey||t.shiftKey||t.code!==(/^[0-9]$/.test(i)?"Digit":"Key")+i)}e==="\u2318Enter"&&(n=["\u2318","Enter"]);var r=n.length>2&&n[0]==="\u21E7",o=r?n[2]:n[1];return!r||!(0,l.vU)()&&/Mac/.test(navigator.platform)||(o==="-"?o="_":o==="="&&(o="+")),!(!(0,l.yl)(t)||t.key.toLowerCase()!==o.toLowerCase()||t.altKey||!(!r&&!t.shiftKey||r&&t.shiftKey))},j=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(a){a.classList.remove("vditor-ir__node--expand")});var n=(0,p.JQ)(e.startContainer,"vditor-ir__node"),i=!e.collapsed&&(0,p.JQ)(e.endContainer,"vditor-ir__node");if(e.collapsed||n&&n===i){n&&(n.classList.add("vditor-ir__node--expand"),n.classList.remove("vditor-ir__node--hidden"),(0,C.Hc)(e));var r=function(a){var c=a.startContainer;if(c.nodeType===3&&c.nodeValue.length!==a.startOffset)return!1;for(var v=c.nextSibling;v&&v.textContent==="";)v=v.nextSibling;if(!v){var g=(0,p.fb)(c,"vditor-ir__marker");if(g&&!g.nextSibling){var f=c.parentElement.parentElement.nextSibling;if(f&&f.nodeType!==3&&f.classList.contains("vditor-ir__node"))return f}return!1}return!(!v||v.nodeType===3||!v.classList.contains("vditor-ir__node")||v.getAttribute("data-block"))&&v}(e);if(r)return r.classList.add("vditor-ir__node--expand"),void r.classList.remove("vditor-ir__node--hidden");var o=function(a){var c=a.startContainer,v=c.previousSibling;return!(c.nodeType!==3||a.startOffset!==0||!v||v.nodeType===3||!v.classList.contains("vditor-ir__node")||v.getAttribute("data-block"))&&v}(e);return o?(o.classList.add("vditor-ir__node--expand"),void o.classList.remove("vditor-ir__node--hidden")):void 0}},re=le(863),ae=function(e,t){e.querySelectorAll("[data-type=footnotes-link]").forEach(function(n){for(var i=n.parentElement,r=i.nextSibling;r&&r.textContent.startsWith(" ");){var o=r;o.childNodes.forEach(function(a){i.append(a.cloneNode(!0))}),r=r.nextSibling,o.remove()}t&&t(i)})},ie=function(e,t){var n,i=getSelection().getRangeAt(0).cloneRange(),r=i.startContainer;i.startContainer.nodeType!==3&&i.startContainer.tagName==="DIV"&&(r=i.startContainer.childNodes[i.startOffset-1]);var o=(0,p.a1)(r,"data-block","0");if(o&&t&&(t.inputType==="deleteContentBackward"||t.data===" ")){for(var a=(0,C.im)(o,e.sv.element,i).start,c=!0,v=a-1;v>o.textContent.substr(0,a).lastIndexOf(`
|
|
32
|
+
`);v--)if(o.textContent.charAt(v)!==" "&&o.textContent.charAt(v)!==" "){c=!1;break}if(a===0&&(c=!1),c)return void Me(e);if(t.inputType==="deleteContentBackward"){var g=(0,p.a1)(r,"data-type","code-block-open-marker")||(0,p.a1)(r,"data-type","code-block-close-marker");if(g){var f;if(g.getAttribute("data-type")==="code-block-close-marker"&&(f=dt(r,"code-block-open-marker"))||g.getAttribute("data-type")==="code-block-open-marker"&&(f=dt(r,"code-block-close-marker",!1)))return f.textContent=g.textContent,void Me(e)}var _=(0,p.a1)(r,"data-type","math-block-open-marker");if(_){var O=_.nextElementSibling.nextElementSibling;return void(O&&O.getAttribute("data-type")==="math-block-close-marker"&&(O.remove(),Me(e)))}o.querySelectorAll('[data-type="code-block-open-marker"]').forEach(function(D){D.textContent.length===1&&D.remove()}),o.querySelectorAll('[data-type="code-block-close-marker"]').forEach(function(D){D.textContent.length===1&&D.remove()});var U=(0,p.a1)(r,"data-type","heading-marker");if(U&&U.textContent.indexOf("#")===-1)return void Me(e)}if((t.data===" "||t.inputType==="deleteContentBackward")&&((0,p.a1)(r,"data-type","padding")||(0,p.a1)(r,"data-type","li-marker")||(0,p.a1)(r,"data-type","task-marker")||(0,p.a1)(r,"data-type","blockquote-marker")))return void Me(e)}if(o&&o.textContent.trimRight()==="$$")Me(e);else{o||(o=e.sv.element),((n=o.firstElementChild)===null||n===void 0?void 0:n.getAttribute("data-type"))==="link-ref-defs-block"&&(o=e.sv.element),(0,p.a1)(r,"data-type","footnotes-link")&&(o=e.sv.element),o.textContent.indexOf(Lute.Caret)===-1&&i.insertNode(document.createTextNode(Lute.Caret)),o.querySelectorAll("[style]").forEach(function(D){D.removeAttribute("style")}),o.querySelectorAll("font").forEach(function(D){D.outerHTML=D.innerHTML});var M=o.textContent,R=o.isEqualNode(e.sv.element);if(R)M=o.textContent;else{o.previousElementSibling&&(M=o.previousElementSibling.textContent+M,o.previousElementSibling.remove()),o.previousElementSibling&&M.indexOf(`---
|
|
33
|
+
`)===0&&(M=o.previousElementSibling.textContent+M,o.previousElementSibling.remove());var q="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(D,B){D&&!o.isEqualNode(D.parentElement)&&(q+=D.parentElement.textContent+`
|
|
34
|
+
`,D.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(D,B){D&&!o.isEqualNode(D.parentElement)&&(q+=D.parentElement.textContent+`
|
|
35
|
+
`,D.parentElement.remove())}),M=q+M}M=Gt(M,e),R?o.innerHTML=M:o.outerHTML=M,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(D){e.sv.element.insertAdjacentElement("beforeend",D.parentElement)}),ae(e.sv.element,function(D){e.sv.element.insertAdjacentElement("beforeend",D)}),(0,C.ib)(e.sv.element,i),ke(e),Me(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})}},Te=le(227),ue=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},de=function(e){var t=window.innerWidth<=E.g.MOBILE_WIDTH?10:35;if(e.wysiwyg.element.parentElement.style.display!=="none"){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px "+Math.max(t,n)+"px"}e.ir.element.parentElement.style.display!=="none"&&(n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2,e.ir.element.style.padding="10px "+Math.max(t,n)+"px"),e.preview.element.style.display!=="block"?e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0))+"px":e.toolbar.element.style.paddingLeft=5+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0)+"px"},X=function(e){if(e.options.typewriterMode){var t=window.innerHeight;typeof e.options.height=="number"?(t=e.options.height,typeof e.options.minHeight=="number"&&(t=Math.max(t,e.options.minHeight)),t=Math.min(window.innerHeight,t)):t=e.element.clientHeight,e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}};function je(){window.removeEventListener("resize",ee)}var Ue,Pt,Cn=function(e){X(e),je(),window.addEventListener("resize",ee=function(){de(e),X(e)});var t=(0,l.pK)()&&localStorage.getItem(e.options.cache.id);return e.options.cache.enable&&t||(e.options.value?t=e.options.value:e.originalInnerHTML?t=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(t="")),t||""},et=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,C.Gb)(e[e.currentMode].element)){u(e.toolbar.elements,E.g.EDIT_TOOLBARS),b(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=(0,C.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]),(e.currentMode==="sv"?(0,p.a1)(n,"data-type","heading"):(0,x.W)(n))&&h(e.toolbar.elements,["headings"]),(e.currentMode==="sv"?(0,p.a1)(n,"data-type","blockquote"):(0,p.lG)(n,"BLOCKQUOTE"))&&h(e.toolbar.elements,["quote"]),(0,p.a1)(n,"data-type","strong")&&h(e.toolbar.elements,["bold"]),(0,p.a1)(n,"data-type","em")&&h(e.toolbar.elements,["italic"]),(0,p.a1)(n,"data-type","s")&&h(e.toolbar.elements,["strike"]),(0,p.a1)(n,"data-type","a")&&h(e.toolbar.elements,["link"]);var i=(0,p.lG)(n,"LI");i?(i.classList.contains("vditor-task")?h(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?h(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&h(e.toolbar.elements,["list"]),b(e.toolbar.elements,["outdent","indent"])):L(e.toolbar.elements,["outdent","indent"]),(0,p.a1)(n,"data-type","code-block")&&(L(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),h(e.toolbar.elements,["code"])),(0,p.a1)(n,"data-type","code")&&(L(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),h(e.toolbar.elements,["inline-code"])),(0,p.a1)(n,"data-type","table")&&L(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},ve=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=m(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,l.pK)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}},e.options.undoDelay)},qt=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},Bt=function(e){for(var t="",n=e.previousSibling;n;)t=n.nodeType===3?n.textContent+t:n.outerHTML+t,n=n.previousSibling;return t},Vt=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var i=document.createElement("p");i.setAttribute("data-block","0"),i.textContent=n.textContent;var r=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(i,n),n.remove(),t.setStart(i.firstChild,Math.min(i.firstChild.textContent.length,r)),t.collapse(!0),(0,C.Hc)(t),!0}if(!n.getAttribute("data-block"))return n.tagName==="P"?n.remove():(n.tagName==="DIV"?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'+n.innerHTML+"</p>"):n.tagName==="BR"?n.outerHTML='<p data-block="0">'+n.outerHTML+"<wbr></p>":(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'+n.outerHTML+"</p>"),(0,C.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},ct=function(e,t){var n=(0,C.zh)(e),i=(0,p.F9)(n.startContainer);i||(i=n.startContainer.childNodes[n.startOffset]),i||e.wysiwyg.element.children.length!==0||(i=e.wysiwyg.element),i&&!i.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),i.innerHTML.trim()==="<wbr>"&&(i.innerHTML="<wbr><br>"),i.tagName==="BLOCKQUOTE"||i.classList.contains("vditor-reset")?i.innerHTML="<"+t+' data-block="0">'+i.innerHTML.trim()+"</"+t+">":i.outerHTML="<"+t+' data-block="0">'+i.innerHTML.trim()+"</"+t+">",(0,C.ib)(e.wysiwyg.element,n),Oe(e))},wt=function(e){var t=getSelection().getRangeAt(0),n=(0,p.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'+n.innerHTML+"</p>",(0,C.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},tt=function(e,t,n){n===void 0&&(n=!0);var i=e.previousElementSibling,r=i.ownerDocument.createRange();i.tagName==="CODE"?(i.style.display="inline-block",n?r.setStart(i.firstChild,1):r.selectNodeContents(i)):(i.style.display="block",i.firstChild.firstChild||i.firstChild.appendChild(document.createTextNode("")),r.selectNodeContents(i.firstChild)),n?r.collapse(!0):r.collapse(!1),(0,C.Hc)(r),e.firstElementChild.classList.contains("language-mindmap")||ke(t)},Ce=function(e,t){if(V("\u21E7\u2318X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},We=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,C.Gb)(e.wysiwyg.element)){u(e.toolbar.elements,E.g.EDIT_TOOLBARS),b(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;n=t.startContainer.nodeType===3?t.startContainer.parentElement:n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var i=(0,p.a1)(n,"data-type","footnotes-block");if(i)return e.wysiwyg.popover.innerHTML="",He(i,e),void xe(e,i);var r=(0,p.lG)(n,"LI");r?(r.classList.contains("vditor-task")?h(e.toolbar.elements,["check"]):r.parentElement.tagName==="OL"?h(e.toolbar.elements,["ordered-list"]):r.parentElement.tagName==="UL"&&h(e.toolbar.elements,["list"]),b(e.toolbar.elements,["outdent","indent"])):L(e.toolbar.elements,["outdent","indent"]),(0,p.lG)(n,"BLOCKQUOTE")&&h(e.toolbar.elements,["quote"]),((0,p.lG)(n,"B")||(0,p.lG)(n,"STRONG"))&&h(e.toolbar.elements,["bold"]),((0,p.lG)(n,"I")||(0,p.lG)(n,"EM"))&&h(e.toolbar.elements,["italic"]),((0,p.lG)(n,"STRIKE")||(0,p.lG)(n,"S"))&&h(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(z){z.classList.remove("vditor-comment--focus")});var o=(0,p.fb)(n,"vditor-comment");if(o){var a=o.getAttribute("data-cmtids").split(" ");if(a.length>1&&o.nextSibling.isSameNode(o.nextElementSibling)){var c=o.nextElementSibling.getAttribute("data-cmtids").split(" ");a.find(function(z){if(c.includes(z))return a=[z],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(z){z.getAttribute("data-cmtids").indexOf(a[0])>-1&&z.classList.add("vditor-comment--focus")})}var v=(0,p.lG)(n,"A");v&&h(e.toolbar.elements,["link"]);var g=(0,p.lG)(n,"TABLE"),f=(0,x.W)(n);(0,p.lG)(n,"CODE")?(0,p.lG)(n,"PRE")?(L(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),h(e.toolbar.elements,["code"])):(L(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),h(e.toolbar.elements,["inline-code"])):f?(L(e.toolbar.elements,["bold"]),h(e.toolbar.elements,["headings"])):g&&L(e.toolbar.elements,["table"]);var _=(0,p.fb)(n,"vditor-toc");if(_)return e.wysiwyg.popover.innerHTML="",He(_,e),void xe(e,_);var O=(0,x.S)(n,"BLOCKQUOTE");if(O&&(e.wysiwyg.popover.innerHTML="",Ge(t,O,e),Fe(t,O,e),He(O,e),xe(e,O)),r&&(e.wysiwyg.popover.innerHTML="",Ge(t,r,e),Fe(t,r,e),He(r,e),xe(e,r)),g){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var U=function(){var z=g.rows.length,ge=g.rows[0].cells.length,Ke=parseInt(ne.value,10)||z,qe=parseInt(be.value,10)||ge;if(Ke!==z||ge!==qe){if(ge!==qe)for(var kn=qe-ge,Qe=0;Qe<g.rows.length;Qe++)if(kn>0)for(var Sn=0;Sn<kn;Sn++)Qe===0?g.rows[Qe].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):g.rows[Qe].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var It=ge-1;It>=qe;It--)g.rows[Qe].cells[It].remove();if(z!==Ke){var Ln=Ke-z;if(Ln>0){for(var jt="<tr>",$e=0;$e<qe;$e++)jt+="<td> </td>";for(var Mn=0;Mn<Ln;Mn++)g.querySelector("tbody")?g.querySelector("tbody").insertAdjacentHTML("beforeend",jt):g.querySelector("thead").insertAdjacentHTML("afterend",jt+"</tr>")}else for($e=z-1;$e>=Ke;$e--)g.rows[$e].remove(),g.rows.length===1&&g.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(m(e))}},M=function(z){ft(g,z),z==="right"?(B.classList.remove("vditor-icon--current"),P.classList.remove("vditor-icon--current"),H.classList.add("vditor-icon--current")):z==="center"?(B.classList.remove("vditor-icon--current"),H.classList.remove("vditor-icon--current"),P.classList.add("vditor-icon--current")):(P.classList.remove("vditor-icon--current"),H.classList.remove("vditor-icon--current"),B.classList.add("vditor-icon--current")),(0,C.Hc)(t),ve(e)},R=(0,p.lG)(n,"TD"),q=(0,p.lG)(n,"TH"),D="left";R?D=R.getAttribute("align")||"left":q&&(D=q.getAttribute("align")||"center");var B=document.createElement("button");B.setAttribute("type","button"),B.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("\u21E7\u2318L")+">"),B.setAttribute("data-type","left"),B.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',B.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(D==="left"?" vditor-icon--current":""),B.onclick=function(){M("left")};var P=document.createElement("button");P.setAttribute("type","button"),P.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("\u21E7\u2318C")+">"),P.setAttribute("data-type","center"),P.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',P.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(D==="center"?" vditor-icon--current":""),P.onclick=function(){M("center")};var H=document.createElement("button");H.setAttribute("type","button"),H.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("\u21E7\u2318R")+">"),H.setAttribute("data-type","right"),H.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',H.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(D==="right"?" vditor-icon--current":""),H.onclick=function(){M("right")};var F=document.createElement("button");F.setAttribute("type","button"),F.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("\u2318=")+">"),F.setAttribute("data-type","insertRow"),F.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',F.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",F.onclick=function(){var z=getSelection().getRangeAt(0).startContainer,ge=(0,p.lG)(z,"TD")||(0,p.lG)(z,"TH");ge&&rn(e,t,ge)};var $=document.createElement("button");$.setAttribute("type","button"),$.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("\u21E7\u2318F")+">"),$.setAttribute("data-type","insertRow"),$.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',$.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",$.onclick=function(){var z=getSelection().getRangeAt(0).startContainer,ge=(0,p.lG)(z,"TD")||(0,p.lG)(z,"TH");ge&&on(e,t,ge)};var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("\u21E7\u2318=")+">"),J.setAttribute("data-type","insertColumn"),J.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",J.onclick=function(){var z=getSelection().getRangeAt(0).startContainer,ge=(0,p.lG)(z,"TD")||(0,p.lG)(z,"TH");ge&&ht(e,g,ge)};var Q=document.createElement("button");Q.setAttribute("type","button"),Q.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("\u21E7\u2318G")+">"),Q.setAttribute("data-type","insertColumn"),Q.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',Q.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Q.onclick=function(){var z=getSelection().getRangeAt(0).startContainer,ge=(0,p.lG)(z,"TD")||(0,p.lG)(z,"TH");ge&&ht(e,g,ge,"beforebegin")};var Y=document.createElement("button");Y.setAttribute("type","button"),Y.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("\u2318-")+">"),Y.setAttribute("data-type","deleteRow"),Y.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',Y.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Y.onclick=function(){var z=getSelection().getRangeAt(0).startContainer,ge=(0,p.lG)(z,"TD")||(0,p.lG)(z,"TH");ge&&an(e,t,ge)};var G=document.createElement("button");G.setAttribute("type","button"),G.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("\u21E7\u2318-")+">"),G.setAttribute("data-type","deleteColumn"),G.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',G.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",G.onclick=function(){var z=getSelection().getRangeAt(0).startContainer,ge=(0,p.lG)(z,"TD")||(0,p.lG)(z,"TH");ge&&ln(e,t,g,ge)},(Ne=document.createElement("span")).setAttribute("aria-label",window.VditorI18n.row),Ne.className="vditor-tooltipped vditor-tooltipped__n";var ne=document.createElement("input");Ne.appendChild(ne),ne.type="number",ne.min="1",ne.className="vditor-input",ne.style.width="42px",ne.style.textAlign="center",ne.setAttribute("placeholder",window.VditorI18n.row),ne.value=g.rows.length.toString(),ne.oninput=function(){U()},ne.onkeydown=function(z){if(!z.isComposing)return z.key==="Tab"?(be.focus(),be.select(),void z.preventDefault()):void(Ce(e,z)||Ie(z,t))};var he=document.createElement("span");he.setAttribute("aria-label",window.VditorI18n.column),he.className="vditor-tooltipped vditor-tooltipped__n";var be=document.createElement("input");he.appendChild(be),be.type="number",be.min="1",be.className="vditor-input",be.style.width="42px",be.style.textAlign="center",be.setAttribute("placeholder",window.VditorI18n.column),be.value=g.rows[0].cells.length.toString(),be.oninput=function(){U()},be.onkeydown=function(z){if(!z.isComposing)return z.key==="Tab"?(ne.focus(),ne.select(),void z.preventDefault()):void(Ce(e,z)||Ie(z,t))},Ge(t,g,e),Fe(t,g,e),He(g,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",B),e.wysiwyg.popover.insertAdjacentElement("beforeend",P),e.wysiwyg.popover.insertAdjacentElement("beforeend",H),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),e.wysiwyg.popover.insertAdjacentElement("beforeend",F),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",Y),e.wysiwyg.popover.insertAdjacentElement("beforeend",G),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ne),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",he),xe(e,g)}var Pe=(0,p.a1)(n,"data-type","link-ref");Pe&&Ut(e,Pe,t);var Ae=(0,p.a1)(n,"data-type","footnotes-ref");if(Ae){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="",(Ne=document.createElement("span")).setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("\u2325Enter")+">"),Ne.className="vditor-tooltipped vditor-tooltipped__n";var _e=document.createElement("input");Ne.appendChild(_e),_e.className="vditor-input",_e.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("\u2325Enter")+">"),_e.style.width="120px",_e.value=Ae.getAttribute("data-footnotes-label"),_e.oninput=function(){_e.value.trim()!==""&&Ae.setAttribute("data-footnotes-label",_e.value),typeof e.options.input=="function"&&e.options.input(m(e))},_e.onkeydown=function(z){z.isComposing||Ce(e,z)||Ie(z,t)},He(Ae,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ne),xe(e,Ae)}var Se=(0,p.fb)(n,"vditor-wysiwyg__block"),Xe=!!Se&&Se.getAttribute("data-type").indexOf("block")>-1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(z){(!Se||Se&&Xe&&!Se.contains(z))&&(z.previousElementSibling.style.display="none")}),Se&&Xe){if(e.wysiwyg.popover.innerHTML="",Ge(t,Se,e),Fe(t,Se,e),He(Se,e),Se.getAttribute("data-type")==="code-block"){var yt=document.createElement("span");yt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("\u2325Enter")+">"),yt.className="vditor-tooltipped vditor-tooltipped__n";var De=document.createElement("input");yt.appendChild(De);var at=Se.firstElementChild.firstElementChild;De.className="vditor-input",De.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("\u2325Enter")+">"),De.value=at.className.indexOf("language-")>-1?at.className.split("-")[1].split(" ")[0]:"",De.oninput=function(z){De.value.trim()!==""?at.className="language-"+De.value:(at.className="",e.hint.recentLanguage=""),Se.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Se.lastElementChild.innerHTML=Se.firstElementChild.innerHTML,we(Se.lastElementChild,e)),ve(e),z.detail===1&&(t.setStart(at.firstChild,0),t.collapse(!0),(0,C.Hc)(t))},De.onkeydown=function(z){if(!z.isComposing&&!Ce(e,z)){if(z.key==="Escape"&&e.hint.element.style.display==="block")return e.hint.element.style.display="none",void z.preventDefault();e.hint.select(z,e),Ie(z,t)}},De.onkeyup=function(z){if(!z.isComposing&&z.key!=="Enter"&&z.key!=="ArrowUp"&&z.key!=="Escape"&&z.key!=="ArrowDown"){var ge=[],Ke=De.value.substring(0,De.selectionStart);(e.options.preview.hljs.langs||E.g.CODE_LANGUAGES).forEach(function(qe){qe.indexOf(Ke.toLowerCase())>-1&&ge.push({html:qe,value:qe})}),e.hint.genHTML(ge,Ke,e),z.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",yt)}xe(e,Se)}else Se=void 0;if(f){var Ne;e.wysiwyg.popover.innerHTML="",(Ne=document.createElement("span")).setAttribute("aria-label","ID<"+(0,l.ns)("\u2325Enter")+">"),Ne.className="vditor-tooltipped vditor-tooltipped__n";var Ve=document.createElement("input");Ne.appendChild(Ve),Ve.className="vditor-input",Ve.setAttribute("placeholder","ID<"+(0,l.ns)("\u2325Enter")+">"),Ve.style.width="120px",Ve.value=f.getAttribute("data-id")||"",Ve.oninput=function(){f.setAttribute("data-id",Ve.value),typeof e.options.input=="function"&&e.options.input(m(e))},Ve.onkeydown=function(z){z.isComposing||Ce(e,z)||Ie(z,t)},Ge(t,f,e),Fe(t,f,e),He(f,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ne),xe(e,f)}if(v&&Et(e,v,t),!(O||r||g||Se||v||Pe||Ae||f||_)){var Ye=(0,p.a1)(n,"data-block","0");Ye&&Ye.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Ge(t,Ye,e),Fe(t,Ye,e),He(Ye,e),xe(e,Ye)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(z){z.style.display="none"});var En=(0,p.a1)(t.startContainer,"data-type","backslash");En&&(En.querySelector("span").style.display="inline")}},200)},xe=function(e,t){var n=t,i=(0,p.lG)(t,"TABLE");i&&(n=i),e.wysiwyg.popover.style.left="0",e.wysiwyg.popover.style.display="block",e.wysiwyg.popover.style.top=Math.max(-8,n.offsetTop-21-e.wysiwyg.element.scrollTop)+"px",e.wysiwyg.popover.style.left=Math.min(n.offsetLeft,e.wysiwyg.element.clientWidth-e.wysiwyg.popover.clientWidth)+"px",e.wysiwyg.popover.setAttribute("data-top",(n.offsetTop-21).toString())},Ut=function(e,t,n){n===void 0&&(n=getSelection().getRangeAt(0)),e.wysiwyg.popover.innerHTML="";var i=function(){o.value.trim()!==""&&(t.tagName==="IMG"?t.setAttribute("alt",o.value):t.textContent=o.value),c.value.trim()!==""&&t.setAttribute("data-link-label",c.value),typeof e.options.input=="function"&&e.options.input(m(e))},r=document.createElement("span");r.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var o=document.createElement("input");r.appendChild(o),o.className="vditor-input",o.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),o.style.width="120px",o.value=t.getAttribute("alt")||t.textContent,o.oninput=function(){i()},o.onkeydown=function(v){Ce(e,v)||Ie(v,n)||nt(e,t,v,c)};var a=document.createElement("span");a.setAttribute("aria-label",window.VditorI18n.linkRef),a.className="vditor-tooltipped vditor-tooltipped__n";var c=document.createElement("input");a.appendChild(c),c.className="vditor-input",c.setAttribute("placeholder",window.VditorI18n.linkRef),c.value=t.getAttribute("data-link-label"),c.oninput=function(){i()},c.onkeydown=function(v){Ce(e,v)||Ie(v,n)||nt(e,t,v,o)},He(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",a),xe(e,t)},Ge=function(e,t,n){var i=t.previousElementSibling;if(i&&(t.parentElement.isEqualNode(n.wysiwyg.element)||t.tagName==="LI")){var r=document.createElement("button");r.setAttribute("type","button"),r.setAttribute("data-type","up"),r.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("\u21E7\u2318U")+">"),r.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',r.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",r.onclick=function(){e.insertNode(document.createElement("wbr")),i.insertAdjacentElement("beforebegin",t),(0,C.ib)(n.wysiwyg.element,e),ve(n),We(n),ke(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",r)}},Fe=function(e,t,n){var i=t.nextElementSibling;if(i&&(t.parentElement.isEqualNode(n.wysiwyg.element)||t.tagName==="LI")){var r=document.createElement("button");r.setAttribute("type","button"),r.setAttribute("data-type","down"),r.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("\u21E7\u2318D")+">"),r.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',r.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",r.onclick=function(){e.insertNode(document.createElement("wbr")),i.insertAdjacentElement("afterend",t),(0,C.ib)(n.wysiwyg.element,e),ve(n),We(n),ke(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",r)}},He=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",window.VditorI18n.remove+"<"+(0,l.ns)("\u21E7\u2318X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var i=(0,C.zh)(t);i.setStartAfter(e),(0,C.Hc)(i),e.remove(),ve(t),We(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&Oe(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},nt=function(e,t,n,i){if(!n.isComposing){if(n.key==="Tab")return i.focus(),i.select(),void n.preventDefault();if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var r=(0,C.zh)(e);t.insertAdjacentHTML("afterend",E.g.ZWSP),r.setStartAfter(t.nextSibling),r.collapse(!0),(0,C.Hc)(r),n.preventDefault()}}},Et=function(e,t,n){e.wysiwyg.popover.innerHTML="";var i=function(){o.value.trim()!==""&&(t.innerHTML=o.value),t.setAttribute("href",c.value),t.setAttribute("title",g.value),ve(e)};t.querySelectorAll("[data-marker]").forEach(function(f){f.removeAttribute("data-marker")});var r=document.createElement("span");r.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),r.className="vditor-tooltipped vditor-tooltipped__n";var o=document.createElement("input");r.appendChild(o),o.className="vditor-input",o.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),o.style.width="120px",o.value=t.innerHTML||"",o.oninput=function(){i()},o.onkeydown=function(f){Ce(e,f)||Ie(f,n)||nt(e,t,f,c)};var a=document.createElement("span");a.setAttribute("aria-label",window.VditorI18n.link),a.className="vditor-tooltipped vditor-tooltipped__n";var c=document.createElement("input");a.appendChild(c),c.className="vditor-input",c.setAttribute("placeholder",window.VditorI18n.link),c.value=t.getAttribute("href")||"",c.oninput=function(){i()},c.onkeydown=function(f){Ce(e,f)||Ie(f,n)||nt(e,t,f,g)};var v=document.createElement("span");v.setAttribute("aria-label",window.VditorI18n.tooltipText),v.className="vditor-tooltipped vditor-tooltipped__n";var g=document.createElement("input");v.appendChild(g),g.className="vditor-input",g.setAttribute("placeholder",window.VditorI18n.tooltipText),g.style.width="60px",g.value=t.getAttribute("title")||"",g.oninput=function(){i()},g.onkeydown=function(f){Ce(e,f)||Ie(f,n)||nt(e,t,f,o)},He(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",r),e.wysiwyg.popover.insertAdjacentElement("beforeend",a),e.wysiwyg.popover.insertAdjacentElement("beforeend",v),xe(e,t)},Ie=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,C.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Ze=function(e){e.currentMode==="wysiwyg"?We(e):e.currentMode==="ir"&&et(e)},Wt=function(e,t,n){n===void 0&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var i=e.wysiwyg.element;i.innerHTML=e.lute.Md2VditorDOM(t),i.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(r){we(r,e),r.previousElementSibling.setAttribute("style","display:none")}),ve(e,n)},An=function(e,t,n){for(var i=e.startContainer.parentElement,r=!1,o="",a="",c=function(M){var R=Bt(M.startContainer),q=qt(M.startContainer),D=M.startContainer.textContent,B=M.startOffset,P="",H="";return(D.substr(0,B)!==""&&D.substr(0,B)!==E.g.ZWSP||R)&&(P=""+R+D.substr(0,B)),(D.substr(B)!==""&&D.substr(B)!==E.g.ZWSP||q)&&(H=""+D.substr(B)+q),{afterHTML:H,beforeHTML:P}}(e),v=c.beforeHTML,g=c.afterHTML;i&&!r;){var f=i.tagName;if(f==="STRIKE"&&(f="S"),f==="I"&&(f="EM"),f==="B"&&(f="STRONG"),f==="S"||f==="STRONG"||f==="EM"){var _="",O="",U="";i.parentElement.getAttribute("data-block")!=="0"&&(O=Bt(i),U=qt(i)),(v||O)&&(v=_=O+"<"+f+">"+v+"</"+f+">"),(n==="bold"&&f==="STRONG"||n==="italic"&&f==="EM"||n==="strikeThrough"&&f==="S")&&(_+=""+o+E.g.ZWSP+"<wbr>"+a,r=!0),(g||U)&&(_+=g="<"+f+">"+g+"</"+f+">"+U),i.parentElement.getAttribute("data-block")!=="0"?(i=i.parentElement).innerHTML=_:(i.outerHTML=_,i=i.parentElement),o="<"+f+">"+o,a="</"+f+">"+a}else r=!0}(0,C.ib)(t.wysiwyg.element,e)},ye=function(e,t){var n,i=this;this.element=document.createElement("div"),t.className&&(n=this.element.classList).add.apply(n,t.className.split(" "));var r=t.hotkey?" <"+(0,l.ns)(t.hotkey)+">":"";t.level===2&&(r=t.hotkey?" <"+(0,l.ns)(t.hotkey)+">":"");var o=t.tip?t.tip+r:""+window.VditorI18n[t.name]+r,a=t.name==="upload"?"div":"button";if(t.level===2)this.element.innerHTML="<"+a+' data-type="'+t.name+'">'+o+"</"+a+">";else{this.element.classList.add("vditor-toolbar__item");var c=document.createElement(a);c.setAttribute("data-type",t.name),c.className="vditor-tooltipped vditor-tooltipped__"+t.tipPosition,c.setAttribute("aria-label",o),c.innerHTML=t.icon,this.element.appendChild(c)}t.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(v){v.preventDefault(),i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||(e.currentMode==="wysiwyg"?function(g,f,_){if(!(g.wysiwyg.composingLock&&_ instanceof CustomEvent)){var O=!0,U=!0;g.wysiwyg.element.querySelector("wbr")&&g.wysiwyg.element.querySelector("wbr").remove();var M=(0,C.zh)(g),R=f.getAttribute("data-type");if(f.classList.contains("vditor-menu--current"))if(R==="strike"&&(R="strikeThrough"),R==="quote"){var q=(0,p.lG)(M.startContainer,"BLOCKQUOTE");q||(q=M.startContainer.childNodes[M.startOffset]),q&&(O=!1,f.classList.remove("vditor-menu--current"),M.insertNode(document.createElement("wbr")),q.outerHTML=q.innerHTML.trim()===""?'<p data-block="0">'+q.innerHTML+"</p>":q.innerHTML,(0,C.ib)(g.wysiwyg.element,M))}else if(R==="inline-code"){var D=(0,p.lG)(M.startContainer,"CODE");D||(D=M.startContainer.childNodes[M.startOffset]),D&&(D.outerHTML=D.innerHTML.replace(E.g.ZWSP,"")+"<wbr>",(0,C.ib)(g.wysiwyg.element,M))}else R==="link"?(M.collapsed&&M.selectNode(M.startContainer.parentElement),document.execCommand("unlink",!1,"")):R==="check"||R==="list"||R==="ordered-list"?(mt(g,M,R),(0,C.ib)(g.wysiwyg.element,M),O=!1,f.classList.remove("vditor-menu--current")):(O=!1,f.classList.remove("vditor-menu--current"),M.toString()===""?An(M,g,R):document.execCommand(R,!1,""));else{g.wysiwyg.element.childNodes.length===0&&(g.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,C.ib)(g.wysiwyg.element,M));var B=(0,p.F9)(M.startContainer);if(R==="quote"){if(B||(B=M.startContainer.childNodes[M.startOffset]),B){O=!1,f.classList.add("vditor-menu--current"),M.insertNode(document.createElement("wbr"));var P=(0,p.lG)(M.startContainer,"LI");P&&B.contains(P)?P.innerHTML='<blockquote data-block="0">'+P.innerHTML+"</blockquote>":B.outerHTML='<blockquote data-block="0">'+B.outerHTML+"</blockquote>",(0,C.ib)(g.wysiwyg.element,M)}}else if(R==="check"||R==="list"||R==="ordered-list")mt(g,M,R,!1),(0,C.ib)(g.wysiwyg.element,M),O=!1,u(g.toolbar.elements,["check","list","ordered-list"]),f.classList.add("vditor-menu--current");else if(R==="inline-code"){if(M.toString()==="")(H=document.createElement("code")).textContent=E.g.ZWSP,M.insertNode(H),M.setStart(H.firstChild,1),M.collapse(!0),(0,C.Hc)(M);else if(M.startContainer.nodeType===3){var H=document.createElement("code");M.surroundContents(H),M.insertNode(H),(0,C.Hc)(M)}f.classList.add("vditor-menu--current")}else if(R==="code")(H=document.createElement("div")).className="vditor-wysiwyg__block",H.setAttribute("data-type","code-block"),H.setAttribute("data-block","0"),H.setAttribute("data-marker","```"),M.toString()===""?H.innerHTML=`<pre><code><wbr>
|
|
36
|
+
</code></pre>`:(H.innerHTML="<pre><code>"+M.toString()+"<wbr></code></pre>",M.deleteContents()),M.insertNode(H),B&&(B.outerHTML=g.lute.SpinVditorDOM(B.outerHTML)),(0,C.ib)(g.wysiwyg.element,M),g.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(be){we(be,g)}),f.classList.add("vditor-menu--disabled");else if(R==="link"){if(M.toString()===""){var F=document.createElement("a");F.innerText=E.g.ZWSP,M.insertNode(F),M.setStart(F.firstChild,1),M.collapse(!0),Et(g,F,M);var $=g.wysiwyg.popover.querySelector("input");$.value="",$.focus(),U=!1}else{(H=document.createElement("a")).setAttribute("href",""),H.innerHTML=M.toString(),M.surroundContents(H),M.insertNode(H),(0,C.Hc)(M),Et(g,H,M);var J=g.wysiwyg.popover.querySelectorAll("input");J[0].value=H.innerText,J[1].focus()}O=!1,f.classList.add("vditor-menu--current")}else if(R==="table"){var Q='<table data-block="0"><thead><tr><th>col1<wbr></th><th>col2</th><th>col3</th></tr></thead><tbody><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table>';if(M.toString().trim()==="")B&&B.innerHTML.trim().replace(E.g.ZWSP,"")===""?B.outerHTML=Q:document.execCommand("insertHTML",!1,Q),M.selectNode(g.wysiwyg.element.querySelector("wbr").previousSibling),g.wysiwyg.element.querySelector("wbr").remove(),(0,C.Hc)(M);else{Q='<table data-block="0"><thead><tr>';var Y=M.toString().split(`
|
|
37
|
+
`),G=Y[0].split(",").length>Y[0].split(" ").length?",":" ";Y.forEach(function(be,Pe){Pe===0?(be.split(G).forEach(function(Ae,_e){Q+=_e===0?"<th>"+Ae+"<wbr></th>":"<th>"+Ae+"</th>"}),Q+="</tr></thead>"):(Q+=Pe===1?"<tbody><tr>":"<tr>",be.split(G).forEach(function(Ae){Q+="<td>"+Ae+"</td>"}),Q+="</tr>")}),Q+="</tbody></table>",document.execCommand("insertHTML",!1,Q),(0,C.ib)(g.wysiwyg.element,M)}O=!1,f.classList.add("vditor-menu--disabled")}else if(R==="line"){if(B){var ne=`<hr data-block="0"><p data-block="0"><wbr>
|
|
38
|
+
</p>`;B.innerHTML.trim()===""?B.outerHTML=ne:B.insertAdjacentHTML("afterend",ne),(0,C.ib)(g.wysiwyg.element,M)}}else if(O=!1,f.classList.add("vditor-menu--current"),R==="strike"&&(R="strikeThrough"),M.toString()!==""||R!=="bold"&&R!=="italic"&&R!=="strikeThrough")document.execCommand(R,!1,"");else{var he="strong";R==="italic"?he="em":R==="strikeThrough"&&(he="s"),(H=document.createElement(he)).textContent=E.g.ZWSP,M.insertNode(H),H.previousSibling&&H.previousSibling.textContent===E.g.ZWSP&&(H.previousSibling.textContent=""),M.setStart(H.firstChild,1),M.collapse(!0),(0,C.Hc)(M)}}O&&We(g),U&&ve(g)}}(e,i.element.children[0],v):e.currentMode==="ir"?Vn(e,i.element.children[0],t.prefix||"",t.suffix||""):Nn(e,i.element.children[0],t.prefix||"",t.suffix||""))})},_n=(Ue=function(e,t){return Ue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)i.hasOwnProperty(r)&&(n[r]=i[r])},Ue(e,t)},function(e,t){function n(){this.constructor=e}Ue(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),ze=function(e,t,n){var i;if(typeof n!="string"?(w(e,["subToolbar","hint"]),n.preventDefault(),i=m(e)):i=n,e.currentMode!==t||typeof n=="string"){if(e.devtools&&e.devtools.renderEchart(e),e.options.preview.mode==="both"&&t==="sv"?e.preview.element.style.display="block":e.preview.element.style.display="none",b(e.toolbar.elements,E.g.EDIT_TOOLBARS),u(e.toolbar.elements,E.g.EDIT_TOOLBARS),L(e.toolbar.elements,["outdent","indent"]),t==="ir")S(e.toolbar.elements,["both"]),T(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="block",e.lute.SetVditorIR(!0),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!1),e.currentMode="ir",e.ir.element.innerHTML=e.lute.Md2VditorIRDOM(i),Re(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),de(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(o){we(o,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(o){(0,se.H)(o,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")S(e.toolbar.elements,["both"]),T(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="block",e.ir.element.parentElement.style.display="none",e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!0),e.lute.SetVditorSV(!1),e.currentMode="wysiwyg",de(e),Wt(e,i,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(o){(0,se.H)(o,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){T(e.toolbar.elements,["both"]),S(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="none",(e.options.preview.mode==="both"||e.options.preview.mode==="editor")&&(e.sv.element.style.display="block"),e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!0),e.currentMode="sv";var r=Gt(i,e);r==="<div data-block='0'></div>"&&(r=""),e.sv.element.innerHTML=r,ae(e.sv.element),Me(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),de(e)}e.undo.resetIcon(e),typeof n!="string"&&(e[e.currentMode].element.focus(),Ze(e)),Oe(e),X(e),e.toolbar.elements["edit-mode"]&&(e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach(function(o){o.classList.remove("vditor-menu--current")}),e.toolbar.elements["edit-mode"].querySelector('button[data-mode="'+e.currentMode+'"]').classList.add("vditor-menu--current")),e.outline.toggle(e,e.currentMode!=="sv"&&e.options.outline.enable,typeof n!="string")}},xn=function(e){function t(n,i){var r=e.call(this,n,i)||this,o=document.createElement("div");return o.className="vditor-hint"+(i.level===2?"":" vditor-panel--arrow"),o.innerHTML='<button data-mode="wysiwyg">'+window.VditorI18n.wysiwyg+" <"+(0,l.ns)("\u2325\u23187")+`></button>
|
|
39
|
+
<button data-mode="ir">`+window.VditorI18n.instantRendering+" <"+(0,l.ns)("\u2325\u23188")+`></button>
|
|
40
|
+
<button data-mode="sv">`+window.VditorI18n.splitView+" <"+(0,l.ns)("\u2325\u23189")+"></button>",r.element.appendChild(o),r._bindEvent(n,o,i),r}return _n(t,e),t.prototype._bindEvent=function(n,i,r){var o=this.element.children[0];k(n,i,o,r.level),i.children.item(0).addEventListener((0,l.Le)(),function(a){ze(n,"wysiwyg",a),a.preventDefault(),a.stopPropagation()}),i.children.item(1).addEventListener((0,l.Le)(),function(a){ze(n,"ir",a),a.preventDefault(),a.stopPropagation()}),i.children.item(2).addEventListener((0,l.Le)(),function(a){ze(n,"sv",a),a.preventDefault(),a.stopPropagation()})},t}(ye),rt=function(e,t){return(0,C.Gb)(e,t)?getSelection().toString():""},kt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(m(e)),w(e,["subToolbar","hint"])})},zt=function(e,t){t.addEventListener("dblclick",function(n){n.target.tagName==="IMG"&&(e.options.image.preview?e.options.image.preview(n.target):e.options.image.isPreview&&(0,re.E)(n.target,e.options.lang,e.options.theme))})},St=function(e,t){t.addEventListener("blur",function(n){if(e.currentMode==="ir"){var i=e.ir.element.querySelector(".vditor-ir__node--expand");i&&i.classList.remove("vditor-ir__node--expand")}else e.currentMode!=="wysiwyg"||e.wysiwyg.selectPopover.contains(n.relatedTarget)||e.wysiwyg.hideComment();e[e.currentMode].range=(0,C.zh)(e),e.options.blur&&e.options.blur(m(e))})},Lt=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(E.g.DROP_EDITOR,E.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(E.g.DROP_EDITOR)?oe(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&vt(e,n,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})})},Mt=function(e,t,n){t.addEventListener("copy",function(i){return n(i,e)})},Tt=function(e,t,n){t.addEventListener("cut",function(i){n(i,e),e.options.comment.enable&&e.currentMode==="wysiwyg"&&e.wysiwyg.getComments(e),document.execCommand("delete")})},ke=function(e){if(e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)),e.options.typewriterMode){var t=e[e.currentMode].element,n=(0,C.Ny)(t).top;e.options.height!=="auto"||e.element.classList.contains("vditor--fullscreen")||window.scrollTo(window.scrollX,n+e.element.offsetTop+e.toolbar.element.offsetHeight-window.innerHeight/2+10),(e.options.height!=="auto"||e.element.classList.contains("vditor--fullscreen"))&&(t.scrollTop=n+t.scrollTop-t.clientHeight/2+10)}},Ct=function(e,t){t.addEventListener("keydown",function(n){if(!n.isComposing&&e.options.keydown&&e.options.keydown(n),!(e.options.hint.extend.length>1||e.toolbar.elements.emoji)||!e.hint.select(n,e)){if(e.options.comment.enable&&e.currentMode==="wysiwyg"&&(n.key==="Backspace"||V("\u2318X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(function(r,o){var a,c,v,g,f;if(r.sv.composingLock=o.isComposing,o.isComposing||(o.key.indexOf("Arrow")!==-1||o.key==="Meta"||o.key==="Control"||o.key==="Alt"||o.key==="Shift"||o.key==="CapsLock"||o.key==="Escape"||/^F\d{1,2}$/.test(o.key)||r.undo.recordFirstPosition(r,o),o.key!=="Enter"&&o.key!=="Tab"&&o.key!=="Backspace"&&o.key.indexOf("Arrow")===-1&&!(0,l.yl)(o)&&o.key!=="Escape"))return!1;var _=(0,C.zh)(r),O=_.startContainer;_.startContainer.nodeType!==3&&_.startContainer.tagName==="DIV"&&(O=_.startContainer.childNodes[_.startOffset-1]);var U=(0,p.a1)(O,"data-type","text"),M=(0,p.a1)(O,"data-type","blockquote-marker");if(!M&&_.startOffset===0&&U&&U.previousElementSibling&&U.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(M=U.previousElementSibling),M&&o.key==="Enter"&&!(0,l.yl)(o)&&!o.altKey&&M.nextElementSibling.textContent.trim()===""&&(0,C.im)(M,r.sv.element,_).start===M.textContent.length)return((a=M.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="padding"&&M.previousElementSibling.setAttribute("data-action","enter-remove"),M.remove(),Me(r),o.preventDefault(),!0;var R=(0,p.a1)(O,"data-type","li-marker"),q=(0,p.a1)(O,"data-type","task-marker"),D=R;if(D||q&&q.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(D=q),D||_.startOffset!==0||!U||!U.previousElementSibling||U.previousElementSibling.getAttribute("data-type")!=="li-marker"&&U.previousElementSibling.getAttribute("data-type")!=="task-marker"||(D=U.previousElementSibling),D){var B=(0,C.im)(D,r.sv.element,_).start,P=D.getAttribute("data-type")==="task-marker",H=D;if(P&&(H=D.previousElementSibling.previousElementSibling.previousElementSibling),B===D.textContent.length){if(o.key==="Enter"&&!(0,l.yl)(o)&&!o.altKey&&!o.shiftKey&&D.nextElementSibling.textContent.trim()==="")return((c=H.previousElementSibling)===null||c===void 0?void 0:c.getAttribute("data-type"))==="padding"?(H.previousElementSibling.remove(),ie(r)):(P&&(H.remove(),D.previousElementSibling.previousElementSibling.remove(),D.previousElementSibling.remove()),D.nextElementSibling.remove(),D.remove(),Me(r)),o.preventDefault(),!0;if(o.key==="Tab")return H.insertAdjacentHTML("beforebegin",'<span data-type="padding">'+H.textContent.replace(/\S/g," ")+"</span>"),/^\d/.test(H.textContent)&&(H.textContent=H.textContent.replace(/^\d{1,}/,"1"),_.selectNodeContents(D.firstChild),_.collapse(!1)),ie(r),o.preventDefault(),!0}}if(Dt(r,_,o))return!0;var F=(0,p.a1)(O,"data-block","0"),$=(0,x.S)(O,"SPAN");if(o.key==="Enter"&&!(0,l.yl)(o)&&!o.altKey&&!o.shiftKey&&F){var J=!1,Q=F.textContent.match(/^\n+/);(0,C.im)(F,r.sv.element).start<=(Q?Q[0].length:0)&&(J=!0);var Y=`
|
|
41
|
+
`;if($){if(((v=$.previousElementSibling)===null||v===void 0?void 0:v.getAttribute("data-action"))==="enter-remove")return $.previousElementSibling.remove(),Me(r),o.preventDefault(),!0;Y+=Hn($)}return _.insertNode(document.createTextNode(Y)),_.collapse(!1),F&&F.textContent.trim()!==""&&!J?ie(r):Me(r),o.preventDefault(),!0}if(o.key==="Backspace"&&!(0,l.yl)(o)&&!o.altKey&&!o.shiftKey){if($&&((g=$.previousElementSibling)===null||g===void 0?void 0:g.getAttribute("data-type"))==="newline"&&(0,C.im)($,r.sv.element,_).start===1&&$.getAttribute("data-type").indexOf("code-block-")===-1)return _.setStart($,0),_.extractContents(),$.textContent.trim()!==""?ie(r):Me(r),o.preventDefault(),!0;if(F&&(0,C.im)(F,r.sv.element,_).start===0&&F.previousElementSibling){_.extractContents();var G=F.previousElementSibling.lastElementChild;return G.getAttribute("data-type")==="newline"&&(G.remove(),G=F.previousElementSibling.lastElementChild),G.getAttribute("data-type")!=="newline"&&(G.insertAdjacentHTML("afterend",F.innerHTML),F.remove()),F.textContent.trim()===""||!((f=F.previousElementSibling)===null||f===void 0)&&f.querySelector('[data-type="code-block-open-marker"]')?(G.getAttribute("data-type")!=="newline"&&(_.selectNodeContents(G.lastChild),_.collapse(!1)),Me(r)):ie(r),o.preventDefault(),!0}}return!1}(e,n))return}else if(e.currentMode==="wysiwyg"){if(function(r,o){if(r.wysiwyg.composingLock=o.isComposing,o.isComposing)return!1;o.key.indexOf("Arrow")!==-1||o.key==="Meta"||o.key==="Control"||o.key==="Alt"||o.key==="Shift"||o.key==="CapsLock"||o.key==="Escape"||/^F\d{1,2}$/.test(o.key)||r.undo.recordFirstPosition(r,o);var a=(0,C.zh)(r),c=a.startContainer;if(!Xt(o,r,c)||(Yt(a,r,o),mn(a),o.key!=="Enter"&&o.key!=="Tab"&&o.key!=="Backspace"&&o.key.indexOf("Arrow")===-1&&!(0,l.yl)(o)&&o.key!=="Escape"&&o.key!=="Delete"))return!1;var v=(0,p.F9)(c),g=(0,p.lG)(c,"P");if(nn(o,r,g,a)||tn(a,r,g,o)||sn(r,o,a))return!0;var f=(0,p.fb)(c,"vditor-wysiwyg__block");if(f){if(o.key==="Escape"&&f.children.length===2)return r.wysiwyg.popover.style.display="none",f.firstElementChild.style.display="none",r.wysiwyg.element.blur(),o.preventDefault(),!0;if(!(0,l.yl)(o)&&!o.shiftKey&&o.altKey&&o.key==="Enter"&&f.getAttribute("data-type")==="code-block"){var _=r.wysiwyg.popover.querySelector(".vditor-input");return _.focus(),_.select(),o.preventDefault(),!0}if(f.getAttribute("data-block")==="0"&&(cn(r,o,f.firstElementChild,a)||it(r,o,a,f.firstElementChild,f)||f.getAttribute("data-type")!=="yaml-front-matter"&&Je(r,o,a,f.firstElementChild,f)))return!0}if(dn(r,a,o,g))return!0;var O=(0,p.E2)(c,"BLOCKQUOTE");if(O&&!o.shiftKey&&o.altKey&&o.key==="Enter"){(0,l.yl)(o)?a.setStartBefore(O):a.setStartAfter(O),(0,C.Hc)(a);var U=document.createElement("p");return U.setAttribute("data-block","0"),U.innerHTML=`
|
|
42
|
+
`,a.insertNode(U),a.collapse(!0),(0,C.Hc)(a),ve(r),ke(r),o.preventDefault(),!0}var M,R=(0,x.W)(c);if(R){if(R.tagName==="H6"&&c.textContent.length===a.startOffset&&!(0,l.yl)(o)&&!o.shiftKey&&!o.altKey&&o.key==="Enter"){var q=document.createElement("p");return q.textContent=`
|
|
43
|
+
`,q.setAttribute("data-block","0"),c.parentElement.insertAdjacentElement("afterend",q),a.setStart(q,0),(0,C.Hc)(a),ve(r),ke(r),o.preventDefault(),!0}var D;if(V("\u2318=",o))return(D=parseInt(R.tagName.substr(1),10)-1)>0&&(ct(r,"h"+D),ve(r)),o.preventDefault(),!0;if(V("\u2318-",o))return(D=parseInt(R.tagName.substr(1),10)+1)<7&&(ct(r,"h"+D),ve(r)),o.preventDefault(),!0;o.key!=="Backspace"||(0,l.yl)(o)||o.shiftKey||o.altKey||R.textContent.length!==1||wt(r)}if(un(r,a,o))return!0;if(o.altKey&&o.key==="Enter"&&!(0,l.yl)(o)&&!o.shiftKey){var B=(0,p.lG)(c,"A"),P=(0,p.a1)(c,"data-type","link-ref"),H=(0,p.a1)(c,"data-type","footnotes-ref");if(B||P||H||R&&R.tagName.length===2){var F=r.wysiwyg.popover.querySelector("input");F.focus(),F.select()}}if(Ce(r,o))return!0;if(V("\u21E7\u2318U",o)&&(M=r.wysiwyg.popover.querySelector('[data-type="up"]'))||V("\u21E7\u2318D",o)&&(M=r.wysiwyg.popover.querySelector('[data-type="down"]')))return M.click(),o.preventDefault(),!0;if(Dt(r,a,o))return!0;if(!(0,l.yl)(o)&&o.shiftKey&&!o.altKey&&o.key==="Enter"&&c.parentElement.tagName!=="LI"&&c.parentElement.tagName!=="P")return["STRONG","STRIKE","S","I","EM","B"].includes(c.parentElement.tagName)?a.insertNode(document.createTextNode(`
|
|
44
|
+
`+E.g.ZWSP)):a.insertNode(document.createTextNode(`
|
|
45
|
+
`)),a.collapse(!1),(0,C.Hc)(a),ve(r),ke(r),o.preventDefault(),!0;if(o.key==="Backspace"&&!(0,l.yl)(o)&&!o.shiftKey&&!o.altKey&&a.toString()===""){if(pn(r,a,o,g))return!0;if(v){if(v.previousElementSibling&&v.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&v.previousElementSibling.getAttribute("data-block")==="0"&&v.tagName!=="UL"&&v.tagName!=="OL"){var $=(0,C.im)(v,r.wysiwyg.element,a).start;if($===0&&a.startOffset===0||$===1&&v.innerText.startsWith(E.g.ZWSP))return tt(v.previousElementSibling.lastElementChild,r,!1),v.innerHTML.trim().replace(E.g.ZWSP,"")===""&&(v.remove(),ve(r)),o.preventDefault(),!0}var J=a.startOffset;if(a.toString()===""&&c.nodeType===3&&c.textContent.charAt(J-2)===`
|
|
46
|
+
`&&c.textContent.charAt(J-1)!==E.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(c.parentElement.tagName))return c.textContent=c.textContent.substring(0,J-1)+E.g.ZWSP,a.setStart(c,J),a.collapse(!0),ve(r),o.preventDefault(),!0;c.textContent===E.g.ZWSP&&a.startOffset===1&&!c.previousSibling&&function(Y){for(var G=Y.startContainer.nextSibling;G&&G.textContent==="";)G=G.nextSibling;return!(!G||G.nodeType===3||G.tagName!=="CODE"&&G.getAttribute("data-type")!=="math-inline"&&G.getAttribute("data-type")!=="html-entity"&&G.getAttribute("data-type")!=="html-inline")}(a)&&(c.textContent=""),v.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(Y){Y.firstElementChild.style.display="inline",Y.lastElementChild.style.display="none"}),v.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(Y){Y.firstElementChild.style.display="inline",Y.lastElementChild.style.display="none"})}}if((0,l.vU)()&&a.startOffset===1&&c.textContent.indexOf(E.g.ZWSP)>-1&&c.previousSibling&&c.previousSibling.nodeType!==3&&c.previousSibling.tagName==="CODE"&&(o.key==="Backspace"||o.key==="ArrowLeft"))return a.selectNodeContents(c.previousSibling),a.collapse(!1),o.preventDefault(),!0;if(fn(o,v,a))return o.preventDefault(),!0;if(Qt(a,o.key),o.key==="ArrowDown"){var Q=c.nextSibling;Q&&Q.nodeType!==3&&Q.getAttribute("data-type")==="math-inline"&&a.setStartAfter(Q)}return!(!v||!K(v,r,o,a)||(o.preventDefault(),0))}(e,n))return}else if(e.currentMode==="ir"&&function(r,o){if(r.ir.composingLock=o.isComposing,o.isComposing)return!1;o.key.indexOf("Arrow")!==-1||o.key==="Meta"||o.key==="Control"||o.key==="Alt"||o.key==="Shift"||o.key==="CapsLock"||o.key==="Escape"||/^F\d{1,2}$/.test(o.key)||r.undo.recordFirstPosition(r,o);var a=(0,C.zh)(r),c=a.startContainer;if(!Xt(o,r,c)||(Yt(a,r,o),mn(a),o.key!=="Enter"&&o.key!=="Tab"&&o.key!=="Backspace"&&o.key.indexOf("Arrow")===-1&&!(0,l.yl)(o)&&o.key!=="Escape"&&o.key!=="Delete"))return!1;var v=(0,p.a1)(c,"data-newline","1");if(!(0,l.yl)(o)&&!o.altKey&&!o.shiftKey&&o.key==="Enter"&&v&&a.startOffset<v.textContent.length){var g=v.previousElementSibling;g&&(a.insertNode(document.createTextNode(g.textContent)),a.collapse(!1));var f=v.nextSibling;f&&(a.insertNode(document.createTextNode(f.textContent)),a.collapse(!0))}var _=(0,p.lG)(c,"P");if(nn(o,r,_,a)||tn(a,r,_,o)||dn(r,a,o,_))return!0;var O=(0,p.fb)(c,"vditor-ir__marker--pre");if(O&&O.tagName==="PRE"){var U=O.firstChild;if(cn(r,o,O,a)||(U.getAttribute("data-type")==="math-block"||U.getAttribute("data-type")==="html-block")&&Je(r,o,a,U,O.parentElement)||it(r,o,a,U,O.parentElement))return!0}var M=(0,p.a1)(c,"data-type","code-block-info");if(M){if(o.key==="Enter"||o.key==="Tab")return a.selectNodeContents(M.nextElementSibling.firstChild),a.collapse(!0),o.preventDefault(),w(r,["hint"]),!0;if(o.key==="Backspace"){var R=(0,C.im)(M,r.ir.element).start;R===1&&a.setStart(c,0),R===2&&(r.hint.recentLanguage="")}if(Je(r,o,a,M,M.parentElement))return w(r,["hint"]),!0}var q=(0,p.lG)(c,"TD")||(0,p.lG)(c,"TH");if(o.key.indexOf("Arrow")>-1&&q){var D=qn(q);if(D&&Je(r,o,a,q,D))return!0;var B=Bn(q);if(B&&it(r,o,a,q,B))return!0}if(sn(r,o,a)||un(r,a,o)||Dt(r,a,o))return!0;var P=(0,x.W)(c);if(P){var H;if(V("\u2318=",o))return(H=P.querySelector(".vditor-ir__marker--heading"))&&H.textContent.trim().length>1&&ot(r,H.textContent.substr(1)),o.preventDefault(),!0;if(V("\u2318-",o))return(H=P.querySelector(".vditor-ir__marker--heading"))&&H.textContent.trim().length<6&&ot(r,H.textContent.trim()+"# "),o.preventDefault(),!0}var F=(0,p.F9)(c);if(o.key==="Backspace"&&!(0,l.yl)(o)&&!o.shiftKey&&!o.altKey&&a.toString()===""){if(pn(r,a,o,_))return!0;if(F&&F.previousElementSibling&&F.tagName!=="UL"&&F.tagName!=="OL"&&(F.previousElementSibling.getAttribute("data-type")==="code-block"||F.previousElementSibling.getAttribute("data-type")==="math-block")){var $=(0,C.im)(F,r.ir.element,a).start;if($===0||$===1&&F.innerText.startsWith(E.g.ZWSP))return a.selectNodeContents(F.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),a.collapse(!1),j(a,r),F.textContent.trim().replace(E.g.ZWSP,"")===""&&(F.remove(),Re(r)),o.preventDefault(),!0}if(P){var J=P.firstElementChild.textContent.length;(0,C.im)(P,r.ir.element).start===J&&(a.setStart(P.firstElementChild.firstChild,J-1),a.collapse(!0),(0,C.Hc)(a))}}return!((o.key!=="ArrowUp"&&o.key!=="ArrowDown"||!F||(F.querySelectorAll(".vditor-ir__node").forEach(function(Q){Q.contains(c)||Q.classList.add("vditor-ir__node--hidden")}),!fn(o,F,a)))&&(Qt(a,o.key),!F||!K(F,r,o,a)||(o.preventDefault(),0)))}(e,n))return;if(e.options.ctrlEnter&&V("\u2318Enter",n))return e.options.ctrlEnter(m(e)),void n.preventDefault();if(V("\u2318Z",n)&&!e.toolbar.elements.undo)return e.undo.undo(e),void n.preventDefault();if(V("\u2318Y",n)&&!e.toolbar.elements.redo)return e.undo.redo(e),void n.preventDefault();if(n.key==="Escape")return e.hint.element.style.display==="block"?e.hint.element.style.display="none":e.options.esc&&!n.isComposing&&e.options.esc(m(e)),void n.preventDefault();if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[1-6]$/.test(n.code)){if(e.currentMode==="wysiwyg"){var i=n.code.replace("Digit","H");(0,p.lG)(getSelection().getRangeAt(0).startContainer,i)?wt(e):ct(e,i),ve(e)}else e.currentMode==="sv"?Ft(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&ot(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" ");return n.preventDefault(),!0}if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[7-9]$/.test(n.code))return n.code==="Digit7"?ze(e,"wysiwyg",n):n.code==="Digit8"?ze(e,"ir",n):n.code==="Digit9"&&ze(e,"sv",n),!0;e.options.toolbar.find(function(r){return!r.hotkey||r.toolbar?!!r.toolbar&&!!r.toolbar.find(function(o){return!!o.hotkey&&(V(o.hotkey,n)?(e.toolbar.elements[o.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0):void 0)}):V(r.hotkey,n)?(e.toolbar.elements[r.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0):void 0})}})},At=function(e,t){t.addEventListener("selectstart",function(n){t.onmouseup=function(){setTimeout(function(){var i=rt(e[e.currentMode].element);i.trim()?(e.currentMode==="wysiwyg"&&e.options.comment.enable&&((0,p.a1)(n.target,"data-type","footnotes-block")||(0,p.a1)(n.target,"data-type","link-ref-defs-block")?e.wysiwyg.hideComment():e.wysiwyg.showComment()),e.options.select&&e.options.select(i)):e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.wysiwyg.hideComment()})}})},Kt=function(e,t){var n=(0,C.zh)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var i=(0,p.a1)(n.startContainer,"data-block","0");i||(i=e.sv.element);var r=e.lute.SpinVditorSVDOM(i.textContent);r="<div data-block='0'>"+r.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
|
|
47
|
+
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
48
|
+
</span></span></div><div data-block="0"><`)+"</div>",i.isEqualNode(e.sv.element)?i.innerHTML=r:i.outerHTML=r,ae(e.sv.element),(0,C.ib)(e.sv.element,n),ke(e)},dt=function(e,t,n){n===void 0&&(n=!0);var i=e;for(i.nodeType===3&&(i=i.parentElement);i;){if(i.getAttribute("data-type")===t)return i;i=n?i.previousElementSibling:i.nextElementSibling}return!1},Gt=function(e,t){return I("SpinVditorSVDOM",e,"argument",t.options.debugger),e="<div data-block='0'>"+t.lute.SpinVditorSVDOM(e).replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
|
|
49
|
+
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
50
|
+
</span></span></div><div data-block="0"><`)+"</div>",I("SpinVditorSVDOM",e,"result",t.options.debugger),e},Hn=function(e){var t=e.getAttribute("data-type"),n=e.previousElementSibling,i=t&&t!=="text"&&t!=="table"&&t!=="heading-marker"&&t!=="newline"&&t!=="yaml-front-matter-open-marker"&&t!=="yaml-front-matter-close-marker"&&t!=="code-block-info"&&t!=="code-block-close-marker"&&t!=="code-block-open-marker"?e.textContent:"",r=!1;for(t==="newline"&&(r=!0);n&&!r;){var o=n.getAttribute("data-type");if(o==="li-marker"||o==="blockquote-marker"||o==="task-marker"||o==="padding"){var a=n.textContent;if(o!=="li-marker"||t!=="code-block-open-marker"&&t!=="code-block-info")if(t==="code-block-close-marker"&&n.nextElementSibling.isSameNode(e)){var c=dt(e,"code-block-open-marker");c&&c.previousElementSibling&&(n=c.previousElementSibling,i=a+i)}else i=a+i;else i=a.replace(/\S/g," ")+i}else o==="newline"&&(r=!0);n=n.previousElementSibling}return i},Me=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),e.preview.render(e);var n=m(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,l.pK)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),clearTimeout(e.sv.processTimeoutId),e.sv.processTimeoutId=window.setTimeout(function(){t.enableAddUndoStack&&!e.sv.composingLock&&e.undo.addToUndoStack(e)},e.options.undoDelay)},Ft=function(e,t){var n=(0,C.zh)(e),i=(0,x.S)(n.startContainer,"SPAN");i&&i.textContent.trim()!==""&&(t=`
|
|
51
|
+
`+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},Nn=function(e,t,n,i){var r=(0,C.zh)(e),o=t.getAttribute("data-type");e.sv.element.childNodes.length===0&&(e.sv.element.innerHTML=`<span data-type="p" data-block="0"><span data-type="text"><wbr></span></span><span data-type="newline"><br><span style="display: none">
|
|
52
|
+
</span></span>`,(0,C.ib)(e.sv.element,r));var a=(0,p.F9)(r.startContainer),c=(0,x.S)(r.startContainer,"SPAN");if(a){if(o==="link"){var v=void 0;return v=r.toString()===""?""+n+Lute.Caret+i:""+n+r.toString()+i.replace(")",Lute.Caret+")"),void document.execCommand("insertHTML",!1,v)}if(o==="italic"||o==="bold"||o==="strike"||o==="inline-code"||o==="code"||o==="table"||o==="line")return v=void 0,v=r.toString()===""?""+n+Lute.Caret+(o==="code"?"":i):""+n+r.toString()+Lute.Caret+(o==="code"?"":i),o==="table"||o==="code"&&c&&c.textContent!==""?v=`
|
|
53
|
+
|
|
54
|
+
`+v:o==="line"&&(v=`
|
|
55
|
+
|
|
56
|
+
`+n+`
|
|
57
|
+
`+Lute.Caret),void document.execCommand("insertHTML",!1,v);if((o==="check"||o==="list"||o==="ordered-list"||o==="quote")&&c){var g="* ";o==="check"?g="* [ ] ":o==="ordered-list"?g="1. ":o==="quote"&&(g="> ");var f=dt(c,"newline");return f?f.insertAdjacentText("afterend",g):a.insertAdjacentText("afterbegin",g),void ie(e)}(0,C.ib)(e.sv.element,r),Me(e)}},Zt=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},Jt=function(e,t){e.options.upload.setHeaders&&(e.options.upload.headers=e.options.upload.setHeaders()),e.options.upload.headers&&Object.keys(e.options.upload.headers).forEach(function(n){t.setRequestHeader(n,e.options.upload.headers[n])})},Dn=function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(g){try{v(i.next(g))}catch(f){o(f)}}function c(g){try{v(i.throw(g))}catch(f){o(f)}}function v(g){var f;g.done?r(g.value):(f=g.value,f instanceof n?f:new n(function(_){_(f)})).then(a,c)}v((i=i.apply(e,t||[])).next())})},On=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(v){return function(g){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&f[0]?i.return:f[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,f[1])).done)return r;switch(i=0,r&&(f=[2&f[0],r.value]),f[0]){case 0:case 1:r=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,i=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(r=a.trys,!((r=r.length>0&&r[r.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!r||f[1]>r[0]&&f[1]<r[3])){a.label=f[1];break}if(f[0]===6&&a.label<r[1]){a.label=r[1],r=f;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(f);break}r[2]&&a.ops.pop(),a.trys.pop();continue}f=t.call(e,a)}catch(_){f=[6,_],i=0}finally{n=r=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([v,g])}}},In=function(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"},_t=function(e,t,n){return Dn(void 0,void 0,void 0,function(){var i,r,o,a,c,v,g,f,_,O,U,M,R,q;return On(this,function(D){switch(D.label){case 0:for(i=[],r=e.options.upload.multiple===!0?t.length:1,M=0;M<r;M++)(o=t[M])instanceof DataTransferItem&&(o=o.getAsFile()),i.push(o);return e.options.upload.handler?[4,e.options.upload.handler(i)]:[3,2];case 1:return a=D.sent(),n&&(n.value=""),typeof a=="string"?(e.tip.show(a),[2]):[2];case 2:return e.options.upload.url&&e.upload?e.options.upload.file?[4,e.options.upload.file(i)]:[3,4]:(n&&(n.value=""),e.tip.show("please config: options.upload.url"),[2]);case 3:i=D.sent(),D.label=4;case 4:if(e.options.upload.validate&&typeof(a=e.options.upload.validate(i))=="string")return e.tip.show(a),[2];if(c=Zt(e),e.upload.range=(0,C.zh)(e),v=function(B,P){B.tip.hide();for(var H=[],F="",$="",J=(B.options.lang,B.options,function(G,ne){var he=P[ne],be=!0;he.name||(F+="<li>"+window.VditorI18n.nameEmpty+"</li>",be=!1),he.size>B.options.upload.max&&(F+="<li>"+he.name+" "+window.VditorI18n.over+" "+B.options.upload.max/1024/1024+"M</li>",be=!1);var Pe=he.name.lastIndexOf("."),Ae=he.name.substr(Pe),_e=B.options.upload.filename(he.name.substr(0,Pe))+Ae;B.options.upload.accept&&(B.options.upload.accept.split(",").some(function(Se){var Xe=Se.trim();if(Xe.indexOf(".")===0){if(Ae.toLowerCase()===Xe.toLowerCase())return!0}else if(he.type.split("/")[0]===Xe.split("/")[0])return!0;return!1})||(F+="<li>"+he.name+" "+window.VditorI18n.fileTypeError+"</li>",be=!1)),be&&(H.push(he),$+="<li>"+_e+" "+window.VditorI18n.uploading+"</li>")}),Q=P.length,Y=0;Y<Q;Y++)J(0,Y);return B.tip.show("<ul>"+F+$+"</ul>"),H}(e,i),v.length===0)return n&&(n.value=""),[2];for(g=new FormData,f=e.options.upload.extraData,_=0,O=Object.keys(f);_<O.length;_++)U=O[_],g.append(U,f[U]);for(M=0,R=v.length;M<R;M++)g.append(e.options.upload.fieldName,v[M]);return(q=new XMLHttpRequest).open("POST",e.options.upload.url),e.options.upload.token&&q.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(q.withCredentials=!0),Jt(e,q),e.upload.isUploading=!0,c.setAttribute("contenteditable","false"),q.onreadystatechange=function(){if(q.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,c.setAttribute("contenteditable","true"),q.status>=200&&q.status<300)if(e.options.upload.success)e.options.upload.success(c,q.responseText);else{var B=q.responseText;e.options.upload.format&&(B=e.options.upload.format(t,q.responseText)),function(P,H){Zt(H).focus();var F=JSON.parse(P),$="";F.code===1&&($=""+F.msg),F.data.errFiles&&F.data.errFiles.length>0&&($="<ul><li>"+$+"</li>",F.data.errFiles.forEach(function(Q){var Y=Q.lastIndexOf("."),G=H.options.upload.filename(Q.substr(0,Y))+Q.substr(Y);$+="<li>"+G+" "+window.VditorI18n.uploadError+"</li>"}),$+="</ul>"),$?H.tip.show($):H.tip.hide();var J="";Object.keys(F.data.succMap).forEach(function(Q){var Y=F.data.succMap[Q],G=Q.lastIndexOf("."),ne=Q.substr(G),he=H.options.upload.filename(Q.substr(0,G))+ne;(ne=ne.toLowerCase()).indexOf(".wav")===0||ne.indexOf(".mp3")===0||ne.indexOf(".ogg")===0?H.currentMode==="wysiwyg"?J+=`<div class="vditor-wysiwyg__block" data-type="html-block"
|
|
58
|
+
data-block="0"><pre><code><audio controls="controls" src="`+Y+'"></audio></code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="'+Y+`"></audio></pre></div>
|
|
59
|
+
`:H.currentMode==="ir"?J+='<audio controls="controls" src="'+Y+`"></audio>
|
|
60
|
+
`:J+="["+he+"]("+Y+`)
|
|
61
|
+
`:ne.indexOf(".apng")===0||ne.indexOf(".bmp")===0||ne.indexOf(".gif")===0||ne.indexOf(".ico")===0||ne.indexOf(".cur")===0||ne.indexOf(".jpg")===0||ne.indexOf(".jpeg")===0||ne.indexOf(".jfif")===0||ne.indexOf(".pjp")===0||ne.indexOf(".pjpeg")===0||ne.indexOf(".png")===0||ne.indexOf(".svg")===0||ne.indexOf(".webp")===0?H.currentMode==="wysiwyg"?J+='<img alt="'+he+'" src="'+Y+`">
|
|
62
|
+
`:J+="
|
|
63
|
+
`:H.currentMode==="wysiwyg"?J+='<a href="'+Y+'">'+he+`</a>
|
|
64
|
+
`:J+="["+he+"]("+Y+`)
|
|
65
|
+
`}),(0,C.Hc)(H.upload.range),document.execCommand("insertHTML",!1,J),H.upload.range=getSelection().getRangeAt(0).cloneRange()}(B,e)}else e.options.upload.error?e.options.upload.error(q.responseText):e.tip.show(q.responseText);n&&(n.value=""),e.upload.element.style.display="none"}},q.upload.onprogress=function(B){if(B.lengthComputable){var P=B.loaded/B.total*100;e.upload.element.style.display="block",e.upload.element.style.width=P+"%"}},q.send(g),[2]}})})},ut=function(e,t,n){var i,r=(0,p.F9)(t.startContainer);if(r||(r=e.wysiwyg.element),n&&n.inputType!=="formatItalic"&&n.inputType!=="deleteByDrag"&&n.inputType!=="insertFromDrop"&&n.inputType!=="formatBold"&&n.inputType!=="formatRemove"&&n.inputType!=="formatStrikeThrough"&&n.inputType!=="insertUnorderedList"&&n.inputType!=="insertOrderedList"&&n.inputType!=="formatOutdent"&&n.inputType!=="formatIndent"&&n.inputType!==""||!n){var o=function(P){for(var H=P.previousSibling;H;){if(H.nodeType!==3&&H.tagName==="A"&&!H.previousSibling&&H.innerHTML.replace(E.g.ZWSP,"")===""&&H.nextSibling)return H;H=H.previousSibling}return!1}(t.startContainer);o&&o.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(P){P.remove()}),t.insertNode(document.createElement("wbr")),r.querySelectorAll("[style]").forEach(function(P){P.removeAttribute("style")}),r.querySelectorAll(".vditor-comment").forEach(function(P){P.textContent.trim()===""&&(P.classList.remove("vditor-comment","vditor-comment--focus"),P.removeAttribute("data-cmtids"))}),(i=r.previousElementSibling)===null||i===void 0||i.querySelectorAll(".vditor-comment").forEach(function(P){P.textContent.trim()===""&&(P.classList.remove("vditor-comment","vditor-comment--focus"),P.removeAttribute("data-cmtids"))});var a="";r.getAttribute("data-type")==="link-ref-defs-block"&&(r=e.wysiwyg.element);var c,v=r.isEqualNode(e.wysiwyg.element),g=(0,p.a1)(r,"data-type","footnotes-block");if(v)a=r.innerHTML;else{var f=(0,p.O9)(t.startContainer);if(f&&!g){var _=(0,x.S)(t.startContainer,"BLOCKQUOTE");r=_?(0,p.F9)(t.startContainer)||r:f}if(g&&(r=g),a=r.outerHTML,r.tagName==="UL"||r.tagName==="OL"){var O=r.previousElementSibling,U=r.nextElementSibling;!O||O.tagName!=="UL"&&O.tagName!=="OL"||(a=O.outerHTML+a,O.remove()),!U||U.tagName!=="UL"&&U.tagName!=="OL"||(a+=U.outerHTML,U.remove()),a=a.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}r.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(P){P&&!r.isEqualNode(P)&&(a+=P.outerHTML,P.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(P){P&&!r.isEqualNode(P)&&(a+=P.outerHTML,P.remove())}))}if((a=a.replace(/<\/(strong|b)><strong data-marker="\W{2}">/g,"").replace(/<\/(em|i)><em data-marker="\W{1}">/g,"").replace(/<\/(s|strike)><s data-marker="~{1,2}">/g,""))==='<p data-block="0">```<wbr></p>'&&e.hint.recentLanguage&&(a='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),I("SpinVditorDOM",a,"argument",e.options.debugger),a=e.lute.SpinVditorDOM(a),I("SpinVditorDOM",a,"result",e.options.debugger),v)r.innerHTML=a;else if(r.outerHTML=a,g){var M=(0,p.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(M){var R=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'+M.getAttribute("data-marker")+'"]');R&&R.setAttribute("aria-label",M.textContent.trim().substr(0,24))}}var q,D=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");D.forEach(function(P,H){H===0?c=P:(c.insertAdjacentHTML("beforeend",P.innerHTML),P.remove())}),D.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",D[0]);var B=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");B.forEach(function(P,H){H===0?q=P:(q.insertAdjacentHTML("beforeend",P.innerHTML),P.remove())}),B.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",B[0]),(0,C.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(P){we(P,e)}),n&&(n.inputType==="deleteContentBackward"||n.inputType==="deleteContentForward")&&e.options.comment.enable&&(e.wysiwyg.triggerRemoveComment(e),e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)))}Oe(e),ve(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},jn=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Rn=function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(g){try{v(i.next(g))}catch(f){o(f)}}function c(g){try{v(i.throw(g))}catch(f){o(f)}}function v(g){var f;g.done?r(g.value):(f=g.value,f instanceof n?f:new n(function(_){_(f)})).then(a,c)}v((i=i.apply(e,t||[])).next())})},Pn=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(v){return function(g){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&f[0]?i.return:f[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,f[1])).done)return r;switch(i=0,r&&(f=[2&f[0],r.value]),f[0]){case 0:case 1:r=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,i=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(r=a.trys,!((r=r.length>0&&r[r.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!r||f[1]>r[0]&&f[1]<r[3])){a.label=f[1];break}if(f[0]===6&&a.label<r[1]){a.label=r[1],r=f;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(f);break}r[2]&&a.ops.pop(),a.trys.pop();continue}f=t.call(e,a)}catch(_){f=[6,_],i=0}finally{n=r=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([v,g])}}},Xt=function(e,t,n){if(e.keyCode===229&&e.code===""&&e.key==="Unidentified"&&t.currentMode!=="sv"){var i=(0,p.F9)(n);if(i&&i.textContent.trim()==="")return t[t.currentMode].composingLock=!0,!1}return!0},Yt=function(e,t,n){if(!(n.key==="Enter"||n.key==="Tab"||n.key==="Backspace"||n.key.indexOf("Arrow")>-1||(0,l.yl)(n)||n.key==="Escape"||n.shiftKey||n.altKey)){var i=(0,p.lG)(e.startContainer,"P")||(0,p.lG)(e.startContainer,"LI");if(i&&(0,C.im)(i,t[t.currentMode].element,e).start===0){i.nodeValue&&(i.nodeValue=i.nodeValue.replace(/\u2006/g,""));var r=document.createTextNode(E.g.ZWSP);e.insertNode(r),e.setStartAfter(r)}}},Qt=function(e,t){if(t==="ArrowDown"||t==="ArrowUp"){var n=(0,p.a1)(e.startContainer,"data-type","math-inline")||(0,p.a1)(e.startContainer,"data-type","html-entity")||(0,p.a1)(e.startContainer,"data-type","html-inline");n&&(t==="ArrowDown"&&e.setStartAfter(n.parentElement),t==="ArrowUp"&&e.setStartBefore(n.parentElement))}},pt=function(e,t){var n=(0,C.zh)(e),i=(0,p.F9)(n.startContainer);i&&(i.insertAdjacentHTML(t,'<p data-block="0">'+E.g.ZWSP+`<wbr>
|
|
66
|
+
</p>`),(0,C.ib)(e[e.currentMode].element,n),Ze(e),oe(e))},qn=function(e){var t=(0,p.lG)(e,"TABLE");return!(!t||!t.rows[0].cells[0].isSameNode(e))&&t},Bn=function(e){var t=(0,p.lG)(e,"TABLE");return!(!t||!t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e))&&t},$t=function(e,t,n){n===void 0&&(n=!0);var i=e.previousElementSibling;return i||(i=e.parentElement.previousElementSibling?e.parentElement.previousElementSibling.lastElementChild:e.parentElement.parentElement.tagName==="TBODY"&&e.parentElement.parentElement.previousElementSibling?e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild:null),i&&(t.selectNodeContents(i),n||t.collapse(!1),(0,C.Hc)(t)),i},it=function(e,t,n,i,r){var o=(0,C.im)(i,e[e.currentMode].element,n);if(t.key==="ArrowDown"&&i.textContent.trimRight().substr(o.start).indexOf(`
|
|
67
|
+
`)===-1||t.key==="ArrowRight"&&o.start>=i.textContent.trimRight().length){var a=r.nextElementSibling;return!a||a&&(a.tagName==="TABLE"||a.getAttribute("data-type"))?(r.insertAdjacentHTML("afterend",'<p data-block="0">'+E.g.ZWSP+"<wbr></p>"),(0,C.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(a),n.collapse(!0),(0,C.Hc)(n)),t.preventDefault(),!0}return!1},Je=function(e,t,n,i,r){var o=(0,C.im)(i,e[e.currentMode].element,n);if(t.key==="ArrowUp"&&i.textContent.substr(0,o.start).indexOf(`
|
|
68
|
+
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&o.start===0){var a=r.previousElementSibling;return!a||a&&(a.tagName==="TABLE"||a.getAttribute("data-type"))?(r.insertAdjacentHTML("beforebegin",'<p data-block="0">'+E.g.ZWSP+"<wbr></p>"),(0,C.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(a),n.collapse(!1),(0,C.Hc)(n)),t.preventDefault(),!0}return!1},mt=function(e,t,n,i){i===void 0&&(i=!0);var r=(0,p.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach(function(f){f.remove()}),t.insertNode(document.createElement("wbr")),i&&r){for(var o="",a=0;a<r.parentElement.childElementCount;a++){var c=r.parentElement.children[a].querySelector("input");c&&c.remove(),o+='<p data-block="0">'+r.parentElement.children[a].innerHTML.trimLeft()+"</p>"}r.parentElement.insertAdjacentHTML("beforebegin",o),r.parentElement.remove()}else if(r)if(n==="check")r.parentElement.querySelectorAll("li").forEach(function(f){f.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'+(f.textContent.indexOf(" ")===0?"":" ")),f.classList.add("vditor-task")});else{r.querySelector("input")&&r.parentElement.querySelectorAll("li").forEach(function(f){f.querySelector("input").remove(),f.classList.remove("vditor-task")});var v=void 0;n==="list"?(v=document.createElement("ul")).setAttribute("data-marker","*"):(v=document.createElement("ol")).setAttribute("data-marker","1."),v.setAttribute("data-block","0"),v.setAttribute("data-tight",r.parentElement.getAttribute("data-tight")),v.innerHTML=r.parentElement.innerHTML,r.parentElement.parentNode.replaceChild(v,r.parentElement)}else{var g=(0,p.a1)(t.startContainer,"data-block","0");g||(e[e.currentMode].element.querySelector("wbr").remove(),(g=e[e.currentMode].element.querySelector("p")).innerHTML="<wbr>"),n==="check"?(g.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '+g.innerHTML+"</li></ul>"),g.remove()):n==="list"?(g.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'+g.innerHTML+"</li></ul>"),g.remove()):n==="ordered-list"&&(g.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'+g.innerHTML+"</li></ol>"),g.remove())}},en=function(e,t,n){var i=t.previousElementSibling;if(t&&i){var r=[t];Array.from(n.cloneContents().children).forEach(function(v,g){v.nodeType!==3&&t&&v.textContent.trim()!==""&&t.getAttribute("data-node-id")===v.getAttribute("data-node-id")&&(g!==0&&r.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(v){v.remove()}),n.insertNode(document.createElement("wbr"));var o=i.parentElement,a="";r.forEach(function(v){var g=v.getAttribute("data-marker");g.length!==1&&(g="1"+g.slice(-1)),a+='<li data-node-id="'+v.getAttribute("data-node-id")+'" data-marker="'+g+'">'+v.innerHTML+"</li>",v.remove()}),i.insertAdjacentHTML("beforeend","<"+o.tagName+' data-block="0">'+a+"</"+o.tagName+">"),e.currentMode==="wysiwyg"?o.outerHTML=e.lute.SpinVditorDOM(o.outerHTML):o.outerHTML=e.lute.SpinVditorIRDOM(o.outerHTML),(0,C.ib)(e[e.currentMode].element,n);var c=(0,p.O9)(n.startContainer);c&&c.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach(function(v){we(v,e),e.currentMode==="wysiwyg"&&v.previousElementSibling.setAttribute("style","display:none")}),oe(e),Ze(e)}else e[e.currentMode].element.focus()},xt=function(e,t,n,i){var r=(0,p.lG)(t.parentElement,"LI");if(r){e[e.currentMode].element.querySelectorAll("wbr").forEach(function(_){_.remove()}),n.insertNode(document.createElement("wbr"));var o=t.parentElement,a=o.cloneNode(),c=[t];Array.from(n.cloneContents().children).forEach(function(_,O){_.nodeType!==3&&t&&_.textContent.trim()!==""&&t.getAttribute("data-node-id")===_.getAttribute("data-node-id")&&(O!==0&&c.push(t),t=t.nextElementSibling)});var v=!1,g="";o.querySelectorAll("li").forEach(function(_){v&&(g+=_.outerHTML,_.nextElementSibling||_.previousElementSibling?_.remove():_.parentElement.remove()),_.isSameNode(c[c.length-1])&&(v=!0)}),c.reverse().forEach(function(_){r.insertAdjacentElement("afterend",_)}),g&&(a.innerHTML=g,c[0].insertAdjacentElement("beforeend",a)),e.currentMode==="wysiwyg"?i.outerHTML=e.lute.SpinVditorDOM(i.outerHTML):i.outerHTML=e.lute.SpinVditorIRDOM(i.outerHTML),(0,C.ib)(e[e.currentMode].element,n);var f=(0,p.O9)(n.startContainer);f&&f.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach(function(_){we(_,e),e.currentMode==="wysiwyg"&&_.previousElementSibling.setAttribute("style","display:none")}),oe(e),Ze(e)}else e[e.currentMode].element.focus()},ft=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,i=e.rows[0].cells.length,r=e.rows.length,o=0,a=0;a<r;a++)for(var c=0;c<i;c++)if(e.rows[a].cells[c].isSameNode(n)){o=c;break}for(var v=0;v<r;v++)e.rows[v].cells[o].setAttribute("align",t)},Ht=function(e){var t=e.trimRight().split(`
|
|
69
|
+
`).pop();return t!==""&&(t.replace(/ |-/g,"")===""||t.replace(/ |_/g,"")===""||t.replace(/ |\*/g,"")==="")&&t.replace(/ /g,"").length>2&&!(t.indexOf("-")>-1&&t.trimLeft().indexOf(" ")===-1&&e.trimRight().split(`
|
|
70
|
+
`).length>1)&&t.indexOf(" ")!==0&&t.indexOf(" ")!==0},Nt=function(e){var t=e.trimRight().split(`
|
|
71
|
+
`);return(e=t.pop()).indexOf(" ")!==0&&e.indexOf(" ")!==0&&(e=e.trimLeft())!==""&&t.length!==0&&(e.replace(/-/g,"")===""||e.replace(/=/g,"")==="")},oe=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?ve(e,t):e.currentMode==="ir"?Re(e,t):e.currentMode==="sv"&&Me(e,t)},tn=function(e,t,n,i){var r,o=e.startContainer,a=(0,p.lG)(o,"LI");if(a){if(!(0,l.yl)(i)&&!i.altKey&&i.key==="Enter"&&!i.shiftKey&&n&&a.contains(n)&&n.nextElementSibling)return a&&!a.textContent.endsWith(`
|
|
72
|
+
`)&&a.insertAdjacentText("beforeend",`
|
|
73
|
+
`),e.insertNode(document.createTextNode(`
|
|
74
|
+
|
|
75
|
+
`)),e.collapse(!1),oe(t),i.preventDefault(),!0;if(!((0,l.yl)(i)||i.shiftKey||i.altKey||i.key!=="Backspace"||a.previousElementSibling||e.toString()!==""||(0,C.im)(a,t[t.currentMode].element,e).start!==0))return a.nextElementSibling?(a.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'+a.innerHTML+"</p>"),a.remove()):a.parentElement.outerHTML='<p data-block="0"><wbr>'+a.innerHTML+"</p>",(0,C.ib)(t[t.currentMode].element,e),oe(t),i.preventDefault(),!0;if(!(0,l.yl)(i)&&!i.shiftKey&&!i.altKey&&i.key==="Backspace"&&a.textContent.trim().replace(E.g.ZWSP,"")===""&&e.toString()===""&&((r=a.previousElementSibling)===null||r===void 0?void 0:r.tagName)==="LI")return a.previousElementSibling.insertAdjacentText("beforeend",`
|
|
76
|
+
|
|
77
|
+
`),e.selectNodeContents(a.previousElementSibling),e.collapse(!1),a.remove(),(0,C.ib)(t[t.currentMode].element,e),oe(t),i.preventDefault(),!0;if(!(0,l.yl)(i)&&!i.altKey&&i.key==="Tab"){var c=!1;if((e.startOffset===0&&(o.nodeType===3&&!o.previousSibling||o.nodeType!==3&&o.nodeName==="LI")||a.classList.contains("vditor-task")&&e.startOffset===1&&o.previousSibling.nodeType!==3&&o.previousSibling.tagName==="INPUT")&&(c=!0),c||e.toString()!=="")return i.shiftKey?xt(t,a,e,a.parentElement):en(t,a,e),i.preventDefault(),!0}}return!1},Dt=function(e,t,n){if(e.options.tab&&n.key==="Tab")return n.shiftKey||(t.toString()===""?(t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1)):(t.extractContents(),t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1))),(0,C.Hc)(t),oe(e),n.preventDefault(),!0},nn=function(e,t,n,i){if(n){if(!(0,l.yl)(e)&&!e.altKey&&e.key==="Enter"){var r=String.raw(Pt||(Pt=jn(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),o=r.split("|");if(r.startsWith("|")&&r.endsWith("|")&&o.length>3){var a=o.map(function(){return"---"}).join("|");return a=n.textContent+`
|
|
78
|
+
`+a.substring(3,a.length-3)+`
|
|
79
|
+
|<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(a),(0,C.ib)(t[t.currentMode].element,i),oe(t),ke(t),e.preventDefault(),!0}if(Ht(n.innerHTML)&&n.previousElementSibling){var c="",v=n.innerHTML.trimRight().split(`
|
|
80
|
+
`);return v.length>1&&(v.pop(),c='<p data-block="0">'+v.join(`
|
|
81
|
+
`)+"</p>"),n.insertAdjacentHTML("afterend",c+`<hr data-block="0"><p data-block="0"><wbr>
|
|
82
|
+
</p>`),n.remove(),(0,C.ib)(t[t.currentMode].element,i),oe(t),ke(t),e.preventDefault(),!0}if(Nt(n.innerHTML))return t.currentMode==="wysiwyg"?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|
83
|
+
</p>`):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|
84
|
+
</p>`),(0,C.ib)(t[t.currentMode].element,i),oe(t),ke(t),e.preventDefault(),!0}if(i.collapsed&&n.previousElementSibling&&e.key==="Backspace"&&!(0,l.yl)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split(`
|
|
85
|
+
`).length>1&&(0,C.im)(n,t[t.currentMode].element,i).start===0){var g=(0,p.DX)(n.previousElementSibling);return g.textContent.endsWith(`
|
|
86
|
+
`)||(g.textContent=g.textContent+`
|
|
87
|
+
`),g.parentElement.insertAdjacentHTML("beforeend","<wbr>"+n.innerHTML),n.remove(),(0,C.ib)(t[t.currentMode].element,i),!1}return!1}},rn=function(e,t,n){for(var i="",r=0;r<n.parentElement.childElementCount;r++)i+='<td align="'+n.parentElement.children[r].getAttribute("align")+'"> </td>';n.tagName==="TH"?n.parentElement.parentElement.insertAdjacentHTML("afterend","<tbody><tr>"+i+"</tr></tbody>"):n.parentElement.insertAdjacentHTML("afterend","<tr>"+i+"</tr>"),oe(e)},on=function(e,t,n){for(var i="",r=0;r<n.parentElement.childElementCount;r++)n.tagName==="TH"?i+='<th align="'+n.parentElement.children[r].getAttribute("align")+'"> </th>':i+='<td align="'+n.parentElement.children[r].getAttribute("align")+'"> </td>';if(n.tagName==="TH"){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>"+i+"</tr></thead>"),t.insertNode(document.createElement("wbr"));var o=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",o),n.parentElement.parentElement.remove(),(0,C.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>"+i+"</tr>");oe(e)},ht=function(e,t,n,i){i===void 0&&(i="afterend");for(var r=0,o=n.previousElementSibling;o;)r++,o=o.previousElementSibling;for(var a=0;a<t.rows.length;a++)a===0?t.rows[a].cells[r].insertAdjacentHTML(i,"<th> </th>"):t.rows[a].cells[r].insertAdjacentHTML(i,"<td> </td>");oe(e)},an=function(e,t,n){if(n.tagName==="TD"){var i=n.parentElement.parentElement;n.parentElement.previousElementSibling?t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild):t.selectNodeContents(i.previousElementSibling.lastElementChild.lastElementChild),i.childElementCount===1?i.remove():n.parentElement.remove(),t.collapse(!1),(0,C.Hc)(t),oe(e)}},ln=function(e,t,n,i){for(var r=0,o=i.previousElementSibling;o;)r++,o=o.previousElementSibling;(i.previousElementSibling||i.nextElementSibling)&&(t.selectNodeContents(i.previousElementSibling||i.nextElementSibling),t.collapse(!0));for(var a=0;a<n.rows.length;a++){var c=n.rows[a].cells;if(c.length===1){n.remove(),Ze(e);break}c[r].remove()}(0,C.Hc)(t),oe(e)},sn=function(e,t,n){var i=n.startContainer,r=(0,p.lG)(i,"TD")||(0,p.lG)(i,"TH");if(r){if(!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"){r.lastElementChild&&(!r.lastElementChild||r.lastElementChild.isSameNode(r.lastChild)&&r.lastElementChild.tagName==="BR")||r.insertAdjacentHTML("beforeend","<br>");var o=document.createElement("br");return n.insertNode(o),n.setStartAfter(o),oe(e),ke(e),t.preventDefault(),!0}if(t.key==="Tab")return t.shiftKey?($t(r,n),t.preventDefault(),!0):((f=r.nextElementSibling)||(f=r.parentElement.nextElementSibling?r.parentElement.nextElementSibling.firstElementChild:r.parentElement.parentElement.tagName==="THEAD"&&r.parentElement.parentElement.nextElementSibling?r.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:null),f&&(n.selectNodeContents(f),(0,C.Hc)(n)),t.preventDefault(),!0);var a=r.parentElement.parentElement.parentElement;if(t.key==="ArrowUp"){if(t.preventDefault(),r.tagName==="TH")return a.previousElementSibling?(n.selectNodeContents(a.previousElementSibling),n.collapse(!1),(0,C.Hc)(n)):pt(e,"beforebegin"),!0;for(var c=0,v=r.parentElement;c<v.cells.length&&!v.cells[c].isSameNode(r);c++);var g=v.previousElementSibling;return g||(g=v.parentElement.previousElementSibling.firstChild),n.selectNodeContents(g.cells[c]),n.collapse(!1),(0,C.Hc)(n),!0}if(t.key==="ArrowDown"){var f;if(t.preventDefault(),!(v=r.parentElement).nextElementSibling&&r.tagName==="TD")return a.nextElementSibling?(n.selectNodeContents(a.nextElementSibling),n.collapse(!0),(0,C.Hc)(n)):pt(e,"afterend"),!0;for(c=0;c<v.cells.length&&!v.cells[c].isSameNode(r);c++);return(f=v.nextElementSibling)||(f=v.parentElement.nextElementSibling.firstChild),n.selectNodeContents(f.cells[c]),n.collapse(!0),(0,C.Hc)(n),!0}if(e.currentMode==="wysiwyg"&&!(0,l.yl)(t)&&t.key==="Enter"&&!t.shiftKey&&t.altKey){var _=e.wysiwyg.popover.querySelector(".vditor-input");return _.focus(),_.select(),t.preventDefault(),!0}if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Backspace"&&n.startOffset===0&&n.toString()==="")return!$t(r,n,!1)&&a&&(a.textContent.trim()===""?(a.outerHTML=`<p data-block="0"><wbr>
|
|
88
|
+
</p>`,(0,C.ib)(e[e.currentMode].element,n)):(n.setStartBefore(a),n.collapse(!0)),oe(e)),t.preventDefault(),!0;if(V("\u21E7\u2318F",t))return on(e,n,r),t.preventDefault(),!0;if(V("\u2318=",t))return rn(e,n,r),t.preventDefault(),!0;if(V("\u21E7\u2318G",t))return ht(e,a,r,"beforebegin"),t.preventDefault(),!0;if(V("\u21E7\u2318=",t))return ht(e,a,r),t.preventDefault(),!0;if(V("\u2318-",t))return an(e,n,r),t.preventDefault(),!0;if(V("\u21E7\u2318-",t))return ln(e,n,a,r),t.preventDefault(),!0;if(V("\u21E7\u2318L",t)){if(e.currentMode==="ir")return ft(a,"left"),oe(e),t.preventDefault(),!0;if(O=e.wysiwyg.popover.querySelector('[data-type="left"]'))return O.click(),t.preventDefault(),!0}if(V("\u21E7\u2318C",t)){if(e.currentMode==="ir")return ft(a,"center"),oe(e),t.preventDefault(),!0;if(O=e.wysiwyg.popover.querySelector('[data-type="center"]'))return O.click(),t.preventDefault(),!0}if(V("\u21E7\u2318R",t)){if(e.currentMode==="ir")return ft(a,"right"),oe(e),t.preventDefault(),!0;var O;if(O=e.wysiwyg.popover.querySelector('[data-type="right"]'))return O.click(),t.preventDefault(),!0}}return!1},cn=function(e,t,n,i){if(n.tagName==="PRE"&&V("\u2318A",t))return i.selectNodeContents(n.firstElementChild),t.preventDefault(),!0;if(e.options.tab&&t.key==="Tab"&&!t.shiftKey&&i.toString()==="")return i.insertNode(document.createTextNode(e.options.tab)),i.collapse(!1),oe(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey){var r=(0,C.im)(n,e[e.currentMode].element,i);if((r.start===0||r.start===1&&n.innerText===`
|
|
89
|
+
`)&&i.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'+n.firstElementChild.innerHTML+"</p>",(0,C.ib)(e[e.currentMode].element,i),oe(e),t.preventDefault(),!0}return!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"&&(n.firstElementChild.textContent.endsWith(`
|
|
90
|
+
`)||n.firstElementChild.insertAdjacentText("beforeend",`
|
|
91
|
+
`),i.extractContents(),i.insertNode(document.createTextNode(`
|
|
92
|
+
`)),i.collapse(!1),(0,C.Hc)(i),(0,l.vU)()||(e.currentMode==="wysiwyg"?ut(e,i):me(e,i)),ke(e),t.preventDefault(),!0)},dn=function(e,t,n,i){var r=t.startContainer,o=(0,p.lG)(r,"BLOCKQUOTE");if(o&&t.toString()===""){if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&(0,C.im)(o,e[e.currentMode].element,t).start===0)return t.insertNode(document.createElement("wbr")),o.outerHTML=o.innerHTML,(0,C.ib)(e[e.currentMode].element,t),oe(e),n.preventDefault(),!0;if(i&&n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&i.parentElement.tagName==="BLOCKQUOTE"){var a=!1;if(i.innerHTML.replace(E.g.ZWSP,"")===`
|
|
93
|
+
`||i.innerHTML.replace(E.g.ZWSP,"")===""?(a=!0,i.remove()):i.innerHTML.endsWith(`
|
|
94
|
+
|
|
95
|
+
`)&&(0,C.im)(i,e[e.currentMode].element,t).start===i.textContent.length-1&&(i.innerHTML=i.innerHTML.substr(0,i.innerHTML.length-2),a=!0),a)return o.insertAdjacentHTML("afterend",'<p data-block="0">'+E.g.ZWSP+`<wbr>
|
|
96
|
+
</p>`),(0,C.ib)(e[e.currentMode].element,t),oe(e),n.preventDefault(),!0}var c=(0,p.F9)(r);if(e.currentMode==="wysiwyg"&&c&&V("\u21E7\u2318;",n))return t.insertNode(document.createElement("wbr")),c.outerHTML='<blockquote data-block="0">'+c.outerHTML+"</blockquote>",(0,C.ib)(e.wysiwyg.element,t),ve(e),n.preventDefault(),!0;if(it(e,n,t,o,o)||Je(e,n,t,o,o))return!0}return!1},un=function(e,t,n){var i=t.startContainer,r=(0,p.fb)(i,"vditor-task");if(r){if(V("\u21E7\u2318J",n)){var o=r.firstElementChild;return o.checked?o.removeAttribute("checked"):o.setAttribute("checked","checked"),oe(e),n.preventDefault(),!0}if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&t.toString()===""&&t.startOffset===1&&(i.nodeType===3&&i.previousSibling&&i.previousSibling.tagName==="INPUT"||i.nodeType!==3)){var a=r.previousElementSibling;return r.querySelector("input").remove(),a?((0,p.DX)(a).parentElement.insertAdjacentHTML("beforeend","<wbr>"+r.innerHTML.trim()),r.remove()):(r.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'+(r.innerHTML.trim()||`
|
|
97
|
+
`)+"</p>"),r.nextElementSibling?r.remove():r.parentElement.remove()),(0,C.ib)(e[e.currentMode].element,t),oe(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey){if(r.textContent.trim()==="")if((0,p.fb)(r.parentElement,"vditor-task")){var c=(0,p.O9)(i);c&&xt(e,r,t,c)}else if(r.nextElementSibling){var v="",g="",f=!1;Array.from(r.parentElement.children).forEach(function(M){r.isSameNode(M)?f=!0:f?v+=M.outerHTML:g+=M.outerHTML});var _=r.parentElement.tagName,O=r.parentElement.tagName==="OL"?"":' data-marker="'+r.parentElement.getAttribute("data-marker")+'"',U="";g&&(U=r.parentElement.tagName==="UL"?"":' start="1"',g="<"+_+' data-tight="true"'+O+' data-block="0">'+g+"</"+_+">"),r.parentElement.outerHTML=g+`<p data-block="0"><wbr>
|
|
98
|
+
</p><`+_+`
|
|
99
|
+
data-tight="true"`+O+' data-block="0"'+U+">"+v+"</"+_+">"}else r.parentElement.insertAdjacentHTML("afterend",`<p data-block="0"><wbr>
|
|
100
|
+
</p>`),r.parentElement.querySelectorAll("li").length===1?r.parentElement.remove():r.remove();else i.nodeType!==3&&t.startOffset===0&&i.firstChild.tagName==="INPUT"?t.setStart(i.childNodes[1],1):(t.setEndAfter(r.lastChild),r.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'+r.getAttribute("data-marker")+'"><input type="checkbox"> <wbr></li>'),document.querySelector("wbr").after(t.extractContents()));return(0,C.ib)(e[e.currentMode].element,t),oe(e),ke(e),n.preventDefault(),!0}}return!1},pn=function(e,t,n,i){if(t.startContainer.nodeType!==3){var r=t.startContainer.children[t.startOffset];if(r&&r.tagName==="HR")return t.selectNodeContents(r.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(i){var o=i.previousElementSibling;if(o&&(0,C.im)(i,e[e.currentMode].element,t).start===0&&((0,l.vU)()&&o.tagName==="HR"||o.tagName==="TABLE")){if(o.tagName==="TABLE"){var a=o.lastElementChild.lastElementChild.lastElementChild;a.innerHTML=a.innerHTML.trimLeft()+"<wbr>"+i.textContent.trim(),i.remove()}else o.remove();return(0,C.ib)(e[e.currentMode].element,t),oe(e),n.preventDefault(),!0}}return!1},mn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},fn=function(e,t,n){var i,r;if(!(0,l.vU)())return!1;if(e.key==="ArrowUp"&&t&&((i=t.previousElementSibling)===null||i===void 0?void 0:i.tagName)==="TABLE"){var o=t.previousElementSibling;return n.selectNodeContents(o.rows[o.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return!(e.key!=="ArrowDown"||!t||((r=t.nextElementSibling)===null||r===void 0?void 0:r.tagName)!=="TABLE")&&(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0)},vt=function(e,t,n){return Rn(void 0,void 0,void 0,function(){var i,r,o,a,c,v,g,f,_,O,U,M,R,q,D,B;return Pn(this,function(P){switch(P.label){case 0:return e[e.currentMode].element.getAttribute("contenteditable")!=="true"?[2]:(t.stopPropagation(),t.preventDefault(),"clipboardData"in t?(i=t.clipboardData.getData("text/html"),r=t.clipboardData.getData("text/plain"),o=t.clipboardData.files):(i=t.dataTransfer.getData("text/html"),r=t.dataTransfer.getData("text/plain"),t.dataTransfer.types.includes("Files")&&(o=t.dataTransfer.items)),a={},c=function(H,F){if(!F)return["",Lute.WalkContinue];var $=H.TokensStr();if(H.__internal_object__.Parent.Type===34&&$&&$.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var J=new XMLHttpRequest;J.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&J.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(J.withCredentials=!0),Jt(e,J),J.setRequestHeader("Content-Type","application/json; charset=utf-8"),J.onreadystatechange=function(){if(J.readyState===XMLHttpRequest.DONE){if(J.status===200){var Q=J.responseText;e.options.upload.linkToImgFormat&&(Q=e.options.upload.linkToImgFormat(J.responseText));var Y=JSON.parse(Q);if(Y.code!==0)return void e.tip.show(Y.msg);var G=Y.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(he){he.textContent===G&&(he.textContent=Y.data.url)});else{var ne=e[e.currentMode].element.querySelector('img[src="'+G+'"]');ne.src=Y.data.url,e.currentMode==="ir"&&(ne.previousElementSibling.previousElementSibling.innerHTML=Y.data.url)}oe(e)}else e.tip.show(J.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(J.responseText)}},J.send(JSON.stringify({url:$}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'+Lute.EscapeHTMLStr($)+"</span>",Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'+Lute.EscapeHTMLStr($)+"</span>",Lute.WalkContinue]},i.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!=='<a href="'+r+'">'+r+"</a>"&&i.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi,"").trim()!=='<!--StartFragment--><a href="'+r+'">'+r+"</a><!--EndFragment-->"||(i=""),(v=new DOMParser().parseFromString(i,"text/html")).body&&(i=v.body.innerHTML),i=Lute.Sanitize(i),e.wysiwyg.getComments(e),g=e[e.currentMode].element.scrollHeight,f=function(H,F,$){$===void 0&&($="sv");var J=document.createElement("div");J.innerHTML=H;var Q=!1;J.childElementCount===1&&J.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(Q=!0);var Y=J.querySelectorAll("pre");if(J.childElementCount===1&&Y.length===1&&Y[0].className!=="vditor-wysiwyg"&&Y[0].className!=="vditor-sv"&&(Q=!0),H.indexOf(`
|
|
101
|
+
<p class="p1">`)===0&&(Q=!0),J.childElementCount===1&&J.firstElementChild.tagName==="TABLE"&&J.querySelector(".line-number")&&J.querySelector(".line-content")&&(Q=!0),Q){var G=F||H;return/\n/.test(G)||Y.length===1?$==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'+G.replace(/&/g,"&").replace(/</g,"<")+"<wbr></code></pre></div>":"\n```\n"+G.replace(/&/g,"&").replace(/</g,"<")+"\n```":$==="wysiwyg"?"<code>"+G.replace(/&/g,"&").replace(/</g,"<")+"</code><wbr>":"`"+G+"`"}return!1}(i,r,e.currentMode),(_=e.currentMode==="sv"?(0,p.a1)(t.target,"data-type","code-block"):(0,p.lG)(t.target,"CODE"))?(e.currentMode==="sv"?document.execCommand("insertHTML",!1,r.replace(/&/g,"&").replace(/</g,"<")):(O=(0,C.im)(t.target,e[e.currentMode].element),_.parentElement.tagName!=="PRE"&&(r+=E.g.ZWSP),_.textContent=_.textContent.substring(0,O.start)+r+_.textContent.substring(O.end),(0,C.$j)(O.start+r.length,O.start+r.length,_.parentElement),!((B=_.parentElement)===null||B===void 0)&&B.nextElementSibling.classList.contains("vditor-"+e.currentMode+"__preview")&&(_.parentElement.nextElementSibling.innerHTML=_.outerHTML,we(_.parentElement.nextElementSibling,e))),[3,8]):[3,1]);case 1:return f?(n.pasteCode(f),[3,8]):[3,2];case 2:return i.trim()===""?[3,3]:((U=document.createElement("div")).innerHTML=i,U.querySelectorAll("[style]").forEach(function(H){H.removeAttribute("style")}),U.querySelectorAll(".vditor-copy").forEach(function(H){H.remove()}),e.currentMode==="ir"?(a.HTML2VditorIRDOM={renderLinkDest:c},e.lute.SetJSRenderers({renderers:a}),(0,C.oC)(e.lute.HTML2VditorIRDOM(U.innerHTML),e)):e.currentMode==="wysiwyg"?(a.HTML2VditorDOM={renderLinkDest:c},e.lute.SetJSRenderers({renderers:a}),(0,C.oC)(e.lute.HTML2VditorDOM(U.innerHTML),e)):(a.Md2VditorSVDOM={renderLinkDest:c},e.lute.SetJSRenderers({renderers:a}),Kt(e,e.lute.HTML2Md(U.innerHTML).trimRight())),e.outline.render(e),[3,8]);case 3:return o.length>0?e.options.upload.url||e.options.upload.handler?[4,_t(e,o)]:[3,5]:[3,7];case 4:return P.sent(),[3,6];case 5:M=new FileReader,"clipboardData"in t?(o=t.clipboardData.files,R=o[0]):t.dataTransfer.types.includes("Files")&&(o=t.dataTransfer.items,R=o[0].getAsFile()),R&&R.type.startsWith("image")&&(M.readAsDataURL(R),M.onload=function(){var H="";e.currentMode==="wysiwyg"?H+='<img alt="'+R.name+'" src="'+M.result.toString()+`">
|
|
102
|
+
`:H+="+`)
|
|
103
|
+
`,document.execCommand("insertHTML",!1,H)}),P.label=6;case 6:return[3,8];case 7:r.trim()!==""&&o.length===0&&((D=(0,C.zh)(e)).toString()!==""&&e.lute.IsValidLinkDest(r)&&(r="["+D.toString()+"]("+r+")"),e.currentMode==="ir"?(a.Md2VditorIRDOM={renderLinkDest:c},e.lute.SetJSRenderers({renderers:a}),(0,C.oC)(e.lute.Md2VditorIRDOM(r),e)):e.currentMode==="wysiwyg"?(a.Md2VditorDOM={renderLinkDest:c},e.lute.SetJSRenderers({renderers:a}),(0,C.oC)(e.lute.Md2VditorDOM(r),e)):(a.Md2VditorSVDOM={renderLinkDest:c},e.lute.SetJSRenderers({renderers:a}),Kt(e,r)),e.outline.render(e)),P.label=8;case 8:return e.currentMode!=="sv"&&((q=(0,p.F9)((0,C.zh)(e).startContainer))&&(D=(0,C.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(H){H.remove()}),D.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?q.outerHTML=e.lute.SpinVditorDOM(q.outerHTML):q.outerHTML=e.lute.SpinVditorIRDOM(q.outerHTML),(0,C.ib)(e[e.currentMode].element,D)),e[e.currentMode].element.querySelectorAll(".vditor-"+e.currentMode+"__preview[data-render='2']").forEach(function(H){we(H,e)})),e.wysiwyg.triggerRemoveComment(e),oe(e),e[e.currentMode].element.scrollHeight-g>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&ke(e),[2]}})})},hn=function(e){e.hint.render(e);var t=(0,C.zh)(e).startContainer,n=(0,p.a1)(t,"data-type","code-block-info");if(n)if(n.textContent.replace(E.g.ZWSP,"")===""&&e.hint.recentLanguage)n.textContent=E.g.ZWSP+e.hint.recentLanguage,(0,C.zh)(e).selectNodeContents(n);else{var i=[],r=n.textContent.substring(0,(0,C.im)(n,e.ir.element).start).replace(E.g.ZWSP,"");(e.options.preview.hljs.langs||E.g.CODE_LANGUAGES).forEach(function(o){o.indexOf(r.toLowerCase())>-1&&i.push({html:o,value:o})}),e.hint.genHTML(i,r,e)}},Re=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&hn(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.composingLock){var n=m(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,l.pK)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}},e.options.undoDelay)},ot=function(e,t){var n=(0,C.zh)(e),i=(0,p.F9)(n.startContainer)||n.startContainer;if(i){var r=i.querySelector(".vditor-ir__marker--heading");r?r.innerHTML=t:(i.insertAdjacentText("afterbegin",t),n.selectNodeContents(i),n.collapse(!1)),me(e,n.cloneRange()),et(e)}},gt=function(e,t,n){var i=(0,p.a1)(e.startContainer,"data-type",n);if(i){i.firstElementChild.remove(),i.lastElementChild.remove(),e.insertNode(document.createElement("wbr"));var r=document.createElement("div");r.innerHTML=t.lute.SpinVditorIRDOM(i.outerHTML),i.outerHTML=r.firstElementChild.innerHTML.trim()}},Vn=function(e,t,n,i){var r=(0,C.zh)(e),o=t.getAttribute("data-type"),a=r.startContainer;a.nodeType===3&&(a=a.parentElement);var c=!0;if(t.classList.contains("vditor-menu--current"))if(o==="quote"){var v=(0,p.lG)(a,"BLOCKQUOTE");v&&(r.insertNode(document.createElement("wbr")),v.outerHTML=v.innerHTML.trim()===""?'<p data-block="0">'+v.innerHTML+"</p>":v.innerHTML)}else if(o==="link"){var g=(0,p.a1)(r.startContainer,"data-type","a");if(g){var f=(0,p.fb)(r.startContainer,"vditor-ir__link");f?(r.insertNode(document.createElement("wbr")),g.outerHTML=f.innerHTML):g.outerHTML=g.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else o==="italic"?gt(r,e,"em"):o==="bold"?gt(r,e,"strong"):o==="strike"?gt(r,e,"s"):o==="inline-code"?gt(r,e,"code"):o!=="check"&&o!=="list"&&o!=="ordered-list"||(mt(e,r,o),c=!1,t.classList.remove("vditor-menu--current"));else{e.ir.element.childNodes.length===0&&(e.ir.element.innerHTML='<p data-block="0"><wbr></p>',(0,C.ib)(e.ir.element,r));var _=(0,p.F9)(r.startContainer);if(o==="line"){if(_){var O=`<hr data-block="0"><p data-block="0"><wbr>
|
|
104
|
+
</p>`;_.innerHTML.trim()===""?_.outerHTML=O:_.insertAdjacentHTML("afterend",O)}}else if(o==="quote")_&&(r.insertNode(document.createElement("wbr")),_.outerHTML='<blockquote data-block="0">'+_.outerHTML+"</blockquote>",c=!1,t.classList.add("vditor-menu--current"));else if(o==="link"){var U=void 0;U=r.toString()===""?n+"<wbr>"+i:""+n+r.toString()+i.replace(")","<wbr>)"),document.execCommand("insertHTML",!1,U),c=!1,t.classList.add("vditor-menu--current")}else if(o==="italic"||o==="bold"||o==="strike"||o==="inline-code"||o==="code"||o==="table"){U=void 0,r.toString()===""?U=n+"<wbr>"+i:(U=o==="code"?n+`
|
|
105
|
+
`+r.toString()+"<wbr>"+i:o==="table"?""+n+r.toString()+"<wbr>"+i:""+n+r.toString()+i+"<wbr>",r.deleteContents()),o!=="table"&&o!=="code"||(U=`
|
|
106
|
+
`+U+`
|
|
107
|
+
|
|
108
|
+
`);var M=document.createElement("span");M.innerHTML=U,r.insertNode(M),me(e,r),o==="table"&&(r.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,C.Hc)(r))}else o!=="check"&&o!=="list"&&o!=="ordered-list"||(mt(e,r,o,!1),c=!1,u(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,C.ib)(e.ir.element,r),Re(e),c&&et(e)},Un=function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(g){try{v(i.next(g))}catch(f){o(f)}}function c(g){try{v(i.throw(g))}catch(f){o(f)}}function v(g){var f;g.done?r(g.value):(f=g.value,f instanceof n?f:new n(function(_){_(f)})).then(a,c)}v((i=i.apply(e,t||[])).next())})},Wn=function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(v){return function(g){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&f[0]?i.return:f[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,f[1])).done)return r;switch(i=0,r&&(f=[2&f[0],r.value]),f[0]){case 0:case 1:r=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,i=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(r=a.trys,!((r=r.length>0&&r[r.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!r||f[1]>r[0]&&f[1]<r[3])){a.label=f[1];break}if(f[0]===6&&a.label<r[1]){a.label=r[1],r=f;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(f);break}r[2]&&a.ops.pop(),a.trys.pop();continue}f=t.call(e,a)}catch(_){f=[6,_],i=0}finally{n=r=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([v,g])}}},zn=function(){function e(t){var n=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(i,r){n.element.style.display="none";var o=decodeURIComponent(i.getAttribute("data-value")),a=window.getSelection().getRangeAt(0);if(r.currentMode==="ir"){var c=(0,p.a1)(a.startContainer,"data-type","code-block-info");if(c)return c.textContent=E.g.ZWSP+o.trimRight(),a.selectNodeContents(c),a.collapse(!1),Re(r),c.parentElement.querySelectorAll("code").forEach(function(_){_.className="language-"+o.trimRight()}),we(c.parentElement.querySelector(".vditor-ir__preview"),r),void(n.recentLanguage=o.trimRight())}if(r.currentMode==="wysiwyg"&&a.startContainer.nodeType!==3){var v=a.startContainer,g=void 0;if((g=v.classList.contains("vditor-input")?v:v.firstElementChild)&&g.classList.contains("vditor-input"))return g.value=o.trimRight(),a.selectNodeContents(g),a.collapse(!1),g.dispatchEvent(new CustomEvent("input",{detail:1})),void(n.recentLanguage=o.trimRight())}if(a.setStart(a.startContainer,n.lastIndex),a.deleteContents(),r.options.hint.parse?r.currentMode==="sv"?(0,C.oC)(r.lute.SpinVditorSVDOM(o),r):r.currentMode==="wysiwyg"?(0,C.oC)(r.lute.SpinVditorDOM(o),r):(0,C.oC)(r.lute.SpinVditorIRDOM(o),r):(0,C.oC)(o,r),n.splitChar===":"&&o.indexOf(":")>-1&&r.currentMode!=="sv"&&a.insertNode(document.createTextNode(" ")),a.collapse(!1),(0,C.Hc)(a),r.currentMode==="wysiwyg")(f=(0,p.fb)(a.startContainer,"vditor-wysiwyg__block"))&&f.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(f.lastElementChild.innerHTML=f.firstElementChild.innerHTML,we(f.lastElementChild,r));else if(r.currentMode==="ir"){var f;(f=(0,p.fb)(a.startContainer,"vditor-ir__marker--pre"))&&f.nextElementSibling.classList.contains("vditor-ir__preview")&&(f.nextElementSibling.innerHTML=f.innerHTML,we(f.nextElementSibling,r))}oe(r)},this.timeId=-1,this.element=document.createElement("div"),this.element.className="vditor-hint",this.recentLanguage="",t.push({key:":"})}return e.prototype.render=function(t){var n=this;if(window.getSelection().focusNode){var i,r=getSelection().getRangeAt(0);i=r.startContainer.textContent.substring(0,r.startOffset)||"";var o=this.getKey(i,t.options.hint.extend);if(o===void 0)this.element.style.display="none",clearTimeout(this.timeId);else if(this.splitChar===":"){var a=o===""?t.options.hint.emoji:t.lute.GetEmojis(),c=[];Object.keys(a).forEach(function(v){v.indexOf(o.toLowerCase())===0&&(a[v].indexOf(".")>-1?c.push({html:'<img src="'+a[v]+'" title=":'+v+':"/> :'+v+":",value:":"+v+":"}):c.push({html:'<span class="vditor-hint__emoji">'+a[v]+"</span>"+v,value:a[v]}))}),this.genHTML(c,o,t)}else t.options.hint.extend.forEach(function(v){v.key===n.splitChar&&(clearTimeout(n.timeId),n.timeId=window.setTimeout(function(){return Un(n,void 0,void 0,function(){var g;return Wn(this,function(f){switch(f.label){case 0:return g=this.genHTML,[4,v.hint(o)];case 1:return g.apply(this,[f.sent(),o,t]),[2]}})})},t.options.hint.delay))})}},e.prototype.genHTML=function(t,n,i){var r=this;if(t.length!==0){var o=i[i.currentMode].element,a=(0,C.Ny)(o),c=a.left+(i.options.outline.position==="left"?i.outline.element.offsetWidth:0),v=a.top,g="";t.forEach(function(_,O){if(!(O>7)){var U=_.html;if(n!==""){var M=U.lastIndexOf(">")+1,R=U.substr(M),q=R.toLowerCase().indexOf(n.toLowerCase());q>-1&&(R=R.substring(0,q)+"<b>"+R.substring(q,q+n.length)+"</b>"+R.substring(q+n.length),U=U.substr(0,M)+R)}g+='<button type="button" data-value="'+encodeURIComponent(_.value)+` "
|
|
109
|
+
`+(O===0?"class='vditor-hint--current'":"")+"> "+U+"</button>"}}),this.element.innerHTML=g;var f=parseInt(document.defaultView.getComputedStyle(o,null).getPropertyValue("line-height"),10);this.element.style.top=v+(f||22)+"px",this.element.style.left=c+"px",this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(_){_.addEventListener("click",function(O){r.fillEmoji(_,i),O.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top=v-this.element.offsetHeight+"px"),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")}else this.element.style.display="none"},e.prototype.select=function(t,n){if(this.element.querySelectorAll("button").length===0||this.element.style.display==="none")return!1;var i=this.element.querySelector(".vditor-hint--current");if(t.key==="ArrowDown")return t.preventDefault(),t.stopPropagation(),i.removeAttribute("class"),i.nextElementSibling?i.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),i.removeAttribute("class"),i.previousElementSibling)i.previousElementSibling.className="vditor-hint--current";else{var r=this.element.children.length;this.element.children[r-1].className="vditor-hint--current"}return!0}return!((0,l.yl)(t)||t.shiftKey||t.altKey||t.key!=="Enter"||t.isComposing)&&(t.preventDefault(),t.stopPropagation(),this.fillEmoji(i,n),!0)},e.prototype.getKey=function(t,n){var i,r=this;if(this.lastIndex=-1,this.splitChar="",n.forEach(function(v){var g=t.lastIndexOf(v.key);r.lastIndex<g&&(r.splitChar=v.key,r.lastIndex=g)}),this.lastIndex===-1)return i;var o=t.split(this.splitChar),a=o[o.length-1];if(o.length>1&&a.trim()===a)if(o.length===2&&o[0]===""&&o[1].length<32)i=o[1];else{var c=o[o.length-2].slice(-1);(0,d.X)(c)===" "&&a.length<32&&(i=a)}return i},e}(),Kn=function(){function e(t){this.composingLock=!1;var n=document.createElement("div");n.className="vditor-ir",n.innerHTML='<pre class="vditor-reset" placeholder="'+t.options.placeholder+`"
|
|
110
|
+
contenteditable="true" spellcheck="false"></pre>`,this.element=n.firstElementChild,this.bindEvent(t),kt(t,this.element),zt(t,this.element),St(t,this.element),Ct(t,this.element),At(t,this.element),Lt(t,this.element),Mt(t,this.element,this.copy),Tt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){var i=getSelection().getRangeAt(0);if(i.toString()!==""){t.stopPropagation(),t.preventDefault();var r=document.createElement("div");r.appendChild(i.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorIRDOM2Md(r.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(i){vt(t,i,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})}),this.element.addEventListener("scroll",function(){w(t,["hint"])}),this.element.addEventListener("compositionstart",function(i){n.composingLock=!0}),this.element.addEventListener("compositionend",function(i){(0,l.vU)()||me(t,getSelection().getRangeAt(0).cloneRange()),n.composingLock=!1}),this.element.addEventListener("input",function(i){if(i.inputType!=="deleteByDrag"&&i.inputType!=="insertFromDrop")return n.preventInput?(n.preventInput=!1,void Re(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})):void(n.composingLock||i.data==="\u2018"||i.data==="\u201C"||i.data==="\u300A"||me(t,getSelection().getRangeAt(0).cloneRange(),!1,i))}),this.element.addEventListener("click",function(i){if(i.target.tagName==="INPUT")return i.target.checked?i.target.setAttribute("checked","checked"):i.target.removeAttribute("checked"),n.preventInput=!0,void Re(t);var r=(0,C.zh)(t),o=(0,p.fb)(i.target,"vditor-ir__preview");if(o||(o=(0,p.fb)(r.startContainer,"vditor-ir__preview")),o&&(o.previousElementSibling.firstElementChild?r.selectNodeContents(o.previousElementSibling.firstElementChild):r.selectNodeContents(o.previousElementSibling),r.collapse(!0),(0,C.Hc)(r),ke(t)),i.target.tagName==="IMG"){var a=i.target.parentElement.querySelector(".vditor-ir__marker--link");a&&(r.selectNode(a),(0,C.Hc)(r))}var c=(0,p.a1)(i.target,"data-type","a");if(!c||c.classList.contains("vditor-ir__node--expand")){if(i.target.isEqualNode(n.element)&&n.element.lastElementChild&&r.collapsed){var v=n.element.lastElementChild.getBoundingClientRect();i.y>v.top+v.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(E.g.ZWSP,"")===""?(r.selectNodeContents(n.element.lastElementChild),r.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'+E.g.ZWSP+"<wbr></p>"),(0,C.ib)(n.element,r)))}r.toString()===""?j(r,t):setTimeout(function(){j((0,C.zh)(t),t)}),st(i,t),et(t)}else t.options.link.click?t.options.link.click(c.querySelector(":scope > .vditor-ir__marker--link")):t.options.link.isOpen&&window.open(c.querySelector(":scope > .vditor-ir__marker--link").textContent)}),this.element.addEventListener("keyup",function(i){if(!i.isComposing&&!(0,l.yl)(i))if(i.key==="Enter"&&ke(t),et(t),i.key!=="Backspace"&&i.key!=="Delete"||t.ir.element.innerHTML===""||t.ir.element.childNodes.length!==1||!t.ir.element.firstElementChild||t.ir.element.firstElementChild.tagName!=="P"||t.ir.element.firstElementChild.childElementCount!==0||t.ir.element.textContent!==""&&t.ir.element.textContent!==`
|
|
111
|
+
`){var r=(0,C.zh)(t);i.key==="Backspace"?((0,l.vU)()&&r.startContainer.textContent===`
|
|
112
|
+
`&&r.startOffset===1&&(r.startContainer.textContent="",j(r,t)),n.element.querySelectorAll(".language-math").forEach(function(a){var c=a.querySelector("br");c&&c.remove()})):i.key.indexOf("Arrow")>-1?(i.key!=="ArrowLeft"&&i.key!=="ArrowRight"||hn(t),j(r,t)):i.keyCode===229&&i.code===""&&i.key==="Unidentified"&&j(r,t);var o=(0,p.fb)(r.startContainer,"vditor-ir__preview");if(o){if(i.key==="ArrowUp"||i.key==="ArrowLeft")return o.previousElementSibling.firstElementChild?r.selectNodeContents(o.previousElementSibling.firstElementChild):r.selectNodeContents(o.previousElementSibling),r.collapse(!1),i.preventDefault(),!0;if(o.tagName==="SPAN"&&(i.key==="ArrowDown"||i.key==="ArrowRight"))return o.parentElement.getAttribute("data-type")==="html-entity"?(o.parentElement.insertAdjacentText("afterend",E.g.ZWSP),r.setStart(o.parentElement.nextSibling,1)):r.selectNodeContents(o.parentElement.lastElementChild),r.collapse(!1),i.preventDefault(),!0}}else t.ir.element.innerHTML=""})},e}(),vn=function(e){return e.currentMode==="sv"?e.lute.Md2HTML(m(e)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML):void 0},Gn=le(895),gn=le(818),Fn=function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-outline",this.element.innerHTML='<div class="vditor-outline__title">'+t+`</div>
|
|
113
|
+
<div class="vditor-outline__content"></div>`}return e.prototype.render=function(t){return t.preview.element.style.display==="block"?(0,gn.k)(t.preview.previewElement,this.element.lastElementChild,t):(0,gn.k)(t[t.currentMode].element,this.element.lastElementChild,t)},e.prototype.toggle=function(t,n,i){var r;n===void 0&&(n=!0),i===void 0&&(i=!0);var o=(r=t.toolbar.elements.outline)===null||r===void 0?void 0:r.firstElementChild;if(n&&window.innerWidth>=E.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),o==null||o.classList.add("vditor-menu--current")):(this.element.style.display="none",o==null||o.classList.remove("vditor-menu--current")),i&&getSelection().rangeCount>0){var a=getSelection().getRangeAt(0);t[t.currentMode].element.contains(a.startContainer)&&(0,C.Hc)(a)}de(t)},e}(),Zn=le(554),Jn=function(){function e(t){var n=this;this.element=document.createElement("div"),this.element.className="vditor-preview",this.previewElement=document.createElement("div"),this.previewElement.className="vditor-reset",t.options.classes.preview&&this.previewElement.classList.add(t.options.classes.preview),this.previewElement.style.maxWidth=t.options.preview.maxWidth+"px",this.previewElement.addEventListener("copy",function(v){if(v.target.tagName!=="TEXTAREA"){var g=document.createElement("div");g.className="vditor-reset",g.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,g,"default"),v.preventDefault()}}),this.previewElement.addEventListener("click",function(v){var g=(0,p.lG)(v.target,"SPAN");if(g&&(0,p.fb)(g,"vditor-toc")){var f=n.previewElement.querySelector("#"+g.getAttribute("data-target-id"));f&&(n.element.scrollTop=f.offsetTop)}else{if(v.target.tagName==="A")return t.options.link.click?t.options.link.click(v.target):t.options.link.isOpen&&window.open(v.target.getAttribute("href")),void v.preventDefault();v.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(v.target):t.options.image.isPreview&&(0,re.E)(v.target,t.options.lang,t.options.theme))}}),this.element.appendChild(this.previewElement);var i=t.options.preview.actions;if(i.length!==0){var r=document.createElement("div");r.className="vditor-preview__action";for(var o=[],a=0;a<i.length;a++){var c=i[a];if(typeof c!="object")switch(c){case"desktop":o.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":o.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":o.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":o.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="\u590D\u5236\u5230\u516C\u4F17\u53F7"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":o.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="\u590D\u5236\u5230\u77E5\u4E4E"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>')}else o.push('<button type="button" data-type="'+c.key+'" class="'+c.className+'"'+(c.tooltip?' aria-label="'+c.tooltip+'"':"")+'">'+c.text+"</button>")}r.innerHTML=o.join(""),r.addEventListener((0,l.Le)(),function(v){var g=(0,x.S)(v.target,"BUTTON");if(g){var f=g.getAttribute("data-type"),_=i.find(function(O){return(O==null?void 0:O.key)===f});_?_.click(f):f!=="mp-wechat"&&f!=="zhihu"?(n.previewElement.style.width=f==="desktop"?"auto":f==="tablet"?"780px":"360px",n.previewElement.scrollWidth>n.previewElement.parentElement.clientWidth&&(n.previewElement.style.width="auto"),n.render(t),r.querySelectorAll("button").forEach(function(O){O.classList.remove("vditor-preview__action--current")}),g.classList.add("vditor-preview__action--current")):n.copyToX(t,n.previewElement.cloneNode(!0),f)}}),this.element.insertBefore(r,this.previewElement)}}return e.prototype.render=function(t,n){var i=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display!=="none")if(n)this.previewElement.innerHTML=n;else if(m(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")!==""){var r=new Date().getTime(),o=m(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var a=new XMLHttpRequest;a.open("POST",t.options.preview.url),a.setRequestHeader("Content-Type","application/json;charset=UTF-8"),a.onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE)if(a.status===200){var v=JSON.parse(a.responseText);if(v.code!==0)return void t.tip.show(v.msg);t.options.preview.transform&&(v.data=t.options.preview.transform(v.data)),i.previewElement.innerHTML=v.data,i.afterRender(t,r)}else{var g=t.lute.Md2HTML(o);t.options.preview.transform&&(g=t.options.preview.transform(g)),i.previewElement.innerHTML=g,i.afterRender(t,r)}},a.send(JSON.stringify({markdownText:o}))}else{var c=t.lute.Md2HTML(o);t.options.preview.transform&&(c=t.options.preview.transform(c)),i.previewElement.innerHTML=c,i.afterRender(t,r)}},t.options.preview.delay)}else this.previewElement.innerHTML="";else this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide()},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var i=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",i.toString())),t.preview.element.setAttribute("data-type","renderPerformance")):t.preview.element.getAttribute("data-type")==="renderPerformance"&&(t.tip.hide(),t.preview.element.removeAttribute("data-type"));var r=t.preview.element.querySelector(".vditor-comment--focus");r&&r.classList.remove("vditor-comment--focus"),(0,Z.O)(t.preview.previewElement,t.options.preview.hljs),(0,ce.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,fe.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,Le.K)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,te.P)(t.preview.previewElement,t.options.cdn),(0,pe.v)(t.preview.previewElement,t.options.cdn),(0,N.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,Ee.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,Be.B)(t.preview.previewElement,t.options.cdn),(0,W.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,Zn.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(c){c.render(t.preview.previewElement,t)});var o=t.preview.element,a=t.outline.render(t);a===""&&(a="[ToC]"),o.querySelectorAll('[data-type="toc-block"]').forEach(function(c){c.innerHTML=a,(0,se.H)(c,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,se.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,i){i===void 0&&(i="mp-wechat"),i!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(o){o.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(o){o.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'+o.getAttribute("data-math")+'\\" style="display: block; margin: 0 auto; max-width: 100%;">'}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(o){o.style.backgroundImage="none"}),this.element.append(n);var r=n.ownerDocument.createRange();r.selectNode(n),(0,C.Hc)(r),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(i)?"\u5DF2\u590D\u5236\uFF0C\u53EF\u5230"+(i==="zhihu"?"\u77E5\u4E4E":"\u5FAE\u4FE1\u516C\u4F17\u53F7\u5E73\u53F0")+"\u8FDB\u884C\u7C98\u8D34":"\u5DF2\u590D\u5236\u5230\u526A\u5207\u677F")},e}(),Xn=function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--"+t.options.resize.position,this.element.innerHTML='<div><svg><use xlink:href="#vditor-icon-resize"></use></svg></div>',this.bindEvent(t)}return e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("mousedown",function(i){var r=document,o=i.clientY,a=t.element.offsetHeight,c=63+t.element.querySelector(".vditor-toolbar").clientHeight;r.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),r.onmousemove=function(v){t.options.resize.position==="top"?t.element.style.height=Math.max(c,a+(o-v.clientY))+"px":t.element.style.height=Math.max(c,a+(v.clientY-o))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},r.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-a),window.captureEvents&&window.captureEvents(),r.onmousemove=null,r.onmouseup=null,r.ondragstart=null,r.onselectstart=null,r.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e}(),Yn=function(){function e(t){this.composingLock=!1,this.element=document.createElement("pre"),this.element.className="vditor-sv vditor-reset",this.element.setAttribute("placeholder",t.options.placeholder),this.element.setAttribute("contenteditable","true"),this.element.setAttribute("spellcheck","false"),this.bindEvent(t),kt(t,this.element),St(t,this.element),Ct(t,this.element),At(t,this.element),Lt(t,this.element),Mt(t,this.element,this.copy),Tt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",rt(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(i){vt(t,i,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var i=n.element.scrollTop,r=n.element.clientHeight,o=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),a=t.preview.element;a.scrollTop=i/r>.5?(i+r)*a.scrollHeight/o-r:i*a.scrollHeight/o}}),this.element.addEventListener("compositionstart",function(i){n.composingLock=!0}),this.element.addEventListener("compositionend",function(i){(0,l.vU)()||ie(t,i),n.composingLock=!1}),this.element.addEventListener("input",function(i){if(i.inputType!=="deleteByDrag"&&i.inputType!=="insertFromDrop"&&!n.composingLock&&i.data!=="\u2018"&&i.data!=="\u201C"&&i.data!=="\u300A")return n.preventInput?(n.preventInput=!1,void Me(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})):void ie(t,i)}),this.element.addEventListener("keyup",function(i){i.isComposing||(0,l.yl)(i)||(i.key!=="Backspace"&&i.key!=="Delete"||t.sv.element.innerHTML===""||t.sv.element.childNodes.length!==1||!t.sv.element.firstElementChild||t.sv.element.firstElementChild.tagName!=="DIV"||t.sv.element.firstElementChild.childElementCount!==2||t.sv.element.firstElementChild.textContent!==""&&t.sv.element.textContent!==`
|
|
114
|
+
`?i.key==="Enter"&&ke(t):t.sv.element.innerHTML="")})},e}(),yn=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(t,n){var i=this;n===void 0&&(n=6e3),this.element.className="vditor-tip vditor-tip--show",n===0?(this.element.innerHTML='<div class="vditor-tip__content">'+t+`
|
|
115
|
+
<div class="vditor-tip__close">X</div></div>`,this.element.querySelector(".vditor-tip__close").addEventListener("click",function(){i.hide()})):(this.element.innerHTML='<div class="vditor-tip__content">'+t+"</div>",setTimeout(function(){i.hide()},n)),this.element.removeAttribute("style"),setTimeout(function(){i.element.getBoundingClientRect().top<46&&(i.element.style.position="fixed",i.element.style.top="46px")},150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e}(),Ot=function(e,t){if(t.options.preview.mode!==e){switch(t.options.preview.mode=e,e){case"both":t.sv.element.style.display="block",t.preview.element.style.display="block",t.preview.render(t),h(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",u(t.toolbar.elements,["both"])}t.devtools&&t.devtools.renderEchart(t)}},Qn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),$n=function(e){function t(n,i){var r=e.call(this,n,i)||this;return n.options.preview.mode==="both"&&r.element.children[0].classList.add("vditor-menu--current"),r.element.children[0].addEventListener((0,l.Le)(),function(o){r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||(o.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Ot("editor",n):Ot("both",n)))}),r}return Qn(t,e),t}(ye),er=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"},bn=le(312),tr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),nr=function(e){function t(n,i){var r=e.call(this,n,i)||this,o=r.element.children[0],a=document.createElement("div");a.className="vditor-hint"+(i.level===2?"":" vditor-panel--arrow");var c="";return E.g.CODE_THEME.forEach(function(v){c+="<button>"+v+"</button>"}),a.innerHTML='<div style="overflow: auto;max-height:'+window.innerHeight/2+'px">'+c+"</div>",a.addEventListener((0,l.Le)(),function(v){v.target.tagName==="BUTTON"&&(w(n,["subToolbar"]),n.options.preview.hljs.style=v.target.textContent,(0,bn.Y)(v.target.textContent,n.options.cdn),v.preventDefault(),v.stopPropagation())}),r.element.appendChild(a),k(n,a,o,i.level),r}return tr(t,e),t}(ye),rr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),ir=function(e){function t(n,i){var r=e.call(this,n,i)||this,o=r.element.children[0],a=document.createElement("div");a.className="vditor-hint"+(i.level===2?"":" vditor-panel--arrow");var c="";return Object.keys(n.options.preview.theme.list).forEach(function(v){c+='<button data-type="'+v+'">'+n.options.preview.theme.list[v]+"</button>"}),a.innerHTML='<div style="overflow: auto;max-height:'+window.innerHeight/2+'px">'+c+"</div>",a.addEventListener((0,l.Le)(),function(v){v.target.tagName==="BUTTON"&&(w(n,["subToolbar"]),n.options.preview.theme.current=v.target.getAttribute("data-type"),(0,Te.Z)(n.options.preview.theme.current,n.options.preview.theme.path),v.preventDefault(),v.stopPropagation())}),r.element.appendChild(a),k(n,a,o,i.level),r}return rr(t,e),t}(ye),or=function(){function e(t){this.element=document.createElement("span"),this.element.className="vditor-counter vditor-tooltipped vditor-tooltipped__nw",this.render(t,"")}return e.prototype.render=function(t,n){var i=n.endsWith(`
|
|
116
|
+
`)?n.length-1:n.length;if(t.options.counter.type==="text"&&t[t.currentMode]){var r=t[t.currentMode].element.cloneNode(!0);r.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(o){o.remove()}),i=r.textContent.length}typeof t.options.counter.max=="number"?(i>t.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML=i+"/"+t.options.counter.max):this.element.innerHTML=""+i,this.element.setAttribute("aria-label",t.options.counter.type),t.options.counter.after&&t.options.counter.after(i,{enable:t.options.counter.enable,max:t.options.counter.max,type:t.options.counter.type})},e}(),ar=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),lr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].innerHTML=i.icon,r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),o.currentTarget.classList.contains(E.g.CLASS_MENU_DISABLED)||i.click(o,n)}),r}return ar(t,e),t}(ye),sr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),cr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.firstElementChild.addEventListener((0,l.Le)(),function(o){var a=r.element.firstElementChild;a.classList.contains(E.g.CLASS_MENU_DISABLED)||(o.preventDefault(),a.classList.contains("vditor-menu--current")?(a.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",de(n)):(a.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",de(n),n.devtools.renderEchart(n)))}),r}return sr(t,e),t}(ye),dr=function(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"},ur=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),pr=function(e){function t(n,i){var r=e.call(this,n,i)||this,o=document.createElement("div");o.className="vditor-panel vditor-panel--arrow";var a="";return Object.keys(n.options.hint.emoji).forEach(function(c){var v=n.options.hint.emoji[c];v.indexOf(".")>-1?a+='<button data-value=":'+c+': " data-key=":'+c+`:"><img
|
|
117
|
+
data-value=":`+c+': " data-key=":'+c+':" class="vditor-emojis__icon" src="'+v+'"/></button>':a+='<button data-value="'+v+` "
|
|
118
|
+
data-key="`+c+'"><span class="vditor-emojis__icon">'+v+"</span></button>"}),o.innerHTML='<div class="vditor-emojis" style="max-height: '+(n.options.height==="auto"?"auto":n.options.height-80)+'px">'+a+`</div><div class="vditor-emojis__tail">
|
|
119
|
+
<span class="vditor-emojis__tip"></span><span>`+(n.options.hint.emojiTail||"")+`</span>
|
|
120
|
+
</div>`,r.element.appendChild(o),k(n,o,r.element.firstElementChild,i.level),r.bindEvent(n),r}return ur(t,e),t.prototype.bindEvent=function(n){var i=this;this.element.lastElementChild.addEventListener((0,l.Le)(),function(r){var o=(0,x.S)(r.target,"BUTTON");if(o){r.preventDefault();var a=o.getAttribute("data-value"),c=(0,C.zh)(n),v=a;if(n.currentMode==="wysiwyg"?v=n.lute.SpinVditorDOM(a):n.currentMode==="ir"&&(v=n.lute.SpinVditorIRDOM(a)),a.indexOf(":")>-1&&n.currentMode!=="sv"){var g=document.createElement("div");g.innerHTML=v,v=g.firstElementChild.firstElementChild.outerHTML+" ",(0,C.oC)(v,n)}else c.extractContents(),c.insertNode(document.createTextNode(a));c.collapse(!1),(0,C.Hc)(c),i.element.lastElementChild.style.display="none",oe(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(r){var o=(0,x.S)(r.target,"BUTTON");o&&(i.element.querySelector(".vditor-emojis__tip").innerHTML=o.getAttribute("data-key"))})},t}(ye),wn=function(e,t,n){var i=document.createElement("a");"download"in i?(i.download=n,i.style.display="none",i.href=URL.createObjectURL(new Blob([t])),document.body.appendChild(i),i.click(),i.remove()):e.tip.show(window.VditorI18n.downloadTip,0)},mr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),fr=function(e){function t(n,i){var r=e.call(this,n,i)||this,o=r.element.children[0],a=document.createElement("div");return a.className="vditor-hint"+(i.level===2?"":" vditor-panel--arrow"),a.innerHTML=`<button data-type="markdown">Markdown</button>
|
|
121
|
+
<button data-type="pdf">PDF</button>
|
|
122
|
+
<button data-type="html">HTML</button>`,a.addEventListener((0,l.Le)(),function(c){var v=c.target;if(v.tagName==="BUTTON"){switch(v.getAttribute("data-type")){case"markdown":(function(g){var f=m(g);wn(g,f,f.substr(0,10)+".md")})(n);break;case"pdf":(function(g){g.tip.show(window.VditorI18n.generate,3800);var f=document.querySelector("#vditorExportIframe");f.contentDocument.open(),f.contentDocument.write('<link rel="stylesheet" href="'+g.options.cdn+`/dist/index.css"/>
|
|
123
|
+
<script src="`+g.options.cdn+`/dist/method.min.js"><\/script>
|
|
124
|
+
<div id="preview" style="width: 800px"></div>
|
|
125
|
+
<script>
|
|
126
|
+
window.addEventListener("message", (e) => {
|
|
127
|
+
if(!e.data) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
Vditor.preview(document.getElementById('preview'), e.data, {
|
|
131
|
+
cdn: "`+g.options.cdn+`",
|
|
132
|
+
markdown: {
|
|
133
|
+
theme: `+JSON.stringify(g.options.preview.theme)+`
|
|
134
|
+
},
|
|
135
|
+
hljs: {
|
|
136
|
+
style: "`+g.options.preview.hljs.style+`"
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
window.print();
|
|
141
|
+
}, 3600);
|
|
142
|
+
}, false);
|
|
143
|
+
<\/script>`),f.contentDocument.close(),setTimeout(function(){f.contentWindow.postMessage(m(g),"*")},200)})(n);break;case"html":(function(g){var f=vn(g),_='<html><head><link rel="stylesheet" type="text/css" href="'+g.options.cdn+`/dist/index.css"/>
|
|
144
|
+
<script src="`+g.options.cdn+"/dist/js/i18n/"+g.options.lang+`.js"><\/script>
|
|
145
|
+
<script src="`+g.options.cdn+`/dist/method.min.js"><\/script></head>
|
|
146
|
+
<body><div class="vditor-reset" id="preview">`+f+`</div>
|
|
147
|
+
<script>
|
|
148
|
+
const previewElement = document.getElementById('preview')
|
|
149
|
+
Vditor.setContentTheme('`+g.options.preview.theme.current+"', '"+g.options.preview.theme.path+`');
|
|
150
|
+
Vditor.codeRender(previewElement);
|
|
151
|
+
Vditor.highlightRender(`+JSON.stringify(g.options.preview.hljs)+", previewElement, '"+g.options.cdn+`');
|
|
152
|
+
Vditor.mathRender(previewElement, {
|
|
153
|
+
cdn: '`+g.options.cdn+`',
|
|
154
|
+
math: `+JSON.stringify(g.options.preview.math)+`,
|
|
155
|
+
});
|
|
156
|
+
Vditor.mermaidRender(previewElement, '`+g.options.cdn+"', '"+g.options.theme+`');
|
|
157
|
+
Vditor.markmapRender(previewElement, '`+g.options.cdn+"', '"+g.options.theme+`');
|
|
158
|
+
Vditor.flowchartRender(previewElement, '`+g.options.cdn+`');
|
|
159
|
+
Vditor.graphvizRender(previewElement, '`+g.options.cdn+`');
|
|
160
|
+
Vditor.chartRender(previewElement, '`+g.options.cdn+"', '"+g.options.theme+`');
|
|
161
|
+
Vditor.mindmapRender(previewElement, '`+g.options.cdn+"', '"+g.options.theme+`');
|
|
162
|
+
Vditor.abcRender(previewElement, '`+g.options.cdn+`');
|
|
163
|
+
`+(g.options.preview.render.media.enable?"Vditor.mediaRender(previewElement);":"")+`
|
|
164
|
+
Vditor.speechRender(previewElement);
|
|
165
|
+
<\/script>
|
|
166
|
+
<script src="`+g.options.cdn+"/dist/js/icons/"+g.options.icon+'.js"><\/script></body></html>';wn(g,_,f.substr(0,10)+".html")})(n)}w(n,["subToolbar"]),c.preventDefault(),c.stopPropagation()}}),r.element.appendChild(a),k(n,a,o,i.level),r}return mr(t,e),t}(ye),hr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),vr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r._bindEvent(n,i),r}return hr(t,e),t.prototype._bindEvent=function(n,i){this.element.children[0].addEventListener((0,l.Le)(),function(r){r.preventDefault(),n.element.className.includes("vditor--fullscreen")?(i.level||(this.innerHTML=i.icon),n.element.style.zIndex="",document.body.style.overflow="",n.element.classList.remove("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(o){var a=n.toolbar.elements[o].firstChild;a&&(a.className=a.className.replace("__s","__n"),n.options.toolbar.forEach(function(c){typeof c!="string"&&c.tipPosition&&c.name===a.dataset.type&&(a.className="vditor-tooltipped vditor-tooltipped__"+c.tipPosition)}))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__s","__n"))):(i.level||(this.innerHTML='<svg><use xlink:href="#vditor-icon-contract"></use></svg>'),n.element.style.zIndex=n.options.fullscreen.index.toString(),document.body.style.overflow="hidden",n.element.classList.add("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(o){var a=n.toolbar.elements[o].firstChild;a&&(a.className=a.className.replace("__n","__s"))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__n","__s"))),n.devtools&&n.devtools.renderEchart(n),i.click&&i.click(r,n),de(n),X(n)})},t}(ye),gr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),yr=function(e){function t(n,i){var r=e.call(this,n,i)||this,o=document.createElement("div");return o.className="vditor-hint vditor-panel--arrow",o.innerHTML='<button data-tag="h1" data-value="# ">'+window.VditorI18n.heading1+" "+(0,l.ns)("<\u2325\u23181>")+`</button>
|
|
167
|
+
<button data-tag="h2" data-value="## ">`+window.VditorI18n.heading2+" <"+(0,l.ns)("\u2325\u23182")+`></button>
|
|
168
|
+
<button data-tag="h3" data-value="### ">`+window.VditorI18n.heading3+" <"+(0,l.ns)("\u2325\u23183")+`></button>
|
|
169
|
+
<button data-tag="h4" data-value="#### ">`+window.VditorI18n.heading4+" <"+(0,l.ns)("\u2325\u23184")+`></button>
|
|
170
|
+
<button data-tag="h5" data-value="##### ">`+window.VditorI18n.heading5+" <"+(0,l.ns)("\u2325\u23185")+`></button>
|
|
171
|
+
<button data-tag="h6" data-value="###### ">`+window.VditorI18n.heading6+" <"+(0,l.ns)("\u2325\u23186")+"></button>",r.element.appendChild(o),r._bindEvent(n,o),r}return gr(t,e),t.prototype._bindEvent=function(n,i){var r=this.element.children[0];r.addEventListener((0,l.Le)(),function(a){a.preventDefault(),clearTimeout(n.wysiwyg.afterRenderTimeoutId),clearTimeout(n.ir.processTimeoutId),clearTimeout(n.sv.processTimeoutId),r.classList.contains(E.g.CLASS_MENU_DISABLED)||(r.blur(),r.classList.contains("vditor-menu--current")?(n.currentMode==="wysiwyg"?(wt(n),ve(n)):n.currentMode==="ir"&&ot(n,""),r.classList.remove("vditor-menu--current")):(w(n,["subToolbar"]),i.style.display="block"))});for(var o=0;o<6;o++)i.children.item(o).addEventListener((0,l.Le)(),function(a){a.preventDefault(),n.currentMode==="wysiwyg"?(ct(n,a.target.getAttribute("data-tag")),ve(n),r.classList.add("vditor-menu--current")):n.currentMode==="ir"?(ot(n,a.target.getAttribute("data-value")),r.classList.add("vditor-menu--current")):Ft(n,a.target.getAttribute("data-value")),i.style.display="none"})},t}(ye),br=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),wr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),n.tip.show(`<div style="margin-bottom:14px;font-size: 14px;line-height: 22px;min-width:300px;max-width: 360px;display: flex;">
|
|
172
|
+
<div style="margin-top: 14px;flex: 1">
|
|
173
|
+
<div>Markdown \u4F7F\u7528\u6307\u5357</div>
|
|
174
|
+
<ul style="list-style: none">
|
|
175
|
+
<li><a href="https://ld246.com/article/1583308420519" target="_blank">\u8BED\u6CD5\u901F\u67E5\u624B\u518C</a></li>
|
|
176
|
+
<li><a href="https://ld246.com/article/1583129520165" target="_blank">\u57FA\u7840\u8BED\u6CD5</a></li>
|
|
177
|
+
<li><a href="https://ld246.com/article/1583305480675" target="_blank">\u6269\u5C55\u8BED\u6CD5</a></li>
|
|
178
|
+
<li><a href="https://ld246.com/article/1582778815353" target="_blank">\u952E\u76D8\u5FEB\u6377\u952E</a></li>
|
|
179
|
+
</ul>
|
|
180
|
+
</div>
|
|
181
|
+
<div style="margin-top: 14px;flex: 1">
|
|
182
|
+
<div>Vditor \u652F\u6301</div>
|
|
183
|
+
<ul style="list-style: none">
|
|
184
|
+
<li><a href="https://github.com/Vanessa219/vditor/issues" target="_blank">Issues</a></li>
|
|
185
|
+
<li><a href="https://ld246.com/tag/vditor" target="_blank">\u5B98\u65B9\u8BA8\u8BBA\u533A</a></li>
|
|
186
|
+
<li><a href="https://ld246.com/article/1549638745630" target="_blank">\u5F00\u53D1\u624B\u518C</a></li>
|
|
187
|
+
<li><a href="https://ld246.com/guide/markdown" target="_blank">\u6F14\u793A\u5730\u5740</a></li>
|
|
188
|
+
</ul>
|
|
189
|
+
</div></div>`,0)}),r}return br(t,e),t}(ye),Er=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),kr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].addEventListener((0,l.Le)(),function(o){if(o.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.currentMode!=="sv"){var a=(0,C.zh)(n),c=(0,p.lG)(a.startContainer,"LI");c&&en(n,c,a)}}),r}return Er(t,e),t}(ye),Sr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Lr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),n.tip.show(`<div style="max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;">
|
|
190
|
+
<p style="text-align: center;margin: 14px 0">
|
|
191
|
+
<em>\u4E0B\u4E00\u4EE3\u7684 Markdown \u7F16\u8F91\u5668\uFF0C\u4E3A\u672A\u6765\u800C\u6784\u5EFA</em>
|
|
192
|
+
</p>
|
|
193
|
+
<div style="display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center">
|
|
194
|
+
<img src="https://unpkg.com/vditor/dist/images/logo.png" style="margin: 0 auto;height: 68px"/>
|
|
195
|
+
<div> </div>
|
|
196
|
+
<div style="flex: 1;min-width: 250px">
|
|
197
|
+
Vditor \u662F\u4E00\u6B3E\u6D4F\u89C8\u5668\u7AEF\u7684 Markdown \u7F16\u8F91\u5668\uFF0C\u652F\u6301\u6240\u89C1\u5373\u6240\u5F97\u3001\u5373\u65F6\u6E32\u67D3\uFF08\u7C7B\u4F3C Typora\uFF09\u548C\u5206\u5C4F\u9884\u89C8\u6A21\u5F0F\u3002
|
|
198
|
+
\u5B83\u4F7F\u7528 TypeScript \u5B9E\u73B0\uFF0C\u652F\u6301\u539F\u751F JavaScript \u4EE5\u53CA Vue\u3001React\u3001Angular \u548C Svelte \u7B49\u6846\u67B6\u3002
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
<div style="display: flex;flex-wrap: wrap;">
|
|
202
|
+
<ul style="list-style: none;flex: 1;min-width:148px">
|
|
203
|
+
<li>
|
|
204
|
+
\u9879\u76EE\u5730\u5740\uFF1A<a href="https://b3log.org/vditor" target="_blank">b3log.org/vditor</a>
|
|
205
|
+
</li>
|
|
206
|
+
<li>
|
|
207
|
+
\u5F00\u6E90\u534F\u8BAE\uFF1AMIT
|
|
208
|
+
</li>
|
|
209
|
+
</ul>
|
|
210
|
+
<ul style="list-style: none;margin-right: 18px">
|
|
211
|
+
<li>
|
|
212
|
+
\u7EC4\u4EF6\u7248\u672C\uFF1AVditor v`+E.H+" / Lute v"+Lute.Version+`
|
|
213
|
+
</li>
|
|
214
|
+
<li>
|
|
215
|
+
\u8D5E\u52A9\u6350\u8D60\uFF1A<a href="https://ld246.com/sponsor" target="_blank">https://ld246.com/sponsor</a>
|
|
216
|
+
</li>
|
|
217
|
+
</ul>
|
|
218
|
+
</div>
|
|
219
|
+
</div>`,0)}),r}return Sr(t,e),t}(ye),Mr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Tr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv"||pt(n,"afterend")}),r}return Mr(t,e),t}(ye),Cr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ar=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv"||pt(n,"beforebegin")}),r}return Cr(t,e),t}(ye),_r=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),xr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r.element.children[0].addEventListener((0,l.Le)(),function(o){if(o.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.currentMode!=="sv"){var a=(0,C.zh)(n),c=(0,p.lG)(a.startContainer,"LI");c&&xt(n,c,a,c.parentElement)}}),r}return _r(t,e),t}(ye),Hr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Nr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return n.options.outline&&r.element.firstElementChild.classList.add("vditor-menu--current"),r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),n.toolbar.elements.outline.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!r.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),r}return Hr(t,e),t}(ye),Dr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Or=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r._bindEvent(n),r}return Dr(t,e),t.prototype._bindEvent=function(n){var i=this;this.element.children[0].addEventListener((0,l.Le)(),function(r){r.preventDefault();var o=i.element.firstElementChild;if(!o.classList.contains(E.g.CLASS_MENU_DISABLED)){var a=E.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);o.classList.contains("vditor-menu--current")?(o.classList.remove("vditor-menu--current"),n.currentMode==="sv"?(n.sv.element.style.display="block",n.options.preview.mode==="both"?n.preview.element.style.display="block":n.preview.element.style.display="none"):(n[n.currentMode].element.parentElement.style.display="block",n.preview.element.style.display="none"),b(n.toolbar.elements,a),n.outline.render(n)):(L(n.toolbar.elements,a),n.preview.element.style.display="block",n.currentMode==="sv"?n.sv.element.style.display="none":n[n.currentMode].element.parentElement.style.display="none",n.preview.render(n),o.classList.add("vditor-menu--current"),w(n,["subToolbar","hint","popover"]),setTimeout(function(){n.outline.render(n)},n.options.preview.delay+10)),de(n)}})},t}(ye),Ir=function(){function e(t){var n;if(this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0,typeof AudioContext<"u")n=new AudioContext;else{if(!webkitAudioContext)return;n=new webkitAudioContext}this.DEFAULT_SAMPLE_RATE=n.sampleRate;var i=n.createGain();n.createMediaStreamSource(t).connect(i),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,i.connect(this.recorder),this.recorder.connect(n.destination),this.readyFlag=!0}return e.prototype.cloneChannelData=function(t,n){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(n)),this.recordingLength+=2048},e.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},e.prototype.stopRecording=function(){this.isRecording=!1},e.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),n=this.mergeBuffers(this.rightChannel),i=new Float32Array(t.length),r=0;r<t.length;++r)i[r]=.5*(t[r]+n[r]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(i=this.downSampleBuffer(i,this.SAMPLE_RATE));var o=44+2*i.length,a=new ArrayBuffer(o),c=new DataView(a);this.writeUTFBytes(c,0,"RIFF"),c.setUint32(4,o,!0),this.writeUTFBytes(c,8,"WAVE"),this.writeUTFBytes(c,12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,1,!0),c.setUint16(22,1,!0),c.setUint32(24,this.SAMPLE_RATE,!0),c.setUint32(28,2*this.SAMPLE_RATE,!0),c.setUint16(32,2,!0),c.setUint16(34,16,!0);var v=2*i.length;this.writeUTFBytes(c,36,"data"),c.setUint32(40,v,!0);for(var g=i.length,f=44,_=0;_<g;_++)c.setInt16(f,32767*i[_],!0),f+=2;return new Blob([c],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(t,n){if(n===this.DEFAULT_SAMPLE_RATE||n>this.DEFAULT_SAMPLE_RATE)return t;for(var i=this.DEFAULT_SAMPLE_RATE/n,r=Math.round(t.length/i),o=new Float32Array(r),a=0,c=0;a<o.length;){for(var v=Math.round((a+1)*i),g=0,f=0,_=c;_<v&&_<t.length;_++)g+=t[_],f++;o[a]=g/f,a++,c=v}return o},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),i=0,r=t.length,o=0;o<r;++o){var a=t[o];n.set(a,i),i+=a.length}return n},e.prototype.writeUTFBytes=function(t,n,i){for(var r=i.length,o=0;o<r;o++)t.setUint8(n+o,i.charCodeAt(o))},e}(),jr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Rr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return r._bindEvent(n),r}return jr(t,e),t.prototype._bindEvent=function(n){var i,r=this;this.element.children[0].addEventListener((0,l.Le)(),function(o){if(o.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){var a=n[n.currentMode].element;if(i)if(i.isRecording){i.stopRecording(),n.tip.hide();var c=new File([i.buildWavFileBlob()],"record"+new Date().getTime()+".wav",{type:"video/webm"});_t(n,[c]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),a.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current");else navigator.mediaDevices.getUserMedia({audio:!0}).then(function(v){(i=new Ir(v)).recorder.onaudioprocess=function(g){if(i.isRecording){var f=g.inputBuffer.getChannelData(0),_=g.inputBuffer.getChannelData(1);i.cloneChannelData(f,_)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),a.setAttribute("contenteditable","false"),r.element.children[0].classList.add("vditor-menu--current")}).catch(function(){n.tip.show(window.VditorI18n["record-tip"])})}})},t}(ye),Pr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),qr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return L({redo:r.element},["redo"]),r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.undo.redo(n)}),r}return Pr(t,e),t}(ye),Br=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Vr=function(e){function t(n,i){var r=e.call(this,n,i)||this;return L({undo:r.element},["undo"]),r.element.children[0].addEventListener((0,l.Le)(),function(o){o.preventDefault(),r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.undo.undo(n)}),r}return Br(t,e),t}(ye),Ur=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),Wr=function(e){function t(n,i){var r=e.call(this,n,i)||this,o='<input type="file"';return n.options.upload.multiple&&(o+=' multiple="multiple"'),n.options.upload.accept&&(o+=' accept="'+n.options.upload.accept+'"'),r.element.children[0].innerHTML=""+(i.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>')+o+">",r._bindEvent(n),r}return Ur(t,e),t.prototype._bindEvent=function(n){var i=this;this.element.children[0].addEventListener((0,l.Le)(),function(r){if(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED))return r.stopPropagation(),void r.preventDefault()}),this.element.querySelector("input").addEventListener("change",function(r){if(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED))return r.stopPropagation(),void r.preventDefault();r.target.files.length!==0&&_t(n,r.target.files,r.target)})},t}(ye),zr=function(){function e(t){var n=this,i=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",i.toolbar.forEach(function(r,o){var a=n.genItem(t,r,o);if(n.element.appendChild(a),r.toolbar){var c=document.createElement("div");c.className="vditor-hint vditor-panel--arrow",c.addEventListener((0,l.Le)(),function(v){c.style.display="none"}),r.toolbar.forEach(function(v,g){v.level=2,c.appendChild(n.genItem(t,v,o+g))}),a.appendChild(c),k(t,c,a.children[0])}}),t.options.toolbarConfig.hide&&this.element.classList.add("vditor-toolbar--hide"),t.options.toolbarConfig.pin&&this.element.classList.add("vditor-toolbar--pin"),t.options.counter.enable&&(t.counter=new or(t),this.element.appendChild(t.counter.element))}return e.prototype.genItem=function(t,n,i){var r;switch(n.name){case"bold":case"italic":case"more":case"strike":case"line":case"quote":case"list":case"ordered-list":case"check":case"code":case"inline-code":case"link":case"table":r=new ye(t,n);break;case"emoji":r=new pr(t,n);break;case"headings":r=new yr(t,n);break;case"|":r=new dr;break;case"br":r=new er;break;case"undo":r=new Vr(t,n);break;case"redo":r=new qr(t,n);break;case"help":r=new wr(t,n);break;case"both":r=new $n(t,n);break;case"preview":r=new Or(t,n);break;case"fullscreen":r=new vr(t,n);break;case"upload":r=new Wr(t,n);break;case"record":r=new Rr(t,n);break;case"info":r=new Lr(t,n);break;case"edit-mode":r=new xn(t,n);break;case"devtools":r=new cr(t,n);break;case"outdent":r=new xr(t,n);break;case"indent":r=new kr(t,n);break;case"outline":r=new Nr(t,n);break;case"insert-after":r=new Tr(t,n);break;case"insert-before":r=new Ar(t,n);break;case"code-theme":r=new nr(t,n);break;case"content-theme":r=new ir(t,n);break;case"export":r=new fr(t,n);break;default:r=new lr(t,n)}if(r){var o=n.name;return o!=="br"&&o!=="|"||(o+=i),this.elements[o]=r.element,r.element}},e}(),Kr=le(471),Gr=function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new Kr}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?b(t.toolbar.elements,["undo"]):L(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?b(t.toolbar.elements,["redo"]):L(t.toolbar.elements,["redo"]))},e.prototype.undo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"&&!(this[t.currentMode].undoStack.length<2)){var n=this[t.currentMode].undoStack.pop();n&&(this[t.currentMode].redoStack.push(n),this.renderDiff(n,t),this[t.currentMode].hasUndo=!0,w(t,["hint"]))}},e.prototype.redo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"){var n=this[t.currentMode].redoStack.pop();n&&(this[t.currentMode].undoStack.push(n),this.renderDiff(n,t,!0))}},e.prototype.recordFirstPosition=function(t,n){if(getSelection().rangeCount!==0&&!(this[t.currentMode].undoStack.length!==1||this[t.currentMode].undoStack[0].length===0||this[t.currentMode].redoStack.length>0||(0,l.vU)()&&n.key==="Backspace"||(0,l.G6)())){var i=this.addCaret(t);i.replace("<wbr>","").replace(" vditor-ir__node--expand","")===this[t.currentMode].undoStack[0][0].diffs[0][1].replace("<wbr>","")&&(this[t.currentMode].undoStack[0][0].diffs[0][1]=i,this[t.currentMode].lastText=i)}},e.prototype.addToUndoStack=function(t){var n=this.addCaret(t,!0),i=this.dmp.diff_main(n,this[t.currentMode].lastText,!0),r=this.dmp.patch_make(n,this[t.currentMode].lastText,i);r.length===0&&this[t.currentMode].undoStack.length>0||(this[t.currentMode].lastText=n,this[t.currentMode].undoStack.push(r),this[t.currentMode].undoStack.length>this.stackSize&&this[t.currentMode].undoStack.shift(),this[t.currentMode].hasUndo&&(this[t.currentMode].redoStack=[],this[t.currentMode].hasUndo=!1,L(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&b(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,i){var r;if(i===void 0&&(i=!1),i){var o=this.dmp.patch_deepCopy(t).reverse();o.forEach(function(c){c.diffs.forEach(function(v){v[0]=-v[0]})}),r=this.dmp.patch_apply(o,this[n.currentMode].lastText)[0]}else r=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=r,n[n.currentMode].element.innerHTML=r,n.currentMode!=="sv"&&n[n.currentMode].element.querySelectorAll(".vditor-"+n.currentMode+"__preview[data-render='2']").forEach(function(c){we(c,n)}),n[n.currentMode].element.querySelector("wbr"))(0,C.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),ke(n);else{var a=getSelection().getRangeAt(0);a.setEndBefore(n[n.currentMode].element),a.collapse(!1)}Oe(n),oe(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),Ze(n),n[n.currentMode].element.querySelectorAll(".vditor-"+n.currentMode+"__preview[data-render='2']").forEach(function(c){we(c,n)}),this[n.currentMode].undoStack.length>1?b(n.toolbar.elements,["undo"]):L(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?b(n.toolbar.elements,["redo"]):L(n.toolbar.elements,["redo"])},e.prototype.resetStack=function(){this.ir={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.sv={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.wysiwyg={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]}},e.prototype.addCaret=function(t,n){var i;if(n===void 0&&(n=!1),getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var r=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(r.startContainer)){i=r.cloneRange();var o=document.createElement("span");o.className="vditor-wbr",r.insertNode(o)}}t.ir.element.cloneNode(!0).querySelectorAll(".vditor-"+t.currentMode+"__preview[data-render='1']").forEach(function(c){c.firstElementChild&&(c.firstElementChild.classList.contains("language-echarts")||c.firstElementChild.classList.contains("language-plantuml")||c.firstElementChild.classList.contains("language-mindmap")?(c.firstElementChild.removeAttribute("_echarts_instance_"),c.firstElementChild.removeAttribute("data-processed"),c.firstElementChild.innerHTML=c.previousElementSibling.firstElementChild.innerHTML,c.setAttribute("data-render","2")):c.firstElementChild.classList.contains("language-math")&&(c.setAttribute("data-render","2"),c.firstElementChild.textContent=c.firstElementChild.getAttribute("data-math"),c.firstElementChild.removeAttribute("data-math")))});var a=t[t.currentMode].element.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(c){c.remove()}),n&&i&&(0,C.Hc)(i),a.replace('<span class="vditor-wbr"></span>',"<wbr>")},e}(),Fr=le(640),Zr=function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:E.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},customRenders:[],debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"\u{1F44D}","-1":"\u{1F44E}",confused:"\u{1F615}",eyes:"\u{1F440}\uFE0F",heart:"\u2764\uFE0F",rocket:"\u{1F680}\uFE0F",smile:"\u{1F604}",tada:"\u{1F389}\uFE0F"},emojiPath:E.g.CDN+"/dist/images/emoji",extend:[],parse:!0},icon:"ant",lang:"zh_CN",mode:"ir",outline:{enable:!1,position:"left"},placeholder:"",preview:{actions:["desktop","tablet","mobile","mp-wechat","zhihu"],delay:1e3,hljs:E.g.HLJS_OPTIONS,markdown:E.g.MARKDOWN_OPTIONS,math:E.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:E.g.THEME_OPTIONS,render:{media:{enable:!0}}},link:{isOpen:!0},image:{isPreview:!0},resize:{enable:!1,position:"bottom"},theme:"classic",toolbar:["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|","upload","record","table","|","undo","redo","|","fullscreen","edit-mode",{name:"more",toolbar:["both","code-theme","content-theme","export","outline","preview","devtools","info","help"]}],toolbarConfig:{hide:!1,pin:!1},typewriterMode:!1,undoDelay:800,upload:{extraData:{},fieldName:"file[]",filename:function(n){return n.replace(/\W/g,"")},linkToImgUrl:"",max:10485760,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,i,r,o,a,c,v,g;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),!((n=(t=this.options.preview)===null||t===void 0?void 0:t.theme)===null||n===void 0)&&n.list&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),!((o=(r=(i=this.options.preview)===null||i===void 0?void 0:i.render)===null||r===void 0?void 0:r.media)===null||o===void 0)&&o.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((a=this.options.hint)===null||a===void 0)&&a.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((v=(c=this.options.preview)===null||c===void 0?void 0:c.theme)===null||v===void 0)&&v.path||(this.defaultOptions.preview.theme.path=this.options.cdn+"/dist/css/content-theme"),!((g=this.options.hint)===null||g===void 0)&&g.emojiPath||(this.defaultOptions.hint.emojiPath=this.options.cdn+"/dist/images/emoji")));var f=(0,Fr.T)(this.defaultOptions,this.options);if(f.cache.enable&&!f.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return f},e.prototype.mergeToolbar=function(t){var n=this,i=[{icon:'<svg><use xlink:href="#vditor-icon-export"></use></svg>',name:"export",tipPosition:"ne"},{hotkey:"\u2318E",icon:'<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',name:"emoji",tipPosition:"ne"},{hotkey:"\u2318H",icon:'<svg><use xlink:href="#vditor-icon-headings"></use></svg>',name:"headings",tipPosition:"ne"},{hotkey:"\u2318B",icon:'<svg><use xlink:href="#vditor-icon-bold"></use></svg>',name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"\u2318I",icon:'<svg><use xlink:href="#vditor-icon-italic"></use></svg>',name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"\u2318D",icon:'<svg><use xlink:href="#vditor-icon-strike"></use></svg>',name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{hotkey:"\u2318K",icon:'<svg><use xlink:href="#vditor-icon-link"></use></svg>',name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{name:"|"},{hotkey:"\u2318L",icon:'<svg><use xlink:href="#vditor-icon-list"></use></svg>',name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"\u2318O",icon:'<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"\u2318J",icon:'<svg><use xlink:href="#vditor-icon-check"></use></svg>',name:"check",prefix:"* [ ] ",tipPosition:"n"},{hotkey:"\u21E7\u2318I",icon:'<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',name:"outdent",tipPosition:"n"},{hotkey:"\u21E7\u2318O",icon:'<svg><use xlink:href="#vditor-icon-indent"></use></svg>',name:"indent",tipPosition:"n"},{name:"|"},{hotkey:"\u2318;",icon:'<svg><use xlink:href="#vditor-icon-quote"></use></svg>',name:"quote",prefix:"> ",tipPosition:"n"},{hotkey:"\u21E7\u2318H",icon:'<svg><use xlink:href="#vditor-icon-line"></use></svg>',name:"line",prefix:"---",tipPosition:"n"},{hotkey:"\u2318U",icon:'<svg><use xlink:href="#vditor-icon-code"></use></svg>',name:"code",prefix:"```",suffix:"\n```",tipPosition:"n"},{hotkey:"\u2318G",icon:'<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{hotkey:"\u21E7\u2318B",icon:'<svg><use xlink:href="#vditor-icon-before"></use></svg>',name:"insert-before",tipPosition:"n"},{hotkey:"\u21E7\u2318E",icon:'<svg><use xlink:href="#vditor-icon-after"></use></svg>',name:"insert-after",tipPosition:"n"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-upload"></use></svg>',name:"upload",tipPosition:"n"},{icon:'<svg><use xlink:href="#vditor-icon-record"></use></svg>',name:"record",tipPosition:"n"},{hotkey:"\u2318M",icon:'<svg><use xlink:href="#vditor-icon-table"></use></svg>',name:"table",prefix:"| col1",suffix:` | col2 | col3 |
|
|
220
|
+
| --- | --- | --- |
|
|
221
|
+
| | | |
|
|
222
|
+
| | | |`,tipPosition:"n"},{name:"|"},{hotkey:"\u2318Z",icon:'<svg><use xlink:href="#vditor-icon-undo"></use></svg>',name:"undo",tipPosition:"nw"},{hotkey:"\u2318Y",icon:'<svg><use xlink:href="#vditor-icon-redo"></use></svg>',name:"redo",tipPosition:"nw"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-more"></use></svg>',name:"more",tipPosition:"e"},{hotkey:"\u2318'",icon:'<svg><use xlink:href="#vditor-icon-fullscreen"></use></svg>',name:"fullscreen",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-edit"></use></svg>',name:"edit-mode",tipPosition:"nw"},{hotkey:"\u2318P",icon:'<svg><use xlink:href="#vditor-icon-both"></use></svg>',name:"both",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-preview"></use></svg>',name:"preview",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',name:"outline",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-theme"></use></svg>',name:"content-theme",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-code-theme"></use></svg>',name:"code-theme",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-bug"></use></svg>',name:"devtools",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-info"></use></svg>',name:"info",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-help"></use></svg>',name:"help",tipPosition:"nw"},{name:"br"}],r=[];return t.forEach(function(o){var a=o;i.forEach(function(c){typeof o=="string"&&c.name===o&&(a=c),typeof o=="object"&&c.name===o.name&&(a=Object.assign({},c,o))}),o.toolbar&&(a.toolbar=n.mergeToolbar(o.toolbar)),r.push(a)}),r},e}(),Jr=function(){function e(t){var n=this;this.composingLock=!1,this.commentIds=[];var i=document.createElement("div");i.className="vditor-wysiwyg",i.innerHTML='<pre class="vditor-reset" placeholder="'+t.options.placeholder+`"
|
|
223
|
+
contenteditable="true" spellcheck="false"></pre>
|
|
224
|
+
<div class="vditor-panel vditor-panel--none"></div>
|
|
225
|
+
<div class="vditor-panel vditor-panel--none">
|
|
226
|
+
<button type="button" aria-label="`+window.VditorI18n.comment+`" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
|
|
227
|
+
<svg><use xlink:href="#vditor-icon-comment"></use></svg>
|
|
228
|
+
</button>
|
|
229
|
+
</div>`,this.element=i.firstElementChild,this.popover=i.firstElementChild.nextElementSibling,this.selectPopover=i.lastElementChild,this.bindEvent(t),kt(t,this.element),zt(t,this.element),St(t,this.element),Ct(t,this.element),At(t,this.element),Lt(t,this.element),Mt(t,this.element,this.copy),Tt(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var r,o,a=Lute.NewNodeID(),c=getSelection().getRangeAt(0),v=c.cloneRange(),g=c.extractContents(),f=!1,_=!1;g.childNodes.forEach(function(M,R){var q=!1;if(M.nodeType===3?q=!0:M.classList.contains("vditor-comment")?M.classList.contains("vditor-comment")&&M.setAttribute("data-cmtids",M.getAttribute("data-cmtids")+" "+a):q=!0,q)if(M.nodeType!==3&&M.getAttribute("data-block")==="0"&&R===0&&v.startOffset>0)M.innerHTML='<span class="vditor-comment" data-cmtids="'+a+'">'+M.innerHTML+"</span>",r=M;else if(M.nodeType!==3&&M.getAttribute("data-block")==="0"&&R===g.childNodes.length-1&&v.endOffset<v.endContainer.textContent.length)M.innerHTML='<span class="vditor-comment" data-cmtids="'+a+'">'+M.innerHTML+"</span>",o=M;else if(M.nodeType!==3&&M.getAttribute("data-block")==="0")R===0?f=!0:R===g.childNodes.length-1&&(_=!0),M.innerHTML='<span class="vditor-comment" data-cmtids="'+a+'">'+M.innerHTML+"</span>";else{var D=document.createElement("span");D.classList.add("vditor-comment"),D.setAttribute("data-cmtids",a),M.parentNode.insertBefore(D,M),D.appendChild(M)}});var O=(0,p.F9)(v.startContainer);O&&(r?(O.insertAdjacentHTML("beforeend",r.innerHTML),r.remove()):O.textContent.trim().replace(E.g.ZWSP,"")===""&&f&&O.remove());var U=(0,p.F9)(v.endContainer);U&&(o?(U.insertAdjacentHTML("afterbegin",o.innerHTML),o.remove()):U.textContent.trim().replace(E.g.ZWSP,"")===""&&_&&U.remove()),c.insertNode(g),t.options.comment.add(a,c.toString(),n.getComments(t,!0)),ve(t,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),n.hideComment()})}return e.prototype.getComments=function(t,n){var i=this;if(n===void 0&&(n=!1),t.currentMode!=="wysiwyg"||!t.options.comment.enable)return[];this.commentIds=[],this.element.querySelectorAll(".vditor-comment").forEach(function(o){i.commentIds=i.commentIds.concat(o.getAttribute("data-cmtids").split(" "))}),this.commentIds=Array.from(new Set(this.commentIds));var r=[];return n?(this.commentIds.forEach(function(o){r.push({id:o,top:i.element.querySelector('.vditor-comment[data-cmtids="'+o+'"]').offsetTop})}),r):void 0},e.prototype.triggerRemoveComment=function(t){var n,i,r;if(t.currentMode==="wysiwyg"&&t.options.comment.enable&&t.wysiwyg.commentIds.length>0){var o=JSON.parse(JSON.stringify(this.commentIds));this.getComments(t);var a=(n=o,i=this.commentIds,r=new Set(i),n.filter(function(c){return!r.has(c)}));a.length>0&&t.options.comment.remove(a)}},e.prototype.showComment=function(){var t=(0,C.Ny)(this.element);this.selectPopover.setAttribute("style","left:"+t.left+"px;display:block;top:"+Math.max(-8,t.top-21)+"px")},e.prototype.hideComment=function(){this.selectPopover.setAttribute("style","display:none")},e.prototype.unbindListener=function(){window.removeEventListener("scroll",this.scrollListener)},e.prototype.copy=function(t,n){var i=getSelection().getRangeAt(0);if(i.toString()!==""){t.stopPropagation(),t.preventDefault();var r=(0,p.lG)(i.startContainer,"CODE"),o=(0,p.lG)(i.endContainer,"CODE");if(r&&o&&o.isSameNode(r)){var a="";return a=r.parentElement.tagName==="PRE"?i.toString():"`"+i.toString()+"`",t.clipboardData.setData("text/plain",a),void t.clipboardData.setData("text/html","")}var c=(0,p.lG)(i.startContainer,"A"),v=(0,p.lG)(i.endContainer,"A");if(c&&v&&v.isSameNode(c)){var g=c.getAttribute("title")||"";return g&&(g=' "'+g+'"'),t.clipboardData.setData("text/plain","["+i.toString()+"]("+c.getAttribute("href")+g+")"),void t.clipboardData.setData("text/html","")}var f=document.createElement("div");f.appendChild(i.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorDOM2Md(f.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.unbindListener(),window.addEventListener("scroll",this.scrollListener=function(){if(w(t,["hint"]),n.popover.style.display==="block"&&n.selectPopover.style.display==="block"){var i=parseInt(n.popover.getAttribute("data-top"),10);if(t.options.height==="auto"){if(t.options.toolbarConfig.pin){var r=Math.max(i,window.scrollY-t.element.offsetTop-8)+"px";n.popover.style.display==="block"&&(n.popover.style.top=r),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=r)}}else if(t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0){var o=Math.max(window.scrollY-t.element.offsetTop-8,Math.min(i-t.wysiwyg.element.scrollTop,n.element.clientHeight-21))+"px";n.popover.style.display==="block"&&(n.popover.style.top=o),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=o)}}}),this.element.addEventListener("scroll",function(){if(w(t,["hint"]),t.options.comment&&t.options.comment.enable&&t.options.comment.scroll&&t.options.comment.scroll(t.wysiwyg.element.scrollTop),n.popover.style.display==="block"){var i=parseInt(n.popover.getAttribute("data-top"),10)-t.wysiwyg.element.scrollTop,r=-8;t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0&&(r=window.scrollY-t.element.offsetTop+r);var o=Math.max(r,Math.min(i,n.element.clientHeight-21))+"px";n.popover.style.top=o,n.selectPopover.style.top=o}}),this.element.addEventListener("paste",function(i){vt(t,i,{pasteCode:function(r){var o=(0,C.zh)(t),a=document.createElement("template");a.innerHTML=r,o.insertNode(a.content.cloneNode(!0));var c=(0,p.a1)(o.startContainer,"data-block","0");c?c.outerHTML=t.lute.SpinVditorDOM(c.outerHTML):t.wysiwyg.element.innerHTML=t.lute.SpinVditorDOM(t.wysiwyg.element.innerHTML),(0,C.ib)(t.wysiwyg.element,o)}})}),this.element.addEventListener("compositionstart",function(){n.composingLock=!0}),this.element.addEventListener("compositionend",function(i){var r=(0,x.W)(getSelection().getRangeAt(0).startContainer);r&&r.textContent===""?Oe(t):((0,l.vU)()||ut(t,getSelection().getRangeAt(0).cloneRange(),i),n.composingLock=!1)}),this.element.addEventListener("input",function(i){if(i.inputType!=="deleteByDrag"&&i.inputType!=="insertFromDrop"){if(n.preventInput)return n.preventInput=!1,void ve(t);if(n.composingLock||i.data==="\u2018"||i.data==="\u201C"||i.data==="\u300A")ve(t);else{var r=getSelection().getRangeAt(0),o=(0,p.F9)(r.startContainer);if(o||(Vt(t,r),o=(0,p.F9)(r.startContainer)),o){for(var a=(0,C.im)(o,t.wysiwyg.element,r).start,c=!0,v=a-1;v>o.textContent.substr(0,a).lastIndexOf(`
|
|
230
|
+
`);v--)if(o.textContent.charAt(v)!==" "&&o.textContent.charAt(v)!==" "){c=!1;break}a===0&&(c=!1);var g=!0;for(v=a-1;v<o.textContent.length;v++)if(o.textContent.charAt(v)!==" "&&o.textContent.charAt(v)!==`
|
|
231
|
+
`){g=!1;break}var f=(0,x.W)(getSelection().getRangeAt(0).startContainer);f&&f.textContent===""&&(Oe(t),f.remove()),c&&o.getAttribute("data-type")!=="code-block"||g||Nt(o.innerHTML)||Ht(o.innerHTML)&&o.previousElementSibling?typeof t.options.input=="function"&&t.options.input(m(t)):(i.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&o.previousElementSibling.remove(),ut(t,r,i))}}}}),this.element.addEventListener("click",function(i){if(i.target.tagName==="INPUT"){var r=i.target;return r.checked?r.setAttribute("checked","checked"):r.removeAttribute("checked"),n.preventInput=!0,void ve(t)}if(i.target.tagName!=="IMG"||i.target.parentElement.classList.contains("vditor-wysiwyg__preview")){var o=(0,p.lG)(i.target,"A");if(o)return t.options.link.click?t.options.link.click(o):t.options.link.isOpen&&window.open(o.getAttribute("href")),void i.preventDefault();var a=(0,C.zh)(t);if(i.target.isEqualNode(n.element)&&n.element.lastElementChild&&a.collapsed){var c=n.element.lastElementChild.getBoundingClientRect();i.y>c.top+c.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(E.g.ZWSP,"")===""?(a.selectNodeContents(n.element.lastElementChild),a.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'+E.g.ZWSP+"<wbr></p>"),(0,C.ib)(n.element,a)))}We(t);var v=(0,p.fb)(i.target,"vditor-wysiwyg__preview");v||(v=(0,p.fb)((0,C.zh)(t).startContainer,"vditor-wysiwyg__preview")),v&&tt(v,t),st(i,t)}else i.target.getAttribute("data-type")==="link-ref"?Ut(t,i.target):function(g,f){var _=g.target;f.wysiwyg.popover.innerHTML="";var O=function(){_.setAttribute("src",M.value),_.setAttribute("alt",q.value),_.setAttribute("title",B.value),typeof f.options.input=="function"&&f.options.input(m(f))},U=document.createElement("span");U.setAttribute("aria-label",window.VditorI18n.imageURL),U.className="vditor-tooltipped vditor-tooltipped__n";var M=document.createElement("input");U.appendChild(M),M.className="vditor-input",M.setAttribute("placeholder",window.VditorI18n.imageURL),M.value=_.getAttribute("src")||"",M.oninput=function(){O()},M.onkeydown=function(P){Ce(f,P)};var R=document.createElement("span");R.setAttribute("aria-label",window.VditorI18n.alternateText),R.className="vditor-tooltipped vditor-tooltipped__n";var q=document.createElement("input");R.appendChild(q),q.className="vditor-input",q.setAttribute("placeholder",window.VditorI18n.alternateText),q.style.width="52px",q.value=_.getAttribute("alt")||"",q.oninput=function(){O()},q.onkeydown=function(P){Ce(f,P)};var D=document.createElement("span");D.setAttribute("aria-label",window.VditorI18n.title),D.className="vditor-tooltipped vditor-tooltipped__n";var B=document.createElement("input");D.appendChild(B),B.className="vditor-input",B.setAttribute("placeholder",window.VditorI18n.title),B.value=_.getAttribute("title")||"",B.oninput=function(){O()},B.onkeydown=function(P){Ce(f,P)},He(_,f),f.wysiwyg.popover.insertAdjacentElement("beforeend",U),f.wysiwyg.popover.insertAdjacentElement("beforeend",R),f.wysiwyg.popover.insertAdjacentElement("beforeend",D),xe(f,_)}(i,t)}),this.element.addEventListener("keyup",function(i){if(!i.isComposing&&!(0,l.yl)(i)){i.key==="Enter"&&ke(t),i.key!=="Backspace"&&i.key!=="Delete"||t.wysiwyg.element.innerHTML===""||t.wysiwyg.element.childNodes.length!==1||!t.wysiwyg.element.firstElementChild||t.wysiwyg.element.firstElementChild.tagName!=="P"||t.wysiwyg.element.firstElementChild.childElementCount!==0||t.wysiwyg.element.textContent!==""&&t.wysiwyg.element.textContent!==`
|
|
232
|
+
`||(t.wysiwyg.element.innerHTML="");var r=(0,C.zh)(t);if(i.key==="Backspace"&&(0,l.vU)()&&r.startContainer.textContent===`
|
|
233
|
+
`&&r.startOffset===1&&(r.startContainer.textContent=""),Vt(t,r),We(t),i.key==="ArrowDown"||i.key==="ArrowRight"||i.key==="Backspace"||i.key==="ArrowLeft"||i.key==="ArrowUp"){i.key!=="ArrowLeft"&&i.key!=="ArrowRight"||t.hint.render(t);var o=(0,p.fb)(r.startContainer,"vditor-wysiwyg__preview");if(!o&&r.startContainer.nodeType!==3&&r.startOffset>0&&(c=r.startContainer).classList.contains("vditor-wysiwyg__block")&&(o=c.lastElementChild),o)if(o.previousElementSibling.style.display!=="none"){var a=o.previousElementSibling;if(a.tagName==="PRE"&&(a=a.firstElementChild),i.key==="ArrowDown"||i.key==="ArrowRight"){var c,v=function(f){for(var _=f;_&&!_.nextSibling;)_=_.parentElement;return _.nextSibling}(c=o.parentElement);if(v&&v.nodeType!==3){var g=v.querySelector(".vditor-wysiwyg__preview");if(g)return void tt(g,t)}if(v.nodeType===3){for(;v.textContent.length===0&&v.nextSibling;)v=v.nextSibling;r.setStart(v,1)}else r.setStart(v.firstChild,0)}else r.selectNodeContents(a),r.collapse(!1)}else i.key==="ArrowDown"||i.key==="ArrowRight"?tt(o,t):tt(o,t,!1)}}})},e}(),Xr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}();const Yr=function(e){function t(n,i){var r=e.call(this)||this;if(r.version=E.H,typeof n=="string"){if(i?i.cache?i.cache.id||(i.cache.id="vditor"+n):i.cache={id:"vditor"+n}:i={cache:{id:"vditor"+n}},!document.getElementById(n))return r.showErrorTip("Failed to get element by id: "+n),r;n=document.getElementById(n)}var o=new Zr(i).merge();if(o.i18n)window.VditorI18n=o.i18n,r.init(n,o);else{if(!["en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(o.lang))throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");var a="vditorI18nScript",c=a+o.lang;document.querySelectorAll('head script[id^="vditorI18nScript"]').forEach(function(v){v.id!==c&&document.head.removeChild(v)}),(0,s.G)(o.cdn+"/dist/js/i18n/"+o.lang+".js",c).then(function(){r.init(n,o)}).catch(function(v){r.showErrorTip("GET "+o.cdn+"/dist/js/i18n/"+o.lang+".js net::ERR_ABORTED 404 (Not Found)")})}return r}return Xr(t,e),t.prototype.showErrorTip=function(n){var i=new yn;document.body.appendChild(i.element),i.show(n,0)},t.prototype.setTheme=function(n,i,r,o){this.vditor.options.theme=n,ue(this.vditor),i&&(this.vditor.options.preview.theme.current=i,(0,Te.Z)(i,o||this.vditor.options.preview.theme.path)),r&&(this.vditor.options.preview.hljs.style=r,(0,bn.Y)(r,this.vditor.options.cdn))},t.prototype.getValue=function(){return m(this.vditor)},t.prototype.getCurrentMode=function(){return this.vditor.currentMode},t.prototype.focus=function(){this.vditor.currentMode==="sv"?this.vditor.sv.element.focus():this.vditor.currentMode==="wysiwyg"?this.vditor.wysiwyg.element.focus():this.vditor.currentMode==="ir"&&this.vditor.ir.element.focus()},t.prototype.blur=function(){this.vditor.currentMode==="sv"?this.vditor.sv.element.blur():this.vditor.currentMode==="wysiwyg"?this.vditor.wysiwyg.element.blur():this.vditor.currentMode==="ir"&&this.vditor.ir.element.blur()},t.prototype.disabled=function(){w(this.vditor,["subToolbar","hint","popover"]),L(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){b(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","true")},t.prototype.getSelection=function(){return this.vditor.currentMode==="wysiwyg"?rt(this.vditor.wysiwyg.element):this.vditor.currentMode==="sv"?rt(this.vditor.sv.element):this.vditor.currentMode==="ir"?rt(this.vditor.ir.element):void 0},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,C.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){localStorage.removeItem(this.vditor.options.cache.id)},t.prototype.disabledCache=function(){this.vditor.options.cache.enable=!1},t.prototype.enableCache=function(){if(!this.vditor.options.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");this.vditor.options.cache.enable=!0},t.prototype.html2md=function(n){return this.vditor.lute.HTML2Md(n)},t.prototype.exportJSON=function(n){return this.vditor.lute.RenderJSON(n)},t.prototype.getHTML=function(){return vn(this.vditor)},t.prototype.tip=function(n,i){this.vditor.tip.show(n,i)},t.prototype.setPreviewMode=function(n){Ot(n,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(n){document.execCommand("insertHTML",!1,n)},t.prototype.insertValue=function(n,i){i===void 0&&(i=!0);var r=(0,C.zh)(this.vditor);r.collapse(!0);var o=document.createElement("template");o.innerHTML=n,r.insertNode(o.content.cloneNode(!0)),r.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,i&&ie(this.vditor)):this.vditor.currentMode==="wysiwyg"?i&&ut(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,i&&me(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.setValue=function(n,i){var r=this;i===void 0&&(i=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>"+this.vditor.lute.SpinVditorSVDOM(n)+"</div>",Me(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?Wt(this.vditor,n,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}):(this.vditor.ir.element.innerHTML=this.vditor.lute.Md2VditorIRDOM(n),this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(o){we(o,r.vditor)}),Re(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),n||(w(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),i&&this.clearStack()},t.prototype.clearStack=function(){this.vditor.undo.clearStack(this.vditor),this.vditor.undo.addToUndoStack(this.vditor)},t.prototype.destroy=function(){this.vditor.element.innerHTML=this.vditor.originalInnerHTML,this.vditor.element.classList.remove("vditor"),this.vditor.element.removeAttribute("style");var n=document.getElementById("vditorIconScript");n&&n.remove(),this.clearCache(),je(),this.vditor.wysiwyg.unbindListener()},t.prototype.getCommentIds=function(){return this.vditor.currentMode!=="wysiwyg"?[]:this.vditor.wysiwyg.getComments(this.vditor,!0)},t.prototype.hlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var i=function(r){r.classList.remove("vditor-comment--hover"),n.forEach(function(o){r.getAttribute("data-cmtids").indexOf(o)>-1&&r.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(r){i(r)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(r){i(r)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var i=function(r){n.forEach(function(o){r.getAttribute("data-cmtids").indexOf(o)>-1&&r.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(r){i(r)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(r){i(r)})}},t.prototype.removeCommentIds=function(n){var i=this;if(this.vditor.currentMode==="wysiwyg"){var r=function(o,a){var c=o.getAttribute("data-cmtids").split(" ");c.find(function(v,g){if(v===a)return c.splice(g,1),!0}),c.length===0?(o.outerHTML=o.innerHTML,(0,C.zh)(i.vditor).collapse(!0)):o.setAttribute("data-cmtids",c.join(" "))};n.forEach(function(o){i.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(a){r(a,o)}),i.vditor.preview.element.style.display!=="none"&&i.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(a){r(a,o)})}),ve(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,i){var r=this;this.vditor={currentMode:i.mode,element:n,hint:new zn(i.hint.extend),lute:void 0,options:i,originalInnerHTML:n.innerHTML,outline:new Fn(window.VditorI18n.outline),tip:new yn},this.vditor.sv=new Yn(this.vditor),this.vditor.undo=new Gr,this.vditor.wysiwyg=new Jr(this.vditor),this.vditor.ir=new Kn(this.vditor),this.vditor.toolbar=new zr(this.vditor),i.resize.enable&&(this.vditor.resize=new Xn(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new y),(i.upload.url||i.upload.handler)&&(this.vditor.upload=new In),(0,s.G)(i._lutePath||i.cdn+"/dist/js/lute/lute.min.js","vditorLuteScript").then(function(){r.vditor.lute=(0,Gn.X)({autoSpace:r.vditor.options.preview.markdown.autoSpace,gfmAutoLink:r.vditor.options.preview.markdown.gfmAutoLink,codeBlockPreview:r.vditor.options.preview.markdown.codeBlockPreview,emojiSite:r.vditor.options.hint.emojiPath,emojis:r.vditor.options.hint.emoji,fixTermTypo:r.vditor.options.preview.markdown.fixTermTypo,footnotes:r.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:r.vditor.options.preview.math.inlineDigit,linkBase:r.vditor.options.preview.markdown.linkBase,linkPrefix:r.vditor.options.preview.markdown.linkPrefix,listStyle:r.vditor.options.preview.markdown.listStyle,mark:r.vditor.options.preview.markdown.mark,mathBlockPreview:r.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:r.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:r.vditor.options.preview.markdown.sanitize,toc:r.vditor.options.preview.markdown.toc}),r.vditor.preview=new Jn(r.vditor),function(o){o.element.innerHTML="",o.element.classList.add("vditor"),o.options.rtl&&o.element.setAttribute("dir","rtl"),ue(o),(0,Te.Z)(o.options.preview.theme.current,o.options.preview.theme.path),typeof o.options.height=="number"?o.element.style.height=o.options.height+"px":o.element.style.height=o.options.height,typeof o.options.minHeight=="number"&&(o.element.style.minHeight=o.options.minHeight+"px"),typeof o.options.width=="number"?o.element.style.width=o.options.width+"px":o.element.style.width=o.options.width,o.element.appendChild(o.toolbar.element);var a=document.createElement("div");if(a.className="vditor-content",o.options.outline.position==="left"&&a.appendChild(o.outline.element),a.appendChild(o.wysiwyg.element.parentElement),a.appendChild(o.sv.element),a.appendChild(o.ir.element.parentElement),a.appendChild(o.preview.element),o.toolbar.elements.devtools&&a.appendChild(o.devtools.element),o.options.outline.position==="right"&&(o.outline.element.classList.add("vditor-outline--right"),a.appendChild(o.outline.element)),o.upload&&a.appendChild(o.upload.element),o.options.resize.enable&&a.appendChild(o.resize.element),a.appendChild(o.hint.element),a.appendChild(o.tip.element),o.element.appendChild(a),a.addEventListener("click",function(){w(o,["subToolbar"])}),o.toolbar.elements.export&&o.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),ze(o,o.options.mode,Cn(o)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&window.visualViewport!==void 0){var c=!1,v=function(g){c||(c=!0,requestAnimationFrame(function(){c=!1;var f=o.toolbar.element;f.style.transform="none",f.getBoundingClientRect().top<0&&(f.style.transform="translate(0, "+-f.getBoundingClientRect().top+"px)")}))};window.visualViewport.addEventListener("scroll",v),window.visualViewport.addEventListener("resize",v)}}(r.vditor),i.after&&i.after(),i.icon&&(0,s.J)(i.cdn+"/dist/js/icons/"+i.icon+".js","vditorIconScript")})},t}(A.default)})(),bt=bt.default})())}}]);
|