import{x as br,o as Ls,n as gl}from"./app.2ab5f89e.js";import{I as Ts}from"./ImgUpload.cf2be17d.js";var Te=navigator.userAgent,ml=navigator.platform,gt=/gecko\/\d/i.test(Te),yl=/MSIE \d/.test(Te),bl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Te),Zr=/Edge\/(\d+)/.exec(Te),re=yl||bl||Zr,ce=re&&(yl?document.documentMode||6:+(Zr||bl)[1]),Le=!Zr&&/WebKit\//.test(Te),Ms=Le&&/Qt\/\d+\.\d+/.test(Te),On=!Zr&&/Chrome\//.test(Te),Xe=/Opera\//.test(Te),wl=/Apple Computer/.test(navigator.vendor),Ds=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Te),As=/PhantomJS/.test(Te),Qr=!Zr&&/AppleWebKit/.test(Te)&&/Mobile\/\w+/.test(Te),In=/Android/.test(Te),zr=Qr||In||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Te),Ye=Qr||/Mac/.test(ml),Fs=/\bCrOS\b/.test(Te),Es=/win/i.test(ml),Nt=Xe&&Te.match(/Version\/(\d*\.\d*)/);Nt&&(Nt=Number(Nt[1]));Nt&&Nt>=15&&(Xe=!1,Le=!0);var Fo=Ye&&(Ms||Xe&&(Nt==null||Nt<12.11)),Ii=gt||re&&ce>=9;function Pr(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Rt=function(e,t){var r=e.className,n=Pr(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function mt(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ie(e,t){return mt(e).appendChild(t)}function G(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return l+(t-o);l+=a-o,l+=r-l%r,o=a+1}}var bt=function(){this.id=null,this.f=null,this.time=0,this.handler=Hn(this.onTimeout,this)};bt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)};bt.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}var hn=[""];function Hi(e){for(;hn.length<=e;)hn.push(ie(hn)+" ");return hn[e]}function ie(e){return e[e.length-1]}function Pn(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Os.test(e))}function bn(e,t){return t?t.source.indexOf("\\w")>-1&&vi(e)?!0:t.test(e):vi(e)}function No(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Is=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function gi(e){return e.charCodeAt(0)>=768&&Is.test(e)}function Cl(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function Hs(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;ot||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),l.level==1?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}var Lr=null;function Br(e,t,r){var n;Lr=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&r=="before"?n=i:Lr=i),o.from==t&&(o.from!=o.to&&r!="before"?n=i:Lr=i)}return n!=null?n:Lr}var zs=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(u,h,p){this.level=u,this.from=h,this.to=p}return function(u,h){var p=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!n.test(u))return!1;for(var b=u.length,y=[],k=0;k-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function de(e,t){var r=zi(e,t);if(!!r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i0}function hr(e){e.prototype.on=function(t,r){X(this,t,r)},e.prototype.off=function(t,r){Oe(this,t,r)}}function Ae(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Tl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function mi(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Rr(e){Ae(e),Tl(e)}function Pi(e){return e.target||e.srcElement}function Ml(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),Ye&&e.ctrlKey&&t==1&&(t=3),t}var Ps=function(){if(re&&ce<9)return!1;var e=G("div");return"draggable"in e||"dragDrop"in e}(),ui;function Ws(e){if(ui==null){var t=G("span","\u200B");Ie(e,G("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ui=t.offsetWidth<=1&&t.offsetHeight>2&&!(re&&ce<8))}var r=ui?G("span","\u200B"):G("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var fi;function _s(e){if(fi!=null)return fi;var t=Ie(e,document.createTextNode("A\u062EA")),r=It(t,0,1).getBoundingClientRect(),n=It(t,1,2).getBoundingClientRect();return mt(e),!r||r.left==r.right?!1:fi=n.right-r.right<3}var Wi=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf(` `,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),l=o.indexOf("\r");l!=-1?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Bs=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Rs=function(){var e=G("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ci=null;function Us(e){if(ci!=null)return ci;var t=Ie(e,G("span","x")),r=t.getBoundingClientRect(),n=It(t,0,1).getBoundingClientRect();return ci=Math.abs(r.left-n.left)>1}var _i={},er={};function Ks(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),_i[e]=t}function qs(e,t){er[e]=t}function Sn(e){if(typeof e=="string"&&er.hasOwnProperty(e))e=er[e];else if(e&&typeof e.name=="string"&&er.hasOwnProperty(e.name)){var t=er[e.name];typeof t=="string"&&(t={name:t}),e=xl(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Bi(e,t){t=Sn(t);var r=_i[t.name];if(!r)return Bi(e,"text/plain");var n=r(e,t);if(ir.hasOwnProperty(t.name)){var i=ir[t.name];for(var o in i)!i.hasOwnProperty(o)||(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var ir={};function Gs(e,t){var r=ir.hasOwnProperty(e)?ir[e]:ir[e]={};Ht(t,r)}function zt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ri(e,t){for(var r;e.innerMode&&(r=e.innerMode(t),!(!r||r.mode==e));)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Dl(e,t,r){return e.startState?e.startState(t,r):!0}var pe=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};pe.prototype.eol=function(){return this.pos>=this.string.length};pe.prototype.sol=function(){return this.pos==this.lineStart};pe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};pe.prototype.next=function(){if(this.post};pe.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t};pe.prototype.skipToEnd=function(){this.pos=this.string.length};pe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0};pe.prototype.backUp=function(e){this.pos-=e};pe.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}};pe.prototype.current=function(){return this.string.slice(this.start,this.pos)};pe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}};pe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)};pe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function q(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t=e.first&&tr?F(r,q(e,r).text.length):Xs(t,q(e,t.line).text.length)}function Xs(e,t){var r=e.ch;return r==null||r>t?F(e.line,t):r<0?F(e.line,0):e}function Oo(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t};Ze.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)t.baseTokenPos+=2;var r=this.baseTokens[this.baseTokenPos+1];return{type:r&&r.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}};Ze.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--};Ze.fromSaved=function(e,t,r){return t instanceof Bn?new Ze(e,zt(e.mode,t.state),r,t.lookAhead):new Ze(e,zt(e.mode,t),r)};Ze.prototype.save=function(e){var t=e!==!1?zt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Bn(t,this.maxLookAhead):t};function Fl(e,t,r,n){var i=[e.state.modeGen],o={};Po(e,t.text,e.doc.mode,r,function(u,h){return i.push(u,h)},o,n);for(var l=r.state,a=function(u){r.baseTokens=i;var h=e.state.overlays[u],p=1,b=0;r.state=!0,Po(e,t.text,h.mode,r,function(y,k){for(var S=p;by&&i.splice(p,1,y,i[p+1],D),p+=2,b=Math.min(y,D)}if(!!k)if(h.opaque)i.splice(S,p-S,y,"overlay "+k),p=S+2;else for(;Se.options.maxHighlightLength&&zt(e.doc.mode,n.state),o=Fl(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Jr(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Ze(n,!0,t);var o=Ys(e,t,r),l=o>n.first&&q(n,o-1).stateAfter,a=l?Ze.fromSaved(n,l,o):new Ze(n,Dl(n.mode),o);return n.iter(o,t,function(s){Ki(e,s.text,a);var u=a.line;s.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&ut.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var Io=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Ho(e,t,r,n){var i=e.doc,o=i.mode,l;t=V(i,t);var a=q(i,t.line),s=Jr(e,t.line,r),u=new pe(a.text,e.options.tabSize,s),h;for(n&&(h=[]);(n||u.pose.options.maxHighlightLength?(a=!1,l&&Ki(e,t,n,h.pos),h.pos=t.length,p=null):p=zo(qi(r,h,n.state,b),o),b){var y=b[0].name;y&&(p="m-"+(p?y+" "+p:y))}if(!a||u!=p){for(;sl;--a){if(a<=o.first)return o.first;var s=q(o,a-1),u=s.stateAfter;if(u&&(!r||a+(u instanceof Bn?u.lookAhead:0)<=o.modeFrontier))return a;var h=Pe(s.text,null,e.options.tabSize);(i==null||n>h)&&(i=a-1,n=h)}return i}function js(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;n--){var i=q(e,n).stateAfter;if(i&&(!(i instanceof Bn)||n+i.lookAhead=t:o.to>t);(n||(n=[])).push(new Rn(l,o.from,s?null:o.to))}}return n}function eu(e,t,r){var n;if(e)for(var i=0;i=t:o.to>t);if(a||o.from==t&&l.type=="bookmark"&&(!r||o.marker.insertLeft)){var s=o.from==null||(l.inclusiveLeft?o.from<=t:o.from0&&a)for(var E=0;E0)){var h=[s,1],p=Z(u.from,a.from),b=Z(u.to,a.to);(p<0||!l.inclusiveLeft&&!p)&&h.push({from:u.from,to:a.from}),(b>0||!l.inclusiveRight&&!b)&&h.push({from:a.to,to:u.to}),i.splice.apply(i,h),s+=h.length-3}}return i}function Il(e){var t=e.markedSpans;if(!!t){for(var r=0;rt)&&(!n||Gi(n,o.marker)<0)&&(n=o.marker)}return n}function _o(e,t,r,n,i){var o=q(e,t),l=it&&o.markedSpans;if(l)for(var a=0;a=0&&p<=0||h<=0&&p>=0)&&(h<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?Z(u.to,r)>=0:Z(u.to,r)>0)||h>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?Z(u.from,n)<=0:Z(u.from,n)<0)))return!0}}}function Je(e){for(var t;t=Pl(e);)e=t.find(-1,!0).line;return e}function nu(e){for(var t;t=Un(e);)e=t.find(1,!0).line;return e}function iu(e){for(var t,r;t=Un(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Xi(e,t){var r=q(e,t),n=Je(r);return r==n?t:le(n)}function Wl(e,t){if(t>e.lastLine())return t;var r=q(e,t),n;if(!Ct(e,r))return t;for(;n=Un(r);)r=n.find(1,!0).line;return le(r)+1}function Ct(e,t){var r=it&&t.markedSpans;if(r){for(var n=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=n)})}var ar=function(e,t,r){this.text=e,Hl(this,t),this.height=r?r(this):1};ar.prototype.lineNo=function(){return le(this)};hr(ar);function ou(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Il(e),Hl(e,r);var i=n?n(e):1;i!=e.height&&Qe(e,i)}function lu(e){e.parent=null,Il(e)}var au={},su={};function Bo(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?su:au;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function _l(e,t){var r=nr("span",null,null,Le?"padding-right: .1px":null),n={pre:nr("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;n.pos=0,n.addToken=fu,_s(e.display.measure)&&(l=st(o,e.doc.direction))&&(n.addToken=hu(n.addToken,l)),n.map=[];var a=t!=e.display.externalMeasured&&le(o);du(o,n,El(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=ai(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=ai(o.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(Ws(e.display.measure))),i==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(Le){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return de(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=ai(n.pre.className,n.textClass||"")),n}function uu(e){var t=G("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function fu(e,t,r,n,i,o,l){if(!!t){var a=e.splitSpaces?cu(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,h;if(!s.test(t))e.col+=t.length,h=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,h),re&&ce<9&&(u=!0),e.pos+=t.length;else{h=document.createDocumentFragment();for(var p=0;;){s.lastIndex=p;var b=s.exec(t),y=b?b.index-p:t.length-p;if(y){var k=document.createTextNode(a.slice(p,p+y));re&&ce<9?h.appendChild(G("span",[k])):h.appendChild(k),e.map.push(e.pos,e.pos+y,k),e.col+=y,e.pos+=y}if(!b)break;p+=y+1;var S=void 0;if(b[0]==" "){var D=e.cm.options.tabSize,A=D-e.col%D;S=h.appendChild(G("span",Hi(A),"cm-tab")),S.setAttribute("role","presentation"),S.setAttribute("cm-text"," "),e.col+=A}else b[0]=="\r"||b[0]==` `?(S=h.appendChild(G("span",b[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),S.setAttribute("cm-text",b[0]),e.col+=1):(S=e.cm.options.specialCharPlaceholder(b[0]),S.setAttribute("cm-text",b[0]),re&&ce<9?h.appendChild(G("span",[S])):h.appendChild(S),e.col+=1);e.map.push(e.pos,e.pos+1,S),e.pos++}}if(e.trailingSpace=a.charCodeAt(t.length-1)==32,r||n||i||u||o){var I=r||"";n&&(I+=n),i&&(I+=i);var L=G("span",[h],I,o);if(l)for(var E in l)l.hasOwnProperty(E)&&E!="style"&&E!="class"&&L.setAttribute(E,l[E]);return e.content.appendChild(L)}e.content.appendChild(h)}}function cu(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;iu&&p.from<=u));b++);if(p.to>=h)return e(r,n,i,o,l,a,s);e(r,n.slice(0,p.to-u),i,o,null,a,s),o=null,n=n.slice(p.to-u),u=p.to}}}function Ro(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function du(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(!n){for(var l=1;ls||Y.collapsed&&W.to==s&&W.from==s)){if(W.to!=null&&W.to!=s&&y>W.to&&(y=W.to,S=""),Y.className&&(k+=" "+Y.className),Y.css&&(b=(b?b+";":"")+Y.css),Y.startStyle&&W.from==s&&(D+=" "+Y.startStyle),Y.endStyle&&W.to==y&&(E||(E=[])).push(Y.endStyle,W.to),Y.title&&((I||(I={})).title=Y.title),Y.attributes)for(var _ in Y.attributes)(I||(I={}))[_]=Y.attributes[_];Y.collapsed&&(!A||Gi(A.marker,Y)<0)&&(A=W)}else W.from>s&&y>W.from&&(y=W.from)}if(E)for(var v=0;v=a)break;for(var d=Math.min(a,y);;){if(h){var B=s+h.length;if(!A){var Q=B>d?h.slice(0,d-s):h;t.addToken(t,Q,p?p+k:k,D,s+Q.length==y?S:"",b,I)}if(B>=d){h=h.slice(d-s),s=d;break}s=B,D=""}h=i.slice(o,o=r[u++]),p=Bo(r[u++],t.cm.options)}}}function Bl(e,t,r){this.line=t,this.rest=iu(t),this.size=this.rest?le(ie(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ct(e,t)}function wn(e,t,r){for(var n=[],i,o=t;o2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Xl(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Su(e,t){t=Je(t);var r=le(t),n=e.display.externalMeasured=new Bl(e.doc,t,r);n.lineN=r;var i=n.built=_l(e,n);return n.text=i.pre,Ie(e.display.lineMeasure,i.pre),n}function Yl(e,t,r,n){return $e(e,dr(e,t),r,n)}function Ji(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(o=s-a,i=o-1,t>=s&&(l="right")),i!=null){if(n=e[u+2],a==s&&r==(n.insertLeft?"left":"right")&&(l=r),r=="left"&&i==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[(u-=3)+2],l="left";if(r=="right"&&i==s-a)for(;u=0&&(r=e[i]).left==r.right;i--);return r}function Tu(e,t,r,n){var i=Zl(t.map,r,n),o=i.node,l=i.start,a=i.end,s=i.collapse,u;if(o.nodeType==3){for(var h=0;h<4;h++){for(;l&&gi(t.line.text.charAt(i.coverStart+l));)--l;for(;i.coverStart+a0&&(s=n="right");var p;e.options.lineWrapping&&(p=o.getClientRects()).length>1?u=p[n=="right"?p.length-1:0]:u=o.getBoundingClientRect()}if(re&&ce<9&&!l&&(!u||!u.left&&!u.right)){var b=o.parentNode.getClientRects()[0];b?u={left:b.left,right:b.left+pr(e.display),top:b.top,bottom:b.bottom}:u=jl}for(var y=u.top-t.rect.top,k=u.bottom-t.rect.top,S=(y+k)/2,D=t.view.measure.heights,A=0;A=n.text.length?(s=n.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return l(u=="before"?s-1:s,u=="before");function h(k,S,D){var A=a[S],I=A.level==1;return l(D?k-1:k,I!=D)}var p=Br(a,s,u),b=Lr,y=h(s,p,u=="before");return b!=null&&(y.other=h(s,b,u!="before")),y}function qo(e,t){var r=0;t=V(e.doc,t),e.options.lineWrapping||(r=pr(e.display)*t.ch);var n=q(e.doc,t.line),i=ot(n)+Kn(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Ci(e,t,r,n,i){var o=F(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function $i(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Ci(n.first,0,null,-1,-1);var i=Et(n,r),o=n.first+n.size-1;if(i>o)return Ci(n.first+n.size-1,q(n,o).text.length,null,1,1);t<0&&(t=0);for(var l=q(n,i);;){var a=Du(e,l,i,t,r),s=ru(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==i)return u;l=q(n,i=u.line)}}function ea(e,t,r,n){n-=Vi(t);var i=t.text.length,o=_r(function(l){return $e(e,r,l-1).bottom<=n},i,0);return i=_r(function(l){return $e(e,r,l).top>n},o,i),{begin:o,end:i}}function ta(e,t,r,n){r||(r=dr(e,t));var i=qn(e,t,$e(e,r,n),"line").top;return ea(e,t,r,i)}function Si(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Du(e,t,r,n,i){i-=ot(t);var o=dr(e,t),l=Vi(t),a=0,s=t.text.length,u=!0,h=st(t,e.doc.direction);if(h){var p=(e.options.lineWrapping?Fu:Au)(e,t,r,o,h,n,i);u=p.level!=1,a=u?p.from:p.to-1,s=u?p.to:p.from-1}var b=null,y=null,k=_r(function(P){var W=$e(e,o,P);return W.top+=l,W.bottom+=l,Si(W,n,i,!1)?(W.top<=i&&W.left<=n&&(b=P,y=W),!0):!1},a,s),S,D,A=!1;if(y){var I=n-y.left=E.bottom?1:0}return k=Cl(t.text,k,1),Ci(r,k,D,A,n-S)}function Au(e,t,r,n,i,o,l){var a=_r(function(p){var b=i[p],y=b.level!=1;return Si(qe(e,F(r,y?b.to:b.from,y?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),s=i[a];if(a>0){var u=s.level!=1,h=qe(e,F(r,u?s.from:s.to,u?"after":"before"),"line",t,n);Si(h,o,l,!0)&&h.top>l&&(s=i[a-1])}return s}function Fu(e,t,r,n,i,o,l){var a=ea(e,t,n,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var h=null,p=null,b=0;b=u||y.to<=s)){var k=y.level!=1,S=$e(e,n,k?Math.min(u,y.to)-1:Math.max(s,y.from)).right,D=SD)&&(h=y,p=D)}}return h||(h=i[i.length-1]),h.fromu&&(h={from:h.from,to:u,level:h.level}),h}var Ft;function sr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ft==null){Ft=G("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ft.appendChild(document.createTextNode("x")),Ft.appendChild(G("br"));Ft.appendChild(document.createTextNode("x"))}Ie(e.measure,Ft);var r=Ft.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),mt(e.measure),r||1}function pr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=G("span","xxxxxxxxxx"),r=G("pre",[t],"CodeMirror-line-like");Ie(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function eo(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;r[a]=o.offsetLeft+o.clientLeft+i,n[a]=o.clientWidth}return{fixedPos:to(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function to(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ra(e){var t=sr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/pr(e.display)-3);return function(i){if(Ct(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var r=e.display.view,n=0;nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)it&&Xi(e.doc,t)i.viewFrom?vt(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)vt(e);else if(t<=i.viewFrom){var o=dn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):vt(e)}else if(r>=i.viewTo){var l=dn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):vt(e)}else{var a=dn(e,t,t,-1),s=dn(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(wn(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):vt(e)}var u=i.externalMeasured;u&&(r=i.lineN&&t=n.viewTo)){var o=n.view[Wt(e,t)];if(o.node!=null){var l=o.changes||(o.changes=[]);Ce(l,r)==-1&&l.push(r)}}}function vt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function dn(e,t,r,n){var i=Wt(e,t),o,l=e.display.view;if(!it||r==e.doc.first+e.doc.size)return{index:i,lineN:r};for(var a=e.display.viewFrom,s=0;s0){if(i==l.length-1)return null;o=a+l[i].size-t,i++}else o=a-t;t+=o,r+=o}for(;Xi(e.doc,r)!=r;){if(i==(n<0?0:l.length-1))return null;r+=n*l[i-(n<0?1:0)].size,i+=n}return{index:i,lineN:r}}function Eu(e,t,r){var n=e.display,i=n.view;i.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=wn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=wn(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Wt(e,r)))),n.viewTo=r}function Go(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||a.to().line0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function oa(e){e.state.focused||(e.display.input.focus(),io(e))}function la(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,$r(e))},100)}function io(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(de(e,"focus",e,t),e.state.focused=!0,Ut(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),Le&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),no(e))}function $r(e,t){e.state.delayingBlurEvent||(e.state.focused&&(de(e,"blur",e,t),e.state.focused=!1,Rt(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Gn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||h<-.005)&&(Qe(i.line,l),Xo(i.line),i.rest))for(var p=0;pe.display.sizerWidth){var b=Math.ceil(a/pr(e.display));b>e.display.maxLineLength&&(e.display.maxLineLength=b,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Xo(e){if(e.widgets)for(var t=0;t=l&&(o=Et(t,ot(q(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function Ou(e,t){if(!ye(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!As){var o=G("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-Kn(e.display))+`px; height: `+(t.bottom-t.top+Ve(e)+r.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Iu(e,t,r,n){n==null&&(n=0);var i;!e.options.lineWrapping&&t==r&&(t=t.ch?F(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?F(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,a=qe(e,t),s=!r||r==t?a:qe(e,r);i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-n,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+n};var u=lo(e,i),h=e.doc.scrollTop,p=e.doc.scrollLeft;if(u.scrollTop!=null&&(en(e,u.scrollTop),Math.abs(e.doc.scrollTop-h)>1&&(l=!0)),u.scrollLeft!=null&&(qt(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(l=!0)),!l)break}return i}function Hu(e,t){var r=lo(e,t);r.scrollTop!=null&&en(e,r.scrollTop),r.scrollLeft!=null&&qt(e,r.scrollLeft)}function lo(e,t){var r=e.display,n=sr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,o=Qi(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+Zi(r),s=t.topa-n;if(t.topi+o){var h=Math.min(t.top,(u?a:t.bottom)-o);h!=i&&(l.scrollTop=h)}var p=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft,b=Kt(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),y=t.right-t.left>b;return y&&(t.right=t.left+b),t.left<10?l.scrollLeft=0:t.leftb+p-3&&(l.scrollLeft=t.right+(y?0:10)-b),l}function ao(e,t){t!=null&&(Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function vr(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Er(e,t,r){(t!=null||r!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function zu(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=qo(e,t.from),n=qo(e,t.to);aa(e,r,n,t.margin)}}function aa(e,t,r,n){var i=lo(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Er(e,i.scrollLeft,i.scrollTop)}function en(e,t){Math.abs(e.doc.scrollTop-t)<2||(gt||Li(e,{top:t}),sa(e,t,!0),gt&&Li(e),rn(e,100))}function sa(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),!(e.display.scroller.scrollTop==t&&!r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function qt(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),!((r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)&&(e.doc.scrollLeft=t,ha(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Xr(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Zi(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Gt=function(e,t,r){this.cm=r;var n=this.vert=G("div",[G("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=G("div",[G("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),X(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),X(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,re&&ce<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Gt.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}};Gt.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};Gt.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};Gt.prototype.zeroWidthHack=function(){var e=Ye&&!Ds?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new bt,this.disableVert=new bt};Gt.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var i=e.getBoundingClientRect(),o=r=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)};Gt.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var tn=function(){};tn.prototype.update=function(){return{bottom:0,right:0}};tn.prototype.setScrollLeft=function(){};tn.prototype.setScrollTop=function(){};tn.prototype.clear=function(){};function ur(e,t){t||(t=Xr(e));var r=e.display.barWidth,n=e.display.barHeight;Yo(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Gn(e),Yo(e,Xr(e)),r=e.display.barWidth,n=e.display.barHeight}function Yo(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var ua={native:Gt,null:tn};function fa(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Rt(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ua[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),X(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?qt(e,t):en(e,t)},e),e.display.scrollbars.addClass&&Ut(e.display.wrapper,e.display.scrollbars.addClass)}var Pu=0;function Xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Pu},pu(e.curOp)}function Yt(e){var t=e.curOp;t&&gu(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Bu(e){e.updatedDisplay=e.mustUpdate&&so(e.cm,e.update)}function Ru(e){var t=e.cm,r=t.display;e.updatedDisplay&&Gn(t),e.barMeasure=Xr(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Yl(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Kt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Uu(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Jr(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?zt(t.mode,n.state):null,s=Fl(e,o,n,!0);a&&(n.state=a),o.styles=s.styles;var u=o.styleClasses,h=s.classes;h?o.styleClasses=h:u&&(o.styleClasses=null);for(var p=!l||l.length!=o.styles.length||u!=h&&(!u||!h||u.bgClass!=h.bgClass||u.textClass!=h.textClass),b=0;!p&&br)return rn(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Ee(e,function(){for(var o=0;o=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&Go(e)==0)return!1;da(e)&&(vt(e),t.dims=eo(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroml&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),it&&(o=Xi(e.doc,o),l=Wl(e.doc,l));var a=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Eu(e,o,l),r.viewOffset=ot(q(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Go(e);if(!a&&s==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var u=Xu(e);return s>4&&(r.lineDiv.style.display="none"),ju(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Yu(u),mt(r.cursorDiv),mt(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,a&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,rn(e,400)),r.updateLineNumbers=null,!0}function ca(e,t){for(var r=t.viewport,n=!0;!((!n||!e.options.lineWrapping||t.oldDisplayWidth==Kt(e))&&(r&&r.top!=null&&(r={top:Math.min(e.doc.height+Zi(e.display)-Qi(e),r.top)}),t.visible=oo(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)||!so(e,t));n=!1){Gn(e);var i=Xr(e);Fr(e),ur(e,i),fo(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Li(e,t){var r=new Yn(e,t);if(so(e,r)){Gn(e),ca(e,r);var n=Xr(e);Fr(e),ur(e,n),fo(e,n),r.finish()}}function ju(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function a(k){var S=k.nextSibling;return Le&&Ye&&e.display.currentWheelTarget==k?k.style.display="none":k.parentNode.removeChild(k),S}for(var s=n.view,u=n.viewFrom,h=0;h-1&&(y=!1),Rl(e,p,u,r)),y&&(mt(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(Ui(e.options,u)))),l=p.node.nextSibling}u+=p.size}for(;l;)l=a(l)}function uo(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function fo(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ve(e)+"px"}function ha(e){var t=e.display,r=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var n=to(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;ll.clientWidth,s=l.scrollHeight>l.clientHeight;if(!!(n&&a||i&&s)){if(i&&Ye&&Le){e:for(var u=t.target,h=o.view;u!=l;u=u.parentNode)for(var p=0;p=0&&Z(e,i.to())<=0)return n}return-1};var ne=function(e,t){this.anchor=e,this.head=t};ne.prototype.from=function(){return _n(this.anchor,this.head)};ne.prototype.to=function(){return Wn(this.anchor,this.head)};ne.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Ge(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(b,y){return Z(b.from(),y.from())}),r=Ce(t,i);for(var o=1;o0:s>=0){var u=_n(a.from(),l.from()),h=Wn(a.to(),l.to()),p=a.empty()?l.from()==l.head:a.from()==a.head;o<=r&&--r,t.splice(--o,2,new ne(p?h:u,p?u:h))}}return new He(t,r)}function wt(e,t){return new He([new ne(e,t||e)],0)}function kt(e){return e.text?F(e.from.line+e.text.length-1,ie(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Zo(e,t){if(Z(e,t.from)<0)return e;if(Z(e,t.to)<=0)return kt(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=kt(t).ch-t.to.ch),F(r,n)}function co(e,t){for(var r=[],n=0;n1&&e.remove(a.line+1,k-1),e.insert(a.line+1,A)}ke(e,"change",e,t)}function _t(e,t,r){function n(i,o,l){if(i.linked)for(var a=0;a1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ie(e.done)}function wa(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,l,a;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(l=$u(i,i.lastOp==n)))a=ie(l.changes),Z(t.from,t.to)==0&&Z(t.from,a.to)==0?a.to=kt(t):l.changes.push(Di(e,t));else{var s=ie(i.done);for((!s||!s.ranges)&&Dn(e.sel,i.done),l={changes:[Di(e,t)],generation:i.generation},i.done.push(l);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||de(e,"historyAdded")}function ef(e,t,r,n){var i=t.charAt(0);return i=="*"||i=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function tf(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ef(e,o,ie(i.done),t))?i.done[i.done.length-1]=t:Dn(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ba(i.undone)}function Dn(e,t){var r=ie(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Jo(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(l){l.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=l.markedSpans),++o})}function rf(e){if(!e)return null;for(var t,r=0;r-1&&(ie(a)[p]=u[p],delete u[p])}}return n}function po(e,t,r,n){if(n){var i=e.anchor;if(r){var o=Z(t,i)<0;o!=Z(r,i)<0?(i=t,t=r):o!=Z(t,r)<0&&(t=r)}return new ne(i,t)}else return new ne(r||t,t)}function jn(e,t,r,n,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),xe(e,new He([po(e.sel.primary(),t,r,i)],0),n)}function $o(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:a.to>t.ch))){if(i&&(de(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--l;continue}else break;if(!s.atomic)continue;if(r){var p=s.find(n<0?1:-1),b=void 0;if((n<0?h:u)&&(p=tl(e,p,-n,p&&p.line==t.line?o:null)),p&&p.line==t.line&&(b=Z(p,r))&&(n<0?b<0:b>0))return tr(e,p,t,n,i)}var y=s.find(n<0?-1:1);return(n<0?u:h)&&(y=tl(e,y,n,y.line==t.line?o:null)),y?tr(e,y,t,n,i):null}}return t}function An(e,t,r,n,i){var o=n||1,l=tr(e,t,r,o,i)||!i&&tr(e,t,r,o,!0)||tr(e,t,r,-o,i)||!i&&tr(e,t,r,-o,!0);return l||(e.cantEdit=!0,F(e.first,0))}function tl(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?V(e,F(t.line-1)):null:r>0&&t.ch==(n||q(e,t.line)).text.length?t.line=0;--i)rl(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else rl(e,t)}}function rl(e,t){if(!(t.text.length==1&&t.text[0]==""&&Z(t.from,t.to)==0)){var r=co(e,t);wa(e,t,r,e.cm?e.cm.curOp.id:NaN),Yr(e,t,r,wi(e,t));var n=[];_t(e,function(i,o){!o&&Ce(n,i.history)==-1&&(Ma(i.history,t),n.push(i.history)),Yr(i,t,null,wi(i,t))})}}function gn(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!(n&&!r)){for(var i=e.history,o,l=e.sel,a=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,u=0;u=0;--y){var k=b(y);if(k)return k.v}}}}function nl(e,t){if(t!=0&&(e.first+=t,e.sel=new He(Pn(e.sel.ranges,function(i){return new ne(F(i.anchor.line+t,i.anchor.ch),F(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){Fe(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:F(o,q(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ot(e,t.from,t.to),r||(r=co(e,t)),e.cm?lf(e.cm,t,n):ho(e,t,n),Zn(e,r,et),e.cantEdit&&An(e,F(e.firstLine(),0))&&(e.cantEdit=!1)}}function lf(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=le(Je(q(n,o.line))),n.iter(s,l.line+1,function(y){if(y==i.maxLine)return a=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ll(e),ho(n,t,r,ra(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,function(y){var k=Mn(y);k>i.maxLineLength&&(i.maxLine=y,i.maxLineLength=k,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),js(n,o.line),rn(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?Fe(e):o.line==l.line&&t.text.length==1&&!ga(e.doc,t)?St(e,o.line,"text"):Fe(e,o.line,l.line+1,u);var h=We(e,"changes"),p=We(e,"change");if(p||h){var b={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};p&&ke(e,"change",e,b),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(b)}e.display.selForContextMenu=null}function gr(e,t,r,n,i){var o;n||(n=r),Z(n,r)<0&&(o=[n,r],r=o[0],n=o[1]),typeof t=="string"&&(t=e.splitLines(t)),fr(e,{from:r,to:n,text:t,origin:i})}function il(e,t,r,n){r1||!(this.children[0]instanceof Nr))){var s=[];this.collapse(s),this.children=[new Nr(s)],this.children[0].parent=this}},collapse:function(e){for(var t=this,r=0;r50){for(var a=o.lines.length%25+25,s=a;s10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=this,i=0;it.display.maxLineLength&&(t.display.maxLine=h,t.display.maxLineLength=p,t.display.maxLineChanged=!0)}i!=null&&t&&this.collapsed&&Fe(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ca(t.doc)),t&&ke(t,"markerCleared",t,this,i,o),r&&Yt(t),this.parent&&this.parent.clear()}};Lt.prototype.find=function(e,t){var r=this;e==null&&this.type=="bookmark"&&(e=1);for(var n,i,o=0;o0||l==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=nr("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(_o(e,t.line,t,r,o)||t.line!=r.line&&_o(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Qs()}o.addToHistory&&wa(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var a=t.line,s=e.cm,u;if(e.iter(a,r.line+1,function(p){s&&o.collapsed&&!s.options.lineWrapping&&Je(p)==s.display.maxLine&&(u=!0),o.collapsed&&a!=t.line&&Qe(p,0),Vs(p,new Rn(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(p){Ct(e,p)&&Qe(p,0)}),o.clearOnEnter&&X(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Zs(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Aa,o.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),o.collapsed)Fe(s,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var h=t.line;h<=r.line;h++)St(s,h,"text");o.atomic&&Ca(s.doc),ke(s,"markerAdded",s,o)}return o}var on=function(e,t){var r=this;this.markers=e,this.primary=t;for(var n=0;n=0;u--)fr(n,i[u]);s?ka(this,s):this.cm&&vr(this.cm)}),undo:me(function(){gn(this,"undo")}),redo:me(function(){gn(this,"redo")}),undoSelection:me(function(){gn(this,"undo",!0)}),redoSelection:me(function(){gn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=V(this,e),t=V(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var a=0;a=s.to||s.from==null&&i!=e.line||s.from!=null&&i==t.line&&s.from>=t.ch)&&(!r||r(s.marker))&&n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=o,++r}),V(this,F(r,t))},indexFromPos:function(e){e=V(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var u=e.dataTransfer.getData("Text");if(u){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),Zn(t.doc,wt(r,r)),h)for(var p=0;p=0;a--)gr(e.doc,"",n[a].from,n[a].to,"+delete");vr(e)})}function go(e,t,r){var n=Cl(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ai(e,t,r){var n=go(e,t.ch,r);return n==null?null:new F(t.line,n,r<0?"after":"before")}function mo(e,t,r,n,i){if(e){var o=st(r,t.doc.direction);if(o){var l=i<0?ie(o):o[0],a=i<0==(l.level==1),s=a?"after":"before",u;if(l.level>0||t.doc.direction=="rtl"){var h=dr(t,r);u=i<0?r.text.length-1:0;var p=$e(t,h,u).top;u=_r(function(b){return $e(t,h,b).top==p},i<0==(l.level==1)?l.from:l.to-1,u),s=="before"&&(u=go(r,u,1))}else u=i<0?l.to:l.from;return new F(n,u,s)}}return new F(n,i<0?r.text.length:0,i<0?"before":"after")}function wf(e,t,r,n){var i=st(t,e.doc.direction);if(!i)return Ai(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=Br(i,r.ch,r.sticky),l=i[o];if(e.doc.direction=="ltr"&&l.level%2==0&&(n>0?l.to>r.ch:l.from=l.from&&b>=h.begin)){var y=p?"before":"after";return new F(r.line,b,y)}}var k=function(A,I,L){for(var E=function(_,v){return v?new F(r.line,a(_,1),"before"):new F(r.line,_,"after")};A>=0&&A0==(P.level!=1),Y=W?L.begin:a(L.end,-1);if(P.from<=Y&&Y0?h.end:a(h.begin,-1);return D!=null&&!(n>0&&D==t.text.length)&&(S=k(n>0?0:i.length-1,n,u(D)),S)?S:null}var jr={selectAll:La,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),et)},killLine:function(e){return Vt(e,function(t){if(t.empty()){var r=q(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new F(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),F(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=q(e.doc,i.line-1).text;l&&(i=new F(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),F(i.line-1,l.length-1),i,"+transpose"))}}r.push(new ne(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Ee(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;ne&&Z(t,this.pos)==0&&r==this.button};var Cr,Sr;function Mf(e,t){var r=+new Date;return Sr&&Sr.compare(r,e,t)?(Cr=Sr=null,"triple"):Cr&&Cr.compare(r,e,t)?(Sr=new Ei(r,e,t),Cr=null,"double"):(Cr=new Ei(r,e,t),Sr=null,"single")}function Ba(e){var t=this,r=t.display;if(!(ye(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.input.ensurePolled(),r.shift=e.shiftKey,lt(r,e)){Le||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(!Ni(t,e)){var n=Pt(t,e),i=Ml(e),o=n?Mf(n,i):"single";window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(n&&Df(t,i,n,o,e))&&(i==1?n?Ff(t,n,o,e):Pi(e)==r.scroller&&Ae(e):i==2?(n&&jn(t.doc,n),setTimeout(function(){return r.input.focus()},20)):i==3&&(Ii?t.display.input.onContextMenu(e):la(t)))}}}function Df(e,t,r,n,i){var o="Click";return n=="double"?o="Double"+o:n=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,Ir(e,Oa(o,i),i,function(l){if(typeof l=="string"&&(l=jr[l]),!l)return!1;var a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),a=l(e,r)!=zn}finally{e.state.suppressEdits=!1}return a})}function Af(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(i.unit==null){var o=Fs?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),i.addNew==null&&(i.addNew=Ye?r.metaKey:r.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(Ye?r.altKey:r.ctrlKey)),i}function Ff(e,t,r,n){re?setTimeout(Hn(oa,e),0):e.curOp.focus=at();var i=Af(e,r,n),o=e.doc.sel,l;e.options.dragDrop&&Ps&&!e.isReadOnly()&&r=="single"&&(l=o.contains(t))>-1&&(Z((l=o.ranges[l]).from(),t)<0||t.xRel>0)&&(Z(l.to(),t)>0||t.xRel<0)?Ef(e,n,t,i):Nf(e,n,t,i)}function Ef(e,t,r,n){var i=e.display,o=!1,l=be(e,function(u){Le&&(i.scroller.draggable=!1),e.state.draggingText=!1,Oe(i.wrapper.ownerDocument,"mouseup",l),Oe(i.wrapper.ownerDocument,"mousemove",a),Oe(i.scroller,"dragstart",s),Oe(i.scroller,"drop",l),o||(Ae(u),n.addNew||jn(e.doc,r,null,null,n.extend),Le||re&&ce==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),a=function(u){o=o||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},s=function(){return o=!0};Le&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),X(i.wrapper.ownerDocument,"mouseup",l),X(i.wrapper.ownerDocument,"mousemove",a),X(i.scroller,"dragstart",s),X(i.scroller,"drop",l),la(e),setTimeout(function(){return i.input.focus()},20)}function cl(e,t,r){if(r=="char")return new ne(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new ne(F(t.line,0),V(e.doc,F(t.line+1,0)));var n=r(e,t);return new ne(n.from,n.to)}function Nf(e,t,r,n){var i=e.display,o=e.doc;Ae(t);var l,a,s=o.sel,u=s.ranges;if(n.addNew&&!n.extend?(a=o.sel.contains(r),a>-1?l=u[a]:l=new ne(r,r)):(l=o.sel.primary(),a=o.sel.primIndex),n.unit=="rectangle")n.addNew||(l=new ne(r,r)),r=Pt(e,t,!0,!0),a=-1;else{var h=cl(e,r,n.unit);n.extend?l=po(l,h.anchor,h.head,n.extend):l=h}n.addNew?a==-1?(a=u.length,xe(o,Ge(e,u.concat([l]),a),{scroll:!1,origin:"*mouse"})):u.length>1&&u[a].empty()&&n.unit=="char"&&!n.extend?(xe(o,Ge(e,u.slice(0,a).concat(u.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):vo(o,a,l,si):(a=0,xe(o,new He([l],0),si),s=o.sel);var p=r;function b(L){if(Z(p,L)!=0)if(p=L,n.unit=="rectangle"){for(var E=[],P=e.options.tabSize,W=Pe(q(o,r.line).text,r.ch,P),Y=Pe(q(o,L.line).text,L.ch,P),_=Math.min(W,Y),v=Math.max(W,Y),C=Math.min(r.line,L.line),d=Math.min(e.lastLine(),Math.max(r.line,L.line));C<=d;C++){var B=q(o,C).text,Q=pi(B,_,P);_==v?E.push(new ne(F(C,Q),F(C,Q))):B.length>Q&&E.push(new ne(F(C,Q),F(C,pi(B,v,P))))}E.length||E.push(new ne(r,r)),xe(o,Ge(e,s.ranges.slice(0,a).concat(E),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(L)}else{var j=l,w=cl(e,L,n.unit),T=j.anchor,x;Z(w.anchor,T)>0?(x=w.head,T=_n(j.from(),w.anchor)):(x=w.anchor,T=Wn(j.to(),w.head));var K=s.ranges.slice(0);K[a]=Of(e,new ne(V(o,T),x)),xe(o,Ge(e,K,a),si)}}var y=i.wrapper.getBoundingClientRect(),k=0;function S(L){var E=++k,P=Pt(e,L,!0,n.unit=="rectangle");if(!!P)if(Z(P,p)!=0){e.curOp.focus=at(),b(P);var W=oo(i,o);(P.line>=W.to||P.liney.bottom?20:0;Y&&setTimeout(be(e,function(){k==E&&(i.scroller.scrollTop+=Y,S(L))}),50)}}function D(L){e.state.selectingText=!1,k=1/0,L&&(Ae(L),i.input.focus()),Oe(i.wrapper.ownerDocument,"mousemove",A),Oe(i.wrapper.ownerDocument,"mouseup",I),o.history.lastSelOrigin=null}var A=be(e,function(L){L.buttons===0||!Ml(L)?D(L):S(L)}),I=be(e,D);e.state.selectingText=I,X(i.wrapper.ownerDocument,"mousemove",A),X(i.wrapper.ownerDocument,"mouseup",I)}function Of(e,t){var r=t.anchor,n=t.head,i=q(e.doc,r.line);if(Z(r,n)==0&&r.sticky==n.sticky)return t;var o=st(i);if(!o)return t;var l=Br(o,r.ch,r.sticky),a=o[l];if(a.from!=r.ch&&a.to!=r.ch)return t;var s=l+(a.from==r.ch==(a.level!=1)?0:1);if(s==0||s==o.length)return t;var u;if(n.line!=r.line)u=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var h=Br(o,n.ch,n.sticky),p=h-l||(n.ch-r.ch)*(a.level==1?-1:1);h==s-1||h==s?u=p<0:u=p>0}var b=o[s+(u?-1:0)],y=u==(b.level==1),k=y?b.from:b.to,S=y?"after":"before";return r.ch==k&&r.sticky==S?t:new ne(new F(r.line,k,S),n)}function Ra(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ae(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!We(e,r))return mi(t);o-=a.top-l.viewOffset;for(var s=0;s=i){var h=Et(e.doc,o),p=e.display.gutterSpecs[s];return de(e,r,e,h,p.className,t),mi(t)}}}function Ni(e,t){return Ra(e,t,"gutterClick",!0)}function If(e,t){lt(e.display,t)||Hf(e,t)||ye(e,t,"contextmenu")||Ii||e.display.input.onContextMenu(t)}function Hf(e,t){return We(e,"gutterContextMenu")?Ra(e,t,"gutterContextMenu",!1):!1}function Ua(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gr(e)}var rr={toString:function(){return"CodeMirror.Init"}},Ka={},Cn={};function zf(e){var t=e.optionHandlers;function r(n,i,o,l){e.defaults[n]=i,o&&(t[n]=l?function(a,s,u){u!=rr&&o(a,s,u)}:o)}e.defineOption=r,e.Init=rr,r("value","",function(n,i){return n.setValue(i)},!0),r("mode",null,function(n,i){n.doc.modeOption=i,Mi(n)},!0),r("indentUnit",2,Mi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){Tr(n),Gr(n),Fe(n)},!0),r("lineSeparator",null,function(n,i){if(n.doc.lineSep=i,!!i){var o=[],l=n.doc.first;n.doc.iter(function(s){for(var u=0;;){var h=s.text.indexOf(i,u);if(h==-1)break;u=h+i.length,o.push(F(l,h))}l++});for(var a=o.length-1;a>=0;a--)gr(n.doc,i,o[a],F(o[a].line,o[a].ch+i.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,i,o){n.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=rr&&n.refresh()}),r("specialCharPlaceholder",uu,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",zr?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running src")},!0),r("spellcheck",!1,function(n,i){return n.getInputField().spellcheck=i},!0),r("autocorrect",!1,function(n,i){return n.getInputField().autocorrect=i},!0),r("autocapitalize",!1,function(n,i){return n.getInputField().autocapitalize=i},!0),r("rtlMoveVisually",!Es),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){Ua(n),wr(n)},!0),r("keyMap","default",function(n,i,o){var l=Fn(i),a=o!=rr&&Fn(o);a&&a.detach&&a.detach(n,l),l.attach&&l.attach(n,a||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Wf,!0),r("gutters",[],function(n,i){n.display.gutterSpecs=Ti(i,n.options.lineNumbers),wr(n)},!0),r("fixedGutter",!0,function(n,i){n.display.gutters.style.left=i?to(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return ur(n)},!0),r("scrollbarStyle","native",function(n){fa(n),ur(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,i){n.display.gutterSpecs=Ti(n.options.gutters,i),wr(n)},!0),r("firstLineNumber",1,wr,!0),r("lineNumberFormatter",function(n){return n},wr,!0),r("showCursorWhenSelecting",!1,Fr,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,i){i=="nocursor"&&($r(n),n.display.input.blur()),n.display.input.readOnlyChanged(i)}),r("disableInput",!1,function(n,i){i||n.display.input.reset()},!0),r("dragDrop",!0,Pf),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Fr,!0),r("singleCursorHeightPerLine",!0,Fr,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Tr,!0),r("addModeClass",!1,Tr,!0),r("pollInterval",100),r("undoDepth",200,function(n,i){return n.doc.history.undoDepth=i}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,Tr,!0),r("moveInputWithCursor",!0,function(n,i){i||n.display.input.resetPosition()}),r("tabindex",null,function(n,i){return n.display.input.getField().tabIndex=i||""}),r("autofocus",null),r("direction","ltr",function(n,i){return n.doc.setDirection(i)},!0),r("phrases",null)}function Pf(e,t,r){var n=r&&r!=rr;if(!t!=!n){var i=e.display.dragFunctions,o=t?X:Oe;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Wf(e){e.options.lineWrapping?(Ut(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Rt(e.display.wrapper,"CodeMirror-wrap"),Yi(e)),ro(e),Fe(e),Gr(e),setTimeout(function(){return ur(e)},100)}function R(e,t){var r=this;if(!(this instanceof R))return new R(e,t);this.options=t=t?Ht(t):{},Ht(Ka,t,!1);var n=t.value;typeof n=="string"?n=new De(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new R.inputStyles[t.inputStyle](this),o=this.display=new Zu(e,n,i,t);o.wrapper.CodeMirror=this,Ua(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),fa(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new bt,keySeq:null,specialChars:null},t.autofocus&&!zr&&o.input.focus(),re&&ce<11&&setTimeout(function(){return r.display.input.reset(!0)},20),_f(this),vf(),Xt(this),this.curOp.forceUpdate=!0,ma(this,n),t.autofocus&&!zr||this.hasFocus()?setTimeout(Hn(io,this),20):$r(this);for(var l in Cn)Cn.hasOwnProperty(l)&&Cn[l](r,t[l],rr);da(this),t.finishInit&&t.finishInit(this);for(var a=0;a20*20}X(t.scroller,"touchstart",function(s){if(!ye(e,s)&&!o(s)&&!Ni(e,s)){t.input.ensurePolled(),clearTimeout(r);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-n.end<=300?n:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),X(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),X(t.scroller,"touchend",function(s){var u=t.activeTouch;if(u&&!lt(t,s)&&u.left!=null&&!u.moved&&new Date-u.start<300){var h=e.coordsChar(t.activeTouch,"page"),p;!u.prev||l(u,u.prev)?p=new ne(h,h):!u.prev.prev||l(u,u.prev.prev)?p=e.findWordAt(h):p=new ne(F(h.line,0),V(e.doc,F(h.line+1,0))),e.setSelection(p.anchor,p.head),e.focus(),Ae(s)}i()}),X(t.scroller,"touchcancel",i),X(t.scroller,"scroll",function(){t.scroller.clientHeight&&(en(e,t.scroller.scrollTop),qt(e,t.scroller.scrollLeft,!0),de(e,"scroll",e))}),X(t.scroller,"mousewheel",function(s){return jo(e,s)}),X(t.scroller,"DOMMouseScroll",function(s){return jo(e,s)}),X(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){ye(e,s)||Rr(s)},over:function(s){ye(e,s)||(pf(e,s),Rr(s))},start:function(s){return df(e,s)},drop:be(e,hf),leave:function(s){ye(e,s)||Ea(e)}};var a=t.input.getField();X(a,"keyup",function(s){return Wa.call(e,s)}),X(a,"keydown",be(e,Pa)),X(a,"keypress",be(e,_a)),X(a,"focus",function(s){return io(e,s)}),X(a,"blur",function(s){return $r(e,s)})}var Oi=[];R.defineInitHook=function(e){return Oi.push(e)};function Hr(e,t,r,n){var i=e.doc,o;r==null&&(r="add"),r=="smart"&&(i.mode.indent?o=Jr(e,t).state:r="prev");var l=e.options.tabSize,a=q(i,t),s=Pe(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var u=a.text.match(/^\s*/)[0],h;if(!n&&!/\S/.test(a.text))h=0,r="not";else if(r=="smart"&&(h=i.mode.indent(o,a.text.slice(u.length),a.text),h==zn||h>150)){if(!n)return;r="prev"}r=="prev"?t>i.first?h=Pe(q(i,t-1).text,null,l):h=0:r=="add"?h=s+e.options.indentUnit:r=="subtract"?h=s-e.options.indentUnit:typeof r=="number"&&(h=s+r),h=Math.max(0,h);var p="",b=0;if(e.options.indentWithTabs)for(var y=Math.floor(h/l);y;--y)b+=l,p+=" ";if(bl,s=Wi(t),u=null;if(a&&n.ranges.length>1)if(Ke&&Ke.text.join(` `)==t){if(n.ranges.length%Ke.text.length==0){u=[];for(var h=0;h=0;b--){var y=n.ranges[b],k=y.from(),S=y.to();y.empty()&&(r&&r>0?k=F(k.line,k.ch-r):e.state.overwrite&&!a?S=F(S.line,Math.min(q(o,S.line).text.length,S.ch+ie(s).length)):a&&Ke&&Ke.lineWise&&Ke.text.join(` `)==t&&(k=S=F(k.line,0)));var D={from:k,to:S,text:u?u[b%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};fr(e.doc,D),ke(e,"inputRead",e,D)}t&&!a&&Ga(e,t),vr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=p),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function qa(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ee(t,function(){return yo(t,r,0,null,"paste")}),!0}function Ga(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var a=0;a-1){l=Hr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(q(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Hr(e,i.head.line,"smart"));l&&ke(e,"electricInput",e,i.head.line)}}}function Xa(e){for(var t=[],r=[],n=0;nl&&(Hr(i,s.head.line,n,!0),l=s.head.line,a==i.doc.sel.primIndex&&vr(i));else{var u=s.from(),h=s.to(),p=Math.max(l,u.line);l=Math.min(i.lastLine(),h.line-(h.ch?0:1))+1;for(var b=p;b0&&vo(i.doc,a,new ne(u,y[a].to()),et)}}}),getTokenAt:function(n,i){return Ho(this,n,i)},getLineTokens:function(n,i){return Ho(this,F(n),i,!0)},getTokenTypeAt:function(n){n=V(this.doc,n);var i=El(this,q(this.doc,n.line)),o=0,l=(i.length-1)/2,a=n.ch,s;if(a==0)s=i[2];else for(;;){var u=o+l>>1;if((u?i[u*2-1]:0)>=a)l=u;else if(i[u*2+1]s&&(n=s,l=!0),a=q(this.doc,n)}else a=n;return qn(this,a,{top:0,left:0},i||"page",o||l).top+(l?this.doc.height-ot(a):0)},defaultTextHeight:function(){return sr(this.display)},defaultCharWidth:function(){return pr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,i,o,l,a){var s=this.display;n=qe(this,V(this.doc,n));var u=n.bottom,h=n.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),s.sizer.appendChild(i),l=="over")u=n.top;else if(l=="above"||l=="near"){var p=Math.max(s.wrapper.clientHeight,this.doc.height),b=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(l=="above"||n.bottom+i.offsetHeight>p)&&n.top>i.offsetHeight?u=n.top-i.offsetHeight:n.bottom+i.offsetHeight<=p&&(u=n.bottom),h+i.offsetWidth>b&&(h=b-i.offsetWidth)}i.style.top=u+"px",i.style.left=i.style.right="",a=="right"?(h=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(a=="left"?h=0:a=="middle"&&(h=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=h+"px"),o&&Hu(this,{left:h,top:u,right:h+i.offsetWidth,bottom:u+i.offsetHeight})},triggerOnKeyDown:Se(Pa),triggerOnKeyPress:Se(_a),triggerOnKeyUp:Wa,triggerOnMouseDown:Se(Ba),execCommand:function(n){if(jr.hasOwnProperty(n))return jr[n].call(null,this)},triggerElectric:Se(function(n){Ga(this,n)}),findPosH:function(n,i,o,l){var a=this,s=1;i<0&&(s=-1,i=-i);for(var u=V(this.doc,n),h=0;h0&&h(o.charAt(l-1));)--l;for(;a.5)&&ro(this),de(this,"refresh",this)}),swapDoc:Se(function(n){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ma(this,n),Gr(this),this.display.input.reset(),Er(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,ke(this,"swapDoc",this,i),i}),phrase:function(n){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},hr(e),e.registerHelper=function(n,i,o){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][i]=o},e.registerGlobalHelper=function(n,i,o,l){e.registerHelper(n,i,l),r[n]._global.push({pred:o,val:l})}}function di(e,t,r,n,i){var o=t,l=r,a=q(e,t.line);function s(){var A=t.line+r;return A=e.first+e.size?!1:(t=new F(A,t.ch,t.sticky),a=q(e,A))}function u(A){var I;if(i?I=wf(e.cm,a,t,r):I=Ai(a,t,r),I==null)if(!A&&s())t=mo(i,e.cm,a,t.line,r);else return!1;else t=I;return!0}if(n=="char")u();else if(n=="column")u(!0);else if(n=="word"||n=="group")for(var h=null,p=n=="group",b=e.cm&&e.cm.getHelper(t,"wordChars"),y=!0;!(r<0&&!u(!y));y=!1){var k=a.text.charAt(t.ch)||` `,S=bn(k,b)?"w":p&&k==` `?"n":!p||/\s/.test(k)?null:"p";if(p&&!y&&!S&&(S="s"),h&&h!=S){r<0&&(r=1,u(),t.sticky="after");break}if(S&&(h=S),r>0&&!u(!y))break}var D=An(e,t,o,l,!0);return yi(o,D)&&(D.hitSide=!0),D}function hl(e,t,r,n){var i=e.doc,o=t.left,l;if(n=="page"){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(a-.5*sr(e.display),3);l=(r>0?t.bottom:t.top)+r*s}else n=="line"&&(l=r>0?t.bottom+3:t.top-3);for(var u;u=$i(e,o,l),!!u.outside;){if(r<0?l<=0:l>=i.height){u.hitSide=!0;break}l+=r*5}return u}var ae=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new bt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ae.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;Ya(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),X(i,"paste",function(l){ye(n,l)||qa(l,n)||ce<=11&&setTimeout(be(n,function(){return t.updateFromDOM()}),20)}),X(i,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),X(i,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),X(i,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),X(i,"touchstart",function(){return r.forceCompositionEnd()}),X(i,"input",function(){t.composing||t.readFromDOMSoon()});function o(l){if(!ye(n,l)){if(n.somethingSelected())En({lineWise:!1,text:n.getSelections()}),l.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var a=Xa(n);En({lineWise:!0,text:a.text}),l.type=="cut"&&n.operation(function(){n.setSelections(a.ranges,0,et),n.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var s=Ke.text.join(` `);if(l.clipboardData.setData("Text",s),l.clipboardData.getData("Text")==s){l.preventDefault();return}}var u=ja(),h=u.firstChild;n.display.lineSpace.insertBefore(u,n.display.lineSpace.firstChild),h.value=Ke.text.join(` `);var p=document.activeElement;Wr(h),setTimeout(function(){n.display.lineSpace.removeChild(u),p.focus(),p==i&&r.showPrimarySelection()},50)}}X(i,"copy",o),X(i,"cut",o)};ae.prototype.prepareSelection=function(){var e=na(this.cm,!1);return e.focus=this.cm.state.focused,e};ae.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))};ae.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};ae.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line=t.display.viewFrom&&dl(t,n)||{node:a[0].measure.map[2],offset:0},u=i.linee.firstLine()&&(n=F(n.line-1,q(e.doc,n.line-1).length)),i.ch==q(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,l,a;n.line==t.viewFrom||(o=Wt(e,n.line))==0?(l=le(t.view[0].line),a=t.view[0].node):(l=le(t.view[o].line),a=t.view[o-1].node.nextSibling);var s=Wt(e,i.line),u,h;if(s==t.view.length-1?(u=t.viewTo-1,h=t.lineDiv.lastChild):(u=le(t.view[s+1].line)-1,h=t.view[s+1].node.previousSibling),!a)return!1;for(var p=e.doc.splitLines(Uf(e,a,h,l,u)),b=Ot(e.doc,F(l,0),F(u,q(e.doc,u).text.length));p.length>1&&b.length>1;)if(ie(p)==ie(b))p.pop(),b.pop(),u--;else if(p[0]==b[0])p.shift(),b.shift(),l++;else break;for(var y=0,k=0,S=p[0],D=b[0],A=Math.min(S.length,D.length);yn.ch&&I.charCodeAt(I.length-k-1)==L.charCodeAt(L.length-k-1);)y--,k++;p[p.length-1]=I.slice(0,I.length-k).replace(/^\u200b+/,""),p[0]=p[0].slice(y).replace(/\u200b+$/,"");var P=F(l,y),W=F(u,b.length?ie(b).length-k:0);if(p.length>1||p[0]||Z(P,W))return gr(e.doc,p,P,W,"+input"),!0};ae.prototype.ensurePolled=function(){this.forceCompositionEnd()};ae.prototype.reset=function(){this.forceCompositionEnd()};ae.prototype.forceCompositionEnd=function(){!this.composing||(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};ae.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))};ae.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ee(this.cm,function(){return Fe(e.cm)})};ae.prototype.setUneditable=function(e){e.contentEditable="false"};ae.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||be(this.cm,yo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))};ae.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")};ae.prototype.onContextMenu=function(){};ae.prototype.resetPosition=function(){};ae.prototype.needsContentAttribute=!0;function dl(e,t){var r=Ji(e,t.line);if(!r||r.hidden)return null;var n=q(e.doc,t.line),i=Xl(r,n,t.line),o=st(n,e.doc.direction),l="left";if(o){var a=Br(o,t.ch);l=a%2?"right":"left"}var s=Zl(i.map,t.ch,l);return s.offset=s.collapse=="right"?s.end:s.start,s}function Rf(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function $t(e,t){return t&&(e.bad=!0),e}function Uf(e,t,r,n,i){var o="",l=!1,a=e.doc.lineSeparator(),s=!1;function u(y){return function(k){return k.id==y}}function h(){l&&(o+=a,s&&(o+=a),l=s=!1)}function p(y){y&&(h(),o+=y)}function b(y){if(y.nodeType==1){var k=y.getAttribute("cm-text");if(k){p(k);return}var S=y.getAttribute("cm-marker"),D;if(S){var A=e.findMarks(F(n,0),F(i+1,0),u(+S));A.length&&(D=A[0].find(0))&&p(Ot(e.doc,D.from,D.to).join(a));return}if(y.getAttribute("contenteditable")=="false")return;var I=/^(pre|div|p|li|table|br)$/i.test(y.nodeName);if(!/^br$/i.test(y.nodeName)&&y.textContent.length==0)return;I&&h();for(var L=0;L=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),X(i,"paste",function(l){ye(n,l)||qa(l,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())});function o(l){if(!ye(n,l)){if(n.somethingSelected())En({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var a=Xa(n);En({lineWise:!0,text:a.text}),l.type=="cut"?n.setSelections(a.ranges,null,et):(r.prevInput="",i.value=a.text.join(` `),Wr(i))}else return;l.type=="cut"&&(n.state.cutIncoming=+new Date)}}X(i,"cut",o),X(i,"copy",o),X(e.scroller,"paste",function(l){if(!(lt(e,l)||ye(n,l))){if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var a=new Event("paste");a.clipboardData=l.clipboardData,i.dispatchEvent(a)}}),X(e.lineSpace,"selectstart",function(l){lt(e,l)||Ae(l)}),X(i,"compositionstart",function(){var l=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:l,range:n.markText(l,n.getCursor("to"),{className:"CodeMirror-composing"})}}),X(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})};ve.prototype.createField=function(e){this.wrapper=ja(),this.textarea=this.wrapper.firstChild};ve.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=na(e);if(e.options.moveInputWithCursor){var i=qe(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n};ve.prototype.showSelection=function(e){var t=this.cm,r=t.display;Ie(r.cursorDiv,e.cursors),Ie(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")};ve.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing)){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&Wr(this.textarea),re&&ce>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",re&&ce>=9&&(this.hasSelection=null))}};ve.prototype.getField=function(){return this.textarea};ve.prototype.supportsTouch=function(){return!1};ve.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!zr||at()!=this.textarea))try{this.textarea.focus()}catch{}};ve.prototype.blur=function(){this.textarea.blur()};ve.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ve.prototype.receivedFocus=function(){this.slowPoll()};ve.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})};ve.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)};ve.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Bs(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(re&&ce>=9&&this.hasSelection===i||Ye&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!n&&(n="\u200B"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var l=0,a=Math.min(n.length,i.length);l1e3||i.indexOf(` `)>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0};ve.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};ve.prototype.onKeyPress=function(){re&&ce>=9&&(this.hasSelection=null),this.fastPoll()};ve.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Pt(r,e),l=n.scroller.scrollTop;if(!o||Xe)return;var a=r.options.resetSelectionOnContextMenu;a&&r.doc.sel.contains(o)==-1&&be(r,xe)(r.doc,wt(o),et);var s=i.style.cssText,u=t.wrapper.style.cssText,h=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-h.top-5)+"px; left: "+(e.clientX-h.left-5)+`px; z-index: 1000; background: `+(re?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var p;Le&&(p=window.scrollY),n.input.focus(),Le&&window.scrollTo(null,p),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=y,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function b(){if(i.selectionStart!=null){var S=r.somethingSelected(),D="\u200B"+(S?i.value:"");i.value="\u21DA",i.value=D,t.prevInput=S?"":"\u200B",i.selectionStart=1,i.selectionEnd=D.length,n.selForContextMenu=r.doc.sel}}function y(){if(t.contextMenuPending==y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,i.style.cssText=s,re&&ce<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=l),i.selectionStart!=null)){(!re||re&&ce<9)&&b();var S=0,D=function(){n.selForContextMenu==r.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?be(r,La)(r):S++<10?n.detectingSelectAll=setTimeout(D,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(D,200)}}if(re&&ce>=9&&b(),Ii){Rr(e);var k=function(){Oe(window,"mouseup",k),setTimeout(y,20)};X(window,"mouseup",k)}else setTimeout(y,50)};ve.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor"};ve.prototype.setUneditable=function(){};ve.prototype.needsContentAttribute=!1;function qf(e,t){if(t=t?Ht(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var r=at();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=a.getValue()}var i;if(e.form&&(X(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch{}}t.finishInit=function(s){s.save=n,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,n(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(Oe(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var a=R(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return a}function Gf(e){e.off=Oe,e.on=X,e.wheelEventPixels=Qu,e.Doc=De,e.splitLines=Wi,e.countColumn=Pe,e.findColumn=pi,e.isWordChar=vi,e.Pass=zn,e.signal=de,e.Line=ar,e.changeEnd=kt,e.scrollbarModel=ua,e.Pos=F,e.cmpPos=Z,e.modes=_i,e.mimeModes=er,e.resolveMode=Sn,e.getMode=Bi,e.modeExtensions=ir,e.extendMode=Gs,e.copyState=zt,e.startState=Dl,e.innerMode=Ri,e.commands=jr,e.keyMap=nt,e.keyName=Ia,e.isModifierKey=Na,e.lookupKey=lr,e.normalizeKeyMap=bf,e.StringStream=pe,e.SharedTextMarker=on,e.TextMarker=Lt,e.LineWidget=nn,e.e_preventDefault=Ae,e.e_stopPropagation=Tl,e.e_stop=Rr,e.addClass=Ut,e.contains=yt,e.rmClass=Rt}zf(R);Bf(R);var Xf="iter insert remove copy getEditor constructor".split(" ");for(var yn in De.prototype)De.prototype.hasOwnProperty(yn)&&Ce(Xf,yn)<0&&(R.prototype[yn]=function(e){return function(){return e.apply(this.doc,arguments)}}(De.prototype[yn]));hr(De);R.inputStyles={textarea:ve,contenteditable:ae};R.defineMode=function(e){!R.defaults.mode&&e!="null"&&(R.defaults.mode=e),Ks.apply(this,arguments)};R.defineMIME=qs;R.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}});R.defineMIME("text/plain","null");R.defineExtension=function(e,t){R.prototype[e]=t};R.defineDocExtension=function(e,t){De.prototype[e]=t};R.fromTextArea=qf;Gf(R);R.version="5.49.2";window.CodeMirror=R;var Yf={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},jf={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};R.defineMode("xml",Zf);function Zf(e,t){var r=e.indentUnit,n={},i=t.htmlMode?Yf:jf;for(var o in i)n[o]=i[o];for(var o in t)n[o]=t[o];var l,a;function s(v,C){function d(j){return C.tokenize=j,j(v,C)}var B=v.next();if(B=="<")return v.eat("!")?v.eat("[")?v.match("CDATA[")?d(p("atom","]]>")):null:v.match("--")?d(p("comment","-->")):v.match("DOCTYPE",!0,!0)?(v.eatWhile(/[\w\._\-]/),d(b(1))):null:v.eat("?")?(v.eatWhile(/[\w\._\-]/),C.tokenize=p("meta","?>"),"meta"):(l=v.eat("/")?"closeTag":"openTag",C.tokenize=u,"tag bracket");if(B=="&"){var Q;return v.eat("#")?v.eat("x")?Q=v.eatWhile(/[a-fA-F\d]/)&&v.eat(";"):Q=v.eatWhile(/[\d]/)&&v.eat(";"):Q=v.eatWhile(/[\w\.\-:]/)&&v.eat(";"),Q?"atom":"error"}else return v.eatWhile(/[^&<]/),null}s.isInText=!0;function u(v,C){var d=v.next();if(d==">"||d=="/"&&v.eat(">"))return C.tokenize=s,l=d==">"?"endTag":"selfcloseTag","tag bracket";if(d=="=")return l="equals",null;if(d=="<"){C.tokenize=s,C.state=D,C.tagName=C.tagStart=null;var B=C.tokenize(v,C);return B?B+" tag error":"tag error"}else return/[\'\"]/.test(d)?(C.tokenize=h(d),C.stringStartCol=v.column(),C.tokenize(v,C)):(v.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(v){var C=function(d,B){for(;!d.eol();)if(d.next()==v){B.tokenize=u;break}return"string"};return C.isInAttribute=!0,C}function p(v,C){return function(d,B){for(;!d.eol();){if(d.match(C)){B.tokenize=s;break}d.next()}return v}}function b(v){return function(C,d){for(var B;(B=C.next())!=null;){if(B=="<")return d.tokenize=b(v+1),d.tokenize(C,d);if(B==">")if(v==1){d.tokenize=s;break}else return d.tokenize=b(v-1),d.tokenize(C,d)}return"meta"}}function y(v,C,d){this.prev=v.context,this.tagName=C,this.indent=v.indented,this.startOfLine=d,(n.doNotIndent.hasOwnProperty(C)||v.context&&v.context.noIndent)&&(this.noIndent=!0)}function k(v){v.context&&(v.context=v.context.prev)}function S(v,C){for(var d;;){if(!v.context||(d=v.context.tagName,!n.contextGrabbers.hasOwnProperty(d)||!n.contextGrabbers[d].hasOwnProperty(C)))return;k(v)}}function D(v,C,d){return v=="openTag"?(d.tagStart=C.column(),A):v=="closeTag"?I:D}function A(v,C,d){return v=="word"?(d.tagName=C.current(),a="tag",P):n.allowMissingTagName&&v=="endTag"?(a="tag bracket",P(v,C,d)):(a="error",A)}function I(v,C,d){if(v=="word"){var B=C.current();return d.context&&d.context.tagName!=B&&n.implicitlyClosed.hasOwnProperty(d.context.tagName)&&k(d),d.context&&d.context.tagName==B||n.matchClosing===!1?(a="tag",L):(a="tag error",E)}else return n.allowMissingTagName&&v=="endTag"?(a="tag bracket",L(v,C,d)):(a="error",E)}function L(v,C,d){return v!="endTag"?(a="error",L):(k(d),D)}function E(v,C,d){return a="error",L(v,C,d)}function P(v,C,d){if(v=="word")return a="attribute",W;if(v=="endTag"||v=="selfcloseTag"){var B=d.tagName,Q=d.tagStart;return d.tagName=d.tagStart=null,v=="selfcloseTag"||n.autoSelfClosers.hasOwnProperty(B)?S(d,B):(S(d,B),d.context=new y(d,B,Q==d.indented)),D}return a="error",P}function W(v,C,d){return v=="equals"?Y:(n.allowMissing||(a="error"),P(v,C,d))}function Y(v,C,d){return v=="string"?_:v=="word"&&n.allowUnquoted?(a="string",P):(a="error",P(v,C,d))}function _(v,C,d){return v=="string"?_:P(v,C,d)}return{startState:function(v){var C={tokenize:s,state:D,indented:v||0,tagName:null,tagStart:null,context:null};return v!=null&&(C.baseIndent=v),C},token:function(v,C){if(!C.tagName&&v.sol()&&(C.indented=v.indentation()),v.eatSpace())return null;l=null;var d=C.tokenize(v,C);return(d||l)&&d!="comment"&&(a=null,C.state=C.state(l||d,v,C),a&&(d=a=="error"?d+" error":a)),d},indent:function(v,C,d){var B=v.context;if(v.tokenize.isInAttribute)return v.tagStart==v.indented?v.stringStartCol+1:v.indented+r;if(B&&B.noIndent)return R.Pass;if(v.tokenize!=u&&v.tokenize!=s)return d?d.match(/^(\s*)/)[0].length:0;if(v.tagName)return n.multilineTagIndentPastTag!==!1?v.tagStart+v.tagName.length+2:v.tagStart+r*(n.multilineTagIndentFactor||1);if(n.alignCDATA&&/$/,blockCommentStart:"",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml",skipAttribute:function(v){v.state==Y&&(v.state=P)},xmlCurrentTag:function(v){return v.tagName?{name:v.tagName,close:v.type=="closeTag"}:null},xmlCurrentContext:function(v){for(var C=[],d=v.context;d;d=d.prev)d.tagName&&C.push(d.tagName);return C.reverse()}}}R.defineMIME("text/xml","xml");R.defineMIME("php","xml");R.defineMIME("vue","xml");R.defineMIME("html","xml");R.defineMIME("application/xml","xml");R.mimeModes.hasOwnProperty("text/html")||R.defineMIME("text/html",{name:"xml",htmlMode:!0});R.defineMode("css",function(e,t){var r=t.inline;t.propertyKeywords||(t=R.resolveMode("text/css"));var n=e.indentUnit,i=t.tokenHooks,o=t.documentTypes||{},l=t.mediaTypes||{},a=t.mediaFeatures||{},s=t.mediaValueKeywords||{},u=t.propertyKeywords||{},h=t.nonStandardPropertyKeywords||{},p=t.fontProperties||{},b=t.counterDescriptors||{},y=t.colorKeywords||{},k=t.valueKeywords||{},S=t.allowNested,D=t.lineComment,A=t.supportsAtComponent===!0,I,L;function E(w,T){return I=T,w}function P(w,T){var x=w.next();if(i[x]){var K=i[x](w,T);if(K!==!1)return K}if(x=="@")return w.eatWhile(/[\w\\\-]/),E("def",w.current());if(x=="="||(x=="~"||x=="|")&&w.eat("="))return E(null,"compare");if(x=='"'||x=="'")return T.tokenize=W(x),T.tokenize(w,T);if(x=="#")return w.eatWhile(/[\w\\\-]/),E("atom","hash");if(x=="!")return w.match(/^\s*\w*/),E("keyword","important");if(/\d/.test(x)||x=="."&&w.eat(/\d/))return w.eatWhile(/[\w.%]/),E("number","unit");if(x==="-"){if(/[\d.]/.test(w.peek()))return w.eatWhile(/[\w.%]/),E("number","unit");if(w.match(/^-[\w\\\-]*/))return w.eatWhile(/[\w\\\-]/),w.match(/^\s*:/,!1)?E("variable-2","variable-definition"):E("variable-2","variable");if(w.match(/^\w+-/))return E("meta","meta")}else return/[,+>*\/]/.test(x)?E(null,"select-op"):x=="."&&w.match(/^-?[_a-z][_a-z0-9-]*/i)?E("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(x)?E(null,x):w.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(w.current().toLowerCase())&&(T.tokenize=Y),E("variable callee","variable")):/[\w\\\-]/.test(x)?(w.eatWhile(/[\w\\\-]/),E("property","word")):E(null,null)}function W(w){return function(T,x){for(var K=!1,m;(m=T.next())!=null;){if(m==w&&!K){w==")"&&T.backUp(1);break}K=!K&&m=="\\"}return(m==w||!K&&w!=")")&&(x.tokenize=null),E("string","string")}}function Y(w,T){return w.next(),w.match(/\s*[\"\')]/,!1)?T.tokenize=null:T.tokenize=W(")"),E(null,"(")}function _(w,T,x){this.type=w,this.indent=T,this.prev=x}function v(w,T,x,K){return w.context=new _(x,T.indentation()+(K===!1?0:n),w.context),x}function C(w){return w.context.prev&&(w.context=w.context.prev),w.context.type}function d(w,T,x){return j[x.context.type](w,T,x)}function B(w,T,x,K){for(var m=K||1;m>0;m--)x.context=x.context.prev;return d(w,T,x)}function Q(w){var T=w.current().toLowerCase();k.hasOwnProperty(T)?L="atom":y.hasOwnProperty(T)?L="keyword":L="variable"}var j={};return j.top=function(w,T,x){if(w=="{")return v(x,T,"block");if(w=="}"&&x.context.prev)return C(x);if(A&&/@component/i.test(w))return v(x,T,"atComponentBlock");if(/^@(-moz-)?document$/i.test(w))return v(x,T,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(w))return v(x,T,"atBlock");if(/^@(font-face|counter-style)/i.test(w))return x.stateArg=w,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(w))return"keyframes";if(w&&w.charAt(0)=="@")return v(x,T,"at");if(w=="hash")L="builtin";else if(w=="word")L="tag";else{if(w=="variable-definition")return"maybeprop";if(w=="interpolation")return v(x,T,"interpolation");if(w==":")return"pseudo";if(S&&w=="(")return v(x,T,"parens")}return x.context.type},j.block=function(w,T,x){if(w=="word"){var K=T.current().toLowerCase();return u.hasOwnProperty(K)?(L="property","maybeprop"):h.hasOwnProperty(K)?(L="string-2","maybeprop"):S?(L=T.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(L+=" error","maybeprop")}else return w=="meta"?"block":!S&&(w=="hash"||w=="qualifier")?(L="error","block"):j.top(w,T,x)},j.maybeprop=function(w,T,x){return w==":"?v(x,T,"prop"):d(w,T,x)},j.prop=function(w,T,x){if(w==";")return C(x);if(w=="{"&&S)return v(x,T,"propBlock");if(w=="}"||w=="{")return B(w,T,x);if(w=="(")return v(x,T,"parens");if(w=="hash"&&!/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(T.current()))L+=" error";else if(w=="word")Q(T);else if(w=="interpolation")return v(x,T,"interpolation");return"prop"},j.propBlock=function(w,T,x){return w=="}"?C(x):w=="word"?(L="property","maybeprop"):x.context.type},j.parens=function(w,T,x){return w=="{"||w=="}"?B(w,T,x):w==")"?C(x):w=="("?v(x,T,"parens"):w=="interpolation"?v(x,T,"interpolation"):(w=="word"&&Q(T),"parens")},j.pseudo=function(w,T,x){return w=="meta"?"pseudo":w=="word"?(L="variable-3",x.context.type):d(w,T,x)},j.documentTypes=function(w,T,x){return w=="word"&&o.hasOwnProperty(T.current())?(L="tag",x.context.type):j.atBlock(w,T,x)},j.atBlock=function(w,T,x){if(w=="(")return v(x,T,"atBlock_parens");if(w=="}"||w==";")return B(w,T,x);if(w=="{")return C(x)&&v(x,T,S?"block":"top");if(w=="interpolation")return v(x,T,"interpolation");if(w=="word"){var K=T.current().toLowerCase();K=="only"||K=="not"||K=="and"||K=="or"?L="keyword":l.hasOwnProperty(K)?L="attribute":a.hasOwnProperty(K)?L="property":s.hasOwnProperty(K)?L="keyword":u.hasOwnProperty(K)?L="property":h.hasOwnProperty(K)?L="string-2":k.hasOwnProperty(K)?L="atom":y.hasOwnProperty(K)?L="keyword":L="error"}return x.context.type},j.atComponentBlock=function(w,T,x){return w=="}"?B(w,T,x):w=="{"?C(x)&&v(x,T,S?"block":"top",!1):(w=="word"&&(L="error"),x.context.type)},j.atBlock_parens=function(w,T,x){return w==")"?C(x):w=="{"||w=="}"?B(w,T,x,2):j.atBlock(w,T,x)},j.restricted_atBlock_before=function(w,T,x){return w=="{"?v(x,T,"restricted_atBlock"):w=="word"&&x.stateArg=="@counter-style"?(L="variable","restricted_atBlock_before"):d(w,T,x)},j.restricted_atBlock=function(w,T,x){return w=="}"?(x.stateArg=null,C(x)):w=="word"?(x.stateArg=="@font-face"&&!p.hasOwnProperty(T.current().toLowerCase())||x.stateArg=="@counter-style"&&!b.hasOwnProperty(T.current().toLowerCase())?L="error":L="property","maybeprop"):"restricted_atBlock"},j.keyframes=function(w,T,x){return w=="word"?(L="variable","keyframes"):w=="{"?v(x,T,"top"):d(w,T,x)},j.at=function(w,T,x){return w==";"?C(x):w=="{"||w=="}"?B(w,T,x):(w=="word"?L="tag":w=="hash"&&(L="builtin"),"at")},j.interpolation=function(w,T,x){return w=="}"?C(x):w=="{"||w==";"?B(w,T,x):(w=="word"?L="variable":w!="variable"&&w!="("&&w!=")"&&(L="error"),"interpolation")},{startState:function(w){return{tokenize:null,state:r?"block":"top",stateArg:null,context:new _(r?"block":"top",w||0,null)}},token:function(w,T){if(!T.tokenize&&w.eatSpace())return null;var x=(T.tokenize||P)(w,T);return x&&typeof x=="object"&&(I=x[1],x=x[0]),L=x,I!="comment"&&(T.state=j[T.state](I,w,T)),L},indent:function(w,T){var x=w.context,K=T&&T.charAt(0),m=x.indent;return x.type=="prop"&&(K=="}"||K==")")&&(x=x.prev),x.prev&&(K=="}"&&(x.type=="block"||x.type=="top"||x.type=="interpolation"||x.type=="restricted_atBlock")?(x=x.prev,m=x.indent):(K==")"&&(x.type=="parens"||x.type=="atBlock_parens")||K=="{"&&(x.type=="at"||x.type=="atBlock"))&&(m=Math.max(0,x.indent-n))),m},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:D,fold:"brace"}});function tt(e){for(var t={},r=0;r!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(f){for(var g=!1,M,N=!1;(M=f.next())!=null;){if(!g){if(M=="/"&&!N)return;M=="["?N=!0:N&&M=="]"&&(N=!1)}g=!g&&M=="\\"}}var b,y;function k(f,g,M){return b=f,y=M,g}function S(f,g){var M=f.next();if(M=='"'||M=="'")return g.tokenize=D(M),g.tokenize(f,g);if(M=="."&&f.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return k("number","number");if(M=="."&&f.match(".."))return k("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(M))return k(M);if(M=="="&&f.eat(">"))return k("=>","operator");if(M=="0"&&f.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return k("number","number");if(/\d/.test(M))return f.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),k("number","number");if(M=="/")return f.eat("*")?(g.tokenize=A,A(f,g)):f.eat("/")?(f.skipToEnd(),k("comment","comment")):Ao(f,g,1)?(p(f),f.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),k("regexp","string-2")):(f.eat("="),k("operator","operator",f.current()));if(M=="`")return g.tokenize=I,I(f,g);if(M=="#")return f.skipToEnd(),k("error","error");if(M=="<"&&f.match("!--")||M=="-"&&f.match("->"))return f.skipToEnd(),k("comment","comment");if(u.test(M))return(M!=">"||!g.lexical||g.lexical.type!=">")&&(f.eat("=")?(M=="!"||M=="=")&&f.eat("="):/[<>*+\-]/.test(M)&&(f.eat(M),M==">"&&f.eat(M))),k("operator","operator",f.current());if(a.test(M)){f.eatWhile(a);var N=f.current();if(g.lastType!="."){if(s.propertyIsEnumerable(N)){var J=s[N];return k(J.type,J.style,N)}if(N=="async"&&f.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return k("async","keyword",N)}return k("variable","variable",N)}}function D(f){return function(g,M){var N=!1,J;if(i&&g.peek()=="@"&&g.match(h))return M.tokenize=S,k("jsonld-keyword","meta");for(;(J=g.next())!=null&&!(J==f&&!N);)N=!N&&J=="\\";return N||(M.tokenize=S),k("string","string")}}function A(f,g){for(var M=!1,N;N=f.next();){if(N=="/"&&M){g.tokenize=S;break}M=N=="*"}return k("comment","comment")}function I(f,g){for(var M=!1,N;(N=f.next())!=null;){if(!M&&(N=="`"||N=="$"&&f.eat("{"))){g.tokenize=S;break}M=!M&&N=="\\"}return k("quasi","string-2",f.current())}var L="([{}])";function E(f,g){g.fatArrowAt&&(g.fatArrowAt=null);var M=f.string.indexOf("=>",f.start);if(!(M<0)){if(l){var N=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(f.string.slice(f.start,M));N&&(M=N.index)}for(var J=0,te=!1,fe=M-1;fe>=0;--fe){var Me=f.string.charAt(fe),je=L.indexOf(Me);if(je>=0&&je<3){if(!J){++fe;break}if(--J==0){Me=="("&&(te=!0);break}}else if(je>=3&&je<6)++J;else if(a.test(Me))te=!0;else if(/["'\/`]/.test(Me))for(;;--fe){if(fe==0)return;var Ss=f.string.charAt(fe-1);if(Ss==Me&&f.string.charAt(fe-2)!="\\"){fe--;break}}else if(te&&!J){++fe;break}}te&&!J&&(g.fatArrowAt=fe)}}var P={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function W(f,g,M,N,J,te){this.indented=f,this.column=g,this.type=M,this.prev=J,this.info=te,N!=null&&(this.align=N)}function Y(f,g){for(var M=f.localVars;M;M=M.next)if(M.name==g)return!0;for(var N=f.context;N;N=N.prev)for(var M=N.vars;M;M=M.next)if(M.name==g)return!0}function _(f,g,M,N,J){var te=f.cc;for(v.state=f,v.stream=J,v.marked=null,v.cc=te,v.style=g,f.lexical.hasOwnProperty("align")||(f.lexical.align=!0);;){var fe=te.length?te.pop():o?$:se;if(fe(M,N)){for(;te.length&&te[te.length-1].lex;)te.pop()();return v.marked?v.marked:M=="variable"&&Y(f,N)?"variable-2":g}}}var v={state:null,column:null,marked:null,cc:null};function C(){for(var f=arguments.length-1;f>=0;f--)v.cc.push(arguments[f])}function d(){return C.apply(null,arguments),!0}function B(f,g){for(var M=g;M;M=M.next)if(M.name==f)return!0;return!1}function Q(f){var g=v.state;if(v.marked="def",g.context){if(g.lexical.info=="var"&&g.context&&g.context.block){var M=j(f,g.context);if(M!=null){g.context=M;return}}else if(!B(f,g.localVars)){g.localVars=new x(f,g.localVars);return}}t.globalVars&&!B(f,g.globalVars)&&(g.globalVars=new x(f,g.globalVars))}function j(f,g){if(g)if(g.block){var M=j(f,g.prev);return M?M==g.prev?g:new T(M,g.vars,!0):null}else return B(f,g.vars)?g:new T(g.prev,new x(f,g.vars),!1);else return null}function w(f){return f=="public"||f=="private"||f=="protected"||f=="abstract"||f=="readonly"}function T(f,g,M){this.prev=f,this.vars=g,this.block=M}function x(f,g){this.name=f,this.next=g}var K=new x("this",new x("arguments",null));function m(){v.state.context=new T(v.state.context,v.state.localVars,!1),v.state.localVars=K}function c(){v.state.context=new T(v.state.context,v.state.localVars,!0),v.state.localVars=null}function z(){v.state.localVars=v.state.context.vars,v.state.context=v.state.context.prev}z.lex=!0;function H(f,g){var M=function(){var N=v.state,J=N.indented;if(N.lexical.type=="stat")J=N.lexical.indented;else for(var te=N.lexical;te&&te.type==")"&&te.align;te=te.prev)J=te.indented;N.lexical=new W(J,v.stream.column(),f,null,N.lexical,g)};return M.lex=!0,M}function O(){var f=v.state;f.lexical.prev&&(f.lexical.type==")"&&(f.indented=f.lexical.indented),f.lexical=f.lexical.prev)}O.lex=!0;function U(f){function g(M){return M==f?d():f==";"||M=="}"||M==")"||M=="]"?C():d(g)}return g}function se(f,g){return f=="var"?d(H("vardef",g),oi,U(";"),O):f=="keyword a"?d(H("form"),oe,se,O):f=="keyword b"?d(H("form"),se,O):f=="keyword d"?v.stream.match(/^\s*$/,!1)?d():d(H("stat"),ze,U(";"),O):f=="debugger"?d(U(";")):f=="{"?d(H("}"),c,an,O,z):f==";"?d():f=="if"?(v.state.lexical.info=="else"&&v.state.cc[v.state.cc.length-1]==O&&v.state.cc.pop()(),d(H("form"),oe,se,O,xo)):f=="function"?d(Ue):f=="for"?d(H("form"),Co,se,O):f=="class"||l&&g=="interface"?(v.marked="keyword",d(H("form",f=="class"?f:g),Lo,O)):f=="variable"?l&&g=="declare"?(v.marked="keyword",d(se)):l&&(g=="module"||g=="enum"||g=="type")&&v.stream.match(/^\s*\w/,!1)?(v.marked="keyword",g=="enum"?d(Do):g=="type"?d(So,U("operator"),ue,U(";")):d(H("form"),Re,U("{"),H("}"),an,O,O)):l&&g=="namespace"?(v.marked="keyword",d(H("form"),$,se,O)):l&&g=="abstract"?(v.marked="keyword",d(se)):d(H("stat"),ls):f=="switch"?d(H("form"),oe,U("{"),H("}","switch"),c,an,O,O,z):f=="case"?d($,U(":")):f=="default"?d(U(":")):f=="catch"?d(H("form"),m,ge,se,O,z):f=="export"?d(H("stat"),ys,O):f=="import"?d(H("stat"),bs,O):f=="async"?d(se):g=="@"?d($,se):C(H("stat"),$,U(";"),O)}function ge(f){if(f=="(")return d(At,U(")"))}function $(f,g){return he(f,g,!1)}function ee(f,g){return he(f,g,!0)}function oe(f){return f!="("?C():d(H(")"),$,U(")"),O)}function he(f,g,M){if(v.state.fatArrowAt==v.stream.start){var N=M?Mt:Tt;if(f=="(")return d(m,H(")"),we(At,")"),O,U("=>"),N,z);if(f=="variable")return C(m,Re,U("=>"),N,z)}var J=M?_e:ut;return P.hasOwnProperty(f)?d(J):f=="function"?d(Ue,J):f=="class"||l&&g=="interface"?(v.marked="keyword",d(H("form"),ms,O)):f=="keyword c"||f=="async"?d(M?ee:$):f=="("?d(H(")"),ze,U(")"),O,J):f=="operator"||f=="spread"?d(M?ee:$):f=="["?d(H("]"),ks,O,J):f=="{"?mr(ln,"}",null,J):f=="quasi"?C(Be,J):f=="new"?d(ct(M)):f=="import"?d($):d()}function ze(f){return f.match(/[;\}\)\],]/)?C():C($)}function ut(f,g){return f==","?d($):_e(f,g,!1)}function _e(f,g,M){var N=M==!1?ut:_e,J=M==!1?$:ee;if(f=="=>")return d(m,M?Mt:Tt,z);if(f=="operator")return/\+\+|--/.test(g)||l&&g=="!"?d(N):l&&g=="<"&&v.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?d(H(">"),we(ue,">"),O,N):g=="?"?d($,U(":"),J):d(J);if(f=="quasi")return C(Be,N);if(f!=";"){if(f=="(")return mr(ee,")","call",N);if(f==".")return d(as,N);if(f=="[")return d(H("]"),ze,U("]"),O,N);if(l&&g=="as")return v.marked="keyword",d(ue,N);if(f=="regexp")return v.state.lastType=v.marked="operator",v.stream.backUp(v.stream.pos-v.stream.start-1),d(J)}}function Be(f,g){return f!="quasi"?C():g.slice(g.length-2)!="${"?d(Be):d($,ft)}function ft(f){if(f=="}")return v.marked="string-2",v.state.tokenize=I,d(Be)}function Tt(f){return E(v.stream,v.state),C(f=="{"?se:$)}function Mt(f){return E(v.stream,v.state),C(f=="{"?se:ee)}function ct(f){return function(g){return g=="."?d(f?ni:ht):g=="variable"&&l?d(hs,f?_e:ut):C(f?ee:$)}}function ht(f,g){if(g=="target")return v.marked="keyword",d(ut)}function ni(f,g){if(g=="target")return v.marked="keyword",d(_e)}function ls(f){return f==":"?d(O,se):C(ut,U(";"),O)}function as(f){if(f=="variable")return v.marked="property",d()}function ln(f,g){if(f=="async")return v.marked="property",d(ln);if(f=="variable"||v.style=="keyword"){if(v.marked="property",g=="get"||g=="set")return d(ss);var M;return l&&v.state.fatArrowAt==v.stream.start&&(M=v.stream.match(/^\s*:\s*/,!1))&&(v.state.fatArrowAt=v.stream.pos+M[0].length),d(Dt)}else{if(f=="number"||f=="string")return v.marked=i?"property":v.style+" property",d(Dt);if(f=="jsonld-keyword")return d(Dt);if(l&&w(g))return v.marked="keyword",d(ln);if(f=="[")return d($,jt,U("]"),Dt);if(f=="spread")return d(ee,Dt);if(g=="*")return v.marked="keyword",d(ln);if(f==":")return C(Dt)}}function ss(f){return f!="variable"?C(Dt):(v.marked="property",d(Ue))}function Dt(f){if(f==":")return d(ee);if(f=="(")return C(Ue)}function we(f,g,M){function N(J,te){if(M?M.indexOf(J)>-1:J==","){var fe=v.state.lexical;return fe.info=="call"&&(fe.pos=(fe.pos||0)+1),d(function(Me,je){return Me==g||je==g?C():C(f)},N)}return J==g||te==g?d():M&&M.indexOf(";")>-1?C(f):d(U(g))}return function(J,te){return J==g||te==g?d():C(f,N)}}function mr(f,g,M){for(var N=3;N"),ue)}function cs(f){if(f=="=>")return d(ue)}function yr(f,g){if(f=="variable"||v.style=="keyword")return v.marked="property",d(yr);if(g=="?"||f=="number"||f=="string")return d(yr);if(f==":")return d(ue);if(f=="[")return d(U("variable"),us,U("]"),yr);if(f=="(")return C(Qt,yr)}function ii(f,g){return f=="variable"&&v.stream.match(/^\s*[?:]/,!1)||g=="?"?d(ii):f==":"?d(ue):f=="spread"?d(ii):C(ue)}function dt(f,g){if(g=="<")return d(H(">"),we(ue,">"),O,dt);if(g=="|"||f=="."||g=="&")return d(ue);if(f=="[")return d(ue,U("]"),dt);if(g=="extends"||g=="implements")return v.marked="keyword",d(ue);if(g=="?")return d(ue,U(":"),ue)}function hs(f,g){if(g=="<")return d(H(">"),we(ue,">"),O,dt)}function sn(){return C(ue,ds)}function ds(f,g){if(g=="=")return d(ue)}function oi(f,g){return g=="enum"?(v.marked="keyword",d(Do)):C(Re,jt,pt,vs)}function Re(f,g){if(l&&w(g))return v.marked="keyword",d(Re);if(f=="variable")return Q(g),d();if(f=="spread")return d(Re);if(f=="[")return mr(ps,"]");if(f=="{")return mr(ko,"}")}function ko(f,g){return f=="variable"&&!v.stream.match(/^\s*:/,!1)?(Q(g),d(pt)):(f=="variable"&&(v.marked="property"),f=="spread"?d(Re):f=="}"?C():f=="["?d($,U("]"),U(":"),ko):d(U(":"),Re,pt))}function ps(){return C(Re,pt)}function pt(f,g){if(g=="=")return d(ee)}function vs(f){if(f==",")return d(oi)}function xo(f,g){if(f=="keyword b"&&g=="else")return d(H("form","else"),se,O)}function Co(f,g){if(g=="await")return d(Co);if(f=="(")return d(H(")"),gs,O)}function gs(f){return f=="var"?d(oi,Zt):f=="variable"?d(Zt):C(Zt)}function Zt(f,g){return f==")"?d():f==";"?d(Zt):g=="in"||g=="of"?(v.marked="keyword",d($,Zt)):C($,Zt)}function Ue(f,g){if(g=="*")return v.marked="keyword",d(Ue);if(f=="variable")return Q(g),d(Ue);if(f=="(")return d(m,H(")"),we(At,")"),O,wo,se,z);if(l&&g=="<")return d(H(">"),we(sn,">"),O,Ue)}function Qt(f,g){if(g=="*")return v.marked="keyword",d(Qt);if(f=="variable")return Q(g),d(Qt);if(f=="(")return d(m,H(")"),we(At,")"),O,wo,z);if(l&&g=="<")return d(H(">"),we(sn,">"),O,Qt)}function So(f,g){if(f=="keyword"||f=="variable")return v.marked="type",d(So);if(g=="<")return d(H(">"),we(sn,">"),O)}function At(f,g){return g=="@"&&d($,At),f=="spread"?d(At):l&&w(g)?(v.marked="keyword",d(At)):l&&f=="this"?d(jt,pt):C(Re,jt,pt)}function ms(f,g){return f=="variable"?Lo(f,g):un(f,g)}function Lo(f,g){if(f=="variable")return Q(g),d(un)}function un(f,g){if(g=="<")return d(H(">"),we(sn,">"),O,un);if(g=="extends"||g=="implements"||l&&f==",")return g=="implements"&&(v.marked="keyword"),d(l?ue:$,un);if(f=="{")return d(H("}"),rt,O)}function rt(f,g){if(f=="async"||f=="variable"&&(g=="static"||g=="get"||g=="set"||l&&w(g))&&v.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return v.marked="keyword",d(rt);if(f=="variable"||v.style=="keyword")return v.marked="property",d(l?fn:Ue,rt);if(f=="number"||f=="string")return d(l?fn:Ue,rt);if(f=="[")return d($,jt,U("]"),l?fn:Ue,rt);if(g=="*")return v.marked="keyword",d(rt);if(l&&f=="(")return C(Qt,rt);if(f==";"||f==",")return d(rt);if(f=="}")return d();if(g=="@")return d($,rt)}function fn(f,g){if(g=="?")return d(fn);if(f==":")return d(ue,pt);if(g=="=")return d(ee);var M=v.state.lexical.prev,N=M&&M.info=="interface";return C(N?Qt:Ue)}function ys(f,g){return g=="*"?(v.marked="keyword",d(li,U(";"))):g=="default"?(v.marked="keyword",d($,U(";"))):f=="{"?d(we(To,"}"),li,U(";")):C(se)}function To(f,g){if(g=="as")return v.marked="keyword",d(U("variable"));if(f=="variable")return C(ee,To)}function bs(f){return f=="string"?d():f=="("?C($):C(cn,Mo,li)}function cn(f,g){return f=="{"?mr(cn,"}"):(f=="variable"&&Q(g),g=="*"&&(v.marked="keyword"),d(ws))}function Mo(f){if(f==",")return d(cn,Mo)}function ws(f,g){if(g=="as")return v.marked="keyword",d(cn)}function li(f,g){if(g=="from")return v.marked="keyword",d($)}function ks(f){return f=="]"?d():C(we(ee,"]"))}function Do(){return C(H("form"),Re,U("{"),H("}"),we(xs,"}"),O,O)}function xs(){return C(Re,pt)}function Cs(f,g){return f.lastType=="operator"||f.lastType==","||u.test(g.charAt(0))||/[,.]/.test(g.charAt(0))}function Ao(f,g,M){return g.tokenize==S&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(g.lastType)||g.lastType=="quasi"&&/\{\s*$/.test(f.string.slice(0,f.pos-(M||0)))}return{startState:function(f){var g={tokenize:S,lastType:"sof",cc:[],lexical:new W((f||0)-r,0,"block",!1),localVars:t.localVars,context:t.localVars&&new T(null,null,!1),indented:f||0};return t.globalVars&&typeof t.globalVars=="object"&&(g.globalVars=t.globalVars),g},token:function(f,g){if(f.sol()&&(g.lexical.hasOwnProperty("align")||(g.lexical.align=!1),g.indented=f.indentation(),E(f,g)),g.tokenize!=A&&f.eatSpace())return null;var M=g.tokenize(f,g);return b=="comment"?M:(g.lastType=b=="operator"&&(y=="++"||y=="--")?"incdec":b,_(g,M,b,y,f))},indent:function(f,g){if(f.tokenize==A)return R.Pass;if(f.tokenize!=S)return 0;var M=g&&g.charAt(0),N=f.lexical,J;if(!/^\s*else\b/.test(g))for(var te=f.cc.length-1;te>=0;--te){var fe=f.cc[te];if(fe==O)N=N.prev;else if(fe!=xo)break}for(;(N.type=="stat"||N.type=="form")&&(M=="}"||(J=f.cc[f.cc.length-1])&&(J==ut||J==_e)&&!/^[,\.=+\-*:?[\(]/.test(g));)N=N.prev;n&&N.type==")"&&N.prev.type=="stat"&&(N=N.prev);var Me=N.type,je=M==Me;return Me=="vardef"?N.indented+(f.lastType=="operator"||f.lastType==","?N.info.length+1:0):Me=="form"&&M=="{"?N.indented:Me=="form"?N.indented+r:Me=="stat"?N.indented+(Cs(f,g)?n||r:0):N.info=="switch"&&!je&&t.doubleIndentSwitch!=!1?N.indented+(/^(?:case|default)\b/.test(g)?r:2*r):N.align?N.column+(je?0:1):N.indented+(je?0:r)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:o?null:"/*",blockCommentEnd:o?null:"*/",blockCommentContinue:o?null:" * ",lineComment:o?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:o?"json":"javascript",jsonldMode:i,jsonMode:o,expressionAllowed:Ao,skipExpression:function(f){var g=f.cc[f.cc.length-1];(g==$||g==ee)&&f.cc.pop()}}}R.registerHelper("wordChars","javascript",/[\w$]/);R.defineMIME("json",{name:"javascript",json:!0});R.defineMIME("typescript",{name:"javascript",typescript:!0});R.defineMIME("ts",{name:"javascript",typescript:!0});const $f=["js","json","python","py","react","coffeescript","dart","go","jsx"];$f.forEach(e=>{R.defineMIME(e,"javascript")});R.defineMode("markdown",function(e,t){var r=R.getMode(e,"text/html"),n=r.name=="null";function i(m){if(R.findModeByName){var c=R.findModeByName(m);c&&(m=c.mime||c.mimes[0])}var z=R.getMode(e,m);return z.name=="null"?null:z}t.highlightFormatting===void 0&&(t.highlightFormatting=!1),t.maxBlockquoteDepth===void 0&&(t.maxBlockquoteDepth=0),t.taskLists===void 0&&(t.taskLists=!1),t.strikethrough===void 0&&(t.strikethrough=!1),t.emoji===void 0&&(t.emoji=!1),t.fencedCodeBlockHighlighting===void 0&&(t.fencedCodeBlockHighlighting=!0),t.xml===void 0&&(t.xml=!0),t.tokenTypeOverrides===void 0&&(t.tokenTypeOverrides={});var o={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var l in o)o.hasOwnProperty(l)&&t.tokenTypeOverrides[l]&&(o[l]=t.tokenTypeOverrides[l]);var a=/^([*\-_])(?:\s*\1){2,}\s*$/,s=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,u=/^\[(x| )\](?=\s)/i,h=t.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,p=/^ *(?:\={1,}|-{1,})\s*$/,b=/^[^#!\[\]*_\\<>` "'(~:]+/,y=/^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/,k=/^\s*\[[^\]]+?\]:.*$/,S=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,D=" ";function A(m,c,z){return c.f=c.inline=z,z(m,c)}function I(m,c,z){return c.f=c.block=z,z(m,c)}function L(m){return!m||!/\S/.test(m.string)}function E(m){if(m.linkTitle=!1,m.linkHref=!1,m.linkText=!1,m.em=!1,m.strong=!1,m.strikethrough=!1,m.quote=0,m.indentedCode=!1,m.f==W){var c=n;if(!c){var z=R.innerMode(r,m.htmlState);c=z.mode.name=="xml"&&z.state.tagStart===null&&!z.state.context&&z.state.tokenize.isInText}c&&(m.f=C,m.block=P,m.htmlState=null)}return m.trailingSpace=0,m.trailingSpaceNewLine=!1,m.prevLine=m.thisLine,m.thisLine={stream:null},null}function P(m,c){var z=m.column()===c.indentation,H=L(c.prevLine.stream),O=c.indentedCode,U=c.prevLine.hr,se=c.list!==!1,ge=(c.listStack[c.listStack.length-1]||0)+3;c.indentedCode=!1;var $=c.indentation;if(c.indentationDiff===null&&(c.indentationDiff=c.indentation,se)){for(c.list=null;$=4&&(O||c.prevLine.fencedCodeEnd||c.prevLine.header||H))return m.skipToEnd(),c.indentedCode=!0,o.code;if(m.eatSpace())return null;if(z&&c.indentation<=ge&&(he=m.match(h))&&he[1].length<=6)return c.quote=0,c.header=he[1].length,c.thisLine.header=!0,t.highlightFormatting&&(c.formatting="header"),c.f=c.inline,_(c);if(c.indentation<=ge&&m.eat(">"))return c.quote=z?1:c.quote+1,t.highlightFormatting&&(c.formatting="quote"),m.eatSpace(),_(c);if(!oe&&!c.setext&&z&&c.indentation<=ge&&(he=m.match(s))){var ze=he[1]?"ol":"ul";return c.indentation=$+m.current().length,c.list=!0,c.quote=0,c.listStack.push(c.indentation),c.em=!1,c.strong=!1,c.code=!1,c.strikethrough=!1,t.taskLists&&m.match(u,!1)&&(c.taskList=!0),c.f=c.inline,t.highlightFormatting&&(c.formatting=["list","list-"+ze]),_(c)}else{if(z&&c.indentation<=ge&&(he=m.match(y,!0)))return c.quote=0,c.fencedEndRE=new RegExp(he[1]+"+ *$"),c.localMode=t.fencedCodeBlockHighlighting&&i(he[2]),c.localMode&&(c.localState=R.startState(c.localMode)),c.f=c.block=Y,t.highlightFormatting&&(c.formatting="code-block"),c.code=-1,_(c);if(c.setext||(!ee||!se)&&!c.quote&&c.list===!1&&!c.code&&!oe&&!k.test(m.string)&&(he=m.lookAhead(1))&&(he=he.match(p)))return c.setext?(c.header=c.setext,c.setext=0,m.skipToEnd(),t.highlightFormatting&&(c.formatting="header")):(c.header=he[0].charAt(0)=="="?1:2,c.setext=c.header),c.thisLine.header=!0,c.f=c.inline,_(c);if(oe)return m.skipToEnd(),c.hr=!0,c.thisLine.hr=!0,o.hr;if(m.peek()==="[")return A(m,c,w)}return A(m,c,c.inline)}function W(m,c){var z=r.token(m,c.htmlState);if(!n){var H=R.innerMode(r,c.htmlState);(H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText||c.md_inside&&m.current().indexOf(">")>-1)&&(c.f=C,c.block=P,c.htmlState=null)}return z}function Y(m,c){var z=c.listStack[c.listStack.length-1]||0,H=c.indentation=m.quote?c.push(o.formatting+"-"+m.formatting[z]+"-"+m.quote):c.push("error"))}if(m.taskOpen)return c.push("meta"),c.length?c.join(" "):null;if(m.taskClosed)return c.push("property"),c.length?c.join(" "):null;if(m.linkHref?c.push(o.linkHref,"url"):(m.strong&&c.push(o.strong),m.em&&c.push(o.em),m.strikethrough&&c.push(o.strikethrough),m.emoji&&c.push(o.emoji),m.linkText&&c.push(o.linkText),m.code&&c.push(o.code),m.image&&c.push(o.image),m.imageAltText&&c.push(o.imageAltText,"link"),m.imageMarker&&c.push(o.imageMarker)),m.header&&c.push(o.header,o.header+"-"+m.header),m.quote&&(c.push(o.quote),!t.maxBlockquoteDepth||t.maxBlockquoteDepth>=m.quote?c.push(o.quote+"-"+m.quote):c.push(o.quote+"-"+t.maxBlockquoteDepth)),m.list!==!1){var H=(m.listStack.length-1)%3;H?H===1?c.push(o.list2):c.push(o.list3):c.push(o.list1)}return m.trailingSpaceNewLine?c.push("trailing-space-new-line"):m.trailingSpace&&c.push("trailing-space-"+(m.trailingSpace%2?"a":"b")),c.length?c.join(" "):null}function v(m,c){if(m.match(b,!0))return _(c)}function C(m,c){var z=c.text(m,c);if(typeof z!="undefined")return z;if(c.list)return c.list=null,_(c);if(c.taskList){var H=m.match(u,!0)[1]===" ";return H?c.taskOpen=!0:c.taskClosed=!0,t.highlightFormatting&&(c.formatting="task"),c.taskList=!1,_(c)}if(c.taskOpen=!1,c.taskClosed=!1,c.header&&m.match(/^#+$/,!0))return t.highlightFormatting&&(c.formatting="header"),_(c);var O=m.next();if(c.linkTitle){c.linkTitle=!1;var U=O;O==="("&&(U=")"),U=String(U).replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var se="^\\s*(?:[^"+U+"\\\\]+|\\\\\\\\|\\\\.)"+U;if(m.match(new RegExp(se),!0))return o.linkHref}if(O==="`"){var ge=c.formatting;t.highlightFormatting&&(c.formatting="code"),m.eatWhile("`");var $=m.current().length;if(c.code==0&&(!c.quote||$==1))return c.code=$,_(c);if($==c.code){var ee=_(c);return c.code=0,ee}else return c.formatting=ge,_(c)}else if(c.code)return _(c);if(O==="\\"&&(m.next(),t.highlightFormatting)){var oe=_(c),he=o.formatting+"-escape";return oe?oe+" "+he:he}if(O==="!"&&m.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return c.imageMarker=!0,c.image=!0,t.highlightFormatting&&(c.formatting="image"),_(c);if(O==="["&&c.imageMarker&&m.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return c.imageMarker=!1,c.imageAltText=!0,t.highlightFormatting&&(c.formatting="image"),_(c);if(O==="]"&&c.imageAltText){t.highlightFormatting&&(c.formatting="image");var oe=_(c);return c.imageAltText=!1,c.image=!1,c.inline=c.f=B,oe}if(O==="["&&!c.image)return c.linkText&&m.match(/^.*?\]/)||(c.linkText=!0,t.highlightFormatting&&(c.formatting="link")),_(c);if(O==="]"&&c.linkText){t.highlightFormatting&&(c.formatting="link");var oe=_(c);return c.linkText=!1,c.inline=c.f=m.match(/\(.*?\)| ?\[.*?\]/,!1)?B:C,oe}if(O==="<"&&m.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){c.f=c.inline=d,t.highlightFormatting&&(c.formatting="link");var oe=_(c);return oe?oe+=" ":oe="",oe+o.linkInline}if(O==="<"&&m.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){c.f=c.inline=d,t.highlightFormatting&&(c.formatting="link");var oe=_(c);return oe?oe+=" ":oe="",oe+o.linkEmail}if(t.xml&&O==="<"&&m.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ze=m.string.indexOf(">",m.pos);if(ze!=-1){var ut=m.string.substring(m.start,ze);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ut)&&(c.md_inside=!0)}return m.backUp(1),c.htmlState=R.startState(r),I(m,c,W)}if(t.xml&&O==="<"&&m.match(/^\/\w*?>/))return c.md_inside=!1,"tag";if(O==="*"||O==="_"){for(var _e=1,Be=m.pos==1?" ":m.string.charAt(m.pos-2);_e<3&&m.eat(O);)_e++;var ft=m.peek()||" ",Tt=!/\s/.test(ft)&&(!S.test(ft)||/\s/.test(Be)||S.test(Be)),Mt=!/\s/.test(Be)&&(!S.test(Be)||/\s/.test(ft)||S.test(ft)),ct=null,ht=null;if(_e%2&&(!c.em&&Tt&&(O==="*"||!Mt||S.test(Be))?ct=!0:c.em==O&&Mt&&(O==="*"||!Tt||S.test(ft))&&(ct=!1)),_e>1&&(!c.strong&&Tt&&(O==="*"||!Mt||S.test(Be))?ht=!0:c.strong==O&&Mt&&(O==="*"||!Tt||S.test(ft))&&(ht=!1)),ht!=null||ct!=null){t.highlightFormatting&&(c.formatting=ct==null?"strong":ht==null?"em":"strong em"),ct===!0&&(c.em=O),ht===!0&&(c.strong=O);var ee=_(c);return ct===!1&&(c.em=!1),ht===!1&&(c.strong=!1),ee}}else if(O===" "&&(m.eat("*")||m.eat("_"))){if(m.peek()===" ")return _(c);m.backUp(1)}if(t.strikethrough){if(O==="~"&&m.eatWhile(O)){if(c.strikethrough){t.highlightFormatting&&(c.formatting="strikethrough");var ee=_(c);return c.strikethrough=!1,ee}else if(m.match(/^[^\s]/,!1))return c.strikethrough=!0,t.highlightFormatting&&(c.formatting="strikethrough"),_(c)}else if(O===" "&&m.match(/^~~/,!0)){if(m.peek()===" ")return _(c);m.backUp(2)}}if(t.emoji&&O===":"&&m.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){c.emoji=!0,t.highlightFormatting&&(c.formatting="emoji");var ni=_(c);return c.emoji=!1,ni}return O===" "&&(m.match(/^ +$/,!1)?c.trailingSpace++:c.trailingSpace&&(c.trailingSpaceNewLine=!0)),_(c)}function d(m,c){var z=m.next();if(z===">"){c.f=c.inline=C,t.highlightFormatting&&(c.formatting="link");var H=_(c);return H?H+=" ":H="",H+o.linkInline}return m.match(/^[^>]+/,!0),o.linkInline}function B(m,c){if(m.eatSpace())return null;var z=m.next();return z==="("||z==="["?(c.f=c.inline=j(z==="("?")":"]"),t.highlightFormatting&&(c.formatting="link-string"),c.linkHref=!0,_(c)):"error"}var Q={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function j(m){return function(c,z){var H=c.next();if(H===m){z.f=z.inline=C,t.highlightFormatting&&(z.formatting="link-string");var O=_(z);return z.linkHref=!1,O}return c.match(Q[m]),z.linkHref=!0,_(z)}}function w(m,c){return m.match(/^([^\]\\]|\\.)*\]:/,!1)?(c.f=T,m.next(),t.highlightFormatting&&(c.formatting="link"),c.linkText=!0,_(c)):A(m,c,C)}function T(m,c){if(m.match(/^\]:/,!0)){c.f=c.inline=x,t.highlightFormatting&&(c.formatting="link");var z=_(c);return c.linkText=!1,z}return m.match(/^([^\]\\]|\\.)+/,!0),o.linkText}function x(m,c){return m.eatSpace()?null:(m.match(/^[^\s]+/,!0),m.peek()===void 0?c.linkTitle=!0:m.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),c.f=c.inline=C,o.linkHref+" url")}var K={startState:function(){return{f:P,prevLine:{stream:null},thisLine:{stream:null},block:P,htmlState:null,indentation:0,inline:C,text:v,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(m){return{f:m.f,prevLine:m.prevLine,thisLine:m.thisLine,block:m.block,htmlState:m.htmlState&&R.copyState(r,m.htmlState),indentation:m.indentation,localMode:m.localMode,localState:m.localMode?R.copyState(m.localMode,m.localState):null,inline:m.inline,text:m.text,formatting:!1,linkText:m.linkText,linkTitle:m.linkTitle,linkHref:m.linkHref,code:m.code,em:m.em,strong:m.strong,strikethrough:m.strikethrough,emoji:m.emoji,header:m.header,setext:m.setext,hr:m.hr,taskList:m.taskList,list:m.list,listStack:m.listStack.slice(0),quote:m.quote,indentedCode:m.indentedCode,trailingSpace:m.trailingSpace,trailingSpaceNewLine:m.trailingSpaceNewLine,md_inside:m.md_inside,fencedEndRE:m.fencedEndRE}},token:function(m,c){if(c.formatting=!1,m!=c.thisLine.stream){if(c.header=0,c.hr=!1,m.match(/^\s*$/,!0))return E(c),null;if(c.prevLine=c.thisLine,c.thisLine={stream:m},c.taskList=!1,c.trailingSpace=0,c.trailingSpaceNewLine=!1,!c.localState&&(c.f=c.block,c.f!=W)){var z=m.match(/^\s*/,!0)[0].replace(/\t/g,D).length;if(c.indentation=z,c.indentationDiff=null,z>0)return null}}return c.f(m,c)},innerMode:function(m){return m.block==W?{state:m.htmlState,mode:r}:m.localState?{state:m.localState,mode:m.localMode}:{state:m,mode:K}},indent:function(m,c,z){return m.block==W&&r.indent?r.indent(m.htmlState,c,z):m.localState&&m.localMode.indent?m.localMode.indent(m.localState,c,z):R.Pass},blankLine:E,getType:_,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return K},"xml");R.defineMIME("text/src","markdown");R.defineMIME("text/x-src","markdown");var ec={tabSize:4,styleActiveLine:!0,lineNumbers:!0,lineWrapping:!1,line:!0,mode:"text/x-src",theme:"default",cursorHeight:.8,lineWiseCopyCut:!0};function tc(e,t){var r=document.createElement("a");if(r.setAttribute("href","data:text/plain;charset=UTF-8,"+encodeURIComponent(e)),r.setAttribute("download",t),r.style.display="none",document.createEvent){const n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),r.dispatchEvent(n)}else r.click()}var rc={strong:!0,italic:!0,overline:!0,h1:!0,h2:!0,h3:!0,h4:!1,h5:!1,h6:!1,hr:!0,quote:!0,ul:!0,ol:!0,code:!0,link:!0,image:!0,uploadImage:!1,custom_image:!1,custom_uploadImage:!1,custom_uploadFile:!1,table:!0,checked:!0,notChecked:!0,split:!0,preview:!0,fullscreen:!0,theme:!0,exportmd:!0,importmd:!0,save:!1,clear:!1},nc={name:"markdown",props:{value:{type:[String,Number],default:""},theme:{type:String,default:"light"},width:{type:[Number,String],default:"auto"},height:{type:[Number,String],default:600},toolbars:{type:Object,default(){return{}}},bordered:{type:Boolean,default:!0},autoSave:{type:Boolean,default:!1},interval:{type:Number,default:1e4},exportFileName:{type:String,default:"unnamed"},markedOptions:{type:Object,default(){return{}}},copyCode:{type:Boolean,default:!0},copyBtnText:{type:String,default:"\u590D\u5236\u4EE3\u7801"},isPreview:{type:Boolean,default:!1},isCustomFullscreen:{type:Boolean,default:!1}},data(){return{currentValue:"",timeoutId:null,indexLenth:1,html:"",preview:!1,split:!0,fullscreen:!1,scrollSide:"",lastInsert:"",timerId:null,themeName:"",themeSlideDown:!1,imgSlideDown:!1,imgs:[],scrolling:!0,editorScrollHeight:0,previewImgModal:!1,previewImgSrc:"",previewImgMode:"",tocTrigger:!1,tocShow:!1,tocAction:"",tocLists:[]}},computed:{tools(){const{toolbars:e={}}=this;return{...rc,...e}}},methods:{insertLink(){this.insertContent(` [link](href)`)},insertImage(){this.insertContent(` ![image](imgUrl)`)},insertTable(){this.insertContent(` header 1 | header 2 ---|--- row 1 col 1 | row 1 col 2 row 2 col 1 | row 2 col 2 `)},handleSave(){const{currentValue:e,themeName:t,html:r}=this;this.$emit("on-save",{theme:t,value:e,html:r})},toggleSlideDown(){this.slideDown=!this.slideDown},setThemes(e){this.themeName=e,this.themeSlideDown=!1,this.$emit("on-theme-change",e)},exportFile(){tc(this.currentValue,this.exportFileName+".md")},importFile(e){const t=e.target.files[0];if(!t)return;const{type:r}=t;if(!["text/markdown","text/src"].includes(r))return;const n=new FileReader;n.readAsText(t,{encoding:"utf-8"}),n.onload=()=>{this.currentValue=n.result,e.target.value="",this.pro&&this.editor.setOption("value",this.currentValue)},n.onerror=i=>{console.error(i)}},handlePaste(e,t){const{clipboardData:r={}}=t,{types:n=[],items:i}=r;let o=null;for(let l=0;l0)for(let t=0,r=e.length;t{if(!!this.$refs.preview){this.imgs=this.$refs.preview.querySelectorAll("img");for(let t=0,r=this.imgs.length;t{const n=this.imgs[t].getAttribute("src");this.previewImage(n)}}},600)},previewImage(e){const t=new Image;t.src=e,t.onload=()=>{const r=t.naturalWidth;t.naturalHeight/r>1.4?this.previewImgMode="horizontal":this.previewImgMode="vertical",this.previewImgSrc=e,this.previewImgModal=!0}},chooseImage(){const e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=()=>{const t=e.files;t[0]&&(this.$emit("on-upload-image",t[0]),e.value="")},e.click()},addCopyListener(){setTimeout(()=>{const e=document.querySelectorAll(".code-block .copy-code");this.btns=e;for(let t=0,r=e.length;t{const n=e[t].parentNode.querySelectorAll("pre")[0].innerText,i=document.createElement("input");i.setAttribute("value",n),document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i),this.$emit("on-copy",n)}},600)},onCustom(e){this.$emit("on-custom",e)}},destroyed(){clearInterval(this.timerId)}},ic={name:"markdown-pro",mixins:[nc],data(){return{pro:!0,editor:null,lastPos:""}},mounted(){br.reset(),this.init(),this.createEditor()},methods:{init(){this.currentValue=this.value,this.themeName=this.theme,this.preview=this.isPreview,this.currentValue=this.value,!this.isPreview&&setTimeout(()=>{this.autoSave&&(this.timerId=setInterval(()=>{this.handleSave()},this.interval))},20)},createEditor(){this.editor=new R(this.$refs.codemirror,{value:this.currentValue,onload:e=>{const{doc:{height:t=0}}=e;this.editorScrollHeight=t},...ec}),this.addEditorLintener(),this.$emit("on-ready",{vm:this,insertContent:this.insertContent})},addEditorLintener(){const e=this.editor;e.on("change",t=>{this.lastPos=e.getCursor(),this.currentValue=e.getValue();const{doc:{height:r}}=t;this.editorScrollHeight=r}),e.on("scroll",this.markdownScroll),e.on("paste",this.handlePaste),e.on("keydown",(t,r)=>{r.keyCode===83?(r.metaKey||r.ctrlKey)&&(r.preventDefault(),this.handleSave()):r.keyCode===13?this.listerenKeyupEnter(r):r.keyCode===8&&this.listerenDelete(t)}),e.on("focus",()=>{this.lastPos=e.getCursor()})},insertContent(e){this.editor.replaceSelection(e),this.lastInsert=e.replace(/\n/g,"")},setCursor(e=0,t=0){const{editor:r}=this;r.setCursor(e,t),r.focus()},insertStrong(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent("**"+i+"**"):(this.insertContent("****"),this.setCursor(r,n+2))},insertItalic(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent("*"+i+"*"):(this.insertContent("**"),this.setCursor(r,n+1))},insertUnderline(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent(""+i+""):(this.insertContent(""),this.setCursor(r,n+3))},insertOverline(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent("~~"+i+"~~"):(this.insertContent("~~~~"),this.setCursor(r,n+2))},insertTitle(e){const t={1:"# ",2:"## ",3:"### ",4:"#### ",5:"##### ",6:"###### "},{editor:r,lastPos:n={}}=this,{line:i}=n,o=r.getSelection();if(o)this.insertContent(` `+t[e]+o+` `);else{const l=t[e];r.isClean()?(this.insertContent(l),this.setCursor(0,l.length)):(this.insertContent(` `+l),this.setCursor(i+1,l.length))}},insertLine(){const{editor:e}=this;e.isClean()?this.insertContent(`---- `):this.insertContent(` ---- `)},insertQuote(){const{editor:e,lastPos:t={}}=this,{line:r=0}=t,n=e.getSelection();n?this.insertContent(` > `+n+` `):e.isClean()?(this.insertContent("> "),this.setCursor(0,3)):(this.insertContent(` > `),this.setCursor(r+1,3))},insertUl(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent(` - `+i+` `):e.isClean()||n===0?(this.insertContent("- "),this.setCursor(r,3)):(this.insertContent(` - `),this.setCursor(r+1,3))},insertOl(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent(` 1. `+i+` `):e.isClean()||n===0?(this.insertContent("1. "),this.setCursor(r,4)):(this.insertContent(` 1. `),this.setCursor(r+1,4))},insertCode(){const{editor:e,lastPos:t={}}=this,{line:r}=t,n=e.getSelection();n?this.insertContent("\n```\n"+n+"\n```\n"):e.isClean()?(this.insertContent("```\n\n```"),this.setCursor(1,0)):(this.insertContent("\n```\n\n```"),this.setCursor(r+2,0))},insertFinished(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent(` - [x] `+i+` `):e.isClean()||n===0?(this.insertContent("- [x] "),this.setCursor(r,6)):(this.insertContent(` - [x] `),this.setCursor(r+1,6))},insertNotFinished(){const{editor:e,lastPos:t={}}=this,{line:r=0,ch:n=0}=t,i=e.getSelection();i?this.insertContent(` - [ ] `+i+` `):e.isClean()||n===0?(this.insertContent("- [ ] "),this.setCursor(r,6)):(this.insertContent(` - [ ] `),this.setCursor(r+1,6))},listerenKeyupEnter(e){const{lastInsert:t}=this;t&&(["-","- [ ]","- [x]"].includes(t.trim())?(e.preventDefault(),this.insertContent(` `+t)):/^\d+\.$/.test(t.trim())&&(e.preventDefault(),this.insertContent(` `+(parseInt(t,0)+1)+". ")))},listerenDelete(){setTimeout(()=>{const{editor:e}=this;e.isClean()||e.getValue().split(` `).pop()===""&&(this.lastInsert="")},20)},onDelete(){const e=this.currentValue.split(` `);e[e.length-1]===""&&(this.lastInsert="")},markdownScroll(e={}){if(this.scrolling&&this.scrollSide==="left"){const{doc:{height:t,scrollTop:r}}=e,n=this.$refs.preview,i=n.offsetHeight,o=n.scrollHeight;n.scrollTop=parseInt(r*(o-i)/(t-i),0)}},previewScroll(){if(this.scrolling&&this.scrollSide==="right"){const e=this.$refs.preview,t=e.offsetHeight,r=e.scrollHeight,n=e.scrollTop,i=parseInt(n*(this.editorScrollHeight-t)/(r-t),0);this.editor.scrollTo(0,i);const o=$A(this.$refs.preview);let l,a;o.find("h1,h2,h3,h4,h5").each((s,u)=>{if(l=$A(u),l.offset().top-o.offset().top>=0&&(a=l.attr("toc-id")))return this.tocAction=a,!1})}},redo(){const{editor:e}=this;e.redo(),setTimeout(()=>{e.refresh()},20)},tocLevel(e,t){let r=9999;return typeof t=="undefined"&&(t=this.tocLists),t.forEach(({level:n})=>{r=Math.min(r,n)}),r===9999?e:e-(r-1)},tocClick(e){this.tocAction=e.anchor;const t=$A(this.$refs.preview),r=t.find("h"+e.level+'[toc-id="'+this.tocAction+'"]');r&&t.animate({scrollTop:r.offset().top-t.offset().top+t.scrollTop()})}},watch:{currentValue(){clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{const{currentValue:e}=this;let t=Ls(e,{sanitize:!1,...this.markedOptions}).replace(/href="/gi,'target="_blank" href="');if(this.copyCode&&t!==""&&(t=t.replace(/
/g,'
'+this.copyBtnText+"
").replace(/<\/pre>/g,"
")),/\[\[TOC\]\]/.test(t)){let r="";br.tocItems.forEach(n=>{r+=`
  • ${n.text}
  • `}),t=t.replace(/\[\[TOC\]\]/g,`
      ${r}
    `)}this.html=t,this.tocLists=br.tocItems,this.tocTrigger||(this.tocShow=this.tocLists.length>1),br.reset(),this.addImageClickListener(),this.addCopyListener(),this.$emit("input",e)},30)},value(){const{value:e,currentValue:t}=this;t!==e&&(this.currentValue=e,this.editor.setOption("value",e))}}},oc=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"markdown",class:`markdown ${e.fullscreen?"fullscreen":""} ${e.bordered?"border":""}`,style:{width:e.width+(typeof e.width=="string"?"":"px"),height:e.height+(typeof e.height=="string"?"":"px")}},[r("ul",{directives:[{name:"show",rawName:"v-show",value:!e.preview,expression:"!preview"}],staticClass:"markdown-toolbars"},[r("li",[e._t("title")],2),e.tools.undo?r("li",{attrs:{name:e.$L("\u64A4\u9500")}},[r("span",{staticClass:"iconfont icon-undo",on:{click:function(n){return e.editor.undo()}}})]):e._e(),e.tools.redo?r("li",{attrs:{name:e.$L("\u91CD\u505A")},on:{click:e.redo}},[r("span",{staticClass:"iconfont icon-redo"})]):e._e(),e.tools.strong?r("li",{attrs:{name:e.$L("\u7C97\u4F53")}},[r("span",{staticClass:"iconfont icon-bold",on:{click:e.insertStrong}})]):e._e(),e.tools.italic?r("li",{attrs:{name:e.$L("\u659C\u4F53")}},[r("span",{staticClass:"iconfont icon-italic",on:{click:e.insertItalic}})]):e._e(),e.tools.overline?r("li",{attrs:{name:e.$L("\u5220\u9664\u7EBF")}},[r("span",{staticClass:"iconfont icon-overline",on:{click:e.insertOverline}})]):e._e(),e.tools.overline?r("li",{attrs:{name:e.$L("\u4E0B\u5212\u7EBF")}},[r("span",{staticClass:"iconfont icon-under-line",on:{click:e.insertUnderline}})]):e._e(),e.tools.h1?r("li",{attrs:{name:e.$L("\u6807\u98981")}},[r("span",{staticStyle:{"font-size":"16px"},on:{click:function(n){return e.insertTitle(1)}}},[e._v("h1")])]):e._e(),e.tools.h2?r("li",{attrs:{name:e.$L("\u6807\u98982")}},[r("span",{staticStyle:{"font-size":"16px"},on:{click:function(n){return e.insertTitle(2)}}},[e._v("h2")])]):e._e(),e.tools.h3?r("li",{attrs:{name:e.$L("\u6807\u98983")}},[r("span",{staticStyle:{"font-size":"16px"},on:{click:function(n){return e.insertTitle(3)}}},[e._v("h3")])]):e._e(),e.tools.h4?r("li",{attrs:{name:e.$L("\u6807\u98984")}},[r("span",{staticStyle:{"font-size":"16px"},on:{click:function(n){return e.insertTitle(4)}}},[e._v("h4")])]):e._e(),e.tools.h5?r("li",{attrs:{name:e.$L("\u6807\u98985")}},[r("span",{staticStyle:{"font-size":"16px"},on:{click:function(n){return e.insertTitle(5)}}},[e._v("h5")])]):e._e(),e.tools.h6?r("li",{attrs:{name:e.$L("\u6807\u98986")}},[r("span",{staticStyle:{"font-size":"16px"},on:{click:function(n){return e.insertTitle(6)}}},[e._v("h6")])]):e._e(),e.tools.hr?r("li",{attrs:{name:e.$L("\u5206\u5272\u7EBF")}},[r("span",{staticClass:"iconfont icon-horizontal",on:{click:e.insertLine}})]):e._e(),e.tools.quote?r("li",{attrs:{name:e.$L("\u5F15\u7528")}},[r("span",{staticClass:"iconfont icon-quote",staticStyle:{"font-size":"16px"},on:{click:e.insertQuote}})]):e._e(),e.tools.ul?r("li",{attrs:{name:e.$L("\u65E0\u5E8F\u5217\u8868")}},[r("span",{staticClass:"iconfont icon-ul",on:{click:e.insertUl}})]):e._e(),e.tools.ol?r("li",{attrs:{name:e.$L("\u6709\u5E8F\u5217\u8868")}},[r("span",{staticClass:"iconfont icon-ol",on:{click:e.insertOl}})]):e._e(),e.tools.code?r("li",{attrs:{name:e.$L("\u4EE3\u7801\u5757")}},[r("span",{staticClass:"iconfont icon-code",on:{click:e.insertCode}})]):e._e(),e.tools.notChecked?r("li",{attrs:{name:e.$L("\u672A\u5B8C\u6210\u5217\u8868")}},[r("span",{staticClass:"iconfont icon-checked-false",on:{click:e.insertNotFinished}})]):e._e(),e.tools.checked?r("li",{attrs:{name:e.$L("\u5DF2\u5B8C\u6210\u5217\u8868")}},[r("span",{staticClass:"iconfont icon-checked",on:{click:e.insertFinished}})]):e._e(),e.tools.link?r("li",{attrs:{name:e.$L("\u94FE\u63A5")}},[r("span",{staticClass:"iconfont icon-link",on:{click:e.insertLink}})]):e._e(),e.tools.image?r("li",{attrs:{name:e.$L("\u56FE\u7247")}},[r("span",{staticClass:"iconfont icon-img",on:{click:e.insertImage}})]):e._e(),e.tools.uploadImage?r("li",{attrs:{name:e.$L("\u672C\u5730\u56FE\u7247")}},[r("span",{staticClass:"iconfont icon-upload-img",on:{click:e.chooseImage}})]):e._e(),e.tools.custom_image?r("li",{attrs:{name:e.$L("\u56FE\u7247\u7A7A\u95F4")}},[r("span",{staticClass:"iconfont icon-img",on:{click:function(n){return e.onCustom("image-browse")}}})]):e._e(),e.tools.custom_uploadImage?r("li",{attrs:{name:e.$L("\u4E0A\u4F20\u56FE\u7247")}},[r("span",{staticClass:"iconfont icon-upload-img",on:{click:function(n){return e.onCustom("image-upload")}}})]):e._e(),e.tools.custom_uploadFile?r("li",{attrs:{name:e.$L("\u4E0A\u4F20\u6587\u4EF6")}},[r("span",{staticClass:"icon-svg",on:{click:function(n){return e.onCustom("file-upload")}}},[r("svg",{staticClass:"icon",attrs:{t:"1599285632421",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"45640",width:"16",height:"16"}},[r("path",{attrs:{d:"M127.519 892.879v-763.34h655.448V514.69h63.612V81.831c0-8.783-7.12-15.903-15.903-15.903H79.81c-8.783 0-15.903 7.12-15.903 15.903v858.757c0 8.783 7.12 15.903 15.903 15.903h493.993v-63.612H127.519z",fill:"#999999","p-id":"45641"}}),r("path",{attrs:{d:"M231.608 228.388h447.269V292H231.608zM231.608 384.409h447.269v63.612H231.608zM231.608 540.43h245.141v63.612H231.608zM231.608 696.451h245.141v63.612H231.608zM923.269 762.938L745.315 584.984c-3.545-3.545-8.34-5.074-12.966-4.596a15.931 15.931 0 0 0-9.848 4.616L544.586 762.918c-6.248 6.248-6.248 16.379 0 22.627l22.353 22.353c6.248 6.248 16.379 6.248 22.627 0l112.555-112.555v245.148c0 8.837 7.163 16 16 16h31.612c8.837 0 16-7.163 16-16V695.363l112.555 112.555c6.248 6.248 16.379 6.248 22.627 0l22.353-22.353c6.249-6.248 6.249-16.378 0.001-22.627z",fill:"#999999","p-id":"45642"}})])])]):e._e(),e.tools.table?r("li",{attrs:{name:e.$L("\u8868\u683C")}},[r("span",{staticClass:"iconfont icon-table",on:{click:e.insertTable}})]):e._e(),e.tools.theme?r("li",{staticClass:"shift-theme",attrs:{name:e.$L("\u4EE3\u7801\u5757\u4E3B\u9898")}},[r("div",[r("span",{staticClass:"iconfont icon-theme",on:{click:function(n){e.themeSlideDown=!e.themeSlideDown}}}),r("ul",{class:{active:e.themeSlideDown},on:{mouseleave:function(n){e.themeSlideDown=!1}}},[r("li",{on:{click:function(n){return e.setThemes("light")}}},[e._v("Light")]),r("li",{on:{click:function(n){return e.setThemes("dark")}}},[e._v("VS Code")]),r("li",{on:{click:function(n){return e.setThemes("oneDark")}}},[e._v("Atom OneDark")]),r("li",{on:{click:function(n){return e.setThemes("gitHub")}}},[e._v("GitHub")])])])]):e._e(),r("li",{directives:[{name:"show",rawName:"v-show",value:e.tools.importmd,expression:"tools.importmd"}],staticClass:"import-file",attrs:{name:e.$L("\u5BFC\u5165\u6587\u4EF6")}},[r("span",{staticClass:"iconfont icon-daoru",on:{click:e.importFile}}),r("input",{attrs:{type:"file",accept:"text/markdown"},on:{change:function(n){return e.importFile(n)}}})]),r("li",{directives:[{name:"show",rawName:"v-show",value:e.tools.exportmd,expression:"tools.exportmd"}],attrs:{name:e.$L("\u4FDD\u5B58\u5230\u672C\u5730")}},[r("span",{staticClass:"iconfont icon-download",on:{click:e.exportFile}})]),e.tools.split&&e.split?r("li",{attrs:{name:e.$L("\u5168\u5C4F\u7F16\u8F91")}},[r("span",{staticClass:"iconfont icon-md",on:{click:function(n){e.split=!1}}})]):e._e(),e.tools.split&&!e.split?r("li",{attrs:{name:e.$L("\u5206\u5C4F\u663E\u793A")}},[r("span",{staticClass:"iconfont icon-group",on:{click:function(n){e.split=!0}}})]):e._e(),e.tools.preview?r("li",{attrs:{name:e.$L("\u9884\u89C8")}},[r("span",{staticClass:"iconfont icon-preview",on:{click:function(n){e.preview=!0}}})]):e._e(),e.tools.clear?r("li",{attrs:{name:e.$L("\u6E05\u7A7A")},on:{click:function(n){e.value=""}}},[r("span",{staticClass:"iconfont icon-clear"})]):e._e(),e.tools.save?r("li",{attrs:{name:e.$L("\u4FDD\u5B58")},on:{click:e.handleSave}},[r("span",{staticClass:"iconfont icon-save"})]):e._e(),r("li",{attrs:{name:e.$L(e.scrolling?"\u540C\u6B65\u6EDA\u52A8:\u5F00":"\u540C\u6B65\u6EDA\u52A8:\u5173")}},[r("span",{directives:[{name:"show",rawName:"v-show",value:e.scrolling,expression:"scrolling"}],staticClass:"iconfont icon-on",on:{click:function(n){e.scrolling=!e.scrolling}}}),r("span",{directives:[{name:"show",rawName:"v-show",value:!e.scrolling,expression:"!scrolling"}],staticClass:"iconfont icon-off",on:{click:function(n){e.scrolling=!e.scrolling}}})]),r("li",{attrs:{name:e.$L("html\u8F6Cmarkdown")},on:{click:function(n){return e.onCustom("html2md")}}},[r("span",{staticStyle:{width:"auto","font-size":"14px",padding:"0 6px"}},[e._v("HTML2MD")])]),r("li",{staticClass:"right"},[r("ul",[r("li",{attrs:{name:e.$L("\u83DC\u5355")},on:{click:function(n){e.tocTrigger=!0}}},[r("span",{directives:[{name:"show",rawName:"v-show",value:e.tocShow,expression:"tocShow"}],staticClass:"icon-svg",on:{click:function(n){e.tocShow=!e.tocShow}}},[r("svg",{staticClass:"icon",attrs:{t:"1611551476626",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"4615",width:"22",height:"22"}},[r("path",{attrs:{d:"M370.1 371.5h-49.6c-3.1 0-5.7-2.5-5.7-5.7v-49.6c0-3.1 2.5-5.7 5.7-5.7h49.6c3.1 0 5.7 2.5 5.7 5.7v49.6c0 3.1-2.6 5.7-5.7 5.7z m333.5-7.6H460.5c-3.1 0-5.7-2.5-5.7-5.7v-34.5c0-3.1 2.5-5.7 5.7-5.7h243.2c3.1 0 5.7 2.5 5.7 5.7v34.5c-0.1 3.2-2.7 5.7-5.8 5.7zM370.1 712.4h-49.6c-3.1 0-5.7-2.5-5.7-5.7v-49.6c0-3.1 2.5-5.7 5.7-5.7h49.6c3.1 0 5.7 2.5 5.7 5.7v49.6c0 3.2-2.6 5.7-5.7 5.7z m333.5-7.5H460.5c-3.1 0-5.7-2.5-5.7-5.7v-34.5c0-3.1 2.5-5.7 5.7-5.7h243.2c3.1 0 5.7 2.5 5.7 5.7v34.5c-0.1 3.1-2.7 5.7-5.8 5.7zM370.1 542.5h-49.6c-3.1 0-5.7-2.5-5.7-5.7v-49.6c0-3.1 2.5-5.7 5.7-5.7h49.6c3.1 0 5.7 2.5 5.7 5.7v49.6c0 3.1-2.6 5.7-5.7 5.7z m333.5-7.6H460.5c-3.1 0-5.7-2.5-5.7-5.7v-34.5c0-3.1 2.5-5.7 5.7-5.7h243.2c3.1 0 5.7 2.5 5.7 5.7v34.5c-0.1 3.2-2.7 5.7-5.8 5.7z","p-id":"4616",fill:"#1890ff"}}),r("path",{attrs:{d:"M847.1 560.4V250.1s0-24.7-14-46.4c-10.8-16.8-30-31.8-64.2-31.8h-261c-0.2 0-0.3 0-0.5 0.1H255s-78.1 0-78.1 78.1l0.1 213.4V774s0 24.7 13.9 46.3c10.8 16.8 30 31.8 64.2 31.8h261.1c0.2 0 0.3 0 0.5-0.1H769s78.1 0 78.1-78.1l-0.1-213.4 0.1-0.1z m-39 213.6c-1.3 38.5-38.9 39-38.9 39h-514c-1.3-0.1-2.5-0.2-3.8-0.3-5.4-1.1-15.7-4.1-23.9-11.7-9-9.7-11.2-22.3-11.7-26.1v-0.7l0.1-524.2c1.3-38.5 38.9-39 38.9-39h514c1.3 0.1 2.5 0.2 3.7 0.3 5.4 1.1 15.7 4.1 23.9 11.7 9 9.7 11.2 22.2 11.7 26 0 0.2 0 0.5 0.1 0.7l-0.1 524.3z","p-id":"4617",fill:"#1890ff"}})])]),r("span",{directives:[{name:"show",rawName:"v-show",value:!e.tocShow,expression:"!tocShow"}],staticClass:"icon-svg",on:{click:function(n){e.tocShow=!e.tocShow}}},[r("svg",{staticClass:"icon",attrs:{t:"1611551476626",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"4615",width:"22",height:"22"}},[r("path",{attrs:{d:"M370.1 371.5h-49.6c-3.1 0-5.7-2.5-5.7-5.7v-49.6c0-3.1 2.5-5.7 5.7-5.7h49.6c3.1 0 5.7 2.5 5.7 5.7v49.6c0 3.1-2.6 5.7-5.7 5.7z m333.5-7.6H460.5c-3.1 0-5.7-2.5-5.7-5.7v-34.5c0-3.1 2.5-5.7 5.7-5.7h243.2c3.1 0 5.7 2.5 5.7 5.7v34.5c-0.1 3.2-2.7 5.7-5.8 5.7zM370.1 712.4h-49.6c-3.1 0-5.7-2.5-5.7-5.7v-49.6c0-3.1 2.5-5.7 5.7-5.7h49.6c3.1 0 5.7 2.5 5.7 5.7v49.6c0 3.2-2.6 5.7-5.7 5.7z m333.5-7.5H460.5c-3.1 0-5.7-2.5-5.7-5.7v-34.5c0-3.1 2.5-5.7 5.7-5.7h243.2c3.1 0 5.7 2.5 5.7 5.7v34.5c-0.1 3.1-2.7 5.7-5.8 5.7zM370.1 542.5h-49.6c-3.1 0-5.7-2.5-5.7-5.7v-49.6c0-3.1 2.5-5.7 5.7-5.7h49.6c3.1 0 5.7 2.5 5.7 5.7v49.6c0 3.1-2.6 5.7-5.7 5.7z m333.5-7.6H460.5c-3.1 0-5.7-2.5-5.7-5.7v-34.5c0-3.1 2.5-5.7 5.7-5.7h243.2c3.1 0 5.7 2.5 5.7 5.7v34.5c-0.1 3.2-2.7 5.7-5.8 5.7z","p-id":"4616",fill:"#777777"}}),r("path",{attrs:{d:"M847.1 560.4V250.1s0-24.7-14-46.4c-10.8-16.8-30-31.8-64.2-31.8h-261c-0.2 0-0.3 0-0.5 0.1H255s-78.1 0-78.1 78.1l0.1 213.4V774s0 24.7 13.9 46.3c10.8 16.8 30 31.8 64.2 31.8h261.1c0.2 0 0.3 0 0.5-0.1H769s78.1 0 78.1-78.1l-0.1-213.4 0.1-0.1z m-39 213.6c-1.3 38.5-38.9 39-38.9 39h-514c-1.3-0.1-2.5-0.2-3.8-0.3-5.4-1.1-15.7-4.1-23.9-11.7-9-9.7-11.2-22.3-11.7-26.1v-0.7l0.1-524.2c1.3-38.5 38.9-39 38.9-39h514c1.3 0.1 2.5 0.2 3.7 0.3 5.4 1.1 15.7 4.1 23.9 11.7 9 9.7 11.2 22.2 11.7 26 0 0.2 0 0.5 0.1 0.7l-0.1 524.3z","p-id":"4617",fill:"#777777"}})])])]),e.tools.fullscreen&&!e.fullscreen?r("li",{attrs:{name:e.$L("\u5168\u5C4F")}},[r("span",{staticClass:"iconfont icon-fullscreen",on:{click:function(n){e.fullscreen=!e.fullscreen}}})]):e._e(),e.tools.fullscreen&&e.fullscreen?r("li",{attrs:{name:e.$L("\u9000\u51FA\u5168\u5C4F")}},[r("span",{staticClass:"iconfont icon-quite",on:{click:function(n){e.fullscreen=!e.fullscreen}}})]):e._e(),e.tools.custom_fullscreen&&!e.isCustomFullscreen?r("li",{attrs:{name:e.$L("\u5168\u5C4F")}},[r("span",{staticClass:"iconfont icon-fullscreen",on:{click:function(n){return e.onCustom("fullscreen")}}})]):e._e(),e.tools.custom_fullscreen&&e.isCustomFullscreen?r("li",{attrs:{name:e.$L("\u9000\u51FA\u5168\u5C4F")}},[r("span",{staticClass:"iconfont icon-quite",on:{click:function(n){return e.onCustom("fullscreen")}}})]):e._e()])])]),r("div",{directives:[{name:"show",rawName:"v-show",value:e.preview&&!e.isPreview,expression:"preview && !isPreview"}],staticClass:"close-preview",on:{click:function(n){e.preview=!1}}},[r("span",{staticClass:"iconfont icon-close"})]),r("div",{staticClass:"markdown-content",style:{background:e.preview?"#fff":""}},[r("div",{directives:[{name:"show",rawName:"v-show",value:!e.preview,expression:"!preview"}],ref:"codemirror",staticClass:"codemirror",on:{mouseenter:function(n){return e.mousescrollSide("left")}}}),r("div",{directives:[{name:"show",rawName:"v-show",value:e.preview?e.preview:e.split,expression:"preview ? preview : split"}],ref:"preview",class:`markdown-preview ${"markdown-theme-"+e.themeName}`,on:{scroll:e.previewScroll,mouseenter:function(n){return e.mousescrollSide("right")}}},[r("div",{ref:"previewInner",domProps:{innerHTML:e._s(e.html)}})]),r("ul",{directives:[{name:"show",rawName:"v-show",value:e.tocShow,expression:"tocShow"}],staticClass:"toc-anchor"},e._l(e.tocLists,function(n){return r("li",{key:n.anchor,staticClass:"toc-anchor-item",on:{click:function(i){return e.tocClick(n)}}},[r("span",{class:`toc-link-${e.tocLevel(n.level)}${e.tocAction==n.anchor?" toc-link-action":""}`,attrs:{anchor:n.anchor,title:n.text}},[e._v(e._s(n.text))])])}),0)]),r("div",{class:["preview-img",e.previewImgModal?"active":""]},[r("span",{staticClass:"close icon-close iconfont",on:{click:function(n){e.previewImgModal=!1}}}),r("img",{class:[e.previewImgMode],attrs:{src:e.previewImgSrc,alt:""}})])])},lc=[];const ac=ic,pl={};var sc=gl(ac,oc,lc,!1,uc,"566f9802",null,null);function uc(e){for(let t in pl)this[t]=pl[t]}var fc=function(){return sc.exports}(),cc=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"mdeditor-wrapper"},[r("div",{staticClass:"mdeditor-box"},[r("MarkdownPro",{ref:"md1",attrs:{height:e.height,toolbars:e.toolbars,copyBtnText:e.$L("\u590D\u5236\u4EE3\u7801"),"is-custom-fullscreen":e.transfer},on:{"on-custom":e.customClick,"on-upload-image":e.handleUploadImageUpload},model:{value:e.content,callback:function(n){e.content=n},expression:"content"}}),r("ImgUpload",{ref:"myUpload",staticClass:"upload-control",attrs:{type:"callback",uploadIng:e.uploadIng,num:"50"},on:{"update:uploadIng":function(n){e.uploadIng=n},"update:upload-ing":function(n){e.uploadIng=n},"on-callback":e.editorImage}}),r("Upload",{ref:"fileUpload",staticClass:"upload-control",attrs:{name:"files",action:e.actionUrl,headers:e.headers,multiple:"",format:e.uploadFormat,"show-upload-list":!1,"max-size":e.maxSize,"on-progress":e.handleProgress,"on-success":e.handleSuccess,"on-error":e.handleError,"on-format-error":e.handleFormatError,"on-exceeded-size":e.handleMaxSize,"before-upload":e.handleBeforeUpload}})],1),e.uploadIng>0?r("Spin",{attrs:{fix:""}},[r("Icon",{staticClass:"icon-loading",attrs:{type:"ios-loading"}}),r("div",[e._v(e._s(e.$L("\u6B63\u5728\u4E0A\u4F20\u6587\u4EF6...")))])],1):e._e(),r("Modal",{staticClass:"mdeditor-transfer",attrs:{"footer-hide":"",fullscreen:"",transfer:"",closable:!1},model:{value:e.transfer,callback:function(n){e.transfer=n},expression:"transfer"}},[r("div",{staticClass:"mdeditor-transfer-body"},[e.transfer?r("MarkdownPro",{ref:"md2",attrs:{toolbars:e.toolbars,copyBtnText:e.$L("\u590D\u5236\u4EE3\u7801"),"is-custom-fullscreen":e.transfer,height:"100%"},on:{"on-custom":e.customClick,"on-upload-image":e.handleUploadImageUpload},model:{value:e.content,callback:function(n){e.content=n},expression:"content"}}):e._e()],1),e.uploadIng>0?r("Spin",{attrs:{fix:""}},[r("Icon",{staticClass:"icon-loading",attrs:{type:"ios-loading"}}),r("div",[e._v(e._s(e.$L("\u6B63\u5728\u4E0A\u4F20\u6587\u4EF6...")))])],1):e._e()],1),r("Modal",{attrs:{title:e.$L("html\u8F6Cmarkdown"),okText:e.$L("\u8F6C\u6362\u6210markdown"),width:"680","class-name":"simple-modal",transfer:""},on:{"on-ok":e.htmlOk},model:{value:e.html2md,callback:function(n){e.html2md=n},expression:"html2md"}},[r("Input",{attrs:{type:"textarea",rows:14,placeholder:e.$L("\u8BF7\u8F93\u5165html\u4EE3\u7801...")},model:{value:e.htmlValue,callback:function(n){e.htmlValue=n},expression:"htmlValue"}})],1)],1)},hc=[];const dc={name:"MDEditor",components:{ImgUpload:Ts,MarkdownPro:fc},props:{value:{default:""},height:{default:380},toolbars:{type:Object,default:()=>({strong:!0,italic:!0,overline:!0,h1:!0,h2:!0,h3:!0,h4:!1,h5:!1,h6:!1,hr:!0,quote:!0,ul:!0,ol:!0,code:!0,link:!0,image:!1,uploadImage:!1,table:!0,checked:!0,notChecked:!0,split:!0,preview:!0,fullscreen:!1,theme:!1,exportmd:!1,importmd:!1,save:!1,clear:!1,custom_image:!0,custom_uploadImage:!0,custom_uploadFile:!0,custom_fullscreen:!0})}},data(){return{content:"",transfer:!1,html2md:!1,htmlValue:"",uploadIng:0,uploadFormat:["jpg","jpeg","webp","png","gif","doc","docx","xls","xlsx","ppt","pptx","txt","esp","pdf","rar","zip","gz","ai","avi","bmp","cdr","eps","mov","mp3","mp4","pr","psd","svg","tif"],actionUrl:$A.apiUrl("system/fileupload"),maxSize:1024e3}},mounted(){this.content=this.value},activated(){this.content=this.value},computed:{headers(){return{fd:$A.getSessionStorageString("userWsFd"),token:this.userToken}}},watch:{value(e){e==null&&(e=""),this.content=e},content(e){this.$emit("input",e)}},methods:{editorImage(e){for(let t=0;t{this.transfer?this.$refs.md2.insertContent(` `+toMarkdown(this.htmlValue,{gfm:!0})):this.$refs.md1.insertContent(` `+toMarkdown(this.htmlValue,{gfm:!0})),this.htmlValue=""}).catch(e=>{$A.modalError("\u7EC4\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF01")})},handleUploadImageUpload(e){this.$refs.myUpload.handleManual(e)},handleProgress(e,t){t._uploadIng===void 0&&(t._uploadIng=!0,this.uploadIng++)},handleSuccess(e,t){if(this.uploadIng--,e.ret===1){let r=`[${e.data.name} (${$A.bytesToSize(e.data.size*1024)})](${e.data.url})`;this.transfer?this.$refs.md2.insertContent(r):this.$refs.md1.insertContent(r)}else $A.modalWarning({title:"\u4E0A\u4F20\u5931\u8D25",content:"\u6587\u4EF6 "+t.name+" \u4E0A\u4F20\u5931\u8D25\uFF0C"+e.msg})},handleError(){this.uploadIng--},handleFormatError(e){$A.modalWarning({title:"\u6587\u4EF6\u683C\u5F0F\u4E0D\u6B63\u786E",content:"\u6587\u4EF6 "+e.name+" \u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u4EC5\u652F\u6301\u4E0A\u4F20\uFF1A"+this.uploadFormat.join(",")})},handleMaxSize(e){$A.modalWarning({title:"\u8D85\u51FA\u6587\u4EF6\u5927\u5C0F\u9650\u5236",content:"\u6587\u4EF6 "+e.name+" \u592A\u5927\uFF0C\u4E0D\u80FD\u8D85\u8FC7\uFF1A"+$A.bytesToSize(this.maxSize*1024)+"\u3002"})},handleBeforeUpload(){return!0}}},vl={};var pc=gl(dc,cc,hc,!1,vc,"76ee765f",null,null);function vc(e){for(let t in vl)this[t]=vl[t]}var yc=function(){return pc.exports}();export{yc as default};