• R/O
  • HTTP
  • SSH
  • HTTPS

MiMicSDK: Commit

MiMicSDK


Commit MetaInfo

Revision46823da6b6b38411dd4dc824f9ec8deeb1134d74 (tree)
Zeit2015-11-15 17:07:56
Autornyatla <nyatla@4719...>
Commiternyatla

Log Message

add mbed.html

git-svn-id: http://svn.osdn.jp/svnroot/mimic/trunk@391 47198e57-cb75-475f-84c4-a814cd6f29e0

Ändern Zusammenfassung

Diff

--- /dev/null
+++ b/misc/mbedJS/mbed.html/MiMicJSEditor.html
@@ -0,0 +1,348 @@
1+<html>
2+<head>
3+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4+<link href="./mimic.css" rel="stylesheet" type="text/css" />
5+<link rel="stylesheet" href="./c/codemirror-mini.css" />
6+<script src="./slib.js"></script>
7+<script src="./c/codemirror-mini.js"></script>
8+<script src="./c/codemirror_jsedit-mini.js"></script>
9+
10+<style id="user-style-nyatla-bg-img">
11+ body{
12+ width:95%;
13+ height:95%;
14+ }
15+ textarea {
16+ font:inherit;
17+ min-width:100%;
18+ max-width:100%;
19+ overflow-y:auto;
20+ resize:none;
21+ }
22+ hr{
23+ height:1px;
24+ color:black;
25+ }
26+ .CodeMirror {
27+ height:400px;
28+ }
29+ #src{
30+ width:100%;
31+ height:400px;
32+ background-color:#ffffff;
33+ border:solid 1px;
34+ }
35+ iframe{
36+ width:100%;
37+ height:400px;
38+ background-color:#eeeeee;
39+ border:0px;
40+ }
41+ button{
42+ font-weight:bold;
43+ text-align:center;
44+ font-size:12px;
45+ padding:0px;
46+ }
47+ #menu2_stop,#menu2_run,#menu2_expt,#menu2_save{
48+ width:50px;height:40px;
49+ }
50+ .tagp{
51+ float:left;
52+ }
53+ .tag{
54+ background-color:#4169E1;
55+ color:white;
56+ font-weight:bold;
57+ padding:0px 1px 1px 3px;
58+ margin:3px 0px 2px 1px;
59+ }
60+</style>
61+<script type="text/javascript">
62+
63+var app;
64+function getElem(id){return document.getElementById(id);}
65+var Mui=new Object();
66+
67+
68+/**
69+ * textboxのコンソールコントロール。
70+ @param id
71+ タグidを指定します。
72+ [id] コンソールにするtextbox
73+ */
74+Mui.TextAreaConsole=function(id)
75+{
76+ var _t=this;
77+ _t._tags={
78+ text:getElem(id),
79+ tag:getElem(id+"_tag")
80+ };
81+ _t.is_auto_scroll=false;
82+ _t.write=function(s){
83+ _t._tags.text.value+=s;
84+ if(_t.is_auto_scroll){
85+ _t._tags.text.scrollTop =_t._tags.text.scrollHeight;
86+ }
87+ }
88+ _t.writeln=function(s){
89+ t.write(s+"\n");
90+ }
91+ _t.cls=function(){
92+ _t._tags.text.value="";
93+ }
94+ _t.getText=function(){
95+ return _t._tags.text.value;
96+ }
97+
98+}
99+Mui.CodeEditor=function(id)
100+{
101+ var _t=this;
102+ this.events={
103+ onUpdate:null
104+ };
105+ this._tags={text:getElem(id)};
106+
107+ this.is_auto_scroll=false;
108+ var mixedMode = {
109+ name: "htmlmixed",
110+ scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,mode: null}]
111+ };
112+ this._cm=CodeMirror.fromTextArea(this._tags.text,{
113+ mode: mixedMode,
114+ styleActiveLine: true,
115+ lineNumbers: true,
116+ lineWrapping:true});
117+ this.selectall=function(){
118+ var e=_t._cm;
119+ e.setSelection({line:0,ch:0},{line:e.lineCount(),ch:0});
120+ }
121+ this.getText=function(){return _t._cm.getValue();}
122+ this.setText=function(v){_t._cm.setValue(v);}
123+ this.readOnly=function(b)
124+ {_t._cm.setOption("readOnly",b);}
125+ var tid=undefined;
126+ this._cm.on("change", function() {
127+ if(tid!=undefined){
128+ clearTimeout(tid);
129+ }
130+ tid = setTimeout(function(){if(_t.events.onUpdate!=null){_t.events.onUpdate();}}, 300);
131+ });
132+}
133+
134+
135+Mui.Command=function(id)
136+{
137+ var _t=this;
138+ this._tags={
139+ run:getElem(id+"_run"),
140+ stop:getElem(id+"_stop"),
141+ save:getElem(id+"_save"),
142+ expt:getElem(id+"_expt")
143+ }
144+ this.events={
145+ onCommand:null
146+ }
147+ _t._onCommand=function(eid){
148+ if(_t.events.onCommand!=null){
149+ _t.events.onCommand(eid);
150+ }
151+ },
152+ this._is_run=false;
153+ this._tags.run.disabled=false;
154+ this._tags.stop.disabled=true;
155+ this.CM_RUN=1;
156+ this.CM_STOP=2;
157+ this.CM_EXPT=3;
158+ this.CM_SAVE=4;
159+ this._tags.run.onclick=function(){
160+ _t._tags.run.disabled=true;
161+ _t._tags.stop.disabled=false;
162+ _t._onCommand(_t.CM_RUN);
163+ };
164+ this._tags.stop.onclick=function()
165+ {
166+ _t._tags.run.disabled=false;
167+ _t._tags.stop.disabled=true;
168+ _t._onCommand(_t.CM_STOP);
169+ };
170+ this._tags.save.onclick=function()
171+ {
172+ _t._tags.run.disabled=false;
173+ _t._tags.stop.disabled=true;
174+ _t._onCommand(_t.CM_SAVE);
175+ };
176+ this._tags.expt.onclick=function(){_t._onCommand(_t.CM_EXPT);};
177+}
178+
179+Mui.Preview=function(id)
180+{
181+ var elem = getElem(id);
182+ function remakeif(str)
183+ {
184+ var f=document.createElement("iframe");
185+ var c=elem.childNodes;
186+ for(var i=0;i<c.length;i++){
187+ elem.removeChild(c[i]);
188+ }
189+ elem.appendChild(f);
190+ var d=f.contentDocument || f.contentWindow.document;
191+ d.open();
192+ d.write(str);
193+ d.close();
194+ }
195+ var _t=this;
196+ this.updatePreview=function(str){
197+ str=str.replace(/<[^<script]*script[^\/>]*\/>/gi,"<noscript/>");
198+ str=str.replace(/<[^<script]*script[^<]*<[^<\/script]*(\/script[^>]*>)/gi,"<noscript></noscript>");
199+ remakeif(str);
200+ }
201+ this.updateRun=function(str){
202+ remakeif(str);
203+ }
204+}
205+
206+function Application()
207+{
208+ //initialization
209+ var ui={
210+ source:new Mui.CodeEditor("src"),
211+ cmd:new Mui.Command("menu2"),
212+ preview:new Mui.Preview("preview")
213+ }
214+ var fname=null;//file name
215+
216+ this.ui=ui;
217+ var mif=null;
218+ ui.cmd.events.onCommand=function(id)
219+ {
220+ switch(id){
221+ case ui.cmd.CM_RUN:
222+ ui.source.readOnly(true);
223+ ui.preview.updateRun(ui.source.getText());
224+ return;
225+ case ui.cmd.CM_STOP:
226+ ui.preview.updatePreview(ui.source.getText());
227+ ui.source.readOnly(false);
228+ return;
229+ case ui.cmd.CM_EXPT:
230+ slib.downloadAsFile("miapp.htm",ui.source.getText());
231+ ui.source.selectall();
232+ return;
233+ case ui.cmd.CM_SAVE:
234+ var n=window.prompt("Input local file path.",fname==null?"/local/noname.htm":fname);
235+ if(n!=null){
236+ try{
237+ if(slib.xhr("/fio/upload.api?name="+n,null,"POST",ui.source.getText()).status!=200){
238+ throw "Bad XHR fio status code.";
239+ }
240+ }catch(e){
241+ alert("Failed to save the file.\n"+e);
242+ }
243+ fname=n;
244+ alert("The file was saved.\n"+fname);
245+ }
246+ return;
247+ default:
248+ alert("unknown command id");
249+ }
250+ }
251+
252+
253+
254+ //preload
255+ {
256+ var q=slib.getUrlQuery(location.href);
257+ var s=q['src'];
258+ if(s!==undefined && s!=null){
259+ try{
260+ var r=slib.xhr(s);
261+ if(r.status!=200){
262+ throw new String("Can not load contet:"+s);
263+ }
264+ ui.source.setText(r.responseText);
265+ fname=s;
266+ }catch(e){
267+ alert("Load failed:\n"+e);
268+ }
269+ }
270+ }
271+ ui.preview.updatePreview(ui.source.getText());
272+ ui.source.events.onUpdate=function()
273+ {
274+ ui.preview.updatePreview(ui.source.getText());
275+ }
276+
277+ //away setting
278+ function away(event) {
279+ event = event || window.event;
280+ return event.returnValue = 'Entries will be lost.\nDo you navigate away from the page?';
281+ }
282+ if (window.addEventListener){
283+ window.addEventListener('beforeunload', away, false);
284+ }else if (window.attachEvent) {
285+ window.attachEvent('onbeforeunload', away);
286+ }
287+}
288+
289+
290+function init()
291+{
292+ app=new Application();
293+}
294+
295+
296+
297+
298+</script>
299+</head>
300+<body onload="init();">
301+<h1 style="float:left;"><img src="./mimiclogo.png"/><span id="idx" >MiMic Javascript Editor</span></h1>
302+<div style="float:right;" ><a href="/">Return to top</a></div>
303+<hr style="clear:both;" />
304+<div id="menu2">
305+ <div style="float:left;"><button id="menu2_run"/>Play</button><button id="menu2_stop" />Stop</button><button id="menu2_save"/>Save</button><button id="menu2_expt"/>Export</button></div>
306+ <div style="float:right;" ><a href="#" onclick="window.open('http://mimic.sourceforge.jp/doc/mbedjs/current/');">API Reference</a></div>
307+</div>
308+<div class="tagp" style="clear:both;width:60%;position:relative;">
309+ <div class="tag" id="src_tag">Source code</div>
310+<textarea id="src">
311+<!DOCTYPE html>
312+<html><head>
313+<meta charset="UTF-8">
314+<script src="/rom/m/mbedJS.all-min.js"></script>
315+<script type="text/javascript">
316+function start()
317+{
318+ var mcu=new mbedJS.Mcu(location.host,{
319+ onNew:function(){
320+ var v=1;
321+ var pin=new mbedJS.DigitalOut(mcu,mbedJS.PinName.LED1,{
322+ onNew:function(){
323+ pin.write(1);
324+ },
325+ onWrite:function(){
326+ setTimeout(function(){pin.write((v++)%2);},100);
327+ }});
328+ },
329+ onError:function(){alert("Error!");}
330+ });
331+}
332+</script>
333+</head>
334+<h1 id="title">LED Blink</h1>
335+<body onload="start()">
336+</body>
337+</html>
338+</textarea>
339+</div>
340+<div class="tagp" style="width:40%">
341+ <div class="tag">Preview</div>
342+ <div id="preview"></div>
343+</div>
344+<div class="footer" style="clear:both">
345+ MiMic project<br/>Copyright (C) 2011-2013 <a href="http://nyatla.jp">nyatla.jp</a> All Rights Reserved.
346+</div>
347+</body>
348+</html>
--- /dev/null
+++ b/misc/mbedJS/mbed.html/c/LICENSE
@@ -0,0 +1,23 @@
1+Copyright (C) 2013 by Marijn Haverbeke <marijnh@gmail.com>
2+
3+Permission is hereby granted, free of charge, to any person obtaining a copy
4+of this software and associated documentation files (the "Software"), to deal
5+in the Software without restriction, including without limitation the rights
6+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+copies of the Software, and to permit persons to whom the Software is
8+furnished to do so, subject to the following conditions:
9+
10+The above copyright notice and this permission notice shall be included in
11+all copies or substantial portions of the Software.
12+
13+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+THE SOFTWARE.
20+
21+Please note that some subdirectories of the CodeMirror distribution
22+include their own LICENSE files, and are released under different
23+licences.
--- /dev/null
+++ b/misc/mbedJS/mbed.html/c/codemirror-mini.css
@@ -0,0 +1 @@
1+.CodeMirror{font-family:monospace;height:300px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid black;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:black}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:black}.cm-s-default .cm-operator{color:black}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:white;color:black}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:0;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
\ No newline at end of file
--- /dev/null
+++ b/misc/mbedJS/mbed.html/c/codemirror-mini.js
@@ -0,0 +1 @@
1+window.CodeMirror=(function(){var bB=/gecko\/\d/i.test(navigator.userAgent);var cs=/MSIE \d/.test(navigator.userAgent);var by=cs&&(document.documentMode==null||document.documentMode<8);var bx=cs&&(document.documentMode==null||document.documentMode<9);var b1=/WebKit\//.test(navigator.userAgent);var cv=b1&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var b9=/Chrome\//.test(navigator.userAgent);var dM=/Opera\//.test(navigator.userAgent);var ae=/Apple Computer/.test(navigator.vendor);var aC=/KHTML\//.test(navigator.userAgent);var bM=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var b6=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var dJ=/PhantomJS/.test(navigator.userAgent);var dl=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var cN=dl||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var bk=dl||/Mac/.test(navigator.platform);var am=/windows/i.test(navigator.platform);var cZ=dM&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(cZ){cZ=Number(cZ[1])}var ba=bk&&(cv||dM&&(cZ==null||cZ<12.11));var bQ=bB||(cs&&!bx);var d9=false,az=false;function z(ee,ef){if(!(this instanceof z)){return new z(ee,ef)}this.options=ef=ef||{};for(var eg in dn){if(!ef.hasOwnProperty(eg)&&dn.hasOwnProperty(eg)){ef[eg]=dn[eg]}}bs(ef);var ek=typeof ef.value=="string"?0:ef.value.first;var ej=this.display=f(ee,ek);ej.wrapper.CodeMirror=this;cJ(this);if(ef.autofocus&&!cN){c2(this)}this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,draggingText:false,highlight:new ed()};bV(this);if(ef.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}var ei=ef.value;if(typeof ei=="string"){ei=new Y(ef.value,ef.mode)}b2(this,cI)(this,ei);if(cs){setTimeout(bH(dF,this,true),20)}dZ(this);var el;try{el=(document.activeElement==ej.input)}catch(eh){}if(el||(ef.autofocus&&!cN)){setTimeout(bH(bL,this),20)}else{ar(this)}b2(this,function(){for(var en in aF){if(aF.propertyIsEnumerable(en)){aF[en](this,ef[en],bq)}}for(var em=0;em<aA.length;++em){aA[em](this)}})()}function f(ee,eg){var eh={};var ef=eh.input=d4("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");if(b1){ef.style.width="1000px"}else{ef.setAttribute("wrap","off")}if(dl){ef.style.border="1px solid black"}ef.setAttribute("autocorrect","off");ef.setAttribute("autocapitalize","off");ef.setAttribute("spellcheck","false");eh.inputDiv=d4("div",[ef],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");eh.scrollbarH=d4("div",[d4("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");eh.scrollbarV=d4("div",[d4("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");eh.scrollbarFiller=d4("div",null,"CodeMirror-scrollbar-filler");eh.gutterFiller=d4("div",null,"CodeMirror-gutter-filler");eh.lineDiv=d4("div",null,"CodeMirror-code");eh.selectionDiv=d4("div",null,null,"position: relative; z-index: 1");eh.cursor=d4("div","\u00a0","CodeMirror-cursor");eh.otherCursor=d4("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");eh.measure=d4("div",null,"CodeMirror-measure");eh.lineSpace=d4("div",[eh.measure,eh.selectionDiv,eh.lineDiv,eh.cursor,eh.otherCursor],null,"position: relative; outline: none");eh.mover=d4("div",[d4("div",[eh.lineSpace],"CodeMirror-lines")],null,"position: relative");eh.sizer=d4("div",[eh.mover],"CodeMirror-sizer");eh.heightForcer=d4("div",null,null,"position: absolute; height: "+aJ+"px; width: 1px;");eh.gutters=d4("div",null,"CodeMirror-gutters");eh.lineGutter=null;eh.scroller=d4("div",[eh.sizer,eh.heightForcer,eh.gutters],"CodeMirror-scroll");eh.scroller.setAttribute("tabIndex","-1");eh.wrapper=d4("div",[eh.inputDiv,eh.scrollbarH,eh.scrollbarV,eh.scrollbarFiller,eh.gutterFiller,eh.scroller],"CodeMirror");if(by){eh.gutters.style.zIndex=-1;eh.scroller.style.paddingRight=0}if(ee.appendChild){ee.appendChild(eh.wrapper)}else{ee(eh.wrapper)}if(dl){ef.style.width="0px"}if(!b1){eh.scroller.draggable=true}if(aC){eh.inputDiv.style.height="1px";eh.inputDiv.style.position="absolute"}else{if(by){eh.scrollbarH.style.minWidth=eh.scrollbarV.style.minWidth="18px"}}eh.viewOffset=eh.lastSizeC=0;eh.showingFrom=eh.showingTo=eg;eh.lineNumWidth=eh.lineNumInnerWidth=eh.lineNumChars=null;eh.prevInput="";eh.alignWidgets=false;eh.pollingFast=false;eh.poll=new ed();eh.cachedCharWidth=eh.cachedTextHeight=null;eh.measureLineCache=[];eh.measureLineCachePos=0;eh.inaccurateSelection=false;eh.maxLine=null;eh.maxLineLength=0;eh.maxLineChanged=false;eh.wheelDX=eh.wheelDY=eh.wheelStartX=eh.wheelStartY=null;return eh}function aS(ee){ee.doc.mode=z.getMode(ee.options,ee.doc.modeOption);ee.doc.iter(function(ef){if(ef.stateAfter){ef.stateAfter=null}if(ef.styles){ef.styles=null}});ee.doc.frontier=ee.doc.first;cM(ee,100);ee.state.modeGen++;if(ee.curOp){O(ee)}}function da(ee){if(ee.options.lineWrapping){ee.display.wrapper.className+=" CodeMirror-wrap";ee.display.sizer.style.minWidth=""}else{ee.display.wrapper.className=ee.display.wrapper.className.replace(" CodeMirror-wrap","");d6(ee)}J(ee);O(ee);R(ee);setTimeout(function(){dj(ee)},100)}function aE(ee){var eg=au(ee.display),ef=ee.options.lineWrapping;var eh=ef&&Math.max(5,ee.display.scroller.clientWidth/cq(ee.display)-3);return function(ei){if(dK(ee.doc,ei)){return 0}else{if(ef){return(Math.ceil(ei.text.length/eh)||1)*eg}else{return eg}}}}function J(ee){var eg=ee.doc,ef=aE(ee);eg.iter(function(eh){var ei=ef(eh);if(ei!=eh.height){d7(eh,ei)}})}function ec(ee){var eg=ds[ee.options.keyMap],ef=eg.style;ee.display.wrapper.className=ee.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(ef?" cm-keymap-"+ef:"");ee.state.disableInput=eg.disableInput}function bV(ee){ee.display.wrapper.className=ee.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+ee.options.theme.replace(/(^|\s)\s*/g," cm-s-");R(ee)}function cl(ee){cJ(ee);O(ee);setTimeout(function(){c6(ee)},20)}function cJ(ee){var ef=ee.display.gutters,ej=ee.options.gutters;cC(ef);for(var eg=0;eg<ej.length;++eg){var eh=ej[eg];var ei=ef.appendChild(d4("div",null,"CodeMirror-gutter "+eh));if(eh=="CodeMirror-linenumbers"){ee.display.lineGutter=ei;ei.style.width=(ee.display.lineNumWidth||1)+"px"}}ef.style.display=eg?"":"none"}function cR(ei,eg){if(eg.height==0){return 0}var ef=eg.text.length,ee,ej=eg;while(ee=dd(ej)){var eh=ee.find();ej=dv(ei,eh.from.line);ef+=eh.from.ch-eh.to.ch}ej=eg;while(ee=cW(ej)){var eh=ee.find();ef-=ej.text.length-eh.from.ch;ej=dv(ei,eh.to.line);ef+=ej.text.length-eh.to.ch}return ef}function d6(ee){var eg=ee.display,ef=ee.doc;eg.maxLine=dv(ef,ef.first);eg.maxLineLength=cR(ef,eg.maxLine);eg.maxLineChanged=true;ef.iter(function(ei){var eh=cR(ef,ei);if(eh>eg.maxLineLength){eg.maxLineLength=eh;eg.maxLine=ei}})}function bs(ee){var eg=false;for(var ef=0;ef<ee.gutters.length;++ef){if(ee.gutters[ef]=="CodeMirror-linenumbers"){if(ee.lineNumbers){eg=true}else{ee.gutters.splice(ef--,1)}}}if(!eg&&ee.lineNumbers){ee.gutters.push("CodeMirror-linenumbers")}}function dj(ee){var ek=ee.display,ef=ee.doc.height;var eh=ef+a3(ek);ek.sizer.style.minHeight=ek.heightForcer.style.top=eh+"px";ek.gutters.style.height=Math.max(eh,ek.scroller.clientHeight-aJ)+"px";var ei=Math.max(eh,ek.scroller.scrollHeight);var ej=ek.scroller.scrollWidth>(ek.scroller.clientWidth+1);var eg=ei>(ek.scroller.clientHeight+1);if(eg){ek.scrollbarV.style.display="block";ek.scrollbarV.style.bottom=ej?i(ek.measure)+"px":"0";ek.scrollbarV.firstChild.style.height=(ei-ek.scroller.clientHeight+ek.scrollbarV.clientHeight)+"px"}else{ek.scrollbarV.style.display=""}if(ej){ek.scrollbarH.style.display="block";ek.scrollbarH.style.right=eg?i(ek.measure)+"px":"0";ek.scrollbarH.firstChild.style.width=(ek.scroller.scrollWidth-ek.scroller.clientWidth+ek.scrollbarH.clientWidth)+"px"}else{ek.scrollbarH.style.display=""}if(ej&&eg){ek.scrollbarFiller.style.display="block";ek.scrollbarFiller.style.height=ek.scrollbarFiller.style.width=i(ek.measure)+"px"}else{ek.scrollbarFiller.style.display=""}if(ej&&ee.options.coverGutterNextToScrollbar&&ee.options.fixedGutter){ek.gutterFiller.style.display="block";ek.gutterFiller.style.height=i(ek.measure)+"px";ek.gutterFiller.style.width=ek.gutters.offsetWidth+"px"}else{ek.gutterFiller.style.display=""}if(bM&&i(ek.measure)===0){ek.scrollbarV.style.minWidth=ek.scrollbarH.style.minHeight=b6?"18px":"12px"}}function bj(ej,ei,eh){var eg=ej.scroller.scrollTop,ee=ej.wrapper.clientHeight;if(typeof eh=="number"){eg=eh}else{if(eh){eg=eh.top;ee=eh.bottom-eh.top}}eg=Math.floor(eg-dq(ej));var ef=Math.ceil(eg+ee);return{from:a1(ei,eg),to:a1(ei,ef)}}function c6(ee){var ek=ee.display;if(!ek.alignWidgets&&(!ek.gutters.firstChild||!ee.options.fixedGutter)){return}var eh=cB(ek)-ek.scroller.scrollLeft+ee.doc.scrollLeft;var ej=ek.gutters.offsetWidth,eg=eh+"px";for(var el=ek.lineDiv.firstChild;el;el=el.nextSibling){if(el.alignable){for(var ei=0,ef=el.alignable;ei<ef.length;++ei){ef[ei].style.left=eg}}}if(ee.options.fixedGutter){ek.gutters.style.left=(eh+ej)+"px"}}function cE(ee){if(!ee.options.lineNumbers){return false}var ej=ee.doc,ef=cU(ee.options,ej.first+ej.size-1),ei=ee.display;if(ef.length!=ei.lineNumChars){var ek=ei.measure.appendChild(d4("div",[d4("div",ef)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var eg=ek.firstChild.offsetWidth,eh=ek.offsetWidth-eg;ei.lineGutter.style.width="";ei.lineNumInnerWidth=Math.max(eg,ei.lineGutter.offsetWidth-eh);ei.lineNumWidth=ei.lineNumInnerWidth+eh;ei.lineNumChars=ei.lineNumInnerWidth?ef.length:-1;ei.lineGutter.style.width=ei.lineNumWidth+"px";return true}return false}function cU(ee,ef){return String(ee.lineNumberFormatter(ef+ee.firstLineNumber))}function cB(ee){return al(ee.scroller).left-al(ee.sizer).left}function ct(ee,eh,ei){var eg=ee.display.showingFrom,ek=ee.display.showingTo,ef;var ej=bj(ee.display,ee.doc,ei);for(;;){if(!cc(ee,eh,ej)){break}ef=true;aY(ee);dj(ee);if(ei){ei=Math.min(ee.display.scroller.scrollHeight-ee.display.scroller.clientHeight,typeof ei=="number"?ei:ei.top)}ej=bj(ee.display,ee.doc,ei);if(ej.from>=ee.display.showingFrom&&ej.to<=ee.display.showingTo){break}eh=[]}if(ef){M(ee,"update",ee);if(ee.display.showingFrom!=eg||ee.display.showingTo!=ek){M(ee,"viewportChange",ee,ee.display.showingFrom,ee.display.showingTo)}}return ef}function cc(ej,eC,ef){var ev=ej.display,eD=ej.doc;if(!ev.wrapper.clientWidth){ev.showingFrom=ev.showingTo=eD.first;ev.viewOffset=0;return}if(eC.length==0&&ef.from>ev.showingFrom&&ef.to<ev.showingTo){return}if(cE(ej)){eC=[{from:eD.first,to:eD.first+eD.size}]}var eA=ev.sizer.style.marginLeft=ev.gutters.offsetWidth+"px";ev.scrollbarH.style.left=ej.options.fixedGutter?eA:"0";var eg=Infinity;if(ej.options.lineNumbers){for(var ew=0;ew<eC.length;++ew){if(eC[ew].diff){eg=eC[ew].from;break}}}var eh=eD.first+eD.size;var eu=Math.max(ef.from-ej.options.viewportMargin,eD.first);var ee=Math.min(eh,ef.to+ej.options.viewportMargin);if(ev.showingFrom<eu&&eu-ev.showingFrom<20){eu=Math.max(eD.first,ev.showingFrom)}if(ev.showingTo>ee&&ev.showingTo-ee<20){ee=Math.min(eh,ev.showingTo)}if(az){eu=a8(t(eD,dv(eD,eu)));while(ee<eh&&dK(eD,dv(eD,ee))){++ee}}var ey=[{from:Math.max(ev.showingFrom,eD.first),to:Math.min(ev.showingTo,eh)}];if(ey[0].from>=ey[0].to){ey=[]}else{ey=dE(ey,eC)}if(az){for(var ew=0;ew<ey.length;++ew){var eo=ey[ew],ez;while(ez=cW(dv(eD,eo.to-1))){var eB=ez.find().from.line;if(eB>eo.from){eo.to=eB}else{ey.splice(ew--,1);break}}}}var er=0;for(var ew=0;ew<ey.length;++ew){var eo=ey[ew];if(eo.from<eu){eo.from=eu}if(eo.to>ee){eo.to=ee}if(eo.from>=eo.to){ey.splice(ew--,1)}else{er+=eo.to-eo.from}}if(er==ee-eu&&eu==ev.showingFrom&&ee==ev.showingTo){h(ej);return}ey.sort(function(eF,eE){return eF.from-eE.from});try{var ek=document.activeElement}catch(ex){}if(er<(ee-eu)*0.7){ev.lineDiv.style.display="none"}bz(ej,eu,ee,ey,eg);ev.lineDiv.style.display="";if(ek&&document.activeElement!=ek&&ek.offsetHeight){ek.focus()}var ep=eu!=ev.showingFrom||ee!=ev.showingTo||ev.lastSizeC!=ev.wrapper.clientHeight;if(ep){ev.lastSizeC=ev.wrapper.clientHeight;cM(ej,400)}ev.showingFrom=eu;ev.showingTo=ee;var ei=ev.lineDiv.offsetTop;for(var et=ev.lineDiv.firstChild,eq;et;et=et.nextSibling){if(et.lineObj){if(by){var en=et.offsetTop+et.offsetHeight;eq=en-ei;ei=en}else{var el=al(et);eq=el.bottom-el.top}var em=et.lineObj.height-eq;if(eq<2){eq=au(ev)}if(em>0.001||em<-0.001){d7(et.lineObj,eq);var es=et.lineObj.widgets;if(es){for(var ew=0;ew<es.length;++ew){es[ew].height=es[ew].node.offsetHeight}}}}}h(ej);return true}function h(ee){var ef=ee.display.viewOffset=a7(ee,dv(ee.doc,ee.display.showingFrom));ee.display.mover.style.top=ef+"px"}function dE(en,el){for(var ei=0,eg=el.length||0;ei<eg;++ei){var ek=el[ei],ee=[],em=ek.diff||0;for(var eh=0,ef=en.length;eh<ef;++eh){var ej=en[eh];if(ek.to<=ej.from&&ek.diff){ee.push({from:ej.from+em,to:ej.to+em})}else{if(ek.to<=ej.from||ek.from>=ej.to){ee.push(ej)}else{if(ek.from>ej.from){ee.push({from:ej.from,to:ek.from})}if(ek.to<ej.to){ee.push({from:ek.to+em,to:ej.to+em})}}}}en=ee}return en}function dt(ee){var ei=ee.display,eh={},eg={};for(var ej=ei.gutters.firstChild,ef=0;ej;ej=ej.nextSibling,++ef){eh[ee.options.gutters[ef]]=ej.offsetLeft;eg[ee.options.gutters[ef]]=ej.offsetWidth}return{fixedPos:cB(ei),gutterTotalWidth:ei.gutters.offsetWidth,gutterLeft:eh,gutterWidth:eg,wrapperWidth:ei.wrapper.clientWidth}}function bz(en,ek,el,eq,ef){var em=dt(en);var ej=en.display,ep=en.options.lineNumbers;if(!eq.length&&(!b1||!en.display.currentWheelTarget)){cC(ej.lineDiv)}var ee=ej.lineDiv,eo=ee.firstChild;function ei(es){var er=es.nextSibling;if(b1&&bk&&en.display.currentWheelTarget==es){es.style.display="none";es.lineObj=null}else{es.parentNode.removeChild(es)}return er}var eg=eq.shift(),eh=ek;en.doc.iter(ek,el,function(eA){if(eg&&eg.to==eh){eg=eq.shift()}if(dK(en.doc,eA)){if(eA.height!=0){d7(eA,0)}if(eA.widgets&&eo.previousSibling){for(var ev=0;ev<eA.widgets.length;++ev){var ex=eA.widgets[ev];if(ex.showIfHidden){var et=eo.previousSibling;if(/pre/i.test(et.nodeName)){var es=d4("div",null,null,"position: relative");et.parentNode.replaceChild(es,et);es.appendChild(et);et=es}var ey=et.appendChild(d4("div",[ex.node],"CodeMirror-linewidget"));if(!ex.handleMouseEvents){ey.ignoreEvents=true}a0(ex,ey,et,em)}}}}else{if(eg&&eg.from<=eh&&eg.to>eh){while(eo.lineObj!=eA){eo=ei(eo)}if(ep&&ef<=eh&&eo.lineNumber){n(eo.lineNumber,cU(en.options,eh))}eo=eo.nextSibling}else{if(eA.widgets){for(var eu=0,ez=eo,ew;ez&&eu<20;++eu,ez=ez.nextSibling){if(ez.lineObj==eA&&/div/i.test(ez.nodeName)){ew=ez;break}}}var er=ag(en,eA,eh,em,ew);if(er!=ew){ee.insertBefore(er,eo)}else{while(eo!=ew){eo=ei(eo)}eo=eo.nextSibling}er.lineObj=eA}}++eh});while(eo){eo=ei(eo)}}function ag(ek,em,en,eq,ef){var ew=cw(ek,em);var ez=em.gutterMarkers,ex=ek.display,el;if(!ek.options.lineNumbers&&!ez&&!em.bgClass&&!em.wrapClass&&!em.widgets){return ew}if(ef){ef.alignable=null;var eA=true,eh=0,eg=null;for(var es=ef.firstChild,er;es;es=er){er=es.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(es.className)){ef.removeChild(es)}else{for(var ey=0,ej=true;ey<em.widgets.length;++ey){var ei=em.widgets[ey];if(!ei.above){eg=es;ej=false}if(ei.node==es.firstChild){a0(ei,es,ef,eq);++eh;break}}if(ey==em.widgets.length){eA=false;break}}}ef.insertBefore(ew,eg);if(eA&&eh==em.widgets.length){el=ef;ef.className=em.wrapClass||""}}if(!el){el=d4("div",null,em.wrapClass,"position: relative");el.appendChild(ew)}if(em.bgClass){el.insertBefore(d4("div",null,em.bgClass+" CodeMirror-linebackground"),el.firstChild)}if(ek.options.lineNumbers||ez){var eu=el.insertBefore(d4("div",null,null,"position: absolute; left: "+(ek.options.fixedGutter?eq.fixedPos:-eq.gutterTotalWidth)+"px"),el.firstChild);if(ek.options.fixedGutter){(el.alignable||(el.alignable=[])).push(eu)}if(ek.options.lineNumbers&&(!ez||!ez["CodeMirror-linenumbers"])){el.lineNumber=eu.appendChild(d4("div",cU(ek.options,en),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+eq.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+ex.lineNumInnerWidth+"px"))}if(ez){for(var ev=0;ev<ek.options.gutters.length;++ev){var ep=ek.options.gutters[ev],eo=ez.hasOwnProperty(ep)&&ez[ep];if(eo){eu.appendChild(d4("div",[eo],"CodeMirror-gutter-elt","left: "+eq.gutterLeft[ep]+"px; width: "+eq.gutterWidth[ep]+"px"))}}}}if(by){el.style.zIndex=2}if(em.widgets&&el!=ef){for(var ey=0,ee=em.widgets;ey<ee.length;++ey){var ei=ee[ey],et=d4("div",[ei.node],"CodeMirror-linewidget");if(!ei.handleMouseEvents){et.ignoreEvents=true}a0(ei,et,el,eq);if(ei.above){el.insertBefore(et,ek.options.lineNumbers&&em.height!=0?eu:ew)}else{el.appendChild(et)}M(ei,"redraw")}}return el}function a0(eh,eg,ef,ei){if(eh.noHScroll){(ef.alignable||(ef.alignable=[])).push(eg);var ee=ei.wrapperWidth;eg.style.left=ei.fixedPos+"px";if(!eh.coverGutter){ee-=ei.gutterTotalWidth;eg.style.paddingLeft=ei.gutterTotalWidth+"px"}eg.style.width=ee+"px"}if(eh.coverGutter){eg.style.zIndex=5;eg.style.position="relative";if(!eh.noHScroll){eg.style.marginLeft=-ei.gutterTotalWidth+"px"}}}function aY(ee){var eh=ee.display;var ei=dT(ee.doc.sel.from,ee.doc.sel.to);if(ei||ee.options.showCursorWhenSelecting){A(ee)}else{eh.cursor.style.display=eh.otherCursor.style.display="none"}if(!ei){T(ee)}else{eh.selectionDiv.style.display="none"}if(ee.options.moveInputWithCursor){var ej=cz(ee,ee.doc.sel.head,"div");var ef=al(eh.wrapper),eg=al(eh.lineDiv);eh.inputDiv.style.top=Math.max(0,Math.min(eh.wrapper.clientHeight-10,ej.top+eg.top-ef.top))+"px";eh.inputDiv.style.left=Math.max(0,Math.min(eh.wrapper.clientWidth-10,ej.left+eg.left-ef.left))+"px"}}function A(ee){var ef=ee.display,eg=cz(ee,ee.doc.sel.head,"div");ef.cursor.style.left=eg.left+"px";ef.cursor.style.top=eg.top+"px";ef.cursor.style.height=Math.max(0,eg.bottom-eg.top)*ee.options.cursorHeight+"px";ef.cursor.style.display="";if(eg.other){ef.otherCursor.style.display="";ef.otherCursor.style.left=eg.other.left+"px";ef.otherCursor.style.top=eg.other.top+"px";ef.otherCursor.style.height=(eg.other.bottom-eg.other.top)*0.85+"px"}else{ef.otherCursor.style.display="none"}}function T(ep){var ek=ep.display,eo=ep.doc,ee=ep.doc.sel;var ei=document.createDocumentFragment();var en=ek.lineSpace.offsetWidth,eg=at(ep.display);function er(ev,eu,et,es){if(eu<0){eu=0}ei.appendChild(d4("div",null,"CodeMirror-selected","position: absolute; left: "+ev+"px; top: "+eu+"px; width: "+(et==null?en-ev:et)+"px; height: "+(es-eu)+"px"))}function em(et,ev,ey){var eu=dv(eo,et);var ew=eu.text.length;var ez,es;function ex(eB,eA){return bS(ep,I(et,eB),"div",eu,eA)}cD(a(eu),ev||0,ey==null?ew:ey,function(eH,eG,eA){var eD=ex(eH,"left"),eE,eF,eC;if(eH==eG){eE=eD;eF=eC=eD.left}else{eE=ex(eG-1,"right");if(eA=="rtl"){var eB=eD;eD=eE;eE=eB}eF=eD.left;eC=eE.right}if(ev==null&&eH==0){eF=eg}if(eE.top-eD.top>3){er(eF,eD.top,null,eD.bottom);eF=eg;if(eD.bottom<eE.top){er(eF,eD.bottom,null,eE.top)}}if(ey==null&&eG==ew){eC=en}if(!ez||eD.top<ez.top||eD.top==ez.top&&eD.left<ez.left){ez=eD}if(!es||eE.bottom>es.bottom||eE.bottom==es.bottom&&eE.right>es.right){es=eE}if(eF<eg+1){eF=eg}er(eF,eE.top,eC-eF,eE.bottom)});return{start:ez,end:es}}if(ee.from.line==ee.to.line){em(ee.from.line,ee.from.ch,ee.to.ch)}else{var eh=dv(eo,ee.from.line),ef=dv(eo,ee.to.line);var ej=t(eo,eh)==t(eo,ef);var eq=em(ee.from.line,ee.from.ch,ej?eh.text.length:null).end;var el=em(ee.to.line,ej?0:null,ee.to.ch).start;if(ej){if(eq.top<el.top-2){er(eq.right,eq.top,null,eq.bottom);er(eg,el.top,el.left,el.bottom)}else{er(eq.right,eq.top,el.left-eq.right,eq.bottom)}}if(eq.bottom<el.top){er(eg,eq.bottom,null,el.top)}}bc(ek.selectionDiv,ei);ek.selectionDiv.style.display=""}function l(ee){if(!ee.state.focused){return}var eg=ee.display;clearInterval(eg.blinker);var ef=true;eg.cursor.style.visibility=eg.otherCursor.style.visibility="";eg.blinker=setInterval(function(){eg.cursor.style.visibility=eg.otherCursor.style.visibility=(ef=!ef)?"":"hidden"},ee.options.cursorBlinkRate)}function cM(ee,ef){if(ee.doc.mode.startState&&ee.doc.frontier<ee.display.showingTo){ee.state.highlight.set(ef,bH(bW,ee))}}function bW(ee){var eh=ee.doc;if(eh.frontier<eh.first){eh.frontier=eh.first}if(eh.frontier>=ee.display.showingTo){return}var ef=+new Date+ee.options.workTime;var eg=bi(eh.mode,co(ee,eh.frontier));var ej=[],ei;eh.iter(eh.frontier,Math.min(eh.first+eh.size,ee.display.showingTo+500),function(ek){if(eh.frontier>=ee.display.showingFrom){var em=ek.styles;ek.styles=dP(ee,ek,eg);var en=!em||em.length!=ek.styles.length;for(var el=0;!en&&el<em.length;++el){en=em[el]!=ek.styles[el]}if(en){if(ei&&ei.end==eh.frontier){ei.end++}else{ej.push(ei={start:eh.frontier,end:eh.frontier+1})}}ek.stateAfter=bi(eh.mode,eg)}else{cm(ee,ek,eg);ek.stateAfter=eh.frontier%5==0?bi(eh.mode,eg):null}++eh.frontier;if(+new Date>ef){cM(ee,ee.options.workDelay);return true}});if(ej.length){b2(ee,function(){for(var ek=0;ek<ej.length;++ek){O(this,ej[ek].start,ej[ek].end)}})()}}function bJ(ek,ee,eh){var ef,ei,ej=ek.doc;for(var en=ee,eg=ee-100;en>eg;--en){if(en<=ej.first){return ej.first}var em=dv(ej,en-1);if(em.stateAfter&&(!eh||en<=ej.frontier)){return en}var el=bb(em.text,null,ek.options.tabSize);if(ei==null||ef>el){ei=en-1;ef=el}}return ei}function co(ee,ek,ef){var ei=ee.doc,eh=ee.display;if(!ei.mode.startState){return true}var ej=bJ(ee,ek,ef),eg=ej>ei.first&&dv(ei,ej-1).stateAfter;if(!eg){eg=bh(ei.mode)}else{eg=bi(ei.mode,eg)}ei.iter(ej,ek,function(el){cm(ee,el,eg);var em=ej==ek-1||ej%5==0||ej>=eh.showingFrom&&ej<eh.showingTo;el.stateAfter=em?bi(ei.mode,eg):null;++ej});return eg}function dq(ee){return ee.lineSpace.offsetTop}function a3(ee){return ee.mover.offsetHeight-ee.lineSpace.offsetHeight}function at(ef){var ee=bc(ef.measure,d4("pre",null,null,"text-align: left")).appendChild(d4("span","x"));return ee.offsetLeft}function cO(el,em,ef,eh,ej){var eg=-1;eh=eh||a4(el,em);for(var ek=ef;;ek+=eg){var ee=eh[ek];if(ee){break}if(eg<0&&ek==0){eg=1}}var ei=(ek<ef||ej=="right")&&ee.topRight!=null;return{left:ek<ef?ee.right:ee.left,right:ek>ef?ee.left:ee.right,top:ei?ee.topRight:ee.top,bottom:ei?ee.bottomRight:ee.bottom}}function dp(ee,ef){var eh=ee.display.measureLineCache;for(var ei=0;ei<eh.length;++ei){var eg=eh[ei];if(eg.text==ef.text&&eg.markedSpans==ef.markedSpans&&ee.display.scroller.clientWidth==eg.width&&eg.classes==ef.textClass+"|"+ef.bgClass+"|"+ef.wrapClass){return eg}}}function dX(ee,ef){var eg=dp(ee,ef);if(eg){eg.text=eg.measure=eg.markedSpans=null}}function a4(ee,ef){var ej=dp(ee,ef);if(ej){return ej.measure}var ei=cb(ee,ef);var eh=ee.display.measureLineCache;var eg={text:ef.text,width:ee.display.scroller.clientWidth,markedSpans:ef.markedSpans,measure:ei,classes:ef.textClass+"|"+ef.bgClass+"|"+ef.wrapClass};if(eh.length==16){eh[++ee.display.measureLineCachePos%16]=eg}else{eh.push(eg)}return ei}function cb(eo,eq){var ez=eo.display,ek=S(eq.text.length);var ev=cw(eo,eq,ek);if(cs&&!by&&!eo.options.lineWrapping&&ev.childNodes.length>100){var eh=document.createDocumentFragment();var es=10,ew=ev.childNodes.length;for(var eB=0,et=Math.ceil(ew/es);eB<et;++eB){var ep=d4("div",null,null,"display: inline-block");for(var eA=0;eA<es&&ew;++eA){ep.appendChild(ev.firstChild);--ew}eh.appendChild(ep)}ev.appendChild(eh)}bc(ez.measure,ev);var eg=al(ez.lineDiv);var ef=[],eG=S(eq.text.length),eE=ev.offsetHeight;if(bx&&ez.measure.first!=ev){bc(ez.measure,ev)}function er(eJ,eL){if(eL>eE){eL=eE}if(eJ<0){eJ=0}for(var eH=0;eH<ef.length;eH+=2){var eI=ef[eH],eK=ef[eH+1];if(eI>eL||eK<eJ){continue}if(eI<=eJ&&eK>=eL||eJ<=eI&&eL>=eK||Math.min(eL,eK)-Math.max(eJ,eI)>=(eL-eJ)>>1){ef[eH]=Math.min(eJ,eI);ef[eH+1]=Math.max(eL,eK);return eH}}ef.push(eJ,eL);return eH}for(var eB=0,ej;eB<ek.length;++eB){if(ej=ek[eB]){var eu,ex=ej;if(/\bCodeMirror-widget\b/.test(ej.className)&&ej.getClientRects){if(ej.firstChild.nodeType==1){ex=ej.firstChild}var em=ex.getClientRects(),eC=em[0],ei=em[em.length-1];if(em.length>1){var eF=er(eC.top-eg.top,eC.bottom-eg.top);var en=er(ei.top-eg.top,ei.bottom-eg.top);eG[eB]={left:eC.left-eg.left,right:ei.right-eg.left,top:eF,topRight:en};continue}}eu=al(ex);var el=er(eu.top-eg.top,eu.bottom-eg.top);var eD=eu.right;if(ej.measureRight){eD=al(ej.measureRight).left}eG[eB]={left:eu.left-eg.left,right:eD-eg.left,top:el}}}for(var eB=0,ej;eB<eG.length;++eB){if(ej=eG[eB]){var ey=ej.top,ee=ej.topRight;ej.top=ef[ey];ej.bottom=ef[ey+1];if(ee!=null){ej.topRight=ef[ee];ej.bottomRight=ef[ee+1]}}}return eG}function c7(ee,eg){var el=false;if(eg.markedSpans){for(var eh=0;eh<eg.markedSpans;++eh){var ej=eg.markedSpans[eh];if(ej.collapsed&&(ej.to==null||ej.to==eg.text.length)){el=true}}}var ei=!el&&dp(ee,eg);if(ei){return cO(ee,eg,eg.text.length,ei.measure,"right").right}var ek=cw(ee,eg);var ef=ek.appendChild(aP(ee.display.measure));bc(ee.display.measure,ek);return al(ef).right-al(ee.display.lineDiv).left}function R(ee){ee.display.measureLineCache.length=ee.display.measureLineCachePos=0;ee.display.cachedCharWidth=ee.display.cachedTextHeight=null;if(!ee.options.lineWrapping){ee.display.maxLineChanged=true}ee.display.lineNumChars=null}function bG(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function bF(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function de(ek,eh,ej,ef){if(eh.widgets){for(var eg=0;eg<eh.widgets.length;++eg){if(eh.widgets[eg].above){var em=bZ(eh.widgets[eg]);ej.top+=em;ej.bottom+=em}}}if(ef=="line"){return ej}if(!ef){ef="local"}var ei=a7(ek,eh);if(ef=="local"){ei+=dq(ek.display)}else{ei-=ek.display.viewOffset}if(ef=="page"||ef=="window"){var ee=al(ek.display.lineSpace);ei+=ee.top+(ef=="window"?0:bF());var el=ee.left+(ef=="window"?0:bG());ej.left+=el;ej.right+=el}ej.top+=ei;ej.bottom+=ei;return ej}function eb(ef,ei,eg){if(eg=="div"){return ei}var ek=ei.left,ej=ei.top;if(eg=="page"){ek-=bG();ej-=bF()}else{if(eg=="local"||!eg){var eh=al(ef.display.sizer);ek+=eh.left;ej+=eh.top}}var ee=al(ef.display.lineSpace);return{left:ek-ee.left,top:ej-ee.top}}function bS(ee,ei,eh,eg,ef){if(!eg){eg=dv(ee.doc,ei.line)}return de(ee,eg,cO(ee,eg,ei.ch,null,ef),eh)}function cz(en,em,eg,el,ej){el=el||dv(en.doc,em.line);if(!ej){ej=a4(en,el)}function ei(er,eq){var ep=cO(en,el,er,ej,eq?"right":"left");if(eq){ep.left=ep.right}else{ep.right=ep.left}return de(en,el,ep,eg)}function eo(es,ep){var eq=ek[ep],er=eq.level%2;if(es==cn(eq)&&ep&&eq.level<ek[ep-1].level){eq=ek[--ep];es=ea(eq)-(eq.level%2?0:1);er=true}else{if(es==ea(eq)&&ep<ek.length-1&&eq.level<ek[ep+1].level){eq=ek[++ep];es=cn(eq)-eq.level%2;er=false}}if(er&&es==eq.to&&es>eq.from){return ei(es-1)}return ei(es,er)}var ek=a(el),ee=em.ch;if(!ek){return ei(ee)}var ef=ah(ek,ee);var eh=eo(ee,ef);if(dm!=null){eh.other=eo(ee,dm)}return eh}function d3(ee,ef,eg,ei){var eh=new I(ee,ef);eh.xRel=ei;if(eg){eh.outside=true}return eh}function dY(el,ei,eh){var ek=el.doc;eh+=el.display.viewOffset;if(eh<0){return d3(ek.first,0,true,-1)}var ef=a1(ek,eh),em=ek.first+ek.size-1;if(ef>em){return d3(ek.first+ek.size-1,dv(ek,em).text.length,true,1)}if(ei<0){ei=0}for(;;){var eg=dv(ek,ef);var en=b0(el,eg,ef,ei,eh);var ej=cW(eg);var ee=ej&&ej.find();if(ej&&(en.ch>ee.from.ch||en.ch==ee.from.ch&&en.xRel>0)){ef=ee.to.line}else{return en}}}function b0(eo,eg,er,eq,ep){var en=ep-a7(eo,eg);var ek=false,ex=2*eo.display.wrapper.clientWidth;var ew=a4(eo,eg);function eB(eD){var eE=cz(eo,I(er,eD),"line",eg,ew);ek=true;if(en>eE.bottom){return eE.left-ex}else{if(en<eE.top){return eE.left+ex}else{ek=false}}return eE.left}var et=a(eg),ev=eg.text.length;var ey=bN(eg),eh=bX(eg);var eu=eB(ey),ee=ek,ef=eB(eh),ej=ek;if(eq>ef){return d3(er,eh,ej,1)}for(;;){if(et?eh==ey||eh==q(eg,ey,1):eh-ey<=1){var es=eq<eu||eq-eu<=ef-eq?ey:eh;var eA=eq-(es==ey?eu:ef);while(dG.test(eg.text.charAt(es))){++es}var em=d3(er,es,es==ey?ee:ej,eA<0?-1:eA?1:0);return em}var el=Math.ceil(ev/2),eC=ey+el;if(et){eC=ey;for(var ez=0;ez<el;++ez){eC=q(eg,eC,1)}}var ei=eB(eC);if(ei>eq){eh=eC;ef=ei;if(ej=ek){ef+=1000}ev=el}else{ey=eC;eu=ei;ee=ek;ev-=el}}}var ai;function au(eg){if(eg.cachedTextHeight!=null){return eg.cachedTextHeight}if(ai==null){ai=d4("pre");for(var ef=0;ef<49;++ef){ai.appendChild(document.createTextNode("x"));ai.appendChild(d4("br"))}ai.appendChild(document.createTextNode("x"))}bc(eg.measure,ai);var ee=ai.offsetHeight/50;if(ee>3){eg.cachedTextHeight=ee}cC(eg.measure);return ee||1}function cq(eh){if(eh.cachedCharWidth!=null){return eh.cachedCharWidth}var ee=d4("span","x");var eg=d4("pre",[ee]);bc(eh.measure,eg);var ef=ee.offsetWidth;if(ef>2){eh.cachedCharWidth=ef}return ef||10}var cG=0;function bR(ee){ee.curOp={changes:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,cursorActivity:false,updateMaxLine:false,updateScrollPos:false,id:++cG};if(!bE++){aO=[]}}function U(eq){var el=eq.curOp,ep=eq.doc,em=eq.display;eq.curOp=null;if(el.updateMaxLine){d6(eq)}if(em.maxLineChanged&&!eq.options.lineWrapping&&em.maxLine){var ef=c7(eq,em.maxLine);em.sizer.style.minWidth=Math.max(0,ef+3+aJ)+"px";em.maxLineChanged=false;var en=Math.max(0,em.sizer.offsetLeft+em.sizer.offsetWidth-em.scroller.clientWidth);if(en<ep.scrollLeft&&!el.updateScrollPos){aZ(eq,Math.min(em.scroller.scrollLeft,en),true)}}var eg,ej;if(el.updateScrollPos){eg=el.updateScrollPos}else{if(el.selectionChanged&&em.scroller.clientHeight){var eo=cz(eq,ep.sel.head);eg=y(eq,eo.left,eo.top,eo.left,eo.bottom)}}if(el.changes.length||eg&&eg.scrollTop!=null){ej=ct(eq,el.changes,eg&&eg.scrollTop);if(eq.display.scroller.offsetHeight){eq.doc.scrollTop=eq.display.scroller.scrollTop}}if(!ej&&el.selectionChanged){aY(eq)}if(el.updateScrollPos){em.scroller.scrollTop=em.scrollbarV.scrollTop=ep.scrollTop=eg.scrollTop;em.scroller.scrollLeft=em.scrollbarH.scrollLeft=ep.scrollLeft=eg.scrollLeft;c6(eq);if(el.scrollToPos){v(eq,dU(eq.doc,el.scrollToPos),el.scrollToPosMargin)}}else{if(eg){ac(eq)}}if(el.selectionChanged){l(eq)}if(eq.state.focused&&el.updateInput){dF(eq,el.userSelChange)}var ek=el.maybeHiddenMarkers,ee=el.maybeUnhiddenMarkers;if(ek){for(var ei=0;ei<ek.length;++ei){if(!ek[ei].lines.length){af(ek[ei],"hide")}}}if(ee){for(var ei=0;ei<ee.length;++ei){if(ee[ei].lines.length){af(ee[ei],"unhide")}}}var eh;if(!--bE){eh=aO;aO=null}if(el.textChanged){af(eq,"change",eq,el.textChanged)}if(el.cursorActivity){af(eq,"cursorActivity",eq)}if(eh){for(var ei=0;ei<eh.length;++ei){eh[ei]()}}}function b2(ee,ef){return function(){var eh=ee||this,ei=!eh.curOp;if(ei){bR(eh)}try{var eg=ef.apply(eh,arguments)}finally{if(ei){U(eh)}}return eg}}function dO(ee){return function(){var eg=this.cm&&!this.cm.curOp,ef;if(eg){bR(this.cm)}try{ef=ee.apply(this,arguments)}finally{if(eg){U(this.cm)}}return ef}}function bU(ef,eh){var eg=!ef.curOp,ee;if(eg){bR(ef)}try{ee=eh()}finally{if(eg){U(ef)}}return ee}function O(ee,eh,eg,ef){if(eh==null){eh=ee.doc.first}if(eg==null){eg=ee.doc.first+ee.doc.size}ee.curOp.changes.push({from:eh,to:eg,diff:ef})}function aN(ee){if(ee.display.pollingFast){return}ee.display.poll.set(ee.options.pollInterval,function(){bu(ee);if(ee.state.focused){aN(ee)}})}function u(ee){var ef=false;ee.display.pollingFast=true;function eg(){var eh=bu(ee);if(!eh&&!ef){ef=true;ee.display.poll.set(60,eg)}else{ee.display.pollingFast=false;aN(ee)}}ee.display.poll.set(20,eg)}function bu(ep){var ek=ep.display.input,eh=ep.display.prevInput,eo=ep.doc,ee=eo.sel;if(!ep.state.focused||aT(ek)||Q(ep)||ep.state.disableInput){return false}var eq=ek.value;if(eq==eh&&dT(ee.from,ee.to)){return false}if(cs&&!bx&&ep.display.inputHasSelection===eq){dF(ep,true);return false}var eg=!ep.curOp;if(eg){bR(ep)}ee.shift=false;var ej=0,ef=Math.min(eh.length,eq.length);while(ej<ef&&eh.charCodeAt(ej)==eq.charCodeAt(ej)){++ej}var en=ee.from,em=ee.to;if(ej<eh.length){en=I(en.line,en.ch-(eh.length-ej))}else{if(ep.state.overwrite&&dT(en,em)&&!ep.state.pasteIncoming){em=I(em.line,Math.min(dv(eo,em.line).text.length,em.ch+(eq.length-ej)))}}var ei=ep.curOp.updateInput;var el={from:en,to:em,text:aw(eq.slice(ej)),origin:ep.state.pasteIncoming?"paste":"+input"};aG(ep.doc,el,"end");ep.curOp.updateInput=ei;M(ep,"inputRead",ep,el);if(eq.length>1000||eq.indexOf("\n")>-1){ek.value=ep.display.prevInput=""}else{ep.display.prevInput=eq}if(eg){U(ep)}ep.state.pasteIncoming=false;return true}function dF(ee,eg){var ef,eh,ej=ee.doc;if(!dT(ej.sel.from,ej.sel.to)){ee.display.prevInput="";ef=b8&&(ej.sel.to.line-ej.sel.from.line>100||(eh=ee.getSelection()).length>1000);var ei=ef?"-":eh||ee.getSelection();ee.display.input.value=ei;if(ee.state.focused){cu(ee.display.input)}if(cs&&!bx){ee.display.inputHasSelection=ei}}else{if(eg){ee.display.prevInput=ee.display.input.value="";if(cs&&!bx){ee.display.inputHasSelection=null}}}ee.display.inaccurateSelection=ef}function c2(ee){if(ee.options.readOnly!="nocursor"&&(!cN||document.activeElement!=ee.display.input)){ee.display.input.focus()}}function Q(ee){return ee.options.readOnly||ee.doc.cantEdit}function dZ(ef){var ek=ef.display;bf(ek.scroller,"mousedown",b2(ef,cV));if(cs){bf(ek.scroller,"dblclick",b2(ef,function(en){if(ap(ef,en)){return}var eo=bA(ef,en);if(!eo||k(ef,en)||aB(ef.display,en)){return}bO(en);var em=Z(dv(ef.doc,eo.line).text,eo);d1(ef.doc,em.from,em.to)}))}else{bf(ek.scroller,"dblclick",function(em){ap(ef,em)||bO(em)})}bf(ek.lineSpace,"selectstart",function(em){if(!aB(ek,em)){bO(em)}});if(!bQ){bf(ek.scroller,"contextmenu",function(em){ab(ef,em)})}bf(ek.scroller,"scroll",function(){if(ek.scroller.clientHeight){D(ef,ek.scroller.scrollTop);aZ(ef,ek.scroller.scrollLeft,true);af(ef,"scroll",ef)}});bf(ek.scrollbarV,"scroll",function(){if(ek.scroller.clientHeight){D(ef,ek.scrollbarV.scrollTop)}});bf(ek.scrollbarH,"scroll",function(){if(ek.scroller.clientHeight){aZ(ef,ek.scrollbarH.scrollLeft)}});bf(ek.scroller,"mousewheel",function(em){b(ef,em)});bf(ek.scroller,"DOMMouseScroll",function(em){b(ef,em)});function el(){if(ef.state.focused){setTimeout(bH(c2,ef),0)}}bf(ek.scrollbarH,"mousedown",el);bf(ek.scrollbarV,"mousedown",el);bf(ek.wrapper,"scroll",function(){ek.wrapper.scrollTop=ek.wrapper.scrollLeft=0});var ee;function ei(){if(ee==null){ee=setTimeout(function(){ee=null;ek.cachedCharWidth=ek.cachedTextHeight=cX=null;R(ef);bU(ef,bH(O,ef))},100)}}bf(window,"resize",ei);function eh(){for(var em=ek.wrapper.parentNode;em&&em!=document.body;em=em.parentNode){}if(em){setTimeout(eh,5000)}else{cL(window,"resize",ei)}}setTimeout(eh,5000);bf(ek.input,"keyup",b2(ef,function(em){if(ap(ef,em)||ef.options.onKeyEvent&&ef.options.onKeyEvent(ef,W(em))){return}if(em.keyCode==16){ef.doc.sel.shift=false}}));bf(ek.input,"input",bH(u,ef));bf(ek.input,"keydown",b2(ef,m));bf(ek.input,"keypress",b2(ef,bI));bf(ek.input,"focus",bH(bL,ef));bf(ek.input,"blur",bH(ar,ef));function eg(em){if(ap(ef,em)||ef.options.onDragEvent&&ef.options.onDragEvent(ef,W(em))){return}cT(em)}if(ef.options.dragDrop){bf(ek.scroller,"dragstart",function(em){G(ef,em)});bf(ek.scroller,"dragenter",eg);bf(ek.scroller,"dragover",eg);bf(ek.scroller,"drop",b2(ef,aI))}bf(ek.scroller,"paste",function(em){if(aB(ek,em)){return}c2(ef);u(ef)});bf(ek.input,"paste",function(){ef.state.pasteIncoming=true;u(ef)});function ej(){if(ek.inaccurateSelection){ek.prevInput="";ek.inaccurateSelection=false;ek.input.value=ef.getSelection();cu(ek.input)}}bf(ek.input,"cut",ej);bf(ek.input,"copy",ej);if(aC){bf(ek.sizer,"mouseup",function(){if(document.activeElement==ek.input){ek.input.blur()}c2(ef)})}}function aB(ef,ee){for(var eg=B(ee);eg!=ef.wrapper;eg=eg.parentNode){if(!eg||eg.ignoreEvents||eg.parentNode==ef.sizer&&eg!=ef.mover){return true}}}function bA(ef,ek,eh){var ej=ef.display;if(!eh){var ei=B(ek);if(ei==ej.scrollbarH||ei==ej.scrollbarH.firstChild||ei==ej.scrollbarV||ei==ej.scrollbarV.firstChild||ei==ej.scrollbarFiller||ei==ej.gutterFiller){return null}}var ee,el,eg=al(ej.lineSpace);try{ee=ek.clientX;el=ek.clientY}catch(ek){return null}return dY(ef,ee-eg.left,el-eg.top)}var cf,ca;function cV(ew){if(ap(this,ew)){return}var eh=this,er=eh.display,ey=eh.doc,ep=ey.sel;ep.shift=ew.shiftKey;if(aB(er,ew)){if(!b1){er.scroller.draggable=false;setTimeout(function(){er.scroller.draggable=true},100)}return}if(k(eh,ew)){return}var eg=bA(eh,ew);switch(dW(ew)){case 3:if(bQ){ab.call(eh,eh,ew)}return;case 2:if(eg){d1(eh.doc,eg)}setTimeout(bH(c2,eh),20);bO(ew);return}if(!eg){if(B(ew)==er.scroller){bO(ew)}return}if(!eh.state.focused){bL(eh)}var ee=+new Date,ef="single";if(ca&&ca.time>ee-400&&dT(ca.pos,eg)){ef="triple";bO(ew);setTimeout(bH(c2,eh),20);aL(eh,eg.line)}else{if(cf&&cf.time>ee-400&&dT(cf.pos,eg)){ef="double";ca={time:ee,pos:eg};bO(ew);var et=Z(dv(ey,eg.line).text,eg);d1(eh.doc,et.from,et.to)}else{cf={time:ee,pos:eg}}}var ei=eg;if(eh.options.dragDrop&&dc&&!Q(eh)&&!dT(ep.from,ep.to)&&!dw(eg,ep.from)&&!dw(ep.to,eg)&&ef=="single"){var es=b2(eh,function(ez){if(b1){er.scroller.draggable=false}eh.state.draggingText=false;cL(document,"mouseup",es);cL(er.scroller,"drop",es);if(Math.abs(ew.clientX-ez.clientX)+Math.abs(ew.clientY-ez.clientY)<10){bO(ez);d1(eh.doc,eg);c2(eh)}});if(b1){er.scroller.draggable=true}eh.state.draggingText=es;if(er.scroller.dragDrop){er.scroller.dragDrop()}bf(document,"mouseup",es);bf(er.scroller,"drop",es);return}bO(ew);if(ef=="single"){d1(eh.doc,dU(ey,eg))}var ex=ep.from,em=ep.to,eq=eg;function eu(eA){if(dT(eq,eA)){return}eq=eA;if(ef=="single"){d1(eh.doc,dU(ey,eg),eA);return}ex=dU(ey,ex);em=dU(ey,em);if(ef=="double"){var ez=Z(dv(ey,eA.line).text,eA);if(dw(eA,ex)){d1(eh.doc,ez.from,em)}else{d1(eh.doc,ex,ez.to)}}else{if(ef=="triple"){if(dw(eA,ex)){d1(eh.doc,em,dU(ey,I(eA.line,0)))}else{d1(eh.doc,ex,dU(ey,I(eA.line+1,0)))}}}}var en=al(er.wrapper);var ej=0;function ev(eB){var ez=++ej;var eD=bA(eh,eB,true);if(!eD){return}if(!dT(eD,ei)){if(!eh.state.focused){bL(eh)}ei=eD;eu(eD);var eC=bj(er,ey);if(eD.line>=eC.to||eD.line<eC.from){setTimeout(b2(eh,function(){if(ej==ez){ev(eB)}}),150)}}else{var eA=eB.clientY<en.top?-20:eB.clientY>en.bottom?20:0;if(eA){setTimeout(b2(eh,function(){if(ej!=ez){return}er.scroller.scrollTop+=eA;ev(eB)}),50)}}}function el(ez){ej=Infinity;bO(ez);c2(eh);cL(document,"mousemove",eo);cL(document,"mouseup",ek)}var eo=b2(eh,function(ez){if(!cs&&!dW(ez)){el(ez)}else{ev(ez)}});var ek=b2(eh,el);bf(document,"mousemove",eo);bf(document,"mouseup",ek)}function k(em,ek){var el=em.display;try{var ef=ek.clientX,ee=ek.clientY}catch(ek){return false}if(ef>=Math.floor(al(el.gutters).right)){return false}bO(ek);if(!dB(em,"gutterClick")){return true}var ej=al(el.lineDiv);if(ee>ej.bottom){return true}ee-=ej.top-el.viewOffset;for(var eh=0;eh<em.options.gutters.length;++eh){var ei=el.gutters.childNodes[eh];if(ei&&al(ei).right>=ef){var en=a1(em.doc,ee);var eg=em.options.gutters[eh];M(em,"gutterClick",em,en,eg,ek);break}}return true}var N=0;function aI(ek){var em=this;if(ap(em,ek)||aB(em.display,ek)||(em.options.onDragEvent&&em.options.onDragEvent(em,W(ek)))){return}bO(ek);if(cs){N=+new Date}var el=bA(em,ek,true),ee=ek.dataTransfer.files;if(!el||Q(em)){return}if(ee&&ee.length&&window.FileReader&&window.File){var eg=ee.length,eo=Array(eg),ef=0;var eh=function(er,eq){var ep=new FileReader;ep.onload=function(){eo[eq]=ep.result;if(++ef==eg){el=dU(em.doc,el);aG(em.doc,{from:el,to:el,text:aw(eo.join("\n")),origin:"paste"},"around")}};ep.readAsText(er)};for(var ei=0;ei<eg;++ei){eh(ee[ei],ei)}}else{if(em.state.draggingText&&!(dw(el,em.doc.sel.from)||dw(em.doc.sel.to,el))){em.state.draggingText(ek);setTimeout(bH(c2,em),20);return}try{var eo=ek.dataTransfer.getData("Text");if(eo){var en=em.doc.sel.from,ej=em.doc.sel.to;bd(em.doc,el,el);if(em.state.draggingText){ax(em.doc,"",en,ej,"paste")}em.replaceSelection(eo,null,"paste");c2(em);bL(em)}}catch(ek){}}}function G(ef,eh){if(cs&&(!ef.state.draggingText||+new Date-N<100)){cT(eh);return}if(ap(ef,eh)||aB(ef.display,eh)){return}var ee=ef.getSelection();eh.dataTransfer.setData("Text",ee);if(eh.dataTransfer.setDragImage&&!ae){var eg=d4("img",null,null,"position: fixed; left: 0; top: 0;");if(dM){eg.width=eg.height=1;ef.display.wrapper.appendChild(eg);eg._top=eg.offsetTop}eh.dataTransfer.setDragImage(eg,0,0);if(dM){eg.parentNode.removeChild(eg)}}}function D(ee,ef){if(Math.abs(ee.doc.scrollTop-ef)<2){return}ee.doc.scrollTop=ef;if(!bB){ct(ee,[],ef)}if(ee.display.scroller.scrollTop!=ef){ee.display.scroller.scrollTop=ef}if(ee.display.scrollbarV.scrollTop!=ef){ee.display.scrollbarV.scrollTop=ef}if(bB){ct(ee,[])}cM(ee,100)}function aZ(ee,eg,ef){if(ef?eg==ee.doc.scrollLeft:Math.abs(ee.doc.scrollLeft-eg)<2){return}eg=Math.min(eg,ee.display.scroller.scrollWidth-ee.display.scroller.clientWidth);ee.doc.scrollLeft=eg;c6(ee);if(ee.display.scroller.scrollLeft!=eg){ee.display.scroller.scrollLeft=eg}if(ee.display.scrollbarH.scrollLeft!=eg){ee.display.scrollbarH.scrollLeft=eg}}var dC=0,bt=null;if(cs){bt=-0.53}else{if(bB){bt=15}else{if(b9){bt=-0.7}else{if(ae){bt=-1/3}}}}function b(ek,ef){var en=ef.wheelDeltaX,em=ef.wheelDeltaY;if(en==null&&ef.detail&&ef.axis==ef.HORIZONTAL_AXIS){en=ef.detail}if(em==null&&ef.detail&&ef.axis==ef.VERTICAL_AXIS){em=ef.detail}else{if(em==null){em=ef.wheelDelta}}var eh=ek.display,ej=eh.scroller;if(!(en&&ej.scrollWidth>ej.clientWidth||em&&ej.scrollHeight>ej.clientHeight)){return}if(em&&bk&&b1){for(var el=ef.target;el!=ej;el=el.parentNode){if(el.lineObj){ek.display.currentWheelTarget=el;break}}}if(en&&!bB&&!dM&&bt!=null){if(em){D(ek,Math.max(0,Math.min(ej.scrollTop+em*bt,ej.scrollHeight-ej.clientHeight)))}aZ(ek,Math.max(0,Math.min(ej.scrollLeft+en*bt,ej.scrollWidth-ej.clientWidth)));bO(ef);eh.wheelStartX=null;return}if(em&&bt!=null){var ee=em*bt;var ei=ek.doc.scrollTop,eg=ei+eh.wrapper.clientHeight;if(ee<0){ei=Math.max(0,ei+ee-50)}else{eg=Math.min(ek.doc.height,eg+ee+50)}ct(ek,[],{top:ei,bottom:eg})}if(dC<20){if(eh.wheelStartX==null){eh.wheelStartX=ej.scrollLeft;eh.wheelStartY=ej.scrollTop;eh.wheelDX=en;eh.wheelDY=em;setTimeout(function(){if(eh.wheelStartX==null){return}var eo=ej.scrollLeft-eh.wheelStartX;var eq=ej.scrollTop-eh.wheelStartY;var ep=(eq&&eh.wheelDY&&eq/eh.wheelDY)||(eo&&eh.wheelDX&&eo/eh.wheelDX);eh.wheelStartX=eh.wheelStartY=null;if(!ep){return}bt=(bt*dC+ep)/(dC+1);++dC},200)}else{eh.wheelDX+=en;eh.wheelDY+=em}}}function d0(ef,ei,ee){if(typeof ei=="string"){ei=c4[ei];if(!ei){return false}}if(ef.display.pollingFast&&bu(ef)){ef.display.pollingFast=false}var ej=ef.doc,eh=ej.sel.shift,eg=false;try{if(Q(ef)){ef.state.suppressEdits=true}if(ee){ej.sel.shift=false}eg=ei(ef)!=bp}finally{ej.sel.shift=eh;ef.state.suppressEdits=false}return eg}function cj(ee){var ef=ee.state.keyMaps.slice(0);if(ee.options.extraKeys){ef.push(ee.options.extraKeys)}ef.push(ee.options.keyMap);return ef}var X;function dz(ee,ek){var ef=d2(ee.options.keyMap),ei=ef.auto;clearTimeout(X);if(ei&&!c3(ek)){X=setTimeout(function(){if(d2(ee.options.keyMap)==ef){ee.options.keyMap=(ei.call?ei.call(null,ee):ei);ec(ee)}},50)}var eh=dH(ek,true),ej=false;if(!eh){return false}var eg=cj(ee);if(ek.shiftKey){ej=g("Shift-"+eh,eg,function(el){return d0(ee,el,true)})||g(eh,eg,function(el){if(typeof el=="string"?/^go[A-Z]/.test(el):el.motion){return d0(ee,el)}})}else{ej=g(eh,eg,function(el){return d0(ee,el)})}if(ej){bO(ek);l(ee);if(bx){ek.oldKeyCode=ek.keyCode;ek.keyCode=0}M(ee,"keyHandled",ee,eh,ek)}return ej}function cP(ee,eh,ef){var eg=g("'"+ef+"'",cj(ee),function(ei){return d0(ee,ei,true)});if(eg){bO(eh);l(ee);M(ee,"keyHandled",ee,"'"+ef+"'",eh)}return eg}var ce=null;function m(eh){var ee=this;if(!ee.state.focused){bL(ee)}if(cs&&eh.keyCode==27){eh.returnValue=false}if(ap(ee,eh)||ee.options.onKeyEvent&&ee.options.onKeyEvent(ee,W(eh))){return}var ef=eh.keyCode;ee.doc.sel.shift=ef==16||eh.shiftKey;var eg=dz(ee,eh);if(dM){ce=eg?ef:null;if(!eg&&ef==88&&!b8&&(bk?eh.metaKey:eh.ctrlKey)){ee.replaceSelection("")}}}function bI(ei){var ee=this;if(ap(ee,ei)||ee.options.onKeyEvent&&ee.options.onKeyEvent(ee,W(ei))){return}var eh=ei.keyCode,ef=ei.charCode;if(dM&&eh==ce){ce=null;bO(ei);return}if(((dM&&(!ei.which||ei.which<10))||aC)&&dz(ee,ei)){return}var eg=String.fromCharCode(ef==null?eh:ef);if(this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Q(this)&&this.doc.mode.electricChars.indexOf(eg)>-1){setTimeout(b2(ee,function(){L(ee,ee.doc.sel.to.line,"smart")}),75)}if(cP(ee,ei,eg)){return}if(cs&&!bx){ee.display.inputHasSelection=null}u(ee)}function bL(ee){if(ee.options.readOnly=="nocursor"){return}if(!ee.state.focused){af(ee,"focus",ee);ee.state.focused=true;if(ee.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1){ee.display.wrapper.className+=" CodeMirror-focused"}dF(ee,true)}aN(ee);l(ee)}function ar(ee){if(ee.state.focused){af(ee,"blur",ee);ee.state.focused=false;ee.display.wrapper.className=ee.display.wrapper.className.replace(" CodeMirror-focused","")}clearInterval(ee.display.blinker);setTimeout(function(){if(!ee.state.focused){ee.doc.sel.shift=false}},150)}var dQ;function ab(en,ei){var ek=en.display,ef=en.doc.sel;if(aB(ek,ei)){return}var em=bA(en,ei),ee=ek.scroller.scrollTop;if(!em||dM){return}if(dT(ef.from,ef.to)||dw(em,ef.from)||!dw(em,ef.to)){b2(en,bd)(en.doc,em,em)}var ej=ek.input.style.cssText;ek.inputDiv.style.position="absolute";ek.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(ei.clientY-5)+"px; left: "+(ei.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";c2(en);dF(en,true);if(dT(ef.from,ef.to)){ek.input.value=ek.prevInput=" "}function eh(){if(ek.input.selectionStart!=null){var eo=ek.input.value=" "+(dT(ef.from,ef.to)?"":ek.input.value);ek.prevInput=" ";ek.input.selectionStart=1;ek.input.selectionEnd=eo.length}}function el(){ek.inputDiv.style.position="relative";ek.input.style.cssText=ej;if(bx){ek.scrollbarV.scrollTop=ek.scroller.scrollTop=ee}aN(en);if(ek.input.selectionStart!=null){if(!cs||bx){eh()}clearTimeout(dQ);var eo=0,ep=function(){if(ek.prevInput==" "&&ek.input.selectionStart==0){b2(en,c4.selectAll)(en)}else{if(eo++<10){dQ=setTimeout(ep,500)}else{dF(en)}}};dQ=setTimeout(ep,200)}}if(cs&&!bx){eh()}if(bQ){cT(ei);var eg=function(){cL(window,"mouseup",eg);setTimeout(el,20)};bf(window,"mouseup",eg)}else{setTimeout(el,50)}}var bY=z.changeEnd=function(ee){if(!ee.text){return ee.to}return I(ee.from.line+ee.text.length-1,dS(ee.text).length+(ee.text.length==1?ee.from.ch:0))};function c5(ei,ek,ej){if(!dw(ek.from,ej)){return dU(ei,ej)}var eh=(ek.text.length-1)-(ek.to.line-ek.from.line);if(ej.line>ek.to.line+eh){var eg=ej.line-eh,ef=ei.first+ei.size-1;if(eg>ef){return I(ef,dv(ei,ef).text.length)}return dI(ej,dv(ei,eg).text.length)}if(ej.line==ek.to.line+eh){return dI(ej,dS(ek.text).length+(ek.text.length==1?ek.from.ch:0)+dv(ei,ek.to.line).text.length-ek.to.ch)}var ee=ej.line-ek.from.line;return dI(ej,ek.text[ee].length+(ee?0:ek.from.ch))}function dA(ef,ei,eg){if(eg&&typeof eg=="object"){return{anchor:c5(ef,ei,eg.anchor),head:c5(ef,ei,eg.head)}}if(eg=="start"){return{anchor:ei.from,head:ei.from}}var ee=bY(ei);if(eg=="around"){return{anchor:ei.from,head:ee}}if(eg=="end"){return{anchor:ee,head:ee}}var eh=function(el){if(dw(el,ei.from)){return el}if(!dw(ei.to,el)){return ee}var ej=el.line+ei.text.length-(ei.to.line-ei.from.line)-1,ek=el.ch;if(el.line==ei.to.line){ek+=ee.ch-ei.to.ch}return I(ej,ek)};return{anchor:eh(ef.sel.anchor),head:eh(ef.sel.head)}}function cy(ef,eh,eg){var ee={canceled:false,from:eh.from,to:eh.to,text:eh.text,origin:eh.origin,cancel:function(){this.canceled=true}};if(eg){ee.update=function(el,ek,ej,ei){if(el){this.from=dU(ef,el)}if(ek){this.to=dU(ef,ek)}if(ej){this.text=ej}if(ei!==undefined){this.origin=ei}}}af(ef,"beforeChange",ef,ee);if(ef.cm){af(ef.cm,"beforeChange",ef.cm,ee)}if(ee.canceled){return null}return{from:ee.from,to:ee.to,text:ee.text,origin:ee.origin}}function aG(eh,ej,ei,eg){if(eh.cm){if(!eh.cm.curOp){return b2(eh.cm,aG)(eh,ej,ei,eg)}if(eh.cm.state.suppressEdits){return}}if(dB(eh,"beforeChange")||eh.cm&&dB(eh.cm,"beforeChange")){ej=cy(eh,ej,true);if(!ej){return}}var ef=d9&&!eg&&bP(eh,ej.from,ej.to);if(ef){for(var ee=ef.length-1;ee>=1;--ee){an(eh,{from:ef[ee].from,to:ef[ee].to,text:[""]})}if(ef.length){an(eh,{from:ef[0].from,to:ef[0].to,text:ej.text},ei)}}else{an(eh,ej,ei)}}function an(eg,ei,eh){var ef=dA(eg,ei,eh);c9(eg,ei,ef,eg.cm?eg.cm.curOp.id:NaN);cK(eg,ei,ef,cQ(eg,ei));var ee=[];cF(eg,function(ek,ej){if(!ej&&cd(ee,ek.history)==-1){cr(ek.history,ei);ee.push(ek.history)}cK(ek,ei,null,cQ(ek,ei))})}function bm(en,ek){if(en.cm&&en.cm.state.suppressEdits){return}var ej=en.history;var ef=(ek=="undo"?ej.done:ej.undone).pop();if(!ef){return}var el={changes:[],anchorBefore:ef.anchorAfter,headBefore:ef.headAfter,anchorAfter:ef.anchorBefore,headAfter:ef.headBefore,generation:ej.generation};(ek=="undo"?ej.undone:ej.done).push(el);ej.generation=ef.generation||++ej.maxGeneration;var eg=dB(en,"beforeChange")||en.cm&&dB(en.cm,"beforeChange");for(var eh=ef.changes.length-1;eh>=0;--eh){var em=ef.changes[eh];em.origin=ek;if(eg&&!cy(en,em,false)){(ek=="undo"?ej.done:ej.undone).length=0;return}el.changes.push(ck(en,em));var ee=eh?dA(en,em,null):{anchor:ef.anchorBefore,head:ef.headBefore};cK(en,em,ee,cH(en,em));var ei=[];cF(en,function(ep,eo){if(!eo&&cd(ei,ep.history)==-1){cr(ep.history,em);ei.push(ep.history)}cK(ep,em,null,cH(ep,em))})}}function dD(ee,eg){function ef(eh){return I(eh.line+eg,eh.ch)}ee.first+=eg;if(ee.cm){O(ee.cm,ee.first,ee.first,eg)}ee.sel.head=ef(ee.sel.head);ee.sel.anchor=ef(ee.sel.anchor);ee.sel.from=ef(ee.sel.from);ee.sel.to=ef(ee.sel.to)}function cK(ei,ej,eh,ef){if(ei.cm&&!ei.cm.curOp){return b2(ei.cm,cK)(ei,ej,eh,ef)}if(ej.to.line<ei.first){dD(ei,ej.text.length-1-(ej.to.line-ej.from.line));return}if(ej.from.line>ei.lastLine()){return}if(ej.from.line<ei.first){var ee=ej.text.length-1-(ei.first-ej.from.line);dD(ei,ee);ej={from:I(ei.first,0),to:I(ej.to.line+ee,ej.to.ch),text:[dS(ej.text)],origin:ej.origin}}var eg=ei.lastLine();if(ej.to.line>eg){ej={from:ej.from,to:I(eg,dv(ei,eg).text.length),text:[ej.text[0]],origin:ej.origin}}ej.removed=d5(ei,ej.from,ej.to);if(!eh){eh=dA(ei,ej,null)}if(ei.cm){aj(ei.cm,ej,ef,eh)}else{dN(ei,ej,ef,eh)}}function aj(eo,ek,eh,ee){var en=eo.doc,ej=eo.display,el=ek.from,em=ek.to;var ef=false,eg=el.line;if(!eo.options.lineWrapping){eg=a8(t(en,dv(en,el.line)));en.iter(eg,em.line+1,function(er){if(er==ej.maxLine){ef=true;return true}})}if(!dw(en.sel.head,ek.from)&&!dw(ek.to,en.sel.head)){eo.curOp.cursorActivity=true}dN(en,ek,eh,ee,aE(eo));if(!eo.options.lineWrapping){en.iter(eg,el.line+ek.text.length,function(es){var er=cR(en,es);if(er>ej.maxLineLength){ej.maxLine=es;ej.maxLineLength=er;ej.maxLineChanged=true;ef=false}});if(ef){eo.curOp.updateMaxLine=true}}en.frontier=Math.min(en.frontier,el.line);cM(eo,400);var eq=ek.text.length-(em.line-el.line)-1;O(eo,el.line,em.line+1,eq);if(dB(eo,"change")){var ei={from:el,to:em,text:ek.text,removed:ek.removed,origin:ek.origin};if(eo.curOp.textChanged){for(var ep=eo.curOp.textChanged;ep.next;ep=ep.next){}ep.next=ei}else{eo.curOp.textChanged=ei}}}function ax(eh,eg,ej,ei,ee){if(!ei){ei=ej}if(dw(ei,ej)){var ef=ei;ei=ej;ej=ef}if(typeof eg=="string"){eg=aw(eg)}aG(eh,{from:ej,to:ei,text:eg,origin:ee},null)}function I(ee,ef){if(!(this instanceof I)){return new I(ee,ef)}this.line=ee;this.ch=ef}z.Pos=I;function dT(ef,ee){return ef.line==ee.line&&ef.ch==ee.ch}function dw(ef,ee){return ef.line<ee.line||(ef.line==ee.line&&ef.ch<ee.ch)}function bv(ee){return I(ee.line,ee.ch)}function b4(ee,ef){return Math.max(ee.first,Math.min(ef,ee.first+ee.size-1))}function dU(ef,eg){if(eg.line<ef.first){return I(ef.first,0)}var ee=ef.first+ef.size-1;if(eg.line>ee){return I(ee,dv(ef,ee).text.length)}return dI(eg,dv(ef,eg.line).text.length)}function dI(eg,ef){var ee=eg.ch;if(ee==null||ee>ef){return I(eg.line,ef)}else{if(ee<0){return I(eg.line,0)}else{return eg}}}function bn(ef,ee){return ee>=ef.first&&ee<ef.first+ef.size}function d1(ei,ej,ee,ef){if(ei.sel.shift||ei.sel.extend){var eh=ei.sel.anchor;if(ee){var eg=dw(ej,eh);if(eg!=dw(ee,eh)){eh=ej;ej=ee}else{if(eg!=dw(ej,ee)){ej=ee}}}bd(ei,eh,ej,ef)}else{bd(ei,ej,ee||ej,ef)}if(ei.cm){ei.cm.curOp.userSelChange=true}}function c(eh,ee,ef){var eg={anchor:ee,head:ef};af(eh,"beforeSelectionChange",eh,eg);if(eh.cm){af(eh.cm,"beforeSelectionChange",eh.cm,eg)}eg.anchor=dU(eh,eg.anchor);eg.head=dU(eh,eg.head);return eg}function bd(el,ei,ej,eg,ef){if(!ef&&dB(el,"beforeSelectionChange")||el.cm&&dB(el.cm,"beforeSelectionChange")){var eh=c(el,ei,ej);ej=eh.head;ei=eh.anchor}var ek=el.sel;ek.goalColumn=null;if(ef||!dT(ei,ek.anchor)){ei=be(el,ei,eg,ef!="push")}if(ef||!dT(ej,ek.head)){ej=be(el,ej,eg,ef!="push")}if(dT(ek.anchor,ei)&&dT(ek.head,ej)){return}ek.anchor=ei;ek.head=ej;var ee=dw(ej,ei);ek.from=ee?ej:ei;ek.to=ee?ei:ej;if(el.cm){el.cm.curOp.updateInput=el.cm.curOp.selectionChanged=el.cm.curOp.cursorActivity=true}M(el,"cursorActivity",el)}function cY(ee){bd(ee.doc,ee.doc.sel.from,ee.doc.sel.to,null,"push")}function be(en,em,ej,ek){var eo=false,eg=em;var eh=ej||1;en.cantEdit=false;search:for(;;){var ep=dv(en,eg.line);if(ep.markedSpans){for(var ei=0;ei<ep.markedSpans.length;++ei){var ee=ep.markedSpans[ei],ef=ee.marker;if((ee.from==null||(ef.inclusiveLeft?ee.from<=eg.ch:ee.from<eg.ch))&&(ee.to==null||(ef.inclusiveRight?ee.to>=eg.ch:ee.to>eg.ch))){if(ek){af(ef,"beforeCursorEnter");if(ef.explicitlyCleared){if(!ep.markedSpans){break}else{--ei;continue}}}if(!ef.atomic){continue}var el=ef.find()[eh<0?"from":"to"];if(dT(el,eg)){el.ch+=eh;if(el.ch<0){if(el.line>en.first){el=dU(en,I(el.line-1))}else{el=null}}else{if(el.ch>ep.text.length){if(el.line<en.first+en.size-1){el=I(el.line+1,0)}else{el=null}}}if(!el){if(eo){if(!ek){return be(en,em,ej,true)}en.cantEdit=true;return I(en.first,0)}eo=true;el=em;eh=-eh}}eg=el;continue search}}}return eg}}function ac(ef){var ei=v(ef,ef.doc.sel.head,ef.options.cursorScrollMargin);if(!ef.state.focused){return}var ej=ef.display,eg=al(ej.sizer),ee=null;if(ei.top+eg.top<0){ee=true}else{if(ei.bottom+eg.top>(window.innerHeight||document.documentElement.clientHeight)){ee=false}}if(ee!=null&&!dJ){var eh=ej.cursor.style.display=="none";if(eh){ej.cursor.style.display="";ej.cursor.style.left=ei.left+"px";ej.cursor.style.top=(ei.top-ej.viewOffset)+"px"}ej.cursor.scrollIntoView(ee);if(eh){ej.cursor.style.display="none"}}}function v(ee,el,ei){if(ei==null){ei=0}for(;;){var ej=false,eh=cz(ee,el);var ek=y(ee,eh.left,eh.top-ei,eh.left,eh.bottom+ei);var ef=ee.doc.scrollTop,eg=ee.doc.scrollLeft;if(ek.scrollTop!=null){D(ee,ek.scrollTop);if(Math.abs(ee.doc.scrollTop-ef)>1){ej=true}}if(ek.scrollLeft!=null){aZ(ee,ek.scrollLeft);if(Math.abs(ee.doc.scrollLeft-eg)>1){ej=true}}if(!ej){return eh}}}function x(ee,eg,ei,ef,eh){var ej=y(ee,eg,ei,ef,eh);if(ej.scrollTop!=null){D(ee,ej.scrollTop)}if(ej.scrollLeft!=null){aZ(ee,ej.scrollLeft)}}function y(ek,es,eh,er,eg){var ep=ek.display,eo=au(ek.display);if(eh<0){eh=0}var ef=ep.scroller.clientHeight-aJ,en=ep.scroller.scrollTop,em={};var eu=ek.doc.height+a3(ep);var ev=eh<eo,eq=eg>eu-eo;if(eh<en){em.scrollTop=ev?0:eh}else{if(eg>en+ef){var el=Math.min(eh,(eq?eu:eg)-ef);if(el!=en){em.scrollTop=el}}}var ej=ep.scroller.clientWidth-aJ,ee=ep.scroller.scrollLeft;es+=ep.gutters.offsetWidth;er+=ep.gutters.offsetWidth;var ei=ep.gutters.offsetWidth;var et=es<ei+10;if(es<ee+ei||et){if(et){es=0}em.scrollLeft=Math.max(0,es-10-ei)}else{if(er>ej+ee-3){em.scrollLeft=er+10-ej}}return em}function w(ee,eg,ef){ee.curOp.updateScrollPos={scrollLeft:eg==null?ee.doc.scrollLeft:eg,scrollTop:ef==null?ee.doc.scrollTop:ef}}function bT(ef,eh,eg){var ei=ef.curOp.updateScrollPos||(ef.curOp.updateScrollPos={scrollLeft:ef.doc.scrollLeft,scrollTop:ef.doc.scrollTop});var ee=ef.display.scroller;ei.scrollTop=Math.max(0,Math.min(ee.scrollHeight-ee.clientHeight,ei.scrollTop+eg));ei.scrollLeft=Math.max(0,Math.min(ee.scrollWidth-ee.clientWidth,ei.scrollLeft+eh))}function L(eq,eh,ep,eg){var eo=eq.doc;if(ep==null){ep="add"}if(ep=="smart"){if(!eq.doc.mode.indent){ep="prev"}else{var ef=co(eq,eh)}}var ek=eq.options.tabSize;var er=dv(eo,eh),ej=bb(er.text,null,ek);var ee=er.text.match(/^\s*/)[0],em;if(ep=="smart"){em=eq.doc.mode.indent(ef,er.text.slice(ee.length),er.text);if(em==bp){if(!eg){return}ep="prev"}}if(ep=="prev"){if(eh>eo.first){em=bb(dv(eo,eh-1).text,null,ek)}else{em=0}}else{if(ep=="add"){em=ej+eq.options.indentUnit}else{if(ep=="subtract"){em=ej-eq.options.indentUnit}else{if(typeof ep=="number"){em=ej+ep}}}}em=Math.max(0,em);var en="",el=0;if(eq.options.indentWithTabs){for(var ei=Math.floor(em/ek);ei;--ei){el+=ek;en+="\t"}}if(el<em){en+=bC(em-el)}if(en!=ee){ax(eq.doc,en,I(eh,0),I(eh,ee.length),"+input")}er.stateAfter=null}function c0(ee,eg,ej){var ei=eg,ef=eg,eh=ee.doc;if(typeof eg=="number"){ef=dv(eh,b4(eh,eg))}else{ei=a8(eg)}if(ei==null){return null}if(ej(ef,ei)){O(ee,ei,ei+1)}else{return null}return ef}function aV(ev,eh,ep,eo,ej){var em=eh.line,en=eh.ch,eu=ep;var ee=dv(ev,em);var es=true;function et(){var ew=em+ep;if(ew<ev.first||ew>=ev.first+ev.size){return(es=false)}em=ew;return ee=dv(ev,ew)}function er(ex){var ew=(ej?q:P)(ee,en,ep,true);if(ew==null){if(!ex&&et()){if(ej){en=(ep<0?bX:bN)(ee)}else{en=ep<0?ee.text.length:0}}else{return(es=false)}}else{en=ew}return true}if(eo=="char"){er()}else{if(eo=="column"){er(true)}else{if(eo=="word"||eo=="group"){var eq=null,ek=eo=="group";for(var ei=true;;ei=false){if(ep<0&&!er(!ei)){break}var ef=ee.text.charAt(en)||"\n";var eg=bK(ef)?"w":!ek?null:/\s/.test(ef)?null:"p";if(eq&&eq!=eg){if(ep<0){ep=1;er()}break}if(eg){eq=eg}if(ep>0&&!er(!ei)){break}}}}}var el=be(ev,I(em,en),eu,true);if(!es){el.hitSide=true}return el}function aR(em,eh,ee,el){var ek=em.doc,ej=eh.left,ei;if(el=="page"){var eg=Math.min(em.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);ei=eh.top+ee*(eg-(ee<0?1.5:0.5)*au(em.display))}else{if(el=="line"){ei=ee>0?eh.bottom+3:eh.top-3}}for(;;){var ef=dY(em,ej,ei);if(!ef.outside){break}if(ee<0?ei<=0:ei>=ek.height){ef.hitSide=true;break}ei+=ee*5}return ef}function Z(eh,ej){var ei=ej.ch,eg=ej.ch;if(eh){if(ej.xRel<0||eg==eh.length){--ei}else{++eg}var ef=eh.charAt(ei);var ee=bK(ef)?bK:/\s/.test(ef)?function(ek){return/\s/.test(ek)}:function(ek){return !/\s/.test(ek)&&!bK(ek)};while(ei>0&&ee(eh.charAt(ei-1))){--ei}while(eg<eh.length&&ee(eh.charAt(eg))){++eg}}return{from:I(ej.line,ei),to:I(ej.line,eg)}}function aL(ee,ef){d1(ee.doc,I(ef,0),dU(ee.doc,I(ef+1,0)))}z.prototype={constructor:z,focus:function(){window.focus();c2(this);bL(this);u(this)},setOption:function(eg,eh){var ef=this.options,ee=ef[eg];if(ef[eg]==eh&&eg!="mode"){return}ef[eg]=eh;if(aF.hasOwnProperty(eg)){b2(this,aF[eg])(this,eh,ee)}},getOption:function(ee){return this.options[ee]},getDoc:function(){return this.doc},addKeyMap:function(ef,ee){this.state.keyMaps[ee?"push":"unshift"](ef)},removeKeyMap:function(ef){var eg=this.state.keyMaps;for(var ee=0;ee<eg.length;++ee){if((typeof ef=="string"?eg[ee].name:eg[ee])==ef){eg.splice(ee,1);return true}}},addOverlay:b2(null,function(ee,ef){var eg=ee.token?ee:z.getMode(this.options,ee);if(eg.startState){throw new Error("Overlays may not be stateful.")}this.state.overlays.push({mode:eg,modeSpec:ee,opaque:ef&&ef.opaque});this.state.modeGen++;O(this)}),removeOverlay:b2(null,function(ee){var eg=this.state.overlays;for(var ef=0;ef<eg.length;++ef){var eh=eg[ef].modeSpec;if(eh==ee||typeof ee=="string"&&eh.name==ee){eg.splice(ef,1);this.state.modeGen++;O(this);return}}}),indentLine:b2(null,function(eg,ee,ef){if(typeof ee!="string"&&typeof ee!="number"){if(ee==null){ee=this.options.smartIndent?"smart":"prev"}else{ee=ee?"add":"subtract"}}if(bn(this.doc,eg)){L(this,eg,ee,ef)}}),indentSelection:b2(null,function(ef){var eg=this.doc.sel;if(dT(eg.from,eg.to)){return L(this,eg.from.line,ef)}var eh=eg.to.line-(eg.to.ch?0:1);for(var ee=eg.from.line;ee<=eh;++ee){L(this,ee,ef)}}),getTokenAt:function(el,ef){var ei=this.doc;el=dU(ei,el);var eh=co(this,el.line,ef),ek=this.doc.mode;var ee=dv(ei,el.line);var ej=new dg(ee.text,this.options.tabSize);while(ej.pos<el.ch&&!ej.eol()){ej.start=ej.pos;var eg=ek.token(ej,eh)}return{start:ej.start,end:ej.pos,string:ej.current(),className:eg||null,type:eg||null,state:eh}},getTokenTypeAt:function(ej){ej=dU(this.doc,ej);var eg=b7(this,dv(this.doc,ej.line));var eh=0,ei=(eg.length-1)/2,ef=ej.ch;for(;;){var ee=(eh+ei)>>1;if((ee?eg[ee*2-1]:0)>=ef){ei=ee}else{if(eg[ee*2+1]<ef){eh=ee+1}else{return eg[ee*2+2]}}}},getStateAfter:function(ef,ee){var eg=this.doc;ef=b4(eg,ef==null?eg.first+eg.size-1:ef);return co(this,ef+1,ee)},cursorCoords:function(eh,ef){var eg,ee=this.doc.sel;if(eh==null){eg=ee.head}else{if(typeof eh=="object"){eg=dU(this.doc,eh)}else{eg=eh?ee.from:ee.to}}return cz(this,eg,ef||"page")},charCoords:function(ef,ee){return bS(this,dU(this.doc,ef),ee||"page")},coordsChar:function(ee,ef){ee=eb(this,ee,ef||"page");return dY(this,ee.left,ee.top)},lineAtHeight:function(ee,ef){ee=eb(this,{top:ee,left:0},ef||"page").top;return a1(this.doc,ee+this.display.viewOffset)},heightAtLine:function(ef,ei){var ee=false,eh=this.doc.first+this.doc.size-1;if(ef<this.doc.first){ef=this.doc.first}else{if(ef>eh){ef=eh;ee=true}}var eg=dv(this.doc,ef);return de(this,dv(this.doc,ef),{top:0,left:0},ei||"page").top+(ee?eg.height:0)},defaultTextHeight:function(){return au(this.display)},defaultCharWidth:function(){return cq(this.display)},setGutterMarker:b2(null,function(ee,ef,eg){return c0(this,ee,function(eh){var ei=eh.gutterMarkers||(eh.gutterMarkers={});ei[ef]=eg;if(!eg&&dh(ei)){eh.gutterMarkers=null}return true})}),clearGutter:b2(null,function(eg){var ee=this,eh=ee.doc,ef=eh.first;eh.iter(function(ei){if(ei.gutterMarkers&&ei.gutterMarkers[eg]){ei.gutterMarkers[eg]=null;O(ee,ef,ef+1);if(dh(ei.gutterMarkers)){ei.gutterMarkers=null}}++ef})}),addLineClass:b2(null,function(eg,ef,ee){return c0(this,eg,function(eh){var ei=ef=="text"?"textClass":ef=="background"?"bgClass":"wrapClass";if(!eh[ei]){eh[ei]=ee}else{if(new RegExp("(?:^|\\s)"+ee+"(?:$|\\s)").test(eh[ei])){return false}else{eh[ei]+=" "+ee}}return true})}),removeLineClass:b2(null,function(eg,ef,ee){return c0(this,eg,function(ei){var el=ef=="text"?"textClass":ef=="background"?"bgClass":"wrapClass";var ek=ei[el];if(!ek){return false}else{if(ee==null){ei[el]=null}else{var ej=ek.match(new RegExp("(?:^|\\s+)"+ee+"(?:$|\\s+)"));if(!ej){return false}var eh=ej.index+ej[0].length;ei[el]=ek.slice(0,ej.index)+(!ej.index||eh==ek.length?"":" ")+ek.slice(eh)||null}}return true})}),addLineWidget:b2(null,function(eg,ef,ee){return a2(this,eg,ef,ee)}),removeLineWidget:function(ee){ee.clear()},lineInfo:function(ee){if(typeof ee=="number"){if(!bn(this.doc,ee)){return null}var ef=ee;ee=dv(this.doc,ee);if(!ee){return null}}else{var ef=a8(ee);if(ef==null){return null}}return{line:ef,handle:ee,text:ee.text,gutterMarkers:ee.gutterMarkers,textClass:ee.textClass,bgClass:ee.bgClass,wrapClass:ee.wrapClass,widgets:ee.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(ej,eg,el,eh,en){var ei=this.display;ej=cz(this,dU(this.doc,ej));var ek=ej.bottom,ef=ej.left;eg.style.position="absolute";ei.sizer.appendChild(eg);if(eh=="over"){ek=ej.top}else{if(eh=="above"||eh=="near"){var ee=Math.max(ei.wrapper.clientHeight,this.doc.height),em=Math.max(ei.sizer.clientWidth,ei.lineSpace.clientWidth);if((eh=="above"||ej.bottom+eg.offsetHeight>ee)&&ej.top>eg.offsetHeight){ek=ej.top-eg.offsetHeight}else{if(ej.bottom+eg.offsetHeight<=ee){ek=ej.bottom}}if(ef+eg.offsetWidth>em){ef=em-eg.offsetWidth}}}eg.style.top=ek+"px";eg.style.left=eg.style.right="";if(en=="right"){ef=ei.sizer.clientWidth-eg.offsetWidth;eg.style.right="0px"}else{if(en=="left"){ef=0}else{if(en=="middle"){ef=(ei.sizer.clientWidth-eg.offsetWidth)/2}}eg.style.left=ef+"px"}if(el){x(this,ef,ek,ef+eg.offsetWidth,ek+eg.offsetHeight)}},triggerOnKeyDown:b2(null,m),execCommand:function(ee){return c4[ee](this)},findPosH:function(ek,eh,ei,ef){var ee=1;if(eh<0){ee=-1;eh=-eh}for(var eg=0,ej=dU(this.doc,ek);eg<eh;++eg){ej=aV(this.doc,ej,ee,ei,ef);if(ej.hitSide){break}}return ej},moveH:b2(null,function(ee,ef){var eg=this.doc.sel,eh;if(eg.shift||eg.extend||dT(eg.from,eg.to)){eh=aV(this.doc,eg.head,ee,ef,this.options.rtlMoveVisually)}else{eh=ee<0?eg.from:eg.to}d1(this.doc,eh,eh,ee)}),deleteH:b2(null,function(ee,ef){var eg=this.doc.sel;if(!dT(eg.from,eg.to)){ax(this.doc,"",eg.from,eg.to,"+delete")}else{ax(this.doc,"",eg.from,aV(this.doc,eg.head,ee,ef,false),"+delete")}this.curOp.userSelChange=true}),findPosV:function(ej,eg,ek,em){var ee=1,ei=em;if(eg<0){ee=-1;eg=-eg}for(var ef=0,el=dU(this.doc,ej);ef<eg;++ef){var eh=cz(this,el,"div");if(ei==null){ei=eh.left}else{eh.left=ei}el=aR(this,eh,ee,ek);if(el.hitSide){break}}return el},moveV:b2(null,function(ee,ef){var eg=this.doc.sel;var ei=cz(this,eg.head,"div");if(eg.goalColumn!=null){ei.left=eg.goalColumn}var eh=aR(this,ei,ee,ef);if(ef=="page"){bT(this,0,bS(this,eh,"div").top-ei.top)}d1(this.doc,eh,eh,ee);eg.goalColumn=ei.left}),toggleOverwrite:function(ee){if(ee!=null&&ee==this.state.overwrite){return}if(this.state.overwrite=!this.state.overwrite){this.display.cursor.className+=" CodeMirror-overwrite"}else{this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")}},hasFocus:function(){return this.state.focused},scrollTo:b2(null,function(ee,ef){w(this,ee,ef)}),getScrollInfo:function(){var ee=this.display.scroller,ef=aJ;return{left:ee.scrollLeft,top:ee.scrollTop,height:ee.scrollHeight-ef,width:ee.scrollWidth-ef,clientHeight:ee.clientHeight-ef,clientWidth:ee.clientWidth-ef}},scrollIntoView:b2(null,function(eh,eg){if(typeof eh=="number"){eh=I(eh,0)}if(!eg){eg=0}var ef=eh;if(!eh||eh.line!=null){this.curOp.scrollToPos=eh?dU(this.doc,eh):this.doc.sel.head;this.curOp.scrollToPosMargin=eg;ef=cz(this,this.curOp.scrollToPos)}var ee=y(this,ef.left,ef.top-eg,ef.right,ef.bottom+eg);w(this,ee.scrollLeft,ee.scrollTop)}),setSize:function(eg,ee){function ef(eh){return typeof eh=="number"||/^\d+$/.test(String(eh))?eh+"px":eh}if(eg!=null){this.display.wrapper.style.width=ef(eg)}if(ee!=null){this.display.wrapper.style.height=ef(ee)}this.refresh()},on:function(ee,ef){bf(this,ee,ef)},off:function(ee,ef){cL(this,ee,ef)},operation:function(ee){return bU(this,ee)},refresh:b2(null,function(){R(this);w(this,this.doc.scrollLeft,this.doc.scrollTop);O(this)}),swapDoc:b2(null,function(ef){var ee=this.doc;ee.cm=null;cI(this,ef);R(this);dF(this,true);w(this,ef.scrollLeft,ef.scrollTop);return ee}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};var aF=z.optionHandlers={};var dn=z.defaults={};function o(ee,eh,eg,ef){z.defaults[ee]=eh;if(eg){aF[ee]=ef?function(ei,ek,ej){if(ej!=bq){eg(ei,ek,ej)}}:eg}}var bq=z.Init={toString:function(){return"CodeMirror.Init"}};o("value","",function(ee,ef){ee.setValue(ef)},true);o("mode",null,function(ee,ef){ee.doc.modeOption=ef;aS(ee)},true);o("indentUnit",2,aS,true);o("indentWithTabs",false);o("smartIndent",true);o("tabSize",4,function(ee){aS(ee);R(ee);O(ee)},true);o("electricChars",true);o("rtlMoveVisually",!am);o("theme","default",function(ee){bV(ee);cl(ee)},true);o("keyMap","default",ec);o("extraKeys",null);o("onKeyEvent",null);o("onDragEvent",null);o("lineWrapping",false,da,true);o("gutters",[],function(ee){bs(ee.options);cl(ee)},true);o("fixedGutter",true,function(ee,ef){ee.display.gutters.style.left=ef?cB(ee.display)+"px":"0";ee.refresh()},true);o("coverGutterNextToScrollbar",false,dj,true);o("lineNumbers",false,function(ee){bs(ee.options);cl(ee)},true);o("firstLineNumber",1,cl,true);o("lineNumberFormatter",function(ee){return ee},cl,true);o("showCursorWhenSelecting",false,aY,true);o("readOnly",false,function(ee,ef){if(ef=="nocursor"){ar(ee);ee.display.input.blur()}else{if(!ef){dF(ee,true)}}});o("dragDrop",true);o("cursorBlinkRate",530);o("cursorScrollMargin",0);o("cursorHeight",1);o("workTime",100);o("workDelay",100);o("flattenSpans",true);o("pollInterval",100);o("undoDepth",40,function(ee,ef){ee.doc.history.undoDepth=ef});o("historyEventDelay",500);o("viewportMargin",10,function(ee){ee.refresh()},true);o("maxHighlightLength",10000,function(ee){aS(ee);ee.refresh()},true);o("moveInputWithCursor",true,function(ee,ef){if(!ef){ee.display.inputDiv.style.top=ee.display.inputDiv.style.left=0}});o("tabindex",null,function(ee,ef){ee.display.input.tabIndex=ef||""});o("autofocus",null);var ci=z.modes={},aq=z.mimeModes={};z.defineMode=function(ee,eg){if(!z.defaults.mode&&ee!="null"){z.defaults.mode=ee}if(arguments.length>2){eg.dependencies=[];for(var ef=2;ef<arguments.length;++ef){eg.dependencies.push(arguments[ef])}}ci[ee]=eg};z.defineMIME=function(ef,ee){aq[ef]=ee};z.resolveMode=function(ee){if(typeof ee=="string"&&aq.hasOwnProperty(ee)){ee=aq[ee]}else{if(ee&&typeof ee.name=="string"&&aq.hasOwnProperty(ee.name)){var ef=aq[ee.name];ee=bw(ef,ee);ee.name=ef.name}else{if(typeof ee=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(ee)){return z.resolveMode("application/xml")}}}if(typeof ee=="string"){return{name:ee}}else{return ee||{name:"null"}}};z.getMode=function(ef,ee){ee=z.resolveMode(ee);var eh=ci[ee.name];if(!eh){return z.getMode(ef,"text/plain")}var ei=eh(ef,ee);if(cg.hasOwnProperty(ee.name)){var eg=cg[ee.name];for(var ej in eg){if(!eg.hasOwnProperty(ej)){continue}if(ei.hasOwnProperty(ej)){ei["_"+ej]=ei[ej]}ei[ej]=eg[ej]}}ei.name=ee.name;return ei};z.defineMode("null",function(){return{token:function(ee){ee.skipToEnd()}}});z.defineMIME("text/plain","null");var cg=z.modeExtensions={};z.extendMode=function(eg,ef){var ee=cg.hasOwnProperty(eg)?cg[eg]:(cg[eg]={});ak(ef,ee)};z.defineExtension=function(ee,ef){z.prototype[ee]=ef};z.defineDocExtension=function(ee,ef){Y.prototype[ee]=ef};z.defineOption=o;var aA=[];z.defineInitHook=function(ee){aA.push(ee)};function bi(eh,ee){if(ee===true){return ee}if(eh.copyState){return eh.copyState(ee)}var eg={};for(var ei in ee){var ef=ee[ei];if(ef instanceof Array){ef=ef.concat([])}eg[ei]=ef}return eg}z.copyState=bi;function bh(eg,ef,ee){return eg.startState?eg.startState(ef,ee):true}z.startState=bh;z.innerMode=function(eg,ee){while(eg.innerMode){var ef=eg.innerMode(ee);ee=ef.state;eg=ef.mode}return ef||{mode:eg,state:ee}};var c4=z.commands={selectAll:function(ee){ee.setSelection(I(ee.firstLine(),0),I(ee.lastLine()))},killLine:function(ee){var eh=ee.getCursor(true),eg=ee.getCursor(false),ef=!dT(eh,eg);if(!ef&&ee.getLine(eh.line).length==eh.ch){ee.replaceRange("",eh,I(eh.line+1,0),"+delete")}else{ee.replaceRange("",eh,ef?eg:I(eh.line),"+delete")}},deleteLine:function(ee){var ef=ee.getCursor().line;ee.replaceRange("",I(ef,0),I(ef),"+delete")},delLineLeft:function(ee){var ef=ee.getCursor();ee.replaceRange("",I(ef.line,0),ef,"+delete")},undo:function(ee){ee.undo()},redo:function(ee){ee.redo()},goDocStart:function(ee){ee.extendSelection(I(ee.firstLine(),0))},goDocEnd:function(ee){ee.extendSelection(I(ee.lastLine()))},goLineStart:function(ee){ee.extendSelection(aU(ee,ee.getCursor().line))},goLineStartSmart:function(ef){var ej=ef.getCursor(),ek=aU(ef,ej.line);var eg=ef.getLineHandle(ek.line);var ee=a(eg);if(!ee||ee[0].level==0){var ei=Math.max(0,eg.text.search(/\S/));var eh=ej.line==ek.line&&ej.ch<=ei&&ej.ch;ef.extendSelection(I(ek.line,eh?0:ei))}else{ef.extendSelection(ek)}},goLineEnd:function(ee){ee.extendSelection(cx(ee,ee.getCursor().line))},goLineRight:function(ee){var ef=ee.charCoords(ee.getCursor(),"div").top+5;ee.extendSelection(ee.coordsChar({left:ee.display.lineDiv.offsetWidth+100,top:ef},"div"))},goLineLeft:function(ee){var ef=ee.charCoords(ee.getCursor(),"div").top+5;ee.extendSelection(ee.coordsChar({left:0,top:ef},"div"))},goLineUp:function(ee){ee.moveV(-1,"line")},goLineDown:function(ee){ee.moveV(1,"line")},goPageUp:function(ee){ee.moveV(-1,"page")},goPageDown:function(ee){ee.moveV(1,"page")},goCharLeft:function(ee){ee.moveH(-1,"char")},goCharRight:function(ee){ee.moveH(1,"char")},goColumnLeft:function(ee){ee.moveH(-1,"column")},goColumnRight:function(ee){ee.moveH(1,"column")},goWordLeft:function(ee){ee.moveH(-1,"word")},goGroupRight:function(ee){ee.moveH(1,"group")},goGroupLeft:function(ee){ee.moveH(-1,"group")},goWordRight:function(ee){ee.moveH(1,"word")},delCharBefore:function(ee){ee.deleteH(-1,"char")},delCharAfter:function(ee){ee.deleteH(1,"char")},delWordBefore:function(ee){ee.deleteH(-1,"word")},delWordAfter:function(ee){ee.deleteH(1,"word")},delGroupBefore:function(ee){ee.deleteH(-1,"group")},delGroupAfter:function(ee){ee.deleteH(1,"group")},indentAuto:function(ee){ee.indentSelection("smart")},indentMore:function(ee){ee.indentSelection("add")},indentLess:function(ee){ee.indentSelection("subtract")},insertTab:function(ee){ee.replaceSelection("\t","end","+input")},defaultTab:function(ee){if(ee.somethingSelected()){ee.indentSelection("add")}else{ee.replaceSelection("\t","end","+input")}},transposeChars:function(ee){var eg=ee.getCursor(),ef=ee.getLine(eg.line);if(eg.ch>0&&eg.ch<ef.length-1){ee.replaceRange(ef.charAt(eg.ch)+ef.charAt(eg.ch-1),I(eg.line,eg.ch-1),I(eg.line,eg.ch+1))}},newlineAndIndent:function(ee){b2(ee,function(){ee.replaceSelection("\n","end","+input");ee.indentLine(ee.getCursor().line,null,true)})()},toggleOverwrite:function(ee){ee.toggleOverwrite()}};var ds=z.keyMap={};ds.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};ds.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":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};ds.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":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft",fallthrough:["basic","emacsy"]};ds["default"]=bk?ds.macDefault:ds.pcDefault;ds.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":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};function d2(ee){if(typeof ee=="string"){return ds[ee]}else{return ee}}function g(ef,ej,eh){function ei(ep){ep=d2(ep);var en=ep[ef];if(en===false){return"stop"}if(en!=null&&eh(en)){return true}if(ep.nofallthrough){return"stop"}var em=ep.fallthrough;if(em==null){return false}if(Object.prototype.toString.call(em)!="[object Array]"){return ei(em)}for(var el=0,eo=em.length;el<eo;++el){var ek=ei(em[el]);if(ek){return ek}}return false}for(var eg=0;eg<ej.length;++eg){var ee=ei(ej[eg]);if(ee){return ee!="stop"}}}function c3(ef){var ee=dx[ef.keyCode];return ee=="Ctrl"||ee=="Alt"||ee=="Shift"||ee=="Mod"}function dH(ef,eg){if(dM&&ef.keyCode==34&&ef["char"]){return false}var ee=dx[ef.keyCode];if(ee==null||ef.altGraphKey){return false}if(ef.altKey){ee="Alt-"+ee}if(ba?ef.metaKey:ef.ctrlKey){ee="Ctrl-"+ee}if(ba?ef.ctrlKey:ef.metaKey){ee="Cmd-"+ee}if(!eg&&ef.shiftKey){ee="Shift-"+ee}return ee}z.lookupKey=g;z.isModifierKey=c3;z.keyName=dH;z.fromTextArea=function(el,em){if(!em){em={}}em.value=el.value;if(!em.tabindex&&el.tabindex){em.tabindex=el.tabindex}if(!em.placeholder&&el.placeholder){em.placeholder=el.placeholder}if(em.autofocus==null){var ee=document.body;try{ee=document.activeElement}catch(eg){}em.autofocus=ee==el||el.getAttribute("autofocus")!=null&&ee==document.body}function ei(){el.value=ek.getValue()}if(el.form){bf(el.form,"submit",ei);if(!em.leaveSubmitMethodAlone){var ef=el.form,ej=ef.submit;try{var eh=ef.submit=function(){ei();ef.submit=ej;ef.submit();ef.submit=eh}}catch(eg){}}}el.style.display="none";var ek=z(function(en){el.parentNode.insertBefore(en,el.nextSibling)},em);ek.save=ei;ek.getTextArea=function(){return el};ek.toTextArea=function(){ei();el.parentNode.removeChild(ek.getWrapperElement());el.style.display="";if(el.form){cL(el.form,"submit",ei);if(typeof el.form.submit=="function"){el.form.submit=ej}}};return ek};function dg(ee,ef){this.pos=this.start=0;this.string=ee;this.tabSize=ef||8;this.lastColumnPos=this.lastColumnValue=0}dg.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length){return this.string.charAt(this.pos++)}},eat:function(ee){var eg=this.string.charAt(this.pos);if(typeof ee=="string"){var ef=eg==ee}else{var ef=eg&&(ee.test?ee.test(eg):ee(eg))}if(ef){++this.pos;return eg}},eatWhile:function(ee){var ef=this.pos;while(this.eat(ee)){}return this.pos>ef},eatSpace:function(){var ee=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this.pos}return this.pos>ee},skipToEnd:function(){this.pos=this.string.length},skipTo:function(ee){var ef=this.string.indexOf(ee,this.pos);if(ef>-1){this.pos=ef;return true}},backUp:function(ee){this.pos-=ee},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=bb(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue},indentation:function(){return bb(this.string,null,this.tabSize)},match:function(ei,ef,ee){if(typeof ei=="string"){var ej=function(ek){return ee?ek.toLowerCase():ek};var eh=this.string.substr(this.pos,ei.length);if(ej(eh)==ej(ei)){if(ef!==false){this.pos+=ei.length}return true}}else{var eg=this.string.slice(this.pos).match(ei);if(eg&&eg.index>0){return null}if(eg&&ef!==false){this.pos+=eg[0].length}return eg}},current:function(){return this.string.slice(this.start,this.pos)}};z.StringStream=dg;function F(ef,ee){this.lines=[];this.type=ee;this.doc=ef}z.TextMarker=F;F.prototype.clear=function(){if(this.explicitlyCleared){return}var el=this.doc.cm,ef=el&&!el.curOp;if(ef){bR(el)}var eg=null,ej=null;for(var eh=0;eh<this.lines.length;++eh){var em=this.lines[eh];var ek=dr(em.markedSpans,this);if(ek.to!=null){ej=a8(em)}em.markedSpans=db(em.markedSpans,ek);if(ek.from!=null){eg=a8(em)}else{if(this.collapsed&&!dK(this.doc,em)&&el){d7(em,au(el.display))}}}if(el&&this.collapsed&&!el.options.lineWrapping){for(var eh=0;eh<this.lines.length;++eh){var ee=t(el.doc,this.lines[eh]),ei=cR(el.doc,ee);if(ei>el.display.maxLineLength){el.display.maxLine=ee;el.display.maxLineLength=ei;el.display.maxLineChanged=true}}}if(eg!=null&&el){O(el,eg,ej+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(el){cY(el)}}if(ef){U(el)}M(this,"clear")};F.prototype.find=function(){var ej,ei;for(var ef=0;ef<this.lines.length;++ef){var ee=this.lines[ef];var eg=dr(ee.markedSpans,this);if(eg.from!=null||eg.to!=null){var eh=a8(ee);if(eg.from!=null){ej=I(eh,eg.from)}if(eg.to!=null){ei=I(eh,eg.to)}}}if(this.type=="bookmark"){return ej}return ej&&{from:ej,to:ei}};F.prototype.changed=function(){var eh=this.find(),ee=this.doc.cm;if(!eh||!ee){return}var ef=dv(this.doc,eh.from.line);dX(ee,ef);if(eh.from.line>=ee.display.showingFrom&&eh.from.line<ee.display.showingTo){for(var eg=ee.display.lineDiv.firstChild;eg;eg=eg.nextSibling){if(eg.lineObj==ef){if(eg.offsetHeight!=ef.height){d7(ef,eg.offsetHeight)}break}}bU(ee,function(){ee.curOp.selectionChanged=true})}};F.prototype.attachLine=function(ee){if(!this.lines.length&&this.doc.cm){var ef=this.doc.cm.curOp;if(!ef.maybeHiddenMarkers||cd(ef.maybeHiddenMarkers,this)==-1){(ef.maybeUnhiddenMarkers||(ef.maybeUnhiddenMarkers=[])).push(this)}}this.lines.push(ee)};F.prototype.detachLine=function(ee){this.lines.splice(cd(this.lines,ee),1);if(!this.lines.length&&this.doc.cm){var ef=this.doc.cm.curOp;(ef.maybeHiddenMarkers||(ef.maybeHiddenMarkers=[])).push(this)}};function c8(en,el,em,ep,ej){if(ep&&ep.shared){return E(en,el,em,ep,ej)}if(en.cm&&!en.cm.curOp){return b2(en.cm,c8)(en,el,em,ep,ej)}var ei=new F(en,ej);if(ej=="range"&&!dw(el,em)){return ei}if(ep){ak(ep,ei)}if(ei.replacedWith){ei.collapsed=true;ei.replacedWith=d4("span",[ei.replacedWith],"CodeMirror-widget");if(!ep.handleMouseEvents){ei.replacedWith.ignoreEvents=true}}if(ei.collapsed){az=true}if(ei.addToHistory){c9(en,{from:el,to:em,origin:"markText"},{head:en.sel.head,anchor:en.sel.anchor},NaN)}var ef=el.line,eo=0,eh,eg,ek=en.cm,ee;en.iter(ef,em.line+1,function(eq){if(ek&&ei.collapsed&&!ek.options.lineWrapping&&t(en,eq)==ek.display.maxLine){ee=true}var er={from:null,to:null,marker:ei};eo+=eq.text.length;if(ef==el.line){er.from=el.ch;eo-=el.ch}if(ef==em.line){er.to=em.ch;eo-=eq.text.length-em.ch}if(ei.collapsed){if(ef==em.line){eg=aW(eq,em.ch)}if(ef==el.line){eh=aW(eq,el.ch)}else{d7(eq,0)}}br(eq,er);++ef});if(ei.collapsed){en.iter(el.line,em.line+1,function(eq){if(dK(en,eq)){d7(eq,0)}})}if(ei.clearOnEnter){bf(ei,"beforeCursorEnter",function(){ei.clear()})}if(ei.readOnly){d9=true;if(en.history.done.length||en.history.undone.length){en.clearHistory()}}if(ei.collapsed){if(eh!=eg){throw new Error("Inserting collapsed marker overlapping an existing one")}ei.size=eo;ei.atomic=true}if(ek){if(ee){ek.curOp.updateMaxLine=true}if(ei.className||ei.startStyle||ei.endStyle||ei.collapsed){O(ek,el.line,em.line+1)}if(ei.atomic){cY(ek)}}return ei}function s(eh,ef){this.markers=eh;this.primary=ef;for(var ee=0,eg=this;ee<eh.length;++ee){eh[ee].parent=this;bf(eh[ee],"clear",function(){eg.clear()})}}z.SharedTextMarker=s;s.prototype.clear=function(){if(this.explicitlyCleared){return}this.explicitlyCleared=true;for(var ee=0;ee<this.markers.length;++ee){this.markers[ee].clear()}M(this,"clear")};s.prototype.find=function(){return this.primary.find()};function E(ei,el,ek,ee,eg){ee=ak(ee);ee.shared=false;var ej=[c8(ei,el,ek,ee,eg)],ef=ej[0];var eh=ee.replacedWith;cF(ei,function(en){if(eh){ee.replacedWith=eh.cloneNode(true)}ej.push(c8(en,dU(en,el),dU(en,ek),ee,eg));for(var em=0;em<en.linked.length;++em){if(en.linked[em].isParent){return}}ef=dS(ej)});return new s(ej,ef)}function dr(eg,ee){if(eg){for(var ef=0;ef<eg.length;++ef){var eh=eg[ef];if(eh.marker==ee){return eh}}}}function db(ef,eg){for(var eh,ee=0;ee<ef.length;++ee){if(ef[ee]!=eg){(eh||(eh=[])).push(ef[ee])}}return eh}function br(ee,ef){ee.markedSpans=ee.markedSpans?ee.markedSpans.concat([ef]):[ef];ef.marker.attachLine(ee)}function ao(ef,eg,ek){if(ef){for(var ei=0,el;ei<ef.length;++ei){var em=ef[ei],ej=em.marker;var ee=em.from==null||(ej.inclusiveLeft?em.from<=eg:em.from<eg);if(ee||ej.type=="bookmark"&&em.from==eg&&(!ek||!em.marker.insertLeft)){var eh=em.to==null||(ej.inclusiveRight?em.to>=eg:em.to>eg);(el||(el=[])).push({from:em.from,to:eh?null:em.to,marker:ej})}}}return el}function ad(ef,eh,ek){if(ef){for(var ei=0,el;ei<ef.length;++ei){var em=ef[ei],ej=em.marker;var eg=em.to==null||(ej.inclusiveRight?em.to>=eh:em.to>eh);if(eg||ej.type=="bookmark"&&em.from==eh&&(!ek||em.marker.insertLeft)){var ee=em.from==null||(ej.inclusiveLeft?em.from<=eh:em.from<eh);(el||(el=[])).push({from:ee?null:em.from-eh,to:em.to==null?null:em.to-eh,marker:ej})}}}return el}function cQ(eq,en){var em=bn(eq,en.from.line)&&dv(eq,en.from.line).markedSpans;var et=bn(eq,en.to.line)&&dv(eq,en.to.line).markedSpans;if(!em&&!et){return null}var ef=en.from.ch,ei=en.to.ch,el=dT(en.from,en.to);var ek=ao(em,ef,el);var es=ad(et,ei,el);var er=en.text.length==1,eg=dS(en.text).length+(er?ef:0);if(ek){for(var eh=0;eh<ek.length;++eh){var ep=ek[eh];if(ep.to==null){var eu=dr(es,ep.marker);if(!eu){ep.to=ef}else{if(er){ep.to=eu.to==null?null:eu.to+eg}}}}}if(es){for(var eh=0;eh<es.length;++eh){var ep=es[eh];if(ep.to!=null){ep.to+=eg}if(ep.from==null){var eu=dr(ek,ep.marker);if(!eu){ep.from=eg;if(er){(ek||(ek=[])).push(ep)}}}else{ep.from+=eg;if(er){(ek||(ek=[])).push(ep)}}}}if(er&&ek){for(var eh=0;eh<ek.length;++eh){if(ek[eh].from!=null&&ek[eh].from==ek[eh].to&&ek[eh].marker.type!="bookmark"){ek.splice(eh--,1)}}if(!ek.length){ek=null}}var ej=[ek];if(!er){var eo=en.text.length-2,ee;if(eo>0&&ek){for(var eh=0;eh<ek.length;++eh){if(ek[eh].to==null){(ee||(ee=[])).push({from:null,to:null,marker:ek[eh].marker})}}}for(var eh=0;eh<eo;++eh){ej.push(ee)}ej.push(es)}return ej}function cH(em,ek){var ee=bl(em,ek);var en=cQ(em,ek);if(!ee){return en}if(!en){return ee}for(var eh=0;eh<ee.length;++eh){var ei=ee[eh],ej=en[eh];if(ei&&ej){spans:for(var eg=0;eg<ej.length;++eg){var el=ej[eg];for(var ef=0;ef<ei.length;++ef){if(ei[ef].marker==el.marker){continue spans}}ei.push(el)}}else{if(ej){ee[eh]=ej}}}return ee}function bP(eo,em,en){var eh=null;eo.iter(em.line,en.line+1,function(ep){if(ep.markedSpans){for(var eq=0;eq<ep.markedSpans.length;++eq){var er=ep.markedSpans[eq].marker;if(er.readOnly&&(!eh||cd(eh,er)==-1)){(eh||(eh=[])).push(er)}}}});if(!eh){return null}var ei=[{from:em,to:en}];for(var ej=0;ej<eh.length;++ej){var ek=eh[ej],ef=ek.find();for(var eg=0;eg<ei.length;++eg){var ee=ei[eg];if(dw(ee.to,ef.from)||dw(ef.to,ee.from)){continue}var el=[eg,1];if(dw(ee.from,ef.from)||!ek.inclusiveLeft&&dT(ee.from,ef.from)){el.push({from:ee.from,to:ef.from})}if(dw(ef.to,ee.to)||!ek.inclusiveRight&&dT(ee.to,ef.to)){el.push({from:ef.to,to:ee.to})}ei.splice.apply(ei,el);eg+=el.length-1}}return ei}function aW(ef,eh){var ee=az&&ef.markedSpans,ej;if(ee){for(var ei,eg=0;eg<ee.length;++eg){ei=ee[eg];if(!ei.marker.collapsed){continue}if((ei.from==null||ei.from<eh)&&(ei.to==null||ei.to>eh)&&(!ej||ej.width<ei.marker.width)){ej=ei.marker}}}return ej}function dd(ee){return aW(ee,-1)}function cW(ee){return aW(ee,ee.text.length+1)}function t(eg,ef){var ee;while(ee=dd(ef)){ef=dv(eg,ee.find().from.line)}return ef}function dK(ei,ef){var ee=az&&ef.markedSpans;if(ee){for(var eh,eg=0;eg<ee.length;++eg){eh=ee[eg];if(!eh.marker.collapsed){continue}if(eh.from==null){return true}if(eh.marker.replacedWith){continue}if(eh.from==0&&eh.marker.inclusiveLeft&&H(ei,ef,eh)){return true}}}}function H(ek,ef,eh){if(eh.to==null){var ee=eh.marker.find().to,ei=dv(ek,ee.line);return H(ek,ei,dr(ei.markedSpans,eh.marker))}if(eh.marker.inclusiveRight&&eh.to==ef.text.length){return true}for(var ej,eg=0;eg<ef.markedSpans.length;++eg){ej=ef.markedSpans[eg];if(ej.marker.collapsed&&!ej.marker.replacedWith&&ej.from==eh.to&&(ej.marker.inclusiveLeft||eh.marker.inclusiveRight)&&H(ek,ef,ej)){return true}}}function d8(ee){var eg=ee.markedSpans;if(!eg){return}for(var ef=0;ef<eg.length;++ef){eg[ef].marker.detachLine(ee)}ee.markedSpans=null}function b3(ee,eg){if(!eg){return}for(var ef=0;ef<eg.length;++ef){eg[ef].marker.attachLine(ee)}ee.markedSpans=eg}var cp=z.LineWidget=function(ee,eh,ef){for(var eg in ef){if(ef.hasOwnProperty(eg)){this[eg]=ef[eg]}}this.cm=ee;this.node=eh};function C(ee){return function(){var eg=!this.cm.curOp;if(eg){bR(this.cm)}try{var ef=ee.apply(this,arguments)}finally{if(eg){U(this.cm)}}return ef}}cp.prototype.clear=C(function(){var ee=this.line.widgets,eg=a8(this.line);if(eg==null||!ee){return}for(var ef=0;ef<ee.length;++ef){if(ee[ef]==this){ee.splice(ef--,1)}}if(!ee.length){this.line.widgets=null}d7(this.line,Math.max(0,this.line.height-bZ(this)));O(this.cm,eg,eg+1)});cp.prototype.changed=C(function(){var ee=this.height;this.height=null;var ef=bZ(this)-ee;if(!ef){return}d7(this.line,this.line.height+ef);var eg=a8(this.line);O(this.cm,eg,eg+1)});function bZ(ee){if(ee.height!=null){return ee.height}if(!ee.node.parentNode||ee.node.parentNode.nodeType!=1){bc(ee.cm.display.measure,d4("div",[ee.node],null,"position: relative"))}return ee.height=ee.node.offsetHeight}function a2(ee,ei,eg,ef){var eh=new cp(ee,eg,ef);if(eh.noHScroll){ee.display.alignWidgets=true}c0(ee,ei,function(ek){(ek.widgets||(ek.widgets=[])).push(eh);eh.line=ek;if(!dK(ee.doc,ek)||eh.showIfHidden){var ej=a7(ee,ek)<ee.display.scroller.scrollTop;d7(ek,ek.height+bZ(eh));if(ej){bT(ee,0,eh.height)}}return true});return eh}function aM(eh,eg,ee){var ef={text:eh};b3(ef,eg);ef.height=ee?ee(ef):1;return ef}function cS(ef,ei,eg,ee){ef.text=ei;if(ef.stateAfter){ef.stateAfter=null}if(ef.styles){ef.styles=null}if(ef.order!=null){ef.order=null}d8(ef);b3(ef,eg);var eh=ee?ee(ef):1;if(eh!=ef.height){d7(ef,eh)}}function aX(ee){ee.parent=null;d8(ee)}function r(el,en,eh,ef,ei){var eg=eh.flattenSpans;if(eg==null){eg=el.options.flattenSpans}var ek=0,ej=null;var em=new dg(en,el.options.tabSize),ee;if(en==""&&eh.blankLine){eh.blankLine(ef)}while(!em.eol()){if(em.pos>el.options.maxHighlightLength){eg=false;em.pos=Math.min(en.length,em.start+50000);ee=null}else{ee=eh.token(em,ef)}if(!eg||ej!=ee){if(ek<em.start){ei(em.start,ej)}ek=em.start;ej=ee}em.start=em.pos}if(ek<em.pos){ei(em.pos,ej)}}function dP(ef,eg,ek){var ei=[ef.state.modeGen];r(ef,eg.text,ef.doc.mode,ek,function(em,en){ei.push(em,en)});for(var el=0;el<ef.state.overlays.length;++el){var eh=ef.state.overlays[el],ej=1,ee=0;r(ef,eg.text,eh.mode,true,function(em,eo){var eq=ej;while(ee<em){var en=ei[ej];if(en>em){ei.splice(ej,1,em,ei[ej+1],en)}ej+=2;ee=Math.min(em,en)}if(!eo){return}if(eh.opaque){ei.splice(eq,ej-eq,em,eo);ej=eq+2}else{for(;eq<ej;eq+=2){var ep=ei[eq+1];ei[eq+1]=ep?ep+" "+eo:eo}}})}return ei}function b7(ee,ef){if(!ef.styles||ef.styles[0]!=ee.state.modeGen){ef.styles=dP(ee,ef,ef.stateAfter=co(ee,a8(ef)))}return ef.styles}function cm(ee,ef,eg){var ei=ee.doc.mode;var eh=new dg(ef.text,ee.options.tabSize);if(ef.text==""&&ei.blankLine){ei.blankLine(eg)}while(!eh.eol()&&eh.pos<=ee.options.maxHighlightLength){ei.token(eh,eg);eh.start=eh.pos}}var cA={};function j(ee){if(!ee){return null}return cA[ee]||(cA[ee]="cm-"+ee.replace(/ +/g," cm-"))}function cw(em,ep,ee){var en,eq=ep,ej=true;while(en=dd(eq)){eq=dv(em.doc,en.find().from.line)}var ek={pre:d4("pre"),col:0,pos:0,display:!ee,measure:null,measuredSomething:false,cm:em};if(eq.textClass){ek.pre.className=eq.textClass}do{if(eq.text){ej=false}ek.measure=eq==ep&&ee;ek.pos=0;ek.addToken=ek.measure?e:p;if((cs||b1)&&em.getOption("lineWrapping")){ek.addToken=dR(ek.addToken)}var ei=aQ(eq,ek,b7(em,eq));if(ee&&eq==ep&&!ek.measuredSomething){ee[0]=ek.pre.appendChild(aP(em.display.measure));ek.measuredSomething=true}if(ei){eq=dv(em.doc,ei.to.line)}}while(ei);if(ee&&!ek.measuredSomething&&!ee[0]){ee[0]=ek.pre.appendChild(ej?d4("span","\u00a0"):aP(em.display.measure))}if(!ek.pre.firstChild&&!dK(em.doc,ep)){ek.pre.appendChild(document.createTextNode("\u00a0"))}var ef;if(ee&&cs&&(ef=a(eq))){var eh=ef.length-1;if(ef[eh].from==ef[eh].to){--eh}var eo=ef[eh],eg=ef[eh-1];if(eo.from+1==eo.to&&eg&&eo.level<eg.level){var el=ee[ek.pos-1];if(el){el.parentNode.insertBefore(el.measureRight=aP(em.display.measure),el.nextSibling)}}}af(em,"renderLine",em,ep,ek.pre);return ek.pre}var b5=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;function p(ei,ep,ee,eh,eq){if(!ep){return}if(!b5.test(ep)){ei.col+=ep.length;var el=document.createTextNode(ep)}else{var el=document.createDocumentFragment(),en=0;while(true){b5.lastIndex=en;var ef=b5.exec(ep);var ek=ef?ef.index-en:ep.length-en;if(ek){el.appendChild(document.createTextNode(ep.slice(en,en+ek)));ei.col+=ek}if(!ef){break}en+=ek+1;if(ef[0]=="\t"){var ej=ei.cm.options.tabSize,em=ej-ei.col%ej;el.appendChild(d4("span",bC(em),"cm-tab"));ei.col+=em}else{var eg=d4("span","\u2022","cm-invalidchar");eg.title="\\u"+ef[0].charCodeAt(0).toString(16);el.appendChild(eg);ei.col+=1}}}if(ee||eh||eq||ei.measure){var eo=ee||"";if(eh){eo+=eh}if(eq){eo+=eq}return ei.pre.appendChild(d4("span",[el],eo))}ei.pre.appendChild(el)}function e(ek,em,ef,eh,en){var ej=ek.cm.options.lineWrapping;for(var ei=0;ei<em.length;++ei){var ee=em.charAt(ei),eg=ei==0;if(ee>="\ud800"&&ee<"\udbff"&&ei<em.length-1){ee=em.slice(ei,ei+2);++ei}else{if(ei&&ej&&bo(em,ei)){ek.pre.appendChild(d4("wbr"))}}var el=ek.measure[ek.pos]=p(ek,ee,ef,eg&&eh,ei==em.length-1&&en);if(cs&&ej&&ee==" "&&ei&&!/\s/.test(em.charAt(ei-1))&&ei<em.length-1&&!/\s/.test(em.charAt(ei+1))){el.style.whiteSpace="normal"}ek.pos+=ee.length}if(em.length){ek.measuredSomething=true}}function dR(ee){function ef(eg){var eh=" ";for(var ei=0;ei<eg.length-2;++ei){eh+=ei%2?" ":"\u00a0"}eh+=" ";return eh}return function(eh,ek,ei,eg,ej){return ee(eh,ek.replace(/ {3,}/,ef),ei,eg,ej)}}function K(ee,ef,eg){if(eg){if(!ee.display){eg=eg.cloneNode(true)}if(ee.measure){ee.measure[ee.pos]=ef?eg:ee.pre.appendChild(aP(ee.cm.display.measure));ee.measuredSomething=true}ee.pre.appendChild(eg)}ee.pos+=ef}function aQ(em,et,el){var ej=em.markedSpans,ek=em.text,er=0;if(!ej){for(var ew=1;ew<el.length;ew+=2){et.addToken(et,ek.slice(er,er=el[ew]),j(el[ew+1]))}return}var ex=ek.length,ei=0,ew=1,ep="",ey;var eA=0,ee,ez,eq,eg;for(;;){if(eA==ei){ee=ez=eq="";eg=null;eA=Infinity;var en=null;for(var eu=0;eu<ej.length;++eu){var ev=ej[eu],es=ev.marker;if(ev.from<=ei&&(ev.to==null||ev.to>ei)){if(ev.to!=null&&eA>ev.to){eA=ev.to;ez=""}if(es.className){ee+=" "+es.className}if(es.startStyle&&ev.from==ei){eq+=" "+es.startStyle}if(es.endStyle&&ev.to==eA){ez+=" "+es.endStyle}if(es.collapsed&&(!eg||eg.marker.size<es.size)){eg=ev}}else{if(ev.from>ei&&eA>ev.from){eA=ev.from}}if(es.type=="bookmark"&&ev.from==ei&&es.replacedWith){en=es.replacedWith}}if(eg&&(eg.from||0)==ei){K(et,(eg.to==null?ex:eg.to)-ei,eg.from!=null&&eg.marker.replacedWith);if(eg.to==null){return eg.marker.find()}}if(en&&!eg){K(et,0,en)}}if(ei>=ex){break}var eo=Math.min(ex,eA);while(true){if(ep){var ef=ei+ep.length;if(!eg){var eh=ef>eo?ep.slice(0,eo-ei):ep;et.addToken(et,eh,ey?ey+ee:ee,eq,ei+eh.length==eA?ez:"")}if(ef>=eo){ep=ep.slice(eo-ei);ei=eo;break}ei=ef;eq=""}ep=ek.slice(er,er=el[ew++]);ey=j(el[ew++])}}}function dN(ev,em,ei,eq,ek){function eh(ew){return ei?ei[ew]:null}function el(ew,ey,ex){cS(ew,ey,ex,ek);M(ew,"change",ew,em)}var er=em.from,ef=em.to,eo=em.text;var en=dv(ev,er.line),ee=dv(ev,ef.line);var eg=dS(eo),et=eh(eo.length-1),ep=ef.line-er.line;if(er.ch==0&&ef.ch==0&&eg==""){for(var es=0,eu=eo.length-1,ej=[];es<eu;++es){ej.push(aM(eo[es],eh(es),ek))}el(ee,ee.text,et);if(ep){ev.remove(er.line,ep)}if(ej.length){ev.insert(er.line,ej)}}else{if(en==ee){if(eo.length==1){el(en,en.text.slice(0,er.ch)+eg+en.text.slice(ef.ch),et)}else{for(var ej=[],es=1,eu=eo.length-1;es<eu;++es){ej.push(aM(eo[es],eh(es),ek))}ej.push(aM(eg+en.text.slice(ef.ch),et,ek));el(en,en.text.slice(0,er.ch)+eo[0],eh(0));ev.insert(er.line+1,ej)}}else{if(eo.length==1){el(en,en.text.slice(0,er.ch)+eo[0]+ee.text.slice(ef.ch),eh(0));ev.remove(er.line+1,ep)}else{el(en,en.text.slice(0,er.ch)+eo[0],eh(0));el(ee,eg+ee.text.slice(ef.ch),et);for(var es=1,eu=eo.length-1,ej=[];es<eu;++es){ej.push(aM(eo[es],eh(es),ek))}if(ep>1){ev.remove(er.line+1,ep-1)}ev.insert(er.line+1,ej)}}}M(ev,"change",ev,em);bd(ev,eq.anchor,eq.head,null,true)}function dk(ef){this.lines=ef;this.parent=null;for(var eg=0,eh=ef.length,ee=0;eg<eh;++eg){ef[eg].parent=this;ee+=ef[eg].height}this.height=ee}dk.prototype={chunkSize:function(){return this.lines.length},removeInner:function(ee,ei){for(var eg=ee,eh=ee+ei;eg<eh;++eg){var ef=this.lines[eg];this.height-=ef.height;aX(ef);M(ef,"delete")}this.lines.splice(ee,ei)},collapse:function(ee){ee.splice.apply(ee,[ee.length,0].concat(this.lines))},insertInner:function(ef,eg,ee){this.height+=ee;this.lines=this.lines.slice(0,ef).concat(eg).concat(this.lines.slice(ef));for(var eh=0,ei=eg.length;eh<ei;++eh){eg[eh].parent=this}},iterN:function(ee,eh,eg){for(var ef=ee+eh;ee<ef;++ee){if(eg(this.lines[ee])){return true}}}};function dL(eh){this.children=eh;var eg=0,ee=0;for(var ef=0,ej=eh.length;ef<ej;++ef){var ei=eh[ef];eg+=ei.chunkSize();ee+=ei.height;ei.parent=this}this.size=eg;this.height=ee;this.parent=null}dL.prototype={chunkSize:function(){return this.size},removeInner:function(ee,el){this.size-=el;for(var eg=0;eg<this.children.length;++eg){var ek=this.children[eg],ei=ek.chunkSize();if(ee<ei){var eh=Math.min(el,ei-ee),ej=ek.height;ek.removeInner(ee,eh);this.height-=ej-ek.height;if(ei==eh){this.children.splice(eg--,1);ek.parent=null}if((el-=eh)==0){break}ee=0}else{ee-=ei}}if(this.size-el<25){var ef=[];this.collapse(ef);this.children=[new dk(ef)];this.children[0].parent=this}},collapse:function(ee){for(var ef=0,eg=this.children.length;ef<eg;++ef){this.children[ef].collapse(ee)}},insertInner:function(ef,em,el){this.size+=em.length;this.height+=el;for(var eg=0,ei=this.children.length;eg<ei;++eg){var ee=this.children[eg],ej=ee.chunkSize();if(ef<=ej){ee.insertInner(ef,em,el);if(ee.lines&&ee.lines.length>50){while(ee.lines.length>50){var eh=ee.lines.splice(ee.lines.length-25,25);var ek=new dk(eh);ee.height-=ek.height;this.children.splice(eg+1,0,ek);ek.parent=this}this.maybeSpill()}break}ef-=ej}},maybeSpill:function(){if(this.children.length<=10){return}var eh=this;do{var ef=eh.children.splice(eh.children.length-5,5);var eg=new dL(ef);if(!eh.parent){var ei=new dL(eh.children);ei.parent=eh;eh.children=[ei,eg];eh=ei}else{eh.size-=eg.size;eh.height-=eg.height;var ee=cd(eh.parent.children,eh);eh.parent.children.splice(ee+1,0,eg)}eg.parent=eh.parent}while(eh.children.length>10);eh.parent.maybeSpill()},iterN:function(ee,el,ek){for(var ef=0,ei=this.children.length;ef<ei;++ef){var ej=this.children[ef],eh=ej.chunkSize();if(ee<eh){var eg=Math.min(el,eh-ee);if(ej.iterN(ee,eg,ek)){return true}if((el-=eg)==0){break}ee=0}else{ee-=eh}}}};var bD=0;var Y=z.Doc=function(eg,ef,ee){if(!(this instanceof Y)){return new Y(eg,ef,ee)}if(ee==null){ee=0}dL.call(this,[new dk([aM("",null)])]);this.first=ee;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=aa();this.cleanGeneration=1;this.frontier=ee;var eh=I(ee,0);this.sel={from:eh,to:eh,head:eh,anchor:eh,shift:false,extend:false,goalColumn:null};this.id=++bD;this.modeOption=ef;if(typeof eg=="string"){eg=aw(eg)}dN(this,{from:eh,to:eh,text:eg},null,{head:eh,anchor:eh})};Y.prototype=bw(dL.prototype,{constructor:Y,iter:function(eg,ef,ee){if(ee){this.iterN(eg-this.first,ef-eg,ee)}else{this.iterN(this.first,this.first+this.size,eg)}},insert:function(ef,eg){var ee=0;for(var eh=0,ei=eg.length;eh<ei;++eh){ee+=eg[eh].height}this.insertInner(ef-this.first,eg,ee)},remove:function(ee,ef){this.removeInner(ee-this.first,ef)},getValue:function(ef){var ee=ay(this,this.first,this.first+this.size);if(ef===false){return ee}return ee.join(ef||"\n")},setValue:function(ef){var eg=I(this.first,0),ee=this.first+this.size-1;aG(this,{from:eg,to:I(ee,dv(this,ee).text.length),text:aw(ef),origin:"setValue"},{head:eg,anchor:eg},true)},replaceRange:function(ef,eh,eg,ee){eh=dU(this,eh);eg=eg?dU(this,eg):eh;ax(this,ef,eh,eg,ee)},getRange:function(eh,eg,ef){var ee=d5(this,dU(this,eh),dU(this,eg));if(ef===false){return ee}return ee.join(ef||"\n")},getLine:function(ef){var ee=this.getLineHandle(ef);return ee&&ee.text},setLine:function(ee,ef){if(bn(this,ee)){ax(this,ef,I(ee,0),dU(this,I(ee)))}},removeLine:function(ee){if(ee){ax(this,"",dU(this,I(ee-1)),dU(this,I(ee)))}else{ax(this,"",I(0,0),dU(this,I(1,0)))}},getLineHandle:function(ee){if(bn(this,ee)){return dv(this,ee)}},getLineNumber:function(ee){return a8(ee)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(ee){return dU(this,ee)},getCursor:function(eg){var ee=this.sel,ef;if(eg==null||eg=="head"){ef=ee.head}else{if(eg=="anchor"){ef=ee.anchor}else{if(eg=="end"||eg===false){ef=ee.to}else{ef=ee.from}}}return bv(ef)},somethingSelected:function(){return !dT(this.sel.head,this.sel.anchor)},setCursor:dO(function(ee,ef,eh){var eg=dU(this,typeof ee=="number"?I(ee,ef||0):ee);if(eh){d1(this,eg)}else{bd(this,eg,eg)}}),setSelection:dO(function(ee,ef){bd(this,dU(this,ee),dU(this,ef||ee))}),extendSelection:dO(function(ef,ee){d1(this,dU(this,ef),ee&&dU(this,ee))}),getSelection:function(ee){return this.getRange(this.sel.from,this.sel.to,ee)},replaceSelection:function(ef,eg,ee){aG(this,{from:this.sel.from,to:this.sel.to,text:aw(ef),origin:ee},eg||"around")},undo:dO(function(){bm(this,"undo")}),redo:dO(function(){bm(this,"redo")}),setExtending:function(ee){this.sel.extend=ee},historySize:function(){var ee=this.history;return{undo:ee.done.length,redo:ee.undone.length}},clearHistory:function(){this.history=aa(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){this.history.lastOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(ee){return this.history.generation==(ee||this.cleanGeneration)},getHistory:function(){return{done:a9(this.history.done),undone:a9(this.history.undone)}},setHistory:function(ef){var ee=this.history=aa(this.history.maxGeneration);ee.done=ef.done.slice(0);ee.undone=ef.undone.slice(0)},markText:function(eg,ef,ee){return c8(this,dU(this,eg),dU(this,ef),ee,"range")},setBookmark:function(eg,ee){var ef={replacedWith:ee&&(ee.nodeType==null?ee.widget:ee),insertLeft:ee&&ee.insertLeft};eg=dU(this,eg);return c8(this,eg,eg,ef,"bookmark")},findMarksAt:function(ei){ei=dU(this,ei);var eh=[],ef=dv(this,ei.line).markedSpans;if(ef){for(var ee=0;ee<ef.length;++ee){var eg=ef[ee];if((eg.from==null||eg.from<=ei.ch)&&(eg.to==null||eg.to>=ei.ch)){eh.push(eg.marker.parent||eg.marker)}}}return eh},getAllMarks:function(){var ee=[];this.iter(function(eg){var ef=eg.markedSpans;if(ef){for(var eh=0;eh<ef.length;++eh){if(ef[eh].from!=null){ee.push(ef[eh].marker)}}}});return ee},posFromIndex:function(ef){var ee,eg=this.first;this.iter(function(eh){var ei=eh.text.length+1;if(ei>ef){ee=ef;return true}ef-=ei;++eg});return dU(this,I(eg,ee))},indexFromPos:function(ef){ef=dU(this,ef);var ee=ef.ch;if(ef.line<this.first||ef.ch<0){return 0}this.iter(this.first,ef.line,function(eg){ee+=eg.text.length+1});return ee},copy:function(ee){var ef=new Y(ay(this,this.first,this.first+this.size),this.modeOption,this.first);ef.scrollTop=this.scrollTop;ef.scrollLeft=this.scrollLeft;ef.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:false,goalColumn:this.sel.goalColumn};if(ee){ef.history.undoDepth=this.history.undoDepth;ef.setHistory(this.getHistory())}return ef},linkedDoc:function(ee){if(!ee){ee={}}var eh=this.first,eg=this.first+this.size;if(ee.from!=null&&ee.from>eh){eh=ee.from}if(ee.to!=null&&ee.to<eg){eg=ee.to}var ef=new Y(ay(this,eh,eg),ee.mode||this.modeOption,eh);if(ee.sharedHist){ef.history=this.history}(this.linked||(this.linked=[])).push({doc:ef,sharedHist:ee.sharedHist});ef.linked=[{doc:this,isParent:true,sharedHist:ee.sharedHist}];return ef},unlinkDoc:function(ef){if(ef instanceof z){ef=ef.doc}if(this.linked){for(var eg=0;eg<this.linked.length;++eg){var eh=this.linked[eg];if(eh.doc!=ef){continue}this.linked.splice(eg,1);ef.unlinkDoc(this);break}}if(ef.history==this.history){var ee=[ef.id];cF(ef,function(ei){ee.push(ei.id)},true);ef.history=aa();ef.history.done=a9(this.history.done,ee);ef.history.undone=a9(this.history.undone,ee)}},iterLinkedDocs:function(ee){cF(this,ee)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});Y.prototype.eachLine=Y.prototype.iter;var d="iter insert remove copy getEditor".split(" ");for(var a5 in Y.prototype){if(Y.prototype.hasOwnProperty(a5)&&cd(d,a5)<0){z.prototype[a5]=(function(ee){return function(){return ee.apply(this.doc,arguments)}})(Y.prototype[a5])}}function cF(eh,eg,ef){function ee(en,el,ej){if(en.linked){for(var ek=0;ek<en.linked.length;++ek){var ei=en.linked[ek];if(ei.doc==el){continue}var em=ej&&ei.sharedHist;if(ef&&!em){continue}eg(ei.doc,em);ee(ei.doc,en,em)}}}ee(eh,null,true)}function cI(ee,ef){if(ef.cm){throw new Error("This document is already in use.")}ee.doc=ef;ef.cm=ee;J(ee);aS(ee);if(!ee.options.lineWrapping){d6(ee)}ee.options.mode=ef.modeOption;O(ee)}function dv(ee,ei){ei-=ee.first;while(!ee.lines){for(var ef=0;;++ef){var eh=ee.children[ef],eg=eh.chunkSize();if(ei<eg){ee=eh;break}ei-=eg}}return ee.lines[ei]}function d5(eg,ei,ee){var ef=[],eh=ei.line;eg.iter(ei.line,ee.line+1,function(ej){var ek=ej.text;if(eh==ee.line){ek=ek.slice(0,ee.ch)}if(eh==ei.line){ek=ek.slice(ei.ch)}ef.push(ek);++eh});return ef}function ay(ef,eh,eg){var ee=[];ef.iter(eh,eg,function(ei){ee.push(ei.text)});return ee}function d7(ef,ee){var eg=ee-ef.height;for(var eh=ef;eh;eh=eh.parent){eh.height+=eg}}function a8(ee){if(ee.parent==null){return null}var ei=ee.parent,eh=cd(ei.lines,ee);for(var ef=ei.parent;ef;ei=ef,ef=ef.parent){for(var eg=0;;++eg){if(ef.children[eg]==ei){break}eh+=ef.children[eg].chunkSize()}}return eh+ei.first}function a1(ek,ei){var eg=ek.first;outer:do{for(var eh=0,ej=ek.children.length;eh<ej;++eh){var ef=ek.children[eh],ee=ef.height;if(ei<ee){ek=ef;continue outer}ei-=ee;eg+=ef.chunkSize()}return eg}while(!ek.lines);for(var eh=0,ej=ek.lines.length;eh<ej;++eh){var em=ek.lines[eh],el=em.height;if(ei<el){break}ei-=el}return eg+eh}function a7(ee,eh){eh=t(ee.doc,eh);var ej=0,eg=eh.parent;for(var ei=0;ei<eg.lines.length;++ei){var ef=eg.lines[ei];if(ef==eh){break}else{ej+=ef.height}}for(var ek=eg.parent;ek;eg=ek,ek=eg.parent){for(var ei=0;ei<ek.children.length;++ei){var el=ek.children[ei];if(el==eg){break}else{ej+=el.height}}}return ej}function a(ef){var ee=ef.order;if(ee==null){ee=ef.order=aH(ef.text)}return ee}function aa(ee){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,generation:ee||1,maxGeneration:ee||1}}function bg(ef,ej,ei,eh){var ee=ej["spans_"+ef.id],eg=0;ef.iter(Math.max(ef.first,ei),Math.min(ef.first+ef.size,eh),function(ek){if(ek.markedSpans){(ee||(ee=ej["spans_"+ef.id]={}))[eg]=ek.markedSpans}++eg})}function ck(ee,eg){var ef={from:eg.from,to:bY(eg),text:d5(ee,eg.from,eg.to)};bg(ee,ef,eg.from.line,eg.to.line+1);cF(ee,function(eh){bg(eh,ef,eg.from.line,eg.to.line+1)},true);return ef}function c9(ej,el,ei,ee){var eh=ej.history;eh.undone.length=0;var eg=+new Date,ek=dS(eh.done);if(ek&&(eh.lastOp==ee||eh.lastOrigin==el.origin&&el.origin&&((el.origin.charAt(0)=="+"&&ej.cm&&eh.lastTime>eg-ej.cm.options.historyEventDelay)||el.origin.charAt(0)=="*"))){var ef=dS(ek.changes);if(dT(el.from,el.to)&&dT(el.from,ef.to)){ef.to=bY(el)}else{ek.changes.push(ck(ej,el))}ek.anchorAfter=ei.anchor;ek.headAfter=ei.head}else{ek={changes:[ck(ej,el)],generation:eh.generation,anchorBefore:ej.sel.anchor,headBefore:ej.sel.head,anchorAfter:ei.anchor,headAfter:ei.head};eh.done.push(ek);eh.generation=++eh.maxGeneration;while(eh.done.length>eh.undoDepth){eh.done.shift()}}eh.lastTime=eg;eh.lastOp=ee;eh.lastOrigin=el.origin}function aK(eg){if(!eg){return null}for(var ef=0,ee;ef<eg.length;++ef){if(eg[ef].marker.explicitlyCleared){if(!ee){ee=eg.slice(0,ef)}}else{if(ee){ee.push(eg[ef])}}}return !ee?eg:ee.length?ee:null}function bl(eh,ei){var eg=ei["spans_"+eh.id];if(!eg){return null}for(var ef=0,ee=[];ef<ei.text.length;++ef){ee.push(aK(eg[ef]))}return ee}function a9(eo,eh){for(var ek=0,ef=[];ek<eo.length;++ek){var eg=eo[ek],em=eg.changes,en=[];ef.push({changes:en,anchorBefore:eg.anchorBefore,headBefore:eg.headBefore,anchorAfter:eg.anchorAfter,headAfter:eg.headAfter});for(var ej=0;ej<em.length;++ej){var el=em[ej],ei;en.push({from:el.from,to:el.to,text:el.text});if(eh){for(var ee in el){if(ei=ee.match(/^spans_(\d+)$/)){if(cd(eh,Number(ei[1]))>-1){dS(en)[ee]=el[ee];delete el[ee]}}}}}}return ef}function di(eh,eg,ef,ee){if(ef<eh.line){eh.line+=ee}else{if(eg<eh.line){eh.line=eg;eh.ch=0}}}function dy(eh,ej,ek,el){for(var eg=0;eg<eh.length;++eg){var ee=eh[eg],ei=true;for(var ef=0;ef<ee.changes.length;++ef){var em=ee.changes[ef];if(!ee.copied){em.from=bv(em.from);em.to=bv(em.to)}if(ek<em.from.line){em.from.line+=el;em.to.line+=el}else{if(ej<=em.to.line){ei=false;break}}}if(!ee.copied){ee.anchorBefore=bv(ee.anchorBefore);ee.headBefore=bv(ee.headBefore);ee.anchorAfter=bv(ee.anchorAfter);ee.readAfter=bv(ee.headAfter);ee.copied=true}if(!ei){eh.splice(0,eg+1);eg=0}else{di(ee.anchorBefore);di(ee.headBefore);di(ee.anchorAfter);di(ee.headAfter)}}}function cr(ef,ei){var eh=ei.from.line,eg=ei.to.line,ee=ei.text.length-(eg-eh)-1;dy(ef.done,eh,eg,ee);dy(ef.undone,eh,eg,ee)}function df(){cT(this)}function W(ee){if(!ee.stop){ee.stop=df}return ee}function bO(ee){if(ee.preventDefault){ee.preventDefault()}else{ee.returnValue=false}}function ch(ee){if(ee.stopPropagation){ee.stopPropagation()}else{ee.cancelBubble=true}}function a6(ee){return ee.defaultPrevented!=null?ee.defaultPrevented:ee.returnValue==false}function cT(ee){bO(ee);ch(ee)}z.e_stop=cT;z.e_preventDefault=bO;z.e_stopPropagation=ch;function B(ee){return ee.target||ee.srcElement}function dW(ef){var ee=ef.which;if(ee==null){if(ef.button&1){ee=1}else{if(ef.button&2){ee=3}else{if(ef.button&4){ee=2}}}}if(bk&&ef.ctrlKey&&ee==1){ee=3}return ee}function bf(eh,ef,eg){if(eh.addEventListener){eh.addEventListener(ef,eg,false)}else{if(eh.attachEvent){eh.attachEvent("on"+ef,eg)}else{var ei=eh._handlers||(eh._handlers={});var ee=ei[ef]||(ei[ef]=[]);ee.push(eg)}}}function cL(ei,eg,eh){if(ei.removeEventListener){ei.removeEventListener(eg,eh,false)}else{if(ei.detachEvent){ei.detachEvent("on"+eg,eh)}else{var ee=ei._handlers&&ei._handlers[eg];if(!ee){return}for(var ef=0;ef<ee.length;++ef){if(ee[ef]==eh){ee.splice(ef,1);break}}}}}function af(ei,eh){var ee=ei._handlers&&ei._handlers[eh];if(!ee){return}var ef=Array.prototype.slice.call(arguments,2);for(var eg=0;eg<ee.length;++eg){ee[eg].apply(null,ef)}}var aO,bE=0;function M(ej,ei){var ee=ej._handlers&&ej._handlers[ei];if(!ee){return}var eg=Array.prototype.slice.call(arguments,2);if(!aO){++bE;aO=[];setTimeout(c1,0)}function ef(ek){return function(){ek.apply(null,eg)}}for(var eh=0;eh<ee.length;++eh){aO.push(ef(ee[eh]))}}function ap(ee,ef){af(ee,ef.type,ee,ef);return a6(ef)}function c1(){--bE;var ee=aO;aO=null;for(var ef=0;ef<ee.length;++ef){ee[ef]()}}function dB(eg,ef){var ee=eg._handlers&&eg._handlers[ef];return ee&&ee.length>0}z.on=bf;z.off=cL;z.signal=af;var aJ=30;var bp=z.Pass={toString:function(){return"CodeMirror.Pass"}};function ed(){this.id=null}ed.prototype={set:function(ee,ef){clearTimeout(this.id);this.id=setTimeout(ef,ee)}};function bb(eg,ee,ei,ej,ef){if(ee==null){ee=eg.search(/[^\s\u00a0]/);if(ee==-1){ee=eg.length}}for(var eh=ej||0,ek=ef||0;eh<ee;++eh){if(eg.charAt(eh)=="\t"){ek+=ei-(ek%ei)}else{++ek}}return ek}z.countColumn=bb;var av=[""];function bC(ee){while(av.length<=ee){av.push(dS(av)+" ")}return av[ee]}function dS(ee){return ee[ee.length-1]}function cu(ef){if(dl){ef.selectionStart=0;ef.selectionEnd=ef.value.length}else{try{ef.select()}catch(ee){}}}function cd(eh,ee){if(eh.indexOf){return eh.indexOf(ee)}for(var ef=0,eg=eh.length;ef<eg;++ef){if(eh[ef]==ee){return ef}}return -1}function bw(eh,ef){function ee(){}ee.prototype=eh;var eg=new ee();if(ef){ak(ef,eg)}return eg}function ak(ef,ee){if(!ee){ee={}}for(var eg in ef){if(ef.hasOwnProperty(eg)){ee[eg]=ef[eg]}}return ee}function S(eg){for(var ee=[],ef=0;ef<eg;++ef){ee.push(undefined)}return ee}function bH(ef){var ee=Array.prototype.slice.call(arguments,1);return function(){return ef.apply(null,ee)}}var aD=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function bK(ee){return/\w/.test(ee)||ee>"\x80"&&(ee.toUpperCase()!=ee.toLowerCase()||aD.test(ee))}function dh(ee){for(var ef in ee){if(ee.hasOwnProperty(ef)&&ee[ef]){return false}}return true}var dG=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;function d4(ee,ei,eh,eg){var ej=document.createElement(ee);if(eh){ej.className=eh}if(eg){ej.style.cssText=eg}if(typeof ei=="string"){n(ej,ei)}else{if(ei){for(var ef=0;ef<ei.length;++ef){ej.appendChild(ei[ef])}}}return ej}function cC(ef){for(var ee=ef.childNodes.length;ee>0;--ee){ef.removeChild(ef.firstChild)}return ef}function bc(ee,ef){return cC(ee).appendChild(ef)}function n(ee,ef){if(bx){ee.innerHTML="";ee.appendChild(document.createTextNode(ef))}else{ee.textContent=ef}}function al(ee){return ee.getBoundingClientRect()}z.replaceGetRect=function(ee){al=ee};var dc=function(){if(bx){return false}var ee=d4("div");return"draggable" in ee||"dragDrop" in ee}();function bo(){return false}if(bB){bo=function(ef,ee){return ef.charCodeAt(ee-1)==36&&ef.charCodeAt(ee)==39}}else{if(ae&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)){bo=function(ef,ee){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(ef.slice(ee-1,ee+1))}}else{if(b1){bo=function(ef,ee){if(ee>1&&ef.charCodeAt(ee-1)==45&&/\w/.test(ef.charAt(ee-2))&&/[^\-?\.]/.test(ef.charAt(ee))){return true}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(ef.slice(ee-1,ee+1))}}}}var cX;function i(ee){if(cX!=null){return cX}var ef=d4("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");bc(ee,ef);if(ef.offsetWidth){cX=ef.offsetHeight-ef.clientHeight}return cX||0}var dV;function aP(ee){if(dV==null){var ef=d4("span","\u200b");bc(ee,d4("span",[ef,document.createTextNode("x")]));if(ee.firstChild.offsetHeight!=0){dV=ef.offsetWidth<=1&&ef.offsetHeight>2&&!by}}if(dV){return d4("span","\u200b")}else{return d4("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}}var aw="\n\nb".split(/\n/).length!=3?function(ej){var ek=0,ee=[],ei=ej.length;while(ek<=ei){var eh=ej.indexOf("\n",ek);if(eh==-1){eh=ej.length}var eg=ej.slice(ek,ej.charAt(eh-1)=="\r"?eh-1:eh);var ef=eg.indexOf("\r");if(ef!=-1){ee.push(eg.slice(0,ef));ek+=ef+1}else{ee.push(eg);ek=eh+1}}return ee}:function(ee){return ee.split(/\r\n?|\n/)};z.splitLines=aw;var aT=window.getSelection?function(ef){try{return ef.selectionStart!=ef.selectionEnd}catch(ee){return false}}:function(eg){try{var ee=eg.ownerDocument.selection.createRange()}catch(ef){}if(!ee||ee.parentElement()!=eg){return false}return ee.compareEndPoints("StartToEnd",ee)!=0};var b8=(function(){var ee=d4("div");if("oncopy" in ee){return true}ee.setAttribute("oncopy","return;");return typeof ee.oncopy=="function"})();var dx={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",109:"-",107:"=",127:"Delete",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"};z.keyNames=dx;(function(){for(var ee=0;ee<10;ee++){dx[ee+48]=String(ee)}for(var ee=65;ee<=90;ee++){dx[ee]=String.fromCharCode(ee)}for(var ee=1;ee<=12;ee++){dx[ee+111]=dx[ee+63235]="F"+ee}})();function cD(ee,ej,ei,eh){if(!ee){return eh(ej,ei,"ltr")}for(var eg=0;eg<ee.length;++eg){var ef=ee[eg];if(ef.from<ei&&ef.to>ej||ej==ei&&ef.to==ej){eh(Math.max(ef.from,ej),Math.min(ef.to,ei),ef.level==1?"rtl":"ltr")}}}function cn(ee){return ee.level%2?ee.to:ee.from}function ea(ee){return ee.level%2?ee.from:ee.to}function bN(ef){var ee=a(ef);return ee?cn(ee[0]):0}function bX(ef){var ee=a(ef);if(!ee){return ef.text.length}return ea(dS(ee))}function aU(ef,ei){var eg=dv(ef.doc,ei);var ej=t(ef.doc,eg);if(ej!=eg){ei=a8(ej)}var ee=a(ej);var eh=!ee?0:ee[0].level%2?bX(ej):bN(ej);return I(ei,eh)}function cx(eg,ej){var ef,eh;while(ef=cW(eh=dv(eg.doc,ej))){ej=ef.find().to.line}var ee=a(eh);var ei=!ee?eh.text.length:ee[0].level%2?bN(eh):bX(eh);return I(ej,ei)}function V(ef,eg,ee){var eh=ef[0].level;if(eg==eh){return true}if(ee==eh){return false}return eg<ee}var dm;function ah(ee,ei){for(var ef=0,eg;ef<ee.length;++ef){var eh=ee[ef];if(eh.from<ei&&eh.to>ei){dm=null;return ef}if(eh.from==ei||eh.to==ei){if(eg==null){eg=ef}else{if(V(ee,eh.level,ee[eg].level)){dm=eg;return ef}else{dm=ef;return eg}}}}dm=null;return eg}function du(ee,eh,ef,eg){if(!eg){return eh+ef}do{eh+=ef}while(eh>0&&dG.test(ee.text.charAt(eh)));return eh}function q(ee,el,eg,eh){var ei=a(ee);if(!ei){return P(ee,el,eg,eh)}var ek=ah(ei,el),ef=ei[ek];var ej=du(ee,el,ef.level%2?-eg:eg,eh);for(;;){if(ej>ef.from&&ej<ef.to){return ej}if(ej==ef.from||ej==ef.to){if(ah(ei,ej)==ek){return ej}ef=ei[ek+=eg];return(eg>0)==ef.level%2?ef.to:ef.from}else{ef=ei[ek+=eg];if(!ef){return null}if((eg>0)==ef.level%2){ej=du(ee,ef.to,-1,eh)}else{ej=du(ee,ef.from,1,eh)}}}}function P(ee,ei,ef,eg){var eh=ei+ef;if(eg){while(eh>0&&dG.test(ee.text.charAt(eh))){eh+=ef}}return eh<0||eh>ee.text.length?null:eh}var aH=(function(){var ek="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var ei="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";function eh(en){if(en<=255){return ek.charAt(en)}else{if(1424<=en&&en<=1524){return"R"}else{if(1536<=en&&en<=1791){return ei.charAt(en-1536)}else{if(1792<=en&&en<=2220){return"r"}else{return"L"}}}}}var ee=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var em=/[stwN]/,eg=/[LRr]/,ef=/[Lb1n]/,ej=/[1n]/;var el="L";return function(ex){if(!ee.test(ex)){return false}var eD=ex.length,et=[];for(var eC=0,ep;eC<eD;++eC){et.push(ep=eh(ex.charCodeAt(eC)))}for(var eC=0,ew=el;eC<eD;++eC){var ep=et[eC];if(ep=="m"){et[eC]=ew}else{ew=ep}}for(var eC=0,en=el;eC<eD;++eC){var ep=et[eC];if(ep=="1"&&en=="r"){et[eC]="n"}else{if(eg.test(ep)){en=ep;if(ep=="r"){et[eC]="R"}}}}for(var eC=1,ew=et[0];eC<eD-1;++eC){var ep=et[eC];if(ep=="+"&&ew=="1"&&et[eC+1]=="1"){et[eC]="1"}else{if(ep==","&&ew==et[eC+1]&&(ew=="1"||ew=="n")){et[eC]=ew}}ew=ep}for(var eC=0;eC<eD;++eC){var ep=et[eC];if(ep==","){et[eC]="N"}else{if(ep=="%"){for(var eq=eC+1;eq<eD&&et[eq]=="%";++eq){}var eE=(eC&&et[eC-1]=="!")||(eq<eD-1&&et[eq]=="1")?"1":"N";for(var eA=eC;eA<eq;++eA){et[eA]=eE}eC=eq-1}}}for(var eC=0,en=el;eC<eD;++eC){var ep=et[eC];if(en=="L"&&ep=="1"){et[eC]="L"}else{if(eg.test(ep)){en=ep}}}for(var eC=0;eC<eD;++eC){if(em.test(et[eC])){for(var eq=eC+1;eq<eD&&em.test(et[eq]);++eq){}var eu=(eC?et[eC-1]:el)=="L";var eo=(eq<eD-1?et[eq]:el)=="L";var eE=eu||eo?"L":"R";for(var eA=eC;eA<eq;++eA){et[eA]=eE}eC=eq-1}}var eB=[],ey;for(var eC=0;eC<eD;){if(ef.test(et[eC])){var er=eC;for(++eC;eC<eD&&ef.test(et[eC]);++eC){}eB.push({from:er,to:eC,level:0})}else{var es=eC,ev=eB.length;for(++eC;eC<eD&&et[eC]!="L";++eC){}for(var eA=es;eA<eC;){if(ej.test(et[eA])){if(es<eA){eB.splice(ev,0,{from:es,to:eA,level:1})}var ez=eA;for(++eA;eA<eC&&ej.test(et[eA]);++eA){}eB.splice(ev,0,{from:ez,to:eA,level:2});es=eA}else{++eA}}if(es<eC){eB.splice(ev,0,{from:es,to:eC,level:1})}}}if(eB[0].level==1&&(ey=ex.match(/^\s+/))){eB[0].from=ey[0].length;eB.unshift({from:0,to:ey[0].length,level:0})}if(dS(eB).level==1&&(ey=ex.match(/\s+$/))){dS(eB).to-=ey[0].length;eB.push({from:eD-ey[0].length,to:eD,level:0})}if(eB[0].level!=dS(eB).level){eB.push({from:eD,to:eD,level:eB[0].level})}return eB}})();z.version="3.14.0";return z})();
\ No newline at end of file
Binary files /dev/null and b/misc/mbedJS/mbed.html/c/codemirror-mini.zip differ
--- /dev/null
+++ b/misc/mbedJS/mbed.html/c/codemirror_jsedit-mini.js
@@ -0,0 +1 @@
1+CodeMirror.defineMode("css",function(a){return CodeMirror.getMode(a,"text/css")});CodeMirror.defineMode("css-base",function(b,d){var e=b.indentUnit,o=d.hooks||{},n=d.atMediaTypes||{},k=d.atMediaFeatures||{},j=d.propertyKeywords||{},l=d.colorKeywords||{},h=d.valueKeywords||{},a=!!d.allowNested,i=null;function g(p,q){i=q;return p}function c(s,r){var q=s.next();if(o[q]){var p=o[q](s,r);if(p!==false){return p}}if(q=="@"){s.eatWhile(/[\w\\\-]/);return g("def",s.current())}else{if(q=="="){g(null,"compare")}else{if((q=="~"||q=="|")&&s.eat("=")){return g(null,"compare")}else{if(q=='"'||q=="'"){r.tokenize=m(q);return r.tokenize(s,r)}else{if(q=="#"){s.eatWhile(/[\w\\\-]/);return g("atom","hash")}else{if(q=="!"){s.match(/^\s*\w*/);return g("keyword","important")}else{if(/\d/.test(q)){s.eatWhile(/[\w.%]/);return g("number","unit")}else{if(q==="-"){if(/\d/.test(s.peek())){s.eatWhile(/[\w.%]/);return g("number","unit")}else{if(s.match(/^[^-]+-/)){return g("meta","meta")}}}else{if(/[,+>*\/]/.test(q)){return g(null,"select-op")}else{if(q=="."&&s.match(/^-?[_a-z][_a-z0-9-]*/i)){return g("qualifier","qualifier")}else{if(q==":"){return g("operator",q)}else{if(/[;{}\[\]\(\)]/.test(q)){return g(null,q)}else{if(q=="u"&&s.match("rl(")){s.backUp(1);r.tokenize=f;return g("property","variable")}else{s.eatWhile(/[\w\\\-]/);return g("property","variable")}}}}}}}}}}}}}}function m(p,q){return function(u,s){var t=false,r;while((r=u.next())!=null){if(r==p&&!t){break}t=!t&&r=="\\"}if(!t){if(q){u.backUp(1)}s.tokenize=c}return g("string","string")}}function f(q,p){q.next();if(!q.match(/\s*[\"\']/,false)){p.tokenize=m(")",true)}else{p.tokenize=c}return g(null,"(")}return{startState:function(p){return{tokenize:c,baseIndent:p||0,stack:[]}},token:function(u,s){s.tokenize=s.tokenize||c;if(s.tokenize==c&&u.eatSpace()){return null}var r=s.tokenize(u,s);if(r&&typeof r!="string"){r=g(r[0],r[1])}var q=s.stack[s.stack.length-1];if(r=="variable"){if(i=="variable-definition"){s.stack.push("propertyValue")}return"variable-2"}else{if(r=="property"){var t=u.current().toLowerCase();if(q=="propertyValue"){if(h.hasOwnProperty(t)){r="string-2"}else{if(l.hasOwnProperty(t)){r="keyword"}else{r="variable-2"}}}else{if(q=="rule"){if(!j.hasOwnProperty(t)){r+=" error"}}else{if(q=="block"){if(j.hasOwnProperty(t)){r="property"}else{if(l.hasOwnProperty(t)){r="keyword"}else{if(h.hasOwnProperty(t)){r="string-2"}else{r="tag"}}}}else{if(!q||q=="@media{"){r="tag"}else{if(q=="@media"){if(n[u.current()]){r="attribute"}else{if(/^(only|not)$/.test(t)){r="keyword"}else{if(t=="and"){r="error"}else{if(k.hasOwnProperty(t)){r="error"}else{r="attribute error"}}}}}else{if(q=="@mediaType"){if(n.hasOwnProperty(t)){r="attribute"}else{if(t=="and"){r="operator"}else{if(/^(only|not)$/.test(t)){r="error"}else{r="error"}}}}else{if(q=="@mediaType("){if(j.hasOwnProperty(t)){}else{if(n.hasOwnProperty(t)){r="error"}else{if(t=="and"){r="operator"}else{if(/^(only|not)$/.test(t)){r="error"}else{r+=" error"}}}}}else{if(q=="@import"){r="tag"}else{r="error"}}}}}}}}}else{if(r=="atom"){if(!q||q=="@media{"||q=="block"){r="builtin"}else{if(q=="propertyValue"){if(!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(u.current())){r+=" error"}}else{r="error"}}}else{if(q=="@media"&&i=="{"){r="error"}}}}if(i=="{"){if(q=="@media"||q=="@mediaType"){s.stack.pop();s.stack[s.stack.length-1]="@media{"}else{var v=a?"block":"rule";s.stack.push(v)}}else{if(i=="}"){var p=s.stack[s.stack.length-1];if(p=="interpolation"){r="operator"}s.stack.pop();if(q=="propertyValue"){s.stack.pop()}}else{if(i=="interpolation"){s.stack.push("interpolation")}else{if(i=="@media"){s.stack.push("@media")}else{if(i=="@import"){s.stack.push("@import")}else{if(q=="@media"&&/\b(keyword|attribute)\b/.test(r)){s.stack.push("@mediaType")}else{if(q=="@mediaType"&&u.current()==","){s.stack.pop()}else{if(q=="@mediaType"&&i=="("){s.stack.push("@mediaType(")}else{if(q=="@mediaType("&&i==")"){s.stack.pop()}else{if((q=="rule"||q=="block")&&i==":"){s.stack.push("propertyValue")}else{if(q=="propertyValue"&&i==";"){s.stack.pop()}else{if(q=="@import"&&i==";"){s.stack.pop()}}}}}}}}}}}}return r},indent:function(q,p){var r=q.stack.length;if(/^\}/.test(p)){r-=q.stack[q.stack.length-1]=="propertyValue"?2:1}return q.baseIndent+r*e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/"}});(function(){function b(k){var j={};for(var h=0;h<k.length;++h){j[k[h]]=true}return j}var e=b(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]);var g=b(["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]);var d=b(["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-shadow","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"]);var c=b(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);var f=b(["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","overlay","overline","padding","padding-box","painted","paused","persian","plus-darker","plus-lighter","pointer","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"]);function a(k,j){var h=false,i;while((i=k.next())!=null){if(h&&i=="/"){j.tokenize=null;break}h=(i=="*")}return["comment","comment"]}CodeMirror.defineMIME("text/css",{atMediaTypes:e,atMediaFeatures:g,propertyKeywords:d,colorKeywords:c,valueKeywords:f,hooks:{"<":function(j,i){function h(n,m){var l=0,k;while((k=n.next())!=null){if(l>=2&&k==">"){m.tokenize=null;break}l=(k=="-")?l+1:0}return["comment","comment"]}if(j.eat("!")){i.tokenize=h;return h(j,i)}},"/":function(i,h){if(i.eat("*")){h.tokenize=a;return a(i,h)}return false}},name:"css-base"});CodeMirror.defineMIME("text/x-scss",{atMediaTypes:e,atMediaFeatures:g,propertyKeywords:d,colorKeywords:c,valueKeywords:f,allowNested:true,hooks:{"$":function(h){h.match(/^[\w-]+/);if(h.peek()==":"){return["variable","variable-definition"]}return["variable","variable"]},"/":function(i,h){if(i.eat("/")){i.skipToEnd();return["comment","comment"]}else{if(i.eat("*")){h.tokenize=a;return a(i,h)}else{return["operator","operator"]}}},"#":function(h){if(h.eat("{")){return["operator","interpolation"]}else{h.eatWhile(/[\w\\\-]/);return["atom","hash"]}}},name:"css-base"})})();CodeMirror.defineMode("htmlmixed",function(b,c){var a=CodeMirror.getMode(b,{name:"xml",htmlMode:true});var m=CodeMirror.getMode(b,"css");var k=[],j=c&&c.scriptTypes;k.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(b,"javascript")});if(j){for(var d=0;d<j.length;++d){var h=j[d];k.push({matches:h.matches,mode:h.mode&&CodeMirror.getMode(b,h.mode)})}}k.push({matches:/./,mode:CodeMirror.getMode(b,"text/plain")});function e(s,q){var o=q.htmlState.tagName;var p=a.token(s,q.htmlState);if(o=="script"&&/\btag\b/.test(p)&&s.current()==">"){var t=s.string.slice(Math.max(0,s.pos-100),s.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);t=t?t[1]:"";if(t&&/[\"\']/.test(t.charAt(0))){t=t.slice(1,t.length-1)}for(var n=0;n<k.length;++n){var r=k[n];if(typeof r.matches=="string"?t==r.matches:r.matches.test(t)){if(r.mode){q.token=l;q.localMode=r.mode;q.localState=r.mode.startState&&r.mode.startState(a.indent(q.htmlState,""))}break}}}else{if(o=="style"&&/\btag\b/.test(p)&&s.current()==">"){q.token=f;q.localMode=m;q.localState=m.startState(a.indent(q.htmlState,""))}}return p}function g(r,n,o){var q=r.current();var p=q.search(n),i;if(p>-1){r.backUp(q.length-p)}else{if(i=q.match(/<\/?$/)){r.backUp(q.length);if(!r.match(n,false)){r.match(q[0])}}}return o}function l(n,i){if(n.match(/^<\/\s*script\s*>/i,false)){i.token=e;i.localState=i.localMode=null;return e(n,i)}return g(n,/<\/\s*script\s*>/,i.localMode.token(n,i.localState))}function f(n,i){if(n.match(/^<\/\s*style\s*>/i,false)){i.token=e;i.localState=i.localMode=null;return e(n,i)}return g(n,/<\/\s*style\s*>/,m.token(n,i.localState))}return{startState:function(){var i=a.startState();return{token:e,localMode:null,localState:null,htmlState:i}},copyState:function(n){if(n.localState){var i=CodeMirror.copyState(n.localMode,n.localState)}return{token:n.token,localMode:n.localMode,localState:i,htmlState:CodeMirror.copyState(a,n.htmlState)}},token:function(n,i){return i.token(n,i)},indent:function(n,i){if(!n.localMode||/^\s*<\//.test(i)){return a.indent(n.htmlState,i)}else{if(n.localMode.indent){return n.localMode.indent(n.localState,i)}else{return CodeMirror.Pass}}},electricChars:"/{}:",innerMode:function(i){return{state:i.localState||i.htmlState,mode:i.localMode||a}}}},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");CodeMirror.defineMode("javascript",function(P,U){var x=P.indentUnit;var Z=U.statementIndent;var Y=U.json;var B=U.typescript;var b=function(){function al(an){return{type:an,style:"keyword"}}var ag=al("keyword a"),ae=al("keyword b"),ad=al("keyword c");var af=al("operator"),aj={type:"atom",style:"atom"};var ah={"if":al("if"),"while":ag,"with":ag,"else":ae,"do":ae,"try":ae,"finally":ae,"return":ad,"break":ad,"continue":ad,"new":ad,"delete":ad,"throw":ad,"var":al("var"),"const":al("var"),let:al("var"),"function":al("function"),"catch":al("catch"),"for":al("for"),"switch":al("switch"),"case":al("case"),"default":al("default"),"in":af,"typeof":af,"instanceof":af,"true":aj,"false":aj,"null":aj,"undefined":aj,"NaN":aj,"Infinity":aj,"this":al("this")};if(B){var am={type:"variable",style:"variable-3"};var ai={"interface":al("interface"),"class":al("class"),"extends":al("extends"),constructor:al("constructor"),"public":al("public"),"private":al("private"),"protected":al("protected"),"static":al("static"),"super":al("super"),string:am,number:am,bool:am,any:am};for(var ak in ai){ah[ak]=ai[ak]}}return ah}();var V=/[+\-*&%=<>!?|~^]/;function ab(af,ae,ad){ae.tokenize=ad;return ad(af,ae)}function h(ag,ad){var af=false,ae;while((ae=ag.next())!=null){if(ae==ad&&!af){return false}af=!af&&ae=="\\"}return af}var ac,q;function I(af,ae,ad){ac=af;q=ad;return ae}function m(ah,af){var ad=ah.next();if(ad=='"'||ad=="'"){return ab(ah,af,C(ad))}else{if(/[\[\]{}\(\),;\:\.]/.test(ad)){return I(ad)}else{if(ad=="0"&&ah.eat(/x/i)){ah.eatWhile(/[\da-f]/i);return I("number","number")}else{if(/\d/.test(ad)||ad=="-"&&ah.eat(/\d/)){ah.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return I("number","number")}else{if(ad=="/"){if(ah.eat("*")){return ab(ah,af,f)}else{if(ah.eat("/")){ah.skipToEnd();return I("comment","comment")}else{if(af.lastType=="operator"||af.lastType=="keyword c"||/^[\[{}\(,;:]$/.test(af.lastType)){h(ah,"/");ah.eatWhile(/[gimy]/);return I("regexp","string-2")}else{ah.eatWhile(V);return I("operator",null,ah.current())}}}}else{if(ad=="#"){ah.skipToEnd();return I("error","error")}else{if(V.test(ad)){ah.eatWhile(V);return I("operator",null,ah.current())}else{ah.eatWhile(/[\w\$_]/);var ag=ah.current(),ae=b.propertyIsEnumerable(ag)&&b[ag];return(ae&&af.lastType!=".")?I(ae.type,ae.style,ag):I("variable","variable",ag)}}}}}}}}function C(ad){return function(af,ae){if(!h(af,ad)){ae.tokenize=m}return I("string","string")}}function f(ag,af){var ad=false,ae;while(ae=ag.next()){if(ae=="/"&&ad){af.tokenize=m;break}ad=(ae=="*")}return I("comment","comment")}var l={atom:true,number:true,variable:true,string:true,regexp:true,"this":true};function v(ai,ae,ad,ah,af,ag){this.indented=ai;this.column=ae;this.type=ad;this.prev=af;this.info=ag;if(ah!=null){this.align=ah}}function y(af,ae){for(var ad=af.localVars;ad;ad=ad.next){if(ad.name==ae){return true}}}function K(ah,ae,ad,ag,ai){var aj=ah.cc;w.state=ah;w.stream=ai;w.marked=null,w.cc=aj;if(!ah.lexical.hasOwnProperty("align")){ah.lexical.align=true}while(true){var af=aj.length?aj.pop():Y?z:A;if(af(ad,ag)){while(aj.length&&aj[aj.length-1].lex){aj.pop()()}if(w.marked){return w.marked}if(ad=="variable"&&y(ah,ag)){return"variable-2"}return ae}}}var w={state:null,column:null,marked:null,cc:null};function a(){for(var ad=arguments.length-1;ad>=0;ad--){w.cc.push(arguments[ad])}}function N(){a.apply(null,arguments);return true}function n(ae){function ad(ah){for(var ag=ah;ag;ag=ag.next){if(ag.name==ae){return true}}return false}var af=w.state;if(af.context){w.marked="def";if(ad(af.localVars)){return}af.localVars={name:ae,next:af.localVars}}else{if(ad(af.globalVars)){return}af.globalVars={name:ae,next:af.globalVars}}}var J={name:"this",next:{name:"arguments"}};function u(){w.state.context={prev:w.state.context,vars:w.state.localVars};w.state.localVars=J}function t(){w.state.localVars=w.state.context.vars;w.state.context=w.state.context.prev}function k(ae,af){var ad=function(){var ah=w.state,ag=ah.indented;if(ah.lexical.type=="stat"){ag=ah.lexical.indented}ah.lexical=new v(ag,w.stream.column(),ae,null,ah.lexical,af)};ad.lex=true;return ad}function M(){var ad=w.state;if(ad.lexical.prev){if(ad.lexical.type==")"){ad.indented=ad.lexical.indented}ad.lexical=ad.lexical.prev}}M.lex=true;function c(ad){return function(ae){if(ae==ad){return N()}else{if(ad==";"){return a()}else{return N(arguments.callee)}}}}function A(ad){if(ad=="var"){return N(k("vardef"),Q,c(";"),M)}if(ad=="keyword a"){return N(k("form"),z,A,M)}if(ad=="keyword b"){return N(k("form"),A,M)}if(ad=="{"){return N(k("}"),o,M)}if(ad==";"){return N()}if(ad=="if"){return N(k("form"),z,A,M,L(w.state.indented))}if(ad=="function"){return N(i)}if(ad=="for"){return N(k("form"),c("("),k(")"),g,c(")"),M,A,M)}if(ad=="variable"){return N(k("stat"),H)}if(ad=="switch"){return N(k("form"),z,k("}","switch"),c("{"),o,M,M)}if(ad=="case"){return N(z,c(":"))}if(ad=="default"){return N(c(":"))}if(ad=="catch"){return N(k("form"),u,c("("),r,c(")"),A,M,t)}return a(k("stat"),z,c(";"),M)}function z(ad){return S(ad,false)}function T(ad){return S(ad,true)}function S(ad,af){var ae=af?j:F;if(l.hasOwnProperty(ad)){return N(ae)}if(ad=="function"){return N(i)}if(ad=="keyword c"){return N(af?E:G)}if(ad=="("){return N(k(")"),G,c(")"),M,ae)}if(ad=="operator"){return N(af?T:z)}if(ad=="["){return N(k("]"),W(T,"]"),M,ae)}if(ad=="{"){return N(k("}"),W(p,"}"),M,ae)}return N()}function G(ad){if(ad.match(/[;\}\)\],]/)){return a()}return a(z)}function E(ad){if(ad.match(/[;\}\)\],]/)){return a()}return a(T)}function F(ad,ae){if(ad==","){return N(z)}return j(ad,ae,F)}function j(ad,af,ae){if(!ae){ae=j}if(ad=="operator"){if(/\+\+|--/.test(af)){return N(ae)}if(af=="?"){return N(z,c(":"),z)}return N(z)}if(ad==";"){return}if(ad=="("){return N(k(")","call"),W(T,")"),M,ae)}if(ad=="."){return N(X,ae)}if(ad=="["){return N(k("]"),z,c("]"),M,ae)}}function H(ad){if(ad==":"){return N(M,A)}return a(F,c(";"),M)}function X(ad){if(ad=="variable"){w.marked="property";return N()}}function p(ad,ae){if(ad=="variable"){w.marked="property";if(ae=="get"||ae=="set"){return N(D)}}else{if(ad=="number"||ad=="string"){w.marked=ad+" property"}}if(l.hasOwnProperty(ad)){return N(c(":"),T)}}function D(ad){if(ad==":"){return N(z)}if(ad!="variable"){return N(c(":"),z)}w.marked="property";return N(i)}function W(af,ad){function ae(ah){if(ah==","){var ag=w.state.lexical;if(ag.info=="call"){ag.pos=(ag.pos||0)+1}return N(af,ae)}if(ah==ad){return N()}return N(c(ad))}return function(ag){if(ag==ad){return N()}else{return a(af,ae)}}}function o(ad){if(ad=="}"){return N()}return a(A,o)}function s(ad){if(ad==":"){return N(aa)}return a()}function aa(ad){if(ad=="variable"){w.marked="variable-3";return N()}return a()}function Q(ad,ae){if(ad=="variable"){n(ae);return B?N(s,O):N(O)}return a()}function O(ad,ae){if(ae=="="){return N(T,O)}if(ad==","){return N(Q)}}function L(ad){return function(ae,af){if(ae=="keyword b"&&af=="else"){w.state.lexical=new v(ad,0,"form",null,w.state.lexical);return N(A,M)}return a()}}function g(ad){if(ad=="var"){return N(Q,c(";"),e)}if(ad==";"){return N(e)}if(ad=="variable"){return N(R)}return a(z,c(";"),e)}function R(ad,ae){if(ae=="in"){return N(z)}return N(F,e)}function e(ad,ae){if(ad==";"){return N(d)}if(ae=="in"){return N(z)}return a(z,c(";"),d)}function d(ad){if(ad!=")"){N(z)}}function i(ad,ae){if(ad=="variable"){n(ae);return N(i)}if(ad=="("){return N(k(")"),u,W(r,")"),M,A,t)}}function r(ad,ae){if(ad=="variable"){n(ae);return B?N(s):N()}}return{startState:function(ad){return{tokenize:m,lastType:null,cc:[],lexical:new v((ad||0)-x,0,"block",false),localVars:U.localVars,globalVars:U.globalVars,context:U.localVars&&{vars:U.localVars},indented:0}},token:function(af,ae){if(af.sol()){if(!ae.lexical.hasOwnProperty("align")){ae.lexical.align=false}ae.indented=af.indentation()}if(ae.tokenize!=f&&af.eatSpace()){return null}var ad=ae.tokenize(af,ae);if(ac=="comment"){return ad}ae.lastType=ac=="operator"&&(q=="++"||q=="--")?"incdec":ac;return K(ae,ad,ac,q,af)},indent:function(ai,ad){if(ai.tokenize==f){return CodeMirror.Pass}if(ai.tokenize!=m){return 0}var ah=ad&&ad.charAt(0),af=ai.lexical;if(af.type=="stat"&&ah=="}"){af=af.prev}if(Z&&af.type==")"&&af.prev.type=="stat"){af=af.prev}var ag=af.type,ae=ah==ag;if(ag=="vardef"){return af.indented+(ai.lastType=="operator"||ai.lastType==","?4:0)}else{if(ag=="form"&&ah=="{"){return af.indented}else{if(ag=="form"){return af.indented+x}else{if(ag=="stat"){return af.indented+(ai.lastType=="operator"||ai.lastType==","?Z||x:0)}else{if(af.info=="switch"&&!ae&&U.doubleIndentSwitch!=false){return af.indented+(/^(?:case|default)\b/.test(ad)?x:2*x)}else{if(af.align){return af.column+(ae?0:1)}else{return af.indented+(ae?0:x)}}}}}}},electricChars:":{}",blockCommentStart:Y?null:"/*",blockCommentEnd:Y?null:"*/",lineComment:Y?null:"//",jsonMode:Y}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("text/ecmascript","javascript");CodeMirror.defineMIME("application/javascript","javascript");CodeMirror.defineMIME("application/ecmascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:true});CodeMirror.defineMIME("application/x-json",{name:"javascript",json:true});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:true});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:true});CodeMirror.defineMode("xml",function(A,k){var r=A.indentUnit;var z=k.multilineTagIndentFactor||1;var x=k.htmlMode?{autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false};var a=k.alignCDATA;var f,g;function o(H,G){function E(J){G.tokenize=J;return J(H,G)}var F=H.next();if(F=="<"){if(H.eat("!")){if(H.eat("[")){if(H.match("CDATA[")){return E(w("atom","]]>"))}else{return null}}else{if(H.match("--")){return E(w("comment","-->"))}else{if(H.match("DOCTYPE",true,true)){H.eatWhile(/[\w\._\-]/);return E(B(1))}else{return null}}}}else{if(H.eat("?")){H.eatWhile(/[\w\._\-]/);G.tokenize=w("meta","?>");return"meta"}else{var C=H.eat("/");f="";var I;while((I=H.eat(/[^\s\u00a0=<>\"\'\/?]/))){f+=I}if(!f){return"error"}g=C?"closeTag":"openTag";G.tokenize=n;return"tag"}}}else{if(F=="&"){var D;if(H.eat("#")){if(H.eat("x")){D=H.eatWhile(/[a-fA-F\d]/)&&H.eat(";")}else{D=H.eatWhile(/[\d]/)&&H.eat(";")}}else{D=H.eatWhile(/[\w\.\-:]/)&&H.eat(";")}return D?"atom":"error"}else{H.eatWhile(/[^&<]/);return null}}}function n(E,D){var C=E.next();if(C==">"||(C=="/"&&E.eat(">"))){D.tokenize=o;g=C==">"?"endTag":"selfcloseTag";return"tag"}else{if(C=="="){g="equals";return null}else{if(C=="<"){return"error"}else{if(/[\'\"]/.test(C)){D.tokenize=j(C);return D.tokenize(E,D)}else{E.eatWhile(/[^\s\u00a0=<>\"\']/);return"word"}}}}}function j(C){return function(E,D){while(!E.eol()){if(E.next()==C){D.tokenize=n;break}}return"string"}}function w(D,C){return function(F,E){while(!F.eol()){if(F.match(C)){E.tokenize=o;break}F.next()}return D}}function B(C){return function(F,E){var D;while((D=F.next())!=null){if(D=="<"){E.tokenize=B(C+1);return E.tokenize(F,E)}else{if(D==">"){if(C==1){E.tokenize=o;break}else{E.tokenize=B(C-1);return E.tokenize(F,E)}}}}return"meta"}}var l,y,h;function b(){for(var C=arguments.length-1;C>=0;C--){l.cc.push(arguments[C])}}function e(){b.apply(null,arguments);return true}function i(C,E){var D=x.doNotIndent.hasOwnProperty(C)||(l.context&&l.context.noIndent);l.context={prev:l.context,tagName:C,indent:l.indented,startOfLine:E,noIndent:D}}function u(){if(l.context){l.context=l.context.prev}}function d(C){if(C=="openTag"){l.tagName=f;l.tagStart=y.column();return e(m,c(l.startOfLine))}else{if(C=="closeTag"){var D=false;if(l.context){if(l.context.tagName!=f){if(x.implicitlyClosed.hasOwnProperty(l.context.tagName.toLowerCase())){u()}D=!l.context||l.context.tagName!=f}}else{D=true}if(D){h="error"}return e(s(D))}}return e()}function c(C){return function(E){var D=l.tagName;l.tagName=l.tagStart=null;if(E=="selfcloseTag"||(E=="endTag"&&x.autoSelfClosers.hasOwnProperty(D.toLowerCase()))){q(D.toLowerCase());return e()}if(E=="endTag"){q(D.toLowerCase());i(D,C);return e()}return e()}}function s(C){return function(D){if(C){h="error"}if(D=="endTag"){u();return e()}h="error";return e(arguments.callee)}}function q(D){var C;while(true){if(!l.context){return}C=l.context.tagName.toLowerCase();if(!x.contextGrabbers.hasOwnProperty(C)||!x.contextGrabbers[C].hasOwnProperty(D)){return}u()}}function m(C){if(C=="word"){h="attribute";return e(p,m)}if(C=="endTag"||C=="selfcloseTag"){return b()}h="error";return e(m)}function p(C){if(C=="equals"){return e(v,m)}if(!x.allowMissing){h="error"}else{if(C=="word"){h="attribute"}}return(C=="endTag"||C=="selfcloseTag")?b():e()}function v(C){if(C=="string"){return e(t)}if(C=="word"&&x.allowUnquoted){h="string";return e()}h="error";return(C=="endTag"||C=="selfCloseTag")?b():e()}function t(C){if(C=="string"){return e(t)}else{return b()}}return{startState:function(){return{tokenize:o,cc:[],indented:0,startOfLine:true,tagName:null,tagStart:null,context:null}},token:function(F,E){if(!E.tagName&&F.sol()){E.startOfLine=true;E.indented=F.indentation()}if(F.eatSpace()){return null}h=g=f=null;var D=E.tokenize(F,E);E.type=g;if((D||g)&&D!="comment"){l=E;y=F;while(true){var C=E.cc.pop()||d;if(C(g||D)){break}}}E.startOfLine=false;return h||D},indent:function(F,C,E){var D=F.context;if((F.tokenize!=n&&F.tokenize!=o)||D&&D.noIndent){return E?E.match(/^(\s*)/)[0].length:0}if(F.tagName){return F.tagStart+r*z}if(a&&/<!\[CDATA\[/.test(C)){return 0}if(D&&/^<\//.test(C)){D=D.prev}while(D&&!D.startOfLine){D=D.prev}if(D){return D.indent+r}else{return 0}},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:k.htmlMode?"html":"xml"}});CodeMirror.defineMIME("text/xml","xml");CodeMirror.defineMIME("application/xml","xml");if(!CodeMirror.mimeModes.hasOwnProperty("text/html")){CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:true})};
\ No newline at end of file
--- /dev/null
+++ b/misc/mbedJS/mbed.html/c/mimicil-mini.js
@@ -0,0 +1 @@
1+CodeMirror.defineMode("z80",function(){var p=/^(and|x?or|add|sub|mul|mget|mput|ld)\b/i;var m=/^(not|sget)\b/i;var n=/^(shr|shl)\b/i;var b=/^(nop)\b/i;var l=/^(call|sput)\b/i;var i=/^(exit)\b/i;var e=/^(\.end)\b/i;var j=/^(\.d32)\b/i;var h=/^(0x[0-9a-f]{1,8}|[0-9]{1,10})\b/i;var d=/^(0x[0-9a-f]{1,2}|[0-9]{1,3})\b/i;var o=/^\#[01234567]\b/i;function a(r){return h.test(r)?"number":false}function q(r){return d.test(r)?"number":false}function k(r){return o.test(r)?"number":false}function g(r){return h.test(r)?"number":o.test(r)?"number":false}function c(r){return d.test(r)?"number":o.test(r)?"number":false}function f(r){return r==","?"keyword":false}return{startState:function(){return{context:[]}},token:function(v,u){if(!v.column()){u.context=null}if(v.eatSpace()){return null}if(v.eatWhile(/\w|\#|\./)){var s=v.current();if(u.context==null){if(p.test(s)){u.context=[k,f,g]}else{if(m.test(s)){u.context=[k]}else{if(n.test(s)){u.context=[k,f,c]}else{if(b.test(s)){u.context=[q]}else{if(l.test(s)){u.context=[g]}else{if(i.test(s)){u.context=[]}else{if(e.test(s)){u.context=[];return"def"}else{if(j.test(s)){u.context=[a];return"def"}else{return"error"}}}}}}}}return"keyword"}else{if(u.context.length!=0){var t=u.context[0](s);if(t!==false){u.context.shift();return t}}}return"error"}if(v.eat(",")){var s=v.current();if(u.context.length!=0){var t=u.context[0](s);if(t!==false){u.context.shift();return t}}return"error"}if(v.eat(";")){v.skipToEnd();return"comment"}else{v.next()}return null}}});CodeMirror.defineMIME("text/x-imicil","MiMicIL");
\ No newline at end of file
--- /dev/null
+++ b/misc/mbedJS/mbed.html/dir.html
@@ -0,0 +1,109 @@
1+<!DOCTYPE html>
2+<html lang="ja">
3+<head>
4+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+ <title>Index of</title>
6+ <link href="./mimic.css" rel="stylesheet" type="text/css">
7+ <script src="./slib.js"></script>
8+ <style>
9+ .header{
10+ text-align:center;
11+ }
12+ .header b{
13+ font-size:24pt;
14+ }
15+ table{
16+ text-align:left;
17+ }
18+ td{
19+ padding:0px 20px 10px 10px;
20+ }
21+ th{
22+ padding:5px 5px 10px 10px;
23+ }
24+ td>a,td>span{
25+ margin-right:10px;
26+ }
27+ .hide{
28+ color:#aaaaaa;
29+ }
30+ </style>
31+ <script langurge="Javascript">
32+function gElem(id){return document.getElementById(id);}
33+function newElem(n){return document.createElement(n);}
34+ function makeParent(d)
35+ {
36+ var s=d.split('/');
37+ var ret="/";
38+ for(var i=1;i<s.length-2;i++){
39+ ret+=s[i]+"/";
40+ }
41+ return ret;
42+ }
43+ function confirm_remove(n)
44+ {
45+ if(window.confirm('Are you sure you want to delete the file?\n'+n)){
46+ try{
47+ if(slib.xhr("/fio/remove.api?name="+n,null).status!=200){
48+ throw "Bad XHR fio status code.";
49+ }
50+ window.location.reload();
51+ }catch(e){
52+ alert("Failed to save the file.\n"+e);
53+ }
54+ }
55+ }
56+ function action_line(dir,di)
57+ {
58+ var r="";
59+ var f=(di.mtype.indexOf("text/html")!=-1);
60+ r+=f?"<a href='./MiMicJSEditor.html?src="+dir+di.name+"'>edit</a>":"<span class='hide'>edit</span>";
61+ r+="<a href='javascript:void(0);' onclick='confirm_remove(\""+dir+di.name+"\");return false;'>remove</a>";
62+ return r;
63+ }
64+ function init()
65+ {
66+ var dir=slib.getUrlQuery(window.location.href)["dir"];
67+ var path=slib.getPath(window.location.href);
68+ if(dir==undefined){
69+ alert("Error");
70+ return;
71+ }
72+ var row="<tr><th>Name</th><th>Type</th><th>File size</th><th>Action</th></tr>";
73+ if(dir=="/"){
74+ gElem("idx").innerHTML="Index of "+dir;
75+ row+='<tr><td><a href="'+path+'?dir=/local/">/local/</a></td><td>mbed Local Drive</td><td>-</td></tr>';
76+ row+='<tr><td><a href="'+path+'?dir=/sd/">/sd/</a></td><td>SDFileSystem</td><td>-</td></tr>';
77+ }else{
78+ gElem("idx").innerHTML="Index of "+dir;
79+ var d=eval("("+slib.xhr(dir+"?list").responseText+")");
80+ var pdir=makeParent(dir);
81+ row+='<tr><td><a href="'+path+'?dir='+makeParent(dir)+'">../</a></td><td>Parent Directory</td><td></td></tr>';
82+ for(var i=0;i<d.list.length;i++){
83+ var di=d.list[i];
84+ if(di.mtype=="directory"){
85+ row+='<tr><td><a href="'+path+'?dir='+dir+di.name+'/">./'+di.name+'</a></td><td>'+di.mtype+'</td><td></td></tr>';
86+ }else{
87+ row+='<tr><td><a href="'+dir+di.name+'">'+di.name+'</a></td><td>'+di.mtype+'</td><td>'+(isFinite(di.size)?di.size:"unknown")+'</td>'
88+ +'<td>'+action_line(dir,di)+'</td>'
89+ +'</tr>';
90+ }
91+ }
92+ }
93+ gElem("tbl").innerHTML=row;
94+ }
95+ </script>
96+</head>
97+<body onload="init();">
98+<h1 style="float:left;"><img src="./mimiclogo.png"/><span id="idx" ></span></h1>
99+<div style="float:right;" ><a href="/">Return to top</a></div>
100+<hr style="clear:both;" />
101+<table><tbody id="tbl">
102+<tr><th>Name</th><th>MIME Type</th><th>File size</th></tr>
103+</tbody></table>
104+<div class="footer">
105+ MiMic project<br/>
106+ Copyright (C) 2011-2013 <a href="http://nyatla.jp/">nyatla.jp</a> All Rights Reserved.
107+</div>
108+</body>
109+</html>
--- /dev/null
+++ b/misc/mbedJS/mbed.html/index.html
@@ -0,0 +1,59 @@
1+<!DOCTYPE html>
2+<html lang="ja">
3+<head>
4+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+ <title>mbedJS</title>
6+ <link href="./mimic.css" rel="stylesheet" type="text/css">
7+ <style>
8+ .header{
9+ text-align:center;
10+ }
11+ .header b{
12+ font-size:32pt;
13+ }
14+ </style>
15+ <script>
16+function gElem(id){return document.getElementById(id);}
17+function init(){
18+ gElem("online_sp").href+="?host="+location.host;
19+}
20+ </script>
21+</head>
22+<body onload="init();">
23+<div class="header">
24+ <img src="./mimiclogo.png"/><br/>
25+ <b>mbedJS</b><br/>
26+</div>
27+<h2>About this page</h2>
28+Hello, This is mbedJS. If you can see this page, MiMic RPC system is running.<br/>
29+<h2>Onchip contents</h2>
30+<ul>
31+<li><a href="./setup.html">Setup</a><br/>This page setup mbedJS configulation.</li>
32+<li><a href="./dir.html?dir=/">Local FileSystem</a><br/>Browse mbed Local FileSystem and SD card(only connected).</li>
33+<li><a href="./MiMicJSEditor.html">JavaScript Editor</a><br/>MiMic JavaScript API test page. Here you can control mbed by JavaScript directly.</a>
34+</li>
35+</ul>
36+<h2>Internet contents</h2>
37+<ul>
38+<li><a href="http://nyatla.jp/mimic/wp/">MiMic Website</a><br/>MiMic Website!</li>
39+<li><a href="http://mbed.org/users/nyatla/code/mbedJS/">mbedJS repository</a><br/>mbedJS primary page. Source code here.</li>
40+<li><a href="http://mimic.sourceforge.jp/doc/mbedjs/current/">JavascriptAPI reference</a><br/>mbedJS API reference.</li>
41+<li><a href="http://sourceforge.jp/projects/mimic/">MiMic project(SorceForge)</a><br/>MiMic core library.</li>
42+<li><a href="http://nyatla.jp/mimic/online_sample/index.html" id="online_sp">Online Sample</a><br/>Various mbedJS contents.</li>
43+</ul>
44+
45+<h2>Reference</h2>
46+Software modules and development tool.
47+<ul>
48+<li><a href="http://sourceforge.jp/projects/mimic/">MiMic SDK</a><br/>This is core module of MiMic.</li>
49+<li><a href="http://codemirror.net/">CodeMirror</a><br/>Onchip code editors are developed based on CodeMirror.</li>
50+<li><a href="https://github.com/adamdunkels/uip">uIP</a><br/>MiMic IP protocol stack is based on uIP 1.0.</li>
51+<li><a href="http://mbed.org/">mbed.org</a><br/>mbedJS can be compile by mbed online compiler.</li>
52+<li><a href="http://www.jp.nxp.com/techzones/microcontrollers-techzone/tools-ecosystem/lpcxpresso.html">LPCXpresso</a>&nbsp;<a href="http://nxp-lpc.com/lpc_boards/lpcxpresso/">NXPセミコンダクターズジャパン</a><br/>MiMic also works with LPCXpresso1768(1769).</li>
53+</ul>
54+<div class="footer">
55+ MiMic project<br/>
56+ Copyright (C) 2011-2013 <a href="http://nyatla.jp/">nyatla.jp</a> All Rights Reserved.
57+</div>
58+</body>
59+</html>
--- /dev/null
+++ b/misc/mbedJS/mbed.html/m/mbedJS.all-min.js
@@ -0,0 +1 @@
1+var MiMicJS={};(function(){var d=MiMicJS;d.VERSION="MiMicJsAPI/2.0.0";d.assertInt=function a(o){if(!d.isArray(o)){if(!d.isInt(o)){throw new d.MiMicException()}}for(var p=0;p<o.length;p++){if(d.isInt(o[p])){continue}throw new d.MiMicException('"'+o[p]+'" is not integer.')}};d.assertNumber=function i(o){if(!d.isArray(o)){if(!d.isNumber(o)){throw new d.MiMicException()}}else{for(var p=0;p<o.length;p++){if(d.isNumber(o[p])){continue}throw new d.MiMicException('"'+o[p]+'" is not number.')}}};d.isNumber=function n(p){return(typeof p=="number")};d.isInt=function g(p){return(typeof p=="number")&&(p-Math.round(p)==0)};d.isGenerator=function e(p){if(!p){return false}return p.toString().indexOf("Generator")!=-1};d.getNow=function j(){return(new Date()).getTime()};d.isArray=function h(o){return o instanceof Array};d.isHashArray=function b(o){return(!(o instanceof Array))&&(typeof o=="object")};d.cloneAssoc=function f(o){var q={};for(var p in o){q[p]=o[p]}return q};d.hexout=function c(p,q){try{var t=["","0","00","000","0000","00000","000000","0000000"];var r=(p>>>0).toString(16).toLowerCase();if(r.length>q){throw new MiMicException(EE.NG)}var o=q-r.length;return t[o]+r}catch(u){throw new MiMicException(u)}};d.assocToStr=function m(o){var p="";for(k in o){p+=k+":"+o[k]+","}return p};d.using=function l(o){for(var p in o){window[p]=o[p]}}}());(function(){var a=MiMicJS;a.Error={OK:[0,"OK"],NG:[1073741824,"NG"],NG_YIELD_NOT_COMPLETED:[1073745921,"The previous function has not been completed."],NG_ILLEGAL_CALL:[1073745922,"Illegal procedure call."],NG_INVALID_ARG:[1073745923,"Invalid arguments."],isOK:function(b){return(1073741824&b)==0}}}());(function(){var b=MiMicJS;b.MiMicException=function a(){var f;if(typeof arguments.callee.caller=="function"){if(arguments.callee.caller.name.toString().length>0){f="function '"+arguments.callee.caller.name+"."}else{var d=arguments.callee.caller.toString();f="closure '"+d.substring(0,d.indexOf("{"))+"...'"}}else{f="root document"}var e="";switch(arguments.length){case 0:this.code=b.Error.NG[0];this.message=f+" code(0x"+this.code.toString(16)+")"+b.Error.NG[1];return;case 1:var c=arguments[0];if(c instanceof b.MiMicException){this.code=c.code;e=" \nfrom "+c.message}else{if(typeof c=="object"&&c.length==2){this.code=c[0];e=c[1]}else{this.code=b.Error.NG[0];e=b.Error.NG[1]+" "+(((typeof c)!="undefined")?c.toString():"v==undefined")}}this.message=f+" code(0x"+this.code.toString(16)+")"+e;return;default:break}throw new b.MiMicException("Invalid MiMicException argument.")};b.MiMicException.prototype={code:null,message:"",alert:function(){alert(this.message)},toString:function(){return"MiMicException:"+this.message}}}());(function(){var NS=MiMicJS;NS.Rpc=function Rpc(i_event){this._event=(i_event)?i_event:null};NS.Rpc.prototype={_event:null,_ws:null,rtt:0,_method_id:0,open:function open(i_url){var _t=this;if(this._ws){throw new MiMicException()}var q=new Array();var ev=this._event;var ws=new WebSocket(i_url);ws.onopen=function(){if(ev.onOpen){ev.onOpen()}};ws.onclose=function(){if(ev.onClose){ev.onClose()}};ws.error=function(){_t.shutdown();if(ev.onClose){ev.onError()}};var rx="";var rxst=0;var _t=this;ws.onmessage=function(e){for(var i=0;i<e.data.length;i++){var t=e.data[i];switch(rxst){case 2:if(t!='"'){rxst=1}break;case 0:if(t!="{"){continue}rx="({";rxst=1;continue;case 1:switch(t){case'"':rxst=2;break;case"}":rx+="})";rxst=0;var j=eval(rx);for(var i2=q.length-1;i2>=0;i2--){if(q[i2][0]==j.id){var qi=q[i2];q.splice(i2,1);if(qi[1]){qi[1](j)}break}}continue}}rx+=t}};this._method_id=0;this._q=q;this._ws=ws},close:function close(){if(this._ws&&this._ws.readyState==1){this._ws.close();this._ws=null}},shutdown:function shutdown(){var _t=this;if(_t._ws){_t._ws.onopen=function(){_t._ws.close()};_t._ws.onmessage=function(){_t._ws.close()};_t._ws.onclose=function(){_t._ws=null};_t._ws.onerror=function(){_t._ws=null}}},sendMethod:function callJsonRpc(i_method,i_params,i_callback){this._ws.send('{"verdion":"2.0","method":"'+i_method+'","params":['+i_params+'],"id":'+this._method_id+"}");this._q.push([this._method_id,i_callback]);this._method_id=(this._method_id+1)&268435455;return this._method_id}}}());var mbedJS={};(function(){var a=mbedJS;a.PinName=function(){var e;var d={};e=65536;for(var b=0;b<=5;b++){for(var c=0;c<=31;c++){d["P"+b+"_"+c]=e+b*32+c}}e=131072;for(var b=5;b<=40;b++){d["p"+b]=e+b}e=196608|0;d.LED1=e+0;d.LED2=e+1;d.LED3=e+2;d.LED4=e+3;e=196608|256;d.USBTX=e+0;d.USBRX=e+1;e=262144;for(var b=0;b<=15;b++){d["D"+b]=e+b}for(var b=0;b<=5;b++){d["A"+b]=e+b+256}d.I2C_SCL=e+512+0;d.I2C_SDA=e+512+1;d.NC=2147483647;return d}();a.PinMode={PullUp:65536,PullDown:65537,PullNone:65538,OpenDrain:65539,PullDefault:65540};a.PortName={Port0:65536,Port1:65537,Port2:65538,Port3:65539,Port4:65540}}());(function(){var d=mbedJS;var b=MiMicJS;var e=function g(i,n,m){try{var j=this;j._mcu=i;j._lc=e;if(b.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(o){j._oid=o.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}b.assertInt(n);return j._mcu.rpc(j.RPC_NS+":_new1",n,h)}catch(l){throw new b.MiMicException(l)}};e.prototype={RPC_NS:"mbedJS:AnalogIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function c(){try{if(this._lc!=e){throw new b.MiMicException(b.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(h){throw new b.MiMicException(h)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}h._lc=e.read;return h._mcu.rpc(h.RPC_NS+":read_fx",h._oid,function(m){var l=m.result[0]/10000;if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new b.MiMicException(i)}},read_u16:function f(){try{var h=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}h._lc=e.read_u16;return h._mcu.rpc(h.RPC_NS+":read_u16",h._oid,function(m){var l=m.result[0];if(h._event.onRead_u16){h._event.onRead_u16(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new b.MiMicException(i)}}};d.AnalogIn=e}());(function(){var b=mbedJS;var a=MiMicJS;var e=function h(j,o,n){try{var l=this;l._mcu=j;l._lc=e;if(a.isGenerator(n)){l._gen=n}else{if(n){l._event=n}}function i(p){l._oid=p.result[0];if(l._event.onNew){l._event.onNew()}if(l._gen){l._gen.next(l)}l._lc=null}a.assertInt(o);return l._mcu.rpc(l.RPC_NS+":_new1",o,i)}catch(m){throw new a.MiMicException(m)}};e.prototype={RPC_NS:"mbedJS:AnalogOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function d(){try{if(this._lc!=e){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(i){throw new a.MiMicException(i)}},write:function g(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.write;a.assertNumber(i);return j._mcu.rpc(j.RPC_NS+":write_fx",j._oid+","+Math.round(i*10000),function(m){if(j._event.onWrite){j._event.onWrite()}if(j._gen){j._gen.next()}j._lc=null})}catch(l){throw new a.MiMicException(l)}},write_u16:function c(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.write;a.assertInt(i);return j._mcu.rpc(j.RPC_NS+":write_fx",j._oid+","+i,function(m){if(j._event.onWrite_u16){j._event.onWrite_u16()}if(j._gen){j._gen.next()}j._lc=null})}catch(l){throw new a.MiMicException(l)}},read:function f(){try{var i=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}i._lc=e.read;return i._mcu.rpc(i.RPC_NS+":read_fx",i._oid,function(m){var l=m.result[0]/10000;if(i._event.onRead){i._event.onRead(l)}if(i._gen){i._gen.next(l)}i._lc=null})}catch(j){throw new a.MiMicException(j)}}};b.AnalogOut=e}());(function(){var e=mbedJS;var c=MiMicJS;var f=function d(j,h,n){try{var r=this;r._mcu=j;r._lc=f;if(c.isGenerator(n)){r._gen=n}else{if(n){r._event=n}}function l(i){r._oid=i.result[0];if(r._event.onNew){r._event.onNew()}if(r._gen){r._gen.next(r)}r._lc=null}var o=h;if(o.length<1||o.length>16){throw new c.MiMicException(c.NG_INVALID_ARG)}c.assertInt(o);var m=o[0];var p=1;for(;p<h.length;p++){m+=","+o[p]}for(;p<16;p++){m+=","+e.PinName.NC}return r._mcu.rpc(r.RPC_NS+":_new1",m,l)}catch(q){throw new c.MiMicException(q)}};f.prototype={RPC_NS:"mbedJS:BusIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function g(){try{if(this._lc!=f){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=f.waitForNew}catch(h){throw new c.MiMicException(h)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}h._lc=f.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new c.MiMicException(i)}},mode:function b(h){try{var i=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}i._lc=f.mode;c.assertInt(h);return i._mcu.rpc(i.RPC_NS+":mode",i._oid+","+h,function(m){var l=m.result[0];if(i._event.onMode){i._event.onMode(l)}if(i._gen){i._gen.next(l)}i._lc=null})}catch(j){throw new c.MiMicException(j)}}};e.BusIn=f}());(function(){var c=mbedJS;var a=MiMicJS;var i=function e(m,l,p){try{var t=this;t._mcu=m;t._lc=i;if(a.isGenerator(p)){t._gen=p}else{if(p){t._event=p}}function n(u){t._oid=u.result[0];if(t._event.onNew){t._event.onNew()}if(t._gen){t._gen.next(t)}t._lc=null}var q=l;a.assertInt(q);if(q.length<1||q.length>16){throw new a.MiMicException(a.NG_INVALID_ARG)}var o=q[0];var r=1;for(;r<l.length;r++){o+=","+q[r]}for(;r<16;r++){o+=","+c.PinName.NC}return t._mcu.rpc(t.RPC_NS+":_new1",o,n)}catch(s){throw new a.MiMicException(s)}};i.prototype={RPC_NS:"mbedJS:BusInOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function d(){try{if(this._lc!=i){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=i.waitForNew}catch(l){throw new a.MiMicException(l)}},write:function f(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=i.write;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":write",m._oid+","+l,function(o){if(m._event.onWrite){m._event.onWrite()}if(m._gen){m._gen.next()}m._lc=null})}catch(n){throw new a.MiMicException(n)}},read:function j(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=i.read;return l._mcu.rpc(l.RPC_NS+":read",l._oid,function(o){var n=o.result[0];if(l._event.onRead){l._event.onRead(n)}if(l._gen){l._gen.next(n)}l._lc=null})}catch(m){throw new a.MiMicException(m)}},mode:function g(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=i.mode;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":mode",m._oid+","+l,function(p){var o=p.result[0];if(m._event.onMode){m._event.onMode(o)}if(m._gen){m._gen.next(o)}m._lc=null})}catch(n){throw new a.MiMicException(n)}},input:function b(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=i.input;return l._mcu.rpc(l.RPC_NS+":input",l._oid,function(n){if(l._event.onInput){l._event.onInput()}if(l._gen){l._gen.next()}l._lc=null})}catch(m){throw new a.MiMicException(m)}},output:function h(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=i.mode;return l._mcu.rpc(l.RPC_NS+":output",l._oid,function(n){if(l._event.onOutput){l._event.onOutput()}if(l._gen){l._gen.next()}l._lc=null})}catch(m){throw new a.MiMicException(m)}}};c.BusInOut=i}());(function(){var f=mbedJS;var c=MiMicJS;var g=function d(j,h,n){try{var r=this;r._mcu=j;r._lc=g;if(c.isGenerator(n)){r._gen=n}else{if(n){r._event=n}}function l(i){r._oid=i.result[0];if(r._event.onNew){r._event.onNew()}if(r._gen){r._gen.next(r)}r._lc=null}var o=h;if(o.length<1||o.length>16){throw new c.MiMicException(c.NG_INVALID_ARG)}c.assertInt(o);var m=o[0];var p=1;for(;p<h.length;p++){m+=","+o[p]}for(;p<16;p++){m+=","+f.PinName.NC}return r._mcu.rpc(r.RPC_NS+":_new1",m,l)}catch(q){throw new c.MiMicException(q)}};g.prototype={RPC_NS:"mbedJS:BusOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function b(){try{if(this._lc!=g){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=g.waitForNew}catch(h){throw new c.MiMicException(h)}},write:function e(h){try{var i=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}i._lc=g.write;c.assertInt(h);return i._mcu.rpc(i.RPC_NS+":write",i._oid+","+h,function(l){if(i._event.onWrite){i._event.onWrite()}if(i._gen){i._gen.next()}i._lc=null})}catch(j){throw new c.MiMicException(j)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}h._lc=g.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new c.MiMicException(i)}}};f.BusOut=g}());(function(){var e=mbedJS;var d=MiMicJS;var f=function g(i,n,m){try{var j=this;j._mcu=i;j._lc=f;if(d.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(o){j._oid=o.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}d.assertInt(n);return j._mcu.rpc(j.RPC_NS+":_new1",n,h)}catch(l){throw new d.MiMicException(l)}};f.prototype={RPC_NS:"mbedJS:DigitalIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function c(){try{if(this._lc!=f){throw new d.MiMicException(d.Error.NG_ILLEGAL_CALL)}this._lc=f.waitForNew}catch(h){throw new d.MiMicException(h)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new d.MiMicException(d.Error.NG_YIELD_NOT_COMPLETED)}h._lc=f.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new d.MiMicException(i)}},mode:function b(h){try{var i=this;if(this._gen&&this._lc){throw new d.MiMicException(d.Error.NG_YIELD_NOT_COMPLETED)}i._lc=f.mode;d.assertInt(h);return i._mcu.rpc(i.RPC_NS+":mode",i._oid+","+h,function(m){var l=m.result[0];if(i._event.onMode){i._event.onMode(l)}if(i._gen){i._gen.next(l)}i._lc=null})}catch(j){throw new d.MiMicException(j)}}};e.DigitalIn=f}());(function(){var c=mbedJS;var b=MiMicJS;var e=function g(i,n,m){try{var j=this;j._mcu=i;j._lc=e;if(b.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(p){j._oid=p.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}var o;if(b.isHashArray(n)){o=[n.pin,n.value]}else{if(b.isArray(n)){o=[n[0],null]}else{o=[n,null]}}b.assertInt(o[0]);if(o[1]){b.assertInt(o[1]);return j._mcu.rpc(j.RPC_NS+":_new2",o[0]+","+o[1],h)}else{return j._mcu.rpc(j.RPC_NS+":_new1",o[0],h)}}catch(l){throw new b.MiMicException(l)}};e.prototype={RPC_NS:"mbedJS:DigitalOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function f(){try{if(this._lc!=e){throw new b.MiMicException(b.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(h){throw new b.MiMicException(h)}},write:function a(h){try{var i=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}i._lc=e.write;b.assertInt(h);return i._mcu.rpc(i.RPC_NS+":write",i._oid+","+h,function(l){if(i._event.onWrite){i._event.onWrite()}if(i._gen){i._gen.next()}i._lc=null})}catch(j){throw new b.MiMicException(j)}},read:function d(){try{var h=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}h._lc=e.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new b.MiMicException(i)}}};c.DigitalOut=e}());(function(){var f=mbedJS;var d=MiMicJS;var g=function c(l,n){var j=this;j._lc=g;j._has_error=false;if(d.isGenerator(n)){j._gen=n}else{if(n){j._event=n}}j._rpc=new d.Rpc({onOpen:function m(){if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j.lc=null},onClose:function o(){if(j._lc==g.close){if(j._event.onClose){j._event.onClose()}}else{if(j._event.onError){j._event.onError()}}if(j._gen){j._gen.next(j)}j.lc=null},onError:function i(){j._has_error=true;if(j._event.onError){j._event.onError()}if(j._gen&&j._lc){j._gen.throw(new d.MiMicException())}}});this._rpc.open("ws://"+l+"/rpc/")};g.prototype={_lc:null,_rpc:null,_gen:null,_event:{},_has_error:false,hasError:function(){return _t._has_error},waitForNew:function e(){if(this._lc!=g){throw new d.MiMicException(d.Error.NG_ILLEGAL_CALL)}this._lc=g.waitForNew},close:function b(){if(this._gen&&this._lc){throw new d.MiMicException(d.Error.NG_YIELD_NOT_COMPLETED)}this._lc=g.close;this._rpc.close()},shutdown:function a(){this._rpc.shutdown()},rpc:function h(i,j,l){if(this._has_error){throw new d.MiMicException()}return this._rpc.sendMethod(i,j,l)},addItem:function(i){this._items.push(i)}};f.Mcu=g}());(function(){var d=mbedJS;var b=MiMicJS;var e=function c(h,m,l){try{var i=this;i._mcu=h;i._lc=e;if(b.isGenerator(l)){i._gen=l}else{if(l){i._event=l}}function g(o){i._oid=o.result[0];if(i._event.onNew){i._event.onNew()}if(i._gen){i._gen.next(i)}i._lc=null}var n;if(b.isHashArray(m)){n=[m.port,m.mask]}else{if(b.isArray(m)){n=m}}b.assertInt(n);return i._mcu.rpc(i.RPC_NS+":_new1",n[0]+","+n[1],g)}catch(j){throw new b.MiMicException(j)}};e.prototype={RPC_NS:"mbedJS:PortIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function a(){try{if(this._lc!=e){throw new b.MiMicException(b.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(g){throw new b.MiMicException(g)}},read:function f(){try{var g=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}g._lc=e.read;return g._mcu.rpc(g.RPC_NS+":read",g._oid,function(l){var i=l.result[0];if(g._event.onRead){g._event.onRead(i)}if(g._gen){g._gen.next(i)}g._lc=null})}catch(h){throw new b.MiMicException(h)}}};d.PortIn=e}());(function(){var e=mbedJS;var c=MiMicJS;var f=function a(i,n,m){try{var j=this;j._mcu=i;j._lc=f;if(c.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(p){j._oid=p.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}var o;if(c.isHashArray(n)){o=[n.port,n.mask]}else{if(c.isArray(n)){o=n}}c.assertInt(o);return j._mcu.rpc(j.RPC_NS+":_new1",o[0]+","+o[1],h)}catch(l){throw new c.MiMicException(l)}};f.prototype={RPC_NS:"mbedJS:PortOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function g(){try{if(this._lc!=f){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=f.waitForNew}catch(h){throw new c.MiMicException(h)}},write:function d(h){try{var i=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}i._lc=f.write;c.assertInt(h);return i._mcu.rpc(i.RPC_NS+":write",i._oid+","+h,function(l){if(i._event.onWrite){i._event.onWrite()}if(i._gen){i._gen.next()}i._lc=null})}catch(j){throw new c.MiMicException(j)}},read:function b(){try{var h=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}h._lc=f.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new c.MiMicException(i)}}};e.PortOut=f}());(function(){var g=mbedJS;var c=MiMicJS;var n=function h(p,t,s){try{var q=this;q._mcu=p;q._lc=n;if(c.isGenerator(s)){q._gen=s}else{if(s){q._event=s}}function o(u){q._oid=u.result[0];if(q._event.onNew){q._event.onNew()}if(q._gen){q._gen.next(q)}q._lc=null}c.assertInt(t);return q._mcu.rpc(q.RPC_NS+":_new1",t,o)}catch(r){throw new c.MiMicException(r)}};n.prototype={RPC_NS:"mbedJS:PwmOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function b(){try{if(this._lc!=n){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=n.waitForNew}catch(o){throw new c.MiMicException(o)}},write:function j(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.write;c.assertNumber(o);return p._mcu.rpc(p.RPC_NS+":write_fx",p._oid+","+Math.round(o*10000),function(r){if(p._event.onWrite){p._event.onWrite()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},read:function m(){try{var o=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}o._lc=n.read;return o._mcu.rpc(o.RPC_NS+":read_fx",o._oid,function(r){var q=r.result[0]/10000;if(o._event.onRead){o._event.onRead(q)}if(o._gen){o._gen.next(q)}o._lc=null})}catch(p){throw new c.MiMicException(p)}},period:function l(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.period;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":period_fx",p._oid+","+Math.round(o*10000),function(r){if(p._event.onPeriod){p._event.onPeriod()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},period_ms:function e(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.period_ms;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":period_ms",p._oid+","+Math.round(o),function(r){if(p._event.onPeriod_ms){p._event.onPeriod_ms()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},period_us:function i(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.period_us;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":period_us",p._oid+","+Math.round(o),function(r){if(p._event.onPeriod_us){p._event.onPeriod_us()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},pulsewidth:function d(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.pulsewidth;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":pulsewidth_fx",p._oid+","+Math.round(o*10000),function(r){if(p._event.onPulsewidth){p._event.onPulsewidth()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},pulsewidth_ms:function a(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.pulsewidth_ms;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":pulsewidth_ms",p._oid+","+Math.round(o),function(r){if(p._event.onPulsewidth_ms){p._event.onPulsewidth_ms()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},pulsewidth_us:function f(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.pulsewidth_us;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":pulsewidth_us",p._oid+","+Math.round(o),function(r){if(p._event.onPulsewidth_us){p._event.onPulsewidth_us()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}}};g.PwmOut=n}());(function(){var b=mbedJS;var a=MiMicJS;var e=function d(j,o,n){try{var l=this;l._mcu=j;l._lc=e;if(a.isGenerator(n)){l._gen=n}else{if(n){l._event=n}}function i(p){l._oid=p.result[0];if(l._event.onNew){l._event.onNew()}if(l._gen){l._gen.next(l)}l._lc=null}a.assertInt(o);return l._mcu.rpc(l.RPC_NS+":_new1",o[0]+","+o[1]+","+o[2]+","+b.PinName.NC,i)}catch(m){throw new a.MiMicException(m)}};e.prototype={RPC_NS:"mbedJS:SPI",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function h(){try{if(this._lc!=e){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(i){throw new a.MiMicException(i)}},write:function g(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.write;a.assertInt(i);return j._mcu.rpc(j.RPC_NS+":write",j._oid+","+i,function(n){var m=n.result[0];if(j._event.onWrite){j._event.onWrite(m)}if(j._gen){j._gen.next(m)}j._lc=null})}catch(l){throw new a.MiMicException(l)}},frequency:function c(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.frequency;a.assertInt(i);return j._mcu.rpc(j.RPC_NS+":frequency",j._oid+","+i,function(m){if(j._event.onFrequency){j._event.onFrequency()}if(j._gen){j._gen.next()}j._lc=null})}catch(l){throw new a.MiMicException(l)}},format:function f(i,j){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=e.format;var n=j?j:0;a.assertInt([i,n]);return l._mcu.rpc(l.RPC_NS+":format",l._oid+","+i+","+n,function(o){if(l._event.onFormat){l._event.onFormat()}if(l._gen){l._gen.next()}l._lc=null})}catch(m){throw new a.MiMicException(m)}}};b.SPI=e}());(function(){var d=mbedJS;var a=MiMicJS;var j=function c(m,q,p){try{var n=this;n._mcu=m;n._lc=j;if(a.isGenerator(p)){n._gen=p}else{if(p){n._event=p}}function l(r){n._oid=r.result[0];if(n._event.onNew){n._event.onNew()}if(n._gen){n._gen.next(n)}n._lc=null}a.assertInt(q);return n._mcu.rpc(n.RPC_NS+":_new1",q[0]+","+q[1]+","+q[2]+","+q[3],l)}catch(o){throw new a.MiMicException(o)}};j.prototype={RPC_NS:"mbedJS:SPISlave",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function b(){try{if(this._lc!=j){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=j.waitForNew}catch(l){throw new a.MiMicException(l)}},frequency:function i(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=j.frequency;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":frequency",m._oid+","+l,function(o){if(m._event.onFrequency){m._event.onFrequency()}if(m._gen){m._gen.next()}m._lc=null})}catch(n){throw new a.MiMicException(n)}},format:function h(l,m){try{var n=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}n._lc=j.format;var p=m?m:0;a.assertInt([l,p]);return n._mcu.rpc(n.RPC_NS+":format",n._oid+","+l+","+p,function(q){if(n._event.onFormat){n._event.onFormat()}if(n._gen){n._gen.next()}n._lc=null})}catch(o){throw new a.MiMicException(o)}},read:function g(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=j.read;return l._mcu.rpc(l.RPC_NS+":read",l._oid,function(o){var n=o.result[0];if(l._event.onRead){l._event.onRead(n)}if(l._gen){l._gen.next(n)}l._lc=null})}catch(m){throw new a.MiMicException(m)}},receive:function e(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=j.receive;return l._mcu.rpc(l.RPC_NS+":receive",l._oid,function(o){var n=o.result[0];if(l._event.onReceive){l._event.onReceive(n)}if(l._gen){l._gen.next(n)}l._lc=null})}catch(m){throw new a.MiMicException(m)}},reply:function f(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=j.reply;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":reply",m._oid+","+l,function(o){if(m._event.onReply){m._event.onReply()}if(m._gen){m._gen.next()}m._lc=null})}catch(n){throw new a.MiMicException(n)}}};d.SPISlave=j}());
\ No newline at end of file
--- /dev/null
+++ b/misc/mbedJS/mbed.html/memDump.html
@@ -0,0 +1,274 @@
1+<html>
2+<head>
3+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4+<script src="./slib.js"></script>
5+<link href="./mimic.css" rel="stylesheet" type="text/css" />
6+<link rel="stylesheet" href="./c/codemirror-mini.css">
7+<script src="./m/MiMicCore-mini.js"></script>
8+<script src="./m/MbedM3.All-mini.js"></script>
9+<script src="./c/codemirror-mini.js"></script>
10+
11+<style id="user-style-nyatla-bg-img">
12+ body{
13+ width:95%;
14+ height:95%;
15+ }
16+ textarea {
17+ font:inherit;
18+ min-width:100%;
19+ max-width:100%;
20+ overflow-y:auto;
21+ resize:none;
22+ }
23+ hr{
24+ height:1px;
25+ color:black;
26+ }
27+ #src{
28+ height:320px;
29+ background-color:#ffffff;
30+ border:solid 1px;
31+ }
32+ button{
33+ font-weight:bold;
34+ text-align:center;
35+ font-size:12px;
36+ padding:0px;
37+ }
38+ #menu2_dump{
39+ width:50px;height:40px;
40+ }
41+ #connect_menu_address{
42+ border:solid 1px #aaaaaa;
43+ width:200px;
44+ }
45+ .tag{
46+ background-color:#4169E1;
47+ color:white;
48+ font-weight:bold;
49+ padding:0px 1px 1px 3px;
50+ }
51+ input{
52+ background-color:white;
53+ color:black;
54+ border:solid 1px #aaaaaa;
55+ }
56+ .td1{
57+ background-color:#4169E1;
58+ color:white;
59+ font-weight:bold;
60+ font-weight:bold;
61+ font-size:12px;
62+ width:120px;
63+ }
64+</style>
65+<script type="text/javascript">
66+
67+var app;
68+function getElem(id){return document.getElementById(id);}
69+
70+var Mui=new Object();
71+
72+
73+Mui.ConnectionCtrl=function(id)
74+{
75+ var _t=this;
76+ //member variables
77+ _t._tags={
78+ input:getElem(id+"_address")
79+ };
80+ //initialize
81+ _t.getAddressText=function(){
82+ return _t._tags.input.value;
83+ }
84+ _t.setAddressText=function(v){
85+ _t._tags.input.value=v;
86+ }
87+}
88+
89+
90+Mui.CodeEditor=function(id)
91+{
92+ var _t=this;
93+ _t._tags={text:getElem(id)};
94+ _t._cm=CodeMirror.fromTextArea(_t._tags.text,{
95+ mode: "text/plain",
96+ styleActiveLine: true,
97+ lineNumbers: true,
98+ lineWrapping:true,
99+ readOnly:true});
100+ _t.selectall=function(){
101+ var e=this._cm;
102+ e.setSelection({line:0,ch:0},{line:e.lineCount(),ch:0});
103+ }
104+ _t.getText=function(){
105+ return this._cm.getValue();
106+ }
107+ _t.setText=function(v){
108+ this._cm.setValue(v);
109+ }
110+}
111+
112+Mui.Command=function(id)
113+{
114+ var _t=this;
115+ _t.CM_DUMP =1;
116+ _t._tags={
117+ dump:getElem(id+"_dump"),
118+ }
119+ _t.events={
120+ onCommand:null
121+ }
122+ _t._tags.dump.onclick=function(){_t._onCommand(_t.CM_DUMP);};
123+ _t._onCommand=function(eid){
124+ if(_t.events.onCommand!=null){
125+ _t.events.onCommand(eid);
126+ }
127+ }
128+ _t._tags.dump.disabled=false;
129+ _t.setEnabled=function(b)
130+ {
131+ _t._tags.dump.disabled=!b;
132+ }
133+}
134+
135+function Application()
136+{
137+ var _t=this;
138+ //initialization
139+ var ui={
140+ connect:new Mui.ConnectionCtrl("connect_menu"),
141+ source:new Mui.CodeEditor("src"),
142+ cmd:new Mui.Command("menu2")
143+ }
144+ _t.VERSION="1.0.0"
145+ _t.ui=ui;
146+ ui.connect.setAddressText(location.host);
147+
148+ var mif=null;
149+ ui.cmd.events.onCommand=function(id)
150+ {
151+ function getInt(a)
152+ {
153+ var b=slib.strtrim(a);
154+ //書式チェック
155+ if(!b.match(/^0x[0-9a-f]+$|^[0-9]+$/i)){
156+ return false;
157+ }
158+ var n=parseInt(b);
159+ if(isNaN(n))
160+ {
161+ return false;
162+ }
163+ return n;
164+ }
165+ function dump(ad,bs,cb)
166+ {
167+ var v=
168+ "Memory dump result:\nstart address: 0x"+MiMicLib.hexout(ad,8)+" "+bs+"blocks("+(bs*4)+"byte)\n"+
169+ "----------\n";
170+ var i=bs,mcu,ma;
171+ var SB=16;
172+ function loop()
173+ {
174+ try{
175+ if(i%SB!=0){
176+ var rd=ma.read32(ad,bs%SB*4);
177+ for(var i2=0;i2<bs%SB;i2++,ad+=4){
178+ v+="0x"+MiMicLib.hexout(ad,8)+": 0x"+MiMicLib.hexout(rd[i2],8)+"\n"
179+ }
180+ i-=bs%SB;
181+ }else{
182+ var rd=ma.read32(ad,SB*4);
183+ for(var i2=0;i2<SB;i2++,ad+=4){
184+ v+="0x"+MiMicLib.hexout(ad,8)+": 0x"+MiMicLib.hexout(rd[i2],8)+"\n"
185+ }
186+ i-=SB;
187+ }
188+ if(i>0){
189+ ui.source.setText("Reading Memory...\n"+((bs-i)*4)+"/"+(bs*4)+"byte");
190+ setTimeout(loop,0);
191+ }else{
192+ mcu.deactivate();
193+ ui.source.setText(v);
194+ cb();
195+ }
196+ }catch(e){
197+ mcu.deactivate();
198+ alert("An error occurred while retrieving memory.\n"+e);
199+ ui.source.setText("ERROR.");
200+ }
201+ }
202+ try{
203+ mcu=new MbedM3.Mcu(ui.connect.getAddressText());
204+ try{
205+ ma=new MbedM3.Memory(mcu);
206+ ui.source.setText("Reading memory block...");
207+ setTimeout(loop,10);
208+ }catch(e){
209+ mcu.deactivate();
210+ alert("Error[1]: "+ui.connect.getAddressText()+"\n"+e);
211+ }
212+ }catch(e){
213+ alert("Can not connect to MiMicRemoteMCU.\nAddress: "+ui.connect.getAddressText()+"\n"+e);
214+ ui.source.setText("ERROR.");
215+ }
216+ }
217+
218+ switch(id){
219+ case ui.cmd.CM_DUMP:
220+ var addr=ui.connect.getAddressText();
221+ if(addr.length==0){
222+ alert("Failed! No input MCU adderss.");
223+ return;
224+ }
225+ var ad=getInt(getElem("in_memaddr").value);
226+ var bs=getInt(getElem("in_block").value);
227+ if(ad===false || ad%4!=0){
228+ alert("Memory address must be unsigned integer of 32bit alignment.");
229+ return;
230+ }
231+ if(bs===false){
232+ alert("Number of blocks must be unsigned integer.");
233+ return;
234+ }
235+ ui.cmd.setEnabled(false);
236+ dump(ad,bs,function(){ui.cmd.setEnabled(true);});
237+ return;
238+ default:
239+ alert("unknown command id");
240+ }
241+ }
242+}
243+function init()
244+{
245+ app=new Application();
246+}
247+
248+</script>
249+</head>
250+<body onload="init();">
251+<h1 style="float:left;"><img src="./mimiclogo.png"/><span id="idx" >MemoryDump</span></h1>
252+<div style="float:right;" ><a href="/">Return to top</a></div>
253+<hr style="clear:both;" />
254+<div id="menu2">
255+ <button id="menu2_dump" style="float:left"/>Dump</button>
256+ <table class="table" style="float:left">
257+ <tr class="input_row">
258+ <td class="td1">Memory address</td><td><input id="in_memaddr" type="text" value="0x20080000"/></td>
259+ </tr>
260+ <tr class="input_row"><td class="td1">Number of blocks</td><td><input id="in_block" type="text" value="1"/></td></tr>
261+ </table>
262+
263+ <div id="connect_menu" style="float:right">
264+ MCU Address:<input id="connect_menu_address" type="text"></input>
265+ </div>
266+</div>
267+<div class="tag" style="clear:both">Dump Result</div>
268+ <textarea id="src"></textarea>
269+</div>
270+<div class="footer">
271+ MiMic project<br/>Copyright (C) 2011-2013 <a href="http://nyatla.jp">nyatla.jp</a> All Rights Reserved.
272+</div>
273+</body>
274+</html>
--- /dev/null
+++ b/misc/mbedJS/mbed.html/mimic.css
@@ -0,0 +1,22 @@
1+body{background:white;font-family:"Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;font-weight:normal;font-style:normal;font-size:14px;-webkit-font-smoothing:antialiased}
2+
3+a{color:#4169E1;font-style:normal;text-decoration:none;}
4+a:link {color:#4169E1;font-style:normal;text-decoration:none;}
5+a:visited{color:#4169E1;text-decoration:none;}
6+a:hover{color:#4169E1;font-style:normal;text-decoration:underline;}
7+a:active {/*クリック中*/
8+ text-decoration:none;
9+}
10+
11+h1>img{
12+ height:64px;
13+ border-style: none;
14+}
15+.footer{
16+ text-align:center;
17+ margin:10px 0px 0px 0px;
18+ width:100%;
19+ border-style:solid;
20+ border-width:1px 0px 1px 0px;
21+ border-color:#777777;
22+}
Binary files /dev/null and b/misc/mbedJS/mbed.html/mimiclogo.png differ
--- /dev/null
+++ b/misc/mbedJS/mbed.html/setup.html
@@ -0,0 +1,375 @@
1+<html>
2+<head>
3+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4+<link href="./mimic.css" rel="stylesheet" type="text/css">
5+<script src="./slib.js"></script>
6+
7+<style id="user-style-nyatla-bg-img">
8+ body{
9+ width:95%;
10+ height:95%;
11+ }
12+ button{
13+ font-weight:bold;
14+ text-align:center;
15+ font-size:12px;
16+ padding:0px;
17+ width:60px;height:40px;
18+ }
19+ .exp{
20+ font-size:9px;
21+ }
22+ .table1,p{
23+ width:480px;
24+ }
25+ .table1 tr
26+ {
27+ height:25px;
28+ background-color:#4169E1;
29+ color:white;
30+ border:solid 1px #aaaaaa;
31+ font-weight:bold;
32+ }
33+ .table1 td
34+ {
35+ margin:2px 2px 2px 2px;
36+ padding:2px 2px 2px 2px;
37+ font-size:12px;
38+ }
39+ .table1 .col1{
40+ width:120px;
41+ }
42+ .table1 p{
43+ font-weight:normal;
44+ width:100%;
45+ }
46+ input,select
47+ {
48+ border:solid 1px #aaaaaa;
49+ }
50+ .table1 input,select
51+ {
52+ width:200px;
53+ }
54+ .table2 input
55+ {
56+ width:100px;
57+ }
58+</style>
59+<script type="text/javascript">
60+
61+var app;
62+function getElem(id){return document.getElementById(id);}
63+
64+function str2HexArray(i_str,delim,len,digit)
65+{
66+ var l=i_str.split(delim);
67+ if(l.length==len){
68+ var r=new Array();
69+ for(var i=0;i<len;i++){
70+ var v=parseInt(l[i],digit);
71+ if(!isNaN(v) && v>=0 && v<=255){
72+ r.push(v);
73+ }else{
74+ throw "str2HexArray failed.";
75+ }
76+ }
77+ return r;
78+ }
79+ throw "str2HexArray failed.";
80+}
81+
82+function int2hex(v,d){var r=v.toString(16);while(r.length<d){r="0"+r;}return r;}
83+function int2hex2(v){return int2hex(v,2);}
84+function arrayToHex(ar)
85+{
86+ if(ar==null){return null;}
87+ var ret="";
88+ for(var i=0;i<ar.length;i++){
89+ ret+=int2hex2(ar[i]);
90+ }
91+ return ret;
92+}
93+function int2str(val){return val.toString(10);}
94+function int2IpAddr(v){return int2str((v>>24)&0xff)+"."+int2str((v>>16)&0xff)+"."+int2str((v>>8)&0xff)+"."+int2str((v>>0)&0xff);}
95+function int2MacAddr(v1,v2){return int2hex2((v1>>24)&0xff)+":"+int2hex2((v1>>16)&0xff)+":"+int2hex2((v1>>8)&0xff)+":"+int2hex2((v1>>0)&0xff)+":"+int2hex2((v2>>24)&0xff)+":"+int2hex2((v2>>16)&0xff);}
96+
97+var Ui=new Object();
98+Ui.IpAddrInput=function(id)
99+{
100+ var _t=this;
101+ var tags={
102+ input:getElem(id)
103+ };
104+ _t.getIpAddr=function(){
105+ return str2HexArray(tags.input.value,".",4,10);
106+ }
107+ _t.getText=function(){
108+ return tags.input.value;
109+ }
110+ _t.setIpValue=function(v1)
111+ {
112+ tags.input.value=int2IpAddr(v1);
113+ }
114+}
115+Ui.IpSetting=function(id)
116+{
117+ var _t=this;
118+ var tags={
119+ mode:getElem(id+"_mode"),
120+ div:getElem(id+"_div")
121+ };
122+ _t.events={
123+ onchange:null
124+ };
125+ _t.addr=new Ui.IpAddrInput(id+"_addr");
126+ _t.mask=new Ui.IpAddrInput(id+"_mask");
127+ _t.gw=new Ui.IpAddrInput(id+"_defgw");
128+ tags.mode.addEventListener("change",function()
129+ {
130+ tags.div.style.visibility=(tags.mode.selectedIndex==0)?"visible":"hidden";
131+ if(_t.events.onchange!=null){
132+ _t.events.onchange(tags.mode.selectedIndex);
133+ }
134+ });
135+ _t.setValue=function(v)
136+ {
137+ tags.mode.selectedIndex=(v.flags & 0x03);
138+ tags.div.style.visibility=(tags.mode.selectedIndex==0)?"visible":"hidden";
139+ _t.addr.setIpValue(v.ip);
140+ _t.mask.setIpValue(v.mask);
141+ _t.gw.setIpValue(v.droute);
142+ };
143+ _t.getValue=function()
144+ {
145+ var ret={};
146+ var err;
147+ try{
148+ err="IP Mode";
149+ ret.flag=tags.mode.selectedIndex;
150+ err="IP Address";
151+ ret.addr=_t.addr.getIpAddr();
152+ err="IP Mask";
153+ ret.mask=_t.mask.getIpAddr();
154+ err="IP Gateway";
155+ ret.gw=_t.gw.getIpAddr();
156+ return ret;
157+ }catch(e){
158+ throw "Invalid value:"+err;
159+ }
160+ }
161+}
162+Ui.MacAddr=function(id)
163+{
164+ var _t=this;
165+ var tags={
166+ input:getElem(id)
167+ };
168+ _t.getMacAddr=function()
169+ {
170+ try{
171+ return str2HexArray(tags.input.value,":",6,16);
172+ }catch(e){
173+ throw "Invalid MAC address '"+tags.input.value+"'";
174+ }
175+ }
176+ _t.setMacValue=function(v1,v2)
177+ {
178+ tags.input.value=int2MacAddr(v1,v2);
179+ }
180+}
181+Ui.HostName=function(id)
182+{
183+ var _t=this;
184+ var tags={
185+ input:getElem(id)
186+ };
187+ _t.getValue=function()
188+ {
189+ var r=tags.input.value;
190+ if(r.length<1 ||r.length>31 || r.match(/[^(a-z0-9_)]/i)){
191+ throw "Invalid Host name."
192+ }
193+ return r;
194+ },
195+ _t.setValue=function(v1)
196+ {
197+ tags.input.value=v1;
198+ }
199+}
200+Ui.Services=function(id)
201+{
202+ var _t=this;
203+ var tags={
204+ http_port:getElem(id+"_http_port"),
205+ mdns:getElem(id+"_mdns_sw"),
206+ upnp:getElem(id+"_upnp_sw")
207+ };
208+ _t.getValue=function()
209+ {
210+ var r={
211+ port:parseInt(tags.http_port.value),
212+ flag:(tags.mdns.selectedIndex==1?0x01:0x00)|(tags.upnp.selectedIndex==1?0x02:0x00)};
213+ if(isNaN(r.port) || r.port<=0){
214+ throw "Invalid port number";
215+ }
216+ return r;
217+ }
218+ _t.init=function(cfg)
219+ {
220+ tags.http_port.value=cfg.http_port;
221+ tags.mdns.selectedIndex=(cfg.flags&0x01)!=0?1:0;
222+ tags.upnp.selectedIndex=(cfg.flags&0x02)!=0?1:0;
223+ }
224+}
225+
226+
227+Ui.Cmd=function(id)
228+{
229+ var _t=this;
230+ var tags={
231+ update:getElem(id+"_update"),
232+ cancel:getElem(id+"_cancel")
233+ };
234+ _t.events={onupdate:null}
235+ tags.update.onclick=function()
236+ {
237+ if(_t.events.onupdate!=null){
238+ _t.events.onupdate();
239+ }
240+ }
241+ tags.cancel.onclick=function()
242+ {
243+ if(window.confirm('Do you want to cancel?')){
244+ document.location="./index.html";
245+ }
246+ }
247+ tags.update.disabled=false;
248+ _t.disable=function(){tags.update.disabled=true;}
249+}
250+
251+
252+function Application()
253+{
254+ var SETUP_API="/setup/setup.api";
255+ var ui={
256+ macaddr:new Ui.MacAddr("in_emac"),
257+ cmd:new Ui.Cmd("cmd"),
258+ ipset:new Ui.IpSetting("in_ip"),
259+ srv:new Ui.Services("srv"),
260+ hostname:new Ui.HostName("in_host")
261+ }
262+ ui.cmd.events.onupdate=function(){
263+ //値チェック
264+ try{
265+ var mac=ui.macaddr.getMacAddr();
266+ var host=ui.hostname.getValue();
267+ var ipv4=ui.ipset.getValue();
268+ var srv=ui.srv.getValue();
269+ var pm=arrayToHex(mac)+"ffff"
270+ +int2hex(ipv4.flag,8)+arrayToHex(ipv4.addr)+arrayToHex(ipv4.mask)+arrayToHex(ipv4.gw)
271+ +int2hex(srv.flag,8)+int2hex(srv.port,4)+"0000";
272+ //LPCXPressoへ送信
273+ var ret=eval("("+slib.xhr(SETUP_API+"?c=update&p="+pm+"&host="+host).responseText+")");
274+ if(ret.result!=0x0){
275+ throw "Configuration update is failed. code=0x"+ret.result;
276+ }else{
277+ throw "Configuration is changed.\n Restart the MiMicRemoteMCU to enable the setting.";
278+ }
279+ }catch(e){
280+ alert(e);
281+ }
282+
283+ }
284+ try{
285+ function setInnerHTML(n,v){getElem(n).innerHTML=v;}
286+ var cfg=eval("("+slib.xhr(SETUP_API+"?c=get").responseText+")");
287+ setInnerHTML("cur_version",cfg.application);
288+ setInnerHTML("cur_lan",cfg.landev);
289+ setInnerHTML("cur_host",cfg.cur.host);
290+ setInnerHTML("cur_mac",int2MacAddr(cfg.cur.mac00010203,cfg.cur.mac0405xxxx));
291+ setInnerHTML("cur_ip",int2IpAddr(cfg.cur.ipv4.ip));
292+ setInnerHTML("cur_mask",int2IpAddr(cfg.cur.ipv4.mask));
293+ setInnerHTML("cur_droute",int2IpAddr(cfg.cur.ipv4.droute));
294+ setInnerHTML("cur_service",
295+ "Http Port="+cfg.cur.services.http_port+","+
296+ "mDNS="+((cfg.cur.services.flags&0x01)?"Enable":"Disable")+","+
297+ "UPnP="+((cfg.cur.services.flags&0x02)?"Enable":"Disable"));
298+ ui.macaddr.setMacValue(cfg.cfg.mac00010203,cfg.cfg.mac0405xxxx);
299+ ui.ipset.setValue(cfg.cfg.ipv4);
300+ ui.hostname.setValue(cfg.cfg.host);
301+ ui.srv.init(cfg.cfg.services);
302+ }catch(e){
303+ ui.update.disable();
304+ alert("MiMic configurator failed initialization.'"+e.toString()+"'");
305+ }
306+}
307+
308+
309+function init()
310+{
311+ app=new Application();
312+}
313+
314+
315+</script>
316+</head>
317+<body onload="init();">
318+<h1 style="float:left;"><img src="./mimiclogo.png"/><span id="idx" >mbedJS configuration</span></h1>
319+<div style="float:right;" ><a href="/">Return to top</a></div>
320+<hr style="clear:both;" />
321+ <h2>Current configuration</h2>
322+ <table class="table1 ">
323+ <colgroup><col span="1" class="col1" /></colgroup>
324+ <colgroup><col span="2" class="col2" /></colgroup>
325+ <tr><td>Version</td><td><p id="cur_version"></p></td></tr>
326+ <tr><td>LAN PHY</td><td><p id="cur_lan"</p></td></tr>
327+ <tr><td>MAC Address</td><td><p id="cur_mac"></p></td></tr>
328+ <tr><td>Host Name</td><td><p id="cur_host"></p></td></tr>
329+ <tr><td>IP Address</td><td><p id="cur_ip"></p></td></tr>
330+ <tr><td>Net Mask</td><td><p id="cur_mask"></p></td></tr>
331+ <tr><td>Default Gateway</td><td><p id="cur_droute"></p></td></tr>
332+ <tr><td>Services</td><td><p id="cur_service"></p></td></tr>
333+ </table>
334+ <p class="exp">
335+If local setting file available, current information might be different with onchip-setting. To fully enable on-chip setting, please remove the setting file "/mimic.cfg" in mbed local file system or SDcard file system.
336+ </p>
337+ <h2>OnChip configuration</h2>
338+
339+ <h3>Ethernet</h3>
340+ <table class="table1">
341+ <colgroup><col span="1" class="col1" /></colgroup>
342+ <colgroup><col span="2" class="col2" /></colgroup>
343+ <tr><td>MAC Address</td><td><input id="in_emac" type="text"/></td></tr>
344+ <tr><td>Host Name</td><td><input id="in_host" type="text"/></td></tr>
345+ <tr>
346+ <td>IP Address</td>
347+ <td>
348+ <div><select id="in_ip_mode"><option>Manual</option><option>DHCP</option><option>AutoIP</option><option>AutoIP+DHCP</option></select></div>
349+ <div id="in_ip_div">
350+ <table class="table2">
351+ <tr><td>Address</td><td><input id="in_ip_addr" type="text"/></td></tr>
352+ <tr><td>Mask</td><td><input id="in_ip_mask" type="text"/></td></tr>
353+ <tr><td>Gateway</td><td><input id="in_ip_defgw" type="text"/></td></tr>
354+ </table>
355+ </div>
356+ </td>
357+ </tr>
358+ </table>
359+ <h3>Service</h3>
360+ <table class="table1">
361+ <colgroup><col span="1" class="col1" /></colgroup>
362+ <colgroup><col span="2" class="col2" /></colgroup>
363+ <tr><td>HTTP Port</td><td><input id="srv_http_port" type="text"/></td></tr>
364+ <tr><td>mDNS</td><td><select id="srv_mdns_sw"><option>Disable</option><option>Enable</option></select></td></tr>
365+ <tr><td>UPnP</td><td><select id="srv_upnp_sw"><option>Disable</option><option>Enable</option></select></td></tr>
366+ </table>
367+ <br/>
368+ <br/>
369+ <button id="cmd_update">Update</button>
370+ <button id="cmd_cancel">Cancel</button>
371+<div class="footer">
372+ MiMic project<br/>Copyright (C) 2011-2013 <a href="http://nyatla.jp">nyatla.jp</a> All Rights Reserved.
373+</div>
374+</body>
375+</html>
--- /dev/null
+++ b/misc/mbedJS/mbed.html/slib.js
@@ -0,0 +1,72 @@
1+slib={
2+ UA_MSIE :0x01,
3+ UA_FIREFOX:0x02,
4+ UA_OPERA :0x04,
5+ UA_CHROME :0x08,
6+ UA_SAFARI :0x10,
7+ UA_UNKNOWN:0x20,
8+ //UserAgent type
9+ UA:(function(){
10+ var ua=window.navigator.userAgent.toLowerCase();
11+ var str=["msie","firefox","opera","chrome","safari"];
12+ for(var i=0;i<str.length;i++){
13+ if (ua.indexOf(str[i]) > -1){return (0x01<<i);}
14+ }
15+ }()),
16+ getUrlQuery:function (s){
17+ var p =new Array();
18+ var hs = (s.indexOf('?')<0) ? new Array(): ((s.split('?'))[1].split('#'))[0].split('&');
19+ for(var i = 0; i <hs.length; i++){
20+ var n=hs[i].split('=');
21+ p[n[0]] = n.length>0?n[1]:null;
22+ }
23+ return p;
24+ },
25+ getPath:function (s){
26+ return (s.indexOf('?')<0)?((s.indexOf('#')<0)?s:s.split('#')[0]):s.split('?')[0];
27+ },
28+ downloadAsFile:function(fn,c)
29+ {
30+ if((this.UA & (this.UA_FIREFOX|this.UA_CHROME))!=0){
31+ var blob = new Blob([c]);
32+ var blobURL = (window.URL || window.webkitURL).createObjectURL(blob);
33+ var a = document.createElement('a');
34+ a.download = fn;
35+ a.href = blobURL;
36+ var evt = document.createEvent("MouseEvents");
37+ evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,a);
38+ a.dispatchEvent( evt );
39+ }else{
40+ var p = window.open("", "", "width=400,height=200");
41+ p.document.open();
42+ p.document.write(
43+ '<html><body><center>Please right-click a link and save a file.<br/><br/>'+
44+ '<a href="data:application/octet-stream,'+encodeURIComponent(c)+'" alt="'+fn+'">Download File</a>'+
45+ '</center></body></html>');
46+ p.document.close();
47+ }
48+ },
49+ strtrim:function(s){return s.replace(/^\s+|\s+$/g, "")},
50+ xhr:function(i_url,i_cb,i_method,i_data)
51+ {
52+ var x = XMLHttpRequest ? new XMLHttpRequest():new XDomainRequest();
53+ if(i_cb!=undefined){
54+ x.onreadystatechange = function(){
55+ if (x.readyState == 4){
56+ i_cb(x);
57+ }
58+ }
59+ }else{
60+ x.onreadystatechange = function(){};
61+ }
62+ x.open(i_method==undefined?"GET":i_method,i_url,false);
63+ try{
64+ x.setRequestHeader('Content-Type',"text/plain");
65+ }catch(e){
66+ alert(e);
67+ }
68+ x.send(i_data==undefined?null:i_data);
69+ return x;
70+ }
71+}
72+
Show on old repository browser