@ahzoo/sus 2.0.3 → 3.0.0

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.
@@ -1,259 +0,0 @@
1
- (function(Ue,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],L):(Ue=typeof globalThis<"u"?globalThis:Ue||self,L(Ue.SuSComment={},Ue.vue))})(this,(function(Ue,L){"use strict";function $n(q){return q&&q.__esModule&&Object.prototype.hasOwnProperty.call(q,"default")?q.default:q}var yt={exports:{}};/*!
2
- * Vditor v3.11.2 - A markdown editor written in TypeScript.
3
- *
4
- * MIT License
5
- *
6
- * Copyright (c) 2018-present B3log 开源, b3log.org
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- *
26
- */var Zn=yt.exports,Qt;function Jn(){return Qt||(Qt=1,(function(q,Me){(function(Q,X){q.exports=X()})(Zn,function(){return(()=>{var se={173:(I=>{var w=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},C=-1,D=1,A=0;w.Diff=function(c,l){return[c,l]},w.prototype.diff_main=function(c,l,g,p){typeof p>"u"&&(this.Diff_Timeout<=0?p=Number.MAX_VALUE:p=new Date().getTime()+this.Diff_Timeout*1e3);var h=p;if(c==null||l==null)throw new Error("Null input. (diff_main)");if(c==l)return c?[new w.Diff(A,c)]:[];typeof g>"u"&&(g=!0);var d=g,E=this.diff_commonPrefix(c,l),v=c.substring(0,E);c=c.substring(E),l=l.substring(E),E=this.diff_commonSuffix(c,l);var b=c.substring(c.length-E);c=c.substring(0,c.length-E),l=l.substring(0,l.length-E);var y=this.diff_compute_(c,l,d,h);return v&&y.unshift(new w.Diff(A,v)),b&&y.push(new w.Diff(A,b)),this.diff_cleanupMerge(y),y},w.prototype.diff_compute_=function(c,l,g,p){var h;if(!c)return[new w.Diff(D,l)];if(!l)return[new w.Diff(C,c)];var d=c.length>l.length?c:l,E=c.length>l.length?l:c,v=d.indexOf(E);if(v!=-1)return h=[new w.Diff(D,d.substring(0,v)),new w.Diff(A,E),new w.Diff(D,d.substring(v+E.length))],c.length>l.length&&(h[0][0]=h[2][0]=C),h;if(E.length==1)return[new w.Diff(C,c),new w.Diff(D,l)];var b=this.diff_halfMatch_(c,l);if(b){var y=b[0],s=b[1],k=b[2],x=b[3],H=b[4],_=this.diff_main(y,k,g,p),B=this.diff_main(s,x,g,p);return _.concat([new w.Diff(A,H)],B)}return g&&c.length>100&&l.length>100?this.diff_lineMode_(c,l,p):this.diff_bisect_(c,l,p)},w.prototype.diff_lineMode_=function(c,l,g){var p=this.diff_linesToChars_(c,l);c=p.chars1,l=p.chars2;var h=p.lineArray,d=this.diff_main(c,l,!1,g);this.diff_charsToLines_(d,h),this.diff_cleanupSemantic(d),d.push(new w.Diff(A,""));for(var E=0,v=0,b=0,y="",s="";E<d.length;){switch(d[E][0]){case D:b++,s+=d[E][1];break;case C:v++,y+=d[E][1];break;case A:if(v>=1&&b>=1){d.splice(E-v-b,v+b),E=E-v-b;for(var k=this.diff_main(y,s,!1,g),x=k.length-1;x>=0;x--)d.splice(E,0,k[x]);E=E+k.length}b=0,v=0,y="",s="";break}E++}return d.pop(),d},w.prototype.diff_bisect_=function(c,l,g){for(var p=c.length,h=l.length,d=Math.ceil((p+h)/2),E=d,v=2*d,b=new Array(v),y=new Array(v),s=0;s<v;s++)b[s]=-1,y[s]=-1;b[E+1]=0,y[E+1]=0;for(var k=p-h,x=k%2!=0,H=0,_=0,B=0,z=0,Z=0;Z<d&&!(new Date().getTime()>g);Z++){for(var ne=-Z+H;ne<=Z-_;ne+=2){var ae=E+ne,ue;ne==-Z||ne!=Z&&b[ae-1]<b[ae+1]?ue=b[ae+1]:ue=b[ae-1]+1;for(var ve=ue-ne;ue<p&&ve<h&&c.charAt(ue)==l.charAt(ve);)ue++,ve++;if(b[ae]=ue,ue>p)_+=2;else if(ve>h)H+=2;else if(x){var me=E+k-ne;if(me>=0&&me<v&&y[me]!=-1){var de=p-y[me];if(ue>=de)return this.diff_bisectSplit_(c,l,ue,ve,g)}}}for(var Ce=-Z+B;Ce<=Z-z;Ce+=2){var me=E+Ce,de;Ce==-Z||Ce!=Z&&y[me-1]<y[me+1]?de=y[me+1]:de=y[me-1]+1;for(var De=de-Ce;de<p&&De<h&&c.charAt(p-de-1)==l.charAt(h-De-1);)de++,De++;if(y[me]=de,de>p)z+=2;else if(De>h)B+=2;else if(!x){var ae=E+k-Ce;if(ae>=0&&ae<v&&b[ae]!=-1){var ue=b[ae],ve=E+ue-ae;if(de=p-de,ue>=de)return this.diff_bisectSplit_(c,l,ue,ve,g)}}}}return[new w.Diff(C,c),new w.Diff(D,l)]},w.prototype.diff_bisectSplit_=function(c,l,g,p,h){var d=c.substring(0,g),E=l.substring(0,p),v=c.substring(g),b=l.substring(p),y=this.diff_main(d,E,!1,h),s=this.diff_main(v,b,!1,h);return y.concat(s)},w.prototype.diff_linesToChars_=function(c,l){var g=[],p={};g[0]="";function h(b){for(var y="",s=0,k=-1,x=g.length;k<b.length-1;){k=b.indexOf(`
27
- `,s),k==-1&&(k=b.length-1);var H=b.substring(s,k+1);(p.hasOwnProperty?p.hasOwnProperty(H):p[H]!==void 0)?y+=String.fromCharCode(p[H]):(x==d&&(H=b.substring(s),k=b.length),y+=String.fromCharCode(x),p[H]=x,g[x++]=H),s=k+1}return y}var d=4e4,E=h(c);d=65535;var v=h(l);return{chars1:E,chars2:v,lineArray:g}},w.prototype.diff_charsToLines_=function(c,l){for(var g=0;g<c.length;g++){for(var p=c[g][1],h=[],d=0;d<p.length;d++)h[d]=l[p.charCodeAt(d)];c[g][1]=h.join("")}},w.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var g=0,p=Math.min(c.length,l.length),h=p,d=0;g<h;)c.substring(d,h)==l.substring(d,h)?(g=h,d=g):p=h,h=Math.floor((p-g)/2+g);return h},w.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var g=0,p=Math.min(c.length,l.length),h=p,d=0;g<h;)c.substring(c.length-h,c.length-d)==l.substring(l.length-h,l.length-d)?(g=h,d=g):p=h,h=Math.floor((p-g)/2+g);return h},w.prototype.diff_commonOverlap_=function(c,l){var g=c.length,p=l.length;if(g==0||p==0)return 0;g>p?c=c.substring(g-p):g<p&&(l=l.substring(0,g));var h=Math.min(g,p);if(c==l)return h;for(var d=0,E=1;;){var v=c.substring(h-E),b=l.indexOf(v);if(b==-1)return d;E+=b,(b==0||c.substring(h-E)==l.substring(0,E))&&(d=E,E++)}},w.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var g=c.length>l.length?c:l,p=c.length>l.length?l:c;if(g.length<4||p.length*2<g.length)return null;var h=this;function d(_,B,z){for(var Z=_.substring(z,z+Math.floor(_.length/4)),ne=-1,ae="",ue,ve,me,de;(ne=B.indexOf(Z,ne+1))!=-1;){var Ce=h.diff_commonPrefix(_.substring(z),B.substring(ne)),De=h.diff_commonSuffix(_.substring(0,z),B.substring(0,ne));ae.length<De+Ce&&(ae=B.substring(ne-De,ne)+B.substring(ne,ne+Ce),ue=_.substring(0,z-De),ve=_.substring(z+Ce),me=B.substring(0,ne-De),de=B.substring(ne+Ce))}return ae.length*2>=_.length?[ue,ve,me,de,ae]:null}var E=d(g,p,Math.ceil(g.length/4)),v=d(g,p,Math.ceil(g.length/2)),b;if(!E&&!v)return null;v?E?b=E[4].length>v[4].length?E:v:b=v:b=E;var y,s,k,x;c.length>l.length?(y=b[0],s=b[1],k=b[2],x=b[3]):(k=b[0],x=b[1],y=b[2],s=b[3]);var H=b[4];return[y,s,k,x,H]},w.prototype.diff_cleanupSemantic=function(c){for(var l=!1,g=[],p=0,h=null,d=0,E=0,v=0,b=0,y=0;d<c.length;)c[d][0]==A?(g[p++]=d,E=b,v=y,b=0,y=0,h=c[d][1]):(c[d][0]==D?b+=c[d][1].length:y+=c[d][1].length,h&&h.length<=Math.max(E,v)&&h.length<=Math.max(b,y)&&(c.splice(g[p-1],0,new w.Diff(C,h)),c[g[p-1]+1][0]=D,p--,p--,d=p>0?g[p-1]:-1,E=0,v=0,b=0,y=0,h=null,l=!0)),d++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),d=1;d<c.length;){if(c[d-1][0]==C&&c[d][0]==D){var s=c[d-1][1],k=c[d][1],x=this.diff_commonOverlap_(s,k),H=this.diff_commonOverlap_(k,s);x>=H?(x>=s.length/2||x>=k.length/2)&&(c.splice(d,0,new w.Diff(A,k.substring(0,x))),c[d-1][1]=s.substring(0,s.length-x),c[d+1][1]=k.substring(x),d++):(H>=s.length/2||H>=k.length/2)&&(c.splice(d,0,new w.Diff(A,s.substring(0,H))),c[d-1][0]=D,c[d-1][1]=k.substring(0,k.length-H),c[d+1][0]=C,c[d+1][1]=s.substring(H),d++),d++}d++}},w.prototype.diff_cleanupSemanticLossless=function(c){function l(H,_){if(!H||!_)return 6;var B=H.charAt(H.length-1),z=_.charAt(0),Z=B.match(w.nonAlphaNumericRegex_),ne=z.match(w.nonAlphaNumericRegex_),ae=Z&&B.match(w.whitespaceRegex_),ue=ne&&z.match(w.whitespaceRegex_),ve=ae&&B.match(w.linebreakRegex_),me=ue&&z.match(w.linebreakRegex_),de=ve&&H.match(w.blanklineEndRegex_),Ce=me&&_.match(w.blanklineStartRegex_);return de||Ce?5:ve||me?4:Z&&!ae&&ue?3:ae||ue?2:Z||ne?1:0}for(var g=1;g<c.length-1;){if(c[g-1][0]==A&&c[g+1][0]==A){var p=c[g-1][1],h=c[g][1],d=c[g+1][1],E=this.diff_commonSuffix(p,h);if(E){var v=h.substring(h.length-E);p=p.substring(0,p.length-E),h=v+h.substring(0,h.length-E),d=v+d}for(var b=p,y=h,s=d,k=l(p,h)+l(h,d);h.charAt(0)===d.charAt(0);){p+=h.charAt(0),h=h.substring(1)+d.charAt(0),d=d.substring(1);var x=l(p,h)+l(h,d);x>=k&&(k=x,b=p,y=h,s=d)}c[g-1][1]!=b&&(b?c[g-1][1]=b:(c.splice(g-1,1),g--),c[g][1]=y,s?c[g+1][1]=s:(c.splice(g+1,1),g--))}g++}},w.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,w.whitespaceRegex_=/\s/,w.linebreakRegex_=/[\r\n]/,w.blanklineEndRegex_=/\n\r?\n$/,w.blanklineStartRegex_=/^\r?\n\r?\n/,w.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,g=[],p=0,h=null,d=0,E=!1,v=!1,b=!1,y=!1;d<c.length;)c[d][0]==A?(c[d][1].length<this.Diff_EditCost&&(b||y)?(g[p++]=d,E=b,v=y,h=c[d][1]):(p=0,h=null),b=y=!1):(c[d][0]==C?y=!0:b=!0,h&&(E&&v&&b&&y||h.length<this.Diff_EditCost/2&&E+v+b+y==3)&&(c.splice(g[p-1],0,new w.Diff(C,h)),c[g[p-1]+1][0]=D,p--,h=null,E&&v?(b=y=!0,p=0):(p--,d=p>0?g[p-1]:-1,b=y=!1),l=!0)),d++;l&&this.diff_cleanupMerge(c)},w.prototype.diff_cleanupMerge=function(c){c.push(new w.Diff(A,""));for(var l=0,g=0,p=0,h="",d="",E;l<c.length;)switch(c[l][0]){case D:p++,d+=c[l][1],l++;break;case C:g++,h+=c[l][1],l++;break;case A:g+p>1?(g!==0&&p!==0&&(E=this.diff_commonPrefix(d,h),E!==0&&(l-g-p>0&&c[l-g-p-1][0]==A?c[l-g-p-1][1]+=d.substring(0,E):(c.splice(0,0,new w.Diff(A,d.substring(0,E))),l++),d=d.substring(E),h=h.substring(E)),E=this.diff_commonSuffix(d,h),E!==0&&(c[l][1]=d.substring(d.length-E)+c[l][1],d=d.substring(0,d.length-E),h=h.substring(0,h.length-E))),l-=g+p,c.splice(l,g+p),h.length&&(c.splice(l,0,new w.Diff(C,h)),l++),d.length&&(c.splice(l,0,new w.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,g=0,h="",d="";break}c[c.length-1][1]===""&&c.pop();var v=!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),v=!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),v=!0)),l++;v&&this.diff_cleanupMerge(c)},w.prototype.diff_xIndex=function(c,l){var g=0,p=0,h=0,d=0,E;for(E=0;E<c.length&&(c[E][0]!==D&&(g+=c[E][1].length),c[E][0]!==C&&(p+=c[E][1].length),!(g>l));E++)h=g,d=p;return c.length!=E&&c[E][0]===C?d:d+(l-h)},w.prototype.diff_prettyHtml=function(c){for(var l=[],g=/&/g,p=/</g,h=/>/g,d=/\n/g,E=0;E<c.length;E++){var v=c[E][0],b=c[E][1],y=b.replace(g,"&amp;").replace(p,"&lt;").replace(h,"&gt;").replace(d,"&para;<br>");switch(v){case D:l[E]='<ins style="background:#e6ffe6;">'+y+"</ins>";break;case C:l[E]='<del style="background:#ffe6e6;">'+y+"</del>";break;case A:l[E]="<span>"+y+"</span>";break}}return l.join("")},w.prototype.diff_text1=function(c){for(var l=[],g=0;g<c.length;g++)c[g][0]!==D&&(l[g]=c[g][1]);return l.join("")},w.prototype.diff_text2=function(c){for(var l=[],g=0;g<c.length;g++)c[g][0]!==C&&(l[g]=c[g][1]);return l.join("")},w.prototype.diff_levenshtein=function(c){for(var l=0,g=0,p=0,h=0;h<c.length;h++){var d=c[h][0],E=c[h][1];switch(d){case D:g+=E.length;break;case C:p+=E.length;break;case A:l+=Math.max(g,p),g=0,p=0;break}}return l+=Math.max(g,p),l},w.prototype.diff_toDelta=function(c){for(var l=[],g=0;g<c.length;g++)switch(c[g][0]){case D:l[g]="+"+encodeURI(c[g][1]);break;case C:l[g]="-"+c[g][1].length;break;case A:l[g]="="+c[g][1].length;break}return l.join(" ").replace(/%20/g," ")},w.prototype.diff_fromDelta=function(c,l){for(var g=[],p=0,h=0,d=l.split(/\t/g),E=0;E<d.length;E++){var v=d[E].substring(1);switch(d[E].charAt(0)){case"+":try{g[p++]=new w.Diff(D,decodeURI(v))}catch{throw new Error("Illegal escape in diff_fromDelta: "+v)}break;case"-":case"=":var b=parseInt(v,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+v);var y=c.substring(h,h+=b);d[E].charAt(0)=="="?g[p++]=new w.Diff(A,y):g[p++]=new w.Diff(C,y);break;default:if(d[E])throw new Error("Invalid diff operation in diff_fromDelta: "+d[E])}}if(h!=c.length)throw new Error("Delta length ("+h+") does not equal source text length ("+c.length+").");return g},w.prototype.match_main=function(c,l,g){if(c==null||l==null||g==null)throw new Error("Null input. (match_main)");return g=Math.max(0,Math.min(g,c.length)),c==l?0:c.length?c.substring(g,g+l.length)==l?g:this.match_bitap_(c,l,g):-1},w.prototype.match_bitap_=function(c,l,g){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),h=this;function d(ue,ve){var me=ue/l.length,de=Math.abs(g-ve);return h.Match_Distance?me+de/h.Match_Distance:de?1:me}var E=this.Match_Threshold,v=c.indexOf(l,g);v!=-1&&(E=Math.min(d(0,v),E),v=c.lastIndexOf(l,g+l.length),v!=-1&&(E=Math.min(d(0,v),E)));var b=1<<l.length-1;v=-1;for(var y,s,k=l.length+c.length,x,H=0;H<l.length;H++){for(y=0,s=k;y<s;)d(H,g+s)<=E?y=s:k=s,s=Math.floor((k-y)/2+y);k=s;var _=Math.max(1,g-s+1),B=Math.min(g+s,c.length)+l.length,z=Array(B+2);z[B+1]=(1<<H)-1;for(var Z=B;Z>=_;Z--){var ne=p[c.charAt(Z-1)];if(H===0?z[Z]=(z[Z+1]<<1|1)&ne:z[Z]=(z[Z+1]<<1|1)&ne|((x[Z+1]|x[Z])<<1|1)|x[Z+1],z[Z]&b){var ae=d(H,Z-1);if(ae<=E)if(E=ae,v=Z-1,v>g)_=Math.max(1,2*g-v);else break}}if(d(H+1,g)>E)break;x=z}return v},w.prototype.match_alphabet_=function(c){for(var l={},g=0;g<c.length;g++)l[c.charAt(g)]=0;for(var g=0;g<c.length;g++)l[c.charAt(g)]|=1<<c.length-g-1;return l},w.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var g=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(g)!=l.lastIndexOf(g)&&g.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,g=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var h=l.substring(c.start2-p,c.start2);h&&c.diffs.unshift(new w.Diff(A,h));var d=l.substring(c.start2+c.length1,c.start2+c.length1+p);d&&c.diffs.push(new w.Diff(A,d)),c.start1-=h.length,c.start2-=h.length,c.length1+=h.length+d.length,c.length2+=h.length+d.length}},w.prototype.patch_make=function(c,l,g){var p,h;if(typeof c=="string"&&typeof l=="string"&&typeof g>"u")p=c,h=this.diff_main(p,l,!0),h.length>2&&(this.diff_cleanupSemantic(h),this.diff_cleanupEfficiency(h));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof g>"u")h=c,p=this.diff_text1(h);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof g>"u")p=c,h=l;else if(typeof c=="string"&&typeof l=="string"&&g&&typeof g=="object")p=c,h=g;else throw new Error("Unknown call format to patch_make.");if(h.length===0)return[];for(var d=[],E=new w.patch_obj,v=0,b=0,y=0,s=p,k=p,x=0;x<h.length;x++){var H=h[x][0],_=h[x][1];switch(!v&&H!==A&&(E.start1=b,E.start2=y),H){case D:E.diffs[v++]=h[x],E.length2+=_.length,k=k.substring(0,y)+_+k.substring(y);break;case C:E.length1+=_.length,E.diffs[v++]=h[x],k=k.substring(0,y)+k.substring(y+_.length);break;case A:_.length<=2*this.Patch_Margin&&v&&h.length!=x+1?(E.diffs[v++]=h[x],E.length1+=_.length,E.length2+=_.length):_.length>=2*this.Patch_Margin&&v&&(this.patch_addContext_(E,s),d.push(E),E=new w.patch_obj,v=0,s=k,b=y);break}H!==D&&(b+=_.length),H!==C&&(y+=_.length)}return v&&(this.patch_addContext_(E,s),d.push(E)),d},w.prototype.patch_deepCopy=function(c){for(var l=[],g=0;g<c.length;g++){var p=c[g],h=new w.patch_obj;h.diffs=[];for(var d=0;d<p.diffs.length;d++)h.diffs[d]=new w.Diff(p.diffs[d][0],p.diffs[d][1]);h.start1=p.start1,h.start2=p.start2,h.length1=p.length1,h.length2=p.length2,l[g]=h}return l},w.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var g=this.patch_addPadding(c);l=g+l+g,this.patch_splitMax(c);for(var p=0,h=[],d=0;d<c.length;d++){var E=c[d].start2+p,v=this.diff_text1(c[d].diffs),b,y=-1;if(v.length>this.Match_MaxBits?(b=this.match_main(l,v.substring(0,this.Match_MaxBits),E),b!=-1&&(y=this.match_main(l,v.substring(v.length-this.Match_MaxBits),E+v.length-this.Match_MaxBits),(y==-1||b>=y)&&(b=-1))):b=this.match_main(l,v,E),b==-1)h[d]=!1,p-=c[d].length2-c[d].length1;else{h[d]=!0,p=b-E;var s;if(y==-1?s=l.substring(b,b+v.length):s=l.substring(b,y+this.Match_MaxBits),v==s)l=l.substring(0,b)+this.diff_text2(c[d].diffs)+l.substring(b+v.length);else{var k=this.diff_main(v,s,!1);if(v.length>this.Match_MaxBits&&this.diff_levenshtein(k)/v.length>this.Patch_DeleteThreshold)h[d]=!1;else{this.diff_cleanupSemanticLossless(k);for(var x=0,H,_=0;_<c[d].diffs.length;_++){var B=c[d].diffs[_];B[0]!==A&&(H=this.diff_xIndex(k,x)),B[0]===D?l=l.substring(0,b+H)+B[1]+l.substring(b+H):B[0]===C&&(l=l.substring(0,b+H)+l.substring(b+this.diff_xIndex(k,x+B[1].length))),B[0]!==C&&(x+=B[1].length)}}}}}return l=l.substring(g.length,l.length-g.length),[l,h]},w.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,g="",p=1;p<=l;p++)g+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var h=c[0],d=h.diffs;if(d.length==0||d[0][0]!=A)d.unshift(new w.Diff(A,g)),h.start1-=l,h.start2-=l,h.length1+=l,h.length2+=l;else if(l>d[0][1].length){var E=l-d[0][1].length;d[0][1]=g.substring(d[0][1].length)+d[0][1],h.start1-=E,h.start2-=E,h.length1+=E,h.length2+=E}if(h=c[c.length-1],d=h.diffs,d.length==0||d[d.length-1][0]!=A)d.push(new w.Diff(A,g)),h.length1+=l,h.length2+=l;else if(l>d[d.length-1][1].length){var E=l-d[d.length-1][1].length;d[d.length-1][1]+=g.substring(0,E),h.length1+=E,h.length2+=E}return g},w.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,g=0;g<c.length;g++)if(!(c[g].length1<=l)){var p=c[g];c.splice(g--,1);for(var h=p.start1,d=p.start2,E="";p.diffs.length!==0;){var v=new w.patch_obj,b=!0;for(v.start1=h-E.length,v.start2=d-E.length,E!==""&&(v.length1=v.length2=E.length,v.diffs.push(new w.Diff(A,E)));p.diffs.length!==0&&v.length1<l-this.Patch_Margin;){var y=p.diffs[0][0],s=p.diffs[0][1];y===D?(v.length2+=s.length,d+=s.length,v.diffs.push(p.diffs.shift()),b=!1):y===C&&v.diffs.length==1&&v.diffs[0][0]==A&&s.length>2*l?(v.length1+=s.length,h+=s.length,b=!1,v.diffs.push(new w.Diff(y,s)),p.diffs.shift()):(s=s.substring(0,l-v.length1-this.Patch_Margin),v.length1+=s.length,h+=s.length,y===A?(v.length2+=s.length,d+=s.length):b=!1,v.diffs.push(new w.Diff(y,s)),s==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(s.length))}E=this.diff_text2(v.diffs),E=E.substring(E.length-this.Patch_Margin);var k=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);k!==""&&(v.length1+=k.length,v.length2+=k.length,v.diffs.length!==0&&v.diffs[v.diffs.length-1][0]===A?v.diffs[v.diffs.length-1][1]+=k:v.diffs.push(new w.Diff(A,k))),b||c.splice(++g,0,v)}}},w.prototype.patch_toText=function(c){for(var l=[],g=0;g<c.length;g++)l[g]=c[g];return l.join("")},w.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var g=c.split(`
28
- `),p=0,h=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;p<g.length;){var d=g[p].match(h);if(!d)throw new Error("Invalid patch string: "+g[p]);var E=new w.patch_obj;for(l.push(E),E.start1=parseInt(d[1],10),d[2]===""?(E.start1--,E.length1=1):d[2]=="0"?E.length1=0:(E.start1--,E.length1=parseInt(d[2],10)),E.start2=parseInt(d[3],10),d[4]===""?(E.start2--,E.length2=1):d[4]=="0"?E.length2=0:(E.start2--,E.length2=parseInt(d[4],10)),p++;p<g.length;){var v=g[p].charAt(0);try{var b=decodeURI(g[p].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+b)}if(v=="-")E.diffs.push(new w.Diff(C,b));else if(v=="+")E.diffs.push(new w.Diff(D,b));else if(v==" ")E.diffs.push(new w.Diff(A,b));else{if(v=="@")break;if(v!=="")throw new Error('Invalid patch mode "'+v+'" in: '+b)}p++}}return l},w.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},w.patch_obj.prototype.toString=function(){var c,l;this.length1===0?c=this.start1+",0":this.length1==1?c=this.start1+1:c=this.start1+1+","+this.length1,this.length2===0?l=this.start2+",0":this.length2==1?l=this.start2+1:l=this.start2+1+","+this.length2;for(var g=["@@ -"+c+" +"+l+` @@
29
- `],p,h=0;h<this.diffs.length;h++){switch(this.diffs[h][0]){case D:p="+";break;case C:p="-";break;case A:p=" ";break}g[h+1]=p+encodeURI(this.diffs[h][1])+`
30
- `}return g.join("").replace(/%20/g," ")},I.exports=w,I.exports.diff_match_patch=w,I.exports.DIFF_DELETE=C,I.exports.DIFF_INSERT=D,I.exports.DIFF_EQUAL=A}),408:((I,w,C)=>{C.d(w,{default:()=>$e});var D=C(135),A=C(840),c=C(775),l=C(428),g=C(325),p=C(483),h=C(999),d=function(j){j===void 0&&(j=document);var oe=function(K){var V=document.createElement("img");V.src=K.getAttribute("data-src"),V.addEventListener("load",function(){!K.getAttribute("style")&&!K.getAttribute("class")&&!K.getAttribute("width")&&!K.getAttribute("height")&&V.naturalHeight>V.naturalWidth&&V.naturalWidth/V.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&V.naturalHeight>window.innerHeight-40&&(K.style.height=window.innerHeight-40+"px"),K.src=V.src}),K.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return j.querySelectorAll("img").forEach(function(K){K.getAttribute("data-src")&&oe(K)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),j.querySelectorAll("img").forEach(function(K){window.vditorImageIntersectionObserver.observe(K)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(K){K.forEach(function(V){(typeof V.isIntersecting>"u"?V.intersectionRatio!==0:V.isIntersecting)&&V.target.getAttribute("data-src")&&oe(V.target)})}),j.querySelectorAll("img").forEach(function(K){window.vditorImageIntersectionObserver.observe(K)}))},E=C(472),v=C(280),b=C(637),y=C(825),s=C(11),k=C(194),x=C(436),H=C(229),_=C(145),B=C(538),z=C(413),Z=C(106),ne=C(673),ae=function(j){document.querySelectorAll(".vditor-anchor").forEach(function(oe){j===1&&oe.classList.add("vditor-anchor--left"),oe.onclick=function(){var K=oe.getAttribute("href").substr(1),V=document.getElementById("vditorAnchor-"+K).offsetTop;document.querySelector("html").scrollTop=V}}),window.onhashchange=function(){var oe=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));oe&&(document.querySelector("html").scrollTop=oe.offsetTop)}},ue=C(214),ve=C(810),me=function(j,oe){if(oe===void 0&&(oe="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var K=function(){var Ae=speechSynthesis.getVoices(),ee,ge;return Ae.forEach(function(Re){Re.lang===oe.replace("_","-")&&(ee=Re),Re.default&&(ge=Re)}),ee||(ee=ge),ee},V='<svg><use xlink:href="#vditor-icon-play"></use></svg>',ye='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(V='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',ye='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var $=document.querySelector(".vditor-speech");$||($=document.createElement("button"),$.className="vditor-speech",j.insertAdjacentElement("beforeend",$),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=K));var Ee=K(),le=new SpeechSynthesisUtterance;le.voice=Ee,le.onend=le.onerror=function(){$.style.display="none",speechSynthesis.cancel(),$.classList.remove("vditor-speech--current"),$.innerHTML=V},j.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(Ae){var ee=Ae.target;if(ee.classList.contains("vditor-speech")||ee.parentElement.classList.contains("vditor-speech")){$.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),$.innerHTML=ye):(speechSynthesis.pause(),$.innerHTML=V)):(le.text=$.getAttribute("data-text"),speechSynthesis.speak(le),$.classList.add("vditor-speech--current"),$.innerHTML=ye),(0,ve.Hc)(window.vditorSpeechRange),j.focus();return}if($.style.display="none",speechSynthesis.cancel(),$.classList.remove("vditor-speech--current"),$.innerHTML=V,getSelection().rangeCount!==0){var ge=getSelection().getRangeAt(0),Re=ge.toString().trim();if(Re){window.vditorSpeechRange=ge.cloneRange();var je=ge.getBoundingClientRect();$.innerHTML=V,$.style.display="block",$.style.top=je.top+je.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?$.style.left=Ae.changedTouches[Ae.changedTouches.length-1].pageX+2+"px":$.style.left=Ae.clientX+2+"px",$.setAttribute("data-text",Re)}}})}},de=function(j,oe,K,V){function ye($){return $ instanceof K?$:new K(function(Ee){Ee($)})}return new(K||(K=Promise))(function($,Ee){function le(ge){try{ee(V.next(ge))}catch(Re){Ee(Re)}}function Ae(ge){try{ee(V.throw(ge))}catch(Re){Ee(Re)}}function ee(ge){ge.done?$(ge.value):ye(ge.value).then(le,Ae)}ee((V=V.apply(j,oe||[])).next())})},Ce=function(j,oe){var K={label:0,sent:function(){if($[0]&1)throw $[1];return $[1]},trys:[],ops:[]},V,ye,$,Ee;return Ee={next:le(0),throw:le(1),return:le(2)},typeof Symbol=="function"&&(Ee[Symbol.iterator]=function(){return this}),Ee;function le(ee){return function(ge){return Ae([ee,ge])}}function Ae(ee){if(V)throw new TypeError("Generator is already executing.");for(;Ee&&(Ee=0,ee[0]&&(K=0)),K;)try{if(V=1,ye&&($=ee[0]&2?ye.return:ee[0]?ye.throw||(($=ye.return)&&$.call(ye),0):ye.next)&&!($=$.call(ye,ee[1])).done)return $;switch(ye=0,$&&(ee=[ee[0]&2,$.value]),ee[0]){case 0:case 1:$=ee;break;case 4:return K.label++,{value:ee[1],done:!1};case 5:K.label++,ye=ee[1],ee=[0];continue;case 7:ee=K.ops.pop(),K.trys.pop();continue;default:if($=K.trys,!($=$.length>0&&$[$.length-1])&&(ee[0]===6||ee[0]===2)){K=0;continue}if(ee[0]===3&&(!$||ee[1]>$[0]&&ee[1]<$[3])){K.label=ee[1];break}if(ee[0]===6&&K.label<$[1]){K.label=$[1],$=ee;break}if($&&K.label<$[2]){K.label=$[2],K.ops.push(ee);break}$[2]&&K.ops.pop(),K.trys.pop();continue}ee=oe.call(j,K)}catch(ge){ee=[6,ge],ye=0}finally{V=$=0}if(ee[0]&5)throw ee[1];return{value:ee[0]?ee[1]:void 0,done:!0}}},De=function(j){var oe,K={anchor:0,cdn:_.g.CDN,customEmoji:{},emojiPath:"".concat(_.g.CDN,"/dist/images/emoji"),hljs:_.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:_.g.MARKDOWN_OPTIONS,math:_.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:_.g.THEME_OPTIONS};return j.cdn&&(!((oe=j.theme)===null||oe===void 0)&&oe.path||(K.theme.path="".concat(j.cdn,"/dist/css/content-theme")),j.emojiPath||(K.emojiPath="".concat(j.cdn,"/dist/images/emoji"))),(0,ne.T)(K,j)},_e=function(j,oe){var K=De(oe);return(0,z.G)("".concat(K.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var V=(0,ue.X)({autoSpace:K.markdown.autoSpace,gfmAutoLink:K.markdown.gfmAutoLink,codeBlockPreview:K.markdown.codeBlockPreview,emojiSite:K.emojiPath,emojis:K.customEmoji,fixTermTypo:K.markdown.fixTermTypo,footnotes:K.markdown.footnotes,headingAnchor:K.anchor!==0,inlineMathDigit:K.math.inlineDigit,lazyLoadImage:K.lazyLoadImage,linkBase:K.markdown.linkBase,linkPrefix:K.markdown.linkPrefix,listStyle:K.markdown.listStyle,mark:K.markdown.mark,mathBlockPreview:K.markdown.mathBlockPreview,paragraphBeginningSpace:K.markdown.paragraphBeginningSpace,sanitize:K.markdown.sanitize,toc:K.markdown.toc});return oe?.renderers&&V.SetJSRenderers({renderers:{Md2HTML:oe.renderers}}),V.SetHeadingID(!0),V.Md2HTML(j)})},M=function(j,oe,K){return de(void 0,void 0,void 0,function(){var V,ye,$,Ee;return Ce(this,function(le){switch(le.label){case 0:return V=De(K),[4,_e(oe,V)];case 1:if(ye=le.sent(),V.transform&&(ye=V.transform(ye)),j.innerHTML=ye,j.classList.add("vditor-reset"),V.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(V.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return $="vditorI18nScript",Ee=$+V.lang,document.querySelectorAll('head script[id^="'.concat($,'"]')).forEach(function(Ae){Ae.id!==Ee&&document.head.removeChild(Ae)}),[4,(0,z.G)("".concat(V.cdn,"/dist/js/i18n/").concat(V.lang,".js"),Ee)];case 3:le.sent(),le.label=4;case 4:return[3,6];case 5:window.VditorI18n=V.i18n,le.label=6;case 6:return V.icon?[4,(0,z.G)("".concat(V.cdn,"/dist/js/icons/").concat(V.icon,".js"),"vditorIconScript")]:[3,8];case 7:le.sent(),le.label=8;case 8:return(0,B.Z)(V.theme.current,V.theme.path),V.anchor===1&&j.classList.add("vditor-reset--anchor"),(0,l.O)(j,V.hljs),(0,h.s)(V.hljs,j,V.cdn),(0,E.H)(j,{cdn:V.cdn,math:V.math}),(0,b.i)(j,V.cdn,V.mode),(0,y.J)(j,V.cdn,V.mode),(0,s.K)(j,V.cdn),(0,g.P)(j,V.cdn),(0,p.v)(j,V.cdn),(0,c.p)(j,V.cdn,V.mode),(0,k.P)(j,V.cdn,V.mode),(0,H.B)(j,V.cdn),(0,D.Q)(j,V.cdn),V.render.media.enable&&(0,v.Y)(j),V.speech.enable&&me(j),V.anchor!==0&&ae(V.anchor),V.after&&V.after(),V.lazyLoadImage&&d(j),j.addEventListener("click",function(Ae){var ee=(0,Z.lG)(Ae.target,"SPAN");if(ee&&(0,Z.fb)(ee,"vditor-toc")){var ge=j.querySelector("#"+ee.getAttribute("data-target-id"));ge&&window.scrollTo(window.scrollX,ge.offsetTop);return}}),[2]}})})},Fe=C(190),wt=C(580),vt=(function(){function j(){}return j.adapterRender=A,j.previewImage=Fe.E,j.codeRender=l.O,j.graphvizRender=p.v,j.highlightRender=h.s,j.mathRender=E.H,j.mermaidRender=b.i,j.SMILESRender=y.J,j.markmapRender=s.K,j.flowchartRender=g.P,j.chartRender=c.p,j.abcRender=D.Q,j.mindmapRender=k.P,j.plantumlRender=H.B,j.outlineRender=x.k,j.mediaRender=v.Y,j.speechRender=me,j.lazyLoadImageRender=d,j.md2html=_e,j.preview=M,j.setCodeTheme=wt.Y,j.setContentTheme=B.Z,j})();const $e=vt}),145:((I,w,C)=>{C.d(w,{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:((I,w,C)=>{C.d(w,{J:()=>g});var D=C(145),A=C(413),c=C(840),l=C(494),g=function(p,h,d){p===void 0&&(p=document),h===void 0&&(h=D.g.CDN);var E=c.SMILESRenderAdapter.getElements(p);E.length>0&&(0,A.G)("".concat(h,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var v=new SmiDrawer({},{});E.forEach(function(b){var y=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||y.trim()==="")){var s="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(s,'"></svg>'),v.draw(y,"#"+s,d==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}}),135:((I,w,C)=>{C.d(w,{Q:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){g===void 0&&(g=document),p===void 0&&(p=D.g.CDN);var h=c.abcRenderAdapter.getElements(g);h.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){h.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:((I,w,C)=>{C.r(w),C.d(w,{mathRenderAdapter:()=>D,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>g,chartRenderAdapter:()=>p,abcRenderAdapter:()=>h,graphvizRenderAdapter:()=>d,flowchartRenderAdapter:()=>E,plantumlRenderAdapter:()=>v});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")}},g={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")}},h={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")}},E={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}}),775:((I,w,C)=>{C.d(w,{p:()=>h});var D=C(145),A=C(413),c=C(840),l=C(494),g=function(d,E,v,b){function y(s){return s instanceof v?s:new v(function(k){k(s)})}return new(v||(v=Promise))(function(s,k){function x(B){try{_(b.next(B))}catch(z){k(z)}}function H(B){try{_(b.throw(B))}catch(z){k(z)}}function _(B){B.done?s(B.value):y(B.value).then(x,H)}_((b=b.apply(d,E||[])).next())})},p=function(d,E){var v={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,y,s,k;return k={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function x(_){return function(B){return H([_,B])}}function H(_){if(b)throw new TypeError("Generator is already executing.");for(;k&&(k=0,_[0]&&(v=0)),v;)try{if(b=1,y&&(s=_[0]&2?y.return:_[0]?y.throw||((s=y.return)&&s.call(y),0):y.next)&&!(s=s.call(y,_[1])).done)return s;switch(y=0,s&&(_=[_[0]&2,s.value]),_[0]){case 0:case 1:s=_;break;case 4:return v.label++,{value:_[1],done:!1};case 5:v.label++,y=_[1],_=[0];continue;case 7:_=v.ops.pop(),v.trys.pop();continue;default:if(s=v.trys,!(s=s.length>0&&s[s.length-1])&&(_[0]===6||_[0]===2)){v=0;continue}if(_[0]===3&&(!s||_[1]>s[0]&&_[1]<s[3])){v.label=_[1];break}if(_[0]===6&&v.label<s[1]){v.label=s[1],s=_;break}if(s&&v.label<s[2]){v.label=s[2],v.ops.push(_);break}s[2]&&v.ops.pop(),v.trys.pop();continue}_=E.call(d,v)}catch(B){_=[6,B],y=0}finally{b=s=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},h=function(d,E,v){d===void 0&&(d=document),E===void 0&&(E=D.g.CDN);var b=c.chartRenderAdapter.getElements(d);b.length>0&&(0,A.G)("".concat(E,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(y){return g(void 0,void 0,void 0,function(){var s,k,x;return p(this,function(H){switch(H.label){case 0:if(y.parentElement.classList.contains("vditor-wysiwyg__pre")||y.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(s=c.chartRenderAdapter.getCode(y).trim(),!s)return[2];H.label=1;case 1:return H.trys.push([1,3,,4]),y.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(s)];case 2:return k=H.sent(),echarts.init(y,v==="dark"?"dark":void 0).setOption(k),y.setAttribute("data-processed","true"),[3,4];case 3:return x=H.sent(),y.className="vditor-reset--error",y.innerHTML="echarts render error: <br>".concat(x),[3,4];case 4:return[2]}})})})})}}),428:((I,w,C)=>{C.d(w,{O:()=>c});var D=C(105),A=C(145),c=function(l,g){Array.from(l.querySelectorAll("pre > code")).filter(function(p,h){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")&&h>5)}).forEach(function(p){var h,d,E,v=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(x){x.remove()}),v=b.innerText}else v.endsWith(`
31
- `)&&(v=v.substr(0,v.length-1));var y='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(y='<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 s=document.createElement("div");s.className="vditor-copy",s.innerHTML='<span aria-label="'.concat(((h=window.VditorI18n)===null||h===void 0?void 0:h.copy)||"复制",`"
32
- onmouseover="this.setAttribute('aria-label', '`).concat(((d=window.VditorI18n)===null||d===void 0?void 0:d.copy)||"复制",`')"
33
- class="vditor-tooltipped vditor-tooltipped__w"
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(y,"</span>");var k=document.createElement("textarea");k.value=(0,D.X)(v),s.insertAdjacentElement("afterbegin",k),g&&g.renderMenu&&g.renderMenu(p,s),p.before(s),p.style.maxHeight=window.outerHeight-40+"px",p.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(A.g.ZWSP,"</span>"))})}}),325:((I,w,C)=>{C.d(w,{P:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){p===void 0&&(p=D.g.CDN);var h=c.flowchartRenderAdapter.getElements(g);h.length!==0&&(0,A.G)("".concat(p,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then(function(){h.forEach(function(d){if(d.getAttribute("data-processed")!=="true"){var E=flowchart.parse(c.flowchartRenderAdapter.getCode(d));d.innerHTML="",E.drawSVG(d),d.setAttribute("data-processed","true")}})})}}),483:((I,w,C)=>{C.d(w,{v:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){p===void 0&&(p=D.g.CDN);var h=c.graphvizRenderAdapter.getElements(g);h.length!==0&&(0,A.G)("".concat(p,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then(function(){h.forEach(function(d){var E=c.graphvizRenderAdapter.getCode(d);if(!(d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre"))&&!(d.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"}),b=window.URL||window.webkitURL,y=b.createObjectURL(v),s=new Worker(y);new Viz({worker:s}).renderSVGElement(E).then(function(k){d.innerHTML=k.outerHTML}).catch(function(k){d.innerHTML="graphviz render error: <br>".concat(k),d.className="vditor-reset--error"})}catch(k){console.error("graphviz error",k)}d.setAttribute("data-processed","true")}})})}}),999:((I,w,C)=>{C.d(w,{s:()=>l});var D=C(145),A=C(413),c=C(290),l=function(g,p,h){p===void 0&&(p=document),h===void 0&&(h=D.g.CDN);var d=g.style;D.g.CODE_THEME.includes(d)||(d="github");var E=document.getElementById("vditorHljsStyle"),v="".concat(h,"/dist/js/highlight.js/styles/").concat(d,".min.css");if(E&&E.getAttribute("href")!==v&&E.remove(),(0,c.c)("".concat(h,"/dist/js/highlight.js/styles/").concat(d,".min.css"),"vditorHljsStyle"),g.enable!==!1){var b=p.querySelectorAll("pre > code");b.length!==0&&(0,A.G)("".concat(h,"/dist/js/highlight.js/highlight.min.js?v=11.7.0"),"vditorHljsScript").then(function(){(0,A.G)("".concat(h,"/dist/js/highlight.js/third-languages.js?v=1.0.1"),"vditorHljsThirdScript").then(function(){p.querySelectorAll("pre > code").forEach(function(y){if(!(y.parentElement.classList.contains("vditor-ir__marker--pre")||y.parentElement.classList.contains("vditor-wysiwyg__pre"))&&!(y.classList.contains("language-mermaid")||y.classList.contains("language-flowchart")||y.classList.contains("language-echarts")||y.classList.contains("language-mindmap")||y.classList.contains("language-plantuml")||y.classList.contains("language-smiles")||y.classList.contains("language-abc")||y.classList.contains("language-graphviz")||y.classList.contains("language-math"))){g.defaultLang!==""&&y.className.indexOf("language-")===-1&&y.classList.add("language-"+g.defaultLang);var s=y.className.replace("language-","");if(window.hljs.getLanguage(s)||(s="plaintext"),y.innerHTML=window.hljs.highlight(y.textContent,{language:s,ignoreIllegals:!0}).value,y.classList.add("hljs"),!!g.lineNumber){y.classList.add("vditor-linenumber");var k=y.querySelector(".vditor-linenumber__temp");k||(k=document.createElement("div"),k.className="vditor-linenumber__temp",y.insertAdjacentElement("beforeend",k));var x=getComputedStyle(y).whiteSpace,H=!1;(x==="pre-wrap"||x==="pre-line")&&(H=!0);var _="",B=y.textContent.split(/\r\n|\r|\n/g);B.pop(),B.map(function(z){var Z="";H&&(k.textContent=z||`
35
- `,Z=' style="height:'.concat(k.getBoundingClientRect().height,'px"')),_+="<span".concat(Z,"></span>")}),k.style.display="none",_='<span class="vditor-linenumber__rows">'.concat(_,"</span>"),y.insertAdjacentHTML("beforeend",_)}}})})})}}}),11:((I,w,C)=>{C.d(w,{K:()=>h});var D=C(145),A=C(413),c=C(840),l={},g=function(d,E){var v=d.transform(E),b=Object.keys(v.features).filter(function(H){return!l[H]});b.forEach(function(H){l[H]=!0});var y=d.getAssets(b),s=y.styles,k=y.scripts,x=window.markmap;return s&&x.loadCSS(s),k&&x.loadJS(k),v},p=function(d,E){var v=window.markmap,b=v.Transformer,y=v.Markmap,s=v.deriveOptions;v.globalCSS;var k=new b;d.innerHTML='<svg style="width:100%"></svg>';var x=d.firstChild,H=y.create(x,null),_=g(k,E),B=_.root,z=_.frontmatter,Z=z?.markmap,ne=s(Z);H.setData(B,ne),H.fit()},h=function(d,E){d===void 0&&(d=document),E===void 0&&(E=D.g.CDN);var v=c.markmapRenderAdapter.getElements(d);v.length!==0&&(0,A.G)("".concat(E,"/dist/js/markmap/markmap.min.js"),"vditorMarkerScript").then(function(){v.forEach(function(b){var y=c.markmapRenderAdapter.getCode(b);if(!(b.getAttribute("data-processed")==="true"||y.trim()==="")){var s=document.createElement("div");s.className="language-markmap",b.parentNode.appendChild(s),p(s,y),b.parentNode.childNodes[0].nodeName=="CODE"&&b.parentNode.removeChild(b.parentNode.childNodes[0])}})})}}),472:((I,w,C)=>{C.d(w,{H:()=>p});var D=C(145),A=C(413),c=C(290),l=C(105),g=C(840),p=function(h,d){h===void 0&&(h=document);var E=g.mathRenderAdapter.getElements(h);if(E.length!==0){var v={cdn:D.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(d&&d.math&&(d.math=Object.assign({},v.math,d.math)),d=Object.assign({},v,d),d.math.engine==="KaTeX")(0,c.c)("".concat(d.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,A.G)("".concat(d.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then(function(){(0,A.G)("".concat(d.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then(function(){E.forEach(function(s){if(!(s.parentElement.classList.contains("vditor-wysiwyg__pre")||s.parentElement.classList.contains("vditor-ir__marker--pre"))&&!s.getAttribute("data-math")){var k=(0,l.X)(g.mathRenderAdapter.getCode(s));s.setAttribute("data-math",k);try{s.innerHTML=katex.renderToString(k,{displayMode:s.tagName==="DIV",output:"html",macros:d.math.macros})}catch(x){s.innerHTML=x.message,s.className="language-math vditor-reset--error"}s.addEventListener("copy",function(x){x.stopPropagation(),x.preventDefault();var H=x.currentTarget.closest(".language-math");x.clipboardData.setData("text/html",H.innerHTML),x.clipboardData.setData("text/plain",H.getAttribute("data-math"))})}})})});else if(d.math.engine==="MathJax"){var b=function(s){if(s.length!==0){var k=0,x=s[s.length-1],H=function(){var _=s[k++];_===x?_():_(H)};H()}};window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(d.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:d.math.macros}},Object.assign(window.MathJax,d.math.mathJaxOptions)),(0,A.J)("".concat(d.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var y=function(s,k){var x=(0,l.X)(s.textContent).trim(),H=window.MathJax.getMetricsFor(s);H.display=s.tagName==="DIV",window.MathJax.tex2svgPromise(x,H).then(function(_){s.innerHTML="",s.setAttribute("data-math",x),s.append(_),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var B=_.querySelector('[data-mml-node="merror"]');B&&B.textContent.trim()!==""&&(s.innerHTML=B.textContent.trim(),s.className="vditor-reset--error"),k&&k()})};window.MathJax.startup.promise.then(function(){for(var s=[],k=function(H){var _=E[H];!_.parentElement.classList.contains("vditor-wysiwyg__pre")&&!_.parentElement.classList.contains("vditor-ir__marker--pre")&&!_.getAttribute("data-math")&&(0,l.X)(_.textContent).trim()&&s.push(function(B){H===E.length-1?y(_):y(_,B)})},x=0;x<E.length;x++)k(x);b(s)})}}}}),280:((I,w,C)=>{C.d(w,{Y:()=>g});var D=C(494),A=function(p,h){p.insertAdjacentHTML("afterend",'<video controls="controls" src="'.concat(h,'"></video>')),p.remove()},c=function(p,h){p.insertAdjacentHTML("afterend",'<audio controls="controls" src="'.concat(h,'"></audio>')),p.remove()},l=function(p,h){var d=h.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),E=h.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),v=h.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),b=h.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),y=h.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),s=h.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),k=h.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),x=h.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(d&&d[1].length===11)p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'.concat(d[1]+(d[2]?"?start="+d[2]:""),'"></iframe>')),p.remove();else if(E&&E[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'.concat(E[1],'"></iframe>')),p.remove();else if(v&&v[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='.concat(v[1],'"></iframe>')),p.remove();else if(b&&b[1])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
36
- src="//coub.com/embed/`.concat(b[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),p.remove();else if(y&&y[0])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
37
- src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(y[0]),'"></iframe>')),p.remove();else if(s&&s[2])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
38
- src="https://www.dailymotion.com/embed/video/`.concat(s[2],'"></iframe>')),p.remove();else if(h.indexOf("bilibili.com")>-1&&(h.indexOf("bvid=")>-1||k&&k[1])){var H={bvid:(0,D.on)("bvid",h)||k&&k[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(h.startsWith("http")?h:"https:"+h).search.split("&").forEach(function(z,Z){if(z){Z===0&&(z=z.substr(1));var ne=z.split("=");H[ne[0]]=ne[1]}});var _="https://player.bilibili.com/player.html?",B=Object.keys(H);B.forEach(function(z,Z){_+="".concat(z,"=").concat(H[z]),Z<B.length-1&&(_+="&")}),p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(_,'"></iframe>')),p.remove()}else x&&x[1]&&(p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(x[1],'"></iframe>')),p.remove())},g=function(p){p&&p.querySelectorAll("a").forEach(function(h){var d=h.getAttribute("href");d&&(d.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?A(h,d):d.match(/^.+.(mp3|wav|flac)$/)?c(h,d):l(h,d))})}}),637:((I,w,C)=>{C.d(w,{i:()=>h});var D=C(145),A=C(413),c=C(840),l=C(494),g=function(d,E,v,b){function y(s){return s instanceof v?s:new v(function(k){k(s)})}return new(v||(v=Promise))(function(s,k){function x(B){try{_(b.next(B))}catch(z){k(z)}}function H(B){try{_(b.throw(B))}catch(z){k(z)}}function _(B){B.done?s(B.value):y(B.value).then(x,H)}_((b=b.apply(d,E||[])).next())})},p=function(d,E){var v={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,y,s,k;return k={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function x(_){return function(B){return H([_,B])}}function H(_){if(b)throw new TypeError("Generator is already executing.");for(;k&&(k=0,_[0]&&(v=0)),v;)try{if(b=1,y&&(s=_[0]&2?y.return:_[0]?y.throw||((s=y.return)&&s.call(y),0):y.next)&&!(s=s.call(y,_[1])).done)return s;switch(y=0,s&&(_=[_[0]&2,s.value]),_[0]){case 0:case 1:s=_;break;case 4:return v.label++,{value:_[1],done:!1};case 5:v.label++,y=_[1],_=[0];continue;case 7:_=v.ops.pop(),v.trys.pop();continue;default:if(s=v.trys,!(s=s.length>0&&s[s.length-1])&&(_[0]===6||_[0]===2)){v=0;continue}if(_[0]===3&&(!s||_[1]>s[0]&&_[1]<s[3])){v.label=_[1];break}if(_[0]===6&&v.label<s[1]){v.label=s[1],s=_;break}if(s&&v.label<s[2]){v.label=s[2],v.ops.push(_);break}s[2]&&v.ops.pop(),v.trys.pop();continue}_=E.call(d,v)}catch(B){_=[6,B],y=0}finally{b=s=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},h=function(d,E,v){d===void 0&&(d=document),E===void 0&&(E=D.g.CDN);var b=c.mermaidRenderAdapter.getElements(d);b.length!==0&&(0,A.G)("".concat(E,"/dist/js/mermaid/mermaid.min.js?v=11.6.0"),"vditorMermaidScript").then(function(){var y={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"&&(y.theme="dark"),mermaid.initialize(y),b.forEach(function(s){return g(void 0,void 0,void 0,function(){var k,x,H,_,B;return p(this,function(z){switch(z.label){case 0:if(k=c.mermaidRenderAdapter.getCode(s),s.getAttribute("data-processed")==="true"||k.trim()==="")return[2];x="mermaid"+(0,l.Wb)(),z.label=1;case 1:return z.trys.push([1,3,,4]),[4,mermaid.render(x,s.textContent)];case 2:return H=z.sent(),s.innerHTML=H.svg,[3,4];case 3:return _=z.sent(),B=document.querySelector("#"+x),s.innerHTML="".concat(B.outerHTML,`<br>
39
- <div style="text-align: left"><small>`).concat(_.message.replace(/\n/,"<br>"),"</small></div>"),B.parentElement.remove(),[3,4];case 4:return s.setAttribute("data-processed","true"),[2]}})})})})}}),194:((I,w,C)=>{C.d(w,{P:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p,h){g===void 0&&(g=document),p===void 0&&(p=D.g.CDN);var d=c.mindmapRenderAdapter.getElements(g);d.length>0&&(0,A.G)("".concat(p,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){d.forEach(function(E){if(!(E.parentElement.classList.contains("vditor-wysiwyg__pre")||E.parentElement.classList.contains("vditor-ir__marker--pre"))){var v=c.mindmapRenderAdapter.getCode(E);if(v)try{if(E.getAttribute("data-processed")==="true")return;echarts.init(E,h==="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(b,y){var s;return!((s=y?.data)===null||s===void 0)&&s.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),E.setAttribute("data-processed","true")}catch(b){E.className="vditor-reset--error",E.innerHTML="mindmap render error: <br>".concat(b)}}})})}}),436:((I,w,C)=>{C.d(w,{k:()=>c});var D=C(771),A=C(472),c=function(l,g,p){var h="",d=[];if(Array.from(l.children).forEach(function(y,s){if((0,D.W)(y)){if(p){var k=y.id.lastIndexOf("_");y.id=y.id.substring(0,k===-1?void 0:k)+"_"+s}d.push(y.id),h+=y.outerHTML.replace("<wbr>","")}}),h==="")return g.innerHTML="","";var E=document.createElement("div");if(p)p.lute.SetToC(!0),p.currentMode==="wysiwyg"&&!p.preview.element.contains(l)?E.innerHTML=p.lute.SpinVditorDOM("<p>[ToC]</p>"+h):p.currentMode==="ir"&&!p.preview.element.contains(l)?E.innerHTML=p.lute.SpinVditorIRDOM("<p>[ToC]</p>"+h):E.innerHTML=p.lute.HTML2VditorDOM("<p>[ToC]</p>"+h),p.lute.SetToC(p.options.preview.markdown.toc);else{g.classList.add("vditor-outline");var v=Lute.New();v.SetToC(!0),E.innerHTML=v.HTML2VditorDOM("<p>[ToC]</p>"+h)}var b=E.firstElementChild.querySelectorAll("li > span[data-target-id]");return b.forEach(function(y,s){if(y.nextElementSibling&&y.nextElementSibling.tagName==="UL"){var k="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(k='<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>'),y.innerHTML="".concat(k,"<span>").concat(y.innerHTML,"</span>")}else y.innerHTML="<svg></svg><span>".concat(y.innerHTML,"</span>");y.setAttribute("data-target-id",d[s])}),h=E.firstElementChild.innerHTML,b.length===0?(g.innerHTML="",h):(g.innerHTML=h,p&&(0,A.H)(g,{cdn:p.options.cdn,math:p.options.preview.math}),g.firstElementChild.addEventListener("click",function(y){for(var s=y.target;s&&!s.isEqualNode(g);){if(s.classList.contains("vditor-outline__action")){s.classList.contains("vditor-outline__action--close")?(s.classList.remove("vditor-outline__action--close"),s.parentElement.nextElementSibling.setAttribute("style","display:block")):(s.classList.add("vditor-outline__action--close"),s.parentElement.nextElementSibling.setAttribute("style","display:none")),y.preventDefault(),y.stopPropagation();break}else if(s.getAttribute("data-target-id")){y.preventDefault(),y.stopPropagation();var k=document.getElementById(s.getAttribute("data-target-id"));if(!k)return;if(p)if(p.options.height==="auto"){var x=k.offsetTop+p.element.offsetTop;p.options.toolbarConfig.pin||(x+=p.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,x)}else p.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,p.element.offsetTop),p.preview.element.contains(l)?l.parentElement.scrollTop=k.offsetTop:l.scrollTop=k.offsetTop;else window.scrollTo(window.scrollX,k.offsetTop);break}s=s.parentElement}}),h)}}),229:((I,w,C)=>{C.d(w,{B:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){g===void 0&&(g=document),p===void 0&&(p=D.g.CDN);var h=c.plantumlRenderAdapter.getElements(g);h.length!==0&&(0,A.G)("".concat(p,"/dist/js/plantuml/plantuml-encoder.min.js"),"vditorPlantumlScript").then(function(){h.forEach(function(d){if(!(d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre"))){var E=c.plantumlRenderAdapter.getCode(d).trim();if(E)try{d.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'.concat(plantumlEncoder.encode(E),'"/>')}catch(v){d.className="vditor-reset--error",d.innerHTML="plantuml render error: <br>".concat(v)}}})})}}),214:((I,w,C)=>{C.d(w,{X:()=>D});var D=function(A){var c=Lute.New();return c.PutEmojis(A.emojis),c.SetEmojiSite(A.emojiSite),c.SetHeadingAnchor(A.headingAnchor),c.SetInlineMathAllowDigitAfterOpenMarker(A.inlineMathDigit),c.SetAutoSpace(A.autoSpace),c.SetToC(A.toc),c.SetFootnotes(A.footnotes),c.SetFixTermTypo(A.fixTermTypo),c.SetVditorCodeBlockPreview(A.codeBlockPreview),c.SetVditorMathBlockPreview(A.mathBlockPreview),c.SetSanitize(A.sanitize),c.SetChineseParagraphBeginningSpace(A.paragraphBeginningSpace),c.SetRenderListStyle(A.listStyle),c.SetLinkBase(A.linkBase),c.SetLinkPrefix(A.linkPrefix),c.SetMark(A.mark),c.SetGFMAutoLink(A.gfmAutoLink),A.lazyLoadImage&&c.SetImageLazyLoading(A.lazyLoadImage),c}}),190:((I,w,C)=>{C.d(w,{E:()=>D});var D=function(A,c,l){l===void 0&&(l="classic");var g=A.getBoundingClientRect(),p=36;document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'.concat(l==="dark"?" vditor--dark":"",`">
40
- <div class="vditor-img__bar">
41
- <span class="vditor-img__btn" data-deg="0">
42
- <svg><use xlink:href="#vditor-icon-redo"></use></svg>
43
- `).concat(window.VditorI18n.spin,`
44
- </span>
45
- <span class="vditor-img__btn" onclick="this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''">
46
- X &nbsp;`).concat(window.VditorI18n.close,`
47
- </span>
48
- </div>
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(g.left,"px, ").concat(g.top-p,'px, 0)" src="').concat(A.getAttribute("src"),`">
51
- </div>
52
- </div>`)),document.body.style.overflow="hidden";var h=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(){h.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(d)),setTimeout(function(){h.parentElement.scrollTo((h.parentElement.scrollWidth-h.parentElement.clientWidth)/2,(h.parentElement.scrollHeight-h.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>h.parentElement.clientHeight?h.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)"):h.style.transform="".concat(d," rotateZ(").concat(v,"deg)"),E.setAttribute("data-deg",v.toString()),setTimeout(function(){h.parentElement.scrollTo((h.parentElement.scrollWidth-h.parentElement.clientWidth)/2,(h.parentElement.scrollHeight-h.parentElement.clientHeight)/2)},400)})}}),580:((I,w,C)=>{C.d(w,{Y:()=>c});var D=C(145),A=C(290),c=function(l,g){g===void 0&&(g=D.g.CDN),D.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),h="".concat(g,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==h&&(p.remove(),(0,A.c)(h,"vditorHljsStyle")):(0,A.c)(h,"vditorHljsStyle")}}),538:((I,w,C)=>{C.d(w,{Z:()=>A});var D=C(290),A=function(c,l){if(!(!c||!l)){var g=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");g?g.getAttribute("href")!==p&&(g.remove(),(0,D.c)(p,"vditorContentTheme")):(0,D.c)(p,"vditorContentTheme")}}}),413:((I,w,C)=>{C.d(w,{J:()=>D,G:()=>A});var D=function(c,l){if(document.getElementById(l))return!1;var g=new XMLHttpRequest;g.open("GET",c,!1),g.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),g.send("");var p=document.createElement("script");p.type="text/javascript",p.text=g.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(g,p){if(document.getElementById(l))return g(!0),!1;var h=document.createElement("script");h.src=c,h.async=!0,document.head.appendChild(h),h.onerror=function(d){p(d)},h.onload=function(){if(document.getElementById(l))return h.remove(),g(!0),!1;h.id=l,g(!0)}})}}),290:((I,w,C)=>{C.d(w,{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:((I,w,C)=>{C.d(w,{X:()=>D});var D=function(A){return A.replace(/\u00a0/g," ")}}),410:((I,w,C)=>{C.d(w,{G6:()=>D,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>g,ns:()=>p,i7:()=>h});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"},g=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},h=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((I,w,C)=>{C.d(w,{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,g){g===void 0&&(g=window.location.search);var p=g.substring(g.indexOf("?")),h=p.indexOf("#"),d=new URLSearchParams(p.substring(0,h>=0?h:void 0));return d.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}}),106:((I,w,C)=>{C.d(w,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>g,F9:()=>p,lG:()=>h,fb:()=>d,DX:()=>E});var D=C(771),A=function(v,b){for(var y=d(v,b),s=!1,k=!1;y&&!y.classList.contains("vditor-reset")&&!k;)s=d(y.parentElement,b),s?y=s:k=!0;return y||!1},c=function(v,b){for(var y=(0,D.S)(v,b),s=!1,k=!1;y&&!y.classList.contains("vditor-reset")&&!k;)s=(0,D.S)(y.parentElement,b),s?y=s:k=!0;return y||!1},l=function(v){var b=c(v,"UL"),y=c(v,"OL"),s=b;return y&&(!b||b&&y.contains(b))&&(s=y),s},g=function(v,b,y){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var s=v,k=!1;s&&!k&&!s.classList.contains("vditor-reset");)s.getAttribute(b)===y?k=!0:s=s.parentElement;return k&&s},p=function(v){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);var b=v,y=!1,s=g(v,"data-block","0");if(s)return s;for(;b&&!y&&!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"?y=!0:b=b.parentElement;return y&&b},h=function(v,b){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var y=v,s=!1;y&&!s&&!y.classList.contains("vditor-reset");)y.nodeName===b?s=!0:y=y.parentElement;return s&&y},d=function(v,b){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var y=v,s=!1;y&&!s&&!y.classList.contains("vditor-reset");)y.classList.contains(b)?s=!0:y=y.parentElement;return s&&y},E=function(v){for(;v&&v.lastChild;)v=v.lastChild;return v}}),771:((I,w,C)=>{C.d(w,{S:()=>D,W:()=>A});var D=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var g=c,p=!1;g&&!p&&!g.classList.contains("vditor-reset");)g.nodeName.indexOf(l)===0?p=!0:g=g.parentElement;return p&&g},A=function(c){var l=D(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}}),673:((I,w,C)=>{C.d(w,{T:()=>D});var D=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},g=function(h){for(var d in h)h.hasOwnProperty(d)&&(Object.prototype.toString.call(h[d])==="[object Object]"?l[d]=D(l[d],h[d]):l[d]=h[d])},p=0;p<A.length;p++)g(A[p]);return l}}),810:((I,w,C)=>{C.d(w,{zh:()=>l,Ny:()=>g,Gb:()=>p,Hc:()=>h,im:()=>d,$j:()=>E,ib:()=>v,oC:()=>b});var D=C(145),A=C(410),c=C(106),l=function(y){var s,k=y[y.currentMode].element;return getSelection().rangeCount>0&&(s=getSelection().getRangeAt(0),k.isEqualNode(s.startContainer)||k.contains(s.startContainer))?s:y[y.currentMode].range?y[y.currentMode].range:(k.focus(),s=k.ownerDocument.createRange(),s.setStart(k,0),s.collapse(!0),s)},g=function(y){var s=window.getSelection().getRangeAt(0);if(!y.contains(s.startContainer)&&!(0,c.fb)(s.startContainer,"vditor-panel--none"))return{left:0,top:0};var k=y.parentElement.getBoundingClientRect(),x;if(s.getClientRects().length===0)if(s.startContainer.nodeType===3){var H=s.startContainer.parentElement;if(H&&H.getClientRects().length>0)x=H.getClientRects()[0];else return{left:0,top:0}}else{var _=s.startContainer.children;if(_[s.startOffset]&&_[s.startOffset].getClientRects().length>0)x=_[s.startOffset].getClientRects()[0];else if(s.startContainer.childNodes.length>0){var B=s.cloneRange();s.selectNode(s.startContainer.childNodes[Math.max(0,s.startOffset-1)]),x=s.getClientRects()[0],s.setEnd(B.endContainer,B.endOffset),s.setStart(B.startContainer,B.startOffset)}else x=s.startContainer.getClientRects()[0];if(!x){for(var z=s.startContainer.childNodes[s.startOffset];!z.getClientRects||z.getClientRects&&z.getClientRects().length===0;)z=z.parentElement;x=z.getClientRects()[0]}}else x=s.getClientRects()[0];return{left:x.left-k.left,top:x.top-k.top}},p=function(y,s){if(!s){if(getSelection().rangeCount===0)return!1;s=getSelection().getRangeAt(0)}var k=s.commonAncestorContainer;return y.isEqualNode(k)||y.contains(k)},h=function(y){var s=window.getSelection();s.removeAllRanges(),s.addRange(y)},d=function(y,s,k){var x={end:0,start:0};if(!k){if(getSelection().rangeCount===0)return x;k=window.getSelection().getRangeAt(0)}if(p(s,k)){var H=k.cloneRange();y.childNodes[0]&&y.childNodes[0].childNodes[0]?H.setStart(y.childNodes[0].childNodes[0],0):H.selectNodeContents(y),H.setEnd(k.startContainer,k.startOffset),x.start=H.toString().length,x.end=x.start+k.toString().length}return x},E=function(y,s,k){var x=0,H=0,_=k.childNodes[H],B=!1,z=!1;y=Math.max(0,y),s=Math.max(0,s);var Z=k.ownerDocument.createRange();for(Z.setStart(_||k,0),Z.collapse(!0);!z&&_;){var ne=x+_.textContent.length;if(!B&&y>=x&&y<=ne&&(y===0?Z.setStart(_,0):_.childNodes[0].nodeType===3?Z.setStart(_.childNodes[0],y-x):_.nextSibling?Z.setStartBefore(_.nextSibling):Z.setStartAfter(_),B=!0,y===s)){z=!0;break}B&&s>=x&&s<=ne&&(s===0?Z.setEnd(_,0):_.childNodes[0].nodeType===3?Z.setEnd(_.childNodes[0],s-x):_.nextSibling?Z.setEndBefore(_.nextSibling):Z.setEndAfter(_),z=!0),x=ne,_=k.childNodes[++H]}return!z&&k.childNodes[H-1]&&Z.setStartBefore(k.childNodes[H-1]),h(Z),Z},v=function(y,s){var k=y.querySelector("wbr");if(k){if(!k.previousElementSibling)k.previousSibling?s.setStart(k.previousSibling,k.previousSibling.textContent.length):k.nextSibling?k.nextSibling.nodeType===3?s.setStart(k.nextSibling,0):s.setStartBefore(k.nextSibling):s.setStart(k.parentElement,0);else if(k.previousElementSibling.isSameNode(k.previousSibling))if(k.previousElementSibling.lastChild){s.setStartBefore(k),s.collapse(!0),h(s),(0,A.i7)()&&(k.previousElementSibling.tagName==="EM"||k.previousElementSibling.tagName==="STRONG"||k.previousElementSibling.tagName==="S")&&(s.insertNode(document.createTextNode(D.g.ZWSP)),s.collapse(!1)),k.remove();return}else s.setStartAfter(k.previousElementSibling);else s.setStart(k.previousSibling,k.previousSibling.textContent.length);s.collapse(!0),k.remove(),h(s)}},b=function(y,s){var k=document.createElement("div");k.innerHTML=y;var x=k.querySelectorAll("p");x.length===1&&!x[0].previousSibling&&!x[0].nextSibling&&s[s.currentMode].element.children.length>0&&k.firstElementChild.tagName==="P"&&(y=x[0].innerHTML.trim());var H=document.createElement("div");H.innerHTML=y;var _=l(s);if(_.toString()!==""&&(s[s.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),H.firstElementChild&&H.firstElementChild.getAttribute("data-block")==="0"){H.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var B=(0,c.F9)(_.startContainer);if(!B)s[s.currentMode].element.insertAdjacentHTML("beforeend",H.innerHTML);else{var z=(0,c.lG)(_.startContainer,"LI");z&&H.firstElementChild.tagName==="UL"?z.insertAdjacentHTML("afterend",H.firstElementChild.innerHTML):B.insertAdjacentHTML("afterend",H.innerHTML)}v(s[s.currentMode].element,_)}else{var Z=document.createElement("template");Z.innerHTML=y,_.insertNode(Z.content.cloneNode(!0)),_.collapse(!1),h(_)}}})},Q={};function X(I){var w=Q[I];if(w!==void 0)return w.exports;var C=Q[I]={exports:{}};return se[I](C,C.exports,X),C.exports}X.d=(I,w)=>{for(var C in w)X.o(w,C)&&!X.o(I,C)&&Object.defineProperty(I,C,{enumerable:!0,get:w[C]})},X.o=(I,w)=>Object.prototype.hasOwnProperty.call(I,w),X.r=I=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})};var we={};return(()=>{X.d(we,{default:()=>Na});var I=X(408),w=X(145),C=X(105),D=function(e){return e.currentMode==="sv"?(0,C.X)("".concat(e.sv.element.textContent,`
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=X(413),c=(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(D(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})(),l=X(410),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.remove("vditor-menu--current")}})},p=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(w.g.CLASS_MENU_DISABLED)&&r.classList.remove(w.g.CLASS_MENU_DISABLED)}})},d=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(w.g.CLASS_MENU_DISABLED)&&r.classList.add(w.g.CLASS_MENU_DISABLED)}})},E=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},v=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},b=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")},y=function(e,t,n,r){n.addEventListener((0,l.Le)(),function(i){i.preventDefault(),i.stopPropagation(),!n.classList.contains(w.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":(b(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),k=X(771),x=function(e,t,n,r){r&&console.log("".concat(e," - ").concat(n,": ").concat(t))},H=X(135),_=X(775),B=X(428),z=X(325),Z=X(483),ne=X(999),ae=X(472),ue=X(637),ve=X(11),me=X(194),de=X(229),Ce=X(825),De=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,"&amp;").replace(/</g,"&lt;"),"<wbr></code></pre></div>"):"\n```\n"+o.replace(/&/g,"&amp;").replace(/</g,"&lt;")+"\n```":n==="wysiwyg"?"<code>".concat(o.replace(/&/g,"&amp;").replace(/</g,"&lt;"),"</code><wbr>"):"`".concat(o,"`")}return!1},_e=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,H.Q)(e,t.options.cdn);else if(n==="mermaid")(0,ue.i)(e,t.options.cdn,t.options.theme);else if(n==="smiles")(0,Ce.J)(e,t.options.cdn,t.options.theme);else if(n==="markmap")(0,ve.K)(e,t.options.cdn);else if(n==="flowchart")(0,z.P)(e,t.options.cdn);else if(n==="echarts")(0,_.p)(e,t.options.cdn,t.options.theme);else if(n==="mindmap")(0,me.P)(e,t.options.cdn,t.options.theme);else if(n==="plantuml")(0,de.B)(e,t.options.cdn);else if(n==="graphviz")(0,Z.v)(e,t.options.cdn);else if(n==="math")(0,ae.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,ne.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,B.O)(e,t.options.preview.hljs))}e.setAttribute("data-render","1")}},M=X(810),Fe=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,ae.H)(r,{cdn:e.options.cdn,math:e.options.preview.math})})}},wt=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}},vt=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,M.im)(e,t[t.currentMode].element,r).start===0)return e.previousElementSibling.remove(),re(t),!0;if(rt(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,M.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),re(t),!0;if(pt(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(),re(t),!0}},$e=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(Kt(i.innerHTML)&&i.previousElementSibling||zt(i.innerHTML))return;for(var a=(0,M.im)(i,e.ir.element,t).start,o=!0,u=a-1;u>i.textContent.substr(0,a).lastIndexOf(`
56
- `);u--)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==" "){o=!1;break}a===0&&(o=!1);for(var m=!0,u=a-1;u<i.textContent.length;u++)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==`
57
- `){m=!1;break}if(o){typeof e.options.input=="function"&&e.options.input(D(e));return}if(m&&/^#{1,6} $/.test(i.textContent)&&(m=!1),m){var f=(0,s.fb)(t.startContainer,"vditor-ir__marker");if(!f){var S=t.startContainer.previousSibling;S&&S.nodeType!==3&&S.classList.contains("vditor-ir__node--expand")&&S.classList.remove("vditor-ir__node--expand"),typeof e.options.input=="function"&&e.options.input(D(e));return}}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(te){te.classList.remove("vditor-ir__node--expand")}),i||(i=e.ir.element),!i.querySelector("wbr")){var T=(0,s.fb)(t.startContainer,"vditor-ir__preview");T?T.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}i.querySelectorAll("[style]").forEach(function(te){te.removeAttribute("style")}),i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.ir.element);var R=i.isEqualNode(e.ir.element),P=(0,s.a1)(i,"data-type","footnotes-block"),O="";if(R)O=i.innerHTML;else{var W=(0,k.S)(t.startContainer,"BLOCKQUOTE"),U=(0,s.O9)(t.startContainer);if(U&&(i=U),W&&(!U||U&&!W.contains(U))&&(i=W),P&&(i=P),O=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var N=i.previousElementSibling,J=i.nextElementSibling;N&&(N.tagName==="UL"||N.tagName==="OL")&&(O=N.outerHTML+O,N.remove()),J&&(J.tagName==="UL"||J.tagName==="OL")&&(O=O+J.outerHTML,J.remove()),O=O.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else i.previousElementSibling&&i.previousElementSibling.textContent.replace(w.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(te){te&&!i.isEqualNode(te)&&(O+=te.outerHTML,te.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(te){te&&!i.isEqualNode(te)&&(O+=te.outerHTML,te.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,P){var F=(0,s.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(F){var Y=F.textContent,fe=Y.substring(1,Y.indexOf("]:")),ce=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(fe,'"]'));ce&&ce.setAttribute("aria-label",Y.substr(fe.length+3).trim().substr(0,24))}}var he,Oe=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");Oe.forEach(function(te,ke){ke===0?he=te:(he.insertAdjacentHTML("beforeend",te.innerHTML),te.remove())}),Oe.length>0&&e.ir.element.insertAdjacentElement("beforeend",Oe[0]);var xe,Ne=e.ir.element.querySelectorAll("[data-type='footnotes-block']");Ne.forEach(function(te,ke){ke===0?xe=te:(xe.insertAdjacentHTML("beforeend",te.innerHTML),te.remove())}),Ne.length>0&&e.ir.element.insertAdjacentElement("beforeend",Ne[0]),(0,M.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(te){_e(te,e)}),Fe(e),ze(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},j=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))},oe=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},K=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},V=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,M.Hc)(e));var i=oe(e);if(i){i.classList.add("vditor-ir__node--expand"),i.classList.remove("vditor-ir__node--hidden");return}var a=K(e);if(a){a.classList.add("vditor-ir__node--expand"),a.classList.remove("vditor-ir__node--hidden");return}}},ye=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,M.zh)(e),r=n.startContainer;if(!bn(t,e,r)||(wn(n,e,t),Nn(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 u=(0,s.lG)(r,"P");if(Cn(t,e,u,n)||kn(n,e,u,t)||Dn(e,n,t,u))return!0;var m=(0,s.fb)(r,"vditor-ir__marker--pre");if(m&&m.tagName==="PRE"){var f=m.firstChild;if(xn(e,t,m,n)||(f.getAttribute("data-type")==="math-block"||f.getAttribute("data-type")==="html-block")&&rt(e,t,n,f,m.parentElement)||pt(e,t,n,f,m.parentElement))return!0}var S=(0,s.a1)(r,"data-type","code-block-info");if(S){if(t.key==="Enter"||t.key==="Tab")return n.selectNodeContents(S.nextElementSibling.firstChild),n.collapse(!0),t.preventDefault(),b(e,["hint"]),!0;if(t.key==="Backspace"){var T=(0,M.im)(S,e.ir.element).start;T===1&&n.setStart(r,0),T===2&&(e.hint.recentLanguage="")}if(rt(e,t,n,S,S.parentElement))return b(e,["hint"]),!0}var R=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(t.key.indexOf("Arrow")>-1&&R){var P=yi(R);if(P&&rt(e,t,n,R,P))return!0;var O=bi(R);if(O&&pt(e,t,n,R,O))return!0}if(An(e,t,n)||Hn(e,n,t)||Gt(e,n,t))return!0;var W=(0,k.W)(r);if(W){if(j("⌘=",t)){var U=W.querySelector(".vditor-ir__marker--heading");return U&&U.textContent.trim().length>1&&ht(e,U.textContent.substr(1)),t.preventDefault(),!0}if(j("⌘-",t)){var U=W.querySelector(".vditor-ir__marker--heading");return U&&U.textContent.trim().length<6&&ht(e,U.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(On(e,n,t,u))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 J=(0,M.im)(N,e.ir.element,n).start;if(J===0||J===1&&N.innerText.startsWith(w.g.ZWSP))return n.selectNodeContents(N.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),n.collapse(!1),V(n,e),N.textContent.trim().replace(w.g.ZWSP,"")===""&&(N.remove(),ze(e)),t.preventDefault(),!0}if(W){var F=W.firstElementChild.textContent.length;(0,M.im)(W,e.ir.element).start===F&&F!==0&&(n.setStart(W.firstElementChild.firstChild,F-1),n.collapse(!0),(0,M.Hc)(n))}}return(t.key==="ArrowUp"||t.key==="ArrowDown")&&N&&(N.querySelectorAll(".vditor-ir__node").forEach(function(Y){Y.contains(r)||Y.classList.add("vditor-ir__node--hidden")}),Rn(t,N,n))?!0:(vn(n,t.key),N&&vt(N,e,t,n)?(t.preventDefault(),!0):!1)},$=X(190),Ee=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)})},le=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,M.im)(a,e.sv.element,r).start,u=!0,m=o-1;m>a.textContent.substr(0,o).lastIndexOf(`
58
- `);m--)if(a.textContent.charAt(m)!==" "&&a.textContent.charAt(m)!==" "){u=!1;break}if(o===0&&(u=!1),u){Le(e);return}if(t.inputType==="deleteContentBackward"){var f=(0,s.a1)(i,"data-type","code-block-open-marker")||(0,s.a1)(i,"data-type","code-block-close-marker");if(f){if(f.getAttribute("data-type")==="code-block-close-marker"){var S=kt(i,"code-block-open-marker");if(S){S.textContent=f.textContent,Le(e);return}}if(f.getAttribute("data-type")==="code-block-open-marker"){var S=kt(i,"code-block-close-marker",!1);if(S){S.textContent=f.textContent,Le(e);return}}}var T=(0,s.a1)(i,"data-type","math-block-open-marker");if(T){var R=T.nextElementSibling.nextElementSibling;R&&R.getAttribute("data-type")==="math-block-close-marker"&&(R.remove(),Le(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 P=(0,s.a1)(i,"data-type","heading-marker");if(P&&P.textContent.indexOf("#")===-1){Le(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"))){Le(e);return}}if(a&&a.textContent.trimRight()==="$$"){Le(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,W=a.isEqualNode(e.sv.element);if(W)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 U="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(N,J){N&&!a.isEqualNode(N.parentElement)&&(U+=N.parentElement.textContent+`
60
- `,N.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(N,J){N&&!a.isEqualNode(N.parentElement)&&(U+=N.parentElement.textContent+`
61
- `,N.parentElement.remove())}),O=U+O}O=dn(O,e),W?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)}),Ee(e.sv.element,function(N){e.sv.element.insertAdjacentElement("beforeend",N)}),(0,M.ib)(e.sv.element,r),Se(e),Le(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},Ae=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 u=(0,M.zh)(e),m=u.startContainer;u.startContainer.nodeType!==3&&u.startContainer.tagName==="DIV"&&(m=u.startContainer.childNodes[u.startOffset-1]);var f=(0,s.a1)(m,"data-type","text"),S=(0,s.a1)(m,"data-type","blockquote-marker");if(!S&&u.startOffset===0&&f&&f.previousElementSibling&&f.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(S=f.previousElementSibling),S&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&S.nextElementSibling.textContent.trim()===""&&(0,M.im)(S,e.sv.element,u).start===S.textContent.length)return((n=S.previousElementSibling)===null||n===void 0?void 0:n.getAttribute("data-type"))==="padding"&&S.previousElementSibling.setAttribute("data-action","enter-remove"),S.remove(),Le(e),t.preventDefault(),!0;var T=(0,s.a1)(m,"data-type","li-marker"),R=(0,s.a1)(m,"data-type","task-marker"),P=T;if(P||R&&R.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(P=R),!P&&u.startOffset===0&&f&&f.previousElementSibling&&(f.previousElementSibling.getAttribute("data-type")==="li-marker"||f.previousElementSibling.getAttribute("data-type")==="task-marker")&&(P=f.previousElementSibling),P){var O=(0,M.im)(P,e.sv.element,u).start,W=P.getAttribute("data-type")==="task-marker",U=P;if(W&&(U=P.previousElementSibling.previousElementSibling.previousElementSibling),O===P.textContent.length){if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&P.nextElementSibling.textContent.trim()==="")return((r=U.previousElementSibling)===null||r===void 0?void 0:r.getAttribute("data-type"))==="padding"?(U.previousElementSibling.remove(),le(e)):(W&&(U.remove(),P.previousElementSibling.previousElementSibling.remove(),P.previousElementSibling.remove()),P.nextElementSibling.remove(),P.remove(),Le(e)),t.preventDefault(),!0;if(t.key==="Tab")return t.shiftKey?U.previousElementSibling.getAttribute("data-type")==="padding"&&U.previousElementSibling.remove():U.insertAdjacentHTML("beforebegin",'<span data-type="padding">'.concat(U.textContent.replace(/\S/g," "),"</span>")),/^\d/.test(U.textContent)&&(U.textContent=U.textContent.replace(/^\d{1,}/,"1"),u.selectNodeContents(P.firstChild),u.collapse(!1)),le(e),t.preventDefault(),!0}}if(Gt(e,u,t))return!0;var N=(0,s.a1)(m,"data-block","0"),J=(0,k.S)(m,"SPAN");if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&N){var F=!1,Y=N.textContent.match(/^\n+/);(0,M.im)(N,e.sv.element).start<=(Y?Y[0].length:0)&&(F=!0);var fe=`
62
- `;if(J){if(((i=J.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return J.previousElementSibling.remove(),Le(e),t.preventDefault(),!0;fe+=ci(J)}return u.insertNode(document.createTextNode(fe)),u.collapse(!1),N&&N.textContent.trim()!==""&&!F?le(e):Le(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(J&&((a=J.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,M.im)(J,e.sv.element,u).start===1&&J.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(J,0),u.extractContents(),J.textContent.trim()!==""?le(e):Le(e),t.preventDefault(),!0;if(N&&(0,M.im)(N,e.sv.element,u).start===0&&N.previousElementSibling){u.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"]'))?le(e):(ce.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ce.lastChild),u.collapse(!1)),Le(e)),t.preventDefault(),!0}}return!1},ee=X(538),ge=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},Re=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),ge(e),(0,ee.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>'),Qe(e,e.options.mode,Yr(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)}},je=function(e){var t=window.innerWidth<=w.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"},Et=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")}},an;function on(){window.removeEventListener("resize",an)}var Yr=function(e){Et(e),on(),window.addEventListener("resize",an=function(){je(e),Et(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||""},lt=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,M.Gb)(e[e.currentMode].element)){g(e.toolbar.elements,w.g.EDIT_TOOLBARS),h(e.toolbar.elements,w.g.EDIT_TOOLBARS);var t=(0,M.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,k.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 m=(0,s.a1)(n,"data-type","a");m&&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"]),h(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 R=(0,s.a1)(n,"data-type","table");R&&d(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},pe=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)},Qr=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(w.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},ei=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"))},sn=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},ln=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},ti=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},ni=function(e){var t=ln(e.startContainer),n=sn(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==w.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==w.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},Ht=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,M.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,M.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},St=function(e,t){var n=(0,M.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,M.ib)(e.wysiwyg.element,n),Fe(e))},Ot=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,M.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},ct=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,M.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&Se(t)},ri=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,M.zh)(e),r=n.startContainer;if(!bn(t,e,r)||(wn(n,e,t),Nn(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(Cn(t,e,a,n)||kn(n,e,a,t)||An(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"&&(xn(e,t,o.firstElementChild,n)||pt(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&rt(e,t,n,o.firstElementChild,o)))return!0}if(Dn(e,n,t,a))return!0;var m=(0,s.E2)(r,"BLOCKQUOTE");if(m&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(m):n.setStartAfter(m),(0,M.Hc)(n);var f=document.createElement("p");return f.setAttribute("data-block","0"),f.innerHTML=`
63
- `,n.insertNode(f),n.collapse(!0),(0,M.Hc)(n),pe(e),Se(e),t.preventDefault(),!0}var S=(0,k.W)(r);if(S){if(S.tagName==="H6"&&r.textContent.length===n.startOffset&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"){var T=document.createElement("p");return T.textContent=`
64
- `,T.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",T),n.setStart(T,0),(0,M.Hc)(n),pe(e),Se(e),t.preventDefault(),!0}if(j("⌘=",t)){var R=parseInt(S.tagName.substr(1),10)-1;return R>0&&(St(e,"h".concat(R)),pe(e)),t.preventDefault(),!0}if(j("⌘-",t)){var R=parseInt(S.tagName.substr(1),10)+1;return R<7&&(St(e,"h".concat(R)),pe(e)),t.preventDefault(),!0}t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&S.textContent.length===1&&Ot(e)}if(Hn(e,n,t))return!0;if(t.altKey&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.shiftKey){var P=(0,s.lG)(r,"A"),O=(0,s.a1)(r,"data-type","link-ref"),W=(0,s.a1)(r,"data-type","footnotes-ref");if(P||O||W||S&&S.tagName.length===2){var U=e.wysiwyg.popover.querySelector("input");U.focus(),U.select()}}if(He(e,t))return!0;if(j("⇧⌘U",t)){var N=e.wysiwyg.popover.querySelector('[data-type="up"]');if(N)return N.click(),t.preventDefault(),!0}if(j("⇧⌘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
- `+w.g.ZWSP)):n.insertNode(document.createTextNode(`
66
- `)),n.collapse(!1),(0,M.Hc)(n),pe(e),Se(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(On(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 J=(0,M.im)(i,e.wysiwyg.element,n).start;if(J===0&&n.startOffset===0||J===1&&i.innerText.startsWith(w.g.ZWSP))return ct(i.previousElementSibling.lastElementChild,e,!1),i.innerHTML.trim().replace(w.g.ZWSP,"")===""&&(i.remove(),pe(e)),t.preventDefault(),!0}var F=n.startOffset;if(n.toString()===""&&r.nodeType===3&&r.textContent.charAt(F-2)===`
67
- `&&r.textContent.charAt(F-1)!==w.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,F-1)+w.g.ZWSP,n.setStart(r,F),n.collapse(!0),pe(e),t.preventDefault(),!0;r.textContent===w.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&ei(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(fe){fe.firstElementChild.style.display="inline",fe.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(fe){fe.firstElementChild.style.display="inline",fe.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(w.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(Rn(t,i,n))return t.preventDefault(),!0;if(vn(n,t.key),t.key==="ArrowDown"){var Y=r.nextSibling;Y&&Y.nodeType!==3&&Y.getAttribute("data-type")==="math-inline"&&n.setStartAfter(Y)}return i&&vt(i,e,t,n)?(t.preventDefault(),!0):!1},He=function(e,t){if(j("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ye=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,M.Gb)(e.wysiwyg.element)){g(e.toolbar.elements,w.g.EDIT_TOOLBARS),h(e.toolbar.elements,w.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="",Ve(r,e),Ie(e,"footnotes-block"),Be(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"]),h(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(G){G.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(G){if(u.includes(G))return o=[G],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(G){G.getAttribute("data-cmtids").indexOf(o[0])>-1&&G.classList.add("vditor-comment--focus")})}var m=(0,s.lG)(n,"A");m&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"TABLE"),S=(0,k.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="",Ve(T,e),Ie(e,"vditor-toc"),Be(e,T);return}var R=(0,k.S)(n,"BLOCKQUOTE");if(R&&(e.wysiwyg.popover.innerHTML="",et(t,R,e),tt(t,R,e),Ve(R,e),Ie(e,"blockquote"),Be(e,R)),i&&(e.wysiwyg.popover.innerHTML="",et(t,i,e),tt(t,i,e),Ve(i,e),Ie(e,"li"),Be(e,i)),f){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var P=function(){var G=f.rows.length,ie=f.rows[0].cells.length,Je=parseInt(ke.value,10)||G,Xe=parseInt(Pe.value,10)||ie;if(!(Je===G&&ie===Xe)){if(ie!==Xe)for(var gt=Xe-ie,Ke=0;Ke<f.rows.length;Ke++)if(gt>0)for(var Kn=0;Kn<gt;Kn++)Ke===0?f.rows[Ke].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):f.rows[Ke].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Xt=ie-1;Xt>=Xe;Xt--)f.rows[Ke].cells[Xt].remove();if(G!==Je){var zn=Je-G;if(zn>0){for(var Yt="<tr>",ot=0;ot<Xe;ot++)Yt+="<td> </td>";for(var Gn=0;Gn<zn;Gn++)f.querySelector("tbody")?f.querySelector("tbody").insertAdjacentHTML("beforeend",Yt):f.querySelector("thead").insertAdjacentHTML("afterend",Yt+"</tr>")}else for(var ot=G-1;ot>=Je;ot--)f.rows[ot].remove(),f.rows.length===1&&f.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(D(e))}},O=function(G){Lt(f,G),G==="right"?(J.classList.remove("vditor-icon--current"),F.classList.remove("vditor-icon--current"),Y.classList.add("vditor-icon--current")):G==="center"?(J.classList.remove("vditor-icon--current"),Y.classList.remove("vditor-icon--current"),F.classList.add("vditor-icon--current")):(F.classList.remove("vditor-icon--current"),Y.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")),(0,M.Hc)(t),pe(e)},W=(0,s.lG)(n,"TD"),U=(0,s.lG)(n,"TH"),N="left";W?N=W.getAttribute("align")||"left":U&&(N=U.getAttribute("align")||"center");var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),J.setAttribute("data-type","left"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="left"?" vditor-icon--current":""),J.onclick=function(){O("left")};var F=document.createElement("button");F.setAttribute("type","button"),F.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),F.setAttribute("data-type","center"),F.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',F.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="center"?" vditor-icon--current":""),F.onclick=function(){O("center")};var Y=document.createElement("button");Y.setAttribute("type","button"),Y.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),Y.setAttribute("data-type","right"),Y.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',Y.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="right"?" vditor-icon--current":""),Y.onclick=function(){O("right")};var fe=document.createElement("button");fe.setAttribute("type","button"),fe.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),fe.setAttribute("data-type","insertRow"),fe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',fe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",fe.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&_n(e,t,ie)};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 G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Ln(e,t,ie)};var he=document.createElement("button");he.setAttribute("type","button"),he.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),he.setAttribute("data-type","insertColumn"),he.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',he.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",he.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Mt(e,f,ie)};var Oe=document.createElement("button");Oe.setAttribute("type","button"),Oe.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),Oe.setAttribute("data-type","insertColumn"),Oe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',Oe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Oe.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Mt(e,f,ie,"beforebegin")};var xe=document.createElement("button");xe.setAttribute("type","button"),xe.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),xe.setAttribute("data-type","deleteRow"),xe.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',xe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",xe.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Mn(e,t,ie)};var Ne=document.createElement("button");Ne.setAttribute("type","button"),Ne.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),Ne.setAttribute("data-type","deleteColumn"),Ne.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',Ne.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Ne.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Tn(e,t,f,ie)};var te=document.createElement("span");te.setAttribute("aria-label",window.VditorI18n.row),te.className="vditor-tooltipped vditor-tooltipped__n";var ke=document.createElement("input");te.appendChild(ke),ke.type="number",ke.min="1",ke.className="vditor-input",ke.style.width="42px",ke.style.textAlign="center",ke.setAttribute("placeholder",window.VditorI18n.row),ke.value=f.rows.length.toString(),ke.oninput=function(){P()},ke.onkeydown=function(G){if(!G.isComposing){if(G.key==="Tab"){Pe.focus(),Pe.select(),G.preventDefault();return}He(e,G)||qe(G,t)}};var xt=document.createElement("span");xt.setAttribute("aria-label",window.VditorI18n.column),xt.className="vditor-tooltipped vditor-tooltipped__n";var Pe=document.createElement("input");xt.appendChild(Pe),Pe.type="number",Pe.min="1",Pe.className="vditor-input",Pe.style.width="42px",Pe.style.textAlign="center",Pe.setAttribute("placeholder",window.VditorI18n.column),Pe.value=f.rows[0].cells.length.toString(),Pe.oninput=function(){P()},Pe.onkeydown=function(G){if(!G.isComposing){if(G.key==="Tab"){ke.focus(),ke.select(),G.preventDefault();return}He(e,G)||qe(G,t)}},et(t,f,e),tt(t,f,e),Ve(f,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",F),e.wysiwyg.popover.insertAdjacentElement("beforeend",Y),e.wysiwyg.popover.insertAdjacentElement("beforeend",ce),e.wysiwyg.popover.insertAdjacentElement("beforeend",fe),e.wysiwyg.popover.insertAdjacentElement("beforeend",Oe),e.wysiwyg.popover.insertAdjacentElement("beforeend",he),e.wysiwyg.popover.insertAdjacentElement("beforeend",xe),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ne),e.wysiwyg.popover.insertAdjacentElement("beforeend",te),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",xt),Ie(e,"table"),Be(e,f)}var Jt=(0,s.a1)(n,"data-type","link-ref");Jt&&cn(e,Jt,t);var it=(0,s.a1)(n,"data-type","footnotes-ref");if(it){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var te=document.createElement("span");te.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),te.className="vditor-tooltipped vditor-tooltipped__n";var Ge=document.createElement("input");te.appendChild(Ge),Ge.className="vditor-input",Ge.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Ge.style.width="120px",Ge.value=it.getAttribute("data-footnotes-label"),Ge.oninput=function(){Ge.value.trim()!==""&&it.setAttribute("data-footnotes-label",Ge.value),typeof e.options.input=="function"&&e.options.input(D(e))},Ge.onkeydown=function(ie){ie.isComposing||He(e,ie)||qe(ie,t)},Ve(it,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",te),Ie(e,"footnotes-ref"),Be(e,it)}var Te=(0,s.fb)(n,"vditor-wysiwyg__block"),Fn=Te?Te.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(G){if(!Te||Te&&Fn&&!Te.contains(G)){var ie=G.previousElementSibling;ie.style.display="none"}}),Te&&Fn){if(e.wysiwyg.popover.innerHTML="",et(t,Te,e),tt(t,Te,e),Ve(Te,e),Te.getAttribute("data-type")==="code-block"){var Dt=document.createElement("span");Dt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Dt.className="vditor-tooltipped vditor-tooltipped__n";var We=document.createElement("input");Dt.appendChild(We);var mt=Te.firstElementChild.firstElementChild;We.className="vditor-input",We.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),We.value=mt.className.indexOf("language-")>-1?mt.className.split("-")[1].split(" ")[0]:"",We.oninput=function(G){We.value.trim()!==""?mt.className="language-".concat(We.value):(mt.className="",e.hint.recentLanguage=""),Te.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Te.lastElementChild.innerHTML=Te.firstElementChild.innerHTML,_e(Te.lastElementChild,e)),pe(e),G.detail===1&&(t.setStart(mt.firstChild,0),t.collapse(!0),(0,M.Hc)(t))},We.onkeydown=function(G){if(!G.isComposing&&!He(e,G)){if(G.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",G.preventDefault();return}e.hint.select(G,e),qe(G,t)}},We.onkeyup=function(G){var ie,Je;if(!(G.isComposing||G.key==="Enter"||G.key==="ArrowUp"||G.key==="Escape"||G.key==="ArrowDown")){var Xe=[],gt=We.value.substring(0,We.selectionStart);(e.options.preview.hljs.langs||w.g.ALIAS_CODE_LANGUAGES.concat(((Je=(ie=window.hljs)===null||ie===void 0?void 0:ie.listLanguages())!==null&&Je!==void 0?Je:[]).sort())).forEach(function(Ke){Ke.indexOf(gt.toLowerCase())>-1&&Xe.push({html:Ke,value:Ke})}),e.hint.genHTML(Xe,gt,e),G.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",Dt),Ie(e,"code-block")}else Ie(e,"block");Be(e,Te)}else Te=void 0;if(S){e.wysiwyg.popover.innerHTML="";var te=document.createElement("span");te.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),te.className="vditor-tooltipped vditor-tooltipped__n";var Ze=document.createElement("input");te.appendChild(Ze),Ze.className="vditor-input",Ze.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),Ze.style.width="120px",Ze.value=S.getAttribute("data-id")||"",Ze.oninput=function(){S.setAttribute("data-id",Ze.value),typeof e.options.input=="function"&&e.options.input(D(e))},Ze.onkeydown=function(ie){ie.isComposing||He(e,ie)||qe(ie,t)},et(t,S,e),tt(t,S,e),Ve(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",te),Ie(e,"heading"),Be(e,S)}if(m&&Nt(e,m,t),!R&&!i&&!f&&!Te&&!m&&!Jt&&!it&&!S&&!T){var at=(0,s.a1)(n,"data-block","0");at&&at.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",et(t,at,e),tt(t,at,e),Ve(at,e),Ie(e,"block"),Be(e,at)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(G){G.style.display="none"});var qn=(0,s.a1)(t.startContainer,"data-type","backslash");qn&&(qn.querySelector("span").style.display="inline")}},200)},Be=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())},cn=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(m){He(e,m)||qe(m,n)||ut(e,t,m,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(m){He(e,m)||qe(m,n)||ut(e,t,m,a)},Ve(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),Ie(e,"link-ref"),Be(e,t)},et=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,M.ib)(n.wysiwyg.element,e),pe(n),Ye(n),Se(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},tt=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,M.ib)(n.wysiwyg.element,e),pe(n),Ye(n),Se(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ve=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,M.zh)(t);r.setStartAfter(e),(0,M.Hc)(r),e.remove(),pe(t),Ye(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&Fe(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},ut=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,M.zh)(e);t.insertAdjacentHTML("afterend",w.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,M.Hc)(i),n.preventDefault()}}},Nt=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),pe(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){He(e,S)||qe(S,n)||ut(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){He(e,S)||qe(S,n)||ut(e,t,S,f)};var m=document.createElement("span");m.setAttribute("aria-label",window.VditorI18n.tooltipText),m.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");m.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){He(e,S)||qe(S,n)||ut(e,t,S,a)},Ve(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",m),Ie(e,"a"),Be(e,t)},ii=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){He(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){He(t,S)};var m=document.createElement("span");m.setAttribute("aria-label",window.VditorI18n.title),m.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");m.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){He(t,S)},Ve(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",m),Ie(t,"image"),Be(t,n)},qe=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,M.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Ie=function(e,t){e.options.customWysiwygToolbar(t,e.wysiwyg.popover)},nt=function(e){e.currentMode==="wysiwyg"?Ye(e):e.currentMode==="ir"&&lt(e)},un=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){_e(i,e),i.previousElementSibling.setAttribute("style","display:none")}),pe(e,n)},ai=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",u=ni(e),m=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="",R="",P="";r.parentElement.getAttribute("data-block")!=="0"&&(R=ln(r),P=sn(r)),(m||R)&&(T="".concat(R,"<").concat(S,">").concat(m,"</").concat(S,">"),m=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(w.g.ZWSP,"<wbr>").concat(o),i=!0),(f||P)&&(f="<".concat(S,">").concat(f,"</").concat(S,">").concat(P),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,M.ib)(t.wysiwyg.element,e)},oi=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,M.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,M.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var m=(0,s.lG)(a.startContainer,"CODE");m||(m=a.startContainer.childNodes[a.startOffset]),m&&(m.outerHTML=m.innerHTML.replace(w.g.ZWSP,"")+"<wbr>",(0,M.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"?(_t(e,a,o),(0,M.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?ai(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,M.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,M.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")_t(e,a,o,!1),(0,M.ib)(e.wysiwyg.element,a),r=!1,g(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=w.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,M.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,M.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>`:(T.innerHTML="<pre><code>".concat(a.toString(),"<wbr></code></pre>"),a.deleteContents()),a.insertNode(T),f&&(f.outerHTML=e.lute.SpinVditorDOM(f.outerHTML)),(0,M.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(fe){_e(fe,e)}),t.classList.add("vditor-menu--disabled")}else if(o==="link"){if(a.toString()===""){var R=document.createElement("a");R.innerText=w.g.ZWSP,a.insertNode(R),a.setStart(R.firstChild,1),a.collapse(!0),Nt(e,R,a);var P=e.wysiwyg.popover.querySelector("input");P.value="",P.focus(),i=!1}else{var T=document.createElement("a");T.setAttribute("href",""),T.innerHTML=a.toString(),a.surroundContents(T),a.insertNode(T),(0,M.Hc)(a),Nt(e,T,a);var O=e.wysiwyg.popover.querySelectorAll("input");O[0].value=T.innerText,O[1].focus()}r=!1,t.classList.add("vditor-menu--current")}else if(o==="table"){var W='<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()==="")f&&f.innerHTML.trim().replace(w.g.ZWSP,"")===""?f.outerHTML=W:document.execCommand("insertHTML",!1,W),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,M.Hc)(a);else{W='<table data-block="0"><thead><tr>';var U=a.toString().split(`
69
- `),N=U[0].split(",").length>U[0].split(" ").length?",":" ";U.forEach(function(Y,fe){fe===0?(Y.split(N).forEach(function(ce,he){he===0?W+="<th>".concat(ce,"<wbr></th>"):W+="<th>".concat(ce,"</th>")}),W+="</tr></thead>"):(fe===1?W+="<tbody><tr>":W+="<tr>",Y.split(N).forEach(function(ce){W+="<td>".concat(ce,"</td>")}),W+="</tr>")}),W+="</tbody></table>",document.execCommand("insertHTML",!1,W),(0,M.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if(o==="line"){if(f){var J=`<hr data-block="0"><p data-block="0"><wbr>
70
- </p>`;f.innerHTML.trim()===""?f.outerHTML=J:f.insertAdjacentHTML("afterend",J),(0,M.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 F="strong";o==="italic"?F="em":o==="strikeThrough"&&(F="s");var T=document.createElement(F);T.textContent=w.g.ZWSP,a.insertNode(T),T.previousSibling&&T.previousSibling.textContent===w.g.ZWSP&&(T.previousSibling.textContent=""),a.setStart(T.firstChild,1),a.collapse(!0),(0,M.Hc)(a)}else document.execCommand(o,!1,"")}r&&Ye(e),i&&pe(e)}},be=(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?" &lt;".concat((0,l.ns)(n.hotkey),"&gt;"):"");var o=n.tip?n.tip+a:"".concat(window.VditorI18n[n.name]).concat(a),u=n.name==="upload"?"div":"button";if(n.level===2)this.element.innerHTML="<".concat(u,' data-type="').concat(n.name,'">').concat(o,"</").concat(u,">");else{this.element.classList.add("vditor-toolbar__item");var m=document.createElement(u);m.setAttribute("data-type",n.name),m.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),m.setAttribute("aria-label",o),m.innerHTML=n.icon,this.element.appendChild(m)}n.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(f){f.preventDefault(),!i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?oi(t,i.element.children[0],f):t.currentMode==="ir"?vi(t,i.element.children[0],n.prefix||"",n.suffix||""):ui(t,i.element.children[0],n.prefix||"",n.suffix||""))})}return e})(),si=(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)}})(),Qe=function(e,t,n){var r;if(typeof n!="string"?(b(e,["subToolbar","hint"]),n.preventDefault(),r=D(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,w.g.EDIT_TOOLBARS),g(e.toolbar.elements,w.g.EDIT_TOOLBARS),d(e.toolbar.elements,["outdent","indent"]),t==="ir")E(e.toolbar.elements,["both"]),v(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),ze(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),je(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){_e(a,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ae.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")E(e.toolbar.elements,["both"]),v(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",je(e),un(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ae.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){v(e.toolbar.elements,["both"]),E(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=dn(r,e);i==="<div data-block='0'></div>"&&(i=""),e.sv.element.innerHTML=i,Ee(e.sv.element),Le(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),je(e)}e.undo.resetIcon(e),typeof n!="string"&&(e[e.currentMode].element.focus(),nt(e)),Fe(e),Et(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")}},li=(function(e){si(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," &lt;").concat((0,l.ns)("⌥⌘7"),`></button>
71
- <button data-mode="ir">`).concat(window.VditorI18n.instantRendering," &lt;").concat((0,l.ns)("⌥⌘8"),`></button>
72
- <button data-mode="sv">`).concat(window.VditorI18n.splitView," &lt;").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];y(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(o){Qe(n,"wysiwyg",o),o.preventDefault(),o.stopPropagation()}),r.children.item(1).addEventListener((0,l.Le)(),function(o){Qe(n,"ir",o),o.preventDefault(),o.stopPropagation()}),r.children.item(2).addEventListener((0,l.Le)(),function(o){Qe(n,"sv",o),o.preventDefault(),o.stopPropagation()})},t})(be),ft=function(e,t){return(0,M.Gb)(e,t)?getSelection().toString():""},Rt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(D(e)),b(e,["subToolbar","hint"])})},fn=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,$.E)(n.target,e.options.lang,e.options.theme))})},It=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,M.zh)(e),e.options.blur&&e.options.blur(D(e))})},Pt=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(w.g.DROP_EDITOR,w.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(w.g.DROP_EDITOR)?re(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&Tt(e,n,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})})},jt=function(e,t,n){t.addEventListener("copy",function(r){return n(r,e)})},Bt=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")})},Se=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,M.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)}},Vt=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"||j("⌘X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(Ae(e,n))return}else if(e.currentMode==="wysiwyg"){if(ri(e,n))return}else if(e.currentMode==="ir"&&ye(e,n))return;if(e.options.ctrlEnter&&j("⌘Enter",n)){e.options.ctrlEnter(D(e)),n.preventDefault();return}if(j("⌘Z",n)&&!e.toolbar.elements.undo){e.undo.undo(e),n.preventDefault();return}if(j("⌘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(D(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)?Ot(e):St(e,r),pe(e)}else e.currentMode==="sv"?pn(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&ht(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"?Qe(e,"wysiwyg",n):n.code==="Digit8"?Qe(e,"ir",n):n.code==="Digit9"&&Qe(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(j(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(j(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=ft(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())})}})},Wt=function(e,t){var n=(0,M.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
- </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,Ee(e.sv.element),(0,M.ib)(e.sv.element,n),Se(e)},kt=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},dn=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
- </span></span><span data-type="newline"><br /><span style="display: none">
76
- </span></span></div><div data-block="0"><`)+"</div>",x("SpinVditorSVDOM",e,"result",t.options.debugger),e},ci=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 u=kt(e,"code-block-open-marker");u&&u.previousElementSibling&&(n=u.previousElementSibling,r=o+r)}else r=o+r}else a==="newline"&&(i=!0);n=n.previousElementSibling}return r},Le=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=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),clearTimeout(e.sv.processTimeoutId),e.sv.processTimeoutId=window.setTimeout(function(){t.enableAddUndoStack&&!e.sv.composingLock&&e.undo.addToUndoStack(e)},e.options.undoDelay)},pn=function(e,t){var n=(0,M.zh)(e),r=(0,k.S)(n.startContainer,"SPAN");r&&r.textContent.trim()!==""&&(t=`
77
- `+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},ui=function(e,t,n,r){var i=(0,M.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,M.ib)(e.sv.element,i));var o=(0,s.F9)(i.startContainer),u=(0,k.S)(i.startContainer,"SPAN");if(o){if(a==="link"){var m=void 0;i.toString()===""?m="".concat(n).concat(Lute.Caret).concat(r):m="".concat(n).concat(i.toString()).concat(r.replace(")",Lute.Caret+")")),document.execCommand("insertHTML",!1,m);return}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"||a==="line"){var m=void 0;i.toString()===""?m="".concat(n).concat(Lute.Caret).concat(a==="code"?"":r):m="".concat(n).concat(i.toString()).concat(Lute.Caret).concat(a==="code"?"":r),a==="table"||a==="code"&&u&&u.textContent!==""?m=`
79
-
80
- `+m:a==="line"&&(m=`
81
-
82
- `.concat(n,`
83
- `).concat(Lute.Caret)),document.execCommand("insertHTML",!1,m);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&u){var f="* ";a==="check"?f="* [ ] ":a==="ordered-list"?f="1. ":a==="quote"&&(f="> ");var S=kt(u,"newline");S?S.insertAdjacentText("afterend",f):o.insertAdjacentText("afterbegin",f),le(e);return}(0,M.ib)(e.sv.element,i),Le(e)}},hn=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},mn=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])})},fi=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 u(S){try{f(r.next(S))}catch(T){o(T)}}function m(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,m)}f((r=r.apply(e,t||[])).next())})},di=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:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return m([f,S])}}function m(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},pi=(function(){function e(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"}return e})(),hi=function(e,t){e.tip.hide();var n=[],r="",i="";e.options.lang,e.options;for(var a=function(f,S){var T=t[S],R=!0;T.name||(r+="<li>".concat(window.VditorI18n.nameEmpty,"</li>"),R=!1),T.size>e.options.upload.max&&(r+="<li>".concat(T.name," ").concat(window.VditorI18n.over," ").concat(e.options.upload.max/1024/1024,"M</li>"),R=!1);var P=T.name.lastIndexOf("."),O=T.name.substr(P),W=e.options.upload.filename(T.name.substr(0,P))+O;if(e.options.upload.accept){var U=e.options.upload.accept.split(",").some(function(N){var J=N.trim();if(J.indexOf(".")===0){if(O.toLowerCase()===J.toLowerCase())return!0}else if(T.type.split("/")[0]===J.split("/")[0])return!0;return!1});U||(r+="<li>".concat(T.name," ").concat(window.VditorI18n.fileTypeError,"</li>"),R=!1)}R&&(n.push(T),i+="<li>".concat(W," ").concat(window.VditorI18n.uploading,' <a class="vditorCancelUpload" href="javascript:void(0)">').concat(window.VditorI18n.cancelUpload,"</a></li>"))},o=t.length,u=0;u<o;u++)a(o,u);if(e.tip.show("<ul>".concat(r).concat(i,"</ul>")),e.options.upload.cancel){var m=e.tip.element.querySelector(".vditorCancelUpload");m&&m.addEventListener("click",function(){e.options.upload.cancel(n),e.tip.hide(),e.upload.isUploading=!1})}return n},mi=function(e,t){var n=hn(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 u=o.lastIndexOf("."),m=t.options.upload.filename(o.substr(0,u))+o.substr(u);i+="<li>".concat(m," ").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 u=r.data.succMap[o],m=o.lastIndexOf("."),f=o.substr(m),S=t.options.upload.filename(o.substr(0,m))+f;f=f.toLowerCase(),f.indexOf(".wav")===0||f.indexOf(".mp3")===0||f.indexOf(".ogg")===0?t.currentMode==="wysiwyg"?a+=`<div class="vditor-wysiwyg__block" data-type="html-block"
84
- data-block="0"><pre><code>&lt;audio controls="controls" src="`.concat(u,'"&gt;&lt;/audio&gt;</code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="').concat(u,`"></audio></pre></div>
85
- `):t.currentMode==="ir"?a+='<audio controls="controls" src="'.concat(u,`"></audio>
86
- `):a+="[".concat(S,"](").concat(u,`)
87
- `):f.indexOf(".apng")===0||f.indexOf(".bmp")===0||f.indexOf(".gif")===0||f.indexOf(".ico")===0||f.indexOf(".cur")===0||f.indexOf(".jpg")===0||f.indexOf(".jpeg")===0||f.indexOf(".jfif")===0||f.indexOf(".pjp")===0||f.indexOf(".pjpeg")===0||f.indexOf(".png")===0||f.indexOf(".svg")===0||f.indexOf(".webp")===0?t.currentMode==="wysiwyg"?a+='<img alt="'.concat(S,'" src="').concat(u,`">
88
- `):a+="![".concat(S,"](").concat(u,`)
89
- `):t.currentMode==="wysiwyg"?a+='<a href="'.concat(u,'">').concat(S,`</a>
90
- `):a+="[".concat(S,"](").concat(u,`)
91
- `)}),(0,M.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},Ft=function(e,t,n){return fi(void 0,void 0,void 0,function(){var r,i,O,a,o,o,u,m,f,S,T,R,P,O,W,U;return di(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(u=hn(e),e.upload.range=(0,M.zh)(e),m=hi(e,r),m.length===0)return n&&(n.value=""),[2];for(f=new FormData,S=e.options.upload.extraData,T=0,R=Object.keys(S);T<R.length;T++)P=R[T],f.append(P,S[P]);for(O=0,W=m.length;O<W;O++)f.append(e.options.upload.fieldName,m[O]);return U=new XMLHttpRequest,e.upload.xhr=U,U.open("POST",e.options.upload.url),e.options.upload.token&&U.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(U.withCredentials=!0),mn(e,U),e.upload.isUploading=!0,u.setAttribute("contenteditable","false"),U.onreadystatechange=function(){if(U.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,u.setAttribute("contenteditable","true"),U.status>=200&&U.status<300)if(e.options.upload.success)e.options.upload.success(u,U.responseText);else{var J=U.responseText;e.options.upload.format&&(J=e.options.upload.format(t,U.responseText)),mi(J,e)}else e.options.upload.error?e.options.upload.error(U.responseText):e.tip.show(U.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},U.upload.onprogress=function(J){if(J.lengthComputable){var F=J.loaded/J.total*100;e.upload.element.style.display="block";var Y=e.upload.element;Y.style.width=F+"%"}},U.send(f),[2]}})})},Ct=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=Qr(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(F){F.remove()}),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach(function(F){F.removeAttribute("style")}),i.querySelectorAll(".vditor-comment").forEach(function(F){F.textContent.trim()===""&&(F.classList.remove("vditor-comment","vditor-comment--focus"),F.removeAttribute("data-cmtids"))}),(r=i.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(F){F.textContent.trim()===""&&(F.classList.remove("vditor-comment","vditor-comment--focus"),F.removeAttribute("data-cmtids"))});var o="";i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.wysiwyg.element);var u=i.isEqualNode(e.wysiwyg.element),m=(0,s.a1)(i,"data-type","footnotes-block");if(u)o=i.innerHTML;else{var f=(0,s.O9)(t.startContainer);if(f&&!m){var S=(0,k.S)(t.startContainer,"BLOCKQUOTE");S?i=(0,s.F9)(t.startContainer)||i:i=f}if(m&&(i=m),o=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var T=i.previousElementSibling,R=i.nextElementSibling;T&&(T.tagName==="UL"||T.tagName==="OL")&&(o=T.outerHTML+o,T.remove()),R&&(R.tagName==="UL"||R.tagName==="OL")&&(o=o+R.outerHTML,R.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(F){F&&!i.isEqualNode(F)&&(o+=F.outerHTML,F.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(F){F&&!i.isEqualNode(F)&&(o+=F.outerHTML,F.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),u)i.innerHTML=o;else if(i.outerHTML=o,m){var P=(0,s.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(P){var O=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(P.getAttribute("data-marker"),'"]'));O&&O.setAttribute("aria-label",P.textContent.trim().substr(0,24))}}var W,U=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");U.forEach(function(F,Y){Y===0?W=F:(W.insertAdjacentHTML("beforeend",F.innerHTML),F.remove())}),U.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",U[0]);var N,J=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");J.forEach(function(F,Y){Y===0?N=F:(N.insertAdjacentHTML("beforeend",F.innerHTML),F.remove())}),J.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",J[0]),(0,M.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(F){_e(F,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)))}Fe(e),pe(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},gi=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},gn=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 u(S){try{f(r.next(S))}catch(T){o(T)}}function m(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,m)}f((r=r.apply(e,t||[])).next())})},yn=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:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return m([f,S])}}function m(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},bn=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},wn=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,M.im)(r,t[t.currentMode].element,e).start===0){r.nodeValue&&(r.nodeValue=r.nodeValue.replace(/\u2006/g,""));var i=document.createTextNode(w.g.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},vn=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))}},dt=function(e,t){var n=(0,M.zh)(e),r=(0,s.F9)(n.startContainer);r&&(r.insertAdjacentHTML(t,'<p data-block="0">'.concat(w.g.ZWSP,`<wbr>
92
- </p>`)),(0,M.ib)(e[e.currentMode].element,n),nt(e),re(e))},yi=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.rows[0].cells[0].isSameNode(e)?t:!1},bi=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)?t:!1},En=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,M.Hc)(t)),r},pt=function(e,t,n,r,i){var a=(0,M.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(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!0),(0,M.Hc)(n)),t.preventDefault(),!0}return!1},rt=function(e,t,n,r,i){var a=(0,M.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(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!1),(0,M.Hc)(n)),t.preventDefault(),!0}return!1},_t=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(S){S.remove()}),t.insertNode(document.createElement("wbr")),r&&i){for(var a="",o=0;o<i.parentElement.childElementCount;o++){var u=i.parentElement.children[o].querySelector("input");u&&u.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(S){S.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'.concat(S.textContent.indexOf(" ")===0?"":" ")),S.classList.add("vditor-task")});else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach(function(S){S.querySelector("input").remove(),S.classList.remove("vditor-task")});var f=void 0;n==="list"?(f=document.createElement("ul"),f.setAttribute("data-marker","*")):(f=document.createElement("ol"),f.setAttribute("data-marker","1.")),f.setAttribute("data-block","0"),f.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),f.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(f,i.parentElement)}else{var m=(0,s.a1)(t.startContainer,"data-block","0");m||(e[e.currentMode].element.querySelector("wbr").remove(),m=e[e.currentMode].element.querySelector("p"),m.innerHTML="<wbr>"),n==="check"?(m.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(m.innerHTML,"</li></ul>")),m.remove()):n==="list"?(m.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(m.innerHTML,"</li></ul>")),m.remove()):n==="ordered-list"&&(m.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(m.innerHTML,"</li></ol>")),m.remove())}},Sn=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach(function(m,f){m.nodeType!==3&&t&&m.textContent.trim()!==""&&t.getAttribute("data-node-id")===m.getAttribute("data-node-id")&&(f!==0&&i.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(m){m.remove()}),n.insertNode(document.createElement("wbr"));var a=r.parentElement,o="";i.forEach(function(m){var f=m.getAttribute("data-marker");f.length!==1&&(f="1".concat(f.slice(-1))),o+='<li data-node-id="'.concat(m.getAttribute("data-node-id"),'" data-marker="').concat(f,'">').concat(m.innerHTML,"</li>"),m.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,M.ib)(e[e.currentMode].element,n);var u=(0,s.O9)(n.startContainer);u&&u.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(m){_e(m,e),e.currentMode==="wysiwyg"&&m.previousElementSibling.setAttribute("style","display:none")}),re(e),nt(e)}else e[e.currentMode].element.focus()},qt=function(e,t,n,r){var i=(0,s.lG)(t.parentElement,"LI");if(i){e[e.currentMode].element.querySelectorAll("wbr").forEach(function(T){T.remove()}),n.insertNode(document.createElement("wbr"));var a=t.parentElement,o=a.cloneNode(),u=[t];Array.from(n.cloneContents().children).forEach(function(T,R){T.nodeType!==3&&t&&T.textContent.trim()!==""&&t.getAttribute("data-node-id")===T.getAttribute("data-node-id")&&(R!==0&&u.push(t),t=t.nextElementSibling)});var m=!1,f="";a.querySelectorAll("li").forEach(function(T){m&&(f+=T.outerHTML,!T.nextElementSibling&&!T.previousElementSibling?T.parentElement.remove():T.remove()),T.isSameNode(u[u.length-1])&&(m=!0)}),u.reverse().forEach(function(T){i.insertAdjacentElement("afterend",T)}),f&&(o.innerHTML=f,u[0].insertAdjacentElement("beforeend",o)),e.currentMode==="wysiwyg"?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,M.ib)(e[e.currentMode].element,n);var S=(0,s.O9)(n.startContainer);S&&S.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(T){_e(T,e),e.currentMode==="wysiwyg"&&T.previousElementSibling.setAttribute("style","display:none")}),re(e),nt(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 u=0;u<r;u++)if(e.rows[o].cells[u].isSameNode(n)){a=u;break}for(var m=0;m<i;m++)e.rows[m].cells[a].setAttribute("align",t)},Kt=function(e){var t=e.trimRight().split(`
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},zt=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,"")===""},re=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?pe(e,t):e.currentMode==="ir"?ze(e,t):e.currentMode==="sv"&&Le(e,t)},kn=function(e,t,n,r){var i,a=e.startContainer,o=(0,s.lG)(a,"LI");if(o){if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Enter"&&!r.shiftKey&&n&&o.contains(n)&&n.nextElementSibling)return o&&!o.textContent.endsWith(`
98
- `)&&o.insertAdjacentText("beforeend",`
99
- `),e.insertNode(document.createTextNode(`
100
-
101
- `)),e.collapse(!1),re(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&!o.previousElementSibling&&e.toString()===""&&(0,M.im)(o,t[t.currentMode].element,e).start===0)return o.nextElementSibling?(o.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(o.innerHTML,"</p>")),o.remove()):o.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(o.innerHTML,"</p>"),(0,M.ib)(t[t.currentMode].element,e),re(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&o.textContent.trim().replace(w.g.ZWSP,"")===""&&e.toString()===""&&((i=o.previousElementSibling)===null||i===void 0?void 0:i.tagName)==="LI")return o.previousElementSibling.insertAdjacentText("beforeend",`
102
-
103
- `),e.selectNodeContents(o.previousElementSibling),e.collapse(!1),o.remove(),(0,M.ib)(t[t.currentMode].element,e),re(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?qt(t,o,e,o.parentElement):Sn(t,o,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,M.Hc)(t),re(e),n.preventDefault(),!0},Cn=function(e,t,n,r){if(n){if(!(0,l.yl)(e)&&!e.altKey&&e.key==="Enter"){var i=String.raw(In||(In=gi(["",""],["",""])),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
- `+o.substring(3,o.length-3)+`
105
- |<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(o),(0,M.ib)(t[t.currentMode].element,r),re(t),Se(t),e.preventDefault(),!0}if(Kt(n.innerHTML)&&n.previousElementSibling){var u="",m=n.innerHTML.trimRight().split(`
106
- `);return m.length>1&&(m.pop(),u='<p data-block="0">'.concat(m.join(`
107
- `),"</p>")),n.insertAdjacentHTML("afterend","".concat(u,`<hr data-block="0"><p data-block="0"><wbr>
108
- </p>`)),n.remove(),(0,M.ib)(t[t.currentMode].element,r),re(t),Se(t),e.preventDefault(),!0}if(zt(n.innerHTML))return t.currentMode==="wysiwyg"?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+`<p data-block="0"><wbr>
109
- </p>`):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+`<p data-block="0"><wbr>
110
- </p>`),(0,M.ib)(t[t.currentMode].element,r),re(t),Se(t),e.preventDefault(),!0}if(r.collapsed&&n.previousElementSibling&&e.key==="Backspace"&&!(0,l.yl)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split(`
111
- `).length>1&&(0,M.im)(n,t[t.currentMode].element,r).start===0){var f=(0,s.DX)(n.previousElementSibling);return f.textContent.endsWith(`
112
- `)||(f.textContent=f.textContent+`
113
- `),f.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,M.ib)(t[t.currentMode].element,r),!1}return!1}},_n=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>")),re(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,M.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));re(e)},Mt=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>");re(e)},Mn=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,M.Hc)(t),re(e)}},Tn=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 u=n.rows[o].cells;if(u.length===1){n.remove(),nt(e);break}u[i].remove()}(0,M.Hc)(t),re(e)},An=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),re(e),Se(e),t.preventDefault(),!0}if(t.key==="Tab"){if(t.shiftKey)return En(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,M.Hc)(n)),t.preventDefault(),!0}var u=i.parentElement.parentElement.parentElement;if(t.key==="ArrowUp"){if(t.preventDefault(),i.tagName==="TH")return u.previousElementSibling?(n.selectNodeContents(u.previousElementSibling),n.collapse(!1),(0,M.Hc)(n)):dt(e,"beforebegin"),!0;for(var m=0,f=i.parentElement;m<f.cells.length&&!f.cells[m].isSameNode(i);m++);var S=f.previousElementSibling;return S||(S=f.parentElement.previousElementSibling.firstChild),n.selectNodeContents(S.cells[m]),n.collapse(!1),(0,M.Hc)(n),!0}if(t.key==="ArrowDown"){t.preventDefault();var f=i.parentElement;if(!f.nextElementSibling&&i.tagName==="TD")return u.nextElementSibling?(n.selectNodeContents(u.nextElementSibling),n.collapse(!0),(0,M.Hc)(n)):dt(e,"afterend"),!0;for(var m=0;m<f.cells.length&&!f.cells[m].isSameNode(i);m++);var o=f.nextElementSibling;return o||(o=f.parentElement.nextElementSibling.firstChild),n.selectNodeContents(o.cells[m]),n.collapse(!0),(0,M.Hc)(n),!0}if(e.currentMode==="wysiwyg"&&!(0,l.yl)(t)&&t.key==="Enter"&&!t.shiftKey&&t.altKey){var T=e.wysiwyg.popover.querySelector(".vditor-input");return T.focus(),T.select(),t.preventDefault(),!0}if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Backspace"&&n.startOffset===0&&n.toString()===""){var R=En(i,n,!1);return!R&&u&&(u.textContent.trim()===""?(u.outerHTML=`<p data-block="0"><wbr>
114
- </p>`,(0,M.ib)(e[e.currentMode].element,n)):(n.setStartBefore(u),n.collapse(!0)),re(e)),t.preventDefault(),!0}if(j("⇧⌘F",t))return Ln(e,n,i),t.preventDefault(),!0;if(j("⌘=",t))return _n(e,n,i),t.preventDefault(),!0;if(j("⇧⌘G",t))return Mt(e,u,i,"beforebegin"),t.preventDefault(),!0;if(j("⇧⌘=",t))return Mt(e,u,i),t.preventDefault(),!0;if(j("⌘-",t))return Mn(e,n,i),t.preventDefault(),!0;if(j("⇧⌘-",t))return Tn(e,n,u,i),t.preventDefault(),!0;if(j("⇧⌘L",t)){if(e.currentMode==="ir")return Lt(u,"left"),re(e),t.preventDefault(),!0;var P=e.wysiwyg.popover.querySelector('[data-type="left"]');if(P)return P.click(),t.preventDefault(),!0}if(j("⇧⌘C",t)){if(e.currentMode==="ir")return Lt(u,"center"),re(e),t.preventDefault(),!0;var P=e.wysiwyg.popover.querySelector('[data-type="center"]');if(P)return P.click(),t.preventDefault(),!0}if(j("⇧⌘R",t)){if(e.currentMode==="ir")return Lt(u,"right"),re(e),t.preventDefault(),!0;var P=e.wysiwyg.popover.querySelector('[data-type="right"]');if(P)return P.click(),t.preventDefault(),!0}}return!1},xn=function(e,t,n,r){if(n.tagName==="PRE"&&j("⌘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),re(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey){var i=(0,M.im)(n,e[e.currentMode].element,r);if((i.start===0||i.start===1&&n.innerText===`
115
- `)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,M.ib)(e[e.currentMode].element,r),re(e),t.preventDefault(),!0}return!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"?(n.firstElementChild.textContent.endsWith(`
116
- `)||n.firstElementChild.insertAdjacentText("beforeend",`
117
- `),r.extractContents(),r.insertNode(document.createTextNode(`
118
- `)),r.collapse(!1),(0,M.Hc)(r),(0,l.vU)()||(e.currentMode==="wysiwyg"?Ct(e,r):$e(e,r)),Se(e),t.preventDefault(),!0):!1},Dn=function(e,t,n,r){var i=t.startContainer,a=(0,s.lG)(i,"BLOCKQUOTE");if(a&&t.toString()===""){if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&(0,M.im)(a,e[e.currentMode].element,t).start===0)return t.insertNode(document.createElement("wbr")),a.outerHTML=a.innerHTML,(0,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0;if(r&&n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&r.parentElement.tagName==="BLOCKQUOTE"){var o=!1;if(r.innerHTML.replace(w.g.ZWSP,"")===`
119
- `||r.innerHTML.replace(w.g.ZWSP,"")===""?(o=!0,r.remove()):r.innerHTML.endsWith(`
120
-
121
- `)&&(0,M.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),o=!0),o)return a.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(w.g.ZWSP,`<wbr>
122
- </p>`)),(0,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0}var u=(0,s.F9)(i);if(e.currentMode==="wysiwyg"&&u&&j("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),u.outerHTML='<blockquote data-block="0">'.concat(u.outerHTML,"</blockquote>"),(0,M.ib)(e.wysiwyg.element,t),pe(e),n.preventDefault(),!0;if(pt(e,n,t,a,a)||rt(e,n,t,a,a))return!0}return!1},Hn=function(e,t,n){var r=t.startContainer,i=(0,s.lG)(r,"LI");if(i&&i.classList.contains("vditor-task")){if(j("⇧⌘J",n)){var a=i.firstElementChild;return a.checked?a.removeAttribute("checked"):a.setAttribute("checked","checked"),re(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 u=(0,s.DX)(o);u.parentElement.insertAdjacentHTML("beforeend","<wbr>"+i.innerHTML.trim()),i.remove()}else i.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(i.innerHTML.trim()||`
123
- `,"</p>")),i.nextElementSibling?i.remove():i.parentElement.remove();return(0,M.ib)(e[e.currentMode].element,t),re(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 m=(0,s.O9)(r);m&&qt(e,i,t,m)}else if(i.nextElementSibling){var f="",S="",T=!1;Array.from(i.parentElement.children).forEach(function(W){i.isSameNode(W)?T=!0:T?f+=W.outerHTML:S+=W.outerHTML});var R=i.parentElement.tagName,P=i.parentElement.tagName==="OL"?"":' data-marker="'.concat(i.parentElement.getAttribute("data-marker"),'"'),O="";S&&(O=i.parentElement.tagName==="UL"?"":' start="1"',S="<".concat(R,' data-tight="true"').concat(P,' data-block="0">').concat(S,"</").concat(R,">")),i.parentElement.outerHTML="".concat(S,`<p data-block="0"><wbr>
124
- </p><`).concat(R,`
125
- data-tight="true"`).concat(P,' data-block="0"').concat(O,">").concat(f,"</").concat(R,">")}else i.parentElement.insertAdjacentHTML("afterend",`<p data-block="0"><wbr>
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,M.ib)(e[e.currentMode].element,t),re(e),Se(e),n.preventDefault(),!0}}return!1},On=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,M.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,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0}}return!1},Nn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},Rn=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},Tt=function(e,t,n){return gn(void 0,void 0,void 0,function(){var r,i,a,o,u,m,f,S,T,R,P,O,W,N,U,N,J;return yn(this,function(F){switch(F.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={},u=function(Y,fe){if(!fe)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,Y,fe);var ce=Y.TokensStr();if(Y.__internal_object__.Parent.Type===34&&ce&&ce.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var he=new XMLHttpRequest;he.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&he.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(he.withCredentials=!0),mn(e,he),he.setRequestHeader("Content-Type","application/json; charset=utf-8"),he.onreadystatechange=function(){if(he.readyState===XMLHttpRequest.DONE){if(he.status===200){var Oe=he.responseText;e.options.upload.linkToImgFormat&&(Oe=e.options.upload.linkToImgFormat(he.responseText));var xe=JSON.parse(Oe);if(xe.code!==0){e.tip.show(xe.msg);return}var Ne=xe.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(ke){ke.textContent===Ne&&(ke.textContent=xe.data.url)});else{var te=e[e.currentMode].element.querySelector('img[src="'.concat(Ne,'"]'));te.src=xe.data.url,e.currentMode==="ir"&&(te.previousElementSibling.previousElementSibling.innerHTML=xe.data.url)}re(e)}else e.tip.show(he.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(he.responseText)}},he.send(JSON.stringify({url:ce}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'.concat(Lute.EscapeHTMLStr(ce),"</span>"),Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'.concat(Lute.EscapeHTMLStr(ce),"</span>"),Lute.WalkContinue]},(r.replace(/&amp;/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<a href="'.concat(i,'">').concat(i,"</a>")||r.replace(/&amp;/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<!--StartFragment--><a href="'.concat(i,'">').concat(i,"</a><!--EndFragment-->"))&&(r=""),m=new DOMParser().parseFromString(r,"text/html"),m.body&&(r=m.body.innerHTML),r=Lute.Sanitize(r),e.wysiwyg.getComments(e),f=e[e.currentMode].element.scrollHeight,S=De(r,i,e.currentMode),T=e.currentMode==="sv"?(0,s.a1)(t.target,"data-type","code-block"):(0,s.lG)(t.target,"CODE"),T?(e.currentMode==="sv"?document.execCommand("insertHTML",!1,i.replace(/&/g,"&amp;").replace(/</g,"&lt;")):(R=(0,M.im)(t.target,e[e.currentMode].element),T.parentElement.tagName!=="PRE"&&(i+=w.g.ZWSP),T.textContent=T.textContent.substring(0,R.start)+i+T.textContent.substring(R.end),(0,M.$j)(R.start+i.length,R.start+i.length,T.parentElement),!((J=T.parentElement)===null||J===void 0)&&J.nextElementSibling.classList.contains("vditor-".concat(e.currentMode,"__preview"))&&(T.parentElement.nextElementSibling.innerHTML=T.outerHTML,_e(T.parentElement.nextElementSibling,e))),[3,10]):[3,1]);case 1:return S?(n.pasteCode(S),[3,10]):[3,2];case 2:return r.trim()===""?[3,5]:(P=document.createElement("div"),P.innerHTML=r,e.options.upload.base64ToLink?[3,4]:[4,wi(e,P,("clipboardData"in t?t.clipboardData:t.dataTransfer).getData("text/rtf"))]);case 3:F.sent(),F.label=4;case 4:return P.querySelectorAll("[style]").forEach(function(Y){Y.removeAttribute("style")}),P.querySelectorAll(".vditor-copy").forEach(function(Y){Y.remove()}),e.currentMode==="ir"?(o.HTML2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(e.lute.HTML2VditorIRDOM(P.innerHTML),e)):e.currentMode==="wysiwyg"?(o.HTML2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(e.lute.HTML2VditorDOM(P.innerHTML),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),Wt(e,e.lute.HTML2Md(P.innerHTML).trimRight())),e.outline.render(e),[3,10];case 5:return a.length>0?e.options.upload.url||e.options.upload.handler?[4,Ft(e,a)]:[3,7]:[3,9];case 6:return F.sent(),[3,8];case 7:O=new FileReader,"clipboardData"in t?(a=t.clipboardData.files,W=a[0]):t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items,W=a[0].getAsFile()),W&&W.type.startsWith("image")&&(O.readAsDataURL(W),O.onload=function(){var Y="";e.currentMode==="wysiwyg"?Y+='<img alt="'.concat(W.name,'" src="').concat(O.result.toString(),`">
127
- `):Y+="![".concat(W.name,"](").concat(O.result.toString(),`)
128
- `),document.execCommand("insertHTML",!1,Y)}),F.label=8;case 8:return[3,10];case 9:i.trim()!==""&&a.length===0&&(N=(0,M.zh)(e),N.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(N.toString(),"](").concat(i,")")),e.currentMode==="ir"?(o.Md2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(Lute.Sanitize(e.lute.Md2VditorIRDOM(i)),e)):e.currentMode==="wysiwyg"?(o.Md2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(Lute.Sanitize(e.lute.Md2VditorDOM(i)),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),Wt(e,i)),e.outline.render(e)),F.label=10;case 10:return e.currentMode!=="sv"&&(U=(0,s.F9)((0,M.zh)(e).startContainer),U&&(N=(0,M.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(Y){Y.remove()}),N.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?U.outerHTML=e.lute.SpinVditorDOM(U.outerHTML):U.outerHTML=e.lute.SpinVditorIRDOM(U.outerHTML),(0,M.ib)(e[e.currentMode].element,N)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(Y){_e(Y,e)})),e.wysiwyg.triggerRemoveComment(e),re(e),e[e.currentMode].element.scrollHeight-f>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&Se(e),[2]}})})},wi=function(e,t,n){return gn(void 0,void 0,void 0,function(){var r,i,a,o,u,m,f,S,T,W,R,P,O,W,U,N;return yn(this,function(J){switch(J.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(u=0,m=a;u<m.length;u++)f=m[u],S=void 0,f.includes("\\pngblip")?S="image/png":f.includes("\\jpegblip")&&(S="image/jpeg"),S&&o.push({hex:f.replace(r,"").replace(/[^\da-fA-F]/g,""),type:S});for(T=[],$t(t,function(F){if(F.tagName==="V:SHAPE")return $t(F,function(Y){Y.tagName==="V:IMAGEDATA"&&T.push({shape:F,img:Y})}),!1}),W=0;W<T.length;W++)R=document.createElement("img"),P="data:"+o[W].type+";base64,"+btoa((o[W].hex.match(/\w{2}/g)||[]).map(function(F){return String.fromCharCode(parseInt(F,16))}).join("")),R.src=P,R.title=T[W].img.getAttribute("title"),T[W].shape.parentNode.replaceChild(R,T[W].shape);O=t.querySelectorAll("img"),W=0,J.label=1;case 1:return W<O.length?(U=O[W].src||"",U?(N=O[W],[4,e.options.upload.base64ToLink(U)]):[3,3]):[3,4];case 2:N.src=J.sent(),J.label=3;case 3:return W++,[3,1];case 4:return[2]}})})},$t=function(e,t){var n=t(e);if(n!==!1)for(var r=0;r<e.children.length;r++)$t(e.children[r],t)},In,Pn=function(e){var t,n;e.hint.render(e);var r=(0,M.zh)(e).startContainer,i=(0,s.a1)(r,"data-type","code-block-info");if(i)if(i.textContent.replace(w.g.ZWSP,"")===""&&e.hint.recentLanguage){i.textContent=w.g.ZWSP+e.hint.recentLanguage;var a=(0,M.zh)(e);a.selectNodeContents(i)}else{var o=[],u=i.textContent.substring(0,(0,M.im)(i,e.ir.element).start).replace(w.g.ZWSP,"");(e.options.preview.hljs.langs||w.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(m){m.indexOf(u.toLowerCase())>-1&&o.push({html:m,value:m})}),e.hint.genHTML(o,u,e)}},ze=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&Pn(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.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)},ht=function(e,t){var n=(0,M.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)),$e(e,n.cloneRange()),lt(e)}},At=function(e,t,n){var r=(0,s.a1)(e.startContainer,"data-type",n);if(r){r.firstElementChild.remove(),r.lastElementChild.remove(),e.insertNode(document.createElement("wbr"));var i=document.createElement("div");i.innerHTML=t.lute.SpinVditorIRDOM(r.outerHTML),r.outerHTML=i.firstElementChild.innerHTML.trim()}},vi=function(e,t,n,r){var i=(0,M.zh)(e),a=t.getAttribute("data-type"),o=i.startContainer;o.nodeType===3&&(o=o.parentElement);var u=!0;if(t.classList.contains("vditor-menu--current"))if(a==="quote"){var m=(0,s.lG)(o,"BLOCKQUOTE");m&&(i.insertNode(document.createElement("wbr")),m.outerHTML=m.innerHTML.trim()===""?'<p data-block="0">'.concat(m.innerHTML,"</p>"):m.innerHTML)}else if(a==="link"){var f=(0,s.a1)(i.startContainer,"data-type","a");if(f){var S=(0,s.fb)(i.startContainer,"vditor-ir__link");S?(i.insertNode(document.createElement("wbr")),f.outerHTML=S.innerHTML):f.outerHTML=f.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else a==="italic"?At(i,e,"em"):a==="bold"?At(i,e,"strong"):a==="strike"?At(i,e,"s"):a==="inline-code"?At(i,e,"code"):(a==="check"||a==="list"||a==="ordered-list")&&(_t(e,i,a),u=!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,M.ib)(e.ir.element,i));var T=(0,s.F9)(i.startContainer);if(a==="line"){if(T){var R=`<hr data-block="0"><p data-block="0"><wbr>
129
- </p>`;T.innerHTML.trim()===""?T.outerHTML=R:T.insertAdjacentHTML("afterend",R)}}else if(a==="quote")T&&(i.insertNode(document.createElement("wbr")),T.outerHTML='<blockquote data-block="0">'.concat(T.outerHTML,"</blockquote>"),u=!1,t.classList.add("vditor-menu--current"));else if(a==="link"){var P=void 0;i.toString()===""?P="".concat(n,"<wbr>").concat(r):P="".concat(n).concat(i.toString()).concat(r.replace(")","<wbr>)")),document.execCommand("insertHTML",!1,P),u=!1,t.classList.add("vditor-menu--current")}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"){var P=void 0;i.toString()===""?P="".concat(n,"<wbr>").concat(r):(a==="code"?P="".concat(n,`
130
- `).concat(i.toString(),"<wbr>").concat(r):a==="table"?P="".concat(n).concat(i.toString(),"<wbr>").concat(r):P="".concat(n).concat(i.toString()).concat(r,"<wbr>"),i.deleteContents()),(a==="table"||a==="code")&&(P=`
131
- `+P+`
132
-
133
- `);var O=document.createElement("span");O.innerHTML=P,i.insertNode(O),$e(e,i),a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,M.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(_t(e,i,a,!1),u=!1,g(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,M.ib)(e.ir.element,i),ze(e),u&&lt(e)},Ei=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 u(S){try{f(r.next(S))}catch(T){o(T)}}function m(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,m)}f((r=r.apply(e,t||[])).next())})},Si=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:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return m([f,S])}}function m(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},ki=(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 u=(0,s.a1)(o.startContainer,"data-type","code-block-info");if(u){u.textContent=w.g.ZWSP+a.trimRight(),o.selectNodeContents(u),o.collapse(!1),ze(i),u.parentElement.querySelectorAll("code").forEach(function(T){T.className="language-"+a.trimRight()}),_e(u.parentElement.querySelector(".vditor-ir__preview"),i),n.recentLanguage=a.trimRight();return}}if(i.currentMode==="wysiwyg"&&o.startContainer.nodeType!==3){var m=o.startContainer,f=void 0;if(m.classList.contains("vditor-input")?f=m:f=m.firstElementChild,f&&f.classList.contains("vditor-input")){f.value=a.trimRight(),o.selectNodeContents(f),o.collapse(!1),f.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,M.oC)(i.lute.SpinVditorSVDOM(a),i):i.currentMode==="wysiwyg"?(0,M.oC)(i.lute.SpinVditorDOM(a),i):(0,M.oC)(i.lute.SpinVditorIRDOM(a),i):(0,M.oC)(a,i),n.splitChar===":"&&a.indexOf(":")>-1&&i.currentMode!=="sv"&&o.insertNode(document.createTextNode(" ")),o.collapse(!1),(0,M.Hc)(o),i.currentMode==="wysiwyg"){var S=(0,s.fb)(o.startContainer,"vditor-wysiwyg__block");S&&S.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(S.lastElementChild.innerHTML=S.firstElementChild.innerHTML,_e(S.lastElementChild,i))}else if(i.currentMode==="ir"){var S=(0,s.fb)(o.startContainer,"vditor-ir__marker--pre");S&&S.nextElementSibling.classList.contains("vditor-ir__preview")&&(S.nextElementSibling.innerHTML=S.innerHTML,_e(S.nextElementSibling,i))}re(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(),u=[];Object.keys(o).forEach(function(m){m.indexOf(a.toLowerCase())===0&&(o[m].indexOf(".")>-1?u.push({html:'<img src="'.concat(o[m],'" title=":').concat(m,':"/> :').concat(m,":"),value:":".concat(m,":")}):u.push({html:'<span class="vditor-hint__emoji">'.concat(o[m],"</span>").concat(m),value:o[m]}))}),this.genHTML(u,a,t)}else t.options.hint.extend.forEach(function(m){m.key===n.splitChar&&(clearTimeout(n.timeId),n.timeId=window.setTimeout(function(){return Ei(n,void 0,void 0,function(){var f;return Si(this,function(S){switch(S.label){case 0:return f=this.genHTML,[4,m.hint(a)];case 1:return f.apply(this,[S.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,M.Ny)(a),u=o.left+(r.options.outline.position==="left"?r.outline.element.offsetWidth:0),m=o.top,f="";t.forEach(function(T,R){if(!(R>7)){var P=T.html;if(n!==""){var O=P.lastIndexOf(">")+1,W=P.substr(O),U=W.toLowerCase().indexOf(n.toLowerCase());U>-1&&(W=W.substring(0,U)+"<b>"+W.substring(U,U+n.length)+"</b>"+W.substring(U+n.length),P=P.substr(0,O)+W)}f+='<button type="button" data-value="'.concat(encodeURIComponent(T.value),` "
134
- `).concat(R===0?"class='vditor-hint--current'":"","> ").concat(P,"</button>")}}),this.element.innerHTML=f;var S=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(m+(S||22),"px"),this.element.style.left="".concat(u,"px"),this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(T){T.addEventListener("click",function(R){i.fillEmoji(T,r),R.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top="".concat(m-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(f){var S=t.lastIndexOf(f.key);r.lastIndex<S&&(r.splitChar=f.key,r.lastIndex=S)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),o=a[a.length-1],u=32;if(a.length>1&&o.trim()===o)if(a.length===2&&a[0]===""&&a[1].length<u)i=a[1];else{var m=a[a.length-2].slice(-1);(0,C.X)(m)===" "&&o.length<u&&(i=o)}return i},e})(),Ci=(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,`"
135
- contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),Rt(t,this.element),fn(t,this.element),It(t,this.element),Vt(t,this.element),Ut(t,this.element),Pt(t,this.element),jt(t,this.element,this.copy),Bt(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()),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){Tt(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){b(t,["hint"])}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||$e(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,ze(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||$e(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,ze(t);return}var i=(0,M.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,M.Hc)(i),Se(t)),r.target.tagName==="IMG"){var o=r.target.parentElement.querySelector(".vditor-ir__marker--link");o&&(i.selectNode(o),(0,M.Hc)(i))}var u=(0,s.a1)(r.target,"data-type","a");if(u&&!u.classList.contains("vditor-ir__node--expand")){t.options.link.click?t.options.link.click(u.querySelector(":scope > .vditor-ir__marker--link")):t.options.link.isOpen&&window.open(u.querySelector(":scope > .vditor-ir__marker--link").textContent);return}if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&i.collapsed){var m=n.element.lastElementChild.getBoundingClientRect();r.y>m.top+m.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(w.g.ZWSP,"")===""?(i.selectNodeContents(n.element.lastElementChild),i.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(n.element,i)))}i.toString()===""?V(i,t):setTimeout(function(){V((0,M.zh)(t),t)}),wt(r,t),lt(t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if(r.key==="Enter"&&Se(t),lt(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===`
136
- `)){t.ir.element.innerHTML="";return}var i=(0,M.zh)(t);r.key==="Backspace"?((0,l.vU)()&&i.startContainer.textContent===`
137
- `&&i.startOffset===1&&(i.startContainer.textContent="",V(i,t)),n.element.querySelectorAll(".language-math").forEach(function(o){var u=o.querySelector("br");u&&u.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&Pn(t),V(i,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&V(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",w.g.ZWSP),i.setStart(a.parentElement.nextSibling,1)):i.selectNodeContents(a.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}})},e})(),jn=function(e){if(e.currentMode==="sv")return e.lute.Md2HTML(D(e));if(e.currentMode==="wysiwyg")return e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML);if(e.currentMode==="ir")return e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML)},_i=X(214),Bn=X(436),Li=(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>
138
- <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>=w.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,M.Hc)(o)}je(t)},e})(),Mi=X(280),Ti=(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(m){if(m.target.tagName!=="TEXTAREA"){var f=document.createElement("div");f.className="vditor-reset",f.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,f,"default"),m.preventDefault()}}),this.previewElement.addEventListener("click",function(m){var f=(0,s.lG)(m.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(m.target.tagName==="A"){t.options.link.click?t.options.link.click(m.target):t.options.link.isOpen&&window.open(m.target.getAttribute("href")),m.preventDefault();return}m.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(m.target):t.options.image.isPreview&&(0,$.E)(m.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(m){var f=(0,k.S)(m.target,"BUTTON");if(f){var S=f.getAttribute("data-type"),T=r.find(function(R){return R?.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(R){R.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 m=JSON.parse(o.responseText);if(m.code!==0){t.tip.show(m.msg);return}t.options.preview.transform&&(m.data=t.options.preview.transform(m.data)),r.previewElement.innerHTML=m.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,B.O)(t.preview.previewElement,t.options.preview.hljs),(0,ne.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,ue.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ve.K)(t.preview.previewElement,t.options.cdn),(0,Ce.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,z.P)(t.preview.previewElement,t.options.cdn),(0,Z.v)(t.preview.previewElement,t.options.cdn),(0,_.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,me.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.B)(t.preview.previewElement,t.options.cdn),(0,H.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,Mi.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,ae.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ae.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,M.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e})(),Ai=(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(m){t.options.resize.position==="top"?t.element.style.height=Math.max(u,o+(a-m.clientY))+"px":t.element.style.height=Math.max(u,o+(m.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})(),xi=(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),Rt(t,this.element),It(t,this.element),Vt(t,this.element),Ut(t,this.element),Pt(t,this.element),jt(t,this.element,this.copy),Bt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",ft(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Tt(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)()||le(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,Le(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}le(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"&&Se(t)}})},e})(),Vn=(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,`
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})(),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),p(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",g(t.toolbar.elements,["both"]);break}t.devtools&&t.devtools.renderEchart(t)}},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)}})(),Hi=(function(e){Di(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(w.g.CLASS_MENU_DISABLED)||(a.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Zt("editor",n):Zt("both",n)))}),i}return t})(be),Oi=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"}return e})(),Un=X(580),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=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return w.g.CODE_THEME.forEach(function(m){u+="<button>".concat(m,"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),o.addEventListener((0,l.Le)(),function(m){m.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.hljs.style=m.target.textContent,(0,Un.Y)(m.target.textContent,n.options.cdn),m.preventDefault(),m.stopPropagation())}),i.element.appendChild(o),y(n,o,a,r.level),i}return t})(be),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)}})(),Pi=(function(e){Ii(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 u="";return Object.keys(n.options.preview.theme.list).forEach(function(m){u+='<button data-type="'.concat(m,'">').concat(n.options.preview.theme.list[m],"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),o.addEventListener((0,l.Le)(),function(m){m.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.theme.current=m.target.getAttribute("data-type"),(0,ee.Z)(n.options.preview.theme.current,n.options.preview.theme.path),m.preventDefault(),m.stopPropagation())}),i.element.appendChild(o),y(n,o,a,r.level),i}return t})(be),ji=(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(`
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})(),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)}})(),Vi=(function(e){Bi(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(w.g.CLASS_MENU_DISABLED)&&r.click(a,n)}),i}return t})(be),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)}})(),Wi=(function(e){Ui(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(w.g.CLASS_MENU_DISABLED)||(a.preventDefault(),o.classList.contains("vditor-menu--current")?(o.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",je(n)):(o.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",je(n),n.devtools.renderEchart(n)))}),i}return t})(be),Fi=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"}return e})(),qi=(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)}})(),Ki=(function(e){qi(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(u){var m=n.options.hint.emoji[u];m.indexOf(".")>-1?o+='<button data-value=":'.concat(u,': " data-key=":').concat(u,`:"><img
142
- data-value=":`).concat(u,': " data-key=":').concat(u,':" class="vditor-emojis__icon" src="').concat(m,'"/></button>'):o+='<button data-value="'.concat(m,` "
143
- data-key="`).concat(u,'"><span class="vditor-emojis__icon">').concat(m,"</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
- <span class="vditor-emojis__tip"></span><span>`).concat(n.options.hint.emojiTail||"",`</span>
145
- </div>`),i.element.appendChild(a),y(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,k.S)(i.target,"BUTTON");if(a){i.preventDefault();var o=a.getAttribute("data-value"),u=(0,M.zh)(n),m=o;if(n.currentMode==="wysiwyg"?m=n.lute.SpinVditorDOM(o):n.currentMode==="ir"&&(m=n.lute.SpinVditorIRDOM(o)),o.indexOf(":")>-1&&n.currentMode!=="sv"){var f=document.createElement("div");f.innerHTML=m,m=f.firstElementChild.firstElementChild.outerHTML+" ",(0,M.oC)(m,n)}else u.extractContents(),u.insertNode(document.createTextNode(o)),(0,s.F9)(u.startContainer)||Ht(n,u);u.collapse(!1),(0,M.Hc)(u),r.element.lastElementChild.style.display="none",re(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(i){var a=(0,k.S)(i.target,"BUTTON");a&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=a.getAttribute("data-key"))})},t})(be),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)},zi=function(e){var t=D(e);Wn(e,t,t.substr(0,10)+".md")},Gi=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
- <script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script>
147
- <div id="preview" style="width: 800px"></div>
148
- <script>
149
- window.addEventListener("message", (e) => {
150
- if(!e.data) {
151
- return;
152
- }
153
- Vditor.preview(document.getElementById('preview'), e.data, {
154
- cdn: "`).concat(e.options.cdn,`",
155
- markdown: {
156
- theme: `).concat(JSON.stringify(e.options.preview.theme),`
157
- },
158
- hljs: {
159
- style: "`).concat(e.options.preview.hljs.style,`"
160
- }
161
- });
162
- setTimeout(() => {
163
- window.print();
164
- }, 3600);
165
- }, false);
166
- <\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(D(e),"*")},200)},$i=function(e){var t=jn(e),n='<html><head><link rel="stylesheet" type="text/css" href="'.concat(e.options.cdn,`/dist/index.css"/>
167
- <script src="`).concat(e.options.cdn,"/dist/js/i18n/").concat(e.options.lang,`.js"><\/script>
168
- <script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script></head>
169
- <body><div class="vditor-reset" id="preview">`).concat(t,`</div>
170
- <script>
171
- const previewElement = document.getElementById('preview')
172
- Vditor.setContentTheme('`).concat(e.options.preview.theme.current,"', '").concat(e.options.preview.theme.path,`');
173
- Vditor.codeRender(previewElement);
174
- Vditor.highlightRender(`).concat(JSON.stringify(e.options.preview.hljs),", previewElement, '").concat(e.options.cdn,`');
175
- Vditor.mathRender(previewElement, {
176
- cdn: '`).concat(e.options.cdn,`',
177
- math: `).concat(JSON.stringify(e.options.preview.math),`,
178
- });
179
- Vditor.mermaidRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
180
- Vditor.SMILESRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
181
- Vditor.markmapRender(previewElement, '`).concat(e.options.cdn,`');
182
- Vditor.flowchartRender(previewElement, '`).concat(e.options.cdn,`');
183
- Vditor.graphvizRender(previewElement, '`).concat(e.options.cdn,`');
184
- Vditor.chartRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
185
- Vditor.mindmapRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
186
- Vditor.abcRender(previewElement, '`).concat(e.options.cdn,`');
187
- `).concat(e.options.preview.render.media.enable?"Vditor.mediaRender(previewElement);":"",`
188
- Vditor.speechRender(previewElement);
189
- <\/script>
190
- <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")},Zi=(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)}})(),Ji=(function(e){Zi(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
- <button data-type="pdf">PDF</button>
192
- <button data-type="html">HTML</button>`,o.addEventListener((0,l.Le)(),function(u){var m=u.target;if(m.tagName==="BUTTON"){switch(m.getAttribute("data-type")){case"markdown":zi(n);break;case"pdf":Gi(n);break;case"html":$i(n);break}b(n,["subToolbar"]),u.preventDefault(),u.stopPropagation()}}),i.element.appendChild(o),y(n,o,a,r.level),i}return t})(be),Xi=(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){Xi(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(u){typeof u!="string"&&u.tipPosition&&u.name===o.dataset.type&&(o.className="vditor-tooltipped vditor-tooltipped__".concat(u.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),je(n),Et(n)})},t})(be),Qi=(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)}})(),ea=(function(e){Qi(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)("&lt;⌥⌘1>"),`</button>
193
- <button data-tag="h2" data-value="## ">`).concat(window.VditorI18n.heading2," &lt;").concat((0,l.ns)("⌥⌘2"),`></button>
194
- <button data-tag="h3" data-value="### ">`).concat(window.VditorI18n.heading3," &lt;").concat((0,l.ns)("⌥⌘3"),`></button>
195
- <button data-tag="h4" data-value="#### ">`).concat(window.VditorI18n.heading4," &lt;").concat((0,l.ns)("⌥⌘4"),`></button>
196
- <button data-tag="h5" data-value="##### ">`).concat(window.VditorI18n.heading5," &lt;").concat((0,l.ns)("⌥⌘5"),`></button>
197
- <button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," &lt;").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(w.g.CLASS_MENU_DISABLED)&&(i.blur(),i.classList.contains("vditor-menu--current")?(n.currentMode==="wysiwyg"?(Ot(n),pe(n)):n.currentMode==="ir"&&ht(n,""),i.classList.remove("vditor-menu--current")):(b(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"?(St(n,o.target.getAttribute("data-tag")),pe(n),i.classList.add("vditor-menu--current")):n.currentMode==="ir"?(ht(n,o.target.getAttribute("data-value")),i.classList.add("vditor-menu--current")):pn(n,o.target.getAttribute("data-value")),r.style.display="none"})},t})(be),ta=(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)}})(),na=(function(e){ta(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
- <div style="margin-top: 14px;flex: 1">
199
- <div>Markdown 使用指南</div>
200
- <ul style="list-style: none">
201
- <li><a href="https://ld246.com/article/1583308420519" target="_blank">语法速查手册</a></li>
202
- <li><a href="https://ld246.com/article/1583129520165" target="_blank">基础语法</a></li>
203
- <li><a href="https://ld246.com/article/1583305480675" target="_blank">扩展语法</a></li>
204
- <li><a href="https://ld246.com/article/1582778815353" target="_blank">键盘快捷键</a></li>
205
- </ul>
206
- </div>
207
- <div style="margin-top: 14px;flex: 1">
208
- <div>Vditor 支持</div>
209
- <ul style="list-style: none">
210
- <li><a href="https://github.com/Vanessa219/vditor/issues" target="_blank">Issues</a></li>
211
- <li><a href="https://ld246.com/tag/vditor" target="_blank">官方讨论区</a></li>
212
- <li><a href="https://ld246.com/article/1549638745630" target="_blank">开发手册</a></li>
213
- <li><a href="https://ld246.com/guide/markdown" target="_blank">演示地址</a></li>
214
- </ul>
215
- </div></div>`,0)}),i}return t})(be),ra=(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)}})(),ia=(function(e){ra(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(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,M.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&Sn(n,u,o)}}),i}return t})(be),aa=(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)}})(),oa=(function(e){aa(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
- <p style="text-align: center;margin: 14px 0">
217
- <em>下一代的 Markdown 编辑器,为未来而构建</em>
218
- </p>
219
- <div style="display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center">
220
- <img src="https://unpkg.com/vditor/dist/images/logo.png" style="margin: 0 auto;height: 68px"/>
221
- <div>&nbsp;&nbsp;</div>
222
- <div style="flex: 1;min-width: 250px">
223
- Vditor 是一款浏览器端的 Markdown 编辑器,支持所见即所得、即时渲染(类似 Typora)和分屏预览模式。
224
- 它使用 TypeScript 实现,支持原生 JavaScript 以及 Vue、React、Angular 和 Svelte 等框架。
225
- </div>
226
- </div>
227
- <div style="display: flex;flex-wrap: wrap;">
228
- <ul style="list-style: none;flex: 1;min-width:148px">
229
- <li>
230
- 项目地址:<a href="https://b3log.org/vditor" target="_blank">b3log.org/vditor</a>
231
- </li>
232
- <li>
233
- 开源协议:MIT
234
- </li>
235
- </ul>
236
- <ul style="list-style: none;margin-right: 18px">
237
- <li>
238
- 组件版本:Vditor v`.concat(w.H," / Lute v").concat(Lute.Version,`
239
- </li>
240
- <li>
241
- 赞助捐赠:<a href="https://ld246.com/sponsor" target="_blank">https://ld246.com/sponsor</a>
242
- </li>
243
- </ul>
244
- </div>
245
- </div>`),0)}),i}return t})(be),sa=(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)}})(),la=(function(e){sa(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(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&dt(n,"afterend")}),i}return t})(be),ca=(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)}})(),ua=(function(e){ca(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(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&dt(n,"beforebegin")}),i}return t})(be),fa=(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)}})(),da=(function(e){fa(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(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,M.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&qt(n,u,o,u.parentElement)}}),i}return t})(be),pa=(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)}})(),ha=(function(e){pa(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(w.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})(be),ma=(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)}})(),ga=(function(e){ma(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(w.g.CLASS_MENU_DISABLED)){var o=w.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)):(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)),je(n)}})},t})(be),ya=(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 m=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,m,!0);for(var f=r.length,S=44,T=1,R=0;R<f;R++)u.setInt16(S,r[R]*(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 m=Math.round((o+1)*r),f=0,S=0,T=u;T<m&&T<t.length;T++)f+=t[T],S++;a[o]=f/S,o++,u=m}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})(),ba=(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)}})(),wa=(function(e){ba(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(w.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(m){i=new ya(m),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"});Ft(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})(be),va=(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)}})(),Ea=(function(e){va(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(w.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t})(be),Sa=(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)}})(),ka=(function(e){Sa(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(w.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t})(be),Ca=(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)}})(),_a=(function(e){Ca(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(w.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&Ft(n,i.target.files,i.target)})},t})(be),La=(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(m){u.style.display="none"}),i.toolbar.forEach(function(m,f){m.level=2,u.appendChild(n.genItem(t,m,a+f))}),o.appendChild(u),y(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 ji(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 be(t,n);break;case"emoji":i=new Ki(t,n);break;case"headings":i=new ea(t,n);break;case"|":i=new Fi;break;case"br":i=new Oi;break;case"undo":i=new ka(t,n);break;case"redo":i=new Ea(t,n);break;case"help":i=new na(t,n);break;case"both":i=new Hi(t,n);break;case"preview":i=new ga(t,n);break;case"fullscreen":i=new Yi(t,n);break;case"upload":i=new _a(t,n);break;case"record":i=new wa(t,n);break;case"info":i=new oa(t,n);break;case"edit-mode":i=new li(t,n);break;case"devtools":i=new Wi(t,n);break;case"outdent":i=new da(t,n);break;case"indent":i=new ia(t,n);break;case"outline":i=new ha(t,n);break;case"insert-after":i=new la(t,n);break;case"insert-before":i=new ua(t,n);break;case"code-theme":i=new Ri(t,n);break;case"content-theme":i=new Pi(t,n);break;case"export":i=new Ji(t,n);break;default:i=new Vi(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e})(),Ma=X(173),Ta=(function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new Ma}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"]):d(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?h(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&&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(u){u.diffs.forEach(function(m){m[0]=-m[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){_e(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,M.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),Se(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}Fe(n),re(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),nt(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){_e(u,n)}),this[n.currentMode].undoStack.length>1?h(n.toolbar.elements,["undo"]):d(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?h(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(m){m.firstElementChild&&(m.firstElementChild.classList.contains("language-echarts")||m.firstElementChild.classList.contains("language-plantuml")||m.firstElementChild.classList.contains("language-mindmap")?(m.firstElementChild.removeAttribute("_echarts_instance_"),m.firstElementChild.removeAttribute("data-processed"),m.firstElementChild.innerHTML=m.previousElementSibling.firstElementChild.innerHTML,m.setAttribute("data-render","2")):m.firstElementChild.classList.contains("language-math")&&(m.setAttribute("data-render","2"),m.firstElementChild.textContent=m.firstElementChild.getAttribute("data-math"),m.firstElementChild.removeAttribute("data-math")))});var u=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(m){m.remove()}),n&&r&&(0,M.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e})(),Aa=X(673),xa=(function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:w.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(w.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:w.g.HLJS_OPTIONS,markdown:w.g.MARKDOWN_OPTIONS,math:w.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:w.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,m,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&&(!((m=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||m===void 0)&&m.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,Aa.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
- | --- | --- | --- |
247
- | | | |
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(u){typeof a=="string"&&u.name===a&&(o=u),typeof a=="object"&&u.name===a.name&&(o=Object.assign({},u,a))}),a.toolbar&&(o.toolbar=n.mergeToolbar(a.toolbar)),i.push(o)}),i},e})(),Da=(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
- contenteditable="true" spellcheck="false"></pre>
250
- <div class="vditor-panel vditor-panel--none"></div>
251
- <div class="vditor-panel vditor-panel--none">
252
- <button type="button" aria-label="`).concat(window.VditorI18n.comment,`" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
253
- <svg><use xlink:href="#vditor-icon-comment"></use></svg>
254
- </button>
255
- </div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),Rt(t,this.element),fn(t,this.element),It(t,this.element),Vt(t,this.element),Ut(t,this.element),Pt(t,this.element),jt(t,this.element,this.copy),Bt(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(),u=a.extractContents(),m,f,S=!1,T=!1;u.childNodes.forEach(function(O,W){var U=!1;if(O.nodeType===3?U=!0:O.classList.contains("vditor-comment")?O.classList.contains("vditor-comment")&&O.setAttribute("data-cmtids",O.getAttribute("data-cmtids")+" "+i):U=!0,U)if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&W===0&&o.startOffset>0)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),m=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&W===u.childNodes.length-1&&o.endOffset<o.endContainer.textContent.length)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),f=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0")W===0?S=!0:W===u.childNodes.length-1&&(T=!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&&(m?(R.insertAdjacentHTML("beforeend",m.innerHTML),m.remove()):R.textContent.trim().replace(w.g.ZWSP,"")===""&&S&&R.remove());var P=(0,s.F9)(o.endContainer);P&&(f?(P.insertAdjacentHTML("afterbegin",f.innerHTML),f.remove()):P.textContent.trim().replace(w.g.ZWSP,"")===""&&T&&P.remove()),a.insertNode(u),t.options.comment.add(i,a.toString(),n.getComments(t,!0)),pe(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 u=new Set(o);return a.filter(function(m){return!u.has(m)})};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,M.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 u=(0,s.lG)(r.startContainer,"A"),m=(0,s.lG)(r.endContainer,"A");if(u&&m&&m.isSameNode(u)){var f=u.getAttribute("title")||"";f&&(f=' "'.concat(f,'"')),t.clipboardData.setData("text/plain","[".concat(r.toString(),"](").concat(u.getAttribute("href")).concat(f,")")),t.clipboardData.setData("text/html","");return}var S=document.createElement("div");S.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorDOM2Md(S.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.unbindListener(),window.addEventListener("scroll",this.scrollListener=function(){if(b(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(b(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){Tt(t,r,{pasteCode:function(i){var a=(0,M.zh)(t),o=document.createElement("template");o.innerHTML=i,a.insertNode(o.content.cloneNode(!0));var u=(0,s.a1)(a.startContainer,"data-block","0");u?u.outerHTML=t.lute.SpinVditorDOM(u.outerHTML):t.wysiwyg.element.innerHTML=t.lute.SpinVditorDOM(t.wysiwyg.element.innerHTML),(0,M.ib)(t.wysiwyg.element,a)}})}),this.element.addEventListener("compositionstart",function(){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){var i=(0,k.W)(getSelection().getRangeAt(0).startContainer);if(i&&i.textContent===""){Fe(t);return}(0,l.vU)()||Ct(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,pe(t);return}if(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"){pe(t);return}var i=getSelection().getRangeAt(0),a=(0,s.F9)(i.startContainer);if(a||(Ht(t,i),a=(0,s.F9)(i.startContainer)),!!a){for(var o=(0,M.im)(a,t.wysiwyg.element,i).start,u=!0,m=o-1;m>a.textContent.substr(0,o).lastIndexOf(`
256
- `);m--)if(a.textContent.charAt(m)!==" "&&a.textContent.charAt(m)!==" "){u=!1;break}o===0&&(u=!1);for(var f=!0,m=o-1;m<a.textContent.length;m++)if(a.textContent.charAt(m)!==" "&&a.textContent.charAt(m)!==`
257
- `){f=!1;break}f&&/^#{1,6} $/.test(a.textContent)&&(f=!1);var S=(0,k.W)(getSelection().getRangeAt(0).startContainer);if(S&&S.textContent===""&&(Fe(t),S.remove()),u&&a.getAttribute("data-type")!=="code-block"||f||zt(a.innerHTML)||Kt(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(D(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&a.previousElementSibling.remove(),Ct(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,M.Hc)(getSelection().getRangeAt(0)),pe(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?cn(t,r.target):ii(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,M.zh)(t);if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&o.collapsed){var u=n.element.lastElementChild.getBoundingClientRect();r.y>u.top+u.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(w.g.ZWSP,"")===""?(o.selectNodeContents(n.element.lastElementChild),o.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(n.element,o)))}Ye(t);var m=(0,s.fb)(r.target,"vditor-wysiwyg__preview");m||(m=(0,s.fb)((0,M.zh)(t).startContainer,"vditor-wysiwyg__preview")),m&&ct(m,t),wt(r,t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){r.key==="Enter"&&Se(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===`
258
- `)&&(t.wysiwyg.element.innerHTML="");var i=(0,M.zh)(t);if(r.key==="Backspace"&&(0,l.vU)()&&i.startContainer.textContent===`
259
- `&&i.startOffset===1&&(i.startContainer.textContent=""),Ht(t,i),Ye(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"?ct(a,t):ct(a,t,!1);return}var m=a.previousElementSibling;if(m.tagName==="PRE"&&(m=m.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,f=ti(o);if(f&&f.nodeType!==3){var S=f.querySelector(".vditor-wysiwyg__preview");if(S){ct(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(m),i.collapse(!1)}}}})},e})(),Ha=(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)}})(),Oa=(function(e){Ha(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=w.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 xa(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",m=u+o.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(f){f.id!==m&&document.head.removeChild(f)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),m).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 Vn;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,ge(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,ee.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,Un.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,w.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,w.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 ft(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return ft(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return ft(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,M.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,M.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&&le(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&Ct(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&$e(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,M.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,M.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):Wt(this.vditor,n),this.vditor.outline.render(this.vditor),re(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>"),Le(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?un(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){_e(a,i.vditor)}),ze(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){dt(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(),on(),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(m,f){if(m===o)return u.splice(f,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,M.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)})}),pe(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 ki(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new Li(window.VditorI18n.outline),tip:new Vn},this.vditor.sv=new xi(this.vditor),this.vditor.undo=new Ta,this.vditor.wysiwyg=new Da(this.vditor),this.vditor.ir=new Ci(this.vditor),this.vditor.toolbar=new La(this.vditor),r.resize.enable&&(this.vditor.resize=new Ai(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new pi),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,_i.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 Ti(i.vditor),Re(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t})(I.default);const Na=Oa})(),we=we.default,we})()})})(yt)),yt.exports}var Xn=Jn();const Yn=$n(Xn),Qn={class:"sus-comment relative flex flex-row w-full"},er={key:0,class:"sus-comment__main absolute top-1 left-1 flex space-x-2 w-full"},tr={key:1,class:"sus-comment-avatar"},nr=["src"],rr={class:"sus-comment__main"},ir={class:"sus-comment__info my-1"},ar={key:0,class:"sus-comment__info-input"},or=["placeholder"],sr=["aria-label"],lr=["placeholder"],cr=["aria-label"],ur=["placeholder"],fr=["id"],dr={class:"sus-comment__footer flex justify-between"},pr={class:"flex items-center"},hr=["aria-label"],mr={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},gr={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},yr=L.defineComponent({__name:"index",props:{vId:{default:"sus-vditor"},editor:{},reply:{},infoBar:{},comment:{}},emits:["on-save","on-cancel","update-avatar"],setup(q,{emit:Me}){class se{articleId="";userName="";userEmail="";userWebsite="";userAvatar="";content="";contentMD="";replyName="";parentId="";notify=1}const Q=q,X=Me,we=Q.reply.userName,I=L.reactive(new se),w=L.ref(null),C=L.ref(""),D=L.ref(""),A=L.ref(""),c=L.ref(""),l=L.ref("收到回复后通知"),g=L.ref(!0),p={enable:Q.infoBar?.enable,name:{show:Q.infoBar?.name?.show,placeholder:Q.infoBar?.name?.placeholder||"昵称(必填)"},website:{show:Q.infoBar?.website?.show,placeholder:Q.infoBar?.website?.placeholder||"网址(https://)",tips:Q.infoBar?.website?.tips||"点击昵称时可跳转"},email:{show:Q.infoBar?.email?.show,placeholder:Q.infoBar?.email?.placeholder||"邮箱(不会公开,仅用于通知回复)",tips:Q.infoBar?.email?.tips||"输入QQ邮箱自动获取头像"}},h={placeholder:Q.editor?.placeholder||"支持常见的markdown语法,如图片、代码块等",emojis:Q.editor?.emojis||[],toolBar:Q.editor?.toolBar||["emoji","link","code","inline-code"],hljs:Q.editor?.hljs||["java","html","javascript","typescript"],cache:Q.editor?.cache==null?!0:Q.editor.cache,cdn:Q.editor?.cdn||"https://unpkg.com/vditor@3.11.2"};function d(){Q.comment&&(I.notify=Q.comment.notify||1,I.userName=Q.comment.userName||"",I.userEmail=Q.comment.userEmail||"",I.userWebsite=Q.comment.userWebsite||"",I.userAvatar=Q.comment.userAvatar||"",I.content=Q.comment.content||"",I.articleId=Q.comment.articleId||"",I.notify==0&&(l.value="收到回复后不通知"))}async function E(){if(!w.value){X("on-save",I);return}if(C.value=w.value?.getHTML(),D.value=w.value?.getValue(),I.userWebsite&&(I.userWebsite.concat("http://")||I.userWebsite.concat("https://")||(I.userWebsite="https://"+I.userWebsite)),localStorage.setItem("user",JSON.stringify(I)),Q.reply.id!="0"){const x=Q.reply.parentId;I.parentId=x==="0"?Q.reply.id:x,I.replyName=Q.reply.userName,h.placeholder="@"+we+":"}I.content=C.value,I.contentMD=D.value,X("on-save",I),A.value="",w.value.setValue("")}function v(){X("on-cancel")}function b(){w.value=new Yn(Q.vId,{after:()=>{},placeholder:h.placeholder,theme:"classic",cache:{enable:h.cache},icon:"material",cdn:h.cdn,toolbar:h.toolBar,hint:{emoji:h.emojis},preview:{hljs:{enable:!0,style:"base16-snazzy",langs:h.hljs}}})}function y(){X("update-avatar",I)}function s(){I.notify==1?(I.notify=0,l.value="收到回复后不通知"):(I.notify=1,l.value="收到回复后通知")}function k(){const x=setInterval(function(){document.querySelector(".vditor-content")&&(clearInterval(x),g.value=!1)},100)}return L.onMounted(()=>{b(),k(),d();const x=localStorage.getItem("user");if(x){const H=JSON.parse(x);I.userName=H.userName,I.userEmail=H.userEmail,I.userWebsite=H.userWebsite,y()}}),(x,H)=>(L.openBlock(),L.createElementBlock("div",Qn,[g.value?(L.openBlock(),L.createElementBlock("div",er,[...H[3]||(H[3]=[L.createStaticVNode('<div class="animate-pulse bg-gray-300 h-12 w-12 rounded-full" data-v-477ecb90></div><div class="space-y-2 w-4/5 mt-3" data-v-477ecb90><div class="animate-pulse rounded-md bg-gray-300 h-4 w-full" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-full" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-10/12" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-10/12" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-8/12" data-v-477ecb90></div></div>',2)])])):L.createCommentVNode("",!0),p.enable?L.withDirectives((L.openBlock(),L.createElementBlock("div",tr,[L.createElementVNode("img",{alt:"",src:c.value,class:"sus-avatar",onerror:"this.onerror=null,this.src='' +''"},null,8,nr)],512)),[[L.vShow,!g.value]]):L.createCommentVNode("",!0),L.createElementVNode("div",rr,[L.withDirectives(L.createElementVNode("div",ir,[p.name.show?(L.openBlock(),L.createElementBlock("div",ar,[L.withDirectives(L.createElementVNode("input",{class:"sus-input sus-username",placeholder:p.name.placeholder,"onUpdate:modelValue":H[0]||(H[0]=_=>I.userName=_),maxlength:"23"},null,8,or),[[L.vModelText,I.userName]])])):L.createCommentVNode("",!0),p.website.show?(L.openBlock(),L.createElementBlock("div",{key:1,class:"sus-comment__info-input vditor-tooltipped vditor-tooltipped__n","aria-label":p.website.tips},[L.withDirectives(L.createElementVNode("input",{class:"sus-input sus-web",placeholder:p.website.placeholder,"onUpdate:modelValue":H[1]||(H[1]=_=>I.userWebsite=_),maxlength:"35"},null,8,lr),[[L.vModelText,I.userWebsite]])],8,sr)):L.createCommentVNode("",!0),p.email.show?(L.openBlock(),L.createElementBlock("div",{key:2,class:"sus-comment__info-input vditor-tooltipped vditor-tooltipped__n","aria-label":p.email.tips},[L.withDirectives(L.createElementVNode("input",{onBlur:y,class:"sus-input sus-email",placeholder:p.email.placeholder,"onUpdate:modelValue":H[2]||(H[2]=_=>I.userEmail=_),maxlength:"35"},null,40,ur),[[L.vModelText,I.userEmail]])],8,cr)):L.createCommentVNode("",!0)],512),[[L.vShow,!g.value]]),L.createElementVNode("div",{id:q.vId,class:"sus-comment__editor h-full w-full"},null,8,fr),L.withDirectives(L.createElementVNode("div",dr,[L.createElementVNode("div",pr,[L.createElementVNode("div",{onClick:s,class:"sus-comment__footer-notify vditor-tooltipped vditor-tooltipped__ne p-1 opacity-70","aria-label":l.value},[I.notify==0?(L.openBlock(),L.createElementBlock("svg",mr,[...H[4]||(H[4]=[L.createElementVNode("path",{fill:"currentColor",d:"M17.5 13a4.5 4.5 0 0 0-4.5 4.5a4.5 4.5 0 0 0 4.5 4.5a4.5 4.5 0 0 0 4.5-4.5a4.5 4.5 0 0 0-4.5-4.5m0 1.5a3 3 0 0 1 3 3a3 3 0 0 1-.42 1.5L16 14.92a3 3 0 0 1 1.5-.42M14.92 16L19 20.08a3 3 0 0 1-1.5.42a3 3 0 0 1-3-3a3 3 0 0 1 .42-1.5M12 2c-1.1 0-2 .9-2 2v.29C7.12 5.14 5 7.82 5 11v6l-2 2v1h8.5a6.5 6.5 0 0 1-.47-2H7v-7a5 5 0 0 1 5-5a5 5 0 0 1 5 5a7 7 0 0 1 .5 0a6.5 6.5 0 0 1 1.5.18V11c0-3.18-2.12-5.86-5-6.71V4a2 2 0 0 0-2-2m-2 19a2 2 0 0 0 2 2c.5 0 .97-.19 1.33-.5a6.5 6.5 0 0 1-1.3-1.5Z"},null,-1)])])):(L.openBlock(),L.createElementBlock("svg",gr,[...H[5]||(H[5]=[L.createStaticVNode('<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" data-v-477ecb90><g data-v-477ecb90><path stroke-dasharray="4" stroke-dashoffset="4" d="M12 3V5" data-v-477ecb90><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.2s" values="4;0" data-v-477ecb90></animate></path><path stroke-dasharray="28" stroke-dashoffset="28" d="M12 5C8.68629 5 6 7.68629 6 11L6 17C5 17 4 18 4 19H12M12 5C15.3137 5 18 7.68629 18 11L18 17C19 17 20 18 20 19H12" data-v-477ecb90><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.2s" dur="0.4s" values="28;0" data-v-477ecb90></animate></path><animateTransform attributeName="transform" begin="0.8s" dur="6s" keyTimes="0;0.05;0.15;0.2;1" repeatCount="indefinite" type="rotate" values="0 12 3;3 12 3;-3 12 3;0 12 3;0 12 3" data-v-477ecb90></animateTransform></g><path stroke-dasharray="8" stroke-dashoffset="8" d="M10 20C10 21.1046 10.8954 22 12 22C13.1046 22 14 21.1046 14 20" data-v-477ecb90><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="8;0" data-v-477ecb90></animate><animateTransform attributeName="transform" begin="1s" dur="6s" keyTimes="0;0.05;0.15;0.2;1" repeatCount="indefinite" type="rotate" values="0 12 8;6 12 8;-6 12 8;0 12 8;0 12 8" data-v-477ecb90></animateTransform></path></g>',1)])]))],8,hr)]),L.createElementVNode("div",{class:"sus-comment__footer-send flex justify-end my-2"},[L.createElementVNode("button",{class:"sus-button cancel mx-2",onClick:v},"取消"),L.createElementVNode("button",{class:"sus-button ok",onClick:E},"发送")])],512),[[L.vShow,!g.value]])])]))}}),st=(q,Me)=>{const se=q.__vccOpts||q;for(const[Q,X]of Me)se[Q]=X;return se},en=st(yr,[["__scopeId","data-v-477ecb90"]]);function br(q){const Me=new Date(q),se=Me.getFullYear(),Q=Me.getMonth()+1,X=Me.getDate(),we=new Date,I=we.getFullYear(),w=we.getMonth()+1,C=we.getDate();if(I===se&&w==Q){const D=C-X;if(D===0)return"今天";if(D<7)return D+"天前"}return I===se?`${Q}月${X}日`:`${se}年${Q}月${X}日`}const wr={class:"sus-item__container relative"},vr={class:"flex flex-row"},Er={class:"sus-item__operate absolute flex"},Sr={class:"sus-comment-aside"},kr={class:"sus-comment-avatar"},Cr=["src"],_r={class:"sus-item__main w-full overflow-hidden"},Lr={class:"sus-item__user leading-loose"},Mr=["rel","href"],Tr={key:0,class:"sus-item-tag mx-1",title:"博主"},Ar={key:1,class:"sus-item__content-name mx-1.5"},xr={class:"sus-item__user-date ml-3"},Dr={class:"sus-item__content"},Hr=["innerHTML"],Or={key:0,class:"sus-item__info flex justify-end mx-1 -mt-1"},Nr={class:"sus-item__info-ip flex items-center"},bt=st(L.defineComponent({__name:"item",props:{comment:{},lineHeight:{},showFooter:{type:Boolean,default:!0}},emits:["on-reply","on-edit","on-remove"],setup(q,{emit:Me}){const se=q,Q=L.ref(),X=L.ref(),we=L.ref(!1);se.comment.showReply=se.comment.showReply===void 0?!0:se.comment.showReply;const I=Me;function w(){Q.value.style.display="block",we.value=!1}function C(){const p=Q?.value?.clientHeight||0,h=se.lineHeight*5;p>=h&&(we.value=!0)}function D(){I("on-reply",se.comment)}function A(){I("on-edit",se.comment)}function c(){I("on-remove",se.comment)}function l(){se.comment.userAvatar||(se.comment.userAvatar="/error.webp")}function g(){const p=new Date(se.comment?.createdDate),h=new Date,d=new Date(h.getFullYear()-1,h.getMonth(),h.getDate());return p>d?"ugc noopener nofollow":"ugc noopener noreferrer nofollow"}return L.onMounted(()=>{l(),C()}),(p,h)=>(L.openBlock(),L.createElementBlock("div",wr,[L.createElementVNode("div",vr,[L.createElementVNode("div",Er,[L.withDirectives(L.createElementVNode("span",{onClick:c,class:"sus-item__operate-delete cursor-pointer"}," 删除 ",512),[[L.vShow,q.comment.showDelete]]),L.withDirectives(L.createElementVNode("span",{onClick:A,class:"sus-item__operate-edit cursor-pointer"}," 编辑 ",512),[[L.vShow,q.comment.showEdit]]),L.withDirectives(L.createElementVNode("span",{onClick:D,class:"sus-item__operate-reply cursor-pointer"}," 回复 ",512),[[L.vShow,q.comment.showReply]])]),L.createElementVNode("div",Sr,[L.createElementVNode("div",kr,[L.withDirectives(L.createElementVNode("img",{alt:"",class:"sus-avatar",src:q.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,Cr),[[L.vShow,!!q.comment.userAvatar]]),L.withDirectives(L.createElementVNode("span",{class:"sus-avatar-text flex w-full h-full items-center justify-center"},L.toDisplayString(q.comment.userName.charAt(0)),513),[[L.vShow,!q.comment.userAvatar]])])]),L.createElementVNode("div",_r,[L.createElementVNode("div",Lr,[L.createElementVNode("a",{target:"_blank",rel:g(),href:q.comment.userWebsite,class:L.normalizeClass([q.comment.tagName,"sus-item__user-name font-semibold ml-1 cursor-pointer"])},L.toDisplayString(q.comment.userName),11,Mr),q.comment.tagName==="owner"?(L.openBlock(),L.createElementBlock("span",Tr," 博主 ")):L.createCommentVNode("",!0),q.comment.replyName?(L.openBlock(),L.createElementBlock("span",Ar,"@"+L.toDisplayString(q.comment.replyName),1)):L.createCommentVNode("",!0),L.createElementVNode("span",xr,L.toDisplayString(L.unref(br)(q.comment.createdDate)),1)]),L.createElementVNode("div",Dr,[L.createElementVNode("span",{ref_key:"contentDom",ref:Q,class:"sus-item__content-text",innerHTML:q.comment.content},null,8,Hr),we.value?(L.openBlock(),L.createElementBlock("a",{key:0,ref_key:"showMoreDom",ref:X,class:"sus-show-detail my-1.5 cursor-pointer",onClick:w},"显示更多>",512)):L.createCommentVNode("",!0)])])]),q.showFooter&&q.comment.area?(L.openBlock(),L.createElementBlock("div",Or,[L.createElementVNode("span",Nr,[h[0]||(h[0]=L.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 28 28"},[L.createElementVNode("path",{fill:"currentColor",d:"M14 2.25A9.75 9.75 0 0 1 23.75 12c0 4.12-2.895 8.61-8.61 13.518a1.75 1.75 0 0 1-2.283-.002l-.378-.328C7.017 20.408 4.25 16.028 4.25 12A9.75 9.75 0 0 1 14 2.25m0 1.5A8.25 8.25 0 0 0 5.75 12c0 3.502 2.548 7.537 7.714 12.057l.373.323a.25.25 0 0 0 .326 0c5.416-4.652 8.087-8.795 8.087-12.38A8.25 8.25 0 0 0 14 3.75m0 4.5a3.75 3.75 0 1 1 0 7.5a3.75 3.75 0 0 1 0-7.5m0 1.5a2.25 2.25 0 1 0 0 4.5a2.25 2.25 0 0 0 0-4.5"})],-1)),L.createTextVNode(" "+L.toDisplayString(q.comment.area),1)])])):L.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-7ef78641"]]),Rr={class:"sus-comment__item"},Ir={key:0,class:"sus-comment__item-child"},Pr={key:1},jr={key:0,class:"sus-comment__item-footer flex justify-center w-full cursor-pointer"},tn=st(L.defineComponent({__name:"index",props:{comment:{},lineHeight:{default:23},showFooter:{type:Boolean,default:!0}},emits:["on-reply","on-edit","on-remove"],setup(q,{emit:Me}){const se=L.ref(!1),Q=Me;function X(w){Q("on-reply",w)}function we(w){Q("on-edit",w)}function I(w){Q("on-remove",w)}return(w,C)=>(L.openBlock(),L.createElementBlock("div",Rr,[L.createVNode(bt,{comment:q.comment,onOnReply:C[0]||(C[0]=D=>X(q.comment)),onOnEdit:C[1]||(C[1]=D=>we(q.comment)),onOnRemove:C[2]||(C[2]=D=>I(q.comment)),lineHeight:q.lineHeight,showFooter:q.showFooter},null,8,["comment","lineHeight","showFooter"]),q.comment.child?.length>0?(L.openBlock(),L.createElementBlock("div",Ir,[L.createVNode(bt,{onOnReply:C[3]||(C[3]=D=>X(q.comment.child[0])),onOnEdit:C[4]||(C[4]=D=>we(q.comment.child[0])),onOnRemove:C[5]||(C[5]=D=>I(q.comment.child[0])),comment:q.comment.child[0],showFooter:q.showFooter,lineHeight:q.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"]),q.comment.child?.length>1?(L.openBlock(),L.createBlock(bt,{key:0,onOnReply:C[6]||(C[6]=D=>X(q.comment.child[1])),onOnEdit:C[7]||(C[7]=D=>we(q.comment.child[1])),onOnRemove:C[8]||(C[8]=D=>I(q.comment.child[1])),comment:q.comment.child[1],showFooter:q.showFooter,lineHeight:q.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"])):L.createCommentVNode("",!0),q.comment.child?.length>2?(L.openBlock(),L.createElementBlock("div",Pr,[se.value?L.createCommentVNode("",!0):(L.openBlock(),L.createElementBlock("div",jr,[L.createElementVNode("p",{class:"sus-load-more",onClick:C[9]||(C[9]=D=>se.value=!0)}," 查看更多回复 > ")])),se.value?(L.openBlock(!0),L.createElementBlock(L.Fragment,{key:1},L.renderList(q.comment.child.slice(2),(D,A)=>(L.openBlock(),L.createBlock(bt,{onOnReply:c=>X(D),onOnEdit:c=>we(D),onOnRemove:c=>I(D),key:A,comment:D,showFooter:q.showFooter,lineHeight:q.lineHeight,class:"sus-comment__item-child__item"},null,8,["onOnReply","onOnEdit","onOnRemove","comment","showFooter","lineHeight"]))),128)):L.createCommentVNode("",!0)])):L.createCommentVNode("",!0)])):L.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-b7810121"]]),Br={class:"sus-top-item flex items-start p-1.5 overflow-hidden"},Vr={class:"sus-top-item__info flex flex-col mr-1"},Ur={class:"sus-top-item__user whitespace-nowrap"},Wr={key:0,class:"sus-top-item__reply whitespace-nowrap"},Fr=["innerHTML"],nn=st(L.defineComponent({__name:"simple",props:{comment:{}},setup(q){return(Me,se)=>(L.openBlock(),L.createElementBlock("div",Br,[L.createElementVNode("div",Vr,[L.createElementVNode("span",Ur,L.toDisplayString(q.comment.userName)+": ",1),q.comment.replyName?(L.openBlock(),L.createElementBlock("span",Wr,L.toDisplayString("@"+q.comment.replyName),1)):L.createCommentVNode("",!0)]),L.createElementVNode("span",{class:"sus-top-item__content w-full",innerHTML:q.comment.content},null,8,Fr)]))}}),[["__scopeId","data-v-7407d86d"]]),qr={class:"sus-top-item__user flex items-center"},Kr={key:0,class:"sus-top-item__user-avatar ml-1 mr-2"},zr=["src"],Gr={class:"sus-top-item__user-owner"},$r={class:"sus-top-item__user-reply ml-3 opacity-70"},Zr=["innerHTML"],rn=st(L.defineComponent({__name:"index",props:{comment:{}},emits:["go-local"],setup(q,{emit:Me}){const se=Me;function Q(){se("go-local")}return(X,we)=>(L.openBlock(),L.createElementBlock("div",{class:"sus-top-item p-1.5 cursor-pointer overflow-hidden",onClick:Q},[L.createElementVNode("div",qr,[q.comment.userAvatar?(L.openBlock(),L.createElementBlock("div",Kr,[L.createElementVNode("img",{alt:"",class:"sus-avatar",loading:"lazy",decoding:"async",src:q.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,zr)])):L.createCommentVNode("",!0),L.createElementVNode("div",Gr,L.toDisplayString(q.comment.userName),1),L.createElementVNode("div",$r,L.toDisplayString(q.comment.replyName?"@"+q.comment.replyName:""),1)]),L.createElementVNode("div",{class:"sus-top-item__content p-1",innerHTML:q.comment.content},null,8,Zr)]))}}),[["__scopeId","data-v-1e2f9488"]]),Jr=[en,tn,rn,nn],Xr={install(q){Jr.forEach(Me=>{q.component(Me.name,Me)})}};Ue.SuSComment=en,Ue.SuSList=tn,Ue.SuSSimpleTop=nn,Ue.SuSTop=rn,Ue.default=Xr,Object.defineProperties(Ue,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));