@dcodegroup-au/dsg-vue 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DsgDatepicker.vue_vue_type_style_index_0_lang-DDMs4q6M.cjs → DsgTablePerPage.vue_vue_type_style_index_0_lang-CnRogxoI.cjs} +1197 -1192
- package/dist/{DsgDatepicker.vue_vue_type_style_index_0_lang-CMJ0kV_S.js → DsgTablePerPage.vue_vue_type_style_index_0_lang-DvL9jhXe.js} +11920 -9574
- package/dist/components/Editor/DsgEditor.vue.d.ts +1 -0
- package/dist/components/Elements/DsgAlert.vue.d.ts +1 -0
- package/dist/components/Elements/DsgDatepicker.vue.d.ts +2 -2
- package/dist/components/Elements/DsgInputSelect.vue.d.ts +58 -0
- package/dist/components/Elements/DsgModal.vue.d.ts +3 -0
- package/dist/components/Elements/ElementComponents.d.ts +2 -1
- package/dist/components/Table/DsgTable.vue.d.ts +7 -4
- package/dist/components/Table/DsgTableComponent.vue.d.ts +3 -3
- package/dist/components/Table/DsgTableFilter.vue.d.ts +1 -0
- package/dist/dsg-vue.cjs +2 -2
- package/dist/dsg-vue.css +4 -4
- package/dist/dsg-vue.editor.cjs +75 -75
- package/dist/dsg-vue.editor.esm.js +1088 -1076
- package/dist/dsg-vue.esm.js +2907 -1592
- package/dist/dsg-vue.table.cjs +2 -7
- package/dist/dsg-vue.table.esm.js +550 -2857
- package/dist/dsg-vue.tailwind.cjs +1 -1
- package/dist/dsg-vue.tailwind.esm.js +138 -120
- package/dist/main.d.ts +1444 -344
- package/dist/table.d.ts +53 -44
- package/dist/tailwind/plugins/DsgFocusRingPlugin.d.ts +14 -1
- package/dist/tailwind.d.ts +1 -0
- package/package.json +17 -17
- package/tsconfig.json +1 -0
- package/vite.config.ts +1 -0
package/dist/dsg-vue.editor.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
* Vditor v3.11.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const fe=require("vue"),Si=require("./_commonjsHelpers-DwGv2jUC.cjs"),Ci=require("./DsgLabel.vue_vue_type_style_index_0_lang-gCBicmCZ.cjs");var kt={exports:{}};/*!
|
|
2
|
+
* Vditor v3.11.1 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
*/var Li=kt.exports,In;function Mi(){return In||(In=1,function(Oe,Gt){(function(nt,Y){Oe.exports=Y()})(Li,function(){return(()=>{var dt={173:Z=>{var E=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},L=-1,x=1,A=0;E.Diff=function(c,l){return[c,l]},E.prototype.diff_main=function(c,l,y,p){typeof p>"u"&&(this.Diff_Timeout<=0?p=Number.MAX_VALUE:p=new Date().getTime()+this.Diff_Timeout*1e3);var m=p;if(c==null||l==null)throw new Error("Null input. (diff_main)");if(c==l)return c?[new E.Diff(A,c)]:[];typeof y>"u"&&(y=!0);var f=y,v=this.diff_commonPrefix(c,l),w=c.substring(0,v);c=c.substring(v),l=l.substring(v),v=this.diff_commonSuffix(c,l);var b=c.substring(c.length-v);c=c.substring(0,c.length-v),l=l.substring(0,l.length-v);var g=this.diff_compute_(c,l,f,m);return w&&g.unshift(new E.Diff(A,w)),b&&g.push(new E.Diff(A,b)),this.diff_cleanupMerge(g),g},E.prototype.diff_compute_=function(c,l,y,p){var m;if(!c)return[new E.Diff(x,l)];if(!l)return[new E.Diff(L,c)];var f=c.length>l.length?c:l,v=c.length>l.length?l:c,w=f.indexOf(v);if(w!=-1)return m=[new E.Diff(x,f.substring(0,w)),new E.Diff(A,v),new E.Diff(x,f.substring(w+v.length))],c.length>l.length&&(m[0][0]=m[2][0]=L),m;if(v.length==1)return[new E.Diff(L,c),new E.Diff(x,l)];var b=this.diff_halfMatch_(c,l);if(b){var g=b[0],
|
|
27
|
-
`,s),C==-1&&(C=b.length-1);var D=b.substring(s,C+1);(p.hasOwnProperty?p.hasOwnProperty(D):p[D]!==void 0)?g+=String.fromCharCode(p[D]):(_==f&&(D=b.substring(s),C=b.length),g+=String.fromCharCode(_),p[D]=_,y[_++]=D),s=C+1}return g}var f=4e4,v=m(c);f=65535;var w=m(l);return{chars1:v,chars2:w,lineArray:y}},E.prototype.diff_charsToLines_=function(c,l){for(var y=0;y<c.length;y++){for(var p=c[y][1],m=[],f=0;f<p.length;f++)m[f]=l[p.charCodeAt(f)];c[y][1]=m.join("")}},E.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,f=0;y<m;)c.substring(f,m)==l.substring(f,m)?(y=m,f=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,f=0;y<m;)c.substring(c.length-m,c.length-f)==l.substring(l.length-m,l.length-f)?(y=m,f=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonOverlap_=function(c,l){var y=c.length,p=l.length;if(y==0||p==0)return 0;y>p?c=c.substring(y-p):y<p&&(l=l.substring(0,y));var m=Math.min(y,p);if(c==l)return m;for(var f=0,v=1;;){var w=c.substring(m-v),b=l.indexOf(w);if(b==-1)return f;v+=b,(b==0||c.substring(m-v)==l.substring(0,v))&&(f=v,v++)}},E.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var y=c.length>l.length?c:l,p=c.length>l.length?l:c;if(y.length<4||p.length*2<y.length)return null;var m=this;function f(M,P,V){for(var z=M.substring(V,V+Math.floor(M.length/4)),$=-1,ne="",oe,me,fe,le;($=P.indexOf(z,$+1))!=-1;){var we=m.diff_commonPrefix(M.substring(V),P.substring($)),ke=m.diff_commonSuffix(M.substring(0,V),P.substring(0,$));ne.length<ke+we&&(ne=P.substring($-ke,$)+P.substring($,$+we),oe=M.substring(0,V-ke),me=M.substring(V+we),fe=P.substring(0,$-ke),le=P.substring($+we))}return ne.length*2>=M.length?[oe,me,fe,le,ne]:null}var v=f(y,p,Math.ceil(y.length/4)),w=f(y,p,Math.ceil(y.length/2)),b;if(!v&&!w)return null;w?v?b=v[4].length>w[4].length?v:w:b=w:b=v;var g,s,C,_;c.length>l.length?(g=b[0],s=b[1],C=b[2],_=b[3]):(C=b[0],_=b[1],g=b[2],s=b[3]);var D=b[4];return[g,s,C,_,D]},E.prototype.diff_cleanupSemantic=function(c){for(var l=!1,y=[],p=0,m=null,f=0,v=0,w=0,b=0,g=0;f<c.length;)c[f][0]==A?(y[p++]=f,v=b,w=g,b=0,g=0,m=c[f][1]):(c[f][0]==x?b+=c[f][1].length:g+=c[f][1].length,m&&m.length<=Math.max(v,w)&&m.length<=Math.max(b,g)&&(c.splice(y[p-1],0,new E.Diff(L,m)),c[y[p-1]+1][0]=x,p--,p--,f=p>0?y[p-1]:-1,v=0,w=0,b=0,g=0,m=null,l=!0)),f++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),f=1;f<c.length;){if(c[f-1][0]==L&&c[f][0]==x){var s=c[f-1][1],C=c[f][1],_=this.diff_commonOverlap_(s,C),D=this.diff_commonOverlap_(C,s);_>=D?(_>=s.length/2||_>=C.length/2)&&(c.splice(f,0,new E.Diff(A,C.substring(0,_))),c[f-1][1]=s.substring(0,s.length-_),c[f+1][1]=C.substring(_),f++):(D>=s.length/2||D>=C.length/2)&&(c.splice(f,0,new E.Diff(A,s.substring(0,D))),c[f-1][0]=x,c[f-1][1]=C.substring(0,C.length-D),c[f+1][0]=L,c[f+1][1]=s.substring(D),f++),f++}f++}},E.prototype.diff_cleanupSemanticLossless=function(c){function l(D,M){if(!D||!M)return 6;var P=D.charAt(D.length-1),V=M.charAt(0),z=P.match(E.nonAlphaNumericRegex_),$=V.match(E.nonAlphaNumericRegex_),ne=z&&P.match(E.whitespaceRegex_),oe=$&&V.match(E.whitespaceRegex_),me=ne&&P.match(E.linebreakRegex_),fe=oe&&V.match(E.linebreakRegex_),le=me&&D.match(E.blanklineEndRegex_),we=fe&&M.match(E.blanklineStartRegex_);return le||we?5:me||fe?4:z&&!ne&&oe?3:ne||oe?2:z||$?1:0}for(var y=1;y<c.length-1;){if(c[y-1][0]==A&&c[y+1][0]==A){var p=c[y-1][1],m=c[y][1],f=c[y+1][1],v=this.diff_commonSuffix(p,m);if(v){var w=m.substring(m.length-v);p=p.substring(0,p.length-v),m=w+m.substring(0,m.length-v),f=w+f}for(var b=p,g=m,s=f,C=l(p,m)+l(m,f);m.charAt(0)===f.charAt(0);){p+=m.charAt(0),m=m.substring(1)+f.charAt(0),f=f.substring(1);var _=l(p,m)+l(m,f);_>=C&&(C=_,b=p,g=m,s=f)}c[y-1][1]!=b&&(b?c[y-1][1]=b:(c.splice(y-1,1),y--),c[y][1]=g,s?c[y+1][1]=s:(c.splice(y+1,1),y--))}y++}},E.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,E.whitespaceRegex_=/\s/,E.linebreakRegex_=/[\r\n]/,E.blanklineEndRegex_=/\n\r?\n$/,E.blanklineStartRegex_=/^\r?\n\r?\n/,E.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,y=[],p=0,m=null,f=0,v=!1,w=!1,b=!1,g=!1;f<c.length;)c[f][0]==A?(c[f][1].length<this.Diff_EditCost&&(b||g)?(y[p++]=f,v=b,w=g,m=c[f][1]):(p=0,m=null),b=g=!1):(c[f][0]==L?g=!0:b=!0,m&&(v&&w&&b&&g||m.length<this.Diff_EditCost/2&&v+w+b+g==3)&&(c.splice(y[p-1],0,new E.Diff(L,m)),c[y[p-1]+1][0]=x,p--,m=null,v&&w?(b=g=!0,p=0):(p--,f=p>0?y[p-1]:-1,b=g=!1),l=!0)),f++;l&&this.diff_cleanupMerge(c)},E.prototype.diff_cleanupMerge=function(c){c.push(new E.Diff(A,""));for(var l=0,y=0,p=0,m="",f="",v;l<c.length;)switch(c[l][0]){case x:p++,f+=c[l][1],l++;break;case L:y++,m+=c[l][1],l++;break;case A:y+p>1?(y!==0&&p!==0&&(v=this.diff_commonPrefix(f,m),v!==0&&(l-y-p>0&&c[l-y-p-1][0]==A?c[l-y-p-1][1]+=f.substring(0,v):(c.splice(0,0,new E.Diff(A,f.substring(0,v))),l++),f=f.substring(v),m=m.substring(v)),v=this.diff_commonSuffix(f,m),v!==0&&(c[l][1]=f.substring(f.length-v)+c[l][1],f=f.substring(0,f.length-v),m=m.substring(0,m.length-v))),l-=y+p,c.splice(l,y+p),m.length&&(c.splice(l,0,new E.Diff(L,m)),l++),f.length&&(c.splice(l,0,new E.Diff(x,f)),l++),l++):l!==0&&c[l-1][0]==A?(c[l-1][1]+=c[l][1],c.splice(l,1)):l++,p=0,y=0,m="",f="";break}c[c.length-1][1]===""&&c.pop();var w=!1;for(l=1;l<c.length-1;)c[l-1][0]==A&&c[l+1][0]==A&&(c[l][1].substring(c[l][1].length-c[l-1][1].length)==c[l-1][1]?(c[l][1]=c[l-1][1]+c[l][1].substring(0,c[l][1].length-c[l-1][1].length),c[l+1][1]=c[l-1][1]+c[l+1][1],c.splice(l-1,1),w=!0):c[l][1].substring(0,c[l+1][1].length)==c[l+1][1]&&(c[l-1][1]+=c[l+1][1],c[l][1]=c[l][1].substring(c[l+1][1].length)+c[l+1][1],c.splice(l+1,1),w=!0)),l++;w&&this.diff_cleanupMerge(c)},E.prototype.diff_xIndex=function(c,l){var y=0,p=0,m=0,f=0,v;for(v=0;v<c.length&&(c[v][0]!==x&&(y+=c[v][1].length),c[v][0]!==L&&(p+=c[v][1].length),!(y>l));v++)m=y,f=p;return c.length!=v&&c[v][0]===L?f:f+(l-m)},E.prototype.diff_prettyHtml=function(c){for(var l=[],y=/&/g,p=/</g,m=/>/g,f=/\n/g,v=0;v<c.length;v++){var w=c[v][0],b=c[v][1],g=b.replace(y,"&").replace(p,"<").replace(m,">").replace(f,"¶<br>");switch(w){case x:l[v]='<ins style="background:#e6ffe6;">'+g+"</ins>";break;case L:l[v]='<del style="background:#ffe6e6;">'+g+"</del>";break;case A:l[v]="<span>"+g+"</span>";break}}return l.join("")},E.prototype.diff_text1=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==x&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_text2=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==L&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_levenshtein=function(c){for(var l=0,y=0,p=0,m=0;m<c.length;m++){var f=c[m][0],v=c[m][1];switch(f){case x:y+=v.length;break;case L:p+=v.length;break;case A:l+=Math.max(y,p),y=0,p=0;break}}return l+=Math.max(y,p),l},E.prototype.diff_toDelta=function(c){for(var l=[],y=0;y<c.length;y++)switch(c[y][0]){case x:l[y]="+"+encodeURI(c[y][1]);break;case L:l[y]="-"+c[y][1].length;break;case A:l[y]="="+c[y][1].length;break}return l.join(" ").replace(/%20/g," ")},E.prototype.diff_fromDelta=function(c,l){for(var y=[],p=0,m=0,f=l.split(/\t/g),v=0;v<f.length;v++){var w=f[v].substring(1);switch(f[v].charAt(0)){case"+":try{y[p++]=new E.Diff(x,decodeURI(w))}catch{throw new Error("Illegal escape in diff_fromDelta: "+w)}break;case"-":case"=":var b=parseInt(w,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+w);var g=c.substring(m,m+=b);f[v].charAt(0)=="="?y[p++]=new E.Diff(A,g):y[p++]=new E.Diff(L,g);break;default:if(f[v])throw new Error("Invalid diff operation in diff_fromDelta: "+f[v])}}if(m!=c.length)throw new Error("Delta length ("+m+") does not equal source text length ("+c.length+").");return y},E.prototype.match_main=function(c,l,y){if(c==null||l==null||y==null)throw new Error("Null input. (match_main)");return y=Math.max(0,Math.min(y,c.length)),c==l?0:c.length?c.substring(y,y+l.length)==l?y:this.match_bitap_(c,l,y):-1},E.prototype.match_bitap_=function(c,l,y){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),m=this;function f(oe,me){var fe=oe/l.length,le=Math.abs(y-me);return m.Match_Distance?fe+le/m.Match_Distance:le?1:fe}var v=this.Match_Threshold,w=c.indexOf(l,y);w!=-1&&(v=Math.min(f(0,w),v),w=c.lastIndexOf(l,y+l.length),w!=-1&&(v=Math.min(f(0,w),v)));var b=1<<l.length-1;w=-1;for(var g,s,C=l.length+c.length,_,D=0;D<l.length;D++){for(g=0,s=C;g<s;)f(D,y+s)<=v?g=s:C=s,s=Math.floor((C-g)/2+g);C=s;var M=Math.max(1,y-s+1),P=Math.min(y+s,c.length)+l.length,V=Array(P+2);V[P+1]=(1<<D)-1;for(var z=P;z>=M;z--){var $=p[c.charAt(z-1)];if(D===0?V[z]=(V[z+1]<<1|1)&$:V[z]=(V[z+1]<<1|1)&$|((_[z+1]|_[z])<<1|1)|_[z+1],V[z]&b){var ne=f(D,z-1);if(ne<=v)if(v=ne,w=z-1,w>y)M=Math.max(1,2*y-w);else break}}if(f(D+1,y)>v)break;_=V}return w},E.prototype.match_alphabet_=function(c){for(var l={},y=0;y<c.length;y++)l[c.charAt(y)]=0;for(var y=0;y<c.length;y++)l[c.charAt(y)]|=1<<c.length-y-1;return l},E.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var y=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(y)!=l.lastIndexOf(y)&&y.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,y=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var m=l.substring(c.start2-p,c.start2);m&&c.diffs.unshift(new E.Diff(A,m));var f=l.substring(c.start2+c.length1,c.start2+c.length1+p);f&&c.diffs.push(new E.Diff(A,f)),c.start1-=m.length,c.start2-=m.length,c.length1+=m.length+f.length,c.length2+=m.length+f.length}},E.prototype.patch_make=function(c,l,y){var p,m;if(typeof c=="string"&&typeof l=="string"&&typeof y>"u")p=c,m=this.diff_main(p,l,!0),m.length>2&&(this.diff_cleanupSemantic(m),this.diff_cleanupEfficiency(m));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof y>"u")m=c,p=this.diff_text1(m);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof y>"u")p=c,m=l;else if(typeof c=="string"&&typeof l=="string"&&y&&typeof y=="object")p=c,m=y;else throw new Error("Unknown call format to patch_make.");if(m.length===0)return[];for(var f=[],v=new E.patch_obj,w=0,b=0,g=0,s=p,C=p,_=0;_<m.length;_++){var D=m[_][0],M=m[_][1];switch(!w&&D!==A&&(v.start1=b,v.start2=g),D){case x:v.diffs[w++]=m[_],v.length2+=M.length,C=C.substring(0,g)+M+C.substring(g);break;case L:v.length1+=M.length,v.diffs[w++]=m[_],C=C.substring(0,g)+C.substring(g+M.length);break;case A:M.length<=2*this.Patch_Margin&&w&&m.length!=_+1?(v.diffs[w++]=m[_],v.length1+=M.length,v.length2+=M.length):M.length>=2*this.Patch_Margin&&w&&(this.patch_addContext_(v,s),f.push(v),v=new E.patch_obj,w=0,s=C,b=g);break}D!==x&&(b+=M.length),D!==L&&(g+=M.length)}return w&&(this.patch_addContext_(v,s),f.push(v)),f},E.prototype.patch_deepCopy=function(c){for(var l=[],y=0;y<c.length;y++){var p=c[y],m=new E.patch_obj;m.diffs=[];for(var f=0;f<p.diffs.length;f++)m.diffs[f]=new E.Diff(p.diffs[f][0],p.diffs[f][1]);m.start1=p.start1,m.start2=p.start2,m.length1=p.length1,m.length2=p.length2,l[y]=m}return l},E.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var y=this.patch_addPadding(c);l=y+l+y,this.patch_splitMax(c);for(var p=0,m=[],f=0;f<c.length;f++){var v=c[f].start2+p,w=this.diff_text1(c[f].diffs),b,g=-1;if(w.length>this.Match_MaxBits?(b=this.match_main(l,w.substring(0,this.Match_MaxBits),v),b!=-1&&(g=this.match_main(l,w.substring(w.length-this.Match_MaxBits),v+w.length-this.Match_MaxBits),(g==-1||b>=g)&&(b=-1))):b=this.match_main(l,w,v),b==-1)m[f]=!1,p-=c[f].length2-c[f].length1;else{m[f]=!0,p=b-v;var s;if(g==-1?s=l.substring(b,b+w.length):s=l.substring(b,g+this.Match_MaxBits),w==s)l=l.substring(0,b)+this.diff_text2(c[f].diffs)+l.substring(b+w.length);else{var C=this.diff_main(w,s,!1);if(w.length>this.Match_MaxBits&&this.diff_levenshtein(C)/w.length>this.Patch_DeleteThreshold)m[f]=!1;else{this.diff_cleanupSemanticLossless(C);for(var _=0,D,M=0;M<c[f].diffs.length;M++){var P=c[f].diffs[M];P[0]!==A&&(D=this.diff_xIndex(C,_)),P[0]===x?l=l.substring(0,b+D)+P[1]+l.substring(b+D):P[0]===L&&(l=l.substring(0,b+D)+l.substring(b+this.diff_xIndex(C,_+P[1].length))),P[0]!==L&&(_+=P[1].length)}}}}}return l=l.substring(y.length,l.length-y.length),[l,m]},E.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,y="",p=1;p<=l;p++)y+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var m=c[0],f=m.diffs;if(f.length==0||f[0][0]!=A)f.unshift(new E.Diff(A,y)),m.start1-=l,m.start2-=l,m.length1+=l,m.length2+=l;else if(l>f[0][1].length){var v=l-f[0][1].length;f[0][1]=y.substring(f[0][1].length)+f[0][1],m.start1-=v,m.start2-=v,m.length1+=v,m.length2+=v}if(m=c[c.length-1],f=m.diffs,f.length==0||f[f.length-1][0]!=A)f.push(new E.Diff(A,y)),m.length1+=l,m.length2+=l;else if(l>f[f.length-1][1].length){var v=l-f[f.length-1][1].length;f[f.length-1][1]+=y.substring(0,v),m.length1+=v,m.length2+=v}return y},E.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,y=0;y<c.length;y++)if(!(c[y].length1<=l)){var p=c[y];c.splice(y--,1);for(var m=p.start1,f=p.start2,v="";p.diffs.length!==0;){var w=new E.patch_obj,b=!0;for(w.start1=m-v.length,w.start2=f-v.length,v!==""&&(w.length1=w.length2=v.length,w.diffs.push(new E.Diff(A,v)));p.diffs.length!==0&&w.length1<l-this.Patch_Margin;){var g=p.diffs[0][0],s=p.diffs[0][1];g===x?(w.length2+=s.length,f+=s.length,w.diffs.push(p.diffs.shift()),b=!1):g===L&&w.diffs.length==1&&w.diffs[0][0]==A&&s.length>2*l?(w.length1+=s.length,m+=s.length,b=!1,w.diffs.push(new E.Diff(g,s)),p.diffs.shift()):(s=s.substring(0,l-w.length1-this.Patch_Margin),w.length1+=s.length,m+=s.length,g===A?(w.length2+=s.length,f+=s.length):b=!1,w.diffs.push(new E.Diff(g,s)),s==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(s.length))}v=this.diff_text2(w.diffs),v=v.substring(v.length-this.Patch_Margin);var C=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);C!==""&&(w.length1+=C.length,w.length2+=C.length,w.diffs.length!==0&&w.diffs[w.diffs.length-1][0]===A?w.diffs[w.diffs.length-1][1]+=C:w.diffs.push(new E.Diff(A,C))),b||c.splice(++y,0,w)}}},E.prototype.patch_toText=function(c){for(var l=[],y=0;y<c.length;y++)l[y]=c[y];return l.join("")},E.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var y=c.split(`
|
|
26
|
+
*/var Li=kt.exports,In;function Mi(){return In||(In=1,function(Oe,Gt){(function(nt,Y){Oe.exports=Y()})(Li,function(){return(()=>{var dt={173:Z=>{var E=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},L=-1,x=1,A=0;E.Diff=function(c,l){return[c,l]},E.prototype.diff_main=function(c,l,y,p){typeof p>"u"&&(this.Diff_Timeout<=0?p=Number.MAX_VALUE:p=new Date().getTime()+this.Diff_Timeout*1e3);var m=p;if(c==null||l==null)throw new Error("Null input. (diff_main)");if(c==l)return c?[new E.Diff(A,c)]:[];typeof y>"u"&&(y=!0);var f=y,v=this.diff_commonPrefix(c,l),w=c.substring(0,v);c=c.substring(v),l=l.substring(v),v=this.diff_commonSuffix(c,l);var b=c.substring(c.length-v);c=c.substring(0,c.length-v),l=l.substring(0,l.length-v);var g=this.diff_compute_(c,l,f,m);return w&&g.unshift(new E.Diff(A,w)),b&&g.push(new E.Diff(A,b)),this.diff_cleanupMerge(g),g},E.prototype.diff_compute_=function(c,l,y,p){var m;if(!c)return[new E.Diff(x,l)];if(!l)return[new E.Diff(L,c)];var f=c.length>l.length?c:l,v=c.length>l.length?l:c,w=f.indexOf(v);if(w!=-1)return m=[new E.Diff(x,f.substring(0,w)),new E.Diff(A,v),new E.Diff(x,f.substring(w+v.length))],c.length>l.length&&(m[0][0]=m[2][0]=L),m;if(v.length==1)return[new E.Diff(L,c),new E.Diff(x,l)];var b=this.diff_halfMatch_(c,l);if(b){var g=b[0],o=b[1],C=b[2],_=b[3],D=b[4],M=this.diff_main(g,C,y,p),P=this.diff_main(o,_,y,p);return M.concat([new E.Diff(A,D)],P)}return y&&c.length>100&&l.length>100?this.diff_lineMode_(c,l,p):this.diff_bisect_(c,l,p)},E.prototype.diff_lineMode_=function(c,l,y){var p=this.diff_linesToChars_(c,l);c=p.chars1,l=p.chars2;var m=p.lineArray,f=this.diff_main(c,l,!1,y);this.diff_charsToLines_(f,m),this.diff_cleanupSemantic(f),f.push(new E.Diff(A,""));for(var v=0,w=0,b=0,g="",o="";v<f.length;){switch(f[v][0]){case x:b++,o+=f[v][1];break;case L:w++,g+=f[v][1];break;case A:if(w>=1&&b>=1){f.splice(v-w-b,w+b),v=v-w-b;for(var C=this.diff_main(g,o,!1,y),_=C.length-1;_>=0;_--)f.splice(v,0,C[_]);v=v+C.length}b=0,w=0,g="",o="";break}v++}return f.pop(),f},E.prototype.diff_bisect_=function(c,l,y){for(var p=c.length,m=l.length,f=Math.ceil((p+m)/2),v=f,w=2*f,b=new Array(w),g=new Array(w),o=0;o<w;o++)b[o]=-1,g[o]=-1;b[v+1]=0,g[v+1]=0;for(var C=p-m,_=C%2!=0,D=0,M=0,P=0,V=0,z=0;z<f&&!(new Date().getTime()>y);z++){for(var $=-z+D;$<=z-M;$+=2){var ne=v+$,oe;$==-z||$!=z&&b[ne-1]<b[ne+1]?oe=b[ne+1]:oe=b[ne-1]+1;for(var ge=oe-$;oe<p&&ge<m&&c.charAt(oe)==l.charAt(ge);)oe++,ge++;if(b[ne]=oe,oe>p)M+=2;else if(ge>m)D+=2;else if(_){var de=v+C-$;if(de>=0&&de<w&&g[de]!=-1){var le=p-g[de];if(oe>=le)return this.diff_bisectSplit_(c,l,oe,ge,y)}}}for(var ve=-z+P;ve<=z-V;ve+=2){var de=v+ve,le;ve==-z||ve!=z&&g[de-1]<g[de+1]?le=g[de+1]:le=g[de-1]+1;for(var Te=le-ve;le<p&&Te<m&&c.charAt(p-le-1)==l.charAt(m-Te-1);)le++,Te++;if(g[de]=le,le>p)V+=2;else if(Te>m)P+=2;else if(!_){var ne=v+C-ve;if(ne>=0&&ne<w&&b[ne]!=-1){var oe=b[ne],ge=v+oe-ne;if(le=p-le,oe>=le)return this.diff_bisectSplit_(c,l,oe,ge,y)}}}}return[new E.Diff(L,c),new E.Diff(x,l)]},E.prototype.diff_bisectSplit_=function(c,l,y,p,m){var f=c.substring(0,y),v=l.substring(0,p),w=c.substring(y),b=l.substring(p),g=this.diff_main(f,v,!1,m),o=this.diff_main(w,b,!1,m);return g.concat(o)},E.prototype.diff_linesToChars_=function(c,l){var y=[],p={};y[0]="";function m(b){for(var g="",o=0,C=-1,_=y.length;C<b.length-1;){C=b.indexOf(`
|
|
27
|
+
`,o),C==-1&&(C=b.length-1);var D=b.substring(o,C+1);(p.hasOwnProperty?p.hasOwnProperty(D):p[D]!==void 0)?g+=String.fromCharCode(p[D]):(_==f&&(D=b.substring(o),C=b.length),g+=String.fromCharCode(_),p[D]=_,y[_++]=D),o=C+1}return g}var f=4e4,v=m(c);f=65535;var w=m(l);return{chars1:v,chars2:w,lineArray:y}},E.prototype.diff_charsToLines_=function(c,l){for(var y=0;y<c.length;y++){for(var p=c[y][1],m=[],f=0;f<p.length;f++)m[f]=l[p.charCodeAt(f)];c[y][1]=m.join("")}},E.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,f=0;y<m;)c.substring(f,m)==l.substring(f,m)?(y=m,f=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var y=0,p=Math.min(c.length,l.length),m=p,f=0;y<m;)c.substring(c.length-m,c.length-f)==l.substring(l.length-m,l.length-f)?(y=m,f=y):p=m,m=Math.floor((p-y)/2+y);return m},E.prototype.diff_commonOverlap_=function(c,l){var y=c.length,p=l.length;if(y==0||p==0)return 0;y>p?c=c.substring(y-p):y<p&&(l=l.substring(0,y));var m=Math.min(y,p);if(c==l)return m;for(var f=0,v=1;;){var w=c.substring(m-v),b=l.indexOf(w);if(b==-1)return f;v+=b,(b==0||c.substring(m-v)==l.substring(0,v))&&(f=v,v++)}},E.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var y=c.length>l.length?c:l,p=c.length>l.length?l:c;if(y.length<4||p.length*2<y.length)return null;var m=this;function f(M,P,V){for(var z=M.substring(V,V+Math.floor(M.length/4)),$=-1,ne="",oe,ge,de,le;($=P.indexOf(z,$+1))!=-1;){var ve=m.diff_commonPrefix(M.substring(V),P.substring($)),Te=m.diff_commonSuffix(M.substring(0,V),P.substring(0,$));ne.length<Te+ve&&(ne=P.substring($-Te,$)+P.substring($,$+ve),oe=M.substring(0,V-Te),ge=M.substring(V+ve),de=P.substring(0,$-Te),le=P.substring($+ve))}return ne.length*2>=M.length?[oe,ge,de,le,ne]:null}var v=f(y,p,Math.ceil(y.length/4)),w=f(y,p,Math.ceil(y.length/2)),b;if(!v&&!w)return null;w?v?b=v[4].length>w[4].length?v:w:b=w:b=v;var g,o,C,_;c.length>l.length?(g=b[0],o=b[1],C=b[2],_=b[3]):(C=b[0],_=b[1],g=b[2],o=b[3]);var D=b[4];return[g,o,C,_,D]},E.prototype.diff_cleanupSemantic=function(c){for(var l=!1,y=[],p=0,m=null,f=0,v=0,w=0,b=0,g=0;f<c.length;)c[f][0]==A?(y[p++]=f,v=b,w=g,b=0,g=0,m=c[f][1]):(c[f][0]==x?b+=c[f][1].length:g+=c[f][1].length,m&&m.length<=Math.max(v,w)&&m.length<=Math.max(b,g)&&(c.splice(y[p-1],0,new E.Diff(L,m)),c[y[p-1]+1][0]=x,p--,p--,f=p>0?y[p-1]:-1,v=0,w=0,b=0,g=0,m=null,l=!0)),f++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),f=1;f<c.length;){if(c[f-1][0]==L&&c[f][0]==x){var o=c[f-1][1],C=c[f][1],_=this.diff_commonOverlap_(o,C),D=this.diff_commonOverlap_(C,o);_>=D?(_>=o.length/2||_>=C.length/2)&&(c.splice(f,0,new E.Diff(A,C.substring(0,_))),c[f-1][1]=o.substring(0,o.length-_),c[f+1][1]=C.substring(_),f++):(D>=o.length/2||D>=C.length/2)&&(c.splice(f,0,new E.Diff(A,o.substring(0,D))),c[f-1][0]=x,c[f-1][1]=C.substring(0,C.length-D),c[f+1][0]=L,c[f+1][1]=o.substring(D),f++),f++}f++}},E.prototype.diff_cleanupSemanticLossless=function(c){function l(D,M){if(!D||!M)return 6;var P=D.charAt(D.length-1),V=M.charAt(0),z=P.match(E.nonAlphaNumericRegex_),$=V.match(E.nonAlphaNumericRegex_),ne=z&&P.match(E.whitespaceRegex_),oe=$&&V.match(E.whitespaceRegex_),ge=ne&&P.match(E.linebreakRegex_),de=oe&&V.match(E.linebreakRegex_),le=ge&&D.match(E.blanklineEndRegex_),ve=de&&M.match(E.blanklineStartRegex_);return le||ve?5:ge||de?4:z&&!ne&&oe?3:ne||oe?2:z||$?1:0}for(var y=1;y<c.length-1;){if(c[y-1][0]==A&&c[y+1][0]==A){var p=c[y-1][1],m=c[y][1],f=c[y+1][1],v=this.diff_commonSuffix(p,m);if(v){var w=m.substring(m.length-v);p=p.substring(0,p.length-v),m=w+m.substring(0,m.length-v),f=w+f}for(var b=p,g=m,o=f,C=l(p,m)+l(m,f);m.charAt(0)===f.charAt(0);){p+=m.charAt(0),m=m.substring(1)+f.charAt(0),f=f.substring(1);var _=l(p,m)+l(m,f);_>=C&&(C=_,b=p,g=m,o=f)}c[y-1][1]!=b&&(b?c[y-1][1]=b:(c.splice(y-1,1),y--),c[y][1]=g,o?c[y+1][1]=o:(c.splice(y+1,1),y--))}y++}},E.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,E.whitespaceRegex_=/\s/,E.linebreakRegex_=/[\r\n]/,E.blanklineEndRegex_=/\n\r?\n$/,E.blanklineStartRegex_=/^\r?\n\r?\n/,E.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,y=[],p=0,m=null,f=0,v=!1,w=!1,b=!1,g=!1;f<c.length;)c[f][0]==A?(c[f][1].length<this.Diff_EditCost&&(b||g)?(y[p++]=f,v=b,w=g,m=c[f][1]):(p=0,m=null),b=g=!1):(c[f][0]==L?g=!0:b=!0,m&&(v&&w&&b&&g||m.length<this.Diff_EditCost/2&&v+w+b+g==3)&&(c.splice(y[p-1],0,new E.Diff(L,m)),c[y[p-1]+1][0]=x,p--,m=null,v&&w?(b=g=!0,p=0):(p--,f=p>0?y[p-1]:-1,b=g=!1),l=!0)),f++;l&&this.diff_cleanupMerge(c)},E.prototype.diff_cleanupMerge=function(c){c.push(new E.Diff(A,""));for(var l=0,y=0,p=0,m="",f="",v;l<c.length;)switch(c[l][0]){case x:p++,f+=c[l][1],l++;break;case L:y++,m+=c[l][1],l++;break;case A:y+p>1?(y!==0&&p!==0&&(v=this.diff_commonPrefix(f,m),v!==0&&(l-y-p>0&&c[l-y-p-1][0]==A?c[l-y-p-1][1]+=f.substring(0,v):(c.splice(0,0,new E.Diff(A,f.substring(0,v))),l++),f=f.substring(v),m=m.substring(v)),v=this.diff_commonSuffix(f,m),v!==0&&(c[l][1]=f.substring(f.length-v)+c[l][1],f=f.substring(0,f.length-v),m=m.substring(0,m.length-v))),l-=y+p,c.splice(l,y+p),m.length&&(c.splice(l,0,new E.Diff(L,m)),l++),f.length&&(c.splice(l,0,new E.Diff(x,f)),l++),l++):l!==0&&c[l-1][0]==A?(c[l-1][1]+=c[l][1],c.splice(l,1)):l++,p=0,y=0,m="",f="";break}c[c.length-1][1]===""&&c.pop();var w=!1;for(l=1;l<c.length-1;)c[l-1][0]==A&&c[l+1][0]==A&&(c[l][1].substring(c[l][1].length-c[l-1][1].length)==c[l-1][1]?(c[l][1]=c[l-1][1]+c[l][1].substring(0,c[l][1].length-c[l-1][1].length),c[l+1][1]=c[l-1][1]+c[l+1][1],c.splice(l-1,1),w=!0):c[l][1].substring(0,c[l+1][1].length)==c[l+1][1]&&(c[l-1][1]+=c[l+1][1],c[l][1]=c[l][1].substring(c[l+1][1].length)+c[l+1][1],c.splice(l+1,1),w=!0)),l++;w&&this.diff_cleanupMerge(c)},E.prototype.diff_xIndex=function(c,l){var y=0,p=0,m=0,f=0,v;for(v=0;v<c.length&&(c[v][0]!==x&&(y+=c[v][1].length),c[v][0]!==L&&(p+=c[v][1].length),!(y>l));v++)m=y,f=p;return c.length!=v&&c[v][0]===L?f:f+(l-m)},E.prototype.diff_prettyHtml=function(c){for(var l=[],y=/&/g,p=/</g,m=/>/g,f=/\n/g,v=0;v<c.length;v++){var w=c[v][0],b=c[v][1],g=b.replace(y,"&").replace(p,"<").replace(m,">").replace(f,"¶<br>");switch(w){case x:l[v]='<ins style="background:#e6ffe6;">'+g+"</ins>";break;case L:l[v]='<del style="background:#ffe6e6;">'+g+"</del>";break;case A:l[v]="<span>"+g+"</span>";break}}return l.join("")},E.prototype.diff_text1=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==x&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_text2=function(c){for(var l=[],y=0;y<c.length;y++)c[y][0]!==L&&(l[y]=c[y][1]);return l.join("")},E.prototype.diff_levenshtein=function(c){for(var l=0,y=0,p=0,m=0;m<c.length;m++){var f=c[m][0],v=c[m][1];switch(f){case x:y+=v.length;break;case L:p+=v.length;break;case A:l+=Math.max(y,p),y=0,p=0;break}}return l+=Math.max(y,p),l},E.prototype.diff_toDelta=function(c){for(var l=[],y=0;y<c.length;y++)switch(c[y][0]){case x:l[y]="+"+encodeURI(c[y][1]);break;case L:l[y]="-"+c[y][1].length;break;case A:l[y]="="+c[y][1].length;break}return l.join(" ").replace(/%20/g," ")},E.prototype.diff_fromDelta=function(c,l){for(var y=[],p=0,m=0,f=l.split(/\t/g),v=0;v<f.length;v++){var w=f[v].substring(1);switch(f[v].charAt(0)){case"+":try{y[p++]=new E.Diff(x,decodeURI(w))}catch{throw new Error("Illegal escape in diff_fromDelta: "+w)}break;case"-":case"=":var b=parseInt(w,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+w);var g=c.substring(m,m+=b);f[v].charAt(0)=="="?y[p++]=new E.Diff(A,g):y[p++]=new E.Diff(L,g);break;default:if(f[v])throw new Error("Invalid diff operation in diff_fromDelta: "+f[v])}}if(m!=c.length)throw new Error("Delta length ("+m+") does not equal source text length ("+c.length+").");return y},E.prototype.match_main=function(c,l,y){if(c==null||l==null||y==null)throw new Error("Null input. (match_main)");return y=Math.max(0,Math.min(y,c.length)),c==l?0:c.length?c.substring(y,y+l.length)==l?y:this.match_bitap_(c,l,y):-1},E.prototype.match_bitap_=function(c,l,y){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),m=this;function f(oe,ge){var de=oe/l.length,le=Math.abs(y-ge);return m.Match_Distance?de+le/m.Match_Distance:le?1:de}var v=this.Match_Threshold,w=c.indexOf(l,y);w!=-1&&(v=Math.min(f(0,w),v),w=c.lastIndexOf(l,y+l.length),w!=-1&&(v=Math.min(f(0,w),v)));var b=1<<l.length-1;w=-1;for(var g,o,C=l.length+c.length,_,D=0;D<l.length;D++){for(g=0,o=C;g<o;)f(D,y+o)<=v?g=o:C=o,o=Math.floor((C-g)/2+g);C=o;var M=Math.max(1,y-o+1),P=Math.min(y+o,c.length)+l.length,V=Array(P+2);V[P+1]=(1<<D)-1;for(var z=P;z>=M;z--){var $=p[c.charAt(z-1)];if(D===0?V[z]=(V[z+1]<<1|1)&$:V[z]=(V[z+1]<<1|1)&$|((_[z+1]|_[z])<<1|1)|_[z+1],V[z]&b){var ne=f(D,z-1);if(ne<=v)if(v=ne,w=z-1,w>y)M=Math.max(1,2*y-w);else break}}if(f(D+1,y)>v)break;_=V}return w},E.prototype.match_alphabet_=function(c){for(var l={},y=0;y<c.length;y++)l[c.charAt(y)]=0;for(var y=0;y<c.length;y++)l[c.charAt(y)]|=1<<c.length-y-1;return l},E.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var y=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(y)!=l.lastIndexOf(y)&&y.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,y=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var m=l.substring(c.start2-p,c.start2);m&&c.diffs.unshift(new E.Diff(A,m));var f=l.substring(c.start2+c.length1,c.start2+c.length1+p);f&&c.diffs.push(new E.Diff(A,f)),c.start1-=m.length,c.start2-=m.length,c.length1+=m.length+f.length,c.length2+=m.length+f.length}},E.prototype.patch_make=function(c,l,y){var p,m;if(typeof c=="string"&&typeof l=="string"&&typeof y>"u")p=c,m=this.diff_main(p,l,!0),m.length>2&&(this.diff_cleanupSemantic(m),this.diff_cleanupEfficiency(m));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof y>"u")m=c,p=this.diff_text1(m);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof y>"u")p=c,m=l;else if(typeof c=="string"&&typeof l=="string"&&y&&typeof y=="object")p=c,m=y;else throw new Error("Unknown call format to patch_make.");if(m.length===0)return[];for(var f=[],v=new E.patch_obj,w=0,b=0,g=0,o=p,C=p,_=0;_<m.length;_++){var D=m[_][0],M=m[_][1];switch(!w&&D!==A&&(v.start1=b,v.start2=g),D){case x:v.diffs[w++]=m[_],v.length2+=M.length,C=C.substring(0,g)+M+C.substring(g);break;case L:v.length1+=M.length,v.diffs[w++]=m[_],C=C.substring(0,g)+C.substring(g+M.length);break;case A:M.length<=2*this.Patch_Margin&&w&&m.length!=_+1?(v.diffs[w++]=m[_],v.length1+=M.length,v.length2+=M.length):M.length>=2*this.Patch_Margin&&w&&(this.patch_addContext_(v,o),f.push(v),v=new E.patch_obj,w=0,o=C,b=g);break}D!==x&&(b+=M.length),D!==L&&(g+=M.length)}return w&&(this.patch_addContext_(v,o),f.push(v)),f},E.prototype.patch_deepCopy=function(c){for(var l=[],y=0;y<c.length;y++){var p=c[y],m=new E.patch_obj;m.diffs=[];for(var f=0;f<p.diffs.length;f++)m.diffs[f]=new E.Diff(p.diffs[f][0],p.diffs[f][1]);m.start1=p.start1,m.start2=p.start2,m.length1=p.length1,m.length2=p.length2,l[y]=m}return l},E.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var y=this.patch_addPadding(c);l=y+l+y,this.patch_splitMax(c);for(var p=0,m=[],f=0;f<c.length;f++){var v=c[f].start2+p,w=this.diff_text1(c[f].diffs),b,g=-1;if(w.length>this.Match_MaxBits?(b=this.match_main(l,w.substring(0,this.Match_MaxBits),v),b!=-1&&(g=this.match_main(l,w.substring(w.length-this.Match_MaxBits),v+w.length-this.Match_MaxBits),(g==-1||b>=g)&&(b=-1))):b=this.match_main(l,w,v),b==-1)m[f]=!1,p-=c[f].length2-c[f].length1;else{m[f]=!0,p=b-v;var o;if(g==-1?o=l.substring(b,b+w.length):o=l.substring(b,g+this.Match_MaxBits),w==o)l=l.substring(0,b)+this.diff_text2(c[f].diffs)+l.substring(b+w.length);else{var C=this.diff_main(w,o,!1);if(w.length>this.Match_MaxBits&&this.diff_levenshtein(C)/w.length>this.Patch_DeleteThreshold)m[f]=!1;else{this.diff_cleanupSemanticLossless(C);for(var _=0,D,M=0;M<c[f].diffs.length;M++){var P=c[f].diffs[M];P[0]!==A&&(D=this.diff_xIndex(C,_)),P[0]===x?l=l.substring(0,b+D)+P[1]+l.substring(b+D):P[0]===L&&(l=l.substring(0,b+D)+l.substring(b+this.diff_xIndex(C,_+P[1].length))),P[0]!==L&&(_+=P[1].length)}}}}}return l=l.substring(y.length,l.length-y.length),[l,m]},E.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,y="",p=1;p<=l;p++)y+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var m=c[0],f=m.diffs;if(f.length==0||f[0][0]!=A)f.unshift(new E.Diff(A,y)),m.start1-=l,m.start2-=l,m.length1+=l,m.length2+=l;else if(l>f[0][1].length){var v=l-f[0][1].length;f[0][1]=y.substring(f[0][1].length)+f[0][1],m.start1-=v,m.start2-=v,m.length1+=v,m.length2+=v}if(m=c[c.length-1],f=m.diffs,f.length==0||f[f.length-1][0]!=A)f.push(new E.Diff(A,y)),m.length1+=l,m.length2+=l;else if(l>f[f.length-1][1].length){var v=l-f[f.length-1][1].length;f[f.length-1][1]+=y.substring(0,v),m.length1+=v,m.length2+=v}return y},E.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,y=0;y<c.length;y++)if(!(c[y].length1<=l)){var p=c[y];c.splice(y--,1);for(var m=p.start1,f=p.start2,v="";p.diffs.length!==0;){var w=new E.patch_obj,b=!0;for(w.start1=m-v.length,w.start2=f-v.length,v!==""&&(w.length1=w.length2=v.length,w.diffs.push(new E.Diff(A,v)));p.diffs.length!==0&&w.length1<l-this.Patch_Margin;){var g=p.diffs[0][0],o=p.diffs[0][1];g===x?(w.length2+=o.length,f+=o.length,w.diffs.push(p.diffs.shift()),b=!1):g===L&&w.diffs.length==1&&w.diffs[0][0]==A&&o.length>2*l?(w.length1+=o.length,m+=o.length,b=!1,w.diffs.push(new E.Diff(g,o)),p.diffs.shift()):(o=o.substring(0,l-w.length1-this.Patch_Margin),w.length1+=o.length,m+=o.length,g===A?(w.length2+=o.length,f+=o.length):b=!1,w.diffs.push(new E.Diff(g,o)),o==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(o.length))}v=this.diff_text2(w.diffs),v=v.substring(v.length-this.Patch_Margin);var C=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);C!==""&&(w.length1+=C.length,w.length2+=C.length,w.diffs.length!==0&&w.diffs[w.diffs.length-1][0]===A?w.diffs[w.diffs.length-1][1]+=C:w.diffs.push(new E.Diff(A,C))),b||c.splice(++y,0,w)}}},E.prototype.patch_toText=function(c){for(var l=[],y=0;y<c.length;y++)l[y]=c[y];return l.join("")},E.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var y=c.split(`
|
|
28
28
|
`),p=0,m=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;p<y.length;){var f=y[p].match(m);if(!f)throw new Error("Invalid patch string: "+y[p]);var v=new E.patch_obj;for(l.push(v),v.start1=parseInt(f[1],10),f[2]===""?(v.start1--,v.length1=1):f[2]=="0"?v.length1=0:(v.start1--,v.length1=parseInt(f[2],10)),v.start2=parseInt(f[3],10),f[4]===""?(v.start2--,v.length2=1):f[4]=="0"?v.length2=0:(v.start2--,v.length2=parseInt(f[4],10)),p++;p<y.length;){var w=y[p].charAt(0);try{var b=decodeURI(y[p].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+b)}if(w=="-")v.diffs.push(new E.Diff(L,b));else if(w=="+")v.diffs.push(new E.Diff(x,b));else if(w==" ")v.diffs.push(new E.Diff(A,b));else{if(w=="@")break;if(w!=="")throw new Error('Invalid patch mode "'+w+'" in: '+b)}p++}}return l},E.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},E.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 y=["@@ -"+c+" +"+l+` @@
|
|
29
29
|
`],p,m=0;m<this.diffs.length;m++){switch(this.diffs[m][0]){case x:p="+";break;case L:p="-";break;case A:p=" ";break}y[m+1]=p+encodeURI(this.diffs[m][1])+`
|
|
30
|
-
`}return y.join("").replace(/%20/g," ")},Z.exports=E,Z.exports.diff_match_patch=E,Z.exports.DIFF_DELETE=L,Z.exports.DIFF_INSERT=x,Z.exports.DIFF_EQUAL=A},408:(Z,E,L)=>{L.d(E,{default:()=>Fe});var x=L(135),A=L(840),c=L(775),l=L(428),y=L(325),p=L(483),m=L(999),f=function(N){N===void 0&&(N=document);var re=function(U){var j=document.createElement("img");j.src=U.getAttribute("data-src"),j.addEventListener("load",function(){!U.getAttribute("style")&&!U.getAttribute("class")&&!U.getAttribute("width")&&!U.getAttribute("height")&&j.naturalHeight>j.naturalWidth&&j.naturalWidth/j.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&j.naturalHeight>window.innerHeight-40&&(U.style.height=window.innerHeight-40+"px"),U.src=j.src}),U.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return N.querySelectorAll("img").forEach(function(U){U.getAttribute("data-src")&&re(U)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),N.querySelectorAll("img").forEach(function(U){window.vditorImageIntersectionObserver.observe(U)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(U){U.forEach(function(j){(typeof j.isIntersecting>"u"?j.intersectionRatio!==0:j.isIntersecting)&&j.target.getAttribute("data-src")&&re(j.target)})}),N.querySelectorAll("img").forEach(function(U){window.vditorImageIntersectionObserver.observe(U)}))},v=L(472),w=L(280),b=L(637),g=L(825),s=L(11),C=L(194),_=L(436),D=L(229),M=L(145),P=L(538),V=L(413),z=L(106),$=L(673),ne=function(N){document.querySelectorAll(".vditor-anchor").forEach(function(re){N===1&&re.classList.add("vditor-anchor--left"),re.onclick=function(){var U=re.getAttribute("href").substr(1),j=document.getElementById("vditorAnchor-"+U).offsetTop;document.querySelector("html").scrollTop=j}}),window.onhashchange=function(){var re=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));re&&(document.querySelector("html").scrollTop=re.offsetTop)}},oe=L(214),me=L(810),fe=function(N,re){if(re===void 0&&(re="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var U=function(){var Ce=speechSynthesis.getVoices(),X,de;return Ce.forEach(function(De){De.lang===re.replace("_","-")&&(X=De),De.default&&(de=De)}),X||(X=de),X},j='<svg><use xlink:href="#vditor-icon-play"></use></svg>',pe='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(j='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',pe='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var K=document.querySelector(".vditor-speech");K||(K=document.createElement("button"),K.className="vditor-speech",N.insertAdjacentElement("beforeend",K),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=U));var ge=U(),ie=new SpeechSynthesisUtterance;ie.voice=ge,ie.onend=ie.onerror=function(){K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j},N.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(Ce){var X=Ce.target;if(X.classList.contains("vditor-speech")||X.parentElement.classList.contains("vditor-speech")){K.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),K.innerHTML=pe):(speechSynthesis.pause(),K.innerHTML=j)):(ie.text=K.getAttribute("data-text"),speechSynthesis.speak(ie),K.classList.add("vditor-speech--current"),K.innerHTML=pe),(0,me.Hc)(window.vditorSpeechRange),N.focus();return}if(K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j,getSelection().rangeCount!==0){var de=getSelection().getRangeAt(0),De=de.toString().trim();if(De){window.vditorSpeechRange=de.cloneRange();var Ne=de.getBoundingClientRect();K.innerHTML=j,K.style.display="block",K.style.top=Ne.top+Ne.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?K.style.left=Ce.changedTouches[Ce.changedTouches.length-1].pageX+2+"px":K.style.left=Ce.clientX+2+"px",K.setAttribute("data-text",De)}}})}},le=function(N,re,U,j){function pe(K){return K instanceof U?K:new U(function(ge){ge(K)})}return new(U||(U=Promise))(function(K,ge){function ie(de){try{X(j.next(de))}catch(De){ge(De)}}function Ce(de){try{X(j.throw(de))}catch(De){ge(De)}}function X(de){de.done?K(de.value):pe(de.value).then(ie,Ce)}X((j=j.apply(N,re||[])).next())})},we=function(N,re){var U={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},j,pe,K,ge;return ge={next:ie(0),throw:ie(1),return:ie(2)},typeof Symbol=="function"&&(ge[Symbol.iterator]=function(){return this}),ge;function ie(X){return function(de){return Ce([X,de])}}function Ce(X){if(j)throw new TypeError("Generator is already executing.");for(;ge&&(ge=0,X[0]&&(U=0)),U;)try{if(j=1,pe&&(K=X[0]&2?pe.return:X[0]?pe.throw||((K=pe.return)&&K.call(pe),0):pe.next)&&!(K=K.call(pe,X[1])).done)return K;switch(pe=0,K&&(X=[X[0]&2,K.value]),X[0]){case 0:case 1:K=X;break;case 4:return U.label++,{value:X[1],done:!1};case 5:U.label++,pe=X[1],X=[0];continue;case 7:X=U.ops.pop(),U.trys.pop();continue;default:if(K=U.trys,!(K=K.length>0&&K[K.length-1])&&(X[0]===6||X[0]===2)){U=0;continue}if(X[0]===3&&(!K||X[1]>K[0]&&X[1]<K[3])){U.label=X[1];break}if(X[0]===6&&U.label<K[1]){U.label=K[1],K=X;break}if(K&&U.label<K[2]){U.label=K[2],U.ops.push(X);break}K[2]&&U.ops.pop(),U.trys.pop();continue}X=re.call(N,U)}catch(de){X=[6,de],pe=0}finally{j=K=0}if(X[0]&5)throw X[1];return{value:X[0]?X[1]:void 0,done:!0}}},ke=function(N){var re,U={anchor:0,cdn:M.g.CDN,customEmoji:{},emojiPath:"".concat(M.g.CDN,"/dist/images/emoji"),hljs:M.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:M.g.MARKDOWN_OPTIONS,math:M.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:M.g.THEME_OPTIONS};return N.cdn&&(!((re=N.theme)===null||re===void 0)&&re.path||(U.theme.path="".concat(N.cdn,"/dist/css/content-theme")),N.emojiPath||(U.emojiPath="".concat(N.cdn,"/dist/images/emoji"))),(0,$.T)(U,N)},ve=function(N,re){var U=ke(re);return(0,V.G)("".concat(U.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var j=(0,oe.X)({autoSpace:U.markdown.autoSpace,gfmAutoLink:U.markdown.gfmAutoLink,codeBlockPreview:U.markdown.codeBlockPreview,emojiSite:U.emojiPath,emojis:U.customEmoji,fixTermTypo:U.markdown.fixTermTypo,footnotes:U.markdown.footnotes,headingAnchor:U.anchor!==0,inlineMathDigit:U.math.inlineDigit,lazyLoadImage:U.lazyLoadImage,linkBase:U.markdown.linkBase,linkPrefix:U.markdown.linkPrefix,listStyle:U.markdown.listStyle,mark:U.markdown.mark,mathBlockPreview:U.markdown.mathBlockPreview,paragraphBeginningSpace:U.markdown.paragraphBeginningSpace,sanitize:U.markdown.sanitize,toc:U.markdown.toc});return re?.renderers&&j.SetJSRenderers({renderers:{Md2HTML:re.renderers}}),j.SetHeadingID(!0),j.Md2HTML(N)})},k=function(N,re,U){return le(void 0,void 0,void 0,function(){var j,pe,K,ge;return we(this,function(ie){switch(ie.label){case 0:return j=ke(U),[4,ve(re,j)];case 1:if(pe=ie.sent(),j.transform&&(pe=j.transform(pe)),N.innerHTML=pe,N.classList.add("vditor-reset"),j.i18n)return[3,5];if(["en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(j.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return K="vditorI18nScript",ge=K+j.lang,document.querySelectorAll('head script[id^="'.concat(K,'"]')).forEach(function(Ce){Ce.id!==ge&&document.head.removeChild(Ce)}),[4,(0,V.G)("".concat(j.cdn,"/dist/js/i18n/").concat(j.lang,".js"),ge)];case 3:ie.sent(),ie.label=4;case 4:return[3,6];case 5:window.VditorI18n=j.i18n,ie.label=6;case 6:return j.icon?[4,(0,V.G)("".concat(j.cdn,"/dist/js/icons/").concat(j.icon,".js"),"vditorIconScript")]:[3,8];case 7:ie.sent(),ie.label=8;case 8:return(0,P.Z)(j.theme.current,j.theme.path),j.anchor===1&&N.classList.add("vditor-reset--anchor"),(0,l.O)(N,j.hljs),(0,m.s)(j.hljs,N,j.cdn),(0,v.H)(N,{cdn:j.cdn,math:j.math}),(0,b.i)(N,j.cdn,j.mode),(0,g.J)(N,j.cdn,j.mode),(0,s.K)(N,j.cdn),(0,y.P)(N,j.cdn),(0,p.v)(N,j.cdn),(0,c.p)(N,j.cdn,j.mode),(0,C.P)(N,j.cdn,j.mode),(0,D.B)(N,j.cdn),(0,x.Q)(N,j.cdn),j.render.media.enable&&(0,w.Y)(N),j.speech.enable&&fe(N),j.anchor!==0&&ne(j.anchor),j.after&&j.after(),j.lazyLoadImage&&f(N),N.addEventListener("click",function(Ce){var X=(0,z.lG)(Ce.target,"SPAN");if(X&&(0,z.fb)(X,"vditor-toc")){var de=N.querySelector("#"+X.getAttribute("data-target-id"));de&&window.scrollTo(window.scrollX,de.offsetTop);return}}),[2]}})})},je=L(190),pt=L(580),ht=function(){function N(){}return N.adapterRender=A,N.previewImage=je.E,N.codeRender=l.O,N.graphvizRender=p.v,N.highlightRender=m.s,N.mathRender=v.H,N.mermaidRender=b.i,N.SMILESRender=g.J,N.markmapRender=s.K,N.flowchartRender=y.P,N.chartRender=c.p,N.abcRender=x.Q,N.mindmapRender=C.P,N.plantumlRender=D.B,N.outlineRender=_.k,N.mediaRender=w.Y,N.speechRender=fe,N.lazyLoadImageRender=f,N.md2html=ve,N.preview=k,N.setCodeTheme=pt.Y,N.setContentTheme=P.Z,N}();const Fe=ht},145:(Z,E,L)=>{L.d(E,{H:()=>x,g:()=>A});var x="3.11.0",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.0"),c.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},c.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},c.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},c.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(c.CDN,"/dist/css/content-theme")},c}()},825:(Z,E,L)=>{L.d(E,{J:()=>y});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(p,m,f){p===void 0&&(p=document),m===void 0&&(m=x.g.CDN);var v=c.SMILESRenderAdapter.getElements(p);v.length>0&&(0,A.G)("".concat(m,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var w=new SmiDrawer({},{});v.forEach(function(b){var g=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var s="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(s,'"></svg>'),w.draw(g,"#"+s,f==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}},135:(Z,E,L)=>{L.d(E,{Q:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=x.g.CDN);var m=c.abcRenderAdapter.getElements(y);m.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){m.forEach(function(f){f.parentElement.classList.contains("vditor-wysiwyg__pre")||f.parentElement.classList.contains("vditor-ir__marker--pre")||f.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(f,c.abcRenderAdapter.getCode(f).trim()),f.style.overflowX="auto",f.setAttribute("data-processed","true"))})})}},840:(Z,E,L)=>{L.r(E),L.d(E,{mathRenderAdapter:()=>x,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>y,chartRenderAdapter:()=>p,abcRenderAdapter:()=>m,graphvizRenderAdapter:()=>f,flowchartRenderAdapter:()=>v,plantumlRenderAdapter:()=>w});var x={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-math")}},A={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-smiles")}},c={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-mermaid")}},l={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-markmap")}},y={getCode:function(b){return b.getAttribute("data-code")},getElements:function(b){return b.querySelectorAll(".language-mindmap")}},p={getCode:function(b){return b.innerText},getElements:function(b){return b.querySelectorAll(".language-echarts")}},m={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-abc")}},f={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-graphviz")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},w={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}},775:(Z,E,L)=>{L.d(E,{p:()=>m});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(f,v,w,b){function g(s){return s instanceof w?s:new w(function(C){C(s)})}return new(w||(w=Promise))(function(s,C){function _(P){try{M(b.next(P))}catch(V){C(V)}}function D(P){try{M(b.throw(P))}catch(V){C(V)}}function M(P){P.done?s(P.value):g(P.value).then(_,D)}M((b=b.apply(f,v||[])).next())})},p=function(f,v){var w={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,g,s,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(M){return function(P){return D([M,P])}}function D(M){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,M[0]&&(w=0)),w;)try{if(b=1,g&&(s=M[0]&2?g.return:M[0]?g.throw||((s=g.return)&&s.call(g),0):g.next)&&!(s=s.call(g,M[1])).done)return s;switch(g=0,s&&(M=[M[0]&2,s.value]),M[0]){case 0:case 1:s=M;break;case 4:return w.label++,{value:M[1],done:!1};case 5:w.label++,g=M[1],M=[0];continue;case 7:M=w.ops.pop(),w.trys.pop();continue;default:if(s=w.trys,!(s=s.length>0&&s[s.length-1])&&(M[0]===6||M[0]===2)){w=0;continue}if(M[0]===3&&(!s||M[1]>s[0]&&M[1]<s[3])){w.label=M[1];break}if(M[0]===6&&w.label<s[1]){w.label=s[1],s=M;break}if(s&&w.label<s[2]){w.label=s[2],w.ops.push(M);break}s[2]&&w.ops.pop(),w.trys.pop();continue}M=v.call(f,w)}catch(P){M=[6,P],g=0}finally{b=s=0}if(M[0]&5)throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}},m=function(f,v,w){f===void 0&&(f=document),v===void 0&&(v=x.g.CDN);var b=c.chartRenderAdapter.getElements(f);b.length>0&&(0,A.G)("".concat(v,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(g){return y(void 0,void 0,void 0,function(){var s,C,_;return p(this,function(D){switch(D.label){case 0:if(g.parentElement.classList.contains("vditor-wysiwyg__pre")||g.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(s=c.chartRenderAdapter.getCode(g).trim(),!s)return[2];D.label=1;case 1:return D.trys.push([1,3,,4]),g.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(s)];case 2:return C=D.sent(),echarts.init(g,w==="dark"?"dark":void 0).setOption(C),g.setAttribute("data-processed","true"),[3,4];case 3:return _=D.sent(),g.className="vditor-reset--error",g.innerHTML="echarts render error: <br>".concat(_),[3,4];case 4:return[2]}})})})})}},428:(Z,E,L)=>{L.d(E,{O:()=>c});var x=L(105),A=L(145),c=function(l,y){Array.from(l.querySelectorAll("pre > code")).filter(function(p,m){return!(p.parentElement.classList.contains("vditor-wysiwyg__pre")||p.parentElement.classList.contains("vditor-ir__marker--pre")||p.classList.contains("language-mermaid")||p.classList.contains("language-flowchart")||p.classList.contains("language-echarts")||p.classList.contains("language-mindmap")||p.classList.contains("language-plantuml")||p.classList.contains("language-markmap")||p.classList.contains("language-abc")||p.classList.contains("language-graphviz")||p.classList.contains("language-math")||p.classList.contains("language-smiles")||p.style.maxHeight.indexOf("px")>-1||l.classList.contains("vditor-preview")&&m>5)}).forEach(function(p){var m,f,v,w=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(_){_.remove()}),w=b.innerText}else w.endsWith(`
|
|
31
|
-
`)&&(w=w.substr(0,w.length-1));var g='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(g='<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
|
|
30
|
+
`}return y.join("").replace(/%20/g," ")},Z.exports=E,Z.exports.diff_match_patch=E,Z.exports.DIFF_DELETE=L,Z.exports.DIFF_INSERT=x,Z.exports.DIFF_EQUAL=A},408:(Z,E,L)=>{L.d(E,{default:()=>Fe});var x=L(135),A=L(840),c=L(775),l=L(428),y=L(325),p=L(483),m=L(999),f=function(N){N===void 0&&(N=document);var re=function(U){var j=document.createElement("img");j.src=U.getAttribute("data-src"),j.addEventListener("load",function(){!U.getAttribute("style")&&!U.getAttribute("class")&&!U.getAttribute("width")&&!U.getAttribute("height")&&j.naturalHeight>j.naturalWidth&&j.naturalWidth/j.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&j.naturalHeight>window.innerHeight-40&&(U.style.height=window.innerHeight-40+"px"),U.src=j.src}),U.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return N.querySelectorAll("img").forEach(function(U){U.getAttribute("data-src")&&re(U)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),N.querySelectorAll("img").forEach(function(U){window.vditorImageIntersectionObserver.observe(U)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(U){U.forEach(function(j){(typeof j.isIntersecting>"u"?j.intersectionRatio!==0:j.isIntersecting)&&j.target.getAttribute("data-src")&&re(j.target)})}),N.querySelectorAll("img").forEach(function(U){window.vditorImageIntersectionObserver.observe(U)}))},v=L(472),w=L(280),b=L(637),g=L(825),o=L(11),C=L(194),_=L(436),D=L(229),M=L(145),P=L(538),V=L(413),z=L(106),$=L(673),ne=function(N){document.querySelectorAll(".vditor-anchor").forEach(function(re){N===1&&re.classList.add("vditor-anchor--left"),re.onclick=function(){var U=re.getAttribute("href").substr(1),j=document.getElementById("vditorAnchor-"+U).offsetTop;document.querySelector("html").scrollTop=j}}),window.onhashchange=function(){var re=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));re&&(document.querySelector("html").scrollTop=re.offsetTop)}},oe=L(214),ge=L(810),de=function(N,re){if(re===void 0&&(re="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var U=function(){var Le=speechSynthesis.getVoices(),X,pe;return Le.forEach(function(De){De.lang===re.replace("_","-")&&(X=De),De.default&&(pe=De)}),X||(X=pe),X},j='<svg><use xlink:href="#vditor-icon-play"></use></svg>',he='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(j='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',he='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var K=document.querySelector(".vditor-speech");K||(K=document.createElement("button"),K.className="vditor-speech",N.insertAdjacentElement("beforeend",K),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=U));var ye=U(),ie=new SpeechSynthesisUtterance;ie.voice=ye,ie.onend=ie.onerror=function(){K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j},N.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(Le){var X=Le.target;if(X.classList.contains("vditor-speech")||X.parentElement.classList.contains("vditor-speech")){K.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),K.innerHTML=he):(speechSynthesis.pause(),K.innerHTML=j)):(ie.text=K.getAttribute("data-text"),speechSynthesis.speak(ie),K.classList.add("vditor-speech--current"),K.innerHTML=he),(0,ge.Hc)(window.vditorSpeechRange),N.focus();return}if(K.style.display="none",speechSynthesis.cancel(),K.classList.remove("vditor-speech--current"),K.innerHTML=j,getSelection().rangeCount!==0){var pe=getSelection().getRangeAt(0),De=pe.toString().trim();if(De){window.vditorSpeechRange=pe.cloneRange();var Ne=pe.getBoundingClientRect();K.innerHTML=j,K.style.display="block",K.style.top=Ne.top+Ne.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?K.style.left=Le.changedTouches[Le.changedTouches.length-1].pageX+2+"px":K.style.left=Le.clientX+2+"px",K.setAttribute("data-text",De)}}})}},le=function(N,re,U,j){function he(K){return K instanceof U?K:new U(function(ye){ye(K)})}return new(U||(U=Promise))(function(K,ye){function ie(pe){try{X(j.next(pe))}catch(De){ye(De)}}function Le(pe){try{X(j.throw(pe))}catch(De){ye(De)}}function X(pe){pe.done?K(pe.value):he(pe.value).then(ie,Le)}X((j=j.apply(N,re||[])).next())})},ve=function(N,re){var U={label:0,sent:function(){if(K[0]&1)throw K[1];return K[1]},trys:[],ops:[]},j,he,K,ye;return ye={next:ie(0),throw:ie(1),return:ie(2)},typeof Symbol=="function"&&(ye[Symbol.iterator]=function(){return this}),ye;function ie(X){return function(pe){return Le([X,pe])}}function Le(X){if(j)throw new TypeError("Generator is already executing.");for(;ye&&(ye=0,X[0]&&(U=0)),U;)try{if(j=1,he&&(K=X[0]&2?he.return:X[0]?he.throw||((K=he.return)&&K.call(he),0):he.next)&&!(K=K.call(he,X[1])).done)return K;switch(he=0,K&&(X=[X[0]&2,K.value]),X[0]){case 0:case 1:K=X;break;case 4:return U.label++,{value:X[1],done:!1};case 5:U.label++,he=X[1],X=[0];continue;case 7:X=U.ops.pop(),U.trys.pop();continue;default:if(K=U.trys,!(K=K.length>0&&K[K.length-1])&&(X[0]===6||X[0]===2)){U=0;continue}if(X[0]===3&&(!K||X[1]>K[0]&&X[1]<K[3])){U.label=X[1];break}if(X[0]===6&&U.label<K[1]){U.label=K[1],K=X;break}if(K&&U.label<K[2]){U.label=K[2],U.ops.push(X);break}K[2]&&U.ops.pop(),U.trys.pop();continue}X=re.call(N,U)}catch(pe){X=[6,pe],he=0}finally{j=K=0}if(X[0]&5)throw X[1];return{value:X[0]?X[1]:void 0,done:!0}}},Te=function(N){var re,U={anchor:0,cdn:M.g.CDN,customEmoji:{},emojiPath:"".concat(M.g.CDN,"/dist/images/emoji"),hljs:M.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:M.g.MARKDOWN_OPTIONS,math:M.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:M.g.THEME_OPTIONS};return N.cdn&&(!((re=N.theme)===null||re===void 0)&&re.path||(U.theme.path="".concat(N.cdn,"/dist/css/content-theme")),N.emojiPath||(U.emojiPath="".concat(N.cdn,"/dist/images/emoji"))),(0,$.T)(U,N)},Ee=function(N,re){var U=Te(re);return(0,V.G)("".concat(U.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var j=(0,oe.X)({autoSpace:U.markdown.autoSpace,gfmAutoLink:U.markdown.gfmAutoLink,codeBlockPreview:U.markdown.codeBlockPreview,emojiSite:U.emojiPath,emojis:U.customEmoji,fixTermTypo:U.markdown.fixTermTypo,footnotes:U.markdown.footnotes,headingAnchor:U.anchor!==0,inlineMathDigit:U.math.inlineDigit,lazyLoadImage:U.lazyLoadImage,linkBase:U.markdown.linkBase,linkPrefix:U.markdown.linkPrefix,listStyle:U.markdown.listStyle,mark:U.markdown.mark,mathBlockPreview:U.markdown.mathBlockPreview,paragraphBeginningSpace:U.markdown.paragraphBeginningSpace,sanitize:U.markdown.sanitize,toc:U.markdown.toc});return re?.renderers&&j.SetJSRenderers({renderers:{Md2HTML:re.renderers}}),j.SetHeadingID(!0),j.Md2HTML(N)})},k=function(N,re,U){return le(void 0,void 0,void 0,function(){var j,he,K,ye;return ve(this,function(ie){switch(ie.label){case 0:return j=Te(U),[4,Ee(re,j)];case 1:if(he=ie.sent(),j.transform&&(he=j.transform(he)),N.innerHTML=he,N.classList.add("vditor-reset"),j.i18n)return[3,5];if(["de_DE","en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(j.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return K="vditorI18nScript",ye=K+j.lang,document.querySelectorAll('head script[id^="'.concat(K,'"]')).forEach(function(Le){Le.id!==ye&&document.head.removeChild(Le)}),[4,(0,V.G)("".concat(j.cdn,"/dist/js/i18n/").concat(j.lang,".js"),ye)];case 3:ie.sent(),ie.label=4;case 4:return[3,6];case 5:window.VditorI18n=j.i18n,ie.label=6;case 6:return j.icon?[4,(0,V.G)("".concat(j.cdn,"/dist/js/icons/").concat(j.icon,".js"),"vditorIconScript")]:[3,8];case 7:ie.sent(),ie.label=8;case 8:return(0,P.Z)(j.theme.current,j.theme.path),j.anchor===1&&N.classList.add("vditor-reset--anchor"),(0,l.O)(N,j.hljs),(0,m.s)(j.hljs,N,j.cdn),(0,v.H)(N,{cdn:j.cdn,math:j.math}),(0,b.i)(N,j.cdn,j.mode),(0,g.J)(N,j.cdn,j.mode),(0,o.K)(N,j.cdn),(0,y.P)(N,j.cdn),(0,p.v)(N,j.cdn),(0,c.p)(N,j.cdn,j.mode),(0,C.P)(N,j.cdn,j.mode),(0,D.B)(N,j.cdn),(0,x.Q)(N,j.cdn),j.render.media.enable&&(0,w.Y)(N),j.speech.enable&&de(N),j.anchor!==0&&ne(j.anchor),j.after&&j.after(),j.lazyLoadImage&&f(N),N.addEventListener("click",function(Le){var X=(0,z.lG)(Le.target,"SPAN");if(X&&(0,z.fb)(X,"vditor-toc")){var pe=N.querySelector("#"+X.getAttribute("data-target-id"));pe&&window.scrollTo(window.scrollX,pe.offsetTop);return}}),[2]}})})},je=L(190),pt=L(580),ht=function(){function N(){}return N.adapterRender=A,N.previewImage=je.E,N.codeRender=l.O,N.graphvizRender=p.v,N.highlightRender=m.s,N.mathRender=v.H,N.mermaidRender=b.i,N.SMILESRender=g.J,N.markmapRender=o.K,N.flowchartRender=y.P,N.chartRender=c.p,N.abcRender=x.Q,N.mindmapRender=C.P,N.plantumlRender=D.B,N.outlineRender=_.k,N.mediaRender=w.Y,N.speechRender=de,N.lazyLoadImageRender=f,N.md2html=Ee,N.preview=k,N.setCodeTheme=pt.Y,N.setContentTheme=P.Z,N}();const Fe=ht},145:(Z,E,L)=>{L.d(E,{H:()=>x,g:()=>A});var x="3.11.1",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.1"),c.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},c.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},c.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},c.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(c.CDN,"/dist/css/content-theme")},c}()},825:(Z,E,L)=>{L.d(E,{J:()=>y});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(p,m,f){p===void 0&&(p=document),m===void 0&&(m=x.g.CDN);var v=c.SMILESRenderAdapter.getElements(p);v.length>0&&(0,A.G)("".concat(m,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var w=new SmiDrawer({},{});v.forEach(function(b){var g=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var o="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(o,'"></svg>'),w.draw(g,"#"+o,f==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}},135:(Z,E,L)=>{L.d(E,{Q:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=x.g.CDN);var m=c.abcRenderAdapter.getElements(y);m.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){m.forEach(function(f){f.parentElement.classList.contains("vditor-wysiwyg__pre")||f.parentElement.classList.contains("vditor-ir__marker--pre")||f.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(f,c.abcRenderAdapter.getCode(f).trim()),f.style.overflowX="auto",f.setAttribute("data-processed","true"))})})}},840:(Z,E,L)=>{L.r(E),L.d(E,{mathRenderAdapter:()=>x,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>y,chartRenderAdapter:()=>p,abcRenderAdapter:()=>m,graphvizRenderAdapter:()=>f,flowchartRenderAdapter:()=>v,plantumlRenderAdapter:()=>w});var x={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-math")}},A={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-smiles")}},c={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-mermaid")}},l={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-markmap")}},y={getCode:function(b){return b.getAttribute("data-code")},getElements:function(b){return b.querySelectorAll(".language-mindmap")}},p={getCode:function(b){return b.innerText},getElements:function(b){return b.querySelectorAll(".language-echarts")}},m={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-abc")}},f={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-graphviz")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},w={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}},775:(Z,E,L)=>{L.d(E,{p:()=>m});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(f,v,w,b){function g(o){return o instanceof w?o:new w(function(C){C(o)})}return new(w||(w=Promise))(function(o,C){function _(P){try{M(b.next(P))}catch(V){C(V)}}function D(P){try{M(b.throw(P))}catch(V){C(V)}}function M(P){P.done?o(P.value):g(P.value).then(_,D)}M((b=b.apply(f,v||[])).next())})},p=function(f,v){var w={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},b,g,o,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(M){return function(P){return D([M,P])}}function D(M){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,M[0]&&(w=0)),w;)try{if(b=1,g&&(o=M[0]&2?g.return:M[0]?g.throw||((o=g.return)&&o.call(g),0):g.next)&&!(o=o.call(g,M[1])).done)return o;switch(g=0,o&&(M=[M[0]&2,o.value]),M[0]){case 0:case 1:o=M;break;case 4:return w.label++,{value:M[1],done:!1};case 5:w.label++,g=M[1],M=[0];continue;case 7:M=w.ops.pop(),w.trys.pop();continue;default:if(o=w.trys,!(o=o.length>0&&o[o.length-1])&&(M[0]===6||M[0]===2)){w=0;continue}if(M[0]===3&&(!o||M[1]>o[0]&&M[1]<o[3])){w.label=M[1];break}if(M[0]===6&&w.label<o[1]){w.label=o[1],o=M;break}if(o&&w.label<o[2]){w.label=o[2],w.ops.push(M);break}o[2]&&w.ops.pop(),w.trys.pop();continue}M=v.call(f,w)}catch(P){M=[6,P],g=0}finally{b=o=0}if(M[0]&5)throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}},m=function(f,v,w){f===void 0&&(f=document),v===void 0&&(v=x.g.CDN);var b=c.chartRenderAdapter.getElements(f);b.length>0&&(0,A.G)("".concat(v,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(g){return y(void 0,void 0,void 0,function(){var o,C,_;return p(this,function(D){switch(D.label){case 0:if(g.parentElement.classList.contains("vditor-wysiwyg__pre")||g.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(o=c.chartRenderAdapter.getCode(g).trim(),!o)return[2];D.label=1;case 1:return D.trys.push([1,3,,4]),g.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(o)];case 2:return C=D.sent(),echarts.init(g,w==="dark"?"dark":void 0).setOption(C),g.setAttribute("data-processed","true"),[3,4];case 3:return _=D.sent(),g.className="vditor-reset--error",g.innerHTML="echarts render error: <br>".concat(_),[3,4];case 4:return[2]}})})})})}},428:(Z,E,L)=>{L.d(E,{O:()=>c});var x=L(105),A=L(145),c=function(l,y){Array.from(l.querySelectorAll("pre > code")).filter(function(p,m){return!(p.parentElement.classList.contains("vditor-wysiwyg__pre")||p.parentElement.classList.contains("vditor-ir__marker--pre")||p.classList.contains("language-mermaid")||p.classList.contains("language-flowchart")||p.classList.contains("language-echarts")||p.classList.contains("language-mindmap")||p.classList.contains("language-plantuml")||p.classList.contains("language-markmap")||p.classList.contains("language-abc")||p.classList.contains("language-graphviz")||p.classList.contains("language-math")||p.classList.contains("language-smiles")||p.style.maxHeight.indexOf("px")>-1||l.classList.contains("vditor-preview")&&m>5)}).forEach(function(p){var m,f,v,w=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(_){_.remove()}),w=b.innerText}else w.endsWith(`
|
|
31
|
+
`)&&(w=w.substr(0,w.length-1));var g='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(g='<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 o=document.createElement("div");o.className="vditor-copy",o.innerHTML='<span aria-label="'.concat(((m=window.VditorI18n)===null||m===void 0?void 0:m.copy)||"复制",`"
|
|
32
32
|
onmouseover="this.setAttribute('aria-label', '`).concat(((f=window.VditorI18n)===null||f===void 0?void 0:f.copy)||"复制",`')"
|
|
33
33
|
class="vditor-tooltipped vditor-tooltipped__w"
|
|
34
|
-
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((v=window.VditorI18n)===null||v===void 0?void 0:v.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(g,"</span>");var C=document.createElement("textarea");C.value=(0,x.X)(w),
|
|
35
|
-
`,z=' style="height:'.concat(C.getBoundingClientRect().height,'px"')),M+="<span".concat(z,"></span>")}),C.style.display="none",M='<span class="vditor-linenumber__rows">'.concat(M,"</span>"),g.insertAdjacentHTML("beforeend",M)}}})})})}}},11:(Z,E,L)=>{L.d(E,{K:()=>m});var x=L(145),A=L(413),c=L(840),l={},y=function(f,v){var w=f.transform(v),b=Object.keys(w.features).filter(function(D){return!l[D]});b.forEach(function(D){l[D]=!0});var g=f.getAssets(b),
|
|
34
|
+
onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((v=window.VditorI18n)===null||v===void 0?void 0:v.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(g,"</span>");var C=document.createElement("textarea");C.value=(0,x.X)(w),o.insertAdjacentElement("afterbegin",C),y&&y.renderMenu&&y.renderMenu(p,o),p.before(o),p.style.maxHeight=window.outerHeight-40+"px",p.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(A.g.ZWSP,"</span>"))})}},325:(Z,E,L)=>{L.d(E,{P:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p){p===void 0&&(p=x.g.CDN);var m=c.flowchartRenderAdapter.getElements(y);m.length!==0&&(0,A.G)("".concat(p,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then(function(){m.forEach(function(f){if(f.getAttribute("data-processed")!=="true"){var v=flowchart.parse(c.flowchartRenderAdapter.getCode(f));f.innerHTML="",v.drawSVG(f),f.setAttribute("data-processed","true")}})})}},483:(Z,E,L)=>{L.d(E,{v:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p){p===void 0&&(p=x.g.CDN);var m=c.graphvizRenderAdapter.getElements(y);m.length!==0&&(0,A.G)("".concat(p,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then(function(){m.forEach(function(f){var v=c.graphvizRenderAdapter.getCode(f);if(!(f.parentElement.classList.contains("vditor-wysiwyg__pre")||f.parentElement.classList.contains("vditor-ir__marker--pre"))&&!(f.getAttribute("data-processed")==="true"||v.trim()==="")){try{var w=new Blob(["importScripts('".concat(document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js"),"');")],{type:"application/javascript"}),b=window.URL||window.webkitURL,g=b.createObjectURL(w),o=new Worker(g);new Viz({worker:o}).renderSVGElement(v).then(function(C){f.innerHTML=C.outerHTML}).catch(function(C){f.innerHTML="graphviz render error: <br>".concat(C),f.className="vditor-reset--error"})}catch(C){console.error("graphviz error",C)}f.setAttribute("data-processed","true")}})})}},999:(Z,E,L)=>{L.d(E,{s:()=>l});var x=L(145),A=L(413),c=L(290),l=function(y,p,m){p===void 0&&(p=document),m===void 0&&(m=x.g.CDN);var f=y.style;x.g.CODE_THEME.includes(f)||(f="github");var v=document.getElementById("vditorHljsStyle"),w="".concat(m,"/dist/js/highlight.js/styles/").concat(f,".min.css");if(v&&v.getAttribute("href")!==w&&v.remove(),(0,c.c)("".concat(m,"/dist/js/highlight.js/styles/").concat(f,".min.css"),"vditorHljsStyle"),y.enable!==!1){var b=p.querySelectorAll("pre > code");b.length!==0&&(0,A.G)("".concat(m,"/dist/js/highlight.js/highlight.min.js?v=11.7.0"),"vditorHljsScript").then(function(){(0,A.G)("".concat(m,"/dist/js/highlight.js/third-languages.js?v=1.0.1"),"vditorHljsThirdScript").then(function(){p.querySelectorAll("pre > code").forEach(function(g){if(!(g.parentElement.classList.contains("vditor-ir__marker--pre")||g.parentElement.classList.contains("vditor-wysiwyg__pre"))&&!(g.classList.contains("language-mermaid")||g.classList.contains("language-flowchart")||g.classList.contains("language-echarts")||g.classList.contains("language-mindmap")||g.classList.contains("language-plantuml")||g.classList.contains("language-smiles")||g.classList.contains("language-abc")||g.classList.contains("language-graphviz")||g.classList.contains("language-math"))){y.defaultLang!==""&&g.className.indexOf("language-")===-1&&g.classList.add("language-"+y.defaultLang);var o=g.className.replace("language-","");if(window.hljs.getLanguage(o)||(o="plaintext"),g.innerHTML=window.hljs.highlight(g.textContent,{language:o,ignoreIllegals:!0}).value,g.classList.add("hljs"),!!y.lineNumber){g.classList.add("vditor-linenumber");var C=g.querySelector(".vditor-linenumber__temp");C||(C=document.createElement("div"),C.className="vditor-linenumber__temp",g.insertAdjacentElement("beforeend",C));var _=getComputedStyle(g).whiteSpace,D=!1;(_==="pre-wrap"||_==="pre-line")&&(D=!0);var M="",P=g.textContent.split(/\r\n|\r|\n/g);P.pop(),P.map(function(V){var z="";D&&(C.textContent=V||`
|
|
35
|
+
`,z=' style="height:'.concat(C.getBoundingClientRect().height,'px"')),M+="<span".concat(z,"></span>")}),C.style.display="none",M='<span class="vditor-linenumber__rows">'.concat(M,"</span>"),g.insertAdjacentHTML("beforeend",M)}}})})})}}},11:(Z,E,L)=>{L.d(E,{K:()=>m});var x=L(145),A=L(413),c=L(840),l={},y=function(f,v){var w=f.transform(v),b=Object.keys(w.features).filter(function(D){return!l[D]});b.forEach(function(D){l[D]=!0});var g=f.getAssets(b),o=g.styles,C=g.scripts,_=window.markmap;return o&&_.loadCSS(o),C&&_.loadJS(C),w},p=function(f,v){var w=window.markmap,b=w.Transformer,g=w.Markmap,o=w.deriveOptions;w.globalCSS;var C=new b;f.innerHTML='<svg style="width:100%"></svg>';var _=f.firstChild,D=g.create(_,null),M=y(C,v),P=M.root,V=M.frontmatter,z=V?.markmap,$=o(z);D.setData(P,$),D.fit()},m=function(f,v){f===void 0&&(f=document),v===void 0&&(v=x.g.CDN);var w=c.markmapRenderAdapter.getElements(f);w.length!==0&&(0,A.G)("".concat(v,"/dist/js/markmap/markmap.min.js"),"vditorMarkerScript").then(function(){w.forEach(function(b){var g=c.markmapRenderAdapter.getCode(b);if(!(b.getAttribute("data-processed")==="true"||g.trim()==="")){var o=document.createElement("div");o.className="language-markmap",b.parentNode.appendChild(o),p(o,g),b.parentNode.childNodes[0].nodeName=="CODE"&&b.parentNode.removeChild(b.parentNode.childNodes[0])}})})}},472:(Z,E,L)=>{L.d(E,{H:()=>p});var x=L(145),A=L(413),c=L(290),l=L(105),y=L(840),p=function(m,f){m===void 0&&(m=document);var v=y.mathRenderAdapter.getElements(m);if(v.length!==0){var w={cdn:x.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(f&&f.math&&(f.math=Object.assign({},w.math,f.math)),f=Object.assign({},w,f),f.math.engine==="KaTeX")(0,c.c)("".concat(f.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,A.G)("".concat(f.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then(function(){(0,A.G)("".concat(f.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then(function(){v.forEach(function(o){if(!(o.parentElement.classList.contains("vditor-wysiwyg__pre")||o.parentElement.classList.contains("vditor-ir__marker--pre"))&&!o.getAttribute("data-math")){var C=(0,l.X)(y.mathRenderAdapter.getCode(o));o.setAttribute("data-math",C);try{o.innerHTML=katex.renderToString(C,{displayMode:o.tagName==="DIV",output:"html",macros:f.math.macros})}catch(_){o.innerHTML=_.message,o.className="language-math vditor-reset--error"}o.addEventListener("copy",function(_){_.stopPropagation(),_.preventDefault();var D=_.currentTarget.closest(".language-math");_.clipboardData.setData("text/html",D.innerHTML),_.clipboardData.setData("text/plain",D.getAttribute("data-math"))})}})})});else if(f.math.engine==="MathJax"){var b=function(o){if(o.length!==0){var C=0,_=o[o.length-1],D=function(){var M=o[C++];M===_?M():M(D)};D()}};window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(f.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:f.math.macros}},Object.assign(window.MathJax,f.math.mathJaxOptions)),(0,A.J)("".concat(f.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var g=function(o,C){var _=(0,l.X)(o.textContent).trim(),D=window.MathJax.getMetricsFor(o);D.display=o.tagName==="DIV",window.MathJax.tex2svgPromise(_,D).then(function(M){o.innerHTML="",o.setAttribute("data-math",_),o.append(M),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var P=M.querySelector('[data-mml-node="merror"]');P&&P.textContent.trim()!==""&&(o.innerHTML=P.textContent.trim(),o.className="vditor-reset--error"),C&&C()})};window.MathJax.startup.promise.then(function(){for(var o=[],C=function(D){var M=v[D];!M.parentElement.classList.contains("vditor-wysiwyg__pre")&&!M.parentElement.classList.contains("vditor-ir__marker--pre")&&!M.getAttribute("data-math")&&(0,l.X)(M.textContent).trim()&&o.push(function(P){D===v.length-1?g(M):g(M,P)})},_=0;_<v.length;_++)C(_);b(o)})}}}},280:(Z,E,L)=>{L.d(E,{Y:()=>y});var x=L(494),A=function(p,m){p.insertAdjacentHTML("afterend",'<video controls="controls" src="'.concat(m,'"></video>')),p.remove()},c=function(p,m){p.insertAdjacentHTML("afterend",'<audio controls="controls" src="'.concat(m,'"></audio>')),p.remove()},l=function(p,m){var f=m.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),v=m.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),w=m.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),b=m.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),g=m.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),o=m.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),C=m.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),_=m.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(f&&f[1].length===11)p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'.concat(f[1]+(f[2]?"?start="+f[2]:""),'"></iframe>')),p.remove();else if(v&&v[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'.concat(v[1],'"></iframe>')),p.remove();else if(w&&w[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='.concat(w[1],'"></iframe>')),p.remove();else if(b&&b[1])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
36
36
|
src="//coub.com/embed/`.concat(b[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),p.remove();else if(g&&g[0])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
37
|
-
src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(g[0]),'"></iframe>')),p.remove();else if(
|
|
38
|
-
src="https://www.dailymotion.com/embed/video/`.concat(
|
|
39
|
-
<div style="text-align: left"><small>`).concat(M.message.replace(/\n/,"<br>"),"</small></div>"),P.parentElement.remove(),[3,4];case 4:return
|
|
37
|
+
src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(g[0]),'"></iframe>')),p.remove();else if(o&&o[2])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
|
|
38
|
+
src="https://www.dailymotion.com/embed/video/`.concat(o[2],'"></iframe>')),p.remove();else if(m.indexOf("bilibili.com")>-1&&(m.indexOf("bvid=")>-1||C&&C[1])){var D={bvid:(0,x.on)("bvid",m)||C&&C[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(m.startsWith("http")?m:"https:"+m).search.split("&").forEach(function(V,z){if(V){z===0&&(V=V.substr(1));var $=V.split("=");D[$[0]]=$[1]}});var M="https://player.bilibili.com/player.html?",P=Object.keys(D);P.forEach(function(V,z){M+="".concat(V,"=").concat(D[V]),z<P.length-1&&(M+="&")}),p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(M,'"></iframe>')),p.remove()}else _&&_[1]&&(p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(_[1],'"></iframe>')),p.remove())},y=function(p){p&&p.querySelectorAll("a").forEach(function(m){var f=m.getAttribute("href");f&&(f.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?A(m,f):f.match(/^.+.(mp3|wav|flac)$/)?c(m,f):l(m,f))})}},637:(Z,E,L)=>{L.d(E,{i:()=>m});var x=L(145),A=L(413),c=L(840),l=L(494),y=function(f,v,w,b){function g(o){return o instanceof w?o:new w(function(C){C(o)})}return new(w||(w=Promise))(function(o,C){function _(P){try{M(b.next(P))}catch(V){C(V)}}function D(P){try{M(b.throw(P))}catch(V){C(V)}}function M(P){P.done?o(P.value):g(P.value).then(_,D)}M((b=b.apply(f,v||[])).next())})},p=function(f,v){var w={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},b,g,o,C;return C={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function _(M){return function(P){return D([M,P])}}function D(M){if(b)throw new TypeError("Generator is already executing.");for(;C&&(C=0,M[0]&&(w=0)),w;)try{if(b=1,g&&(o=M[0]&2?g.return:M[0]?g.throw||((o=g.return)&&o.call(g),0):g.next)&&!(o=o.call(g,M[1])).done)return o;switch(g=0,o&&(M=[M[0]&2,o.value]),M[0]){case 0:case 1:o=M;break;case 4:return w.label++,{value:M[1],done:!1};case 5:w.label++,g=M[1],M=[0];continue;case 7:M=w.ops.pop(),w.trys.pop();continue;default:if(o=w.trys,!(o=o.length>0&&o[o.length-1])&&(M[0]===6||M[0]===2)){w=0;continue}if(M[0]===3&&(!o||M[1]>o[0]&&M[1]<o[3])){w.label=M[1];break}if(M[0]===6&&w.label<o[1]){w.label=o[1],o=M;break}if(o&&w.label<o[2]){w.label=o[2],w.ops.push(M);break}o[2]&&w.ops.pop(),w.trys.pop();continue}M=v.call(f,w)}catch(P){M=[6,P],g=0}finally{b=o=0}if(M[0]&5)throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}},m=function(f,v,w){f===void 0&&(f=document),v===void 0&&(v=x.g.CDN);var b=c.mermaidRenderAdapter.getElements(f);b.length!==0&&(0,A.G)("".concat(v,"/dist/js/mermaid/mermaid.min.js?v=11.6.0"),"vditorMermaidScript").then(function(){var g={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}};w==="dark"&&(g.theme="dark"),mermaid.initialize(g),b.forEach(function(o){return y(void 0,void 0,void 0,function(){var C,_,D,M,P;return p(this,function(V){switch(V.label){case 0:if(C=c.mermaidRenderAdapter.getCode(o),o.getAttribute("data-processed")==="true"||C.trim()==="")return[2];_="mermaid"+(0,l.Wb)(),V.label=1;case 1:return V.trys.push([1,3,,4]),[4,mermaid.render(_,o.textContent)];case 2:return D=V.sent(),o.innerHTML=D.svg,[3,4];case 3:return M=V.sent(),P=document.querySelector("#"+_),o.innerHTML="".concat(P.outerHTML,`<br>
|
|
39
|
+
<div style="text-align: left"><small>`).concat(M.message.replace(/\n/,"<br>"),"</small></div>"),P.parentElement.remove(),[3,4];case 4:return o.setAttribute("data-processed","true"),[2]}})})})})}},194:(Z,E,L)=>{L.d(E,{P:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p,m){y===void 0&&(y=document),p===void 0&&(p=x.g.CDN);var f=c.mindmapRenderAdapter.getElements(y);f.length>0&&(0,A.G)("".concat(p,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){f.forEach(function(v){if(!(v.parentElement.classList.contains("vditor-wysiwyg__pre")||v.parentElement.classList.contains("vditor-ir__marker--pre"))){var w=c.mindmapRenderAdapter.getCode(v);if(w)try{if(v.getAttribute("data-processed")==="true")return;echarts.init(v,m==="dark"?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(w))],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,g){var o;return!((o=g?.data)===null||o===void 0)&&o.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),v.setAttribute("data-processed","true")}catch(b){v.className="vditor-reset--error",v.innerHTML="mindmap render error: <br>".concat(b)}}})})}},436:(Z,E,L)=>{L.d(E,{k:()=>c});var x=L(771),A=L(472),c=function(l,y,p){var m="",f=[];if(Array.from(l.children).forEach(function(g,o){if((0,x.W)(g)){if(p){var C=g.id.lastIndexOf("_");g.id=g.id.substring(0,C===-1?void 0:C)+"_"+o}f.push(g.id),m+=g.outerHTML.replace("<wbr>","")}}),m==="")return y.innerHTML="","";var v=document.createElement("div");if(p)p.lute.SetToC(!0),p.currentMode==="wysiwyg"&&!p.preview.element.contains(l)?v.innerHTML=p.lute.SpinVditorDOM("<p>[ToC]</p>"+m):p.currentMode==="ir"&&!p.preview.element.contains(l)?v.innerHTML=p.lute.SpinVditorIRDOM("<p>[ToC]</p>"+m):v.innerHTML=p.lute.HTML2VditorDOM("<p>[ToC]</p>"+m),p.lute.SetToC(p.options.preview.markdown.toc);else{y.classList.add("vditor-outline");var w=Lute.New();w.SetToC(!0),v.innerHTML=w.HTML2VditorDOM("<p>[ToC]</p>"+m)}var b=v.firstElementChild.querySelectorAll("li > span[data-target-id]");return b.forEach(function(g,o){if(g.nextElementSibling&&g.nextElementSibling.tagName==="UL"){var C="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(C='<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>'),g.innerHTML="".concat(C,"<span>").concat(g.innerHTML,"</span>")}else g.innerHTML="<svg></svg><span>".concat(g.innerHTML,"</span>");g.setAttribute("data-target-id",f[o])}),m=v.firstElementChild.innerHTML,b.length===0?(y.innerHTML="",m):(y.innerHTML=m,p&&(0,A.H)(y,{cdn:p.options.cdn,math:p.options.preview.math}),y.firstElementChild.addEventListener("click",function(g){for(var o=g.target;o&&!o.isEqualNode(y);){if(o.classList.contains("vditor-outline__action")){o.classList.contains("vditor-outline__action--close")?(o.classList.remove("vditor-outline__action--close"),o.parentElement.nextElementSibling.setAttribute("style","display:block")):(o.classList.add("vditor-outline__action--close"),o.parentElement.nextElementSibling.setAttribute("style","display:none")),g.preventDefault(),g.stopPropagation();break}else if(o.getAttribute("data-target-id")){g.preventDefault(),g.stopPropagation();var C=document.getElementById(o.getAttribute("data-target-id"));if(!C)return;if(p)if(p.options.height==="auto"){var _=C.offsetTop+p.element.offsetTop;p.options.toolbarConfig.pin||(_+=p.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,_)}else p.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,p.element.offsetTop),p.preview.element.contains(l)?l.parentElement.scrollTop=C.offsetTop:l.scrollTop=C.offsetTop;else window.scrollTo(window.scrollX,C.offsetTop);break}o=o.parentElement}}),m)}},229:(Z,E,L)=>{L.d(E,{B:()=>l});var x=L(145),A=L(413),c=L(840),l=function(y,p){y===void 0&&(y=document),p===void 0&&(p=x.g.CDN);var m=c.plantumlRenderAdapter.getElements(y);m.length!==0&&(0,A.G)("".concat(p,"/dist/js/plantuml/plantuml-encoder.min.js"),"vditorPlantumlScript").then(function(){m.forEach(function(f){if(!(f.parentElement.classList.contains("vditor-wysiwyg__pre")||f.parentElement.classList.contains("vditor-ir__marker--pre"))){var v=c.plantumlRenderAdapter.getCode(f).trim();if(v)try{f.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'.concat(plantumlEncoder.encode(v),'"/>')}catch(w){f.className="vditor-reset--error",f.innerHTML="plantuml render error: <br>".concat(w)}}})})}},214:(Z,E,L)=>{L.d(E,{X:()=>x});var x=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:(Z,E,L)=>{L.d(E,{E:()=>x});var x=function(A,c,l){l===void 0&&(l="classic");var y=A.getBoundingClientRect(),p=36;document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'.concat(l==="dark"?" vditor--dark":"",`">
|
|
40
40
|
<div class="vditor-img__bar">
|
|
41
41
|
<span class="vditor-img__btn" data-deg="0">
|
|
42
42
|
<svg><use xlink:href="#vditor-icon-redo"></use></svg>
|
|
@@ -49,38 +49,38 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
49
49
|
<div class="vditor-img__img" onclick="this.parentElement.outerHTML = '';document.body.style.overflow = ''">
|
|
50
50
|
<img style="width: `).concat(A.width,"px;height:").concat(A.height,"px;transform: translate3d(").concat(y.left,"px, ").concat(y.top-p,'px, 0)" src="').concat(A.getAttribute("src"),`">
|
|
51
51
|
</div>
|
|
52
|
-
</div>`)),document.body.style.overflow="hidden";var m=document.querySelector(".vditor-img img"),f="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-p-A.naturalHeight)/2,"px, 0)");setTimeout(function(){m.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(f)),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)});var v=document.querySelector(".vditor-img__btn");v.addEventListener("click",function(){var w=parseInt(v.getAttribute("data-deg"),10)+90;w/90%2===1&&A.naturalWidth>m.parentElement.clientHeight?m.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(w,"deg)"):m.style.transform="".concat(f," rotateZ(").concat(w,"deg)"),v.setAttribute("data-deg",w.toString()),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)})}},580:(Z,E,L)=>{L.d(E,{Y:()=>c});var x=L(145),A=L(290),c=function(l,y){y===void 0&&(y=x.g.CDN),x.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),m="".concat(y,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==m&&(p.remove(),(0,A.c)(m,"vditorHljsStyle")):(0,A.c)(m,"vditorHljsStyle")}},538:(Z,E,L)=>{L.d(E,{Z:()=>A});var x=L(290),A=function(c,l){if(!(!c||!l)){var y=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");y?y.getAttribute("href")!==p&&(y.remove(),(0,x.c)(p,"vditorContentTheme")):(0,x.c)(p,"vditorContentTheme")}}},413:(Z,E,L)=>{L.d(E,{J:()=>x,G:()=>A});var x=function(c,l){if(document.getElementById(l))return!1;var y=new XMLHttpRequest;y.open("GET",c,!1),y.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),y.send("");var p=document.createElement("script");p.type="text/javascript",p.text=y.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(y,p){if(document.getElementById(l))return y(!0),!1;var m=document.createElement("script");m.src=c,m.async=!0,document.head.appendChild(m),m.onerror=function(f){p(f)},m.onload=function(){if(document.getElementById(l))return m.remove(),y(!0),!1;m.id=l,y(!0)}})}},290:(Z,E,L)=>{L.d(E,{c:()=>x});var x=function(A,c){if(!document.getElementById(c)){var l=document.createElement("link");l.id=c,l.rel="stylesheet",l.type="text/css",l.href=A,document.getElementsByTagName("head")[0].appendChild(l)}}},105:(Z,E,L)=>{L.d(E,{X:()=>x});var x=function(A){return A.replace(/\u00a0/g," ")}},410:(Z,E,L)=>{L.d(E,{G6:()=>x,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>y,ns:()=>p,i7:()=>m});var x=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},c=function(){try{return typeof localStorage<"u"}catch{return!1}},l=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},y=function(f){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(f.metaKey&&!f.ctrlKey):!!(!f.metaKey&&f.ctrlKey)},p=function(f){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?f.indexOf("⇧")>-1&&A()&&(f=f.replace(";",":").replace("=","+").replace("-","_")):(f.startsWith("⌘")?f=f.replace("⌘","⌘+"):f.startsWith("⌥")&&f.substr(1,1)!=="⌘"?f=f.replace("⌥","⌥+"):f=f.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),f=f.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),f.indexOf("Shift")>-1&&(f=f.replace(";",":").replace("=","+").replace("-","_"))),f},m=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}},494:(Z,E,L)=>{L.d(E,{Wb:()=>x,on:()=>A,Qf:()=>c});var x=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(l){return(parseInt(l,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(l,10)/4).toString(16)})},A=function(l,y){y===void 0&&(y=window.location.search);var p=y.substring(y.indexOf("?")),m=p.indexOf("#"),f=new URLSearchParams(p.substring(0,m>=0?m:void 0));return f.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}},106:(Z,E,L)=>{L.d(E,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>y,F9:()=>p,lG:()=>m,fb:()=>f,DX:()=>v});var x=L(771),A=function(w,b){for(var g=f(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=f(g.parentElement,b),s?g=s:C=!0;return g||!1},c=function(w,b){for(var g=(0,x.S)(w,b),s=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)s=(0,x.S)(g.parentElement,b),s?g=s:C=!0;return g||!1},l=function(w){var b=c(w,"UL"),g=c(w,"OL"),s=b;return g&&(!b||b&&g.contains(b))&&(s=g),s},y=function(w,b,g){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var s=w,C=!1;s&&!C&&!s.classList.contains("vditor-reset");)s.getAttribute(b)===g?C=!0:s=s.parentElement;return C&&s},p=function(w){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);var b=w,g=!1,s=y(w,"data-block","0");if(s)return s;for(;b&&!g&&!b.classList.contains("vditor-reset");)b.tagName==="H1"||b.tagName==="H2"||b.tagName==="H3"||b.tagName==="H4"||b.tagName==="H5"||b.tagName==="H6"||b.tagName==="P"||b.tagName==="BLOCKQUOTE"||b.tagName==="OL"||b.tagName==="UL"?g=!0:b=b.parentElement;return g&&b},m=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},f=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,s=!1;g&&!s&&!g.classList.contains("vditor-reset");)g.classList.contains(b)?s=!0:g=g.parentElement;return s&&g},v=function(w){for(;w&&w.lastChild;)w=w.lastChild;return w}},771:(Z,E,L)=>{L.d(E,{S:()=>x,W:()=>A});var x=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var y=c,p=!1;y&&!p&&!y.classList.contains("vditor-reset");)y.nodeName.indexOf(l)===0?p=!0:y=y.parentElement;return p&&y},A=function(c){var l=x(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}},673:(Z,E,L)=>{L.d(E,{T:()=>x});var x=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},y=function(m){for(var f in m)m.hasOwnProperty(f)&&(Object.prototype.toString.call(m[f])==="[object Object]"?l[f]=x(l[f],m[f]):l[f]=m[f])},p=0;p<A.length;p++)y(A[p]);return l}},810:(Z,E,L)=>{L.d(E,{zh:()=>l,Ny:()=>y,Gb:()=>p,Hc:()=>m,im:()=>f,$j:()=>v,ib:()=>w,oC:()=>b});var x=L(145),A=L(410),c=L(106),l=function(g){var s,C=g[g.currentMode].element;return getSelection().rangeCount>0&&(s=getSelection().getRangeAt(0),C.isEqualNode(s.startContainer)||C.contains(s.startContainer))?s:g[g.currentMode].range?g[g.currentMode].range:(C.focus(),s=C.ownerDocument.createRange(),s.setStart(C,0),s.collapse(!0),s)},y=function(g){var s=window.getSelection().getRangeAt(0);if(!g.contains(s.startContainer)&&!(0,c.fb)(s.startContainer,"vditor-panel--none"))return{left:0,top:0};var C=g.parentElement.getBoundingClientRect(),_;if(s.getClientRects().length===0)if(s.startContainer.nodeType===3){var D=s.startContainer.parentElement;if(D&&D.getClientRects().length>0)_=D.getClientRects()[0];else return{left:0,top:0}}else{var M=s.startContainer.children;if(M[s.startOffset]&&M[s.startOffset].getClientRects().length>0)_=M[s.startOffset].getClientRects()[0];else if(s.startContainer.childNodes.length>0){var P=s.cloneRange();s.selectNode(s.startContainer.childNodes[Math.max(0,s.startOffset-1)]),_=s.getClientRects()[0],s.setEnd(P.endContainer,P.endOffset),s.setStart(P.startContainer,P.startOffset)}else _=s.startContainer.getClientRects()[0];if(!_){for(var V=s.startContainer.childNodes[s.startOffset];!V.getClientRects||V.getClientRects&&V.getClientRects().length===0;)V=V.parentElement;_=V.getClientRects()[0]}}else _=s.getClientRects()[0];return{left:_.left-C.left,top:_.top-C.top}},p=function(g,s){if(!s){if(getSelection().rangeCount===0)return!1;s=getSelection().getRangeAt(0)}var C=s.commonAncestorContainer;return g.isEqualNode(C)||g.contains(C)},m=function(g){var s=window.getSelection();s.removeAllRanges(),s.addRange(g)},f=function(g,s,C){var _={end:0,start:0};if(!C){if(getSelection().rangeCount===0)return _;C=window.getSelection().getRangeAt(0)}if(p(s,C)){var D=C.cloneRange();g.childNodes[0]&&g.childNodes[0].childNodes[0]?D.setStart(g.childNodes[0].childNodes[0],0):D.selectNodeContents(g),D.setEnd(C.startContainer,C.startOffset),_.start=D.toString().length,_.end=_.start+C.toString().length}return _},v=function(g,s,C){var _=0,D=0,M=C.childNodes[D],P=!1,V=!1;g=Math.max(0,g),s=Math.max(0,s);var z=C.ownerDocument.createRange();for(z.setStart(M||C,0),z.collapse(!0);!V&&M;){var $=_+M.textContent.length;if(!P&&g>=_&&g<=$&&(g===0?z.setStart(M,0):M.childNodes[0].nodeType===3?z.setStart(M.childNodes[0],g-_):M.nextSibling?z.setStartBefore(M.nextSibling):z.setStartAfter(M),P=!0,g===s)){V=!0;break}P&&s>=_&&s<=$&&(s===0?z.setEnd(M,0):M.childNodes[0].nodeType===3?z.setEnd(M.childNodes[0],s-_):M.nextSibling?z.setEndBefore(M.nextSibling):z.setEndAfter(M),V=!0),_=$,M=C.childNodes[++D]}return!V&&C.childNodes[D-1]&&z.setStartBefore(C.childNodes[D-1]),m(z),z},w=function(g,s){var C=g.querySelector("wbr");if(C){if(!C.previousElementSibling)C.previousSibling?s.setStart(C.previousSibling,C.previousSibling.textContent.length):C.nextSibling?C.nextSibling.nodeType===3?s.setStart(C.nextSibling,0):s.setStartBefore(C.nextSibling):s.setStart(C.parentElement,0);else if(C.previousElementSibling.isSameNode(C.previousSibling))if(C.previousElementSibling.lastChild){s.setStartBefore(C),s.collapse(!0),m(s),(0,A.i7)()&&(C.previousElementSibling.tagName==="EM"||C.previousElementSibling.tagName==="STRONG"||C.previousElementSibling.tagName==="S")&&(s.insertNode(document.createTextNode(x.g.ZWSP)),s.collapse(!1)),C.remove();return}else s.setStartAfter(C.previousElementSibling);else s.setStart(C.previousSibling,C.previousSibling.textContent.length);s.collapse(!0),C.remove(),m(s)}},b=function(g,s){var C=document.createElement("div");C.innerHTML=g;var _=C.querySelectorAll("p");_.length===1&&!_[0].previousSibling&&!_[0].nextSibling&&s[s.currentMode].element.children.length>0&&C.firstElementChild.tagName==="P"&&(g=_[0].innerHTML.trim());var D=document.createElement("div");D.innerHTML=g;var M=l(s);if(M.toString()!==""&&(s[s.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),D.firstElementChild&&D.firstElementChild.getAttribute("data-block")==="0"){D.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var P=(0,c.F9)(M.startContainer);P?P.insertAdjacentHTML("afterend",D.innerHTML):s[s.currentMode].element.insertAdjacentHTML("beforeend",D.innerHTML),w(s[s.currentMode].element,M)}else{var V=document.createElement("template");V.innerHTML=g,M.insertNode(V.content.cloneNode(!0)),M.collapse(!1),m(M)}}}},nt={};function Y(Z){var E=nt[Z];if(E!==void 0)return E.exports;var L=nt[Z]={exports:{}};return dt[Z](L,L.exports,Y),L.exports}Y.d=(Z,E)=>{for(var L in E)Y.o(E,L)&&!Y.o(Z,L)&&Object.defineProperty(Z,L,{enumerable:!0,get:E[L]})},Y.o=(Z,E)=>Object.prototype.hasOwnProperty.call(Z,E),Y.r=Z=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})};var xe={};return(()=>{Y.d(xe,{default:()=>Ei});var Z=Y(408),E=Y(145),L=Y(105),x=function(e){return e.currentMode==="sv"?(0,L.X)("".concat(e.sv.element.textContent,`
|
|
52
|
+
</div>`)),document.body.style.overflow="hidden";var m=document.querySelector(".vditor-img img"),f="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-p-A.naturalHeight)/2,"px, 0)");setTimeout(function(){m.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(f)),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)});var v=document.querySelector(".vditor-img__btn");v.addEventListener("click",function(){var w=parseInt(v.getAttribute("data-deg"),10)+90;w/90%2===1&&A.naturalWidth>m.parentElement.clientHeight?m.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(w,"deg)"):m.style.transform="".concat(f," rotateZ(").concat(w,"deg)"),v.setAttribute("data-deg",w.toString()),setTimeout(function(){m.parentElement.scrollTo((m.parentElement.scrollWidth-m.parentElement.clientWidth)/2,(m.parentElement.scrollHeight-m.parentElement.clientHeight)/2)},400)})}},580:(Z,E,L)=>{L.d(E,{Y:()=>c});var x=L(145),A=L(290),c=function(l,y){y===void 0&&(y=x.g.CDN),x.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),m="".concat(y,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==m&&(p.remove(),(0,A.c)(m,"vditorHljsStyle")):(0,A.c)(m,"vditorHljsStyle")}},538:(Z,E,L)=>{L.d(E,{Z:()=>A});var x=L(290),A=function(c,l){if(!(!c||!l)){var y=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");y?y.getAttribute("href")!==p&&(y.remove(),(0,x.c)(p,"vditorContentTheme")):(0,x.c)(p,"vditorContentTheme")}}},413:(Z,E,L)=>{L.d(E,{J:()=>x,G:()=>A});var x=function(c,l){if(document.getElementById(l))return!1;var y=new XMLHttpRequest;y.open("GET",c,!1),y.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),y.send("");var p=document.createElement("script");p.type="text/javascript",p.text=y.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(y,p){if(document.getElementById(l))return y(!0),!1;var m=document.createElement("script");m.src=c,m.async=!0,document.head.appendChild(m),m.onerror=function(f){p(f)},m.onload=function(){if(document.getElementById(l))return m.remove(),y(!0),!1;m.id=l,y(!0)}})}},290:(Z,E,L)=>{L.d(E,{c:()=>x});var x=function(A,c){if(!document.getElementById(c)){var l=document.createElement("link");l.id=c,l.rel="stylesheet",l.type="text/css",l.href=A,document.getElementsByTagName("head")[0].appendChild(l)}}},105:(Z,E,L)=>{L.d(E,{X:()=>x});var x=function(A){return A.replace(/\u00a0/g," ")}},410:(Z,E,L)=>{L.d(E,{G6:()=>x,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>y,ns:()=>p,i7:()=>m});var x=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},c=function(){try{return typeof localStorage<"u"}catch{return!1}},l=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},y=function(f){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(f.metaKey&&!f.ctrlKey):!!(!f.metaKey&&f.ctrlKey)},p=function(f){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?f.indexOf("⇧")>-1&&A()&&(f=f.replace(";",":").replace("=","+").replace("-","_")):(f.startsWith("⌘")?f=f.replace("⌘","⌘+"):f.startsWith("⌥")&&f.substr(1,1)!=="⌘"?f=f.replace("⌥","⌥+"):f=f.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),f=f.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),f.indexOf("Shift")>-1&&(f=f.replace(";",":").replace("=","+").replace("-","_"))),f},m=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}},494:(Z,E,L)=>{L.d(E,{Wb:()=>x,on:()=>A,Qf:()=>c});var x=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(l){return(parseInt(l,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(l,10)/4).toString(16)})},A=function(l,y){y===void 0&&(y=window.location.search);var p=y.substring(y.indexOf("?")),m=p.indexOf("#"),f=new URLSearchParams(p.substring(0,m>=0?m:void 0));return f.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}},106:(Z,E,L)=>{L.d(E,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>y,F9:()=>p,lG:()=>m,fb:()=>f,DX:()=>v});var x=L(771),A=function(w,b){for(var g=f(w,b),o=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)o=f(g.parentElement,b),o?g=o:C=!0;return g||!1},c=function(w,b){for(var g=(0,x.S)(w,b),o=!1,C=!1;g&&!g.classList.contains("vditor-reset")&&!C;)o=(0,x.S)(g.parentElement,b),o?g=o:C=!0;return g||!1},l=function(w){var b=c(w,"UL"),g=c(w,"OL"),o=b;return g&&(!b||b&&g.contains(b))&&(o=g),o},y=function(w,b,g){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var o=w,C=!1;o&&!C&&!o.classList.contains("vditor-reset");)o.getAttribute(b)===g?C=!0:o=o.parentElement;return C&&o},p=function(w){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);var b=w,g=!1,o=y(w,"data-block","0");if(o)return o;for(;b&&!g&&!b.classList.contains("vditor-reset");)b.tagName==="H1"||b.tagName==="H2"||b.tagName==="H3"||b.tagName==="H4"||b.tagName==="H5"||b.tagName==="H6"||b.tagName==="P"||b.tagName==="BLOCKQUOTE"||b.tagName==="OL"||b.tagName==="UL"?g=!0:b=b.parentElement;return g&&b},m=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,o=!1;g&&!o&&!g.classList.contains("vditor-reset");)g.nodeName===b?o=!0:g=g.parentElement;return o&&g},f=function(w,b){if(!w)return!1;w.nodeType===3&&(w=w.parentElement);for(var g=w,o=!1;g&&!o&&!g.classList.contains("vditor-reset");)g.classList.contains(b)?o=!0:g=g.parentElement;return o&&g},v=function(w){for(;w&&w.lastChild;)w=w.lastChild;return w}},771:(Z,E,L)=>{L.d(E,{S:()=>x,W:()=>A});var x=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var y=c,p=!1;y&&!p&&!y.classList.contains("vditor-reset");)y.nodeName.indexOf(l)===0?p=!0:y=y.parentElement;return p&&y},A=function(c){var l=x(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}},673:(Z,E,L)=>{L.d(E,{T:()=>x});var x=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},y=function(m){for(var f in m)m.hasOwnProperty(f)&&(Object.prototype.toString.call(m[f])==="[object Object]"?l[f]=x(l[f],m[f]):l[f]=m[f])},p=0;p<A.length;p++)y(A[p]);return l}},810:(Z,E,L)=>{L.d(E,{zh:()=>l,Ny:()=>y,Gb:()=>p,Hc:()=>m,im:()=>f,$j:()=>v,ib:()=>w,oC:()=>b});var x=L(145),A=L(410),c=L(106),l=function(g){var o,C=g[g.currentMode].element;return getSelection().rangeCount>0&&(o=getSelection().getRangeAt(0),C.isEqualNode(o.startContainer)||C.contains(o.startContainer))?o:g[g.currentMode].range?g[g.currentMode].range:(C.focus(),o=C.ownerDocument.createRange(),o.setStart(C,0),o.collapse(!0),o)},y=function(g){var o=window.getSelection().getRangeAt(0);if(!g.contains(o.startContainer)&&!(0,c.fb)(o.startContainer,"vditor-panel--none"))return{left:0,top:0};var C=g.parentElement.getBoundingClientRect(),_;if(o.getClientRects().length===0)if(o.startContainer.nodeType===3){var D=o.startContainer.parentElement;if(D&&D.getClientRects().length>0)_=D.getClientRects()[0];else return{left:0,top:0}}else{var M=o.startContainer.children;if(M[o.startOffset]&&M[o.startOffset].getClientRects().length>0)_=M[o.startOffset].getClientRects()[0];else if(o.startContainer.childNodes.length>0){var P=o.cloneRange();o.selectNode(o.startContainer.childNodes[Math.max(0,o.startOffset-1)]),_=o.getClientRects()[0],o.setEnd(P.endContainer,P.endOffset),o.setStart(P.startContainer,P.startOffset)}else _=o.startContainer.getClientRects()[0];if(!_){for(var V=o.startContainer.childNodes[o.startOffset];!V.getClientRects||V.getClientRects&&V.getClientRects().length===0;)V=V.parentElement;_=V.getClientRects()[0]}}else _=o.getClientRects()[0];return{left:_.left-C.left,top:_.top-C.top}},p=function(g,o){if(!o){if(getSelection().rangeCount===0)return!1;o=getSelection().getRangeAt(0)}var C=o.commonAncestorContainer;return g.isEqualNode(C)||g.contains(C)},m=function(g){var o=window.getSelection();o.removeAllRanges(),o.addRange(g)},f=function(g,o,C){var _={end:0,start:0};if(!C){if(getSelection().rangeCount===0)return _;C=window.getSelection().getRangeAt(0)}if(p(o,C)){var D=C.cloneRange();g.childNodes[0]&&g.childNodes[0].childNodes[0]?D.setStart(g.childNodes[0].childNodes[0],0):D.selectNodeContents(g),D.setEnd(C.startContainer,C.startOffset),_.start=D.toString().length,_.end=_.start+C.toString().length}return _},v=function(g,o,C){var _=0,D=0,M=C.childNodes[D],P=!1,V=!1;g=Math.max(0,g),o=Math.max(0,o);var z=C.ownerDocument.createRange();for(z.setStart(M||C,0),z.collapse(!0);!V&&M;){var $=_+M.textContent.length;if(!P&&g>=_&&g<=$&&(g===0?z.setStart(M,0):M.childNodes[0].nodeType===3?z.setStart(M.childNodes[0],g-_):M.nextSibling?z.setStartBefore(M.nextSibling):z.setStartAfter(M),P=!0,g===o)){V=!0;break}P&&o>=_&&o<=$&&(o===0?z.setEnd(M,0):M.childNodes[0].nodeType===3?z.setEnd(M.childNodes[0],o-_):M.nextSibling?z.setEndBefore(M.nextSibling):z.setEndAfter(M),V=!0),_=$,M=C.childNodes[++D]}return!V&&C.childNodes[D-1]&&z.setStartBefore(C.childNodes[D-1]),m(z),z},w=function(g,o){var C=g.querySelector("wbr");if(C){if(!C.previousElementSibling)C.previousSibling?o.setStart(C.previousSibling,C.previousSibling.textContent.length):C.nextSibling?C.nextSibling.nodeType===3?o.setStart(C.nextSibling,0):o.setStartBefore(C.nextSibling):o.setStart(C.parentElement,0);else if(C.previousElementSibling.isSameNode(C.previousSibling))if(C.previousElementSibling.lastChild){o.setStartBefore(C),o.collapse(!0),m(o),(0,A.i7)()&&(C.previousElementSibling.tagName==="EM"||C.previousElementSibling.tagName==="STRONG"||C.previousElementSibling.tagName==="S")&&(o.insertNode(document.createTextNode(x.g.ZWSP)),o.collapse(!1)),C.remove();return}else o.setStartAfter(C.previousElementSibling);else o.setStart(C.previousSibling,C.previousSibling.textContent.length);o.collapse(!0),C.remove(),m(o)}},b=function(g,o){var C=document.createElement("div");C.innerHTML=g;var _=C.querySelectorAll("p");_.length===1&&!_[0].previousSibling&&!_[0].nextSibling&&o[o.currentMode].element.children.length>0&&C.firstElementChild.tagName==="P"&&(g=_[0].innerHTML.trim());var D=document.createElement("div");D.innerHTML=g;var M=l(o);if(M.toString()!==""&&(o[o.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),D.firstElementChild&&D.firstElementChild.getAttribute("data-block")==="0"){D.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var P=(0,c.F9)(M.startContainer);P?P.insertAdjacentHTML("afterend",D.innerHTML):o[o.currentMode].element.insertAdjacentHTML("beforeend",D.innerHTML),w(o[o.currentMode].element,M)}else{var V=document.createElement("template");V.innerHTML=g,M.insertNode(V.content.cloneNode(!0)),M.collapse(!1),m(M)}}}},nt={};function Y(Z){var E=nt[Z];if(E!==void 0)return E.exports;var L=nt[Z]={exports:{}};return dt[Z](L,L.exports,Y),L.exports}Y.d=(Z,E)=>{for(var L in E)Y.o(E,L)&&!Y.o(Z,L)&&Object.defineProperty(Z,L,{enumerable:!0,get:E[L]})},Y.o=(Z,E)=>Object.prototype.hasOwnProperty.call(Z,E),Y.r=Z=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})};var ke={};return(()=>{Y.d(ke,{default:()=>Ei});var Z=Y(408),E=Y(145),L=Y(105),x=function(e){return e.currentMode==="sv"?(0,L.X)("".concat(e.sv.element.textContent,`
|
|
53
53
|
`).replace(/\n\n$/,`
|
|
54
|
-
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=Y(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(x(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=Y(410),y=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")}})},m=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.classList.remove(E.g.CLASS_MENU_DISABLED)}})},f=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.classList.add(E.g.CLASS_MENU_DISABLED)}})},v=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},w=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},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")},g=function(e,t,n,r){n.addEventListener((0,l.Le)(),function(i){i.preventDefault(),i.stopPropagation(),!n.classList.contains(E.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")))})},
|
|
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
|
|
56
|
-
`);u--)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==" "){
|
|
57
|
-
`){h=!1;break}if(
|
|
58
|
-
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}if(
|
|
54
|
+
`)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=Y(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(x(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=Y(410),y=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")}})},m=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.classList.remove(E.g.CLASS_MENU_DISABLED)}})},f=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(E.g.CLASS_MENU_DISABLED)&&r.classList.add(E.g.CLASS_MENU_DISABLED)}})},v=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},w=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},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")},g=function(e,t,n,r){n.addEventListener((0,l.Le)(),function(i){i.preventDefault(),i.stopPropagation(),!n.classList.contains(E.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")))})},o=Y(106),C=Y(771),_=function(e,t,n,r){r&&console.log("".concat(e," - ").concat(n,": ").concat(t))},D=Y(135),M=Y(775),P=Y(428),V=Y(325),z=Y(483),$=Y(999),ne=Y(472),oe=Y(637),ge=Y(11),de=Y(194),le=Y(229),ve=Y(825),Te=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 s=t||e;return/\n/.test(s)||a.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(s.replace(/&/g,"&").replace(/</g,"<"),"<wbr></code></pre></div>"):"\n```\n"+s.replace(/&/g,"&").replace(/</g,"<")+"\n```":n==="wysiwyg"?"<code>".concat(s.replace(/&/g,"&").replace(/</g,"<"),"</code><wbr>"):"`".concat(s,"`")}return!1},Ee=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,D.Q)(e,t.options.cdn);else if(n==="mermaid")(0,oe.i)(e,t.options.cdn,t.options.theme);else if(n==="smiles")(0,ve.J)(e,t.options.cdn,t.options.theme);else if(n==="markmap")(0,ge.K)(e,t.options.cdn);else if(n==="flowchart")(0,V.P)(e,t.options.cdn);else if(n==="echarts")(0,M.p)(e,t.options.cdn,t.options.theme);else if(n==="mindmap")(0,de.P)(e,t.options.cdn,t.options.theme);else if(n==="plantuml")(0,le.B)(e,t.options.cdn);else if(n==="graphviz")(0,z.v)(e,t.options.cdn);else if(n==="math")(0,ne.H)(e,{cdn:t.options.cdn,math:t.options.preview.math});else{var r=t.options.customRenders.find(function(i){if(i.language===n)return i.render(e,t),!0});r||((0,$.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,P.O)(e,t.options.preview.hljs))}e.setAttribute("data-render","1")}},k=Y(810),je=function(e){if(e.currentMode!=="sv"){var t=e[e.currentMode].element,n=e.outline.render(e);n===""&&(n="[ToC]"),t.querySelectorAll('[data-type="toc-block"]').forEach(function(r){r.innerHTML=n,(0,ne.H)(r,{cdn:e.options.cdn,math:e.options.preview.math})})}},pt=function(e,t){var n=(0,o.lG)(e.target,"SPAN");if(n&&(0,o.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}},ht=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,k.im)(e,t[t.currentMode].element,r).start===0)return e.previousElementSibling.remove(),ee(t),!0;if(Qe(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,k.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),ee(t),!0;if(lt(t,n,r,e,e.nextElementSibling))return!0}if(n.key==="Backspace"||n.key==="Delete"){var i=(0,o.fb)(r.startContainer,"vditor-toc");if(i)return i.remove(),ee(t),!0}},Fe=function(e,t,n,r){n===void 0&&(n=!1);var i=(0,o.F9)(t.startContainer);if(i&&!n&&i.getAttribute("data-type")!=="code-block"){if(Ut(i.innerHTML)&&i.previousElementSibling||Vt(i.innerHTML))return;for(var a=(0,k.im)(i,e.ir.element,t).start,s=!0,u=a-1;u>i.textContent.substr(0,a).lastIndexOf(`
|
|
56
|
+
`);u--)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==" "){s=!1;break}a===0&&(s=!1);for(var h=!0,u=a-1;u<i.textContent.length;u++)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==`
|
|
57
|
+
`){h=!1;break}if(s){typeof e.options.input=="function"&&e.options.input(x(e));return}if(h&&/^#{1,6} $/.test(i.textContent)&&(h=!1),h){var d=(0,o.fb)(t.startContainer,"vditor-ir__marker");if(!d){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(x(e));return}}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(Q){Q.classList.remove("vditor-ir__node--expand")}),i||(i=e.ir.element),!i.querySelector("wbr")){var T=(0,o.fb)(t.startContainer,"vditor-ir__preview");T?T.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}i.querySelectorAll("[style]").forEach(function(Q){Q.removeAttribute("style")}),i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.ir.element);var R=i.isEqualNode(e.ir.element),I=(0,o.a1)(i,"data-type","footnotes-block"),O="";if(R)O=i.innerHTML;else{var q=(0,C.S)(t.startContainer,"BLOCKQUOTE"),B=(0,o.O9)(t.startContainer);if(B&&(i=B),q&&(!B||B&&!q.contains(B))&&(i=q),I&&(i=I),O=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var H=i.previousElementSibling,G=i.nextElementSibling;H&&(H.tagName==="UL"||H.tagName==="OL")&&(O=H.outerHTML+O,H.remove()),G&&(G.tagName==="UL"||G.tagName==="OL")&&(O=O+G.outerHTML,G.remove()),O=O.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else i.previousElementSibling&&i.previousElementSibling.textContent.replace(E.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(Q){Q&&!i.isEqualNode(Q)&&(O+=Q.outerHTML,Q.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(Q){Q&&!i.isEqualNode(Q)&&(O+=Q.outerHTML,Q.remove())}))}if(_("SpinVditorIRDOM",O,"argument",e.options.debugger),O=e.lute.SpinVditorIRDOM(O),_("SpinVditorIRDOM",O,"result",e.options.debugger),R)i.innerHTML=O;else if(i.outerHTML=O,I){var W=(0,o.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(W){var J=W.textContent,se=J.substring(1,J.indexOf("]:")),ae=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(se,'"]'));ae&&ae.setAttribute("aria-label",J.substr(se.length+3).trim().substr(0,24))}}var ue,Ae=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");Ae.forEach(function(Q,we){we===0?ue=Q:(ue.insertAdjacentHTML("beforeend",Q.innerHTML),Q.remove())}),Ae.length>0&&e.ir.element.insertAdjacentElement("beforeend",Ae[0]);var Me,xe=e.ir.element.querySelectorAll("[data-type='footnotes-block']");xe.forEach(function(Q,we){we===0?Me=Q:(Me.insertAdjacentHTML("beforeend",Q.innerHTML),Q.remove())}),xe.length>0&&e.ir.element.insertAdjacentElement("beforeend",xe[0]),(0,k.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(Q){Ee(Q,e)}),je(e),Ve(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},N=function(e,t){if(e==="")return!1;if(e.indexOf("⇧")===-1&&e.indexOf("⌘")===-1&&e.indexOf("⌥")===-1)return!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.code===e;if(e==="⇧Tab")return!!(!(0,l.yl)(t)&&!t.altKey&&t.shiftKey&&t.code==="Tab");var n=e.split("");if(e.startsWith("⌥")){var r=n.length===3?n[2]:n[1];return!!((n.length===3?(0,l.yl)(t):!(0,l.yl)(t))&&t.altKey&&!t.shiftKey&&t.code===(/^[0-9]$/.test(r)?"Digit":"Key")+r)}e==="⌘Enter"&&(n=["⌘","Enter"]);var i=n.length>2&&n[0]==="⇧",a=i?n[2]:n[1];return i&&((0,l.vU)()||!/Mac/.test(navigator.platform))&&(a==="-"?a="_":a==="="&&(a="+")),!!((0,l.yl)(t)&&t.key.toLowerCase()===a.toLowerCase()&&!t.altKey&&(!i&&!t.shiftKey||i&&t.shiftKey))},re=function(e){var t=e.startContainer;if(t.nodeType===3&&t.nodeValue.length!==e.startOffset)return!1;for(var n=t.nextSibling;n&&n.textContent==="";)n=n.nextSibling;if(n){if(n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&!n.getAttribute("data-block"))return n}else{var r=(0,o.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},U=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},j=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(s){s.classList.remove("vditor-ir__node--expand")});var n=(0,o.JQ)(e.startContainer,"vditor-ir__node"),r=!e.collapsed&&(0,o.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,k.Hc)(e));var i=re(e);if(i){i.classList.add("vditor-ir__node--expand"),i.classList.remove("vditor-ir__node--hidden");return}var a=U(e);if(a){a.classList.add("vditor-ir__node--expand"),a.classList.remove("vditor-ir__node--hidden");return}}},he=function(e,t){if(e.ir.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,k.zh)(e),r=n.startContainer;if(!on(t,e,r)||(sn(n,e,t),Sn(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,o.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 s=i.nextSibling;s&&(n.insertNode(document.createTextNode(s.textContent)),n.collapse(!0))}var u=(0,o.lG)(r,"P");if(dn(t,e,u,n)||fn(n,e,u,t)||wn(e,n,t,u))return!0;var h=(0,o.fb)(r,"vditor-ir__marker--pre");if(h&&h.tagName==="PRE"){var d=h.firstChild;if(bn(e,t,h,n)||(d.getAttribute("data-type")==="math-block"||d.getAttribute("data-type")==="html-block")&&Qe(e,t,n,d,h.parentElement)||lt(e,t,n,d,h.parentElement))return!0}var S=(0,o.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,k.im)(S,e.ir.element).start;T===1&&n.setStart(r,0),T===2&&(e.hint.recentLanguage="")}if(Qe(e,t,n,S,S.parentElement))return b(e,["hint"]),!0}var R=(0,o.lG)(r,"TD")||(0,o.lG)(r,"TH");if(t.key.indexOf("Arrow")>-1&&R){var I=ar(R);if(I&&Qe(e,t,n,R,I))return!0;var O=or(R);if(O&<(e,t,n,R,O))return!0}if(yn(e,t,n)||vn(e,n,t)||Wt(e,n,t))return!0;var q=(0,C.W)(r);if(q){if(N("⌘=",t)){var B=q.querySelector(".vditor-ir__marker--heading");return B&&B.textContent.trim().length>1&&ct(e,B.textContent.substr(1)),t.preventDefault(),!0}if(N("⌘-",t)){var B=q.querySelector(".vditor-ir__marker--heading");return B&&B.textContent.trim().length<6&&ct(e,B.textContent.trim()+"# "),t.preventDefault(),!0}}var H=(0,o.F9)(r);if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(En(e,n,t,u))return!0;if(H&&H.previousElementSibling&&H.tagName!=="UL"&&H.tagName!=="OL"&&(H.previousElementSibling.getAttribute("data-type")==="code-block"||H.previousElementSibling.getAttribute("data-type")==="math-block")){var G=(0,k.im)(H,e.ir.element,n).start;if(G===0||G===1&&H.innerText.startsWith(E.g.ZWSP))return n.selectNodeContents(H.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),n.collapse(!1),j(n,e),H.textContent.trim().replace(E.g.ZWSP,"")===""&&(H.remove(),Ve(e)),t.preventDefault(),!0}if(q){var W=q.firstElementChild.textContent.length;(0,k.im)(q,e.ir.element).start===W&&W!==0&&(n.setStart(q.firstElementChild.firstChild,W-1),n.collapse(!0),(0,k.Hc)(n))}}return(t.key==="ArrowUp"||t.key==="ArrowDown")&&H&&(H.querySelectorAll(".vditor-ir__node").forEach(function(J){J.contains(r)||J.classList.add("vditor-ir__node--hidden")}),Cn(t,H,n))?!0:(ln(n,t.key),H&&ht(H,e,t,n)?(t.preventDefault(),!0):!1)},K=Y(190),ye=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(s){r.append(s.cloneNode(!0))}),i=i.nextSibling,a.remove()}t&&t(r)})},ie=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,o.a1)(i,"data-block","0");if(a&&t&&(t.inputType==="deleteContentBackward"||t.data===" ")){for(var s=(0,k.im)(a,e.sv.element,r).start,u=!0,h=s-1;h>a.textContent.substr(0,s).lastIndexOf(`
|
|
58
|
+
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}if(s===0&&(u=!1),u){Se(e);return}if(t.inputType==="deleteContentBackward"){var d=(0,o.a1)(i,"data-type","code-block-open-marker")||(0,o.a1)(i,"data-type","code-block-close-marker");if(d){if(d.getAttribute("data-type")==="code-block-close-marker"){var S=yt(i,"code-block-open-marker");if(S){S.textContent=d.textContent,Se(e);return}}if(d.getAttribute("data-type")==="code-block-open-marker"){var S=yt(i,"code-block-close-marker",!1);if(S){S.textContent=d.textContent,Se(e);return}}}var T=(0,o.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(),Se(e));return}a.querySelectorAll('[data-type="code-block-open-marker"]').forEach(function(H){H.textContent.length===1&&H.remove()}),a.querySelectorAll('[data-type="code-block-close-marker"]').forEach(function(H){H.textContent.length===1&&H.remove()});var I=(0,o.a1)(i,"data-type","heading-marker");if(I&&I.textContent.indexOf("#")===-1){Se(e);return}}if((t.data===" "||t.inputType==="deleteContentBackward")&&((0,o.a1)(i,"data-type","padding")||(0,o.a1)(i,"data-type","li-marker")||(0,o.a1)(i,"data-type","task-marker")||(0,o.a1)(i,"data-type","blockquote-marker"))){Se(e);return}}if(a&&a.textContent.trimRight()==="$$"){Se(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,o.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(H){H.removeAttribute("style")}),a.querySelectorAll("font").forEach(function(H){H.outerHTML=H.innerHTML});var O=a.textContent,q=a.isEqualNode(e.sv.element);if(q)O=a.textContent;else{a.previousElementSibling&&(O=a.previousElementSibling.textContent+O,a.previousElementSibling.remove()),a.previousElementSibling&&O.indexOf(`---
|
|
59
59
|
`)===0&&(O=a.previousElementSibling.textContent+O,a.previousElementSibling.remove());var B="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(H,G){H&&!a.isEqualNode(H.parentElement)&&(B+=H.parentElement.textContent+`
|
|
60
60
|
`,H.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(H,G){H&&!a.isEqualNode(H.parentElement)&&(B+=H.parentElement.textContent+`
|
|
61
|
-
`,H.parentElement.remove())}),O=B+O}O=tn(O,e),q?a.innerHTML=O:a.outerHTML=O,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(H){e.sv.element.insertAdjacentElement("beforeend",H.parentElement)}),
|
|
62
|
-
`;if(G){if(((i=G.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return G.previousElementSibling.remove(),Ee(e),t.preventDefault(),!0;se+=Jn(G)}return u.insertNode(document.createTextNode(se)),u.collapse(!1),H&&H.textContent.trim()!==""&&!W?ie(e):Ee(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(G&&((a=G.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,k.im)(G,e.sv.element,u).start===1&&G.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(G,0),u.extractContents(),G.textContent.trim()!==""?ie(e):Ee(e),t.preventDefault(),!0;if(H&&(0,k.im)(H,e.sv.element,u).start===0&&H.previousElementSibling){u.extractContents();var ae=H.previousElementSibling.lastElementChild;return ae.getAttribute("data-type")==="newline"&&(ae.remove(),ae=H.previousElementSibling.lastElementChild),ae.getAttribute("data-type")!=="newline"&&(ae.insertAdjacentHTML("afterend",H.innerHTML),H.remove()),H.textContent.trim()!==""&&!(!((o=H.previousElementSibling)===null||o===void 0)&&o.querySelector('[data-type="code-block-open-marker"]'))?ie(e):(ae.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ae.lastChild),u.collapse(!1)),Ee(e)),t.preventDefault(),!0}}return!1},X=Y(538),de=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},De=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),de(e),(0,X.Z)(e.options.preview.theme.current,e.options.preview.theme.path),typeof e.options.height=="number"?e.element.style.height=e.options.height+"px":e.element.style.height=e.options.height,typeof e.options.minHeight=="number"&&(e.element.style.minHeight=e.options.minHeight+"px"),typeof e.options.width=="number"?e.element.style.width=e.options.width+"px":e.element.style.width=e.options.width,e.element.appendChild(e.toolbar.element);var t=document.createElement("div");if(t.className="vditor-content",e.options.outline.position==="left"&&t.appendChild(e.outline.element),t.appendChild(e.wysiwyg.element.parentElement),t.appendChild(e.sv.element),t.appendChild(e.ir.element.parentElement),t.appendChild(e.preview.element),e.toolbar.elements.devtools&&t.appendChild(e.devtools.element),e.options.outline.position==="right"&&(e.outline.element.classList.add("vditor-outline--right"),t.appendChild(e.outline.element)),e.upload&&t.appendChild(e.upload.element),e.options.resize.enable&&t.appendChild(e.resize.element),t.appendChild(e.hint.element),t.appendChild(e.tip.element),e.element.appendChild(t),t.addEventListener("click",function(){b(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Ze(e,e.options.mode,jn(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)}},Ne=function(e){var t=window.innerWidth<=E.g.MOBILE_WIDTH?10:35;if(e.wysiwyg.element.parentElement.style.display!=="none"){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px ".concat(Math.max(t,n),"px")}if(e.ir.element.parentElement.style.display!=="none"){var n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px ".concat(Math.max(t,n),"px")}e.preview.element.style.display!=="block"?e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0))+"px":e.toolbar.element.style.paddingLeft=5+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0)+"px"},mt=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")}},Zt;function Jt(){window.removeEventListener("resize",Zt)}var jn=function(e){mt(e),Jt(),window.addEventListener("resize",Zt=function(){Ne(e),mt(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||""},rt=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e[e.currentMode].element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=(0,k.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,s.a1)(n,"data-type","heading"):(0,C.W)(n);r&&p(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,s.a1)(n,"data-type","blockquote"):(0,s.lG)(n,"BLOCKQUOTE");i&&p(e.toolbar.elements,["quote"]);var a=(0,s.a1)(n,"data-type","strong");a&&p(e.toolbar.elements,["bold"]);var o=(0,s.a1)(n,"data-type","em");o&&p(e.toolbar.elements,["italic"]);var u=(0,s.a1)(n,"data-type","s");u&&p(e.toolbar.elements,["strike"]);var h=(0,s.a1)(n,"data-type","a");h&&p(e.toolbar.elements,["link"]);var d=(0,s.lG)(n,"LI");d?(d.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):d.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):d.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):f(e.toolbar.elements,["outdent","indent"]);var S=(0,s.a1)(n,"data-type","code-block");S&&(f(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&&(f(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&&f(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},ce=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=x(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)},Bn=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(E.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},Un=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"))},Xt=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},Yt=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},Vn=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},Wn=function(e){var t=Yt(e.startContainer),n=Xt(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==E.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==E.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},Tt=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,k.Hc)(t),!0}else if(!n.getAttribute("data-block"))return n.tagName==="P"?n.remove():(n.tagName==="DIV"?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,k.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},gt=function(e,t){var n=(0,k.zh)(e),r=(0,s.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>"),r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")?r.innerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"):r.outerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"),(0,k.ib)(e.wysiwyg.element,n),je(e))},_t=function(e){var t=getSelection().getRangeAt(0),n=(0,s.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>"),(0,k.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},it=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,k.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&ye(t)},Fn=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,k.zh)(e),r=n.startContainer;if(!on(t,e,r)||(sn(n,e,t),Sn(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(dn(t,e,a,n)||fn(n,e,a,t)||yn(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"&&(bn(e,t,o.firstElementChild,n)||lt(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&Qe(e,t,n,o.firstElementChild,o)))return!0}if(wn(e,n,t,a))return!0;var h=(0,s.E2)(r,"BLOCKQUOTE");if(h&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(h):n.setStartAfter(h),(0,k.Hc)(n);var d=document.createElement("p");return d.setAttribute("data-block","0"),d.innerHTML=`
|
|
63
|
-
`,n.insertNode(d),n.collapse(!0),(0,k.Hc)(n),ce(e),
|
|
64
|
-
`,T.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",T),n.setStart(T,0),(0,k.Hc)(n),ce(e),
|
|
61
|
+
`,H.parentElement.remove())}),O=B+O}O=tn(O,e),q?a.innerHTML=O:a.outerHTML=O,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(H){e.sv.element.insertAdjacentElement("beforeend",H.parentElement)}),ye(e.sv.element,function(H){e.sv.element.insertAdjacentElement("beforeend",H)}),(0,k.ib)(e.sv.element,r),be(e),Se(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},Le=function(e,t){var n,r,i,a,s;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,k.zh)(e),h=u.startContainer;u.startContainer.nodeType!==3&&u.startContainer.tagName==="DIV"&&(h=u.startContainer.childNodes[u.startOffset-1]);var d=(0,o.a1)(h,"data-type","text"),S=(0,o.a1)(h,"data-type","blockquote-marker");if(!S&&u.startOffset===0&&d&&d.previousElementSibling&&d.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(S=d.previousElementSibling),S&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&S.nextElementSibling.textContent.trim()===""&&(0,k.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(),Se(e),t.preventDefault(),!0;var T=(0,o.a1)(h,"data-type","li-marker"),R=(0,o.a1)(h,"data-type","task-marker"),I=T;if(I||R&&R.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(I=R),!I&&u.startOffset===0&&d&&d.previousElementSibling&&(d.previousElementSibling.getAttribute("data-type")==="li-marker"||d.previousElementSibling.getAttribute("data-type")==="task-marker")&&(I=d.previousElementSibling),I){var O=(0,k.im)(I,e.sv.element,u).start,q=I.getAttribute("data-type")==="task-marker",B=I;if(q&&(B=I.previousElementSibling.previousElementSibling.previousElementSibling),O===I.textContent.length){if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&I.nextElementSibling.textContent.trim()==="")return((r=B.previousElementSibling)===null||r===void 0?void 0:r.getAttribute("data-type"))==="padding"?(B.previousElementSibling.remove(),ie(e)):(q&&(B.remove(),I.previousElementSibling.previousElementSibling.remove(),I.previousElementSibling.remove()),I.nextElementSibling.remove(),I.remove(),Se(e)),t.preventDefault(),!0;if(t.key==="Tab")return t.shiftKey?B.previousElementSibling.getAttribute("data-type")==="padding"&&B.previousElementSibling.remove():B.insertAdjacentHTML("beforebegin",'<span data-type="padding">'.concat(B.textContent.replace(/\S/g," "),"</span>")),/^\d/.test(B.textContent)&&(B.textContent=B.textContent.replace(/^\d{1,}/,"1"),u.selectNodeContents(I.firstChild),u.collapse(!1)),ie(e),t.preventDefault(),!0}}if(Wt(e,u,t))return!0;var H=(0,o.a1)(h,"data-block","0"),G=(0,C.S)(h,"SPAN");if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&H){var W=!1,J=H.textContent.match(/^\n+/);(0,k.im)(H,e.sv.element).start<=(J?J[0].length:0)&&(W=!0);var se=`
|
|
62
|
+
`;if(G){if(((i=G.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return G.previousElementSibling.remove(),Se(e),t.preventDefault(),!0;se+=Jn(G)}return u.insertNode(document.createTextNode(se)),u.collapse(!1),H&&H.textContent.trim()!==""&&!W?ie(e):Se(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(G&&((a=G.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,k.im)(G,e.sv.element,u).start===1&&G.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(G,0),u.extractContents(),G.textContent.trim()!==""?ie(e):Se(e),t.preventDefault(),!0;if(H&&(0,k.im)(H,e.sv.element,u).start===0&&H.previousElementSibling){u.extractContents();var ae=H.previousElementSibling.lastElementChild;return ae.getAttribute("data-type")==="newline"&&(ae.remove(),ae=H.previousElementSibling.lastElementChild),ae.getAttribute("data-type")!=="newline"&&(ae.insertAdjacentHTML("afterend",H.innerHTML),H.remove()),H.textContent.trim()!==""&&!(!((s=H.previousElementSibling)===null||s===void 0)&&s.querySelector('[data-type="code-block-open-marker"]'))?ie(e):(ae.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ae.lastChild),u.collapse(!1)),Se(e)),t.preventDefault(),!0}}return!1},X=Y(538),pe=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},De=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),pe(e),(0,X.Z)(e.options.preview.theme.current,e.options.preview.theme.path),typeof e.options.height=="number"?e.element.style.height=e.options.height+"px":e.element.style.height=e.options.height,typeof e.options.minHeight=="number"&&(e.element.style.minHeight=e.options.minHeight+"px"),typeof e.options.width=="number"?e.element.style.width=e.options.width+"px":e.element.style.width=e.options.width,e.element.appendChild(e.toolbar.element);var t=document.createElement("div");if(t.className="vditor-content",e.options.outline.position==="left"&&t.appendChild(e.outline.element),t.appendChild(e.wysiwyg.element.parentElement),t.appendChild(e.sv.element),t.appendChild(e.ir.element.parentElement),t.appendChild(e.preview.element),e.toolbar.elements.devtools&&t.appendChild(e.devtools.element),e.options.outline.position==="right"&&(e.outline.element.classList.add("vditor-outline--right"),t.appendChild(e.outline.element)),e.upload&&t.appendChild(e.upload.element),e.options.resize.enable&&t.appendChild(e.resize.element),t.appendChild(e.hint.element),t.appendChild(e.tip.element),e.element.appendChild(t),t.addEventListener("click",function(){b(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Ze(e,e.options.mode,jn(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)}},Ne=function(e){var t=window.innerWidth<=E.g.MOBILE_WIDTH?10:35;if(e.wysiwyg.element.parentElement.style.display!=="none"){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px ".concat(Math.max(t,n),"px")}if(e.ir.element.parentElement.style.display!=="none"){var n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px ".concat(Math.max(t,n),"px")}e.preview.element.style.display!=="block"?e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0))+"px":e.toolbar.element.style.paddingLeft=5+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0)+"px"},mt=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")}},Zt;function Jt(){window.removeEventListener("resize",Zt)}var jn=function(e){mt(e),Jt(),window.addEventListener("resize",Zt=function(){Ne(e),mt(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||""},rt=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e[e.currentMode].element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=(0,k.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,o.a1)(n,"data-type","heading"):(0,C.W)(n);r&&p(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,o.a1)(n,"data-type","blockquote"):(0,o.lG)(n,"BLOCKQUOTE");i&&p(e.toolbar.elements,["quote"]);var a=(0,o.a1)(n,"data-type","strong");a&&p(e.toolbar.elements,["bold"]);var s=(0,o.a1)(n,"data-type","em");s&&p(e.toolbar.elements,["italic"]);var u=(0,o.a1)(n,"data-type","s");u&&p(e.toolbar.elements,["strike"]);var h=(0,o.a1)(n,"data-type","a");h&&p(e.toolbar.elements,["link"]);var d=(0,o.lG)(n,"LI");d?(d.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):d.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):d.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):f(e.toolbar.elements,["outdent","indent"]);var S=(0,o.a1)(n,"data-type","code-block");S&&(f(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,o.a1)(n,"data-type","code");T&&(f(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,o.a1)(n,"data-type","table");R&&f(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},ce=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=x(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)},Bn=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(E.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},Un=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"))},Xt=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},Yt=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},Vn=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},Wn=function(e){var t=Yt(e.startContainer),n=Xt(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",s="";return(r.substr(0,i)!==""&&r.substr(0,i)!==E.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==E.g.ZWSP||n)&&(s="".concat(r.substr(i)).concat(n)),{afterHTML:s,beforeHTML:a}},Tt=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,k.Hc)(t),!0}else if(!n.getAttribute("data-block"))return n.tagName==="P"?n.remove():(n.tagName==="DIV"?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,k.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},gt=function(e,t){var n=(0,k.zh)(e),r=(0,o.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>"),r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")?r.innerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"):r.outerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"),(0,k.ib)(e.wysiwyg.element,n),je(e))},_t=function(e){var t=getSelection().getRangeAt(0),n=(0,o.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>"),(0,k.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},it=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,k.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&be(t)},Fn=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,k.zh)(e),r=n.startContainer;if(!on(t,e,r)||(sn(n,e,t),Sn(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,o.F9)(r),a=(0,o.lG)(r,"P");if(dn(t,e,a,n)||fn(n,e,a,t)||yn(e,t,n))return!0;var s=(0,o.fb)(r,"vditor-wysiwyg__block");if(s){if(t.key==="Escape"&&s.children.length===2)return e.wysiwyg.popover.style.display="none",s.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,l.yl)(t)&&!t.shiftKey&&t.altKey&&t.key==="Enter"&&s.getAttribute("data-type")==="code-block"){var u=e.wysiwyg.popover.querySelector(".vditor-input");return u.focus(),u.select(),t.preventDefault(),!0}if(s.getAttribute("data-block")==="0"&&(bn(e,t,s.firstElementChild,n)||lt(e,t,n,s.firstElementChild,s)||s.getAttribute("data-type")!=="yaml-front-matter"&&Qe(e,t,n,s.firstElementChild,s)))return!0}if(wn(e,n,t,a))return!0;var h=(0,o.E2)(r,"BLOCKQUOTE");if(h&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(h):n.setStartAfter(h),(0,k.Hc)(n);var d=document.createElement("p");return d.setAttribute("data-block","0"),d.innerHTML=`
|
|
63
|
+
`,n.insertNode(d),n.collapse(!0),(0,k.Hc)(n),ce(e),be(e),t.preventDefault(),!0}var S=(0,C.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,k.Hc)(n),ce(e),be(e),t.preventDefault(),!0}if(N("⌘=",t)){var R=parseInt(S.tagName.substr(1),10)-1;return R>0&&(gt(e,"h".concat(R)),ce(e)),t.preventDefault(),!0}if(N("⌘-",t)){var R=parseInt(S.tagName.substr(1),10)+1;return R<7&&(gt(e,"h".concat(R)),ce(e)),t.preventDefault(),!0}t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&S.textContent.length===1&&_t(e)}if(vn(e,n,t))return!0;if(t.altKey&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.shiftKey){var I=(0,o.lG)(r,"A"),O=(0,o.a1)(r,"data-type","link-ref"),q=(0,o.a1)(r,"data-type","footnotes-ref");if(I||O||q||S&&S.tagName.length===2){var B=e.wysiwyg.popover.querySelector("input");B.focus(),B.select()}}if(_e(e,t))return!0;if(N("⇧⌘U",t)){var H=e.wysiwyg.popover.querySelector('[data-type="up"]');if(H)return H.click(),t.preventDefault(),!0}if(N("⇧⌘D",t)){var H=e.wysiwyg.popover.querySelector('[data-type="down"]');if(H)return H.click(),t.preventDefault(),!0}if(Wt(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
65
|
`+E.g.ZWSP)):n.insertNode(document.createTextNode(`
|
|
66
|
-
`)),n.collapse(!1),(0,k.Hc)(n),ce(e),
|
|
67
|
-
`&&r.textContent.charAt(W-1)!==E.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,W-1)+E.g.ZWSP,n.setStart(r,W),n.collapse(!0),ce(e),t.preventDefault(),!0;r.textContent===E.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&Un(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(E.g.ZWSP)>-1&&r.previousSibling&&r.previousSibling.nodeType!==3&&r.previousSibling.tagName==="CODE"&&(t.key==="Backspace"||t.key==="ArrowLeft"))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(Cn(t,i,n))return t.preventDefault(),!0;if(ln(n,t.key),t.key==="ArrowDown"){var J=r.nextSibling;J&&J.nodeType!==3&&J.getAttribute("data-type")==="math-inline"&&n.setStartAfter(J)}return i&&ht(i,e,t,n)?(t.preventDefault(),!0):!1},Te=function(e,t){if(N("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ge=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e.wysiwyg.element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;t.startContainer.nodeType===3?n=t.startContainer.parentElement:n=n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,s.a1)(n,"data-type","footnotes-block");if(r){e.wysiwyg.popover.innerHTML="",Ie(r,e),Re(e,r);return}var i=(0,s.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):f(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(F){F.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(F){if(u.includes(F))return o=[F],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(F){F.getAttribute("data-cmtids").indexOf(o[0])>-1&&F.classList.add("vditor-comment--focus")})}var h=(0,s.lG)(n,"A");h&&p(e.toolbar.elements,["link"]);var d=(0,s.lG)(n,"TABLE"),S=(0,C.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(f(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"])):(f(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?(f(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):d&&f(e.toolbar.elements,["table"]);var T=(0,s.fb)(n,"vditor-toc");if(T){e.wysiwyg.popover.innerHTML="",Ie(T,e),Re(e,T);return}var R=(0,C.S)(n,"BLOCKQUOTE");if(R&&(e.wysiwyg.popover.innerHTML="",Je(t,R,e),Xe(t,R,e),Ie(R,e),Re(e,R)),i&&(e.wysiwyg.popover.innerHTML="",Je(t,i,e),Xe(t,i,e),Ie(i,e),Re(e,i)),d){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var I=function(){var F=d.rows.length,te=d.rows[0].cells.length,Ke=parseInt(be.value,10)||F,ze=parseInt(He.value,10)||te;if(!(Ke===F&&te===ze)){if(te!==ze)for(var ft=ze-te,Ue=0;Ue<d.rows.length;Ue++)if(ft>0)for(var On=0;On<ft;On++)Ue===0?d.rows[Ue].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):d.rows[Ue].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Kt=te-1;Kt>=ze;Kt--)d.rows[Ue].cells[Kt].remove();if(F!==Ke){var Nn=Ke-F;if(Nn>0){for(var zt="<tr>",tt=0;tt<ze;tt++)zt+="<td> </td>";for(var Rn=0;Rn<Nn;Rn++)d.querySelector("tbody")?d.querySelector("tbody").insertAdjacentHTML("beforeend",zt):d.querySelector("thead").insertAdjacentHTML("afterend",zt+"</tr>")}else for(var tt=F-1;tt>=Ke;tt--)d.rows[tt].remove(),d.rows.length===1&&d.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(x(e))}},O=function(F){vt(d,F),F==="right"?(G.classList.remove("vditor-icon--current"),W.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")):F==="center"?(G.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),W.classList.add("vditor-icon--current")):(W.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),G.classList.add("vditor-icon--current")),(0,k.Hc)(t),ce(e)},q=(0,s.lG)(n,"TD"),B=(0,s.lG)(n,"TH"),H="left";q?H=q.getAttribute("align")||"left":B&&(H=B.getAttribute("align")||"center");var G=document.createElement("button");G.setAttribute("type","button"),G.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),G.setAttribute("data-type","left"),G.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',G.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(H==="left"?" vditor-icon--current":""),G.onclick=function(){O("left")};var W=document.createElement("button");W.setAttribute("type","button"),W.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),W.setAttribute("data-type","center"),W.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',W.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(H==="center"?" vditor-icon--current":""),W.onclick=function(){O("center")};var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),J.setAttribute("data-type","right"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(H==="right"?" vditor-icon--current":""),J.onclick=function(){O("right")};var se=document.createElement("button");se.setAttribute("type","button"),se.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),se.setAttribute("data-type","insertRow"),se.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',se.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",se.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(F,"TD")||(0,s.lG)(F,"TH");te&&pn(e,t,te)};var ae=document.createElement("button");ae.setAttribute("type","button"),ae.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ae.setAttribute("data-type","insertRow"),ae.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ae.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(F,"TD")||(0,s.lG)(F,"TH");te&&hn(e,t,te)};var ue=document.createElement("button");ue.setAttribute("type","button"),ue.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),ue.setAttribute("data-type","insertColumn"),ue.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',ue.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ue.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(F,"TD")||(0,s.lG)(F,"TH");te&&Et(e,d,te)};var _e=document.createElement("button");_e.setAttribute("type","button"),_e.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),_e.setAttribute("data-type","insertColumn"),_e.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',_e.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",_e.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(F,"TD")||(0,s.lG)(F,"TH");te&&Et(e,d,te,"beforebegin")};var Le=document.createElement("button");Le.setAttribute("type","button"),Le.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),Le.setAttribute("data-type","deleteRow"),Le.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',Le.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Le.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(F,"TD")||(0,s.lG)(F,"TH");te&&mn(e,t,te)};var Ae=document.createElement("button");Ae.setAttribute("type","button"),Ae.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),Ae.setAttribute("data-type","deleteColumn"),Ae.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',Ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Ae.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,s.lG)(F,"TD")||(0,s.lG)(F,"TH");te&&gn(e,t,d,te)};var Q=document.createElement("span");Q.setAttribute("aria-label",window.VditorI18n.row),Q.className="vditor-tooltipped vditor-tooltipped__n";var be=document.createElement("input");Q.appendChild(be),be.type="number",be.min="1",be.className="vditor-input",be.style.width="42px",be.style.textAlign="center",be.setAttribute("placeholder",window.VditorI18n.row),be.value=d.rows.length.toString(),be.oninput=function(){I()},be.onkeydown=function(F){if(!F.isComposing){if(F.key==="Tab"){He.focus(),He.select(),F.preventDefault();return}Te(e,F)||Be(F,t)}};var Lt=document.createElement("span");Lt.setAttribute("aria-label",window.VditorI18n.column),Lt.className="vditor-tooltipped vditor-tooltipped__n";var He=document.createElement("input");Lt.appendChild(He),He.type="number",He.min="1",He.className="vditor-input",He.style.width="42px",He.style.textAlign="center",He.setAttribute("placeholder",window.VditorI18n.column),He.value=d.rows[0].cells.length.toString(),He.oninput=function(){I()},He.onkeydown=function(F){if(!F.isComposing){if(F.key==="Tab"){be.focus(),be.select(),F.preventDefault();return}Te(e,F)||Be(F,t)}},Je(t,d,e),Xe(t,d,e),Ie(d,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",G),e.wysiwyg.popover.insertAdjacentElement("beforeend",W),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",se),e.wysiwyg.popover.insertAdjacentElement("beforeend",_e),e.wysiwyg.popover.insertAdjacentElement("beforeend",ue),e.wysiwyg.popover.insertAdjacentElement("beforeend",Le),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",Lt),Re(e,d)}var qt=(0,s.a1)(n,"data-type","link-ref");qt&&Qt(e,qt,t);var $e=(0,s.a1)(n,"data-type","footnotes-ref");if($e){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var Q=document.createElement("span");Q.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Q.className="vditor-tooltipped vditor-tooltipped__n";var We=document.createElement("input");Q.appendChild(We),We.className="vditor-input",We.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),We.style.width="120px",We.value=$e.getAttribute("data-footnotes-label"),We.oninput=function(){We.value.trim()!==""&&$e.setAttribute("data-footnotes-label",We.value),typeof e.options.input=="function"&&e.options.input(x(e))},We.onkeydown=function(te){te.isComposing||Te(e,te)||Be(te,t)},Ie($e,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),Re(e,$e)}var Se=(0,s.fb)(n,"vditor-wysiwyg__block"),Dn=Se?Se.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(F){if(!Se||Se&&Dn&&!Se.contains(F)){var te=F.previousElementSibling;te.style.display="none"}}),Se&&Dn){if(e.wysiwyg.popover.innerHTML="",Je(t,Se,e),Xe(t,Se,e),Ie(Se,e),Se.getAttribute("data-type")==="code-block"){var Mt=document.createElement("span");Mt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Mt.className="vditor-tooltipped vditor-tooltipped__n";var Pe=document.createElement("input");Mt.appendChild(Pe);var ut=Se.firstElementChild.firstElementChild;Pe.className="vditor-input",Pe.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Pe.value=ut.className.indexOf("language-")>-1?ut.className.split("-")[1].split(" ")[0]:"",Pe.oninput=function(F){Pe.value.trim()!==""?ut.className="language-".concat(Pe.value):(ut.className="",e.hint.recentLanguage=""),Se.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Se.lastElementChild.innerHTML=Se.firstElementChild.innerHTML,ve(Se.lastElementChild,e)),ce(e),F.detail===1&&(t.setStart(ut.firstChild,0),t.collapse(!0),(0,k.Hc)(t))},Pe.onkeydown=function(F){if(!F.isComposing&&!Te(e,F)){if(F.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",F.preventDefault();return}e.hint.select(F,e),Be(F,t)}},Pe.onkeyup=function(F){var te,Ke;if(!(F.isComposing||F.key==="Enter"||F.key==="ArrowUp"||F.key==="Escape"||F.key==="ArrowDown")){var ze=[],ft=Pe.value.substring(0,Pe.selectionStart);(e.options.preview.hljs.langs||E.g.ALIAS_CODE_LANGUAGES.concat(((Ke=(te=window.hljs)===null||te===void 0?void 0:te.listLanguages())!==null&&Ke!==void 0?Ke:[]).sort())).forEach(function(Ue){Ue.indexOf(ft.toLowerCase())>-1&&ze.push({html:Ue,value:Ue})}),e.hint.genHTML(ze,ft,e),F.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",Mt)}Re(e,Se)}else Se=void 0;if(S){e.wysiwyg.popover.innerHTML="";var Q=document.createElement("span");Q.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),Q.className="vditor-tooltipped vditor-tooltipped__n";var qe=document.createElement("input");Q.appendChild(qe),qe.className="vditor-input",qe.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),qe.style.width="120px",qe.value=S.getAttribute("data-id")||"",qe.oninput=function(){S.setAttribute("data-id",qe.value),typeof e.options.input=="function"&&e.options.input(x(e))},qe.onkeydown=function(te){te.isComposing||Te(e,te)||Be(te,t)},Je(t,S,e),Xe(t,S,e),Ie(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),Re(e,S)}if(h&&At(e,h,t),!R&&!i&&!d&&!Se&&!h&&!qt&&!$e&&!S&&!T){var et=(0,s.a1)(n,"data-block","0");et&&et.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Je(t,et,e),Xe(t,et,e),Ie(et,e),Re(e,et)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(F){F.style.display="none"});var Hn=(0,s.a1)(t.startContainer,"data-type","backslash");Hn&&(Hn.querySelector("span").style.display="inline")}},200)},Re=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())},Qt=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(x(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(h){Te(e,h)||Be(h,n)||at(e,t,h,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.linkRef),u.value=t.getAttribute("data-link-label"),u.oninput=function(){r()},u.onkeydown=function(h){Te(e,h)||Be(h,n)||at(e,t,h,a)},Ie(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),Re(e,t)},Je=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ge(n),ye(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Xe=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ge(n),ye(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ie=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",window.VditorI18n.remove+"<"+(0,l.ns)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,k.zh)(t);r.setStartAfter(e),(0,k.Hc)(r),e.remove(),ce(t),Ge(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&je(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},at=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,k.zh)(e);t.insertAdjacentHTML("afterend",E.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,k.Hc)(i),n.preventDefault()}}},At=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",d.value),ce(e)};t.querySelectorAll("[data-marker]").forEach(function(S){S.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(S){Te(e,S)||Be(S,n)||at(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){Te(e,S)||Be(S,n)||at(e,t,S,d)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.tooltipText),h.className="vditor-tooltipped vditor-tooltipped__n";var d=document.createElement("input");h.appendChild(d),d.className="vditor-input",d.setAttribute("placeholder",window.VditorI18n.tooltipText),d.style.width="60px",d.value=t.getAttribute("title")||"",d.oninput=function(){r()},d.onkeydown=function(S){Te(e,S)||Be(S,n)||at(e,t,S,a)},Ie(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",h),Re(e,t)},qn=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",d.value),typeof t.options.input=="function"&&t.options.input(x(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){Te(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){Te(t,S)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.title),h.className="vditor-tooltipped vditor-tooltipped__n";var d=document.createElement("input");h.appendChild(d),d.className="vditor-input",d.setAttribute("placeholder",window.VditorI18n.title),d.value=n.getAttribute("title")||"",d.oninput=function(){r()},d.onkeydown=function(S){Te(t,S)},Ie(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",h),Re(t,n)},Be=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,k.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Ye=function(e){e.currentMode==="wysiwyg"?Ge(e):e.currentMode==="ir"&&rt(e)},$t=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){ve(i,e),i.previousElementSibling.setAttribute("style","display:none")}),ce(e,n)},Kn=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",u=Wn(e),h=u.beforeHTML,d=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="",I="";r.parentElement.getAttribute("data-block")!=="0"&&(R=Yt(r),I=Xt(r)),(h||R)&&(T="".concat(R,"<").concat(S,">").concat(h,"</").concat(S,">"),h=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(E.g.ZWSP,"<wbr>").concat(o),i=!0),(d||I)&&(d="<".concat(S,">").concat(d,"</").concat(S,">").concat(I),T+=d),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=T):(r.outerHTML=T,r=r.parentElement),a="<".concat(S,">")+a,o="</".concat(S,">")+o}else i=!0}(0,k.ib)(t.wysiwyg.element,e)},zn=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,k.zh)(e),o=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(o==="strike"&&(o="strikeThrough"),o==="quote"){var u=(0,s.lG)(a.startContainer,"BLOCKQUOTE");u||(u=a.startContainer.childNodes[a.startOffset]),u&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),u.outerHTML=u.innerHTML.trim()===""?'<p data-block="0">'.concat(u.innerHTML,"</p>"):u.innerHTML,(0,k.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var h=(0,s.lG)(a.startContainer,"CODE");h||(h=a.startContainer.childNodes[a.startOffset]),h&&(h.outerHTML=h.innerHTML.replace(E.g.ZWSP,"")+"<wbr>",(0,k.ib)(e.wysiwyg.element,a))}else o==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):o==="check"||o==="list"||o==="ordered-list"?(wt(e,a,o),(0,k.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?Kn(a,e,o):document.execCommand(o,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,k.ib)(e.wysiwyg.element,a));var d=(0,s.F9)(a.startContainer);if(o==="quote"){if(d||(d=a.startContainer.childNodes[a.startOffset]),d){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var S=(0,s.lG)(a.startContainer,"LI");S&&d.contains(S)?S.innerHTML='<blockquote data-block="0">'.concat(S.innerHTML,"</blockquote>"):d.outerHTML='<blockquote data-block="0">'.concat(d.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")wt(e,a,o,!1),(0,k.ib)(e.wysiwyg.element,a),r=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(o==="inline-code"){if(a.toString()===""){var T=document.createElement("code");T.textContent=E.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a)}t.classList.add("vditor-menu--current")}else if(o==="code"){var T=document.createElement("div");T.className="vditor-wysiwyg__block",T.setAttribute("data-type","code-block"),T.setAttribute("data-block","0"),T.setAttribute("data-marker","```"),a.toString()===""?T.innerHTML=`<pre><code><wbr>
|
|
68
|
-
</code></pre>`:(T.innerHTML="<pre><code>".concat(a.toString(),"<wbr></code></pre>"),a.deleteContents()),a.insertNode(T),d&&(d.outerHTML=e.lute.SpinVditorDOM(d.outerHTML)),(0,k.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(se){
|
|
69
|
-
`),H=B[0].split(",").length>B[0].split(" ").length?",":" ";B.forEach(function(J,se){se===0?(J.split(H).forEach(function(ae,ue){ue===0?q+="<th>".concat(ae,"<wbr></th>"):q+="<th>".concat(ae,"</th>")}),q+="</tr></thead>"):(se===1?q+="<tbody><tr>":q+="<tr>",J.split(H).forEach(function(ae){q+="<td>".concat(ae,"</td>")}),q+="</tr>")}),q+="</tbody></table>",document.execCommand("insertHTML",!1,q),(0,k.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if(
|
|
70
|
-
</p>`;d.innerHTML.trim()===""?d.outerHTML=G:d.insertAdjacentHTML("afterend",G),(0,k.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),
|
|
66
|
+
`)),n.collapse(!1),(0,k.Hc)(n),ce(e),be(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(En(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 G=(0,k.im)(i,e.wysiwyg.element,n).start;if(G===0&&n.startOffset===0||G===1&&i.innerText.startsWith(E.g.ZWSP))return it(i.previousElementSibling.lastElementChild,e,!1),i.innerHTML.trim().replace(E.g.ZWSP,"")===""&&(i.remove(),ce(e)),t.preventDefault(),!0}var W=n.startOffset;if(n.toString()===""&&r.nodeType===3&&r.textContent.charAt(W-2)===`
|
|
67
|
+
`&&r.textContent.charAt(W-1)!==E.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,W-1)+E.g.ZWSP,n.setStart(r,W),n.collapse(!0),ce(e),t.preventDefault(),!0;r.textContent===E.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&Un(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(se){se.firstElementChild.style.display="inline",se.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(E.g.ZWSP)>-1&&r.previousSibling&&r.previousSibling.nodeType!==3&&r.previousSibling.tagName==="CODE"&&(t.key==="Backspace"||t.key==="ArrowLeft"))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(Cn(t,i,n))return t.preventDefault(),!0;if(ln(n,t.key),t.key==="ArrowDown"){var J=r.nextSibling;J&&J.nodeType!==3&&J.getAttribute("data-type")==="math-inline"&&n.setStartAfter(J)}return i&&ht(i,e,t,n)?(t.preventDefault(),!0):!1},_e=function(e,t){if(N("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ge=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,k.Gb)(e.wysiwyg.element)){y(e.toolbar.elements,E.g.EDIT_TOOLBARS),m(e.toolbar.elements,E.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;t.startContainer.nodeType===3?n=t.startContainer.parentElement:n=n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,o.a1)(n,"data-type","footnotes-block");if(r){e.wysiwyg.popover.innerHTML="",Ie(r,e),Re(e,r);return}var i=(0,o.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),m(e.toolbar.elements,["outdent","indent"])):f(e.toolbar.elements,["outdent","indent"]),(0,o.lG)(n,"BLOCKQUOTE")&&p(e.toolbar.elements,["quote"]),((0,o.lG)(n,"B")||(0,o.lG)(n,"STRONG"))&&p(e.toolbar.elements,["bold"]),((0,o.lG)(n,"I")||(0,o.lG)(n,"EM"))&&p(e.toolbar.elements,["italic"]),((0,o.lG)(n,"STRIKE")||(0,o.lG)(n,"S"))&&p(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(F){F.classList.remove("vditor-comment--focus")});var a=(0,o.fb)(n,"vditor-comment");if(a){var s=a.getAttribute("data-cmtids").split(" ");if(s.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var u=a.nextElementSibling.getAttribute("data-cmtids").split(" ");s.find(function(F){if(u.includes(F))return s=[F],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(F){F.getAttribute("data-cmtids").indexOf(s[0])>-1&&F.classList.add("vditor-comment--focus")})}var h=(0,o.lG)(n,"A");h&&p(e.toolbar.elements,["link"]);var d=(0,o.lG)(n,"TABLE"),S=(0,C.W)(n);(0,o.lG)(n,"CODE")?(0,o.lG)(n,"PRE")?(f(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"])):(f(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?(f(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):d&&f(e.toolbar.elements,["table"]);var T=(0,o.fb)(n,"vditor-toc");if(T){e.wysiwyg.popover.innerHTML="",Ie(T,e),Re(e,T);return}var R=(0,C.S)(n,"BLOCKQUOTE");if(R&&(e.wysiwyg.popover.innerHTML="",Je(t,R,e),Xe(t,R,e),Ie(R,e),Re(e,R)),i&&(e.wysiwyg.popover.innerHTML="",Je(t,i,e),Xe(t,i,e),Ie(i,e),Re(e,i)),d){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var I=function(){var F=d.rows.length,te=d.rows[0].cells.length,Ke=parseInt(we.value,10)||F,ze=parseInt(He.value,10)||te;if(!(Ke===F&&te===ze)){if(te!==ze)for(var ft=ze-te,Ue=0;Ue<d.rows.length;Ue++)if(ft>0)for(var On=0;On<ft;On++)Ue===0?d.rows[Ue].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):d.rows[Ue].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Kt=te-1;Kt>=ze;Kt--)d.rows[Ue].cells[Kt].remove();if(F!==Ke){var Nn=Ke-F;if(Nn>0){for(var zt="<tr>",tt=0;tt<ze;tt++)zt+="<td> </td>";for(var Rn=0;Rn<Nn;Rn++)d.querySelector("tbody")?d.querySelector("tbody").insertAdjacentHTML("beforeend",zt):d.querySelector("thead").insertAdjacentHTML("afterend",zt+"</tr>")}else for(var tt=F-1;tt>=Ke;tt--)d.rows[tt].remove(),d.rows.length===1&&d.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(x(e))}},O=function(F){vt(d,F),F==="right"?(G.classList.remove("vditor-icon--current"),W.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")):F==="center"?(G.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),W.classList.add("vditor-icon--current")):(W.classList.remove("vditor-icon--current"),J.classList.remove("vditor-icon--current"),G.classList.add("vditor-icon--current")),(0,k.Hc)(t),ce(e)},q=(0,o.lG)(n,"TD"),B=(0,o.lG)(n,"TH"),H="left";q?H=q.getAttribute("align")||"left":B&&(H=B.getAttribute("align")||"center");var G=document.createElement("button");G.setAttribute("type","button"),G.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),G.setAttribute("data-type","left"),G.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',G.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(H==="left"?" vditor-icon--current":""),G.onclick=function(){O("left")};var W=document.createElement("button");W.setAttribute("type","button"),W.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),W.setAttribute("data-type","center"),W.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',W.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(H==="center"?" vditor-icon--current":""),W.onclick=function(){O("center")};var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),J.setAttribute("data-type","right"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(H==="right"?" vditor-icon--current":""),J.onclick=function(){O("right")};var se=document.createElement("button");se.setAttribute("type","button"),se.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),se.setAttribute("data-type","insertRow"),se.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',se.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",se.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,o.lG)(F,"TD")||(0,o.lG)(F,"TH");te&&pn(e,t,te)};var ae=document.createElement("button");ae.setAttribute("type","button"),ae.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ae.setAttribute("data-type","insertRow"),ae.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ae.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,o.lG)(F,"TD")||(0,o.lG)(F,"TH");te&&hn(e,t,te)};var ue=document.createElement("button");ue.setAttribute("type","button"),ue.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),ue.setAttribute("data-type","insertColumn"),ue.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',ue.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ue.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,o.lG)(F,"TD")||(0,o.lG)(F,"TH");te&&Et(e,d,te)};var Ae=document.createElement("button");Ae.setAttribute("type","button"),Ae.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),Ae.setAttribute("data-type","insertColumn"),Ae.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',Ae.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Ae.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,o.lG)(F,"TD")||(0,o.lG)(F,"TH");te&&Et(e,d,te,"beforebegin")};var Me=document.createElement("button");Me.setAttribute("type","button"),Me.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),Me.setAttribute("data-type","deleteRow"),Me.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',Me.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Me.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,o.lG)(F,"TD")||(0,o.lG)(F,"TH");te&&mn(e,t,te)};var xe=document.createElement("button");xe.setAttribute("type","button"),xe.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),xe.setAttribute("data-type","deleteColumn"),xe.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',xe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",xe.onclick=function(){var F=getSelection().getRangeAt(0).startContainer,te=(0,o.lG)(F,"TD")||(0,o.lG)(F,"TH");te&&gn(e,t,d,te)};var Q=document.createElement("span");Q.setAttribute("aria-label",window.VditorI18n.row),Q.className="vditor-tooltipped vditor-tooltipped__n";var we=document.createElement("input");Q.appendChild(we),we.type="number",we.min="1",we.className="vditor-input",we.style.width="42px",we.style.textAlign="center",we.setAttribute("placeholder",window.VditorI18n.row),we.value=d.rows.length.toString(),we.oninput=function(){I()},we.onkeydown=function(F){if(!F.isComposing){if(F.key==="Tab"){He.focus(),He.select(),F.preventDefault();return}_e(e,F)||Be(F,t)}};var Lt=document.createElement("span");Lt.setAttribute("aria-label",window.VditorI18n.column),Lt.className="vditor-tooltipped vditor-tooltipped__n";var He=document.createElement("input");Lt.appendChild(He),He.type="number",He.min="1",He.className="vditor-input",He.style.width="42px",He.style.textAlign="center",He.setAttribute("placeholder",window.VditorI18n.column),He.value=d.rows[0].cells.length.toString(),He.oninput=function(){I()},He.onkeydown=function(F){if(!F.isComposing){if(F.key==="Tab"){we.focus(),we.select(),F.preventDefault();return}_e(e,F)||Be(F,t)}},Je(t,d,e),Xe(t,d,e),Ie(d,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",G),e.wysiwyg.popover.insertAdjacentElement("beforeend",W),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",se),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ae),e.wysiwyg.popover.insertAdjacentElement("beforeend",ue),e.wysiwyg.popover.insertAdjacentElement("beforeend",Me),e.wysiwyg.popover.insertAdjacentElement("beforeend",xe),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",Lt),Re(e,d)}var qt=(0,o.a1)(n,"data-type","link-ref");qt&&Qt(e,qt,t);var $e=(0,o.a1)(n,"data-type","footnotes-ref");if($e){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var Q=document.createElement("span");Q.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Q.className="vditor-tooltipped vditor-tooltipped__n";var We=document.createElement("input");Q.appendChild(We),We.className="vditor-input",We.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),We.style.width="120px",We.value=$e.getAttribute("data-footnotes-label"),We.oninput=function(){We.value.trim()!==""&&$e.setAttribute("data-footnotes-label",We.value),typeof e.options.input=="function"&&e.options.input(x(e))},We.onkeydown=function(te){te.isComposing||_e(e,te)||Be(te,t)},Ie($e,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),Re(e,$e)}var Ce=(0,o.fb)(n,"vditor-wysiwyg__block"),Dn=Ce?Ce.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(F){if(!Ce||Ce&&Dn&&!Ce.contains(F)){var te=F.previousElementSibling;te.style.display="none"}}),Ce&&Dn){if(e.wysiwyg.popover.innerHTML="",Je(t,Ce,e),Xe(t,Ce,e),Ie(Ce,e),Ce.getAttribute("data-type")==="code-block"){var Mt=document.createElement("span");Mt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Mt.className="vditor-tooltipped vditor-tooltipped__n";var Pe=document.createElement("input");Mt.appendChild(Pe);var ut=Ce.firstElementChild.firstElementChild;Pe.className="vditor-input",Pe.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Pe.value=ut.className.indexOf("language-")>-1?ut.className.split("-")[1].split(" ")[0]:"",Pe.oninput=function(F){Pe.value.trim()!==""?ut.className="language-".concat(Pe.value):(ut.className="",e.hint.recentLanguage=""),Ce.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Ce.lastElementChild.innerHTML=Ce.firstElementChild.innerHTML,Ee(Ce.lastElementChild,e)),ce(e),F.detail===1&&(t.setStart(ut.firstChild,0),t.collapse(!0),(0,k.Hc)(t))},Pe.onkeydown=function(F){if(!F.isComposing&&!_e(e,F)){if(F.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",F.preventDefault();return}e.hint.select(F,e),Be(F,t)}},Pe.onkeyup=function(F){var te,Ke;if(!(F.isComposing||F.key==="Enter"||F.key==="ArrowUp"||F.key==="Escape"||F.key==="ArrowDown")){var ze=[],ft=Pe.value.substring(0,Pe.selectionStart);(e.options.preview.hljs.langs||E.g.ALIAS_CODE_LANGUAGES.concat(((Ke=(te=window.hljs)===null||te===void 0?void 0:te.listLanguages())!==null&&Ke!==void 0?Ke:[]).sort())).forEach(function(Ue){Ue.indexOf(ft.toLowerCase())>-1&&ze.push({html:Ue,value:Ue})}),e.hint.genHTML(ze,ft,e),F.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",Mt)}Re(e,Ce)}else Ce=void 0;if(S){e.wysiwyg.popover.innerHTML="";var Q=document.createElement("span");Q.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),Q.className="vditor-tooltipped vditor-tooltipped__n";var qe=document.createElement("input");Q.appendChild(qe),qe.className="vditor-input",qe.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),qe.style.width="120px",qe.value=S.getAttribute("data-id")||"",qe.oninput=function(){S.setAttribute("data-id",qe.value),typeof e.options.input=="function"&&e.options.input(x(e))},qe.onkeydown=function(te){te.isComposing||_e(e,te)||Be(te,t)},Je(t,S,e),Xe(t,S,e),Ie(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",Q),Re(e,S)}if(h&&At(e,h,t),!R&&!i&&!d&&!Ce&&!h&&!qt&&!$e&&!S&&!T){var et=(0,o.a1)(n,"data-block","0");et&&et.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",Je(t,et,e),Xe(t,et,e),Ie(et,e),Re(e,et)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(F){F.style.display="none"});var Hn=(0,o.a1)(t.startContainer,"data-type","backslash");Hn&&(Hn.querySelector("span").style.display="inline")}},200)},Re=function(e,t){var n=t,r=(0,o.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())},Qt=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(x(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(h){_e(e,h)||Be(h,n)||at(e,t,h,u)};var s=document.createElement("span");s.setAttribute("aria-label",window.VditorI18n.linkRef),s.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");s.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.linkRef),u.value=t.getAttribute("data-link-label"),u.oninput=function(){r()},u.onkeydown=function(h){_e(e,h)||Be(h,n)||at(e,t,h,a)},Ie(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",s),Re(e,t)},Je=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ge(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Xe=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,k.ib)(n.wysiwyg.element,e),ce(n),Ge(n),be(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ie=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",window.VditorI18n.remove+"<"+(0,l.ns)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,k.zh)(t);r.setStartAfter(e),(0,k.Hc)(r),e.remove(),ce(t),Ge(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&je(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},at=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,k.zh)(e);t.insertAdjacentHTML("afterend",E.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,k.Hc)(i),n.preventDefault()}}},At=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",d.value),ce(e)};t.querySelectorAll("[data-marker]").forEach(function(S){S.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(S){_e(e,S)||Be(S,n)||at(e,t,S,u)};var s=document.createElement("span");s.setAttribute("aria-label",window.VditorI18n.link),s.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");s.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){_e(e,S)||Be(S,n)||at(e,t,S,d)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.tooltipText),h.className="vditor-tooltipped vditor-tooltipped__n";var d=document.createElement("input");h.appendChild(d),d.className="vditor-input",d.setAttribute("placeholder",window.VditorI18n.tooltipText),d.style.width="60px",d.value=t.getAttribute("title")||"",d.oninput=function(){r()},d.onkeydown=function(S){_e(e,S)||Be(S,n)||at(e,t,S,a)},Ie(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",s),e.wysiwyg.popover.insertAdjacentElement("beforeend",h),Re(e,t)},qn=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",d.value),typeof t.options.input=="function"&&t.options.input(x(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){_e(t,S)};var s=document.createElement("span");s.setAttribute("aria-label",window.VditorI18n.alternateText),s.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");s.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){_e(t,S)};var h=document.createElement("span");h.setAttribute("aria-label",window.VditorI18n.title),h.className="vditor-tooltipped vditor-tooltipped__n";var d=document.createElement("input");h.appendChild(d),d.className="vditor-input",d.setAttribute("placeholder",window.VditorI18n.title),d.value=n.getAttribute("title")||"",d.oninput=function(){r()},d.onkeydown=function(S){_e(t,S)},Ie(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",s),t.wysiwyg.popover.insertAdjacentElement("beforeend",h),Re(t,n)},Be=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,k.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Ye=function(e){e.currentMode==="wysiwyg"?Ge(e):e.currentMode==="ir"&&rt(e)},$t=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){Ee(i,e),i.previousElementSibling.setAttribute("style","display:none")}),ce(e,n)},Kn=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",s="",u=Wn(e),h=u.beforeHTML,d=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="",I="";r.parentElement.getAttribute("data-block")!=="0"&&(R=Yt(r),I=Xt(r)),(h||R)&&(T="".concat(R,"<").concat(S,">").concat(h,"</").concat(S,">"),h=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(E.g.ZWSP,"<wbr>").concat(s),i=!0),(d||I)&&(d="<".concat(S,">").concat(d,"</").concat(S,">").concat(I),T+=d),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=T):(r.outerHTML=T,r=r.parentElement),a="<".concat(S,">")+a,s="</".concat(S,">")+s}else i=!0}(0,k.ib)(t.wysiwyg.element,e)},zn=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,k.zh)(e),s=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(s==="strike"&&(s="strikeThrough"),s==="quote"){var u=(0,o.lG)(a.startContainer,"BLOCKQUOTE");u||(u=a.startContainer.childNodes[a.startOffset]),u&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),u.outerHTML=u.innerHTML.trim()===""?'<p data-block="0">'.concat(u.innerHTML,"</p>"):u.innerHTML,(0,k.ib)(e.wysiwyg.element,a))}else if(s==="inline-code"){var h=(0,o.lG)(a.startContainer,"CODE");h||(h=a.startContainer.childNodes[a.startOffset]),h&&(h.outerHTML=h.innerHTML.replace(E.g.ZWSP,"")+"<wbr>",(0,k.ib)(e.wysiwyg.element,a))}else s==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):s==="check"||s==="list"||s==="ordered-list"?(wt(e,a,s),(0,k.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?Kn(a,e,s):document.execCommand(s,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,k.ib)(e.wysiwyg.element,a));var d=(0,o.F9)(a.startContainer);if(s==="quote"){if(d||(d=a.startContainer.childNodes[a.startOffset]),d){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var S=(0,o.lG)(a.startContainer,"LI");S&&d.contains(S)?S.innerHTML='<blockquote data-block="0">'.concat(S.innerHTML,"</blockquote>"):d.outerHTML='<blockquote data-block="0">'.concat(d.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,a)}}else if(s==="check"||s==="list"||s==="ordered-list")wt(e,a,s,!1),(0,k.ib)(e.wysiwyg.element,a),r=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(s==="inline-code"){if(a.toString()===""){var T=document.createElement("code");T.textContent=E.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a)}t.classList.add("vditor-menu--current")}else if(s==="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),d&&(d.outerHTML=e.lute.SpinVditorDOM(d.outerHTML)),(0,k.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(se){Ee(se,e)}),t.classList.add("vditor-menu--disabled")}else if(s==="link"){if(a.toString()===""){var R=document.createElement("a");R.innerText=E.g.ZWSP,a.insertNode(R),a.setStart(R.firstChild,1),a.collapse(!0),At(e,R,a);var I=e.wysiwyg.popover.querySelector("input");I.value="",I.focus(),i=!1}else{var T=document.createElement("a");T.setAttribute("href",""),T.innerHTML=a.toString(),a.surroundContents(T),a.insertNode(T),(0,k.Hc)(a),At(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(s==="table"){var q='<table data-block="0"><thead><tr><th>col1<wbr></th><th>col2</th><th>col3</th></tr></thead><tbody><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table>';if(a.toString().trim()==="")d&&d.innerHTML.trim().replace(E.g.ZWSP,"")===""?d.outerHTML=q:document.execCommand("insertHTML",!1,q),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,k.Hc)(a);else{q='<table data-block="0"><thead><tr>';var B=a.toString().split(`
|
|
69
|
+
`),H=B[0].split(",").length>B[0].split(" ").length?",":" ";B.forEach(function(J,se){se===0?(J.split(H).forEach(function(ae,ue){ue===0?q+="<th>".concat(ae,"<wbr></th>"):q+="<th>".concat(ae,"</th>")}),q+="</tr></thead>"):(se===1?q+="<tbody><tr>":q+="<tr>",J.split(H).forEach(function(ae){q+="<td>".concat(ae,"</td>")}),q+="</tr>")}),q+="</tbody></table>",document.execCommand("insertHTML",!1,q),(0,k.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if(s==="line"){if(d){var G=`<hr data-block="0"><p data-block="0"><wbr>
|
|
70
|
+
</p>`;d.innerHTML.trim()===""?d.outerHTML=G:d.insertAdjacentHTML("afterend",G),(0,k.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),s==="strike"&&(s="strikeThrough"),a.toString()===""&&(s==="bold"||s==="italic"||s==="strikeThrough")){var W="strong";s==="italic"?W="em":s==="strikeThrough"&&(W="s");var T=document.createElement(W);T.textContent=E.g.ZWSP,a.insertNode(T),T.previousSibling&&T.previousSibling.textContent===E.g.ZWSP&&(T.previousSibling.textContent=""),a.setStart(T.firstChild,1),a.collapse(!0),(0,k.Hc)(a)}else document.execCommand(s,!1,"")}r&&Ge(e),i&&ce(e)}},me=function(){function e(t,n){var r,i=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"";n.level===2&&(a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"");var s=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(s,"</").concat(u,">");else{this.element.classList.add("vditor-toolbar__item");var h=document.createElement(u);h.setAttribute("data-type",n.name),h.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),h.setAttribute("aria-label",s),h.innerHTML=n.icon,this.element.appendChild(h)}n.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(d){d.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?zn(t,i.element.children[0],d):t.currentMode==="ir"?sr(t,i.element.children[0],n.prefix||"",n.suffix||""):Xn(t,i.element.children[0],n.prefix||"",n.suffix||""))})}return e}(),Gn=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)}}(),Ze=function(e,t,n){var r;if(typeof n!="string"?(b(e,["subToolbar","hint"]),n.preventDefault(),r=x(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",m(e.toolbar.elements,E.g.EDIT_TOOLBARS),y(e.toolbar.elements,E.g.EDIT_TOOLBARS),f(e.toolbar.elements,["outdent","indent"]),t==="ir")v(e.toolbar.elements,["both"]),w(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="block",e.lute.SetVditorIR(!0),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!1),e.currentMode="ir",e.ir.element.innerHTML=e.lute.Md2VditorIRDOM(r),Ve(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),Ne(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){Ee(a,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ne.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")v(e.toolbar.elements,["both"]),w(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="block",e.ir.element.parentElement.style.display="none",e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!0),e.lute.SetVditorSV(!1),e.currentMode="wysiwyg",Ne(e),$t(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ne.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){w(e.toolbar.elements,["both"]),v(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="none",(e.options.preview.mode==="both"||e.options.preview.mode==="editor")&&(e.sv.element.style.display="block"),e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!0),e.currentMode="sv";var i=tn(r,e);i==="<div data-block='0'></div>"&&(i=""),e.sv.element.innerHTML=i,ye(e.sv.element),Se(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),Ne(e)}e.undo.resetIcon(e),typeof n!="string"&&(e[e.currentMode].element.focus(),Ye(e)),je(e),mt(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")}},Zn=function(e){Gn(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),a.innerHTML='<button data-mode="wysiwyg">'.concat(window.VditorI18n.wysiwyg," <").concat((0,l.ns)("⌥⌘7"),`></button>
|
|
71
71
|
<button data-mode="ir">`).concat(window.VditorI18n.instantRendering," <").concat((0,l.ns)("⌥⌘8"),`></button>
|
|
72
|
-
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];g(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(
|
|
72
|
+
<button data-mode="sv">`).concat(window.VditorI18n.splitView," <").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];g(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(s){Ze(n,"wysiwyg",s),s.preventDefault(),s.stopPropagation()}),r.children.item(1).addEventListener((0,l.Le)(),function(s){Ze(n,"ir",s),s.preventDefault(),s.stopPropagation()}),r.children.item(2).addEventListener((0,l.Le)(),function(s){Ze(n,"sv",s),s.preventDefault(),s.stopPropagation()})},t}(me),ot=function(e,t){return(0,k.Gb)(e,t)?getSelection().toString():""},xt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(x(e)),b(e,["subToolbar","hint"])})},en=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,K.E)(n.target,e.options.lang,e.options.theme))})},Dt=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,k.zh)(e),e.options.blur&&e.options.blur(x(e))})},Ht=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(E.g.DROP_EDITOR,E.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(E.g.DROP_EDITOR)?ee(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&St(e,n,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})})},Ot=function(e,t,n){t.addEventListener("copy",function(r){return n(r,e)})},Nt=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")})},be=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,k.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)}},Rt=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"||N("⌘X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(Le(e,n))return}else if(e.currentMode==="wysiwyg"){if(Fn(e,n))return}else if(e.currentMode==="ir"&&he(e,n))return;if(e.options.ctrlEnter&&N("⌘Enter",n)){e.options.ctrlEnter(x(e)),n.preventDefault();return}if(N("⌘Z",n)&&!e.toolbar.elements.undo){e.undo.undo(e),n.preventDefault();return}if(N("⌘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(x(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,o.lG)(getSelection().getRangeAt(0).startContainer,r)?_t(e):gt(e,r),ce(e)}else e.currentMode==="sv"?nn(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&ct(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" ");return n.preventDefault(),!0}if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[7-9]$/.test(n.code))return n.code==="Digit7"?Ze(e,"wysiwyg",n):n.code==="Digit8"?Ze(e,"ir",n):n.code==="Digit9"&&Ze(e,"sv",n),!0;e.options.toolbar.find(function(i){if(!i.hotkey||i.toolbar){if(i.toolbar){var a=i.toolbar.find(function(s){if(!s.hotkey)return!1;if(N(s.hotkey,n))return e.toolbar.elements[s.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0});return!!a}return!1}if(N(i.hotkey,n))return e.toolbar.elements[i.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0})}})},It=function(e,t){t.addEventListener("selectstart",function(n){t.onmouseup=function(){setTimeout(function(){var r=ot(e[e.currentMode].element);r.trim()?(e.currentMode==="wysiwyg"&&e.options.comment.enable&&(!(0,o.a1)(n.target,"data-type","footnotes-block")&&!(0,o.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())})}})},Pt=function(e,t){var n=(0,k.zh)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var r=(0,o.a1)(n.startContainer,"data-block","0");r||(r=e.sv.element);var i=e.lute.SpinVditorSVDOM(r.textContent);i="<div data-block='0'>"+i.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
|
|
73
73
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
74
|
-
</span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,
|
|
74
|
+
</span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,ye(e.sv.element),(0,k.ib)(e.sv.element,n),be(e)},yt=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},tn=function(e,t){_("SpinVditorSVDOM",e,"argument",t.options.debugger);var n=t.lute.SpinVditorSVDOM(e);return e="<div data-block='0'>"+n.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
|
|
75
75
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
76
|
-
</span></span></div><div data-block="0"><`)+"</div>",_("SpinVditorSVDOM",e,"result",t.options.debugger),e},Jn=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
|
|
76
|
+
</span></span></div><div data-block="0"><`)+"</div>",_("SpinVditorSVDOM",e,"result",t.options.debugger),e},Jn=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 s=n.textContent;if(a==="li-marker"&&(t==="code-block-open-marker"||t==="code-block-info"))r=s.replace(/\S/g," ")+r;else if(t==="code-block-close-marker"&&n.nextElementSibling.isSameNode(e)){var u=yt(e,"code-block-open-marker");u&&u.previousElementSibling&&(n=u.previousElementSibling,r=s+r)}else r=s+r}else a==="newline"&&(i=!0);n=n.previousElementSibling}return r},Se=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=x(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)},nn=function(e,t){var n=(0,k.zh)(e),r=(0,C.S)(n.startContainer,"SPAN");r&&r.textContent.trim()!==""&&(t=`
|
|
77
77
|
`+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},Xn=function(e,t,n,r){var i=(0,k.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,k.ib)(e.sv.element,i));var
|
|
78
|
+
</span></span>`,(0,k.ib)(e.sv.element,i));var s=(0,o.F9)(i.startContainer),u=(0,C.S)(i.startContainer,"SPAN");if(s){if(a==="link"){var h=void 0;i.toString()===""?h="".concat(n).concat(Lute.Caret).concat(r):h="".concat(n).concat(i.toString()).concat(r.replace(")",Lute.Caret+")")),document.execCommand("insertHTML",!1,h);return}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"||a==="line"){var h=void 0;i.toString()===""?h="".concat(n).concat(Lute.Caret).concat(a==="code"?"":r):h="".concat(n).concat(i.toString()).concat(Lute.Caret).concat(a==="code"?"":r),a==="table"||a==="code"&&u&&u.textContent!==""?h=`
|
|
79
79
|
|
|
80
80
|
`+h:a==="line"&&(h=`
|
|
81
81
|
|
|
82
82
|
`.concat(n,`
|
|
83
|
-
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,h);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&u){var d="* ";a==="check"?d="* [ ] ":a==="ordered-list"?d="1. ":a==="quote"&&(d="> ");var S=yt(u,"newline");S?S.insertAdjacentText("afterend",d):
|
|
83
|
+
`).concat(Lute.Caret)),document.execCommand("insertHTML",!1,h);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&u){var d="* ";a==="check"?d="* [ ] ":a==="ordered-list"?d="1. ":a==="quote"&&(d="> ");var S=yt(u,"newline");S?S.insertAdjacentText("afterend",d):s.insertAdjacentText("afterbegin",d),ie(e);return}(0,k.ib)(e.sv.element,i),Se(e)}},rn=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},an=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])})},Yn=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function u(S){try{d(r.next(S))}catch(T){s(T)}}function h(S){try{d(r.throw(S))}catch(T){s(T)}}function d(S){S.done?a(S.value):i(S.value).then(u,h)}d((r=r.apply(e,t||[])).next())})},Qn=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(d){return function(S){return h([d,S])}}function h(d){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(a=d[0]&2?i.return:d[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,d[1])).done)return a;switch(i=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){n.label=d[1];break}if(d[0]===6&&n.label<a[1]){n.label=a[1],a=d;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(d);break}a[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(S){d=[6,S],i=0}finally{r=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},$n=function(){function e(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"}return e}(),er=function(e,t){e.tip.hide();var n=[],r="",i="";e.options.lang,e.options;for(var a=function(d,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 I=T.name.lastIndexOf("."),O=T.name.substr(I),q=e.options.upload.filename(T.name.substr(0,I))+O;if(e.options.upload.accept){var B=e.options.upload.accept.split(",").some(function(H){var G=H.trim();if(G.indexOf(".")===0){if(O.toLowerCase()===G.toLowerCase())return!0}else if(T.type.split("/")[0]===G.split("/")[0])return!0;return!1});B||(r+="<li>".concat(T.name," ").concat(window.VditorI18n.fileTypeError,"</li>"),R=!1)}R&&(n.push(T),i+="<li>".concat(q," ").concat(window.VditorI18n.uploading,' <a class="vditorCancelUpload" href="javascript:void(0)">').concat(window.VditorI18n.cancelUpload,"</a></li>"))},s=t.length,u=0;u<s;u++)a(s,u);if(e.tip.show("<ul>".concat(r).concat(i,"</ul>")),e.options.upload.cancel){var h=e.tip.element.querySelector(".vditorCancelUpload");h&&h.addEventListener("click",function(){e.options.upload.cancel(n),e.tip.hide(),e.upload.isUploading=!1})}return n},tr=function(e,t){var n=rn(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(s){var u=s.lastIndexOf("."),h=t.options.upload.filename(s.substr(0,u))+s.substr(u);i+="<li>".concat(h," ").concat(window.VditorI18n.uploadError,"</li>")}),i+="</ul>"),i?t.tip.show(i):t.tip.hide();var a="";Object.keys(r.data.succMap).forEach(function(s){var u=r.data.succMap[s],h=s.lastIndexOf("."),d=s.substr(h),S=t.options.upload.filename(s.substr(0,h))+d;d=d.toLowerCase(),d.indexOf(".wav")===0||d.indexOf(".mp3")===0||d.indexOf(".ogg")===0?t.currentMode==="wysiwyg"?a+=`<div class="vditor-wysiwyg__block" data-type="html-block"
|
|
84
84
|
data-block="0"><pre><code><audio controls="controls" src="`.concat(u,'"></audio></code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="').concat(u,`"></audio></pre></div>
|
|
85
85
|
`):t.currentMode==="ir"?a+='<audio controls="controls" src="'.concat(u,`"></audio>
|
|
86
86
|
`):a+="[".concat(S,"](").concat(u,`)
|
|
@@ -88,61 +88,61 @@ onclick="event.stopPropagation();this.previousElementSibling.select();document.e
|
|
|
88
88
|
`):a+=".concat(u,`)
|
|
89
89
|
`):t.currentMode==="wysiwyg"?a+='<a href="'.concat(u,'">').concat(S,`</a>
|
|
90
90
|
`):a+="[".concat(S,"](").concat(u,`)
|
|
91
|
-
`)}),(0,k.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},jt=function(e,t,n){return Yn(void 0,void 0,void 0,function(){var r,i,O,a,
|
|
92
|
-
</p>`)),(0,k.ib)(e[e.currentMode].element,n),Ye(e),ee(e))},ar=function(e){var t=(0,
|
|
93
|
-
`)===-1||t.key==="ArrowRight"&&a.start>=r.textContent.trimRight().length){var
|
|
94
|
-
`)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&a.start===0){var
|
|
91
|
+
`)}),(0,k.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},jt=function(e,t,n){return Yn(void 0,void 0,void 0,function(){var r,i,O,a,s,s,u,h,d,S,T,R,I,O,q,B;return Qn(this,function(H){switch(H.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 s=H.sent(),n&&(n.value=""),typeof s=="string"?(e.tip.show(s),[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=H.sent(),H.label=4;case 4:if(e.options.upload.validate&&(s=e.options.upload.validate(r),typeof s=="string"))return e.tip.show(s),[2];if(u=rn(e),e.upload.range=(0,k.zh)(e),h=er(e,r),h.length===0)return n&&(n.value=""),[2];for(d=new FormData,S=e.options.upload.extraData,T=0,R=Object.keys(S);T<R.length;T++)I=R[T],d.append(I,S[I]);for(O=0,q=h.length;O<q;O++)d.append(e.options.upload.fieldName,h[O]);return B=new XMLHttpRequest,e.upload.xhr=B,B.open("POST",e.options.upload.url),e.options.upload.token&&B.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(B.withCredentials=!0),an(e,B),e.upload.isUploading=!0,u.setAttribute("contenteditable","false"),B.onreadystatechange=function(){if(B.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,u.setAttribute("contenteditable","true"),B.status>=200&&B.status<300)if(e.options.upload.success)e.options.upload.success(u,B.responseText);else{var G=B.responseText;e.options.upload.format&&(G=e.options.upload.format(t,B.responseText)),tr(G,e)}else e.options.upload.error?e.options.upload.error(B.responseText):e.tip.show(B.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},B.upload.onprogress=function(G){if(G.lengthComputable){var W=G.loaded/G.total*100;e.upload.element.style.display="block";var J=e.upload.element;J.style.width=W+"%"}},B.send(d),[2]}})})},bt=function(e,t,n){var r,i=(0,o.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=Bn(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(W){W.remove()}),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach(function(W){W.removeAttribute("style")}),i.querySelectorAll(".vditor-comment").forEach(function(W){W.textContent.trim()===""&&(W.classList.remove("vditor-comment","vditor-comment--focus"),W.removeAttribute("data-cmtids"))}),(r=i.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(W){W.textContent.trim()===""&&(W.classList.remove("vditor-comment","vditor-comment--focus"),W.removeAttribute("data-cmtids"))});var s="";i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.wysiwyg.element);var u=i.isEqualNode(e.wysiwyg.element),h=(0,o.a1)(i,"data-type","footnotes-block");if(u)s=i.innerHTML;else{var d=(0,o.O9)(t.startContainer);if(d&&!h){var S=(0,C.S)(t.startContainer,"BLOCKQUOTE");S?i=(0,o.F9)(t.startContainer)||i:i=d}if(h&&(i=h),s=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var T=i.previousElementSibling,R=i.nextElementSibling;T&&(T.tagName==="UL"||T.tagName==="OL")&&(s=T.outerHTML+s,T.remove()),R&&(R.tagName==="UL"||R.tagName==="OL")&&(s=s+R.outerHTML,R.remove()),s=s.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}i.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(W){W&&!i.isEqualNode(W)&&(s+=W.outerHTML,W.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(W){W&&!i.isEqualNode(W)&&(s+=W.outerHTML,W.remove())}))}if(s=s.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,""),s==='<p data-block="0">```<wbr></p>'&&e.hint.recentLanguage&&(s='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),_("SpinVditorDOM",s,"argument",e.options.debugger),s=e.lute.SpinVditorDOM(s),_("SpinVditorDOM",s,"result",e.options.debugger),u)i.innerHTML=s;else if(i.outerHTML=s,h){var I=(0,o.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(I){var O=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(I.getAttribute("data-marker"),'"]'));O&&O.setAttribute("aria-label",I.textContent.trim().substr(0,24))}}var q,B=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");B.forEach(function(W,J){J===0?q=W:(q.insertAdjacentHTML("beforeend",W.innerHTML),W.remove())}),B.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",B[0]);var H,G=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");G.forEach(function(W,J){J===0?H=W:(H.insertAdjacentHTML("beforeend",W.innerHTML),W.remove())}),G.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",G[0]),(0,k.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(W){Ee(W,e)}),n&&(n.inputType==="deleteContentBackward"||n.inputType==="deleteContentForward")&&e.options.comment.enable&&(e.wysiwyg.triggerRemoveComment(e),e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)))}je(e),ce(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},nr=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},rr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function u(S){try{d(r.next(S))}catch(T){s(T)}}function h(S){try{d(r.throw(S))}catch(T){s(T)}}function d(S){S.done?a(S.value):i(S.value).then(u,h)}d((r=r.apply(e,t||[])).next())})},ir=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(d){return function(S){return h([d,S])}}function h(d){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(a=d[0]&2?i.return:d[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,d[1])).done)return a;switch(i=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){n.label=d[1];break}if(d[0]===6&&n.label<a[1]){n.label=a[1],a=d;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(d);break}a[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(S){d=[6,S],i=0}finally{r=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},on=function(e,t,n){if(e.keyCode===229&&e.code===""&&e.key==="Unidentified"&&t.currentMode!=="sv"){var r=(0,o.F9)(n);if(r&&r.textContent.trim()==="")return t[t.currentMode].composingLock=!0,!1}return!0},sn=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,o.lG)(e.startContainer,"P")||(0,o.lG)(e.startContainer,"LI");if(r&&(0,k.im)(r,t[t.currentMode].element,e).start===0){r.nodeValue&&(r.nodeValue=r.nodeValue.replace(/\u2006/g,""));var i=document.createTextNode(E.g.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},ln=function(e,t){if(t==="ArrowDown"||t==="ArrowUp"){var n=(0,o.a1)(e.startContainer,"data-type","math-inline")||(0,o.a1)(e.startContainer,"data-type","html-entity")||(0,o.a1)(e.startContainer,"data-type","html-inline");n&&(t==="ArrowDown"&&e.setStartAfter(n.parentElement),t==="ArrowUp"&&e.setStartBefore(n.parentElement))}},st=function(e,t){var n=(0,k.zh)(e),r=(0,o.F9)(n.startContainer);r&&(r.insertAdjacentHTML(t,'<p data-block="0">'.concat(E.g.ZWSP,`<wbr>
|
|
92
|
+
</p>`)),(0,k.ib)(e[e.currentMode].element,n),Ye(e),ee(e))},ar=function(e){var t=(0,o.lG)(e,"TABLE");return t&&t.rows[0].cells[0].isSameNode(e)?t:!1},or=function(e){var t=(0,o.lG)(e,"TABLE");return t&&t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)?t:!1},cn=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,k.Hc)(t)),r},lt=function(e,t,n,r,i){var a=(0,k.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 s=i.nextElementSibling;return!s||s&&(s.tagName==="TABLE"||s.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(s),n.collapse(!0),(0,k.Hc)(n)),t.preventDefault(),!0}return!1},Qe=function(e,t,n,r,i){var a=(0,k.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 s=i.previousElementSibling;return!s||s&&(s.tagName==="TABLE"||s.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(s),n.collapse(!1),(0,k.Hc)(n)),t.preventDefault(),!0}return!1},wt=function(e,t,n,r){r===void 0&&(r=!0);var i=(0,o.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="",s=0;s<i.parentElement.childElementCount;s++){var u=i.parentElement.children[s].querySelector("input");u&&u.remove(),a+='<p data-block="0">'.concat(i.parentElement.children[s].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 d=void 0;n==="list"?(d=document.createElement("ul"),d.setAttribute("data-marker","*")):(d=document.createElement("ol"),d.setAttribute("data-marker","1.")),d.setAttribute("data-block","0"),d.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),d.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(d,i.parentElement)}else{var h=(0,o.a1)(t.startContainer,"data-block","0");h||(e[e.currentMode].element.querySelector("wbr").remove(),h=e[e.currentMode].element.querySelector("p"),h.innerHTML="<wbr>"),n==="check"?(h.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(h.innerHTML,"</li></ul>")),h.remove()):n==="list"?(h.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(h.innerHTML,"</li></ul>")),h.remove()):n==="ordered-list"&&(h.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(h.innerHTML,"</li></ol>")),h.remove())}},un=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach(function(h,d){h.nodeType!==3&&t&&h.textContent.trim()!==""&&t.getAttribute("data-node-id")===h.getAttribute("data-node-id")&&(d!==0&&i.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(h){h.remove()}),n.insertNode(document.createElement("wbr"));var a=r.parentElement,s="";i.forEach(function(h){var d=h.getAttribute("data-marker");d.length!==1&&(d="1".concat(d.slice(-1))),s+='<li data-node-id="'.concat(h.getAttribute("data-node-id"),'" data-marker="').concat(d,'">').concat(h.innerHTML,"</li>"),h.remove()}),r.insertAdjacentHTML("beforeend","<".concat(a.tagName,' data-block="0">').concat(s,"</").concat(a.tagName,">")),e.currentMode==="wysiwyg"?a.outerHTML=e.lute.SpinVditorDOM(a.outerHTML):a.outerHTML=e.lute.SpinVditorIRDOM(a.outerHTML),(0,k.ib)(e[e.currentMode].element,n);var u=(0,o.O9)(n.startContainer);u&&u.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(h){Ee(h,e),e.currentMode==="wysiwyg"&&h.previousElementSibling.setAttribute("style","display:none")}),ee(e),Ye(e)}else e[e.currentMode].element.focus()},Bt=function(e,t,n,r){var i=(0,o.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,s=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 h=!1,d="";a.querySelectorAll("li").forEach(function(T){h&&(d+=T.outerHTML,!T.nextElementSibling&&!T.previousElementSibling?T.parentElement.remove():T.remove()),T.isSameNode(u[u.length-1])&&(h=!0)}),u.reverse().forEach(function(T){i.insertAdjacentElement("afterend",T)}),d&&(s.innerHTML=d,u[0].insertAdjacentElement("beforeend",s)),e.currentMode==="wysiwyg"?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,k.ib)(e[e.currentMode].element,n);var S=(0,o.O9)(n.startContainer);S&&S.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(T){Ee(T,e),e.currentMode==="wysiwyg"&&T.previousElementSibling.setAttribute("style","display:none")}),ee(e),Ye(e)}else e[e.currentMode].element.focus()},vt=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,r=e.rows[0].cells.length,i=e.rows.length,a=0,s=0;s<i;s++)for(var u=0;u<r;u++)if(e.rows[s].cells[u].isSameNode(n)){a=u;break}for(var h=0;h<i;h++)e.rows[h].cells[a].setAttribute("align",t)},Ut=function(e){var t=e.trimRight().split(`
|
|
95
95
|
`).pop();return t===""?!1:(t.replace(/ |-/g,"")===""||t.replace(/ |_/g,"")===""||t.replace(/ |\*/g,"")==="")&&t.replace(/ /g,"").length>2?!(t.indexOf("-")>-1&&t.trimLeft().indexOf(" ")===-1&&e.trimRight().split(`
|
|
96
96
|
`).length>1||t.indexOf(" ")===0||t.indexOf(" ")===0):!1},Vt=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,"")===""},ee=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?ce(e,t):e.currentMode==="ir"?Ve(e,t):e.currentMode==="sv"&&
|
|
98
|
-
`)&&
|
|
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,"")===""},ee=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?ce(e,t):e.currentMode==="ir"?Ve(e,t):e.currentMode==="sv"&&Se(e,t)},fn=function(e,t,n,r){var i,a=e.startContainer,s=(0,o.lG)(a,"LI");if(s){if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Enter"&&!r.shiftKey&&n&&s.contains(n)&&n.nextElementSibling)return s&&!s.textContent.endsWith(`
|
|
98
|
+
`)&&s.insertAdjacentText("beforeend",`
|
|
99
99
|
`),e.insertNode(document.createTextNode(`
|
|
100
100
|
|
|
101
|
-
`)),e.collapse(!1),ee(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&!
|
|
101
|
+
`)),e.collapse(!1),ee(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&!s.previousElementSibling&&e.toString()===""&&(0,k.im)(s,t[t.currentMode].element,e).start===0)return s.nextElementSibling?(s.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(s.innerHTML,"</p>")),s.remove()):s.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(s.innerHTML,"</p>"),(0,k.ib)(t[t.currentMode].element,e),ee(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&s.textContent.trim().replace(E.g.ZWSP,"")===""&&e.toString()===""&&((i=s.previousElementSibling)===null||i===void 0?void 0:i.tagName)==="LI")return s.previousElementSibling.insertAdjacentText("beforeend",`
|
|
102
102
|
|
|
103
|
-
`),e.selectNodeContents(
|
|
104
|
-
`+
|
|
105
|
-
|<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(
|
|
103
|
+
`),e.selectNodeContents(s.previousElementSibling),e.collapse(!1),s.remove(),(0,k.ib)(t[t.currentMode].element,e),ee(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Tab"){var u=!1;if((e.startOffset===0&&(a.nodeType===3&&!a.previousSibling||a.nodeType!==3&&a.nodeName==="LI")||s.classList.contains("vditor-task")&&e.startOffset===1&&a.previousSibling.nodeType!==3&&a.previousSibling.tagName==="INPUT")&&(u=!0),u||e.toString()!=="")return r.shiftKey?Bt(t,s,e,s.parentElement):un(t,s,e),r.preventDefault(),!0}}return!1},Wt=function(e,t,n){if(e.options.tab&&n.key==="Tab")return n.shiftKey||(t.toString()===""?(t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1)):(t.extractContents(),t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1))),(0,k.Hc)(t),ee(e),n.preventDefault(),!0},dn=function(e,t,n,r){if(n){if(!(0,l.yl)(e)&&!e.altKey&&e.key==="Enter"){var i=String.raw(Ln||(Ln=nr(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),a=i.split("|");if(i.startsWith("|")&&i.endsWith("|")&&a.length>3){var s=a.map(function(){return"---"}).join("|");return s=n.textContent+`
|
|
104
|
+
`+s.substring(3,s.length-3)+`
|
|
105
|
+
|<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(s),(0,k.ib)(t[t.currentMode].element,r),ee(t),be(t),e.preventDefault(),!0}if(Ut(n.innerHTML)&&n.previousElementSibling){var u="",h=n.innerHTML.trimRight().split(`
|
|
106
106
|
`);return h.length>1&&(h.pop(),u='<p data-block="0">'.concat(h.join(`
|
|
107
107
|
`),"</p>")),n.insertAdjacentHTML("afterend","".concat(u,`<hr data-block="0"><p data-block="0"><wbr>
|
|
108
|
-
</p>`)),n.remove(),(0,k.ib)(t[t.currentMode].element,r),ee(t),
|
|
108
|
+
</p>`)),n.remove(),(0,k.ib)(t[t.currentMode].element,r),ee(t),be(t),e.preventDefault(),!0}if(Vt(n.innerHTML))return t.currentMode==="wysiwyg"?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|
109
109
|
</p>`):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+`<p data-block="0"><wbr>
|
|
110
|
-
</p>`),(0,k.ib)(t[t.currentMode].element,r),ee(t),
|
|
111
|
-
`).length>1&&(0,k.im)(n,t[t.currentMode].element,r).start===0){var d=(0,
|
|
110
|
+
</p>`),(0,k.ib)(t[t.currentMode].element,r),ee(t),be(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,k.im)(n,t[t.currentMode].element,r).start===0){var d=(0,o.DX)(n.previousElementSibling);return d.textContent.endsWith(`
|
|
112
112
|
`)||(d.textContent=d.textContent+`
|
|
113
|
-
`),d.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,k.ib)(t[t.currentMode].element,r),!1}return!1}},pn=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>")),ee(e)},hn=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,k.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));ee(e)},Et=function(e,t,n,r){r===void 0&&(r="afterend");for(var i=0,a=n.previousElementSibling;a;)i++,a=a.previousElementSibling;for(var
|
|
113
|
+
`),d.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,k.ib)(t[t.currentMode].element,r),!1}return!1}},pn=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>")),ee(e)},hn=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,k.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));ee(e)},Et=function(e,t,n,r){r===void 0&&(r="afterend");for(var i=0,a=n.previousElementSibling;a;)i++,a=a.previousElementSibling;for(var s=0;s<t.rows.length;s++)s===0?t.rows[s].cells[i].insertAdjacentHTML(r,"<th> </th>"):t.rows[s].cells[i].insertAdjacentHTML(r,"<td> </td>");ee(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,k.Hc)(t),ee(e)}},gn=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 s=0;s<n.rows.length;s++){var u=n.rows[s].cells;if(u.length===1){n.remove(),Ye(e);break}u[i].remove()}(0,k.Hc)(t),ee(e)},yn=function(e,t,n){var r=n.startContainer,i=(0,o.lG)(r,"TD")||(0,o.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),ee(e),be(e),t.preventDefault(),!0}if(t.key==="Tab"){if(t.shiftKey)return cn(i,n),t.preventDefault(),!0;var s=i.nextElementSibling;return s||(i.parentElement.nextElementSibling?s=i.parentElement.nextElementSibling.firstElementChild:i.parentElement.parentElement.tagName==="THEAD"&&i.parentElement.parentElement.nextElementSibling?s=i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:s=null),s&&(n.selectNodeContents(s),(0,k.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,k.Hc)(n)):st(e,"beforebegin"),!0;for(var h=0,d=i.parentElement;h<d.cells.length&&!d.cells[h].isSameNode(i);h++);var S=d.previousElementSibling;return S||(S=d.parentElement.previousElementSibling.firstChild),n.selectNodeContents(S.cells[h]),n.collapse(!1),(0,k.Hc)(n),!0}if(t.key==="ArrowDown"){t.preventDefault();var d=i.parentElement;if(!d.nextElementSibling&&i.tagName==="TD")return u.nextElementSibling?(n.selectNodeContents(u.nextElementSibling),n.collapse(!0),(0,k.Hc)(n)):st(e,"afterend"),!0;for(var h=0;h<d.cells.length&&!d.cells[h].isSameNode(i);h++);var s=d.nextElementSibling;return s||(s=d.parentElement.nextElementSibling.firstChild),n.selectNodeContents(s.cells[h]),n.collapse(!0),(0,k.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=cn(i,n,!1);return!R&&u&&(u.textContent.trim()===""?(u.outerHTML=`<p data-block="0"><wbr>
|
|
114
114
|
</p>`,(0,k.ib)(e[e.currentMode].element,n)):(n.setStartBefore(u),n.collapse(!0)),ee(e)),t.preventDefault(),!0}if(N("⇧⌘F",t))return hn(e,n,i),t.preventDefault(),!0;if(N("⌘=",t))return pn(e,n,i),t.preventDefault(),!0;if(N("⇧⌘G",t))return Et(e,u,i,"beforebegin"),t.preventDefault(),!0;if(N("⇧⌘=",t))return Et(e,u,i),t.preventDefault(),!0;if(N("⌘-",t))return mn(e,n,i),t.preventDefault(),!0;if(N("⇧⌘-",t))return gn(e,n,u,i),t.preventDefault(),!0;if(N("⇧⌘L",t)){if(e.currentMode==="ir")return vt(u,"left"),ee(e),t.preventDefault(),!0;var I=e.wysiwyg.popover.querySelector('[data-type="left"]');if(I)return I.click(),t.preventDefault(),!0}if(N("⇧⌘C",t)){if(e.currentMode==="ir")return vt(u,"center"),ee(e),t.preventDefault(),!0;var I=e.wysiwyg.popover.querySelector('[data-type="center"]');if(I)return I.click(),t.preventDefault(),!0}if(N("⇧⌘R",t)){if(e.currentMode==="ir")return vt(u,"right"),ee(e),t.preventDefault(),!0;var I=e.wysiwyg.popover.querySelector('[data-type="right"]');if(I)return I.click(),t.preventDefault(),!0}}return!1},bn=function(e,t,n,r){if(n.tagName==="PRE"&&N("⌘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),ee(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey){var i=(0,k.im)(n,e[e.currentMode].element,r);if((i.start===0||i.start===1&&n.innerText===`
|
|
115
115
|
`)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,k.ib)(e[e.currentMode].element,r),ee(e),t.preventDefault(),!0}return!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"?(n.firstElementChild.textContent.endsWith(`
|
|
116
116
|
`)||n.firstElementChild.insertAdjacentText("beforeend",`
|
|
117
117
|
`),r.extractContents(),r.insertNode(document.createTextNode(`
|
|
118
|
-
`)),r.collapse(!1),(0,k.Hc)(r),(0,l.vU)()||(e.currentMode==="wysiwyg"?bt(e,r):Fe(e,r)),
|
|
119
|
-
`||r.innerHTML.replace(E.g.ZWSP,"")===""?(
|
|
118
|
+
`)),r.collapse(!1),(0,k.Hc)(r),(0,l.vU)()||(e.currentMode==="wysiwyg"?bt(e,r):Fe(e,r)),be(e),t.preventDefault(),!0):!1},wn=function(e,t,n,r){var i=t.startContainer,a=(0,o.lG)(i,"BLOCKQUOTE");if(a&&t.toString()===""){if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&(0,k.im)(a,e[e.currentMode].element,t).start===0)return t.insertNode(document.createElement("wbr")),a.outerHTML=a.innerHTML,(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0;if(r&&n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&r.parentElement.tagName==="BLOCKQUOTE"){var s=!1;if(r.innerHTML.replace(E.g.ZWSP,"")===`
|
|
119
|
+
`||r.innerHTML.replace(E.g.ZWSP,"")===""?(s=!0,r.remove()):r.innerHTML.endsWith(`
|
|
120
120
|
|
|
121
|
-
`)&&(0,k.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),
|
|
122
|
-
</p>`)),(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}var u=(0,
|
|
123
|
-
`,"</p>")),i.nextElementSibling?i.remove():i.parentElement.remove();return(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey){if(i.textContent.trim()==="")if((0,
|
|
121
|
+
`)&&(0,k.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),s=!0),s)return a.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(E.g.ZWSP,`<wbr>
|
|
122
|
+
</p>`)),(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}var u=(0,o.F9)(i);if(e.currentMode==="wysiwyg"&&u&&N("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),u.outerHTML='<blockquote data-block="0">'.concat(u.outerHTML,"</blockquote>"),(0,k.ib)(e.wysiwyg.element,t),ce(e),n.preventDefault(),!0;if(lt(e,n,t,a,a)||Qe(e,n,t,a,a))return!0}return!1},vn=function(e,t,n){var r=t.startContainer,i=(0,o.lG)(r,"LI");if(i&&i.classList.contains("vditor-task")){if(N("⇧⌘J",n)){var a=i.firstElementChild;return a.checked?a.removeAttribute("checked"):a.setAttribute("checked","checked"),ee(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 s=i.previousElementSibling;if(i.querySelector("input").remove(),s){var u=(0,o.DX)(s);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,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey){if(i.textContent.trim()==="")if((0,o.fb)(i.parentElement,"vditor-task")){var h=(0,o.O9)(r);h&&Bt(e,i,t,h)}else if(i.nextElementSibling){var d="",S="",T=!1;Array.from(i.parentElement.children).forEach(function(q){i.isSameNode(q)?T=!0:T?d+=q.outerHTML:S+=q.outerHTML});var R=i.parentElement.tagName,I=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(I,' data-block="0">').concat(S,"</").concat(R,">")),i.parentElement.outerHTML="".concat(S,`<p data-block="0"><wbr>
|
|
124
124
|
</p><`).concat(R,`
|
|
125
125
|
data-tight="true"`).concat(I,' data-block="0"').concat(O,">").concat(d,"</").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,k.ib)(e[e.currentMode].element,t),ee(e),
|
|
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,k.ib)(e[e.currentMode].element,t),ee(e),be(e),n.preventDefault(),!0}}return!1},En=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,k.im)(r,e[e.currentMode].element,t).start===0&&((0,l.vU)()&&a.tagName==="HR"||a.tagName==="TABLE")){if(a.tagName==="TABLE"){var s=a.lastElementChild.lastElementChild.lastElementChild;s.innerHTML=s.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else a.remove();return(0,k.ib)(e[e.currentMode].element,t),ee(e),n.preventDefault(),!0}}return!1},Sn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},Cn=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},St=function(e,t,n){return rr(void 0,void 0,void 0,function(){var r,i,a,s,u,h,d,S,T,R,I,O,q,H,B,H,G;return ir(this,function(W){switch(W.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)),s={},u=function(J,se){if(!se)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,J,se);var ae=J.TokensStr();if(J.__internal_object__.Parent.Type===34&&ae&&ae.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var ue=new XMLHttpRequest;ue.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&ue.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(ue.withCredentials=!0),an(e,ue),ue.setRequestHeader("Content-Type","application/json; charset=utf-8"),ue.onreadystatechange=function(){if(ue.readyState===XMLHttpRequest.DONE){if(ue.status===200){var Ae=ue.responseText;e.options.upload.linkToImgFormat&&(Ae=e.options.upload.linkToImgFormat(ue.responseText));var Me=JSON.parse(Ae);if(Me.code!==0){e.tip.show(Me.msg);return}var xe=Me.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(we){we.textContent===xe&&(we.textContent=Me.data.url)});else{var Q=e[e.currentMode].element.querySelector('img[src="'.concat(xe,'"]'));Q.src=Me.data.url,e.currentMode==="ir"&&(Q.previousElementSibling.previousElementSibling.innerHTML=Me.data.url)}ee(e)}else e.tip.show(ue.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(ue.responseText)}},ue.send(JSON.stringify({url:ae}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'.concat(Lute.EscapeHTMLStr(ae),"</span>"),Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'.concat(Lute.EscapeHTMLStr(ae),"</span>"),Lute.WalkContinue]},(r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<a href="'.concat(i,'">').concat(i,"</a>")||r.replace(/&/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<!--StartFragment--><a href="'.concat(i,'">').concat(i,"</a><!--EndFragment-->"))&&(r=""),h=new DOMParser().parseFromString(r,"text/html"),h.body&&(r=h.body.innerHTML),r=Lute.Sanitize(r),e.wysiwyg.getComments(e),d=e[e.currentMode].element.scrollHeight,S=Te(r,i,e.currentMode),T=e.currentMode==="sv"?(0,o.a1)(t.target,"data-type","code-block"):(0,o.lG)(t.target,"CODE"),T?(e.currentMode==="sv"?document.execCommand("insertHTML",!1,i.replace(/&/g,"&").replace(/</g,"<")):(R=(0,k.im)(t.target,e[e.currentMode].element),T.parentElement.tagName!=="PRE"&&(i+=E.g.ZWSP),T.textContent=T.textContent.substring(0,R.start)+i+T.textContent.substring(R.end),(0,k.$j)(R.start+i.length,R.start+i.length,T.parentElement),!((G=T.parentElement)===null||G===void 0)&&G.nextElementSibling.classList.contains("vditor-".concat(e.currentMode,"__preview"))&&(T.parentElement.nextElementSibling.innerHTML=T.outerHTML,Ee(T.parentElement.nextElementSibling,e))),[3,8]):[3,1]);case 1:return S?(n.pasteCode(S),[3,8]):[3,2];case 2:return r.trim()===""?[3,3]:(I=document.createElement("div"),I.innerHTML=r,I.querySelectorAll("[style]").forEach(function(J){J.removeAttribute("style")}),I.querySelectorAll(".vditor-copy").forEach(function(J){J.remove()}),e.currentMode==="ir"?(s.HTML2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:s}),(0,k.oC)(e.lute.HTML2VditorIRDOM(I.innerHTML),e)):e.currentMode==="wysiwyg"?(s.HTML2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:s}),(0,k.oC)(e.lute.HTML2VditorDOM(I.innerHTML),e)):(s.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:s}),Pt(e,e.lute.HTML2Md(I.innerHTML).trimRight())),e.outline.render(e),[3,8]);case 3:return a.length>0?e.options.upload.url||e.options.upload.handler?[4,jt(e,a)]:[3,5]:[3,7];case 4:return W.sent(),[3,6];case 5:O=new FileReader,"clipboardData"in t?(a=t.clipboardData.files,q=a[0]):t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items,q=a[0].getAsFile()),q&&q.type.startsWith("image")&&(O.readAsDataURL(q),O.onload=function(){var J="";e.currentMode==="wysiwyg"?J+='<img alt="'.concat(q.name,'" src="').concat(O.result.toString(),`">
|
|
127
127
|
`):J+=".concat(O.result.toString(),`)
|
|
128
|
-
`),document.execCommand("insertHTML",!1,J)}),W.label=6;case 6:return[3,8];case 7:i.trim()!==""&&a.length===0&&(H=(0,k.zh)(e),H.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(H.toString(),"](").concat(i,")")),e.currentMode==="ir"?(
|
|
128
|
+
`),document.execCommand("insertHTML",!1,J)}),W.label=6;case 6:return[3,8];case 7:i.trim()!==""&&a.length===0&&(H=(0,k.zh)(e),H.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(H.toString(),"](").concat(i,")")),e.currentMode==="ir"?(s.Md2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:s}),(0,k.oC)(e.lute.Md2VditorIRDOM(i),e)):e.currentMode==="wysiwyg"?(s.Md2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:s}),(0,k.oC)(e.lute.Md2VditorDOM(i),e)):(s.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:s}),Pt(e,i)),e.outline.render(e)),W.label=8;case 8:return e.currentMode!=="sv"&&(B=(0,o.F9)((0,k.zh)(e).startContainer),B&&(H=(0,k.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(J){J.remove()}),H.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?B.outerHTML=e.lute.SpinVditorDOM(B.outerHTML):B.outerHTML=e.lute.SpinVditorIRDOM(B.outerHTML),(0,k.ib)(e[e.currentMode].element,H)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(J){Ee(J,e)})),e.wysiwyg.triggerRemoveComment(e),ee(e),e[e.currentMode].element.scrollHeight-d>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&be(e),[2]}})})},Ln,Mn=function(e){var t,n;e.hint.render(e);var r=(0,k.zh)(e).startContainer,i=(0,o.a1)(r,"data-type","code-block-info");if(i)if(i.textContent.replace(E.g.ZWSP,"")===""&&e.hint.recentLanguage){i.textContent=E.g.ZWSP+e.hint.recentLanguage;var a=(0,k.zh)(e);a.selectNodeContents(i)}else{var s=[],u=i.textContent.substring(0,(0,k.im)(i,e.ir.element).start).replace(E.g.ZWSP,"");(e.options.preview.hljs.langs||E.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(h){h.indexOf(u.toLowerCase())>-1&&s.push({html:h,value:h})}),e.hint.genHTML(s,u,e)}},Ve=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&Mn(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.composingLock){var n=x(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)},ct=function(e,t){var n=(0,k.zh)(e),r=(0,o.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)),Fe(e,n.cloneRange()),rt(e)}},Ct=function(e,t,n){var r=(0,o.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()}},sr=function(e,t,n,r){var i=(0,k.zh)(e),a=t.getAttribute("data-type"),s=i.startContainer;s.nodeType===3&&(s=s.parentElement);var u=!0;if(t.classList.contains("vditor-menu--current"))if(a==="quote"){var h=(0,o.lG)(s,"BLOCKQUOTE");h&&(i.insertNode(document.createElement("wbr")),h.outerHTML=h.innerHTML.trim()===""?'<p data-block="0">'.concat(h.innerHTML,"</p>"):h.innerHTML)}else if(a==="link"){var d=(0,o.a1)(i.startContainer,"data-type","a");if(d){var S=(0,o.fb)(i.startContainer,"vditor-ir__link");S?(i.insertNode(document.createElement("wbr")),d.outerHTML=S.innerHTML):d.outerHTML=d.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else a==="italic"?Ct(i,e,"em"):a==="bold"?Ct(i,e,"strong"):a==="strike"?Ct(i,e,"s"):a==="inline-code"?Ct(i,e,"code"):(a==="check"||a==="list"||a==="ordered-list")&&(wt(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,k.ib)(e.ir.element,i));var T=(0,o.F9)(i.startContainer);if(a==="line"){if(T){var R=`<hr data-block="0"><p data-block="0"><wbr>
|
|
129
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 I=void 0;i.toString()===""?I="".concat(n,"<wbr>").concat(r):I="".concat(n).concat(i.toString()).concat(r.replace(")","<wbr>)")),document.execCommand("insertHTML",!1,I),u=!1,t.classList.add("vditor-menu--current")}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"){var I=void 0;i.toString()===""?I="".concat(n,"<wbr>").concat(r):(a==="code"?I="".concat(n,`
|
|
130
130
|
`).concat(i.toString(),"<wbr>").concat(r):a==="table"?I="".concat(n).concat(i.toString(),"<wbr>").concat(r):I="".concat(n).concat(i.toString()).concat(r,"<wbr>"),i.deleteContents()),(a==="table"||a==="code")&&(I=`
|
|
131
131
|
`+I+`
|
|
132
132
|
|
|
133
|
-
`);var O=document.createElement("span");O.innerHTML=I,i.insertNode(O),Fe(e,i),a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,k.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(wt(e,i,a,!1),u=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,k.ib)(e.ir.element,i),Ve(e),u&&rt(e)},lr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(
|
|
134
|
-
`).concat(R===0?"class='vditor-hint--current'":"","> ").concat(I,"</button>")}}),this.element.innerHTML=d;var S=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(h+(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(h-this.element.offsetHeight,"px")),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")},e.prototype.select=function(t,n){if(this.element.querySelectorAll("button").length===0||this.element.style.display==="none")return!1;var r=this.element.querySelector(".vditor-hint--current");if(t.key==="ArrowDown")return t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.nextElementSibling?r.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.previousElementSibling)r.previousElementSibling.className="vditor-hint--current";else{var i=this.element.children.length;this.element.children[i-1].className="vditor-hint--current"}return!0}else if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"&&!t.isComposing)return t.preventDefault(),t.stopPropagation(),this.fillEmoji(r,n),!0;return!1},e.prototype.getKey=function(t,n){var r=this;this.lastIndex=-1,this.splitChar="",n.forEach(function(d){var S=t.lastIndexOf(d.key);r.lastIndex<S&&(r.splitChar=d.key,r.lastIndex=S)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),
|
|
135
|
-
contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),xt(t,this.element),en(t,this.element),Dt(t,this.element),Rt(t,this.element),It(t,this.element),Ht(t,this.element),Ot(t,this.element,this.copy),Nt(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){St(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)()||Fe(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,Ve(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||Fe(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,Ve(t);return}var i=(0,k.zh)(t),a=(0,
|
|
133
|
+
`);var O=document.createElement("span");O.innerHTML=I,i.insertNode(O),Fe(e,i),a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,k.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(wt(e,i,a,!1),u=!1,y(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,k.ib)(e.ir.element,i),Ve(e),u&&rt(e)},lr=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function u(S){try{d(r.next(S))}catch(T){s(T)}}function h(S){try{d(r.throw(S))}catch(T){s(T)}}function d(S){S.done?a(S.value):i(S.value).then(u,h)}d((r=r.apply(e,t||[])).next())})},cr=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(d){return function(S){return h([d,S])}}function h(d){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,d[0]&&(n=0)),n;)try{if(r=1,i&&(a=d[0]&2?i.return:d[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,d[1])).done)return a;switch(i=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]<a[3])){n.label=d[1];break}if(d[0]===6&&n.label<a[1]){n.label=a[1],a=d;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(d);break}a[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(S){d=[6,S],i=0}finally{r=a=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},ur=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")),s=window.getSelection().getRangeAt(0);if(i.currentMode==="ir"){var u=(0,o.a1)(s.startContainer,"data-type","code-block-info");if(u){u.textContent=E.g.ZWSP+a.trimRight(),s.selectNodeContents(u),s.collapse(!1),Ve(i),u.parentElement.querySelectorAll("code").forEach(function(T){T.className="language-"+a.trimRight()}),Ee(u.parentElement.querySelector(".vditor-ir__preview"),i),n.recentLanguage=a.trimRight();return}}if(i.currentMode==="wysiwyg"&&s.startContainer.nodeType!==3){var h=s.startContainer,d=void 0;if(h.classList.contains("vditor-input")?d=h:d=h.firstElementChild,d&&d.classList.contains("vditor-input")){d.value=a.trimRight(),s.selectNodeContents(d),s.collapse(!1),d.dispatchEvent(new CustomEvent("input",{detail:1})),n.recentLanguage=a.trimRight();return}}if(s.setStart(s.startContainer,n.lastIndex),s.deleteContents(),i.options.hint.parse?i.currentMode==="sv"?(0,k.oC)(i.lute.SpinVditorSVDOM(a),i):i.currentMode==="wysiwyg"?(0,k.oC)(i.lute.SpinVditorDOM(a),i):(0,k.oC)(i.lute.SpinVditorIRDOM(a),i):(0,k.oC)(a,i),n.splitChar===":"&&a.indexOf(":")>-1&&i.currentMode!=="sv"&&s.insertNode(document.createTextNode(" ")),s.collapse(!1),(0,k.Hc)(s),i.currentMode==="wysiwyg"){var S=(0,o.fb)(s.startContainer,"vditor-wysiwyg__block");S&&S.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(S.lastElementChild.innerHTML=S.firstElementChild.innerHTML,Ee(S.lastElementChild,i))}else if(i.currentMode==="ir"){var S=(0,o.fb)(s.startContainer,"vditor-ir__marker--pre");S&&S.nextElementSibling.classList.contains("vditor-ir__preview")&&(S.nextElementSibling.innerHTML=S.innerHTML,Ee(S.nextElementSibling,i))}ee(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 s=a===""?t.options.hint.emoji:t.lute.GetEmojis(),u=[];Object.keys(s).forEach(function(h){h.indexOf(a.toLowerCase())===0&&(s[h].indexOf(".")>-1?u.push({html:'<img src="'.concat(s[h],'" title=":').concat(h,':"/> :').concat(h,":"),value:":".concat(h,":")}):u.push({html:'<span class="vditor-hint__emoji">'.concat(s[h],"</span>").concat(h),value:s[h]}))}),this.genHTML(u,a,t)}else t.options.hint.extend.forEach(function(h){h.key===n.splitChar&&(clearTimeout(n.timeId),n.timeId=window.setTimeout(function(){return lr(n,void 0,void 0,function(){var d;return cr(this,function(S){switch(S.label){case 0:return d=this.genHTML,[4,h.hint(a)];case 1:return d.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,s=(0,k.Ny)(a),u=s.left+(r.options.outline.position==="left"?r.outline.element.offsetWidth:0),h=s.top,d="";t.forEach(function(T,R){if(!(R>7)){var I=T.html;if(n!==""){var O=I.lastIndexOf(">")+1,q=I.substr(O),B=q.toLowerCase().indexOf(n.toLowerCase());B>-1&&(q=q.substring(0,B)+"<b>"+q.substring(B,B+n.length)+"</b>"+q.substring(B+n.length),I=I.substr(0,O)+q)}d+='<button type="button" data-value="'.concat(encodeURIComponent(T.value),` "
|
|
134
|
+
`).concat(R===0?"class='vditor-hint--current'":"","> ").concat(I,"</button>")}}),this.element.innerHTML=d;var S=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(h+(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(h-this.element.offsetHeight,"px")),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")},e.prototype.select=function(t,n){if(this.element.querySelectorAll("button").length===0||this.element.style.display==="none")return!1;var r=this.element.querySelector(".vditor-hint--current");if(t.key==="ArrowDown")return t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.nextElementSibling?r.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.previousElementSibling)r.previousElementSibling.className="vditor-hint--current";else{var i=this.element.children.length;this.element.children[i-1].className="vditor-hint--current"}return!0}else if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"&&!t.isComposing)return t.preventDefault(),t.stopPropagation(),this.fillEmoji(r,n),!0;return!1},e.prototype.getKey=function(t,n){var r=this;this.lastIndex=-1,this.splitChar="",n.forEach(function(d){var S=t.lastIndexOf(d.key);r.lastIndex<S&&(r.splitChar=d.key,r.lastIndex=S)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),s=a[a.length-1],u=32;if(a.length>1&&s.trim()===s)if(a.length===2&&a[0]===""&&a[1].length<u)i=a[1];else{var h=a[a.length-2].slice(-1);(0,L.X)(h)===" "&&s.length<u&&(i=s)}return i},e}(),fr=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),xt(t,this.element),en(t,this.element),Dt(t,this.element),Rt(t,this.element),It(t,this.element),Ht(t,this.element),Ot(t,this.element,this.copy),Nt(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){St(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)()||Fe(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,Ve(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||Fe(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,Ve(t);return}var i=(0,k.zh)(t),a=(0,o.fb)(r.target,"vditor-ir__preview");if(a||(a=(0,o.fb)(i.startContainer,"vditor-ir__preview")),a&&(a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!0),(0,k.Hc)(i),be(t)),r.target.tagName==="IMG"){var s=r.target.parentElement.querySelector(".vditor-ir__marker--link");s&&(i.selectNode(s),(0,k.Hc)(i))}var u=(0,o.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 h=n.element.lastElementChild.getBoundingClientRect();r.y>h.top+h.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(E.g.ZWSP,"")===""?(i.selectNodeContents(n.element.lastElementChild),i.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(n.element,i)))}i.toString()===""?j(i,t):setTimeout(function(){j((0,k.zh)(t),t)}),pt(r,t),rt(t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if(r.key==="Enter"&&be(t),rt(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
136
|
`)){t.ir.element.innerHTML="";return}var i=(0,k.zh)(t);r.key==="Backspace"?((0,l.vU)()&&i.startContainer.textContent===`
|
|
137
|
-
`&&i.startOffset===1&&(i.startContainer.textContent="",j(i,t)),n.element.querySelectorAll(".language-math").forEach(function(
|
|
138
|
-
<div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,Tn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Tn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=E.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var o=getSelection().getRangeAt(0);t[t.currentMode].element.contains(o.startContainer)&&(0,k.Hc)(o)}Ne(t)},e}(),hr=Y(280),mr=function(){function e(t){var n=this;this.element=document.createElement("div"),this.element.className="vditor-preview",this.previewElement=document.createElement("div"),this.previewElement.className="vditor-reset",t.options.classes.preview&&this.previewElement.classList.add(t.options.classes.preview),this.previewElement.style.maxWidth=t.options.preview.maxWidth+"px",this.previewElement.addEventListener("copy",function(h){if(h.target.tagName!=="TEXTAREA"){var d=document.createElement("div");d.className="vditor-reset",d.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,d,"default"),h.preventDefault()}}),this.previewElement.addEventListener("click",function(h){var d=(0,s.lG)(h.target,"SPAN");if(d&&(0,s.fb)(d,"vditor-toc")){var S=n.previewElement.querySelector("#"+d.getAttribute("data-target-id"));S&&(n.element.scrollTop=S.offsetTop);return}if(h.target.tagName==="A"){t.options.link.click?t.options.link.click(h.target):t.options.link.isOpen&&window.open(h.target.getAttribute("href")),h.preventDefault();return}h.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(h.target):t.options.image.isPreview&&(0,K.E)(h.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],o=0;o<r.length;o++){var u=r[o];if(typeof u=="object"){a.push('<button type="button" data-type="'.concat(u.key,'" class="').concat(u.className,'"').concat(u.tooltip?' aria-label="'.concat(u.tooltip,'"'):"",'">').concat(u.text,"</button>"));continue}switch(u){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":a.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>');break}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(h){var d=(0,C.S)(h.target,"BUTTON");if(d){var S=d.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")}),d.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n;return}if(x(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=x(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var o=new XMLHttpRequest;o.open("POST",t.options.preview.url),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(o.status===200){var h=JSON.parse(o.responseText);if(h.code!==0){t.tip.show(h.msg);return}t.options.preview.transform&&(h.data=t.options.preview.transform(h.data)),r.previewElement.innerHTML=h.data,r.afterRender(t,i)}else{var d=t.lute.Md2HTML(a);t.options.preview.transform&&(d=t.options.preview.transform(d)),r.previewElement.innerHTML=d,r.afterRender(t,i)}},o.send(JSON.stringify({markdownText:a}))}else{var u=t.lute.Md2HTML(a);t.options.preview.transform&&(u=t.options.preview.transform(u)),r.previewElement.innerHTML=u,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.toString())),t.preview.element.setAttribute("data-type","renderPerformance")):t.preview.element.getAttribute("data-type")==="renderPerformance"&&(t.tip.hide(),t.preview.element.removeAttribute("data-type"));var i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,P.O)(t.preview.previewElement,t.options.preview.hljs),(0,$.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,oe.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,me.K)(t.preview.previewElement,t.options.cdn),(0,we.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,V.P)(t.preview.previewElement,t.options.cdn),(0,z.v)(t.preview.previewElement,t.options.cdn),(0,M.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,fe.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,le.B)(t.preview.previewElement,t.options.cdn),(0,D.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,hr.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(u){u.render(t.preview.previewElement,t)});var a=t.preview.element,o=t.outline.render(t);o===""&&(o="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(u){u.innerHTML=o,(0,ne.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ne.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,k.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e}(),gr=function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--".concat(t.options.resize.position),this.element.innerHTML='<div><svg><use xlink:href="#vditor-icon-resize"></use></svg></div>',this.bindEvent(t)}return e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("mousedown",function(r){var i=document,a=r.clientY,o=t.element.offsetHeight,u=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(h){t.options.resize.position==="top"?t.element.style.height=Math.max(u,o+(a-h.clientY))+"px":t.element.style.height=Math.max(u,o+(h.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),i.onmousemove=null,i.onmouseup=null,i.ondragstart=null,i.onselectstart=null,i.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e}(),yr=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),xt(t,this.element),Dt(t,this.element),Rt(t,this.element),It(t,this.element),Ht(t,this.element),Ot(t,this.element,this.copy),Nt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",ot(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){St(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var r=n.element.scrollTop,i=n.element.clientHeight,a=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),o=t.preview.element;r/i>.5?o.scrollTop=(r+i)*o.scrollHeight/a-i:o.scrollTop=r*o.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||ie(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Ee(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}ie(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.key==="Delete")&&t.sv.element.innerHTML!==""&&t.sv.element.childNodes.length===1&&t.sv.element.firstElementChild&&t.sv.element.firstElementChild.tagName==="DIV"&&t.sv.element.firstElementChild.childElementCount===2&&(t.sv.element.firstElementChild.textContent===""||t.sv.element.textContent===`
|
|
139
|
-
`)){t.sv.element.innerHTML="";return}r.key==="Enter"&&
|
|
140
|
-
<div class="vditor-tip__close">X</div></div>`),this.element.querySelector(".vditor-tip__close").addEventListener("click",function(){r.hide()})):(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,"</div>"),setTimeout(function(){r.hide()},n)),this.element.removeAttribute("style"),setTimeout(function(){var i=r.element.getBoundingClientRect();i.top<46&&(r.element.style.position="fixed",r.element.style.top="46px")},150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e}(),Ft=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",y(t.toolbar.elements,["both"]);break}t.devtools&&t.devtools.renderEchart(t)}},br=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),wr=function(e){br(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
|
|
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}(),kr=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)}}(),Tr=function(e){kr(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(E.g.CLASS_MENU_DISABLED)&&r.click(a,n)}),i}return t}(
|
|
142
|
-
data-value=":`).concat(u,': " data-key=":').concat(u,':" class="vditor-emojis__icon" src="').concat(h,'"/></button>'):
|
|
143
|
-
data-key="`).concat(u,'"><span class="vditor-emojis__icon">').concat(h,"</span></button>")}),a.innerHTML='<div class="vditor-emojis" style="max-height: '.concat(n.options.height==="auto"?"auto":n.options.height-80,'px">').concat(
|
|
137
|
+
`&&i.startOffset===1&&(i.startContainer.textContent="",j(i,t)),n.element.querySelectorAll(".language-math").forEach(function(s){var u=s.querySelector("br");u&&u.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&Mn(t),j(i,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&j(i,t);var a=(0,o.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",E.g.ZWSP),i.setStart(a.parentElement.nextSibling,1)):i.selectNodeContents(a.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}})},e}(),kn=function(e){if(e.currentMode==="sv")return e.lute.Md2HTML(x(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)},dr=Y(214),Tn=Y(436),pr=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,Tn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Tn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=E.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var s=getSelection().getRangeAt(0);t[t.currentMode].element.contains(s.startContainer)&&(0,k.Hc)(s)}Ne(t)},e}(),hr=Y(280),mr=function(){function e(t){var n=this;this.element=document.createElement("div"),this.element.className="vditor-preview",this.previewElement=document.createElement("div"),this.previewElement.className="vditor-reset",t.options.classes.preview&&this.previewElement.classList.add(t.options.classes.preview),this.previewElement.style.maxWidth=t.options.preview.maxWidth+"px",this.previewElement.addEventListener("copy",function(h){if(h.target.tagName!=="TEXTAREA"){var d=document.createElement("div");d.className="vditor-reset",d.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,d,"default"),h.preventDefault()}}),this.previewElement.addEventListener("click",function(h){var d=(0,o.lG)(h.target,"SPAN");if(d&&(0,o.fb)(d,"vditor-toc")){var S=n.previewElement.querySelector("#"+d.getAttribute("data-target-id"));S&&(n.element.scrollTop=S.offsetTop);return}if(h.target.tagName==="A"){t.options.link.click?t.options.link.click(h.target):t.options.link.isOpen&&window.open(h.target.getAttribute("href")),h.preventDefault();return}h.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(h.target):t.options.image.isPreview&&(0,K.E)(h.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],s=0;s<r.length;s++){var u=r[s];if(typeof u=="object"){a.push('<button type="button" data-type="'.concat(u.key,'" class="').concat(u.className,'"').concat(u.tooltip?' aria-label="'.concat(u.tooltip,'"'):"",'">').concat(u.text,"</button>"));continue}switch(u){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":a.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>');break}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(h){var d=(0,C.S)(h.target,"BUTTON");if(d){var S=d.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")}),d.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n;return}if(x(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=x(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var s=new XMLHttpRequest;s.open("POST",t.options.preview.url),s.setRequestHeader("Content-Type","application/json;charset=UTF-8"),s.onreadystatechange=function(){if(s.readyState===XMLHttpRequest.DONE)if(s.status===200){var h=JSON.parse(s.responseText);if(h.code!==0){t.tip.show(h.msg);return}t.options.preview.transform&&(h.data=t.options.preview.transform(h.data)),r.previewElement.innerHTML=h.data,r.afterRender(t,i)}else{var d=t.lute.Md2HTML(a);t.options.preview.transform&&(d=t.options.preview.transform(d)),r.previewElement.innerHTML=d,r.afterRender(t,i)}},s.send(JSON.stringify({markdownText:a}))}else{var u=t.lute.Md2HTML(a);t.options.preview.transform&&(u=t.options.preview.transform(u)),r.previewElement.innerHTML=u,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.toString())),t.preview.element.setAttribute("data-type","renderPerformance")):t.preview.element.getAttribute("data-type")==="renderPerformance"&&(t.tip.hide(),t.preview.element.removeAttribute("data-type"));var i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,P.O)(t.preview.previewElement,t.options.preview.hljs),(0,$.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,oe.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ge.K)(t.preview.previewElement,t.options.cdn),(0,ve.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,V.P)(t.preview.previewElement,t.options.cdn),(0,z.v)(t.preview.previewElement,t.options.cdn),(0,M.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,le.B)(t.preview.previewElement,t.options.cdn),(0,D.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,hr.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(u){u.render(t.preview.previewElement,t)});var a=t.preview.element,s=t.outline.render(t);s===""&&(s="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(u){u.innerHTML=s,(0,ne.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ne.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,k.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e}(),gr=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,s=t.element.offsetHeight,u=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(h){t.options.resize.position==="top"?t.element.style.height=Math.max(u,s+(a-h.clientY))+"px":t.element.style.height=Math.max(u,s+(h.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-s),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}(),yr=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),xt(t,this.element),Dt(t,this.element),Rt(t,this.element),It(t,this.element),Ht(t,this.element),Ot(t,this.element,this.copy),Nt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",ot(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){St(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"),s=t.preview.element;r/i>.5?s.scrollTop=(r+i)*s.scrollHeight/a-i:s.scrollTop=r*s.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||ie(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Se(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}ie(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.key==="Delete")&&t.sv.element.innerHTML!==""&&t.sv.element.childNodes.length===1&&t.sv.element.firstElementChild&&t.sv.element.firstElementChild.tagName==="DIV"&&t.sv.element.firstElementChild.childElementCount===2&&(t.sv.element.firstElementChild.textContent===""||t.sv.element.textContent===`
|
|
139
|
+
`)){t.sv.element.innerHTML="";return}r.key==="Enter"&&be(t)}})},e}(),_n=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}(),Ft=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",y(t.toolbar.elements,["both"]);break}t.devtools&&t.devtools.renderEchart(t)}},br=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),wr=function(e){br(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 s=i.element.firstElementChild;s.classList.contains(E.g.CLASS_MENU_DISABLED)||(a.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Ft("editor",n):Ft("both",n)))}),i}return t}(me),vr=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"}return e}(),An=Y(580),Er=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)}}(),Sr=function(e){Er(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],s=document.createElement("div");s.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return E.g.CODE_THEME.forEach(function(h){u+="<button>".concat(h,"</button>")}),s.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),s.addEventListener((0,l.Le)(),function(h){h.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.hljs.style=h.target.textContent,(0,An.Y)(h.target.textContent,n.options.cdn),h.preventDefault(),h.stopPropagation())}),i.element.appendChild(s),g(n,s,a,r.level),i}return t}(me),Cr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Lr=function(e){Cr(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],s=document.createElement("div");s.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return Object.keys(n.options.preview.theme.list).forEach(function(h){u+='<button data-type="'.concat(h,'">').concat(n.options.preview.theme.list[h],"</button>")}),s.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),s.addEventListener((0,l.Le)(),function(h){h.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.theme.current=h.target.getAttribute("data-type"),(0,X.Z)(n.options.preview.theme.current,n.options.preview.theme.path),h.preventDefault(),h.stopPropagation())}),i.element.appendChild(s),g(n,s,a,r.level),i}return t}(me),Mr=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}(),kr=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)}}(),Tr=function(e){kr(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(E.g.CLASS_MENU_DISABLED)&&r.click(a,n)}),i}return t}(me),_r=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ar=function(e){_r(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 s=i.element.firstElementChild;s.classList.contains(E.g.CLASS_MENU_DISABLED)||(a.preventDefault(),s.classList.contains("vditor-menu--current")?(s.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",Ne(n)):(s.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",Ne(n),n.devtools.renderEchart(n)))}),i}return t}(me),xr=function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"}return e}(),Dr=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)}}(),Hr=function(e){Dr(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 s="";return Object.keys(n.options.hint.emoji).forEach(function(u){var h=n.options.hint.emoji[u];h.indexOf(".")>-1?s+='<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(h,'"/></button>'):s+='<button data-value="'.concat(h,` "
|
|
143
|
+
data-key="`).concat(u,'"><span class="vditor-emojis__icon">').concat(h,"</span></button>")}),a.innerHTML='<div class="vditor-emojis" style="max-height: '.concat(n.options.height==="auto"?"auto":n.options.height-80,'px">').concat(s,`</div><div class="vditor-emojis__tail">
|
|
144
144
|
<span class="vditor-emojis__tip"></span><span>`).concat(n.options.hint.emojiTail||"",`</span>
|
|
145
|
-
</div>`),i.element.appendChild(a),g(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,C.S)(i.target,"BUTTON");if(a){i.preventDefault();var
|
|
145
|
+
</div>`),i.element.appendChild(a),g(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,C.S)(i.target,"BUTTON");if(a){i.preventDefault();var s=a.getAttribute("data-value"),u=(0,k.zh)(n),h=s;if(n.currentMode==="wysiwyg"?h=n.lute.SpinVditorDOM(s):n.currentMode==="ir"&&(h=n.lute.SpinVditorIRDOM(s)),s.indexOf(":")>-1&&n.currentMode!=="sv"){var d=document.createElement("div");d.innerHTML=h,h=d.firstElementChild.firstElementChild.outerHTML+" ",(0,k.oC)(h,n)}else u.extractContents(),u.insertNode(document.createTextNode(s)),(0,o.F9)(u.startContainer)||Tt(n,u);u.collapse(!1),(0,k.Hc)(u),r.element.lastElementChild.style.display="none",ee(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(i){var a=(0,C.S)(i.target,"BUTTON");a&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=a.getAttribute("data-key"))})},t}(me),xn=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)},Or=function(e){var t=x(e);xn(e,t,t.substr(0,10)+".md")},Nr=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
146
|
<script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script>
|
|
147
147
|
<div id="preview" style="width: 800px"></div>
|
|
148
148
|
<script>
|
|
@@ -187,14 +187,14 @@ window.addEventListener("message", (e) => {
|
|
|
187
187
|
`).concat(e.options.preview.render.media.enable?"Vditor.mediaRender(previewElement);":"",`
|
|
188
188
|
Vditor.speechRender(previewElement);
|
|
189
189
|
<\/script>
|
|
190
|
-
<script src="`).concat(e.options.cdn,"/dist/js/icons/").concat(e.options.icon,'.js"><\/script></body></html>');xn(e,n,t.substr(0,10)+".html")},Ir=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)}}(),Pr=function(e){Ir(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],
|
|
190
|
+
<script src="`).concat(e.options.cdn,"/dist/js/icons/").concat(e.options.icon,'.js"><\/script></body></html>');xn(e,n,t.substr(0,10)+".html")},Ir=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)}}(),Pr=function(e){Ir(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],s=document.createElement("div");return s.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),s.innerHTML=`<button data-type="markdown">Markdown</button>
|
|
191
191
|
<button data-type="pdf">PDF</button>
|
|
192
|
-
<button data-type="html">HTML</button>`,
|
|
192
|
+
<button data-type="html">HTML</button>`,s.addEventListener((0,l.Le)(),function(u){var h=u.target;if(h.tagName==="BUTTON"){switch(h.getAttribute("data-type")){case"markdown":Or(n);break;case"pdf":Nr(n);break;case"html":Rr(n);break}b(n,["subToolbar"]),u.preventDefault(),u.stopPropagation()}}),i.element.appendChild(s),g(n,s,a,r.level),i}return t}(me),jr=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)}}(),Br=function(e){jr(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 s=n.toolbar.elements[a].firstChild;s&&(s.className=s.className.replace("__s","__n"),n.options.toolbar.forEach(function(u){typeof u!="string"&&u.tipPosition&&u.name===s.dataset.type&&(s.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 s=n.toolbar.elements[a].firstChild;s&&(s.className=s.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),Ne(n),mt(n)})},t}(me),Ur=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)}}(),Vr=function(e){Ur(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint vditor-panel--arrow",a.innerHTML='<button data-tag="h1" data-value="# ">'.concat(window.VditorI18n.heading1," ").concat((0,l.ns)("<⌥⌘1>"),`</button>
|
|
193
193
|
<button data-tag="h2" data-value="## ">`).concat(window.VditorI18n.heading2," <").concat((0,l.ns)("⌥⌘2"),`></button>
|
|
194
194
|
<button data-tag="h3" data-value="### ">`).concat(window.VditorI18n.heading3," <").concat((0,l.ns)("⌥⌘3"),`></button>
|
|
195
195
|
<button data-tag="h4" data-value="#### ">`).concat(window.VditorI18n.heading4," <").concat((0,l.ns)("⌥⌘4"),`></button>
|
|
196
196
|
<button data-tag="h5" data-value="##### ">`).concat(window.VditorI18n.heading5," <").concat((0,l.ns)("⌥⌘5"),`></button>
|
|
197
|
-
<button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," <").concat((0,l.ns)("⌥⌘6"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a),i}return t.prototype._bindEvent=function(n,r){var i=this.element.children[0];i.addEventListener((0,l.Le)(),function(
|
|
197
|
+
<button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," <").concat((0,l.ns)("⌥⌘6"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a),i}return t.prototype._bindEvent=function(n,r){var i=this.element.children[0];i.addEventListener((0,l.Le)(),function(s){s.preventDefault(),clearTimeout(n.wysiwyg.afterRenderTimeoutId),clearTimeout(n.ir.processTimeoutId),clearTimeout(n.sv.processTimeoutId),!i.classList.contains(E.g.CLASS_MENU_DISABLED)&&(i.blur(),i.classList.contains("vditor-menu--current")?(n.currentMode==="wysiwyg"?(_t(n),ce(n)):n.currentMode==="ir"&&ct(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(s){s.preventDefault(),n.currentMode==="wysiwyg"?(gt(n,s.target.getAttribute("data-tag")),ce(n),i.classList.add("vditor-menu--current")):n.currentMode==="ir"?(ct(n,s.target.getAttribute("data-value")),i.classList.add("vditor-menu--current")):nn(n,s.target.getAttribute("data-value")),r.style.display="none"})},t}(me),Wr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fr=function(e){Wr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].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
198
|
<div style="margin-top: 14px;flex: 1">
|
|
199
199
|
<div>Markdown 使用指南</div>
|
|
200
200
|
<ul style="list-style: none">
|
|
@@ -212,7 +212,7 @@ window.addEventListener("message", (e) => {
|
|
|
212
212
|
<li><a href="https://ld246.com/article/1549638745630" target="_blank">开发手册</a></li>
|
|
213
213
|
<li><a href="https://ld246.com/guide/markdown" target="_blank">演示地址</a></li>
|
|
214
214
|
</ul>
|
|
215
|
-
</div></div>`,0)}),i}return t}(
|
|
215
|
+
</div></div>`,0)}),i}return t}(me),qr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Kr=function(e){qr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var s=(0,k.zh)(n),u=(0,o.lG)(s.startContainer,"LI");u&&un(n,u,s)}}),i}return t}(me),zr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gr=function(e){zr(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
216
|
<p style="text-align: center;margin: 14px 0">
|
|
217
217
|
<em>下一代的 Markdown 编辑器,为未来而构建</em>
|
|
218
218
|
</p>
|
|
@@ -242,20 +242,20 @@ window.addEventListener("message", (e) => {
|
|
|
242
242
|
</li>
|
|
243
243
|
</ul>
|
|
244
244
|
</div>
|
|
245
|
-
</div>`),0)}),i}return t}(he),Zr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Jr=function(e){Zr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&st(n,"afterend")}),i}return t}(he),Xr=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)}}(),Yr=function(e){Xr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&st(n,"beforebegin")}),i}return t}(he),Qr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),$r=function(e){Qr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,k.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&Bt(n,u,o,u.parentElement)}}),i}return t}(he),ei=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ti=function(e){ei(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var o=n.toolbar.elements.outline.firstElementChild;o.classList.contains(E.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t}(he),ni=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ri=function(e){ni(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=E.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.classList.remove("vditor-menu--current"),n.currentMode==="sv"?(n.sv.element.style.display="block",n.options.preview.mode==="both"?n.preview.element.style.display="block":n.preview.element.style.display="none"):(n[n.currentMode].element.parentElement.style.display="block",n.preview.element.style.display="none"),m(n.toolbar.elements,o),n.outline.render(n)):(f(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)),Ne(n)}})},t}(he),ii=function(){function e(t){this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0;var n;if(typeof AudioContext<"u")n=new AudioContext;else if(webkitAudioContext)n=new webkitAudioContext;else return;this.DEFAULT_SAMPLE_RATE=n.sampleRate;var r=n.createGain(),i=n.createMediaStreamSource(t);i.connect(r),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,r.connect(this.recorder),this.recorder.connect(n.destination),this.readyFlag=!0}return e.prototype.cloneChannelData=function(t,n){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(n)),this.recordingLength+=2048},e.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},e.prototype.stopRecording=function(){this.isRecording=!1},e.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),n=this.mergeBuffers(this.rightChannel),r=new Float32Array(t.length),i=0;i<t.length;++i)r[i]=.5*(t[i]+n[i]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(r=this.downSampleBuffer(r,this.SAMPLE_RATE));var a=44+r.length*2,o=new ArrayBuffer(a),u=new DataView(o);this.writeUTFBytes(u,0,"RIFF"),u.setUint32(4,a,!0),this.writeUTFBytes(u,8,"WAVE"),this.writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,this.SAMPLE_RATE,!0),u.setUint32(28,this.SAMPLE_RATE*2,!0),u.setUint16(32,2,!0),u.setUint16(34,16,!0);var h=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,h,!0);for(var d=r.length,S=44,T=1,R=0;R<d;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 h=Math.round((o+1)*r),d=0,S=0,T=u;T<h&&T<t.length;T++)d+=t[T],S++;a[o]=d/S,o++,u=h}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var o=t[a];n.set(o,r),r+=o.length}return n},e.prototype.writeUTFBytes=function(t,n,r){for(var i=r.length,a=0;a<i;a++)t.setUint8(n+a,r.charCodeAt(a))},e}(),ai=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)}}(),oi=function(e){ai(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(h){i=new ii(h),i.recorder.onaudioprocess=function(d){if(i.isRecording){var S=d.inputBuffer.getChannelData(0),T=d.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"});jt(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}(he),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)}}(),li=function(e){si(t,e);function t(n,r){var i=e.call(this,n,r)||this;return f({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t}(he),ci=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ui=function(e){ci(t,e);function t(n,r){var i=e.call(this,n,r)||this;return f({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t}(he),fi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),di=function(e){fi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&jt(n,i.target.files,i.target)})},t}(he),pi=function(){function e(t){var n=this,r=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",r.toolbar.forEach(function(i,a){var o=n.genItem(t,i,a);if(n.element.appendChild(o),i.toolbar){var u=document.createElement("div");u.className="vditor-hint vditor-panel--arrow",u.addEventListener((0,l.Le)(),function(h){u.style.display="none"}),i.toolbar.forEach(function(h,d){h.level=2,u.appendChild(n.genItem(t,h,a+d))}),o.appendChild(u),g(t,u,o.children[0])}}),t.options.toolbarConfig.hide&&this.element.classList.add("vditor-toolbar--hide"),t.options.toolbarConfig.pin&&this.element.classList.add("vditor-toolbar--pin"),t.options.counter.enable&&(t.counter=new Mr(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 he(t,n);break;case"emoji":i=new Hr(t,n);break;case"headings":i=new Vr(t,n);break;case"|":i=new xr;break;case"br":i=new vr;break;case"undo":i=new ui(t,n);break;case"redo":i=new li(t,n);break;case"help":i=new Fr(t,n);break;case"both":i=new wr(t,n);break;case"preview":i=new ri(t,n);break;case"fullscreen":i=new Br(t,n);break;case"upload":i=new di(t,n);break;case"record":i=new oi(t,n);break;case"info":i=new Gr(t,n);break;case"edit-mode":i=new Zn(t,n);break;case"devtools":i=new Ar(t,n);break;case"outdent":i=new $r(t,n);break;case"indent":i=new Kr(t,n);break;case"outline":i=new ti(t,n);break;case"insert-after":i=new Jr(t,n);break;case"insert-before":i=new Yr(t,n);break;case"code-theme":i=new Sr(t,n);break;case"content-theme":i=new Lr(t,n);break;case"export":i=new Pr(t,n);break;default:i=new Tr(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e}(),hi=Y(173),mi=function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new hi}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?m(t.toolbar.elements,["undo"]):f(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?m(t.toolbar.elements,["redo"]):f(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,f(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&m(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(u){u.diffs.forEach(function(h){h[0]=-h[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(u){u.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?u.parentElement.outerHTML=n.lute.SpinVditorIRDOM(u.parentElement.outerHTML):u.parentElement.outerHTML=n.lute.SpinVditorDOM(u.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){ve(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,k.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),ye(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}je(n),ee(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),Ye(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){ve(u,n)}),this[n.currentMode].undoStack.length>1?m(n.toolbar.elements,["undo"]):f(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?m(n.toolbar.elements,["redo"]):f(n.toolbar.elements,["redo"])},e.prototype.resetStack=function(){this.ir={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.sv={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.wysiwyg={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]}},e.prototype.addCaret=function(t,n){n===void 0&&(n=!1);var r;if(getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var i=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(i.startContainer)){r=i.cloneRange();var a=document.createElement("span");a.className="vditor-wbr",i.insertNode(a)}}var o=t[t.currentMode].element.cloneNode(!0);o.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(h){h.firstElementChild&&(h.firstElementChild.classList.contains("language-echarts")||h.firstElementChild.classList.contains("language-plantuml")||h.firstElementChild.classList.contains("language-mindmap")?(h.firstElementChild.removeAttribute("_echarts_instance_"),h.firstElementChild.removeAttribute("data-processed"),h.firstElementChild.innerHTML=h.previousElementSibling.firstElementChild.innerHTML,h.setAttribute("data-render","2")):h.firstElementChild.classList.contains("language-math")&&(h.setAttribute("data-render","2"),h.firstElementChild.textContent=h.firstElementChild.getAttribute("data-math"),h.firstElementChild.removeAttribute("data-math")))});var u=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(h){h.remove()}),n&&r&&(0,k.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e}(),gi=Y(673),yi=function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:E.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},customRenders:[],debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(E.g.CDN,"/dist/images/emoji"),extend:[],parse:!0},icon:"ant",lang:"zh_CN",mode:"ir",outline:{enable:!1,position:"left"},placeholder:"",preview:{actions:["desktop","tablet","mobile","mp-wechat","zhihu"],delay:1e3,hljs:E.g.HLJS_OPTIONS,markdown:E.g.MARKDOWN_OPTIONS,math:E.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:E.g.THEME_OPTIONS,render:{media:{enable:!0}}},link:{isOpen:!0},image:{isPreview:!0},resize:{enable:!1,position:"bottom"},theme:"classic",toolbar:["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|","upload","record","table","|","undo","redo","|","fullscreen","edit-mode",{name:"more",toolbar:["both","code-theme","content-theme","export","outline","preview","devtools","info","help"]}],toolbarConfig:{hide:!1,pin:!1},typewriterMode:!1,undoDelay:800,upload:{extraData:{},fieldName:"file[]",filename:function(n){return n.replace(/\W/g,"")},linkToImgUrl:"",max:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,o,u,h,d;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),!((n=(t=this.options.preview)===null||t===void 0?void 0:t.theme)===null||n===void 0)&&n.list&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((o=this.options.hint)===null||o===void 0)&&o.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((h=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||h===void 0)&&h.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((d=this.options.hint)===null||d===void 0)&&d.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var S=(0,gi.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 |
|
|
245
|
+
</div>`),0)}),i}return t}(me),Zr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Jr=function(e){Zr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&st(n,"afterend")}),i}return t}(me),Xr=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)}}(),Yr=function(e){Xr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&st(n,"beforebegin")}),i}return t}(me),Qr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),$r=function(e){Qr(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var s=(0,k.zh)(n),u=(0,o.lG)(s.startContainer,"LI");u&&Bt(n,u,s,u.parentElement)}}),i}return t}(me),ei=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ti=function(e){ei(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var s=n.toolbar.elements.outline.firstElementChild;s.classList.contains(E.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t}(me),ni=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ri=function(e){ni(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(E.g.CLASS_MENU_DISABLED)){var s=E.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.classList.remove("vditor-menu--current"),n.currentMode==="sv"?(n.sv.element.style.display="block",n.options.preview.mode==="both"?n.preview.element.style.display="block":n.preview.element.style.display="none"):(n[n.currentMode].element.parentElement.style.display="block",n.preview.element.style.display="none"),m(n.toolbar.elements,s),n.outline.render(n)):(f(n.toolbar.elements,s),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)),Ne(n)}})},t}(me),ii=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,s=new ArrayBuffer(a),u=new DataView(s);this.writeUTFBytes(u,0,"RIFF"),u.setUint32(4,a,!0),this.writeUTFBytes(u,8,"WAVE"),this.writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,this.SAMPLE_RATE,!0),u.setUint32(28,this.SAMPLE_RATE*2,!0),u.setUint16(32,2,!0),u.setUint16(34,16,!0);var h=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,h,!0);for(var d=r.length,S=44,T=1,R=0;R<d;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),s=0,u=0;s<a.length;){for(var h=Math.round((s+1)*r),d=0,S=0,T=u;T<h&&T<t.length;T++)d+=t[T],S++;a[s]=d/S,s++,u=h}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var s=t[a];n.set(s,r),r+=s.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}(),ai=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)}}(),oi=function(e){ai(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){var s=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(h){i=new ii(h),i.recorder.onaudioprocess=function(d){if(i.isRecording){var S=d.inputBuffer.getChannelData(0),T=d.inputBuffer.getChannelData(1);i.cloneChannelData(S,T)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),s.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"});jt(n,[u]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),s.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current")}})},t}(me),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)}}(),li=function(e){si(t,e);function t(n,r){var i=e.call(this,n,r)||this;return f({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t}(me),ci=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ui=function(e){ci(t,e);function t(n,r){var i=e.call(this,n,r)||this;return f({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t}(me),fi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),di=function(e){fi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(E.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&jt(n,i.target.files,i.target)})},t}(me),pi=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 s=n.genItem(t,i,a);if(n.element.appendChild(s),i.toolbar){var u=document.createElement("div");u.className="vditor-hint vditor-panel--arrow",u.addEventListener((0,l.Le)(),function(h){u.style.display="none"}),i.toolbar.forEach(function(h,d){h.level=2,u.appendChild(n.genItem(t,h,a+d))}),s.appendChild(u),g(t,u,s.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 Mr(t),this.element.appendChild(t.counter.element))}return e.prototype.updateConfig=function(t,n){t.options.toolbarConfig=Object.assign({hide:!1,pin:!1},n),t.options.toolbarConfig.hide?this.element.classList.add("vditor-toolbar--hide"):this.element.classList.remove("vditor-toolbar--hide"),t.options.toolbarConfig.pin?this.element.classList.add("vditor-toolbar--pin"):this.element.classList.remove("vditor-toolbar--pin")},e.prototype.genItem=function(t,n,r){var i;switch(n.name){case"bold":case"italic":case"more":case"strike":case"line":case"quote":case"list":case"ordered-list":case"check":case"code":case"inline-code":case"link":case"table":i=new me(t,n);break;case"emoji":i=new Hr(t,n);break;case"headings":i=new Vr(t,n);break;case"|":i=new xr;break;case"br":i=new vr;break;case"undo":i=new ui(t,n);break;case"redo":i=new li(t,n);break;case"help":i=new Fr(t,n);break;case"both":i=new wr(t,n);break;case"preview":i=new ri(t,n);break;case"fullscreen":i=new Br(t,n);break;case"upload":i=new di(t,n);break;case"record":i=new oi(t,n);break;case"info":i=new Gr(t,n);break;case"edit-mode":i=new Zn(t,n);break;case"devtools":i=new Ar(t,n);break;case"outdent":i=new $r(t,n);break;case"indent":i=new Kr(t,n);break;case"outline":i=new ti(t,n);break;case"insert-after":i=new Jr(t,n);break;case"insert-before":i=new Yr(t,n);break;case"code-theme":i=new Sr(t,n);break;case"content-theme":i=new Lr(t,n);break;case"export":i=new Pr(t,n);break;default:i=new Tr(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e}(),hi=Y(173),mi=function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new hi}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?m(t.toolbar.elements,["undo"]):f(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?m(t.toolbar.elements,["redo"]):f(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,f(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&m(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(u){u.diffs.forEach(function(h){h[0]=-h[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(u){u.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?u.parentElement.outerHTML=n.lute.SpinVditorIRDOM(u.parentElement.outerHTML):u.parentElement.outerHTML=n.lute.SpinVditorDOM(u.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Ee(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,k.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),be(n);else{var s=getSelection().getRangeAt(0);s.setEndBefore(n[n.currentMode].element),s.collapse(!1)}je(n),ee(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),Ye(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){Ee(u,n)}),this[n.currentMode].undoStack.length>1?m(n.toolbar.elements,["undo"]):f(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?m(n.toolbar.elements,["redo"]):f(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 s=t[t.currentMode].element.cloneNode(!0);s.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(h){h.firstElementChild&&(h.firstElementChild.classList.contains("language-echarts")||h.firstElementChild.classList.contains("language-plantuml")||h.firstElementChild.classList.contains("language-mindmap")?(h.firstElementChild.removeAttribute("_echarts_instance_"),h.firstElementChild.removeAttribute("data-processed"),h.firstElementChild.innerHTML=h.previousElementSibling.firstElementChild.innerHTML,h.setAttribute("data-render","2")):h.firstElementChild.classList.contains("language-math")&&(h.setAttribute("data-render","2"),h.firstElementChild.textContent=h.firstElementChild.getAttribute("data-math"),h.firstElementChild.removeAttribute("data-math")))});var u=s.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(h){h.remove()}),n&&r&&(0,k.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e}(),gi=Y(673),yi=function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:E.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},customRenders:[],debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(E.g.CDN,"/dist/images/emoji"),extend:[],parse:!0},icon:"ant",lang:"zh_CN",mode:"ir",outline:{enable:!1,position:"left"},placeholder:"",preview:{actions:["desktop","tablet","mobile","mp-wechat","zhihu"],delay:1e3,hljs:E.g.HLJS_OPTIONS,markdown:E.g.MARKDOWN_OPTIONS,math:E.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:E.g.THEME_OPTIONS,render:{media:{enable:!0}}},link:{isOpen:!0},image:{isPreview:!0},resize:{enable:!1,position:"bottom"},theme:"classic",toolbar:["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|","upload","record","table","|","undo","redo","|","fullscreen","edit-mode",{name:"more",toolbar:["both","code-theme","content-theme","export","outline","preview","devtools","info","help"]}],toolbarConfig:{hide:!1,pin:!1},typewriterMode:!1,undoDelay:800,upload:{extraData:{},fieldName:"file[]",filename:function(n){return n.replace(/\W/g,"")},linkToImgUrl:"",max:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,s,u,h,d;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),!((n=(t=this.options.preview)===null||t===void 0?void 0:t.theme)===null||n===void 0)&&n.list&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((s=this.options.hint)===null||s===void 0)&&s.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((h=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||h===void 0)&&h.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((d=this.options.hint)===null||d===void 0)&&d.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var S=(0,gi.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
246
|
| --- | --- | --- |
|
|
247
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
|
|
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 s=a;r.forEach(function(u){typeof a=="string"&&u.name===a&&(s=u),typeof a=="object"&&u.name===a.name&&(s=Object.assign({},u,a))}),a.toolbar&&(s.toolbar=n.mergeToolbar(a.toolbar)),i.push(s)}),i},e}(),bi=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
249
|
contenteditable="true" spellcheck="false"></pre>
|
|
250
250
|
<div class="vditor-panel vditor-panel--none"></div>
|
|
251
251
|
<div class="vditor-panel vditor-panel--none">
|
|
252
252
|
<button type="button" aria-label="`).concat(window.VditorI18n.comment,`" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
|
|
253
253
|
<svg><use xlink:href="#vditor-icon-comment"></use></svg>
|
|
254
254
|
</button>
|
|
255
|
-
</div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),xt(t,this.element),en(t,this.element),Dt(t,this.element),Rt(t,this.element),It(t,this.element),Ht(t,this.element),Ot(t,this.element,this.copy),Nt(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var i=Lute.NewNodeID(),a=getSelection().getRangeAt(0),
|
|
256
|
-
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}
|
|
257
|
-
`){d=!1;break}d&&/^#{1,6} $/.test(a.textContent)&&(d=!1);var S=(0,C.W)(getSelection().getRangeAt(0).startContainer);if(S&&S.textContent===""&&(je(t),S.remove()),u&&a.getAttribute("data-type")!=="code-block"||d||Vt(a.innerHTML)||Ut(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(x(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&a.previousElementSibling.remove(),bt(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,k.Hc)(getSelection().getRangeAt(0)),ce(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?Qt(t,r.target):qn(r,t);return}var a=(0,
|
|
255
|
+
</div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),xt(t,this.element),en(t,this.element),Dt(t,this.element),Rt(t,this.element),It(t,this.element),Ht(t,this.element),Ot(t,this.element,this.copy),Nt(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var i=Lute.NewNodeID(),a=getSelection().getRangeAt(0),s=a.cloneRange(),u=a.extractContents(),h,d,S=!1,T=!1;u.childNodes.forEach(function(O,q){var B=!1;if(O.nodeType===3?B=!0:O.classList.contains("vditor-comment")?O.classList.contains("vditor-comment")&&O.setAttribute("data-cmtids",O.getAttribute("data-cmtids")+" "+i):B=!0,B)if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&q===0&&s.startOffset>0)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),h=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&q===u.childNodes.length-1&&s.endOffset<s.endContainer.textContent.length)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),d=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0")q===0?S=!0:q===u.childNodes.length-1&&(T=!0),O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>");else{var H=document.createElement("span");H.classList.add("vditor-comment"),H.setAttribute("data-cmtids",i),O.parentNode.insertBefore(H,O),H.appendChild(O)}});var R=(0,o.F9)(s.startContainer);R&&(h?(R.insertAdjacentHTML("beforeend",h.innerHTML),h.remove()):R.textContent.trim().replace(E.g.ZWSP,"")===""&&S&&R.remove());var I=(0,o.F9)(s.endContainer);I&&(d?(I.insertAdjacentHTML("afterbegin",d.innerHTML),d.remove()):I.textContent.trim().replace(E.g.ZWSP,"")===""&&T&&I.remove()),a.insertNode(u),t.options.comment.add(i,a.toString(),n.getComments(t,!0)),ce(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,s){var u=new Set(s);return a.filter(function(h){return!u.has(h)})};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,k.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,o.lG)(r.startContainer,"CODE"),a=(0,o.lG)(r.endContainer,"CODE");if(i&&a&&a.isSameNode(i)){var s="";i.parentElement.tagName==="PRE"?s=r.toString():s="`"+r.toString()+"`",t.clipboardData.setData("text/plain",s),t.clipboardData.setData("text/html","");return}var u=(0,o.lG)(r.startContainer,"A"),h=(0,o.lG)(r.endContainer,"A");if(u&&h&&h.isSameNode(u)){var d=u.getAttribute("title")||"";d&&(d=' "'.concat(d,'"')),t.clipboardData.setData("text/plain","[".concat(r.toString(),"](").concat(u.getAttribute("href")).concat(d,")")),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){St(t,r,{pasteCode:function(i){var a=(0,k.zh)(t),s=document.createElement("template");s.innerHTML=i,a.insertNode(s.content.cloneNode(!0));var u=(0,o.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,k.ib)(t.wysiwyg.element,a)}})}),this.element.addEventListener("compositionstart",function(){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){var i=(0,C.W)(getSelection().getRangeAt(0).startContainer);if(i&&i.textContent===""){je(t);return}(0,l.vU)()||bt(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,ce(t);return}if(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"){ce(t);return}var i=getSelection().getRangeAt(0),a=(0,o.F9)(i.startContainer);if(a||(Tt(t,i),a=(0,o.F9)(i.startContainer)),!!a){for(var s=(0,k.im)(a,t.wysiwyg.element,i).start,u=!0,h=s-1;h>a.textContent.substr(0,s).lastIndexOf(`
|
|
256
|
+
`);h--)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==" "){u=!1;break}s===0&&(u=!1);for(var d=!0,h=s-1;h<a.textContent.length;h++)if(a.textContent.charAt(h)!==" "&&a.textContent.charAt(h)!==`
|
|
257
|
+
`){d=!1;break}d&&/^#{1,6} $/.test(a.textContent)&&(d=!1);var S=(0,C.W)(getSelection().getRangeAt(0).startContainer);if(S&&S.textContent===""&&(je(t),S.remove()),u&&a.getAttribute("data-type")!=="code-block"||d||Vt(a.innerHTML)||Ut(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(x(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&a.previousElementSibling.remove(),bt(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,k.Hc)(getSelection().getRangeAt(0)),ce(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?Qt(t,r.target):qn(r,t);return}var a=(0,o.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 s=(0,k.zh)(t);if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&s.collapsed){var u=n.element.lastElementChild.getBoundingClientRect();r.y>u.top+u.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(E.g.ZWSP,"")===""?(s.selectNodeContents(n.element.lastElementChild),s.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(E.g.ZWSP,"<wbr></p>")),(0,k.ib)(n.element,s)))}Ge(t);var h=(0,o.fb)(r.target,"vditor-wysiwyg__preview");h||(h=(0,o.fb)((0,k.zh)(t).startContainer,"vditor-wysiwyg__preview")),h&&it(h,t),pt(r,t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){r.key==="Enter"&&be(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
258
|
`)&&(t.wysiwyg.element.innerHTML="");var i=(0,k.zh)(t);if(r.key==="Backspace"&&(0,l.vU)()&&i.startContainer.textContent===`
|
|
259
|
-
`&&i.startOffset===1&&(i.startContainer.textContent=""),Tt(t,i),Ge(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"?it(a,t):it(a,t,!1);return}var h=a.previousElementSibling;if(h.tagName==="PRE"&&(h=h.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,d=Vn(o);if(d&&d.nodeType!==3){var S=d.querySelector(".vditor-wysiwyg__preview");if(S){it(S,t);return}}if(d.nodeType===3){for(;d.textContent.length===0&&d.nextSibling;)d=d.nextSibling;i.setStart(d,1)}else i.setStart(d.firstChild,0)}else i.selectNodeContents(h),i.collapse(!1)}}}})},e}(),wi=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){wi(t,e);function t(n,r){var i=e.call(this)||this;if(i.version=E.H,typeof n=="string"){if(r?r.cache?r.cache.id||(r.cache.id="vditor".concat(n)):r.cache={id:"vditor".concat(n)}:r={cache:{id:"vditor".concat(n)}},!document.getElementById(n))return i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new yi(r),o=a.merge();if(o.i18n)window.VditorI18n=o.i18n,i.init(n,o);else if(["en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(o.lang)){var u="vditorI18nScript",h=u+o.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(d){d.id!==h&&document.head.removeChild(d)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),h).then(function(){i.init(n,o)}).catch(function(d){i.showErrorTip("GET ".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return i}return t.prototype.showErrorTip=function(n){var r=new _n;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,de(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,X.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,An.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return x(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"]),f(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){m(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","true")},t.prototype.getSelection=function(){if(this.vditor.currentMode==="wysiwyg")return ot(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return ot(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return ot(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,k.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&localStorage.removeItem(this.vditor.options.cache.id)},t.prototype.disabledCache=function(){this.vditor.options.cache.enable=!1},t.prototype.enableCache=function(){if(!this.vditor.options.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");this.vditor.options.cache.enable=!0},t.prototype.html2md=function(n){return this.vditor.lute.HTML2Md(n)},t.prototype.exportJSON=function(n){return this.vditor.lute.RenderJSON(n)},t.prototype.getHTML=function(){return kn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Ft(n,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(n){document.execCommand("insertHTML",!1,n)},t.prototype.insertValue=function(n,r){r===void 0&&(r=!0);var i=(0,k.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&ie(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&bt(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&Fe(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,k.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,k.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):Pt(this.vditor,n),this.vditor.outline.render(this.vditor),ee(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Ee(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?$t(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){ve(a,i.vditor)}),Ve(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){st(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(),Jt(),this.vditor.wysiwyg.unbindListener(),this.vditor.options.after=void 0},t.prototype.getCommentIds=function(){return this.vditor.currentMode!=="wysiwyg"?[]:this.vditor.wysiwyg.getComments(this.vditor,!0)},t.prototype.hlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){i.classList.remove("vditor-comment--hover"),n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.removeCommentIds=function(n){var r=this;if(this.vditor.currentMode==="wysiwyg"){var i=function(a,o){var u=a.getAttribute("data-cmtids").split(" ");u.find(function(h,d){if(h===o)return u.splice(d,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,k.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",u.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)})}),ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.vditor={currentMode:r.mode,element:n,hint:new ur(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new pr(window.VditorI18n.outline),tip:new _n},this.vditor.sv=new yr(this.vditor),this.vditor.undo=new mi,this.vditor.wysiwyg=new bi(this.vditor),this.vditor.ir=new fr(this.vditor),this.vditor.toolbar=new pi(this.vditor),r.resize.enable&&(this.vditor.resize=new gr(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new $n),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,dr.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 mr(i.vditor),De(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")})},t}(Z.default);const Ei=vi})(),xe=xe.default,xe})()})}(kt)),kt.exports}var ki=Mi();const Ti=Si.getDefaultExportFromCjs(ki),_i={class:"dsg-editor"},Ai={ref:"vditor",class:"dsg-editor__vditor"},xi=Me.defineComponent({__name:"DsgEditor",props:Me.mergeModels({label:{default:""},targetModel:{default:null},targetModelClass:{default:""},mediaUploadEndpoint:{default:""},csrf:{default:""}},{modelValue:{required:!0},modelModifiers:{}}),emits:Me.mergeModels(["on-before-input","on-after-input","update:modelValue"],["update:modelValue"]),setup(Oe,{expose:Gt,emit:dt}){let nt=Me.useModel(Oe,"modelValue"),Y=Me.ref(nt);Me.watch(()=>Y.value,(w,b)=>{m("update:modelValue",w)});const xe=Me.ref(),Z=Me.useTemplateRef("vditor"),E=()=>({modelId:Oe.targetModel?Oe.targetModel.id:"",modelClass:Oe.targetModelClass?Oe.targetModelClass:""}),L=(w,b)=>{if(!w)return!1;w.nodeType===3&&(w=w.parentElement);let g=w,s=!1;for(;g&&!s&&!g.classList.contains("vditor-reset");)g.nodeName===b?s=!0:g=g.parentElement;return s&&g},x=w=>{let b;const g=w[w.currentMode].element;return getSelection().rangeCount>0&&(b=getSelection().getRangeAt(0),g.isEqualNode(b.startContainer)||g.contains(b.startContainer))?b:w[w.currentMode].range?w[w.currentMode].range:(g.focus(),b=g.ownerDocument.createRange(),b.setStart(g,0),b.collapse(!0),b)},A=w=>{let b=x(xe.value.vditor);const g=L(b.startContainer,"LI");if(!g||g.nextElementSibling||g.previousElementSibling)return!1;if(g.parentNode?.previousSibling?.nodeName==="UL"&&g.parentNode?.previousSibling?.firstChild.classList.contains("vditor-task")){let s=g.parentNode?.previousSibling,C=g.parentNode;s.appendChild(g),g.classList.add("vditor-task");let _=document.createElement("input");_.setAttribute("type","checkbox"),g.insertBefore(_,g.firstChild),C&&C.parentNode&&C.parentNode.removeChild(C),b.setStartAfter(g),b.collapse(!0)}},c=()=>Oe.csrf?Oe.csrf:window.csrf,l=w=>new Promise(b=>{new MutationObserver((s,C)=>{const _=document.querySelector(w);_&&(C.disconnect(),b(_))}).observe(document.body,{childList:!0,subtree:!0})}),y=w=>{w.addEventListener("paste",b=>{if("clipboardData"in b&&b.clipboardData?.items){for(const g of b.clipboardData.items)if(g.type.startsWith("image/")){const s=b.clipboardData?.files[0].name.split(".").slice(0,-1).join("")||"pasted-image",C=g.type.split("/")[1];b.preventDefault(),b.stopPropagation();const _=new FileReader;_.readAsDataURL(g.getAsFile()),_.onload=()=>{const D=_.result;xe.value?.insertMD(`🐰 
|
|
260
|
-
`)}}}},!0)},p=()=>{let w=["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|"];Oe.mediaUploadEndpoint&&c()!==""&&w.push("upload");let b=["table","|","undo","redo","|","fullscreen",{name:"more",toolbar:["both","export","outline","preview","devtools","info","help"]}];for(let g=0;g<b.length;g++)w.push(b[g]);return w};
|
|
261
|
-
`),
|
|
259
|
+
`&&i.startOffset===1&&(i.startContainer.textContent=""),Tt(t,i),Ge(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,o.fb)(i.startContainer,"vditor-wysiwyg__preview");if(!a&&i.startContainer.nodeType!==3&&i.startOffset>0){var s=i.startContainer;s.classList.contains("vditor-wysiwyg__block")&&(a=s.lastElementChild)}if(a){var u=a.previousElementSibling;if(u.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?it(a,t):it(a,t,!1);return}var h=a.previousElementSibling;if(h.tagName==="PRE"&&(h=h.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var s=a.parentElement,d=Vn(s);if(d&&d.nodeType!==3){var S=d.querySelector(".vditor-wysiwyg__preview");if(S){it(S,t);return}}if(d.nodeType===3){for(;d.textContent.length===0&&d.nextSibling;)d=d.nextSibling;i.setStart(d,1)}else i.setStart(d.firstChild,0)}else i.selectNodeContents(h),i.collapse(!1)}}}})},e}(),wi=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){wi(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=E.H,typeof n=="string"){if(r?r.cache?r.cache.id||(r.cache.id="vditor".concat(n)):r.cache={id:"vditor".concat(n)}:r={cache:{id:"vditor".concat(n)}},!document.getElementById(n))return i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new yi(r),s=a.merge();if(s.i18n)window.VditorI18n=s.i18n,i.init(n,s);else if(["de_DE","en_US","fr_FR","pt_BR","ja_JP","ko_KR","ru_RU","sv_SE","zh_CN","zh_TW"].includes(s.lang)){var u="vditorI18nScript",h=u+s.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(d){d.id!==h&&document.head.removeChild(d)}),(0,A.G)("".concat(s.cdn,"/dist/js/i18n/").concat(s.lang,".js"),h).then(function(){i.init(n,s)}).catch(function(d){i.showErrorTip("GET ".concat(s.cdn,"/dist/js/i18n/").concat(s.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 _n;document.body.appendChild(r.element),r.show(n,0)},t.prototype.updateToolbarConfig=function(n){this.vditor.toolbar.updateConfig(this.vditor,n)},t.prototype.setTheme=function(n,r,i,a){this.vditor.options.theme=n,pe(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,X.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,An.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return x(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"]),f(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){m(this.vditor.toolbar.elements,E.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","true")},t.prototype.getSelection=function(){if(this.vditor.currentMode==="wysiwyg")return ot(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return ot(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return ot(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,k.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&localStorage.removeItem(this.vditor.options.cache.id)},t.prototype.disabledCache=function(){this.vditor.options.cache.enable=!1},t.prototype.enableCache=function(){if(!this.vditor.options.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");this.vditor.options.cache.enable=!0},t.prototype.html2md=function(n){return this.vditor.lute.HTML2Md(n)},t.prototype.exportJSON=function(n){return this.vditor.lute.RenderJSON(n)},t.prototype.getHTML=function(){return kn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Ft(n,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(n){document.execCommand("insertHTML",!1,n)},t.prototype.insertValue=function(n,r){r===void 0&&(r=!0);var i=(0,k.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&ie(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&bt(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&Fe(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,k.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,k.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):Pt(this.vditor,n),this.vditor.outline.render(this.vditor),ee(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Se(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?$t(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){Ee(a,i.vditor)}),Ve(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){st(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(),Jt(),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,s){var u=a.getAttribute("data-cmtids").split(" ");u.find(function(h,d){if(h===s)return u.splice(d,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,k.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",u.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(s){i(s,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(s){i(s,a)})}),ce(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.isDestroyed||(this.vditor={currentMode:r.mode,element:n,hint:new ur(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new pr(window.VditorI18n.outline),tip:new _n},this.vditor.sv=new yr(this.vditor),this.vditor.undo=new mi,this.vditor.wysiwyg=new bi(this.vditor),this.vditor.ir=new fr(this.vditor),this.vditor.toolbar=new pi(this.vditor),r.resize.enable&&(this.vditor.resize=new gr(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new $n),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,dr.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 mr(i.vditor),De(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t}(Z.default);const Ei=vi})(),ke=ke.default,ke})()})}(kt)),kt.exports}var ki=Mi();const Ti=Si.getDefaultExportFromCjs(ki),_i={class:"dsg-editor"},Ai={ref:"vditor",class:"dsg-editor__vditor"},xi={key:0,class:"dsg-editor--error-wrapper"},Di=fe.defineComponent({__name:"DsgEditor",props:fe.mergeModels({label:{default:""},targetModel:{default:null},targetModelClass:{default:""},mediaUploadEndpoint:{default:""},csrf:{default:""},errors:{default:()=>[]}},{modelValue:{required:!0},modelModifiers:{}}),emits:fe.mergeModels(["on-before-input","on-after-input","update:modelValue"],["update:modelValue"]),setup(Oe,{expose:Gt,emit:dt}){let nt=fe.useModel(Oe,"modelValue"),Y=fe.ref(nt);fe.watch(()=>Y.value,(w,b)=>{m("update:modelValue",w)});const ke=fe.ref(),Z=fe.useTemplateRef("vditor"),E=()=>({modelId:Oe.targetModel?Oe.targetModel.id:"",modelClass:Oe.targetModelClass?Oe.targetModelClass:""}),L=(w,b)=>{if(!w)return!1;w.nodeType===3&&(w=w.parentElement);let g=w,o=!1;for(;g&&!o&&!g.classList.contains("vditor-reset");)g.nodeName===b?o=!0:g=g.parentElement;return o&&g},x=w=>{let b;const g=w[w.currentMode].element;return getSelection().rangeCount>0&&(b=getSelection().getRangeAt(0),g.isEqualNode(b.startContainer)||g.contains(b.startContainer))?b:w[w.currentMode].range?w[w.currentMode].range:(g.focus(),b=g.ownerDocument.createRange(),b.setStart(g,0),b.collapse(!0),b)},A=w=>{let b=x(ke.value.vditor);const g=L(b.startContainer,"LI");if(!g||g.nextElementSibling||g.previousElementSibling)return!1;if(g.parentNode?.previousSibling?.nodeName==="UL"&&g.parentNode?.previousSibling?.firstChild.classList.contains("vditor-task")){let o=g.parentNode?.previousSibling,C=g.parentNode;o.appendChild(g),g.classList.add("vditor-task");let _=document.createElement("input");_.setAttribute("type","checkbox"),g.insertBefore(_,g.firstChild),C&&C.parentNode&&C.parentNode.removeChild(C),b.setStartAfter(g),b.collapse(!0)}},c=()=>Oe.csrf?Oe.csrf:window.csrf,l=w=>new Promise(b=>{new MutationObserver((o,C)=>{const _=document.querySelector(w);_&&(C.disconnect(),b(_))}).observe(document.body,{childList:!0,subtree:!0})}),y=w=>{w.addEventListener("paste",b=>{if("clipboardData"in b&&b.clipboardData?.items){for(const g of b.clipboardData.items)if(g.type.startsWith("image/")){const o=b.clipboardData?.files[0].name.split(".").slice(0,-1).join("")||"pasted-image",C=g.type.split("/")[1];b.preventDefault(),b.stopPropagation();const _=new FileReader;_.readAsDataURL(g.getAsFile()),_.onload=()=>{const D=_.result;ke.value?.insertMD(`🐰 
|
|
260
|
+
`)}}}},!0)},p=()=>{let w=["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|"];Oe.mediaUploadEndpoint&&c()!==""&&w.push("upload");let b=["table","|","undo","redo","|","fullscreen",{name:"more",toolbar:["both","export","outline","preview","devtools","info","help"]}];for(let g=0;g<b.length;g++)w.push(b[g]);return w};fe.onMounted(()=>{let w={mode:"wysiwyg",height:"auto",minHeight:300,lang:"en_US",toolbarConfig:{pin:!0},cache:{enable:!1},preview:{maxWidth:2e3},toolbar:p(),after:()=>{Z.value.getElementsByClassName("vditor-wysiwyg")[0].addEventListener("keyup",g=>{g.key==="Enter"&&A()&&g.preventDefault()}),Y.value&&ke.value?.setValue(Y.value)},input:b=>{m("on-before-input",Y.value,b),Y.value=b,m("on-after-input",b)},upload:{}};Oe.mediaUploadEndpoint&&c()!==""&&(w.upload={accept:"image/*",url:Oe.mediaUploadEndpoint,headers:{"X-CSRF-TOKEN":c()},extraData:E(),multiple:!1,error:b=>{ke.value?.vditor.tip.show("The file upload failed",5e3)},success:(b,g)=>{const o=JSON.parse(g);document.execCommand("insertHTML",!1,`
|
|
261
|
+
`),Y.value=ke.value.getValue(),ke.value?.setValue(ke.value.getValue()),m("update:modelValue",Y.value),ke.value?.vditor.tip.hide()}}),Z.value&&(ke.value=new Ti(Z.value,w),l("pre.vditor-reset").then(b=>{y(b)}))});const m=dt;return Gt({getEditor:()=>ke.value,getEditorValue:()=>Y.value}),(w,b)=>(fe.openBlock(),fe.createElementBlock("div",_i,[fe.createElementVNode("div",null,[w.label?(fe.openBlock(),fe.createBlock(Ci._sfc_main,{key:0,classes:"dsg-editor__label",label:w.label},null,8,["label"])):fe.createCommentVNode("",!0),fe.createElementVNode("div",Ai,null,512)]),w.errors&&w.errors.length?(fe.openBlock(),fe.createElementBlock("div",xi,[(fe.openBlock(!0),fe.createElementBlock(fe.Fragment,null,fe.renderList(w.errors,(g,o)=>(fe.openBlock(),fe.createElementBlock("div",{class:"dsg-editor--error",key:o},fe.toDisplayString(g),1))),128))])):fe.createCommentVNode("",!0)]))}}),Pn=Di,Hi={DsgEditor:Pn};exports.DsgEditor=Pn;exports.default=Hi;
|