@dcodegroup-au/dsg-vue 1.0.10-next → 1.0.12-next
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/{DsgTablePerPage.vue_vue_type_style_index_0_lang-DQk8doWV.cjs → DsgTablePerPage.vue_vue_type_style_index_0_lang-CX6n9ht7.cjs} +1201 -1201
- package/dist/{DsgTablePerPage.vue_vue_type_style_index_0_lang-CaBn8JMp.js → DsgTablePerPage.vue_vue_type_style_index_0_lang-o48o8k1B.js} +6272 -6230
- package/dist/components/Elements/DsgDatepicker.vue.d.ts +11 -3
- package/dist/dsg-vue.cjs +5 -5
- package/dist/dsg-vue.css +3 -3
- package/dist/dsg-vue.editor.cjs +110 -109
- package/dist/dsg-vue.editor.esm.js +3558 -3163
- package/dist/dsg-vue.esm.js +14 -17
- package/dist/dsg-vue.table.cjs +2 -2
- package/dist/dsg-vue.table.esm.js +137 -137
- package/dist/main.d.ts +3 -3
- package/package.json +3 -3
package/dist/dsg-vue.editor.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
* Vditor v3.11.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ue=require("vue"),Jn=require("./DsgLabel.vue_vue_type_style_index_0_lang-BTfTmByq.cjs");var At={exports:{}};/*!
|
|
2
|
+
* Vditor v3.11.3 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
*/var
|
|
27
|
-
`,s),C==-1&&(C=b.length-1);var x=b.substring(s,C+1);(p.hasOwnProperty?p.hasOwnProperty(x):p[x]!==void 0)?g+=String.fromCharCode(p[x]):(_==d&&(x=b.substring(s),C=b.length),g+=String.fromCharCode(_),p[x]=_,y[_++]=x),s=C+1}return g}var d=4e4,v=m(c);d=65535;var w=m(l);return{chars1:v,chars2:w,lineArray:y}},E.prototype.diff_charsToLines_=function(c,l){for(var y=0;y<c.length;y++){for(var p=c[y][1],m=[],d=0;d<p.length;d++)m[d]=l[p.charCodeAt(d)];c[y][1]=m.join("")}},E.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,d=0;y<m;)c.substring(d,m)==l.substring(d,m)?(y=m,d=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,d=0;y<m;)c.substring(c.length-m,c.length-d)==l.substring(l.length-m,l.length-d)?(y=m,d=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonOverlap_=function(c,l){var y=c.length,p=l.length;if(y==0||p==0)return 0;y>p?c=c.substring(y-p):y<p&&(l=l.substring(0,y));var m=Math.min(y,p);if(c==l)return m;for(var d=0,v=1;;){var w=c.substring(m-v),b=l.indexOf(w);if(b==-1)return d;v+=b,(b==0||c.substring(m-v)==l.substring(0,v))&&(d=v,v++)}},E.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var y=c.length>l.length?c:l,p=c.length>l.length?l:c;if(y.length<4||p.length*2<y.length)return null;var m=this;function d(L,P,F){for(var z=L.substring(F,F+Math.floor(L.length/4)),Q=-1,ne="",oe,ge,de,le;(Q=P.indexOf(z,Q+1))!=-1;){var Ee=m.diff_commonPrefix(L.substring(F),P.substring(Q)),_e=m.diff_commonSuffix(L.substring(0,F),P.substring(0,Q));ne.length<_e+Ee&&(ne=P.substring(Q-_e,Q)+P.substring(Q,Q+Ee),oe=L.substring(0,F-_e),ge=L.substring(F+Ee),de=P.substring(0,Q-_e),le=P.substring(Q+Ee))}return ne.length*2>=L.length?[oe,ge,de,le,ne]:null}var v=d(y,p,Math.ceil(y.length/4)),w=d(y,p,Math.ceil(y.length/2)),b;if(!v&&!w)return null;w?v?b=v[4].length>w[4].length?v:w:b=w:b=v;var g,s,C,_;c.length>l.length?(g=b[0],s=b[1],C=b[2],_=b[3]):(C=b[0],_=b[1],g=b[2],s=b[3]);var x=b[4];return[g,s,C,_,x]},E.prototype.diff_cleanupSemantic=function(c){for(var l=!1,y=[],p=0,m=null,d=0,v=0,w=0,b=0,g=0;d<c.length;)c[d][0]==A?(y[p++]=d,v=b,w=g,b=0,g=0,m=c[d][1]):(c[d][0]==D?b+=c[d][1].length:g+=c[d][1].length,m&&m.length<=Math.max(v,w)&&m.length<=Math.max(b,g)&&(c.splice(y[p-1],0,new E.Diff(M,m)),c[y[p-1]+1][0]=D,p--,p--,d=p>0?y[p-1]:-1,v=0,w=0,b=0,g=0,m=null,l=!0)),d++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),d=1;d<c.length;){if(c[d-1][0]==M&&c[d][0]==D){var s=c[d-1][1],C=c[d][1],_=this.diff_commonOverlap_(s,C),x=this.diff_commonOverlap_(C,s);_>=x?(_>=s.length/2||_>=C.length/2)&&(c.splice(d,0,new E.Diff(A,C.substring(0,_))),c[d-1][1]=s.substring(0,s.length-_),c[d+1][1]=C.substring(_),d++):(x>=s.length/2||x>=C.length/2)&&(c.splice(d,0,new E.Diff(A,s.substring(0,x))),c[d-1][0]=D,c[d-1][1]=C.substring(0,C.length-x),c[d+1][0]=M,c[d+1][1]=s.substring(x),d++),d++}d++}},E.prototype.diff_cleanupSemanticLossless=function(c){function l(x,L){if(!x||!L)return 6;var P=x.charAt(x.length-1),F=L.charAt(0),z=P.match(E.nonAlphaNumericRegex_),Q=F.match(E.nonAlphaNumericRegex_),ne=z&&P.match(E.whitespaceRegex_),oe=Q&&F.match(E.whitespaceRegex_),ge=ne&&P.match(E.linebreakRegex_),de=oe&&F.match(E.linebreakRegex_),le=ge&&x.match(E.blanklineEndRegex_),Ee=de&&L.match(E.blanklineStartRegex_);return le||Ee?5:ge||de?4:z&&!ne&&oe?3:ne||oe?2:z||Q?1:0}for(var y=1;y<c.length-1;){if(c[y-1][0]==A&&c[y+1][0]==A){var p=c[y-1][1],m=c[y][1],d=c[y+1][1],v=this.diff_commonSuffix(p,m);if(v){var w=m.substring(m.length-v);p=p.substring(0,p.length-v),m=w+m.substring(0,m.length-v),d=w+d}for(var b=p,g=m,s=d,C=l(p,m)+l(m,d);m.charAt(0)===d.charAt(0);){p+=m.charAt(0),m=m.substring(1)+d.charAt(0),d=d.substring(1);var _=l(p,m)+l(m,d);_>=C&&(C=_,b=p,g=m,s=d)}c[y-1][1]!=b&&(b?c[y-1][1]=b:(c.splice(y-1,1),y--),c[y][1]=g,s?c[y+1][1]=s:(c.splice(y+1,1),y--))}y++}},E.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,E.whitespaceRegex_=/\s/,E.linebreakRegex_=/[\r\n]/,E.blanklineEndRegex_=/\n\r?\n$/,E.blanklineStartRegex_=/^\r?\n\r?\n/,E.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,y=[],p=0,m=null,d=0,v=!1,w=!1,b=!1,g=!1;d<c.length;)c[d][0]==A?(c[d][1].length<this.Diff_EditCost&&(b||g)?(y[p++]=d,v=b,w=g,m=c[d][1]):(p=0,m=null),b=g=!1):(c[d][0]==M?g=!0:b=!0,m&&(v&&w&&b&&g||m.length<this.Diff_EditCost/2&&v+w+b+g==3)&&(c.splice(y[p-1],0,new E.Diff(M,m)),c[y[p-1]+1][0]=D,p--,m=null,v&&w?(b=g=!0,p=0):(p--,d=p>0?y[p-1]:-1,b=g=!1),l=!0)),d++;l&&this.diff_cleanupMerge(c)},E.prototype.diff_cleanupMerge=function(c){c.push(new E.Diff(A,""));for(var l=0,y=0,p=0,m="",d="",v;l<c.length;)switch(c[l][0]){case D:p++,d+=c[l][1],l++;break;case M:y++,m+=c[l][1],l++;break;case A:y+p>1?(y!==0&&p!==0&&(v=this.diff_commonPrefix(d,m),v!==0&&(l-y-p>0&&c[l-y-p-1][0]==A?c[l-y-p-1][1]+=d.substring(0,v):(c.splice(0,0,new E.Diff(A,d.substring(0,v))),l++),d=d.substring(v),m=m.substring(v)),v=this.diff_commonSuffix(d,m),v!==0&&(c[l][1]=d.substring(d.length-v)+c[l][1],d=d.substring(0,d.length-v),m=m.substring(0,m.length-v))),l-=y+p,c.splice(l,y+p),m.length&&(c.splice(l,0,new E.Diff(M,m)),l++),d.length&&(c.splice(l,0,new E.Diff(D,d)),l++),l++):l!==0&&c[l-1][0]==A?(c[l-1][1]+=c[l][1],c.splice(l,1)):l++,p=0,y=0,m="",d="";break}c[c.length-1][1]===""&&c.pop();var w=!1;for(l=1;l<c.length-1;)c[l-1][0]==A&&c[l+1][0]==A&&(c[l][1].substring(c[l][1].length-c[l-1][1].length)==c[l-1][1]?(c[l][1]=c[l-1][1]+c[l][1].substring(0,c[l][1].length-c[l-1][1].length),c[l+1][1]=c[l-1][1]+c[l+1][1],c.splice(l-1,1),w=!0):c[l][1].substring(0,c[l+1][1].length)==c[l+1][1]&&(c[l-1][1]+=c[l+1][1],c[l][1]=c[l][1].substring(c[l+1][1].length)+c[l+1][1],c.splice(l+1,1),w=!0)),l++;w&&this.diff_cleanupMerge(c)},E.prototype.diff_xIndex=function(c,l){var y=0,p=0,m=0,d=0,v;for(v=0;v<c.length&&(c[v][0]!==D&&(y+=c[v][1].length),c[v][0]!==M&&(p+=c[v][1].length),!(y>l));v++)m=y,d=p;return c.length!=v&&c[v][0]===M?d:d+(l-m)},E.prototype.diff_prettyHtml=function(c){for(var l=[],y=/&/g,p=/</g,m=/>/g,d=/\n/g,v=0;v<c.length;v++){var w=c[v][0],b=c[v][1],g=b.replace(y,"&").replace(p,"<").replace(m,">").replace(d,"¶<br>");switch(w){case D:l[v]='<ins style="background:#e6ffe6;">'+g+"</ins>";break;case M:l[v]='<del style="background:#ffe6e6;">'+g+"</del>";break;case A:l[v]="<span>"+g+"</span>";break}}return l.join("")},E.prototype.diff_text1=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==D&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_text2=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==M&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_levenshtein=function(c){for(var l=0,y=0,p=0,m=0;m<c.length;m++){var d=c[m][0],v=c[m][1];switch(d){case D:y+=v.length;break;case M:p+=v.length;break;case A:l+=Math.max(y,p),y=0,p=0;break}}return l+=Math.max(y,p),l},E.prototype.diff_toDelta=function(c){for(var l=[],y=0;y<c.length;y++)switch(c[y][0]){case D:l[y]="+"+encodeURI(c[y][1]);break;case M:l[y]="-"+c[y][1].length;break;case A:l[y]="="+c[y][1].length;break}return l.join(" ").replace(/%20/g," ")},E.prototype.diff_fromDelta=function(c,l){for(var y=[],p=0,m=0,d=l.split(/\t/g),v=0;v<d.length;v++){var w=d[v].substring(1);switch(d[v].charAt(0)){case"+":try{y[p++]=new E.Diff(D,decodeURI(w))}catch{throw new Error("Illegal escape in diff_fromDelta: "+w)}break;case"-":case"=":var b=parseInt(w,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+w);var g=c.substring(m,m+=b);d[v].charAt(0)=="="?y[p++]=new E.Diff(A,g):y[p++]=new E.Diff(M,g);break;default:if(d[v])throw new Error("Invalid diff operation in diff_fromDelta: "+d[v])}}if(m!=c.length)throw new Error("Delta length ("+m+") does not equal source text length ("+c.length+").");return y},E.prototype.match_main=function(c,l,y){if(c==null||l==null||y==null)throw new Error("Null input. (match_main)");return y=Math.max(0,Math.min(y,c.length)),c==l?0:c.length?c.substring(y,y+l.length)==l?y:this.match_bitap_(c,l,y):-1},E.prototype.match_bitap_=function(c,l,y){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),m=this;function d(oe,ge){var de=oe/l.length,le=Math.abs(y-ge);return m.Match_Distance?de+le/m.Match_Distance:le?1:de}var v=this.Match_Threshold,w=c.indexOf(l,y);w!=-1&&(v=Math.min(d(0,w),v),w=c.lastIndexOf(l,y+l.length),w!=-1&&(v=Math.min(d(0,w),v)));var b=1<<l.length-1;w=-1;for(var g,s,C=l.length+c.length,_,x=0;x<l.length;x++){for(g=0,s=C;g<s;)d(x,y+s)<=v?g=s:C=s,s=Math.floor((C-g)/2+g);C=s;var L=Math.max(1,y-s+1),P=Math.min(y+s,c.length)+l.length,F=Array(P+2);F[P+1]=(1<<x)-1;for(var z=P;z>=L;z--){var Q=p[c.charAt(z-1)];if(x===0?F[z]=(F[z+1]<<1|1)&Q:F[z]=(F[z+1]<<1|1)&Q|((_[z+1]|_[z])<<1|1)|_[z+1],F[z]&b){var ne=d(x,z-1);if(ne<=v)if(v=ne,w=z-1,w>y)L=Math.max(1,2*y-w);else break}}if(d(x+1,y)>v)break;_=F}return w},E.prototype.match_alphabet_=function(c){for(var l={},y=0;y<c.length;y++)l[c.charAt(y)]=0;for(var y=0;y<c.length;y++)l[c.charAt(y)]|=1<<c.length-y-1;return l},E.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var y=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(y)!=l.lastIndexOf(y)&&y.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,y=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var m=l.substring(c.start2-p,c.start2);m&&c.diffs.unshift(new E.Diff(A,m));var d=l.substring(c.start2+c.length1,c.start2+c.length1+p);d&&c.diffs.push(new E.Diff(A,d)),c.start1-=m.length,c.start2-=m.length,c.length1+=m.length+d.length,c.length2+=m.length+d.length}},E.prototype.patch_make=function(c,l,y){var p,m;if(typeof c=="string"&&typeof l=="string"&&typeof y>"u")p=c,m=this.diff_main(p,l,!0),m.length>2&&(this.diff_cleanupSemantic(m),this.diff_cleanupEfficiency(m));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof y>"u")m=c,p=this.diff_text1(m);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof y>"u")p=c,m=l;else if(typeof c=="string"&&typeof l=="string"&&y&&typeof y=="object")p=c,m=y;else throw new Error("Unknown call format to patch_make.");if(m.length===0)return[];for(var d=[],v=new E.patch_obj,w=0,b=0,g=0,s=p,C=p,_=0;_<m.length;_++){var x=m[_][0],L=m[_][1];switch(!w&&x!==A&&(v.start1=b,v.start2=g),x){case D:v.diffs[w++]=m[_],v.length2+=L.length,C=C.substring(0,g)+L+C.substring(g);break;case M:v.length1+=L.length,v.diffs[w++]=m[_],C=C.substring(0,g)+C.substring(g+L.length);break;case A:L.length<=2*this.Patch_Margin&&w&&m.length!=_+1?(v.diffs[w++]=m[_],v.length1+=L.length,v.length2+=L.length):L.length>=2*this.Patch_Margin&&w&&(this.patch_addContext_(v,s),d.push(v),v=new E.patch_obj,w=0,s=C,b=g);break}x!==D&&(b+=L.length),x!==M&&(g+=L.length)}return w&&(this.patch_addContext_(v,s),d.push(v)),d},E.prototype.patch_deepCopy=function(c){for(var l=[],y=0;y<c.length;y++){var p=c[y],m=new E.patch_obj;m.diffs=[];for(var d=0;d<p.diffs.length;d++)m.diffs[d]=new E.Diff(p.diffs[d][0],p.diffs[d][1]);m.start1=p.start1,m.start2=p.start2,m.length1=p.length1,m.length2=p.length2,l[y]=m}return l},E.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var y=this.patch_addPadding(c);l=y+l+y,this.patch_splitMax(c);for(var p=0,m=[],d=0;d<c.length;d++){var v=c[d].start2+p,w=this.diff_text1(c[d].diffs),b,g=-1;if(w.length>this.Match_MaxBits?(b=this.match_main(l,w.substring(0,this.Match_MaxBits),v),b!=-1&&(g=this.match_main(l,w.substring(w.length-this.Match_MaxBits),v+w.length-this.Match_MaxBits),(g==-1||b>=g)&&(b=-1))):b=this.match_main(l,w,v),b==-1)m[d]=!1,p-=c[d].length2-c[d].length1;else{m[d]=!0,p=b-v;var s;if(g==-1?s=l.substring(b,b+w.length):s=l.substring(b,g+this.Match_MaxBits),w==s)l=l.substring(0,b)+this.diff_text2(c[d].diffs)+l.substring(b+w.length);else{var C=this.diff_main(w,s,!1);if(w.length>this.Match_MaxBits&&this.diff_levenshtein(C)/w.length>this.Patch_DeleteThreshold)m[d]=!1;else{this.diff_cleanupSemanticLossless(C);for(var _=0,x,L=0;L<c[d].diffs.length;L++){var P=c[d].diffs[L];P[0]!==A&&(x=this.diff_xIndex(C,_)),P[0]===D?l=l.substring(0,b+x)+P[1]+l.substring(b+x):P[0]===M&&(l=l.substring(0,b+x)+l.substring(b+this.diff_xIndex(C,_+P[1].length))),P[0]!==M&&(_+=P[1].length)}}}}}return l=l.substring(y.length,l.length-y.length),[l,m]},E.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,y="",p=1;p<=l;p++)y+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var m=c[0],d=m.diffs;if(d.length==0||d[0][0]!=A)d.unshift(new E.Diff(A,y)),m.start1-=l,m.start2-=l,m.length1+=l,m.length2+=l;else if(l>d[0][1].length){var v=l-d[0][1].length;d[0][1]=y.substring(d[0][1].length)+d[0][1],m.start1-=v,m.start2-=v,m.length1+=v,m.length2+=v}if(m=c[c.length-1],d=m.diffs,d.length==0||d[d.length-1][0]!=A)d.push(new E.Diff(A,y)),m.length1+=l,m.length2+=l;else if(l>d[d.length-1][1].length){var v=l-d[d.length-1][1].length;d[d.length-1][1]+=y.substring(0,v),m.length1+=v,m.length2+=v}return y},E.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,y=0;y<c.length;y++)if(!(c[y].length1<=l)){var p=c[y];c.splice(y--,1);for(var m=p.start1,d=p.start2,v="";p.diffs.length!==0;){var w=new E.patch_obj,b=!0;for(w.start1=m-v.length,w.start2=d-v.length,v!==""&&(w.length1=w.length2=v.length,w.diffs.push(new E.Diff(A,v)));p.diffs.length!==0&&w.length1<l-this.Patch_Margin;){var g=p.diffs[0][0],s=p.diffs[0][1];g===D?(w.length2+=s.length,d+=s.length,w.diffs.push(p.diffs.shift()),b=!1):g===M&&w.diffs.length==1&&w.diffs[0][0]==A&&s.length>2*l?(w.length1+=s.length,m+=s.length,b=!1,w.diffs.push(new E.Diff(g,s)),p.diffs.shift()):(s=s.substring(0,l-w.length1-this.Patch_Margin),w.length1+=s.length,m+=s.length,g===A?(w.length2+=s.length,d+=s.length):b=!1,w.diffs.push(new E.Diff(g,s)),s==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(s.length))}v=this.diff_text2(w.diffs),v=v.substring(v.length-this.Patch_Margin);var C=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);C!==""&&(w.length1+=C.length,w.length2+=C.length,w.diffs.length!==0&&w.diffs[w.diffs.length-1][0]===A?w.diffs[w.diffs.length-1][1]+=C:w.diffs.push(new E.Diff(A,C))),b||c.splice(++y,0,w)}}},E.prototype.patch_toText=function(c){for(var l=[],y=0;y<c.length;y++)l[y]=c[y];return l.join("")},E.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var y=c.split(`
|
|
28
|
-
`),
|
|
29
|
-
`],
|
|
30
|
-
`}return y.join("").replace(/%20/g," ")},Z.exports=E,Z.exports.diff_match_patch=E,Z.exports.DIFF_DELETE=M,Z.exports.DIFF_INSERT=D,Z.exports.DIFF_EQUAL=A}),408:((Z,E,M)=>{M.d(E,{default:()=>qe});var D=M(135),A=M(840),c=M(775),l=M(428),y=M(325),p=M(483),m=M(999),d=function(I){I===void 0&&(I=document);var re=function(W){var j=document.createElement("img");j.src=W.getAttribute("data-src"),j.addEventListener("load",function(){!W.getAttribute("style")&&!W.getAttribute("class")&&!W.getAttribute("width")&&!W.getAttribute("height")&&j.naturalHeight>j.naturalWidth&&j.naturalWidth/j.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&j.naturalHeight>window.innerHeight-40&&(W.style.height=window.innerHeight-40+"px"),W.src=j.src}),W.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return I.querySelectorAll("img").forEach(function(W){W.getAttribute("data-src")&&re(W)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),I.querySelectorAll("img").forEach(function(W){window.vditorImageIntersectionObserver.observe(W)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(W){W.forEach(function(j){(typeof j.isIntersecting>"u"?j.intersectionRatio!==0:j.isIntersecting)&&j.target.getAttribute("data-src")&&re(j.target)})}),I.querySelectorAll("img").forEach(function(W){window.vditorImageIntersectionObserver.observe(W)}))},v=M(472),w=M(280),b=M(637),g=M(825),s=M(11),C=M(194),_=M(436),x=M(229),L=M(145),P=M(538),F=M(413),z=M(106),Q=M(673),ne=function(I){document.querySelectorAll(".vditor-anchor").forEach(function(re){I===1&&re.classList.add("vditor-anchor--left"),re.onclick=function(){var W=re.getAttribute("href").substr(1),j=document.getElementById("vditorAnchor-"+W).offsetTop;document.querySelector("html").scrollTop=j}}),window.onhashchange=function(){var re=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));re&&(document.querySelector("html").scrollTop=re.offsetTop)}},oe=M(214),ge=M(810),de=function(I,re){if(re===void 0&&(re="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var W=function(){var ke=speechSynthesis.getVoices(),X,pe;return ke.forEach(function(He){He.lang===re.replace("_","-")&&(X=He),He.default&&(pe=He)}),X||(X=pe),X},j='<svg><use xlink:href="#vditor-icon-play"></use></svg>',he='<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>',he='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var K=document.querySelector(".vditor-speech");K||(K=document.createElement("button"),K.className="vditor-speech",I.insertAdjacentElement("beforeend",K),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=W));var ye=W(),ie=new SpeechSynthesisUtterance;ie.voice=ye,ie.onend=ie.onerror=function(){K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j},I.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(ke){var X=ke.target;if(X.classList.contains("vditor-speech")||X.parentElement.classList.contains("vditor-speech")){K.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),K.innerHTML=he):(speechSynthesis.pause(),K.innerHTML=j)):(ie.text=K.getAttribute("data-text"),speechSynthesis.speak(ie),K.classList.add("vditor-speech--current"),K.innerHTML=he),(0,ge.Hc)(window.vditorSpeechRange),I.focus();return}if(K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j,getSelection().rangeCount!==0){var pe=getSelection().getRangeAt(0),He=pe.toString().trim();if(He){window.vditorSpeechRange=pe.cloneRange();var Re=pe.getBoundingClientRect();K.innerHTML=j,K.style.display="block",K.style.top=Re.top+Re.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?K.style.left=ke.changedTouches[ke.changedTouches.length-1].pageX+2+"px":K.style.left=ke.clientX+2+"px",K.setAttribute("data-text",He)}}})}},le=function(I,re,W,j){function he(K){return K instanceof W?K:new W(function(ye){ye(K)})}return new(W||(W=Promise))(function(K,ye){function ie(pe){try{X(j.next(pe))}catch(He){ye(He)}}function ke(pe){try{X(j.throw(pe))}catch(He){ye(He)}}function X(pe){pe.done?K(pe.value):he(pe.value).then(ie,ke)}X((j=j.apply(I,re||[])).next())})},Ee=function(I,re){var W={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},j,he,K,ye;return ye={next:ie(0),throw:ie(1),return:ie(2)},typeof Symbol=="function"&&(ye[Symbol.iterator]=function(){return this}),ye;function ie(X){return function(pe){return ke([X,pe])}}function ke(X){if(j)throw new TypeError("Generator is already executing.");for(;ye&&(ye=0,X[0]&&(W=0)),W;)try{if(j=1,he&&(K=X[0]&2?he.return:X[0]?he.throw||((K=he.return)&&K.call(he),0):he.next)&&!(K=K.call(he,X[1])).done)return K;switch(he=0,K&&(X=[X[0]&2,K.value]),X[0]){case 0:case 1:K=X;break;case 4:return W.label++,{value:X[1],done:!1};case 5:W.label++,he=X[1],X=[0];continue;case 7:X=W.ops.pop(),W.trys.pop();continue;default:if(K=W.trys,!(K=K.length>0&&K[K.length-1])&&(X[0]===6||X[0]===2)){W=0;continue}if(X[0]===3&&(!K||X[1]>K[0]&&X[1]<K[3])){W.label=X[1];break}if(X[0]===6&&W.label<K[1]){W.label=K[1],K=X;break}if(K&&W.label<K[2]){W.label=K[2],W.ops.push(X);break}K[2]&&W.ops.pop(),W.trys.pop();continue}X=re.call(I,W)}catch(pe){X=[6,pe],he=0}finally{j=K=0}if(X[0]&5)throw X[1];return{value:X[0]?X[1]:void 0,done:!0}}},_e=function(I){var re,W={anchor:0,cdn:L.g.CDN,customEmoji:{},emojiPath:"".concat(L.g.CDN,"/dist/images/emoji"),hljs:L.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:L.g.MARKDOWN_OPTIONS,math:L.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:L.g.THEME_OPTIONS};return I.cdn&&(!((re=I.theme)===null||re===void 0)&&re.path||(W.theme.path="".concat(I.cdn,"/dist/css/content-theme")),I.emojiPath||(W.emojiPath="".concat(I.cdn,"/dist/images/emoji"))),(0,Q.T)(W,I)},Se=function(I,re){var W=_e(re);return(0,F.G)("".concat(W.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var j=(0,oe.X)({autoSpace:W.markdown.autoSpace,gfmAutoLink:W.markdown.gfmAutoLink,codeBlockPreview:W.markdown.codeBlockPreview,emojiSite:W.emojiPath,emojis:W.customEmoji,fixTermTypo:W.markdown.fixTermTypo,footnotes:W.markdown.footnotes,headingAnchor:W.anchor!==0,inlineMathDigit:W.math.inlineDigit,lazyLoadImage:W.lazyLoadImage,linkBase:W.markdown.linkBase,linkPrefix:W.markdown.linkPrefix,listStyle:W.markdown.listStyle,mark:W.markdown.mark,mathBlockPreview:W.markdown.mathBlockPreview,paragraphBeginningSpace:W.markdown.paragraphBeginningSpace,sanitize:W.markdown.sanitize,toc:W.markdown.toc});return re?.renderers&&j.SetJSRenderers({renderers:{Md2HTML:re.renderers}}),j.SetHeadingID(!0),j.Md2HTML(I)})},k=function(I,re,W){return le(void 0,void 0,void 0,function(){var j,he,K,ye;return Ee(this,function(ie){switch(ie.label){case 0:return j=_e(W),[4,Se(re,j)];case 1:if(he=ie.sent(),j.transform&&(he=j.transform(he)),I.innerHTML=he,I.classList.add("vditor-reset"),j.i18n)return[3,5];if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","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 K="vditorI18nScript",ye=K+j.lang,document.querySelectorAll('head script[id^="'.concat(K,'"]')).forEach(function(ke){ke.id!==ye&&document.head.removeChild(ke)}),[4,(0,F.G)("".concat(j.cdn,"/dist/js/i18n/").concat(j.lang,".js"),ye)];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,F.G)("".concat(j.cdn,"/dist/js/icons/").concat(j.icon,".js"),"vditorIconScript")]:[3,8];case 7:ie.sent(),ie.label=8;case 8:return(0,P.Z)(j.theme.current,j.theme.path),j.anchor===1&&I.classList.add("vditor-reset--anchor"),(0,l.O)(I,j.hljs),(0,m.s)(j.hljs,I,j.cdn),(0,v.H)(I,{cdn:j.cdn,math:j.math}),(0,b.i)(I,j.cdn,j.mode),(0,g.J)(I,j.cdn,j.mode),(0,s.K)(I,j.cdn),(0,y.P)(I,j.cdn),(0,p.v)(I,j.cdn),(0,c.p)(I,j.cdn,j.mode),(0,C.P)(I,j.cdn,j.mode),(0,x.B)(I,j.cdn),(0,D.Q)(I,j.cdn),j.render.media.enable&&(0,w.Y)(I),j.speech.enable&&de(I),j.anchor!==0&&ne(j.anchor),j.after&&j.after(),j.lazyLoadImage&&d(I),I.addEventListener("click",function(ke){var X=(0,z.lG)(ke.target,"SPAN");if(X&&(0,z.fb)(X,"vditor-toc")){var pe=I.querySelector("#"+X.getAttribute("data-target-id"));pe&&window.scrollTo(window.scrollX,pe.offsetTop);return}}),[2]}})})},Be=M(190),ht=M(580),mt=(function(){function I(){}return I.adapterRender=A,I.previewImage=Be.E,I.codeRender=l.O,I.graphvizRender=p.v,I.highlightRender=m.s,I.mathRender=v.H,I.mermaidRender=b.i,I.SMILESRender=g.J,I.markmapRender=s.K,I.flowchartRender=y.P,I.chartRender=c.p,I.abcRender=D.Q,I.mindmapRender=C.P,I.plantumlRender=x.B,I.outlineRender=_.k,I.mediaRender=w.Y,I.speechRender=de,I.lazyLoadImageRender=d,I.md2html=Se,I.preview=k,I.setCodeTheme=ht.Y,I.setContentTheme=P.Z,I})();const qe=mt}),145:((Z,E,M)=>{M.d(E,{H:()=>D,g:()=>A});var D="3.11.2",A=(function(){function c(){}return c.ZWSP="",c.DROP_EDITOR="application/editor",c.MOBILE_WIDTH=520,c.CLASS_MENU_DISABLED="vditor-menu--disabled",c.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"],c.CODE_THEME=["a11y-dark","agate","an-old-hope","androidstudio","arta","atom-one-dark","atom-one-dark-reasonable","base16/3024","base16/apathy","base16/apprentice","base16/ashes","base16/atelier-cave","base16/atelier-dune","base16/atelier-estuary","base16/atelier-forest","base16/atelier-heath","base16/atelier-lakeside","base16/atelier-plateau","base16/atelier-savanna","base16/atelier-seaside","base16/atelier-sulphurpool","base16/atlas","base16/bespin","base16/black-metal","base16/black-metal-bathory","base16/black-metal-burzum","base16/black-metal-dark-funeral","base16/black-metal-gorgoroth","base16/black-metal-immortal","base16/black-metal-khold","base16/black-metal-marduk","base16/black-metal-mayhem","base16/black-metal-nile","base16/black-metal-venom","base16/brewer","base16/bright","base16/brogrammer","base16/brush-trees-dark","base16/chalk","base16/circus","base16/classic-dark","base16/codeschool","base16/colors","base16/danqing","base16/darcula","base16/dark-violet","base16/darkmoss","base16/darktooth","base16/decaf","base16/default-dark","base16/dracula","base16/edge-dark","base16/eighties","base16/embers","base16/equilibrium-dark","base16/equilibrium-gray-dark","base16/espresso","base16/eva","base16/eva-dim","base16/flat","base16/framer","base16/gigavolt","base16/google-dark","base16/grayscale-dark","base16/green-screen","base16/gruvbox-dark-hard","base16/gruvbox-dark-medium","base16/gruvbox-dark-pale","base16/gruvbox-dark-soft","base16/hardcore","base16/harmonic16-dark","base16/heetch-dark","base16/helios","base16/hopscotch","base16/horizon-dark","base16/humanoid-dark","base16/ia-dark","base16/icy-dark","base16/ir-black","base16/isotope","base16/kimber","base16/london-tube","base16/macintosh","base16/marrakesh","base16/materia","base16/material","base16/material-darker","base16/material-palenight","base16/material-vivid","base16/mellow-purple","base16/mocha","base16/monokai","base16/nebula","base16/nord","base16/nova","base16/ocean","base16/oceanicnext","base16/onedark","base16/outrun-dark","base16/papercolor-dark","base16/paraiso","base16/pasque","base16/phd","base16/pico","base16/pop","base16/porple","base16/qualia","base16/railscasts","base16/rebecca","base16/ros-pine","base16/ros-pine-moon","base16/sandcastle","base16/seti-ui","base16/silk-dark","base16/snazzy","base16/solar-flare","base16/solarized-dark","base16/spacemacs","base16/summercamp","base16/summerfruit-dark","base16/synth-midnight-terminal-dark","base16/tango","base16/tender","base16/tomorrow-night","base16/twilight","base16/unikitty-dark","base16/vulcan","base16/windows-10","base16/windows-95","base16/windows-high-contrast","base16/windows-nt","base16/woodland","base16/xcode-dusk","base16/zenburn","codepen-embed","dark","devibeans","far","felipec","github-dark","github-dark-dimmed","gml","gradient-dark","hybrid","ir-black","isbl-editor-dark","kimbie-dark","lioshi","monokai","monokai-sublime","night-owl","nnfx-dark","nord","obsidian","panda-syntax-dark","paraiso-dark","pojoaque","qtcreator-dark","rainbow","shades-of-purple","srcery","stackoverflow-dark","sunburst","tomorrow-night-blue","tomorrow-night-bright","tokyo-night-dark","vs2015","xt256","ant-design","a11y-light","arduino-light","ascetic","atom-one-light","base16/atelier-cave-light","base16/atelier-dune-light","base16/atelier-estuary-light","base16/atelier-forest-light","base16/atelier-heath-light","base16/atelier-lakeside-light","base16/atelier-plateau-light","base16/atelier-savanna-light","base16/atelier-seaside-light","base16/atelier-sulphurpool-light","base16/brush-trees","base16/classic-light","base16/cupcake","base16/cupertino","base16/default-light","base16/dirtysea","base16/edge-light","base16/equilibrium-gray-light","base16/equilibrium-light","base16/fruit-soda","base16/github","base16/google-light","base16/grayscale-light","base16/gruvbox-light-hard","base16/gruvbox-light-medium","base16/gruvbox-light-soft","base16/harmonic16-light","base16/heetch-light","base16/humanoid-light","base16/horizon-light","base16/ia-light","base16/material-lighter","base16/mexico-light","base16/one-light","base16/papercolor-light","base16/ros-pine-dawn","base16/sagelight","base16/shapeshifter","base16/silk-light","base16/solar-flare-light","base16/solarized-light","base16/summerfruit-light","base16/synth-midnight-terminal-light","base16/tomorrow","base16/unikitty-light","base16/windows-10-light","base16/windows-95-light","base16/windows-high-contrast-light","brown-paper","base16/windows-nt-light","color-brewer","docco","foundation","github","googlecode","gradient-light","grayscale","idea","intellij-light","isbl-editor-light","kimbie-light","lightfair","magula","mono-blue","nnfx-light","panda-syntax-light","paraiso-light","purebasic","qtcreator-light","routeros","school-book","stackoverflow-light","tokyo-night-light","vs","xcode","default"],c.ALIAS_CODE_LANGUAGES=["abc","plantuml","mermaid","flowchart","echarts","mindmap","graphviz","math","markmap","smiles","js","ts","html","toml","c#","bat"],c.CDN="https://unpkg.com/vditor@".concat("3.11.2"),c.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},c.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},c.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},c.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(c.CDN,"/dist/css/content-theme")},c})()}),825:((Z,E,M)=>{M.d(E,{J:()=>y});var D=M(145),A=M(413),c=M(840),l=M(494),y=function(p,m,d){p===void 0&&(p=document),m===void 0&&(m=D.g.CDN);var v=c.SMILESRenderAdapter.getElements(p);v.length>0&&(0,A.G)("".concat(m,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var w=new SmiDrawer({},{});v.forEach(function(b){var g=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var s="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(s,'"></svg>'),w.draw(g,"#"+s,d==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}}),135:((Z,E,M)=>{M.d(E,{Q:()=>l});var D=M(145),A=M(413),c=M(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=D.g.CDN);var m=c.abcRenderAdapter.getElements(y);m.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){m.forEach(function(d){d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre")||d.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(d,c.abcRenderAdapter.getCode(d).trim()),d.style.overflowX="auto",d.setAttribute("data-processed","true"))})})}}),840:((Z,E,M)=>{M.r(E),M.d(E,{mathRenderAdapter:()=>D,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>y,chartRenderAdapter:()=>p,abcRenderAdapter:()=>m,graphvizRenderAdapter:()=>d,flowchartRenderAdapter:()=>v,plantumlRenderAdapter:()=>w});var D={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-math")}},A={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-smiles")}},c={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-mermaid")}},l={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-markmap")}},y={getCode:function(b){return b.getAttribute("data-code")},getElements:function(b){return b.querySelectorAll(".language-mindmap")}},p={getCode:function(b){return b.innerText},getElements:function(b){return b.querySelectorAll(".language-echarts")}},m={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-abc")}},d={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-graphviz")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},w={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}}),775:((Z,E,M)=>{M.d(E,{p:()=>m});var D=M(145),A=M(413),c=M(840),l=M(494),y=function(d,v,w,b){function g(s){return s instanceof w?s:new w(function(C){C(s)})}return new(w||(w=Promise))(function(s,C){function _(P){try{L(b.next(P))}catch(F){C(F)}}function x(P){try{L(b.throw(P))}catch(F){C(F)}}function L(P){P.done?s(P.value):g(P.value).then(_,x)}L((b=b.apply(d,v||[])).next())})},p=function(d,v){var w={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,g,s,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(L){return function(P){return x([L,P])}}function x(L){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,L[0]&&(w=0)),w;)try{if(b=1,g&&(s=L[0]&2?g.return:L[0]?g.throw||((s=g.return)&&s.call(g),0):g.next)&&!(s=s.call(g,L[1])).done)return s;switch(g=0,s&&(L=[L[0]&2,s.value]),L[0]){case 0:case 1:s=L;break;case 4:return w.label++,{value:L[1],done:!1};case 5:w.label++,g=L[1],L=[0];continue;case 7:L=w.ops.pop(),w.trys.pop();continue;default:if(s=w.trys,!(s=s.length>0&&s[s.length-1])&&(L[0]===6||L[0]===2)){w=0;continue}if(L[0]===3&&(!s||L[1]>s[0]&&L[1]<s[3])){w.label=L[1];break}if(L[0]===6&&w.label<s[1]){w.label=s[1],s=L;break}if(s&&w.label<s[2]){w.label=s[2],w.ops.push(L);break}s[2]&&w.ops.pop(),w.trys.pop();continue}L=v.call(d,w)}catch(P){L=[6,P],g=0}finally{b=s=0}if(L[0]&5)throw L[1];return{value:L[0]?L[1]:void 0,done:!0}}},m=function(d,v,w){d===void 0&&(d=document),v===void 0&&(v=D.g.CDN);var b=c.chartRenderAdapter.getElements(d);b.length>0&&(0,A.G)("".concat(v,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(g){return y(void 0,void 0,void 0,function(){var s,C,_;return p(this,function(x){switch(x.label){case 0:if(g.parentElement.classList.contains("vditor-wysiwyg__pre")||g.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(s=c.chartRenderAdapter.getCode(g).trim(),!s)return[2];x.label=1;case 1:return x.trys.push([1,3,,4]),g.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(s)];case 2:return C=x.sent(),echarts.init(g,w==="dark"?"dark":void 0).setOption(C),g.setAttribute("data-processed","true"),[3,4];case 3:return _=x.sent(),g.className="vditor-reset--error",g.innerHTML="echarts render error: <br>".concat(_),[3,4];case 4:return[2]}})})})})}}),428:((Z,E,M)=>{M.d(E,{O:()=>c});var D=M(105),A=M(145),c=function(l,y){Array.from(l.querySelectorAll("pre > code")).filter(function(p,m){return!(p.parentElement.classList.contains("vditor-wysiwyg__pre")||p.parentElement.classList.contains("vditor-ir__marker--pre")||p.classList.contains("language-mermaid")||p.classList.contains("language-flowchart")||p.classList.contains("language-echarts")||p.classList.contains("language-mindmap")||p.classList.contains("language-plantuml")||p.classList.contains("language-markmap")||p.classList.contains("language-abc")||p.classList.contains("language-graphviz")||p.classList.contains("language-math")||p.classList.contains("language-smiles")||p.style.maxHeight.indexOf("px")>-1||l.classList.contains("vditor-preview")&&m>5)}).forEach(function(p){var m,d,v,w=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(_){_.remove()}),w=b.innerText}else w.endsWith(`
|
|
31
|
-
`)&&(
|
|
32
|
-
onmouseover="this.setAttribute('aria-label', '`).concat(((
|
|
26
|
+
*/var ji=At.exports,Zn;function Bi(){return Zn||(Zn=1,(function(Ee,$t){(function(it,X){Ee.exports=X()})(ji,function(){return(()=>{var ht={132:(Z=>{var S=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},k=-1,H=1,A=0;S.Diff=function(u,m){return[u,m]},S.prototype.diff_main=function(u,m,l,b){typeof b>"u"&&(this.Diff_Timeout<=0?b=Number.MAX_VALUE:b=new Date().getTime()+this.Diff_Timeout*1e3);var g=b;if(u==null||m==null)throw new Error("Null input. (diff_main)");if(u==m)return u?[new S.Diff(A,u)]:[];typeof l>"u"&&(l=!0);var h=l,E=this.diff_commonPrefix(u,m),v=u.substring(0,E);u=u.substring(E),m=m.substring(E),E=this.diff_commonSuffix(u,m);var w=u.substring(u.length-E);u=u.substring(0,u.length-E),m=m.substring(0,m.length-E);var c=this.diff_compute_(u,m,h,g);return v&&c.unshift(new S.Diff(A,v)),w&&c.push(new S.Diff(A,w)),this.diff_cleanupMerge(c),c},S.prototype.diff_compute_=function(u,m,l,b){var g;if(!u)return[new S.Diff(H,m)];if(!m)return[new S.Diff(k,u)];var h=u.length>m.length?u:m,E=u.length>m.length?m:u,v=h.indexOf(E);if(v!=-1)return g=[new S.Diff(H,h.substring(0,v)),new S.Diff(A,E),new S.Diff(H,h.substring(v+E.length))],u.length>m.length&&(g[0][0]=g[2][0]=k),g;if(E.length==1)return[new S.Diff(k,u),new S.Diff(H,m)];var w=this.diff_halfMatch_(u,m);if(w){var c=w[0],f=w[1],s=w[2],M=w[3],x=w[4],L=this.diff_main(c,s,l,b),D=this.diff_main(f,M,l,b);return L.concat([new S.Diff(A,x)],D)}return l&&u.length>100&&m.length>100?this.diff_lineMode_(u,m,b):this.diff_bisect_(u,m,b)},S.prototype.diff_lineMode_=function(u,m,l){var b=this.diff_linesToChars_(u,m);u=b.chars1,m=b.chars2;var g=b.lineArray,h=this.diff_main(u,m,!1,l);this.diff_charsToLines_(h,g),this.diff_cleanupSemantic(h),h.push(new S.Diff(A,""));for(var E=0,v=0,w=0,c="",f="";E<h.length;){switch(h[E][0]){case H:w++,f+=h[E][1];break;case k:v++,c+=h[E][1];break;case A:if(v>=1&&w>=1){h.splice(E-v-w,v+w),E=E-v-w;for(var s=this.diff_main(c,f,!1,l),M=s.length-1;M>=0;M--)h.splice(E,0,s[M]);E=E+s.length}w=0,v=0,c="",f="";break}E++}return h.pop(),h},S.prototype.diff_bisect_=function(u,m,l){for(var b=u.length,g=m.length,h=Math.ceil((b+g)/2),E=h,v=2*h,w=new Array(v),c=new Array(v),f=0;f<v;f++)w[f]=-1,c[f]=-1;w[E+1]=0,c[E+1]=0;for(var s=b-g,M=s%2!=0,x=0,L=0,D=0,j=0,q=0;q<h&&!(new Date().getTime()>l);q++){for(var ee=-q+x;ee<=q-L;ee+=2){var oe=E+ee,ne;ee==-q||ee!=q&&w[oe-1]<w[oe+1]?ne=w[oe+1]:ne=w[oe-1]+1;for(var ge=ne-ee;ne<b&&ge<g&&u.charAt(ne)==m.charAt(ge);)ne++,ge++;if(w[oe]=ne,ne>b)L+=2;else if(ge>g)x+=2;else if(M){var de=E+s-ee;if(de>=0&&de<v&&c[de]!=-1){var se=b-c[de];if(ne>=se)return this.diff_bisectSplit_(u,m,ne,ge,l)}}}for(var ye=-q+D;ye<=q-j;ye+=2){var de=E+ye,se;ye==-q||ye!=q&&c[de-1]<c[de+1]?se=c[de+1]:se=c[de-1]+1;for(var Ae=se-ye;se<b&&Ae<g&&u.charAt(b-se-1)==m.charAt(g-Ae-1);)se++,Ae++;if(c[de]=se,se>b)j+=2;else if(Ae>g)D+=2;else if(!M){var oe=E+s-ye;if(oe>=0&&oe<v&&w[oe]!=-1){var ne=w[oe],ge=E+ne-oe;if(se=b-se,ne>=se)return this.diff_bisectSplit_(u,m,ne,ge,l)}}}}return[new S.Diff(k,u),new S.Diff(H,m)]},S.prototype.diff_bisectSplit_=function(u,m,l,b,g){var h=u.substring(0,l),E=m.substring(0,b),v=u.substring(l),w=m.substring(b),c=this.diff_main(h,E,!1,g),f=this.diff_main(v,w,!1,g);return c.concat(f)},S.prototype.diff_linesToChars_=function(u,m){var l=[],b={};l[0]="";function g(w){for(var c="",f=0,s=-1,M=l.length;s<w.length-1;){s=w.indexOf(`
|
|
27
|
+
`,f),s==-1&&(s=w.length-1);var x=w.substring(f,s+1);(b.hasOwnProperty?b.hasOwnProperty(x):b[x]!==void 0)?c+=String.fromCharCode(b[x]):(M==h&&(x=w.substring(f),s=w.length),c+=String.fromCharCode(M),b[x]=M,l[M++]=x),f=s+1}return c}var h=4e4,E=g(u);h=65535;var v=g(m);return{chars1:E,chars2:v,lineArray:l}},S.prototype.diff_charsToLines_=function(u,m){for(var l=0;l<u.length;l++){for(var b=u[l][1],g=[],h=0;h<b.length;h++)g[h]=m[b.charCodeAt(h)];u[l][1]=g.join("")}},S.prototype.diff_commonPrefix=function(u,m){if(!u||!m||u.charAt(0)!=m.charAt(0))return 0;for(var l=0,b=Math.min(u.length,m.length),g=b,h=0;l<g;)u.substring(h,g)==m.substring(h,g)?(l=g,h=l):b=g,g=Math.floor((b-l)/2+l);return g},S.prototype.diff_commonSuffix=function(u,m){if(!u||!m||u.charAt(u.length-1)!=m.charAt(m.length-1))return 0;for(var l=0,b=Math.min(u.length,m.length),g=b,h=0;l<g;)u.substring(u.length-g,u.length-h)==m.substring(m.length-g,m.length-h)?(l=g,h=l):b=g,g=Math.floor((b-l)/2+l);return g},S.prototype.diff_commonOverlap_=function(u,m){var l=u.length,b=m.length;if(l==0||b==0)return 0;l>b?u=u.substring(l-b):l<b&&(m=m.substring(0,l));var g=Math.min(l,b);if(u==m)return g;for(var h=0,E=1;;){var v=u.substring(g-E),w=m.indexOf(v);if(w==-1)return h;E+=w,(w==0||u.substring(g-E)==m.substring(0,E))&&(h=E,E++)}},S.prototype.diff_halfMatch_=function(u,m){if(this.Diff_Timeout<=0)return null;var l=u.length>m.length?u:m,b=u.length>m.length?m:u;if(l.length<4||b.length*2<l.length)return null;var g=this;function h(L,D,j){for(var q=L.substring(j,j+Math.floor(L.length/4)),ee=-1,oe="",ne,ge,de,se;(ee=D.indexOf(q,ee+1))!=-1;){var ye=g.diff_commonPrefix(L.substring(j),D.substring(ee)),Ae=g.diff_commonSuffix(L.substring(0,j),D.substring(0,ee));oe.length<Ae+ye&&(oe=D.substring(ee-Ae,ee)+D.substring(ee,ee+ye),ne=L.substring(0,j-Ae),ge=L.substring(j+ye),de=D.substring(0,ee-Ae),se=D.substring(ee+ye))}return oe.length*2>=L.length?[ne,ge,de,se,oe]:null}var E=h(l,b,Math.ceil(l.length/4)),v=h(l,b,Math.ceil(l.length/2)),w;if(!E&&!v)return null;v?E?w=E[4].length>v[4].length?E:v:w=v:w=E;var c,f,s,M;u.length>m.length?(c=w[0],f=w[1],s=w[2],M=w[3]):(s=w[0],M=w[1],c=w[2],f=w[3]);var x=w[4];return[c,f,s,M,x]},S.prototype.diff_cleanupSemantic=function(u){for(var m=!1,l=[],b=0,g=null,h=0,E=0,v=0,w=0,c=0;h<u.length;)u[h][0]==A?(l[b++]=h,E=w,v=c,w=0,c=0,g=u[h][1]):(u[h][0]==H?w+=u[h][1].length:c+=u[h][1].length,g&&g.length<=Math.max(E,v)&&g.length<=Math.max(w,c)&&(u.splice(l[b-1],0,new S.Diff(k,g)),u[l[b-1]+1][0]=H,b--,b--,h=b>0?l[b-1]:-1,E=0,v=0,w=0,c=0,g=null,m=!0)),h++;for(m&&this.diff_cleanupMerge(u),this.diff_cleanupSemanticLossless(u),h=1;h<u.length;){if(u[h-1][0]==k&&u[h][0]==H){var f=u[h-1][1],s=u[h][1],M=this.diff_commonOverlap_(f,s),x=this.diff_commonOverlap_(s,f);M>=x?(M>=f.length/2||M>=s.length/2)&&(u.splice(h,0,new S.Diff(A,s.substring(0,M))),u[h-1][1]=f.substring(0,f.length-M),u[h+1][1]=s.substring(M),h++):(x>=f.length/2||x>=s.length/2)&&(u.splice(h,0,new S.Diff(A,f.substring(0,x))),u[h-1][0]=H,u[h-1][1]=s.substring(0,s.length-x),u[h+1][0]=k,u[h+1][1]=f.substring(x),h++),h++}h++}},S.prototype.diff_cleanupSemanticLossless=function(u){function m(x,L){if(!x||!L)return 6;var D=x.charAt(x.length-1),j=L.charAt(0),q=D.match(S.nonAlphaNumericRegex_),ee=j.match(S.nonAlphaNumericRegex_),oe=q&&D.match(S.whitespaceRegex_),ne=ee&&j.match(S.whitespaceRegex_),ge=oe&&D.match(S.linebreakRegex_),de=ne&&j.match(S.linebreakRegex_),se=ge&&x.match(S.blanklineEndRegex_),ye=de&&L.match(S.blanklineStartRegex_);return se||ye?5:ge||de?4:q&&!oe&&ne?3:oe||ne?2:q||ee?1:0}for(var l=1;l<u.length-1;){if(u[l-1][0]==A&&u[l+1][0]==A){var b=u[l-1][1],g=u[l][1],h=u[l+1][1],E=this.diff_commonSuffix(b,g);if(E){var v=g.substring(g.length-E);b=b.substring(0,b.length-E),g=v+g.substring(0,g.length-E),h=v+h}for(var w=b,c=g,f=h,s=m(b,g)+m(g,h);g.charAt(0)===h.charAt(0);){b+=g.charAt(0),g=g.substring(1)+h.charAt(0),h=h.substring(1);var M=m(b,g)+m(g,h);M>=s&&(s=M,w=b,c=g,f=h)}u[l-1][1]!=w&&(w?u[l-1][1]=w:(u.splice(l-1,1),l--),u[l][1]=c,f?u[l+1][1]=f:(u.splice(l+1,1),l--))}l++}},S.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,S.whitespaceRegex_=/\s/,S.linebreakRegex_=/[\r\n]/,S.blanklineEndRegex_=/\n\r?\n$/,S.blanklineStartRegex_=/^\r?\n\r?\n/,S.prototype.diff_cleanupEfficiency=function(u){for(var m=!1,l=[],b=0,g=null,h=0,E=!1,v=!1,w=!1,c=!1;h<u.length;)u[h][0]==A?(u[h][1].length<this.Diff_EditCost&&(w||c)?(l[b++]=h,E=w,v=c,g=u[h][1]):(b=0,g=null),w=c=!1):(u[h][0]==k?c=!0:w=!0,g&&(E&&v&&w&&c||g.length<this.Diff_EditCost/2&&E+v+w+c==3)&&(u.splice(l[b-1],0,new S.Diff(k,g)),u[l[b-1]+1][0]=H,b--,g=null,E&&v?(w=c=!0,b=0):(b--,h=b>0?l[b-1]:-1,w=c=!1),m=!0)),h++;m&&this.diff_cleanupMerge(u)},S.prototype.diff_cleanupMerge=function(u){u.push(new S.Diff(A,""));for(var m=0,l=0,b=0,g="",h="",E;m<u.length;)switch(u[m][0]){case H:b++,h+=u[m][1],m++;break;case k:l++,g+=u[m][1],m++;break;case A:l+b>1?(l!==0&&b!==0&&(E=this.diff_commonPrefix(h,g),E!==0&&(m-l-b>0&&u[m-l-b-1][0]==A?u[m-l-b-1][1]+=h.substring(0,E):(u.splice(0,0,new S.Diff(A,h.substring(0,E))),m++),h=h.substring(E),g=g.substring(E)),E=this.diff_commonSuffix(h,g),E!==0&&(u[m][1]=h.substring(h.length-E)+u[m][1],h=h.substring(0,h.length-E),g=g.substring(0,g.length-E))),m-=l+b,u.splice(m,l+b),g.length&&(u.splice(m,0,new S.Diff(k,g)),m++),h.length&&(u.splice(m,0,new S.Diff(H,h)),m++),m++):m!==0&&u[m-1][0]==A?(u[m-1][1]+=u[m][1],u.splice(m,1)):m++,b=0,l=0,g="",h="";break}u[u.length-1][1]===""&&u.pop();var v=!1;for(m=1;m<u.length-1;)u[m-1][0]==A&&u[m+1][0]==A&&(u[m][1].substring(u[m][1].length-u[m-1][1].length)==u[m-1][1]?(u[m][1]=u[m-1][1]+u[m][1].substring(0,u[m][1].length-u[m-1][1].length),u[m+1][1]=u[m-1][1]+u[m+1][1],u.splice(m-1,1),v=!0):u[m][1].substring(0,u[m+1][1].length)==u[m+1][1]&&(u[m-1][1]+=u[m+1][1],u[m][1]=u[m][1].substring(u[m+1][1].length)+u[m+1][1],u.splice(m+1,1),v=!0)),m++;v&&this.diff_cleanupMerge(u)},S.prototype.diff_xIndex=function(u,m){var l=0,b=0,g=0,h=0,E;for(E=0;E<u.length&&(u[E][0]!==H&&(l+=u[E][1].length),u[E][0]!==k&&(b+=u[E][1].length),!(l>m));E++)g=l,h=b;return u.length!=E&&u[E][0]===k?h:h+(m-g)},S.prototype.diff_prettyHtml=function(u){for(var m=[],l=/&/g,b=/</g,g=/>/g,h=/\n/g,E=0;E<u.length;E++){var v=u[E][0],w=u[E][1],c=w.replace(l,"&").replace(b,"<").replace(g,">").replace(h,"¶<br>");switch(v){case H:m[E]='<ins style="background:#e6ffe6;">'+c+"</ins>";break;case k:m[E]='<del style="background:#ffe6e6;">'+c+"</del>";break;case A:m[E]="<span>"+c+"</span>";break}}return m.join("")},S.prototype.diff_text1=function(u){for(var m=[],l=0;l<u.length;l++)u[l][0]!==H&&(m[l]=u[l][1]);return m.join("")},S.prototype.diff_text2=function(u){for(var m=[],l=0;l<u.length;l++)u[l][0]!==k&&(m[l]=u[l][1]);return m.join("")},S.prototype.diff_levenshtein=function(u){for(var m=0,l=0,b=0,g=0;g<u.length;g++){var h=u[g][0],E=u[g][1];switch(h){case H:l+=E.length;break;case k:b+=E.length;break;case A:m+=Math.max(l,b),l=0,b=0;break}}return m+=Math.max(l,b),m},S.prototype.diff_toDelta=function(u){for(var m=[],l=0;l<u.length;l++)switch(u[l][0]){case H:m[l]="+"+encodeURI(u[l][1]);break;case k:m[l]="-"+u[l][1].length;break;case A:m[l]="="+u[l][1].length;break}return m.join(" ").replace(/%20/g," ")},S.prototype.diff_fromDelta=function(u,m){for(var l=[],b=0,g=0,h=m.split(/\t/g),E=0;E<h.length;E++){var v=h[E].substring(1);switch(h[E].charAt(0)){case"+":try{l[b++]=new S.Diff(H,decodeURI(v))}catch{throw new Error("Illegal escape in diff_fromDelta: "+v)}break;case"-":case"=":var w=parseInt(v,10);if(isNaN(w)||w<0)throw new Error("Invalid number in diff_fromDelta: "+v);var c=u.substring(g,g+=w);h[E].charAt(0)=="="?l[b++]=new S.Diff(A,c):l[b++]=new S.Diff(k,c);break;default:if(h[E])throw new Error("Invalid diff operation in diff_fromDelta: "+h[E])}}if(g!=u.length)throw new Error("Delta length ("+g+") does not equal source text length ("+u.length+").");return l},S.prototype.match_main=function(u,m,l){if(u==null||m==null||l==null)throw new Error("Null input. (match_main)");return l=Math.max(0,Math.min(l,u.length)),u==m?0:u.length?u.substring(l,l+m.length)==m?l:this.match_bitap_(u,m,l):-1},S.prototype.match_bitap_=function(u,m,l){if(m.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var b=this.match_alphabet_(m),g=this;function h(ne,ge){var de=ne/m.length,se=Math.abs(l-ge);return g.Match_Distance?de+se/g.Match_Distance:se?1:de}var E=this.Match_Threshold,v=u.indexOf(m,l);v!=-1&&(E=Math.min(h(0,v),E),v=u.lastIndexOf(m,l+m.length),v!=-1&&(E=Math.min(h(0,v),E)));var w=1<<m.length-1;v=-1;for(var c,f,s=m.length+u.length,M,x=0;x<m.length;x++){for(c=0,f=s;c<f;)h(x,l+f)<=E?c=f:s=f,f=Math.floor((s-c)/2+c);s=f;var L=Math.max(1,l-f+1),D=Math.min(l+f,u.length)+m.length,j=Array(D+2);j[D+1]=(1<<x)-1;for(var q=D;q>=L;q--){var ee=b[u.charAt(q-1)];if(x===0?j[q]=(j[q+1]<<1|1)&ee:j[q]=(j[q+1]<<1|1)&ee|((M[q+1]|M[q])<<1|1)|M[q+1],j[q]&w){var oe=h(x,q-1);if(oe<=E)if(E=oe,v=q-1,v>l)L=Math.max(1,2*l-v);else break}}if(h(x+1,l)>E)break;M=j}return v},S.prototype.match_alphabet_=function(u){for(var m={},l=0;l<u.length;l++)m[u.charAt(l)]=0;for(var l=0;l<u.length;l++)m[u.charAt(l)]|=1<<u.length-l-1;return m},S.prototype.patch_addContext_=function(u,m){if(m.length!=0){if(u.start2===null)throw Error("patch not initialized");for(var l=m.substring(u.start2,u.start2+u.length1),b=0;m.indexOf(l)!=m.lastIndexOf(l)&&l.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)b+=this.Patch_Margin,l=m.substring(u.start2-b,u.start2+u.length1+b);b+=this.Patch_Margin;var g=m.substring(u.start2-b,u.start2);g&&u.diffs.unshift(new S.Diff(A,g));var h=m.substring(u.start2+u.length1,u.start2+u.length1+b);h&&u.diffs.push(new S.Diff(A,h)),u.start1-=g.length,u.start2-=g.length,u.length1+=g.length+h.length,u.length2+=g.length+h.length}},S.prototype.patch_make=function(u,m,l){var b,g;if(typeof u=="string"&&typeof m=="string"&&typeof l>"u")b=u,g=this.diff_main(b,m,!0),g.length>2&&(this.diff_cleanupSemantic(g),this.diff_cleanupEfficiency(g));else if(u&&typeof u=="object"&&typeof m>"u"&&typeof l>"u")g=u,b=this.diff_text1(g);else if(typeof u=="string"&&m&&typeof m=="object"&&typeof l>"u")b=u,g=m;else if(typeof u=="string"&&typeof m=="string"&&l&&typeof l=="object")b=u,g=l;else throw new Error("Unknown call format to patch_make.");if(g.length===0)return[];for(var h=[],E=new S.patch_obj,v=0,w=0,c=0,f=b,s=b,M=0;M<g.length;M++){var x=g[M][0],L=g[M][1];switch(!v&&x!==A&&(E.start1=w,E.start2=c),x){case H:E.diffs[v++]=g[M],E.length2+=L.length,s=s.substring(0,c)+L+s.substring(c);break;case k:E.length1+=L.length,E.diffs[v++]=g[M],s=s.substring(0,c)+s.substring(c+L.length);break;case A:L.length<=2*this.Patch_Margin&&v&&g.length!=M+1?(E.diffs[v++]=g[M],E.length1+=L.length,E.length2+=L.length):L.length>=2*this.Patch_Margin&&v&&(this.patch_addContext_(E,f),h.push(E),E=new S.patch_obj,v=0,f=s,w=c);break}x!==H&&(w+=L.length),x!==k&&(c+=L.length)}return v&&(this.patch_addContext_(E,f),h.push(E)),h},S.prototype.patch_deepCopy=function(u){for(var m=[],l=0;l<u.length;l++){var b=u[l],g=new S.patch_obj;g.diffs=[];for(var h=0;h<b.diffs.length;h++)g.diffs[h]=new S.Diff(b.diffs[h][0],b.diffs[h][1]);g.start1=b.start1,g.start2=b.start2,g.length1=b.length1,g.length2=b.length2,m[l]=g}return m},S.prototype.patch_apply=function(u,m){if(u.length==0)return[m,[]];u=this.patch_deepCopy(u);var l=this.patch_addPadding(u);m=l+m+l,this.patch_splitMax(u);for(var b=0,g=[],h=0;h<u.length;h++){var E=u[h].start2+b,v=this.diff_text1(u[h].diffs),w,c=-1;if(v.length>this.Match_MaxBits?(w=this.match_main(m,v.substring(0,this.Match_MaxBits),E),w!=-1&&(c=this.match_main(m,v.substring(v.length-this.Match_MaxBits),E+v.length-this.Match_MaxBits),(c==-1||w>=c)&&(w=-1))):w=this.match_main(m,v,E),w==-1)g[h]=!1,b-=u[h].length2-u[h].length1;else{g[h]=!0,b=w-E;var f;if(c==-1?f=m.substring(w,w+v.length):f=m.substring(w,c+this.Match_MaxBits),v==f)m=m.substring(0,w)+this.diff_text2(u[h].diffs)+m.substring(w+v.length);else{var s=this.diff_main(v,f,!1);if(v.length>this.Match_MaxBits&&this.diff_levenshtein(s)/v.length>this.Patch_DeleteThreshold)g[h]=!1;else{this.diff_cleanupSemanticLossless(s);for(var M=0,x,L=0;L<u[h].diffs.length;L++){var D=u[h].diffs[L];D[0]!==A&&(x=this.diff_xIndex(s,M)),D[0]===H?m=m.substring(0,w+x)+D[1]+m.substring(w+x):D[0]===k&&(m=m.substring(0,w+x)+m.substring(w+this.diff_xIndex(s,M+D[1].length))),D[0]!==k&&(M+=D[1].length)}}}}}return m=m.substring(l.length,m.length-l.length),[m,g]},S.prototype.patch_addPadding=function(u){for(var m=this.Patch_Margin,l="",b=1;b<=m;b++)l+=String.fromCharCode(b);for(var b=0;b<u.length;b++)u[b].start1+=m,u[b].start2+=m;var g=u[0],h=g.diffs;if(h.length==0||h[0][0]!=A)h.unshift(new S.Diff(A,l)),g.start1-=m,g.start2-=m,g.length1+=m,g.length2+=m;else if(m>h[0][1].length){var E=m-h[0][1].length;h[0][1]=l.substring(h[0][1].length)+h[0][1],g.start1-=E,g.start2-=E,g.length1+=E,g.length2+=E}if(g=u[u.length-1],h=g.diffs,h.length==0||h[h.length-1][0]!=A)h.push(new S.Diff(A,l)),g.length1+=m,g.length2+=m;else if(m>h[h.length-1][1].length){var E=m-h[h.length-1][1].length;h[h.length-1][1]+=l.substring(0,E),g.length1+=E,g.length2+=E}return l},S.prototype.patch_splitMax=function(u){for(var m=this.Match_MaxBits,l=0;l<u.length;l++)if(!(u[l].length1<=m)){var b=u[l];u.splice(l--,1);for(var g=b.start1,h=b.start2,E="";b.diffs.length!==0;){var v=new S.patch_obj,w=!0;for(v.start1=g-E.length,v.start2=h-E.length,E!==""&&(v.length1=v.length2=E.length,v.diffs.push(new S.Diff(A,E)));b.diffs.length!==0&&v.length1<m-this.Patch_Margin;){var c=b.diffs[0][0],f=b.diffs[0][1];c===H?(v.length2+=f.length,h+=f.length,v.diffs.push(b.diffs.shift()),w=!1):c===k&&v.diffs.length==1&&v.diffs[0][0]==A&&f.length>2*m?(v.length1+=f.length,g+=f.length,w=!1,v.diffs.push(new S.Diff(c,f)),b.diffs.shift()):(f=f.substring(0,m-v.length1-this.Patch_Margin),v.length1+=f.length,g+=f.length,c===A?(v.length2+=f.length,h+=f.length):w=!1,v.diffs.push(new S.Diff(c,f)),f==b.diffs[0][1]?b.diffs.shift():b.diffs[0][1]=b.diffs[0][1].substring(f.length))}E=this.diff_text2(v.diffs),E=E.substring(E.length-this.Patch_Margin);var s=this.diff_text1(b.diffs).substring(0,this.Patch_Margin);s!==""&&(v.length1+=s.length,v.length2+=s.length,v.diffs.length!==0&&v.diffs[v.diffs.length-1][0]===A?v.diffs[v.diffs.length-1][1]+=s:v.diffs.push(new S.Diff(A,s))),w||u.splice(++l,0,v)}}},S.prototype.patch_toText=function(u){for(var m=[],l=0;l<u.length;l++)m[l]=u[l];return m.join("")},S.prototype.patch_fromText=function(u){var m=[];if(!u)return m;for(var l=u.split(`
|
|
28
|
+
`),b=0,g=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;b<l.length;){var h=l[b].match(g);if(!h)throw new Error("Invalid patch string: "+l[b]);var E=new S.patch_obj;for(m.push(E),E.start1=parseInt(h[1],10),h[2]===""?(E.start1--,E.length1=1):h[2]=="0"?E.length1=0:(E.start1--,E.length1=parseInt(h[2],10)),E.start2=parseInt(h[3],10),h[4]===""?(E.start2--,E.length2=1):h[4]=="0"?E.length2=0:(E.start2--,E.length2=parseInt(h[4],10)),b++;b<l.length;){var v=l[b].charAt(0);try{var w=decodeURI(l[b].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+w)}if(v=="-")E.diffs.push(new S.Diff(k,w));else if(v=="+")E.diffs.push(new S.Diff(H,w));else if(v==" ")E.diffs.push(new S.Diff(A,w));else{if(v=="@")break;if(v!=="")throw new Error('Invalid patch mode "'+v+'" in: '+w)}b++}}return m},S.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},S.patch_obj.prototype.toString=function(){var u,m;this.length1===0?u=this.start1+",0":this.length1==1?u=this.start1+1:u=this.start1+1+","+this.length1,this.length2===0?m=this.start2+",0":this.length2==1?m=this.start2+1:m=this.start2+1+","+this.length2;for(var l=["@@ -"+u+" +"+m+` @@
|
|
29
|
+
`],b,g=0;g<this.diffs.length;g++){switch(this.diffs[g][0]){case H:b="+";break;case k:b="-";break;case A:b=" ";break}l[g+1]=b+encodeURI(this.diffs[g][1])+`
|
|
30
|
+
`}return l.join("").replace(/%20/g," ")},Z.exports=S,Z.exports.diff_match_patch=S,Z.exports.DIFF_DELETE=k,Z.exports.DIFF_INSERT=H,Z.exports.DIFF_EQUAL=A}),408:((Z,S,k)=>{k.d(S,{default:()=>qe});var H=k(135),A=k(840),u=k(775),m=k(428),l=k(325),b=k(483),g=k(999),h=function(P){P===void 0&&(P=document);var re=function(F){var U=document.createElement("img");U.src=F.getAttribute("data-src"),U.addEventListener("load",function(){!F.getAttribute("style")&&!F.getAttribute("class")&&!F.getAttribute("width")&&!F.getAttribute("height")&&U.naturalHeight>U.naturalWidth&&U.naturalWidth/U.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&U.naturalHeight>window.innerHeight-40&&(F.style.height=window.innerHeight-40+"px"),F.src=U.src}),F.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return P.querySelectorAll("img").forEach(function(F){F.getAttribute("data-src")&&re(F)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),P.querySelectorAll("img").forEach(function(F){window.vditorImageIntersectionObserver.observe(F)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(F){F.forEach(function(U){(typeof U.isIntersecting>"u"?U.intersectionRatio!==0:U.isIntersecting)&&U.target.getAttribute("data-src")&&re(U.target)})}),P.querySelectorAll("img").forEach(function(F){window.vditorImageIntersectionObserver.observe(F)}))},E=k(472),v=k(280),w=k(637),c=k(825),f=k(11),s=k(194),M=k(436),x=k(229),L=k(497),D=k(145),j=k(538),q=k(413),ee=k(106),oe=k(673),ne=function(P){document.querySelectorAll(".vditor-anchor").forEach(function(re){P===1&&re.classList.add("vditor-anchor--left"),re.onclick=function(){var F=re.getAttribute("href").substr(1),U=document.getElementById("vditorAnchor-"+F).offsetTop;document.querySelector("html").scrollTop=U}}),window.onhashchange=function(){var re=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));re&&(document.querySelector("html").scrollTop=re.offsetTop)}},ge=k(161),de=k(214),se=k(810),ye=function(P,re){if(re===void 0&&(re="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var F=function(){var _e=speechSynthesis.getVoices(),J,pe;return _e.forEach(function(De){De.lang===re.replace("_","-")&&(J=De),De.default&&(pe=De)}),J||(J=pe),J},U='<svg><use xlink:href="#vditor-icon-play"></use></svg>',he='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(U='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',he='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var G=document.querySelector(".vditor-speech");G||(G=document.createElement("button"),G.className="vditor-speech",P.insertAdjacentElement("beforeend",G),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=F));var be=F(),ae=new SpeechSynthesisUtterance;ae.voice=be,ae.onend=ae.onerror=function(){G.style.display="none",speechSynthesis.cancel(),G.classList.remove("vditor-speech--current"),G.innerHTML=U},P.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(_e){var J=_e.target;if(J.classList.contains("vditor-speech")||J.parentElement.classList.contains("vditor-speech")){G.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),G.innerHTML=he):(speechSynthesis.pause(),G.innerHTML=U)):(ae.text=G.getAttribute("data-text"),speechSynthesis.speak(ae),G.classList.add("vditor-speech--current"),G.innerHTML=he),(0,se.Hc)(window.vditorSpeechRange),P.focus();return}if(G.style.display="none",speechSynthesis.cancel(),G.classList.remove("vditor-speech--current"),G.innerHTML=U,getSelection().rangeCount!==0){var pe=getSelection().getRangeAt(0),De=pe.toString().trim();if(De){window.vditorSpeechRange=pe.cloneRange();var Re=pe.getBoundingClientRect();G.innerHTML=U,G.style.display="block",G.style.top=Re.top+Re.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?G.style.left=_e.changedTouches[_e.changedTouches.length-1].pageX+2+"px":G.style.left=_e.clientX+2+"px",G.setAttribute("data-text",De)}}})}},Ae=function(P,re,F,U){function he(G){return G instanceof F?G:new F(function(be){be(G)})}return new(F||(F=Promise))(function(G,be){function ae(pe){try{J(U.next(pe))}catch(De){be(De)}}function _e(pe){try{J(U.throw(pe))}catch(De){be(De)}}function J(pe){pe.done?G(pe.value):he(pe.value).then(ae,_e)}J((U=U.apply(P,re||[])).next())})},mt=function(P,re){var F={label:0,sent:function(){if(G[0]&1)throw G[1];return G[1]},trys:[],ops:[]},U,he,G,be;return be={next:ae(0),throw:ae(1),return:ae(2)},typeof Symbol=="function"&&(be[Symbol.iterator]=function(){return this}),be;function ae(J){return function(pe){return _e([J,pe])}}function _e(J){if(U)throw new TypeError("Generator is already executing.");for(;be&&(be=0,J[0]&&(F=0)),F;)try{if(U=1,he&&(G=J[0]&2?he.return:J[0]?he.throw||((G=he.return)&&G.call(he),0):he.next)&&!(G=G.call(he,J[1])).done)return G;switch(he=0,G&&(J=[J[0]&2,G.value]),J[0]){case 0:case 1:G=J;break;case 4:return F.label++,{value:J[1],done:!1};case 5:F.label++,he=J[1],J=[0];continue;case 7:J=F.ops.pop(),F.trys.pop();continue;default:if(G=F.trys,!(G=G.length>0&&G[G.length-1])&&(J[0]===6||J[0]===2)){F=0;continue}if(J[0]===3&&(!G||J[1]>G[0]&&J[1]<G[3])){F.label=J[1];break}if(J[0]===6&&F.label<G[1]){F.label=G[1],G=J;break}if(G&&F.label<G[2]){F.label=G[2],F.ops.push(J);break}G[2]&&F.ops.pop(),F.trys.pop();continue}J=re.call(P,F)}catch(pe){J=[6,pe],he=0}finally{U=G=0}if(J[0]&5)throw J[1];return{value:J[0]?J[1]:void 0,done:!0}}},gt=function(P){var re,F={anchor:0,cdn:D.g.CDN,customEmoji:{},emojiPath:"".concat(D.g.CDN,"/dist/images/emoji"),hljs:D.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:D.g.MARKDOWN_OPTIONS,math:D.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:D.g.THEME_OPTIONS};return P.cdn&&(!((re=P.theme)===null||re===void 0)&&re.path||(F.theme.path="".concat(P.cdn,"/dist/css/content-theme")),P.emojiPath||(F.emojiPath="".concat(P.cdn,"/dist/images/emoji"))),(0,oe.T)(F,P)},Se=function(P,re){var F=gt(re);return(0,q.G)("".concat(F.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var U=(0,de.X)({autoSpace:F.markdown.autoSpace,callout:F.markdown.callout,gfmAutoLink:F.markdown.gfmAutoLink,codeBlockPreview:F.markdown.codeBlockPreview,emojiSite:F.emojiPath,emojis:F.customEmoji,fixTermTypo:F.markdown.fixTermTypo,footnotes:F.markdown.footnotes,headingAnchor:F.anchor!==0,inlineMathDigit:F.math.inlineDigit,lazyLoadImage:F.lazyLoadImage,linkBase:F.markdown.linkBase,linkPrefix:F.markdown.linkPrefix,listStyle:F.markdown.listStyle,mark:F.markdown.mark,mathBlockPreview:F.markdown.mathBlockPreview,paragraphBeginningSpace:F.markdown.paragraphBeginningSpace,sanitize:F.markdown.sanitize,sub:F.markdown.sub,sup:F.markdown.sup,toc:F.markdown.toc});return re?.renderers&&U.SetJSRenderers({renderers:{Md2HTML:re.renderers}}),U.SetHeadingID(!0),(0,ge.V)(U.Md2HTML(P),F.markdown.imageCaption)})},T=function(P,re,F){return Ae(void 0,void 0,void 0,function(){var U,he,G,be;return mt(this,function(ae){switch(ae.label){case 0:return U=gt(F),[4,Se(re,U)];case 1:if(he=ae.sent(),U.transform&&(he=U.transform(he)),P.innerHTML=he,P.classList.add("vditor-reset"),U.i18n)return[3,5];if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","zh_CN","zh_TW"].includes(U.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return G="vditorI18nScript",be=G+U.lang,document.querySelectorAll('head script[id^="'.concat(G,'"]')).forEach(function(_e){_e.id!==be&&document.head.removeChild(_e)}),[4,(0,q.G)("".concat(U.cdn,"/dist/js/i18n/").concat(U.lang,".js"),be)];case 3:ae.sent(),ae.label=4;case 4:return[3,6];case 5:window.VditorI18n=U.i18n,ae.label=6;case 6:return U.icon?[4,(0,q.G)("".concat(U.cdn,"/dist/js/icons/").concat(U.icon,".js"),"vditorIconScript")]:[3,8];case 7:ae.sent(),ae.label=8;case 8:return(0,j.Z)(U.theme.current,U.theme.path),U.anchor===1&&P.classList.add("vditor-reset--anchor"),(0,m.O)(P,U.hljs),(0,g.s)(U.hljs,P,U.cdn),(0,E.H)(P,{cdn:U.cdn,math:U.math}),(0,w.i)(P,U.cdn,U.mode),(0,c.J)(P,U.cdn,U.mode),(0,f.K)(P,U.cdn),(0,l.P)(P,U.cdn),(0,b.v)(P,U.cdn),(0,L.F)(P,U.cdn),(0,u.p)(P,U.cdn,U.mode),(0,s.P)(P,U.cdn,U.mode),(0,x.B)(P,U.cdn),(0,H.Q)(P,U.cdn),U.render.media.enable&&(0,v.Y)(P),U.speech.enable&&ye(P),U.anchor!==0&&ne(U.anchor),U.after&&U.after(),U.lazyLoadImage&&h(P),P.addEventListener("click",function(_e){var J=(0,ee.lG)(_e.target,"SPAN");if(J&&(0,ee.fb)(J,"vditor-toc")){var pe=P.querySelector("#"+J.getAttribute("data-target-id"));pe&&window.scrollTo(window.scrollX,pe.offsetTop);return}}),[2]}})})},je=k(190),yt=k(580),bt=(function(){function P(){}return P.adapterRender=A,P.previewImage=je.E,P.codeRender=m.O,P.graphvizRender=b.v,P.wavedromRender=L.F,P.highlightRender=g.s,P.mathRender=E.H,P.mermaidRender=w.i,P.SMILESRender=c.J,P.markmapRender=f.K,P.flowchartRender=l.P,P.chartRender=u.p,P.abcRender=H.Q,P.mindmapRender=s.P,P.plantumlRender=x.B,P.outlineRender=M.k,P.mediaRender=v.Y,P.speechRender=ye,P.lazyLoadImageRender=h,P.md2html=Se,P.preview=T,P.setCodeTheme=yt.Y,P.setContentTheme=j.Z,P})();const qe=bt}),145:((Z,S,k)=>{k.d(S,{H:()=>H,g:()=>A});var H="3.11.3",A=(function(){function u(){}return u.ZWSP="",u.DROP_EDITOR="application/editor",u.MOBILE_WIDTH=520,u.CLASS_MENU_DISABLED="vditor-menu--disabled",u.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"],u.CODE_THEME=["a11y-dark","agate","an-old-hope","androidstudio","arta","atom-one-dark","atom-one-dark-reasonable","base16/3024","base16/apathy","base16/apprentice","base16/ashes","base16/atelier-cave","base16/atelier-dune","base16/atelier-estuary","base16/atelier-forest","base16/atelier-heath","base16/atelier-lakeside","base16/atelier-plateau","base16/atelier-savanna","base16/atelier-seaside","base16/atelier-sulphurpool","base16/atlas","base16/bespin","base16/black-metal","base16/black-metal-bathory","base16/black-metal-burzum","base16/black-metal-dark-funeral","base16/black-metal-gorgoroth","base16/black-metal-immortal","base16/black-metal-khold","base16/black-metal-marduk","base16/black-metal-mayhem","base16/black-metal-nile","base16/black-metal-venom","base16/brewer","base16/bright","base16/brogrammer","base16/brush-trees-dark","base16/chalk","base16/circus","base16/classic-dark","base16/codeschool","base16/colors","base16/danqing","base16/darcula","base16/dark-violet","base16/darkmoss","base16/darktooth","base16/decaf","base16/default-dark","base16/dracula","base16/edge-dark","base16/eighties","base16/embers","base16/equilibrium-dark","base16/equilibrium-gray-dark","base16/espresso","base16/eva","base16/eva-dim","base16/flat","base16/framer","base16/gigavolt","base16/google-dark","base16/grayscale-dark","base16/green-screen","base16/gruvbox-dark-hard","base16/gruvbox-dark-medium","base16/gruvbox-dark-pale","base16/gruvbox-dark-soft","base16/hardcore","base16/harmonic16-dark","base16/heetch-dark","base16/helios","base16/hopscotch","base16/horizon-dark","base16/humanoid-dark","base16/ia-dark","base16/icy-dark","base16/ir-black","base16/isotope","base16/kimber","base16/london-tube","base16/macintosh","base16/marrakesh","base16/materia","base16/material","base16/material-darker","base16/material-palenight","base16/material-vivid","base16/mellow-purple","base16/mocha","base16/monokai","base16/nebula","base16/nord","base16/nova","base16/ocean","base16/oceanicnext","base16/onedark","base16/outrun-dark","base16/papercolor-dark","base16/paraiso","base16/pasque","base16/phd","base16/pico","base16/pop","base16/porple","base16/qualia","base16/railscasts","base16/rebecca","base16/ros-pine","base16/ros-pine-moon","base16/sandcastle","base16/seti-ui","base16/silk-dark","base16/snazzy","base16/solar-flare","base16/solarized-dark","base16/spacemacs","base16/summercamp","base16/summerfruit-dark","base16/synth-midnight-terminal-dark","base16/tango","base16/tender","base16/tomorrow-night","base16/twilight","base16/unikitty-dark","base16/vulcan","base16/windows-10","base16/windows-95","base16/windows-high-contrast","base16/windows-nt","base16/woodland","base16/xcode-dusk","base16/zenburn","codepen-embed","dark","devibeans","far","felipec","github-dark","github-dark-dimmed","gml","gradient-dark","hybrid","ir-black","isbl-editor-dark","kimbie-dark","lioshi","monokai","monokai-sublime","night-owl","nnfx-dark","nord","obsidian","panda-syntax-dark","paraiso-dark","pojoaque","qtcreator-dark","rainbow","shades-of-purple","srcery","stackoverflow-dark","sunburst","tomorrow-night-blue","tomorrow-night-bright","tokyo-night-dark","vs2015","xt256","ant-design","a11y-light","arduino-light","ascetic","atom-one-light","base16/atelier-cave-light","base16/atelier-dune-light","base16/atelier-estuary-light","base16/atelier-forest-light","base16/atelier-heath-light","base16/atelier-lakeside-light","base16/atelier-plateau-light","base16/atelier-savanna-light","base16/atelier-seaside-light","base16/atelier-sulphurpool-light","base16/brush-trees","base16/classic-light","base16/cupcake","base16/cupertino","base16/default-light","base16/dirtysea","base16/edge-light","base16/equilibrium-gray-light","base16/equilibrium-light","base16/fruit-soda","base16/github","base16/google-light","base16/grayscale-light","base16/gruvbox-light-hard","base16/gruvbox-light-medium","base16/gruvbox-light-soft","base16/harmonic16-light","base16/heetch-light","base16/humanoid-light","base16/horizon-light","base16/ia-light","base16/material-lighter","base16/mexico-light","base16/one-light","base16/papercolor-light","base16/ros-pine-dawn","base16/sagelight","base16/shapeshifter","base16/silk-light","base16/solar-flare-light","base16/solarized-light","base16/summerfruit-light","base16/synth-midnight-terminal-light","base16/tomorrow","base16/unikitty-light","base16/windows-10-light","base16/windows-95-light","base16/windows-high-contrast-light","brown-paper","base16/windows-nt-light","color-brewer","docco","foundation","github","googlecode","gradient-light","grayscale","idea","intellij-light","isbl-editor-light","kimbie-light","lightfair","magula","mono-blue","nnfx-light","panda-syntax-light","paraiso-light","purebasic","qtcreator-light","routeros","school-book","stackoverflow-light","tokyo-night-light","vs","xcode","default"],u.ALIAS_CODE_LANGUAGES=["abc","plantuml","mermaid","flowchart","echarts","mindmap","graphviz","wavedrom","math","markmap","smiles","js","ts","html","toml","c#","bat"],u.CDN="https://unpkg.com/vditor@".concat("3.11.3"),u.MARKDOWN_OPTIONS={autoSpace:!1,callout:!0,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,imageCaption:!1,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,sub:!1,sup:!1,toc:!1},u.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},u.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},u.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(u.CDN,"/dist/css/content-theme")},u})()}),825:((Z,S,k)=>{k.d(S,{J:()=>l});var H=k(145),A=k(413),u=k(840),m=k(494),l=function(b,g,h){b===void 0&&(b=document),g===void 0&&(g=H.g.CDN);var E=u.SMILESRenderAdapter.getElements(b);E.length>0&&(0,A.G)("".concat(g,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var v=new SmiDrawer({},{});E.forEach(function(w){var c=u.SMILESRenderAdapter.getCode(w).trim();if(!(w.getAttribute("data-processed")==="true"||c.trim()==="")){var f="smiles"+(0,m.Wb)();w.innerHTML='<svg id="'.concat(f,'"></svg>'),v.draw(c,"#"+f,h==="dark"?"dark":void 0),w.setAttribute("data-processed","true")}})})}}),135:((Z,S,k)=>{k.d(S,{Q:()=>m});var H=k(145),A=k(413),u=k(840),m=function(l,b){l===void 0&&(l=document),b===void 0&&(b=H.g.CDN);var g=u.abcRenderAdapter.getElements(l);g.length>0&&(0,A.G)("".concat(b,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){g.forEach(function(h){h.parentElement.classList.contains("vditor-wysiwyg__pre")||h.parentElement.classList.contains("vditor-ir__marker--pre")||h.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(h,u.abcRenderAdapter.getCode(h).trim()),h.style.overflowX="auto",h.setAttribute("data-processed","true"))})})}}),840:((Z,S,k)=>{k.r(S),k.d(S,{mathRenderAdapter:()=>H,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>u,markmapRenderAdapter:()=>m,mindmapRenderAdapter:()=>l,chartRenderAdapter:()=>b,abcRenderAdapter:()=>g,graphvizRenderAdapter:()=>h,wavedromRenderAdapter:()=>E,flowchartRenderAdapter:()=>v,plantumlRenderAdapter:()=>w});var H={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-math")}},A={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-smiles")}},u={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-mermaid")}},m={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-markmap")}},l={getCode:function(c){return c.getAttribute("data-code")},getElements:function(c){return c.querySelectorAll(".language-mindmap")}},b={getCode:function(c){return c.innerText},getElements:function(c){return c.querySelectorAll(".language-echarts")}},g={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-abc")}},h={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-graphviz")}},E={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-wavedrom")}},v={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-flowchart")}},w={getCode:function(c){return c.textContent},getElements:function(c){return c.querySelectorAll(".language-plantuml")}}}),775:((Z,S,k)=>{k.d(S,{p:()=>g});var H=k(145),A=k(413),u=k(840),m=k(494),l=function(h,E,v,w){function c(f){return f instanceof v?f:new v(function(s){s(f)})}return new(v||(v=Promise))(function(f,s){function M(D){try{L(w.next(D))}catch(j){s(j)}}function x(D){try{L(w.throw(D))}catch(j){s(j)}}function L(D){D.done?f(D.value):c(D.value).then(M,x)}L((w=w.apply(h,E||[])).next())})},b=function(h,E){var v={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},w,c,f,s;return s={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function M(L){return function(D){return x([L,D])}}function x(L){if(w)throw new TypeError("Generator is already executing.");for(;s&&(s=0,L[0]&&(v=0)),v;)try{if(w=1,c&&(f=L[0]&2?c.return:L[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,L[1])).done)return f;switch(c=0,f&&(L=[L[0]&2,f.value]),L[0]){case 0:case 1:f=L;break;case 4:return v.label++,{value:L[1],done:!1};case 5:v.label++,c=L[1],L=[0];continue;case 7:L=v.ops.pop(),v.trys.pop();continue;default:if(f=v.trys,!(f=f.length>0&&f[f.length-1])&&(L[0]===6||L[0]===2)){v=0;continue}if(L[0]===3&&(!f||L[1]>f[0]&&L[1]<f[3])){v.label=L[1];break}if(L[0]===6&&v.label<f[1]){v.label=f[1],f=L;break}if(f&&v.label<f[2]){v.label=f[2],v.ops.push(L);break}f[2]&&v.ops.pop(),v.trys.pop();continue}L=E.call(h,v)}catch(D){L=[6,D],c=0}finally{w=f=0}if(L[0]&5)throw L[1];return{value:L[0]?L[1]:void 0,done:!0}}},g=function(h,E,v){h===void 0&&(h=document),E===void 0&&(E=H.g.CDN);var w=u.chartRenderAdapter.getElements(h);w.length>0&&(0,A.G)("".concat(E,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){w.forEach(function(c){return l(void 0,void 0,void 0,function(){var f,s,M;return b(this,function(x){switch(x.label){case 0:if(c.parentElement.classList.contains("vditor-wysiwyg__pre")||c.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(f=u.chartRenderAdapter.getCode(c).trim(),!f)return[2];x.label=1;case 1:return x.trys.push([1,3,,4]),c.getAttribute("data-processed")==="true"?[2]:[4,(0,m.Qf)(f)];case 2:return s=x.sent(),echarts.init(c,v==="dark"?"dark":void 0).setOption(s),c.setAttribute("data-processed","true"),[3,4];case 3:return M=x.sent(),c.className="vditor-reset--error",c.innerHTML="echarts render error: <br>".concat(M),[3,4];case 4:return[2]}})})})})}}),428:((Z,S,k)=>{k.d(S,{O:()=>u});var H=k(105),A=k(145),u=function(m,l){Array.from(m.querySelectorAll("pre > code")).filter(function(b,g){return!(b.parentElement.classList.contains("vditor-wysiwyg__pre")||b.parentElement.classList.contains("vditor-ir__marker--pre")||b.classList.contains("language-mermaid")||b.classList.contains("language-flowchart")||b.classList.contains("language-echarts")||b.classList.contains("language-mindmap")||b.classList.contains("language-plantuml")||b.classList.contains("language-markmap")||b.classList.contains("language-abc")||b.classList.contains("language-graphviz")||b.classList.contains("language-math")||b.classList.contains("language-smiles")||b.style.maxHeight.indexOf("px")>-1||m.classList.contains("vditor-preview")&&g>5)}).forEach(function(b){var g,h,E,v=b.innerText;if(b.classList.contains("highlight-chroma")){var w=b.cloneNode(!0);w.querySelectorAll(".highlight-ln").forEach(function(M){M.remove()}),v=w.innerText}else v.endsWith(`
|
|
31
|
+
`)&&(v=v.substr(0,v.length-1));var c='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(c='<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 f=document.createElement("div");f.className="vditor-copy",f.innerHTML='<span aria-label="'.concat(((g=window.VditorI18n)===null||g===void 0?void 0:g.copy)||"复制",`"
|
|
32
|
+
onmouseover="this.setAttribute('aria-label', '`).concat(((h=window.VditorI18n)===null||h===void 0?void 0:h.copy)||"复制",`')"
|
|
33
33
|
class="vditor-tooltipped vditor-tooltipped__w"
|
|
34
|
-
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((
|
|
35
|
-
`,
|
|
36
|
-
src="//coub.com/embed/`.concat(
|
|
37
|
-
src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(
|
|
38
|
-
src="https://www.dailymotion.com/embed/video/`.concat(
|
|
39
|
-
<div style="text-align: left"><small>`).concat(L.message.replace(/\n/,"<br>"),"</small></div>"),
|
|
34
|
+
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((E=window.VditorI18n)===null||E===void 0?void 0:E.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(c,"</span>");var s=document.createElement("textarea");s.value=(0,H.X)(v),f.insertAdjacentElement("afterbegin",s),l&&l.renderMenu&&l.renderMenu(b,f),b.before(f),b.style.maxHeight=window.outerHeight-40+"px",b.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(A.g.ZWSP,"</span>"))})}}),325:((Z,S,k)=>{k.d(S,{P:()=>m});var H=k(145),A=k(413),u=k(840),m=function(l,b){b===void 0&&(b=H.g.CDN);var g=u.flowchartRenderAdapter.getElements(l);g.length!==0&&(0,A.G)("".concat(b,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then(function(){g.forEach(function(h){if(h.getAttribute("data-processed")!=="true"){var E=flowchart.parse(u.flowchartRenderAdapter.getCode(h));h.innerHTML="",E.drawSVG(h),h.setAttribute("data-processed","true")}})})}}),483:((Z,S,k)=>{k.d(S,{v:()=>m});var H=k(145),A=k(413),u=k(840),m=function(l,b){b===void 0&&(b=H.g.CDN);var g=u.graphvizRenderAdapter.getElements(l);g.length!==0&&(0,A.G)("".concat(b,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then(function(){g.forEach(function(h){var E=u.graphvizRenderAdapter.getCode(h);if(!(h.parentElement.classList.contains("vditor-wysiwyg__pre")||h.parentElement.classList.contains("vditor-ir__marker--pre"))&&!(h.getAttribute("data-processed")==="true"||E.trim()==="")){try{var v=new Blob(["importScripts('".concat(document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js"),"');")],{type:"application/javascript"}),w=window.URL||window.webkitURL,c=w.createObjectURL(v),f=new Worker(c);new Viz({worker:f}).renderSVGElement(E).then(function(s){h.innerHTML=s.outerHTML}).catch(function(s){h.innerHTML="graphviz render error: <br>".concat(s),h.className="vditor-reset--error"})}catch(s){console.error("graphviz error",s)}h.setAttribute("data-processed","true")}})})}}),999:((Z,S,k)=>{k.d(S,{s:()=>m});var H=k(145),A=k(413),u=k(290),m=function(l,b,g){b===void 0&&(b=document),g===void 0&&(g=H.g.CDN);var h=l.style;H.g.CODE_THEME.includes(h)||(h="github");var E=document.getElementById("vditorHljsStyle"),v="".concat(g,"/dist/js/highlight.js/styles/").concat(h,".min.css");if(E&&E.getAttribute("href")!==v&&E.remove(),(0,u.c)("".concat(g,"/dist/js/highlight.js/styles/").concat(h,".min.css"),"vditorHljsStyle"),l.enable!==!1){var w=b.querySelectorAll("pre > code");w.length!==0&&(0,A.G)("".concat(g,"/dist/js/highlight.js/highlight.min.js?v=11.7.0"),"vditorHljsScript").then(function(){(0,A.G)("".concat(g,"/dist/js/highlight.js/third-languages.js?v=1.0.1"),"vditorHljsThirdScript").then(function(){b.querySelectorAll("pre > code").forEach(function(c){if(!(c.parentElement.classList.contains("vditor-ir__marker--pre")||c.parentElement.classList.contains("vditor-wysiwyg__pre"))&&!(c.classList.contains("language-mermaid")||c.classList.contains("language-flowchart")||c.classList.contains("language-echarts")||c.classList.contains("language-mindmap")||c.classList.contains("language-plantuml")||c.classList.contains("language-smiles")||c.classList.contains("language-abc")||c.classList.contains("language-graphviz")||c.classList.contains("language-math"))){l.defaultLang!==""&&c.className.indexOf("language-")===-1&&c.classList.add("language-"+l.defaultLang);var f=c.className.replace("language-","");if(window.hljs.getLanguage(f)||(f="plaintext"),c.innerHTML=window.hljs.highlight(c.textContent,{language:f,ignoreIllegals:!0}).value,c.classList.add("hljs"),!!l.lineNumber){c.classList.add("vditor-linenumber");var s=c.querySelector(".vditor-linenumber__temp");s||(s=document.createElement("div"),s.className="vditor-linenumber__temp",c.insertAdjacentElement("beforeend",s));var M=getComputedStyle(c).whiteSpace,x=!1;(M==="pre-wrap"||M==="pre-line")&&(x=!0);var L="",D=c.textContent.split(/\r\n|\r|\n/g);D.pop(),D.map(function(j){var q="";x&&(s.textContent=j||`
|
|
35
|
+
`,q=' style="height:'.concat(s.getBoundingClientRect().height,'px"')),L+="<span".concat(q,"></span>")}),s.style.display="none",L='<span class="vditor-linenumber__rows">'.concat(L,"</span>"),c.insertAdjacentHTML("beforeend",L)}}})})})}}}),161:((Z,S,k)=>{k.d(S,{W:()=>E,V:()=>v});var H=function(w,c){return c===void 0&&(c=!1),Array.from(w.childNodes).filter(function(f){return f.nodeType===Node.COMMENT_NODE?!1:f.nodeType===Node.TEXT_NODE?f.textContent.replace(/\u200b/g,"").trim()!=="":f instanceof HTMLElement?f.tagName==="WBR"?!1:!c||!f.classList.contains("vditor-ir__marker"):!0})},A=function(w){var c=H(w);if(!(c.length!==1||!(c[0]instanceof HTMLElement))){var f=c[0];if(f instanceof HTMLImageElement)return{container:f,image:f};if(f instanceof HTMLAnchorElement){var s=H(f);if(s.length===1&&s[0]instanceof HTMLImageElement)return{container:f,image:s[0]}}}},u=function(w){var c=H(w);if(!(c.length!==1||!(c[0]instanceof HTMLElement))){var f=c[0];if(f.getAttribute("data-type")==="a"){var s=H(f,!0);if(s.length!==1||!(s[0]instanceof HTMLElement))return;f=s[0]}if(f.getAttribute("data-type")==="img"){var M=f.querySelector(":scope > img"),x=f.querySelector(":scope > .vditor-ir__marker--title");if(!(!(M instanceof HTMLImageElement)||!x)){var L=x.textContent.trim(),D=L[0]==="("?")":L[0];if(!(L.length<2||!['"',"'","("].includes(L[0])||L[L.length-1]!==D))return{caption:L.slice(1,-1).trim(),container:f,image:M}}}}},m=function(w){w.querySelectorAll("span.vditor-image[data-image-caption]").forEach(function(c){for(;c.firstChild;)c.parentNode.insertBefore(c.firstChild,c);c.remove()})},l=function(w){w.querySelectorAll(".vditor-image[data-image-caption]").forEach(function(c){c.classList.remove("vditor-image"),c.removeAttribute("data-image-caption")})},b=function(w){w.querySelectorAll("p").forEach(function(c){var f,s=A(c),M=(f=s?.image.getAttribute("title"))===null||f===void 0?void 0:f.trim();if(!(!s||!M)){var x=document.createElement("figure");Array.from(c.attributes).forEach(function(D){x.setAttribute(D.name,D.value)}),x.classList.add("vditor-image");var L=document.createElement("figcaption");L.textContent=M,x.append(s.container,L),c.replaceWith(x)}})},g=function(w){w.querySelectorAll("p").forEach(function(c){var f,s=A(c),M=(f=s?.image.getAttribute("title"))===null||f===void 0?void 0:f.trim();if(!(!s||!M)){var x=document.createElement("span");x.className="vditor-image",x.setAttribute("data-image-caption",M),s.container.replaceWith(x),x.append(s.container)}})},h=function(w){w.querySelectorAll("p").forEach(function(c){var f=u(c);f?.caption&&(f.container.classList.add("vditor-image"),f.container.setAttribute("data-image-caption",f.caption))})},E=function(w,c,f){c==="wysiwyg"?m(w):c==="ir"&&l(w),f&&(c==="preview"?b(w):c==="wysiwyg"?g(w):h(w))},v=function(w,c){if(!c)return w;var f=document.createElement("div");return f.innerHTML=w,E(f,"preview",!0),f.innerHTML}}),11:((Z,S,k)=>{k.d(S,{K:()=>g});var H=k(145),A=k(413),u=k(840),m={},l=function(h,E){var v=h.transform(E),w=Object.keys(v.features).filter(function(x){return!m[x]});w.forEach(function(x){m[x]=!0});var c=h.getAssets(w),f=c.styles,s=c.scripts,M=window.markmap;return f&&M.loadCSS(f),s&&M.loadJS(s),v},b=function(h,E){var v=window.markmap,w=v.Transformer,c=v.Markmap,f=v.deriveOptions;v.globalCSS;var s=new w;h.innerHTML='<svg style="width:100%"></svg>';var M=h.firstChild,x=c.create(M,null),L=l(s,E),D=L.root,j=L.frontmatter,q=j?.markmap,ee=f(q);x.setData(D,ee),x.fit()},g=function(h,E){h===void 0&&(h=document),E===void 0&&(E=H.g.CDN);var v=u.markmapRenderAdapter.getElements(h);v.length!==0&&(0,A.G)("".concat(E,"/dist/js/markmap/markmap.min.js"),"vditorMarkerScript").then(function(){v.forEach(function(w){var c=u.markmapRenderAdapter.getCode(w);if(!(w.getAttribute("data-processed")==="true"||c.trim()==="")){var f=document.createElement("div");f.className="language-markmap",w.parentNode.appendChild(f),b(f,c),w.parentNode.childNodes[0].nodeName=="CODE"&&w.parentNode.removeChild(w.parentNode.childNodes[0])}})})}}),472:((Z,S,k)=>{k.d(S,{H:()=>b});var H=k(145),A=k(413),u=k(290),m=k(105),l=k(840),b=function(g,h){g===void 0&&(g=document);var E=l.mathRenderAdapter.getElements(g);if(E.length!==0){var v={cdn:H.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(h&&h.math&&(h.math=Object.assign({},v.math,h.math)),h=Object.assign({},v,h),h.math.engine==="KaTeX")(0,u.c)("".concat(h.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,A.G)("".concat(h.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then(function(){(0,A.G)("".concat(h.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then(function(){E.forEach(function(f){if(!(f.parentElement.classList.contains("vditor-wysiwyg__pre")||f.parentElement.classList.contains("vditor-ir__marker--pre"))&&!f.getAttribute("data-math")){var s=(0,m.X)(l.mathRenderAdapter.getCode(f));f.setAttribute("data-math",s);try{f.innerHTML=katex.renderToString(s,{displayMode:f.tagName==="DIV",output:"html",macros:h.math.macros})}catch(M){f.innerHTML=M.message,f.className="language-math vditor-reset--error"}f.addEventListener("copy",function(M){M.stopPropagation(),M.preventDefault();var x=M.currentTarget.closest(".language-math");M.clipboardData.setData("text/html",x.innerHTML),M.clipboardData.setData("text/plain",x.getAttribute("data-math"))})}})})});else if(h.math.engine==="MathJax"){var w=function(f){if(f.length!==0){var s=0,M=f[f.length-1],x=function(){var L=f[s++];L===M?L():L(x)};x()}};window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(h.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:h.math.macros}},Object.assign(window.MathJax,h.math.mathJaxOptions)),(0,A.J)("".concat(h.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var c=function(f,s){var M=(0,m.X)(f.textContent).trim(),x=window.MathJax.getMetricsFor(f);x.display=f.tagName==="DIV",window.MathJax.tex2svgPromise(M,x).then(function(L){f.innerHTML="",f.setAttribute("data-math",M),f.append(L),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var D=L.querySelector('[data-mml-node="merror"]');D&&D.textContent.trim()!==""&&(f.innerHTML=D.textContent.trim(),f.className="vditor-reset--error"),s&&s()})};window.MathJax.startup.promise.then(function(){for(var f=[],s=function(x){var L=E[x];!L.parentElement.classList.contains("vditor-wysiwyg__pre")&&!L.parentElement.classList.contains("vditor-ir__marker--pre")&&!L.getAttribute("data-math")&&(0,m.X)(L.textContent).trim()&&f.push(function(D){x===E.length-1?c(L):c(L,D)})},M=0;M<E.length;M++)s(M);w(f)})}}}}),280:((Z,S,k)=>{k.d(S,{Y:()=>l});var H=k(494),A=function(b,g){b.insertAdjacentHTML("afterend",'<video controls="controls" src="'.concat(g,'"></video>')),b.remove()},u=function(b,g){b.insertAdjacentHTML("afterend",'<audio controls="controls" src="'.concat(g,'"></audio>')),b.remove()},m=function(b,g){var h=g.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),E=g.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),v=g.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),w=g.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),c=g.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),f=g.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),s=g.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),M=g.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(h&&h[1].length===11)b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'.concat(h[1]+(h[2]?"?start="+h[2]:""),'"></iframe>')),b.remove();else if(E&&E[1])b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'.concat(E[1],'"></iframe>')),b.remove();else if(v&&v[1])b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='.concat(v[1],'"></iframe>')),b.remove();else if(w&&w[1])b.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
36
|
+
src="//coub.com/embed/`.concat(w[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),b.remove();else if(c&&c[0])b.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
37
|
+
src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(c[0]),'"></iframe>')),b.remove();else if(f&&f[2])b.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
38
|
+
src="https://www.dailymotion.com/embed/video/`.concat(f[2],'"></iframe>')),b.remove();else if(g.indexOf("bilibili.com")>-1&&(g.indexOf("bvid=")>-1||s&&s[1])){var x={bvid:(0,H.on)("bvid",g)||s&&s[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(g.startsWith("http")?g:"https:"+g).search.split("&").forEach(function(j,q){if(j){q===0&&(j=j.substr(1));var ee=j.split("=");x[ee[0]]=ee[1]}});var L="https://player.bilibili.com/player.html?",D=Object.keys(x);D.forEach(function(j,q){L+="".concat(j,"=").concat(x[j]),q<D.length-1&&(L+="&")}),b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(L,'"></iframe>')),b.remove()}else M&&M[1]&&(b.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(M[1],'"></iframe>')),b.remove())},l=function(b){b&&b.querySelectorAll("a").forEach(function(g){var h=g.getAttribute("href");h&&(h.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?A(g,h):h.match(/^.+.(mp3|wav|flac)$/)?u(g,h):m(g,h))})}}),637:((Z,S,k)=>{k.d(S,{i:()=>g});var H=k(145),A=k(413),u=k(840),m=k(494),l=function(h,E,v,w){function c(f){return f instanceof v?f:new v(function(s){s(f)})}return new(v||(v=Promise))(function(f,s){function M(D){try{L(w.next(D))}catch(j){s(j)}}function x(D){try{L(w.throw(D))}catch(j){s(j)}}function L(D){D.done?f(D.value):c(D.value).then(M,x)}L((w=w.apply(h,E||[])).next())})},b=function(h,E){var v={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},w,c,f,s;return s={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function M(L){return function(D){return x([L,D])}}function x(L){if(w)throw new TypeError("Generator is already executing.");for(;s&&(s=0,L[0]&&(v=0)),v;)try{if(w=1,c&&(f=L[0]&2?c.return:L[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,L[1])).done)return f;switch(c=0,f&&(L=[L[0]&2,f.value]),L[0]){case 0:case 1:f=L;break;case 4:return v.label++,{value:L[1],done:!1};case 5:v.label++,c=L[1],L=[0];continue;case 7:L=v.ops.pop(),v.trys.pop();continue;default:if(f=v.trys,!(f=f.length>0&&f[f.length-1])&&(L[0]===6||L[0]===2)){v=0;continue}if(L[0]===3&&(!f||L[1]>f[0]&&L[1]<f[3])){v.label=L[1];break}if(L[0]===6&&v.label<f[1]){v.label=f[1],f=L;break}if(f&&v.label<f[2]){v.label=f[2],v.ops.push(L);break}f[2]&&v.ops.pop(),v.trys.pop();continue}L=E.call(h,v)}catch(D){L=[6,D],c=0}finally{w=f=0}if(L[0]&5)throw L[1];return{value:L[0]?L[1]:void 0,done:!0}}},g=function(h,E,v){h===void 0&&(h=document),E===void 0&&(E=H.g.CDN);var w=u.mermaidRenderAdapter.getElements(h);w.length!==0&&(0,A.G)("".concat(E,"/dist/js/mermaid/mermaid.min.js?v=11.16.1"),"vditorMermaidScript").then(function(){var c={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}};v==="dark"&&(c.theme="dark"),mermaid.initialize(c),w.forEach(function(f){return l(void 0,void 0,void 0,function(){var s,M,x,L,D;return b(this,function(j){switch(j.label){case 0:if(s=u.mermaidRenderAdapter.getCode(f),f.getAttribute("data-processed")==="true"||s.trim()==="")return[2];M="mermaid"+(0,m.Wb)(),j.label=1;case 1:return j.trys.push([1,3,,4]),[4,mermaid.render(M,f.textContent)];case 2:return x=j.sent(),f.innerHTML=x.svg,[3,4];case 3:return L=j.sent(),D=document.querySelector("#"+M),f.innerHTML="".concat(D.outerHTML,`<br>
|
|
39
|
+
<div style="text-align: left"><small>`).concat(L.message.replace(/\n/,"<br>"),"</small></div>"),D.parentElement.remove(),[3,4];case 4:return f.setAttribute("data-processed","true"),[2]}})})})})}}),194:((Z,S,k)=>{k.d(S,{P:()=>m});var H=k(145),A=k(413),u=k(840),m=function(l,b,g){l===void 0&&(l=document),b===void 0&&(b=H.g.CDN);var h=u.mindmapRenderAdapter.getElements(l);h.length>0&&(0,A.G)("".concat(b,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){h.forEach(function(E){if(!(E.parentElement.classList.contains("vditor-wysiwyg__pre")||E.parentElement.classList.contains("vditor-ir__marker--pre"))){var v=u.mindmapRenderAdapter.getCode(E);if(v)try{if(E.getAttribute("data-processed")==="true")return;echarts.init(E,g==="dark"?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(v))],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(w,c){var f;return!((f=c?.data)===null||f===void 0)&&f.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),E.setAttribute("data-processed","true")}catch(w){E.className="vditor-reset--error",E.innerHTML="mindmap render error: <br>".concat(w)}}})})}}),436:((Z,S,k)=>{k.d(S,{k:()=>u});var H=k(771),A=k(472),u=function(m,l,b){var g="",h=[];if(Array.from(m.children).forEach(function(c,f){if((0,H.W)(c)){if(b){var s=c.id.lastIndexOf("_");c.id=c.id.substring(0,s===-1?void 0:s)+"_"+f}h.push(c.id),g+=c.outerHTML.replace("<wbr>","")}}),g==="")return l.innerHTML="","";var E=document.createElement("div");if(b)b.lute.SetToC(!0),b.currentMode==="wysiwyg"&&!b.preview.element.contains(m)?E.innerHTML=b.lute.SpinVditorDOM("<p>[ToC]</p>"+g):b.currentMode==="ir"&&!b.preview.element.contains(m)?E.innerHTML=b.lute.SpinVditorIRDOM("<p>[ToC]</p>"+g):E.innerHTML=b.lute.HTML2VditorDOM("<p>[ToC]</p>"+g),b.lute.SetToC(b.options.preview.markdown.toc);else{l.classList.add("vditor-outline");var v=Lute.New();v.SetToC(!0),E.innerHTML=v.HTML2VditorDOM("<p>[ToC]</p>"+g)}var w=E.firstElementChild.querySelectorAll("li > span[data-target-id]");return w.forEach(function(c,f){if(c.nextElementSibling&&c.nextElementSibling.tagName==="UL"){var s="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(s='<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>'),c.innerHTML="".concat(s,"<span>").concat(c.innerHTML,"</span>")}else c.innerHTML="<svg></svg><span>".concat(c.innerHTML,"</span>");c.setAttribute("data-target-id",h[f])}),g=E.firstElementChild.innerHTML,w.length===0?(l.innerHTML="",g):(l.innerHTML=g,b&&(0,A.H)(l,{cdn:b.options.cdn,math:b.options.preview.math}),l.firstElementChild.addEventListener("click",function(c){for(var f=c.target;f&&!f.isEqualNode(l);){if(f.classList.contains("vditor-outline__action")){f.classList.contains("vditor-outline__action--close")?(f.classList.remove("vditor-outline__action--close"),f.parentElement.nextElementSibling.setAttribute("style","display:block")):(f.classList.add("vditor-outline__action--close"),f.parentElement.nextElementSibling.setAttribute("style","display:none")),c.preventDefault(),c.stopPropagation();break}else if(f.getAttribute("data-target-id")){c.preventDefault(),c.stopPropagation();var s=document.getElementById(f.getAttribute("data-target-id"));if(!s)return;if(b)if(b.options.height==="auto"){var M=s.offsetTop+b.element.offsetTop;b.options.toolbarConfig.pin||(M+=b.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,M)}else b.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,b.element.offsetTop),b.preview.element.contains(m)?m.parentElement.scrollTop=s.offsetTop:m.scrollTop=s.offsetTop;else window.scrollTo(window.scrollX,s.offsetTop);break}f=f.parentElement}}),g)}}),229:((Z,S,k)=>{k.d(S,{B:()=>m});var H=k(145),A=k(413),u=k(840),m=function(l,b){l===void 0&&(l=document),b===void 0&&(b=H.g.CDN);var g=u.plantumlRenderAdapter.getElements(l);g.length!==0&&(0,A.G)("".concat(b,"/dist/js/plantuml/plantuml-encoder.min.js"),"vditorPlantumlScript").then(function(){g.forEach(function(h){if(!(h.parentElement.classList.contains("vditor-wysiwyg__pre")||h.parentElement.classList.contains("vditor-ir__marker--pre"))){var E=u.plantumlRenderAdapter.getCode(h).trim();if(E)try{h.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'.concat(plantumlEncoder.encode(E),'"/>')}catch(v){h.className="vditor-reset--error",h.innerHTML="plantuml render error: <br>".concat(v)}}})})}}),214:((Z,S,k)=>{k.d(S,{X:()=>H});var H=function(A){var u=Lute.New();return u.PutEmojis(A.emojis),u.SetEmojiSite(A.emojiSite),u.SetHeadingAnchor(A.headingAnchor),u.SetInlineMathAllowDigitAfterOpenMarker(A.inlineMathDigit),u.SetAutoSpace(A.autoSpace),u.SetCallout(A.callout),u.SetToC(A.toc),u.SetFootnotes(A.footnotes),u.SetFixTermTypo(A.fixTermTypo),u.SetVditorCodeBlockPreview(A.codeBlockPreview),u.SetVditorMathBlockPreview(A.mathBlockPreview),u.SetSanitize(A.sanitize),u.SetChineseParagraphBeginningSpace(A.paragraphBeginningSpace),u.SetRenderListStyle(A.listStyle),u.SetLinkBase(A.linkBase),u.SetLinkPrefix(A.linkPrefix),u.SetMark(A.mark),u.SetGFMAutoLink(A.gfmAutoLink),A.lazyLoadImage&&u.SetImageLazyLoading(A.lazyLoadImage),u.SetSup(A.sup),u.SetSub(A.sub),u}}),497:((Z,S,k)=>{k.d(S,{F:()=>h});var H=k(145),A=k(413),u=k(494),m=k(840),l=function(E,v,w,c){function f(s){return s instanceof w?s:new w(function(M){M(s)})}return new(w||(w=Promise))(function(s,M){function x(j){try{D(c.next(j))}catch(q){M(q)}}function L(j){try{D(c.throw(j))}catch(q){M(q)}}function D(j){j.done?s(j.value):f(j.value).then(x,L)}D((c=c.apply(E,v||[])).next())})},b=function(E,v){var w={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},c,f,s,M;return M={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function x(D){return function(j){return L([D,j])}}function L(D){if(c)throw new TypeError("Generator is already executing.");for(;M&&(M=0,D[0]&&(w=0)),w;)try{if(c=1,f&&(s=D[0]&2?f.return:D[0]?f.throw||((s=f.return)&&s.call(f),0):f.next)&&!(s=s.call(f,D[1])).done)return s;switch(f=0,s&&(D=[D[0]&2,s.value]),D[0]){case 0:case 1:s=D;break;case 4:return w.label++,{value:D[1],done:!1};case 5:w.label++,f=D[1],D=[0];continue;case 7:D=w.ops.pop(),w.trys.pop();continue;default:if(s=w.trys,!(s=s.length>0&&s[s.length-1])&&(D[0]===6||D[0]===2)){w=0;continue}if(D[0]===3&&(!s||D[1]>s[0]&&D[1]<s[3])){w.label=D[1];break}if(D[0]===6&&w.label<s[1]){w.label=s[1],s=D;break}if(s&&w.label<s[2]){w.label=s[2],w.ops.push(D);break}s[2]&&w.ops.pop(),w.trys.pop();continue}D=v.call(E,w)}catch(j){D=[6,j],f=0}finally{c=s=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}},g=0,h=function(E,v){E===void 0&&(E=document),v===void 0&&(v=H.g.CDN);var w=m.wavedromRenderAdapter.getElements(E);w.length!==0&&(0,A.G)("".concat(v,"/dist/js/wavedrom/wavedrom.min.js?v=3.6.2"),"vditorWavedromScript").then(function(){w.forEach(function(c){return l(void 0,void 0,void 0,function(){var f,s,M,x,L,D;return b(this,function(j){switch(j.label){case 0:if(c.parentElement.classList.contains("vditor-wysiwyg__pre")||c.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(f=m.wavedromRenderAdapter.getCode(c),c.getAttribute("data-processed")==="true"||f.trim()==="")return[2];s=c,c.tagName==="CODE"&&(s=document.createElement("div"),Array.from(c.attributes).forEach(function(q){s.setAttribute(q.name,q.value)}),c.replaceWith(s)),j.label=1;case 1:return j.trys.push([1,3,,4]),[4,(0,u.Qf)(f)];case 2:return M=j.sent(),wavedrom.renderWaveElement(g,M,s,wavedrom.waveSkin,!1),g++,[3,4];case 3:return x=j.sent(),L=x instanceof Error?x.message:String(x),D=document.createElement("br"),s.replaceChildren(document.createTextNode("wavedrom render error:"),D,document.createTextNode(L)),s.classList.add("vditor-reset--error"),[3,4];case 4:return s.setAttribute("data-processed","true"),[2]}})})})})}}),190:((Z,S,k)=>{k.d(S,{E:()=>H});var H=function(A,u,m){m===void 0&&(m="classic");var l=A.getBoundingClientRect(),b=36;document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'.concat(m==="dark"?" vditor--dark":"",`">
|
|
40
40
|
<div class="vditor-img__bar">
|
|
41
41
|
<span class="vditor-img__btn" data-deg="0">
|
|
42
42
|
<svg><use xlink:href="#vditor-icon-redo"></use></svg>
|
|
@@ -47,102 +47,101 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
47
47
|
</span>
|
|
48
48
|
</div>
|
|
49
49
|
<div class="vditor-img__img" onclick="this.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|
50
|
-
<img style="width: `).concat(A.width,"px;height:").concat(A.height,"px;transform: translate3d(").concat(
|
|
50
|
+
<img style="width: `).concat(A.width,"px;height:").concat(A.height,"px;transform: translate3d(").concat(l.left,"px, ").concat(l.top-b,'px, 0)" src="').concat(A.getAttribute("src"),`">
|
|
51
51
|
</div>
|
|
52
|
-
</div>`)),document.body.style.overflow="hidden";var m=document.querySelector(".vditor-img img"),d="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-p-A.naturalHeight)/2,"px, 0)");setTimeout(function(){m.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(d)),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)});var v=document.querySelector(".vditor-img__btn");v.addEventListener("click",function(){var w=parseInt(v.getAttribute("data-deg"),10)+90;w/90%2===1&&A.naturalWidth>m.parentElement.clientHeight?m.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(w,"deg)"):m.style.transform="".concat(d," rotateZ(").concat(w,"deg)"),v.setAttribute("data-deg",w.toString()),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)})}}),580:((Z,E,M)=>{M.d(E,{Y:()=>c});var D=M(145),A=M(290),c=function(l,y){y===void 0&&(y=D.g.CDN),D.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),m="".concat(y,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==m&&(p.remove(),(0,A.c)(m,"vditorHljsStyle")):(0,A.c)(m,"vditorHljsStyle")}}),538:((Z,E,M)=>{M.d(E,{Z:()=>A});var D=M(290),A=function(c,l){if(!(!c||!l)){var y=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");y?y.getAttribute("href")!==p&&(y.remove(),(0,D.c)(p,"vditorContentTheme")):(0,D.c)(p,"vditorContentTheme")}}}),413:((Z,E,M)=>{M.d(E,{J:()=>D,G:()=>A});var D=function(c,l){if(document.getElementById(l))return!1;var y=new XMLHttpRequest;y.open("GET",c,!1),y.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),y.send("");var p=document.createElement("script");p.type="text/javascript",p.text=y.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(y,p){if(document.getElementById(l))return y(!0),!1;var m=document.createElement("script");m.src=c,m.async=!0,document.head.appendChild(m),m.onerror=function(d){p(d)},m.onload=function(){if(document.getElementById(l))return m.remove(),y(!0),!1;m.id=l,y(!0)}})}}),290:((Z,E,M)=>{M.d(E,{c:()=>D});var D=function(A,c){if(!document.getElementById(c)){var l=document.createElement("link");l.id=c,l.rel="stylesheet",l.type="text/css",l.href=A,document.getElementsByTagName("head")[0].appendChild(l)}}}),105:((Z,E,M)=>{M.d(E,{X:()=>D});var D=function(A){return A.replace(/\u00a0/g," ")}}),410:((Z,E,M)=>{M.d(E,{G6:()=>D,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>y,ns:()=>p,i7:()=>m});var D=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},c=function(){try{return typeof localStorage<"u"}catch{return!1}},l=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},y=function(d){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(d.metaKey&&!d.ctrlKey):!!(!d.metaKey&&d.ctrlKey)},p=function(d){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?d.indexOf("⇧")>-1&&A()&&(d=d.replace(";",":").replace("=","+").replace("-","_")):(d.startsWith("⌘")?d=d.replace("⌘","⌘+"):d.startsWith("⌥")&&d.substr(1,1)!=="⌘"?d=d.replace("⌥","⌥+"):d=d.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),d=d.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),d.indexOf("Shift")>-1&&(d=d.replace(";",":").replace("=","+").replace("-","_"))),d},m=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((Z,E,M)=>{M.d(E,{Wb:()=>D,on:()=>A,Qf:()=>c});var D=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(l){return(parseInt(l,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(l,10)/4).toString(16)})},A=function(l,y){y===void 0&&(y=window.location.search);var p=y.substring(y.indexOf("?")),m=p.indexOf("#"),d=new URLSearchParams(p.substring(0,m>=0?m:void 0));return d.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}}),106:((Z,E,M)=>{M.d(E,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>y,F9:()=>p,lG:()=>m,fb:()=>d,DX:()=>v});var D=M(771),A=function(w,b){for(var g=d(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=d(g.parentElement,b),s?g=s:C=!0;return g||!1},c=function(w,b){for(var g=(0,D.S)(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=(0,D.S)(g.parentElement,b),s?g=s:C=!0;return g||!1},l=function(w){var b=c(w,"UL"),g=c(w,"OL"),s=b;return g&&(!b||b&&g.contains(b))&&(s=g),s},y=function(w,b,g){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var s=w,C=!1;s&&!C&&!s.classList.contains("vditor-reset");)s.getAttribute(b)===g?C=!0:s=s.parentElement;return C&&s},p=function(w){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);var b=w,g=!1,s=y(w,"data-block","0");if(s)return s;for(;b&&!g&&!b.classList.contains("vditor-reset");)b.tagName==="H1"||b.tagName==="H2"||b.tagName==="H3"||b.tagName==="H4"||b.tagName==="H5"||b.tagName==="H6"||b.tagName==="P"||b.tagName==="BLOCKQUOTE"||b.tagName==="OL"||b.tagName==="UL"?g=!0:b=b.parentElement;return g&&b},m=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},d=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.classList.contains(b)?s=!0:g=g.parentElement;return s&&g},v=function(w){for(;w&&w.lastChild;)w=w.lastChild;return w}}),771:((Z,E,M)=>{M.d(E,{S:()=>D,W:()=>A});var D=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var y=c,p=!1;y&&!p&&!y.classList.contains("vditor-reset");)y.nodeName.indexOf(l)===0?p=!0:y=y.parentElement;return p&&y},A=function(c){var l=D(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}}),673:((Z,E,M)=>{M.d(E,{T:()=>D});var D=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},y=function(m){for(var d in m)m.hasOwnProperty(d)&&(Object.prototype.toString.call(m[d])==="[object Object]"?l[d]=D(l[d],m[d]):l[d]=m[d])},p=0;p<A.length;p++)y(A[p]);return l}}),810:((Z,E,M)=>{M.d(E,{zh:()=>l,Ny:()=>y,Gb:()=>p,Hc:()=>m,im:()=>d,$j:()=>v,ib:()=>w,oC:()=>b});var D=M(145),A=M(410),c=M(106),l=function(g){var s,C=g[g.currentMode].element;return getSelection().rangeCount>0&&(s=getSelection().getRangeAt(0),C.isEqualNode(s.startContainer)||C.contains(s.startContainer))?s:g[g.currentMode].range?g[g.currentMode].range:(C.focus(),s=C.ownerDocument.createRange(),s.setStart(C,0),s.collapse(!0),s)},y=function(g){var s=window.getSelection().getRangeAt(0);if(!g.contains(s.startContainer)&&!(0,c.fb)(s.startContainer,"vditor-panel--none"))return{left:0,top:0};var C=g.parentElement.getBoundingClientRect(),_;if(s.getClientRects().length===0)if(s.startContainer.nodeType===3){var x=s.startContainer.parentElement;if(x&&x.getClientRects().length>0)_=x.getClientRects()[0];else return{left:0,top:0}}else{var L=s.startContainer.children;if(L[s.startOffset]&&L[s.startOffset].getClientRects().length>0)_=L[s.startOffset].getClientRects()[0];else if(s.startContainer.childNodes.length>0){var P=s.cloneRange();s.selectNode(s.startContainer.childNodes[Math.max(0,s.startOffset-1)]),_=s.getClientRects()[0],s.setEnd(P.endContainer,P.endOffset),s.setStart(P.startContainer,P.startOffset)}else _=s.startContainer.getClientRects()[0];if(!_){for(var F=s.startContainer.childNodes[s.startOffset];!F.getClientRects||F.getClientRects&&F.getClientRects().length===0;)F=F.parentElement;_=F.getClientRects()[0]}}else _=s.getClientRects()[0];return{left:_.left-C.left,top:_.top-C.top}},p=function(g,s){if(!s){if(getSelection().rangeCount===0)return!1;s=getSelection().getRangeAt(0)}var C=s.commonAncestorContainer;return g.isEqualNode(C)||g.contains(C)},m=function(g){var s=window.getSelection();s.removeAllRanges(),s.addRange(g)},d=function(g,s,C){var _={end:0,start:0};if(!C){if(getSelection().rangeCount===0)return _;C=window.getSelection().getRangeAt(0)}if(p(s,C)){var x=C.cloneRange();g.childNodes[0]&&g.childNodes[0].childNodes[0]?x.setStart(g.childNodes[0].childNodes[0],0):x.selectNodeContents(g),x.setEnd(C.startContainer,C.startOffset),_.start=x.toString().length,_.end=_.start+C.toString().length}return _},v=function(g,s,C){var _=0,x=0,L=C.childNodes[x],P=!1,F=!1;g=Math.max(0,g),s=Math.max(0,s);var z=C.ownerDocument.createRange();for(z.setStart(L||C,0),z.collapse(!0);!F&&L;){var Q=_+L.textContent.length;if(!P&&g>=_&&g<=Q&&(g===0?z.setStart(L,0):L.childNodes[0].nodeType===3?z.setStart(L.childNodes[0],g-_):L.nextSibling?z.setStartBefore(L.nextSibling):z.setStartAfter(L),P=!0,g===s)){F=!0;break}P&&s>=_&&s<=Q&&(s===0?z.setEnd(L,0):L.childNodes[0].nodeType===3?z.setEnd(L.childNodes[0],s-_):L.nextSibling?z.setEndBefore(L.nextSibling):z.setEndAfter(L),F=!0),_=Q,L=C.childNodes[++x]}return!F&&C.childNodes[x-1]&&z.setStartBefore(C.childNodes[x-1]),m(z),z},w=function(g,s){var C=g.querySelector("wbr");if(C){if(!C.previousElementSibling)C.previousSibling?s.setStart(C.previousSibling,C.previousSibling.textContent.length):C.nextSibling?C.nextSibling.nodeType===3?s.setStart(C.nextSibling,0):s.setStartBefore(C.nextSibling):s.setStart(C.parentElement,0);else if(C.previousElementSibling.isSameNode(C.previousSibling))if(C.previousElementSibling.lastChild){s.setStartBefore(C),s.collapse(!0),m(s),(0,A.i7)()&&(C.previousElementSibling.tagName==="EM"||C.previousElementSibling.tagName==="STRONG"||C.previousElementSibling.tagName==="S")&&(s.insertNode(document.createTextNode(D.g.ZWSP)),s.collapse(!1)),C.remove();return}else s.setStartAfter(C.previousElementSibling);else s.setStart(C.previousSibling,C.previousSibling.textContent.length);s.collapse(!0),C.remove(),m(s)}},b=function(g,s){var C=document.createElement("div");C.innerHTML=g;var _=C.querySelectorAll("p");_.length===1&&!_[0].previousSibling&&!_[0].nextSibling&&s[s.currentMode].element.children.length>0&&C.firstElementChild.tagName==="P"&&(g=_[0].innerHTML.trim());var x=document.createElement("div");x.innerHTML=g;var L=l(s);if(L.toString()!==""&&(s[s.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),x.firstElementChild&&x.firstElementChild.getAttribute("data-block")==="0"){x.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var P=(0,c.F9)(L.startContainer);if(!P)s[s.currentMode].element.insertAdjacentHTML("beforeend",x.innerHTML);else{var F=(0,c.lG)(L.startContainer,"LI");F&&x.firstElementChild.tagName==="UL"?F.insertAdjacentHTML("afterend",x.firstElementChild.innerHTML):P.insertAdjacentHTML("afterend",x.innerHTML)}w(s[s.currentMode].element,L)}else{var z=document.createElement("template");z.innerHTML=g,L.insertNode(z.content.cloneNode(!0)),L.collapse(!1),m(L)}}})},rt={};function Y(Z){var E=rt[Z];if(E!==void 0)return E.exports;var M=rt[Z]={exports:{}};return pt[Z](M,M.exports,Y),M.exports}Y.d=(Z,E)=>{for(var M in E)Y.o(E,M)&&!Y.o(Z,M)&&Object.defineProperty(Z,M,{enumerable:!0,get:E[M]})},Y.o=(Z,E)=>Object.prototype.hasOwnProperty.call(Z,E),Y.r=Z=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})};var Me={};return(()=>{Y.d(Me,{default:()=>Mi});var Z=Y(408),E=Y(145),M=Y(105),D=function(e){return e.currentMode==="sv"?(0,M.X)("".concat(e.sv.element.textContent,`
|
|
52
|
+
</div>`)),document.body.style.overflow="hidden";var g=document.querySelector(".vditor-img img"),h="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-b-A.naturalHeight)/2,"px, 0)");setTimeout(function(){g.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(h)),setTimeout(function(){g.parentElement.scrollTo((g.parentElement.scrollWidth-g.parentElement.clientWidth)/2,(g.parentElement.scrollHeight-g.parentElement.clientHeight)/2)},400)});var E=document.querySelector(".vditor-img__btn");E.addEventListener("click",function(){var v=parseInt(E.getAttribute("data-deg"),10)+90;v/90%2===1&&A.naturalWidth>g.parentElement.clientHeight?g.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(v,"deg)"):g.style.transform="".concat(h," rotateZ(").concat(v,"deg)"),E.setAttribute("data-deg",v.toString()),setTimeout(function(){g.parentElement.scrollTo((g.parentElement.scrollWidth-g.parentElement.clientWidth)/2,(g.parentElement.scrollHeight-g.parentElement.clientHeight)/2)},400)})}}),580:((Z,S,k)=>{k.d(S,{Y:()=>u});var H=k(145),A=k(290),u=function(m,l){l===void 0&&(l=H.g.CDN),H.g.CODE_THEME.includes(m)||(m="github");var b=document.getElementById("vditorHljsStyle"),g="".concat(l,"/dist/js/highlight.js/styles/").concat(m,".min.css");b?b.getAttribute("href")!==g&&(b.remove(),(0,A.c)(g,"vditorHljsStyle")):(0,A.c)(g,"vditorHljsStyle")}}),538:((Z,S,k)=>{k.d(S,{Z:()=>A});var H=k(290),A=function(u,m){if(!(!u||!m)){var l=document.getElementById("vditorContentTheme"),b="".concat(m,"/").concat(u,".css");l?l.getAttribute("href")!==b&&(l.remove(),(0,H.c)(b,"vditorContentTheme")):(0,H.c)(b,"vditorContentTheme")}}}),413:((Z,S,k)=>{k.d(S,{J:()=>H,G:()=>A});var H=function(u,m){if(document.getElementById(m))return!1;var l=new XMLHttpRequest;l.open("GET",u,!1),l.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),l.send("");var b=document.createElement("script");b.type="text/javascript",b.text=l.responseText,b.id=m,document.head.appendChild(b)},A=function(u,m){return new Promise(function(l,b){if(document.getElementById(m))return l(!0),!1;var g=document.createElement("script");g.src=u,g.async=!0,document.head.appendChild(g),g.onerror=function(h){b(h)},g.onload=function(){if(document.getElementById(m))return g.remove(),l(!0),!1;g.id=m,l(!0)}})}}),290:((Z,S,k)=>{k.d(S,{c:()=>H});var H=function(A,u){if(!document.getElementById(u)){var m=document.createElement("link");m.id=u,m.rel="stylesheet",m.type="text/css",m.href=A,document.getElementsByTagName("head")[0].appendChild(m)}}}),105:((Z,S,k)=>{k.d(S,{X:()=>H});var H=function(A){return A.replace(/\u00a0/g," ")}}),410:((Z,S,k)=>{k.d(S,{G6:()=>H,vU:()=>A,pK:()=>u,Le:()=>m,yl:()=>l,ns:()=>b,i7:()=>g});var H=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},u=function(){try{return typeof localStorage<"u"}catch{return!1}},m=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},l=function(h){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(h.metaKey&&!h.ctrlKey):!!(!h.metaKey&&h.ctrlKey)},b=function(h){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?h.indexOf("⇧")>-1&&A()&&(h=h.replace(";",":").replace("=","+").replace("-","_")):(h.startsWith("⌘")?h=h.replace("⌘","⌘+"):h.startsWith("⌥")&&h.substr(1,1)!=="⌘"?h=h.replace("⌥","⌥+"):h=h.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),h=h.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),h.indexOf("Shift")>-1&&(h=h.replace(";",":").replace("=","+").replace("-","_"))),h},g=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((Z,S,k)=>{k.d(S,{Wb:()=>H,on:()=>A,Qf:()=>u});var H=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(m){return(parseInt(m,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(m,10)/4).toString(16)})},A=function(m,l){l===void 0&&(l=window.location.search);var b=l.substring(l.indexOf("?")),g=b.indexOf("#"),h=new URLSearchParams(b.substring(0,g>=0?g:void 0));return h.get(m)},u=function(m){return Function('"use strict";return ('.concat(m,")"))()}}),106:((Z,S,k)=>{k.d(S,{JQ:()=>A,E2:()=>u,O9:()=>m,a1:()=>l,F9:()=>b,lG:()=>g,fb:()=>h,DX:()=>E});var H=k(771),A=function(v,w){for(var c=h(v,w),f=!1,s=!1;c&&!c.classList.contains("vditor-reset")&&!s;)f=h(c.parentElement,w),f?c=f:s=!0;return c||!1},u=function(v,w){for(var c=(0,H.S)(v,w),f=!1,s=!1;c&&!c.classList.contains("vditor-reset")&&!s;)f=(0,H.S)(c.parentElement,w),f?c=f:s=!0;return c||!1},m=function(v){var w=u(v,"UL"),c=u(v,"OL"),f=w;return c&&(!w||w&&c.contains(w))&&(f=c),f},l=function(v,w,c){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var f=v,s=!1;f&&!s&&!f.classList.contains("vditor-reset");)f.getAttribute(w)===c?s=!0:f=f.parentElement;return s&&f},b=function(v){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);var w=v,c=!1,f=l(v,"data-block","0");if(f)return f;for(;w&&!c&&!w.classList.contains("vditor-reset");)w.tagName==="H1"||w.tagName==="H2"||w.tagName==="H3"||w.tagName==="H4"||w.tagName==="H5"||w.tagName==="H6"||w.tagName==="P"||w.tagName==="BLOCKQUOTE"||w.tagName==="OL"||w.tagName==="UL"?c=!0:w=w.parentElement;return c&&w},g=function(v,w){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var c=v,f=!1;c&&!f&&!c.classList.contains("vditor-reset");)c.nodeName===w?f=!0:c=c.parentElement;return f&&c},h=function(v,w){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var c=v,f=!1;c&&!f&&!c.classList.contains("vditor-reset");)c.classList.contains(w)?f=!0:c=c.parentElement;return f&&c},E=function(v){for(;v&&v.lastChild;)v=v.lastChild;return v}}),771:((Z,S,k)=>{k.d(S,{S:()=>H,W:()=>A});var H=function(u,m){if(!u)return!1;u.nodeType===3&&(u=u.parentElement);for(var l=u,b=!1;l&&!b&&!l.classList.contains("vditor-reset");)l.nodeName.indexOf(m)===0?b=!0:l=l.parentElement;return b&&l},A=function(u){var m=H(u,"H");return m&&m.tagName.length===2&&m.tagName!=="HR"?m:!1}}),673:((Z,S,k)=>{k.d(S,{T:()=>H});var H=function(){for(var A=[],u=0;u<arguments.length;u++)A[u]=arguments[u];for(var m={},l=function(g){for(var h in g)g.hasOwnProperty(h)&&(Object.prototype.toString.call(g[h])==="[object Object]"?m[h]=H(m[h],g[h]):m[h]=g[h])},b=0;b<A.length;b++)l(A[b]);return m}}),810:((Z,S,k)=>{k.d(S,{zh:()=>m,Ny:()=>l,Gb:()=>b,Hc:()=>g,im:()=>h,$j:()=>E,ib:()=>v,oC:()=>w});var H=k(145),A=k(410),u=k(106),m=function(c){var f,s=c[c.currentMode].element;return getSelection().rangeCount>0&&(f=getSelection().getRangeAt(0),s.isEqualNode(f.startContainer)||s.contains(f.startContainer))?f:c[c.currentMode].range?c[c.currentMode].range:(s.focus(),f=s.ownerDocument.createRange(),f.setStart(s,0),f.collapse(!0),f)},l=function(c){var f=window.getSelection().getRangeAt(0);if(!c.contains(f.startContainer)&&!(0,u.fb)(f.startContainer,"vditor-panel--none"))return{left:0,top:0};var s=c.parentElement.getBoundingClientRect(),M;if(f.getClientRects().length===0)if(f.startContainer.nodeType===3){var x=f.startContainer.parentElement;if(x&&x.getClientRects().length>0)M=x.getClientRects()[0];else return{left:0,top:0}}else{var L=f.startContainer.children;if(L[f.startOffset]&&L[f.startOffset].getClientRects().length>0)M=L[f.startOffset].getClientRects()[0];else if(f.startContainer.childNodes.length>0){var D=f.cloneRange();f.selectNode(f.startContainer.childNodes[Math.max(0,f.startOffset-1)]),M=f.getClientRects()[0],f.setEnd(D.endContainer,D.endOffset),f.setStart(D.startContainer,D.startOffset)}else M=f.startContainer.getClientRects()[0];if(!M){for(var j=f.startContainer.childNodes[f.startOffset];!j.getClientRects||j.getClientRects&&j.getClientRects().length===0;)j=j.parentElement;M=j.getClientRects()[0]}}else M=f.getClientRects()[0];return{left:M.left-s.left,top:M.top-s.top}},b=function(c,f){if(!f){if(getSelection().rangeCount===0)return!1;f=getSelection().getRangeAt(0)}var s=f.commonAncestorContainer;return c.isEqualNode(s)||c.contains(s)},g=function(c){var f=window.getSelection();f.removeAllRanges(),f.addRange(c)},h=function(c,f,s){var M={end:0,start:0};if(!s){if(getSelection().rangeCount===0)return M;s=window.getSelection().getRangeAt(0)}if(b(f,s)){var x=s.cloneRange();c.childNodes[0]&&c.childNodes[0].childNodes[0]?x.setStart(c.childNodes[0].childNodes[0],0):x.selectNodeContents(c),x.setEnd(s.startContainer,s.startOffset),M.start=x.toString().length,M.end=M.start+s.toString().length}return M},E=function(c,f,s){var M=0,x=0,L=s.childNodes[x],D=!1,j=!1;c=Math.max(0,c),f=Math.max(0,f);var q=s.ownerDocument.createRange();for(q.setStart(L||s,0),q.collapse(!0);!j&&L;){var ee=M+L.textContent.length;if(!D&&c>=M&&c<=ee&&(c===0?q.setStart(L,0):L.childNodes[0].nodeType===3?q.setStart(L.childNodes[0],c-M):L.nextSibling?q.setStartBefore(L.nextSibling):q.setStartAfter(L),D=!0,c===f)){j=!0;break}D&&f>=M&&f<=ee&&(f===0?q.setEnd(L,0):L.childNodes[0].nodeType===3?q.setEnd(L.childNodes[0],f-M):L.nextSibling?q.setEndBefore(L.nextSibling):q.setEndAfter(L),j=!0),M=ee,L=s.childNodes[++x]}return!j&&s.childNodes[x-1]&&q.setStartBefore(s.childNodes[x-1]),g(q),q},v=function(c,f){var s=c.querySelector("wbr");if(s){if(!s.previousElementSibling)s.previousSibling?f.setStart(s.previousSibling,s.previousSibling.textContent.length):s.nextSibling?s.nextSibling.nodeType===3?f.setStart(s.nextSibling,0):f.setStartBefore(s.nextSibling):f.setStart(s.parentElement,0);else if(s.previousElementSibling.isSameNode(s.previousSibling))if(s.previousElementSibling.lastChild){f.setStartBefore(s),f.collapse(!0),g(f),(0,A.i7)()&&(s.previousElementSibling.tagName==="EM"||s.previousElementSibling.tagName==="STRONG"||s.previousElementSibling.tagName==="S")&&(f.insertNode(document.createTextNode(H.g.ZWSP)),f.collapse(!1)),s.remove();return}else f.setStartAfter(s.previousElementSibling);else f.setStart(s.previousSibling,s.previousSibling.textContent.length);f.collapse(!0),s.remove(),g(f)}},w=function(c,f){var s=document.createElement("div");s.innerHTML=c;var M=s.querySelectorAll("p");M.length===1&&!M[0].previousSibling&&!M[0].nextSibling&&f[f.currentMode].element.children.length>0&&s.firstElementChild.tagName==="P"&&(c=M[0].innerHTML.trim());var x=document.createElement("div");x.innerHTML=c;var L=m(f);if(L.toString()!==""&&(f[f.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),x.firstElementChild&&x.firstElementChild.getAttribute("data-block")==="0"){x.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var D=(0,u.F9)(L.startContainer);if(!D)f[f.currentMode].element.insertAdjacentHTML("beforeend",x.innerHTML);else{var j=(0,u.lG)(L.startContainer,"LI");j&&x.firstElementChild.tagName==="UL"?j.insertAdjacentHTML("afterend",x.firstElementChild.innerHTML):D.insertAdjacentHTML("afterend",x.innerHTML)}v(f[f.currentMode].element,L)}else{var q=document.createElement("template");q.innerHTML=c,L.insertNode(q.content.cloneNode(!0)),L.collapse(!1),g(L)}}})},it={};function X(Z){var S=it[Z];if(S!==void 0)return S.exports;var k=it[Z]={exports:{}};return ht[Z](k,k.exports,X),k.exports}X.d=(Z,S)=>{for(var k in S)X.o(S,k)&&!X.o(Z,k)&&Object.defineProperty(Z,k,{enumerable:!0,get:S[k]})},X.o=(Z,S)=>Object.prototype.hasOwnProperty.call(Z,S),X.r=Z=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})};var Te={};return(()=>{X.d(Te,{default:()=>Pi});var Z=X(408),S=X(145),k=X(105),H=function(e){return e.currentMode==="sv"?(0,k.X)("".concat(e.sv.element.textContent,`
|
|
53
53
|
`).replace(/\n\n$/,`
|
|
54
|
-
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=
|
|
55
|
-
<p class="p1">`)===0&&(i=!0),r.childElementCount===1&&r.firstElementChild.tagName==="TABLE"&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var o=t||e;return/\n/.test(o)||a.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(o.replace(/&/g,"&").replace(/</g,"<"),"<wbr></code></pre></div>"):"\n```\n"+o.replace(/&/g,"&").replace(/</g,"<")+"\n```":n==="wysiwyg"?"<code>".concat(o.replace(/&/g,"&").replace(/</g,"<"),"</code><wbr>"):"`".concat(o,"`")}return!1},Se=function(e,t){if(e){if(e.parentElement.getAttribute("data-type")==="html-block"){e.setAttribute("data-render","1");return}var n=e.firstElementChild.className.replace("language-","");if(n==="abc")(0,
|
|
56
|
-
`);
|
|
57
|
-
`){
|
|
58
|
-
`);
|
|
59
|
-
`)===0&&(
|
|
60
|
-
`,
|
|
61
|
-
`,
|
|
62
|
-
`;if(G){if(((i=G.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return G.previousElementSibling.remove(),Ce(e),t.preventDefault(),!0;se+=er(G)}return u.insertNode(document.createTextNode(se)),u.collapse(!1),O&&O.textContent.trim()!==""&&!V?ie(e):Ce(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(G&&((a=G.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,k.im)(G,e.sv.element,u).start===1&&G.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(G,0),u.extractContents(),G.textContent.trim()!==""?ie(e):Ce(e),t.preventDefault(),!0;if(O&&(0,k.im)(O,e.sv.element,u).start===0&&O.previousElementSibling){u.extractContents();var ae=O.previousElementSibling.lastElementChild;return ae.getAttribute("data-type")==="newline"&&(ae.remove(),ae=O.previousElementSibling.lastElementChild),ae.getAttribute("data-type")!=="newline"&&(ae.insertAdjacentHTML("afterend",O.innerHTML),O.remove()),O.textContent.trim()!==""&&!(!((o=O.previousElementSibling)===null||o===void 0)&&o.querySelector('[data-type="code-block-open-marker"]'))?ie(e):(ae.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ae.lastChild),u.collapse(!1)),Ce(e)),t.preventDefault(),!0}}return!1},X=Y(538),pe=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},He=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),pe(e),(0,X.Z)(e.options.preview.theme.current,e.options.preview.theme.path),typeof e.options.height=="number"?e.element.style.height=e.options.height+"px":e.element.style.height=e.options.height,typeof e.options.minHeight=="number"&&(e.element.style.minHeight=e.options.minHeight+"px"),typeof e.options.width=="number"?e.element.style.width=e.options.width+"px":e.element.style.width=e.options.width,e.element.appendChild(e.toolbar.element);var t=document.createElement("div");if(t.className="vditor-content",e.options.outline.position==="left"&&t.appendChild(e.outline.element),t.appendChild(e.wysiwyg.element.parentElement),t.appendChild(e.sv.element),t.appendChild(e.ir.element.parentElement),t.appendChild(e.preview.element),e.toolbar.elements.devtools&&t.appendChild(e.devtools.element),e.options.outline.position==="right"&&(e.outline.element.classList.add("vditor-outline--right"),t.appendChild(e.outline.element)),e.upload&&t.appendChild(e.upload.element),e.options.resize.enable&&t.appendChild(e.resize.element),t.appendChild(e.hint.element),t.appendChild(e.tip.element),e.element.appendChild(t),t.addEventListener("click",function(){b(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Je(e,e.options.mode,Fn(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&typeof window.visualViewport<"u"){var n=!1,r=function(i){n||(n=!0,requestAnimationFrame(function(){n=!1;var a=e.toolbar.element;a.style.transform="none",a.getBoundingClientRect().top<0&&(a.style.transform="translate(0, ".concat(-a.getBoundingClientRect().top,"px)"))}))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}},Re=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 ".concat(Math.max(t,n),"px")}if(e.ir.element.parentElement.style.display!=="none"){var n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px ".concat(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"},gt=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")}},Xt;function Yt(){window.removeEventListener("resize",Xt)}var Fn=function(e){gt(e),Yt(),window.addEventListener("resize",Xt=function(){Re(e),gt(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||""},it=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e[e.currentMode].element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=(0,k.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,s.a1)(n,"data-type","heading"):(0,C.W)(n);r&&p(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,s.a1)(n,"data-type","blockquote"):(0,s.lG)(n,"BLOCKQUOTE");i&&p(e.toolbar.elements,["quote"]);var a=(0,s.a1)(n,"data-type","strong");a&&p(e.toolbar.elements,["bold"]);var o=(0,s.a1)(n,"data-type","em");o&&p(e.toolbar.elements,["italic"]);var u=(0,s.a1)(n,"data-type","s");u&&p(e.toolbar.elements,["strike"]);var h=(0,s.a1)(n,"data-type","a");h&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"LI");f?(f.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):f.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):f.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]);var S=(0,s.a1)(n,"data-type","code-block");S&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"]));var T=(0,s.a1)(n,"data-type","code");T&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"]));var N=(0,s.a1)(n,"data-type","table");N&&d(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},ce=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=D(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)},qn=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(E.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},Kn=function(e){for(var t=e.startContainer.nextSibling;t&&t.textContent==="";)t=t.nextSibling;return!!(t&&t.nodeType!==3&&(t.tagName==="CODE"||t.getAttribute("data-type")==="math-inline"||t.getAttribute("data-type")==="html-entity"||t.getAttribute("data-type")==="html-inline"))},$t=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},Qt=function(e){for(var t="",n=e.previousSibling;n;)n.nodeType===3?t=n.textContent+t:t=n.outerHTML+t,n=n.previousSibling;return t},zn=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},Gn=function(e){var t=Qt(e.startContainer),n=$t(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==E.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==E.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},_t=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,k.Hc)(t),!0}else 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">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,k.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},yt=function(e,t){var n=(0,k.zh)(e),r=(0,s.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>"),r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")?r.innerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"):r.outerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"),(0,k.ib)(e.wysiwyg.element,n),Be(e))},At=function(e){var t=getSelection().getRangeAt(0),n=(0,s.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>"),(0,k.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},at=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,k.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&be(t)},Zn=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,k.zh)(e),r=n.startContainer;if(!un(t,e,r)||(fn(n,e,t),kn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.F9)(r),a=(0,s.lG)(r,"P");if(gn(t,e,a,n)||mn(n,e,a,t)||En(e,t,n))return!0;var o=(0,s.fb)(r,"vditor-wysiwyg__block");if(o){if(t.key==="Escape"&&o.children.length===2)return e.wysiwyg.popover.style.display="none",o.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,l.yl)(t)&&!t.shiftKey&&t.altKey&&t.key==="Enter"&&o.getAttribute("data-type")==="code-block"){var u=e.wysiwyg.popover.querySelector(".vditor-input");return u.focus(),u.select(),t.preventDefault(),!0}if(o.getAttribute("data-block")==="0"&&(Sn(e,t,o.firstElementChild,n)||ct(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&Qe(e,t,n,o.firstElementChild,o)))return!0}if(Cn(e,n,t,a))return!0;var h=(0,s.E2)(r,"BLOCKQUOTE");if(h&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(h):n.setStartAfter(h),(0,k.Hc)(n);var f=document.createElement("p");return f.setAttribute("data-block","0"),f.innerHTML=`
|
|
63
|
-
`,n.insertNode(
|
|
64
|
-
`,
|
|
65
|
-
`+
|
|
66
|
-
`)),n.collapse(!1),(0,
|
|
67
|
-
`&&r.textContent.charAt(V-1)!==E.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,V-1)+E.g.ZWSP,n.setStart(r,V),n.collapse(!0),ce(e),t.preventDefault(),!0;r.textContent===E.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&Kn(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(E.g.ZWSP)>-1&&r.previousSibling&&r.previousSibling.nodeType!==3&&r.previousSibling.tagName==="CODE"&&(t.key==="Backspace"||t.key==="ArrowLeft"))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(Tn(t,i,n))return t.preventDefault(),!0;if(dn(n,t.key),t.key==="ArrowDown"){var J=r.nextSibling;J&&J.nodeType!==3&&J.getAttribute("data-type")==="math-inline"&&n.setStartAfter(J)}return i&&mt(i,e,t,n)?(t.preventDefault(),!0):!1},Ae=function(e,t){if(I("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ze=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e.wysiwyg.element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;t.startContainer.nodeType===3?n=t.startContainer.parentElement:n=n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,s.a1)(n,"data-type","footnotes-block");if(r){e.wysiwyg.popover.innerHTML="",Pe(r,e),Oe(e,"footnotes-block"),Ie(e,r);return}var i=(0,s.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]),(0,s.lG)(n,"BLOCKQUOTE")&&p(e.toolbar.elements,["quote"]),((0,s.lG)(n,"B")||(0,s.lG)(n,"STRONG"))&&p(e.toolbar.elements,["bold"]),((0,s.lG)(n,"I")||(0,s.lG)(n,"EM"))&&p(e.toolbar.elements,["italic"]),((0,s.lG)(n,"STRIKE")||(0,s.lG)(n,"S"))&&p(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(q){q.classList.remove("vditor-comment--focus")});var a=(0,s.fb)(n,"vditor-comment");if(a){var o=a.getAttribute("data-cmtids").split(" ");if(o.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var u=a.nextElementSibling.getAttribute("data-cmtids").split(" ");o.find(function(q){if(u.includes(q))return o=[q],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(q){q.getAttribute("data-cmtids").indexOf(o[0])>-1&&q.classList.add("vditor-comment--focus")})}var h=(0,s.lG)(n,"A");h&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"TABLE"),S=(0,C.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"])):(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"])):S?(d(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):f&&d(e.toolbar.elements,["table"]);var T=(0,s.fb)(n,"vditor-toc");if(T){e.wysiwyg.popover.innerHTML="",Pe(T,e),Oe(e,"vditor-toc"),Ie(e,T);return}var N=(0,C.S)(n,"BLOCKQUOTE");if(N&&(e.wysiwyg.popover.innerHTML="",Xe(t,N,e),Ye(t,N,e),Pe(N,e),Oe(e,"blockquote"),Ie(e,N)),i&&(e.wysiwyg.popover.innerHTML="",Xe(t,i,e),Ye(t,i,e),Pe(i,e),Oe(e,"li"),Ie(e,i)),f){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var R=function(){var q=f.rows.length,te=f.rows[0].cells.length,ze=parseInt(we.value,10)||q,Ge=parseInt(Ne.value,10)||te;if(!(ze===q&&te===Ge)){if(te!==Ge)for(var dt=Ge-te,Ve=0;Ve<f.rows.length;Ve++)if(dt>0)for(var Pn=0;Pn<dt;Pn++)Ve===0?f.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):f.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Gt=te-1;Gt>=Ge;Gt--)f.rows[Ve].cells[Gt].remove();if(q!==ze){var jn=ze-q;if(jn>0){for(var Zt="<tr>",nt=0;nt<Ge;nt++)Zt+="<td> </td>";for(var Bn=0;Bn<jn;Bn++)f.querySelector("tbody")?f.querySelector("tbody").insertAdjacentHTML("beforeend",Zt):f.querySelector("thead").insertAdjacentHTML("afterend",Zt+"</tr>")}else for(var nt=q-1;nt>=ze;nt--)f.rows[nt].remove(),f.rows.length===1&&f.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(D(e))}},H=function(q){Et(f,q),q==="right"?(G.classList.remove("vditor-icon--current"),V.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")):q==="center"?(G.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),V.classList.add("vditor-icon--current")):(V.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),G.classList.add("vditor-icon--current")),(0,k.Hc)(t),ce(e)},U=(0,s.lG)(n,"TD"),B=(0,s.lG)(n,"TH"),O="left";U?O=U.getAttribute("align")||"left":B&&(O=B.getAttribute("align")||"center");var G=document.createElement("button");G.setAttribute("type","button"),G.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),G.setAttribute("data-type","left"),G.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',G.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="left"?" vditor-icon--current":""),G.onclick=function(){H("left")};var V=document.createElement("button");V.setAttribute("type","button"),V.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),V.setAttribute("data-type","center"),V.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',V.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="center"?" vditor-icon--current":""),V.onclick=function(){H("center")};var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),J.setAttribute("data-type","right"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(O==="right"?" vditor-icon--current":""),J.onclick=function(){H("right")};var se=document.createElement("button");se.setAttribute("type","button"),se.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),se.setAttribute("data-type","insertRow"),se.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',se.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",se.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&yn(e,t,te)};var ae=document.createElement("button");ae.setAttribute("type","button"),ae.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ae.setAttribute("data-type","insertRow"),ae.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ae.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&bn(e,t,te)};var ue=document.createElement("button");ue.setAttribute("type","button"),ue.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),ue.setAttribute("data-type","insertColumn"),ue.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',ue.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ue.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&St(e,f,te)};var xe=document.createElement("button");xe.setAttribute("type","button"),xe.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),xe.setAttribute("data-type","insertColumn"),xe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',xe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",xe.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&St(e,f,te,"beforebegin")};var Te=document.createElement("button");Te.setAttribute("type","button"),Te.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),Te.setAttribute("data-type","deleteRow"),Te.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',Te.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Te.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&wn(e,t,te)};var De=document.createElement("button");De.setAttribute("type","button"),De.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),De.setAttribute("data-type","deleteColumn"),De.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',De.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",De.onclick=function(){var q=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(q,"TD")||(0,s.lG)(q,"TH");te&&vn(e,t,f,te)};var $=document.createElement("span");$.setAttribute("aria-label",window.VditorI18n.row),$.className="vditor-tooltipped vditor-tooltipped__n";var we=document.createElement("input");$.appendChild(we),we.type="number",we.min="1",we.className="vditor-input",we.style.width="42px",we.style.textAlign="center",we.setAttribute("placeholder",window.VditorI18n.row),we.value=f.rows.length.toString(),we.oninput=function(){R()},we.onkeydown=function(q){if(!q.isComposing){if(q.key==="Tab"){Ne.focus(),Ne.select(),q.preventDefault();return}Ae(e,q)||Ue(q,t)}};var Mt=document.createElement("span");Mt.setAttribute("aria-label",window.VditorI18n.column),Mt.className="vditor-tooltipped vditor-tooltipped__n";var Ne=document.createElement("input");Mt.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.column),Ne.value=f.rows[0].cells.length.toString(),Ne.oninput=function(){R()},Ne.onkeydown=function(q){if(!q.isComposing){if(q.key==="Tab"){we.focus(),we.select(),q.preventDefault();return}Ae(e,q)||Ue(q,t)}},Xe(t,f,e),Ye(t,f,e),Pe(f,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",G),e.wysiwyg.popover.insertAdjacentElement("beforeend",V),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",se),e.wysiwyg.popover.insertAdjacentElement("beforeend",xe),e.wysiwyg.popover.insertAdjacentElement("beforeend",ue),e.wysiwyg.popover.insertAdjacentElement("beforeend",Te),e.wysiwyg.popover.insertAdjacentElement("beforeend",De),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",Mt),Oe(e,"table"),Ie(e,f)}var zt=(0,s.a1)(n,"data-type","link-ref");zt&&en(e,zt,t);var et=(0,s.a1)(n,"data-type","footnotes-ref");if(et){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var $=document.createElement("span");$.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Fe=document.createElement("input");$.appendChild(Fe),Fe.className="vditor-input",Fe.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Fe.style.width="120px",Fe.value=et.getAttribute("data-footnotes-label"),Fe.oninput=function(){Fe.value.trim()!==""&&et.setAttribute("data-footnotes-label",Fe.value),typeof e.options.input=="function"&&e.options.input(D(e))},Fe.onkeydown=function(te){te.isComposing||Ae(e,te)||Ue(te,t)},Pe(et,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),Oe(e,"footnotes-ref"),Ie(e,et)}var Le=(0,s.fb)(n,"vditor-wysiwyg__block"),Rn=Le?Le.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(q){if(!Le||Le&&Rn&&!Le.contains(q)){var te=q.previousElementSibling;te.style.display="none"}}),Le&&Rn){if(e.wysiwyg.popover.innerHTML="",Xe(t,Le,e),Ye(t,Le,e),Pe(Le,e),Le.getAttribute("data-type")==="code-block"){var kt=document.createElement("span");kt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),kt.className="vditor-tooltipped vditor-tooltipped__n";var je=document.createElement("input");kt.appendChild(je);var ft=Le.firstElementChild.firstElementChild;je.className="vditor-input",je.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),je.value=ft.className.indexOf("language-")>-1?ft.className.split("-")[1].split(" ")[0]:"",je.oninput=function(q){je.value.trim()!==""?ft.className="language-".concat(je.value):(ft.className="",e.hint.recentLanguage=""),Le.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Le.lastElementChild.innerHTML=Le.firstElementChild.innerHTML,Se(Le.lastElementChild,e)),ce(e),q.detail===1&&(t.setStart(ft.firstChild,0),t.collapse(!0),(0,k.Hc)(t))},je.onkeydown=function(q){if(!q.isComposing&&!Ae(e,q)){if(q.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",q.preventDefault();return}e.hint.select(q,e),Ue(q,t)}},je.onkeyup=function(q){var te,ze;if(!(q.isComposing||q.key==="Enter"||q.key==="ArrowUp"||q.key==="Escape"||q.key==="ArrowDown")){var Ge=[],dt=je.value.substring(0,je.selectionStart);(e.options.preview.hljs.langs||E.g.ALIAS_CODE_LANGUAGES.concat(((ze=(te=window.hljs)===null||te===void 0?void 0:te.listLanguages())!==null&&ze!==void 0?ze:[]).sort())).forEach(function(Ve){Ve.indexOf(dt.toLowerCase())>-1&&Ge.push({html:Ve,value:Ve})}),e.hint.genHTML(Ge,dt,e),q.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",kt),Oe(e,"code-block")}else Oe(e,"block");Ie(e,Le)}else Le=void 0;if(S){e.wysiwyg.popover.innerHTML="";var $=document.createElement("span");$.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Ke=document.createElement("input");$.appendChild(Ke),Ke.className="vditor-input",Ke.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),Ke.style.width="120px",Ke.value=S.getAttribute("data-id")||"",Ke.oninput=function(){S.setAttribute("data-id",Ke.value),typeof e.options.input=="function"&&e.options.input(D(e))},Ke.onkeydown=function(te){te.isComposing||Ae(e,te)||Ue(te,t)},Xe(t,S,e),Ye(t,S,e),Pe(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),Oe(e,"heading"),Ie(e,S)}if(h&&xt(e,h,t),!N&&!i&&!f&&!Le&&!h&&!zt&&!et&&!S&&!T){var tt=(0,s.a1)(n,"data-block","0");tt&&tt.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Xe(t,tt,e),Ye(t,tt,e),Pe(tt,e),Oe(e,"block"),Ie(e,tt)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(q){q.style.display="none"});var In=(0,s.a1)(t.startContainer,"data-type","backslash");In&&(In.querySelector("span").style.display="inline")}},200)},Ie=function(e,t){var n=t,r=(0,s.lG)(t,"TABLE");r&&(n=r),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())},en=function(e,t,n){n===void 0&&(n=getSelection().getRangeAt(0)),e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.tagName==="IMG"?t.setAttribute("alt",a.value):t.textContent=a.value),u.value.trim()!==""&&t.setAttribute("data-link-label",u.value),typeof e.options.input=="function"&&e.options.input(D(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(h){Ae(e,h)||Ue(h,n)||ot(e,t,h,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.linkRef),u.value=t.getAttribute("data-link-label"),u.oninput=function(){r()},u.onkeydown=function(h){Ae(e,h)||Ue(h,n)||ot(e,t,h,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),Oe(e,"link-ref"),Ie(e,t)},Xe=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ze(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ye=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ze(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Pe=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)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,k.zh)(t);r.setStartAfter(e),(0,k.Hc)(r),e.remove(),ce(t),Ze(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&Be(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},ot=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,k.zh)(e);t.insertAdjacentHTML("afterend",E.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,k.Hc)(i),n.preventDefault()}}},xt=function(e,t,n){e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.innerHTML=a.value),t.setAttribute("href",u.value),t.setAttribute("title",f.value),ce(e)};t.querySelectorAll("[data-marker]").forEach(function(S){S.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.link),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.link),u.value=t.getAttribute("href")||"",u.oninput=function(){r()},u.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,f)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.tooltipText),h.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");h.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.tooltipText),f.style.width="60px",f.value=t.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){Ae(e,S)||Ue(S,n)||ot(e,t,S,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",h),Oe(e,"a"),Ie(e,t)},Jn=function(e,t){var n=e.target;t.wysiwyg.popover.innerHTML="";var r=function(){n.setAttribute("src",a.value),n.setAttribute("alt",u.value),n.setAttribute("title",f.value),typeof t.options.input=="function"&&t.options.input(D(t))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.imageURL),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.imageURL),a.value=n.getAttribute("src")||"",a.oninput=function(){r()},a.onkeydown=function(S){Ae(t,S)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.alternateText),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.alternateText),u.style.width="52px",u.value=n.getAttribute("alt")||"",u.oninput=function(){r()},u.onkeydown=function(S){Ae(t,S)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.title),h.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");h.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.title),f.value=n.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){Ae(t,S)},Pe(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",h),Oe(t,"image"),Ie(t,n)},Ue=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,k.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Oe=function(e,t){e.options.customWysiwygToolbar(t,e.wysiwyg.popover)},$e=function(e){e.currentMode==="wysiwyg"?Ze(e):e.currentMode==="ir"&&it(e)},tn=function(e,t,n){n===void 0&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(i){Se(i,e),i.previousElementSibling.setAttribute("style","display:none")}),ce(e,n)},Xn=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",u=Gn(e),h=u.beforeHTML,f=u.afterHTML;r&&!i;){var S=r.tagName;if(S==="STRIKE"&&(S="S"),S==="I"&&(S="EM"),S==="B"&&(S="STRONG"),S==="S"||S==="STRONG"||S==="EM"){var T="",N="",R="";r.parentElement.getAttribute("data-block")!=="0"&&(N=Qt(r),R=$t(r)),(h||N)&&(T="".concat(N,"<").concat(S,">").concat(h,"</").concat(S,">"),h=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(E.g.ZWSP,"<wbr>").concat(o),i=!0),(f||R)&&(f="<".concat(S,">").concat(f,"</").concat(S,">").concat(R),T+=f),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=T):(r.outerHTML=T,r=r.parentElement),a="<".concat(S,">")+a,o="</".concat(S,">")+o}else i=!0}(0,k.ib)(t.wysiwyg.element,e)},Yn=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,k.zh)(e),o=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(o==="strike"&&(o="strikeThrough"),o==="quote"){var u=(0,s.lG)(a.startContainer,"BLOCKQUOTE");u||(u=a.startContainer.childNodes[a.startOffset]),u&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),u.outerHTML=u.innerHTML.trim()===""?'<p data-block="0">'.concat(u.innerHTML,"</p>"):u.innerHTML,(0,k.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var h=(0,s.lG)(a.startContainer,"CODE");h||(h=a.startContainer.childNodes[a.startOffset]),h&&(h.outerHTML=h.innerHTML.replace(E.g.ZWSP,"")+"<wbr>",(0,k.ib)(e.wysiwyg.element,a))}else o==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):o==="check"||o==="list"||o==="ordered-list"?(vt(e,a,o),(0,k.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?Xn(a,e,o):document.execCommand(o,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,k.ib)(e.wysiwyg.element,a));var f=(0,s.F9)(a.startContainer);if(o==="quote"){if(f||(f=a.startContainer.childNodes[a.startOffset]),f){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var S=(0,s.lG)(a.startContainer,"LI");S&&f.contains(S)?S.innerHTML='<blockquote data-block="0">'.concat(S.innerHTML,"</blockquote>"):f.outerHTML='<blockquote data-block="0">'.concat(f.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")vt(e,a,o,!1),(0,k.ib)(e.wysiwyg.element,a),r=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(o==="inline-code"){if(a.toString()===""){var T=document.createElement("code");T.textContent=E.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a)}t.classList.add("vditor-menu--current")}else if(o==="code"){var T=document.createElement("div");T.className="vditor-wysiwyg__block",T.setAttribute("data-type","code-block"),T.setAttribute("data-block","0"),T.setAttribute("data-marker","```"),a.toString()===""?T.innerHTML=`<pre><code><wbr>
|
|
68
|
-
</code></pre>`:(
|
|
69
|
-
`),
|
|
70
|
-
</p>`;
|
|
54
|
+
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=X(413),u=(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,A.G)("".concat(t.options.cdn,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"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(H(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(r){n.element.lastElementChild.style.display="none",n.element.firstElementChild.innerHTML=r}})},e})(),m=X(161),l=X(410),b=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains("vditor-menu--current")&&r.classList.remove("vditor-menu--current")}})},g=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains("vditor-menu--current")&&r.classList.add("vditor-menu--current")}})},h=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(S.g.CLASS_MENU_DISABLED)&&r.classList.remove(S.g.CLASS_MENU_DISABLED)}})},E=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(S.g.CLASS_MENU_DISABLED)&&r.classList.add(S.g.CLASS_MENU_DISABLED)}})},v=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},w=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},c=function(e,t,n){t.includes("subToolbar")&&(e.toolbar.element.querySelectorAll(".vditor-hint").forEach(function(r){n&&r.isEqualNode(n)||(r.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")},f=function(e,t,n,r){n.addEventListener((0,l.Le)(),function(i){i.preventDefault(),i.stopPropagation(),!n.classList.contains(S.g.CLASS_MENU_DISABLED)&&(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach(function(a){a.classList.remove("vditor-hint--current")}),t.style.display==="block"?t.style.display="none":(c(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")))})},s=X(106),M=X(771),x=function(e,t,n,r){r&&console.log("".concat(e," - ").concat(n,": ").concat(t))},L=X(135),D=X(775),j=X(428),q=X(325),ee=X(483),oe=X(999),ne=X(472),ge=X(637),de=X(11),se=X(194),ye=X(229),Ae=X(825),mt=X(497),gt=function(e,t,n){n===void 0&&(n="sv");var r=document.createElement("div");r.innerHTML=e;var i=!1;r.childElementCount===1&&r.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(i=!0);var a=r.querySelectorAll("pre");if(r.childElementCount===1&&a.length===1&&a[0].className!=="vditor-wysiwyg"&&a[0].className!=="vditor-sv"&&(i=!0),e.indexOf(`
|
|
55
|
+
<p class="p1">`)===0&&(i=!0),r.childElementCount===1&&r.firstElementChild.tagName==="TABLE"&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var o=t||e;return/\n/.test(o)||a.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(o.replace(/&/g,"&").replace(/</g,"<"),"<wbr></code></pre></div>"):"\n```\n"+o.replace(/&/g,"&").replace(/</g,"<")+"\n```":n==="wysiwyg"?"<code>".concat(o.replace(/&/g,"&").replace(/</g,"<"),"</code><wbr>"):"`".concat(o,"`")}return!1},Se=function(e,t){if(e){if(e.parentElement.getAttribute("data-type")==="html-block"){e.setAttribute("data-render","1");return}var n=e.firstElementChild.className.replace("language-","");if(n==="abc")(0,L.Q)(e,t.options.cdn);else if(n==="mermaid")(0,ge.i)(e,t.options.cdn,t.options.theme);else if(n==="smiles")(0,Ae.J)(e,t.options.cdn,t.options.theme);else if(n==="markmap")(0,de.K)(e,t.options.cdn);else if(n==="flowchart")(0,q.P)(e,t.options.cdn);else if(n==="echarts")(0,D.p)(e,t.options.cdn,t.options.theme);else if(n==="mindmap")(0,se.P)(e,t.options.cdn,t.options.theme);else if(n==="plantuml")(0,ye.B)(e,t.options.cdn);else if(n==="graphviz")(0,ee.v)(e,t.options.cdn);else if(n==="wavedrom")(0,mt.F)(e,t.options.cdn);else if(n==="math")(0,ne.H)(e,{cdn:t.options.cdn,math:t.options.preview.math});else{var r=t.options.customRenders.find(function(i){if(i.language===n)return i.render(e,t),!0});r||((0,oe.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,j.O)(e,t.options.preview.hljs))}e.setAttribute("data-render","1")}},T=X(810),je=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(r){r.innerHTML=n,(0,ne.H)(r,{cdn:e.options.cdn,math:e.options.preview.math})})}},yt=function(e,t){var n=(0,s.lG)(e.target,"SPAN");if(n&&(0,s.fb)(n,"vditor-toc")){var r=t[t.currentMode].element.querySelector("#"+n.getAttribute("data-target-id"));if(r)if(t.options.height==="auto"){var i=r.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(i+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,i)}else t.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,t.element.offsetTop),t[t.currentMode].element.scrollTop=r.offsetTop;return}},bt=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,T.im)(e,t[t.currentMode].element,r).start===0)return e.previousElementSibling.remove(),Q(t),!0;if(et(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,T.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),Q(t),!0;if(ut(t,n,r,e,e.nextElementSibling))return!0}if(n.key==="Backspace"||n.key==="Delete"){var i=(0,s.fb)(r.startContainer,"vditor-toc");if(i)return i.remove(),Q(t),!0}},qe=function(e,t,n,r){n===void 0&&(n=!1);var i=(0,s.F9)(t.startContainer);if(i&&!n&&i.getAttribute("data-type")!=="code-block"){if(qt(i.innerHTML)&&i.previousElementSibling||Kt(i.innerHTML))return;for(var a=(0,T.im)(i,e.ir.element,t).start,o=!0,p=a-1;p>i.textContent.substr(0,a).lastIndexOf(`
|
|
56
|
+
`);p--)if(i.textContent.charAt(p)!==" "&&i.textContent.charAt(p)!==" "){o=!1;break}a===0&&(o=!1);for(var y=!0,p=a-1;p<i.textContent.length;p++)if(i.textContent.charAt(p)!==" "&&i.textContent.charAt(p)!==`
|
|
57
|
+
`){y=!1;break}if(o){typeof e.options.input=="function"&&e.options.input(H(e));return}if(y&&/^#{1,6} $/.test(i.textContent)&&(y=!1),y){var d=(0,s.fb)(t.startContainer,"vditor-ir__marker");if(!d){var C=t.startContainer.previousSibling;C&&C.nodeType!==3&&C.classList.contains("vditor-ir__node--expand")&&C.classList.remove("vditor-ir__node--expand"),typeof e.options.input=="function"&&e.options.input(H(e));return}}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function($){$.classList.remove("vditor-ir__node--expand")}),i||(i=e.ir.element),!i.querySelector("wbr")){var _=(0,s.fb)(t.startContainer,"vditor-ir__preview");_?_.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}i.querySelectorAll("[style]").forEach(function($){$.removeAttribute("style")}),i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.ir.element);var R=i.isEqualNode(e.ir.element),I=(0,s.a1)(i,"data-type","footnotes-block"),O="";if(R)O=i.innerHTML;else{var V=(0,M.S)(t.startContainer,"BLOCKQUOTE"),B=(0,s.O9)(t.startContainer);if(B&&(i=B),V&&(!B||B&&!V.contains(B))&&(i=V),I&&(i=I),O=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var N=i.previousElementSibling,z=i.nextElementSibling;N&&(N.tagName==="UL"||N.tagName==="OL")&&(O=N.outerHTML+O,N.remove()),z&&(z.tagName==="UL"||z.tagName==="OL")&&(O=O+z.outerHTML,z.remove()),O=O.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else i.previousElementSibling&&i.previousElementSibling.textContent.replace(S.g.ZWSP,"")!==""&&r&&r.inputType==="insertParagraph"&&(O=i.previousElementSibling.outerHTML+O,i.previousElementSibling.remove());i.innerText.startsWith("```")||(e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function($){$&&!i.isEqualNode($)&&(O+=$.outerHTML,$.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function($){$&&!i.isEqualNode($)&&(O+=$.outerHTML,$.remove())}))}if(x("SpinVditorIRDOM",O,"argument",e.options.debugger),O=e.lute.SpinVditorIRDOM(O),x("SpinVditorIRDOM",O,"result",e.options.debugger),R)i.innerHTML=O;else if(i.outerHTML=O,I){var Y=(0,s.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(Y){var W=Y.textContent,ie=W.substring(1,W.indexOf("]:")),ce=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(ie,'"]'));ce&&ce.setAttribute("aria-label",W.substr(ie.length+3).trim().substr(0,24))}}var Le,fe=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");fe.forEach(function($,ve){ve===0?Le=$:(Le.insertAdjacentHTML("beforeend",$.innerHTML),$.remove())}),fe.length>0&&e.ir.element.insertAdjacentElement("beforeend",fe[0]);var Oe,ke=e.ir.element.querySelectorAll("[data-type='footnotes-block']");ke.forEach(function($,ve){ve===0?Oe=$:(Oe.insertAdjacentHTML("beforeend",$.innerHTML),$.remove())}),ke.length>0&&e.ir.element.insertAdjacentElement("beforeend",ke[0]),(0,T.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function($){Se($,e)}),je(e),We(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},P=function(e,t){if(e==="")return!1;if(e.indexOf("⇧")===-1&&e.indexOf("⌘")===-1&&e.indexOf("⌥")===-1)return!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.code===e;if(e==="⇧Tab")return!!(!(0,l.yl)(t)&&!t.altKey&&t.shiftKey&&t.code==="Tab");var n=e.split("");if(e.startsWith("⌥")){var r=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(r)?"Digit":"Key")+r)}e==="⌘Enter"&&(n=["⌘","Enter"]);var i=n.length>2&&n[0]==="⇧",a=i?n[2]:n[1];return i&&((0,l.vU)()||!/Mac/.test(navigator.platform))&&(a==="-"?a="_":a==="="&&(a="+")),!!((0,l.yl)(t)&&t.key.toLowerCase()===a.toLowerCase()&&!t.altKey&&(!i&&!t.shiftKey||i&&t.shiftKey))},re=function(e){var t=e.startContainer;if(t.nodeType===3&&t.nodeValue.length!==e.startOffset)return!1;for(var n=t.nextSibling;n&&n.textContent==="";)n=n.nextSibling;if(n){if(n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&!n.getAttribute("data-block"))return n}else{var r=(0,s.fb)(t,"vditor-ir__marker");if(r&&!r.nextSibling){var i=t.parentElement.parentElement.nextSibling;if(i&&i.nodeType!==3&&i.classList.contains("vditor-ir__node"))return i}return!1}return!1},F=function(e){var t=e.startContainer,n=t.previousSibling;return t.nodeType===3&&e.startOffset===0&&n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&!n.getAttribute("data-block")?n:!1},U=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(o){o.classList.remove("vditor-ir__node--expand")});var n=(0,s.JQ)(e.startContainer,"vditor-ir__node"),r=!e.collapsed&&(0,s.JQ)(e.endContainer,"vditor-ir__node");if(!(!e.collapsed&&(!n||n!==r))){n&&(n.classList.add("vditor-ir__node--expand"),n.classList.remove("vditor-ir__node--hidden"),(0,T.Hc)(e));var i=re(e);if(i){i.classList.add("vditor-ir__node--expand"),i.classList.remove("vditor-ir__node--hidden");return}var a=F(e);if(a){a.classList.add("vditor-ir__node--expand"),a.classList.remove("vditor-ir__node--hidden");return}}},he=function(e,t){if(e.ir.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,T.zh)(e),r=n.startContainer;if(!mn(t,e,r)||(gn(n,e,t),Hn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.a1)(r,"data-newline","1");if(!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.key==="Enter"&&i&&n.startOffset<i.textContent.length){var a=i.previousElementSibling;a&&(n.insertNode(document.createTextNode(a.textContent)),n.collapse(!1));var o=i.nextSibling;o&&(n.insertNode(document.createTextNode(o.textContent)),n.collapse(!0))}var p=(0,s.lG)(r,"P");if(Sn(t,e,p,n)||En(n,e,p,t)||An(e,n,t,p))return!0;var y=(0,s.fb)(r,"vditor-ir__marker--pre");if(y&&y.tagName==="PRE"){var d=y.firstChild;if(_n(e,t,y,n)||(d.getAttribute("data-type")==="math-block"||d.getAttribute("data-type")==="html-block")&&et(e,t,n,d,y.parentElement)||ut(e,t,n,d,y.parentElement))return!0}var C=(0,s.a1)(r,"data-type","code-block-info");if(C){if(t.key==="Enter"||t.key==="Tab")return n.selectNodeContents(C.nextElementSibling.firstChild),n.collapse(!0),t.preventDefault(),c(e,["hint"]),!0;if(t.key==="Backspace"){var _=(0,T.im)(C,e.ir.element).start;_===1&&n.setStart(r,0),_===2&&(e.hint.recentLanguage="")}if(et(e,t,n,C,C.parentElement))return c(e,["hint"]),!0}var R=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(t.key.indexOf("Arrow")>-1&&R){var I=wr(R);if(I&&et(e,t,n,R,I))return!0;var O=vr(R);if(O&&ut(e,t,n,R,O))return!0}if(Tn(e,t,n)||xn(e,n,t)||Gt(e,n,t))return!0;var V=(0,M.W)(r);if(V){if(P("⌘=",t)){var B=V.querySelector(".vditor-ir__marker--heading");return B&&B.textContent.trim().length>1&&ft(e,B.textContent.substr(1)),t.preventDefault(),!0}if(P("⌘-",t)){var B=V.querySelector(".vditor-ir__marker--heading");return B&&B.textContent.trim().length<6&&ft(e,B.textContent.trim()+"# "),t.preventDefault(),!0}}var N=(0,s.F9)(r);if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(Dn(e,n,t,p))return!0;if(N&&N.previousElementSibling&&N.tagName!=="UL"&&N.tagName!=="OL"&&(N.previousElementSibling.getAttribute("data-type")==="code-block"||N.previousElementSibling.getAttribute("data-type")==="math-block")){var z=(0,T.im)(N,e.ir.element,n).start;if(z===0||z===1&&N.innerText.startsWith(S.g.ZWSP))return n.selectNodeContents(N.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),n.collapse(!1),U(n,e),N.textContent.trim().replace(S.g.ZWSP,"")===""&&(N.remove(),We(e)),t.preventDefault(),!0}if(V){var Y=V.firstElementChild.textContent.length;(0,T.im)(V,e.ir.element).start===Y&&Y!==0&&(n.setStart(V.firstElementChild.firstChild,Y-1),n.collapse(!0),(0,T.Hc)(n))}}return(t.key==="ArrowUp"||t.key==="ArrowDown")&&N&&(N.querySelectorAll(".vditor-ir__node").forEach(function(W){W.contains(r)||W.classList.add("vditor-ir__node--hidden")}),On(t,N,n))?!0:(yn(n,t.key),N&&bt(N,e,t,n)?(t.preventDefault(),!0):!1)},G=X(190),be=function(e,t){e.querySelectorAll("[data-type=footnotes-link]").forEach(function(n){for(var r=n.parentElement,i=r.nextSibling;i&&i.textContent.startsWith(" ");){var a=i;a.childNodes.forEach(function(o){r.append(o.cloneNode(!0))}),i=i.nextSibling,a.remove()}t&&t(r)})},ae=function(e,t){var n,r=getSelection().getRangeAt(0).cloneRange(),i=r.startContainer;r.startContainer.nodeType!==3&&r.startContainer.tagName==="DIV"&&(i=r.startContainer.childNodes[r.startOffset-1]);var a=(0,s.a1)(i,"data-block","0");if(a&&t&&(t.inputType==="deleteContentBackward"||t.data===" ")){for(var o=(0,T.im)(a,e.sv.element,r).start,p=!0,y=o-1;y>a.textContent.substr(0,o).lastIndexOf(`
|
|
58
|
+
`);y--)if(a.textContent.charAt(y)!==" "&&a.textContent.charAt(y)!==" "){p=!1;break}if(o===0&&(p=!1),p){Ce(e);return}if(t.inputType==="deleteContentBackward"){var d=(0,s.a1)(i,"data-type","code-block-open-marker")||(0,s.a1)(i,"data-type","code-block-close-marker");if(d){if(d.getAttribute("data-type")==="code-block-close-marker"){var C=Et(i,"code-block-open-marker");if(C){C.textContent=d.textContent,Ce(e);return}}if(d.getAttribute("data-type")==="code-block-open-marker"){var C=Et(i,"code-block-close-marker",!1);if(C){C.textContent=d.textContent,Ce(e);return}}}var _=(0,s.a1)(i,"data-type","math-block-open-marker");if(_){var R=_.nextElementSibling.nextElementSibling;R&&R.getAttribute("data-type")==="math-block-close-marker"&&(R.remove(),Ce(e));return}a.querySelectorAll('[data-type="code-block-open-marker"]').forEach(function(N){N.textContent.length===1&&N.remove()}),a.querySelectorAll('[data-type="code-block-close-marker"]').forEach(function(N){N.textContent.length===1&&N.remove()});var I=(0,s.a1)(i,"data-type","heading-marker");if(I&&I.textContent.indexOf("#")===-1){Ce(e);return}}if((t.data===" "||t.inputType==="deleteContentBackward")&&((0,s.a1)(i,"data-type","padding")||(0,s.a1)(i,"data-type","li-marker")||(0,s.a1)(i,"data-type","task-marker")||(0,s.a1)(i,"data-type","blockquote-marker"))){Ce(e);return}}if(a&&a.textContent.trimRight()==="$$"){Ce(e);return}a||(a=e.sv.element),((n=a.firstElementChild)===null||n===void 0?void 0:n.getAttribute("data-type"))==="link-ref-defs-block"&&(a=e.sv.element),(0,s.a1)(i,"data-type","footnotes-link")&&(a=e.sv.element),a.textContent.indexOf(Lute.Caret)===-1&&r.insertNode(document.createTextNode(Lute.Caret)),a.querySelectorAll("[style]").forEach(function(N){N.removeAttribute("style")}),a.querySelectorAll("font").forEach(function(N){N.outerHTML=N.innerHTML});var O=a.textContent,V=a.isEqualNode(e.sv.element);if(V)O=a.textContent;else{a.previousElementSibling&&(O=a.previousElementSibling.textContent+O,a.previousElementSibling.remove()),a.previousElementSibling&&O.indexOf(`---
|
|
59
|
+
`)===0&&(O=a.previousElementSibling.textContent+O,a.previousElementSibling.remove());var B="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(N,z){N&&!a.isEqualNode(N.parentElement)&&(B+=N.parentElement.textContent+`
|
|
60
|
+
`,N.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(N,z){N&&!a.isEqualNode(N.parentElement)&&(B+=N.parentElement.textContent+`
|
|
61
|
+
`,N.parentElement.remove())}),O=B+O}O=cn(O,e),V?a.innerHTML=O:a.outerHTML=O,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(N){e.sv.element.insertAdjacentElement("beforeend",N.parentElement)}),be(e.sv.element,function(N){e.sv.element.insertAdjacentElement("beforeend",N)}),(0,T.ib)(e.sv.element,r),we(e),Ce(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},_e=function(e,t){var n,r,i,a,o;if(e.sv.composingLock=t.isComposing,t.isComposing||(t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"))return!1;var p=(0,T.zh)(e),y=p.startContainer;p.startContainer.nodeType!==3&&p.startContainer.tagName==="DIV"&&(y=p.startContainer.childNodes[p.startOffset-1]);var d=(0,s.a1)(y,"data-type","text"),C=(0,s.a1)(y,"data-type","blockquote-marker");if(!C&&p.startOffset===0&&d&&d.previousElementSibling&&d.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(C=d.previousElementSibling),C&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&C.nextElementSibling.textContent.trim()===""&&(0,T.im)(C,e.sv.element,p).start===C.textContent.length)return((n=C.previousElementSibling)===null||n===void 0?void 0:n.getAttribute("data-type"))==="padding"&&C.previousElementSibling.setAttribute("data-action","enter-remove"),C.remove(),Ce(e),t.preventDefault(),!0;var _=(0,s.a1)(y,"data-type","li-marker"),R=(0,s.a1)(y,"data-type","task-marker"),I=_;if(I||R&&R.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(I=R),!I&&p.startOffset===0&&d&&d.previousElementSibling&&(d.previousElementSibling.getAttribute("data-type")==="li-marker"||d.previousElementSibling.getAttribute("data-type")==="task-marker")&&(I=d.previousElementSibling),I){var O=(0,T.im)(I,e.sv.element,p).start,V=I.getAttribute("data-type")==="task-marker",B=I;if(V&&(B=I.previousElementSibling.previousElementSibling.previousElementSibling),O===I.textContent.length){if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&I.nextElementSibling.textContent.trim()==="")return((r=B.previousElementSibling)===null||r===void 0?void 0:r.getAttribute("data-type"))==="padding"?(B.previousElementSibling.remove(),ae(e)):(V&&(B.remove(),I.previousElementSibling.previousElementSibling.remove(),I.previousElementSibling.remove()),I.nextElementSibling.remove(),I.remove(),Ce(e)),t.preventDefault(),!0;if(t.key==="Tab")return t.shiftKey?B.previousElementSibling.getAttribute("data-type")==="padding"&&B.previousElementSibling.remove():B.insertAdjacentHTML("beforebegin",'<span data-type="padding">'.concat(B.textContent.replace(/\S/g," "),"</span>")),/^\d/.test(B.textContent)&&(B.textContent=B.textContent.replace(/^\d{1,}/,"1"),p.selectNodeContents(I.firstChild),p.collapse(!1)),ae(e),t.preventDefault(),!0}}if(Gt(e,p,t))return!0;var N=(0,s.a1)(y,"data-block","0"),z=(0,M.S)(y,"SPAN");if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&N){var Y=!1,W=N.textContent.match(/^\n+/);(0,T.im)(N,e.sv.element).start<=(W?W[0].length:0)&&(Y=!0);var ie=`
|
|
62
|
+
`;if(z){if(((i=z.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return z.previousElementSibling.remove(),Ce(e),t.preventDefault(),!0;ie+=fr(z)}return p.insertNode(document.createTextNode(ie)),p.collapse(!1),N&&N.textContent.trim()!==""&&!Y?ae(e):Ce(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(z&&((a=z.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,T.im)(z,e.sv.element,p).start===1&&z.getAttribute("data-type").indexOf("code-block-")===-1)return p.setStart(z,0),p.extractContents(),z.textContent.trim()!==""?ae(e):Ce(e),t.preventDefault(),!0;if(N&&(0,T.im)(N,e.sv.element,p).start===0&&N.previousElementSibling){p.extractContents();var ce=N.previousElementSibling.lastElementChild;return ce.getAttribute("data-type")==="newline"&&(ce.remove(),ce=N.previousElementSibling.lastElementChild),ce.getAttribute("data-type")!=="newline"&&(ce.insertAdjacentHTML("afterend",N.innerHTML),N.remove()),N.textContent.trim()!==""&&!(!((o=N.previousElementSibling)===null||o===void 0)&&o.querySelector('[data-type="code-block-open-marker"]'))?ae(e):(ce.getAttribute("data-type")!=="newline"&&(p.selectNodeContents(ce.lastChild),p.collapse(!1)),Ce(e)),t.preventDefault(),!0}}return!1},J=X(538),pe=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},De=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),pe(e),(0,J.Z)(e.options.preview.theme.current,e.options.preview.theme.path),typeof e.options.height=="number"?e.element.style.height=e.options.height+"px":e.element.style.height=e.options.height,typeof e.options.minHeight=="number"&&(e.element.style.minHeight=e.options.minHeight+"px"),typeof e.options.width=="number"?e.element.style.width=e.options.width+"px":e.element.style.width=e.options.width,e.element.appendChild(e.toolbar.element);var t=document.createElement("div");if(t.className="vditor-content",e.options.outline.position==="left"&&t.appendChild(e.outline.element),t.appendChild(e.wysiwyg.element.parentElement),t.appendChild(e.sv.element),t.appendChild(e.ir.element.parentElement),t.appendChild(e.preview.element),e.toolbar.elements.devtools&&t.appendChild(e.devtools.element),e.options.outline.position==="right"&&(e.outline.element.classList.add("vditor-outline--right"),t.appendChild(e.outline.element)),e.upload&&t.appendChild(e.upload.element),e.options.resize.enable&&t.appendChild(e.resize.element),t.appendChild(e.hint.element),t.appendChild(e.tip.element),e.element.appendChild(t),t.addEventListener("click",function(){c(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Je(e,e.options.mode,Yn(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&typeof window.visualViewport<"u"){var n=!1,r=function(i){n||(n=!0,requestAnimationFrame(function(){n=!1;var a=e.toolbar.element;a.style.transform="none",a.getBoundingClientRect().top<0&&(a.style.transform="translate(0, ".concat(-a.getBoundingClientRect().top,"px)"))}))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}},Re=function(e){var t=window.innerWidth<=S.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 ".concat(Math.max(t,n),"px")}if(e.ir.element.parentElement.style.display!=="none"){var n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px ".concat(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"},wt=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")}},Qt;function en(){window.removeEventListener("resize",Qt)}var Yn=function(e){wt(e),en(),window.addEventListener("resize",Qt=function(){Re(e),wt(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||""},at=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,T.Gb)(e[e.currentMode].element)){b(e.toolbar.elements,S.g.EDIT_TOOLBARS),h(e.toolbar.elements,S.g.EDIT_TOOLBARS);var t=(0,T.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,s.a1)(n,"data-type","heading"):(0,M.W)(n);r&&g(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,s.a1)(n,"data-type","blockquote"):(0,s.lG)(n,"BLOCKQUOTE");i&&g(e.toolbar.elements,["quote"]);var a=(0,s.a1)(n,"data-type","strong");a&&g(e.toolbar.elements,["bold"]);var o=(0,s.a1)(n,"data-type","em");o&&g(e.toolbar.elements,["italic"]);var p=(0,s.a1)(n,"data-type","s");p&&g(e.toolbar.elements,["strike"]);var y=(0,s.a1)(n,"data-type","a");y&&g(e.toolbar.elements,["link"]);var d=(0,s.lG)(n,"LI");d?(d.classList.contains("vditor-task")?g(e.toolbar.elements,["check"]):d.parentElement.tagName==="OL"?g(e.toolbar.elements,["ordered-list"]):d.parentElement.tagName==="UL"&&g(e.toolbar.elements,["list"]),h(e.toolbar.elements,["outdent","indent"])):E(e.toolbar.elements,["outdent","indent"]);var C=(0,s.a1)(n,"data-type","code-block");C&&(E(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),g(e.toolbar.elements,["code"]));var _=(0,s.a1)(n,"data-type","code");_&&(E(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),g(e.toolbar.elements,["inline-code"]));var R=(0,s.a1)(n,"data-type","table");R&&E(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},le=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),(0,m.W)(e.wysiwyg.element,"wysiwyg",e.options.preview.markdown.imageCaption),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=H(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)},$n=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(S.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},Qn=function(e){for(var t=e.startContainer.nextSibling;t&&t.textContent==="";)t=t.nextSibling;return!!(t&&t.nodeType!==3&&(t.tagName==="CODE"||t.getAttribute("data-type")==="math-inline"||t.getAttribute("data-type")==="html-entity"||t.getAttribute("data-type")==="html-inline"))},tn=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},nn=function(e){for(var t="",n=e.previousSibling;n;)n.nodeType===3?t=n.textContent+t:t=n.outerHTML+t,n=n.previousSibling;return t},er=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},tr=function(e){var t=nn(e.startContainer),n=tn(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==S.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==S.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},xt=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,T.Hc)(t),!0}else 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">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,T.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},Dt=function(e,t){var n=e.ownerDocument.createElement(t);return n.setAttribute("data-block","0"),n},rn=function(e,t){for(var n=Dt(e,t);e.firstChild;)n.appendChild(e.firstChild);return e.replaceWith(n),n},an=function(e){if(e.nodeType!==1)return!1;var t=e;return t.getAttribute("data-block")==="0"||t.tagName==="INPUT"},nr=function(e,t){for(var n,r,i=t;i.parentNode&&!i.parentNode.isSameNode(e);)i=i.parentNode;if(!(!((n=i.parentNode)===null||n===void 0)&&n.isSameNode(e)))return[];for(var a=i,o=i;a.previousSibling&&!an(a.previousSibling);)a=a.previousSibling;for(;o.nextSibling&&!an(o.nextSibling);)o=o.nextSibling;if(a.previousSibling instanceof HTMLInputElement&&a.nodeType===3){var p=(r=a.textContent.match(/^\s+/))===null||r===void 0?void 0:r[0];p&&(a.textContent=a.textContent.substring(p.length),e.insertBefore(e.ownerDocument.createTextNode(p),a))}for(var y=[],d=a;d&&(y.push(d),!d.isSameNode(o));)d=d.nextSibling;return y},rr=function(e,t,n){var r=nr(e,t);if(r.length===0)return!1;var i=Dt(e,n);return e.insertBefore(i,r[0]),r.forEach(function(a){i.appendChild(a)}),i.innerHTML.trim()==="<wbr>"&&i.appendChild(e.ownerDocument.createElement("br")),!0},ir=function(e){for(var t=e.ownerDocument.createDocumentFragment();e.firstChild;)t.appendChild(e.firstChild);e.replaceWith(t)},vt=function(e,t){var n=(0,T.zh)(e),r=(0,s.F9)(n.startContainer);if(r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")){var i=document.createElement("wbr");n.insertNode(i),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>");var a=(0,s.lG)(i,"LI");if(a&&r.isSameNode(a.parentElement)){if(!rr(a,i,t)){i.remove();return}}else if(r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")){for(var o=Dt(r,t);r.firstChild;)o.appendChild(r.firstChild);r.appendChild(o)}else rn(r,t);(0,T.ib)(e.wysiwyg.element,n),je(e)}},Ht=function(e){var t,n,r=getSelection().getRangeAt(0),i=(0,s.F9)(r.startContainer);i||(i=r.startContainer.childNodes[r.startOffset]),i&&(r.insertNode(document.createElement("wbr")),((t=i.parentElement)===null||t===void 0?void 0:t.tagName)==="LI"&&((n=i.parentElement.parentElement)===null||n===void 0?void 0:n.getAttribute("data-tight"))==="true"?ir(i):rn(i,"p"),(0,T.ib)(e.wysiwyg.element,r),je(e)),e.wysiwyg.popover.style.display="none"},ot=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,T.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&we(t)},ar=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,T.zh)(e),r=n.startContainer;if(!mn(t,e,r)||(gn(n,e,t),Hn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.F9)(r),a=(0,s.lG)(r,"P");if(Sn(t,e,a,n)||En(n,e,a,t)||Tn(e,t,n))return!0;var o=(0,s.fb)(r,"vditor-wysiwyg__block");if(o){if(t.key==="Escape"&&o.children.length===2)return e.wysiwyg.popover.style.display="none",o.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,l.yl)(t)&&!t.shiftKey&&t.altKey&&t.key==="Enter"&&o.getAttribute("data-type")==="code-block"){var p=e.wysiwyg.popover.querySelector(".vditor-input");return p.focus(),p.select(),t.preventDefault(),!0}if(o.getAttribute("data-block")==="0"&&(_n(e,t,o.firstElementChild,n)||ut(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&et(e,t,n,o.firstElementChild,o)))return!0}if(An(e,n,t,a))return!0;var y=(0,s.E2)(r,"BLOCKQUOTE");if(y&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(y):n.setStartAfter(y),(0,T.Hc)(n);var d=document.createElement("p");return d.setAttribute("data-block","0"),d.innerHTML=`
|
|
63
|
+
`,n.insertNode(d),n.collapse(!0),(0,T.Hc)(n),le(e),we(e),t.preventDefault(),!0}var C=(0,M.W)(r);if(C){if(C.tagName==="H6"&&r.textContent.length===n.startOffset&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"){var _=document.createElement("p");return _.textContent=`
|
|
64
|
+
`,_.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",_),n.setStart(_,0),(0,T.Hc)(n),le(e),we(e),t.preventDefault(),!0}if(P("⌘=",t)){var R=parseInt(C.tagName.substr(1),10)-1;return R>0&&(vt(e,"h".concat(R)),le(e)),t.preventDefault(),!0}if(P("⌘-",t)){var R=parseInt(C.tagName.substr(1),10)+1;return R<7&&(vt(e,"h".concat(R)),le(e)),t.preventDefault(),!0}t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&C.textContent.length===1&&Ht(e)}if(xn(e,n,t))return!0;if(t.altKey&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.shiftKey){var I=(0,s.lG)(r,"A"),O=(0,s.a1)(r,"data-type","link-ref"),V=(0,s.a1)(r,"data-type","footnotes-ref");if(I||O||V||C&&C.tagName.length===2){var B=e.wysiwyg.popover.querySelector("input");B.focus(),B.select()}}if(xe(e,t))return!0;if(P("⇧⌘U",t)){var N=e.wysiwyg.popover.querySelector('[data-type="up"]');if(N)return N.click(),t.preventDefault(),!0}if(P("⇧⌘D",t)){var N=e.wysiwyg.popover.querySelector('[data-type="down"]');if(N)return N.click(),t.preventDefault(),!0}if(Gt(e,n,t))return!0;if(!(0,l.yl)(t)&&t.shiftKey&&!t.altKey&&t.key==="Enter"&&r.parentElement.tagName!=="LI"&&r.parentElement.tagName!=="P")return["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName)?n.insertNode(document.createTextNode(`
|
|
65
|
+
`+S.g.ZWSP)):n.insertNode(document.createTextNode(`
|
|
66
|
+
`)),n.collapse(!1),(0,T.Hc)(n),le(e),we(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(Dn(e,n,t,a))return!0;if(i){if(i.previousElementSibling&&i.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&i.previousElementSibling.getAttribute("data-block")==="0"&&i.tagName!=="UL"&&i.tagName!=="OL"){var z=(0,T.im)(i,e.wysiwyg.element,n).start;if(z===0&&n.startOffset===0||z===1&&i.innerText.startsWith(S.g.ZWSP))return ot(i.previousElementSibling.lastElementChild,e,!1),i.innerHTML.trim().replace(S.g.ZWSP,"")===""&&(i.remove(),le(e)),t.preventDefault(),!0}var Y=n.startOffset;if(n.toString()===""&&r.nodeType===3&&r.textContent.charAt(Y-2)===`
|
|
67
|
+
`&&r.textContent.charAt(Y-1)!==S.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,Y-1)+S.g.ZWSP,n.setStart(r,Y),n.collapse(!0),le(e),t.preventDefault(),!0;r.textContent===S.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&Qn(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(ie){ie.firstElementChild.style.display="inline",ie.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(ie){ie.firstElementChild.style.display="inline",ie.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(S.g.ZWSP)>-1&&r.previousSibling&&r.previousSibling.nodeType!==3&&r.previousSibling.tagName==="CODE"&&(t.key==="Backspace"||t.key==="ArrowLeft"))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(On(t,i,n))return t.preventDefault(),!0;if(yn(n,t.key),t.key==="ArrowDown"){var W=r.nextSibling;W&&W.nodeType!==3&&W.getAttribute("data-type")==="math-inline"&&n.setStartAfter(W)}return i&&bt(i,e,t,n)?(t.preventDefault(),!0):!1},xe=function(e,t){if(P("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ze=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,T.Gb)(e.wysiwyg.element)){b(e.toolbar.elements,S.g.EDIT_TOOLBARS),h(e.toolbar.elements,S.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;t.startContainer.nodeType===3?n=t.startContainer.parentElement:n=n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,s.a1)(n,"data-type","footnotes-block");if(r){e.wysiwyg.popover.innerHTML="",Pe(r,e),He(e,"footnotes-block"),Ie(e,r);return}var i=(0,s.lG)(n,"LI");i?(i.classList.contains("vditor-task")?g(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?g(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&g(e.toolbar.elements,["list"]),h(e.toolbar.elements,["outdent","indent"])):E(e.toolbar.elements,["outdent","indent"]),(0,s.lG)(n,"BLOCKQUOTE")&&g(e.toolbar.elements,["quote"]),((0,s.lG)(n,"B")||(0,s.lG)(n,"STRONG"))&&g(e.toolbar.elements,["bold"]),((0,s.lG)(n,"I")||(0,s.lG)(n,"EM"))&&g(e.toolbar.elements,["italic"]),((0,s.lG)(n,"STRIKE")||(0,s.lG)(n,"S"))&&g(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(K){K.classList.remove("vditor-comment--focus")});var a=(0,s.fb)(n,"vditor-comment");if(a){var o=a.getAttribute("data-cmtids").split(" ");if(o.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var p=a.nextElementSibling.getAttribute("data-cmtids").split(" ");o.find(function(K){if(p.includes(K))return o=[K],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(K){K.getAttribute("data-cmtids").indexOf(o[0])>-1&&K.classList.add("vditor-comment--focus")})}var y=(0,s.lG)(n,"A");y&&g(e.toolbar.elements,["link"]);var d=(0,s.lG)(n,"TABLE"),C=(0,M.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(E(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),g(e.toolbar.elements,["code"])):(E(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),g(e.toolbar.elements,["inline-code"])):C?(E(e.toolbar.elements,["bold"]),g(e.toolbar.elements,["headings"])):d&&E(e.toolbar.elements,["table"]);var _=(0,s.fb)(n,"vditor-toc");if(_){e.wysiwyg.popover.innerHTML="",Pe(_,e),He(e,"vditor-toc"),Ie(e,_);return}var R=(0,M.S)(n,"BLOCKQUOTE");if(R&&(e.wysiwyg.popover.innerHTML="",Ye(t,R,e),$e(t,R,e),Pe(R,e),He(e,"blockquote"),Ie(e,R)),i&&(e.wysiwyg.popover.innerHTML="",Ye(t,i,e),$e(t,i,e),Pe(i,e),He(e,"li"),Ie(e,i)),d){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var I=function(){var K=d.rows.length,te=d.rows[0].cells.length,Ge=parseInt(ve.value,10)||K,ze=parseInt(Ne.value,10)||te;if(!(Ge===K&&te===ze)){if(te!==ze)for(var pt=ze-te,Ve=0;Ve<d.rows.length;Ve++)if(pt>0)for(var Kn=0;Kn<pt;Kn++)Ve===0?d.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):d.rows[Ve].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Xt=te-1;Xt>=ze;Xt--)d.rows[Ve].cells[Xt].remove();if(K!==Ge){var Gn=Ge-K;if(Gn>0){for(var Yt="<tr>",rt=0;rt<ze;rt++)Yt+="<td> </td>";for(var zn=0;zn<Gn;zn++)d.querySelector("tbody")?d.querySelector("tbody").insertAdjacentHTML("beforeend",Yt):d.querySelector("thead").insertAdjacentHTML("afterend",Yt+"</tr>")}else for(var rt=K-1;rt>=Ge;rt--)d.rows[rt].remove(),d.rows.length===1&&d.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(H(e))}},O=function(K){Lt(d,K),K==="right"?(z.classList.remove("vditor-icon--current"),Y.classList.remove("vditor-icon--current"),W.classList.add("vditor-icon--current")):K==="center"?(z.classList.remove("vditor-icon--current"),W.classList.remove("vditor-icon--current"),Y.classList.add("vditor-icon--current")):(Y.classList.remove("vditor-icon--current"),W.classList.remove("vditor-icon--current"),z.classList.add("vditor-icon--current")),(0,T.Hc)(t),le(e)},V=(0,s.lG)(n,"TD"),B=(0,s.lG)(n,"TH"),N="left";V?N=V.getAttribute("align")||"left":B&&(N=B.getAttribute("align")||"center");var z=document.createElement("button");z.setAttribute("type","button"),z.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),z.setAttribute("data-type","left"),z.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',z.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="left"?" vditor-icon--current":""),z.onclick=function(){O("left")};var Y=document.createElement("button");Y.setAttribute("type","button"),Y.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),Y.setAttribute("data-type","center"),Y.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',Y.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="center"?" vditor-icon--current":""),Y.onclick=function(){O("center")};var W=document.createElement("button");W.setAttribute("type","button"),W.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),W.setAttribute("data-type","right"),W.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',W.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="right"?" vditor-icon--current":""),W.onclick=function(){O("right")};var ie=document.createElement("button");ie.setAttribute("type","button"),ie.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),ie.setAttribute("data-type","insertRow"),ie.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',ie.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ie.onclick=function(){var K=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(K,"TD")||(0,s.lG)(K,"TH");te&&Cn(e,t,te)};var ce=document.createElement("button");ce.setAttribute("type","button"),ce.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ce.setAttribute("data-type","insertRow"),ce.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ce.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ce.onclick=function(){var K=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(K,"TD")||(0,s.lG)(K,"TH");te&&Ln(e,t,te)};var Le=document.createElement("button");Le.setAttribute("type","button"),Le.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),Le.setAttribute("data-type","insertColumn"),Le.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',Le.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Le.onclick=function(){var K=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(K,"TD")||(0,s.lG)(K,"TH");te&&kt(e,d,te)};var fe=document.createElement("button");fe.setAttribute("type","button"),fe.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),fe.setAttribute("data-type","insertColumn"),fe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',fe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",fe.onclick=function(){var K=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(K,"TD")||(0,s.lG)(K,"TH");te&&kt(e,d,te,"beforebegin")};var Oe=document.createElement("button");Oe.setAttribute("type","button"),Oe.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),Oe.setAttribute("data-type","deleteRow"),Oe.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',Oe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Oe.onclick=function(){var K=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(K,"TD")||(0,s.lG)(K,"TH");te&&kn(e,t,te)};var ke=document.createElement("button");ke.setAttribute("type","button"),ke.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),ke.setAttribute("data-type","deleteColumn"),ke.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',ke.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ke.onclick=function(){var K=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(K,"TD")||(0,s.lG)(K,"TH");te&&Mn(e,t,d,te)};var $=document.createElement("span");$.setAttribute("aria-label",window.VditorI18n.row),$.className="vditor-tooltipped vditor-tooltipped__n";var ve=document.createElement("input");$.appendChild(ve),ve.type="number",ve.min="1",ve.className="vditor-input",ve.style.width="42px",ve.style.textAlign="center",ve.setAttribute("placeholder",window.VditorI18n.row),ve.value=d.rows.length.toString(),ve.oninput=function(){I()},ve.onkeydown=function(K){if(!K.isComposing){if(K.key==="Tab"){Ne.focus(),Ne.select(),K.preventDefault();return}xe(e,K)||Ue(K,t)}};var Xe=document.createElement("span");Xe.setAttribute("aria-label",window.VditorI18n.column),Xe.className="vditor-tooltipped vditor-tooltipped__n";var Ne=document.createElement("input");Xe.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.column),Ne.value=d.rows[0].cells.length.toString(),Ne.oninput=function(){I()},Ne.onkeydown=function(K){if(!K.isComposing){if(K.key==="Tab"){ve.focus(),ve.select(),K.preventDefault();return}xe(e,K)||Ue(K,t)}},Ye(t,d,e),$e(t,d,e),Pe(d,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",z),e.wysiwyg.popover.insertAdjacentElement("beforeend",Y),e.wysiwyg.popover.insertAdjacentElement("beforeend",W),e.wysiwyg.popover.insertAdjacentElement("beforeend",ce),e.wysiwyg.popover.insertAdjacentElement("beforeend",ie),e.wysiwyg.popover.insertAdjacentElement("beforeend",fe),e.wysiwyg.popover.insertAdjacentElement("beforeend",Le),e.wysiwyg.popover.insertAdjacentElement("beforeend",Oe),e.wysiwyg.popover.insertAdjacentElement("beforeend",ke),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",Xe),He(e,"table"),Ie(e,d)}var Jt=(0,s.a1)(n,"data-type","link-ref");Jt&&on(e,Jt,t);var tt=(0,s.a1)(n,"data-type","footnotes-ref");if(tt){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var $=document.createElement("span");$.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Fe=document.createElement("input");$.appendChild(Fe),Fe.className="vditor-input",Fe.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Fe.style.width="120px",Fe.value=tt.getAttribute("data-footnotes-label"),Fe.oninput=function(){Fe.value.trim()!==""&&tt.setAttribute("data-footnotes-label",Fe.value),typeof e.options.input=="function"&&e.options.input(H(e))},Fe.onkeydown=function(te){te.isComposing||xe(e,te)||Ue(te,t)},Pe(tt,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),He(e,"footnotes-ref"),Ie(e,tt)}var Me=(0,s.fb)(n,"vditor-wysiwyg__block"),Fn=Me?Me.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(K){if(!Me||Me&&Fn&&!Me.contains(K)){var te=K.previousElementSibling;te.style.display="none"}}),Me&&Fn){if(e.wysiwyg.popover.innerHTML="",Ye(t,Me,e),$e(t,Me,e),Pe(Me,e),Me.getAttribute("data-type")==="code-block"){var _t=document.createElement("span");_t.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),_t.className="vditor-tooltipped vditor-tooltipped__n";var Be=document.createElement("input");_t.appendChild(Be);var dt=Me.firstElementChild.firstElementChild;Be.className="vditor-input",Be.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Be.value=dt.className.indexOf("language-")>-1?dt.className.split("-")[1].split(" ")[0]:"",Be.oninput=function(K){Be.value.trim()!==""?dt.className="language-".concat(Be.value):(dt.className="",e.hint.recentLanguage=""),Me.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Me.lastElementChild.innerHTML=Me.firstElementChild.innerHTML,Se(Me.lastElementChild,e)),le(e),K.detail===1&&(t.setStart(dt.firstChild,0),t.collapse(!0),(0,T.Hc)(t))},Be.onkeydown=function(K){if(!K.isComposing&&!xe(e,K)){if(K.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",K.preventDefault();return}e.hint.select(K,e),Ue(K,t)}},Be.onkeyup=function(K){var te,Ge;if(!(K.isComposing||K.key==="Enter"||K.key==="ArrowUp"||K.key==="Escape"||K.key==="ArrowDown")){var ze=[],pt=Be.value.substring(0,Be.selectionStart);(e.options.preview.hljs.langs||S.g.ALIAS_CODE_LANGUAGES.concat(((Ge=(te=window.hljs)===null||te===void 0?void 0:te.listLanguages())!==null&&Ge!==void 0?Ge:[]).sort())).forEach(function(Ve){Ve.indexOf(pt.toLowerCase())>-1&&ze.push({html:Ve,value:Ve})}),e.hint.genHTML(ze,pt,e),K.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",_t),He(e,"code-block")}else He(e,"block");Ie(e,Me)}else Me=void 0;if(C){e.wysiwyg.popover.innerHTML="";var $=document.createElement("span");$.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),$.className="vditor-tooltipped vditor-tooltipped__n";var Ke=document.createElement("input");$.appendChild(Ke),Ke.className="vditor-input",Ke.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),Ke.style.width="120px",Ke.value=C.getAttribute("data-id")||"",Ke.oninput=function(){C.setAttribute("data-id",Ke.value),typeof e.options.input=="function"&&e.options.input(H(e))},Ke.onkeydown=function(te){te.isComposing||xe(e,te)||Ue(te,t)},Ye(t,C,e),$e(t,C,e),Pe(C,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",$),He(e,"heading"),Ie(e,C)}if(y&&Ot(e,y,t),!R&&!i&&!d&&!Me&&!y&&!Jt&&!tt&&!C&&!_){var nt=(0,s.a1)(n,"data-block","0");nt&&nt.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Ye(t,nt,e),$e(t,nt,e),Pe(nt,e),He(e,"block"),Ie(e,nt)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(K){K.style.display="none"});var qn=(0,s.a1)(t.startContainer,"data-type","backslash");qn&&(qn.querySelector("span").style.display="inline")}},200)},Ie=function(e,t){var n=t,r=(0,s.lG)(t,"TABLE");r&&(n=r),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())},on=function(e,t,n){n===void 0&&(n=getSelection().getRangeAt(0)),e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.tagName==="IMG"?t.setAttribute("alt",a.value):t.textContent=a.value),p.value.trim()!==""&&t.setAttribute("data-link-label",p.value),typeof e.options.input=="function"&&e.options.input(H(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(y){xe(e,y)||Ue(y,n)||st(e,t,y,p)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var p=document.createElement("input");o.appendChild(p),p.className="vditor-input",p.setAttribute("placeholder",window.VditorI18n.linkRef),p.value=t.getAttribute("data-link-label"),p.oninput=function(){r()},p.onkeydown=function(y){xe(e,y)||Ue(y,n)||st(e,t,y,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),He(e,"link-ref"),Ie(e,t)},Ye=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,T.ib)(n.wysiwyg.element,e),le(n),Ze(n),we(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},$e=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,T.ib)(n.wysiwyg.element,e),le(n),Ze(n),we(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Pe=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)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,T.zh)(t);r.setStartAfter(e),(0,T.Hc)(r),e.remove(),le(t),Ze(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&je(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},st=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,T.zh)(e);t.insertAdjacentHTML("afterend",S.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,T.Hc)(i),n.preventDefault()}}},Ot=function(e,t,n){e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.innerHTML=a.value),t.setAttribute("href",p.value),t.setAttribute("title",d.value),le(e)};t.querySelectorAll("[data-marker]").forEach(function(C){C.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(C){xe(e,C)||Ue(C,n)||st(e,t,C,p)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.link),o.className="vditor-tooltipped vditor-tooltipped__n";var p=document.createElement("input");o.appendChild(p),p.className="vditor-input",p.setAttribute("placeholder",window.VditorI18n.link),p.value=t.getAttribute("href")||"",p.oninput=function(){r()},p.onkeydown=function(C){xe(e,C)||Ue(C,n)||st(e,t,C,d)};var y=document.createElement("span");y.setAttribute("aria-label",window.VditorI18n.tooltipText),y.className="vditor-tooltipped vditor-tooltipped__n";var d=document.createElement("input");y.appendChild(d),d.className="vditor-input",d.setAttribute("placeholder",window.VditorI18n.tooltipText),d.style.width="60px",d.value=t.getAttribute("title")||"",d.oninput=function(){r()},d.onkeydown=function(C){xe(e,C)||Ue(C,n)||st(e,t,C,a)},Pe(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",y),He(e,"a"),Ie(e,t)},or=function(e,t){var n=e.target;t.wysiwyg.popover.innerHTML="";var r=function(){n.setAttribute("src",a.value),n.setAttribute("alt",p.value),n.setAttribute("title",d.value),(0,m.W)(t.wysiwyg.element,"wysiwyg",t.options.preview.markdown.imageCaption),typeof t.options.input=="function"&&t.options.input(H(t))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.imageURL),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.imageURL),a.value=n.getAttribute("src")||"",a.oninput=function(){r()},a.onkeydown=function(C){xe(t,C)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.alternateText),o.className="vditor-tooltipped vditor-tooltipped__n";var p=document.createElement("input");o.appendChild(p),p.className="vditor-input",p.setAttribute("placeholder",window.VditorI18n.alternateText),p.style.width="52px",p.value=n.getAttribute("alt")||"",p.oninput=function(){r()},p.onkeydown=function(C){xe(t,C)};var y=document.createElement("span");y.setAttribute("aria-label",window.VditorI18n.title),y.className="vditor-tooltipped vditor-tooltipped__n";var d=document.createElement("input");y.appendChild(d),d.className="vditor-input",d.setAttribute("placeholder",window.VditorI18n.title),d.value=n.getAttribute("title")||"",d.oninput=function(){r()},d.onkeydown=function(C){xe(t,C)},Pe(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",y),He(t,"image"),Ie(t,n)},Ue=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,T.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},He=function(e,t){e.options.customWysiwygToolbar&&e.options.customWysiwygToolbar(t,e.wysiwyg.popover)},Qe=function(e){e.currentMode==="wysiwyg"?Ze(e):e.currentMode==="ir"&&at(e)},sn=function(e,t,n){n===void 0&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(i){Se(i,e),i.previousElementSibling.setAttribute("style","display:none")}),le(e,n)},sr=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",p=tr(e),y=p.beforeHTML,d=p.afterHTML;r&&!i;){var C=r.tagName;if(C==="STRIKE"&&(C="S"),C==="I"&&(C="EM"),C==="B"&&(C="STRONG"),C==="S"||C==="STRONG"||C==="EM"){var _="",R="",I="";r.parentElement.getAttribute("data-block")!=="0"&&(R=nn(r),I=tn(r)),(y||R)&&(_="".concat(R,"<").concat(C,">").concat(y,"</").concat(C,">"),y=_),(n==="bold"&&C==="STRONG"||n==="italic"&&C==="EM"||n==="strikeThrough"&&C==="S")&&(_+="".concat(a).concat(S.g.ZWSP,"<wbr>").concat(o),i=!0),(d||I)&&(d="<".concat(C,">").concat(d,"</").concat(C,">").concat(I),_+=d),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=_):(r.outerHTML=_,r=r.parentElement),a="<".concat(C,">")+a,o="</".concat(C,">")+o}else i=!0}(0,T.ib)(t.wysiwyg.element,e)},lr=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,T.zh)(e),o=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(o==="strike"&&(o="strikeThrough"),o==="quote"){var p=(0,s.lG)(a.startContainer,"BLOCKQUOTE");p||(p=a.startContainer.childNodes[a.startOffset]),p&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),p.outerHTML=p.innerHTML.trim()===""?'<p data-block="0">'.concat(p.innerHTML,"</p>"):p.innerHTML,(0,T.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var y=(0,s.lG)(a.startContainer,"CODE");y||(y=a.startContainer.childNodes[a.startOffset]),y&&(y.outerHTML=y.innerHTML.replace(S.g.ZWSP,"")+"<wbr>",(0,T.ib)(e.wysiwyg.element,a))}else o==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):o==="check"||o==="list"||o==="ordered-list"?(Ct(e,a,o),(0,T.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?sr(a,e,o):document.execCommand(o,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,T.ib)(e.wysiwyg.element,a));var d=(0,s.F9)(a.startContainer);if(o==="quote"){if(d||(d=a.startContainer.childNodes[a.startOffset]),d){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var C=(0,s.lG)(a.startContainer,"LI");C&&d.contains(C)?C.innerHTML='<blockquote data-block="0">'.concat(C.innerHTML,"</blockquote>"):d.outerHTML='<blockquote data-block="0">'.concat(d.outerHTML,"</blockquote>"),(0,T.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")Ct(e,a,o,!1),(0,T.ib)(e.wysiwyg.element,a),r=!1,b(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(o==="inline-code"){if(a.toString()===""){var _=document.createElement("code");_.textContent=S.g.ZWSP,a.insertNode(_),a.setStart(_.firstChild,1),a.collapse(!0),(0,T.Hc)(a)}else if(a.startContainer.nodeType===3){var _=document.createElement("code");a.surroundContents(_),a.insertNode(_),(0,T.Hc)(a)}t.classList.add("vditor-menu--current")}else if(o==="code"){var _=document.createElement("div");_.className="vditor-wysiwyg__block",_.setAttribute("data-type","code-block"),_.setAttribute("data-block","0"),_.setAttribute("data-marker","```"),a.toString()===""?_.innerHTML=`<pre><code><wbr>
|
|
68
|
+
</code></pre>`:(_.innerHTML="<pre><code>".concat(a.toString(),"<wbr></code></pre>"),a.deleteContents()),a.insertNode(_),d&&(d.outerHTML=e.lute.SpinVditorDOM(d.outerHTML)),(0,T.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(ie){Se(ie,e)}),t.classList.add("vditor-menu--disabled")}else if(o==="link"){if(a.toString()===""){var R=document.createElement("a");R.innerText=S.g.ZWSP,a.insertNode(R),a.setStart(R.firstChild,1),a.collapse(!0),Ot(e,R,a);var I=e.wysiwyg.popover.querySelector("input");I.value="",I.focus(),i=!1}else{var _=document.createElement("a");_.setAttribute("href",""),_.innerHTML=a.toString(),a.surroundContents(_),a.insertNode(_),(0,T.Hc)(a),Ot(e,_,a);var O=e.wysiwyg.popover.querySelectorAll("input");O[0].value=_.innerText,O[1].focus()}r=!1,t.classList.add("vditor-menu--current")}else if(o==="table"){var V='<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(a.toString().trim()==="")d&&d.innerHTML.trim().replace(S.g.ZWSP,"")===""?d.outerHTML=V:document.execCommand("insertHTML",!1,V),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,T.Hc)(a);else{V='<table data-block="0"><thead><tr>';var B=a.toString().split(`
|
|
69
|
+
`),N=B[0].split(",").length>B[0].split(" ").length?",":" ";B.forEach(function(W,ie){ie===0?(W.split(N).forEach(function(ce,Le){Le===0?V+="<th>".concat(ce,"<wbr></th>"):V+="<th>".concat(ce,"</th>")}),V+="</tr></thead>"):(ie===1?V+="<tbody><tr>":V+="<tr>",W.split(N).forEach(function(ce){V+="<td>".concat(ce,"</td>")}),V+="</tr>")}),V+="</tbody></table>",document.execCommand("insertHTML",!1,V),(0,T.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if(o==="line"){if(d){var z=`<hr data-block="0"><p data-block="0"><wbr>
|
|
70
|
+
</p>`;d.innerHTML.trim()===""?d.outerHTML=z:d.insertAdjacentHTML("afterend",z),(0,T.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),o==="strike"&&(o="strikeThrough"),a.toString()===""&&(o==="bold"||o==="italic"||o==="strikeThrough")){var Y="strong";o==="italic"?Y="em":o==="strikeThrough"&&(Y="s");var _=document.createElement(Y);_.textContent=S.g.ZWSP,a.insertNode(_),_.previousSibling&&_.previousSibling.textContent===S.g.ZWSP&&(_.previousSibling.textContent=""),a.setStart(_.firstChild,1),a.collapse(!0),(0,T.Hc)(a)}else document.execCommand(o,!1,"")}r&&Ze(e),i&&le(e)}},me=(function(){function e(t,n){var r,i=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"";n.level===2&&(a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"");var o=n.tip?n.tip+a:"".concat(window.VditorI18n[n.name]).concat(a),p=n.name==="upload"?"div":"button";if(n.level===2)this.element.innerHTML="<".concat(p,' data-type="').concat(n.name,'">').concat(o,"</").concat(p,">");else{this.element.classList.add("vditor-toolbar__item");var y=document.createElement(p);y.setAttribute("data-type",n.name),y.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),y.setAttribute("aria-label",o),y.innerHTML=n.icon,this.element.appendChild(y)}n.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(d){d.preventDefault(),!i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?lr(t,i.element.children[0],d):t.currentMode==="ir"?Cr(t,i.element.children[0],n.prefix||"",n.suffix||""):dr(t,i.element.children[0],n.prefix||"",n.suffix||""))})}return e})(),cr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Je=function(e,t,n){var r;if(typeof n!="string"?(c(e,["subToolbar","hint"]),n.preventDefault(),r=H(e)):r=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",h(e.toolbar.elements,S.g.EDIT_TOOLBARS),b(e.toolbar.elements,S.g.EDIT_TOOLBARS),E(e.toolbar.elements,["outdent","indent"]),t==="ir")v(e.toolbar.elements,["both"]),w(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(r),We(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),Re(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){Se(a,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ne.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")v(e.toolbar.elements,["both"]),w(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",Re(e),sn(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ne.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){w(e.toolbar.elements,["both"]),v(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 i=cn(r,e);i==="<div data-block='0'></div>"&&(i=""),e.sv.element.innerHTML=i,be(e.sv.element),Ce(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),Re(e)}e.undo.resetIcon(e),typeof n!="string"&&(e[e.currentMode].element.focus(),Qe(e)),je(e),wt(e),e.toolbar.elements["edit-mode"]&&(e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach(function(a){a.classList.remove("vditor-menu--current")}),e.toolbar.elements["edit-mode"].querySelector('button[data-mode="'.concat(e.currentMode,'"]')).classList.add("vditor-menu--current")),e.outline.toggle(e,e.currentMode!=="sv"&&e.options.outline.enable,typeof n!="string")}},ur=(function(e){cr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),a.innerHTML='<button data-mode="wysiwyg">'.concat(window.VditorI18n.wysiwyg," <").concat((0,l.ns)("⌥⌘7"),`></button>
|
|
71
71
|
<button data-mode="ir">`).concat(window.VditorI18n.instantRendering," <").concat((0,l.ns)("⌥⌘8"),`></button>
|
|
72
|
-
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];
|
|
72
|
+
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];f(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(o){Je(n,"wysiwyg",o),o.preventDefault(),o.stopPropagation()}),r.children.item(1).addEventListener((0,l.Le)(),function(o){Je(n,"ir",o),o.preventDefault(),o.stopPropagation()}),r.children.item(2).addEventListener((0,l.Le)(),function(o){Je(n,"sv",o),o.preventDefault(),o.stopPropagation()})},t})(me),lt=function(e,t){return(0,T.Gb)(e,t)?getSelection().toString():""},Nt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(H(e)),c(e,["subToolbar","hint"])})},ln=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,G.E)(n.target,e.options.lang,e.options.theme))})},Rt=function(e,t){t.addEventListener("blur",function(n){if(e.currentMode==="ir"){var r=e.ir.element.querySelector(".vditor-ir__node--expand");r&&r.classList.remove("vditor-ir__node--expand")}else e.currentMode==="wysiwyg"&&!e.wysiwyg.selectPopover.contains(n.relatedTarget)&&e.wysiwyg.hideComment();e[e.currentMode].range=(0,T.zh)(e),e.options.blur&&e.options.blur(H(e))})},It=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(S.g.DROP_EDITOR,S.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(S.g.DROP_EDITOR)?Q(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&Mt(e,n,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})})},Pt=function(e,t,n){t.addEventListener("copy",function(r){return n(r,e)})},jt=function(e,t,n){t.addEventListener("cut",function(r){n(r,e),e.options.comment.enable&&e.currentMode==="wysiwyg"&&e.wysiwyg.getComments(e),document.execCommand("delete")})},we=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,T.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)}},Bt=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"||P("⌘X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(_e(e,n))return}else if(e.currentMode==="wysiwyg"){if(ar(e,n))return}else if(e.currentMode==="ir"&&he(e,n))return;if(e.options.ctrlEnter&&P("⌘Enter",n)){e.options.ctrlEnter(H(e)),n.preventDefault();return}if(P("⌘Z",n)&&!e.toolbar.elements.undo){e.undo.undo(e),n.preventDefault();return}if(P("⌘Y",n)&&!e.toolbar.elements.redo){e.undo.redo(e),n.preventDefault();return}if(n.key==="Escape"){e.hint.element.style.display==="block"?e.hint.element.style.display="none":e.options.esc&&!n.isComposing&&e.options.esc(H(e)),n.preventDefault();return}if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[1-6]$/.test(n.code)){if(e.currentMode==="wysiwyg"){var r=n.code.replace("Digit","H");(0,s.lG)(getSelection().getRangeAt(0).startContainer,r)?Ht(e):vt(e,r),le(e)}else e.currentMode==="sv"?un(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&ft(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"?Je(e,"wysiwyg",n):n.code==="Digit8"?Je(e,"ir",n):n.code==="Digit9"&&Je(e,"sv",n),!0;e.options.toolbar.find(function(i){if(!i.hotkey||i.toolbar){if(i.toolbar){var a=i.toolbar.find(function(o){if(!o.hotkey)return!1;if(P(o.hotkey,n))return e.toolbar.elements[o.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0});return!!a}return!1}if(P(i.hotkey,n))return e.toolbar.elements[i.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0})}})},Ut=function(e,t){t.addEventListener("selectstart",function(n){t.onmouseup=function(){setTimeout(function(){var r=lt(e[e.currentMode].element);r.trim()?(e.currentMode==="wysiwyg"&&e.options.comment.enable&&(!(0,s.a1)(n.target,"data-type","footnotes-block")&&!(0,s.a1)(n.target,"data-type","link-ref-defs-block")?e.wysiwyg.showComment():e.wysiwyg.hideComment()),e.options.select&&e.options.select(r)):(e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.wysiwyg.hideComment(),typeof e.options.unSelect=="function"&&e.options.unSelect())})}})},Vt=function(e,t){var n=(0,T.zh)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var r=(0,s.a1)(n.startContainer,"data-block","0");r||(r=e.sv.element);var i=e.lute.SpinVditorSVDOM(r.textContent);i="<div data-block='0'>"+i.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">
|
|
73
73
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
74
|
-
</span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,
|
|
74
|
+
</span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,be(e.sv.element),(0,T.ib)(e.sv.element,n),we(e)},Et=function(e,t,n){n===void 0&&(n=!0);var r=e;for(r.nodeType===3&&(r=r.parentElement);r;){if(r.getAttribute("data-type")===t)return r;n?r=r.previousElementSibling:r=r.nextElementSibling}return!1},cn=function(e,t){x("SpinVditorSVDOM",e,"argument",t.options.debugger);var n=t.lute.SpinVditorSVDOM(e);return e="<div data-block='0'>"+n.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">
|
|
75
75
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
76
|
-
</span></span></div><div data-block="0"><`)+"</div>",
|
|
77
|
-
`+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},
|
|
78
|
-
</span></span>`,(0,
|
|
76
|
+
</span></span></div><div data-block="0"><`)+"</div>",x("SpinVditorSVDOM",e,"result",t.options.debugger),e},fr=function(e){var t=e.getAttribute("data-type"),n=e.previousElementSibling,r=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:"",i=!1;for(t==="newline"&&(i=!0);n&&!i;){var a=n.getAttribute("data-type");if(a==="li-marker"||a==="blockquote-marker"||a==="task-marker"||a==="padding"){var o=n.textContent;if(a==="li-marker"&&(t==="code-block-open-marker"||t==="code-block-info"))r=o.replace(/\S/g," ")+r;else if(t==="code-block-close-marker"&&n.nextElementSibling.isSameNode(e)){var p=Et(e,"code-block-open-marker");p&&p.previousElementSibling&&(n=p.previousElementSibling,r=o+r)}else r=o+r}else a==="newline"&&(i=!0);n=n.previousElementSibling}return r},Ce=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=H(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)},un=function(e,t){var n=(0,T.zh)(e),r=(0,M.S)(n.startContainer,"SPAN");r&&r.textContent.trim()!==""&&(t=`
|
|
77
|
+
`+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},dr=function(e,t,n,r){var i=(0,T.zh)(e),a=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">
|
|
78
|
+
</span></span>`,(0,T.ib)(e.sv.element,i));var o=(0,s.F9)(i.startContainer),p=(0,M.S)(i.startContainer,"SPAN");if(o){if(a==="link"){var y=void 0;i.toString()===""?y="".concat(n).concat(Lute.Caret).concat(r):y="".concat(n).concat(i.toString()).concat(r.replace(")",Lute.Caret+")")),document.execCommand("insertHTML",!1,y);return}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"||a==="line"){var y=void 0;i.toString()===""?y="".concat(n).concat(Lute.Caret).concat(a==="code"?"":r):y="".concat(n).concat(i.toString()).concat(Lute.Caret).concat(a==="code"?"":r),a==="table"||a==="code"&&p&&p.textContent!==""?y=`
|
|
79
79
|
|
|
80
|
-
`+
|
|
80
|
+
`+y:a==="line"&&(y=`
|
|
81
81
|
|
|
82
82
|
`.concat(n,`
|
|
83
|
-
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,
|
|
84
|
-
data-block="0"><pre><code><audio controls="controls" src="`.concat(
|
|
85
|
-
`):t.currentMode==="ir"?a+='<audio controls="controls" src="'.concat(
|
|
86
|
-
`):a+="[".concat(
|
|
87
|
-
`):
|
|
88
|
-
`):a+="![".concat(
|
|
89
|
-
`):t.currentMode==="wysiwyg"?a+='<a href="'.concat(
|
|
90
|
-
`):a+="[".concat(
|
|
91
|
-
`)}),(0,
|
|
92
|
-
</p>`)),(0,
|
|
93
|
-
`)===-1||t.key==="ArrowRight"&&a.start>=r.textContent.trimRight().length){var o=i.nextElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(
|
|
94
|
-
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&a.start===0){var o=i.previousElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(
|
|
83
|
+
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,y);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&p){var d="* ";a==="check"?d="* [ ] ":a==="ordered-list"?d="1. ":a==="quote"&&(d="> ");var C=Et(p,"newline");C?C.insertAdjacentText("afterend",d):o.insertAdjacentText("afterbegin",d),ae(e);return}(0,T.ib)(e.sv.element,i),Ce(e)}},fn=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},dn=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])})},pr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function p(C){try{d(r.next(C))}catch(_){o(_)}}function y(C){try{d(r.throw(C))}catch(_){o(_)}}function d(C){C.done?a(C.value):i(C.value).then(p,y)}d((r=r.apply(e,t||[])).next())})},hr=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function p(d){return function(C){return y([d,C])}}function y(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(a=d[0]&2?i.return:d[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,d[1])).done)return a;switch(i=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){n.label=d[1];break}if(d[0]===6&&n.label<a[1]){n.label=a[1],a=d;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(d);break}a[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(C){d=[6,C],i=0}finally{r=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},mr=(function(){function e(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"}return e})(),gr=function(e,t){e.tip.hide();var n=[],r="",i="";e.options.lang,e.options;for(var a=function(d,C){var _=t[C],R=!0;_.name||(r+="<li>".concat(window.VditorI18n.nameEmpty,"</li>"),R=!1),_.size>e.options.upload.max&&(r+="<li>".concat(_.name," ").concat(window.VditorI18n.over," ").concat(e.options.upload.max/1024/1024,"M</li>"),R=!1);var I=_.name.lastIndexOf("."),O=_.name.substr(I),V=e.options.upload.filename(_.name.substr(0,I))+O;if(e.options.upload.accept){var B=e.options.upload.accept.split(",").some(function(N){var z=N.trim();if(z.indexOf(".")===0){if(O.toLowerCase()===z.toLowerCase())return!0}else if(_.type.split("/")[0]===z.split("/")[0])return!0;return!1});B||(r+="<li>".concat(_.name," ").concat(window.VditorI18n.fileTypeError,"</li>"),R=!1)}R&&(n.push(_),i+="<li>".concat(V," ").concat(window.VditorI18n.uploading,' <a class="vditorCancelUpload" href="javascript:void(0)">').concat(window.VditorI18n.cancelUpload,"</a></li>"))},o=t.length,p=0;p<o;p++)a(o,p);if(e.tip.show("<ul>".concat(r).concat(i,"</ul>")),e.options.upload.cancel){var y=e.tip.element.querySelector(".vditorCancelUpload");y&&y.addEventListener("click",function(){e.options.upload.cancel(n),e.tip.hide(),e.upload.isUploading=!1})}return n},yr=function(e,t){var n=fn(t);n.focus();var r=JSON.parse(e),i="";r.code===1&&(i="".concat(r.msg)),r.data.errFiles&&r.data.errFiles.length>0&&(i="<ul><li>".concat(i,"</li>"),r.data.errFiles.forEach(function(o){var p=o.lastIndexOf("."),y=t.options.upload.filename(o.substr(0,p))+o.substr(p);i+="<li>".concat(y," ").concat(window.VditorI18n.uploadError,"</li>")}),i+="</ul>"),i?t.tip.show(i):t.tip.hide();var a="";Object.keys(r.data.succMap).forEach(function(o){var p=r.data.succMap[o],y=o.lastIndexOf("."),d=o.substr(y),C=t.options.upload.filename(o.substr(0,y))+d;d=d.toLowerCase(),d.indexOf(".wav")===0||d.indexOf(".mp3")===0||d.indexOf(".ogg")===0?t.currentMode==="wysiwyg"?a+=`<div class="vditor-wysiwyg__block" data-type="html-block"
|
|
84
|
+
data-block="0"><pre><code><audio controls="controls" src="`.concat(p,'"></audio></code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="').concat(p,`"></audio></pre></div>
|
|
85
|
+
`):t.currentMode==="ir"?a+='<audio controls="controls" src="'.concat(p,`"></audio>
|
|
86
|
+
`):a+="[".concat(C,"](").concat(p,`)
|
|
87
|
+
`):d.indexOf(".apng")===0||d.indexOf(".bmp")===0||d.indexOf(".gif")===0||d.indexOf(".ico")===0||d.indexOf(".cur")===0||d.indexOf(".jpg")===0||d.indexOf(".jpeg")===0||d.indexOf(".jfif")===0||d.indexOf(".pjp")===0||d.indexOf(".pjpeg")===0||d.indexOf(".png")===0||d.indexOf(".svg")===0||d.indexOf(".webp")===0?t.currentMode==="wysiwyg"?a+='<img alt="'.concat(C,'" src="').concat(p,`">
|
|
88
|
+
`):a+=".concat(p,`)
|
|
89
|
+
`):t.currentMode==="wysiwyg"?a+='<a href="'.concat(p,'">').concat(C,`</a>
|
|
90
|
+
`):a+="[".concat(C,"](").concat(p,`)
|
|
91
|
+
`)}),(0,T.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},Wt=function(e,t,n){return pr(void 0,void 0,void 0,function(){var r,i,O,a,o,o,p,y,d,C,_,R,I,O,V,B;return hr(this,function(N){switch(N.label){case 0:for(r=[],i=e.options.upload.multiple===!0?t.length:1,O=0;O<i;O++)a=t[O],a instanceof DataTransferItem&&(a=a.getAsFile()),r.push(a);return e.options.upload.handler?[4,e.options.upload.handler(r)]:[3,2];case 1:return o=N.sent(),n&&(n.value=""),typeof o=="string"?(e.tip.show(o),[2]):[2];case 2:return!e.options.upload.url||!e.upload?(n&&(n.value=""),e.tip.show("please config: options.upload.url"),[2]):e.options.upload.file?[4,e.options.upload.file(r)]:[3,4];case 3:r=N.sent(),N.label=4;case 4:if(e.options.upload.validate&&(o=e.options.upload.validate(r),typeof o=="string"))return e.tip.show(o),[2];if(p=fn(e),e.upload.range=(0,T.zh)(e),y=gr(e,r),y.length===0)return n&&(n.value=""),[2];for(d=new FormData,C=e.options.upload.extraData,_=0,R=Object.keys(C);_<R.length;_++)I=R[_],d.append(I,C[I]);for(O=0,V=y.length;O<V;O++)d.append(e.options.upload.fieldName,y[O]);return B=new XMLHttpRequest,e.upload.xhr=B,B.open("POST",e.options.upload.url),e.options.upload.token&&B.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(B.withCredentials=!0),dn(e,B),e.upload.isUploading=!0,p.setAttribute("contenteditable","false"),B.onreadystatechange=function(){if(B.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,p.setAttribute("contenteditable","true"),B.status>=200&&B.status<300)if(e.options.upload.success)e.options.upload.success(p,B.responseText);else{var z=B.responseText;e.options.upload.format&&(z=e.options.upload.format(t,B.responseText)),yr(z,e)}else e.options.upload.error?e.options.upload.error(B.responseText):e.tip.show(B.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},B.upload.onprogress=function(z){if(z.lengthComputable){var Y=z.loaded/z.total*100;e.upload.element.style.display="block";var W=e.upload.element;W.style.width=Y+"%"}},B.send(d),[2]}})})},St=function(e,t,n){var r,i=(0,s.F9)(t.startContainer);if(i||(i=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 a=$n(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(W){W.remove()}),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach(function(W){W.removeAttribute("style")}),i.querySelectorAll(".vditor-comment").forEach(function(W){W.textContent.trim()===""&&(W.classList.remove("vditor-comment","vditor-comment--focus"),W.removeAttribute("data-cmtids"))}),(r=i.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(W){W.textContent.trim()===""&&(W.classList.remove("vditor-comment","vditor-comment--focus"),W.removeAttribute("data-cmtids"))});var o="";i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.wysiwyg.element);var p=i.isEqualNode(e.wysiwyg.element),y=(0,s.a1)(i,"data-type","footnotes-block"),d=(0,s.a1)(t.startContainer,"data-type","callout");if(p)o=i.innerHTML;else{var C=(0,s.O9)(t.startContainer);if(C&&!y){var _=(0,M.S)(t.startContainer,"BLOCKQUOTE");_?i=(0,s.F9)(t.startContainer)||i:i=C}if(y&&(i=y),d&&(i=d),o=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var R=i.previousElementSibling,I=i.nextElementSibling;R&&(R.tagName==="UL"||R.tagName==="OL")&&(o=R.outerHTML+o,R.remove()),I&&(I.tagName==="UL"||I.tagName==="OL")&&(o=o+I.outerHTML,I.remove()),o=o.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}i.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(W){W&&!i.isEqualNode(W)&&(o+=W.outerHTML,W.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(W){W&&!i.isEqualNode(W)&&(o+=W.outerHTML,W.remove())}))}if(o=o.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,""),o==='<p data-block="0">```<wbr></p>'&&e.hint.recentLanguage&&(o='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),x("SpinVditorDOM",o,"argument",e.options.debugger),o=e.lute.SpinVditorDOM(o),x("SpinVditorDOM",o,"result",e.options.debugger),p)i.innerHTML=o;else if(i.outerHTML=o,y){var O=(0,s.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(O){var V=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(O.getAttribute("data-marker"),'"]'));V&&V.setAttribute("aria-label",O.textContent.trim().substr(0,24))}}var B,N=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");N.forEach(function(W,ie){ie===0?B=W:(B.insertAdjacentHTML("beforeend",W.innerHTML),W.remove())}),N.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",N[0]);var z,Y=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");Y.forEach(function(W,ie){ie===0?z=W:(z.insertAdjacentHTML("beforeend",W.innerHTML),W.remove())}),Y.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",Y[0]),(0,T.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(W){Se(W,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)))}je(e),le(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},br=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},pn=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function p(C){try{d(r.next(C))}catch(_){o(_)}}function y(C){try{d(r.throw(C))}catch(_){o(_)}}function d(C){C.done?a(C.value):i(C.value).then(p,y)}d((r=r.apply(e,t||[])).next())})},hn=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function p(d){return function(C){return y([d,C])}}function y(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(a=d[0]&2?i.return:d[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,d[1])).done)return a;switch(i=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){n.label=d[1];break}if(d[0]===6&&n.label<a[1]){n.label=a[1],a=d;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(d);break}a[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(C){d=[6,C],i=0}finally{r=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},mn=function(e,t,n){if(e.keyCode===229&&e.code===""&&e.key==="Unidentified"&&t.currentMode!=="sv"){var r=(0,s.F9)(n);if(r&&r.textContent.trim()==="")return t[t.currentMode].composingLock=!0,!1}return!0},gn=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 r=(0,s.lG)(e.startContainer,"P")||(0,s.lG)(e.startContainer,"LI");if(r&&(0,T.im)(r,t[t.currentMode].element,e).start===0){r.nodeValue&&(r.nodeValue=r.nodeValue.replace(/\u2006/g,""));var i=document.createTextNode(S.g.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},yn=function(e,t){if(t==="ArrowDown"||t==="ArrowUp"){var n=(0,s.a1)(e.startContainer,"data-type","math-inline")||(0,s.a1)(e.startContainer,"data-type","html-entity")||(0,s.a1)(e.startContainer,"data-type","html-inline");n&&(t==="ArrowDown"&&e.setStartAfter(n.parentElement),t==="ArrowUp"&&e.setStartBefore(n.parentElement))}},ct=function(e,t){var n=(0,T.zh)(e),r=(0,s.F9)(n.startContainer);r&&(r.insertAdjacentHTML(t,'<p data-block="0">'.concat(S.g.ZWSP,`<wbr>
|
|
92
|
+
</p>`)),(0,T.ib)(e[e.currentMode].element,n),Qe(e),Q(e))},wr=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.rows[0].cells[0].isSameNode(e)?t:!1},vr=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)?t:!1},bn=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling;return r||(e.parentElement.previousElementSibling?r=e.parentElement.previousElementSibling.lastElementChild:e.parentElement.parentElement.tagName==="TBODY"&&e.parentElement.parentElement.previousElementSibling?r=e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild:r=null),r&&(t.selectNodeContents(r),n||t.collapse(!1),(0,T.Hc)(t)),r},ut=function(e,t,n,r,i){var a=(0,T.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowDown"&&r.textContent.trimRight().substr(a.start).indexOf(`
|
|
93
|
+
`)===-1||t.key==="ArrowRight"&&a.start>=r.textContent.trimRight().length){var o=i.nextElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(S.g.ZWSP,"<wbr></p>")),(0,T.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!0),(0,T.Hc)(n)),t.preventDefault(),!0}return!1},et=function(e,t,n,r,i){var a=(0,T.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowUp"&&r.textContent.substr(0,a.start).indexOf(`
|
|
94
|
+
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&a.start===0){var o=i.previousElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(S.g.ZWSP,"<wbr></p>")),(0,T.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!1),(0,T.Hc)(n)),t.preventDefault(),!0}return!1},Ct=function(e,t,n,r){r===void 0&&(r=!0);var i=(0,s.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach(function(C){C.remove()}),t.insertNode(document.createElement("wbr")),r&&i){for(var a="",o=0;o<i.parentElement.childElementCount;o++){var p=i.parentElement.children[o].querySelector("input");p&&p.remove(),a+='<p data-block="0">'.concat(i.parentElement.children[o].innerHTML.trimLeft(),"</p>")}i.parentElement.insertAdjacentHTML("beforebegin",a),i.parentElement.remove()}else if(i)if(n==="check")i.parentElement.querySelectorAll("li").forEach(function(C){C.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'.concat(C.textContent.indexOf(" ")===0?"":" ")),C.classList.add("vditor-task")});else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach(function(C){C.querySelector("input").remove(),C.classList.remove("vditor-task")});var d=void 0;n==="list"?(d=document.createElement("ul"),d.setAttribute("data-marker","*")):(d=document.createElement("ol"),d.setAttribute("data-marker","1.")),d.setAttribute("data-block","0"),d.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),d.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(d,i.parentElement)}else{var y=(0,s.a1)(t.startContainer,"data-block","0");y||(e[e.currentMode].element.querySelector("wbr").remove(),y=e[e.currentMode].element.querySelector("p"),y.innerHTML="<wbr>"),n==="check"?(y.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(y.innerHTML,"</li></ul>")),y.remove()):n==="list"?(y.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(y.innerHTML,"</li></ul>")),y.remove()):n==="ordered-list"&&(y.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(y.innerHTML,"</li></ol>")),y.remove())}},wn=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach(function(y,d){y.nodeType!==3&&t&&y.textContent.trim()!==""&&t.getAttribute("data-node-id")===y.getAttribute("data-node-id")&&(d!==0&&i.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(y){y.remove()}),n.insertNode(document.createElement("wbr"));var a=r.parentElement,o="";i.forEach(function(y){var d=y.getAttribute("data-marker");d.length!==1&&(d="1".concat(d.slice(-1))),o+='<li data-node-id="'.concat(y.getAttribute("data-node-id"),'" data-marker="').concat(d,'">').concat(y.innerHTML,"</li>"),y.remove()}),r.insertAdjacentHTML("beforeend","<".concat(a.tagName,' data-block="0">').concat(o,"</").concat(a.tagName,">")),e.currentMode==="wysiwyg"?a.outerHTML=e.lute.SpinVditorDOM(a.outerHTML):a.outerHTML=e.lute.SpinVditorIRDOM(a.outerHTML),(0,T.ib)(e[e.currentMode].element,n);var p=(0,s.O9)(n.startContainer);p&&p.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(y){Se(y,e),e.currentMode==="wysiwyg"&&y.previousElementSibling.setAttribute("style","display:none")}),Q(e),Qe(e)}else e[e.currentMode].element.focus()},Ft=function(e,t,n,r){var i=(0,s.lG)(t.parentElement,"LI");if(i){e[e.currentMode].element.querySelectorAll("wbr").forEach(function(_){_.remove()}),n.insertNode(document.createElement("wbr"));var a=t.parentElement,o=a.cloneNode(),p=[t];Array.from(n.cloneContents().children).forEach(function(_,R){_.nodeType!==3&&t&&_.textContent.trim()!==""&&t.getAttribute("data-node-id")===_.getAttribute("data-node-id")&&(R!==0&&p.push(t),t=t.nextElementSibling)});var y=!1,d="";a.querySelectorAll("li").forEach(function(_){y&&(d+=_.outerHTML,!_.nextElementSibling&&!_.previousElementSibling?_.parentElement.remove():_.remove()),_.isSameNode(p[p.length-1])&&(y=!0)}),p.reverse().forEach(function(_){i.insertAdjacentElement("afterend",_)}),d&&(o.innerHTML=d,p[0].insertAdjacentElement("beforeend",o)),e.currentMode==="wysiwyg"?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,T.ib)(e[e.currentMode].element,n);var C=(0,s.O9)(n.startContainer);C&&C.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(_){Se(_,e),e.currentMode==="wysiwyg"&&_.previousElementSibling.setAttribute("style","display:none")}),Q(e),Qe(e)}else e[e.currentMode].element.focus()},Lt=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,r=e.rows[0].cells.length,i=e.rows.length,a=0,o=0;o<i;o++)for(var p=0;p<r;p++)if(e.rows[o].cells[p].isSameNode(n)){a=p;break}for(var y=0;y<i;y++)e.rows[y].cells[a].setAttribute("align",t)},qt=function(e){var t=e.trimRight().split(`
|
|
95
95
|
`).pop();return t===""?!1:(t.replace(/ |-/g,"")===""||t.replace(/ |_/g,"")===""||t.replace(/ |\*/g,"")==="")&&t.replace(/ /g,"").length>2?!(t.indexOf("-")>-1&&t.trimLeft().indexOf(" ")===-1&&e.trimRight().split(`
|
|
96
|
-
`).length>1||t.indexOf(" ")===0||t.indexOf(" ")===0):!1},
|
|
97
|
-
`);return e=t.pop(),e.indexOf(" ")===0||e.indexOf(" ")===0||(e=e.trimLeft(),e===""||t.length===0)?!1:e.replace(/-/g,"")===""||e.replace(/=/g,"")===""},
|
|
98
|
-
`)&&
|
|
96
|
+
`).length>1||t.indexOf(" ")===0||t.indexOf(" ")===0):!1},Kt=function(e){var t=e.trimRight().split(`
|
|
97
|
+
`);return e=t.pop(),e.indexOf(" ")===0||e.indexOf(" ")===0||(e=e.trimLeft(),e===""||t.length===0)?!1:e.replace(/-/g,"")===""||e.replace(/=/g,"")===""},Q=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?le(e,t):e.currentMode==="ir"?We(e,t):e.currentMode==="sv"&&Ce(e,t)},Er=function(e){return e.textContent.split(S.g.ZWSP).join("").trim()!==""?!1:!e.querySelector(["audio","canvas","embed","hr","iframe","img","object","ol","pre","svg","table","ul","video","input:not([type='checkbox'])"].join(", "))},vn=function(e){var t=e.parentElement,n=t.parentElement,r=document.createElement("p");r.setAttribute("data-block","0"),r.innerHTML="<wbr>";var i;if(e.nextElementSibling){for(i=t.cloneNode(!1);e.nextElementSibling;)i.appendChild(e.nextElementSibling);n.insertBefore(i,t.nextSibling)}return e.remove(),t.childElementCount===0?n.replaceChild(r,t):n.insertBefore(r,i||t.nextSibling),r},En=function(e,t,n,r){var i=e.startContainer,a=(0,s.lG)(i,"LI");if(a){if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Enter"&&!r.shiftKey&&n&&a.contains(n)&&n.nextElementSibling)return a&&!a.textContent.endsWith(`
|
|
98
|
+
`)&&a.insertAdjacentText("beforeend",`
|
|
99
99
|
`),e.insertNode(document.createTextNode(`
|
|
100
100
|
|
|
101
|
-
`)),e.collapse(!1),
|
|
102
|
-
|
|
103
|
-
`),e.selectNodeContents(o.previousElementSibling),e.collapse(!1),o.remove(),(0,k.ib)(t[t.currentMode].element,e),ee(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Tab"){var u=!1;if((e.startOffset===0&&(a.nodeType===3&&!a.previousSibling||a.nodeType!==3&&a.nodeName==="LI")||o.classList.contains("vditor-task")&&e.startOffset===1&&a.previousSibling.nodeType!==3&&a.previousSibling.tagName==="INPUT")&&(u=!0),u||e.toString()!=="")return r.shiftKey?Ut(t,o,e,o.parentElement):hn(t,o,e),r.preventDefault(),!0}}return!1},Ft=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,k.Hc)(t),ee(e),n.preventDefault(),!0},gn=function(e,t,n,r){if(n){if(!(0,l.yl)(e)&&!e.altKey&&e.key==="Enter"){var i=String.raw(_n||(_n=sr(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),a=i.split("|");if(i.startsWith("|")&&i.endsWith("|")&&a.length>3){var o=a.map(function(){return"---"}).join("|");return o=n.textContent+`
|
|
101
|
+
`)),e.collapse(!1),Q(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Enter"&&e.collapsed&&!a.nextElementSibling&&a.parentElement.parentElement.tagName==="LI"&&Er(a)){var o=vn(a);return(0,T.ib)(o,e),Q(t),r.preventDefault(),!0}if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&a.textContent.trim().replace(S.g.ZWSP,"")===""&&e.toString()===""){var o=vn(a);return(0,T.ib)(o,e),Q(t),r.preventDefault(),!0}if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&!a.previousElementSibling&&e.toString()===""&&(0,T.im)(a,t[t.currentMode].element,e).start===0)return a.nextElementSibling?(a.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(a.innerHTML,"</p>")),a.remove()):a.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(a.innerHTML,"</p>"),(0,T.ib)(t[t.currentMode].element,e),Q(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Tab"){var p=!1;if((e.startOffset===0&&(i.nodeType===3&&!i.previousSibling||i.nodeType!==3&&i.nodeName==="LI")||a.classList.contains("vditor-task")&&e.startOffset===1&&i.previousSibling.nodeType!==3&&i.previousSibling.tagName==="INPUT")&&(p=!0),p||e.toString()!=="")return r.shiftKey?Ft(t,a,e,a.parentElement):wn(t,a,e),r.preventDefault(),!0}}return!1},Gt=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,T.Hc)(t),Q(e),n.preventDefault(),!0},Sn=function(e,t,n,r){if(n){if(!(0,l.yl)(e)&&!e.altKey&&e.key==="Enter"){var i=String.raw(Nn||(Nn=br(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),a=i.split("|");if(i.startsWith("|")&&i.endsWith("|")&&a.length>3){var o=a.map(function(){return"---"}).join("|");return o=n.textContent+`
|
|
104
102
|
`+o.substring(3,o.length-3)+`
|
|
105
|
-
|<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(o),(0,
|
|
106
|
-
`);return
|
|
107
|
-
`),"</p>")),n.insertAdjacentHTML("afterend","".concat(
|
|
108
|
-
</p>`)),n.remove(),(0,
|
|
103
|
+
|<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(o),(0,T.ib)(t[t.currentMode].element,r),Q(t),we(t),e.preventDefault(),!0}if(qt(n.innerHTML)&&n.previousElementSibling){var p="",y=n.innerHTML.trimRight().split(`
|
|
104
|
+
`);return y.length>1&&(y.pop(),p='<p data-block="0">'.concat(y.join(`
|
|
105
|
+
`),"</p>")),n.insertAdjacentHTML("afterend","".concat(p,`<hr data-block="0"><p data-block="0"><wbr>
|
|
106
|
+
</p>`)),n.remove(),(0,T.ib)(t[t.currentMode].element,r),Q(t),we(t),e.preventDefault(),!0}if(Kt(n.innerHTML))return t.currentMode==="wysiwyg"?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|
109
107
|
</p>`):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|
110
|
-
</p>`),(0,
|
|
111
|
-
`).length>1&&(0,
|
|
112
|
-
`)||(
|
|
113
|
-
`),
|
|
114
|
-
</p>`,(0,
|
|
115
|
-
`)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,
|
|
108
|
+
</p>`),(0,T.ib)(t[t.currentMode].element,r),Q(t),we(t),e.preventDefault(),!0}if(r.collapsed&&n.previousElementSibling&&e.key==="Backspace"&&!(0,l.yl)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split(`
|
|
109
|
+
`).length>1&&(0,T.im)(n,t[t.currentMode].element,r).start===0){var d=(0,s.DX)(n.previousElementSibling);return d.textContent.endsWith(`
|
|
110
|
+
`)||(d.textContent=d.textContent+`
|
|
111
|
+
`),d.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,T.ib)(t[t.currentMode].element,r),!1}return!1}},Cn=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)r+='<td align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </td>');n.tagName==="TH"?n.parentElement.parentElement.insertAdjacentHTML("afterend","<tbody><tr>".concat(r,"</tr></tbody>")):n.parentElement.insertAdjacentHTML("afterend","<tr>".concat(r,"</tr>")),Q(e)},Ln=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)n.tagName==="TH"?r+='<th align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </th>'):r+='<td align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </td>');if(n.tagName==="TH"){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>".concat(r,"</tr></thead>")),t.insertNode(document.createElement("wbr"));var a=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",a),n.parentElement.parentElement.remove(),(0,T.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));Q(e)},kt=function(e,t,n,r){r===void 0&&(r="afterend");for(var i=0,a=n.previousElementSibling;a;)i++,a=a.previousElementSibling;for(var o=0;o<t.rows.length;o++)o===0?t.rows[o].cells[i].insertAdjacentHTML(r,"<th> </th>"):t.rows[o].cells[i].insertAdjacentHTML(r,"<td> </td>");Q(e)},kn=function(e,t,n){if(n.tagName==="TD"){var r=n.parentElement.parentElement;n.parentElement.previousElementSibling?t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild):t.selectNodeContents(r.previousElementSibling.lastElementChild.lastElementChild),r.childElementCount===1?r.remove():n.parentElement.remove(),t.collapse(!1),(0,T.Hc)(t),Q(e)}},Mn=function(e,t,n,r){for(var i=0,a=r.previousElementSibling;a;)i++,a=a.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var o=0;o<n.rows.length;o++){var p=n.rows[o].cells;if(p.length===1){n.remove(),Qe(e);break}p[i].remove()}(0,T.Hc)(t),Q(e)},Tn=function(e,t,n){var r=n.startContainer,i=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(i){if(!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"){(!i.lastElementChild||i.lastElementChild&&(!i.lastElementChild.isSameNode(i.lastChild)||i.lastElementChild.tagName!=="BR"))&&i.insertAdjacentHTML("beforeend","<br>");var a=document.createElement("br");return n.insertNode(a),n.setStartAfter(a),Q(e),we(e),t.preventDefault(),!0}if(t.key==="Tab"){if(t.shiftKey)return bn(i,n),t.preventDefault(),!0;var o=i.nextElementSibling;return o||(i.parentElement.nextElementSibling?o=i.parentElement.nextElementSibling.firstElementChild:i.parentElement.parentElement.tagName==="THEAD"&&i.parentElement.parentElement.nextElementSibling?o=i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:o=null),o&&(n.selectNodeContents(o),(0,T.Hc)(n)),t.preventDefault(),!0}var p=i.parentElement.parentElement.parentElement;if(t.key==="ArrowUp"){if(t.preventDefault(),i.tagName==="TH")return p.previousElementSibling?(n.selectNodeContents(p.previousElementSibling),n.collapse(!1),(0,T.Hc)(n)):ct(e,"beforebegin"),!0;for(var y=0,d=i.parentElement;y<d.cells.length&&!d.cells[y].isSameNode(i);y++);var C=d.previousElementSibling;return C||(C=d.parentElement.previousElementSibling.firstChild),n.selectNodeContents(C.cells[y]),n.collapse(!1),(0,T.Hc)(n),!0}if(t.key==="ArrowDown"){t.preventDefault();var d=i.parentElement;if(!d.nextElementSibling&&i.tagName==="TD")return p.nextElementSibling?(n.selectNodeContents(p.nextElementSibling),n.collapse(!0),(0,T.Hc)(n)):ct(e,"afterend"),!0;for(var y=0;y<d.cells.length&&!d.cells[y].isSameNode(i);y++);var o=d.nextElementSibling;return o||(o=d.parentElement.nextElementSibling.firstChild),n.selectNodeContents(o.cells[y]),n.collapse(!0),(0,T.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()===""){var R=bn(i,n,!1);return!R&&p&&(p.textContent.trim()===""?(p.outerHTML=`<p data-block="0"><wbr>
|
|
112
|
+
</p>`,(0,T.ib)(e[e.currentMode].element,n)):(n.setStartBefore(p),n.collapse(!0)),Q(e)),t.preventDefault(),!0}if(P("⇧⌘F",t))return Ln(e,n,i),t.preventDefault(),!0;if(P("⌘=",t))return Cn(e,n,i),t.preventDefault(),!0;if(P("⇧⌘G",t))return kt(e,p,i,"beforebegin"),t.preventDefault(),!0;if(P("⇧⌘=",t))return kt(e,p,i),t.preventDefault(),!0;if(P("⌘-",t))return kn(e,n,i),t.preventDefault(),!0;if(P("⇧⌘-",t))return Mn(e,n,p,i),t.preventDefault(),!0;if(P("⇧⌘L",t)){if(e.currentMode==="ir")return Lt(p,"left"),Q(e),t.preventDefault(),!0;var I=e.wysiwyg.popover.querySelector('[data-type="left"]');if(I)return I.click(),t.preventDefault(),!0}if(P("⇧⌘C",t)){if(e.currentMode==="ir")return Lt(p,"center"),Q(e),t.preventDefault(),!0;var I=e.wysiwyg.popover.querySelector('[data-type="center"]');if(I)return I.click(),t.preventDefault(),!0}if(P("⇧⌘R",t)){if(e.currentMode==="ir")return Lt(p,"right"),Q(e),t.preventDefault(),!0;var I=e.wysiwyg.popover.querySelector('[data-type="right"]');if(I)return I.click(),t.preventDefault(),!0}}return!1},_n=function(e,t,n,r){if(n.tagName==="PRE"&&P("⌘A",t))return r.selectNodeContents(n.firstElementChild),t.preventDefault(),!0;if(e.options.tab&&t.key==="Tab"&&!t.shiftKey&&r.toString()==="")return r.insertNode(document.createTextNode(e.options.tab)),r.collapse(!1),Q(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey){var i=(0,T.im)(n,e[e.currentMode].element,r);if((i.start===0||i.start===1&&n.innerText===`
|
|
113
|
+
`)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,T.ib)(e[e.currentMode].element,r),Q(e),t.preventDefault(),!0}return!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"?(n.firstElementChild.textContent.endsWith(`
|
|
116
114
|
`)||n.firstElementChild.insertAdjacentText("beforeend",`
|
|
117
115
|
`),r.extractContents(),r.insertNode(document.createTextNode(`
|
|
118
|
-
`)),r.collapse(!1),(0,
|
|
119
|
-
|
|
116
|
+
`)),r.collapse(!1),(0,T.Hc)(r),(0,l.vU)()||(e.currentMode==="wysiwyg"?St(e,r):qe(e,r)),we(e),t.preventDefault(),!0):!1},An=function(e,t,n,r){var i,a=t.startContainer,o=(0,s.lG)(a,"BLOCKQUOTE");if(o&&t.toString()===""){if(r&&n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&r.parentElement.isSameNode(o)&&(0,s.lG)(o.parentElement,"LI")&&(t.collapsed||!t.cloneContents().firstElementChild)&&r.innerHTML.replace(S.g.ZWSP,"")!==`
|
|
117
|
+
`&&r.innerHTML.replace(S.g.ZWSP,"")!==""){var p=t.cloneRange();p.setEnd(r,r.childNodes.length);var y=document.createElement("p");return y.setAttribute("data-block","0"),y.appendChild(p.extractContents()),r.insertAdjacentElement("afterend",y),t.setStart(y,0),t.collapse(!0),(0,T.Hc)(t),Q(e),n.preventDefault(),!0}if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&(0,T.im)(o,e[e.currentMode].element,t).start===0)return t.insertNode(document.createElement("wbr")),o.outerHTML=o.innerHTML,(0,T.ib)(e[e.currentMode].element,t),Q(e),n.preventDefault(),!0;if(r&&n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&r.parentElement.tagName==="BLOCKQUOTE"){var d=!1;if(r.innerHTML.replace(S.g.ZWSP,"")===`
|
|
118
|
+
`||r.innerHTML.replace(S.g.ZWSP,"")===""?(d=!0,r.remove()):r.innerHTML.endsWith(`
|
|
120
119
|
|
|
121
|
-
`)&&(0,
|
|
122
|
-
</p>`)),(0,
|
|
123
|
-
`,"</p>")),i.nextElementSibling?i.remove():i.parentElement.remove();return(0,
|
|
124
|
-
</p><`).concat(
|
|
125
|
-
data-tight="true"`).concat(
|
|
126
|
-
</p>`),i.parentElement.querySelectorAll("li").length===1?i.parentElement.remove():i.remove();else r.nodeType!==3&&t.startOffset===0&&r.firstChild.tagName==="INPUT"?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'.concat(i.getAttribute("data-marker"),'"><input type="checkbox"> <wbr></li>')),document.querySelector("wbr").after(t.extractContents()));return(0,
|
|
127
|
-
`):
|
|
128
|
-
`),document.execCommand("insertHTML",!1,
|
|
129
|
-
</p>`;
|
|
130
|
-
`).concat(i.toString(),"<wbr>").concat(r):a==="table"?
|
|
131
|
-
`+
|
|
120
|
+
`)&&(0,T.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),d=!0),d)return o.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(S.g.ZWSP,`<wbr>
|
|
121
|
+
</p>`)),(0,T.ib)(e[e.currentMode].element,t),Q(e),n.preventDefault(),!0}var C=(0,s.F9)(a);if(e.currentMode==="wysiwyg"&&C&&P("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),C.outerHTML='<blockquote data-block="0">'.concat(C.outerHTML,"</blockquote>"),(0,T.ib)(e.wysiwyg.element,t),le(e),n.preventDefault(),!0;var _=o.parentElement.tagName==="LI"?o.parentElement:null,R=!o.nextElementSibling&&((i=_?.nextElementSibling)===null||i===void 0?void 0:i.tagName)==="LI"?_:o;if(ut(e,n,t,o,R))return!0;if(n.key==="ArrowUp"&&_&&!o.previousElementSibling)return!1;if(et(e,n,t,o,o))return!0}return!1},xn=function(e,t,n){var r=t.startContainer,i=(0,s.lG)(r,"LI");if(i&&i.classList.contains("vditor-task")){if(P("⇧⌘J",n)){var a=i.firstElementChild;return a.checked?a.removeAttribute("checked"):a.setAttribute("checked","checked"),Q(e),n.preventDefault(),!0}if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&t.toString()===""&&t.startOffset===1&&(r.nodeType===3&&r.previousSibling&&r.previousSibling.tagName==="INPUT"||r.nodeType!==3)){var o=i.previousElementSibling;if(i.querySelector("input").remove(),o){var p=(0,s.DX)(o);p.parentElement.insertAdjacentHTML("beforeend","<wbr>"+i.innerHTML.trim()),i.remove()}else i.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(i.innerHTML.trim()||`
|
|
122
|
+
`,"</p>")),i.nextElementSibling?i.remove():i.parentElement.remove();return(0,T.ib)(e[e.currentMode].element,t),Q(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey){if(i.textContent.trim()==="")if((0,s.fb)(i.parentElement,"vditor-task")){var y=(0,s.O9)(r);y&&Ft(e,i,t,y)}else if(i.nextElementSibling){var d="",C="",_=!1;Array.from(i.parentElement.children).forEach(function(V){i.isSameNode(V)?_=!0:_?d+=V.outerHTML:C+=V.outerHTML});var R=i.parentElement.tagName,I=i.parentElement.tagName==="OL"?"":' data-marker="'.concat(i.parentElement.getAttribute("data-marker"),'"'),O="";C&&(O=i.parentElement.tagName==="UL"?"":' start="1"',C="<".concat(R,' data-tight="true"').concat(I,' data-block="0">').concat(C,"</").concat(R,">")),i.parentElement.outerHTML="".concat(C,`<p data-block="0"><wbr>
|
|
123
|
+
</p><`).concat(R,`
|
|
124
|
+
data-tight="true"`).concat(I,' data-block="0"').concat(O,">").concat(d,"</").concat(R,">")}else i.parentElement.insertAdjacentHTML("afterend",`<p data-block="0"><wbr>
|
|
125
|
+
</p>`),i.parentElement.querySelectorAll("li").length===1?i.parentElement.remove():i.remove();else r.nodeType!==3&&t.startOffset===0&&r.firstChild.tagName==="INPUT"?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'.concat(i.getAttribute("data-marker"),'"><input type="checkbox"> <wbr></li>')),document.querySelector("wbr").after(t.extractContents()));return(0,T.ib)(e[e.currentMode].element,t),Q(e),we(e),n.preventDefault(),!0}}return!1},Dn=function(e,t,n,r){if(t.startContainer.nodeType!==3){var i=t.startContainer.children[t.startOffset];if(i&&i.tagName==="HR")return t.selectNodeContents(i.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var a=r.previousElementSibling;if(a&&(0,T.im)(r,e[e.currentMode].element,t).start===0&&((0,l.vU)()&&a.tagName==="HR"||a.tagName==="TABLE")){if(a.tagName==="TABLE"){var o=a.lastElementChild.lastElementChild.lastElementChild;o.innerHTML=o.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else a.remove();return(0,T.ib)(e[e.currentMode].element,t),Q(e),n.preventDefault(),!0}}return!1},Hn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},On=function(e,t,n){var r,i;if(!(0,l.vU)())return!1;if(e.key==="ArrowUp"&&t&&((r=t.previousElementSibling)===null||r===void 0?void 0:r.tagName)==="TABLE"){var a=t.previousElementSibling;return n.selectNodeContents(a.rows[a.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return e.key==="ArrowDown"&&t&&((i=t.nextElementSibling)===null||i===void 0?void 0:i.tagName)==="TABLE"?(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0):!1},Mt=function(e,t,n){return pn(void 0,void 0,void 0,function(){var r,i,a,o,p,y,d,C,_,R,I,O,V,N,B,N,z;return hn(this,function(Y){switch(Y.label){case 0:return e[e.currentMode].element.getAttribute("contenteditable")!=="true"?[2]:(t.stopPropagation(),t.preventDefault(),"clipboardData"in t?(r=t.clipboardData.getData("text/html"),i=t.clipboardData.getData("text/plain"),a=t.clipboardData.files):(r=t.dataTransfer.getData("text/html"),i=t.dataTransfer.getData("text/plain"),t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items)),o={},p=function(W,ie){if(!ie)return["",Lute.WalkContinue];var ce=W.__internal_object__.Parent;if(ce.Type===33&&ce.LinkType===3)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,W,ie);var Le=W.TokensStr();if(W.__internal_object__.Parent.Type===34&&Le&&Le.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var fe=new XMLHttpRequest;fe.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&fe.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(fe.withCredentials=!0),dn(e,fe),fe.setRequestHeader("Content-Type","application/json; charset=utf-8"),fe.onreadystatechange=function(){if(fe.readyState===XMLHttpRequest.DONE){if(fe.status===200){var Oe=fe.responseText;e.options.upload.linkToImgFormat&&(Oe=e.options.upload.linkToImgFormat(fe.responseText));var ke=JSON.parse(Oe);if(ke.code!==0){e.tip.show(ke.msg);return}var $=ke.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(Xe){Xe.textContent===$&&(Xe.textContent=ke.data.url)});else{var ve=e[e.currentMode].element.querySelector('img[src="'.concat($,'"]'));ve.src=ke.data.url,e.currentMode==="ir"&&(ve.previousElementSibling.previousElementSibling.innerHTML=ke.data.url)}Q(e)}else e.tip.show(fe.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(fe.responseText)}},fe.send(JSON.stringify({url:Le}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'.concat(Lute.EscapeHTMLStr(Le),"</span>"),Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'.concat(Lute.EscapeHTMLStr(Le),"</span>"),Lute.WalkContinue]},(r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<a href="'.concat(i,'">').concat(i,"</a>")||r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<!--StartFragment--><a href="'.concat(i,'">').concat(i,"</a><!--EndFragment-->"))&&(r=""),y=new DOMParser().parseFromString(r,"text/html"),y.body&&(r=y.body.innerHTML),r=Lute.Sanitize(r),e.wysiwyg.getComments(e),d=e[e.currentMode].element.scrollHeight,C=gt(r,i,e.currentMode),_=e.currentMode==="sv"?(0,s.a1)(t.target,"data-type","code-block"):(0,s.lG)(t.target,"CODE"),_?(e.currentMode==="sv"?document.execCommand("insertHTML",!1,i.replace(/&/g,"&").replace(/</g,"<")):(R=(0,T.im)(t.target,e[e.currentMode].element),_.parentElement.tagName!=="PRE"&&(i+=S.g.ZWSP),_.textContent=_.textContent.substring(0,R.start)+i+_.textContent.substring(R.end),(0,T.$j)(R.start+i.length,R.start+i.length,_.parentElement),!((z=_.parentElement)===null||z===void 0)&&z.nextElementSibling.classList.contains("vditor-".concat(e.currentMode,"__preview"))&&(_.parentElement.nextElementSibling.innerHTML=_.outerHTML,Se(_.parentElement.nextElementSibling,e))),[3,10]):[3,1]);case 1:return C?(n.pasteCode(C),[3,10]):[3,2];case 2:return r.trim()===""?[3,5]:(I=document.createElement("div"),I.innerHTML=r,e.options.upload.base64ToLink?[3,4]:[4,Sr(e,I,("clipboardData"in t?t.clipboardData:t.dataTransfer).getData("text/rtf"))]);case 3:Y.sent(),Y.label=4;case 4:return I.querySelectorAll("[style]").forEach(function(W){W.removeAttribute("style")}),I.querySelectorAll(".vditor-copy").forEach(function(W){W.remove()}),e.currentMode==="ir"?(o.HTML2VditorIRDOM={renderLinkDest:p},e.lute.SetJSRenderers({renderers:o}),(0,T.oC)(e.lute.HTML2VditorIRDOM(I.innerHTML),e)):e.currentMode==="wysiwyg"?(o.HTML2VditorDOM={renderLinkDest:p},e.lute.SetJSRenderers({renderers:o}),(0,T.oC)(e.lute.HTML2VditorDOM(I.innerHTML),e)):(o.Md2VditorSVDOM={renderLinkDest:p},e.lute.SetJSRenderers({renderers:o}),Vt(e,e.lute.HTML2Md(I.innerHTML).trimRight())),e.outline.render(e),[3,10];case 5:return a.length>0?e.options.upload.url||e.options.upload.handler?[4,Wt(e,a)]:[3,7]:[3,9];case 6:return Y.sent(),[3,8];case 7:O=new FileReader,"clipboardData"in t?(a=t.clipboardData.files,V=a[0]):t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items,V=a[0].getAsFile()),V&&V.type.startsWith("image")&&(O.readAsDataURL(V),O.onload=function(){var W="";e.currentMode==="wysiwyg"?W+='<img alt="'.concat(V.name,'" src="').concat(O.result.toString(),`">
|
|
126
|
+
`):W+=".concat(O.result.toString(),`)
|
|
127
|
+
`),document.execCommand("insertHTML",!1,W)}),Y.label=8;case 8:return[3,10];case 9:i.trim()!==""&&a.length===0&&(N=(0,T.zh)(e),N.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(N.toString(),"](").concat(i,")")),e.currentMode==="ir"?(o.Md2VditorIRDOM={renderLinkDest:p},e.lute.SetJSRenderers({renderers:o}),(0,T.oC)(Lute.Sanitize(e.lute.Md2VditorIRDOM(i)),e)):e.currentMode==="wysiwyg"?(o.Md2VditorDOM={renderLinkDest:p},e.lute.SetJSRenderers({renderers:o}),(0,T.oC)(Lute.Sanitize(e.lute.Md2VditorDOM(i)),e)):(o.Md2VditorSVDOM={renderLinkDest:p},e.lute.SetJSRenderers({renderers:o}),Vt(e,i)),e.outline.render(e)),Y.label=10;case 10:return e.currentMode!=="sv"&&(B=(0,s.F9)((0,T.zh)(e).startContainer),B&&(N=(0,T.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(W){W.remove()}),N.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?B.outerHTML=e.lute.SpinVditorDOM(B.outerHTML):B.outerHTML=e.lute.SpinVditorIRDOM(B.outerHTML),(0,T.ib)(e[e.currentMode].element,N)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(W){Se(W,e)})),e.wysiwyg.triggerRemoveComment(e),Q(e),e[e.currentMode].element.scrollHeight-d>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&we(e),[2]}})})},Sr=function(e,t,n){return pn(void 0,void 0,void 0,function(){var r,i,a,o,p,y,d,C,_,V,R,I,O,V,B,N;return hn(this,function(z){switch(z.label){case 0:if(!n)return[2];if(r=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+r.source+"))([\\da-fA-F\\s]+)\\}","g"),a=n.match(i),o=[],a)for(p=0,y=a;p<y.length;p++)d=y[p],C=void 0,d.includes("\\pngblip")?C="image/png":d.includes("\\jpegblip")&&(C="image/jpeg"),C&&o.push({hex:d.replace(r,"").replace(/[^\da-fA-F]/g,""),type:C});for(_=[],zt(t,function(Y){if(Y.tagName==="V:SHAPE")return zt(Y,function(W){W.tagName==="V:IMAGEDATA"&&_.push({shape:Y,img:W})}),!1}),V=0;V<_.length;V++)R=document.createElement("img"),I="data:"+o[V].type+";base64,"+btoa((o[V].hex.match(/\w{2}/g)||[]).map(function(Y){return String.fromCharCode(parseInt(Y,16))}).join("")),R.src=I,R.title=_[V].img.getAttribute("title"),_[V].shape.parentNode.replaceChild(R,_[V].shape);O=t.querySelectorAll("img"),V=0,z.label=1;case 1:return V<O.length?(B=O[V].src||"",B?(N=O[V],[4,e.options.upload.base64ToLink(B)]):[3,3]):[3,4];case 2:N.src=z.sent(),z.label=3;case 3:return V++,[3,1];case 4:return[2]}})})},zt=function(e,t){var n=t(e);if(n!==!1)for(var r=0;r<e.children.length;r++)zt(e.children[r],t)},Nn,Rn=function(e){var t,n;e.hint.render(e);var r=(0,T.zh)(e).startContainer,i=(0,s.a1)(r,"data-type","code-block-info");if(i)if(i.textContent.replace(S.g.ZWSP,"")===""&&e.hint.recentLanguage){i.textContent=S.g.ZWSP+e.hint.recentLanguage;var a=(0,T.zh)(e);a.selectNodeContents(i)}else{var o=[],p=i.textContent.substring(0,(0,T.im)(i,e.ir.element).start).replace(S.g.ZWSP,"");(e.options.preview.hljs.langs||S.g.ALIAS_CODE_LANGUAGES.concat(((n=(t=window.hljs)===null||t===void 0?void 0:t.listLanguages())!==null&&n!==void 0?n:[]).sort())).forEach(function(y){y.indexOf(p.toLowerCase())>-1&&o.push({html:y,value:y})}),e.hint.genHTML(o,p,e)}},We=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),(0,m.W)(e.ir.element,"ir",e.options.preview.markdown.imageCaption),t.enableHint&&Rn(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.composingLock){var n=H(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)},ft=function(e,t){var n=(0,T.zh)(e),r=(0,s.F9)(n.startContainer)||n.startContainer;if(r){var i=r.querySelector(".vditor-ir__marker--heading");i?i.innerHTML=t:(r.insertAdjacentText("afterbegin",t),n.selectNodeContents(r),n.collapse(!1)),qe(e,n.cloneRange()),at(e)}},Tt=function(e,t,n){var r=(0,s.a1)(e.startContainer,"data-type",n);if(r){var i=!e.collapsed;if(r.firstElementChild.remove(),r.lastElementChild.remove(),i){var a=e.cloneRange();a.collapse(!1),a.insertNode(document.createElement("wbr"))}e.insertNode(document.createElement("wbr"));var o=document.createElement("div");if(o.innerHTML=t.lute.SpinVditorIRDOM(r.outerHTML),r.outerHTML=o.firstElementChild.innerHTML.trim(),i){(0,T.ib)(t.ir.element,e);var p=t.ir.element.querySelector("wbr");e.setEndBefore(p),p.remove(),(0,T.Hc)(e)}}},Cr=function(e,t,n,r){var i=(0,T.zh)(e),a=t.getAttribute("data-type"),o=i.startContainer;o.nodeType===3&&(o=o.parentElement);var p=!0;if(t.classList.contains("vditor-menu--current"))if(a==="quote"){var y=(0,s.lG)(o,"BLOCKQUOTE");y&&(i.insertNode(document.createElement("wbr")),y.outerHTML=y.innerHTML.trim()===""?'<p data-block="0">'.concat(y.innerHTML,"</p>"):y.innerHTML)}else if(a==="link"){var d=(0,s.a1)(i.startContainer,"data-type","a");if(d){var C=(0,s.fb)(i.startContainer,"vditor-ir__link");C?(i.insertNode(document.createElement("wbr")),d.outerHTML=C.innerHTML):d.outerHTML=d.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else a==="italic"?Tt(i,e,"em"):a==="bold"?Tt(i,e,"strong"):a==="strike"?Tt(i,e,"s"):a==="inline-code"?Tt(i,e,"code"):(a==="check"||a==="list"||a==="ordered-list")&&(Ct(e,i,a),p=!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,T.ib)(e.ir.element,i));var _=(0,s.F9)(i.startContainer);if(a==="line"){if(_){var R=`<hr data-block="0"><p data-block="0"><wbr>
|
|
128
|
+
</p>`;_.innerHTML.trim()===""?_.outerHTML=R:_.insertAdjacentHTML("afterend",R)}}else if(a==="quote")_&&(i.insertNode(document.createElement("wbr")),_.outerHTML='<blockquote data-block="0">'.concat(_.outerHTML,"</blockquote>"),p=!1,t.classList.add("vditor-menu--current"));else if(a==="link"){var I=void 0;i.toString()===""?I="".concat(n,"<wbr>").concat(r):I="".concat(n).concat(i.toString()).concat(r.replace(")","<wbr>)")),document.execCommand("insertHTML",!1,I),p=!1,t.classList.add("vditor-menu--current")}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"){var I=void 0,O=!1;i.toString()===""?I="".concat(n,"<wbr>").concat(r):(a==="code"?I="".concat(n,`
|
|
129
|
+
`).concat(i.toString(),"<wbr>").concat(r):a==="table"?I="".concat(n).concat(i.toString(),"<wbr>").concat(r):(I="".concat(n,"<wbr>").concat(i.toString(),"<wbr>").concat(r),O=!0),i.deleteContents()),(a==="table"||a==="code")&&(I=`
|
|
130
|
+
`+I+`
|
|
132
131
|
|
|
133
|
-
`);var
|
|
134
|
-
`).concat(
|
|
135
|
-
contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),
|
|
136
|
-
`)){t.ir.element.innerHTML="";return}var i=(0,
|
|
137
|
-
`&&i.startOffset===1&&(i.startContainer.textContent="",
|
|
138
|
-
<div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,Dn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Dn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=E.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var o=getSelection().getRangeAt(0);t[t.currentMode].element.contains(o.startContainer)&&(0,k.Hc)(o)}Re(t)},e})(),br=Y(280),wr=(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(h){if(h.target.tagName!=="TEXTAREA"){var f=document.createElement("div");f.className="vditor-reset",f.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,f,"default"),h.preventDefault()}}),this.previewElement.addEventListener("click",function(h){var f=(0,s.lG)(h.target,"SPAN");if(f&&(0,s.fb)(f,"vditor-toc")){var S=n.previewElement.querySelector("#"+f.getAttribute("data-target-id"));S&&(n.element.scrollTop=S.offsetTop);return}if(h.target.tagName==="A"){t.options.link.click?t.options.link.click(h.target):t.options.link.isOpen&&window.open(h.target.getAttribute("href")),h.preventDefault();return}h.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(h.target):t.options.image.isPreview&&(0,K.E)(h.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],o=0;o<r.length;o++){var u=r[o];if(typeof u=="object"){a.push('<button type="button" data-type="'.concat(u.key,'" class="').concat(u.className,'"').concat(u.tooltip?' aria-label="'.concat(u.tooltip,'"'):"",'">').concat(u.text,"</button>"));continue}switch(u){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":a.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>');break}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(h){var f=(0,C.S)(h.target,"BUTTON");if(f){var S=f.getAttribute("data-type"),T=r.find(function(N){return N?.key===S});if(T){T.click(S);return}if(S==="mp-wechat"||S==="zhihu"){n.copyToX(t,n.previewElement.cloneNode(!0),S);return}S==="desktop"?n.previewElement.style.width="auto":S==="tablet"?n.previewElement.style.width="780px":n.previewElement.style.width="360px",n.previewElement.scrollWidth>n.previewElement.parentElement.clientWidth&&(n.previewElement.style.width="auto"),n.render(t),i.querySelectorAll("button").forEach(function(N){N.classList.remove("vditor-preview__action--current")}),f.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n;return}if(D(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=D(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var o=new XMLHttpRequest;o.open("POST",t.options.preview.url),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(o.status===200){var h=JSON.parse(o.responseText);if(h.code!==0){t.tip.show(h.msg);return}t.options.preview.transform&&(h.data=t.options.preview.transform(h.data)),r.previewElement.innerHTML=h.data,r.afterRender(t,i)}else{var f=t.lute.Md2HTML(a);t.options.preview.transform&&(f=t.options.preview.transform(f)),r.previewElement.innerHTML=f,r.afterRender(t,i)}},o.send(JSON.stringify({markdownText:a}))}else{var u=t.lute.Md2HTML(a);t.options.preview.transform&&(u=t.options.preview.transform(u)),r.previewElement.innerHTML=u,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.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 i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,P.O)(t.preview.previewElement,t.options.preview.hljs),(0,Q.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,oe.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ge.K)(t.preview.previewElement,t.options.cdn),(0,Ee.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,F.P)(t.preview.previewElement,t.options.cdn),(0,z.v)(t.preview.previewElement,t.options.cdn),(0,L.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,le.B)(t.preview.previewElement,t.options.cdn),(0,x.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,br.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(u){u.render(t.preview.previewElement,t)});var a=t.preview.element,o=t.outline.render(t);o===""&&(o="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(u){u.innerHTML=o,(0,ne.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ne.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,k.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e})(),vr=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--".concat(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(r){var i=document,a=r.clientY,o=t.element.offsetHeight,u=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(h){t.options.resize.position==="top"?t.element.style.height=Math.max(u,o+(a-h.clientY))+"px":t.element.style.height=Math.max(u,o+(h.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),i.onmousemove=null,i.onmouseup=null,i.ondragstart=null,i.onselectstart=null,i.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e})(),Er=(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),Dt(t,this.element),Ht(t,this.element),It(t,this.element),Pt(t,this.element),Ot(t,this.element),Nt(t,this.element,this.copy),Rt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",st(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Ct(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var r=n.element.scrollTop,i=n.element.clientHeight,a=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),o=t.preview.element;r/i>.5?o.scrollTop=(r+i)*o.scrollHeight/a-i:o.scrollTop=r*o.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||ie(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Ce(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}ie(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.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===`
|
|
139
|
-
`)){t.sv.element.innerHTML="";return}r.key==="Enter"&&
|
|
140
|
-
<div class="vditor-tip__close">X</div></div>`),this.element.querySelector(".vditor-tip__close").addEventListener("click",function(){r.hide()})):(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,"</div>"),setTimeout(function(){r.hide()},n)),this.element.removeAttribute("style"),setTimeout(function(){var i=r.element.getBoundingClientRect();i.top<46&&(r.element.style.position="fixed",r.element.style.top="46px")},150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e})(),
|
|
141
|
-
`)?n.length-1:n.length;if(t.options.counter.type==="text"&&t[t.currentMode]){var i=t[t.currentMode].element.cloneNode(!0);i.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(a){a.remove()}),r=i.textContent.length}typeof t.options.counter.max=="number"?(r>t.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML="".concat(r,"/").concat(t.options.counter.max)):this.element.innerHTML="".concat(r),this.element.setAttribute("aria-label",t.options.counter.type),t.options.counter.after&&t.options.counter.after(r,{enable:t.options.counter.enable,max:t.options.counter.max,type:t.options.counter.type})},e})(),
|
|
142
|
-
data-value=":`).concat(
|
|
143
|
-
data-key="`).concat(
|
|
132
|
+
`);var V=document.createElement("span");if(V.innerHTML=I,i.insertNode(V),qe(e,i),O){var B=e.ir.element.querySelector("wbr");i.setEndBefore(B),B.remove(),(0,T.Hc)(i)}a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,T.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(Ct(e,i,a,!1),p=!1,b(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,T.ib)(e.ir.element,i),We(e),p&&at(e)},Lr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function p(C){try{d(r.next(C))}catch(_){o(_)}}function y(C){try{d(r.throw(C))}catch(_){o(_)}}function d(C){C.done?a(C.value):i(C.value).then(p,y)}d((r=r.apply(e,t||[])).next())})},kr=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function p(d){return function(C){return y([d,C])}}function y(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(a=d[0]&2?i.return:d[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,d[1])).done)return a;switch(i=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){n.label=d[1];break}if(d[0]===6&&n.label<a[1]){n.label=a[1],a=d;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(d);break}a[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(C){d=[6,C],i=0}finally{r=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},Mr=(function(){function e(t){var n=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(r,i){n.element.style.display="none";var a=decodeURIComponent(r.getAttribute("data-value")),o=window.getSelection().getRangeAt(0);if(i.currentMode==="ir"){var p=(0,s.a1)(o.startContainer,"data-type","code-block-info");if(p){p.textContent=S.g.ZWSP+a.trimRight(),o.selectNodeContents(p),o.collapse(!1),We(i),p.parentElement.querySelectorAll("code").forEach(function(_){_.className="language-"+a.trimRight()}),Se(p.parentElement.querySelector(".vditor-ir__preview"),i),n.recentLanguage=a.trimRight();return}}if(i.currentMode==="wysiwyg"&&o.startContainer.nodeType!==3){var y=o.startContainer,d=void 0;if(y.classList.contains("vditor-input")?d=y:d=y.firstElementChild,d&&d.classList.contains("vditor-input")){d.value=a.trimRight(),o.selectNodeContents(d),o.collapse(!1),d.dispatchEvent(new CustomEvent("input",{detail:1})),n.recentLanguage=a.trimRight();return}}if(o.setStart(o.startContainer,n.lastIndex),o.deleteContents(),i.options.hint.parse?i.currentMode==="sv"?(0,T.oC)(i.lute.SpinVditorSVDOM(a),i):i.currentMode==="wysiwyg"?(0,T.oC)(i.lute.SpinVditorDOM(a),i):(0,T.oC)(i.lute.SpinVditorIRDOM(a),i):(0,T.oC)(a,i),n.splitChar===":"&&a.indexOf(":")>-1&&i.currentMode!=="sv"&&o.insertNode(document.createTextNode(" ")),o.collapse(!1),(0,T.Hc)(o),i.currentMode==="wysiwyg"){var C=(0,s.fb)(o.startContainer,"vditor-wysiwyg__block");C&&C.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(C.lastElementChild.innerHTML=C.firstElementChild.innerHTML,Se(C.lastElementChild,i))}else if(i.currentMode==="ir"){var C=(0,s.fb)(o.startContainer,"vditor-ir__marker--pre");C&&C.nextElementSibling.classList.contains("vditor-ir__preview")&&(C.nextElementSibling.innerHTML=C.innerHTML,Se(C.nextElementSibling,i))}Q(i)},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 r,i=getSelection().getRangeAt(0);r=i.startContainer.textContent.substring(0,i.startOffset)||"";var a=this.getKey(r,t.options.hint.extend);if(typeof a>"u")this.element.style.display="none",clearTimeout(this.timeId);else if(this.splitChar===":"){var o=a===""?t.options.hint.emoji:t.lute.GetEmojis(),p=[];Object.keys(o).forEach(function(y){y.indexOf(a.toLowerCase())===0&&(o[y].indexOf(".")>-1?p.push({html:'<img src="'.concat(o[y],'" title=":').concat(y,':"/> :').concat(y,":"),value:":".concat(y,":")}):p.push({html:'<span class="vditor-hint__emoji">'.concat(o[y],"</span>").concat(y),value:o[y]}))}),this.genHTML(p,a,t)}else t.options.hint.extend.forEach(function(y){y.key===n.splitChar&&(clearTimeout(n.timeId),n.timeId=window.setTimeout(function(){return Lr(n,void 0,void 0,function(){var d;return kr(this,function(C){switch(C.label){case 0:return d=this.genHTML,[4,y.hint(a)];case 1:return d.apply(this,[C.sent(),a,t]),[2]}})})},t.options.hint.delay))})}},e.prototype.genHTML=function(t,n,r){var i=this;if(t.length===0){this.element.style.display="none";return}var a=r[r.currentMode].element,o=(0,T.Ny)(a),p=o.left+(r.options.outline.position==="left"?r.outline.element.offsetWidth:0),y=o.top,d="";t.forEach(function(_,R){if(!(R>7)){var I=_.html;if(n!==""){var O=I.lastIndexOf(">")+1,V=I.substr(O),B=V.toLowerCase().indexOf(n.toLowerCase());B>-1&&(V=V.substring(0,B)+"<b>"+V.substring(B,B+n.length)+"</b>"+V.substring(B+n.length),I=I.substr(0,O)+V)}d+='<button type="button" data-value="'.concat(encodeURIComponent(_.value),` "
|
|
133
|
+
`).concat(R===0?"class='vditor-hint--current'":"","> ").concat(I,"</button>")}}),this.element.innerHTML=d;var C=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(y+(C||22),"px"),this.element.style.left="".concat(p,"px"),this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(_){_.addEventListener("click",function(R){i.fillEmoji(_,r),R.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top="".concat(y-this.element.offsetHeight,"px")),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")},e.prototype.select=function(t,n){if(this.element.querySelectorAll("button").length===0||this.element.style.display==="none")return!1;var r=this.element.querySelector(".vditor-hint--current");if(t.key==="ArrowDown")return t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.nextElementSibling?r.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.previousElementSibling)r.previousElementSibling.className="vditor-hint--current";else{var i=this.element.children.length;this.element.children[i-1].className="vditor-hint--current"}return!0}else if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"&&!t.isComposing)return t.preventDefault(),t.stopPropagation(),this.fillEmoji(r,n),!0;return!1},e.prototype.getKey=function(t,n){var r=this;this.lastIndex=-1,this.splitChar="",n.forEach(function(d){var C=t.lastIndexOf(d.key);r.lastIndex<C&&(r.splitChar=d.key,r.lastIndex=C)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),o=a[a.length-1],p=32;if(a.length>1&&o.trim()===o)if(a.length===2&&a[0]===""&&a[1].length<p)i=a[1];else{var y=a[a.length-2].slice(-1);(0,k.X)(y)===" "&&o.length<p&&(i=o)}return i},e})(),In=function(e){return Array.from(e.children).find(function(t){return t.getAttribute("data-type")==="heading-marker"})},Pn=function(e,t){if(!(!e||!t||e.tagName!==t.tagName||e.getAttribute("data-marker")!==t.getAttribute("data-marker")||t.textContent.trim()===""||In(t))){var n=In(e);n&&(e.firstElementChild===n?t.insertBefore(n.cloneNode(!0),t.firstChild):e.lastElementChild===n&&t.appendChild(n.cloneNode(!0)))}},Tr=(function(){function e(t){this.composingLock=!1;var n=document.createElement("div");n.className="vditor-ir",n.innerHTML='<pre class="vditor-reset" placeholder="'.concat(t.options.placeholder,`"
|
|
134
|
+
contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),Nt(t,this.element),ln(t,this.element),Rt(t,this.element),Bt(t,this.element),Ut(t,this.element),It(t,this.element),Pt(t,this.element,this.copy),jt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){var r=getSelection().getRangeAt(0);if(r.toString()!==""){t.stopPropagation(),t.preventDefault();var i=document.createElement("div");i.appendChild(r.cloneContents());var a=i.querySelectorAll("h1, h2, h3, h4, h5, h6");Pn((0,M.W)(r.startContainer),a.item(0)),Pn((0,M.W)(r.endContainer),a.item(a.length-1)),t.clipboardData.setData("text/plain",n.lute.VditorIRDOM2Md(i.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Mt(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){c(t,["hint"])}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||qe(t,getSelection().getRangeAt(0).cloneRange()),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")){if(n.preventInput){n.preventInput=!1,We(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||qe(t,getSelection().getRangeAt(0).cloneRange(),!1,r)}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){r.target.checked?r.target.setAttribute("checked","checked"):r.target.removeAttribute("checked"),n.preventInput=!0,We(t);return}var i=(0,T.zh)(t),a=(0,s.fb)(r.target,"vditor-ir__preview");if(a||(a=(0,s.fb)(i.startContainer,"vditor-ir__preview")),a&&(a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!0),(0,T.Hc)(i),we(t)),r.target.tagName==="IMG"){var o=r.target.parentElement.querySelector(".vditor-ir__marker--link");o&&(i.selectNode(o),(0,T.Hc)(i))}var p=(0,s.a1)(r.target,"data-type","a");if(p&&!p.classList.contains("vditor-ir__node--expand")){t.options.link.click?t.options.link.click(p.querySelector(":scope > .vditor-ir__marker--link")):t.options.link.isOpen&&window.open(p.querySelector(":scope > .vditor-ir__marker--link").textContent);return}if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&i.collapsed){var y=n.element.lastElementChild.getBoundingClientRect();r.y>y.top+y.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(S.g.ZWSP,"")===""?(i.selectNodeContents(n.element.lastElementChild),i.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(S.g.ZWSP,"<wbr></p>")),(0,T.ib)(n.element,i)))}i.toString()===""?U(i,t):setTimeout(function(){U((0,T.zh)(t),t)}),yt(r,t),at(t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if(r.key==="Enter"&&we(t),at(t),(r.key==="Backspace"||r.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===`
|
|
135
|
+
`)){t.ir.element.innerHTML="";return}var i=(0,T.zh)(t);r.key==="Backspace"?((0,l.vU)()&&i.startContainer.textContent===`
|
|
136
|
+
`&&i.startOffset===1&&(i.startContainer.textContent="",U(i,t)),n.element.querySelectorAll(".language-math").forEach(function(o){var p=o.querySelector("br");p&&p.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&Rn(t),U(i,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&U(i,t);var a=(0,s.fb)(i.startContainer,"vditor-ir__preview");if(a){if(r.key==="ArrowUp"||r.key==="ArrowLeft")return a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!1),r.preventDefault(),!0;if(a.tagName==="SPAN"&&(r.key==="ArrowDown"||r.key==="ArrowRight"))return a.parentElement.getAttribute("data-type")==="html-entity"?(a.parentElement.insertAdjacentText("afterend",S.g.ZWSP),i.setStart(a.parentElement.nextSibling,1)):i.selectNodeContents(a.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}})},e})(),jn=function(e){var t="";return e.currentMode==="sv"?t=e.lute.Md2HTML(H(e)):e.currentMode==="wysiwyg"?t=e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML):e.currentMode==="ir"&&(t=e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML)),(0,m.V)(t,e.options.preview.markdown.imageCaption)},_r=X(214),Bn=X(436),Ar=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-outline",this.element.innerHTML='<div class="vditor-outline__title">'.concat(t,`</div>
|
|
137
|
+
<div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,Bn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Bn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=S.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var o=getSelection().getRangeAt(0);t[t.currentMode].element.contains(o.startContainer)&&(0,T.Hc)(o)}Re(t)},e})(),xr=X(280),Dr=(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(y){if(y.target.tagName!=="TEXTAREA"){var d=document.createElement("div");d.className="vditor-reset",d.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,d,"default"),y.preventDefault()}}),this.previewElement.addEventListener("click",function(y){var d=(0,s.lG)(y.target,"SPAN");if(d&&(0,s.fb)(d,"vditor-toc")){var C=n.previewElement.querySelector("#"+d.getAttribute("data-target-id"));C&&(n.element.scrollTop=C.offsetTop);return}if(y.target.tagName==="A"){t.options.link.click?t.options.link.click(y.target):t.options.link.isOpen&&window.open(y.target.getAttribute("href")),y.preventDefault();return}y.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(y.target):t.options.image.isPreview&&(0,G.E)(y.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],o=0;o<r.length;o++){var p=r[o];if(typeof p=="object"){a.push('<button type="button" data-type="'.concat(p.key,'" class="').concat(p.className,'"').concat(p.tooltip?' aria-label="'.concat(p.tooltip,'"'):"",'">').concat(p.text,"</button>"));continue}switch(p){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":a.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>');break}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(y){var d=(0,M.S)(y.target,"BUTTON");if(d){var C=d.getAttribute("data-type"),_=r.find(function(R){return R?.key===C});if(_){_.click(C);return}if(C==="mp-wechat"||C==="zhihu"){n.copyToX(t,n.previewElement.cloneNode(!0),C);return}C==="desktop"?n.previewElement.style.width="auto":C==="tablet"?n.previewElement.style.width="780px":n.previewElement.style.width="360px",n.previewElement.scrollWidth>n.previewElement.parentElement.clientWidth&&(n.previewElement.style.width="auto"),n.render(t),i.querySelectorAll("button").forEach(function(R){R.classList.remove("vditor-preview__action--current")}),d.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n,(0,m.W)(this.previewElement,"preview",t.options.preview.markdown.imageCaption);return}if(H(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=H(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var o=new XMLHttpRequest;o.open("POST",t.options.preview.url),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(o.status===200){var y=JSON.parse(o.responseText);if(y.code!==0){t.tip.show(y.msg);return}t.options.preview.transform&&(y.data=t.options.preview.transform(y.data)),r.previewElement.innerHTML=y.data,r.afterRender(t,i)}else{var d=t.lute.Md2HTML(a);t.options.preview.transform&&(d=t.options.preview.transform(d)),r.previewElement.innerHTML=d,r.afterRender(t,i)}},o.send(JSON.stringify({markdownText:a}))}else{var p=t.lute.Md2HTML(a);t.options.preview.transform&&(p=t.options.preview.transform(p)),r.previewElement.innerHTML=p,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){(0,m.W)(this.previewElement,"preview",t.options.preview.markdown.imageCaption),t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.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 i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,j.O)(t.preview.previewElement,t.options.preview.hljs),(0,oe.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,ge.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.K)(t.preview.previewElement,t.options.cdn),(0,Ae.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,q.P)(t.preview.previewElement,t.options.cdn),(0,ee.v)(t.preview.previewElement,t.options.cdn),(0,mt.F)(t.preview.previewElement,t.options.cdn),(0,D.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,se.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ye.B)(t.preview.previewElement,t.options.cdn),(0,L.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,xr.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(p){p.render(t.preview.previewElement,t)});var a=t.preview.element,o=t.outline.render(t);o===""&&(o="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(p){p.innerHTML=o,(0,ne.H)(p,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ne.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,T.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e})(),Hr=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--".concat(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(r){var i=document,a=r.clientY,o=t.element.offsetHeight,p=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(y){t.options.resize.position==="top"?t.element.style.height=Math.max(p,o+(a-y.clientY))+"px":t.element.style.height=Math.max(p,o+(y.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),i.onmousemove=null,i.onmouseup=null,i.ondragstart=null,i.onselectstart=null,i.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e})(),Or=(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),Nt(t,this.element),Rt(t,this.element),Bt(t,this.element),Ut(t,this.element),It(t,this.element),Pt(t,this.element,this.copy),jt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",lt(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Mt(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var r=n.element.scrollTop,i=n.element.clientHeight,a=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),o=t.preview.element;r/i>.5?o.scrollTop=(r+i)*o.scrollHeight/a-i:o.scrollTop=r*o.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||ae(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Ce(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}ae(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.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===`
|
|
138
|
+
`)){t.sv.element.innerHTML="";return}r.key==="Enter"&&we(t)}})},e})(),Un=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(t,n){var r=this;n===void 0&&(n=6e3),this.element.className="vditor-tip vditor-tip--show",n===0?(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,`
|
|
139
|
+
<div class="vditor-tip__close">X</div></div>`),this.element.querySelector(".vditor-tip__close").addEventListener("click",function(){r.hide()})):(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,"</div>"),setTimeout(function(){r.hide()},n)),this.element.removeAttribute("style"),setTimeout(function(){var i=r.element.getBoundingClientRect();i.top<46&&(r.element.style.position="fixed",r.element.style.top="46px")},150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e})(),Zt=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),g(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",b(t.toolbar.elements,["both"]);break}t.devtools&&t.devtools.renderEchart(t)}},Nr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Rr=(function(e){Nr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.preview.mode==="both"&&i.element.children[0].classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){var o=i.element.firstElementChild;o.classList.contains(S.g.CLASS_MENU_DISABLED)||(a.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Zt("editor",n):Zt("both",n)))}),i}return t})(me),Ir=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"}return e})(),Vn=X(580),Pr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),jr=(function(e){Pr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var p="";return S.g.CODE_THEME.forEach(function(y){p+="<button>".concat(y,"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(p,"</div>"),o.addEventListener((0,l.Le)(),function(y){y.target.tagName==="BUTTON"&&(c(n,["subToolbar"]),n.options.preview.hljs.style=y.target.textContent,(0,Vn.Y)(y.target.textContent,n.options.cdn),y.preventDefault(),y.stopPropagation())}),i.element.appendChild(o),f(n,o,a,r.level),i}return t})(me),Br=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ur=(function(e){Br(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var p="";return Object.keys(n.options.preview.theme.list).forEach(function(y){p+='<button data-type="'.concat(y,'">').concat(n.options.preview.theme.list[y],"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(p,"</div>"),o.addEventListener((0,l.Le)(),function(y){y.target.tagName==="BUTTON"&&(c(n,["subToolbar"]),n.options.preview.theme.current=y.target.getAttribute("data-type"),(0,J.Z)(n.options.preview.theme.current,n.options.preview.theme.path),y.preventDefault(),y.stopPropagation())}),i.element.appendChild(o),f(n,o,a,r.level),i}return t})(me),Vr=(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 r=n.endsWith(`
|
|
140
|
+
`)?n.length-1:n.length;if(t.options.counter.type==="text"&&t[t.currentMode]){var i=t[t.currentMode].element.cloneNode(!0);i.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(a){a.remove()}),r=i.textContent.length}typeof t.options.counter.max=="number"?(r>t.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML="".concat(r,"/").concat(t.options.counter.max)):this.element.innerHTML="".concat(r),this.element.setAttribute("aria-label",t.options.counter.type),t.options.counter.after&&t.options.counter.after(r,{enable:t.options.counter.enable,max:t.options.counter.max,type:t.options.counter.type})},e})(),Wr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Fr=(function(e){Wr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].innerHTML=r.icon,i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!a.currentTarget.classList.contains(S.g.CLASS_MENU_DISABLED)&&r.click(a,n)}),i}return t})(me),qr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Kr=(function(e){qr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.firstElementChild.addEventListener((0,l.Le)(),function(a){var o=i.element.firstElementChild;o.classList.contains(S.g.CLASS_MENU_DISABLED)||(a.preventDefault(),o.classList.contains("vditor-menu--current")?(o.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",Re(n)):(o.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",Re(n),n.devtools.renderEchart(n)))}),i}return t})(me),Gr=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"}return e})(),zr=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Zr=(function(e){zr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");a.className="vditor-panel vditor-panel--arrow";var o="";return Object.keys(n.options.hint.emoji).forEach(function(p){var y=n.options.hint.emoji[p];y.indexOf(".")>-1?o+='<button data-value=":'.concat(p,': " data-key=":').concat(p,`:"><img
|
|
141
|
+
data-value=":`).concat(p,': " data-key=":').concat(p,':" class="vditor-emojis__icon" src="').concat(y,'"/></button>'):o+='<button data-value="'.concat(y,` "
|
|
142
|
+
data-key="`).concat(p,'"><span class="vditor-emojis__icon">').concat(y,"</span></button>")}),a.innerHTML='<div class="vditor-emojis" style="max-height: '.concat(n.options.height==="auto"?"auto":n.options.height-80,'px">').concat(o,`</div><div class="vditor-emojis__tail">
|
|
144
143
|
<span class="vditor-emojis__tip"></span><span>`).concat(n.options.hint.emojiTail||"",`</span>
|
|
145
|
-
</div>`),i.element.appendChild(a),
|
|
144
|
+
</div>`),i.element.appendChild(a),f(n,a,i.element.firstElementChild,r.level),i.bindEvent(n),i}return t.prototype.bindEvent=function(n){var r=this;this.element.lastElementChild.addEventListener((0,l.Le)(),function(i){var a=(0,M.S)(i.target,"BUTTON");if(a){i.preventDefault();var o=a.getAttribute("data-value"),p=(0,T.zh)(n),y=o;if(n.currentMode==="wysiwyg"?y=n.lute.SpinVditorDOM(o):n.currentMode==="ir"&&(y=n.lute.SpinVditorIRDOM(o)),o.indexOf(":")>-1&&n.currentMode!=="sv"){var d=document.createElement("div");d.innerHTML=y,y=d.firstElementChild.firstElementChild.outerHTML+" ",(0,T.oC)(y,n)}else p.extractContents(),p.insertNode(document.createTextNode(o)),(0,s.F9)(p.startContainer)||xt(n,p);p.collapse(!1),(0,T.Hc)(p),r.element.lastElementChild.style.display="none",Q(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(i){var a=(0,M.S)(i.target,"BUTTON");a&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=a.getAttribute("data-key"))})},t})(me),Wn=function(e,t,n){var r=document.createElement("a");"download"in r?(r.download=n,r.style.display="none",r.href=URL.createObjectURL(new Blob([t])),document.body.appendChild(r),r.click(),r.remove()):e.tip.show(window.VditorI18n.downloadTip,0)},Jr=function(e){var t=H(e);Wn(e,t,t.substr(0,10)+".md")},Xr=function(e){e.tip.show(window.VditorI18n.generate,3800);var t=document.querySelector("#vditorExportIframe");t.contentDocument.open(),t.contentDocument.write('<link rel="stylesheet" href="'.concat(e.options.cdn,`/dist/index.css"/>
|
|
146
145
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script>
|
|
147
146
|
<div id="preview" style="width: 800px"></div>
|
|
148
147
|
<script>
|
|
@@ -153,6 +152,7 @@ window.addEventListener("message", (e) => {
|
|
|
153
152
|
Vditor.preview(document.getElementById('preview'), e.data, {
|
|
154
153
|
cdn: "`).concat(e.options.cdn,`",
|
|
155
154
|
markdown: {
|
|
155
|
+
callout: `).concat(JSON.stringify(e.options.preview.markdown.callout),`,
|
|
156
156
|
theme: `).concat(JSON.stringify(e.options.preview.theme),`
|
|
157
157
|
},
|
|
158
158
|
hljs: {
|
|
@@ -163,7 +163,7 @@ window.addEventListener("message", (e) => {
|
|
|
163
163
|
window.print();
|
|
164
164
|
}, 3600);
|
|
165
165
|
}, false);
|
|
166
|
-
<\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(
|
|
166
|
+
<\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(H(e),"*")},200)},Yr=function(e){var t=jn(e),n='<html><head><link rel="stylesheet" type="text/css" href="'.concat(e.options.cdn,`/dist/index.css"/>
|
|
167
167
|
<script src="`).concat(e.options.cdn,"/dist/js/i18n/").concat(e.options.lang,`.js"><\/script>
|
|
168
168
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script></head>
|
|
169
169
|
<body><div class="vditor-reset" id="preview">`).concat(t,`</div>
|
|
@@ -181,20 +181,21 @@ window.addEventListener("message", (e) => {
|
|
|
181
181
|
Vditor.markmapRender(previewElement, '`).concat(e.options.cdn,`');
|
|
182
182
|
Vditor.flowchartRender(previewElement, '`).concat(e.options.cdn,`');
|
|
183
183
|
Vditor.graphvizRender(previewElement, '`).concat(e.options.cdn,`');
|
|
184
|
+
Vditor.wavedromRender(previewElement, '`).concat(e.options.cdn,`');
|
|
184
185
|
Vditor.chartRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
|
|
185
186
|
Vditor.mindmapRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
|
|
186
187
|
Vditor.abcRender(previewElement, '`).concat(e.options.cdn,`');
|
|
187
188
|
`).concat(e.options.preview.render.media.enable?"Vditor.mediaRender(previewElement);":"",`
|
|
188
189
|
Vditor.speechRender(previewElement);
|
|
189
190
|
<\/script>
|
|
190
|
-
<script src="`).concat(e.options.cdn,"/dist/js/icons/").concat(e.options.icon,'.js"><\/script></body></html>');
|
|
191
|
+
<script src="`).concat(e.options.cdn,"/dist/js/icons/").concat(e.options.icon,'.js"><\/script></body></html>');Wn(e,n,t.substr(0,10)+".html")},$r=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Qr=(function(e){$r(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");return o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),o.innerHTML=`<button data-type="markdown">Markdown</button>
|
|
191
192
|
<button data-type="pdf">PDF</button>
|
|
192
|
-
<button data-type="html">HTML</button>`,o.addEventListener((0,l.Le)(),function(
|
|
193
|
+
<button data-type="html">HTML</button>`,o.addEventListener((0,l.Le)(),function(p){var y=p.target;if(y.tagName==="BUTTON"){switch(y.getAttribute("data-type")){case"markdown":Jr(n);break;case"pdf":Xr(n);break;case"html":Yr(n);break}c(n,["subToolbar"]),p.preventDefault(),p.stopPropagation()}}),i.element.appendChild(o),f(n,o,a,r.level),i}return t})(me),ei=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ti=(function(e){ei(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n,r),i}return t.prototype._bindEvent=function(n,r){this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault(),n.element.className.includes("vditor--fullscreen")?(r.level||(this.innerHTML=r.icon),n.element.style.zIndex="",document.body.style.overflow="",n.element.classList.remove("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(a){var o=n.toolbar.elements[a].firstChild;o&&(o.className=o.className.replace("__s","__n"),n.options.toolbar.forEach(function(p){typeof p!="string"&&p.tipPosition&&p.name===o.dataset.type&&(o.className="vditor-tooltipped vditor-tooltipped__".concat(p.tipPosition))}))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__s","__n"))):(r.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(a){var o=n.toolbar.elements[a].firstChild;o&&(o.className=o.className.replace("__n","__s"))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__n","__s"))),n.devtools&&n.devtools.renderEchart(n),r.click&&r.click(i,n),Re(n),wt(n)})},t})(me),ni=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ri=(function(e){ni(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint vditor-panel--arrow",a.innerHTML='<button data-tag="h1" data-value="# ">'.concat(window.VditorI18n.heading1," ").concat((0,l.ns)("<⌥⌘1>"),`</button>
|
|
193
194
|
<button data-tag="h2" data-value="## ">`).concat(window.VditorI18n.heading2," <").concat((0,l.ns)("⌥⌘2"),`></button>
|
|
194
195
|
<button data-tag="h3" data-value="### ">`).concat(window.VditorI18n.heading3," <").concat((0,l.ns)("⌥⌘3"),`></button>
|
|
195
196
|
<button data-tag="h4" data-value="#### ">`).concat(window.VditorI18n.heading4," <").concat((0,l.ns)("⌥⌘4"),`></button>
|
|
196
197
|
<button data-tag="h5" data-value="##### ">`).concat(window.VditorI18n.heading5," <").concat((0,l.ns)("⌥⌘5"),`></button>
|
|
197
|
-
<button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," <").concat((0,l.ns)("⌥⌘6"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a),i}return t.prototype._bindEvent=function(n,r){var i=this.element.children[0];i.addEventListener((0,l.Le)(),function(o){o.preventDefault(),clearTimeout(n.wysiwyg.afterRenderTimeoutId),clearTimeout(n.ir.processTimeoutId),clearTimeout(n.sv.processTimeoutId),!i.classList.contains(
|
|
198
|
+
<button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," <").concat((0,l.ns)("⌥⌘6"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a),i}return t.prototype._bindEvent=function(n,r){var i=this.element.children[0];i.addEventListener((0,l.Le)(),function(o){o.preventDefault(),clearTimeout(n.wysiwyg.afterRenderTimeoutId),clearTimeout(n.ir.processTimeoutId),clearTimeout(n.sv.processTimeoutId),!i.classList.contains(S.g.CLASS_MENU_DISABLED)&&(i.blur(),i.classList.contains("vditor-menu--current")?(n.currentMode==="wysiwyg"?(Ht(n),le(n)):n.currentMode==="ir"&&ft(n,""),i.classList.remove("vditor-menu--current")):(c(n,["subToolbar"]),r.style.display="block"))});for(var a=0;a<6;a++)r.children.item(a).addEventListener((0,l.Le)(),function(o){o.preventDefault(),n.currentMode==="wysiwyg"?(vt(n,o.target.getAttribute("data-tag")),le(n),i.classList.add("vditor-menu--current")):n.currentMode==="ir"?(ft(n,o.target.getAttribute("data-value")),i.classList.add("vditor-menu--current")):un(n,o.target.getAttribute("data-value")),r.style.display="none"})},t})(me),ii=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ai=(function(e){ii(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),n.tip.show(`<div style="margin-bottom:14px;font-size: 14px;line-height: 22px;min-width:300px;max-width: 360px;display: flex;">
|
|
198
199
|
<div style="margin-top: 14px;flex: 1">
|
|
199
200
|
<div>Markdown 使用指南</div>
|
|
200
201
|
<ul style="list-style: none">
|
|
@@ -212,7 +213,7 @@ window.addEventListener("message", (e) => {
|
|
|
212
213
|
<li><a href="https://ld246.com/article/1549638745630" target="_blank">开发手册</a></li>
|
|
213
214
|
<li><a href="https://ld246.com/guide/markdown" target="_blank">演示地址</a></li>
|
|
214
215
|
</ul>
|
|
215
|
-
</div></div>`,0)}),i}return t})(me),
|
|
216
|
+
</div></div>`,0)}),i}return t})(me),oi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),si=(function(e){oi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,T.zh)(n),p=(0,s.lG)(o.startContainer,"LI");p&&wn(n,p,o)}}),i}return t})(me),li=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ci=(function(e){li(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),n.tip.show(`<div style="max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;">
|
|
216
217
|
<p style="text-align: center;margin: 14px 0">
|
|
217
218
|
<em>下一代的 Markdown 编辑器,为未来而构建</em>
|
|
218
219
|
</p>
|
|
@@ -235,28 +236,28 @@ window.addEventListener("message", (e) => {
|
|
|
235
236
|
</ul>
|
|
236
237
|
<ul style="list-style: none;margin-right: 18px">
|
|
237
238
|
<li>
|
|
238
|
-
组件版本:Vditor v`.concat(
|
|
239
|
+
组件版本:Vditor v`.concat(S.H," / Lute v").concat(Lute.Version,`
|
|
239
240
|
</li>
|
|
240
241
|
<li>
|
|
241
242
|
赞助捐赠:<a href="https://ld246.com/sponsor" target="_blank">https://ld246.com/sponsor</a>
|
|
242
243
|
</li>
|
|
243
244
|
</ul>
|
|
244
245
|
</div>
|
|
245
|
-
</div>`),0)}),i}return t})(me),$r=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Qr=(function(e){$r(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&<(n,"afterend")}),i}return t})(me),ei=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ti=(function(e){ei(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&<(n,"beforebegin")}),i}return t})(me),ni=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ri=(function(e){ni(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,k.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&Ut(n,u,o,u.parentElement)}}),i}return t})(me),ii=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ai=(function(e){ii(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var o=n.toolbar.elements.outline.firstElementChild;o.classList.contains(E.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t})(me),oi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),si=(function(e){oi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=E.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.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"),m(n.toolbar.elements,o),n.outline.render(n)):(d(n.toolbar.elements,o),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),a.classList.add("vditor-menu--current"),b(n,["subToolbar","hint","popover"]),setTimeout(function(){n.outline.render(n)},n.options.preview.delay+10)),Re(n)}})},t})(me),li=(function(){function e(t){this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0;var n;if(typeof AudioContext<"u")n=new AudioContext;else if(webkitAudioContext)n=new webkitAudioContext;else return;this.DEFAULT_SAMPLE_RATE=n.sampleRate;var r=n.createGain(),i=n.createMediaStreamSource(t);i.connect(r),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,r.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),r=new Float32Array(t.length),i=0;i<t.length;++i)r[i]=.5*(t[i]+n[i]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(r=this.downSampleBuffer(r,this.SAMPLE_RATE));var a=44+r.length*2,o=new ArrayBuffer(a),u=new DataView(o);this.writeUTFBytes(u,0,"RIFF"),u.setUint32(4,a,!0),this.writeUTFBytes(u,8,"WAVE"),this.writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,this.SAMPLE_RATE,!0),u.setUint32(28,this.SAMPLE_RATE*2,!0),u.setUint16(32,2,!0),u.setUint16(34,16,!0);var h=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,h,!0);for(var f=r.length,S=44,T=1,N=0;N<f;N++)u.setInt16(S,r[N]*(32767*T),!0),S+=2;return new Blob([u],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(t,n){if(n===this.DEFAULT_SAMPLE_RATE||n>this.DEFAULT_SAMPLE_RATE)return t;for(var r=this.DEFAULT_SAMPLE_RATE/n,i=Math.round(t.length/r),a=new Float32Array(i),o=0,u=0;o<a.length;){for(var h=Math.round((o+1)*r),f=0,S=0,T=u;T<h&&T<t.length;T++)f+=t[T],S++;a[o]=f/S,o++,u=h}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var o=t[a];n.set(o,r),r+=o.length}return n},e.prototype.writeUTFBytes=function(t,n,r){for(var i=r.length,a=0;a<i;a++)t.setUint8(n+a,r.charCodeAt(a))},e})(),ci=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ui=(function(e){ci(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(h){i=new li(h),i.recorder.onaudioprocess=function(f){if(i.isRecording){var S=f.inputBuffer.getChannelData(0),T=f.inputBuffer.getChannelData(1);i.cloneChannelData(S,T)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),r.element.children[0].classList.add("vditor-menu--current")}).catch(function(){n.tip.show(window.VditorI18n["record-tip"])});return}if(i.isRecording){i.stopRecording(),n.tip.hide();var u=new File([i.buildWavFileBlob()],"record".concat(new Date().getTime(),".wav"),{type:"video/webm"});Bt(n,[u]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current")}})},t})(me),fi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),di=(function(e){fi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t})(me),pi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),hi=(function(e){pi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t})(me),mi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),gi=(function(e){mi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&Bt(n,i.target.files,i.target)})},t})(me),yi=(function(){function e(t){var n=this,r=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",r.toolbar.forEach(function(i,a){var o=n.genItem(t,i,a);if(n.element.appendChild(o),i.toolbar){var u=document.createElement("div");u.className="vditor-hint vditor-panel--arrow",u.addEventListener((0,l.Le)(),function(h){u.style.display="none"}),i.toolbar.forEach(function(h,f){h.level=2,u.appendChild(n.genItem(t,h,a+f))}),o.appendChild(u),g(t,u,o.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 Ar(t),this.element.appendChild(t.counter.element))}return e.prototype.updateConfig=function(t,n){t.options.toolbarConfig=Object.assign({hide:!1,pin:!1},n),t.options.toolbarConfig.hide?this.element.classList.add("vditor-toolbar--hide"):this.element.classList.remove("vditor-toolbar--hide"),t.options.toolbarConfig.pin?this.element.classList.add("vditor-toolbar--pin"):this.element.classList.remove("vditor-toolbar--pin")},e.prototype.genItem=function(t,n,r){var i;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":i=new me(t,n);break;case"emoji":i=new Ir(t,n);break;case"headings":i=new Kr(t,n);break;case"|":i=new Nr;break;case"br":i=new Lr;break;case"undo":i=new hi(t,n);break;case"redo":i=new di(t,n);break;case"help":i=new Gr(t,n);break;case"both":i=new Cr(t,n);break;case"preview":i=new si(t,n);break;case"fullscreen":i=new Fr(t,n);break;case"upload":i=new gi(t,n);break;case"record":i=new ui(t,n);break;case"info":i=new Yr(t,n);break;case"edit-mode":i=new Qn(t,n);break;case"devtools":i=new Or(t,n);break;case"outdent":i=new ri(t,n);break;case"indent":i=new Jr(t,n);break;case"outline":i=new ai(t,n);break;case"insert-after":i=new Qr(t,n);break;case"insert-before":i=new ti(t,n);break;case"code-theme":i=new kr(t,n);break;case"content-theme":i=new _r(t,n);break;case"export":i=new Vr(t,n);break;default:i=new Dr(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e})(),bi=Y(173),wi=(function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new bi}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?m(t.toolbar.elements,["undo"]):d(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?m(t.toolbar.elements,["redo"]):d(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,b(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 r=this.addCaret(t);r.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]=r,this[t.currentMode].lastText=r)}},e.prototype.addToUndoStack=function(t){var n=this.addCaret(t,!0),r=this.dmp.diff_main(n,this[t.currentMode].lastText,!0),i=this.dmp.patch_make(n,this[t.currentMode].lastText,r);i.length===0&&this[t.currentMode].undoStack.length>0||(this[t.currentMode].lastText=n,this[t.currentMode].undoStack.push(i),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,d(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&m(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(u){u.diffs.forEach(function(h){h[0]=-h[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(u){u.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?u.parentElement.outerHTML=n.lute.SpinVditorIRDOM(u.parentElement.outerHTML):u.parentElement.outerHTML=n.lute.SpinVditorDOM(u.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Se(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,k.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),be(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}Be(n),ee(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),$e(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Se(u,n)}),this[n.currentMode].undoStack.length>1?m(n.toolbar.elements,["undo"]):d(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?m(n.toolbar.elements,["redo"]):d(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){n===void 0&&(n=!1);var r;if(getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var i=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(i.startContainer)){r=i.cloneRange();var a=document.createElement("span");a.className="vditor-wbr",i.insertNode(a)}}var o=t[t.currentMode].element.cloneNode(!0);o.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(h){h.firstElementChild&&(h.firstElementChild.classList.contains("language-echarts")||h.firstElementChild.classList.contains("language-plantuml")||h.firstElementChild.classList.contains("language-mindmap")?(h.firstElementChild.removeAttribute("_echarts_instance_"),h.firstElementChild.removeAttribute("data-processed"),h.firstElementChild.innerHTML=h.previousElementSibling.firstElementChild.innerHTML,h.setAttribute("data-render","2")):h.firstElementChild.classList.contains("language-math")&&(h.setAttribute("data-render","2"),h.firstElementChild.textContent=h.firstElementChild.getAttribute("data-math"),h.firstElementChild.removeAttribute("data-math")))});var u=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(h){h.remove()}),n&&r&&(0,k.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e})(),vi=Y(673),Ei=(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":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(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:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,o,u,h,f;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),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((o=this.options.hint)===null||o===void 0)&&o.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((h=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||h===void 0)&&h.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((f=this.options.hint)===null||f===void 0)&&f.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var S=(0,vi.T)(this.defaultOptions,this.options);if(S.cache.enable&&!S.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return S},e.prototype.mergeToolbar=function(t){var n=this,r=[{icon:'<svg><use xlink:href="#vditor-icon-export"></use></svg>',name:"export",tipPosition:"ne"},{hotkey:"⌘E",icon:'<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',name:"emoji",tipPosition:"ne"},{hotkey:"⌘H",icon:'<svg><use xlink:href="#vditor-icon-headings"></use></svg>',name:"headings",tipPosition:"ne"},{hotkey:"⌘B",icon:'<svg><use xlink:href="#vditor-icon-bold"></use></svg>',name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"⌘I",icon:'<svg><use xlink:href="#vditor-icon-italic"></use></svg>',name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"⌘D",icon:'<svg><use xlink:href="#vditor-icon-strike"></use></svg>',name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{hotkey:"⌘K",icon:'<svg><use xlink:href="#vditor-icon-link"></use></svg>',name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{name:"|"},{hotkey:"⌘L",icon:'<svg><use xlink:href="#vditor-icon-list"></use></svg>',name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"⌘O",icon:'<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"⌘J",icon:'<svg><use xlink:href="#vditor-icon-check"></use></svg>',name:"check",prefix:"* [ ] ",tipPosition:"n"},{hotkey:"⇧⌘I",icon:'<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',name:"outdent",tipPosition:"n"},{hotkey:"⇧⌘O",icon:'<svg><use xlink:href="#vditor-icon-indent"></use></svg>',name:"indent",tipPosition:"n"},{name:"|"},{hotkey:"⌘;",icon:'<svg><use xlink:href="#vditor-icon-quote"></use></svg>',name:"quote",prefix:"> ",tipPosition:"n"},{hotkey:"⇧⌘H",icon:'<svg><use xlink:href="#vditor-icon-line"></use></svg>',name:"line",prefix:"---",tipPosition:"n"},{hotkey:"⌘U",icon:'<svg><use xlink:href="#vditor-icon-code"></use></svg>',name:"code",prefix:"```",suffix:"\n```",tipPosition:"n"},{hotkey:"⌘G",icon:'<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{hotkey:"⇧⌘B",icon:'<svg><use xlink:href="#vditor-icon-before"></use></svg>',name:"insert-before",tipPosition:"n"},{hotkey:"⇧⌘E",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:"⌘M",icon:'<svg><use xlink:href="#vditor-icon-table"></use></svg>',name:"table",prefix:"| col1",suffix:` | col2 | col3 |
|
|
246
|
+
</div>`),0)}),i}return t})(me),ui=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),fi=(function(e){ui(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&ct(n,"afterend")}),i}return t})(me),di=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),pi=(function(e){di(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&ct(n,"beforebegin")}),i}return t})(me),hi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),mi=(function(e){hi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,T.zh)(n),p=(0,s.lG)(o.startContainer,"LI");p&&Ft(n,p,o,p.parentElement)}}),i}return t})(me),gi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),yi=(function(e){gi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var o=n.toolbar.elements.outline.firstElementChild;o.classList.contains(S.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t})(me),bi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),wi=(function(e){bi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(S.g.CLASS_MENU_DISABLED)){var o=S.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.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"),h(n.toolbar.elements,o),n.outline.render(n)):(E(n.toolbar.elements,o),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),a.classList.add("vditor-menu--current"),c(n,["subToolbar","hint","popover"]),setTimeout(function(){n.outline.render(n)},n.options.preview.delay+10)),Re(n)}})},t})(me),vi=(function(){function e(t){this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0;var n;if(typeof AudioContext<"u")n=new AudioContext;else if(webkitAudioContext)n=new webkitAudioContext;else return;this.DEFAULT_SAMPLE_RATE=n.sampleRate;var r=n.createGain(),i=n.createMediaStreamSource(t);i.connect(r),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,r.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),r=new Float32Array(t.length),i=0;i<t.length;++i)r[i]=.5*(t[i]+n[i]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(r=this.downSampleBuffer(r,this.SAMPLE_RATE));var a=44+r.length*2,o=new ArrayBuffer(a),p=new DataView(o);this.writeUTFBytes(p,0,"RIFF"),p.setUint32(4,a,!0),this.writeUTFBytes(p,8,"WAVE"),this.writeUTFBytes(p,12,"fmt "),p.setUint32(16,16,!0),p.setUint16(20,1,!0),p.setUint16(22,1,!0),p.setUint32(24,this.SAMPLE_RATE,!0),p.setUint32(28,this.SAMPLE_RATE*2,!0),p.setUint16(32,2,!0),p.setUint16(34,16,!0);var y=r.length*2;this.writeUTFBytes(p,36,"data"),p.setUint32(40,y,!0);for(var d=r.length,C=44,_=1,R=0;R<d;R++)p.setInt16(C,r[R]*(32767*_),!0),C+=2;return new Blob([p],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(t,n){if(n===this.DEFAULT_SAMPLE_RATE||n>this.DEFAULT_SAMPLE_RATE)return t;for(var r=this.DEFAULT_SAMPLE_RATE/n,i=Math.round(t.length/r),a=new Float32Array(i),o=0,p=0;o<a.length;){for(var y=Math.round((o+1)*r),d=0,C=0,_=p;_<y&&_<t.length;_++)d+=t[_],C++;a[o]=d/C,o++,p=y}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var o=t[a];n.set(o,r),r+=o.length}return n},e.prototype.writeUTFBytes=function(t,n,r){for(var i=r.length,a=0;a<i;a++)t.setUint8(n+a,r.charCodeAt(a))},e})(),Ei=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Si=(function(e){Ei(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(y){i=new vi(y),i.recorder.onaudioprocess=function(d){if(i.isRecording){var C=d.inputBuffer.getChannelData(0),_=d.inputBuffer.getChannelData(1);i.cloneChannelData(C,_)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),r.element.children[0].classList.add("vditor-menu--current")}).catch(function(){n.tip.show(window.VditorI18n["record-tip"])});return}if(i.isRecording){i.stopRecording(),n.tip.hide();var p=new File([i.buildWavFileBlob()],"record".concat(new Date().getTime(),".wav"),{type:"video/webm"});Wt(n,[p]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current")}})},t})(me),Ci=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Li=(function(e){Ci(t,e);function t(n,r){var i=e.call(this,n,r)||this;return E({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t})(me),ki=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Mi=(function(e){ki(t,e);function t(n,r){var i=e.call(this,n,r)||this;return E({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t})(me),Ti=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),_i=(function(e){Ti(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(S.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&Wt(n,i.target.files,i.target)})},t})(me),Ai=(function(){function e(t){var n=this,r=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",r.toolbar.forEach(function(i,a){var o=n.genItem(t,i,a);if(n.element.appendChild(o),i.toolbar){var p=document.createElement("div");p.className="vditor-hint vditor-panel--arrow",p.addEventListener((0,l.Le)(),function(y){p.style.display="none"}),i.toolbar.forEach(function(y,d){y.level=2,p.appendChild(n.genItem(t,y,a+d))}),o.appendChild(p),f(t,p,o.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 Vr(t),this.element.appendChild(t.counter.element))}return e.prototype.updateConfig=function(t,n){t.options.toolbarConfig=Object.assign({hide:!1,pin:!1},n),t.options.toolbarConfig.hide?this.element.classList.add("vditor-toolbar--hide"):this.element.classList.remove("vditor-toolbar--hide"),t.options.toolbarConfig.pin?this.element.classList.add("vditor-toolbar--pin"):this.element.classList.remove("vditor-toolbar--pin")},e.prototype.genItem=function(t,n,r){var i;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":i=new me(t,n);break;case"emoji":i=new Zr(t,n);break;case"headings":i=new ri(t,n);break;case"|":i=new Gr;break;case"br":i=new Ir;break;case"undo":i=new Mi(t,n);break;case"redo":i=new Li(t,n);break;case"help":i=new ai(t,n);break;case"both":i=new Rr(t,n);break;case"preview":i=new wi(t,n);break;case"fullscreen":i=new ti(t,n);break;case"upload":i=new _i(t,n);break;case"record":i=new Si(t,n);break;case"info":i=new ci(t,n);break;case"edit-mode":i=new ur(t,n);break;case"devtools":i=new Kr(t,n);break;case"outdent":i=new mi(t,n);break;case"indent":i=new si(t,n);break;case"outline":i=new yi(t,n);break;case"insert-after":i=new fi(t,n);break;case"insert-before":i=new pi(t,n);break;case"code-theme":i=new jr(t,n);break;case"content-theme":i=new Ur(t,n);break;case"export":i=new Qr(t,n);break;default:i=new Fr(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e})(),xi=X(132),Di=(function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new xi}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?h(t.toolbar.elements,["undo"]):E(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?h(t.toolbar.elements,["redo"]):E(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,c(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 r=this.addCaret(t);r.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]=r,this[t.currentMode].lastText=r)}},e.prototype.addToUndoStack=function(t){var n=this.addCaret(t,!0),r=this.dmp.diff_main(n,this[t.currentMode].lastText,!0),i=this.dmp.patch_make(n,this[t.currentMode].lastText,r);i.length===0&&this[t.currentMode].undoStack.length>0||(this[t.currentMode].lastText=n,this[t.currentMode].undoStack.push(i),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,E(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&h(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(p){p.diffs.forEach(function(y){y[0]=-y[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(p){p.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?p.parentElement.outerHTML=n.lute.SpinVditorIRDOM(p.parentElement.outerHTML):p.parentElement.outerHTML=n.lute.SpinVditorDOM(p.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(p){Se(p,n)})),n[n.currentMode].element.querySelector("wbr"))(0,T.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),we(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}je(n),Q(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),Qe(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(p){Se(p,n)}),this[n.currentMode].undoStack.length>1?h(n.toolbar.elements,["undo"]):E(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?h(n.toolbar.elements,["redo"]):E(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){n===void 0&&(n=!1);var r;if(getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var i=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(i.startContainer)){r=i.cloneRange();var a=document.createElement("span");a.className="vditor-wbr",i.insertNode(a)}}var o=t[t.currentMode].element.cloneNode(!0);o.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(y){y.firstElementChild&&(y.firstElementChild.classList.contains("language-echarts")||y.firstElementChild.classList.contains("language-plantuml")||y.firstElementChild.classList.contains("language-mindmap")?(y.firstElementChild.removeAttribute("_echarts_instance_"),y.firstElementChild.removeAttribute("data-processed"),y.firstElementChild.innerHTML=y.previousElementSibling.firstElementChild.innerHTML,y.setAttribute("data-render","2")):y.firstElementChild.classList.contains("language-math")&&(y.setAttribute("data-render","2"),y.firstElementChild.textContent=y.firstElementChild.getAttribute("data-math"),y.firstElementChild.removeAttribute("data-math")))});var p=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(y){y.remove()}),n&&r&&(0,T.Hc)(r),p.replace('<span class="vditor-wbr"></span>',"<wbr>")},e})(),Hi=X(673),Oi=(function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:S.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":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(S.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:S.g.HLJS_OPTIONS,markdown:S.g.MARKDOWN_OPTIONS,math:S.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:S.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:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,o,p,y,d;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),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((o=this.options.hint)===null||o===void 0)&&o.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((y=(p=this.options.preview)===null||p===void 0?void 0:p.theme)===null||y===void 0)&&y.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((d=this.options.hint)===null||d===void 0)&&d.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var C=(0,Hi.T)(this.defaultOptions,this.options);if(C.cache.enable&&!C.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return C},e.prototype.mergeToolbar=function(t){var n=this,r=[{icon:'<svg><use xlink:href="#vditor-icon-export"></use></svg>',name:"export",tipPosition:"ne"},{hotkey:"⌘E",icon:'<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',name:"emoji",tipPosition:"ne"},{hotkey:"⌘H",icon:'<svg><use xlink:href="#vditor-icon-headings"></use></svg>',name:"headings",tipPosition:"ne"},{hotkey:"⌘B",icon:'<svg><use xlink:href="#vditor-icon-bold"></use></svg>',name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"⌘I",icon:'<svg><use xlink:href="#vditor-icon-italic"></use></svg>',name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"⌘D",icon:'<svg><use xlink:href="#vditor-icon-strike"></use></svg>',name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{hotkey:"⌘K",icon:'<svg><use xlink:href="#vditor-icon-link"></use></svg>',name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{name:"|"},{hotkey:"⌘L",icon:'<svg><use xlink:href="#vditor-icon-list"></use></svg>',name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"⌘O",icon:'<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"⌘J",icon:'<svg><use xlink:href="#vditor-icon-check"></use></svg>',name:"check",prefix:"* [ ] ",tipPosition:"n"},{hotkey:"⇧⌘I",icon:'<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',name:"outdent",tipPosition:"n"},{hotkey:"⇧⌘O",icon:'<svg><use xlink:href="#vditor-icon-indent"></use></svg>',name:"indent",tipPosition:"n"},{name:"|"},{hotkey:"⌘;",icon:'<svg><use xlink:href="#vditor-icon-quote"></use></svg>',name:"quote",prefix:"> ",tipPosition:"n"},{hotkey:"⇧⌘H",icon:'<svg><use xlink:href="#vditor-icon-line"></use></svg>',name:"line",prefix:"***",tipPosition:"n"},{hotkey:"⌘U",icon:'<svg><use xlink:href="#vditor-icon-code"></use></svg>',name:"code",prefix:"```",suffix:"\n```",tipPosition:"n"},{hotkey:"⌘G",icon:'<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{hotkey:"⇧⌘B",icon:'<svg><use xlink:href="#vditor-icon-before"></use></svg>',name:"insert-before",tipPosition:"n"},{hotkey:"⇧⌘E",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:"⌘M",icon:'<svg><use xlink:href="#vditor-icon-table"></use></svg>',name:"table",prefix:"| col1",suffix:` | col2 | col3 |
|
|
246
247
|
| --- | --- | --- |
|
|
247
248
|
| | | |
|
|
248
|
-
| | | |`,tipPosition:"n"},{name:"|"},{hotkey:"⌘Z",icon:'<svg><use xlink:href="#vditor-icon-undo"></use></svg>',name:"undo",tipPosition:"nw"},{hotkey:"⌘Y",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:"⌘'",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:"⌘P",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"}],i=[];return t.forEach(function(a){var o=a;r.forEach(function(
|
|
249
|
+
| | | |`,tipPosition:"n"},{name:"|"},{hotkey:"⌘Z",icon:'<svg><use xlink:href="#vditor-icon-undo"></use></svg>',name:"undo",tipPosition:"nw"},{hotkey:"⌘Y",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:"⌘'",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:"⌘P",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"}],i=[];return t.forEach(function(a){var o=a;r.forEach(function(p){typeof a=="string"&&p.name===a&&(o=p),typeof a=="object"&&p.name===a.name&&(o=Object.assign({},p,a))}),a.toolbar&&(o.toolbar=n.mergeToolbar(a.toolbar)),i.push(o)}),i},e})(),Ni=(function(){function e(t){var n=this;this.composingLock=!1,this.commentIds=[];var r=document.createElement("div");r.className="vditor-wysiwyg",r.innerHTML='<pre class="vditor-reset" placeholder="'.concat(t.options.placeholder,`"
|
|
249
250
|
contenteditable="true" spellcheck="false"></pre>
|
|
250
251
|
<div class="vditor-panel vditor-panel--none"></div>
|
|
251
252
|
<div class="vditor-panel vditor-panel--none">
|
|
252
253
|
<button type="button" aria-label="`).concat(window.VditorI18n.comment,`" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
|
|
253
254
|
<svg><use xlink:href="#vditor-icon-comment"></use></svg>
|
|
254
255
|
</button>
|
|
255
|
-
</div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),
|
|
256
|
-
`);
|
|
257
|
-
`){
|
|
258
|
-
`)&&(t.wysiwyg.element.innerHTML="");var i=(0,
|
|
259
|
-
`&&i.startOffset===1&&(i.startContainer.textContent=""),_t(t,i),Ze(t),!(r.key!=="ArrowDown"&&r.key!=="ArrowRight"&&r.key!=="Backspace"&&r.key!=="ArrowLeft"&&r.key!=="ArrowUp")){(r.key==="ArrowLeft"||r.key==="ArrowRight")&&t.hint.render(t);var a=(0,s.fb)(i.startContainer,"vditor-wysiwyg__preview");if(!a&&i.startContainer.nodeType!==3&&i.startOffset>0){var o=i.startContainer;o.classList.contains("vditor-wysiwyg__block")&&(a=o.lastElementChild)}if(a){var u=a.previousElementSibling;if(u.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?at(a,t):at(a,t,!1);return}var h=a.previousElementSibling;if(h.tagName==="PRE"&&(h=h.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,f=zn(o);if(f&&f.nodeType!==3){var S=f.querySelector(".vditor-wysiwyg__preview");if(S){at(S,t);return}}if(f.nodeType===3){for(;f.textContent.length===0&&f.nextSibling;)f=f.nextSibling;i.setStart(f,1)}else i.setStart(f.firstChild,0)}else i.selectNodeContents(h),i.collapse(!1)}}}})},e})(),Ci=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Li=(function(e){Ci(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=E.H,typeof n=="string"){if(r?r.cache?r.cache.id||(r.cache.id="vditor".concat(n)):r.cache={id:"vditor".concat(n)}:r={cache:{id:"vditor".concat(n)}},!document.getElementById(n))return i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new Ei(r),o=a.merge();if(o.i18n)window.VditorI18n=o.i18n,i.init(n,o);else if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","zh_CN","zh_TW"].includes(o.lang)){var u="vditorI18nScript",h=u+o.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(f){f.id!==h&&document.head.removeChild(f)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),h).then(function(){i.init(n,o)}).catch(function(f){i.showErrorTip("GET ".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return i}return t.prototype.showErrorTip=function(n){var r=new Hn;document.body.appendChild(r.element),r.show(n,0)},t.prototype.updateToolbarConfig=function(n){this.vditor.toolbar.updateConfig(this.vditor,n)},t.prototype.setTheme=function(n,r,i,a){this.vditor.options.theme=n,pe(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,X.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,On.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return D(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(){b(this.vditor,["subToolbar","hint","popover"]),d(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(){m(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(){if(this.vditor.currentMode==="wysiwyg")return st(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return st(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return st(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,k.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&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 xn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Kt(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,r){r===void 0&&(r=!0);var i=(0,k.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&ie(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&wt(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&qe(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,k.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,k.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):jt(this.vditor,n),this.vditor.outline.render(this.vditor),ee(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?tn(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(a){Se(a,i.vditor)}),We(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),n||(b(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),r&&this.clearStack()},t.prototype.insertEmptyBlock=function(n){lt(this.vditor,n)},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(),Yt(),this.vditor.wysiwyg.unbindListener(),this.vditor.options.after=void 0,this.isDestroyed=!0},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 r=function(i){i.classList.remove("vditor-comment--hover"),n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.removeCommentIds=function(n){var r=this;if(this.vditor.currentMode==="wysiwyg"){var i=function(a,o){var u=a.getAttribute("data-cmtids").split(" ");u.find(function(h,f){if(h===o)return u.splice(f,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,k.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",u.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)})}),ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.isDestroyed||(this.vditor={currentMode:r.mode,element:n,hint:new hr(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new yr(window.VditorI18n.outline),tip:new Hn},this.vditor.sv=new Er(this.vditor),this.vditor.undo=new wi,this.vditor.wysiwyg=new Si(this.vditor),this.vditor.ir=new mr(this.vditor),this.vditor.toolbar=new yi(this.vditor),r.resize.enable&&(this.vditor.resize=new vr(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new ir),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,gr.X)({autoSpace:i.vditor.options.preview.markdown.autoSpace,gfmAutoLink:i.vditor.options.preview.markdown.gfmAutoLink,codeBlockPreview:i.vditor.options.preview.markdown.codeBlockPreview,emojiSite:i.vditor.options.hint.emojiPath,emojis:i.vditor.options.hint.emoji,fixTermTypo:i.vditor.options.preview.markdown.fixTermTypo,footnotes:i.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:i.vditor.options.preview.math.inlineDigit,linkBase:i.vditor.options.preview.markdown.linkBase,linkPrefix:i.vditor.options.preview.markdown.linkPrefix,listStyle:i.vditor.options.preview.markdown.listStyle,mark:i.vditor.options.preview.markdown.mark,mathBlockPreview:i.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:i.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:i.vditor.options.preview.markdown.sanitize,toc:i.vditor.options.preview.markdown.toc}),i.vditor.preview=new wr(i.vditor),He(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t})(Z.default);const Mi=Li})(),Me=Me.default,Me})()})})(Tt)),Tt.exports}var _i=Ti();const Ai=Vn.getDefaultExportFromCjs(_i),xi={class:"dsg-editor"},Di={ref:"vditor",class:"dsg-editor__vditor"},Hi={key:0,class:"dsg-editor__error-wrapper"},Oi=fe.defineComponent({__name:"DsgEditor",props:fe.mergeModels({label:{default:""},targetModel:{default:null},targetModelClass:{default:""},mediaUploadEndpoint:{default:""},csrf:{default:""},errors:{default:()=>[]}},{modelValue:{required:!0},modelModifiers:{}}),emits:fe.mergeModels(["on-before-input","on-after-input","update:modelValue"],["update:modelValue"]),setup(ve,{expose:Jt,emit:pt}){let rt=fe.useModel(ve,"modelValue"),Y=fe.ref(rt);fe.watch(()=>Y.value,(w,b)=>{m("update:modelValue",w)});const Me=fe.ref(),Z=fe.useTemplateRef("vditor"),E=()=>({modelId:ve.targetModel?ve.targetModel.id:"",modelClass:ve.targetModelClass?ve.targetModelClass:""}),M=(w,b)=>{if(!w)return!1;w.nodeType===3&&(w=w.parentElement);let g=w,s=!1;for(;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},D=w=>{let b;const g=w[w.currentMode].element;return getSelection().rangeCount>0&&(b=getSelection().getRangeAt(0),g.isEqualNode(b.startContainer)||g.contains(b.startContainer))?b:w[w.currentMode].range?w[w.currentMode].range:(g.focus(),b=g.ownerDocument.createRange(),b.setStart(g,0),b.collapse(!0),b)},A=w=>{let b=D(Me.value.vditor);const g=M(b.startContainer,"LI");if(!g||g.nextElementSibling||g.previousElementSibling)return!1;if(g.parentNode?.previousSibling?.nodeName==="UL"&&g.parentNode?.previousSibling?.firstChild.classList.contains("vditor-task")){let s=g.parentNode?.previousSibling,C=g.parentNode;s.appendChild(g),g.classList.add("vditor-task");let _=document.createElement("input");_.setAttribute("type","checkbox"),g.insertBefore(_,g.firstChild),C&&C.parentNode&&C.parentNode.removeChild(C),b.setStartAfter(g),b.collapse(!0)}},c=()=>ve.csrf?ve.csrf:window.csrf,l=w=>new Promise(b=>{new MutationObserver((s,C)=>{const _=document.querySelector(w);_&&(C.disconnect(),b(_))}).observe(document.body,{childList:!0,subtree:!0})}),y=w=>{w.addEventListener("paste",b=>{if("clipboardData"in b&&b.clipboardData?.items){for(const g of b.clipboardData.items)if(g.type.startsWith("image/")){const s=b.clipboardData?.files[0].name.split(".").slice(0,-1).join("")||"pasted-image",C=g.type.split("/")[1];if(b.preventDefault(),b.stopPropagation(),ve.mediaUploadEndpoint&&c()!==""){const _=new FormData,x=E();Object.keys(x).forEach(L=>{_.append(L,x[L])}),_.append("file[]",g.getAsFile()),fetch(ve.mediaUploadEndpoint,{method:"POST",headers:{"X-CSRF-TOKEN":c()},body:_}).then(L=>L.json()).then(L=>{Me.value?.insertMD(`
|
|
260
|
-
`)}).catch(()=>{
|
|
261
|
-
`)}}}}},!0)},
|
|
262
|
-
`),
|
|
256
|
+
</div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),Nt(t,this.element),ln(t,this.element),Rt(t,this.element),Bt(t,this.element),Ut(t,this.element),It(t,this.element),Pt(t,this.element,this.copy),jt(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var i=Lute.NewNodeID(),a=getSelection().getRangeAt(0),o=a.cloneRange(),p=a.extractContents(),y,d,C=!1,_=!1;p.childNodes.forEach(function(O,V){var B=!1;if(O.nodeType===3?B=!0:O.classList.contains("vditor-comment")?O.classList.contains("vditor-comment")&&O.setAttribute("data-cmtids",O.getAttribute("data-cmtids")+" "+i):B=!0,B)if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&V===0&&o.startOffset>0)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),y=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&V===p.childNodes.length-1&&o.endOffset<o.endContainer.textContent.length)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),d=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0")V===0?C=!0:V===p.childNodes.length-1&&(_=!0),O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>");else{var N=document.createElement("span");N.classList.add("vditor-comment"),N.setAttribute("data-cmtids",i),O.parentNode.insertBefore(N,O),N.appendChild(O)}});var R=(0,s.F9)(o.startContainer);R&&(y?(R.insertAdjacentHTML("beforeend",y.innerHTML),y.remove()):R.textContent.trim().replace(S.g.ZWSP,"")===""&&C&&R.remove());var I=(0,s.F9)(o.endContainer);I&&(d?(I.insertAdjacentHTML("afterbegin",d.innerHTML),d.remove()):I.textContent.trim().replace(S.g.ZWSP,"")===""&&_&&I.remove()),a.insertNode(p),t.options.comment.add(i,a.toString(),n.getComments(t,!0)),le(t,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),n.hideComment()})}return e.prototype.getComments=function(t,n){var r=this;if(n===void 0&&(n=!1),t.currentMode==="wysiwyg"&&t.options.comment.enable){this.commentIds=[],this.element.querySelectorAll(".vditor-comment").forEach(function(a){r.commentIds=r.commentIds.concat(a.getAttribute("data-cmtids").split(" "))}),this.commentIds=Array.from(new Set(this.commentIds));var i=[];if(n)return this.commentIds.forEach(function(a){i.push({id:a,top:r.element.querySelector('.vditor-comment[data-cmtids="'.concat(a,'"]')).offsetTop})}),i}else return[]},e.prototype.triggerRemoveComment=function(t){var n=function(a,o){var p=new Set(o);return a.filter(function(y){return!p.has(y)})};if(t.currentMode==="wysiwyg"&&t.options.comment.enable&&t.wysiwyg.commentIds.length>0){var r=JSON.parse(JSON.stringify(this.commentIds));this.getComments(t);var i=n(r,this.commentIds);i.length>0&&t.options.comment.remove(i)}},e.prototype.showComment=function(){var t=(0,T.Ny)(this.element);this.selectPopover.setAttribute("style","left:".concat(t.left,"px;display:block;top:").concat(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 r=getSelection().getRangeAt(0);if(r.toString()!==""){t.stopPropagation(),t.preventDefault();var i=(0,s.lG)(r.startContainer,"CODE"),a=(0,s.lG)(r.endContainer,"CODE");if(i&&a&&a.isSameNode(i)){var o="";i.parentElement.tagName==="PRE"?o=r.toString():o="`"+r.toString()+"`",t.clipboardData.setData("text/plain",o),t.clipboardData.setData("text/html","");return}var p=(0,s.lG)(r.startContainer,"A"),y=(0,s.lG)(r.endContainer,"A");if(p&&y&&y.isSameNode(p)){var d=p.getAttribute("title")||"";d&&(d=' "'.concat(d,'"')),t.clipboardData.setData("text/plain","[".concat(r.toString(),"](").concat(p.getAttribute("href")).concat(d,")")),t.clipboardData.setData("text/html","");return}var C=document.createElement("div");C.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorDOM2Md(C.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.unbindListener(),window.addEventListener("scroll",this.scrollListener=function(){if(c(t,["hint"]),!(n.popover.style.display!=="block"||n.selectPopover.style.display!=="block")){var r=parseInt(n.popover.getAttribute("data-top"),10);if(t.options.height!=="auto"){if(t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0){var i=Math.max(window.scrollY-t.element.offsetTop-8,Math.min(r-t.wysiwyg.element.scrollTop,n.element.clientHeight-21))+"px";n.popover.style.display==="block"&&(n.popover.style.top=i),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=i)}return}else if(!t.options.toolbarConfig.pin)return;var a=Math.max(r,window.scrollY-t.element.offsetTop-8)+"px";n.popover.style.display==="block"&&(n.popover.style.top=a),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=a)}}),this.element.addEventListener("scroll",function(){if(c(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 r=parseInt(n.popover.getAttribute("data-top"),10)-t.wysiwyg.element.scrollTop,i=-8;t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0&&(i=window.scrollY-t.element.offsetTop+i);var a=Math.max(i,Math.min(r,n.element.clientHeight-21))+"px";n.popover.style.top=a,n.selectPopover.style.top=a}}),this.element.addEventListener("paste",function(r){Mt(t,r,{pasteCode:function(i){var a=(0,T.zh)(t),o=document.createElement("template");o.innerHTML=i,a.insertNode(o.content.cloneNode(!0));var p=(0,s.a1)(a.startContainer,"data-block","0");p?p.outerHTML=t.lute.SpinVditorDOM(p.outerHTML):t.wysiwyg.element.innerHTML=t.lute.SpinVditorDOM(t.wysiwyg.element.innerHTML),(0,T.ib)(t.wysiwyg.element,a)}})}),this.element.addEventListener("compositionstart",function(){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){var i=(0,M.W)(getSelection().getRangeAt(0).startContainer);if(i&&i.textContent===""){je(t);return}(0,l.vU)()||St(t,getSelection().getRangeAt(0).cloneRange(),r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")){if(n.preventInput){n.preventInput=!1,le(t);return}if(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"){le(t);return}var i=getSelection().getRangeAt(0),a=(0,s.F9)(i.startContainer);if(a||(xt(t,i),a=(0,s.F9)(i.startContainer)),!!a){for(var o=(0,T.im)(a,t.wysiwyg.element,i).start,p=!0,y=o-1;y>a.textContent.substr(0,o).lastIndexOf(`
|
|
257
|
+
`);y--)if(a.textContent.charAt(y)!==" "&&a.textContent.charAt(y)!==" "){p=!1;break}o===0&&(p=!1);for(var d=!0,y=o-1;y<a.textContent.length;y++)if(a.textContent.charAt(y)!==" "&&a.textContent.charAt(y)!==`
|
|
258
|
+
`){d=!1;break}d&&/^#{1,6} $/.test(a.textContent)&&(d=!1);var C=(0,M.W)(getSelection().getRangeAt(0).startContainer);if(C&&C.textContent===""&&(je(t),C.remove()),p&&a.getAttribute("data-type")!=="code-block"||d||Kt(a.innerHTML)||qt(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(H(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&a.previousElementSibling.remove(),St(t,i,r)}}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){var i=r.target;i.checked?i.setAttribute("checked","checked"):i.removeAttribute("checked"),n.preventInput=!0,getSelection().rangeCount>0&&(0,T.Hc)(getSelection().getRangeAt(0)),le(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?on(t,r.target):or(r,t);return}var a=(0,s.lG)(r.target,"A");if(a){t.options.link.click?t.options.link.click(a):t.options.link.isOpen&&window.open(a.getAttribute("href")),r.preventDefault();return}var o=(0,T.zh)(t);if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&o.collapsed){var p=n.element.lastElementChild.getBoundingClientRect();r.y>p.top+p.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(S.g.ZWSP,"")===""?(o.selectNodeContents(n.element.lastElementChild),o.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(S.g.ZWSP,"<wbr></p>")),(0,T.ib)(n.element,o)))}Ze(t);var y=(0,s.fb)(r.target,"vditor-wysiwyg__preview");y||(y=(0,s.fb)((0,T.zh)(t).startContainer,"vditor-wysiwyg__preview")),y&&ot(y,t),yt(r,t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){r.key==="Enter"&&we(t),(r.key==="Backspace"||r.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===`
|
|
259
|
+
`)&&(t.wysiwyg.element.innerHTML="");var i=(0,T.zh)(t);if(r.key==="Backspace"&&(0,l.vU)()&&i.startContainer.textContent===`
|
|
260
|
+
`&&i.startOffset===1&&(i.startContainer.textContent=""),xt(t,i),Ze(t),!(r.key!=="ArrowDown"&&r.key!=="ArrowRight"&&r.key!=="Backspace"&&r.key!=="ArrowLeft"&&r.key!=="ArrowUp")){(r.key==="ArrowLeft"||r.key==="ArrowRight")&&t.hint.render(t);var a=(0,s.fb)(i.startContainer,"vditor-wysiwyg__preview");if(!a&&i.startContainer.nodeType!==3&&i.startOffset>0){var o=i.startContainer;o.classList.contains("vditor-wysiwyg__block")&&(a=o.lastElementChild)}if(a){var p=a.previousElementSibling;if(p.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?ot(a,t):ot(a,t,!1);return}var y=a.previousElementSibling;if(y.tagName==="PRE"&&(y=y.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,d=er(o);if(d&&d.nodeType!==3){var C=d.querySelector(".vditor-wysiwyg__preview");if(C){ot(C,t);return}}if(d.nodeType===3){for(;d.textContent.length===0&&d.nextSibling;)d=d.nextSibling;i.setStart(d,1)}else i.setStart(d.firstChild,0)}else i.selectNodeContents(y),i.collapse(!1)}}}})},e})(),Ri=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ii=(function(e){Ri(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=S.H,typeof n=="string"){if(r?r.cache?r.cache.id||(r.cache.id="vditor".concat(n)):r.cache={id:"vditor".concat(n)}:r={cache:{id:"vditor".concat(n)}},!document.getElementById(n))return i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new Oi(r),o=a.merge();if(o.i18n)window.VditorI18n=o.i18n,i.init(n,o);else if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","zh_CN","zh_TW"].includes(o.lang)){var p="vditorI18nScript",y=p+o.lang;document.querySelectorAll('head script[id^="'.concat(p,'"]')).forEach(function(d){d.id!==y&&document.head.removeChild(d)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),y).then(function(){i.init(n,o)}).catch(function(d){i.showErrorTip("GET ".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return i}return t.prototype.showErrorTip=function(n){var r=new Un;document.body.appendChild(r.element),r.show(n,0)},t.prototype.updateToolbarConfig=function(n){this.vditor.toolbar.updateConfig(this.vditor,n)},t.prototype.setTheme=function(n,r,i,a){this.vditor.options.theme=n,pe(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,J.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,Vn.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return H(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(){c(this.vditor,["subToolbar","hint","popover"]),E(this.vditor.toolbar.elements,S.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){h(this.vditor.toolbar.elements,S.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(){if(this.vditor.currentMode==="wysiwyg")return lt(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return lt(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return lt(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,T.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&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 jn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Zt(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,r){r===void 0&&(r=!0);var i=(0,T.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&ae(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&St(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&qe(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,T.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,T.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):Vt(this.vditor,n),this.vditor.outline.render(this.vditor),Q(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?sn(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(a){Se(a,i.vditor)}),We(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),n||(c(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),r&&this.clearStack()},t.prototype.insertEmptyBlock=function(n){ct(this.vditor,n)},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(),en(),this.vditor.wysiwyg.unbindListener(),this.vditor.options.after=void 0,this.isDestroyed=!0},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 r=function(i){i.classList.remove("vditor-comment--hover"),n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.removeCommentIds=function(n){var r=this;if(this.vditor.currentMode==="wysiwyg"){var i=function(a,o){var p=a.getAttribute("data-cmtids").split(" ");p.find(function(y,d){if(y===o)return p.splice(d,1),!0}),p.length===0?(a.outerHTML=a.innerHTML,(0,T.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",p.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)})}),le(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.isDestroyed||(this.vditor={currentMode:r.mode,element:n,hint:new Mr(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new Ar(window.VditorI18n.outline),tip:new Un},this.vditor.sv=new Or(this.vditor),this.vditor.undo=new Di,this.vditor.wysiwyg=new Ni(this.vditor),this.vditor.ir=new Tr(this.vditor),this.vditor.toolbar=new Ai(this.vditor),r.resize.enable&&(this.vditor.resize=new Hr(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new u),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new mr),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,_r.X)({autoSpace:i.vditor.options.preview.markdown.autoSpace,callout:i.vditor.options.preview.markdown.callout,gfmAutoLink:i.vditor.options.preview.markdown.gfmAutoLink,codeBlockPreview:i.vditor.options.preview.markdown.codeBlockPreview,emojiSite:i.vditor.options.hint.emojiPath,emojis:i.vditor.options.hint.emoji,fixTermTypo:i.vditor.options.preview.markdown.fixTermTypo,footnotes:i.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:i.vditor.options.preview.math.inlineDigit,linkBase:i.vditor.options.preview.markdown.linkBase,linkPrefix:i.vditor.options.preview.markdown.linkPrefix,listStyle:i.vditor.options.preview.markdown.listStyle,mark:i.vditor.options.preview.markdown.mark,mathBlockPreview:i.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:i.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:i.vditor.options.preview.markdown.sanitize,sub:i.vditor.options.preview.markdown.sub,sup:i.vditor.options.preview.markdown.sup,toc:i.vditor.options.preview.markdown.toc}),i.vditor.preview=new Dr(i.vditor),De(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t})(Z.default);const Pi=Ii})(),Te=Te.default,Te})()})})(At)),At.exports}var Ui=Bi();const Vi=Jn.getDefaultExportFromCjs(Ui),Wi={class:"dsg-editor"},Fi={ref:"vditor",class:"dsg-editor__vditor"},qi={key:0,class:"dsg-editor__error-wrapper"},Ki=ue.defineComponent({__name:"DsgEditor",props:ue.mergeModels({label:{default:""},targetModel:{default:null},targetModelClass:{default:""},mediaUploadEndpoint:{default:""},csrf:{default:""},errors:{default:()=>[]}},{modelValue:{required:!0},modelModifiers:{}}),emits:ue.mergeModels(["on-before-input","on-after-input","update:modelValue"],["update:modelValue"]),setup(Ee,{expose:$t,emit:ht}){let it=ue.useModel(Ee,"modelValue"),X=ue.ref(it);ue.watch(()=>X.value,(v,w)=>{g("update:modelValue",v)});const Te=ue.ref(),Z=ue.useTemplateRef("vditor"),S=()=>({modelId:Ee.targetModel?Ee.targetModel.id:"",modelClass:Ee.targetModelClass?Ee.targetModelClass:""}),k=(v,w)=>{if(!v)return!1;v.nodeType===3&&(v=v.parentElement);let c=v,f=!1;for(;c&&!f&&!c.classList.contains("vditor-reset");)c.nodeName===w?f=!0:c=c.parentElement;return f&&c},H=v=>{let w;const c=v[v.currentMode].element;return getSelection().rangeCount>0&&(w=getSelection().getRangeAt(0),c.isEqualNode(w.startContainer)||c.contains(w.startContainer))?w:v[v.currentMode].range?v[v.currentMode].range:(c.focus(),w=c.ownerDocument.createRange(),w.setStart(c,0),w.collapse(!0),w)},A=v=>{let w=H(Te.value.vditor);const c=k(w.startContainer,"LI");if(!c||c.nextElementSibling||c.previousElementSibling)return!1;if(c.parentNode?.previousSibling?.nodeName==="UL"&&c.parentNode?.previousSibling?.firstChild.classList.contains("vditor-task")){let f=c.parentNode?.previousSibling,s=c.parentNode;f.appendChild(c),c.classList.add("vditor-task");let M=document.createElement("input");M.setAttribute("type","checkbox"),c.insertBefore(M,c.firstChild),s&&s.parentNode&&s.parentNode.removeChild(s),w.setStartAfter(c),w.collapse(!0)}},u=()=>Ee.csrf?Ee.csrf:window.csrf,m=v=>new Promise(w=>{new MutationObserver((f,s)=>{const M=document.querySelector(v);M&&(s.disconnect(),w(M))}).observe(document.body,{childList:!0,subtree:!0})}),l=v=>{v.addEventListener("paste",w=>{if("clipboardData"in w&&w.clipboardData?.items){for(const c of w.clipboardData.items)if(c.type.startsWith("image/")){const f=w.clipboardData?.files[0].name.split(".").slice(0,-1).join("")||"pasted-image",s=c.type.split("/")[1];if(w.preventDefault(),w.stopPropagation(),Ee.mediaUploadEndpoint&&u()!==""){const M=new FormData,x=S();Object.keys(x).forEach(L=>{M.append(L,x[L])}),M.append("file[]",c.getAsFile()),fetch(Ee.mediaUploadEndpoint,{method:"POST",headers:{"X-CSRF-TOKEN":u()},body:M}).then(L=>L.json()).then(L=>{Te.value?.insertMD(`
|
|
261
|
+
`)}).catch(()=>{Te.value?.vditor.tip.show("The file upload failed",5e3)});return}else{const M=new FileReader;M.readAsDataURL(c.getAsFile()),M.onload=()=>{const x=M.result;Te.value?.insertMD(`
|
|
262
|
+
`)}}}}},!0)},b=()=>{let v=["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|"];Ee.mediaUploadEndpoint&&u()!==""&&v.push("upload");let w=["table","|","undo","redo","|","fullscreen",{name:"more",toolbar:["both","export","outline","preview","devtools","info","help"]}];for(let c=0;c<w.length;c++)v.push(w[c]);return v};ue.onMounted(()=>{let v={mode:"wysiwyg",height:"auto",minHeight:300,lang:"en_US",toolbarConfig:{pin:!0},cache:{enable:!1},preview:{maxWidth:2e3},toolbar:b(),after:()=>{Z.value.getElementsByClassName("vditor-wysiwyg")[0].addEventListener("keyup",c=>{c.key==="Enter"&&A()&&c.preventDefault()}),X.value&&Te.value?.setValue(X.value)},input:w=>{g("on-before-input",X.value,w),X.value=w,g("on-after-input",w)},upload:{}};Ee.mediaUploadEndpoint&&u()!==""&&(v.upload={accept:"image/*",url:Ee.mediaUploadEndpoint,headers:{"X-CSRF-TOKEN":u()},extraData:S(),multiple:!1,error:w=>{Te.value?.vditor.tip.show("The file upload failed",5e3)},success:(w,c)=>{const f=JSON.parse(c);document.execCommand("insertHTML",!1,`
|
|
263
|
+
`),X.value=Te.value.getValue(),Te.value?.setValue(Te.value.getValue()),g("update:modelValue",X.value),Te.value?.vditor.tip.hide()}}),Z.value&&(Te.value=new Vi(Z.value,v),m("pre.vditor-reset").then(w=>{l(w)}))});const g=ht;return $t({getEditor:()=>Te.value,getEditorValue:()=>X.value}),(v,w)=>(ue.openBlock(),ue.createElementBlock("div",Wi,[ue.createElementVNode("div",null,[Ee.label?(ue.openBlock(),ue.createBlock(Jn._sfc_main,{key:0,class:"dsg-editor__label",label:Ee.label},null,8,["label"])):ue.createCommentVNode("",!0),ue.createElementVNode("div",Fi,null,512)]),Ee.errors&&Ee.errors.length?(ue.openBlock(),ue.createElementBlock("div",qi,[(ue.openBlock(!0),ue.createElementBlock(ue.Fragment,null,ue.renderList(Ee.errors,(c,f)=>(ue.openBlock(),ue.createElementBlock("div",{class:"dsg-editor__error",key:f},ue.toDisplayString(c),1))),128))])):ue.createCommentVNode("",!0)]))}}),Xn=Ki,Gi={DsgEditor:Xn};exports.DsgEditor=Xn;exports.default=Gi;
|