comfortable_mexican_sofa 1.6.10 → 1.6.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js +4 -3
- data/app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js +1 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js +3 -2
- data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror.css +47 -22
- data/comfortable_mexican_sofa.gemspec +2 -2
- data/config/initializers/comfortable_mexican_sofa.rb +1 -1
- data/lib/comfortable_mexican_sofa/configuration.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/configuration_test.rb +3 -1
- data/test/unit/tags/page_file_test.rb +5 -5
- data/test/unit/tags/page_files_test.rb +3 -3
- metadata +9 -9
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# ComfortableMexicanSofa (Rails 3 CMS Engine)
|
1
|
+
# ComfortableMexicanSofa (Rails 3 CMS Engine)
|
2
|
+
[![Build Status](https://secure.travis-ci.org/comfy/comfortable-mexican-sofa.png)](http://travis-ci.org/comfy/comfortable-mexican-sofa) [![Dependency Status](https://gemnasium.com/comfy/comfortable-mexican-sofa.png)](https://gemnasium.com/comfy/comfortable-mexican-sofa)
|
2
3
|
|
3
4
|
ComfortableMexicanSofa is a powerful CMS Engine for your Rails 3 applications.
|
4
5
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.11
|
@@ -118,9 +118,10 @@ $.CMS = function(){
|
|
118
118
|
if ($(element).hasClass('css')) mode = 'css';
|
119
119
|
if ($(element).hasClass('js')) mode = 'javascript';
|
120
120
|
CodeMirror.fromTextArea(element, {
|
121
|
-
htmlMode:
|
122
|
-
mode:
|
123
|
-
tabMode:
|
121
|
+
htmlMode: true,
|
122
|
+
mode: mode,
|
123
|
+
tabMode: 'indent',
|
124
|
+
lineWrapping: true
|
124
125
|
});
|
125
126
|
});
|
126
127
|
},
|
@@ -1 +1 @@
|
|
1
|
-
var CodeMirror=function(){function a(b,c){function bB(a){return a>=0&&a<bb.length}function bD(a){bd=null;var b={line:0,ch:0};bO(b,{line:bb.length-1,ch:bb[bb.length-1].text.length},O(a),b,b),bd=new j,bl=!0}function bE(a){var b=[];for(var c=0,d=bb.length;c<d;++c)b.push(bb[c].text);return b.join("\n")}function bF(a){function i(a){var b=cO(a,!0);if(b&&!H(b,e)){be||bM(),e=b,cl(c,b),bl=!1;var d=cf();if(b.line>=d.to||b.line<d.from)f=setTimeout(c_(function(){i(a)}),150)}}for(var b=p(a);b!=x;b=b.parentNode)if(b.parentNode==R&&b!=T)return;for(var b=p(a);b!=x;b=b.parentNode)if(b.parentNode==V)return g.onGutterClick&&g.onGutterClick(bC,N(V.childNodes,b)+br,a),m(a);var c=cO(a);switch(q(a)){case 3:v&&!A&&cP(a);return;case 2:c&&cn(c.line,c.ch,!0);return}if(!c){p(a)==E&&m(a);return}be||bM();var d=+(new Date);if(bj>d-400)return m(a),cu(c.line);if(bi>d-400)return bj=d,m(a),ct(c);bi=d;var e=c,f;if(u&&!H(bf.from,bf.to)&&!I(c,bf.from)&&!I(bf.to,c)){var h=r(n,"mouseup",c_(function(b){bk=!1,h(),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(m(b),cn(c.line,c.ch,!0),cb())}),!0);bk=!0;return}m(a),cn(c.line,c.ch,!0);var j=r(n,"mousemove",c_(function(a){clearTimeout(f),m(a),i(a)}),!0),h=r(n,"mouseup",c_(function(a){clearTimeout(f);var b=cO(a);b&&cl(c,b),m(a),cb(),bl=!0,j(),h()}),!0)}function bG(a){var b=cO(a);if(!b)return;bj=+(new Date),m(a),ct(b)}function bH(a){a.preventDefault();var b=cO(a,!0),c=a.dataTransfer.files;if(!b||g.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){f[c]=d.result;if(++h==e){b=cp(b);var a=bT(f.join(""),b,b);cl(b,a)}},d.readAsText(a)}var e=c.length,f=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var f=a.dataTransfer.getData("Text");if(f){var j=bT(f,b,b),k=bf.from,l=bf.to;cl(b,j),bk&&bT("",k,l),cb()}}catch(a){}}function bI(a){var b=bX();L(b),a.dataTransfer.setDragImage(K,0,0),a.dataTransfer.setData("Text",b)}function bJ(a){be||bM();var b=a.keyCode;w&&b==27&&(a.returnValue=!1);var c=(A?a.metaKey:a.ctrlKey)&&!a.altKey,d=a.ctrlKey||a.altKey||a.metaKey;b==16||a.shiftKey?bg=bg||(bf.inverted?bf.to:bf.from):bg=null;if(g.onKeyEvent&&g.onKeyEvent(bC,l(a)))return;if(b==33||b==34)return cq(b==34),m(a);if(c&&(b==36||b==35||A&&(b==38||b==40)))return cr(b==36||b==38),m(a);if(c&&b==65)return cs(),m(a);if(!g.readOnly){if(!d&&b==13)return;if(!d&&b==9&&cw(a.shiftKey))return m(a);if(c&&b==90)return bQ(),m(a);if(c&&(a.shiftKey&&b==90||b==89))return bR(),m(a)}if(b==36&&g.smartHome)return cx(),m(a);bu=(c?"c":"")+(a.altKey?"a":"")+b;if(bf.inverted&&B[bu]===!0){var e=P(D);e&&(bh={anchor:e.start},Q(D,e.start,e.start))}!c&&!a.altKey&&(bu=null),b$(bu)}function bK(a){if(g.onKeyEvent&&g.onKeyEvent(bC,l(a)))return;bh&&(bh=null,bl=!0),a.keyCode==16&&(bg=null)}function bL(a){if(g.onKeyEvent&&g.onKeyEvent(bC,l(a)))return;if(g.electricChars&&ba.electricChars){var b=String.fromCharCode(a.charCode==null?a.keyCode:a.charCode);ba.electricChars.indexOf(b)>-1&&setTimeout(c_(function(){cy(bf.to.line,"smart")}),50)}var c=a.keyCode;c==13?(g.readOnly||cv(),m(a)):!a.ctrlKey&&!a.altKey&&!a.metaKey&&c==9&&g.tabMode!="default"?m(a):b$(bu)}function bM(){if(g.readOnly=="nocursor")return;be||(g.onFocus&&g.onFocus(bC),be=!0,x.className.search(/\bCodeMirror-focused\b/)==-1&&(x.className+=" CodeMirror-focused"),bp||ca()),bZ(),cQ()}function bN(){be&&(g.onBlur&&g.onBlur(bC),be=!1,x.className=x.className.replace(" CodeMirror-focused","")),clearInterval(_),setTimeout(function(){be||(bg=null)},150)}function bO(a,b,c,d,e){if(bd){var f=[];for(var h=a.line,i=b.line+1;h<i;++h)f.push(bb[h].text);bd.addChange(a.line,c.length,f);while(bd.done.length>g.undoDepth)bd.done.shift()}bS(a,b,c,d,e)}function bP(a,b){var c=a.pop();if(c){var d=[],e=c.start+c.added;for(var f=c.start;f<e;++f)d.push(bb[f].text);b.push({start:c.start,added:c.old.length,old:d});var g=cp({line:c.start+c.old.length-1,ch:M(d[d.length-1],c.old[c.old.length-1])});bS({line:c.start,ch:0},{line:e-1,ch:bb[e-1].text.length},c.old,g,g),bl=!0}}function bQ(){bP(bd.done,bd.undone)}function bR(){bP(bd.undone,bd.done)}function bS(a,b,c,d,e){function s(a){return a<=Math.min(b.line,b.line+q)?a:a+q}var f=!1,g=bx.length;for(var i=a.line;i<=b.line;++i)if(bb[i].text.length==g){f=!0;break}var j=b.line-a.line,k=bb[a.line],l=bb[b.line];if(k==l)if(c.length==1)k.replace(a.ch,b.ch,c[0]);else{l=k.split(b.ch,c[c.length-1]);var m=[a.line+1,j];k.replace(a.ch,k.text.length,c[0]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));m.push(l),bb.splice.apply(bb,m)}else if(c.length==1)k.replace(a.ch,k.text.length,c[0]+l.text.slice(b.ch)),bb.splice(a.line+1,j);else{var m=[a.line+1,j-1];k.replace(a.ch,k.text.length,c[0]),l.replace(0,b.ch,c[c.length-1]);for(var i=1,n=c.length-1;i<n;++i)m.push(new h(c[i]));bb.splice.apply(bb,m)}for(var i=a.line,n=i+c.length;i<n;++i){var o=bb[i].text;o.length>g&&(bx=o,g=o.length,by=null,f=!1)}if(f){g=0,bx="",by=null;for(var i=0,n=bb.length;i<n;++i){var o=bb[i].text;o.length>g&&(g=o.length,bx=o)}}var p=[],q=c.length-j-1;for(var i=0,o=bc.length;i<o;++i){var r=bc[i];r<a.line?p.push(r):r>b.line&&p.push(r+q)}c.length<5?(cV(a.line,a.line+c.length),p.push(a.line+c.length)):p.push(a.line),bc=p,cX(100),bm.push({from:a.line,to:b.line+1,diff:q}),bn={from:a,to:b,text:c},cm(d,e,s(bf.from.line),s(bf.to.line)),R.style.height=bb.length*cL()+2*cM()+"px"}function bT(a,b,c){function d(d){if(I(d,b))return d;if(!I(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=cp(b),c?c=cp(c):c=b,a=O(a);var e;return bV(a,b,c,function(a){return e=a,{from:d(bf.from),to:d(bf.to)}}),e}function bU(a,b){bV(O(a),bf.from,bf.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:bf.from,to:bf.from}:{from:bf.from,to:a}})}function bV(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});bO(b,c,a,f.from,f.to)}function bW(a,b){var c=a.line,d=b.line;if(c==d)return bb[c].text.slice(a.ch,b.ch);var e=[bb[c].text.slice(a.ch)];for(var f=c+1;f<d;++f)e.push(bb[f].text);return e.push(bb[d].text.slice(0,b.ch)),e.join("\n")}function bX(){return bW(bf.from,bf.to)}function bZ(){if(bY)return;Z.set(2e3,function(){cY(),b_(),be&&bZ(),cZ()})}function b$(a){function c(){cY();var d=b_();d&&a&&(d=="moved"&&B[a]==null&&(B[a]=!0),d=="changed"&&(B[a]=!1)),!d&&!b?(b=!0,Z.set(80,c)):(bY=!1,bZ()),cZ()}var b=!1;bY=!0,Z.set(20,c)}function b_(){function f(a,c){var d=0;for(;;){var e=b.indexOf("\n",d);if(e==-1||(b.charAt(e-1)=="\r"?e-1:e)>=a)return{line:c,ch:a-d};++c,d=e+1}}if(bp||!be)return;var a=!1,b=D.value,c=P(D);if(!c)return!1;var a=bv.text!=b,d=bh,e=a||c.start!=bv.start||c.end!=(d?bv.start:bv.end);if(!e&&!d)return!1;if(a){bg=bh=null;if(g.readOnly)return bl=!0,"changed"}var h=f(c.start,bv.from),i=f(c.end,bv.from);if(d){var j=c.start==d.anchor?i:h,k=bg?bf.to:c.start==d.anchor?h:i;(bf.inverted=I(j,k))?(h=j,i=k):(bh=null,h=k,i=j)}h.line==i.line&&h.line==bf.from.line&&h.line==bf.to.line&&!bg&&(bl=!1);if(a){var l=0,m=b.length,n=Math.min(m,bv.text.length),o,p=bv.from,q=-1;while(l<n&&(o=b.charAt(l))==bv.text.charAt(l))++l,o=="\n"&&(p++,q=l);var r=q>-1?l-q:l,s=bv.to-1,t=bv.text.length;for(;;){o=bv.text.charAt(t);if(b.charAt(m)!=o){++m,++t;break}o=="\n"&&s--;if(t<=l||m<=l)break;--m,--t}var q=bv.text.lastIndexOf("\n",t-1),u=q==-1?t:t-q-1;bO({line:p,ch:r},{line:s,ch:u},O(b.slice(l,m)),h,i);if(p!=s||h.line!=p)bl=!0}else cm(h,i);return bv.text=b,bv.start=c.start,bv.end=c.end,a?"changed":e?"moved":!1}function ca(){var a=[],b=Math.max(0,bf.from.line-1),c=Math.min(bb.length,bf.to.line+2);for(var d=b;d<c;++d)a.push(bb[d].text);a=D.value=a.join(y);var e=bf.from.ch,f=bf.to.ch;for(var d=b;d<bf.from.line;++d)e+=y.length+bb[d].text.length;for(var d=b;d<bf.to.line;++d)f+=y.length+bb[d].text.length;bv={text:a,from:b,to:c,start:e,end:f},Q(D,e,bh?e:f)}function cb(){g.readOnly!="nocursor"&&D.focus()}function cc(){if(!X.getBoundingClientRect)return;var a=X.getBoundingClientRect(),b=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.top<0||a.bottom>b)&&X.scrollIntoView()}function cd(){var a=cJ(bf.inverted?bf.from:bf.to);return ce(a.x,a.y,a.x,a.yBot)}function ce(a,b,c,d){var e=cN(),f=cM(),h=cL();b+=f,d+=f,a+=e,c+=e;var i=E.clientHeight,j=E.scrollTop,k=!1,l=!0;b<j?(E.scrollTop=Math.max(0,b-2*h),k=!0):d>j+i&&(E.scrollTop=d+h-i,k=!0);var m=E.clientWidth,n=E.scrollLeft,o=g.fixedGutter?U.clientWidth:0;return a<n+o?(a<50&&(a=0),E.scrollLeft=Math.max(0,a-10-o),k=!0):c>m+n&&(E.scrollLeft=c+10-m,k=!0,c>R.clientWidth&&(l=!1)),k&&g.onScroll&&g.onScroll(bC),l}function cf(){var a=cL(),b=E.scrollTop-cM();return{from:Math.min(bb.length,Math.max(0,Math.floor(b/a))),to:Math.min(bb.length,Math.ceil((b+E.clientHeight)/a))}}function cg(a){if(!E.clientWidth){br=bs=0;return}var b=a===!0?[]:[{from:br,to:bs,domStart:0}];for(var c=0,d=a.length||0;c<d;++c){var e=a[c],f=[],g=e.diff||0;for(var h=0,i=b.length;h<i;++h){var j=b[h];e.to<=j.from?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):j.to<=e.from?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}b=f}var k=cf(),l=Math.min(br,Math.max(k.from-3,0)),m=Math.min(bb.length,Math.max(bs,k.to+3)),n=[],o=0,p=bs-br,q=l,r=0;for(var c=0,d=b.length;c<d;++c){var j=b[c];if(j.to<=l)continue;if(j.from>=m)break;if(j.domStart>o||j.from>q)n.push({from:q,to:j.from,domSize:j.domStart-o,domStart:o}),r+=j.from-q;q=j.to,o=j.domStart+(j.to-j.from)}if(o!=p||q!=m)r+=Math.abs(m-q),n.push({from:q,to:m,domSize:p-o,domStart:o}),m-q!=p-o&&(bq=!0);if(!n.length)return;Y.style.display="none",r>(k.to-k.from)*.3?ch(l=Math.max(k.from-10,0),m=Math.min(k.to+7,bb.length)):ci(n),Y.style.display="";var s=l!=br||m!=bs||bt!=E.clientHeight;br=l,bs=m,T.style.top=l*cL()+"px",s&&(bt=E.clientHeight,R.style.height=bb.length*cL()+2*cM()+"px"),(s||bq)&&cj(),by==null&&(by=cG(bx)),by>E.clientWidth?(W.style.width=by+"px",R.style.width="",R.style.width=E.scrollWidth+"px"):W.style.width=R.style.width="";if(Y.childNodes.length!=bs-br)throw new Error("BAD PATCH! "+JSON.stringify(n)+" size="+(bs-br)+" nodes="+Y.childNodes.length);ck()}function ch(a,b){var c=[],d={line:a,ch:0},e=I(bf.from,d)&&!I(bf.to,d);for(var f=a;f<b;++f){var g=null,h=null;e?(g=0,bf.to.line==f&&(e=!1,h=bf.to.ch)):bf.from.line==f&&(bf.to.line==f?(g=bf.from.ch,h=bf.to.ch):(e=!0,g=bf.from.ch)),c.push(bb[f].getHTML(g,h,!0))}Y.innerHTML=c.join("")}function ci(a){var b=bf.from.line,c=bf.to.line,d=0,e=t&&n.createElement("div");for(var f=0,g=a.length;f<g;++f){var h=a[f],i=h.to-h.from-h.domSize,j=Y.childNodes[h.domStart+h.domSize+d]||null;if(t)for(var k=Math.max(-i,h.domSize);k>0;--k)Y.removeChild(j?j.previousSibling:Y.lastChild);else if(i){for(var k=Math.max(0,i);k>0;--k)Y.insertBefore(n.createElement("pre"),j);for(var k=Math.max(0,-i);k>0;--k)Y.removeChild(j?j.previousSibling:Y.lastChild)}var l=Y.childNodes[h.domStart+d],m=b<h.from&&c>=h.from;for(var k=h.from;k<h.to;++k){var o=null,p=null;m?(o=0,c==k&&(m=!1,p=bf.to.ch)):b==k&&(c==k?(o=bf.from.ch,p=bf.to.ch):(m=!0,o=bf.from.ch)),t?(e.innerHTML=bb[k].getHTML(o,p,!0),Y.insertBefore(e.firstChild,j)):(l.innerHTML=bb[k].getHTML(o,p,!1),l.className=bb[k].className||"",l=l.nextSibling)}d+=i}}function cj(){if(!g.gutter&&!g.lineNumbers)return;var a=T.offsetHeight,b=E.clientHeight;U.style.height=(a-b<2?b:a)+"px";var c=[];for(var d=br;d<Math.max(bs,br+1);++d){var e=bb[d].gutterMarker,f=g.lineNumbers?d+g.firstLineNumber:null;e&&e.text?f=e.text.replace("%N%",f!=null?f:""):f==null&&(f="\u00a0"),c.push(e&&e.style?'<pre class="'+e.style+'">':"<pre>",f,"</pre>")}U.style.display="none",V.innerHTML=c.join("");var h=String(bb.length).length,i=V.firstChild,j=G(i),k="";while(j.length+k.length<h)k+="\u00a0";k&&i.insertBefore(n.createTextNode(k),i.firstChild),U.style.display="",W.style.marginLeft=U.offsetWidth+"px",bq=!1}function ck(){var a=bf.inverted?bf.from:bf.to,b=cL(),c=cH(a.line,a.ch),d=a.line*b-E.scrollTop;C.style.top=Math.max(Math.min(d,E.offsetHeight),0)+"px",C.style.left=c-E.scrollLeft+"px",H(bf.from,bf.to)?(X.style.top=(a.line-br)*b+"px",X.style.left=c+"px",X.style.display=""):X.style.display="none"}function cl(a,b){var c=bg&&cp(bg);c&&(I(c,a)?a=c:I(b,c)&&(b=c)),cm(a,b)}function cm(a,b,c,d){if(H(bf.from,a)&&H(bf.to,b))return;if(I(b,a)){var e=b;b=a,a=e}H(a,b)?bf.inverted=!1:H(a,bf.to)?bf.inverted=!1:H(b,bf.from)&&(bf.inverted=!0),c==null&&(c=bf.from.line,d=bf.to.line),H(a,b)?H(bf.from,bf.to)||bm.push({from:c,to:d+1}):H(bf.from,bf.to)?bm.push({from:a.line,to:b.line+1}):(H(a,bf.from)||(a.line<c?bm.push({from:a.line,to:Math.min(b.line,c)+1}):bm.push({from:c,to:Math.min(d,a.line)+1})),H(b,bf.to)||(b.line<d?bm.push({from:Math.max(c,a.line),to:d+1}):bm.push({from:Math.max(a.line,d),to:b.line+1}))),bf.from=a,bf.to=b,bo=!0}function cn(a,b,c){var d=cp({line:a,ch:b||0});(c?cl:cm)(d,d)}function co(a){return Math.max(0,Math.min(a,bb.length-1))}function cp(a){if(a.line<0)return{line:0,ch:0};if(a.line>=bb.length)return{line:bb.length-1,ch:bb[bb.length-1].text.length};var b=a.ch,c=bb[a.line].text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function cq(a){var b=Math.floor(E.clientHeight/cL()),c=bf.inverted?bf.from:bf.to;cn(c.line+Math.max(b-1,1)*(a?1:-1),c.ch,!0)}function cr(a){var b=a?{line:0,ch:0}:{line:bb.length-1,ch:bb[bb.length-1].text.length};cl(b,b)}function cs(){var a=bb.length-1;cm({line:0,ch:0},{line:a,ch:bb[a].text.length})}function ct(a){var b=bb[a.line].text,c=a.ch,d=a.ch;while(c>0&&/\w/.test(b.charAt(c-1)))--c;while(d<b.length&&/\w/.test(b.charAt(d)))++d;cl({line:a.line,ch:c},{line:a.line,ch:d})}function cu(a){cl({line:a,ch:0},{line:a,ch:bb[a].text.length})}function cv(){bU("\n","end"),g.enterMode!="flat"&&cy(bf.from.line,g.enterMode=="keep"?"prev":"smart")}function cw(a){function b(a){if(H(bf.from,bf.to))return cy(bf.from.line,a);var b=bf.to.line-(bf.to.ch?0:1);for(var c=bf.from.line;c<=b;++c)cy(c,a)}bg=null;switch(g.tabMode){case"default":return!1;case"indent":b("smart");break;case"classic":if(H(bf.from,bf.to)){a?cy(bf.from.line,"smart"):bU("\t","end");break};case"shift":b(a?"subtract":"add")}return!0}function cx(){var a=Math.max(0,bb[bf.from.line].text.search(/\S/));cn(bf.from.line,bf.from.ch<=a&&bf.from.ch?0:a,!0)}function cy(a,b){if(b=="smart")if(!ba.indent)b="prev";else var c=cU(a);var d=bb[a],e=d.indentation(),f=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=bb[a-1].indentation():h=0:b=="smart"?h=ba.indent(c,d.text.slice(f.length)):b=="add"?h=e+g.indentUnit:b=="subtract"&&(h=e-g.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(bf.from.line!=a&&bf.to.line!=a)return;var j=f}else{var j="",k=0;if(g.indentWithTabs)for(var l=Math.floor(h/z);l;--l)k+=z,j+="\t";while(k<h)++k,j+=" "}bT(j,{line:a,ch:0},{line:a,ch:f.length})}function cz(){ba=a.getMode(g,g.mode);for(var b=0,c=bb.length;b<c;++b)bb[b].stateAfter=null;bc=[0],cX()}function cA(){var a=g.gutter||g.lineNumbers;U.style.display=a?"":"none",a?bq=!0:Y.parentNode.style.marginLeft=0}function cB(a,b,c){function e(a,b,c,e){var a=bb[a],f=a.addMark(b,c,e);f.line=a,d.push(f)}a=cp(a),b=cp(b);var d=[];if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,0,null,c);e(b.line,0,b.ch,c)}return bm.push({from:a.line,to:b.line+1}),function(){var a,b;for(var c=0;c<d.length;++c){var e=d[c],f=N(bb,e.line);e.line.removeMark(e),f>-1&&(a==null&&(a=f),b=f)}a!=null&&bm.push({from:a,to:b+1})}}function cC(a,b,c){return typeof a=="number"&&(a=bb[co(a)]),a.gutterMarker={text:b,style:c},bq=!0,a}function cD(a){typeof a=="number"&&(a=bb[co(a)]),a.gutterMarker=null,bq=!0}function cE(a,b){if(typeof a=="number"){var c=a;a=bb[co(a)]}else{var c=N(bb,a);if(c==-1)return null}return a.className!=b&&(a.className=b,bm.push({from:c,to:c+1})),a}function cF(a){if(typeof a=="number"){var b=a;a=bb[a];if(!a)return null}else{var b=N(bb,a);if(b==-1)return null}var c=a.gutterMarker;return{line:b,text:a.text,markerText:c&&c.text,markerClass:c&&c.style}}function cG(a){return S.innerHTML="<pre><span>x</span></pre>",S.firstChild.firstChild.firstChild.nodeValue=a,S.firstChild.firstChild.offsetWidth||10}function cH(a,b){return b==0?0:(S.innerHTML="<pre><span>"+bb[a].getHTML(null,null,!1,b)+"</span></pre>",S.firstChild.firstChild.offsetWidth)}function cI(a,b){function e(a){return S.innerHTML="<pre><span>"+c.getHTML(null,null,!1,a)+"</span></pre>",S.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=bb[a],d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/cG("x")));for(;;){var k=e(j);if(k<=b&&j<h)j=Math.min(h,Math.ceil(j*1.2));else{i=k,h=j;break}}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function cJ(a,b){var c=cL(),d=a.line-(b?br:0);return{x:cH(a.line,a.ch),y:d*c,yBot:(d+1)*c}}function cK(a){var b=cJ(a,!0),c=F(W);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function cL(){var a=Y.childNodes.length;return a?Y.offsetHeight/a||1:(S.innerHTML="<pre>x</pre>",S.firstChild.offsetHeight||1)}function cM(){return W.offsetTop}function cN(){return W.offsetLeft}function cO(a,b){var c=F(E,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>E.clientWidth||e-c.top>E.clientHeight))return null;var f=F(W,!0),g=br+Math.floor((e-f.top)/cL());return cp({line:g,ch:cI(co(g),d-f.left)})}function cP(a){function e(){var a=O(D.value).join("\n");a!=d&&c_(bU)(a,"end"),C.style.position="relative",D.style.cssText=c,bp=!1,ca(),bZ()}var b=cO(a);if(!b||window.opera)return;(H(bf.from,bf.to)||I(b,bf.from)||!I(b,bf.to))&&c_(cn)(b.line,b.ch);var c=D.style.cssText;C.style.position="absolute",D.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",bp=!0;var d=D.value=bX();cb(),Q(D,0,D.value.length);if(v){o(a);var f=r(window,"mouseup",function(){f(),setTimeout(e,20)},!0)}else setTimeout(e,50)}function cQ(){clearInterval(_);var a=!0;X.style.visibility="",_=setInterval(function(){X.style.visibility=(a=!a)?"":"hidden"},650)}function cS(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=cR[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=bf.inverted?bf.from:bf.to,c=bb[b.line],d=b.ch-1,e=d>=0&&cR[c.text.charAt(d)]||cR[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,bb.length):Math.max(-1,k-100);k!=l;k+=h){var c=bb[k],q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=cB({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null?cB({line:k,ch:r.pos},{line:k,ch:r.pos+1},m):function(){},u=c_(function(){s(),t()});a?setTimeout(u,800):bw=u}function cT(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var f=bb[d-1];if(f.stateAfter)return d;var g=f.indentation();if(c==null||b>g)c=d-1,b=g}return c}function cU(a){var b=cT(a),c=b&&bb[b-1].stateAfter;c?c=e(ba,c):c=f(ba);for(var d=b;d<a;++d){var g=bb[d];g.highlight(ba,c),g.stateAfter=e(ba,c)}return bm.push({from:b,to:a}),a<bb.length&&!bb[a].stateAfter&&bc.push(a),c}function cV(a,b){var c=cU(a);for(var d=a;d<b;++d){var f=bb[d];f.highlight(ba,c),f.stateAfter=e(ba,c)}}function cW(){var a=+(new Date)+g.workTime,b=bc.length;while(bc.length){if(!bb[br].stateAfter)var c=br;else var c=bc.pop();if(c>=bb.length)continue;var d=cT(c),h=d&&bb[d-1].stateAfter;h?h=e(ba,h):h=f(ba);var i=0,j=ba.compareStates,k=!1;for(var l=d,m=bb.length;l<m;++l){var n=bb[l],o=n.stateAfter;if(+(new Date)>a){bc.push(l),cX(g.workDelay),k&&bm.push({from:c,to:l+1});return}var p=n.highlight(ba,h);p&&(k=!0),n.stateAfter=e(ba,h);if(j){if(o&&j(o,h))break}else if(p!==!1||!o)i=0;else if(++i>3)break}k&&bm.push({from:c,to:l+1})}b&&g.onHighlightComplete&&g.onHighlightComplete(bC)}function cX(a){if(!bc.length)return;$.set(a,c_(cW))}function cY(){bl=null,bm=[],bn=bo=!1}function cZ(){var a=!1;bo&&(a=!cd()),bm.length?cg(bm):(bo&&ck(),bq&&cj()),a&&cd(),bo&&(cc(),cQ()),be&&!bp&&(bl===!0||bl!==!1&&bo)&&ca(),bo&&g.matchBrackets&&setTimeout(c_(function(){bw&&(bw(),bw=null),cS(!1)}),20);var b=bn;bo&&g.onCursorActivity&&g.onCursorActivity(bC),b&&g.onChange&&bC&&g.onChange(bC,b)}function c_(a){return function(){c$++||cY();try{var b=a.apply(this,arguments)}finally{--c$||cZ()}return b}}function da(a,b,c){this.atOccurrence=!1,c==null&&(c=typeof a=="string"&&a==a.toLowerCase()),b&&typeof b=="object"?b=cp(b):b={line:0,ch:0},this.pos={from:b,to:b};if(typeof a!="string")this.matches=function(b,c){if(b){var d=bb[c.line].text.slice(0,c.ch),e=d.match(a),f=0;while(e){var g=d.indexOf(e[0]);f+=g,d=d.slice(g+1);var h=d.match(a);if(h)e=h;else break;f++}}else var d=bb[c.line].text.slice(c.ch),e=d.match(a),f=e&&c.ch+d.indexOf(e[0]);if(e)return{from:{line:c.line,ch:f},to:{line:c.line,ch:f+e[0].length},match:e}};else{c&&(a=a.toLowerCase());var d=c?function(a){return a.toLowerCase()}:function(a){return a},e=a.split("\n");e.length==1?this.matches=function(b,c){var e=d(bb[c.line].text),f=a.length,g;if(b?c.ch>=f&&(g=e.lastIndexOf(a,c.ch-f))!=-1:(g=e.indexOf(a,c.ch))!=-1)return{from:{line:c.line,ch:g},to:{line:c.line,ch:g+f}}}:this.matches=function(a,b){var c=b.line,f=a?e.length-1:0,g=e[f],h=d(bb[c].text),i=a?h.indexOf(g)+g.length:h.lastIndexOf(g);if(a?i>=b.ch||i!=g.length:i<=b.ch||i!=h.length-g.length)return;for(;;){if(a?!c:c==bb.length-1)return;h=d(bb[c+=a?-1:1].text),g=e[a?--f:++f];if(f>0&&f<e.length-1){if(h!=g)return;continue}var j=a?h.lastIndexOf(g):h.indexOf(g)+g.length;if(a?j!=h.length-g.length:j!=g.length)return;var k={line:b.line,ch:i},l={line:c,ch:j};return{from:a?l:k,to:a?k:l}}}}}var g={},i=a.defaults;for(var k in i)i.hasOwnProperty(k)&&(g[k]=(c&&c.hasOwnProperty(k)?c:i)[k]);var n=g.document,x=n.createElement("div");x.className="CodeMirror",x.innerHTML='<div style="overflow: hidden; position: relative; width: 1px; height: 0px;"><textarea style="position: absolute; width: 2px;" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll cm-s-'+g.theme+'">'+'<div style="position: relative">'+'<div style="position: absolute; height: 0; width: 0; overflow: hidden;"></div>'+'<div style="position: relative">'+'<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>'+'<div class="CodeMirror-lines"><div style="position: relative" draggable="true">'+'<pre class="CodeMirror-cursor"> </pre>'+"<div></div>"+"</div></div></div></div></div>",b.appendChild?b.appendChild(x):b(x);var C=x.firstChild,D=C.firstChild,E=x.lastChild,R=E.firstChild,S=R.firstChild,T=S.nextSibling,U=T.firstChild,V=U.firstChild,W=U.nextSibling.firstChild,X=W.firstChild,Y=X.nextSibling;g.tabindex!=null&&(D.tabindex=g.tabindex),!g.gutter&&!g.lineNumbers&&(U.style.display="none");var Z=new s,$=new s,_,ba,bb=[new h("")],bc,bd=new j,be;cz();var bf={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br=0,bs=0,bt=0,bu=null,bv,bw,bx="",by;c_(function(){bD(g.value||""),bl=!1})(),r(E,"mousedown",c_(bF)),r(E,"dblclick",c_(bG)),r(W,"dragstart",bI),v||r(E,"contextmenu",cP),r(E,"scroll",function(){cg([]),g.fixedGutter&&(U.style.left=E.scrollLeft+"px"),g.onScroll&&g.onScroll(bC)}),r(window,"resize",function(){cg(!0)}),r(D,"keyup",c_(bK)),r(D,"keydown",c_(bJ)),r(D,"keypress",c_(bL)),r(D,"focus",bM),r(D,"blur",bN),r(E,"dragenter",o),r(E,"dragover",o),r(E,"drop",c_(bH)),r(E,"paste",function(){cb(),b$()}),r(D,"paste",function(){b$()}),r(D,"cut",function(){b$()});var bz;try{bz=n.activeElement==D}catch(bA){}bz?setTimeout(bM,20):bN();var bC=x.CodeMirror={getValue:bE,setValue:c_(bD),getSelection:bX,replaceSelection:c_(bU),focus:function(){cb(),bM(),b$()},setOption:function(a,b){g[a]=b,a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"?c_(cA)():a=="mode"||a=="indentUnit"?cz():a=="readOnly"&&b=="nocursor"?D.blur():a=="theme"&&(E.className=E.className.replace(/cm-s-\w+/,"cm-s-"+b))},getOption:function(a){return g[a]},undo:c_(bQ),redo:c_(bR),indentLine:c_(function(a,b){bB(a)&&cy(a,b==null?"smart":b?"add":"subtract")}),historySize:function(){return{undo:bd.done.length,redo:bd.undone.length}},matchBrackets:c_(function(){cS(!0)}),getTokenAt:function(a){return a=cp(a),bb[a.line].getTokenAt(ba,cU(a.line),a.ch)},getStateAfter:function(a){return a=co(a==null?bb.length-1:a),cU(a+1)},cursorCoords:function(a){return a==null&&(a=bf.inverted),cK(a?bf.from:bf.to)},charCoords:function(a){return cK(cp(a))},coordsChar:function(a){var b=F(W),c=co(Math.min(bb.length-1,br+Math.floor((a.y-b.top)/cL())));return cp({line:c,ch:cI(co(c),a.x-b.left)})},getSearchCursor:function(a,b,c){return new da(a,b,c)},markText:c_(function(a,b,c){return c_(cB(a,b,c))}),setMarker:c_(cC),clearMarker:c_(cD),setLineClass:c_(cE),lineInfo:cF,addWidget:function(a,b,c,d,e){a=cJ(cp(a));var f=a.yBot,g=a.x;b.style.position="absolute",R.appendChild(b);if(d=="over")f=a.y;else if(d=="near"){var h=Math.max(E.offsetHeight,bb.length*cL()),i=Math.max(R.clientWidth,W.clientWidth)-cN();a.yBot+b.offsetHeight>h&&a.y>b.offsetHeight&&(f=a.y-b.offsetHeight),g+b.offsetWidth>i&&(g=i-b.offsetWidth)}b.style.top=f+cM()+"px",b.style.left=b.style.right="",e=="right"?(g=R.clientWidth-b.offsetWidth,b.style.right="0px"):(e=="left"?g=0:e=="middle"&&(g=(R.clientWidth-b.offsetWidth)/2),b.style.left=g+cN()+"px"),c&&ce(g,f,g+b.offsetWidth,f+b.offsetHeight)},lineCount:function(){return bb.length},getCursor:function(a){return a==null&&(a=bf.inverted),J(a?bf.from:bf.to)},somethingSelected:function(){return!H(bf.from,bf.to)},setCursor:c_(function(a,b){b==null&&typeof a.line=="number"?cn(a.line,a.ch):cn(a,b)}),setSelection:c_(function(a,b){cm(cp(a),cp(b||a))}),getLine:function(a){if(bB(a))return bb[a].text},setLine:c_(function(a,b){bB(a)&&bT(b,{line:a,ch:0},{line:a,ch:bb[a].text.length})}),removeLine:c_(function(a){bB(a)&&bT("",{line:a,ch:0},cp({line:a+1,ch:0}))}),replaceRange:c_(bT),getRange:function(a,b){return bW(cp(a),cp(b))},coordsFromIndex:function(a){var b=bb.length,c=0,d,e,f;for(d=0;d<b;d++){f=bb[d].text.length+1;if(c+f>a){e=a-c;break}c+=f}return cp({line:d,ch:e})},operation:function(a){return c_(a)()},refresh:function(){cg(!0)},getInputField:function(){return D},getWrapperElement:function(){return x},getScrollerElement:function(){return E},getGutterElement:function(){return U}},bY=!1,cR={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},c$=0;da.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function d(a){var c={line:a,ch:0};return b.pos={from:c,to:c},b.atOccurrence=!1,!1}var b=this,c=cp(a?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(a,c))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!c.line)return d(0);c={line:c.line-1,ch:bb[c.line-1].text.length}}else{if(c.line==bb.length-1)return d(bb.length);c={line:c.line+1,ch:0}}}},from:function(){if(this.atOccurrence)return J(this.pos.from)},to:function(){if(this.atOccurrence)return J(this.pos.to)},replace:function(a){var b=this;this.atOccurrence&&c_(function(){b.pos.to=bT(a,b.pos.from,b.pos.to)})()}};for(var db in d)d.propertyIsEnumerable(db)&&!bC.propertyIsEnumerable(db)&&(bC[db]=d[db]);return bC}function e(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function f(a,b,c){return a.startState?a.startState(b,c):!0}function g(a){this.pos=this.start=0,this.string=a}function h(a,b){this.styles=b||[a,null],this.stateAfter=null,this.text=a,this.marked=this.gutterMarker=this.className=null}function i(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function j(){this.time=0,this.done=[],this.undone=[]}function k(){o(this)}function l(a){return a.stop||(a.stop=k),a}function m(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function n(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function o(a){m(a),n(a)}function p(a){return a.target||a.srcElement}function q(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function r(a,b,c,d){function e(a){c(a||window.event)}if(typeof a.addEventListener=="function"){a.addEventListener(b,e,!1);if(d)return function(){a.removeEventListener(b,e,!1)}}else{a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function s(){this.id=null}function D(a,b){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var c=0,d=0;c<b;++c)a.charAt(c)=="\t"?d+=z-d%z:++d;return d}function E(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function F(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent)d+=g.offsetLeft,e+=g.offsetTop,b&&E(g).position=="fixed"&&(f=!0);var h=b&&!f?null:c;for(var g=a.parentNode;g!=h;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function G(a){return a.textContent||a.innerText||a.nodeValue||""}function H(a,b){return a.line==b.line&&a.ch==b.ch}function I(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function J(a){return{line:a.line,ch:a.ch}}function L(a){return K.innerText=K.textContent=a,K.innerHTML}function M(a,b){if(!b)return a?a.length:0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function N(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,tabMode:"classic",enterMode:"indent",electricChars:!0,onKeyEvent:null,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,smartHome:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,undoDepth:40,tabindex:null,document:window.document};var b={},c={};a.defineMode=function(c,d){!a.defaults.mode&&c!="null"&&(a.defaults.mode=c),b[c]=d},a.defineMIME=function(a,b){c[a]=b},a.getMode=function(d,e){typeof e=="string"&&c.hasOwnProperty(e)&&(e=c[e]);if(typeof e=="string")var f=e,g={};else if(e!=null)var f=e.name,g=e;var h=b[f];return h?h(d,g||{}):(window.console&&console.warn("No mode "+f+" found, falling back to plain text."),a.getMode(d,"text/plain"))},a.listModes=function(){var a=[];for(var c in b)b.propertyIsEnumerable(c)&&a.push(c);return a},a.listMIMEs=function(){var a=[];for(var b in c)c.propertyIsEnumerable(b)&&a.push({mime:b,mode:c[b]});return a};var d={};a.defineExtension=function(a,b){d[a]=b},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex);if(b.form){var e=r(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.startState=f,a.copyState=e,g.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return D(this.string,this.start)},indentation:function(){return D(this.string)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=g,h.prototype={replace:function(a,b,c){var d=[],e=this.marked;i(0,a,this.styles,d),c&&d.push(c,null),i(b,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(b),this.stateAfter=null;if(e){var f=c.length-(b-a),g=this.text.length;function h(a){return a<=Math.min(b,b+f)?a:a+f}for(var j=0;j<e.length;++j){var k=e[j],l=!1;k.from>=g?l=!0:(k.from=h(k.from),k.to!=null&&(k.to=h(k.to)));if(l||k.from>=k.to)e.splice(j,1),j--}}},split:function(a,b){var c=[b,null];return i(a,this.text.length,this.styles,c),new h(b+this.text.slice(a),c)},addMark:function(a,b,c){var d=this.marked,e={from:a,to:b,style:c};return this.marked==null&&(this.marked=[]),this.marked.push(e),this.marked.sort(function(a,b){return a.from-b.from}),e},removeMark:function(a){var b=this.marked;if(!b)return;for(var c=0;c<b.length;++c)if(b[c]==a){b.splice(c,1);break}},highlight:function(a,b){var c=new g(this.text),d=this.styles,e=0,f=!1,h=d[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!c.eol()){var j=a.token(c,b),k=this.text.slice(c.start,c.pos);c.start=c.pos,e&&d[e-1]==j?d[e-2]+=k:k&&(!f&&(d[e+1]!=j||e&&d[e-2]!=i)&&(f=!0),d[e++]=k,d[e++]=j,i=h,h=d[e]);if(c.pos>5e3){d[e++]=this.text.slice(c.pos),d[e++]=null;break}}return d.length!=e&&(d.length=e,f=!0),e&&d[e-2]!=i&&(f=!0),f||(d.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new g(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(){return D(this.text)},getHTML:function(a,b,c,d){function f(a,b){if(!a)return;b?e.push('<span class="',b,'">',L(a),"</span>"):e.push(L(a))}var e=[];c&&e.push(this.className?'<pre class="'+this.className+'">':"<pre>");var g=this.styles,h=this.text,i=this.marked;a==b&&(a=null);var j=h.length;d!=null&&(j=Math.min(d,j));if(!h&&d==null)f(" ",a!=null&&b==null?"CodeMirror-selected":null);else if(!i&&a==null)for(var k=0,l=0;l<j;k+=2){var m=g[k],n=g[k+1],o=m.length;l+o>j&&(m=m.slice(0,j-l)),l+=o,f(m,n&&"cm-"+n)}else{var p=0,k=0,q="",n,r=0,s=-1,t=null;function u(){i&&(s+=1,t=s<i.length?i[s]:null)}u();while(p<j){var v=j,w="";if(a!=null)if(a>p)v=a;else if(b==null||b>p)w=" CodeMirror-selected",b!=null&&(v=Math.min(v,b));while(t&&t.to!=null&&t.to<=p)u();t&&(t.from>p?v=Math.min(v,t.from):(w+=" "+t.style,t.to!=null&&(v=Math.min(v,t.to))));for(;;){var x=p+q.length,y=n;w&&(y=n?n+w:w),f(x>v?q.slice(0,v-p):q,y);if(x>=v){q=q.slice(v-p),p=v;break}p=x,q=g[k++],n="cm-"+g[k++]}}a!=null&&b==null&&f(" ","CodeMirror-selected")}return c&&e.push("</pre>"),e.join("")}},j.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1];if(d-this.time>400||!e||e.start>a+b||e.start+e.added<a-e.added+e.old.length)this.done.push({start:a,added:b,old:c});else{var f=0;if(a<e.start){for(var g=e.start-a-1;g>=0;--g)e.old.unshift(c[g]);e.added+=e.start-a,e.start=a}else e.start<a&&(f=a-e.start,b+=f);for(var g=e.added-f,h=c.length;g<h;++g)e.old.push(c[g]);e.added<b&&(e.added=b)}this.time=d}},s.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var t=function(){var a=document.createElement("pre");return a.innerHTML=" ",!a.innerHTML}(),u=function(){if(/MSIE [1-8]\b/.test(navigator.userAgent))return!1;var a=document.createElement("div");return"ondragstart"in a&&"ondrop"in a}(),v=/gecko\/\d{7}/i.test(navigator.userAgent),w=/MSIE \d/.test(navigator.userAgent),x=/Apple Computer/.test(navigator.vendor),y="\n";(function(){var a=document.createElement("textarea");a.value="foo\nbar",a.value.indexOf("\r")>-1&&(y="\r\n")})();var z=8,A=/Mac/.test(navigator.platform),B={};for(var C=35;C<=40;++C)B[C]=B["c"+C]=!0;var K=document.createElement("div");a.htmlEscape=L;var O,P,Q;return"\n\nb".split(/\n/).length!=3?O=function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:O=function(a){return a.split(/\r?\n/)},a.splitLines=O,window.getSelection?(P=function(a){try{return{start:a.selectionStart,end:a.selectionEnd}}catch(b){return null}},x?Q=function(a,b,c){b==c?a.setSelectionRange(b,c):(a.setSelectionRange(b,c-1),window.getSelection().modify("extend","forward","character"))}:Q=function(a,b,c){try{a.setSelectionRange(b,c)}catch(d){}}):(P=function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){return null}if(!b||b.parentElement()!=a)return null;var d=a.value,e=d.length,f=a.createTextRange();f.moveToBookmark(b.getBookmark());var g=a.createTextRange();g.collapse(!1);if(f.compareEndPoints("StartToEnd",g)>-1)return{start:e,end:e};var h=-f.moveStart("character",-e);for(var i=d.indexOf("\r");i>-1&&i<h;i=d.indexOf("\r",i+1),h++);if(f.compareEndPoints("EndToEnd",g)>-1)return{start:h,end:e};var j=-f.moveEnd("character",-e);for(var i=d.indexOf("\r");i>-1&&i<j;i=d.indexOf("\r",i+1),j++);return{start:h,end:j}},Q=function(a,b,c){var d=a.createTextRange();d.collapse(!0);var e=d.duplicate(),f=0,g=a.value;for(var h=g.indexOf("\n");h>-1&&h<b;h=g.indexOf("\n",h+1))++f;d.move("character",b-f);for(;h>-1&&h<c;h=g.indexOf("\n",h+1))++f;e.move("character",c-f),d.setEndPoint("EndToEnd",e),d.select()}),a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null"),a}();CodeMirror.overlayParser=function(a,b,c){return{startState:function(){return{base:CodeMirror.startState(a),overlay:CodeMirror.startState(b),basePos:0,baseCur:null,overlayPos:0,overlayCur:null}},copyState:function(c){return{base:CodeMirror.copyState(a,c.base),overlay:CodeMirror.copyState(b,c.overlay),basePos:c.basePos,baseCur:null,overlayPos:c.overlayPos,overlayCur:null}},token:function(d,e){return d.start==e.basePos&&(e.baseCur=a.token(d,e.base),e.basePos=d.pos),d.start==e.overlayPos&&(d.pos=d.start,e.overlayCur=b.token(d,e.overlay),e.overlayPos=d.pos),d.pos=Math.min(e.basePos,e.overlayPos),d.eol()&&(e.basePos=e.overlayPos=0),e.overlayCur==null?e.baseCur:e.baseCur!=null&&c?e.baseCur+" "+e.overlayCur:e.overlayCur},indent:function(b,c){return a.indent(b.base,c)},electricChars:a.electricChars}},CodeMirror.runMode=function(a,b,c){var d=CodeMirror.getMode({indentUnit:2},b),e=c.nodeType==1;if(e){var f=c,g=[];c=function(a,b){a=="\n"?g.push("<br>"):b?g.push('<span class="cm-'+CodeMirror.htmlEscape(b)+'">'+CodeMirror.htmlEscape(a)+"</span>"):g.push(CodeMirror.htmlEscape(a))}}var h=CodeMirror.splitLines(a),i=CodeMirror.startState(d);for(var j=0,k=h.length;j<k;++j){j&&c("\n");var l=new CodeMirror.StringStream(h[j]);while(!l.eol()){var m=d.token(l,i);c(l.current(),m),l.start=l.pos}}e&&(f.innerHTML=g.join(""))},CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function e(a,b){var c=a.next();if(c=="@")return a.eatWhile(/[\w\\\-]/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=f,f(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=g,g(a,b);if(c=="=")d(null,"compare");else return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=h(c),b.tokenize(a,b)):c=="#"?(a.eatWhile(/[\w\\\-]/),d("atom","hash")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,.+>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]]/.test(c)?d(null,c):(a.eatWhile(/[\w\\\-]/),d("variable","variable")):d(null,"compare")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("comment","comment")}function g(a,b){var c=0,f;while((f=a.next())!=null){if(c>=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("comment","comment")}function h(a){return function(b,c){var f=!1,g;while((g=b.next())!=null){if(g==a&&!f)break;f=!f&&g=="\\"}return f||(c.tokenize=e),d("string","string")}}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="atom";else if(d=="variable")if(e=="rule")d="number";else if(!e||e=="@media{")d="tag";return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(a,b){function f(a,b){var f=c.token(a,b.htmlState);return f=="tag"&&a.current()==">"&&b.htmlState.context&&(/^script$/i.test(b.htmlState.context.tagName)?(b.token=h,b.localState=d.startState(c.indent(b.htmlState,"")),b.mode="javascript"):/^style$/i.test(b.htmlState.context.tagName)&&(b.token=i,b.localState=e.startState(c.indent(b.htmlState,"")),b.mode="css")),f}function g(a,b,c){var d=a.current(),e=d.search(b);return e>-1&&a.backUp(d.length-e),c}function h(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=f,b.curState=null,b.mode="html",f(a,b)):g(a,/<\/\s*script\s*>/,d.token(a,b.localState))}function i(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*style\s*>/,e.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"javascript"),e=CodeMirror.getMode(a,"css");return{startState:function(){var a=c.startState();return{token:f,localState:null,mode:"html",htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.token==i?e:d,a.localState);return{token:a.token,localState:b,mode:a.mode,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return a.token==f||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.token==h?d.indent(a.localState,b):e.indent(a.localState,b)},electricChars:"/{}:"}}),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(a,b){function g(a,b,c){return b.tokenize=c,c(a,b)}function h(a,b){var c=!1,d;while((d=a.next())!=null){if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}function k(a,b,c){return i=a,j=c,b}function l(a,b){var c=a.next();if(c=='"'||c=="'")return g(a,b,m(c));if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if(c=="0"&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/),k("number","number");if(c=="/")return a.eat("*")?g(a,b,n):a.eat("/")?(a.skipToEnd(),k("comment","comment")):b.reAllowed?(h(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string")):(a.eatWhile(f),k("operator",null,a.current()));if(c=="#")return a.skipToEnd(),k("error","error");if(f.test(c))return a.eatWhile(f),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),i=e.propertyIsEnumerable(d)&&e[d];return i?k(i.type,i.style,d):k("variable","variable",d)}function m(a){return function(b,c){return h(b,a)||(c.tokenize=l),k("string","string")}}function n(a,b){var c=!1,d;while(d=a.next()){if(d=="/"&&c){b.tokenize=l;break}c=d=="*"}return k("comment","comment")}function p(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,d!=null&&(this.align=d)}function q(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function r(a,b,c,e,f){var g=a.cc;s.state=a,s.stream=f,s.marked=null,s.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;){var h=g.length?g.pop():d?D:C;if(h(c,e)){while(g.length&&g[g.length-1].lex)g.pop()();return s.marked?s.marked:c=="variable"&&q(a,e)?"variable-2":b}}}function t(){for(var a=arguments.length-1;a>=0;a--)s.cc.push(arguments[a])}function u(){return t.apply(null,arguments),!0}function v(a){var b=s.state;if(b.context){s.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function x(){s.state.context||(s.state.localVars=w),s.state.context={prev:s.state.context,vars:s.state.localVars}}function y(){s.state.localVars=s.state.context.vars,s.state.context=s.state.context.prev}function z(a,b){var c=function(){var c=s.state;c.lexical=new p(c.indented,s.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function A(){var a=s.state;a.lexical.prev&&(a.lexical.type==")"&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function B(a){return function b(b){return b==a?u():a==";"?t():u(arguments.callee)}}function C(a){return a=="var"?u(z("vardef"),K,B(";"),A):a=="keyword a"?u(z("form"),D,C,A):a=="keyword b"?u(z("form"),C,A):a=="{"?u(z("}"),J,A):a==";"?u():a=="function"?u(Q):a=="for"?u(z("form"),B("("),z(")"),M,B(")"),A,C,A):a=="variable"?u(z("stat"),F):a=="switch"?u(z("form"),D,z("}","switch"),B("{"),J,A,A):a=="case"?u(D,B(":")):a=="default"?u(B(":")):a=="catch"?u(z("form"),x,B("("),R,B(")"),C,A,y):t(z("stat"),D,B(";"),A)}function D(a){return o.hasOwnProperty(a)?u(E):a=="function"?u(Q):a=="keyword c"?u(D):a=="("?u(z(")"),D,B(")"),A,E):a=="operator"?u(D):a=="["?u(z("]"),I(D,"]"),A,E):a=="{"?u(z("}"),I(H,"}"),A,E):u()}function E(a,b){if(a=="operator"&&/\+\+|--/.test(b))return u(E);if(a=="operator")return u(D);if(a==";")return;if(a=="(")return u(z(")"),I(D,")"),A,E);if(a==".")return u(G,E);if(a=="[")return u(z("]"),D,B("]"),A,E)}function F(a){return a==":"?u(A,C):t(E,B(";"),A)}function G(a){if(a=="variable")return s.marked="property",u()}function H(a){a=="variable"&&(s.marked="property");if(o.hasOwnProperty(a))return u(B(":"),D)}function I(a,b){function c(d){return d==","?u(a,c):d==b?u():u(B(b))}return function d(d){return d==b?u():t(a,c)}}function J(a){return a=="}"?u():t(C,J)}function K(a,b){return a=="variable"?(v(b),u(L)):u()}function L(a,b){if(b=="=")return u(D,L);if(a==",")return u(K)}function M(a){return a=="var"?u(K,O):a==";"?t(O):a=="variable"?u(N):t(O)}function N(a,b){return b=="in"?u(D):u(E,O)}function O(a,b){return a==";"?u(P):b=="in"?u(D):u(D,B(";"),P)}function P(a){a!=")"&&u(D)}function Q(a,b){if(a=="variable")return v(b),u(Q);if(a=="(")return u(z(")"),x,I(R,")"),A,C,y)}function R(a,b){if(a=="variable")return v(b),u()}var c=a.indentUnit,d=b.json,e=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"};return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),f=/[+\-*&%=<>!?|]/,i,j,o={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},s={state:null,column:null,marked:null,cc:null},w={name:"this",next:{name:"arguments"}};return A.lex=!0,{startState:function(a){return{tokenize:l,reAllowed:!0,cc:[],lexical:new p((a||0)-c,0,"block",!1),localVars:null,context:null,indented:0}},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation());if(a.eatSpace())return null;var c=b.tokenize(a,b);return i=="comment"?c:(b.reAllowed=i=="operator"||i=="keyword c"||i.match(/^[\[{}\(,;:]$/),r(b,c,i,j,a))},indent:function(a,b){if(a.tokenize!=l)return 0;var d=b&&b.charAt(0),e=a.lexical,f=e.type,g=d==f;return f=="vardef"?e.indented+4:f=="form"&&d=="{"?e.indented:f=="stat"||f=="form"?e.indented+c:e.info=="switch"&&!g?e.indented+(/^(?:case|default)\b/.test(b)?c:2*c):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(a,b){function h(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if(d=="<"){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(k("atom","]]>")):null:a.match("--")?c(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(k("meta",">"))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=k("meta","?>"),"meta";g=a.eat("/")?"closeTag":"openTag",a.eatSpace(),f="";var e;while(e=a.eat(/[^\s\u00a0=<>\"\'\/?]/))f+=e;return b.tokenize=i,"tag"}return d=="&"?(a.eatWhile(/[^;]/),a.eat(";"),"atom"):(a.eatWhile(/[^&<]/),null)}function i(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=h,g=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(g="equals",null):/[\'\"]/.test(c)?(b.tokenize=j(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function j(a){return function(b,c){while(!b.eol())if(b.next()==a){c.tokenize=i;break}return"string"}}function k(a,b){return function(c,d){while(!c.eol()){if(c.match(b)){d.tokenize=h;break}c.next()}return a}}function n(){for(var a=arguments.length-1;a>=0;a--)l.cc.push(arguments[a])}function o(){return n.apply(null,arguments),!0}function p(a,b){var c=d.doNotIndent.hasOwnProperty(a)||l.context&&l.context.noIndent;l.context={prev:l.context,tagName:a,indent:l.indented,startOfLine:b,noIndent:c}}function q(){l.context&&(l.context=l.context.prev)}function r(a){if(a=="openTag")return l.tagName=f,o(u,s(l.startOfLine));if(a=="closeTag"){var b=!1;return l.context?b=l.context.tagName!=f:b=!0,b&&(m="error"),o(t(b))}return a=="string"?((!l.context||l.context.name!="!cdata")&&p("!cdata"),l.tokenize==h&&q(),o()):o()}function s(a){return function(b){return b=="selfcloseTag"||b=="endTag"&&d.autoSelfClosers.hasOwnProperty(l.tagName.toLowerCase())?o():b=="endTag"?(p(l.tagName,a),o()):o()}}function t(a){return function(b){return a&&(m="error"),b=="endTag"?(q(),o()):(m="error",o(arguments.callee))}}function u(a){return a=="word"?(m="attribute",o(u)):a=="equals"?o(v,u):a=="string"?(m="error",o(u)):n()}function v(a){return a=="word"&&d.allowUnquoted?(m="string",o()):a=="string"?o(w):n()}function w(a){return a=="string"?o(w):n()}var c=a.indentUnit,d=b.htmlMode?{autoSelfClosers:{br:!0,img:!0,hr:!0,link:!0,input:!0,meta:!0,col:!0,frame:!0,base:!0,area:!0},doNotIndent:{pre:!0,"!cdata":!0},allowUnquoted:!0}:{autoSelfClosers:{},doNotIndent:{"!cdata":!0},allowUnquoted:!1},e=b.alignCDATA,f,g,l,m;return{startState:function(){return{tokenize:h,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(a,b){a.sol()&&(b.startOfLine=!0,b.indented=a.indentation());if(a.eatSpace())return null;m=g=f=null;var c=b.tokenize(a,b);if((c||g)&&c!="comment"){l=b;for(;;){var d=b.cc.pop()||r;if(d(g||c))break}}return b.startOfLine=!1,m||c},indent:function(a,b){var d=a.context;if(d&&d.noIndent)return 0;if(e&&/<!\[CDATA\[/.test(b))return 0;d&&/^<\//.test(b)&&(d=d.prev);while(d&&!d.startOfLine)d=d.prev;return d?d.indent+c:0},compareStates:function(a,b){if(a.indented!=b.indented)return!1;for(var c=a.context,d=b.context;;c=c.prev,d=d.prev){if(!c||!d)return c==d;if(c.tagName!=d.tagName)return!1}},electricChars:"/"}}),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0})
|
1
|
+
var CodeMirror=function(){function a(d,e){function bS(a){return a>=0&&a<bq.size}function bU(a){return u(bq,a)}function bV(a,b){bH=!0;var c=b-a.height;for(var d=a;d;d=d.parent)d.height+=c}function bW(a){var b={line:0,ch:0};ch(b,{line:bq.size-1,ch:bU(bq.size-1).text.length},_(a),b,b),bB=!0}function bX(a){var b=[];return bq.iter(0,bq.size,function(a){b.push(a.text)}),b.join("\n")}function bY(a){function j(a){var b=dA(a,!0);if(b&&!T(b,g)){bs||cf(),g=b,cI(d,b),bB=!1;var c=cB();if(b.line>=c.to||b.line<c.from)h=setTimeout(dN(function(){j(a)}),150)}}cH(G(a,"shiftKey"));for(var b=E(a);b!=C;b=b.parentNode)if(b.parentNode==bc&&b!=bd)return;for(var b=E(a);b!=C;b=b.parentNode)if(b.parentNode==bf)return f.onGutterClick&&f.onGutterClick(bT,Z(bf.childNodes,b)+bK,a),B(a);var d=dA(a);switch(F(a)){case 3:K&&!c&&dB(a);return;case 2:d&&cL(d.line,d.ch,!0);return}if(!d){E(a)==P&&B(a);return}bs||cf();var e=+(new Date);if(bw&&bw.time>e-400&&T(bw.pos,d))return B(a),setTimeout(cx,20),cU(d.line);if(bv&&bv.time>e-400&&T(bv.pos,d))return bw={time:e,pos:d},B(a),cT(d);bv={time:e,pos:d};var g=d,h;if(J&&!f.readOnly&&!T(bt.from,bt.to)&&!U(d,bt.from)&&!U(bt.to,d)){M&&(bg.draggable=!0);var i=H(z,"mouseup",dN(function(b){M&&(bg.draggable=!1),by=!1,i(),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(B(b),cL(d.line,d.ch,!0),cx())}),!0);by=!0;return}B(a),cL(d.line,d.ch,!0);var k=H(z,"mousemove",dN(function(a){clearTimeout(h),B(a),j(a)}),!0),i=H(z,"mouseup",dN(function(a){clearTimeout(h);var b=dA(a);b&&cI(d,b),B(a),cx(),bB=!0,k(),i()}),!0)}function bZ(a){for(var b=E(a);b!=C;b=b.parentNode)if(b.parentNode==bf)return B(a);var c=dA(a);if(!c)return;bw={time:+(new Date),pos:c},B(a),cT(c)}function b$(a){a.preventDefault();var b=dA(a,!0),c=a.dataTransfer.files;if(!b||f.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){g[c]=d.result,++h==e&&(b=cN(b),dN(function(){var a=cm(g.join(""),b,b);cI(b,a)})())},d.readAsText(a)}var e=c.length,g=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var g=a.dataTransfer.getData("Text");if(g){var j=bt.from,k=bt.to;cI(b,b),by&&cm("",j,k),cn(g),cx()}}catch(a){}}function b_(a){var b=cq();X(b),a.dataTransfer.setDragImage(W,0,0),a.dataTransfer.setData("Text",b)}function ca(a){function g(){return c.call?c.call(null,bT):c}var b=bb[G(a,"keyCode")],c=i[f.keyMap].auto,d,e;if(b==null||a.altGraphKey)return c&&(f.keyMap=g()),null;G(a,"altKey")&&(b="Alt-"+b),G(a,"ctrlKey")&&(b="Ctrl-"+b),G(a,"metaKey")&&(b="Cmd-"+b),G(a,"shiftKey")&&(d=j("Shift-"+b,f.extraKeys,f.keyMap))?e=!0:d=j(b,f.extraKeys,f.keyMap),typeof d=="string"&&(h.propertyIsEnumerable(d)?d=h[d]:d=null),c&&(d||!k(a))&&(f.keyMap=g());if(!d)return!1;var l=bu;try{f.readOnly&&(bA=!0),e&&(bu=null),d(bT)}finally{bu=l,bA=!1}return B(a),!0}function cc(a){bs||cf(),L&&a.keyCode==27&&(a.returnValue=!1);if(f.onKeyEvent&&f.onKeyEvent(bT,A(a)))return;var b=G(a,"keyCode");cH(b==16||G(a,"shiftKey"));var d=ca(a);window.opera&&(cb=d?b:null,!d&&b==88&&G(a,c?"metaKey":"ctrlKey")&&cn(""))}function cd(a){if(f.onKeyEvent&&f.onKeyEvent(bT,A(a)))return;var b=G(a,"keyCode"),c=G(a,"charCode");if(window.opera&&b==cb){cb=null,B(a);return}if(window.opera&&!a.which&&ca(a))return;if(f.electricChars&&bp.electricChars&&f.smartIndent&&!f.readOnly){var d=String.fromCharCode(c==null?b:c);bp.electricChars.indexOf(d)>-1&&setTimeout(dN(function(){cW(bt.to.line,"smart")}),75)}ct()}function ce(a){if(f.onKeyEvent&&f.onKeyEvent(bT,A(a)))return;G(a,"keyCode")==16&&(bu=null)}function cf(){if(f.readOnly=="nocursor")return;bs||(f.onFocus&&f.onFocus(bT),bs=!0,C.className.search(/\bCodeMirror-focused\b/)==-1&&(C.className+=" CodeMirror-focused"),bG||cw(!0)),cs(),dC()}function cg(){bs&&(f.onBlur&&f.onBlur(bT),bs=!1,bN&&dN(function(){bN&&(bN(),bN=null)})(),C.className=C.className.replace(" CodeMirror-focused","")),clearInterval(bo),setTimeout(function(){bs||(bu=null)},150)}function ch(a,b,c,d,e){if(bA)return;if(bQ){var g=[];bq.iter(a.line,b.line+1,function(a){g.push(a.text)}),bQ.addChange(a.line,c.length,g);while(bQ.done.length>f.undoDepth)bQ.done.shift()}cl(a,b,c,d,e)}function ci(a,b,c){var d=a.pop(),e=d?d.length:0,f=[];for(var g=c>0?0:e-1,h=c>0?e:-1;g!=h;g+=c){var i=d[g],j=[],k=i.start+i.added;bq.iter(i.start,k,function(a){j.push(a.text)}),f.push({start:i.start,added:i.old.length,old:j});var l=cN({line:i.start+i.old.length-1,ch:Y(j[j.length-1],i.old[i.old.length-1])});cl({line:i.start,ch:0},{line:k-1,ch:bU(k-1).text.length},i.old,l,l)}bB=!0,b.push(f)}function cj(){ci(bQ.done,bQ.undone,-1)}function ck(){ci(bQ.undone,bQ.done,1)}function cl(a,b,c,d,e){function y(a){return a<=Math.min(b.line,b.line+s)?a:a+s}if(bA)return;var g=!1,h=bO.length;f.lineWrapping||bq.iter(a.line,b.line,function(a){if(a.text.length==h)return g=!0,!0});if(a.line!=b.line||c.length>1)bH=!0;var i=b.line-a.line,j=bU(a.line),k=bU(b.line);if(a.ch==0&&b.ch==0&&c[c.length-1]==""){var l=[],m=null;a.line?(m=bU(a.line-1),m.fixMarkEnds(k)):k.fixMarkStarts();for(var n=0,o=c.length-1;n<o;++n)l.push(q.inheritMarks(c[n],m));i&&bq.remove(a.line,i,bI),l.length&&bq.insert(a.line,l)}else if(j==k)if(c.length==1)j.replace(a.ch,b.ch,c[0]);else{k=j.split(b.ch,c[c.length-1]),j.replace(a.ch,null,c[0]),j.fixMarkEnds(k);var l=[];for(var n=1,o=c.length-1;n<o;++n)l.push(q.inheritMarks(c[n],j));l.push(k),bq.insert(a.line+1,l)}else if(c.length==1)j.replace(a.ch,null,c[0]),k.replace(null,b.ch,""),j.append(k),bq.remove(a.line+1,i,bI);else{var l=[];j.replace(a.ch,null,c[0]),k.replace(null,b.ch,c[c.length-1]),j.fixMarkEnds(k);for(var n=1,o=c.length-1;n<o;++n)l.push(q.inheritMarks(c[n],j));i>1&&bq.remove(a.line+1,i-1,bI),bq.insert(a.line+1,l)}if(f.lineWrapping){var p=P.clientWidth/dx()-3;bq.iter(a.line,a.line+c.length,function(a){if(a.hidden)return;var b=Math.ceil(a.text.length/p)||1;b!=a.height&&bV(a,b)})}else bq.iter(a.line,n+c.length,function(a){var b=a.text;b.length>h&&(bO=b,h=b.length,bP=null,g=!1)}),g&&(h=0,bO="",bP=null,bq.iter(0,bq.size,function(a){var b=a.text;b.length>h&&(h=b.length,bO=b)}));var r=[],s=c.length-i-1;for(var n=0,t=br.length;n<t;++n){var u=br[n];u<a.line?r.push(u):u>b.line&&r.push(u+s)}var v=a.line+Math.min(c.length,500);dH(a.line,v),r.push(v),br=r,dJ(100),bD.push({from:a.line,to:b.line+1,diff:s});var w={from:a,to:b,text:c};if(bE){for(var x=bE;x.next;x=x.next);x.next=w}else bE=w;cJ(d,e,y(bt.from.line),y(bt.to.line)),P.clientHeight&&(bc.style.height=bq.height*du()+2*dy()+"px")}function cm(a,b,c){function d(d){if(U(d,b))return d;if(!U(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=cN(b),c?c=cN(c):c=b,a=_(a);var e;return co(a,b,c,function(a){return e=a,{from:d(bt.from),to:d(bt.to)}}),e}function cn(a,b){co(_(a),bt.from,bt.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:bt.from,to:bt.from}:{from:bt.from,to:a}})}function co(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});ch(b,c,a,f.from,f.to)}function cp(a,b){var c=a.line,d=b.line;if(c==d)return bU(c).text.slice(a.ch,b.ch);var e=[bU(c).text.slice(a.ch)];return bq.iter(c+1,d,function(a){e.push(a.text)}),e.push(bU(d).text.slice(0,b.ch)),e.join("\n")}function cq(){return cp(bt.from,bt.to)}function cs(){if(cr)return;bm.set(f.pollInterval,function(){dK(),cv(),bs&&cs(),dL()})}function ct(){function b(){dK();var c=cv();!c&&!a?(a=!0,bm.set(60,b)):(cr=!1,cs()),dL()}var a=!1;cr=!0,bm.set(20,b)}function cv(){if(bG||!bs||ba(O)||f.readOnly)return!1;var a=O.value;if(a==cu)return!1;bu=null;var b=0,c=Math.min(cu.length,a.length);while(b<c&&cu[b]==a[b])++b;return b<cu.length?bt.from={line:bt.from.line,ch:bt.from.ch-(cu.length-b)}:bz&&T(bt.from,bt.to)&&(bt.to={line:bt.to.line,ch:Math.min(bU(bt.to.line).text.length,bt.to.ch+(a.length-b))}),cn(a.slice(b),"end"),cu=a,!0}function cw(a){T(bt.from,bt.to)?a&&(cu=O.value=""):(cu="",O.value=cq(),S(O))}function cx(){f.readOnly!="nocursor"&&O.focus()}function cy(){if(!bi.getBoundingClientRect)return;var a=bi.getBoundingClientRect();if(L&&a.top==a.bottom)return;var b=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.top<0||a.bottom>b)&&bi.scrollIntoView()}function cz(){var a=dn(bt.inverted?bt.from:bt.to),b=f.lineWrapping?Math.min(a.x,bg.offsetWidth):a.x;return cA(b,a.y,b,a.yBot)}function cA(a,b,c,d){var e=dz(),g=dy(),h=du();b+=g,d+=g,a+=e,c+=e;var i=P.clientHeight,j=P.scrollTop,k=!1,l=!0;b<j?(P.scrollTop=Math.max(0,b-2*h),k=!0):d>j+i&&(P.scrollTop=d+h-i,k=!0);var m=P.clientWidth,n=P.scrollLeft,o=f.fixedGutter?be.clientWidth:0;return a<n+o?(a<50&&(a=0),P.scrollLeft=Math.max(0,a-10-o),k=!0):c>m+n-3&&(P.scrollLeft=c+10-m,k=!0,c>bc.clientWidth&&(l=!1)),k&&f.onScroll&&f.onScroll(bT),l}function cB(){var a=du(),b=P.scrollTop-dy(),c=Math.max(0,Math.floor(b/a)),d=Math.ceil((b+P.clientHeight)/a);return{from:w(bq,c),to:w(bq,d)}}function cC(a,b){if(!P.clientWidth){bK=bL=bJ=0;return}var c=cB();if(a!==!0&&a.length==0&&c.from>bK&&c.to<bL)return;var d=Math.max(c.from-100,0),e=Math.min(bq.size,c.to+100);bK<d&&d-bK<20&&(d=bK),bL>e&&bL-e<20&&(e=Math.min(bq.size,bL));var g=a===!0?[]:cD([{from:bK,to:bL,domStart:0}],a),h=0;for(var i=0;i<g.length;++i){var j=g[i];j.from<d&&(j.domStart+=d-j.from,j.from=d),j.to>e&&(j.to=e),j.from>=j.to?g.splice(i--,1):h+=j.to-j.from}if(h==e-d)return;g.sort(function(a,b){return a.domStart-b.domStart});var k=du(),l=be.style.display;bk.style.display="none",cE(d,e,g),bk.style.display=be.style.display="";var m=d!=bK||e!=bL||bM!=P.clientHeight+k;m&&(bM=P.clientHeight+k),bK=d,bL=e,bJ=x(bq,d),bd.style.top=bJ*k+"px",P.clientHeight&&(bc.style.height=bq.height*k+2*dy()+"px");if(bk.childNodes.length!=bL-bK)throw new Error("BAD PATCH! "+JSON.stringify(g)+" size="+(bL-bK)+" nodes="+bk.childNodes.length);if(f.lineWrapping){bP=P.clientWidth;var n=bk.firstChild,o=!1;bq.iter(bK,bL,function(a){if(!a.hidden){var b=Math.round(n.offsetHeight/k)||1;a.height!=b&&(bV(a,b),bH=o=!0)}n=n.nextSibling}),o&&(bc.style.height=bq.height*k+2*dy()+"px")}else bP==null&&(bP=dj(bO)),bP>P.clientWidth?(bg.style.width=bP+"px",bc.style.width="",bc.style.width=P.scrollWidth+"px"):bg.style.width=bc.style.width="";return be.style.display=l,(m||bH)&&cF(),cG(),!b&&f.onUpdate&&f.onUpdate(bT),!0}function cD(a,b){for(var c=0,d=b.length||0;c<d;++c){var e=b[c],f=[],g=e.diff||0;for(var h=0,i=a.length;h<i;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}a=f}return a}function cE(a,b,c){if(!c.length)bk.innerHTML="";else{function d(a){var b=a.nextSibling;return a.parentNode.removeChild(a),b}var e=0,f=bk.firstChild,g;for(var h=0;h<c.length;++h){var i=c[h];while(i.domStart>e)f=d(f),e++;for(var j=0,k=i.to-i.from;j<k;++j)f=f.nextSibling,e++}while(f)f=d(f)}var l=c.shift(),f=bk.firstChild,j=a,m=z.createElement("div"),n;bq.iter(a,b,function(a){l&&l.to==j&&(l=c.shift());if(!l||l.from>j){if(a.hidden)var b=m.innerHTML="<pre></pre>";else{var b="<pre>"+a.getHTML(c$)+"</pre>";a.className&&(b='<div style="position: relative"><pre class="'+a.className+'" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>'+b+"</div>")}m.innerHTML=b,bk.insertBefore(m.firstChild,f)}else f=f.nextSibling;++j})}function cF(){if(!f.gutter&&!f.lineNumbers)return;var a=bd.offsetHeight,b=P.clientHeight;be.style.height=(a-b<2?b:a)+"px";var c=[],d=bK;bq.iter(bK,Math.max(bL,bK+1),function(a){if(a.hidden)c.push("<pre></pre>");else{var b=a.gutterMarker,e=f.lineNumbers?d+f.firstLineNumber:null;b&&b.text?e=b.text.replace("%N%",e!=null?e:""):e==null&&(e="\u00a0"),c.push(b&&b.style?'<pre class="'+b.style+'">':"<pre>",e);for(var g=1;g<a.height;++g)c.push("<br/> ");c.push("</pre>")}++d}),be.style.display="none",bf.innerHTML=c.join("");var e=String(bq.size).length,g=bf.firstChild,h=R(g),i="";while(h.length+i.length<e)i+="\u00a0";i&&g.insertBefore(z.createTextNode(i),g.firstChild),be.style.display="",bg.style.marginLeft=be.offsetWidth+"px",bH=!1}function cG(){var a=T(bt.from,bt.to),b=dn(bt.from,!0),c=a?b:dn(bt.to,!0),d=bt.inverted?b:c,e=du(),g=Q(C),h=Q(bk);N.style.top=Math.max(0,Math.min(P.offsetHeight,d.y+h.top-g.top))+"px",N.style.left=Math.max(0,Math.min(P.offsetWidth,d.x+h.left-g.left))+"px";if(a)bi.style.top=d.y+"px",bi.style.left=(f.lineWrapping?Math.min(d.x,bg.offsetWidth):d.x)+"px",bi.style.display="",bj.style.display="none";else{var i=b.y==c.y,j="";function k(a,b,c,d){j+='<div class="CodeMirror-selected" style="position: absolute; left: '+a+"px; top: "+b+"px; right: "+c+"px; height: "+d+'px"></div>'}if(bt.from.ch&&b.y>=0){var l=i?bg.clientWidth-c.x:0;k(b.x,b.y,l,e)}var m=Math.max(0,b.y+(bt.from.ch?e:0)),n=Math.min(c.y,bg.clientHeight)-m;n>.2*e&&k(0,m,0,n),(!i||!bt.from.ch)&&c.y<bg.clientHeight-.5*e&&k(0,c.y,bg.clientWidth-c.x,e),bj.innerHTML=j,bi.style.display="none",bj.style.display=""}}function cH(a){a?bu=bu||(bt.inverted?bt.to:bt.from):bu=null}function cI(a,b){var c=bu&&cN(bu);c&&(U(c,a)?a=c:U(b,c)&&(b=c)),cJ(a,b),bC=!0}function cJ(a,b,c,d){cR=null,c==null&&(c=bt.from.line,d=bt.to.line);if(T(bt.from,a)&&T(bt.to,b))return;if(U(b,a)){var e=b;b=a,a=e}a.line!=c&&(a=cK(a,c,bt.from.ch)),b.line!=d&&(b=cK(b,d,bt.to.ch)),T(a,b)?bt.inverted=!1:T(a,bt.to)?bt.inverted=!1:T(b,bt.from)&&(bt.inverted=!0),bt.from=a,bt.to=b,bF=!0}function cK(a,b,c){function d(b){var d=a.line+b,e=b==1?bq.size:-1;while(d!=e){var f=bU(d);if(!f.hidden){var g=a.ch;if(g>c||g>f.text.length)g=f.text.length;return{line:d,ch:g}}d+=b}}var e=bU(a.line);return e.hidden?a.line>=b?d(1)||d(-1):d(-1)||d(1):a}function cL(a,b,c){var d=cN({line:a,ch:b||0});(c?cI:cJ)(d,d)}function cM(a){return Math.max(0,Math.min(a,bq.size-1))}function cN(a){if(a.line<0)return{line:0,ch:0};if(a.line>=bq.size)return{line:bq.size-1,ch:bU(bq.size-1).text.length};var b=a.ch,c=bU(a.line).text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function cO(a,b){function g(){for(var b=d+a,c=a<0?-1:bq.size;b!=c;b+=a){var e=bU(b);if(!e.hidden)return d=b,f=e,!0}}function h(b){if(e==(a<0?0:f.text.length))if(!b&&g())e=a<0?f.text.length:0;else return!1;else e+=a;return!0}var c=bt.inverted?bt.from:bt.to,d=c.line,e=c.ch,f=bU(d);if(b=="char")h();else if(b=="column")h(!0);else if(b=="word"){var i=!1;for(;;){if(a<0&&!h())break;if($(f.text.charAt(e)))i=!0;else if(i){a<0&&(a=1,h());break}if(a>0&&!h())break}}return{line:d,ch:e}}function cP(a,b){var c=a<0?bt.from:bt.to;if(bu||T(bt.from,bt.to))c=cO(a,b);cL(c.line,c.ch,!0)}function cQ(a,b){T(bt.from,bt.to)?a<0?cm("",cO(a,b),bt.to):cm("",bt.from,cO(a,b)):cm("",bt.from,bt.to),bC=!0}function cS(a,b){var c=0,d=dn(bt.inverted?bt.from:bt.to,!0);cR!=null&&(d.x=cR),b=="page"?c=Math.min(P.clientHeight,window.innerHeight||document.documentElement.clientHeight):b=="line"&&(c=du());var e=dp(d.x,d.y+c*a+2);cL(e.line,e.ch,!0),cR=d.x}function cT(a){var b=bU(a.line).text,c=a.ch,d=a.ch;while(c>0&&$(b.charAt(c-1)))--c;while(d<b.length&&$(b.charAt(d)))++d;cI({line:a.line,ch:c},{line:a.line,ch:d})}function cU(a){cI({line:a,ch:0},{line:a,ch:bU(a).text.length})}function cV(a){if(T(bt.from,bt.to))return cW(bt.from.line,a);var b=bt.to.line-(bt.to.ch?0:1);for(var c=bt.from.line;c<=b;++c)cW(c,a)}function cW(a,b){b||(b="add");if(b=="smart")if(!bp.indent)b="prev";else var c=dG(a);var d=bU(a),e=d.indentation(f.tabSize),g=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=bU(a-1).indentation(f.tabSize):h=0:b=="smart"?h=bp.indent(c,d.text.slice(g.length),d.text):b=="add"?h=e+f.indentUnit:b=="subtract"&&(h=e-f.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(bt.from.line!=a&&bt.to.line!=a)return;var j=g}else{var j="",k=0;if(f.indentWithTabs)for(var l=Math.floor(h/f.tabSize);l;--l)k+=f.tabSize,j+="\t";while(k<h)++k,j+=" "}cm(j,{line:a,ch:0},{line:a,ch:g.length})}function cX(){bp=a.getMode(f,f.mode),bq.iter(0,bq.size,function(a){a.stateAfter=null}),br=[0],dJ()}function cY(){var a=f.gutter||f.lineNumbers;be.style.display=a?"":"none",a?bH=!0:bk.parentNode.style.marginLeft=0}function cZ(a,b){if(f.lineWrapping){C.className+=" CodeMirror-wrap";var c=P.clientWidth/dx()-3;bq.iter(0,bq.size,function(a){if(a.hidden)return;var b=Math.ceil(a.text.length/c)||1;b!=1&&bV(a,b)}),bg.style.width=bc.style.width=""}else C.className=C.className.replace(" CodeMirror-wrap",""),bP=null,bO="",bq.iter(0,bq.size,function(a){a.height!=1&&!a.hidden&&bV(a,1),a.text.length>bO.length&&(bO=a.text)});bD.push({from:0,to:bq.size})}function c$(a){var b=f.tabSize-a%f.tabSize;for(var c='<span class="cm-tab">',d=0;d<b;++d)c+=" ";return{html:c+"</span>",width:b}}function c_(){P.className=P.className.replace(/\s*cm-s-\w+/g,"")+f.theme.replace(/(^|\s)\s*/g," cm-s-")}function da(){this.set=[]}function db(a,b,c){function e(a,b,c,e){bU(a).addMark(new o(b,c,e,d.set))}a=cN(a),b=cN(b);var d=new da;if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,null,null,c);e(b.line,null,b.ch,c)}return bD.push({from:a.line,to:b.line+1}),d}function dc(a){a=cN(a);var b=new p(a.ch);return bU(a.line).addMark(b),b}function dd(a,b,c){return typeof a=="number"&&(a=bU(cM(a))),a.gutterMarker={text:b,style:c},bH=!0,a}function de(a){typeof a=="number"&&(a=bU(cM(a))),a.gutterMarker=null,bH=!0}function df(a,b){var c=a,d=a;typeof a=="number"?d=bU(cM(a)):c=v(a);if(c==null)return null;if(b(d,c))bD.push({from:c,to:c+1});else return null;return d}function dg(a,b){return df(a,function(a){if(a.className!=b)return a.className=b,!0})}function dh(a,b){return df(a,function(a,c){if(a.hidden!=b){a.hidden=b,bV(a,b?0:1);var d=bt.from.line,e=bt.to.line;if(b&&(d==c||e==c)){var f=d==c?cK({line:d,ch:0},d,0):bt.from,g=e==c?cK({line:e,ch:0},e,0):bt.to;cJ(f,g)}return bH=!0}})}function di(a){if(typeof a=="number"){if(!bS(a))return null;var b=a;a=bU(a);if(!a)return null}else{var b=v(a);if(b==null)return null}var c=a.gutterMarker;return{line:b,handle:a,text:a.text,markerText:c&&c.text,markerClass:c&&c.style,lineClass:a.className}}function dj(a){return bh.innerHTML="<pre><span>x</span></pre>",bh.firstChild.firstChild.firstChild.nodeValue=a,bh.firstChild.firstChild.offsetWidth||10}function dk(a,b){function e(a){return bh.innerHTML="<pre><span>"+c.getHTML(c$,a)+"</span></pre>",bh.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=bU(a),d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/dx()));for(;;){var k=e(j);if(k<=b&&j<h)j=Math.min(h,Math.ceil(j*1.2));else{i=k,h=j;break}}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function dm(a,b){if(b==0)return{top:0,left:0};var c="";if(f.lineWrapping){var d=a.text.indexOf(" ",b+2);c=X(a.text.slice(b+1,d<0?a.text.length:d+(L?5:0)))}bh.innerHTML="<pre>"+a.getHTML(c$,b)+'<span id="CodeMirror-temp-'+dl+'">'+X(a.text.charAt(b)||" ")+"</span>"+c+"</pre>";var e=document.getElementById("CodeMirror-temp-"+dl),g=e.offsetTop,h=e.offsetLeft;if(L&&g==0&&h==0){var i=document.createElement("span");i.innerHTML="x",e.parentNode.insertBefore(i,e.nextSibling),g=i.offsetTop}return{top:g,left:h}}function dn(a,b){var c,d=du(),e=d*(x(bq,a.line)-(b?bJ:0));if(a.ch==0)c=0;else{var g=dm(bU(a.line),a.ch);c=g.left,f.lineWrapping&&(e+=Math.max(0,g.top))}return{x:c,y:e,yBot:e+d}}function dp(a,b){function l(a){var b=dm(h,a);if(j){var d=Math.round(b.top/c);return Math.max(0,b.left+(d-k)*P.clientWidth)}return b.left}b<0&&(b=0);var c=du(),d=dx(),e=bJ+Math.floor(b/c),g=w(bq,e);if(g>=bq.size)return{line:bq.size-1,ch:bU(bq.size-1).text.length};var h=bU(g),i=h.text,j=f.lineWrapping,k=j?e-x(bq,g):0;if(a<=0&&k==0)return{line:g,ch:0};var m=0,n=0,o=i.length,p,q=Math.min(o,Math.ceil((a+k*P.clientWidth*.9)/d));for(;;){var r=l(q);if(r<=a&&q<o)q=Math.min(o,Math.ceil(q*1.2));else{p=r,o=q;break}}if(a>p)return{line:g,ch:o};q=Math.floor(o*.8),r=l(q),r<a&&(m=q,n=r);for(;;){if(o-m<=1)return{line:g,ch:p-a>a-n?m:o};var s=Math.ceil((m+o)/2),t=l(s);t>a?(o=s,p=t):(m=s,n=t)}}function dq(a){var b=dn(a,!0),c=Q(bg);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function du(){if(dt==null){dt="<pre>";for(var a=0;a<49;++a)dt+="x<br/>";dt+="x</pre>"}var b=bk.clientHeight;return b==ds?dr:(ds=b,bh.innerHTML=dt,dr=bh.firstChild.offsetHeight/50||1,bh.innerHTML="",dr)}function dx(){return P.clientWidth==dw?dv:(dw=P.clientWidth,dv=dj("x"))}function dy(){return bg.offsetTop}function dz(){return bg.offsetLeft}function dA(a,b){var c=Q(P,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>P.clientWidth||e-c.top>P.clientHeight))return null;var f=Q(bg,!0);return dp(d-f.left,e-f.top)}function dB(a){function e(){var a=_(O.value).join("\n");a!=d&&dN(cn)(a,"end"),N.style.position="relative",O.style.cssText=c,bG=!1,cw(!0),cs()}var b=dA(a);if(!b||window.opera)return;(T(bt.from,bt.to)||U(b,bt.from)||!U(b,bt.to))&&dN(cL)(b.line,b.ch);var c=O.style.cssText;N.style.position="absolute",O.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",bG=!0;var d=O.value=cq();cx(),S(O);if(K){D(a);var f=H(window,"mouseup",function(){f(),setTimeout(e,20)},!0)}else setTimeout(e,50)}function dC(){clearInterval(bo);var a=!0;bi.style.visibility="",bo=setInterval(function(){bi.style.visibility=(a=!a)?"":"hidden"},650)}function dE(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=dD[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=bt.inverted?bt.from:bt.to,c=bU(b.line),d=b.ch-1,e=d>=0&&dD[c.text.charAt(d)]||dD[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,bq.size):Math.max(-1,k-100);k!=l;k+=h){var c=bU(k),q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=db({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null&&db({line:k,ch:r.pos},{line:k,ch:r.pos+1},m),u=dN(function(){s.clear(),t&&t.clear()});a?setTimeout(u,800):bN=u}function dF(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var g=bU(d-1);if(g.stateAfter)return d;var h=g.indentation(f.tabSize);if(c==null||b>h)c=d-1,b=h}return c}function dG(a){var b=dF(a),c=b&&bU(b-1).stateAfter;return c?c=l(bp,c):c=m(bp),bq.iter(b,a,function(a){a.highlight(bp,c,f.tabSize),a.stateAfter=l(bp,c)}),b<a&&bD.push({from:b,to:a}),a<bq.size&&!bU(a).stateAfter&&br.push(a),c}function dH(a,b){var c=dG(a);bq.iter(a,b,function(a){a.highlight(bp,c,f.tabSize),a.stateAfter=l(bp,c)})}function dI(){var a=+(new Date)+f.workTime,b=br.length;while(br.length){if(!bU(bK).stateAfter)var c=bK;else var c=br.pop();if(c>=bq.size)continue;var d=dF(c),e=d&&bU(d-1).stateAfter;e?e=l(bp,e):e=m(bp);var g=0,h=bp.compareStates,i=!1,j=d,k=!1;bq.iter(j,bq.size,function(b){var d=b.stateAfter;if(+(new Date)>a)return br.push(j),dJ(f.workDelay),i&&bD.push({from:c,to:j+1}),k=!0;var m=b.highlight(bp,e,f.tabSize);m&&(i=!0),b.stateAfter=l(bp,e);if(h){if(d&&h(d,e))return!0}else if(m!==!1||!d)g=0;else if(++g>3&&(!bp.indent||bp.indent(d,"")==bp.indent(e,"")))return!0;++j});if(k)return;i&&bD.push({from:c,to:j+1})}b&&f.onHighlightComplete&&f.onHighlightComplete(bT)}function dJ(a){if(!br.length)return;bn.set(a,dN(dI))}function dK(){bB=bC=bE=null,bD=[],bF=!1,bI=[]}function dL(){var a=!1,b;bF&&(a=!cz()),bD.length?b=cC(bD,!0):(bF&&cG(),bH&&cF()),a&&cz(),bF&&(cy(),dC()),bs&&!bG&&(bB===!0||bB!==!1&&bF)&&cw(bC),bF&&f.matchBrackets&&setTimeout(dN(function(){bN&&(bN(),bN=null),T(bt.from,bt.to)&&dE(!1)}),20);var c=bE,d=bI;bF&&f.onCursorActivity&&f.onCursorActivity(bT),c&&f.onChange&&bT&&f.onChange(bT,c);for(var e=0;e<d.length;++e)d[e](bT);b&&f.onUpdate&&f.onUpdate(bT)}function dN(a){return function(){dM++||dK();try{var b=a.apply(this,arguments)}finally{--dM||dL()}return b}}var f={},n=a.defaults;for(var r in n)n.hasOwnProperty(r)&&(f[r]=(e&&e.hasOwnProperty(r)?e:n)[r]);var z=f.document,C=z.createElement("div");C.className="CodeMirror"+(f.lineWrapping?" CodeMirror-wrap":""),C.innerHTML='<div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll" tabindex="-1"><div style="position: relative"><div style="position: relative"><div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div style="position: relative; z-index: 0"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div><pre class="CodeMirror-cursor"> </pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div>',d.appendChild?d.appendChild(C):d(C);var N=C.firstChild,O=N.firstChild,P=C.lastChild,bc=P.firstChild,bd=bc.firstChild,be=bd.firstChild,bf=be.firstChild,bg=be.nextSibling.firstChild,bh=bg.firstChild,bi=bh.nextSibling,bj=bi.nextSibling,bk=bj.nextSibling;c_(),b&&(O.style.width="0px"),M||(bg.draggable=!0),bg.style.outline="none",f.tabindex!=null&&(O.tabIndex=f.tabindex),!f.gutter&&!f.lineNumbers&&(be.style.display="none");try{dj("x")}catch(bl){throw bl.message.match(/runtime/i)&&(bl=new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)")),bl}var bm=new I,bn=new I,bo,bp,bq=new t([new s([new q("")])]),br,bs;cX();var bt={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},bu,bv,bw,bx=0,by,bz=!1,bA=!1,bB,bC,bD,bE,bF,bG,bH,bI,bJ=0,bK=0,bL=0,bM=0,bN,bO="",bP;dN(function(){bW(f.value||""),bB=!1})();var bQ=new y;H(P,"mousedown",dN(bY)),H(P,"dblclick",dN(bZ)),H(bg,"dragstart",b_),H(bg,"selectstart",B),K||H(P,"contextmenu",dB),H(P,"scroll",function(){bx=P.scrollTop,cC([]),f.fixedGutter&&(be.style.left=P.scrollLeft+"px"),f.onScroll&&f.onScroll(bT)}),H(window,"resize",function(){cC(!0)}),H(O,"keyup",dN(ce)),H(O,"input",ct),H(O,"keydown",dN(cc)),H(O,"keypress",dN(cd)),H(O,"focus",cf),H(O,"blur",cg),H(P,"dragenter",D),H(P,"dragover",D),H(P,"drop",dN(b$)),H(P,"paste",function(){cx(),ct()}),H(O,"paste",ct),H(O,"cut",dN(function(){f.readOnly||cn("")}));var bR;try{bR=z.activeElement==O}catch(bl){}bR?setTimeout(cf,20):cg();var bT=C.CodeMirror={getValue:bX,setValue:dN(bW),getSelection:cq,replaceSelection:dN(cn),focus:function(){cx(),cf(),ct()},setOption:function(a,b){var c=f[a];f[a]=b,a=="mode"||a=="indentUnit"?cX():a=="readOnly"&&b=="nocursor"?(cg(),O.blur()):a=="readOnly"&&!b?cw(!0):a=="theme"?c_():a=="lineWrapping"&&c!=b?dN(cZ)():a=="tabSize"&&cC(!0);if(a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"||a=="theme")cY(),cC(!0)},getOption:function(a){return f[a]},undo:dN(cj),redo:dN(ck),indentLine:dN(function(a,b){typeof b!="string"&&(b==null?b=f.smartIndent?"smart":"prev":b=b?"add":"subtract"),bS(a)&&cW(a,b)}),indentSelection:dN(cV),historySize:function(){return{undo:bQ.done.length,redo:bQ.undone.length}},clearHistory:function(){bQ=new y},matchBrackets:dN(function(){dE(!0)}),getTokenAt:dN(function(a){return a=cN(a),bU(a.line).getTokenAt(bp,dG(a.line),a.ch)}),getStateAfter:function(a){return a=cM(a==null?bq.size-1:a),dG(a+1)},cursorCoords:function(a){return a==null&&(a=bt.inverted),dq(a?bt.from:bt.to)},charCoords:function(a){return dq(cN(a))},coordsChar:function(a){var b=Q(bg);return dp(a.x-b.left,a.y-b.top)},markText:dN(db),setBookmark:dc,setMarker:dN(dd),clearMarker:dN(de),setLineClass:dN(dg),hideLine:dN(function(a){return dh(a,!0)}),showLine:dN(function(a){return dh(a,!1)}),onDeleteLine:function(a,b){if(typeof a=="number"){if(!bS(a))return null;a=bU(a)}return(a.handlers||(a.handlers=[])).push(b),a},lineInfo:di,addWidget:function(a,b,c,d,e){a=dn(cN(a));var f=a.yBot,g=a.x;b.style.position="absolute",bc.appendChild(b);if(d=="over")f=a.y;else if(d=="near"){var h=Math.max(P.offsetHeight,bq.height*du()),i=Math.max(bc.clientWidth,bg.clientWidth)-dz();a.yBot+b.offsetHeight>h&&a.y>b.offsetHeight&&(f=a.y-b.offsetHeight),g+b.offsetWidth>i&&(g=i-b.offsetWidth)}b.style.top=f+dy()+"px",b.style.left=b.style.right="",e=="right"?(g=bc.clientWidth-b.offsetWidth,b.style.right="0px"):(e=="left"?g=0:e=="middle"&&(g=(bc.clientWidth-b.offsetWidth)/2),b.style.left=g+dz()+"px"),c&&cA(g,f,g+b.offsetWidth,f+b.offsetHeight)},lineCount:function(){return bq.size},clipPos:cN,getCursor:function(a){return a==null&&(a=bt.inverted),V(a?bt.from:bt.to)},somethingSelected:function(){return!T(bt.from,bt.to)},setCursor:dN(function(a,b,c){b==null&&typeof a.line=="number"?cL(a.line,a.ch,c):cL(a,b,c)}),setSelection:dN(function(a,b,c){(c?cI:cJ)(cN(a),cN(b||a))}),getLine:function(a){if(bS(a))return bU(a).text},getLineHandle:function(a){if(bS(a))return bU(a)},setLine:dN(function(a,b){bS(a)&&cm(b,{line:a,ch:0},{line:a,ch:bU(a).text.length})}),removeLine:dN(function(a){bS(a)&&cm("",{line:a,ch:0},cN({line:a+1,ch:0}))}),replaceRange:dN(cm),getRange:function(a,b){return cp(cN(a),cN(b))},execCommand:function(a){return h[a](bT)},moveH:dN(cP),deleteH:dN(cQ),moveV:dN(cS),toggleOverwrite:function(){bz?(bz=!1,bi.className=bi.className.replace(" CodeMirror-overwrite","")):(bz=!0,bi.className+=" CodeMirror-overwrite")},posFromIndex:function(a){var b=0,c;return bq.iter(0,bq.size,function(d){var e=d.text.length+1;if(e>a)return c=a,!0;a-=e,++b}),cN({line:b,ch:c})},indexFromPos:function(a){if(a.line<0||a.ch<0)return 0;var b=a.ch;return bq.iter(0,a.line,function(a){b+=a.text.length+1}),b},scrollTo:function(a,b){a!=null&&(P.scrollLeft=a),b!=null&&(P.scrollTop=b),cC([])},operation:function(a){return dN(a)()},refresh:function(){cC(!0),P.scrollHeight>bx&&(P.scrollTop=bx)},getInputField:function(){return O},getWrapperElement:function(){return C},getScrollerElement:function(){return P},getGutterElement:function(){return be}},cb=null,cr=!1,cu="",cR=null;da.prototype.clear=dN(function(){var a=Infinity,b=-Infinity;for(var c=0,d=this.set.length;c<d;++c){var e=this.set[c],f=e.marked;if(!f||!e.parent)continue;var g=v(e);a=Math.min(a,g),b=Math.max(b,g);for(var h=0;h<f.length;++h)f[h].set==this.set&&f.splice(h--,1)}a!=Infinity&&bD.push({from:a,to:b+1})}),da.prototype.find=function(){var a,b;for(var c=0,d=this.set.length;c<d;++c){var e=this.set[c],f=e.marked;for(var g=0;g<f.length;++g){var h=f[g];if(h.set==this.set)if(h.from!=null||h.to!=null){var i=v(e);i!=null&&(h.from!=null&&(a={line:i,ch:h.from}),h.to!=null&&(b={line:i,ch:h.to}))}}}return{from:a,to:b}};var dl=Math.floor(Math.random()*16777215).toString(16),dr,ds,dt,dv,dw=0,dD={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},dM=0;for(var dO in g)g.propertyIsEnumerable(dO)&&!bT.propertyIsEnumerable(dO)&&(bT[dO]=g[dO]);return bT}function j(a,b,c){function d(a,b,c){var e=b[a];if(e!=null)return e;c==null&&(c=b.fallthrough);if(c==null)return b.catchall;if(typeof c=="string")return d(a,i[c]);for(var f=0,g=c.length;f<g;++f){e=d(a,i[c[f]]);if(e!=null)return e}return null}return b?d(a,b,c):d(a,i[c])}function k(a){var b=bb[G(a,"keyCode")];return b=="Ctrl"||b=="Alt"||b=="Shift"||b=="Mod"}function l(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function m(a,b,c){return a.startState?a.startState(b,c):!0}function n(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8}function o(a,b,c,d){this.from=a,this.to=b,this.style=c,this.set=d}function p(a){this.from=a,this.to=a,this.line=null}function q(a,b){this.styles=b||[a,null],this.text=a,this.height=1,this.marked=this.gutterMarker=this.className=this.handlers=null,this.stateAfter=this.parent=this.hidden=null}function r(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function s(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function t(a){this.children=a;var b=0,c=0;for(var d=0,e=a.length;d<e;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function u(a,b){while(!a.lines)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function v(a){if(a.parent==null)return null;var b=a.parent,c=Z(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent)for(var e=0,f=d.children.length;;++e){if(d.children[e]==b)break;c+=d.children[e].chunkSize()}return c}function w(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.height;if(b<g){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;d<e;++d){var h=a.lines[d],i=h.height;if(b<i)break;b-=i}return c+d}function x(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.chunkSize();if(b<g){a=f;continue a}b-=g,c+=f.height}return c}while(!a.lines);for(var d=0;d<b;++d)c+=a.lines[d].height;return c}function y(){this.time=0,this.done=[],this.undone=[]}function z(){D(this)}function A(a){return a.stop||(a.stop=z),a}function B(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function C(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function D(a){B(a),C(a)}function E(a){return a.target||a.srcElement}function F(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function G(a,b){var c=a.override&&a.override.hasOwnProperty(b);return c?a.override[b]:a[b]}function H(a,b,c,d){if(typeof a.addEventListener=="function"){a.addEventListener(b,c,!1);if(d)return function(){a.removeEventListener(b,c,!1)}}else{var e=function(a){c(a||window.event)};a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function I(){this.id=null}function O(a,b,c){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var d=0,e=0;d<b;++d)a.charAt(d)=="\t"?e+=c-e%c:++e;return e}function P(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function Q(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent){var h=g.offsetLeft,i=g.offsetTop;g==c?(d+=Math.abs(h),e+=Math.abs(i)):(d+=h,e+=i),b&&P(g).position=="fixed"&&(f=!0)}var j=b&&!f?null:c;for(var g=a.parentNode;g!=j;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function R(a){return a.textContent||a.innerText||a.nodeValue||""}function S(a){b?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function T(a,b){return a.line==b.line&&a.ch==b.ch}function U(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function V(a){return{line:a.line,ch:a.ch}}function X(a){return W.textContent=a,W.innerHTML}function Y(a,b){if(!b)return 0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function Z(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function $(a){return/\w/.test(a)||a.toUpperCase()!=a.toLowerCase()}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,onKeyEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,document:window.document};var b=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),c=b||/Mac/.test(navigator.platform),d=/Win/.test(navigator.platform),e={},f={};a.defineMode=function(b,c){!a.defaults.mode&&b!="null"&&(a.defaults.mode=b),e[b]=c},a.defineMIME=function(a,b){f[a]=b},a.getMode=function(b,c){typeof c=="string"&&f.hasOwnProperty(c)&&(c=f[c]);if(typeof c=="string")var d=c,g={};else if(c!=null)var d=c.name,g=c;var h=e[d];return h?h(b,g||{}):(window.console&&console.warn("No mode "+d+" found, falling back to plain text."),a.getMode(b,"text/plain"))},a.listModes=function(){var a=[];for(var b in e)e.propertyIsEnumerable(b)&&a.push(b);return a},a.listMIMEs=function(){var a=[];for(var b in f)f.propertyIsEnumerable(b)&&a.push({mime:b,mode:f[b]});return a};var g=a.extensions={};a.defineExtension=function(a,b){g[a]=b};var h=a.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!T(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,{line:b.line+1,ch:0}):a.replaceRange("",b,d?c:{line:b.line})},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b})},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.setCursor(0,0,!0)},goDocEnd:function(a){a.setSelection({line:a.lineCount()-1},null,!0)},goLineStart:function(a){a.setCursor(a.getCursor().line,0,!0)},goLineStartSmart:function(a){var b=a.getCursor(),c=a.getLine(b.line),d=Math.max(0,c.search(/\S/));a.setCursor(b.line,b.ch<=d&&b.ch?0:d,!0)},goLineEnd:function(a){a.setSelection({line:a.getCursor().line},null,!0)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1,"word")},delCharLeft:function(a){a.deleteH(-1,"char")},delCharRight:function(a){a.deleteH(1,"char")},delWordLeft:function(a){a.deleteH(-1,"word")},delWordRight:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t","end")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),{line:b.line,ch:b.ch-1},{line:b.line,ch:b.ch+1})},newlineAndIndent:function(a){a.replaceSelection("\n","end"),a.indentLine(a.getCursor().line)},toggleOverwrite:function(a){a.toggleOverwrite()}},i=a.keyMap={};i.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"indentMore","Shift-Tab":"indentLess",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},i.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll",fallthrough:"basic"},i.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll",fallthrough:["basic","emacsy"]},i["default"]=c?i.macDefault:i.pcDefault,i.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex);if(b.form){var e=H(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.getTextArea=function(){return b},h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.copyState=l,a.startState=m,n.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return O(this.string,this.start,this.tabSize)},indentation:function(){return O(this.string,null,this.tabSize)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=n,o.prototype={attach:function(a){this.set.push(a)},detach:function(a){var b=Z(this.set,a);b>-1&&this.set.splice(b,1)},split:function(a,b){if(this.to<=a&&this.to!=null)return null;var c=this.from<a||this.from==null?null:this.from-a+b,d=this.to==null?null:this.to-a+b;return new o(c,d,this.style,this.set)},dup:function(){return new o(null,null,this.style,this.set)},clipTo:function(a,b,c,d,e){this.from!=null&&this.from>=b&&(this.from=Math.max(d,this.from)+e),this.to!=null&&this.to>b&&(this.to=d<this.to?this.to+e:b),a&&d>this.from&&(d<this.to||this.to==null)&&(this.from=null),c&&(b<this.to||this.to==null)&&(b>this.from||this.from==null)&&(this.to=null)},isDead:function(){return this.from!=null&&this.to!=null&&this.from>=this.to},sameSet:function(a){return this.set==a.set}},p.prototype={attach:function(a){this.line=a},detach:function(a){this.line==a&&(this.line=null)},split:function(a,b){if(a<this.from)return this.from=this.to=this.from-a+b,this},isDead:function(){return this.from>this.to},clipTo:function(a,b,c,d,e){(a||b<this.from)&&(c||d>this.to)?(this.from=0,this.to=-1):this.from>b&&(this.from=this.to=Math.max(d,this.from)+e)},sameSet:function(a){return!1},find:function(){return!this.line||!this.line.parent?null:{line:v(this.line),ch:this.from}},clear:function(){if(this.line){var a=Z(this.line.marked,this);a!=-1&&this.line.marked.splice(a,1),this.line=null}}},q.inheritMarks=function(a,b){var c=new q(a),d=b&&b.marked;if(d)for(var e=0;e<d.length;++e)if(d[e].to==null&&d[e].style){var f=c.marked||(c.marked=[]),g=d[e],h=g.dup();f.push(h),h.attach(c)}return c},q.prototype={replace:function(a,b,c){var d=[],e=this.marked,f=b==null?this.text.length:b;r(0,a,this.styles,d),c&&d.push(c,null),r(f,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(f),this.stateAfter=null;if(e){var g=c.length-(f-a);for(var h=0;h<e.length;++h){var i=e[h];i.clipTo(a==null,a||0,b==null,f,g),i.isDead()&&(i.detach(this),e.splice(h--,1))}}},split:function(a,b){var c=[b,null],d=this.marked;r(a,this.text.length,this.styles,c);var e=new q(b+this.text.slice(a),c);if(d)for(var f=0;f<d.length;++f){var g=d[f],h=g.split(a,b.length);h&&(e.marked||(e.marked=[]),e.marked.push(h),h.attach(e))}return e},append:function(a){var b=this.text.length,c=a.marked,d=this.marked;this.text+=a.text,r(0,a.text.length,a.styles,this.styles);if(d)for(var e=0;e<d.length;++e)d[e].to==null&&(d[e].to=b);if(c&&c.length){d||(this.marked=d=[]);a:for(var e=0;e<c.length;++e){var f=c[e];if(!f.from)for(var g=0;g<d.length;++g){var h=d[g];if(h.to==b&&h.sameSet(f)){h.to=f.to==null?null:f.to+b,h.isDead()&&(h.detach(this),c.splice(e--,1));continue a}}d.push(f),f.attach(this),f.from+=b,f.to!=null&&(f.to+=b)}}},fixMarkEnds:function(a){var b=this.marked,c=a.marked;if(!b)return;for(var d=0;d<b.length;++d){var e=b[d],f=e.to==null;if(f&&c)for(var g=0;g<c.length;++g)if(c[g].sameSet(e)){f=!1;break}f&&(e.to=this.text.length)}},fixMarkStarts:function(){var a=this.marked;if(!a)return;for(var b=0;b<a.length;++b)a[b].from==null&&(a[b].from=0)},addMark:function(a){a.attach(this),this.marked==null&&(this.marked=[]),this.marked.push(a),this.marked.sort(function(a,b){return(a.from||0)-(b.from||0)})},highlight:function(a,b,c){var d=new n(this.text,c),e=this.styles,f=0,g=!1,h=e[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!d.eol()){var j=a.token(d,b),k=this.text.slice(d.start,d.pos);d.start=d.pos,f&&e[f-1]==j?e[f-2]+=k:k&&(!g&&(e[f+1]!=j||f&&e[f-2]!=i)&&(g=!0),e[f++]=k,e[f++]=j,i=h,h=e[f]);if(d.pos>5e3){e[f++]=this.text.slice(d.pos),e[f++]=null;break}}return e.length!=f&&(e.length=f,g=!0),f&&e[f-2]!=i&&(g=!0),g||(e.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new n(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(a){return O(this.text,null,a)},getHTML:function(a,b){function f(b,f){if(!b)return;d&&L&&b.charAt(0)==" "&&(b="\u00a0"+b.slice(1)),d=!1;if(b.indexOf("\t")==-1){e+=b.length;var g=X(b)}else{var g="";for(var h=0;;){var i=b.indexOf("\t",h);if(i==-1){g+=X(b.slice(h)),e+=b.length-h;break}e+=i-h;var j=a(e);g+=X(b.slice(h,i))+j.html,e+=j.width,h=i+1}}f?c.push('<span class="',f,'">',g,"</span>"):c.push(g)}function k(a){return a?"cm-"+a.replace(/ +/g," cm-"):null}var c=[],d=!0,e=0,g=this.styles,h=this.text,i=this.marked,j=h.length;b!=null&&(j=Math.min(b,j));if(!h&&b==null)f(" ");else if(!i||!i.length)for(var l=0,m=0;m<j;l+=2){var n=g[l],o=g[l+1],p=n.length;m+p>j&&(n=n.slice(0,j-m)),m+=p,f(n,k(o))}else{var q=0,l=0,r="",o,s=0,t=i[0].from||0,u=[],v=0;function w(){var a;while(v<i.length&&((a=i[v]).from==q||a.from==null))a.style!=null&&u.push(a),++v;t=v<i.length?i[v].from:Infinity;for(var b=0;b<u.length;++b){var c=u[b].to||Infinity;c==q?u.splice(b--,1):t=Math.min(c,t)}}var x=0;while(q<j){t==q&&w();var y=Math.min(j,t);for(;;){if(r){var z=q+r.length,A=o;for(var B=0;B<u.length;++B)A=(A?A+" ":"")+u[B].style;f(z>y?r.slice(0,y-q):r,A);if(z>=y){r=r.slice(y-q),q=y;break}q=z}r=g[l++],o=k(g[l++])}}}return c.join("")},cleanUp:function(){this.parent=null;if(this.marked)for(var a=0,b=this.marked.length;a<b;++a)this.marked[a].detach(this)}},s.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var d=a,e=a+b;d<e;++d){var f=this.lines[d];this.height-=f.height,f.cleanUp();if(f.handlers)for(var g=0;g<f.handlers.length;++g)c.push(f.handlers[g])}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c,this.lines.splice.apply(this.lines,[a,0].concat(b));for(var d=0,e=b.length;d<e;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;a<d;++a)if(c(this.lines[a]))return!0}},t.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a),h=e.height;e.remove(a,g,c),this.height-=h-e.height,f==g&&(this.children.splice(d--,1),e.parent=null);if((b-=g)==0)break;a=0}else a-=f}if(this.size-b<25){var i=[];this.collapse(i),this.children=[new s(i)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insert:function(a,b){var c=0;for(var d=0,e=b.length;d<e;++d)c+=b[d].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<=g){f.insertHeight(a,b,c);if(f.lines&&f.lines.length>50){while(f.lines.length>50){var h=f.lines.splice(f.lines.length-25,25),i=new s(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(this.children.length<=10)return;var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new t(b);if(!a.parent){var d=new t(a.children);d.parent=a,a.children=[d,c],a=d}else{a.size-=c.size,a.height-=c.height;var e=Z(a.parent.children,a);a.parent.children.splice(e+1,0,c)}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<g){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if((b-=h)==0)break;a=0}else a-=g}}},y.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1],f=e&&e[e.length-1],g=d-this.time;if(g>400||!f)this.done.push([{start:a,added:b,old:c}]);else if(f.start>a+c.length||f.start+f.added<a-f.added+f.old.length)e.push({start:a,added:b,old:c});else{var h=0;if(a<f.start){for(var i=f.start-a-1;i>=0;--i)f.old.unshift(c[i]);f.added+=f.start-a,f.start=a}else f.start<a&&(h=a-f.start,b+=h);for(var i=f.added-h,j=c.length;i<j;++i)f.old.push(c[i]);f.added<b&&(f.added=b)}this.time=d}},a.e_stop=D,a.e_preventDefault=B,a.e_stopPropagation=C,a.connect=H,I.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var J=function(){if(/MSIE [1-8]\b/.test(navigator.userAgent))return!1;var a=document.createElement("div");return"draggable"in a}(),K=/gecko\/\d{7}/i.test(navigator.userAgent),L=/MSIE \d/.test(navigator.userAgent),M=/WebKit\//.test(navigator.userAgent),N="\n";(function(){var a=document.createElement("textarea");a.value="foo\nbar",a.value.indexOf("\r")>-1&&(N="\r\n")})(),document.documentElement.getBoundingClientRect!=null&&(Q=function(a,b){try{var c=a.getBoundingClientRect();c={top:c.top,left:c.left}}catch(d){c={top:0,left:0}}if(!b)if(window.pageYOffset==null){var e=document.documentElement||document.body.parentNode;e.scrollTop==null&&(e=document.body),c.top+=e.scrollTop,c.left+=e.scrollLeft}else c.top+=window.pageYOffset,c.left+=window.pageXOffset;return c});var W=document.createElement("pre");X("a")=="\na"?X=function(a){return W.textContent=a,W.innerHTML.slice(1)}:X("\t")!="\t"&&(X=function(a){return W.innerHTML="",W.appendChild(document.createTextNode(a)),W.innerHTML}),a.htmlEscape=X;var _="\n\nb".split(/\n/).length!=3?function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:function(a){return a.split(/\r?\n/)};a.splitLines=_;var ba=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:b.compareEndPoints("StartToEnd",b)!=0};a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var bb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return a.keyNames=bb,function(){for(var a=0;a<10;a++)bb[a+48]=String(a);for(var a=65;a<=90;a++)bb[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)bb[a+111]=bb[a+63235]="F"+a}(),a}();CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function e(a,b){var c=a.next();if(c=="@")return a.eatWhile(/[\w\\\-]/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=f,f(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=g,g(a,b);if(c=="=")d(null,"compare");else return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=h(c),b.tokenize(a,b)):c=="#"?(a.eatWhile(/[\w\\\-]/),d("atom","hash")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,.+>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]]/.test(c)?d(null,c):(a.eatWhile(/[\w\\\-]/),d("variable","variable")):d(null,"compare")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("comment","comment")}function g(a,b){var c=0,f;while((f=a.next())!=null){if(c>=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("comment","comment")}function h(a){return function(b,c){var f=!1,g;while((g=b.next())!=null){if(g==a&&!f)break;f=!f&&g=="\\"}return f||(c.tokenize=e),d("string","string")}}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="atom";else if(d=="variable")if(e=="rule")d="number";else if(!e||e=="@media{")d="tag";return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("htmlmixed",function(a,b){function f(a,b){var f=c.token(a,b.htmlState);return f=="tag"&&a.current()==">"&&b.htmlState.context&&(/^script$/i.test(b.htmlState.context.tagName)?(b.token=h,b.localState=d.startState(c.indent(b.htmlState,"")),b.mode="javascript"):/^style$/i.test(b.htmlState.context.tagName)&&(b.token=i,b.localState=e.startState(c.indent(b.htmlState,"")),b.mode="css")),f}function g(a,b,c){var d=a.current(),e=d.search(b);return e>-1&&a.backUp(d.length-e),c}function h(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=f,b.curState=null,b.mode="html",f(a,b)):g(a,/<\/\s*script\s*>/,d.token(a,b.localState))}function i(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*style\s*>/,e.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"javascript"),e=CodeMirror.getMode(a,"css");return{startState:function(){var a=c.startState();return{token:f,localState:null,mode:"html",htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.token==i?e:d,a.localState);return{token:a.token,localState:b,mode:a.mode,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return a.token==f||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.token==h?d.indent(a.localState,b):e.indent(a.localState,b)},compareStates:function(a,b){return c.compareStates(a.htmlState,b.htmlState)},electricChars:"/{}:"}}),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(a,b){function g(a,b,c){return b.tokenize=c,c(a,b)}function h(a,b){var c=!1,d;while((d=a.next())!=null){if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}function k(a,b,c){return i=a,j=c,b}function l(a,b){var c=a.next();if(c=='"'||c=="'")return g(a,b,m(c));if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if(c=="0"&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),k("number","number");if(c=="/")return a.eat("*")?g(a,b,n):a.eat("/")?(a.skipToEnd(),k("comment","comment")):b.reAllowed?(h(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string-2")):(a.eatWhile(f),k("operator",null,a.current()));if(c=="#")return a.skipToEnd(),k("error","error");if(f.test(c))return a.eatWhile(f),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),i=e.propertyIsEnumerable(d)&&e[d];return i&&b.kwAllowed?k(i.type,i.style,d):k("variable","variable",d)}function m(a){return function(b,c){return h(b,a)||(c.tokenize=l),k("string","string")}}function n(a,b){var c=!1,d;while(d=a.next()){if(d=="/"&&c){b.tokenize=l;break}c=d=="*"}return k("comment","comment")}function p(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,d!=null&&(this.align=d)}function q(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function r(a,b,c,e,f){var g=a.cc;s.state=a,s.stream=f,s.marked=null,s.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;){var h=g.length?g.pop():d?D:C;if(h(c,e)){while(g.length&&g[g.length-1].lex)g.pop()();return s.marked?s.marked:c=="variable"&&q(a,e)?"variable-2":b}}}function t(){for(var a=arguments.length-1;a>=0;a--)s.cc.push(arguments[a])}function u(){return t.apply(null,arguments),!0}function v(a){var b=s.state;if(b.context){s.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function x(){s.state.context||(s.state.localVars=w),s.state.context={prev:s.state.context,vars:s.state.localVars}}function y(){s.state.localVars=s.state.context.vars,s.state.context=s.state.context.prev}function z(a,b){var c=function(){var c=s.state;c.lexical=new p(c.indented,s.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function A(){var a=s.state;a.lexical.prev&&(a.lexical.type==")"&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function B(a){return function(c){return c==a?u():a==";"?t():u(arguments.callee)}}function C(a){return a=="var"?u(z("vardef"),L,B(";"),A):a=="keyword a"?u(z("form"),D,C,A):a=="keyword b"?u(z("form"),C,A):a=="{"?u(z("}"),K,A):a==";"?u():a=="function"?u(R):a=="for"?u(z("form"),B("("),z(")"),N,B(")"),A,C,A):a=="variable"?u(z("stat"),G):a=="switch"?u(z("form"),D,z("}","switch"),B("{"),K,A,A):a=="case"?u(D,B(":")):a=="default"?u(B(":")):a=="catch"?u(z("form"),x,B("("),S,B(")"),C,A,y):t(z("stat"),D,B(";"),A)}function D(a){return o.hasOwnProperty(a)?u(F):a=="function"?u(R):a=="keyword c"?u(E):a=="("?u(z(")"),E,B(")"),A,F):a=="operator"?u(D):a=="["?u(z("]"),J(D,"]"),A,F):a=="{"?u(z("}"),J(I,"}"),A,F):u()}function E(a){return a.match(/[;\}\)\],]/)?t():t(D)}function F(a,b){if(a=="operator"&&/\+\+|--/.test(b))return u(F);if(a=="operator")return u(D);if(a==";")return;if(a=="(")return u(z(")"),J(D,")"),A,F);if(a==".")return u(H,F);if(a=="[")return u(z("]"),D,B("]"),A,F)}function G(a){return a==":"?u(A,C):t(F,B(";"),A)}function H(a){if(a=="variable")return s.marked="property",u()}function I(a){a=="variable"&&(s.marked="property");if(o.hasOwnProperty(a))return u(B(":"),D)}function J(a,b){function c(d){return d==","?u(a,c):d==b?u():u(B(b))}return function(e){return e==b?u():t(a,c)}}function K(a){return a=="}"?u():t(C,K)}function L(a,b){return a=="variable"?(v(b),u(M)):u()}function M(a,b){if(b=="=")return u(D,M);if(a==",")return u(L)}function N(a){return a=="var"?u(L,P):a==";"?t(P):a=="variable"?u(O):t(P)}function O(a,b){return b=="in"?u(D):u(F,P)}function P(a,b){return a==";"?u(Q):b=="in"?u(D):u(D,B(";"),Q)}function Q(a){a!=")"&&u(D)}function R(a,b){if(a=="variable")return v(b),u(R);if(a=="(")return u(z(")"),x,J(S,")"),A,C,y)}function S(a,b){if(a=="variable")return v(b),u()}var c=a.indentUnit,d=b.json,e=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"};return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),f=/[+\-*&%=<>!?|]/,i,j,o={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},s={state:null,column:null,marked:null,cc:null},w={name:"this",next:{name:"arguments"}};return A.lex=!0,{startState:function(a){return{tokenize:l,reAllowed:!0,kwAllowed:!0,cc:[],lexical:new p((a||0)-c,0,"block",!1),localVars:null,context:null,indented:0}},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation());if(a.eatSpace())return null;var c=b.tokenize(a,b);return i=="comment"?c:(b.reAllowed=i=="operator"||i=="keyword c"||i.match(/^[\[{}\(,;:]$/),b.kwAllowed=i!=".",r(b,c,i,j,a))},indent:function(a,b){if(a.tokenize!=l)return 0;var d=b&&b.charAt(0),e=a.lexical,f=e.type,g=d==f;return f=="vardef"?e.indented+4:f=="form"&&d=="{"?e.indented:f=="stat"||f=="form"?e.indented+c:e.info=="switch"&&!g?e.indented+(/^(?:case|default)\b/.test(b)?c:2*c):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(a,b){function h(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if(d=="<"){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(k("atom","]]>")):null:a.match("--")?c(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(l(1))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=k("meta","?>"),"meta";g=a.eat("/")?"closeTag":"openTag",a.eatSpace(),f="";var e;while(e=a.eat(/[^\s\u00a0=<>\"\'\/?]/))f+=e;return b.tokenize=i,"tag"}if(d=="&"){var h;return a.eat("#")?a.eat("x")?h=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):h=a.eatWhile(/[\d]/)&&a.eat(";"):h=a.eatWhile(/[\w]/)&&a.eat(";"),h?"atom":"error"}return a.eatWhile(/[^&<]/),null}function i(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=h,g=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(g="equals",null):/[\'\"]/.test(c)?(b.tokenize=j(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function j(a){return function(b,c){while(!b.eol())if(b.next()==a){c.tokenize=i;break}return"string"}}function k(a,b){return function(c,d){while(!c.eol()){if(c.match(b)){d.tokenize=h;break}c.next()}return a}}function l(a){return function(b,c){var d;while((d=b.next())!=null){if(d=="<")return c.tokenize=l(a+1),c.tokenize(b,c);if(d==">"){if(a==1){c.tokenize=h;break}return c.tokenize=l(a-1),c.tokenize(b,c)}}return"meta"}}function o(){for(var a=arguments.length-1;a>=0;a--)m.cc.push(arguments[a])}function p(){return o.apply(null,arguments),!0}function q(a,b){var c=d.doNotIndent.hasOwnProperty(a)||m.context&&m.context.noIndent;m.context={prev:m.context,tagName:a,indent:m.indented,startOfLine:b,noIndent:c}}function r(){m.context&&(m.context=m.context.prev)}function s(a){if(a=="openTag")return m.tagName=f,p(v,t(m.startOfLine));if(a=="closeTag"){var b=!1;return m.context?b=m.context.tagName!=f:b=!0,b&&(n="error"),p(u(b))}return p()}function t(a){return function(b){return b=="selfcloseTag"||b=="endTag"&&d.autoSelfClosers.hasOwnProperty(m.tagName.toLowerCase())?p():b=="endTag"?(q(m.tagName,a),p()):p()}}function u(a){return function(b){return a&&(n="error"),b=="endTag"?(r(),p()):(n="error",p(arguments.callee))}}function v(a){return a=="word"?(n="attribute",p(v)):a=="equals"?p(w,v):a=="string"?(n="error",p(v)):o()}function w(a){return a=="word"&&d.allowUnquoted?(n="string",p()):a=="string"?p(x):o()}function x(a){return a=="string"?p(x):o()}var c=a.indentUnit,d=b.htmlMode?{autoSelfClosers:{br:!0,img:!0,hr:!0,link:!0,input:!0,meta:!0,col:!0,frame:!0,base:!0,area:!0},doNotIndent:{pre:!0},allowUnquoted:!0}:{autoSelfClosers:{},doNotIndent:{},allowUnquoted:!1},e=b.alignCDATA,f,g,m,n;return{startState:function(){return{tokenize:h,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(a,b){a.sol()&&(b.startOfLine=!0,b.indented=a.indentation());if(a.eatSpace())return null;n=g=f=null;var c=b.tokenize(a,b);b.type=g;if((c||g)&&c!="comment"){m=b;for(;;){var d=b.cc.pop()||s;if(d(g||c))break}}return b.startOfLine=!1,n||c},indent:function(a,b,d){var f=a.context;if(a.tokenize!=i&&a.tokenize!=h||f&&f.noIndent)return d?d.match(/^(\s*)/)[0].length:0;if(e&&/<!\[CDATA\[/.test(b))return 0;f&&/^<\//.test(b)&&(f=f.prev);while(f&&!f.startOfLine)f=f.prev;return f?f.indent+c:0},compareStates:function(a,b){if(a.indented!=b.indented||a.tokenize!=b.tokenize)return!1;for(var c=a.context,d=b.context;;c=c.prev,d=d.prev){if(!c||!d)return c==d;if(c.tagName!=d.tagName)return!1}},electricChars:"/"}}),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0})
|
@@ -11,8 +11,9 @@
|
|
11
11
|
this.source.val(html);
|
12
12
|
|
13
13
|
this.codeMirror = CodeMirror.fromTextArea(this.source[0], {
|
14
|
-
mode:
|
15
|
-
tabMode:
|
14
|
+
mode: 'htmlmixed',
|
15
|
+
tabMode: 'indent',
|
16
|
+
lineWrapping: true
|
16
17
|
});
|
17
18
|
for (var i = 0, e = this.codeMirror.lineCount(); i < e; ++i) this.codeMirror.indentLine(i);
|
18
19
|
|
@@ -1,8 +1,17 @@
|
|
1
|
+
.CodeMirror {
|
2
|
+
background-color: #fff;
|
3
|
+
}
|
4
|
+
|
5
|
+
/* -- elRTE adjustments -------------------------------------------------- */
|
6
|
+
.el-rte .workzone .CodeMirror,
|
7
|
+
.el-rte .workzone .CodeMirror .CodeMirror-scroll {
|
8
|
+
height: 100%;
|
9
|
+
}
|
10
|
+
|
11
|
+
/* -- Defaults ----------------------------------------------------------- */
|
1
12
|
.CodeMirror {
|
2
13
|
line-height: 1em;
|
3
14
|
font-family: monospace;
|
4
|
-
height: 300px;
|
5
|
-
background-color: #fff;
|
6
15
|
}
|
7
16
|
|
8
17
|
.CodeMirror-scroll {
|
@@ -13,12 +22,6 @@
|
|
13
22
|
position: relative;
|
14
23
|
}
|
15
24
|
|
16
|
-
/* elRTE adjustments */
|
17
|
-
.el-rte .workzone .CodeMirror,
|
18
|
-
.el-rte .workzone .CodeMirror .CodeMirror-scroll {
|
19
|
-
height: 100%;
|
20
|
-
}
|
21
|
-
|
22
25
|
.CodeMirror-gutter {
|
23
26
|
position: absolute; left: 0; top: 0;
|
24
27
|
z-index: 10;
|
@@ -31,6 +34,7 @@
|
|
31
34
|
color: #aaa;
|
32
35
|
text-align: right;
|
33
36
|
padding: .4em .2em .4em .4em;
|
37
|
+
white-space: pre !important;
|
34
38
|
}
|
35
39
|
.CodeMirror-lines {
|
36
40
|
padding: .4em;
|
@@ -49,31 +53,40 @@
|
|
49
53
|
word-wrap: normal;
|
50
54
|
}
|
51
55
|
|
56
|
+
.CodeMirror-wrap pre {
|
57
|
+
word-wrap: break-word;
|
58
|
+
white-space: pre-wrap;
|
59
|
+
}
|
60
|
+
.CodeMirror-wrap .CodeMirror-scroll {
|
61
|
+
overflow-x: hidden;
|
62
|
+
}
|
63
|
+
|
52
64
|
.CodeMirror textarea {
|
53
|
-
|
54
|
-
font-size: inherit !important;
|
65
|
+
outline: none !important;
|
55
66
|
}
|
56
67
|
|
57
|
-
.CodeMirror-cursor {
|
68
|
+
.CodeMirror pre.CodeMirror-cursor {
|
58
69
|
z-index: 10;
|
59
70
|
position: absolute;
|
60
71
|
visibility: hidden;
|
61
|
-
border-left: 1px solid black
|
72
|
+
border-left: 1px solid black;
|
73
|
+
border-right:none;
|
74
|
+
width:0;
|
62
75
|
}
|
63
|
-
.CodeMirror
|
76
|
+
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
|
77
|
+
.CodeMirror-focused pre.CodeMirror-cursor {
|
64
78
|
visibility: visible;
|
65
79
|
}
|
66
80
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
background:
|
81
|
+
div.CodeMirror-selected { background: #d9d9d9; }
|
82
|
+
.CodeMirror-focused div.CodeMirror-selected { background: #eee; }
|
83
|
+
|
84
|
+
.CodeMirror-searching {
|
85
|
+
background: #ffa;
|
86
|
+
background: rgba(255, 255, 0, .4);
|
73
87
|
}
|
74
88
|
|
75
|
-
|
76
|
-
.CodeMirror-nonmatchingbracket {color: #f22 !important;}
|
89
|
+
/* Default theme */
|
77
90
|
|
78
91
|
.cm-s-default span.cm-keyword {color: #708;}
|
79
92
|
.cm-s-default span.cm-atom {color: #219;}
|
@@ -81,7 +94,7 @@ span.CodeMirror-selected {
|
|
81
94
|
.cm-s-default span.cm-def {color: #00f;}
|
82
95
|
.cm-s-default span.cm-variable {color: black;}
|
83
96
|
.cm-s-default span.cm-variable-2 {color: #05a;}
|
84
|
-
.cm-s-default span.cm-variable-3 {color: #
|
97
|
+
.cm-s-default span.cm-variable-3 {color: #085;}
|
85
98
|
.cm-s-default span.cm-property {color: black;}
|
86
99
|
.cm-s-default span.cm-operator {color: black;}
|
87
100
|
.cm-s-default span.cm-comment {color: #a50;}
|
@@ -94,3 +107,15 @@ span.CodeMirror-selected {
|
|
94
107
|
.cm-s-default span.cm-bracket {color: #cc7;}
|
95
108
|
.cm-s-default span.cm-tag {color: #170;}
|
96
109
|
.cm-s-default span.cm-attribute {color: #00c;}
|
110
|
+
.cm-s-default span.cm-header {color: #a0a;}
|
111
|
+
.cm-s-default span.cm-quote {color: #090;}
|
112
|
+
.cm-s-default span.cm-hr {color: #999;}
|
113
|
+
.cm-s-default span.cm-link {color: #00c;}
|
114
|
+
|
115
|
+
span.cm-header, span.cm-strong {font-weight: bold;}
|
116
|
+
span.cm-em {font-style: italic;}
|
117
|
+
span.cm-emstrong {font-style: italic; font-weight: bold;}
|
118
|
+
span.cm-link {text-decoration: underline;}
|
119
|
+
|
120
|
+
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
121
|
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comfortable_mexican_sofa"
|
8
|
-
s.version = "1.6.
|
8
|
+
s.version = "1.6.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = "2012-02-
|
12
|
+
s.date = "2012-02-08"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,7 +31,7 @@ ComfortableMexicanSofa.configure do |config|
|
|
31
31
|
# the upload method and appropriate settings based on Paperclip. For S3 see:
|
32
32
|
# http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/S3, and for
|
33
33
|
# filesystem see: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/S3
|
34
|
-
# config.upload_file_options = {:
|
34
|
+
# config.upload_file_options = {:url => '/system/:class/:id/:attachment/:style/:filename'}
|
35
35
|
|
36
36
|
# Sofa allows you to setup entire site from files. Database is updated with each
|
37
37
|
# request (if necessary). Please note that database entries are destroyed if there's
|
@@ -58,7 +58,7 @@ class ComfortableMexicanSofa::Configuration
|
|
58
58
|
@admin_route_prefix = 'cms-admin'
|
59
59
|
@admin_route_redirect = ''
|
60
60
|
@allow_irb = false
|
61
|
-
@upload_file_options = {}
|
61
|
+
@upload_file_options = { :url => '/system/:class/:id/:attachment/:style/:filename' }
|
62
62
|
@enable_fixtures = false
|
63
63
|
@fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
|
64
64
|
@revisions_limit = 25
|
data/test/test_helper.rb
CHANGED
@@ -34,7 +34,7 @@ class ActiveSupport::TestCase
|
|
34
34
|
'zh-CN' => '简体中文'
|
35
35
|
}
|
36
36
|
config.admin_locale = nil
|
37
|
-
config.upload_file_options = { }
|
37
|
+
config.upload_file_options = { :url => '/system/:class/:id/:attachment/:style/:filename' }
|
38
38
|
end
|
39
39
|
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
40
40
|
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
@@ -23,7 +23,9 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
23
23
|
}), config.locales
|
24
24
|
assert_equal nil, config.admin_locale
|
25
25
|
assert_equal nil, config.database_config
|
26
|
-
assert_equal ({
|
26
|
+
assert_equal ({
|
27
|
+
:url => '/system/:class/:id/:attachment/:style/:filename'
|
28
|
+
}), config.upload_file_options
|
27
29
|
end
|
28
30
|
|
29
31
|
def test_initialization_overrides
|
@@ -54,22 +54,22 @@ class PageFileTagTest < ActiveSupport::TestCase
|
|
54
54
|
file = tag.block.files.first
|
55
55
|
|
56
56
|
assert_equal file, tag.content
|
57
|
-
assert_equal "/system/files/#{file.id}/original/image.jpg", tag.render
|
57
|
+
assert_equal "/system/cms/files/#{file.id}/files/original/image.jpg", tag.render
|
58
58
|
|
59
59
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:link }}')
|
60
|
-
assert_equal "<a href='/system/files/#{file.id}/original/image.jpg' target='_blank'>file</a>",
|
60
|
+
assert_equal "<a href='/system/cms/files/#{file.id}/files/original/image.jpg' target='_blank'>file</a>",
|
61
61
|
tag.render
|
62
62
|
|
63
63
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:link:link label }}')
|
64
|
-
assert_equal "<a href='/system/files/#{file.id}/original/image.jpg' target='_blank'>link label</a>",
|
64
|
+
assert_equal "<a href='/system/cms/files/#{file.id}/files/original/image.jpg' target='_blank'>link label</a>",
|
65
65
|
tag.render
|
66
66
|
|
67
67
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:image }}')
|
68
|
-
assert_equal "<img src='/system/files/#{file.id}/original/image.jpg' alt='file' />",
|
68
|
+
assert_equal "<img src='/system/cms/files/#{file.id}/files/original/image.jpg' alt='file' />",
|
69
69
|
tag.render
|
70
70
|
|
71
71
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:image:image alt }}')
|
72
|
-
assert_equal "<img src='/system/files/#{file.id}/original/image.jpg' alt='image alt' />",
|
72
|
+
assert_equal "<img src='/system/cms/files/#{file.id}/files/original/image.jpg' alt='image alt' />",
|
73
73
|
tag.render
|
74
74
|
|
75
75
|
assert tag = ComfortableMexicanSofa::Tag::PageFile.initialize_tag(page, '{{ cms:page_file:file:partial }}')
|
@@ -55,14 +55,14 @@ class PageFilesTagTest < ActiveSupport::TestCase
|
|
55
55
|
file_a, file_b = files
|
56
56
|
|
57
57
|
assert_equal files, tag.content
|
58
|
-
assert_equal "/system/files/#{file_a.id}/original/image.jpg, /system/files/#{file_b.id}/original/image.gif", tag.render
|
58
|
+
assert_equal "/system/cms/files/#{file_a.id}/files/original/image.jpg, /system/cms/files/#{file_b.id}/files/original/image.gif", tag.render
|
59
59
|
|
60
60
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:link }}')
|
61
|
-
assert_equal "<a href='/system/files/#{file_a.id}/original/image.jpg' target='_blank'>Image</a> <a href='/system/files/#{file_b.id}/original/image.gif' target='_blank'>Image</a>",
|
61
|
+
assert_equal "<a href='/system/cms/files/#{file_a.id}/files/original/image.jpg' target='_blank'>Image</a> <a href='/system/cms/files/#{file_b.id}/files/original/image.gif' target='_blank'>Image</a>",
|
62
62
|
tag.render
|
63
63
|
|
64
64
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:image }}')
|
65
|
-
assert_equal "<img src='/system/files/#{file_a.id}/original/image.jpg' alt='Image' /> <img src='/system/files/#{file_b.id}/original/image.gif' alt='Image' />",
|
65
|
+
assert_equal "<img src='/system/cms/files/#{file_a.id}/files/original/image.jpg' alt='Image' /> <img src='/system/cms/files/#{file_b.id}/files/original/image.gif' alt='Image' />",
|
66
66
|
tag.render
|
67
67
|
|
68
68
|
assert tag = ComfortableMexicanSofa::Tag::PageFiles.initialize_tag(page, '{{ cms:page_files:files:partial }}')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-02-
|
13
|
+
date: 2012-02-08 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70121486515260 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70121486515260
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: active_link_to
|
28
|
-
requirement: &
|
28
|
+
requirement: &70121486514720 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70121486514720
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: paperclip
|
39
|
-
requirement: &
|
39
|
+
requirement: &70121486514020 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: 2.3.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70121486514020
|
48
48
|
description: ''
|
49
49
|
email: oleg@theworkinggroup.ca
|
50
50
|
executables: []
|
@@ -364,7 +364,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
364
364
|
version: '0'
|
365
365
|
segments:
|
366
366
|
- 0
|
367
|
-
hash:
|
367
|
+
hash: 1091644248589677740
|
368
368
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
369
369
|
none: false
|
370
370
|
requirements:
|