• /home/barbar84/www/wp-inclu.../js/codemirr...
• File: codemirror.min.js
• Dòng [
21/
28]:
k&&!Ce(a,e,!1))return g.length=0,{};j.push(ae(a,e));var f=c?Qd(a,e):p(g);He(a,e,f,ke(a,e)),!c&&a.cm&&a.cm.scrollIntoView({from:e.from,to:Od(e)});var h=[];Xd(a,function(a,b){b||m(h,a.history)!=-1||(Me(a.history,e),h.push(a.history)),He(a,e,null,ke(a,e))})},n=d.changes.length-1;n>=0;--n){var o=l(n);if(o)return o.v}}}}function Ge(a,b){if(0!=b&&(a.first+=b,a.sel=new xh(q(a.sel.ranges,function(a){return new yh(J(a.anchor.line+b,a.anchor.ch),J(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){qd(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)rd(a.cm,d,"gutter")}}function He(a,b,c,d){if(a.cm&&!a.cm.curOp)return nd(a.cm,He)(a,b,c,d);if(b.to.line<a.first)return void Ge(a,b.text.length-1-(b.to.line-b.from.line));if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Ge(a,e),b={from:J(a.first,0),to:J(b.to.line+e,b.to.ch),text:[p(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:J(f,B(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=C(a,b.from,b.to),c||(c=Qd(a,b)),a.cm?Ie(a.cm,b,d):Wd(a,b,d),ue(a,c,Ng)}}function Ie(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=F(la(B(d,f.line))),d.iter(i,g.line+1,function(a){if(a==e.maxLine)return h=!0,!0})),d.sel.contains(b.from,b.to)>-1&&Ga(a),Wd(d,b,c,wc(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=ta(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),ib(d,f.line),wd(a,400);var j=b.text.length-(g.line-f.line)-1;b.full?qd(a):f.line!=g.line||1!=b.text.length||Vd(a.doc,b)?qd(a,f.line,g.line+1,j):rd(a,f.line,"text");var k=Ha(a,"changes"),l=Ha(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&yb(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}a.display.selForContextMenu=null}function Je(a,b,c,d,e){if(d||(d=c),K(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),De(a,{from:c,to:d,text:b,origin:e})}function Ke(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Le(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)Ke(f.ranges[h].anchor,b,c,d),Ke(f.ranges[h].head,b,c,d)}else{for(var i=0;i<f.changes.length;++i){var j=f.changes[i];if(c<j.from.line)j.from=J(j.from.line+d,j.from.ch),j.to=J(j.to.line+d,j.to.ch);else if(b<=j.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Me(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Le(a.done,c,d,e),Le(a.undone,c,d,e)}function Ne(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=B(a,P(a,b)):e=F(b),null==e?null:(d(f,e)&&a.cm&&rd(a.cm,e,c),f)}function Oe(a){var b=this;this.lines=a,this.parent=null;for(var c=0,d=0;d<a.length;++d)a[d].parent=b,c+=a[d].height;this.height=c}function Pe(a){var b=this;this.children=a;for(var c=0,d=0,e=0;e<a.length;++e){var f=a[e];c+=f.chunkSize(),d+=f.height,f.parent=b}this.size=c,this.height=d,this.parent=null}function Qe(a,b,c){sa(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Tc(a,c)}function Re(a,b,c,d){var e=new zh(a,c,d),f=a.cm;return f&&e.noHScroll&&(f.display.alignWidgets=!0),Ne(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,f&&!qa(a,b)){var d=sa(b)<a.scrollTop;E(b,b.height+Mb(e)),d&&Tc(f,e.height),f.curOp.forceUpdate=!0}return!0}),yb(f,"lineWidgetAdded",f,e,"number"==typeof b?b:F(b)),e}function Se(a,b,c,d,f){if(d&&d.shared)return Te(a,b,c,d,f);if(a.cm&&!a.cm.curOp)return nd(a.cm,Se)(a,b,c,d,f);var g=new Bh(a,f),h=K(b,c);if(d&&k(d,g,!1),h>0||0==h&&g.clearWhenEmpty!==!1)return g;if(g.replacedWith&&(g.collapsed=!0,g.widgetNode=e("span",[g.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||g.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(g.widgetNode.insertLeft=!0)),g.collapsed){if(ka(a,b.line,b,c,g)||b.line!=c.line&&ka(a,c.line,b,c,g))throw new Error("Inserting collapsed marker partially overlapping an existing one");U()}g.addToHistory&&de(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var i,j=b.line,l=a.cm;if(a.iter(j,c.line+1,function(a){l&&g.collapsed&&!l.options.lineWrapping&&la(a)==l.display.maxLine&&(i=!0),g.collapsed&&j!=b.line&&E(a,0),Y(a,new V(g,j==b.line?b.ch:null,j==c.line?c.ch:null)),++j}),g.collapsed&&a.iter(b.line,c.line+1,function(b){qa(a,b)&&E(b,0)}),g.clearOnEnter&&Yg(g,"beforeCursorEnter",function(){return g.clear()}),g.readOnly&&(T(),(a.history.done.length||a.history.undone.length)&&a.clearHistory()),g.collapsed&&(g.id=++Ah,g.atomic=!0),l){if(i&&(l.curOp.updateMaxLine=!0),g.collapsed)qd(l,b.line,c.line+1);else if(g.className||g.title||g.startStyle||g.endStyle||g.css)for(var m=b.line;m<=c.line;m++)rd(l,m,"text");g.atomic&&we(l.doc),yb(l,"markerAdded",l,g)}return g}function Te(a,b,c,d,e){d=k(d),d.shared=!1;var f=[Se(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Xd(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Se(a,Q(a,b),Q(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=p(f)}),new Ch(f,g)}function Ue(a){return a.findMarks(J(a.first,0),a.clipPos(J(a.lastLine())),function(a){return a.parent})}function Ve(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(K(f,g)){var h=Se(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function We(a){for(var b=function(b){var c=a[b],d=[c.primary.doc];Xd(c.primary.doc,function(a){return d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];m(d,f.doc)==-1&&(f.parent=null,c.markers.splice(e--,1))}},c=0;c<a.length;c++)b(c)}function Xe(a){var b=this;if($e(b),!Fa(b,a)&&!Nb(b.display,a)){Ja(a),ng&&(Fh=+new Date);var c=yc(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||m(b.options.allowDropFileTypes,a.type)!=-1){var h=new FileReader;h.onload=nd(b,function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e){c=Q(b.doc,c);var i={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};De(b.doc,i),se(b.doc,Nd(c,Od(i)))}}),h.readAsText(a)}},i=0;i<e;++i)h(d[i],i);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),void setTimeout(function(){return b.display.input.focus()},20);try{var j=a.dataTransfer.getData("Text");if(j){var k;if(b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections()),ue(b.doc,Nd(c,c)),k)for(var l=0;l<k.length;++l)Je(b.doc,"",k[l].anchor,k[l].head,"drag");b.replaceSelection(j,"around","paste"),b.display.input.focus()}}catch(a){}}}}function Ye(a,b){if(ng&&(!a.state.draggingText||+new Date-Fh<100))return void Ma(b);if(!Fa(a,b)&&!Nb(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!tg)){var c=d("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",sg&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),sg&&c.parentNode.removeChild(c)}}function Ze(a,b){var e=yc(a,b);if(e){var f=document.createDocumentFragment();Cc(a,e,f),a.display.dragCursor||(a.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv)),c(a.display.dragCursor,f)}}function $e(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function _e(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function af(){Gh||(bf(),Gh=!0)}function bf(){var a;Yg(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,_e(cf)},100))}),Yg(window,"blur",function(){return _e(Jc)})}function cf(a){var b=a.display;b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth||(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function df(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else{if(!/^s(hift)?$/i.test(h))throw new Error("Unrecognized modifier name: "+h);e=!0}}return c&&(a="Alt-"+a),d&&(a="Ctrl-"+a),f&&(a="Cmd-"+a),e&&(a="Shift-"+a),a}function ef(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=q(c.split(" "),df),f=0;f<e.length;f++){var g=void 0,h=void 0;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var i=b[h];if(i){if(i!=g)throw new Error("Inconsistent bindings for "+h)}else b[h]=g}delete a[c]}for(var j in b)a[j]=b[j];return a}function ff(a,b,c,d){b=kf(b);var e=b.call?b.call(a,d):b[a];if(e===!1)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return ff(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=ff(a,b.fallthrough[f],c,d);if(g)return g}}}function gf(a){var b="string"==typeof a?a:Hh[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function hf(a,b,c){var d=a;return b.altKey&&"Alt"!=d&&(a="Alt-"+a),(Eg?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a),(Eg?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a),!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a),a}function jf(a,b){if(sg&&34==a.keyCode&&a["char"])return!1;var c=Hh[a.keyCode];return null!=c&&!a.altGraphKey&&hf(c,a,b)}function kf(a){return"string"==typeof a?Lh[a]:a}function lf(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&K(f.from,p(d).to)<=0;){var g=d.pop();if(K(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}md(a,function(){for(var b=d.length-1;b>=0;b--)Je(a.doc,"",d[b].from,d[b].to,"+delete");Uc(a)})}function mf(a,b){var c=B(a.doc,b),d=la(c);return d!=c&&(b=F(d)),Aa(!0,a,d,b,1)}function nf(a,b){var c=B(a.doc,b),d=ma(c);return d!=c&&(b=F(d)),Aa(!0,a,c,b,-1)}function of(a,b){var c=mf(a,b.line),d=B(a.doc,c.line),e=xa(d,a.doc.direction);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return J(c.line,g?0:f,c.sticky)}return c}function pf(a,b,c){if("string"==typeof b&&(b=Mh[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Mg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function qf(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=ff(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&ff(b,a.options.extraKeys,c,a)||ff(b,a.options.keyMap,c,a)}function rf(a,b,c,d){var e=a.state.keySeq;if(e){if(gf(b))return"handled";Nh.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())}),b=e+" "+b}var f=qf(a,b,d);return"multi"==f&&(a.state.keySeq=b),"handled"==f&&yb(a,"keyHandled",a,b,c),"handled"!=f&&"multi"!=f||(Ja(c),Fc(a)),e&&!f&&/\'$/.test(b)?(Ja(c),!0):!!f}function sf(a,b){var c=jf(b,!0);return!!c&&(b.shiftKey&&!a.state.keySeq?rf(a,"Shift-"+c,b,function(b){return pf(a,b,!0)})||rf(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return pf(a,b)}):rf(a,c,b,function(b){return pf(a,b)}))}function tf(a,b,c){return rf(a,"'"+c+"'",b,function(b){return pf(a,b,!0)})}function uf(a){var b=this;if(b.curOp.focus=g(),!Fa(b,a)){ng&&og<11&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var d=sf(b,a);sg&&(Oh=d?c:null,!d&&88==c&&!ah&&(zg?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||vf(b)}}function vf(a){function b(a){18!=a.keyCode&&a.altKey||(Gg(c,"CodeMirror-crosshair"),Da(document,"keyup",b),Da(document,"mouseover",b))}var c=a.display.lineDiv;h(c,"CodeMirror-crosshair"),Yg(document,"keyup",b),Yg(document,"mouseover",b)}function wf(a){16==a.keyCode&&(this.doc.sel.shift=!1),Fa(this,a)}function xf(a){var b=this;if(!(Nb(b.display,a)||Fa(b,a)||a.ctrlKey&&!a.altKey||zg&&a.metaKey)){var c=a.keyCode,d=a.charCode;if(sg&&c==Oh)return Oh=null,void Ja(a);if(!sg||a.which&&!(a.which<10)||!sf(b,a)){var e=String.fromCharCode(null==d?c:d);"\b"!=e&&(tf(b,a,e)||b.display.input.onKeyPress(a))}}}function yf(a,b){var c=+new Date;return Sh&&Sh.compare(c,a,b)?(Rh=Sh=null,"triple"):Rh&&Rh.compare(c,a,b)?(Sh=new Qh(c,a,b),Rh=null,"double"):(Rh=new Qh(c,a,b),Sh=null,"single")}function zf(a){var b=this,c=b.display;if(!(Fa(b,a)||c.activeTouch&&c.input.supportsTouch())){if(c.input.ensurePolled(),c.shift=a.shiftKey,Nb(c,a))return void(pg||(c.scroller.draggable=!1,setTimeout(function(){return c.scroller.draggable=!0},100)));if(!Hf(b,a)){var d=yc(b,a),e=Oa(a),f=d?yf(d,e):"single";window.focus(),1==e&&b.state.selectingText&&b.state.selectingText(a),d&&Af(b,e,d,f,a)||(1==e?d?Cf(b,d,f,a):Na(a)==c.scroller&&Ja(a):2==e?(d&&ne(b.doc,d),setTimeout(function(){return c.input.focus()},20)):3==e&&(Fg?If(b,a):Hc(b)))}}}function Af(a,b,c,d,e){var f="Click";return"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f),f=(1==b?"Left":2==b?"Middle":"Right")+f,rf(a,hf(f,e),e,function(b){if("string"==typeof b&&(b=Mh[b]),!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Mg}finally{a.state.suppressEdits=!1}return d})}function Bf(a,b,c){var d=a.getOption("configureMouse"),e=d?d(a,b,c):{};if(null==e.unit){var f=Ag?c.shiftKey&&c.metaKey:c.altKey;e.unit=f?"rectangle":"single"==b?"char":"double"==b?"word":"line"}return(null==e.extend||a.doc.extend)&&(e.extend=a.doc.extend||c.shiftKey),null==e.addNew&&(e.addNew=zg?c.metaKey:c.ctrlKey),null==e.moveOnDrag&&(e.moveOnDrag=!(zg?c.altKey:c.ctrlKey)),e}function Cf(a,b,c,d){ng?setTimeout(j(Gc,a),0):a.curOp.focus=g();var e,f=Bf(a,c,d),h=a.doc.sel;a.options.dragDrop&&Zg&&!a.isReadOnly()&&"single"==c&&(e=h.contains(b))>-1&&(K((e=h.ranges[e]).from(),b)<0||b.xRel>0)&&(K(e.to(),b)>0||b.xRel<0)?Df(a,d,b,f):Ff(a,d,b,f)}function Df(a,b,c,d){var e=a.display,f=!1,g=nd(a,function(b){pg&&(e.scroller.draggable=!1),a.state.draggingText=!1,Da(document,"mouseup",g),Da(document,"mousemove",h),Da(e.scroller,"dragstart",i),Da(e.scroller,"drop",g),f||(Ja(b),d.addNew||ne(a.doc,c,null,null,d.extend),pg||ng&&9==og?setTimeout(function(){document.body.focus(),e.input.focus()},20):e.input.focus())}),h=function(a){f=f||Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)>=10},i=function(){return f=!0};pg&&(e.scroller.draggable=!0),a.state.draggingText=g,g.copy=!d.moveOnDrag,e.scroller.dragDrop&&e.scroller.dragDrop(),Yg(document,"mouseup",g),Yg(document,"mousemove",h),Yg(e.scroller,"dragstart",i),Yg(e.scroller,"drop",g),Hc(a),setTimeout(function(){return e.input.focus()},20)}function Ef(a,b,c){if("char"==c)return new yh(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new yh(J(b.line,0),Q(a.doc,J(b.line+1,0)));var d=c(a,b);return new yh(d.from,d.to)}function Ff(a,b,c,d){function e(b){if(0!=K(r,b))if(r=b,"rectangle"==d.unit){for(var e=[],f=a.options.tabSize,g=l(B(j,c.line).text,c.ch,f),h=l(B(j,b.line).text,b.ch,f),i=Math.min(g,h),p=Math.max(g,h),q=Math.min(c.line,b.line),s=Math.min(a.lastLine(),Math.max(c.line,b.line));q<=s;q++){var t=B(j,q).text,u=n(t,i,f);i==p?e.push(new yh(J(q,u),J(q,u))):t.length>u&&e.push(new yh(J(q,u),J(q,n(t,p,f))))}e.length||e.push(new yh(c,c)),te(j,Md(o.ranges.slice(0,m).concat(e),m),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var v,w=k,x=Ef(a,b,d.unit),y=w.anchor;K(x.anchor,y)>0?(v=x.head,y=O(w.from(),x.anchor)):(v=x.anchor,y=N(w.to(),x.head));var z=o.ranges.slice(0);z[m]=new yh(Q(j,y),v),te(j,Md(z,m),Og)}}function f(b){var c=++t,h=yc(a,b,!0,"rectangle"==d.unit);if(h)if(0!=K(h,r)){a.curOp.focus=g(),e(h);var k=Mc(i,j);(h.line>=k.to||h.line<k.from)&&setTimeout(nd(a,function(){t==c&&f(b)}),150)}else{var l=b.clientY<s.top?-20:b.clientY>s.bottom?20:0;l&&setTimeout(nd(a,function(){t==c&&(i.scroller.scrollTop+=l,f(b))}),50)}}function h(b){a.state.selectingText=!1,t=1/0,Ja(b),i.input.focus(),Da(document,"mousemove",u),Da(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;Ja(b);var k,m,o=j.sel,p=o.ranges;if(d.addNew&&!d.extend?(m=j.sel.contains(c),k=m>-1?p[m]:new yh(c,c)):(k=j.sel.primary(),m=j.sel.primIndex),"rectangle"==d.unit)d.addNew||(k=new yh(c,c)),c=yc(a,b,!0,!0),m=-1;else{var q=Ef(a,c,d.unit);k=d.extend?me(k,q.anchor,q.head,d.extend):q}d.addNew?m==-1?(m=p.length,te(j,Md(p.concat([k]),m),{scroll:!1,origin:"*mouse"})):p.length>1&&p[m].empty()&&"char"==d.unit&&!d.extend?(te(j,Md(p.slice(0,m).concat(p.slice(m+1)),0),{scroll:!1,origin:"*mouse"}),o=j.sel):pe(j,m,k,Og):(m=0,te(j,new xh([k],0),Og),o=j.sel);var r=c,s=i.wrapper.getBoundingClientRect(),t=0,u=nd(a,function(a){Oa(a)?f(a):h(a)}),v=nd(a,h);a.state.selectingText=v,Yg(document,"mousemove",u),Yg(document,"mouseup",v)}function Gf(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(b){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ja(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Ha(a,c))return La(b);f-=h.top-g.viewOffset;for(var i=0;i<a.options.gutters.length;++i){var j=g.gutters.childNodes[i];if(j&&j.getBoundingClientRect().right>=e){var k=G(a.doc,f),l=a.options.gutters[i];return Ea(a,c,a,k,l,b),La(b)}}}function Hf(a,b){return Gf(a,b,"gutterClick",!0)}function If(a,b){Nb(a.display,b)||Jf(a,b)||Fa(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function Jf(a,b){return!!Ha(a,"gutterContextMenu")&&Gf(a,b,"gutterContextMenu",!1)}function Kf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fc(a)}function Lf(a){function b(b,d,e,f){a.defaults[b]=d,e&&(c[b]=f?function(a,b,c){c!=Th&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b,a.Init=Th,b("value","",function(a,b){return a.setValue(b)},!0),b("mode",null,function(a,b){a.doc.modeOption=b,Td(a)},!0),b("indentUnit",2,Td,!0),b("indentWithTabs",!1),b("smartIndent",!0),b("tabSize",4,function(a){Ud(a),fc(a),qd(a)},!0),b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(f==-1)break;e=f+b.length,c.push(J(d,f))}d++});for(var e=c.length-1;e>=0;e--)Je(a.doc,b,c[e],J(c[e].line,c[e].ch+b.length))}}),b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g"),c!=Th&&a.refresh()}),b("specialCharPlaceholder",nb,function(a){return a.refresh()},!0),b("electricChars",!0),b("inputStyle",yg?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0),b("rtlMoveVisually",!Bg),b("wholeLineUpdateBefore",!0),b("theme","default",function(a){Kf(a),Mf(a)},!0),b("keyMap","default",function(a,b,c){var d=kf(b),e=c!=Th&&kf(c);e&&e.detach&&e.detach(a,d),d.attach&&d.attach(a,e||null)}),b("extraKeys",null),b("configureMouse",null),b("lineWrapping",!1,Of,!0),b("gutters",[],function(a){Id(a.options),Mf(a)},!0),b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?vc(a.display)+"px":"0",a.refresh()},!0),b("coverGutterNextToScrollbar",!1,function(a){return bd(a)},!0),b("scrollbarStyle","native",function(a){dd(a),bd(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0),b("lineNumbers",!1,function(a){Id(a.options),Mf(a)},!0),b("firstLineNumber",1,Mf,!0),b("lineNumberFormatter",function(a){return a},Mf,!0),b("showCursorWhenSelecting",!1,Ac,!0),b("resetSelectionOnContextMenu",!0),b("lineWiseCopyCut",!0),b("pasteLinesPerSelection",!0),b("readOnly",!1,function(a,b){"nocursor"==b&&(Jc(a),a.display.input.blur()),a.display.input.readOnlyChanged(b)}),b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0),b("dragDrop",!0,Nf),b("allowDropFileTypes",null),b("cursorBlinkRate",530),b("cursorScrollMargin",0),b("cursorHeight",1,Ac,!0),b("singleCursorHeightPerLine",!0,Ac,!0),b("workTime",100),b("workDelay",100),b("flattenSpans",!0,Ud,!0),b("addModeClass",!1,Ud,!0),b("pollInterval",100),b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b}),b("historyEventDelay",1250),b("viewportMargin",10,function(a){return a.refresh()},!0),b("maxHighlightLength",1e4,Ud,!0),b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()}),b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""}),b("autofocus",null),b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)}function Mf(a){Hd(a),qd(a),Nc(a)}function Nf(a,b,c){var d=c&&c!=Th;if(!b!=!d){var e=a.display.dragFunctions,f=b?Yg:Da;f(a.display.scroller,"dragstart",e.start),f(a.display.scroller,"dragenter",e.enter),f(a.display.scroller,"dragover",e.over),f(a.display.scroller,"dragleave",e.leave),f(a.display.scroller,"drop",e.drop)}}function Of(a){a.options.lineWrapping?(h(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Gg(a.display.wrapper,"CodeMirror-wrap"),ua(a)),xc(a),qd(a),fc(a),setTimeout(function(){return bd(a)},100)}function Pf(a,b){var c=this;if(!(this instanceof Pf))return new Pf(a,b);this.options=b=b?k(b):{},k(Uh,b,!1),Id(b);var d=b.value;"string"==typeof d&&(d=new Eh(d,b.mode,null,b.lineSeparator,b.direction)),this.doc=d;var e=new Pf.inputStyles[b.inputStyle](this),f=this.display=new A(a,d,e);f.wrapper.CodeMirror=this,Hd(this),Kf(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),dd(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 Ig,keySeq:null,specialChars:null},b.autofocus&&!yg&&f.input.focus(),ng&&og<11&&setTimeout(function(){return c.display.input.reset(!0)},20),Qf(this),af(),ed(this),this.curOp.forceUpdate=!0,Yd(this,d),b.autofocus&&!yg||this.hasFocus()?setTimeout(j(Ic,this),20):Jc(this);for(var g in Vh)Vh.hasOwnProperty(g)&&Vh[g](c,b[g],Th);Oc(this),b.finishInit&&b.finishInit(this);for(var h=0;h<Wh.length;++h)Wh[h](c);fd(this),pg&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(f.lineDiv).textRendering&&(f.lineDiv.style.textRendering="auto")}function Qf(a){function b(){e.activeTouch&&(f=setTimeout(function(){return e.activeTouch=null},1e3),g=e.activeTouch,g.end=+new Date)}function c(a){if(1!=a.touches.length)return!1;var b=a.touches[0];return b.radiusX<=1&&b.radiusY<=1}function d(a,b){if(null==b.left)return!0;var c=b.left-a.left,d=b.top-a.top;return c*c+d*d>400}var e=a.display;Yg(e.scroller,"mousedown",nd(a,zf)),ng&&og<11?Yg(e.scroller,"dblclick",nd(a,function(b){if(!Fa(a,b)){var c=yc(a,b);if(c&&!Hf(a,b)&&!Nb(a.display,b)){Ja(b);var d=a.findWordAt(c);ne(a.doc,d.anchor,d.head)}}})):Yg(e.scroller,"dblclick",function(b){return Fa(a,b)||Ja(b)}),Fg||Yg(e.scroller,"contextmenu",function(b){return If(a,b)});var f,g={end:0};Yg(e.scroller,"touchstart",function(b){if(!Fa(a,b)&&!c(b)){e.input.ensurePolled(),clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}}),Yg(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)}),Yg(e.scroller,"touchend",function(c){var f=e.activeTouch;if(f&&!Nb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new yh(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new yh(J(h.line,0),Q(a.doc,J(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Ja(c)}b()}),Yg(e.scroller,"touchcancel",b),Yg(e.scroller,"scroll",function(){e.scroller.clientHeight&&(Zc(a,e.scroller.scrollTop),_c(a,e.scroller.scrollLeft,!0),Ea(a,"scroll",a))}),Yg(e.scroller,"mousewheel",function(b){return Ld(a,b)}),Yg(e.scroller,"DOMMouseScroll",function(b){return Ld(a,b)}),Yg(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0}),e.dragFunctions={enter:function(b){Fa(a,b)||Ma(b)},over:function(b){Fa(a,b)||(Ze(a,b),Ma(b))},start:function(b){return Ye(a,b)},drop:nd(a,Xe),leave:function(b){Fa(a,b)||$e(a)}};var h=e.input.getField();Yg(h,"keyup",function(b){return wf.call(a,b)}),Yg(h,"keydown",nd(a,uf)),Yg(h,"keypress",nd(a,xf)),Yg(h,"focus",function(b){return Ic(a,b)}),Yg(h,"blur",function(b){return Jc(a,b)})}function Rf(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=ab(a,b).state:c="prev");var g=a.options.tabSize,h=B(f,b),i=l(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Mg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?l(B(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var m="",n=0;if(a.options.indentWithTabs)for(var p=Math.floor(j/g);p;--p)n+=g,m+="\t";if(n<j&&(m+=o(j-n)),m!=k)return Je(f,m,J(b,0),J(b,k.length),"+input"),h.stateAfter=null,!0;for(var q=0;q<f.sel.ranges.length;q++){var r=f.sel.ranges[q];if(r.head.line==b&&r.head.ch<k.length){var s=J(b,k.length);pe(f,q,new yh(s,s));break}}}function Sf(a){Xh=a}function Tf(a,b,c,d,e){var f=a.doc;a.display.shift=!1,d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=$g(b),i=null;if(g&&d.ranges.length>1)if(Xh&&Xh.text.join("\n")==b){if(d.ranges.length%Xh.text.length==0){i=[];for(var j=0;j<Xh.text.length;j++)i.push(f.splitLines(Xh.text[j]))}}else h.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(i=q(h,function(a){return[a]}));for(var k,l=d.ranges.length-1;l>=0;l--){var m=d.ranges[l],n=m.from(),o=m.to();m.empty()&&(c&&c>0?n=J(n.line,n.ch-c):a.state.overwrite&&!g?o=J(o.line,Math.min(B(f,o.line).text.length,o.ch+p(h).length)):Xh&&Xh.lineWise&&Xh.text.join("\n")==b&&(n=o=J(n.line,0))),k=a.curOp.updateInput;var r={from:n,to:o,text:i?i[l%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};De(a.doc,r),yb(a,"inputRead",a,r)}b&&!g&&Vf(a,b),Uc(a),a.curOp.updateInput=k,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function Uf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||md(b,function(){return Tf(b,c,0,null,"paste")}),!0}function Vf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h<f.electricChars.length;h++)if(b.indexOf(f.electricChars.charAt(h))>-1){g=Rf(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(B(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Rf(a,e.head.line,"smart"));g&&yb(a,"electricInput",a,e.head.line)}}}function Wf(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,f={anchor:J(e,0),head:J(e+1,0)};c.push(f),b.push(a.getRange(f.anchor,f.head))}return{text:b,ranges:c}}function Xf(a,b){a.setAttribute("autocorrect","off"),a.setAttribute("autocapitalize","off"),a.setAttribute("spellcheck",!!b)}function Yf(){var a=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),b=d("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return pg?a.style.width="1000px":a.setAttribute("wrap","off"),wg&&(a.style.border="1px solid black"),Xf(a),b}function Zf(a,b,c,d,e){function f(){var d=b.line+c;return!(d<a.first||d>=a.first+a.size)&&(b=new J(d,b.ch,b.sticky),j=B(a,d))}function g(d){var g;if(g=e?Ba(a.cm,j,b,c):za(j,b,c),null==g){if(d||!f())return!1;b=Aa(e,a.cm,j,b.line,c)}else b=g;return!0}var h=b,i=c,j=B(a,b.line);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var k=null,l="group"==d,m=a.cm&&a.cm.getHelper(b,"wordChars"),n=!0;!(c<0)||g(!n);n=!1){var o=j.text.charAt(b.ch)||"\n",p=v(o,m)?"w":l&&"\n"==o?"n":!l||/\s/.test(o)?null:"p";if(!l||n||p||(p="s"),k&&k!=p){c<0&&(c=1,g(),b.sticky="after");break}if(p&&(k=p),c>0&&!g(!n))break}var q=ze(a,b,h,i,!0);return L(h,q)&&(q.hitSide=!0),q}function $f(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(h-.5*sc(a.display),3);e=(c>0?b.bottom:b.top)+c*i}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(var j;j=oc(a,g,e),j.outside;){if(c<0?e<=0:e>=f.height){j.hitSide=!0;break}e+=5*c}return j}function _f(a,b){var c=Yb(a,b.line);if(!c||c.hidden)return null;var d=B(a.doc,b.line),e=Vb(c,d,b.line),f=xa(d,a.doc.direction),g="left";if(f){var h=wa(f,b.ch);g=h%2?"right":"left"}var i=_b(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function ag(a){for(var b=a;b;b=b.parentNode)if(/CodeMirror-gutter-wrapper/.test(b.className))return!0;return!1}function bg(a,b){return b&&(a.bad=!0),a}function cg(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(){k&&(j+=l,k=!1)}function h(a){a&&(g(),j+=a)}function i(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return void h(c||b.textContent.replace(/\u200b/g,""));var j,m=b.getAttribute("cm-marker");if(m){var n=a.findMarks(J(d,0),J(e+1,0),f(+m));return void(n.length&&(j=n[0].find(0))&&h(C(a.doc,j.from,j.to).join(l)))}if("false"==b.getAttribute("contenteditable"))return;var o=/^(pre|div|p)$/i.test(b.nodeName);o&&g();for(var p=0;p<b.childNodes.length;p++)i(b.childNodes[p]);o&&(k=!0)}else 3==b.nodeType&&h(b.nodeValue)}for(var j="",k=!1,l=a.doc.lineSeparator();i(b),b!=c;)b=b.nextSibling;return j}function dg(a,b,c){var d;if(b==a.display.lineDiv){if(d=a.display.lineDiv.childNodes[c],!d)return bg(a.clipPos(J(a.display.viewTo-1)),!0);b=null,c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return eg(f,b,c)}}function eg(a,b,c){function d(b,c,d){for(var e=-1;e<(l?l.length:0);e++)for(var f=e<0?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){var i=F(e<0?a.line:a.rest[e]),j=f[g]+d;return(d<0||h!=b)&&(j=f[g+(d?1:0)]),J(i,j)}}}var e=a.text.firstChild,g=!1;if(!b||!f(e,b))return bg(J(F(a.line),0),!0);if(b==e&&(g=!0,b=e.childNodes[c],c=0,!b)){var h=a.rest?p(a.rest):a.line;return bg(J(F(h),h.text.length),g)}var i=3==b.nodeType?b:null,j=b;for(i||1!=b.childNodes.length||3!=b.firstChild.nodeType||(i=b.firstChild,c&&(c=i.nodeValue.length));j.parentNode!=e;)j=j.parentNode;var k=a.measure,l=k.maps,m=d(i,j,c);if(m)return bg(m,g);for(var n=j.nextSibling,o=i?i.nodeValue.length-c:0;n;n=n.nextSibling){if(m=d(n,n.firstChild,0))return bg(J(m.line,m.ch-o),g);o+=n.textContent.length}for(var q=j.previousSibling,r=c;q;q=q.previousSibling){if(m=d(q,q.firstChild,-1))return bg(J(m.line,m.ch+r),g);r+=q.textContent.length}}function fg(a,b){function c(){a.value=j.getValue()}if(b=b?k(b):{},b.value=a.value,!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var d=g();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(Yg(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var h=f.submit=function(){c(),f.submit=e,f.submit(),f.submit=h}}catch(i){}}b.finishInit=function(b){b.save=c,b.getTextArea=function(){return a},b.toTextArea=function(){b.toTextArea=isNaN,