@ahzoo/sus 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @ahzoo/sus might be problematic. Click here for more details.

@@ -1,259 +1,107 @@
1
- (function(Ue,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],L):(Ue=typeof globalThis<"u"?globalThis:Ue||self,L(Ue.SuSComment={},Ue.vue))})(this,(function(Ue,L){"use strict";function $n(q){return q&&q.__esModule&&Object.prototype.hasOwnProperty.call(q,"default")?q.default:q}var yt={exports:{}};/*!
2
- * Vditor v3.11.2 - A markdown editor written in TypeScript.
3
- *
4
- * MIT License
5
- *
6
- * Copyright (c) 2018-present B3log 开源, b3log.org
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- *
26
- */var Zn=yt.exports,Qt;function Jn(){return Qt||(Qt=1,(function(q,Me){(function(Q,X){q.exports=X()})(Zn,function(){return(()=>{var se={173:(I=>{var w=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},C=-1,D=1,A=0;w.Diff=function(c,l){return[c,l]},w.prototype.diff_main=function(c,l,g,p){typeof p>"u"&&(this.Diff_Timeout<=0?p=Number.MAX_VALUE:p=new Date().getTime()+this.Diff_Timeout*1e3);var h=p;if(c==null||l==null)throw new Error("Null input. (diff_main)");if(c==l)return c?[new w.Diff(A,c)]:[];typeof g>"u"&&(g=!0);var d=g,E=this.diff_commonPrefix(c,l),v=c.substring(0,E);c=c.substring(E),l=l.substring(E),E=this.diff_commonSuffix(c,l);var b=c.substring(c.length-E);c=c.substring(0,c.length-E),l=l.substring(0,l.length-E);var y=this.diff_compute_(c,l,d,h);return v&&y.unshift(new w.Diff(A,v)),b&&y.push(new w.Diff(A,b)),this.diff_cleanupMerge(y),y},w.prototype.diff_compute_=function(c,l,g,p){var h;if(!c)return[new w.Diff(D,l)];if(!l)return[new w.Diff(C,c)];var d=c.length>l.length?c:l,E=c.length>l.length?l:c,v=d.indexOf(E);if(v!=-1)return h=[new w.Diff(D,d.substring(0,v)),new w.Diff(A,E),new w.Diff(D,d.substring(v+E.length))],c.length>l.length&&(h[0][0]=h[2][0]=C),h;if(E.length==1)return[new w.Diff(C,c),new w.Diff(D,l)];var b=this.diff_halfMatch_(c,l);if(b){var y=b[0],s=b[1],k=b[2],x=b[3],H=b[4],_=this.diff_main(y,k,g,p),B=this.diff_main(s,x,g,p);return _.concat([new w.Diff(A,H)],B)}return g&&c.length>100&&l.length>100?this.diff_lineMode_(c,l,p):this.diff_bisect_(c,l,p)},w.prototype.diff_lineMode_=function(c,l,g){var p=this.diff_linesToChars_(c,l);c=p.chars1,l=p.chars2;var h=p.lineArray,d=this.diff_main(c,l,!1,g);this.diff_charsToLines_(d,h),this.diff_cleanupSemantic(d),d.push(new w.Diff(A,""));for(var E=0,v=0,b=0,y="",s="";E<d.length;){switch(d[E][0]){case D:b++,s+=d[E][1];break;case C:v++,y+=d[E][1];break;case A:if(v>=1&&b>=1){d.splice(E-v-b,v+b),E=E-v-b;for(var k=this.diff_main(y,s,!1,g),x=k.length-1;x>=0;x--)d.splice(E,0,k[x]);E=E+k.length}b=0,v=0,y="",s="";break}E++}return d.pop(),d},w.prototype.diff_bisect_=function(c,l,g){for(var p=c.length,h=l.length,d=Math.ceil((p+h)/2),E=d,v=2*d,b=new Array(v),y=new Array(v),s=0;s<v;s++)b[s]=-1,y[s]=-1;b[E+1]=0,y[E+1]=0;for(var k=p-h,x=k%2!=0,H=0,_=0,B=0,z=0,Z=0;Z<d&&!(new Date().getTime()>g);Z++){for(var ne=-Z+H;ne<=Z-_;ne+=2){var ae=E+ne,ue;ne==-Z||ne!=Z&&b[ae-1]<b[ae+1]?ue=b[ae+1]:ue=b[ae-1]+1;for(var ve=ue-ne;ue<p&&ve<h&&c.charAt(ue)==l.charAt(ve);)ue++,ve++;if(b[ae]=ue,ue>p)_+=2;else if(ve>h)H+=2;else if(x){var me=E+k-ne;if(me>=0&&me<v&&y[me]!=-1){var de=p-y[me];if(ue>=de)return this.diff_bisectSplit_(c,l,ue,ve,g)}}}for(var Ce=-Z+B;Ce<=Z-z;Ce+=2){var me=E+Ce,de;Ce==-Z||Ce!=Z&&y[me-1]<y[me+1]?de=y[me+1]:de=y[me-1]+1;for(var De=de-Ce;de<p&&De<h&&c.charAt(p-de-1)==l.charAt(h-De-1);)de++,De++;if(y[me]=de,de>p)z+=2;else if(De>h)B+=2;else if(!x){var ae=E+k-Ce;if(ae>=0&&ae<v&&b[ae]!=-1){var ue=b[ae],ve=E+ue-ae;if(de=p-de,ue>=de)return this.diff_bisectSplit_(c,l,ue,ve,g)}}}}return[new w.Diff(C,c),new w.Diff(D,l)]},w.prototype.diff_bisectSplit_=function(c,l,g,p,h){var d=c.substring(0,g),E=l.substring(0,p),v=c.substring(g),b=l.substring(p),y=this.diff_main(d,E,!1,h),s=this.diff_main(v,b,!1,h);return y.concat(s)},w.prototype.diff_linesToChars_=function(c,l){var g=[],p={};g[0]="";function h(b){for(var y="",s=0,k=-1,x=g.length;k<b.length-1;){k=b.indexOf(`
27
- `,s),k==-1&&(k=b.length-1);var H=b.substring(s,k+1);(p.hasOwnProperty?p.hasOwnProperty(H):p[H]!==void 0)?y+=String.fromCharCode(p[H]):(x==d&&(H=b.substring(s),k=b.length),y+=String.fromCharCode(x),p[H]=x,g[x++]=H),s=k+1}return y}var d=4e4,E=h(c);d=65535;var v=h(l);return{chars1:E,chars2:v,lineArray:g}},w.prototype.diff_charsToLines_=function(c,l){for(var g=0;g<c.length;g++){for(var p=c[g][1],h=[],d=0;d<p.length;d++)h[d]=l[p.charCodeAt(d)];c[g][1]=h.join("")}},w.prototype.diff_commonPrefix=function(c,l){if(!c||!l||c.charAt(0)!=l.charAt(0))return 0;for(var g=0,p=Math.min(c.length,l.length),h=p,d=0;g<h;)c.substring(d,h)==l.substring(d,h)?(g=h,d=g):p=h,h=Math.floor((p-g)/2+g);return h},w.prototype.diff_commonSuffix=function(c,l){if(!c||!l||c.charAt(c.length-1)!=l.charAt(l.length-1))return 0;for(var g=0,p=Math.min(c.length,l.length),h=p,d=0;g<h;)c.substring(c.length-h,c.length-d)==l.substring(l.length-h,l.length-d)?(g=h,d=g):p=h,h=Math.floor((p-g)/2+g);return h},w.prototype.diff_commonOverlap_=function(c,l){var g=c.length,p=l.length;if(g==0||p==0)return 0;g>p?c=c.substring(g-p):g<p&&(l=l.substring(0,g));var h=Math.min(g,p);if(c==l)return h;for(var d=0,E=1;;){var v=c.substring(h-E),b=l.indexOf(v);if(b==-1)return d;E+=b,(b==0||c.substring(h-E)==l.substring(0,E))&&(d=E,E++)}},w.prototype.diff_halfMatch_=function(c,l){if(this.Diff_Timeout<=0)return null;var g=c.length>l.length?c:l,p=c.length>l.length?l:c;if(g.length<4||p.length*2<g.length)return null;var h=this;function d(_,B,z){for(var Z=_.substring(z,z+Math.floor(_.length/4)),ne=-1,ae="",ue,ve,me,de;(ne=B.indexOf(Z,ne+1))!=-1;){var Ce=h.diff_commonPrefix(_.substring(z),B.substring(ne)),De=h.diff_commonSuffix(_.substring(0,z),B.substring(0,ne));ae.length<De+Ce&&(ae=B.substring(ne-De,ne)+B.substring(ne,ne+Ce),ue=_.substring(0,z-De),ve=_.substring(z+Ce),me=B.substring(0,ne-De),de=B.substring(ne+Ce))}return ae.length*2>=_.length?[ue,ve,me,de,ae]:null}var E=d(g,p,Math.ceil(g.length/4)),v=d(g,p,Math.ceil(g.length/2)),b;if(!E&&!v)return null;v?E?b=E[4].length>v[4].length?E:v:b=v:b=E;var y,s,k,x;c.length>l.length?(y=b[0],s=b[1],k=b[2],x=b[3]):(k=b[0],x=b[1],y=b[2],s=b[3]);var H=b[4];return[y,s,k,x,H]},w.prototype.diff_cleanupSemantic=function(c){for(var l=!1,g=[],p=0,h=null,d=0,E=0,v=0,b=0,y=0;d<c.length;)c[d][0]==A?(g[p++]=d,E=b,v=y,b=0,y=0,h=c[d][1]):(c[d][0]==D?b+=c[d][1].length:y+=c[d][1].length,h&&h.length<=Math.max(E,v)&&h.length<=Math.max(b,y)&&(c.splice(g[p-1],0,new w.Diff(C,h)),c[g[p-1]+1][0]=D,p--,p--,d=p>0?g[p-1]:-1,E=0,v=0,b=0,y=0,h=null,l=!0)),d++;for(l&&this.diff_cleanupMerge(c),this.diff_cleanupSemanticLossless(c),d=1;d<c.length;){if(c[d-1][0]==C&&c[d][0]==D){var s=c[d-1][1],k=c[d][1],x=this.diff_commonOverlap_(s,k),H=this.diff_commonOverlap_(k,s);x>=H?(x>=s.length/2||x>=k.length/2)&&(c.splice(d,0,new w.Diff(A,k.substring(0,x))),c[d-1][1]=s.substring(0,s.length-x),c[d+1][1]=k.substring(x),d++):(H>=s.length/2||H>=k.length/2)&&(c.splice(d,0,new w.Diff(A,s.substring(0,H))),c[d-1][0]=D,c[d-1][1]=k.substring(0,k.length-H),c[d+1][0]=C,c[d+1][1]=s.substring(H),d++),d++}d++}},w.prototype.diff_cleanupSemanticLossless=function(c){function l(H,_){if(!H||!_)return 6;var B=H.charAt(H.length-1),z=_.charAt(0),Z=B.match(w.nonAlphaNumericRegex_),ne=z.match(w.nonAlphaNumericRegex_),ae=Z&&B.match(w.whitespaceRegex_),ue=ne&&z.match(w.whitespaceRegex_),ve=ae&&B.match(w.linebreakRegex_),me=ue&&z.match(w.linebreakRegex_),de=ve&&H.match(w.blanklineEndRegex_),Ce=me&&_.match(w.blanklineStartRegex_);return de||Ce?5:ve||me?4:Z&&!ae&&ue?3:ae||ue?2:Z||ne?1:0}for(var g=1;g<c.length-1;){if(c[g-1][0]==A&&c[g+1][0]==A){var p=c[g-1][1],h=c[g][1],d=c[g+1][1],E=this.diff_commonSuffix(p,h);if(E){var v=h.substring(h.length-E);p=p.substring(0,p.length-E),h=v+h.substring(0,h.length-E),d=v+d}for(var b=p,y=h,s=d,k=l(p,h)+l(h,d);h.charAt(0)===d.charAt(0);){p+=h.charAt(0),h=h.substring(1)+d.charAt(0),d=d.substring(1);var x=l(p,h)+l(h,d);x>=k&&(k=x,b=p,y=h,s=d)}c[g-1][1]!=b&&(b?c[g-1][1]=b:(c.splice(g-1,1),g--),c[g][1]=y,s?c[g+1][1]=s:(c.splice(g+1,1),g--))}g++}},w.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,w.whitespaceRegex_=/\s/,w.linebreakRegex_=/[\r\n]/,w.blanklineEndRegex_=/\n\r?\n$/,w.blanklineStartRegex_=/^\r?\n\r?\n/,w.prototype.diff_cleanupEfficiency=function(c){for(var l=!1,g=[],p=0,h=null,d=0,E=!1,v=!1,b=!1,y=!1;d<c.length;)c[d][0]==A?(c[d][1].length<this.Diff_EditCost&&(b||y)?(g[p++]=d,E=b,v=y,h=c[d][1]):(p=0,h=null),b=y=!1):(c[d][0]==C?y=!0:b=!0,h&&(E&&v&&b&&y||h.length<this.Diff_EditCost/2&&E+v+b+y==3)&&(c.splice(g[p-1],0,new w.Diff(C,h)),c[g[p-1]+1][0]=D,p--,h=null,E&&v?(b=y=!0,p=0):(p--,d=p>0?g[p-1]:-1,b=y=!1),l=!0)),d++;l&&this.diff_cleanupMerge(c)},w.prototype.diff_cleanupMerge=function(c){c.push(new w.Diff(A,""));for(var l=0,g=0,p=0,h="",d="",E;l<c.length;)switch(c[l][0]){case D:p++,d+=c[l][1],l++;break;case C:g++,h+=c[l][1],l++;break;case A:g+p>1?(g!==0&&p!==0&&(E=this.diff_commonPrefix(d,h),E!==0&&(l-g-p>0&&c[l-g-p-1][0]==A?c[l-g-p-1][1]+=d.substring(0,E):(c.splice(0,0,new w.Diff(A,d.substring(0,E))),l++),d=d.substring(E),h=h.substring(E)),E=this.diff_commonSuffix(d,h),E!==0&&(c[l][1]=d.substring(d.length-E)+c[l][1],d=d.substring(0,d.length-E),h=h.substring(0,h.length-E))),l-=g+p,c.splice(l,g+p),h.length&&(c.splice(l,0,new w.Diff(C,h)),l++),d.length&&(c.splice(l,0,new w.Diff(D,d)),l++),l++):l!==0&&c[l-1][0]==A?(c[l-1][1]+=c[l][1],c.splice(l,1)):l++,p=0,g=0,h="",d="";break}c[c.length-1][1]===""&&c.pop();var v=!1;for(l=1;l<c.length-1;)c[l-1][0]==A&&c[l+1][0]==A&&(c[l][1].substring(c[l][1].length-c[l-1][1].length)==c[l-1][1]?(c[l][1]=c[l-1][1]+c[l][1].substring(0,c[l][1].length-c[l-1][1].length),c[l+1][1]=c[l-1][1]+c[l+1][1],c.splice(l-1,1),v=!0):c[l][1].substring(0,c[l+1][1].length)==c[l+1][1]&&(c[l-1][1]+=c[l+1][1],c[l][1]=c[l][1].substring(c[l+1][1].length)+c[l+1][1],c.splice(l+1,1),v=!0)),l++;v&&this.diff_cleanupMerge(c)},w.prototype.diff_xIndex=function(c,l){var g=0,p=0,h=0,d=0,E;for(E=0;E<c.length&&(c[E][0]!==D&&(g+=c[E][1].length),c[E][0]!==C&&(p+=c[E][1].length),!(g>l));E++)h=g,d=p;return c.length!=E&&c[E][0]===C?d:d+(l-h)},w.prototype.diff_prettyHtml=function(c){for(var l=[],g=/&/g,p=/</g,h=/>/g,d=/\n/g,E=0;E<c.length;E++){var v=c[E][0],b=c[E][1],y=b.replace(g,"&amp;").replace(p,"&lt;").replace(h,"&gt;").replace(d,"&para;<br>");switch(v){case D:l[E]='<ins style="background:#e6ffe6;">'+y+"</ins>";break;case C:l[E]='<del style="background:#ffe6e6;">'+y+"</del>";break;case A:l[E]="<span>"+y+"</span>";break}}return l.join("")},w.prototype.diff_text1=function(c){for(var l=[],g=0;g<c.length;g++)c[g][0]!==D&&(l[g]=c[g][1]);return l.join("")},w.prototype.diff_text2=function(c){for(var l=[],g=0;g<c.length;g++)c[g][0]!==C&&(l[g]=c[g][1]);return l.join("")},w.prototype.diff_levenshtein=function(c){for(var l=0,g=0,p=0,h=0;h<c.length;h++){var d=c[h][0],E=c[h][1];switch(d){case D:g+=E.length;break;case C:p+=E.length;break;case A:l+=Math.max(g,p),g=0,p=0;break}}return l+=Math.max(g,p),l},w.prototype.diff_toDelta=function(c){for(var l=[],g=0;g<c.length;g++)switch(c[g][0]){case D:l[g]="+"+encodeURI(c[g][1]);break;case C:l[g]="-"+c[g][1].length;break;case A:l[g]="="+c[g][1].length;break}return l.join(" ").replace(/%20/g," ")},w.prototype.diff_fromDelta=function(c,l){for(var g=[],p=0,h=0,d=l.split(/\t/g),E=0;E<d.length;E++){var v=d[E].substring(1);switch(d[E].charAt(0)){case"+":try{g[p++]=new w.Diff(D,decodeURI(v))}catch{throw new Error("Illegal escape in diff_fromDelta: "+v)}break;case"-":case"=":var b=parseInt(v,10);if(isNaN(b)||b<0)throw new Error("Invalid number in diff_fromDelta: "+v);var y=c.substring(h,h+=b);d[E].charAt(0)=="="?g[p++]=new w.Diff(A,y):g[p++]=new w.Diff(C,y);break;default:if(d[E])throw new Error("Invalid diff operation in diff_fromDelta: "+d[E])}}if(h!=c.length)throw new Error("Delta length ("+h+") does not equal source text length ("+c.length+").");return g},w.prototype.match_main=function(c,l,g){if(c==null||l==null||g==null)throw new Error("Null input. (match_main)");return g=Math.max(0,Math.min(g,c.length)),c==l?0:c.length?c.substring(g,g+l.length)==l?g:this.match_bitap_(c,l,g):-1},w.prototype.match_bitap_=function(c,l,g){if(l.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var p=this.match_alphabet_(l),h=this;function d(ue,ve){var me=ue/l.length,de=Math.abs(g-ve);return h.Match_Distance?me+de/h.Match_Distance:de?1:me}var E=this.Match_Threshold,v=c.indexOf(l,g);v!=-1&&(E=Math.min(d(0,v),E),v=c.lastIndexOf(l,g+l.length),v!=-1&&(E=Math.min(d(0,v),E)));var b=1<<l.length-1;v=-1;for(var y,s,k=l.length+c.length,x,H=0;H<l.length;H++){for(y=0,s=k;y<s;)d(H,g+s)<=E?y=s:k=s,s=Math.floor((k-y)/2+y);k=s;var _=Math.max(1,g-s+1),B=Math.min(g+s,c.length)+l.length,z=Array(B+2);z[B+1]=(1<<H)-1;for(var Z=B;Z>=_;Z--){var ne=p[c.charAt(Z-1)];if(H===0?z[Z]=(z[Z+1]<<1|1)&ne:z[Z]=(z[Z+1]<<1|1)&ne|((x[Z+1]|x[Z])<<1|1)|x[Z+1],z[Z]&b){var ae=d(H,Z-1);if(ae<=E)if(E=ae,v=Z-1,v>g)_=Math.max(1,2*g-v);else break}}if(d(H+1,g)>E)break;x=z}return v},w.prototype.match_alphabet_=function(c){for(var l={},g=0;g<c.length;g++)l[c.charAt(g)]=0;for(var g=0;g<c.length;g++)l[c.charAt(g)]|=1<<c.length-g-1;return l},w.prototype.patch_addContext_=function(c,l){if(l.length!=0){if(c.start2===null)throw Error("patch not initialized");for(var g=l.substring(c.start2,c.start2+c.length1),p=0;l.indexOf(g)!=l.lastIndexOf(g)&&g.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)p+=this.Patch_Margin,g=l.substring(c.start2-p,c.start2+c.length1+p);p+=this.Patch_Margin;var h=l.substring(c.start2-p,c.start2);h&&c.diffs.unshift(new w.Diff(A,h));var d=l.substring(c.start2+c.length1,c.start2+c.length1+p);d&&c.diffs.push(new w.Diff(A,d)),c.start1-=h.length,c.start2-=h.length,c.length1+=h.length+d.length,c.length2+=h.length+d.length}},w.prototype.patch_make=function(c,l,g){var p,h;if(typeof c=="string"&&typeof l=="string"&&typeof g>"u")p=c,h=this.diff_main(p,l,!0),h.length>2&&(this.diff_cleanupSemantic(h),this.diff_cleanupEfficiency(h));else if(c&&typeof c=="object"&&typeof l>"u"&&typeof g>"u")h=c,p=this.diff_text1(h);else if(typeof c=="string"&&l&&typeof l=="object"&&typeof g>"u")p=c,h=l;else if(typeof c=="string"&&typeof l=="string"&&g&&typeof g=="object")p=c,h=g;else throw new Error("Unknown call format to patch_make.");if(h.length===0)return[];for(var d=[],E=new w.patch_obj,v=0,b=0,y=0,s=p,k=p,x=0;x<h.length;x++){var H=h[x][0],_=h[x][1];switch(!v&&H!==A&&(E.start1=b,E.start2=y),H){case D:E.diffs[v++]=h[x],E.length2+=_.length,k=k.substring(0,y)+_+k.substring(y);break;case C:E.length1+=_.length,E.diffs[v++]=h[x],k=k.substring(0,y)+k.substring(y+_.length);break;case A:_.length<=2*this.Patch_Margin&&v&&h.length!=x+1?(E.diffs[v++]=h[x],E.length1+=_.length,E.length2+=_.length):_.length>=2*this.Patch_Margin&&v&&(this.patch_addContext_(E,s),d.push(E),E=new w.patch_obj,v=0,s=k,b=y);break}H!==D&&(b+=_.length),H!==C&&(y+=_.length)}return v&&(this.patch_addContext_(E,s),d.push(E)),d},w.prototype.patch_deepCopy=function(c){for(var l=[],g=0;g<c.length;g++){var p=c[g],h=new w.patch_obj;h.diffs=[];for(var d=0;d<p.diffs.length;d++)h.diffs[d]=new w.Diff(p.diffs[d][0],p.diffs[d][1]);h.start1=p.start1,h.start2=p.start2,h.length1=p.length1,h.length2=p.length2,l[g]=h}return l},w.prototype.patch_apply=function(c,l){if(c.length==0)return[l,[]];c=this.patch_deepCopy(c);var g=this.patch_addPadding(c);l=g+l+g,this.patch_splitMax(c);for(var p=0,h=[],d=0;d<c.length;d++){var E=c[d].start2+p,v=this.diff_text1(c[d].diffs),b,y=-1;if(v.length>this.Match_MaxBits?(b=this.match_main(l,v.substring(0,this.Match_MaxBits),E),b!=-1&&(y=this.match_main(l,v.substring(v.length-this.Match_MaxBits),E+v.length-this.Match_MaxBits),(y==-1||b>=y)&&(b=-1))):b=this.match_main(l,v,E),b==-1)h[d]=!1,p-=c[d].length2-c[d].length1;else{h[d]=!0,p=b-E;var s;if(y==-1?s=l.substring(b,b+v.length):s=l.substring(b,y+this.Match_MaxBits),v==s)l=l.substring(0,b)+this.diff_text2(c[d].diffs)+l.substring(b+v.length);else{var k=this.diff_main(v,s,!1);if(v.length>this.Match_MaxBits&&this.diff_levenshtein(k)/v.length>this.Patch_DeleteThreshold)h[d]=!1;else{this.diff_cleanupSemanticLossless(k);for(var x=0,H,_=0;_<c[d].diffs.length;_++){var B=c[d].diffs[_];B[0]!==A&&(H=this.diff_xIndex(k,x)),B[0]===D?l=l.substring(0,b+H)+B[1]+l.substring(b+H):B[0]===C&&(l=l.substring(0,b+H)+l.substring(b+this.diff_xIndex(k,x+B[1].length))),B[0]!==C&&(x+=B[1].length)}}}}}return l=l.substring(g.length,l.length-g.length),[l,h]},w.prototype.patch_addPadding=function(c){for(var l=this.Patch_Margin,g="",p=1;p<=l;p++)g+=String.fromCharCode(p);for(var p=0;p<c.length;p++)c[p].start1+=l,c[p].start2+=l;var h=c[0],d=h.diffs;if(d.length==0||d[0][0]!=A)d.unshift(new w.Diff(A,g)),h.start1-=l,h.start2-=l,h.length1+=l,h.length2+=l;else if(l>d[0][1].length){var E=l-d[0][1].length;d[0][1]=g.substring(d[0][1].length)+d[0][1],h.start1-=E,h.start2-=E,h.length1+=E,h.length2+=E}if(h=c[c.length-1],d=h.diffs,d.length==0||d[d.length-1][0]!=A)d.push(new w.Diff(A,g)),h.length1+=l,h.length2+=l;else if(l>d[d.length-1][1].length){var E=l-d[d.length-1][1].length;d[d.length-1][1]+=g.substring(0,E),h.length1+=E,h.length2+=E}return g},w.prototype.patch_splitMax=function(c){for(var l=this.Match_MaxBits,g=0;g<c.length;g++)if(!(c[g].length1<=l)){var p=c[g];c.splice(g--,1);for(var h=p.start1,d=p.start2,E="";p.diffs.length!==0;){var v=new w.patch_obj,b=!0;for(v.start1=h-E.length,v.start2=d-E.length,E!==""&&(v.length1=v.length2=E.length,v.diffs.push(new w.Diff(A,E)));p.diffs.length!==0&&v.length1<l-this.Patch_Margin;){var y=p.diffs[0][0],s=p.diffs[0][1];y===D?(v.length2+=s.length,d+=s.length,v.diffs.push(p.diffs.shift()),b=!1):y===C&&v.diffs.length==1&&v.diffs[0][0]==A&&s.length>2*l?(v.length1+=s.length,h+=s.length,b=!1,v.diffs.push(new w.Diff(y,s)),p.diffs.shift()):(s=s.substring(0,l-v.length1-this.Patch_Margin),v.length1+=s.length,h+=s.length,y===A?(v.length2+=s.length,d+=s.length):b=!1,v.diffs.push(new w.Diff(y,s)),s==p.diffs[0][1]?p.diffs.shift():p.diffs[0][1]=p.diffs[0][1].substring(s.length))}E=this.diff_text2(v.diffs),E=E.substring(E.length-this.Patch_Margin);var k=this.diff_text1(p.diffs).substring(0,this.Patch_Margin);k!==""&&(v.length1+=k.length,v.length2+=k.length,v.diffs.length!==0&&v.diffs[v.diffs.length-1][0]===A?v.diffs[v.diffs.length-1][1]+=k:v.diffs.push(new w.Diff(A,k))),b||c.splice(++g,0,v)}}},w.prototype.patch_toText=function(c){for(var l=[],g=0;g<c.length;g++)l[g]=c[g];return l.join("")},w.prototype.patch_fromText=function(c){var l=[];if(!c)return l;for(var g=c.split(`
28
- `),p=0,h=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;p<g.length;){var d=g[p].match(h);if(!d)throw new Error("Invalid patch string: "+g[p]);var E=new w.patch_obj;for(l.push(E),E.start1=parseInt(d[1],10),d[2]===""?(E.start1--,E.length1=1):d[2]=="0"?E.length1=0:(E.start1--,E.length1=parseInt(d[2],10)),E.start2=parseInt(d[3],10),d[4]===""?(E.start2--,E.length2=1):d[4]=="0"?E.length2=0:(E.start2--,E.length2=parseInt(d[4],10)),p++;p<g.length;){var v=g[p].charAt(0);try{var b=decodeURI(g[p].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+b)}if(v=="-")E.diffs.push(new w.Diff(C,b));else if(v=="+")E.diffs.push(new w.Diff(D,b));else if(v==" ")E.diffs.push(new w.Diff(A,b));else{if(v=="@")break;if(v!=="")throw new Error('Invalid patch mode "'+v+'" in: '+b)}p++}}return l},w.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},w.patch_obj.prototype.toString=function(){var c,l;this.length1===0?c=this.start1+",0":this.length1==1?c=this.start1+1:c=this.start1+1+","+this.length1,this.length2===0?l=this.start2+",0":this.length2==1?l=this.start2+1:l=this.start2+1+","+this.length2;for(var g=["@@ -"+c+" +"+l+` @@
29
- `],p,h=0;h<this.diffs.length;h++){switch(this.diffs[h][0]){case D:p="+";break;case C:p="-";break;case A:p=" ";break}g[h+1]=p+encodeURI(this.diffs[h][1])+`
30
- `}return g.join("").replace(/%20/g," ")},I.exports=w,I.exports.diff_match_patch=w,I.exports.DIFF_DELETE=C,I.exports.DIFF_INSERT=D,I.exports.DIFF_EQUAL=A}),408:((I,w,C)=>{C.d(w,{default:()=>$e});var D=C(135),A=C(840),c=C(775),l=C(428),g=C(325),p=C(483),h=C(999),d=function(j){j===void 0&&(j=document);var oe=function(K){var V=document.createElement("img");V.src=K.getAttribute("data-src"),V.addEventListener("load",function(){!K.getAttribute("style")&&!K.getAttribute("class")&&!K.getAttribute("width")&&!K.getAttribute("height")&&V.naturalHeight>V.naturalWidth&&V.naturalWidth/V.naturalHeight<document.querySelector(".vditor-reset").clientWidth/(window.innerHeight-40)&&V.naturalHeight>window.innerHeight-40&&(K.style.height=window.innerHeight-40+"px"),K.src=V.src}),K.removeAttribute("data-src")};if(!("IntersectionObserver"in window))return j.querySelectorAll("img").forEach(function(K){K.getAttribute("data-src")&&oe(K)}),!1;window.vditorImageIntersectionObserver?(window.vditorImageIntersectionObserver.disconnect(),j.querySelectorAll("img").forEach(function(K){window.vditorImageIntersectionObserver.observe(K)})):(window.vditorImageIntersectionObserver=new IntersectionObserver(function(K){K.forEach(function(V){(typeof V.isIntersecting>"u"?V.intersectionRatio!==0:V.isIntersecting)&&V.target.getAttribute("data-src")&&oe(V.target)})}),j.querySelectorAll("img").forEach(function(K){window.vditorImageIntersectionObserver.observe(K)}))},E=C(472),v=C(280),b=C(637),y=C(825),s=C(11),k=C(194),x=C(436),H=C(229),_=C(145),B=C(538),z=C(413),Z=C(106),ne=C(673),ae=function(j){document.querySelectorAll(".vditor-anchor").forEach(function(oe){j===1&&oe.classList.add("vditor-anchor--left"),oe.onclick=function(){var K=oe.getAttribute("href").substr(1),V=document.getElementById("vditorAnchor-"+K).offsetTop;document.querySelector("html").scrollTop=V}}),window.onhashchange=function(){var oe=document.getElementById("vditorAnchor-"+decodeURIComponent(window.location.hash.substr(1)));oe&&(document.querySelector("html").scrollTop=oe.offsetTop)}},ue=C(214),ve=C(810),me=function(j,oe){if(oe===void 0&&(oe="zh_CN"),!(typeof speechSynthesis>"u"||typeof SpeechSynthesisUtterance>"u")){var K=function(){var Ae=speechSynthesis.getVoices(),ee,ge;return Ae.forEach(function(Re){Re.lang===oe.replace("_","-")&&(ee=Re),Re.default&&(ge=Re)}),ee||(ee=ge),ee},V='<svg><use xlink:href="#vditor-icon-play"></use></svg>',ye='<svg><use xlink:href="#vditor-icon-pause"></use></svg>';document.getElementById("vditorIconScript")||(V='<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>',ye='<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');var $=document.querySelector(".vditor-speech");$||($=document.createElement("button"),$.className="vditor-speech",j.insertAdjacentElement("beforeend",$),speechSynthesis.onvoiceschanged!==void 0&&(speechSynthesis.onvoiceschanged=K));var Ee=K(),le=new SpeechSynthesisUtterance;le.voice=Ee,le.onend=le.onerror=function(){$.style.display="none",speechSynthesis.cancel(),$.classList.remove("vditor-speech--current"),$.innerHTML=V},j.addEventListener(window.ontouchstart!==void 0?"touchend":"click",function(Ae){var ee=Ae.target;if(ee.classList.contains("vditor-speech")||ee.parentElement.classList.contains("vditor-speech")){$.classList.contains("vditor-speech--current")?speechSynthesis.speaking&&(speechSynthesis.paused?(speechSynthesis.resume(),$.innerHTML=ye):(speechSynthesis.pause(),$.innerHTML=V)):(le.text=$.getAttribute("data-text"),speechSynthesis.speak(le),$.classList.add("vditor-speech--current"),$.innerHTML=ye),(0,ve.Hc)(window.vditorSpeechRange),j.focus();return}if($.style.display="none",speechSynthesis.cancel(),$.classList.remove("vditor-speech--current"),$.innerHTML=V,getSelection().rangeCount!==0){var ge=getSelection().getRangeAt(0),Re=ge.toString().trim();if(Re){window.vditorSpeechRange=ge.cloneRange();var je=ge.getBoundingClientRect();$.innerHTML=V,$.style.display="block",$.style.top=je.top+je.height+document.querySelector("html").scrollTop-20+"px",window.ontouchstart!==void 0?$.style.left=Ae.changedTouches[Ae.changedTouches.length-1].pageX+2+"px":$.style.left=Ae.clientX+2+"px",$.setAttribute("data-text",Re)}}})}},de=function(j,oe,K,V){function ye($){return $ instanceof K?$:new K(function(Ee){Ee($)})}return new(K||(K=Promise))(function($,Ee){function le(ge){try{ee(V.next(ge))}catch(Re){Ee(Re)}}function Ae(ge){try{ee(V.throw(ge))}catch(Re){Ee(Re)}}function ee(ge){ge.done?$(ge.value):ye(ge.value).then(le,Ae)}ee((V=V.apply(j,oe||[])).next())})},Ce=function(j,oe){var K={label:0,sent:function(){if($[0]&1)throw $[1];return $[1]},trys:[],ops:[]},V,ye,$,Ee;return Ee={next:le(0),throw:le(1),return:le(2)},typeof Symbol=="function"&&(Ee[Symbol.iterator]=function(){return this}),Ee;function le(ee){return function(ge){return Ae([ee,ge])}}function Ae(ee){if(V)throw new TypeError("Generator is already executing.");for(;Ee&&(Ee=0,ee[0]&&(K=0)),K;)try{if(V=1,ye&&($=ee[0]&2?ye.return:ee[0]?ye.throw||(($=ye.return)&&$.call(ye),0):ye.next)&&!($=$.call(ye,ee[1])).done)return $;switch(ye=0,$&&(ee=[ee[0]&2,$.value]),ee[0]){case 0:case 1:$=ee;break;case 4:return K.label++,{value:ee[1],done:!1};case 5:K.label++,ye=ee[1],ee=[0];continue;case 7:ee=K.ops.pop(),K.trys.pop();continue;default:if($=K.trys,!($=$.length>0&&$[$.length-1])&&(ee[0]===6||ee[0]===2)){K=0;continue}if(ee[0]===3&&(!$||ee[1]>$[0]&&ee[1]<$[3])){K.label=ee[1];break}if(ee[0]===6&&K.label<$[1]){K.label=$[1],$=ee;break}if($&&K.label<$[2]){K.label=$[2],K.ops.push(ee);break}$[2]&&K.ops.pop(),K.trys.pop();continue}ee=oe.call(j,K)}catch(ge){ee=[6,ge],ye=0}finally{V=$=0}if(ee[0]&5)throw ee[1];return{value:ee[0]?ee[1]:void 0,done:!0}}},De=function(j){var oe,K={anchor:0,cdn:_.g.CDN,customEmoji:{},emojiPath:"".concat(_.g.CDN,"/dist/images/emoji"),hljs:_.g.HLJS_OPTIONS,icon:"ant",lang:"zh_CN",markdown:_.g.MARKDOWN_OPTIONS,math:_.g.MATH_OPTIONS,mode:"light",speech:{enable:!1},render:{media:{enable:!0}},theme:_.g.THEME_OPTIONS};return j.cdn&&(!((oe=j.theme)===null||oe===void 0)&&oe.path||(K.theme.path="".concat(j.cdn,"/dist/css/content-theme")),j.emojiPath||(K.emojiPath="".concat(j.cdn,"/dist/images/emoji"))),(0,ne.T)(K,j)},_e=function(j,oe){var K=De(oe);return(0,z.G)("".concat(K.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){var V=(0,ue.X)({autoSpace:K.markdown.autoSpace,gfmAutoLink:K.markdown.gfmAutoLink,codeBlockPreview:K.markdown.codeBlockPreview,emojiSite:K.emojiPath,emojis:K.customEmoji,fixTermTypo:K.markdown.fixTermTypo,footnotes:K.markdown.footnotes,headingAnchor:K.anchor!==0,inlineMathDigit:K.math.inlineDigit,lazyLoadImage:K.lazyLoadImage,linkBase:K.markdown.linkBase,linkPrefix:K.markdown.linkPrefix,listStyle:K.markdown.listStyle,mark:K.markdown.mark,mathBlockPreview:K.markdown.mathBlockPreview,paragraphBeginningSpace:K.markdown.paragraphBeginningSpace,sanitize:K.markdown.sanitize,toc:K.markdown.toc});return oe?.renderers&&V.SetJSRenderers({renderers:{Md2HTML:oe.renderers}}),V.SetHeadingID(!0),V.Md2HTML(j)})},M=function(j,oe,K){return de(void 0,void 0,void 0,function(){var V,ye,$,Ee;return Ce(this,function(le){switch(le.label){case 0:return V=De(K),[4,_e(oe,V)];case 1:if(ye=le.sent(),V.transform&&(ye=V.transform(ye)),j.innerHTML=ye,j.classList.add("vditor-reset"),V.i18n)return[3,5];if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","zh_CN","zh_TW"].includes(V.lang))return[3,2];throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");case 2:return $="vditorI18nScript",Ee=$+V.lang,document.querySelectorAll('head script[id^="'.concat($,'"]')).forEach(function(Ae){Ae.id!==Ee&&document.head.removeChild(Ae)}),[4,(0,z.G)("".concat(V.cdn,"/dist/js/i18n/").concat(V.lang,".js"),Ee)];case 3:le.sent(),le.label=4;case 4:return[3,6];case 5:window.VditorI18n=V.i18n,le.label=6;case 6:return V.icon?[4,(0,z.G)("".concat(V.cdn,"/dist/js/icons/").concat(V.icon,".js"),"vditorIconScript")]:[3,8];case 7:le.sent(),le.label=8;case 8:return(0,B.Z)(V.theme.current,V.theme.path),V.anchor===1&&j.classList.add("vditor-reset--anchor"),(0,l.O)(j,V.hljs),(0,h.s)(V.hljs,j,V.cdn),(0,E.H)(j,{cdn:V.cdn,math:V.math}),(0,b.i)(j,V.cdn,V.mode),(0,y.J)(j,V.cdn,V.mode),(0,s.K)(j,V.cdn),(0,g.P)(j,V.cdn),(0,p.v)(j,V.cdn),(0,c.p)(j,V.cdn,V.mode),(0,k.P)(j,V.cdn,V.mode),(0,H.B)(j,V.cdn),(0,D.Q)(j,V.cdn),V.render.media.enable&&(0,v.Y)(j),V.speech.enable&&me(j),V.anchor!==0&&ae(V.anchor),V.after&&V.after(),V.lazyLoadImage&&d(j),j.addEventListener("click",function(Ae){var ee=(0,Z.lG)(Ae.target,"SPAN");if(ee&&(0,Z.fb)(ee,"vditor-toc")){var ge=j.querySelector("#"+ee.getAttribute("data-target-id"));ge&&window.scrollTo(window.scrollX,ge.offsetTop);return}}),[2]}})})},Fe=C(190),wt=C(580),vt=(function(){function j(){}return j.adapterRender=A,j.previewImage=Fe.E,j.codeRender=l.O,j.graphvizRender=p.v,j.highlightRender=h.s,j.mathRender=E.H,j.mermaidRender=b.i,j.SMILESRender=y.J,j.markmapRender=s.K,j.flowchartRender=g.P,j.chartRender=c.p,j.abcRender=D.Q,j.mindmapRender=k.P,j.plantumlRender=H.B,j.outlineRender=x.k,j.mediaRender=v.Y,j.speechRender=me,j.lazyLoadImageRender=d,j.md2html=_e,j.preview=M,j.setCodeTheme=wt.Y,j.setContentTheme=B.Z,j})();const $e=vt}),145:((I,w,C)=>{C.d(w,{H:()=>D,g:()=>A});var D="3.11.2",A=(function(){function c(){}return c.ZWSP="​",c.DROP_EDITOR="application/editor",c.MOBILE_WIDTH=520,c.CLASS_MENU_DISABLED="vditor-menu--disabled",c.EDIT_TOOLBARS=["emoji","headings","bold","italic","strike","link","list","ordered-list","outdent","indent","check","line","quote","code","inline-code","insert-after","insert-before","upload","record","table"],c.CODE_THEME=["a11y-dark","agate","an-old-hope","androidstudio","arta","atom-one-dark","atom-one-dark-reasonable","base16/3024","base16/apathy","base16/apprentice","base16/ashes","base16/atelier-cave","base16/atelier-dune","base16/atelier-estuary","base16/atelier-forest","base16/atelier-heath","base16/atelier-lakeside","base16/atelier-plateau","base16/atelier-savanna","base16/atelier-seaside","base16/atelier-sulphurpool","base16/atlas","base16/bespin","base16/black-metal","base16/black-metal-bathory","base16/black-metal-burzum","base16/black-metal-dark-funeral","base16/black-metal-gorgoroth","base16/black-metal-immortal","base16/black-metal-khold","base16/black-metal-marduk","base16/black-metal-mayhem","base16/black-metal-nile","base16/black-metal-venom","base16/brewer","base16/bright","base16/brogrammer","base16/brush-trees-dark","base16/chalk","base16/circus","base16/classic-dark","base16/codeschool","base16/colors","base16/danqing","base16/darcula","base16/dark-violet","base16/darkmoss","base16/darktooth","base16/decaf","base16/default-dark","base16/dracula","base16/edge-dark","base16/eighties","base16/embers","base16/equilibrium-dark","base16/equilibrium-gray-dark","base16/espresso","base16/eva","base16/eva-dim","base16/flat","base16/framer","base16/gigavolt","base16/google-dark","base16/grayscale-dark","base16/green-screen","base16/gruvbox-dark-hard","base16/gruvbox-dark-medium","base16/gruvbox-dark-pale","base16/gruvbox-dark-soft","base16/hardcore","base16/harmonic16-dark","base16/heetch-dark","base16/helios","base16/hopscotch","base16/horizon-dark","base16/humanoid-dark","base16/ia-dark","base16/icy-dark","base16/ir-black","base16/isotope","base16/kimber","base16/london-tube","base16/macintosh","base16/marrakesh","base16/materia","base16/material","base16/material-darker","base16/material-palenight","base16/material-vivid","base16/mellow-purple","base16/mocha","base16/monokai","base16/nebula","base16/nord","base16/nova","base16/ocean","base16/oceanicnext","base16/onedark","base16/outrun-dark","base16/papercolor-dark","base16/paraiso","base16/pasque","base16/phd","base16/pico","base16/pop","base16/porple","base16/qualia","base16/railscasts","base16/rebecca","base16/ros-pine","base16/ros-pine-moon","base16/sandcastle","base16/seti-ui","base16/silk-dark","base16/snazzy","base16/solar-flare","base16/solarized-dark","base16/spacemacs","base16/summercamp","base16/summerfruit-dark","base16/synth-midnight-terminal-dark","base16/tango","base16/tender","base16/tomorrow-night","base16/twilight","base16/unikitty-dark","base16/vulcan","base16/windows-10","base16/windows-95","base16/windows-high-contrast","base16/windows-nt","base16/woodland","base16/xcode-dusk","base16/zenburn","codepen-embed","dark","devibeans","far","felipec","github-dark","github-dark-dimmed","gml","gradient-dark","hybrid","ir-black","isbl-editor-dark","kimbie-dark","lioshi","monokai","monokai-sublime","night-owl","nnfx-dark","nord","obsidian","panda-syntax-dark","paraiso-dark","pojoaque","qtcreator-dark","rainbow","shades-of-purple","srcery","stackoverflow-dark","sunburst","tomorrow-night-blue","tomorrow-night-bright","tokyo-night-dark","vs2015","xt256","ant-design","a11y-light","arduino-light","ascetic","atom-one-light","base16/atelier-cave-light","base16/atelier-dune-light","base16/atelier-estuary-light","base16/atelier-forest-light","base16/atelier-heath-light","base16/atelier-lakeside-light","base16/atelier-plateau-light","base16/atelier-savanna-light","base16/atelier-seaside-light","base16/atelier-sulphurpool-light","base16/brush-trees","base16/classic-light","base16/cupcake","base16/cupertino","base16/default-light","base16/dirtysea","base16/edge-light","base16/equilibrium-gray-light","base16/equilibrium-light","base16/fruit-soda","base16/github","base16/google-light","base16/grayscale-light","base16/gruvbox-light-hard","base16/gruvbox-light-medium","base16/gruvbox-light-soft","base16/harmonic16-light","base16/heetch-light","base16/humanoid-light","base16/horizon-light","base16/ia-light","base16/material-lighter","base16/mexico-light","base16/one-light","base16/papercolor-light","base16/ros-pine-dawn","base16/sagelight","base16/shapeshifter","base16/silk-light","base16/solar-flare-light","base16/solarized-light","base16/summerfruit-light","base16/synth-midnight-terminal-light","base16/tomorrow","base16/unikitty-light","base16/windows-10-light","base16/windows-95-light","base16/windows-high-contrast-light","brown-paper","base16/windows-nt-light","color-brewer","docco","foundation","github","googlecode","gradient-light","grayscale","idea","intellij-light","isbl-editor-light","kimbie-light","lightfair","magula","mono-blue","nnfx-light","panda-syntax-light","paraiso-light","purebasic","qtcreator-light","routeros","school-book","stackoverflow-light","tokyo-night-light","vs","xcode","default"],c.ALIAS_CODE_LANGUAGES=["abc","plantuml","mermaid","flowchart","echarts","mindmap","graphviz","math","markmap","smiles","js","ts","html","toml","c#","bat"],c.CDN="https://unpkg.com/vditor@".concat("3.11.2"),c.MARKDOWN_OPTIONS={autoSpace:!1,gfmAutoLink:!0,codeBlockPreview:!0,fixTermTypo:!1,footnotes:!0,linkBase:"",linkPrefix:"",listStyle:!1,mark:!1,mathBlockPreview:!0,paragraphBeginningSpace:!1,sanitize:!0,toc:!1},c.HLJS_OPTIONS={enable:!0,lineNumber:!1,defaultLang:"",style:"github"},c.MATH_OPTIONS={engine:"KaTeX",inlineDigit:!1,macros:{}},c.THEME_OPTIONS={current:"light",list:{"ant-design":"Ant Design",dark:"Dark",light:"Light",wechat:"WeChat"},path:"".concat(c.CDN,"/dist/css/content-theme")},c})()}),825:((I,w,C)=>{C.d(w,{J:()=>g});var D=C(145),A=C(413),c=C(840),l=C(494),g=function(p,h,d){p===void 0&&(p=document),h===void 0&&(h=D.g.CDN);var E=c.SMILESRenderAdapter.getElements(p);E.length>0&&(0,A.G)("".concat(h,"/dist/js/smiles-drawer/smiles-drawer.min.js?v=2.1.7"),"vditorAbcjsScript").then(function(){var v=new SmiDrawer({},{});E.forEach(function(b){var y=c.SMILESRenderAdapter.getCode(b).trim();if(!(b.getAttribute("data-processed")==="true"||y.trim()==="")){var s="smiles"+(0,l.Wb)();b.innerHTML='<svg id="'.concat(s,'"></svg>'),v.draw(y,"#"+s,d==="dark"?"dark":void 0),b.setAttribute("data-processed","true")}})})}}),135:((I,w,C)=>{C.d(w,{Q:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){g===void 0&&(g=document),p===void 0&&(p=D.g.CDN);var h=c.abcRenderAdapter.getElements(g);h.length>0&&(0,A.G)("".concat(p,"/dist/js/abcjs/abcjs_basic.min.js"),"vditorAbcjsScript").then(function(){h.forEach(function(d){d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre")||d.getAttribute("data-processed")!=="true"&&(ABCJS.renderAbc(d,c.abcRenderAdapter.getCode(d).trim()),d.style.overflowX="auto",d.setAttribute("data-processed","true"))})})}}),840:((I,w,C)=>{C.r(w),C.d(w,{mathRenderAdapter:()=>D,SMILESRenderAdapter:()=>A,mermaidRenderAdapter:()=>c,markmapRenderAdapter:()=>l,mindmapRenderAdapter:()=>g,chartRenderAdapter:()=>p,abcRenderAdapter:()=>h,graphvizRenderAdapter:()=>d,flowchartRenderAdapter:()=>E,plantumlRenderAdapter:()=>v});var D={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-math")}},A={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-smiles")}},c={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-mermaid")}},l={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-markmap")}},g={getCode:function(b){return b.getAttribute("data-code")},getElements:function(b){return b.querySelectorAll(".language-mindmap")}},p={getCode:function(b){return b.innerText},getElements:function(b){return b.querySelectorAll(".language-echarts")}},h={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-abc")}},d={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-graphviz")}},E={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-flowchart")}},v={getCode:function(b){return b.textContent},getElements:function(b){return b.querySelectorAll(".language-plantuml")}}}),775:((I,w,C)=>{C.d(w,{p:()=>h});var D=C(145),A=C(413),c=C(840),l=C(494),g=function(d,E,v,b){function y(s){return s instanceof v?s:new v(function(k){k(s)})}return new(v||(v=Promise))(function(s,k){function x(B){try{_(b.next(B))}catch(z){k(z)}}function H(B){try{_(b.throw(B))}catch(z){k(z)}}function _(B){B.done?s(B.value):y(B.value).then(x,H)}_((b=b.apply(d,E||[])).next())})},p=function(d,E){var v={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,y,s,k;return k={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function x(_){return function(B){return H([_,B])}}function H(_){if(b)throw new TypeError("Generator is already executing.");for(;k&&(k=0,_[0]&&(v=0)),v;)try{if(b=1,y&&(s=_[0]&2?y.return:_[0]?y.throw||((s=y.return)&&s.call(y),0):y.next)&&!(s=s.call(y,_[1])).done)return s;switch(y=0,s&&(_=[_[0]&2,s.value]),_[0]){case 0:case 1:s=_;break;case 4:return v.label++,{value:_[1],done:!1};case 5:v.label++,y=_[1],_=[0];continue;case 7:_=v.ops.pop(),v.trys.pop();continue;default:if(s=v.trys,!(s=s.length>0&&s[s.length-1])&&(_[0]===6||_[0]===2)){v=0;continue}if(_[0]===3&&(!s||_[1]>s[0]&&_[1]<s[3])){v.label=_[1];break}if(_[0]===6&&v.label<s[1]){v.label=s[1],s=_;break}if(s&&v.label<s[2]){v.label=s[2],v.ops.push(_);break}s[2]&&v.ops.pop(),v.trys.pop();continue}_=E.call(d,v)}catch(B){_=[6,B],y=0}finally{b=s=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},h=function(d,E,v){d===void 0&&(d=document),E===void 0&&(E=D.g.CDN);var b=c.chartRenderAdapter.getElements(d);b.length>0&&(0,A.G)("".concat(E,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){b.forEach(function(y){return g(void 0,void 0,void 0,function(){var s,k,x;return p(this,function(H){switch(H.label){case 0:if(y.parentElement.classList.contains("vditor-wysiwyg__pre")||y.parentElement.classList.contains("vditor-ir__marker--pre"))return[2];if(s=c.chartRenderAdapter.getCode(y).trim(),!s)return[2];H.label=1;case 1:return H.trys.push([1,3,,4]),y.getAttribute("data-processed")==="true"?[2]:[4,(0,l.Qf)(s)];case 2:return k=H.sent(),echarts.init(y,v==="dark"?"dark":void 0).setOption(k),y.setAttribute("data-processed","true"),[3,4];case 3:return x=H.sent(),y.className="vditor-reset--error",y.innerHTML="echarts render error: <br>".concat(x),[3,4];case 4:return[2]}})})})})}}),428:((I,w,C)=>{C.d(w,{O:()=>c});var D=C(105),A=C(145),c=function(l,g){Array.from(l.querySelectorAll("pre > code")).filter(function(p,h){return!(p.parentElement.classList.contains("vditor-wysiwyg__pre")||p.parentElement.classList.contains("vditor-ir__marker--pre")||p.classList.contains("language-mermaid")||p.classList.contains("language-flowchart")||p.classList.contains("language-echarts")||p.classList.contains("language-mindmap")||p.classList.contains("language-plantuml")||p.classList.contains("language-markmap")||p.classList.contains("language-abc")||p.classList.contains("language-graphviz")||p.classList.contains("language-math")||p.classList.contains("language-smiles")||p.style.maxHeight.indexOf("px")>-1||l.classList.contains("vditor-preview")&&h>5)}).forEach(function(p){var h,d,E,v=p.innerText;if(p.classList.contains("highlight-chroma")){var b=p.cloneNode(!0);b.querySelectorAll(".highlight-ln").forEach(function(x){x.remove()}),v=b.innerText}else v.endsWith(`
31
- `)&&(v=v.substr(0,v.length-1));var y='<svg><use xlink:href="#vditor-icon-copy"></use></svg>';document.getElementById("vditorIconScript")||(y='<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>');var s=document.createElement("div");s.className="vditor-copy",s.innerHTML='<span aria-label="'.concat(((h=window.VditorI18n)===null||h===void 0?void 0:h.copy)||"复制",`"
32
- onmouseover="this.setAttribute('aria-label', '`).concat(((d=window.VditorI18n)===null||d===void 0?void 0:d.copy)||"复制",`')"
33
- class="vditor-tooltipped vditor-tooltipped__w"
34
- onclick="event.stopPropagation();this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '`).concat(((E=window.VditorI18n)===null||E===void 0?void 0:E.copied)||"已复制",`');this.previousElementSibling.blur()">`).concat(y,"</span>");var k=document.createElement("textarea");k.value=(0,D.X)(v),s.insertAdjacentElement("afterbegin",k),g&&g.renderMenu&&g.renderMenu(p,s),p.before(s),p.style.maxHeight=window.outerHeight-40+"px",p.insertAdjacentHTML("afterend",'<span style="position: absolute">'.concat(A.g.ZWSP,"</span>"))})}}),325:((I,w,C)=>{C.d(w,{P:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){p===void 0&&(p=D.g.CDN);var h=c.flowchartRenderAdapter.getElements(g);h.length!==0&&(0,A.G)("".concat(p,"/dist/js/flowchart.js/flowchart.min.js"),"vditorFlowchartScript").then(function(){h.forEach(function(d){if(d.getAttribute("data-processed")!=="true"){var E=flowchart.parse(c.flowchartRenderAdapter.getCode(d));d.innerHTML="",E.drawSVG(d),d.setAttribute("data-processed","true")}})})}}),483:((I,w,C)=>{C.d(w,{v:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){p===void 0&&(p=D.g.CDN);var h=c.graphvizRenderAdapter.getElements(g);h.length!==0&&(0,A.G)("".concat(p,"/dist/js/graphviz/viz.js"),"vditorGraphVizScript").then(function(){h.forEach(function(d){var E=c.graphvizRenderAdapter.getCode(d);if(!(d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre"))&&!(d.getAttribute("data-processed")==="true"||E.trim()==="")){try{var v=new Blob(["importScripts('".concat(document.getElementById("vditorGraphVizScript").src.replace("viz.js","full.render.js"),"');")],{type:"application/javascript"}),b=window.URL||window.webkitURL,y=b.createObjectURL(v),s=new Worker(y);new Viz({worker:s}).renderSVGElement(E).then(function(k){d.innerHTML=k.outerHTML}).catch(function(k){d.innerHTML="graphviz render error: <br>".concat(k),d.className="vditor-reset--error"})}catch(k){console.error("graphviz error",k)}d.setAttribute("data-processed","true")}})})}}),999:((I,w,C)=>{C.d(w,{s:()=>l});var D=C(145),A=C(413),c=C(290),l=function(g,p,h){p===void 0&&(p=document),h===void 0&&(h=D.g.CDN);var d=g.style;D.g.CODE_THEME.includes(d)||(d="github");var E=document.getElementById("vditorHljsStyle"),v="".concat(h,"/dist/js/highlight.js/styles/").concat(d,".min.css");if(E&&E.getAttribute("href")!==v&&E.remove(),(0,c.c)("".concat(h,"/dist/js/highlight.js/styles/").concat(d,".min.css"),"vditorHljsStyle"),g.enable!==!1){var b=p.querySelectorAll("pre > code");b.length!==0&&(0,A.G)("".concat(h,"/dist/js/highlight.js/highlight.min.js?v=11.7.0"),"vditorHljsScript").then(function(){(0,A.G)("".concat(h,"/dist/js/highlight.js/third-languages.js?v=1.0.1"),"vditorHljsThirdScript").then(function(){p.querySelectorAll("pre > code").forEach(function(y){if(!(y.parentElement.classList.contains("vditor-ir__marker--pre")||y.parentElement.classList.contains("vditor-wysiwyg__pre"))&&!(y.classList.contains("language-mermaid")||y.classList.contains("language-flowchart")||y.classList.contains("language-echarts")||y.classList.contains("language-mindmap")||y.classList.contains("language-plantuml")||y.classList.contains("language-smiles")||y.classList.contains("language-abc")||y.classList.contains("language-graphviz")||y.classList.contains("language-math"))){g.defaultLang!==""&&y.className.indexOf("language-")===-1&&y.classList.add("language-"+g.defaultLang);var s=y.className.replace("language-","");if(window.hljs.getLanguage(s)||(s="plaintext"),y.innerHTML=window.hljs.highlight(y.textContent,{language:s,ignoreIllegals:!0}).value,y.classList.add("hljs"),!!g.lineNumber){y.classList.add("vditor-linenumber");var k=y.querySelector(".vditor-linenumber__temp");k||(k=document.createElement("div"),k.className="vditor-linenumber__temp",y.insertAdjacentElement("beforeend",k));var x=getComputedStyle(y).whiteSpace,H=!1;(x==="pre-wrap"||x==="pre-line")&&(H=!0);var _="",B=y.textContent.split(/\r\n|\r|\n/g);B.pop(),B.map(function(z){var Z="";H&&(k.textContent=z||`
35
- `,Z=' style="height:'.concat(k.getBoundingClientRect().height,'px"')),_+="<span".concat(Z,"></span>")}),k.style.display="none",_='<span class="vditor-linenumber__rows">'.concat(_,"</span>"),y.insertAdjacentHTML("beforeend",_)}}})})})}}}),11:((I,w,C)=>{C.d(w,{K:()=>h});var D=C(145),A=C(413),c=C(840),l={},g=function(d,E){var v=d.transform(E),b=Object.keys(v.features).filter(function(H){return!l[H]});b.forEach(function(H){l[H]=!0});var y=d.getAssets(b),s=y.styles,k=y.scripts,x=window.markmap;return s&&x.loadCSS(s),k&&x.loadJS(k),v},p=function(d,E){var v=window.markmap,b=v.Transformer,y=v.Markmap,s=v.deriveOptions;v.globalCSS;var k=new b;d.innerHTML='<svg style="width:100%"></svg>';var x=d.firstChild,H=y.create(x,null),_=g(k,E),B=_.root,z=_.frontmatter,Z=z?.markmap,ne=s(Z);H.setData(B,ne),H.fit()},h=function(d,E){d===void 0&&(d=document),E===void 0&&(E=D.g.CDN);var v=c.markmapRenderAdapter.getElements(d);v.length!==0&&(0,A.G)("".concat(E,"/dist/js/markmap/markmap.min.js"),"vditorMarkerScript").then(function(){v.forEach(function(b){var y=c.markmapRenderAdapter.getCode(b);if(!(b.getAttribute("data-processed")==="true"||y.trim()==="")){var s=document.createElement("div");s.className="language-markmap",b.parentNode.appendChild(s),p(s,y),b.parentNode.childNodes[0].nodeName=="CODE"&&b.parentNode.removeChild(b.parentNode.childNodes[0])}})})}}),472:((I,w,C)=>{C.d(w,{H:()=>p});var D=C(145),A=C(413),c=C(290),l=C(105),g=C(840),p=function(h,d){h===void 0&&(h=document);var E=g.mathRenderAdapter.getElements(h);if(E.length!==0){var v={cdn:D.g.CDN,math:{engine:"KaTeX",inlineDigit:!1,macros:{}}};if(d&&d.math&&(d.math=Object.assign({},v.math,d.math)),d=Object.assign({},v,d),d.math.engine==="KaTeX")(0,c.c)("".concat(d.cdn,"/dist/js/katex/katex.min.css?v=0.16.9"),"vditorKatexStyle"),(0,A.G)("".concat(d.cdn,"/dist/js/katex/katex.min.js?v=0.16.9"),"vditorKatexScript").then(function(){(0,A.G)("".concat(d.cdn,"/dist/js/katex/mhchem.min.js?v=0.16.9"),"vditorKatexChemScript").then(function(){E.forEach(function(s){if(!(s.parentElement.classList.contains("vditor-wysiwyg__pre")||s.parentElement.classList.contains("vditor-ir__marker--pre"))&&!s.getAttribute("data-math")){var k=(0,l.X)(g.mathRenderAdapter.getCode(s));s.setAttribute("data-math",k);try{s.innerHTML=katex.renderToString(k,{displayMode:s.tagName==="DIV",output:"html",macros:d.math.macros})}catch(x){s.innerHTML=x.message,s.className="language-math vditor-reset--error"}s.addEventListener("copy",function(x){x.stopPropagation(),x.preventDefault();var H=x.currentTarget.closest(".language-math");x.clipboardData.setData("text/html",H.innerHTML),x.clipboardData.setData("text/plain",H.getAttribute("data-math"))})}})})});else if(d.math.engine==="MathJax"){var b=function(s){if(s.length!==0){var k=0,x=s[s.length-1],H=function(){var _=s[k++];_===x?_():_(H)};H()}};window.MathJax||(window.MathJax={loader:{paths:{mathjax:"".concat(d.cdn,"/dist/js/mathjax")}},startup:{typeset:!1},tex:{macros:d.math.macros}},Object.assign(window.MathJax,d.math.mathJaxOptions)),(0,A.J)("".concat(d.cdn,"/dist/js/mathjax/tex-svg-full.js"),"protyleMathJaxScript");var y=function(s,k){var x=(0,l.X)(s.textContent).trim(),H=window.MathJax.getMetricsFor(s);H.display=s.tagName==="DIV",window.MathJax.tex2svgPromise(x,H).then(function(_){s.innerHTML="",s.setAttribute("data-math",x),s.append(_),window.MathJax.startup.document.clear(),window.MathJax.startup.document.updateDocument();var B=_.querySelector('[data-mml-node="merror"]');B&&B.textContent.trim()!==""&&(s.innerHTML=B.textContent.trim(),s.className="vditor-reset--error"),k&&k()})};window.MathJax.startup.promise.then(function(){for(var s=[],k=function(H){var _=E[H];!_.parentElement.classList.contains("vditor-wysiwyg__pre")&&!_.parentElement.classList.contains("vditor-ir__marker--pre")&&!_.getAttribute("data-math")&&(0,l.X)(_.textContent).trim()&&s.push(function(B){H===E.length-1?y(_):y(_,B)})},x=0;x<E.length;x++)k(x);b(s)})}}}}),280:((I,w,C)=>{C.d(w,{Y:()=>g});var D=C(494),A=function(p,h){p.insertAdjacentHTML("afterend",'<video controls="controls" src="'.concat(h,'"></video>')),p.remove()},c=function(p,h){p.insertAdjacentHTML("afterend",'<audio controls="controls" src="'.concat(h,'"></audio>')),p.remove()},l=function(p,h){var d=h.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/),E=h.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),v=h.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/),b=h.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/),y=h.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/),s=h.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/),k=h.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/),x=h.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);if(d&&d[1].length===11)p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//www.youtube.com/embed/'.concat(d[1]+(d[2]?"?start="+d[2]:""),'"></iframe>')),p.remove();else if(E&&E[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//player.youku.com/embed/'.concat(E[1],'"></iframe>')),p.remove();else if(v&&v[1])p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="https://v.qq.com/txp/iframe/player.html?vid='.concat(v[1],'"></iframe>')),p.remove();else if(b&&b[1])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
36
- src="//coub.com/embed/`.concat(b[1],'?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>')),p.remove();else if(y&&y[0])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
37
- src="https://www.facebook.com/plugins/video.php?href=`.concat(encodeURIComponent(y[0]),'"></iframe>')),p.remove();else if(s&&s[2])p.insertAdjacentHTML("afterend",`<iframe class="iframe__video"
38
- src="https://www.dailymotion.com/embed/video/`.concat(s[2],'"></iframe>')),p.remove();else if(h.indexOf("bilibili.com")>-1&&(h.indexOf("bvid=")>-1||k&&k[1])){var H={bvid:(0,D.on)("bvid",h)||k&&k[1],page:"1",high_quality:"1",as_wide:"1",allowfullscreen:"true",autoplay:"0"};new URL(h.startsWith("http")?h:"https:"+h).search.split("&").forEach(function(z,Z){if(z){Z===0&&(z=z.substr(1));var ne=z.split("=");H[ne[0]]=ne[1]}});var _="https://player.bilibili.com/player.html?",B=Object.keys(H);B.forEach(function(z,Z){_+="".concat(z,"=").concat(H[z]),Z<B.length-1&&(_+="&")}),p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="'.concat(_,'"></iframe>')),p.remove()}else x&&x[1]&&(p.insertAdjacentHTML("afterend",'<iframe class="iframe__video" src="//embed.ted.com/talks/'.concat(x[1],'"></iframe>')),p.remove())},g=function(p){p&&p.querySelectorAll("a").forEach(function(h){var d=h.getAttribute("href");d&&(d.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)?A(h,d):d.match(/^.+.(mp3|wav|flac)$/)?c(h,d):l(h,d))})}}),637:((I,w,C)=>{C.d(w,{i:()=>h});var D=C(145),A=C(413),c=C(840),l=C(494),g=function(d,E,v,b){function y(s){return s instanceof v?s:new v(function(k){k(s)})}return new(v||(v=Promise))(function(s,k){function x(B){try{_(b.next(B))}catch(z){k(z)}}function H(B){try{_(b.throw(B))}catch(z){k(z)}}function _(B){B.done?s(B.value):y(B.value).then(x,H)}_((b=b.apply(d,E||[])).next())})},p=function(d,E){var v={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},b,y,s,k;return k={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function x(_){return function(B){return H([_,B])}}function H(_){if(b)throw new TypeError("Generator is already executing.");for(;k&&(k=0,_[0]&&(v=0)),v;)try{if(b=1,y&&(s=_[0]&2?y.return:_[0]?y.throw||((s=y.return)&&s.call(y),0):y.next)&&!(s=s.call(y,_[1])).done)return s;switch(y=0,s&&(_=[_[0]&2,s.value]),_[0]){case 0:case 1:s=_;break;case 4:return v.label++,{value:_[1],done:!1};case 5:v.label++,y=_[1],_=[0];continue;case 7:_=v.ops.pop(),v.trys.pop();continue;default:if(s=v.trys,!(s=s.length>0&&s[s.length-1])&&(_[0]===6||_[0]===2)){v=0;continue}if(_[0]===3&&(!s||_[1]>s[0]&&_[1]<s[3])){v.label=_[1];break}if(_[0]===6&&v.label<s[1]){v.label=s[1],s=_;break}if(s&&v.label<s[2]){v.label=s[2],v.ops.push(_);break}s[2]&&v.ops.pop(),v.trys.pop();continue}_=E.call(d,v)}catch(B){_=[6,B],y=0}finally{b=s=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},h=function(d,E,v){d===void 0&&(d=document),E===void 0&&(E=D.g.CDN);var b=c.mermaidRenderAdapter.getElements(d);b.length!==0&&(0,A.G)("".concat(E,"/dist/js/mermaid/mermaid.min.js?v=11.6.0"),"vditorMermaidScript").then(function(){var y={securityLevel:"loose",altFontFamily:"sans-serif",fontFamily:"sans-serif",startOnLoad:!1,flowchart:{htmlLabels:!0,useMaxWidth:!0},sequence:{useMaxWidth:!0,diagramMarginX:8,diagramMarginY:8,boxMargin:8,showSequenceNumbers:!0},gantt:{leftPadding:75,rightPadding:20}};v==="dark"&&(y.theme="dark"),mermaid.initialize(y),b.forEach(function(s){return g(void 0,void 0,void 0,function(){var k,x,H,_,B;return p(this,function(z){switch(z.label){case 0:if(k=c.mermaidRenderAdapter.getCode(s),s.getAttribute("data-processed")==="true"||k.trim()==="")return[2];x="mermaid"+(0,l.Wb)(),z.label=1;case 1:return z.trys.push([1,3,,4]),[4,mermaid.render(x,s.textContent)];case 2:return H=z.sent(),s.innerHTML=H.svg,[3,4];case 3:return _=z.sent(),B=document.querySelector("#"+x),s.innerHTML="".concat(B.outerHTML,`<br>
39
- <div style="text-align: left"><small>`).concat(_.message.replace(/\n/,"<br>"),"</small></div>"),B.parentElement.remove(),[3,4];case 4:return s.setAttribute("data-processed","true"),[2]}})})})})}}),194:((I,w,C)=>{C.d(w,{P:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p,h){g===void 0&&(g=document),p===void 0&&(p=D.g.CDN);var d=c.mindmapRenderAdapter.getElements(g);d.length>0&&(0,A.G)("".concat(p,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){d.forEach(function(E){if(!(E.parentElement.classList.contains("vditor-wysiwyg__pre")||E.parentElement.classList.contains("vditor-ir__marker--pre"))){var v=c.mindmapRenderAdapter.getCode(E);if(v)try{if(E.getAttribute("data-processed")==="true")return;echarts.init(E,h==="dark"?"dark":void 0).setOption({series:[{data:[JSON.parse(decodeURIComponent(v))],initialTreeDepth:-1,itemStyle:{borderWidth:0,color:"#4285f4"},label:{backgroundColor:"#f6f8fa",borderColor:"#d1d5da",borderRadius:5,borderWidth:.5,color:"#586069",lineHeight:20,offset:[-5,0],padding:[0,5],position:"insideRight"},lineStyle:{color:"#d1d5da",width:1},roam:!0,symbol:function(b,y){var s;return!((s=y?.data)===null||s===void 0)&&s.children?"circle":"path://"},type:"tree"}],tooltip:{trigger:"item",triggerOn:"mousemove"}}),E.setAttribute("data-processed","true")}catch(b){E.className="vditor-reset--error",E.innerHTML="mindmap render error: <br>".concat(b)}}})})}}),436:((I,w,C)=>{C.d(w,{k:()=>c});var D=C(771),A=C(472),c=function(l,g,p){var h="",d=[];if(Array.from(l.children).forEach(function(y,s){if((0,D.W)(y)){if(p){var k=y.id.lastIndexOf("_");y.id=y.id.substring(0,k===-1?void 0:k)+"_"+s}d.push(y.id),h+=y.outerHTML.replace("<wbr>","")}}),h==="")return g.innerHTML="","";var E=document.createElement("div");if(p)p.lute.SetToC(!0),p.currentMode==="wysiwyg"&&!p.preview.element.contains(l)?E.innerHTML=p.lute.SpinVditorDOM("<p>[ToC]</p>"+h):p.currentMode==="ir"&&!p.preview.element.contains(l)?E.innerHTML=p.lute.SpinVditorIRDOM("<p>[ToC]</p>"+h):E.innerHTML=p.lute.HTML2VditorDOM("<p>[ToC]</p>"+h),p.lute.SetToC(p.options.preview.markdown.toc);else{g.classList.add("vditor-outline");var v=Lute.New();v.SetToC(!0),E.innerHTML=v.HTML2VditorDOM("<p>[ToC]</p>"+h)}var b=E.firstElementChild.querySelectorAll("li > span[data-target-id]");return b.forEach(function(y,s){if(y.nextElementSibling&&y.nextElementSibling.tagName==="UL"){var k="<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";document.getElementById("vditorIconScript")||(k='<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>'),y.innerHTML="".concat(k,"<span>").concat(y.innerHTML,"</span>")}else y.innerHTML="<svg></svg><span>".concat(y.innerHTML,"</span>");y.setAttribute("data-target-id",d[s])}),h=E.firstElementChild.innerHTML,b.length===0?(g.innerHTML="",h):(g.innerHTML=h,p&&(0,A.H)(g,{cdn:p.options.cdn,math:p.options.preview.math}),g.firstElementChild.addEventListener("click",function(y){for(var s=y.target;s&&!s.isEqualNode(g);){if(s.classList.contains("vditor-outline__action")){s.classList.contains("vditor-outline__action--close")?(s.classList.remove("vditor-outline__action--close"),s.parentElement.nextElementSibling.setAttribute("style","display:block")):(s.classList.add("vditor-outline__action--close"),s.parentElement.nextElementSibling.setAttribute("style","display:none")),y.preventDefault(),y.stopPropagation();break}else if(s.getAttribute("data-target-id")){y.preventDefault(),y.stopPropagation();var k=document.getElementById(s.getAttribute("data-target-id"));if(!k)return;if(p)if(p.options.height==="auto"){var x=k.offsetTop+p.element.offsetTop;p.options.toolbarConfig.pin||(x+=p.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,x)}else p.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,p.element.offsetTop),p.preview.element.contains(l)?l.parentElement.scrollTop=k.offsetTop:l.scrollTop=k.offsetTop;else window.scrollTo(window.scrollX,k.offsetTop);break}s=s.parentElement}}),h)}}),229:((I,w,C)=>{C.d(w,{B:()=>l});var D=C(145),A=C(413),c=C(840),l=function(g,p){g===void 0&&(g=document),p===void 0&&(p=D.g.CDN);var h=c.plantumlRenderAdapter.getElements(g);h.length!==0&&(0,A.G)("".concat(p,"/dist/js/plantuml/plantuml-encoder.min.js"),"vditorPlantumlScript").then(function(){h.forEach(function(d){if(!(d.parentElement.classList.contains("vditor-wysiwyg__pre")||d.parentElement.classList.contains("vditor-ir__marker--pre"))){var E=c.plantumlRenderAdapter.getCode(d).trim();if(E)try{d.innerHTML='<object type="image/svg+xml" data="https://www.plantuml.com/plantuml/svg/~1'.concat(plantumlEncoder.encode(E),'"/>')}catch(v){d.className="vditor-reset--error",d.innerHTML="plantuml render error: <br>".concat(v)}}})})}}),214:((I,w,C)=>{C.d(w,{X:()=>D});var D=function(A){var c=Lute.New();return c.PutEmojis(A.emojis),c.SetEmojiSite(A.emojiSite),c.SetHeadingAnchor(A.headingAnchor),c.SetInlineMathAllowDigitAfterOpenMarker(A.inlineMathDigit),c.SetAutoSpace(A.autoSpace),c.SetToC(A.toc),c.SetFootnotes(A.footnotes),c.SetFixTermTypo(A.fixTermTypo),c.SetVditorCodeBlockPreview(A.codeBlockPreview),c.SetVditorMathBlockPreview(A.mathBlockPreview),c.SetSanitize(A.sanitize),c.SetChineseParagraphBeginningSpace(A.paragraphBeginningSpace),c.SetRenderListStyle(A.listStyle),c.SetLinkBase(A.linkBase),c.SetLinkPrefix(A.linkPrefix),c.SetMark(A.mark),c.SetGFMAutoLink(A.gfmAutoLink),A.lazyLoadImage&&c.SetImageLazyLoading(A.lazyLoadImage),c}}),190:((I,w,C)=>{C.d(w,{E:()=>D});var D=function(A,c,l){l===void 0&&(l="classic");var g=A.getBoundingClientRect(),p=36;document.body.insertAdjacentHTML("beforeend",'<div class="vditor vditor-img'.concat(l==="dark"?" vditor--dark":"",`">
40
- <div class="vditor-img__bar">
41
- <span class="vditor-img__btn" data-deg="0">
42
- <svg><use xlink:href="#vditor-icon-redo"></use></svg>
43
- `).concat(window.VditorI18n.spin,`
44
- </span>
45
- <span class="vditor-img__btn" onclick="this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''">
46
- X &nbsp;`).concat(window.VditorI18n.close,`
47
- </span>
48
- </div>
49
- <div class="vditor-img__img" onclick="this.parentElement.outerHTML = '';document.body.style.overflow = ''">
50
- <img style="width: `).concat(A.width,"px;height:").concat(A.height,"px;transform: translate3d(").concat(g.left,"px, ").concat(g.top-p,'px, 0)" src="').concat(A.getAttribute("src"),`">
51
- </div>
52
- </div>`)),document.body.style.overflow="hidden";var h=document.querySelector(".vditor-img img"),d="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(Math.max(0,window.innerHeight-p-A.naturalHeight)/2,"px, 0)");setTimeout(function(){h.setAttribute("style","transition: transform .3s ease-in-out;transform: ".concat(d)),setTimeout(function(){h.parentElement.scrollTo((h.parentElement.scrollWidth-h.parentElement.clientWidth)/2,(h.parentElement.scrollHeight-h.parentElement.clientHeight)/2)},400)});var E=document.querySelector(".vditor-img__btn");E.addEventListener("click",function(){var v=parseInt(E.getAttribute("data-deg"),10)+90;v/90%2===1&&A.naturalWidth>h.parentElement.clientHeight?h.style.transform="translate3d(".concat(Math.max(0,window.innerWidth-A.naturalWidth)/2,"px, ").concat(A.naturalWidth/2-A.naturalHeight/2,"px, 0) rotateZ(").concat(v,"deg)"):h.style.transform="".concat(d," rotateZ(").concat(v,"deg)"),E.setAttribute("data-deg",v.toString()),setTimeout(function(){h.parentElement.scrollTo((h.parentElement.scrollWidth-h.parentElement.clientWidth)/2,(h.parentElement.scrollHeight-h.parentElement.clientHeight)/2)},400)})}}),580:((I,w,C)=>{C.d(w,{Y:()=>c});var D=C(145),A=C(290),c=function(l,g){g===void 0&&(g=D.g.CDN),D.g.CODE_THEME.includes(l)||(l="github");var p=document.getElementById("vditorHljsStyle"),h="".concat(g,"/dist/js/highlight.js/styles/").concat(l,".min.css");p?p.getAttribute("href")!==h&&(p.remove(),(0,A.c)(h,"vditorHljsStyle")):(0,A.c)(h,"vditorHljsStyle")}}),538:((I,w,C)=>{C.d(w,{Z:()=>A});var D=C(290),A=function(c,l){if(!(!c||!l)){var g=document.getElementById("vditorContentTheme"),p="".concat(l,"/").concat(c,".css");g?g.getAttribute("href")!==p&&(g.remove(),(0,D.c)(p,"vditorContentTheme")):(0,D.c)(p,"vditorContentTheme")}}}),413:((I,w,C)=>{C.d(w,{J:()=>D,G:()=>A});var D=function(c,l){if(document.getElementById(l))return!1;var g=new XMLHttpRequest;g.open("GET",c,!1),g.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),g.send("");var p=document.createElement("script");p.type="text/javascript",p.text=g.responseText,p.id=l,document.head.appendChild(p)},A=function(c,l){return new Promise(function(g,p){if(document.getElementById(l))return g(!0),!1;var h=document.createElement("script");h.src=c,h.async=!0,document.head.appendChild(h),h.onerror=function(d){p(d)},h.onload=function(){if(document.getElementById(l))return h.remove(),g(!0),!1;h.id=l,g(!0)}})}}),290:((I,w,C)=>{C.d(w,{c:()=>D});var D=function(A,c){if(!document.getElementById(c)){var l=document.createElement("link");l.id=c,l.rel="stylesheet",l.type="text/css",l.href=A,document.getElementsByTagName("head")[0].appendChild(l)}}}),105:((I,w,C)=>{C.d(w,{X:()=>D});var D=function(A){return A.replace(/\u00a0/g," ")}}),410:((I,w,C)=>{C.d(w,{G6:()=>D,vU:()=>A,pK:()=>c,Le:()=>l,yl:()=>g,ns:()=>p,i7:()=>h});var D=function(){return navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")===-1},A=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},c=function(){try{return typeof localStorage<"u"}catch{return!1}},l=function(){return navigator.userAgent.indexOf("iPhone")>-1?"touchstart":"click"},g=function(d){return navigator.platform.toUpperCase().indexOf("MAC")>=0?!!(d.metaKey&&!d.ctrlKey):!!(!d.metaKey&&d.ctrlKey)},p=function(d){return/Mac/.test(navigator.platform)||navigator.platform==="iPhone"?d.indexOf("⇧")>-1&&A()&&(d=d.replace(";",":").replace("=","+").replace("-","_")):(d.startsWith("⌘")?d=d.replace("⌘","⌘+"):d.startsWith("⌥")&&d.substr(1,1)!=="⌘"?d=d.replace("⌥","⌥+"):d=d.replace("⇧⌘","⌘+⇧+").replace("⌥⌘","⌥+⌘+"),d=d.replace("⌘","Ctrl").replace("⇧","Shift").replace("⌥","Alt"),d.indexOf("Shift")>-1&&(d=d.replace(";",":").replace("=","+").replace("-","_"))),d},h=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}}),494:((I,w,C)=>{C.d(w,{Wb:()=>D,on:()=>A,Qf:()=>c});var D=function(){return([1e7].toString()+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(l){return(parseInt(l,10)^window.crypto.getRandomValues(new Uint32Array(1))[0]&15>>parseInt(l,10)/4).toString(16)})},A=function(l,g){g===void 0&&(g=window.location.search);var p=g.substring(g.indexOf("?")),h=p.indexOf("#"),d=new URLSearchParams(p.substring(0,h>=0?h:void 0));return d.get(l)},c=function(l){return Function('"use strict";return ('.concat(l,")"))()}}),106:((I,w,C)=>{C.d(w,{JQ:()=>A,E2:()=>c,O9:()=>l,a1:()=>g,F9:()=>p,lG:()=>h,fb:()=>d,DX:()=>E});var D=C(771),A=function(v,b){for(var y=d(v,b),s=!1,k=!1;y&&!y.classList.contains("vditor-reset")&&!k;)s=d(y.parentElement,b),s?y=s:k=!0;return y||!1},c=function(v,b){for(var y=(0,D.S)(v,b),s=!1,k=!1;y&&!y.classList.contains("vditor-reset")&&!k;)s=(0,D.S)(y.parentElement,b),s?y=s:k=!0;return y||!1},l=function(v){var b=c(v,"UL"),y=c(v,"OL"),s=b;return y&&(!b||b&&y.contains(b))&&(s=y),s},g=function(v,b,y){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var s=v,k=!1;s&&!k&&!s.classList.contains("vditor-reset");)s.getAttribute(b)===y?k=!0:s=s.parentElement;return k&&s},p=function(v){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);var b=v,y=!1,s=g(v,"data-block","0");if(s)return s;for(;b&&!y&&!b.classList.contains("vditor-reset");)b.tagName==="H1"||b.tagName==="H2"||b.tagName==="H3"||b.tagName==="H4"||b.tagName==="H5"||b.tagName==="H6"||b.tagName==="P"||b.tagName==="BLOCKQUOTE"||b.tagName==="OL"||b.tagName==="UL"?y=!0:b=b.parentElement;return y&&b},h=function(v,b){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var y=v,s=!1;y&&!s&&!y.classList.contains("vditor-reset");)y.nodeName===b?s=!0:y=y.parentElement;return s&&y},d=function(v,b){if(!v)return!1;v.nodeType===3&&(v=v.parentElement);for(var y=v,s=!1;y&&!s&&!y.classList.contains("vditor-reset");)y.classList.contains(b)?s=!0:y=y.parentElement;return s&&y},E=function(v){for(;v&&v.lastChild;)v=v.lastChild;return v}}),771:((I,w,C)=>{C.d(w,{S:()=>D,W:()=>A});var D=function(c,l){if(!c)return!1;c.nodeType===3&&(c=c.parentElement);for(var g=c,p=!1;g&&!p&&!g.classList.contains("vditor-reset");)g.nodeName.indexOf(l)===0?p=!0:g=g.parentElement;return p&&g},A=function(c){var l=D(c,"H");return l&&l.tagName.length===2&&l.tagName!=="HR"?l:!1}}),673:((I,w,C)=>{C.d(w,{T:()=>D});var D=function(){for(var A=[],c=0;c<arguments.length;c++)A[c]=arguments[c];for(var l={},g=function(h){for(var d in h)h.hasOwnProperty(d)&&(Object.prototype.toString.call(h[d])==="[object Object]"?l[d]=D(l[d],h[d]):l[d]=h[d])},p=0;p<A.length;p++)g(A[p]);return l}}),810:((I,w,C)=>{C.d(w,{zh:()=>l,Ny:()=>g,Gb:()=>p,Hc:()=>h,im:()=>d,$j:()=>E,ib:()=>v,oC:()=>b});var D=C(145),A=C(410),c=C(106),l=function(y){var s,k=y[y.currentMode].element;return getSelection().rangeCount>0&&(s=getSelection().getRangeAt(0),k.isEqualNode(s.startContainer)||k.contains(s.startContainer))?s:y[y.currentMode].range?y[y.currentMode].range:(k.focus(),s=k.ownerDocument.createRange(),s.setStart(k,0),s.collapse(!0),s)},g=function(y){var s=window.getSelection().getRangeAt(0);if(!y.contains(s.startContainer)&&!(0,c.fb)(s.startContainer,"vditor-panel--none"))return{left:0,top:0};var k=y.parentElement.getBoundingClientRect(),x;if(s.getClientRects().length===0)if(s.startContainer.nodeType===3){var H=s.startContainer.parentElement;if(H&&H.getClientRects().length>0)x=H.getClientRects()[0];else return{left:0,top:0}}else{var _=s.startContainer.children;if(_[s.startOffset]&&_[s.startOffset].getClientRects().length>0)x=_[s.startOffset].getClientRects()[0];else if(s.startContainer.childNodes.length>0){var B=s.cloneRange();s.selectNode(s.startContainer.childNodes[Math.max(0,s.startOffset-1)]),x=s.getClientRects()[0],s.setEnd(B.endContainer,B.endOffset),s.setStart(B.startContainer,B.startOffset)}else x=s.startContainer.getClientRects()[0];if(!x){for(var z=s.startContainer.childNodes[s.startOffset];!z.getClientRects||z.getClientRects&&z.getClientRects().length===0;)z=z.parentElement;x=z.getClientRects()[0]}}else x=s.getClientRects()[0];return{left:x.left-k.left,top:x.top-k.top}},p=function(y,s){if(!s){if(getSelection().rangeCount===0)return!1;s=getSelection().getRangeAt(0)}var k=s.commonAncestorContainer;return y.isEqualNode(k)||y.contains(k)},h=function(y){var s=window.getSelection();s.removeAllRanges(),s.addRange(y)},d=function(y,s,k){var x={end:0,start:0};if(!k){if(getSelection().rangeCount===0)return x;k=window.getSelection().getRangeAt(0)}if(p(s,k)){var H=k.cloneRange();y.childNodes[0]&&y.childNodes[0].childNodes[0]?H.setStart(y.childNodes[0].childNodes[0],0):H.selectNodeContents(y),H.setEnd(k.startContainer,k.startOffset),x.start=H.toString().length,x.end=x.start+k.toString().length}return x},E=function(y,s,k){var x=0,H=0,_=k.childNodes[H],B=!1,z=!1;y=Math.max(0,y),s=Math.max(0,s);var Z=k.ownerDocument.createRange();for(Z.setStart(_||k,0),Z.collapse(!0);!z&&_;){var ne=x+_.textContent.length;if(!B&&y>=x&&y<=ne&&(y===0?Z.setStart(_,0):_.childNodes[0].nodeType===3?Z.setStart(_.childNodes[0],y-x):_.nextSibling?Z.setStartBefore(_.nextSibling):Z.setStartAfter(_),B=!0,y===s)){z=!0;break}B&&s>=x&&s<=ne&&(s===0?Z.setEnd(_,0):_.childNodes[0].nodeType===3?Z.setEnd(_.childNodes[0],s-x):_.nextSibling?Z.setEndBefore(_.nextSibling):Z.setEndAfter(_),z=!0),x=ne,_=k.childNodes[++H]}return!z&&k.childNodes[H-1]&&Z.setStartBefore(k.childNodes[H-1]),h(Z),Z},v=function(y,s){var k=y.querySelector("wbr");if(k){if(!k.previousElementSibling)k.previousSibling?s.setStart(k.previousSibling,k.previousSibling.textContent.length):k.nextSibling?k.nextSibling.nodeType===3?s.setStart(k.nextSibling,0):s.setStartBefore(k.nextSibling):s.setStart(k.parentElement,0);else if(k.previousElementSibling.isSameNode(k.previousSibling))if(k.previousElementSibling.lastChild){s.setStartBefore(k),s.collapse(!0),h(s),(0,A.i7)()&&(k.previousElementSibling.tagName==="EM"||k.previousElementSibling.tagName==="STRONG"||k.previousElementSibling.tagName==="S")&&(s.insertNode(document.createTextNode(D.g.ZWSP)),s.collapse(!1)),k.remove();return}else s.setStartAfter(k.previousElementSibling);else s.setStart(k.previousSibling,k.previousSibling.textContent.length);s.collapse(!0),k.remove(),h(s)}},b=function(y,s){var k=document.createElement("div");k.innerHTML=y;var x=k.querySelectorAll("p");x.length===1&&!x[0].previousSibling&&!x[0].nextSibling&&s[s.currentMode].element.children.length>0&&k.firstElementChild.tagName==="P"&&(y=x[0].innerHTML.trim());var H=document.createElement("div");H.innerHTML=y;var _=l(s);if(_.toString()!==""&&(s[s.currentMode].preventInput=!0,document.execCommand("delete",!1,"")),H.firstElementChild&&H.firstElementChild.getAttribute("data-block")==="0"){H.lastElementChild.insertAdjacentHTML("beforeend","<wbr>");var B=(0,c.F9)(_.startContainer);if(!B)s[s.currentMode].element.insertAdjacentHTML("beforeend",H.innerHTML);else{var z=(0,c.lG)(_.startContainer,"LI");z&&H.firstElementChild.tagName==="UL"?z.insertAdjacentHTML("afterend",H.firstElementChild.innerHTML):B.insertAdjacentHTML("afterend",H.innerHTML)}v(s[s.currentMode].element,_)}else{var Z=document.createElement("template");Z.innerHTML=y,_.insertNode(Z.content.cloneNode(!0)),_.collapse(!1),h(_)}}})},Q={};function X(I){var w=Q[I];if(w!==void 0)return w.exports;var C=Q[I]={exports:{}};return se[I](C,C.exports,X),C.exports}X.d=(I,w)=>{for(var C in w)X.o(w,C)&&!X.o(I,C)&&Object.defineProperty(I,C,{enumerable:!0,get:w[C]})},X.o=(I,w)=>Object.prototype.hasOwnProperty.call(I,w),X.r=I=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})};var we={};return(()=>{X.d(we,{default:()=>Na});var I=X(408),w=X(145),C=X(105),D=function(e){return e.currentMode==="sv"?(0,C.X)("".concat(e.sv.element.textContent,`
53
- `).replace(/\n\n$/,`
54
- `)):e.currentMode==="wysiwyg"?e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML):e.currentMode==="ir"?e.lute.VditorIRDOM2Md(e.ir.element.innerHTML):""},A=X(413),c=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-devtools",this.element.innerHTML='<div class="vditor-reset--error"></div><div style="height: 100%;"></div>'}return e.prototype.renderEchart=function(t){var n=this;t.devtools.element.style.display==="block"&&(0,A.G)("".concat(t.options.cdn,"/dist/js/echarts/echarts.min.js?v=5.5.1"),"vditorEchartsScript").then(function(){n.ASTChart||(n.ASTChart=echarts.init(t.devtools.element.lastElementChild));try{n.element.lastElementChild.style.display="block",n.element.firstElementChild.innerHTML="",n.ASTChart.setOption({series:[{data:JSON.parse(t.lute.RenderEChartsJSON(D(t))),initialTreeDepth:-1,label:{align:"left",backgroundColor:"rgba(68, 77, 86, .68)",borderRadius:3,color:"#d1d5da",fontSize:12,lineHeight:12,offset:[9,12],padding:[2,4,2,4],position:"top",verticalAlign:"middle"},lineStyle:{color:"#4285f4",type:"curve",width:1},orient:"vertical",roam:!0,type:"tree"}],toolbox:{bottom:25,emphasis:{iconStyle:{color:"#4285f4"}},feature:{restore:{show:!0},saveAsImage:{show:!0}},right:15,show:!0}}),n.ASTChart.resize()}catch(r){n.element.lastElementChild.style.display="none",n.element.firstElementChild.innerHTML=r}})},e})(),l=X(410),g=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains("vditor-menu--current")&&r.classList.remove("vditor-menu--current")}})},p=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains("vditor-menu--current")&&r.classList.add("vditor-menu--current")}})},h=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&r.classList.contains(w.g.CLASS_MENU_DISABLED)&&r.classList.remove(w.g.CLASS_MENU_DISABLED)}})},d=function(e,t){t.forEach(function(n){if(e[n]){var r=e[n].children[0];r&&!r.classList.contains(w.g.CLASS_MENU_DISABLED)&&r.classList.add(w.g.CLASS_MENU_DISABLED)}})},E=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="none")})},v=function(e,t){t.forEach(function(n){e[n]&&e[n]&&(e[n].style.display="block")})},b=function(e,t,n){t.includes("subToolbar")&&(e.toolbar.element.querySelectorAll(".vditor-hint").forEach(function(r){n&&r.isEqualNode(n)||(r.style.display="none")}),e.toolbar.elements.emoji&&(e.toolbar.elements.emoji.lastElementChild.style.display="none")),t.includes("hint")&&(e.hint.element.style.display="none"),e.wysiwyg.popover&&t.includes("popover")&&(e.wysiwyg.popover.style.display="none")},y=function(e,t,n,r){n.addEventListener((0,l.Le)(),function(i){i.preventDefault(),i.stopPropagation(),!n.classList.contains(w.g.CLASS_MENU_DISABLED)&&(e.toolbar.element.querySelectorAll(".vditor-hint--current").forEach(function(a){a.classList.remove("vditor-hint--current")}),t.style.display==="block"?t.style.display="none":(b(e,["subToolbar","hint","popover"],n.parentElement.parentElement),n.classList.contains("vditor-tooltipped")||n.classList.add("vditor-hint--current"),t.style.display="block",e.toolbar.element.getBoundingClientRect().right-n.getBoundingClientRect().right<250?t.classList.add("vditor-panel--left"):t.classList.remove("vditor-panel--left")))})},s=X(106),k=X(771),x=function(e,t,n,r){r&&console.log("".concat(e," - ").concat(n,": ").concat(t))},H=X(135),_=X(775),B=X(428),z=X(325),Z=X(483),ne=X(999),ae=X(472),ue=X(637),ve=X(11),me=X(194),de=X(229),Ce=X(825),De=function(e,t,n){n===void 0&&(n="sv");var r=document.createElement("div");r.innerHTML=e;var i=!1;r.childElementCount===1&&r.lastElementChild.style.fontFamily.indexOf("monospace")>-1&&(i=!0);var a=r.querySelectorAll("pre");if(r.childElementCount===1&&a.length===1&&a[0].className!=="vditor-wysiwyg"&&a[0].className!=="vditor-sv"&&(i=!0),e.indexOf(`
55
- <p class="p1">`)===0&&(i=!0),r.childElementCount===1&&r.firstElementChild.tagName==="TABLE"&&r.querySelector(".line-number")&&r.querySelector(".line-content")&&(i=!0),i){var o=t||e;return/\n/.test(o)||a.length===1?n==="wysiwyg"?'<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>'.concat(o.replace(/&/g,"&amp;").replace(/</g,"&lt;"),"<wbr></code></pre></div>"):"\n```\n"+o.replace(/&/g,"&amp;").replace(/</g,"&lt;")+"\n```":n==="wysiwyg"?"<code>".concat(o.replace(/&/g,"&amp;").replace(/</g,"&lt;"),"</code><wbr>"):"`".concat(o,"`")}return!1},_e=function(e,t){if(e){if(e.parentElement.getAttribute("data-type")==="html-block"){e.setAttribute("data-render","1");return}var n=e.firstElementChild.className.replace("language-","");if(n==="abc")(0,H.Q)(e,t.options.cdn);else if(n==="mermaid")(0,ue.i)(e,t.options.cdn,t.options.theme);else if(n==="smiles")(0,Ce.J)(e,t.options.cdn,t.options.theme);else if(n==="markmap")(0,ve.K)(e,t.options.cdn);else if(n==="flowchart")(0,z.P)(e,t.options.cdn);else if(n==="echarts")(0,_.p)(e,t.options.cdn,t.options.theme);else if(n==="mindmap")(0,me.P)(e,t.options.cdn,t.options.theme);else if(n==="plantuml")(0,de.B)(e,t.options.cdn);else if(n==="graphviz")(0,Z.v)(e,t.options.cdn);else if(n==="math")(0,ae.H)(e,{cdn:t.options.cdn,math:t.options.preview.math});else{var r=t.options.customRenders.find(function(i){if(i.language===n)return i.render(e,t),!0});r||((0,ne.s)(Object.assign({},t.options.preview.hljs),e,t.options.cdn),(0,B.O)(e,t.options.preview.hljs))}e.setAttribute("data-render","1")}},M=X(810),Fe=function(e){if(e.currentMode!=="sv"){var t=e[e.currentMode].element,n=e.outline.render(e);n===""&&(n="[ToC]"),t.querySelectorAll('[data-type="toc-block"]').forEach(function(r){r.innerHTML=n,(0,ae.H)(r,{cdn:e.options.cdn,math:e.options.preview.math})})}},wt=function(e,t){var n=(0,s.lG)(e.target,"SPAN");if(n&&(0,s.fb)(n,"vditor-toc")){var r=t[t.currentMode].element.querySelector("#"+n.getAttribute("data-target-id"));if(r)if(t.options.height==="auto"){var i=r.offsetTop+t.element.offsetTop;t.options.toolbarConfig.pin||(i+=t.toolbar.element.offsetHeight),window.scrollTo(window.scrollX,i)}else t.element.offsetTop<window.scrollY&&window.scrollTo(window.scrollX,t.element.offsetTop),t[t.currentMode].element.scrollTop=r.offsetTop;return}},vt=function(e,t,n,r){if(e.previousElementSibling&&e.previousElementSibling.classList.contains("vditor-toc")){if(n.key==="Backspace"&&(0,M.im)(e,t[t.currentMode].element,r).start===0)return e.previousElementSibling.remove(),re(t),!0;if(rt(t,n,r,e,e.previousElementSibling))return!0}if(e.nextElementSibling&&e.nextElementSibling.classList.contains("vditor-toc")){if(n.key==="Delete"&&(0,M.im)(e,t[t.currentMode].element,r).start>=e.textContent.trimRight().length)return e.nextElementSibling.remove(),re(t),!0;if(pt(t,n,r,e,e.nextElementSibling))return!0}if(n.key==="Backspace"||n.key==="Delete"){var i=(0,s.fb)(r.startContainer,"vditor-toc");if(i)return i.remove(),re(t),!0}},$e=function(e,t,n,r){n===void 0&&(n=!1);var i=(0,s.F9)(t.startContainer);if(i&&!n&&i.getAttribute("data-type")!=="code-block"){if(Kt(i.innerHTML)&&i.previousElementSibling||zt(i.innerHTML))return;for(var a=(0,M.im)(i,e.ir.element,t).start,o=!0,u=a-1;u>i.textContent.substr(0,a).lastIndexOf(`
56
- `);u--)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==" "){o=!1;break}a===0&&(o=!1);for(var m=!0,u=a-1;u<i.textContent.length;u++)if(i.textContent.charAt(u)!==" "&&i.textContent.charAt(u)!==`
57
- `){m=!1;break}if(o){typeof e.options.input=="function"&&e.options.input(D(e));return}if(m&&/^#{1,6} $/.test(i.textContent)&&(m=!1),m){var f=(0,s.fb)(t.startContainer,"vditor-ir__marker");if(!f){var S=t.startContainer.previousSibling;S&&S.nodeType!==3&&S.classList.contains("vditor-ir__node--expand")&&S.classList.remove("vditor-ir__node--expand"),typeof e.options.input=="function"&&e.options.input(D(e));return}}}if(e.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(te){te.classList.remove("vditor-ir__node--expand")}),i||(i=e.ir.element),!i.querySelector("wbr")){var T=(0,s.fb)(t.startContainer,"vditor-ir__preview");T?T.previousElementSibling.insertAdjacentHTML("beforeend","<wbr>"):t.insertNode(document.createElement("wbr"))}i.querySelectorAll("[style]").forEach(function(te){te.removeAttribute("style")}),i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.ir.element);var R=i.isEqualNode(e.ir.element),P=(0,s.a1)(i,"data-type","footnotes-block"),O="";if(R)O=i.innerHTML;else{var W=(0,k.S)(t.startContainer,"BLOCKQUOTE"),U=(0,s.O9)(t.startContainer);if(U&&(i=U),W&&(!U||U&&!W.contains(U))&&(i=W),P&&(i=P),O=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var N=i.previousElementSibling,J=i.nextElementSibling;N&&(N.tagName==="UL"||N.tagName==="OL")&&(O=N.outerHTML+O,N.remove()),J&&(J.tagName==="UL"||J.tagName==="OL")&&(O=O+J.outerHTML,J.remove()),O=O.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}else i.previousElementSibling&&i.previousElementSibling.textContent.replace(w.g.ZWSP,"")!==""&&r&&r.inputType==="insertParagraph"&&(O=i.previousElementSibling.outerHTML+O,i.previousElementSibling.remove());i.innerText.startsWith("```")||(e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(te){te&&!i.isEqualNode(te)&&(O+=te.outerHTML,te.remove())}),e.ir.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(te){te&&!i.isEqualNode(te)&&(O+=te.outerHTML,te.remove())}))}if(x("SpinVditorIRDOM",O,"argument",e.options.debugger),O=e.lute.SpinVditorIRDOM(O),x("SpinVditorIRDOM",O,"result",e.options.debugger),R)i.innerHTML=O;else if(i.outerHTML=O,P){var F=(0,s.a1)(e.ir.element.querySelector("wbr"),"data-type","footnotes-def");if(F){var Y=F.textContent,fe=Y.substring(1,Y.indexOf("]:")),ce=e.ir.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(fe,'"]'));ce&&ce.setAttribute("aria-label",Y.substr(fe.length+3).trim().substr(0,24))}}var he,Oe=e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");Oe.forEach(function(te,ke){ke===0?he=te:(he.insertAdjacentHTML("beforeend",te.innerHTML),te.remove())}),Oe.length>0&&e.ir.element.insertAdjacentElement("beforeend",Oe[0]);var xe,Ne=e.ir.element.querySelectorAll("[data-type='footnotes-block']");Ne.forEach(function(te,ke){ke===0?xe=te:(xe.insertAdjacentHTML("beforeend",te.innerHTML),te.remove())}),Ne.length>0&&e.ir.element.insertAdjacentElement("beforeend",Ne[0]),(0,M.ib)(e.ir.element,t),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(te){_e(te,e)}),Fe(e),ze(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},j=function(e,t){if(e==="")return!1;if(e.indexOf("⇧")===-1&&e.indexOf("⌘")===-1&&e.indexOf("⌥")===-1)return!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.code===e;if(e==="⇧Tab")return!!(!(0,l.yl)(t)&&!t.altKey&&t.shiftKey&&t.code==="Tab");var n=e.split("");if(e.startsWith("⌥")){var r=n.length===3?n[2]:n[1];return!!((n.length===3?(0,l.yl)(t):!(0,l.yl)(t))&&t.altKey&&!t.shiftKey&&t.code===(/^[0-9]$/.test(r)?"Digit":"Key")+r)}e==="⌘Enter"&&(n=["⌘","Enter"]);var i=n.length>2&&n[0]==="⇧",a=i?n[2]:n[1];return i&&((0,l.vU)()||!/Mac/.test(navigator.platform))&&(a==="-"?a="_":a==="="&&(a="+")),!!((0,l.yl)(t)&&t.key.toLowerCase()===a.toLowerCase()&&!t.altKey&&(!i&&!t.shiftKey||i&&t.shiftKey))},oe=function(e){var t=e.startContainer;if(t.nodeType===3&&t.nodeValue.length!==e.startOffset)return!1;for(var n=t.nextSibling;n&&n.textContent==="";)n=n.nextSibling;if(n){if(n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&!n.getAttribute("data-block"))return n}else{var r=(0,s.fb)(t,"vditor-ir__marker");if(r&&!r.nextSibling){var i=t.parentElement.parentElement.nextSibling;if(i&&i.nodeType!==3&&i.classList.contains("vditor-ir__node"))return i}return!1}return!1},K=function(e){var t=e.startContainer,n=t.previousSibling;return t.nodeType===3&&e.startOffset===0&&n&&n.nodeType!==3&&n.classList.contains("vditor-ir__node")&&!n.getAttribute("data-block")?n:!1},V=function(e,t){t.ir.element.querySelectorAll(".vditor-ir__node--expand").forEach(function(o){o.classList.remove("vditor-ir__node--expand")});var n=(0,s.JQ)(e.startContainer,"vditor-ir__node"),r=!e.collapsed&&(0,s.JQ)(e.endContainer,"vditor-ir__node");if(!(!e.collapsed&&(!n||n!==r))){n&&(n.classList.add("vditor-ir__node--expand"),n.classList.remove("vditor-ir__node--hidden"),(0,M.Hc)(e));var i=oe(e);if(i){i.classList.add("vditor-ir__node--expand"),i.classList.remove("vditor-ir__node--hidden");return}var a=K(e);if(a){a.classList.add("vditor-ir__node--expand"),a.classList.remove("vditor-ir__node--hidden");return}}},ye=function(e,t){if(e.ir.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,M.zh)(e),r=n.startContainer;if(!bn(t,e,r)||(wn(n,e,t),Nn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.a1)(r,"data-newline","1");if(!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&t.key==="Enter"&&i&&n.startOffset<i.textContent.length){var a=i.previousElementSibling;a&&(n.insertNode(document.createTextNode(a.textContent)),n.collapse(!1));var o=i.nextSibling;o&&(n.insertNode(document.createTextNode(o.textContent)),n.collapse(!0))}var u=(0,s.lG)(r,"P");if(Cn(t,e,u,n)||kn(n,e,u,t)||Dn(e,n,t,u))return!0;var m=(0,s.fb)(r,"vditor-ir__marker--pre");if(m&&m.tagName==="PRE"){var f=m.firstChild;if(xn(e,t,m,n)||(f.getAttribute("data-type")==="math-block"||f.getAttribute("data-type")==="html-block")&&rt(e,t,n,f,m.parentElement)||pt(e,t,n,f,m.parentElement))return!0}var S=(0,s.a1)(r,"data-type","code-block-info");if(S){if(t.key==="Enter"||t.key==="Tab")return n.selectNodeContents(S.nextElementSibling.firstChild),n.collapse(!0),t.preventDefault(),b(e,["hint"]),!0;if(t.key==="Backspace"){var T=(0,M.im)(S,e.ir.element).start;T===1&&n.setStart(r,0),T===2&&(e.hint.recentLanguage="")}if(rt(e,t,n,S,S.parentElement))return b(e,["hint"]),!0}var R=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(t.key.indexOf("Arrow")>-1&&R){var P=yi(R);if(P&&rt(e,t,n,R,P))return!0;var O=bi(R);if(O&&pt(e,t,n,R,O))return!0}if(An(e,t,n)||Hn(e,n,t)||Gt(e,n,t))return!0;var W=(0,k.W)(r);if(W){if(j("⌘=",t)){var U=W.querySelector(".vditor-ir__marker--heading");return U&&U.textContent.trim().length>1&&ht(e,U.textContent.substr(1)),t.preventDefault(),!0}if(j("⌘-",t)){var U=W.querySelector(".vditor-ir__marker--heading");return U&&U.textContent.trim().length<6&&ht(e,U.textContent.trim()+"# "),t.preventDefault(),!0}}var N=(0,s.F9)(r);if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(On(e,n,t,u))return!0;if(N&&N.previousElementSibling&&N.tagName!=="UL"&&N.tagName!=="OL"&&(N.previousElementSibling.getAttribute("data-type")==="code-block"||N.previousElementSibling.getAttribute("data-type")==="math-block")){var J=(0,M.im)(N,e.ir.element,n).start;if(J===0||J===1&&N.innerText.startsWith(w.g.ZWSP))return n.selectNodeContents(N.previousElementSibling.querySelector(".vditor-ir__marker--pre code")),n.collapse(!1),V(n,e),N.textContent.trim().replace(w.g.ZWSP,"")===""&&(N.remove(),ze(e)),t.preventDefault(),!0}if(W){var F=W.firstElementChild.textContent.length;(0,M.im)(W,e.ir.element).start===F&&F!==0&&(n.setStart(W.firstElementChild.firstChild,F-1),n.collapse(!0),(0,M.Hc)(n))}}return(t.key==="ArrowUp"||t.key==="ArrowDown")&&N&&(N.querySelectorAll(".vditor-ir__node").forEach(function(Y){Y.contains(r)||Y.classList.add("vditor-ir__node--hidden")}),Rn(t,N,n))?!0:(vn(n,t.key),N&&vt(N,e,t,n)?(t.preventDefault(),!0):!1)},$=X(190),Ee=function(e,t){e.querySelectorAll("[data-type=footnotes-link]").forEach(function(n){for(var r=n.parentElement,i=r.nextSibling;i&&i.textContent.startsWith(" ");){var a=i;a.childNodes.forEach(function(o){r.append(o.cloneNode(!0))}),i=i.nextSibling,a.remove()}t&&t(r)})},le=function(e,t){var n,r=getSelection().getRangeAt(0).cloneRange(),i=r.startContainer;r.startContainer.nodeType!==3&&r.startContainer.tagName==="DIV"&&(i=r.startContainer.childNodes[r.startOffset-1]);var a=(0,s.a1)(i,"data-block","0");if(a&&t&&(t.inputType==="deleteContentBackward"||t.data===" ")){for(var o=(0,M.im)(a,e.sv.element,r).start,u=!0,m=o-1;m>a.textContent.substr(0,o).lastIndexOf(`
58
- `);m--)if(a.textContent.charAt(m)!==" "&&a.textContent.charAt(m)!==" "){u=!1;break}if(o===0&&(u=!1),u){Le(e);return}if(t.inputType==="deleteContentBackward"){var f=(0,s.a1)(i,"data-type","code-block-open-marker")||(0,s.a1)(i,"data-type","code-block-close-marker");if(f){if(f.getAttribute("data-type")==="code-block-close-marker"){var S=kt(i,"code-block-open-marker");if(S){S.textContent=f.textContent,Le(e);return}}if(f.getAttribute("data-type")==="code-block-open-marker"){var S=kt(i,"code-block-close-marker",!1);if(S){S.textContent=f.textContent,Le(e);return}}}var T=(0,s.a1)(i,"data-type","math-block-open-marker");if(T){var R=T.nextElementSibling.nextElementSibling;R&&R.getAttribute("data-type")==="math-block-close-marker"&&(R.remove(),Le(e));return}a.querySelectorAll('[data-type="code-block-open-marker"]').forEach(function(N){N.textContent.length===1&&N.remove()}),a.querySelectorAll('[data-type="code-block-close-marker"]').forEach(function(N){N.textContent.length===1&&N.remove()});var P=(0,s.a1)(i,"data-type","heading-marker");if(P&&P.textContent.indexOf("#")===-1){Le(e);return}}if((t.data===" "||t.inputType==="deleteContentBackward")&&((0,s.a1)(i,"data-type","padding")||(0,s.a1)(i,"data-type","li-marker")||(0,s.a1)(i,"data-type","task-marker")||(0,s.a1)(i,"data-type","blockquote-marker"))){Le(e);return}}if(a&&a.textContent.trimRight()==="$$"){Le(e);return}a||(a=e.sv.element),((n=a.firstElementChild)===null||n===void 0?void 0:n.getAttribute("data-type"))==="link-ref-defs-block"&&(a=e.sv.element),(0,s.a1)(i,"data-type","footnotes-link")&&(a=e.sv.element),a.textContent.indexOf(Lute.Caret)===-1&&r.insertNode(document.createTextNode(Lute.Caret)),a.querySelectorAll("[style]").forEach(function(N){N.removeAttribute("style")}),a.querySelectorAll("font").forEach(function(N){N.outerHTML=N.innerHTML});var O=a.textContent,W=a.isEqualNode(e.sv.element);if(W)O=a.textContent;else{a.previousElementSibling&&(O=a.previousElementSibling.textContent+O,a.previousElementSibling.remove()),a.previousElementSibling&&O.indexOf(`---
59
- `)===0&&(O=a.previousElementSibling.textContent+O,a.previousElementSibling.remove());var U="";e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(N,J){N&&!a.isEqualNode(N.parentElement)&&(U+=N.parentElement.textContent+`
60
- `,N.parentElement.remove())}),e.sv.element.querySelectorAll("[data-type='footnotes-link']").forEach(function(N,J){N&&!a.isEqualNode(N.parentElement)&&(U+=N.parentElement.textContent+`
61
- `,N.parentElement.remove())}),O=U+O}O=dn(O,e),W?a.innerHTML=O:a.outerHTML=O,e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(N){e.sv.element.insertAdjacentElement("beforeend",N.parentElement)}),Ee(e.sv.element,function(N){e.sv.element.insertAdjacentElement("beforeend",N)}),(0,M.ib)(e.sv.element,r),Se(e),Le(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},Ae=function(e,t){var n,r,i,a,o;if(e.sv.composingLock=t.isComposing,t.isComposing||(t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"))return!1;var u=(0,M.zh)(e),m=u.startContainer;u.startContainer.nodeType!==3&&u.startContainer.tagName==="DIV"&&(m=u.startContainer.childNodes[u.startOffset-1]);var f=(0,s.a1)(m,"data-type","text"),S=(0,s.a1)(m,"data-type","blockquote-marker");if(!S&&u.startOffset===0&&f&&f.previousElementSibling&&f.previousElementSibling.getAttribute("data-type")==="blockquote-marker"&&(S=f.previousElementSibling),S&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&S.nextElementSibling.textContent.trim()===""&&(0,M.im)(S,e.sv.element,u).start===S.textContent.length)return((n=S.previousElementSibling)===null||n===void 0?void 0:n.getAttribute("data-type"))==="padding"&&S.previousElementSibling.setAttribute("data-action","enter-remove"),S.remove(),Le(e),t.preventDefault(),!0;var T=(0,s.a1)(m,"data-type","li-marker"),R=(0,s.a1)(m,"data-type","task-marker"),P=T;if(P||R&&R.nextElementSibling.getAttribute("data-type")!=="task-marker"&&(P=R),!P&&u.startOffset===0&&f&&f.previousElementSibling&&(f.previousElementSibling.getAttribute("data-type")==="li-marker"||f.previousElementSibling.getAttribute("data-type")==="task-marker")&&(P=f.previousElementSibling),P){var O=(0,M.im)(P,e.sv.element,u).start,W=P.getAttribute("data-type")==="task-marker",U=P;if(W&&(U=P.previousElementSibling.previousElementSibling.previousElementSibling),O===P.textContent.length){if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&P.nextElementSibling.textContent.trim()==="")return((r=U.previousElementSibling)===null||r===void 0?void 0:r.getAttribute("data-type"))==="padding"?(U.previousElementSibling.remove(),le(e)):(W&&(U.remove(),P.previousElementSibling.previousElementSibling.remove(),P.previousElementSibling.remove()),P.nextElementSibling.remove(),P.remove(),Le(e)),t.preventDefault(),!0;if(t.key==="Tab")return t.shiftKey?U.previousElementSibling.getAttribute("data-type")==="padding"&&U.previousElementSibling.remove():U.insertAdjacentHTML("beforebegin",'<span data-type="padding">'.concat(U.textContent.replace(/\S/g," "),"</span>")),/^\d/.test(U.textContent)&&(U.textContent=U.textContent.replace(/^\d{1,}/,"1"),u.selectNodeContents(P.firstChild),u.collapse(!1)),le(e),t.preventDefault(),!0}}if(Gt(e,u,t))return!0;var N=(0,s.a1)(m,"data-block","0"),J=(0,k.S)(m,"SPAN");if(t.key==="Enter"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey&&N){var F=!1,Y=N.textContent.match(/^\n+/);(0,M.im)(N,e.sv.element).start<=(Y?Y[0].length:0)&&(F=!0);var fe=`
62
- `;if(J){if(((i=J.previousElementSibling)===null||i===void 0?void 0:i.getAttribute("data-action"))==="enter-remove")return J.previousElementSibling.remove(),Le(e),t.preventDefault(),!0;fe+=ci(J)}return u.insertNode(document.createTextNode(fe)),u.collapse(!1),N&&N.textContent.trim()!==""&&!F?le(e):Le(e),t.preventDefault(),!0}if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.altKey&&!t.shiftKey){if(J&&((a=J.previousElementSibling)===null||a===void 0?void 0:a.getAttribute("data-type"))==="newline"&&(0,M.im)(J,e.sv.element,u).start===1&&J.getAttribute("data-type").indexOf("code-block-")===-1)return u.setStart(J,0),u.extractContents(),J.textContent.trim()!==""?le(e):Le(e),t.preventDefault(),!0;if(N&&(0,M.im)(N,e.sv.element,u).start===0&&N.previousElementSibling){u.extractContents();var ce=N.previousElementSibling.lastElementChild;return ce.getAttribute("data-type")==="newline"&&(ce.remove(),ce=N.previousElementSibling.lastElementChild),ce.getAttribute("data-type")!=="newline"&&(ce.insertAdjacentHTML("afterend",N.innerHTML),N.remove()),N.textContent.trim()!==""&&!(!((o=N.previousElementSibling)===null||o===void 0)&&o.querySelector('[data-type="code-block-open-marker"]'))?le(e):(ce.getAttribute("data-type")!=="newline"&&(u.selectNodeContents(ce.lastChild),u.collapse(!1)),Le(e)),t.preventDefault(),!0}}return!1},ee=X(538),ge=function(e){e.options.theme==="dark"?e.element.classList.add("vditor--dark"):e.element.classList.remove("vditor--dark")},Re=function(e){e.element.innerHTML="",e.element.classList.add("vditor"),e.options.rtl&&e.element.setAttribute("dir","rtl"),ge(e),(0,ee.Z)(e.options.preview.theme.current,e.options.preview.theme.path),typeof e.options.height=="number"?e.element.style.height=e.options.height+"px":e.element.style.height=e.options.height,typeof e.options.minHeight=="number"&&(e.element.style.minHeight=e.options.minHeight+"px"),typeof e.options.width=="number"?e.element.style.width=e.options.width+"px":e.element.style.width=e.options.width,e.element.appendChild(e.toolbar.element);var t=document.createElement("div");if(t.className="vditor-content",e.options.outline.position==="left"&&t.appendChild(e.outline.element),t.appendChild(e.wysiwyg.element.parentElement),t.appendChild(e.sv.element),t.appendChild(e.ir.element.parentElement),t.appendChild(e.preview.element),e.toolbar.elements.devtools&&t.appendChild(e.devtools.element),e.options.outline.position==="right"&&(e.outline.element.classList.add("vditor-outline--right"),t.appendChild(e.outline.element)),e.upload&&t.appendChild(e.upload.element),e.options.resize.enable&&t.appendChild(e.resize.element),t.appendChild(e.hint.element),t.appendChild(e.tip.element),e.element.appendChild(t),t.addEventListener("click",function(){b(e,["subToolbar"])}),e.toolbar.elements.export&&e.element.insertAdjacentHTML("beforeend",'<iframe id="vditorExportIframe" style="width: 100%;height: 0;border: 0"></iframe>'),Qe(e,e.options.mode,Yr(e)),document.execCommand("DefaultParagraphSeparator",!1,"p"),navigator.userAgent.indexOf("iPhone")>-1&&typeof window.visualViewport<"u"){var n=!1,r=function(i){n||(n=!0,requestAnimationFrame(function(){n=!1;var a=e.toolbar.element;a.style.transform="none",a.getBoundingClientRect().top<0&&(a.style.transform="translate(0, ".concat(-a.getBoundingClientRect().top,"px)"))}))};window.visualViewport.addEventListener("scroll",r),window.visualViewport.addEventListener("resize",r)}},je=function(e){var t=window.innerWidth<=w.g.MOBILE_WIDTH?10:35;if(e.wysiwyg.element.parentElement.style.display!=="none"){var n=(e.wysiwyg.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.wysiwyg.element.style.padding="10px ".concat(Math.max(t,n),"px")}if(e.ir.element.parentElement.style.display!=="none"){var n=(e.ir.element.parentElement.clientWidth-e.options.preview.maxWidth)/2;e.ir.element.style.padding="10px ".concat(Math.max(t,n),"px")}e.preview.element.style.display!=="block"?e.toolbar.element.style.paddingLeft=Math.max(5,parseInt(e[e.currentMode].element.style.paddingLeft||"0",10)+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0))+"px":e.toolbar.element.style.paddingLeft=5+(e.options.outline.position==="left"?e.outline.element.offsetWidth:0)+"px"},Et=function(e){if(e.options.typewriterMode){var t=window.innerHeight;typeof e.options.height=="number"?(t=e.options.height,typeof e.options.minHeight=="number"&&(t=Math.max(t,e.options.minHeight)),t=Math.min(window.innerHeight,t)):t=e.element.clientHeight,e.element.classList.contains("vditor--fullscreen")&&(t=window.innerHeight),e[e.currentMode].element.style.setProperty("--editor-bottom",(t-e.toolbar.element.offsetHeight)/2+"px")}},an;function on(){window.removeEventListener("resize",an)}var Yr=function(e){Et(e),on(),window.addEventListener("resize",an=function(){je(e),Et(e)});var t=(0,l.pK)()&&localStorage.getItem(e.options.cache.id);return(!e.options.cache.enable||!t)&&(e.options.value?t=e.options.value:e.originalInnerHTML?t=e.lute.HTML2Md(e.originalInnerHTML):e.options.cache.enable||(t="")),t||""},lt=function(e){clearTimeout(e[e.currentMode].hlToolbarTimeoutId),e[e.currentMode].hlToolbarTimeoutId=window.setTimeout(function(){if(e[e.currentMode].element.getAttribute("contenteditable")!=="false"&&(0,M.Gb)(e[e.currentMode].element)){g(e.toolbar.elements,w.g.EDIT_TOOLBARS),h(e.toolbar.elements,w.g.EDIT_TOOLBARS);var t=(0,M.zh)(e),n=t.startContainer;t.startContainer.nodeType===3&&(n=t.startContainer.parentElement),n.classList.contains("vditor-reset")&&(n=n.childNodes[t.startOffset]);var r=e.currentMode==="sv"?(0,s.a1)(n,"data-type","heading"):(0,k.W)(n);r&&p(e.toolbar.elements,["headings"]);var i=e.currentMode==="sv"?(0,s.a1)(n,"data-type","blockquote"):(0,s.lG)(n,"BLOCKQUOTE");i&&p(e.toolbar.elements,["quote"]);var a=(0,s.a1)(n,"data-type","strong");a&&p(e.toolbar.elements,["bold"]);var o=(0,s.a1)(n,"data-type","em");o&&p(e.toolbar.elements,["italic"]);var u=(0,s.a1)(n,"data-type","s");u&&p(e.toolbar.elements,["strike"]);var m=(0,s.a1)(n,"data-type","a");m&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"LI");f?(f.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):f.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):f.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),h(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]);var S=(0,s.a1)(n,"data-type","code-block");S&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"]));var T=(0,s.a1)(n,"data-type","code");T&&(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"]));var R=(0,s.a1)(n,"data-type","table");R&&d(e.toolbar.elements,["headings","list","ordered-list","check","line","quote","code","table"])}},200)},pe=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),clearTimeout(e.wysiwyg.afterRenderTimeoutId),e.wysiwyg.afterRenderTimeoutId=window.setTimeout(function(){if(!e.wysiwyg.composingLock){var n=D(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,l.pK)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}},e.options.undoDelay)},Qr=function(e){for(var t=e.previousSibling;t;){if(t.nodeType!==3&&t.tagName==="A"&&!t.previousSibling&&t.innerHTML.replace(w.g.ZWSP,"")===""&&t.nextSibling)return t;t=t.previousSibling}return!1},ei=function(e){for(var t=e.startContainer.nextSibling;t&&t.textContent==="";)t=t.nextSibling;return!!(t&&t.nodeType!==3&&(t.tagName==="CODE"||t.getAttribute("data-type")==="math-inline"||t.getAttribute("data-type")==="html-entity"||t.getAttribute("data-type")==="html-inline"))},sn=function(e){for(var t="",n=e.nextSibling;n;)n.nodeType===3?t+=n.textContent:t+=n.outerHTML,n=n.nextSibling;return t},ln=function(e){for(var t="",n=e.previousSibling;n;)n.nodeType===3?t=n.textContent+t:t=n.outerHTML+t,n=n.previousSibling;return t},ti=function(e){for(var t=e;t&&!t.nextSibling;)t=t.parentElement;return t.nextSibling},ni=function(e){var t=ln(e.startContainer),n=sn(e.startContainer),r=e.startContainer.textContent,i=e.startOffset,a="",o="";return(r.substr(0,i)!==""&&r.substr(0,i)!==w.g.ZWSP||t)&&(a="".concat(t).concat(r.substr(0,i))),(r.substr(i)!==""&&r.substr(i)!==w.g.ZWSP||n)&&(o="".concat(r.substr(i)).concat(n)),{afterHTML:o,beforeHTML:a}},Ht=function(e,t){Array.from(e.wysiwyg.element.childNodes).find(function(n){if(n.nodeType===3){var r=document.createElement("p");r.setAttribute("data-block","0"),r.textContent=n.textContent;var i=t.startContainer.nodeType===3?t.startOffset:n.textContent.length;return n.parentNode.insertBefore(r,n),n.remove(),t.setStart(r.firstChild,Math.min(r.firstChild.textContent.length,i)),t.collapse(!0),(0,M.Hc)(t),!0}else if(!n.getAttribute("data-block"))return n.tagName==="P"?n.remove():(n.tagName==="DIV"?(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>")):n.tagName==="BR"?n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"<wbr></p>"):(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.outerHTML,"</p>")),(0,M.ib)(e.wysiwyg.element,t),t=getSelection().getRangeAt(0)),!0})},St=function(e,t){var n=(0,M.zh)(e),r=(0,s.F9)(n.startContainer);r||(r=n.startContainer.childNodes[n.startOffset]),!r&&e.wysiwyg.element.children.length===0&&(r=e.wysiwyg.element),r&&!r.classList.contains("vditor-wysiwyg__block")&&(n.insertNode(document.createElement("wbr")),r.innerHTML.trim()==="<wbr>"&&(r.innerHTML="<wbr><br>"),r.tagName==="BLOCKQUOTE"||r.classList.contains("vditor-reset")?r.innerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"):r.outerHTML="<".concat(t,' data-block="0">').concat(r.innerHTML.trim(),"</").concat(t,">"),(0,M.ib)(e.wysiwyg.element,n),Fe(e))},Ot=function(e){var t=getSelection().getRangeAt(0),n=(0,s.F9)(t.startContainer);n||(n=t.startContainer.childNodes[t.startOffset]),n&&(t.insertNode(document.createElement("wbr")),n.outerHTML='<p data-block="0">'.concat(n.innerHTML,"</p>"),(0,M.ib)(e.wysiwyg.element,t)),e.wysiwyg.popover.style.display="none"},ct=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling,i=r.ownerDocument.createRange();r.tagName==="CODE"?(r.style.display="inline-block",n?i.setStart(r.firstChild,1):i.selectNodeContents(r)):(r.style.display="block",r.firstChild.firstChild||r.firstChild.appendChild(document.createTextNode("")),i.selectNodeContents(r.firstChild)),n?i.collapse(!0):i.collapse(!1),(0,M.Hc)(i),!e.firstElementChild.classList.contains("language-mindmap")&&Se(t)},ri=function(e,t){if(e.wysiwyg.composingLock=t.isComposing,t.isComposing)return!1;t.key.indexOf("Arrow")===-1&&t.key!=="Meta"&&t.key!=="Control"&&t.key!=="Alt"&&t.key!=="Shift"&&t.key!=="CapsLock"&&t.key!=="Escape"&&!/^F\d{1,2}$/.test(t.key)&&e.undo.recordFirstPosition(e,t);var n=(0,M.zh)(e),r=n.startContainer;if(!bn(t,e,r)||(wn(n,e,t),Nn(n),t.key!=="Enter"&&t.key!=="Tab"&&t.key!=="Backspace"&&t.key.indexOf("Arrow")===-1&&!(0,l.yl)(t)&&t.key!=="Escape"&&t.key!=="Delete"))return!1;var i=(0,s.F9)(r),a=(0,s.lG)(r,"P");if(Cn(t,e,a,n)||kn(n,e,a,t)||An(e,t,n))return!0;var o=(0,s.fb)(r,"vditor-wysiwyg__block");if(o){if(t.key==="Escape"&&o.children.length===2)return e.wysiwyg.popover.style.display="none",o.firstElementChild.style.display="none",e.wysiwyg.element.blur(),t.preventDefault(),!0;if(!(0,l.yl)(t)&&!t.shiftKey&&t.altKey&&t.key==="Enter"&&o.getAttribute("data-type")==="code-block"){var u=e.wysiwyg.popover.querySelector(".vditor-input");return u.focus(),u.select(),t.preventDefault(),!0}if(o.getAttribute("data-block")==="0"&&(xn(e,t,o.firstElementChild,n)||pt(e,t,n,o.firstElementChild,o)||o.getAttribute("data-type")!=="yaml-front-matter"&&rt(e,t,n,o.firstElementChild,o)))return!0}if(Dn(e,n,t,a))return!0;var m=(0,s.E2)(r,"BLOCKQUOTE");if(m&&!t.shiftKey&&t.altKey&&t.key==="Enter"){(0,l.yl)(t)?n.setStartBefore(m):n.setStartAfter(m),(0,M.Hc)(n);var f=document.createElement("p");return f.setAttribute("data-block","0"),f.innerHTML=`
63
- `,n.insertNode(f),n.collapse(!0),(0,M.Hc)(n),pe(e),Se(e),t.preventDefault(),!0}var S=(0,k.W)(r);if(S){if(S.tagName==="H6"&&r.textContent.length===n.startOffset&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"){var T=document.createElement("p");return T.textContent=`
64
- `,T.setAttribute("data-block","0"),r.parentElement.insertAdjacentElement("afterend",T),n.setStart(T,0),(0,M.Hc)(n),pe(e),Se(e),t.preventDefault(),!0}if(j("⌘=",t)){var R=parseInt(S.tagName.substr(1),10)-1;return R>0&&(St(e,"h".concat(R)),pe(e)),t.preventDefault(),!0}if(j("⌘-",t)){var R=parseInt(S.tagName.substr(1),10)+1;return R<7&&(St(e,"h".concat(R)),pe(e)),t.preventDefault(),!0}t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&S.textContent.length===1&&Ot(e)}if(Hn(e,n,t))return!0;if(t.altKey&&t.key==="Enter"&&!(0,l.yl)(t)&&!t.shiftKey){var P=(0,s.lG)(r,"A"),O=(0,s.a1)(r,"data-type","link-ref"),W=(0,s.a1)(r,"data-type","footnotes-ref");if(P||O||W||S&&S.tagName.length===2){var U=e.wysiwyg.popover.querySelector("input");U.focus(),U.select()}}if(He(e,t))return!0;if(j("⇧⌘U",t)){var N=e.wysiwyg.popover.querySelector('[data-type="up"]');if(N)return N.click(),t.preventDefault(),!0}if(j("⇧⌘D",t)){var N=e.wysiwyg.popover.querySelector('[data-type="down"]');if(N)return N.click(),t.preventDefault(),!0}if(Gt(e,n,t))return!0;if(!(0,l.yl)(t)&&t.shiftKey&&!t.altKey&&t.key==="Enter"&&r.parentElement.tagName!=="LI"&&r.parentElement.tagName!=="P")return["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName)?n.insertNode(document.createTextNode(`
65
- `+w.g.ZWSP)):n.insertNode(document.createTextNode(`
66
- `)),n.collapse(!1),(0,M.Hc)(n),pe(e),Se(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&n.toString()===""){if(On(e,n,t,a))return!0;if(i){if(i.previousElementSibling&&i.previousElementSibling.classList.contains("vditor-wysiwyg__block")&&i.previousElementSibling.getAttribute("data-block")==="0"&&i.tagName!=="UL"&&i.tagName!=="OL"){var J=(0,M.im)(i,e.wysiwyg.element,n).start;if(J===0&&n.startOffset===0||J===1&&i.innerText.startsWith(w.g.ZWSP))return ct(i.previousElementSibling.lastElementChild,e,!1),i.innerHTML.trim().replace(w.g.ZWSP,"")===""&&(i.remove(),pe(e)),t.preventDefault(),!0}var F=n.startOffset;if(n.toString()===""&&r.nodeType===3&&r.textContent.charAt(F-2)===`
67
- `&&r.textContent.charAt(F-1)!==w.g.ZWSP&&["STRONG","STRIKE","S","I","EM","B"].includes(r.parentElement.tagName))return r.textContent=r.textContent.substring(0,F-1)+w.g.ZWSP,n.setStart(r,F),n.collapse(!0),pe(e),t.preventDefault(),!0;r.textContent===w.g.ZWSP&&n.startOffset===1&&!r.previousSibling&&ei(n)&&(r.textContent=""),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='math-inline']").forEach(function(fe){fe.firstElementChild.style.display="inline",fe.lastElementChild.style.display="none"}),i.querySelectorAll("span.vditor-wysiwyg__block[data-type='html-entity']").forEach(function(fe){fe.firstElementChild.style.display="inline",fe.lastElementChild.style.display="none"})}}if((0,l.vU)()&&n.startOffset===1&&r.textContent.indexOf(w.g.ZWSP)>-1&&r.previousSibling&&r.previousSibling.nodeType!==3&&r.previousSibling.tagName==="CODE"&&(t.key==="Backspace"||t.key==="ArrowLeft"))return n.selectNodeContents(r.previousSibling),n.collapse(!1),t.preventDefault(),!0;if(Rn(t,i,n))return t.preventDefault(),!0;if(vn(n,t.key),t.key==="ArrowDown"){var Y=r.nextSibling;Y&&Y.nodeType!==3&&Y.getAttribute("data-type")==="math-inline"&&n.setStartAfter(Y)}return i&&vt(i,e,t,n)?(t.preventDefault(),!0):!1},He=function(e,t){if(j("⇧⌘X",t)){var n=e.wysiwyg.popover.querySelector('[data-type="remove"]');return n&&n.click(),t.preventDefault(),!0}},Ye=function(e){clearTimeout(e.wysiwyg.hlToolbarTimeoutId),e.wysiwyg.hlToolbarTimeoutId=window.setTimeout(function(){if(e.wysiwyg.element.getAttribute("contenteditable")!=="false"&&(0,M.Gb)(e.wysiwyg.element)){g(e.toolbar.elements,w.g.EDIT_TOOLBARS),h(e.toolbar.elements,w.g.EDIT_TOOLBARS);var t=getSelection().getRangeAt(0),n=t.startContainer;t.startContainer.nodeType===3?n=t.startContainer.parentElement:n=n.childNodes[t.startOffset>=n.childNodes.length?n.childNodes.length-1:t.startOffset];var r=(0,s.a1)(n,"data-type","footnotes-block");if(r){e.wysiwyg.popover.innerHTML="",Ve(r,e),Ie(e,"footnotes-block"),Be(e,r);return}var i=(0,s.lG)(n,"LI");i?(i.classList.contains("vditor-task")?p(e.toolbar.elements,["check"]):i.parentElement.tagName==="OL"?p(e.toolbar.elements,["ordered-list"]):i.parentElement.tagName==="UL"&&p(e.toolbar.elements,["list"]),h(e.toolbar.elements,["outdent","indent"])):d(e.toolbar.elements,["outdent","indent"]),(0,s.lG)(n,"BLOCKQUOTE")&&p(e.toolbar.elements,["quote"]),((0,s.lG)(n,"B")||(0,s.lG)(n,"STRONG"))&&p(e.toolbar.elements,["bold"]),((0,s.lG)(n,"I")||(0,s.lG)(n,"EM"))&&p(e.toolbar.elements,["italic"]),((0,s.lG)(n,"STRIKE")||(0,s.lG)(n,"S"))&&p(e.toolbar.elements,["strike"]),e.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function(G){G.classList.remove("vditor-comment--focus")});var a=(0,s.fb)(n,"vditor-comment");if(a){var o=a.getAttribute("data-cmtids").split(" ");if(o.length>1&&a.nextSibling.isSameNode(a.nextElementSibling)){var u=a.nextElementSibling.getAttribute("data-cmtids").split(" ");o.find(function(G){if(u.includes(G))return o=[G],!0})}e.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(G){G.getAttribute("data-cmtids").indexOf(o[0])>-1&&G.classList.add("vditor-comment--focus")})}var m=(0,s.lG)(n,"A");m&&p(e.toolbar.elements,["link"]);var f=(0,s.lG)(n,"TABLE"),S=(0,k.W)(n);(0,s.lG)(n,"CODE")?(0,s.lG)(n,"PRE")?(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","inline-code","upload","link","table","record"]),p(e.toolbar.elements,["code"])):(d(e.toolbar.elements,["headings","bold","italic","strike","line","quote","list","ordered-list","check","code","upload","link","table","record"]),p(e.toolbar.elements,["inline-code"])):S?(d(e.toolbar.elements,["bold"]),p(e.toolbar.elements,["headings"])):f&&d(e.toolbar.elements,["table"]);var T=(0,s.fb)(n,"vditor-toc");if(T){e.wysiwyg.popover.innerHTML="",Ve(T,e),Ie(e,"vditor-toc"),Be(e,T);return}var R=(0,k.S)(n,"BLOCKQUOTE");if(R&&(e.wysiwyg.popover.innerHTML="",et(t,R,e),tt(t,R,e),Ve(R,e),Ie(e,"blockquote"),Be(e,R)),i&&(e.wysiwyg.popover.innerHTML="",et(t,i,e),tt(t,i,e),Ve(i,e),Ie(e,"li"),Be(e,i)),f){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var P=function(){var G=f.rows.length,ie=f.rows[0].cells.length,Je=parseInt(ke.value,10)||G,Xe=parseInt(Pe.value,10)||ie;if(!(Je===G&&ie===Xe)){if(ie!==Xe)for(var gt=Xe-ie,Ke=0;Ke<f.rows.length;Ke++)if(gt>0)for(var Kn=0;Kn<gt;Kn++)Ke===0?f.rows[Ke].lastElementChild.insertAdjacentHTML("afterend","<th> </th>"):f.rows[Ke].lastElementChild.insertAdjacentHTML("afterend","<td> </td>");else for(var Xt=ie-1;Xt>=Xe;Xt--)f.rows[Ke].cells[Xt].remove();if(G!==Je){var zn=Je-G;if(zn>0){for(var Yt="<tr>",ot=0;ot<Xe;ot++)Yt+="<td> </td>";for(var Gn=0;Gn<zn;Gn++)f.querySelector("tbody")?f.querySelector("tbody").insertAdjacentHTML("beforeend",Yt):f.querySelector("thead").insertAdjacentHTML("afterend",Yt+"</tr>")}else for(var ot=G-1;ot>=Je;ot--)f.rows[ot].remove(),f.rows.length===1&&f.querySelector("tbody").remove()}typeof e.options.input=="function"&&e.options.input(D(e))}},O=function(G){Lt(f,G),G==="right"?(J.classList.remove("vditor-icon--current"),F.classList.remove("vditor-icon--current"),Y.classList.add("vditor-icon--current")):G==="center"?(J.classList.remove("vditor-icon--current"),Y.classList.remove("vditor-icon--current"),F.classList.add("vditor-icon--current")):(F.classList.remove("vditor-icon--current"),Y.classList.remove("vditor-icon--current"),J.classList.add("vditor-icon--current")),(0,M.Hc)(t),pe(e)},W=(0,s.lG)(n,"TD"),U=(0,s.lG)(n,"TH"),N="left";W?N=W.getAttribute("align")||"left":U&&(N=U.getAttribute("align")||"center");var J=document.createElement("button");J.setAttribute("type","button"),J.setAttribute("aria-label",window.VditorI18n.alignLeft+"<"+(0,l.ns)("⇧⌘L")+">"),J.setAttribute("data-type","left"),J.innerHTML='<svg><use xlink:href="#vditor-icon-align-left"></use></svg>',J.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="left"?" vditor-icon--current":""),J.onclick=function(){O("left")};var F=document.createElement("button");F.setAttribute("type","button"),F.setAttribute("aria-label",window.VditorI18n.alignCenter+"<"+(0,l.ns)("⇧⌘C")+">"),F.setAttribute("data-type","center"),F.innerHTML='<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',F.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="center"?" vditor-icon--current":""),F.onclick=function(){O("center")};var Y=document.createElement("button");Y.setAttribute("type","button"),Y.setAttribute("aria-label",window.VditorI18n.alignRight+"<"+(0,l.ns)("⇧⌘R")+">"),Y.setAttribute("data-type","right"),Y.innerHTML='<svg><use xlink:href="#vditor-icon-align-right"></use></svg>',Y.className="vditor-icon vditor-tooltipped vditor-tooltipped__n"+(N==="right"?" vditor-icon--current":""),Y.onclick=function(){O("right")};var fe=document.createElement("button");fe.setAttribute("type","button"),fe.setAttribute("aria-label",window.VditorI18n.insertRowBelow+"<"+(0,l.ns)("⌘=")+">"),fe.setAttribute("data-type","insertRow"),fe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>',fe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",fe.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&_n(e,t,ie)};var ce=document.createElement("button");ce.setAttribute("type","button"),ce.setAttribute("aria-label",window.VditorI18n.insertRowAbove+"<"+(0,l.ns)("⇧⌘F")+">"),ce.setAttribute("data-type","insertRow"),ce.innerHTML='<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>',ce.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",ce.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Ln(e,t,ie)};var he=document.createElement("button");he.setAttribute("type","button"),he.setAttribute("aria-label",window.VditorI18n.insertColumnRight+"<"+(0,l.ns)("⇧⌘=")+">"),he.setAttribute("data-type","insertColumn"),he.innerHTML='<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>',he.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",he.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Mt(e,f,ie)};var Oe=document.createElement("button");Oe.setAttribute("type","button"),Oe.setAttribute("aria-label",window.VditorI18n.insertColumnLeft+"<"+(0,l.ns)("⇧⌘G")+">"),Oe.setAttribute("data-type","insertColumn"),Oe.innerHTML='<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>',Oe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Oe.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Mt(e,f,ie,"beforebegin")};var xe=document.createElement("button");xe.setAttribute("type","button"),xe.setAttribute("aria-label",window.VditorI18n["delete-row"]+"<"+(0,l.ns)("⌘-")+">"),xe.setAttribute("data-type","deleteRow"),xe.innerHTML='<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>',xe.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",xe.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Mn(e,t,ie)};var Ne=document.createElement("button");Ne.setAttribute("type","button"),Ne.setAttribute("aria-label",window.VditorI18n["delete-column"]+"<"+(0,l.ns)("⇧⌘-")+">"),Ne.setAttribute("data-type","deleteColumn"),Ne.innerHTML='<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>',Ne.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",Ne.onclick=function(){var G=getSelection().getRangeAt(0).startContainer,ie=(0,s.lG)(G,"TD")||(0,s.lG)(G,"TH");ie&&Tn(e,t,f,ie)};var te=document.createElement("span");te.setAttribute("aria-label",window.VditorI18n.row),te.className="vditor-tooltipped vditor-tooltipped__n";var ke=document.createElement("input");te.appendChild(ke),ke.type="number",ke.min="1",ke.className="vditor-input",ke.style.width="42px",ke.style.textAlign="center",ke.setAttribute("placeholder",window.VditorI18n.row),ke.value=f.rows.length.toString(),ke.oninput=function(){P()},ke.onkeydown=function(G){if(!G.isComposing){if(G.key==="Tab"){Pe.focus(),Pe.select(),G.preventDefault();return}He(e,G)||qe(G,t)}};var xt=document.createElement("span");xt.setAttribute("aria-label",window.VditorI18n.column),xt.className="vditor-tooltipped vditor-tooltipped__n";var Pe=document.createElement("input");xt.appendChild(Pe),Pe.type="number",Pe.min="1",Pe.className="vditor-input",Pe.style.width="42px",Pe.style.textAlign="center",Pe.setAttribute("placeholder",window.VditorI18n.column),Pe.value=f.rows[0].cells.length.toString(),Pe.oninput=function(){P()},Pe.onkeydown=function(G){if(!G.isComposing){if(G.key==="Tab"){ke.focus(),ke.select(),G.preventDefault();return}He(e,G)||qe(G,t)}},et(t,f,e),tt(t,f,e),Ve(f,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",J),e.wysiwyg.popover.insertAdjacentElement("beforeend",F),e.wysiwyg.popover.insertAdjacentElement("beforeend",Y),e.wysiwyg.popover.insertAdjacentElement("beforeend",ce),e.wysiwyg.popover.insertAdjacentElement("beforeend",fe),e.wysiwyg.popover.insertAdjacentElement("beforeend",Oe),e.wysiwyg.popover.insertAdjacentElement("beforeend",he),e.wysiwyg.popover.insertAdjacentElement("beforeend",xe),e.wysiwyg.popover.insertAdjacentElement("beforeend",Ne),e.wysiwyg.popover.insertAdjacentElement("beforeend",te),e.wysiwyg.popover.insertAdjacentHTML("beforeend"," x "),e.wysiwyg.popover.insertAdjacentElement("beforeend",xt),Ie(e,"table"),Be(e,f)}var Jt=(0,s.a1)(n,"data-type","link-ref");Jt&&cn(e,Jt,t);var it=(0,s.a1)(n,"data-type","footnotes-ref");if(it){e.options.lang,e.options,e.wysiwyg.popover.innerHTML="";var te=document.createElement("span");te.setAttribute("aria-label",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),te.className="vditor-tooltipped vditor-tooltipped__n";var Ge=document.createElement("input");te.appendChild(Ge),Ge.className="vditor-input",Ge.setAttribute("placeholder",window.VditorI18n.footnoteRef+"<"+(0,l.ns)("⌥Enter")+">"),Ge.style.width="120px",Ge.value=it.getAttribute("data-footnotes-label"),Ge.oninput=function(){Ge.value.trim()!==""&&it.setAttribute("data-footnotes-label",Ge.value),typeof e.options.input=="function"&&e.options.input(D(e))},Ge.onkeydown=function(ie){ie.isComposing||He(e,ie)||qe(ie,t)},Ve(it,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",te),Ie(e,"footnotes-ref"),Be(e,it)}var Te=(0,s.fb)(n,"vditor-wysiwyg__block"),Fn=Te?Te.getAttribute("data-type").indexOf("block")>-1:!1;if(e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(G){if(!Te||Te&&Fn&&!Te.contains(G)){var ie=G.previousElementSibling;ie.style.display="none"}}),Te&&Fn){if(e.wysiwyg.popover.innerHTML="",et(t,Te,e),tt(t,Te,e),Ve(Te,e),Te.getAttribute("data-type")==="code-block"){var Dt=document.createElement("span");Dt.setAttribute("aria-label",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),Dt.className="vditor-tooltipped vditor-tooltipped__n";var We=document.createElement("input");Dt.appendChild(We);var mt=Te.firstElementChild.firstElementChild;We.className="vditor-input",We.setAttribute("placeholder",window.VditorI18n.language+"<"+(0,l.ns)("⌥Enter")+">"),We.value=mt.className.indexOf("language-")>-1?mt.className.split("-")[1].split(" ")[0]:"",We.oninput=function(G){We.value.trim()!==""?mt.className="language-".concat(We.value):(mt.className="",e.hint.recentLanguage=""),Te.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(Te.lastElementChild.innerHTML=Te.firstElementChild.innerHTML,_e(Te.lastElementChild,e)),pe(e),G.detail===1&&(t.setStart(mt.firstChild,0),t.collapse(!0),(0,M.Hc)(t))},We.onkeydown=function(G){if(!G.isComposing&&!He(e,G)){if(G.key==="Escape"&&e.hint.element.style.display==="block"){e.hint.element.style.display="none",G.preventDefault();return}e.hint.select(G,e),qe(G,t)}},We.onkeyup=function(G){var ie,Je;if(!(G.isComposing||G.key==="Enter"||G.key==="ArrowUp"||G.key==="Escape"||G.key==="ArrowDown")){var Xe=[],gt=We.value.substring(0,We.selectionStart);(e.options.preview.hljs.langs||w.g.ALIAS_CODE_LANGUAGES.concat(((Je=(ie=window.hljs)===null||ie===void 0?void 0:ie.listLanguages())!==null&&Je!==void 0?Je:[]).sort())).forEach(function(Ke){Ke.indexOf(gt.toLowerCase())>-1&&Xe.push({html:Ke,value:Ke})}),e.hint.genHTML(Xe,gt,e),G.preventDefault()}},e.wysiwyg.popover.insertAdjacentElement("beforeend",Dt),Ie(e,"code-block")}else Ie(e,"block");Be(e,Te)}else Te=void 0;if(S){e.wysiwyg.popover.innerHTML="";var te=document.createElement("span");te.setAttribute("aria-label","ID<"+(0,l.ns)("⌥Enter")+">"),te.className="vditor-tooltipped vditor-tooltipped__n";var Ze=document.createElement("input");te.appendChild(Ze),Ze.className="vditor-input",Ze.setAttribute("placeholder","ID<"+(0,l.ns)("⌥Enter")+">"),Ze.style.width="120px",Ze.value=S.getAttribute("data-id")||"",Ze.oninput=function(){S.setAttribute("data-id",Ze.value),typeof e.options.input=="function"&&e.options.input(D(e))},Ze.onkeydown=function(ie){ie.isComposing||He(e,ie)||qe(ie,t)},et(t,S,e),tt(t,S,e),Ve(S,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",te),Ie(e,"heading"),Be(e,S)}if(m&&Nt(e,m,t),!R&&!i&&!f&&!Te&&!m&&!Jt&&!it&&!S&&!T){var at=(0,s.a1)(n,"data-block","0");at&&at.parentElement.isEqualNode(e.wysiwyg.element)?(e.wysiwyg.popover.innerHTML="",et(t,at,e),tt(t,at,e),Ve(at,e),Ie(e,"block"),Be(e,at)):e.wysiwyg.popover.style.display="none"}e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(G){G.style.display="none"});var qn=(0,s.a1)(t.startContainer,"data-type","backslash");qn&&(qn.querySelector("span").style.display="inline")}},200)},Be=function(e,t){var n=t,r=(0,s.lG)(t,"TABLE");r&&(n=r),e.wysiwyg.popover.style.left="0",e.wysiwyg.popover.style.display="block",e.wysiwyg.popover.style.top=Math.max(-8,n.offsetTop-21-e.wysiwyg.element.scrollTop)+"px",e.wysiwyg.popover.style.left=Math.min(n.offsetLeft,e.wysiwyg.element.clientWidth-e.wysiwyg.popover.clientWidth)+"px",e.wysiwyg.popover.setAttribute("data-top",(n.offsetTop-21).toString())},cn=function(e,t,n){n===void 0&&(n=getSelection().getRangeAt(0)),e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.tagName==="IMG"?t.setAttribute("alt",a.value):t.textContent=a.value),u.value.trim()!==""&&t.setAttribute("data-link-label",u.value),typeof e.options.input=="function"&&e.options.input(D(e))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.getAttribute("alt")||t.textContent,a.oninput=function(){r()},a.onkeydown=function(m){He(e,m)||qe(m,n)||ut(e,t,m,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.linkRef),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.linkRef),u.value=t.getAttribute("data-link-label"),u.oninput=function(){r()},u.onkeydown=function(m){He(e,m)||qe(m,n)||ut(e,t,m,a)},Ve(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),Ie(e,"link-ref"),Be(e,t)},et=function(e,t,n){var r=t.previousElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","up"),i.setAttribute("aria-label",window.VditorI18n.up+"<"+(0,l.ns)("⇧⌘U")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-up"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("beforebegin",t),(0,M.ib)(n.wysiwyg.element,e),pe(n),Ye(n),Se(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},tt=function(e,t,n){var r=t.nextElementSibling;if(!(!r||!t.parentElement.isEqualNode(n.wysiwyg.element)&&t.tagName!=="LI")){var i=document.createElement("button");i.setAttribute("type","button"),i.setAttribute("data-type","down"),i.setAttribute("aria-label",window.VditorI18n.down+"<"+(0,l.ns)("⇧⌘D")+">"),i.innerHTML='<svg><use xlink:href="#vditor-icon-down"></use></svg>',i.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",i.onclick=function(){e.insertNode(document.createElement("wbr")),r.insertAdjacentElement("afterend",t),(0,M.ib)(n.wysiwyg.element,e),pe(n),Ye(n),Se(n)},n.wysiwyg.popover.insertAdjacentElement("beforeend",i)}},Ve=function(e,t){var n=document.createElement("button");n.setAttribute("type","button"),n.setAttribute("data-type","remove"),n.setAttribute("aria-label",window.VditorI18n.remove+"<"+(0,l.ns)("⇧⌘X")+">"),n.innerHTML='<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>',n.className="vditor-icon vditor-tooltipped vditor-tooltipped__n",n.onclick=function(){var r=(0,M.zh)(t);r.setStartAfter(e),(0,M.Hc)(r),e.remove(),pe(t),Ye(t),["H1","H2","H3","H4","H5","H6"].includes(e.tagName)&&Fe(t)},t.wysiwyg.popover.insertAdjacentElement("beforeend",n)},ut=function(e,t,n,r){if(!n.isComposing){if(n.key==="Tab"){r.focus(),r.select(),n.preventDefault();return}if(!(0,l.yl)(n)&&!n.shiftKey&&n.altKey&&n.key==="Enter"){var i=(0,M.zh)(e);t.insertAdjacentHTML("afterend",w.g.ZWSP),i.setStartAfter(t.nextSibling),i.collapse(!0),(0,M.Hc)(i),n.preventDefault()}}},Nt=function(e,t,n){e.wysiwyg.popover.innerHTML="";var r=function(){a.value.trim()!==""&&(t.innerHTML=a.value),t.setAttribute("href",u.value),t.setAttribute("title",f.value),pe(e)};t.querySelectorAll("[data-marker]").forEach(function(S){S.removeAttribute("data-marker")});var i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.textIsNotEmpty),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.textIsNotEmpty),a.style.width="120px",a.value=t.innerHTML||"",a.oninput=function(){r()},a.onkeydown=function(S){He(e,S)||qe(S,n)||ut(e,t,S,u)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.link),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.link),u.value=t.getAttribute("href")||"",u.oninput=function(){r()},u.onkeydown=function(S){He(e,S)||qe(S,n)||ut(e,t,S,f)};var m=document.createElement("span");m.setAttribute("aria-label",window.VditorI18n.tooltipText),m.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");m.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.tooltipText),f.style.width="60px",f.value=t.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){He(e,S)||qe(S,n)||ut(e,t,S,a)},Ve(t,e),e.wysiwyg.popover.insertAdjacentElement("beforeend",i),e.wysiwyg.popover.insertAdjacentElement("beforeend",o),e.wysiwyg.popover.insertAdjacentElement("beforeend",m),Ie(e,"a"),Be(e,t)},ii=function(e,t){var n=e.target;t.wysiwyg.popover.innerHTML="";var r=function(){n.setAttribute("src",a.value),n.setAttribute("alt",u.value),n.setAttribute("title",f.value),typeof t.options.input=="function"&&t.options.input(D(t))},i=document.createElement("span");i.setAttribute("aria-label",window.VditorI18n.imageURL),i.className="vditor-tooltipped vditor-tooltipped__n";var a=document.createElement("input");i.appendChild(a),a.className="vditor-input",a.setAttribute("placeholder",window.VditorI18n.imageURL),a.value=n.getAttribute("src")||"",a.oninput=function(){r()},a.onkeydown=function(S){He(t,S)};var o=document.createElement("span");o.setAttribute("aria-label",window.VditorI18n.alternateText),o.className="vditor-tooltipped vditor-tooltipped__n";var u=document.createElement("input");o.appendChild(u),u.className="vditor-input",u.setAttribute("placeholder",window.VditorI18n.alternateText),u.style.width="52px",u.value=n.getAttribute("alt")||"",u.oninput=function(){r()},u.onkeydown=function(S){He(t,S)};var m=document.createElement("span");m.setAttribute("aria-label",window.VditorI18n.title),m.className="vditor-tooltipped vditor-tooltipped__n";var f=document.createElement("input");m.appendChild(f),f.className="vditor-input",f.setAttribute("placeholder",window.VditorI18n.title),f.value=n.getAttribute("title")||"",f.oninput=function(){r()},f.onkeydown=function(S){He(t,S)},Ve(n,t),t.wysiwyg.popover.insertAdjacentElement("beforeend",i),t.wysiwyg.popover.insertAdjacentElement("beforeend",o),t.wysiwyg.popover.insertAdjacentElement("beforeend",m),Ie(t,"image"),Be(t,n)},qe=function(e,t){if(!(0,l.yl)(e)&&!e.shiftKey&&e.key==="Enter"||e.key==="Escape")return t&&(0,M.Hc)(t),e.preventDefault(),e.stopPropagation(),!0},Ie=function(e,t){e.options.customWysiwygToolbar(t,e.wysiwyg.popover)},nt=function(e){e.currentMode==="wysiwyg"?Ye(e):e.currentMode==="ir"&&lt(e)},un=function(e,t,n){n===void 0&&(n={enableAddUndoStack:!0,enableHint:!1,enableInput:!0});var r=e.wysiwyg.element;r.innerHTML=e.lute.Md2VditorDOM(t),r.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(i){_e(i,e),i.previousElementSibling.setAttribute("style","display:none")}),pe(e,n)},ai=function(e,t,n){for(var r=e.startContainer.parentElement,i=!1,a="",o="",u=ni(e),m=u.beforeHTML,f=u.afterHTML;r&&!i;){var S=r.tagName;if(S==="STRIKE"&&(S="S"),S==="I"&&(S="EM"),S==="B"&&(S="STRONG"),S==="S"||S==="STRONG"||S==="EM"){var T="",R="",P="";r.parentElement.getAttribute("data-block")!=="0"&&(R=ln(r),P=sn(r)),(m||R)&&(T="".concat(R,"<").concat(S,">").concat(m,"</").concat(S,">"),m=T),(n==="bold"&&S==="STRONG"||n==="italic"&&S==="EM"||n==="strikeThrough"&&S==="S")&&(T+="".concat(a).concat(w.g.ZWSP,"<wbr>").concat(o),i=!0),(f||P)&&(f="<".concat(S,">").concat(f,"</").concat(S,">").concat(P),T+=f),r.parentElement.getAttribute("data-block")!=="0"?(r=r.parentElement,r.innerHTML=T):(r.outerHTML=T,r=r.parentElement),a="<".concat(S,">")+a,o="</".concat(S,">")+o}else i=!0}(0,M.ib)(t.wysiwyg.element,e)},oi=function(e,t,n){if(!(e.wysiwyg.composingLock&&n instanceof CustomEvent)){var r=!0,i=!0;e.wysiwyg.element.querySelector("wbr")&&e.wysiwyg.element.querySelector("wbr").remove();var a=(0,M.zh)(e),o=t.getAttribute("data-type");if(t.classList.contains("vditor-menu--current"))if(o==="strike"&&(o="strikeThrough"),o==="quote"){var u=(0,s.lG)(a.startContainer,"BLOCKQUOTE");u||(u=a.startContainer.childNodes[a.startOffset]),u&&(r=!1,t.classList.remove("vditor-menu--current"),a.insertNode(document.createElement("wbr")),u.outerHTML=u.innerHTML.trim()===""?'<p data-block="0">'.concat(u.innerHTML,"</p>"):u.innerHTML,(0,M.ib)(e.wysiwyg.element,a))}else if(o==="inline-code"){var m=(0,s.lG)(a.startContainer,"CODE");m||(m=a.startContainer.childNodes[a.startOffset]),m&&(m.outerHTML=m.innerHTML.replace(w.g.ZWSP,"")+"<wbr>",(0,M.ib)(e.wysiwyg.element,a))}else o==="link"?(a.collapsed&&a.selectNode(a.startContainer.parentElement),document.execCommand("unlink",!1,"")):o==="check"||o==="list"||o==="ordered-list"?(_t(e,a,o),(0,M.ib)(e.wysiwyg.element,a),r=!1,t.classList.remove("vditor-menu--current")):(r=!1,t.classList.remove("vditor-menu--current"),a.toString()===""?ai(a,e,o):document.execCommand(o,!1,""));else{e.wysiwyg.element.childNodes.length===0&&(e.wysiwyg.element.innerHTML='<p data-block="0"><wbr></p>',(0,M.ib)(e.wysiwyg.element,a));var f=(0,s.F9)(a.startContainer);if(o==="quote"){if(f||(f=a.startContainer.childNodes[a.startOffset]),f){r=!1,t.classList.add("vditor-menu--current"),a.insertNode(document.createElement("wbr"));var S=(0,s.lG)(a.startContainer,"LI");S&&f.contains(S)?S.innerHTML='<blockquote data-block="0">'.concat(S.innerHTML,"</blockquote>"):f.outerHTML='<blockquote data-block="0">'.concat(f.outerHTML,"</blockquote>"),(0,M.ib)(e.wysiwyg.element,a)}}else if(o==="check"||o==="list"||o==="ordered-list")_t(e,a,o,!1),(0,M.ib)(e.wysiwyg.element,a),r=!1,g(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current");else if(o==="inline-code"){if(a.toString()===""){var T=document.createElement("code");T.textContent=w.g.ZWSP,a.insertNode(T),a.setStart(T.firstChild,1),a.collapse(!0),(0,M.Hc)(a)}else if(a.startContainer.nodeType===3){var T=document.createElement("code");a.surroundContents(T),a.insertNode(T),(0,M.Hc)(a)}t.classList.add("vditor-menu--current")}else if(o==="code"){var T=document.createElement("div");T.className="vditor-wysiwyg__block",T.setAttribute("data-type","code-block"),T.setAttribute("data-block","0"),T.setAttribute("data-marker","```"),a.toString()===""?T.innerHTML=`<pre><code><wbr>
68
- </code></pre>`:(T.innerHTML="<pre><code>".concat(a.toString(),"<wbr></code></pre>"),a.deleteContents()),a.insertNode(T),f&&(f.outerHTML=e.lute.SpinVditorDOM(f.outerHTML)),(0,M.ib)(e.wysiwyg.element,a),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(fe){_e(fe,e)}),t.classList.add("vditor-menu--disabled")}else if(o==="link"){if(a.toString()===""){var R=document.createElement("a");R.innerText=w.g.ZWSP,a.insertNode(R),a.setStart(R.firstChild,1),a.collapse(!0),Nt(e,R,a);var P=e.wysiwyg.popover.querySelector("input");P.value="",P.focus(),i=!1}else{var T=document.createElement("a");T.setAttribute("href",""),T.innerHTML=a.toString(),a.surroundContents(T),a.insertNode(T),(0,M.Hc)(a),Nt(e,T,a);var O=e.wysiwyg.popover.querySelectorAll("input");O[0].value=T.innerText,O[1].focus()}r=!1,t.classList.add("vditor-menu--current")}else if(o==="table"){var W='<table data-block="0"><thead><tr><th>col1<wbr></th><th>col2</th><th>col3</th></tr></thead><tbody><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr></tbody></table>';if(a.toString().trim()==="")f&&f.innerHTML.trim().replace(w.g.ZWSP,"")===""?f.outerHTML=W:document.execCommand("insertHTML",!1,W),a.selectNode(e.wysiwyg.element.querySelector("wbr").previousSibling),e.wysiwyg.element.querySelector("wbr").remove(),(0,M.Hc)(a);else{W='<table data-block="0"><thead><tr>';var U=a.toString().split(`
69
- `),N=U[0].split(",").length>U[0].split(" ").length?",":" ";U.forEach(function(Y,fe){fe===0?(Y.split(N).forEach(function(ce,he){he===0?W+="<th>".concat(ce,"<wbr></th>"):W+="<th>".concat(ce,"</th>")}),W+="</tr></thead>"):(fe===1?W+="<tbody><tr>":W+="<tr>",Y.split(N).forEach(function(ce){W+="<td>".concat(ce,"</td>")}),W+="</tr>")}),W+="</tbody></table>",document.execCommand("insertHTML",!1,W),(0,M.ib)(e.wysiwyg.element,a)}r=!1,t.classList.add("vditor-menu--disabled")}else if(o==="line"){if(f){var J=`<hr data-block="0"><p data-block="0"><wbr>
70
- </p>`;f.innerHTML.trim()===""?f.outerHTML=J:f.insertAdjacentHTML("afterend",J),(0,M.ib)(e.wysiwyg.element,a)}}else if(r=!1,t.classList.add("vditor-menu--current"),o==="strike"&&(o="strikeThrough"),a.toString()===""&&(o==="bold"||o==="italic"||o==="strikeThrough")){var F="strong";o==="italic"?F="em":o==="strikeThrough"&&(F="s");var T=document.createElement(F);T.textContent=w.g.ZWSP,a.insertNode(T),T.previousSibling&&T.previousSibling.textContent===w.g.ZWSP&&(T.previousSibling.textContent=""),a.setStart(T.firstChild,1),a.collapse(!0),(0,M.Hc)(a)}else document.execCommand(o,!1,"")}r&&Ye(e),i&&pe(e)}},be=(function(){function e(t,n){var r,i=this;this.element=document.createElement("div"),n.className&&(r=this.element.classList).add.apply(r,n.className.split(" "));var a=n.hotkey?" <".concat((0,l.ns)(n.hotkey),">"):"";n.level===2&&(a=n.hotkey?" &lt;".concat((0,l.ns)(n.hotkey),"&gt;"):"");var o=n.tip?n.tip+a:"".concat(window.VditorI18n[n.name]).concat(a),u=n.name==="upload"?"div":"button";if(n.level===2)this.element.innerHTML="<".concat(u,' data-type="').concat(n.name,'">').concat(o,"</").concat(u,">");else{this.element.classList.add("vditor-toolbar__item");var m=document.createElement(u);m.setAttribute("data-type",n.name),m.className="vditor-tooltipped vditor-tooltipped__".concat(n.tipPosition),m.setAttribute("aria-label",o),m.innerHTML=n.icon,this.element.appendChild(m)}n.prefix&&this.element.children[0].addEventListener((0,l.Le)(),function(f){f.preventDefault(),!i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)&&(t.currentMode==="wysiwyg"?oi(t,i.element.children[0],f):t.currentMode==="ir"?vi(t,i.element.children[0],n.prefix||"",n.suffix||""):ui(t,i.element.children[0],n.prefix||"",n.suffix||""))})}return e})(),si=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Qe=function(e,t,n){var r;if(typeof n!="string"?(b(e,["subToolbar","hint"]),n.preventDefault(),r=D(e)):r=n,!(e.currentMode===t&&typeof n!="string")){if(e.devtools&&e.devtools.renderEchart(e),e.options.preview.mode==="both"&&t==="sv"?e.preview.element.style.display="block":e.preview.element.style.display="none",h(e.toolbar.elements,w.g.EDIT_TOOLBARS),g(e.toolbar.elements,w.g.EDIT_TOOLBARS),d(e.toolbar.elements,["outdent","indent"]),t==="ir")E(e.toolbar.elements,["both"]),v(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="block",e.lute.SetVditorIR(!0),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!1),e.currentMode="ir",e.ir.element.innerHTML=e.lute.Md2VditorIRDOM(r),ze(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),je(e),e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){_e(a,e)}),e.ir.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ae.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})});else if(t==="wysiwyg")E(e.toolbar.elements,["both"]),v(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.sv.element.style.display="none",e.wysiwyg.element.parentElement.style.display="block",e.ir.element.parentElement.style.display="none",e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!0),e.lute.SetVditorSV(!1),e.currentMode="wysiwyg",je(e),un(e,r,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(a){(0,ae.H)(a,{cdn:e.options.cdn,math:e.options.preview.math})}),e.wysiwyg.popover.style.display="none";else if(t==="sv"){v(e.toolbar.elements,["both"]),E(e.toolbar.elements,["outdent","indent","outline","insert-before","insert-after"]),e.wysiwyg.element.parentElement.style.display="none",e.ir.element.parentElement.style.display="none",(e.options.preview.mode==="both"||e.options.preview.mode==="editor")&&(e.sv.element.style.display="block"),e.lute.SetVditorIR(!1),e.lute.SetVditorWYSIWYG(!1),e.lute.SetVditorSV(!0),e.currentMode="sv";var i=dn(r,e);i==="<div data-block='0'></div>"&&(i=""),e.sv.element.innerHTML=i,Ee(e.sv.element),Le(e,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),je(e)}e.undo.resetIcon(e),typeof n!="string"&&(e[e.currentMode].element.focus(),nt(e)),Fe(e),Et(e),e.toolbar.elements["edit-mode"]&&(e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach(function(a){a.classList.remove("vditor-menu--current")}),e.toolbar.elements["edit-mode"].querySelector('button[data-mode="'.concat(e.currentMode,'"]')).classList.add("vditor-menu--current")),e.outline.toggle(e,e.currentMode!=="sv"&&e.options.outline.enable,typeof n!="string")}},li=(function(e){si(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),a.innerHTML='<button data-mode="wysiwyg">'.concat(window.VditorI18n.wysiwyg," &lt;").concat((0,l.ns)("⌥⌘7"),`></button>
71
- <button data-mode="ir">`).concat(window.VditorI18n.instantRendering," &lt;").concat((0,l.ns)("⌥⌘8"),`></button>
72
- <button data-mode="sv">`).concat(window.VditorI18n.splitView," &lt;").concat((0,l.ns)("⌥⌘9"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a,r),i}return t.prototype._bindEvent=function(n,r,i){var a=this.element.children[0];y(n,r,a,i.level),r.children.item(0).addEventListener((0,l.Le)(),function(o){Qe(n,"wysiwyg",o),o.preventDefault(),o.stopPropagation()}),r.children.item(1).addEventListener((0,l.Le)(),function(o){Qe(n,"ir",o),o.preventDefault(),o.stopPropagation()}),r.children.item(2).addEventListener((0,l.Le)(),function(o){Qe(n,"sv",o),o.preventDefault(),o.stopPropagation()})},t})(be),ft=function(e,t){return(0,M.Gb)(e,t)?getSelection().toString():""},Rt=function(e,t){t.addEventListener("focus",function(){e.options.focus&&e.options.focus(D(e)),b(e,["subToolbar","hint"])})},fn=function(e,t){t.addEventListener("dblclick",function(n){n.target.tagName==="IMG"&&(e.options.image.preview?e.options.image.preview(n.target):e.options.image.isPreview&&(0,$.E)(n.target,e.options.lang,e.options.theme))})},It=function(e,t){t.addEventListener("blur",function(n){if(e.currentMode==="ir"){var r=e.ir.element.querySelector(".vditor-ir__node--expand");r&&r.classList.remove("vditor-ir__node--expand")}else e.currentMode==="wysiwyg"&&!e.wysiwyg.selectPopover.contains(n.relatedTarget)&&e.wysiwyg.hideComment();e[e.currentMode].range=(0,M.zh)(e),e.options.blur&&e.options.blur(D(e))})},Pt=function(e,t){t.addEventListener("dragstart",function(n){n.dataTransfer.setData(w.g.DROP_EDITOR,w.g.DROP_EDITOR)}),t.addEventListener("drop",function(n){n.dataTransfer.getData(w.g.DROP_EDITOR)?re(e):(n.dataTransfer.types.includes("Files")||n.dataTransfer.types.includes("text/html"))&&Tt(e,n,{pasteCode:function(r){document.execCommand("insertHTML",!1,r)}})})},jt=function(e,t,n){t.addEventListener("copy",function(r){return n(r,e)})},Bt=function(e,t,n){t.addEventListener("cut",function(r){n(r,e),e.options.comment.enable&&e.currentMode==="wysiwyg"&&e.wysiwyg.getComments(e),document.execCommand("delete")})},Se=function(e){if(e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)),!!e.options.typewriterMode){var t=e[e.currentMode].element,n=(0,M.Ny)(t).top;e.options.height==="auto"&&!e.element.classList.contains("vditor--fullscreen")&&window.scrollTo(window.scrollX,n+e.element.offsetTop+e.toolbar.element.offsetHeight-window.innerHeight/2+10),(e.options.height!=="auto"||e.element.classList.contains("vditor--fullscreen"))&&(t.scrollTop=n+t.scrollTop-t.clientHeight/2+10)}},Vt=function(e,t){t.addEventListener("keydown",function(n){if(!n.isComposing&&e.options.keydown&&e.options.keydown(n),!((e.options.hint.extend.length>1||e.toolbar.elements.emoji)&&e.hint.select(n,e))){if(e.options.comment.enable&&e.currentMode==="wysiwyg"&&(n.key==="Backspace"||j("⌘X",n))&&e.wysiwyg.getComments(e),e.currentMode==="sv"){if(Ae(e,n))return}else if(e.currentMode==="wysiwyg"){if(ri(e,n))return}else if(e.currentMode==="ir"&&ye(e,n))return;if(e.options.ctrlEnter&&j("⌘Enter",n)){e.options.ctrlEnter(D(e)),n.preventDefault();return}if(j("⌘Z",n)&&!e.toolbar.elements.undo){e.undo.undo(e),n.preventDefault();return}if(j("⌘Y",n)&&!e.toolbar.elements.redo){e.undo.redo(e),n.preventDefault();return}if(n.key==="Escape"){e.hint.element.style.display==="block"?e.hint.element.style.display="none":e.options.esc&&!n.isComposing&&e.options.esc(D(e)),n.preventDefault();return}if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[1-6]$/.test(n.code)){if(e.currentMode==="wysiwyg"){var r=n.code.replace("Digit","H");(0,s.lG)(getSelection().getRangeAt(0).startContainer,r)?Ot(e):St(e,r),pe(e)}else e.currentMode==="sv"?pn(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" "):e.currentMode==="ir"&&ht(e,"#".repeat(parseInt(n.code.replace("Digit",""),10))+" ");return n.preventDefault(),!0}if((0,l.yl)(n)&&n.altKey&&!n.shiftKey&&/^Digit[7-9]$/.test(n.code))return n.code==="Digit7"?Qe(e,"wysiwyg",n):n.code==="Digit8"?Qe(e,"ir",n):n.code==="Digit9"&&Qe(e,"sv",n),!0;e.options.toolbar.find(function(i){if(!i.hotkey||i.toolbar){if(i.toolbar){var a=i.toolbar.find(function(o){if(!o.hotkey)return!1;if(j(o.hotkey,n))return e.toolbar.elements[o.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0});return!!a}return!1}if(j(i.hotkey,n))return e.toolbar.elements[i.name].children[0].dispatchEvent(new CustomEvent((0,l.Le)())),n.preventDefault(),!0})}})},Ut=function(e,t){t.addEventListener("selectstart",function(n){t.onmouseup=function(){setTimeout(function(){var r=ft(e[e.currentMode].element);r.trim()?(e.currentMode==="wysiwyg"&&e.options.comment.enable&&(!(0,s.a1)(n.target,"data-type","footnotes-block")&&!(0,s.a1)(n.target,"data-type","link-ref-defs-block")?e.wysiwyg.showComment():e.wysiwyg.hideComment()),e.options.select&&e.options.select(r)):(e.currentMode==="wysiwyg"&&e.options.comment.enable&&e.wysiwyg.hideComment(),typeof e.options.unSelect=="function"&&e.options.unSelect())})}})},Wt=function(e,t){var n=(0,M.zh)(e);n.extractContents(),n.insertNode(document.createTextNode(Lute.Caret)),n.insertNode(document.createTextNode(t));var r=(0,s.a1)(n.startContainer,"data-block","0");r||(r=e.sv.element);var i=e.lute.SpinVditorSVDOM(r.textContent);i="<div data-block='0'>"+i.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
73
- </span></span><span data-type="newline"><br /><span style="display: none">
74
- </span></span></div><div data-block="0"><`)+"</div>",r.isEqualNode(e.sv.element)?r.innerHTML=i:r.outerHTML=i,Ee(e.sv.element),(0,M.ib)(e.sv.element,n),Se(e)},kt=function(e,t,n){n===void 0&&(n=!0);var r=e;for(r.nodeType===3&&(r=r.parentElement);r;){if(r.getAttribute("data-type")===t)return r;n?r=r.previousElementSibling:r=r.nextElementSibling}return!1},dn=function(e,t){x("SpinVditorSVDOM",e,"argument",t.options.debugger);var n=t.lute.SpinVditorSVDOM(e);return e="<div data-block='0'>"+n.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g,`<span data-type="newline"><br /><span style="display: none">
75
- </span></span><span data-type="newline"><br /><span style="display: none">
76
- </span></span></div><div data-block="0"><`)+"</div>",x("SpinVditorSVDOM",e,"result",t.options.debugger),e},ci=function(e){var t=e.getAttribute("data-type"),n=e.previousElementSibling,r=t&&t!=="text"&&t!=="table"&&t!=="heading-marker"&&t!=="newline"&&t!=="yaml-front-matter-open-marker"&&t!=="yaml-front-matter-close-marker"&&t!=="code-block-info"&&t!=="code-block-close-marker"&&t!=="code-block-open-marker"?e.textContent:"",i=!1;for(t==="newline"&&(i=!0);n&&!i;){var a=n.getAttribute("data-type");if(a==="li-marker"||a==="blockquote-marker"||a==="task-marker"||a==="padding"){var o=n.textContent;if(a==="li-marker"&&(t==="code-block-open-marker"||t==="code-block-info"))r=o.replace(/\S/g," ")+r;else if(t==="code-block-close-marker"&&n.nextElementSibling.isSameNode(e)){var u=kt(e,"code-block-open-marker");u&&u.previousElementSibling&&(n=u.previousElementSibling,r=o+r)}else r=o+r}else a==="newline"&&(i=!0);n=n.previousElementSibling}return r},Le=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&e.hint.render(e),e.preview.render(e);var n=D(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,l.pK)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),clearTimeout(e.sv.processTimeoutId),e.sv.processTimeoutId=window.setTimeout(function(){t.enableAddUndoStack&&!e.sv.composingLock&&e.undo.addToUndoStack(e)},e.options.undoDelay)},pn=function(e,t){var n=(0,M.zh)(e),r=(0,k.S)(n.startContainer,"SPAN");r&&r.textContent.trim()!==""&&(t=`
77
- `+t),n.collapse(!0),document.execCommand("insertHTML",!1,t)},ui=function(e,t,n,r){var i=(0,M.zh)(e),a=t.getAttribute("data-type");e.sv.element.childNodes.length===0&&(e.sv.element.innerHTML=`<span data-type="p" data-block="0"><span data-type="text"><wbr></span></span><span data-type="newline"><br><span style="display: none">
78
- </span></span>`,(0,M.ib)(e.sv.element,i));var o=(0,s.F9)(i.startContainer),u=(0,k.S)(i.startContainer,"SPAN");if(o){if(a==="link"){var m=void 0;i.toString()===""?m="".concat(n).concat(Lute.Caret).concat(r):m="".concat(n).concat(i.toString()).concat(r.replace(")",Lute.Caret+")")),document.execCommand("insertHTML",!1,m);return}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"||a==="line"){var m=void 0;i.toString()===""?m="".concat(n).concat(Lute.Caret).concat(a==="code"?"":r):m="".concat(n).concat(i.toString()).concat(Lute.Caret).concat(a==="code"?"":r),a==="table"||a==="code"&&u&&u.textContent!==""?m=`
1
+ (function(je,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue"),require("@ahzoo/ouo"),require("lowlight")):typeof define=="function"&&define.amd?define(["exports","vue","@ahzoo/ouo","lowlight"],m):(je=typeof globalThis<"u"?globalThis:je||self,m(je.SuSComment={},je.vue,je.ouo,je.lowlight$1))})(this,(function(je,m,qn,_f){"use strict";function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new Te(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new Te(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function El(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=El(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Ml(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Ml(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class S{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new S(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new S(r,i)}cutByIndex(e,t){return e==t?S.empty:e==0&&t==this.content.length?this:new S(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new S(i,s)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return El(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Ml(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Or(t+1,s):Or(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return S.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new S(t||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const ps={index:0,offset:0};function Or(n,e){return ps.index=n,ps.offset=e,ps}function Nr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Nr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Nr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Sl{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Nr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Sl.none;if(e instanceof Sl)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};ne.none=[];class Ar extends Error{}class N{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Tl(this.content,e+this.openStart,t);return r&&new N(r,this.openStart,this.openEnd)}removeBetween(e,t){return new N(vl(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return N.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new N(S.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new N(e,r,i)}}N.empty=new N(S.empty,0,0);function vl(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vl(s.content,e-i-1,t-i-1)))}function Tl(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Tl(o.content,e-s-1,t,o);return l&&n.replaceChild(i,o.copy(l))}function Vf(n,e,t){if(t.openStart>n.depth)throw new Ar("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ar("Inconsistent open depths");return Ol(n,e,t,0)}function Ol(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Ol(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return on(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=$f(t,n);return on(s,Al(n,o,l,e,r))}else return on(s,Dr(n,e,r))}function Nl(n,e){if(!e.type.compatibleContent(n.type))throw new Ar("Cannot join "+e.type.name+" onto "+n.type.name)}function ms(n,e,t){let r=n.node(t);return Nl(r,e.node(t)),r}function sn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Jn(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(sn(n.nodeAfter,r),s++));for(let l=s;l<o;l++)sn(i.child(l),r);e&&e.depth==t&&e.textOffset&&sn(e.nodeBefore,r)}function on(n,e){return n.type.checkContent(e),n.copy(e)}function Al(n,e,t,r,i){let s=n.depth>i&&ms(n,e,i+1),o=r.depth>i&&ms(t,r,i+1),l=[];return Jn(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Nl(s,o),sn(on(s,Al(n,e,t,r,i+1)),l)):(s&&sn(on(s,Dr(n,e,i+1)),l),Jn(e,t,i,l),o&&sn(on(o,Dr(t,r,i+1)),l)),Jn(r,null,i,l),new S(l)}function Dr(n,e,t){let r=[];if(Jn(null,n,t,r),n.depth>t){let i=ms(n,e,t+1);sn(on(i,Dr(n,e,t+1)),r)}return Jn(e,null,t,r),new S(r)}function $f(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(S.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Gn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Rr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Gn(t,r,s)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else Dl.set(e,r=new zf);let i=r.elts[r.i]=Gn.resolve(e,t);return r.i=(r.i+1)%Hf,i}}class zf{constructor(){this.elts=[],this.i=0}}const Hf=12,Dl=new WeakMap;class Rr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ff=Object.create(null);let Lt=class Cl{constructor(e,t,r,i=ne.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||S.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Nr(this.attrs,t||e.defaultAttrs||Ff)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new Cl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Cl(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return N.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new N(c,i.depth-o,s.depth-o)}replace(e,t,r){return Vf(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Gn.resolveCached(this,e)}resolveNoCache(e){return Gn.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=S.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=S.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Lt.prototype.text=void 0;class Ir extends Lt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ir(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ir(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ln{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jf(e,t);if(r.next==null)return ln.empty;let i=Il(r);r.next&&r.err("Unexpected trailing text");let s=Yf(Gf(i));return Xf(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return S.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=s(u,l.concat(d));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
+ `)}}ln.empty=new ln(!0);class jf{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Il(n){let e=[];do e.push(Uf(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Uf(n){let e=[];do e.push(Wf(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wf(n){let e=Jf(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Kf(n,e);else break;return e}function Pl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Kf(n,e){let t=Pl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Pl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function qf(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Jf(n){if(n.eat("(")){let e=Il(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=qf(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Gf(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,a),d),a=d}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=t();r(a,d),i(s(o.expr,a),d),a=d}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ll(n,e){return e-n}function Bl(n,e){let t=[];return r(e),t.sort(Ll);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function Yf(n){let e=Object.create(null);return t(Bl(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<i.length;d++)i[d][0]==l&&(c=i[d][1]);Bl(n,a).forEach(d=>{c||i.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new ln(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(Ll);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Xf(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _l(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Vl(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function $l(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function zl(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Zf(n,r,e[r]);return t}let Hl=class Rf{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=zl(e,r.attrs),this.defaultAttrs=_l(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ln.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Vl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Lt(this,this.computeAttrs(e),S.from(t),ne.setFrom(r))}createChecked(e=null,t,r){return t=S.from(t),this.checkContent(t),new Lt(this,this.computeAttrs(e),t,ne.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=S.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(S.empty,!0);return s?new Lt(this,e,t.append(s),ne.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){$l(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:ne.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Rf(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Qf(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class Zf{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Qf(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Pr{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=zl(e,i.attrs),this.excluded=null;let s=_l(this.attrs);this.instance=s?new ne(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,Vl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Pr(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){$l(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Fl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=Hl.compile(this.spec.nodes,this),this.marks=Pr.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=ln.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?jl(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:jl(this,o.split(" "))}this.nodeFromJSON=i=>Lt.fromJSON(this,i),this.markFromJSON=i=>ne.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Hl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Ir(r,r.defaultAttrs,e,ne.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function jl(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function eh(n){return n.tag!=null}function th(n){return n.style!=null}class Bt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(eh(i))this.tags.push(i);else if(th(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new ql(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ql(this,t,!0);return r.addAll(e,ne.none,t.from,t.to),N.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(ih(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Jl(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Jl(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Bt(e,Bt.schemaRules(e)))}}const Ul={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},nh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wl={ol:!0,ul:!0},Yn=1,gs=2,Xn=4;function Kl(n,e,t){return e!=null?(e?Yn:0)|(e==="full"?gs:0):n&&n.whitespace=="pre"?Yn|gs:t&~Xn}class Lr{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ne.none,this.match=s||(o&Xn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(S.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Yn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=S.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(S.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ul.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ql{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Kl(null,t.preserveWhitespace,0)|(r?Xn:0);i?s=new Lr(i.type,i.attrs,ne.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Lr(null,null,ne.none,!0,null,o):s=new Lr(e.schema.topNodeType,null,ne.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&gs?"full":this.localPreserveWS||(i.options&Yn)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
3
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Wl.hasOwnProperty(o)&&this.parser.normalizeLists&&rh(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:nh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(Ul.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=a&&a.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ne.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Gl(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Kl(e,s,o.options);o.options&Xn&&o.content.length==0&&(l|=Xn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Gl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Lr(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Yn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function rh(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Wl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function ih(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Jl(n){let e={};for(let t in n)e[t]=n[t];return e}function Gl(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class an{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ys(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Br(ys(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Br(ys(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Br(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new an(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Yl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Yl(e.marks)}}function Yl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ys(n){return n.document||window.document}const Xl=new WeakMap;function sh(n){let e=Xl.get(n);return e===void 0&&Xl.set(n,e=oh(n)),e}function oh(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function Br(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=sh(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Br(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Ql=65535,Zl=Math.pow(2,16);function lh(n,e){return n+e*Zl}function ea(n){return n&Ql}function ah(n){return(n-(n&Ql))/Zl}const ta=1,na=2,_r=4,ra=8;class bs{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ra)>0}get deletedBefore(){return(this.delInfo&(ta|_r))>0}get deletedAfter(){return(this.delInfo&(na|_r))>0}get deletedAcross(){return(this.delInfo&_r)>0}}class Ue{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ue.empty)return Ue.empty}recover(e){let t=0,r=ea(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+ah(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],d=this.ranges[l+o],u=a+c;if(e<=u){let f=c?e==a?-1:e==u?1:t:t,h=a+i+(f<0?0:d);if(r)return h;let p=e==(t<0?a:u)?null:lh(l/3,e-a),g=e==a?na:e==u?ta:_r;return(t<0?e!=a:e!=u)&&(g|=ra),new bs(h,g,p)}i+=d-c}return r?e+i:new bs(e+i,0,null)}touches(e,t){let r=0,i=ea(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],d=a+c;if(e<=d&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(l,l+c,a,a+d),s+=d-c}}invert(){return new Ue(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ue.empty:new Ue(e<0?[0,-e,0]:[0,0,e])}}Ue.empty=new Ue([]);class Qn{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Qn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Qn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new bs(e,i,null)}}const ws=Object.create(null);class De{getMap(){return Ue.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ws[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ws)throw new RangeError("Duplicate use of step JSON ID "+e);return ws[e]=t,t.prototype.jsonID=e,t}}class ye{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ye(e,null)}static fail(e){return new ye(null,e)}static fromReplace(e,t,r,i){try{return ye.ok(e.replace(t,r,i))}catch(s){if(s instanceof Ar)return ye.fail(s.message);throw s}}}function ks(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(ks(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return S.fromArray(r)}class _t extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new N(ks(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,s)}invert(){return new tt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _t(t.pos,r.pos,this.mark)}merge(e){return e instanceof _t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new _t(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",_t);class tt extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new N(ks(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ye.fromReplace(e,this.from,this.to,r)}invert(){return new _t(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new tt(t.pos,r.pos,this.mark)}merge(e){return e instanceof tt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new tt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",tt);class Vt extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new N(S.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Vt(this.pos,t.marks[i]);return new Vt(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Vt(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vt(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Vt);class cn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ye.fromReplace(e,this.pos,this.pos+1,new N(S.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Vt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new cn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",cn);class Se extends De{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&xs(e,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ue([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Se(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?N.empty:new N(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?N.empty:new N(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Se(t.from,t.to,N.fromJSON(e,t.slice),!!t.structure)}}De.jsonID("replace",Se);class Ce extends De{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(xs(e,this.from,this.gapFrom)||xs(e,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ye.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ye.fromReplace(e,this.from,this.to,r):ye.fail("Content does not fit in gap")}getMap(){return new Ue([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ce(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Ce(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ce(t.from,t.to,t.gapFrom,t.gapTo,N.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",Ce);function xs(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function ch(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(p)||(o&&o.to==f&&o.mark.eq(u[g])?o.to=h:i.push(o=new tt(f,h,u[g])));l&&l.to==f?l.to=h:s.push(l=new _t(f,h,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function dh(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Pr){let c=o.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let u=a[d],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&u.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:u,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>n.step(new tt(o.from,o.to,o.style)))}function Ss(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),d=l+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Se(l,d,N.empty));else{r=u;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new tt(l,d,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new N(S.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Se(l+f.index,l+f.index+f[0].length,p))}}l=d}if(!r.validEnd){let a=r.fillBefore(S.empty,!0);n.replace(l,l,new N(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function uh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function En(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!uh(i,s,o))break}return null}function fh(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,d=S.empty,u=0;for(let p=s,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,d=S.from(r.node(p).copy(d)),u++):a--;let f=S.empty,h=0;for(let p=s,g=!1;p>t;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=S.from(i.node(p).copy(f)),h++):c++;n.step(new Ce(a,c,o,l,new N(d.append(f),u,h),d.size-u,!0))}function Cs(n,e,t=null,r=n){let i=hh(n,e),s=i&&ph(r,e);return s?i.map(ia).concat({type:e,attrs:t}).concat(s.map(ia)):null}function ia(n){return{type:n,attrs:null}}function hh(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function ph(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function mh(n,e,t){let r=S.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=S.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Ce(i,s,i,s,new N(r,0,0),t.length,!0))}function gh(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&yh(n.doc,n.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&oa(n,o,l,s),Ss(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let d=n.mapping.slice(s),u=d.map(l,1),f=d.map(l+o.nodeSize,1);return n.step(new Ce(u,f,u+1,f-1,new N(S.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&sa(n,o,l,s),!1}})}function sa(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function oa(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
5
+ `))}})}function yh(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function bh(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ce(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new N(S.from(o),0,0),1,!0))}function kt(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let u=i.node(c),f=i.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=r&&r[d+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!g.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function wh(n,e,t=1,r){let i=n.doc.resolve(e),s=S.empty,o=S.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=S.from(i.node(l).copy(s));let d=r&&r[c];o=S.from(d?d.type.create(d.attrs,o):i.node(l).copy(o))}n.step(new Se(e,e,new N(s.append(o),t,t),!0))}function $t(n,e){let t=n.resolve(e),r=t.index();return la(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function kh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function la(n,e){return!!(n&&e&&!n.isLeaf&&kh(n,e))}function Vr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&la(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function xh(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let l=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);oa(n,d.node(),d.before(),l)}o.inlineContent&&Ss(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Se(c,a.map(e+t,-1),N.empty,!0)),r===!0){let d=n.doc.resolve(c);sa(n,d.node(),d.before(),n.steps.length)}return n}function Sh(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function aa(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(a,a,i);else{let u=c.contentMatchAt(a).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function $r(n,e,t=e,r=N.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return ca(i,s,r)?new Se(e,t,r):new Ch(i,s,r).fit()}function ca(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ch{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=S.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=S.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new N(s,o,l);return e>-1?new Ce(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Es(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(S.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Es(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new N(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Es(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new N(Zn(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new N(Zn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)d.push(i.child(g));u=u.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let g=l.child(c),y=u.matchType(g.type);if(!y)break;c++,(c>1||a==0||g.content.size)&&(u=y,d.push(da(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=er(this.placed,t,S.from(d)),this.frontier[t].match=u,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let w=y.lastChild;this.frontier.push({type:w.type,match:w.contentMatchAt(w.childCount)}),y=w.content}this.unplaced=p?e==0?N.empty:new N(Zn(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new N(Zn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ms(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Ms(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Ms(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=er(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=er(this.placed,this.depth,S.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(S.empty,!0);t.childCount&&(this.placed=er(this.placed,this.frontier.length,t))}}function Zn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Zn(n.firstChild.content,e-1,t)))}function er(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(er(n.lastChild.content,e-1,t)))}function Es(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function da(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,da(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(S.empty,!0)))),n.copy(r)}function Ms(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Eh(t,s.content,o)?l:null}function Eh(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Mh(n){return n.spec.defining||n.spec.definingForContent}function vh(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(ca(i,s,r))return n.step(new Se(e,t,r));let o=fa(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],d=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=d-1;f>=0;f--){let h=c[f],p=Mh(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))d=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+d+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<o.length;g++){let y=o[(g+a)%o.length],w=!0;y<0&&(w=!1,y=-y);let k=i.node(y-1),C=i.index(y-1);if(k.canReplaceWith(C,C,p.type,p.marks))return n.replace(i.before(y),w?s.after(y):t,new N(ua(r.content,0,r.openStart,h),h,r.openEnd))}}let u=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>u));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function ua(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(ua(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(S.empty,!0))}return n}function Th(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Sh(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new N(S.from(r),0,0))}function Oh(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=fa(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function fa(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Mn extends De{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ye.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ye.fromReplace(e,this.pos,this.pos+1,new N(S.from(i),0,t.isLeaf?0:1))}getMap(){return Ue.empty}invert(e){return new Mn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Mn(t.pos,t.attr,t.value)}}De.jsonID("attr",Mn);class tr extends De{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ye.ok(r)}getMap(){return Ue.empty}invert(e){return new tr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new tr(t.attr,t.value)}}De.jsonID("docAttr",tr);let vn=class extends Error{};vn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},vn.prototype=Object.create(Error.prototype),vn.prototype.constructor=vn,vn.prototype.name="TransformError";class ha{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Qn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new vn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=N.empty){let i=$r(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new N(S.from(r),0,0))}delete(e,t){return this.replace(e,t,N.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return vh(this,e,t,r),this}replaceRangeWith(e,t,r){return Th(this,e,t,r),this}deleteRange(e,t){return Oh(this,e,t),this}lift(e,t){return fh(this,e,t),this}join(e,t=1){return xh(this,e,t),this}wrap(e,t){return mh(this,e,t),this}setBlockType(e,t=e,r,i=null){return gh(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return bh(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Mn(e,t,r)),this}setDocAttribute(e,t){return this.step(new tr(e,t)),this}addNodeMark(e,t){return this.step(new Vt(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof ne)t.isInSet(r.marks)&&this.step(new cn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new cn(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,r){return wh(this,e,t,r),this}addMark(e,t,r){return ch(this,e,t,r),this}removeMark(e,t,r){return dh(this,e,t,r),this}clearIncompatible(e,t,r){return Ss(this,e,t,r),this}}const vs=Object.create(null);class H{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new pa(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=N.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(c.pos),l?N.empty:t),l==0&&ya(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),d=a.map(l.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),ya(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new F(e):Tn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Tn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Tn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new We(e.node(0))}static atStart(e){return Tn(e,e,0,0,1)||new We(e)}static atEnd(e){return Tn(e,e,e.content.size,e.childCount,-1)||new We(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=vs[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in vs)throw new RangeError("Duplicate use of selection JSON ID "+e);return vs[e]=t,t.prototype.jsonID=e,t}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}H.prototype.visible=!0;class pa{constructor(e,t){this.$from=e,this.$to=t}}let ma=!1;function ga(n){!ma&&!n.parent.inlineContent&&(ma=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class F extends H{constructor(e,t=e){ga(e),ga(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return H.near(r);let i=e.resolve(t.map(this.anchor));return new F(i.parent.inlineContent?i:r,r)}replace(e,t=N.empty){if(super.replace(e,t),t==N.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=H.findFrom(t,r,!0)||H.findFrom(t,-r,!0);if(s)t=s.$head;else return H.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new F(e,t)}}H.jsonID("text",F);class zr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new zr(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends H{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?H.near(s):new B(s)}content(){return new N(S.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ts(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1,H.jsonID("node",B);class Ts{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new zr(r,r):new Ts(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&B.isSelectable(r)?new B(t):H.near(t)}}class We extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=N.empty){if(t==N.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new We(e)}map(e){return new We(e)}eq(e){return e instanceof We}getBookmark(){return Nh}}H.jsonID("all",We);const Nh={map(){return this},resolve(n){return new We(n)}};function Tn(n,e,t,r,i,s=!1){if(e.inlineContent)return F.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&B.isSelectable(l))return B.create(n,t-(i<0?l.nodeSize:0))}else{let a=Tn(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function ya(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Se||i instanceof Ce))return;let s=n.mapping.maps[r],o;s.forEach((l,a,c,d)=>{o==null&&(o=d)}),n.setSelection(H.near(n.doc.resolve(o),t))}const ba=1,Hr=2,wa=4;class Ah extends ha{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ba)&~Hr,this.storedMarks=null,this}get selectionSet(){return(this.updated&ba)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Hr,this}ensureMarks(e){return ne.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Hr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Hr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ne.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(H.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wa,this}get scrolledIntoView(){return(this.updated&wa)>0}}function ka(n,e){return!e||!n?n:n.bind(e)}class nr{constructor(e,t,r){this.name=e,this.init=ka(t.init,r),this.apply=ka(t.apply,r)}}const Dh=[new nr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new nr("selection",{init(n,e){return n.selection||H.atStart(e.doc)},apply(n){return n.selection}}),new nr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new nr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Os{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Dh.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new nr(r.key,r.spec.state,r))})}}class On{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new On(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Ah(this)}static create(e){let t=new Os(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new On(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Os(this.schema,e.plugins),r=t.fields,i=new On(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Os(e.schema,e.plugins),s=new On(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Lt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=H.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function xa(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=xa(i,e,{})),t[r]=i}return t}class se{constructor(e){this.spec=e,this.props={},e.props&&xa(e.props,this,this.props),this.key=e.key?e.key.key:Sa("plugin")}getState(e){return e[this.key]}}const Ns=Object.create(null);function Sa(n){return n in Ns?n+"$"+ ++Ns[n]:(Ns[n]=0,n+"$")}class le{constructor(e="key"){this.key=Sa(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Oe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Nn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let As=null;const xt=function(n,e,t){let r=As||(As=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Rh=function(){As=null},dn=function(n,e,t,r){return t&&(Ca(n,e,t,r,-1)||Ca(n,e,t,r,1))},Ih=/^(img|br|input|textarea|hr)$/i;function Ca(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Je(n))){let o=n.parentNode;if(!o||o.nodeType!=1||rr(n)||Ih.test(n.nodeName)||n.contentEditable=="false")return!1;e=Oe(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?Je(n):0}else return!1}}function Je(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ph(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Je(n)}else if(n.parentNode&&!rr(n))e=Oe(n),n=n.parentNode;else return null}}function Lh(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!rr(n))e=Oe(n)+1,n=n.parentNode;else return null}}function Bh(n,e,t){for(let r=e==0,i=e==Je(n);r||i;){if(n==t)return!0;let s=Oe(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Je(n)}}function rr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Fr=function(n){return n.focusNode&&dn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function un(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function _h(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Vh(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Je(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Je(r.startContainer),r.startOffset)}}}const lt=typeof navigator<"u"?navigator:null,Ea=typeof document<"u"?document:null,zt=lt&&lt.userAgent||"",Ds=/Edge\/(\d+)/.exec(zt),Ma=/MSIE \d/.exec(zt),Rs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zt),He=!!(Ma||Rs||Ds),Ht=Ma?document.documentMode:Rs?+Rs[1]:Ds?+Ds[1]:0,Ge=!He&&/gecko\/(\d+)/i.test(zt);Ge&&+(/Firefox\/(\d+)/.exec(zt)||[0,0])[1];const Is=!He&&/Chrome\/(\d+)/.exec(zt),Re=!!Is,va=Is?+Is[1]:0,Be=!He&&!!lt&&/Apple Computer/.test(lt.vendor),An=Be&&(/Mobile\/\w+/.test(zt)||!!lt&&lt.maxTouchPoints>2),Ye=An||(lt?/Mac/.test(lt.platform):!1),$h=lt?/Win/.test(lt.platform):!1,St=/Android \d/.test(zt),ir=!!Ea&&"webkitFontSmoothing"in Ea.documentElement.style,zh=ir?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Hh(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ct(n,e){return typeof n=="number"?n:n[e]}function Fh(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ta(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Nn(o);continue}let l=o,a=l==s.body,c=a?Hh(s):Fh(l),d=0,u=0;if(e.top<c.top+Ct(r,"top")?u=-(c.top-e.top+Ct(i,"top")):e.bottom>c.bottom-Ct(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Ct(i,"top")-c.top:e.bottom-c.bottom+Ct(i,"bottom")),e.left<c.left+Ct(r,"left")?d=-(c.left-e.left+Ct(i,"left")):e.right>c.right-Ct(r,"right")&&(d=e.right-c.right+Ct(i,"right")),d||u)if(a)s.defaultView.scrollBy(d,u);else{let h=l.scrollLeft,p=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let g=l.scrollLeft-h,y=l.scrollTop-p;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Nn(o)}}function jh(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Oa(n.dom)}}function Oa(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Nn(r));return e}function Uh({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Na(t,r==0?0:r-e)}function Na(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Dn=null;function Wh(n){if(n.setActive)return n.setActive();if(Dn)return n.focus(Dn);let e=Oa(n);n.focus(Dn==null?{get preventScroll(){return Dn={preventScroll:!0},!0}}:void 0),Dn||(Dn=!1,Na(e,0))}function Aa(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=xt(d).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=d,r=g,i=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&g&&(s=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=u+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?Kh(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Aa(t,i)}function Kh(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Ft(r,1);if(s.top!=s.bottom&&Ps(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Ps(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function qh(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Jh(n,e,t){let{node:r,offset:i}=Aa(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function Gh(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Da(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Ps(e,c))return Da(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function Yh(n,e){let t=n.dom.ownerDocument,r,i=0,s=Vh(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Ps(e,c)||(o=Da(n.dom,e,c),!o))return null}if(Be)for(let c=o;r&&c;c=Nn(c))c.draggable&&(r=void 0);if(o=qh(o,e),r){if(Ge&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;ir&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Gh(n,r,i,e))}l==null&&(l=Jh(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ra(n){return n.top<n.bottom||n.left<n.right}function Ft(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ra(r))return r}return Array.prototype.find.call(t,Ra)||n.getBoundingClientRect()}const Xh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ia(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=ir||Ge;if(r.nodeType==3)if(o&&(Xh.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Ft(xt(r,i,i),t);if(Ge&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Ft(xt(r,i-1,i-1),-1);if(c.top==a.top){let d=Ft(xt(r,i,i+1),-1);if(d.top!=a.top)return sr(d,d.left<c.left)}}return a}else{let a=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(a--,d=1):t<0?a--:c++,sr(Ft(xt(r,a,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Je(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ls(a.getBoundingClientRect(),!1)}if(s==null&&i<Je(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ls(a.getBoundingClientRect(),!0)}return Ls(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Je(r))){let a=r.childNodes[i-1],c=a.nodeType==3?xt(a,Je(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return sr(Ft(c,1),!1)}if(s==null&&i<Je(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?xt(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return sr(Ft(c,-1),!0)}return sr(Ft(r.nodeType==3?xt(r):r,-t),t>=0)}function sr(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ls(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Pa(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Qh(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Pa(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Ia(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=xt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const Zh=/[\u0590-\u08ac]/;function ep(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!Zh.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Pa(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:g}=n.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let La=null,Ba=null,_a=!1;function tp(n,e,t){return La==e&&Ba==t?_a:(La=e,Ba=t,_a=t=="up"||t=="down"?Qh(n,e,t):ep(n,e,t))}const Xe=0,Va=1,fn=2,at=3;class or{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Xe,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Oe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof Ha){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof $a&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Oe(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Oe(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let d=o+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=o;for(let u=l;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Oe(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=Oe(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],y=p+g.size;if(s>p&&o<y)return g.setSelection(e-p-g.border,t-p-g.border,r,i);p=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((Ge||Be)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(u=!!(p&&h.nodeValue[p-1]==`
6
+ `),u&&p==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Oe(y)+1});break}let w=g.pmViewDesc;if(w&&w.node&&w.node.isBlock)break}}else{let g=h.childNodes[p-1];u=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ge&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||u&&Be)&&dn(l.node,l.offset,d.anchorNode,d.anchorOffset)&&dn(a.node,a.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(u&&Ge)){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?fn:Va,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=at:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?fn:at}r=o}this.dirty=fn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?fn:Va;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class $a extends or{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Xe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class np extends or{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class hn extends or{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=an.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new hn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&at||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=at&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Xe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xe}}slice(e,t,r){let i=hn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=_s(s,t,o,r)),e>0&&(s=_s(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class jt extends or{constructor(e,t,r,i,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=an.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=Ua(d,r,t),c?a=new rp(e,t,r,i,d,u||null,f,c,s,o+1):t.isText?new jr(e,t,r,i,d,f,s):new jt(e,t,r,i,d,u||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>S.empty)}return e}matchesNode(e,t,r){return this.dirty==Xe&&e.eq(this.node)&&Ur(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new sp(this,o&&o.node,e);ap(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?ne.none:this.node.child(d).marks,r,e),a.placeWidget(c,e,i)},(c,d,u,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,d,u,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,d,u,h,e)||a.updateNextNode(c,d,u,e,f,i)||a.addNode(c,d,u,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==fn)&&(o&&this.protectLocalComposition(e,o),Fa(this.contentDOM,this.children,e),An&&cp(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof F)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=dp(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new np(this,s,t,i);e.input.compositionNodes.push(o),this.children=_s(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==at||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Xe}updateOuterDeco(e){if(Ur(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ja(this.dom,this.nodeDOM,Bs(this.outerDeco,this.node,t),Bs(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function za(n,e,t,r,i){Ua(r,e,n);let s=new jt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class jr extends jt{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==at||this.dirty!=Xe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Xe||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Xe,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new jr(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=at)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ha extends or{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class rp extends jt{constructor(e,t,r,i,s,o,l,a,c,d){super(e,t,r,i,s,o,l,c,d),this.spec=a}update(e,t,r,i){if(this.dirty==at)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Fa(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=r;)r=Wa(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(o instanceof hn){let a=r?r.previousSibling:n.lastChild;Fa(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=Wa(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const lr=function(n){n&&(this.nodeName=n)};lr.prototype=Object.create(null);const pn=[new lr];function Bs(n,e,t){if(n.length==0)return pn;let r=t?pn[0]:new lr,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new lr(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(r=new lr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function ja(n,e,t,r){if(t==pn&&r==pn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=pn[0]),i=a}ip(i,l||pn[0],o)}return i}function ip(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Ua(n,e,t){return ja(n,n,pn,Bs(e,t,n.nodeType!=1))}function Ur(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Wa(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class sp{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=op(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Xe,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=hn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==at&&o.dom==o.contentDOM&&(o.dirty=fn),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof jt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let d=a.dom,u,f=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=at&&Ur(t,a.outerDeco));if(!f&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(a,e,t,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=fn,u.updateChildren(i,o+1),u.dirty=Xe),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ur(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=jt.create(this.top,t,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,s){let o=jt.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new $a(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof hn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof jr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Be||Re)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Ha(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function op(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof hn)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function lp(n,e){return n.type.side-e.type.side}function ap(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(d?(u||(u=[d])).push(y):d=y)}if(d)if(u){u.sort(lp);for(let y=0;y<u.length;y++)t(u[y],c,!!a)}else t(d,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<n.childCount)h=c,f=n.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let y=p;o<i.length&&i[o].from<y&&(y=i[o].from);for(let w=0;w<l.length;w++)l[w].to<y&&(y=l[w].to);y<p&&(a=f.cut(y-s),f=f.cut(0,y-s),p=y,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,g,e.forChild(s,f),h),s=p}}function cp(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function dp(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function _s(n,e,t,r,i){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],c=l,d=l+=a.size;c>=t||d<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>t&&s.push(a.slice(t-c,a.size,r)))}return s}function Vs(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Fr(t)){for(a=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&B.isSelectable(u)&&i.parent&&!(u.isInline&&Bh(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new B(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,f=o;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[a,o]=f==n.state.selection.anchor?[f,u]:[u,f],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let u=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;c=zs(n,d,l,u)}return c}function Ka(n){return n.editable?n.hasFocus():Za(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Et(n,e=!1){let t=n.state.selection;if(Ya(n,t),!!Ka(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Re){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&dn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)fp(n);else{let{anchor:r,head:i}=t,s,o;qa&&!(t instanceof F)&&(t.$from.parent.inlineContent||(s=Ja(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=Ja(n,t.to))),n.docView.setSelection(r,i,n,e),qa&&(s&&Ga(s),o&&Ga(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&up(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const qa=Be||Re&&va<63;function Ja(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Be&&i&&i.contentEditable=="false")return $s(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return $s(i);if(s)return $s(s)}}function $s(n){return n.contentEditable="true",Be&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ga(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function up(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ka(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function fp(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Oe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&He&&Ht<=11&&(t.disabled=!0,t.disabled=!1)}function Ya(n,e){if(e instanceof B){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Xa(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Xa(n)}function Xa(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function zs(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||F.between(e,t,r)}function Qa(n){return n.editable&&!n.hasFocus()?!1:Za(n)}function Za(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function hp(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return dn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Hs(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&H.findFrom(s,e)}function Ut(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ec(n,e,t){let r=n.state.selection;if(r instanceof F)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ut(n,new F(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Hs(n.state,e);return i&&i instanceof B?Ut(n,i):!1}else if(!(Ye&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?B.isSelectable(s)?Ut(n,new B(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):ir?Ut(n,new F(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Ut(n,new F(e>0?r.$to:r.$from));{let i=Hs(n.state,e);return i?Ut(n,i):!1}}}function Wr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ar(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Rn(n,e){return e<0?pp(n):mp(n)}function pp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Ge&&t.nodeType==1&&r<Wr(t)&&ar(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(ar(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(tc(t))break;{let l=t.previousSibling;for(;l&&ar(l,-1);)i=t.parentNode,s=Oe(l),l=l.previousSibling;if(l)t=l,r=Wr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Fs(n,t,r):i&&Fs(n,i,s)}function mp(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Wr(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(ar(l,1))s=t,o=++r;else break}else{if(tc(t))break;{let l=t.nextSibling;for(;l&&ar(l,1);)s=l.parentNode,o=Oe(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Wr(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&Fs(n,s,o)}function tc(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function gp(n,e){for(;n&&e==n.childNodes.length&&!rr(n);)e=Oe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function yp(n,e){for(;n&&!e&&!rr(n);)e=Oe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Fs(n,e,t){if(e.nodeType!=3){let s,o;(o=gp(e,t))?(e=o,t=0):(s=yp(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Fr(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Et(n)},50)}function nc(n,e){let t=n.state.doc.resolve(e);if(!(Re||$h)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function rc(n,e,t){let r=n.state.selection;if(r instanceof F&&!r.empty||t.indexOf("s")>-1||Ye&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Hs(n.state,e);if(o&&o instanceof B)return Ut(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof We?H.near(o,e):H.findFrom(o,e);return l?Ut(n,l):!1}return!1}function ic(n,e){if(!(n.state.selection instanceof F))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function sc(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function bp(n){if(!Be||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;sc(n,r,"true"),setTimeout(()=>sc(n,r,"false"),20)}return!1}function wp(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function kp(n,e){let t=e.keyCode,r=wp(e);if(t==8||Ye&&t==72&&r=="c")return ic(n,-1)||Rn(n,-1);if(t==46&&!e.shiftKey||Ye&&t==68&&r=="c")return ic(n,1)||Rn(n,1);if(t==13||t==27)return!0;if(t==37||Ye&&t==66&&r=="c"){let i=t==37?nc(n,n.state.selection.from)=="ltr"?-1:1:-1;return ec(n,i,r)||Rn(n,i)}else if(t==39||Ye&&t==70&&r=="c"){let i=t==39?nc(n,n.state.selection.from)=="ltr"?1:-1:1;return ec(n,i,r)||Rn(n,i)}else{if(t==38||Ye&&t==80&&r=="c")return rc(n,-1,r)||Rn(n,-1);if(t==40||Ye&&t==78&&r=="c")return bp(n)||rc(n,1,r)||Rn(n,1);if(r==(Ye?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function js(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||an.fromSchema(n.state.schema),l=hc(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=uc[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let p=l.createElement(d[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
79
7
 
80
- `+m:a==="line"&&(m=`
8
+ `);return{dom:a,text:f,slice:e}}function oc(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return l=new N(S.from(n.state.schema.text(e.replace(/\r\n?/g,`
9
+ `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let u=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(u)l=u;else{let f=i.marks(),{schema:h}=n.state,p=an.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(p.serializeNode(h.text(g,f)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=Ep(t),ir&&Mp(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Bt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!xp.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=vp(dc(l,+d[1],+d[2]),d[4]);else if(l=N.maxOpen(Sp(l.content,i),!0),l.openStart||l.openEnd){let u=0,f=0;for(let h=l.content.firstChild;u<l.openStart&&!h.type.spec.isolating;u++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=dc(l,u,f)}return n.someProp("transformPasted",u=>{l=u(l,n,a)}),l}const xp=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Sp(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&ac(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=cc(o[o.length-1],s.length));let d=lc(l,a);o.push(d),i=i.matchType(d.type),s=a}}),o)return S.from(o)}return n}function lc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,S.from(n));return n}function ac(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=ac(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(S.from(lc(t,n,i+1))))}}function cc(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,cc(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(S.empty,!0);return n.copy(t.append(r))}function Us(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=Us(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(S.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function dc(n,e,t){return e<n.openStart&&(n=new N(Us(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new N(Us(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const uc={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let fc=null;function hc(){return fc||(fc=document.implementation.createHTMLDocument("title"))}let Ws=null;function Cp(n){let e=window.trustedTypes;return e?(Ws||(Ws=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ws.createHTML(n)):n}function Ep(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=hc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&uc[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Cp(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Mp(n){let e=n.querySelectorAll(Re?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function vp(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=S.from(a.create(r[l+1],i)),s++,o++}return new N(i,s,o)}const _e={},Ve={},Tp={touchstart:!0,touchmove:!0};class Op{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Np(n){for(let e in _e){let t=_e[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Dp(n,r)&&!qs(n,r)&&(n.editable||!(r.type in Ve))&&t(n,r)},Tp[e]?{passive:!0}:void 0)}Be&&n.dom.addEventListener("input",()=>null),Ks(n)}function Wt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Ap(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ks(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>qs(n,r))})}function qs(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Dp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Rp(n,e){!qs(n,e)&&_e[e.type]&&(n.editable||!(e.type in Ve))&&_e[e.type](n,e)}Ve.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!mc(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(St&&Re&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),An&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,un(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||kp(n,t)?t.preventDefault():Wt(n,"key")},Ve.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Ve.keypress=(n,e)=>{let t=e;if(mc(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ye&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof F)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function Kr(n){return{left:n.clientX,top:n.clientY}}function Ip(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Js(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function In(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Pp(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(In(n,new B(t)),!0):!1}function Lp(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof B&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(B.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(In(n,B.create(n.state.doc,i)),!0):!1}function Bp(n,e,t,r,i){return Js(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Lp(n,t):Pp(n,t))}function _p(n,e,t,r){return Js(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Vp(n,e,t,r){return Js(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||$p(n,t,r)}function $p(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(In(n,F.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)In(n,F.create(r,l+1,l+1+o.content.size));else if(B.isSelectable(o))In(n,B.create(r,l));else continue;return!0}}function Gs(n){return qr(n)}const pc=Ye?"metaKey":"ctrlKey";_e.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Gs(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Ip(t,n.input.lastClick)&&!t[pc]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(Kr(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new zp(n,o,t,!!r)):(s=="doubleClick"?_p:Vp)(n,o.pos,o.inside,t)?t.preventDefault():Wt(n,"pointer"))};class zp{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[pc],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof B&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ge&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Et(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Kr(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wt(this.view,"pointer"):Bp(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Be&&this.mightDrag&&!this.mightDrag.node.isAtom||Re&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(In(this.view,H.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Wt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}_e.touchstart=n=>{n.input.lastTouch=Date.now(),Gs(n),Wt(n,"pointer")},_e.touchmove=n=>{n.input.lastTouch=Date.now(),Wt(n,"pointer")},_e.contextmenu=n=>Gs(n);function mc(n,e){return n.composing?!0:Be&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Hp=St?5e3:-1;Ve.compositionstart=Ve.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof F&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),qr(n,!0),n.markCursor=null;else if(qr(n,!e.selection.empty),Ge&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}gc(n,Hp)},Ve.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,gc(n,20))};function gc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>qr(n),e))}function yc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=jp());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Fp(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Ph(e.focusNode,e.focusOffset),r=Lh(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function jp(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function qr(n,e=!1){if(!(St&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),yc(n),e||n.docView&&n.docView.dirty){let t=Vs(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Up(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const cr=He&&Ht<15||An&&zh<604;_e.copy=Ve.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=cr?null:t.clipboardData,o=r.content(),{dom:l,text:a}=js(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Up(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Wp(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Kp(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?dr(n,r.value,null,i,e):dr(n,r.textContent,r.innerHTML,i,e)},50)}function dr(n,e,t,r,i){let s=oc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||N.empty)))return!0;if(!s)return!1;let o=Wp(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ve.paste=(n,e)=>{let t=e;if(n.composing&&!St)return;let r=cr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&dr(n,bc(r),r.getData("text/html"),i,t)?t.preventDefault():Kp(n,t)};class wc{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const qp=Ye?"altKey":"ctrlKey";function kc(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[qp]}_e.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Kr(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof B?i.to-1:i.to))){if(r&&r.mightDrag)o=B.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=B.create(n.state.doc,u.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:d}=js(n,l);(!t.dataTransfer.files.length||!Re||va>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(cr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",cr||t.dataTransfer.setData("text/plain",c),n.dragging=new wc(d,kc(n,t),o)},_e.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Ve.dragover=Ve.dragenter=(n,e)=>e.preventDefault(),Ve.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Kr(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=oc(n,bc(t.dataTransfer),cr?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&kc(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||N.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?aa(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(f))return;let h=c.doc.resolve(d);if(u&&B.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new B(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,y,w,k)=>p=k),c.setSelection(zs(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))},_e.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Et(n)},20))},_e.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},_e.beforeinput=(n,e)=>{if(Re&&St&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,un(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Ve)_e[n]=Ve[n];function ur(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Jr{constructor(e,t){this.toDOM=e,this.spec=t||mn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ie(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Jr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ur(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Kt{constructor(e,t){this.attrs=e,this.spec=t||mn}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ie(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Kt&&ur(this.attrs,e.attrs)&&ur(this.spec,e.spec)}static is(e){return e.type instanceof Kt}destroy(){}}class Ys{constructor(e,t){this.attrs=e,this.spec=t||mn}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Ie(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ys&&ur(this.attrs,e.attrs)&&ur(this.spec,e.spec)}destroy(){}}class Ie{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ie(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Ie(e,e,new Jr(t,r))}static inline(e,t,r,i){return new Ie(e,t,new Kt(r,i))}static node(e,t,r,i){return new Ie(e,t,new Ys(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Kt}get widget(){return this.type instanceof Jr}}const Pn=[],mn={};class ae{constructor(e,t){this.local=e.length?e:Pn,this.children=t.length?t:Pn}static create(e,t){return t.length?Gr(t,e,0,mn):Pe}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==Pe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||mn)}mapInner(e,t,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Jp(this.children,o||[],e,t,r,i,s):o?new ae(o.sort(gn),Pn):Pe}add(e,t){return t.length?this==Pe?ae.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,d;if(d=Sc(t,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,d,c+1):i.splice(s,0,a,a+l.nodeSize,Gr(d,l,c+1,mn)),s+=3}});let o=xc(s?Cc(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ae(o.length?this.local.concat(o).sort(gn):this.local,i||this.children)}remove(e){return e.length==0||this==Pe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+t,a=r[s+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>l&&u.to<a&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=Pe?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ae(i,r):Pe}forChild(e,t){if(this==Pe)return this;if(t.isLeaf)return ae.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof Kt){let c=Math.max(s,a.from)-s,d=Math.min(o,a.to)-s;c<d&&(i||(i=[])).push(a.copy(c,d))}}if(i){let l=new ae(i.sort(gn),Pn);return r?new qt([l,r]):l}return r||Pe}eq(e){if(this==e)return!0;if(!(e instanceof ae)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Xs(this.localsInner(e))}localsInner(e){if(this==Pe)return Pn;if(e.inlineContent||!this.local.some(Kt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Kt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ae.empty=new ae([],[]),ae.removeOverlap=Xs;const Pe=ae.empty;class qt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,mn));return qt.from(r)}forChild(e,t){if(t.isLeaf)return ae.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Pe&&(s instanceof qt?r=r.concat(s.members):r.push(s))}return qt.from(r)}eq(e){if(!(e instanceof qt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Xs(r?t:t.sort(gn)):Pn}static from(e){switch(e.length){case 0:return Pe;case 1:return e[0];default:return new qt(e.every(t=>t instanceof ae)?e:e.reduce((t,r)=>t.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Jp(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let u=0;t.maps[c].forEach((f,h,p,g)=>{let y=g-p-(h-f);for(let w=0;w<l.length;w+=3){let k=l[w+1];if(k<0||f>k+d-u)continue;let C=l[w]+d-u;h>=C?l[w+1]=f<=C?-2:-1:f>=d&&y&&(l[w]+=y,l[w+1]+=y)}u+=y}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=t.map(n[c]+s),u=d-i;if(u<0||u>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(u),y=r.maybeChild(p);if(y&&g==u&&g+y.nodeSize==h){let w=l[c+2].mapInner(t,y,d+1,n[c]+s+1,o);w!=Pe?(l[c]=u,l[c+1]=h,l[c+2]=w):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Gp(l,n,e,t,i,s,o),d=Gr(c,r,0,o);e=d.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,f=0;u<d.children.length;u+=3){let h=d.children[u];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ae(e.sort(gn),l)}function xc(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Ie(i.from+e,i.to+e,i.type))}return t}function Gp(n,e,t,r,i,s,o){function l(a,c){for(let d=0;d<a.local.length;d++){let u=a.local[d].map(r,i,c);u?t.push(u):o.onRemove&&o.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}function Sc(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function Cc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Gr(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let c=Sc(n,l,a+t);if(c){s=!0;let d=Gr(c,l,t+a+1,r);d!=Pe&&i.push(a,a+l.nodeSize,d)}});let o=xc(s?Cc(n):n,-t).sort(gn);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new ae(o,i):Pe}function gn(n,e){return n.from-e.from||n.to-e.to}function Xs(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Ec(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Ec(e,i,r.copy(s.from,r.to)));break}}}return e}function Ec(n,e,t){for(;e<n.length&&gn(t,n[e])>0;)e++;n.splice(e,0,t)}function Qs(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Pe&&e.push(r)}),n.cursorWrapper&&e.push(ae.create(n.state.doc,[n.cursorWrapper.deco])),qt.from(e)}const Yp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xp=He&&Ht<=11;class Qp{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Zp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qp,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);He&&Ht<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Xp&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Yp)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Qa(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(He&&Ht<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&dn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Nn(s))t.add(s);for(let s=e.anchorNode;s;s=Nn(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Qa(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],a);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(l=!0))}if(Ge&&a.length){let d=a.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!u||nm(e,u)!=h)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Fr(r)&&(c=Vs(e))&&c.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),em(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(He&&Ht<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:f}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?Oe(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?Oe(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Mc=new WeakMap,vc=!1;function em(n){if(!Mc.has(n)&&(Mc.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ge,vc)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),vc=!0}}function Tc(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return dn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function tm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Tc(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Tc(n,t):null}function nm(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function rm(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],Fr(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Re&&n.input.lastKeyCode===8)for(let y=s;y>i;y--){let w=r.childNodes[y-1],k=w.pmViewDesc;if(w.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let u=n.state.doc,f=n.someProp("domParser")||Bt.fromSchema(n.state.schema),h=u.resolve(o),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:im,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,w=c[1]&&c[1].pos;w==null&&(w=y),p={anchor:y+o,head:w+o}}return{doc:g,sel:p,from:o,to:l}}function im(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Be&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Be&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const sm=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function om(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,V=Vs(n,T);if(V&&!n.state.selection.eq(V)){if(Re&&St&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",j=>j(n,un(13,"Enter"))))return;let K=n.state.tr.setSelection(V);T=="pointer"?K.setMeta("pointer",!0):T=="key"&&K.scrollIntoView(),s&&K.setMeta("composition",s),n.dispatch(K)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=rm(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let p=cm(u.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(An&&n.input.lastIOSEnter>Date.now()-225||St)&&i.some(T=>T.nodeType==1&&!sm.test(T.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",T=>T(n,un(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof F&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=Oc(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let V=n.state.tr.setSelection(T);s&&V.setMeta("composition",s),n.dispatch(V)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof F&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),He&&Ht<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),w=d.resolve(p.start),k=g.sameParent(y)&&g.parent.inlineContent&&w.end()>=p.endA;if((An&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!k&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",T=>T(n,un(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&am(d,p.start,p.endA,g,y)&&n.someProp("handleKeyDown",T=>T(n,un(8,"Backspace")))){St&&Re&&n.domObserver.suppressSelectionUpdates();return}Re&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),St&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,un(13,"Enter"))})},20));let C=p.start,D=p.endA,M=T=>{let V=T||n.state.tr.replace(C,D,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let K=Oc(n,V.doc,c.sel);K&&!(Re&&n.composing&&K.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(K.head==C||K.head==V.mapping.map(D)-1)||He&&K.empty&&K.head==C)&&V.setSelection(K)}return s&&V.setMeta("composition",s),V.scrollIntoView()},P;if(k){if(g.pos==y.pos){He&&Ht<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Et(n),20));let T=M(n.state.tr.delete(C,D)),V=d.resolve(p.start).marksAcross(d.resolve(p.endA));V&&T.ensureMarks(V),n.dispatch(T)}else if(p.endA==p.endB&&(P=lm(g.parent.content.cut(g.parentOffset,y.parentOffset),w.parent.content.cut(w.parentOffset,p.endA-w.start())))){let T=M(n.state.tr);P.type=="add"?T.addMark(C,D,P.mark):T.removeMark(C,D,P.mark),n.dispatch(T)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let T=g.parent.textBetween(g.parentOffset,y.parentOffset),V=()=>M(n.state.tr.insertText(T,C,D));n.someProp("handleTextInput",K=>K(n,C,D,T,V))||n.dispatch(V())}}else n.dispatch(M())}function Oc(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:zs(n,e.resolve(t.anchor),e.resolve(t.head))}function lm(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=d=>d.mark(l.addToSet(d.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(S.from(c).eq(n))return{mark:l,type:o}}function am(n,e,t,r,i){if(t-e<=i.pos-r.pos||Zs(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Zs(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Zs(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Zs(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function cm(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&n.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&Nc(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<n.size&&Nc(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function Nc(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Ac{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Op,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Lc),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ic(this),Rc(this),this.nodeViews=Pc(this),this.docView=za(this.state.doc,Dc(this),Qs(this),this.dom,this),this.domObserver=new Zp(this,(r,i,s,o)=>om(this,r,i,s,o)),this.domObserver.start(),Np(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ks(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Lc),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(yc(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Pc(this);um(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ks(this),this.editable=Ic(this),Rc(this);let a=Qs(this),c=Dc(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(i.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&jh(this);if(o){this.domObserver.stop();let h=u&&(He||Re)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&dm(i.selection,e.selection);if(u){let p=Re?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Fp(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=za(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&hp(this))?Et(this,h):(Ya(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&Uh(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof B){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ta(this,t.getBoundingClientRect(),e)}else Ta(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new wc(e.slice,e.move,i<0?void 0:B.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(He){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Wh(this.dom),Et(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Yh(this,e)}coordsAtPos(e,t=1){return Ia(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return tp(this,t||this.state,e)}pasteHTML(e,t){return dr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return dr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return js(this,e)}destroy(){this.docView&&(Ap(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Qs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Rh())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Rp(this,e)}domSelectionRange(){let e=this.domSelection();return e?Be&&this.root.nodeType===11&&_h(this.dom.ownerDocument)==this.dom&&tm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ac.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Dc(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ie.node(0,n.state.doc.content.size,e)]}function Rc(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ie.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Ic(n){return!n.someProp("editable",e=>e(n.state)===!1)}function dm(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Pc(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function um(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Lc(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Jt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Yr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fm=typeof navigator<"u"&&/Mac/.test(navigator.platform),hm=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ne=0;Ne<10;Ne++)Jt[48+Ne]=Jt[96+Ne]=String(Ne);for(var Ne=1;Ne<=24;Ne++)Jt[Ne+111]="F"+Ne;for(var Ne=65;Ne<=90;Ne++)Jt[Ne]=String.fromCharCode(Ne+32),Yr[Ne]=String.fromCharCode(Ne);for(var eo in Jt)Yr.hasOwnProperty(eo)||(Yr[eo]=Jt[eo]);function pm(n){var e=fm&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||hm&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Yr:Jt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const mm=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gm=typeof navigator<"u"&&/Win/.test(navigator.platform);function ym(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))mm?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function bm(n){let e=Object.create(null);for(let t in n)e[ym(t)]=n[t];return e}function to(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function wm(n){return new se({props:{handleKeyDown:no(n)}})}function no(n){let e=bm(n);return function(t,r){let i=pm(r),s,o=e[to(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[to(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(gm&&r.ctrlKey&&r.altKey)&&(s=Jt[r.keyCode])&&s!=i){let l=e[to(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const ro=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Bc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const _c=(n,e,t)=>{let r=Bc(n,t);if(!r)return!1;let i=io(r);if(!i){let o=r.blockRange(),l=o&&En(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(Kc(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ln(s,"end")||B.isSelectable(s)))for(let o=r.depth;;o--){let l=$r(n.doc,r.before(o),r.after(o),N.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Ln(s,"end")?H.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):B.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},km=(n,e,t)=>{let r=Bc(n,t);if(!r)return!1;let i=io(r);return i?Vc(n,i,e):!1},xm=(n,e,t)=>{let r=zc(n,t);if(!r)return!1;let i=so(r);return i?Vc(n,i,e):!1};function Vc(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=$r(n.doc,s,a,N.empty);if(!c||c.from!=s||c instanceof Se&&c.slice.size>=a-s)return!1;if(t){let d=n.tr.step(c);d.setSelection(F.create(d.doc,s)),t(d.scrollIntoView())}return!0}function Ln(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const $c=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=io(r)}let o=s&&s.nodeBefore;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function io(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function zc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Hc=(n,e,t)=>{let r=zc(n,t);if(!r)return!1;let i=so(r);if(!i)return!1;let s=i.nodeAfter;if(Kc(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ln(s,"start")||B.isSelectable(s))){let o=$r(n.doc,r.before(),r.after(),N.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(Ln(s,"start")?H.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):B.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Fc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=so(r)}let o=s&&s.nodeAfter;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos)).scrollIntoView()),!0)};function so(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Sm=(n,e)=>{let t=n.selection,r=t instanceof B,i;if(r){if(t.node.isTextblock||!$t(n.doc,t.from))return!1;i=t.from}else if(i=Vr(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(B.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Cm=(n,e)=>{let t=n.selection,r;if(t instanceof B){if(t.node.isTextblock||!$t(n.doc,t.to))return!1;r=t.to}else if(r=Vr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Em=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&En(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},jc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
10
+ `).scrollIntoView()),!0)};function oo(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Mm=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=oo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(H.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Uc=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof We||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=oo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(o,s.createAndFill());l.setSelection(F.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Wc=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(kt(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&En(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function vm(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!kt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=oo(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof F||e.selection instanceof We)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=kt(d.doc,u,s.length,s);if(f||(s[0]=l?{type:l}:null,f=kt(d.doc,u,s.length,s)),!f)return!1;if(d.split(u,s.length,s),!a&&c&&r.node(o).type!=l){let h=d.mapping.map(r.before(o)),p=d.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(o)),l)}return t&&t(d.scrollIntoView()),!0}}const Tm=vm(),Om=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(B.create(n.doc,i))),!0)};function Nm(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||$t(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Kc(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Nm(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,p=S.empty;for(let w=o.length-1;w>=0;w--)p=S.from(o[w].create(null,p));p=S.from(i.copy(p));let g=n.tr.step(new Ce(e.pos-1,h,e.pos,h,new N(p,1,0),o.length,!0)),y=g.doc.resolve(h+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&$t(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&a?null:H.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&En(u);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(u,f).scrollIntoView()),!0;if(c&&Ln(s,"start",!0)&&Ln(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let w=S.empty;for(let C=p.length-1;C>=0;C--)w=S.from(p[C].copy(w));let k=n.tr.step(new Ce(e.pos-p.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new N(w,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function qc(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(F.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Am=qc(-1),Dm=qc(1);function Rm(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&Cs(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Jc(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}r(s.scrollIntoView())}return!0}}function lo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}lo(ro,_c,$c),lo(ro,Hc,Fc),lo(jc,Uc,Wc,Tm),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Im(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let l=r?t.tr:null;return Pm(l,o,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Pm(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new Rr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Rr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=Cs(s,t,r,e);return l?(n&&Lm(n,e,l,i,t),!0):!1}function Lm(n,e,t,r,i){let s=S.empty;for(let d=t.length-1;d>=0;d--)s=S.from(t[d].type.create(t[d].attrs,s));n.step(new Ce(e.start-(r?2:0),e.end,e.start,e.end,new N(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let l=t.length-o,a=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,f=!0;d<u;d++,f=!1)!f&&kt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Bm(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?_m(e,t,n,s):Vm(e,t,s):!0:!1}}function _m(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Ce(s-1,o,s,o,new N(S.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Rr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=En(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return $t(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function Vm(n,e,t){let r=n.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,g=t.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(l?0:1),d+1,o.content.append(a?S.empty:S.from(i))))return!1;let u=s.pos,f=u+o.nodeSize;return r.step(new Ce(u-(l?1:0),f+(a?1:0),u+1,f-1,new N((l?S.empty:S.from(i.copy(S.empty))).append(a?S.empty:S.from(i.copy(S.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function $m(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=S.from(c?n.create():null),u=new N(S.from(n.create(null,S.from(l.type.create(null,d)))),c?3:1,0),f=s.start,h=s.end;t(e.tr.step(new Ce(f-(c?3:1),h,f,h,u,1,!0)).scrollIntoView())}return!0}}var zm=Object.defineProperty,Gc=(n,e)=>{for(var t in e)zm(n,t,{get:e[t],enumerable:!0})};function Xr(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var Qr=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,l])=>[o,(...c)=>{const d=l(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],l=!!n,a=n||i.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(t).map(([u,f])=>[u,(...p)=>{const g=this.buildProps(a,e),y=f(...p)(g);return o.push(y),d}])),run:c};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:Xr({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},Hm=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function Yc(n,e){const t=new ha(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}var Xc=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Xc(r)}return n};function Zr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Xc(t)}function fr(n,e,t){if(n instanceof Lt||n instanceof S)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return S.fromArray(n.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),fr("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="";const a=new Fl({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Bt.fromSchema(a).parseSlice(Zr(n),t.parseOptions):Bt.fromSchema(a).parse(Zr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Bt.fromSchema(e);return t.slice?s.parseSlice(Zr(n),t.parseOptions).content:s.parse(Zr(n),t.parseOptions)}return fr("",e,t)}function ao(n,e,t={},r={}){return fr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}function Fm(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function co(n,e){const t=[];return n.descendants((r,i)=>{e(r)&&t.push({node:r,pos:i})}),t}function jm(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function Um(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function ei(n){return e=>Um(e.$from,n)}function $(n,e,t){return n.config[e]===void 0&&n.parent?$(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?$(n.parent,e,t):null}):n.config[e]}function uo(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",t);return r?[e,...uo(r())]:e}).flat(10)}function fo(n,e){const t=an.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Qc(n){return typeof n=="function"}function ee(n,e=void 0,...t){return Qc(n)?e?n.bind(e)(...t):n(...t):n}function Wm(n={}){return Object.keys(n).length===0&&n.constructor===Object}function hr(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Zc(n){const e=[],{nodeExtensions:t,markExtensions:r}=hr(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=$(o,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([f,h])=>{e.push({type:u,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=$(o,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([d,u])=>{const f={...s,...u};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:o.name,name:d,attribute:f})})}),e}function ce(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(d=>!a.includes(d));r[i]=[...a,...c].join(" ")}else if(i==="style"){const l=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;a.forEach(d=>{const[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),l.forEach(d=>{const[u,f]=d.split(":").map(h=>h.trim());c.set(u,f)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=s}),r},{})}function ti(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ce(t,r),{})}function Km(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function ed(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):Km(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function td(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Wm(t)?!1:t!=null))}function qm(n,e){var t;const r=Zc(n),{nodeExtensions:i,markExtensions:s}=hr(n),o=(t=i.find(c=>$(c,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(c=>{const d=r.filter(w=>w.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((w,k)=>{const C=$(k,"extendNodeSchema",u);return{...w,...C?C(c):{}}},{}),h=td({...f,content:ee($(c,"content",u)),marks:ee($(c,"marks",u)),group:ee($(c,"group",u)),inline:ee($(c,"inline",u)),atom:ee($(c,"atom",u)),selectable:ee($(c,"selectable",u)),draggable:ee($(c,"draggable",u)),code:ee($(c,"code",u)),whitespace:ee($(c,"whitespace",u)),linebreakReplacement:ee($(c,"linebreakReplacement",u)),defining:ee($(c,"defining",u)),isolating:ee($(c,"isolating",u)),attrs:Object.fromEntries(d.map(w=>{var k,C;return[w.name,{default:(k=w?.attribute)==null?void 0:k.default,validate:(C=w?.attribute)==null?void 0:C.validate}]}))}),p=ee($(c,"parseHTML",u));p&&(h.parseDOM=p.map(w=>ed(w,d)));const g=$(c,"renderHTML",u);g&&(h.toDOM=w=>g({node:w,HTMLAttributes:ti(w,d)}));const y=$(c,"renderText",u);return y&&(h.toText=y),[c.name,h]})),a=Object.fromEntries(s.map(c=>{const d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((y,w)=>{const k=$(w,"extendMarkSchema",u);return{...y,...k?k(c):{}}},{}),h=td({...f,inclusive:ee($(c,"inclusive",u)),excludes:ee($(c,"excludes",u)),group:ee($(c,"group",u)),spanning:ee($(c,"spanning",u)),code:ee($(c,"code",u)),attrs:Object.fromEntries(d.map(y=>{var w,k;return[y.name,{default:(w=y?.attribute)==null?void 0:w.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),p=ee($(c,"parseHTML",u));p&&(h.parseDOM=p.map(y=>ed(y,d)));const g=$(c,"renderHTML",u);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:ti(y,d)})),[c.name,h]}));return new Fl({topNode:o,nodes:l,marks:a})}function Jm(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function ho(n){return n.sort((t,r)=>{const i=$(t,"priority")||100,s=$(r,"priority")||100;return i>s?-1:i<s?1:0})}function nd(n){const e=ho(uo(n)),t=Jm(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function rd(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
81
11
 
82
- `.concat(n,`
83
- `).concat(Lute.Caret)),document.execCommand("insertHTML",!1,m);return}else if((a==="check"||a==="list"||a==="ordered-list"||a==="quote")&&u){var f="* ";a==="check"?f="* [ ] ":a==="ordered-list"?f="1. ":a==="quote"&&(f="> ");var S=kt(u,"newline");S?S.insertAdjacentText("afterend",f):o.insertAdjacentText("afterbegin",f),le(e);return}(0,M.ib)(e.sv.element,i),Le(e)}},hn=function(e){switch(e.currentMode){case"ir":return e.ir.element;case"wysiwyg":return e.wysiwyg.element;case"sv":return e.sv.element}},mn=function(e,t){e.options.upload.setHeaders&&(e.options.upload.headers=e.options.upload.setHeaders()),e.options.upload.headers&&Object.keys(e.options.upload.headers).forEach(function(n){t.setRequestHeader(n,e.options.upload.headers[n])})},fi=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function m(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,m)}f((r=r.apply(e,t||[])).next())})},di=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return m([f,S])}}function m(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},pi=(function(){function e(){this.isUploading=!1,this.element=document.createElement("div"),this.element.className="vditor-upload"}return e})(),hi=function(e,t){e.tip.hide();var n=[],r="",i="";e.options.lang,e.options;for(var a=function(f,S){var T=t[S],R=!0;T.name||(r+="<li>".concat(window.VditorI18n.nameEmpty,"</li>"),R=!1),T.size>e.options.upload.max&&(r+="<li>".concat(T.name," ").concat(window.VditorI18n.over," ").concat(e.options.upload.max/1024/1024,"M</li>"),R=!1);var P=T.name.lastIndexOf("."),O=T.name.substr(P),W=e.options.upload.filename(T.name.substr(0,P))+O;if(e.options.upload.accept){var U=e.options.upload.accept.split(",").some(function(N){var J=N.trim();if(J.indexOf(".")===0){if(O.toLowerCase()===J.toLowerCase())return!0}else if(T.type.split("/")[0]===J.split("/")[0])return!0;return!1});U||(r+="<li>".concat(T.name," ").concat(window.VditorI18n.fileTypeError,"</li>"),R=!1)}R&&(n.push(T),i+="<li>".concat(W," ").concat(window.VditorI18n.uploading,' <a class="vditorCancelUpload" href="javascript:void(0)">').concat(window.VditorI18n.cancelUpload,"</a></li>"))},o=t.length,u=0;u<o;u++)a(o,u);if(e.tip.show("<ul>".concat(r).concat(i,"</ul>")),e.options.upload.cancel){var m=e.tip.element.querySelector(".vditorCancelUpload");m&&m.addEventListener("click",function(){e.options.upload.cancel(n),e.tip.hide(),e.upload.isUploading=!1})}return n},mi=function(e,t){var n=hn(t);n.focus();var r=JSON.parse(e),i="";r.code===1&&(i="".concat(r.msg)),r.data.errFiles&&r.data.errFiles.length>0&&(i="<ul><li>".concat(i,"</li>"),r.data.errFiles.forEach(function(o){var u=o.lastIndexOf("."),m=t.options.upload.filename(o.substr(0,u))+o.substr(u);i+="<li>".concat(m," ").concat(window.VditorI18n.uploadError,"</li>")}),i+="</ul>"),i?t.tip.show(i):t.tip.hide();var a="";Object.keys(r.data.succMap).forEach(function(o){var u=r.data.succMap[o],m=o.lastIndexOf("."),f=o.substr(m),S=t.options.upload.filename(o.substr(0,m))+f;f=f.toLowerCase(),f.indexOf(".wav")===0||f.indexOf(".mp3")===0||f.indexOf(".ogg")===0?t.currentMode==="wysiwyg"?a+=`<div class="vditor-wysiwyg__block" data-type="html-block"
84
- data-block="0"><pre><code>&lt;audio controls="controls" src="`.concat(u,'"&gt;&lt;/audio&gt;</code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="').concat(u,`"></audio></pre></div>
85
- `):t.currentMode==="ir"?a+='<audio controls="controls" src="'.concat(u,`"></audio>
86
- `):a+="[".concat(S,"](").concat(u,`)
87
- `):f.indexOf(".apng")===0||f.indexOf(".bmp")===0||f.indexOf(".gif")===0||f.indexOf(".ico")===0||f.indexOf(".cur")===0||f.indexOf(".jpg")===0||f.indexOf(".jpeg")===0||f.indexOf(".jfif")===0||f.indexOf(".pjp")===0||f.indexOf(".pjpeg")===0||f.indexOf(".png")===0||f.indexOf(".svg")===0||f.indexOf(".webp")===0?t.currentMode==="wysiwyg"?a+='<img alt="'.concat(S,'" src="').concat(u,`">
88
- `):a+="![".concat(S,"](").concat(u,`)
89
- `):t.currentMode==="wysiwyg"?a+='<a href="'.concat(u,'">').concat(S,`</a>
90
- `):a+="[".concat(S,"](").concat(u,`)
91
- `)}),(0,M.Hc)(t.upload.range),document.execCommand("insertHTML",!1,a),t.upload.range=getSelection().getRangeAt(0).cloneRange()},Ft=function(e,t,n){return fi(void 0,void 0,void 0,function(){var r,i,O,a,o,o,u,m,f,S,T,R,P,O,W,U;return di(this,function(N){switch(N.label){case 0:for(r=[],i=e.options.upload.multiple===!0?t.length:1,O=0;O<i;O++)a=t[O],a instanceof DataTransferItem&&(a=a.getAsFile()),r.push(a);return e.options.upload.handler?[4,e.options.upload.handler(r)]:[3,2];case 1:return o=N.sent(),n&&(n.value=""),typeof o=="string"?(e.tip.show(o),[2]):[2];case 2:return!e.options.upload.url||!e.upload?(n&&(n.value=""),e.tip.show("please config: options.upload.url"),[2]):e.options.upload.file?[4,e.options.upload.file(r)]:[3,4];case 3:r=N.sent(),N.label=4;case 4:if(e.options.upload.validate&&(o=e.options.upload.validate(r),typeof o=="string"))return e.tip.show(o),[2];if(u=hn(e),e.upload.range=(0,M.zh)(e),m=hi(e,r),m.length===0)return n&&(n.value=""),[2];for(f=new FormData,S=e.options.upload.extraData,T=0,R=Object.keys(S);T<R.length;T++)P=R[T],f.append(P,S[P]);for(O=0,W=m.length;O<W;O++)f.append(e.options.upload.fieldName,m[O]);return U=new XMLHttpRequest,e.upload.xhr=U,U.open("POST",e.options.upload.url),e.options.upload.token&&U.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(U.withCredentials=!0),mn(e,U),e.upload.isUploading=!0,u.setAttribute("contenteditable","false"),U.onreadystatechange=function(){if(U.readyState===XMLHttpRequest.DONE){if(e.upload.isUploading=!1,u.setAttribute("contenteditable","true"),U.status>=200&&U.status<300)if(e.options.upload.success)e.options.upload.success(u,U.responseText);else{var J=U.responseText;e.options.upload.format&&(J=e.options.upload.format(t,U.responseText)),mi(J,e)}else e.options.upload.error?e.options.upload.error(U.responseText):e.tip.show(U.responseText);n&&(n.value=""),e.upload.element.style.display="none",e.upload.xhr=void 0}},U.upload.onprogress=function(J){if(J.lengthComputable){var F=J.loaded/J.total*100;e.upload.element.style.display="block";var Y=e.upload.element;Y.style.width=F+"%"}},U.send(f),[2]}})})},Ct=function(e,t,n){var r,i=(0,s.F9)(t.startContainer);if(i||(i=e.wysiwyg.element),n&&n.inputType!=="formatItalic"&&n.inputType!=="deleteByDrag"&&n.inputType!=="insertFromDrop"&&n.inputType!=="formatBold"&&n.inputType!=="formatRemove"&&n.inputType!=="formatStrikeThrough"&&n.inputType!=="insertUnorderedList"&&n.inputType!=="insertOrderedList"&&n.inputType!=="formatOutdent"&&n.inputType!=="formatIndent"&&n.inputType!==""||!n){var a=Qr(t.startContainer);a&&a.remove(),e.wysiwyg.element.querySelectorAll("wbr").forEach(function(F){F.remove()}),t.insertNode(document.createElement("wbr")),i.querySelectorAll("[style]").forEach(function(F){F.removeAttribute("style")}),i.querySelectorAll(".vditor-comment").forEach(function(F){F.textContent.trim()===""&&(F.classList.remove("vditor-comment","vditor-comment--focus"),F.removeAttribute("data-cmtids"))}),(r=i.previousElementSibling)===null||r===void 0||r.querySelectorAll(".vditor-comment").forEach(function(F){F.textContent.trim()===""&&(F.classList.remove("vditor-comment","vditor-comment--focus"),F.removeAttribute("data-cmtids"))});var o="";i.getAttribute("data-type")==="link-ref-defs-block"&&(i=e.wysiwyg.element);var u=i.isEqualNode(e.wysiwyg.element),m=(0,s.a1)(i,"data-type","footnotes-block");if(u)o=i.innerHTML;else{var f=(0,s.O9)(t.startContainer);if(f&&!m){var S=(0,k.S)(t.startContainer,"BLOCKQUOTE");S?i=(0,s.F9)(t.startContainer)||i:i=f}if(m&&(i=m),o=i.outerHTML,i.tagName==="UL"||i.tagName==="OL"){var T=i.previousElementSibling,R=i.nextElementSibling;T&&(T.tagName==="UL"||T.tagName==="OL")&&(o=T.outerHTML+o,T.remove()),R&&(R.tagName==="UL"||R.tagName==="OL")&&(o=o+R.outerHTML,R.remove()),o=o.replace("<div><wbr><br></div>","<li><p><wbr><br></p></li>")}i.innerText.startsWith("```")||(e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(F){F&&!i.isEqualNode(F)&&(o+=F.outerHTML,F.remove())}),e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']").forEach(function(F){F&&!i.isEqualNode(F)&&(o+=F.outerHTML,F.remove())}))}if(o=o.replace(/<\/(strong|b)><strong data-marker="\W{2}">/g,"").replace(/<\/(em|i)><em data-marker="\W{1}">/g,"").replace(/<\/(s|strike)><s data-marker="~{1,2}">/g,""),o==='<p data-block="0">```<wbr></p>'&&e.hint.recentLanguage&&(o='<p data-block="0">```<wbr></p>'.replace("```","```"+e.hint.recentLanguage)),x("SpinVditorDOM",o,"argument",e.options.debugger),o=e.lute.SpinVditorDOM(o),x("SpinVditorDOM",o,"result",e.options.debugger),u)i.innerHTML=o;else if(i.outerHTML=o,m){var P=(0,s.E2)(e.wysiwyg.element.querySelector("wbr"),"LI");if(P){var O=e.wysiwyg.element.querySelector('sup[data-type="footnotes-ref"][data-footnotes-label="'.concat(P.getAttribute("data-marker"),'"]'));O&&O.setAttribute("aria-label",P.textContent.trim().substr(0,24))}}var W,U=e.wysiwyg.element.querySelectorAll("[data-type='link-ref-defs-block']");U.forEach(function(F,Y){Y===0?W=F:(W.insertAdjacentHTML("beforeend",F.innerHTML),F.remove())}),U.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",U[0]);var N,J=e.wysiwyg.element.querySelectorAll("[data-type='footnotes-block']");J.forEach(function(F,Y){Y===0?N=F:(N.insertAdjacentHTML("beforeend",F.innerHTML),F.remove())}),J.length>0&&e.wysiwyg.element.insertAdjacentElement("beforeend",J[0]),(0,M.ib)(e.wysiwyg.element,t),e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(F){_e(F,e)}),n&&(n.inputType==="deleteContentBackward"||n.inputType==="deleteContentForward")&&e.options.comment.enable&&(e.wysiwyg.triggerRemoveComment(e),e.options.comment.adjustTop(e.wysiwyg.getComments(e,!0)))}Fe(e),pe(e,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0})},gi=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},gn=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function m(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,m)}f((r=r.apply(e,t||[])).next())})},yn=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return m([f,S])}}function m(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},bn=function(e,t,n){if(e.keyCode===229&&e.code===""&&e.key==="Unidentified"&&t.currentMode!=="sv"){var r=(0,s.F9)(n);if(r&&r.textContent.trim()==="")return t[t.currentMode].composingLock=!0,!1}return!0},wn=function(e,t,n){if(!(n.key==="Enter"||n.key==="Tab"||n.key==="Backspace"||n.key.indexOf("Arrow")>-1||(0,l.yl)(n)||n.key==="Escape"||n.shiftKey||n.altKey)){var r=(0,s.lG)(e.startContainer,"P")||(0,s.lG)(e.startContainer,"LI");if(r&&(0,M.im)(r,t[t.currentMode].element,e).start===0){r.nodeValue&&(r.nodeValue=r.nodeValue.replace(/\u2006/g,""));var i=document.createTextNode(w.g.ZWSP);e.insertNode(i),e.setStartAfter(i)}}},vn=function(e,t){if(t==="ArrowDown"||t==="ArrowUp"){var n=(0,s.a1)(e.startContainer,"data-type","math-inline")||(0,s.a1)(e.startContainer,"data-type","html-entity")||(0,s.a1)(e.startContainer,"data-type","html-inline");n&&(t==="ArrowDown"&&e.setStartAfter(n.parentElement),t==="ArrowUp"&&e.setStartBefore(n.parentElement))}},dt=function(e,t){var n=(0,M.zh)(e),r=(0,s.F9)(n.startContainer);r&&(r.insertAdjacentHTML(t,'<p data-block="0">'.concat(w.g.ZWSP,`<wbr>
92
- </p>`)),(0,M.ib)(e[e.currentMode].element,n),nt(e),re(e))},yi=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.rows[0].cells[0].isSameNode(e)?t:!1},bi=function(e){var t=(0,s.lG)(e,"TABLE");return t&&t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)?t:!1},En=function(e,t,n){n===void 0&&(n=!0);var r=e.previousElementSibling;return r||(e.parentElement.previousElementSibling?r=e.parentElement.previousElementSibling.lastElementChild:e.parentElement.parentElement.tagName==="TBODY"&&e.parentElement.parentElement.previousElementSibling?r=e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild:r=null),r&&(t.selectNodeContents(r),n||t.collapse(!1),(0,M.Hc)(t)),r},pt=function(e,t,n,r,i){var a=(0,M.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowDown"&&r.textContent.trimRight().substr(a.start).indexOf(`
93
- `)===-1||t.key==="ArrowRight"&&a.start>=r.textContent.trimRight().length){var o=i.nextElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!0),(0,M.Hc)(n)),t.preventDefault(),!0}return!1},rt=function(e,t,n,r,i){var a=(0,M.im)(r,e[e.currentMode].element,n);if(t.key==="ArrowUp"&&r.textContent.substr(0,a.start).indexOf(`
94
- `)===-1||(t.key==="ArrowLeft"||t.key==="Backspace"&&n.toString()==="")&&a.start===0){var o=i.previousElementSibling;return!o||o&&(o.tagName==="TABLE"||o.getAttribute("data-type"))?(i.insertAdjacentHTML("beforebegin",'<p data-block="0">'.concat(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(e[e.currentMode].element,n)):(n.selectNodeContents(o),n.collapse(!1),(0,M.Hc)(n)),t.preventDefault(),!0}return!1},_t=function(e,t,n,r){r===void 0&&(r=!0);var i=(0,s.lG)(t.startContainer,"LI");if(e[e.currentMode].element.querySelectorAll("wbr").forEach(function(S){S.remove()}),t.insertNode(document.createElement("wbr")),r&&i){for(var a="",o=0;o<i.parentElement.childElementCount;o++){var u=i.parentElement.children[o].querySelector("input");u&&u.remove(),a+='<p data-block="0">'.concat(i.parentElement.children[o].innerHTML.trimLeft(),"</p>")}i.parentElement.insertAdjacentHTML("beforebegin",a),i.parentElement.remove()}else if(i)if(n==="check")i.parentElement.querySelectorAll("li").forEach(function(S){S.insertAdjacentHTML("afterbegin",'<input type="checkbox" />'.concat(S.textContent.indexOf(" ")===0?"":" ")),S.classList.add("vditor-task")});else{i.querySelector("input")&&i.parentElement.querySelectorAll("li").forEach(function(S){S.querySelector("input").remove(),S.classList.remove("vditor-task")});var f=void 0;n==="list"?(f=document.createElement("ul"),f.setAttribute("data-marker","*")):(f=document.createElement("ol"),f.setAttribute("data-marker","1.")),f.setAttribute("data-block","0"),f.setAttribute("data-tight",i.parentElement.getAttribute("data-tight")),f.innerHTML=i.parentElement.innerHTML,i.parentElement.parentNode.replaceChild(f,i.parentElement)}else{var m=(0,s.a1)(t.startContainer,"data-block","0");m||(e[e.currentMode].element.querySelector("wbr").remove(),m=e[e.currentMode].element.querySelector("p"),m.innerHTML="<wbr>"),n==="check"?(m.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> '.concat(m.innerHTML,"</li></ul>")),m.remove()):n==="list"?(m.insertAdjacentHTML("beforebegin",'<ul data-block="0"><li>'.concat(m.innerHTML,"</li></ul>")),m.remove()):n==="ordered-list"&&(m.insertAdjacentHTML("beforebegin",'<ol data-block="0"><li>'.concat(m.innerHTML,"</li></ol>")),m.remove())}},Sn=function(e,t,n){var r=t.previousElementSibling;if(t&&r){var i=[t];Array.from(n.cloneContents().children).forEach(function(m,f){m.nodeType!==3&&t&&m.textContent.trim()!==""&&t.getAttribute("data-node-id")===m.getAttribute("data-node-id")&&(f!==0&&i.push(t),t=t.nextElementSibling)}),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(m){m.remove()}),n.insertNode(document.createElement("wbr"));var a=r.parentElement,o="";i.forEach(function(m){var f=m.getAttribute("data-marker");f.length!==1&&(f="1".concat(f.slice(-1))),o+='<li data-node-id="'.concat(m.getAttribute("data-node-id"),'" data-marker="').concat(f,'">').concat(m.innerHTML,"</li>"),m.remove()}),r.insertAdjacentHTML("beforeend","<".concat(a.tagName,' data-block="0">').concat(o,"</").concat(a.tagName,">")),e.currentMode==="wysiwyg"?a.outerHTML=e.lute.SpinVditorDOM(a.outerHTML):a.outerHTML=e.lute.SpinVditorIRDOM(a.outerHTML),(0,M.ib)(e[e.currentMode].element,n);var u=(0,s.O9)(n.startContainer);u&&u.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(m){_e(m,e),e.currentMode==="wysiwyg"&&m.previousElementSibling.setAttribute("style","display:none")}),re(e),nt(e)}else e[e.currentMode].element.focus()},qt=function(e,t,n,r){var i=(0,s.lG)(t.parentElement,"LI");if(i){e[e.currentMode].element.querySelectorAll("wbr").forEach(function(T){T.remove()}),n.insertNode(document.createElement("wbr"));var a=t.parentElement,o=a.cloneNode(),u=[t];Array.from(n.cloneContents().children).forEach(function(T,R){T.nodeType!==3&&t&&T.textContent.trim()!==""&&t.getAttribute("data-node-id")===T.getAttribute("data-node-id")&&(R!==0&&u.push(t),t=t.nextElementSibling)});var m=!1,f="";a.querySelectorAll("li").forEach(function(T){m&&(f+=T.outerHTML,!T.nextElementSibling&&!T.previousElementSibling?T.parentElement.remove():T.remove()),T.isSameNode(u[u.length-1])&&(m=!0)}),u.reverse().forEach(function(T){i.insertAdjacentElement("afterend",T)}),f&&(o.innerHTML=f,u[0].insertAdjacentElement("beforeend",o)),e.currentMode==="wysiwyg"?r.outerHTML=e.lute.SpinVditorDOM(r.outerHTML):r.outerHTML=e.lute.SpinVditorIRDOM(r.outerHTML),(0,M.ib)(e[e.currentMode].element,n);var S=(0,s.O9)(n.startContainer);S&&S.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(T){_e(T,e),e.currentMode==="wysiwyg"&&T.previousElementSibling.setAttribute("style","display:none")}),re(e),nt(e)}else e[e.currentMode].element.focus()},Lt=function(e,t){for(var n=getSelection().getRangeAt(0).startContainer.parentElement,r=e.rows[0].cells.length,i=e.rows.length,a=0,o=0;o<i;o++)for(var u=0;u<r;u++)if(e.rows[o].cells[u].isSameNode(n)){a=u;break}for(var m=0;m<i;m++)e.rows[m].cells[a].setAttribute("align",t)},Kt=function(e){var t=e.trimRight().split(`
95
- `).pop();return t===""?!1:(t.replace(/ |-/g,"")===""||t.replace(/ |_/g,"")===""||t.replace(/ |\*/g,"")==="")&&t.replace(/ /g,"").length>2?!(t.indexOf("-")>-1&&t.trimLeft().indexOf(" ")===-1&&e.trimRight().split(`
96
- `).length>1||t.indexOf(" ")===0||t.indexOf(" ")===0):!1},zt=function(e){var t=e.trimRight().split(`
97
- `);return e=t.pop(),e.indexOf(" ")===0||e.indexOf(" ")===0||(e=e.trimLeft(),e===""||t.length===0)?!1:e.replace(/-/g,"")===""||e.replace(/=/g,"")===""},re=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),e.currentMode==="wysiwyg"?pe(e,t):e.currentMode==="ir"?ze(e,t):e.currentMode==="sv"&&Le(e,t)},kn=function(e,t,n,r){var i,a=e.startContainer,o=(0,s.lG)(a,"LI");if(o){if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Enter"&&!r.shiftKey&&n&&o.contains(n)&&n.nextElementSibling)return o&&!o.textContent.endsWith(`
98
- `)&&o.insertAdjacentText("beforeend",`
99
- `),e.insertNode(document.createTextNode(`
12
+ `,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,i,(a,c,d,u)=>{var f;a.isBlock&&c>r&&(l+=s);const h=o?.[a.type.name];if(h)return d&&(l+=h({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c))}),l}function id(n,e){const t={from:0,to:n.content.size};return rd(n,t,e)}function po(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Mt(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}function sd(n,e){const t=Mt(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function be(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Gm(n,e){const t=be(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function ni(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function od(n,e){const t=ni(typeof e=="string"?e:e.name,n.schema);return t==="node"?Gm(n,e):t==="mark"?sd(n,e):{}}function Ym(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Xm(n){const e=Ym(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function ld(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),d=e.slice(s).map(a),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),Xm(r)}function mo(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ri(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:mo(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function ad(n,e,t={}){return n.find(r=>r.type===e&&ri(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function cd(n,e,t={}){return!!ad(n,e,t)}function go(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!ad([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,c=l+i.node.nodeSize;for(;o>0&&cd([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a<n.parent.childCount&&cd([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function yo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=go(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Qm=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};function bo(n,e){return e.nodes[n]||e.marks[n]||null}function ii(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var Zm=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const d=((c=(a=i.type.spec).toText)==null?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function wo(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?Mt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>ri(u.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:u,$to:f})=>{const h=u.pos,p=f.pos;n.doc.nodesBetween(h,p,(g,y)=>{if(!g.isText&&!g.marks.length)return;const w=Math.max(h,y),k=Math.min(p,y+g.nodeSize),C=k-w;o+=C,l.push(...g.marks.map(D=>({mark:D,from:w,to:k})))})}),o===0)return!1;const a=l.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>ri(u.mark.attrs,t,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=l.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,f)=>u+f.to-f.from,0);return(a>0?a+c:a)>=o}function Gt(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?be(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(u,f)=>{if(u.isText)return;const h=Math.max(r,f),p=Math.min(i,f+u.nodeSize);l.push({node:u,from:h,to:p})});const a=i-r,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>ri(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=a}function eg(n,e,t={}){if(!e)return Gt(n,null,t)||wo(n,null,t);const r=ni(e,n.schema);return r==="node"?Gt(n,e,t):r==="mark"?wo(n,e,t):!1}var tg=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=ei(l=>l.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},ng=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function dd(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function ud(n,e){const{nodeExtensions:t}=hr(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ee($(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function si(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(si(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function fd(n){return n instanceof B}function ko(n){return n instanceof F}function vt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function hd(n,e,t){const i=n.state.doc.content.size,s=vt(e,0,i),o=vt(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),u=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h=f-u,p=d-c,w={top:c,bottom:d,left:u,right:f,width:h,height:p,x:u,y:c};return{...w,toJSON:()=>w}}function pd(n,e=null){if(!e)return null;const t=H.atStart(n),r=H.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?F.create(n,vt(0,i,s),vt(n.content.size,i,s)):F.create(n,vt(e,i,s),vt(e,i,s))}function rg(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Se||i instanceof Ce))return;const s=n.mapping.maps[r];let o=0;s.forEach((l,a,c,d)=>{o===0&&(o=d)}),n.setSelection(H.near(n.doc.resolve(o),t))}var oi=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},ig=(n,e)=>{if(mo(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function li(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const u=Zm(c)+s;return o.forEach(f=>{if(d)return;const h=ig(u,f.find);if(!h)return;const p=a.state.tr,g=Xr({state:a.state,transaction:p}),y={from:r-(h[0].length-s.length),to:i},{commands:w,chain:k,can:C}=new Qr({editor:t,state:g});f.handler({state:g,range:y,match:h,commands:w,chain:k,can:C})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),d=!0)}),d}function sg(n){const{editor:e,rules:t}=n,r=new se({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=fo(S.from(d),o.schema);const{from:u}=a,f=u+d.length;li({editor:e,from:u,to:f,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return li({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&li({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?li({editor:e,from:o.pos,to:o.pos,text:`
13
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function og(n){return Object.prototype.toString.call(n).slice(8,-1)}function ai(n){return og(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function md(n,e){const t={...n};return ai(n)&&ai(e)&&Object.keys(e).forEach(r=>{ai(e[r])&&ai(n[r])?t[r]=md(n[r],e[r]):t[r]=e[r]}),t}var xo=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...ee($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ee($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>md(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},yn=class If extends xo{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new If(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const a=o.find(c=>c?.type.name===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function lg(n){return typeof n=="number"}var ag=class{constructor(n){this.find=n.find,this.handler=n.handler}},cg=(n,e,t)=>{if(mo(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function dg(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:d}=new Qr({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,i,(h,p)=>{var g,y,w,k,C;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const D=(C=(k=(w=h.content)==null?void 0:w.size)!=null?k:h.nodeSize)!=null?C:0,M=Math.max(r,p),P=Math.min(i,p+D);if(M>=P)return;const T=h.isText?h.text||"":h.textBetween(M-p,P-p,void 0,"");cg(T,s.find,o).forEach(K=>{if(K.index===void 0)return;const j=M+K.index+1,U=j+K[0].length,R={from:t.tr.mapping.map(j),to:t.tr.mapping.map(U)},X=s.handler({state:t,range:R,match:K,commands:a,chain:c,can:d,pasteEvent:o,dropEvent:l});u.push(X)})}),u.every(h=>h!==null)}var ci=null,ug=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function fg(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:d,from:u,to:f,rule:h,pasteEvt:p})=>{const g=d.tr,y=Xr({state:d,transaction:g});if(!(!dg({editor:e,state:y,from:Math.max(u-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(d=>new se({view(u){const f=p=>{var g;r=(g=u.dom.parentElement)!=null&&g.contains(p.target)?u.dom.parentElement:null,r&&(ci=e)},h=()=>{ci&&(ci=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(u,f)=>{if(s=r===u.dom.parentElement,l=f,!s){const h=ci;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,f,h)=>{const p=u[0],g=p.getMeta("uiEvent")==="paste"&&!i,y=p.getMeta("uiEvent")==="drop"&&!s,w=p.getMeta("applyPasteRules"),k=!!w;if(!g&&!y&&!k)return;if(k){let{text:M}=w;typeof M=="string"?M=M:M=fo(S.from(M),h.schema);const{from:P}=w,T=P+M.length,V=ug(M);return a({rule:d,state:h,from:P,to:{b:T},pasteEvt:V})}const C=f.doc.content.findDiffStart(h.doc.content),D=f.doc.content.findDiffEnd(h.doc.content);if(!(!lg(C)||!D||C===D.b))return a({rule:d,state:h,from:C,to:D,pasteEvt:o})}}))}var di=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.extensions=nd(n),this.schema=qm(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bo(e.name,this.schema)},r=$(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return ho([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:bo(r.name,this.schema)},s=[],o=$(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&$(r,"exitable",i)&&(l.ArrowRight=()=>yn.handleExit({editor:n,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:n})]));l={...l,...f}}const a=wm(l);s.push(a);const c=$(r,"addInputRules",i);if(dd(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=sg({editor:n,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const d=$(r,"addPasteRules",i);if(dd(r,n.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const h=fg({editor:n,rules:f});s.push(...h)}}const u=$(r,"addProseMirrorPlugins",i);if(u){const f=u();s.push(...f)}return s})}get attributes(){return Zc(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=hr(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:be(t.name,this.schema)},s=$(t,"addNodeView",i);if(!s)return[];const o=(l,a,c,d,u)=>{const f=ti(l,r);return s()({node:l,view:a,getPos:c,decorations:d,innerDecorations:u,editor:n,extension:t,HTMLAttributes:f})};return[t.name,o]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=hr(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addMarkView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Mt(t.name,this.schema)},s=$(t,"addMarkView",i);if(!s)return[];const o=(l,a,c)=>{const d=ti(l,r);return s()({mark:l,view:a,inline:c,editor:n,extension:t,HTMLAttributes:d,updateAttributes:u=>{vy(l,n,u)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:bo(e.name,this.schema)};e.type==="mark"&&((t=ee($(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=$(e,"onBeforeCreate",r),s=$(e,"onCreate",r),o=$(e,"onUpdate",r),l=$(e,"onSelectionUpdate",r),a=$(e,"onTransaction",r),c=$(e,"onFocus",r),d=$(e,"onBlur",r),u=$(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};di.resolve=nd,di.sort=ho,di.flatten=uo;var hg={};Gc(hg,{ClipboardTextSerializer:()=>gd,Commands:()=>Sd,Delete:()=>Cd,Drop:()=>Ed,Editable:()=>Md,FocusEvents:()=>Td,Keymap:()=>Od,Paste:()=>Nd,Tabindex:()=>Ad,focusEventsPluginKey:()=>vd});var de=class Pf extends xo{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Pf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},gd=de.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new se({key:new le("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$to.pos)),a=po(t);return rd(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),yd={};Gc(yd,{blur:()=>pg,clearContent:()=>mg,clearNodes:()=>gg,command:()=>yg,createParagraphNear:()=>bg,cut:()=>wg,deleteCurrentNode:()=>kg,deleteNode:()=>xg,deleteRange:()=>Sg,deleteSelection:()=>Cg,enter:()=>Eg,exitCode:()=>Mg,extendMarkRange:()=>vg,first:()=>Tg,focus:()=>Og,forEach:()=>Ng,insertContent:()=>Ag,insertContentAt:()=>Rg,joinBackward:()=>Lg,joinDown:()=>Pg,joinForward:()=>Bg,joinItemBackward:()=>_g,joinItemForward:()=>Vg,joinTextblockBackward:()=>$g,joinTextblockForward:()=>zg,joinUp:()=>Ig,keyboardShortcut:()=>Fg,lift:()=>jg,liftEmptyBlock:()=>Ug,liftListItem:()=>Wg,newlineInCode:()=>Kg,resetAttributes:()=>qg,scrollIntoView:()=>Jg,selectAll:()=>Gg,selectNodeBackward:()=>Yg,selectNodeForward:()=>Xg,selectParentNode:()=>Qg,selectTextblockEnd:()=>Zg,selectTextblockStart:()=>ey,setContent:()=>ty,setMark:()=>ry,setMeta:()=>iy,setNode:()=>sy,setNodeSelection:()=>oy,setTextSelection:()=>ly,sinkListItem:()=>ay,splitBlock:()=>cy,splitListItem:()=>dy,toggleList:()=>uy,toggleMark:()=>fy,toggleNode:()=>hy,toggleWrap:()=>py,undoInputRule:()=>my,unsetAllMarks:()=>gy,unsetMark:()=>yy,updateAttributes:()=>by,wrapIn:()=>wy,wrapInList:()=>ky});var pg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),mg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),gg=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(a)),f=c.resolve(d.map(a+l.nodeSize)),h=u.blockRange(f);if(!h)return;const p=En(h);if(l.type.isTextblock){const{defaultType:g}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},yg=n=>e=>n(e),bg=()=>({state:n,dispatch:e})=>Uc(n,e),wg=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new F(r.doc.resolve(Math.max(o-1,0)))),!0},kg=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},xg=n=>({tr:e,state:t,dispatch:r})=>{const i=be(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},Sg=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Cg=()=>({state:n,dispatch:e})=>ro(n,e),Eg=()=>({commands:n})=>n.keyboardShortcut("Enter"),Mg=()=>({state:n,dispatch:e})=>Mm(n,e),vg=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=Mt(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:d}=l;if(i){const u=go(a,s,e);if(u&&u.from<=c&&u.to>=d){const f=F.create(o,u.from,u.to);t.setSelection(f)}}return!0},Tg=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function bd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ui(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Og=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(ui()||bd())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!ko(t.state.selection))return o(),!0;const l=pd(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ng=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Ag=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Dg=n=>!("type"in n),Rg=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{fr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=fr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;if((Dg(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),d===u&&h){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,u+=1)}let g;if(f){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof S){let y="";e.forEach(w=>{w.text&&(y+=w.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,u)}else{g=l;const y=r.doc.resolve(d),w=y.node(),k=y.parentOffset===0,C=w.isText||w.isTextblock,D=w.content.size>0;k&&C&&D&&(d=Math.max(0,d-1)),r.replaceWith(d,u,g)}t.updateSelection&&rg(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},Ig=()=>({state:n,dispatch:e})=>Sm(n,e),Pg=()=>({state:n,dispatch:e})=>Cm(n,e),Lg=()=>({state:n,dispatch:e})=>_c(n,e),Bg=()=>({state:n,dispatch:e})=>Hc(n,e),_g=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Vr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Vg=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Vr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},$g=()=>({state:n,dispatch:e})=>km(n,e),zg=()=>({state:n,dispatch:e})=>xm(n,e);function wd(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Hg(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))ui()||wd()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var Fg=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=Hg(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0},jg=(n,e={})=>({state:t,dispatch:r})=>{const i=be(n,t.schema);return Gt(t,i,e)?Em(t,r):!1},Ug=()=>({state:n,dispatch:e})=>Wc(n,e),Wg=n=>({state:e,dispatch:t})=>{const r=be(n,e.schema);return Bm(r)(e,t)},Kg=()=>({state:n,dispatch:e})=>jc(n,e);function kd(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var qg=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=ni(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=be(n,r.schema)),l==="mark"&&(o=Mt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{s&&s===c.type&&t.setNodeMarkup(d,void 0,kd(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&t.addMark(d,d+c.nodeSize,o.create(kd(u.attrs,e)))})})}),!0):!1},Jg=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Gg=()=>({tr:n,dispatch:e})=>{if(e){const t=new We(n.doc);n.setSelection(t)}return!0},Yg=()=>({state:n,dispatch:e})=>$c(n,e),Xg=()=>({state:n,dispatch:e})=>Fc(n,e),Qg=()=>({state:n,dispatch:e})=>Om(n,e),Zg=()=>({state:n,dispatch:e})=>Dm(n,e),ey=()=>({state:n,dispatch:e})=>Am(n,e),ty=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const c=ao(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function ny(n,e,t){var r;const{selection:i}=e;let s=null;if(ko(i)&&(s=i.$cursor),s){const l=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,u,f)=>{if(c)return!1;if(d.isInline){const h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));c=h&&p}return!c}),c})}var ry=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=Mt(n,r.schema);if(i)if(o){const c=sd(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,h)=>{const p=Math.max(h,d),g=Math.min(h+f.nodeSize,u);f.marks.find(w=>w.type===a)?f.marks.forEach(w=>{a===w.type&&t.addMark(p,g,a.create({...w.attrs,...e}))}):t.addMark(p,g,a.create(e))})});return ny(r,t,a)},iy=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),sy=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=be(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>Jc(s,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Jc(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},oy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=vt(n,0,r.content.size),s=B.create(r,i);e.setSelection(s)}return!0},ly=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=F.atStart(r).from,l=F.atEnd(r).to,a=vt(i,o,l),c=vt(s,o,l),d=F.create(r,a,c);e.setSelection(d)}return!0},ay=n=>({state:e,dispatch:t})=>{const r=be(n,e.schema);return $m(r)(e,t)};function xd(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var cy=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,d=ii(c,l.node().type.name,l.node().attrs);if(s instanceof B&&s.node.isBlock)return!l.parentOffset||!kt(o,l.pos)?!1:(r&&(n&&xd(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const u=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:Fm(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=u&&f?[{type:f,attrs:d}]:void 0,p=kt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&kt(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:d}]:void 0),r){if(p&&(s instanceof F&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!u&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&xd(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},dy=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const l=be(n,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==l)return!1;const f=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let w=S.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let V=a.depth-k;V>=a.depth-3;V-=1)w=S.from(a.node(V).copy(w));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,D={...ii(f,a.node().type.name,a.node().attrs),...e},M=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(D))||void 0;w=w.append(S.from(l.createAndFill(null,M)||void 0));const P=a.before(a.depth-(k-1));t.replace(P,a.after(-C),new N(w,4-k,0));let T=-1;t.doc.nodesBetween(P,t.doc.content.size,(V,K)=>{if(T>-1)return!1;V.isTextblock&&V.content.size===0&&(T=K+1)}),T>-1&&t.setSelection(F.near(t.doc.resolve(T))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,p={...ii(f,u.type.name,u.attrs),...e},g={...ii(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const y=h?[{type:l,attrs:p},{type:h,attrs:g}]:[{type:l,attrs:p}];if(!kt(t.doc,a.pos,2))return!1;if(i){const{selection:w,storedMarks:k}=r,{splittableMarks:C}=s.extensionManager,D=k||w.$to.parentOffset&&w.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!D||!i)return!0;const M=D.filter(P=>C.includes(P.type.name));t.ensureMarks(M)}return!0},So=(n,e)=>{const t=ei(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&$t(n.doc,t.pos)&&n.join(t.pos),!0},Co=(n,e)=>{const t=ei(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&$t(n.doc,r)&&n.join(r),!0},uy=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:u,splittableMarks:f}=i.extensionManager,h=be(n,o.schema),p=be(e,o.schema),{selection:g,storedMarks:y}=o,{$from:w,$to:k}=g,C=w.blockRange(k),D=y||g.$to.parentOffset&&g.$from.marks();if(!C)return!1;const M=ei(P=>ud(P.type.name,u))(g);if(C.depth>=1&&M&&C.depth-M.depth<=1){if(M.node.type===h)return c.liftListItem(p);if(ud(M.node.type.name,u)&&h.validContent(M.node.content)&&l)return a().command(()=>(s.setNodeMarkup(M.pos,h),!0)).command(()=>So(s,h)).command(()=>Co(s,h)).run()}return!t||!D||!l?a().command(()=>d().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>So(s,h)).command(()=>Co(s,h)).run():a().command(()=>{const P=d().wrapInList(h,r),T=D.filter(V=>f.includes(V.type.name));return s.ensureMarks(T),P?!0:c.clearNodes()}).wrapInList(h,r).command(()=>So(s,h)).command(()=>Co(s,h)).run()},fy=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Mt(n,r.schema);return wo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},hy=(n,e,t={})=>({state:r,commands:i})=>{const s=be(n,r.schema),o=be(e,r.schema),l=Gt(r,s,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...t})},py=(n,e={})=>({state:t,commands:r})=>{const i=be(n,t.schema);return Gt(t,i,e)?r.lift(i):r.wrapIn(i,e)},my=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},gy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},yy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=Mt(n,r.schema),{$from:c,empty:d,ranges:u}=l;if(!i)return!0;if(d&&o){let{from:f,to:h}=l;const p=(s=c.marks().find(y=>y.type===a))==null?void 0:s.attrs,g=go(c,a,p);g&&(f=g.from,h=g.to),t.removeMark(f,h,a)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},by=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const l=ni(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=be(n,r.schema)),l==="mark"&&(o=Mt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;let u,f,h,p;t.selection.empty?r.doc.nodesBetween(c,d,(g,y)=>{s&&s===g.type&&(h=Math.max(y,c),p=Math.min(y+g.nodeSize,d),u=y,f=g)}):r.doc.nodesBetween(c,d,(g,y)=>{y<c&&s&&s===g.type&&(h=Math.max(y,c),p=Math.min(y+g.nodeSize,d),u=y,f=g),y>=c&&y<=d&&(s&&s===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(w=>{if(o===w.type){const k=Math.max(y,c),C=Math.min(y+g.nodeSize,d);t.addMark(k,C,o.create({...w.attrs,...e}))}}))}),f&&(u!==void 0&&t.setNodeMarkup(u,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&t.addMark(h,p,o.create({...g.attrs,...e}))}))}),!0):!1},wy=(n,e={})=>({state:t,dispatch:r})=>{const i=be(n,t.schema);return Rm(i,e)(t,r)},ky=(n,e={})=>({state:t,dispatch:r})=>{const i=be(n,t.schema);return Im(i,e)(t,r)},Sd=de.create({name:"commands",addCommands(){return{...yd}}}),Cd=de.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?c:n.getMeta("y-sync$"))return;const d=Yc(n.before,[n,...e]);ld(d).forEach(h=>{d.mapping.mapResult(h.oldRange.from).deletedAfter&&d.mapping.mapResult(h.oldRange.to).deletedBefore&&d.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const y=g+p.nodeSize-2,w=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!w,editor:this.editor,transaction:n,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((h,p)=>{var g,y;if(h instanceof tt){const w=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),C=f.invert().map(w,-1),D=f.invert().map(k),M=(g=d.doc.nodeAt(w-1))==null?void 0:g.marks.some(T=>T.eq(h.mark)),P=(y=d.doc.nodeAt(k))==null?void 0:y.marks.some(T=>T.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:C,to:D},newRange:{from:w,to:k},partial:!!(P||M),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Ed=de.create({name:"drop",addProseMirrorPlugins(){return[new se({key:new le("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Md=de.create({name:"editable",addProseMirrorPlugins(){return[new se({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vd=new le("focusEvents"),Td=de.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new se({key:vd,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Od=de.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:f,parent:h}=u,p=u.parent.isTextblock&&f>0?l.doc.resolve(f-1):u,g=p.parent.type.spec.isolating,y=u.pos-u.parentOffset,w=g&&p.parent.childCount===1?y===u.pos:H.atStart(c).from===f;return!d||!h.type.isTextblock||h.textContent.length||!w||w&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ui()||wd()?s:i},addProseMirrorPlugins(){return[new se({key:new le("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),i=n.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=H.atStart(e.doc).from,c=H.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!si(t.doc))return;const f=t.tr,h=Xr({state:t,transaction:f}),{commands:p}=new Qr({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Nd=de.create({name:"paste",addProseMirrorPlugins(){return[new se({key:new le("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Ad=de.create({name:"tabindex",addProseMirrorPlugins(){return[new se({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),xy=class Kn{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Kn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Kn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;const a=new Kn(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Kn(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==t[a])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Sy=`.ProseMirror {
14
+ position: relative;
15
+ }
100
16
 
101
- `)),e.collapse(!1),re(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&!o.previousElementSibling&&e.toString()===""&&(0,M.im)(o,t[t.currentMode].element,e).start===0)return o.nextElementSibling?(o.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(o.innerHTML,"</p>")),o.remove()):o.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(o.innerHTML,"</p>"),(0,M.ib)(t[t.currentMode].element,e),re(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.shiftKey&&!r.altKey&&r.key==="Backspace"&&o.textContent.trim().replace(w.g.ZWSP,"")===""&&e.toString()===""&&((i=o.previousElementSibling)===null||i===void 0?void 0:i.tagName)==="LI")return o.previousElementSibling.insertAdjacentText("beforeend",`
17
+ .ProseMirror {
18
+ word-wrap: break-word;
19
+ white-space: pre-wrap;
20
+ white-space: break-spaces;
21
+ -webkit-font-variant-ligatures: none;
22
+ font-variant-ligatures: none;
23
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
24
+ }
102
25
 
103
- `),e.selectNodeContents(o.previousElementSibling),e.collapse(!1),o.remove(),(0,M.ib)(t[t.currentMode].element,e),re(t),r.preventDefault(),!0;if(!(0,l.yl)(r)&&!r.altKey&&r.key==="Tab"){var u=!1;if((e.startOffset===0&&(a.nodeType===3&&!a.previousSibling||a.nodeType!==3&&a.nodeName==="LI")||o.classList.contains("vditor-task")&&e.startOffset===1&&a.previousSibling.nodeType!==3&&a.previousSibling.tagName==="INPUT")&&(u=!0),u||e.toString()!=="")return r.shiftKey?qt(t,o,e,o.parentElement):Sn(t,o,e),r.preventDefault(),!0}}return!1},Gt=function(e,t,n){if(e.options.tab&&n.key==="Tab")return n.shiftKey||(t.toString()===""?(t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1)):(t.extractContents(),t.insertNode(document.createTextNode(e.options.tab)),t.collapse(!1))),(0,M.Hc)(t),re(e),n.preventDefault(),!0},Cn=function(e,t,n,r){if(n){if(!(0,l.yl)(e)&&!e.altKey&&e.key==="Enter"){var i=String.raw(In||(In=gi(["",""],["",""])),n.textContent).replace(/\\\|/g,"").trim(),a=i.split("|");if(i.startsWith("|")&&i.endsWith("|")&&a.length>3){var o=a.map(function(){return"---"}).join("|");return o=n.textContent+`
104
- `+o.substring(3,o.length-3)+`
105
- |<wbr>`,n.outerHTML=t.lute.SpinVditorDOM(o),(0,M.ib)(t[t.currentMode].element,r),re(t),Se(t),e.preventDefault(),!0}if(Kt(n.innerHTML)&&n.previousElementSibling){var u="",m=n.innerHTML.trimRight().split(`
106
- `);return m.length>1&&(m.pop(),u='<p data-block="0">'.concat(m.join(`
107
- `),"</p>")),n.insertAdjacentHTML("afterend","".concat(u,`<hr data-block="0"><p data-block="0"><wbr>
108
- </p>`)),n.remove(),(0,M.ib)(t[t.currentMode].element,r),re(t),Se(t),e.preventDefault(),!0}if(zt(n.innerHTML))return t.currentMode==="wysiwyg"?n.outerHTML=t.lute.SpinVditorDOM(n.innerHTML+`<p data-block="0"><wbr>
109
- </p>`):n.outerHTML=t.lute.SpinVditorIRDOM(n.innerHTML+`<p data-block="0"><wbr>
110
- </p>`),(0,M.ib)(t[t.currentMode].element,r),re(t),Se(t),e.preventDefault(),!0}if(r.collapsed&&n.previousElementSibling&&e.key==="Backspace"&&!(0,l.yl)(e)&&!e.altKey&&!e.shiftKey&&n.textContent.trimRight().split(`
111
- `).length>1&&(0,M.im)(n,t[t.currentMode].element,r).start===0){var f=(0,s.DX)(n.previousElementSibling);return f.textContent.endsWith(`
112
- `)||(f.textContent=f.textContent+`
113
- `),f.parentElement.insertAdjacentHTML("beforeend","<wbr>".concat(n.innerHTML)),n.remove(),(0,M.ib)(t[t.currentMode].element,r),!1}return!1}},_n=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)r+='<td align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </td>');n.tagName==="TH"?n.parentElement.parentElement.insertAdjacentHTML("afterend","<tbody><tr>".concat(r,"</tr></tbody>")):n.parentElement.insertAdjacentHTML("afterend","<tr>".concat(r,"</tr>")),re(e)},Ln=function(e,t,n){for(var r="",i=0;i<n.parentElement.childElementCount;i++)n.tagName==="TH"?r+='<th align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </th>'):r+='<td align="'.concat(n.parentElement.children[i].getAttribute("align"),'"> </td>');if(n.tagName==="TH"){n.parentElement.parentElement.insertAdjacentHTML("beforebegin","<thead><tr>".concat(r,"</tr></thead>")),t.insertNode(document.createElement("wbr"));var a=n.parentElement.innerHTML.replace(/<th>/g,"<td>").replace(/<\/th>/g,"</td>");n.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin",a),n.parentElement.parentElement.remove(),(0,M.ib)(e.ir.element,t)}else n.parentElement.insertAdjacentHTML("beforebegin","<tr>".concat(r,"</tr>"));re(e)},Mt=function(e,t,n,r){r===void 0&&(r="afterend");for(var i=0,a=n.previousElementSibling;a;)i++,a=a.previousElementSibling;for(var o=0;o<t.rows.length;o++)o===0?t.rows[o].cells[i].insertAdjacentHTML(r,"<th> </th>"):t.rows[o].cells[i].insertAdjacentHTML(r,"<td> </td>");re(e)},Mn=function(e,t,n){if(n.tagName==="TD"){var r=n.parentElement.parentElement;n.parentElement.previousElementSibling?t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild):t.selectNodeContents(r.previousElementSibling.lastElementChild.lastElementChild),r.childElementCount===1?r.remove():n.parentElement.remove(),t.collapse(!1),(0,M.Hc)(t),re(e)}},Tn=function(e,t,n,r){for(var i=0,a=r.previousElementSibling;a;)i++,a=a.previousElementSibling;(r.previousElementSibling||r.nextElementSibling)&&(t.selectNodeContents(r.previousElementSibling||r.nextElementSibling),t.collapse(!0));for(var o=0;o<n.rows.length;o++){var u=n.rows[o].cells;if(u.length===1){n.remove(),nt(e);break}u[i].remove()}(0,M.Hc)(t),re(e)},An=function(e,t,n){var r=n.startContainer,i=(0,s.lG)(r,"TD")||(0,s.lG)(r,"TH");if(i){if(!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"){(!i.lastElementChild||i.lastElementChild&&(!i.lastElementChild.isSameNode(i.lastChild)||i.lastElementChild.tagName!=="BR"))&&i.insertAdjacentHTML("beforeend","<br>");var a=document.createElement("br");return n.insertNode(a),n.setStartAfter(a),re(e),Se(e),t.preventDefault(),!0}if(t.key==="Tab"){if(t.shiftKey)return En(i,n),t.preventDefault(),!0;var o=i.nextElementSibling;return o||(i.parentElement.nextElementSibling?o=i.parentElement.nextElementSibling.firstElementChild:i.parentElement.parentElement.tagName==="THEAD"&&i.parentElement.parentElement.nextElementSibling?o=i.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild:o=null),o&&(n.selectNodeContents(o),(0,M.Hc)(n)),t.preventDefault(),!0}var u=i.parentElement.parentElement.parentElement;if(t.key==="ArrowUp"){if(t.preventDefault(),i.tagName==="TH")return u.previousElementSibling?(n.selectNodeContents(u.previousElementSibling),n.collapse(!1),(0,M.Hc)(n)):dt(e,"beforebegin"),!0;for(var m=0,f=i.parentElement;m<f.cells.length&&!f.cells[m].isSameNode(i);m++);var S=f.previousElementSibling;return S||(S=f.parentElement.previousElementSibling.firstChild),n.selectNodeContents(S.cells[m]),n.collapse(!1),(0,M.Hc)(n),!0}if(t.key==="ArrowDown"){t.preventDefault();var f=i.parentElement;if(!f.nextElementSibling&&i.tagName==="TD")return u.nextElementSibling?(n.selectNodeContents(u.nextElementSibling),n.collapse(!0),(0,M.Hc)(n)):dt(e,"afterend"),!0;for(var m=0;m<f.cells.length&&!f.cells[m].isSameNode(i);m++);var o=f.nextElementSibling;return o||(o=f.parentElement.nextElementSibling.firstChild),n.selectNodeContents(o.cells[m]),n.collapse(!0),(0,M.Hc)(n),!0}if(e.currentMode==="wysiwyg"&&!(0,l.yl)(t)&&t.key==="Enter"&&!t.shiftKey&&t.altKey){var T=e.wysiwyg.popover.querySelector(".vditor-input");return T.focus(),T.select(),t.preventDefault(),!0}if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Backspace"&&n.startOffset===0&&n.toString()===""){var R=En(i,n,!1);return!R&&u&&(u.textContent.trim()===""?(u.outerHTML=`<p data-block="0"><wbr>
114
- </p>`,(0,M.ib)(e[e.currentMode].element,n)):(n.setStartBefore(u),n.collapse(!0)),re(e)),t.preventDefault(),!0}if(j("⇧⌘F",t))return Ln(e,n,i),t.preventDefault(),!0;if(j("⌘=",t))return _n(e,n,i),t.preventDefault(),!0;if(j("⇧⌘G",t))return Mt(e,u,i,"beforebegin"),t.preventDefault(),!0;if(j("⇧⌘=",t))return Mt(e,u,i),t.preventDefault(),!0;if(j("⌘-",t))return Mn(e,n,i),t.preventDefault(),!0;if(j("⇧⌘-",t))return Tn(e,n,u,i),t.preventDefault(),!0;if(j("⇧⌘L",t)){if(e.currentMode==="ir")return Lt(u,"left"),re(e),t.preventDefault(),!0;var P=e.wysiwyg.popover.querySelector('[data-type="left"]');if(P)return P.click(),t.preventDefault(),!0}if(j("⇧⌘C",t)){if(e.currentMode==="ir")return Lt(u,"center"),re(e),t.preventDefault(),!0;var P=e.wysiwyg.popover.querySelector('[data-type="center"]');if(P)return P.click(),t.preventDefault(),!0}if(j("⇧⌘R",t)){if(e.currentMode==="ir")return Lt(u,"right"),re(e),t.preventDefault(),!0;var P=e.wysiwyg.popover.querySelector('[data-type="right"]');if(P)return P.click(),t.preventDefault(),!0}}return!1},xn=function(e,t,n,r){if(n.tagName==="PRE"&&j("⌘A",t))return r.selectNodeContents(n.firstElementChild),t.preventDefault(),!0;if(e.options.tab&&t.key==="Tab"&&!t.shiftKey&&r.toString()==="")return r.insertNode(document.createTextNode(e.options.tab)),r.collapse(!1),re(e),t.preventDefault(),!0;if(t.key==="Backspace"&&!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey){var i=(0,M.im)(n,e[e.currentMode].element,r);if((i.start===0||i.start===1&&n.innerText===`
115
- `)&&r.toString()==="")return n.parentElement.outerHTML='<p data-block="0"><wbr>'.concat(n.firstElementChild.innerHTML,"</p>"),(0,M.ib)(e[e.currentMode].element,r),re(e),t.preventDefault(),!0}return!(0,l.yl)(t)&&!t.altKey&&t.key==="Enter"?(n.firstElementChild.textContent.endsWith(`
116
- `)||n.firstElementChild.insertAdjacentText("beforeend",`
117
- `),r.extractContents(),r.insertNode(document.createTextNode(`
118
- `)),r.collapse(!1),(0,M.Hc)(r),(0,l.vU)()||(e.currentMode==="wysiwyg"?Ct(e,r):$e(e,r)),Se(e),t.preventDefault(),!0):!1},Dn=function(e,t,n,r){var i=t.startContainer,a=(0,s.lG)(i,"BLOCKQUOTE");if(a&&t.toString()===""){if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&(0,M.im)(a,e[e.currentMode].element,t).start===0)return t.insertNode(document.createElement("wbr")),a.outerHTML=a.innerHTML,(0,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0;if(r&&n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&r.parentElement.tagName==="BLOCKQUOTE"){var o=!1;if(r.innerHTML.replace(w.g.ZWSP,"")===`
119
- `||r.innerHTML.replace(w.g.ZWSP,"")===""?(o=!0,r.remove()):r.innerHTML.endsWith(`
26
+ .ProseMirror [contenteditable="false"] {
27
+ white-space: normal;
28
+ }
120
29
 
121
- `)&&(0,M.im)(r,e[e.currentMode].element,t).start===r.textContent.length-1&&(r.innerHTML=r.innerHTML.substr(0,r.innerHTML.length-2),o=!0),o)return a.insertAdjacentHTML("afterend",'<p data-block="0">'.concat(w.g.ZWSP,`<wbr>
122
- </p>`)),(0,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0}var u=(0,s.F9)(i);if(e.currentMode==="wysiwyg"&&u&&j("⇧⌘;",n))return t.insertNode(document.createElement("wbr")),u.outerHTML='<blockquote data-block="0">'.concat(u.outerHTML,"</blockquote>"),(0,M.ib)(e.wysiwyg.element,t),pe(e),n.preventDefault(),!0;if(pt(e,n,t,a,a)||rt(e,n,t,a,a))return!0}return!1},Hn=function(e,t,n){var r=t.startContainer,i=(0,s.lG)(r,"LI");if(i&&i.classList.contains("vditor-task")){if(j("⇧⌘J",n)){var a=i.firstElementChild;return a.checked?a.removeAttribute("checked"):a.setAttribute("checked","checked"),re(e),n.preventDefault(),!0}if(n.key==="Backspace"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey&&t.toString()===""&&t.startOffset===1&&(r.nodeType===3&&r.previousSibling&&r.previousSibling.tagName==="INPUT"||r.nodeType!==3)){var o=i.previousElementSibling;if(i.querySelector("input").remove(),o){var u=(0,s.DX)(o);u.parentElement.insertAdjacentHTML("beforeend","<wbr>"+i.innerHTML.trim()),i.remove()}else i.parentElement.insertAdjacentHTML("beforebegin",'<p data-block="0"><wbr>'.concat(i.innerHTML.trim()||`
123
- `,"</p>")),i.nextElementSibling?i.remove():i.parentElement.remove();return(0,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0}if(n.key==="Enter"&&!(0,l.yl)(n)&&!n.shiftKey&&!n.altKey){if(i.textContent.trim()==="")if((0,s.fb)(i.parentElement,"vditor-task")){var m=(0,s.O9)(r);m&&qt(e,i,t,m)}else if(i.nextElementSibling){var f="",S="",T=!1;Array.from(i.parentElement.children).forEach(function(W){i.isSameNode(W)?T=!0:T?f+=W.outerHTML:S+=W.outerHTML});var R=i.parentElement.tagName,P=i.parentElement.tagName==="OL"?"":' data-marker="'.concat(i.parentElement.getAttribute("data-marker"),'"'),O="";S&&(O=i.parentElement.tagName==="UL"?"":' start="1"',S="<".concat(R,' data-tight="true"').concat(P,' data-block="0">').concat(S,"</").concat(R,">")),i.parentElement.outerHTML="".concat(S,`<p data-block="0"><wbr>
124
- </p><`).concat(R,`
125
- data-tight="true"`).concat(P,' data-block="0"').concat(O,">").concat(f,"</").concat(R,">")}else i.parentElement.insertAdjacentHTML("afterend",`<p data-block="0"><wbr>
126
- </p>`),i.parentElement.querySelectorAll("li").length===1?i.parentElement.remove():i.remove();else r.nodeType!==3&&t.startOffset===0&&r.firstChild.tagName==="INPUT"?t.setStart(r.childNodes[1],1):(t.setEndAfter(i.lastChild),i.insertAdjacentHTML("afterend",'<li class="vditor-task" data-marker="'.concat(i.getAttribute("data-marker"),'"><input type="checkbox"> <wbr></li>')),document.querySelector("wbr").after(t.extractContents()));return(0,M.ib)(e[e.currentMode].element,t),re(e),Se(e),n.preventDefault(),!0}}return!1},On=function(e,t,n,r){if(t.startContainer.nodeType!==3){var i=t.startContainer.children[t.startOffset];if(i&&i.tagName==="HR")return t.selectNodeContents(i.previousElementSibling),t.collapse(!1),n.preventDefault(),!0}if(r){var a=r.previousElementSibling;if(a&&(0,M.im)(r,e[e.currentMode].element,t).start===0&&((0,l.vU)()&&a.tagName==="HR"||a.tagName==="TABLE")){if(a.tagName==="TABLE"){var o=a.lastElementChild.lastElementChild.lastElementChild;o.innerHTML=o.innerHTML.trimLeft()+"<wbr>"+r.textContent.trim(),r.remove()}else a.remove();return(0,M.ib)(e[e.currentMode].element,t),re(e),n.preventDefault(),!0}}return!1},Nn=function(e){(0,l.vU)()&&e.startContainer.nodeType!==3&&e.startContainer.tagName==="HR"&&e.setStartBefore(e.startContainer)},Rn=function(e,t,n){var r,i;if(!(0,l.vU)())return!1;if(e.key==="ArrowUp"&&t&&((r=t.previousElementSibling)===null||r===void 0?void 0:r.tagName)==="TABLE"){var a=t.previousElementSibling;return n.selectNodeContents(a.rows[a.rows.length-1].lastElementChild),n.collapse(!1),e.preventDefault(),!0}return e.key==="ArrowDown"&&t&&((i=t.nextElementSibling)===null||i===void 0?void 0:i.tagName)==="TABLE"?(n.selectNodeContents(t.nextElementSibling.rows[0].cells[0]),n.collapse(!0),e.preventDefault(),!0):!1},Tt=function(e,t,n){return gn(void 0,void 0,void 0,function(){var r,i,a,o,u,m,f,S,T,R,P,O,W,N,U,N,J;return yn(this,function(F){switch(F.label){case 0:return e[e.currentMode].element.getAttribute("contenteditable")!=="true"?[2]:(t.stopPropagation(),t.preventDefault(),"clipboardData"in t?(r=t.clipboardData.getData("text/html"),i=t.clipboardData.getData("text/plain"),a=t.clipboardData.files):(r=t.dataTransfer.getData("text/html"),i=t.dataTransfer.getData("text/plain"),t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items)),o={},u=function(Y,fe){if(!fe)return["",Lute.WalkContinue];if(e.options.upload.renderLinkDest)return e.options.upload.renderLinkDest(e,Y,fe);var ce=Y.TokensStr();if(Y.__internal_object__.Parent.Type===34&&ce&&ce.indexOf("file://")===-1&&e.options.upload.linkToImgUrl){var he=new XMLHttpRequest;he.open("POST",e.options.upload.linkToImgUrl),e.options.upload.token&&he.setRequestHeader("X-Upload-Token",e.options.upload.token),e.options.upload.withCredentials&&(he.withCredentials=!0),mn(e,he),he.setRequestHeader("Content-Type","application/json; charset=utf-8"),he.onreadystatechange=function(){if(he.readyState===XMLHttpRequest.DONE){if(he.status===200){var Oe=he.responseText;e.options.upload.linkToImgFormat&&(Oe=e.options.upload.linkToImgFormat(he.responseText));var xe=JSON.parse(Oe);if(xe.code!==0){e.tip.show(xe.msg);return}var Ne=xe.data.originalURL;if(e.currentMode==="sv")e.sv.element.querySelectorAll(".vditor-sv__marker--link").forEach(function(ke){ke.textContent===Ne&&(ke.textContent=xe.data.url)});else{var te=e[e.currentMode].element.querySelector('img[src="'.concat(Ne,'"]'));te.src=xe.data.url,e.currentMode==="ir"&&(te.previousElementSibling.previousElementSibling.innerHTML=xe.data.url)}re(e)}else e.tip.show(he.responseText);e.options.upload.linkToImgCallback&&e.options.upload.linkToImgCallback(he.responseText)}},he.send(JSON.stringify({url:ce}))}return e.currentMode==="ir"?['<span class="vditor-ir__marker vditor-ir__marker--link">'.concat(Lute.EscapeHTMLStr(ce),"</span>"),Lute.WalkContinue]:e.currentMode==="wysiwyg"?["",Lute.WalkContinue]:['<span class="vditor-sv__marker--link">'.concat(Lute.EscapeHTMLStr(ce),"</span>"),Lute.WalkContinue]},(r.replace(/&amp;/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<a href="'.concat(i,'">').concat(i,"</a>")||r.replace(/&amp;/g,"&").replace(/<(|\/)(html|body|meta)[^>]*?>/ig,"").trim()==='<!--StartFragment--><a href="'.concat(i,'">').concat(i,"</a><!--EndFragment-->"))&&(r=""),m=new DOMParser().parseFromString(r,"text/html"),m.body&&(r=m.body.innerHTML),r=Lute.Sanitize(r),e.wysiwyg.getComments(e),f=e[e.currentMode].element.scrollHeight,S=De(r,i,e.currentMode),T=e.currentMode==="sv"?(0,s.a1)(t.target,"data-type","code-block"):(0,s.lG)(t.target,"CODE"),T?(e.currentMode==="sv"?document.execCommand("insertHTML",!1,i.replace(/&/g,"&amp;").replace(/</g,"&lt;")):(R=(0,M.im)(t.target,e[e.currentMode].element),T.parentElement.tagName!=="PRE"&&(i+=w.g.ZWSP),T.textContent=T.textContent.substring(0,R.start)+i+T.textContent.substring(R.end),(0,M.$j)(R.start+i.length,R.start+i.length,T.parentElement),!((J=T.parentElement)===null||J===void 0)&&J.nextElementSibling.classList.contains("vditor-".concat(e.currentMode,"__preview"))&&(T.parentElement.nextElementSibling.innerHTML=T.outerHTML,_e(T.parentElement.nextElementSibling,e))),[3,10]):[3,1]);case 1:return S?(n.pasteCode(S),[3,10]):[3,2];case 2:return r.trim()===""?[3,5]:(P=document.createElement("div"),P.innerHTML=r,e.options.upload.base64ToLink?[3,4]:[4,wi(e,P,("clipboardData"in t?t.clipboardData:t.dataTransfer).getData("text/rtf"))]);case 3:F.sent(),F.label=4;case 4:return P.querySelectorAll("[style]").forEach(function(Y){Y.removeAttribute("style")}),P.querySelectorAll(".vditor-copy").forEach(function(Y){Y.remove()}),e.currentMode==="ir"?(o.HTML2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(e.lute.HTML2VditorIRDOM(P.innerHTML),e)):e.currentMode==="wysiwyg"?(o.HTML2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(e.lute.HTML2VditorDOM(P.innerHTML),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),Wt(e,e.lute.HTML2Md(P.innerHTML).trimRight())),e.outline.render(e),[3,10];case 5:return a.length>0?e.options.upload.url||e.options.upload.handler?[4,Ft(e,a)]:[3,7]:[3,9];case 6:return F.sent(),[3,8];case 7:O=new FileReader,"clipboardData"in t?(a=t.clipboardData.files,W=a[0]):t.dataTransfer.types.includes("Files")&&(a=t.dataTransfer.items,W=a[0].getAsFile()),W&&W.type.startsWith("image")&&(O.readAsDataURL(W),O.onload=function(){var Y="";e.currentMode==="wysiwyg"?Y+='<img alt="'.concat(W.name,'" src="').concat(O.result.toString(),`">
127
- `):Y+="![".concat(W.name,"](").concat(O.result.toString(),`)
128
- `),document.execCommand("insertHTML",!1,Y)}),F.label=8;case 8:return[3,10];case 9:i.trim()!==""&&a.length===0&&(N=(0,M.zh)(e),N.toString()!==""&&e.lute.IsValidLinkDest(i)&&(i="[".concat(N.toString(),"](").concat(i,")")),e.currentMode==="ir"?(o.Md2VditorIRDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(Lute.Sanitize(e.lute.Md2VditorIRDOM(i)),e)):e.currentMode==="wysiwyg"?(o.Md2VditorDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),(0,M.oC)(Lute.Sanitize(e.lute.Md2VditorDOM(i)),e)):(o.Md2VditorSVDOM={renderLinkDest:u},e.lute.SetJSRenderers({renderers:o}),Wt(e,i)),e.outline.render(e)),F.label=10;case 10:return e.currentMode!=="sv"&&(U=(0,s.F9)((0,M.zh)(e).startContainer),U&&(N=(0,M.zh)(e),e[e.currentMode].element.querySelectorAll("wbr").forEach(function(Y){Y.remove()}),N.insertNode(document.createElement("wbr")),e.currentMode==="wysiwyg"?U.outerHTML=e.lute.SpinVditorDOM(U.outerHTML):U.outerHTML=e.lute.SpinVditorIRDOM(U.outerHTML),(0,M.ib)(e[e.currentMode].element,N)),e[e.currentMode].element.querySelectorAll(".vditor-".concat(e.currentMode,"__preview[data-render='2']")).forEach(function(Y){_e(Y,e)})),e.wysiwyg.triggerRemoveComment(e),re(e),e[e.currentMode].element.scrollHeight-f>Math.min(e[e.currentMode].element.clientHeight,window.innerHeight)/2&&Se(e),[2]}})})},wi=function(e,t,n){return gn(void 0,void 0,void 0,function(){var r,i,a,o,u,m,f,S,T,W,R,P,O,W,U,N;return yn(this,function(J){switch(J.label){case 0:if(!n)return[2];if(r=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+r.source+"))([\\da-fA-F\\s]+)\\}","g"),a=n.match(i),o=[],a)for(u=0,m=a;u<m.length;u++)f=m[u],S=void 0,f.includes("\\pngblip")?S="image/png":f.includes("\\jpegblip")&&(S="image/jpeg"),S&&o.push({hex:f.replace(r,"").replace(/[^\da-fA-F]/g,""),type:S});for(T=[],$t(t,function(F){if(F.tagName==="V:SHAPE")return $t(F,function(Y){Y.tagName==="V:IMAGEDATA"&&T.push({shape:F,img:Y})}),!1}),W=0;W<T.length;W++)R=document.createElement("img"),P="data:"+o[W].type+";base64,"+btoa((o[W].hex.match(/\w{2}/g)||[]).map(function(F){return String.fromCharCode(parseInt(F,16))}).join("")),R.src=P,R.title=T[W].img.getAttribute("title"),T[W].shape.parentNode.replaceChild(R,T[W].shape);O=t.querySelectorAll("img"),W=0,J.label=1;case 1:return W<O.length?(U=O[W].src||"",U?(N=O[W],[4,e.options.upload.base64ToLink(U)]):[3,3]):[3,4];case 2:N.src=J.sent(),J.label=3;case 3:return W++,[3,1];case 4:return[2]}})})},$t=function(e,t){var n=t(e);if(n!==!1)for(var r=0;r<e.children.length;r++)$t(e.children[r],t)},In,Pn=function(e){var t,n;e.hint.render(e);var r=(0,M.zh)(e).startContainer,i=(0,s.a1)(r,"data-type","code-block-info");if(i)if(i.textContent.replace(w.g.ZWSP,"")===""&&e.hint.recentLanguage){i.textContent=w.g.ZWSP+e.hint.recentLanguage;var a=(0,M.zh)(e);a.selectNodeContents(i)}else{var o=[],u=i.textContent.substring(0,(0,M.im)(i,e.ir.element).start).replace(w.g.ZWSP,"");(e.options.preview.hljs.langs||w.g.ALIAS_CODE_LANGUAGES.concat(((n=(t=window.hljs)===null||t===void 0?void 0:t.listLanguages())!==null&&n!==void 0?n:[]).sort())).forEach(function(m){m.indexOf(u.toLowerCase())>-1&&o.push({html:m,value:m})}),e.hint.genHTML(o,u,e)}},ze=function(e,t){t===void 0&&(t={enableAddUndoStack:!0,enableHint:!1,enableInput:!0}),t.enableHint&&Pn(e),clearTimeout(e.ir.processTimeoutId),e.ir.processTimeoutId=window.setTimeout(function(){if(!e.ir.composingLock){var n=D(e);typeof e.options.input=="function"&&t.enableInput&&e.options.input(n),e.options.counter.enable&&e.counter.render(e,n),e.options.cache.enable&&(0,l.pK)()&&(localStorage.setItem(e.options.cache.id,n),e.options.cache.after&&e.options.cache.after(n)),e.devtools&&e.devtools.renderEchart(e),t.enableAddUndoStack&&e.undo.addToUndoStack(e)}},e.options.undoDelay)},ht=function(e,t){var n=(0,M.zh)(e),r=(0,s.F9)(n.startContainer)||n.startContainer;if(r){var i=r.querySelector(".vditor-ir__marker--heading");i?i.innerHTML=t:(r.insertAdjacentText("afterbegin",t),n.selectNodeContents(r),n.collapse(!1)),$e(e,n.cloneRange()),lt(e)}},At=function(e,t,n){var r=(0,s.a1)(e.startContainer,"data-type",n);if(r){r.firstElementChild.remove(),r.lastElementChild.remove(),e.insertNode(document.createElement("wbr"));var i=document.createElement("div");i.innerHTML=t.lute.SpinVditorIRDOM(r.outerHTML),r.outerHTML=i.firstElementChild.innerHTML.trim()}},vi=function(e,t,n,r){var i=(0,M.zh)(e),a=t.getAttribute("data-type"),o=i.startContainer;o.nodeType===3&&(o=o.parentElement);var u=!0;if(t.classList.contains("vditor-menu--current"))if(a==="quote"){var m=(0,s.lG)(o,"BLOCKQUOTE");m&&(i.insertNode(document.createElement("wbr")),m.outerHTML=m.innerHTML.trim()===""?'<p data-block="0">'.concat(m.innerHTML,"</p>"):m.innerHTML)}else if(a==="link"){var f=(0,s.a1)(i.startContainer,"data-type","a");if(f){var S=(0,s.fb)(i.startContainer,"vditor-ir__link");S?(i.insertNode(document.createElement("wbr")),f.outerHTML=S.innerHTML):f.outerHTML=f.querySelector(".vditor-ir__link").innerHTML+"<wbr>"}}else a==="italic"?At(i,e,"em"):a==="bold"?At(i,e,"strong"):a==="strike"?At(i,e,"s"):a==="inline-code"?At(i,e,"code"):(a==="check"||a==="list"||a==="ordered-list")&&(_t(e,i,a),u=!1,t.classList.remove("vditor-menu--current"));else{e.ir.element.childNodes.length===0&&(e.ir.element.innerHTML='<p data-block="0"><wbr></p>',(0,M.ib)(e.ir.element,i));var T=(0,s.F9)(i.startContainer);if(a==="line"){if(T){var R=`<hr data-block="0"><p data-block="0"><wbr>
129
- </p>`;T.innerHTML.trim()===""?T.outerHTML=R:T.insertAdjacentHTML("afterend",R)}}else if(a==="quote")T&&(i.insertNode(document.createElement("wbr")),T.outerHTML='<blockquote data-block="0">'.concat(T.outerHTML,"</blockquote>"),u=!1,t.classList.add("vditor-menu--current"));else if(a==="link"){var P=void 0;i.toString()===""?P="".concat(n,"<wbr>").concat(r):P="".concat(n).concat(i.toString()).concat(r.replace(")","<wbr>)")),document.execCommand("insertHTML",!1,P),u=!1,t.classList.add("vditor-menu--current")}else if(a==="italic"||a==="bold"||a==="strike"||a==="inline-code"||a==="code"||a==="table"){var P=void 0;i.toString()===""?P="".concat(n,"<wbr>").concat(r):(a==="code"?P="".concat(n,`
130
- `).concat(i.toString(),"<wbr>").concat(r):a==="table"?P="".concat(n).concat(i.toString(),"<wbr>").concat(r):P="".concat(n).concat(i.toString()).concat(r,"<wbr>"),i.deleteContents()),(a==="table"||a==="code")&&(P=`
131
- `+P+`
30
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
31
+ white-space: pre-wrap;
32
+ }
132
33
 
133
- `);var O=document.createElement("span");O.innerHTML=P,i.insertNode(O),$e(e,i),a==="table"&&(i.selectNodeContents(getSelection().getRangeAt(0).startContainer.parentElement),(0,M.Hc)(i))}else(a==="check"||a==="list"||a==="ordered-list")&&(_t(e,i,a,!1),u=!1,g(e.toolbar.elements,["check","list","ordered-list"]),t.classList.add("vditor-menu--current"))}(0,M.ib)(e.ir.element,i),ze(e),u&&lt(e)},Ei=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function u(S){try{f(r.next(S))}catch(T){o(T)}}function m(S){try{f(r.throw(S))}catch(T){o(T)}}function f(S){S.done?a(S.value):i(S.value).then(u,m)}f((r=r.apply(e,t||[])).next())})},Si=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(f){return function(S){return m([f,S])}}function m(f){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(S){f=[6,S],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},ki=(function(){function e(t){var n=this;this.splitChar="",this.lastIndex=-1,this.fillEmoji=function(r,i){n.element.style.display="none";var a=decodeURIComponent(r.getAttribute("data-value")),o=window.getSelection().getRangeAt(0);if(i.currentMode==="ir"){var u=(0,s.a1)(o.startContainer,"data-type","code-block-info");if(u){u.textContent=w.g.ZWSP+a.trimRight(),o.selectNodeContents(u),o.collapse(!1),ze(i),u.parentElement.querySelectorAll("code").forEach(function(T){T.className="language-"+a.trimRight()}),_e(u.parentElement.querySelector(".vditor-ir__preview"),i),n.recentLanguage=a.trimRight();return}}if(i.currentMode==="wysiwyg"&&o.startContainer.nodeType!==3){var m=o.startContainer,f=void 0;if(m.classList.contains("vditor-input")?f=m:f=m.firstElementChild,f&&f.classList.contains("vditor-input")){f.value=a.trimRight(),o.selectNodeContents(f),o.collapse(!1),f.dispatchEvent(new CustomEvent("input",{detail:1})),n.recentLanguage=a.trimRight();return}}if(o.setStart(o.startContainer,n.lastIndex),o.deleteContents(),i.options.hint.parse?i.currentMode==="sv"?(0,M.oC)(i.lute.SpinVditorSVDOM(a),i):i.currentMode==="wysiwyg"?(0,M.oC)(i.lute.SpinVditorDOM(a),i):(0,M.oC)(i.lute.SpinVditorIRDOM(a),i):(0,M.oC)(a,i),n.splitChar===":"&&a.indexOf(":")>-1&&i.currentMode!=="sv"&&o.insertNode(document.createTextNode(" ")),o.collapse(!1),(0,M.Hc)(o),i.currentMode==="wysiwyg"){var S=(0,s.fb)(o.startContainer,"vditor-wysiwyg__block");S&&S.lastElementChild.classList.contains("vditor-wysiwyg__preview")&&(S.lastElementChild.innerHTML=S.firstElementChild.innerHTML,_e(S.lastElementChild,i))}else if(i.currentMode==="ir"){var S=(0,s.fb)(o.startContainer,"vditor-ir__marker--pre");S&&S.nextElementSibling.classList.contains("vditor-ir__preview")&&(S.nextElementSibling.innerHTML=S.innerHTML,_e(S.nextElementSibling,i))}re(i)},this.timeId=-1,this.element=document.createElement("div"),this.element.className="vditor-hint",this.recentLanguage="",t.push({key:":"})}return e.prototype.render=function(t){var n=this;if(window.getSelection().focusNode){var r,i=getSelection().getRangeAt(0);r=i.startContainer.textContent.substring(0,i.startOffset)||"";var a=this.getKey(r,t.options.hint.extend);if(typeof a>"u")this.element.style.display="none",clearTimeout(this.timeId);else if(this.splitChar===":"){var o=a===""?t.options.hint.emoji:t.lute.GetEmojis(),u=[];Object.keys(o).forEach(function(m){m.indexOf(a.toLowerCase())===0&&(o[m].indexOf(".")>-1?u.push({html:'<img src="'.concat(o[m],'" title=":').concat(m,':"/> :').concat(m,":"),value:":".concat(m,":")}):u.push({html:'<span class="vditor-hint__emoji">'.concat(o[m],"</span>").concat(m),value:o[m]}))}),this.genHTML(u,a,t)}else t.options.hint.extend.forEach(function(m){m.key===n.splitChar&&(clearTimeout(n.timeId),n.timeId=window.setTimeout(function(){return Ei(n,void 0,void 0,function(){var f;return Si(this,function(S){switch(S.label){case 0:return f=this.genHTML,[4,m.hint(a)];case 1:return f.apply(this,[S.sent(),a,t]),[2]}})})},t.options.hint.delay))})}},e.prototype.genHTML=function(t,n,r){var i=this;if(t.length===0){this.element.style.display="none";return}var a=r[r.currentMode].element,o=(0,M.Ny)(a),u=o.left+(r.options.outline.position==="left"?r.outline.element.offsetWidth:0),m=o.top,f="";t.forEach(function(T,R){if(!(R>7)){var P=T.html;if(n!==""){var O=P.lastIndexOf(">")+1,W=P.substr(O),U=W.toLowerCase().indexOf(n.toLowerCase());U>-1&&(W=W.substring(0,U)+"<b>"+W.substring(U,U+n.length)+"</b>"+W.substring(U+n.length),P=P.substr(0,O)+W)}f+='<button type="button" data-value="'.concat(encodeURIComponent(T.value),` "
134
- `).concat(R===0?"class='vditor-hint--current'":"","> ").concat(P,"</button>")}}),this.element.innerHTML=f;var S=parseInt(document.defaultView.getComputedStyle(a,null).getPropertyValue("line-height"),10);this.element.style.top="".concat(m+(S||22),"px"),this.element.style.left="".concat(u,"px"),this.element.style.display="block",this.element.style.right="auto",this.element.querySelectorAll("button").forEach(function(T){T.addEventListener("click",function(R){i.fillEmoji(T,r),R.preventDefault()})}),this.element.getBoundingClientRect().bottom>window.innerHeight&&(this.element.style.top="".concat(m-this.element.offsetHeight,"px")),this.element.getBoundingClientRect().right>window.innerWidth&&(this.element.style.left="auto",this.element.style.right="0")},e.prototype.select=function(t,n){if(this.element.querySelectorAll("button").length===0||this.element.style.display==="none")return!1;var r=this.element.querySelector(".vditor-hint--current");if(t.key==="ArrowDown")return t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.nextElementSibling?r.nextElementSibling.className="vditor-hint--current":this.element.children[0].className="vditor-hint--current",!0;if(t.key==="ArrowUp"){if(t.preventDefault(),t.stopPropagation(),r.removeAttribute("class"),r.previousElementSibling)r.previousElementSibling.className="vditor-hint--current";else{var i=this.element.children.length;this.element.children[i-1].className="vditor-hint--current"}return!0}else if(!(0,l.yl)(t)&&!t.shiftKey&&!t.altKey&&t.key==="Enter"&&!t.isComposing)return t.preventDefault(),t.stopPropagation(),this.fillEmoji(r,n),!0;return!1},e.prototype.getKey=function(t,n){var r=this;this.lastIndex=-1,this.splitChar="",n.forEach(function(f){var S=t.lastIndexOf(f.key);r.lastIndex<S&&(r.splitChar=f.key,r.lastIndex=S)});var i;if(this.lastIndex===-1)return i;var a=t.split(this.splitChar),o=a[a.length-1],u=32;if(a.length>1&&o.trim()===o)if(a.length===2&&a[0]===""&&a[1].length<u)i=a[1];else{var m=a[a.length-2].slice(-1);(0,C.X)(m)===" "&&o.length<u&&(i=o)}return i},e})(),Ci=(function(){function e(t){this.composingLock=!1;var n=document.createElement("div");n.className="vditor-ir",n.innerHTML='<pre class="vditor-reset" placeholder="'.concat(t.options.placeholder,`"
135
- contenteditable="true" spellcheck="false"></pre>`),this.element=n.firstElementChild,this.bindEvent(t),Rt(t,this.element),fn(t,this.element),It(t,this.element),Vt(t,this.element),Ut(t,this.element),Pt(t,this.element),jt(t,this.element,this.copy),Bt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){var r=getSelection().getRangeAt(0);if(r.toString()!==""){t.stopPropagation(),t.preventDefault();var i=document.createElement("div");i.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorIRDOM2Md(i.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Tt(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){b(t,["hint"])}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||$e(t,getSelection().getRangeAt(0).cloneRange()),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")){if(n.preventInput){n.preventInput=!1,ze(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"||$e(t,getSelection().getRangeAt(0).cloneRange(),!1,r)}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){r.target.checked?r.target.setAttribute("checked","checked"):r.target.removeAttribute("checked"),n.preventInput=!0,ze(t);return}var i=(0,M.zh)(t),a=(0,s.fb)(r.target,"vditor-ir__preview");if(a||(a=(0,s.fb)(i.startContainer,"vditor-ir__preview")),a&&(a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!0),(0,M.Hc)(i),Se(t)),r.target.tagName==="IMG"){var o=r.target.parentElement.querySelector(".vditor-ir__marker--link");o&&(i.selectNode(o),(0,M.Hc)(i))}var u=(0,s.a1)(r.target,"data-type","a");if(u&&!u.classList.contains("vditor-ir__node--expand")){t.options.link.click?t.options.link.click(u.querySelector(":scope > .vditor-ir__marker--link")):t.options.link.isOpen&&window.open(u.querySelector(":scope > .vditor-ir__marker--link").textContent);return}if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&i.collapsed){var m=n.element.lastElementChild.getBoundingClientRect();r.y>m.top+m.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(w.g.ZWSP,"")===""?(i.selectNodeContents(n.element.lastElementChild),i.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(n.element,i)))}i.toString()===""?V(i,t):setTimeout(function(){V((0,M.zh)(t),t)}),wt(r,t),lt(t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if(r.key==="Enter"&&Se(t),lt(t),(r.key==="Backspace"||r.key==="Delete")&&t.ir.element.innerHTML!==""&&t.ir.element.childNodes.length===1&&t.ir.element.firstElementChild&&t.ir.element.firstElementChild.tagName==="P"&&t.ir.element.firstElementChild.childElementCount===0&&(t.ir.element.textContent===""||t.ir.element.textContent===`
136
- `)){t.ir.element.innerHTML="";return}var i=(0,M.zh)(t);r.key==="Backspace"?((0,l.vU)()&&i.startContainer.textContent===`
137
- `&&i.startOffset===1&&(i.startContainer.textContent="",V(i,t)),n.element.querySelectorAll(".language-math").forEach(function(o){var u=o.querySelector("br");u&&u.remove()})):r.key.indexOf("Arrow")>-1?((r.key==="ArrowLeft"||r.key==="ArrowRight")&&Pn(t),V(i,t)):r.keyCode===229&&r.code===""&&r.key==="Unidentified"&&V(i,t);var a=(0,s.fb)(i.startContainer,"vditor-ir__preview");if(a){if(r.key==="ArrowUp"||r.key==="ArrowLeft")return a.previousElementSibling.firstElementChild?i.selectNodeContents(a.previousElementSibling.firstElementChild):i.selectNodeContents(a.previousElementSibling),i.collapse(!1),r.preventDefault(),!0;if(a.tagName==="SPAN"&&(r.key==="ArrowDown"||r.key==="ArrowRight"))return a.parentElement.getAttribute("data-type")==="html-entity"?(a.parentElement.insertAdjacentText("afterend",w.g.ZWSP),i.setStart(a.parentElement.nextSibling,1)):i.selectNodeContents(a.parentElement.lastElementChild),i.collapse(!1),r.preventDefault(),!0}}})},e})(),jn=function(e){if(e.currentMode==="sv")return e.lute.Md2HTML(D(e));if(e.currentMode==="wysiwyg")return e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML);if(e.currentMode==="ir")return e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML)},_i=X(214),Bn=X(436),Li=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-outline",this.element.innerHTML='<div class="vditor-outline__title">'.concat(t,`</div>
138
- <div class="vditor-outline__content"></div>`)}return e.prototype.render=function(t){var n="";return t.preview.element.style.display==="block"?n=(0,Bn.k)(t.preview.previewElement,this.element.lastElementChild,t):n=(0,Bn.k)(t[t.currentMode].element,this.element.lastElementChild,t),n},e.prototype.toggle=function(t,n,r){var i;n===void 0&&(n=!0),r===void 0&&(r=!0);var a=(i=t.toolbar.elements.outline)===null||i===void 0?void 0:i.firstElementChild;if(n&&window.innerWidth>=w.g.MOBILE_WIDTH?(this.element.style.display="block",this.render(t),a?.classList.add("vditor-menu--current")):(this.element.style.display="none",a?.classList.remove("vditor-menu--current")),r&&getSelection().rangeCount>0){var o=getSelection().getRangeAt(0);t[t.currentMode].element.contains(o.startContainer)&&(0,M.Hc)(o)}je(t)},e})(),Mi=X(280),Ti=(function(){function e(t){var n=this;this.element=document.createElement("div"),this.element.className="vditor-preview",this.previewElement=document.createElement("div"),this.previewElement.className="vditor-reset",t.options.classes.preview&&this.previewElement.classList.add(t.options.classes.preview),this.previewElement.style.maxWidth=t.options.preview.maxWidth+"px",this.previewElement.addEventListener("copy",function(m){if(m.target.tagName!=="TEXTAREA"){var f=document.createElement("div");f.className="vditor-reset",f.appendChild(getSelection().getRangeAt(0).cloneContents()),n.copyToX(t,f,"default"),m.preventDefault()}}),this.previewElement.addEventListener("click",function(m){var f=(0,s.lG)(m.target,"SPAN");if(f&&(0,s.fb)(f,"vditor-toc")){var S=n.previewElement.querySelector("#"+f.getAttribute("data-target-id"));S&&(n.element.scrollTop=S.offsetTop);return}if(m.target.tagName==="A"){t.options.link.click?t.options.link.click(m.target):t.options.link.isOpen&&window.open(m.target.getAttribute("href")),m.preventDefault();return}m.target.tagName==="IMG"&&(t.options.image.preview?t.options.image.preview(m.target):t.options.image.isPreview&&(0,$.E)(m.target,t.options.lang,t.options.theme))}),this.element.appendChild(this.previewElement);var r=t.options.preview.actions;if(r.length!==0){var i=document.createElement("div");i.className="vditor-preview__action";for(var a=[],o=0;o<r.length;o++){var u=r[o];if(typeof u=="object"){a.push('<button type="button" data-type="'.concat(u.key,'" class="').concat(u.className,'"').concat(u.tooltip?' aria-label="'.concat(u.tooltip,'"'):"",'">').concat(u.text,"</button>"));continue}switch(u){case"desktop":a.push('<button type="button" class="vditor-preview__action--current" data-type="desktop">Desktop</button>');break;case"tablet":a.push('<button type="button" data-type="tablet">Tablet</button>');break;case"mobile":a.push('<button type="button" data-type="mobile">Mobile/Wechat</button>');break;case"mp-wechat":a.push('<button type="button" data-type="mp-wechat" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到公众号"><svg><use xlink:href="#vditor-icon-mp-wechat"></use></svg></button>');break;case"zhihu":a.push('<button type="button" data-type="zhihu" class="vditor-tooltipped vditor-tooltipped__w" aria-label="复制到知乎"><svg><use xlink:href="#vditor-icon-zhihu"></use></svg></button>');break}}i.innerHTML=a.join(""),i.addEventListener((0,l.Le)(),function(m){var f=(0,k.S)(m.target,"BUTTON");if(f){var S=f.getAttribute("data-type"),T=r.find(function(R){return R?.key===S});if(T){T.click(S);return}if(S==="mp-wechat"||S==="zhihu"){n.copyToX(t,n.previewElement.cloneNode(!0),S);return}S==="desktop"?n.previewElement.style.width="auto":S==="tablet"?n.previewElement.style.width="780px":n.previewElement.style.width="360px",n.previewElement.scrollWidth>n.previewElement.parentElement.clientWidth&&(n.previewElement.style.width="auto"),n.render(t),i.querySelectorAll("button").forEach(function(R){R.classList.remove("vditor-preview__action--current")}),f.classList.add("vditor-preview__action--current")}}),this.element.insertBefore(i,this.previewElement)}}return e.prototype.render=function(t,n){var r=this;if(clearTimeout(this.mdTimeoutId),this.element.style.display==="none"){this.element.getAttribute("data-type")==="renderPerformance"&&t.tip.hide();return}if(n){this.previewElement.innerHTML=n;return}if(D(t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")===""){this.previewElement.innerHTML="";return}var i=new Date().getTime(),a=D(t);this.mdTimeoutId=window.setTimeout(function(){if(t.options.preview.url){var o=new XMLHttpRequest;o.open("POST",t.options.preview.url),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(o.status===200){var m=JSON.parse(o.responseText);if(m.code!==0){t.tip.show(m.msg);return}t.options.preview.transform&&(m.data=t.options.preview.transform(m.data)),r.previewElement.innerHTML=m.data,r.afterRender(t,i)}else{var f=t.lute.Md2HTML(a);t.options.preview.transform&&(f=t.options.preview.transform(f)),r.previewElement.innerHTML=f,r.afterRender(t,i)}},o.send(JSON.stringify({markdownText:a}))}else{var u=t.lute.Md2HTML(a);t.options.preview.transform&&(u=t.options.preview.transform(u)),r.previewElement.innerHTML=u,r.afterRender(t,i)}},t.options.preview.delay)},e.prototype.afterRender=function(t,n){t.options.preview.parse&&t.options.preview.parse(this.element);var r=new Date().getTime()-n;new Date().getTime()-n>2600?(t.tip.show(window.VditorI18n.performanceTip.replace("${x}",r.toString())),t.preview.element.setAttribute("data-type","renderPerformance")):t.preview.element.getAttribute("data-type")==="renderPerformance"&&(t.tip.hide(),t.preview.element.removeAttribute("data-type"));var i=t.preview.element.querySelector(".vditor-comment--focus");i&&i.classList.remove("vditor-comment--focus"),(0,B.O)(t.preview.previewElement,t.options.preview.hljs),(0,ne.s)(t.options.preview.hljs,t.preview.previewElement,t.options.cdn),(0,ue.i)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,ve.K)(t.preview.previewElement,t.options.cdn),(0,Ce.J)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,z.P)(t.preview.previewElement,t.options.cdn),(0,Z.v)(t.preview.previewElement,t.options.cdn),(0,_.p)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,me.P)(t.preview.previewElement,t.options.cdn,t.options.theme),(0,de.B)(t.preview.previewElement,t.options.cdn),(0,H.Q)(t.preview.previewElement,t.options.cdn),t.options.preview.render.media.enable&&(0,Mi.Y)(t.preview.previewElement),t.options.customRenders.forEach(function(u){u.render(t.preview.previewElement,t)});var a=t.preview.element,o=t.outline.render(t);o===""&&(o="[ToC]"),a.querySelectorAll('[data-type="toc-block"]').forEach(function(u){u.innerHTML=o,(0,ae.H)(u,{cdn:t.options.cdn,math:t.options.preview.math})}),(0,ae.H)(t.preview.previewElement,{cdn:t.options.cdn,math:t.options.preview.math})},e.prototype.copyToX=function(t,n,r){r===void 0&&(r="mp-wechat"),r!=="zhihu"?n.querySelectorAll(".katex-html .base").forEach(function(a){a.style.display="initial"}):n.querySelectorAll(".language-math").forEach(function(a){a.outerHTML='<img class="Formula-image" data-eeimg="true" src="//www.zhihu.com/equation?tex=" alt="'.concat(a.getAttribute("data-math"),'\\" style="display: block; margin: 0 auto; max-width: 100%;">')}),n.style.backgroundColor="#fff",n.querySelectorAll("code").forEach(function(a){a.style.backgroundImage="none"}),this.element.append(n);var i=n.ownerDocument.createRange();i.selectNode(n),(0,M.Hc)(i),document.execCommand("copy"),n.remove(),t.tip.show(["zhihu","mp-wechat"].includes(r)?"已复制,可到".concat(r==="zhihu"?"知乎":"微信公众号平台","进行粘贴"):"已复制到剪切板")},e})(),Ai=(function(){function e(t){this.element=document.createElement("div"),this.element.className="vditor-resize vditor-resize--".concat(t.options.resize.position),this.element.innerHTML='<div><svg><use xlink:href="#vditor-icon-resize"></use></svg></div>',this.bindEvent(t)}return e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("mousedown",function(r){var i=document,a=r.clientY,o=t.element.offsetHeight,u=63+t.element.querySelector(".vditor-toolbar").clientHeight;i.ondragstart=function(){return!1},window.captureEvents&&window.captureEvents(),n.element.classList.add("vditor-resize--selected"),i.onmousemove=function(m){t.options.resize.position==="top"?t.element.style.height=Math.max(u,o+(a-m.clientY))+"px":t.element.style.height=Math.max(u,o+(m.clientY-a))+"px",t.options.typewriterMode&&(t.sv.element.style.paddingBottom=t.sv.element.parentElement.offsetHeight/2+"px")},i.onmouseup=function(){t.options.resize.after&&t.options.resize.after(t.element.offsetHeight-o),window.captureEvents&&window.captureEvents(),i.onmousemove=null,i.onmouseup=null,i.ondragstart=null,i.onselectstart=null,i.onselect=null,n.element.classList.remove("vditor-resize--selected")}})},e})(),xi=(function(){function e(t){this.composingLock=!1,this.element=document.createElement("pre"),this.element.className="vditor-sv vditor-reset",this.element.setAttribute("placeholder",t.options.placeholder),this.element.setAttribute("contenteditable","true"),this.element.setAttribute("spellcheck","false"),this.bindEvent(t),Rt(t,this.element),It(t,this.element),Vt(t,this.element),Ut(t,this.element),Pt(t,this.element),jt(t,this.element,this.copy),Bt(t,this.element,this.copy)}return e.prototype.copy=function(t,n){t.stopPropagation(),t.preventDefault(),t.clipboardData.setData("text/plain",ft(n[n.currentMode].element))},e.prototype.bindEvent=function(t){var n=this;this.element.addEventListener("paste",function(r){Tt(t,r,{pasteCode:function(i){document.execCommand("insertHTML",!1,i)}})}),this.element.addEventListener("scroll",function(){if(t.preview.element.style.display==="block"){var r=n.element.scrollTop,i=n.element.clientHeight,a=n.element.scrollHeight-parseFloat(n.element.style.paddingBottom||"0"),o=t.preview.element;r/i>.5?o.scrollTop=(r+i)*o.scrollHeight/a-i:o.scrollTop=r*o.scrollHeight/a}}),this.element.addEventListener("compositionstart",function(r){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){(0,l.vU)()||le(t,r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")&&!(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《")){if(n.preventInput){n.preventInput=!1,Le(t,{enableAddUndoStack:!0,enableHint:!0,enableInput:!0});return}le(t,r)}}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){if((r.key==="Backspace"||r.key==="Delete")&&t.sv.element.innerHTML!==""&&t.sv.element.childNodes.length===1&&t.sv.element.firstElementChild&&t.sv.element.firstElementChild.tagName==="DIV"&&t.sv.element.firstElementChild.childElementCount===2&&(t.sv.element.firstElementChild.textContent===""||t.sv.element.textContent===`
139
- `)){t.sv.element.innerHTML="";return}r.key==="Enter"&&Se(t)}})},e})(),Vn=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-tip"}return e.prototype.show=function(t,n){var r=this;n===void 0&&(n=6e3),this.element.className="vditor-tip vditor-tip--show",n===0?(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,`
140
- <div class="vditor-tip__close">X</div></div>`),this.element.querySelector(".vditor-tip__close").addEventListener("click",function(){r.hide()})):(this.element.innerHTML='<div class="vditor-tip__content">'.concat(t,"</div>"),setTimeout(function(){r.hide()},n)),this.element.removeAttribute("style"),setTimeout(function(){var i=r.element.getBoundingClientRect();i.top<46&&(r.element.style.position="fixed",r.element.style.top="46px")},150)},e.prototype.hide=function(){this.element.className="vditor-messageElementtip",this.element.innerHTML=""},e})(),Zt=function(e,t){if(t.options.preview.mode!==e){switch(t.options.preview.mode=e,e){case"both":t.sv.element.style.display="block",t.preview.element.style.display="block",t.preview.render(t),p(t.toolbar.elements,["both"]);break;case"editor":t.sv.element.style.display="block",t.preview.element.style.display="none",g(t.toolbar.elements,["both"]);break}t.devtools&&t.devtools.renderEchart(t)}},Di=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Hi=(function(e){Di(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.preview.mode==="both"&&i.element.children[0].classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){var o=i.element.firstElementChild;o.classList.contains(w.g.CLASS_MENU_DISABLED)||(a.preventDefault(),n.currentMode==="sv"&&(n.options.preview.mode==="both"?Zt("editor",n):Zt("both",n)))}),i}return t})(be),Oi=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__br"}return e})(),Un=X(580),Ni=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ri=(function(e){Ni(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return w.g.CODE_THEME.forEach(function(m){u+="<button>".concat(m,"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),o.addEventListener((0,l.Le)(),function(m){m.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.hljs.style=m.target.textContent,(0,Un.Y)(m.target.textContent,n.options.cdn),m.preventDefault(),m.stopPropagation())}),i.element.appendChild(o),y(n,o,a,r.level),i}return t})(be),Ii=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Pi=(function(e){Ii(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow");var u="";return Object.keys(n.options.preview.theme.list).forEach(function(m){u+='<button data-type="'.concat(m,'">').concat(n.options.preview.theme.list[m],"</button>")}),o.innerHTML='<div style="overflow: auto;max-height:'.concat(window.innerHeight/2,'px">').concat(u,"</div>"),o.addEventListener((0,l.Le)(),function(m){m.target.tagName==="BUTTON"&&(b(n,["subToolbar"]),n.options.preview.theme.current=m.target.getAttribute("data-type"),(0,ee.Z)(n.options.preview.theme.current,n.options.preview.theme.path),m.preventDefault(),m.stopPropagation())}),i.element.appendChild(o),y(n,o,a,r.level),i}return t})(be),ji=(function(){function e(t){this.element=document.createElement("span"),this.element.className="vditor-counter vditor-tooltipped vditor-tooltipped__nw",this.render(t,"")}return e.prototype.render=function(t,n){var r=n.endsWith(`
141
- `)?n.length-1:n.length;if(t.options.counter.type==="text"&&t[t.currentMode]){var i=t[t.currentMode].element.cloneNode(!0);i.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(a){a.remove()}),r=i.textContent.length}typeof t.options.counter.max=="number"?(r>t.options.counter.max?this.element.className="vditor-counter vditor-counter--error":this.element.className="vditor-counter",this.element.innerHTML="".concat(r,"/").concat(t.options.counter.max)):this.element.innerHTML="".concat(r),this.element.setAttribute("aria-label",t.options.counter.type),t.options.counter.after&&t.options.counter.after(r,{enable:t.options.counter.enable,max:t.options.counter.max,type:t.options.counter.type})},e})(),Bi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Vi=(function(e){Bi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].innerHTML=r.icon,i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!a.currentTarget.classList.contains(w.g.CLASS_MENU_DISABLED)&&r.click(a,n)}),i}return t})(be),Ui=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Wi=(function(e){Ui(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.firstElementChild.addEventListener((0,l.Le)(),function(a){var o=i.element.firstElementChild;o.classList.contains(w.g.CLASS_MENU_DISABLED)||(a.preventDefault(),o.classList.contains("vditor-menu--current")?(o.classList.remove("vditor-menu--current"),n.devtools.element.style.display="none",je(n)):(o.classList.add("vditor-menu--current"),n.devtools.element.style.display="block",je(n),n.devtools.renderEchart(n)))}),i}return t})(be),Fi=(function(){function e(){this.element=document.createElement("div"),this.element.className="vditor-toolbar__divider"}return e})(),qi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ki=(function(e){qi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");a.className="vditor-panel vditor-panel--arrow";var o="";return Object.keys(n.options.hint.emoji).forEach(function(u){var m=n.options.hint.emoji[u];m.indexOf(".")>-1?o+='<button data-value=":'.concat(u,': " data-key=":').concat(u,`:"><img
142
- data-value=":`).concat(u,': " data-key=":').concat(u,':" class="vditor-emojis__icon" src="').concat(m,'"/></button>'):o+='<button data-value="'.concat(m,` "
143
- data-key="`).concat(u,'"><span class="vditor-emojis__icon">').concat(m,"</span></button>")}),a.innerHTML='<div class="vditor-emojis" style="max-height: '.concat(n.options.height==="auto"?"auto":n.options.height-80,'px">').concat(o,`</div><div class="vditor-emojis__tail">
144
- <span class="vditor-emojis__tip"></span><span>`).concat(n.options.hint.emojiTail||"",`</span>
145
- </div>`),i.element.appendChild(a),y(n,a,i.element.firstElementChild,r.level),i.bindEvent(n),i}return t.prototype.bindEvent=function(n){var r=this;this.element.lastElementChild.addEventListener((0,l.Le)(),function(i){var a=(0,k.S)(i.target,"BUTTON");if(a){i.preventDefault();var o=a.getAttribute("data-value"),u=(0,M.zh)(n),m=o;if(n.currentMode==="wysiwyg"?m=n.lute.SpinVditorDOM(o):n.currentMode==="ir"&&(m=n.lute.SpinVditorIRDOM(o)),o.indexOf(":")>-1&&n.currentMode!=="sv"){var f=document.createElement("div");f.innerHTML=m,m=f.firstElementChild.firstElementChild.outerHTML+" ",(0,M.oC)(m,n)}else u.extractContents(),u.insertNode(document.createTextNode(o)),(0,s.F9)(u.startContainer)||Ht(n,u);u.collapse(!1),(0,M.Hc)(u),r.element.lastElementChild.style.display="none",re(n)}}),this.element.lastElementChild.addEventListener("mouseover",function(i){var a=(0,k.S)(i.target,"BUTTON");a&&(r.element.querySelector(".vditor-emojis__tip").innerHTML=a.getAttribute("data-key"))})},t})(be),Wn=function(e,t,n){var r=document.createElement("a");"download"in r?(r.download=n,r.style.display="none",r.href=URL.createObjectURL(new Blob([t])),document.body.appendChild(r),r.click(),r.remove()):e.tip.show(window.VditorI18n.downloadTip,0)},zi=function(e){var t=D(e);Wn(e,t,t.substr(0,10)+".md")},Gi=function(e){e.tip.show(window.VditorI18n.generate,3800);var t=document.querySelector("#vditorExportIframe");t.contentDocument.open(),t.contentDocument.write('<link rel="stylesheet" href="'.concat(e.options.cdn,`/dist/index.css"/>
146
- <script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script>
147
- <div id="preview" style="width: 800px"></div>
148
- <script>
149
- window.addEventListener("message", (e) => {
150
- if(!e.data) {
151
- return;
34
+ .ProseMirror pre {
35
+ white-space: pre-wrap;
36
+ }
37
+
38
+ img.ProseMirror-separator {
39
+ display: inline !important;
40
+ border: none !important;
41
+ margin: 0 !important;
42
+ width: 0 !important;
43
+ height: 0 !important;
44
+ }
45
+
46
+ .ProseMirror-gapcursor {
47
+ display: none;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ margin: 0;
51
+ }
52
+
53
+ .ProseMirror-gapcursor:after {
54
+ content: "";
55
+ display: block;
56
+ position: absolute;
57
+ top: -2px;
58
+ width: 20px;
59
+ border-top: 1px solid black;
60
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
61
+ }
62
+
63
+ @keyframes ProseMirror-cursor-blink {
64
+ to {
65
+ visibility: hidden;
152
66
  }
153
- Vditor.preview(document.getElementById('preview'), e.data, {
154
- cdn: "`).concat(e.options.cdn,`",
155
- markdown: {
156
- theme: `).concat(JSON.stringify(e.options.preview.theme),`
157
- },
158
- hljs: {
159
- style: "`).concat(e.options.preview.hljs.style,`"
160
- }
161
- });
162
- setTimeout(() => {
163
- window.print();
164
- }, 3600);
165
- }, false);
166
- <\/script>`)),t.contentDocument.close(),setTimeout(function(){t.contentWindow.postMessage(D(e),"*")},200)},$i=function(e){var t=jn(e),n='<html><head><link rel="stylesheet" type="text/css" href="'.concat(e.options.cdn,`/dist/index.css"/>
167
- <script src="`).concat(e.options.cdn,"/dist/js/i18n/").concat(e.options.lang,`.js"><\/script>
168
- <script src="`).concat(e.options.cdn,`/dist/method.min.js"><\/script></head>
169
- <body><div class="vditor-reset" id="preview">`).concat(t,`</div>
170
- <script>
171
- const previewElement = document.getElementById('preview')
172
- Vditor.setContentTheme('`).concat(e.options.preview.theme.current,"', '").concat(e.options.preview.theme.path,`');
173
- Vditor.codeRender(previewElement);
174
- Vditor.highlightRender(`).concat(JSON.stringify(e.options.preview.hljs),", previewElement, '").concat(e.options.cdn,`');
175
- Vditor.mathRender(previewElement, {
176
- cdn: '`).concat(e.options.cdn,`',
177
- math: `).concat(JSON.stringify(e.options.preview.math),`,
178
- });
179
- Vditor.mermaidRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
180
- Vditor.SMILESRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
181
- Vditor.markmapRender(previewElement, '`).concat(e.options.cdn,`');
182
- Vditor.flowchartRender(previewElement, '`).concat(e.options.cdn,`');
183
- Vditor.graphvizRender(previewElement, '`).concat(e.options.cdn,`');
184
- Vditor.chartRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
185
- Vditor.mindmapRender(previewElement, '`).concat(e.options.cdn,"', '").concat(e.options.theme,`');
186
- Vditor.abcRender(previewElement, '`).concat(e.options.cdn,`');
187
- `).concat(e.options.preview.render.media.enable?"Vditor.mediaRender(previewElement);":"",`
188
- Vditor.speechRender(previewElement);
189
- <\/script>
190
- <script src="`).concat(e.options.cdn,"/dist/js/icons/").concat(e.options.icon,'.js"><\/script></body></html>');Wn(e,n,t.substr(0,10)+".html")},Zi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ji=(function(e){Zi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=i.element.children[0],o=document.createElement("div");return o.className="vditor-hint".concat(r.level===2?"":" vditor-panel--arrow"),o.innerHTML=`<button data-type="markdown">Markdown</button>
191
- <button data-type="pdf">PDF</button>
192
- <button data-type="html">HTML</button>`,o.addEventListener((0,l.Le)(),function(u){var m=u.target;if(m.tagName==="BUTTON"){switch(m.getAttribute("data-type")){case"markdown":zi(n);break;case"pdf":Gi(n);break;case"html":$i(n);break}b(n,["subToolbar"]),u.preventDefault(),u.stopPropagation()}}),i.element.appendChild(o),y(n,o,a,r.level),i}return t})(be),Xi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Yi=(function(e){Xi(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n,r),i}return t.prototype._bindEvent=function(n,r){this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault(),n.element.className.includes("vditor--fullscreen")?(r.level||(this.innerHTML=r.icon),n.element.style.zIndex="",document.body.style.overflow="",n.element.classList.remove("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(a){var o=n.toolbar.elements[a].firstChild;o&&(o.className=o.className.replace("__s","__n"),n.options.toolbar.forEach(function(u){typeof u!="string"&&u.tipPosition&&u.name===o.dataset.type&&(o.className="vditor-tooltipped vditor-tooltipped__".concat(u.tipPosition))}))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__s","__n"))):(r.level||(this.innerHTML='<svg><use xlink:href="#vditor-icon-contract"></use></svg>'),n.element.style.zIndex=n.options.fullscreen.index.toString(),document.body.style.overflow="hidden",n.element.classList.add("vditor--fullscreen"),Object.keys(n.toolbar.elements).forEach(function(a){var o=n.toolbar.elements[a].firstChild;o&&(o.className=o.className.replace("__n","__s"))}),n.counter&&(n.counter.element.className=n.counter.element.className.replace("__n","__s"))),n.devtools&&n.devtools.renderEchart(n),r.click&&r.click(i,n),je(n),Et(n)})},t})(be),Qi=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ea=(function(e){Qi(t,e);function t(n,r){var i=e.call(this,n,r)||this,a=document.createElement("div");return a.className="vditor-hint vditor-panel--arrow",a.innerHTML='<button data-tag="h1" data-value="# ">'.concat(window.VditorI18n.heading1," ").concat((0,l.ns)("&lt;⌥⌘1>"),`</button>
193
- <button data-tag="h2" data-value="## ">`).concat(window.VditorI18n.heading2," &lt;").concat((0,l.ns)("⌥⌘2"),`></button>
194
- <button data-tag="h3" data-value="### ">`).concat(window.VditorI18n.heading3," &lt;").concat((0,l.ns)("⌥⌘3"),`></button>
195
- <button data-tag="h4" data-value="#### ">`).concat(window.VditorI18n.heading4," &lt;").concat((0,l.ns)("⌥⌘4"),`></button>
196
- <button data-tag="h5" data-value="##### ">`).concat(window.VditorI18n.heading5," &lt;").concat((0,l.ns)("⌥⌘5"),`></button>
197
- <button data-tag="h6" data-value="###### ">`).concat(window.VditorI18n.heading6," &lt;").concat((0,l.ns)("⌥⌘6"),"></button>"),i.element.appendChild(a),i._bindEvent(n,a),i}return t.prototype._bindEvent=function(n,r){var i=this.element.children[0];i.addEventListener((0,l.Le)(),function(o){o.preventDefault(),clearTimeout(n.wysiwyg.afterRenderTimeoutId),clearTimeout(n.ir.processTimeoutId),clearTimeout(n.sv.processTimeoutId),!i.classList.contains(w.g.CLASS_MENU_DISABLED)&&(i.blur(),i.classList.contains("vditor-menu--current")?(n.currentMode==="wysiwyg"?(Ot(n),pe(n)):n.currentMode==="ir"&&ht(n,""),i.classList.remove("vditor-menu--current")):(b(n,["subToolbar"]),r.style.display="block"))});for(var a=0;a<6;a++)r.children.item(a).addEventListener((0,l.Le)(),function(o){o.preventDefault(),n.currentMode==="wysiwyg"?(St(n,o.target.getAttribute("data-tag")),pe(n),i.classList.add("vditor-menu--current")):n.currentMode==="ir"?(ht(n,o.target.getAttribute("data-value")),i.classList.add("vditor-menu--current")):pn(n,o.target.getAttribute("data-value")),r.style.display="none"})},t})(be),ta=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),na=(function(e){ta(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),n.tip.show(`<div style="margin-bottom:14px;font-size: 14px;line-height: 22px;min-width:300px;max-width: 360px;display: flex;">
198
- <div style="margin-top: 14px;flex: 1">
199
- <div>Markdown 使用指南</div>
200
- <ul style="list-style: none">
201
- <li><a href="https://ld246.com/article/1583308420519" target="_blank">语法速查手册</a></li>
202
- <li><a href="https://ld246.com/article/1583129520165" target="_blank">基础语法</a></li>
203
- <li><a href="https://ld246.com/article/1583305480675" target="_blank">扩展语法</a></li>
204
- <li><a href="https://ld246.com/article/1582778815353" target="_blank">键盘快捷键</a></li>
205
- </ul>
206
- </div>
207
- <div style="margin-top: 14px;flex: 1">
208
- <div>Vditor 支持</div>
209
- <ul style="list-style: none">
210
- <li><a href="https://github.com/Vanessa219/vditor/issues" target="_blank">Issues</a></li>
211
- <li><a href="https://ld246.com/tag/vditor" target="_blank">官方讨论区</a></li>
212
- <li><a href="https://ld246.com/article/1549638745630" target="_blank">开发手册</a></li>
213
- <li><a href="https://ld246.com/guide/markdown" target="_blank">演示地址</a></li>
214
- </ul>
215
- </div></div>`,0)}),i}return t})(be),ra=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ia=(function(e){ra(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,M.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&Sn(n,u,o)}}),i}return t})(be),aa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),oa=(function(e){aa(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),n.tip.show(`<div style="max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;">
216
- <p style="text-align: center;margin: 14px 0">
217
- <em>下一代的 Markdown 编辑器,为未来而构建</em>
218
- </p>
219
- <div style="display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center">
220
- <img src="https://unpkg.com/vditor/dist/images/logo.png" style="margin: 0 auto;height: 68px"/>
221
- <div>&nbsp;&nbsp;</div>
222
- <div style="flex: 1;min-width: 250px">
223
- Vditor 是一款浏览器端的 Markdown 编辑器,支持所见即所得、即时渲染(类似 Typora)和分屏预览模式。
224
- 它使用 TypeScript 实现,支持原生 JavaScript 以及 Vue、React、Angular 和 Svelte 等框架。
225
- </div>
226
- </div>
227
- <div style="display: flex;flex-wrap: wrap;">
228
- <ul style="list-style: none;flex: 1;min-width:148px">
229
- <li>
230
- 项目地址:<a href="https://b3log.org/vditor" target="_blank">b3log.org/vditor</a>
231
- </li>
232
- <li>
233
- 开源协议:MIT
234
- </li>
235
- </ul>
236
- <ul style="list-style: none;margin-right: 18px">
237
- <li>
238
- 组件版本:Vditor v`.concat(w.H," / Lute v").concat(Lute.Version,`
239
- </li>
240
- <li>
241
- 赞助捐赠:<a href="https://ld246.com/sponsor" target="_blank">https://ld246.com/sponsor</a>
242
- </li>
243
- </ul>
244
- </div>
245
- </div>`),0)}),i}return t})(be),sa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),la=(function(e){sa(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&dt(n,"afterend")}),i}return t})(be),ca=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ua=(function(e){ca(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!(i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")&&dt(n,"beforebegin")}),i}return t})(be),fa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),da=(function(e){fa(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!(i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)||n.currentMode==="sv")){var o=(0,M.zh)(n),u=(0,s.lG)(o.startContainer,"LI");u&&qt(n,u,o,u.parentElement)}}),i}return t})(be),pa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ha=(function(e){pa(t,e);function t(n,r){var i=e.call(this,n,r)||this;return n.options.outline&&i.element.firstElementChild.classList.add("vditor-menu--current"),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault();var o=n.toolbar.elements.outline.firstElementChild;o.classList.contains(w.g.CLASS_MENU_DISABLED)||(n.options.outline.enable=!i.element.firstElementChild.classList.contains("vditor-menu--current"),n.outline.toggle(n,n.options.outline.enable))}),i}return t})(be),ma=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ga=(function(e){ma(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){i.preventDefault();var a=r.element.firstElementChild;if(!a.classList.contains(w.g.CLASS_MENU_DISABLED)){var o=w.g.EDIT_TOOLBARS.concat(["both","edit-mode","devtools"]);a.classList.contains("vditor-menu--current")?(a.classList.remove("vditor-menu--current"),n.currentMode==="sv"?(n.sv.element.style.display="block",n.options.preview.mode==="both"?n.preview.element.style.display="block":n.preview.element.style.display="none"):(n[n.currentMode].element.parentElement.style.display="block",n.preview.element.style.display="none"),h(n.toolbar.elements,o),n.outline.render(n)):(d(n.toolbar.elements,o),n.preview.element.style.display="block",n.currentMode==="sv"?n.sv.element.style.display="none":n[n.currentMode].element.parentElement.style.display="none",n.preview.render(n),a.classList.add("vditor-menu--current"),b(n,["subToolbar","hint","popover"]),setTimeout(function(){n.outline.render(n)},n.options.preview.delay+10)),je(n)}})},t})(be),ya=(function(){function e(t){this.SAMPLE_RATE=5e3,this.isRecording=!1,this.readyFlag=!1,this.leftChannel=[],this.rightChannel=[],this.recordingLength=0;var n;if(typeof AudioContext<"u")n=new AudioContext;else if(webkitAudioContext)n=new webkitAudioContext;else return;this.DEFAULT_SAMPLE_RATE=n.sampleRate;var r=n.createGain(),i=n.createMediaStreamSource(t);i.connect(r),this.recorder=n.createScriptProcessor(2048,2,1),this.recorder.onaudioprocess=null,r.connect(this.recorder),this.recorder.connect(n.destination),this.readyFlag=!0}return e.prototype.cloneChannelData=function(t,n){this.leftChannel.push(new Float32Array(t)),this.rightChannel.push(new Float32Array(n)),this.recordingLength+=2048},e.prototype.startRecordingNewWavFile=function(){this.readyFlag&&(this.isRecording=!0,this.leftChannel.length=this.rightChannel.length=0,this.recordingLength=0)},e.prototype.stopRecording=function(){this.isRecording=!1},e.prototype.buildWavFileBlob=function(){for(var t=this.mergeBuffers(this.leftChannel),n=this.mergeBuffers(this.rightChannel),r=new Float32Array(t.length),i=0;i<t.length;++i)r[i]=.5*(t[i]+n[i]);this.DEFAULT_SAMPLE_RATE>this.SAMPLE_RATE&&(r=this.downSampleBuffer(r,this.SAMPLE_RATE));var a=44+r.length*2,o=new ArrayBuffer(a),u=new DataView(o);this.writeUTFBytes(u,0,"RIFF"),u.setUint32(4,a,!0),this.writeUTFBytes(u,8,"WAVE"),this.writeUTFBytes(u,12,"fmt "),u.setUint32(16,16,!0),u.setUint16(20,1,!0),u.setUint16(22,1,!0),u.setUint32(24,this.SAMPLE_RATE,!0),u.setUint32(28,this.SAMPLE_RATE*2,!0),u.setUint16(32,2,!0),u.setUint16(34,16,!0);var m=r.length*2;this.writeUTFBytes(u,36,"data"),u.setUint32(40,m,!0);for(var f=r.length,S=44,T=1,R=0;R<f;R++)u.setInt16(S,r[R]*(32767*T),!0),S+=2;return new Blob([u],{type:"audio/wav"})},e.prototype.downSampleBuffer=function(t,n){if(n===this.DEFAULT_SAMPLE_RATE||n>this.DEFAULT_SAMPLE_RATE)return t;for(var r=this.DEFAULT_SAMPLE_RATE/n,i=Math.round(t.length/r),a=new Float32Array(i),o=0,u=0;o<a.length;){for(var m=Math.round((o+1)*r),f=0,S=0,T=u;T<m&&T<t.length;T++)f+=t[T],S++;a[o]=f/S,o++,u=m}return a},e.prototype.mergeBuffers=function(t){for(var n=new Float32Array(this.recordingLength),r=0,i=t.length,a=0;a<i;++a){var o=t[a];n.set(o,r),r+=o.length}return n},e.prototype.writeUTFBytes=function(t,n,r){for(var i=r.length,a=0;a<i;a++)t.setUint8(n+a,r.charCodeAt(a))},e})(),ba=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),wa=(function(e){ba(t,e);function t(n,r){var i=e.call(this,n,r)||this;return i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this,i;this.element.children[0].addEventListener((0,l.Le)(),function(a){if(a.preventDefault(),!r.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)){var o=n[n.currentMode].element;if(!i){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(m){i=new ya(m),i.recorder.onaudioprocess=function(f){if(i.isRecording){var S=f.inputBuffer.getChannelData(0),T=f.inputBuffer.getChannelData(1);i.cloneChannelData(S,T)}},i.startRecordingNewWavFile(),n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),r.element.children[0].classList.add("vditor-menu--current")}).catch(function(){n.tip.show(window.VditorI18n["record-tip"])});return}if(i.isRecording){i.stopRecording(),n.tip.hide();var u=new File([i.buildWavFileBlob()],"record".concat(new Date().getTime(),".wav"),{type:"video/webm"});Ft(n,[u]),r.element.children[0].classList.remove("vditor-menu--current")}else n.tip.show(window.VditorI18n.recording),o.setAttribute("contenteditable","false"),i.startRecordingNewWavFile(),r.element.children[0].classList.add("vditor-menu--current")}})},t})(be),va=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ea=(function(e){va(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({redo:i.element},["redo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)&&n.undo.redo(n)}),i}return t})(be),Sa=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ka=(function(e){Sa(t,e);function t(n,r){var i=e.call(this,n,r)||this;return d({undo:i.element},["undo"]),i.element.children[0].addEventListener((0,l.Le)(),function(a){a.preventDefault(),!i.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)&&n.undo.undo(n)}),i}return t})(be),Ca=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),_a=(function(e){Ca(t,e);function t(n,r){var i=e.call(this,n,r)||this,a='<input type="file"';return n.options.upload.multiple&&(a+=' multiple="multiple"'),n.options.upload.accept&&(a+=' accept="'.concat(n.options.upload.accept,'"')),i.element.children[0].innerHTML="".concat(r.icon||'<svg><use xlink:href="#vditor-icon-upload"></use></svg>').concat(a,">"),i._bindEvent(n),i}return t.prototype._bindEvent=function(n){var r=this;this.element.children[0].addEventListener((0,l.Le)(),function(i){if(r.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}}),this.element.querySelector("input").addEventListener("change",function(i){if(r.element.firstElementChild.classList.contains(w.g.CLASS_MENU_DISABLED)){i.stopPropagation(),i.preventDefault();return}i.target.files.length!==0&&Ft(n,i.target.files,i.target)})},t})(be),La=(function(){function e(t){var n=this,r=t.options;this.elements={},this.element=document.createElement("div"),this.element.className="vditor-toolbar",r.toolbar.forEach(function(i,a){var o=n.genItem(t,i,a);if(n.element.appendChild(o),i.toolbar){var u=document.createElement("div");u.className="vditor-hint vditor-panel--arrow",u.addEventListener((0,l.Le)(),function(m){u.style.display="none"}),i.toolbar.forEach(function(m,f){m.level=2,u.appendChild(n.genItem(t,m,a+f))}),o.appendChild(u),y(t,u,o.children[0])}}),t.options.toolbarConfig.hide&&this.element.classList.add("vditor-toolbar--hide"),t.options.toolbarConfig.pin&&this.element.classList.add("vditor-toolbar--pin"),t.options.counter.enable&&(t.counter=new ji(t),this.element.appendChild(t.counter.element))}return e.prototype.updateConfig=function(t,n){t.options.toolbarConfig=Object.assign({hide:!1,pin:!1},n),t.options.toolbarConfig.hide?this.element.classList.add("vditor-toolbar--hide"):this.element.classList.remove("vditor-toolbar--hide"),t.options.toolbarConfig.pin?this.element.classList.add("vditor-toolbar--pin"):this.element.classList.remove("vditor-toolbar--pin")},e.prototype.genItem=function(t,n,r){var i;switch(n.name){case"bold":case"italic":case"more":case"strike":case"line":case"quote":case"list":case"ordered-list":case"check":case"code":case"inline-code":case"link":case"table":i=new be(t,n);break;case"emoji":i=new Ki(t,n);break;case"headings":i=new ea(t,n);break;case"|":i=new Fi;break;case"br":i=new Oi;break;case"undo":i=new ka(t,n);break;case"redo":i=new Ea(t,n);break;case"help":i=new na(t,n);break;case"both":i=new Hi(t,n);break;case"preview":i=new ga(t,n);break;case"fullscreen":i=new Yi(t,n);break;case"upload":i=new _a(t,n);break;case"record":i=new wa(t,n);break;case"info":i=new oa(t,n);break;case"edit-mode":i=new li(t,n);break;case"devtools":i=new Wi(t,n);break;case"outdent":i=new da(t,n);break;case"indent":i=new ia(t,n);break;case"outline":i=new ha(t,n);break;case"insert-after":i=new la(t,n);break;case"insert-before":i=new ua(t,n);break;case"code-theme":i=new Ri(t,n);break;case"content-theme":i=new Pi(t,n);break;case"export":i=new Ji(t,n);break;default:i=new Vi(t,n);break}if(i){var a=n.name;return(a==="br"||a==="|")&&(a=a+r),this.elements[a]=i.element,i.element}},e})(),Ma=X(173),Ta=(function(){function e(){this.stackSize=50,this.resetStack(),this.dmp=new Ma}return e.prototype.clearStack=function(t){this.resetStack(),this.resetIcon(t)},e.prototype.resetIcon=function(t){t.toolbar&&(this[t.currentMode].undoStack.length>1?h(t.toolbar.elements,["undo"]):d(t.toolbar.elements,["undo"]),this[t.currentMode].redoStack.length!==0?h(t.toolbar.elements,["redo"]):d(t.toolbar.elements,["redo"]))},e.prototype.undo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"&&!(this[t.currentMode].undoStack.length<2)){var n=this[t.currentMode].undoStack.pop();n&&(this[t.currentMode].redoStack.push(n),this.renderDiff(n,t),this[t.currentMode].hasUndo=!0,b(t,["hint"]))}},e.prototype.redo=function(t){if(t[t.currentMode].element.getAttribute("contenteditable")!=="false"){var n=this[t.currentMode].redoStack.pop();n&&(this[t.currentMode].undoStack.push(n),this.renderDiff(n,t,!0))}},e.prototype.recordFirstPosition=function(t,n){if(getSelection().rangeCount!==0&&!(this[t.currentMode].undoStack.length!==1||this[t.currentMode].undoStack[0].length===0||this[t.currentMode].redoStack.length>0)&&!((0,l.vU)()&&n.key==="Backspace")&&!(0,l.G6)()){var r=this.addCaret(t);r.replace("<wbr>","").replace(" vditor-ir__node--expand","")===this[t.currentMode].undoStack[0][0].diffs[0][1].replace("<wbr>","")&&(this[t.currentMode].undoStack[0][0].diffs[0][1]=r,this[t.currentMode].lastText=r)}},e.prototype.addToUndoStack=function(t){var n=this.addCaret(t,!0),r=this.dmp.diff_main(n,this[t.currentMode].lastText,!0),i=this.dmp.patch_make(n,this[t.currentMode].lastText,r);i.length===0&&this[t.currentMode].undoStack.length>0||(this[t.currentMode].lastText=n,this[t.currentMode].undoStack.push(i),this[t.currentMode].undoStack.length>this.stackSize&&this[t.currentMode].undoStack.shift(),this[t.currentMode].hasUndo&&(this[t.currentMode].redoStack=[],this[t.currentMode].hasUndo=!1,d(t.toolbar.elements,["redo"])),this[t.currentMode].undoStack.length>1&&h(t.toolbar.elements,["undo"]))},e.prototype.renderDiff=function(t,n,r){r===void 0&&(r=!1);var i;if(r){var a=this.dmp.patch_deepCopy(t).reverse();a.forEach(function(u){u.diffs.forEach(function(m){m[0]=-m[0]})}),i=this.dmp.patch_apply(a,this[n.currentMode].lastText)[0]}else i=this.dmp.patch_apply(t,this[n.currentMode].lastText)[0];if(this[n.currentMode].lastText=i,n[n.currentMode].element.innerHTML=i,n.currentMode!=="sv"&&(n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview")).forEach(function(u){u.parentElement.querySelector(".language-echarts")&&(n.currentMode==="ir"?u.parentElement.outerHTML=n.lute.SpinVditorIRDOM(u.parentElement.outerHTML):u.parentElement.outerHTML=n.lute.SpinVditorDOM(u.parentElement.outerHTML))}),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){_e(u,n)})),n[n.currentMode].element.querySelector("wbr"))(0,M.ib)(n[n.currentMode].element,n[n.currentMode].element.ownerDocument.createRange()),Se(n);else{var o=getSelection().getRangeAt(0);o.setEndBefore(n[n.currentMode].element),o.collapse(!1)}Fe(n),re(n,{enableAddUndoStack:!1,enableHint:!1,enableInput:!0}),nt(n),n[n.currentMode].element.querySelectorAll(".vditor-".concat(n.currentMode,"__preview[data-render='2']")).forEach(function(u){_e(u,n)}),this[n.currentMode].undoStack.length>1?h(n.toolbar.elements,["undo"]):d(n.toolbar.elements,["undo"]),this[n.currentMode].redoStack.length!==0?h(n.toolbar.elements,["redo"]):d(n.toolbar.elements,["redo"])},e.prototype.resetStack=function(){this.ir={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.sv={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]},this.wysiwyg={hasUndo:!1,lastText:"",redoStack:[],undoStack:[]}},e.prototype.addCaret=function(t,n){n===void 0&&(n=!1);var r;if(getSelection().rangeCount!==0&&!t[t.currentMode].element.querySelector("wbr")){var i=getSelection().getRangeAt(0);if(t[t.currentMode].element.contains(i.startContainer)){r=i.cloneRange();var a=document.createElement("span");a.className="vditor-wbr",i.insertNode(a)}}var o=t[t.currentMode].element.cloneNode(!0);o.querySelectorAll(".vditor-".concat(t.currentMode,"__preview[data-render='1']")).forEach(function(m){m.firstElementChild&&(m.firstElementChild.classList.contains("language-echarts")||m.firstElementChild.classList.contains("language-plantuml")||m.firstElementChild.classList.contains("language-mindmap")?(m.firstElementChild.removeAttribute("_echarts_instance_"),m.firstElementChild.removeAttribute("data-processed"),m.firstElementChild.innerHTML=m.previousElementSibling.firstElementChild.innerHTML,m.setAttribute("data-render","2")):m.firstElementChild.classList.contains("language-math")&&(m.setAttribute("data-render","2"),m.firstElementChild.textContent=m.firstElementChild.getAttribute("data-math"),m.firstElementChild.removeAttribute("data-math")))});var u=o.innerHTML;return t[t.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function(m){m.remove()}),n&&r&&(0,M.Hc)(r),u.replace('<span class="vditor-wbr"></span>',"<wbr>")},e})(),Aa=X(673),xa=(function(){function e(t){this.defaultOptions={rtl:!1,after:void 0,cache:{enable:!0},cdn:w.g.CDN,classes:{preview:""},comment:{enable:!1},counter:{enable:!1,type:"markdown"},customRenders:[],debugger:!1,fullscreen:{index:90},height:"auto",hint:{delay:200,emoji:{"+1":"👍","-1":"👎",confused:"😕",eyes:"👀️",heart:"❤️",rocket:"🚀️",smile:"😄",tada:"🎉️"},emojiPath:"".concat(w.g.CDN,"/dist/images/emoji"),extend:[],parse:!0},icon:"ant",lang:"zh_CN",mode:"ir",outline:{enable:!1,position:"left"},placeholder:"",preview:{actions:["desktop","tablet","mobile","mp-wechat","zhihu"],delay:1e3,hljs:w.g.HLJS_OPTIONS,markdown:w.g.MARKDOWN_OPTIONS,math:w.g.MATH_OPTIONS,maxWidth:800,mode:"both",theme:w.g.THEME_OPTIONS,render:{media:{enable:!0}}},link:{isOpen:!0},image:{isPreview:!0},resize:{enable:!1,position:"bottom"},theme:"classic",toolbar:["emoji","headings","bold","italic","strike","link","|","list","ordered-list","check","outdent","indent","|","quote","line","code","inline-code","insert-before","insert-after","|","upload","record","table","|","undo","redo","|","fullscreen","edit-mode",{name:"more",toolbar:["both","code-theme","content-theme","export","outline","preview","devtools","info","help"]}],toolbarConfig:{hide:!1,pin:!1},typewriterMode:!1,undoDelay:800,upload:{extraData:{},fieldName:"file[]",filename:function(n){return n.replace(/\W/g,"")},linkToImgUrl:"",max:10*1024*1024,multiple:!0,url:"",withCredentials:!1},value:"",width:"auto"},this.options=t}return e.prototype.merge=function(){var t,n,r,i,a,o,u,m,f;this.options&&(this.options.toolbar?this.options.toolbar=this.mergeToolbar(this.options.toolbar):this.options.toolbar=this.mergeToolbar(this.defaultOptions.toolbar),!((n=(t=this.options.preview)===null||t===void 0?void 0:t.theme)===null||n===void 0)&&n.list&&(this.defaultOptions.preview.theme.list=this.options.preview.theme.list),!((a=(i=(r=this.options.preview)===null||r===void 0?void 0:r.render)===null||i===void 0?void 0:i.media)===null||a===void 0)&&a.enable&&(this.defaultOptions.preview.render.media.enable=this.options.preview.render.media.enable),!((o=this.options.hint)===null||o===void 0)&&o.emoji&&(this.defaultOptions.hint.emoji=this.options.hint.emoji),this.options.comment&&(this.defaultOptions.comment=this.options.comment),this.options.cdn&&(!((m=(u=this.options.preview)===null||u===void 0?void 0:u.theme)===null||m===void 0)&&m.path||(this.defaultOptions.preview.theme.path="".concat(this.options.cdn,"/dist/css/content-theme")),!((f=this.options.hint)===null||f===void 0)&&f.emojiPath||(this.defaultOptions.hint.emojiPath="".concat(this.options.cdn,"/dist/images/emoji"))));var S=(0,Aa.T)(this.defaultOptions,this.options);if(S.cache.enable&&!S.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");return S},e.prototype.mergeToolbar=function(t){var n=this,r=[{icon:'<svg><use xlink:href="#vditor-icon-export"></use></svg>',name:"export",tipPosition:"ne"},{hotkey:"⌘E",icon:'<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',name:"emoji",tipPosition:"ne"},{hotkey:"⌘H",icon:'<svg><use xlink:href="#vditor-icon-headings"></use></svg>',name:"headings",tipPosition:"ne"},{hotkey:"⌘B",icon:'<svg><use xlink:href="#vditor-icon-bold"></use></svg>',name:"bold",prefix:"**",suffix:"**",tipPosition:"ne"},{hotkey:"⌘I",icon:'<svg><use xlink:href="#vditor-icon-italic"></use></svg>',name:"italic",prefix:"*",suffix:"*",tipPosition:"ne"},{hotkey:"⌘D",icon:'<svg><use xlink:href="#vditor-icon-strike"></use></svg>',name:"strike",prefix:"~~",suffix:"~~",tipPosition:"ne"},{hotkey:"⌘K",icon:'<svg><use xlink:href="#vditor-icon-link"></use></svg>',name:"link",prefix:"[",suffix:"](https://)",tipPosition:"n"},{name:"|"},{hotkey:"⌘L",icon:'<svg><use xlink:href="#vditor-icon-list"></use></svg>',name:"list",prefix:"* ",tipPosition:"n"},{hotkey:"⌘O",icon:'<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',name:"ordered-list",prefix:"1. ",tipPosition:"n"},{hotkey:"⌘J",icon:'<svg><use xlink:href="#vditor-icon-check"></use></svg>',name:"check",prefix:"* [ ] ",tipPosition:"n"},{hotkey:"⇧⌘I",icon:'<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',name:"outdent",tipPosition:"n"},{hotkey:"⇧⌘O",icon:'<svg><use xlink:href="#vditor-icon-indent"></use></svg>',name:"indent",tipPosition:"n"},{name:"|"},{hotkey:"⌘;",icon:'<svg><use xlink:href="#vditor-icon-quote"></use></svg>',name:"quote",prefix:"> ",tipPosition:"n"},{hotkey:"⇧⌘H",icon:'<svg><use xlink:href="#vditor-icon-line"></use></svg>',name:"line",prefix:"---",tipPosition:"n"},{hotkey:"⌘U",icon:'<svg><use xlink:href="#vditor-icon-code"></use></svg>',name:"code",prefix:"```",suffix:"\n```",tipPosition:"n"},{hotkey:"⌘G",icon:'<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',name:"inline-code",prefix:"`",suffix:"`",tipPosition:"n"},{hotkey:"⇧⌘B",icon:'<svg><use xlink:href="#vditor-icon-before"></use></svg>',name:"insert-before",tipPosition:"n"},{hotkey:"⇧⌘E",icon:'<svg><use xlink:href="#vditor-icon-after"></use></svg>',name:"insert-after",tipPosition:"n"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-upload"></use></svg>',name:"upload",tipPosition:"n"},{icon:'<svg><use xlink:href="#vditor-icon-record"></use></svg>',name:"record",tipPosition:"n"},{hotkey:"⌘M",icon:'<svg><use xlink:href="#vditor-icon-table"></use></svg>',name:"table",prefix:"| col1",suffix:` | col2 | col3 |
246
- | --- | --- | --- |
247
- | | | |
248
- | | | |`,tipPosition:"n"},{name:"|"},{hotkey:"⌘Z",icon:'<svg><use xlink:href="#vditor-icon-undo"></use></svg>',name:"undo",tipPosition:"nw"},{hotkey:"⌘Y",icon:'<svg><use xlink:href="#vditor-icon-redo"></use></svg>',name:"redo",tipPosition:"nw"},{name:"|"},{icon:'<svg><use xlink:href="#vditor-icon-more"></use></svg>',name:"more",tipPosition:"e"},{hotkey:"⌘'",icon:'<svg><use xlink:href="#vditor-icon-fullscreen"></use></svg>',name:"fullscreen",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-edit"></use></svg>',name:"edit-mode",tipPosition:"nw"},{hotkey:"⌘P",icon:'<svg><use xlink:href="#vditor-icon-both"></use></svg>',name:"both",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-preview"></use></svg>',name:"preview",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',name:"outline",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-theme"></use></svg>',name:"content-theme",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-code-theme"></use></svg>',name:"code-theme",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-bug"></use></svg>',name:"devtools",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-info"></use></svg>',name:"info",tipPosition:"nw"},{icon:'<svg><use xlink:href="#vditor-icon-help"></use></svg>',name:"help",tipPosition:"nw"},{name:"br"}],i=[];return t.forEach(function(a){var o=a;r.forEach(function(u){typeof a=="string"&&u.name===a&&(o=u),typeof a=="object"&&u.name===a.name&&(o=Object.assign({},u,a))}),a.toolbar&&(o.toolbar=n.mergeToolbar(a.toolbar)),i.push(o)}),i},e})(),Da=(function(){function e(t){var n=this;this.composingLock=!1,this.commentIds=[];var r=document.createElement("div");r.className="vditor-wysiwyg",r.innerHTML='<pre class="vditor-reset" placeholder="'.concat(t.options.placeholder,`"
249
- contenteditable="true" spellcheck="false"></pre>
250
- <div class="vditor-panel vditor-panel--none"></div>
251
- <div class="vditor-panel vditor-panel--none">
252
- <button type="button" aria-label="`).concat(window.VditorI18n.comment,`" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
253
- <svg><use xlink:href="#vditor-icon-comment"></use></svg>
254
- </button>
255
- </div>`),this.element=r.firstElementChild,this.popover=r.firstElementChild.nextElementSibling,this.selectPopover=r.lastElementChild,this.bindEvent(t),Rt(t,this.element),fn(t,this.element),It(t,this.element),Vt(t,this.element),Ut(t,this.element),Pt(t,this.element),jt(t,this.element,this.copy),Bt(t,this.element,this.copy),t.options.comment.enable&&(this.selectPopover.querySelector("button").onclick=function(){var i=Lute.NewNodeID(),a=getSelection().getRangeAt(0),o=a.cloneRange(),u=a.extractContents(),m,f,S=!1,T=!1;u.childNodes.forEach(function(O,W){var U=!1;if(O.nodeType===3?U=!0:O.classList.contains("vditor-comment")?O.classList.contains("vditor-comment")&&O.setAttribute("data-cmtids",O.getAttribute("data-cmtids")+" "+i):U=!0,U)if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&W===0&&o.startOffset>0)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),m=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0"&&W===u.childNodes.length-1&&o.endOffset<o.endContainer.textContent.length)O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>"),f=O;else if(O.nodeType!==3&&O.getAttribute("data-block")==="0")W===0?S=!0:W===u.childNodes.length-1&&(T=!0),O.innerHTML='<span class="vditor-comment" data-cmtids="'.concat(i,'">').concat(O.innerHTML,"</span>");else{var N=document.createElement("span");N.classList.add("vditor-comment"),N.setAttribute("data-cmtids",i),O.parentNode.insertBefore(N,O),N.appendChild(O)}});var R=(0,s.F9)(o.startContainer);R&&(m?(R.insertAdjacentHTML("beforeend",m.innerHTML),m.remove()):R.textContent.trim().replace(w.g.ZWSP,"")===""&&S&&R.remove());var P=(0,s.F9)(o.endContainer);P&&(f?(P.insertAdjacentHTML("afterbegin",f.innerHTML),f.remove()):P.textContent.trim().replace(w.g.ZWSP,"")===""&&T&&P.remove()),a.insertNode(u),t.options.comment.add(i,a.toString(),n.getComments(t,!0)),pe(t,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}),n.hideComment()})}return e.prototype.getComments=function(t,n){var r=this;if(n===void 0&&(n=!1),t.currentMode==="wysiwyg"&&t.options.comment.enable){this.commentIds=[],this.element.querySelectorAll(".vditor-comment").forEach(function(a){r.commentIds=r.commentIds.concat(a.getAttribute("data-cmtids").split(" "))}),this.commentIds=Array.from(new Set(this.commentIds));var i=[];if(n)return this.commentIds.forEach(function(a){i.push({id:a,top:r.element.querySelector('.vditor-comment[data-cmtids="'.concat(a,'"]')).offsetTop})}),i}else return[]},e.prototype.triggerRemoveComment=function(t){var n=function(a,o){var u=new Set(o);return a.filter(function(m){return!u.has(m)})};if(t.currentMode==="wysiwyg"&&t.options.comment.enable&&t.wysiwyg.commentIds.length>0){var r=JSON.parse(JSON.stringify(this.commentIds));this.getComments(t);var i=n(r,this.commentIds);i.length>0&&t.options.comment.remove(i)}},e.prototype.showComment=function(){var t=(0,M.Ny)(this.element);this.selectPopover.setAttribute("style","left:".concat(t.left,"px;display:block;top:").concat(Math.max(-8,t.top-21),"px"))},e.prototype.hideComment=function(){this.selectPopover.setAttribute("style","display:none")},e.prototype.unbindListener=function(){window.removeEventListener("scroll",this.scrollListener)},e.prototype.copy=function(t,n){var r=getSelection().getRangeAt(0);if(r.toString()!==""){t.stopPropagation(),t.preventDefault();var i=(0,s.lG)(r.startContainer,"CODE"),a=(0,s.lG)(r.endContainer,"CODE");if(i&&a&&a.isSameNode(i)){var o="";i.parentElement.tagName==="PRE"?o=r.toString():o="`"+r.toString()+"`",t.clipboardData.setData("text/plain",o),t.clipboardData.setData("text/html","");return}var u=(0,s.lG)(r.startContainer,"A"),m=(0,s.lG)(r.endContainer,"A");if(u&&m&&m.isSameNode(u)){var f=u.getAttribute("title")||"";f&&(f=' "'.concat(f,'"')),t.clipboardData.setData("text/plain","[".concat(r.toString(),"](").concat(u.getAttribute("href")).concat(f,")")),t.clipboardData.setData("text/html","");return}var S=document.createElement("div");S.appendChild(r.cloneContents()),t.clipboardData.setData("text/plain",n.lute.VditorDOM2Md(S.innerHTML).trim()),t.clipboardData.setData("text/html","")}},e.prototype.bindEvent=function(t){var n=this;this.unbindListener(),window.addEventListener("scroll",this.scrollListener=function(){if(b(t,["hint"]),!(n.popover.style.display!=="block"||n.selectPopover.style.display!=="block")){var r=parseInt(n.popover.getAttribute("data-top"),10);if(t.options.height!=="auto"){if(t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0){var i=Math.max(window.scrollY-t.element.offsetTop-8,Math.min(r-t.wysiwyg.element.scrollTop,n.element.clientHeight-21))+"px";n.popover.style.display==="block"&&(n.popover.style.top=i),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=i)}return}else if(!t.options.toolbarConfig.pin)return;var a=Math.max(r,window.scrollY-t.element.offsetTop-8)+"px";n.popover.style.display==="block"&&(n.popover.style.top=a),n.selectPopover.style.display==="block"&&(n.selectPopover.style.top=a)}}),this.element.addEventListener("scroll",function(){if(b(t,["hint"]),t.options.comment&&t.options.comment.enable&&t.options.comment.scroll&&t.options.comment.scroll(t.wysiwyg.element.scrollTop),n.popover.style.display==="block"){var r=parseInt(n.popover.getAttribute("data-top"),10)-t.wysiwyg.element.scrollTop,i=-8;t.options.toolbarConfig.pin&&t.toolbar.element.getBoundingClientRect().top===0&&(i=window.scrollY-t.element.offsetTop+i);var a=Math.max(i,Math.min(r,n.element.clientHeight-21))+"px";n.popover.style.top=a,n.selectPopover.style.top=a}}),this.element.addEventListener("paste",function(r){Tt(t,r,{pasteCode:function(i){var a=(0,M.zh)(t),o=document.createElement("template");o.innerHTML=i,a.insertNode(o.content.cloneNode(!0));var u=(0,s.a1)(a.startContainer,"data-block","0");u?u.outerHTML=t.lute.SpinVditorDOM(u.outerHTML):t.wysiwyg.element.innerHTML=t.lute.SpinVditorDOM(t.wysiwyg.element.innerHTML),(0,M.ib)(t.wysiwyg.element,a)}})}),this.element.addEventListener("compositionstart",function(){n.composingLock=!0}),this.element.addEventListener("compositionend",function(r){var i=(0,k.W)(getSelection().getRangeAt(0).startContainer);if(i&&i.textContent===""){Fe(t);return}(0,l.vU)()||Ct(t,getSelection().getRangeAt(0).cloneRange(),r),n.composingLock=!1}),this.element.addEventListener("input",function(r){if(!(r.inputType==="deleteByDrag"||r.inputType==="insertFromDrop")){if(n.preventInput){n.preventInput=!1,pe(t);return}if(n.composingLock||r.data==="‘"||r.data==="“"||r.data==="《"){pe(t);return}var i=getSelection().getRangeAt(0),a=(0,s.F9)(i.startContainer);if(a||(Ht(t,i),a=(0,s.F9)(i.startContainer)),!!a){for(var o=(0,M.im)(a,t.wysiwyg.element,i).start,u=!0,m=o-1;m>a.textContent.substr(0,o).lastIndexOf(`
256
- `);m--)if(a.textContent.charAt(m)!==" "&&a.textContent.charAt(m)!==" "){u=!1;break}o===0&&(u=!1);for(var f=!0,m=o-1;m<a.textContent.length;m++)if(a.textContent.charAt(m)!==" "&&a.textContent.charAt(m)!==`
257
- `){f=!1;break}f&&/^#{1,6} $/.test(a.textContent)&&(f=!1);var S=(0,k.W)(getSelection().getRangeAt(0).startContainer);if(S&&S.textContent===""&&(Fe(t),S.remove()),u&&a.getAttribute("data-type")!=="code-block"||f||zt(a.innerHTML)||Kt(a.innerHTML)&&a.previousElementSibling){typeof t.options.input=="function"&&t.options.input(D(t));return}r.inputType==="insertParagraph"&&n.element.innerHTML==="<p><br></p><p><br></p>"&&a.previousElementSibling.remove(),Ct(t,i,r)}}}),this.element.addEventListener("click",function(r){if(r.target.tagName==="INPUT"){var i=r.target;i.checked?i.setAttribute("checked","checked"):i.removeAttribute("checked"),n.preventInput=!0,getSelection().rangeCount>0&&(0,M.Hc)(getSelection().getRangeAt(0)),pe(t);return}if(r.target.tagName==="IMG"&&!r.target.parentElement.classList.contains("vditor-wysiwyg__preview")){r.target.getAttribute("data-type")==="link-ref"?cn(t,r.target):ii(r,t);return}var a=(0,s.lG)(r.target,"A");if(a){t.options.link.click?t.options.link.click(a):t.options.link.isOpen&&window.open(a.getAttribute("href")),r.preventDefault();return}var o=(0,M.zh)(t);if(r.target.isEqualNode(n.element)&&n.element.lastElementChild&&o.collapsed){var u=n.element.lastElementChild.getBoundingClientRect();r.y>u.top+u.height&&(n.element.lastElementChild.tagName==="P"&&n.element.lastElementChild.textContent.trim().replace(w.g.ZWSP,"")===""?(o.selectNodeContents(n.element.lastElementChild),o.collapse(!1)):(n.element.insertAdjacentHTML("beforeend",'<p data-block="0">'.concat(w.g.ZWSP,"<wbr></p>")),(0,M.ib)(n.element,o)))}Ye(t);var m=(0,s.fb)(r.target,"vditor-wysiwyg__preview");m||(m=(0,s.fb)((0,M.zh)(t).startContainer,"vditor-wysiwyg__preview")),m&&ct(m,t),wt(r,t)}),this.element.addEventListener("keyup",function(r){if(!(r.isComposing||(0,l.yl)(r))){r.key==="Enter"&&Se(t),(r.key==="Backspace"||r.key==="Delete")&&t.wysiwyg.element.innerHTML!==""&&t.wysiwyg.element.childNodes.length===1&&t.wysiwyg.element.firstElementChild&&t.wysiwyg.element.firstElementChild.tagName==="P"&&t.wysiwyg.element.firstElementChild.childElementCount===0&&(t.wysiwyg.element.textContent===""||t.wysiwyg.element.textContent===`
258
- `)&&(t.wysiwyg.element.innerHTML="");var i=(0,M.zh)(t);if(r.key==="Backspace"&&(0,l.vU)()&&i.startContainer.textContent===`
259
- `&&i.startOffset===1&&(i.startContainer.textContent=""),Ht(t,i),Ye(t),!(r.key!=="ArrowDown"&&r.key!=="ArrowRight"&&r.key!=="Backspace"&&r.key!=="ArrowLeft"&&r.key!=="ArrowUp")){(r.key==="ArrowLeft"||r.key==="ArrowRight")&&t.hint.render(t);var a=(0,s.fb)(i.startContainer,"vditor-wysiwyg__preview");if(!a&&i.startContainer.nodeType!==3&&i.startOffset>0){var o=i.startContainer;o.classList.contains("vditor-wysiwyg__block")&&(a=o.lastElementChild)}if(a){var u=a.previousElementSibling;if(u.style.display==="none"){r.key==="ArrowDown"||r.key==="ArrowRight"?ct(a,t):ct(a,t,!1);return}var m=a.previousElementSibling;if(m.tagName==="PRE"&&(m=m.firstElementChild),r.key==="ArrowDown"||r.key==="ArrowRight"){var o=a.parentElement,f=ti(o);if(f&&f.nodeType!==3){var S=f.querySelector(".vditor-wysiwyg__preview");if(S){ct(S,t);return}}if(f.nodeType===3){for(;f.textContent.length===0&&f.nextSibling;)f=f.nextSibling;i.setStart(f,1)}else i.setStart(f.firstChild,0)}else i.selectNodeContents(m),i.collapse(!1)}}}})},e})(),Ha=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Oa=(function(e){Ha(t,e);function t(n,r){var i=e.call(this)||this;if(i.isDestroyed=!1,i.version=w.H,typeof n=="string"){if(r?r.cache?r.cache.id||(r.cache.id="vditor".concat(n)):r.cache={id:"vditor".concat(n)}:r={cache:{id:"vditor".concat(n)}},!document.getElementById(n))return i.showErrorTip("Failed to get element by id: ".concat(n)),i;n=document.getElementById(n)}var a=new xa(r),o=a.merge();if(o.i18n)window.VditorI18n=o.i18n,i.init(n,o);else if(["de_DE","en_US","es_ES","fr_FR","ja_JP","ko_KR","pt_BR","ru_RU","sv_SE","vi_VN","zh_CN","zh_TW"].includes(o.lang)){var u="vditorI18nScript",m=u+o.lang;document.querySelectorAll('head script[id^="'.concat(u,'"]')).forEach(function(f){f.id!==m&&document.head.removeChild(f)}),(0,A.G)("".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js"),m).then(function(){i.init(n,o)}).catch(function(f){i.showErrorTip("GET ".concat(o.cdn,"/dist/js/i18n/").concat(o.lang,".js net::ERR_ABORTED 404 (Not Found)"))})}else throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");return i}return t.prototype.showErrorTip=function(n){var r=new Vn;document.body.appendChild(r.element),r.show(n,0)},t.prototype.updateToolbarConfig=function(n){this.vditor.toolbar.updateConfig(this.vditor,n)},t.prototype.setTheme=function(n,r,i,a){this.vditor.options.theme=n,ge(this.vditor),r&&(this.vditor.options.preview.theme.current=r,(0,ee.Z)(r,a||this.vditor.options.preview.theme.path)),i&&(this.vditor.options.preview.hljs.style=i,(0,Un.Y)(i,this.vditor.options.cdn))},t.prototype.getValue=function(){return D(this.vditor)},t.prototype.getCurrentMode=function(){return this.vditor.currentMode},t.prototype.focus=function(){this.vditor.currentMode==="sv"?this.vditor.sv.element.focus():this.vditor.currentMode==="wysiwyg"?this.vditor.wysiwyg.element.focus():this.vditor.currentMode==="ir"&&this.vditor.ir.element.focus()},t.prototype.blur=function(){this.vditor.currentMode==="sv"?this.vditor.sv.element.blur():this.vditor.currentMode==="wysiwyg"?this.vditor.wysiwyg.element.blur():this.vditor.currentMode==="ir"&&this.vditor.ir.element.blur()},t.prototype.disabled=function(){b(this.vditor,["subToolbar","hint","popover"]),d(this.vditor.toolbar.elements,w.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","false")},t.prototype.enable=function(){h(this.vditor.toolbar.elements,w.g.EDIT_TOOLBARS.concat(["undo","redo","fullscreen","edit-mode"])),this.vditor.undo.resetIcon(this.vditor),this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable","true")},t.prototype.getSelection=function(){if(this.vditor.currentMode==="wysiwyg")return ft(this.vditor.wysiwyg.element);if(this.vditor.currentMode==="sv")return ft(this.vditor.sv.element);if(this.vditor.currentMode==="ir")return ft(this.vditor.ir.element)},t.prototype.renderPreview=function(n){this.vditor.preview.render(this.vditor,n)},t.prototype.getCursorPosition=function(){return(0,M.Ny)(this.vditor[this.vditor.currentMode].element)},t.prototype.isUploading=function(){return this.vditor.upload.isUploading},t.prototype.clearCache=function(){this.vditor.options.cache.enable&&(0,l.pK)()&&localStorage.removeItem(this.vditor.options.cache.id)},t.prototype.disabledCache=function(){this.vditor.options.cache.enable=!1},t.prototype.enableCache=function(){if(!this.vditor.options.cache.id)throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");this.vditor.options.cache.enable=!0},t.prototype.html2md=function(n){return this.vditor.lute.HTML2Md(n)},t.prototype.exportJSON=function(n){return this.vditor.lute.RenderJSON(n)},t.prototype.getHTML=function(){return jn(this.vditor)},t.prototype.tip=function(n,r){this.vditor.tip.show(n,r)},t.prototype.setPreviewMode=function(n){Zt(n,this.vditor)},t.prototype.deleteValue=function(){window.getSelection().isCollapsed||document.execCommand("delete",!1)},t.prototype.updateValue=function(n){document.execCommand("insertHTML",!1,n)},t.prototype.insertValue=function(n,r){r===void 0&&(r=!0);var i=(0,M.zh)(this.vditor);i.collapse(!0);var a=document.createElement("template");a.innerHTML=n,i.insertNode(a.content.cloneNode(!0)),i.collapse(!1),this.vditor.currentMode==="sv"?(this.vditor.sv.preventInput=!0,r&&le(this.vditor)):this.vditor.currentMode==="wysiwyg"?r&&Ct(this.vditor,getSelection().getRangeAt(0)):this.vditor.currentMode==="ir"&&(this.vditor.ir.preventInput=!0,r&&$e(this.vditor,getSelection().getRangeAt(0),!0))},t.prototype.insertMD=function(n){this.vditor.currentMode==="ir"?(0,M.oC)(this.vditor.lute.Md2VditorIRDOM(n),this.vditor):this.vditor.currentMode==="wysiwyg"?(0,M.oC)(this.vditor.lute.Md2VditorDOM(n),this.vditor):Wt(this.vditor,n),this.vditor.outline.render(this.vditor),re(this.vditor)},t.prototype.setValue=function(n,r){var i=this;r===void 0&&(r=!1),this.vditor.currentMode==="sv"?(this.vditor.sv.element.innerHTML="<div data-block='0'>".concat(this.vditor.lute.SpinVditorSVDOM(n),"</div>"),Le(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})):this.vditor.currentMode==="wysiwyg"?un(this.vditor,n,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1}):(this.vditor.ir.element.innerHTML=this.vditor.lute.Md2VditorIRDOM(n),this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(a){_e(a,i.vditor)}),ze(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})),this.vditor.outline.render(this.vditor),n||(b(this.vditor,["emoji","headings","submenu","hint"]),this.vditor.wysiwyg.popover&&(this.vditor.wysiwyg.popover.style.display="none"),this.clearCache()),r&&this.clearStack()},t.prototype.insertEmptyBlock=function(n){dt(this.vditor,n)},t.prototype.clearStack=function(){this.vditor.undo.clearStack(this.vditor),this.vditor.undo.addToUndoStack(this.vditor)},t.prototype.destroy=function(){this.vditor.element.innerHTML=this.vditor.originalInnerHTML,this.vditor.element.classList.remove("vditor"),this.vditor.element.removeAttribute("style");var n=document.getElementById("vditorIconScript");n&&n.remove(),this.clearCache(),on(),this.vditor.wysiwyg.unbindListener(),this.vditor.options.after=void 0,this.isDestroyed=!0},t.prototype.getCommentIds=function(){return this.vditor.currentMode!=="wysiwyg"?[]:this.vditor.wysiwyg.getComments(this.vditor,!0)},t.prototype.hlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){i.classList.remove("vditor-comment--hover"),n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.add("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.unHlCommentIds=function(n){if(this.vditor.currentMode==="wysiwyg"){var r=function(i){n.forEach(function(a){i.getAttribute("data-cmtids").indexOf(a)>-1&&i.classList.remove("vditor-comment--hover")})};this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)}),this.vditor.preview.element.style.display!=="none"&&this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(i){r(i)})}},t.prototype.removeCommentIds=function(n){var r=this;if(this.vditor.currentMode==="wysiwyg"){var i=function(a,o){var u=a.getAttribute("data-cmtids").split(" ");u.find(function(m,f){if(m===o)return u.splice(f,1),!0}),u.length===0?(a.outerHTML=a.innerHTML,(0,M.zh)(r.vditor).collapse(!0)):a.setAttribute("data-cmtids",u.join(" "))};n.forEach(function(a){r.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)}),r.vditor.preview.element.style.display!=="none"&&r.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function(o){i(o,a)})}),pe(this.vditor,{enableAddUndoStack:!0,enableHint:!1,enableInput:!1})}},t.prototype.init=function(n,r){var i=this;this.isDestroyed||(this.vditor={currentMode:r.mode,element:n,hint:new ki(r.hint.extend),lute:void 0,options:r,originalInnerHTML:n.innerHTML,outline:new Li(window.VditorI18n.outline),tip:new Vn},this.vditor.sv=new xi(this.vditor),this.vditor.undo=new Ta,this.vditor.wysiwyg=new Da(this.vditor),this.vditor.ir=new Ci(this.vditor),this.vditor.toolbar=new La(this.vditor),r.resize.enable&&(this.vditor.resize=new Ai(this.vditor)),this.vditor.toolbar.elements.devtools&&(this.vditor.devtools=new c),(r.upload.url||r.upload.handler)&&(this.vditor.upload=new pi),(0,A.G)(r._lutePath||"".concat(r.cdn,"/dist/js/lute/lute.min.js"),"vditorLuteScript").then(function(){i.vditor.lute=(0,_i.X)({autoSpace:i.vditor.options.preview.markdown.autoSpace,gfmAutoLink:i.vditor.options.preview.markdown.gfmAutoLink,codeBlockPreview:i.vditor.options.preview.markdown.codeBlockPreview,emojiSite:i.vditor.options.hint.emojiPath,emojis:i.vditor.options.hint.emoji,fixTermTypo:i.vditor.options.preview.markdown.fixTermTypo,footnotes:i.vditor.options.preview.markdown.footnotes,headingAnchor:!1,inlineMathDigit:i.vditor.options.preview.math.inlineDigit,linkBase:i.vditor.options.preview.markdown.linkBase,linkPrefix:i.vditor.options.preview.markdown.linkPrefix,listStyle:i.vditor.options.preview.markdown.listStyle,mark:i.vditor.options.preview.markdown.mark,mathBlockPreview:i.vditor.options.preview.markdown.mathBlockPreview,paragraphBeginningSpace:i.vditor.options.preview.markdown.paragraphBeginningSpace,sanitize:i.vditor.options.preview.markdown.sanitize,toc:i.vditor.options.preview.markdown.toc}),i.vditor.preview=new Ti(i.vditor),Re(i.vditor),r.after&&r.after(),r.icon&&(0,A.J)("".concat(r.cdn,"/dist/js/icons/").concat(r.icon,".js"),"vditorIconScript")}))},t})(I.default);const Na=Oa})(),we=we.default,we})()})})(yt)),yt.exports}var Xn=Jn();const Yn=$n(Xn),Qn={class:"sus-comment relative flex flex-row w-full"},er={key:0,class:"sus-comment__main absolute top-1 left-1 flex space-x-2 w-full"},tr={key:1,class:"sus-comment-avatar"},nr=["src"],rr={class:"sus-comment__main"},ir={class:"sus-comment__info my-1"},ar={key:0,class:"sus-comment__info-input"},or=["placeholder"],sr=["aria-label"],lr=["placeholder"],cr=["aria-label"],ur=["placeholder"],fr=["id"],dr={class:"sus-comment__footer flex justify-between"},pr={class:"flex items-center"},hr=["aria-label"],mr={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},gr={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},yr=L.defineComponent({__name:"index",props:{vId:{default:"sus-vditor"},editor:{},reply:{},infoBar:{},comment:{}},emits:["on-save","on-cancel","update-avatar"],setup(q,{emit:Me}){class se{articleId="";userName="";userEmail="";userWebsite="";userAvatar="";content="";contentMD="";replyName="";parentId="";notify=1}const Q=q,X=Me,we=Q.reply.userName,I=L.reactive(new se),w=L.ref(null),C=L.ref(""),D=L.ref(""),A=L.ref(""),c=L.ref(""),l=L.ref("收到回复后通知"),g=L.ref(!0),p={enable:Q.infoBar?.enable,name:{show:Q.infoBar?.name?.show,placeholder:Q.infoBar?.name?.placeholder||"昵称(必填)"},website:{show:Q.infoBar?.website?.show,placeholder:Q.infoBar?.website?.placeholder||"网址(https://)",tips:Q.infoBar?.website?.tips||"点击昵称时可跳转"},email:{show:Q.infoBar?.email?.show,placeholder:Q.infoBar?.email?.placeholder||"邮箱(不会公开,仅用于通知回复)",tips:Q.infoBar?.email?.tips||"输入QQ邮箱自动获取头像"}},h={placeholder:Q.editor?.placeholder||"支持常见的markdown语法,如图片、代码块等",emojis:Q.editor?.emojis||[],toolBar:Q.editor?.toolBar||["emoji","link","code","inline-code"],hljs:Q.editor?.hljs||["java","html","javascript","typescript"],cache:Q.editor?.cache==null?!0:Q.editor.cache,cdn:Q.editor?.cdn||"https://unpkg.com/vditor@3.11.2"};function d(){Q.comment&&(I.notify=Q.comment.notify||1,I.userName=Q.comment.userName||"",I.userEmail=Q.comment.userEmail||"",I.userWebsite=Q.comment.userWebsite||"",I.userAvatar=Q.comment.userAvatar||"",I.content=Q.comment.content||"",I.articleId=Q.comment.articleId||"",I.notify==0&&(l.value="收到回复后不通知"))}async function E(){if(!w.value){X("on-save",I);return}if(C.value=w.value?.getHTML(),D.value=w.value?.getValue(),I.userWebsite&&(I.userWebsite.concat("http://")||I.userWebsite.concat("https://")||(I.userWebsite="https://"+I.userWebsite)),localStorage.setItem("user",JSON.stringify(I)),Q.reply.id!="0"){const x=Q.reply.parentId;I.parentId=x==="0"?Q.reply.id:x,I.replyName=Q.reply.userName,h.placeholder="@"+we+":"}I.content=C.value,I.contentMD=D.value,X("on-save",I),A.value="",w.value.setValue("")}function v(){X("on-cancel")}function b(){w.value=new Yn(Q.vId,{after:()=>{},placeholder:h.placeholder,theme:"classic",cache:{enable:h.cache},icon:"material",cdn:h.cdn,toolbar:h.toolBar,hint:{emoji:h.emojis},preview:{hljs:{enable:!0,style:"base16-snazzy",langs:h.hljs}}})}function y(){X("update-avatar",I)}function s(){I.notify==1?(I.notify=0,l.value="收到回复后不通知"):(I.notify=1,l.value="收到回复后通知")}function k(){const x=setInterval(function(){document.querySelector(".vditor-content")&&(clearInterval(x),g.value=!1)},100)}return L.onMounted(()=>{b(),k(),d();const x=localStorage.getItem("user");if(x){const H=JSON.parse(x);I.userName=H.userName,I.userEmail=H.userEmail,I.userWebsite=H.userWebsite,y()}}),(x,H)=>(L.openBlock(),L.createElementBlock("div",Qn,[g.value?(L.openBlock(),L.createElementBlock("div",er,[...H[3]||(H[3]=[L.createStaticVNode('<div class="animate-pulse bg-gray-300 h-12 w-12 rounded-full" data-v-477ecb90></div><div class="space-y-2 w-4/5 mt-3" data-v-477ecb90><div class="animate-pulse rounded-md bg-gray-300 h-4 w-full" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-full" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-10/12" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-10/12" data-v-477ecb90></div><div class="animate-pulse rounded-md bg-gray-300 h-4 w-8/12" data-v-477ecb90></div></div>',2)])])):L.createCommentVNode("",!0),p.enable?L.withDirectives((L.openBlock(),L.createElementBlock("div",tr,[L.createElementVNode("img",{alt:"",src:c.value,class:"sus-avatar",onerror:"this.onerror=null,this.src='' +''"},null,8,nr)],512)),[[L.vShow,!g.value]]):L.createCommentVNode("",!0),L.createElementVNode("div",rr,[L.withDirectives(L.createElementVNode("div",ir,[p.name.show?(L.openBlock(),L.createElementBlock("div",ar,[L.withDirectives(L.createElementVNode("input",{class:"sus-input sus-username",placeholder:p.name.placeholder,"onUpdate:modelValue":H[0]||(H[0]=_=>I.userName=_),maxlength:"23"},null,8,or),[[L.vModelText,I.userName]])])):L.createCommentVNode("",!0),p.website.show?(L.openBlock(),L.createElementBlock("div",{key:1,class:"sus-comment__info-input vditor-tooltipped vditor-tooltipped__n","aria-label":p.website.tips},[L.withDirectives(L.createElementVNode("input",{class:"sus-input sus-web",placeholder:p.website.placeholder,"onUpdate:modelValue":H[1]||(H[1]=_=>I.userWebsite=_),maxlength:"35"},null,8,lr),[[L.vModelText,I.userWebsite]])],8,sr)):L.createCommentVNode("",!0),p.email.show?(L.openBlock(),L.createElementBlock("div",{key:2,class:"sus-comment__info-input vditor-tooltipped vditor-tooltipped__n","aria-label":p.email.tips},[L.withDirectives(L.createElementVNode("input",{onBlur:y,class:"sus-input sus-email",placeholder:p.email.placeholder,"onUpdate:modelValue":H[2]||(H[2]=_=>I.userEmail=_),maxlength:"35"},null,40,ur),[[L.vModelText,I.userEmail]])],8,cr)):L.createCommentVNode("",!0)],512),[[L.vShow,!g.value]]),L.createElementVNode("div",{id:q.vId,class:"sus-comment__editor h-full w-full"},null,8,fr),L.withDirectives(L.createElementVNode("div",dr,[L.createElementVNode("div",pr,[L.createElementVNode("div",{onClick:s,class:"sus-comment__footer-notify vditor-tooltipped vditor-tooltipped__ne p-1 opacity-70","aria-label":l.value},[I.notify==0?(L.openBlock(),L.createElementBlock("svg",mr,[...H[4]||(H[4]=[L.createElementVNode("path",{fill:"currentColor",d:"M17.5 13a4.5 4.5 0 0 0-4.5 4.5a4.5 4.5 0 0 0 4.5 4.5a4.5 4.5 0 0 0 4.5-4.5a4.5 4.5 0 0 0-4.5-4.5m0 1.5a3 3 0 0 1 3 3a3 3 0 0 1-.42 1.5L16 14.92a3 3 0 0 1 1.5-.42M14.92 16L19 20.08a3 3 0 0 1-1.5.42a3 3 0 0 1-3-3a3 3 0 0 1 .42-1.5M12 2c-1.1 0-2 .9-2 2v.29C7.12 5.14 5 7.82 5 11v6l-2 2v1h8.5a6.5 6.5 0 0 1-.47-2H7v-7a5 5 0 0 1 5-5a5 5 0 0 1 5 5a7 7 0 0 1 .5 0a6.5 6.5 0 0 1 1.5.18V11c0-3.18-2.12-5.86-5-6.71V4a2 2 0 0 0-2-2m-2 19a2 2 0 0 0 2 2c.5 0 .97-.19 1.33-.5a6.5 6.5 0 0 1-1.3-1.5Z"},null,-1)])])):(L.openBlock(),L.createElementBlock("svg",gr,[...H[5]||(H[5]=[L.createStaticVNode('<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" data-v-477ecb90><g data-v-477ecb90><path stroke-dasharray="4" stroke-dashoffset="4" d="M12 3V5" data-v-477ecb90><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.2s" values="4;0" data-v-477ecb90></animate></path><path stroke-dasharray="28" stroke-dashoffset="28" d="M12 5C8.68629 5 6 7.68629 6 11L6 17C5 17 4 18 4 19H12M12 5C15.3137 5 18 7.68629 18 11L18 17C19 17 20 18 20 19H12" data-v-477ecb90><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.2s" dur="0.4s" values="28;0" data-v-477ecb90></animate></path><animateTransform attributeName="transform" begin="0.8s" dur="6s" keyTimes="0;0.05;0.15;0.2;1" repeatCount="indefinite" type="rotate" values="0 12 3;3 12 3;-3 12 3;0 12 3;0 12 3" data-v-477ecb90></animateTransform></g><path stroke-dasharray="8" stroke-dashoffset="8" d="M10 20C10 21.1046 10.8954 22 12 22C13.1046 22 14 21.1046 14 20" data-v-477ecb90><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="8;0" data-v-477ecb90></animate><animateTransform attributeName="transform" begin="1s" dur="6s" keyTimes="0;0.05;0.15;0.2;1" repeatCount="indefinite" type="rotate" values="0 12 8;6 12 8;-6 12 8;0 12 8;0 12 8" data-v-477ecb90></animateTransform></path></g>',1)])]))],8,hr)]),L.createElementVNode("div",{class:"sus-comment__footer-send flex justify-end my-2"},[L.createElementVNode("button",{class:"sus-button cancel mx-2",onClick:v},"取消"),L.createElementVNode("button",{class:"sus-button ok",onClick:E},"发送")])],512),[[L.vShow,!g.value]])])]))}}),st=(q,Me)=>{const se=q.__vccOpts||q;for(const[Q,X]of Me)se[Q]=X;return se},en=st(yr,[["__scopeId","data-v-477ecb90"]]);function br(q){const Me=new Date(q),se=Me.getFullYear(),Q=Me.getMonth()+1,X=Me.getDate(),we=new Date,I=we.getFullYear(),w=we.getMonth()+1,C=we.getDate();if(I===se&&w==Q){const D=C-X;if(D===0)return"今天";if(D<7)return D+"天前"}return I===se?`${Q}月${X}日`:`${se}年${Q}月${X}日`}const wr={class:"sus-item__container relative"},vr={class:"flex flex-row"},Er={class:"sus-item__operate absolute flex"},Sr={class:"sus-comment-aside"},kr={class:"sus-comment-avatar"},Cr=["src"],_r={class:"sus-item__main w-full overflow-hidden"},Lr={class:"sus-item__user leading-loose"},Mr=["rel","href"],Tr={key:0,class:"sus-item-tag mx-1",title:"博主"},Ar={key:1,class:"sus-item__content-name mx-1.5"},xr={class:"sus-item__user-date ml-3"},Dr={class:"sus-item__content"},Hr=["innerHTML"],Or={key:0,class:"sus-item__info flex justify-end mx-1 -mt-1"},Nr={class:"sus-item__info-ip flex items-center"},bt=st(L.defineComponent({__name:"item",props:{comment:{},lineHeight:{},showFooter:{type:Boolean,default:!0}},emits:["on-reply","on-edit","on-remove"],setup(q,{emit:Me}){const se=q,Q=L.ref(),X=L.ref(),we=L.ref(!1);se.comment.showReply=se.comment.showReply===void 0?!0:se.comment.showReply;const I=Me;function w(){Q.value.style.display="block",we.value=!1}function C(){const p=Q?.value?.clientHeight||0,h=se.lineHeight*5;p>=h&&(we.value=!0)}function D(){I("on-reply",se.comment)}function A(){I("on-edit",se.comment)}function c(){I("on-remove",se.comment)}function l(){se.comment.userAvatar||(se.comment.userAvatar="/error.webp")}function g(){const p=new Date(se.comment?.createdDate),h=new Date,d=new Date(h.getFullYear()-1,h.getMonth(),h.getDate());return p>d?"ugc noopener nofollow":"ugc noopener noreferrer nofollow"}return L.onMounted(()=>{l(),C()}),(p,h)=>(L.openBlock(),L.createElementBlock("div",wr,[L.createElementVNode("div",vr,[L.createElementVNode("div",Er,[L.withDirectives(L.createElementVNode("span",{onClick:c,class:"sus-item__operate-delete cursor-pointer"}," 删除 ",512),[[L.vShow,q.comment.showDelete]]),L.withDirectives(L.createElementVNode("span",{onClick:A,class:"sus-item__operate-edit cursor-pointer"}," 编辑 ",512),[[L.vShow,q.comment.showEdit]]),L.withDirectives(L.createElementVNode("span",{onClick:D,class:"sus-item__operate-reply cursor-pointer"}," 回复 ",512),[[L.vShow,q.comment.showReply]])]),L.createElementVNode("div",Sr,[L.createElementVNode("div",kr,[L.withDirectives(L.createElementVNode("img",{alt:"",class:"sus-avatar",src:q.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,Cr),[[L.vShow,!!q.comment.userAvatar]]),L.withDirectives(L.createElementVNode("span",{class:"sus-avatar-text flex w-full h-full items-center justify-center"},L.toDisplayString(q.comment.userName.charAt(0)),513),[[L.vShow,!q.comment.userAvatar]])])]),L.createElementVNode("div",_r,[L.createElementVNode("div",Lr,[L.createElementVNode("a",{target:"_blank",rel:g(),href:q.comment.userWebsite,class:L.normalizeClass([q.comment.tagName,"sus-item__user-name font-semibold ml-1 cursor-pointer"])},L.toDisplayString(q.comment.userName),11,Mr),q.comment.tagName==="owner"?(L.openBlock(),L.createElementBlock("span",Tr," 博主 ")):L.createCommentVNode("",!0),q.comment.replyName?(L.openBlock(),L.createElementBlock("span",Ar,"@"+L.toDisplayString(q.comment.replyName),1)):L.createCommentVNode("",!0),L.createElementVNode("span",xr,L.toDisplayString(L.unref(br)(q.comment.createdDate)),1)]),L.createElementVNode("div",Dr,[L.createElementVNode("span",{ref_key:"contentDom",ref:Q,class:"sus-item__content-text",innerHTML:q.comment.content},null,8,Hr),we.value?(L.openBlock(),L.createElementBlock("a",{key:0,ref_key:"showMoreDom",ref:X,class:"sus-show-detail my-1.5 cursor-pointer",onClick:w},"显示更多>",512)):L.createCommentVNode("",!0)])])]),q.showFooter&&q.comment.area?(L.openBlock(),L.createElementBlock("div",Or,[L.createElementVNode("span",Nr,[h[0]||(h[0]=L.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 28 28"},[L.createElementVNode("path",{fill:"currentColor",d:"M14 2.25A9.75 9.75 0 0 1 23.75 12c0 4.12-2.895 8.61-8.61 13.518a1.75 1.75 0 0 1-2.283-.002l-.378-.328C7.017 20.408 4.25 16.028 4.25 12A9.75 9.75 0 0 1 14 2.25m0 1.5A8.25 8.25 0 0 0 5.75 12c0 3.502 2.548 7.537 7.714 12.057l.373.323a.25.25 0 0 0 .326 0c5.416-4.652 8.087-8.795 8.087-12.38A8.25 8.25 0 0 0 14 3.75m0 4.5a3.75 3.75 0 1 1 0 7.5a3.75 3.75 0 0 1 0-7.5m0 1.5a2.25 2.25 0 1 0 0 4.5a2.25 2.25 0 0 0 0-4.5"})],-1)),L.createTextVNode(" "+L.toDisplayString(q.comment.area),1)])])):L.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-7ef78641"]]),Rr={class:"sus-comment__item"},Ir={key:0,class:"sus-comment__item-child"},Pr={key:1},jr={key:0,class:"sus-comment__item-footer flex justify-center w-full cursor-pointer"},tn=st(L.defineComponent({__name:"index",props:{comment:{},lineHeight:{default:23},showFooter:{type:Boolean,default:!0}},emits:["on-reply","on-edit","on-remove"],setup(q,{emit:Me}){const se=L.ref(!1),Q=Me;function X(w){Q("on-reply",w)}function we(w){Q("on-edit",w)}function I(w){Q("on-remove",w)}return(w,C)=>(L.openBlock(),L.createElementBlock("div",Rr,[L.createVNode(bt,{comment:q.comment,onOnReply:C[0]||(C[0]=D=>X(q.comment)),onOnEdit:C[1]||(C[1]=D=>we(q.comment)),onOnRemove:C[2]||(C[2]=D=>I(q.comment)),lineHeight:q.lineHeight,showFooter:q.showFooter},null,8,["comment","lineHeight","showFooter"]),q.comment.child?.length>0?(L.openBlock(),L.createElementBlock("div",Ir,[L.createVNode(bt,{onOnReply:C[3]||(C[3]=D=>X(q.comment.child[0])),onOnEdit:C[4]||(C[4]=D=>we(q.comment.child[0])),onOnRemove:C[5]||(C[5]=D=>I(q.comment.child[0])),comment:q.comment.child[0],showFooter:q.showFooter,lineHeight:q.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"]),q.comment.child?.length>1?(L.openBlock(),L.createBlock(bt,{key:0,onOnReply:C[6]||(C[6]=D=>X(q.comment.child[1])),onOnEdit:C[7]||(C[7]=D=>we(q.comment.child[1])),onOnRemove:C[8]||(C[8]=D=>I(q.comment.child[1])),comment:q.comment.child[1],showFooter:q.showFooter,lineHeight:q.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"])):L.createCommentVNode("",!0),q.comment.child?.length>2?(L.openBlock(),L.createElementBlock("div",Pr,[se.value?L.createCommentVNode("",!0):(L.openBlock(),L.createElementBlock("div",jr,[L.createElementVNode("p",{class:"sus-load-more",onClick:C[9]||(C[9]=D=>se.value=!0)}," 查看更多回复 > ")])),se.value?(L.openBlock(!0),L.createElementBlock(L.Fragment,{key:1},L.renderList(q.comment.child.slice(2),(D,A)=>(L.openBlock(),L.createBlock(bt,{onOnReply:c=>X(D),onOnEdit:c=>we(D),onOnRemove:c=>I(D),key:A,comment:D,showFooter:q.showFooter,lineHeight:q.lineHeight,class:"sus-comment__item-child__item"},null,8,["onOnReply","onOnEdit","onOnRemove","comment","showFooter","lineHeight"]))),128)):L.createCommentVNode("",!0)])):L.createCommentVNode("",!0)])):L.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-b7810121"]]),Br={class:"sus-top-item flex items-start p-1.5 overflow-hidden"},Vr={class:"sus-top-item__info flex flex-col mr-1"},Ur={class:"sus-top-item__user whitespace-nowrap"},Wr={key:0,class:"sus-top-item__reply whitespace-nowrap"},Fr=["innerHTML"],nn=st(L.defineComponent({__name:"simple",props:{comment:{}},setup(q){return(Me,se)=>(L.openBlock(),L.createElementBlock("div",Br,[L.createElementVNode("div",Vr,[L.createElementVNode("span",Ur,L.toDisplayString(q.comment.userName)+": ",1),q.comment.replyName?(L.openBlock(),L.createElementBlock("span",Wr,L.toDisplayString("@"+q.comment.replyName),1)):L.createCommentVNode("",!0)]),L.createElementVNode("span",{class:"sus-top-item__content w-full",innerHTML:q.comment.content},null,8,Fr)]))}}),[["__scopeId","data-v-7407d86d"]]),qr={class:"sus-top-item__user flex items-center"},Kr={key:0,class:"sus-top-item__user-avatar ml-1 mr-2"},zr=["src"],Gr={class:"sus-top-item__user-owner"},$r={class:"sus-top-item__user-reply ml-3 opacity-70"},Zr=["innerHTML"],rn=st(L.defineComponent({__name:"index",props:{comment:{}},emits:["go-local"],setup(q,{emit:Me}){const se=Me;function Q(){se("go-local")}return(X,we)=>(L.openBlock(),L.createElementBlock("div",{class:"sus-top-item p-1.5 cursor-pointer overflow-hidden",onClick:Q},[L.createElementVNode("div",qr,[q.comment.userAvatar?(L.openBlock(),L.createElementBlock("div",Kr,[L.createElementVNode("img",{alt:"",class:"sus-avatar",loading:"lazy",decoding:"async",src:q.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,zr)])):L.createCommentVNode("",!0),L.createElementVNode("div",Gr,L.toDisplayString(q.comment.userName),1),L.createElementVNode("div",$r,L.toDisplayString(q.comment.replyName?"@"+q.comment.replyName:""),1)]),L.createElementVNode("div",{class:"sus-top-item__content p-1",innerHTML:q.comment.content},null,8,Zr)]))}}),[["__scopeId","data-v-1e2f9488"]]),Jr=[en,tn,rn,nn],Xr={install(q){Jr.forEach(Me=>{q.component(Me.name,Me)})}};Ue.SuSComment=en,Ue.SuSList=tn,Ue.SuSSimpleTop=nn,Ue.SuSTop=rn,Ue.default=Xr,Object.defineProperties(Ue,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
67
+ }
68
+
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+
73
+ .ProseMirror-hideselection *::-moz-selection {
74
+ background: transparent;
75
+ }
76
+
77
+ .ProseMirror-hideselection * {
78
+ caret-color: transparent;
79
+ }
80
+
81
+ .ProseMirror-focused .ProseMirror-gapcursor {
82
+ display: block;
83
+ }`;function Cy(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Ey=class extends Hm{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=pd(t,this.options.autofocus);this.editorState=On.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Cy(Sy,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=Qc(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(l=>!l.key.startsWith(o))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[Md,gd.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Sd,Td,Od,Ad,Ed,Nd,Cd].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new di(i,this)}createCommandManager(){this.commandManager=new Qr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=ao(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=ao(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Ac(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(d)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),s=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=r.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),a=l?.getMeta("focus"),c=l?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),c&&this.emit("blur",{editor:this,event:c.event,transaction:l}),!(e.getMeta("preventUpdate")||!r.some(d=>d.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return od(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return eg(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return fo(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
84
+
85
+ `,textSerializers:r={}}=e||{};return id(this.state.doc,{blockSeparator:t,textSerializers:{...po(this.schema),...r}})}get isEmpty(){return si(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new xy(t,this)}get $doc(){return this.$pos(0)}};function Bn(n){return new oi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=ee(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),d=c+o.length;if(yo(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;d<t.to&&s.delete(d,t.to),c>t.from&&s.delete(t.from+a,c);const f=t.from+a+o.length;s.addMark(t.from+a,f,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Dd(n){return new oi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=ee(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>l?d=l:l=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(d,l,a)}else if(r[0]){const c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:n.undoable})}function Eo(n){return new oi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=ee(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function _n(n){return new oi({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=ee(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&Cs(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||u.$to.parentOffset&&u.$from.marks();if(p){const g=p.filter(y=>h.includes(y.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&$t(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}function My(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof B){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function vy(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((l,a)=>{const c=s.mapping.map(a),d=s.mapping.map(a)+l.nodeSize;let u=null;if(l.marks.forEach(h=>{if(h!==o)return!1;u=h}),!u)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==u.attrs[h]&&(f=!0)}),f){const h=n.type.create({...n.attrs,...t});s.removeMark(c,d,n.type),s.addMark(c,d,h)}}),s.docChanged&&e.view.dispatch(s)}var $e=class Lf extends xo{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Lf(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Ty=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,r,i,s,o,l;const{view:a}=this.editor,c=n.target,d=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(c)||!d)return;let u=0,f=0;if(this.dom!==d){const k=this.dom.getBoundingClientRect(),C=d.getBoundingClientRect(),D=(i=n.offsetX)!=null?i:(r=n.nativeEvent)==null?void 0:r.offsetX,M=(o=n.offsetY)!=null?o:(s=n.nativeEvent)==null?void 0:s.offsetY;u=C.x-k.x+D,f=C.y-k.y+M}const h=this.dom.cloneNode(!0);try{const k=this.dom.getBoundingClientRect();h.style.width=`${Math.round(k.width)}px`,h.style.height=`${Math.round(k.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(l=n.dataTransfer)==null||l.setDragImage(h,u,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=B.create(a.state.doc,g),w=a.state.tr.setSelection(y);a.dispatch(w)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=n.type.startsWith("drag"),s=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!s&&!i)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,d=B.isSelectable(this.node),u=n.type==="copy",f=n.type==="paste",h=n.type==="cut",p=n.type==="mousedown";if(!c&&d&&i&&n.target===this.dom&&n.preventDefault(),c&&i&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(c&&l&&!a&&p){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||u||f||h||p&&d)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(ui()||bd())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function bn(n){return new ag({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=ee(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const d=a.search(/\S/),u=t.from+a.indexOf(l),f=u+l.length;if(yo(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===n.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;f<t.to&&o.delete(f,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+l.length,o.addMark(t.from+d,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function Rd(n){return m.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var Oy=class extends Ey{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Rd(this.view.state),this.reactiveExtensionStorage=Rd(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),m.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Ny=m.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=m.ref(),t=m.getCurrentInstance();return m.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&m.nextTick(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.firstChild))return;const s=m.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),m.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return m.h("div",{ref:n=>{this.rootEl=n}})}}),Ay=m.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return m.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Dy=m.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return m.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}}),Ry=(n={})=>{const e=m.shallowRef();return m.onMounted(()=>{e.value=new Oy(n)}),m.onBeforeUnmount(()=>{var t,r,i;const s=(t=e.value)==null?void 0:t.view.dom,o=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(o,s),(i=e.value)==null||i.destroy()}),e},Iy=class{constructor(n,{props:e={},editor:t}){this.editor=t,this.component=m.markRaw(n),this.el=document.createElement("div"),this.props=m.reactive(e),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var n,e,t,r;return(e=(n=this.renderedComponent.vNode)==null?void 0:n.component)!=null&&e.exposed?this.renderedComponent.vNode.component.exposed:(r=(t=this.renderedComponent.vNode)==null?void 0:t.component)==null?void 0:r.proxy}renderComponent(){let n=m.h(this.component,this.props);return this.editor.appContext&&(n.appContext=this.editor.appContext),typeof document<"u"&&this.el&&m.render(n,this.el),{vNode:n,destroy:()=>{this.el&&m.render(null,this.el),this.el=null,n=null},el:this.el?this.el.firstElementChild:null}}updateProps(n={}){Object.entries(n).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}};m.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return m.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var Py=class extends Ty{mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(r={})=>this.updateAttributes(r),deleteNode:()=>this.deleteNode()},e=this.onDragStart.bind(this);this.decorationClasses=m.ref(this.getDecorationClasses());const t=m.defineComponent({extends:{...this.component},props:Object.keys(n),template:this.component.template,setup:r=>{var i,s;return m.provide("onDragStart",e),m.provide("decorationClasses",this.decorationClasses),(s=(i=this.component).setup)==null?void 0:s.call(i,r,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new Iy(t,{editor:this.editor,props:n})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(n,e,t){const r=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:s,newNode:n,newDecorations:e,oldInnerDecorations:o,innerDecorations:t,updateProps:()=>r({node:n,decorations:e,innerDecorations:t})})}return n.type!==this.node.type?!1:(n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,r({node:n,decorations:e,innerDecorations:t})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(n=>n.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}};function Ly(n,e){return t=>{if(!t.editor.contentComponent)return{};const r=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new Py(r,t,e)}}const By={key:0,class:"sus-emoji-panel"},_y=["onClick","src","alt","title"],Vy=m.defineComponent({__name:"index",props:{emoji:{},editor:{}},setup(n){const e=n;function t(r){e.editor?.commands.insertContent({type:"emoji",attrs:{name:r.name,src:r.fallbackImage}}),e.emoji.showPanel=!1}return(r,i)=>(m.openBlock(),m.createBlock(m.Transition,{name:"slide-up"},{default:m.withCtx(()=>[n.emoji.showPanel?(m.openBlock(),m.createElementBlock("div",By,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(n.emoji.emojis,s=>(m.openBlock(),m.createElementBlock("div",null,[m.createElementVNode("img",{onClick:o=>t(s),class:"sus-emoji-item",src:s.fallbackImage,alt:s.name,title:`:${s.name}:`},null,8,_y)]))),256))])):m.createCommentVNode("",!0)]),_:1}))}}),Yt=(n,e)=>{const t=n.__vccOpts||n;for(const[r,i]of e)t[r]=i;return t},$y=Yt(Vy,[["__scopeId","data-v-a444a71e"]]);var fi=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},zy=/^\s*>\s$/,Hy=$e.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return fi("blockquote",{...ce(this.options.HTMLAttributes,n),children:fi("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[_n({find:zy,type:this.type})]}}),Fy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,jy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Uy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Wy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ky=yn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return fi("strong",{...ce(this.options.HTMLAttributes,n),children:fi("slot",{})})},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Bn({find:Fy,type:this.type}),Bn({find:Uy,type:this.type})]},addPasteRules(){return[bn({find:jy,type:this.type}),bn({find:Wy,type:this.type})]}}),qy=/(^|[^`])`([^`]+)`(?!`)$/,Jy=/(^|[^`])`([^`]+)`(?!`)/g,Gy=yn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Bn({find:qy,type:this.type})]},addPasteRules(){return[bn({find:Jy,type:this.type})]}}),Mo=4,Yy=/^```([a-z]+)?[\s\n]$/,Xy=/^~~~([a-z]+)?[\s\n]$/,Id=$e.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Mo,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ce(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Mo,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(t);return o?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:c,to:d}=i,h=r.doc.textBetween(c,d,`
86
+ `,`
87
+ `).split(`
88
+ `).map(p=>l+p).join(`
89
+ `);return a.replaceWith(c,d,r.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Mo,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:l})=>{var a;const{pos:c}=s,d=s.start(),u=s.end(),h=r.doc.textBetween(d,u,`
90
+ `,`
91
+ `).split(`
92
+ `);let p=0,g=0;const y=c-d;for(let P=0;P<h.length;P+=1){if(g+h[P].length>=y){p=P;break}g+=h[P].length+1}const k=((a=h[p].match(/^ */))==null?void 0:a[0])||"",C=Math.min(k.length,t);if(C===0)return!0;let D=d;for(let P=0;P<p;P+=1)D+=h[P].length+1;return l.delete(D,D+C),c-D<=C&&l.setSelection(F.create(l.doc,D)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:c}=i,f=r.doc.textBetween(a,c,`
93
+ `,`
94
+ `).split(`
95
+ `).map(h=>{var p;const g=((p=h.match(/^ */))==null?void 0:p[0])||"",y=Math.min(g.length,t);return h.slice(y)}).join(`
96
+ `);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
97
+
98
+ `);return!s||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(H.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Eo({find:Yy,type:this.type,getAttributes:n=>({language:n[1]})}),Eo({find:Xy,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new se({key:new le("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
99
+ `));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(F.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),Qy=Id,Zy=$e.create({name:"doc",topNode:!0,content:"block+"}),e0=$e.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ce(this.options.HTMLAttributes,n)]},renderText(){return`
100
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&o){const u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),t0=$e.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,ce(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Eo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),n0=$e.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ce(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!My(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return fd(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(F.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(B.create(o.doc,a.pos)):o.setSelection(F.create(o.doc,a.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,u=d?.create();u&&(o.insert(c,u),o.setSelection(F.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Dd({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),r0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,i0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,s0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,o0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,l0=yn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Bn({find:r0,type:this.type}),Bn({find:s0,type:this.type})]},addPasteRules(){return[bn({find:i0,type:this.type}),bn({find:o0,type:this.type})]}});const a0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",c0="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",vo="numeric",To="ascii",Oo="alpha",pr="asciinumeric",mr="alphanumeric",No="domain",Pd="emoji",d0="scheme",u0="slashscheme",Ao="whitespace";function f0(n,e){return n in e||(e[n]=[]),e[n]}function wn(n,e,t){e[vo]&&(e[pr]=!0,e[mr]=!0),e[To]&&(e[pr]=!0,e[Oo]=!0),e[pr]&&(e[mr]=!0),e[Oo]&&(e[mr]=!0),e[mr]&&(e[No]=!0),e[Pd]&&(e[No]=!0);for(const r in e){const i=f0(r,t);i.indexOf(n)<0&&i.push(n)}}function h0(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Fe(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Fe.groups={},Fe.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||Fe.groups;let i;return e&&e.j?i=e:(i=new Fe(e),t&&r&&wn(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||Fe.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,l=i.go(n);if(l?(o=new Fe,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new Fe,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(h0(o.t,r),t);wn(s,a,r)}else t&&wn(s,t,r);o.t=s}return i.j[n]=o,o}};const G=(n,e,t,r,i)=>n.ta(e,t,r,i),ue=(n,e,t,r,i)=>n.tr(e,t,r,i),Ld=(n,e,t,r,i)=>n.ts(e,t,r,i),E=(n,e,t,r,i)=>n.tt(e,t,r,i),Tt="WORD",Do="UWORD",Bd="ASCIINUMERICAL",_d="ALPHANUMERICAL",gr="LOCALHOST",Ro="TLD",Io="UTLD",hi="SCHEME",Vn="SLASH_SCHEME",Po="NUM",Lo="WS",Bo="NL",yr="OPENBRACE",br="CLOSEBRACE",pi="OPENBRACKET",mi="CLOSEBRACKET",gi="OPENPAREN",yi="CLOSEPAREN",bi="OPENANGLEBRACKET",wi="CLOSEANGLEBRACKET",ki="FULLWIDTHLEFTPAREN",xi="FULLWIDTHRIGHTPAREN",Si="LEFTCORNERBRACKET",Ci="RIGHTCORNERBRACKET",Ei="LEFTWHITECORNERBRACKET",Mi="RIGHTWHITECORNERBRACKET",vi="FULLWIDTHLESSTHAN",Ti="FULLWIDTHGREATERTHAN",Oi="AMPERSAND",Ni="APOSTROPHE",Ai="ASTERISK",Xt="AT",Di="BACKSLASH",Ri="BACKTICK",Ii="CARET",Qt="COLON",_o="COMMA",Pi="DOLLAR",ct="DOT",Li="EQUALS",Vo="EXCLAMATION",Qe="HYPHEN",wr="PERCENT",Bi="PIPE",_i="PLUS",Vi="POUND",kr="QUERY",$o="QUOTE",Vd="FULLWIDTHMIDDLEDOT",zo="SEMI",dt="SLASH",xr="TILDE",$i="UNDERSCORE",$d="EMOJI",zi="SYM";var zd=Object.freeze({__proto__:null,ALPHANUMERICAL:_d,AMPERSAND:Oi,APOSTROPHE:Ni,ASCIINUMERICAL:Bd,ASTERISK:Ai,AT:Xt,BACKSLASH:Di,BACKTICK:Ri,CARET:Ii,CLOSEANGLEBRACKET:wi,CLOSEBRACE:br,CLOSEBRACKET:mi,CLOSEPAREN:yi,COLON:Qt,COMMA:_o,DOLLAR:Pi,DOT:ct,EMOJI:$d,EQUALS:Li,EXCLAMATION:Vo,FULLWIDTHGREATERTHAN:Ti,FULLWIDTHLEFTPAREN:ki,FULLWIDTHLESSTHAN:vi,FULLWIDTHMIDDLEDOT:Vd,FULLWIDTHRIGHTPAREN:xi,HYPHEN:Qe,LEFTCORNERBRACKET:Si,LEFTWHITECORNERBRACKET:Ei,LOCALHOST:gr,NL:Bo,NUM:Po,OPENANGLEBRACKET:bi,OPENBRACE:yr,OPENBRACKET:pi,OPENPAREN:gi,PERCENT:wr,PIPE:Bi,PLUS:_i,POUND:Vi,QUERY:kr,QUOTE:$o,RIGHTCORNERBRACKET:Ci,RIGHTWHITECORNERBRACKET:Mi,SCHEME:hi,SEMI:zo,SLASH:dt,SLASH_SCHEME:Vn,SYM:zi,TILDE:xr,TLD:Ro,UNDERSCORE:$i,UTLD:Io,UWORD:Do,WORD:Tt,WS:Lo});const Ot=/[a-z]/,Sr=new RegExp("\\p{L}","u"),Ho=new RegExp("\\p{Emoji}","u"),Nt=/\d/,Fo=/\s/,Hd="\r",jo=`
101
+ `,p0="️",m0="‍",Uo="";let Hi=null,Fi=null;function g0(n=[]){const e={};Fe.groups=e;const t=new Fe;Hi==null&&(Hi=jd(a0)),Fi==null&&(Fi=jd(c0)),E(t,"'",Ni),E(t,"{",yr),E(t,"}",br),E(t,"[",pi),E(t,"]",mi),E(t,"(",gi),E(t,")",yi),E(t,"<",bi),E(t,">",wi),E(t,"(",ki),E(t,")",xi),E(t,"「",Si),E(t,"」",Ci),E(t,"『",Ei),E(t,"』",Mi),E(t,"<",vi),E(t,">",Ti),E(t,"&",Oi),E(t,"*",Ai),E(t,"@",Xt),E(t,"`",Ri),E(t,"^",Ii),E(t,":",Qt),E(t,",",_o),E(t,"$",Pi),E(t,".",ct),E(t,"=",Li),E(t,"!",Vo),E(t,"-",Qe),E(t,"%",wr),E(t,"|",Bi),E(t,"+",_i),E(t,"#",Vi),E(t,"?",kr),E(t,'"',$o),E(t,"/",dt),E(t,";",zo),E(t,"~",xr),E(t,"_",$i),E(t,"\\",Di),E(t,"・",Vd);const r=ue(t,Nt,Po,{[vo]:!0});ue(r,Nt,r);const i=ue(r,Ot,Bd,{[pr]:!0}),s=ue(r,Sr,_d,{[mr]:!0}),o=ue(t,Ot,Tt,{[To]:!0});ue(o,Nt,i),ue(o,Ot,o),ue(i,Nt,i),ue(i,Ot,i);const l=ue(t,Sr,Do,{[Oo]:!0});ue(l,Ot),ue(l,Nt,s),ue(l,Sr,l),ue(s,Nt,s),ue(s,Ot),ue(s,Sr,s);const a=E(t,jo,Bo,{[Ao]:!0}),c=E(t,Hd,Lo,{[Ao]:!0}),d=ue(t,Fo,Lo,{[Ao]:!0});E(t,Uo,d),E(c,jo,a),E(c,Uo,d),ue(c,Fo,d),E(d,Hd),E(d,jo),ue(d,Fo,d),E(d,Uo,d);const u=ue(t,Ho,$d,{[Pd]:!0});E(u,"#"),ue(u,Ho,u),E(u,p0,u);const f=E(u,m0);E(f,"#"),ue(f,Ho,u);const h=[[Ot,o],[Nt,i]],p=[[Ot,null],[Sr,l],[Nt,s]];for(let g=0;g<Hi.length;g++)Zt(t,Hi[g],Ro,Tt,h);for(let g=0;g<Fi.length;g++)Zt(t,Fi[g],Io,Do,p);wn(Ro,{tld:!0,ascii:!0},e),wn(Io,{utld:!0,alpha:!0},e),Zt(t,"file",hi,Tt,h),Zt(t,"mailto",hi,Tt,h),Zt(t,"http",Vn,Tt,h),Zt(t,"https",Vn,Tt,h),Zt(t,"ftp",Vn,Tt,h),Zt(t,"ftps",Vn,Tt,h),wn(hi,{scheme:!0,ascii:!0},e),wn(Vn,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[d0]:!0}:{[u0]:!0};y.indexOf("-")>=0?k[No]=!0:Ot.test(y)?Nt.test(y)?k[pr]=!0:k[To]=!0:k[vo]=!0,Ld(t,y,y,k)}return Ld(t,"localhost",gr,{ascii:!0}),t.jd=new Fe(zi),{start:t,tokens:Object.assign({groups:e},zd)}}function Fd(n,e){const t=y0(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let l=n,a=null,c=0,d=null,u=-1,f=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(u=0,f=0,d=l):u>=0&&(u+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=f,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function y0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function Zt(n,e,t,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?s=n.j[a]:(s=new Fe(r),s.jr=i.slice(),n.j[a]=s),n=s}return s=new Fe(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function jd(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Cr={defaultProtocol:"http",events:null,format:Ud,formatHref:Ud,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Wo(n,e=null){let t=Object.assign({},Cr);n&&(t=Object.assign(t,n instanceof Wo?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Wo.prototype={o:Cr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Cr[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Ud(n){return n}function Wd(n,e){this.t="token",this.v=n,this.tk=e}Wd.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Cr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function ji(n,e){class t extends Wd{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Kd=ji("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),qd=ji("text"),b0=ji("nl"),Ui=ji("url",{isLink:!0,toHref(n=Cr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==gr&&n[1].t===Qt}}),Ze=n=>new Fe(n);function w0({groups:n}){const e=n.domain.concat([Oi,Ai,Xt,Di,Ri,Ii,Pi,Li,Qe,Po,wr,Bi,_i,Vi,dt,zi,xr,$i]),t=[Ni,Qt,_o,ct,Vo,wr,kr,$o,zo,bi,wi,yr,br,mi,pi,gi,yi,ki,xi,Si,Ci,Ei,Mi,vi,Ti],r=[Oi,Ni,Ai,Di,Ri,Ii,Pi,Li,Qe,yr,br,wr,Bi,_i,Vi,kr,dt,zi,xr,$i],i=Ze(),s=E(i,xr);G(s,r,s),G(s,n.domain,s);const o=Ze(),l=Ze(),a=Ze();G(i,n.domain,o),G(i,n.scheme,l),G(i,n.slashscheme,a),G(o,r,s),G(o,n.domain,o);const c=E(o,Xt);E(s,Xt,c),E(l,Xt,c),E(a,Xt,c);const d=E(s,ct);G(d,r,s),G(d,n.domain,s);const u=Ze();G(c,n.domain,u),G(u,n.domain,u);const f=E(u,ct);G(f,n.domain,u);const h=Ze(Kd);G(f,n.tld,h),G(f,n.utld,h),E(c,gr,h);const p=E(u,Qe);E(p,Qe,p),G(p,n.domain,u),G(h,n.domain,u),E(h,ct,f),E(h,Qe,p);const g=E(h,Qt);G(g,n.numeric,Kd);const y=E(o,Qe),w=E(o,ct);E(y,Qe,y),G(y,n.domain,o),G(w,r,s),G(w,n.domain,o);const k=Ze(Ui);G(w,n.tld,k),G(w,n.utld,k),G(k,n.domain,o),G(k,r,s),E(k,ct,w),E(k,Qe,y),E(k,Xt,c);const C=E(k,Qt),D=Ze(Ui);G(C,n.numeric,D);const M=Ze(Ui),P=Ze();G(M,e,M),G(M,t,P),G(P,e,M),G(P,t,P),E(k,dt,M),E(D,dt,M);const T=E(l,Qt),V=E(a,Qt),K=E(V,dt),j=E(K,dt);G(l,n.domain,o),E(l,ct,w),E(l,Qe,y),G(a,n.domain,o),E(a,ct,w),E(a,Qe,y),G(T,n.domain,M),E(T,dt,M),E(T,kr,M),G(j,n.domain,M),G(j,e,M),E(j,dt,M);const U=[[yr,br],[pi,mi],[gi,yi],[bi,wi],[ki,xi],[Si,Ci],[Ei,Mi],[vi,Ti]];for(let R=0;R<U.length;R++){const[X,Z]=U[R],ke=E(M,X);E(P,X,ke),E(ke,Z,M);const he=Ze(Ui);G(ke,e,he);const pe=Ze();G(ke,t),G(he,e,he),G(he,t,pe),G(pe,e,he),G(pe,t,pe),E(he,Z,M),E(pe,Z,M)}return E(i,gr,k),E(i,Bo,b0),{start:i,tokens:zd}}function k0(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,c=null,d=0,u=null,f=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(f=0,u=l):f>=0&&f++,i++,d++;if(f<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Ko(qd,e,o)),o=[]),i-=f,d-=f;const h=u.t,p=t.slice(i-d,i);s.push(Ko(h,e,p))}}return o.length>0&&s.push(Ko(qd,e,o)),s}function Ko(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const x0=typeof console<"u"&&console&&console.warn||(()=>{}),S0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",oe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function C0(){return Fe.groups={},oe.scanner=null,oe.parser=null,oe.tokenQueue=[],oe.pluginQueue=[],oe.customSchemes=[],oe.initialized=!1,oe}function Jd(n,e=!1){if(oe.initialized&&x0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${S0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
102
+ 1. Must only contain digits, lowercase ASCII letters or "-"
103
+ 2. Cannot start or end with "-"
104
+ 3. "-" cannot repeat`);oe.customSchemes.push([n,e])}function E0(){oe.scanner=g0(oe.customSchemes);for(let n=0;n<oe.tokenQueue.length;n++)oe.tokenQueue[n][1]({scanner:oe.scanner});oe.parser=w0(oe.scanner.tokens);for(let n=0;n<oe.pluginQueue.length;n++)oe.pluginQueue[n][1]({scanner:oe.scanner,parser:oe.parser});return oe.initialized=!0,oe}function qo(n){return oe.initialized||E0(),k0(oe.parser.start,n,Fd(oe.scanner.start,n))}qo.scan=Fd;function Gd(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Wo(t),i=qo(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var Jo="[\0-   ᠎ -\u2029  ]",M0=new RegExp(Jo),v0=new RegExp(`${Jo}$`),T0=new RegExp(Jo,"g");function O0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function N0(n){return new se({key:new le("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Yc(t.doc,[...e]);if(ld(l).forEach(({newRange:c})=>{const d=jm(r.doc,c,h=>h.isTextblock);let u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!v0.test(h))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){const h=f.split(M0).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=u.pos+f.lastIndexOf(p);if(!p)return!1;const y=qo(p).map(w=>w.toObject(n.defaultProtocol));if(!O0(y))return!1;y.filter(w=>w.isLink).map(w=>({...w,from:g+w.start+1,to:g+w.end+1})).filter(w=>r.schema.marks.code?!r.doc.rangeHasMark(w.from,w.to,r.schema.marks.code):!0).filter(w=>n.validate(w.value)).filter(w=>n.shouldAutoLink(w.value)).forEach(w=>{yo(w.from,w.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(w.from,w.to,n.type.create({href:w.href}))})}}),!!o.steps.length)return o}})}function A0(n){return new se({key:new le("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;o=u.find(f=>f.nodeName==="A")}if(!o)return!1;const l=od(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,c=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,c),!0):!1}}})}function D0(n){return new se({key:new le("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=Gd(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:n.editor.commands.setMark(n.type,{href:a.href})}}})}function kn(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(T0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yd=yn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Jd(n);return}Jd(n.scheme,n.optionalSlashes)})},onDestroy(){C0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!kn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!kn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!kn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ce(this.options.HTMLAttributes,n),0]:["a",ce(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[bn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Gd(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!kn(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(N0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!kn(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(A0({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(D0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),R0=Yd,I0=Object.defineProperty,P0=(n,e)=>{for(var t in e)I0(n,t,{get:e[t],enumerable:!0})},L0="listItem",Xd="textStyle",Qd=/^\s*([-+*])\s$/,Zd=$e.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(L0,this.editor.getAttributes(Xd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=_n({find:Qd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:Qd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Xd),editor:this.editor})),[n]}}),eu=$e.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ce(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),B0={};P0(B0,{findListItemPos:()=>Er,getNextListDepth:()=>Go,handleBackspace:()=>Yo,handleDelete:()=>Xo,hasListBefore:()=>tu,hasListItemAfter:()=>_0,hasListItemBefore:()=>nu,listItemHasSubList:()=>ru,nextListIsDeeper:()=>iu,nextListIsHigher:()=>su});var Er=(n,e)=>{const{$from:t}=e.selection,r=be(n,e.schema);let i=null,s=t.depth,o=t.pos,l=null;for(;s>0&&l===null;)i=t.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},Go=(n,e)=>{const t=Er(n,e);if(!t)return!1;const[,r]=Qm(e,n,t.$pos.pos+4);return r},tu=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},nu=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},ru=(n,e,t)=>{if(!t)return!1;const r=be(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},Yo=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Gt(n.state,e)&&tu(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},u.end()).joinForward().run()}if(!Gt(n.state,e)||!ng(n.state))return!1;const r=Er(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=ru(e,n.state,s);return nu(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},iu=(n,e)=>{const t=Go(n,e),r=Er(n,e);return!r||!t?!1:t>r.depth},su=(n,e)=>{const t=Go(n,e),r=Er(n,e);return!r||!t?!1:t<r.depth},Xo=(n,e)=>{if(!Gt(n.state,e)||!tg(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:iu(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():su(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},_0=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},ou=de.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Xo(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Xo(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Yo(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Yo(n,t,r)&&(e=!0)}),e}}}}),V0="listItem",lu="textStyle",au=/^(\d+)\.\s$/,cu=$e.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ce(this.options.HTMLAttributes,t),0]:["ol",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V0,this.editor.getAttributes(lu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=_n({find:au,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:au,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(lu)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),$0=/^\s*(\[([( |x])?\])\s$/,z0=$e.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var u,f;l.ariaLabel=((f=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:f.call(u,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(n),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u)}),{dom:i,contentDOM:a,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[_n({find:$0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),H0=$e.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ce(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});de.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Zd.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(eu.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(ou.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(cu.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(z0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(H0.configure(this.options.taskList)),n}});var F0=$e.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),j0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,U0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,W0=yn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Bn({find:j0,type:this.type})]},addPasteRules(){return[bn({find:U0,type:this.type})]}}),K0=$e.create({name:"text",group:"inline"}),q0=yn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function J0(n={}){return new se({view(e){return new G0(e,n)}})}class G0{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=u?p.bottom:p.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,h=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=aa(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fe extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return fe.valid(r)?new fe(r):H.near(r)}content(){return N.empty}eq(e){return e instanceof fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new fe(e.resolve(t.pos))}getBookmark(){return new Qo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Y0(e)||!X0(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(fe.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!B.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(fe.valid(l))return l}return null}}}fe.prototype.visible=!1,fe.findFrom=fe.findGapCursorFrom,H.jsonID("gapcursor",fe);class Qo{constructor(e){this.pos=e}map(e){return new Qo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return fe.valid(t)?new fe(t):H.near(t)}}function Y0(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function X0(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Q0(){return new se({props:{decorations:nb,createSelectionBetween(n,e,t){return e.pos==t.pos&&fe.valid(t)?new fe(t):null},handleClick:eb,handleKeyDown:Z0,handleDOMEvents:{beforeinput:tb}}})}const Z0=no({ArrowLeft:Wi("horiz",-1),ArrowRight:Wi("horiz",1),ArrowUp:Wi("vert",-1),ArrowDown:Wi("vert",1)});function Wi(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof F){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=fe.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new fe(c))),!0):!1}}function eb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!fe.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&B.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new fe(r))),!0)}function tb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof fe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=S.empty;for(let o=r.length-1;o>=0;o--)i=S.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new N(i,0,0));return s.setSelection(F.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function nb(n){if(!(n.selection instanceof fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[Ie.widget(n.selection.head,e,{key:"gapcursor"})])}var Ki=200,Ee=function(){};Ee.prototype.append=function(e){return e.length?(e=Ee.from(e),!this.length&&e||e.length<Ki&&this.leafAppend(e)||this.length<Ki&&e.leafPrepend(this)||this.appendInner(e)):this},Ee.prototype.prepend=function(e){return e.length?Ee.from(e).append(this):this},Ee.prototype.appendInner=function(e){return new rb(this,e)},Ee.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ee.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ee.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ee.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ee.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i},Ee.from=function(e){return e instanceof Ee?e:e&&e.length?new du(e):Ee.empty};var du=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ki)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ki)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ee);Ee.empty=new du([]);var rb=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ee);const ib=500;class nt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new ut(u.map));let h=u.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new ut(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new nt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new ut(e.mapping.maps[d],u,t),h;(h=a&&a.merge(f))&&(f=h,d?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-r.depth;return c>ob&&(l=sb(l,c),o-=c),new nt(l.append(s),o)}remapping(e,t){let r=new Qn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(t=>new ut(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(a+1,h));y&&l++,r.push(new ut(p,g,y))}else r.push(new ut(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new ut(s.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new nt(d,l);return u.emptyItemCount()>ib&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new ut(c.invert(),a,d),f,h=i.length-1;(f=i.length&&i[h].merge(u))?i[h]=f:i.push(u)}}else o.map&&r--},this.items.length,0),new nt(Ee.from(i.reverse()),s)}}nt.empty=new nt(Ee.empty,0);function sb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class ut{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ut(t.getMap().invert(),t,this.selection)}}}class en{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const ob=20;function lb(n,e,t,r){let i=t.getMeta(xn),s;if(i)return i.historyState;t.getMeta(db)&&(n=new en(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(xn))return o.getMeta(xn).redo?new en(n.done.addTransform(t,void 0,r,qi(e)),n.undone,uu(t.mapping.maps),n.prevTime,n.prevComposition):new en(n.done,n.undone.addTransform(t,void 0,r,qi(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!ab(t,n.prevRanges)),c=o?Zo(n.prevRanges,t.mapping):uu(t.mapping.maps);return new en(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,qi(e)),nt.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new en(n.done.rebased(t,s),n.undone.rebased(t,s),Zo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new en(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Zo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function ab(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function uu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Zo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function cb(n,e,t){let r=qi(e),i=xn.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new en(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(xn,{redo:t,historyState:a})}let el=!1,fu=null;function qi(n){let e=n.plugins;if(fu!=e){el=!1,fu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){el=!0;break}}return el}const xn=new le("history"),db=new le("closeHistory");function ub(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new se({key:xn,state:{init(){return new en(nt.empty,nt.empty,null,0,-1)},apply(e,t,r){return lb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?pu:r=="historyRedo"?mu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function hu(n,e){return(t,r)=>{let i=xn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=cb(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const pu=hu(!1,!0),mu=hu(!0,!0);de.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new se({key:new le("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var fb=de.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[J0(this.options)]}});de.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new se({key:new le("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return ae.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(n,s)}}})]}});var hb=de.create({name:"gapCursor",addProseMirrorPlugins(){return[Q0()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ee($(n,"allowGapCursor",t)))!=null?e:null}}}),pb=de.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new se({key:new le("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,l)=>{const a=r>=l&&r<=l+o.nodeSize,c=!o.isLeaf&&si(o);if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=Ie.node(l,l+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),ae.create(n,i)}}})]}});de.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new se({key:new le("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||fd(t.selection)||n.view.dragging?null:ae.create(t.doc,[Ie.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function gu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var mb=de.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new le(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new se({key:n,appendTransaction:(t,r,i)=>{const{doc:s,tr:o,schema:l}=i,a=n.getState(i),c=s.content.size,d=l.nodes[this.options.node];if(a)return o.insert(c,d.create())},state:{init:(t,r)=>{const i=r.tr.doc.lastChild;return!gu({node:i,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const i=t.doc.lastChild;return!gu({node:i,types:e})}}})]}}),gb=de.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>pu(n,e),redo:()=>({state:n,dispatch:e})=>mu(n,e)}},addProseMirrorPlugins(){return[ub(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yb=de.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(Ky.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Hy.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Zd.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Gy.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Id.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Zy.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(fb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(hb.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(e0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(t0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(gb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(n0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(l0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(eu.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(ou.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(Yd.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(cu.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(F0.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(W0.configure(this.options.strike)),this.options.text!==!1&&i.push(K0.configure(this.options.text)),this.options.underline!==!1&&i.push(q0.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(mb.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),bb=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,wb=$e.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",ce(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Dd({find:bb,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),kb=wb;const yu=["top","right","bottom","left"],bu=["start","end"],wu=yu.reduce((n,e)=>n.concat(e,e+"-"+bu[0],e+"-"+bu[1]),[]),ft=Math.min,ze=Math.max,Ji=Math.round,ht=n=>({x:n,y:n}),xb={left:"right",right:"left",bottom:"top",top:"bottom"},Sb={start:"end",end:"start"};function tl(n,e,t){return ze(n,ft(e,t))}function At(n,e){return typeof n=="function"?n(e):n}function et(n){return n.split("-")[0]}function rt(n){return n.split("-")[1]}function ku(n){return n==="x"?"y":"x"}function nl(n){return n==="y"?"height":"width"}const Cb=new Set(["top","bottom"]);function pt(n){return Cb.has(et(n))?"y":"x"}function rl(n){return ku(pt(n))}function xu(n,e,t){t===void 0&&(t=!1);const r=rt(n),i=rl(n),s=nl(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Yi(o)),[o,Yi(o)]}function Eb(n){const e=Yi(n);return[Gi(n),e,Gi(e)]}function Gi(n){return n.replace(/start|end/g,e=>Sb[e])}const Su=["left","right"],Cu=["right","left"],Mb=["top","bottom"],vb=["bottom","top"];function Tb(n,e,t){switch(n){case"top":case"bottom":return t?e?Cu:Su:e?Su:Cu;case"left":case"right":return e?Mb:vb;default:return[]}}function Ob(n,e,t,r){const i=rt(n);let s=Tb(et(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Gi)))),s}function Yi(n){return n.replace(/left|right|bottom|top/g,e=>xb[e])}function Nb(n){return{top:0,right:0,bottom:0,left:0,...n}}function il(n){return typeof n!="number"?Nb(n):{top:n,right:n,bottom:n,left:n}}function $n(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Eu(n,e,t){let{reference:r,floating:i}=n;const s=pt(e),o=rl(e),l=nl(o),a=et(e),c=s==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let h;switch(a){case"top":h={x:d,y:r.y-i.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(rt(e)){case"start":h[o]-=f*(t&&c?-1:1);break;case"end":h[o]+=f*(t&&c?-1:1);break}return h}const Ab=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:u}=Eu(c,r,a),f=r,h={},p=0;for(let g=0;g<l.length;g++){const{name:y,fn:w}=l[g],{x:k,y:C,data:D,reset:M}=await w({x:d,y:u,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});d=k??d,u=C??u,h={...h,[y]:{...h[y],...D}},M&&p<=50&&(p++,typeof M=="object"&&(M.placement&&(f=M.placement),M.rects&&(c=M.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):M.rects),{x:d,y:u}=Eu(c,f,a)),g=-1)}return{x:d,y:u,placement:f,strategy:i,middlewareData:h}};async function zn(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=At(e,n),p=il(h),y=l[f?u==="floating"?"reference":"floating":u],w=$n(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:a})),k=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),D=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},M=$n(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:C,strategy:a}):k);return{top:(w.top-M.top+p.top)/D.y,bottom:(M.bottom-w.bottom+p.bottom)/D.y,left:(w.left-M.left+p.left)/D.x,right:(M.right-w.right+p.right)/D.x}}const Db=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:a}=e,{element:c,padding:d=0}=At(n,e)||{};if(c==null)return{};const u=il(d),f={x:t,y:r},h=rl(i),p=nl(h),g=await o.getDimensions(c),y=h==="y",w=y?"top":"left",k=y?"bottom":"right",C=y?"clientHeight":"clientWidth",D=s.reference[p]+s.reference[h]-f[h]-s.floating[p],M=f[h]-s.reference[h],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=P?P[C]:0;(!T||!await(o.isElement==null?void 0:o.isElement(P)))&&(T=l.floating[C]||s.floating[p]);const V=D/2-M/2,K=T/2-g[p]/2-1,j=ft(u[w],K),U=ft(u[k],K),R=j,X=T-g[p]-U,Z=T/2-g[p]/2+V,ke=tl(R,Z,X),he=!a.arrow&&rt(i)!=null&&Z!==ke&&s.reference[p]/2-(Z<R?j:U)-g[p]/2<0,pe=he?Z<R?Z-R:Z-X:0;return{[h]:f[h]+pe,data:{[h]:ke,centerOffset:Z-ke-pe,...he&&{alignmentOffset:pe}},reset:he}}});function Rb(n,e,t){return(n?[...t.filter(i=>rt(i)===n),...t.filter(i=>rt(i)!==n)]:t.filter(i=>et(i)===i)).filter(i=>n?rt(i)===n||(e?Gi(i)!==i:!1):!0)}const Ib=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:s,middlewareData:o,placement:l,platform:a,elements:c}=e,{crossAxis:d=!1,alignment:u,allowedPlacements:f=wu,autoAlignment:h=!0,...p}=At(n,e),g=u!==void 0||f===wu?Rb(u||null,h,f):f,y=await zn(e,p),w=((t=o.autoPlacement)==null?void 0:t.index)||0,k=g[w];if(k==null)return{};const C=xu(k,s,await(a.isRTL==null?void 0:a.isRTL(c.floating)));if(l!==k)return{reset:{placement:g[0]}};const D=[y[et(k)],y[C[0]],y[C[1]]],M=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:D}],P=g[w+1];if(P)return{data:{index:w+1,overflows:M},reset:{placement:P}};const T=M.map(j=>{const U=rt(j.placement);return[j.placement,U&&d?j.overflows.slice(0,2).reduce((R,X)=>R+X,0):j.overflows[0],j.overflows]}).sort((j,U)=>j[1]-U[1]),K=((i=T.filter(j=>j[2].slice(0,rt(j[0])?2:3).every(U=>U<=0))[0])==null?void 0:i[0])||T[0][0];return K!==l?{data:{index:w+1,overflows:M},reset:{placement:K}}:{}}}},Pb=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=At(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const w=et(i),k=pt(l),C=et(l)===l,D=await(a.isRTL==null?void 0:a.isRTL(c.floating)),M=f||(C||!g?[Yi(l)]:Eb(l)),P=p!=="none";!f&&P&&M.push(...Ob(l,g,p,D));const T=[l,...M],V=await zn(e,y),K=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&K.push(V[w]),u){const Z=xu(i,o,D);K.push(V[Z[0]],V[Z[1]])}if(j=[...j,{placement:i,overflows:K}],!K.every(Z=>Z<=0)){var U,R;const Z=(((U=s.flip)==null?void 0:U.index)||0)+1,ke=T[Z];if(ke&&(!(u==="alignment"?k!==pt(ke):!1)||j.every(Me=>pt(Me.placement)===k?Me.overflows[0]>0:!0)))return{data:{index:Z,overflows:j},reset:{placement:ke}};let he=(R=j.filter(pe=>pe.overflows[0]<=0).sort((pe,Me)=>pe.overflows[1]-Me.overflows[1])[0])==null?void 0:R.placement;if(!he)switch(h){case"bestFit":{var X;const pe=(X=j.filter(Me=>{if(P){const yt=pt(Me.placement);return yt===k||yt==="y"}return!0}).map(Me=>[Me.placement,Me.overflows.filter(yt=>yt>0).reduce((yt,pl)=>yt+pl,0)]).sort((Me,yt)=>Me[1]-yt[1])[0])==null?void 0:X[0];pe&&(he=pe);break}case"initialPlacement":he=l;break}if(i!==he)return{reset:{placement:he}}}return{}}}};function Mu(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function vu(n){return yu.some(e=>n[e]>=0)}const Lb=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=At(n,e);switch(r){case"referenceHidden":{const s=await zn(e,{...i,elementContext:"reference"}),o=Mu(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:vu(o)}}}case"escaped":{const s=await zn(e,{...i,altBoundary:!0}),o=Mu(s,t.floating);return{data:{escapedOffsets:o,escaped:vu(o)}}}default:return{}}}}};function Tu(n){const e=ft(...n.map(s=>s.left)),t=ft(...n.map(s=>s.top)),r=ze(...n.map(s=>s.right)),i=ze(...n.map(s=>s.bottom));return{x:e,y:t,width:r-e,height:i-t}}function Bb(n){const e=n.slice().sort((i,s)=>i.y-s.y),t=[];let r=null;for(let i=0;i<e.length;i++){const s=e[i];!r||s.y-r.y>r.height/2?t.push([s]):t[t.length-1].push(s),r=s}return t.map(i=>$n(Tu(i)))}const _b=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:s,strategy:o}=e,{padding:l=2,x:a,y:c}=At(n,e),d=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),u=Bb(d),f=$n(Tu(d)),h=il(l);function p(){if(u.length===2&&u[0].left>u[1].right&&a!=null&&c!=null)return u.find(y=>a>y.left-h.left&&a<y.right+h.right&&c>y.top-h.top&&c<y.bottom+h.bottom)||f;if(u.length>=2){if(pt(t)==="y"){const j=u[0],U=u[u.length-1],R=et(t)==="top",X=j.top,Z=U.bottom,ke=R?j.left:U.left,he=R?j.right:U.right,pe=he-ke,Me=Z-X;return{top:X,bottom:Z,left:ke,right:he,width:pe,height:Me,x:ke,y:X}}const y=et(t)==="left",w=ze(...u.map(j=>j.right)),k=ft(...u.map(j=>j.left)),C=u.filter(j=>y?j.left===k:j.right===w),D=C[0].top,M=C[C.length-1].bottom,P=k,T=w,V=T-P,K=M-D;return{top:D,bottom:M,left:P,right:T,width:V,height:K,x:P,y:D}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:o});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},Vb=new Set(["left","top"]);async function $b(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=et(t),l=rt(t),a=pt(t)==="y",c=Vb.has(o)?-1:1,d=s&&a?-1:1,u=At(e,n);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*d,y:f*c}:{x:f*c,y:h*d}}const zb=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await $b(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},Hb=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...a}=At(n,e),c={x:t,y:r},d=await zn(e,a),u=pt(et(i)),f=ku(u);let h=c[f],p=c[u];if(s){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",k=h+d[y],C=h-d[w];h=tl(k,h,C)}if(o){const y=u==="y"?"top":"left",w=u==="y"?"bottom":"right",k=p+d[y],C=p-d[w];p=tl(k,p,C)}const g=l.fn({...e,[f]:h,[u]:p});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:s,[u]:o}}}}}},Fb=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:a=()=>{},...c}=At(n,e),d=await zn(e,c),u=et(i),f=rt(i),h=pt(i)==="y",{width:p,height:g}=s.floating;let y,w;u==="top"||u==="bottom"?(y=u,w=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(w=u,y=f==="end"?"top":"bottom");const k=g-d.top-d.bottom,C=p-d.left-d.right,D=ft(g-d[y],k),M=ft(p-d[w],C),P=!e.middlewareData.shift;let T=D,V=M;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(V=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(T=k),P&&!f){const j=ze(d.left,0),U=ze(d.right,0),R=ze(d.top,0),X=ze(d.bottom,0);h?V=p-2*(j!==0||U!==0?j+U:ze(d.left,d.right)):T=g-2*(R!==0||X!==0?R+X:ze(d.top,d.bottom))}await a({...e,availableWidth:V,availableHeight:T});const K=await o.getDimensions(l.floating);return p!==K.width||g!==K.height?{reset:{rects:!0}}:{}}}};function Xi(){return typeof window<"u"}function Hn(n){return Ou(n)?(n.nodeName||"").toLowerCase():"#document"}function Ke(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Dt(n){var e;return(e=(Ou(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Ou(n){return Xi()?n instanceof Node||n instanceof Ke(n).Node:!1}function it(n){return Xi()?n instanceof Element||n instanceof Ke(n).Element:!1}function mt(n){return Xi()?n instanceof HTMLElement||n instanceof Ke(n).HTMLElement:!1}function Nu(n){return!Xi()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ke(n).ShadowRoot}const jb=new Set(["inline","contents"]);function Mr(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=st(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!jb.has(i)}const Ub=new Set(["table","td","th"]);function Wb(n){return Ub.has(Hn(n))}const Kb=[":popover-open",":modal"];function Qi(n){return Kb.some(e=>{try{return n.matches(e)}catch{return!1}})}const qb=["transform","translate","scale","rotate","perspective"],Jb=["transform","translate","scale","rotate","perspective","filter"],Gb=["paint","layout","strict","content"];function sl(n){const e=ol(),t=it(n)?st(n):n;return qb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Jb.some(r=>(t.willChange||"").includes(r))||Gb.some(r=>(t.contain||"").includes(r))}function Yb(n){let e=tn(n);for(;mt(e)&&!Fn(e);){if(sl(e))return e;if(Qi(e))return null;e=tn(e)}return null}function ol(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Xb=new Set(["html","body","#document"]);function Fn(n){return Xb.has(Hn(n))}function st(n){return Ke(n).getComputedStyle(n)}function Zi(n){return it(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tn(n){if(Hn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Nu(n)&&n.host||Dt(n);return Nu(e)?e.host:e}function Au(n){const e=tn(n);return Fn(e)?n.ownerDocument?n.ownerDocument.body:n.body:mt(e)&&Mr(e)?e:Au(e)}function Du(n,e,t){var r;e===void 0&&(e=[]);const i=Au(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ke(i);return s?(ll(o),e.concat(o,o.visualViewport||[],Mr(i)?i:[],[])):e.concat(i,Du(i,[]))}function ll(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ru(n){const e=st(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=mt(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=Ji(t)!==s||Ji(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}function Iu(n){return it(n)?n:n.contextElement}function jn(n){const e=Iu(n);if(!mt(e))return ht(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Ru(e);let o=(s?Ji(t.width):t.width)/r,l=(s?Ji(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Qb=ht(0);function Pu(n){const e=Ke(n);return!ol()||!e.visualViewport?Qb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Zb(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ke(n)?!1:e}function vr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=Iu(n);let o=ht(1);e&&(r?it(r)&&(o=jn(r)):o=jn(n));const l=Zb(s,t,r)?Pu(s):ht(0);let a=(i.left+l.x)/o.x,c=(i.top+l.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(s){const f=Ke(s),h=r&&it(r)?Ke(r):r;let p=f,g=ll(p);for(;g&&r&&h!==p;){const y=jn(g),w=g.getBoundingClientRect(),k=st(g),C=w.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,D=w.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,c*=y.y,d*=y.x,u*=y.y,a+=C,c+=D,p=Ke(g),g=ll(p)}}return $n({width:d,height:u,x:a,y:c})}function es(n,e){const t=Zi(n).scrollLeft;return e?e.left+t:vr(Dt(n)).left+t}function Lu(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-es(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function e1(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=Dt(r),l=e?Qi(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},c=ht(1);const d=ht(0),u=mt(r);if((u||!u&&!s)&&((Hn(r)!=="body"||Mr(o))&&(a=Zi(r)),mt(r))){const h=vr(r);c=jn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=o&&!u&&!s?Lu(o,a):ht(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-a.scrollTop*c.y+d.y+f.y}}function t1(n){return Array.from(n.getClientRects())}function n1(n){const e=Dt(n),t=Zi(n),r=n.ownerDocument.body,i=ze(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ze(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+es(n);const l=-t.scrollTop;return st(r).direction==="rtl"&&(o+=ze(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const Bu=25;function r1(n,e){const t=Ke(n),r=Dt(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const d=ol();(!d||d&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const c=es(r);if(c<=0){const d=r.ownerDocument,u=d.body,f=getComputedStyle(u),h=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-u.clientWidth-h);p<=Bu&&(s-=p)}else c<=Bu&&(s+=c);return{width:s,height:o,x:l,y:a}}const i1=new Set(["absolute","fixed"]);function s1(n,e){const t=vr(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=mt(n)?jn(n):ht(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,c=r*s.y;return{width:o,height:l,x:a,y:c}}function _u(n,e,t){let r;if(e==="viewport")r=r1(n,t);else if(e==="document")r=n1(Dt(n));else if(it(e))r=s1(e,t);else{const i=Pu(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return $n(r)}function Vu(n,e){const t=tn(n);return t===e||!it(t)||Fn(t)?!1:st(t).position==="fixed"||Vu(t,e)}function o1(n,e){const t=e.get(n);if(t)return t;let r=Du(n,[]).filter(l=>it(l)&&Hn(l)!=="body"),i=null;const s=st(n).position==="fixed";let o=s?tn(n):n;for(;it(o)&&!Fn(o);){const l=st(o),a=sl(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&i1.has(i.position)||Mr(o)&&!a&&Vu(n,o))?r=r.filter(d=>d!==o):i=l,o=tn(o)}return e.set(n,r),r}function l1(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?Qi(e)?[]:o1(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((c,d)=>{const u=_u(e,d,i);return c.top=ze(u.top,c.top),c.right=ft(u.right,c.right),c.bottom=ft(u.bottom,c.bottom),c.left=ze(u.left,c.left),c},_u(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function a1(n){const{width:e,height:t}=Ru(n);return{width:e,height:t}}function c1(n,e,t){const r=mt(e),i=Dt(e),s=t==="fixed",o=vr(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=ht(0);function c(){a.x=es(i)}if(r||!r&&!s)if((Hn(e)!=="body"||Mr(i))&&(l=Zi(e)),r){const h=vr(e,!0,s,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?Lu(i,l):ht(0),u=o.left+l.scrollLeft-a.x-d.x,f=o.top+l.scrollTop-a.y-d.y;return{x:u,y:f,width:o.width,height:o.height}}function al(n){return st(n).position==="static"}function $u(n,e){if(!mt(n)||st(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Dt(n)===t&&(t=t.ownerDocument.body),t}function zu(n,e){const t=Ke(n);if(Qi(n))return t;if(!mt(n)){let i=tn(n);for(;i&&!Fn(i);){if(it(i)&&!al(i))return i;i=tn(i)}return t}let r=$u(n,e);for(;r&&Wb(r)&&al(r);)r=$u(r,e);return r&&Fn(r)&&al(r)&&!sl(r)?t:r||Yb(n)||t}const d1=async function(n){const e=this.getOffsetParent||zu,t=this.getDimensions,r=await t(n.floating);return{reference:c1(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function u1(n){return st(n).direction==="rtl"}const f1={convertOffsetParentRelativeRectToViewportRelativeRect:e1,getDocumentElement:Dt,getClippingRect:l1,getOffsetParent:zu,getElementRects:d1,getClientRects:t1,getDimensions:a1,getScale:jn,isElement:it,isRTL:u1},Hu=zb,Fu=Ib,ju=Hb,Uu=Pb,Wu=Fb,Ku=Lb,qu=Db,Ju=_b,Gu=(n,e,t)=>{const r=new Map,i={platform:f1,...t},s={...i.platform,_c:r};return Ab(n,e,{...i,platform:s})};var cl,dl;if(typeof WeakMap<"u"){let n=new WeakMap;cl=e=>n.get(e),dl=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;cl=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},dl=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Rt=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[s*this.width+(t<0?r-1:i)]:(t<0?s==0:o==this.height)?null:this.map[r+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const s=r*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==n.left&&i&&this.map[s-1]==o||r==n.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const s=i+t.child(r).nodeSize;if(r==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(n){return cl(n)||dl(n,h1(n))}};function h1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=p1(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,d=e*t;c<d;c++)r[c]=0;for(let c=0,d=0;c<t;c++){const u=n.child(c);d++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==u.childCount)break;const g=u.child(p),{colspan:y,rowspan:w,colwidth:k}=g.attrs;for(let C=0;C<w;C++){if(C+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:w-C});break}const D=i+C*e;for(let M=0;M<y;M++){r[D+M]==0?r[D+M]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:y-M});const P=k&&k[M];if(P){const T=(D+M)%e*2,V=o[T];V==null||V!=P&&o[T+1]==1?(o[T]=P,o[T+1]=1):V==P&&o[T+1]++}}}i+=y,d+=g.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:c,n:h}),d++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new Rt(e,t,r,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&m1(l,o,n),l}function p1(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function m1(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const d=(i+c)%n.width,u=e[d*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=g1(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function g1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ul(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}new le("selectingCells");function y1(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Yu(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function b1(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=y1(e.$head)||w1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function w1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Xu(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Qu(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Zu(n,e,t){const r=n.node(-1),i=Rt.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function ef(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}var gt=class Pt extends H{constructor(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(d=>d!=t.pos-s);a.unshift(t.pos-s);const c=a.map(d=>{const u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const f=s+d+1;return new pa(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Xu(r)&&Xu(i)&&Qu(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Pt.rowSelection(r,i):s&&this.isColSelection()?Pt.colSelection(r,i):new Pt(r,i)}return F.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=Rt.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let d=a*t.width+i.left,u=i.left;u<i.right;u++,d++){const f=t.map[d];if(s[f])continue;s[f]=!0;const h=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,y=h.right-i.right;if(g>0||y>0){let w=p.attrs;if(g>0&&(w=ef(w,0,g)),y>0&&(w=ef(w,w.colspan-y,y)),h.left<i.left){if(p=p.type.createAndFill(w),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<i.top||h.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}o.push(e.child(a).copy(S.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new N(S.from(l),1,1)}replace(e,t=N.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?N.empty:t)}const s=H.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new N(S.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Rt.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Pt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Rt.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof Pt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new Pt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Pt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Pt(e.resolve(t),e.resolve(r))}getBookmark(){return new k1(this.$anchorCell.pos,this.$headCell.pos)}};gt.prototype.visible=!1,H.jsonID("cell",gt);var k1=class Bf{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Bf(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Qu(t,r)?new gt(t,r):H.near(r,1)}};new le("fix-tables");function tf(n){const e=n.selection,t=b1(n),r=t.node(-1),i=t.start(-1),s=Rt.get(r);return{...e instanceof gt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}function x1(n){return function(e,t){if(!Yu(e))return!1;if(t){const r=ul(e.schema),i=tf(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);t(s)}return!0}}function nf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function fl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?x1(n):function(t,r){if(!Yu(t))return!1;if(r){const i=ul(t.schema),s=tf(t),o=t.tr,l=nf("row",s,i),a=nf("column",s,i),d=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:s.map.height}:n=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const p=h+s.tableStart,g=o.doc.nodeAt(p);g&&o.setNodeMarkup(p,f,g.attrs)}),r(o)}return!0}}fl("row",{useDeprecatedLogic:!0}),fl("column",{useDeprecatedLogic:!0}),fl("cell",{useDeprecatedLogic:!0});function ts(n,e){const t=n.selection;if(!(t instanceof gt))return!1;if(e){const r=n.tr,i=ul(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new N(i,0,0))}),r.docChanged&&e(r)}return!0}no({ArrowLeft:rs("horiz",-1),ArrowRight:rs("horiz",1),ArrowUp:rs("vert",-1),ArrowDown:rs("vert",1),"Shift-ArrowLeft":is("horiz",-1),"Shift-ArrowRight":is("horiz",1),"Shift-ArrowUp":is("vert",-1),"Shift-ArrowDown":is("vert",1),Backspace:ts,"Mod-Backspace":ts,Delete:ts,"Mod-Delete":ts});function ns(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function rs(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof gt)return ns(t,r,H.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=rf(i,n,e);if(o==null)return!1;if(n=="horiz")return ns(t,r,H.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=Zu(l,n,e);let c;return a?c=H.near(a,1):e<0?c=H.near(t.doc.resolve(l.before(-1)),-1):c=H.near(t.doc.resolve(l.after(-1)),1),ns(t,r,c)}}}function is(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof gt)o=s;else{const a=rf(i,n,e);if(a==null)return!1;o=new gt(t.doc.resolve(a))}const l=Zu(o.$headCell,n,e);return l?ns(t,r,new gt(o.$anchorCell,l)):!1}}function rf(n,e,t){if(!(n.state.selection instanceof F))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}new le("tableColumnResizing");function S1(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,l=r-t,a=i,c=t;return new DOMRect(a,c,o,l)}var C1=class{constructor({editor:n,element:e,view:t,updateDelay:r=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:u,from:f,to:h})=>{const{doc:p,selection:g}=u,{empty:y}=g,w=!p.textBetween(f,h).length&&ko(u.selection),k=this.element.contains(document.activeElement);return!(!(d.hasFocus()||k)||y||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var u;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,u)=>{const f=!u?.selection.eq(d.state.selection),h=!u?.doc.eq(d.state.doc);!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,h,u)},this.updateDelay))},this.updateHandler=(d,u,f,h)=>{const{composing:p}=d;if(p||!u&&!f)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:d})=>{d.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var c;this.editor=n,this.element=e,this.view=t,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(c=a?.scrollTarget)!=null?c:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&this.show()}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Uu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ju(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Hu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(qu(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wu(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Fu(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(Ku(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Ju(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n;const{selection:e}=this.editor.state,t=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(t)return t;const r=hd(this.view,e.from,e.to);let i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(e instanceof B){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof gt){const{$anchorCell:s,$headCell:o}=e,l=s?s.pos:o.pos,a=o?o.pos:s.pos,c=this.view.nodeDOM(l),d=this.view.nodeDOM(a);if(!c||!d)return;const u=c===d?c.getBoundingClientRect():S1(c.getBoundingClientRect(),d.getBoundingClientRect());i={getBoundingClientRect:()=>u,getClientRects:()=>[u]}}return i}updatePosition(){const n=this.virtualElement;n&&Gu(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,r=t.selection.from!==t.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(n,e);return}const i=!e?.selection.eq(n.state.selection),s=!e?.doc.eq(n.state.doc);this.updateHandler(n,i,s,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:s,to:o})}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},sf=n=>new se({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new C1({view:e,...n})});de.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[sf({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var E1=m.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{editor:i,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:c,getReferencedVirtualElement:d,updateDelay:u}=n;r.value&&(r.value.style.visibility="hidden",r.value.style.position="absolute",r.value.remove(),i.registerPlugin(sf({editor:i,element:r.value,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:c,getReferencedVirtualElement:d,updateDelay:u})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return m.h(m.Teleport,{to:"body"},m.h("div",{...t,ref:r},(i=e.default)==null?void 0:i.call(e)))}}}),M1=class{constructor({editor:n,element:e,view:t,options:r,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:l})=>{const{selection:a}=l,{$anchor:c,empty:d}=a,u=c.depth===1,f=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!o.hasFocus()||!d||!u||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,l,a,c)=>{const{composing:d}=o;if(d||!l&&!a)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var l;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((l=this.element.parentNode)!=null&&l.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=n,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&this.show()}getTextContent(n){return id(n,{textSerializers:po(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Uu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ju(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Hu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(qu(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wu(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Fu(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(Ku(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Ju(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:s,to:o})}updatePosition(){const{selection:n}=this.editor.state,e=hd(this.view,n.from,n.to);Gu({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!e?.selection.eq(n.state.selection),r=!e?.doc.eq(n.state.doc);this.updateHandler(n,t,r,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},of=n=>new se({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new M1({view:e,...n})});de.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[of({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}}),m.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{pluginKey:i,editor:s,options:o,appendTo:l,shouldShow:a}=n;r.value&&(r.value.style.visibility="hidden",r.value.style.position="absolute",r.value.remove(),s.registerPlugin(of({pluginKey:i,editor:s,element:r.value,options:o,appendTo:l,shouldShow:a})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return m.h(m.Teleport,{to:"body"},m.h("div",{...t,ref:r},(i=e.default)==null?void 0:i.call(e)))}}});const v1={class:"sus-bubble-menu"},T1=Yt(m.defineComponent({__name:"BubbleMenu",props:{editor:{},showMenu:{type:Boolean}},setup(n){const e=n,t=m.ref(""),r=m.ref(!1);function i({editor:l}){const{from:a,to:c}=l.state.selection;if(a===c){const{$anchor:d}=l.state.selection;return l.isActive("link")}return l.isActive("link")}function s(){if(r.value){r.value=!1;return}t.value=e.editor?.getAttributes("link").href,r.value=!0}function o(){if(!t.value){e.editor?.chain().focus().extendMarkRange("link").unsetLink().run(),r.value=!1;return}e.editor?.chain().focus().extendMarkRange("link").setLink({href:t.value}).run(),r.value=!1}return(l,a)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.withDirectives(m.createElementVNode("div",{class:"sus-bubble-mask",onClick:a[2]||(a[2]=c=>r.value=!1)},[m.createElementVNode("div",{class:"sus-link",onClick:a[1]||(a[1]=m.withModifiers(()=>{},["stop"]))},[m.withDirectives(m.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>t.value=c),onKeyup:m.withKeys(o,["enter"]),class:"sus-link-input",type:"text",placeholder:"请输入链接"},null,544),[[m.vModelText,t.value]]),m.createElementVNode("button",{onClick:o,title:"确定"},[...a[4]||(a[4]=[m.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-1bbeca5c><rect width="24" height="24" fill="none" data-v-1bbeca5c></rect><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" data-v-1bbeca5c><path d="M15 2.458A10 10 0 0 0 12 2C6.477 2 2 6.477 2 12s4.477 10 10 10s10-4.477 10-10a10 10 0 0 0-.458-3" data-v-1bbeca5c></path><path stroke-linejoin="round" d="M8.5 9.5L12 13l9-10" data-v-1bbeca5c></path></g></svg>',1)])])])],512),[[m.vShow,r.value]]),n.editor&&n.showMenu?(m.openBlock(),m.createBlock(m.unref(E1),{key:0,editor:n.editor,options:{placement:"bottom",offset:8,shouldShow:i}},{default:m.withCtx(()=>[m.createElementVNode("div",v1,[m.createElementVNode("button",{onClick:s,title:"添加链接"},[...a[5]||(a[5]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("path",{d:"M9 17H7A5 5 0 0 1 7 7h2"}),m.createElementVNode("path",{d:"M15 7h2a5 5 0 1 1 0 10h-2"}),m.createElementVNode("line",{x1:"8",x2:"16",y1:"12",y2:"12"})],-1)])]),m.createElementVNode("button",{onClick:a[3]||(a[3]=c=>n.editor.commands.unsetAllMarks()),title:"清除当前选中格式"},[...a[6]||(a[6]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("path",{d:"M4 7V4h16v3"}),m.createElementVNode("path",{d:"M5 20h6"}),m.createElementVNode("path",{d:"M13 4 8 20"}),m.createElementVNode("path",{d:"m15 15 5 5"}),m.createElementVNode("path",{d:"m20 15-5 5"})],-1)])])])]),_:1},8,["editor","options"])):m.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-1bbeca5c"]]),O1=$e.create({name:"emoji",inline:!0,group:"inline",atom:!0,addAttributes(){return{name:{default:null},src:{default:null}}},parseHTML(){return[{tag:"span[data-type='emoji']"}]},renderHTML({HTMLAttributes:n}){return["span",{"data-type":"emoji",class:"emoji",contenteditable:"false"},["img",ce(n,{src:n.src,alt:n.name,draggable:"false",loading:"lazy",align:"absmiddle"})]]}});function N1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hl,lf;function A1(){if(lf)return hl;lf=1;function n(b){return b instanceof Map?b.clear=b.delete=b.set=function(){throw new Error("map is read-only")}:b instanceof Set&&(b.add=b.clear=b.delete=function(){throw new Error("set is read-only")}),Object.freeze(b),Object.getOwnPropertyNames(b).forEach(x=>{const O=b[x],q=typeof O;(q==="object"||q==="function")&&!Object.isFrozen(O)&&n(O)}),b}class e{constructor(x){x.data===void 0&&(x.data={}),this.data=x.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(b,...x){const O=Object.create(null);for(const q in b)O[q]=b[q];return x.forEach(function(q){for(const me in q)O[me]=q[me]}),O}const i="</span>",s=b=>!!b.scope,o=(b,{prefix:x})=>{if(b.startsWith("language:"))return b.replace("language:","language-");if(b.includes(".")){const O=b.split(".");return[`${x}${O.shift()}`,...O.map((q,me)=>`${q}${"_".repeat(me+1)}`)].join(" ")}return`${x}${b}`};class l{constructor(x,O){this.buffer="",this.classPrefix=O.classPrefix,x.walk(this)}addText(x){this.buffer+=t(x)}openNode(x){if(!s(x))return;const O=o(x.scope,{prefix:this.classPrefix});this.span(O)}closeNode(x){s(x)&&(this.buffer+=i)}value(){return this.buffer}span(x){this.buffer+=`<span class="${x}">`}}const a=(b={})=>{const x={children:[]};return Object.assign(x,b),x};class c{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(x){this.top.children.push(x)}openNode(x){const O=a({scope:x});this.add(O),this.stack.push(O)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(x){return this.constructor._walk(x,this.rootNode)}static _walk(x,O){return typeof O=="string"?x.addText(O):O.children&&(x.openNode(O),O.children.forEach(q=>this._walk(x,q)),x.closeNode(O)),x}static _collapse(x){typeof x!="string"&&x.children&&(x.children.every(O=>typeof O=="string")?x.children=[x.children.join("")]:x.children.forEach(O=>{c._collapse(O)}))}}class d extends c{constructor(x){super(),this.options=x}addText(x){x!==""&&this.add(x)}startScope(x){this.openNode(x)}endScope(){this.closeNode()}__addSublanguage(x,O){const q=x.root;O&&(q.scope=`language:${O}`),this.add(q)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(b){return b?typeof b=="string"?b:b.source:null}function f(b){return g("(?=",b,")")}function h(b){return g("(?:",b,")*")}function p(b){return g("(?:",b,")?")}function g(...b){return b.map(O=>u(O)).join("")}function y(b){const x=b[b.length-1];return typeof x=="object"&&x.constructor===Object?(b.splice(b.length-1,1),x):{}}function w(...b){return"("+(y(b).capture?"":"?:")+b.map(q=>u(q)).join("|")+")"}function k(b){return new RegExp(b.toString()+"|").exec("").length-1}function C(b,x){const O=b&&b.exec(x);return O&&O.index===0}const D=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(b,{joinWith:x}){let O=0;return b.map(q=>{O+=1;const me=O;let ge=u(q),L="";for(;ge.length>0;){const I=D.exec(ge);if(!I){L+=ge;break}L+=ge.substring(0,I.index),ge=ge.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?L+="\\"+String(Number(I[1])+me):(L+=I[0],I[0]==="("&&O++)}return L}).map(q=>`(${q})`).join(x)}const P=/\b\B/,T="[a-zA-Z]\\w*",V="[a-zA-Z_]\\w*",K="\\b\\d+(\\.\\d+)?",j="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",U="\\b(0b[01]+)",R="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",X=(b={})=>{const x=/^#![ ]*\//;return b.binary&&(b.begin=g(x,/.*\b/,b.binary,/\b.*/)),r({scope:"meta",begin:x,end:/$/,relevance:0,"on:begin":(O,q)=>{O.index!==0&&q.ignoreMatch()}},b)},Z={begin:"\\\\[\\s\\S]",relevance:0},ke={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},he={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},pe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Me=function(b,x,O={}){const q=r({scope:"comment",begin:b,end:x,contains:[]},O);q.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const me=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return q.contains.push({begin:g(/[ ]+/,"(",me,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),q},yt=Me("//","$"),pl=Me("/\\*","\\*/"),Xw=Me("#","$"),Qw={scope:"number",begin:K,relevance:0},Zw={scope:"number",begin:j,relevance:0},ek={scope:"number",begin:U,relevance:0},tk={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},nk={scope:"title",begin:T,relevance:0},rk={scope:"title",begin:V,relevance:0},ik={begin:"\\.\\s*"+V,relevance:0};var ls=Object.freeze({__proto__:null,APOS_STRING_MODE:ke,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:ek,BINARY_NUMBER_RE:U,COMMENT:Me,C_BLOCK_COMMENT_MODE:pl,C_LINE_COMMENT_MODE:yt,C_NUMBER_MODE:Zw,C_NUMBER_RE:j,END_SAME_AS_BEGIN:function(b){return Object.assign(b,{"on:begin":(x,O)=>{O.data._beginMatch=x[1]},"on:end":(x,O)=>{O.data._beginMatch!==x[1]&&O.ignoreMatch()}})},HASH_COMMENT_MODE:Xw,IDENT_RE:T,MATCH_NOTHING_RE:P,METHOD_GUARD:ik,NUMBER_MODE:Qw,NUMBER_RE:K,PHRASAL_WORDS_MODE:pe,QUOTE_STRING_MODE:he,REGEXP_MODE:tk,RE_STARTERS_RE:R,SHEBANG:X,TITLE_MODE:nk,UNDERSCORE_IDENT_RE:V,UNDERSCORE_TITLE_MODE:rk});function sk(b,x){b.input[b.index-1]==="."&&x.ignoreMatch()}function ok(b,x){b.className!==void 0&&(b.scope=b.className,delete b.className)}function lk(b,x){x&&b.beginKeywords&&(b.begin="\\b("+b.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",b.__beforeBegin=sk,b.keywords=b.keywords||b.beginKeywords,delete b.beginKeywords,b.relevance===void 0&&(b.relevance=0))}function ak(b,x){Array.isArray(b.illegal)&&(b.illegal=w(...b.illegal))}function ck(b,x){if(b.match){if(b.begin||b.end)throw new Error("begin & end are not supported with match");b.begin=b.match,delete b.match}}function dk(b,x){b.relevance===void 0&&(b.relevance=1)}const uk=(b,x)=>{if(!b.beforeMatch)return;if(b.starts)throw new Error("beforeMatch cannot be used with starts");const O=Object.assign({},b);Object.keys(b).forEach(q=>{delete b[q]}),b.keywords=O.keywords,b.begin=g(O.beforeMatch,f(O.begin)),b.starts={relevance:0,contains:[Object.assign(O,{endsParent:!0})]},b.relevance=0,delete O.beforeMatch},fk=["of","and","for","in","not","or","if","then","parent","list","value"],hk="keyword";function gf(b,x,O=hk){const q=Object.create(null);return typeof b=="string"?me(O,b.split(" ")):Array.isArray(b)?me(O,b):Object.keys(b).forEach(function(ge){Object.assign(q,gf(b[ge],x,ge))}),q;function me(ge,L){x&&(L=L.map(I=>I.toLowerCase())),L.forEach(function(I){const W=I.split("|");q[W[0]]=[ge,pk(W[0],W[1])]})}}function pk(b,x){return x?Number(x):mk(b)?0:1}function mk(b){return fk.includes(b.toLowerCase())}const yf={},Sn=b=>{console.error(b)},bf=(b,...x)=>{console.log(`WARN: ${b}`,...x)},Un=(b,x)=>{yf[`${b}/${x}`]||(console.log(`Deprecated as of ${b}. ${x}`),yf[`${b}/${x}`]=!0)},as=new Error;function wf(b,x,{key:O}){let q=0;const me=b[O],ge={},L={};for(let I=1;I<=x.length;I++)L[I+q]=me[I],ge[I+q]=!0,q+=k(x[I-1]);b[O]=L,b[O]._emit=ge,b[O]._multi=!0}function gk(b){if(Array.isArray(b.begin)){if(b.skip||b.excludeBegin||b.returnBegin)throw Sn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),as;if(typeof b.beginScope!="object"||b.beginScope===null)throw Sn("beginScope must be object"),as;wf(b,b.begin,{key:"beginScope"}),b.begin=M(b.begin,{joinWith:""})}}function yk(b){if(Array.isArray(b.end)){if(b.skip||b.excludeEnd||b.returnEnd)throw Sn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),as;if(typeof b.endScope!="object"||b.endScope===null)throw Sn("endScope must be object"),as;wf(b,b.end,{key:"endScope"}),b.end=M(b.end,{joinWith:""})}}function bk(b){b.scope&&typeof b.scope=="object"&&b.scope!==null&&(b.beginScope=b.scope,delete b.scope)}function wk(b){bk(b),typeof b.beginScope=="string"&&(b.beginScope={_wrap:b.beginScope}),typeof b.endScope=="string"&&(b.endScope={_wrap:b.endScope}),gk(b),yk(b)}function kk(b){function x(L,I){return new RegExp(u(L),"m"+(b.case_insensitive?"i":"")+(b.unicodeRegex?"u":"")+(I?"g":""))}class O{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,W){W.position=this.position++,this.matchIndexes[this.matchAt]=W,this.regexes.push([W,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(W=>W[1]);this.matcherRe=x(M(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const W=this.matcherRe.exec(I);if(!W)return null;const ve=W.findIndex((Tr,gl)=>gl>0&&Tr!==void 0),we=this.matchIndexes[ve];return W.splice(0,ve),Object.assign(W,we)}}class q{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const W=new O;return this.rules.slice(I).forEach(([ve,we])=>W.addRule(ve,we)),W.compile(),this.multiRegexes[I]=W,W}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,W){this.rules.push([I,W]),W.type==="begin"&&this.count++}exec(I){const W=this.getMatcher(this.regexIndex);W.lastIndex=this.lastIndex;let ve=W.exec(I);if(this.resumingScanAtSamePosition()&&!(ve&&ve.index===this.lastIndex)){const we=this.getMatcher(0);we.lastIndex=this.lastIndex+1,ve=we.exec(I)}return ve&&(this.regexIndex+=ve.position+1,this.regexIndex===this.count&&this.considerAll()),ve}}function me(L){const I=new q;return L.contains.forEach(W=>I.addRule(W.begin,{rule:W,type:"begin"})),L.terminatorEnd&&I.addRule(L.terminatorEnd,{type:"end"}),L.illegal&&I.addRule(L.illegal,{type:"illegal"}),I}function ge(L,I){const W=L;if(L.isCompiled)return W;[ok,ck,wk,uk].forEach(we=>we(L,I)),b.compilerExtensions.forEach(we=>we(L,I)),L.__beforeBegin=null,[lk,ak,dk].forEach(we=>we(L,I)),L.isCompiled=!0;let ve=null;return typeof L.keywords=="object"&&L.keywords.$pattern&&(L.keywords=Object.assign({},L.keywords),ve=L.keywords.$pattern,delete L.keywords.$pattern),ve=ve||/\w+/,L.keywords&&(L.keywords=gf(L.keywords,b.case_insensitive)),W.keywordPatternRe=x(ve,!0),I&&(L.begin||(L.begin=/\B|\b/),W.beginRe=x(W.begin),!L.end&&!L.endsWithParent&&(L.end=/\B|\b/),L.end&&(W.endRe=x(W.end)),W.terminatorEnd=u(W.end)||"",L.endsWithParent&&I.terminatorEnd&&(W.terminatorEnd+=(L.end?"|":"")+I.terminatorEnd)),L.illegal&&(W.illegalRe=x(L.illegal)),L.contains||(L.contains=[]),L.contains=[].concat(...L.contains.map(function(we){return xk(we==="self"?L:we)})),L.contains.forEach(function(we){ge(we,W)}),L.starts&&ge(L.starts,I),W.matcher=me(W),W}if(b.compilerExtensions||(b.compilerExtensions=[]),b.contains&&b.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return b.classNameAliases=r(b.classNameAliases||{}),ge(b)}function kf(b){return b?b.endsWithParent||kf(b.starts):!1}function xk(b){return b.variants&&!b.cachedVariants&&(b.cachedVariants=b.variants.map(function(x){return r(b,{variants:null},x)})),b.cachedVariants?b.cachedVariants:kf(b)?r(b,{starts:b.starts?r(b.starts):null}):Object.isFrozen(b)?r(b):b}var Sk="11.11.1";class Ck extends Error{constructor(x,O){super(x),this.name="HTMLInjectionError",this.html=O}}const ml=t,xf=r,Sf=Symbol("nomatch"),Ek=7,Cf=function(b){const x=Object.create(null),O=Object.create(null),q=[];let me=!0;const ge="Could not find the language '{}', did you forget to load/include a language module?",L={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function W(v){return I.noHighlightRe.test(v)}function ve(v){let z=v.className+" ";z+=v.parentNode?v.parentNode.className:"";const Q=I.languageDetectRe.exec(z);if(Q){const re=nn(Q[1]);return re||(bf(ge.replace("{}",Q[1])),bf("Falling back to no-highlight mode for this block.",v)),re?Q[1]:"no-highlight"}return z.split(/\s+/).find(re=>W(re)||nn(re))}function we(v,z,Q){let re="",xe="";typeof z=="object"?(re=v,Q=z.ignoreIllegals,xe=z.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
105
+ https://github.com/highlightjs/highlight.js/issues/2277`),xe=v,re=z),Q===void 0&&(Q=!0);const ot={code:re,language:xe};ds("before:highlight",ot);const rn=ot.result?ot.result:Tr(ot.language,ot.code,Q);return rn.code=ot.code,ds("after:highlight",rn),rn}function Tr(v,z,Q,re){const xe=Object.create(null);function ot(A,_){return A.keywords[_]}function rn(){if(!J.keywords){Ae.addText(ie);return}let A=0;J.keywordPatternRe.lastIndex=0;let _=J.keywordPatternRe.exec(ie),Y="";for(;_;){Y+=ie.substring(A,_.index);const te=wt.case_insensitive?_[0].toLowerCase():_[0],Le=ot(J,te);if(Le){const[It,Hk]=Le;if(Ae.addText(Y),Y="",xe[te]=(xe[te]||0)+1,xe[te]<=Ek&&(hs+=Hk),It.startsWith("_"))Y+=_[0];else{const Fk=wt.classNameAliases[It]||It;bt(_[0],Fk)}}else Y+=_[0];A=J.keywordPatternRe.lastIndex,_=J.keywordPatternRe.exec(ie)}Y+=ie.substring(A),Ae.addText(Y)}function us(){if(ie==="")return;let A=null;if(typeof J.subLanguage=="string"){if(!x[J.subLanguage]){Ae.addText(ie);return}A=Tr(J.subLanguage,ie,!0,Df[J.subLanguage]),Df[J.subLanguage]=A._top}else A=yl(ie,J.subLanguage.length?J.subLanguage:null);J.relevance>0&&(hs+=A.relevance),Ae.__addSublanguage(A._emitter,A.language)}function qe(){J.subLanguage!=null?us():rn(),ie=""}function bt(A,_){A!==""&&(Ae.startScope(_),Ae.addText(A),Ae.endScope())}function Tf(A,_){let Y=1;const te=_.length-1;for(;Y<=te;){if(!A._emit[Y]){Y++;continue}const Le=wt.classNameAliases[A[Y]]||A[Y],It=_[Y];Le?bt(It,Le):(ie=It,rn(),ie=""),Y++}}function Of(A,_){return A.scope&&typeof A.scope=="string"&&Ae.openNode(wt.classNameAliases[A.scope]||A.scope),A.beginScope&&(A.beginScope._wrap?(bt(ie,wt.classNameAliases[A.beginScope._wrap]||A.beginScope._wrap),ie=""):A.beginScope._multi&&(Tf(A.beginScope,_),ie="")),J=Object.create(A,{parent:{value:J}}),J}function Nf(A,_,Y){let te=C(A.endRe,Y);if(te){if(A["on:end"]){const Le=new e(A);A["on:end"](_,Le),Le.isMatchIgnored&&(te=!1)}if(te){for(;A.endsParent&&A.parent;)A=A.parent;return A}}if(A.endsWithParent)return Nf(A.parent,_,Y)}function Bk(A){return J.matcher.regexIndex===0?(ie+=A[0],1):(xl=!0,0)}function _k(A){const _=A[0],Y=A.rule,te=new e(Y),Le=[Y.__beforeBegin,Y["on:begin"]];for(const It of Le)if(It&&(It(A,te),te.isMatchIgnored))return Bk(_);return Y.skip?ie+=_:(Y.excludeBegin&&(ie+=_),qe(),!Y.returnBegin&&!Y.excludeBegin&&(ie=_)),Of(Y,A),Y.returnBegin?0:_.length}function Vk(A){const _=A[0],Y=z.substring(A.index),te=Nf(J,A,Y);if(!te)return Sf;const Le=J;J.endScope&&J.endScope._wrap?(qe(),bt(_,J.endScope._wrap)):J.endScope&&J.endScope._multi?(qe(),Tf(J.endScope,A)):Le.skip?ie+=_:(Le.returnEnd||Le.excludeEnd||(ie+=_),qe(),Le.excludeEnd&&(ie=_));do J.scope&&Ae.closeNode(),!J.skip&&!J.subLanguage&&(hs+=J.relevance),J=J.parent;while(J!==te.parent);return te.starts&&Of(te.starts,A),Le.returnEnd?0:_.length}function $k(){const A=[];for(let _=J;_!==wt;_=_.parent)_.scope&&A.unshift(_.scope);A.forEach(_=>Ae.openNode(_))}let fs={};function Af(A,_){const Y=_&&_[0];if(ie+=A,Y==null)return qe(),0;if(fs.type==="begin"&&_.type==="end"&&fs.index===_.index&&Y===""){if(ie+=z.slice(_.index,_.index+1),!me){const te=new Error(`0 width match regex (${v})`);throw te.languageName=v,te.badRule=fs.rule,te}return 1}if(fs=_,_.type==="begin")return _k(_);if(_.type==="illegal"&&!Q){const te=new Error('Illegal lexeme "'+Y+'" for mode "'+(J.scope||"<unnamed>")+'"');throw te.mode=J,te}else if(_.type==="end"){const te=Vk(_);if(te!==Sf)return te}if(_.type==="illegal"&&Y==="")return ie+=`
106
+ `,1;if(kl>1e5&&kl>_.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=Y,Y.length}const wt=nn(v);if(!wt)throw Sn(ge.replace("{}",v)),new Error('Unknown language: "'+v+'"');const zk=kk(wt);let wl="",J=re||zk;const Df={},Ae=new I.__emitter(I);$k();let ie="",hs=0,Cn=0,kl=0,xl=!1;try{if(wt.__emitTokens)wt.__emitTokens(z,Ae);else{for(J.matcher.considerAll();;){kl++,xl?xl=!1:J.matcher.considerAll(),J.matcher.lastIndex=Cn;const A=J.matcher.exec(z);if(!A)break;const _=z.substring(Cn,A.index),Y=Af(_,A);Cn=A.index+Y}Af(z.substring(Cn))}return Ae.finalize(),wl=Ae.toHTML(),{language:v,value:wl,relevance:hs,illegal:!1,_emitter:Ae,_top:J}}catch(A){if(A.message&&A.message.includes("Illegal"))return{language:v,value:ml(z),illegal:!0,relevance:0,_illegalBy:{message:A.message,index:Cn,context:z.slice(Cn-100,Cn+100),mode:A.mode,resultSoFar:wl},_emitter:Ae};if(me)return{language:v,value:ml(z),illegal:!1,relevance:0,errorRaised:A,_emitter:Ae,_top:J};throw A}}function gl(v){const z={value:ml(v),illegal:!1,relevance:0,_top:L,_emitter:new I.__emitter(I)};return z._emitter.addText(v),z}function yl(v,z){z=z||I.languages||Object.keys(x);const Q=gl(v),re=z.filter(nn).filter(vf).map(qe=>Tr(qe,v,!1));re.unshift(Q);const xe=re.sort((qe,bt)=>{if(qe.relevance!==bt.relevance)return bt.relevance-qe.relevance;if(qe.language&&bt.language){if(nn(qe.language).supersetOf===bt.language)return 1;if(nn(bt.language).supersetOf===qe.language)return-1}return 0}),[ot,rn]=xe,us=ot;return us.secondBest=rn,us}function Mk(v,z,Q){const re=z&&O[z]||Q;v.classList.add("hljs"),v.classList.add(`language-${re}`)}function bl(v){let z=null;const Q=ve(v);if(W(Q))return;if(ds("before:highlightElement",{el:v,language:Q}),v.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",v);return}if(v.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(v)),I.throwUnescapedHTML))throw new Ck("One of your code blocks includes unescaped HTML.",v.innerHTML);z=v;const re=z.textContent,xe=Q?we(re,{language:Q,ignoreIllegals:!0}):yl(re);v.innerHTML=xe.value,v.dataset.highlighted="yes",Mk(v,Q,xe.language),v.result={language:xe.language,re:xe.relevance,relevance:xe.relevance},xe.secondBest&&(v.secondBest={language:xe.secondBest.language,relevance:xe.secondBest.relevance}),ds("after:highlightElement",{el:v,result:xe,text:re})}function vk(v){I=xf(I,v)}const Tk=()=>{cs(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Ok(){cs(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ef=!1;function cs(){function v(){cs()}if(document.readyState==="loading"){Ef||window.addEventListener("DOMContentLoaded",v,!1),Ef=!0;return}document.querySelectorAll(I.cssSelector).forEach(bl)}function Nk(v,z){let Q=null;try{Q=z(b)}catch(re){if(Sn("Language definition for '{}' could not be registered.".replace("{}",v)),me)Sn(re);else throw re;Q=L}Q.name||(Q.name=v),x[v]=Q,Q.rawDefinition=z.bind(null,b),Q.aliases&&Mf(Q.aliases,{languageName:v})}function Ak(v){delete x[v];for(const z of Object.keys(O))O[z]===v&&delete O[z]}function Dk(){return Object.keys(x)}function nn(v){return v=(v||"").toLowerCase(),x[v]||x[O[v]]}function Mf(v,{languageName:z}){typeof v=="string"&&(v=[v]),v.forEach(Q=>{O[Q.toLowerCase()]=z})}function vf(v){const z=nn(v);return z&&!z.disableAutodetect}function Rk(v){v["before:highlightBlock"]&&!v["before:highlightElement"]&&(v["before:highlightElement"]=z=>{v["before:highlightBlock"](Object.assign({block:z.el},z))}),v["after:highlightBlock"]&&!v["after:highlightElement"]&&(v["after:highlightElement"]=z=>{v["after:highlightBlock"](Object.assign({block:z.el},z))})}function Ik(v){Rk(v),q.push(v)}function Pk(v){const z=q.indexOf(v);z!==-1&&q.splice(z,1)}function ds(v,z){const Q=v;q.forEach(function(re){re[Q]&&re[Q](z)})}function Lk(v){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),bl(v)}Object.assign(b,{highlight:we,highlightAuto:yl,highlightAll:cs,highlightElement:bl,highlightBlock:Lk,configure:vk,initHighlighting:Tk,initHighlightingOnLoad:Ok,registerLanguage:Nk,unregisterLanguage:Ak,listLanguages:Dk,getLanguage:nn,registerAliases:Mf,autoDetection:vf,inherit:xf,addPlugin:Ik,removePlugin:Pk}),b.debugMode=function(){me=!1},b.safeMode=function(){me=!0},b.versionString=Sk,b.regex={concat:g,lookahead:f,either:w,optional:p,anyNumberOfTimes:h};for(const v in ls)typeof ls[v]=="object"&&n(ls[v]);return Object.assign(b,ls),b},Wn=Cf({});return Wn.newInstance=()=>Cf({}),hl=Wn,Wn.HighlightJS=Wn,Wn.default=Wn,hl}var D1=A1();const R1=N1(D1);function af(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?af(t.children,r):{text:t.value,classes:r}})}function cf(n){return n.value||n.children||[]}function I1(n){return!!R1.getLanguage(n)}function df({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return co(n,s=>s.type.name===e).forEach(s=>{var o;let l=s.pos+1;const a=s.node.attrs.language||r,c=t.listLanguages(),d=a&&(c.includes(a)||I1(a)||(o=t.registered)!=null&&o.call(t,a))?cf(t.highlight(a,s.node.textContent)):cf(t.highlightAuto(s.node.textContent));af(d).forEach(u=>{const f=l+u.text.length;if(u.classes.length){const h=Ie.inline(l,f,{class:u.classes.join(" ")});i.push(h)}l=f})}),ae.create(n,i)}function P1(n){return typeof n=="function"}function L1({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>P1(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new se({key:new le("lowlight"),state:{init:(i,{doc:s})=>df({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,l)=>{const a=o.selection.$head.parent.type.name,c=l.selection.$head.parent.type.name,d=co(o.doc,f=>f.type.name===n),u=co(l.doc,f=>f.type.name===n);return i.docChanged&&([a,c].includes(n)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?df({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var B1=Qy.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],L1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),_1=B1;const V1=["onClick"],$1={class:"sus-code-block-content"},z1=Yt(m.defineComponent({__name:"CodeBlockView",props:{editor:{},node:{},updateAttributes:{type:Function},selected:{type:Boolean}},setup(n){const e=n,t=m.ref(!1),r=m.ref(null),i=m.computed(()=>e.node.attrs.language||""),s=m.computed(()=>{const c=uf.find(d=>d.value===i.value);return c?c.label:"纯文本"});function o(c){e.updateAttributes({language:c||null}),t.value=!1}function l(){t.value=!t.value}function a(c){r.value&&!r.value.contains(c.target)&&(t.value=!1)}return m.onMounted(()=>{document.addEventListener("click",a)}),m.onUnmounted(()=>{document.removeEventListener("click",a)}),(c,d)=>(m.openBlock(),m.createBlock(m.unref(Dy),{class:m.normalizeClass(["sus-code-block-wrapper",{"is-selected":n.selected}])},{default:m.withCtx(()=>[m.createElementVNode("div",{class:"sus-code-block-toolbar",ref_key:"languageSelectRef",ref:r},[m.createElementVNode("button",{onClick:m.withModifiers(l,["stop"]),class:"sus-code-block-language-btn",title:"选择语言"},[m.createElementVNode("span",null,m.toDisplayString(s.value),1),d[1]||(d[1]=m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1))]),t.value?(m.openBlock(),m.createElementBlock("div",{key:0,class:"sus-code-block-language-selector",onClick:d[0]||(d[0]=m.withModifiers(()=>{},["stop"]))},[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(m.unref(uf),u=>(m.openBlock(),m.createElementBlock("div",{key:u.value,onClick:f=>o(u.value),class:m.normalizeClass(["sus-code-block-language-item",{active:i.value===u.value}])},m.toDisplayString(u.label),11,V1))),128))])):m.createCommentVNode("",!0)],512),m.createElementVNode("pre",$1,[d[2]||(d[2]=m.createTextVNode(" ",-1)),m.createElementVNode("code",null,[m.createVNode(m.unref(Ay))]),d[3]||(d[3]=m.createTextVNode(`
107
+ `,-1))])]),_:1},8,["class"]))}}),[["__scopeId","data-v-a07bc552"]]),H1=_f.createLowlight(),uf=[{value:"",label:"纯文本"},{value:"java",label:"Java"},{value:"python",label:"Python"},{value:"shell",label:"Shell"},{value:"yaml",label:"YAML"},{value:"javascript",label:"JavaScript"},{value:"html",label:"HTML"}],F1=_1.extend({addNodeView(){return Ly(z1)}}).configure({lowlight:H1,defaultLanguage:null}),j1={class:"sus-comment"},U1={key:0,class:"sus-comment-avatar"},W1=["src"],K1={class:"sus-avatar-text"},q1={class:"sus-comment__main"},J1={key:0,class:"sus-comment__info"},G1={key:0,class:"sus-comment__info-input"},Y1=["placeholder","title"],X1={key:1,class:"sus-comment__info-input"},Q1=["placeholder","title"],Z1={key:2,class:"sus-comment__info-input"},ew=["placeholder","title"],tw={class:"sus-comment__editor-wrapper"},nw={class:"sus-comment__footer"},rw={class:"sus-comment__footer-left"},iw={key:0,class:"sus-comment__footer-icon"},sw={key:1,class:"sus-upload sus-comment__footer-icon"},ow={class:"sus-comment__toolbar"},lw={class:"sus-comment__toolbar-mask"},aw={class:"sus-comment__extend"},cw=["src"],dw=["onClick"],ff=Yt(m.defineComponent({__name:"index",props:{reply:{},toolBar:{},infoBar:{},placeholder:{default:"支持常见的markdown语法,如图片、代码块等"},comment:{}},emits:["on-save","on-cancel","add-image","update-avatar"],setup(n,{expose:e,emit:t}){class r{articleId="";userName="";userEmail="";userWebsite="";userAvatar="";content="";contentText="";replyName="";parentId="";notify=0;privacy=!1}const i=n;e({updateImage:M,updatePreviewImage:T});const s=t,o=m.reactive({emojis:i.toolBar?.emoji?.emojis||[],showPanel:!1}),l=i.reply?.userName,a=m.ref("在此处留下你的足迹吧!(支持markdown语法)"),c=m.reactive(new r),d=m.ref(""),u=m.ref(null),f=m.ref([]),h=m.ref(null),p=i.comment?.privacy||!1,g={enable:i.infoBar?.enable===void 0?!0:i.infoBar.enable,name:{show:i.infoBar?.name?.show===void 0?!0:i.infoBar.name.show,placeholder:i.infoBar?.name?.placeholder||"昵称(必填)"},website:{show:i.infoBar?.website?.show===void 0?!0:i.infoBar.website.show,placeholder:i.infoBar?.website?.placeholder||"网址(https://)",tips:i.infoBar?.website?.tips||"点击昵称时可跳转"},email:{show:i.infoBar?.email?.show===void 0?!0:i.infoBar.email.show,placeholder:i.infoBar?.email?.placeholder||"邮箱(不会公开,仅用于通知回复)",tips:i.infoBar?.email?.tips||"输入QQ邮箱自动获取头像"}},y=Ry({extensions:[yb.configure({codeBlock:!1}),F1,kb,pb.configure({placeholder:i.placeholder}),R0.configure({openOnClick:!1,enableClickSelection:!0,HTMLAttributes:{class:"cursor-pointer",onclick:"return false;"}}),O1],editorProps:{handleDOMEvents:{mousedown:(U,R)=>R.target.closest("a")?(R.preventDefault(),R.stopPropagation(),setTimeout(()=>{y.value&&y.value.chain().focus().extendMarkRange("link").run()},0),!0):!1,click:(U,R)=>R.target.closest("a")?(R.preventDefault(),R.stopPropagation(),!0):!1}}});function w(){i.comment&&(c.privacy=i.comment.privacy===void 0?!1:i.comment.privacy,c.notify=i.comment.notify||1,c.userName=i.comment.userName||"",c.userEmail=i.comment.userEmail||"",c.userWebsite=i.comment.userWebsite||"",c.userAvatar=i.comment.userAvatar||"",c.content=i.comment.content||"",c.articleId=i.comment.articleId||"")}async function k(){if(!(!y||!y.value)){if(d.value=y.value.getHTML(),c.userWebsite&&(c.userWebsite.concat("http://")||c.userWebsite.concat("https://")||(c.userWebsite="https://"+c.userWebsite)),localStorage.setItem("user",JSON.stringify(c)),localStorage.setItem("comment-content",d.value),i.reply?.id&&i.reply?.id!="0"){const U=i.reply.parentId;c.parentId=U==="0"?i.reply.id:U,c.replyName=i.reply.userName,a.value="@"+l+":"}c.content=d.value,c.contentText=y.value.getText(),s("on-save",c,h.value)}}function C(){localStorage.setItem("comment-content",""),s("on-cancel")}function D(){s("add-image",u.value,h.value)}function M(U){h.value||(h.value=[]),!h.value||h.value.length==0?h.value=U:h.value=P(h.value,U[0]),f.value=[];for(let R=0;R<h.value.length;R++)f.value.push(URL.createObjectURL(h.value[R]))}function P(U,R){return[...U,R]}function T(U){f.value=U}function V(){s("update-avatar",c)}function K(){c.notify==1?c.notify=0:c.notify=1}function j(U){try{if(!h.value||!h.value.length||h.value.length<=1){h.value=[],f.value=[];return}h.value?.splice(U,1),f.value.splice(U,1)}catch(R){console.log("remove image error: ",R),h.value=[],f.value=[]}}return m.onMounted(()=>{if(!y||!y.value)return;w();const U=localStorage.getItem("user");if(c.content&&c.content.length>3)y.value.commands.setContent(c.content);else{const R=localStorage.getItem("comment-content");R&&y.value.commands.setContent(R)}if(U){const R=JSON.parse(U);c.userName=R.userName,c.userEmail=R.userEmail,c.userWebsite=R.userWebsite,V()}c.notify=1}),(U,R)=>(m.openBlock(),m.createElementBlock("div",j1,[g.enable?(m.openBlock(),m.createElementBlock("div",U1,[m.withDirectives(m.createElementVNode("img",{alt:"头像",src:c.userAvatar,class:"sus-avatar",onerror:"this.onerror=null,this.src='/error.webp'"},null,8,W1),[[m.vShow,!!c.userAvatar]]),m.withDirectives(m.createElementVNode("div",K1,[m.createElementVNode("span",null,m.toDisplayString(c?.userName?.charAt(0)),1)],512),[[m.vShow,!c.userAvatar]])])):m.createCommentVNode("",!0),m.createElementVNode("div",q1,[g.enable?(m.openBlock(),m.createElementBlock("div",J1,[g.name.show?(m.openBlock(),m.createElementBlock("div",G1,[m.withDirectives(m.createElementVNode("input",{class:"sus-input sus-username",placeholder:g.name.placeholder,title:g.name.placeholder,"onUpdate:modelValue":R[0]||(R[0]=X=>c.userName=X),maxlength:"23"},null,8,Y1),[[m.vModelText,c.userName]])])):m.createCommentVNode("",!0),g.website.show?(m.openBlock(),m.createElementBlock("div",X1,[m.createVNode(m.unref(qn.OuOToolTip),{content:g.website.tips},{default:m.withCtx(()=>[m.withDirectives(m.createElementVNode("input",{class:"sus-input sus-web",placeholder:g.website.placeholder,title:g.website.placeholder,"onUpdate:modelValue":R[1]||(R[1]=X=>c.userWebsite=X),maxlength:"35"},null,8,Q1),[[m.vModelText,c.userWebsite]])]),_:1},8,["content"])])):m.createCommentVNode("",!0),g.email.show?(m.openBlock(),m.createElementBlock("div",Z1,[m.createVNode(m.unref(qn.OuOToolTip),{content:g.email.tips},{default:m.withCtx(()=>[m.withDirectives(m.createElementVNode("input",{onBlur:V,class:"sus-input sus-email",placeholder:g.email.placeholder,title:g.email.placeholder,"onUpdate:modelValue":R[2]||(R[2]=X=>c.userEmail=X),maxlength:"35"},null,40,ew),[[m.vModelText,c.userEmail]])]),_:1},8,["content"])])):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0),m.createElementVNode("div",tw,[m.createVNode(T1,{editor:m.unref(y),showMenu:n.toolBar?.bubbleMenu?.show},null,8,["editor","showMenu"]),m.withDirectives(m.createVNode($y,{class:"sus-emoji-panel-position",emoji:o,editor:m.unref(y)},null,8,["emoji","editor"]),[[m.vShow,o.showPanel]]),m.createVNode(m.unref(Ny),{class:"sus-comment-input",editor:m.unref(y)},null,8,["editor"])]),m.createElementVNode("div",nw,[m.createElementVNode("div",rw,[o.emojis.length>=0?(m.openBlock(),m.createElementBlock("div",iw,[(m.openBlock(),m.createElementBlock("svg",{title:"表情",onClick:R[3]||(R[3]=X=>o.showPanel=!o.showPanel),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[...R[5]||(R[5]=[m.createStaticVNode('<g fill="none" data-v-f4426d84><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M9 16c.85.63 1.885 1 3 1s2.15-.37 3-1" data-v-f4426d84></path><path fill="currentColor" d="M16 10.5c0 .828-.448 1.5-1 1.5s-1-.672-1-1.5s.448-1.5 1-1.5s1 .672 1 1.5" data-v-f4426d84></path><ellipse cx="9" cy="10.5" fill="currentColor" rx="1" ry="1.5" data-v-f4426d84></ellipse><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M7 3.338A9.95 9.95 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-1.821.487-3.53 1.338-5" data-v-f4426d84></path></g>',1)])]))])):m.createCommentVNode("",!0),n.toolBar?.image?(m.openBlock(),m.createElementBlock("div",sw,[m.createElementVNode("input",{ref_key:"imgRef",ref:u,onChange:D,type:"file",id:"upload-input",name:"image",accept:"image/*"},null,544),R[6]||(R[6]=m.createStaticVNode('<label for="upload-input" data-v-f4426d84><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" data-v-f4426d84><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" data-v-f4426d84><path d="m2 12.5l1.752-1.533a2.3 2.3 0 0 1 3.14.105l4.29 4.29a2 2 0 0 0 2.564.222l.299-.21a3 3 0 0 1 3.731.225L21 18.5m-6-13h3.5m0 0H22m-3.5 0V9m0-3.5V2" data-v-f4426d84></path><path d="M22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12c0-1.128 0-2.122.02-3M12 2C7.286 2 4.929 2 3.464 3.464c-.424.425-.726.925-.94 1.536" data-v-f4426d84></path></g></svg></label>',1))])):m.createCommentVNode("",!0),n.toolBar?.notify?(m.openBlock(),m.createElementBlock("div",{key:2,onClick:K,class:"sus-comment__footer-icon"},[m.withDirectives(m.createVNode(m.unref(qn.OuOToolTip),{content:"收到回复后通知"},{default:m.withCtx(()=>[...R[7]||(R[7]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M12 6v4m-4.5 9c.655 1.748 2.422 3 4.5 3q.367 0 .72-.05M16.5 19a4.5 4.5 0 0 1-1.302 1.84M9.107 2.674A6.5 6.5 0 0 1 12 2c3.727 0 6.75 3.136 6.75 7.005v.705a4.4 4.4 0 0 0 .692 2.375l1.108 1.724c1.011 1.575.239 3.716-1.52 4.214a25.8 25.8 0 0 1-14.06 0c-1.759-.498-2.531-2.639-1.52-4.213l1.108-1.725A4.4 4.4 0 0 0 5.25 9.71v-.705c0-1.074.233-2.092.65-3.002"})],-1)])]),_:1},512),[[m.vShow,c.notify===1]]),m.withDirectives(m.createVNode(m.unref(qn.OuOToolTip),{content:"收到回复后不通知"},{default:m.withCtx(()=>[...R[8]||(R[8]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{"stroke-linejoin":"round",d:"M10 9h4l-4 4h4"}),m.createElementVNode("path",{d:"M7.5 19c.655 1.748 2.422 3 4.5 3q.367 0 .72-.05M16.5 19a4.5 4.5 0 0 1-1.302 1.84M9.107 2.674A6.5 6.5 0 0 1 12 2c3.727 0 6.75 3.136 6.75 7.005v.705a4.4 4.4 0 0 0 .692 2.375l1.108 1.724c1.011 1.575.239 3.716-1.52 4.214a25.8 25.8 0 0 1-14.06 0c-1.759-.498-2.531-2.639-1.52-4.213l1.108-1.725A4.4 4.4 0 0 0 5.25 9.71v-.705c0-1.074.233-2.092.65-3.002"})])],-1)])]),_:1},512),[[m.vShow,c.notify!==1]])])):m.createCommentVNode("",!0)]),m.createElementVNode("div",{class:"sus-comment__footer-send"},[m.createElementVNode("button",{class:"sus-button cancel",onClick:C},"取消"),m.createElementVNode("button",{class:"sus-button ok",onClick:k},"发送")])]),m.createElementVNode("div",ow,[m.withDirectives(m.createVNode(m.unref(qn.OuOCheckBox),{modelValue:c.privacy,"onUpdate:modelValue":R[4]||(R[4]=X=>c.privacy=X),checked:m.unref(p)},{default:m.withCtx(()=>[...R[9]||(R[9]=[m.createTextVNode(" 仅博主可见 ",-1)])]),_:1},8,["modelValue","checked"]),[[m.vShow,n.toolBar?.privacy?.show]]),m.withDirectives(m.createElementVNode("div",lw,null,512),[[m.vShow,n.toolBar?.privacy?.disable]])]),m.createElementVNode("div",aw,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(f.value,(X,Z)=>(m.openBlock(),m.createElementBlock("div",{class:"sus-comment__extend-img",key:X},[m.createElementVNode("img",{class:"img-item",src:X,alt:""},null,8,cw),m.createElementVNode("div",{onClick:ke=>j(Z),class:"mask"},[...R[10]||(R[10]=[m.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" data-v-f4426d84><g fill="none" stroke="currentColor" stroke-width="1.5" data-v-f4426d84><path stroke-linecap="round" d="M20.5 6h-17m6 5l.5 5m4.5-5l-.5 5" data-v-f4426d84></path><path d="M6.5 6h.11a2 2 0 0 0 1.83-1.32l.034-.103l.097-.291c.083-.249.125-.373.18-.479a1.5 1.5 0 0 1 1.094-.788C9.962 3 10.093 3 10.355 3h3.29c.262 0 .393 0 .51.019a1.5 1.5 0 0 1 1.094.788c.055.106.097.23.18.479l.097.291A2 2 0 0 0 17.5 6" data-v-f4426d84></path><path stroke-linecap="round" d="M18.374 15.4c-.177 2.654-.266 3.981-1.131 4.79s-2.195.81-4.856.81h-.774c-2.66 0-3.99 0-4.856-.81c-.865-.809-.953-2.136-1.13-4.79l-.46-6.9m13.666 0l-.2 3" data-v-f4426d84></path></g></svg>',1)])],8,dw)]))),128))])])]))}}),[["__scopeId","data-v-f4426d84"]]);function uw(n){const e=new Date(n),t=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),s=new Date,o=s.getFullYear(),l=s.getMonth()+1,a=s.getDate();if(o===t&&l==r){const c=a-i;if(c===0)return"今天";if(c<7)return c+"天前"}return o===t?`${r}月${i}日`:`${t}年${r}月${i}日`}const fw={class:"sus-item__container"},hw={class:"sus-item-svg",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},pw={class:"sus-item__row"},mw={class:"sus-item__operate"},gw={class:"sus-comment-aside"},yw={class:"sus-comment-avatar"},bw=["src"],ww={class:"sus-avatar-text"},kw={class:"sus-item-floor"},xw={class:"sus-item__main"},Sw={class:"sus-item__user"},Cw=["rel","href"],Ew={key:0,class:"sus-item-tag",title:"博主"},Mw={key:1,class:"sus-item__content-name"},vw={class:"sus-item__user-date"},Tw={key:0,class:"sus-item__content"},Ow=["innerHTML"],Nw={key:1,class:"sus-item__content"},Aw=["innerHTML"],Dw={key:0,class:"sus-item__info"},Rw={class:"sus-item__info-area"},Iw={class:"sus-item__info-useragent"},ss=Yt(m.defineComponent({__name:"item",props:{comment:{},lineHeight:{},showFooter:{type:Boolean},num:{default:1}},emits:["on-reply","on-edit","on-remove"],setup(n,{emit:e}){const t=n,r=m.ref(),i=m.ref(),s=m.ref(!1),o=e;function l(){r.value.style.display="block",s.value=!1}function a(){const p=r?.value?.clientHeight||0,g=t.lineHeight*5;p>=g&&(s.value=!0)}function c(){o("on-reply",t.comment)}function d(){o("on-edit",t.comment)}function u(){o("on-remove",t.comment)}function f(){t.comment.userAvatar||(t.comment.userAvatar="/error.webp")}function h(){const p=new Date(t.comment?.createdDate),g=new Date,y=new Date(g.getFullYear()-1,g.getMonth(),g.getDate());return p>y?"ugc noopener nofollow":"ugc noopener noreferrer nofollow"}return m.onMounted(()=>{f(),a()}),(p,g)=>(m.openBlock(),m.createElementBlock("div",fw,[m.withDirectives((m.openBlock(),m.createElementBlock("svg",hw,[...g[0]||(g[0]=[m.createElementVNode("rect",{width:"24",height:"24",fill:"none"},null,-1),m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{d:"M21 7v-.281c0-2.19 0-3.285-.707-3.884c-.707-.6-1.788-.42-3.95-.059l-1.055.176c-1.64.273-2.46.41-3.288.41s-1.648-.137-3.288-.41l-1.054-.176c-2.162-.36-3.243-.54-3.95.059S3 4.529 3 6.719V12c0 5.49 4.239 8.155 6.899 9.286c.721.307 1.082.46 2.101.46c1.02 0 1.38-.153 2.101-.46C16.761 20.155 21 17.49 21 12v-1"}),m.createElementVNode("path",{d:"M6.5 9c.291-.583 1.077-1 2-1s1.709.417 2 1m3 0c.291-.583 1.077-1 2-1s1.709.417 2 1m-9 5s1.05 1 3.5 1s3.5-1 3.5-1"})],-1)])],512)),[[m.vShow,n.comment.band==="privacy"]]),m.createElementVNode("div",pw,[m.createElementVNode("div",mw,[m.withDirectives(m.createElementVNode("span",{onClick:u,class:"sus-item__operate-delete"}," 删除 ",512),[[m.vShow,!n.comment.privacy&&n.comment.showDelete]]),m.withDirectives(m.createElementVNode("span",{onClick:d,class:"sus-item__operate-edit"}," 编辑 ",512),[[m.vShow,!n.comment.privacy&&n.comment.showEdit]]),m.withDirectives(m.createElementVNode("span",{onClick:c,class:"sus-item__operate-reply"}," 回复 ",512),[[m.vShow,!n.comment.privacy]])]),m.createElementVNode("div",gw,[m.createElementVNode("div",yw,[m.withDirectives(m.createElementVNode("img",{alt:"",class:"sus-avatar",src:n.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,bw),[[m.vShow,!!n.comment.userAvatar]]),m.withDirectives(m.createElementVNode("div",ww,[m.createElementVNode("span",null,m.toDisplayString(n.comment.userName.charAt(0)),1)],512),[[m.vShow,!n.comment.userAvatar]])]),m.createElementVNode("p",kw,m.toDisplayString(n.num),1)]),m.createElementVNode("div",xw,[m.createElementVNode("div",Sw,[m.createElementVNode("a",{target:"_blank",rel:h(),href:n.comment.userWebsite,class:m.normalizeClass([n.comment.tagName,"sus-item__user-name"])},m.toDisplayString(n.comment.userName),11,Cw),n.comment.tagName==="owner"?(m.openBlock(),m.createElementBlock("span",Ew," 博主 ")):m.createCommentVNode("",!0),n.comment.replyName?(m.openBlock(),m.createElementBlock("span",Mw,"@"+m.toDisplayString(n.comment.replyName),1)):m.createCommentVNode("",!0),m.createElementVNode("span",vw,m.toDisplayString(m.unref(uw)(n.comment.createdDate)),1)]),n.comment.privacy?(m.openBlock(),m.createElementBlock("div",Tw,[g[1]||(g[1]=m.createElementVNode("div",{class:"sus-item-privacy"},null,-1)),m.createElementVNode("span",{class:"sus-item-privacy-text",innerHTML:n.comment.content},null,8,Ow)])):(m.openBlock(),m.createElementBlock("div",Nw,[m.createElementVNode("span",{ref_key:"contentDom",ref:r,class:"sus-item__content-text",innerHTML:n.comment.content+(n.comment.contentExtends||"")},null,8,Aw),s.value?(m.openBlock(),m.createElementBlock("a",{key:0,ref_key:"showMoreDom",ref:i,class:"sus-show-detail",onClick:l},"显示更多>",512)):m.createCommentVNode("",!0)]))])]),n.showFooter&&n.comment.area&&!n.comment.privacy?(m.openBlock(),m.createElementBlock("div",Dw,[m.createElementVNode("span",Rw,[g[2]||(g[2]=m.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{d:"M12.5 7.041A3 3 0 1 0 14.959 9.5"}),m.createElementVNode("path",{d:"M5 15.216c-.647-1.654-1-3.415-1-5.073C4 5.646 7.582 2 12 2s8 3.646 8 8.143c0 4.462-2.553 9.67-6.537 11.531a3.45 3.45 0 0 1-2.926 0C9.265 21.08 8.138 20.144 7.194 19"})])],-1)),m.createTextVNode(" "+m.toDisplayString(n.comment.area),1)]),m.createElementVNode("span",Iw,[g[3]||(g[3]=m.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M5 2.252c-.774.169-1.359.45-1.828.92C2 4.343 2 6.229 2 10v1c0 2.828 0 4.243.879 5.121C3.757 17 5.172 17 8 17h8c2.828 0 4.243 0 5.121-.879C22 15.243 22 13.828 22 11v-1c0-3.771 0-5.657-1.172-6.828S17.771 2 14 2H9m7 20H8m4-5v5m10-9h-6M2 13h10"})],-1)),m.createTextVNode(" "+m.toDisplayString(n.comment.userAgent),1)])])):m.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ddb1717b"]]),Pw={class:"sus-comment__item"},Lw={key:0,class:"sus-comment__item-child"},Bw={key:1},_w={key:0,class:"sus-comment__item-footer"},hf=Yt(m.defineComponent({__name:"index",props:{comment:{},lineHeight:{default:23},showFooter:{type:Boolean,default:!1}},emits:["on-reply","on-edit","on-remove"],setup(n,{emit:e}){const t=m.ref(!1),r=e;function i(l){r("on-reply",l)}function s(l){r("on-edit",l)}function o(l){r("on-remove",l)}return(l,a)=>(m.openBlock(),m.createElementBlock("div",Pw,[m.createVNode(ss,{comment:n.comment,onOnReply:a[0]||(a[0]=c=>i(n.comment)),onOnEdit:a[1]||(a[1]=c=>s(n.comment)),onOnRemove:a[2]||(a[2]=c=>o(n.comment)),lineHeight:n.lineHeight,showFooter:n.showFooter},null,8,["comment","lineHeight","showFooter"]),n.comment.child?.length>0?(m.openBlock(),m.createElementBlock("div",Lw,[m.createVNode(ss,{onOnReply:a[3]||(a[3]=c=>i(n.comment.child[0])),onOnEdit:a[4]||(a[4]=c=>s(n.comment.child[0])),onOnRemove:a[5]||(a[5]=c=>o(n.comment.child[0])),comment:n.comment.child[0],num:2,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"]),n.comment.child?.length>1?(m.openBlock(),m.createBlock(ss,{key:0,onOnReply:a[6]||(a[6]=c=>i(n.comment.child[1])),onOnEdit:a[7]||(a[7]=c=>s(n.comment.child[1])),onOnRemove:a[8]||(a[8]=c=>o(n.comment.child[1])),comment:n.comment.child[1],num:3,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"])):m.createCommentVNode("",!0),n.comment.child?.length>2?(m.openBlock(),m.createElementBlock("div",Bw,[t.value?m.createCommentVNode("",!0):(m.openBlock(),m.createElementBlock("div",_w,[m.createElementVNode("p",{class:"sus-load-more",onClick:a[9]||(a[9]=c=>t.value=!0)}," 查看更多回复 > ")])),t.value?(m.openBlock(!0),m.createElementBlock(m.Fragment,{key:1},m.renderList(n.comment.child.slice(2),(c,d)=>(m.openBlock(),m.createBlock(ss,{onOnReply:u=>i(c),onOnEdit:u=>s(c),onOnRemove:u=>o(c),key:d,comment:c,num:4+d,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["onOnReply","onOnEdit","onOnRemove","comment","num","showFooter","lineHeight"]))),128)):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-170ec605"]]),Vw={class:"sus-top-item"},$w={class:"sus-top-item__info"},zw={class:"sus-top-item__user"},Hw={key:0,class:"sus-top-item__reply"},Fw=["innerHTML"],pf=Yt(m.defineComponent({__name:"simple",props:{comment:{}},setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",Vw,[m.createElementVNode("div",$w,[m.createElementVNode("span",zw,m.toDisplayString(n.comment.userName)+": ",1),n.comment.replyName?(m.openBlock(),m.createElementBlock("span",Hw,m.toDisplayString("@"+n.comment.replyName),1)):m.createCommentVNode("",!0)]),m.createElementVNode("span",{class:"sus-top-item__content",innerHTML:n.comment.content},null,8,Fw)]))}}),[["__scopeId","data-v-f6f1f9aa"]]),jw={class:"sus-top-item__user"},Uw={key:0,class:"sus-top-item__user-avatar"},Ww=["src"],Kw={class:"sus-top-item__user-owner"},qw={class:"sus-top-item__user-reply"},Jw=["innerHTML"],mf=Yt(m.defineComponent({__name:"index",props:{comment:{}},emits:["go-local"],setup(n,{emit:e}){const t=e;function r(){t("go-local")}return(i,s)=>(m.openBlock(),m.createElementBlock("div",{class:"sus-top-item",onClick:r},[m.createElementVNode("div",jw,[n.comment.userAvatar?(m.openBlock(),m.createElementBlock("div",Uw,[m.createElementVNode("img",{alt:"",class:"sus-avatar",loading:"lazy",decoding:"async",src:n.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,Ww)])):m.createCommentVNode("",!0),m.createElementVNode("div",Kw,m.toDisplayString(n.comment.userName),1),m.createElementVNode("div",qw,m.toDisplayString(n.comment.replyName?"@"+n.comment.replyName:""),1)]),m.createElementVNode("div",{class:"sus-top-item__content",innerHTML:n.comment.content},null,8,Jw)]))}}),[["__scopeId","data-v-250e2f2a"]]),Gw=[ff,hf,mf,pf],Yw={install(n){Gw.forEach(e=>{n.component(e.name,e)})}};je.SuSComment=ff,je.SuSList=hf,je.SuSSimpleTop=pf,je.SuSTop=mf,je.default=Yw,Object.defineProperties(je,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));