import"./helpers-CjmtV6uB.js";import"./common-CalHcBJp.js";import{j as Fu}from"./index-C8mAaM2V.js";import{Q as Eu,t as Ol,H as Wu,d as Nl,c as Iu,o as Pl,f as Bu,al as Hu,i as zu,v as Ru,E as dl,am as Ku,b as _u,an as pl,h as vl}from"./index-bVOhw2NF.js";import{c as Uu,i as Gu,d as qu,g as Xu}from"./vue-repl-jaFwbjhK.js";function uf(){const We=(H,z)=>{z.addEventListener("message",H)},Ie=(H,z,V)=>{V.postMessage({type:H,data:z})};function y(H){var B;const z=document.getElementById(H.id);if(!z)return;const V=(B=z.querySelector(".iframe-container iframe"))==null?void 0:B.contentWindow;if(!V){Eu(y.bind(null,H));return}const{click:re,dblclick:I,mouseenter:D,mouseleave:_,change:T}=Fu();We(C=>{const{type:M,data:W}=C.data;if(M==="inited")Ol(()=>H.props.datasets,Z=>{Z&&Ie("update",Wu(Z),V)},{immediate:!0,deep:!0}),H.isRemote&&H.config&&Ie("config",JSON.parse(H.config),V);else if(M==="hookEmitEvent"){const{eventType:Z,value:O}=W;Z==="click"?re(H.props.datasets,O,H):Z==="dblclick"?I(H.props.datasets,O,H):Z==="mouseenter"?D(H.props.datasets,O,H):Z==="mouseleave"?_(H.props.datasets,O,H):Z==="change"&&T(H.props.datasets,O,H)}},V)}return{init:y}}var Ml={exports:{}};(function(We,Ie){(function(y,H){We.exports=H()})(Uu,function(){var y=navigator.userAgent,H=navigator.platform,z=/gecko\/\d/i.test(y),V=/MSIE \d/.test(y),re=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(y),I=/Edge\/(\d+)/.exec(y),D=V||re||I,_=D&&(V?document.documentMode||6:+(I||re)[1]),T=!I&&/WebKit\//.test(y),B=T&&/Qt\/\d+\.\d+/.test(y),C=!I&&/Chrome\/(\d+)/.exec(y),M=C&&+C[1],W=/Opera\//.test(y),Z=/Apple Computer/.test(navigator.vendor),O=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(y),S=/PhantomJS/.test(y),v=Z&&(/Mobile\/\w+/.test(y)||navigator.maxTouchPoints>2),g=/Android/.test(y),u=v||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(y),p=v||/Mac/.test(H),m=/\bCrOS\b/.test(y),w=/win/i.test(H),d=W&&y.match(/Version\/(\d*\.\d*)/);d&&(d=Number(d[1])),d&&d>=15&&(W=!1,T=!0);var L=p&&(B||W&&(d==null||d<12.11)),F=z||D&&_>=9;function N(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var U=function(e,t){var n=e.className,r=N(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function A(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return A(e).appendChild(t)}function c(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}var be=function(){this.id=null,this.f=null,this.time=0,this.handler=ge(this.onTimeout,this)};be.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},be.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var pt=[""];function Tt(e){for(;pt.length<=e;)pt.push(Ce(pt)+" ");return pt[e]}function Ce(e){return e[e.length-1]}function De(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function jt(e,t){return t?t.source.indexOf("\\w")>-1&&at(e)?!0:t.test(e):at(e)}function In(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Yt=/[\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 je(e){return e.charCodeAt(0)>=768&&Yt.test(e)}function nr(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function ir(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var br=null;function or(e,t,n){var r;br=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:br=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:br=i)}return r??br}var gi=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(f){return f<=247?e.charAt(f):1424<=f&&f<=1524?"R":1536<=f&&f<=1785?t.charAt(f-1536):1774<=f&&f<=2220?"r":8192<=f&&f<=8203?"w":f==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(f,b,k){this.level=f,this.from=b,this.to=k}return function(f,b){var k=b=="ltr"?"L":"R";if(f.length==0||b=="ltr"&&!r.test(f))return!1;for(var E=f.length,P=[],q=0;q-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Re(e,t){var n=Zt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Dt(e){e.prototype.on=function(t,n){pe(this,t,n)},e.prototype.off=function(t,n){lt(this,t,n)}}function st(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Mr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function vt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ar(e){st(e),Mr(e)}function on(e){return e.target||e.srcElement}function Ft(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),p&&e.ctrlKey&&t==1&&(t=3),t}var mi=function(){if(D&&_<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e}(),Dr;function Hn(e){if(Dr==null){var t=c("span","​");G(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Dr=t.offsetWidth<=1&&t.offsetHeight>2&&!(D&&_<8))}var n=Dr?c("span","​"):c("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var an;function lr(e){if(an!=null)return an;var t=G(e,document.createTextNode("AخA")),n=j(t,0,1).getBoundingClientRect(),r=j(t,1,2).getBoundingClientRect();return A(e),!n||n.left==n.right?!1:an=r.right-n.right<3}var Pt=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` `,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},sr=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},zn=function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function yi(e){if(Et!=null)return Et;var t=G(e,c("span","x")),n=t.getBoundingClientRect(),r=j(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var Fr={},Wt={};function It(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Fr[e]=t}function xr(e,t){Wt[e]=t}function Er(e){if(typeof e=="string"&&Wt.hasOwnProperty(e))e=Wt[e];else if(e&&typeof e.name=="string"&&Wt.hasOwnProperty(e.name)){var t=Wt[e.name];typeof t=="string"&&(t={name:t}),e=X(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Er("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Er("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Wr(e,t){t=Er(t);var n=Fr[t.name];if(!n)return Wr(e,"text/plain");var r=n(e,t);if(ur.hasOwnProperty(t.name)){var i=ur[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var ur={};function Ir(e,t){var n=ur.hasOwnProperty(e)?ur[e]:ur[e]={};xe(t,n)}function _t(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function ln(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Br(e,t,n){return e.startState?e.startState(t,n):!0}var _e=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};_e.prototype.eol=function(){return this.pos>=this.string.length},_e.prototype.sol=function(){return this.pos==this.lineStart},_e.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},_e.prototype.next=function(){if(this.post},_e.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},_e.prototype.skipToEnd=function(){this.pos=this.string.length},_e.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},_e.prototype.backUp=function(e){this.pos-=e},_e.prototype.column=function(){return this.lastColumnPos0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},_e.prototype.current=function(){return this.string.slice(this.start,this.pos)},_e.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},_e.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},_e.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ue(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 n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?K(n,ue(e,n).text.length):El(t,ue(e,t.line).text.length)}function El(e,t){var n=e.ch;return n==null||n>t?K(e.line,t):n<0?K(e.line,0):e}function vo(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ut.fromSaved=function(e,t,n){return t instanceof Rn?new Ut(e,_t(e.mode,t.state),n,t.lookAhead):new Ut(e,_t(e.mode,t),n)},Ut.prototype.save=function(e){var t=e!==!1?_t(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Rn(t,this.maxLookAhead):t};function go(e,t,n,r){var i=[e.state.modeGen],o={};wo(e,t.text,e.doc.mode,n,function(f,b){return i.push(f,b)},o,r);for(var a=n.state,l=function(f){n.baseTokens=i;var b=e.state.overlays[f],k=1,E=0;n.state=!0,wo(e,t.text,b.mode,n,function(P,q){for(var J=k;EP&&i.splice(k,1,P,i[k+1],ee),k+=2,E=Math.min(P,ee)}if(q)if(b.opaque)i.splice(J,k-J,P,"overlay "+q),k=J+2;else for(;Je.options.maxHighlightLength&&_t(e.doc.mode,r.state),o=go(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function un(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Ut(r,!0,t);var o=Wl(e,t,n),a=o>r.first&&ue(r,o-1).stateAfter,l=a?Ut.fromSaved(r,a,o):new Ut(r,Br(r.mode),o);return r.iter(o,t,function(s){bi(e,s.text,l);var f=l.line;s.stateAfter=f==t-1||f%5==0||f>=i.viewFrom&&ft.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var bo=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function xo(e,t,n,r){var i=e.doc,o=i.mode,a;t=ye(i,t);var l=ue(i,t.line),s=un(e,t.line,n),f=new _e(l.text,e.options.tabSize,s),b;for(r&&(b=[]);(r||f.pose.options.maxHighlightLength?(l=!1,a&&bi(e,t,r,b.pos),b.pos=t.length,k=null):k=ko(xi(n,b,r.state,E),o),E){var P=E[0].name;P&&(k="m-"+(k?P+" "+k:P))}if(!l||f!=k){for(;sa;--l){if(l<=o.first)return o.first;var s=ue(o,l-1),f=s.stateAfter;if(f&&(!n||l+(f instanceof Rn?f.lookAhead:0)<=o.modeFrontier))return l;var b=Le(s.text,null,e.options.tabSize);(i==null||r>b)&&(i=l-1,r=b)}return i}function Il(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=ue(e,r).stateAfter;if(i&&(!(i instanceof Rn)||r+i.lookAhead=t:o.to>t);(r||(r=[])).push(new Kn(a,o.from,s?null:o.to))}}return r}function _l(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t);if(l||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var se=0;se0)){var b=[s,1],k=ae(f.from,l.from),E=ae(f.to,l.to);(k<0||!a.inclusiveLeft&&!k)&&b.push({from:f.from,to:l.from}),(E>0||!a.inclusiveRight&&!E)&&b.push({from:l.to,to:f.to}),i.splice.apply(i,b),s+=b.length-3}}return i}function Lo(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||wi(r,o.marker)<0)&&(r=o.marker)}return r}function No(e,t,n,r,i){var o=ue(e,t),a=Jt&&o.markedSpans;if(a)for(var l=0;l=0&&k<=0||b<=0&&k>=0)&&(b<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ae(f.to,n)>=0:ae(f.to,n)>0)||b>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ae(f.from,r)<=0:ae(f.from,r)<0)))return!0}}}function Bt(e){for(var t;t=Oo(e);)e=t.find(-1,!0).line;return e}function ql(e){for(var t;t=Gn(e);)e=t.find(1,!0).line;return e}function Xl(e){for(var t,n;t=Gn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Si(e,t){var n=ue(e,t),r=Bt(n);return n==r?t:h(r)}function Po(e,t){if(t>e.lastLine())return t;var n=ue(e,t),r;if(!fr(e,n))return t;for(;r=Gn(n);)n=r.find(1,!0).line;return h(n)+1}function fr(e,t){var n=Jt&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var zr=function(e,t,n){this.text=e,To(this,t),this.height=n?n(this):1};zr.prototype.lineNo=function(){return h(this)},Dt(zr);function jl(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Lo(e),To(e,n);var i=r?r(e):1;i!=e.height&&At(e,i)}function Yl(e){e.parent=null,Lo(e)}var Zl={},Ql={};function Mo(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ql:Zl;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Do(e,t){var n=Q("span",null,null,T?"padding-right: .1px":null),r={pre:Q("pre",[n],"CodeMirror-line"),content:n,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,a=void 0;r.pos=0,r.addToken=Vl,lr(e.display.measure)&&(a=Se(o,e.doc.direction))&&(r.addToken=es(r.addToken,a)),r.map=[];var l=t!=e.display.externalMeasured&&h(o);ts(o,r,mo(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=we(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=we(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Hn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(T){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=we(r.pre.className,r.textClass||"")),r}function Jl(e){var t=c("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Vl(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?$l(t,e.trailingSpace):t,s=e.cm.state.specialChars,f=!1,b;if(!s.test(t))e.col+=t.length,b=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,b),D&&_<9&&(f=!0),e.pos+=t.length;else{b=document.createDocumentFragment();for(var k=0;;){s.lastIndex=k;var E=s.exec(t),P=E?E.index-k:t.length-k;if(P){var q=document.createTextNode(l.slice(k,k+P));D&&_<9?b.appendChild(c("span",[q])):b.appendChild(q),e.map.push(e.pos,e.pos+P,q),e.col+=P,e.pos+=P}if(!E)break;k+=P+1;var J=void 0;if(E[0]==" "){var ee=e.cm.options.tabSize,ie=ee-e.col%ee;J=b.appendChild(c("span",Tt(ie),"cm-tab")),J.setAttribute("role","presentation"),J.setAttribute("cm-text"," "),e.col+=ie}else E[0]=="\r"||E[0]==` `?(J=b.appendChild(c("span",E[0]=="\r"?"␍":"␤","cm-invalidchar")),J.setAttribute("cm-text",E[0]),e.col+=1):(J=e.cm.options.specialCharPlaceholder(E[0]),J.setAttribute("cm-text",E[0]),D&&_<9?b.appendChild(c("span",[J])):b.appendChild(J),e.col+=1);e.map.push(e.pos,e.pos+1,J),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,n||r||i||f||o||a){var le=n||"";r&&(le+=r),i&&(le+=i);var oe=c("span",[b],le,o);if(a)for(var se in a)a.hasOwnProperty(se)&&se!="style"&&se!="class"&&oe.setAttribute(se,a[se]);return e.content.appendChild(oe)}e.content.appendChild(b)}}function $l(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;if&&k.from<=f));E++);if(k.to>=b)return e(n,r,i,o,a,l,s);e(n,r.slice(0,k.to-f),i,o,null,l,s),o=null,r=r.slice(k.to-f),f=k.to}}}function Fo(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function ts(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var a=1;as||ke.collapsed&&de.to==s&&de.from==s)){if(de.to!=null&&de.to!=s&&P>de.to&&(P=de.to,J=""),ke.className&&(q+=" "+ke.className),ke.css&&(E=(E?E+";":"")+ke.css),ke.startStyle&&de.from==s&&(ee+=" "+ke.startStyle),ke.endStyle&&de.to==P&&(se||(se=[])).push(ke.endStyle,de.to),ke.title&&((le||(le={})).title=ke.title),ke.attributes)for(var Fe in ke.attributes)(le||(le={}))[Fe]=ke.attributes[Fe];ke.collapsed&&(!ie||wi(ie.marker,ke)<0)&&(ie=de)}else de.from>s&&P>de.from&&(P=de.from)}if(se)for(var tt=0;tt=l)break;for(var Ct=Math.min(l,P);;){if(b){var bt=s+b.length;if(!ie){var Ye=bt>Ct?b.slice(0,Ct-s):b;t.addToken(t,Ye,k?k+q:q,ee,s+Ye.length==P?J:"",E,le)}if(bt>=Ct){b=b.slice(Ct-s),s=Ct;break}s=bt,ee=""}b=i.slice(o,o=n[f++]),k=Mo(n[f++],t.cm.options)}}}function Eo(e,t,n){this.line=t,this.rest=Xl(t),this.size=this.rest?h(Ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=fr(e,t)}function Xn(e,t,n){for(var r=[],i,o=t;o2&&o.push((s.bottom+f.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ko(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function hs(e,t){t=Bt(t);var n=h(t),r=e.display.externalMeasured=new Eo(e.doc,t,n);r.lineN=n;var i=r.built=Do(e,r);return r.text=i.pre,G(e.display.lineMeasure,i.pre),r}function _o(e,t,n,r){return qt(e,Kr(e,t),n,r)}function Ni(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(o=s-l,i=o-1,t>=s&&(a="right")),i!=null){if(r=e[f+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),n=="left"&&i==0)for(;f&&e[f-2]==e[f-3]&&e[f-1].insertLeft;)r=e[(f-=3)+2],a="left";if(n=="right"&&i==s-l)for(;f=0&&(n=e[i]).left==n.right;i--);return n}function ps(e,t,n,r){var i=Go(t.map,n,r),o=i.node,a=i.start,l=i.end,s=i.collapse,f;if(o.nodeType==3){for(var b=0;b<4;b++){for(;a&&je(t.line.text.charAt(i.coverStart+a));)--a;for(;i.coverStart+l0&&(s=r="right");var k;e.options.lineWrapping&&(k=o.getClientRects()).length>1?f=k[r=="right"?k.length-1:0]:f=o.getBoundingClientRect()}if(D&&_<9&&!a&&(!f||!f.left&&!f.right)){var E=o.parentNode.getClientRects()[0];E?f={left:E.left,right:E.left+Ur(e.display),top:E.top,bottom:E.bottom}:f=Uo}for(var P=f.top-t.rect.top,q=f.bottom-t.rect.top,J=(P+q)/2,ee=t.view.measure.heights,ie=0;ie=r.text.length?(s=r.text.length,f="before"):s<=0&&(s=0,f="after"),!l)return a(f=="before"?s-1:s,f=="before");function b(q,J,ee){var ie=l[J],le=ie.level==1;return a(ee?q-1:q,le!=ee)}var k=or(l,s,f),E=br,P=b(s,k,f=="before");return E!=null&&(P.other=b(s,E,f!="before")),P}function Qo(e,t){var n=0;t=ye(e.doc,t),e.options.lineWrapping||(n=Ur(e.display)*t.ch);var r=ue(e.doc,t.line),i=Vt(r)+jn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Mi(e,t,n,r,i){var o=K(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Di(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Mi(r.first,0,null,-1,-1);var i=x(r,n),o=r.first+r.size-1;if(i>o)return Mi(r.first+r.size-1,ue(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=ue(r,i);;){var l=gs(e,a,i,t,n),s=Gl(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var f=s.find(1);if(f.line==i)return f;a=ue(r,i=f.line)}}function Jo(e,t,n,r){r-=Pi(t);var i=t.text.length,o=Kt(function(a){return qt(e,n,a-1).bottom<=r},i,0);return i=Kt(function(a){return qt(e,n,a).top>r},o,i),{begin:o,end:i}}function Vo(e,t,n,r){n||(n=Kr(e,t));var i=Yn(e,t,qt(e,n,r),"line").top;return Jo(e,t,n,i)}function Fi(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function gs(e,t,n,r,i){i-=Vt(t);var o=Kr(e,t),a=Pi(t),l=0,s=t.text.length,f=!0,b=Se(t,e.doc.direction);if(b){var k=(e.options.lineWrapping?ys:ms)(e,t,n,o,b,r,i);f=k.level!=1,l=f?k.from:k.to-1,s=f?k.to:k.from-1}var E=null,P=null,q=Kt(function(ve){var de=qt(e,o,ve);return de.top+=a,de.bottom+=a,Fi(de,r,i,!1)?(de.top<=i&&de.left<=r&&(E=ve,P=de),!0):!1},l,s),J,ee,ie=!1;if(P){var le=r-P.left=se.bottom?1:0}return q=nr(t.text,q,1),Mi(n,q,ee,ie,r-J)}function ms(e,t,n,r,i,o,a){var l=Kt(function(k){var E=i[k],P=E.level!=1;return Fi(Ht(e,K(n,P?E.to:E.from,P?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var f=s.level!=1,b=Ht(e,K(n,f?s.from:s.to,f?"after":"before"),"line",t,r);Fi(b,o,a,!0)&&b.top>a&&(s=i[l-1])}return s}function ys(e,t,n,r,i,o,a){var l=Jo(e,t,r,a),s=l.begin,f=l.end;/\s/.test(t.text.charAt(f-1))&&f--;for(var b=null,k=null,E=0;E=f||P.to<=s)){var q=P.level!=1,J=qt(e,r,q?Math.min(f,P.to)-1:Math.max(s,P.from)).right,ee=Jee)&&(b=P,k=ee)}}return b||(b=i[i.length-1]),b.fromf&&(b={from:b.from,to:f,level:b.level}),b}var wr;function _r(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(wr==null){wr=c("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)wr.appendChild(document.createTextNode("x")),wr.appendChild(c("br"));wr.appendChild(document.createTextNode("x"))}G(e.measure,wr);var n=wr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),A(e.measure),n||1}function Ur(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=c("span","xxxxxxxxxx"),n=c("pre",[t],"CodeMirror-line-like");G(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ei(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:Wi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Wi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function $o(e){var t=_r(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Ur(e.display)-3);return function(i){if(fr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(f=ue(e.doc,s.line).text).length==s.ch){var b=Le(f,f.length,e.options.tabSize)-f.length;s=K(s.line,Math.max(0,Math.round((o-Ro(e.display).left)/Ur(e.display))-b))}return s}function Cr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Jt&&Si(e.doc,t)i.viewFrom?hr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)hr(e);else if(t<=i.viewFrom){var o=Qn(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):hr(e)}else if(n>=i.viewTo){var a=Qn(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):hr(e)}else{var l=Qn(e,t,t,-1),s=Qn(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Xn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):hr(e)}var f=i.externalMeasured;f&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Cr(e,t)];if(o.node!=null){var a=o.changes||(o.changes=[]);he(a,n)==-1&&a.push(n)}}}function hr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Qn(e,t,n,r){var i=Cr(e,t),o,a=e.display.view;if(!Jt||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(i==a.length-1)return null;o=l+a[i].size-t,i++}else o=l-t;t+=o,n+=o}for(;Si(e.doc,n)!=n;){if(i==(r<0?0:a.length-1))return null;n+=r*a[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function bs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Xn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Xn(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Cr(e,n)))),r.viewTo=n}function ea(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||s.to().line0?a:e.defaultCharWidth())+"px"}if(r.other){var l=n.appendChild(c("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Jn(e,t){return e.top-t.top||e.left-t.left}function xs(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=Ro(e.display),l=a.left,s=Math.max(r.sizerWidth,kr(e)-r.sizer.offsetLeft)-a.right,f=i.direction=="ltr";function b(oe,se,ve,de){se<0&&(se=0),se=Math.round(se),de=Math.round(de),o.appendChild(c("div",null,"CodeMirror-selected","position: absolute; left: "+oe+`px; top: `+se+"px; width: "+(ve??s-oe)+`px; height: `+(de-se)+"px"))}function k(oe,se,ve){var de=ue(i,oe),ke=de.text.length,Fe,tt;function ze(Ye,xt){return Zn(e,K(oe,Ye),"div",de,xt)}function Ct(Ye,xt,ot){var Qe=Vo(e,de,null,Ye),Ze=xt=="ltr"==(ot=="after")?"left":"right",Ue=ot=="after"?Qe.begin:Qe.end-(/\s/.test(de.text.charAt(Qe.end-1))?2:1);return ze(Ue,Ze)[Ze]}var bt=Se(de,i.direction);return ir(bt,se||0,ve??ke,function(Ye,xt,ot,Qe){var Ze=ot=="ltr",Ue=ze(Ye,Ze?"left":"right"),kt=ze(xt-1,Ze?"right":"left"),rn=se==null&&Ye==0,yr=ve==null&&xt==ke,ft=Qe==0,Xt=!bt||Qe==bt.length-1;if(kt.top-Ue.top<=3){var rt=(f?rn:yr)&&ft,fo=(f?yr:rn)&&Xt,rr=rt?l:(Ze?Ue:kt).left,Nr=fo?s:(Ze?kt:Ue).right;b(rr,Ue.top,Nr-rr,Ue.bottom)}else{var Pr,ht,nn,co;Ze?(Pr=f&&rn&&ft?l:Ue.left,ht=f?s:Ct(Ye,ot,"before"),nn=f?l:Ct(xt,ot,"after"),co=f&&yr&&Xt?s:kt.right):(Pr=f?Ct(Ye,ot,"before"):l,ht=!f&&rn&&ft?s:Ue.right,nn=!f&&yr&&Xt?l:kt.left,co=f?Ct(xt,ot,"after"):s),b(Pr,Ue.top,ht-Pr,Ue.bottom),Ue.bottom0?t.blinker=setInterval(function(){e.hasFocus()||Gr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ra(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ri(e))}function zi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Gr(e))},100)}function Ri(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,ce(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),T&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Hi(e))}function Gr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,U(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Vn(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,a=0;a.005||P<-.005)&&(ie.display.sizerWidth){var J=Math.ceil(b/Ur(e.display));J>e.display.maxLineLength&&(e.display.maxLineLength=J,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function na(e){if(e.widgets)for(var t=0;t=a&&(o=x(t,Vt(ue(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function ks(e,t){if(!Ke(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),i!=null&&!S){var a=c("div","​",null,`position: absolute; top: `+(t.top-n.viewOffset-jn(e.display))+`px; height: `+(t.bottom-t.top+Gt(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}function ws(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?K(t.line,t.ch+1,"before"):t,t=t.ch?K(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=Ht(e,t),s=!n||n==t?l:Ht(e,n);i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r};var f=Ki(e,i),b=e.doc.scrollTop,k=e.doc.scrollLeft;if(f.scrollTop!=null&&(mn(e,f.scrollTop),Math.abs(e.doc.scrollTop-b)>1&&(a=!0)),f.scrollLeft!=null&&(Lr(e,f.scrollLeft),Math.abs(e.doc.scrollLeft-k)>1&&(a=!0)),!a)break}return i}function Ss(e,t){var n=Ki(e,t);n.scrollTop!=null&&mn(e,n.scrollTop),n.scrollLeft!=null&&Lr(e,n.scrollLeft)}function Ki(e,t){var n=e.display,r=_r(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Oi(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ai(n),s=t.topl-r;if(t.topi+o){var b=Math.min(t.top,(f?l:t.bottom)-o);b!=i&&(a.scrollTop=b)}var k=e.options.fixedGutter?0:n.gutters.offsetWidth,E=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-k,P=kr(e)-n.gutters.offsetWidth,q=t.right-t.left>P;return q&&(t.right=t.left+P),t.left<10?a.scrollLeft=0:t.leftP+E-3&&(a.scrollLeft=t.right+(q?0:10)-P),a}function _i(e,t){t!=null&&(ei(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function qr(e){ei(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function gn(e,t,n){(t!=null||n!=null)&&ei(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Cs(e,t){ei(e),e.curOp.scrollToPos=t}function ei(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Qo(e,t.from),r=Qo(e,t.to);ia(e,n,r,t.margin)}}function ia(e,t,n,r){var i=Ki(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});gn(e,i.scrollLeft,i.scrollTop)}function mn(e,t){Math.abs(e.doc.scrollTop-t)<2||(z||Gi(e,{top:t}),oa(e,t,!0),z&&Gi(e),xn(e,100))}function oa(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Lr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,fa(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function yn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ai(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?n:0,docHeight:r,scrollHeight:r+Gt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Tr=function(e,t,n){this.cm=n;var r=this.vert=c("div",[c("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=c("div",[c("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),pe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),pe(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,D&&_<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Tr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r: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&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Tr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Tr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Tr.prototype.zeroWidthHack=function(){var e=p&&!O?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new be,this.disableVert=new be},Tr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),o=n=="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.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Tr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var bn=function(){};bn.prototype.update=function(){return{bottom:0,right:0}},bn.prototype.setScrollLeft=function(){},bn.prototype.setScrollTop=function(){},bn.prototype.clear=function(){};function Xr(e,t){t||(t=yn(e));var n=e.display.barWidth,r=e.display.barHeight;aa(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),aa(e,yn(e)),n=e.display.barWidth,r=e.display.barHeight}function aa(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var la={native:Tr,null:bn};function sa(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new la[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),pe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Lr(e,t):mn(e,t)},e),e.display.scrollbars.addClass&&ce(e.display.wrapper,e.display.scrollbars.addClass)}var Ls=0;function Ar(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:++Ls,markArrays:null},rs(e.curOp)}function Or(e){var t=e.curOp;t&&is(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ti(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Os(e){e.updatedDisplay=e.mustUpdate&&Ui(e.cm,e.update)}function Ns(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=yn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=_o(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Gt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-kr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Ps(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=un(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?_t(t.mode,r.state):null,s=go(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var f=o.styleClasses,b=s.classes;b?o.styleClasses=b:f&&(o.styleClasses=null);for(var k=!a||a.length!=o.styles.length||f!=b&&(!f||!b||f.bgClass!=b.bgClass||f.textClass!=b.textClass),E=0;!k&&En)return xn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&St(e,function(){for(var o=0;o=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&ea(e)==0)return!1;ca(e)&&(hr(e),t.dims=Ei(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Jt&&(o=Si(e.doc,o),a=Po(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;bs(e,o,a),n.viewOffset=Vt(ue(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=ea(e);if(!l&&s==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=Es(e);return s>4&&(n.lineDiv.style.display="none"),Is(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ws(f),A(n.cursorDiv),A(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,xn(e,400)),n.updateLineNumbers=null,!0}function ua(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==kr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Ai(e.display)-Oi(e),n.top)}),t.visible=$n(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=$n(e.display,e.doc,n));if(!Ui(e,t))break;Vn(e);var i=yn(e);vn(e),Xr(e,i),Xi(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 Gi(e,t){var n=new ti(e,t);if(Ui(e,n)){Vn(e),ua(e,n);var r=yn(e);vn(e),Xr(e,r),Xi(e,r),n.finish()}}function Is(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(q){var J=q.nextSibling;return T&&p&&e.display.currentWheelTarget==q?q.style.display="none":q.parentNode.removeChild(q),J}for(var s=r.view,f=r.viewFrom,b=0;b-1&&(P=!1),Wo(e,k,f,n)),P&&(A(k.lineNumber),k.lineNumber.appendChild(document.createTextNode($(e.options,f)))),a=k.node.nextSibling}f+=k.size}for(;a;)a=l(a)}function qi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Ve(e,"gutterChanged",e)}function Xi(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+Gt(e)+"px"}function fa(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Wi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),D&&_<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!T&&!(z&&u)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ji(r.gutters,r.lineNumbers),ha(i),n.init(i)}var ri=0,er=null;D?er=-.53:z?er=15:C?er=-.7:Z&&(er=-1/3);function da(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function Hs(e){var t=da(e);return t.x*=er,t.y*=er,t}function pa(e,t){C&&M==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=da(t),r=n.x,i=n.y,o=er;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var a=e.display,l=a.scroller,s=l.scrollWidth>l.clientWidth,f=l.scrollHeight>l.clientHeight;if(r&&s||i&&f){if(i&&p&&T){e:for(var b=t.target,k=a.view;b!=l;b=b.parentNode)for(var E=0;E=0&&ae(e,r.to())<=0)return n}return-1};var Ne=function(e,t){this.anchor=e,this.head=t};Ne.prototype.from=function(){return Hr(this.anchor,this.head)},Ne.prototype.to=function(){return gt(this.anchor,this.head)},Ne.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function zt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(E,P){return ae(E.from(),P.from())}),n=he(t,i);for(var o=1;o0:s>=0){var f=Hr(l.from(),a.from()),b=gt(l.to(),a.to()),k=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new Ne(k?b:f,k?f:b))}}return new Ot(t,n)}function dr(e,t){return new Ot([new Ne(e,t||e)],0)}function pr(e){return e.text?K(e.from.line+e.text.length-1,Ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function va(e,t){if(ae(e,t.from)<0)return e;if(ae(e,t.to)<=0)return pr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=pr(t).ch-t.to.ch),K(n,r)}function Yi(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,q-1),e.insert(l.line+1,ie)}Ve(e,"change",e,t)}function vr(e,t,n){function r(i,o,a){if(i.linked)for(var l=0;l1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ce(e.done)}function ka(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,a,l;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(a=Ks(i,i.lastOp==r)))l=Ce(a.changes),ae(t.from,t.to)==0&&ae(t.from,l.to)==0?l.to=pr(t):a.changes.push(Ji(e,t));else{var s=Ce(i.done);for((!s||!s.ranges)&&ii(e.sel,i.done),a={changes:[Ji(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Re(e,"historyAdded")}function _s(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Us(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||_s(e,o,Ce(i.done),t))?i.done[i.done.length-1]=t:ii(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&xa(i.undone)}function ii(e,t){var n=Ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function wa(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(a){a.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=a.markedSpans),++o})}function Gs(e){if(!e)return null;for(var t,n=0;n-1&&(Ce(l)[k]=f[k],delete f[k])}}return r}function Vi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ae(t,i)<0;o!=ae(n,i)<0?(i=t,t=n):o!=ae(t,n)<0&&(t=n)}return new Ne(i,t)}else return new Ne(n||t,t)}function oi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ut(e,new Ot([Vi(e.sel.primary(),t,n,i)],0),r)}function Ca(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(Re(s,"beforeCursorEnter"),s.explicitlyCleared))if(o.markedSpans){--a;continue}else break;if(!s.atomic)continue;if(n){var k=s.find(r<0?1:-1),E=void 0;if((r<0?b:f)&&(k=Pa(e,k,-r,k&&k.line==t.line?o:null)),k&&k.line==t.line&&(E=ae(k,n))&&(r<0?E<0:E>0))return Yr(e,k,t,r,i)}var P=s.find(r<0?-1:1);return(r<0?f:b)&&(P=Pa(e,P,r,P.line==t.line?o:null)),P?Yr(e,P,t,r,i):null}}return t}function li(e,t,n,r,i){var o=r||1,a=Yr(e,t,n,o,i)||!i&&Yr(e,t,n,o,!0)||Yr(e,t,n,-o,i)||!i&&Yr(e,t,n,-o,!0);return a||(e.cantEdit=!0,K(e.first,0))}function Pa(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ye(e,K(t.line-1)):null:n>0&&t.ch==(r||ue(e,t.line)).text.length?t.line=0;--i)Fa(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Fa(e,t)}}function Fa(e,t){if(!(t.text.length==1&&t.text[0]==""&&ae(t.from,t.to)==0)){var n=Yi(e,t);ka(e,t,n,e.cm?e.cm.curOp.id:NaN),Sn(e,t,n,ki(e,t));var r=[];vr(e,function(i,o){!o&&he(r,i.history)==-1&&(Ba(i.history,t),r.push(i.history)),Sn(i,t,null,ki(i,t))})}}function si(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,a=e.sel,l=t=="undo"?i.done:i.undone,s=t=="undo"?i.undone:i.done,f=0;f=0;--P){var q=E(P);if(q)return q.v}}}}function Ea(e,t){if(t!=0&&(e.first+=t,e.sel=new Ot(De(e.sel.ranges,function(i){return new Ne(K(i.anchor.line+t,i.anchor.ch),K(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){mt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:K(o,ue(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Qt(e,t.from,t.to),n||(n=Yi(e,t)),e.cm?js(e.cm,t,r):Qi(e,t,r),ai(e,n,dt),e.cantEdit&&li(e,K(e.firstLine(),0))&&(e.cantEdit=!1)}}function js(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=h(Bt(ue(r,o.line))),r.iter(s,a.line+1,function(P){if(P==i.maxLine)return l=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Nt(e),Qi(r,t,n,$o(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(P){var q=qn(P);q>i.maxLineLength&&(i.maxLine=P,i.maxLineLength=q,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),Il(r,o.line),xn(e,400);var f=t.text.length-(a.line-o.line)-1;t.full?mt(e):o.line==a.line&&t.text.length==1&&!ma(e.doc,t)?cr(e,o.line,"text"):mt(e,o.line,a.line+1,f);var b=wt(e,"changes"),k=wt(e,"change");if(k||b){var E={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};k&&Ve(e,"change",e,E),b&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(E)}e.display.selForContextMenu=null}function Qr(e,t,n,r,i){var o;r||(r=n),ae(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),Zr(e,{from:n,to:r,text:t,origin:i})}function Wa(e,t,n,r){n1||!(this.children[0]instanceof Ln))){var l=[];this.collapse(l),this.children=[new Ln(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=f,e.display.maxLineLength=b,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&mt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Oa(e.doc)),e&&Ve(e,"markerCleared",e,this,r,i),t&&Or(e),this.parent&&this.parent.clear()}},gr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||a==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Q("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(No(e,t.line,t,n,o)||t.line!=n.line&&No(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Hl()}o.addToHistory&&ka(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,f;if(e.iter(l,n.line+1,function(k){s&&o.collapsed&&!s.options.lineWrapping&&Bt(k)==s.display.maxLine&&(f=!0),o.collapsed&&l!=t.line&&At(k,0),Rl(k,new Kn(o,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(k){fr(e,k)&&At(k,0)}),o.clearOnEnter&&pe(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Bl(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++za,o.atomic=!0),s){if(f&&(s.curOp.updateMaxLine=!0),o.collapsed)mt(s,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var b=t.line;b<=n.line;b++)cr(s,b,"text");o.atomic&&Oa(s.doc),Ve(s,"markerAdded",s,o)}return o}var On=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;s--)Zr(this,r[s]);l?Ta(this,l):this.cm&&qr(this.cm)}),undo:et(function(){si(this,"undo")}),redo:et(function(){si(this,"redo")}),undoSelection:et(function(){si(this,"undo",!0)}),redoSelection:et(function(){si(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ye(this,e),t=ye(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||s.from==null&&i!=e.line||s.from!=null&&i==t.line&&s.from>=t.ch)&&(!n||n(s.marker))&&r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),ye(this,K(n,t))},indexFromPos:function(e){e=ye(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 b=e.dataTransfer.getData("Text");if(b){var k;if(t.state.draggingText&&!t.state.draggingText.copy&&(k=t.listSelections()),ai(t.doc,dr(n,n)),k)for(var E=0;E=0;l--)Qr(e.doc,"",r[l].from,r[l].to,"+delete");qr(e)})}function eo(e,t,n){var r=nr(e.text,t+n,n);return r<0||r>e.text.length?null:r}function to(e,t,n){var r=eo(e,t.ch,n);return r==null?null:new K(t.line,r,n<0?"after":"before")}function ro(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=Se(n,t.doc.direction);if(o){var a=i<0?Ce(o):o[0],l=i<0==(a.level==1),s=l?"after":"before",f;if(a.level>0||t.doc.direction=="rtl"){var b=Kr(t,n);f=i<0?n.text.length-1:0;var k=qt(t,b,f).top;f=Kt(function(E){return qt(t,b,E).top==k},i<0==(a.level==1)?a.from:a.to-1,f),s=="before"&&(f=eo(n,f,1))}else f=i<0?a.to:a.from;return new K(r,f,s)}}return new K(r,i<0?n.text.length:0,i<0?"before":"after")}function lu(e,t,n,r){var i=Se(t,e.doc.direction);if(!i)return to(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=or(i,n.ch,n.sticky),a=i[o];if(e.doc.direction=="ltr"&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&E>=b.begin)){var P=k?"before":"after";return new K(n.line,E,P)}}var q=function(ie,le,oe){for(var se=function(Fe,tt){return tt?new K(n.line,l(Fe,1),"before"):new K(n.line,Fe,"after")};ie>=0&&ie0==(ve.level!=1),ke=de?oe.begin:l(oe.end,-1);if(ve.from<=ke&&ke0?b.end:l(b.begin,-1);return ee!=null&&!(r>0&&ee==t.text.length)&&(J=q(r>0?0:i.length-1,r,f(ee)),J)?J:null}var Mn={selectAll:Ma,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),dt)},killLine:function(e){return $r(e,function(t){if(t.empty()){var n=ue(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new K(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),K(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=ue(e.doc,i.line-1).text;a&&(i=new K(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),K(i.line-1,a.length-1),i,"+transpose"))}}n.push(new Ne(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&ae(t,this.pos)==0&&n==this.button};var Fn,En;function pu(e,t){var n=+new Date;return En&&En.compare(n,e,t)?(Fn=En=null,"triple"):Fn&&Fn.compare(n,e,t)?(En=new io(n,e,t),Fn=null,"double"):(Fn=new io(n,e,t),En=null,"single")}function tl(e){var t=this,n=t.display;if(!(Ke(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,$t(n,e)){T||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!oo(t,e)){var r=Sr(t,e),i=Ft(e),o=r?pu(r,i):"single";me(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&vu(t,i,r,o,e))&&(i==1?r?mu(t,r,o,e):on(e)==n.scroller&&st(e):i==2?(r&&oi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(F?t.display.input.onContextMenu(e):zi(t)))}}}function vu(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,Dn(e,Xa(o,i),i,function(a){if(typeof a=="string"&&(a=Mn[a]),!a)return!1;var l=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),l=a(e,n)!=Mt}finally{e.state.suppressEdits=!1}return l})}function gu(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=m?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=p?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(p?n.altKey:n.ctrlKey)),i}function mu(e,t,n,r){D?setTimeout(ge(ra,e),0):e.curOp.focus=fe(Ge(e));var i=gu(e,n,r),o=e.doc.sel,a;e.options.dragDrop&&mi&&!e.isReadOnly()&&n=="single"&&(a=o.contains(t))>-1&&(ae((a=o.ranges[a]).from(),t)<0||t.xRel>0)&&(ae(a.to(),t)>0||t.xRel<0)?yu(e,r,t,i):bu(e,r,t,i)}function yu(e,t,n,r){var i=e.display,o=!1,a=$e(e,function(f){T&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:zi(e)),lt(i.wrapper.ownerDocument,"mouseup",a),lt(i.wrapper.ownerDocument,"mousemove",l),lt(i.scroller,"dragstart",s),lt(i.scroller,"drop",a),o||(st(f),r.addNew||oi(e.doc,n,null,null,r.extend),T&&!Z||D&&_==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),l=function(f){o=o||Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)>=10},s=function(){return o=!0};T&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=!r.moveOnDrag,pe(i.wrapper.ownerDocument,"mouseup",a),pe(i.wrapper.ownerDocument,"mousemove",l),pe(i.scroller,"dragstart",s),pe(i.scroller,"drop",a),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function rl(e,t,n){if(n=="char")return new Ne(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ne(K(t.line,0),ye(e.doc,K(t.line+1,0)));var r=n(e,t);return new Ne(r.from,r.to)}function bu(e,t,n,r){D&&zi(e);var i=e.display,o=e.doc;st(t);var a,l,s=o.sel,f=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),l>-1?a=f[l]:a=new Ne(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),r.unit=="rectangle")r.addNew||(a=new Ne(n,n)),n=Sr(e,t,!0,!0),l=-1;else{var b=rl(e,n,r.unit);r.extend?a=Vi(a,b.anchor,b.head,r.extend):a=b}r.addNew?l==-1?(l=f.length,ut(o,zt(e,f.concat([a]),l),{scroll:!1,origin:"*mouse"})):f.length>1&&f[l].empty()&&r.unit=="char"&&!r.extend?(ut(o,zt(e,f.slice(0,l).concat(f.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):$i(o,l,a,Lt):(l=0,ut(o,new Ot([a],0),Lt),s=o.sel);var k=n;function E(oe){if(ae(k,oe)!=0)if(k=oe,r.unit=="rectangle"){for(var se=[],ve=e.options.tabSize,de=Le(ue(o,n.line).text,n.ch,ve),ke=Le(ue(o,oe.line).text,oe.ch,ve),Fe=Math.min(de,ke),tt=Math.max(de,ke),ze=Math.min(n.line,oe.line),Ct=Math.min(e.lastLine(),Math.max(n.line,oe.line));ze<=Ct;ze++){var bt=ue(o,ze).text,Ye=Xe(bt,Fe,ve);Fe==tt?se.push(new Ne(K(ze,Ye),K(ze,Ye))):bt.length>Ye&&se.push(new Ne(K(ze,Ye),K(ze,Xe(bt,tt,ve))))}se.length||se.push(new Ne(n,n)),ut(o,zt(e,s.ranges.slice(0,l).concat(se),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(oe)}else{var xt=a,ot=rl(e,oe,r.unit),Qe=xt.anchor,Ze;ae(ot.anchor,Qe)>0?(Ze=ot.head,Qe=Hr(xt.from(),ot.anchor)):(Ze=ot.anchor,Qe=gt(xt.to(),ot.head));var Ue=s.ranges.slice(0);Ue[l]=xu(e,new Ne(ye(o,Qe),Ze)),ut(o,zt(e,Ue,l),Lt)}}var P=i.wrapper.getBoundingClientRect(),q=0;function J(oe){var se=++q,ve=Sr(e,oe,!0,r.unit=="rectangle");if(ve)if(ae(ve,k)!=0){e.curOp.focus=fe(Ge(e)),E(ve);var de=$n(i,o);(ve.line>=de.to||ve.lineP.bottom?20:0;ke&&setTimeout($e(e,function(){q==se&&(i.scroller.scrollTop+=ke,J(oe))}),50)}}function ee(oe){e.state.selectingText=!1,q=1/0,oe&&(st(oe),i.input.focus()),lt(i.wrapper.ownerDocument,"mousemove",ie),lt(i.wrapper.ownerDocument,"mouseup",le),o.history.lastSelOrigin=null}var ie=$e(e,function(oe){oe.buttons===0||!Ft(oe)?ee(oe):J(oe)}),le=$e(e,ee);e.state.selectingText=le,pe(i.wrapper.ownerDocument,"mousemove",ie),pe(i.wrapper.ownerDocument,"mouseup",le)}function xu(e,t){var n=t.anchor,r=t.head,i=ue(e.doc,n.line);if(ae(n,r)==0&&n.sticky==r.sticky)return t;var o=Se(i);if(!o)return t;var a=or(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s=a+(l.from==n.ch==(l.level!=1)?0:1);if(s==0||s==o.length)return t;var f;if(r.line!=n.line)f=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var b=or(o,r.ch,r.sticky),k=b-a||(r.ch-n.ch)*(l.level==1?-1:1);b==s-1||b==s?f=k<0:f=k>0}var E=o[s+(f?-1:0)],P=f==(E.level==1),q=P?E.from:E.to,J=P?"after":"before";return n.ch==q&&n.sticky==J?t:new Ne(new K(n.line,q,J),r)}function nl(e,t,n,r){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;r&&st(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!wt(e,n))return vt(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var b=x(e.doc,o),k=e.display.gutterSpecs[s];return Re(e,n,e,b,k.className,t),vt(t)}}}function oo(e,t){return nl(e,t,"gutterClick",!0)}function il(e,t){$t(e.display,t)||ku(e,t)||Ke(e,t,"contextmenu")||F||e.display.input.onContextMenu(t)}function ku(e,t){return wt(e,"gutterContextMenu")?nl(e,t,"gutterContextMenu",!1):!1}function ol(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pn(e)}var en={toString:function(){return"CodeMirror.Init"}},al={},hi={};function wu(e){var t=e.optionHandlers;function n(r,i,o,a){e.defaults[r]=i,o&&(t[r]=a?function(l,s,f){f!=en&&o(l,s,f)}:o)}e.defineOption=n,e.Init=en,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Zi(r)},!0),n("indentUnit",2,Zi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wn(r),pn(r),mt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],a=r.doc.first;r.doc.iter(function(s){for(var f=0;;){var b=s.text.indexOf(i,f);if(b==-1)break;f=b+i.length,o.push(K(a,b))}a++});for(var l=o.length-1;l>=0;l--)Qr(r.doc,i,o[l],K(o[l].line,o[l].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=en&&r.refresh()}),n("specialCharPlaceholder",Jl,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",u?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ol(r),kn(r)},!0),n("keyMap","default",function(r,i,o){var a=fi(i),l=o!=en&&fi(o);l&&l.detach&&l.detach(r,a),a.attach&&a.attach(r,l||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Cu,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ji(i,r.options.lineNumbers),kn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Wi(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Xr(r)},!0),n("scrollbarStyle","native",function(r){sa(r),Xr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ji(r.options.gutters,i),kn(r)},!0),n("firstLineNumber",1,kn,!0),n("lineNumberFormatter",function(r){return r},kn,!0),n("showCursorWhenSelecting",!1,vn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Gr(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Su),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vn,!0),n("singleCursorHeightPerLine",!0,vn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wn,!0),n("addModeClass",!1,wn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Su(e,t,n){var r=n&&n!=en;if(!t!=!r){var i=e.display.dragFunctions,o=t?pe:lt;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 Cu(e){e.options.lineWrapping?(ce(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(U(e.display.wrapper,"CodeMirror-wrap"),Li(e)),Ii(e),mt(e),pn(e),setTimeout(function(){return Xr(e)},100)}function He(e,t){var n=this;if(!(this instanceof He))return new He(e,t);this.options=t=t?xe(t):{},xe(al,t,!1);var r=t.value;typeof r=="string"?r=new yt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new He.inputStyles[t.inputStyle](this),o=this.display=new Bs(e,r,i,t);o.wrapper.CodeMirror=this,ol(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),sa(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 be,keySeq:null,specialChars:null},t.autofocus&&!u&&o.input.focus(),D&&_<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Lu(this),ru(),Ar(this),this.curOp.forceUpdate=!0,ya(this,r),t.autofocus&&!u||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ri(n)},20):Gr(this);for(var a in hi)hi.hasOwnProperty(a)&&hi[a](this,t[a],en);ca(this),t.finishInit&&t.finishInit(this);for(var l=0;l20*20}pe(t.scroller,"touchstart",function(s){if(!Ke(e,s)&&!o(s)&&!oo(e,s)){t.input.ensurePolled(),clearTimeout(n);var f=+new Date;t.activeTouch={start:f,moved:!1,prev:f-r.end<=300?r:null},s.touches.length==1&&(t.activeTouch.left=s.touches[0].pageX,t.activeTouch.top=s.touches[0].pageY)}}),pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),pe(t.scroller,"touchend",function(s){var f=t.activeTouch;if(f&&!$t(t,s)&&f.left!=null&&!f.moved&&new Date-f.start<300){var b=e.coordsChar(t.activeTouch,"page"),k;!f.prev||a(f,f.prev)?k=new Ne(b,b):!f.prev.prev||a(f,f.prev.prev)?k=e.findWordAt(b):k=new Ne(K(b.line,0),ye(e.doc,K(b.line+1,0))),e.setSelection(k.anchor,k.head),e.focus(),st(s)}i()}),pe(t.scroller,"touchcancel",i),pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(mn(e,t.scroller.scrollTop),Lr(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),pe(t.scroller,"mousewheel",function(s){return pa(e,s)}),pe(t.scroller,"DOMMouseScroll",function(s){return pa(e,s)}),pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(s){Ke(e,s)||ar(s)},over:function(s){Ke(e,s)||(tu(e,s),ar(s))},start:function(s){return eu(e,s)},drop:$e(e,$s),leave:function(s){Ke(e,s)||_a(e)}};var l=t.input.getField();pe(l,"keyup",function(s){return $a.call(e,s)}),pe(l,"keydown",$e(e,Va)),pe(l,"keypress",$e(e,el)),pe(l,"focus",function(s){return Ri(e,s)}),pe(l,"blur",function(s){return Gr(e,s)})}var ao=[];He.defineInitHook=function(e){return ao.push(e)};function Wn(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=un(e,t).state:n="prev");var a=e.options.tabSize,l=ue(i,t),s=Le(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var f=l.text.match(/^\s*/)[0],b;if(!r&&!/\S/.test(l.text))b=0,n="not";else if(n=="smart"&&(b=i.mode.indent(o,l.text.slice(f.length),l.text),b==Mt||b>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?b=Le(ue(i,t-1).text,null,a):b=0:n=="add"?b=s+e.options.indentUnit:n=="subtract"?b=s-e.options.indentUnit:typeof n=="number"&&(b=s+n),b=Math.max(0,b);var k="",E=0;if(e.options.indentWithTabs)for(var P=Math.floor(b/a);P;--P)E+=a,k+=" ";if(Ea,s=Pt(t),f=null;if(l&&r.ranges.length>1)if(Rt&&Rt.text.join(` `)==t){if(r.ranges.length%Rt.text.length==0){f=[];for(var b=0;b=0;E--){var P=r.ranges[E],q=P.from(),J=P.to();P.empty()&&(n&&n>0?q=K(q.line,q.ch-n):e.state.overwrite&&!l?J=K(J.line,Math.min(ue(o,J.line).text.length,J.ch+Ce(s).length)):l&&Rt&&Rt.lineWise&&Rt.text.join(` `)==s.join(` `)&&(q=J=K(q.line,0)));var ee={from:q,to:J,text:f?f[E%f.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};Zr(e.doc,ee),Ve(e,"inputRead",e,ee)}t&&!l&&sl(e,t),qr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=k),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ll(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return lo(t,n,0,null,"paste")}),!0}function sl(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Wn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ue(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Wn(e,i.head.line,"smart"));a&&Ve(e,"electricInput",e,i.head.line)}}}function ul(e){for(var t=[],n=[],r=0;ro&&(Wn(this,l.head.line,r,!0),o=l.head.line,a==this.doc.sel.primIndex&&qr(this));else{var s=l.from(),f=l.to(),b=Math.max(o,s.line);o=Math.min(this.lastLine(),f.line-(f.ch?0:1))+1;for(var k=b;k0&&$i(this.doc,a,new Ne(s,E[a].to()),dt)}}}),getTokenAt:function(r,i){return xo(this,r,i)},getLineTokens:function(r,i){return xo(this,K(r),i,!0)},getTokenTypeAt:function(r){r=ye(this.doc,r);var i=mo(this,ue(this.doc,r.line)),o=0,a=(i.length-1)/2,l=r.ch,s;if(l==0)s=i[2];else for(;;){var f=o+a>>1;if((f?i[f*2-1]:0)>=l)a=f;else if(i[f*2+1]s&&(r=s,a=!0),l=ue(this.doc,r)}else l=r;return Yn(this,l,{top:0,left:0},i||"page",o||a).top+(a?this.doc.height-Vt(l):0)},defaultTextHeight:function(){return _r(this.display)},defaultCharWidth:function(){return Ur(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,a,l){var s=this.display;r=Ht(this,ye(this.doc,r));var f=r.bottom,b=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),s.sizer.appendChild(i),a=="over")f=r.top;else if(a=="above"||a=="near"){var k=Math.max(s.wrapper.clientHeight,this.doc.height),E=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(a=="above"||r.bottom+i.offsetHeight>k)&&r.top>i.offsetHeight?f=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=k&&(f=r.bottom),b+i.offsetWidth>E&&(b=E-i.offsetWidth)}i.style.top=f+"px",i.style.left=i.style.right="",l=="right"?(b=s.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(l=="left"?b=0:l=="middle"&&(b=(s.sizer.clientWidth-i.offsetWidth)/2),i.style.left=b+"px"),o&&Ss(this,{left:b,top:f,right:b+i.offsetWidth,bottom:f+i.offsetHeight})},triggerOnKeyDown:ct(Va),triggerOnKeyPress:ct(el),triggerOnKeyUp:$a,triggerOnMouseDown:ct(tl),execCommand:function(r){if(Mn.hasOwnProperty(r))return Mn[r].call(null,this)},triggerElectric:ct(function(r){sl(this,r)}),findPosH:function(r,i,o,a){var l=1;i<0&&(l=-1,i=-i);for(var s=ye(this.doc,r),f=0;f0&&b(o.charAt(a-1));)--a;for(;l.5||this.options.lineWrapping)&&Ii(this),Re(this,"refresh",this)}),swapDoc:ct(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),ya(this,r),pn(this),this.display.input.reset(),gn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ve(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},Dt(e),e.registerHelper=function(r,i,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=o},e.registerGlobalHelper=function(r,i,o,a){e.registerHelper(r,i,a),n[r]._global.push({pred:o,val:a})}}function uo(e,t,n,r,i){var o=t,a=n,l=ue(e,t.line),s=i&&e.direction=="rtl"?-n:n;function f(){var le=t.line+s;return le=e.first+e.size?!1:(t=new K(le,t.ch,t.sticky),l=ue(e,le))}function b(le){var oe;if(r=="codepoint"){var se=l.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(se))oe=null;else{var ve=n>0?se>=55296&&se<56320:se>=56320&&se<57343;oe=new K(t.line,Math.max(0,Math.min(l.text.length,t.ch+n*(ve?2:1))),-n)}}else i?oe=lu(e.cm,l,t,n):oe=to(l,t,n);if(oe==null)if(!le&&f())t=ro(i,e.cm,l,t.line,s);else return!1;else t=oe;return!0}if(r=="char"||r=="codepoint")b();else if(r=="column")b(!0);else if(r=="word"||r=="group")for(var k=null,E=r=="group",P=e.cm&&e.cm.getHelper(t,"wordChars"),q=!0;!(n<0&&!b(!q));q=!1){var J=l.text.charAt(t.ch)||` `,ee=jt(J,P)?"w":E&&J==` `?"n":!E||/\s/.test(J)?null:"p";if(E&&!q&&!ee&&(ee="s"),k&&k!=ee){n<0&&(n=1,b(),t.sticky="after");break}if(ee&&(k=ee),n>0&&!b(!q))break}var ie=li(e,t,o,a,!0);return Oe(o,ie)&&(ie.hitSide=!0),ie}function cl(e,t,n,r){var i=e.doc,o=t.left,a;if(r=="page"){var l=Math.min(e.display.wrapper.clientHeight,me(e).innerHeight||i(e).documentElement.clientHeight),s=Math.max(l-.5*_r(e.display),3);a=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(a=n>0?t.bottom+3:t.top-3);for(var f;f=Di(e,o,a),!!f.outside;){if(n<0?a<=0:a>=i.height){f.hitSide=!0;break}a+=n*5}return f}var Pe=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new be,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Pe.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,so(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(l){for(var s=l.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}pe(i,"paste",function(l){!o(l)||Ke(r,l)||ll(l,r)||_<=11&&setTimeout($e(r,function(){return t.updateFromDOM()}),20)}),pe(i,"compositionstart",function(l){t.composing={data:l.data,done:!1}}),pe(i,"compositionupdate",function(l){t.composing||(t.composing={data:l.data,done:!1})}),pe(i,"compositionend",function(l){t.composing&&(l.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),pe(i,"touchstart",function(){return n.forceCompositionEnd()}),pe(i,"input",function(){t.composing||t.readFromDOMSoon()});function a(l){if(!(!o(l)||Ke(r,l))){if(r.somethingSelected())di({lineWise:!1,text:r.getSelections()}),l.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=ul(r);di({lineWise:!0,text:s.text}),l.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,dt),r.replaceSelection("",null,"cut")})}else return;if(l.clipboardData){l.clipboardData.clearData();var f=Rt.text.join(` `);if(l.clipboardData.setData("Text",f),l.clipboardData.getData("Text")==f){l.preventDefault();return}}var b=fl(),k=b.firstChild;so(k),r.display.lineSpace.insertBefore(b,r.display.lineSpace.firstChild),k.value=Rt.text.join(` `);var E=fe(Ee(i));Be(k),setTimeout(function(){r.display.lineSpace.removeChild(b),E.focus(),E==i&&n.showPrimarySelection()},50)}}pe(i,"copy",a),pe(i,"cut",a)},Pe.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Pe.prototype.prepareSelection=function(){var e=ta(this.cm,!1);return e.focus=fe(Ee(this.div))==this.div,e},Pe.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Pe.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Pe.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&hl(t,r)||{node:l[0].measure.map[2],offset:0},f=i.linee.firstLine()&&(r=K(r.line-1,ue(e.doc,r.line-1).length)),i.ch==ue(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var o,a,l;r.line==t.viewFrom||(o=Cr(e,r.line))==0?(a=h(t.view[0].line),l=t.view[0].node):(a=h(t.view[o].line),l=t.view[o-1].node.nextSibling);var s=Cr(e,i.line),f,b;if(s==t.view.length-1?(f=t.viewTo-1,b=t.lineDiv.lastChild):(f=h(t.view[s+1].line)-1,b=t.view[s+1].node.previousSibling),!l)return!1;for(var k=e.doc.splitLines(Ou(e,l,b,a,f)),E=Qt(e.doc,K(a,0),K(f,ue(e.doc,f).text.length));k.length>1&&E.length>1;)if(Ce(k)==Ce(E))k.pop(),E.pop(),f--;else if(k[0]==E[0])k.shift(),E.shift(),a++;else break;for(var P=0,q=0,J=k[0],ee=E[0],ie=Math.min(J.length,ee.length);Pr.ch&&le.charCodeAt(le.length-q-1)==oe.charCodeAt(oe.length-q-1);)P--,q++;k[k.length-1]=le.slice(0,le.length-q).replace(/^\u200b+/,""),k[0]=k[0].slice(P).replace(/\u200b+$/,"");var ve=K(a,P),de=K(f,E.length?Ce(E).length-q:0);if(k.length>1||k[0]||ae(ve,de))return Qr(e.doc,k,ve,de,"+input"),!0},Pe.prototype.ensurePolled=function(){this.forceCompositionEnd()},Pe.prototype.reset=function(){this.forceCompositionEnd()},Pe.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Pe.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))},Pe.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return mt(e.cm)})},Pe.prototype.setUneditable=function(e){e.contentEditable="false"},Pe.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||$e(this.cm,lo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Pe.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Pe.prototype.onContextMenu=function(){},Pe.prototype.resetPosition=function(){},Pe.prototype.needsContentAttribute=!0;function hl(e,t){var n=Ni(e,t.line);if(!n||n.hidden)return null;var r=ue(e.doc,t.line),i=Ko(n,r,t.line),o=Se(r,e.doc.direction),a="left";if(o){var l=or(o,t.ch);a=l%2?"right":"left"}var s=Go(i.map,t.ch,a);return s.offset=s.collapse=="right"?s.end:s.start,s}function Au(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function tn(e,t){return t&&(e.bad=!0),e}function Ou(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function f(P){return function(q){return q.id==P}}function b(){a&&(o+=l,s&&(o+=l),a=s=!1)}function k(P){P&&(b(),o+=P)}function E(P){if(P.nodeType==1){var q=P.getAttribute("cm-text");if(q){k(q);return}var J=P.getAttribute("cm-marker"),ee;if(J){var ie=e.findMarks(K(r,0),K(i+1,0),f(+J));ie.length&&(ee=ie[0].find(0))&&k(Qt(e.doc,ee.from,ee.to).join(l));return}if(P.getAttribute("contenteditable")=="false")return;var le=/^(pre|div|p|li|table|br)$/i.test(P.nodeName);if(!/^br$/i.test(P.nodeName)&&P.textContent.length==0)return;le&&b();for(var oe=0;oe=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),pe(i,"paste",function(a){Ke(r,a)||ll(a,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(a){if(!Ke(r,a)){if(r.somethingSelected())di({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var l=ul(r);di({lineWise:!0,text:l.text}),a.type=="cut"?r.setSelections(l.ranges,null,dt):(n.prevInput="",i.value=l.text.join(` `),Be(i))}else return;a.type=="cut"&&(r.state.cutIncoming=+new Date)}}pe(i,"cut",o),pe(i,"copy",o),pe(e.scroller,"paste",function(a){if(!($t(e,a)||Ke(r,a))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var l=new Event("paste");l.clipboardData=a.clipboardData,i.dispatchEvent(l)}}),pe(e.lineSpace,"selectstart",function(a){$t(e,a)||st(a)}),pe(i,"compositionstart",function(){var a=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:a,range:r.markText(a,r.getCursor("to"),{className:"CodeMirror-composing"})}}),pe(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},qe.prototype.createField=function(e){this.wrapper=fl(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;so(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},qe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ta(e);if(e.options.moveInputWithCursor){var i=Ht(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},qe.prototype.showSelection=function(e){var t=this.cm,n=t.display;G(n.cursorDiv,e.cursors),G(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Be(this.textarea),D&&_>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",D&&_>=9&&(this.hasSelection=null));this.resetting=!1}},qe.prototype.getField=function(){return this.textarea},qe.prototype.supportsTouch=function(){return!1},qe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!u||fe(Ee(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},qe.prototype.blur=function(){this.textarea.blur()},qe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qe.prototype.receivedFocus=function(){this.slowPoll()},qe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},qe.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||sr(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(D&&_>=9&&this.hasSelection===i||p&&/[\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&&!r&&(r="​"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a1e3||i.indexOf(` `)>-1?n.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},qe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qe.prototype.onKeyPress=function(){D&&_>=9&&(this.hasSelection=null),this.fastPoll()},qe.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Sr(n,e),a=r.scroller.scrollTop;if(!o||W)return;var l=n.options.resetSelectionOnContextMenu;l&&n.doc.sel.contains(o)==-1&&$e(n,ut)(n.doc,dr(o),dt);var s=i.style.cssText,f=t.wrapper.style.cssText,b=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-b.top-5)+"px; left: "+(e.clientX-b.left-5)+`px; z-index: 1000; background: `+(D?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var k;T&&(k=i.ownerDocument.defaultView.scrollY),r.input.focus(),T&&i.ownerDocument.defaultView.scrollTo(null,k),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=P,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function E(){if(i.selectionStart!=null){var J=n.somethingSelected(),ee="​"+(J?i.value:"");i.value="⇚",i.value=ee,t.prevInput=J?"":"​",i.selectionStart=1,i.selectionEnd=ee.length,r.selForContextMenu=n.doc.sel}}function P(){if(t.contextMenuPending==P&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=s,D&&_<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=a),i.selectionStart!=null)){(!D||D&&_<9)&&E();var J=0,ee=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="​"?$e(n,Ma)(n):J++<10?r.detectingSelectAll=setTimeout(ee,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ee,200)}}if(D&&_>=9&&E(),F){ar(e);var q=function(){lt(window,"mouseup",q),setTimeout(P,20)};pe(window,"mouseup",q)}else setTimeout(P,50)},qe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qe.prototype.setUneditable=function(){},qe.prototype.needsContentAttribute=!1;function Pu(e,t){if(t=t?xe(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 n=fe(Ee(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(pe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var l=He(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return l}function Mu(e){e.off=lt,e.on=pe,e.wheelEventPixels=Hs,e.Doc=yt,e.splitLines=Pt,e.countColumn=Le,e.findColumn=Xe,e.isWordChar=at,e.Pass=Mt,e.signal=Re,e.Line=zr,e.changeEnd=pr,e.scrollbarModel=la,e.Pos=K,e.cmpPos=ae,e.modes=Fr,e.mimeModes=Wt,e.resolveMode=Er,e.getMode=Wr,e.modeExtensions=ur,e.extendMode=Ir,e.copyState=_t,e.startState=Br,e.innerMode=ln,e.commands=Mn,e.keyMap=tr,e.keyName=ja,e.isModifierKey=qa,e.lookupKey=Vr,e.normalizeKeyMap=au,e.StringStream=_e,e.SharedTextMarker=On,e.TextMarker=gr,e.LineWidget=An,e.e_preventDefault=st,e.e_stopPropagation=Mr,e.e_stop=ar,e.addClass=ce,e.contains=ne,e.rmClass=U,e.keyNames=mr}wu(He),Tu(He);var Du="iter insert remove copy getEditor constructor".split(" ");for(var vi in yt.prototype)yt.prototype.hasOwnProperty(vi)&&he(Du,vi)<0&&(He.prototype[vi]=function(e){return function(){return e.apply(this.doc,arguments)}}(yt.prototype[vi]));return Dt(yt),He.inputStyles={textarea:qe,contenteditable:Pe},He.defineMode=function(e){!He.defaults.mode&&e!="null"&&(He.defaults.mode=e),It.apply(this,arguments)},He.defineMIME=xr,He.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),He.defineMIME("text/plain","null"),He.defineExtension=function(e,t){He.prototype[e]=t},He.defineDocExtension=function(e,t){yt.prototype[e]=t},He.fromTextArea=Pu,Mu(He),He.version="5.65.18",He})})(Ml);var nt=Ml.exports;const ju=Xu(nt);var Yu={exports:{}};(function(We,Ie){(function(y){y(nt)})(function(y){y.defineMode("javascript",function(H,z){var V=H.indentUnit,re=z.statementIndent,I=z.jsonld,D=z.json||I,_=z.trackScope!==!1,T=z.typescript,B=z.wordCharacters||/[\w$\xa1-\uffff]/,C=function(){function h(Je){return{type:Je,style:"keyword"}}var x=h("keyword a"),Y=h("keyword b"),$=h("keyword c"),K=h("keyword d"),ae=h("operator"),Oe={type:"atom",style:"atom"};return{if:h("if"),while:x,with:x,else:Y,do:Y,try:Y,finally:Y,return:K,break:K,continue:K,new:h("new"),delete:$,void:$,throw:$,debugger:h("debugger"),var:h("var"),const:h("var"),let:h("var"),function:h("function"),catch:h("catch"),for:h("for"),switch:h("switch"),case:h("case"),default:h("default"),in:ae,typeof:ae,instanceof:ae,true:Oe,false:Oe,null:Oe,undefined:Oe,NaN:Oe,Infinity:Oe,this:h("this"),class:h("class"),super:h("atom"),yield:$,export:h("export"),import:h("import"),extends:$,await:$}}(),M=/[+\-*&%=<>!?|~^@]/,W=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function Z(h){for(var x=!1,Y,$=!1;(Y=h.next())!=null;){if(!x){if(Y=="/"&&!$)return;Y=="["?$=!0:$&&Y=="]"&&($=!1)}x=!x&&Y=="\\"}}var O,S;function v(h,x,Y){return O=h,S=Y,x}function g(h,x){var Y=h.next();if(Y=='"'||Y=="'")return x.tokenize=u(Y),x.tokenize(h,x);if(Y=="."&&h.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return v("number","number");if(Y=="."&&h.match(".."))return v("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(Y))return v(Y);if(Y=="="&&h.eat(">"))return v("=>","operator");if(Y=="0"&&h.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return v("number","number");if(/\d/.test(Y))return h.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),v("number","number");if(Y=="/")return h.eat("*")?(x.tokenize=p,p(h,x)):h.eat("/")?(h.skipToEnd(),v("comment","comment")):At(h,x,1)?(Z(h),h.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),v("regexp","string-2")):(h.eat("="),v("operator","operator",h.current()));if(Y=="`")return x.tokenize=m,m(h,x);if(Y=="#"&&h.peek()=="!")return h.skipToEnd(),v("meta","meta");if(Y=="#"&&h.eatWhile(B))return v("variable","property");if(Y=="<"&&h.match("!--")||Y=="-"&&h.match("->")&&!/\S/.test(h.string.slice(0,h.start)))return h.skipToEnd(),v("comment","comment");if(M.test(Y))return(Y!=">"||!x.lexical||x.lexical.type!=">")&&(h.eat("=")?(Y=="!"||Y=="=")&&h.eat("="):/[<>*+\-|&?]/.test(Y)&&(h.eat(Y),Y==">"&&h.eat(Y))),Y=="?"&&h.eat(".")?v("."):v("operator","operator",h.current());if(B.test(Y)){h.eatWhile(B);var $=h.current();if(x.lastType!="."){if(C.propertyIsEnumerable($)){var K=C[$];return v(K.type,K.style,$)}if($=="async"&&h.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return v("async","keyword",$)}return v("variable","variable",$)}}function u(h){return function(x,Y){var $=!1,K;if(I&&x.peek()=="@"&&x.match(W))return Y.tokenize=g,v("jsonld-keyword","meta");for(;(K=x.next())!=null&&!(K==h&&!$);)$=!$&&K=="\\";return $||(Y.tokenize=g),v("string","string")}}function p(h,x){for(var Y=!1,$;$=h.next();){if($=="/"&&Y){x.tokenize=g;break}Y=$=="*"}return v("comment","comment")}function m(h,x){for(var Y=!1,$;($=h.next())!=null;){if(!Y&&($=="`"||$=="$"&&h.eat("{"))){x.tokenize=g;break}Y=!Y&&$=="\\"}return v("quasi","string-2",h.current())}var w="([{}])";function d(h,x){x.fatArrowAt&&(x.fatArrowAt=null);var Y=h.string.indexOf("=>",h.start);if(!(Y<0)){if(T){var $=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(h.string.slice(h.start,Y));$&&(Y=$.index)}for(var K=0,ae=!1,Oe=Y-1;Oe>=0;--Oe){var Je=h.string.charAt(Oe),gt=w.indexOf(Je);if(gt>=0&><3){if(!K){++Oe;break}if(--K==0){Je=="("&&(ae=!0);break}}else if(gt>=3&><6)++K;else if(B.test(Je))ae=!0;else if(/["'\/`]/.test(Je))for(;;--Oe){if(Oe==0)return;var Hr=h.string.charAt(Oe-1);if(Hr==Je&&h.string.charAt(Oe-2)!="\\"){Oe--;break}}else if(ae&&!K){++Oe;break}}ae&&!K&&(x.fatArrowAt=Oe)}}var L={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function F(h,x,Y,$,K,ae){this.indented=h,this.column=x,this.type=Y,this.prev=K,this.info=ae,$!=null&&(this.align=$)}function N(h,x){if(!_)return!1;for(var Y=h.localVars;Y;Y=Y.next)if(Y.name==x)return!0;for(var $=h.context;$;$=$.prev)for(var Y=$.vars;Y;Y=Y.next)if(Y.name==x)return!0}function U(h,x,Y,$,K){var ae=h.cc;for(A.state=h,A.stream=K,A.marked=null,A.cc=ae,A.style=x,h.lexical.hasOwnProperty("align")||(h.lexical.align=!0);;){var Oe=ae.length?ae.pop():D?he:Le;if(Oe(Y,$)){for(;ae.length&&ae[ae.length-1].lex;)ae.pop()();return A.marked?A.marked:Y=="variable"&&N(h,$)?"variable-2":x}}}var A={state:null,column:null,marked:null,cc:null};function G(){for(var h=arguments.length-1;h>=0;h--)A.cc.push(arguments[h])}function c(){return G.apply(null,arguments),!0}function Q(h,x){for(var Y=x;Y;Y=Y.next)if(Y.name==h)return!0;return!1}function j(h){var x=A.state;if(A.marked="def",!!_){if(x.context){if(x.lexical.info=="var"&&x.context&&x.context.block){var Y=ne(h,x.context);if(Y!=null){x.context=Y;return}}else if(!Q(h,x.localVars)){x.localVars=new we(h,x.localVars);return}}z.globalVars&&!Q(h,x.globalVars)&&(x.globalVars=new we(h,x.globalVars))}}function ne(h,x){if(x)if(x.block){var Y=ne(h,x.prev);return Y?Y==x.prev?x:new ce(Y,x.vars,!0):null}else return Q(h,x.vars)?x:new ce(x.prev,new we(h,x.vars),!1);else return null}function fe(h){return h=="public"||h=="private"||h=="protected"||h=="abstract"||h=="readonly"}function ce(h,x,Y){this.prev=h,this.vars=x,this.block=Y}function we(h,x){this.name=h,this.next=x}var Be=new we("this",new we("arguments",null));function Me(){A.state.context=new ce(A.state.context,A.state.localVars,!1),A.state.localVars=Be}function Ge(){A.state.context=new ce(A.state.context,A.state.localVars,!0),A.state.localVars=null}Me.lex=Ge.lex=!0;function Ee(){A.state.localVars=A.state.context.vars,A.state.context=A.state.context.prev}Ee.lex=!0;function me(h,x){var Y=function(){var $=A.state,K=$.indented;if($.lexical.type=="stat")K=$.lexical.indented;else for(var ae=$.lexical;ae&&ae.type==")"&&ae.align;ae=ae.prev)K=ae.indented;$.lexical=new F(K,A.stream.column(),h,null,$.lexical,x)};return Y.lex=!0,Y}function ge(){var h=A.state;h.lexical.prev&&(h.lexical.type==")"&&(h.indented=h.lexical.indented),h.lexical=h.lexical.prev)}ge.lex=!0;function xe(h){function x(Y){return Y==h?c():h==";"||Y=="}"||Y==")"||Y=="]"?G():c(x)}return x}function Le(h,x){return h=="var"?c(me("vardef",x),Mr,xe(";"),ge):h=="keyword a"?c(me("form"),Mt,Le,ge):h=="keyword b"?c(me("form"),Le,ge):h=="keyword d"?A.stream.match(/^\s*$/,!1)?c():c(me("stat"),Lt,xe(";"),ge):h=="debugger"?c(xe(";")):h=="{"?c(me("}"),Ge,Kt,ge,Ee):h==";"?c():h=="if"?(A.state.lexical.info=="else"&&A.state.cc[A.state.cc.length-1]==ge&&A.state.cc.pop()(),c(me("form"),Mt,Le,ge,Dr)):h=="function"?c(Pt):h=="for"?c(me("form"),Ge,Hn,Le,Ee,ge):h=="class"||T&&x=="interface"?(A.marked="keyword",c(me("form",h=="class"?h:x),Fr,ge)):h=="variable"?T&&x=="declare"?(A.marked="keyword",c(Le)):T&&(x=="module"||x=="enum"||x=="type")&&A.stream.match(/^\s*\w/,!1)?(A.marked="keyword",x=="enum"?c(ue):x=="type"?c(zn,xe("operator"),Se,xe(";")):c(me("form"),vt,xe("{"),me("}"),Kt,ge,ge)):T&&x=="namespace"?(A.marked="keyword",c(me("form"),he,Le,ge)):T&&x=="abstract"?(A.marked="keyword",c(Le)):c(me("stat"),Te):h=="switch"?c(me("form"),Mt,xe("{"),me("}","switch"),Ge,Kt,ge,ge,Ee):h=="case"?c(he,xe(":")):h=="default"?c(xe(":")):h=="catch"?c(me("form"),Me,be,Le,ge,Ee):h=="export"?c(me("stat"),Er,ge):h=="import"?c(me("stat"),ur,ge):h=="async"?c(Le):x=="@"?c(he,Le):G(me("stat"),he,xe(";"),ge)}function be(h){if(h=="(")return c(Et,xe(")"))}function he(h,x){return dt(h,x,!1)}function it(h,x){return dt(h,x,!0)}function Mt(h){return h!="("?G():c(me(")"),Lt,xe(")"),ge)}function dt(h,x,Y){if(A.state.fatArrowAt==A.stream.start){var $=Y?De:Ce;if(h=="(")return c(Me,me(")"),je(Et,")"),ge,xe("=>"),$,Ee);if(h=="variable")return G(Me,vt,xe("=>"),$,Ee)}var K=Y?Xe:Ae;return L.hasOwnProperty(h)?c(K):h=="function"?c(Pt,K):h=="class"||T&&x=="interface"?(A.marked="keyword",c(me("form"),yi,ge)):h=="keyword c"||h=="async"?c(Y?it:he):h=="("?c(me(")"),Lt,xe(")"),ge,K):h=="operator"||h=="spread"?c(Y?it:he):h=="["?c(me("]"),_e,ge,K):h=="{"?nr(jt,"}",null,K):h=="quasi"?G(pt,K):h=="new"?c(R(Y)):c()}function Lt(h){return h.match(/[;\}\)\],]/)?G():G(he)}function Ae(h,x){return h==","?c(Lt):Xe(h,x,!1)}function Xe(h,x,Y){var $=Y==!1?Ae:Xe,K=Y==!1?he:it;if(h=="=>")return c(Me,Y?De:Ce,Ee);if(h=="operator")return/\+\+|--/.test(x)||T&&x=="!"?c($):T&&x=="<"&&A.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?c(me(">"),je(Se,">"),ge,$):x=="?"?c(he,xe(":"),K):c(K);if(h=="quasi")return G(pt,$);if(h!=";"){if(h=="(")return nr(it,")","call",$);if(h==".")return c(at,$);if(h=="[")return c(me("]"),Lt,xe("]"),ge,$);if(T&&x=="as")return A.marked="keyword",c(Se,$);if(h=="regexp")return A.state.lastType=A.marked="operator",A.stream.backUp(A.stream.pos-A.stream.start-1),c(K)}}function pt(h,x){return h!="quasi"?G():x.slice(x.length-2)!="${"?c(pt):c(Lt,Tt)}function Tt(h){if(h=="}")return A.marked="string-2",A.state.tokenize=m,c(pt)}function Ce(h){return d(A.stream,A.state),G(h=="{"?Le:he)}function De(h){return d(A.stream,A.state),G(h=="{"?Le:it)}function R(h){return function(x){return x=="."?c(h?X:te):x=="variable"&&T?c(wt,h?Xe:Ae):G(h?it:he)}}function te(h,x){if(x=="target")return A.marked="keyword",c(Ae)}function X(h,x){if(x=="target")return A.marked="keyword",c(Xe)}function Te(h){return h==":"?c(ge,Le):G(Ae,xe(";"),ge)}function at(h){if(h=="variable")return A.marked="property",c()}function jt(h,x){if(h=="async")return A.marked="property",c(jt);if(h=="variable"||A.style=="keyword"){if(A.marked="property",x=="get"||x=="set")return c(In);var Y;return T&&A.state.fatArrowAt==A.stream.start&&(Y=A.stream.match(/^\s*:\s*/,!1))&&(A.state.fatArrowAt=A.stream.pos+Y[0].length),c(Yt)}else{if(h=="number"||h=="string")return A.marked=I?"property":A.style+" property",c(Yt);if(h=="jsonld-keyword")return c(Yt);if(T&&fe(x))return A.marked="keyword",c(jt);if(h=="[")return c(he,ir,xe("]"),Yt);if(h=="spread")return c(it,Yt);if(x=="*")return A.marked="keyword",c(jt);if(h==":")return G(Yt)}}function In(h){return h!="variable"?G(Yt):(A.marked="property",c(Pt))}function Yt(h){if(h==":")return c(it);if(h=="(")return G(Pt)}function je(h,x,Y){function $(K,ae){if(Y?Y.indexOf(K)>-1:K==","){var Oe=A.state.lexical;return Oe.info=="call"&&(Oe.pos=(Oe.pos||0)+1),c(function(Je,gt){return Je==x||gt==x?G():G(h)},$)}return K==x||ae==x?c():Y&&Y.indexOf(";")>-1?G(h):c(xe(x))}return function(K,ae){return K==x||ae==x?c():G(h,$)}}function nr(h,x,Y){for(var $=3;$"),Se);if(h=="quasi")return G(lt,Nt)}function Bn(h){if(h=="=>")return c(Se)}function pe(h){return h.match(/[\}\)\]]/)?c():h==","||h==";"?c(pe):G(Zt,pe)}function Zt(h,x){if(h=="variable"||A.style=="keyword")return A.marked="property",c(Zt);if(x=="?"||h=="number"||h=="string")return c(Zt);if(h==":")return c(Se);if(h=="[")return c(xe("variable"),br,xe("]"),Zt);if(h=="(")return G(sr,Zt);if(!h.match(/[;\}\)\],]/))return c()}function lt(h,x){return h!="quasi"?G():x.slice(x.length-2)!="${"?c(lt):c(Se,Re)}function Re(h){if(h=="}")return A.marked="string-2",A.state.tokenize=m,c(lt)}function Ke(h,x){return h=="variable"&&A.stream.match(/^\s*[?:]/,!1)||x=="?"?c(Ke):h==":"?c(Se):h=="spread"?c(Ke):G(Se)}function Nt(h,x){if(x=="<")return c(me(">"),je(Se,">"),ge,Nt);if(x=="|"||h=="."||x=="&")return c(Se);if(h=="[")return c(Se,xe("]"),Nt);if(x=="extends"||x=="implements")return A.marked="keyword",c(Se);if(x=="?")return c(Se,xe(":"),Se)}function wt(h,x){if(x=="<")return c(me(">"),je(Se,">"),ge,Nt)}function Dt(){return G(Se,st)}function st(h,x){if(x=="=")return c(Se)}function Mr(h,x){return x=="enum"?(A.marked="keyword",c(ue)):G(vt,ir,Ft,mi)}function vt(h,x){if(T&&fe(x))return A.marked="keyword",c(vt);if(h=="variable")return j(x),c();if(h=="spread")return c(vt);if(h=="[")return nr(on,"]");if(h=="{")return nr(ar,"}")}function ar(h,x){return h=="variable"&&!A.stream.match(/^\s*:/,!1)?(j(x),c(Ft)):(h=="variable"&&(A.marked="property"),h=="spread"?c(vt):h=="}"?G():h=="["?c(he,xe("]"),xe(":"),ar):c(xe(":"),vt,Ft))}function on(){return G(vt,Ft)}function Ft(h,x){if(x=="=")return c(it)}function mi(h){if(h==",")return c(Mr)}function Dr(h,x){if(h=="keyword b"&&x=="else")return c(me("form","else"),Le,ge)}function Hn(h,x){if(x=="await")return c(Hn);if(h=="(")return c(me(")"),an,ge)}function an(h){return h=="var"?c(Mr,lr):h=="variable"?c(lr):G(lr)}function lr(h,x){return h==")"?c():h==";"?c(lr):x=="in"||x=="of"?(A.marked="keyword",c(he,lr)):G(he,lr)}function Pt(h,x){if(x=="*")return A.marked="keyword",c(Pt);if(h=="variable")return j(x),c(Pt);if(h=="(")return c(Me,me(")"),je(Et,")"),ge,or,Le,Ee);if(T&&x=="<")return c(me(">"),je(Dt,">"),ge,Pt)}function sr(h,x){if(x=="*")return A.marked="keyword",c(sr);if(h=="variable")return j(x),c(sr);if(h=="(")return c(Me,me(")"),je(Et,")"),ge,or,Ee);if(T&&x=="<")return c(me(">"),je(Dt,">"),ge,sr)}function zn(h,x){if(h=="keyword"||h=="variable")return A.marked="type",c(zn);if(x=="<")return c(me(">"),je(Dt,">"),ge)}function Et(h,x){return x=="@"&&c(he,Et),h=="spread"?c(Et):T&&fe(x)?(A.marked="keyword",c(Et)):T&&h=="this"?c(ir,Ft):G(vt,ir,Ft)}function yi(h,x){return h=="variable"?Fr(h,x):Wt(h,x)}function Fr(h,x){if(h=="variable")return j(x),c(Wt)}function Wt(h,x){if(x=="<")return c(me(">"),je(Dt,">"),ge,Wt);if(x=="extends"||x=="implements"||T&&h==",")return x=="implements"&&(A.marked="keyword"),c(T?Se:he,Wt);if(h=="{")return c(me("}"),It,ge)}function It(h,x){if(h=="async"||h=="variable"&&(x=="static"||x=="get"||x=="set"||T&&fe(x))&&A.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return A.marked="keyword",c(It);if(h=="variable"||A.style=="keyword")return A.marked="property",c(xr,It);if(h=="number"||h=="string")return c(xr,It);if(h=="[")return c(he,ir,xe("]"),xr,It);if(x=="*")return A.marked="keyword",c(It);if(T&&h=="(")return G(sr,It);if(h==";"||h==",")return c(It);if(h=="}")return c();if(x=="@")return c(he,It)}function xr(h,x){if(x=="!"||x=="?")return c(xr);if(h==":")return c(Se,Ft);if(x=="=")return c(it);var Y=A.state.lexical.prev,$=Y&&Y.info=="interface";return G($?sr:Pt)}function Er(h,x){return x=="*"?(A.marked="keyword",c(Br,xe(";"))):x=="default"?(A.marked="keyword",c(he,xe(";"))):h=="{"?c(je(Wr,"}"),Br,xe(";")):G(Le)}function Wr(h,x){if(x=="as")return A.marked="keyword",c(xe("variable"));if(h=="variable")return G(it,Wr)}function ur(h){return h=="string"?c():h=="("?G(he):h=="."?G(Ae):G(Ir,_t,Br)}function Ir(h,x){return h=="{"?nr(Ir,"}"):(h=="variable"&&j(x),x=="*"&&(A.marked="keyword"),c(ln))}function _t(h){if(h==",")return c(Ir,_t)}function ln(h,x){if(x=="as")return A.marked="keyword",c(Ir)}function Br(h,x){if(x=="from")return A.marked="keyword",c(he)}function _e(h){return h=="]"?c():G(je(it,"]"))}function ue(){return G(me("form"),vt,xe("{"),me("}"),je(Qt,"}"),ge,ge)}function Qt(){return G(vt,Ft)}function sn(h,x){return h.lastType=="operator"||h.lastType==","||M.test(x.charAt(0))||/[,.]/.test(x.charAt(0))}function At(h,x,Y){return x.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(x.lastType)||x.lastType=="quasi"&&/\{\s*$/.test(h.string.slice(0,h.pos-(Y||0)))}return{startState:function(h){var x={tokenize:g,lastType:"sof",cc:[],lexical:new F((h||0)-V,0,"block",!1),localVars:z.localVars,context:z.localVars&&new ce(null,null,!1),indented:h||0};return z.globalVars&&typeof z.globalVars=="object"&&(x.globalVars=z.globalVars),x},token:function(h,x){if(h.sol()&&(x.lexical.hasOwnProperty("align")||(x.lexical.align=!1),x.indented=h.indentation(),d(h,x)),x.tokenize!=p&&h.eatSpace())return null;var Y=x.tokenize(h,x);return O=="comment"?Y:(x.lastType=O=="operator"&&(S=="++"||S=="--")?"incdec":O,U(x,Y,O,S,h))},indent:function(h,x){if(h.tokenize==p||h.tokenize==m)return y.Pass;if(h.tokenize!=g)return 0;var Y=x&&x.charAt(0),$=h.lexical,K;if(!/^\s*else\b/.test(x))for(var ae=h.cc.length-1;ae>=0;--ae){var Oe=h.cc[ae];if(Oe==ge)$=$.prev;else if(Oe!=Dr&&Oe!=Ee)break}for(;($.type=="stat"||$.type=="form")&&(Y=="}"||(K=h.cc[h.cc.length-1])&&(K==Ae||K==Xe)&&!/^[,\.=+\-*:?[\(]/.test(x));)$=$.prev;re&&$.type==")"&&$.prev.type=="stat"&&($=$.prev);var Je=$.type,gt=Y==Je;return Je=="vardef"?$.indented+(h.lastType=="operator"||h.lastType==","?$.info.length+1:0):Je=="form"&&Y=="{"?$.indented:Je=="form"?$.indented+V:Je=="stat"?$.indented+(sn(h,x)?re||V:0):$.info=="switch"&&!gt&&z.doubleIndentSwitch!=!1?$.indented+(/^(?:case|default)\b/.test(x)?V:2*V):$.align?$.column+(gt?0:1):$.indented+(gt?0:V)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:D?null:"/*",blockCommentEnd:D?null:"*/",blockCommentContinue:D?null:" * ",lineComment:D?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:D?"json":"javascript",jsonldMode:I,jsonMode:D,expressionAllowed:At,skipExpression:function(h){U(h,"atom","atom","true",new y.StringStream("",2,null))}}}),y.registerHelper("wordChars","javascript",/[\w$]/),y.defineMIME("text/javascript","javascript"),y.defineMIME("text/ecmascript","javascript"),y.defineMIME("application/javascript","javascript"),y.defineMIME("application/x-javascript","javascript"),y.defineMIME("application/ecmascript","javascript"),y.defineMIME("application/json",{name:"javascript",json:!0}),y.defineMIME("application/x-json",{name:"javascript",json:!0}),y.defineMIME("application/manifest+json",{name:"javascript",json:!0}),y.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),y.defineMIME("text/typescript",{name:"javascript",typescript:!0}),y.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})();var Zu=Yu.exports,gl={exports:{}},ml;function Dl(){return ml||(ml=1,function(We,Ie){(function(y){y(nt)})(function(y){y.defineMode("css",function(F,N){var U=N.inline;N.propertyKeywords||(N=y.resolveMode("text/css"));var A=F.indentUnit,G=N.tokenHooks,c=N.documentTypes||{},Q=N.mediaTypes||{},j=N.mediaFeatures||{},ne=N.mediaValueKeywords||{},fe=N.propertyKeywords||{},ce=N.nonStandardPropertyKeywords||{},we=N.fontProperties||{},Be=N.counterDescriptors||{},Me=N.colorKeywords||{},Ge=N.valueKeywords||{},Ee=N.allowNested,me=N.lineComment,ge=N.supportsAtComponent===!0,xe=F.highlightNonStandardPropertyKeywords!==!1,Le,be;function he(R,te){return Le=te,R}function it(R,te){var X=R.next();if(G[X]){var Te=G[X](R,te);if(Te!==!1)return Te}if(X=="@")return R.eatWhile(/[\w\\\-]/),he("def",R.current());if(X=="="||(X=="~"||X=="|")&&R.eat("="))return he(null,"compare");if(X=='"'||X=="'")return te.tokenize=Mt(X),te.tokenize(R,te);if(X=="#")return R.eatWhile(/[\w\\\-]/),he("atom","hash");if(X=="!")return R.match(/^\s*\w*/),he("keyword","important");if(/\d/.test(X)||X=="."&&R.eat(/\d/))return R.eatWhile(/[\w.%]/),he("number","unit");if(X==="-"){if(/[\d.]/.test(R.peek()))return R.eatWhile(/[\w.%]/),he("number","unit");if(R.match(/^-[\w\\\-]*/))return R.eatWhile(/[\w\\\-]/),R.match(/^\s*:/,!1)?he("variable-2","variable-definition"):he("variable-2","variable");if(R.match(/^\w+-/))return he("meta","meta")}else return/[,+>*\/]/.test(X)?he(null,"select-op"):X=="."&&R.match(/^-?[_a-z][_a-z0-9-]*/i)?he("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(X)?he(null,X):R.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(R.current())&&(te.tokenize=dt),he("variable callee","variable")):/[\w\\\-]/.test(X)?(R.eatWhile(/[\w\\\-]/),he("property","word")):he(null,null)}function Mt(R){return function(te,X){for(var Te=!1,at;(at=te.next())!=null;){if(at==R&&!Te){R==")"&&te.backUp(1);break}Te=!Te&&at=="\\"}return(at==R||!Te&&R!=")")&&(X.tokenize=null),he("string","string")}}function dt(R,te){return R.next(),R.match(/^\s*[\"\')]/,!1)?te.tokenize=null:te.tokenize=Mt(")"),he(null,"(")}function Lt(R,te,X){this.type=R,this.indent=te,this.prev=X}function Ae(R,te,X,Te){return R.context=new Lt(X,te.indentation()+(Te===!1?0:A),R.context),X}function Xe(R){return R.context.prev&&(R.context=R.context.prev),R.context.type}function pt(R,te,X){return De[X.context.type](R,te,X)}function Tt(R,te,X,Te){for(var at=Te||1;at>0;at--)X.context=X.context.prev;return pt(R,te,X)}function Ce(R){var te=R.current().toLowerCase();Ge.hasOwnProperty(te)?be="atom":Me.hasOwnProperty(te)?be="keyword":be="variable"}var De={};return De.top=function(R,te,X){if(R=="{")return Ae(X,te,"block");if(R=="}"&&X.context.prev)return Xe(X);if(ge&&/@component/i.test(R))return Ae(X,te,"atComponentBlock");if(/^@(-moz-)?document$/i.test(R))return Ae(X,te,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(R))return Ae(X,te,"atBlock");if(/^@(font-face|counter-style)/i.test(R))return X.stateArg=R,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(R))return"keyframes";if(R&&R.charAt(0)=="@")return Ae(X,te,"at");if(R=="hash")be="builtin";else if(R=="word")be="tag";else{if(R=="variable-definition")return"maybeprop";if(R=="interpolation")return Ae(X,te,"interpolation");if(R==":")return"pseudo";if(Ee&&R=="(")return Ae(X,te,"parens")}return X.context.type},De.block=function(R,te,X){if(R=="word"){var Te=te.current().toLowerCase();return fe.hasOwnProperty(Te)?(be="property","maybeprop"):ce.hasOwnProperty(Te)?(be=xe?"string-2":"property","maybeprop"):Ee?(be=te.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(be+=" error","maybeprop")}else return R=="meta"?"block":!Ee&&(R=="hash"||R=="qualifier")?(be="error","block"):De.top(R,te,X)},De.maybeprop=function(R,te,X){return R==":"?Ae(X,te,"prop"):pt(R,te,X)},De.prop=function(R,te,X){if(R==";")return Xe(X);if(R=="{"&&Ee)return Ae(X,te,"propBlock");if(R=="}"||R=="{")return Tt(R,te,X);if(R=="(")return Ae(X,te,"parens");if(R=="hash"&&!/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(te.current()))be+=" error";else if(R=="word")Ce(te);else if(R=="interpolation")return Ae(X,te,"interpolation");return"prop"},De.propBlock=function(R,te,X){return R=="}"?Xe(X):R=="word"?(be="property","maybeprop"):X.context.type},De.parens=function(R,te,X){return R=="{"||R=="}"?Tt(R,te,X):R==")"?Xe(X):R=="("?Ae(X,te,"parens"):R=="interpolation"?Ae(X,te,"interpolation"):(R=="word"&&Ce(te),"parens")},De.pseudo=function(R,te,X){return R=="meta"?"pseudo":R=="word"?(be="variable-3",X.context.type):pt(R,te,X)},De.documentTypes=function(R,te,X){return R=="word"&&c.hasOwnProperty(te.current())?(be="tag",X.context.type):De.atBlock(R,te,X)},De.atBlock=function(R,te,X){if(R=="(")return Ae(X,te,"atBlock_parens");if(R=="}"||R==";")return Tt(R,te,X);if(R=="{")return Xe(X)&&Ae(X,te,Ee?"block":"top");if(R=="interpolation")return Ae(X,te,"interpolation");if(R=="word"){var Te=te.current().toLowerCase();Te=="only"||Te=="not"||Te=="and"||Te=="or"?be="keyword":Q.hasOwnProperty(Te)?be="attribute":j.hasOwnProperty(Te)?be="property":ne.hasOwnProperty(Te)?be="keyword":fe.hasOwnProperty(Te)?be="property":ce.hasOwnProperty(Te)?be=xe?"string-2":"property":Ge.hasOwnProperty(Te)?be="atom":Me.hasOwnProperty(Te)?be="keyword":be="error"}return X.context.type},De.atComponentBlock=function(R,te,X){return R=="}"?Tt(R,te,X):R=="{"?Xe(X)&&Ae(X,te,Ee?"block":"top",!1):(R=="word"&&(be="error"),X.context.type)},De.atBlock_parens=function(R,te,X){return R==")"?Xe(X):R=="{"||R=="}"?Tt(R,te,X,2):De.atBlock(R,te,X)},De.restricted_atBlock_before=function(R,te,X){return R=="{"?Ae(X,te,"restricted_atBlock"):R=="word"&&X.stateArg=="@counter-style"?(be="variable","restricted_atBlock_before"):pt(R,te,X)},De.restricted_atBlock=function(R,te,X){return R=="}"?(X.stateArg=null,Xe(X)):R=="word"?(X.stateArg=="@font-face"&&!we.hasOwnProperty(te.current().toLowerCase())||X.stateArg=="@counter-style"&&!Be.hasOwnProperty(te.current().toLowerCase())?be="error":be="property","maybeprop"):"restricted_atBlock"},De.keyframes=function(R,te,X){return R=="word"?(be="variable","keyframes"):R=="{"?Ae(X,te,"top"):pt(R,te,X)},De.at=function(R,te,X){return R==";"?Xe(X):R=="{"||R=="}"?Tt(R,te,X):(R=="word"?be="tag":R=="hash"&&(be="builtin"),"at")},De.interpolation=function(R,te,X){return R=="}"?Xe(X):R=="{"||R==";"?Tt(R,te,X):(R=="word"?be="variable":R!="variable"&&R!="("&&R!=")"&&(be="error"),"interpolation")},{startState:function(R){return{tokenize:null,state:U?"block":"top",stateArg:null,context:new Lt(U?"block":"top",R||0,null)}},token:function(R,te){if(!te.tokenize&&R.eatSpace())return null;var X=(te.tokenize||it)(R,te);return X&&typeof X=="object"&&(Le=X[1],X=X[0]),be=X,Le!="comment"&&(te.state=De[te.state](Le,R,te)),be},indent:function(R,te){var X=R.context,Te=te&&te.charAt(0),at=X.indent;return X.type=="prop"&&(Te=="}"||Te==")")&&(X=X.prev),X.prev&&(Te=="}"&&(X.type=="block"||X.type=="top"||X.type=="interpolation"||X.type=="restricted_atBlock")?(X=X.prev,at=X.indent):(Te==")"&&(X.type=="parens"||X.type=="atBlock_parens")||Te=="{"&&(X.type=="at"||X.type=="atBlock"))&&(at=Math.max(0,X.indent-A))),at},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:me,fold:"brace"}});function H(F){for(var N={},U=0;U")):null:c.match("--")?j(O("comment","-->")):c.match("DOCTYPE",!0,!0)?(c.eatWhile(/[\w\._\-]/),j(S(1))):null:c.eat("?")?(c.eatWhile(/[\w\._\-]/),Q.tokenize=O("meta","?>"),"meta"):(B=c.eat("/")?"closeTag":"openTag",Q.tokenize=W,"tag bracket");if(ne=="&"){var fe;return c.eat("#")?c.eat("x")?fe=c.eatWhile(/[a-fA-F\d]/)&&c.eat(";"):fe=c.eatWhile(/[\d]/)&&c.eat(";"):fe=c.eatWhile(/[\w\.\-:]/)&&c.eat(";"),fe?"atom":"error"}else return c.eatWhile(/[^&<]/),null}M.isInText=!0;function W(c,Q){var j=c.next();if(j==">"||j=="/"&&c.eat(">"))return Q.tokenize=M,B=j==">"?"endTag":"selfcloseTag","tag bracket";if(j=="=")return B="equals",null;if(j=="<"){Q.tokenize=M,Q.state=m,Q.tagName=Q.tagStart=null;var ne=Q.tokenize(c,Q);return ne?ne+" tag error":"tag error"}else return/[\'\"]/.test(j)?(Q.tokenize=Z(j),Q.stringStartCol=c.column(),Q.tokenize(c,Q)):(c.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function Z(c){var Q=function(j,ne){for(;!j.eol();)if(j.next()==c){ne.tokenize=W;break}return"string"};return Q.isInAttribute=!0,Q}function O(c,Q){return function(j,ne){for(;!j.eol();){if(j.match(Q)){ne.tokenize=M;break}j.next()}return c}}function S(c){return function(Q,j){for(var ne;(ne=Q.next())!=null;){if(ne=="<")return j.tokenize=S(c+1),j.tokenize(Q,j);if(ne==">")if(c==1){j.tokenize=M;break}else return j.tokenize=S(c-1),j.tokenize(Q,j)}return"meta"}}function v(c){return c&&c.toLowerCase()}function g(c,Q,j){this.prev=c.context,this.tagName=Q||"",this.indent=c.indented,this.startOfLine=j,(D.doNotIndent.hasOwnProperty(Q)||c.context&&c.context.noIndent)&&(this.noIndent=!0)}function u(c){c.context&&(c.context=c.context.prev)}function p(c,Q){for(var j;;){if(!c.context||(j=c.context.tagName,!D.contextGrabbers.hasOwnProperty(v(j))||!D.contextGrabbers[v(j)].hasOwnProperty(v(Q))))return;u(c)}}function m(c,Q,j){return c=="openTag"?(j.tagStart=Q.column(),w):c=="closeTag"?d:m}function w(c,Q,j){return c=="word"?(j.tagName=Q.current(),C="tag",N):D.allowMissingTagName&&c=="endTag"?(C="tag bracket",N(c,Q,j)):(C="error",w)}function d(c,Q,j){if(c=="word"){var ne=Q.current();return j.context&&j.context.tagName!=ne&&D.implicitlyClosed.hasOwnProperty(v(j.context.tagName))&&u(j),j.context&&j.context.tagName==ne||D.matchClosing===!1?(C="tag",L):(C="tag error",F)}else return D.allowMissingTagName&&c=="endTag"?(C="tag bracket",L(c,Q,j)):(C="error",F)}function L(c,Q,j){return c!="endTag"?(C="error",L):(u(j),m)}function F(c,Q,j){return C="error",L(c,Q,j)}function N(c,Q,j){if(c=="word")return C="attribute",U;if(c=="endTag"||c=="selfcloseTag"){var ne=j.tagName,fe=j.tagStart;return j.tagName=j.tagStart=null,c=="selfcloseTag"||D.autoSelfClosers.hasOwnProperty(v(ne))?p(j,ne):(p(j,ne),j.context=new g(j,ne,fe==j.indented)),m}return C="error",N}function U(c,Q,j){return c=="equals"?A:(D.allowMissing||(C="error"),N(c,Q,j))}function A(c,Q,j){return c=="string"?G:c=="word"&&D.allowUnquoted?(C="string",N):(C="error",N(c,Q,j))}function G(c,Q,j){return c=="string"?G:N(c,Q,j)}return{startState:function(c){var Q={tokenize:M,state:m,indented:c||0,tagName:null,tagStart:null,context:null};return c!=null&&(Q.baseIndent=c),Q},token:function(c,Q){if(!Q.tagName&&c.sol()&&(Q.indented=c.indentation()),c.eatSpace())return null;B=null;var j=Q.tokenize(c,Q);return(j||B)&&j!="comment"&&(C=null,Q.state=Q.state(B||j,c,Q),C&&(j=C=="error"?j+" error":C)),j},indent:function(c,Q,j){var ne=c.context;if(c.tokenize.isInAttribute)return c.tagStart==c.indented?c.stringStartCol+1:c.indented+I;if(ne&&ne.noIndent)return y.Pass;if(c.tokenize!=W&&c.tokenize!=M)return j?j.match(/^(\s*)/)[0].length:0;if(c.tagName)return D.multilineTagIndentPastTag!==!1?c.tagStart+c.tagName.length+2:c.tagStart+I*(D.multilineTagIndentFactor||1);if(D.alignCDATA&&/$/,blockCommentStart:"",configuration:D.htmlMode?"html":"xml",helperType:D.htmlMode?"html":"xml",skipAttribute:function(c){c.state==A&&(c.state=N)},xmlCurrentTag:function(c){return c.tagName?{name:c.tagName,close:c.type=="closeTag"}:null},xmlCurrentContext:function(c){for(var Q=[],j=c.context;j;j=j.prev)Q.push(j.tagName);return Q.reverse()}}}),y.defineMIME("text/xml","xml"),y.defineMIME("application/xml","xml"),y.mimeModes.hasOwnProperty("text/html")||y.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),yl.exports}(function(We,Ie){(function(y){y(nt,Qu(),Zu,Dl())})(function(y){var H={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};function z(B,C,M){var W=B.current(),Z=W.search(C);return Z>-1?B.backUp(W.length-Z):W.match(/<\/?$/)&&(B.backUp(W.length),B.match(C,!1)||B.match(W)),M}var V={};function re(B){var C=V[B];return C||(V[B]=new RegExp("\\s+"+B+`\\s*=\\s*('|")?([^'"]+)('|")?\\s*`))}function I(B,C){var M=B.match(re(C));return M?/^\s*(.*?)\s*$/.exec(M[2])[1]:""}function D(B,C){return new RegExp((C?"^":"")+"","i")}function _(B,C){for(var M in B)for(var W=C[M]||(C[M]=[]),Z=B[M],O=Z.length-1;O>=0;O--)W.unshift(Z[O])}function T(B,C){for(var M=0;M=0;S--)W.script.unshift(["type",O[S].matches,O[S].mode]);function v(g,u){var p=M.token(g,u.htmlState),m=/\btag\b/.test(p),w;if(m&&!/[<>\s\/]/.test(g.current())&&(w=u.htmlState.tagName&&u.htmlState.tagName.toLowerCase())&&W.hasOwnProperty(w))u.inTag=w+" ";else if(u.inTag&&m&&/>$/.test(g.current())){var d=/^([\S]+) (.*)/.exec(u.inTag);u.inTag=null;var L=g.current()==">"&&T(W[d[1]],d[2]),F=y.getMode(B,L),N=D(d[1],!0),U=D(d[1],!1);u.token=function(A,G){return A.match(N,!1)?(G.token=v,G.localState=G.localMode=null,null):z(A,U,G.localMode.token(A,G.localState))},u.localMode=F,u.localState=y.startState(F,M.indent(u.htmlState,"",""))}else u.inTag&&(u.inTag+=g.current(),g.eol()&&(u.inTag+=" "));return p}return{startState:function(){var g=y.startState(M);return{token:v,inTag:null,localMode:null,localState:null,htmlState:g}},copyState:function(g){var u;return g.localState&&(u=y.copyState(g.localMode,g.localState)),{token:g.token,inTag:g.inTag,localMode:g.localMode,localState:u,htmlState:y.copyState(M,g.htmlState)}},token:function(g,u){return u.token(g,u)},indent:function(g,u,p){return!g.localMode||/^\s*<\//.test(u)?M.indent(g.htmlState,u,p):g.localMode.indent?g.localMode.indent(g.localState,u,p):y.Pass},innerMode:function(g){return{state:g.localState||g.htmlState,mode:g.localMode||M}}}},"xml","javascript","css"),y.defineMIME("text/html","htmlmixed")})})();(function(We,Ie){(function(y){y(nt)})(function(y){var H={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},z=y.Pos;y.defineOption("autoCloseBrackets",!1,function(S,v,g){g&&g!=y.Init&&(S.removeKeyMap(re),S.state.closeBrackets=null),v&&(I(V(v,"pairs")),S.state.closeBrackets=v,S.addKeyMap(re))});function V(S,v){return v=="pairs"&&typeof S=="string"?S:typeof S=="object"&&S[v]!=null?S[v]:H[v]}var re={Backspace:T,Enter:B};function I(S){for(var v=0;v=0;p--){var w=u[p].head;S.replaceRange("",z(w.line,w.ch-1),z(w.line,w.ch+1),"+delete")}}function B(S){var v=_(S),g=v&&V(v,"explode");if(!g||S.getOption("disableInput"))return y.Pass;for(var u=S.listSelections(),p=0;p0?{line:w.head.line,ch:w.head.ch+v}:{line:w.head.line-1};g.push({anchor:d,head:d})}S.setSelections(g,p)}function M(S){var v=y.cmpPos(S.anchor,S.head)>0;return{anchor:new z(S.anchor.line,S.anchor.ch+(v?-1:1)),head:new z(S.head.line,S.head.ch+(v?1:-1))}}function W(S,v){var g=_(S);if(!g||S.getOption("disableInput"))return y.Pass;var u=V(g,"pairs"),p=u.indexOf(v);if(p==-1)return y.Pass;for(var m=V(g,"closeBefore"),w=V(g,"triples"),d=u.charAt(p+1)==v,L=S.listSelections(),F=p%2==0,N,U=0;U=0&&S.getRange(G,z(G.line,G.ch+3))==v+v+v?c="skipThree":c="skip";else if(d&&G.ch>1&&w.indexOf(v)>=0&&S.getRange(z(G.line,G.ch-2),G)==v+v){if(G.ch>2&&/\bstring/.test(S.getTokenTypeAt(z(G.line,G.ch-2))))return y.Pass;c="addFour"}else if(d){var j=G.ch==0?" ":S.getRange(z(G.line,G.ch-1),G);if(!y.isWordChar(Q)&&j!=v&&!y.isWordChar(j))c="both";else return y.Pass}else if(F&&(Q.length===0||/\s/.test(Q)||m.indexOf(Q)>-1))c="both";else return y.Pass;if(!N)N=c;else if(N!=c)return y.Pass}var ne=p%2?u.charAt(p-1):v,fe=p%2?v:u.charAt(p+1);S.operation(function(){if(N=="skip")C(S,1);else if(N=="skipThree")C(S,3);else if(N=="surround"){for(var ce=S.getSelections(),we=0;we=v.max))return v.ch=0,v.text=v.cm.getLine(++v.line),!0}function B(v){if(!(v.line<=v.min))return v.text=v.cm.getLine(--v.line),v.ch=v.text.length,!0}function C(v){for(;;){var g=v.text.indexOf(">",v.ch);if(g==-1){if(T(v))continue;return}if(!_(v,g+1)){v.ch=g+1;continue}var u=v.text.lastIndexOf("/",g),p=u>-1&&!/\S/.test(v.text.slice(u+1,g));return v.ch=g+1,p?"selfClose":"regular"}}function M(v){for(;;){var g=v.ch?v.text.lastIndexOf("<",v.ch-1):-1;if(g==-1){if(B(v))continue;return}if(!_(v,g+1)){v.ch=g;continue}I.lastIndex=g,v.ch=g;var u=I.exec(v.text);if(u&&u.index==g)return u}}function W(v){for(;;){I.lastIndex=v.ch;var g=I.exec(v.text);if(!g){if(T(v))continue;return}if(!_(v,g.index+1)){v.ch=g.index+1;continue}return v.ch=g.index+g[0].length,g}}function Z(v){for(;;){var g=v.ch?v.text.lastIndexOf(">",v.ch-1):-1;if(g==-1){if(B(v))continue;return}if(!_(v,g+1)){v.ch=g;continue}var u=v.text.lastIndexOf("/",g),p=u>-1&&!/\S/.test(v.text.slice(u+1,g));return v.ch=g+1,p?"selfClose":"regular"}}function O(v,g){for(var u=[];;){var p=W(v),m,w=v.line,d=v.ch-(p?p[0].length:0);if(!p||!(m=C(v)))return;if(m!="selfClose")if(p[1]){for(var L=u.length-1;L>=0;--L)if(u[L]==p[2]){u.length=L;break}if(L<0&&(!g||g==p[2]))return{tag:p[2],from:H(w,d),to:H(v.line,v.ch)}}else u.push(p[2])}}function S(v,g){for(var u=[];;){var p=Z(v);if(!p)return;if(p=="selfClose"){M(v);continue}var m=v.line,w=v.ch,d=M(v);if(!d)return;if(d[1])u.push(d[2]);else{for(var L=u.length-1;L>=0;--L)if(u[L]==d[2]){u.length=L;break}if(L<0&&(!g||g==d[2]))return{tag:d[2],from:H(v.line,v.ch),to:H(m,w)}}}}y.registerHelper("fold","xml",function(v,g){for(var u=new D(v,g.line,0);;){var p=W(u);if(!p||u.line!=g.line)return;var m=C(u);if(!m)return;if(!p[1]&&m!="selfClose"){var w=H(u.line,u.ch),d=O(u,p[2]);return d&&z(d.from,w)>0?{from:w,to:d.from}:null}}}),y.findMatchingTag=function(v,g,u){var p=new D(v,g.line,g.ch,u);if(!(p.text.indexOf(">")==-1&&p.text.indexOf("<")==-1)){var m=C(p),w=m&&H(p.line,p.ch),d=m&&M(p);if(!(!m||!d||z(p,g)>0)){var L={from:H(p.line,p.ch),to:w,tag:d[2]};return m=="selfClose"?{open:L,close:null,at:"open"}:d[1]?{open:S(p,d[2]),close:L,at:"close"}:(p=new D(v,w.line,w.ch,u),{open:L,close:O(p,d[2]),at:"open"})}}},y.findEnclosingTag=function(v,g,u,p){for(var m=new D(v,g.line,g.ch,u);;){var w=S(m,p);if(!w)break;var d=new D(v,g.line,g.ch,u),L=O(d,w.tag);if(L)return{open:w,close:L}}},y.scanForClosingTag=function(v,g,u,p){var m=new D(v,g.line,g.ch,p?{from:0,to:p}:null);return O(m,u)}})}()),xl.exports}(function(We,Ie){(function(y){y(nt,Ju())})(function(y){y.defineOption("autoCloseTags",!1,function(T,B,C){if(C!=y.Init&&C&&T.removeKeyMap("autoCloseTags"),!!B){var M={name:"autoCloseTags"};(typeof B!="object"||B.whenClosing!==!1)&&(M["'/'"]=function(W){return I(W)}),(typeof B!="object"||B.whenOpening!==!1)&&(M["'>'"]=function(W){return V(W)}),T.addKeyMap(M)}});var H=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],z=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function V(T){if(T.getOption("disableInput"))return y.Pass;for(var B=T.listSelections(),C=[],M=T.getOption("autoCloseTags"),W=0;WZ.ch&&(u=u.slice(0,u.length-O.end+Z.ch));var d=u.toLowerCase();if(!u||O.type=="string"&&(O.end!=Z.ch||!/[\"\']/.test(O.string.charAt(O.string.length-1))||O.string.length==1)||O.type=="tag"&&g.close||O.string.indexOf("/")==Z.ch-O.start-1||m&&D(m,d)>-1||_(T,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(v)||[],u,Z,!0))return y.Pass;var L=typeof M=="object"&&M.emptyTags;if(L&&D(L,u)>-1){C[W]={text:"/>",newPos:y.Pos(Z.line,Z.ch+2)};continue}var F=w&&D(w,d)>-1;C[W]={indent:F,text:">"+(F?` `:"")+"",newPos:F?y.Pos(Z.line+1,0):y.Pos(Z.line,Z.ch+1)}}for(var N=typeof M=="object"&&M.dontIndentOnAutoClose,W=B.length-1;W>=0;W--){var U=C[W];T.replaceRange(U.text,B[W].head,B[W].anchor,"+insert");var A=T.listSelections().slice(0);A[W]={head:U.newPos,anchor:U.newPos},T.setSelections(A),!N&&U.indent&&(T.indentLine(U.newPos.line,null,!0),T.indentLine(U.newPos.line+1,null,!0))}}function re(T,B){for(var C=T.listSelections(),M=[],W=B?"/":""&&(m+=">"),M[S]=m}if(T.replaceSelections(M),C=T.listSelections(),!O)for(var S=0;S=0&&B[v]==C;v--)++S;M=O.to;for(var v=1;v=0;Z--){var O=M[Z].from(),S=M[Z].to();O.line>=C||(S.line>=C&&(S=V(C,0)),C=O.line,W==null?B.uncomment(O,S,T)?W="un":(B.lineComment(O,S,T),W="line"):W=="un"?B.uncomment(O,S,T):B.lineComment(O,S,T))}});function D(T,B,C){return/\bstring\b/.test(T.getTokenTypeAt(V(B.line,0)))&&!/^[\'\"\`]/.test(C)}function _(T,B){var C=T.getMode();return C.useInnerComments===!1||!C.innerMode?C:T.getModeAt(B)}y.defineExtension("lineComment",function(T,B,C){C||(C=H);var M=this,W=_(M,T),Z=M.getLine(T.line);if(!(Z==null||D(M,T,Z))){var O=C.lineComment||W.lineComment;if(!O){(C.blockCommentStart||W.blockCommentStart)&&(C.fullLines=!0,M.blockComment(T,B,C));return}var S=Math.min(B.ch!=0||B.line==T.line?B.line+1:B.line,M.lastLine()+1),v=C.padding==null?" ":C.padding,g=C.commentBlankLines||T.line==B.line;M.operation(function(){if(C.indent){for(var u=null,p=T.line;pw.length)&&(u=w)}for(var p=T.line;pS||M.operation(function(){if(C.fullLines!=!1){var g=z.test(M.getLine(S));M.replaceRange(v+O,V(S)),M.replaceRange(Z+v,V(T.line,0));var u=C.blockCommentLead||W.blockCommentLead;if(u!=null)for(var p=T.line+1;p<=S;++p)(p!=S||g)&&M.replaceRange(u+v,V(p,0))}else{var m=re(M.getCursor("to"),B)==0,w=!M.somethingSelected();M.replaceRange(O,B),m&&M.setSelection(w?B:M.getCursor("from"),B),M.replaceRange(Z,T)}})}}),y.defineExtension("uncomment",function(T,B,C){C||(C=H);var M=this,W=_(M,T),Z=Math.min(B.ch!=0||B.line==T.line?B.line:B.line-1,M.lastLine()),O=Math.min(T.line,Z),S=C.lineComment||W.lineComment,v=[],g=C.padding==null?" ":C.padding,u;e:{if(!S)break e;for(var p=O;p<=Z;++p){var m=M.getLine(p),w=m.indexOf(S);if(w>-1&&!/comment/.test(M.getTokenTypeAt(V(p,w+1)))&&(w=-1),w==-1&&z.test(m)||w>-1&&z.test(m.slice(0,w)))break e;v.push(m)}if(M.operation(function(){for(var ce=O;ce<=Z;++ce){var we=v[ce-O],Be=we.indexOf(S),Me=Be+S.length;Be<0||(we.slice(Me,Me+g.length)==g&&(Me+=g.length),u=!0,M.replaceRange("",V(ce,Be),V(ce,Me)))}}),u)return!0}var d=C.blockCommentStart||W.blockCommentStart,L=C.blockCommentEnd||W.blockCommentEnd;if(!d||!L)return!1;var F=C.blockCommentLead||W.blockCommentLead,N=M.getLine(O),U=N.indexOf(d);if(U==-1)return!1;var A=Z==O?N:M.getLine(Z),G=A.indexOf(L,Z==O?U+d.length:0),c=V(O,U+1),Q=V(Z,G+1);if(G==-1||!/comment/.test(M.getTokenTypeAt(c))||!/comment/.test(M.getTokenTypeAt(Q))||M.getRange(c,Q,` `).indexOf(L)>-1)return!1;var j=N.lastIndexOf(d,T.ch),ne=j==-1?-1:N.slice(0,T.ch).indexOf(L,j+d.length);if(j!=-1&&ne!=-1&&ne+L.length!=T.ch)return!1;ne=A.indexOf(L,B.ch);var fe=A.slice(B.ch).lastIndexOf(d,ne-B.ch);return j=ne==-1||fe==-1?-1:B.ch+fe,ne!=-1&&j!=-1&&j!=B.ch?!1:(M.operation(function(){M.replaceRange("",V(Z,G-(g&&A.slice(G-g.length,G)==g?g.length:0)),V(Z,G+L.length));var ce=U+d.length;if(g&&N.slice(ce,ce+g.length)==g&&(ce+=g.length),M.replaceRange("",V(O,U),V(O,ce)),F)for(var we=O+1;we<=Z;++we){var Be=M.getLine(we),Me=Be.indexOf(F);if(!(Me==-1||z.test(Be.slice(0,Me)))){var Ge=Me+F.length;g&&Be.slice(Ge,Ge+g.length)==g&&(Ge+=g.length),M.replaceRange("",V(we,Me),V(we,Ge))}}}),!0)})})})();var Vu={exports:{}};(function(We,Ie){(function(y){y(nt)})(function(y){function H(I,D,_,T){if(_&&_.call){var B=_;_=null}else var B=re(I,_,"rangeFinder");typeof D=="number"&&(D=y.Pos(D,0));var C=re(I,_,"minFoldSize");function M(S){var v=B(I,D);if(!v||v.to.line-v.from.lineI.firstLine();)D=y.Pos(D.line-1,0),W=M(!1);if(!(!W||W.cleared||T==="unfold")){var Z=z(I,_,W);y.on(Z,"mousedown",function(S){O.clear(),y.e_preventDefault(S)});var O=I.markText(W.from,W.to,{replacedWith:Z,clearOnEnter:re(I,_,"clearOnEnter"),__isFold:!0});O.on("clear",function(S,v){y.signal(I,"unfold",I,S,v)}),y.signal(I,"fold",I,W.from,W.to)}}function z(I,D,_){var T=re(I,D,"widget");if(typeof T=="function"&&(T=T(_.from,_.to)),typeof T=="string"){var B=document.createTextNode(T);T=document.createElement("span"),T.appendChild(B),T.className="CodeMirror-foldmarker"}else T&&(T=T.cloneNode(!0));return T}y.newFoldFunction=function(I,D){return function(_,T){H(_,T,{rangeFinder:I,widget:D})}},y.defineExtension("foldCode",function(I,D,_){H(this,I,D,_)}),y.defineExtension("isFolded",function(I){for(var D=this.findMarksAt(I),_=0;_=p){if(d&&N&&d.test(N.className))return;F=I(g.indicatorOpen)}}!F&&!N||O.setGutterMarker(L,g.gutter,F)})}function _(O){return new RegExp("(^|\\s)"+O+"(?:$|\\s)\\s*")}function T(O){var S=O.getViewport(),v=O.state.foldGutter;v&&(O.operation(function(){D(O,S.from,S.to)}),v.from=S.from,v.to=S.to)}function B(O,S,v){var g=O.state.foldGutter;if(g){var u=g.options;if(v==u.gutter){var p=re(O,S);p?p.clear():O.foldCode(H(S,0),u)}}}function C(O,S){S=="mode"&&M(O)}function M(O){var S=O.state.foldGutter;if(S){var v=S.options;S.from=S.to=0,clearTimeout(S.changeUpdate),S.changeUpdate=setTimeout(function(){T(O)},v.foldOnChangeTimeSpan||600)}}function W(O){var S=O.state.foldGutter;if(S){var v=S.options;clearTimeout(S.changeUpdate),S.changeUpdate=setTimeout(function(){var g=O.getViewport();S.from==S.to||g.from-S.to>20||S.from-g.to>20?T(O):O.operation(function(){g.fromS.to&&(D(O,S.to,g.to),S.to=g.to)})},v.updateViewportTimeSpan||400)}}function Z(O,S){var v=O.state.foldGutter;if(v){var g=S.line;g>=v.from&&gz.lastLine())return null;var M=z.getTokenAt(y.Pos(C,1));if(/\S/.test(M.string)||(M=z.getTokenAt(y.Pos(C,M.end+1))),M.type!="keyword"||M.string!="import")return null;for(var W=C,Z=Math.min(z.lastLine(),C+10);W<=Z;++W){var O=z.getLine(W),S=O.indexOf(";");if(S!=-1)return{startCh:M.end,end:y.Pos(W,S)}}}var I=V.line,D=re(I),_;if(!D||re(I-1)||(_=re(I-2))&&_.end.line==I-1)return null;for(var T=D.end;;){var B=re(T.line+1);if(B==null)break;T=B.end}return{from:z.clipPos(y.Pos(I,D.startCh+1)),to:T}}),y.registerHelper("fold","include",function(z,V){function re(B){if(Bz.lastLine())return null;var C=z.getTokenAt(y.Pos(B,1));if(/\S/.test(C.string)||(C=z.getTokenAt(y.Pos(B,C.end+1))),C.type=="meta"&&C.string.slice(0,8)=="#include")return C.start+8}var I=V.line,D=re(I);if(D==null||re(I-1)!=null)return null;for(var _=I;;){var T=re(_+1);if(T==null)break;++_}return{from:y.Pos(I,D+1),to:z.clipPos(y.Pos(_))}})})})();(function(We,Ie){(function(y){y(nt)})(function(y){function H(z,V){var re=z.getLine(V),I=re.search(/\S/);return I==-1||/\bcomment\b/.test(z.getTokenTypeAt(y.Pos(V,I+1)))?-1:y.countColumn(re,null,z.getOption("tabSize"))}y.registerHelper("fold","indent",function(z,V){var re=H(z,V.line);if(!(re<0)){for(var I=null,D=V.line+1,_=z.lastLine();D<=_;++D){var T=H(z,D);if(T!=-1)if(T>re)I=D;else break}if(I)return{from:y.Pos(V.line,z.getLine(V.line).length),to:y.Pos(I,z.getLine(I).length)}}})})})();(function(We,Ie){(function(y){y(nt)})(function(y){y.registerGlobalHelper("fold","comment",function(H){return H.blockCommentStart&&H.blockCommentEnd},function(H,z){var V=H.getModeAt(z),re=V.blockCommentStart,I=V.blockCommentEnd;if(!(!re||!I)){for(var D=z.line,_=H.getLine(D),T,B=z.ch,C=0;;){var M=B<=0?-1:_.lastIndexOf(re,B-1);if(M==-1){if(C==1)return;C=1,B=_.length;continue}if(C==1&&Md);L++){var F=v.getLine(w++);p=p==null?F:p+` `+F}m=m*2,g.lastIndex=u.ch;var N=g.exec(p);if(N){var U=p.slice(0,N.index).split(` `),A=N[0].split(` `),G=u.line+U.length-1,c=U[U.length-1].length;return{from:H(G,c),to:H(G+A.length-1,A.length==1?c+A[0].length:A[A.length-1].length),match:N}}}}function _(v,g,u){for(var p,m=0;m<=v.length;){g.lastIndex=m;var w=g.exec(v);if(!w)break;var d=w.index+w[0].length;if(d>v.length-u)break;(!p||d>p.index+p[0].length)&&(p=w),m=w.index+1}return p}function T(v,g,u){g=V(g,"g");for(var p=u.line,m=u.ch,w=v.firstLine();p>=w;p--,m=-1){var d=v.getLine(p),L=_(d,g,m<0?0:d.length-m);if(L)return{from:H(p,L.index),to:H(p,L.index+L[0].length),match:L}}}function B(v,g,u){if(!re(g))return T(v,g,u);g=V(g,"gm");for(var p,m=1,w=v.getLine(u.line).length-u.ch,d=u.line,L=v.firstLine();d>=L;){for(var F=0;F=L;F++){var N=v.getLine(d--);p=p==null?N:N+` `+p}m*=2;var U=_(p,g,w);if(U){var A=p.slice(0,U.index).split(` `),G=U[0].split(` `),c=d+A.length,Q=A[A.length-1].length;return{from:H(c,Q),to:H(c+G.length-1,G.length==1?Q+G[0].length:G[G.length-1].length),match:U}}}}var C,M;String.prototype.normalize?(C=function(v){return v.normalize("NFD").toLowerCase()},M=function(v){return v.normalize("NFD")}):(C=function(v){return v.toLowerCase()},M=function(v){return v});function W(v,g,u,p){if(v.length==g.length)return u;for(var m=0,w=u+Math.max(0,v.length-g.length);;){if(m==w)return m;var d=m+w>>1,L=p(v.slice(0,d)).length;if(L==u)return d;L>u?w=d:m=d+1}}function Z(v,g,u,p){if(!g.length)return null;var m=p?C:M,w=m(g).split(/\r|\n\r?/);e:for(var d=u.line,L=u.ch,F=v.lastLine()+1-w.length;d<=F;d++,L=0){var N=v.getLine(d).slice(L),U=m(N);if(w.length==1){var A=U.indexOf(w[0]);if(A==-1)continue e;var u=W(N,U,A,m)+L;return{from:H(d,W(N,U,A,m)+L),to:H(d,W(N,U,A+w[0].length,m)+L)}}else{var G=U.length-w[0].length;if(U.slice(G)!=w[0])continue e;for(var c=1;c=F;d--,L=-1){var N=v.getLine(d);L>-1&&(N=N.slice(0,L));var U=m(N);if(w.length==1){var A=U.lastIndexOf(w[0]);if(A==-1)continue e;return{from:H(d,W(N,U,A,m)),to:H(d,W(N,U,A+w[0].length,m))}}else{var G=w[w.length-1];if(U.slice(0,G.length)!=G)continue e;for(var c=1,u=d-w.length+1;c(this.doc.getLine(g.line)||"").length&&(g.ch=0,g.line++)),y.cmpPos(g,this.doc.clipPos(g))!=0))return this.atOccurrence=!1;var u=this.matches(v,g);if(this.afterEmptyMatch=u&&y.cmpPos(u.from,u.to)==0,u)return this.pos=u,this.atOccurrence=!0,this.pos.match||!0;var p=H(v?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:p,to:p},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(v,g){if(this.atOccurrence){var u=y.splitLines(v);this.doc.replaceRange(u,this.pos.from,this.pos.to,g),this.pos.to=H(this.pos.from.line+u.length-1,u[u.length-1].length+(u.length==1?this.pos.from.ch:0))}}},y.defineExtension("getSearchCursor",function(v,g,u){return new S(this.doc,v,g,u)}),y.defineDocExtension("getSearchCursor",function(v,g,u){return new S(this,v,g,u)}),y.defineExtension("selectMatches",function(v,g){for(var u=[],p=this.getSearchCursor(v,this.getCursor("from"),g);p.findNext()&&!(y.cmpPos(p.to(),this.getCursor("to"))>0);)u.push({anchor:p.from(),head:p.to()});u.length&&this.setSelections(u,0)})})}()),wl.exports}var Cl={exports:{}},Ll;function Fl(){return Ll||(Ll=1,function(We,Ie){(function(y){y(nt)})(function(y){function H(V,re,I){var D=V.getWrapperElement(),_;return _=D.appendChild(document.createElement("div")),I?_.className="CodeMirror-dialog CodeMirror-dialog-bottom":_.className="CodeMirror-dialog CodeMirror-dialog-top",typeof re=="string"?_.innerHTML=re:_.appendChild(re),y.addClass(D,"dialog-opened"),_}function z(V,re){V.state.currentNotificationClose&&V.state.currentNotificationClose(),V.state.currentNotificationClose=re}y.defineExtension("openDialog",function(V,re,I){I||(I={}),z(this,null);var D=H(this,V,I.bottom),_=!1,T=this;function B(W){if(typeof W=="string")C.value=W;else{if(_)return;_=!0,y.rmClass(D.parentNode,"dialog-opened"),D.parentNode.removeChild(D),T.focus(),I.onClose&&I.onClose(D)}}var C=D.getElementsByTagName("input")[0],M;return C?(C.focus(),I.value&&(C.value=I.value,I.selectValueOnOpen!==!1&&C.select()),I.onInput&&y.on(C,"input",function(W){I.onInput(W,C.value,B)}),I.onKeyUp&&y.on(C,"keyup",function(W){I.onKeyUp(W,C.value,B)}),y.on(C,"keydown",function(W){I&&I.onKeyDown&&I.onKeyDown(W,C.value,B)||((W.keyCode==27||I.closeOnEnter!==!1&&W.keyCode==13)&&(C.blur(),y.e_stop(W),B()),W.keyCode==13&&re(C.value,W))}),I.closeOnBlur!==!1&&y.on(D,"focusout",function(W){W.relatedTarget!==null&&B()})):(M=D.getElementsByTagName("button")[0])&&(y.on(M,"click",function(){B(),T.focus()}),I.closeOnBlur!==!1&&y.on(M,"blur",B),M.focus()),B}),y.defineExtension("openConfirm",function(V,re,I){z(this,null);var D=H(this,V,I&&I.bottom),_=D.getElementsByTagName("button"),T=!1,B=this,C=1;function M(){T||(T=!0,y.rmClass(D.parentNode,"dialog-opened"),D.parentNode.removeChild(D),B.focus())}_[0].focus();for(var W=0;W<_.length;++W){var Z=_[W];(function(O){y.on(Z,"click",function(S){y.e_preventDefault(S),M(),O&&O(B)})})(re[W]),y.on(Z,"blur",function(){--C,setTimeout(function(){C<=0&&M()},200)}),y.on(Z,"focus",function(){++C})}}),y.defineExtension("openNotification",function(V,re){z(this,B);var I=H(this,V,re&&re.bottom),D=!1,_,T=re&&typeof re.duration<"u"?re.duration:5e3;function B(){D||(D=!0,clearTimeout(_),y.rmClass(I.parentNode,"dialog-opened"),I.parentNode.removeChild(I))}return y.on(I,"click",function(C){y.e_preventDefault(C),B()}),T&&(_=setTimeout(B,T)),B})})}()),Cl.exports}(function(We,Ie){(function(y){y(nt,ho(),Fl())})(function(y){y.defineOption("search",{bottom:!1});function H(d,L){return typeof d=="string"?d=new RegExp(d.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),L?"gi":"g"):d.global||(d=new RegExp(d.source,d.ignoreCase?"gi":"g")),{token:function(F){d.lastIndex=F.pos;var N=d.exec(F.string);if(N&&N.index==F.pos)return F.pos+=N[0].length||1,"searching";N?F.pos=N.index:F.skipToEnd()}}}function z(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function V(d){return d.state.search||(d.state.search=new z)}function re(d){return typeof d=="string"&&d==d.toLowerCase()}function I(d,L,F){return d.getSearchCursor(L,F,{caseFold:re(L),multiline:!0})}function D(d,L,F,N,U){d.openDialog(L,N,{value:F,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){O(d)},onKeyDown:U,bottom:d.options.search.bottom})}function _(d,L,F,N,U){d.openDialog?d.openDialog(L,U,{value:N,selectValueOnOpen:!0,bottom:d.options.search.bottom}):U(prompt(F,N))}function T(d,L,F,N){d.openConfirm?d.openConfirm(L,N):confirm(F)&&N[0]()}function B(d){return d.replace(/\\([nrt\\])/g,function(L,F){return F=="n"?` `:F=="r"?"\r":F=="t"?" ":F=="\\"?"\\":L})}function C(d){var L=d.match(/^\/(.*)\/([a-z]*)$/);if(L)try{d=new RegExp(L[1],L[2].indexOf("i")==-1?"":"i")}catch{}else d=B(d);return(typeof d=="string"?d=="":d.test(""))&&(d=/x^/),d}function M(d,L,F){L.queryText=F,L.query=C(F),d.removeOverlay(L.overlay,re(L.query)),L.overlay=H(L.query,re(L.query)),d.addOverlay(L.overlay),d.showMatchesOnScrollbar&&(L.annotate&&(L.annotate.clear(),L.annotate=null),L.annotate=d.showMatchesOnScrollbar(L.query,re(L.query)))}function W(d,L,F,N){var U=V(d);if(U.query)return Z(d,L);var A=d.getSelection()||U.lastQuery;if(A instanceof RegExp&&A.source=="x^"&&(A=null),F&&d.openDialog){var G=null,c=function(Q,j){y.e_stop(j),Q&&(Q!=U.queryText&&(M(d,U,Q),U.posFrom=U.posTo=d.getCursor()),G&&(G.style.opacity=1),Z(d,j.shiftKey,function(ne,fe){var ce;fe.line<3&&document.querySelector&&(ce=d.display.wrapper.querySelector(".CodeMirror-dialog"))&&ce.getBoundingClientRect().bottom-4>d.cursorCoords(fe,"window").top&&((G=ce).style.opacity=.4)}))};D(d,v(d),A,c,function(Q,j){var ne=y.keyName(Q),fe=d.getOption("extraKeys"),ce=fe&&fe[ne]||y.keyMap[d.getOption("keyMap")][ne];ce=="findNext"||ce=="findPrev"||ce=="findPersistentNext"||ce=="findPersistentPrev"?(y.e_stop(Q),M(d,V(d),j),d.execCommand(ce)):(ce=="find"||ce=="findPersistent")&&(y.e_stop(Q),c(j,Q))}),N&&A&&(M(d,U,A),Z(d,L))}else _(d,v(d),"Search for:",A,function(Q){Q&&!U.query&&d.operation(function(){M(d,U,Q),U.posFrom=U.posTo=d.getCursor(),Z(d,L)})})}function Z(d,L,F){d.operation(function(){var N=V(d),U=I(d,N.query,L?N.posFrom:N.posTo);!U.find(L)&&(U=I(d,N.query,L?y.Pos(d.lastLine()):y.Pos(d.firstLine(),0)),!U.find(L))||(d.setSelection(U.from(),U.to()),d.scrollIntoView({from:U.from(),to:U.to()},20),N.posFrom=U.from(),N.posTo=U.to(),F&&F(U.from(),U.to()))})}function O(d){d.operation(function(){var L=V(d);L.lastQuery=L.query,L.query&&(L.query=L.queryText=null,d.removeOverlay(L.overlay),L.annotate&&(L.annotate.clear(),L.annotate=null))})}function S(d,L){var F=d?document.createElement(d):document.createDocumentFragment();for(var N in L)F[N]=L[N];for(var U=2;U",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function re(C){return C&&C.bracketRegex||/[(){}[\]]/}function I(C,M,W){var Z=C.getLineHandle(M.line),O=M.ch-1,S=W&&W.afterCursor;S==null&&(S=/(^| )cm-fat-cursor($| )/.test(C.getWrapperElement().className));var v=re(W),g=!S&&O>=0&&v.test(Z.text.charAt(O))&&V[Z.text.charAt(O)]||v.test(Z.text.charAt(O+1))&&V[Z.text.charAt(++O)];if(!g)return null;var u=g.charAt(1)==">"?1:-1;if(W&&W.strict&&u>0!=(O==M.ch))return null;var p=C.getTokenTypeAt(z(M.line,O+1)),m=D(C,z(M.line,O+(u>0?1:0)),u,p,W);return m==null?null:{from:z(M.line,O),to:m&&m.pos,match:m&&m.ch==g.charAt(0),forward:u>0}}function D(C,M,W,Z,O){for(var S=O&&O.maxScanLineLength||1e4,v=O&&O.maxScanLines||1e3,g=[],u=re(O),p=W>0?Math.min(M.line+v,C.lastLine()+1):Math.max(C.firstLine()-1,M.line-v),m=M.line;m!=p;m+=W){var w=C.getLine(m);if(w){var d=W>0?0:w.length-1,L=W>0?w.length:-1;if(!(w.length>S))for(m==M.line&&(d=M.ch-(W<0?1:0));d!=L;d+=W){var F=w.charAt(d);if(u.test(F)&&(Z===void 0||(C.getTokenTypeAt(z(m,d+1))||"")==(Z||""))){var N=V[F];if(N&&N.charAt(1)==">"==W>0)g.push(F);else if(g.length)g.pop();else return{pos:z(m,d),ch:F}}}}}return m-W==(W>0?C.lastLine():C.firstLine())?!1:null}function _(C,M,W){for(var Z=C.state.matchBrackets.maxHighlightLineLength||1e3,O=W&&W.highlightNonMatching,S=[],v=C.listSelections(),g=0;g0&&p.ch>=w.length)return u.clipPos(z(p.line+1,0));for(var d="start",L,F=p.ch,N=F,U=m<0?0:w.length,A=0;N!=U;N+=m,A++){var G=w.charAt(m<0?N-1:N),c=G!="_"&&y.isWordChar(G)?"w":"o";if(c=="w"&&G.toUpperCase()==G&&(c="W"),d=="start")c!="o"?(d="in",L=c):F=N+m;else if(d=="in"&&L!=c){if(L=="w"&&c=="W"&&m<0&&N--,L=="W"&&c=="w"&&m>0)if(N==F+1){L="w";continue}else N--;break}}return z(p.line,N)}function re(u,p){u.extendSelectionsBy(function(m){return u.display.shift||u.doc.extend||m.empty()?V(u.doc,m.head,p):p<0?m.from():m.to()})}H.goSubwordLeft=function(u){re(u,-1)},H.goSubwordRight=function(u){re(u,1)},H.scrollLineUp=function(u){var p=u.getScrollInfo();if(!u.somethingSelected()){var m=u.lineAtHeight(p.top+p.clientHeight,"local");u.getCursor().line>=m&&u.execCommand("goLineUp")}u.scrollTo(null,p.top-u.defaultTextHeight())},H.scrollLineDown=function(u){var p=u.getScrollInfo();if(!u.somethingSelected()){var m=u.lineAtHeight(p.top,"local")+1;u.getCursor().line<=m&&u.execCommand("goLineDown")}u.scrollTo(null,p.top+u.defaultTextHeight())},H.splitSelectionByLine=function(u){for(var p=u.listSelections(),m=[],w=0;wd.line&&F==L.line&&L.ch==0||m.push({anchor:F==d.line?d:z(F,0),head:F==L.line?L:z(F)});u.setSelections(m,0)},H.singleSelectionTop=function(u){var p=u.listSelections()[0];u.setSelection(p.anchor,p.head,{scroll:!1})},H.selectLine=function(u){for(var p=u.listSelections(),m=[],w=0;ww?m.push(N,U):m.length&&(m[m.length-1]=U),w=U}u.operation(function(){for(var A=0;Au.lastLine()?u.replaceRange(` `+Q,z(u.lastLine()),null,"+swapLine"):u.replaceRange(Q+` `,z(c,0),null,"+swapLine")}u.setSelections(d),u.scrollIntoView()})},H.swapLineDown=function(u){if(u.isReadOnly())return y.Pass;for(var p=u.listSelections(),m=[],w=u.lastLine()+1,d=p.length-1;d>=0;d--){var L=p[d],F=L.to().line+1,N=L.from().line;L.to().ch==0&&!L.empty()&&F--,F=0;U-=2){var A=m[U],G=m[U+1],c=u.getLine(A);A==u.lastLine()?u.replaceRange("",z(A-1),z(A),"+swapLine"):u.replaceRange("",z(A,0),z(A+1,0),"+swapLine"),u.replaceRange(c+` `,z(G,0),null,"+swapLine")}u.scrollIntoView()})},H.toggleCommentIndented=function(u){u.toggleComment({indent:!0})},H.joinLines=function(u){for(var p=u.listSelections(),m=[],w=0;w=0;L--){var F=m[w[L]];if(!(N&&y.cmpPos(F.head,N)>0)){var U=D(u,F.head);N=U.from,u.replaceRange(p(U.word),U.from,U.to)}}})}H.smartBackspace=function(u){if(u.somethingSelected())return y.Pass;u.operation(function(){for(var p=u.listSelections(),m=u.getOption("indentUnit"),w=p.length-1;w>=0;w--){var d=p[w].head,L=u.getRange({line:d.line,ch:0},d),F=y.countColumn(L,null,u.getOption("tabSize")),N=u.findPosH(d,-1,"char",!1);if(L&&!/\S/.test(L)&&F%m==0){var U=new z(d.line,y.findColumn(L,F-m,m));U.ch!=d.ch&&(N=U)}u.replaceRange("",N,d,"+delete")}})},H.delLineRight=function(u){u.operation(function(){for(var p=u.listSelections(),m=p.length-1;m>=0;m--)u.replaceRange("",p[m].anchor,z(p[m].to().line),"+delete");u.scrollIntoView()})},H.upcaseAtCursor=function(u){Z(u,function(p){return p.toUpperCase()})},H.downcaseAtCursor=function(u){Z(u,function(p){return p.toLowerCase()})},H.setSublimeMark=function(u){u.state.sublimeMark&&u.state.sublimeMark.clear(),u.state.sublimeMark=u.setBookmark(u.getCursor())},H.selectToSublimeMark=function(u){var p=u.state.sublimeMark&&u.state.sublimeMark.find();p&&u.setSelection(u.getCursor(),p)},H.deleteToSublimeMark=function(u){var p=u.state.sublimeMark&&u.state.sublimeMark.find();if(p){var m=u.getCursor(),w=p;if(y.cmpPos(m,w)>0){var d=w;w=m,m=d}u.state.sublimeKilled=u.getRange(m,w),u.replaceRange("",m,w)}},H.swapWithSublimeMark=function(u){var p=u.state.sublimeMark&&u.state.sublimeMark.find();p&&(u.state.sublimeMark.clear(),u.state.sublimeMark=u.setBookmark(u.getCursor()),u.setCursor(p))},H.sublimeYank=function(u){u.state.sublimeKilled!=null&&u.replaceSelection(u.state.sublimeKilled,null,"paste")},H.showInCenter=function(u){var p=u.cursorCoords(null,"local");u.scrollTo(null,(p.top+p.bottom)/2-u.getScrollInfo().clientHeight/2)};function O(u){var p=u.getCursor("from"),m=u.getCursor("to");if(y.cmpPos(p,m)==0){var w=D(u,p);if(!w.word)return;p=w.from,m=w.to}return{from:p,to:m,query:u.getRange(p,m),word:w}}function S(u,p){var m=O(u);if(m){var w=m.query,d=u.getSearchCursor(w,p?m.to:m.from);(p?d.findNext():d.findPrevious())?u.setSelection(d.from(),d.to()):(d=u.getSearchCursor(w,p?z(u.firstLine(),0):u.clipPos(z(u.lastLine()))),(p?d.findNext():d.findPrevious())?u.setSelection(d.from(),d.to()):m.word&&u.setSelection(m.from,m.to))}}H.findUnder=function(u){S(u,!0)},H.findUnderPrevious=function(u){S(u,!1)},H.findAllUnder=function(u){var p=O(u);if(p){for(var m=u.getSearchCursor(p.query),w=[],d=-1;m.findNext();)w.push({anchor:m.from(),head:m.to()}),m.from().line<=p.from.line&&m.from().ch<=p.from.ch&&d++;u.setSelections(w,d)}};var v=y.keyMap;v.macSublime={"Cmd-Left":"goLineStartSmart","Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Ctrl-Alt-Up":"scrollLineUp","Ctrl-Alt-Down":"scrollLineDown","Cmd-L":"selectLine","Shift-Cmd-L":"splitSelectionByLine",Esc:"singleSelectionTop","Cmd-Enter":"insertLineAfter","Shift-Cmd-Enter":"insertLineBefore","Cmd-D":"selectNextOccurrence","Shift-Cmd-Space":"selectScope","Shift-Cmd-M":"selectBetweenBrackets","Cmd-M":"goToBracket","Cmd-Ctrl-Up":"swapLineUp","Cmd-Ctrl-Down":"swapLineDown","Cmd-/":"toggleCommentIndented","Cmd-J":"joinLines","Shift-Cmd-D":"duplicateLine",F5:"sortLines","Shift-F5":"reverseSortLines","Cmd-F5":"sortLinesInsensitive","Shift-Cmd-F5":"reverseSortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Cmd-F2":"toggleBookmark","Shift-Cmd-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Cmd-K Cmd-D":"skipAndSelectNextOccurrence","Cmd-K Cmd-K":"delLineRight","Cmd-K Cmd-U":"upcaseAtCursor","Cmd-K Cmd-L":"downcaseAtCursor","Cmd-K Cmd-Space":"setSublimeMark","Cmd-K Cmd-A":"selectToSublimeMark","Cmd-K Cmd-W":"deleteToSublimeMark","Cmd-K Cmd-X":"swapWithSublimeMark","Cmd-K Cmd-Y":"sublimeYank","Cmd-K Cmd-C":"showInCenter","Cmd-K Cmd-G":"clearBookmarks","Cmd-K Cmd-Backspace":"delLineLeft","Cmd-K Cmd-1":"foldAll","Cmd-K Cmd-0":"unfoldAll","Cmd-K Cmd-J":"unfoldAll","Ctrl-Shift-Up":"addCursorToPrevLine","Ctrl-Shift-Down":"addCursorToNextLine","Cmd-F3":"findUnder","Shift-Cmd-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Cmd-[":"fold","Shift-Cmd-]":"unfold","Cmd-I":"findIncremental","Shift-Cmd-I":"findIncrementalReverse","Cmd-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"macDefault"},y.normalizeKeyMap(v.macSublime),v.pcSublime={"Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-T":"transposeChars","Alt-Left":"goSubwordLeft","Alt-Right":"goSubwordRight","Ctrl-Up":"scrollLineUp","Ctrl-Down":"scrollLineDown","Ctrl-L":"selectLine","Shift-Ctrl-L":"splitSelectionByLine",Esc:"singleSelectionTop","Ctrl-Enter":"insertLineAfter","Shift-Ctrl-Enter":"insertLineBefore","Ctrl-D":"selectNextOccurrence","Shift-Ctrl-Space":"selectScope","Shift-Ctrl-M":"selectBetweenBrackets","Ctrl-M":"goToBracket","Shift-Ctrl-Up":"swapLineUp","Shift-Ctrl-Down":"swapLineDown","Ctrl-/":"toggleCommentIndented","Ctrl-J":"joinLines","Shift-Ctrl-D":"duplicateLine",F9:"sortLines","Shift-F9":"reverseSortLines","Ctrl-F9":"sortLinesInsensitive","Shift-Ctrl-F9":"reverseSortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Ctrl-F2":"toggleBookmark","Shift-Ctrl-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Ctrl-K Ctrl-D":"skipAndSelectNextOccurrence","Ctrl-K Ctrl-K":"delLineRight","Ctrl-K Ctrl-U":"upcaseAtCursor","Ctrl-K Ctrl-L":"downcaseAtCursor","Ctrl-K Ctrl-Space":"setSublimeMark","Ctrl-K Ctrl-A":"selectToSublimeMark","Ctrl-K Ctrl-W":"deleteToSublimeMark","Ctrl-K Ctrl-X":"swapWithSublimeMark","Ctrl-K Ctrl-Y":"sublimeYank","Ctrl-K Ctrl-C":"showInCenter","Ctrl-K Ctrl-G":"clearBookmarks","Ctrl-K Ctrl-Backspace":"delLineLeft","Ctrl-K Ctrl-1":"foldAll","Ctrl-K Ctrl-0":"unfoldAll","Ctrl-K Ctrl-J":"unfoldAll","Ctrl-Alt-Up":"addCursorToPrevLine","Ctrl-Alt-Down":"addCursorToNextLine","Ctrl-F3":"findUnder","Shift-Ctrl-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Ctrl-[":"fold","Shift-Ctrl-]":"unfold","Ctrl-I":"findIncremental","Shift-Ctrl-I":"findIncrementalReverse","Ctrl-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"pcDefault"},y.normalizeKeyMap(v.pcSublime);var g=v.default==v.macDefault;v.sublime=g?v.macSublime:v.pcSublime})})();const tf=["onKeydown"],rf=Nl({__name:"CodeMirror",props:{mode:{default:"htmlmixed"},value:{default:""},readonly:{type:Boolean,default:!1}},emits:["change"],setup(We,{emit:Ie}){const y=We,H=Ie,z=Hu("container"),{autoResize:V,autoSave:re}=zu(Gu);let I;const D=()=>{H("change",I.getValue())};return Ru(()=>{const _=y.readonly?{}:{autoCloseBrackets:!0,autoCloseTags:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],keyMap:"sublime"};I=ju(z.value,{value:"",mode:y.mode,readOnly:y.readonly,tabSize:2,lineWrapping:!0,lineNumbers:!0,..._}),dl(()=>{const T=I.getValue();y.value!==T&&I.setValue(y.value)}),dl(()=>{I.setOption("mode",y.mode)}),setTimeout(()=>{I.refresh()},50),V.value&&window.addEventListener("resize",qu(()=>{I.refresh()})),Ol(re,T=>{T&&(I.on("change",D),Ku(()=>I.off("change",D)))},{immediate:!0})}),(_,T)=>(Pl(),_u("div",{ref:"container",class:"editor",onKeydown:[pl(vl(D,["ctrl","prevent"]),["s"]),pl(vl(D,["meta","prevent"]),["s"])]},null,40,tf))}}),ff=Nl({editorType:"codemirror",__name:"CodeMirrorEditor",props:{value:{},filename:{},readonly:{type:Boolean},mode:{}},emits:["change"],setup(We,{emit:Ie}){const y=We,H=Ie,z=I=>{H("change",I)},V={css:"css",html:"htmlmixed",js:{name:"javascript"},json:{name:"javascript",json:!0},ts:{name:"javascript",typescript:!0},vue:"htmlmixed"},re=Iu(()=>{const{mode:I,filename:D}=y,_=V[I||D.split(".").pop()];return D.lastIndexOf(".")!==-1&&_?_:V.js});return(I,D)=>(Pl(),Bu(rf,{value:I.value,mode:re.value,readonly:I.readonly,onChange:z},null,8,["value","mode","readonly"]))}});export{ff as _,uf as u};